index-f06c19d5.js
466.8 KB
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))s(n);new MutationObserver(n=>{for(const r of n)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function t(n){const r={};return n.integrity&&(r.integrity=n.integrity),n.referrerPolicy&&(r.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?r.credentials="include":n.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function s(n){if(n.ep)return;n.ep=!0;const r=t(n);fetch(n.href,r)}})();function kr(i,e){const t=Object.create(null),s=i.split(",");for(let n=0;n<s.length;n++)t[s[n]]=!0;return e?n=>!!t[n.toLowerCase()]:n=>!!t[n]}const Ie={},Es=[],yt=()=>{},Xu=()=>!1,Qu=/^on[^a-z]/,zi=i=>Qu.test(i),Or=i=>i.startsWith("onUpdate:"),Be=Object.assign,Fr=(i,e)=>{const t=i.indexOf(e);t>-1&&i.splice(t,1)},Ju=Object.prototype.hasOwnProperty,ge=(i,e)=>Ju.call(i,e),le=Array.isArray,Hs=i=>Xi(i)==="[object Map]",Zu=i=>Xi(i)==="[object Set]",ce=i=>typeof i=="function",Ke=i=>typeof i=="string",Nr=i=>typeof i=="symbol",ke=i=>i!==null&&typeof i=="object",bl=i=>ke(i)&&ce(i.then)&&ce(i.catch),ef=Object.prototype.toString,Xi=i=>ef.call(i),tf=i=>Xi(i).slice(8,-1),sf=i=>Xi(i)==="[object Object]",Mr=i=>Ke(i)&&i!=="NaN"&&i[0]!=="-"&&""+parseInt(i,10)===i,Li=kr(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Qi=i=>{const e=Object.create(null);return t=>e[t]||(e[t]=i(t))},nf=/-(\w)/g,Dt=Qi(i=>i.replace(nf,(e,t)=>t?t.toUpperCase():"")),rf=/\B([A-Z])/g,ws=Qi(i=>i.replace(rf,"-$1").toLowerCase()),Ji=Qi(i=>i.charAt(0).toUpperCase()+i.slice(1)),xn=Qi(i=>i?`on${Ji(i)}`:""),Xs=(i,e)=>!Object.is(i,e),An=(i,e)=>{for(let t=0;t<i.length;t++)i[t](e)},Fi=(i,e,t)=>{Object.defineProperty(i,e,{configurable:!0,enumerable:!1,value:t})},of=i=>{const e=parseFloat(i);return isNaN(e)?i:e};let Io;const ir=()=>Io||(Io=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Ur(i){if(le(i)){const e={};for(let t=0;t<i.length;t++){const s=i[t],n=Ke(s)?uf(s):Ur(s);if(n)for(const r in n)e[r]=n[r]}return e}else{if(Ke(i))return i;if(ke(i))return i}}const af=/;(?![^(]*\))/g,lf=/:([^]+)/,cf=/\/\*[^]*?\*\//g;function uf(i){const e={};return i.replace(cf,"").split(af).forEach(t=>{if(t){const s=t.split(lf);s.length>1&&(e[s[0].trim()]=s[1].trim())}}),e}function Zi(i){let e="";if(Ke(i))e=i;else if(le(i))for(let t=0;t<i.length;t++){const s=Zi(i[t]);s&&(e+=s+" ")}else if(ke(i))for(const t in i)i[t]&&(e+=t+" ");return e.trim()}const ff="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",hf=kr(ff);function Il(i){return!!i||i===""}let ct;class df{constructor(e=!1){this.detached=e,this._active=!0,this.effects=[],this.cleanups=[],this.parent=ct,!e&&ct&&(this.index=(ct.scopes||(ct.scopes=[])).push(this)-1)}get active(){return this._active}run(e){if(this._active){const t=ct;try{return ct=this,e()}finally{ct=t}}}on(){ct=this}off(){ct=this.parent}stop(e){if(this._active){let t,s;for(t=0,s=this.effects.length;t<s;t++)this.effects[t].stop();for(t=0,s=this.cleanups.length;t<s;t++)this.cleanups[t]();if(this.scopes)for(t=0,s=this.scopes.length;t<s;t++)this.scopes[t].stop(!0);if(!this.detached&&this.parent&&!e){const n=this.parent.scopes.pop();n&&n!==this&&(this.parent.scopes[this.index]=n,n.index=this.index)}this.parent=void 0,this._active=!1}}}function gf(i,e=ct){e&&e.active&&e.effects.push(i)}function mf(){return ct}const Br=i=>{const e=new Set(i);return e.w=0,e.n=0,e},Dl=i=>(i.w&Qt)>0,Cl=i=>(i.n&Qt)>0,pf=({deps:i})=>{if(i.length)for(let e=0;e<i.length;e++)i[e].w|=Qt},yf=i=>{const{deps:e}=i;if(e.length){let t=0;for(let s=0;s<e.length;s++){const n=e[s];Dl(n)&&!Cl(n)?n.delete(i):e[t++]=n,n.w&=~Qt,n.n&=~Qt}e.length=t}},nr=new WeakMap;let Gs=0,Qt=1;const rr=30;let ht;const rs=Symbol(""),or=Symbol("");class $r{constructor(e,t=null,s){this.fn=e,this.scheduler=t,this.active=!0,this.deps=[],this.parent=void 0,gf(this,s)}run(){if(!this.active)return this.fn();let e=ht,t=qt;for(;e;){if(e===this)return;e=e.parent}try{return this.parent=ht,ht=this,qt=!0,Qt=1<<++Gs,Gs<=rr?pf(this):Do(this),this.fn()}finally{Gs<=rr&&yf(this),Qt=1<<--Gs,ht=this.parent,qt=t,this.parent=void 0,this.deferStop&&this.stop()}}stop(){ht===this?this.deferStop=!0:this.active&&(Do(this),this.onStop&&this.onStop(),this.active=!1)}}function Do(i){const{deps:e}=i;if(e.length){for(let t=0;t<e.length;t++)e[t].delete(i);e.length=0}}let qt=!0;const wl=[];function _s(){wl.push(qt),qt=!1}function Ps(){const i=wl.pop();qt=i===void 0?!0:i}function et(i,e,t){if(qt&&ht){let s=nr.get(i);s||nr.set(i,s=new Map);let n=s.get(t);n||s.set(t,n=Br()),_l(n)}}function _l(i,e){let t=!1;Gs<=rr?Cl(i)||(i.n|=Qt,t=!Dl(i)):t=!i.has(ht),t&&(i.add(ht),ht.deps.push(i))}function Ut(i,e,t,s,n,r){const o=nr.get(i);if(!o)return;let a=[];if(e==="clear")a=[...o.values()];else if(t==="length"&&le(i)){const l=Number(s);o.forEach((c,u)=>{(u==="length"||u>=l)&&a.push(c)})}else switch(t!==void 0&&a.push(o.get(t)),e){case"add":le(i)?Mr(t)&&a.push(o.get("length")):(a.push(o.get(rs)),Hs(i)&&a.push(o.get(or)));break;case"delete":le(i)||(a.push(o.get(rs)),Hs(i)&&a.push(o.get(or)));break;case"set":Hs(i)&&a.push(o.get(rs));break}if(a.length===1)a[0]&&ar(a[0]);else{const l=[];for(const c of a)c&&l.push(...c);ar(Br(l))}}function ar(i,e){const t=le(i)?i:[...i];for(const s of t)s.computed&&Co(s);for(const s of t)s.computed||Co(s)}function Co(i,e){(i!==ht||i.allowRecurse)&&(i.scheduler?i.scheduler():i.run())}const Tf=kr("__proto__,__v_isRef,__isVue"),Pl=new Set(Object.getOwnPropertyNames(Symbol).filter(i=>i!=="arguments"&&i!=="caller").map(i=>Symbol[i]).filter(Nr)),Ef=Gr(),xf=Gr(!1,!0),Af=Gr(!0),wo=Sf();function Sf(){const i={};return["includes","indexOf","lastIndexOf"].forEach(e=>{i[e]=function(...t){const s=Ee(this);for(let r=0,o=this.length;r<o;r++)et(s,"get",r+"");const n=s[e](...t);return n===-1||n===!1?s[e](...t.map(Ee)):n}}),["push","pop","shift","unshift","splice"].forEach(e=>{i[e]=function(...t){_s();const s=Ee(this)[e].apply(this,t);return Ps(),s}}),i}function vf(i){const e=Ee(this);return et(e,"has",i),e.hasOwnProperty(i)}function Gr(i=!1,e=!1){return function(s,n,r){if(n==="__v_isReactive")return!i;if(n==="__v_isReadonly")return i;if(n==="__v_isShallow")return e;if(n==="__v_raw"&&r===(i?e?Bf:Ml:e?Nl:Fl).get(s))return s;const o=le(s);if(!i){if(o&&ge(wo,n))return Reflect.get(wo,n,r);if(n==="hasOwnProperty")return vf}const a=Reflect.get(s,n,r);return(Nr(n)?Pl.has(n):Tf(n))||(i||et(s,"get",n),e)?a:je(a)?o&&Mr(n)?a:a.value:ke(a)?i?Bl(a):tn(a):a}}const Rf=kl(),Lf=kl(!0);function kl(i=!1){return function(t,s,n,r){let o=t[s];if(vs(o)&&je(o)&&!je(n))return!1;if(!i&&(!Ni(n)&&!vs(n)&&(o=Ee(o),n=Ee(n)),!le(t)&&je(o)&&!je(n)))return o.value=n,!0;const a=le(t)&&Mr(s)?Number(s)<t.length:ge(t,s),l=Reflect.set(t,s,n,r);return t===Ee(r)&&(a?Xs(n,o)&&Ut(t,"set",s,n):Ut(t,"add",s,n)),l}}function bf(i,e){const t=ge(i,e);i[e];const s=Reflect.deleteProperty(i,e);return s&&t&&Ut(i,"delete",e,void 0),s}function If(i,e){const t=Reflect.has(i,e);return(!Nr(e)||!Pl.has(e))&&et(i,"has",e),t}function Df(i){return et(i,"iterate",le(i)?"length":rs),Reflect.ownKeys(i)}const Ol={get:Ef,set:Rf,deleteProperty:bf,has:If,ownKeys:Df},Cf={get:Af,set(i,e){return!0},deleteProperty(i,e){return!0}},wf=Be({},Ol,{get:xf,set:Lf}),Kr=i=>i,en=i=>Reflect.getPrototypeOf(i);function ci(i,e,t=!1,s=!1){i=i.__v_raw;const n=Ee(i),r=Ee(e);t||(e!==r&&et(n,"get",e),et(n,"get",r));const{has:o}=en(n),a=s?Kr:t?Wr:Qs;if(o.call(n,e))return a(i.get(e));if(o.call(n,r))return a(i.get(r));i!==n&&i.get(e)}function ui(i,e=!1){const t=this.__v_raw,s=Ee(t),n=Ee(i);return e||(i!==n&&et(s,"has",i),et(s,"has",n)),i===n?t.has(i):t.has(i)||t.has(n)}function fi(i,e=!1){return i=i.__v_raw,!e&&et(Ee(i),"iterate",rs),Reflect.get(i,"size",i)}function _o(i){i=Ee(i);const e=Ee(this);return en(e).has.call(e,i)||(e.add(i),Ut(e,"add",i,i)),this}function Po(i,e){e=Ee(e);const t=Ee(this),{has:s,get:n}=en(t);let r=s.call(t,i);r||(i=Ee(i),r=s.call(t,i));const o=n.call(t,i);return t.set(i,e),r?Xs(e,o)&&Ut(t,"set",i,e):Ut(t,"add",i,e),this}function ko(i){const e=Ee(this),{has:t,get:s}=en(e);let n=t.call(e,i);n||(i=Ee(i),n=t.call(e,i)),s&&s.call(e,i);const r=e.delete(i);return n&&Ut(e,"delete",i,void 0),r}function Oo(){const i=Ee(this),e=i.size!==0,t=i.clear();return e&&Ut(i,"clear",void 0,void 0),t}function hi(i,e){return function(s,n){const r=this,o=r.__v_raw,a=Ee(o),l=e?Kr:i?Wr:Qs;return!i&&et(a,"iterate",rs),o.forEach((c,u)=>s.call(n,l(c),l(u),r))}}function di(i,e,t){return function(...s){const n=this.__v_raw,r=Ee(n),o=Hs(r),a=i==="entries"||i===Symbol.iterator&&o,l=i==="keys"&&o,c=n[i](...s),u=t?Kr:e?Wr:Qs;return!e&&et(r,"iterate",l?or:rs),{next(){const{value:f,done:h}=c.next();return h?{value:f,done:h}:{value:a?[u(f[0]),u(f[1])]:u(f),done:h}},[Symbol.iterator](){return this}}}}function $t(i){return function(...e){return i==="delete"?!1:this}}function _f(){const i={get(r){return ci(this,r)},get size(){return fi(this)},has:ui,add:_o,set:Po,delete:ko,clear:Oo,forEach:hi(!1,!1)},e={get(r){return ci(this,r,!1,!0)},get size(){return fi(this)},has:ui,add:_o,set:Po,delete:ko,clear:Oo,forEach:hi(!1,!0)},t={get(r){return ci(this,r,!0)},get size(){return fi(this,!0)},has(r){return ui.call(this,r,!0)},add:$t("add"),set:$t("set"),delete:$t("delete"),clear:$t("clear"),forEach:hi(!0,!1)},s={get(r){return ci(this,r,!0,!0)},get size(){return fi(this,!0)},has(r){return ui.call(this,r,!0)},add:$t("add"),set:$t("set"),delete:$t("delete"),clear:$t("clear"),forEach:hi(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(r=>{i[r]=di(r,!1,!1),t[r]=di(r,!0,!1),e[r]=di(r,!1,!0),s[r]=di(r,!0,!0)}),[i,t,e,s]}const[Pf,kf,Of,Ff]=_f();function Hr(i,e){const t=e?i?Ff:Of:i?kf:Pf;return(s,n,r)=>n==="__v_isReactive"?!i:n==="__v_isReadonly"?i:n==="__v_raw"?s:Reflect.get(ge(t,n)&&n in s?t:s,n,r)}const Nf={get:Hr(!1,!1)},Mf={get:Hr(!1,!0)},Uf={get:Hr(!0,!1)},Fl=new WeakMap,Nl=new WeakMap,Ml=new WeakMap,Bf=new WeakMap;function $f(i){switch(i){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Gf(i){return i.__v_skip||!Object.isExtensible(i)?0:$f(tf(i))}function tn(i){return vs(i)?i:Vr(i,!1,Ol,Nf,Fl)}function Ul(i){return Vr(i,!1,wf,Mf,Nl)}function Bl(i){return Vr(i,!0,Cf,Uf,Ml)}function Vr(i,e,t,s,n){if(!ke(i)||i.__v_raw&&!(e&&i.__v_isReactive))return i;const r=n.get(i);if(r)return r;const o=Gf(i);if(o===0)return i;const a=new Proxy(i,o===2?s:t);return n.set(i,a),a}function xs(i){return vs(i)?xs(i.__v_raw):!!(i&&i.__v_isReactive)}function vs(i){return!!(i&&i.__v_isReadonly)}function Ni(i){return!!(i&&i.__v_isShallow)}function $l(i){return xs(i)||vs(i)}function Ee(i){const e=i&&i.__v_raw;return e?Ee(e):i}function Gl(i){return Fi(i,"__v_skip",!0),i}const Qs=i=>ke(i)?tn(i):i,Wr=i=>ke(i)?Bl(i):i;function Kl(i){qt&&ht&&(i=Ee(i),_l(i.dep||(i.dep=Br())))}function Hl(i,e){i=Ee(i);const t=i.dep;t&&ar(t)}function je(i){return!!(i&&i.__v_isRef===!0)}function ps(i){return Vl(i,!1)}function Kf(i){return Vl(i,!0)}function Vl(i,e){return je(i)?i:new Hf(i,e)}class Hf{constructor(e,t){this.__v_isShallow=t,this.dep=void 0,this.__v_isRef=!0,this._rawValue=t?e:Ee(e),this._value=t?e:Qs(e)}get value(){return Kl(this),this._value}set value(e){const t=this.__v_isShallow||Ni(e)||vs(e);e=t?e:Ee(e),Xs(e,this._rawValue)&&(this._rawValue=e,this._value=t?e:Qs(e),Hl(this))}}function zt(i){return je(i)?i.value:i}const Vf={get:(i,e,t)=>zt(Reflect.get(i,e,t)),set:(i,e,t,s)=>{const n=i[e];return je(n)&&!je(t)?(n.value=t,!0):Reflect.set(i,e,t,s)}};function Wl(i){return xs(i)?i:new Proxy(i,Vf)}class Wf{constructor(e,t,s,n){this._setter=t,this.dep=void 0,this.__v_isRef=!0,this.__v_isReadonly=!1,this._dirty=!0,this.effect=new $r(e,()=>{this._dirty||(this._dirty=!0,Hl(this))}),this.effect.computed=this,this.effect.active=this._cacheable=!n,this.__v_isReadonly=s}get value(){const e=Ee(this);return Kl(e),(e._dirty||!e._cacheable)&&(e._dirty=!1,e._value=e.effect.run()),e._value}set value(e){this._setter(e)}}function Yf(i,e,t=!1){let s,n;const r=ce(i);return r?(s=i,n=yt):(s=i.get,n=i.set),new Wf(s,n,r||!n,t)}function Xt(i,e,t,s){let n;try{n=s?i(...s):i()}catch(r){sn(r,e,t)}return n}function Tt(i,e,t,s){if(ce(i)){const r=Xt(i,e,t,s);return r&&bl(r)&&r.catch(o=>{sn(o,e,t)}),r}const n=[];for(let r=0;r<i.length;r++)n.push(Tt(i[r],e,t,s));return n}function sn(i,e,t,s=!0){const n=e?e.vnode:null;if(e){let r=e.parent;const o=e.proxy,a=t;for(;r;){const c=r.ec;if(c){for(let u=0;u<c.length;u++)if(c[u](i,o,a)===!1)return}r=r.parent}const l=e.appContext.config.errorHandler;if(l){Xt(l,null,10,[i,o,a]);return}}jf(i,t,n,s)}function jf(i,e,t,s=!0){console.error(i)}let Js=!1,lr=!1;const Ye=[];let Lt=0;const As=[];let Pt=null,ss=0;const Yl=Promise.resolve();let Yr=null;function jl(i){const e=Yr||Yl;return i?e.then(this?i.bind(this):i):e}function qf(i){let e=Lt+1,t=Ye.length;for(;e<t;){const s=e+t>>>1;Zs(Ye[s])<i?e=s+1:t=s}return e}function jr(i){(!Ye.length||!Ye.includes(i,Js&&i.allowRecurse?Lt+1:Lt))&&(i.id==null?Ye.push(i):Ye.splice(qf(i.id),0,i),ql())}function ql(){!Js&&!lr&&(lr=!0,Yr=Yl.then(Xl))}function zf(i){const e=Ye.indexOf(i);e>Lt&&Ye.splice(e,1)}function Xf(i){le(i)?As.push(...i):(!Pt||!Pt.includes(i,i.allowRecurse?ss+1:ss))&&As.push(i),ql()}function Fo(i,e=Js?Lt+1:0){for(;e<Ye.length;e++){const t=Ye[e];t&&t.pre&&(Ye.splice(e,1),e--,t())}}function zl(i){if(As.length){const e=[...new Set(As)];if(As.length=0,Pt){Pt.push(...e);return}for(Pt=e,Pt.sort((t,s)=>Zs(t)-Zs(s)),ss=0;ss<Pt.length;ss++)Pt[ss]();Pt=null,ss=0}}const Zs=i=>i.id==null?1/0:i.id,Qf=(i,e)=>{const t=Zs(i)-Zs(e);if(t===0){if(i.pre&&!e.pre)return-1;if(e.pre&&!i.pre)return 1}return t};function Xl(i){lr=!1,Js=!0,Ye.sort(Qf);const e=yt;try{for(Lt=0;Lt<Ye.length;Lt++){const t=Ye[Lt];t&&t.active!==!1&&Xt(t,null,14)}}finally{Lt=0,Ye.length=0,zl(),Js=!1,Yr=null,(Ye.length||As.length)&&Xl()}}function Jf(i,e,...t){if(i.isUnmounted)return;const s=i.vnode.props||Ie;let n=t;const r=e.startsWith("update:"),o=r&&e.slice(7);if(o&&o in s){const u=`${o==="modelValue"?"model":o}Modifiers`,{number:f,trim:h}=s[u]||Ie;h&&(n=t.map(d=>Ke(d)?d.trim():d)),f&&(n=t.map(of))}let a,l=s[a=xn(e)]||s[a=xn(Dt(e))];!l&&r&&(l=s[a=xn(ws(e))]),l&&Tt(l,i,6,n);const c=s[a+"Once"];if(c){if(!i.emitted)i.emitted={};else if(i.emitted[a])return;i.emitted[a]=!0,Tt(c,i,6,n)}}function Ql(i,e,t=!1){const s=e.emitsCache,n=s.get(i);if(n!==void 0)return n;const r=i.emits;let o={},a=!1;if(!ce(i)){const l=c=>{const u=Ql(c,e,!0);u&&(a=!0,Be(o,u))};!t&&e.mixins.length&&e.mixins.forEach(l),i.extends&&l(i.extends),i.mixins&&i.mixins.forEach(l)}return!r&&!a?(ke(i)&&s.set(i,null),null):(le(r)?r.forEach(l=>o[l]=null):Be(o,r),ke(i)&&s.set(i,o),o)}function nn(i,e){return!i||!zi(e)?!1:(e=e.slice(2).replace(/Once$/,""),ge(i,e[0].toLowerCase()+e.slice(1))||ge(i,ws(e))||ge(i,e))}let ot=null,rn=null;function Mi(i){const e=ot;return ot=i,rn=i&&i.type.__scopeId||null,e}function Zf(i){rn=i}function eh(){rn=null}function th(i,e=ot,t){if(!e||i._n)return i;const s=(...n)=>{s._d&&Yo(-1);const r=Mi(e);let o;try{o=i(...n)}finally{Mi(r),s._d&&Yo(1)}return o};return s._n=!0,s._c=!0,s._d=!0,s}function Sn(i){const{type:e,vnode:t,proxy:s,withProxy:n,props:r,propsOptions:[o],slots:a,attrs:l,emit:c,render:u,renderCache:f,data:h,setupState:d,ctx:g,inheritAttrs:m}=i;let y,T;const x=Mi(i);try{if(t.shapeFlag&4){const R=n||s;y=vt(u.call(R,R,f,r,d,h,g)),T=l}else{const R=e;y=vt(R.length>1?R(r,{attrs:l,slots:a,emit:c}):R(r,null)),T=e.props?l:sh(l)}}catch(R){Ws.length=0,sn(R,i,1),y=Ze(ls)}let S=y;if(T&&m!==!1){const R=Object.keys(T),{shapeFlag:b}=S;R.length&&b&7&&(o&&R.some(Or)&&(T=ih(T,o)),S=Ls(S,T))}return t.dirs&&(S=Ls(S),S.dirs=S.dirs?S.dirs.concat(t.dirs):t.dirs),t.transition&&(S.transition=t.transition),y=S,Mi(x),y}const sh=i=>{let e;for(const t in i)(t==="class"||t==="style"||zi(t))&&((e||(e={}))[t]=i[t]);return e},ih=(i,e)=>{const t={};for(const s in i)(!Or(s)||!(s.slice(9)in e))&&(t[s]=i[s]);return t};function nh(i,e,t){const{props:s,children:n,component:r}=i,{props:o,children:a,patchFlag:l}=e,c=r.emitsOptions;if(e.dirs||e.transition)return!0;if(t&&l>=0){if(l&1024)return!0;if(l&16)return s?No(s,o,c):!!o;if(l&8){const u=e.dynamicProps;for(let f=0;f<u.length;f++){const h=u[f];if(o[h]!==s[h]&&!nn(c,h))return!0}}}else return(n||a)&&(!a||!a.$stable)?!0:s===o?!1:s?o?No(s,o,c):!0:!!o;return!1}function No(i,e,t){const s=Object.keys(e);if(s.length!==Object.keys(i).length)return!0;for(let n=0;n<s.length;n++){const r=s[n];if(e[r]!==i[r]&&!nn(t,r))return!0}return!1}function rh({vnode:i,parent:e},t){for(;e&&e.subTree===i;)(i=e.vnode).el=t,e=e.parent}const oh=i=>i.__isSuspense;function ah(i,e){e&&e.pendingBranch?le(i)?e.effects.push(...i):e.effects.push(i):Xf(i)}const gi={};function bi(i,e,t){return Jl(i,e,t)}function Jl(i,e,{immediate:t,deep:s,flush:n,onTrack:r,onTrigger:o}=Ie){var a;const l=mf()===((a=Ge)==null?void 0:a.scope)?Ge:null;let c,u=!1,f=!1;if(je(i)?(c=()=>i.value,u=Ni(i)):xs(i)?(c=()=>i,s=!0):le(i)?(f=!0,u=i.some(R=>xs(R)||Ni(R)),c=()=>i.map(R=>{if(je(R))return R.value;if(xs(R))return ns(R);if(ce(R))return Xt(R,l,2)})):ce(i)?e?c=()=>Xt(i,l,2):c=()=>{if(!(l&&l.isUnmounted))return h&&h(),Tt(i,l,3,[d])}:c=yt,e&&s){const R=c;c=()=>ns(R())}let h,d=R=>{h=x.onStop=()=>{Xt(R,l,4)}},g;if(ti)if(d=yt,e?t&&Tt(e,l,3,[c(),f?[]:void 0,d]):c(),n==="sync"){const R=sd();g=R.__watcherHandles||(R.__watcherHandles=[])}else return yt;let m=f?new Array(i.length).fill(gi):gi;const y=()=>{if(x.active)if(e){const R=x.run();(s||u||(f?R.some((b,M)=>Xs(b,m[M])):Xs(R,m)))&&(h&&h(),Tt(e,l,3,[R,m===gi?void 0:f&&m[0]===gi?[]:m,d]),m=R)}else x.run()};y.allowRecurse=!!e;let T;n==="sync"?T=y:n==="post"?T=()=>Qe(y,l&&l.suspense):(y.pre=!0,l&&(y.id=l.uid),T=()=>jr(y));const x=new $r(c,T);e?t?y():m=x.run():n==="post"?Qe(x.run.bind(x),l&&l.suspense):x.run();const S=()=>{x.stop(),l&&l.scope&&Fr(l.scope.effects,x)};return g&&g.push(S),S}function lh(i,e,t){const s=this.proxy,n=Ke(i)?i.includes(".")?Zl(s,i):()=>s[i]:i.bind(s,s);let r;ce(e)?r=e:(r=e.handler,t=e);const o=Ge;bs(this);const a=Jl(n,r.bind(s),t);return o?bs(o):os(),a}function Zl(i,e){const t=e.split(".");return()=>{let s=i;for(let n=0;n<t.length&&s;n++)s=s[t[n]];return s}}function ns(i,e){if(!ke(i)||i.__v_skip||(e=e||new Set,e.has(i)))return i;if(e.add(i),je(i))ns(i.value,e);else if(le(i))for(let t=0;t<i.length;t++)ns(i[t],e);else if(Zu(i)||Hs(i))i.forEach(t=>{ns(t,e)});else if(sf(i))for(const t in i)ns(i[t],e);return i}function ch(i,e){const t=ot;if(t===null)return i;const s=cn(t)||t.proxy,n=i.dirs||(i.dirs=[]);for(let r=0;r<e.length;r++){let[o,a,l,c=Ie]=e[r];o&&(ce(o)&&(o={mounted:o,updated:o}),o.deep&&ns(a),n.push({dir:o,instance:s,value:a,oldValue:void 0,arg:l,modifiers:c}))}return i}function Jt(i,e,t,s){const n=i.dirs,r=e&&e.dirs;for(let o=0;o<n.length;o++){const a=n[o];r&&(a.oldValue=r[o].value);let l=a.dir[s];l&&(_s(),Tt(l,t,8,[i.el,a,i,e]),Ps())}}function ec(i,e){return ce(i)?(()=>Be({name:i.name},e,{setup:i}))():i}const Ii=i=>!!i.type.__asyncLoader,tc=i=>i.type.__isKeepAlive;function uh(i,e){sc(i,"a",e)}function fh(i,e){sc(i,"da",e)}function sc(i,e,t=Ge){const s=i.__wdc||(i.__wdc=()=>{let n=t;for(;n;){if(n.isDeactivated)return;n=n.parent}return i()});if(on(e,s,t),t){let n=t.parent;for(;n&&n.parent;)tc(n.parent.vnode)&&hh(s,e,t,n),n=n.parent}}function hh(i,e,t,s){const n=on(e,i,s,!0);ic(()=>{Fr(s[e],n)},t)}function on(i,e,t=Ge,s=!1){if(t){const n=t[i]||(t[i]=[]),r=e.__weh||(e.__weh=(...o)=>{if(t.isUnmounted)return;_s(),bs(t);const a=Tt(e,t,i,o);return os(),Ps(),a});return s?n.unshift(r):n.push(r),r}}const Bt=i=>(e,t=Ge)=>(!ti||i==="sp")&&on(i,(...s)=>e(...s),t),dh=Bt("bm"),qr=Bt("m"),gh=Bt("bu"),mh=Bt("u"),ph=Bt("bum"),ic=Bt("um"),yh=Bt("sp"),Th=Bt("rtg"),Eh=Bt("rtc");function xh(i,e=Ge){on("ec",i,e)}const nc="components";function Ah(i,e){return vh(nc,i,!0,e)||i}const Sh=Symbol.for("v-ndc");function vh(i,e,t=!0,s=!1){const n=ot||Ge;if(n){const r=n.type;if(i===nc){const a=Zh(r,!1);if(a&&(a===e||a===Dt(e)||a===Ji(Dt(e))))return r}const o=Mo(n[i]||r[i],e)||Mo(n.appContext[i],e);return!o&&s?r:o}}function Mo(i,e){return i&&(i[e]||i[Dt(e)]||i[Ji(Dt(e))])}const cr=i=>i?yc(i)?cn(i)||i.proxy:cr(i.parent):null,Vs=Be(Object.create(null),{$:i=>i,$el:i=>i.vnode.el,$data:i=>i.data,$props:i=>i.props,$attrs:i=>i.attrs,$slots:i=>i.slots,$refs:i=>i.refs,$parent:i=>cr(i.parent),$root:i=>cr(i.root),$emit:i=>i.emit,$options:i=>zr(i),$forceUpdate:i=>i.f||(i.f=()=>jr(i.update)),$nextTick:i=>i.n||(i.n=jl.bind(i.proxy)),$watch:i=>lh.bind(i)}),vn=(i,e)=>i!==Ie&&!i.__isScriptSetup&&ge(i,e),Rh={get({_:i},e){const{ctx:t,setupState:s,data:n,props:r,accessCache:o,type:a,appContext:l}=i;let c;if(e[0]!=="$"){const d=o[e];if(d!==void 0)switch(d){case 1:return s[e];case 2:return n[e];case 4:return t[e];case 3:return r[e]}else{if(vn(s,e))return o[e]=1,s[e];if(n!==Ie&&ge(n,e))return o[e]=2,n[e];if((c=i.propsOptions[0])&&ge(c,e))return o[e]=3,r[e];if(t!==Ie&&ge(t,e))return o[e]=4,t[e];ur&&(o[e]=0)}}const u=Vs[e];let f,h;if(u)return e==="$attrs"&&et(i,"get",e),u(i);if((f=a.__cssModules)&&(f=f[e]))return f;if(t!==Ie&&ge(t,e))return o[e]=4,t[e];if(h=l.config.globalProperties,ge(h,e))return h[e]},set({_:i},e,t){const{data:s,setupState:n,ctx:r}=i;return vn(n,e)?(n[e]=t,!0):s!==Ie&&ge(s,e)?(s[e]=t,!0):ge(i.props,e)||e[0]==="$"&&e.slice(1)in i?!1:(r[e]=t,!0)},has({_:{data:i,setupState:e,accessCache:t,ctx:s,appContext:n,propsOptions:r}},o){let a;return!!t[o]||i!==Ie&&ge(i,o)||vn(e,o)||(a=r[0])&&ge(a,o)||ge(s,o)||ge(Vs,o)||ge(n.config.globalProperties,o)},defineProperty(i,e,t){return t.get!=null?i._.accessCache[e]=0:ge(t,"value")&&this.set(i,e,t.value,null),Reflect.defineProperty(i,e,t)}};function Uo(i){return le(i)?i.reduce((e,t)=>(e[t]=null,e),{}):i}let ur=!0;function Lh(i){const e=zr(i),t=i.proxy,s=i.ctx;ur=!1,e.beforeCreate&&Bo(e.beforeCreate,i,"bc");const{data:n,computed:r,methods:o,watch:a,provide:l,inject:c,created:u,beforeMount:f,mounted:h,beforeUpdate:d,updated:g,activated:m,deactivated:y,beforeDestroy:T,beforeUnmount:x,destroyed:S,unmounted:R,render:b,renderTracked:M,renderTriggered:P,errorCaptured:B,serverPrefetch:K,expose:C,inheritAttrs:q,components:W,directives:ue,filters:_e}=e;if(c&&bh(c,s,null),o)for(const te in o){const $=o[te];ce($)&&(s[te]=$.bind(t))}if(n){const te=n.call(t,t);ke(te)&&(i.data=tn(te))}if(ur=!0,r)for(const te in r){const $=r[te],z=ce($)?$.bind(t,t):ce($.get)?$.get.bind(t,t):yt,fe=!ce($)&&ce($.set)?$.set.bind(t):yt,he=dt({get:z,set:fe});Object.defineProperty(s,te,{enumerable:!0,configurable:!0,get:()=>he.value,set:re=>he.value=re})}if(a)for(const te in a)rc(a[te],s,t,te);if(l){const te=ce(l)?l.call(t):l;Reflect.ownKeys(te).forEach($=>{Di($,te[$])})}u&&Bo(u,i,"c");function ae(te,$){le($)?$.forEach(z=>te(z.bind(t))):$&&te($.bind(t))}if(ae(dh,f),ae(qr,h),ae(gh,d),ae(mh,g),ae(uh,m),ae(fh,y),ae(xh,B),ae(Eh,M),ae(Th,P),ae(ph,x),ae(ic,R),ae(yh,K),le(C))if(C.length){const te=i.exposed||(i.exposed={});C.forEach($=>{Object.defineProperty(te,$,{get:()=>t[$],set:z=>t[$]=z})})}else i.exposed||(i.exposed={});b&&i.render===yt&&(i.render=b),q!=null&&(i.inheritAttrs=q),W&&(i.components=W),ue&&(i.directives=ue)}function bh(i,e,t=yt){le(i)&&(i=fr(i));for(const s in i){const n=i[s];let r;ke(n)?"default"in n?r=bt(n.from||s,n.default,!0):r=bt(n.from||s):r=bt(n),je(r)?Object.defineProperty(e,s,{enumerable:!0,configurable:!0,get:()=>r.value,set:o=>r.value=o}):e[s]=r}}function Bo(i,e,t){Tt(le(i)?i.map(s=>s.bind(e.proxy)):i.bind(e.proxy),e,t)}function rc(i,e,t,s){const n=s.includes(".")?Zl(t,s):()=>t[s];if(Ke(i)){const r=e[i];ce(r)&&bi(n,r)}else if(ce(i))bi(n,i.bind(t));else if(ke(i))if(le(i))i.forEach(r=>rc(r,e,t,s));else{const r=ce(i.handler)?i.handler.bind(t):e[i.handler];ce(r)&&bi(n,r,i)}}function zr(i){const e=i.type,{mixins:t,extends:s}=e,{mixins:n,optionsCache:r,config:{optionMergeStrategies:o}}=i.appContext,a=r.get(e);let l;return a?l=a:!n.length&&!t&&!s?l=e:(l={},n.length&&n.forEach(c=>Ui(l,c,o,!0)),Ui(l,e,o)),ke(e)&&r.set(e,l),l}function Ui(i,e,t,s=!1){const{mixins:n,extends:r}=e;r&&Ui(i,r,t,!0),n&&n.forEach(o=>Ui(i,o,t,!0));for(const o in e)if(!(s&&o==="expose")){const a=Ih[o]||t&&t[o];i[o]=a?a(i[o],e[o]):e[o]}return i}const Ih={data:$o,props:Go,emits:Go,methods:Ks,computed:Ks,beforeCreate:qe,created:qe,beforeMount:qe,mounted:qe,beforeUpdate:qe,updated:qe,beforeDestroy:qe,beforeUnmount:qe,destroyed:qe,unmounted:qe,activated:qe,deactivated:qe,errorCaptured:qe,serverPrefetch:qe,components:Ks,directives:Ks,watch:Ch,provide:$o,inject:Dh};function $o(i,e){return e?i?function(){return Be(ce(i)?i.call(this,this):i,ce(e)?e.call(this,this):e)}:e:i}function Dh(i,e){return Ks(fr(i),fr(e))}function fr(i){if(le(i)){const e={};for(let t=0;t<i.length;t++)e[i[t]]=i[t];return e}return i}function qe(i,e){return i?[...new Set([].concat(i,e))]:e}function Ks(i,e){return i?Be(Object.create(null),i,e):e}function Go(i,e){return i?le(i)&&le(e)?[...new Set([...i,...e])]:Be(Object.create(null),Uo(i),Uo(e??{})):e}function Ch(i,e){if(!i)return e;if(!e)return i;const t=Be(Object.create(null),i);for(const s in e)t[s]=qe(i[s],e[s]);return t}function oc(){return{app:null,config:{isNativeTag:Xu,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let wh=0;function _h(i,e){return function(s,n=null){ce(s)||(s=Be({},s)),n!=null&&!ke(n)&&(n=null);const r=oc(),o=new Set;let a=!1;const l=r.app={_uid:wh++,_component:s,_props:n,_container:null,_context:r,_instance:null,version:id,get config(){return r.config},set config(c){},use(c,...u){return o.has(c)||(c&&ce(c.install)?(o.add(c),c.install(l,...u)):ce(c)&&(o.add(c),c(l,...u))),l},mixin(c){return r.mixins.includes(c)||r.mixins.push(c),l},component(c,u){return u?(r.components[c]=u,l):r.components[c]},directive(c,u){return u?(r.directives[c]=u,l):r.directives[c]},mount(c,u,f){if(!a){const h=Ze(s,n);return h.appContext=r,u&&e?e(h,c):i(h,c,f),a=!0,l._container=c,c.__vue_app__=l,cn(h.component)||h.component.proxy}},unmount(){a&&(i(null,l._container),delete l._container.__vue_app__)},provide(c,u){return r.provides[c]=u,l},runWithContext(c){Bi=l;try{return c()}finally{Bi=null}}};return l}}let Bi=null;function Di(i,e){if(Ge){let t=Ge.provides;const s=Ge.parent&&Ge.parent.provides;s===t&&(t=Ge.provides=Object.create(s)),t[i]=e}}function bt(i,e,t=!1){const s=Ge||ot;if(s||Bi){const n=s?s.parent==null?s.vnode.appContext&&s.vnode.appContext.provides:s.parent.provides:Bi._context.provides;if(n&&i in n)return n[i];if(arguments.length>1)return t&&ce(e)?e.call(s&&s.proxy):e}}function Ph(i,e,t,s=!1){const n={},r={};Fi(r,ln,1),i.propsDefaults=Object.create(null),ac(i,e,n,r);for(const o in i.propsOptions[0])o in n||(n[o]=void 0);t?i.props=s?n:Ul(n):i.type.props?i.props=n:i.props=r,i.attrs=r}function kh(i,e,t,s){const{props:n,attrs:r,vnode:{patchFlag:o}}=i,a=Ee(n),[l]=i.propsOptions;let c=!1;if((s||o>0)&&!(o&16)){if(o&8){const u=i.vnode.dynamicProps;for(let f=0;f<u.length;f++){let h=u[f];if(nn(i.emitsOptions,h))continue;const d=e[h];if(l)if(ge(r,h))d!==r[h]&&(r[h]=d,c=!0);else{const g=Dt(h);n[g]=hr(l,a,g,d,i,!1)}else d!==r[h]&&(r[h]=d,c=!0)}}}else{ac(i,e,n,r)&&(c=!0);let u;for(const f in a)(!e||!ge(e,f)&&((u=ws(f))===f||!ge(e,u)))&&(l?t&&(t[f]!==void 0||t[u]!==void 0)&&(n[f]=hr(l,a,f,void 0,i,!0)):delete n[f]);if(r!==a)for(const f in r)(!e||!ge(e,f))&&(delete r[f],c=!0)}c&&Ut(i,"set","$attrs")}function ac(i,e,t,s){const[n,r]=i.propsOptions;let o=!1,a;if(e)for(let l in e){if(Li(l))continue;const c=e[l];let u;n&&ge(n,u=Dt(l))?!r||!r.includes(u)?t[u]=c:(a||(a={}))[u]=c:nn(i.emitsOptions,l)||(!(l in s)||c!==s[l])&&(s[l]=c,o=!0)}if(r){const l=Ee(t),c=a||Ie;for(let u=0;u<r.length;u++){const f=r[u];t[f]=hr(n,l,f,c[f],i,!ge(c,f))}}return o}function hr(i,e,t,s,n,r){const o=i[t];if(o!=null){const a=ge(o,"default");if(a&&s===void 0){const l=o.default;if(o.type!==Function&&!o.skipFactory&&ce(l)){const{propsDefaults:c}=n;t in c?s=c[t]:(bs(n),s=c[t]=l.call(null,e),os())}else s=l}o[0]&&(r&&!a?s=!1:o[1]&&(s===""||s===ws(t))&&(s=!0))}return s}function lc(i,e,t=!1){const s=e.propsCache,n=s.get(i);if(n)return n;const r=i.props,o={},a=[];let l=!1;if(!ce(i)){const u=f=>{l=!0;const[h,d]=lc(f,e,!0);Be(o,h),d&&a.push(...d)};!t&&e.mixins.length&&e.mixins.forEach(u),i.extends&&u(i.extends),i.mixins&&i.mixins.forEach(u)}if(!r&&!l)return ke(i)&&s.set(i,Es),Es;if(le(r))for(let u=0;u<r.length;u++){const f=Dt(r[u]);Ko(f)&&(o[f]=Ie)}else if(r)for(const u in r){const f=Dt(u);if(Ko(f)){const h=r[u],d=o[f]=le(h)||ce(h)?{type:h}:Be({},h);if(d){const g=Wo(Boolean,d.type),m=Wo(String,d.type);d[0]=g>-1,d[1]=m<0||g<m,(g>-1||ge(d,"default"))&&a.push(f)}}}const c=[o,a];return ke(i)&&s.set(i,c),c}function Ko(i){return i[0]!=="$"}function Ho(i){const e=i&&i.toString().match(/^\s*(function|class) (\w+)/);return e?e[2]:i===null?"null":""}function Vo(i,e){return Ho(i)===Ho(e)}function Wo(i,e){return le(e)?e.findIndex(t=>Vo(t,i)):ce(e)&&Vo(e,i)?0:-1}const cc=i=>i[0]==="_"||i==="$stable",Xr=i=>le(i)?i.map(vt):[vt(i)],Oh=(i,e,t)=>{if(e._n)return e;const s=th((...n)=>Xr(e(...n)),t);return s._c=!1,s},uc=(i,e,t)=>{const s=i._ctx;for(const n in i){if(cc(n))continue;const r=i[n];if(ce(r))e[n]=Oh(n,r,s);else if(r!=null){const o=Xr(r);e[n]=()=>o}}},fc=(i,e)=>{const t=Xr(e);i.slots.default=()=>t},Fh=(i,e)=>{if(i.vnode.shapeFlag&32){const t=e._;t?(i.slots=Ee(e),Fi(e,"_",t)):uc(e,i.slots={})}else i.slots={},e&&fc(i,e);Fi(i.slots,ln,1)},Nh=(i,e,t)=>{const{vnode:s,slots:n}=i;let r=!0,o=Ie;if(s.shapeFlag&32){const a=e._;a?t&&a===1?r=!1:(Be(n,e),!t&&a===1&&delete n._):(r=!e.$stable,uc(e,n)),o=e}else e&&(fc(i,e),o={default:1});if(r)for(const a in n)!cc(a)&&!(a in o)&&delete n[a]};function dr(i,e,t,s,n=!1){if(le(i)){i.forEach((h,d)=>dr(h,e&&(le(e)?e[d]:e),t,s,n));return}if(Ii(s)&&!n)return;const r=s.shapeFlag&4?cn(s.component)||s.component.proxy:s.el,o=n?null:r,{i:a,r:l}=i,c=e&&e.r,u=a.refs===Ie?a.refs={}:a.refs,f=a.setupState;if(c!=null&&c!==l&&(Ke(c)?(u[c]=null,ge(f,c)&&(f[c]=null)):je(c)&&(c.value=null)),ce(l))Xt(l,a,12,[o,u]);else{const h=Ke(l),d=je(l);if(h||d){const g=()=>{if(i.f){const m=h?ge(f,l)?f[l]:u[l]:l.value;n?le(m)&&Fr(m,r):le(m)?m.includes(r)||m.push(r):h?(u[l]=[r],ge(f,l)&&(f[l]=u[l])):(l.value=[r],i.k&&(u[i.k]=l.value))}else h?(u[l]=o,ge(f,l)&&(f[l]=o)):d&&(l.value=o,i.k&&(u[i.k]=o))};o?(g.id=-1,Qe(g,t)):g()}}}const Qe=ah;function Mh(i){return Uh(i)}function Uh(i,e){const t=ir();t.__VUE__=!0;const{insert:s,remove:n,patchProp:r,createElement:o,createText:a,createComment:l,setText:c,setElementText:u,parentNode:f,nextSibling:h,setScopeId:d=yt,insertStaticContent:g}=i,m=(E,A,L,w=null,O=null,N=null,Y=!1,G=null,H=!!A.dynamicChildren)=>{if(E===A)return;E&&!Fs(E,A)&&(w=_(E),re(E,O,N,!0),E=null),A.patchFlag===-2&&(H=!1,A.dynamicChildren=null);const{type:U,ref:Z,shapeFlag:X}=A;switch(U){case an:y(E,A,L,w);break;case ls:T(E,A,L,w);break;case Rn:E==null&&x(A,L,w,Y);break;case Ft:W(E,A,L,w,O,N,Y,G,H);break;default:X&1?b(E,A,L,w,O,N,Y,G,H):X&6?ue(E,A,L,w,O,N,Y,G,H):(X&64||X&128)&&U.process(E,A,L,w,O,N,Y,G,H,V)}Z!=null&&O&&dr(Z,E&&E.ref,N,A||E,!A)},y=(E,A,L,w)=>{if(E==null)s(A.el=a(A.children),L,w);else{const O=A.el=E.el;A.children!==E.children&&c(O,A.children)}},T=(E,A,L,w)=>{E==null?s(A.el=l(A.children||""),L,w):A.el=E.el},x=(E,A,L,w)=>{[E.el,E.anchor]=g(E.children,A,L,w,E.el,E.anchor)},S=({el:E,anchor:A},L,w)=>{let O;for(;E&&E!==A;)O=h(E),s(E,L,w),E=O;s(A,L,w)},R=({el:E,anchor:A})=>{let L;for(;E&&E!==A;)L=h(E),n(E),E=L;n(A)},b=(E,A,L,w,O,N,Y,G,H)=>{Y=Y||A.type==="svg",E==null?M(A,L,w,O,N,Y,G,H):K(E,A,O,N,Y,G,H)},M=(E,A,L,w,O,N,Y,G)=>{let H,U;const{type:Z,props:X,shapeFlag:ee,transition:oe,dirs:de}=E;if(H=E.el=o(E.type,N,X&&X.is,X),ee&8?u(H,E.children):ee&16&&B(E.children,H,null,w,O,N&&Z!=="foreignObject",Y,G),de&&Jt(E,null,w,"created"),P(H,E,E.scopeId,Y,w),X){for(const ve in X)ve!=="value"&&!Li(ve)&&r(H,ve,null,X[ve],N,E.children,w,O,Ae);"value"in X&&r(H,"value",null,X.value),(U=X.onVnodeBeforeMount)&&At(U,w,E)}de&&Jt(E,null,w,"beforeMount");const be=(!O||O&&!O.pendingBranch)&&oe&&!oe.persisted;be&&oe.beforeEnter(H),s(H,A,L),((U=X&&X.onVnodeMounted)||be||de)&&Qe(()=>{U&&At(U,w,E),be&&oe.enter(H),de&&Jt(E,null,w,"mounted")},O)},P=(E,A,L,w,O)=>{if(L&&d(E,L),w)for(let N=0;N<w.length;N++)d(E,w[N]);if(O){let N=O.subTree;if(A===N){const Y=O.vnode;P(E,Y,Y.scopeId,Y.slotScopeIds,O.parent)}}},B=(E,A,L,w,O,N,Y,G,H=0)=>{for(let U=H;U<E.length;U++){const Z=E[U]=G?Vt(E[U]):vt(E[U]);m(null,Z,A,L,w,O,N,Y,G)}},K=(E,A,L,w,O,N,Y)=>{const G=A.el=E.el;let{patchFlag:H,dynamicChildren:U,dirs:Z}=A;H|=E.patchFlag&16;const X=E.props||Ie,ee=A.props||Ie;let oe;L&&Zt(L,!1),(oe=ee.onVnodeBeforeUpdate)&&At(oe,L,A,E),Z&&Jt(A,E,L,"beforeUpdate"),L&&Zt(L,!0);const de=O&&A.type!=="foreignObject";if(U?C(E.dynamicChildren,U,G,L,w,de,N):Y||$(E,A,G,null,L,w,de,N,!1),H>0){if(H&16)q(G,A,X,ee,L,w,O);else if(H&2&&X.class!==ee.class&&r(G,"class",null,ee.class,O),H&4&&r(G,"style",X.style,ee.style,O),H&8){const be=A.dynamicProps;for(let ve=0;ve<be.length;ve++){const Oe=be[ve],lt=X[Oe],us=ee[Oe];(us!==lt||Oe==="value")&&r(G,Oe,lt,us,O,E.children,L,w,Ae)}}H&1&&E.children!==A.children&&u(G,A.children)}else!Y&&U==null&&q(G,A,X,ee,L,w,O);((oe=ee.onVnodeUpdated)||Z)&&Qe(()=>{oe&&At(oe,L,A,E),Z&&Jt(A,E,L,"updated")},w)},C=(E,A,L,w,O,N,Y)=>{for(let G=0;G<A.length;G++){const H=E[G],U=A[G],Z=H.el&&(H.type===Ft||!Fs(H,U)||H.shapeFlag&70)?f(H.el):L;m(H,U,Z,null,w,O,N,Y,!0)}},q=(E,A,L,w,O,N,Y)=>{if(L!==w){if(L!==Ie)for(const G in L)!Li(G)&&!(G in w)&&r(E,G,L[G],null,Y,A.children,O,N,Ae);for(const G in w){if(Li(G))continue;const H=w[G],U=L[G];H!==U&&G!=="value"&&r(E,G,U,H,Y,A.children,O,N,Ae)}"value"in w&&r(E,"value",L.value,w.value)}},W=(E,A,L,w,O,N,Y,G,H)=>{const U=A.el=E?E.el:a(""),Z=A.anchor=E?E.anchor:a("");let{patchFlag:X,dynamicChildren:ee,slotScopeIds:oe}=A;oe&&(G=G?G.concat(oe):oe),E==null?(s(U,L,w),s(Z,L,w),B(A.children,L,Z,O,N,Y,G,H)):X>0&&X&64&&ee&&E.dynamicChildren?(C(E.dynamicChildren,ee,L,O,N,Y,G),(A.key!=null||O&&A===O.subTree)&&hc(E,A,!0)):$(E,A,L,Z,O,N,Y,G,H)},ue=(E,A,L,w,O,N,Y,G,H)=>{A.slotScopeIds=G,E==null?A.shapeFlag&512?O.ctx.activate(A,L,w,Y,H):_e(A,L,w,O,N,Y,H):Te(E,A,H)},_e=(E,A,L,w,O,N,Y)=>{const G=E.component=qh(E,w,O);if(tc(E)&&(G.ctx.renderer=V),zh(G),G.asyncDep){if(O&&O.registerDep(G,ae),!E.el){const H=G.subTree=Ze(ls);T(null,H,A,L)}return}ae(G,E,A,L,O,N,Y)},Te=(E,A,L)=>{const w=A.component=E.component;if(nh(E,A,L))if(w.asyncDep&&!w.asyncResolved){te(w,A,L);return}else w.next=A,zf(w.update),w.update();else A.el=E.el,w.vnode=A},ae=(E,A,L,w,O,N,Y)=>{const G=()=>{if(E.isMounted){let{next:Z,bu:X,u:ee,parent:oe,vnode:de}=E,be=Z,ve;Zt(E,!1),Z?(Z.el=de.el,te(E,Z,Y)):Z=de,X&&An(X),(ve=Z.props&&Z.props.onVnodeBeforeUpdate)&&At(ve,oe,Z,de),Zt(E,!0);const Oe=Sn(E),lt=E.subTree;E.subTree=Oe,m(lt,Oe,f(lt.el),_(lt),E,O,N),Z.el=Oe.el,be===null&&rh(E,Oe.el),ee&&Qe(ee,O),(ve=Z.props&&Z.props.onVnodeUpdated)&&Qe(()=>At(ve,oe,Z,de),O)}else{let Z;const{el:X,props:ee}=A,{bm:oe,m:de,parent:be}=E,ve=Ii(A);if(Zt(E,!1),oe&&An(oe),!ve&&(Z=ee&&ee.onVnodeBeforeMount)&&At(Z,be,A),Zt(E,!0),X&&xe){const Oe=()=>{E.subTree=Sn(E),xe(X,E.subTree,E,O,null)};ve?A.type.__asyncLoader().then(()=>!E.isUnmounted&&Oe()):Oe()}else{const Oe=E.subTree=Sn(E);m(null,Oe,L,w,E,O,N),A.el=Oe.el}if(de&&Qe(de,O),!ve&&(Z=ee&&ee.onVnodeMounted)){const Oe=A;Qe(()=>At(Z,be,Oe),O)}(A.shapeFlag&256||be&&Ii(be.vnode)&&be.vnode.shapeFlag&256)&&E.a&&Qe(E.a,O),E.isMounted=!0,A=L=w=null}},H=E.effect=new $r(G,()=>jr(U),E.scope),U=E.update=()=>H.run();U.id=E.uid,Zt(E,!0),U()},te=(E,A,L)=>{A.component=E;const w=E.vnode.props;E.vnode=A,E.next=null,kh(E,A.props,w,L),Nh(E,A.children,L),_s(),Fo(),Ps()},$=(E,A,L,w,O,N,Y,G,H=!1)=>{const U=E&&E.children,Z=E?E.shapeFlag:0,X=A.children,{patchFlag:ee,shapeFlag:oe}=A;if(ee>0){if(ee&128){fe(U,X,L,w,O,N,Y,G,H);return}else if(ee&256){z(U,X,L,w,O,N,Y,G,H);return}}oe&8?(Z&16&&Ae(U,O,N),X!==U&&u(L,X)):Z&16?oe&16?fe(U,X,L,w,O,N,Y,G,H):Ae(U,O,N,!0):(Z&8&&u(L,""),oe&16&&B(X,L,w,O,N,Y,G,H))},z=(E,A,L,w,O,N,Y,G,H)=>{E=E||Es,A=A||Es;const U=E.length,Z=A.length,X=Math.min(U,Z);let ee;for(ee=0;ee<X;ee++){const oe=A[ee]=H?Vt(A[ee]):vt(A[ee]);m(E[ee],oe,L,null,O,N,Y,G,H)}U>Z?Ae(E,O,N,!0,!1,X):B(A,L,w,O,N,Y,G,H,X)},fe=(E,A,L,w,O,N,Y,G,H)=>{let U=0;const Z=A.length;let X=E.length-1,ee=Z-1;for(;U<=X&&U<=ee;){const oe=E[U],de=A[U]=H?Vt(A[U]):vt(A[U]);if(Fs(oe,de))m(oe,de,L,null,O,N,Y,G,H);else break;U++}for(;U<=X&&U<=ee;){const oe=E[X],de=A[ee]=H?Vt(A[ee]):vt(A[ee]);if(Fs(oe,de))m(oe,de,L,null,O,N,Y,G,H);else break;X--,ee--}if(U>X){if(U<=ee){const oe=ee+1,de=oe<Z?A[oe].el:w;for(;U<=ee;)m(null,A[U]=H?Vt(A[U]):vt(A[U]),L,de,O,N,Y,G,H),U++}}else if(U>ee)for(;U<=X;)re(E[U],O,N,!0),U++;else{const oe=U,de=U,be=new Map;for(U=de;U<=ee;U++){const st=A[U]=H?Vt(A[U]):vt(A[U]);st.key!=null&&be.set(st.key,U)}let ve,Oe=0;const lt=ee-de+1;let us=!1,Ro=0;const Os=new Array(lt);for(U=0;U<lt;U++)Os[U]=0;for(U=oe;U<=X;U++){const st=E[U];if(Oe>=lt){re(st,O,N,!0);continue}let xt;if(st.key!=null)xt=be.get(st.key);else for(ve=de;ve<=ee;ve++)if(Os[ve-de]===0&&Fs(st,A[ve])){xt=ve;break}xt===void 0?re(st,O,N,!0):(Os[xt-de]=U+1,xt>=Ro?Ro=xt:us=!0,m(st,A[xt],L,null,O,N,Y,G,H),Oe++)}const Lo=us?Bh(Os):Es;for(ve=Lo.length-1,U=lt-1;U>=0;U--){const st=de+U,xt=A[st],bo=st+1<Z?A[st+1].el:w;Os[U]===0?m(null,xt,L,bo,O,N,Y,G,H):us&&(ve<0||U!==Lo[ve]?he(xt,L,bo,2):ve--)}}},he=(E,A,L,w,O=null)=>{const{el:N,type:Y,transition:G,children:H,shapeFlag:U}=E;if(U&6){he(E.component.subTree,A,L,w);return}if(U&128){E.suspense.move(A,L,w);return}if(U&64){Y.move(E,A,L,V);return}if(Y===Ft){s(N,A,L);for(let X=0;X<H.length;X++)he(H[X],A,L,w);s(E.anchor,A,L);return}if(Y===Rn){S(E,A,L);return}if(w!==2&&U&1&&G)if(w===0)G.beforeEnter(N),s(N,A,L),Qe(()=>G.enter(N),O);else{const{leave:X,delayLeave:ee,afterLeave:oe}=G,de=()=>s(N,A,L),be=()=>{X(N,()=>{de(),oe&&oe()})};ee?ee(N,de,be):be()}else s(N,A,L)},re=(E,A,L,w=!1,O=!1)=>{const{type:N,props:Y,ref:G,children:H,dynamicChildren:U,shapeFlag:Z,patchFlag:X,dirs:ee}=E;if(G!=null&&dr(G,null,L,E,!0),Z&256){A.ctx.deactivate(E);return}const oe=Z&1&&ee,de=!Ii(E);let be;if(de&&(be=Y&&Y.onVnodeBeforeUnmount)&&At(be,A,E),Z&6)He(E.component,L,w);else{if(Z&128){E.suspense.unmount(L,w);return}oe&&Jt(E,null,A,"beforeUnmount"),Z&64?E.type.remove(E,A,L,O,V,w):U&&(N!==Ft||X>0&&X&64)?Ae(U,A,L,!1,!0):(N===Ft&&X&384||!O&&Z&16)&&Ae(H,A,L),w&&Le(E)}(de&&(be=Y&&Y.onVnodeUnmounted)||oe)&&Qe(()=>{be&&At(be,A,E),oe&&Jt(E,null,A,"unmounted")},L)},Le=E=>{const{type:A,el:L,anchor:w,transition:O}=E;if(A===Ft){Ne(L,w);return}if(A===Rn){R(E);return}const N=()=>{n(L),O&&!O.persisted&&O.afterLeave&&O.afterLeave()};if(E.shapeFlag&1&&O&&!O.persisted){const{leave:Y,delayLeave:G}=O,H=()=>Y(L,N);G?G(E.el,N,H):H()}else N()},Ne=(E,A)=>{let L;for(;E!==A;)L=h(E),n(E),E=L;n(A)},He=(E,A,L)=>{const{bum:w,scope:O,update:N,subTree:Y,um:G}=E;w&&An(w),O.stop(),N&&(N.active=!1,re(Y,E,A,L)),G&&Qe(G,A),Qe(()=>{E.isUnmounted=!0},A),A&&A.pendingBranch&&!A.isUnmounted&&E.asyncDep&&!E.asyncResolved&&E.suspenseId===A.pendingId&&(A.deps--,A.deps===0&&A.resolve())},Ae=(E,A,L,w=!1,O=!1,N=0)=>{for(let Y=N;Y<E.length;Y++)re(E[Y],A,L,w,O)},_=E=>E.shapeFlag&6?_(E.component.subTree):E.shapeFlag&128?E.suspense.next():h(E.anchor||E.el),j=(E,A,L)=>{E==null?A._vnode&&re(A._vnode,null,null,!0):m(A._vnode||null,E,A,null,null,null,L),Fo(),zl(),A._vnode=E},V={p:m,um:re,m:he,r:Le,mt:_e,mc:B,pc:$,pbc:C,n:_,o:i};let Q,xe;return e&&([Q,xe]=e(V)),{render:j,hydrate:Q,createApp:_h(j,Q)}}function Zt({effect:i,update:e},t){i.allowRecurse=e.allowRecurse=t}function hc(i,e,t=!1){const s=i.children,n=e.children;if(le(s)&&le(n))for(let r=0;r<s.length;r++){const o=s[r];let a=n[r];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=n[r]=Vt(n[r]),a.el=o.el),t||hc(o,a)),a.type===an&&(a.el=o.el)}}function Bh(i){const e=i.slice(),t=[0];let s,n,r,o,a;const l=i.length;for(s=0;s<l;s++){const c=i[s];if(c!==0){if(n=t[t.length-1],i[n]<c){e[s]=n,t.push(s);continue}for(r=0,o=t.length-1;r<o;)a=r+o>>1,i[t[a]]<c?r=a+1:o=a;c<i[t[r]]&&(r>0&&(e[s]=t[r-1]),t[r]=s)}}for(r=t.length,o=t[r-1];r-- >0;)t[r]=o,o=e[o];return t}const $h=i=>i.__isTeleport,Ft=Symbol.for("v-fgt"),an=Symbol.for("v-txt"),ls=Symbol.for("v-cmt"),Rn=Symbol.for("v-stc"),Ws=[];let mt=null;function Rs(i=!1){Ws.push(mt=i?null:[])}function Gh(){Ws.pop(),mt=Ws[Ws.length-1]||null}let ei=1;function Yo(i){ei+=i}function dc(i){return i.dynamicChildren=ei>0?mt||Es:null,Gh(),ei>0&&mt&&mt.push(i),i}function $i(i,e,t,s,n,r){return dc(Pe(i,e,t,s,n,r,!0))}function gc(i,e,t,s,n){return dc(Ze(i,e,t,s,n,!0))}function gr(i){return i?i.__v_isVNode===!0:!1}function Fs(i,e){return i.type===e.type&&i.key===e.key}const ln="__vInternal",mc=({key:i})=>i??null,Ci=({ref:i,ref_key:e,ref_for:t})=>(typeof i=="number"&&(i=""+i),i!=null?Ke(i)||je(i)||ce(i)?{i:ot,r:i,k:e,f:!!t}:i:null);function Pe(i,e=null,t=null,s=0,n=null,r=i===Ft?0:1,o=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:i,props:e,key:e&&mc(e),ref:e&&Ci(e),scopeId:rn,slotScopeIds:null,children:t,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetAnchor:null,staticCount:0,shapeFlag:r,patchFlag:s,dynamicProps:n,dynamicChildren:null,appContext:null,ctx:ot};return a?(Qr(l,t),r&128&&i.normalize(l)):t&&(l.shapeFlag|=Ke(t)?8:16),ei>0&&!o&&mt&&(l.patchFlag>0||r&6)&&l.patchFlag!==32&&mt.push(l),l}const Ze=Kh;function Kh(i,e=null,t=null,s=0,n=null,r=!1){if((!i||i===Sh)&&(i=ls),gr(i)){const a=Ls(i,e,!0);return t&&Qr(a,t),ei>0&&!r&&mt&&(a.shapeFlag&6?mt[mt.indexOf(i)]=a:mt.push(a)),a.patchFlag|=-2,a}if(ed(i)&&(i=i.__vccOpts),e){e=Hh(e);let{class:a,style:l}=e;a&&!Ke(a)&&(e.class=Zi(a)),ke(l)&&($l(l)&&!le(l)&&(l=Be({},l)),e.style=Ur(l))}const o=Ke(i)?1:oh(i)?128:$h(i)?64:ke(i)?4:ce(i)?2:0;return Pe(i,e,t,s,n,o,r,!0)}function Hh(i){return i?$l(i)||ln in i?Be({},i):i:null}function Ls(i,e,t=!1){const{props:s,ref:n,patchFlag:r,children:o}=i,a=e?Wh(s||{},e):s;return{__v_isVNode:!0,__v_skip:!0,type:i.type,props:a,key:a&&mc(a),ref:e&&e.ref?t&&n?le(n)?n.concat(Ci(e)):[n,Ci(e)]:Ci(e):n,scopeId:i.scopeId,slotScopeIds:i.slotScopeIds,children:o,target:i.target,targetAnchor:i.targetAnchor,staticCount:i.staticCount,shapeFlag:i.shapeFlag,patchFlag:e&&i.type!==Ft?r===-1?16:r|16:r,dynamicProps:i.dynamicProps,dynamicChildren:i.dynamicChildren,appContext:i.appContext,dirs:i.dirs,transition:i.transition,component:i.component,suspense:i.suspense,ssContent:i.ssContent&&Ls(i.ssContent),ssFallback:i.ssFallback&&Ls(i.ssFallback),el:i.el,anchor:i.anchor,ctx:i.ctx,ce:i.ce}}function Vh(i=" ",e=0){return Ze(an,null,i,e)}function pc(i="",e=!1){return e?(Rs(),gc(ls,null,i)):Ze(ls,null,i)}function vt(i){return i==null||typeof i=="boolean"?Ze(ls):le(i)?Ze(Ft,null,i.slice()):typeof i=="object"?Vt(i):Ze(an,null,String(i))}function Vt(i){return i.el===null&&i.patchFlag!==-1||i.memo?i:Ls(i)}function Qr(i,e){let t=0;const{shapeFlag:s}=i;if(e==null)e=null;else if(le(e))t=16;else if(typeof e=="object")if(s&65){const n=e.default;n&&(n._c&&(n._d=!1),Qr(i,n()),n._c&&(n._d=!0));return}else{t=32;const n=e._;!n&&!(ln in e)?e._ctx=ot:n===3&&ot&&(ot.slots._===1?e._=1:(e._=2,i.patchFlag|=1024))}else ce(e)?(e={default:e,_ctx:ot},t=32):(e=String(e),s&64?(t=16,e=[Vh(e)]):t=8);i.children=e,i.shapeFlag|=t}function Wh(...i){const e={};for(let t=0;t<i.length;t++){const s=i[t];for(const n in s)if(n==="class")e.class!==s.class&&(e.class=Zi([e.class,s.class]));else if(n==="style")e.style=Ur([e.style,s.style]);else if(zi(n)){const r=e[n],o=s[n];o&&r!==o&&!(le(r)&&r.includes(o))&&(e[n]=r?[].concat(r,o):o)}else n!==""&&(e[n]=s[n])}return e}function At(i,e,t,s=null){Tt(i,e,7,[t,s])}const Yh=oc();let jh=0;function qh(i,e,t){const s=i.type,n=(e?e.appContext:i.appContext)||Yh,r={uid:jh++,vnode:i,type:s,parent:e,appContext:n,root:null,next:null,subTree:null,effect:null,update:null,scope:new df(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:e?e.provides:Object.create(n.provides),accessCache:null,renderCache:[],components:null,directives:null,propsOptions:lc(s,n),emitsOptions:Ql(s,n),emit:null,emitted:null,propsDefaults:Ie,inheritAttrs:s.inheritAttrs,ctx:Ie,data:Ie,props:Ie,attrs:Ie,slots:Ie,refs:Ie,setupState:Ie,setupContext:null,attrsProxy:null,slotsProxy:null,suspense:t,suspenseId:t?t.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return r.ctx={_:r},r.root=e?e.root:r,r.emit=Jf.bind(null,r),i.ce&&i.ce(r),r}let Ge=null,Jr,fs,jo="__VUE_INSTANCE_SETTERS__";(fs=ir()[jo])||(fs=ir()[jo]=[]),fs.push(i=>Ge=i),Jr=i=>{fs.length>1?fs.forEach(e=>e(i)):fs[0](i)};const bs=i=>{Jr(i),i.scope.on()},os=()=>{Ge&&Ge.scope.off(),Jr(null)};function yc(i){return i.vnode.shapeFlag&4}let ti=!1;function zh(i,e=!1){ti=e;const{props:t,children:s}=i.vnode,n=yc(i);Ph(i,t,n,e),Fh(i,s);const r=n?Xh(i,e):void 0;return ti=!1,r}function Xh(i,e){const t=i.type;i.accessCache=Object.create(null),i.proxy=Gl(new Proxy(i.ctx,Rh));const{setup:s}=t;if(s){const n=i.setupContext=s.length>1?Jh(i):null;bs(i),_s();const r=Xt(s,i,0,[i.props,n]);if(Ps(),os(),bl(r)){if(r.then(os,os),e)return r.then(o=>{qo(i,o,e)}).catch(o=>{sn(o,i,0)});i.asyncDep=r}else qo(i,r,e)}else Tc(i,e)}function qo(i,e,t){ce(e)?i.type.__ssrInlineRender?i.ssrRender=e:i.render=e:ke(e)&&(i.setupState=Wl(e)),Tc(i,t)}let zo;function Tc(i,e,t){const s=i.type;if(!i.render){if(!e&&zo&&!s.render){const n=s.template||zr(i).template;if(n){const{isCustomElement:r,compilerOptions:o}=i.appContext.config,{delimiters:a,compilerOptions:l}=s,c=Be(Be({isCustomElement:r,delimiters:a},o),l);s.render=zo(n,c)}}i.render=s.render||yt}bs(i),_s(),Lh(i),Ps(),os()}function Qh(i){return i.attrsProxy||(i.attrsProxy=new Proxy(i.attrs,{get(e,t){return et(i,"get","$attrs"),e[t]}}))}function Jh(i){const e=t=>{i.exposed=t||{}};return{get attrs(){return Qh(i)},slots:i.slots,emit:i.emit,expose:e}}function cn(i){if(i.exposed)return i.exposeProxy||(i.exposeProxy=new Proxy(Wl(Gl(i.exposed)),{get(e,t){if(t in e)return e[t];if(t in Vs)return Vs[t](i)},has(e,t){return t in e||t in Vs}}))}function Zh(i,e=!0){return ce(i)?i.displayName||i.name:i.name||e&&i.__name}function ed(i){return ce(i)&&"__vccOpts"in i}const dt=(i,e)=>Yf(i,e,ti);function Ec(i,e,t){const s=arguments.length;return s===2?ke(e)&&!le(e)?gr(e)?Ze(i,null,[e]):Ze(i,e):Ze(i,null,e):(s>3?t=Array.prototype.slice.call(arguments,2):s===3&&gr(t)&&(t=[t]),Ze(i,e,t))}const td=Symbol.for("v-scx"),sd=()=>bt(td),id="3.3.4",nd="http://www.w3.org/2000/svg",is=typeof document<"u"?document:null,Xo=is&&is.createElement("template"),rd={insert:(i,e,t)=>{e.insertBefore(i,t||null)},remove:i=>{const e=i.parentNode;e&&e.removeChild(i)},createElement:(i,e,t,s)=>{const n=e?is.createElementNS(nd,i):is.createElement(i,t?{is:t}:void 0);return i==="select"&&s&&s.multiple!=null&&n.setAttribute("multiple",s.multiple),n},createText:i=>is.createTextNode(i),createComment:i=>is.createComment(i),setText:(i,e)=>{i.nodeValue=e},setElementText:(i,e)=>{i.textContent=e},parentNode:i=>i.parentNode,nextSibling:i=>i.nextSibling,querySelector:i=>is.querySelector(i),setScopeId(i,e){i.setAttribute(e,"")},insertStaticContent(i,e,t,s,n,r){const o=t?t.previousSibling:e.lastChild;if(n&&(n===r||n.nextSibling))for(;e.insertBefore(n.cloneNode(!0),t),!(n===r||!(n=n.nextSibling)););else{Xo.innerHTML=s?`<svg>${i}</svg>`:i;const a=Xo.content;if(s){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}e.insertBefore(a,t)}return[o?o.nextSibling:e.firstChild,t?t.previousSibling:e.lastChild]}};function od(i,e,t){const s=i._vtc;s&&(e=(e?[e,...s]:[...s]).join(" ")),e==null?i.removeAttribute("class"):t?i.setAttribute("class",e):i.className=e}function ad(i,e,t){const s=i.style,n=Ke(t);if(t&&!n){if(e&&!Ke(e))for(const r in e)t[r]==null&&mr(s,r,"");for(const r in t)mr(s,r,t[r])}else{const r=s.display;n?e!==t&&(s.cssText=t):e&&i.removeAttribute("style"),"_vod"in i&&(s.display=r)}}const Qo=/\s*!important$/;function mr(i,e,t){if(le(t))t.forEach(s=>mr(i,e,s));else if(t==null&&(t=""),e.startsWith("--"))i.setProperty(e,t);else{const s=ld(i,e);Qo.test(t)?i.setProperty(ws(s),t.replace(Qo,""),"important"):i[s]=t}}const Jo=["Webkit","Moz","ms"],Ln={};function ld(i,e){const t=Ln[e];if(t)return t;let s=Dt(e);if(s!=="filter"&&s in i)return Ln[e]=s;s=Ji(s);for(let n=0;n<Jo.length;n++){const r=Jo[n]+s;if(r in i)return Ln[e]=r}return e}const Zo="http://www.w3.org/1999/xlink";function cd(i,e,t,s,n){if(s&&e.startsWith("xlink:"))t==null?i.removeAttributeNS(Zo,e.slice(6,e.length)):i.setAttributeNS(Zo,e,t);else{const r=hf(e);t==null||r&&!Il(t)?i.removeAttribute(e):i.setAttribute(e,r?"":t)}}function ud(i,e,t,s,n,r,o){if(e==="innerHTML"||e==="textContent"){s&&o(s,n,r),i[e]=t??"";return}const a=i.tagName;if(e==="value"&&a!=="PROGRESS"&&!a.includes("-")){i._value=t;const c=a==="OPTION"?i.getAttribute("value"):i.value,u=t??"";c!==u&&(i.value=u),t==null&&i.removeAttribute(e);return}let l=!1;if(t===""||t==null){const c=typeof i[e];c==="boolean"?t=Il(t):t==null&&c==="string"?(t="",l=!0):c==="number"&&(t=0,l=!0)}try{i[e]=t}catch{}l&&i.removeAttribute(e)}function fd(i,e,t,s){i.addEventListener(e,t,s)}function hd(i,e,t,s){i.removeEventListener(e,t,s)}function dd(i,e,t,s,n=null){const r=i._vei||(i._vei={}),o=r[e];if(s&&o)o.value=s;else{const[a,l]=gd(e);if(s){const c=r[e]=yd(s,n);fd(i,a,c,l)}else o&&(hd(i,a,o,l),r[e]=void 0)}}const ea=/(?:Once|Passive|Capture)$/;function gd(i){let e;if(ea.test(i)){e={};let s;for(;s=i.match(ea);)i=i.slice(0,i.length-s[0].length),e[s[0].toLowerCase()]=!0}return[i[2]===":"?i.slice(3):ws(i.slice(2)),e]}let bn=0;const md=Promise.resolve(),pd=()=>bn||(md.then(()=>bn=0),bn=Date.now());function yd(i,e){const t=s=>{if(!s._vts)s._vts=Date.now();else if(s._vts<=t.attached)return;Tt(Td(s,t.value),e,5,[s])};return t.value=i,t.attached=pd(),t}function Td(i,e){if(le(e)){const t=i.stopImmediatePropagation;return i.stopImmediatePropagation=()=>{t.call(i),i._stopped=!0},e.map(s=>n=>!n._stopped&&s&&s(n))}else return e}const ta=/^on[a-z]/,Ed=(i,e,t,s,n=!1,r,o,a,l)=>{e==="class"?od(i,s,n):e==="style"?ad(i,t,s):zi(e)?Or(e)||dd(i,e,t,s,o):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):xd(i,e,s,n))?ud(i,e,s,r,o,a,l):(e==="true-value"?i._trueValue=s:e==="false-value"&&(i._falseValue=s),cd(i,e,s,n))};function xd(i,e,t,s){return s?!!(e==="innerHTML"||e==="textContent"||e in i&&ta.test(e)&&ce(t)):e==="spellcheck"||e==="draggable"||e==="translate"||e==="form"||e==="list"&&i.tagName==="INPUT"||e==="type"&&i.tagName==="TEXTAREA"||ta.test(e)&&Ke(t)?!1:e in i}const Ad={beforeMount(i,{value:e},{transition:t}){i._vod=i.style.display==="none"?"":i.style.display,t&&e?t.beforeEnter(i):Ns(i,e)},mounted(i,{value:e},{transition:t}){t&&e&&t.enter(i)},updated(i,{value:e,oldValue:t},{transition:s}){!e!=!t&&(s?e?(s.beforeEnter(i),Ns(i,!0),s.enter(i)):s.leave(i,()=>{Ns(i,!1)}):Ns(i,e))},beforeUnmount(i,{value:e}){Ns(i,e)}};function Ns(i,e){i.style.display=e?i._vod:"none"}const Sd=Be({patchProp:Ed},rd);let sa;function vd(){return sa||(sa=Mh(Sd))}const Rd=(...i)=>{const e=vd().createApp(...i),{mount:t}=e;return e.mount=s=>{const n=Ld(s);if(!n)return;const r=e._component;!ce(r)&&!r.render&&!r.template&&(r.template=n.innerHTML),n.innerHTML="";const o=t(n,!1,n instanceof SVGElement);return n instanceof Element&&(n.removeAttribute("v-cloak"),n.setAttribute("data-v-app","")),o},e};function Ld(i){return Ke(i)?document.querySelector(i):i}/*!
* vue-router v4.2.4
* (c) 2023 Eduardo San Martin Morote
* @license MIT
*/const ys=typeof window<"u";function bd(i){return i.__esModule||i[Symbol.toStringTag]==="Module"}const Se=Object.assign;function In(i,e){const t={};for(const s in e){const n=e[s];t[s]=Et(n)?n.map(i):i(n)}return t}const Ys=()=>{},Et=Array.isArray,Id=/\/$/,Dd=i=>i.replace(Id,"");function Dn(i,e,t="/"){let s,n={},r="",o="";const a=e.indexOf("#");let l=e.indexOf("?");return a<l&&a>=0&&(l=-1),l>-1&&(s=e.slice(0,l),r=e.slice(l+1,a>-1?a:e.length),n=i(r)),a>-1&&(s=s||e.slice(0,a),o=e.slice(a,e.length)),s=Pd(s??e,t),{fullPath:s+(r&&"?")+r+o,path:s,query:n,hash:o}}function Cd(i,e){const t=e.query?i(e.query):"";return e.path+(t&&"?")+t+(e.hash||"")}function ia(i,e){return!e||!i.toLowerCase().startsWith(e.toLowerCase())?i:i.slice(e.length)||"/"}function wd(i,e,t){const s=e.matched.length-1,n=t.matched.length-1;return s>-1&&s===n&&Is(e.matched[s],t.matched[n])&&xc(e.params,t.params)&&i(e.query)===i(t.query)&&e.hash===t.hash}function Is(i,e){return(i.aliasOf||i)===(e.aliasOf||e)}function xc(i,e){if(Object.keys(i).length!==Object.keys(e).length)return!1;for(const t in i)if(!_d(i[t],e[t]))return!1;return!0}function _d(i,e){return Et(i)?na(i,e):Et(e)?na(e,i):i===e}function na(i,e){return Et(e)?i.length===e.length&&i.every((t,s)=>t===e[s]):i.length===1&&i[0]===e}function Pd(i,e){if(i.startsWith("/"))return i;if(!i)return e;const t=e.split("/"),s=i.split("/"),n=s[s.length-1];(n===".."||n===".")&&s.push("");let r=t.length-1,o,a;for(o=0;o<s.length;o++)if(a=s[o],a!==".")if(a==="..")r>1&&r--;else break;return t.slice(0,r).join("/")+"/"+s.slice(o-(o===s.length?1:0)).join("/")}var si;(function(i){i.pop="pop",i.push="push"})(si||(si={}));var js;(function(i){i.back="back",i.forward="forward",i.unknown=""})(js||(js={}));function kd(i){if(!i)if(ys){const e=document.querySelector("base");i=e&&e.getAttribute("href")||"/",i=i.replace(/^\w+:\/\/[^\/]+/,"")}else i="/";return i[0]!=="/"&&i[0]!=="#"&&(i="/"+i),Dd(i)}const Od=/^[^#]+#/;function Fd(i,e){return i.replace(Od,"#")+e}function Nd(i,e){const t=document.documentElement.getBoundingClientRect(),s=i.getBoundingClientRect();return{behavior:e.behavior,left:s.left-t.left-(e.left||0),top:s.top-t.top-(e.top||0)}}const un=()=>({left:window.pageXOffset,top:window.pageYOffset});function Md(i){let e;if("el"in i){const t=i.el,s=typeof t=="string"&&t.startsWith("#"),n=typeof t=="string"?s?document.getElementById(t.slice(1)):document.querySelector(t):t;if(!n)return;e=Nd(n,i)}else e=i;"scrollBehavior"in document.documentElement.style?window.scrollTo(e):window.scrollTo(e.left!=null?e.left:window.pageXOffset,e.top!=null?e.top:window.pageYOffset)}function ra(i,e){return(history.state?history.state.position-e:-1)+i}const pr=new Map;function Ud(i,e){pr.set(i,e)}function Bd(i){const e=pr.get(i);return pr.delete(i),e}let $d=()=>location.protocol+"//"+location.host;function Ac(i,e){const{pathname:t,search:s,hash:n}=e,r=i.indexOf("#");if(r>-1){let a=n.includes(i.slice(r))?i.slice(r).length:1,l=n.slice(a);return l[0]!=="/"&&(l="/"+l),ia(l,"")}return ia(t,i)+s+n}function Gd(i,e,t,s){let n=[],r=[],o=null;const a=({state:h})=>{const d=Ac(i,location),g=t.value,m=e.value;let y=0;if(h){if(t.value=d,e.value=h,o&&o===g){o=null;return}y=m?h.position-m.position:0}else s(d);n.forEach(T=>{T(t.value,g,{delta:y,type:si.pop,direction:y?y>0?js.forward:js.back:js.unknown})})};function l(){o=t.value}function c(h){n.push(h);const d=()=>{const g=n.indexOf(h);g>-1&&n.splice(g,1)};return r.push(d),d}function u(){const{history:h}=window;h.state&&h.replaceState(Se({},h.state,{scroll:un()}),"")}function f(){for(const h of r)h();r=[],window.removeEventListener("popstate",a),window.removeEventListener("beforeunload",u)}return window.addEventListener("popstate",a),window.addEventListener("beforeunload",u,{passive:!0}),{pauseListeners:l,listen:c,destroy:f}}function oa(i,e,t,s=!1,n=!1){return{back:i,current:e,forward:t,replaced:s,position:window.history.length,scroll:n?un():null}}function Kd(i){const{history:e,location:t}=window,s={value:Ac(i,t)},n={value:e.state};n.value||r(s.value,{back:null,current:s.value,forward:null,position:e.length-1,replaced:!0,scroll:null},!0);function r(l,c,u){const f=i.indexOf("#"),h=f>-1?(t.host&&document.querySelector("base")?i:i.slice(f))+l:$d()+i+l;try{e[u?"replaceState":"pushState"](c,"",h),n.value=c}catch(d){console.error(d),t[u?"replace":"assign"](h)}}function o(l,c){const u=Se({},e.state,oa(n.value.back,l,n.value.forward,!0),c,{position:n.value.position});r(l,u,!0),s.value=l}function a(l,c){const u=Se({},n.value,e.state,{forward:l,scroll:un()});r(u.current,u,!0);const f=Se({},oa(s.value,l,null),{position:u.position+1},c);r(l,f,!1),s.value=l}return{location:s,state:n,push:a,replace:o}}function Hd(i){i=kd(i);const e=Kd(i),t=Gd(i,e.state,e.location,e.replace);function s(r,o=!0){o||t.pauseListeners(),history.go(r)}const n=Se({location:"",base:i,go:s,createHref:Fd.bind(null,i)},e,t);return Object.defineProperty(n,"location",{enumerable:!0,get:()=>e.location.value}),Object.defineProperty(n,"state",{enumerable:!0,get:()=>e.state.value}),n}function Vd(i){return i=location.host?i||location.pathname+location.search:"",i.includes("#")||(i+="#"),Hd(i)}function Wd(i){return typeof i=="string"||i&&typeof i=="object"}function Sc(i){return typeof i=="string"||typeof i=="symbol"}const Gt={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0},vc=Symbol("");var aa;(function(i){i[i.aborted=4]="aborted",i[i.cancelled=8]="cancelled",i[i.duplicated=16]="duplicated"})(aa||(aa={}));function Ds(i,e){return Se(new Error,{type:i,[vc]:!0},e)}function wt(i,e){return i instanceof Error&&vc in i&&(e==null||!!(i.type&e))}const la="[^/]+?",Yd={sensitive:!1,strict:!1,start:!0,end:!0},jd=/[.+*?^${}()[\]/\\]/g;function qd(i,e){const t=Se({},Yd,e),s=[];let n=t.start?"^":"";const r=[];for(const c of i){const u=c.length?[]:[90];t.strict&&!c.length&&(n+="/");for(let f=0;f<c.length;f++){const h=c[f];let d=40+(t.sensitive?.25:0);if(h.type===0)f||(n+="/"),n+=h.value.replace(jd,"\\$&"),d+=40;else if(h.type===1){const{value:g,repeatable:m,optional:y,regexp:T}=h;r.push({name:g,repeatable:m,optional:y});const x=T||la;if(x!==la){d+=10;try{new RegExp(`(${x})`)}catch(R){throw new Error(`Invalid custom RegExp for param "${g}" (${x}): `+R.message)}}let S=m?`((?:${x})(?:/(?:${x}))*)`:`(${x})`;f||(S=y&&c.length<2?`(?:/${S})`:"/"+S),y&&(S+="?"),n+=S,d+=20,y&&(d+=-8),m&&(d+=-20),x===".*"&&(d+=-50)}u.push(d)}s.push(u)}if(t.strict&&t.end){const c=s.length-1;s[c][s[c].length-1]+=.7000000000000001}t.strict||(n+="/?"),t.end?n+="$":t.strict&&(n+="(?:/|$)");const o=new RegExp(n,t.sensitive?"":"i");function a(c){const u=c.match(o),f={};if(!u)return null;for(let h=1;h<u.length;h++){const d=u[h]||"",g=r[h-1];f[g.name]=d&&g.repeatable?d.split("/"):d}return f}function l(c){let u="",f=!1;for(const h of i){(!f||!u.endsWith("/"))&&(u+="/"),f=!1;for(const d of h)if(d.type===0)u+=d.value;else if(d.type===1){const{value:g,repeatable:m,optional:y}=d,T=g in c?c[g]:"";if(Et(T)&&!m)throw new Error(`Provided param "${g}" is an array but it is not repeatable (* or + modifiers)`);const x=Et(T)?T.join("/"):T;if(!x)if(y)h.length<2&&(u.endsWith("/")?u=u.slice(0,-1):f=!0);else throw new Error(`Missing required param "${g}"`);u+=x}}return u||"/"}return{re:o,score:s,keys:r,parse:a,stringify:l}}function zd(i,e){let t=0;for(;t<i.length&&t<e.length;){const s=e[t]-i[t];if(s)return s;t++}return i.length<e.length?i.length===1&&i[0]===40+40?-1:1:i.length>e.length?e.length===1&&e[0]===40+40?1:-1:0}function Xd(i,e){let t=0;const s=i.score,n=e.score;for(;t<s.length&&t<n.length;){const r=zd(s[t],n[t]);if(r)return r;t++}if(Math.abs(n.length-s.length)===1){if(ca(s))return 1;if(ca(n))return-1}return n.length-s.length}function ca(i){const e=i[i.length-1];return i.length>0&&e[e.length-1]<0}const Qd={type:0,value:""},Jd=/[a-zA-Z0-9_]/;function Zd(i){if(!i)return[[]];if(i==="/")return[[Qd]];if(!i.startsWith("/"))throw new Error(`Invalid path "${i}"`);function e(d){throw new Error(`ERR (${t})/"${c}": ${d}`)}let t=0,s=t;const n=[];let r;function o(){r&&n.push(r),r=[]}let a=0,l,c="",u="";function f(){c&&(t===0?r.push({type:0,value:c}):t===1||t===2||t===3?(r.length>1&&(l==="*"||l==="+")&&e(`A repeatable param (${c}) must be alone in its segment. eg: '/:ids+.`),r.push({type:1,value:c,regexp:u,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):e("Invalid state to consume buffer"),c="")}function h(){c+=l}for(;a<i.length;){if(l=i[a++],l==="\\"&&t!==2){s=t,t=4;continue}switch(t){case 0:l==="/"?(c&&f(),o()):l===":"?(f(),t=1):h();break;case 4:h(),t=s;break;case 1:l==="("?t=2:Jd.test(l)?h():(f(),t=0,l!=="*"&&l!=="?"&&l!=="+"&&a--);break;case 2:l===")"?u[u.length-1]=="\\"?u=u.slice(0,-1)+l:t=3:u+=l;break;case 3:f(),t=0,l!=="*"&&l!=="?"&&l!=="+"&&a--,u="";break;default:e("Unknown state");break}}return t===2&&e(`Unfinished custom RegExp for param "${c}"`),f(),o(),n}function eg(i,e,t){const s=qd(Zd(i.path),t),n=Se(s,{record:i,parent:e,children:[],alias:[]});return e&&!n.record.aliasOf==!e.record.aliasOf&&e.children.push(n),n}function tg(i,e){const t=[],s=new Map;e=ha({strict:!1,end:!0,sensitive:!1},e);function n(u){return s.get(u)}function r(u,f,h){const d=!h,g=sg(u);g.aliasOf=h&&h.record;const m=ha(e,u),y=[g];if("alias"in u){const S=typeof u.alias=="string"?[u.alias]:u.alias;for(const R of S)y.push(Se({},g,{components:h?h.record.components:g.components,path:R,aliasOf:h?h.record:g}))}let T,x;for(const S of y){const{path:R}=S;if(f&&R[0]!=="/"){const b=f.record.path,M=b[b.length-1]==="/"?"":"/";S.path=f.record.path+(R&&M+R)}if(T=eg(S,f,m),h?h.alias.push(T):(x=x||T,x!==T&&x.alias.push(T),d&&u.name&&!fa(T)&&o(u.name)),g.children){const b=g.children;for(let M=0;M<b.length;M++)r(b[M],T,h&&h.children[M])}h=h||T,(T.record.components&&Object.keys(T.record.components).length||T.record.name||T.record.redirect)&&l(T)}return x?()=>{o(x)}:Ys}function o(u){if(Sc(u)){const f=s.get(u);f&&(s.delete(u),t.splice(t.indexOf(f),1),f.children.forEach(o),f.alias.forEach(o))}else{const f=t.indexOf(u);f>-1&&(t.splice(f,1),u.record.name&&s.delete(u.record.name),u.children.forEach(o),u.alias.forEach(o))}}function a(){return t}function l(u){let f=0;for(;f<t.length&&Xd(u,t[f])>=0&&(u.record.path!==t[f].record.path||!Rc(u,t[f]));)f++;t.splice(f,0,u),u.record.name&&!fa(u)&&s.set(u.record.name,u)}function c(u,f){let h,d={},g,m;if("name"in u&&u.name){if(h=s.get(u.name),!h)throw Ds(1,{location:u});m=h.record.name,d=Se(ua(f.params,h.keys.filter(x=>!x.optional).map(x=>x.name)),u.params&&ua(u.params,h.keys.map(x=>x.name))),g=h.stringify(d)}else if("path"in u)g=u.path,h=t.find(x=>x.re.test(g)),h&&(d=h.parse(g),m=h.record.name);else{if(h=f.name?s.get(f.name):t.find(x=>x.re.test(f.path)),!h)throw Ds(1,{location:u,currentLocation:f});m=h.record.name,d=Se({},f.params,u.params),g=h.stringify(d)}const y=[];let T=h;for(;T;)y.unshift(T.record),T=T.parent;return{name:m,path:g,params:d,matched:y,meta:ng(y)}}return i.forEach(u=>r(u)),{addRoute:r,resolve:c,removeRoute:o,getRoutes:a,getRecordMatcher:n}}function ua(i,e){const t={};for(const s of e)s in i&&(t[s]=i[s]);return t}function sg(i){return{path:i.path,redirect:i.redirect,name:i.name,meta:i.meta||{},aliasOf:void 0,beforeEnter:i.beforeEnter,props:ig(i),children:i.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in i?i.components||null:i.component&&{default:i.component}}}function ig(i){const e={},t=i.props||!1;if("component"in i)e.default=t;else for(const s in i.components)e[s]=typeof t=="object"?t[s]:t;return e}function fa(i){for(;i;){if(i.record.aliasOf)return!0;i=i.parent}return!1}function ng(i){return i.reduce((e,t)=>Se(e,t.meta),{})}function ha(i,e){const t={};for(const s in i)t[s]=s in e?e[s]:i[s];return t}function Rc(i,e){return e.children.some(t=>t===i||Rc(i,t))}const Lc=/#/g,rg=/&/g,og=/\//g,ag=/=/g,lg=/\?/g,bc=/\+/g,cg=/%5B/g,ug=/%5D/g,Ic=/%5E/g,fg=/%60/g,Dc=/%7B/g,hg=/%7C/g,Cc=/%7D/g,dg=/%20/g;function Zr(i){return encodeURI(""+i).replace(hg,"|").replace(cg,"[").replace(ug,"]")}function gg(i){return Zr(i).replace(Dc,"{").replace(Cc,"}").replace(Ic,"^")}function yr(i){return Zr(i).replace(bc,"%2B").replace(dg,"+").replace(Lc,"%23").replace(rg,"%26").replace(fg,"`").replace(Dc,"{").replace(Cc,"}").replace(Ic,"^")}function mg(i){return yr(i).replace(ag,"%3D")}function pg(i){return Zr(i).replace(Lc,"%23").replace(lg,"%3F")}function yg(i){return i==null?"":pg(i).replace(og,"%2F")}function Gi(i){try{return decodeURIComponent(""+i)}catch{}return""+i}function Tg(i){const e={};if(i===""||i==="?")return e;const s=(i[0]==="?"?i.slice(1):i).split("&");for(let n=0;n<s.length;++n){const r=s[n].replace(bc," "),o=r.indexOf("="),a=Gi(o<0?r:r.slice(0,o)),l=o<0?null:Gi(r.slice(o+1));if(a in e){let c=e[a];Et(c)||(c=e[a]=[c]),c.push(l)}else e[a]=l}return e}function da(i){let e="";for(let t in i){const s=i[t];if(t=mg(t),s==null){s!==void 0&&(e+=(e.length?"&":"")+t);continue}(Et(s)?s.map(r=>r&&yr(r)):[s&&yr(s)]).forEach(r=>{r!==void 0&&(e+=(e.length?"&":"")+t,r!=null&&(e+="="+r))})}return e}function Eg(i){const e={};for(const t in i){const s=i[t];s!==void 0&&(e[t]=Et(s)?s.map(n=>n==null?null:""+n):s==null?s:""+s)}return e}const xg=Symbol(""),ga=Symbol(""),fn=Symbol(""),wc=Symbol(""),Tr=Symbol("");function Ms(){let i=[];function e(s){return i.push(s),()=>{const n=i.indexOf(s);n>-1&&i.splice(n,1)}}function t(){i=[]}return{add:e,list:()=>i.slice(),reset:t}}function Wt(i,e,t,s,n){const r=s&&(s.enterCallbacks[n]=s.enterCallbacks[n]||[]);return()=>new Promise((o,a)=>{const l=f=>{f===!1?a(Ds(4,{from:t,to:e})):f instanceof Error?a(f):Wd(f)?a(Ds(2,{from:e,to:f})):(r&&s.enterCallbacks[n]===r&&typeof f=="function"&&r.push(f),o())},c=i.call(s&&s.instances[n],e,t,l);let u=Promise.resolve(c);i.length<3&&(u=u.then(l)),u.catch(f=>a(f))})}function Cn(i,e,t,s){const n=[];for(const r of i)for(const o in r.components){let a=r.components[o];if(!(e!=="beforeRouteEnter"&&!r.instances[o]))if(Ag(a)){const c=(a.__vccOpts||a)[e];c&&n.push(Wt(c,t,s,r,o))}else{let l=a();n.push(()=>l.then(c=>{if(!c)return Promise.reject(new Error(`Couldn't resolve component "${o}" at "${r.path}"`));const u=bd(c)?c.default:c;r.components[o]=u;const h=(u.__vccOpts||u)[e];return h&&Wt(h,t,s,r,o)()}))}}return n}function Ag(i){return typeof i=="object"||"displayName"in i||"props"in i||"__vccOpts"in i}function ma(i){const e=bt(fn),t=bt(wc),s=dt(()=>e.resolve(zt(i.to))),n=dt(()=>{const{matched:l}=s.value,{length:c}=l,u=l[c-1],f=t.matched;if(!u||!f.length)return-1;const h=f.findIndex(Is.bind(null,u));if(h>-1)return h;const d=pa(l[c-2]);return c>1&&pa(u)===d&&f[f.length-1].path!==d?f.findIndex(Is.bind(null,l[c-2])):h}),r=dt(()=>n.value>-1&&Lg(t.params,s.value.params)),o=dt(()=>n.value>-1&&n.value===t.matched.length-1&&xc(t.params,s.value.params));function a(l={}){return Rg(l)?e[zt(i.replace)?"replace":"push"](zt(i.to)).catch(Ys):Promise.resolve()}return{route:s,href:dt(()=>s.value.href),isActive:r,isExactActive:o,navigate:a}}const Sg=ec({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"}},useLink:ma,setup(i,{slots:e}){const t=tn(ma(i)),{options:s}=bt(fn),n=dt(()=>({[ya(i.activeClass,s.linkActiveClass,"router-link-active")]:t.isActive,[ya(i.exactActiveClass,s.linkExactActiveClass,"router-link-exact-active")]:t.isExactActive}));return()=>{const r=e.default&&e.default(t);return i.custom?r:Ec("a",{"aria-current":t.isExactActive?i.ariaCurrentValue:null,href:t.href,onClick:t.navigate,class:n.value},r)}}}),vg=Sg;function Rg(i){if(!(i.metaKey||i.altKey||i.ctrlKey||i.shiftKey)&&!i.defaultPrevented&&!(i.button!==void 0&&i.button!==0)){if(i.currentTarget&&i.currentTarget.getAttribute){const e=i.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return i.preventDefault&&i.preventDefault(),!0}}function Lg(i,e){for(const t in e){const s=e[t],n=i[t];if(typeof s=="string"){if(s!==n)return!1}else if(!Et(n)||n.length!==s.length||s.some((r,o)=>r!==n[o]))return!1}return!0}function pa(i){return i?i.aliasOf?i.aliasOf.path:i.path:""}const ya=(i,e,t)=>i??e??t,bg=ec({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(i,{attrs:e,slots:t}){const s=bt(Tr),n=dt(()=>i.route||s.value),r=bt(ga,0),o=dt(()=>{let c=zt(r);const{matched:u}=n.value;let f;for(;(f=u[c])&&!f.components;)c++;return c}),a=dt(()=>n.value.matched[o.value]);Di(ga,dt(()=>o.value+1)),Di(xg,a),Di(Tr,n);const l=ps();return bi(()=>[l.value,a.value,i.name],([c,u,f],[h,d,g])=>{u&&(u.instances[f]=c,d&&d!==u&&c&&c===h&&(u.leaveGuards.size||(u.leaveGuards=d.leaveGuards),u.updateGuards.size||(u.updateGuards=d.updateGuards))),c&&u&&(!d||!Is(u,d)||!h)&&(u.enterCallbacks[f]||[]).forEach(m=>m(c))},{flush:"post"}),()=>{const c=n.value,u=i.name,f=a.value,h=f&&f.components[u];if(!h)return Ta(t.default,{Component:h,route:c});const d=f.props[u],g=d?d===!0?c.params:typeof d=="function"?d(c):d:null,y=Ec(h,Se({},g,e,{onVnodeUnmounted:T=>{T.component.isUnmounted&&(f.instances[u]=null)},ref:l}));return Ta(t.default,{Component:y,route:c})||y}}});function Ta(i,e){if(!i)return null;const t=i(e);return t.length===1?t[0]:t}const Ig=bg;function Dg(i){const e=tg(i.routes,i),t=i.parseQuery||Tg,s=i.stringifyQuery||da,n=i.history,r=Ms(),o=Ms(),a=Ms(),l=Kf(Gt);let c=Gt;ys&&i.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const u=In.bind(null,_=>""+_),f=In.bind(null,yg),h=In.bind(null,Gi);function d(_,j){let V,Q;return Sc(_)?(V=e.getRecordMatcher(_),Q=j):Q=_,e.addRoute(Q,V)}function g(_){const j=e.getRecordMatcher(_);j&&e.removeRoute(j)}function m(){return e.getRoutes().map(_=>_.record)}function y(_){return!!e.getRecordMatcher(_)}function T(_,j){if(j=Se({},j||l.value),typeof _=="string"){const L=Dn(t,_,j.path),w=e.resolve({path:L.path},j),O=n.createHref(L.fullPath);return Se(L,w,{params:h(w.params),hash:Gi(L.hash),redirectedFrom:void 0,href:O})}let V;if("path"in _)V=Se({},_,{path:Dn(t,_.path,j.path).path});else{const L=Se({},_.params);for(const w in L)L[w]==null&&delete L[w];V=Se({},_,{params:f(L)}),j.params=f(j.params)}const Q=e.resolve(V,j),xe=_.hash||"";Q.params=u(h(Q.params));const E=Cd(s,Se({},_,{hash:gg(xe),path:Q.path})),A=n.createHref(E);return Se({fullPath:E,hash:xe,query:s===da?Eg(_.query):_.query||{}},Q,{redirectedFrom:void 0,href:A})}function x(_){return typeof _=="string"?Dn(t,_,l.value.path):Se({},_)}function S(_,j){if(c!==_)return Ds(8,{from:j,to:_})}function R(_){return P(_)}function b(_){return R(Se(x(_),{replace:!0}))}function M(_){const j=_.matched[_.matched.length-1];if(j&&j.redirect){const{redirect:V}=j;let Q=typeof V=="function"?V(_):V;return typeof Q=="string"&&(Q=Q.includes("?")||Q.includes("#")?Q=x(Q):{path:Q},Q.params={}),Se({query:_.query,hash:_.hash,params:"path"in Q?{}:_.params},Q)}}function P(_,j){const V=c=T(_),Q=l.value,xe=_.state,E=_.force,A=_.replace===!0,L=M(V);if(L)return P(Se(x(L),{state:typeof L=="object"?Se({},xe,L.state):xe,force:E,replace:A}),j||V);const w=V;w.redirectedFrom=j;let O;return!E&&wd(s,Q,V)&&(O=Ds(16,{to:w,from:Q}),he(Q,Q,!0,!1)),(O?Promise.resolve(O):C(w,Q)).catch(N=>wt(N)?wt(N,2)?N:fe(N):$(N,w,Q)).then(N=>{if(N){if(wt(N,2))return P(Se({replace:A},x(N.to),{state:typeof N.to=="object"?Se({},xe,N.to.state):xe,force:E}),j||w)}else N=W(w,Q,!0,A,xe);return q(w,Q,N),N})}function B(_,j){const V=S(_,j);return V?Promise.reject(V):Promise.resolve()}function K(_){const j=Ne.values().next().value;return j&&typeof j.runWithContext=="function"?j.runWithContext(_):_()}function C(_,j){let V;const[Q,xe,E]=Cg(_,j);V=Cn(Q.reverse(),"beforeRouteLeave",_,j);for(const L of Q)L.leaveGuards.forEach(w=>{V.push(Wt(w,_,j))});const A=B.bind(null,_,j);return V.push(A),Ae(V).then(()=>{V=[];for(const L of r.list())V.push(Wt(L,_,j));return V.push(A),Ae(V)}).then(()=>{V=Cn(xe,"beforeRouteUpdate",_,j);for(const L of xe)L.updateGuards.forEach(w=>{V.push(Wt(w,_,j))});return V.push(A),Ae(V)}).then(()=>{V=[];for(const L of E)if(L.beforeEnter)if(Et(L.beforeEnter))for(const w of L.beforeEnter)V.push(Wt(w,_,j));else V.push(Wt(L.beforeEnter,_,j));return V.push(A),Ae(V)}).then(()=>(_.matched.forEach(L=>L.enterCallbacks={}),V=Cn(E,"beforeRouteEnter",_,j),V.push(A),Ae(V))).then(()=>{V=[];for(const L of o.list())V.push(Wt(L,_,j));return V.push(A),Ae(V)}).catch(L=>wt(L,8)?L:Promise.reject(L))}function q(_,j,V){a.list().forEach(Q=>K(()=>Q(_,j,V)))}function W(_,j,V,Q,xe){const E=S(_,j);if(E)return E;const A=j===Gt,L=ys?history.state:{};V&&(Q||A?n.replace(_.fullPath,Se({scroll:A&&L&&L.scroll},xe)):n.push(_.fullPath,xe)),l.value=_,he(_,j,V,A),fe()}let ue;function _e(){ue||(ue=n.listen((_,j,V)=>{if(!He.listening)return;const Q=T(_),xe=M(Q);if(xe){P(Se(xe,{replace:!0}),Q).catch(Ys);return}c=Q;const E=l.value;ys&&Ud(ra(E.fullPath,V.delta),un()),C(Q,E).catch(A=>wt(A,12)?A:wt(A,2)?(P(A.to,Q).then(L=>{wt(L,20)&&!V.delta&&V.type===si.pop&&n.go(-1,!1)}).catch(Ys),Promise.reject()):(V.delta&&n.go(-V.delta,!1),$(A,Q,E))).then(A=>{A=A||W(Q,E,!1),A&&(V.delta&&!wt(A,8)?n.go(-V.delta,!1):V.type===si.pop&&wt(A,20)&&n.go(-1,!1)),q(Q,E,A)}).catch(Ys)}))}let Te=Ms(),ae=Ms(),te;function $(_,j,V){fe(_);const Q=ae.list();return Q.length?Q.forEach(xe=>xe(_,j,V)):console.error(_),Promise.reject(_)}function z(){return te&&l.value!==Gt?Promise.resolve():new Promise((_,j)=>{Te.add([_,j])})}function fe(_){return te||(te=!_,_e(),Te.list().forEach(([j,V])=>_?V(_):j()),Te.reset()),_}function he(_,j,V,Q){const{scrollBehavior:xe}=i;if(!ys||!xe)return Promise.resolve();const E=!V&&Bd(ra(_.fullPath,0))||(Q||!V)&&history.state&&history.state.scroll||null;return jl().then(()=>xe(_,j,E)).then(A=>A&&Md(A)).catch(A=>$(A,_,j))}const re=_=>n.go(_);let Le;const Ne=new Set,He={currentRoute:l,listening:!0,addRoute:d,removeRoute:g,hasRoute:y,getRoutes:m,resolve:T,options:i,push:R,replace:b,go:re,back:()=>re(-1),forward:()=>re(1),beforeEach:r.add,beforeResolve:o.add,afterEach:a.add,onError:ae.add,isReady:z,install(_){const j=this;_.component("RouterLink",vg),_.component("RouterView",Ig),_.config.globalProperties.$router=j,Object.defineProperty(_.config.globalProperties,"$route",{enumerable:!0,get:()=>zt(l)}),ys&&!Le&&l.value===Gt&&(Le=!0,R(n.location).catch(xe=>{}));const V={};for(const xe in Gt)Object.defineProperty(V,xe,{get:()=>l.value[xe],enumerable:!0});_.provide(fn,j),_.provide(wc,Ul(V)),_.provide(Tr,l);const Q=_.unmount;Ne.add(_),_.unmount=function(){Ne.delete(_),Ne.size<1&&(c=Gt,ue&&ue(),ue=null,l.value=Gt,Le=!1,te=!1),Q()}}};function Ae(_){return _.reduce((j,V)=>j.then(()=>K(V)),Promise.resolve())}return He}function Cg(i,e){const t=[],s=[],n=[],r=Math.max(e.matched.length,i.matched.length);for(let o=0;o<r;o++){const a=e.matched[o];a&&(i.matched.find(c=>Is(c,a))?s.push(a):t.push(a));const l=i.matched[o];l&&(e.matched.find(c=>Is(c,l))||n.push(l))}return[t,s,n]}function wg(){return bt(fn)}const eo=(i,e)=>{const t=i.__vccOpts||i;for(const[s,n]of e)t[s]=n;return t},_g={__name:"App",setup(i){return wg(),qr(()=>{}),(e,t)=>{const s=Ah("router-view");return Rs(),gc(s)}}},Pg=eo(_g,[["__scopeId","data-v-be9d76f5"]]),kg="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAAAXNSR0IArs4c6QAADRtJREFUeF7tnV+IXFcZwL/vzG6o0IcIESoETaFxd+KDqZlgHlJM3iyNNDubB6UEElLwQcEELK0PRaQv/oMI1gehkoqCPmRnowlY6UMi5iGS2WaFuDurha4asGDAPAS6uDP3k3Nn7mZ3M3u/75x77p1z7tyFlsDce/5853e+f+e79yJUf2MtARzr2VeThwqAMYegAqACYMwlMObTrzRABcCYS2DMp19pgAqA8klg+uDJfRHhXtyFJ5DwCwiwGyHa158pPqn/TwATycwRoPtICvQw/jfh/R7iXUBaUV1aXL4z/5vySQrKEQZ+5nMzR9WEOgcI+xDoWF4LFYNCsNpTMIek3um0L9/Iq6+i2g3WBNSfnfkK1NSrAHSwKGFt70cDQYB3I6Q/rNxuvTaqcWTpNygA4p0+qd7Ic5fbCjOBgQAvhKQZggBgqtG8qADO2y5O0fchwcMI8HJnYe5s0X2b9uctANqRg1rtO4h0xnRSvlyvtUIP8NpKe27GlzENMWP+DW360OylkBd+mK/gKwheaYC+Y4eXAOAJ/7DMPiKtESKib3cW5n+UvTU3LXgBgFb3OKmuA8EgVs8+uYFT1kWgBwT4YQSwigQPAKK/YgT3iOhWZ/HKapIzqCnYS/F/uAcIpxTQHiR4CpD2EODu7CPa3AIuUrc3o/t32655ayMHYOpw83uK4FXzoQ+9Y40Ab2Ev+pnrxI2OQHASz9QAXiCAp7KON9YGgDc77bnjWdvKcv9IAag3Zu9kieMTIerkTJEedz/xBEcU4NcI4ZksC0CAN0YJwUgA0AKcmISrtqpVq/JI4ZXO7dGHWTEMu+CIIniJAK2SUhrk7jod/9tf5m9mgcnm3sIBmGqcOq8gumgzWL1bovXo9VEISjLeLImqUZmEQgGYajTfUgDnJMLccg3Cau9/dNrXhd8+Hw1CbVL9xMa8FW0SCgNgujF73TSFG3vyPTrt2qEzBtDyBltTVyQEhQBw4FDz7ybO0iCEu7bscQbNhIl6Y3YegU5sPoLm7i8KgtwBONCY+a+Js6fj9qX2/Mc5AYX2u41/gATvLy209uc511wBONBo/tskZi6K+jwFyrVtbgpxcbk99yzXru3vuQFgGuNHoC6stC//2HYiId1nerqZ58bIBQBDb3+NQD0f0hm6C9j6DiJel/oFeUHgHADDOH9tud36mAuBhthGDMEE/p4Q4jpF7i8CvOL6aNkpAP34F//ETUT/XlZnTzL3zdeYOId5hMVOAZB6/NXiP46J1DnUECy1W5OmoO10vTMA6oebH0iOc6vFH74UZkkjd5GBEwAMjnTXqBvVfTgHd7WDXLYzMKHvSgpiiPBtFyegmQGIizkm1AcSQRCo4+Pm7Uvkst0nkPhR8eFRN9qfdTNlBkCq+scpzjdd9O3XTx+a+RYi/pBrBwE+XGq3Psldl/Z7JgAGNXy/5gaQVwzL9Rvy71ON2XkFdJKbQ9aNlQ2ARvMjzl756PRNf/7FLytVe5MAPgUEhAj/iqLeNzrv/fYqJ/AifxceomXKpVgDICV0ud2y7iMPYevFR1X73WNtExBR70WfIBjUFbwLQKlV0gTwTqfdet5GXtaLU280ieswQvi+b8/MHWg0/xHv/KF/dH+5Pf8Jbl5F/i6JsLLkBqwAkOx+H1W/Xrj6oWYEuMNT0QS0vNBSRS6wpC9Jgs1WC1gBUBfY/qzOiUQwNtdwmss3kxVD239ghnO2rXwBYwCEKilzeGKzuJJ7QgRAz0tSW2Fjco0BkOx+6NFXfa3jCxUA4UGbsRYwAmD6cPMMEuhn93b8K6KMSbLTd7omVABiLSCorTTNthoBUG809VHv0dQF8Hj3x/aUiV589AESecu0gNlBkSkAqaGf77s/dAAkvoBpSCgGQOL82TghWdS5zb0hawA9X0nFlUkEJgZAYn98Vp8JLKEDIDp9RVhdvt16WrJB5AA0mutpBYwhqP8ymACJGQAAcTQgAmC6ceoYQnQ9jagQ1H9ZAJCYAWk0IAJAUuYdgvovCwCSaEBaMSQCgLP/oaj/sgDQNwPMI3dCP0AGAGP/I4Cfr7RbL0ucjlFfE7oT+MiZnZ2HlIIRaTgoAoATWm+dngvl2X1uLqGYMpEZ6EZPczWDLACSk6hQhFYmEyCZi+RMhgWAcwB9Pfcv41nA9jlxfoAkMhMAkF6cGJIDKNk1IWkzDgBJMS4LABcBAJgdPlROoDsJcI+TScrGeQCYcCOPJ1bdiejxlsriBOqZce9UlphnFgCuAERiZ/JcUJO2JRlNQjjbud1626TdUV0rOKBjU8IsAAeYHAARveL65cdb6vZHJV1X/eb43AEXoUlyAZkBcJ0D2LFu39WCjKqdHJ47KAQAzma6BiC9bn9Uq+eqX7fPHXDJICcagAPAddiUWrfvah1G1Y7j5w4ktQHc+rAmoALALS3cgpj2lnV9MgPg2gTUGzP/AcA9poII4XoE+OdSu/VpV2MtRANwUYAk32wy4coJlEurKCcw9RFwkwJE6dQ0BKAmfoBEUzs+xydtbNTXbYSBUbPz3pUFl8PhXiThxAnk8s1BJYIEr7ORllK5XEjbtgpKBKVXnkhLj2wn6fq+rE6T6/FkaY97StvRWUD6C58lJ05ZJun63jIBwL2PWXJSy0YB/IlTWK93LxMA3Emt5KCOBYArQZacOLnexVnaKxMA9cbsR2mvj5HUarIAuAg1siyY63vLBUD6a3okORoWAEmyIY9Q0PXCJ+2VBQDR0baLolAtOK4mICRHsCwAcLWaet0kaWdWA8QAMC+CDskPKAsA3CtjJBGAXlsRAHzpkdtXmOel/gfaLPUdB5Jdk+f4pG1zIEscQDEA3LmzbigUP4ATXAgASNQ/Cey/GADJzpFknaR053ldGQDg4n+p/TcDgPUDwjADZQCAm4PU/psBIHhZYQhmgBOe7yZApP4NCnVFTqAmRZIPCMEMhA4A5/2bqH8jDTDwA6rXxOXpoDBtc1nZwe03l9ut56TDFGuAGACBGTCxP9JBurwuZA0gcf5MK7SMABiYgeW0j0ToKpQeqFd8/QxsqABINp+p+jc2AfoGQRWKzi5VL4t2qbZ8elm0xBn0OTEUogbgjuQT1mwiGCMTkHQk1AJOv3DpakNxD57YCNHV2HZqh6vL1PfZluZZASDWAh5+MibtuQPXdfsuwJDE/Ta2PxmbFQAGvoB3WiCkj0ZJUvBZdr+VE5iQI4kI4g4I3l9aaO13sRtctbHluQM9xvizce7r9rOOV6L6TV4LO2w81hpAmheICQW80WnPHc8qkHG6nyvGTWSRNf2eCYAYAuFXw22dlHFa9A0nu3HqvILoIjt34dtA09rJDICkVmBga7rUo9O+fkuIFXZBF0gTPrFmFZ755wqA1CFMIHDxxeuC1qLwbqTRlR5YVtWfOQrYLh2pzcrqtBS+KgV2KHT6dCGf+IMQ3PAzm4CkA20KJibhKgHuZjv1MDLgxpz37+LFN/gYhGTMzgDQnUn9gdgcVBBsrI/B4oPpaR8HgVMAYn+g0XxLAZzjOq58gn6RjZrAOxKt6dLub14b5wDoxg38AX1y2O2u0/FQXjcvAVtyjYm331/8fL7JkAsANhD0AN5cabcuSIQX+jWmi59nIi03AEwh0NfnOVFfoDHRjgMzmWttRa4AaKdQTao3EOiYdAF8LiaRzmHYdab2vr/4+b97IVcAksjAAoJuBHizLOcH04dnLyHRGROAioqScgcgmbSp6kuihJDTxya5ka1wFPcNhsIAsPEJEqHo3UARvR7KOUKcD9mFvwSCfSa7Pk9vf6dxFApADMGh2UuIZuow0QZAsOozCDY+z+aFcZXfN4GucAASv2BiEq+nfYs4bRJaI/QUzK3cbr1mMtm8rq03mhe1o0uAB2360LmQUZm6kQBg6xxuF64WnNYKRcOgPXqo4SlA9YJJhDMcjuLs/bD+RwbAhnNoaRKGwgBwvwd4CwD/6PrBlES9K4gOSlO3nDbw4S2rIwfAlTYYBgQBdpHoHiE+jABWAWlFX6e6tNiL4J5OP+vdHBHurSnYSwr2AqjPEsJuBNitgKb1a9hcLfjGGB0e53KQcb97AUAyyEGK9FLao2fchDz/fQ16dNanaMYrAOIo4eDJfTRRu6hSPozs+SI/Nrz+85J4baU9N+Pb2L0DYMM3eATCl0LVCD4vfCJnbwHYCoL6Zo3gZUJ40rcdtINn3Y0If9VZmDvr+3i9B2AzCIh4BGr4dQA46ptg9W7X5xcA+N1O+/IN38a303iCAWDzBJI4HFG9BEBWyRcXCxQncBDuUUQ/df3xTBfjk7QRJADbJ6ZjdNyFJ2oRzBLCM5KJ21wTLzjgXSJYBMRfhLTTS6UBuMVLYnsNBRDsqRF8EZDiL5ER4BMIMLE5DR1nFAd/BNBFoDUCtUoADwjpzzpv4FPoxs3f5PdSaACTCVfXbpVABcCYE1EBUAEw5hIY8+lXGqACYMwlMObTrzRABcCYS2DMp/9/NM4x6t07h4AAAAAASUVORK5CYII=",Og="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAAAXNSR0IArs4c6QAACbxJREFUeF7tnbFyGzcQhhcQXaRIkScI3UmulDFdpTDVpnIYzySdpKdIKavMU0jqkhmHTptKVJHK9CSVqc70G3jSpKEPmbvjURQlcRe4BQ6HWzWSLRB32P2w++/iRCqQr05bQHV69bJ4EAA6DoEAIAB03AIdX75EAAGg4xbo+PIlAggAaVpgd/9FH3q9PkD2PF+hAjMsVmpUv/iuoPxe/B/MVz8rU/ysjJpnGq7A6DksFvPrf/64GZOQyZKIAOvOLh2tSmdzfi0hUQCTTOmL6+nrCef0Tc3VWgBKp+tDbw7HPLIEwig4B9BXbQWiVQCsnG7g6FYIx5wV4vcG5jkM19PxaYjLcV2jFQDkjtc7+sQoOOJauLd5DMzblCaiBmB38HKoTHYW3W6n0pNHBQ2n12/H59SXhB4XJQCtd/ymFyMGISoA8lCveurMi4oPvbXuu14OwufsIKaSMhoAdgejEwXwis1Pt8o2mIOCj1VNn19j3QmFuKy+8t6Byop/6wyeG2X6rEBGJhYbB6AI95Bd1nZ87nBl5gbUxEdZVkDySA9LKBjEaCQgNApA7V2/NKIPh28DsooYHJWJAXjVZOnYCAC1c30kuyeHhCUyNKgNggNQJ+TnuwUW2UVMImo9Utx0Jx20TENQBwVg99noSBk4s833sTt+cz3OIDQAQTAAnPJ9g6HRFtL7xrumupC6IAgAT56OzqyUcwM7gcPhD81RwG95fhEKAu8A7A2+v7Sro81kNn1z4NMhTcztkhaUgfP378bHPu/XKwC2Oz8U9T4Nis1tmwp928QbAFYLLUK+Pm7rmTrm9PtEotrRl9RDLp8QeAHATu2nGfIxKAqBGAEE7ADY1fnddH4Fh9VzDp5OFFkBKMse/QGjv/x9t52/DkH5aBuheeShLGYFgK74xfl3dAH1NNTAfPZu/Ji2yfBRbADQRZ84v27TiFMUsgBAz/vifOyUkfpAjAF9wFE1sQCw93T0AS1pmEMXHtzaOYJcHTDZszYA1NDPRWw73Wp311QxzdEprAUA9UY5c5adKds7mtRLYWig1QKApvol77tiSGul17OvMwAkQgFgNh07X8PVcKm8jqoH6qRXZ+dQdr9RcBzzH0W0ARTSRqshCJ0AIN2UdPrY+CJtNsey0AkAnzfEZrWEJqKJbTctYA0ApenDUZ4k5D+WpVAEoYsWsAaAtPsX2eNYn9xl8UYDk/iKAg4AjMy29cvu90cHGgUcxKAVABTx5xKG/JksrZkpUcC26WYFANbzl93vHzg0BVtGATIAFPEndb9/AEh+sCgJyQCg+Ue6fv69v/xbROypK5s0QAZAwn8Q/5Iugm9Gek+ADsBgu/oX8UfyHcsgNA1Y6AASABT1L4c+LL4lTUKrBmhPDJEAwEKOqH+S31gHYdUAVQeQAMDyv6h/Vt+SJkOfxCKmARoAWP6X1i/JaZyD0DTABQB6ISn/OP1qNdcew8ZEIwAuAOklh9XqZDBqAVwH4EKwNgAiAFE/eRuAA4C/AxkKAFYBUNWmNyt0eGJMCFI2JwoASpk899cYgmhDiPBYXn0ALA4eGrNUohcOAwDyZ1/GQwn4ZPDDNwbMzwDwHQB82XL/fQKAPxWoX95Pf/+bcy1ohUYoBfEIEBiApfP/AoAvOI0VwVz/KVDfckKQJAB7g9GvAPBjBA7zcQu/zabjn7gmDgMA0mzgPgTaG4z+TSDsP+TjT7Pp+CsuAPJ5sGYQ5h88BQgAnP5qIQCBNYCkADve/EeAwACICKQDEEgDbH+rVx9PAkkZSIMgWQBoy5dRYRpByJs9+4gA4lqaBbCTWpazADkMojmjiVFBDoOwi8g7fjbh+vKa6OYkHNShfQCOPNOcidK+MsezmjgA2Pv/Eg4c0nZDc6vDegCUgzoUAEq7UYRgeAjwyEx7gy4iAFgvAH/0KLyJ0r4iVgFQtRkJABGC8cGECUBKCZiviggA8vm+ogOCE4Lmf0IFQAcAE4L5xz/Io2HBIMDDPy3/kwEoheB2HUANOcGslPCFuMK/FQCoDpA0EAw5LPzbbEaSBshXhp48SRoIAgAl/FPq/+pmyQBQ0gC19AhiqUQvgqViWx9YAUCiT8SgN/QozR/bP9W3A4BQDdjkH2+WSnRiTPzly7YJ/1YisLIpGoIYPsUiUf/VWhZFg7lsPqsIUIjBAdIUyrtLAT71upY1W/hi0u53SL/WAJDEoEQBVsQom85W/DlVAdWLSDckfQE2CNC0W6MEd4oApCiQ3xSxH81mqQQnolRerrvfSQRKFAhLGdb1K5S/Q+6vlQLIFYEIwlq0UEJ/nd1fKwIUFQGhL1ASKg+M2JKAnr0sJ6yz+2sDUJaFoxMF8GrrAqUqsPI/SWQzbSxnEbjSAnkU2NGXlA+PNp+zA/ksoe0sUD8sEpiqrNoAUJtDxbKZbtpqO7VsMC3v1xN+6yZhAYCcCkoKJrPpm4OW+SXI7dKdz6ep+AAoBKE6A1BDzFrSKr5rIarzuTcQGwA2VUGhPuW8YEUB3fn2p33oZsQG2P6e1rla1TDz2bvxY9trpDTeyvk1Gj4P2Yw1AqwqA0ppWA3OS8QOVgdlD4WWMgvl5Kmt7gUAO1FYVgddgoBc6q0CJZ/o24wE3gBwgkDB+fV0fJpSiN9cC6lxtvYi31rJLwD7L/rQ04dop/CWldIsE21DfmkS/7bwCkBVGVhDULSO04kGtrs+ZJXkHQAnYZiIQHTb9WEPz4IBYK0J1iBQAJPsc3balnOE3PHWUa8SfJ7UftAycJuIo5503ZnDwLwAQemL6+nrSYxCsY7ji0pI6ePQawsaAVbpgHqC+ICXc2Wcabi6fjs+jwGEPMdrA32j4MjpfhosgxsBwFkcblq3wahQa7evraPph2UaA+BGHL4cKpOdoc8TYFurgkHDFRg95w6lNw43Q8qBF3a7TYX8oI0g1AjLAVy76XY7AeZFOVXoBpiDgo85GMWYxaL4XonK4vrVV6/XB5X1wcDXZVg3fRaHR7Tr1+3UeARYvxnXsokKWvPjzMQszHFM1UxUAKzSwrPRkTLmkHvnNQZALvI0nMYiWqONAJsOKo+WWwxCxI6vbB1lBLgDwv6Lvt7RJ85lVuit31BN77LMVgCwSg25WHukh1FGhZaeX7QKgE3BWLZbmcoyl+2zdDossouYhJ3NUloLwF0Yen1tskMfZdvqWpXDQV9x9xlsnMY5NgkA7jNI2Vsoa3qdwfMSjOWXUeXPCsrvpuwZlP9nip8NqOV5g77K+wZt3eEYLMkCgC1cfr/kXQzRbQtIBOi2/2nvFt5xGyW9fIkASbsXX5wAgNso6RECQNLuxRcnAOA2SnrE//BWLNt9n4Z2AAAAAElFTkSuQmCC";function _c(i,e){return function(){return i.apply(e,arguments)}}const{toString:Fg}=Object.prototype,{getPrototypeOf:to}=Object,hn=(i=>e=>{const t=Fg.call(e);return i[t]||(i[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),Ct=i=>(i=i.toLowerCase(),e=>hn(e)===i),dn=i=>e=>typeof e===i,{isArray:ks}=Array,ii=dn("undefined");function Ng(i){return i!==null&&!ii(i)&&i.constructor!==null&&!ii(i.constructor)&&at(i.constructor.isBuffer)&&i.constructor.isBuffer(i)}const Pc=Ct("ArrayBuffer");function Mg(i){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(i):e=i&&i.buffer&&Pc(i.buffer),e}const Ug=dn("string"),at=dn("function"),kc=dn("number"),gn=i=>i!==null&&typeof i=="object",Bg=i=>i===!0||i===!1,wi=i=>{if(hn(i)!=="object")return!1;const e=to(i);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in i)&&!(Symbol.iterator in i)},$g=Ct("Date"),Gg=Ct("File"),Kg=Ct("Blob"),Hg=Ct("FileList"),Vg=i=>gn(i)&&at(i.pipe),Wg=i=>{let e;return i&&(typeof FormData=="function"&&i instanceof FormData||at(i.append)&&((e=hn(i))==="formdata"||e==="object"&&at(i.toString)&&i.toString()==="[object FormData]"))},Yg=Ct("URLSearchParams"),jg=i=>i.trim?i.trim():i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ai(i,e,{allOwnKeys:t=!1}={}){if(i===null||typeof i>"u")return;let s,n;if(typeof i!="object"&&(i=[i]),ks(i))for(s=0,n=i.length;s<n;s++)e.call(null,i[s],s,i);else{const r=t?Object.getOwnPropertyNames(i):Object.keys(i),o=r.length;let a;for(s=0;s<o;s++)a=r[s],e.call(null,i[a],a,i)}}function Oc(i,e){e=e.toLowerCase();const t=Object.keys(i);let s=t.length,n;for(;s-- >0;)if(n=t[s],e===n.toLowerCase())return n;return null}const Fc=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),Nc=i=>!ii(i)&&i!==Fc;function Er(){const{caseless:i}=Nc(this)&&this||{},e={},t=(s,n)=>{const r=i&&Oc(e,n)||n;wi(e[r])&&wi(s)?e[r]=Er(e[r],s):wi(s)?e[r]=Er({},s):ks(s)?e[r]=s.slice():e[r]=s};for(let s=0,n=arguments.length;s<n;s++)arguments[s]&&ai(arguments[s],t);return e}const qg=(i,e,t,{allOwnKeys:s}={})=>(ai(e,(n,r)=>{t&&at(n)?i[r]=_c(n,t):i[r]=n},{allOwnKeys:s}),i),zg=i=>(i.charCodeAt(0)===65279&&(i=i.slice(1)),i),Xg=(i,e,t,s)=>{i.prototype=Object.create(e.prototype,s),i.prototype.constructor=i,Object.defineProperty(i,"super",{value:e.prototype}),t&&Object.assign(i.prototype,t)},Qg=(i,e,t,s)=>{let n,r,o;const a={};if(e=e||{},i==null)return e;do{for(n=Object.getOwnPropertyNames(i),r=n.length;r-- >0;)o=n[r],(!s||s(o,i,e))&&!a[o]&&(e[o]=i[o],a[o]=!0);i=t!==!1&&to(i)}while(i&&(!t||t(i,e))&&i!==Object.prototype);return e},Jg=(i,e,t)=>{i=String(i),(t===void 0||t>i.length)&&(t=i.length),t-=e.length;const s=i.indexOf(e,t);return s!==-1&&s===t},Zg=i=>{if(!i)return null;if(ks(i))return i;let e=i.length;if(!kc(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=i[e];return t},e0=(i=>e=>i&&e instanceof i)(typeof Uint8Array<"u"&&to(Uint8Array)),t0=(i,e)=>{const s=(i&&i[Symbol.iterator]).call(i);let n;for(;(n=s.next())&&!n.done;){const r=n.value;e.call(i,r[0],r[1])}},s0=(i,e)=>{let t;const s=[];for(;(t=i.exec(e))!==null;)s.push(t);return s},i0=Ct("HTMLFormElement"),n0=i=>i.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,s,n){return s.toUpperCase()+n}),Ea=(({hasOwnProperty:i})=>(e,t)=>i.call(e,t))(Object.prototype),r0=Ct("RegExp"),Mc=(i,e)=>{const t=Object.getOwnPropertyDescriptors(i),s={};ai(t,(n,r)=>{let o;(o=e(n,r,i))!==!1&&(s[r]=o||n)}),Object.defineProperties(i,s)},o0=i=>{Mc(i,(e,t)=>{if(at(i)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const s=i[t];if(at(s)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},a0=(i,e)=>{const t={},s=n=>{n.forEach(r=>{t[r]=!0})};return ks(i)?s(i):s(String(i).split(e)),t},l0=()=>{},c0=(i,e)=>(i=+i,Number.isFinite(i)?i:e),wn="abcdefghijklmnopqrstuvwxyz",xa="0123456789",Uc={DIGIT:xa,ALPHA:wn,ALPHA_DIGIT:wn+wn.toUpperCase()+xa},u0=(i=16,e=Uc.ALPHA_DIGIT)=>{let t="";const{length:s}=e;for(;i--;)t+=e[Math.random()*s|0];return t};function f0(i){return!!(i&&at(i.append)&&i[Symbol.toStringTag]==="FormData"&&i[Symbol.iterator])}const h0=i=>{const e=new Array(10),t=(s,n)=>{if(gn(s)){if(e.indexOf(s)>=0)return;if(!("toJSON"in s)){e[n]=s;const r=ks(s)?[]:{};return ai(s,(o,a)=>{const l=t(o,n+1);!ii(l)&&(r[a]=l)}),e[n]=void 0,r}}return s};return t(i,0)},d0=Ct("AsyncFunction"),g0=i=>i&&(gn(i)||at(i))&&at(i.then)&&at(i.catch),k={isArray:ks,isArrayBuffer:Pc,isBuffer:Ng,isFormData:Wg,isArrayBufferView:Mg,isString:Ug,isNumber:kc,isBoolean:Bg,isObject:gn,isPlainObject:wi,isUndefined:ii,isDate:$g,isFile:Gg,isBlob:Kg,isRegExp:r0,isFunction:at,isStream:Vg,isURLSearchParams:Yg,isTypedArray:e0,isFileList:Hg,forEach:ai,merge:Er,extend:qg,trim:jg,stripBOM:zg,inherits:Xg,toFlatObject:Qg,kindOf:hn,kindOfTest:Ct,endsWith:Jg,toArray:Zg,forEachEntry:t0,matchAll:s0,isHTMLForm:i0,hasOwnProperty:Ea,hasOwnProp:Ea,reduceDescriptors:Mc,freezeMethods:o0,toObjectSet:a0,toCamelCase:n0,noop:l0,toFiniteNumber:c0,findKey:Oc,global:Fc,isContextDefined:Nc,ALPHABET:Uc,generateString:u0,isSpecCompliantForm:f0,toJSONObject:h0,isAsyncFn:d0,isThenable:g0};function me(i,e,t,s,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=i,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),s&&(this.request=s),n&&(this.response=n)}k.inherits(me,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:k.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const Bc=me.prototype,$c={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(i=>{$c[i]={value:i}});Object.defineProperties(me,$c);Object.defineProperty(Bc,"isAxiosError",{value:!0});me.from=(i,e,t,s,n,r)=>{const o=Object.create(Bc);return k.toFlatObject(i,o,function(l){return l!==Error.prototype},a=>a!=="isAxiosError"),me.call(o,i.message,e,t,s,n),o.cause=i,o.name=i.name,r&&Object.assign(o,r),o};const m0=null;function xr(i){return k.isPlainObject(i)||k.isArray(i)}function Gc(i){return k.endsWith(i,"[]")?i.slice(0,-2):i}function Aa(i,e,t){return i?i.concat(e).map(function(n,r){return n=Gc(n),!t&&r?"["+n+"]":n}).join(t?".":""):e}function p0(i){return k.isArray(i)&&!i.some(xr)}const y0=k.toFlatObject(k,{},null,function(e){return/^is[A-Z]/.test(e)});function mn(i,e,t){if(!k.isObject(i))throw new TypeError("target must be an object");e=e||new FormData,t=k.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,y){return!k.isUndefined(y[m])});const s=t.metaTokens,n=t.visitor||u,r=t.dots,o=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&k.isSpecCompliantForm(e);if(!k.isFunction(n))throw new TypeError("visitor must be a function");function c(g){if(g===null)return"";if(k.isDate(g))return g.toISOString();if(!l&&k.isBlob(g))throw new me("Blob is not supported. Use a Buffer instead.");return k.isArrayBuffer(g)||k.isTypedArray(g)?l&&typeof Blob=="function"?new Blob([g]):Buffer.from(g):g}function u(g,m,y){let T=g;if(g&&!y&&typeof g=="object"){if(k.endsWith(m,"{}"))m=s?m:m.slice(0,-2),g=JSON.stringify(g);else if(k.isArray(g)&&p0(g)||(k.isFileList(g)||k.endsWith(m,"[]"))&&(T=k.toArray(g)))return m=Gc(m),T.forEach(function(S,R){!(k.isUndefined(S)||S===null)&&e.append(o===!0?Aa([m],R,r):o===null?m:m+"[]",c(S))}),!1}return xr(g)?!0:(e.append(Aa(y,m,r),c(g)),!1)}const f=[],h=Object.assign(y0,{defaultVisitor:u,convertValue:c,isVisitable:xr});function d(g,m){if(!k.isUndefined(g)){if(f.indexOf(g)!==-1)throw Error("Circular reference detected in "+m.join("."));f.push(g),k.forEach(g,function(T,x){(!(k.isUndefined(T)||T===null)&&n.call(e,T,k.isString(x)?x.trim():x,m,h))===!0&&d(T,m?m.concat(x):[x])}),f.pop()}}if(!k.isObject(i))throw new TypeError("data must be an object");return d(i),e}function Sa(i){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(i).replace(/[!'()~]|%20|%00/g,function(s){return e[s]})}function so(i,e){this._pairs=[],i&&mn(i,this,e)}const Kc=so.prototype;Kc.append=function(e,t){this._pairs.push([e,t])};Kc.toString=function(e){const t=e?function(s){return e.call(this,s,Sa)}:Sa;return this._pairs.map(function(n){return t(n[0])+"="+t(n[1])},"").join("&")};function T0(i){return encodeURIComponent(i).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Hc(i,e,t){if(!e)return i;const s=t&&t.encode||T0,n=t&&t.serialize;let r;if(n?r=n(e,t):r=k.isURLSearchParams(e)?e.toString():new so(e,t).toString(s),r){const o=i.indexOf("#");o!==-1&&(i=i.slice(0,o)),i+=(i.indexOf("?")===-1?"?":"&")+r}return i}class E0{constructor(){this.handlers=[]}use(e,t,s){return this.handlers.push({fulfilled:e,rejected:t,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){k.forEach(this.handlers,function(s){s!==null&&e(s)})}}const va=E0,Vc={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},x0=typeof URLSearchParams<"u"?URLSearchParams:so,A0=typeof FormData<"u"?FormData:null,S0=typeof Blob<"u"?Blob:null,v0=(()=>{let i;return typeof navigator<"u"&&((i=navigator.product)==="ReactNative"||i==="NativeScript"||i==="NS")?!1:typeof window<"u"&&typeof document<"u"})(),R0=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),pt={isBrowser:!0,classes:{URLSearchParams:x0,FormData:A0,Blob:S0},isStandardBrowserEnv:v0,isStandardBrowserWebWorkerEnv:R0,protocols:["http","https","file","blob","url","data"]};function L0(i,e){return mn(i,new pt.classes.URLSearchParams,Object.assign({visitor:function(t,s,n,r){return pt.isNode&&k.isBuffer(t)?(this.append(s,t.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},e))}function b0(i){return k.matchAll(/\w+|\[(\w*)]/g,i).map(e=>e[0]==="[]"?"":e[1]||e[0])}function I0(i){const e={},t=Object.keys(i);let s;const n=t.length;let r;for(s=0;s<n;s++)r=t[s],e[r]=i[r];return e}function Wc(i){function e(t,s,n,r){let o=t[r++];const a=Number.isFinite(+o),l=r>=t.length;return o=!o&&k.isArray(n)?n.length:o,l?(k.hasOwnProp(n,o)?n[o]=[n[o],s]:n[o]=s,!a):((!n[o]||!k.isObject(n[o]))&&(n[o]=[]),e(t,s,n[o],r)&&k.isArray(n[o])&&(n[o]=I0(n[o])),!a)}if(k.isFormData(i)&&k.isFunction(i.entries)){const t={};return k.forEachEntry(i,(s,n)=>{e(b0(s),n,t,0)}),t}return null}function D0(i,e,t){if(k.isString(i))try{return(e||JSON.parse)(i),k.trim(i)}catch(s){if(s.name!=="SyntaxError")throw s}return(t||JSON.stringify)(i)}const io={transitional:Vc,adapter:pt.isNode?"http":"xhr",transformRequest:[function(e,t){const s=t.getContentType()||"",n=s.indexOf("application/json")>-1,r=k.isObject(e);if(r&&k.isHTMLForm(e)&&(e=new FormData(e)),k.isFormData(e))return n&&n?JSON.stringify(Wc(e)):e;if(k.isArrayBuffer(e)||k.isBuffer(e)||k.isStream(e)||k.isFile(e)||k.isBlob(e))return e;if(k.isArrayBufferView(e))return e.buffer;if(k.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(r){if(s.indexOf("application/x-www-form-urlencoded")>-1)return L0(e,this.formSerializer).toString();if((a=k.isFileList(e))||s.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return mn(a?{"files[]":e}:e,l&&new l,this.formSerializer)}}return r||n?(t.setContentType("application/json",!1),D0(e)):e}],transformResponse:[function(e){const t=this.transitional||io.transitional,s=t&&t.forcedJSONParsing,n=this.responseType==="json";if(e&&k.isString(e)&&(s&&!this.responseType||n)){const o=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?me.from(a,me.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:pt.classes.FormData,Blob:pt.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};k.forEach(["delete","get","head","post","put","patch"],i=>{io.headers[i]={}});const no=io,C0=k.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),w0=i=>{const e={};let t,s,n;return i&&i.split(`
`).forEach(function(o){n=o.indexOf(":"),t=o.substring(0,n).trim().toLowerCase(),s=o.substring(n+1).trim(),!(!t||e[t]&&C0[t])&&(t==="set-cookie"?e[t]?e[t].push(s):e[t]=[s]:e[t]=e[t]?e[t]+", "+s:s)}),e},Ra=Symbol("internals");function Us(i){return i&&String(i).trim().toLowerCase()}function _i(i){return i===!1||i==null?i:k.isArray(i)?i.map(_i):String(i)}function _0(i){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=t.exec(i);)e[s[1]]=s[2];return e}const P0=i=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(i.trim());function _n(i,e,t,s,n){if(k.isFunction(s))return s.call(this,e,t);if(n&&(e=t),!!k.isString(e)){if(k.isString(s))return e.indexOf(s)!==-1;if(k.isRegExp(s))return s.test(e)}}function k0(i){return i.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,s)=>t.toUpperCase()+s)}function O0(i,e){const t=k.toCamelCase(" "+e);["get","set","has"].forEach(s=>{Object.defineProperty(i,s+t,{value:function(n,r,o){return this[s].call(this,e,n,r,o)},configurable:!0})})}class pn{constructor(e){e&&this.set(e)}set(e,t,s){const n=this;function r(a,l,c){const u=Us(l);if(!u)throw new Error("header name must be a non-empty string");const f=k.findKey(n,u);(!f||n[f]===void 0||c===!0||c===void 0&&n[f]!==!1)&&(n[f||l]=_i(a))}const o=(a,l)=>k.forEach(a,(c,u)=>r(c,u,l));return k.isPlainObject(e)||e instanceof this.constructor?o(e,t):k.isString(e)&&(e=e.trim())&&!P0(e)?o(w0(e),t):e!=null&&r(t,e,s),this}get(e,t){if(e=Us(e),e){const s=k.findKey(this,e);if(s){const n=this[s];if(!t)return n;if(t===!0)return _0(n);if(k.isFunction(t))return t.call(this,n,s);if(k.isRegExp(t))return t.exec(n);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Us(e),e){const s=k.findKey(this,e);return!!(s&&this[s]!==void 0&&(!t||_n(this,this[s],s,t)))}return!1}delete(e,t){const s=this;let n=!1;function r(o){if(o=Us(o),o){const a=k.findKey(s,o);a&&(!t||_n(s,s[a],a,t))&&(delete s[a],n=!0)}}return k.isArray(e)?e.forEach(r):r(e),n}clear(e){const t=Object.keys(this);let s=t.length,n=!1;for(;s--;){const r=t[s];(!e||_n(this,this[r],r,e,!0))&&(delete this[r],n=!0)}return n}normalize(e){const t=this,s={};return k.forEach(this,(n,r)=>{const o=k.findKey(s,r);if(o){t[o]=_i(n),delete t[r];return}const a=e?k0(r):String(r).trim();a!==r&&delete t[r],t[a]=_i(n),s[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return k.forEach(this,(s,n)=>{s!=null&&s!==!1&&(t[n]=e&&k.isArray(s)?s.join(", "):s)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(`
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const s=new this(e);return t.forEach(n=>s.set(n)),s}static accessor(e){const s=(this[Ra]=this[Ra]={accessors:{}}).accessors,n=this.prototype;function r(o){const a=Us(o);s[a]||(O0(n,o),s[a]=!0)}return k.isArray(e)?e.forEach(r):r(e),this}}pn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);k.reduceDescriptors(pn.prototype,({value:i},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>i,set(s){this[t]=s}}});k.freezeMethods(pn);const Mt=pn;function Pn(i,e){const t=this||no,s=e||t,n=Mt.from(s.headers);let r=s.data;return k.forEach(i,function(a){r=a.call(t,r,n.normalize(),e?e.status:void 0)}),n.normalize(),r}function Yc(i){return!!(i&&i.__CANCEL__)}function li(i,e,t){me.call(this,i??"canceled",me.ERR_CANCELED,e,t),this.name="CanceledError"}k.inherits(li,me,{__CANCEL__:!0});function F0(i,e,t){const s=t.config.validateStatus;!t.status||!s||s(t.status)?i(t):e(new me("Request failed with status code "+t.status,[me.ERR_BAD_REQUEST,me.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}const N0=pt.isStandardBrowserEnv?function(){return{write:function(t,s,n,r,o,a){const l=[];l.push(t+"="+encodeURIComponent(s)),k.isNumber(n)&&l.push("expires="+new Date(n).toGMTString()),k.isString(r)&&l.push("path="+r),k.isString(o)&&l.push("domain="+o),a===!0&&l.push("secure"),document.cookie=l.join("; ")},read:function(t){const s=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return s?decodeURIComponent(s[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}();function M0(i){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i)}function U0(i,e){return e?i.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):i}function jc(i,e){return i&&!M0(e)?U0(i,e):e}const B0=pt.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let s;function n(r){let o=r;return e&&(t.setAttribute("href",o),o=t.href),t.setAttribute("href",o),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return s=n(window.location.href),function(o){const a=k.isString(o)?n(o):o;return a.protocol===s.protocol&&a.host===s.host}}():function(){return function(){return!0}}();function $0(i){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(i);return e&&e[1]||""}function G0(i,e){i=i||10;const t=new Array(i),s=new Array(i);let n=0,r=0,o;return e=e!==void 0?e:1e3,function(l){const c=Date.now(),u=s[r];o||(o=c),t[n]=l,s[n]=c;let f=r,h=0;for(;f!==n;)h+=t[f++],f=f%i;if(n=(n+1)%i,n===r&&(r=(r+1)%i),c-o<e)return;const d=u&&c-u;return d?Math.round(h*1e3/d):void 0}}function La(i,e){let t=0;const s=G0(50,250);return n=>{const r=n.loaded,o=n.lengthComputable?n.total:void 0,a=r-t,l=s(a),c=r<=o;t=r;const u={loaded:r,total:o,progress:o?r/o:void 0,bytes:a,rate:l||void 0,estimated:l&&o&&c?(o-r)/l:void 0,event:n};u[e?"download":"upload"]=!0,i(u)}}const K0=typeof XMLHttpRequest<"u",H0=K0&&function(i){return new Promise(function(t,s){let n=i.data;const r=Mt.from(i.headers).normalize(),o=i.responseType;let a;function l(){i.cancelToken&&i.cancelToken.unsubscribe(a),i.signal&&i.signal.removeEventListener("abort",a)}k.isFormData(n)&&(pt.isStandardBrowserEnv||pt.isStandardBrowserWebWorkerEnv?r.setContentType(!1):r.setContentType("multipart/form-data;",!1));let c=new XMLHttpRequest;if(i.auth){const d=i.auth.username||"",g=i.auth.password?unescape(encodeURIComponent(i.auth.password)):"";r.set("Authorization","Basic "+btoa(d+":"+g))}const u=jc(i.baseURL,i.url);c.open(i.method.toUpperCase(),Hc(u,i.params,i.paramsSerializer),!0),c.timeout=i.timeout;function f(){if(!c)return;const d=Mt.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders()),m={data:!o||o==="text"||o==="json"?c.responseText:c.response,status:c.status,statusText:c.statusText,headers:d,config:i,request:c};F0(function(T){t(T),l()},function(T){s(T),l()},m),c=null}if("onloadend"in c?c.onloadend=f:c.onreadystatechange=function(){!c||c.readyState!==4||c.status===0&&!(c.responseURL&&c.responseURL.indexOf("file:")===0)||setTimeout(f)},c.onabort=function(){c&&(s(new me("Request aborted",me.ECONNABORTED,i,c)),c=null)},c.onerror=function(){s(new me("Network Error",me.ERR_NETWORK,i,c)),c=null},c.ontimeout=function(){let g=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const m=i.transitional||Vc;i.timeoutErrorMessage&&(g=i.timeoutErrorMessage),s(new me(g,m.clarifyTimeoutError?me.ETIMEDOUT:me.ECONNABORTED,i,c)),c=null},pt.isStandardBrowserEnv){const d=(i.withCredentials||B0(u))&&i.xsrfCookieName&&N0.read(i.xsrfCookieName);d&&r.set(i.xsrfHeaderName,d)}n===void 0&&r.setContentType(null),"setRequestHeader"in c&&k.forEach(r.toJSON(),function(g,m){c.setRequestHeader(m,g)}),k.isUndefined(i.withCredentials)||(c.withCredentials=!!i.withCredentials),o&&o!=="json"&&(c.responseType=i.responseType),typeof i.onDownloadProgress=="function"&&c.addEventListener("progress",La(i.onDownloadProgress,!0)),typeof i.onUploadProgress=="function"&&c.upload&&c.upload.addEventListener("progress",La(i.onUploadProgress)),(i.cancelToken||i.signal)&&(a=d=>{c&&(s(!d||d.type?new li(null,i,c):d),c.abort(),c=null)},i.cancelToken&&i.cancelToken.subscribe(a),i.signal&&(i.signal.aborted?a():i.signal.addEventListener("abort",a)));const h=$0(u);if(h&&pt.protocols.indexOf(h)===-1){s(new me("Unsupported protocol "+h+":",me.ERR_BAD_REQUEST,i));return}c.send(n||null)})},Pi={http:m0,xhr:H0};k.forEach(Pi,(i,e)=>{if(i){try{Object.defineProperty(i,"name",{value:e})}catch{}Object.defineProperty(i,"adapterName",{value:e})}});const qc={getAdapter:i=>{i=k.isArray(i)?i:[i];const{length:e}=i;let t,s;for(let n=0;n<e&&(t=i[n],!(s=k.isString(t)?Pi[t.toLowerCase()]:t));n++);if(!s)throw s===!1?new me(`Adapter ${t} is not supported by the environment`,"ERR_NOT_SUPPORT"):new Error(k.hasOwnProp(Pi,t)?`Adapter '${t}' is not available in the build`:`Unknown adapter '${t}'`);if(!k.isFunction(s))throw new TypeError("adapter is not a function");return s},adapters:Pi};function kn(i){if(i.cancelToken&&i.cancelToken.throwIfRequested(),i.signal&&i.signal.aborted)throw new li(null,i)}function ba(i){return kn(i),i.headers=Mt.from(i.headers),i.data=Pn.call(i,i.transformRequest),["post","put","patch"].indexOf(i.method)!==-1&&i.headers.setContentType("application/x-www-form-urlencoded",!1),qc.getAdapter(i.adapter||no.adapter)(i).then(function(s){return kn(i),s.data=Pn.call(i,i.transformResponse,s),s.headers=Mt.from(s.headers),s},function(s){return Yc(s)||(kn(i),s&&s.response&&(s.response.data=Pn.call(i,i.transformResponse,s.response),s.response.headers=Mt.from(s.response.headers))),Promise.reject(s)})}const Ia=i=>i instanceof Mt?i.toJSON():i;function Cs(i,e){e=e||{};const t={};function s(c,u,f){return k.isPlainObject(c)&&k.isPlainObject(u)?k.merge.call({caseless:f},c,u):k.isPlainObject(u)?k.merge({},u):k.isArray(u)?u.slice():u}function n(c,u,f){if(k.isUndefined(u)){if(!k.isUndefined(c))return s(void 0,c,f)}else return s(c,u,f)}function r(c,u){if(!k.isUndefined(u))return s(void 0,u)}function o(c,u){if(k.isUndefined(u)){if(!k.isUndefined(c))return s(void 0,c)}else return s(void 0,u)}function a(c,u,f){if(f in e)return s(c,u);if(f in i)return s(void 0,c)}const l={url:r,method:r,data:r,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(c,u)=>n(Ia(c),Ia(u),!0)};return k.forEach(Object.keys(Object.assign({},i,e)),function(u){const f=l[u]||n,h=f(i[u],e[u],u);k.isUndefined(h)&&f!==a||(t[u]=h)}),t}const zc="1.5.0",ro={};["object","boolean","number","function","string","symbol"].forEach((i,e)=>{ro[i]=function(s){return typeof s===i||"a"+(e<1?"n ":" ")+i}});const Da={};ro.transitional=function(e,t,s){function n(r,o){return"[Axios v"+zc+"] Transitional option '"+r+"'"+o+(s?". "+s:"")}return(r,o,a)=>{if(e===!1)throw new me(n(o," has been removed"+(t?" in "+t:"")),me.ERR_DEPRECATED);return t&&!Da[o]&&(Da[o]=!0,console.warn(n(o," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(r,o,a):!0}};function V0(i,e,t){if(typeof i!="object")throw new me("options must be an object",me.ERR_BAD_OPTION_VALUE);const s=Object.keys(i);let n=s.length;for(;n-- >0;){const r=s[n],o=e[r];if(o){const a=i[r],l=a===void 0||o(a,r,i);if(l!==!0)throw new me("option "+r+" must be "+l,me.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new me("Unknown option "+r,me.ERR_BAD_OPTION)}}const Ar={assertOptions:V0,validators:ro},Kt=Ar.validators;class Ki{constructor(e){this.defaults=e,this.interceptors={request:new va,response:new va}}request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Cs(this.defaults,t);const{transitional:s,paramsSerializer:n,headers:r}=t;s!==void 0&&Ar.assertOptions(s,{silentJSONParsing:Kt.transitional(Kt.boolean),forcedJSONParsing:Kt.transitional(Kt.boolean),clarifyTimeoutError:Kt.transitional(Kt.boolean)},!1),n!=null&&(k.isFunction(n)?t.paramsSerializer={serialize:n}:Ar.assertOptions(n,{encode:Kt.function,serialize:Kt.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=r&&k.merge(r.common,r[t.method]);r&&k.forEach(["delete","get","head","post","put","patch","common"],g=>{delete r[g]}),t.headers=Mt.concat(o,r);const a=[];let l=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(t)===!1||(l=l&&m.synchronous,a.unshift(m.fulfilled,m.rejected))});const c=[];this.interceptors.response.forEach(function(m){c.push(m.fulfilled,m.rejected)});let u,f=0,h;if(!l){const g=[ba.bind(this),void 0];for(g.unshift.apply(g,a),g.push.apply(g,c),h=g.length,u=Promise.resolve(t);f<h;)u=u.then(g[f++],g[f++]);return u}h=a.length;let d=t;for(f=0;f<h;){const g=a[f++],m=a[f++];try{d=g(d)}catch(y){m.call(this,y);break}}try{u=ba.call(this,d)}catch(g){return Promise.reject(g)}for(f=0,h=c.length;f<h;)u=u.then(c[f++],c[f++]);return u}getUri(e){e=Cs(this.defaults,e);const t=jc(e.baseURL,e.url);return Hc(t,e.params,e.paramsSerializer)}}k.forEach(["delete","get","head","options"],function(e){Ki.prototype[e]=function(t,s){return this.request(Cs(s||{},{method:e,url:t,data:(s||{}).data}))}});k.forEach(["post","put","patch"],function(e){function t(s){return function(r,o,a){return this.request(Cs(a||{},{method:e,headers:s?{"Content-Type":"multipart/form-data"}:{},url:r,data:o}))}}Ki.prototype[e]=t(),Ki.prototype[e+"Form"]=t(!0)});const ki=Ki;class oo{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(r){t=r});const s=this;this.promise.then(n=>{if(!s._listeners)return;let r=s._listeners.length;for(;r-- >0;)s._listeners[r](n);s._listeners=null}),this.promise.then=n=>{let r;const o=new Promise(a=>{s.subscribe(a),r=a}).then(n);return o.cancel=function(){s.unsubscribe(r)},o},e(function(r,o,a){s.reason||(s.reason=new li(r,o,a),t(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}static source(){let e;return{token:new oo(function(n){e=n}),cancel:e}}}const W0=oo;function Y0(i){return function(t){return i.apply(null,t)}}function j0(i){return k.isObject(i)&&i.isAxiosError===!0}const Sr={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Sr).forEach(([i,e])=>{Sr[e]=i});const q0=Sr;function Xc(i){const e=new ki(i),t=_c(ki.prototype.request,e);return k.extend(t,ki.prototype,e,{allOwnKeys:!0}),k.extend(t,e,null,{allOwnKeys:!0}),t.create=function(n){return Xc(Cs(i,n))},t}const Fe=Xc(no);Fe.Axios=ki;Fe.CanceledError=li;Fe.CancelToken=W0;Fe.isCancel=Yc;Fe.VERSION=zc;Fe.toFormData=mn;Fe.AxiosError=me;Fe.Cancel=Fe.CanceledError;Fe.all=function(e){return Promise.all(e)};Fe.spread=Y0;Fe.isAxiosError=j0;Fe.mergeConfig=Cs;Fe.AxiosHeaders=Mt;Fe.formToJSON=i=>Wc(k.isHTMLForm(i)?new FormData(i):i);Fe.getAdapter=qc.getAdapter;Fe.HttpStatusCode=q0;Fe.default=Fe;const Ca=Fe;function Qc(i){const e=Ca.create({baseURL:"https://hk.ynzhsk.cn/api/",timeout:5e3});return Ca.defaults.withCredentials=!0,e.interceptors.request.use(t=>t,t=>{}),e.interceptors.response.use(t=>t.data,t=>{}),e(i)}function z0(i){return Qc({url:"/reservoir/hkws/Isc/CameraUrlall",method:"post",data:i})}function wa(i){return Qc({url:"/reservoir/hkws/Isc/yuntai",method:"post",data:i})}function X0(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Jc={exports:{}};(function(i,e){(function(t){var s=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,n=/^(?=([^\/?#]*))\1([^]*)$/,r=/(?:\/|^)\.(?=\/)/g,o=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,a={buildAbsoluteURL:function(l,c,u){if(u=u||{},l=l.trim(),c=c.trim(),!c){if(!u.alwaysNormalize)return l;var f=a.parseURL(l);if(!f)throw new Error("Error trying to parse base URL.");return f.path=a.normalizePath(f.path),a.buildURLFromParts(f)}var h=a.parseURL(c);if(!h)throw new Error("Error trying to parse relative URL.");if(h.scheme)return u.alwaysNormalize?(h.path=a.normalizePath(h.path),a.buildURLFromParts(h)):c;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 g=n.exec(d.path);d.netLoc=g[1],d.path=g[2]}d.netLoc&&!d.path&&(d.path="/");var m={scheme:d.scheme,netLoc:h.netLoc,path:null,params:h.params,query:h.query,fragment:h.fragment};if(!h.netLoc&&(m.netLoc=d.netLoc,h.path[0]!=="/"))if(!h.path)m.path=d.path,h.params||(m.params=d.params,h.query||(m.query=d.query));else{var y=d.path,T=y.substring(0,y.lastIndexOf("/")+1)+h.path;m.path=a.normalizePath(T)}return m.path===null&&(m.path=u.alwaysNormalize?a.normalizePath(h.path):h.path),a.buildURLFromParts(m)},parseURL:function(l){var c=s.exec(l);return c?{scheme:c[1]||"",netLoc:c[2]||"",path:c[3]||"",params:c[4]||"",query:c[5]||"",fragment:c[6]||""}:null},normalizePath:function(l){for(l=l.split("").reverse().join("").replace(r,"");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}};i.exports=a})()})(Jc);var ao=Jc.exports;function _a(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);e&&(s=s.filter(function(n){return Object.getOwnPropertyDescriptor(i,n).enumerable})),t.push.apply(t,s)}return t}function tt(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?_a(Object(t),!0).forEach(function(s){Q0(i,s,t[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):_a(Object(t)).forEach(function(s){Object.defineProperty(i,s,Object.getOwnPropertyDescriptor(t,s))})}return i}function Q0(i,e,t){return e=Z0(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Me(){return Me=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(i[s]=t[s])}return i},Me.apply(this,arguments)}function J0(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var s=t.call(i,e||"default");if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function Z0(i){var e=J0(i,"string");return typeof e=="symbol"?e:String(e)}const J=Number.isFinite||function(i){return typeof i=="number"&&isFinite(i)};let p=function(i){return i.MEDIA_ATTACHING="hlsMediaAttaching",i.MEDIA_ATTACHED="hlsMediaAttached",i.MEDIA_DETACHING="hlsMediaDetaching",i.MEDIA_DETACHED="hlsMediaDetached",i.BUFFER_RESET="hlsBufferReset",i.BUFFER_CODECS="hlsBufferCodecs",i.BUFFER_CREATED="hlsBufferCreated",i.BUFFER_APPENDING="hlsBufferAppending",i.BUFFER_APPENDED="hlsBufferAppended",i.BUFFER_EOS="hlsBufferEos",i.BUFFER_FLUSHING="hlsBufferFlushing",i.BUFFER_FLUSHED="hlsBufferFlushed",i.MANIFEST_LOADING="hlsManifestLoading",i.MANIFEST_LOADED="hlsManifestLoaded",i.MANIFEST_PARSED="hlsManifestParsed",i.LEVEL_SWITCHING="hlsLevelSwitching",i.LEVEL_SWITCHED="hlsLevelSwitched",i.LEVEL_LOADING="hlsLevelLoading",i.LEVEL_LOADED="hlsLevelLoaded",i.LEVEL_UPDATED="hlsLevelUpdated",i.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",i.LEVELS_UPDATED="hlsLevelsUpdated",i.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",i.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",i.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",i.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",i.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",i.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",i.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",i.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",i.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",i.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",i.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",i.CUES_PARSED="hlsCuesParsed",i.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",i.INIT_PTS_FOUND="hlsInitPtsFound",i.FRAG_LOADING="hlsFragLoading",i.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",i.FRAG_LOADED="hlsFragLoaded",i.FRAG_DECRYPTED="hlsFragDecrypted",i.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",i.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",i.FRAG_PARSING_METADATA="hlsFragParsingMetadata",i.FRAG_PARSED="hlsFragParsed",i.FRAG_BUFFERED="hlsFragBuffered",i.FRAG_CHANGED="hlsFragChanged",i.FPS_DROP="hlsFpsDrop",i.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",i.ERROR="hlsError",i.DESTROYING="hlsDestroying",i.KEY_LOADING="hlsKeyLoading",i.KEY_LOADED="hlsKeyLoaded",i.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",i.BACK_BUFFER_REACHED="hlsBackBufferReached",i}({}),se=function(i){return i.NETWORK_ERROR="networkError",i.MEDIA_ERROR="mediaError",i.KEY_SYSTEM_ERROR="keySystemError",i.MUX_ERROR="muxError",i.OTHER_ERROR="otherError",i}({}),D=function(i){return i.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",i.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",i.KEY_SYSTEM_NO_SESSION="keySystemNoSession",i.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",i.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",i.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",i.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",i.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",i.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",i.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",i.MANIFEST_LOAD_ERROR="manifestLoadError",i.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",i.MANIFEST_PARSING_ERROR="manifestParsingError",i.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",i.LEVEL_EMPTY_ERROR="levelEmptyError",i.LEVEL_LOAD_ERROR="levelLoadError",i.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",i.LEVEL_PARSING_ERROR="levelParsingError",i.LEVEL_SWITCH_ERROR="levelSwitchError",i.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",i.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",i.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",i.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",i.FRAG_LOAD_ERROR="fragLoadError",i.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",i.FRAG_DECRYPT_ERROR="fragDecryptError",i.FRAG_PARSING_ERROR="fragParsingError",i.FRAG_GAP="fragGap",i.REMUX_ALLOC_ERROR="remuxAllocError",i.KEY_LOAD_ERROR="keyLoadError",i.KEY_LOAD_TIMEOUT="keyLoadTimeOut",i.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",i.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",i.BUFFER_APPEND_ERROR="bufferAppendError",i.BUFFER_APPENDING_ERROR="bufferAppendingError",i.BUFFER_STALLED_ERROR="bufferStalledError",i.BUFFER_FULL_ERROR="bufferFullError",i.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",i.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",i.INTERNAL_EXCEPTION="internalException",i.INTERNAL_ABORTED="aborted",i.UNKNOWN="unknown",i}({});const ts=function(){},vr={trace:ts,debug:ts,log:ts,warn:ts,info:ts,error:ts};let qs=vr;function em(i){const e=self.console[i];return e?e.bind(self.console,`[${i}] >`):ts}function tm(i,...e){e.forEach(function(t){qs[t]=i[t]?i[t].bind(i):em(t)})}function sm(i,e){if(self.console&&i===!0||typeof i=="object"){tm(i,"debug","log","info","warn","error");try{qs.log(`Debug logs enabled for "${e}" in hls.js version 1.4.12`)}catch{qs=vr}}else qs=vr}const v=qs,im=/^(\d+)x(\d+)$/,Pa=/(.+?)=(".*?"|.*?)(?:,|$)/g;class Ce{constructor(e){typeof e=="string"&&(e=Ce.parseAttrList(e));for(const t in e)e.hasOwnProperty(t)&&(t.substring(0,2)==="X-"&&(this.clientAttrs=this.clientAttrs||[],this.clientAttrs.push(t)),this[t]=e[t])}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 s=new Uint8Array(t.length/2);for(let n=0;n<t.length/2;n++)s[n]=parseInt(t.slice(n*2,n*2+2),16);return s}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 s=this[e];return s?parseFloat(s):t}enumeratedString(e){return this[e]}bool(e){return this[e]==="YES"}decimalResolution(e){const t=im.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e){let t;const s={},n='"';for(Pa.lastIndex=0;(t=Pa.exec(e))!==null;){let r=t[2];r.indexOf(n)===0&&r.lastIndexOf(n)===r.length-1&&(r=r.slice(1,-1));const o=t[1].trim();s[o]=r}return s}}function nm(i){return i!=="ID"&&i!=="CLASS"&&i!=="START-DATE"&&i!=="DURATION"&&i!=="END-DATE"&&i!=="END-ON-NEXT"}function rm(i){return i==="SCTE35-OUT"||i==="SCTE35-IN"}class Zc{constructor(e,t){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,t){const s=t.attr;for(const n in s)if(Object.prototype.hasOwnProperty.call(e,n)&&e[n]!==s[n]){v.warn(`DATERANGE tag attribute: "${n}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=n;break}e=Me(new Ce({}),s,e)}if(this.attr=e,this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const s=new Date(this.attr["END-DATE"]);J(s.getTime())&&(this._endDate=s)}}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(J(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&&J(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)}}class yn{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 Re={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class eu{constructor(e){this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams={[Re.AUDIO]:null,[Re.VIDEO]:null,[Re.AUDIOVIDEO]:null},this.baseurl=e}setByteRange(e,t){const s=e.split("@",2),n=[];s.length===1?n[0]=t?t.byteRangeEndOffset:0:n[0]=parseInt(s[1]),n[1]=parseInt(s[0])+n[0],this._byteRange=n}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=ao.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}}class On extends eu{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 yn,this.urlId=0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 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 s=Object.keys(this.levelkeys);if(s.length===1)return this._decryptdata=this.levelkeys[s[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null||!J(this.programDateTime))return null;const e=J(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),s=t.length;if(s>1||s===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,s,n,r,o=!1){const{elementaryStreams:a}=this,l=a[e];if(!l){a[e]={startPTS:t,endPTS:s,startDTS:n,endDTS:r,partial:o};return}l.startPTS=Math.min(l.startPTS,t),l.endPTS=Math.max(l.endPTS,s),l.startDTS=Math.min(l.startDTS,n),l.endDTS=Math.max(l.endDTS,r)}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[Re.AUDIO]=null,e[Re.VIDEO]=null,e[Re.AUDIOVIDEO]=null}}class om extends eu{constructor(e,t,s,n,r){super(s),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 yn,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=n;const o=e.enumeratedString("BYTERANGE");o&&this.setByteRange(o,r),r&&(this.fragOffset=r.fragOffset+r.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 am=10;class lm{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,s=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!s||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&s>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?J(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||am}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 lo(i){return Uint8Array.from(atob(i),e=>e.charCodeAt(0))}function cm(i){const e=tu(i).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function um(i){const e=function(s,n,r){const o=s[n];s[n]=s[r],s[r]=o};e(i,0,3),e(i,1,2),e(i,4,5),e(i,6,7)}function fm(i){const e=i.split(":");let t=null;if(e[0]==="data"&&e.length===2){const s=e[1].split(";"),n=s[s.length-1].split(",");if(n.length===2){const r=n[0]==="base64",o=n[1];r?(s.splice(-1,1),t=lo(o)):t=cm(o)}}return t}function tu(i){return Uint8Array.from(unescape(encodeURIComponent(i)),e=>e.charCodeAt(0))}var we={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Je={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function ka(i){switch(i){case Je.FAIRPLAY:return we.FAIRPLAY;case Je.PLAYREADY:return we.PLAYREADY;case Je.WIDEVINE:return we.WIDEVINE;case Je.CLEARKEY:return we.CLEARKEY}}var su={WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function hm(i){if(i===su.WIDEVINE)return we.WIDEVINE}function Oa(i){switch(i){case we.FAIRPLAY:return Je.FAIRPLAY;case we.PLAYREADY:return Je.PLAYREADY;case we.WIDEVINE:return Je.WIDEVINE;case we.CLEARKEY:return Je.CLEARKEY}}function Fn(i){const{drmSystems:e,widevineLicenseUrl:t}=i,s=e?[we.FAIRPLAY,we.WIDEVINE,we.PLAYREADY,we.CLEARKEY].filter(n=>!!e[n]):[];return!s[we.WIDEVINE]&&t&&s.push(we.WIDEVINE),s}const iu=function(){return typeof self<"u"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function dm(i,e,t,s){let n;switch(i){case we.FAIRPLAY:n=["cenc","sinf"];break;case we.WIDEVINE:case we.PLAYREADY:n=["cenc"];break;case we.CLEARKEY:n=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${i}`)}return gm(n,e,t,s)}function gm(i,e,t,s){return[{initDataTypes:i,persistentState:s.persistentState||"not-allowed",distinctiveIdentifier:s.distinctiveIdentifier||"not-allowed",sessionTypes:s.sessionTypes||[s.sessionType||"temporary"],audioCapabilities:e.map(r=>({contentType:`audio/mp4; codecs="${r}"`,robustness:s.audioRobustness||"",encryptionScheme:s.audioEncryptionScheme||null})),videoCapabilities:t.map(r=>({contentType:`video/mp4; codecs="${r}"`,robustness:s.videoRobustness||"",encryptionScheme:s.videoEncryptionScheme||null}))}]}function as(i,e,t){return Uint8Array.prototype.slice?i.slice(e,t):new Uint8Array(Array.prototype.slice.call(i,e,t))}const co=(i,e)=>e+10<=i.length&&i[e]===73&&i[e+1]===68&&i[e+2]===51&&i[e+3]<255&&i[e+4]<255&&i[e+6]<128&&i[e+7]<128&&i[e+8]<128&&i[e+9]<128,nu=(i,e)=>e+10<=i.length&&i[e]===51&&i[e+1]===68&&i[e+2]===73&&i[e+3]<255&&i[e+4]<255&&i[e+6]<128&&i[e+7]<128&&i[e+8]<128&&i[e+9]<128,Hi=(i,e)=>{const t=e;let s=0;for(;co(i,e);){s+=10;const n=Tn(i,e+6);s+=n,nu(i,e+10)&&(s+=10),e+=s}if(s>0)return i.subarray(t,t+s)},Tn=(i,e)=>{let t=0;return t=(i[e]&127)<<21,t|=(i[e+1]&127)<<14,t|=(i[e+2]&127)<<7,t|=i[e+3]&127,t},mm=(i,e)=>co(i,e)&&Tn(i,e+6)+10<=i.length-e,pm=i=>{const e=ou(i);for(let t=0;t<e.length;t++){const s=e[t];if(ru(s))return Sm(s)}},ru=i=>i&&i.key==="PRIV"&&i.info==="com.apple.streaming.transportStreamTimestamp",ym=i=>{const e=String.fromCharCode(i[0],i[1],i[2],i[3]),t=Tn(i,4),s=10;return{type:e,size:t,data:i.subarray(s,s+t)}},ou=i=>{let e=0;const t=[];for(;co(i,e);){const s=Tn(i,e+6);e+=10;const n=e+s;for(;e+8<n;){const r=ym(i.subarray(e)),o=Tm(r);o&&t.push(o),e+=r.size+10}nu(i,e)&&(e+=10)}return t},Tm=i=>i.type==="PRIV"?Em(i):i.type[0]==="W"?Am(i):xm(i),Em=i=>{if(i.size<2)return;const e=It(i.data,!0),t=new Uint8Array(i.data.subarray(e.length+1));return{key:i.type,info:e,data:t.buffer}},xm=i=>{if(i.size<2)return;if(i.type==="TXXX"){let t=1;const s=It(i.data.subarray(t),!0);t+=s.length+1;const n=It(i.data.subarray(t));return{key:i.type,info:s,data:n}}const e=It(i.data.subarray(1));return{key:i.type,data:e}},Am=i=>{if(i.type==="WXXX"){if(i.size<2)return;let t=1;const s=It(i.data.subarray(t),!0);t+=s.length+1;const n=It(i.data.subarray(t));return{key:i.type,info:s,data:n}}const e=It(i.data);return{key:i.type,data:e}},Sm=i=>{if(i.data.byteLength===8){const e=new Uint8Array(i.data),t=e[3]&1;let s=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return s/=45,t&&(s+=4772185884e-2),Math.round(s)}},It=(i,e=!1)=>{const t=vm();if(t){const c=t.decode(i);if(e){const u=c.indexOf("\0");return u!==-1?c.substring(0,u):c}return c.replace(/\0/g,"")}const s=i.length;let n,r,o,a="",l=0;for(;l<s;){if(n=i[l++],n===0&&e)return a;if(n===0||n===3)continue;switch(n>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:a+=String.fromCharCode(n);break;case 12:case 13:r=i[l++],a+=String.fromCharCode((n&31)<<6|r&63);break;case 14:r=i[l++],o=i[l++],a+=String.fromCharCode((n&15)<<12|(r&63)<<6|(o&63)<<0);break}}return a};let Nn;function vm(){return!Nn&&typeof self.TextDecoder<"u"&&(Nn=new self.TextDecoder("utf-8")),Nn}const St={hexDump:function(i){let e="";for(let t=0;t<i.length;t++){let s=i[t].toString(16);s.length<2&&(s="0"+s),e+=s}return e}},Vi=Math.pow(2,32)-1,Rm=[].push,au={video:1,audio:2,id3:3,text:4};function $e(i){return String.fromCharCode.apply(null,i)}function lu(i,e){const t=i[e]<<8|i[e+1];return t<0?65536+t:t}function ne(i,e){const t=cu(i,e);return t<0?4294967296+t:t}function cu(i,e){return i[e]<<24|i[e+1]<<16|i[e+2]<<8|i[e+3]}function Mn(i,e,t){i[e]=t>>24,i[e+1]=t>>16&255,i[e+2]=t>>8&255,i[e+3]=t&255}function pe(i,e){const t=[];if(!e.length)return t;const s=i.byteLength;for(let n=0;n<s;){const r=ne(i,n),o=$e(i.subarray(n+4,n+8)),a=r>1?n+r:s;if(o===e[0])if(e.length===1)t.push(i.subarray(n+8,a));else{const l=pe(i.subarray(n+8,a),e.slice(1));l.length&&Rm.apply(t,l)}n=a}return t}function Lm(i){const e=[],t=i[0];let s=8;const n=ne(i,s);s+=4;const r=0,o=0;t===0?s+=8:s+=16,s+=2;let a=i.length+o;const l=lu(i,s);s+=2;for(let c=0;c<l;c++){let u=s;const f=ne(i,u);u+=4;const h=f&2147483647;if((f&2147483648)>>>31===1)return v.warn("SIDX has hierarchical references (not supported)"),null;const g=ne(i,u);u+=4,e.push({referenceSize:h,subsegmentDuration:g,info:{duration:g/n,start:a,end:a+h-1}}),a+=h,u+=4,s=u}return{earliestPresentationTime:r,timescale:n,version:t,referencesCount:l,references:e}}function uu(i){const e=[],t=pe(i,["moov","trak"]);for(let n=0;n<t.length;n++){const r=t[n],o=pe(r,["tkhd"])[0];if(o){let a=o[0],l=a===0?12:20;const c=ne(o,l),u=pe(r,["mdia","mdhd"])[0];if(u){a=u[0],l=a===0?12:20;const f=ne(u,l),h=pe(r,["mdia","hdlr"])[0];if(h){const d=$e(h.subarray(8,12)),g={soun:Re.AUDIO,vide:Re.VIDEO}[d];if(g){const m=pe(r,["mdia","minf","stbl","stsd"])[0];let y;m&&(y=$e(m.subarray(12,16))),e[c]={timescale:f,type:g},e[g]={timescale:f,id:c,codec:y}}}}}}return pe(i,["moov","mvex","trex"]).forEach(n=>{const r=ne(n,4),o=e[r];o&&(o.default={duration:ne(n,12),flags:ne(n,20)})}),e}function bm(i,e){if(!i||!e)return i;const t=e.keyId;return t&&e.isCommonEncryption&&pe(i,["moov","trak"]).forEach(n=>{const o=pe(n,["mdia","minf","stbl","stsd"])[0].subarray(8);let a=pe(o,["enca"]);const l=a.length>0;l||(a=pe(o,["encv"])),a.forEach(c=>{const u=l?c.subarray(28):c.subarray(78);pe(u,["sinf"]).forEach(h=>{const d=fu(h);if(d){const g=d.subarray(8,24);g.some(m=>m!==0)||(v.log(`[eme] Patching keyId in 'enc${l?"a":"v"}>sinf>>tenc' box: ${St.hexDump(g)} -> ${St.hexDump(t)}`),d.set(t,8))}})})}),i}function fu(i){const e=pe(i,["schm"])[0];if(e){const t=$e(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return pe(i,["schi","tenc"])[0]}return v.error("[eme] missing 'schm' box"),null}function Im(i,e){return pe(e,["moof","traf"]).reduce((t,s)=>{const n=pe(s,["tfdt"])[0],r=n[0],o=pe(s,["tfhd"]).reduce((a,l)=>{const c=ne(l,4),u=i[c];if(u){let f=ne(n,4);if(r===1){if(f===Vi)return v.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),a;f*=Vi+1,f+=ne(n,8)}const h=u.timescale||9e4,d=f/h;if(isFinite(d)&&(a===null||d<a))return d}return a},null);return o!==null&&isFinite(o)&&(t===null||o<t)?o:t},null)}function Dm(i,e){let t=0,s=0,n=0;const r=pe(i,["moof","traf"]);for(let o=0;o<r.length;o++){const a=r[o],l=pe(a,["tfhd"])[0],c=ne(l,4),u=e[c];if(!u)continue;const f=u.default,h=ne(l,0)|(f==null?void 0:f.flags);let d=f==null?void 0:f.duration;h&8&&(h&2?d=ne(l,12):d=ne(l,8));const g=u.timescale||9e4,m=pe(a,["trun"]);for(let y=0;y<m.length;y++){if(t=Cm(m[y]),!t&&d){const T=ne(m[y],4);t=d*T}u.type===Re.VIDEO?s+=t/g:u.type===Re.AUDIO&&(n+=t/g)}}if(s===0&&n===0){let o=0;const a=pe(i,["sidx"]);for(let l=0;l<a.length;l++){const c=Lm(a[l]);c!=null&&c.references&&(o+=c.references.reduce((u,f)=>u+f.info.duration||0,0))}return o}return s||n}function Cm(i){const e=ne(i,0);let t=8;e&1&&(t+=4),e&4&&(t+=4);let s=0;const n=ne(i,4);for(let r=0;r<n;r++){if(e&256){const o=ne(i,t);s+=o,t+=4}e&512&&(t+=4),e&1024&&(t+=4),e&2048&&(t+=4)}return s}function wm(i,e,t){pe(e,["moof","traf"]).forEach(s=>{pe(s,["tfhd"]).forEach(n=>{const r=ne(n,4),o=i[r];if(!o)return;const a=o.timescale||9e4;pe(s,["tfdt"]).forEach(l=>{const c=l[0];let u=ne(l,4);if(c===0)u-=t*a,u=Math.max(u,0),Mn(l,4,u);else{u*=Math.pow(2,32),u+=ne(l,8),u-=t*a,u=Math.max(u,0);const f=Math.floor(u/(Vi+1)),h=Math.floor(u%(Vi+1));Mn(l,4,f),Mn(l,8,h)}})})})}function _m(i){const e={valid:null,remainder:null},t=pe(i,["moof"]);if(t){if(t.length<2)return e.remainder=i,e}else return e;const s=t[t.length-1];return e.valid=as(i,0,s.byteOffset-8),e.remainder=as(i,s.byteOffset-8),e}function cs(i,e){const t=new Uint8Array(i.length+e.length);return t.set(i),t.set(e,i.length),t}function Fa(i,e){const t=[],s=e.samples,n=e.timescale,r=e.id;let o=!1;return pe(s,["moof"]).map(l=>{const c=l.byteOffset-8;pe(l,["traf"]).map(f=>{const h=pe(f,["tfdt"]).map(d=>{const g=d[0];let m=ne(d,4);return g===1&&(m*=Math.pow(2,32),m+=ne(d,8)),m/n})[0];return h!==void 0&&(i=h),pe(f,["tfhd"]).map(d=>{const g=ne(d,4),m=ne(d,0)&16777215,y=(m&1)!==0,T=(m&2)!==0,x=(m&8)!==0;let S=0;const R=(m&16)!==0;let b=0;const M=(m&32)!==0;let P=8;g===r&&(y&&(P+=8),T&&(P+=4),x&&(S=ne(d,P),P+=4),R&&(b=ne(d,P),P+=4),M&&(P+=4),e.type==="video"&&(o=Pm(e.codec)),pe(f,["trun"]).map(B=>{const K=B[0],C=ne(B,0)&16777215,q=(C&1)!==0;let W=0;const ue=(C&4)!==0,_e=(C&256)!==0;let Te=0;const ae=(C&512)!==0;let te=0;const $=(C&1024)!==0,z=(C&2048)!==0;let fe=0;const he=ne(B,4);let re=8;q&&(W=ne(B,re),re+=4),ue&&(re+=4);let Le=W+c;for(let Ne=0;Ne<he;Ne++){if(_e?(Te=ne(B,re),re+=4):Te=S,ae?(te=ne(B,re),re+=4):te=b,$&&(re+=4),z&&(K===0?fe=ne(B,re):fe=cu(B,re),re+=4),e.type===Re.VIDEO){let He=0;for(;He<te;){const Ae=ne(s,Le);if(Le+=4,km(o,s[Le])){const _=s.subarray(Le,Le+Ae);hu(_,o?2:1,i+fe/n,t)}Le+=Ae,He+=Ae+4}}i+=Te/n}}))})})}),t}function Pm(i){if(!i)return!1;const e=i.indexOf("."),t=e<0?i:i.substring(0,e);return t==="hvc1"||t==="hev1"||t==="dvh1"||t==="dvhe"}function km(i,e){if(i){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function hu(i,e,t,s){const n=du(i);let r=0;r+=e;let o=0,a=0,l=!1,c=0;for(;r<n.length;){o=0;do{if(r>=n.length)break;c=n[r++],o+=c}while(c===255);a=0;do{if(r>=n.length)break;c=n[r++],a+=c}while(c===255);const u=n.length-r;if(!l&&o===4&&r<n.length){if(l=!0,n[r++]===181){const h=lu(n,r);if(r+=2,h===49){const d=ne(n,r);if(r+=4,d===1195456820){const g=n[r++];if(g===3){const m=n[r++],y=31&m,T=64&m,x=T?2+y*3:0,S=new Uint8Array(x);if(T){S[0]=m;for(let R=1;R<x;R++)S[R]=n[r++]}s.push({type:g,payloadType:o,pts:t,bytes:S})}}}}}else if(o===5&&a<u){if(l=!0,a>16){const f=[];for(let g=0;g<16;g++){const m=n[r++].toString(16);f.push(m.length==1?"0"+m:m),(g===3||g===5||g===7||g===9)&&f.push("-")}const h=a-16,d=new Uint8Array(h);for(let g=0;g<h;g++)d[g]=n[r++];s.push({payloadType:o,pts:t,uuid:f.join(""),userData:It(d),userDataBytes:d})}}else if(a<u)r+=a;else if(a>u)break}}function du(i){const e=i.byteLength,t=[];let s=1;for(;s<e-2;)i[s]===0&&i[s+1]===0&&i[s+2]===3?(t.push(s+2),s+=2):s++;if(t.length===0)return i;const n=e-t.length,r=new Uint8Array(n);let o=0;for(s=0;s<n;o++,s++)o===t[0]&&(o++,t.shift()),r[s]=i[o];return r}function Om(i){const e=i[0];let t="",s="",n=0,r=0,o=0,a=0,l=0,c=0;if(e===0){for(;$e(i.subarray(c,c+1))!=="\0";)t+=$e(i.subarray(c,c+1)),c+=1;for(t+=$e(i.subarray(c,c+1)),c+=1;$e(i.subarray(c,c+1))!=="\0";)s+=$e(i.subarray(c,c+1)),c+=1;s+=$e(i.subarray(c,c+1)),c+=1,n=ne(i,12),r=ne(i,16),a=ne(i,20),l=ne(i,24),c=28}else if(e===1){c+=4,n=ne(i,c),c+=4;const f=ne(i,c);c+=4;const h=ne(i,c);for(c+=4,o=2**32*f+h,Number.isSafeInteger(o)||(o=Number.MAX_SAFE_INTEGER,v.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),a=ne(i,c),c+=4,l=ne(i,c),c+=4;$e(i.subarray(c,c+1))!=="\0";)t+=$e(i.subarray(c,c+1)),c+=1;for(t+=$e(i.subarray(c,c+1)),c+=1;$e(i.subarray(c,c+1))!=="\0";)s+=$e(i.subarray(c,c+1)),c+=1;s+=$e(i.subarray(c,c+1)),c+=1}const u=i.subarray(c,i.byteLength);return{schemeIdUri:t,value:s,timeScale:n,presentationTime:o,presentationTimeDelta:r,eventDuration:a,id:l,payload:u}}function Fm(i,...e){const t=e.length;let s=8,n=t;for(;n--;)s+=e[n].byteLength;const r=new Uint8Array(s);for(r[0]=s>>24&255,r[1]=s>>16&255,r[2]=s>>8&255,r[3]=s&255,r.set(i,4),n=0,s=8;n<t;n++)r.set(e[n],s),s+=e[n].byteLength;return r}function Nm(i,e,t){if(i.byteLength!==16)throw new RangeError("Invalid system id");let s,n;if(e){s=1,n=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");n.set(l,a*16)}}else s=0,n=new Uint8Array;let r;s>0?(r=new Uint8Array(4),e.length>0&&new DataView(r.buffer).setUint32(0,e.length,!1)):r=new Uint8Array;const o=new Uint8Array(4);return t&&t.byteLength>0&&new DataView(o.buffer).setUint32(0,t.byteLength,!1),Fm([112,115,115,104],new Uint8Array([s,0,0,0]),i,r,n,o,t||new Uint8Array)}function Mm(i){if(!(i instanceof ArrayBuffer)||i.byteLength<32)return null;const e={version:0,systemId:"",kids:null,data:null},t=new DataView(i),s=t.getUint32(0);if(i.byteLength!==s&&s>44||t.getUint32(4)!==1886614376||(e.version=t.getUint32(8)>>>24,e.version>1))return null;e.systemId=St.hexDump(new Uint8Array(i,12,16));const r=t.getUint32(28);if(e.version===0){if(s-32<r)return null;e.data=new Uint8Array(i,32,r)}else if(e.version===1){e.kids=[];for(let o=0;o<r;o++)e.kids.push(new Uint8Array(i,32+o*16,16))}return e}let mi={};class ni{static clearKeyUriToKeyIdMap(){mi={}}constructor(e,t,s,n=[1],r=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=s,this.keyFormatVersions=n,this.iv=r,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 Je.FAIRPLAY:case Je.WIDEVINE:case Je.PLAYREADY:case Je.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&&v.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0);const s=Um(e);return new ni(this.method,this.uri,"identity",this.keyFormatVersions,s)}const t=fm(this.uri);if(t)switch(this.keyFormat){case Je.WIDEVINE:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case Je.PLAYREADY:{const s=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=Nm(s,null,t);const n=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2),r=String.fromCharCode.apply(null,Array.from(n)),o=r.substring(r.indexOf("<"),r.length),c=new DOMParser().parseFromString(o,"text/xml").getElementsByTagName("KID")[0];if(c){const u=c.childNodes[0]?c.childNodes[0].nodeValue:c.getAttribute("VALUE");if(u){const f=lo(u).subarray(0,16);um(f),this.keyId=f}}break}default:{let s=t.subarray(0,16);if(s.length!==16){const n=new Uint8Array(16);n.set(s,16-s.length),s=n}this.keyId=s;break}}if(!this.keyId||this.keyId.byteLength!==16){let s=mi[this.uri];if(!s){const n=Object.keys(mi).length%Number.MAX_SAFE_INTEGER;s=new Uint8Array(16),new DataView(s.buffer,12,4).setUint32(0,n),mi[this.uri]=s}this.keyId=s}return this}}function Um(i){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=i>>8*(15-t)&255;return e}const gu=/\{\$([a-zA-Z0-9-_]+)\}/g;function Na(i){return gu.test(i)}function Xe(i,e,t){if(i.variableList!==null||i.hasVariableRefs)for(let s=t.length;s--;){const n=t[s],r=e[n];r&&(e[n]=Rr(i,r))}}function Rr(i,e){if(i.variableList!==null||i.hasVariableRefs){const t=i.variableList;return e.replace(gu,s=>{const n=s.substring(2,s.length-1),r=t==null?void 0:t[n];return r===void 0?(i.playlistParsingError||(i.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${n}"`)),s):r})}return e}function Ma(i,e,t){let s=i.variableList;s||(i.variableList=s={});let n,r;if("QUERYPARAM"in e){n=e.QUERYPARAM;try{const o=new self.URL(t).searchParams;if(o.has(n))r=o.get(n);else throw new Error(`"${n}" does not match any query parameter in URI: "${t}"`)}catch(o){i.playlistParsingError||(i.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${o.message}`))}}else n=e.NAME,r=e.VALUE;n in s?i.playlistParsingError||(i.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${n}"`)):s[n]=r||""}function Bm(i,e,t){const s=e.IMPORT;if(t&&s in t){let n=i.variableList;n||(i.variableList=n={}),n[s]=t[s]}else i.playlistParsingError||(i.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${s}"`))}function En(){if(!(typeof self>"u"))return self.MediaSource||self.WebKitMediaSource}const $m={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dva1:!0,dvav:!0,dvh1:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}},Ua=En();function Gm(i,e){const t=$m[e];return!!t&&t[i.slice(0,4)]===!0}function Un(i,e){var t;return(t=Ua==null?void 0:Ua.isTypeSupported(`${e||"video"}/mp4;codecs="${i}"`))!=null?t:!1}const Ba=/#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,$a=/#EXT-X-MEDIA:(.*)/g,Km=/^#EXT(?:INF|-X-TARGETDURATION):/m,Ga=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),Hm=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)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));class gt{static findGroup(e,t){for(let s=0;s<e.length;s++){const n=e[s];if(n.id===t)return n}}static convertAVC1ToAVCOTI(e){const t=e.split(".");if(t.length>2){let s=t.shift()+".";return s+=parseInt(t.shift()).toString(16),s+=("000"+parseInt(t.shift()).toString(16)).slice(-4),s}return e}static resolve(e,t){return ao.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return Km.test(e)}static parseMasterPlaylist(e,t){const s=Na(e),n={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:s},r=[];Ba.lastIndex=0;let o;for(;(o=Ba.exec(e))!=null;)if(o[1]){var a;const c=new Ce(o[1]);Xe(n,c,["CODECS","SUPPLEMENTAL-CODECS","ALLOWED-CPC","PATHWAY-ID","STABLE-VARIANT-ID","AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS","NAME"]);const u=Rr(n,o[2]),f={attrs:c,bitrate:c.decimalInteger("AVERAGE-BANDWIDTH")||c.decimalInteger("BANDWIDTH"),name:c.NAME,url:gt.resolve(u,t)},h=c.decimalResolution("RESOLUTION");h&&(f.width=h.width,f.height=h.height),Vm((c.CODECS||"").split(/[ ,]+/).filter(d=>d),f),f.videoCodec&&f.videoCodec.indexOf("avc1")!==-1&&(f.videoCodec=gt.convertAVC1ToAVCOTI(f.videoCodec)),(a=f.unknownCodecs)!=null&&a.length||r.push(f),n.levels.push(f)}else if(o[3]){const c=o[3],u=o[4];switch(c){case"SESSION-DATA":{const f=new Ce(u);Xe(n,f,["DATA-ID","LANGUAGE","VALUE","URI"]);const h=f["DATA-ID"];h&&(n.sessionData===null&&(n.sessionData={}),n.sessionData[h]=f);break}case"SESSION-KEY":{const f=Ka(u,t,n);f.encrypted&&f.isSupported()?(n.sessionKeys===null&&(n.sessionKeys=[]),n.sessionKeys.push(f)):v.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${u}"`);break}case"DEFINE":{{const f=new Ce(u);Xe(n,f,["NAME","VALUE","QUERYPARAM"]),Ma(n,f,t)}break}case"CONTENT-STEERING":{const f=new Ce(u);Xe(n,f,["SERVER-URI","PATHWAY-ID"]),n.contentSteering={uri:gt.resolve(f["SERVER-URI"],t),pathwayId:f["PATHWAY-ID"]||"."};break}case"START":{n.startTimeOffset=Ha(u);break}}}const l=r.length>0&&r.length<n.levels.length;return n.levels=l?r:n.levels,n.levels.length===0&&(n.playlistParsingError=new Error("no levels found in manifest")),n}static parseMasterPlaylistMedia(e,t,s){let n;const r={},o=s.levels,a={AUDIO:o.map(c=>({id:c.attrs.AUDIO,audioCodec:c.audioCodec})),SUBTITLES:o.map(c=>({id:c.attrs.SUBTITLES,textCodec:c.textCodec})),"CLOSED-CAPTIONS":[]};let l=0;for($a.lastIndex=0;(n=$a.exec(e))!==null;){const c=new Ce(n[1]),u=c.TYPE;if(u){const f=a[u],h=r[u]||[];r[u]=h,Xe(s,c,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);const d={attrs:c,bitrate:0,id:l++,groupId:c["GROUP-ID"]||"",instreamId:c["INSTREAM-ID"],name:c.NAME||c.LANGUAGE||"",type:u,default:c.bool("DEFAULT"),autoselect:c.bool("AUTOSELECT"),forced:c.bool("FORCED"),lang:c.LANGUAGE,url:c.URI?gt.resolve(c.URI,t):""};if(f!=null&&f.length){const g=gt.findGroup(f,d.groupId)||f[0];Va(d,g,"audioCodec"),Va(d,g,"textCodec")}h.push(d)}}return r}static parseLevelPlaylist(e,t,s,n,r,o){const a=new lm(t),l=a.fragments;let c=null,u=0,f=0,h=0,d=0,g=null,m=new On(n,t),y,T,x,S=-1,R=!1;for(Ga.lastIndex=0,a.m3u8=e,a.hasVariableRefs=Na(e);(y=Ga.exec(e))!==null;){R&&(R=!1,m=new On(n,t),m.start=h,m.sn=u,m.cc=d,m.level=s,c&&(m.initSegment=c,m.rawProgramDateTime=c.rawProgramDateTime,c.rawProgramDateTime=null));const B=y[1];if(B){m.duration=parseFloat(B);const K=(" "+y[2]).slice(1);m.title=K||null,m.tagList.push(K?["INF",B,K]:["INF",B])}else if(y[3]){if(J(m.duration)){m.start=h,x&&ja(m,x,a),m.sn=u,m.level=s,m.cc=d,m.urlId=r,l.push(m);const K=(" "+y[3]).slice(1);m.relurl=Rr(a,K),Wa(m,g),g=m,h+=m.duration,u++,f=0,R=!0}}else if(y[4]){const K=(" "+y[4]).slice(1);g?m.setByteRange(K,g):m.setByteRange(K)}else if(y[5])m.rawProgramDateTime=(" "+y[5]).slice(1),m.tagList.push(["PROGRAM-DATE-TIME",m.rawProgramDateTime]),S===-1&&(S=l.length);else{if(y=y[0].match(Hm),!y){v.warn("No matches on slow regex match for level playlist!");continue}for(T=1;T<y.length&&!(typeof y[T]<"u");T++);const K=(" "+y[T]).slice(1),C=(" "+y[T+1]).slice(1),q=y[T+2]?(" "+y[T+2]).slice(1):"";switch(K){case"PLAYLIST-TYPE":a.type=C.toUpperCase();break;case"MEDIA-SEQUENCE":u=a.startSN=parseInt(C);break;case"SKIP":{const W=new Ce(C);Xe(a,W,["RECENTLY-REMOVED-DATERANGES"]);const ue=W.decimalInteger("SKIPPED-SEGMENTS");if(J(ue)){a.skippedSegments=ue;for(let Te=ue;Te--;)l.unshift(null);u+=ue}const _e=W.enumeratedString("RECENTLY-REMOVED-DATERANGES");_e&&(a.recentlyRemovedDateranges=_e.split(" "));break}case"TARGETDURATION":a.targetduration=Math.max(parseInt(C),1);break;case"VERSION":a.version=parseInt(C);break;case"EXTM3U":break;case"ENDLIST":a.live=!1;break;case"#":(C||q)&&m.tagList.push(q?[C,q]:[C]);break;case"DISCONTINUITY":d++,m.tagList.push(["DIS"]);break;case"GAP":m.gap=!0,m.tagList.push([K]);break;case"BITRATE":m.tagList.push([K,C]);break;case"DATERANGE":{const W=new Ce(C);Xe(a,W,["ID","CLASS","START-DATE","END-DATE","SCTE35-CMD","SCTE35-OUT","SCTE35-IN"]),Xe(a,W,W.clientAttrs);const ue=new Zc(W,a.dateRanges[W.ID]);ue.isValid||a.skippedSegments?a.dateRanges[ue.id]=ue:v.warn(`Ignoring invalid DATERANGE tag: "${C}"`),m.tagList.push(["EXT-X-DATERANGE",C]);break}case"DEFINE":{{const W=new Ce(C);Xe(a,W,["NAME","VALUE","IMPORT","QUERYPARAM"]),"IMPORT"in W?Bm(a,W,o):Ma(a,W,t)}break}case"DISCONTINUITY-SEQUENCE":d=parseInt(C);break;case"KEY":{const W=Ka(C,t,a);if(W.isSupported()){if(W.method==="NONE"){x=void 0;break}x||(x={}),x[W.keyFormat]&&(x=Me({},x)),x[W.keyFormat]=W}else v.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${C}"`);break}case"START":a.startTimeOffset=Ha(C);break;case"MAP":{const W=new Ce(C);if(Xe(a,W,["BYTERANGE","URI"]),m.duration){const ue=new On(n,t);Ya(ue,W,s,x),c=ue,m.initSegment=c,c.rawProgramDateTime&&!m.rawProgramDateTime&&(m.rawProgramDateTime=c.rawProgramDateTime)}else Ya(m,W,s,x),c=m,R=!0;break}case"SERVER-CONTROL":{const W=new Ce(C);a.canBlockReload=W.bool("CAN-BLOCK-RELOAD"),a.canSkipUntil=W.optionalFloat("CAN-SKIP-UNTIL",0),a.canSkipDateRanges=a.canSkipUntil>0&&W.bool("CAN-SKIP-DATERANGES"),a.partHoldBack=W.optionalFloat("PART-HOLD-BACK",0),a.holdBack=W.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{const W=new Ce(C);a.partTarget=W.decimalFloatingPoint("PART-TARGET");break}case"PART":{let W=a.partList;W||(W=a.partList=[]);const ue=f>0?W[W.length-1]:void 0,_e=f++,Te=new Ce(C);Xe(a,Te,["BYTERANGE","URI"]);const ae=new om(Te,m,t,_e,ue);W.push(ae),m.duration+=ae.duration;break}case"PRELOAD-HINT":{const W=new Ce(C);Xe(a,W,["URI"]),a.preloadHint=W;break}case"RENDITION-REPORT":{const W=new Ce(C);Xe(a,W,["URI"]),a.renditionReports=a.renditionReports||[],a.renditionReports.push(W);break}default:v.warn(`line parsed but not handled: ${y}`);break}}}g&&!g.relurl?(l.pop(),h-=g.duration,a.partList&&(a.fragmentHint=g)):a.partList&&(Wa(m,g),m.cc=d,a.fragmentHint=m,x&&ja(m,x,a));const b=l.length,M=l[0],P=l[b-1];if(h+=a.skippedSegments*a.targetduration,h>0&&b&&P){a.averagetargetduration=h/b;const B=P.sn;a.endSN=B!=="initSegment"?B:0,a.live||(P.endList=!0),M&&(a.startCC=M.cc)}else a.endSN=0,a.startCC=0;return a.fragmentHint&&(h+=a.fragmentHint.duration),a.totalduration=h,a.endCC=d,S>0&&Wm(l,S),a}}function Ka(i,e,t){var s,n;const r=new Ce(i);Xe(t,r,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);const o=(s=r.METHOD)!=null?s:"",a=r.URI,l=r.hexadecimalInteger("IV"),c=r.KEYFORMATVERSIONS,u=(n=r.KEYFORMAT)!=null?n:"identity";a&&r.IV&&!l&&v.error(`Invalid IV: ${r.IV}`);const f=a?gt.resolve(a,e):"",h=(c||"1").split("/").map(Number).filter(Number.isFinite);return new ni(o,f,u,h,l)}function Ha(i){const t=new Ce(i).decimalFloatingPoint("TIME-OFFSET");return J(t)?t:null}function Vm(i,e){["video","audio","text"].forEach(t=>{const s=i.filter(n=>Gm(n,t));if(s.length){const n=s.filter(r=>r.lastIndexOf("avc1",0)===0||r.lastIndexOf("mp4a",0)===0);e[`${t}Codec`]=n.length>0?n[0]:s[0],i=i.filter(r=>s.indexOf(r)===-1)}}),e.unknownCodecs=i}function Va(i,e,t){const s=e[t];s&&(i[t]=s)}function Wm(i,e){let t=i[e];for(let s=e;s--;){const n=i[s];if(!n)return;n.programDateTime=t.programDateTime-n.duration*1e3,t=n}}function Wa(i,e){i.rawProgramDateTime?i.programDateTime=Date.parse(i.rawProgramDateTime):e!=null&&e.programDateTime&&(i.programDateTime=e.endProgramDateTime),J(i.programDateTime)||(i.programDateTime=null,i.rawProgramDateTime=null)}function Ya(i,e,t,s){i.relurl=e.URI,e.BYTERANGE&&i.setByteRange(e.BYTERANGE),i.level=t,i.sn="initSegment",s&&(i.levelkeys=s),i.initSegment=null}function ja(i,e,t){i.levelkeys=e;const{encryptedFragments:s}=t;(!s.length||s[s.length-1].levelkeys!==e)&&Object.keys(e).some(n=>e[n].isCommonEncryption)&&s.push(i)}var ye={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},ie={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};function qa(i){const{type:e}=i;switch(e){case ye.AUDIO_TRACK:return ie.AUDIO;case ye.SUBTITLE_TRACK:return ie.SUBTITLE;default:return ie.MAIN}}function Bn(i,e){let t=i.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class Ym{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.LEVEL_LOADING,this.onLevelLoading,this),e.on(p.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(p.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}unregisterListeners(){const{hls:e}=this;e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.LEVEL_LOADING,this.onLevelLoading,this),e.off(p.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(p.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}createInternalLoader(e){const t=this.hls.config,s=t.pLoader,n=t.loader,r=s||n,o=new r(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:s}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:ye.MANIFEST,url:s,deliveryDirectives:null})}onLevelLoading(e,t){const{id:s,level:n,url:r,deliveryDirectives:o}=t;this.load({id:s,level:n,responseType:"text",type:ye.LEVEL,url:r,deliveryDirectives:o})}onAudioTrackLoading(e,t){const{id:s,groupId:n,url:r,deliveryDirectives:o}=t;this.load({id:s,groupId:n,level:null,responseType:"text",type:ye.AUDIO_TRACK,url:r,deliveryDirectives:o})}onSubtitleTrackLoading(e,t){const{id:s,groupId:n,url:r,deliveryDirectives:o}=t;this.load({id:s,groupId:n,level:null,responseType:"text",type:ye.SUBTITLE_TRACK,url:r,deliveryDirectives:o})}load(e){var t;const s=this.hls.config;let n=this.getInternalLoader(e);if(n){const c=n.context;if(c&&c.url===e.url){v.trace("[playlist-loader]: playlist request ongoing");return}v.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),n.abort()}let r;if(e.type===ye.MANIFEST?r=s.manifestLoadPolicy.default:r=Me({},s.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),n=this.createInternalLoader(e),(t=e.deliveryDirectives)!=null&&t.part){let c;if(e.type===ye.LEVEL&&e.level!==null?c=this.hls.levels[e.level].details:e.type===ye.AUDIO_TRACK&&e.id!==null?c=this.hls.audioTracks[e.id].details:e.type===ye.SUBTITLE_TRACK&&e.id!==null&&(c=this.hls.subtitleTracks[e.id].details),c){const u=c.partTarget,f=c.targetduration;if(u&&f){const h=Math.max(u*3,f*.8)*1e3;r=Me({},r,{maxTimeToFirstByteMs:Math.min(h,r.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(h,r.maxTimeToFirstByteMs)})}}}const o=r.errorRetry||r.timeoutRetry||{},a={loadPolicy:r,timeout:r.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},l={onSuccess:(c,u,f,h)=>{const d=this.getInternalLoader(f);this.resetInternalLoader(f.type);const g=c.data;if(g.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(c,f,new Error("no EXTM3U delimiter"),h||null,u);return}u.parsing.start=performance.now(),gt.isMediaPlaylist(g)?this.handleTrackOrLevelPlaylist(c,u,f,h||null,d):this.handleMasterPlaylist(c,u,f,h)},onError:(c,u,f,h)=>{this.handleNetworkError(u,f,!1,c,h)},onTimeout:(c,u,f)=>{this.handleNetworkError(u,f,!0,void 0,c)}};n.load(e,a,l)}handleMasterPlaylist(e,t,s,n){const r=this.hls,o=e.data,a=Bn(e,s),l=gt.parseMasterPlaylist(o,a);if(l.playlistParsingError){this.handleManifestParsingError(e,s,l.playlistParsingError,n,t);return}const{contentSteering:c,levels:u,sessionData:f,sessionKeys:h,startTimeOffset:d,variableList:g}=l;this.variableList=g;const{AUDIO:m=[],SUBTITLES:y,"CLOSED-CAPTIONS":T}=gt.parseMasterPlaylistMedia(o,a,l);m.length&&!m.some(S=>!S.url)&&u[0].audioCodec&&!u[0].attrs.AUDIO&&(v.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),m.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new Ce({}),bitrate:0,url:""})),r.trigger(p.MANIFEST_LOADED,{levels:u,audioTracks:m,subtitles:y,captions:T,contentSteering:c,url:a,stats:t,networkDetails:n,sessionData:f,sessionKeys:h,startTimeOffset:d,variableList:g})}handleTrackOrLevelPlaylist(e,t,s,n,r){const o=this.hls,{id:a,level:l,type:c}=s,u=Bn(e,s),f=J(a)?a:0,h=J(l)?l:f,d=qa(s),g=gt.parseLevelPlaylist(e.data,u,h,d,f,this.variableList);if(c===ye.MANIFEST){const m={attrs:new Ce({}),bitrate:0,details:g,name:"",url:u};o.trigger(p.MANIFEST_LOADED,{levels:[m],audioTracks:[],url:u,stats:t,networkDetails:n,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),s.levelDetails=g,this.handlePlaylistLoaded(g,e,t,s,n,r)}handleManifestParsingError(e,t,s,n,r){this.hls.trigger(p.ERROR,{type:se.NETWORK_ERROR,details:D.MANIFEST_PARSING_ERROR,fatal:t.type===ye.MANIFEST,url:e.url,err:s,error:s,reason:s.message,response:e,context:t,networkDetails:n,stats:r})}handleNetworkError(e,t,s=!1,n,r){let o=`A network ${s?"timeout":"error"+(n?" (status "+n.code+")":"")} occurred while loading ${e.type}`;e.type===ye.LEVEL?o+=`: ${e.level} id: ${e.id}`:(e.type===ye.AUDIO_TRACK||e.type===ye.SUBTITLE_TRACK)&&(o+=` id: ${e.id} group-id: "${e.groupId}"`);const a=new Error(o);v.warn(`[playlist-loader]: ${o}`);let l=D.UNKNOWN,c=!1;const u=this.getInternalLoader(e);switch(e.type){case ye.MANIFEST:l=s?D.MANIFEST_LOAD_TIMEOUT:D.MANIFEST_LOAD_ERROR,c=!0;break;case ye.LEVEL:l=s?D.LEVEL_LOAD_TIMEOUT:D.LEVEL_LOAD_ERROR,c=!1;break;case ye.AUDIO_TRACK:l=s?D.AUDIO_TRACK_LOAD_TIMEOUT:D.AUDIO_TRACK_LOAD_ERROR,c=!1;break;case ye.SUBTITLE_TRACK:l=s?D.SUBTITLE_TRACK_LOAD_TIMEOUT:D.SUBTITLE_LOAD_ERROR,c=!1;break}u&&this.resetInternalLoader(e.type);const f={type:se.NETWORK_ERROR,details:l,fatal:c,url:e.url,loader:u,context:e,error:a,networkDetails:t,stats:r};if(n){const h=(t==null?void 0:t.url)||e.url;f.response=tt({url:h,data:void 0},n)}this.hls.trigger(p.ERROR,f)}handlePlaylistLoaded(e,t,s,n,r,o){const a=this.hls,{type:l,level:c,id:u,groupId:f,deliveryDirectives:h}=n,d=Bn(t,n),g=qa(n),m=typeof n.level=="number"&&g===ie.MAIN?c:void 0;if(!e.fragments.length){const T=new Error("No Segments found in Playlist");a.trigger(p.ERROR,{type:se.NETWORK_ERROR,details:D.LEVEL_EMPTY_ERROR,fatal:!1,url:d,error:T,reason:T.message,response:t,context:n,level:m,parent:g,networkDetails:r,stats:s});return}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const y=e.playlistParsingError;if(y){a.trigger(p.ERROR,{type:se.NETWORK_ERROR,details:D.LEVEL_PARSING_ERROR,fatal:!1,url:d,error:y,reason:y.message,response:t,context:n,level:m,parent:g,networkDetails:r,stats:s});return}switch(e.live&&o&&(o.getCacheAge&&(e.ageHeader=o.getCacheAge()||0),(!o.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),l){case ye.MANIFEST:case ye.LEVEL:a.trigger(p.LEVEL_LOADED,{details:e,level:m||0,id:u||0,stats:s,networkDetails:r,deliveryDirectives:h});break;case ye.AUDIO_TRACK:a.trigger(p.AUDIO_TRACK_LOADED,{details:e,id:u||0,groupId:f||"",stats:s,networkDetails:r,deliveryDirectives:h});break;case ye.SUBTITLE_TRACK:a.trigger(p.SUBTITLE_TRACK_LOADED,{details:e,id:u||0,groupId:f||"",stats:s,networkDetails:r,deliveryDirectives:h});break}}}function mu(i,e){let t;try{t=new Event("addtrack")}catch{t=document.createEvent("Event"),t.initEvent("addtrack",!1,!1)}t.track=i,e.dispatchEvent(t)}function pu(i,e){const t=i.mode;if(t==="disabled"&&(i.mode="hidden"),i.cues&&!i.cues.getCueById(e.id))try{if(i.addCue(e),!i.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(s){v.debug(`[texttrack-utils]: ${s}`);try{const n=new self.TextTrackCue(e.startTime,e.endTime,e.text);n.id=e.id,i.addCue(n)}catch(n){v.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${n}`)}}t==="disabled"&&(i.mode=t)}function Ts(i){const e=i.mode;if(e==="disabled"&&(i.mode="hidden"),i.cues)for(let t=i.cues.length;t--;)i.removeCue(i.cues[t]);e==="disabled"&&(i.mode=e)}function Lr(i,e,t,s){const n=i.mode;if(n==="disabled"&&(i.mode="hidden"),i.cues&&i.cues.length>0){const r=qm(i.cues,e,t);for(let o=0;o<r.length;o++)(!s||s(r[o]))&&i.removeCue(r[o])}n==="disabled"&&(i.mode=n)}function jm(i,e){if(e<i[0].startTime)return 0;const t=i.length-1;if(e>i[t].endTime)return-1;let s=0,n=t;for(;s<=n;){const r=Math.floor((n+s)/2);if(e<i[r].startTime)n=r-1;else if(e>i[r].startTime&&s<t)s=r+1;else return r}return i[s].startTime-e<e-i[n].startTime?s:n}function qm(i,e,t){const s=[],n=jm(i,e);if(n>-1)for(let r=n,o=i.length;r<o;r++){const a=i[r];if(a.startTime>=e&&a.endTime<=t)s.push(a);else if(a.startTime>t)return s}return s}var ft={audioId3:"org.id3",dateRange:"com.apple.quicktime.HLS",emsg:"https://aomedia.org/emsg/ID3"};const zm=.25;function br(){if(!(typeof self>"u"))return self.WebKitDataCue||self.VTTCue||self.TextTrackCue}const pi=(()=>{const i=br();try{new i(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function $n(i,e){return i.getTime()/1e3-e}function Xm(i){return Uint8Array.from(i.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}class Qm{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=null}_registerListeners(){const{hls:e}=this;e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(p.LEVEL_UPDATED,this.onLevelUpdated,this)}_unregisterListeners(){const{hls:e}=this;e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(p.LEVEL_UPDATED,this.onLevelUpdated,this)}onMediaAttached(e,t){this.media=t.media}onMediaDetaching(){this.id3Track&&(Ts(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 s=e[t];if(s.kind==="metadata"&&s.label==="id3")return mu(s,this.media),s}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media)return;const{hls:{config:{enableEmsgMetadataCues:s,enableID3MetadataCues:n}}}=this;if(!s&&!n)return;const{samples:r}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const o=br();for(let a=0;a<r.length;a++){const l=r[a].type;if(l===ft.emsg&&!s||!n)continue;const c=ou(r[a].data);if(c){const u=r[a].pts;let f=u+r[a].duration;f>pi&&(f=pi),f-u<=0&&(f=u+zm);for(let d=0;d<c.length;d++){const g=c[d];if(!ru(g)){this.updateId3CueEnds(u,l);const m=new o(u,f,"");m.value=g,l&&(m.type=l),this.id3Track.addCue(m)}}}}}updateId3CueEnds(e,t){var s;const n=(s=this.id3Track)==null?void 0:s.cues;if(n)for(let r=n.length;r--;){const o=n[r];o.type===t&&o.startTime<e&&o.endTime===pi&&(o.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:s,type:n}){const{id3Track:r,hls:o}=this;if(!o)return;const{config:{enableEmsgMetadataCues:a,enableID3MetadataCues:l}}=o;if(r&&(a||l)){let c;n==="audio"?c=u=>u.type===ft.audioId3&&l:n==="video"?c=u=>u.type===ft.emsg&&a:c=u=>u.type===ft.audioId3&&l||u.type===ft.emsg&&a,Lr(r,t,s,c)}}onLevelUpdated(e,{details:t}){if(!this.media||!t.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{dateRangeCuesAppended:s,id3Track:n}=this,{dateRanges:r}=t,o=Object.keys(r);if(n){const u=Object.keys(s).filter(f=>!o.includes(f));for(let f=u.length;f--;){const h=u[f];Object.keys(s[h].cues).forEach(d=>{n.removeCue(s[h].cues[d])}),delete s[h]}}const a=t.fragments[t.fragments.length-1];if(o.length===0||!J(a==null?void 0:a.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const l=a.programDateTime/1e3-a.start,c=br();for(let u=0;u<o.length;u++){const f=o[u],h=r[f],d=s[f],g=(d==null?void 0:d.cues)||{};let m=(d==null?void 0:d.durationKnown)||!1;const y=$n(h.startDate,l);let T=pi;const x=h.endDate;if(x)T=$n(x,l),m=!0;else if(h.endOnNext&&!m){const R=o.reduce((b,M)=>{const P=r[M];return P.class===h.class&&P.id!==M&&P.startDate>h.startDate&&b.push(P),b},[]).sort((b,M)=>b.startDate.getTime()-M.startDate.getTime())[0];R&&(T=$n(R.startDate,l),m=!0)}const S=Object.keys(h.attr);for(let R=0;R<S.length;R++){const b=S[R];if(!nm(b))continue;let M=g[b];if(M)m&&!d.durationKnown&&(M.endTime=T);else{let P=h.attr[b];M=new c(y,T,""),rm(b)&&(P=Xm(P)),M.value={key:b,data:P},M.type=ft.dateRange,M.id=f,this.id3Track.addCue(M),g[b]=M}}s[f]={cues:g,dateRange:h,durationKnown:m}}}}class Jm{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:s,targetduration:n}=e,{liveSyncDuration:r,liveSyncDurationCount:o,lowLatencyMode:a}=this.config,l=this.hls.userConfig;let c=a&&s||t;(l.liveSyncDuration||l.liveSyncDurationCount||c===0)&&(c=r!==void 0?r:o*n);const u=n,f=1;return c+Math.min(this.stallCount*f,u)}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency,s=this.levelDetails;if(e===null||t===null||s===null)return null;const n=s.edge,r=e-t-this.edgeStalled,o=n-s.totalduration,a=n-(this.config.lowLatencyMode&&s.partTarget||s.targetduration);return Math.min(Math.max(o,r),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 s=e.buffered.length;return(s?e.buffered.end(s-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null}registerListeners(){this.hls.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(p.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(p.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(p.ERROR,this.onError,this)}unregisterListeners(){this.hls.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(p.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(p.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(p.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)}onManifestLoading(){this.levelDetails=null,this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){this.levelDetails=t,t.advanced&&this.timeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)}onError(e,t){var s;t.details===D.BUFFER_STALLED_ERROR&&(this.stallCount++,(s=this.levelDetails)!=null&&s.live&&v.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 s=this.computeLatency();if(s===null)return;this._latency=s;const{lowLatencyMode:n,maxLiveSyncPlaybackRate:r}=this.config;if(!n||r===1)return;const o=this.targetLatency;if(o===null)return;const a=s-o,l=Math.min(this.maxLatency,o+t.targetduration),c=a<l;if(t.live&&c&&a>.05&&this.forwardBufferLength>1){const u=Math.min(2,Math.max(1,r)),f=Math.round(2/(1+Math.exp(-.75*a-this.edgeStalled))*20)/20;e.playbackRate=Math.min(u,Math.max(1,f))}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 Ir=["NONE","TYPE-0","TYPE-1",null];var zs={No:"",Yes:"YES",v2:"v2"};function Zm(i,e){const{canSkipUntil:t,canSkipDateRanges:s,endSN:n}=i,r=e!==void 0?e-n:0;return t&&r<t?s?zs.v2:zs.Yes:zs.No}class za{constructor(e,t,s){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=s}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 ri{constructor(e){this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=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.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.unknownCodecs=e.unknownCodecs,this.codecSet=[e.videoCodec,e.audioCodec].filter(t=>t).join(",").replace(/\.[^.,]+/g,"")}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get attrs(){return this._attrs[this._urlId]}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get uri(){return this.url[this._urlId]||""}get urlId(){return this._urlId}set urlId(e){const t=e%this.url.length;this._urlId!==t&&(this.fragmentError=0,this.loadError=0,this.details=void 0,this._urlId=t)}get audioGroupId(){var e;return(e=this.audioGroupIds)==null?void 0:e[this.urlId]}get textGroupId(){var e;return(e=this.textGroupIds)==null?void 0:e[this.urlId]}addFallback(e){this.url.push(e.url),this._attrs.push(e.attrs)}}function Gn(i,e){const t=e.startPTS;if(J(t)){let s=0,n;e.sn>i.sn?(s=t-i.start,n=i):(s=i.start-t,n=e),n.duration!==s&&(n.duration=s)}else e.sn>i.sn?i.cc===e.cc&&i.minEndPTS?e.start=i.start+(i.minEndPTS-i.start):e.start=i.start+i.duration:e.start=Math.max(i.start-e.duration,0)}function yu(i,e,t,s,n,r){s-t<=0&&(v.warn("Fragment should have a positive duration",e),s=t+e.duration,r=n+e.duration);let a=t,l=s;const c=e.startPTS,u=e.endPTS;if(J(c)){const y=Math.abs(c-t);J(e.deltaPTS)?e.deltaPTS=Math.max(y,e.deltaPTS):e.deltaPTS=y,a=Math.max(t,c),t=Math.min(t,c),n=Math.min(n,e.startDTS),l=Math.min(s,u),s=Math.max(s,u),r=Math.max(r,e.endDTS)}const f=t-e.start;e.start!==0&&(e.start=t),e.duration=s-e.start,e.startPTS=t,e.maxStartPTS=a,e.startDTS=n,e.endPTS=s,e.minEndPTS=l,e.endDTS=r;const h=e.sn;if(!i||h<i.startSN||h>i.endSN)return 0;let d;const g=h-i.startSN,m=i.fragments;for(m[g]=e,d=g;d>0;d--)Gn(m[d],m[d-1]);for(d=g;d<m.length-1;d++)Gn(m[d],m[d+1]);return i.fragmentHint&&Gn(m[m.length-1],i.fragmentHint),i.PTSKnown=i.alignedSliding=!0,f}function ep(i,e){let t=null;const s=i.fragments;for(let l=s.length-1;l>=0;l--){const c=s[l].initSegment;if(c){t=c;break}}i.fragmentHint&&delete i.fragmentHint.endPTS;let n=0,r;if(ip(i,e,(l,c)=>{l.relurl&&(n=l.cc-c.cc),J(l.startPTS)&&J(l.endPTS)&&(c.start=c.startPTS=l.startPTS,c.startDTS=l.startDTS,c.maxStartPTS=l.maxStartPTS,c.endPTS=l.endPTS,c.endDTS=l.endDTS,c.minEndPTS=l.minEndPTS,c.duration=l.endPTS-l.startPTS,c.duration&&(r=c),e.PTSKnown=e.alignedSliding=!0),c.elementaryStreams=l.elementaryStreams,c.loader=l.loader,c.stats=l.stats,c.urlId=l.urlId,l.initSegment&&(c.initSegment=l.initSegment,t=l.initSegment)}),t&&(e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments).forEach(c=>{var u;(!c.initSegment||c.initSegment.relurl===((u=t)==null?void 0:u.relurl))&&(c.initSegment=t)}),e.skippedSegments)if(e.deltaUpdateFailed=e.fragments.some(l=>!l),e.deltaUpdateFailed){v.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=tp(i.dateRanges,e.dateRanges,e.recentlyRemovedDateranges));const o=e.fragments;if(n){v.warn("discontinuity sliding from playlist, take drift into account");for(let l=0;l<o.length;l++)o[l].cc+=n}e.skippedSegments&&(e.startCC=e.fragments[0].cc),sp(i.partList,e.partList,(l,c)=>{c.elementaryStreams=l.elementaryStreams,c.stats=l.stats}),r?yu(e,r,r.startPTS,r.endPTS,r.startDTS,r.endDTS):Tu(i,e),o.length&&(e.totalduration=e.edge-o[0].start),e.driftStartTime=i.driftStartTime,e.driftStart=i.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=i.driftEndTime,e.driftEnd=i.driftEnd,e.advancedDateTime=i.advancedDateTime}function tp(i,e,t){const s=Me({},i);return t&&t.forEach(n=>{delete s[n]}),Object.keys(e).forEach(n=>{const r=new Zc(e[n].attr,s[n]);r.isValid?s[n]=r:v.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${JSON.stringify(e[n].attr)}"`)}),s}function sp(i,e,t){if(i&&e){let s=0;for(let n=0,r=i.length;n<=r;n++){const o=i[n],a=e[n+s];o&&a&&o.index===a.index&&o.fragment.sn===a.fragment.sn?t(o,a):s--}}}function ip(i,e,t){const s=e.skippedSegments,n=Math.max(i.startSN,e.startSN)-e.startSN,r=(i.fragmentHint?1:0)+(s?e.endSN:Math.min(i.endSN,e.endSN))-e.startSN,o=e.startSN-i.startSN,a=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,l=i.fragmentHint?i.fragments.concat(i.fragmentHint):i.fragments;for(let c=n;c<=r;c++){const u=l[o+c];let f=a[c];s&&!f&&c<s&&(f=e.fragments[c]=u),u&&f&&t(u,f)}}function Tu(i,e){const t=e.startSN+e.skippedSegments-i.startSN,s=i.fragments;t<0||t>=s.length||Dr(e,s[t].start)}function Dr(i,e){if(e){const t=i.fragments;for(let s=i.skippedSegments;s<t.length;s++)t[s].start+=e;i.fragmentHint&&(i.fragmentHint.start+=e)}}function np(i,e=1/0){let t=1e3*i.targetduration;if(i.updated){const s=i.fragments,n=4;if(s.length&&t*n>e){const r=s[s.length-1].duration*1e3;r<t&&(t=r)}}else t/=2;return Math.round(t)}function rp(i,e,t){if(!(i!=null&&i.details))return null;const s=i.details;let n=s.fragments[e-s.startSN];return n||(n=s.fragmentHint,n&&n.sn===e)?n:e<s.startSN&&t&&t.sn===e?t:null}function Xa(i,e,t){var s;return i!=null&&i.details?Eu((s=i.details)==null?void 0:s.partList,e,t):null}function Eu(i,e,t){if(i)for(let s=i.length;s--;){const n=i[s];if(n.index===t&&n.fragment.sn===e)return n}return null}function Wi(i){switch(i.details){case D.FRAG_LOAD_TIMEOUT:case D.KEY_LOAD_TIMEOUT:case D.LEVEL_LOAD_TIMEOUT:case D.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function Qa(i,e){const t=Wi(e);return i.default[`${t?"timeout":"error"}Retry`]}function uo(i,e){const t=i.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*i.retryDelayMs,i.maxRetryDelayMs)}function Ja(i){return tt(tt({},i),{errorRetry:null,timeoutRetry:null})}function Yi(i,e,t,s){return!!i&&e<i.maxNumRetry&&(op(s)||!!t)}function op(i){return i===0&&navigator.onLine===!1||!!i&&(i<400||i>499)}const xu={search:function(i,e){let t=0,s=i.length-1,n=null,r=null;for(;t<=s;){n=(t+s)/2|0,r=i[n];const o=e(r);if(o>0)t=n+1;else if(o<0)s=n-1;else return r}return null}};function ap(i,e,t){if(e===null||!Array.isArray(i)||!i.length||!J(e))return null;const s=i[0].programDateTime;if(e<(s||0))return null;const n=i[i.length-1].endProgramDateTime;if(e>=(n||0))return null;t=t||0;for(let r=0;r<i.length;++r){const o=i[r];if(lp(e,t,o))return o}return null}function oi(i,e,t=0,s=0){let n=null;if(i?n=e[i.sn-e[0].sn+1]||null:t===0&&e[0].start===0&&(n=e[0]),n&&Cr(t,s,n)===0)return n;const r=xu.search(e,Cr.bind(null,t,s));return r&&(r!==i||!n)?r:n}function Cr(i=0,e=0,t){if(t.start<=i&&t.start+t.duration>i)return 0;const s=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-s<=i?1:t.start-s>i&&t.start?-1:0}function lp(i,e,t){const s=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-s>i}function cp(i,e){return xu.search(i,t=>t.cc<e?1:t.cc>e?-1:0)}const up=3e5;var We={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},nt={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4};class fp{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=v.log.bind(v,"[info]:"),this.warn=v.warn.bind(v,"[warning]:"),this.error=v.error.bind(v,"[error]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(p.ERROR,this.onError,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(p.ERROR,this.onError,this),e.off(p.ERROR,this.onErrorOut,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}}startLoad(e){this.playlistError=0}stopLoad(){}getVariantLevelIndex(e){return(e==null?void 0:e.type)===ie.MAIN?e.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(e,t){var s,n;if(t.fatal)return;const r=this.hls,o=t.context;switch(t.details){case D.FRAG_LOAD_ERROR:case D.FRAG_LOAD_TIMEOUT:case D.KEY_LOAD_ERROR:case D.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case D.FRAG_PARSING_ERROR:if((s=t.frag)!=null&&s.gap){t.errorAction={action:We.DoNothing,flags:nt.None};return}case D.FRAG_GAP:case D.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=We.SendAlternateToPenaltyBox;return}case D.LEVEL_EMPTY_ERROR:case D.LEVEL_PARSING_ERROR:{var a,l;const c=t.parent===ie.MAIN?t.level:r.loadLevel;t.details===D.LEVEL_EMPTY_ERROR&&((a=t.context)!=null&&(l=a.levelDetails)!=null&&l.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,c):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,c))}return;case D.LEVEL_LOAD_ERROR:case D.LEVEL_LOAD_TIMEOUT:typeof(o==null?void 0:o.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,o.level));return;case D.AUDIO_TRACK_LOAD_ERROR:case D.AUDIO_TRACK_LOAD_TIMEOUT:case D.SUBTITLE_LOAD_ERROR:case D.SUBTITLE_TRACK_LOAD_TIMEOUT:if(o){const c=r.levels[r.loadLevel];if(c&&(o.type===ye.AUDIO_TRACK&&o.groupId===c.audioGroupId||o.type===ye.SUBTITLE_TRACK&&o.groupId===c.textGroupId)){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r.loadLevel),t.errorAction.action=We.SendAlternateToPenaltyBox,t.errorAction.flags=nt.MoveAllAlternatesMatchingHost;return}}return;case D.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const c=r.levels[r.loadLevel],u=c==null?void 0:c.attrs["HDCP-LEVEL"];u&&(t.errorAction={action:We.SendAlternateToPenaltyBox,flags:nt.MoveAllAlternatesMatchingHDCP,hdcpLevel:u})}return;case D.BUFFER_ADD_CODEC_ERROR:case D.REMUX_ALLOC_ERROR:t.errorAction=this.getLevelSwitchAction(t,(n=t.level)!=null?n:r.loadLevel);return;case D.INTERNAL_EXCEPTION:case D.BUFFER_APPENDING_ERROR:case D.BUFFER_APPEND_ERROR:case D.BUFFER_FULL_ERROR:case D.LEVEL_SWITCH_ERROR:case D.BUFFER_STALLED_ERROR:case D.BUFFER_SEEK_OVER_HOLE:case D.BUFFER_NUDGE_ON_STALL:t.errorAction={action:We.DoNothing,flags:nt.None};return}if(t.type===se.KEY_SYSTEM_ERROR){const c=this.getVariantLevelIndex(t.frag);t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,c);return}}getPlaylistRetryOrSwitchAction(e,t){var s;const n=this.hls,r=Qa(n.config.playlistLoadPolicy,e),o=this.playlistError++,a=(s=e.response)==null?void 0:s.code;if(Yi(r,o,Wi(e),a))return{action:We.RetryRequest,flags:nt.None,retryConfig:r,retryCount:o};const c=this.getLevelSwitchAction(e,t);return r&&(c.retryConfig=r,c.retryCount=o),c}getFragRetryOrSwitchAction(e){const t=this.hls,s=this.getVariantLevelIndex(e.frag),n=t.levels[s],{fragLoadPolicy:r,keyLoadPolicy:o}=t.config,a=Qa(e.details.startsWith("key")?o:r,e),l=t.levels.reduce((f,h)=>f+h.fragmentError,0);if(n){var c;e.details!==D.FRAG_GAP&&n.fragmentError++;const f=(c=e.response)==null?void 0:c.code;if(Yi(a,l,Wi(e),f))return{action:We.RetryRequest,flags:nt.None,retryConfig:a,retryCount:l}}const u=this.getLevelSwitchAction(e,s);return a&&(u.retryConfig=a,u.retryCount=l),u}getLevelSwitchAction(e,t){const s=this.hls;t==null&&(t=s.loadLevel);const n=this.hls.levels[t];if(n&&(n.loadError++,s.autoLevelEnabled)){var r,o;let a=-1;const{levels:l,loadLevel:c,minAutoLevel:u,maxAutoLevel:f}=s,h=(r=e.frag)==null?void 0:r.type,{type:d,groupId:g}=(o=e.context)!=null?o:{};for(let m=l.length;m--;){const y=(m+c)%l.length;if(y!==c&&y>=u&&y<=f&&l[y].loadError===0){const T=l[y];if(e.details===D.FRAG_GAP&&e.frag){const x=l[y].details;if(x){const S=oi(e.frag,x.fragments,e.frag.start);if(S!=null&&S.gap)continue}}else{if(d===ye.AUDIO_TRACK&&g===T.audioGroupId||d===ye.SUBTITLE_TRACK&&g===T.textGroupId)continue;if(h===ie.AUDIO&&n.audioGroupId===T.audioGroupId||h===ie.SUBTITLE&&n.textGroupId===T.textGroupId)continue}a=y;break}}if(a>-1&&s.loadLevel!==a)return e.levelRetry=!0,this.playlistError=0,{action:We.SendAlternateToPenaltyBox,flags:nt.None,nextAutoLevel:a}}return{action:We.SendAlternateToPenaltyBox,flags:nt.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var s;switch((s=t.errorAction)==null?void 0:s.action){case We.DoNothing:break;case We.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==D.FRAG_GAP&&(t.fatal=!0);break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,s=e.errorAction;if(!s)return;const{flags:n,hdcpLevel:r,nextAutoLevel:o}=s;switch(n){case nt.None:this.switchLevel(e,o);break;case nt.MoveAllAlternatesMatchingHost:s.resolved||(s.resolved=this.redundantFailover(e));break;case nt.MoveAllAlternatesMatchingHDCP:r&&(t.maxHdcpLevel=Ir[Ir.indexOf(r)-1],s.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}s.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)}redundantFailover(e){const{hls:t,penalizedRenditions:s}=this,n=e.parent===ie.MAIN?e.level:t.loadLevel,r=t.levels[n],o=r.url.length,a=e.frag?e.frag.urlId:r.urlId;r.urlId===a&&(!e.frag||r.details)&&this.penalizeRendition(r,e);for(let l=1;l<o;l++){const c=(a+l)%o,u=s[c];if(!u||hp(u,e,s[a]))return this.warn(`Switching to Redundant Stream ${c+1}/${o}: "${r.url[c]}" after ${e.details}`),this.playlistError=0,t.levels.forEach(f=>{f.urlId=c}),t.nextLoadLevel=n,!0}return!1}penalizeRendition(e,t){const{penalizedRenditions:s}=this,n=s[e.urlId]||{lastErrorPerfMs:0,errors:[],details:void 0};n.lastErrorPerfMs=performance.now(),n.errors.push(t),n.details=e.details,s[e.urlId]=n}}function hp(i,e,t){if(performance.now()-i.lastErrorPerfMs>up)return!0;const s=i.details;if(e.details===D.FRAG_GAP&&s&&e.frag){const n=e.frag.start,r=oi(null,s.fragments,n);if(r&&!r.gap)return!0}if(t&&i.errors.length<t.errors.length){const n=i.errors[i.errors.length-1];if(s&&n.frag&&e.frag&&Math.abs(n.frag.start-e.frag.start)>s.targetduration*3)return!0}return!1}class fo{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=v.log.bind(v,`${t}:`),this.warn=v.warn.bind(v,`${t}:`),this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){clearTimeout(this.timer),this.timer=-1}startLoad(){this.canLoad=!0,this.requestScheduled=-1,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t){const s=t==null?void 0:t.renditionReports;if(s){let n=-1;for(let r=0;r<s.length;r++){const o=s[r];let a;try{a=new self.URL(o.URI,t.url).href}catch(l){v.warn(`Could not construct new URL for Rendition Report: ${l}`),a=o.URI||""}if(a===e){n=r;break}else a===e.substring(0,a.length)&&(n=r)}if(n!==-1){const r=s[n],o=parseInt(r["LAST-MSN"])||(t==null?void 0:t.lastPartSn);let a=parseInt(r["LAST-PART"])||(t==null?void 0:t.lastPartIndex);if(this.hls.config.lowLatencyMode){const l=Math.min(t.age-t.partTarget,t.targetduration);a>=0&&l>t.partTarget&&(a+=1)}return new za(o,a>=0?a:void 0,zs.No)}}}loadPlaylist(e){this.requestScheduled===-1&&(this.requestScheduled=self.performance.now())}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}shouldReloadPlaylist(e){return this.timer===-1&&this.requestScheduled===-1&&this.shouldLoadPlaylist(e)}playlistLoaded(e,t,s){const{details:n,stats:r}=t,o=self.performance.now(),a=r.loading.first?Math.max(0,o-r.loading.first):0;if(n.advancedDateTime=Date.now()-a,n.live||s!=null&&s.live){if(n.reloaded(s),s&&this.log(`live playlist ${e} ${n.advanced?"REFRESHED "+n.lastPartSn+"-"+n.lastPartIndex:n.updated?"UPDATED":"MISSED"}`),s&&n.fragments.length>0&&ep(s,n),!this.canLoad||!n.live)return;let l,c,u;if(n.canBlockReload&&n.endSN&&n.advanced){const y=this.hls.config.lowLatencyMode,T=n.lastPartSn,x=n.endSN,S=n.lastPartIndex,R=S!==-1,b=T===x,M=y?0:S;R?(c=b?x+1:T,u=b?M:S+1):c=x+1;const P=n.age,B=P+n.ageHeader;let K=Math.min(B-n.partTarget,n.targetduration*1.5);if(K>0){if(s&&K>s.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${s.tuneInGoal} to: ${K} with playlist age: ${n.age}`),K=0;else{const C=Math.floor(K/n.targetduration);if(c+=C,u!==void 0){const q=Math.round(K%n.targetduration/n.partTarget);u+=q}this.log(`CDN Tune-in age: ${n.ageHeader}s last advanced ${P.toFixed(2)}s goal: ${K} skip sn ${C} to part ${u}`)}n.tuneInGoal=K}if(l=this.getDeliveryDirectives(n,t.deliveryDirectives,c,u),y||!b){this.loadPlaylist(l);return}}else(n.canBlockReload||n.canSkipUntil)&&(l=this.getDeliveryDirectives(n,t.deliveryDirectives,c,u));const f=this.hls.mainForwardBufferInfo,h=f?f.end-f.len:0,d=(n.edge-h)*1e3,g=np(n,d);n.updated&&o>this.requestScheduled+g&&(this.requestScheduled=r.loading.start),c!==void 0&&n.canBlockReload?this.requestScheduled=r.loading.first+g-(n.partTarget*1e3||1e3):this.requestScheduled===-1||this.requestScheduled+g<o?this.requestScheduled=o:this.requestScheduled-o<=0&&(this.requestScheduled+=g);let m=this.requestScheduled-o;m=Math.max(0,m),this.log(`reload live playlist ${e} in ${Math.round(m)} ms`),this.timer=self.setTimeout(()=>this.loadPlaylist(l),m)}else this.clearTimer()}getDeliveryDirectives(e,t,s,n){let r=Zm(e,s);return t!=null&&t.skip&&e.deltaUpdateFailed&&(s=t.msn,n=t.part,r=zs.No),new za(s,n,r)}checkRetry(e){const t=e.details,s=Wi(e),n=e.errorAction,{action:r,retryCount:o=0,retryConfig:a}=n||{},l=!!n&&!!a&&(r===We.RetryRequest||!n.resolved&&r===We.SendAlternateToPenaltyBox);if(l){var c;if(this.requestScheduled=-1,o>=a.maxNumRetry)return!1;if(s&&(c=e.context)!=null&&c.deliveryDirectives)this.warn(`Retrying playlist loading ${o+1}/${a.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const u=uo(a,o);this.timer=self.setTimeout(()=>this.loadPlaylist(),u),this.warn(`Retrying playlist loading ${o+1}/${a.maxNumRetry} after "${t}" in ${u}ms`)}e.levelRetry=!0,n.resolved=!0}return l}}let Kn;class dp extends fo{constructor(e,t){super(e,"[level-controller]"),this._levels=[],this._firstLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(p.LEVEL_LOADED,this.onLevelLoaded,this),e.on(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(p.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(p.FRAG_LOADED,this.onFragLoaded,this),e.on(p.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(p.LEVEL_LOADED,this.onLevelLoaded,this),e.off(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(p.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(p.FRAG_LOADED,this.onFragLoaded,this),e.off(p.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}startLoad(){this._levels.forEach(t=>{t.loadError=0,t.fragmentError=0}),super.startLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[]}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const s=[],n={};let r;t.levels.forEach(o=>{var a;const l=o.attrs;((a=o.audioCodec)==null?void 0:a.indexOf("mp4a.40.34"))!==-1&&(Kn||(Kn=/chrome|firefox/i.test(navigator.userAgent)),Kn&&(o.audioCodec=void 0));const{AUDIO:c,CODECS:u,"FRAME-RATE":f,"PATHWAY-ID":h,RESOLUTION:d,SUBTITLES:g}=l,y=`${`${h||"."}-`}${o.bitrate}-${d}-${f}-${u}`;r=n[y],r?r.addFallback(o):(r=new ri(o),n[y]=r,s.push(r)),ji(r,"audio",c),ji(r,"text",g)}),this.filterAndSortMediaOptions(s,t)}filterAndSortMediaOptions(e,t){let s=[],n=[],r=!1,o=!1,a=!1,l=e.filter(({audioCodec:d,videoCodec:g,width:m,height:y,unknownCodecs:T})=>(r||(r=!!(m&&y)),o||(o=!!g),a||(a=!!d),!(T!=null&&T.length)&&(!d||Un(d,"audio"))&&(!g||Un(g,"video"))));if((r||o)&&a&&(l=l.filter(({videoCodec:d,width:g,height:m})=>!!d||!!(g&&m))),l.length===0){Promise.resolve().then(()=>{if(this.hls){const d=new Error("no level with compatible codecs found in manifest");this.hls.trigger(p.ERROR,{type:se.MEDIA_ERROR,details:D.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:d,reason:d.message})}});return}t.audioTracks&&(s=t.audioTracks.filter(d=>!d.audioCodec||Un(d.audioCodec,"audio")),Za(s)),t.subtitles&&(n=t.subtitles,Za(n));const c=l.slice(0);l.sort((d,g)=>d.attrs["HDCP-LEVEL"]!==g.attrs["HDCP-LEVEL"]?(d.attrs["HDCP-LEVEL"]||"")>(g.attrs["HDCP-LEVEL"]||"")?1:-1:d.bitrate!==g.bitrate?d.bitrate-g.bitrate:d.attrs["FRAME-RATE"]!==g.attrs["FRAME-RATE"]?d.attrs.decimalFloatingPoint("FRAME-RATE")-g.attrs.decimalFloatingPoint("FRAME-RATE"):d.attrs.SCORE!==g.attrs.SCORE?d.attrs.decimalFloatingPoint("SCORE")-g.attrs.decimalFloatingPoint("SCORE"):r&&d.height!==g.height?d.height-g.height:0);let u=c[0];if(this.steering&&(l=this.steering.filterParsedLevels(l),l.length!==c.length)){for(let d=0;d<c.length;d++)if(c[d].pathwayId===l[0].pathwayId){u=c[d];break}}this._levels=l;for(let d=0;d<l.length;d++)if(l[d]===u){this._firstLevel=d,this.log(`manifest loaded, ${l.length} level(s) found, first bitrate: ${u.bitrate}`);break}const f=a&&!o,h={levels:l,audioTracks:s,subtitleTracks:n,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:a,video:o,altAudio:!f&&s.some(d=>!!d.url)};this.hls.trigger(p.MANIFEST_PARSED,h),(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 u=new Error("invalid level idx"),f=e<0;if(this.hls.trigger(p.ERROR,{type:se.OTHER_ERROR,details:D.LEVEL_SWITCH_ERROR,level:e,fatal:f,error:u,reason:u.message}),f)return;e=Math.min(e,t.length-1)}const s=this.currentLevelIndex,n=this.currentLevel,r=n?n.attrs["PATHWAY-ID"]:void 0,o=t[e],a=o.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=o,s===e&&o.details&&n&&r===a)return;this.log(`Switching to level ${e}${a?" with Pathway "+a:""} from level ${s}${r?" with Pathway "+r:""}`);const l=Me({},o,{level:e,maxBitrate:o.maxBitrate,attrs:o.attrs,uri:o.uri,urlId:o.urlId});delete l._attrs,delete l._urlId,this.hls.trigger(p.LEVEL_SWITCHING,l);const c=o.details;if(!c||c.live){const u=this.switchParams(o.uri,n==null?void 0:n.details);this.loadPlaylist(u)}}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._firstLevel}else return this._startLevel}set startLevel(e){this._startLevel=e}onError(e,t){t.fatal||!t.context||t.context.type===ye.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragLoaded(e,{frag:t}){if(t!==void 0&&t.type===ie.MAIN){const s=this._levels[t.level];s!==void 0&&(s.loadError=0)}}onLevelLoaded(e,t){var s;const{level:n,details:r}=t,o=this._levels[n];if(!o){var a;this.warn(`Invalid level index ${n}`),(a=t.deliveryDirectives)!=null&&a.skip&&(r.deltaUpdateFailed=!0);return}n===this.currentLevelIndex?(o.fragmentError===0&&(o.loadError=0),this.playlistLoaded(n,t,o.details)):(s=t.deliveryDirectives)!=null&&s.skip&&(r.deltaUpdateFailed=!0)}onAudioTrackSwitched(e,t){const s=this.currentLevel;if(!s)return;const n=this.hls.audioTracks[t.id].groupId;if(s.audioGroupIds&&s.audioGroupId!==n){let r=-1;for(let o=0;o<s.audioGroupIds.length;o++)if(s.audioGroupIds[o]===n){r=o;break}r!==-1&&r!==s.urlId&&(s.urlId=r,this.canLoad&&this.startLoad())}}loadPlaylist(e){super.loadPlaylist();const t=this.currentLevelIndex,s=this.currentLevel;if(s&&this.shouldLoadPlaylist(s)){const n=s.urlId;let r=s.uri;if(e)try{r=e.addDirectives(r)}catch(a){this.warn(`Could not construct new URL with HLS Delivery Directives: ${a}`)}const o=s.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${o?" Pathway "+o:""} URI ${n+1}/${s.url.length} ${r}`),this.clearTimer(),this.hls.trigger(p.LEVEL_LOADING,{url:r,level:t,id:n,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,t){const s=(r,o)=>o!==t,n=this._levels.filter((r,o)=>o!==e?!0:r.url.length>1&&t!==void 0?(r.url=r.url.filter(s),r.audioGroupIds&&(r.audioGroupIds=r.audioGroupIds.filter(s)),r.textGroupIds&&(r.textGroupIds=r.textGroupIds.filter(s)),r.urlId=0,!0):(this.steering&&this.steering.removeLevel(r),!1));this.hls.trigger(p.LEVELS_UPDATED,{levels:n})}onLevelsUpdated(e,{levels:t}){t.forEach((s,n)=>{const{details:r}=s;r!=null&&r.fragments&&r.fragments.forEach(o=>{o.level=n})}),this._levels=t}}function ji(i,e,t){t&&(e==="audio"?(i.audioGroupIds||(i.audioGroupIds=[]),i.audioGroupIds[i.url.length-1]=t):e==="text"&&(i.textGroupIds||(i.textGroupIds=[]),i.textGroupIds[i.url.length-1]=t))}function Za(i){const e={};i.forEach(t=>{const s=t.groupId||"";t.id=e[s]=e[s]||0,e[s]++})}var Ue={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class gp{constructor(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(p.BUFFER_APPENDED,this.onBufferAppended,this),e.on(p.FRAG_BUFFERED,this.onFragBuffered,this),e.on(p.FRAG_LOADED,this.onFragLoaded,this)}_unregisterListeners(){const{hls:e}=this;e.off(p.BUFFER_APPENDED,this.onBufferAppended,this),e.off(p.FRAG_BUFFERED,this.onFragBuffered,this),e.off(p.FRAG_LOADED,this.onFragLoaded,this)}destroy(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const s=this.activePartLists[t];if(s)for(let n=s.length;n--;){const r=s[n];if(!r)break;const o=r.end;if(r.start<=e&&o!==null&&e<=o)return r}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){const{fragments:s}=this,n=Object.keys(s);for(let r=n.length;r--;){const o=s[n[r]];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,s,n){this.timeRanges&&(this.timeRanges[e]=t);const r=(n==null?void 0:n.fragment.sn)||-1;Object.keys(this.fragments).forEach(o=>{const a=this.fragments[o];if(!a||r>=a.body.sn)return;if(!a.buffered&&!a.loaded){a.body.type===s&&this.removeFragment(a.body);return}const l=a.range[e];l&&l.time.some(c=>{const u=!this.isTimeBuffered(c.startPTS,c.endPTS,t);return u&&this.removeFragment(a.body),u})})}detectPartialFragments(e){const t=this.timeRanges,{frag:s,part:n}=e;if(!t||s.sn==="initSegment")return;const r=hs(s),o=this.fragments[r];if(!o||o.buffered&&s.gap)return;const a=!s.relurl;Object.keys(t).forEach(l=>{const c=s.elementaryStreams[l];if(!c)return;const u=t[l],f=a||c.partial===!0;o.range[l]=this.getBufferedTimes(s,n,f,u)}),o.loaded=null,Object.keys(o.range).length?(o.buffered=!0,(o.body.endList=s.endList||o.body.endList)&&(this.endListFragments[o.body.type]=o),yi(o)||this.removeParts(s.sn-1,s.type)):this.removeFragment(o.body)}removeParts(e,t){const s=this.activePartLists[t];s&&(this.activePartLists[t]=s.filter(n=>n.fragment.sn>=e))}fragBuffered(e,t){const s=hs(e);let n=this.fragments[s];!n&&t&&(n=this.fragments[s]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),n&&(n.loaded=null,n.buffered=!0)}getBufferedTimes(e,t,s,n){const r={time:[],partial:s},o=e.start,a=e.end,l=e.minEndPTS||a,c=e.maxStartPTS||o;for(let u=0;u<n.length;u++){const f=n.start(u)-this.bufferPadding,h=n.end(u)+this.bufferPadding;if(c>=f&&l<=h){r.time.push({startPTS:Math.max(o,n.start(u)),endPTS:Math.min(a,n.end(u))});break}else if(o<h&&a>f)r.partial=!0,r.time.push({startPTS:Math.max(o,n.start(u)),endPTS:Math.min(a,n.end(u))});else if(a<=f)break}return r}getPartialFragment(e){let t=null,s,n,r,o=0;const{bufferPadding:a,fragments:l}=this;return Object.keys(l).forEach(c=>{const u=l[c];u&&yi(u)&&(n=u.body.start-a,r=u.body.end+a,e>=n&&e<=r&&(s=Math.min(e-n,r-e),o<=s&&(t=u.body,o=s)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||yi(t))}getState(e){const t=hs(e),s=this.fragments[t];return s?s.buffered?yi(s)?Ue.PARTIAL:Ue.OK:Ue.APPENDING:Ue.NOT_LOADED}isTimeBuffered(e,t,s){let n,r;for(let o=0;o<s.length;o++){if(n=s.start(o)-this.bufferPadding,r=s.end(o)+this.bufferPadding,e>=n&&t<=r)return!0;if(t<=n)return!1}return!1}onFragLoaded(e,t){const{frag:s,part:n}=t;if(s.sn==="initSegment"||s.bitrateTest)return;const r=n?null:t,o=hs(s);this.fragments[o]={body:s,appendedPTS:null,loaded:r,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:s,part:n,timeRanges:r}=t;if(s.sn==="initSegment")return;const o=s.type;if(n){let a=this.activePartLists[o];a||(this.activePartLists[o]=a=[]),a.push(n)}this.timeRanges=r,Object.keys(r).forEach(a=>{const l=r[a];this.detectEvictedFragments(a,l,o,n)})}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=hs(e);return!!this.fragments[t]}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,s,n,r){n&&!this.hasGaps||Object.keys(this.fragments).forEach(o=>{const a=this.fragments[o];if(!a)return;const l=a.body;l.type!==s||n&&!l.gap||l.start<t&&l.end>e&&(a.buffered||r)&&this.removeFragment(l)})}removeFragment(e){const t=hs(e);e.stats.loaded=0,e.clearElementaryStreamInfo();const s=this.activePartLists[e.type];if(s){const n=e.sn;this.activePartLists[e.type]=s.filter(r=>r.fragment.sn!==n)}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 yi(i){var e,t,s;return i.buffered&&(i.body.gap||((e=i.range.video)==null?void 0:e.partial)||((t=i.range.audio)==null?void 0:t.partial)||((s=i.range.audiovideo)==null?void 0:s.partial))}function hs(i){return`${i.type}_${i.level}_${i.urlId}_${i.sn}`}const el=Math.pow(2,17);class mp{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 s=e.url;if(!s)return Promise.reject(new kt({type:se.NETWORK_ERROR,details:D.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${s?"part list":"url"}`),networkDetails:null}));this.abort();const n=this.config,r=n.fLoader,o=n.loader;return new Promise((a,l)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(d=>d[0]==="GAP")){l(sl(e));return}else e.gap=!1;const c=this.loader=e.loader=r?new r(n):new o(n),u=tl(e),f=Ja(n.fragLoadPolicy.default),h={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:el};e.stats=c.stats,c.load(u,h,{onSuccess:(d,g,m,y)=>{this.resetLoader(e,c);let T=d.data;m.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(T.slice(0,16)),T=T.slice(16)),a({frag:e,part:null,payload:T,networkDetails:y})},onError:(d,g,m,y)=>{this.resetLoader(e,c),l(new kt({type:se.NETWORK_ERROR,details:D.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:tt({url:s,data:void 0},d),error:new Error(`HTTP Error ${d.code} ${d.text}`),networkDetails:m,stats:y}))},onAbort:(d,g,m)=>{this.resetLoader(e,c),l(new kt({type:se.NETWORK_ERROR,details:D.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:m,stats:d}))},onTimeout:(d,g,m)=>{this.resetLoader(e,c),l(new kt({type:se.NETWORK_ERROR,details:D.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${h.timeout}ms`),networkDetails:m,stats:d}))},onProgress:(d,g,m,y)=>{t&&t({frag:e,part:null,payload:m,networkDetails:y})}})})}loadPart(e,t,s){this.abort();const n=this.config,r=n.fLoader,o=n.loader;return new Promise((a,l)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){l(sl(e,t));return}const c=this.loader=e.loader=r?new r(n):new o(n),u=tl(e,t),f=Ja(n.fragLoadPolicy.default),h={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:el};t.stats=c.stats,c.load(u,h,{onSuccess:(d,g,m,y)=>{this.resetLoader(e,c),this.updateStatsFromPart(e,t);const T={frag:e,part:t,payload:d.data,networkDetails:y};s(T),a(T)},onError:(d,g,m,y)=>{this.resetLoader(e,c),l(new kt({type:se.NETWORK_ERROR,details:D.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:tt({url:u.url,data:void 0},d),error:new Error(`HTTP Error ${d.code} ${d.text}`),networkDetails:m,stats:y}))},onAbort:(d,g,m)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,c),l(new kt({type:se.NETWORK_ERROR,details:D.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:m,stats:d}))},onTimeout:(d,g,m)=>{this.resetLoader(e,c),l(new kt({type:se.NETWORK_ERROR,details:D.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${h.timeout}ms`),networkDetails:m,stats:d}))}})})}updateStatsFromPart(e,t){const s=e.stats,n=t.stats,r=n.total;if(s.loaded+=n.loaded,r){const l=Math.round(e.duration/t.duration),c=Math.min(Math.round(s.loaded/r),l),f=(l-c)*Math.round(s.loaded/c);s.total=s.loaded+f}else s.total=Math.max(s.loaded,s.total);const o=s.loading,a=n.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 tl(i,e=null){const t=e||i,s={frag:i,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},n=t.byteRangeStartOffset,r=t.byteRangeEndOffset;if(J(n)&&J(r)){var o;let a=n,l=r;if(i.sn==="initSegment"&&((o=i.decryptdata)==null?void 0:o.method)==="AES-128"){const c=r-n;c%16&&(l=r+(16-c%16)),n!==0&&(s.resetIV=!0,a=n-16)}s.rangeStart=a,s.rangeEnd=l}return s}function sl(i,e){const t=new Error(`GAP ${i.gap?"tag":"attribute"} found`),s={type:se.MEDIA_ERROR,details:D.FRAG_GAP,fatal:!1,frag:i,error:t,networkDetails:null};return e&&(s.part=e),(e||i).stats.aborted=!0,new kt(s)}class kt extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class pp{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const t in this.keyUriToKeyInfo){const s=this.keyUriToKeyInfo[t].loader;if(s){if(e&&e!==s.context.frag.type)return;s.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=D.KEY_LOAD_ERROR,s,n,r){return new kt({type:se.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:r,error:s,networkDetails:n})}loadClear(e,t){if(this.emeController&&this.config.emeEnabled){const{sn:s,cc:n}=e;for(let r=0;r<t.length;r++){const o=t[r];if(n<=o.cc&&(s==="initSegment"||o.sn==="initSegment"||s<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 s,n;t&&e.setKeyFormat(t);const r=e.decryptdata;if(!r){const c=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,D.KEY_LOAD_ERROR,c))}const o=r.uri;if(!o)return Promise.reject(this.createKeyLoadError(e,D.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${o}"`)));let a=this.keyUriToKeyInfo[o];if((s=a)!=null&&s.decryptdata.key)return r.key=a.decryptdata.key,Promise.resolve({frag:e,keyInfo:a});if((n=a)!=null&&n.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(c=>(r.key=c.keyInfo.decryptdata.key,{frag:e,keyInfo:a}))}}switch(a=this.keyUriToKeyInfo[o]={decryptdata:r,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},r.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return r.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,D.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${r.method}"`)))}}loadKeyEME(e,t){const s={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const n=this.emeController.loadKey(s);if(n)return(e.keyLoadPromise=n.then(r=>(e.mediaKeySessionContext=r,s))).catch(r=>{throw e.keyLoadPromise=null,r})}return Promise.resolve(s)}loadKeyHTTP(e,t){const s=this.config,n=s.loader,r=new n(s);return t.keyLoader=e.loader=r,e.keyLoadPromise=new Promise((o,a)=>{const l={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},c=s.keyLoadPolicy.default,u={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(h,d,g,m)=>{const{frag:y,keyInfo:T,url:x}=g;if(!y.decryptdata||T!==this.keyUriToKeyInfo[x])return a(this.createKeyLoadError(y,D.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),m));T.decryptdata.key=y.decryptdata.key=new Uint8Array(h.data),y.keyLoader=null,T.loader=null,o({frag:y,keyInfo:T})},onError:(h,d,g,m)=>{this.resetLoader(d),a(this.createKeyLoadError(t,D.KEY_LOAD_ERROR,new Error(`HTTP Error ${h.code} loading key ${h.text}`),g,tt({url:l.url,data:void 0},h)))},onTimeout:(h,d,g)=>{this.resetLoader(d),a(this.createKeyLoadError(t,D.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),g))},onAbort:(h,d,g)=>{this.resetLoader(d),a(this.createKeyLoadError(t,D.INTERNAL_ABORTED,new Error("key loading aborted"),g))}};r.load(l,u,f)})}resetLoader(e){const{frag:t,keyInfo:s,url:n}=e,r=s.loader;t.keyLoader===r&&(t.keyLoader=null,s.loader=null),delete this.keyUriToKeyInfo[n],r&&r.destroy()}}class yp{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(){}}const Tp={length:0,start:()=>0,end:()=>0};class De{static isBuffered(e,t){try{if(e){const s=De.getBuffered(e);for(let n=0;n<s.length;n++)if(t>=s.start(n)&&t<=s.end(n))return!0}}catch{}return!1}static bufferInfo(e,t,s){try{if(e){const n=De.getBuffered(e),r=[];let o;for(o=0;o<n.length;o++)r.push({start:n.start(o),end:n.end(o)});return this.bufferedInfo(r,t,s)}}catch{}return{len:0,start:t,end:t,nextStart:void 0}}static bufferedInfo(e,t,s){t=Math.max(0,t),e.sort(function(c,u){const f=c.start-u.start;return f||u.end-c.end});let n=[];if(s)for(let c=0;c<e.length;c++){const u=n.length;if(u){const f=n[u-1].end;e[c].start-f<s?e[c].end>f&&(n[u-1].end=e[c].end):n.push(e[c])}else n.push(e[c])}else n=e;let r=0,o,a=t,l=t;for(let c=0;c<n.length;c++){const u=n[c].start,f=n[c].end;if(t+s>=u&&t<f)a=u,l=f,r=l-t;else if(t+s<u){o=u;break}}return{len:r,start:a||0,end:l||0,nextStart:o}}static getBuffered(e){try{return e.buffered}catch(t){return v.log("failed to get media.buffered",t),Tp}}}class ho{constructor(e,t,s,n=0,r=-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=Ti(),this.buffering={audio:Ti(),video:Ti(),audiovideo:Ti()},this.level=e,this.sn=t,this.id=s,this.size=n,this.part=r,this.partial=o}}function Ti(){return{start:0,executeStart:0,executeEnd:0,end:0}}function Au(i,e){let t=null;for(let s=0,n=i.length;s<n;s++){const r=i[s];if(r&&r.cc===e){t=r;break}}return t}function Ep(i,e,t){return!!(e.details&&(t.endCC>t.startCC||i&&i.cc<t.startCC))}function xp(i,e,t=0){const s=i.fragments,n=e.fragments;if(!n.length||!s.length){v.log("No fragments to align");return}const r=Au(s,n[0].cc);if(!r||r&&!r.startPTS){v.log("No frag in previous level to align on");return}return r}function il(i,e){if(i){const t=i.start+e;i.start=i.startPTS=t,i.endPTS=t+i.duration}}function go(i,e){const t=e.fragments;for(let s=0,n=t.length;s<n;s++)il(t[s],i);e.fragmentHint&&il(e.fragmentHint,i),e.alignedSliding=!0}function Ap(i,e,t){e&&(Sp(i,t,e),!t.alignedSliding&&e.details&&vp(t,e.details),!t.alignedSliding&&e.details&&!t.skippedSegments&&Tu(e.details,t))}function Sp(i,e,t){if(Ep(i,t,e)){const s=xp(t.details,e);s&&J(s.start)&&(v.log(`Adjusting PTS using last level due to CC increase within current level ${e.url}`),go(s.start,e))}}function vp(i,e){if(!e.fragments.length||!i.hasProgramDateTime||!e.hasProgramDateTime)return;const t=e.fragments[0].programDateTime,s=i.fragments[0].programDateTime,n=(s-t)/1e3+e.fragments[0].start;n&&J(n)&&(v.log(`Adjusting PTS using programDateTime delta ${s-t}ms, sliding:${n.toFixed(3)} ${i.url} `),go(n,i))}function Su(i,e){if(!i.hasProgramDateTime||!e.hasProgramDateTime)return;const t=i.fragments,s=e.fragments;if(!t.length||!s.length)return;const n=Math.round(s.length/2)-1,r=s[n],o=Au(t,r.cc)||t[Math.round(t.length/2)-1],a=r.programDateTime,l=o.programDateTime;if(a===null||l===null)return;const c=(l-a)/1e3-(o.start-r.start);go(c,i)}class Rp{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 Lp{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 bp(i){const e=i.byteLength,t=e&&new DataView(i.buffer).getUint8(e-1);return t?as(i,0,e-t):i}class Ip{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),s=new Uint32Array(4);for(let n=0;n<4;n++)s[n]=t.getUint32(n*4);return s}initTable(){const e=this.sBox,t=this.invSBox,s=this.subMix,n=s[0],r=s[1],o=s[2],a=s[3],l=this.invSubMix,c=l[0],u=l[1],f=l[2],h=l[3],d=new Uint32Array(256);let g=0,m=0,y=0;for(y=0;y<256;y++)y<128?d[y]=y<<1:d[y]=y<<1^283;for(y=0;y<256;y++){let T=m^m<<1^m<<2^m<<3^m<<4;T=T>>>8^T&255^99,e[g]=T,t[T]=g;const x=d[g],S=d[x],R=d[S];let b=d[T]*257^T*16843008;n[g]=b<<24|b>>>8,r[g]=b<<16|b>>>16,o[g]=b<<8|b>>>24,a[g]=b,b=R*16843009^S*65537^x*257^g*16843008,c[T]=b<<24|b>>>8,u[T]=b<<16|b>>>16,f[T]=b<<8|b>>>24,h[T]=b,g?(g=x^d[d[d[R^x]]],m^=d[d[m]]):g=m=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let s=!0,n=0;for(;n<t.length&&s;)s=t[n]===this.key[n],n++;if(s)return;this.key=t;const r=this.keySize=t.length;if(r!==4&&r!==6&&r!==8)throw new Error("Invalid aes key size="+r);const o=this.ksRows=(r+6+1)*4;let a,l;const c=this.keySchedule=new Uint32Array(o),u=this.invKeySchedule=new Uint32Array(o),f=this.sBox,h=this.rcon,d=this.invSubMix,g=d[0],m=d[1],y=d[2],T=d[3];let x,S;for(a=0;a<o;a++){if(a<r){x=c[a]=t[a];continue}S=x,a%r===0?(S=S<<8|S>>>24,S=f[S>>>24]<<24|f[S>>>16&255]<<16|f[S>>>8&255]<<8|f[S&255],S^=h[a/r|0]<<24):r>6&&a%r===4&&(S=f[S>>>24]<<24|f[S>>>16&255]<<16|f[S>>>8&255]<<8|f[S&255]),c[a]=x=(c[a-r]^S)>>>0}for(l=0;l<o;l++)a=o-l,l&3?S=c[a]:S=c[a-4],l<4||a<=4?u[l]=S:u[l]=g[f[S>>>24]]^m[f[S>>>16&255]]^y[f[S>>>8&255]]^T[f[S&255]],u[l]=u[l]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,s){const n=this.keySize+6,r=this.invKeySchedule,o=this.invSBox,a=this.invSubMix,l=a[0],c=a[1],u=a[2],f=a[3],h=this.uint8ArrayToUint32Array_(s);let d=h[0],g=h[1],m=h[2],y=h[3];const T=new Int32Array(e),x=new Int32Array(T.length);let S,R,b,M,P,B,K,C,q,W,ue,_e,Te,ae;const te=this.networkToHostOrderSwap;for(;t<T.length;){for(q=te(T[t]),W=te(T[t+1]),ue=te(T[t+2]),_e=te(T[t+3]),P=q^r[0],B=_e^r[1],K=ue^r[2],C=W^r[3],Te=4,ae=1;ae<n;ae++)S=l[P>>>24]^c[B>>16&255]^u[K>>8&255]^f[C&255]^r[Te],R=l[B>>>24]^c[K>>16&255]^u[C>>8&255]^f[P&255]^r[Te+1],b=l[K>>>24]^c[C>>16&255]^u[P>>8&255]^f[B&255]^r[Te+2],M=l[C>>>24]^c[P>>16&255]^u[B>>8&255]^f[K&255]^r[Te+3],P=S,B=R,K=b,C=M,Te=Te+4;S=o[P>>>24]<<24^o[B>>16&255]<<16^o[K>>8&255]<<8^o[C&255]^r[Te],R=o[B>>>24]<<24^o[K>>16&255]<<16^o[C>>8&255]<<8^o[P&255]^r[Te+1],b=o[K>>>24]<<24^o[C>>16&255]<<16^o[P>>8&255]<<8^o[B&255]^r[Te+2],M=o[C>>>24]<<24^o[P>>16&255]<<16^o[B>>8&255]<<8^o[K&255]^r[Te+3],x[t]=te(S^d),x[t+1]=te(M^g),x[t+2]=te(b^m),x[t+3]=te(R^y),d=q,g=W,m=ue,y=_e,t=t+4}return x.buffer}}const Dp=16;class mo{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 s=self.crypto;s&&(this.subtle=s.subtle||s.webkitSubtle)}catch{}this.subtle===null&&(this.useSoftware=!0)}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){const{currentResult:e,remainderData:t}=this;if(!e||t)return this.reset(),null;const s=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?bp(s):s}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,s){return this.useSoftware?new Promise((n,r)=>{this.softwareDecrypt(new Uint8Array(e),t,s);const o=this.flush();o?n(o.buffer):r(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,s)}softwareDecrypt(e,t,s){const{currentIV:n,currentResult:r,remainderData:o}=this;this.logOnce("JS AES decrypt"),o&&(e=cs(o,e),this.remainderData=null);const a=this.getValidChunk(e);if(!a.length)return null;n&&(s=n);let l=this.softwareDecrypter;l||(l=this.softwareDecrypter=new Ip),l.expandKey(t);const c=r;return this.currentResult=l.decrypt(a.buffer,0,s),this.currentIV=as(a,-16).buffer,c||null}webCryptoDecrypt(e,t,s){const n=this.subtle;return(this.key!==t||!this.fastAesKey)&&(this.key=t,this.fastAesKey=new Lp(n,t)),this.fastAesKey.expandKey().then(r=>n?(this.logOnce("WebCrypto AES decrypt"),new Rp(n,new Uint8Array(s)).decrypt(e.buffer,r)):Promise.reject(new Error("web crypto not initialized"))).catch(r=>(v.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${r.name}: ${r.message}`),this.onWebCryptoError(e,t,s)))}onWebCryptoError(e,t,s){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,s);const n=this.flush();if(n)return n.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")}getValidChunk(e){let t=e;const s=e.length-e.length%Dp;return s!==e.length&&(t=as(e,0,s),this.remainderData=as(e,s)),t}logOnce(e){this.logEnabled&&(v.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const Cp={toString:function(i){let e="";const t=i.length;for(let s=0;s<t;s++)e+=`[${i.start(s).toFixed(3)}-${i.end(s).toFixed(3)}]`;return e}},F={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 po extends yp{constructor(e,t,s,n,r){super(),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=F.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=r,this.logPrefix=n,this.log=v.log.bind(v,`${n}:`),this.warn=v.warn.bind(v,`${n}:`),this.hls=e,this.fragmentLoader=new mp(e.config),this.keyLoader=s,this.fragmentTracker=t,this.config=e.config,this.decrypter=new mo(e.config),e.on(p.MANIFEST_LOADED,this.onManifestLoaded,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const e=this.fragCurrent;e!=null&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=F.STOPPED}_streamEnded(e,t){if(t.live||e.nextStart||!e.end||!this.media)return!1;const s=t.partList;if(s!=null&&s.length){const r=s[s.length-1];return De.isBuffered(this.media,r.start+r.duration/2)}const n=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(n)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null){var e;return(e=this.levels[this.levelLastLoaded])==null?void 0:e.details}}onMediaAttached(e,t){const s=this.media=this.mediaBuffer=t.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),s.addEventListener("seeking",this.onvseeking),s.addEventListener("ended",this.onvended);const n=this.config;this.levels&&n.autoStartLoad&&this.state===F.STOPPED&&this.startLoad(n.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:s,mediaBuffer:n,state:r}=this,o=s?s.currentTime:0,a=De.bufferInfo(n||s,o,e.maxBufferHole);if(this.log(`media seeking to ${J(o)?o.toFixed(3):o}, state: ${r}`),this.state===F.ENDED)this.resetLoadingState();else if(t){const l=e.maxFragLookUpTolerance,c=t.start-l,u=t.start+t.duration+l;if(!a.len||u<a.start||c>a.end){const f=o>u;(o<c||f)&&(f&&t.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),t.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}s&&(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.stopLoad(),super.onHandlerDestroying()}onHandlerDestroyed(){this.state=F.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,s){this._loadFragForPlayback(e,t,s)}_loadFragForPlayback(e,t,s){const n=r=>{if(this.fragContextChanged(e)){this.warn(`Fragment ${e.sn}${r.part?" p: "+r.part.index:""} of level ${e.level} was dropped during download.`),this.fragmentTracker.removeFragment(e);return}e.stats.chunkCount++,this._handleFragmentLoadProgress(r)};this._doFragLoad(e,t,s,n).then(r=>{if(!r)return;const o=this.state;if(this.fragContextChanged(e)){(o===F.FRAG_LOADING||!this.fragCurrent&&o===F.PARSING)&&(this.fragmentTracker.removeFragment(e),this.state=F.IDLE);return}"payload"in r&&(this.log(`Loaded fragment ${e.sn} of level ${e.level}`),this.hls.trigger(p.FRAG_LOADED,r)),this._handleFragmentLoadComplete(r)}).catch(r=>{this.state===F.STOPPED||this.state===F.ERROR||(this.warn(r),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:s}=this;if(s.getState(e)===Ue.APPENDING){const r=e.type,o=this.getFwdBufferInfo(this.mediaBuffer,r),a=Math.max(e.duration,o?o.len:this.config.maxBufferLength);this.reduceMaxBufferLength(a)&&s.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?s.removeAllFragments():s.hasParts(e.type)&&(s.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),s.getState(e)===Ue.PARTIAL&&s.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,s=null){if(!(e-t))return;const n={startOffset:e,endOffset:t,type:s};this.hls.trigger(p.BUFFER_FLUSHING,n)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(s=>{if(!s||this.fragContextChanged(e)||!this.levels)throw new Error("init load aborted");return s}).then(s=>{const{hls:n}=this,{payload:r}=s,o=e.decryptdata;if(r&&r.byteLength>0&&o&&o.key&&o.iv&&o.method==="AES-128"){const a=self.performance.now();return this.decrypter.decrypt(new Uint8Array(r),o.key.buffer,o.iv.buffer).catch(l=>{throw n.trigger(p.ERROR,{type:se.MEDIA_ERROR,details:D.FRAG_DECRYPT_ERROR,fatal:!1,error:l,reason:l.message,frag:e}),l}).then(l=>{const c=self.performance.now();return n.trigger(p.FRAG_DECRYPTED,{frag:e,payload:l,stats:{tstart:a,tdecrypt:c}}),s.payload=l,s})}return s}).then(s=>{const{fragCurrent:n,hls:r,levels:o}=this;if(!o)throw new Error("init load aborted, missing levels");const a=e.stats;this.state=F.IDLE,t.fragmentError=0,e.data=new Uint8Array(s.payload),a.parsing.start=a.buffering.start=self.performance.now(),a.parsing.end=a.buffering.end=self.performance.now(),s.frag===n&&r.trigger(p.FRAG_BUFFERED,{stats:a,frag:n,part:null,id:e.type}),this.tick()}).catch(s=>{this.state===F.STOPPED||this.state===F.ERROR||(this.warn(s),this.resetFragmentLoading(e))})}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.level!==t.level||e.sn!==t.sn||e.urlId!==t.urlId}fragBufferedComplete(e,t){var s,n,r,o;const a=this.mediaBuffer?this.mediaBuffer:this.media;this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.playlistType===ie.MAIN?"level":"track"} ${e.level} (frag:[${((s=e.startPTS)!=null?s:NaN).toFixed(3)}-${((n=e.endPTS)!=null?n:NaN).toFixed(3)}] > buffer:${a?Cp.toString(De.getBuffered(a)):"(detached)"})`),this.state=F.IDLE,a&&(!this.loadedmetadata&&e.type==ie.MAIN&&a.buffered.length&&((r=this.fragCurrent)==null?void 0:r.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:s,part:n,partsLoaded:r}=e,o=!r||r.length===0||r.some(l=>!l),a=new ho(s.level,s.sn,s.stats.chunkCount+1,0,n?n.index:-1,!o);t.flush(a)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,s=null,n){var r;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&&!((r=e.decryptdata)!=null&&r.key)?(this.log(`Loading key for ${e.sn} of [${o.startSN}-${o.endSN}], ${this.logPrefix==="[stream-controller]"?"level":"track"} ${e.level}`),this.state=F.KEY_LOADING,this.fragCurrent=e,a=this.keyLoader.load(e).then(u=>{if(!this.fragContextChanged(u.frag))return this.hls.trigger(p.KEY_LOADED,u),this.state===F.KEY_LOADING&&(this.state=F.IDLE),u}),this.hls.trigger(p.KEY_LOADING,{frag:e}),this.fragCurrent===null&&(a=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))):!e.encrypted&&o.encryptedFragments.length&&this.keyLoader.loadClear(e,o.encryptedFragments),s=Math.max(e.start,s||0),this.config.lowLatencyMode&&e.sn!=="initSegment"){const u=o.partList;if(u&&n){s>e.end&&o.fragmentHint&&(e=o.fragmentHint);const f=this.getNextPart(u,e,s);if(f>-1){const h=u[f];this.log(`Loading part sn: ${e.sn} p: ${h.index} cc: ${e.cc} of playlist [${o.startSN}-${o.endSN}] parts [0-${f}-${u.length-1}] ${this.logPrefix==="[stream-controller]"?"level":"track"}: ${e.level}, target: ${parseFloat(s.toFixed(3))}`),this.nextLoadPosition=h.start+h.duration,this.state=F.FRAG_LOADING;let d;return a?d=a.then(g=>!g||this.fragContextChanged(g.frag)?null:this.doFragPartsLoad(e,h,t,n)).catch(g=>this.handleFragLoadError(g)):d=this.doFragPartsLoad(e,h,t,n).catch(g=>this.handleFragLoadError(g)),this.hls.trigger(p.FRAG_LOADING,{frag:e,part:h,targetBufferTime:s}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):d}else if(!e.url||this.loadedEndOfParts(u,s))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(s.toFixed(3))}`),J(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=F.FRAG_LOADING;const l=this.config.progressive;let c;return l&&a?c=a.then(u=>!u||this.fragContextChanged(u==null?void 0:u.frag)?null:this.fragmentLoader.load(e,n)).catch(u=>this.handleFragLoadError(u)):c=Promise.all([this.fragmentLoader.load(e,l?n:void 0),a]).then(([u])=>(!l&&u&&n&&n(u),u)).catch(u=>this.handleFragLoadError(u)),this.hls.trigger(p.FRAG_LOADING,{frag:e,targetBufferTime:s}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):c}doFragPartsLoad(e,t,s,n){return new Promise((r,o)=>{var a;const l=[],c=(a=s.details)==null?void 0:a.partList,u=f=>{this.fragmentLoader.loadPart(e,f,n).then(h=>{l[f.index]=h;const d=h.part;this.hls.trigger(p.FRAG_LOADED,h);const g=Xa(s,e.sn,f.index+1)||Eu(c,e.sn,f.index+1);if(g)u(g);else return r({frag:e,part:d,partsLoaded:l})}).catch(o)};u(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;e.data&&t.details===D.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(p.ERROR,t)}else this.hls.trigger(p.ERROR,{type:se.OTHER_ERROR,details:D.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==F.PARSING){!this.fragCurrent&&this.state!==F.STOPPED&&this.state!==F.ERROR&&(this.state=F.IDLE);return}const{frag:s,part:n,level:r}=t,o=self.performance.now();s.stats.parsing.end=o,n&&(n.stats.parsing.end=o),this.updateLevelTiming(s,n,r,e.partial)}getCurrentContext(e){const{levels:t,fragCurrent:s}=this,{level:n,sn:r,part:o}=e;if(!(t!=null&&t[n]))return this.warn(`Levels object was unset while buffering fragment ${r} of level ${n}. The current chunk will not be buffered.`),null;const a=t[n],l=o>-1?Xa(a,r,o):null,c=l?l.fragment:rp(a,r,s);return c?(s&&s!==c&&(c.stats=s.stats),{frag:c,part:l,level:a}):null}bufferFragmentData(e,t,s,n,r){var o;if(!e||this.state!==F.PARSING)return;const{data1:a,data2:l}=e;let c=a;if(a&&l&&(c=cs(a,l)),!((o=c)!=null&&o.length))return;const u={type:e.type,frag:t,part:s,chunkMeta:n,parent:t.type,data:c};if(this.hls.trigger(p.BUFFER_APPENDING,u),e.dropped&&e.independent&&!s){if(r)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!De.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const s=t.currentTime,n=De.bufferInfo(t,s,0),r=e.duration,o=Math.min(this.config.maxFragLookUpTolerance*2,r*.25),a=Math.max(Math.min(e.start-o,n.end-o),s+o);e.start-a>o&&this.flushMainBuffer(a,e.start)}getFwdBufferInfo(e,t){const s=this.getLoadPosition();return J(s)?this.getFwdBufferInfoAtPos(e,s,t):null}getFwdBufferInfoAtPos(e,t,s){const{config:{maxBufferHole:n}}=this,r=De.bufferInfo(e,t,n);if(r.len===0&&r.nextStart!==void 0){const o=this.fragmentTracker.getBufferedFrag(t,s);if(o&&r.nextStart<o.end)return De.bufferInfo(e,t,Math.max(r.nextStart,n))}return r}getMaxBufferLength(e){const{config:t}=this;let s;return e?s=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):s=t.maxBufferLength,Math.min(s,t.maxMaxBufferLength)}reduceMaxBufferLength(e){const t=this.config,s=e||t.maxBufferLength;return t.maxMaxBufferLength>=s?(t.maxMaxBufferLength/=2,this.warn(`Reduce max buffer length to ${t.maxMaxBufferLength}s`),!0):!1}getAppendedFrag(e,t=ie.MAIN){const s=this.fragmentTracker.getAppendedFrag(e,ie.MAIN);return s&&"fragment"in s?s.fragment:s}getNextFragment(e,t){const s=t.fragments,n=s.length;if(!n)return null;const{config:r}=this,o=s[0].start;let a;if(t.live){const l=r.initialLiveManifestSize;if(n<l)return this.warn(`Not enough fragments to start playback (have: ${n}, need: ${l})`),null;!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(a=this.getInitialLiveFragment(t,s),this.startPosition=a?this.hls.liveSyncPosition||a.start:e)}else e<=o&&(a=s[0]);if(!a){const l=r.lowLatencyMode?t.partEnd:t.fragmentEnd;a=this.getFragmentAtPosition(e,l,t)}return this.mapToInitFragWhenRequired(a)}isLoopLoading(e,t){const s=this.fragmentTracker.getState(e);return(s===Ue.OK||s===Ue.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,s,n,r){const o=e.gap,a=this.getNextFragment(this.nextLoadPosition,t);if(a===null)return a;if(e=a,o&&e&&!e.gap&&s.nextStart){const l=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,s.nextStart,n);if(l!==null&&s.len+l.len>=r)return this.log(`buffer full after gaps in "${n}" 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,s){let n=-1,r=!1,o=!0;for(let a=0,l=e.length;a<l;a++){const c=e[a];if(o=o&&!c.independent,n>-1&&s<c.start)break;const u=c.loaded;u?n=-1:(r||c.independent||o)&&c.fragment===t&&(n=a),r=u}return n}loadedEndOfParts(e,t){const s=e[e.length-1];return s&&t>s.start&&s.loaded}getInitialLiveFragment(e,t){const s=this.fragPrevious;let n=null;if(s){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${s.programDateTime}`),n=ap(t,s.endProgramDateTime,this.config.maxFragLookUpTolerance)),!n){const r=s.sn+1;if(r>=e.startSN&&r<=e.endSN){const o=t[r-e.startSN];s.cc===o.cc&&(n=o,this.log(`Live playlist, switching playlist, load frag with next SN: ${n.sn}`))}n||(n=cp(t,s.cc),n&&this.log(`Live playlist, switching playlist, load frag with same CC: ${n.sn}`))}}else{const r=this.hls.liveSyncPosition;r!==null&&(n=this.getFragmentAtPosition(r,this.bitrateTest?e.fragmentEnd:e.edge,e))}return n}getFragmentAtPosition(e,t,s){const{config:n}=this;let{fragPrevious:r}=this,{fragments:o,endSN:a}=s;const{fragmentHint:l}=s,c=n.maxFragLookUpTolerance,u=s.partList,f=!!(n.lowLatencyMode&&u!=null&&u.length&&l);f&&l&&!this.bitrateTest&&(o=o.concat(l),a=l.sn);let h;if(e<t){const d=e>t-c?0:c;h=oi(r,o,e,d)}else h=o[o.length-1];if(h){const d=h.sn-s.startSN,g=this.fragmentTracker.getState(h);if((g===Ue.OK||g===Ue.PARTIAL&&h.gap)&&(r=h),r&&h.sn===r.sn&&(!f||u[0].fragment.sn>h.sn)&&r&&h.level===r.level){const y=o[d+1];h.sn<a&&this.fragmentTracker.getState(y)!==Ue.OK?h=y:h=null}}return h}synchronizeToLiveEdge(e){const{config:t,media:s}=this;if(!s)return;const n=this.hls.liveSyncPosition,r=s.currentTime,o=e.fragments[0].start,a=e.edge,l=r>=o-t.maxFragLookUpTolerance&&r<=a;if(n!==null&&s.duration>n&&(r<n||!l)){const c=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;(!l&&s.readyState<4||r<a-c)&&(this.loadedmetadata||(this.nextLoadPosition=n),s.readyState&&(this.warn(`Playback: ${r.toFixed(3)} is located too far from the end of live sliding playlist: ${a}, reset currentTime to : ${n.toFixed(3)}`),s.currentTime=n))}}alignPlaylists(e,t){const{levels:s,levelLastLoaded:n,fragPrevious:r}=this,o=n!==null?s[n]:null,a=e.fragments.length;if(!a)return this.warn("No fragments in live playlist"),0;const l=e.fragments[0].start,c=!t,u=e.alignedSliding&&J(l);if(c||!u&&!l){Ap(r,o,e);const f=e.fragments[0].start;return this.log(`Live playlist sliding: ${f.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} prev-sn: ${r?r.sn:"na"} fragments: ${a}`),f}return l}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let s=this.startPosition;if(s<t&&(s=-1),s===-1||this.lastCurrentTime===-1){const n=this.startTimeOffset!==null,r=n?this.startTimeOffset:e.startTimeOffset;r!==null&&J(r)?(s=t+r,r<0&&(s+=e.totalduration),s=Math.min(Math.max(t,s),t+e.totalduration),this.log(`Start time offset ${r} found in ${n?"multivariant":"media"} playlist, adjust startPosition to ${s}`),this.startPosition=s):e.live?s=this.hls.liveSyncPosition||t:this.startPosition=s=0,this.lastCurrentTime=s}this.nextLoadPosition=s}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!==F.FRAG_LOADING_WAITING_RETRY)&&(this.state=F.IDLE)}onFragmentOrKeyLoadError(e,t){if(t.chunkMeta&&!t.frag){const f=this.getCurrentContext(t.chunkMeta);f&&(t.frag=f.frag)}const s=t.frag;if(!s||s.type!==e||!this.levels)return;if(this.fragContextChanged(s)){var n;this.warn(`Frag load error must match current frag to retry ${s.url} > ${(n=this.fragCurrent)==null?void 0:n.url}`);return}const r=t.details===D.FRAG_GAP;r&&this.fragmentTracker.fragBuffered(s,!0);const o=t.errorAction,{action:a,retryCount:l=0,retryConfig:c}=o||{};if(o&&a===We.RetryRequest&&c){var u;this.resetStartWhenNotLoaded((u=this.levelLastLoaded)!=null?u:s.level);const f=uo(c,l);this.warn(`Fragment ${s.sn} of ${e} ${s.level} errored with ${t.details}, retrying loading ${l+1}/${c.maxNumRetry} in ${f}ms`),o.resolved=!0,this.retryDate=self.performance.now()+f,this.state=F.FRAG_LOADING_WAITING_RETRY}else c&&o?(this.resetFragmentErrors(e),l<c.maxNumRetry?r||(o.resolved=!0):v.warn(`${t.details} reached or exceeded max retry (${l})`)):(o==null?void 0:o.action)===We.SendAlternateToPenaltyBox?this.state=F.WAITING_LEVEL:this.state=F.ERROR;this.tickImmediate()}reduceLengthAndFlushBuffer(e){if(this.state===F.PARSING||this.state===F.PARSED){const t=e.parent,s=this.getFwdBufferInfo(this.mediaBuffer,t),n=s&&s.len>.5;n&&this.reduceMaxBufferLength(s.len);const r=!n;return r&&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(),r}return!1}resetFragmentErrors(e){e===ie.AUDIO&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==F.STOPPED&&(this.state=F.IDLE)}afterBufferFlushed(e,t,s){if(!e)return;const n=De.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,n,s),this.state===F.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=F.IDLE}resetStartWhenNotLoaded(e){if(!this.loadedmetadata){this.startFragRequested=!1;const t=this.levels?this.levels[e].details:null;t!=null&&t.live?(this.startPosition=-1,this.setStartPosition(t,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){var t;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((t=this.levelLastLoaded)!=null?t:e.level),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,s,n){var r;const o=s.details;if(!o){this.warn("level.details undefined");return}if(Object.keys(e.elementaryStreams).reduce((l,c)=>{const u=e.elementaryStreams[c];if(u){const f=u.endPTS-u.startPTS;if(f<=0)return this.warn(`Could not parse fragment ${e.sn} ${c} duration reliably (${f})`),l||!1;const h=n?0:yu(o,e,u.startPTS,u.endPTS,u.startDTS,u.endDTS);return this.hls.trigger(p.LEVEL_PTS_UPDATED,{details:o,level:s,drift:h,type:c,frag:e,start:u.startPTS,end:u.endPTS}),!0}return l},!1))s.fragmentError=0;else if(((r=this.transmuxer)==null?void 0:r.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(s.fragmentError===0&&(s.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)),this.warn(l.message),this.hls.trigger(p.ERROR,{type:se.MEDIA_ERROR,details:D.FRAG_PARSING_ERROR,fatal:!1,error:l,frag:e,reason:`Found no media in msn ${e.sn} of level "${s.url}"`}),!this.hls)return;this.resetTransmuxer()}this.state=F.PARSED,this.hls.trigger(p.FRAG_PARSED,{frag:e,part:t})}resetTransmuxer(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)}recoverWorkerError(e){if(e.event==="demuxerWorker"){var t,s,n;this.fragmentTracker.removeAllFragments(),this.resetTransmuxer(),this.resetStartWhenNotLoaded((t=(s=this.levelLastLoaded)!=null?s:(n=this.fragCurrent)==null?void 0:n.level)!=null?t:0),this.resetLoadingState()}}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}function vu(){return self.SourceBuffer||self.WebKitSourceBuffer}function wp(){const i=En();if(!i)return!1;const e=vu(),t=i&&typeof i.isTypeSupported=="function"&&i.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),s=!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function";return!!t&&!!s}function _p(){var i;const e=vu();return typeof(e==null||(i=e.prototype)==null?void 0:i.changeType)=="function"}function Pp(){return typeof __HLS_WORKER_BUNDLE__=="function"}function kp(){const i=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(i);return{worker:new self.Worker(e),objectURL:e}}function Op(i){const e=new self.URL(i,self.location.href).href;return{worker:new self.Worker(e),scriptURL:e}}function Rt(i="",e=9e4){return{type:i,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class Ru{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,s,n){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,s){}demux(e,t){this.cachedData&&(e=cs(this.cachedData,e),this.cachedData=null);let s=Hi(e,0),n=s?s.length:0,r;const o=this._audioTrack,a=this._id3Track,l=s?pm(s):void 0,c=e.length;for((this.basePTS===null||this.frameIndex===0&&J(l))&&(this.basePTS=Fp(l,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),s&&s.length>0&&a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:s,type:ft.audioId3,duration:Number.POSITIVE_INFINITY});n<c;){if(this.canParse(e,n)){const u=this.appendFrame(o,e,n);u?(this.frameIndex++,this.lastPTS=u.sample.pts,n+=u.length,r=n):n=c}else mm(e,n)?(s=Hi(e,n),a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:s,type:ft.audioId3,duration:Number.POSITIVE_INFINITY}),n+=s.length,r=n):n++;if(n===c&&r!==c){const u=as(e,r);this.cachedData?this.cachedData=cs(this.cachedData,u):this.cachedData=u}}return{audioTrack:o,videoTrack:Rt(),id3Track:a,textTrack:Rt()}}demuxSampleAes(e,t,s){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:Rt(),id3Track:this._id3Track,textTrack:Rt()}}destroy(){}}const Fp=(i,e,t)=>{if(J(i))return i*90;const s=t?t.baseTime*9e4/t.timescale:0;return e*9e4+s};function Np(i,e,t,s){let n,r,o,a;const l=navigator.userAgent.toLowerCase(),c=s,u=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];n=((e[t+2]&192)>>>6)+1;const f=(e[t+2]&60)>>>2;if(f>u.length-1){i.trigger(p.ERROR,{type:se.MEDIA_ERROR,details:D.FRAG_PARSING_ERROR,fatal:!0,reason:`invalid ADTS sampling index:${f}`});return}return o=(e[t+2]&1)<<2,o|=(e[t+3]&192)>>>6,v.log(`manifest codec:${s}, ADTS type:${n}, samplingIndex:${f}`),/firefox/i.test(l)?f>=6?(n=5,a=new Array(4),r=f-3):(n=2,a=new Array(2),r=f):l.indexOf("android")!==-1?(n=2,a=new Array(2),r=f):(n=5,a=new Array(4),s&&(s.indexOf("mp4a.40.29")!==-1||s.indexOf("mp4a.40.5")!==-1)||!s&&f>=6?r=f-3:((s&&s.indexOf("mp4a.40.2")!==-1&&(f>=6&&o===1||/vivaldi/i.test(l))||!s&&o===1)&&(n=2,a=new Array(2)),r=f)),a[0]=n<<3,a[0]|=(f&14)>>1,a[1]|=(f&1)<<7,a[1]|=o<<3,n===5&&(a[1]|=(r&14)>>1,a[2]=(r&1)<<7,a[2]|=8,a[3]=0),{config:a,samplerate:u[f],channelCount:o,codec:"mp4a.40."+n,manifestCodec:c}}function Lu(i,e){return i[e]===255&&(i[e+1]&246)===240}function bu(i,e){return i[e+1]&1?7:9}function yo(i,e){return(i[e+3]&3)<<11|i[e+4]<<3|(i[e+5]&224)>>>5}function Mp(i,e){return e+5<i.length}function qi(i,e){return e+1<i.length&&Lu(i,e)}function Up(i,e){return Mp(i,e)&&Lu(i,e)&&yo(i,e)<=i.length-e}function Bp(i,e){if(qi(i,e)){const t=bu(i,e);if(e+t>=i.length)return!1;const s=yo(i,e);if(s<=t)return!1;const n=e+s;return n===i.length||qi(i,n)}return!1}function Iu(i,e,t,s,n){if(!i.samplerate){const r=Np(e,t,s,n);if(!r)return;i.config=r.config,i.samplerate=r.samplerate,i.channelCount=r.channelCount,i.codec=r.codec,i.manifestCodec=r.manifestCodec,v.log(`parsed codec:${i.codec}, rate:${r.samplerate}, channels:${r.channelCount}`)}}function Du(i){return 1024*9e4/i}function $p(i,e){const t=bu(i,e);if(e+t<=i.length){const s=yo(i,e)-t;if(s>0)return{headerLength:t,frameLength:s}}}function Cu(i,e,t,s,n){const r=Du(i.samplerate),o=s+n*r,a=$p(e,t);let l;if(a){const{frameLength:f,headerLength:h}=a,d=h+f,g=Math.max(0,t+d-e.length);g?(l=new Uint8Array(d-h),l.set(e.subarray(t+h,e.length),0)):l=e.subarray(t+h,t+d);const m={unit:l,pts:o};return g||i.samples.push(m),{sample:m,length:d,missing:g}}const c=e.length-t;return l=new Uint8Array(c),l.set(e.subarray(t,e.length),0),{sample:{unit:l,pts:o},length:c,missing:-1}}class Gp extends Ru{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,s,n){super.resetInitSegment(e,t,s,n),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:n,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;let s=(Hi(e,0)||[]).length;for(let n=e.length;s<n;s++)if(Bp(e,s))return v.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return Up(e,t)}appendFrame(e,t,s){Iu(e,this.observer,t,s,e.manifestCodec);const n=Cu(e,t,s,this.basePTS,this.frameIndex);if(n&&n.missing===0)return n}}const Kp=/\/emsg[-/]ID3/i;class Hp{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,s,n){const r=this.videoTrack=Rt("video",1),o=this.audioTrack=Rt("audio",1),a=this.txtTrack=Rt("text",1);if(this.id3Track=Rt("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const l=uu(e);if(l.video){const{id:c,timescale:u,codec:f}=l.video;r.id=c,r.timescale=a.timescale=u,r.codec=f}if(l.audio){const{id:c,timescale:u,codec:f}=l.audio;o.id=c,o.timescale=u,o.codec=f}a.id=au.text,r.sampleDuration=0,r.duration=o.duration=n}resetContiguity(){this.remainderData=null}static probe(e){return e=e.length>16384?e.subarray(0,16384):e,pe(e,["moof"]).length>0}demux(e,t){this.timeOffset=t;let s=e;const n=this.videoTrack,r=this.txtTrack;if(this.config.progressive){this.remainderData&&(s=cs(this.remainderData,e));const a=_m(s);this.remainderData=a.remainder,n.samples=a.valid||new Uint8Array}else n.samples=s;const o=this.extractID3Track(n,t);return r.samples=Fa(t,n),{videoTrack:n,audioTrack:this.audioTrack,id3Track:o,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,s=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const n=this.extractID3Track(t,this.timeOffset);return s.samples=Fa(e,t),{videoTrack:t,audioTrack:Rt(),id3Track:n,textTrack:Rt()}}extractID3Track(e,t){const s=this.id3Track;if(e.samples.length){const n=pe(e.samples,["emsg"]);n&&n.forEach(r=>{const o=Om(r);if(Kp.test(o.schemeIdUri)){const a=J(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 c=o.payload;s.samples.push({data:c,len:c.byteLength,dts:a,pts:a,type:ft.emsg,duration:l})}})}return s}demuxSampleAes(e,t,s){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){}}let Ei=null;const Vp=[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],Wp=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Yp=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],jp=[0,1,1,4];function wu(i,e,t,s,n){if(t+24>e.length)return;const r=_u(e,t);if(r&&t+r.frameLength<=e.length){const o=r.samplesPerFrame*9e4/r.sampleRate,a=s+n*o,l={unit:e.subarray(t,t+r.frameLength),pts:a,dts:a};return i.config=[],i.channelCount=r.channelCount,i.samplerate=r.sampleRate,i.samples.push(l),{sample:l,length:r.frameLength,missing:0}}}function _u(i,e){const t=i[e+1]>>3&3,s=i[e+1]>>1&3,n=i[e+2]>>4&15,r=i[e+2]>>2&3;if(t!==1&&n!==0&&n!==15&&r!==3){const o=i[e+2]>>1&1,a=i[e+3]>>6,l=t===3?3-s:s===3?3:4,c=Vp[l*14+n-1]*1e3,f=Wp[(t===3?0:t===2?1:2)*3+r],h=a===3?1:2,d=Yp[t][s],g=jp[s],m=d*8*g,y=Math.floor(d*c/f+o)*g;if(Ei===null){const S=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Ei=S?parseInt(S[1]):0}return!!Ei&&Ei<=87&&s===2&&c>=224e3&&a===0&&(i[e+3]=i[e+3]|128),{sampleRate:f,channelCount:h,frameLength:y,samplesPerFrame:m}}}function To(i,e){return i[e]===255&&(i[e+1]&224)===224&&(i[e+1]&6)!==0}function Pu(i,e){return e+1<i.length&&To(i,e)}function qp(i,e){return To(i,e)&&4<=i.length-e}function zp(i,e){if(e+1<i.length&&To(i,e)){const s=_u(i,e);let n=4;s!=null&&s.frameLength&&(n=s.frameLength);const r=e+n;return r===i.length||Pu(i,r)}return!1}class nl{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,s=e.byteLength-t,n=new Uint8Array(4),r=Math.min(4,t);if(r===0)throw new Error("no bytes available");n.set(e.subarray(s,s+r)),this.word=new DataView(n.buffer).getUint32(0),this.bitsAvailable=r*8,this.bytesAvailable-=r}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 s=this.word>>>32-t;if(e>32&&v.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?s<<t|this.readBits(t):s}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,s=8,n;for(let r=0;r<e;r++)s!==0&&(n=this.readEG(),s=(t+n+256)%256),t=s===0?t:s}readSPS(){let e=0,t=0,s=0,n=0,r,o,a;const l=this.readUByte.bind(this),c=this.readBits.bind(this),u=this.readUEG.bind(this),f=this.readBoolean.bind(this),h=this.skipBits.bind(this),d=this.skipEG.bind(this),g=this.skipUEG.bind(this),m=this.skipScalingList.bind(this);l();const y=l();if(c(5),h(3),l(),g(),y===100||y===110||y===122||y===244||y===44||y===83||y===86||y===118||y===128){const M=u();if(M===3&&h(1),g(),g(),h(1),f())for(o=M!==3?8:12,a=0;a<o;a++)f()&&(a<6?m(16):m(64))}g();const T=u();if(T===0)u();else if(T===1)for(h(1),d(),d(),r=u(),a=0;a<r;a++)d();g(),h(1);const x=u(),S=u(),R=c(1);R===0&&h(1),h(1),f()&&(e=u(),t=u(),s=u(),n=u());let b=[1,1];if(f()&&f())switch(l()){case 1:b=[1,1];break;case 2:b=[12,11];break;case 3:b=[10,11];break;case 4:b=[16,11];break;case 5:b=[40,33];break;case 6:b=[24,11];break;case 7:b=[20,11];break;case 8:b=[32,11];break;case 9:b=[80,33];break;case 10:b=[18,11];break;case 11:b=[15,11];break;case 12:b=[64,33];break;case 13:b=[160,99];break;case 14:b=[4,3];break;case 15:b=[3,2];break;case 16:b=[2,1];break;case 255:{b=[l()<<8|l(),l()<<8|l()];break}}return{width:Math.ceil((x+1)*16-e*2-t*2),height:(2-R)*(S+1)*16-(R?2:4)*(s+n),pixelRatio:b}}readSliceType(){return this.readUByte(),this.readUEG(),this.readUEG()}}class Xp{constructor(e,t,s){this.keyData=void 0,this.decrypter=void 0,this.keyData=s,this.decrypter=new mo(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer)}decryptAacSample(e,t,s){const n=e[t].unit;if(n.length<=16)return;const r=n.subarray(16,n.length-n.length%16),o=r.buffer.slice(r.byteOffset,r.byteOffset+r.length);this.decryptBuffer(o).then(a=>{const l=new Uint8Array(a);n.set(l,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,s)})}decryptAacSamples(e,t,s){for(;;t++){if(t>=e.length){s();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,s),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,s=new Int8Array(t);let n=0;for(let r=32;r<e.length-16;r+=160,n+=16)s.set(e.subarray(r,r+16),n);return s}getAvcDecryptedUnit(e,t){const s=new Uint8Array(t);let n=0;for(let r=32;r<e.length-16;r+=160,n+=16)e.set(s.subarray(n,n+16),r);return e}decryptAvcSample(e,t,s,n,r){const o=du(r.data),a=this.getAvcEncryptedData(o);this.decryptBuffer(a.buffer).then(l=>{r.data=this.getAvcDecryptedUnit(o,l),this.decrypter.isSync()||this.decryptAvcSamples(e,t,s+1,n)})}decryptAvcSamples(e,t,s,n){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,s=0){if(t>=e.length){n();return}const r=e[t].units;for(;!(s>=r.length);s++){const o=r[s];if(!(o.data.length<=48||o.type!==1&&o.type!==5)&&(this.decryptAvcSample(e,t,s,n,o),!this.decrypter.isSync()))return}}}}const Ve=188;class Yt{constructor(e,t,s){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._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=e,this.config=t,this.typeSupported=s}static probe(e){const t=Yt.syncOffset(e);return t>0&&v.warn(`MPEG2-TS detected but first sync word found @ offset ${t}`),t!==-1}static syncOffset(e){const t=e.length;let s=Math.min(Ve*5,e.length-Ve)+1,n=0;for(;n<s;){let r=!1,o=-1,a=0;for(let l=n;l<t;l+=Ve)if(e[l]===71){if(a++,o===-1&&(o=l,o!==0&&(s=Math.min(o+Ve*99,e.length-Ve)+1)),r||(r=wr(e,l)===0),r&&a>1&&(o===0&&a>2||l+Ve>s))return o}else{if(a)return-1;break}n++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:au[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,s,n){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=Yt.createTrack("video"),this._audioTrack=Yt.createTrack("audio",n),this._id3Track=Yt.createTrack("id3"),this._txtTrack=Yt.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=s,this._duration=n}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_avcTrack:t,_id3Track:s}=this;e&&(e.pesData=null),t&&(t.pesData=null),s&&(s.pesData=null),this.aacOverFlow=null,this.avcSample=null,this.remainderData=null}demux(e,t,s=!1,n=!1){s||(this.sampleAes=null);let r;const o=this._avcTrack,a=this._audioTrack,l=this._id3Track,c=this._txtTrack;let u=o.pid,f=o.pesData,h=a.pid,d=l.pid,g=a.pesData,m=l.pesData,y=null,T=this.pmtParsed,x=this._pmtId,S=e.length;if(this.remainderData&&(e=cs(this.remainderData,e),S=e.length,this.remainderData=null),S<Ve&&!n)return this.remainderData=e,{audioTrack:a,videoTrack:o,id3Track:l,textTrack:c};const R=Math.max(0,Yt.syncOffset(e));S-=(S-R)%Ve,S<e.byteLength&&!n&&(this.remainderData=new Uint8Array(e.buffer,S,e.buffer.byteLength-S));let b=0;for(let P=R;P<S;P+=Ve)if(e[P]===71){const B=!!(e[P+1]&64),K=wr(e,P),C=(e[P+3]&48)>>4;let q;if(C>1){if(q=P+5+e[P+4],q===P+Ve)continue}else q=P+4;switch(K){case u:B&&(f&&(r=ds(f))&&this.parseAVCPES(o,c,r,!1),f={data:[],size:0}),f&&(f.data.push(e.subarray(q,P+Ve)),f.size+=P+Ve-q);break;case h:if(B){if(g&&(r=ds(g)))switch(a.segmentCodec){case"aac":this.parseAACPES(a,r);break;case"mp3":this.parseMPEGPES(a,r);break}g={data:[],size:0}}g&&(g.data.push(e.subarray(q,P+Ve)),g.size+=P+Ve-q);break;case d:B&&(m&&(r=ds(m))&&this.parseID3PES(l,r),m={data:[],size:0}),m&&(m.data.push(e.subarray(q,P+Ve)),m.size+=P+Ve-q);break;case 0:B&&(q+=e[q]+1),x=this._pmtId=Qp(e,q);break;case x:{B&&(q+=e[q]+1);const W=Jp(e,q,this.typeSupported,s);u=W.avc,u>0&&(o.pid=u),h=W.audio,h>0&&(a.pid=h,a.segmentCodec=W.segmentCodec),d=W.id3,d>0&&(l.pid=d),y!==null&&!T&&(v.warn(`MPEG-TS PMT found at ${P} after unknown PID '${y}'. Backtracking to sync byte @${R} to parse all TS packets.`),y=null,P=R-188),T=this.pmtParsed=!0;break}case 17:case 8191:break;default:y=K;break}}else b++;if(b>0){const P=new Error(`Found ${b} TS packet/s that do not start with 0x47`);this.observer.emit(p.ERROR,p.ERROR,{type:se.MEDIA_ERROR,details:D.FRAG_PARSING_ERROR,fatal:!1,error:P,reason:P.message})}o.pesData=f,a.pesData=g,l.pesData=m;const M={audioTrack:a,videoTrack:o,id3Track:l,textTrack:c};return n&&this.extractRemainingSamples(M),M}flush(){const{remainderData:e}=this;this.remainderData=null;let t;return e?t=this.demux(e,-1,!1,!0):t={videoTrack:this._avcTrack,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:s,id3Track:n,textTrack:r}=e,o=s.pesData,a=t.pesData,l=n.pesData;let c;if(o&&(c=ds(o))?(this.parseAVCPES(s,r,c,!0),s.pesData=null):s.pesData=o,a&&(c=ds(a))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,c);break;case"mp3":this.parseMPEGPES(t,c);break}t.pesData=null}else a!=null&&a.size&&v.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=a;l&&(c=ds(l))?(this.parseID3PES(n,c),n.pesData=null):n.pesData=l}demuxSampleAes(e,t,s){const n=this.demux(e,s,!0,!this.config.progressive),r=this.sampleAes=new Xp(this.observer,this.config,t);return this.decrypt(n,r)}decrypt(e,t){return new Promise(s=>{const{audioTrack:n,videoTrack:r}=e;n.samples&&n.segmentCodec==="aac"?t.decryptAacSamples(n.samples,0,()=>{r.samples?t.decryptAvcSamples(r.samples,0,0,()=>{s(e)}):s(e)}):r.samples&&t.decryptAvcSamples(r.samples,0,0,()=>{s(e)})})}destroy(){this._duration=0}parseAVCPES(e,t,s,n){const r=this.parseAVCNALu(e,s.data);let o=this.avcSample,a,l=!1;s.data=null,o&&r.length&&!e.audFound&&(Bs(o,e),o=this.avcSample=xi(!1,s.pts,s.dts,"")),r.forEach(c=>{var u;switch(c.type){case 1:{let h=!1;a=!0;const d=c.data;if(l&&d.length>4){const g=new nl(d).readSliceType();(g===2||g===4||g===7||g===9)&&(h=!0)}if(h){var f;(f=o)!=null&&f.frame&&!o.key&&(Bs(o,e),o=this.avcSample=null)}o||(o=this.avcSample=xi(!0,s.pts,s.dts,"")),o.frame=!0,o.key=h;break}case 5:a=!0,(u=o)!=null&&u.frame&&!o.key&&(Bs(o,e),o=this.avcSample=null),o||(o=this.avcSample=xi(!0,s.pts,s.dts,"")),o.key=!0,o.frame=!0;break;case 6:{a=!0,hu(c.data,1,s.pts,t.samples);break}case 7:if(a=!0,l=!0,!e.sps){const h=c.data,g=new nl(h).readSPS();e.width=g.width,e.height=g.height,e.pixelRatio=g.pixelRatio,e.sps=[h],e.duration=this._duration;const m=h.subarray(1,4);let y="avc1.";for(let T=0;T<3;T++){let x=m[T].toString(16);x.length<2&&(x="0"+x),y+=x}e.codec=y}break;case 8:a=!0,e.pps||(e.pps=[c.data]);break;case 9:a=!1,e.audFound=!0,o&&Bs(o,e),o=this.avcSample=xi(!1,s.pts,s.dts,"");break;case 12:a=!0;break;default:a=!1,o&&(o.debug+="unknown NAL "+c.type+" ");break}o&&a&&o.units.push(c)}),n&&o&&(Bs(o,e),this.avcSample=null)}getLastNalUnit(e){var t;let s=this.avcSample,n;if((!s||s.units.length===0)&&(s=e[e.length-1]),(t=s)!=null&&t.units){const r=s.units;n=r[r.length-1]}return n}parseAVCNALu(e,t){const s=t.byteLength;let n=e.naluState||0;const r=n,o=[];let a=0,l,c,u,f=-1,h=0;for(n===-1&&(f=0,h=t[0]&31,n=0,a=1);a<s;){if(l=t[a++],!n){n=l?0:1;continue}if(n===1){n=l?0:2;continue}if(!l)n=3;else if(l===1){if(f>=0){const d={data:t.subarray(f,a-n-1),type:h};o.push(d)}else{const d=this.getLastNalUnit(e.samples);if(d&&(r&&a<=4-r&&d.state&&(d.data=d.data.subarray(0,d.data.byteLength-r)),c=a-n-1,c>0)){const g=new Uint8Array(d.data.byteLength+c);g.set(d.data,0),g.set(t.subarray(0,c),d.data.byteLength),d.data=g,d.state=0}}a<s?(u=t[a]&31,f=a,h=u,n=0):n=-1}else n=0}if(f>=0&&n>=0){const d={data:t.subarray(f,s),type:h,state:n};o.push(d)}if(o.length===0){const d=this.getLastNalUnit(e.samples);if(d){const g=new Uint8Array(d.data.byteLength+t.byteLength);g.set(d.data,0),g.set(t,d.data.byteLength),d.data=g}}return e.naluState=n,o}parseAACPES(e,t){let s=0;const n=this.aacOverFlow;let r=t.data;if(n){this.aacOverFlow=null;const f=n.missing,h=n.sample.unit.byteLength;if(f===-1){const d=new Uint8Array(h+r.byteLength);d.set(n.sample.unit,0),d.set(r,h),r=d}else{const d=h-f;n.sample.unit.set(r.subarray(0,f),d),e.samples.push(n.sample),s=n.missing}}let o,a;for(o=s,a=r.length;o<a-1&&!qi(r,o);o++);if(o!==s){let f;const h=o<a-1;h?f=`AAC PES did not start with ADTS header,offset:${o}`:f="No ADTS header found in AAC PES";const d=new Error(f);if(v.warn(`parsing error: ${f}`),this.observer.emit(p.ERROR,p.ERROR,{type:se.MEDIA_ERROR,details:D.FRAG_PARSING_ERROR,fatal:!1,levelRetry:h,error:d,reason:f}),!h)return}Iu(e,this.observer,r,o,this.audioCodec);let l;if(t.pts!==void 0)l=t.pts;else if(n){const f=Du(e.samplerate);l=n.sample.pts+f}else{v.warn("[tsdemuxer]: AAC PES unknown PTS");return}let c=0,u;for(;o<a;)if(u=Cu(e,r,o,l,c),o+=u.length,u.missing){this.aacOverFlow=u;break}else for(c++;o<a-1&&!qi(r,o);o++);}parseMPEGPES(e,t){const s=t.data,n=s.length;let r=0,o=0;const a=t.pts;if(a===void 0){v.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;o<n;)if(Pu(s,o)){const l=wu(e,s,o,a,r);if(l)o+=l.length,r++;else break}else o++}parseID3PES(e,t){if(t.pts===void 0){v.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const s=Me({},t,{type:this._avcTrack?ft.emsg:ft.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(s)}}function xi(i,e,t,s){return{key:i,frame:!1,pts:e,dts:t,units:[],debug:s,length:0}}function wr(i,e){return((i[e+1]&31)<<8)+i[e+2]}function Qp(i,e){return(i[e+10]&31)<<8|i[e+11]}function Jp(i,e,t,s){const n={audio:-1,avc:-1,id3:-1,segmentCodec:"aac"},r=(i[e+1]&15)<<8|i[e+2],o=e+3+r-4,a=(i[e+10]&15)<<8|i[e+11];for(e+=12+a;e<o;){const l=wr(i,e);switch(i[e]){case 207:if(!s){v.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:n.audio===-1&&(n.audio=l);break;case 21:n.id3===-1&&(n.id3=l);break;case 219:if(!s){v.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:n.avc===-1&&(n.avc=l);break;case 3:case 4:t.mpeg!==!0&&t.mp3!==!0?v.log("MPEG audio found, not supported in this browser"):n.audio===-1&&(n.audio=l,n.segmentCodec="mp3");break;case 36:v.warn("Unsupported HEVC stream type found");break}e+=((i[e+3]&15)<<8|i[e+4])+5}return n}function ds(i){let e=0,t,s,n,r,o;const a=i.data;if(!i||i.size===0)return null;for(;a[0].length<19&&a.length>1;){const c=new Uint8Array(a[0].length+a[1].length);c.set(a[0]),c.set(a[1],a[0].length),a[0]=c,a.splice(1,1)}if(t=a[0],(t[0]<<16)+(t[1]<<8)+t[2]===1){if(s=(t[4]<<8)+t[5],s&&s>i.size-6)return null;const c=t[7];c&192&&(r=(t[9]&14)*536870912+(t[10]&255)*4194304+(t[11]&254)*16384+(t[12]&255)*128+(t[13]&254)/2,c&64?(o=(t[14]&14)*536870912+(t[15]&255)*4194304+(t[16]&254)*16384+(t[17]&255)*128+(t[18]&254)/2,r-o>60*9e4&&(v.warn(`${Math.round((r-o)/9e4)}s delta between PTS and DTS, align them`),r=o)):o=r),n=t[8];let u=n+9;if(i.size<=u)return null;i.size-=u;const f=new Uint8Array(i.size);for(let h=0,d=a.length;h<d;h++){t=a[h];let g=t.byteLength;if(u)if(u>g){u-=g;continue}else t=t.subarray(u),g-=u,u=0;f.set(t,e),e+=g}return s&&(s-=n+3),{data:f,pts:r,dts:o,len:s}}return null}function Bs(i,e){if(i.units.length&&i.frame){if(i.pts===void 0){const t=e.samples,s=t.length;if(s){const n=t[s-1];i.pts=n.pts,i.dts=n.dts}else{e.dropped++;return}}e.samples.push(i)}i.debug.length&&v.log(i.pts+"/"+i.dts+":"+i.debug)}class Zp extends Ru{resetInitSegment(e,t,s,n){super.resetInitSegment(e,t,s,n),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:n,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;let s=(Hi(e,0)||[]).length;for(let n=e.length;s<n;s++)if(zp(e,s))return v.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return qp(e,t)}appendFrame(e,t,s){if(this.basePTS!==null)return wu(e,t,s,this.basePTS,this.frameIndex)}}class rl{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 Ht=Math.pow(2,32)-1;class I{static init(){I.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};let e;for(e in I.types)I.types.hasOwnProperty(e)&&(I.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]),s=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]);I.HDLR_TYPES={video:t,audio:s};const n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),r=new Uint8Array([0,0,0,0,0,0,0,0]);I.STTS=I.STSC=I.STCO=r,I.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),I.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),I.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),I.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]);I.FTYP=I.box(I.types.ftyp,o,l,o,a),I.DINF=I.box(I.types.dinf,I.box(I.types.dref,n))}static box(e,...t){let s=8,n=t.length;const r=n;for(;n--;)s+=t[n].byteLength;const o=new Uint8Array(s);for(o[0]=s>>24&255,o[1]=s>>16&255,o[2]=s>>8&255,o[3]=s&255,o.set(e,4),n=0,s=8;n<r;n++)o.set(t[n],s),s+=t[n].byteLength;return o}static hdlr(e){return I.box(I.types.hdlr,I.HDLR_TYPES[e])}static mdat(e){return I.box(I.types.mdat,e)}static mdhd(e,t){t*=e;const s=Math.floor(t/(Ht+1)),n=Math.floor(t%(Ht+1));return I.box(I.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,s>>24,s>>16&255,s>>8&255,s&255,n>>24,n>>16&255,n>>8&255,n&255,85,196,0,0]))}static mdia(e){return I.box(I.types.mdia,I.mdhd(e.timescale,e.duration),I.hdlr(e.type),I.minf(e))}static mfhd(e){return I.box(I.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"?I.box(I.types.minf,I.box(I.types.smhd,I.SMHD),I.DINF,I.stbl(e)):I.box(I.types.minf,I.box(I.types.vmhd,I.VMHD),I.DINF,I.stbl(e))}static moof(e,t,s){return I.box(I.types.moof,I.mfhd(e),I.traf(s,t))}static moov(e){let t=e.length;const s=[];for(;t--;)s[t]=I.trak(e[t]);return I.box.apply(null,[I.types.moov,I.mvhd(e[0].timescale,e[0].duration)].concat(s).concat(I.mvex(e)))}static mvex(e){let t=e.length;const s=[];for(;t--;)s[t]=I.trex(e[t]);return I.box.apply(null,[I.types.mvex,...s])}static mvhd(e,t){t*=e;const s=Math.floor(t/(Ht+1)),n=Math.floor(t%(Ht+1)),r=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,s>>24,s>>16&255,s>>8&255,s&255,n>>24,n>>16&255,n>>8&255,n&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 I.box(I.types.mvhd,r)}static sdtp(e){const t=e.samples||[],s=new Uint8Array(4+t.length);let n,r;for(n=0;n<t.length;n++)r=t[n].flags,s[n+4]=r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy;return I.box(I.types.sdtp,s)}static stbl(e){return I.box(I.types.stbl,I.stsd(e),I.box(I.types.stts,I.STTS),I.box(I.types.stsc,I.STSC),I.box(I.types.stsz,I.STSZ),I.box(I.types.stco,I.STCO))}static avc1(e){let t=[],s=[],n,r,o;for(n=0;n<e.sps.length;n++)r=e.sps[n],o=r.byteLength,t.push(o>>>8&255),t.push(o&255),t=t.concat(Array.prototype.slice.call(r));for(n=0;n<e.pps.length;n++)r=e.pps[n],o=r.byteLength,s.push(o>>>8&255),s.push(o&255),s=s.concat(Array.prototype.slice.call(r));const a=I.box(I.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(s))),l=e.width,c=e.height,u=e.pixelRatio[0],f=e.pixelRatio[1];return I.box(I.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,c>>8&255,c&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,I.box(I.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),I.box(I.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,u&255,f>>24,f>>16&255,f>>8&255,f&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 mp4a(e){const t=e.samplerate;return I.box(I.types.mp4a,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]),I.box(I.types.esds,I.esds(e)))}static mp3(e){const t=e.samplerate;return I.box(I.types[".mp3"],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 stsd(e){return e.type==="audio"?e.segmentCodec==="mp3"&&e.codec==="mp3"?I.box(I.types.stsd,I.STSD,I.mp3(e)):I.box(I.types.stsd,I.STSD,I.mp4a(e)):I.box(I.types.stsd,I.STSD,I.avc1(e))}static tkhd(e){const t=e.id,s=e.duration*e.timescale,n=e.width,r=e.height,o=Math.floor(s/(Ht+1)),a=Math.floor(s%(Ht+1));return I.box(I.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,n>>8&255,n&255,0,0,r>>8&255,r&255,0,0]))}static traf(e,t){const s=I.sdtp(e),n=e.id,r=Math.floor(t/(Ht+1)),o=Math.floor(t%(Ht+1));return I.box(I.types.traf,I.box(I.types.tfhd,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,n&255])),I.box(I.types.tfdt,new Uint8Array([1,0,0,0,r>>24,r>>16&255,r>>8&255,r&255,o>>24,o>>16&255,o>>8&255,o&255])),I.trun(e,s.length+16+20+8+16+8+8),s)}static trak(e){return e.duration=e.duration||4294967295,I.box(I.types.trak,I.tkhd(e),I.mdia(e))}static trex(e){const t=e.id;return I.box(I.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 s=e.samples||[],n=s.length,r=12+16*n,o=new Uint8Array(r);let a,l,c,u,f,h;for(t+=8+r,o.set([e.type==="video"?1:0,0,15,1,n>>>24&255,n>>>16&255,n>>>8&255,n&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),a=0;a<n;a++)l=s[a],c=l.duration,u=l.size,f=l.flags,h=l.cts,o.set([c>>>24&255,c>>>16&255,c>>>8&255,c&255,u>>>24&255,u>>>16&255,u>>>8&255,u&255,f.isLeading<<2|f.dependsOn,f.isDependedOn<<6|f.hasRedundancy<<4|f.paddingValue<<1|f.isNonSync,f.degradPrio&61440,f.degradPrio&15,h>>>24&255,h>>>16&255,h>>>8&255,h&255],12+16*a);return I.box(I.types.trun,o)}static initSegment(e){I.types||I.init();const t=I.moov(e),s=new Uint8Array(I.FTYP.byteLength+t.byteLength);return s.set(I.FTYP),s.set(t,I.FTYP.byteLength),s}}I.types=void 0;I.HDLR_TYPES=void 0;I.STTS=void 0;I.STSC=void 0;I.STCO=void 0;I.STSZ=void 0;I.VMHD=void 0;I.SMHD=void 0;I.STSD=void 0;I.FTYP=void 0;I.DINF=void 0;const ku=9e4;function Eo(i,e,t=1,s=!1){const n=i*e*t;return s?Math.round(n):n}function ey(i,e,t=1,s=!1){return Eo(i,e,1/t,s)}function $s(i,e=!1){return Eo(i,1e3,1/ku,e)}function ty(i,e=1){return Eo(i,ku,1/e)}const sy=10*1e3,ol=1024,iy=1152;let Ai=null,Hn=null;class Vn{constructor(e,t,s,n=""){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.observer=e,this.config=t,this.typeSupported=s,this.ISGenerated=!1,Ai===null){const o=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Ai=o?parseInt(o[1]):0}if(Hn===null){const r=navigator.userAgent.match(/Safari\/(\d+)/i);Hn=r?parseInt(r[1]):0}}destroy(){}resetTimeStamp(e){v.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){v.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){v.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1}getVideoStartPts(e){let t=!1;const s=e.reduce((n,r)=>{const o=r.pts-n;return o<-4294967296?(t=!0,rt(n,r.pts)):o>0?n:r.pts},e[0].pts);return t&&v.debug("PTS rollover detected"),s}remux(e,t,s,n,r,o,a,l){let c,u,f,h,d,g,m=r,y=r;const T=e.pid>-1,x=t.pid>-1,S=t.samples.length,R=e.samples.length>0,b=a&&S>0||S>1;if((!T||R)&&(!x||b)||this.ISGenerated||a){this.ISGenerated||(f=this.generateIS(e,t,r,o));const P=this.isVideoContiguous;let B=-1,K;if(b&&(B=ny(t.samples),!P&&this.config.forceKeyFrameOnDiscontinuity))if(g=!0,B>0){v.warn(`[mp4-remuxer]: Dropped ${B} out of ${S} video samples due to a missing keyframe`);const C=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(B),t.dropped+=B,y+=(t.samples[0].pts-C)/t.inputTimeScale,K=y}else B===-1&&(v.warn(`[mp4-remuxer]: No keyframe found out of ${S} video samples`),g=!1);if(this.ISGenerated){if(R&&b){const C=this.getVideoStartPts(t.samples),W=(rt(e.samples[0].pts,C)-C)/t.inputTimeScale;m+=Math.max(0,W),y+=Math.max(0,-W)}if(R){if(e.samplerate||(v.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),f=this.generateIS(e,t,r,o)),u=this.remuxAudio(e,m,this.isAudioContiguous,o,x||b||l===ie.AUDIO?y:void 0),b){const C=u?u.endPTS-u.startPTS:0;t.inputTimeScale||(v.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),f=this.generateIS(e,t,r,o)),c=this.remuxVideo(t,y,P,C)}}else b&&(c=this.remuxVideo(t,y,P,0));c&&(c.firstKeyFrame=B,c.independent=B!==-1,c.firstKeyFramePTS=K)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(s.samples.length&&(d=Ou(s,r,this._initPTS,this._initDTS)),n.samples.length&&(h=Fu(n,r,this._initPTS))),{audio:u,video:c,initSegment:f,independent:g,text:h,id3:d}}generateIS(e,t,s,n){const r=e.samples,o=t.samples,a=this.typeSupported,l={},c=this._initPTS;let u=!c||n,f="audio/mp4",h,d,g;if(u&&(h=d=1/0),e.config&&r.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":a.mpeg?(f="audio/mpeg",e.codec=""):a.mp3&&(e.codec="mp3");break}l.audio={id:"audio",container:f,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&a.mpeg?new Uint8Array(0):I.initSegment([e]),metadata:{channelCount:e.channelCount}},u&&(g=e.inputTimeScale,!c||g!==c.timescale?h=d=r[0].pts-Math.round(g*s):u=!1)}if(t.sps&&t.pps&&o.length&&(t.timescale=t.inputTimeScale,l.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:I.initSegment([t]),metadata:{width:t.width,height:t.height}},u))if(g=t.inputTimeScale,!c||g!==c.timescale){const m=this.getVideoStartPts(o),y=Math.round(g*s);d=Math.min(d,rt(o[0].dts,m)-y),h=Math.min(h,m-y)}else u=!1;if(Object.keys(l).length)return this.ISGenerated=!0,u?(this._initPTS={baseTime:h,timescale:g},this._initDTS={baseTime:d,timescale:g}):h=g=void 0,{tracks:l,initPTS:h,timescale:g}}remuxVideo(e,t,s,n){const r=e.inputTimeScale,o=e.samples,a=[],l=o.length,c=this._initPTS;let u=this.nextAvcDts,f=8,h=this.videoSampleDuration,d,g,m=Number.POSITIVE_INFINITY,y=Number.NEGATIVE_INFINITY,T=!1;if(!s||u===null){const $=t*r,z=o[0].pts-rt(o[0].dts,o[0].pts);u=$-z}const x=c.baseTime*r/c.timescale;for(let $=0;$<l;$++){const z=o[$];z.pts=rt(z.pts-x,u),z.dts=rt(z.dts-x,u),z.dts<o[$>0?$-1:$].dts&&(T=!0)}T&&o.sort(function($,z){const fe=$.dts-z.dts,he=$.pts-z.pts;return fe||he}),d=o[0].dts,g=o[o.length-1].dts;const S=g-d,R=S?Math.round(S/(l-1)):h||e.inputTimeScale/30;if(s){const $=d-u,z=$>R,fe=$<-1;if((z||fe)&&(z?v.warn(`AVC: ${$s($,!0)} ms (${$}dts) hole between fragments detected, filling it`):v.warn(`AVC: ${$s(-$,!0)} ms (${$}dts) overlapping between fragments detected`),!fe||u>=o[0].pts)){d=u;const he=o[0].pts-$;o[0].dts=d,o[0].pts=he,v.log(`Video: First PTS/DTS adjusted: ${$s(he,!0)}/${$s(d,!0)}, delta: ${$s($,!0)} ms`)}}d=Math.max(0,d);let b=0,M=0;for(let $=0;$<l;$++){const z=o[$],fe=z.units,he=fe.length;let re=0;for(let Le=0;Le<he;Le++)re+=fe[Le].data.length;M+=re,b+=he,z.length=re,z.dts=Math.max(z.dts,d),m=Math.min(z.pts,m),y=Math.max(z.pts,y)}g=o[l-1].dts;const P=M+4*b+8;let B;try{B=new Uint8Array(P)}catch($){this.observer.emit(p.ERROR,p.ERROR,{type:se.MUX_ERROR,details:D.REMUX_ALLOC_ERROR,fatal:!1,error:$,bytes:P,reason:`fail allocating video mdat ${P}`});return}const K=new DataView(B.buffer);K.setUint32(0,P),B.set(I.types.mdat,4);let C=!1,q=Number.POSITIVE_INFINITY,W=Number.POSITIVE_INFINITY,ue=Number.NEGATIVE_INFINITY,_e=Number.NEGATIVE_INFINITY;for(let $=0;$<l;$++){const z=o[$],fe=z.units;let he=0;for(let Ne=0,He=fe.length;Ne<He;Ne++){const Ae=fe[Ne],_=Ae.data,j=Ae.data.byteLength;K.setUint32(f,j),f+=4,B.set(_,f),f+=j,he+=4+j}let re;if($<l-1)h=o[$+1].dts-z.dts,re=o[$+1].pts-z.pts;else{const Ne=this.config,He=$>0?z.dts-o[$-1].dts:R;if(re=$>0?z.pts-o[$-1].pts:R,Ne.stretchShortVideoTrack&&this.nextAudioPts!==null){const Ae=Math.floor(Ne.maxBufferHole*r),_=(n?m+n*r:this.nextAudioPts)-z.pts;_>Ae?(h=_-He,h<0?h=He:C=!0,v.log(`[mp4-remuxer]: It is approximately ${_/90} ms to the next segment; using duration ${h/90} ms for the last video frame.`)):h=He}else h=He}const Le=Math.round(z.pts-z.dts);q=Math.min(q,h),ue=Math.max(ue,h),W=Math.min(W,re),_e=Math.max(_e,re),a.push(new al(z.key,h,he,Le))}if(a.length){if(Ai){if(Ai<70){const $=a[0].flags;$.dependsOn=2,$.isNonSync=0}}else if(Hn&&_e-W<ue-q&&R/ue<.025&&a[0].cts===0){v.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let $=d;for(let z=0,fe=a.length;z<fe;z++){const he=$+a[z].duration,re=$+a[z].cts;if(z<fe-1){const Le=he+a[z+1].cts;a[z].duration=Le-re}else a[z].duration=z?a[z-1].duration:R;a[z].cts=0,$=he}}}h=C||!h?R:h,this.nextAvcDts=u=g+h,this.videoSampleDuration=h,this.isVideoContiguous=!0;const Te=I.moof(e.sequenceNumber++,d,Me({},e,{samples:a})),ae="video",te={data1:Te,data2:B,startPTS:m/r,endPTS:(y+h)/r,startDTS:d/r,endDTS:u/r,type:ae,hasAudio:!1,hasVideo:!0,nb:a.length,dropped:e.dropped};return e.samples=[],e.dropped=0,te}remuxAudio(e,t,s,n,r){const o=e.inputTimeScale,a=e.samplerate?e.samplerate:o,l=o/a,c=e.segmentCodec==="aac"?ol:iy,u=c*l,f=this._initPTS,h=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,d=[],g=r!==void 0;let m=e.samples,y=h?0:8,T=this.nextAudioPts||-1;const x=t*o,S=f.baseTime*o/f.timescale;if(this.isAudioContiguous=s=s||m.length&&T>0&&(n&&Math.abs(x-T)<9e3||Math.abs(rt(m[0].pts-S,x)-T)<20*u),m.forEach(function(ae){ae.pts=rt(ae.pts-S,x)}),!s||T<0){if(m=m.filter(ae=>ae.pts>=0),!m.length)return;r===0?T=0:n&&!g?T=Math.max(0,x):T=m[0].pts}if(e.segmentCodec==="aac"){const ae=this.config.maxAudioFramesDrift;for(let te=0,$=T;te<m.length;te++){const z=m[te],fe=z.pts,he=fe-$,re=Math.abs(1e3*he/o);if(he<=-ae*u&&g)te===0&&(v.warn(`Audio frame @ ${(fe/o).toFixed(3)}s overlaps nextAudioPts by ${Math.round(1e3*he/o)} ms.`),this.nextAudioPts=T=$=fe);else if(he>=ae*u&&re<sy&&g){let Le=Math.round(he/u);$=fe-Le*u,$<0&&(Le--,$+=u),te===0&&(this.nextAudioPts=T=$),v.warn(`[mp4-remuxer]: Injecting ${Le} audio frame @ ${($/o).toFixed(3)}s due to ${Math.round(1e3*he/o)} ms gap.`);for(let Ne=0;Ne<Le;Ne++){const He=Math.max($,0);let Ae=rl.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);Ae||(v.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Ae=z.unit.subarray()),m.splice(te,0,{unit:Ae,pts:He}),$+=u,te++}}z.pts=$,$+=u}}let R=null,b=null,M,P=0,B=m.length;for(;B--;)P+=m[B].unit.byteLength;for(let ae=0,te=m.length;ae<te;ae++){const $=m[ae],z=$.unit;let fe=$.pts;if(b!==null){const re=d[ae-1];re.duration=Math.round((fe-b)/l)}else if(s&&e.segmentCodec==="aac"&&(fe=T),R=fe,P>0){P+=y;try{M=new Uint8Array(P)}catch(re){this.observer.emit(p.ERROR,p.ERROR,{type:se.MUX_ERROR,details:D.REMUX_ALLOC_ERROR,fatal:!1,error:re,bytes:P,reason:`fail allocating audio mdat ${P}`});return}h||(new DataView(M.buffer).setUint32(0,P),M.set(I.types.mdat,4))}else return;M.set(z,y);const he=z.byteLength;y+=he,d.push(new al(!0,c,he,0)),b=fe}const K=d.length;if(!K)return;const C=d[d.length-1];this.nextAudioPts=T=b+l*C.duration;const q=h?new Uint8Array(0):I.moof(e.sequenceNumber++,R/l,Me({},e,{samples:d}));e.samples=[];const W=R/o,ue=T/o,Te={data1:q,data2:M,startPTS:W,endPTS:ue,startDTS:W,endDTS:ue,type:"audio",hasAudio:!0,hasVideo:!1,nb:K};return this.isAudioContiguous=!0,Te}remuxEmptyAudio(e,t,s,n){const r=e.inputTimeScale,o=e.samplerate?e.samplerate:r,a=r/o,l=this.nextAudioPts,c=this._initDTS,u=c.baseTime*9e4/c.timescale,f=(l!==null?l:n.startDTS*r)+u,h=n.endDTS*r+u,d=a*ol,g=Math.ceil((h-f)/d),m=rl.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(v.warn("[mp4-remuxer]: remux empty Audio"),!m){v.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}const y=[];for(let T=0;T<g;T++){const x=f+T*d;y.push({unit:m,pts:x,dts:x})}return e.samples=y,this.remuxAudio(e,t,s,!1)}}function rt(i,e){let t;if(e===null)return i;for(e<i?t=-8589934592:t=8589934592;Math.abs(i-e)>4294967296;)i+=t;return i}function ny(i){for(let e=0;e<i.length;e++)if(i[e].key)return e;return-1}function Ou(i,e,t,s){const n=i.samples.length;if(!n)return;const r=i.inputTimeScale;for(let a=0;a<n;a++){const l=i.samples[a];l.pts=rt(l.pts-t.baseTime*r/t.timescale,e*r)/r,l.dts=rt(l.dts-s.baseTime*r/s.timescale,e*r)/r}const o=i.samples;return i.samples=[],{samples:o}}function Fu(i,e,t){const s=i.samples.length;if(!s)return;const n=i.inputTimeScale;for(let o=0;o<s;o++){const a=i.samples[o];a.pts=rt(a.pts-t.baseTime*n/t.timescale,e*n)/n}i.samples.sort((o,a)=>o.pts-a.pts);const r=i.samples;return i.samples=[],{samples:r}}class al{constructor(e,t,s,n){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=t,this.size=s,this.cts=n,this.flags=new ry(e)}}class ry{constructor(e){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=e?2:1,this.isNonSync=e?0:1}}class oy{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,s,n){this.audioCodec=t,this.videoCodec=s,this.generateInitSegment(bm(e,n)),this.emitInitSegment=!0}generateInitSegment(e){let{audioCodec:t,videoCodec:s}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const n=this.initData=uu(e);t||(t=ll(n.audio,Re.AUDIO)),s||(s=ll(n.video,Re.VIDEO));const r={};n.audio&&n.video?r.audiovideo={container:"video/mp4",codec:t+","+s,initSegment:e,id:"main"}:n.audio?r.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:n.video?r.video={container:"video/mp4",codec:s,initSegment:e,id:"main"}:v.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=r}remux(e,t,s,n,r,o){var a,l;let{initPTS:c,lastEndTime:u}=this;const f={audio:void 0,video:void 0,text:n,id3:s,initSegment:void 0};J(u)||(u=this.lastEndTime=r||0);const h=t.samples;if(!(h!=null&&h.length))return f;const d={initPTS:void 0,timescale:1};let g=this.initData;if((a=g)!=null&&a.length||(this.generateInitSegment(h),g=this.initData),!((l=g)!=null&&l.length))return v.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),f;this.emitInitSegment&&(d.tracks=this.initTracks,this.emitInitSegment=!1);const m=Dm(h,g),y=Im(g,h),T=y===null?r:y;(ay(c,T,r,m)||d.timescale!==c.timescale&&o)&&(d.initPTS=T-r,c&&c.timescale===1&&v.warn(`Adjusting initPTS by ${d.initPTS-c.baseTime}`),this.initPTS=c={baseTime:d.initPTS,timescale:1});const x=e?T-c.baseTime/c.timescale:u,S=x+m;wm(g,h,c.baseTime/c.timescale),m>0?this.lastEndTime=S:(v.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const R=!!g.audio,b=!!g.video;let M="";R&&(M+="audio"),b&&(M+="video");const P={data1:h,startPTS:x,startDTS:x,endPTS:S,endDTS:S,type:M,hasAudio:R,hasVideo:b,nb:1,dropped:0};return f.audio=P.type==="audio"?P:void 0,f.video=P.type!=="audio"?P:void 0,f.initSegment=d,f.id3=Ou(s,r,c,c),n.samples.length&&(f.text=Fu(n,r,c)),f}}function ay(i,e,t,s){if(i===null)return!0;const n=Math.max(s,1),r=e-i.baseTime/i.timescale;return Math.abs(r-t)>n}function ll(i,e){const t=i==null?void 0:i.codec;return t&&t.length>4?t:t==="hvc1"||t==="hev1"?"hvc1.1.6.L120.90":t==="av01"?"av01.0.04M.08":t==="avc1"||e===Re.VIDEO?"avc1.42e01e":"mp4a.40.5"}let Ot;try{Ot=self.performance.now.bind(self.performance)}catch{v.debug("Unable to use Performance API on this environment"),Ot=typeof self<"u"&&self.Date.now}const Wn=[{demux:Hp,remux:oy},{demux:Yt,remux:Vn},{demux:Gp,remux:Vn},{demux:Zp,remux:Vn}];class cl{constructor(e,t,s,n,r){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=s,this.vendor=n,this.id=r}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,s,n){const r=s.transmuxing;r.executeStart=Ot();let o=new Uint8Array(e);const{currentTransmuxState:a,transmuxConfig:l}=this;n&&(this.currentTransmuxState=n);const{contiguous:c,discontinuity:u,trackSwitch:f,accurateTimeOffset:h,timeOffset:d,initSegmentChange:g}=n||a,{audioCodec:m,videoCodec:y,defaultInitPts:T,duration:x,initSegmentData:S}=l,R=ly(o,t);if(R&&R.method==="AES-128"){const B=this.getDecrypter();if(B.isSync()){let K=B.softwareDecrypt(o,R.key.buffer,R.iv.buffer);if(s.part>-1&&(K=B.flush()),!K)return r.executeEnd=Ot(),Yn(s);o=new Uint8Array(K)}else return this.decryptionPromise=B.webCryptoDecrypt(o,R.key.buffer,R.iv.buffer).then(K=>{const C=this.push(K,null,s);return this.decryptionPromise=null,C}),this.decryptionPromise}const b=this.needsProbing(u,f);if(b){const B=this.configureTransmuxer(o);if(B)return v.warn(`[transmuxer] ${B.message}`),this.observer.emit(p.ERROR,p.ERROR,{type:se.MEDIA_ERROR,details:D.FRAG_PARSING_ERROR,fatal:!1,error:B,reason:B.message}),r.executeEnd=Ot(),Yn(s)}(u||f||g||b)&&this.resetInitSegment(S,m,y,x,t),(u||g||b)&&this.resetInitialTimestamp(T),c||this.resetContiguity();const M=this.transmux(o,R,d,h,s),P=this.currentTransmuxState;return P.contiguous=!0,P.discontinuity=!1,P.trackSwitch=!1,r.executeEnd=Ot(),M}flush(e){const t=e.transmuxing;t.executeStart=Ot();const{decrypter:s,currentTransmuxState:n,decryptionPromise:r}=this;if(r)return r.then(()=>this.flush(e));const o=[],{timeOffset:a}=n;if(s){const f=s.flush();f&&o.push(this.push(f,null,e))}const{demuxer:l,remuxer:c}=this;if(!l||!c)return t.executeEnd=Ot(),[Yn(e)];const u=l.flush(a);return Oi(u)?u.then(f=>(this.flushRemux(o,f,e),o)):(this.flushRemux(o,u,e),o)}flushRemux(e,t,s){const{audioTrack:n,videoTrack:r,id3Track:o,textTrack:a}=t,{accurateTimeOffset:l,timeOffset:c}=this.currentTransmuxState;v.log(`[transmuxer.ts]: Flushed fragment ${s.sn}${s.part>-1?" p: "+s.part:""} of level ${s.level}`);const u=this.remuxer.remux(n,r,o,a,c,l,!0,this.id);e.push({remuxResult:u,chunkMeta:s}),s.transmuxing.executeEnd=Ot()}resetInitialTimestamp(e){const{demuxer:t,remuxer:s}=this;!t||!s||(t.resetTimeStamp(e),s.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,s,n,r){const{demuxer:o,remuxer:a}=this;!o||!a||(o.resetInitSegment(e,t,s,n),a.resetInitSegment(e,t,s,r))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,s,n,r){let o;return t&&t.method==="SAMPLE-AES"?o=this.transmuxSampleAes(e,t,s,n,r):o=this.transmuxUnencrypted(e,s,n,r),o}transmuxUnencrypted(e,t,s,n){const{audioTrack:r,videoTrack:o,id3Track:a,textTrack:l}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(r,o,a,l,t,s,!1,this.id),chunkMeta:n}}transmuxSampleAes(e,t,s,n,r){return this.demuxer.demuxSampleAes(e,t,s).then(o=>({remuxResult:this.remuxer.remux(o.audioTrack,o.videoTrack,o.id3Track,o.textTrack,s,n,!1,this.id),chunkMeta:r}))}configureTransmuxer(e){const{config:t,observer:s,typeSupported:n,vendor:r}=this;let o;for(let f=0,h=Wn.length;f<h;f++)if(Wn[f].demux.probe(e)){o=Wn[f];break}if(!o)return new Error("Failed to find demuxer by probing fragment data");const a=this.demuxer,l=this.remuxer,c=o.remux,u=o.demux;(!l||!(l instanceof c))&&(this.remuxer=new c(s,t,n,r)),(!a||!(a instanceof u))&&(this.demuxer=new u(s,t,n),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 mo(this.config)),e}}function ly(i,e){let t=null;return i.byteLength>0&&e!=null&&e.key!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const Yn=i=>({remuxResult:{},chunkMeta:i});function Oi(i){return"then"in i&&i.then instanceof Function}class cy{constructor(e,t,s,n,r){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=s,this.duration=n,this.defaultInitPts=r||null}}class uy{constructor(e,t,s,n,r,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=s,this.trackSwitch=n,this.timeOffset=r,this.initSegmentChange=o}}var Nu={exports:{}};(function(i){var e=Object.prototype.hasOwnProperty,t="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(t=!1));function n(l,c,u){this.fn=l,this.context=c,this.once=u||!1}function r(l,c,u,f,h){if(typeof u!="function")throw new TypeError("The listener must be a function");var d=new n(u,f||l,h),g=t?t+c:c;return l._events[g]?l._events[g].fn?l._events[g]=[l._events[g],d]:l._events[g].push(d):(l._events[g]=d,l._eventsCount++),l}function o(l,c){--l._eventsCount===0?l._events=new s:delete l._events[c]}function a(){this._events=new s,this._eventsCount=0}a.prototype.eventNames=function(){var c=[],u,f;if(this._eventsCount===0)return c;for(f in u=this._events)e.call(u,f)&&c.push(t?f.slice(1):f);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(u)):c},a.prototype.listeners=function(c){var u=t?t+c:c,f=this._events[u];if(!f)return[];if(f.fn)return[f.fn];for(var h=0,d=f.length,g=new Array(d);h<d;h++)g[h]=f[h].fn;return g},a.prototype.listenerCount=function(c){var u=t?t+c:c,f=this._events[u];return f?f.fn?1:f.length:0},a.prototype.emit=function(c,u,f,h,d,g){var m=t?t+c:c;if(!this._events[m])return!1;var y=this._events[m],T=arguments.length,x,S;if(y.fn){switch(y.once&&this.removeListener(c,y.fn,void 0,!0),T){case 1:return y.fn.call(y.context),!0;case 2:return y.fn.call(y.context,u),!0;case 3:return y.fn.call(y.context,u,f),!0;case 4:return y.fn.call(y.context,u,f,h),!0;case 5:return y.fn.call(y.context,u,f,h,d),!0;case 6:return y.fn.call(y.context,u,f,h,d,g),!0}for(S=1,x=new Array(T-1);S<T;S++)x[S-1]=arguments[S];y.fn.apply(y.context,x)}else{var R=y.length,b;for(S=0;S<R;S++)switch(y[S].once&&this.removeListener(c,y[S].fn,void 0,!0),T){case 1:y[S].fn.call(y[S].context);break;case 2:y[S].fn.call(y[S].context,u);break;case 3:y[S].fn.call(y[S].context,u,f);break;case 4:y[S].fn.call(y[S].context,u,f,h);break;default:if(!x)for(b=1,x=new Array(T-1);b<T;b++)x[b-1]=arguments[b];y[S].fn.apply(y[S].context,x)}}return!0},a.prototype.on=function(c,u,f){return r(this,c,u,f,!1)},a.prototype.once=function(c,u,f){return r(this,c,u,f,!0)},a.prototype.removeListener=function(c,u,f,h){var d=t?t+c:c;if(!this._events[d])return this;if(!u)return o(this,d),this;var g=this._events[d];if(g.fn)g.fn===u&&(!h||g.once)&&(!f||g.context===f)&&o(this,d);else{for(var m=0,y=[],T=g.length;m<T;m++)(g[m].fn!==u||h&&!g[m].once||f&&g[m].context!==f)&&y.push(g[m]);y.length?this._events[d]=y.length===1?y[0]:y:o(this,d)}return this},a.prototype.removeAllListeners=function(c){var u;return c?(u=t?t+c:c,this._events[u]&&o(this,u)):(this._events=new s,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=t,a.EventEmitter=a,i.exports=a})(Nu);var fy=Nu.exports,xo=X0(fy);const jn=En()||{isTypeSupported:()=>!1};class Mu{constructor(e,t,s,n){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 r=e.config;this.hls=e,this.id=t,this.useWorker=!!r.enableWorker,this.onTransmuxComplete=s,this.onFlush=n;const o=(c,u)=>{u=u||{},u.frag=this.frag,u.id=this.id,c===p.ERROR&&(this.error=u.error),this.hls.trigger(c,u)};this.observer=new xo,this.observer.on(p.FRAG_DECRYPTED,o),this.observer.on(p.ERROR,o);const a={mp4:jn.isTypeSupported("video/mp4"),mpeg:jn.isTypeSupported("audio/mpeg"),mp3:jn.isTypeSupported('audio/mp4; codecs="mp3"')},l=navigator.vendor;if(this.useWorker&&typeof Worker<"u"&&(r.workerPath||Pp())){try{r.workerPath?(v.log(`loading Web Worker ${r.workerPath} for "${t}"`),this.workerContext=Op(r.workerPath)):(v.log(`injecting Web Worker for "${t}"`),this.workerContext=kp()),this.onwmsg=f=>this.onWorkerMessage(f);const{worker:u}=this.workerContext;u.addEventListener("message",this.onwmsg),u.onerror=f=>{const h=new Error(`${f.message} (${f.filename}:${f.lineno})`);r.enableWorker=!1,v.warn(`Error in "${t}" Web Worker, fallback to inline`),this.hls.trigger(p.ERROR,{type:se.OTHER_ERROR,details:D.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:h})},u.postMessage({cmd:"init",typeSupported:a,vendor:l,id:t,config:JSON.stringify(r)})}catch(u){v.warn(`Error setting up "${t}" Web Worker, fallback to inline`,u),this.resetWorker(),this.error=null,this.transmuxer=new cl(this.observer,a,r,l,t)}return}this.transmuxer=new cl(this.observer,a,r,l,t)}resetWorker(){if(this.workerContext){const{worker:e,objectURL:t}=this.workerContext;t&&self.URL.revokeObjectURL(t),e.removeEventListener("message",this.onwmsg),e.onerror=null,e.terminate(),this.workerContext=null}}destroy(){if(this.workerContext)this.resetWorker(),this.onwmsg=void 0;else{const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.observer=null,this.hls=null}push(e,t,s,n,r,o,a,l,c,u){var f,h;c.transmuxing.start=self.performance.now();const{transmuxer:d}=this,g=o?o.start:r.start,m=r.decryptdata,y=this.frag,T=!(y&&r.cc===y.cc),x=!(y&&c.level===y.level),S=y?c.sn-y.sn:-1,R=this.part?c.part-this.part.index:-1,b=S===0&&c.id>1&&c.id===(y==null?void 0:y.stats.chunkCount),M=!x&&(S===1||S===0&&(R===1||b&&R<=0)),P=self.performance.now();(x||S||r.stats.parsing.start===0)&&(r.stats.parsing.start=P),o&&(R||!M)&&(o.stats.parsing.start=P);const B=!(y&&((f=r.initSegment)==null?void 0:f.url)===((h=y.initSegment)==null?void 0:h.url)),K=new uy(T,M,l,x,g,B);if(!M||T||B){v.log(`[transmuxer-interface, ${r.type}]: Starting new transmux session for sn: ${c.sn} p: ${c.part} level: ${c.level} id: ${c.id}
discontinuity: ${T}
trackSwitch: ${x}
contiguous: ${M}
accurateTimeOffset: ${l}
timeOffset: ${g}
initSegmentChange: ${B}`);const C=new cy(s,n,t,a,u);this.configureTransmuxer(C)}if(this.frag=r,this.part=o,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:e,decryptdata:m,chunkMeta:c,state:K},e instanceof ArrayBuffer?[e]:[]);else if(d){const C=d.push(e,m,c,K);Oi(C)?(d.async=!0,C.then(q=>{this.handleTransmuxComplete(q)}).catch(q=>{this.transmuxerError(q,c,"transmuxer-interface push error")})):(d.async=!1,this.handleTransmuxComplete(C))}}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 s=t.flush(e);Oi(s)||t.async?(Oi(s)||(s=Promise.resolve(s)),s.then(r=>{this.handleFlushResult(r,e)}).catch(r=>{this.transmuxerError(r,e,"transmuxer-interface flush error")})):this.handleFlushResult(s,e)}}transmuxerError(e,t,s){this.hls&&(this.error=e,this.hls.trigger(p.ERROR,{type:se.MEDIA_ERROR,details:D.FRAG_PARSING_ERROR,chunkMeta:t,fatal:!1,error:e,err:e,reason:s}))}handleFlushResult(e,t){e.forEach(s=>{this.handleTransmuxComplete(s)}),this.onFlush(t)}onWorkerMessage(e){const t=e.data,s=this.hls;switch(t.event){case"init":{var n;const r=(n=this.workerContext)==null?void 0:n.objectURL;r&&self.URL.revokeObjectURL(r);break}case"transmuxComplete":{this.handleTransmuxComplete(t.data);break}case"flush":{this.onFlush(t.data);break}case"workerLog":v[t.data.logType]&&v[t.data.logType](t.data.message);break;default:{t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,s.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)}}const hy=250,qn=2,dy=.1,gy=.05;class my{constructor(e,t,s,n){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=s,this.hls=n}destroy(){this.media=null,this.hls=this.fragmentTracker=null}poll(e,t){const{config:s,media:n,stalled:r}=this;if(n===null)return;const{currentTime:o,seeking:a}=n,l=this.seeking&&!a,c=!this.seeking&&a;if(this.seeking=a,o!==e){if(this.moved=!0,r!==null){if(this.stallReported){const T=self.performance.now()-r;v.warn(`playback not stuck anymore @${o}, after ${Math.round(T)}ms`),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if(c||l){this.stalled=null;return}if(n.paused&&!a||n.ended||n.playbackRate===0||!De.getBuffered(n).length)return;const u=De.bufferInfo(n,o,0),f=u.len>0,h=u.nextStart||0;if(!f&&!h)return;if(a){const T=u.len>qn,x=!h||t&&t.start<=o||h-o>qn&&!this.fragmentTracker.getPartialFragment(o);if(T||x)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var d;const T=Math.max(h,u.start||0)-o,x=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,R=(x==null||(d=x.details)==null?void 0:d.live)?x.details.targetduration*2:qn,b=this.fragmentTracker.getPartialFragment(o);if(T>0&&(T<=R||b)){this._trySkipBufferHole(b);return}}const g=self.performance.now();if(r===null){this.stalled=g;return}const m=g-r;if(!a&&m>=hy&&(this._reportStall(u),!this.media))return;const y=De.bufferInfo(n,o,s.maxBufferHole);this._tryFixBufferStall(y,m)}_tryFixBufferStall(e,t){const{config:s,fragmentTracker:n,media:r}=this;if(r===null)return;const o=r.currentTime,a=n.getPartialFragment(o);a&&(this._trySkipBufferHole(a)||!this.media)||(e.len>s.maxBufferHole||e.nextStart&&e.nextStart-o<s.maxBufferHole)&&t>s.highBufferWatchdogPeriod*1e3&&(v.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}_reportStall(e){const{hls:t,media:s,stallReported:n}=this;if(!n&&s){this.stallReported=!0;const r=new Error(`Playback stalling at @${s.currentTime} due to low buffer (${JSON.stringify(e)})`);v.warn(r.message),t.trigger(p.ERROR,{type:se.MEDIA_ERROR,details:D.BUFFER_STALLED_ERROR,fatal:!1,error:r,buffer:e.len})}}_trySkipBufferHole(e){const{config:t,hls:s,media:n}=this;if(n===null)return 0;const r=n.currentTime,o=De.bufferInfo(n,r,0),a=r<o.start?o.start:o.nextStart;if(a){const l=o.len<=t.maxBufferHole,c=o.len>0&&o.len<1&&n.readyState<3,u=a-r;if(u>0&&(l||c)){if(u>t.maxBufferHole){const{fragmentTracker:h}=this;let d=!1;if(r===0){const g=h.getAppendedFrag(0,ie.MAIN);g&&a<g.end&&(d=!0)}if(!d){const g=e||h.getAppendedFrag(r,ie.MAIN);if(g){let m=!1,y=g.end;for(;y<a;){const T=h.getPartialFragment(y);if(T)y+=T.duration;else{m=!0;break}}if(m)return 0}}}const f=Math.max(a+gy,r+dy);if(v.warn(`skipping hole, adjusting currentTime from ${r} to ${f}`),this.moved=!0,this.stalled=null,n.currentTime=f,e&&!e.gap){const h=new Error(`fragment loaded with buffer holes, seeking from ${r} to ${f}`);s.trigger(p.ERROR,{type:se.MEDIA_ERROR,details:D.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:h,reason:h.message,frag:e})}return f}}return 0}_tryNudgeBuffer(){const{config:e,hls:t,media:s,nudgeRetry:n}=this;if(s===null)return;const r=s.currentTime;if(this.nudgeRetry++,n<e.nudgeMaxRetry){const o=r+(n+1)*e.nudgeOffset,a=new Error(`Nudging 'currentTime' from ${r} to ${o}`);v.warn(a.message),s.currentTime=o,t.trigger(p.ERROR,{type:se.MEDIA_ERROR,details:D.BUFFER_NUDGE_ON_STALL,error:a,fatal:!1})}else{const o=new Error(`Playhead still not moving while enough data buffered @${r} after ${e.nudgeMaxRetry} nudges`);v.error(o.message),t.trigger(p.ERROR,{type:se.MEDIA_ERROR,details:D.BUFFER_STALLED_ERROR,error:o,fatal:!0})}}}const py=100;class yy extends po{constructor(e,t,s){super(e,t,s,"[stream-controller]",ie.MAIN),this.audioCodecSwap=!1,this.gapController=null,this.level=-1,this._forceStartLoad=!1,this.altAudio=!1,this.audioOnly=!1,this.fragPlaying=null,this.onvplaying=null,this.onvseeked=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.LEVEL_LOADING,this.onLevelLoading,this),e.on(p.LEVEL_LOADED,this.onLevelLoaded,this),e.on(p.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(p.ERROR,this.onError,this),e.on(p.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(p.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(p.BUFFER_CREATED,this.onBufferCreated,this),e.on(p.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(p.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.LEVEL_LOADED,this.onLevelLoaded,this),e.off(p.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(p.ERROR,this.onError,this),e.off(p.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(p.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(p.BUFFER_CREATED,this.onBufferCreated,this),e.off(p.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(p.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this._unregisterListeners(),this.onMediaDetaching()}startLoad(e){if(this.levels){const{lastCurrentTime:t,hls:s}=this;if(this.stopLoad(),this.setInterval(py),this.level=-1,!this.startFragRequested){let n=s.startLevel;n===-1&&(s.config.testBandwidth&&this.levels.length>1?(n=0,this.bitrateTest=!0):n=s.nextAutoLevel),this.level=s.nextLoadLevel=n,this.loadedmetadata=!1}t>0&&e===-1&&(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t),this.state=F.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=F.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case F.WAITING_LEVEL:{var e;const{levels:s,level:n}=this,r=s==null||(e=s[n])==null?void 0:e.details;if(r&&(!r.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(r))break;this.state=F.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=F.IDLE;break}break}case F.FRAG_LOADING_WAITING_RETRY:{var t;const s=self.performance.now(),n=this.retryDate;(!n||s>=n||(t=this.media)!=null&&t.seeking)&&(this.resetStartWhenNotLoaded(this.level),this.state=F.IDLE)}break}this.state===F.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){super.onTickEnd(),this.checkBuffer(),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:s,media:n}=this,{config:r,nextLoadLevel:o}=e;if(t===null||!n&&(this.startFragRequested||!r.startFragPrefetch)||this.altAudio&&this.audioOnly||!(s!=null&&s[o]))return;const a=s[o],l=this.getMainFwdBufferInfo();if(l===null)return;const c=this.getLevelDetails();if(c&&this._streamEnded(l,c)){const y={};this.altAudio&&(y.type="video"),this.hls.trigger(p.BUFFER_EOS,y),this.state=F.ENDED;return}e.loadLevel!==o&&e.manualLevel===-1&&this.log(`Adapting to level ${o} from level ${this.level}`),this.level=e.nextLoadLevel=o;const u=a.details;if(!u||this.state===F.WAITING_LEVEL||u.live&&this.levelLastLoaded!==o){this.level=o,this.state=F.WAITING_LEVEL;return}const f=l.len,h=this.getMaxBufferLength(a.maxBitrate);if(f>=h)return;this.backtrackFragment&&this.backtrackFragment.start>l.end&&(this.backtrackFragment=null);const d=this.backtrackFragment?this.backtrackFragment.start:l.end;let g=this.getNextFragment(d,u);if(this.couldBacktrack&&!this.fragPrevious&&g&&g.sn!=="initSegment"&&this.fragmentTracker.getState(g)!==Ue.OK){var m;const T=((m=this.backtrackFragment)!=null?m:g).sn-u.startSN,x=u.fragments[T-1];x&&g.cc===x.cc&&(g=x,this.fragmentTracker.removeFragment(x))}else this.backtrackFragment&&l.len&&(this.backtrackFragment=null);if(g&&this.isLoopLoading(g,d)){if(!g.gap){const T=this.audioOnly&&!this.altAudio?Re.AUDIO:Re.VIDEO,x=(T===Re.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;x&&this.afterBufferFlushed(x,T,ie.MAIN)}g=this.getNextFragmentLoopLoading(g,u,l,ie.MAIN,h)}g&&(g.initSegment&&!g.initSegment.data&&!this.bitrateTest&&(g=g.initSegment),this.loadFragment(g,a,d))}loadFragment(e,t,s){const n=this.fragmentTracker.getState(e);this.fragCurrent=e,n===Ue.NOT_LOADED||n===Ue.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,s)):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,ie.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 s;const n=this.getAppendedFrag(t.currentTime);n&&n.start>1&&this.flushMainBuffer(0,n.start-1);const r=this.getLevelDetails();if(r!=null&&r.live){const a=this.getMainFwdBufferInfo();if(!a||a.len<r.targetduration*2)return}if(!t.paused&&e){const a=this.hls.nextLoadLevel,l=e[a],c=this.fragLastKbps;c&&this.fragCurrent?s=this.fragCurrent.duration*l.maxBitrate/(1e3*c)+1:s=0}else s=0;const o=this.getBufferedFrag(t.currentTime+s);if(o){const a=this.followingBufferedFrag(o);if(a){this.abortCurrentFrag();const l=a.maxStartPTS?a.maxStartPTS:a.start,c=a.duration,u=Math.max(o.end,l+Math.min(Math.max(c-this.config.maxFragLookUpTolerance,c*.5),c*.75));this.flushMainBuffer(u,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 F.KEY_LOADING:case F.FRAG_LOADING:case F.FRAG_LOADING_WAITING_RETRY:case F.PARSING:case F.PARSED:this.state=F.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 s=t.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),s.addEventListener("playing",this.onvplaying),s.addEventListener("seeked",this.onvseeked),this.gapController=new my(this.config,s,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;J(t)&&this.log(`Media seeked to ${t.toFixed(3)}`);const s=this.getMainFwdBufferInfo();if(s===null||s.len===0){this.warn(`Main forward buffer length on "seeked" event ${s?s.len:"empty"})`);return}this.tick()}onManifestLoading(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(p.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=0,this.levels=this.fragPlaying=this.backtrackFragment=null,this.altAudio=this.audioOnly=!1}onManifestParsed(e,t){let s=!1,n=!1,r;t.levels.forEach(o=>{r=o.audioCodec,r&&(r.indexOf("mp4a.40.2")!==-1&&(s=!0),r.indexOf("mp4a.40.5")!==-1&&(n=!0))}),this.audioCodecSwitch=s&&n&&!_p(),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:s}=this;if(!s||this.state!==F.IDLE)return;const n=s[t.level];(!n.details||n.details.live&&this.levelLastLoaded!==t.level||this.waitForCdnTuneIn(n.details))&&(this.state=F.WAITING_LEVEL)}onLevelLoaded(e,t){var s;const{levels:n}=this,r=t.level,o=t.details,a=o.totalduration;if(!n){this.warn(`Levels were reset while loading level ${r}`);return}this.log(`Level ${r} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""}, cc [${o.startCC}, ${o.endCC}] duration:${a}`);const l=n[r],c=this.fragCurrent;c&&(this.state===F.FRAG_LOADING||this.state===F.FRAG_LOADING_WAITING_RETRY)&&(c.level!==t.level||c.urlId!==l.urlId)&&c.loader&&this.abortCurrentFrag();let u=0;if(o.live||(s=l.details)!=null&&s.live){if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;u=this.alignPlaylists(o,l.details)}if(l.details=o,this.levelLastLoaded=r,this.hls.trigger(p.LEVEL_UPDATED,{details:o,level:r}),this.state===F.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=F.IDLE}this.startFragRequested?o.live&&this.synchronizeToLiveEdge(o):this.setStartPosition(o,u),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:s,part:n,payload:r}=e,{levels:o}=this;if(!o){this.warn(`Levels were reset while fragment load was in progress. Fragment ${s.sn} of level ${s.level} will not be buffered`);return}const a=o[s.level],l=a.details;if(!l){this.warn(`Dropping fragment ${s.sn} of level ${s.level} after level details were reset`),this.fragmentTracker.removeFragment(s);return}const c=a.videoCodec,u=l.PTSKnown||!l.live,f=(t=s.initSegment)==null?void 0:t.data,h=this._getAudioCodec(a),d=this.transmuxer=this.transmuxer||new Mu(this.hls,ie.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),g=n?n.index:-1,m=g!==-1,y=new ho(s.level,s.sn,s.stats.chunkCount,r.byteLength,g,m),T=this.initPTS[s.cc];d.push(r,f,h,c,s,n,l.totalduration,u,y,T)}onAudioTrackSwitching(e,t){const s=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 r=this.hls;s&&(r.trigger(p.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),r.trigger(p.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const s=t.id,n=!!this.hls.audioTracks[s].url;if(n){const r=this.videoBuffer;r&&this.mediaBuffer!==r&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=r)}this.altAudio=n,this.tick()}onBufferCreated(e,t){const s=t.tracks;let n,r,o=!1;for(const a in s){const l=s[a];if(l.id==="main"){if(r=a,n=l,a==="video"){const c=s[a];c&&(this.videoBuffer=c.buffer)}}else o=!0}o&&n?(this.log(`Alternate track found, use ${r}.buffered to schedule main fragment loading`),this.mediaBuffer=n.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:s,part:n}=t;if(s&&s.type!==ie.MAIN)return;if(this.fragContextChanged(s)){this.warn(`Fragment ${s.sn}${n?" p: "+n.index:""} of level ${s.level} finished buffering, but was aborted. state: ${this.state}`),this.state===F.PARSED&&(this.state=F.IDLE);return}const r=n?n.stats:s.stats;this.fragLastKbps=Math.round(8*r.total/(r.buffering.end-r.loading.first)),s.sn!=="initSegment"&&(this.fragPrevious=s),this.fragBufferedComplete(s,n)}onError(e,t){var s;if(t.fatal){this.state=F.ERROR;return}switch(t.details){case D.FRAG_GAP:case D.FRAG_PARSING_ERROR:case D.FRAG_DECRYPT_ERROR:case D.FRAG_LOAD_ERROR:case D.FRAG_LOAD_TIMEOUT:case D.KEY_LOAD_ERROR:case D.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(ie.MAIN,t);break;case D.LEVEL_LOAD_ERROR:case D.LEVEL_LOAD_TIMEOUT:case D.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===F.WAITING_LEVEL&&((s=t.context)==null?void 0:s.type)===ye.LEVEL&&(this.state=F.IDLE);break;case D.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case D.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}checkBuffer(){const{media:e,gapController:t}=this;if(!(!e||!t||!e.readyState)){if(this.loadedmetadata||!De.getBuffered(e).length){const s=this.state!==F.IDLE?this.fragCurrent:null;t.poll(this.lastCurrentTime,s)}this.lastCurrentTime=e.currentTime}}onFragLoadEmergencyAborted(){this.state=F.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==Re.AUDIO||this.audioOnly&&!this.altAudio){const s=(t===Re.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(s,t,ie.MAIN)}}onLevelsUpdated(e,t){this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let s=this.startPosition;if(s>=0&&t<s){if(e.seeking){this.log(`could not seek to ${s}, already seeking at ${t}`);return}const n=De.getBuffered(e),o=(n.length?n.start(0):0)-s;o>0&&(o<this.config.maxBufferHole||o<this.config.maxFragLookUpTolerance)&&(this.log(`adjusting start position by ${o} to match buffer start`),s+=o,this.startPosition=s),this.log(`seek to target start position ${s} from current time ${t}`),e.currentTime=s}}_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(s=>{const{hls:n}=this;if(!s||this.fragContextChanged(e))return;t.fragmentError=0,this.state=F.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const r=e.stats;r.parsing.start=r.parsing.end=r.buffering.start=r.buffering.end=self.performance.now(),n.trigger(p.FRAG_LOADED,s),e.bitrateTest=!1})}_handleTransmuxComplete(e){var t;const s="main",{hls:n}=this,{remuxResult:r,chunkMeta:o}=e,a=this.getCurrentContext(o);if(!a){this.resetWhenMissingContext(o);return}const{frag:l,part:c,level:u}=a,{video:f,text:h,id3:d,initSegment:g}=r,{details:m}=u,y=this.altAudio?void 0:r.audio;if(this.fragContextChanged(l)){this.fragmentTracker.removeFragment(l);return}if(this.state=F.PARSING,g){if(g!=null&&g.tracks){const S=l.initSegment||l;this._bufferInitSegment(u,g.tracks,S,o),n.trigger(p.FRAG_PARSING_INIT_SEGMENT,{frag:S,id:s,tracks:g.tracks})}const T=g.initPTS,x=g.timescale;J(T)&&(this.initPTS[l.cc]={baseTime:T,timescale:x},n.trigger(p.INIT_PTS_FOUND,{frag:l,id:s,initPTS:T,timescale:x}))}if(f&&m&&l.sn!=="initSegment"){const T=m.fragments[l.sn-1-m.startSN],x=l.sn===m.startSN,S=!T||l.cc>T.cc;if(r.independent!==!1){const{startPTS:R,endPTS:b,startDTS:M,endDTS:P}=f;if(c)c.elementaryStreams[f.type]={startPTS:R,endPTS:b,startDTS:M,endDTS:P};else if(f.firstKeyFrame&&f.independent&&o.id===1&&!S&&(this.couldBacktrack=!0),f.dropped&&f.independent){const B=this.getMainFwdBufferInfo(),K=(B?B.end:this.getLoadPosition())+this.config.maxBufferHole,C=f.firstKeyFramePTS?f.firstKeyFramePTS:R;if(!x&&K<C-this.config.maxBufferHole&&!S){this.backtrack(l);return}else S&&(l.gap=!0);l.setElementaryStreamInfo(f.type,l.start,b,l.start,P,!0)}l.setElementaryStreamInfo(f.type,R,b,M,P),this.backtrackFragment&&(this.backtrackFragment=l),this.bufferFragmentData(f,l,c,o,x||S)}else if(x||S)l.gap=!0;else{this.backtrack(l);return}}if(y){const{startPTS:T,endPTS:x,startDTS:S,endDTS:R}=y;c&&(c.elementaryStreams[Re.AUDIO]={startPTS:T,endPTS:x,startDTS:S,endDTS:R}),l.setElementaryStreamInfo(Re.AUDIO,T,x,S,R),this.bufferFragmentData(y,l,c,o)}if(m&&d!=null&&(t=d.samples)!=null&&t.length){const T={id:s,frag:l,details:m,samples:d.samples};n.trigger(p.FRAG_PARSING_METADATA,T)}if(m&&h){const T={id:s,frag:l,details:m,samples:h.samples};n.trigger(p.FRAG_PARSING_USERDATA,T)}}_bufferInitSegment(e,t,s,n){if(this.state!==F.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;const{audio:r,video:o,audiovideo:a}=t;if(r){let l=e.audioCodec;const c=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(l&&(l.indexOf("mp4a.40.5")!==-1?l="mp4a.40.2":l="mp4a.40.5"),r.metadata.channelCount!==1&&c.indexOf("firefox")===-1&&(l="mp4a.40.5")),c.indexOf("android")!==-1&&r.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}"`),r.levelCodec=l,r.id="main",this.log(`Init audio buffer, container:${r.container}, codecs[selected/level/parsed]=[${l||""}/${e.audioCodec||""}/${r.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.attrs.CODECS||""}/${a.codec}]`),this.hls.trigger(p.BUFFER_CODECS,t),Object.keys(t).forEach(l=>{const u=t[l].initSegment;u!=null&&u.byteLength&&this.hls.trigger(p.BUFFER_APPENDING,{type:l,data:u,frag:s,part:null,chunkMeta:n,parent:s.type})}),this.tick()}getMainFwdBufferInfo(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,ie.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=F.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const s=e.currentTime;if(De.isBuffered(e,s)?t=this.getAppendedFrag(s):De.isBuffered(e,s+.1)&&(t=this.getAppendedFrag(s+.1)),t){this.backtrackFragment=null;const n=this.fragPlaying,r=t.level;(!n||t.sn!==n.sn||n.level!==r||t.urlId!==n.urlId)&&(this.fragPlaying=t,this.hls.trigger(p.FRAG_CHANGED,{frag:t}),(!n||n.level!==r)&&this.hls.trigger(p.LEVEL_SWITCHED,{level:r}))}}}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,s=this.currentFrag;if(s&&J(t)&&J(s.programDateTime)){const n=s.programDateTime+(t-s.start)*1e3;return new Date(n)}}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 gs{constructor(e,t=0,s=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_=s}sample(e,t){const s=Math.pow(this.alpha_,e);this.estimate_=t*(1-s)+s*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 Ty{constructor(e,t,s,n=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_=s,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new gs(e),this.fast_=new gs(t),this.defaultTTFB_=n,this.ttfb_=new gs(e)}update(e,t){const{slow_:s,fast_:n,ttfb_:r}=this;s.halfLife!==e&&(this.slow_=new gs(e,s.getEstimate(),s.getTotalWeight())),n.halfLife!==t&&(this.fast_=new gs(t,n.getEstimate(),n.getTotalWeight())),r.halfLife!==e&&(this.ttfb_=new gs(e,r.getEstimate(),r.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const s=8*t,n=e/1e3,r=s/n;this.fast_.sample(n,r),this.slow_.sample(n,r)}sampleTTFB(e){const t=e/1e3,s=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(s,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(){}}class Ey{constructor(e){this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=-1,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=e;const t=e.config;this.bwEstimator=new Ty(t.abrEwmaSlowVoD,t.abrEwmaFastVoD,t.abrEwmaDefaultEstimate),this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(p.FRAG_LOADING,this.onFragLoading,this),e.on(p.FRAG_LOADED,this.onFragLoaded,this),e.on(p.FRAG_BUFFERED,this.onFragBuffered,this),e.on(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(p.LEVEL_LOADED,this.onLevelLoaded,this)}unregisterListeners(){const{hls:e}=this;e.off(p.FRAG_LOADING,this.onFragLoading,this),e.off(p.FRAG_LOADED,this.onFragLoaded,this),e.off(p.FRAG_BUFFERED,this.onFragBuffered,this),e.off(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(p.LEVEL_LOADED,this.onLevelLoaded,this)}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null}onFragLoading(e,t){var s;const n=t.frag;this.ignoreFragment(n)||(this.fragCurrent=n,this.partCurrent=(s=t.part)!=null?s:null,this.clearTimer(),this.timer=self.setInterval(this.onCheck,100))}onLevelSwitching(e,t){this.clearTimer()}getTimeToLoadFrag(e,t,s,n){const r=e+s/t,o=n?this.lastLevelLoadSec:0;return r+o}onLevelLoaded(e,t){const s=this.hls.config,{total:n,bwEstimate:r}=t.stats;J(n)&&J(r)&&(this.lastLevelLoadSec=8*n/r),t.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)}_abandonRulesCheck(){const{fragCurrent:e,partCurrent:t,hls:s}=this,{autoLevelEnabled:n,media:r}=s;if(!e||!r)return;const o=performance.now(),a=t?t.stats:e.stats,l=t?t.duration:e.duration,c=o-a.loading.start;if(a.aborted||a.loaded&&a.loaded===a.total||e.level===0){this.clearTimer(),this._nextAutoLevel=-1;return}if(!n||r.paused||!r.playbackRate||!r.readyState)return;const u=s.mainForwardBufferInfo;if(u===null)return;const f=this.bwEstimator.getEstimateTTFB(),h=Math.abs(r.playbackRate);if(c<=Math.max(f,1e3*(l/(h*2))))return;const d=u.len/h;if(d>=2*l/h)return;const g=a.loading.first?a.loading.first-a.loading.start:-1,m=a.loaded&&g>-1,y=this.bwEstimator.getEstimate(),{levels:T,minAutoLevel:x}=s,S=T[e.level],R=a.total||Math.max(a.loaded,Math.round(l*S.maxBitrate/8));let b=c-g;b<1&&m&&(b=Math.min(c,a.loaded*8/y));const M=m?a.loaded*1e3/b:0,P=M?(R-a.loaded)/M:R*8/y+f/1e3;if(P<=d)return;const B=M?M*8:y;let K=Number.POSITIVE_INFINITY,C;for(C=e.level-1;C>x;C--){const q=T[C].maxBitrate;if(K=this.getTimeToLoadFrag(f/1e3,B,l*q,!T[C].details),K<d)break}K>=P||K>l*10||(s.nextLoadLevel=C,m?this.bwEstimator.sample(c-Math.min(f,g),a.loaded):this.bwEstimator.sampleTTFB(c),this.clearTimer(),v.warn(`[abr] Fragment ${e.sn}${t?" part "+t.index:""} of level ${e.level} is loading too slowly;
Time to underbuffer: ${d.toFixed(3)} s
Estimated load time for current fragment: ${P.toFixed(3)} s
Estimated load time for down switch fragment: ${K.toFixed(3)} s
TTFB estimate: ${g}
Current BW estimate: ${J(y)?(y/1024).toFixed(3):"Unknown"} Kb/s
New BW estimate: ${(this.bwEstimator.getEstimate()/1024).toFixed(3)} Kb/s
Aborting and switching to level ${C}`),e.loader&&(this.fragCurrent=this.partCurrent=null,e.abortRequests()),s.trigger(p.FRAG_LOAD_EMERGENCY_ABORTED,{frag:e,part:t,stats:a}))}onFragLoaded(e,{frag:t,part:s}){const n=s?s.stats:t.stats;if(t.type===ie.MAIN&&this.bwEstimator.sampleTTFB(n.loading.first-n.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),this.lastLoadedFragLevel=t.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){const r=s?s.duration:t.duration,o=this.hls.levels[t.level],a=(o.loaded?o.loaded.bytes:0)+n.loaded,l=(o.loaded?o.loaded.duration:0)+r;o.loaded={bytes:a,duration:l},o.realBitrate=Math.round(8*a/l)}if(t.bitrateTest){const r={stats:n,frag:t,part:s,id:t.type};this.onFragBuffered(p.FRAG_BUFFERED,r),t.bitrateTest=!1}}}onFragBuffered(e,t){const{frag:s,part:n}=t,r=n!=null&&n.stats.loaded?n.stats:s.stats;if(r.aborted||this.ignoreFragment(s))return;const o=r.parsing.end-r.loading.start-Math.min(r.loading.first-r.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(o,r.loaded),r.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=o/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==ie.MAIN||e.sn==="initSegment"}clearTimer(){self.clearInterval(this.timer)}get nextAutoLevel(){const e=this._nextAutoLevel,t=this.bwEstimator;if(e!==-1&&!t.canEstimate())return e;let s=this.getNextABRAutoLevel();if(e!==-1){const n=this.hls.levels;if(n.length>Math.max(e,s)&&n[e].loadError<=n[s].loadError)return e}return e!==-1&&(s=Math.min(e,s)),s}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:s}=this,{maxAutoLevel:n,config:r,minAutoLevel:o,media:a}=s,l=t?t.duration:e?e.duration:0,c=a&&a.playbackRate!==0?Math.abs(a.playbackRate):1,u=this.bwEstimator?this.bwEstimator.getEstimate():r.abrEwmaDefaultEstimate,f=s.mainForwardBufferInfo,h=(f?f.len:0)/c;let d=this.findBestLevel(u,o,n,h,r.abrBandWidthFactor,r.abrBandWidthUpFactor);if(d>=0)return d;v.trace(`[abr] ${h?"rebuffering expected":"buffer is empty"}, finding optimal quality level`);let g=l?Math.min(l,r.maxStarvationDelay):r.maxStarvationDelay,m=r.abrBandWidthFactor,y=r.abrBandWidthUpFactor;if(!h){const T=this.bitrateTestDelay;T&&(g=(l?Math.min(l,r.maxLoadingDelay):r.maxLoadingDelay)-T,v.trace(`[abr] bitrate test took ${Math.round(1e3*T)}ms, set first fragment max fetchDuration to ${Math.round(1e3*g)} ms`),m=y=1)}return d=this.findBestLevel(u,o,n,h+g,m,y),Math.max(d,0)}findBestLevel(e,t,s,n,r,o){var a;const{fragCurrent:l,partCurrent:c,lastLoadedFragLevel:u}=this,{levels:f}=this.hls,h=f[u],d=!!(h!=null&&(a=h.details)!=null&&a.live),g=h==null?void 0:h.codecSet,m=c?c.duration:l?l.duration:0,y=this.bwEstimator.getEstimateTTFB()/1e3;let T=t,x=-1;for(let S=s;S>=t;S--){const R=f[S];if(!R||g&&R.codecSet!==g){R&&(T=Math.min(S,T),x=Math.max(S,x));continue}x!==-1&&v.trace(`[abr] Skipped level(s) ${T}-${x} with CODECS:"${f[x].attrs.CODECS}"; not compatible with "${h.attrs.CODECS}"`);const b=R.details,M=(c?b==null?void 0:b.partTarget:b==null?void 0:b.averagetargetduration)||m;let P;S<=u?P=r*e:P=o*e;const B=f[S].maxBitrate,K=this.getTimeToLoadFrag(y,P,B*M,b===void 0);if(v.trace(`[abr] level:${S} adjustedbw-bitrate:${Math.round(P-B)} avgDuration:${M.toFixed(1)} maxFetchDuration:${n.toFixed(1)} fetchDuration:${K.toFixed(1)}`),P>B&&(K===0||!J(K)||d&&!this.bitrateTestDelay||K<n))return S}return-1}set nextAutoLevel(e){this._nextAutoLevel=e}}class Uu{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let s;if(e.length)e.length===1?s=e[0]:s=xy(e,t);else return new Uint8Array(0);return this.reset(),s}reset(){this.chunks.length=0,this.dataLength=0}}function xy(i,e){const t=new Uint8Array(e);let s=0;for(let n=0;n<i.length;n++){const r=i[n];t.set(r,s),s+=r.length}return t}const ul=100;class Ay extends po{constructor(e,t,s){super(e,t,s,"[audio-stream-controller]",ie.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.bufferFlushed=!1,this.cachedTrackLoadedData=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),this.mainDetails=null,this.bufferedTrack=null,this.switchingTrack=null}_registerListeners(){const{hls:e}=this;e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.LEVEL_LOADED,this.onLevelLoaded,this),e.on(p.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(p.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(p.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(p.ERROR,this.onError,this),e.on(p.BUFFER_RESET,this.onBufferReset,this),e.on(p.BUFFER_CREATED,this.onBufferCreated,this),e.on(p.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(p.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(p.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.LEVEL_LOADED,this.onLevelLoaded,this),e.off(p.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(p.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(p.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(p.ERROR,this.onError,this),e.off(p.BUFFER_RESET,this.onBufferReset,this),e.off(p.BUFFER_CREATED,this.onBufferCreated,this),e.off(p.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(p.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(p.FRAG_BUFFERED,this.onFragBuffered,this)}onInitPtsFound(e,{frag:t,id:s,initPTS:n,timescale:r}){if(s==="main"){const o=t.cc;this.initPTS[t.cc]={baseTime:n,timescale:r},this.log(`InitPTS for cc: ${o} found from main: ${n}`),this.videoTrackCC=o,this.state===F.WAITING_INIT_PTS&&this.tick()}}startLoad(e){if(!this.levels){this.startPosition=e,this.state=F.STOPPED;return}const t=this.lastCurrentTime;this.stopLoad(),this.setInterval(ul),t>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t,this.state=F.IDLE):(this.loadedmetadata=!1,this.state=F.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}doTick(){switch(this.state){case F.IDLE:this.doTickIdle();break;case F.WAITING_TRACK:{var e;const{levels:s,trackId:n}=this,r=s==null||(e=s[n])==null?void 0:e.details;if(r){if(this.waitForCdnTuneIn(r))break;this.state=F.WAITING_INIT_PTS}break}case F.FRAG_LOADING_WAITING_RETRY:{var t;const s=performance.now(),n=this.retryDate;(!n||s>=n||(t=this.media)!=null&&t.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded(this.trackId),this.state=F.IDLE);break}case F.WAITING_INIT_PTS:{const s=this.waitingData;if(s){const{frag:n,part:r,cache:o,complete:a}=s;if(this.initPTS[n.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=F.FRAG_LOADING;const l=o.flush(),c={frag:n,part:r,payload:l,networkDetails:null};this._handleFragmentLoadProgress(c),a&&super._handleFragmentLoadComplete(c)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log(`Waiting fragment cc (${n.cc}) cancelled because video is at cc ${this.videoTrackCC}`),this.clearWaitingFragment();else{const l=this.getLoadPosition(),c=De.bufferInfo(this.mediaBuffer,l,this.config.maxBufferHole);Cr(c.end,this.config.maxFragLookUpTolerance,n)<0&&(this.log(`Waiting fragment cc (${n.cc}) @ ${n.start} cancelled because another fragment at ${c.end} is needed`),this.clearWaitingFragment())}}else this.state=F.IDLE}}this.onTickEnd()}clearWaitingFragment(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=F.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:s,trackId:n}=this,r=e.config;if(!(t!=null&&t[n])||!s&&(this.startFragRequested||!r.startFragPrefetch))return;const o=t[n],a=o.details;if(!a||a.live&&this.levelLastLoaded!==n||this.waitForCdnTuneIn(a)){this.state=F.WAITING_TRACK;return}const l=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&l&&(this.bufferFlushed=!1,this.afterBufferFlushed(l,Re.AUDIO,ie.AUDIO));const c=this.getFwdBufferInfo(l,ie.AUDIO);if(c===null)return;const{bufferedTrack:u,switchingTrack:f}=this;if(!f&&this._streamEnded(c,a)){e.trigger(p.BUFFER_EOS,{type:"audio"}),this.state=F.ENDED;return}const h=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,ie.MAIN),d=c.len,g=this.getMaxBufferLength(h==null?void 0:h.len);if(d>=g&&!f)return;const y=a.fragments[0].start;let T=c.end;if(f&&s){const b=this.getLoadPosition();u&&f.attrs!==u.attrs&&(T=b),a.PTSKnown&&b<y&&(c.end>y||c.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),s.currentTime=y+.05)}let x=this.getNextFragment(T,a),S=!1;if(x&&this.isLoopLoading(x,T)&&(S=!!x.gap,x=this.getNextFragmentLoopLoading(x,a,c,ie.MAIN,g)),!x){this.bufferFlushed=!0;return}const R=h&&x.start>h.end+a.targetduration;if(R||!(h!=null&&h.len)&&c.len){const b=this.getAppendedFrag(x.start,ie.MAIN);if(b===null||(S||(S=!!b.gap||!!R&&h.len===0),R&&!S||S&&c.nextStart&&c.nextStart<b.end))return}this.loadFragment(x,o,T)}getMaxBufferLength(e){const t=super.getMaxBufferLength();return e?Math.min(Math.max(t,e),this.config.maxMaxBufferLength):t}onMediaDetaching(){this.videoBuffer=null,super.onMediaDetaching()}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(s=>new ri(s))}onAudioTrackSwitching(e,t){const s=!!t.url;this.trackId=t.id;const{fragCurrent:n}=this;n&&(n.abortRequests(),this.removeUnbufferedFrags(n.start)),this.resetLoadingState(),s?this.setInterval(ul):this.resetTransmuxer(),s?(this.switchingTrack=t,this.state=F.IDLE):(this.switchingTrack=null,this.bufferedTrack=t,this.state=F.STOPPED),this.tick()}onManifestLoading(){this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1,this.levels=this.mainDetails=this.waitingData=this.bufferedTrack=this.cachedTrackLoadedData=this.switchingTrack=null,this.startFragRequested=!1,this.trackId=this.videoTrackCC=this.waitingVideoCC=-1}onLevelLoaded(e,t){this.mainDetails=t.details,this.cachedTrackLoadedData!==null&&(this.hls.trigger(p.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)}onAudioTrackLoaded(e,t){var s;if(this.mainDetails==null){this.cachedTrackLoadedData=t;return}const{levels:n}=this,{details:r,id:o}=t;if(!n){this.warn(`Audio tracks were reset while loading level ${o}`);return}this.log(`Track ${o} loaded [${r.startSN},${r.endSN}]${r.lastPartSn?`[part-${r.lastPartSn}-${r.lastPartIndex}]`:""},duration:${r.totalduration}`);const a=n[o];let l=0;if(r.live||(s=a.details)!=null&&s.live){this.checkLiveUpdate(r);const c=this.mainDetails;if(r.deltaUpdateFailed||!c)return;!a.details&&r.hasProgramDateTime&&c.hasProgramDateTime?(Su(r,c),l=r.fragments[0].start):l=this.alignPlaylists(r,a.details)}a.details=r,this.levelLastLoaded=o,!this.startFragRequested&&(this.mainDetails||!r.live)&&this.setStartPosition(a.details,l),this.state===F.WAITING_TRACK&&!this.waitForCdnTuneIn(r)&&(this.state=F.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:s,part:n,payload:r}=e,{config:o,trackId:a,levels:l}=this;if(!l){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${s.sn} of level ${s.level} will not be buffered`);return}const c=l[a];if(!c){this.warn("Audio track is undefined on fragment load progress");return}const u=c.details;if(!u){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(s.start);return}const f=o.defaultAudioCodec||c.audioCodec||"mp4a.40.2";let h=this.transmuxer;h||(h=this.transmuxer=new Mu(this.hls,ie.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const d=this.initPTS[s.cc],g=(t=s.initSegment)==null?void 0:t.data;if(d!==void 0){const y=n?n.index:-1,T=y!==-1,x=new ho(s.level,s.sn,s.stats.chunkCount,r.byteLength,y,T);h.push(r,g,f,"",s,n,u.totalduration,!1,x,d)}else{this.log(`Unknown video PTS for cc ${s.cc}, waiting for video PTS before demuxing audio frag ${s.sn} of [${u.startSN} ,${u.endSN}],track ${a}`);const{cache:m}=this.waitingData=this.waitingData||{frag:s,part:n,cache:new Uu,complete:!1};m.push(new Uint8Array(r)),this.waitingVideoCC=this.videoTrackCC,this.state=F.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 s=t.tracks.audio;s&&(this.mediaBuffer=s.buffer||null),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer||null)}onFragBuffered(e,t){const{frag:s,part:n}=t;if(s.type!==ie.AUDIO){if(!this.loadedmetadata&&s.type===ie.MAIN){const r=this.videoBuffer||this.media;r&&De.getBuffered(r).length&&(this.loadedmetadata=!0)}return}if(this.fragContextChanged(s)){this.warn(`Fragment ${s.sn}${n?" p: "+n.index:""} of level ${s.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(s.sn!=="initSegment"){this.fragPrevious=s;const r=this.switchingTrack;r&&(this.bufferedTrack=r,this.switchingTrack=null,this.hls.trigger(p.AUDIO_TRACK_SWITCHED,tt({},r)))}this.fragBufferedComplete(s,n)}onError(e,t){var s;if(t.fatal){this.state=F.ERROR;return}switch(t.details){case D.FRAG_GAP:case D.FRAG_PARSING_ERROR:case D.FRAG_DECRYPT_ERROR:case D.FRAG_LOAD_ERROR:case D.FRAG_LOAD_TIMEOUT:case D.KEY_LOAD_ERROR:case D.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(ie.AUDIO,t);break;case D.AUDIO_TRACK_LOAD_ERROR:case D.AUDIO_TRACK_LOAD_TIMEOUT:case D.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===F.WAITING_TRACK&&((s=t.context)==null?void 0:s.type)===ye.AUDIO_TRACK&&(this.state=F.IDLE);break;case D.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case D.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushed(e,{type:t}){t===Re.AUDIO&&(this.bufferFlushed=!0,this.state===F.ENDED&&(this.state=F.IDLE))}_handleTransmuxComplete(e){var t;const s="audio",{hls:n}=this,{remuxResult:r,chunkMeta:o}=e,a=this.getCurrentContext(o);if(!a){this.resetWhenMissingContext(o);return}const{frag:l,part:c,level:u}=a,{details:f}=u,{audio:h,text:d,id3:g,initSegment:m}=r;if(this.fragContextChanged(l)||!f){this.fragmentTracker.removeFragment(l);return}if(this.state=F.PARSING,this.switchingTrack&&h&&this.completeAudioSwitch(this.switchingTrack),m!=null&&m.tracks){const y=l.initSegment||l;this._bufferInitSegment(m.tracks,y,o),n.trigger(p.FRAG_PARSING_INIT_SEGMENT,{frag:y,id:s,tracks:m.tracks})}if(h){const{startPTS:y,endPTS:T,startDTS:x,endDTS:S}=h;c&&(c.elementaryStreams[Re.AUDIO]={startPTS:y,endPTS:T,startDTS:x,endDTS:S}),l.setElementaryStreamInfo(Re.AUDIO,y,T,x,S),this.bufferFragmentData(h,l,c,o)}if(g!=null&&(t=g.samples)!=null&&t.length){const y=Me({id:s,frag:l,details:f},g);n.trigger(p.FRAG_PARSING_METADATA,y)}if(d){const y=Me({id:s,frag:l,details:f},d);n.trigger(p.FRAG_PARSING_USERDATA,y)}}_bufferInitSegment(e,t,s){if(this.state!==F.PARSING)return;e.video&&delete e.video;const n=e.audio;if(!n)return;n.levelCodec=n.codec,n.id="audio",this.log(`Init audio buffer, container:${n.container}, codecs[parsed]=[${n.codec}]`),this.hls.trigger(p.BUFFER_CODECS,e);const r=n.initSegment;if(r!=null&&r.byteLength){const o={type:"audio",frag:t,part:null,chunkMeta:s,parent:t.type,data:r};this.hls.trigger(p.BUFFER_APPENDING,o)}this.tick()}loadFragment(e,t,s){const n=this.fragmentTracker.getState(e);if(this.fragCurrent=e,this.switchingTrack||n===Ue.NOT_LOADED||n===Ue.PARTIAL){var r;e.sn==="initSegment"?this._loadInitSegment(e,t):(r=t.details)!=null&&r.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=F.WAITING_INIT_PTS):(this.startFragRequested=!0,super.loadFragment(e,t,s))}else this.clearTrackerIfNeeded(e)}completeAudioSwitch(e){const{hls:t,media:s,bufferedTrack:n}=this,r=n==null?void 0:n.attrs,o=e.attrs;s&&r&&(r.CHANNELS!==o.CHANNELS||r.NAME!==o.NAME||r.LANGUAGE!==o.LANGUAGE)&&(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio")),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(p.AUDIO_TRACK_SWITCHED,tt({},e))}}class Sy extends fo{constructor(e){super(e,"[audio-track-controller]"),this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.LEVEL_LOADING,this.onLevelLoading,this),e.on(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(p.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.LEVEL_LOADING,this.onLevelLoading,this),e.off(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(p.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(p.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){const{id:s,groupId:n,details:r}=t,o=this.tracksInGroup[s];if(!o||o.groupId!==n){this.warn(`Track with id:${s} and group:${n} not found in active group ${o.groupId}`);return}const a=o.details;o.details=t.details,this.log(`audio-track ${s} "${o.name}" lang:${o.lang} group:${n} loaded [${r.startSN}-${r.endSN}]`),s===this.trackId&&this.playlistLoaded(s,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!=null&&t.audioGroupIds))return;const s=t.audioGroupIds[t.urlId];if(this.groupId!==s){this.groupId=s||null;const n=this.tracks.filter(o=>!s||o.groupId===s);this.selectDefaultTrack&&!n.some(o=>o.default)&&(this.selectDefaultTrack=!1),this.tracksInGroup=n;const r={audioTracks:n};this.log(`Updating audio tracks, ${n.length} track(s) found in group:${s}`),this.hls.trigger(p.AUDIO_TRACKS_UPDATED,r),this.selectInitialTrack()}else this.shouldReloadPlaylist(this.currentTrack)&&this.setAudioTrack(this.trackId)}onError(e,t){t.fatal||!t.context||t.context.type===ye.AUDIO_TRACK&&t.context.id===this.trackId&&t.context.groupId===this.groupId&&(this.requestScheduled=-1,this.checkRetry(t))}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();const s=this.currentTrack;t[this.trackId];const n=t[e],{groupId:r,name:o}=n;if(this.log(`Switching to audio-track ${e} "${o}" lang:${n.lang} group:${r}`),this.trackId=e,this.currentTrack=n,this.selectDefaultTrack=!1,this.hls.trigger(p.AUDIO_TRACK_SWITCHING,tt({},n)),n.details&&!n.details.live)return;const a=this.switchParams(n.url,s==null?void 0:s.details);this.loadPlaylist(a)}selectInitialTrack(){const e=this.tracksInGroup,t=this.findTrackId(this.currentTrack)|this.findTrackId(null);if(t!==-1)this.setAudioTrack(t);else{const s=new Error(`No track found for running audio group-ID: ${this.groupId} track count: ${e.length}`);this.warn(s.message),this.hls.trigger(p.ERROR,{type:se.MEDIA_ERROR,details:D.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:s})}}findTrackId(e){const t=this.tracksInGroup;for(let s=0;s<t.length;s++){const n=t[s];if((!this.selectDefaultTrack||n.default)&&(!e||e.attrs["STABLE-RENDITION-ID"]!==void 0&&e.attrs["STABLE-RENDITION-ID"]===n.attrs["STABLE-RENDITION-ID"]||e.name===n.name&&e.lang===n.lang))return n.id}return-1}loadPlaylist(e){super.loadPlaylist();const t=this.tracksInGroup[this.trackId];if(this.shouldLoadPlaylist(t)){const s=t.id,n=t.groupId;let r=t.url;if(e)try{r=e.addDirectives(r)}catch(o){this.warn(`Could not construct new URL with HLS Delivery Directives: ${o}`)}this.log(`loading audio-track playlist ${s} "${t.name}" lang:${t.lang} group:${n}`),this.clearTimer(),this.hls.trigger(p.AUDIO_TRACK_LOADING,{url:r,id:s,groupId:n,deliveryDirectives:e||null})}}}function Bu(i,e){if(i.length!==e.length)return!1;for(let t=0;t<i.length;t++)if(!vy(i[t].attrs,e[t].attrs))return!1;return!0}function vy(i,e){const t=i["STABLE-RENDITION-ID"];return t?t===e["STABLE-RENDITION-ID"]:!["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED"].some(s=>i[s]!==e[s])}const fl=500;class Ry extends po{constructor(e,t,s){super(e,t,s,"[subtitle-stream-controller]",ie.SUBTITLE),this.levels=[],this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),this.mainDetails=null}_registerListeners(){const{hls:e}=this;e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.LEVEL_LOADED,this.onLevelLoaded,this),e.on(p.ERROR,this.onError,this),e.on(p.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(p.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(p.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(p.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(p.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.LEVEL_LOADED,this.onLevelLoaded,this),e.off(p.ERROR,this.onError,this),e.off(p.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(p.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(p.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(p.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(p.FRAG_BUFFERED,this.onFragBuffered,this)}startLoad(e){this.stopLoad(),this.state=F.IDLE,this.setInterval(fl),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:s,success:n}=t;if(this.fragPrevious=s,this.state=F.IDLE,!n)return;const r=this.tracksBuffered[this.currentTrackId];if(!r)return;let o;const a=s.start;for(let c=0;c<r.length;c++)if(a>=r[c].start&&a<=r[c].end){o=r[c];break}const l=s.start+s.duration;o?o.end=l:(o={start:a,end:l},r.push(o)),this.fragmentTracker.fragBuffered(s)}onBufferFlushing(e,t){const{startOffset:s,endOffset:n}=t;if(s===0&&n!==Number.POSITIVE_INFINITY){const r=n-1;if(r<=0)return;t.endOffsetSubtitles=Math.max(0,r),this.tracksBuffered.forEach(o=>{for(let a=0;a<o.length;){if(o[a].end<=r){o.shift();continue}else if(o[a].start<r)o[a].start=r;else break;a++}}),this.fragmentTracker.removeFragmentsInRange(s,r,ie.SUBTITLE)}}onFragBuffered(e,t){if(!this.loadedmetadata&&t.frag.type===ie.MAIN){var s;(s=this.media)!=null&&s.buffered.length&&(this.loadedmetadata=!0)}}onError(e,t){const s=t.frag;(s==null?void 0:s.type)===ie.SUBTITLE&&(this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==F.STOPPED&&(this.state=F.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(Bu(this.levels,t)){this.levels=t.map(s=>new ri(s));return}this.tracksBuffered=[],this.levels=t.map(s=>{const n=new ri(s);return this.tracksBuffered[n.id]=[],n}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,ie.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){if(this.currentTrackId=t.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}const s=this.levels[this.currentTrackId];s!=null&&s.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,s&&this.setInterval(fl)}onSubtitleTrackLoaded(e,t){var s;const{details:n,id:r}=t,{currentTrackId:o,levels:a}=this;if(!a.length)return;const l=a[o];if(r>=a.length||r!==o||!l)return;this.mediaBuffer=this.mediaBufferTimeRanges;let c=0;if(n.live||(s=l.details)!=null&&s.live){const u=this.mainDetails;if(n.deltaUpdateFailed||!u)return;const f=u.fragments[0];l.details?(c=this.alignPlaylists(n,l.details),c===0&&f&&(c=f.start,Dr(n,c))):n.hasProgramDateTime&&u.hasProgramDateTime?(Su(n,u),c=n.fragments[0].start):f&&(c=f.start,Dr(n,c))}l.details=n,this.levelLastLoaded=r,!this.startFragRequested&&(this.mainDetails||!n.live)&&this.setStartPosition(l.details,c),this.tick(),n.live&&!this.fragCurrent&&this.media&&this.state===F.IDLE&&(oi(null,n.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),l.details=void 0))}_handleFragmentLoadComplete(e){const{frag:t,payload:s}=e,n=t.decryptdata,r=this.hls;if(!this.fragContextChanged(t)&&s&&s.byteLength>0&&n&&n.key&&n.iv&&n.method==="AES-128"){const o=performance.now();this.decrypter.decrypt(new Uint8Array(s),n.key.buffer,n.iv.buffer).catch(a=>{throw r.trigger(p.ERROR,{type:se.MEDIA_ERROR,details:D.FRAG_DECRYPT_ERROR,fatal:!1,error:a,reason:a.message,frag:t}),a}).then(a=>{const l=performance.now();r.trigger(p.FRAG_DECRYPTED,{frag:t,payload:a,stats:{tstart:o,tdecrypt:l}})}).catch(a=>{this.warn(`${a.name}: ${a.message}`),this.state=F.IDLE})}}doTick(){if(!this.media){this.state=F.IDLE;return}if(this.state===F.IDLE){const{currentTrackId:e,levels:t}=this,s=t[e];if(!t.length||!s||!s.details)return;const{config:n}=this,r=this.getLoadPosition(),o=De.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],r,n.maxBufferHole),{end:a,len:l}=o,c=this.getFwdBufferInfo(this.media,ie.MAIN),u=s.details,f=this.getMaxBufferLength(c==null?void 0:c.len)+u.levelTargetDuration;if(l>f)return;const h=u.fragments,d=h.length,g=u.edge;let m=null;const y=this.fragPrevious;if(a<g){const T=n.maxFragLookUpTolerance,x=a>g-T?0:T;m=oi(y,h,Math.max(h[0].start,a),x),!m&&y&&y.start<h[0].start&&(m=h[0])}else m=h[d-1];if(!m)return;if(m=this.mapToInitFragWhenRequired(m),m.sn!=="initSegment"){const T=m.sn-u.startSN,x=h[T-1];x&&x.cc===m.cc&&this.fragmentTracker.getState(x)===Ue.NOT_LOADED&&(m=x)}this.fragmentTracker.getState(m)===Ue.NOT_LOADED&&this.loadFragment(m,s,a)}}getMaxBufferLength(e){const t=super.getMaxBufferLength();return e?Math.max(t,e):t}loadFragment(e,t,s){this.fragCurrent=e,e.sn==="initSegment"?this._loadInitSegment(e,t):(this.startFragRequested=!0,super.loadFragment(e,t,s))}get mediaBufferTimeRanges(){return new Ly(this.tracksBuffered[this.currentTrackId]||[])}}class Ly{constructor(e){this.buffered=void 0;const t=(s,n,r)=>{if(n=n>>>0,n>r-1)throw new DOMException(`Failed to execute '${s}' on 'TimeRanges': The index provided (${n}) is greater than the maximum bound (${r})`);return e[n][s]};this.buffered={get length(){return e.length},end(s){return t("end",s,e.length)},start(s){return t("start",s,e.length)}}}}class by extends fo{constructor(e){super(e,"[subtitle-track-controller]"),this.media=null,this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.trackChangeListener=()=>this.onTextTracksChanged(),this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes(this.trackId)}registerListeners(){const{hls:e}=this;e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.LEVEL_LOADING,this.onLevelLoading,this),e.on(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(p.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.LEVEL_LOADING,this.onLevelLoading,this),e.off(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(p.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(p.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,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),zn(this.media.textTracks).forEach(t=>{Ts(t)}),this.subtitleTrack=-1,this.media=null}onManifestLoading(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:s,details:n}=t,{trackId:r}=this,o=this.tracksInGroup[r];if(!o){this.warn(`Invalid subtitle track id ${s}`);return}const a=o.details;o.details=t.details,this.log(`subtitle track ${s} loaded [${n.startSN}-${n.endSN}]`),s===this.trackId&&this.playlistLoaded(s,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!=null&&t.textGroupIds))return;const s=t.textGroupIds[t.urlId],n=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;if(this.groupId!==s){const r=this.tracks.filter(l=>!s||l.groupId===s);this.tracksInGroup=r;const o=this.findTrackId(n==null?void 0:n.name)||this.findTrackId();this.groupId=s||null;const a={subtitleTracks:r};this.log(`Updating subtitle tracks, ${r.length} track(s) found in "${s}" group-id`),this.hls.trigger(p.SUBTITLE_TRACKS_UPDATED,a),o!==-1&&this.setSubtitleTrack(o,n)}else this.shouldReloadPlaylist(n)&&this.setSubtitleTrack(this.trackId,n)}findTrackId(e){const t=this.tracksInGroup;for(let s=0;s<t.length;s++){const n=t[s];if((!this.selectDefaultTrack||n.default)&&(!e||e===n.name))return n.id}return-1}onError(e,t){t.fatal||!t.context||t.context.type===ye.SUBTITLE_TRACK&&t.context.id===this.trackId&&t.context.groupId===this.groupId&&this.checkRetry(t)}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(e){this.selectDefaultTrack=!1;const t=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(e,t)}loadPlaylist(e){super.loadPlaylist();const t=this.tracksInGroup[this.trackId];if(this.shouldLoadPlaylist(t)){const s=t.id,n=t.groupId;let r=t.url;if(e)try{r=e.addDirectives(r)}catch(o){this.warn(`Could not construct new URL with HLS Delivery Directives: ${o}`)}this.log(`Loading subtitle playlist for id ${s}`),this.hls.trigger(p.SUBTITLE_TRACK_LOADING,{url:r,id:s,groupId:n,deliveryDirectives:e||null})}}toggleTrackModes(e){const{media:t,trackId:s}=this;if(!t)return;const n=zn(t.textTracks),r=n.filter(a=>a.groupId===this.groupId);if(e===-1)[].slice.call(n).forEach(a=>{a.mode="disabled"});else{const a=r[s];a&&(a.mode="disabled")}const o=r[e];o&&(o.mode=this.subtitleDisplay?"showing":"hidden")}setSubtitleTrack(e,t){var s;const n=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(this.trackId!==e&&this.toggleTrackModes(e),this.trackId===e&&(e===-1||(s=n[e])!=null&&s.details)||e<-1||e>=n.length)return;this.clearTimer();const r=n[e];if(this.log(`Switching to subtitle-track ${e}`+(r?` "${r.name}" lang:${r.lang} group:${r.groupId}`:"")),this.trackId=e,r){const{id:o,groupId:a="",name:l,type:c,url:u}=r;this.hls.trigger(p.SUBTITLE_TRACK_SWITCH,{id:o,groupId:a,name:l,type:c,url:u});const f=this.switchParams(r.url,t==null?void 0:t.details);this.loadPlaylist(f)}else this.hls.trigger(p.SUBTITLE_TRACK_SWITCH,{id:e})}onTextTracksChanged(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let e=-1;const t=zn(this.media.textTracks);for(let s=0;s<t.length;s++)if(t[s].mode==="hidden")e=s;else if(t[s].mode==="showing"){e=s;break}this.subtitleTrack!==e&&(this.subtitleTrack=e)}}function zn(i){const e=[];for(let t=0;t<i.length;t++){const s=i[t];(s.kind==="subtitles"||s.kind==="captions")&&s.label&&e.push(i[t])}return e}class Iy{constructor(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}append(e,t){const s=this.queues[t];s.push(e),s.length===1&&this.buffers[t]&&this.executeNext(t)}insertAbort(e,t){this.queues[t].unshift(e),this.executeNext(t)}appendBlocker(e){let t;const s=new Promise(r=>{t=r}),n={execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};return this.append(n,e),s}executeNext(e){const{buffers:t,queues:s}=this,n=t[e],r=s[e];if(r.length){const o=r[0];try{o.execute()}catch(a){v.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),o.onError(a),n!=null&&n.updating||(r.shift(),this.executeNext(e))}}}shiftAndExecuteNext(e){this.queues[e].shift(),this.executeNext(e)}current(e){return this.queues[e][0]}}const hl=En(),dl=/([ha]vc.)(?:\.[^.,]+)+/;class Dy{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.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=()=>{const{media:t,mediaSource:s}=this;v.log("[buffer-controller]: Media source opened"),t&&(t.removeEventListener("emptied",this._onMediaEmptied),this.updateMediaElementDuration(),this.hls.trigger(p.MEDIA_ATTACHED,{media:t})),s&&s.removeEventListener("sourceopen",this._onMediaSourceOpen),this.checkPendingTracks()},this._onMediaSourceClose=()=>{v.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=()=>{v.log("[buffer-controller]: Media source ended")},this._onMediaEmptied=()=>{const{media:t,_objectUrl:s}=this;t&&t.src!==s&&v.error(`Media element src was set while attaching MediaSource (${s} > ${t.src})`)},this.hls=e,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}registerListeners(){const{hls:e}=this;e.on(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.BUFFER_RESET,this.onBufferReset,this),e.on(p.BUFFER_APPENDING,this.onBufferAppending,this),e.on(p.BUFFER_CODECS,this.onBufferCodecs,this),e.on(p.BUFFER_EOS,this.onBufferEos,this),e.on(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(p.FRAG_PARSED,this.onFragParsed,this),e.on(p.FRAG_CHANGED,this.onFragChanged,this)}unregisterListeners(){const{hls:e}=this;e.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.BUFFER_RESET,this.onBufferReset,this),e.off(p.BUFFER_APPENDING,this.onBufferAppending,this),e.off(p.BUFFER_CODECS,this.onBufferCodecs,this),e.off(p.BUFFER_EOS,this.onBufferEos,this),e.off(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(p.FRAG_PARSED,this.onFragParsed,this),e.off(p.FRAG_CHANGED,this.onFragChanged,this)}_initSourceBuffer(){this.sourceBuffer={},this.operationQueue=new Iy(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.lastMpegAudioChunk=null}onManifestLoading(){this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){let s=2;(t.audio&&!t.video||!t.altAudio)&&(s=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=s,v.log(`${this.bufferCodecEventsExpected} bufferCodec event(s) expected`)}onMediaAttaching(e,t){const s=this.media=t.media;if(s&&hl){const n=this.mediaSource=new hl;n.addEventListener("sourceopen",this._onMediaSourceOpen),n.addEventListener("sourceended",this._onMediaSourceEnded),n.addEventListener("sourceclose",this._onMediaSourceClose),s.src=self.URL.createObjectURL(n),this._objectUrl=s.src,s.addEventListener("emptied",this._onMediaEmptied)}}onMediaDetaching(){const{media:e,mediaSource:t,_objectUrl:s}=this;if(t){if(v.log("[buffer-controller]: media source detaching"),t.readyState==="open")try{t.endOfStream()}catch(n){v.warn(`[buffer-controller]: onMediaDetaching: ${n.message} while calling endOfStream`)}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),e&&(e.removeEventListener("emptied",this._onMediaEmptied),s&&self.URL.revokeObjectURL(s),e.src===s?(e.removeAttribute("src"),e.load()):v.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(p.MEDIA_DETACHED,void 0)}onBufferReset(){this.getSourceBufferTypes().forEach(e=>{const t=this.sourceBuffer[e];try{t&&(this.removeBufferListeners(e),this.mediaSource&&this.mediaSource.removeSourceBuffer(t),this.sourceBuffer[e]=void 0)}catch(s){v.warn(`[buffer-controller]: Failed to reset the ${e} buffer`,s)}}),this._initSourceBuffer()}onBufferCodecs(e,t){const s=this.getSourceBufferTypes().length;Object.keys(t).forEach(n=>{if(s){const r=this.tracks[n];if(r&&typeof r.buffer.changeType=="function"){const{id:o,codec:a,levelCodec:l,container:c,metadata:u}=t[n],f=(r.levelCodec||r.codec).replace(dl,"$1"),h=(l||a).replace(dl,"$1");if(f!==h){const d=`${c};codecs=${l||a}`;this.appendChangeType(n,d),v.log(`[buffer-controller]: switching codec ${f} to ${h}`),this.tracks[n]={buffer:r.buffer,codec:a,container:c,levelCodec:l,metadata:u,id:o}}}}else this.pendingTracks[n]=t[n]}),!s&&(this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks())}appendChangeType(e,t){const{operationQueue:s}=this,n={execute:()=>{const r=this.sourceBuffer[e];r&&(v.log(`[buffer-controller]: changing ${e} sourceBuffer type to ${t}`),r.changeType(t)),s.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:r=>{v.warn(`[buffer-controller]: Failed to change ${e} SourceBuffer type`,r)}};s.append(n,e)}onBufferAppending(e,t){const{hls:s,operationQueue:n,tracks:r}=this,{data:o,type:a,frag:l,part:c,chunkMeta:u}=t,f=u.buffering[a],h=self.performance.now();f.start=h;const d=l.stats.buffering,g=c?c.stats.buffering:null;d.start===0&&(d.start=h),g&&g.start===0&&(g.start=h);const m=r.audio;let y=!1;a==="audio"&&(m==null?void 0:m.container)==="audio/mpeg"&&(y=!this.lastMpegAudioChunk||u.id===1||this.lastMpegAudioChunk.sn!==u.sn,this.lastMpegAudioChunk=u);const T=l.start,x={execute:()=>{if(f.executeStart=self.performance.now(),y){const S=this.sourceBuffer[a];if(S){const R=T-S.timestampOffset;Math.abs(R)>=.1&&(v.log(`[buffer-controller]: Updating audio SourceBuffer timestampOffset to ${T} (delta: ${R}) sn: ${l.sn})`),S.timestampOffset=T)}}this.appendExecutor(o,a)},onStart:()=>{},onComplete:()=>{const S=self.performance.now();f.executeEnd=f.end=S,d.first===0&&(d.first=S),g&&g.first===0&&(g.first=S);const{sourceBuffer:R}=this,b={};for(const M in R)b[M]=De.getBuffered(R[M]);this.appendError=0,this.hls.trigger(p.BUFFER_APPENDED,{type:a,frag:l,part:c,chunkMeta:u,parent:l.type,timeRanges:b})},onError:S=>{v.error(`[buffer-controller]: Error encountered while trying to append to the ${a} SourceBuffer`,S);const R={type:se.MEDIA_ERROR,parent:l.type,details:D.BUFFER_APPEND_ERROR,frag:l,part:c,chunkMeta:u,error:S,err:S,fatal:!1};S.code===DOMException.QUOTA_EXCEEDED_ERR?R.details=D.BUFFER_FULL_ERROR:(this.appendError++,R.details=D.BUFFER_APPEND_ERROR,this.appendError>s.config.appendErrorMaxRetry&&(v.error(`[buffer-controller]: Failed ${s.config.appendErrorMaxRetry} times to append segment in sourceBuffer`),R.fatal=!0)),s.trigger(p.ERROR,R)}};n.append(x,a)}onBufferFlushing(e,t){const{operationQueue:s}=this,n=r=>({execute:this.removeExecutor.bind(this,r,t.startOffset,t.endOffset),onStart:()=>{},onComplete:()=>{this.hls.trigger(p.BUFFER_FLUSHED,{type:r})},onError:o=>{v.warn(`[buffer-controller]: Failed to remove from ${r} SourceBuffer`,o)}});t.type?s.append(n(t.type),t.type):this.getSourceBufferTypes().forEach(r=>{s.append(n(r),r)})}onFragParsed(e,t){const{frag:s,part:n}=t,r=[],o=n?n.elementaryStreams:s.elementaryStreams;o[Re.AUDIOVIDEO]?r.push("audiovideo"):(o[Re.AUDIO]&&r.push("audio"),o[Re.VIDEO]&&r.push("video"));const a=()=>{const l=self.performance.now();s.stats.buffering.end=l,n&&(n.stats.buffering.end=l);const c=n?n.stats:s.stats;this.hls.trigger(p.FRAG_BUFFERED,{frag:s,part:n,stats:c,id:s.type})};r.length===0&&v.warn(`Fragments must have at least one ElementaryStreamType set. type: ${s.type} level: ${s.level} sn: ${s.sn}`),this.blockBuffers(a,r)}onFragChanged(e,t){this.flushBackBuffer()}onBufferEos(e,t){this.getSourceBufferTypes().reduce((n,r)=>{const o=this.sourceBuffer[r];return o&&(!t.type||t.type===r)&&(o.ending=!0,o.ended||(o.ended=!0,v.log(`[buffer-controller]: ${r} sourceBuffer now EOS`))),n&&!!(!o||o.ended)},!0)&&(v.log("[buffer-controller]: Queueing mediaSource.endOfStream()"),this.blockBuffers(()=>{this.getSourceBufferTypes().forEach(r=>{const o=this.sourceBuffer[r];o&&(o.ending=!1)});const{mediaSource:n}=this;if(!n||n.readyState!=="open"){n&&v.info(`[buffer-controller]: Could not call mediaSource.endOfStream(). mediaSource.readyState: ${n.readyState}`);return}v.log("[buffer-controller]: Calling mediaSource.endOfStream()"),n.endOfStream()}))}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())}flushBackBuffer(){const{hls:e,details:t,media:s,sourceBuffer:n}=this;if(!s||t===null)return;const r=this.getSourceBufferTypes();if(!r.length)return;const o=t.live&&e.config.liveBackBufferLength!==null?e.config.liveBackBufferLength:e.config.backBufferLength;if(!J(o)||o<0)return;const a=s.currentTime,l=t.levelTargetDuration,c=Math.max(o,l),u=Math.floor(a/l)*l-c;r.forEach(f=>{const h=n[f];if(h){const d=De.getBuffered(h);if(d.length>0&&u>d.start(0)){if(e.trigger(p.BACK_BUFFER_REACHED,{bufferEnd:u}),t.live)e.trigger(p.LIVE_BACK_BUFFER_REACHED,{bufferEnd:u});else if(h.ended&&d.end(d.length-1)-a<l*2){v.info(`[buffer-controller]: Cannot flush ${f} back buffer while SourceBuffer is in ended state`);return}e.trigger(p.BUFFER_FLUSHING,{startOffset:0,endOffset:u,type:f})}}})}updateMediaElementDuration(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;const{details:e,hls:t,media:s,mediaSource:n}=this,r=e.fragments[0].start+e.totalduration,o=s.duration,a=J(n.duration)?n.duration:0;e.live&&t.config.liveDurationInfinity?(v.log("[buffer-controller]: Media Source duration is set to Infinity"),n.duration=1/0,this.updateSeekableRange(e)):(r>a&&r>o||!J(o))&&(v.log(`[buffer-controller]: Updating Media Source duration to ${r.toFixed(3)}`),n.duration=r)}updateSeekableRange(e){const t=this.mediaSource,s=e.fragments;if(s.length&&e.live&&t!=null&&t.setLiveSeekableRange){const r=Math.max(0,s[0].start),o=Math.max(r,r+e.totalduration);t.setLiveSeekableRange(r,o)}}checkPendingTracks(){const{bufferCodecEventsExpected:e,operationQueue:t,pendingTracks:s}=this,n=Object.keys(s).length;if(n&&!e||n===2){this.createSourceBuffers(s),this.pendingTracks={};const r=this.getSourceBufferTypes();if(r.length)this.hls.trigger(p.BUFFER_CREATED,{tracks:this.tracks}),r.forEach(o=>{t.executeNext(o)});else{const o=new Error("could not create source buffer for media codec(s)");this.hls.trigger(p.ERROR,{type:se.MEDIA_ERROR,details:D.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:o,reason:o.message})}}}createSourceBuffers(e){const{sourceBuffer:t,mediaSource:s}=this;if(!s)throw Error("createSourceBuffers called when mediaSource was null");for(const n in e)if(!t[n]){const r=e[n];if(!r)throw Error(`source buffer exists for track ${n}, however track does not`);const o=r.levelCodec||r.codec,a=`${r.container};codecs=${o}`;v.log(`[buffer-controller]: creating sourceBuffer(${a})`);try{const l=t[n]=s.addSourceBuffer(a),c=n;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.tracks[n]={buffer:l,codec:o,container:r.container,levelCodec:r.levelCodec,metadata:r.metadata,id:r.id}}catch(l){v.error(`[buffer-controller]: error while trying to add sourceBuffer: ${l.message}`),this.hls.trigger(p.ERROR,{type:se.MEDIA_ERROR,details:D.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:l,mimeType:a})}}}_onSBUpdateStart(e){const{operationQueue:t}=this;t.current(e).onStart()}_onSBUpdateEnd(e){const{operationQueue:t}=this;t.current(e).onComplete(),t.shiftAndExecuteNext(e)}_onSBUpdateError(e,t){const s=new Error(`${e} SourceBuffer error`);v.error(`[buffer-controller]: ${s}`,t),this.hls.trigger(p.ERROR,{type:se.MEDIA_ERROR,details:D.BUFFER_APPENDING_ERROR,error:s,fatal:!1});const n=this.operationQueue.current(e);n&&n.onError(t)}removeExecutor(e,t,s){const{media:n,mediaSource:r,operationQueue:o,sourceBuffer:a}=this,l=a[e];if(!n||!r||!l){v.warn(`[buffer-controller]: Attempting to remove from the ${e} SourceBuffer, but it does not exist`),o.shiftAndExecuteNext(e);return}const c=J(n.duration)?n.duration:1/0,u=J(r.duration)?r.duration:1/0,f=Math.max(0,t),h=Math.min(s,c,u);h>f&&!l.ending?(l.ended=!1,v.log(`[buffer-controller]: Removing [${f},${h}] from the ${e} SourceBuffer`),l.remove(f,h)):o.shiftAndExecuteNext(e)}appendExecutor(e,t){const{operationQueue:s,sourceBuffer:n}=this,r=n[t];if(!r){v.warn(`[buffer-controller]: Attempting to append to the ${t} SourceBuffer, but it does not exist`),s.shiftAndExecuteNext(t);return}r.ended=!1,r.appendBuffer(e)}blockBuffers(e,t=this.getSourceBufferTypes()){if(!t.length){v.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);return}const{operationQueue:s}=this,n=t.map(r=>s.appendBlocker(r));Promise.all(n).then(()=>{e(),t.forEach(r=>{const o=this.sourceBuffer[r];o!=null&&o.updating||s.shiftAndExecuteNext(r)})})}getSourceBufferTypes(){return Object.keys(this.sourceBuffer)}addBufferListener(e,t,s){const n=this.sourceBuffer[e];if(!n)return;const r=s.bind(this,e);this.listeners[e].push({event:t,listener:r}),n.addEventListener(t,r)}removeBufferListeners(e){const t=this.sourceBuffer[e];t&&this.listeners[e].forEach(s=>{t.removeEventListener(s.event,s.listener)})}}const gl={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},$u=function(e){let t=e;return gl.hasOwnProperty(e)&&(t=gl[e]),String.fromCharCode(t)},ut=15,_t=100,Cy={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},wy={17:2,18:4,21:6,22:8,23:10,19:13,20:15},_y={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},Py={25:2,26:4,29:6,30:8,31:10,27:13,28:15},ky=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class Oy{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const s=typeof t=="function"?t():t;v.log(`${this.time} [${e}] ${s}`)}}}const es=function(e){const t=[];for(let s=0;s<e.length;s++)t.push(e[s].toString(16));return t};class Gu{constructor(e,t,s,n,r){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=e||"white",this.underline=t||!1,this.italics=s||!1,this.background=n||"black",this.flash=r||!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 s=0;s<t.length;s++){const n=t[s];e.hasOwnProperty(n)&&(this[n]=e[n])}}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 Fy{constructor(e,t,s,n,r,o){this.uchar=void 0,this.penState=void 0,this.uchar=e||" ",this.penState=new Gu(t,s,n,r,o)}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 Ny{constructor(e){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(let t=0;t<_t;t++)this.chars.push(new Fy);this.logger=e,this.pos=0,this.currPenState=new Gu}equals(e){let t=!0;for(let s=0;s<_t;s++)if(!this.chars[s].equals(e.chars[s])){t=!1;break}return t}copy(e){for(let t=0;t<_t;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<_t;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>_t&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=_t)}moveCursor(e){const t=this.pos+e;if(e>1)for(let s=this.pos+1;s<t+1;s++)this.chars[s].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=$u(e);if(this.pos>=_t){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<_t;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 s=0;s<_t;s++){const n=this.chars[s].uchar;n!==" "&&(t=!1),e.push(n)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}class Xn{constructor(e){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(let t=0;t<ut;t++)this.rows.push(new Ny(e));this.logger=e,this.currRow=ut-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}reset(){for(let e=0;e<ut;e++)this.rows[e].clear();this.currRow=ut-1}equals(e){let t=!0;for(let s=0;s<ut;s++)if(!this.rows[s].equals(e.rows[s])){t=!1;break}return t}copy(e){for(let t=0;t<ut;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<ut;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<ut;a++)this.rows[a].clear();const r=this.currRow+1-this.nrRollUpRows,o=this.lastOutputScreen;if(o){const a=o.rows[r].cueStartTime,l=this.logger.time;if(a&&l!==null&&a<l)for(let c=0;c<this.nrRollUpRows;c++)this.rows[t-this.nrRollUpRows+c+1].copy(o.rows[r+c])}}this.currRow=t;const s=this.rows[this.currRow];if(e.indent!==null){const r=e.indent,o=Math.max(r-1,0);s.setCursor(e.indent),e.color=s.chars[o].penState.foreground}const n={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(n)}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 s="",n=-1;for(let r=0;r<ut;r++){const o=this.rows[r].getTextString();o&&(n=r+1,e?t.push("Row "+n+": '"+o+"'"):t.push(o.trim()))}return t.length>0&&(e?s="["+t.join(" | ")+"]":s=t.join(`
`)),s}getTextAndFormat(){return this.rows}}class ml{constructor(e,t,s){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 Xn(s),this.nonDisplayedMemory=new Xn(s),this.lastOutputScreen=new Xn(s),this.currRollUpRow=this.displayedMemory.rows[ut-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=s}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[ut-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 s=0;s<e.length;s++)this.writeScreen.insertChar(e[s]);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 s=Math.floor(e/2)-16,n=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=n[s]}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 pl{constructor(e,t,s){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;const n=new Oy;this.channels=[null,new ml(e,t,n),new ml(e+1,s,n)],this.cmdHistory=Tl(),this.logger=n}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){let s,n,r,o=!1;this.logger.time=e;for(let a=0;a<t.length;a+=2)if(n=t[a]&127,r=t[a+1]&127,!(n===0&&r===0)){if(this.logger.log(3,"["+es([t[a],t[a+1]])+"] -> ("+es([n,r])+")"),s=this.parseCmd(n,r),s||(s=this.parseMidrow(n,r)),s||(s=this.parsePAC(n,r)),s||(s=this.parseBackgroundAttributes(n,r)),!s&&(o=this.parseChars(n,r),o)){const l=this.currentChannel;l&&l>0?this.channels[l].insertChars(o):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!s&&!o&&this.logger.log(2,"Couldn't parse cleaned data "+es([n,r])+" orig: "+es([t[a],t[a+1]]))}}parseCmd(e,t){const{cmdHistory:s}=this,n=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,r=(e===23||e===31)&&t>=33&&t<=35;if(!(n||r))return!1;if(yl(e,t,s))return ms(null,null,s),this.logger.log(3,"Repeated command ("+es([e,t])+") is dropped"),!0;const o=e===20||e===21||e===23?1:2,a=this.channels[o];return e===20||e===21||e===28||e===29?t===32?a.ccRCL():t===33?a.ccBS():t===34?a.ccAOF():t===35?a.ccAON():t===36?a.ccDER():t===37?a.ccRU(2):t===38?a.ccRU(3):t===39?a.ccRU(4):t===40?a.ccFON():t===41?a.ccRDC():t===42?a.ccTR():t===43?a.ccRTD():t===44?a.ccEDM():t===45?a.ccCR():t===46?a.ccENM():t===47&&a.ccEOC():a.ccTO(t-32),ms(e,t,s),this.currentChannel=o,!0}parseMidrow(e,t){let s=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?s=1:s=2,s!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const n=this.channels[s];return n?(n.ccMIDROW(t),this.logger.log(3,"MIDROW ("+es([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let s;const n=this.cmdHistory,r=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,o=(e===16||e===24)&&t>=64&&t<=95;if(!(r||o))return!1;if(yl(e,t,n))return ms(null,null,n),!0;const a=e<=23?1:2;t>=64&&t<=95?s=a===1?Cy[e]:_y[e]:s=a===1?wy[e]:Py[e];const l=this.channels[a];return l?(l.setPAC(this.interpretPAC(s,t)),ms(e,t,n),this.currentChannel=a,!0):!1}interpretPAC(e,t){let s;const n={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?s=t-96:s=t-64,n.underline=(s&1)===1,s<=13?n.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(s/2)]:s<=15?(n.italics=!0,n.color="white"):n.indent=Math.floor((s-16)/2)*4,n}parseChars(e,t){let s,n=null,r=null;if(e>=25?(s=2,r=e-8):(s=1,r=e),r>=17&&r<=19){let o;r===17?o=t+80:r===18?o=t+112:o=t+144,this.logger.log(2,"Special char '"+$u(o)+"' in channel "+s),n=[o]}else e>=32&&e<=127&&(n=t===0?[e]:[e,t]);if(n){const o=es(n);this.logger.log(3,"Char codes = "+o.join(",")),ms(e,t,this.cmdHistory)}return n}parseBackgroundAttributes(e,t){const s=(e===16||e===24)&&t>=32&&t<=47,n=(e===23||e===31)&&t>=45&&t<=47;if(!(s||n))return!1;let r;const o={};e===16||e===24?(r=Math.floor((t-32)/2),o.background=ky[r],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),ms(e,t,this.cmdHistory),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){const t=this.channels[e];t&&t.reset()}this.cmdHistory=Tl()}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){const s=this.channels[t];s&&s.cueSplitAtTime(e)}}}function ms(i,e,t){t.a=i,t.b=e}function yl(i,e,t){return t.a===i&&t.b===e}function Tl(){return{a:null,b:null}}class Si{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,s){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=s,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}var Ao=function(){if(typeof self<"u"&&self.VTTCue)return self.VTTCue;const i=["","lr","rl"],e=["start","middle","end","left","right"];function t(a,l){if(typeof l!="string"||!Array.isArray(a))return!1;const c=l.toLowerCase();return~a.indexOf(c)?c:!1}function s(a){return t(i,a)}function n(a){return t(e,a)}function r(a,...l){let c=1;for(;c<arguments.length;c++){const u=arguments[c];for(const f in u)a[f]=u[f]}return a}function o(a,l,c){const u=this,f={enumerable:!0};u.hasBeenReset=!1;let h="",d=!1,g=a,m=l,y=c,T=null,x="",S=!0,R="auto",b="start",M=50,P="middle",B=50,K="middle";Object.defineProperty(u,"id",r({},f,{get:function(){return h},set:function(C){h=""+C}})),Object.defineProperty(u,"pauseOnExit",r({},f,{get:function(){return d},set:function(C){d=!!C}})),Object.defineProperty(u,"startTime",r({},f,{get:function(){return g},set:function(C){if(typeof C!="number")throw new TypeError("Start time must be set to a number.");g=C,this.hasBeenReset=!0}})),Object.defineProperty(u,"endTime",r({},f,{get:function(){return m},set:function(C){if(typeof C!="number")throw new TypeError("End time must be set to a number.");m=C,this.hasBeenReset=!0}})),Object.defineProperty(u,"text",r({},f,{get:function(){return y},set:function(C){y=""+C,this.hasBeenReset=!0}})),Object.defineProperty(u,"region",r({},f,{get:function(){return T},set:function(C){T=C,this.hasBeenReset=!0}})),Object.defineProperty(u,"vertical",r({},f,{get:function(){return x},set:function(C){const q=s(C);if(q===!1)throw new SyntaxError("An invalid or illegal string was specified.");x=q,this.hasBeenReset=!0}})),Object.defineProperty(u,"snapToLines",r({},f,{get:function(){return S},set:function(C){S=!!C,this.hasBeenReset=!0}})),Object.defineProperty(u,"line",r({},f,{get:function(){return R},set:function(C){if(typeof C!="number"&&C!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");R=C,this.hasBeenReset=!0}})),Object.defineProperty(u,"lineAlign",r({},f,{get:function(){return b},set:function(C){const q=n(C);if(!q)throw new SyntaxError("An invalid or illegal string was specified.");b=q,this.hasBeenReset=!0}})),Object.defineProperty(u,"position",r({},f,{get:function(){return M},set:function(C){if(C<0||C>100)throw new Error("Position must be between 0 and 100.");M=C,this.hasBeenReset=!0}})),Object.defineProperty(u,"positionAlign",r({},f,{get:function(){return P},set:function(C){const q=n(C);if(!q)throw new SyntaxError("An invalid or illegal string was specified.");P=q,this.hasBeenReset=!0}})),Object.defineProperty(u,"size",r({},f,{get:function(){return B},set:function(C){if(C<0||C>100)throw new Error("Size must be between 0 and 100.");B=C,this.hasBeenReset=!0}})),Object.defineProperty(u,"align",r({},f,{get:function(){return K},set:function(C){const q=n(C);if(!q)throw new SyntaxError("An invalid or illegal string was specified.");K=q,this.hasBeenReset=!0}})),u.displayState=void 0}return o.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},o}();class My{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function Ku(i){function e(s,n,r,o){return(s|0)*3600+(n|0)*60+(r|0)+parseFloat(o||0)}const t=i.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 Uy{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==""&&(this.values[e]=t)}get(e,t,s){return s?this.has(e)?this.values[e]:t[s]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,s){for(let n=0;n<s.length;++n)if(t===s[n]){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 s=parseFloat(t);if(s>=0&&s<=100)return this.set(e,s),!0}return!1}}function Hu(i,e,t,s){const n=s?i.split(s):[i];for(const r in n){if(typeof n[r]!="string")continue;const o=n[r].split(t);if(o.length!==2)continue;const a=o[0],l=o[1];e(a,l)}}const _r=new Ao(0,0,""),vi=_r.align==="middle"?"middle":"center";function By(i,e,t){const s=i;function n(){const a=Ku(i);if(a===null)throw new Error("Malformed timestamp: "+s);return i=i.replace(/^[^\sa-zA-Z-]+/,""),a}function r(a,l){const c=new Uy;Hu(a,function(h,d){let g;switch(h){case"region":for(let m=t.length-1;m>=0;m--)if(t[m].id===d){c.set(h,t[m].region);break}break;case"vertical":c.alt(h,d,["rl","lr"]);break;case"line":g=d.split(","),c.integer(h,g[0]),c.percent(h,g[0])&&c.set("snapToLines",!1),c.alt(h,g[0],["auto"]),g.length===2&&c.alt("lineAlign",g[1],["start",vi,"end"]);break;case"position":g=d.split(","),c.percent(h,g[0]),g.length===2&&c.alt("positionAlign",g[1],["start",vi,"end","line-left","line-right","auto"]);break;case"size":c.percent(h,d);break;case"align":c.alt(h,d,["start",vi,"end","left","right"]);break}},/:/,/\s/),l.region=c.get("region",null),l.vertical=c.get("vertical","");let u=c.get("line","auto");u==="auto"&&_r.line===-1&&(u=-1),l.line=u,l.lineAlign=c.get("lineAlign","start"),l.snapToLines=c.get("snapToLines",!0),l.size=c.get("size",100),l.align=c.get("align",vi);let f=c.get("position","auto");f==="auto"&&_r.position===50&&(f=l.align==="start"||l.align==="left"?0:l.align==="end"||l.align==="right"?100:50),l.position=f}function o(){i=i.replace(/^\s+/,"")}if(o(),e.startTime=n(),o(),i.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+s);i=i.slice(3),o(),e.endTime=n(),o(),r(i,e)}function Vu(i){return i.replace(/<br(?: \/)?>/gi,`
`)}class $y{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new My,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 s(){let r=t.buffer,o=0;for(r=Vu(r);o<r.length&&r[o]!=="\r"&&r[o]!==`
`;)++o;const a=r.slice(0,o);return r[o]==="\r"&&++o,r[o]===`
`&&++o,t.buffer=r.slice(o),a}function n(r){Hu(r,function(o,a){},/:/)}try{let r="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;r=s();const a=r.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:r=s(),t.state){case"HEADER":/:/.test(r)?n(r):r||(t.state="ID");continue;case"NOTE":r||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(r)){t.state="NOTE";break}if(!r)continue;if(t.cue=new Ao(0,0,""),t.state="CUE",r.indexOf("-->")===-1){t.cue.id=r;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{By(r,t.cue,t.regionList)}catch{t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const a=r.indexOf("-->")!==-1;if(!r||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+=`
`),t.cue.text+=r}continue;case"BADCUE":r||(t.state="ID")}}}catch{t.state==="CUETEXT"&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state=t.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this}flush(){const e=this;try{if((e.cue||e.state==="HEADER")&&(e.buffer+=`
`,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 Gy=/\r\n|\n\r|\n|\r/g,Qn=function(e,t,s=0){return e.slice(s,s+t.length)===t},Ky=function(e){let t=parseInt(e.slice(-3));const s=parseInt(e.slice(-6,-4)),n=parseInt(e.slice(-9,-7)),r=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!J(t)||!J(s)||!J(n)||!J(r))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*s,t+=60*1e3*n,t+=60*60*1e3*r,t},Jn=function(e){let t=5381,s=e.length;for(;s;)t=t*33^e.charCodeAt(--s);return(t>>>0).toString()};function So(i,e,t){return Jn(i.toString())+Jn(e.toString())+Jn(t)}const Hy=function(e,t,s){let n=e[t],r=e[n.prevCC];if(!r||!r.new&&n.new){e.ccOffset=e.presentationOffset=n.start,n.new=!1;return}for(;(o=r)!=null&&o.new;){var o;e.ccOffset+=n.start-r.start,n.new=!1,n=r,r=e[n.prevCC]}e.presentationOffset=s};function Vy(i,e,t,s,n,r,o){const a=new $y,l=It(new Uint8Array(i)).trim().replace(Gy,`
`).split(`
`),c=[],u=e?ty(e.baseTime,e.timescale):0;let f="00:00.000",h=0,d=0,g,m=!0;a.oncue=function(y){const T=t[s];let x=t.ccOffset;const S=(h-u)/9e4;if(T!=null&&T.new&&(d!==void 0?x=t.ccOffset=T.start:Hy(t,s,S)),S){if(!e){g=new Error("Missing initPTS for VTT MPEGTS");return}x=S-t.presentationOffset}const R=y.endTime-y.startTime,b=rt((y.startTime+x-d)*9e4,n*9e4)/9e4;y.startTime=Math.max(b,0),y.endTime=Math.max(b+R,0);const M=y.text.trim();y.text=decodeURIComponent(encodeURIComponent(M)),y.id||(y.id=So(y.startTime,y.endTime,M)),y.endTime>0&&c.push(y)},a.onparsingerror=function(y){g=y},a.onflush=function(){if(g){o(g);return}r(c)},l.forEach(y=>{if(m)if(Qn(y,"X-TIMESTAMP-MAP=")){m=!1,y.slice(16).split(",").forEach(T=>{Qn(T,"LOCAL:")?f=T.slice(6):Qn(T,"MPEGTS:")&&(h=parseInt(T.slice(7)))});try{d=Ky(f)/1e3}catch(T){g=T}return}else y===""&&(m=!1);a.parse(y+`
`)}),a.flush()}const Zn="stpp.ttml.im1t",Wu=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Yu=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,Wy={left:"start",center:"center",right:"end",start:"start",end:"end"};function El(i,e,t,s){const n=pe(new Uint8Array(i),["mdat"]);if(n.length===0){s(new Error("Could not parse IMSC1 mdat"));return}const r=n.map(a=>It(a)),o=ey(e.baseTime,1,e.timescale);try{r.forEach(a=>t(Yy(a,o)))}catch(a){s(a)}}function Yy(i,e){const n=new DOMParser().parseFromString(i,"text/xml").getElementsByTagName("tt")[0];if(!n)throw new Error("Invalid ttml");const r={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},o=Object.keys(r).reduce((f,h)=>(f[h]=n.getAttribute(`ttp:${h}`)||r[h],f),{}),a=n.getAttribute("xml:space")!=="preserve",l=xl(er(n,"styling","style")),c=xl(er(n,"layout","region")),u=er(n,"body","[begin]");return[].map.call(u,f=>{const h=ju(f,a);if(!h||!f.hasAttribute("begin"))return null;const d=sr(f.getAttribute("begin"),o),g=sr(f.getAttribute("dur"),o);let m=sr(f.getAttribute("end"),o);if(d===null)throw Al(f);if(m===null){if(g===null)throw Al(f);m=d+g}const y=new Ao(d-e,m-e,h);y.id=So(y.startTime,y.endTime,y.text);const T=c[f.getAttribute("region")],x=l[f.getAttribute("style")],S=jy(T,x,l),{textAlign:R}=S;if(R){const b=Wy[R];b&&(y.lineAlign=b),y.align=R}return Me(y,S),y}).filter(f=>f!==null)}function er(i,e,t){const s=i.getElementsByTagName(e)[0];return s?[].slice.call(s.querySelectorAll(t)):[]}function xl(i){return i.reduce((e,t)=>{const s=t.getAttribute("xml:id");return s&&(e[s]=t),e},{})}function ju(i,e){return[].slice.call(i.childNodes).reduce((t,s,n)=>{var r;return s.nodeName==="br"&&n?t+`
`:(r=s.childNodes)!=null&&r.length?ju(s,e):e?t+s.textContent.trim().replace(/\s+/g," "):t+s.textContent},"")}function jy(i,e,t){const s="http://www.w3.org/ns/ttml#styling";let n=null;const r=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],o=i!=null&&i.hasAttribute("style")?i.getAttribute("style"):null;return o&&t.hasOwnProperty(o)&&(n=t[o]),r.reduce((a,l)=>{const c=tr(e,s,l)||tr(i,s,l)||tr(n,s,l);return c&&(a[l]=c),a},{})}function tr(i,e,t){return i&&i.hasAttributeNS(e,t)?i.getAttributeNS(e,t):null}function Al(i){return new Error(`Could not parse ttml timestamp ${i}`)}function sr(i,e){if(!i)return null;let t=Ku(i);return t===null&&(Wu.test(i)?t=qy(i,e):Yu.test(i)&&(t=zy(i,e))),t}function qy(i,e){const t=Wu.exec(i),s=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+s/e.frameRate}function zy(i,e){const t=Yu.exec(i),s=Number(t[1]);switch(t[2]){case"h":return s*3600;case"m":return s*60;case"ms":return s*1e3;case"f":return s/e.frameRate;case"t":return s/e.tickRate}return s}class Xy{constructor(e){if(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.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Sl(),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}},this.config.enableCEA708Captions){const t=new Si(this,"textTrack1"),s=new Si(this,"textTrack2"),n=new Si(this,"textTrack3"),r=new Si(this,"textTrack4");this.cea608Parser1=new pl(1,t,s),this.cea608Parser2=new pl(3,n,r)}e.on(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(p.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(p.FRAG_LOADING,this.onFragLoading,this),e.on(p.FRAG_LOADED,this.onFragLoaded,this),e.on(p.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(p.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(p.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(p.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(p.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(p.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(p.FRAG_LOADING,this.onFragLoading,this),e.off(p.FRAG_LOADED,this.onFragLoaded,this),e.off(p.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(p.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(p.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(p.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(p.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null}addCues(e,t,s,n,r){let o=!1;for(let a=r.length;a--;){const l=r[a],c=Jy(l[0],l[1],t,s);if(c>=0&&(l[0]=Math.min(l[0],t),l[1]=Math.max(l[1],s),o=!0,c/(s-t)>.5))return}if(o||r.push([t,s]),this.config.renderTextTracksNatively){const a=this.captionsTracks[e];this.Cues.newCue(a,t,s,n)}else{const a=this.Cues.newCue(null,t,s,n);this.hls.trigger(p.CUES_PARSED,{type:"captions",cues:a,track:e})}}onInitPtsFound(e,{frag:t,id:s,initPTS:n,timescale:r}){const{unparsedVttFrags:o}=this;s==="main"&&(this.initPTS[t.cc]={baseTime:n,timescale:r}),o.length&&(this.unparsedVttFrags=[],o.forEach(a=>{this.onFragLoaded(p.FRAG_LOADED,a)}))}getExistingTrack(e){const{media:t}=this;if(t)for(let s=0;s<t.textTracks.length;s++){const n=t.textTracks[s];if(n[e])return n}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:t,captionsTracks:s,media:n}=this,{label:r,languageCode:o}=t[e],a=this.getExistingTrack(e);if(a)s[e]=a,Ts(s[e]),mu(s[e],n);else{const l=this.createTextTrack("captions",r,o);l&&(l[e]=!0,s[e]=l)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const s=t.label,n={_id:e,label:s,kind:"captions",default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=n,this.hls.trigger(p.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[n]})}createTextTrack(e,t,s){const n=this.media;if(n)return n.addTextTrack(e,t,s)}onMediaAttaching(e,t){this.media=t.media,this._cleanTracks()}onMediaDetaching(){const{captionsTracks:e}=this;Object.keys(e).forEach(t=>{Ts(e[t]),delete e[t]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Sl(),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 s=0;s<t.length;s++)Ts(t[s])}onSubtitleTracksUpdated(e,t){const s=t.subtitleTracks||[],n=s.some(r=>r.textCodec===Zn);if(this.config.enableWebVTT||n&&this.config.enableIMSC1){if(Bu(this.tracks,s)){this.tracks=s;return}if(this.textTracks=[],this.tracks=s,this.config.renderTextTracksNatively){const o=this.media?this.media.textTracks:null;this.tracks.forEach((a,l)=>{let c;if(o&&l<o.length){let u=null;for(let f=0;f<o.length;f++)if(Qy(o[f],a)){u=o[f];break}u&&(c=u)}if(c)Ts(c);else{const u=this._captionsOrSubtitlesFromCharacteristics(a);c=this.createTextTrack(u,a.name,a.lang),c&&(c.mode="disabled")}c&&(c.groupId=a.groupId,this.textTracks.push(c))})}else if(this.tracks.length){const o=this.tracks.map(a=>({label:a.name,kind:a.type.toLowerCase(),default:a.default,subtitleTrack:a}));this.hls.trigger(p.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:o})}}}_captionsOrSubtitlesFromCharacteristics(e){if(e.attrs.CHARACTERISTICS){const t=/transcribes-spoken-dialog/gi.test(e.attrs.CHARACTERISTICS),s=/describes-music-and-sound/gi.test(e.attrs.CHARACTERISTICS);if(t&&s)return"captions"}return"subtitles"}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(s=>{const n=/(?:CC|SERVICE)([1-4])/.exec(s.instreamId);if(!n)return;const r=`textTrack${n[1]}`,o=this.captionsProperties[r];o&&(o.label=s.name,s.lang&&(o.languageCode=s.lang),o.media=s)})}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return t==null?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){const{cea608Parser1:s,cea608Parser2:n,lastSn:r,lastPartIndex:o}=this;if(!(!this.enabled||!(s&&n))&&t.frag.type===ie.MAIN){var a,l;const c=t.frag.sn,u=(a=t==null||(l=t.part)==null?void 0:l.index)!=null?a:-1;c===r+1||c===r&&u===o+1||(s.reset(),n.reset()),this.lastSn=c,this.lastPartIndex=u}}onFragLoaded(e,t){const{frag:s,payload:n}=t;if(s.type===ie.SUBTITLE)if(n.byteLength){const r=s.decryptdata,o="stats"in t;if(r==null||!r.encrypted||o){const a=this.tracks[s.level],l=this.vttCCs;l[s.cc]||(l[s.cc]={start:s.start,prevCC:this.prevCC,new:!0},this.prevCC=s.cc),a&&a.textCodec===Zn?this._parseIMSC1(s,n):this._parseVTTs(t)}}else this.hls.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const s=this.hls;El(t,this.initPTS[e.cc],n=>{this._appendCues(n,e.level),s.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},n=>{v.log(`Failed to parse IMSC1: ${n}`),s.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:n})})}_parseVTTs(e){var t;const{frag:s,payload:n}=e,{initPTS:r,unparsedVttFrags:o}=this,a=r.length-1;if(!r[s.cc]&&a===-1){o.push(e);return}const l=this.hls,c=(t=s.initSegment)!=null&&t.data?cs(s.initSegment.data,new Uint8Array(n)):n;Vy(c,this.initPTS[s.cc],this.vttCCs,s.cc,s.start,u=>{this._appendCues(u,s.level),l.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:s})},u=>{const f=u.message==="Missing initPTS for VTT MPEGTS";f?o.push(e):this._fallbackToIMSC1(s,n),v.log(`Failed to parse VTT cue: ${u}`),!(f&&a>s.cc)&&l.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:u})})}_fallbackToIMSC1(e,t){const s=this.tracks[e.level];s.textCodec||El(t,this.initPTS[e.cc],()=>{s.textCodec=Zn,this._parseIMSC1(e,t)},()=>{s.textCodec="wvtt"})}_appendCues(e,t){const s=this.hls;if(this.config.renderTextTracksNatively){const n=this.textTracks[t];if(!n||n.mode==="disabled")return;e.forEach(r=>pu(n,r))}else{const n=this.tracks[t];if(!n)return;const r=n.default?"default":"subtitles"+t;s.trigger(p.CUES_PARSED,{type:"subtitles",cues:e,track:r})}}onFragDecrypted(e,t){const{frag:s}=t;s.type===ie.SUBTITLE&&this.onFragLoaded(p.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){const{cea608Parser1:s,cea608Parser2:n}=this;if(!this.enabled||!(s&&n))return;const{frag:r,samples:o}=t;if(!(r.type===ie.MAIN&&this.closedCaptionsForLevel(r)==="NONE"))for(let a=0;a<o.length;a++){const l=o[a].bytes;if(l){const c=this.extractCea608Data(l);s.addData(o[a].pts,c[0]),n.addData(o[a].pts,c[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:s,endOffsetSubtitles:n,type:r}){const{media:o}=this;if(!(!o||o.currentTime<s)){if(!r||r==="video"){const{captionsTracks:a}=this;Object.keys(a).forEach(l=>Lr(a[l],t,s))}if(this.config.renderTextTracksNatively&&t===0&&n!==void 0){const{textTracks:a}=this;Object.keys(a).forEach(l=>Lr(a[l],t,n))}}}extractCea608Data(e){const t=[[],[]],s=e[0]&31;let n=2;for(let r=0;r<s;r++){const o=e[n++],a=127&e[n++],l=127&e[n++];if(a===0&&l===0)continue;if((4&o)!==0){const u=3&o;(u===0||u===1)&&(t[u].push(a),t[u].push(l))}}return t}}function Qy(i,e){return!!i&&i.label===e.name&&!(i.textTrack1||i.textTrack2)}function Jy(i,e,t,s){return Math.min(e,s)-Math.max(i,t)}function Sl(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}class vo{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.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:e}=this;e.on(p.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.BUFFER_CODECS,this.onBufferCodecs,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(p.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.BUFFER_CODECS,this.onBufferCodecs,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const s=this.hls.levels[t.droppedLevel];this.isLevelAllowed(s)&&this.restrictedLevels.push({bitrate:s.bitrate,height:s.height,width:s.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null}onManifestParsed(e,t){const s=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,s.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping()}detectPlayerSize(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){const e=this.hls.levels;if(e.length){const t=this.hls;t.autoLevelCapping=this.getMaxLevel(e.length-1),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 s=t.filter((n,r)=>this.isLevelAllowed(n)&&r<=e);return this.clientRect=null,vo.getMaxLevelByMediaSize(s,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),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 s=e.getBoundingClientRect();t.width=s.width,t.height=s.height,!t.width&&!t.height&&(t.width=s.right-s.left||e.width||0,t.height=s.bottom-s.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(s=>e.bitrate===s.bitrate&&e.width===s.width&&e.height===s.height)}static getMaxLevelByMediaSize(e,t,s){if(!(e!=null&&e.length))return-1;const n=(o,a)=>a?o.width!==a.width||o.height!==a.height:!0;let r=e.length-1;for(let o=0;o<e.length;o+=1){const a=e[o];if((a.width>=t||a.height>=s)&&n(a,e[o+1])){r=o;break}}return r}}class Zy{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on(p.MEDIA_ATTACHING,this.onMediaAttaching,this)}unregisterListeners(){this.hls.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const s=this.hls.config;if(s.capLevelOnFPSDrop){const n=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=n,n&&typeof n.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),s.fpsDroppedMonitoringPeriod)}}checkFPS(e,t,s){const n=performance.now();if(t){if(this.lastTime){const r=n-this.lastTime,o=s-this.lastDroppedFrames,a=t-this.lastDecodedFrames,l=1e3*o/r,c=this.hls;if(c.trigger(p.FPS_DROP,{currentDropped:o,currentDecoded:a,totalDroppedFrames:s}),l>0&&o>c.config.fpsDroppedMonitoringThreshold*a){let u=c.currentLevel;v.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u),u>0&&(c.autoLevelCapping===-1||c.autoLevelCapping>=u)&&(u=u-1,c.trigger(p.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:c.currentLevel}),c.autoLevelCapping=u,this.streamController.nextLevelSwitch())}}this.lastTime=n,this.lastDroppedFrames=s,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 Ri="[eme]";class Ss{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=Ss.CDMCleanupPromise?[Ss.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=v.debug.bind(v,Ri),this.log=v.log.bind(v,Ri),this.warn=v.warn.bind(v,Ri),this.error=v.error.bind(v,Ri),this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.unregisterListeners(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.onMediaEncrypted=this.onWaitingForKey=this.keyIdToKeySessionPromise=null,this.config=null}registerListeners(){this.hls.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(p.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(p.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(p.MANIFEST_LOADED,this.onManifestLoaded,this)}unregisterListeners(){this.hls.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(p.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(p.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(p.MANIFEST_LOADED,this.onManifestLoaded,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:s}=this.config,n=t[e];if(n)return n.licenseUrl;if(e===we.WIDEVINE&&s)return s;throw new Error(`no license server URL configured for key-system "${e}"`)}getServerCertificateUrl(e){const{drmSystems:t}=this.config,s=t[e];if(s)return s.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,s=(o,a,l)=>!!o&&l.indexOf(o)===a,n=t.map(o=>o.audioCodec).filter(s),r=t.map(o=>o.videoCodec).filter(s);return n.length+r.length===0&&r.push("avc1.42e01e"),new Promise((o,a)=>{const l=c=>{const u=c.shift();this.getMediaKeysPromise(u,n,r).then(f=>o({keySystem:u,mediaKeys:f})).catch(f=>{c.length?l(c):f instanceof it?a(f):a(new it({type:se.KEY_SYSTEM_ERROR,details:D.KEY_SYSTEM_NO_ACCESS,error:f,fatal:!0},f.message))})};l(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:s}=this.config;if(typeof s!="function"){let n=`Configured requestMediaKeySystemAccess is not a function ${s}`;return iu===null&&self.location.protocol==="http:"&&(n=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(n))}return s(e,t)}getMediaKeysPromise(e,t,s){const n=dm(e,t,s,this.config.drmSystemOptions),r=this.keySystemAccessPromises[e];let o=r==null?void 0:r.keySystemAccess;if(!o){this.log(`Requesting encrypted media "${e}" key-system access with config: ${JSON.stringify(n)}`),o=this.requestMediaKeySystemAccess(e,n);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 c=this.fetchServerCertificate(e);return this.log(`Create media-keys for "${e}"`),a.mediaKeys=l.createMediaKeys().then(u=>(this.log(`Media-keys created for "${e}"`),c.then(f=>f?this.setMediaKeysServerCertificate(u,e,f):u))),a.mediaKeys.catch(u=>{this.error(`Failed to create media-keys for "${e}"}: ${u}`)}),a.mediaKeys})}return o.then(()=>r.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:s}){this.log(`Creating key-system session "${t}" keyId: ${St.hexDump(e.keyId||[])}`);const n=s.createSession(),r={decryptdata:e,keySystem:t,mediaKeys:s,mediaKeysSession:n,keyStatus:"status-pending"};return this.mediaKeySessions.push(r),r}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const s=this.createMediaKeySessionContext(e),n=this.getKeyIdString(t),r="cenc";this.keyIdToKeySessionPromise[n]=this.generateRequestWithPreferredKeySession(s,r,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 St.hexDump(e.keyId)}updateKeySession(e,t){var s;const n=e.mediaKeysSession;return this.log(`Updating key-session "${n.sessionId}" for keyID ${St.hexDump(((s=e.decryptdata)==null?void 0:s.keyId)||[])}
} (data length: ${t&&t.byteLength})`),n.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,s)=>{const n=Fn(this.config),r=e.map(ka).filter(o=>!!o&&n.indexOf(o)!==-1);return this.getKeySystemSelectionPromise(r).then(({keySystem:o})=>{const a=Oa(o);a?t(a):s(new Error(`Unable to find format for key-system "${o}"`))}).catch(s)})}loadKey(e){const t=e.keyInfo.decryptdata,s=this.getKeyIdString(t),n=`(keyId: ${s} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${n}`);let r=this.keyIdToKeySessionPromise[s];return r||(r=this.keyIdToKeySessionPromise[s]=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 ${n}`),this.attemptSetMediaKeys(o,a).then(()=>{this.throwIfDestroyed();const l=this.createMediaKeySessionContext({keySystem:o,mediaKeys:a,decryptdata:t}),c="cenc";return this.generateRequestWithPreferredKeySession(l,c,t.pssh,"playlist-key")}))),r.catch(o=>this.handleError(o))),r}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof it?this.hls.trigger(p.ERROR,e.data):this.hls.trigger(p.ERROR,{type:se.KEY_SYSTEM_ERROR,details:D.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),s=this.keyIdToKeySessionPromise[t];if(!s){const n=ka(e.keyFormat),r=n?[n]:Fn(this.config);return this.attemptKeySystemAccess(r)}return s}getKeySystemSelectionPromise(e){if(e.length||(e=Fn(this.config)),e.length===0)throw new it({type:se.KEY_SYSTEM_ERROR,details:D.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:s}=e;if(this.debug(`"${e.type}" event: init data type: "${t}"`),s===null)return;let n,r;if(t==="sinf"&&this.config.drmSystems[we.FAIRPLAY]){const u=$e(new Uint8Array(s));try{const f=lo(JSON.parse(u).sinf),h=fu(new Uint8Array(f));if(!h)return;n=h.subarray(8,24),r=we.FAIRPLAY}catch{this.warn('Failed to parse sinf "encrypted" event message initData');return}}else{const u=Mm(s);if(u===null)return;u.version===0&&u.systemId===su.WIDEVINE&&u.data&&(n=u.data.subarray(8,24)),r=hm(u.systemId)}if(!r||!n)return;const o=St.hexDump(n),{keyIdToKeySessionPromise:a,mediaKeySessions:l}=this;let c=a[o];for(let u=0;u<l.length;u++){const f=l[u],h=f.decryptdata;if(h.pssh||!h.keyId)continue;const d=St.hexDump(h.keyId);if(o===d||h.uri.replace(/-/g,"").indexOf(o)!==-1){c=a[d],delete a[d],h.pssh=new Uint8Array(s),h.keyId=n,c=a[o]=c.then(()=>this.generateRequestWithPreferredKeySession(f,t,s,"encrypted-event-key-match"));break}}c||(c=a[o]=this.getKeySystemSelectionPromise([r]).then(({keySystem:u,mediaKeys:f})=>{var h;this.throwIfDestroyed();const d=new ni("ISO-23001-7",o,(h=Oa(u))!=null?h:"");return d.pssh=new Uint8Array(s),d.keyId=n,this.attemptSetMediaKeys(u,f).then(()=>{this.throwIfDestroyed();const g=this.createMediaKeySessionContext({decryptdata:d,keySystem:u,mediaKeys:f});return this.generateRequestWithPreferredKeySession(g,t,s,"encrypted-event-no-match")})})),c.catch(u=>this.handleError(u))}_onWaitingForKey(e){this.log(`"${e.type}" event`)}attemptSetMediaKeys(e,t){const s=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const n=Promise.all(s).then(()=>{if(!this.media)throw new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)});return this.setMediaKeysQueue.push(n),n.then(()=>{this.log(`Media-keys set for "${e}"`),s.push(n),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(r=>s.indexOf(r)===-1)})}generateRequestWithPreferredKeySession(e,t,s,n){var r,o;const a=(r=this.config.drmSystems)==null||(o=r[e.keySystem])==null?void 0:o.generateRequest;if(a)try{const h=a.call(this.hls,t,s,e);if(!h)throw new Error("Invalid response from configured generateRequest filter");t=h.initDataType,s=e.decryptdata.pssh=h.initData?new Uint8Array(h.initData):null}catch(h){var l;if(this.warn(h.message),(l=this.hls)!=null&&l.config.debug)throw h}if(s===null)return this.log(`Skipping key-session request for "${n}" (no initData)`),Promise.resolve(e);const c=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${n}": ${c} (init data type: ${t} length: ${s?s.byteLength:null})`);const u=new xo;e.mediaKeysSession.onmessage=h=>{const d=e.mediaKeysSession;if(!d){u.emit("error",new Error("invalid state"));return}const{messageType:g,message:m}=h;this.log(`"${g}" message event for session "${d.sessionId}" message size: ${m.byteLength}`),g==="license-request"||g==="license-renewal"?this.renewLicense(e,m).catch(y=>{this.handleError(y),u.emit("error",y)}):g==="license-release"?e.keySystem===we.FAIRPLAY&&(this.updateKeySession(e,tu("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${g}"`)},e.mediaKeysSession.onkeystatuseschange=h=>{if(!e.mediaKeysSession){u.emit("error",new Error("invalid state"));return}this.onKeyStatusChange(e);const g=e.keyStatus;u.emit("keyStatus",g),g==="expired"&&(this.warn(`${e.keySystem} expired for key ${c}`),this.renewKeySession(e))};const f=new Promise((h,d)=>{u.on("error",d),u.on("keyStatus",g=>{g.startsWith("usable")?h():g==="output-restricted"?d(new it({type:se.KEY_SYSTEM_ERROR,details:D.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):g==="internal-error"?d(new it({type:se.KEY_SYSTEM_ERROR,details:D.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${g}"`)):g==="expired"?d(new Error("key expired while generating request")):this.warn(`unhandled key status change "${g}"`)})});return e.mediaKeysSession.generateRequest(t,s).then(()=>{var h;this.log(`Request generated for key-session "${(h=e.mediaKeysSession)==null?void 0:h.sessionId}" keyId: ${c}`)}).catch(h=>{throw new it({type:se.KEY_SYSTEM_ERROR,details:D.KEY_SYSTEM_NO_SESSION,error:h,fatal:!1},`Error generating key-session request: ${h}`)}).then(()=>f).catch(h=>{throw u.removeAllListeners(),this.removeSession(e),h}).then(()=>(u.removeAllListeners(),e))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach((t,s)=>{this.log(`key status change "${t}" for keyStatuses keyId: ${St.hexDump("buffer"in s?new Uint8Array(s.buffer,s.byteOffset,s.byteLength):new Uint8Array(s))} session keyId: ${St.hexDump(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t})}fetchServerCertificate(e){const t=this.config,s=t.loader,n=new s(t),r=this.getServerCertificateUrl(e);return r?(this.log(`Fetching serverCertificate for "${e}"`),new Promise((o,a)=>{const l={responseType:"arraybuffer",url:r},c=t.certLoadPolicy.default,u={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(h,d,g,m)=>{o(h.data)},onError:(h,d,g,m)=>{a(new it({type:se.KEY_SYSTEM_ERROR,details:D.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:g,response:tt({url:l.url,data:void 0},h)},`"${e}" certificate request failed (${r}). Status: ${h.code} (${h.text})`))},onTimeout:(h,d,g)=>{a(new it({type:se.KEY_SYSTEM_ERROR,details:D.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:g,response:{url:l.url,data:void 0}},`"${e}" certificate request timed out (${r})`))},onAbort:(h,d,g)=>{a(new Error("aborted"))}};n.load(l,u,f)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,s){return new Promise((n,r)=>{e.setServerCertificate(s).then(o=>{this.log(`setServerCertificate ${o?"success":"not supported by CDM"} (${s==null?void 0:s.byteLength}) on "${t}"`),n(e)}).catch(o=>{r(new it({type:se.KEY_SYSTEM_ERROR,details:D.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:o,fatal:!0},o.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(s=>this.updateKeySession(e,new Uint8Array(s)).catch(n=>{throw new it({type:se.KEY_SYSTEM_ERROR,details:D.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:n,fatal:!0},n.message)}))}setupLicenseXHR(e,t,s,n){const r=this.config.licenseXhrSetup;return r?Promise.resolve().then(()=>{if(!s.decryptdata)throw new Error("Key removed");return r.call(this.hls,e,t,s,n)}).catch(o=>{if(!s.decryptdata)throw o;return e.open("POST",t,!0),r.call(this.hls,e,t,s,n)}).then(o=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:o||n})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:n}))}requestLicense(e,t){const s=this.config.keyLoadPolicy.default;return new Promise((n,r)=>{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 r(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 c=this.config.licenseResponseCallback;if(c)try{l=c.call(this.hls,a,o,e)}catch(u){this.error(u)}n(l)}else{const l=s.errorRetry,c=l?l.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>c||a.status>=400&&a.status<500)r(new it({type:se.KEY_SYSTEM_ERROR,details:D.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 u=c-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${u} attempts left`),this.requestLicense(e,t).then(n,r)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=a,this.setupLicenseXHR(a,o,e,t).then(({xhr:l,licenseChallenge:c})=>{l.send(c)})})}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const s=t.media;this.media=s,s.addEventListener("encrypted",this.onMediaEncrypted),s.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={},ni.clearKeyUriToKeyIdMap();const s=t.length;Ss.CDMCleanupPromise=Promise.all(t.map(n=>this.removeSession(n)).concat(e==null?void 0:e.setMediaKeys(null).catch(n=>{this.log(`Could not clear media keys: ${n}. media.src: ${e==null?void 0:e.src}`)}))).then(()=>{s&&(this.log("finished closing key sessions and clearing media keys"),t.length=0)}).catch(n=>{this.log(`Could not close sessions and clear media keys: ${n}. media.src: ${e==null?void 0:e.src}`)})}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const s=t.reduce((n,r)=>(n.indexOf(r.keyFormat)===-1&&n.push(r.keyFormat),n),[]);this.log(`Selecting key-system from session-keys ${s.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(s)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:s}=e;if(t){this.log(`Remove licenses and keys and close session ${t.sessionId}`),t.onmessage=null,t.onkeystatuseschange=null,s&&s.readyState!==XMLHttpRequest.DONE&&s.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const n=this.mediaKeySessions.indexOf(e);return n>-1&&this.mediaKeySessions.splice(n,1),t.remove().catch(r=>{this.log(`Could not remove session: ${r}`)}).then(()=>t.close()).catch(r=>{this.log(`Could not close session: ${r}`)})}}}Ss.CDMCleanupPromise=void 0;class it 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}}const eT=1;var ze={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"};const tT="h";class jt{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.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=n=>{try{this.apply(n,{ot:ze.MANIFEST,su:!this.initialized})}catch(r){v.warn("Could not generate manifest CMCD data.",r)}},this.applyFragmentData=n=>{try{const r=n.frag,o=this.hls.levels[r.level],a=this.getObjectType(r),l={d:r.duration*1e3,ot:a};(a===ze.VIDEO||a===ze.AUDIO||a==ze.MUXED)&&(l.br=o.bitrate/1e3,l.tb=this.getTopBandwidth(a)/1e3,l.bl=this.getBufferLength(a)),this.apply(n,l)}catch(r){v.warn("Could not generate segment CMCD data.",r)}},this.hls=e;const t=this.config=e.config,{cmcd:s}=t;s!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=s.sessionId||jt.uuid(),this.cid=s.contentId,this.useHeaders=s.useHeaders===!0,this.registerListeners())}registerListeners(){const e=this.hls;e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHED,this.onMediaDetached,this),e.on(p.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHED,this.onMediaDetached,this),e.off(p.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null}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 s,n;this.audioBuffer=(s=t.tracks.audio)==null?void 0:s.buffer,this.videoBuffer=(n=t.tracks.video)==null?void 0:n.buffer}createData(){var e;return{v:eT,sf:tT,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){Me(t,this.createData());const s=t.ot===ze.INIT||t.ot===ze.VIDEO||t.ot===ze.MUXED;if(this.starved&&s&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering),this.useHeaders){const n=jt.toHeaders(t);if(!Object.keys(n).length)return;e.headers||(e.headers={}),Me(e.headers,n)}else{const n=jt.toQuery(t);if(!n)return;e.url=jt.appendQueryToUri(e.url,n)}}getObjectType(e){const{type:t}=e;if(t==="subtitle")return ze.TIMED_TEXT;if(e.sn==="initSegment")return ze.INIT;if(t==="audio")return ze.AUDIO;if(t==="main")return this.hls.audioTracks.length?ze.VIDEO:ze.MUXED}getTopBandwidth(e){let t=0,s;const n=this.hls;if(e===ze.AUDIO)s=n.audioTracks;else{const r=n.maxAutoLevel,o=r>-1?r+1:n.levels.length;s=n.levels.slice(0,o)}for(const r of s)r.bitrate>t&&(t=r.bitrate);return t>0?t:NaN}getBufferLength(e){const t=this.hls.media,s=e===ze.AUDIO?this.audioBuffer:this.videoBuffer;return!s||!t?NaN:De.bufferInfo(s,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,s=e||this.config.loader;return class{constructor(r){this.loader=void 0,this.loader=new s(r)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(r,o,a){t(r),this.loader.load(r,o,a)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,s=e||this.config.loader;return class{constructor(r){this.loader=void 0,this.loader=new s(r)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(r,o,a){t(r),this.loader.load(r,o,a)}}}static uuid(){const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}static serialize(e){const t=[],s=c=>!Number.isNaN(c)&&c!=null&&c!==""&&c!==!1,n=c=>Math.round(c),r=c=>n(c/100)*100,a={br:n,d:n,bl:r,dl:r,mtp:r,nor:c=>encodeURIComponent(c),rtp:r,tb:n},l=Object.keys(e||{}).sort();for(const c of l){let u=e[c];if(!s(u)||c==="v"&&u===1||c=="pr"&&u===1)continue;const f=a[c];f&&(u=f(u));const h=typeof u;let d;c==="ot"||c==="sf"||c==="st"?d=`${c}=${u}`:h==="boolean"?d=c:h==="number"?d=`${c}=${u}`:d=`${c}=${JSON.stringify(u)}`,t.push(d)}return t.join(",")}static toHeaders(e){const t=Object.keys(e),s={},n=["Object","Request","Session","Status"],r=[{},{},{},{}],o={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3};for(const a of t){const l=o[a]!=null?o[a]:1;r[l][a]=e[a]}for(let a=0;a<r.length;a++){const l=jt.serialize(r[a]);l&&(s[`CMCD-${n[a]}`]=l)}return s}static toQuery(e){return`CMCD=${encodeURIComponent(jt.serialize(e))}`}static appendQueryToUri(e,t){if(!t)return e;const s=e.includes("?")?"&":"?";return`${e}${s}${t}`}}const sT=3e5;class iT{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=v.log.bind(v,"[content-steering]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.ERROR,this.onError,this))}startLoad(){if(this.started=!0,self.clearTimeout(this.reloadTimer),this.enabled&&this.uri)if(this.updated){const e=Math.max(this.timeToLoad*1e3-(performance.now()-this.updated),0);this.scheduleRefresh(this.uri,e)}else this.loadSteeringManifest(this.uri)}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),self.clearTimeout(this.reloadTimer)}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(s=>s!==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:s}=t;s!==null&&(this.pathwayId=s.pathwayId,this.uri=s.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:s}=t;if((s==null?void 0:s.action)===We.SendAlternateToPenaltyBox&&s.flags===nt.MoveAllAlternatesMatchingHost){let n=this.pathwayPriority;const r=this.pathwayId;this.penalizedPathways[r]||(this.penalizedPathways[r]=performance.now()),!n&&this.levels&&(n=this.levels.reduce((o,a)=>(o.indexOf(a.pathwayId)===-1&&o.push(a.pathwayId),o),[])),n&&n.length>1&&(this.updatePathwayPriority(n),s.resolved=this.pathwayId!==r)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const s=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${s}"`),t=this.getLevelsForPathway(s),this.pathwayId=s}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 s=this.penalizedPathways,n=performance.now();Object.keys(s).forEach(r=>{n-s[r]>sT&&delete s[r]});for(let r=0;r<e.length;r++){const o=e[r];if(s[o])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,this.hls.trigger(p.LEVELS_UPDATED,{levels:t});const c=this.hls.levels[a];l&&c&&this.levels&&(c.attrs["STABLE-VARIANT-ID"]!==l.attrs["STABLE-VARIANT-ID"]&&c.bitrate!==l.bitrate&&this.log(`Unstable Pathways change from bitrate ${l.bitrate} to ${c.bitrate}`),this.hls.nextLoadLevel=a);break}}}clonePathways(e){const t=this.levels;if(!t)return;const s={},n={};e.forEach(r=>{const{ID:o,"BASE-ID":a,"URI-REPLACEMENT":l}=r;if(t.some(u=>u.pathwayId===o))return;const c=this.getLevelsForPathway(a).map(u=>{const f=Me({},u);f.details=void 0,f.url=qu(u.uri,u.attrs["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",l);const h=new Ce(u.attrs);h["PATHWAY-ID"]=o;const d=h.AUDIO&&`${h.AUDIO}_clone_${o}`,g=h.SUBTITLES&&`${h.SUBTITLES}_clone_${o}`;d&&(s[h.AUDIO]=d,h.AUDIO=d),g&&(n[h.SUBTITLES]=g,h.SUBTITLES=g),f.attrs=h;const m=new ri(f);return ji(m,"audio",d),ji(m,"text",g),m});t.push(...c),vl(this.audioTracks,s,l,o),vl(this.subtitleTracks,n,l,o)})}loadSteeringManifest(e){const t=this.hls.config,s=t.loader;this.loader&&this.loader.destroy(),this.loader=new s(t);let n;try{n=new self.URL(e)}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(n.protocol!=="data:"){const u=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;n.searchParams.set("_HLS_pathway",this.pathwayId),n.searchParams.set("_HLS_throughput",""+u)}const r={responseType:"json",url:n.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},c={onSuccess:(u,f,h,d)=>{this.log(`Loaded steering manifest: "${n}"`);const g=u.data;if(g.VERSION!==1){this.log(`Steering VERSION ${g.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=g.TTL;const{"RELOAD-URI":m,"PATHWAY-CLONES":y,"PATHWAY-PRIORITY":T}=g;if(m)try{this.uri=new self.URL(m,n).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${m}`);return}this.scheduleRefresh(this.uri||h.url),y&&this.clonePathways(y),T&&this.updatePathwayPriority(T)},onError:(u,f,h,d)=>{if(this.log(`Error loading steering manifest: ${u.code} ${u.text} (${f.url})`),this.stopLoad(),u.code===410){this.enabled=!1,this.log(`Steering manifest ${f.url} no longer available`);return}let g=this.timeToLoad*1e3;if(u.code===429){const m=this.loader;if(typeof(m==null?void 0:m.getResponseHeader)=="function"){const y=m.getResponseHeader("Retry-After");y&&(g=parseFloat(y)*1e3)}this.log(`Steering manifest ${f.url} rate limited`);return}this.scheduleRefresh(this.uri||f.url,g)},onTimeout:(u,f,h)=>{this.log(`Timeout loading steering manifest (${f.url})`),this.scheduleRefresh(this.uri||f.url)}};this.log(`Requesting steering manifest: ${n}`),this.loader.load(r,l,c)}scheduleRefresh(e,t=this.timeToLoad*1e3){self.clearTimeout(this.reloadTimer),this.reloadTimer=self.setTimeout(()=>{this.loadSteeringManifest(e)},t)}}function vl(i,e,t,s){i&&Object.keys(e).forEach(n=>{const r=i.filter(o=>o.groupId===n).map(o=>{const a=Me({},o);return a.details=void 0,a.attrs=new Ce(a.attrs),a.url=a.attrs.URI=qu(o.url,o.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),a.groupId=a.attrs["GROUP-ID"]=e[n],a.attrs["PATHWAY-ID"]=s,a});i.push(...r)})}function qu(i,e,t,s){const{HOST:n,PARAMS:r,[t]:o}=s;let a;e&&(a=o==null?void 0:o[e],a&&(i=a));const l=new self.URL(i);return n&&!a&&(l.host=n),r&&Object.keys(r).sort().forEach(c=>{c&&l.searchParams.set(c,r[c])}),l.href}const nT=/^age:\s*[\d.]+\s*$/im;class zu{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=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new yn,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=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,s){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=s,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e)return;const s=this.loader=new self.XMLHttpRequest,n=this.stats;n.loading.first=0,n.loaded=0,n.aborted=!1;const r=this.xhrSetup;r?Promise.resolve().then(()=>{if(!this.stats.aborted)return r(s,t.url)}).catch(o=>(s.open("GET",t.url,!0),r(s,t.url))).then(()=>{this.stats.aborted||this.openAndSendXhr(s,t,e)}).catch(o=>{this.callbacks.onError({code:s.status,text:o.message},t,s,n)}):this.openAndSendXhr(s,t,e)}openAndSendXhr(e,t,s){e.readyState||e.open("GET",t.url,!0);const n=this.context.headers,{maxTimeToFirstByteMs:r,maxLoadTimeMs:o}=s.loadPolicy;if(n)for(const a in n)e.setRequestHeader(a,n[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),s.timeout=r&&J(r)?r:o,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:s}=this;if(!e||!t)return;const n=t.readyState,r=this.config;if(!s.aborted&&n>=2&&(s.loading.first===0&&(s.loading.first=Math.max(self.performance.now(),s.loading.start),r.timeout!==r.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),r.timeout=r.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.loadPolicy.maxLoadTimeMs-(s.loading.first-s.loading.start)))),n===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)){s.loading.end=Math.max(self.performance.now(),s.loading.first);const l=a?t.response:t.responseText,c=t.responseType==="arraybuffer"?l.byteLength:l.length;if(s.loaded=s.total=c,s.bwEstimate=s.total*8e3/(s.loading.end-s.loading.first),!this.callbacks)return;const u=this.callbacks.onProgress;if(u&&u(s,e,l,t),!this.callbacks)return;const f={url:t.responseURL,data:l,code:o};this.callbacks.onSuccess(f,s,e,t)}else{const l=r.loadPolicy.errorRetry,c=s.retry;Yi(l,c,!1,o)?this.retry(l):(v.error(`${o} while loading ${e.url}`),this.callbacks.onError({code:o,text:t.statusText},e,t,s))}}}loadtimeout(){var e;const t=(e=this.config)==null?void 0:e.loadPolicy.timeoutRetry,s=this.stats.retry;if(Yi(t,s,!0))this.retry(t);else{v.warn(`timeout while loading ${this.context.url}`);const n=this.callbacks;n&&(this.abortInternal(),n.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:s}=this;this.retryDelay=uo(e,s.retry),s.retry++,v.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t.url}, retrying ${s.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&&nT.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 rT(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const oT=/(\d+)-(\d+)\/(\d+)/;class Rl{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||uT,this.controller=new self.AbortController,this.stats=new yn}destroy(){this.loader=this.callbacks=null,this.abortInternal()}abortInternal(){const e=this.response;e!=null&&e.ok||(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,s){const n=this.stats;if(n.loading.start)throw new Error("Loader can only be used once.");n.loading.start=self.performance.now();const r=aT(e,this.controller.signal),o=s.onProgress,a=e.responseType==="arraybuffer",l=a?"byteLength":"length",{maxTimeToFirstByteMs:c,maxLoadTimeMs:u}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=s,this.request=this.fetchSetup(e,r),self.clearTimeout(this.requestTimeout),t.timeout=c&&J(c)?c:u,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),s.onTimeout(n,e,this.response)},t.timeout),self.fetch(this.request).then(f=>{this.response=this.loader=f;const h=Math.max(self.performance.now(),n.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=u,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),s.onTimeout(n,e,this.response)},u-(h-n.loading.start)),!f.ok){const{status:d,statusText:g}=f;throw new fT(g||"fetch, bad network response",d,f)}return n.loading.first=h,n.total=cT(f.headers)||n.total,o&&J(t.highWaterMark)?this.loadProgressively(f,n,e,t.highWaterMark,o):a?f.arrayBuffer():e.responseType==="json"?f.json():f.text()}).then(f=>{const{response:h}=this;self.clearTimeout(this.requestTimeout),n.loading.end=Math.max(self.performance.now(),n.loading.first);const d=f[l];d&&(n.loaded=n.total=d);const g={url:h.url,data:f,code:h.status};o&&!J(t.highWaterMark)&&o(n,e,f,h),s.onSuccess(g,n,e,h)}).catch(f=>{if(self.clearTimeout(this.requestTimeout),n.aborted)return;const h=f&&f.code||0,d=f?f.message:null;s.onError({code:h,text:d},e,f?f.details:null,n)})}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,s,n=0,r){const o=new Uu,a=e.body.getReader(),l=()=>a.read().then(c=>{if(c.done)return o.dataLength&&r(t,s,o.flush(),e),Promise.resolve(new ArrayBuffer(0));const u=c.value,f=u.length;return t.loaded+=f,f<n||o.dataLength?(o.push(u),o.dataLength>=n&&r(t,s,o.flush(),e)):r(t,s,u,e),l()}).catch(()=>Promise.reject());return l()}}function aT(i,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(Me({},i.headers))};return i.rangeEnd&&t.headers.set("Range","bytes="+i.rangeStart+"-"+String(i.rangeEnd-1)),t}function lT(i){const e=oT.exec(i);if(e)return parseInt(e[2])-parseInt(e[1])+1}function cT(i){const e=i.get("Content-Range");if(e){const s=lT(e);if(J(s))return s}const t=i.get("Content-Length");if(t)return parseInt(t)}function uT(i,e){return new self.Request(i.url,e)}class fT extends Error{constructor(e,t,s){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=s}}const hT=/\s/,dT={newCue(i,e,t,s){const n=[];let r,o,a,l,c;const u=self.VTTCue||self.TextTrackCue;for(let h=0;h<s.rows.length;h++)if(r=s.rows[h],a=!0,l=0,c="",!r.isEmpty()){var f;for(let m=0;m<r.chars.length;m++)hT.test(r.chars[m].uchar)&&a?l++:(c+=r.chars[m].uchar,a=!1);r.cueStartTime=e,e===t&&(t+=1e-4),l>=16?l--:l++;const d=Vu(c.trim()),g=So(e,t,d);i!=null&&(f=i.cues)!=null&&f.getCueById(g)||(o=new u(e,t,d),o.id=g,o.line=h+1,o.align="left",o.position=10+Math.min(80,Math.floor(l*8/32)*10),n.push(o))}return i&&n.length&&(n.sort((h,d)=>h.line==="auto"||d.line==="auto"?0:h.line>8&&d.line>8?d.line-h.line:h.line-d.line),n.forEach(h=>pu(i,h))),n}},gT={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},mT=tt(tt({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength: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:zu,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Ey,bufferController:Dy,capLevelController:vo,errorController:fp,fpsController:Zy,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:iu,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,certLoadPolicy:{default:gT},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},pT()),{},{subtitleStreamController:Ry,subtitleTrackController:by,timelineController:Xy,audioStreamController:Ay,audioTrackController:Sy,emeController:Ss,cmcdController:jt,contentSteeringController:iT});function pT(){return{cueHandler:dT,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 yT(i,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=Pr(i),s=["manifest","level","frag"],n=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return s.forEach(r=>{const o=`${r==="level"?"playlist":r}LoadPolicy`,a=e[o]===void 0,l=[];n.forEach(c=>{const u=`${r}Loading${c}`,f=e[u];if(f!==void 0&&a){l.push(u);const h=t[o].default;switch(e[o]={default:h},c){case"TimeOut":h.maxLoadTimeMs=f,h.maxTimeToFirstByteMs=f;break;case"MaxRetry":h.errorRetry.maxNumRetry=f,h.timeoutRetry.maxNumRetry=f;break;case"RetryDelay":h.errorRetry.retryDelayMs=f,h.timeoutRetry.retryDelayMs=f;break;case"MaxRetryTimeout":h.errorRetry.maxRetryDelayMs=f,h.timeoutRetry.maxRetryDelayMs=f;break}}}),l.length&&v.warn(`hls.js config: "${l.join('", "')}" setting(s) are deprecated, use "${o}": ${JSON.stringify(e[o])}`)}),tt(tt({},t),e)}function Pr(i){return i&&typeof i=="object"?Array.isArray(i)?i.map(Pr):Object.keys(i).reduce((e,t)=>(e[t]=Pr(i[t]),e),{}):i}function TT(i){const e=i.loader;e!==Rl&&e!==zu?(v.log("[config]: Custom loader detected, cannot enable progressive streaming"),i.progressive=!1):rT()&&(i.loader=Rl,i.progressive=!0,i.enableSoftwareAES=!0,v.log("[config]: Progressive streaming enabled, using FetchLoader"))}class Nt{static get version(){return"1.4.12"}static isSupported(){return wp()}static get Events(){return p}static get ErrorTypes(){return se}static get ErrorDetails(){return D}static get DefaultConfig(){return Nt.defaultConfig?Nt.defaultConfig:mT}static set DefaultConfig(e){Nt.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new xo,this._autoLevelCapping=void 0,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,sm(e.debug||!1,"Hls instance");const t=this.config=yT(Nt.DefaultConfig,e);this.userConfig=e,this._autoLevelCapping=-1,t.progressive&&TT(t);const{abrController:s,bufferController:n,capLevelController:r,errorController:o,fpsController:a}=t,l=new o(this),c=this.abrController=new s(this),u=this.bufferController=new n(this),f=this.capLevelController=new r(this),h=new a(this),d=new Ym(this),g=new Qm(this),m=t.contentSteeringController,y=m?new m(this):null,T=this.levelController=new dp(this,y),x=new gp(this),S=new pp(this.config),R=this.streamController=new yy(this,x,S);f.setStreamController(R),h.setStreamController(R);const b=[d,T,R];y&&b.splice(1,0,y),this.networkControllers=b;const M=[c,u,f,h,g,x];this.audioTrackController=this.createController(t.audioTrackController,b);const P=t.audioStreamController;P&&b.push(new P(this,x,S)),this.subtitleTrackController=this.createController(t.subtitleTrackController,b);const B=t.subtitleStreamController;B&&b.push(new B(this,x,S)),this.createController(t.timelineController,M),S.emeController=this.emeController=this.createController(t.emeController,M),this.cmcdController=this.createController(t.cmcdController,M),this.latencyController=this.createController(Jm,M),this.coreComponents=M,b.push(l);const K=l.onErrorOut;typeof K=="function"&&this.on(p.ERROR,K,l)}createController(e,t){if(e){const s=new e(this);return t&&t.push(s),s}return null}on(e,t,s=this){this._emitter.on(e,t,s)}once(e,t,s=this){this._emitter.once(e,t,s)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,s=this,n){this._emitter.off(e,t,s,n)}listeners(e){return this._emitter.listeners(e)}emit(e,t,s){return this._emitter.emit(e,t,s)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(s){v.error("An internal error happened while handling event "+e+'. Error message: "'+s.message+'". Here is a stacktrace:',s),this.trigger(p.ERROR,{type:se.OTHER_ERROR,details:D.INTERNAL_EXCEPTION,fatal:!1,event:e,error:s})}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){v.log("destroy"),this.trigger(p.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(t=>t.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(t=>t.destroy()),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){v.log("attachMedia"),this._media=e,this.trigger(p.MEDIA_ATTACHING,{media:e})}detachMedia(){v.log("detachMedia"),this.trigger(p.MEDIA_DETACHING,void 0),this._media=null}loadSource(e){this.stopLoad();const t=this.media,s=this.url,n=this.url=ao.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});v.log(`loadSource:${n}`),t&&s&&(s!==n||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(p.MANIFEST_LOADING,{url:e})}startLoad(e=-1){v.log(`startLoad(${e})`),this.networkControllers.forEach(t=>{t.startLoad(e)})}stopLoad(){v.log("stopLoad"),this.networkControllers.forEach(e=>{e.stopLoad()})}swapAudioCodec(){v.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){v.log("recoverMediaError");const e=this._media;this.detachMedia(),e&&this.attachMedia(e)}removeLevel(e,t=0){this.levelController.removeLevel(e,t)}get levels(){const e=this.levelController.levels;return e||[]}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){v.log(`set currentLevel:${e}`),this.loadLevel=e,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){v.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){v.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){v.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){return this.levelController.startLevel}set startLevel(e){v.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}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(v.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e)}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){Ir.indexOf(e)>-1&&(this._maxHdcpLevel=e)}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 s=e.length;for(let n=0;n<s;n++)if(e[n].maxBitrate>=t)return n;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:s}=this;let n;if(t===-1&&e&&e.length?n=e.length-1:n=t,s)for(let r=n;r--;){const o=e[r].attrs["HDCP-LEVEL"];if(o&&o<=s)return r}return n}get nextAutoLevel(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)}set nextAutoLevel(e){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,e)}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}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 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}}Nt.defaultConfig=void 0;const ET={name:"",components:{},props:{sourceUrl:{type:String,default:""},height:{type:String,default:"550px"}},data(){return{hls:null,sourceUrls:this.sourceUrl,loadingVideo:!1,waiting:!1,reloadPlayTime:null}},computed:{},watch:{sourceUrl:{handler(i,e){i&&i!==e&&(this.waiting=!0,this.sourceUrls=i,this.playVideo())}}},created(){},methods:{playVideo(){this.$nextTick(()=>[this.loadingVideo=!1]),Nt.isSupported()?(this.hls=new Nt,this.hls.loadSource(this.sourceUrls),this.hls.attachMedia(this.$refs.video),this.hls.on(Nt.Events.MANIFEST_PARSED,(i,e)=>{this.loadingVideo=!1,this.waiting=!1,this.$emit("playStatus",!0),this.$refs.video.play()})):this.$refs.video.canPlayType("application/vnd.apple.mpegurl")}}},xT={class:"ali-player"},AT={class:"main"},ST={class:"video-center"},vT={key:0,class:"video",style:{"background-color":"#0c0b0b"}},RT={id:"video",controls:"",class:"video",ref:"video",autoplay:"",muted:"",controlslist:"nodownload noplaybackrate",disablePictureInPicture:"",style:{"background-color":"#0c0b0b",width:"100%",height:"100%"}};function LT(i,e,t,s,n,r){return Rs(),$i("div",xT,[Pe("div",AT,[Pe("div",ST,[n.hls?pc("",!0):(Rs(),$i("div",vT)),ch(Pe("video",RT,null,512),[[Ad,n.hls]])])])])}const bT=eo(ET,[["render",LT],["__scopeId","data-v-055abdc3"]]),Ll=""+new URL("noraml-b84fb159.png",import.meta.url).href,IT=""+new URL("top-79b412a9.png",import.meta.url).href,DT=""+new URL("right-c002f550.png",import.meta.url).href,CT=""+new URL("download1-62bdc83a.png",import.meta.url).href,wT=""+new URL("left-fa6e26df.png",import.meta.url).href;const _T=i=>(Zf("data-v-78f825c0"),i=i(),eh(),i),PT={class:"playerHome"},kT={class:"liveCon"},OT={key:0,class:"player_mian"},FT=_T(()=>Pe("div",{class:"player_mian_playback"},null,-1)),NT={class:"player_mian_yuntai"},MT={class:"player_mian_yunta_left"},UT=["src"],BT={class:"player_mian_yunta_right"},$T={class:"towards_far"},GT={class:"towards_near"},KT={__name:"index",setup(i){let e=ps(Ll),t=ps("bcde5e16864d4071934b51c4cf154fe2"),s=ps("http://139.9.65.252:83/openUrl/qub0mxW/live.m3u8"),n=ps([]);const r=ps(!1),o=()=>{const f=navigator.userAgent,h=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i;r.value=h.test(f)};qr(()=>{o(),l()});const a=f=>{},l=()=>{z0({protocol:"hls"}).then(f=>{n.value=f.data.map(h=>{let d={url:h.data.url,flag:!1};return{...h,data:d}}),console.log(n.value,""),s.value=n.value[11].data.url,t.value=n.value[11].cameraIndexCode})},c=f=>{console.log("Control",f),f=="UP"?e.value=IT:f=="RIGHT"?e.value=DT:f=="DOWN"?e.value=CT:f=="LEFT"&&(e.value=wT),wa({command:f,cameraIndexCode:t.value,action:"0",speed:"40"}).then(h=>{console.log(h,"speed")})},u=f=>{console.log("stop",f),e.value=Ll,wa({cameraIndexCode:t.value,command:f,action:"1"}).then(h=>{console.log(h,"stop")})};return(f,h)=>(Rs(),$i("div",PT,[Pe("div",{class:Zi(r.value?"player_box":"player_box1"),ref:"parentElement"},[Pe("div",kT,[Ze(bT,{sourceUrl:zt(s),onPlayStatus:a},null,8,["sourceUrl"])])],2),r.value?(Rs(),$i("div",OT,[FT,Pe("div",NT,[Pe("div",MT,[Pe("img",{src:zt(e)},null,8,UT),Pe("div",{class:"towards_top",onTouchstart:h[0]||(h[0]=d=>c("UP")),onTouchend:h[1]||(h[1]=d=>u("UP")),onMousedown:h[2]||(h[2]=d=>c("UP")),onMouseup:h[3]||(h[3]=d=>u("UP"))},null,32),Pe("div",{class:"towards_right",onTouchstart:h[4]||(h[4]=d=>c("RIGHT")),onTouchend:h[5]||(h[5]=d=>u("RIGHT")),onMousedown:h[6]||(h[6]=d=>c("RIGHT")),onMouseup:h[7]||(h[7]=d=>u("RIGHT"))},null,32),Pe("div",{class:"towards_lower",onTouchstart:h[8]||(h[8]=d=>c("DOWN")),onTouchend:h[9]||(h[9]=d=>u("DOWN")),onMousedown:h[10]||(h[10]=d=>c("DOWN")),onMouseup:h[11]||(h[11]=d=>u("DOWN"))},null,32),Pe("div",{class:"towards_left",onTouchstart:h[12]||(h[12]=d=>c("LEFT")),onTouchend:h[13]||(h[13]=d=>u("LEFT")),onMousedown:h[14]||(h[14]=d=>c("LEFT")),onMouseup:h[15]||(h[15]=d=>u("LEFT"))},null,32)]),Pe("div",BT,[Pe("div",null,[Pe("div",$T,[Pe("img",{src:kg,onTouchstart:h[16]||(h[16]=d=>c("ZOOM_IN")),onTouchend:h[17]||(h[17]=d=>u("ZOOM_IN")),onMousedown:h[18]||(h[18]=d=>c("ZOOM_IN")),onMouseup:h[19]||(h[19]=d=>u("ZOOM_IN"))},null,32)]),Pe("div",GT,[Pe("img",{src:Og,onTouchstart:h[20]||(h[20]=d=>c("ZOOM_OUT")),onTouchend:h[21]||(h[21]=d=>u("ZOOM_OUT")),onMousedown:h[22]||(h[22]=d=>c("ZOOM_OUT")),onMouseup:h[23]||(h[23]=d=>u("ZOOM_OUT"))},null,32)])])])])])):pc("",!0)]))}},HT=eo(KT,[["__scopeId","data-v-78f825c0"]]),VT=[{path:"/",name:"首页",redirect:"/home"},{path:"/home",name:"home",component:HT}],WT=Dg({routes:VT,history:Vd()});Rd(Pg).use(WT).mount("#app");