PageSourceSearch

https://primal.net/assets/index-c5647853.js

js primal.net collected 2026-10-09 21:45:40 UTC 1,722,710 bytes, 3,584 lines download raw bytes

1var DL=Object.defineProperty;var U4=(t,e,n)=>e in t?DL(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var a=(t,e)=>DL(t,"name",{value:e,configurable:!0});var vt=(t,e,n)=>(U4(t,typeof e!="symbol"?e+"":e,n),n),Vy=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)};var Re=(t,e,n)=>(Vy(t,e,"read from private field"),n?n.call(t):e.get(t)),Ze=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},st=(t,e,n,i)=>(Vy(t,e,"write to private field"),i?i.call(t,n):e.set(t,n),n);var en=(t,e,n)=>(Vy(t,e,"access private method"),n);a(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const r of s)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const r={};return s.integrity&&(r.integrity=s.integrity),s.referrerPolicy&&(r.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?r.credentials="include":s.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}a(n,"getFetchOpts");function i(s){if(s.ep)return;s.ep=!0;const r=n(s);fetch(s.href,r)}a(i,"processPreload")},"polyfill")();const ot={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return OL(this.context.count)},getNextContextId(){return OL(this.context.count++)}};function OL(t){const e=String(t),n=e.length-1;return ot.context.id+(n?String.fromCharCode(96+n):"")+e}a(OL,"getContextId");function zu(t){ot.context=t}a(zu,"setHydrateContext");const KP=!1,B4=a((t,e)=>t===e,"equalFn"),ri=Symbol("solid-proxy"),qP=typeof Proxy=="function",Cf=Symbol("solid-track"),qm={equals:B4};let jP=JP;const Ao=1,jm=2,YP={owned:null,cleanups:null,context:null,owner:null},Wy={};var Ft=null;let zy=null,$4=null,Kt=null,Ai=null,mo=null,Vv=0;function ld(t,e){const n=Kt,i=Ft,s=t.length===0,r=e===void 0?i:e,o=s?YP:{owned:null,cleanups:null,context:r?r.context:null,owner:r},l=s?t:()=>t(()=>An(()=>Df(o)));Ft=o,Kt=null;try{return Nr(l,!0)}finally{Kt=n,Ft=i}}a(ld,"createRoot");function Je(t,e){e=e?Object.assign({},qm,e):qm;const n={value:t,observers:null,observerSlots:null,comparator:e.equals||void 0},i=a(s=>(typeof s=="function"&&(s=s(n.value)),QP(n,s)),"setter");return[ZP.bind(n),i]}a(Je,"createSignal");function OE(t,e,n){const i=zv(t,e,!0,Ao);eu(i)}a(OE,"createComputed");function ze(t,e,n){const i=zv(t,e,!1,Ao);eu(i)}a(ze,"createRenderEffect");function We(t,e,n){jP=q4;const i=zv(t,e,!1,Ao);(!n||!n.render)&&(i.user=!0),mo?mo.push(i):eu(i)}a(We,"createEffect");function ht(t,e,n){n=n?Object.assign({},qm,n):qm;const i=zv(t,e,!0,0);return i.observers=null,i.observerSlots=null,i.comparator=n.equals||void 0,eu(i),ZP.bind(i)}a(ht,"createMemo");function H4(t){return t&&typeof t=="object"&&"then"in t}a(H4,"isPromise$1");function G4(t,e,n){let i,s,r;typeof e=="function"?(i=t,s=e,r=n||{}):(i=!0,s=t,r=e||{});let o=null,l=Wy,d=null,c=!1,u="initialValue"in r,f=typeof i=="function"&&ht(i);const h=new Set,[p,g]=(r.storage||Je)(r.initialValue),[v,y]=Je(void 0),[b,E]=Je(void 0,{equals:!1}),[T,I]=Je(u?"ready":"unresolved");ot.context&&(d=ot.getNextContextId(),r.ssrLoadFrom==="initial"?l=r.initialValue:ot.load&&ot.has(d)&&(l=ot.load(d)));function M(D,L,m,S){return o===D&&(o=null,S!==void 0&&(u=!0),(D===l||L===l)&&r.onHydrated&&queueMicrotask(()=>r.onHydrated(S,{value:L})),l=Wy,H(L,m)),L}a(M,"loadEnd");function H(D,L){Nr(()=>{L===void 0&&g(()=>D),I(L!==void 0?"errored":u?"ready":"unresolved"),y(L);for(const m of h.keys())m.decrement();h.clear()},!1)}a(H,"completeLoad");function N(){const D=W4,L=p(),m=v();if(m!==void 0&&!o)throw m;return Kt&&!Kt.user&&D&&OE(()=>{b(),o&&(D.resolved||h.has(D)||(D.increment(),h.add(D)))}),L}a(N,"read");function $(D=!0){if(D!==!1&&c)return;c=!1;const L=f?f():i;if(L==null||L===!1){M(o,An(p));return}let m;const S=l!==Wy?l:An(()=>{try{return s(L,{value:p(),refetching:D})}catch(_){m=_}});if(m!==void 0){M(o,void 0,Xg(m),L);return}else if(!H4(S))return M(o,S,void 0,L),S;return o=S,"v"in S?(S.s===1?M(o,S.v,void 0,L):M(o,void 0,Xg(S.v),L),S):(c=!0,queueMicrotask(()=>c=!1),Nr(()=>{I(u?"refreshing":"pending"),E()},!1),S.then(_=>M(S,_,void 0,L),_=>M(S,void 0,Xg(_),L)))}a($,"load"),Object.defineProperties(N,{state:{get:()=>T()},error:{get:()=>v()},loading:{get(){const D=T();return D==="pending"||D==="refreshing"}}
1,latest:{get(){if(!u)return N();const D=v();if(D&&!o)throw D;return p()}}});let F=Ft;return f?OE(()=>(F=Ft,$(!1))):$(!1),[N,{refetch:D=>Wv(F,()=>$(D)),mutate:g}]}a(G4,"createResource");function Aa(t){return Nr(t,!1)}a(Aa,"batch");function An(t){if(Kt===null)return t();const e=Kt;Kt=null;try{return t()}finally{Kt=e}}a(An,"untrack");function oi(t,e,n){const i=Array.isArray(t);let s,r=n&&n.defer;return o=>{let l;if(i){l=Array(t.length);for(let c=0;c<t.length;c++)l[c]=t[c]()}else l=t();if(r)return r=!1,o;const d=An(()=>e(l,s,o));return s=l,d}}a(oi,"on");function Or(t){We(()=>An(t))}a(Or,"onMount");function Tt(t){return Ft===null||(Ft.cleanups===null?Ft.cleanups=[t]:Ft.cleanups.push(t)),t}a(Tt,"onCleanup");function Id(){return Kt}a(Id,"getListener");function Pf(){return Ft}a(Pf,"getOwner");function Wv(t,e){const n=Ft,i=Kt;Ft=t,Kt=null;try{return Nr(e,!0)}catch(s){ET(s)}finally{Ft=n,Kt=i}}a(Wv,"runWithOwner");function pf(t){const e=Kt,n=Ft;return Promise.resolve().then(()=>{Kt=e,Ft=n;let i;return Nr(t,!1),Kt=Ft=null,i?i.done:void 0})}a(pf,"startTransition");const[V4,V0e]=Je(!1);function W0e(){return[V4,pf]}a(W0e,"useTransition");function Pn(t,e){const n=Symbol("context");return{id:n,Provider:j4(n),defaultValue:t}}a(Pn,"createContext");function Dn(t){let e;return Ft&&Ft.context&&(e=Ft.context[t.id])!==void 0?e:t.defaultValue}a(Dn,"useContext");function Tp(t){const e=ht(t),n=ht(()=>NE(e()));return n.toArray=()=>{const i=n();return Array.isArray(i)?i:i!=null?[i]:[]},n}a(Tp,"children");let W4;function ZP(){if(this.sources&&this.state)if(this.state===Ao)eu(this);else{const t=Ai;Ai=null,Nr(()=>Zm(this),!1),Ai=t}if(Kt){const t=this.observers?this.observers.length:0;Kt.sources?(Kt.sources.push(this),Kt.sourceSlots.push(t)):(Kt.sources=[this],Kt.sourceSlots=[t]),this.observers?(this.observers.push(Kt),this.observerSlots.push(Kt.sources.length-1)):(this.observers=[Kt],this.observerSlots=[Kt.sources.length-1])}return this.value}a(ZP,"readSignal");function QP(t,e,n){let i=t.value;return(!t.comparator||!t.comparator(i,e))&&(t.value=e,t.observers&&t.observers.length&&Nr(()=>{for(let s=0;s<t.observers.length;s+=1){const r=t.observers[s],o=zy&&zy.running;o&&zy.disposed.has(r),(o?!r.tState:!r.state)&&(r.pure?Ai.push(r):mo.push(r),r.observers&&XP(r)),o||(r.state=Ao)}if(Ai.length>1e6)throw Ai=[],new Error},!1)),e}a(QP,"writeSignal");function eu(t){if(!t.fn)return;Df(t);const e=Vv;z4(t,t.value,e)}a(eu,"updateComputation");function z4(t,e,n){let i;const s=Ft,r=Kt;Kt=Ft=t;try{i=t.fn(e)}catch(o){return t.pure&&(t.state=Ao,t.owned&&t.owned.forEach(Df),t.owned=null),t.updatedAt=n+1,ET(o)}finally{Kt=r,Ft=s}(!t.updatedAt||t.updatedAt<=n)&&(t.updatedAt!=null&&"observers"in t?QP(t,i):t.value=i,t.updatedAt=n)}a(z4,"runComputation");function zv(t,e,n,i=Ao,s){const r={fn:t,state:i,updatedAt:null,owned:null,sources:null,
1sourceSlots:null,cleanups:null,value:e,owner:Ft,context:Ft?Ft.context:null,pure:n};return Ft===null||Ft!==YP&&(Ft.owned?Ft.owned.push(r):Ft.owned=[r]),r}a(zv,"createComputation");function Ym(t){if(t.state===0)return;if(t.state===jm)return Zm(t);if(t.suspense&&An(t.suspense.inFallback))return t.suspense.effects.push(t);const e=[t];for(;(t=t.owner)&&(!t.updatedAt||t.updatedAt<Vv);)t.state&&e.push(t);for(let n=e.length-1;n>=0;n--)if(t=e[n],t.state===Ao)eu(t);else if(t.state===jm){const i=Ai;Ai=null,Nr(()=>Zm(t,e[0]),!1),Ai=i}}a(Ym,"runTop");function Nr(t,e){if(Ai)return t();let n=!1;e||(Ai=[]),mo?n=!0:mo=[],Vv++;try{const i=t();return K4(n),i}catch(i){n||(mo=null),Ai=null,ET(i)}}a(Nr,"runUpdates");function K4(t){if(Ai&&(JP(Ai),Ai=null),t)return;const e=mo;mo=null,e.length&&Nr(()=>jP(e),!1)}a(K4,"completeUpdates");function JP(t){for(let e=0;e<t.length;e++)Ym(t[e])}a(JP,"runQueue");function q4(t){let e,n=0;for(e=0;e<t.length;e++){const i=t[e];i.user?t[n++]=i:Ym(i)}if(ot.context){if(ot.count){ot.effects||(ot.effects=[]),ot.effects.push(...t.slice(0,n));return}zu()}for(ot.effects&&(ot.done||!ot.count)&&(t=[...ot.effects,...t],n+=ot.effects.length,delete ot.effects),e=0;e<n;e++)Ym(t[e])}a(q4,"runUserEffects");function Zm(t,e){t.state=0;for(let n=0;n<t.sources.length;n+=1){const i=t.sources[n];if(i.sources){const s=i.state;s===Ao?i!==e&&(!i.updatedAt||i.updatedAt<Vv)&&Ym(i):s===jm&&Zm(i,e)}}}a(Zm,"lookUpstream");function XP(t){for(let e=0;e<t.observers.length;e+=1){const n=t.observers[e];n.state||(n.state=jm,n.pure?Ai.push(n):mo.push(n),n.observers&&XP(n))}}a(XP,"markDownstream");function Df(t){let e;if(t.sources)for(;t.sources.length;){const n=t.sources.pop(),i=t.sourceSlots.pop(),s=n.observers;if(s&&s.length){const r=s.pop(),o=n.observerSlots.pop();i<s.length&&(r.sourceSlots[o]=i,s[i]=r,n.observerSlots[i]=o)}}if(t.tOwned){for(e=t.tOwned.length-1;e>=0;e--)Df(t.tOwned[e]);delete t.tOwned}if(t.owned){for(e=t.owned.length-1;e>=0;e--)Df(t.owned[e]);t.owned=null}if(t.cleanups){for(e=t.cleanups.length-1;e>=0;e--)t.cleanups[e]();t.cleanups=null}t.state=0}a(Df,"cleanNode");function Xg(t){return t instanceof Error?t:new Error(typeof t=="string"?t:"Unknown error",{cause:t})}a(Xg,"castError");function ET(t,e=Ft){throw Xg(t)}a(ET,"handleError");function NE(t){if(typeof t=="function"&&!t.length)return NE(t());if(Array.isArray(t)){const e=[];for(let n=0;n<t.length;n++){const i=NE(t[n]);Array.isArray(i)?e.push.apply(e,i):e.push(i)}return e}return t}a(NE,"resolveChildren");function j4(t,e){return a(function(i){let s;return ze(()=>s=An(()=>(Ft.context={...Ft.context,[t]:i.value},Tp(()=>i.children))),void 0),s},"provider")}a(j4,"createProvider");const Y4=Symbol("fallback");function NL(t){for(let e=0;e<t.length;e++)t[e]()}a(NL,"dispose");function Z4(t,e,n={}){let i=[],s=[],r=[],o=0,l=e.length>1?[]:null;return Tt(()=>NL(r)),()=>{let d=t()||[],c=d.length,u,f;return d[Cf],An(()=>{let p,g,v,y,b,E,T,I,M;if(c===0)o!==0&&(NL(r),r=[],i=[],s=[],o=0,l&&(l=[])),n.fallback&&(i=[Y4],s[0]=ld(H=>(r[0]=H,n.fallback())),o=1);else if(o===0){for(s=new Array(c),f=0;f<c;f++)i[f]=d[f],s[f]=ld(h);o=c}else{for(v=new Array(c),y=new Array(c),l&&(b=new Array(c)),E=0,T=Math.min(o,c);E<T&&i[E]===d[E];E++);for(T=o-1,I=c-1;T>=E&&I>=E&&i[T]===d[I];T--,I--)v[I]=s[T],y[I]=r[T],l&&(b[I]=l[T]);for(p=new Map,g=new Array(I+1),f=I;f>=E;f--)M=d[f],u=p.get(M),g[f]=u===void 0?-1:u,p.set(M,f);for(u=E;u<=T;u++)M=i[u],f=p.get(M),f!==void 0&&f!==-1?(v[f]=s[u],y[f]=r[u],l&&(b[f]=l[u]),f=g[f],p.set(M,f)):r[u]();for(f=E;f<c;f++)f in v?(s[f]=v[f],r[f]=y[f],l&&(l[f]=b[f],l[f](f))):s[f]=ld(h);s=s.slice(0,o=c),i=d.slice(0)}return s});function h(p){if(r[f]=p,l){const[g,v]=Je(f);return l[f]=v,e(d[f],g)}return e(d[f])}a(h,"mapper")}}a(Z4,"mapArray");function X(t,e){return An(()=>t(e||{}))}a(X,"createComponent");function Yp(){return!0}a(Yp,"trueFn");const FE={get(t,e,n){return e===ri?n:t.get(e)},has(t,e){return e===ri?!0:t.has(e)},set:Yp,deleteProperty:Yp,getOwnPropertyDescriptor(t,e){return{configurable:!0,enumerable:!0,get(){return t.get(e)},set:Yp,deleteProperty:Yp}},ownKeys(t){return t.keys()}};function Ky(t){return(t=typeof t=="function"?t():t)?t:{}}a(Ky,"resolveSource");function Q4(){for(let t=0,e=this.length;t<e;++t){const n=this[t]();if(n!==void 0)return n}}a(Q4,"resolveSources");function Yt(...t){let e=!1;for(let o=0;o<t.length;o++){const l=t[o];e=e||!!l&&ri in l,t[o]=typeof l=="function"?(e=!0,ht(l)):l}if(qP&&e)return new Proxy({get(o){for(let l=t.length-1;l>=0;l--){const d=Ky(t[l])[o];if(d!==void 0)return d}},has(o){for(let l=t.length-1;l>=0;l--)if(o in Ky(t[l]))return!0;return!1},keys(){const o=[];for(let l=0;l<t.length;l++)o.push(...Object.keys(Ky(t[l])));return[...new Set(o)]}},FE);const n={},i=Object.create(null);for(let o=t.length-1;o>=0;o--){const l=t[o];if(!l)continue;const d=Object.getOwnPropertyNames(l);for(let c=d.length-1;c>=0;
1c--){const u=d[c];if(u==="__proto__"||u==="constructor")continue;const f=Object.getOwnPropertyDescriptor(l,u);if(!i[u])i[u]=f.get?{enumerable:!0,configurable:!0,get:Q4.bind(n[u]=[f.get.bind(l)])}:f.value!==void 0?f:void 0;else{const h=n[u];h&&(f.get?h.push(f.get.bind(l)):f.value!==void 0&&h.push(()=>f.value))}}}const s={},r=Object.keys(i);for(let o=r.length-1;o>=0;o--){const l=r[o],d=i[l];d&&d.get?Object.defineProperty(s,l,d):s[l]=d?d.value:void 0}return s}a(Yt,"mergeProps");function Gn(t,...e){if(qP&&ri in t){const s=new Set(e.length>1?e.flat():e[0]),r=e.map(o=>new Proxy({get(l){return o.includes(l)?t[l]:void 0},has(l){return o.includes(l)&&l in t},keys(){return o.filter(l=>l in t)}},FE));return r.push(new Proxy({get(o){return s.has(o)?void 0:t[o]},has(o){return s.has(o)?!1:o in t},keys(){return Object.keys(t).filter(o=>!s.has(o))}},FE)),r}const n={},i=e.map(()=>({}));for(const s of Object.getOwnPropertyNames(t)){const r=Object.getOwnPropertyDescriptor(t,s),o=!r.get&&!r.set&&r.enumerable&&r.writable&&r.configurable;let l=!1,d=0;for(const c of e)c.includes(s)&&(l=!0,o?i[d][s]=r.value:Object.defineProperty(i[d],s,r)),++d;l||(o?n[s]=r.value:Object.defineProperty(n,s,r))}return[...i,n]}a(Gn,"splitProps");function at(t){let e,n;const i=a(s=>{const r=ot.context;if(r){const[l,d]=Je();ot.count||(ot.count=0),ot.count++,(n||(n=t())).then(c=>{!ot.done&&zu(r),ot.count--,d(()=>c.default),zu()}),e=l}else if(!e){const[l]=G4(()=>(n||(n=t())).then(d=>d.default));e=l}let o;return ht(()=>(o=e())?An(()=>{if(!r||ot.done)return o(s);const l=ot.context;zu(r);const d=o(s);return zu(l),d}):"")},"wrap");return i.preload=()=>n||((n=t()).then(s=>e=a(()=>s.default,"comp")),n),i}a(at,"lazy");let J4=0;function Ap(){return ot.context?ot.getNextContextId():`cl-${J4++}`}a(Ap,"createUniqueId");const eD=a(t=>`Stale read from <${t}>.`,"narrowedError");function UE(t){const e="fallback"in t&&{fallback:()=>t.fallback};return ht(Z4(()=>t.each,t.children,e||void 0))}a(UE,"For");function sn(t){const e=t.keyed,n=ht(()=>t.when,void 0,void 0),i=e?n:ht(n,void 0,{equals:(s,r)=>!s==!r});return ht(()=>{const s=i();if(s){const r=t.children;return typeof r=="function"&&r.length>0?An(()=>r(e?s:()=>{if(!An(i))throw eD("Show");return n()})):r}return t.fallback},void 0,void 0)}a(sn,"Show");function Qm(t){const e=Tp(()=>t.children),n=ht(()=>{const i=e(),s=Array.isArray(i)?i:[i];let r=a(()=>{},"func");for(let o=0;o<s.length;o++){const l=o,d=s[o],c=r,u=ht(()=>c()?void 0:d.when,void 0,void 0),f=d.keyed?u:ht(u,void 0,{equals:(h,p)=>!h==!p});r=a(()=>c()||(f()?[l,u,d]:void 0),"func")}return r});return ht(()=>{const i=n()();if(!i)return t.fallback;const[s,r,o]=i,l=o.children;return typeof l=="function"&&l.length>0?An(()=>l(o.keyed?r():()=>{if(An(n)()?.[0]!==s)throw eD("Match");return r()})):l},void 0,void 0)}a(Qm,"Switch");function _a(t){return t}a(_a,"Match");const X4=["allowfullscreen","async","alpha","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected","adauctionheaders","browsingtopics","credentialless","defaultchecked","defaultmuted","defaultselected","defer","disablepictureinpicture","disableremoteplayback","preservespitch","shadowrootclonable","shadowrootcustomelementregistry","shadowrootdelegatesfocus","shadowrootserializable","sharedstoragewritable"],e8=new Set(["className","value","readOnly","noValidate","formNoValidate","isMap","noModule","playsInline","adAuctionHeaders","allowFullscreen","browsingTopics","defaultChecked","defaultMuted","defaultSelected","disablePictureInPicture","disableRemotePlayback","preservesPitch","shadowRootClonable","shadowRootCustomElementRegistry","shadowRootDelegatesFocus","shadowRootSerializable","sharedStorageWritable",...X4]),t8=new Set(["innerHTML","textContent","innerText","children"]),n8=Object.assign(Object.create(null),{className:"class",htmlFor:"for"}),i8=Object.assign(Object.create(null),{class:"className",novalidate:{$:"noValidate",FORM:1},formnovalidate:{$:"formNoValidate",BUTTON:1,INPUT:1},ismap:{$:"isMap",IMG:1},nomodule:{$:"noModule",SCRIPT:1}
1,playsinline:{$:"playsInline",VIDEO:1},readonly:{$:"readOnly",INPUT:1,TEXTAREA:1},adauctionheaders:{$:"adAuctionHeaders",IFRAME:1},allowfullscreen:{$:"allowFullscreen",IFRAME:1},browsingtopics:{$:"browsingTopics",IMG:1},defaultchecked:{$:"defaultChecked",INPUT:1},defaultmuted:{$:"defaultMuted",AUDIO:1,VIDEO:1},defaultselected:{$:"defaultSelected",OPTION:1},disablepictureinpicture:{$:"disablePictureInPicture",VIDEO:1},disableremoteplayback:{$:"disableRemotePlayback",AUDIO:1,VIDEO:1},preservespitch:{$:"preservesPitch",AUDIO:1,VIDEO:1},shadowrootclonable:{$:"shadowRootClonable",TEMPLATE:1},shadowrootdelegatesfocus:{$:"shadowRootDelegatesFocus",TEMPLATE:1},shadowrootserializable:{$:"shadowRootSerializable",TEMPLATE:1},sharedstoragewritable:{$:"sharedStorageWritable",IFRAME:1,IMG:1}});function s8(t,e){const n=i8[t];return typeof n=="object"?n[e]?n.$:void 0:n}a(s8,"getPropAlias");const r8=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),o8=new Set(["altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","stop","svg","switch","symbol","text","textPath","tref","tspan","use","view","vkern"]),a8={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},ps=a(t=>ht(()=>t()),"memo");function l8(t,e,n){let i=n.length,s=e.length,r=i,o=0,l=0,d=e[s-1].nextSibling,c=null;for(;o<s||l<r;){if(e[o]===n[l]){o++,l++;continue}for(;e[s-1]===n[r-1];)s--,r--;if(s===o){const u=r<i?l?n[l-1].nextSibling:n[r-l]:d;for(;l<r;)t.insertBefore(n[l++],u)}else if(r===l)for(;o<s;)(!c||!c.has(e[o]))&&e[o].remove(),o++;else if(e[o]===n[r-1]&&n[l]===e[s-1]){const u=e[--s].nextSibling;t.insertBefore(n[l++],e[o++].nextSibling),t.insertBefore(n[--r],u),e[s]=n[r]}else{if(!c){c=new Map;let f=l;for(;f<r;)c.set(n[f],f++)}const u=c.get(e[o]);if(u!=null)if(l<u&&u<r){let f=o,h=1,p;for(;++f<s&&f<r&&!((p=c.get(e[f]))==null||p!==u+h);)h++;if(h>u-l){const g=e[o];for(;l<u;)t.insertBefore(n[l++],g)}else t.replaceChild(n[l++],e[o++])}else o++;else e[o++].remove()}}}a(l8,"reconcileArrays");const FL="_$DX_DELEGATE";function c8(t,e,n,i={}){let s;return ld(r=>{s=r,e===document?t():Fe(e,t(),e.firstChild?null:void 0,n)},i.owner),()=>{s(),e.textContent=""}}a(c8,"render");function It(t,e,n,i){let s;const r=a(()=>{const l=i?document.createElementNS("http://www.w3.org/1998/Math/MathML","template"):document.createElement("template");return l.innerHTML=t,n?l.content.firstChild.firstChild:i?l.firstChild:l.content.firstChild},"create"),o=e?()=>An(()=>document.importNode(s||(s=r()),!0)):()=>(s||(s=r())).cloneNode(!0);return o.cloneNode=o,o}a(It,"template$1");function Kv(t,e=window.document){const n=e[FL]||(e[FL]=new Set);for(let i=0,s=t.length;i<s;i++){const r=t[i];n.has(r)||(n.add(r),e.addEventListener(r,v8))}}a(Kv,"delegateEvents");function Ct(t,e,n){Ql(t)||(n==null?t.removeAttribute(e):t.setAttribute(e,n))}a(Ct,"setAttribute");function d8(t,e,n,i){Ql(t)||(i==null?t.removeAttributeNS(e,n):t.setAttributeNS(e,n,i))}a(d8,"setAttributeNS");function u8(t,e,n){Ql(t)||(n?t.setAttribute(e,""):t.removeAttribute(e))}a(u8,"setBoolAttribute");function xe(t,e){Ql(t)||(e==null?t.removeAttribute("class"):t.className=e)}a(xe,"className");function f8(t,e,n,i){if(i)Array.isArray(n)?(t[`$$${e}`]=n[0],t[`$$${e}Data`]=n[1]):t[`$$${e}`]=n;else if(Array.isArray(n)){const s=n[0];t.addEventListener(e,n[0]=r=>s.call(t,n[1],r))}else t.addEventListener(e,n,typeof n!="function"&&n)}a(f8,"addEventListener$1");function h8(t,e,n={}){const i=Object.keys(e||{}),s=Object.keys(n);let r,o;for(r=0,o=s.length;r<o;r++){const l=s[r];!l||l==="undefined"||e[l]||(UL(t,l,!1),delete n[l])}for(r=0,o=i.length;r<o;r++){const l=i[r],d=!!e[l];
1!l||l==="undefined"||n[l]===d||!d||(UL(t,l,!0),n[l]=d)}return n}a(h8,"classList");function tD(t,e,n){if(!e)return n?Ct(t,"style"):e;const i=t.style;if(typeof e=="string")return i.cssText=e;typeof n=="string"&&(i.cssText=n=void 0),n||(n={}),e||(e={});let s,r;for(r in n)e[r]==null&&i.removeProperty(r),delete n[r];for(r in e)s=e[r],s!==n[r]&&(i.setProperty(r,s),n[r]=s);return n}a(tD,"style");function nD(t,e={},n,i){const s={};return i||ze(()=>s.children=Rd(t,e.children,s.children)),ze(()=>typeof e.ref=="function"&&Ld(e.ref,t)),ze(()=>p8(t,e,n,!0,s,!0)),s}a(nD,"spread");function Ld(t,e,n){return An(()=>t(e,n))}a(Ld,"use");function Fe(t,e,n,i){if(n!==void 0&&!i&&(i=[]),typeof e!="function")return Rd(t,e,i,n);ze(s=>Rd(t,e(),s,n),i)}a(Fe,"insert");function p8(t,e,n,i,s={},r=!1){e||(e={});for(const o in s)if(!(o in e)){if(o==="children")continue;s[o]=BL(t,o,null,s[o],n,r,e)}for(const o in e){if(o==="children"){i||Rd(t,e.children);continue}const l=e[o];s[o]=BL(t,o,l,s[o],n,r,e)}}a(p8,"assign$1");function g8(t){let e,n;return!Ql()||!(e=ot.registry.get(n=y8()))?t():(ot.completed&&ot.completed.add(e),ot.registry.delete(n),e)}a(g8,"getNextElement");function Ql(t){return!!ot.context&&!ot.done&&(!t||t.isConnected)}a(Ql,"isHydrating");function m8(t){return t.toLowerCase().replace(/-([a-z])/g,(e,n)=>n.toUpperCase())}a(m8,"toPropertyName");function UL(t,e,n){const i=e.trim().split(/\s+/);for(let s=0,r=i.length;s<r;s++)t.classList.toggle(i[s],n)}a(UL,"toggleClassKey");function BL(t,e,n,i,s,r,o){let l,d,c,u,f;if(e==="style")return tD(t,n,i);if(e==="classList")return h8(t,n,i);if(n===i)return i;if(e==="ref")r||n(t);else if(e.slice(0,3)==="on:"){const h=e.slice(3);i&&t.removeEventListener(h,i,typeof i!="function"&&i),n&&t.addEventListener(h,n,typeof n!="function"&&n)}else if(e.slice(0,10)==="oncapture:"){const h=e.slice(10);i&&t.removeEventListener(h,i,!0),n&&t.addEventListener(h,n,!0)}else if(e.slice(0,2)==="on"){const h=e.slice(2).toLowerCase(),p=r8.has(h);if(!p&&i){const g=Array.isArray(i)?i[0]:i;t.removeEventListener(h,g)}(p||n)&&(f8(t,h,n,p),p&&Kv([h]))}else if(e.slice(0,5)==="attr:")Ct(t,e.slice(5),n);else if(e.slice(0,5)==="bool:")u8(t,e.slice(5),n);else if((f=e.slice(0,5)==="prop:")||(c=t8.has(e))||!s&&((u=s8(e,t.tagName))||(d=e8.has(e)))||(l=t.nodeName.includes("-")||"is"in o)){if(f)e=e.slice(5),d=!0;else if(Ql(t))return n;e==="class"||e==="className"?xe(t,n):l&&!d&&!c?t[m8(e)]=n:t[u||e]=n}else{const h=s&&e.indexOf(":")>-1&&a8[e.split(":")[0]];h?d8(t,h,e,n):Ct(t,n8[e]||e,n)}return n}a(BL,"assignProp");function v8(t){if(ot.registry&&ot.events&&ot.events.find(([d,c])=>c===t))return;let e=t.target;const n=`$$${t.type}`,i=t.target,s=t.currentTarget,r=a(d=>Object.defineProperty(t,"target",{configurable:!0,value:d}),"retarget"),o=a(()=>{const d=e[n];if(d&&!e.disabled){const c=e[`${n}Data`];if(c!==void 0?d.call(e,c,t):d.call(e,t),t.cancelBubble)return}return e.host&&typeof e.host!="string"&&!e.host._$host&&e.contains(t.target)&&r(e.host),!0},"handleNode"),l=a(()=>{for(;o()&&(e=e._$host||e.parentNode||e.host););},"walkUpTree");if(Object.defineProperty(t,"currentTarget",{configurable:!0,get(){return e||document}}),ot.registry&&!ot.done&&(ot.done=_$HY.done=!0),t.composedPath){const d=t.composedPath();r(d[0]);for(let c=0;c<d.length-2&&(e=d[c],!!o());c++){if(e._$host){e=e._$host,l();break}if(e.parentNode===s)break}}else l();r(i)}a(v8,"eventHandler");function Rd(t,e,n,i,s){const r=Ql(t);if(r){!n&&(n=[...t.childNodes]);let d=[];for(let c=0;c<n.length;c++){const u=n[c];u.nodeType===8&&u.data.slice(0,2)==="!$"?u.remove():d.push(u)}n=d}for(;typeof n=="function";)n=n();if(e===n)return n;const o=typeof e,l=i!==void 0;if(t=l&&n[0]&&n[0].parentNode||t,o==="string"||o==="number"){if(r||o==="number"&&(e=e.toString(),e===n))return n;if(l){let d=n[0];d&&d.nodeType===3?d.data!==e&&(d.data=e):d=document.createTextNode(e),n=hc(t,n,i,d)}else n!==""&&typeof n=="string"?n=t.firstChild.data=e:n=t.textContent=e}else if(e==null||o==="boolean"){if(r)return n;n=hc(t,n,i)}else{if(o==="function")return ze(()=>{let d=e();for(;typeof d=="function";)d=d();n=Rd(t,d,n,i)}),()=>n;if(Array.isArray(e)){const d=[],c=n&&Array.isArray(n);if(BE(d,e,n,s))return ze(()=>n=Rd(t,d,n,i,!0)),()=>n;if(r){if(!d.length)return n;if(i===void 0)return n=[...t.childNodes];let u=d[0];if(u.parentNode!==t)return n;const f=[u];for(;(u=u.nextSibling)!==i;)f.push(u);return n=f}if(d.length===0){if(n=hc(t,n,i),l)return n}else c?n.length===0?$L(t,d,i):l8(t,n,d):(n&&hc(t),$L(t,d));n=d}else if(e.nodeType){if(r&&e.parentNode)return n=l?[e]:e;if(Array.isArray(n)){if(l)return n=hc(t,n,i,e);hc(t,n,null,e)}else n==null||n===""||!t.firstChild?t.appendChild(e):t.replaceChild(e,t.firstChild);n=e}}return n}a(Rd,"insertExpression");function BE(t,e,n,i){let s=!1;for(let r=0,o=e.length;r<o;r++){let l=e[r],d=n&&n[t.length],c;if(!(l==null||l===!0||l===!1))if((c=typeof l)=="object"&&l.nodeType)t.push(l);else if(Array.isArray(l))s=BE(t,l,d)||s;else if(c==="function")if(i){for(;typeof l=="function";)l=l();s=BE(t,Array.isArray(l)?l:[l],Array.isArray(d)?d:[d])||s}else t.push(l),s=!0;else{const u=String(l);d&&d.nodeType===3&&d.data===u?t.push(d):t.push(document.createTextNode(u))}}return s}a(BE,"normalizeIncomingArray");function $L(t,e,n=null){for(let i=0,s=e.length;i<s;i++)t.insertBefore(e[i],n)}a($L,"appendNodes");function hc(t,e,n,i){if(n===void 0)return t.textContent="";const s=i||document.createTextNode("");if(e.length){let r=!1;for(let o=e.length-1;o>=0;o--){const l=e[o];if(s!==l){const d=l.parentNode===t;!r&&!o?d?t.replaceChild(s,l):t.insertBefore(s,n):d&&l.remove()}else r=!0}}else t.insertBefore(s,n);return[s]}a(hc,"cleanChildren");function y8(){return ot.getNextContextId()}a(y8,"getHydrationKey");const iD=!1,b8="http://www.w3.org/2000/svg";function sD(t,e=!1,n=void 0){return e?document.createElementNS(b8,t):document.createElement(t,{is:n})}a(sD,"createElement$1");function E8(t){const{useShadow:e}=t,n=document.createTextNode(""),i=a(()=>t.mount||document.body,"mount"),s=Pf();let r,o=!!ot.context;return We(()=>{o&&(Pf().user=o=!1),r||(r=Wv(s,()=>ht(()=>t.children)));const l=i();if(l instanceof HTMLHeadElement){const[d,c]=Je(!1),u=a(()=>c(!0),"cleanup");ld(f=>Fe(l,()=>d()?f():r(),null)),Tt(u)}else{const d=sD(t.isSVG?"g":"div",t.isSVG),c=e&&d.attachShadow?d.attachShadow({mode:"open"}):d;Object.defineProperty(d,"_$host",{get(){return n.parentNode},configurable:!0}),Fe(c,r),l.appendChild(d),t.ref&&t.ref(d),Tt(()=>l.removeChild(d))}},void 0,{render:!o}),n}a(E8,"Portal");function _8(t,e){const n=ht(t);return ht(()=>{const i=n();switch(typeof i){case"function":return An(()=>i(e));case"string":const s=o8.has(i),r=ot.context?g8():sD(i,s,An(()=>e.is));return nD(r,e,s),r}})}a(_8,"createDynamic");function w8(t){const[,e]=Gn(t,["component"]);return _8(()=>t.component,e)}a(w8,"Dynamic");const xi=a((...t)=>{localStorage.getItem("devMode")==="true"&&console.log(...t)},"logInfo"),ii=a((...t)=>{localStorage.getItem("devMode")==="true"&&console.warn(...t)},"logWarning"),Tn=a((...t)=>{localStorage.getItem("devMode")==="true"&&console.error(...t)},"logError");/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const S8=4,HL=0,GL=1,T8=2;function tu(t){let e=t.length;for(;--e>=0;)t[e]=0}a(tu,"zero$1");const A8=0,rD=1,x8=2,I8=3,L8=258,_T=29,xp=256,Of=xp+1+_T,cd=30,wT=19,oD=2*Of+1,ul=15,qy=16,R8=7,ST=256,aD=16,lD=17,cD=18,$E=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),em=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),k8=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),dD=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),M8=512,oo=new Array((Of+2)*2);tu(oo);const gf=new Array(cd*2);tu(gf);const Nf=new Array(M8);tu(Nf);const Ff=new Array(L8-I8+1);tu(Ff);const TT=new Array(_T);tu(TT);const Jm=new Array(cd);tu(Jm);function jy(t,e,n,i,s){this.static_tree=t,this.extra_bits=e,this.extra_base=n,this.elems=i,this.max_length=s,this.has_stree=t&&t.length}a(jy,"StaticTreeDesc");let uD,fD,hD;function Yy(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}a(Yy,"TreeDesc");const pD=a(t=>t<256?Nf[t]:Nf[256+(t>>
vendor: 4,923 bytes, line 1
1>7)],"d_code"),Uf=a((t,e)=>{t.pending_buf[t.pending++]=e&255,t.pending_buf[t.pending++]=e>>>8&255},"put_short"),Xi=a((t,e,n)=>{t.bi_valid>qy-n?(t.bi_buf|=e<<t.bi_valid&65535,Uf(t,t.bi_buf),t.bi_buf=e>>qy-t.bi_valid,t.bi_valid+=n-qy):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=n)},"send_bits"),Sr=a((t,e,n)=>{Xi(t,n[e*2],n[e*2+1])},"send_code"),gD=a((t,e)=>{let n=0;do n|=t&1,t>>>=1,n<<=1;while(--e>0);return n>>>1},"bi_reverse"),C8=a(t=>{t.bi_valid===16?(Uf(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=t.bi_buf&255,t.bi_buf>>=8,t.bi_valid-=8)},"bi_flush"),P8=a((t,e)=>{const n=e.dyn_tree,i=e.max_code,s=e.stat_desc.static_tree,r=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,l=e.stat_desc.extra_base,d=e.stat_desc.max_length;let c,u,f,h,p,g,v=0;for(h=0;h<=ul;h++)t.bl_count[h]=0;for(n[t.heap[t.heap_max]*2+1]=0,c=t.heap_max+1;c<oD;c++)u=t.heap[c],h=n[n[u*2+1]*2+1]+1,h>d&&(h=d,v++),n[u*2+1]=h,!(u>i)&&(t.bl_count[h]++,p=0,u>=l&&(p=o[u-l]),g=n[u*2],t.opt_len+=g*(h+p),r&&(t.static_len+=g*(s[u*2+1]+p)));if(v!==0){do{for(h=d-1;t.bl_count[h]===0;)h--;t.bl_count[h]--,t.bl_count[h+1]+=2,t.bl_count[d]--,v-=2}while(v>0);for(h=d;h!==0;h--)for(u=t.bl_count[h];u!==0;)f=t.heap[--c],!(f>i)&&(n[f*2+1]!==h&&(t.opt_len+=(h-n[f*2+1])*n[f*2],n[f*2+1]=h),u--)}},"gen_bitlen"),mD=a((t,e,n)=>{const i=new Array(ul+1);let s=0,r,o;for(r=1;r<=ul;r++)s=s+n[r-1]<<1,i[r]=s;for(o=0;o<=e;o++){let l=t[o*2+1];l!==0&&(t[o*2]=gD(i[l]++,l))}},"gen_codes"),D8=a(()=>{let t,e,n,i,s;const r=new Array(ul+1);for(n=0,i=0;i<_T-1;i++)for(TT[i]=n,t=0;t<1<<$E[i];t++)Ff[n++]=i;for(Ff[n-1]=i,s=0,i=0;i<16;i++)for(Jm[i]=s,t=0;t<1<<em[i];t++)Nf[s++]=i;for(s>>=7;i<cd;i++)for(Jm[i]=s<<7,t=0;t<1<<em[i]-7;t++)Nf[256+s++]=i;for(e=0;e<=ul;e++)r[e]=0;for(t=0;t<=143;)oo[t*2+1]=8,t++,r[8]++;for(;t<=255;)oo[t*2+1]=9,t++,r[9]++;for(;t<=279;)oo[t*2+1]=7,t++,r[7]++;for(;t<=287;)oo[t*2+1]=8,t++,r[8]++;for(mD(oo,Of+1,r),t=0;t<cd;t++)gf[t*2+1]=5,gf[t*2]=gD(t,5);uD=new jy(oo,$E,xp+1,Of,ul),fD=new jy(gf,em,0,cd,ul),hD=new jy(new Array(0),k8,0,wT,R8)},"tr_static_init"),vD=a(t=>{let e;for(e=0;e<Of;e++)t.dyn_ltree[e*2]=0;for(e=0;e<cd;e++)t.dyn_dtree[e*2]=0;for(e=0;e<wT;e++)t.bl_tree[e*2]=0;t.dyn_ltree[ST*2]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0},"init_block"),yD=a(t=>{t.bi_valid>8?Uf(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},"bi_windup"),VL=a((t,e,n,i)=>{const s=e*2,r=n*2;return t[s]<t[r]||t[s]===t[r]&&i[e]<=i[n]},"smaller"),Zy=a((t,e,n)=>{const i=t.heap[n];let s=n<<1;for(;s<=t.heap_len&&(s<t.heap_len&&VL(e,t.heap[s+1],t.heap[s],t.depth)&&s++,!VL(e,i,t.heap[s],t.depth));)t.heap[n]=t.heap[s],n=s,s<<=1;t.heap[n]=i},"pqdownheap"),WL=a((t,e,n)=>{let i,s,r=0,o,l;if(t.sym_next!==0)do i=t.pending_buf[t.sym_buf+r++]&255,i+=(t.pending_buf[t.sym_buf+r++]&255)<<8,s=t.pending_buf[t.sym_buf+r++],i===0?Sr(t,s,e):(o=Ff[s],Sr(t,o+xp+1,e),l=$E[o],l!==0&&(s-=TT[o],Xi(t,s,l)),i--,o=pD(i),Sr(t,o,n),l=em[o],l!==0&&(i-=Jm[o],Xi(t,i,l)));while(r<t.sym_next);Sr(t,ST,e)},"compress_block"),HE=a((t,e)=>{const n=e.dyn_tree,i=e.stat_desc.static_tree,s=e.stat_desc.has_stree,r=e.stat_desc.elems;let o,l,d=-1,c;for(t.heap_len=0,t.heap_max=oD,o=0;o<r;o++)n[o*2]!==0?(t.heap[++t.heap_len]=d=o,t.depth[o]=0):n[o*2+1]=0;for(;t.heap_len<2;)c=t.heap[++t.heap_len]=d<2?++d:0,n[c*2]=1,t.depth[c]=0,t.opt_len--,s&&(t.static_len-=i[c*2+1]);for(e.max_code=d,o=t.heap_len>>1;o>=1;o--)Zy(t,n,o);c=r;do o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Zy(t,n,1),l=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=l,n[c*2]=n[o*2]+n[l*2],t.depth[c]=(t.depth[o]>=t.depth[l]?t.depth[o]:t.depth[l])+1,n[o*2+1]=n[l*2+1]=c,t.heap[1]=c++,Zy(t,n,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],P8(t,e),mD(n,d,t.bl_count)},"build_tree"),zL=a((t,e,n)=>{let i,s=-1,r,o=e[0*2+1],l=0,d=7,c=4;for(o===0&&(d=138,c=3),e[(n+1)*2+1]=65535,i=0;i<=n;i++)r=o,o=e[(i+1)*2+1],!(++l<d&&r===o)&&(l<c?t.bl_tree[r*2]+=l:r!==0?(r!==s&&t.bl_tree[r*2]++,t.bl_tree[aD*2]++):l<=10?t.bl_tree[lD*2]++:t.bl_tree[cD*2]++,l=0,s=r,o===0?(d=138,c=3):r===o?(d=6,c=3):(d=7,c=4))},"scan_tree"),KL=a((t,e,n)=>{let i,s=-1,r,o=e[0*2+1],l=0,d=7,c=4;for(o===0&&(d=138,c=3),i=0;i<=n;i++)if(r=o,o=e[(i+1)*2+1],!(++l<d&&r===o)){if(l<c)do Sr(t,r,t.bl_tree);while(--l!==0);else r!==0?(r!==s&&(Sr(t,r,t.bl_tree),l--),Sr(t,aD,t.bl_tree),Xi(t,l-3,2)):l<=10?(Sr(t,lD,t.bl_tree),Xi(t,l-3,3)):(Sr(t,cD,t.bl_tree),Xi(t,l-11,7));l=0,s=r,o===0?(d=138,c=3):r===o?(d=6,c=3):(d=7,c=4)}},"send_tree"),O8=a(t=>{let e;for(zL(t,t.dyn_ltree,t.l_desc.max_code),zL(t,t.dyn_dtree,t.d_desc.max_code),HE(t,t.bl_desc),e=wT-1;e>=3&&t.bl_tree[dD[e]*2+1]===0;e--);return t.opt_len+=3*(e+1)+5+5+4,e},"build_bl_tree"),N8=a((t,e,n,i)=>{let s;for(Xi(t,e-257,5),Xi(t,n-1,5),Xi(t,i-4,4),s=0;s<i;s++)Xi(t,t.bl_tree[dD[s]*2+1],3);KL(t,t.dyn_ltree,e-1),KL(t,t.dyn_dtree,n-1)},"send_all_trees"),F8=a(t=>{let e=4093624447,n;for(n=0;n<=31;n++,e>>>=1)if(e&1&&t.dyn_ltree[n*2]!==0)return HL;
1if(t.dyn_ltree[9*2]!==0||t.dyn_ltree[10*2]!==0||t.dyn_ltree[13*2]!==0)return GL;for(n=32;n<xp;n++)if(t.dyn_ltree[n*2]!==0)return GL;return HL},"detect_data_type");let qL=!1;const U8=a(t=>{qL||(D8(),qL=!0),t.l_desc=new Yy(t.dyn_ltree,uD),t.d_desc=new Yy(t.dyn_dtree,fD),t.bl_desc=new Yy(t.bl_tree,hD),t.bi_buf=0,t.bi_valid=0,vD(t)},"_tr_init$1"),bD=a((t,e,n,i)=>{Xi(t,(A8<<1)+(i?1:0),3),yD(t),Uf(t,n),Uf(t,~n),n&&t.pending_buf.set(t.window.subarray(e,e+n),t.pending),t.pending+=n},"_tr_stored_block$1"),B8=a(t=>{Xi(t,rD<<1,3),Sr(t,ST,oo),C8(t)},"_tr_align$1"),$8=a((t,e,n,i)=>{let s,r,o=0;t.level>0?(t.strm.data_type===T8&&(t.strm.data_type=F8(t)),HE(t,t.l_desc),HE(t,t.d_desc),o=O8(t),s=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,r<=s&&(s=r)):s=r=n+5,n+4<=s&&e!==-1?bD(t,e,n,i):t.strategy===S8||r===s?(Xi(t,(rD<<1)+(i?1:0),3),WL(t,oo,gf)):(Xi(t,(x8<<1)+(i?1:0),3),N8(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),WL(t,t.dyn_ltree,t.dyn_dtree)),vD(t),i&&yD(t)},"_tr_flush_block$1"),H8=a((t,e,n)=>(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=n,e===0?t.dyn_ltree[n*2]++:(t.matches++,e--,t.dyn_ltree[(Ff[n]+xp+1)*2]++,t.dyn_dtree[pD(e)*2]++),t.sym_next===t.sym_end),"_tr_tally$1");var G8=U8,V8=bD,W8=$8,z8=H8,K8=B8,q8={_tr_init:G8,_tr_stored_block:V8,_tr_flush_block:W8,_tr_tally:z8,_tr_align:K8};const j8=a((t,e,n,i)=>{let s=t&65535|0,r=t>>>16&65535|0,o=0;for(;n!==0;){o=n>2e3?2e3:n,n-=o;do s=s+e[i++]|0,r=r+s|0;while(--o);s%=65521,r%=65521}return s|r<<16|0},"adler32");var Bf=j8;const Y8=a(()=>{let t,e=[];for(var n=0;n<256;n++){t=n;for(var i=0;i<8;i++)t=t&1?3988292384^t>>>1:t>>>1;e[n]=t}return e},"makeTable"),Z8=new Uint32Array(Y8()),Q8=a((t,e,n,i)=>{const s=Z8,r=i+n;t^=-1;for(let o=i;o<r;o++)t=t>>>8^s[(t^e[o])&255];return t^-1},"crc32");var ni=Q8,Fl={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Jl={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:J8,_tr_stored_block:GE,_tr_flush_block:X8,_tr_tally:xa,_tr_align:e6}=q8,{Z_NO_FLUSH:Ia,Z_PARTIAL_FLUSH:t6,Z_FULL_FLUSH:n6,Z_FINISH:xs,Z_BLOCK:jL,Z_OK:ui,Z_STREAM_END:YL,Z_STREAM_ERROR:kr,Z_DATA_ERROR:i6,Z_BUF_ER
vendor: 35,595 bytes, line 1
1ROR:Qy,Z_DEFAULT_COMPRESSION:s6,Z_FILTERED:r6,Z_HUFFMAN_ONLY:Zp,Z_RLE:o6,Z_FIXED:a6,Z_DEFAULT_STRATEGY:l6,Z_UNKNOWN:c6,Z_DEFLATED:qv}=Jl,d6=9,u6=15,f6=8,h6=29,p6=256,VE=p6+1+h6,g6=30,m6=19,v6=2*VE+1,y6=15,xt=3,wa=258,Mr=wa+xt+1,b6=32,kd=42,AT=57,WE=69,zE=73,KE=91,qE=103,fl=113,Ku=666,Ni=1,nu=2,Ul=3,iu=4,E6=3,hl=a((t,e)=>(t.msg=Fl[e],e),"err"),ZL=a(t=>t*2-(t>4?9:0),"rank"),na=a(t=>{let e=t.length;for(;--e>=0;)t[e]=0},"zero"),_6=a(t=>{let e,n,i,s=t.w_size;e=t.hash_size,i=e;do n=t.head[--i],t.head[i]=n>=s?n-s:0;while(--e);e=s,i=e;do n=t.prev[--i],t.prev[i]=n>=s?n-s:0;while(--e)},"slide_hash");let w6=a((t,e,n)=>(e<<t.hash_shift^n)&t.hash_mask,"HASH_ZLIB"),La=w6;const ls=a(t=>{const e=t.state;let n=e.pending;n>t.avail_out&&(n=t.avail_out),n!==0&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+n),t.next_out),t.next_out+=n,e.pending_out+=n,t.total_out+=n,t.avail_out-=n,e.pending-=n,e.pending===0&&(e.pending_out=0))},"flush_pending"),fs=a((t,e)=>{X8(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,ls(t.strm)},"flush_block_only"),Ht=a((t,e)=>{t.pending_buf[t.pending++]=e},"put_byte"),Iu=a((t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=e&255},"putShortMSB"),jE=a((t,e,n,i)=>{let s=t.avail_in;return s>i&&(s=i),s===0?0:(t.avail_in-=s,e.set(t.input.subarray(t.next_in,t.next_in+s),n),t.state.wrap===1?t.adler=Bf(t.adler,e,s,n):t.state.wrap===2&&(t.adler=ni(t.adler,e,s,n)),t.next_in+=s,t.total_in+=s,s)},"read_buf"),ED=a((t,e)=>{let n=t.max_chain_length,i=t.strstart,s,r,o=t.prev_length,l=t.nice_match;const d=t.strstart>t.w_size-Mr?t.strstart-(t.w_size-Mr):0,c=t.window,u=t.w_mask,f=t.prev,h=t.strstart+wa;let p=c[i+o-1],g=c[i+o];t.prev_length>=t.good_match&&(n>>=2),l>t.lookahead&&(l=t.lookahead);do if(s=e,!(c[s+o]!==g||c[s+o-1]!==p||c[s]!==c[i]||c[++s]!==c[i+1])){i+=2,s++;do;while(c[++i]===c[++s]&&c[++i]===c[++s]&&c[++i]===c[++s]&&c[++i]===c[++s]&&c[++i]===c[++s]&&c[++i]===c[++s]&&c[++i]===c[++s]&&c[++i]===c[++s]&&i<h);if(r=wa-(h-i),i=h-wa,r>o){if(t.match_start=e,o=r,r>=l)break;p=c[i+o-1],g=c[i+o]}}while((e=f[e&u])>d&&--n!==0);return o<=t.lookahead?o:t.lookahead},"longest_match"),Md=a(t=>{const e=t.w_size;let n,i,s;do{if(i=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-Mr)&&(t.window.set(t.window.subarray(e,e+e-i),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),_6(t),i+=e),t.strm.avail_in===0)break;if(n=jE(t.strm,t.window,t.strstart+t.lookahead,i),t.lookahead+=n,t.lookahead+t.insert>=xt)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=La(t,t.ins_h,t.window[s+1]);t.insert&&(t.ins_h=La(t,t.ins_h,t.window[s+xt-1]),t.prev[s&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=s,s++,t.insert--,!(t.lookahead+t.insert<xt)););}while(t.lookahead<Mr&&t.strm.avail_in!==0)},"fill_window"),_D=a((t,e)=>{let n=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,i,s,r,o=0,l=t.strm.avail_in;do{if(i=65535,r=t.bi_valid+42>>3,t.strm.avail_out<r||(r=t.strm.avail_out-r,s=t.strstart-t.block_start,i>s+t.strm.avail_in&&(i=s+t.strm.avail_in),i>r&&(i=r),i<n&&(i===0&&e!==xs||e===Ia||i!==s+t.strm.avail_in)))break;o=e===xs&&i===s+t.strm.avail_in?1:0,GE(t,0,0,o),t.pending_buf[t.pending-4]=i,t.pending_buf[t.pending-3]=i>>8,t.pending_buf[t.pending-2]=~i,t.pending_buf[t.pending-1]=~i>>8,ls(t.strm),s&&(s>i&&(s=i),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+s),t.strm.next_out),t.strm.next_out+=s,t.strm.avail_out-=s,t.strm.total_out+=s,t.block_start+=s,i-=s),i&&(jE(t.strm,t.strm.output,t.strm.next_out,i),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i)}while(o===0);return l-=t.strm.avail_in,l&&(l>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=l&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-l,t.strm.next_in),t.strstart),t.strstart+=l,t.insert+=l>t.w_size-t.insert?t.w_size-t.insert:l),t.block_start=t.strstart),t.high_water<t.strstart&&(t.high_water=t.strstart),o?iu:e!==Ia&&e!==xs&&t.strm.avail_in===0&&t.strstart===t.block_start?nu:(r=t.window_size-t.strstart,t.strm.avail_in>r&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,r+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),r>t.strm.avail_in&&(r=t.strm.avail_in),r&&(jE(t.strm,t.window,t.strstart,r),t.strstart+=r,t.insert+=r>t.w_size-t.insert?t.w_size-t.insert:r),t.high_water<t.strstart&&(t.high_water=t.strstart),r=t.bi_valid+42>>3,r=t.pending_buf_size-r>65535?65535:t.pending_buf_size-r,n=r>t.w_size?t.w_size:r,s=t.strstart-t.block_start,(s>=n||(s||e===xs)&&e!==Ia&&t.strm.avail_in===0&&s<=r)&&(i=s>r?r:s,o=e===xs&&t.strm.avail_in===0&&i===s?1:0,GE(t,t.block_start,i,o),t.block_start+=i,ls(t.strm)),o?Ul:Ni)},"deflate_stored"),Jy=a((t,e)=>{let n,i;for(;;){if(t.lookahead<Mr){if(Md(t),t.lookahead<Mr&&e===Ia)return Ni;if(t.lookahead===0)break}if(n=0,t.lookahead>=xt&&(t.ins_h=La(t,t.ins_h,t.window[t.strstart+xt-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),n!==0&&t.strstart-n<=t.w_size-Mr&&(t.match_length=ED(t,n)),t.match_length>=xt)if(i=xa(t,t.strstart-t.match_start,t.match_length-xt),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=xt){t.match_length--;do t.strstart++,t.ins_h=La(t,t.ins_h,t.window[t.strstart+xt-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart;while(--t.match_length!==0);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=La(t,t.ins_h,t.window[t.strstart+1]);else i=xa(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(i&&(fs(t,!1),t.strm.avail_out===0))return Ni}return t.insert=t.strstart<xt-1?t.strstart:xt-1,e===xs?(fs(t,!0),t.strm.avail_out===0?Ul:iu):t.sym_next&&(fs(t,!1),t.strm.avail_out===0)?Ni:nu},"deflate_fast"),pc=a((t,e)=>{let n,i,s;for(;;){if(t.lookahead<Mr){if(Md(t),t.lookahead<Mr&&e===Ia)return Ni;if(t.lookahead===0)break}if(n=0,t.lookahead>=xt&&(t.ins_h=La(t,t.ins_h,t.window[t.strstart+xt-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=xt-1,n!==0&&t.prev_length<t.max_lazy_match&&t.strstart-n<=t.w_size-Mr&&(t.match_length=ED(t,n),t.match_length<=5&&(t.strategy===r6||t.match_length===xt&&t.strstart-t.match_start>4096)&&(t.match_length=xt-1)),t.prev_length>=xt&&t.match_length<=t.prev_length){s=t.strstart+t.lookahead-xt,i=xa(t,t.strstart-1-t.prev_match,t.prev_length-xt),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=s&&(t.ins_h=La(t,t.ins_h,t.window[t.strstart+xt-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart);while(--t.prev_length!==0);if(t.match_available=0,t.match_length=xt-1,t.strstart++,i&&(fs(t,!1),t.strm.avail_out===0))return Ni}else if(t.match_available){if(i=xa(t,0,t.window[t.strstart-1]),i&&fs(t,!1),t.strstart++,t.lookahead--,t.strm.avail_out===0)return Ni}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(i=xa(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<xt-1?t.strstart:xt-1,e===xs?(fs(t,!0),t.strm.avail_out===0?Ul:iu):t.sym_next&&(fs(t,!1),t.strm.avail_out===0)?Ni:nu},"deflate_slow"),S6=a((t,e)=>{let n,i,s,r;const o=t.window;for(;;){if(t.lookahead<=wa){if(Md(t),t.lookahead<=wa&&e===Ia)return Ni;if(t.lookahead===0)break}if(t.match_length=0,t.lookahead>=xt&&t.strstart>0&&(s=t.strstart-1,i=o[s],i===o[++s]&&i===o[++s]&&i===o[++s])){r=t.strstart+wa;do;while(i===o[++s]&&i===o[++s]&&i===o[++s]&&i===o[++s]&&i===o[++s]&&i===o[++s]&&i===o[++s]&&i===o[++s]&&s<r);t.match_length=wa-(r-s),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=xt?(n=xa(t,1,t.match_length-xt),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=xa(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(fs(t,!1),t.strm.avail_out===0))return Ni}return t.insert=0,e===xs?(fs(t,!0),t.strm.avail_out===0?Ul:iu):t.sym_next&&(fs(t,!1),t.strm.avail_out===0)?Ni:nu},"deflate_rle"),T6=a((t,e)=>{let n;for(;;){if(t.lookahead===0&&(Md(t),t.lookahead===0)){if(e===Ia)return Ni;break}if(t.match_length=0,n=xa(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(fs(t,!1),t.strm.avail_out===0))return Ni}return t.insert=0,e===xs?(fs(t,!0),t.strm.avail_out===0?Ul:iu):t.sym_next&&(fs(t,!1),t.strm.avail_out===0)?Ni:nu},"deflate_huff");function er(t,e,n,i,s){this.good_length=t,this.max_lazy=e,this.nice_length=n,this.max_chain=i,this.func=s}a(er,"Config");const qu=[new er(0,0,0,0,_D),new er(4,4,8,4,Jy),new er(4,5,16,8,Jy),new er(4,6,32,32,Jy),new er(4,4,16,16,pc),new er(8,16,32,32,pc),new er(8,16,128,128,pc),new er(8,32,128,256,pc),new er(32,128,258,1024,pc),new er(32,258,258,4096,pc)],A6=a(t=>{t.window_size=2*t.w_size,na(t.head),t.max_lazy_match=qu[t.level].max_lazy,t.good_match=qu[t.level].good_length,t.nice_match=qu[t.level].nice_length,t.max_chain_length=qu[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=xt-1,t.match_available=0,t.ins_h=0},"lm_init");function x6(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=qv,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(v6*2),this.dyn_dtree=new Uint16Array((2*g6+1)*2),this.bl_tree=new Uint16Array((2*m6+1)*2),na(this.dyn_ltree),na(this.dyn_dtree),na(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(y6+1),this.heap=new Uint16Array(2*VE+1),na(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*VE+1),na(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}a(x6,"DeflateState");const Ip=a(t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==kd&&e.status!==AT&&e.status!==WE&&e.status!==zE&&e.status!==KE&&e.status!==qE&&e.status!==fl&&e.status!==Ku?1:0},"deflateStateCheck"),wD=a(t=>{if(Ip(t))return hl(t,kr);t.total_in=t.total_out=0,t.data_type=c6;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?AT:e.wrap?kd:fl,t.adler=e.wrap===2?0:1,e.last_flush=-2,J8(e),ui},"deflateResetKeep"),SD=a(t=>{const e=wD(t);return e===ui&&A6(t.state),e},"deflateReset"),I6=a((t,e)=>Ip(t)||t.state.wrap!==2?kr:(t.state.gzhead=e,ui),"deflateSetHeader"),TD=a((t,e,n,i,s,r)=>{if(!t)return kr;let o=1;if(e===s6&&(e=6),i<0?(o=0,i=-i):i>15&&(o=2,i-=16),s<1||s>d6||n!==qv||i<8||i>15||e<0||e>9||r<0||r>a6||i===8&&o!==1)return hl(t,kr);i===8&&(i=9);const l=new x6;return t.state=l,l.strm=t,l.status=kd,l.wrap=o,l.gzhead=null,l.w_bits=i,l.w_size=1<<l.w_bits,l.w_mask=l.w_size-1,l.hash_bits=s+7,l.hash_size=1<<l.hash_bits,l.hash_mask=l.hash_size-1,l.hash_shift=~~((l.hash_bits+xt-1)/xt),l.window=new Uint8Array(l.w_size*2),l.head=new Uint16Array(l.hash_size),l.prev=new Uint16Array(l.w_size),l.lit_bufsize=1<<s+6,l.pending_buf_size=l.lit_bufsize*4,l.pending_buf=new Uint8Array(l.pending_buf_size),l.sym_buf=l.lit_bufsize,l.sym_end=(l.lit_bufsize-1)*3,l.level=e,l.strategy=r,l.method=n,SD(t)},"deflateInit2"),L6=a((t,e)=>TD(t,e,qv,u6,f6,l6),"deflateInit"),R6=a((t,e)=>{if(Ip(t)||e>jL||e<0)return t?hl(t,kr):kr;const n=t.state;if(!t.output||t.avail_in!==0&&!t.input||n.status===Ku&&e!==xs)return hl(t,t.avail_out===0?Qy:kr);const i=n.last_flush;if(n.last_flush=e,n.pending!==0){if(ls(t),t.avail_out===0)return n.last_flush=-1,ui}else if(t.avail_in===0&&ZL(e)<=ZL(i)&&e!==xs)return hl(t,Qy);if(n.status===Ku&&t.avail_in!==0)return hl(t,Qy);if(n.status===kd&&n.wrap===0&&(n.status=fl),n.status===kd){let s=qv+(n.w_bits-8<<4)<<8,r=-1;if(n.strategy>=Zp||n.level<2?r=0:n.level<6?r=1:n.level===6?r=2:r=3,s|=r<<6,n.strstart!==0&&(s|=b6),s+=31-s%31,Iu(n,s),n.strstart!==0&&(Iu(n,t.adler>>>16),Iu(n,t.adler&65535)),t.adler=1,n.status=fl,ls(t),n.pending!==0)return n.last_flush=-1,ui}if(n.status===AT){if(t.adler=0,Ht(n,31),Ht(n,139),Ht(n,8),n.gzhead)Ht(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),Ht(n,n.gzhead.time&255),Ht(n,n.gzhead.time>>8&255),Ht(n,n.gzhead.time>>16&255),Ht(n,n.gzhead.time>>24&255),Ht(n,n.level===9?2:n.strategy>=Zp||n.level<2?4:0),Ht(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(Ht(n,n.gzhead.extra.length&255),Ht(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(t.adler=ni(t.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=WE;else if(Ht(n,0),Ht(n,0),Ht(n,0),Ht(n,0),Ht(n,0),Ht(n,n.level===9?2:n.strategy>=Zp||n.level<2?4:0),Ht(n,E6),n.status=fl,ls(t),n.pending!==0)return n.last_flush=-1,ui}if(n.status===WE){if(n.gzhead.extra){let s=n.pending,r=(n.gzhead.extra.length&65535)-n.gzindex;for(;n.pending+r>n.pending_buf_size;){let l=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+l),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>s&&(t.adler=ni(t.adler,n.pending_buf,n.pending-s,s)),n.gzindex+=l,ls(t),n.pending!==0)return n.last_flush=-1,ui;s=0,r-=l}let o=new Uint8Array(n.gzhead.extra);n.pending_buf.set(o.subarray(n.gzindex,n.gzindex+r),n.pending),n.pending+=r,n.gzhead.hcrc&&n.pending>s&&(t.adler=ni(t.adler,n.pending_buf,n.pending-s,s)),n.gzindex=0}n.status=zE}if(n.status===zE){if(n.gzhead.name){let s=n.pending,r;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>s&&(t.adler=ni(t.adler,n.pending_buf,n.pending-s,s)),ls(t),n.pending!==0)return n.last_flush=-1,ui;s=0}n.gzindex<n.gzhead.name.length?r=n.gzhead.name.charCodeAt(n.gzindex++)&255:r=0,Ht(n,r)}while(r!==0);n.gzhead.hcrc&&n.pending>s&&(t.adler=ni(t.adler,n.pending_buf,n.pending-s,s)),n.gzindex=0}n.status=KE}if(n.status===KE){if(n.gzhead.comment){let s=n.pending,r;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>s&&(t.adler=ni(t.adler,n.pending_buf,n.pending-s,s)),ls(t),n.pending!==0)return n.last_flush=-1,ui;s=0}n.gzindex<n.gzhead.comment.length?r=n.gzhead.comment.charCodeAt(n.gzindex++)&255:r=0,Ht(n,r)}while(r!==0);n.gzhead.hcrc&&n.pending>s&&(t.adler=ni(t.adler,n.pending_buf,n.pending-s,s))}n.status=qE}if(n.status===qE){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(ls(t),n.pending!==0))return n.last_flush=-1,ui;Ht(n,t.adler&255),Ht(n,t.adler>>8&255),t.adler=0}if(n.status=fl,ls(t),n.pending!==0)return n.last_flush=-1,ui}if(t.avail_in!==0||n.lookahead!==0||e!==Ia&&n.status!==Ku){let s=n.level===0?_D(n,e):n.strategy===Zp?T6(n,e):n.strategy===o6?S6(n,e):qu[n.level].func(n,e);if((s===Ul||s===iu)&&(n.status=Ku),s===Ni||s===Ul)return t.avail_out===0&&(n.last_flush=-1),ui;if(s===nu&&(e===t6?e6(n):e!==jL&&(GE(n,0,0,!1),e===n6&&(na(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),ls(t),t.avail_out===0))return n.last_flush=-1,ui}return e!==xs?ui:n.wrap<=0?YL:(n.wrap===2?(Ht(n,t.adler&255),Ht(n,t.adler>>8&255),Ht(n,t.adler>>16&255),Ht(n,t.adler>>24&255),Ht(n,t.total_in&255),Ht(n,t.total_in>>8&255),Ht(n,t.total_in>>16&255),Ht(n,t.total_in>>24&255)):(Iu(n,t.adler>>>16),Iu(n,t.adler&65535)),ls(t),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?ui:YL)},"deflate$2"),k6=a(t=>{if(Ip(t))return kr;const e=t.state.status;return t.state=null,e===fl?hl(t,i6):ui},"deflateEnd"),M6=a((t,e)=>{let n=e.length;if(Ip(t))return kr;const i=t.state,s=i.wrap;if(s===2||s===1&&i.status!==kd||i.lookahead)return kr;if(s===1&&(t.adler=Bf(t.adler,e,n,0)),i.wrap=0,n>=i.w_size){s===0&&(na(i.head),i.strstart=0,i.block_start=0,i.insert=0);let d=new Uint8Array(i.w_size);d.set(e.subarray(n-i.w_size,n),0),e=d,n=i.w_size}const r=t.avail_in,o=t.next_in,l=t.input;for(t.avail_in=n,t.next_in=0,t.input=e,Md(i);i.lookahead>=xt;){let d=i.strstart,c=i.lookahead-(xt-1);do i.ins_h=La(i,i.ins_h,i.window[d+xt-1]),i.prev[d&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=d,d++;while(--c);i.strstart=d,i.lookahead=xt-1,Md(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=xt-1,i.match_available=0,t.next_in=o,t.input=l,t.avail_in=r,i.wrap=s,ui},"deflateSetDictionary");var C6=L6,P6=TD,D6=SD,O6=wD,N6=I6,F6=R6,U6=k6,B6=M6,$6="pako deflate (from Nodeca project)",mf={deflateInit:C6,deflateInit2:P6,deflateReset:D6,deflateResetKeep:O6,deflateSetHeader:N6,deflate:F6,deflateEnd:U6,deflateSetDictionary:B6,deflateInfo:$6};const H6=a((t,e)=>Object.prototype.hasOwnProperty.call(t,e),"_has");var G6=a(function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const n=e.shift();if(n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(const i in n)H6(n,i)&&(t[i]=n[i])}}return t},"assign"),V6=a(t=>{let e=0;for(let i=0,s=t.length;i<s;i++)e+=t[i].length;const n=new Uint8Array(e);for(let i=0,s=0,r=t.length;i<r;i++){let o=t[i];n.set(o,s),s+=o.length}return n},"flattenChunks"),jv={assign:G6,flattenChunks:V6};let AD=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{AD=!1}const $f=new Uint8Array(256);for(let t=0;t<256;t++)$f[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;$f[254]=$f[254]=1;var W6=a(t=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(t);let e,n,i,s,r,o=t.length,l=0;for(s=0;s<o;s++)n=t.charCodeAt(s),(n&64512)===55296&&s+1<o&&(i=t.charCodeAt(s+1),(i&64512)===56320&&(n=65536+(n-55296<<10)+(i-56320),s++)),l+=n<128?1:n<2048?2:n<65536?3:4;for(e=new Uint8Array(l),r=0,s=0;r<l;s++)n=t.charCodeAt(s),(n&64512)===55296&&s+1<o&&(i=t.charCodeAt(s+1),(i&64512)===56320&&(n=65536+(n-55296<<10)+(i-56320),s++)),n<128?e[r++]=n:n<2048?(e[r++]=192|n>>>6,e[r++]=128|n&63):n<65536?(e[r++]=224|n>>>12,e[r++]=128|n>>>6&63,e[r++]=128|n&63):(e[r++]=240|n>>>18,e[r++]=128|n>>>12&63,e[r++]=128|n>>>6&63,e[r++]=128|n&63);return e},"string2buf");const z6=a((t,e)=>{if(e<65534&&t.subarray&&AD)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let n="";for(let i=0;i<e;i++)n+=String.fromCharCode(t[i]);return n},"buf2binstring");var K6=a((t,e)=>{const n=e||t.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(t.subarray(0,e));let i,s;const r=new Array(n*2);for(s=0,i=0;i<n;){let o=t[i++];if(o<128){r[s++]=o;continue}let l=$f[o];if(l>4){r[s++]=65533,i+=l-1;continue}for(o&=l===2?31:l===3?15:7;l>1&&i<n;)o=o<<6|t[i++]&63,l--;if(l>1){r[s++]=65533;continue}o<65536?r[s++]=o:(o-=65536,r[s++]=55296|o>>10&1023,r[s++]=56320|o&1023)}return z6(r,s)},"buf2string"),q6=a((t,e)=>{e=e||t.length,e>t.length&&(e=t.length);let n=e-1;for(;n>=0&&(t[n]&192)===128;)n--;return n<0||n===0?e:n+$f[t[n]]>e?n:e},"utf8border"),Hf={string2buf:W6,buf2string:K6,utf8border:q6};function j6(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}a(j6,"ZStream");var xD=j6;const ID=Object.prototype.toString,{Z_NO_FLUSH:Y6,Z_SYNC_FLUSH:Z6,Z_FULL_FLUSH:Q6,Z_FINISH:J6,Z_OK:Xm,Z_STREAM_END:X6,Z_DEFAULT_COMPRESSION:eH,Z_DEFAULT_STRATEGY:tH,Z_DEFLATED:nH}=Jl;function Lp(t){this.options=jv.assign({level:eH,method:nH,chunkSize:16384,windowBits:15,memLevel:8,strategy:tH},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new xD,this.strm.avail_out=0;let n=mf.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(n!==Xm)throw new Error(Fl[n]);if(e.header&&mf.deflateSetHeader(this.strm,e.header),e.dictionary){let i;if(typeof e.dictionary=="string"?i=Hf.string2buf(e.dictionary):ID.call(e.dictionary)==="[object ArrayBuffer]"?i=new Uint8Array(e.dictionary):i=e.dictionary,n=mf.deflateSetDictionary(this.strm,i),n!==Xm)throw new Error(Fl[n]);this._dict_set=!0}}a(Lp,"Deflate$1");Lp.prototype.push=function(t,e){const n=this.strm,i=this.options.chunkSize;let s,r;if(this.ended)return!1;for(e===~~e?r=e:r=e===!0?J6:Y6,typeof t=="string"?n.input=Hf.string2buf(t):ID.call(t)==="[object ArrayBuffer]"?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;;){if(n.avail_out===0&&(n.output=new Uint8Array(i),n.next_out=0,n.avail_out=i),(r===Z6||r===Q6)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(s=mf.deflate(n,r),s===X6)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),s=mf.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===Xm;if(n.avail_out===0){this.onData(n.output);continue}if(r>0&&n.next_out>0){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(n.avail_in===0)break}return!0};Lp.prototype.onData=function(t){this.chunks.push(t)};Lp.prototype.onEnd=function(t){t===Xm&&(this.result=jv.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function xT(t,e){const n=new Lp(e);if(n.push(t,!0),n.err)throw n.msg||Fl[n.err];return n.result}a(xT,"deflate$1");function iH(t,e){return e=e||{},e.raw=!0,xT(t,e)}a(iH,"deflateRaw$1");function sH(t,e){return e=e||{},e.gzip=!0,xT(t,e)}a(sH,"gzip$1");var rH=Lp,oH=xT,aH=iH,lH=sH,cH=Jl,dH={Deflate:rH,deflate:oH,deflateRaw:aH,gzip:lH,constants:cH};const Qp=16209,uH=16191;var fH=a(function(e,n){let i,s,r,o,l,d,c,u,f,h,p,g,v,y,b,E,T,I,M,H,N,$,F,D;const L=e.state;i=e.next_in,F=e.input,s=i+(e.avail_in-5),r=e.next_out,D=e.output,o=r-(n-e.avail_out),l=r+(e.avail_out-257),d=L.dmax,c=L.wsize,u=L.whave,f=L.wnext,h=L.window,p=L.hold,g=L.bits,v=L.lencode,y=L.distcode,b=(1<<L.lenbits)-1,E=(1<<L.distbits)-1;e:do{g<15&&(p+=F[i++]<<g,g+=8,p+=F[i++]<<g,g+=8),T=v[p&b];t:for(;;){if(I=T>>>24,p>>>=I,g-=I,I=T>>>16&255,I===0)D[r++]=T&65535;else if(I&16){M=T&65535,I&=15,I&&(g<I&&(p+=F[i++]<<g,g+=8),M+=p&(1<<I)-1,p>>>=I,g-=I),g<15&&(p+=F[i++]<<g,g+=8,p+=F[i++]<<g,g+=8),T=y[p&E];n:for(;;){if(I=T>>>24,p>>>=I,g-=I,I=T>>>16&255,I&16){if(H=T&65535,I&=15,g<I&&(p+=F[i++]<<g,g+=8,g<I&&(p+=F[i++]<<g,g+=8)),H+=p&(1<<I)-1,H>d){e.msg="invalid distance too far back",L.mode=Qp;break e}if(p>>>=I,g-=I,I=r-o,H>I){if(I=H-I,I>u&&L.sane){e.msg="invalid distance too far back",L.mode=Qp;break e}if(N=0,$=h,f===0){if(N+=c-I,I<M){M-=I;do D[r++]=h[N++];while(--I);N=r-H,$=D}}else if(f<I){if(N+=c+f-I,I-=f,I<M){M-=I;do D[r++]=h[N++];while(--I);if(N=0,f<M){I=f,M-=I;do D[r++]=h[N++];while(--I);N=r-H,$=D}}}else if(N+=f-I,I<M){M-=I;do D[r++]=h[N++];while(--I);N=r-H,$=D}for(;M>2;)D[r++]=$[N++],D[r++]=$[N++],D[r++]=$[N++],M-=3;M&&(D[r++]=$[N++],M>1&&(D[r++]=$[N++]))}else{N=r-H;do D[r++]=D[N++],D[r++]=D[N++],D[r++]=D[N++],M-=3;while(M>2);M&&(D[r++]=D[N++],M>1&&(D[r++]=D[N++]))}}else if(I&64){e.msg="invalid distance code",L.mode=Qp;break e}else{T=y[(T&65535)+(p&(1<<I)-1)];continue n}break}}else if(I&64)if(I&32){L.mode=uH;break e}else{e.msg="invalid literal/length code",L.mode=Qp;break e}else{T=v[(T&65535)+(p&(1<<I)-1)];continue t}break}}while(i<s&&r<l);M=g>>3,i-=M,g-=M<<3,p&=(1<<g)-1,e.next_in=i,e.next_out=r,e.avail_in=i<s?5+(s-i):5-(i-s),e.avail_out=r<l?257+(l-r):257-(r-l),L.hold=p,L.bits=g},"inflate_fast");const gc=15,QL=852,JL=592,XL=0,Xy=1,eR=2,hH=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),pH=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),gH=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),mH=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),vH=a((t,e,n,i,s,r,o,l)=>{const d=l.bits;let c=0,u=0,f=0,h=0,p=0,g=0,v=0,y=0,b=0,E=0,T,I,M,H,N,$=null,F;const D=new Uint16Array(gc+1),L=new Uint16Array(gc+1);let m=null,S,_,A;for(c=0;c<=gc;c++)D[c]=0;for(u=0;u<i;u++)D[e[n+u]]++;for(p=d,h=gc;h>=1&&D[h]===0;h--);if(p>h&&(p=h),h===0)return s[r++]=1<<24|64<<16|0,s[r++]=1<<24|64<<16|0,l.bits=1,0;for(f=1;f<h&&D[f]===0;f++);for(p<f&&(p=f),y=1,c=1;c<=gc;c++)if(y<<=1,y-=D[c],y<0)return-1;if(y>0&&(t===XL||h!==1))return-1;for(L[1]=0,c=1;c<gc;c++)L[c+1]=L[c]+D[c];for(u=0;u<i;u++)e[n+u]!==0&&(o[L[e[n+u]]++]=u);if(t===XL?($=m=o,F=20):t===Xy?($=hH,m=pH,F=257):($=gH,m=mH,F=0),E=0,u=0,c=f,N=r,g=p,v=0,M=-1,b=1<<p,H=b-1,t===Xy&&b>QL||t===eR&&b>JL)return 1;for(;;){S=c-v,o[u]+1<F?(_=0,A=o[u]):o[u]>=F?(_=m[o[u]-F],A=$[o[u]-F]):(_=32+64,A=0),T=1<<c-v,I=1<<g,f=I;do I-=T,s[N+(E>>v)+I]=S<<24|_<<16|A|0;while(I!==0);for(T=1<<c-1;E&T;)T>>=1;if(T!==0?(E&=T-1,E+=T):E=0,u++,--D[c]===0){if(c===h)break;c=e[n+o[u]]}if(c>p&&(E&H)!==M){for(v===0&&(v=p),N+=f,g=c-v,y=1<<g;g+v<h&&(y-=D[g+v],!(y<=0));)g++,y<<=1;if(b+=1<<g,t===Xy&&b>QL||t===eR&&b>JL)return 1;M=E&H,s[M]=p<<24|g<<16|N-r|0}}return E!==0&&(s[N+E]=c-v<<24|64<<16|0),l.bits=p,0},"inflate_table");var vf=vH;const yH=0,LD=1,RD=2,{Z_FINISH:tR,Z_BLOCK:bH,Z_TREES:Jp,Z_OK:Bl,Z_STREAM_END:EH,Z_NEED_DICT:_H,Z_STREAM_ERROR:Rs,Z_DATA_ERROR:kD,Z_MEM_ERROR:MD,Z_BUF_ERROR:wH,Z_DEFLATED:nR}=Jl,Yv=16180,iR=16181,sR=16182,rR=16183,oR=16184,aR=16185,lR=16186,cR=16187,dR=16188,uR=16189,e0=16190,Wr=16191,eb=16192,fR=16193,tb=16194,hR=16195,pR=16196,gR=16197,mR=16198,Xp=16199,eg=16200,vR=16201,yR=16202,bR=16203,ER=16204,_R=16205,nb=16206,wR=16207,SR=16208,vn=16209,CD=16210,PD=16211,SH=852,TH=592,AH=15,xH=AH,TR=a(t=>(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24),"zswap32");function IH(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}a(IH,"InflateState");const Xl=a(t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode<Yv||e.mode>PD?1:0},"inflateStateCheck"),DD=a(t=>{if(Xl(t))return Rs;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=e.wrap&1),e.mode=Yv,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(SH),e.distcode=e.distdyn=new Int32Array(TH),e.sane=1,e.back=-1,Bl},"inflateResetKeep"),OD=a(t=>{if(Xl(t))return Rs;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,DD(t)},"inflateReset"),ND=a((t,e)=>{let n;if(Xl(t))return Rs;const i=t.state;return e<0?(n=0,e=-e):(n=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?Rs:(i.window!==null&&i.wbits!==e&&(i.window=null),i.wrap=n,i.wbits=e,OD(t))},"inflateReset2"),FD=a((t,e)=>{if(!t)return Rs;const n=new IH;t.state=n,n.strm=t,n.window=null,n.mode=Yv;const i=ND(t,e);return i!==Bl&&(t.state=null),i},"inflateInit2"),LH=a(t=>FD(t,xH),"inflateInit");let AR=!0,ib,sb;const RH=a(t=>{if(AR){ib=new Int32Array(512),sb=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(vf(LD,t.lens,0,288,ib,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;vf(RD,t.lens,0,32,sb,0,t.work,{bits:5}),AR=!1}t.lencode=ib,t.lenbits=9,t.distcode=sb,t.distbits=5},"fixedtables"),UD=a((t,e,n,i)=>{let s;const r=t.state;return r.window===null&&(r.wsize=1<<r.wbits,r.wnext=0,r.whave=0,r.window=new Uint8Array(r.wsize)),i>=r.wsize?(r.window.set(e.subarray(n-r.wsize,n),0),r.wnext=0,r.whave=r.wsize):(s=r.wsize-r.wnext,s>i&&(s=i),r.window.set(e.subarray(n-i,n-i+s),r.wnext),i-=s,i?(r.window.set(e.subarray(n-i,n),0),r.wnext=i,r.whave=r.wsize):(r.wnext+=s,r.wnext===r.wsize&&(r.wnext=0),r.whave<r.wsize&&(r.whave+=s))),0},"updatewindow"),kH=a((t,e)=>{let n,i,s,r,o,l,d,c,u,f,h,p,g,v,y=0,b,E,T,I,M,H,N,$;const F=new Uint8Array(4);let D,L;const m=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Xl(t)||!t.output||!t.input&&t.avail_in!==0)return Rs;n=t.state,n.mode===Wr&&(n.mode=eb),o=t.next_out,s=t.output,d=t.avail_out,r=t.next_in,i=t.input,l=t.avail_in,c=n.hold,u=n.bits,f=l,h=d,$=Bl;e:for(;;)switch(n.mode){case Yv:if(n.wrap===0){n.mode=eb;break}for(;u<16;){if(l===0)break e;l--,c+=i[r++]<<u,u+=8}if(n.wrap&2&&c===35615){n.wbits===0&&(n.wbits=15),n.check=0,F[0]=c&255,F[1]=c>>>8&255,n.check=ni(n.check,F,2,0),c=0,u=0,n.mode=iR;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((c&255)<<8)+(c>>8))%31){t.msg="incorrect header check",n.mode=vn;break}if((c&15)!==nR){t.msg="unknown compression method",n.mode=vn;break}if(c>>>=4,u-=4,N=(c&15)+8,n.wbits===0&&(n.wbits=N),N>15||N>n.wbits){t.msg="invalid window size",n.mode=vn;break}n.dmax=1<<n.wbits,n.flags=0,t.adler=n.check=1,n.mode=c&512?uR:Wr,c=0,u=0;break;case iR:for(;u<16;){if(l===0)break e;l--,c+=i[r++]<<u,u+=8}if(n.flags=c,(n.flags&255)!==nR){t.msg="unknown compression method",n.mode=vn;break}if(n.flags&57344){t.msg="unknown header flags set",n.mode=vn;break}n.head&&(n.head.text=c>>8&1),n.flags&512&&n.wrap&4&&(F[0]=c&255,F[1]=c>>>8&255,n.check=ni(n.check,F,2,0)),c=0,u=0,n.mode=sR;case sR:for(;u<32;){if(l===0)break e;l--,c+=i[r++]<<u,u+=8}n.head&&(n.head.time=c),n.flags&512&&n.wrap&4&&(F[0]=c&255,F[1]=c>>>8&255,F[2]=c>>>16&255,F[3]=c>>>24&255,n.check=ni(n.check,F,4,0)),c=0,u=0,n.mode=rR;case rR:for(;u<16;){if(l===0)break e;l--,c+=i[r++]<<u,u+=8}n.head&&(n.head.xflags=c&255,n.head.os=c>>8),n.flags&512&&n.wrap&4&&(F[0]=c&255,F[1]=c>>>8&255,n.check=ni(n.check,F,2,0)),c=0,u=0,n.mode=oR;case oR:if(n.flags&1024){for(;u<16;){if(l===0)break e;l--,c+=i[r++]<<u,u+=8}n.length=c,n.head&&(n.head.extra_len=c),n.flags&512&&n.wrap&4&&(F[0]=c&255,F[1]=c>>>8&255,n.check=ni(n.check,F,2,0)),c=0,u=0}else n.head&&(n.head.extra=null);n.mode=aR;case aR:if(n.flags&1024&&(p=n.length,p>l&&(p=l),p&&(n.head&&(N=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(i.subarray(r,r+p),N)),n.flags&512&&n.wrap&4&&(n.check=ni(n.check,i,p,r)),l-=p,r+=p,n.length-=p),n.length))break e;n.length=0,n.mode=lR;case lR:if(n.flags&2048){if(l===0)break e;p=0;do N=i[r+p++],n.head&&N&&n.length<65536&&(n.head.name+=String.fromCharCode(N));while(N&&p<l);if(n.flags&512&&n.wrap&4&&(n.check=ni(n.check,i,p,r)),l-=p,r+=p,N)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=cR;case cR:if(n.flags&4096){if(l===0)break e;p=0;do N=i[r+p++],n.head&&N&&n.length<65536&&(n.head.comment+=String.fromCharCode(N));while(N&&p<l);if(n.flags&512&&n.wrap&4&&(n.check=ni(n.check,i,p,r)),l-=p,r+=p,N)break e}else n.head&&(n.head.comment=null);n.mode=dR;case dR:if(n.flags&512){for(;u<16;){if(l===0)break e;l--,c+=i[r++]<<u,u+=8}if(n.wrap&4&&c!==(n.check&65535)){t.msg="header crc mismatch",n.mode=vn;break}c=0,u=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=Wr;break;case uR:for(;u<32;){if(l===0)break e;l--,c+=i[r++]<<u,u+=8}t.adler=n.check=TR(c),c=0,u=0,n.mode=e0;case e0:if(n.havedict===0)return t.next_out=o,t.avail_out=d,t.next_in=r,t.avail_in=l,n.hold=c,n.bits=u,_H;t.adler=n.check=1,n.mode=Wr;case Wr:if(e===bH||e===Jp)break e;case eb:if(n.last){c>>>=u&7,u-=u&7,n.mode=nb;break}for(;u<3;){if(l===0)break e;l--,c+=i[r++]<<u,u+=8}switch(n.last=c&1,c>>>=1,u-=1,c&3){case 0:n.mode=fR;break;case 1:if(RH(n),n.mode=Xp,e===Jp){c>>>=2,u-=2;break e}break;case 2:n.mode=pR;break;case 3:t.msg="invalid block type",n.mode=vn}c>>>=2,u-=2;break;case fR:for(c>>>=u&7,u-=u&7;u<32;){if(l===0)break e;l--,c+=i[r++]<<u,u+=8}if((c&65535)!==(c>>>16^65535)){t.msg="invalid stored block lengths",n.mode=vn;break}if(n.length=c&65535,c=0,u=0,n.mode=tb,e===Jp)break e;case tb:n.mode=hR;case hR:if(p=n.length,p){if(p>l&&(p=l),p>d&&(p=d),p===0)break e;s.set(i.subarray(r,r+p),o),l-=p,r+=p,d-=p,o+=p,n.length-=p;break}n.mode=Wr;break;case pR:for(;u<14;){if(l===0)break e;l--,c+=i[r++]<<u,u+=8}if(n.nlen=(c&31)+257,c>>>=5,u-=5,n.ndist=(c&31)+1,c>>>=5,u-=5,n.ncode=(c&15)+4,c>>>=4,u-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=vn;break}n.have=0,n.mode=gR;case gR:for(;n.have<n.ncode;){for(;u<3;){if(l===0)break e;l--,c+=i[r++]<<u,u+=8}n.lens[m[n.have++]]=c&7,c>>>=3,u-=3}for(;n.have<19;)n.lens[m[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,D={bits:n.lenbits},$=vf(yH,n.lens,0,19,n.lencode,0,n.work,D),n.lenbits=D.bits,$){t.msg="invalid code lengths set",n.mode=vn;break}n.have=0,n.mode=mR;case mR:for(;n.have<n.nlen+n.ndist;){for(;y=n.lencode[c&(1<<n.lenbits)-1],b=y>>>24,E=y>>>16&255,T=y&65535,!(b<=u);){if(l===0)break e;l--,c+=i[r++]<<u,u+=8}if(T<16)c>>>=b,u-=b,n.lens[n.have++]=T;else{if(T===16){for(L=b+2;u<L;){if(l===0)break e;l--,c+=i[r++]<<u,u+=8}if(c>>>=b,u-=b,n.have===0){t.msg="invalid bit length repeat",n.mode=vn;break}N=n.lens[n.have-1],p=3+(c&3),c>>>=2,u-=2}else if(T===17){for(L=b+3;u<L;){if(l===0)break e;l--,c+=i[r++]<<u,u+=8}c>>>=b,u-=b,N=0,p=3+(c&7),c>>>=3,u-=3}else{for(L=b+7;u<L;){if(l===0)break e;l--,c+=i[r++]<<u,u+=8}c>>>=b,u-=b,N=0,p=11+(c&127),c>>>=7,u-=7}if(n.have+p>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=vn;break}for(;p--;)n.lens[n.have++]=N}}if(n.mode===vn)break;if(n.lens[256]===0){t.msg="invalid code -- missing end-of-block",n.mode=vn;break}if(n.lenbits=9,D={bits:n.lenbits},$=vf(LD,n.lens,0,n.nlen,n.lencode,0,n.work,D),n.lenbits=D.bits,$){t.msg="invalid literal/lengths set",n.mode=vn;break}if(n.distbits=6,n.distcode=n.distdyn,D={bits:n.distbits},$=vf(RD,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,D),n.distbits=D.bits,$){t.msg="invalid distances set",n.mode=vn;break}if(n.mode=Xp,e===Jp)break e;case Xp:n.mode=eg;case eg:if(l>=6&&d>=258){t.next_out=o,t.avail_out=d,t.next_in=r,t.avail_in=l,n.hold=c,n.bits=u,fH(t,h),o=t.next_out,s=t.output,d=t.avail_out,r=t.next_in,i=t.input,l=t.avail_in,c=n.hold,u=n.bits,n.mode===Wr&&(n.back=-1);break}for(n.back=0;y=n.lencode[c&(1<<n.lenbits)-1],b=y>>>24,E=y>>>16&255,T=y&65535,!(b<=u);){if(l===0)break e;l--,c+=i[r++]<<u,u+=8}if(E&&!(E&240)){for(I=b,M=E,H=T;y=n.lencode[H+((c&(1<<I+M)-1)>>I)],b=y>>>24,E=y>>>16&255,T=y&65535,!(I+b<=u);){if(l===0)break e;l--,c+=i[r++]<<u,u+=8}c>>>=I,u-=I,n.back+=I}if(c>>>=b,u-=b,n.back+=b,n.length=T,E===0){n.mode=_R;break}if(E&32){n.back=-1,n.mode=Wr;break}if(E&64){t.msg="invalid literal/length code",n.mode=vn;break}n.extra=E&15,n.mode=vR;case vR:if(n.extra){for(L=n.extra;u<L;){if(l===0)break e;l--,c+=i[r++]<<u,u+=8}n.length+=c&(1<<n.extra)-1,c>>>=n.extra,u-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=yR;case yR:for(;y=n.distcode[c&(1<<n.distbits)-1],b=y>>>24,E=y>>>16&255,T=y&65535,!(b<=u);){if(l===0)break e;l--,c+=i[r++]<<u,u+=8}if(!(E&240)){for(I=b,M=E,H=T;y=n.distcode[H+((c&(1<<I+M)-1)>>I)],b=y>>>24,E=y>>>16&255,T=y&65535,!(I+b<=u);){if(l===0)break e;l--,c+=i[r++]<<u,u+=8}c>>>=I,u-=I,n.back+=I}if(c>>>=b,u-=b,n.back+=b,E&64){t.msg="invalid distance code",n.mode=vn;break}n.offset=T,n.extra=E&15,n.mode=bR;case bR:if(n.extra){for(L=n.extra;u<L;){if(l===0)break e;l--,c+=i[r++]<<u,u+=8}n.offset+=c&(1<<n.extra)-1,c>>>=n.extra,u-=n.extra,n.back+=n.extra}if(n.offset>
vendor: 4,942 bytes, line 1
1n.dmax){t.msg="invalid distance too far back",n.mode=vn;break}n.mode=ER;case ER:if(d===0)break e;if(p=h-d,n.offset>p){if(p=n.offset-p,p>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=vn;break}p>n.wnext?(p-=n.wnext,g=n.wsize-p):g=n.wnext-p,p>n.length&&(p=n.length),v=n.window}else v=s,g=o-n.offset,p=n.length;p>d&&(p=d),d-=p,n.length-=p;do s[o++]=v[g++];while(--p);n.length===0&&(n.mode=eg);break;case _R:if(d===0)break e;s[o++]=n.length,d--,n.mode=eg;break;case nb:if(n.wrap){for(;u<32;){if(l===0)break e;l--,c|=i[r++]<<u,u+=8}if(h-=d,t.total_out+=h,n.total+=h,n.wrap&4&&h&&(t.adler=n.check=n.flags?ni(n.check,s,h,o-h):Bf(n.check,s,h,o-h)),h=d,n.wrap&4&&(n.flags?c:TR(c))!==n.check){t.msg="incorrect data check",n.mode=vn;break}c=0,u=0}n.mode=wR;case wR:if(n.wrap&&n.flags){for(;u<32;){if(l===0)break e;l--,c+=i[r++]<<u,u+=8}if(n.wrap&4&&c!==(n.total&4294967295)){t.msg="incorrect length check",n.mode=vn;break}c=0,u=0}n.mode=SR;case SR:$=EH;break e;case vn:$=kD;break e;case CD:return MD;case PD:default:return Rs}return t.next_out=o,t.avail_out=d,t.next_in=r,t.avail_in=l,n.hold=c,n.bits=u,(n.wsize||h!==t.avail_out&&n.mode<vn&&(n.mode<nb||e!==tR))&&UD(t,t.output,t.next_out,h-t.avail_out),f-=t.avail_in,h-=t.avail_out,t.total_in+=f,t.total_out+=h,n.total+=h,n.wrap&4&&h&&(t.adler=n.check=n.flags?ni(n.check,s,h,t.next_out-h):Bf(n.check,s,h,t.next_out-h)),t.data_type=n.bits+(n.last?64:0)+(n.mode===Wr?128:0)+(n.mode===Xp||n.mode===tb?256:0),(f===0&&h===0||e===tR)&&$===Bl&&($=wH),$},"inflate$2"),MH=a(t=>{if(Xl(t))return Rs;let e=t.state;return e.window&&(e.window=null),t.state=null,Bl},"inflateEnd"),CH=a((t,e)=>{if(Xl(t))return Rs;const n=t.state;return n.wrap&2?(n.head=e,e.done=!1,Bl):Rs},"inflateGetHeader"),PH=a((t,e)=>{const n=e.length;let i,s,r;return Xl(t)||(i=t.state,i.wrap!==0&&i.mode!==e0)?Rs:i.mode===e0&&(s=1,s=Bf(s,e,n,0),s!==i.check)?kD:(r=UD(t,e,n,n),r?(i.mode=CD,MD):(i.havedict=1,Bl))},"inflateSetDictionary");var DH=OD,OH=ND,NH=DD,FH=LH,UH=FD,BH=kH,$H=MH,HH=CH,GH=PH,VH="pako inflate (from Nodeca project)",ao={inflateReset:DH,inflateReset2:OH,inflateResetKeep:NH,inflateInit:FH,inflateInit2:UH,inflate:BH,inflateEnd:$H,inflateGetHeader:HH,inflateSetDictionary:GH,inflateInfo:VH};function WH(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}a(WH,"GZheader");var zH=WH;const BD=Object.prototype.toString,{Z_NO_FLUSH:KH,Z_FINISH:qH,Z_OK:Gf,Z_STREAM_END:rb,Z_NEED_DICT:ob,Z_STREAM_ERROR:jH,Z_DATA_ERROR:xR,Z_MEM_ERROR:YH}=Jl;function Rp(t){this.options=jv.assign({chunkSize:1024*64,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(t&&t.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15||(e.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new xD,this.strm.avail_out=0;let n=ao.inflateInit2(this.strm,e.windowBits);if(n!==Gf)throw new Error(Fl[n]);if(this.header=new zH,ao.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=Hf.string2buf(e.dictionary):BD.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(n=ao.inflateSetDictionary(this.strm,e.dictionary),n!==Gf)))throw new Error(Fl[n])}a(Rp,"Inflate$1");Rp.prototype.push=function(t,e){const n=this.strm,i=this.options.chunkSize,s=this.options.dictionary;let r,o,l;if(this.ended)return!1;for(e===~~e?o=e:o=e===!0?qH:KH,BD.call(t)==="[object ArrayBuffer]"?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;;){for(n.avail_out===0&&(n.output=new Uint8Array(i),n.next_out=0,n.avail_out=i),r=ao.inflate(n,o),r===ob&&s&&(r=ao.inflateSetDictionary(n,s),r===Gf?r=ao.inflate(n,o):r===xR&&(r=ob));n.avail_in>0&&r===rb&&n.state.wrap>0&&t[n.next_in]!==0;)ao.inflateReset(n),r=ao.inflate(n,o);switch(r){case jH:case xR:case ob:case YH:return this.onEnd(r),this.ended=!0,!1}if(l=n.avail_out,n.next_out&&(n.avail_out===0||r===rb))if(this.options.to==="string"){let d=Hf.utf8border(n.output,n.next_out),c=n.next_out-d,u=Hf.buf2string(n.output,d);n.next_out=c,n.avail_out=i-c,c&&n.output.set(n.output.subarray(d,d+c),0),this.onData(u)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(!(r===Gf&&l===0)){if(r===rb)return r=ao.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,!0;if(n.avail_in===0)break}}return!0};Rp.prototype.onData=function(t){this.chunks.push(t)};Rp.prototype.onEnd=function(t){t===Gf&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=jv.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function IT(t,e){const n=new Rp(e);if(n.push(t),n.err)throw n.msg||Fl[n.err];return n.result}a(IT,"inflate$1");function ZH(t,e){return e=e||{},e.raw=!0,IT(t,e)}
1a(ZH,"inflateRaw$1");var QH=Rp,JH=IT,XH=ZH,e5=IT,t5=Jl,n5={Inflate:QH,inflate:JH,inflateRaw:XH,ungzip:e5,constants:t5};const{Deflate:i5,deflate:s5,deflateRaw:r5,gzip:o5}=dH,{Inflate:a5,inflate:l5,inflateRaw:c5,ungzip:d5}=n5;var u5=i5,f5=s5,h5=r5,p5=o5,g5=a5,m5=l5,v5=c5,y5=d5,b5=Jl,E5={Deflate:u5,deflate:f5,deflateRaw:h5,gzip:p5,Inflate:g5,inflate:m5,inflateRaw:v5,ungzip:y5,constants:b5};const[_5,$D]=Je(!0),[yn,w5]=Je(),[Pa,YE]=Je(!1),S5=a(()=>!Pa(),"isNotConnected"),T5=a((t,e)=>{const n=`set_protocol_${Ee}`,i=Me(n,{onEose:()=>{i(),e()}});Ae(JSON.stringify(["REQ",n,{cache:["set_primal_protocol",{compression:t}]}]),!0)},"setPrimalProtocol"),HD=a(()=>{if(localStorage.getItem("noBinary")==="true"?YE(!0):T5("zlib",()=>{YE(!0)}),localStorage.getItem("devMode")==="true"){const e=window.onPrimalCacheServerConnected;e&&e(Vf,yn()),yn()?.addEventListener("message",function(n){const i=window.onPrimalCacheServerMessageReceived;i&&i(Vf,n.data)})}},"onOpen"),GD=a(()=>{YE(!1),yn()?.removeEventListener("open",HD),yn()?.removeEventListener("close",GD),yn()?.removeEventListener("error",VD),_5()&&setTimeout(()=>{Zv()},200)},"onClose"),VD=a(t=>{Tn("ws error: ",t)},"onError");let Vf="";const Zv=a(()=>{if(S5()){Vf=localStorage.getItem("cacheServer")||"wss://cache2.primal.net/v1";let t=new WebSocket(Vf);t.binaryType="arraybuffer",w5(t),xi("CACHE SOCKET: ",yn()),yn()?.addEventListener("open",HD),yn()?.addEventListener("close",GD),yn()?.addEventListener("error",VD),$D(()=>!0)}},"connect"),LT=a((t=!0)=>{$D(()=>t),yn()?.close()},"disconnect"),A5=a(()=>{LT(),setTimeout(Zv,1e3)},"reset"),Ae=a((t,e=!1)=>{if(Pa()||e){const n=new CustomEvent("send",{detail:{message:t,ws:yn()}});yn()?.send(t),yn()?.dispatchEvent(n);const i=window.onPrimalCacheServerMessageSent;i&&i(Vf,t)}else setTimeout(()=>{Ae(t)},100)},"sendMessage$1"),Qv=a((t,e)=>{t&&Object.keys(e).forEach(n=>{t.removeEventListener(n,e[n]),t.addEventListener(n,e[n])})},"refreshSocketListeners"),Da=a((t,e)=>{t&&Object.keys(e).forEach(n=>{t.removeEventListener(n,e[n])})},"removeSocketListeners"),x5=a(async t=>{try{return E5.inflate(t,{to:"string"})}catch(e){return Tn("ERROR PAKO: ",e),"{}"}},"decompressBlob"),su=a(async t=>{if(typeof t.data=="string")return t.data;try{return await x5(t.data)}catch(e){return Tn("ERROR TO DECOMPRESS BLOB: ",e),"{}"}},"readData"),Jv=a((t,e,n)=>{const i=a(async s=>{const r=await su(s),o=JSON.parse(r),[l,d,c]=o;if(l==="EVENTS"){let u=0;for(u=0;u<c.length;u++){const f=c[u];n("EVENT",d,f)}return}e===d&&n(l,d,c)},"listener");return t.addEventListener("message",i),()=>{t.removeEventListener("message",i)}},"subTo$1"),Me=a((t,e)=>{const n=a(async i=>{const s=await su(i),r=JSON.parse(s),[o,l]=r;if(e&&t===l){if(o==="EVENTS"){const d=r[2];let c=0;for(c=0;c<d.length;c++){const u=d[c];e.onEvent&&e.onEvent(l,u)}}o==="EVENT"&&e.onEvent&&e.onEvent(l,r[2]),o==="EOSE"&&e.onEose&&e.onEose(l),o==="NOTICE"&&e.onNotice&&e.onNotice(l,r[2])}},"listener");return yn()?.addEventListener("message",n),()=>{yn()?.removeEventListener("message",n)}},"subsTo"),I5="_toastHolder_1lp3m_1",L5="_toastSuccess_1lp3m_18",R5="_fadein_1lp3m_1",k5="_toastWarning_1lp3m_35",M5="_toastInfo_1lp3m_52",Lu={toastHolder:I5,toastSuccess:L5,fadein:R5,toastWarning:k5,toastInfo:M5};/*! @license DOMPurify 3.4.13 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.13/LICENSE */function IR(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}a(IR,"_arrayLikeToArray");function C5(t){if(Array.isArray(t))return t}a(C5,"_arrayWithHoles");function P5(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var i,s,r,o,l=[],d=!0,c=!1;try{if(r=(n=n.call(t)).next,e!==0)for(;!(d=(i=r.call(n)).done)&&(l.push(i.value),l.length!==e);d=!0);}catch(u){c=!0,s=u}finally{try{if(!d&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw s}}return l}}a(P5,"_iterableToArrayLimit");function D5(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}a(D5,"_nonIterableRest");function O5(t,e){return C5(t)||P5(t,e)||N5(t,e)||D5()}a(O5,"_slicedToArray");function N5(t,e){if(t){if(typeof t=="string")return IR(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?IR(t,e):void 0}}a(N5,"_unsupportedIterableToArray");
vendor: 4,572 bytes, line 2
2const WD=Object.entries,LR=Object.setPrototypeOf,F5=Object.isFrozen,U5=Object.getPrototypeOf,B5=Object.getOwnPropertyDescriptor;let hi=Object.freeze,gi=Object.seal,Pc=Object.create,zD=typeof Reflect<"u"&&Reflect,ZE=zD.apply,QE=zD.construct;hi||(hi=a(function(e){return e},"freeze"));gi||(gi=a(function(e){return e},"seal"));ZE||(ZE=a(function(e,n){for(var i=arguments.length,s=new Array(i>2?i-2:0),r=2;r<i;r++)s[r-2]=arguments[r];return e.apply(n,s)},"apply"));QE||(QE=a(function(e){for(var n=arguments.length,i=new Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];return new e(...i)},"construct"));const mc=Hn(Array.prototype.forEach),$5=Hn(Array.prototype.lastIndexOf),RR=Hn(Array.prototype.pop),vc=Hn(Array.prototype.push),H5=Hn(Array.prototype.splice),ia=Array.isArray,ju=Hn(String.prototype.toLowerCase),ab=Hn(String.prototype.toString),kR=Hn(String.prototype.match),Ru=Hn(String.prototype.replace),MR=Hn(String.prototype.indexOf),G5=Hn(String.prototype.trim),V5=Hn(Number.prototype.toString),W5=Hn(Boolean.prototype.toString),CR=typeof BigInt>"u"?null:Hn(BigInt.prototype.toString),PR=typeof Symbol>"u"?null:Hn(Symbol.prototype.toString),Xn=Hn(Object.prototype.hasOwnProperty),ku=Hn(Object.prototype.toString),Qn=Hn(RegExp.prototype.test),za=z5(TypeError);function Hn(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];return ZE(t,e,i)}}a(Hn,"unapply");function z5(t){return function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];return QE(t,n)}}a(z5,"unconstruct");function Mt(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ju;if(LR&&LR(t,null),!ia(e))return t;let i=e.length;for(;i--;){let s=e[i];if(typeof s=="string"){const r=n(s);r!==s&&(F5(e)||(e[i]=r),s=r)}t[s]=!0}return t}a(Mt,"addToSet");function K5(t){for(let e=0;e<t.length;e++)Xn(t,e)||(t[e]=null);return t}a(K5,"cleanArray");function bi(t){const e=Pc(null);for(const i of WD(t)){var n=O5(i,2);const s=n[0],r=n[1];Xn(t,s)&&(ia(r)?e[s]=K5(r):r&&typeof r=="object"&&r.constructor===Object?e[s]=bi(r):e[s]=r)}return e}a(bi,"clone");function q5(t){switch(typeof t){case"string":return t;case"number":return V5(t);case"boolean":return W5(t);case"bigint":return CR?CR(t):"0";case"symbol":return PR?PR(t):"Symbol()";case"undefined":return ku(t);case"function":case"object":{if(t===null)return ku(t);const e=t,n=Fs(e,"toString");if(typeof n=="function"){const i=n(e);return typeof i=="string"?i:ku(i)}return ku(t)}default:return ku(t)}}a(q5,"stringifyValue");function Fs(t,e){for(;t!==null;){const i=B5(t,e);if(i){if(i.get)return Hn(i.get);if(typeof i.value=="function")return Hn(i.value)}t=U5(t)}function n(){return null}return a(n,"fallbackValue"),n}a(Fs,"lookupGetter");function j5(t){try{return Qn(t,""),!0}catch{return!1}}a(j5,"isRegex");const DR=hi(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),lb=hi(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),cb=hi(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Y5=
2hi(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),db=hi(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Z5=hi(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),OR=hi(["#text"]),NR=hi(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),ub=hi(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),FR=hi(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","
2subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),tg=hi(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Q5=gi(/{{[\w\W]*|^[\w\W]*}}/g),J5=gi(/<%[\w\W]*|^[\w\W]*%>/g),X5=gi(/\${[\w\W]*/g),e9=gi(/^data-[\-\w.\u00B7-\uFFFF]+$/),t9=gi(/^aria-[\-\w]+$/),UR=gi(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),n9=gi(/^(?:\w+script|data):/i),i9=gi(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),s9=gi(/^html$/i),r9=gi(/^[a-z][.\w]*(-[.\w]+)+$/i),BR=gi(/<[/\w!]/g),$R=gi(/<[/\w]/g),o9=gi(/<\/no(script|embed|frames)/i),a9=gi(/\/>/i),ss={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},l9=a(function(){return typeof window>"u"?null:window},"getGlobal"),c9=a(function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let i=null;const s="data-tt-policy-suffix";n&&n.hasAttribute(s)&&(i=n.getAttribute(s));const r="dompurify"+(i?"#"+i:"");try{return e.createPolicy(r,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+r+" could not be created."),null}},"_createTrustedTypesPolicy"),HR=a(function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},"_createHooksMap"),Mo=a(function(e,n,i,s){return Xn(e,n)&&ia(e[n])?Mt(s.base?bi(s.base):{},e[n],s.transform):i},"_resolveSetOption");function KD(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:l9();const e=a(Ie=>KD(Ie),"DOMPurify");if(e.version="3.4.13",e.removed=[],!t||!t.document||t.document.nodeType!==ss.document||!t.Element)return e.isSupported=!1,e;let n=t.document;const i=n,s=i.currentScript;t.DocumentFragment;const r=t.HTMLTemplateElement,o=t.Node,l=t.Element,d=t.NodeFilter,c=t.NamedNodeMap;c===void 0&&(t.NamedNodeMap||t.MozNamedAttrMap),t.HTMLFormElement;const u=t.DOMParser,f=t.trustedTypes,h=l.prototype,p=Fs(h,"cloneNode"),g=Fs(h,"remove"),v=Fs(h,"nextSibling"),y=Fs(h,"childNodes"),b=Fs(h,"parentNode"),E=Fs(h,"shadowRoot"),T=Fs(h,"attributes"),I=o&&o.prototype?Fs(o.prototype,"nodeType"):null,M=o&&o.prototype?Fs(o.prototype,"nodeName"):null,H=o&&o.prototype?Fs(o.prototype,"ownerDocument"):null;if(typeof r=="function"){const Ie=n.createElement("template");Ie.content&&Ie.content.ownerDocument&&(n=Ie.content.ownerDocument)}let N,$="",F,D=!1,L=0;const m=a(function(){if(L>0)throw za('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},"_assertNotInTrustedTypesPolicy"),S=a(function(q){m(),L++;try{return N.createHTML(q)}finally{L--}},"_createTrustedHTML"),_=a(function(q){m(),L++;try{return N.createScriptURL(q)}finally{L--}},"_createTrustedScriptURL"),A=a(function(){return D||(F=c9(f,s),D=!0),F},"_getDefaultTrustedTypesPolicy"),x=n,C=x.implementation,U=x.createNodeIterator,R=x.createDocumentFragment,w=x.getElementsByTagName,P=i.importNode;let V=HR();e.isSupported=typeof WD=="function"&&typeof b=="function"&&C&&C.createHTMLDocument!==void 0;const Z=Q5,ee=J5,ne=X5,se=e9,ge=t9,ie=n9,j=i9,Y=r9;let le=UR,pe=null;const Te=Mt({},[...DR,...lb,...cb,...db,...OR]);let Le=null;const De=Mt({},[...NR,...ub,...FR,...tg]);let _e=Object.seal(Pc(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),we=null,ye=null;const te=Object.seal(Pc(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let he=!0,ae=!0,ve=!1,lt=!0,Ye=!1,nt=!0,Qt=!1,W=!1,k=null,O=null,K=!1,Q=!1,ce=!1,oe=!1,ke=!0,ft=!1;const et="user-content-";let it=!0,_t=!1,Gt={},Rt=null;const Lo=Mt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let zt=null;const dn=Mt({},["audio","video","img","source","image","track"]);let Ri=null;const Jt=Mt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Vt="http://www.w3.org/1998/Math/MathML",Gr="http://www.w3.org/2000/svg",$t="http://www.w3.org/1999/xhtml";let on=$t,rc=!1,gn=null;const xn=Mt({},[Vt,Gr,$t],ab),yu=hi(["mi","mo","mn","ms","mtext"]);let mn=Mt({},yu);const bn=hi(["annotation-xml"]);let oc=Mt({},bn);const In=Mt({},["title","style","font","a","script"]);let cn=null;const Kp=["application/xhtml+xml","text/html"],Ln="text/html";let ut=null,Js=null;const bu=n.createElement("form"),ac=a(function(q){return q instanceof RegExp||q instanceof Function},"isRegexOrFunction"),Wa=a(function(){let q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Js&&Js===q)return;(!q||typeof q!="object")&&(q={}
vendor: 4,495 bytes, line 2
2),q=bi(q),cn=Kp.indexOf(q.PARSER_MEDIA_TYPE)===-1?Ln:q.PARSER_MEDIA_TYPE,ut=cn==="application/xhtml+xml"?ab:ju,pe=Mo(q,"ALLOWED_TAGS",Te,{transform:ut}),Le=Mo(q,"ALLOWED_ATTR",De,{transform:ut}),gn=Mo(q,"ALLOWED_NAMESPACES",xn,{transform:ab}),Ri=Mo(q,"ADD_URI_SAFE_ATTR",Jt,{transform:ut,base:Jt}),zt=Mo(q,"ADD_DATA_URI_TAGS",dn,{transform:ut,base:dn}),Rt=Mo(q,"FORBID_CONTENTS",Lo,{transform:ut}),we=Mo(q,"FORBID_TAGS",bi({}),{transform:ut}),ye=Mo(q,"FORBID_ATTR",bi({}),{transform:ut}),Gt=Xn(q,"USE_PROFILES")?q.USE_PROFILES&&typeof q.USE_PROFILES=="object"?bi(q.USE_PROFILES):q.USE_PROFILES:!1,he=q.ALLOW_ARIA_ATTR!==!1,ae=q.ALLOW_DATA_ATTR!==!1,ve=q.ALLOW_UNKNOWN_PROTOCOLS||!1,lt=q.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ye=q.SAFE_FOR_TEMPLATES||!1,nt=q.SAFE_FOR_XML!==!1,Qt=q.WHOLE_DOCUMENT||!1,Q=q.RETURN_DOM||!1,ce=q.RETURN_DOM_FRAGMENT||!1,oe=q.RETURN_TRUSTED_TYPE||!1,K=q.FORCE_BODY||!1,ke=q.SANITIZE_DOM!==!1,ft=q.SANITIZE_NAMED_PROPS||!1,it=q.KEEP_CONTENT!==!1,_t=q.IN_PLACE||!1,le=j5(q.ALLOWED_URI_REGEXP)?q.ALLOWED_URI_REGEXP:UR,on=typeof q.NAMESPACE=="string"?q.NAMESPACE:$t,mn=Xn(q,"MATHML_TEXT_INTEGRATION_POINTS")&&q.MATHML_TEXT_INTEGRATION_POINTS&&typeof q.MATHML_TEXT_INTEGRATION_POINTS=="object"?bi(q.MATHML_TEXT_INTEGRATION_POINTS):Mt({},yu),oc=Xn(q,"HTML_INTEGRATION_POINTS")&&q.HTML_INTEGRATION_POINTS&&typeof q.HTML_INTEGRATION_POINTS=="object"?bi(q.HTML_INTEGRATION_POINTS):Mt({},bn);const ue=Xn(q,"CUSTOM_ELEMENT_HANDLING")&&q.CUSTOM_ELEMENT_HANDLING&&typeof q.CUSTOM_ELEMENT_HANDLING=="object"?bi(q.CUSTOM_ELEMENT_HANDLING):Pc(null);if(_e=Pc(null),Xn(ue,"tagNameCheck")&&ac(ue.tagNameCheck)&&(_e.tagNameCheck=ue.tagNameCheck),Xn(ue,"attributeNameCheck")&&ac(ue.attributeNameCheck)&&(_e.attributeNameCheck=ue.attributeNameCheck),Xn(ue,"allowCustomizedBuiltInElements")&&typeof ue.allowCustomizedBuiltInElements=="boolean"&&(_e.allowCustomizedBuiltInElements=ue.allowCustomizedBuiltInElements),gi(_e),Ye&&(ae=!1),ce&&(Q=!0),Gt&&(pe=Mt({},OR),Le=Pc(null),Gt.html===!0&&(Mt(pe,DR),Mt(Le,NR)),Gt.svg===!0&&(Mt(pe,lb),Mt(Le,ub),Mt(Le,tg)),Gt.svgFilters===!0&&(Mt(pe,cb),Mt(Le,ub),Mt(Le,tg)),Gt.mathMl===!0&&(Mt(pe,db),Mt(Le,FR),Mt(Le,tg))),te.tagCheck=null,te.attributeCheck=null,Xn(q,"ADD_TAGS")&&(typeof q.ADD_TAGS=="function"?te.tagCheck=q.ADD_TAGS:ia(q.ADD_TAGS)&&(pe===Te&&(pe=bi(pe)),Mt(pe,q.ADD_TAGS,ut))),Xn(q,"ADD_ATTR")&&(typeof q.ADD_ATTR=="function"?te.attributeCheck=q.ADD_ATTR:ia(q.ADD_ATTR)&&(Le===De&&(Le=bi(Le)),Mt(Le,q.ADD_ATTR,ut))),Xn(q,"ADD_URI_SAFE_ATTR")&&ia(q.ADD_URI_SAFE_ATTR)&&Mt(Ri,q.ADD_URI_SAFE_ATTR,ut),Xn(q,"FORBID_CONTENTS")&&ia(q.FORBID_CONTENTS)&&(Rt===Lo&&(Rt=bi(Rt)),Mt(Rt,q.FORBID_CONTENTS,ut)),Xn(q,"ADD_FORBID_CONTENTS")&&ia(q.ADD_FORBID_CONTENTS)&&(Rt===Lo&&(Rt=bi(Rt)),Mt(Rt,q.ADD_FORBID_CONTENTS,ut)),it&&(pe["#text"]=!0),Qt&&Mt(pe,["html","head","body"]),pe.table&&(Mt(pe,["tbody"]),delete we.tbody),q.TRUSTED_TYPES_POLICY){if(typeof q.TRUSTED_TYPES_POLICY.createHTML!="function")throw za('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof q.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw za('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const Se=N;N=q.TRUSTED_TYPES_POLICY;try{$=S("")}catch(He){throw N=Se,He}}else q.TRUSTED_TYPES_POLICY===null?(N=void 0,$=""):(N===void 0&&(N=A()),N&&typeof $=="string"&&($=S("")));hi&&hi(q),Js=q},"_parseConfig"),lc=Mt({},[...lb,...cb,...Y5]),cc=Mt({},[...db,...Z5]),Eu=a(function(q,ue,Se){return ue.namespaceURI===$t?q==="svg":ue.namespaceURI===Vt?q==="svg"&&(Se==="annotation-xml"||mn[Se]):!!lc[q]},"_checkSvgNamespace"),_u=a(function(q,ue,Se){return ue.namespaceURI===$t?q==="math":ue.namespaceURI===Gr?q==="math"&&oc[Se]:!!cc[q]},"_checkMathMlNamespace"),wu=a(function(q,ue,Se){return ue.namespaceURI===Gr&&!oc[Se]||ue.namespaceURI===Vt&&!mn[Se]?!1:!cc[q]&&(In[q]||!lc[q])},"_checkHtmlNamespace"),Su=a(function(q){let ue=b(q);(!ue||!ue.tagName)&&(ue={namespaceURI:on,tagName:"template"});const Se=ju(q.tagName),He=ju(ue.tagName);return gn[q.namespaceURI]?q.namespaceURI===Gr?Eu(Se,ue,He):q.namespaceURI===Vt?_u(Se,ue,He):q.namespaceURI===$t?wu(Se,ue,He):!!(cn==="application/xhtml+xml"&&gn[q.namespaceURI]):!1},"_checkValidNamespace"),ys=a(function(q){vc(e.removed,{element:q});try{b(q).removeChild(q)}catch{if(g(q),!b(q))throw za("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},"_forceRemove"),Ro=a(function(q){Vr(q);const ue=y(q);
2if(ue){const He=[];mc(ue,qe=>{vc(He,qe)}),mc(He,qe=>{try{g(qe)}catch{}})}const Se=T(q);if(Se)for(let He=Se.length-1;He>=0;--He){const qe=Se[He],pt=qe&&qe.name;if(typeof pt=="string")try{q.removeAttribute(pt)}catch{}}},"_neutralizeRoot"),Ps=a(function(q,ue){try{vc(e.removed,{attribute:ue.getAttributeNode(q),from:ue})}catch{vc(e.removed,{attribute:null,from:ue})}if(ue.removeAttribute(q),q==="is")if(Q||ce)try{ys(ue)}catch{}else try{ue.setAttribute(q,"")}catch{}},"_removeAttribute"),Tu=a(function(q){const ue=T(q);if(ue)for(let Se=ue.length-1;Se>=0;--Se){const He=ue[Se],qe=He&&He.name;if(!(typeof qe!="string"||Le[ut(qe)]))try{q.removeAttribute(qe)}catch{}}},"_stripDisallowedAttributes"),Vr=a(function(q){const ue=[q];for(;ue.length>0;){const Se=ue.pop();(I?I(Se):Se.nodeType)===ss.element&&Tu(Se);const qe=y(Se);if(qe)for(let pt=qe.length-1;pt>=0;--pt)ue.push(qe[pt])}},"_neutralizeSubtree"),Au=a(function(q){if(!nt)return;const ue=[q];for(;ue.length>0;){const Se=ue.pop(),He=I?I(Se):Se.nodeType;if(He===ss.processingInstruction||He===ss.comment&&Qn($R,Se.data)){try{g(Se)}catch{}continue}if(He===ss.element){const pt=Se,Xt=ut(M?M(Se):Se.nodeName);try{pt.hasAttribute&&pt.hasAttribute("patchsrc")&&pt.removeAttribute("patchsrc"),pt.hasAttribute&&pt.hasAttribute("for")&&Xt!=="label"&&Xt!=="output"&&pt.removeAttribute("for")}catch{}}const qe=y(Se);if(qe)for(let pt=qe.length-1;pt>=0;--pt)ue.push(qe[pt])}},"_neutralizePatchLinkage"),dc=a(function(q){let ue=null,Se=null;if(K)q="<remove></remove>"+q;else{const pt=kR(q,/^[\r\n\t ]+/);Se=pt&&pt[0]}cn==="application/xhtml+xml"&&on===$t&&(q='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+q+"</body></html>");const He=N?S(q):q;if(on===$t)try{ue=new u().parseFromString(He,cn)}catch{}if(!ue||!ue.documentElement){ue=C.createDocument(on,"template",null);try{ue.documentElement.innerHTML=rc?$:He}catch{}}const qe=ue.body||ue.documentElement;return q&&Se&&qe.insertBefore(n.createTextNode(Se),qe.childNodes[0]||null),on===$t?w.call(ue,Qt?"html":"body")[0]:Qt?ue.documentElement:qe},"_initDocument"),uc=a(function(q){const ue=H?H(q):q.ownerDocument;return U.call(ue||q,q,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},"_createNodeIterator"),ko=a(function(q){return q=Ru(q,Z," "),q=Ru(q,ee," "),q=Ru(q,ne," "),q},"_stripTemplateExpressions"),$y=a(function(q){var ue;q.normalize();const Se=H?H(q):q.ownerDocument,He=U.call(Se||q,q,d.SHOW_TEXT|d.SHOW_COMMENT|d.SHOW_CDATA_SECTION|d.SHOW_PROCESSING_INSTRUCTION,null);let qe=He.nextNode();for(;qe;)qe.data=ko(qe.data),qe=He.nextNode();const pt=(ue=q.querySelectorAll)===null||ue===void 0?void 0:ue.call(q,"template");pt&&mc(pt,Xt=>{fc(Xt.content)&&$y(Xt.content)})},"_scrubTemplateExpressions"),qp=a(function(q){const ue=M?M(q):null;return typeof ue!="string"||ut(ue)!=="form"?!1:typeof q.nodeName!="string"||typeof q.textContent!="string"||typeof q.removeChild!="function"||q.attributes!==T(q)||typeof q.removeAttribute!="function"||typeof q.setAttribute!="function"||typeof q.namespaceURI!="string"||typeof q.insertBefore!="function"||typeof q.hasChildNodes!="function"||q.nodeType!==I(q)||q.childNodes!==y(q)},"_isClobbered"),fc=a(function(q){if(!I||typeof q!="object"||q===null)return!1;try{return I(q)===ss.documentFragment}catch{return!1}},"_isDocumentFragment"),xu=a(function(q){if(!I||typeof q!="object"||q===null)return!1;try{return typeof I(q)=="number"}catch{return!1}},"_isNode");function Xs(Ie,q,ue){Ie.length!==0&&mc(Ie,Se=>{Se.call(e,q,ue,Js)})}a(Xs,"_executeHooks");const P4=a(function(q,ue){return!!(nt&&q.hasChildNodes()&&!xu(q.firstElementChild)&&Qn(BR,q.textContent)&&Qn(BR,q.innerHTML)||nt&&q.namespaceURI===$t&&ue==="style"&&xu(q.firstElementChild)||q.nodeType===ss.processingInstruction||nt&&q.nodeType===ss.comment&&Qn($R,q.data))},"_isUnsafeNode"),D4=a(function(q,ue,Se){if(!we[ue]&&CL(ue)&&(_e.tagNameCheck instanceof RegExp&&Qn(_e.tagNameCheck,ue)||_e.tagNameCheck instanceof Function&&_e.tagNameCheck(ue)))return!1;if(it&&!Rt[ue]){const He=b(q),qe=y(q);if(qe&&He){const pt=qe.length;for(let Xt=pt-1;Xt>=0;--Xt){const En=q===Se?p(qe[Xt],!0):qe[Xt];He.insertBefore(En,v(q))}}}return ys(q),!0},"_sanitizeDisallowedNode"),RL=a(function(q,ue,Se,He){return q.length===0?ue:ue===Se||ue===He?bi(ue):ue},"_forkSharedAllowlist"),kL=a(function(q,ue){if(Xs(V.beforeSanitizeElements,q,null),q
2!==ue&&b(q)===null)return _t&&Vr(q),!0;if(qp(q))return ys(q),!0;const Se=ut(M?M(q):q.nodeName);if(pe=RL(V.uponSanitizeElement,pe,Te,k),Xs(V.uponSanitizeElement,q,{tagName:Se,allowedTags:pe}),q!==ue&&b(q)===null)return _t&&Vr(q),!0;if(P4(q,Se))return ys(q),!0;if(we[Se]||!(te.tagCheck instanceof Function&&te.tagCheck(Se))&&!pe[Se]){const qe=D4(q,Se,ue);return qe===!1&&Xs(V.afterSanitizeElements,q,null),qe}if((I?I(q):q.nodeType)===ss.element&&!Su(q)||(Se==="noscript"||Se==="noembed"||Se==="noframes")&&Qn(o9,q.innerHTML))return ys(q),!0;if(Ye&&q.nodeType===ss.text){const qe=ko(q.textContent);q.textContent!==qe&&(vc(e.removed,{element:q.cloneNode()}),q.textContent=qe)}return Xs(V.afterSanitizeElements,q,null),!1},"_sanitizeElements"),ML=a(function(q,ue,Se){if(ye[ue]||nt&&ue==="patchsrc"||nt&&ue==="for"&&q!=="label"&&q!=="output"||ke&&(ue==="id"||ue==="name")&&(Se in n||Se in bu))return!1;const He=Le[ue]||te.attributeCheck instanceof Function&&te.attributeCheck(ue,q);if(!(ae&&Qn(se,ue))){if(!(he&&Qn(ge,ue))){if(He){if(!Ri[ue]){if(!Qn(le,Ru(Se,j,""))){if(!((ue==="src"||ue==="xlink:href"||ue==="href")&&q!=="script"&&MR(Se,"data:")===0&&zt[q])){if(!(ve&&!Qn(ie,Ru(Se,j,"")))){if(Se)return!1}}}}}else if(!(CL(q)&&(_e.tagNameCheck instanceof RegExp&&Qn(_e.tagNameCheck,q)||_e.tagNameCheck instanceof Function&&_e.tagNameCheck(q))&&(_e.attributeNameCheck instanceof RegExp&&Qn(_e.attributeNameCheck,ue)||_e.attributeNameCheck instanceof Function&&_e.attributeNameCheck(ue,q))||ue==="is"&&_e.allowCustomizedBuiltInElements&&(_e.tagNameCheck instanceof RegExp&&Qn(_e.tagNameCheck,Se)||_e.tagNameCheck instanceof Function&&_e.tagNameCheck(Se))))return!1}}return!0},"_isValidAttribute"),O4=Mt({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),CL=a(function(q){return!O4[ju(q)]&&Qn(Y,q)},"_isBasicCustomElement"),N4=a(function(q,ue,Se,He){if(N&&typeof f=="object"&&typeof f.getAttributeType=="function"&&!Se)switch(f.getAttributeType(q,ue)){case"TrustedHTML":return S(He);case"TrustedScriptURL":return _(He)}return He},"_applyTrustedTypesToAttribute"),F4=a(function(q,ue,Se,He){try{Se?q.setAttributeNS(Se,ue,He):q.setAttribute(ue,He),qp(q)?ys(q):RR(e.removed)}catch{Ps(ue,q)}},"_setAttributeValue"),PL=a(function(q){Xs(V.beforeSanitizeAttributes,q,null);const ue=q.attributes;if(!ue||qp(q))return;Le=RL(V.uponSanitizeAttribute,Le,De,O);const Se={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Le,forceKeepAttr:void 0};let He=ue.length;const qe=ut(q.nodeName);for(;He--;){const pt=ue[He],Xt=pt.name,En=pt.namespaceURI,$i=pt.value,Hi=ut(Xt),Gy=$i;let ki=Xt==="value"?Gy:G5(Gy);if(Se.attrName=Hi,Se.attrValue=ki,Se.keepAttr=!0,Se.forceKeepAttr=void 0,Xs(V.uponSanitizeAttribute,q,Se),ki=Se.attrValue,ft&&(Hi==="id"||Hi==="name")&&MR(ki,et)!==0&&(Ps(Xt,q),ki=et+ki),nt&&Qn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,ki)){Ps(Xt,q);continue}if(Hi==="attributename"&&kR(ki,"href")){Ps(Xt,q);continue}if(!Se.forceKeepAttr){if(!Se.keepAttr){Ps(Xt,q);continue}if(!lt&&Qn(a9,ki)){Ps(Xt,q);continue}if(Ye&&(ki=ko(ki)),!ML(qe,Hi,ki)){Ps(Xt,q);continue}ki=N4(qe,Hi,En,ki),ki!==Gy&&F4(q,Xt,En,ki)}}Xs(V.afterSanitizeAttributes,q,null)},"_sanitizeAttributes"),jp=a(function(q){let ue=null;const Se=uc(q);for(Xs(V.beforeSanitizeShadowDOM,q,null);ue=Se.nextNode();)if(Xs(V.uponSanitizeShadowNode,ue,null),kL(ue,q),PL(ue),fc(ue.content)&&jp(ue.content),(I?I(ue):ue.nodeType)===ss.element){const qe=E(ue);fc(qe)&&(Hy(qe),jp(qe))}Xs(V.afterSanitizeShadowDOM,q,null)},"_sanitizeShadowDOM"),Hy=a(function(q){const ue=[{node:q,shadow:null}];for(;ue.length>0;){const Se=ue.pop();if(Se.shadow){jp(Se.shadow);continue}const He=Se.node,pt=(I?I(He):He.nodeType)===ss.element,Xt=y(He);if(Xt)for(let En=Xt.length-1;En>=0;--En)ue.push({node:Xt[En],shadow:null});if(pt){const En=M?M(He):null;if(typeof En=="string"&&ut(En)==="template"){const $i=He.content;fc($i)&&ue.push({node:$i,shadow:null})}}if(pt){const En=E(He);fc(En)&&ue.push({node:null,shadow:En},{node:En,shadow:null})}}},"_sanitizeAttachedShadowRoots");return e.sanitize=function(Ie){let q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ue=null,Se=null,He=null,qe=null;if(rc=!Ie,rc&&(Ie="<!-->"),typeof Ie!="string"&&!xu(Ie)&&(Ie=q5(Ie),typeof Ie!="string"))throw za("dirty is not a string, aborting");if(!e.isSupported)return Ie;W?(pe=k,Le=O):Wa(q),(V.uponSanitizeElement.length>0||V.uponSanitizeAttribute.length>0)&&(pe=bi(pe)),V.uponSanitizeAttribute.length>0&&(Le=bi(Le)),e.removed=[];const pt=_t&&typeof Ie!="string"&&xu(Ie);
2if(pt){Au(Ie);const $i=M?M(Ie):Ie.nodeName;if(typeof $i=="string"){const Hi=ut($i);if(!pe[Hi]||we[Hi])throw Ro(Ie),za("root node is forbidden and cannot be sanitized in-place")}if(qp(Ie))throw Ro(Ie),za("root node is clobbered and cannot be sanitized in-place");try{Hy(Ie)}catch(Hi){throw Ro(Ie),Hi}}else if(xu(Ie))ue=dc("<!---->"),Se=ue.ownerDocument.importNode(Ie,!0),Se.nodeType===ss.element&&Se.nodeName==="BODY"||Se.nodeName==="HTML"?ue=Se:ue.appendChild(Se),Hy(Se);else{if(!Q&&!Ye&&!Qt&&Ie.indexOf("<")===-1)return N&&oe?S(Ie):Ie;if(ue=dc(Ie),!ue)return Q?null:oe?$:""}ue&&K&&ys(ue.firstChild);const Xt=pt?Ie:ue;try{const $i=uc(Xt);for(;He=$i.nextNode();)kL(He,Xt),PL(He),fc(He.content)&&jp(He.content)}catch($i){throw pt&&(Ro(Ie),mc(e.removed,Hi=>{Hi.element&&Vr(Hi.element)})),$i}if(pt)return mc(e.removed,$i=>{$i.element&&Vr($i.element)}),Ye&&$y(Ie),Ie;if(Q){if(Ye&&$y(ue),ce)for(qe=R.call(ue.ownerDocument);ue.firstChild;)qe.appendChild(ue.firstChild);else qe=ue;return(Le.shadowroot||Le.shadowrootmode)&&(qe=P.call(i,qe,!0)),qe}let En=Qt?ue.outerHTML:ue.innerHTML;return Qt&&pe["!doctype"]&&ue.ownerDocument&&ue.ownerDocument.doctype&&ue.ownerDocument.doctype.name&&Qn(s9,ue.ownerDocument.doctype.name)&&(En="<!DOCTYPE "+ue.ownerDocument.doctype.name+`>
3`+En),Ye&&(En=ko(En)),N&&oe?S(En):En},e.setConfig=function(){let Ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Wa(Ie),W=!0,k=pe,O=Le},e.clearConfig=function(){Js=null,W=!1,k=null,O=null,N=F,$=""},e.isValidAttribute=function(Ie,q,ue){Js||Wa({});const Se=ut(Ie),He=ut(q);return ML(Se,He,ue)},e.addHook=function(Ie,q){typeof q=="function"&&Xn(V,Ie)&&vc(V[Ie],q)},e.removeHook=function(Ie,q){if(Xn(V,Ie)){if(q!==void 0){const ue=$5(V[Ie],q);return ue===-1?void 0:H5(V[Ie],ue,1)[0]}return RR(V[Ie])}},e.removeHooks=function(Ie){Xn(V,Ie)&&(V[Ie]=[])},e.removeAllHooks=function(){V=HR()},e}a(KD,"createDOMPurify");var d9=KD(),u9=It("<div>");const qD=Pn(),f9=a(t=>{let e;const n=a((s,r,o=4e3)=>{const l=document.createElement("div");l.innerHTML=d9.sanitize(s),l.classList.add(r),setTimeout(()=>{e?.append(l)},0),setTimeout(()=>{e?.removeChild(l)},o)},"toastMesage"),i={sendWarning:s=>{n(s,Lu.toastWarning)},sendSuccess:s=>{n(s,Lu.toastSuccess,2e3)},sendInfo:s=>{n(s,Lu.toastInfo)},notImplemented:()=>{n("Feature not available in this preview release. Rest assured, we are working on it. Come back soon!",Lu.toastInfo,2e3)}};return[(()=>{var s=u9(),r=e;return typeof r=="function"?Ld(r,s):e=s,ze(()=>xe(s,Lu.toastHolder)),s})(),X(qD.Provider,{value:i,get children(){return t.children}})]},"Toaster");function h9(){return Dn(qD)}a(h9,"useToastContext");const Wf=Symbol("store-raw"),Cr=Symbol("store-node"),As=Symbol("store-has"),jD=Symbol("store-self");function YD(t){let e=t[ri];if(!e&&(Object.defineProperty(t,ri,{value:e=new Proxy(t,g9)}),!Array.isArray(t))){const n=Object.keys(t),i=Object.getOwnPropertyDescriptors(t);for(let s=0,r=n.length;s<r;s++){const o=n[s];i[o].get&&Object.defineProperty(t,o,{enumerable:i[o].enumerable,get:i[o].get.bind(e)})}}return e}a(YD,"wrap$1");function bo(t){let e;return t!=null&&typeof t=="object"&&(t[ri]||!(e=Object.getPrototypeOf(t))||e===Object.prototype||Array.isArray(t))}a(bo,"isWrappable");function Pt(t,e=new Set){let n,i,s,r;if(n=t!=null&&t[Wf])return n;if(!bo(t)||e.has(t))return t;if(Array.isArray(t)){Object.isFrozen(t)?t=t.slice(0):e.add(t);for(let o=0,l=t.length;o<l;o++)s=t[o],(i=Pt(s,e))!==s&&(t[o]=i)}else{Object.isFrozen(t)?t=Object.assign({},t):e.add(t);const o=Object.keys(t),l=Object.getOwnPropertyDescriptors(t);for(let d=0,c=o.length;d<c;d++)r=o[d],!l[r].get&&(s=t[r],(i=Pt(s,e))!==s&&(t[r]=i))}return t}a(Pt,"unwrap");function Cd(t,e){let n=t[e];return n||Object.defineProperty(t,e,{value:n=Object.create(null)}),n}a(Cd,"getNodes");function $l(t,e,n){if(t[e])return t[e];const[i,s]=Je(n,{equals:!1,internal:!0});return i.$=s,t[e]=i}a($l,"getNode");function p9(t,e){const n=Reflect.getOwnPropertyDescriptor(t,e);return!n||n.get||!n.configurable||e===ri||e===Cr||(delete n.value,delete n.writable,n.get=()=>t[ri][e]),n}a(p9,"proxyDescriptor$1");function RT(t){Id()&&$l(Cd(t,Cr),jD)()}a(RT,"trackSelf");function ZD(t){return RT(t),Reflect.ownKeys(t)}a(ZD,"ownKeys$1");const g9={get(t,e,n){if(e===Wf)return t;if(e===ri)return n;if(e===Cf)return RT(t),n;const i=Cd(t,Cr),s=i[e];let r=s?s():t[e];if(e===Cr||e===As||e==="__proto__")return r;if(!s){const o=Object.getOwnPropertyDescriptor(t,e);Id()&&(typeof r!="function"||t.hasOwnProperty(e))&&!(o&&o.get)&&(r=$l(i,e,r)())}return bo(r)?YD(r):r},has(t,e){return e===Wf||e===ri||e===Cf||e===Cr||e===As||e==="__proto__"?!0:(Id()&&$l(Cd(t,As),e)(),e in t)},set(){return!0},deleteProperty(){return!0},ownKeys:ZD,getOwnPropertyDescriptor:p9};function qi(t,e,n,i=!1){if(!i&&t[e]===n)return;const s=t[e],r=t.length;n===void 0?(delete t[e],t[As]&&t[As][e]&&s!==void 0&&t[As][e].$()):(t[e]=n,t[As]&&t[As][e]&&s===void 0&&t[As][e].$());let o=Cd(t,Cr),l;if((l=$l(o,e,s))&&l.$(()=>n),Array.isArray(t)&&t.length!==r){for(let d=t.length;d<r;d++)(l=o[d])&&l.$();(l=$l(o,"length",r))&&l.$(t.length)}(l=o[jD])&&l.$()}a(qi,"setProperty");function QD(t,e){const n=Object.keys(e);for(let i=0;i<n.length;i+=1){const s=n[i];qi(t,s,e[s])}}a(QD,"mergeStoreNode");function m9(t,e){if(typeof e=="function"&&(e=e(t)),e=Pt(e),Array.isArray(e)){if(t===e)return;let n=0,i=e.length;for(;n<i;n++){const s=e[n];t[n]!==s&&qi(t,n,s)}qi(t,"length",i)}else QD(t,e)}a(m9,"updateArray");function Yu(t,e,n=[]){let i,s=t;if(e.length>1){i=e.shift();const o=typeof i,l=Array.isArray(t);if(Array.isArray(i)){for(let d=0;d<i.length;d++)Yu(t,[i[d]].concat(e),n);return}else if(l&&o==="function"){for(let d=0;d<t.length;d++)i(t[d],d)&&Yu(t,[d].concat(e),n);return}else if(l&&o==="object"){const{from:d=0,to:c=t.length-1,by:u=1}=i;for(let f=d;f<=c;f+=u)Yu(t,[f].concat(e),n);return}else if(e.length>1){Yu(t[i],e,[i].concat(n));return}s=t[i],n=[i].concat(n)}let r=e[0];typeof r=="function"&&(r=r(s,n),r===s)||i===void 0&&r==null||(r=Pt(r),i===void 0||bo(s)&&bo(r)&&!Array.isArray(r)?QD(s,r):qi(t,i,r))}a(Yu,"updatePath");function li(...[t,e]){const n=Pt(t||{}),i=Array.isArray(n),s=YD(n);function r(...o){Aa(()=>{i&&o.length===1?m9(n,o[0]):Yu(n,o)})}return a(r,"setStore"),[s,r]}a(li,"createStore");function v9(t,e){const n=Reflect.getOwnPropertyDescriptor(t,e);return!n||n.get||n.set||!n.configurable||e===ri||e===Cr||(delete n.value,delete n.writable,n.get=()=>t[ri][e],n.set=i=>t[ri][e]=i),n}a(v9,"proxyDescriptor");const y9={get(t,e,n){if(e===Wf)return t;if(e===ri)return n;if(e===Cf)return RT(t),n;const i=Cd(t,Cr),s=i[e];let r=s?s():t[e];if(e===Cr||e===As||e==="__proto__")return r;if(!s){const o=Object.getOwnPropertyDescriptor(t,e),l=typeof r=="function";if(Id()&&(!l||t.hasOwnProperty(e))&&!(o&&o.get))r=$l(i,e,r)();else if(r!=null&&l&&r===Array.prototype[e])return(...d)=>Aa(()=>Array.prototype[e].apply(n,d))}return bo(r)?JD(r):r},has(t,e){return e===Wf||e===ri||e===Cf||e===Cr||e===As||e==="__proto__"?!0:(Id()&&$l(Cd(t,As),e)(),e in t)},set(t,e,n){return Aa(()=>qi(t,e,Pt(n))),!0},deleteProperty(t,e){return Aa(()=>qi(t,e,void 0,!0)),!0},ownKeys:ZD,getOwnPropertyDescriptor:v9};function JD(t){let e=t[ri];if(!e){Object.defineProperty(t,ri,{value:e=new Proxy(t,y9)});const n=Object.keys(t),i=Object.getOwnPropertyDescriptors(t),s=Object.getPrototypeOf(t),r=s!==null&&t!==null&&typeof t=="object"&&!Array.isArray(t)&&s!==Object.prototype;if(r){let o=s;for(;o!=null;){const l=Object.getOwnPropertyDescriptors(o);
3n.push(...Object.keys(l)),Object.assign(i,l),o=Object.getPrototypeOf(o)}}for(let o=0,l=n.length;o<l;o++){const d=n[o];if(!(r&&d==="constructor")){if(i[d].get){const c=i[d].get.bind(e);Object.defineProperty(t,d,{get:c,configurable:!0})}if(i[d].set){const c=i[d].set;Object.defineProperty(t,d,{set:a(f=>Aa(()=>c.call(e,f)),"set"),configurable:!0})}}}}return e}a(JD,"wrap");function b9(t,e){const n=Pt(t||{});return JD(n)}a(b9,"createMutable");const JE=Symbol("store-root");function Dc(t,e,n,i,s){const r=e[n];if(t===r)return;const o=Array.isArray(t);if(n!==JE&&(!bo(t)||!bo(r)||o!==Array.isArray(r)||s&&t[s]!==r[s])){qi(e,n,t);return}if(o){if(t.length&&r.length&&(!i||s&&t[0]&&t[0][s]!=null)){let c,u,f,h,p,g,v,y;for(f=0,h=Math.min(r.length,t.length);f<h&&(r[f]===t[f]||s&&r[f]&&t[f]&&r[f][s]&&r[f][s]===t[f][s]);f++)Dc(t[f],r,f,i,s);const b=new Array(t.length),E=new Map;for(h=r.length-1,p=t.length-1;h>=f&&p>=f&&(r[h]===t[p]||s&&r[h]&&t[p]&&r[h][s]&&r[h][s]===t[p][s]);h--,p--)b[p]=r[h];if(f>p||f>h){for(u=f;u<=p;u++)qi(r,u,t[u]);for(;u<t.length;u++)qi(r,u,b[u]),Dc(t[u],r,u,i,s);r.length>t.length&&qi(r,"length",t.length);return}for(v=new Array(p+1),u=p;u>=f;u--)g=t[u],y=s&&g?g[s]:g,c=E.get(y),v[u]=c===void 0?-1:c,E.set(y,u);for(c=f;c<=h;c++)g=r[c],y=s&&g?g[s]:g,u=E.get(y),u!==void 0&&u!==-1&&(b[u]=r[c],u=v[u],E.set(y,u));for(u=f;u<t.length;u++)u in b?(qi(r,u,b[u]),Dc(t[u],r,u,i,s)):qi(r,u,t[u])}else for(let c=0,u=t.length;c<u;c++)Dc(t[c],r,c,i,s);r.length>t.length&&qi(r,"length",t.length);return}const l=Object.keys(t);for(let c=0,u=l.length;c<u;c++)Dc(t[l[c]],r,l[c],i,s);const d=Object.keys(r);for(let c=0,u=d.length;c<u;c++)t[d[c]]===void 0&&qi(r,d[c],void 0)}a(Dc,"applyState");function Si(t,e={}){const{merge:n,key:i="id"}=e,s=Pt(t);return r=>{if(!bo(r)||!bo(s))return s;const o=Dc(s,{[JE]:r},JE,n,i);return o===void 0?r:o}}a(Si,"reconcile");const XE="/assets/logo-d368885b.svg",z0e=Object.freeze(Object.defineProperty({__proto__:null,default:XE},Symbol.toStringTag,{value:"Module"})),E9=1e3,_9=60*E9,XD=60*_9,w9=24*XD,ng={users:{},messages:[],postStats:{},noteActions:{},topZaps:{},streams:[],pollResults:{}},S9="9a500dccc084a138330a1d1b2be0d5e86394624325d25084d3eca164e7ea698a",T9=[{name:"midnight",label:"midnight wave",logo:XE,dark:!0},{name:"ice",label:"ice wave",logo:XE}],Xv={names:{miljan:"d61f3bc5b3eb4400efdae6169a5c17cabf3246b514361de939ce4a1a0da6ef4a",marko:"123afae7d187ba36d6ddcd97dbf4acc59aeffe243f782592ff8f25ed579df306",essguess:"0b13870379cf18ae6b6d516d9f0833e0273c7a6758652a698e11f04c9c1a0d29",pr:"dd9b989dfe5e0840a92538f3e9f84f674e5f17ab05932efbacb4d8e6c905f302",marija:"b8a518a60fab9f3969b62238860f4643003b6437b75d60860dd8de34fb21c931",moysie:"2a55ed52ed31f85f8bdef3bdd165aa74265d82c952193d7b76fb4c76cccc4231",nikola:"97b988fbf4f8880493f925711e1bd806617b508fd3d28312288507e42f8a3368",princfilip:"29c07b40860f06df7c1ada6af2cc6b4c541b76a720542d7ee645c20c9452ffd2",highlights:"9a500dccc084a138330a1d1b2be0d5e86394624325d25084d3eca164e7ea698a",primal:"532d830dffe09c13e75e8b145c825718fc12b0003f61d61e9077721c7fff93cb",andi:"5fd8c6a375c431729a3b78e2080ffff0a1dc63f52e2a868a801151190a31f955",rockstar:"91c9a5e1a9744114c6fe2d61ae4de82629eaaa0fb52f48288093c7e7e036f832",qa:"88cc134b1a65f54ef48acc1df3665063d3ea45f04eab8af4646e561c5ae99079",jack:"82341f882b6eabcd2ba7f1ef90aad961cf074af15b9ef44a09f9d2a8fbfbe6a2"}},A9=[];var G=(t=>(t[t.Metadata=0]="Metadata",t[t.Text=1]="Text",t[t.RecommendRelay=2]="RecommendRelay",t[t.Contacts=3]="Contacts",t[t.EncryptedDirectMessage=4]="EncryptedDirectMessage",t[t.EventDeletion=5]="EventDeletion",t[t.Repost=6]="Repost",t[t.Reaction=7]="Reaction",t[t.Image=20]="Image",t[t.ChannelCreation=40]="ChannelCreation",t[t.ChannelMetadata=41]="ChannelMetadata",t[t.ChannelMessage=42]="ChannelMessage",t[t.ChannelHideMessage=43]="ChannelHideMessage",t[t.ChannelMuteUser=44]="ChannelMuteUser",t[t.UserPoll=1068]="UserPoll",t[t.UserPollVote=1018]="UserPollVote",t[t.ZapPoll=6969]="ZapPoll",t[t.Comment=1111]="Comment",t[t.LiveChatMessage=1311]="LiveChatMessage",t[t.ReportContent=1984]="ReportContent",t[t.Subscribe=7001]="Subscribe",t[t.Unsubscribe=7002]="Unsubscribe",t[t.Highlight=9802]="Highlight",t[t.Zap=9735]="Zap",t[t.MuteList=1e4]="MuteList",t[t.RelayList=10002]="RelayList",t[t.Bookmarks=10003]="Bookmarks",t[t.Blossom=10063]="Blossom",t[t.TierList=17e3]="TierList",t[t.StreamMuteList=10555]="StreamMuteList",t[t.WalletInfo=13194]="WalletInfo",t[t.WalletRequest=23194]="WalletRequest",t[t.WalletResponse=23195]="WalletResponse",t[t.CategorizedPeople=3e4]="CategorizedPeople",t[t.LongForm=30023]="LongForm",t[t.Settings=30078]="Settings",t[t.LiveEvent=30311]="LiveEvent",t[t.Draft=31234]="Draft",t[t.DVM=31990]="DVM",t[t.Tier=37001]="Tier",t[t.ACK=10000098]="ACK",t[t.NoteStats=10000100]="NoteStats",t[t.NetStats=10000101]="NetStats",t[t.LegendStats=10000102]="LegendStats",t[t.UserStats=10000105]="UserStats",t[t.OldestEvent=10000106]="OldestEvent",t[t.Mentions=10000107]="Mentions",t[t.UserScore=10000108]="UserScore",t[t.Notification=10000110]="Notification",t[t.Timestamp=10000111]="Timestamp",t[t.NotificationStats=10000112]="NotificationStats",t[t.FeedRange=10000113]="FeedRange",t[t.NoteActions=10000115]="NoteActions",t[t.Me
3ssageStats=10000117]="MessageStats",t[t.MesagePerSenderStats=10000118]="MesagePerSenderStats",t[t.MediaInfo=10000119]="MediaInfo",t[t.Upload=10000120]="Upload",t[t.Uploaded=10000121]="Uploaded",t[t.Releases=10000124]="Releases",t[t.ImportResponse=10000127]="ImportResponse",t[t.LinkMetadata=10000128]="LinkMetadata",t[t.EventZapInfo=10000129]="EventZapInfo",t[t.FilteringReason=10000131]="FilteringReason",t[t.UserFollowerCounts=10000133]="UserFollowerCounts",t[t.SuggestedUsersByCategory=10000134]="SuggestedUsersByCategory",t[t.UploadChunk=10000135]="UploadChunk",t[t.UserRelays=10000139]="UserRelays",t[t.RelayHint=10000141]="RelayHint",t[t.NoteQuoteStats=10000143]="NoteQuoteStats",t[t.WordCount=10000144]="WordCount",t[t.FeaturedAuthors=10000148]="FeaturedAuthors",t[t.DVMFollowsActions=10000156]="DVMFollowsActions",t[t.UserFollowerIncrease=10000157]="UserFollowerIncrease",t[t.VerifiedUsersDict=10000158]="VerifiedUsersDict",t[t.DVMMetadata=10000159]="DVMMetadata",t[t.NoteTopicStat=10000160]="NoteTopicStat",t[t.MediaStats=10000163]="MediaStats",t[t.MediaList=10000164]="MediaList",t[t.ContentStats=10000166]="ContentStats",t[t.BroadcastStatus=10000167]="BroadcastStatus",t[t.LegendCustomization=10000168]="LegendCustomization",t[t.MembershipCohortInfo=10000169]="MembershipCohortInfo",t[t.LegendLeaderboard=10000170]="LegendLeaderboard",t[t.PremiumLeaderboard=10000171]="PremiumLeaderboard",t[t.ArticlesStats=10000174]="ArticlesStats",t[t.LiveEventStats=10000176]="LiveEventStats",t[t.PollResults=10000179]="PollResults",t[t.WALLET_OPERATION=10000300]="WALLET_OPERATION",t[t.WALLET_NWC_ACTIVE=10000802]="WALLET_NWC_ACTIVE",t[t.WALLET_NWC_CONNECTION=10000803]="WALLET_NWC_CONNECTION",t[t.ExchangeRate=10000305]="ExchangeRate",t[t.OrderHistory=10000605]="OrderHistory",t[t.LongFormShell=10030023]="LongFormShell",t[t.LiveChatReload=11000001]="LiveChatReload",t[t.HLSVideo=10000178]="HLSVideo",t))(G||{}),un=(t=>(t[t.NEW_USER_FOLLOWED_YOU=1]="NEW_USER_FOLLOWED_YOU",t[t.USER_UNFOLLOWED_YOU=2]="USER_UNFOLLOWED_YOU",t[t.YOUR_POST_WAS_ZAPPED=3]="YOUR_POST_WAS_ZAPPED",t[t.YOUR_POST_WAS_LIKED=4]="YOUR_POST_WAS_LIKED",t[t.YOUR_POST_WAS_REPOSTED=5]="YOUR_POST_WAS_REPOSTED",t[t.YOUR_POST_WAS_REPLIED_TO=6]="YOUR_POST_WAS_REPLIED_TO",t[t.YOU_WERE_MENTIONED_IN_POST=7]="YOU_WERE_MENTIONED_IN_POST",t[t.YOUR_POST_WAS_MENTIONED_IN_POST=8]="YOUR_POST_WAS_MENTIONED_IN_POST",t[t.POST_YOU_WERE_MENTIONED_IN_WAS_ZAPPED=101]="POST_YOU_WERE_MENTIONED_IN_WAS_ZAPPED",t[t.POST_YOU_WERE_MENTIONED_IN_WAS_LIKED=102]="POST_YOU_WERE_MENTIONED_IN_WAS_LIKED",t[t.POST_YOU_WERE_MENTIONED_IN_WAS_REPOSTED=103]="POST_YOU_WERE_MENTIONED_IN_WAS_REPOSTED",t[t.POST_YOU_WERE_MENTIONED_IN_WAS_REPLIED_TO=104]="POST_YOU_WERE_MENTIONED_IN_WAS_REPLIED_TO",t[t.POST_YOUR_POST_WAS_MENTIONED_IN_WAS_ZAPPED=201]="POST_YOUR_POST_WAS_MENTIONED_IN_WAS_ZAPPED",t[t.POST_YOUR_POST_WAS_MENTIONED_IN_WAS_LIKED=202]="POST_YOUR_POST_WAS_MENTIONED_IN_WAS_LIKED",t[t.POST_YOUR_POST_WAS_MENTIONED_IN_WAS_REPOSTED=203]="POST_YOUR_POST_WAS_MENTIONED_IN_WAS_REPOSTED",t[t.POST_YOUR_POST_WAS_MENTIONED_IN_WAS_REPLIED_TO=204]="POST_YOUR_POST_WAS_MENTIONED_IN_WAS_REPLIED_TO",t[t.YOUR_POST_WAS_HIGHLIGHTED=301]="YOUR_POST_WAS_HIGHLIGHTED",t[t.YOUR_POST_WAS_BOOKMARKED=302]="YOUR_POST_WAS_BOOKMARKED",t[t.YOUR_POST_HAD_REACTION=303]="YOUR_POST_HAD_REACTION",t[t.LIVE_EVENT_HAPPENING=501]="LIVE_EVENT_HAPPENING",t[t.REPLY_TO_REPLY=601]="REPLY_TO_REPLY",t))(un||{});const K0e=[101,102,103,104,201,202,203,501],q0e={1:"follower",2:"follower",3:"who_zapped_it",4:"who_liked_it",5:"who_reposted_it",6:"who_replied_to_it",601:"who_replied_to_it",7:"you_were_mentioned_by",8:"your_post_was_mentioned_by",101:"who_zapped_it",102:"who_liked_it",103:"who_reposted_it",104:"who_replied_to_it",201:"who_zapped_it",202:"who_liked_it",203:"who_reposted_it",204:"who_replied_to_it",301:"who_highlighted_it",302:"who_bookmarked_it",303:"who_reacted",501:"host"},j0e={3:"your_post",4:"your_post",5:"your_post",6:"reply",601:"reply",7:"you_were_mentioned_in",8:"your_post_were_mentioned_in",101:"post_you_were_mentioned_in",102:"post_you_were_mentioned_in",103:"post_you_were_mentioned_in",104:"reply",201:"your_post_were_mentioned_in",202:"your_post_were_mentioned_in",203:"your_post_were_mentioned_in",204:"reply",301:"your_post",302:"your_post",303:"your_post",501:"live_event_id"},Y0e=/^[a-zA-Z0-9\-\_]+$/,x9=/zap\.stream\/.+/i,I9=/open\.spotify\.com\/(track|album|playlist|episode)\/([a-zA-Z0-9]+)/,L9=
3/twitch\.tv\/([a-z0-9_]+$)/i,R9=/player\.twitch\.tv\/([a-z0-9_]+$)/i,e_=/mixcloud\.com\/(?!live)([a-zA-Z0-9]+)\/([a-zA-Z0-9-]+)/,k9=/soundcloud\.com\/(?!live)([a-zA-Z0-9]+)\/([a-zA-Z0-9-]+)/,M9=/music\.apple\.com\/([a-z]{2}\/)?(?:album|playlist)\/[\w\d-]+\/([.a-zA-Z0-9-]+)(?:\?i=\d+)?/i,C9=/https?:\/\/(?:player\.|www\.)?wavlake\.com\/(?!top|new|artists|account|activity|login|preferences|feed|profile)(?:(?:track|album)\/[a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12}|[a-z-]+)/i,P9=/(?:https?:\/\/)?(?:www\.)?rumble\.com\/embed\/([a-zA-Z0-9-]+)/i,eO=/(?:https?:\/\/)?(?:www|m\.)?(?:youtu\.be\/|youtube\.com\/(?:live\/|shorts\/|embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})/,D9=/https?:\/\/(www\.)?[-a-zA-Z0-9\u00F0-\u02AF@:%._\+~#=]{1,256}\.[a-zA-Z0-9\u00F0-\u02AF()]{1,8}\b([-a-zA-Z0-9\u00F0-\u02AF()@:%_\+.~#?&//=]*)/i,O9=/https?:\/\/(www\.)?[-a-zA-Z0-9\u00F0-\u02AF@:%._\+~#=]{1,256}\.[a-zA-Z0-9\u00F0-\u02AF()]{1,8}\b([-a-zA-Z0-9\u00F0-\u02AF()@:%_\+.~#?&//=]*)/ig,Z0e=/https?:\/\/\S+\.[^()]+(?:\([^)]*\))*/,N9=/^(\.|,|;|\?|\!)$/,F9=/(?:\s|^)\:\w+\:/,U9=/lnbc[a-zA-Z0-9]*/,B9=/bitcoin:[a-zA-Z0-9]*(\?.*)lightning=([a-zA-Z0-9]*)(&.*|$)/,$9=/(?:\s|^)#(?![0-9]+(?:\s|$))([a-zA-Z0-9]+)/i,Q0e=/(\r\n|\r|\n)/ig,H9=/\#\[([0-9]*)\]/,J0e=/((note|nevent)1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]+)\b/g,G9=/((note|nevent)1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]+)\b/,V9=/((npub|nprofile)1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]+)\b/,X0e=/((nostr:)?(npub|nprofile)1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]+)\b/g,eve=/((nostr:)?(npub|nprofile)1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]+)\b/,tve=/(?:\s|^)((nostr:)?(npub|nprofile)1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]+)\b/g,W9=/((naddr)1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]+)\b/,nve=/((naddr)1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]+)\b/g,ive=/(?:\s|^|\()@\`(.*?)\`/ig,sve=/(http(s?):)([/|.|\w|\s|-])*\.(?:png|jpg|jpeg|webp|gif|format=png)/g,rve=/(http(s?):)([/|.|\w|\s|-])*\.(?:png|jpg|jpeg|webp|gif|mp4|mov|ogg|webm|3gp|format=png)/g,ove=/(http(s?):)([/|.|\w|\s|-])*\.(?:png|jpg|jpeg|webp|gif|mp4|mov|ogg|webm|3gp|format=png)/,ave=/(?:\s|^)(nostr:)?((note|nevent|naddr)1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]+)\b/,lve=/(?:\s|^)(nostr:)?((note|nevent|naddr)1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]+)\b/g,cve=/((note|nevent|naddr)1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]+)\b/,z9=/((note|nevent|naddr|nprofile|npub)1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]+)\b/,dve=/(https?:\/\/.*\.(?:png|jpg|jpeg|webp|gif|format=png))|\!\[(.*?)\]\((https?:\/\/.*)\)/i,uve=/[^A-Za-z0-9]/,fve=/[^A-Za-z0-9\-\_]/,hve=/[0-9]+:[A-Za-z0-9]+:[A-Za-z0-9]+/,pve=200,gve=200,mve=238,vve=99,t_={NEW_USER_FOLLOWED_YOU:!0,USER_UNFOLLOWED_YOU:!0,YOUR_POST_WAS_ZAPPED:!0,YOUR_POST_WAS_LIKED:!0,YOUR_POST_WAS_REPOSTED:!0,YOUR_POST_WAS_REPLIED_TO:!0,YOU_WERE_MENTIONED_IN_POST:!0,YOUR_POST_WAS_MENTIONED_IN_POST:!0,POST_YOU_WERE_MENTIONED_IN_WAS_ZAPPED:!0,POST_YOU_WERE_MENTIONED_IN_WAS_LIKED:!0,POST_YOU_WERE_MENTIONED_IN_WAS_REPOSTED:!0,POST_YOU_WERE_MENTIONED_IN_WAS_REPLIED_TO:!0,POST_YOUR_POST_WAS_MENTIONED_IN_WAS_ZAPPED:!0,POST_YOUR_POST_WAS_MENTIONED_IN_WAS_LIKED:!0,POST_YOUR_POST_WAS_MENTIONED_IN_WAS_REPOSTED:!0,POST_YOUR_POST_WAS_MENTIONED_IN_WAS_REPLIED_TO:!0,LIVE_EVENT_HAPPENING:!0},n_={ignore_events_with_too_many_mentions:!0},yve=0;new Date().getTime();const tO=new Date("12/19/2023").getTime(),nO="1.1.10",bve="https://apps.apple.com/us/app/primal/id1673134518",iO=new Date("02/02/2024").getTime(),sO="0.91.2",Eve="https://play.google.com/store/apps/details?id=net.primal.android",rO={amount:42,message:"Onward 🫡"},oO=[{emoji:"👍",amount:21,message:"Great post 👍"},{emoji:"🚀",amount:420,message:"Let's go 🚀"},{emoji:"☕",amount:1e3,message:"Coffee on me ☕"},{emoji:"🍻",amount:5e3,message:"Cheers 🍻"},{emoji:"🍷",amount:1e4,message:"Party time 🍷"},{emoji:"👑",amount:1e5,message:"Generational wealth 👑"}],aO="content",kT="trending",K9={name:"primal_spam",scopes:[aO,kT]},q9={name:"primal_nsfw",scopes:[kT]},lO=[K9,q9],_ve="npub1tkpg9lyfgy83c4mgrgkrhzl90t732ekzvt73m6658xva88g5rj6qy6ntw4",wve=["primal_spam","primal_nsfw"],Sve=50,zf="prpec",cO="?iv=",Tve={regular:100,premium:1024,premiumLegend:10*1024},Ave={paymentRequest:"",sections:[],expiry:0,route_hints:[]},j9=["a","e"],dO=7*24*60*60*1e3,tm="https://blossom.primal.net",Zt="Primal-Web App",Qe={resetDirectMessages:"reset_direct_message_count",markAllAsRead:"mark_all_dms_as_read",nofiticationsLastSeen:"notifications_laste_seen",changePremiumName:"change_premium_name",getMembershipStatus:"get_membership_status",getPremiumQRCode:"membership_purchase_premium",getLegendQRCode:"membership_purchase_legend",getPremiumStatus:"membership_status",getPremiumMediaStats:"membership_media_management_stats",getPremiumMediaList:"membership_media_management_uploads",deletePremiumMedia:"membership_media_management_delete",getContactListHistory:"membership_recovery_contact_lists",getContentDownloadData:"membership_content_backup",getContentListHistory:"membership_content_stats",startContentBroadcast:"membership_content_rebroadcast_start",cancelContentBroadcast:"membership_content_rebroadcast_cancel",startListeningForContentBroadcastStaus:"rebroadcasting_status",getOrderListHistory:"membership_purchase_history",setLegendCustumization:"membership_legend_customization",initStripe:"membership_purchase_product",resolveStripe:"membership_stripe_checkout_session_check_status",report
3User:"report_user",sendSettings:"set_app_settings",getSettings:"get_app_settings",getHomeSettings:"get_app_subsettings_home",setHomeSettings:"set_app_subsettings_home",getReadsSettings:"get_app_subsettings_reads",setReadsSettings:"set_app_subsettings_reads",getNWCSettings:"get_app_subsettings_nwc",setNWCSettings:"set_app_subsettings_nwc"},Y9="Primal Remote Wallet";/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function MT(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}a(MT,"isBytes$5");function Oa(t,e=""){if(!Number.isSafeInteger(t)||t<0){const n=e&&`"${e}" `;throw new Error(`${n}expected integer >= 0, got ${t}`)}}a(Oa,"anumber$5");function an(t,e,n=""){const i=MT(t),s=t?.length,r=e!==void 0;if(!i||r&&s!==e){const o=n&&`"${n}" `,l=r?` of length ${e}`:"",d=i?`length=${s}`:`type=${typeof t}`;throw new Error(o+"expected Uint8Array"+l+", got "+d)}return t}a(an,"abytes$3");function ey(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash must wrapped by utils.createHasher");Oa(t.outputLen),Oa(t.blockLen)}a(ey,"ahash$1");function t0(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}a(t0,"aexists$1");function Z9(t,e){an(t,void 0,"digestInto() output");const n=e.outputLen;if(t.length<n)throw new Error('"digestInto() output" expected to be of length >='+n)}a(Z9,"aoutput$1");function Kf(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}a(Kf,"clean$2");function fb(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}a(fb,"createView$1");function tr(t,e){return t<<32-e|t>>>e}a(tr,"rotr$1");const uO=(()=>typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function")(),Q9=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function qt(t){if(an(t),uO)return t.toHex();let e="";for(let n=0;n<t.length;n++)e+=Q9[t[n]];return e}a(qt,"bytesToHex$2");const zr={_0:48,_9:57,A:65,F:70,a:97,f:102};function GR(t){if(t>=zr._0&&t<=zr._9)return t-zr._0;if(t>=zr.A&&t<=zr.F)return t-(zr.A-10);if(t>=zr.a&&t<=zr.f)return t-(zr.a-10)}a(GR,"asciiToBase16$2");function rn(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);if(uO)return Uint8Array.fromHex(t);const e=t.length,n=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const i=new Uint8Array(n);for(let s=0,r=0;s<n;s++,r+=2){const o=GR(t.charCodeAt(r)),l=GR(t.charCodeAt(r+1));if(o===void 0||l===void 0){const d=t[r]+t[r+1];throw new Error('hex string expected, got non-hex character "'+d+'" at index '+r)}i[s]=o*16+l}return i}a(rn,"hexToBytes$3");function pi(...t){let e=0;for(let i=0;i<t.length;i++){const s=t[i];an(s),e+=s.length}const n=new Uint8Array(e);for(let i=0,s=0;i<t.length;i++){const r=t[i];n.set(r,s),s+=r.length}return n}a(pi,"concatBytes$1");function J9(t,e={}){const n=a((s,r)=>t(r).update(s).digest(),"hashC"),i=t(void 0);return n.outputLen=i.outputLen,n.blockLen=i.blockLen,n.create=s=>t(s),Object.assign(n,e),Object.freeze(n)}a(J9,"createHasher$1");function ec(t=32){const e=typeof globalThis=="object"?globalThis.crypto:null;if(typeof e?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");return e.getRandomValues(new Uint8Array(t))}a(ec,"randomBytes$1");const X9=a(t=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,t])}),"oidNist");function eG(t,e,n){return t&e^~t&n}a(eG,"Chi$1");function tG(t,e,n){return t&e^t&n^e&n}a(tG,"Maj$1");var Wh;let nG=(Wh=class{blockLen;outputLen;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,n,i,s){this.blockLen=e,this.outputLen=n,this.padOffset=i,this.isLE=s,this.buffer=new Uint8Array(e),this.view=fb(this.buffer)}update(e){t0(this),an(e);const{view:n,buffer:i,blockLen:s}=this,r=e.length;for(let o=0;o<r;){const l=Math.min(s-this.pos,r-o);if(l===s){const d=fb(e);for(;s<=r-o;o+=s)this.process(d,o);continue}i.set(e.subarray(o,o+l),this.pos),this.pos+=l,o+=l,this.pos===s&&(this.process(n,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){t0(this),Z9(e,this),this.finished=!0;const{buffer:n,view:i,blockLen:s,isLE:r}=this;let{pos:o}=this;n[o++]=128,Kf(this.buffer.subarray(o)),this.padOffset>s-o&&(this.process(i,0),o=0);for(let f=o;f<s;f++)n[f]=0;i.setBigUint64(s-8,BigInt(this.length*8),r),this.process(i,0);const l=fb(e),d=this.outputLen;if(d%4)throw new Error("_sha2: outputLen must be aligned to 32bit");const c=d/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<c;f++)l.setUint32(4*f,u[f],r)}
3digest(){const{buffer:e,outputLen:n}=this;this.digestInto(e);const i=e.slice(0,n);return this.destroy(),i}_cloneInto(e){e||=new this.constructor,e.set(...this.get());const{blockLen:n,buffer:i,length:s,finished:r,destroyed:o,pos:l}=this;return e.destroyed=o,e.finished=r,e.length=s,e.pos=l,s%n&&e.buffer.set(i),e}clone(){return this._cloneInto()}},a(Wh,"HashMD"),Wh);const Co=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),iG=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Po=new Uint32Array(64),KA=class KA extends nG{constructor(e){super(64,e,8,!1)}get(){const{A:e,B:n,C:i,D:s,E:r,F:o,G:l,H:d}=this;return[e,n,i,s,r,o,l,d]}set(e,n,i,s,r,o,l,d){this.A=e|0,this.B=n|0,this.C=i|0,this.D=s|0,this.E=r|0,this.F=o|0,this.G=l|0,this.H=d|0}process(e,n){for(let f=0;f<16;f++,n+=4)Po[f]=e.getUint32(n,!1);for(let f=16;f<64;f++){const h=Po[f-15],p=Po[f-2],g=tr(h,7)^tr(h,18)^h>>>3,v=tr(p,17)^tr(p,19)^p>>>10;Po[f]=v+Po[f-7]+g+Po[f-16]|0}let{A:i,B:s,C:r,D:o,E:l,F:d,G:c,H:u}=this;for(let f=0;f<64;f++){const h=tr(l,6)^tr(l,11)^tr(l,25),p=u+h+eG(l,d,c)+iG[f]+Po[f]|0,v=(tr(i,2)^tr(i,13)^tr(i,22))+tG(i,s,r)|0;u=c,c=d,d=l,l=o+p|0,o=r,r=s,s=i,i=p+v|0}i=i+this.A|0,s=s+this.B|0,r=r+this.C|0,o=o+this.D|0,l=l+this.E|0,d=d+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(i,s,r,o,l,d,c,u)}roundClean(){Kf(Po)}destroy(){this.set(0,0,0,0,0,0,0,0),Kf(this.buffer)}};a(KA,"SHA2_32B");let i_=KA;const qA=class qA extends i_{A=Co[0]|0;B=Co[1]|0;C=Co[2]|0;D=Co[3]|0;E=Co[4]|0;F=Co[5]|0;G=Co[6]|0;H=Co[7]|0;constructor(){super(32)}};a(qA,"_SHA256");let s_=qA;const ns=J9(()=>new s_,X9(1));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const CT=BigInt(0),r_=BigInt(1);function n0(t,e=""){if(typeof t!="boolean"){const n=e&&`"${e}" `;throw new Error(n+"expected boolean, got type="+typeof t)}return t}a(n0,"abool$1");function fO(t){if(typeof t=="bigint"){if(!nm(t))throw new Error("positive bigint expected, got "+t)}else Oa(t);return t}a(fO,"abignumber");function ig(t){const e=fO(t).toString(16);return e.length&1?"0"+e:e}a(ig,"numberToHexUnpadded$1");function hO(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return t===""?CT:BigInt("0x"+t)}a(hO,"hexToNumber$3");function kp(t){return hO(qt(t))}a(kp,"bytesToNumberBE$1");function pO(t){return hO(qt(sG(an(t)).reverse()))}a(pO,"bytesToNumberLE$1");function PT(t,e){Oa(e),t=fO(t);const n=rn(t.toString(16).padStart(e*2,"0"));if(n.length!==e)throw new Error("number too large");return n}a(PT,"numberToBytesBE$1");function gO(t,e){return PT(t,e).reverse()}a(gO,"numberToBytesLE$1");function sG(t){return Uint8Array.from(t)}a(sG,"copyBytes$1");function rG(t){return Uint8Array.from(t,(e,n)=>{const i=e.charCodeAt(0);if(e.length!==1||i>127)throw new Error(`string contains non-ASCII character "${t[n]}" with code ${i} at position ${n}`);return i})}a(rG,"asciiToBytes");const nm=a(t=>typeof t=="bigint"&&CT<=t,"isPosBig$1");function oG(t,e,n){return nm(t)&&nm(e)&&nm(n)&&e<=t&&t<n}a(oG,"inRange$1");function aG(t,e,n,i){if(!oG(e,n,i))throw new Error("expected valid "+t+": "+n+" <= n < "+i+", got "+e)}a(aG,"aInRange$1");function lG(t){let e;for(e=0;t>CT;t>>=r_,e+=1);return e}a(lG,"bitLen$1");const DT=a(t=>(r_<<BigInt(t))-r_,"bitMask$1");function cG(t,e,n){if(Oa(t,"hashLen"),Oa(e,"qByteLen"),typeof n!="function")throw new Error("hmacFn must be a function");const i=a(y=>new Uint8Array(y),"u8n"),s=Uint8Array.of(),r=Uint8Array.of(0),o=Uint8Array.of(1),l=1e3;let d=i(t),c=i(t),u=0;const f=a(()=>{d.fill(1),c.fill(0),u=0},"reset"),h=a((...y)=>n(c,pi(d,...y)),"h"),p=a((y=s)=>{c=h(r,y),d=h(),y.length!==0&&(c=h(o,y),d=h())},"reseed"),g=a(()=>
3{if(u++>=l)throw new Error("drbg: tried max amount of iterations");let y=0;const b=[];for(;y<e;){d=h();const E=d.slice();b.push(E),y+=d.length}return pi(...b)},"gen");return a((y,b)=>{f(),p(y);let E;for(;!(E=b(g()));)p();return f(),E},"genUntil")}a(cG,"createHmacDrbg$1");function OT(t,e={},n={}){if(!t||typeof t!="object")throw new Error("expected valid options object");function i(r,o,l){const d=t[r];if(l&&d===void 0)return;const c=typeof d;if(c!==o||d===null)throw new Error(`param "${r}" is invalid: expected ${o}, got ${c}`)}a(i,"checkField");const s=a((r,o)=>Object.entries(r).forEach(([l,d])=>i(l,d,o)),"iter");s(e,!1),s(n,!0)}a(OT,"validateObject");function VR(t){const e=new WeakMap;return(n,...i)=>{const s=e.get(n);if(s!==void 0)return s;const r=t(n,...i);return e.set(n,r),r}}a(VR,"memoized$1");/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const es=BigInt(0),Fi=BigInt(1),pl=BigInt(2),mO=BigInt(3),vO=BigInt(4),yO=BigInt(5),dG=BigInt(7),bO=BigInt(8),uG=BigInt(9),EO=BigInt(16);function Hs(t,e){const n=t%e;return n>=es?n:e+n}a(Hs,"mod$1");function bs(t,e,n){let i=t;for(;e-- >es;)i*=i,i%=n;return i}a(bs,"pow2$1");function WR(t,e){if(t===es)throw new Error("invert: expected non-zero number");if(e<=es)throw new Error("invert: expected positive modulus, got "+e);let n=Hs(t,e),i=e,s=es,r=Fi;for(;n!==es;){const l=i/n,d=i%n,c=s-r*l;i=n,n=d,s=r,r=c}if(i!==Fi)throw new Error("invert: does not exist");return Hs(s,e)}a(WR,"invert$1");function NT(t,e,n){if(!t.eql(t.sqr(e),n))throw new Error("Cannot find square root")}a(NT,"assertIsSquare$1");function _O(t,e){const n=(t.ORDER+Fi)/vO,i=t.pow(e,n);return NT(t,i,e),i}a(_O,"sqrt3mod4$1");function fG(t,e){const n=(t.ORDER-yO)/bO,i=t.mul(e,pl),s=t.pow(i,n),r=t.mul(e,s),o=t.mul(t.mul(r,pl),s),l=t.mul(r,t.sub(o,t.ONE));return NT(t,l,e),l}a(fG,"sqrt5mod8$1");function hG(t){const e=ty(t),n=wO(t),i=n(e,e.neg(e.ONE)),s=n(e,i),r=n(e,e.neg(i)),o=(t+dG)/EO;return(l,d)=>{let c=l.pow(d,o),u=l.mul(c,i);const f=l.mul(c,s),h=l.mul(c,r),p=l.eql(l.sqr(u),d),g=l.eql(l.sqr(f),d);c=l.cmov(c,u,p),u=l.cmov(h,f,g);const v=l.eql(l.sqr(u),d),y=l.cmov(c,u,v);return NT(l,y,d),y}}a(hG,"sqrt9mod16$1");function wO(t){if(t<mO)throw new Error("sqrt is not defined for small field");let e=t-Fi,n=0;for(;e%pl===es;)e/=pl,n++;let i=pl;const s=ty(t);for(;zR(s,i)===1;)if(i++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return _O;let r=s.pow(i,e);const o=(e+Fi)/pl;return a(function(d,c){if(d.is0(c))return c;if(zR(d,c)!==1)throw new Error("Cannot find square root");let u=n,f=d.mul(d.ONE,r),h=d.pow(c,e),p=d.pow(c,o);for(;!d.eql(h,d.ONE);){if(d.is0(h))return d.ZERO;let g=1,v=d.sqr(h);for(;!d.eql(v,d.ONE);)if(g++,v=d.sqr(v),g===u)throw new Error("Cannot find square root");const y=Fi<<BigInt(u-g-1),b=d.pow(f,y);u=g,f=d.sqr(b),h=d.mul(h,f),p=d.mul(p,b)}return p},"tonelliSlow")}a(wO,"tonelliShanks$1");function pG(t){return t%vO===mO?_O:t%bO===yO?fG:t%EO===uG?hG(t):wO(t)}a(pG,"FpSqrt$1");const gG=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function mG(t){const e={ORDER:"bigint",BYTES:"number",BITS:"number"},n=gG.reduce((i,s)=>(i[s]="function",i),e);return OT(t,n),t}a(mG,"validateField$1");function vG(t,e,n){if(n<es)throw new Error("invalid exponent, negatives unsupported");if(n===es)return t.ONE;if(n===Fi)return e;let i=t.ONE,s=e;for(;n>es;)n&Fi&&(i=t.mul(i,s)),s=t.sqr(s),n>>=Fi;return i}a(vG,"FpPow$1");function SO(t,e,n=!1){const i=new Array(e.length).fill(n?t.ZERO:void 0),s=e.reduce((o,l,d)=>t.is0(l)?o:(i[d]=o,t.mul(o,l)),t.ONE),r=t.inv(s);return e.reduceRight((o,l,d)=>t.is0(l)?o:(i[d]=t.mul(o,i[d]),t.mul(o,l)),r),i}a(SO,"FpInvertBatch$1");function zR(t,e){const n=(t.ORDER-Fi)/pl,i=t.pow(e,n),s=t.eql(i,t.ONE),r=t.eql(i,t.ZERO),o=t.eql(i,t.neg(t.ONE));if(!s&&!r&&!o)throw new Error("invalid Legendre symbol result");return s?1:r?0:-1}a(zR,"FpLegendre$1");function yG(t,e){e!==void 0&&Oa(e);const n=e!==void 0?e:t.toString(2).length,i=Math.ceil(n/8);return{nBitLength:n,nByteLength:i}}a(yG,"nLength$1");const jA=class jA{ORDER;BITS;BYTES;isLE;ZERO=es;ONE=Fi;_lengths;_sqrt;_mod;constructor(e,n={}){if(e<=es)throw new Error("invalid field: expected ORDER > 0, got "+e);let i;this.isLE=!1,n!=null&&typeof n=="object"&&(typeof n.BITS=="number"&&(i=n.BITS),typeof n.sqrt=="function"&&(this.sqrt=n.sqrt),typeof n.isLE=="boolean"&&(this.isLE=n.isLE),n.allowedLengths&&(this._lengths=n.allowedLengths?.slice()),typeof n.modFromBytes=="boolean"&&(this._mod=n.modFromBytes)
3);const{nBitLength:s,nByteLength:r}=yG(e,i);if(r>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=e,this.BITS=s,this.BYTES=r,this._sqrt=void 0,Object.preventExtensions(this)}create(e){return Hs(e,this.ORDER)}isValid(e){if(typeof e!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof e);return es<=e&&e<this.ORDER}is0(e){return e===es}isValidNot0(e){return!this.is0(e)&&this.isValid(e)}isOdd(e){return(e&Fi)===Fi}neg(e){return Hs(-e,this.ORDER)}eql(e,n){return e===n}sqr(e){return Hs(e*e,this.ORDER)}add(e,n){return Hs(e+n,this.ORDER)}sub(e,n){return Hs(e-n,this.ORDER)}mul(e,n){return Hs(e*n,this.ORDER)}pow(e,n){return vG(this,e,n)}div(e,n){return Hs(e*WR(n,this.ORDER),this.ORDER)}sqrN(e){return e*e}addN(e,n){return e+n}subN(e,n){return e-n}mulN(e,n){return e*n}inv(e){return WR(e,this.ORDER)}sqrt(e){return this._sqrt||(this._sqrt=pG(this.ORDER)),this._sqrt(this,e)}toBytes(e){return this.isLE?gO(e,this.BYTES):PT(e,this.BYTES)}fromBytes(e,n=!1){an(e);const{_lengths:i,BYTES:s,isLE:r,ORDER:o,_mod:l}=this;if(i){if(!i.includes(e.length)||e.length>s)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+e.length);const c=new Uint8Array(s);c.set(e,r?0:c.length-e.length),e=c}if(e.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+e.length);let d=r?pO(e):kp(e);if(l&&(d=Hs(d,o)),!n&&!this.isValid(d))throw new Error("invalid field element: outside of range 0..ORDER");return d}invertBatch(e){return SO(this,e)}cmov(e,n,i){return i?n:e}};a(jA,"_Field");let o_=jA;function ty(t,e={}){return new o_(t,e)}a(ty,"Field$1");function TO(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}a(TO,"getFieldBytesLength$1");function AO(t){const e=TO(t);return e+Math.ceil(e/2)}a(AO,"getMinHashLength$1");function xO(t,e,n=!1){an(t);const i=t.length,s=TO(e),r=AO(e);if(i<16||i<r||i>1024)throw new Error("expected "+r+"-1024 bytes of input, got "+i);const o=n?pO(t):kp(t),l=Hs(o,e-Fi)+Fi;return n?gO(l,s):PT(l,s)}a(xO,"mapHashToField$1");/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Pd=BigInt(0),gl=BigInt(1);function i0(t,e){const n=e.negate();return t?n:e}a(i0,"negateCt$1");function KR(t,e){const n=SO(t.Fp,e.map(i=>i.Z));return e.map((i,s)=>t.fromAffine(i.toAffine(n[s])))}a(KR,"normalizeZ$1");function IO(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}a(IO,"validateW$1");function hb(t,e){IO(t,e);const n=Math.ceil(e/t)+1,i=2**(t-1),s=2**t,r=DT(t),o=BigInt(t);return{windows:n,windowSize:i,mask:r,maxNumber:s,shiftBy:o}}a(hb,"calcWOpts$1");function qR(t,e,n){const{windowSize:i,mask:s,maxNumber:r,shiftBy:o}=n;let l=Number(t&s),d=t>>o;l>i&&(l-=r,d+=gl);const c=e*i,u=c+Math.abs(l)-1,f=l===0,h=l<0,p=e%2!==0;return{nextN:d,offset:u,isZero:f,isNeg:h,isNegF:p,offsetF:c}}a(qR,"calcOffsets$1");const pb=new WeakMap,LO=new WeakMap;function gb(t){return LO.get(t)||1}a(gb,"getW$1");function jR(t){if(t!==Pd)throw new Error("invalid wNAF")}a(jR,"assert0$1");var zh;let bG=(zh=class{BASE;ZERO;Fn;bits;constructor(e,n){this.BASE=e.BASE,this.ZERO=e.ZERO,this.Fn=e.Fn,this.bits=n}_unsafeLadder(e,n,i=this.ZERO){let s=e;for(;n>Pd;)n&gl&&(i=i.add(s)),s=s.double(),n>>=gl;return i}precomputeWindow(e,n){const{windows:i,windowSize:s}=hb(n,this.bits),r=[];let o=e,l=o;for(let d=0;d<i;d++){l=o,r.push(l);for(let c=1;c<s;c++)l=l.add(o),r.push(l);o=l.double()}return r}wNAF(e,n,i){if(!this.Fn.isValid(i))throw new Error("invalid scalar");let s=this.ZERO,r=this.BASE;const o=hb(e,this.bits);for(let l=0;l<o.windows;l++){const{nextN:d,offset:c,isZero:u,isNeg:f,isNegF:h,offsetF:p}=qR(i,l,o);i=d,u?r=r.add(i0(h,n[p])):s=s.add(i0(f,n[c]))}return jR(i),{p:s,f:r}}wNAFUnsafe(e,n,i,s=this.ZERO){const r=hb(e,this.bits);for(let o=0;o<r.windows&&i!==Pd;o++){const{nextN:l,offset:d,isZero:c,isNeg:u}=qR(i,o,r);if(i=l,!c){const f=n[d];s=s.add(u?f.negate():f)}}return jR(i),s}getPrecomputes(e,n,i){let s=pb.get(n);return s||(s=this.precomputeWindow(n,e),e!==1&&(typeof i=="function"&&(s=i(s)),pb.set(n,s))),s}cached(e,n,i){const s=gb(e);
3return this.wNAF(s,this.getPrecomputes(s,e,i),n)}unsafe(e,n,i,s){const r=gb(e);return r===1?this._unsafeLadder(e,n,s):this.wNAFUnsafe(r,this.getPrecomputes(r,e,i),n,s)}createCache(e,n){IO(n,this.bits),LO.set(e,n),pb.delete(e)}hasCache(e){return gb(e)!==1}},a(zh,"wNAF"),zh);function EG(t,e,n,i){let s=e,r=t.ZERO,o=t.ZERO;for(;n>Pd||i>Pd;)n&gl&&(r=r.add(s)),i&gl&&(o=o.add(s)),s=s.double(),n>>=gl,i>>=gl;return{p1:r,p2:o}}a(EG,"mulEndoUnsafe$1");function YR(t,e,n){if(e){if(e.ORDER!==t)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return mG(e),e}else return ty(t,{isLE:n})}a(YR,"createField$1");function _G(t,e,n={},i){if(i===void 0&&(i=t==="edwards"),!e||typeof e!="object")throw new Error(`expected valid ${t} CURVE object`);for(const d of["p","n","h"]){const c=e[d];if(!(typeof c=="bigint"&&c>Pd))throw new Error(`CURVE.${d} must be positive bigint`)}const s=YR(e.p,n.Fp,i),r=YR(e.n,n.Fn,i),l=["Gx","Gy","a",t==="weierstrass"?"b":"d"];for(const d of l)if(!s.isValid(e[d]))throw new Error(`CURVE.${d} must be valid field element of CURVE.Fp`);return e=Object.freeze(Object.assign({},e)),{CURVE:e,Fp:s,Fn:r}}a(_G,"createCurveFields");function RO(t,e){return a(function(i){const s=t(i);return{secretKey:s,publicKey:e(s)}},"keygen")}a(RO,"createKeygen");const YA=class YA{oHash;iHash;blockLen;outputLen;finished=!1;destroyed=!1;constructor(e,n){if(ey(e),an(n,void 0,"key"),this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(n.length>i?e.create().update(n).digest():n);for(let r=0;r<s.length;r++)s[r]^=54;this.iHash.update(s),this.oHash=e.create();for(let r=0;r<s.length;r++)s[r]^=106;this.oHash.update(s),Kf(s)}update(e){return t0(this),this.iHash.update(e),this}digestInto(e){t0(this),an(e,this.outputLen,"output"),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||=Object.create(Object.getPrototypeOf(this),{});const{oHash:n,iHash:i,finished:s,destroyed:r,blockLen:o,outputLen:l}=this;return e=e,e.finished=s,e.destroyed=r,e.blockLen=o,e.outputLen=l,e.oHash=n._cloneInto(e.oHash),e.iHash=i._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};a(YA,"_HMAC");let s0=YA;const ru=a((t,e,n)=>new s0(t,e).update(n).digest(),"hmac$1");ru.create=(t,e)=>new s0(t,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ZR=a((t,e)=>(t+(t>=0?e:-e)/kO)/e,"divNearest$1");function wG(t,e,n){const[[i,s],[r,o]]=e,l=ZR(o*t,n),d=ZR(-s*t,n);let c=t-l*i-d*r,u=-l*s-d*o;const f=c<uo,h=u<uo;f&&(c=-c),h&&(u=-u);const p=DT(Math.ceil(lG(n)/2))+dd;if(c<uo||c>=p||u<uo||u>=p)throw new Error("splitScalar (endomorphism): failed, k="+t);return{k1neg:f,k1:c,k2neg:h,k2:u}}a(wG,"_splitEndoScalar$1");function a_(t){if(!["compact","recovered","der"].includes(t))throw new Error('Signature format must be "compact", "recovered", or "der"');return t}a(a_,"validateSigFormat$1");function mb(t,e){const n={};for(let i of Object.keys(e))n[i]=t[i]===void 0?e[i]:t[i];return n0(n.lowS,"lowS"),n0(n.prehash,"prehash"),n.format!==void 0&&a_(n.format),n}a(mb,"validateSigOpts$1");var Kh;let SG=(Kh=class extends Error{constructor(e=""){super(e)}},a(Kh,"DERErr"),Kh);const Zo={Err:SG,_tlv:{encode:(t,e)=>{const{Err:n}=Zo;if(t<0||t>256)throw new n("tlv.encode: wrong tag");if(e.length&1)throw new n("tlv.encode: unpadded data");const i=e.length/2,s=ig(i);if(s.length/2&128)throw new n("tlv.encode: long form length too big");const r=i>127?ig(s.length/2|128):"";return ig(t)+r+s+e},decode(t,e){const{Err:n}=Zo;let i=0;if(t<0||t>256)throw new n("tlv.encode: wrong tag");if(e.length<2||e[i++]!==t)throw new n("tlv.decode: wrong tlv");const s=e[i++],r=!!(s&128);let o=0;if(!r)o=s;else{const d=s&127;if(!d)throw new n("tlv.decode(long): indefinite length not supported");if(d>4)throw new n("tlv.decode(long): byte length is too big");const c=e.subarray(i,i+d);
vendor: 4,100 bytes, line 3
3if(c.length!==d)throw new n("tlv.decode: length bytes not complete");if(c[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const u of c)o=o<<8|u;if(i+=d,o<128)throw new n("tlv.decode(long): not minimal encoding")}const l=e.subarray(i,i+o);if(l.length!==o)throw new n("tlv.decode: wrong value length");return{v:l,l:e.subarray(i+o)}}},_int:{encode(t){const{Err:e}=Zo;if(t<uo)throw new e("integer: negative integers are not allowed");let n=ig(t);if(Number.parseInt(n[0],16)&8&&(n="00"+n),n.length&1)throw new e("unexpected DER parsing assertion: unpadded hex");return n},decode(t){const{Err:e}=Zo;if(t[0]&128)throw new e("invalid signature integer: negative");if(t[0]===0&&!(t[1]&128))throw new e("invalid signature integer: unnecessary leading zero");return kp(t)}},toSig(t){const{Err:e,_int:n,_tlv:i}=Zo,s=an(t,void 0,"signature"),{v:r,l:o}=i.decode(48,s);if(o.length)throw new e("invalid signature: left bytes after parsing");const{v:l,l:d}=i.decode(2,r),{v:c,l:u}=i.decode(2,d);if(u.length)throw new e("invalid signature: left bytes after parsing");return{r:n.decode(l),s:n.decode(c)}},hexFromSig(t){const{_tlv:e,_int:n}=Zo,i=e.encode(2,n.encode(t.r)),s=e.encode(2,n.encode(t.s)),r=i+s;return e.encode(48,r)}},uo=BigInt(0),dd=BigInt(1),kO=BigInt(2),sg=BigInt(3),TG=BigInt(4);function AG(t,e={}){const n=_G("weierstrass",t,e),{Fp:i,Fn:s}=n;let r=n.CURVE;const{h:o,n:l}=r;OT(e,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});const{endo:d}=e;if(d&&(!i.is0(r.a)||typeof d.beta!="bigint"||!Array.isArray(d.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const c=CO(i,s);function u(){if(!i.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}a(u,"assertCompressionIsSupported");function f(S,_,A){const{x,y:C}=_.toAffine(),U=i.toBytes(x);if(n0(A,"isCompressed"),A){u();const R=!i.isOdd(C);return pi(MO(R),U)}else return pi(Uint8Array.of(4),U,i.toBytes(C))}a(f,"pointToBytes");function h(S){an(S,void 0,"Point");const{publicKey:_,publicKeyUncompressed:A}=c,x=S.length,C=S[0],U=S.subarray(1);if(x===_&&(C===2||C===3)){const R=i.fromBytes(U);if(!i.isValid(R))throw new Error("bad point: is not on curve, wrong x");const w=v(R);let P;try{P=i.sqrt(w)}catch(ee){const ne=ee instanceof Error?": "+ee.message:"";throw new Error("bad point: is not on curve, sqrt error"+ne)}u();const V=i.isOdd(P);return(C&1)===1!==V&&(P=i.neg(P)),{x:R,y:P}}else if(x===A&&C===4){const R=i.BYTES,w=i.fromBytes(U.subarray(0,R)),P=i.fromBytes(U.subarray(R,R*2));if(!y(w,P))throw new Error("bad point: is not on curve");return{x:w,y:P}}else throw new Error(`bad point: got length ${x}, expected compressed=${_} or uncompressed=${A}`)}a(h,"pointFromBytes");const p=e.toBytes||f,g=e.fromBytes||h;function v(S){const _=i.sqr(S),A=i.mul(_,S);return i.add(i.add(A,i.mul(S,r.a)),r.b)}a(v,"weierstrassEquation");function y(S,_){const A=i.sqr(_),x=v(S);return i.eql(A,x)}if(a(y,"isValidXY"),!y(r.Gx,r.Gy))throw new Error("bad curve params: generator point");const b=i.mul(i.pow(r.a,sg),TG),E=i.mul(i.sqr(r.b),BigInt(27));if(i.is0(i.add(b,E)))throw new Error("bad curve params: a or b");function T(S,_,A=!1){if(!i.isValid(_)||A&&i.is0(_))throw new Error(`bad point coordinate ${S}`);return _}a(T,"acoord");function I(S){if(!(S instanceof F))throw new Error("Weierstrass Point expected")}a(I,"aprjpoint");function M(S){if(!d||!d.basises)throw new Error("no endo");return wG(S,d.basises,s.ORDER)}a(M,"splitEndoScalarN");const H=VR((S,_)=>{const{X:A,Y:x,Z:C}=S;if(i.eql(C,i.ONE))return{x:A,y:x};const U=S.is0();_==null&&(_=U?i.ONE:i.inv(C));const R=i.mul(A,_),w=i.mul(x,_),P=i.mul(C,_);if(U)return{x:i.ZERO,y:i.ZERO};if(!i.eql(P,i.ONE))throw new Error("invZ was invalid");return{x:R,y:w}}),N=VR(S=>{if(S.is0()){if(e.allowInfinityPoint&&!i.is0(S.Y))return;throw new Error("bad point: ZERO")}const{x:_,y:A}=S.toAffine();if(!i.isValid(_)||!i.isValid(A))throw new Error("bad point: x or y not field elements");if(!y(_,A))throw new Error("bad point: equation left != right");
3if(!S.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function $(S,_,A,x,C){return A=new F(i.mul(A.X,S),A.Y,A.Z),_=i0(x,_),A=i0(C,A),_.add(A)}a($,"finishEndo");const m=class m{X;Y;Z;constructor(_,A,x){this.X=T("x",_),this.Y=T("y",A,!0),this.Z=T("z",x),Object.freeze(this)}static CURVE(){return r}static fromAffine(_){const{x:A,y:x}=_||{};if(!_||!i.isValid(A)||!i.isValid(x))throw new Error("invalid affine point");if(_ instanceof m)throw new Error("projective point not allowed");return i.is0(A)&&i.is0(x)?m.ZERO:new m(A,x,i.ONE)}static fromBytes(_){const A=m.fromAffine(g(an(_,void 0,"point")));return A.assertValidity(),A}static fromHex(_){return m.fromBytes(rn(_))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(_=8,A=!0){return L.createCache(this,_),A||this.multiply(sg),this}assertValidity(){N(this)}hasEvenY(){const{y:_}=this.toAffine();if(!i.isOdd)throw new Error("Field doesn't support isOdd");return!i.isOdd(_)}equals(_){I(_);const{X:A,Y:x,Z:C}=this,{X:U,Y:R,Z:w}=_,P=i.eql(i.mul(A,w),i.mul(U,C)),V=i.eql(i.mul(x,w),i.mul(R,C));return P&&V}negate(){return new m(this.X,i.neg(this.Y),this.Z)}double(){const{a:_,b:A}=r,x=i.mul(A,sg),{X:C,Y:U,Z:R}=this;let w=i.ZERO,P=i.ZERO,V=i.ZERO,Z=i.mul(C,C),ee=i.mul(U,U),ne=i.mul(R,R),se=i.mul(C,U);return se=i.add(se,se),V=i.mul(C,R),V=i.add(V,V),w=i.mul(_,V),P=i.mul(x,ne),P=i.add(w,P),w=i.sub(ee,P),P=i.add(ee,P),P=i.mul(w,P),w=i.mul(se,w),V=i.mul(x,V),ne=i.mul(_,ne),se=i.sub(Z,ne),se=i.mul(_,se),se=i.add(se,V),V=i.add(Z,Z),Z=i.add(V,Z),Z=i.add(Z,ne),Z=i.mul(Z,se),P=i.add(P,Z),ne=i.mul(U,R),ne=i.add(ne,ne),Z=i.mul(ne,se),w=i.sub(w,Z),V=i.mul(ne,ee),V=i.add(V,V),V=i.add(V,V),new m(w,P,V)}add(_){I(_);const{X:A,Y:x,Z:C}=this,{X:U,Y:R,Z:w}=_;let P=i.ZERO,V=i.ZERO,Z=i.ZERO;const ee=r.a,ne=i.mul(r.b,sg);let se=i.mul(A,U),ge=i.mul(x,R),ie=i.mul(C,w),j=i.add(A,x),Y=i.add(U,R);j=i.mul(j,Y),Y=i.add(se,ge),j=i.sub(j,Y),Y=i.add(A,C);let le=i.add(U,w);return Y=i.mul(Y,le),le=i.add(se,ie),Y=i.sub(Y,le),le=i.add(x,C),P=i.add(R,w),le=i.mul(le,P),P=i.add(ge,ie),le=i.sub(le,P),Z=i.mul(ee,Y),P=i.mul(ne,ie),Z=i.add(P,Z),P=i.sub(ge,Z),Z=i.add(ge,Z),V=i.mul(P,Z),ge=i.add(se,se),ge=i.add(ge,se),ie=i.mul(ee,ie),Y=i.mul(ne,Y),ge=i.add(ge,ie),ie=i.sub(se,ie),ie=i.mul(ee,ie),Y=i.add(Y,ie),se=i.mul(ge,Y),V=i.add(V,se),se=i.mul(le,Y),P=i.mul(j,P),P=i.sub(P,se),se=i.mul(j,ge),Z=i.mul(le,Z),Z=i.add(Z,se),new m(P,V,Z)}subtract(_){return this.add(_.negate())}is0(){return this.equals(m.ZERO)}multiply(_){const{endo:A}=e;if(!s.isValidNot0(_))throw new Error("invalid scalar: out of range");let x,C;const U=a(R=>L.cached(this,R,w=>KR(m,w)),"mul");if(A){const{k1neg:R,k1:w,k2neg:P,k2:V}=M(_),{p:Z,f:ee}=U(w),{p:ne,f:se}=U(V);C=ee.add(se),x=$(A.beta,Z,ne,R,P)}else{const{p:R,f:w}=U(_);x=R,C=w}return KR(m,[x,C])[0]}multiplyUnsafe(_){const{endo:A}=e,x=this;if(!s.isValid(_))throw new Error("invalid scalar: out of range");if(_===uo||x.is0())return m.ZERO;if(_===dd)return x;if(L.hasCache(this))return this.multiply(_);if(A){const{k1neg:C,k1:U,k2neg:R,k2:w}=M(_),{p1:P,p2:V}=EG(m,x,U,w);return $(A.beta,P,V,C,R)}else return L.unsafe(x,_)}toAffine(_){return H(this,_)}isTorsionFree(){const{isTorsionFree:_}=e;return o===dd?!0:_?_(m,this):L.unsafe(this,l).is0()}clearCofactor(){const{clearCofactor:_}=e;return o===dd?this:_?_(m,this):this.multiplyUnsafe(o)}isSmallOrder(){return this.multiplyUnsafe(o).is0()}toBytes(_=!0){return n0(_,"isCompressed"),this.assertValidity(),p(m,this,_)}toHex(_=!0){return qt(this.toBytes(_))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}};a(m,"Point"),vt(m,"BASE",new m(r.Gx,r.Gy,i.ONE)),vt(m,"ZERO",new m(i.ZERO,i.ONE,i.ZERO)),vt(m,"Fp",i),vt(m,"Fn",s);let F=m;const D=s.BITS,L=new bG(F,e.endo?Math.ceil(D/2):D);return F.BASE.precompute(8),F}a(AG,"weierstrass$1");function MO(t){return Uint8Array.of(t?2:3)}a(MO,"pprefix$1");function CO(t,e){return{secretKey:e.BYTES,publicKey:1+t.BYTES,publicKeyUncompressed:1+2*t.BYTES,publicKeyHasPrefix:!0,signature:2*e.BYTES}}a(CO,"getWLengths$1");function xG(t,e={}){const{Fn:n}=t,i=e.randomBytes||ec,s=Object.assign(CO(t.Fp,n),{seed:AO(n.ORDER)});function r(p){try{const g=n.fromBytes(p);return n.isValidNot0(g)}catch{return!1}}a(r,"isValidSecretKey");function o(p,g){const{publicKey:v,publicKeyUncompressed:y}=s;try{const b=p.length;return g===!0&&b!==v||g===!1&&b!==y?!1:!!t.fromBytes(p)}catch{return!1}}a(o,"isValidPublicKey");function l(p=i(s.seed)){return xO(an(p,s.seed,"seed"),n.ORDER)}a(l,"randomSecretKey");function d(p,g=!0){return t.BASE.multiply(n.fromBytes(p)).toBytes(g)}a(d,"getPublicKey");function c(p){const{secretKey:g,publicKey:v,publicKeyUncompressed:y}=s;if(!MT(p)||"_lengths"in n&&n._lengths||g===v)return;const b=an(p,void 0,"key").length;return b===v||b===y}a(c,"isProbPub");function u(p,g,v=!0){if(c(p)===!0)throw new Error("first arg must be private key");if(c(g)===!1)throw new Error("second arg must be public key");const y=n.fromBytes(p);return t.fromBytes(g).multiply(y).toBytes(v)}a(u,"getSharedSecret");const f={isValidSecretKey:r,isValidPublicKey:o,randomSecretKey:l},h=RO(l,d);return Object.freeze({getPublicKey:d,getSharedSecret:u,keygen:h,Point:t,utils:f,lengths:s})}a(xG,"ecdh$1");function IG(t,e,n={}){ey(e),OT(n,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"}),n=Object.assign({},n);const i=n.randomBytes||ec,s=n.hmac||((A,x)=>ru(e,A,x)),{Fp:r,Fn:o}=t,{ORDER:l,BITS:d}=o,{keygen:c,getPublicKey:u,getSharedSecret:f,utils:h,lengths:p}=xG(t,n),g={prehash:!0,lowS:typeof n.lowS=="boolean"?n.lowS:!0,format:"compact",extraEntropy:!1},v=l*kO<r.ORDER;function y(A){const x=l>>dd;return A>x}
3a(y,"isBiggerThanHalfOrder");function b(A,x){if(!o.isValidNot0(x))throw new Error(`invalid signature ${A}: out of range 1..Point.Fn.ORDER`);return x}a(b,"validateRS");function E(){if(v)throw new Error('"recovered" sig type is not supported for cofactor >2 curves')}a(E,"assertSmallCofactor");function T(A,x){a_(x);const C=p.signature,U=x==="compact"?C:x==="recovered"?C+1:void 0;return an(A,U)}a(T,"validateSigLength");const _=class _{r;s;recovery;constructor(x,C,U){if(this.r=b("r",x),this.s=b("s",C),U!=null){if(E(),![0,1,2,3].includes(U))throw new Error("invalid recovery id");this.recovery=U}Object.freeze(this)}static fromBytes(x,C=g.format){T(x,C);let U;if(C==="der"){const{r:V,s:Z}=Zo.toSig(an(x));return new _(V,Z)}C==="recovered"&&(U=x[0],C="compact",x=x.subarray(1));const R=p.signature/2,w=x.subarray(0,R),P=x.subarray(R,R*2);return new _(o.fromBytes(w),o.fromBytes(P),U)}static fromHex(x,C){return this.fromBytes(rn(x),C)}assertRecovery(){const{recovery:x}=this;if(x==null)throw new Error("invalid recovery id: must be present");return x}addRecoveryBit(x){return new _(this.r,this.s,x)}recoverPublicKey(x){const{r:C,s:U}=this,R=this.assertRecovery(),w=R===2||R===3?C+l:C;if(!r.isValid(w))throw new Error("invalid recovery id: sig.r+curve.n != R.x");const P=r.toBytes(w),V=t.fromBytes(pi(MO((R&1)===0),P)),Z=o.inv(w),ee=H(an(x,void 0,"msgHash")),ne=o.create(-ee*Z),se=o.create(U*Z),ge=t.BASE.multiplyUnsafe(ne).add(V.multiplyUnsafe(se));if(ge.is0())throw new Error("invalid recovery: point at infinify");return ge.assertValidity(),ge}hasHighS(){return y(this.s)}toBytes(x=g.format){if(a_(x),x==="der")return rn(Zo.hexFromSig(this));const{r:C,s:U}=this,R=o.toBytes(C),w=o.toBytes(U);return x==="recovered"?(E(),pi(Uint8Array.of(this.assertRecovery()),R,w)):pi(R,w)}toHex(x){return qt(this.toBytes(x))}};a(_,"Signature");let I=_;const M=n.bits2int||a(function(x){if(x.length>8192)throw new Error("input is too large");const C=kp(x),U=x.length*8-d;return U>0?C>>BigInt(U):C},"bits2int_def"),H=n.bits2int_modN||a(function(x){return o.create(M(x))},"bits2int_modN_def"),N=DT(d);function $(A){return aG("num < 2^"+d,A,uo,N),o.toBytes(A)}a($,"int2octets");function F(A,x){return an(A,void 0,"message"),x?an(e(A),void 0,"prehashed message"):A}a(F,"validateMsgAndHash");function D(A,x,C){const{lowS:U,prehash:R,extraEntropy:w}=mb(C,g);A=F(A,R);const P=H(A),V=o.fromBytes(x);if(!o.isValidNot0(V))throw new Error("invalid private key");const Z=[$(V),$(P)];if(w!=null&&w!==!1){const ge=w===!0?i(p.secretKey):w;Z.push(an(ge,void 0,"extraEntropy"))}const ee=pi(...Z),ne=P;function se(ge){const ie=M(ge);if(!o.isValidNot0(ie))return;const j=o.inv(ie),Y=t.BASE.multiply(ie).toAffine(),le=o.create(Y.x);if(le===uo)return;const pe=o.create(j*o.create(ne+le*V));if(pe===uo)return;let Te=(Y.x===le?0:2)|Number(Y.y&dd),Le=pe;return U&&y(pe)&&(Le=o.neg(pe),Te^=1),new I(le,Le,v?void 0:Te)}return a(se,"k2sig"),{seed:ee,k2sig:se}}a(D,"prepSig");function L(A,x,C={}){const{seed:U,k2sig:R}=D(A,x,C);return cG(e.outputLen,o.BYTES,s)(U,R).toBytes(C.format)}a(L,"sign");function m(A,x,C,U={}){const{lowS:R,prehash:w,format:P}=mb(U,g);if(C=an(C,void 0,"publicKey"),x=F(x,w),!MT(A)){const V=A instanceof I?", use sig.toBytes()":"";throw new Error("verify expects Uint8Array signature"+V)}T(A,P);try{const V=I.fromBytes(A,P),Z=t.fromBytes(C);if(R&&V.hasHighS())return!1;const{r:ee,s:ne}=V,se=H(x),ge=o.inv(ne),ie=o.create(se*ge),j=o.create(ee*ge),Y=t.BASE.multiplyUnsafe(ie).add(Z.multiplyUnsafe(j));return Y.is0()?!1:o.create(Y.x)===ee}catch{return!1}}a(m,"verify");function S(A,x,C={}){const{prehash:U}=mb(C,g);return x=F(x,U),I.fromBytes(A,"recovered").recoverPublicKey(x).toBytes()}return a(S,"recoverPublicKey"),Object.freeze({keygen:c,getPublicKey:u,getSharedSecret:f,utils:h,lengths:p,Point:t,sign:L,verify:m,recoverPublicKey:S,Signature:I,hash:e})}a(IG,"ecdsa$1");/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ny={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},LG={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},RG=BigInt(0),l_=BigInt(2);function kG(t){const e=ny.p,n=BigInt(3),i=BigInt(6),s=BigInt(11),r=BigInt(22),o=BigInt(23),l=BigInt(44),d=BigInt(88),c=t*t*t%e,u=c*c*t%e,f=bs(u,n,e)*u%e,h=bs(f,n,e)*u%e,p=bs(h,l_,e)*c%e,g=bs(p,s,e)*p%e,v=bs(g,r,e)*g%e,y=bs(v,l,e)*v%e,b=bs(y,d,e)*y%e,E=bs(b,l,e)*v%e,T=bs(E,n,e)*u%e,I=bs(T,o,e)*g%e,M=bs(I,i,e)*c%e,H=bs(M,l_,e);if(!r0.eql(r0.sqr(H),t))throw new Error("Cannot find square root");return H}a(kG,"sqrtMod$1");const r0=ty(ny.p,{sqrt:kG}),tc=AG(ny,{Fp:r0,endo:LG}),iy=IG(tc,ns),QR={};function o0(t,...e){let n=QR[t];if(n===void 0){const i=ns(rG(t));n=pi(i,i),QR[t]=n}return ns(pi(n,...e))}a(o0,"taggedHash$1");const FT=a(t=>t.toBytes(!0).slice(1),"pointToBytes$1"),UT=a(t=>t%l_===RG,"hasEven$1");function c_(t){const{Fn:e,BASE:n}=tc,i=e.fromBytes(t),s=n.multiply(i);return{scalar:UT(s.y)?i:e.neg(i),bytes:FT(s)}}a(c_,"schnorrGetExtPubKey$1");function PO(t){const e=r0;if(!e.isValidNot0(t))throw new Error("invalid x: Fail if x ≥ p");const n=e.create(t*t),i=e.create(n*t+BigInt(7));let s=e.sqrt(i);UT(s)||(s=e.neg(s));const r=tc.fromAffine({x:t,y:s});return r.assertValidity(),r}a(PO,"lift_x$1");const yf=kp;function DO(...t){return tc.Fn.create(yf(o0("BIP0340/challenge",...t)))}a(DO,"challenge$1");function JR(t){return c_(t).bytes}a(JR,"schnorrGetPublicKey$1");function MG(t,e,n=ec(32)){const{Fn:i}=tc,s=an(t,void 0,"message"),{bytes:r,scalar:o}=c_(e),l=an(n,32,"auxRand"),d=i.toBytes(o^yf(o0("BIP0340/aux",l))),c=o0("BIP0340/nonce",d,r,s),{bytes:u,scalar:f}=c_(c),h=DO(u,r,s),p=new Uint8Array(64);if(p.set(u,0),p.set(i.toBytes(i.create(f+h*o)),32),!OO(p,s,r))throw new Error("sign: Invalid signature produced");return p}a(MG,"schnorrSign$1");function OO(t,e,n){const{Fp:i,Fn:s,BASE:r}=tc,o=an(t,64,"signature"),l=an(e,void 0,"message"),d=an(n,32,"publicKey");try{const c=PO(yf(d)),u=yf(o.subarray(0,32));if(!i.isValidNot0(u))return!1;const f=yf(o.subarray(32,64));if(!s.isValidNot0(f))return!1;const h=DO(s.toBytes(u),FT(c),l),p=r.multiplyUnsafe(f).add(c.multiplyUnsafe(s.neg(h))),{x:g,y:v}=p.toAffine();return!(p.is0()||!UT(v)||g!==u)}catch{return!1}}a(OO,"schnorrVerify$1");const Tr=(()=>{const n=a((i=ec(48))=>xO(i,ny.n),"randomSecretKey");return{keygen:RO(n,JR),getPublicKey:JR,sign:MG,verify:OO,Point:tc,utils:{randomSecretKey:n,taggedHash:o0,lift_x:PO,pointToBytes:FT},lengths:{secretKey:32,publicKey:32,publicKeyHasPrefix:!1,signature:32*2,seed:48}}})();/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function BT(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}a(BT,"isBytes$4");function CG(t){if(!BT(t))throw new Error("Uint8Array expected")}a(CG,"abytes$2");function NO(t,e){return Array.isArray(e)?e.length===0?!0:t?e.every(n=>typeof n=="string"):e.every(n=>Number.isSafeInteger(n)):!1}a(NO,"isArrayOf$2");function PG(t){if(typeof t!="function")throw new Error("function expected");return!0}a(PG,"afn$2");function Hl(t,e){if(typeof e!="string")throw new Error(`${t}: string expected`);return!0}a(Hl,"astr$2");function $T(t){if(!Number.isSafeInteger(t))throw new Error(`invalid integer: ${t}`)}a($T,"anumber$4");function d_(t){if(!Array.isArray(t))throw new Error("array expected")}a(d_,"aArr$2");function a0(t,e){if(!NO(!0,e))throw new Error(`${t}
3: array of strings expected`)}a(a0,"astrArr$2");function FO(t,e){if(!NO(!1,e))throw new Error(`${t}: array of numbers expected`)}a(FO,"anumArr$2");function UO(...t){const e=a(r=>r,"id"),n=a((r,o)=>l=>r(o(l)),"wrap"),i=t.map(r=>r.encode).reduceRight(n,e),s=t.map(r=>r.decode).reduce(n,e);return{encode:i,decode:s}}a(UO,"chain$4");function BO(t){const e=typeof t=="string"?t.split(""):t,n=e.length;a0("alphabet",e);const i=new Map(e.map((s,r)=>[s,r]));return{encode:s=>(d_(s),s.map(r=>{if(!Number.isSafeInteger(r)||r<0||r>=n)throw new Error(`alphabet.encode: digit index outside alphabet "${r}". Allowed: ${t}`);return e[r]})),decode:s=>(d_(s),s.map(r=>{Hl("alphabet.decode",r);const o=i.get(r);if(o===void 0)throw new Error(`Unknown letter: "${r}". Allowed: ${t}`);return o}))}}a(BO,"alphabet$3");function $O(t=""){return Hl("join",t),{encode:e=>(a0("join.decode",e),e.join(t)),decode:e=>(Hl("join.decode",e),e.split(t))}}a($O,"join$3");function DG(t,e="="){return $T(t),Hl("padding",e),{encode(n){for(a0("padding.encode",n);n.length*t%8;)n.push(e);return n},decode(n){a0("padding.decode",n);let i=n.length;if(i*t%8)throw new Error("padding: invalid, string should have whole number of bytes");for(;i>0&&n[i-1]===e;i--)if((i-1)*t%8===0)throw new Error("padding: invalid, string has too much padding");return n.slice(0,i)}}}a(DG,"padding$2");const HO=a((t,e)=>e===0?t:HO(e,t%e),"gcd$2"),l0=a((t,e)=>t+(e-HO(t,e)),"radix2carry$2"),im=(()=>{let t=[];for(let e=0;e<40;e++)t.push(2**e);return t})();function u_(t,e,n,i){if(d_(t),e<=0||e>32)throw new Error(`convertRadix2: wrong from=${e}`);if(n<=0||n>32)throw new Error(`convertRadix2: wrong to=${n}`);if(l0(e,n)>32)throw new Error(`convertRadix2: carry overflow from=${e} to=${n} carryBits=${l0(e,n)}`);let s=0,r=0;const o=im[e],l=im[n]-1,d=[];for(const c of t){if($T(c),c>=o)throw new Error(`convertRadix2: invalid data word=${c} from=${e}`);if(s=s<<e|c,r+e>32)throw new Error(`convertRadix2: carry overflow pos=${r} from=${e}`);for(r+=e;r>=n;r-=n)d.push((s>>r-n&l)>>>0);const u=im[r];if(u===void 0)throw new Error("invalid carry");s&=u-1}if(s=s<<n-r&l,!i&&r>=e)throw new Error("Excess padding");if(!i&&s>0)throw new Error(`Non-zero padding: ${s}`);return i&&r>0&&d.push(s>>>0),d}a(u_,"convertRadix2$2");function GO(t,e=!1){if($T(t),t<=0||t>32)throw new Error("radix2: bits should be in (0..32]");if(l0(8,t)>32||l0(t,8)>32)throw new Error("radix2: carry overflow");return{encode:n=>{if(!BT(n))throw new Error("radix2.encode input should be Uint8Array");return u_(Array.from(n),8,t,!e)},decode:n=>(FO("radix2.decode",n),Uint8Array.from(u_(n,t,8,e)))}}a(GO,"radix2$2");function XR(t){return PG(t),function(...e){try{return t.apply(null,e)}catch{}}}a(XR,"unsafeWrapper$1");const OG=(()=>typeof Uint8Array.from([]).toBase64=="function"&&typeof Uint8Array.fromBase64=="function")(),NG=a((t,e)=>{Hl("base64",t);const n=e?/^[A-Za-z0-9=_-]+$/:/^[A-Za-z0-9=+/]+$/,i=e?"base64url":"base64";if(t.length>0&&!n.test(t))throw new Error("invalid base64");return Uint8Array.fromBase64(t,{alphabet:i,lastChunkHandling:"strict"})},"decodeBase64Builtin"),Fr=OG?{encode(t){return CG(t),t.toBase64()},decode(t){return NG(t,!1)}}:UO(GO(6),BO("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),DG(6),$O("")),f_=UO(BO("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),$O("")),ek=[996825010,642813549,513874426,1027748829,705979059];function Mu(t){const e=t>>25;let n=(t&33554431)<<5;for(let i=0;i<ek.length;i++)(e>>i&1)===1&&(n^=ek[i]);return n}a(Mu,"bech32Polymod$1");function tk(t,e,n=1){const i=t.length;let s=1;for(let r=0;r<i;r++){const o=t.charCodeAt(r);if(o<33||o>126)throw new Error(`Invalid prefix (${t})`);s=Mu(s)^o>>5}s=Mu(s);for(let r=0;r<i;r++)s=Mu(s)^t.charCodeAt(r)&31;for(let r of e)s=Mu(s)^r;for(let r=0;r<6;r++)s=Mu(s);return s^=n,f_.encode(u_([s%im[30]],30,5,!1))}a(tk,"bechChecksum$1");function FG(t){const e=t==="bech32"?1:734539939,n=GO(5),i=n.decode,s=n.encode,r=XR(i);function o(f,h,p=90){Hl("bech32.encode prefix",f),BT(h)&&(h=Array.from(h)),FO("bech32.encode",h);const g=f.length;if(g===0)throw new TypeError(`Invalid prefix length ${g}`);const v=g+7+h.length;if(p!==!1&&v>p)throw new TypeError(`Length ${v} exceeds limit ${p}`);const y=f.toLowerCase(),b=tk(y,h,e);return`${y}1${f_.encode(h)}${b}`}a(o,"encode");
3function l(f,h=90){Hl("bech32.decode input",f);const p=f.length;if(p<8||h!==!1&&p>h)throw new TypeError(`invalid string length: ${p} (${f}). Expected (8..${h})`);const g=f.toLowerCase();if(f!==g&&f!==f.toUpperCase())throw new Error("String must be lowercase or uppercase");const v=g.lastIndexOf("1");if(v===0||v===-1)throw new Error('Letter "1" must be present between prefix and data only');const y=g.slice(0,v),b=g.slice(v+1);if(b.length<6)throw new Error("Data must be at least 6 characters long");const E=f_.decode(b).slice(0,-6),T=tk(y,E,e);if(!b.endsWith(T))throw new Error(`Invalid checksum in ${f}: expected "${T}"`);return{prefix:y,words:E}}a(l,"decode");const d=XR(l);function c(f){const{prefix:h,words:p}=l(f,!1);return{prefix:h,words:p,bytes:i(p)}}a(c,"decodeToBytes");function u(f,h){return o(f,s(h))}return a(u,"encodeFromBytes"),{encode:o,decode:l,encodeFromBytes:u,decodeToBytes:c,decodeUnsafe:d,fromWords:i,fromWordsUnsafe:r,toWords:s}}a(FG,"genBech32$1");const Dd=FG("bech32");/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */function UG(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}a(UG,"isBytes$3");function nk(t){if(typeof t!="boolean")throw new Error(`boolean expected, not ${t}`)}a(nk,"abool");function vb(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}a(vb,"anumber$3");function Yi(t,e,n=""){const i=UG(t),s=t?.length,r=e!==void 0;if(!i||r&&s!==e){const o=n&&`"${n}" `,l=r?` of length ${e}`:"",d=i?`length=${s}`:`type=${typeof t}`;throw new Error(o+"expected Uint8Array"+l+", got "+d)}return t}a(Yi,"abytes$1");function Ti(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}a(Ti,"u32");function Od(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}a(Od,"clean$1");const BG=(()=>new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68)();function $G(t,e){return t.buffer===e.buffer&&t.byteOffset<e.byteOffset+e.byteLength&&e.byteOffset<t.byteOffset+t.byteLength}a($G,"overlapBytes");function VO(t,e){if($G(t,e)&&t.byteOffset<e.byteOffset)throw new Error("complex overlap of input and output is not supported")}a(VO,"complexOverlapBytes");function HG(t,e){if(e==null||typeof e!="object")throw new Error("options must be defined");return Object.assign(t,e)}a(HG,"checkOpts$1");function WO(t,e){if(t.length!==e.length)return!1;let n=0;for(let i=0;i<t.length;i++)n|=t[i]^e[i];return n===0}a(WO,"equalBytes");const GG=a((t,e)=>{function n(i,...s){if(Yi(i,void 0,"key"),!BG)throw new Error("Non little-endian hardware is not yet supported");if(t.nonceLength!==void 0){const u=s[0];Yi(u,t.varSizeNonce?void 0:t.nonceLength,"nonce")}const r=t.tagLength;r&&s[1]!==void 0&&Yi(s[1],void 0,"AAD");const o=e(i,...s),l=a((u,f)=>{if(f!==void 0){if(u!==2)throw new Error("cipher output not supported");Yi(f,void 0,"output")}},"checkOutput");let d=!1;return{encrypt(u,f){if(d)throw new Error("cannot encrypt() twice with same key + nonce");return d=!0,Yi(u),l(o.encrypt.length,f),o.encrypt(u,f)},decrypt(u,f){if(Yi(u),r&&u.length<r)throw new Error('"ciphertext" expected length bigger than tagLength='+r);return l(o.decrypt.length,f),o.decrypt(u,f)}}}return a(n,"wrappedCipher"),Object.assign(n,t),n},"wrapCipher");function zO(t,e,n=!0){if(e===void 0)return new Uint8Array(t);if(e.length!==t)throw new Error('"output" expected Uint8Array of length '+t+", got: "+e.length);if(n&&!ud(e))throw new Error("invalid output, must be aligned");return e}a(zO,"getOutput");function ud(t){return t.byteOffset%4===0}a(ud,"isAligned32$1");function Rl(t){return Uint8Array.from(t)}a(Rl,"copyBytes");const Ra=16,VG=283;function WG(t){if(![16,24,32].includes(t.length))throw new Error('"aes key" expected Uint8Array of length 16/24/32, got length='+t.length)}a(WG,"validateKeyLength");function HT(t){return t<<1^VG&-(t>>7)}a(HT,"mul2");function Xc(t,e){let n=0;for(;e>0;e>>=1)n^=t&-(e&1),t=HT(t);return n}a(Xc,"mul");const h_=(()=>{const t=new Uint8Array(256);for(let n=0,i=1;n<256;n++,i^=HT(i))t[n]=i;const e=new Uint8Array(256);e[0]=99;for(let n=0;n<255;n++){let i=t[255-n];i|=i<<8,e[t[n]]=(i^i>>4^i>>5^i>>6^i>>7^99)&255}return Od(t),e}
3)(),zG=h_.map((t,e)=>h_.indexOf(e)),KG=a(t=>t<<24|t>>>8,"rotr32_8"),yb=a(t=>t<<8|t>>>24,"rotl32_8");function KO(t,e){if(t.length!==256)throw new Error("Wrong sbox length");const n=new Uint32Array(256).map((c,u)=>e(t[u])),i=n.map(yb),s=i.map(yb),r=s.map(yb),o=new Uint32Array(256*256),l=new Uint32Array(256*256),d=new Uint16Array(256*256);for(let c=0;c<256;c++)for(let u=0;u<256;u++){const f=c*256+u;o[f]=n[c]^i[u],l[f]=s[c]^r[u],d[f]=t[c]<<8|t[u]}return{sbox:t,sbox2:d,T0:n,T1:i,T2:s,T3:r,T01:o,T23:l}}a(KO,"genTtable");const GT=KO(h_,t=>Xc(t,3)<<24|t<<16|t<<8|Xc(t,2)),qO=KO(zG,t=>Xc(t,11)<<24|Xc(t,13)<<16|Xc(t,9)<<8|Xc(t,14)),qG=(()=>{const t=new Uint8Array(16);for(let e=0,n=1;e<16;e++,n=HT(n))t[e]=n;return t})();function jO(t){Yi(t);const e=t.length;WG(t);const{sbox2:n}=GT,i=[];ud(t)||i.push(t=Rl(t));const s=Ti(t),r=s.length,o=a(d=>Ir(n,d,d,d,d),"subByte"),l=new Uint32Array(e+28);l.set(s);for(let d=r;d<l.length;d++){let c=l[d-1];d%r===0?c=o(KG(c))^qG[d/r-1]:r>6&&d%r===4&&(c=o(c)),l[d]=l[d-r]^c}return Od(...i),l}a(jO,"expandKeyLE");function jG(t){const e=jO(t),n=e.slice(),i=e.length,{sbox2:s}=GT,{T0:r,T1:o,T2:l,T3:d}=qO;for(let c=0;c<i;c+=4)for(let u=0;u<4;u++)n[c+u]=e[i-c-4+u];Od(e);for(let c=4;c<i-4;c++){const u=n[c],f=Ir(s,u,u,u,u);n[c]=r[f&255]^o[f>>>8&255]^l[f>>>16&255]^d[f>>>24]}return n}a(jG,"expandKeyDecLE");function Sa(t,e,n,i,s,r){return t[n<<8&65280|i>>>8&255]^e[s>>>8&65280|r>>>24&255]}a(Sa,"apply0123");function Ir(t,e,n,i,s){return t[e&255|n&65280]|t[i>>>16&255|s>>>16&65280]<<16}a(Ir,"applySbox");function ik(t,e,n,i,s){const{sbox2:r,T01:o,T23:l}=GT;let d=0;e^=t[d++],n^=t[d++],i^=t[d++],s^=t[d++];const c=t.length/4-2;for(let g=0;g<c;g++){const v=t[d++]^Sa(o,l,e,n,i,s),y=t[d++]^Sa(o,l,n,i,s,e),b=t[d++]^Sa(o,l,i,s,e,n),E=t[d++]^Sa(o,l,s,e,n,i);e=v,n=y,i=b,s=E}const u=t[d++]^Ir(r,e,n,i,s),f=t[d++]^Ir(r,n,i,s,e),h=t[d++]^Ir(r,i,s,e,n),p=t[d++]^Ir(r,s,e,n,i);return{s0:u,s1:f,s2:h,s3:p}}a(ik,"encrypt$3");function YG(t,e,n,i,s){const{sbox2:r,T01:o,T23:l}=qO;let d=0;e^=t[d++],n^=t[d++],i^=t[d++],s^=t[d++];const c=t.length/4-2;for(let g=0;g<c;g++){const v=t[d++]^Sa(o,l,e,s,i,n),y=t[d++]^Sa(o,l,n,e,s,i),b=t[d++]^Sa(o,l,i,n,e,s),E=t[d++]^Sa(o,l,s,i,n,e);e=v,n=y,i=b,s=E}const u=t[d++]^Ir(r,e,s,i,n),f=t[d++]^Ir(r,n,e,s,i),h=t[d++]^Ir(r,i,n,e,s),p=t[d++]^Ir(r,s,i,n,e);return{s0:u,s1:f,s2:h,s3:p}}a(YG,"decrypt$3");function ZG(t){if(Yi(t),t.length%Ra!==0)throw new Error("aes-(cbc/ecb).decrypt ciphertext should consist of blocks with size "+Ra)}a(ZG,"validateBlockDecrypt");function QG(t,e,n){Yi(t);let i=t.length;const s=i%Ra;if(!e&&s!==0)throw new Error("aec/(cbc-ecb): unpadded plaintext with disabled padding");ud(t)||(t=Rl(t));const r=Ti(t);if(e){let l=Ra-s;l||(l=Ra),i=i+l}n=zO(i,n),VO(t,n);const o=Ti(n);return{b:r,o,out:n}}a(QG,"validateBlockEncrypt");function JG(t,e){if(!e)return t;const n=t.length;if(!n)throw new Error("aes/pcks5: empty ciphertext not allowed");const i=t[n-1];if(i<=0||i>16)throw new Error("aes/pcks5: wrong padding");const s=t.subarray(0,-i);for(let r=0;r<i;r++)if(t[n-r-1]!==i)throw new Error("aes/pcks5: wrong padding");return s}a(JG,"validatePCKS");function XG(t){const e=new Uint8Array(16),n=Ti(e);e.set(t);const i=Ra-t.length;for(let s=Ra-i;s<Ra;s++)e[s]=i;return n}a(XG,"padPCKS");const YO=GG({blockSize:16,nonceLength:16},a(function(e,n,i={}){const s=!i.disablePadding;return{encrypt(r,o){const l=jO(e),{b:d,o:c,out:u}=QG(r,s,o);let f=n;const h=[l];ud(f)||h.push(f=Rl(f));const p=Ti(f);let g=p[0],v=p[1],y=p[2],b=p[3],E=0;for(;E+4<=d.length;)g^=d[E+0],v^=d[E+1],y^=d[E+2],b^=d[E+3],{s0:g,s1:v,s2:y,s3:b}=ik(l,g,v,y,b),c[E++]=g,c[E++]=v,c[E++]=y,c[E++]=b;if(s){const T=XG(r.subarray(E*4));g^=T[0],v^=T[1],y^=T[2],b^=T[3],{s0:g,s1:v,s2:y,s3:b}=ik(l,g,v,y,b),c[E++]=g,c[E++]=v,c[E++]=y,c[E++]=b}return Od(...h),u},decrypt(r,o){ZG(r);const l=jG(e);let d=n;const c=[l];ud(d)||c.push(d=Rl(d));const u=Ti(d);o=zO(r.length,o),ud(r)||c.push(r=Rl(r)),VO(r,o);const f=Ti(r),h=Ti(o);let p=u[0],g=u[1],v=u[2],y=u[3];for(let b=0;b+4<=f.length;){const E=p,T=g,I=v,M=y;p=f[b+0],g=f[b+1],v=f[b+2],y=f[b+3];const{s0:H,s1:N,s2:$,s3:F}=YG(l,p,g,v,y);h[b++]=H^E,h[b++]=N^T,h[b++]=$^I,h[b++]=F^M}return Od(...c),JG(o,s)}}},"aescbc")),ZO=a(t=>Uint8Array.from(t.split(""),e=>e.charCodeAt(0)),"encodeStr"),e7=ZO("expand 16-byte k"),t7=ZO("expand 32-byte k"),n7=Ti(e7),i7=Ti(t7);function Ut(t,e){return t<<e|t>>>32-e}a(Ut,"rotl$1");function p_(t){return t.byteOffset%4===0}a(p_,"isAligned32");const rg=64,s7=16,QO=2**32-1,sk=Uint32Array.of();function r7(t,e,n,i,s,r,o,l){const d=s.length,c=new Uint8Array(rg),u=Ti(c),f=p_(s)&&p_(r),h=f?Ti(s):sk,p=f?Ti(r):sk;for(let g=0;g<d;o++){if(t(e,n,i,u,o,l),o>=QO)throw new Error("arx: counter overflow");const v=Math.min(rg,d-g);
3if(f&&v===rg){const y=g/4;if(g%4!==0)throw new Error("arx: invalid block position");for(let b=0,E;b<s7;b++)E=y+b,p[E]=h[E]^u[b];g+=rg;continue}for(let y=0,b;y<v;y++)b=g+y,r[b]=s[b]^c[y];g+=v}}a(r7,"runCipher");function o7(t,e){const{allowShortKeys:n,extendNonceFn:i,counterLength:s,counterRight:r,rounds:o}=HG({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},e);if(typeof t!="function")throw new Error("core must be a function");return vb(s),vb(o),nk(r),nk(n),(l,d,c,u,f=0)=>{Yi(l,void 0,"key"),Yi(d,void 0,"nonce"),Yi(c,void 0,"data");const h=c.length;if(u===void 0&&(u=new Uint8Array(h)),Yi(u,void 0,"output"),vb(f),f<0||f>=QO)throw new Error("arx: counter overflow");if(u.length<h)throw new Error(`arx: output (${u.length}) is shorter than data (${h})`);const p=[];let g=l.length,v,y;if(g===32)p.push(v=Rl(l)),y=i7;else if(g===16&&n)v=new Uint8Array(32),v.set(l),v.set(l,16),y=n7,p.push(v);else throw Yi(l,32,"arx key"),new Error("invalid key size");p_(d)||p.push(d=Rl(d));const b=Ti(v);if(i){if(d.length!==24)throw new Error("arx: extended nonce must be 24 bytes");i(y,b,Ti(d.subarray(0,16)),b),d=d.subarray(16)}const E=16-s;if(E!==d.length)throw new Error(`arx: nonce must be ${E} or 16 bytes`);if(E!==12){const I=new Uint8Array(12);I.set(d,r?0:12-d.length),d=I,p.push(d)}const T=Ti(d);return r7(t,y,b,T,c,u,f,o),Od(...p),u}}a(o7,"createCipher");function a7(t,e,n,i,s,r=20){let o=t[0],l=t[1],d=t[2],c=t[3],u=e[0],f=e[1],h=e[2],p=e[3],g=e[4],v=e[5],y=e[6],b=e[7],E=s,T=n[0],I=n[1],M=n[2],H=o,N=l,$=d,F=c,D=u,L=f,m=h,S=p,_=g,A=v,x=y,C=b,U=E,R=T,w=I,P=M;for(let Z=0;Z<r;Z+=2)H=H+D|0,U=Ut(U^H,16),_=_+U|0,D=Ut(D^_,12),H=H+D|0,U=Ut(U^H,8),_=_+U|0,D=Ut(D^_,7),N=N+L|0,R=Ut(R^N,16),A=A+R|0,L=Ut(L^A,12),N=N+L|0,R=Ut(R^N,8),A=A+R|0,L=Ut(L^A,7),$=$+m|0,w=Ut(w^$,16),x=x+w|0,m=Ut(m^x,12),$=$+m|0,w=Ut(w^$,8),x=x+w|0,m=Ut(m^x,7),F=F+S|0,P=Ut(P^F,16),C=C+P|0,S=Ut(S^C,12),F=F+S|0,P=Ut(P^F,8),C=C+P|0,S=Ut(S^C,7),H=H+L|0,P=Ut(P^H,16),x=x+P|0,L=Ut(L^x,12),H=H+L|0,P=Ut(P^H,8),x=x+P|0,L=Ut(L^x,7),N=N+m|0,U=Ut(U^N,16),C=C+U|0,m=Ut(m^C,12),N=N+m|0,U=Ut(U^N,8),C=C+U|0,m=Ut(m^C,7),$=$+S|0,R=Ut(R^$,16),_=_+R|0,S=Ut(S^_,12),$=$+S|0,R=Ut(R^$,8),_=_+R|0,S=Ut(S^_,7),F=F+D|0,w=Ut(w^F,16),A=A+w|0,D=Ut(D^A,12),F=F+D|0,w=Ut(w^F,8),A=A+w|0,D=Ut(D^A,7);let V=0;i[V++]=o+H|0,i[V++]=l+N|0,i[V++]=d+$|0,i[V++]=c+F|0,i[V++]=u+D|0,i[V++]=f+L|0,i[V++]=h+m|0,i[V++]=p+S|0,i[V++]=g+_|0,i[V++]=v+A|0,i[V++]=y+x|0,i[V++]=b+C|0,i[V++]=E+U|0,i[V++]=T+R|0,i[V++]=I+w|0,i[V++]=M+P|0}a(a7,"chachaCore");const sy=o7(a7,{counterRight:!1,counterLength:4,allowShortKeys:!1});function JO(t,e,n){return ey(t),n===void 0&&(n=new Uint8Array(t.outputLen)),ru(t,n,e)}a(JO,"extract");const bb=Uint8Array.of(0),rk=Uint8Array.of();function XO(t,e,n,i=32){ey(t),Oa(i,"length");const s=t.outputLen;if(i>255*s)throw new Error("Length must be <= 255*HashLen");const r=Math.ceil(i/s);n===void 0?n=rk:an(n,void 0,"info");const o=new Uint8Array(r*s),l=ru.create(t,e),d=l._cloneInto(),c=new Uint8Array(l.outputLen);for(let u=0;u<r;u++)bb[0]=u+1,d.update(u===0?rk:c).update(n).update(bb).digestInto(c),o.set(c,s*u),l._cloneInto(d);return l.destroy(),d.destroy(),Kf(c,bb),o.slice(0,i)}a(XO,"expand");var l7=Object.defineProperty,pn=a((t,e)=>{for(var n in e)l7(t,n,{get:e[n],enumerable:!0})},"__export$1"),Qa=Symbol("verified"),c7=a(t=>t instanceof Object,"isRecord$1");function VT(t){if(!c7(t)||typeof t.kind!="number"||typeof t.content!="string"||typeof t.created_at!="number"||typeof t.pubkey!="string"||!t.pubkey.match(/^[a-f0-9]{64}$/)||!Array.isArray(t.tags))return!1;for(let e=0;e<t.tags.length;e++){let n=t.tags[e];if(!Array.isArray(n))return!1;for(let i=0;i<n.length;i++)if(typeof n[i]!="string")return!1}return!0}a(VT,"validateEvent$1");var c0={};pn(c0,{binarySearch:()=>WT,bytesToHex:()=>qt,hexToBytes:()=>rn,insertEventIntoAscendingList:()=>u7,insertEventIntoDescendingList:()=>d7,mergeReverseSortedLists:()=>f7,normalizeURL:()=>ed,utf8Decoder:()=>fo,utf8Encoder:()=>ks});var fo=new TextDecoder("utf-8"),ks=new TextEncoder;function ed(t){try{t.indexOf("://")===-1&&(t="wss://"+t);let e=new URL(t);return e.protocol==="http:"?e.protocol="ws:":e.protocol==="https:"&&(e.protocol="wss:"),e.pathname=e.pathname.replace(/\/+/g,"/"),e.pathname.endsWith("/")&&(e.pathname=e.pathname.slice(0,-1)),(e.port==="80"&&e.protocol==="ws:"||e.port==="443"&&e.protocol==="wss:")&&(e.port=""),e.searchParams.sort(),e.hash="",e.toString()}catch{throw new Error(`Invalid URL: ${t}`)}}a(ed,"normalizeURL$1");function d7(t,e){const[n,i]=WT(t,s=>e.id===s.id?0:e.created_at===s.created_at?-1:s.created_at-e.created_at);return i||t.splice(n,0,e),t}a(d7,"insertEventIntoDescendingList");function u7(t,e){const[n,i]=WT(t,s=>e.id===s.id?0:e.created_at===s.created_at?-1:e.created_at-s.created_at);return i||t.splice(n,0,e),t}a(u7,"insertEventIntoAscendingList");function WT(t,e){let n=0,i=t.length-1;for(;n<=i;){const s=Math.floor((n+i)/2),r=e(t[s]);if(r===0)return[s,!0];r<0?i=s-1:n=s+1}return[n,!1]}a(WT,"binarySearch");function f7(t,e){const n=new Array(t.length+e.length);n.length=0;let i=0,s=0,r=[];for(;i<t.length&&s<e.length;){let o;if(t[i]?.created_at>e[s]?.created_at?(o=t[i],i++):(o=e[s],s++),n.length>0&&n[n.length-1].created_at===o.created_at){if(r.includes(o.id))continue}else r.length=0;n.push(o),r.push(o.id)}for(;i<t.length;){const o=t[i];if(i++,n.length>0&&n[n.length-1].created_at===o.created_at){if(r.includes(o.id))continue}else r.length=0;n.push(o),r.push(o.id)}for(;s<e.length;){const o=e[s];if(s++,n.length>0&&n[n.length-1].created_at===o.created_at){if(r.includes(o.id))continue}else r.length=0;n.push(o),r.push(o.id)}return n}a(f7,"mergeReverseSortedLists");var qh,h7=(qh=class{generateSecretKey(){return Tr.utils.randomSecretKey()}getPublicKey(e){return qt(Tr.getPublicKey(e))}finalizeEvent(e,n){const i=e;return i.pubkey=qt(Tr.getPublicKey(n)),i.id=sm(i),i.sig=qt(Tr.sign(rn(sm(i)),n)),i[Qa]=!0,i}verifyEvent(e){if(typeof e[Qa]=="boolean")return e[Qa];const n=sm(e);if(n!==e.id)return e[Qa]=!1,!1;try{const i=Tr.verify(rn(e.sig),rn(n),rn(e.pubkey));return e[Qa]=i,i}catch{return e[Qa]=!1,!1}}},a(qh,"JS"),qh);function p7(t){if(!VT(t))throw new Error("can't serialize event with wrong or missing properties");return JSON.stringify([0,t.pubkey,t.created_at,t.kind,t.tags,t.content])}a(p7,"serializeEvent$1");function sm(t){let e=ns(ks.encode(p7(t)));return qt(e)}a(sm,"getEventHash$1");var ry=new h7,Ks=ry.generateSecretKey,nc=ry.getPublicKey,qs=ry.finalizeEvent,ou=ry.verifyEvent,g7={};pn(g7,{Application:()=>IV,BadgeAward:()=>S7,BadgeDefinition:()=>EV,BlockedRelaysList:()=>nV,BlossomServerList:()=>cV,BookmarkList:()=>X7,Bookmarksets:()=>vV,Calendar:()=>DV,CalendarEventRSVP:()=>OV,ChannelCreation:()=>r2,ChannelHideMessage:()=>l2,ChannelMessage:()=>a2,ChannelMetadata:()=>o2,ChannelMuteUser:()=>c2,ChatMessage:()=>T7,ClassifiedListing:()=>kV,ClientAuth:()=>u2,Comment:()=>P7,CommunitiesList:()=>eV,CommunityDefinition:()=>BV,CommunityPostApproval:()=>H7,Contacts:()=>E7,CreateOrUpdateProduct:()=>SV,CreateOrUpdateStall:()=>wV,Curationsets:()=>yV,Date:()=>CV,DirectMessageRelaysList:()=>aV,DraftClassifiedListing:()=>MV,DraftLong:()=>AV,Emojisets:()=>xV,EncryptedDirectMessage:()=>
3_7,EventDeletion:()=>w7,FavoriteRelays:()=>sV,FileMessage:()=>x7,FileMetadata:()=>C7,FileServerPreference:()=>lV,Followsets:()=>pV,ForumThread:()=>A7,GenericRepost:()=>YT,Genericlists:()=>gV,GiftWrap:()=>d2,GroupMetadata:()=>$V,HTTPAuth:()=>ZT,Handlerinformation:()=>UV,Handlerrecommendation:()=>FV,Highlights:()=>j7,InterestsList:()=>rV,Interestsets:()=>_V,JobFeedback:()=>W7,JobRequest:()=>G7,JobResult:()=>V7,Label:()=>$7,LightningPubRPC:()=>uV,LiveChatMessage:()=>D7,LiveEvent:()=>LV,LongFormArticle:()=>TV,Metadata:()=>y7,Mutelist:()=>Z7,NWCWalletInfo:()=>dV,NWCWalletRequest:()=>f2,NWCWalletResponse:()=>fV,NormalVideo:()=>L7,NostrConnect:()=>hV,OpenTimestamps:()=>k7,Photo:()=>I7,Pinlist:()=>Q7,Poll:()=>M7,PollResponse:()=>Y7,PrivateDirectMessage:()=>s2,ProblemTracker:()=>F7,ProfileBadges:()=>bV,PublicChatsList:()=>tV,Reaction:()=>jT,RecommendRelay:()=>b7,RelayList:()=>J7,RelayReview:()=>NV,Relaysets:()=>mV,Report:()=>U7,Reporting:()=>B7,Repost:()=>qT,Seal:()=>i2,SearchRelaysList:()=>iV,ShortTextNote:()=>n2,ShortVideo:()=>R7,Time:()=>PV,UserEmojiList:()=>oV,UserStatuses:()=>RV,Voice:()=>O7,VoiceComment:()=>N7,Zap:()=>q7,ZapGoal:()=>z7,ZapRequest:()=>K7,classifyKind:()=>m7,isAddressableKind:()=>KT,isEphemeralKind:()=>t2,isKind:()=>v7,isRegularKind:()=>e2,isReplaceableKind:()=>zT});function e2(t){return t<1e4&&t!==0&&t!==3}a(e2,"isRegularKind");function zT(t){return t===0||t===3||1e4<=t&&t<2e4}a(zT,"isReplaceableKind");function t2(t){return 2e4<=t&&t<3e4}a(t2,"isEphemeralKind");function KT(t){return 3e4<=t&&t<4e4}a(KT,"isAddressableKind");function m7(t){return e2(t)?"regular":zT(t)?"replaceable":t2(t)?"ephemeral":KT(t)?"parameterized":"unknown"}a(m7,"classifyKind");function v7(t,e){const n=e instanceof Array?e:[e];return VT(t)&&n.includes(t.kind)||!1}a(v7,"isKind");var y7=0,n2=1,b7=2,E7=3,_7=4,w7=5,qT=6,jT=7,S7=8,T7=9,A7=11,i2=13,s2=14,x7=15,YT=16,I7=20,L7=21,R7=22,r2=40,o2=41,a2=42,l2=43,c2=44,k7=1040,d2=1059,M7=1068,C7=1063,P7=1111,D7=1311,O7=1222,N7=1244,F7=1971,U7=1984,B7=1984,$7=1985,H7=4550,G7=5999,V7=6999,W7=7e3,z7=9041,K7=9734,q7=9735,j7=9802,Y7=1018,Z7=1e4,Q7=10001,J7=10002,X7=10003,eV=10004,tV=10005,nV=10006,iV=10007,sV=10012,rV=10015,oV=10030,aV=10050,lV=10096,cV=10063,dV=13194,uV=21e3,u2=22242,f2=23194,fV=23195,hV=24133,ZT=27235,pV=3e4,gV=30001,mV=30002,vV=30003,yV=30004,bV=30008,EV=30009,_V=30015,wV=30017,SV=30018,TV=30023,AV=30024,xV=30030,IV=30078,LV=30311,RV=30315,kV=30402,MV=30403,CV=31922,PV=31923,DV=31924,OV=31925,NV=31987,FV=31989,UV=31990,BV=34550,$V=39e3;function HV(t,e){if(t.ids&&t.ids.indexOf(e.id)===-1||t.kinds&&t.kinds.indexOf(e.kind)===-1||t.authors&&t.authors.indexOf(e.pubkey)===-1)return!1;for(let n in t)if(n[0]==="#"){let i=n.slice(1),s=t[`#${i}`];if(s&&!e.tags.find(([r,o])=>r===n.slice(1)&&s.indexOf(o)!==-1))return!1}return!(t.since&&e.created_at<t.since||t.until&&e.created_at>t.until)}a(HV,"matchFilter$1");function GV(t,e){for(let n=0;n<t.length;n++)if(HV(t[n],e))return!0;return!1}a(GV,"matchFilters$1");var VV={};pn(VV,{getHex64:()=>oy,getInt:()=>h2,getSubscriptionId:()=>p2,matchEventId:()=>WV,matchEventKind:()=>KV,matchEventPubkey:()=>zV});function oy(t,e){let n=e.length+3,i=t.indexOf(`"${e}":`)+n,s=t.slice(i).indexOf('"')+i+1;return t.slice(s,s+64)}a(oy,"getHex64$1");function h2(t,e){let n=e.length,i=t.indexOf(`"${e}":`)+n+3,s=t.slice(i),r=Math.min(s.indexOf(","),s.indexOf("}"));return parseInt(s.slice(0,r),10)}a(h2,"getInt");function p2(t){let e=t.slice(0,22).indexOf('"EVENT"');if(e===-1)return null;let n=t.slice(e+7+1).indexOf('"');if(n===-1)return null;let i=e+7+1+n,s=t.slice(i+1,80).indexOf('"');if(s===-1)return null;let r=i+1+s;return t.slice(i+1,r)}a(p2,"getSubscriptionId$1");function WV(t,e){return e===oy(t,"id")}a(WV,"matchEventId");function zV(t,e){return e===oy(t,"pubkey")}a(zV,"matchEventPubkey");function KV(t,e){return e===h2(t,"kind")}a(KV,"matchEventKind");var qV={};pn(qV,{makeAuthEvent:()=>g2});function g2(t,e){return{kind:u2,created_at:Math.floor(Date.now()/1e3),tags:[["relay",t],["challenge",e]],content:""}}a(g2,"makeAuthEvent$1");var jh,m2=(jh=class extends Error{constructor(e,n){super(`Tried to send message '${e} on a closed connection to ${n}.`),this.name="SendingOnClosedConnection"}},a(jh,"SendingOnClosedConnection"),jh),Yh,QT=(Yh=class{url;_connected=!1;onclose=null;onnotice=e=>console.debug(`NOTICE from ${this.url}: ${e}`);onauth;baseEoseTimeout=4400;publishTimeout=4400;pingFrequency=29e3;pingTimeout=2e4;
3resubscribeBackoff=[1e4,1e4,1e4,2e4,2e4,3e4,6e4];openSubs=new Map;enablePing;enableReconnect;idleSince=Date.now();ongoingOperations=0;reconnectTimeoutHandle;pingIntervalHandle;reconnectAttempts=0;skipReconnection=!1;connectionPromise;openCountRequests=new Map;openEventPublishes=new Map;ws;challenge;authPromise;serial=0;verifyEvent;_WebSocket;constructor(e,n){this.url=ed(e),this.verifyEvent=n.verifyEvent,this._WebSocket=n.websocketImplementation||WebSocket,this.enablePing=n.enablePing,this.enableReconnect=n.enableReconnect||!1}static async connect(e,n){const i=new QT(e,n);return await i.connect(n),i}closeAllSubscriptions(e){for(let[n,i]of this.openSubs)i.close(e);this.openSubs.clear();for(let[n,i]of this.openEventPublishes)i.reject(new Error(e));this.openEventPublishes.clear();for(let[n,i]of this.openCountRequests)i.reject(new Error(e));this.openCountRequests.clear()}get connected(){return this._connected}async reconnect(){const e=this.resubscribeBackoff[Math.min(this.reconnectAttempts,this.resubscribeBackoff.length-1)];this.reconnectAttempts++,this.reconnectTimeoutHandle=setTimeout(async()=>{try{await this.connect()}catch{}},e)}handleHardClose(e){this.pingIntervalHandle&&(clearInterval(this.pingIntervalHandle),this.pingIntervalHandle=void 0),this._connected=!1,this.connectionPromise=void 0,this.idleSince=void 0,this.enableReconnect&&!this.skipReconnection?this.reconnect():(this.onclose?.(),this.closeAllSubscriptions(e))}async connect(e){let n;return this.connectionPromise?this.connectionPromise:(this.challenge=void 0,this.authPromise=void 0,this.skipReconnection=!1,this.connectionPromise=new Promise((i,s)=>{e?.timeout&&(n=setTimeout(()=>{s("connection timed out"),this.connectionPromise=void 0,this.skipReconnection=!0,this.onclose?.(),this.handleHardClose("relay connection timed out")},e.timeout)),e?.abort&&(e.abort.onabort=s);try{this.ws=new this._WebSocket(this.url)}catch(r){clearTimeout(n),s(r);return}this.ws.onopen=()=>{this.reconnectTimeoutHandle&&(clearTimeout(this.reconnectTimeoutHandle),this.reconnectTimeoutHandle=void 0),clearTimeout(n),this._connected=!0;const r=this.reconnectAttempts>0;this.reconnectAttempts=0;for(const o of this.openSubs.values()){if(o.eosed=!1,r)for(let l=0;l<o.filters.length;l++)o.lastEmitted&&(o.filters[l].since=o.lastEmitted+1);o.fire()}this.enablePing&&(this.pingIntervalHandle=setInterval(()=>this.pingpong(),this.pingFrequency)),i()},this.ws.onerror=()=>{clearTimeout(n),s("connection failed"),this.connectionPromise=void 0,this.skipReconnection=!0,this.onclose?.(),this.handleHardClose("relay connection failed")},this.ws.onclose=r=>{clearTimeout(n),s(r.message||"websocket closed"),this.handleHardClose("relay connection closed")},this.ws.onmessage=this._onmessage.bind(this)}),this.connectionPromise)}waitForPingPong(){return new Promise(e=>{this.ws.once("pong",()=>e(!0)),this.ws.ping()})}waitForDummyReq(){return new Promise((e,n)=>{if(!this.connectionPromise)return n(new Error(`no connection to ${this.url}, can't ping`));try{const i=this.subscribe([{ids:["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"],limit:0}],{label:"<forced-ping>",oneose:()=>{e(!0),i.close()},onclose(){e(!0)},eoseTimeout:this.pingTimeout+1e3})}catch(i){n(i)}})}async pingpong(){this.ws?.readyState===1&&(await Promise.any([this.ws&&this.ws.ping&&this.ws.once?this.waitForPingPong():this.waitForDummyReq(),new Promise(n=>setTimeout(()=>n(!1),this.pingTimeout))])||this.ws?.readyState===this._WebSocket.OPEN&&this.ws?.close())}async send(e){if(!this.connectionPromise)throw new m2(e,this.url);this.connectionPromise.then(()=>{this.ws?.send(e)})}async auth(e){const n=this.challenge;if(!n)throw new Error("can't perform auth, no challenge was received");return this.authPromise?this.authPromise:(this.authPromise=new Promise(async(i,s)=>{try{let r=await e(g2(this.url,n)),o=setTimeout(()=>{let l=this.openEventPublishes.get(r.id);l&&(l.reject(new Error("auth timed out")),this.openEventPublishes.delete(r.id))},this.publishTimeout);this.openEventPublishes.set(r.id,{resolve:i,reject:s,timeout:o}),this.send('["AUTH",'+JSON.stringify(r)+"]")}catch(r){console.warn("subscribe auth function failed:",r)}}),this.authPromise)}async publish(e){this.idleSince=void 0,this.ongoingOperations++;const n=new Promise((i,s)=>{const r=setTimeout(()=>{const o=this.openEventPublishes.get(e.id);o&&(o.reject(new Error("publish timed out")),this.openEventPublishes.delete(e.id))},this.publishTimeout);this.openEventPublishes.set(e.id,{resolve:i,reject:s,timeout:r})});return this.send('["EVENT",'+JSON.stringify(e)+"]"),this.ongoingOperations--,this.ongoingOperations===0&&(this.idleSince=Date.now()),n}async count(e,n){this.serial++;const i=n?.id||"count:"+this.serial,s=new Promise((r,o)=>{this.openCountRequests.set(i,{resolve:r,reject:o})});return this.send('["COUNT","'+i+'",'+JSON.stringify(e).substring(1)),s}subscribe(e,n){n.label!=="<forced-ping>"&&(this.idleSince=void 0,this.ongoingOperations++);const i=this.prepareSubscription(e,n);return i.fire(),n.abort&&(n.abort.onabort=()=>i.close(String(n.abort.reason||"<aborted>"))),i}prepareSubscription(e,n){this.serial++;const i=n.id||(n.label?n.label+":":"sub:")+this.serial,s=new jV(this,i,e,n);return this.openSubs.set(i,s),s}close(){this.skipReconnection=!0,this.reconnectTimeoutHandle&&(clearTimeout(this.reconnectTimeoutHandle),this.reconnectTimeoutHandle=void 0),this.pingIntervalHandle&&(clearInterval(this.pingIntervalHandle),this.pingIntervalHandle=void 0),this.closeAllSubscriptions("relay connection closed by us"),this._connected=!1,this.idleSince=void 0,this.onclose?.(),this.ws?.readyState===this._WebSocket.OPEN&&this.ws?.close()}_onmessage(e){const n=e.data;if(!n)return;const i=p2(n);if(i){const s=this.openSubs.get(i);if(!s)return;const r=oy(n,"id"),o=s.alreadyHaveEvent?.(r);
3if(s.receivedEvent?.(this,r),o)return}try{let s=JSON.parse(n);switch(s[0]){case"EVENT":{const r=this.openSubs.get(s[1]),o=s[2];this.verifyEvent(o)&&GV(r.filters,o)&&r.onevent(o),(!r.lastEmitted||r.lastEmitted<o.created_at)&&(r.lastEmitted=o.created_at);return}case"COUNT":{const r=s[1],o=s[2],l=this.openCountRequests.get(r);l&&(l.resolve(o.count),this.openCountRequests.delete(r));return}case"EOSE":{const r=this.openSubs.get(s[1]);if(!r)return;r.receivedEose();return}case"OK":{const r=s[1],o=s[2],l=s[3],d=this.openEventPublishes.get(r);d&&(clearTimeout(d.timeout),o?d.resolve(l):d.reject(new Error(l)),this.openEventPublishes.delete(r));return}case"CLOSED":{const r=s[1],o=this.openSubs.get(r);if(!o)return;o.closed=!0,o.close(s[2]);return}case"NOTICE":{this.onnotice(s[1]);return}case"AUTH":{this.challenge=s[1],this.onauth&&this.auth(this.onauth);return}default:{this.openSubs.get(s[1])?.oncustom?.(s);return}}}catch(s){const[r,o,l]=JSON.parse(n);window.printer.maybe(l.pubkey,":: caught err",l,this.url,s);return}}},a(Yh,"AbstractRelay"),Yh),Zh,jV=(Zh=class{relay;id;lastEmitted;closed=!1;eosed=!1;filters;alreadyHaveEvent;receivedEvent;onevent;oneose;onclose;oncustom;eoseTimeout;eoseTimeoutHandle;constructor(e,n,i,s){if(i.length===0)throw new Error("subscription can't be created with zero filters");this.relay=e,this.filters=i,this.id=n,this.alreadyHaveEvent=s.alreadyHaveEvent,this.receivedEvent=s.receivedEvent,this.eoseTimeout=s.eoseTimeout||e.baseEoseTimeout,this.oneose=s.oneose,this.onclose=s.onclose,this.onevent=s.onevent||(r=>{console.warn(`onevent() callback not defined for subscription '${this.id}' in relay ${this.relay.url}. event received:`,r)})}fire(){this.relay.send('["REQ","'+this.id+'",'+JSON.stringify(this.filters).substring(1)),this.eoseTimeoutHandle=setTimeout(this.receivedEose.bind(this),this.eoseTimeout)}receivedEose(){this.eosed||(clearTimeout(this.eoseTimeoutHandle),this.eosed=!0,this.oneose?.())}close(e="closed by caller"){if(!this.closed&&this.relay.connected){try{this.relay.send('["CLOSE",'+JSON.stringify(this.id)+"]")}catch(n){if(!(n instanceof m2))throw n}this.closed=!0}this.relay.openSubs.delete(this.id),this.relay.ongoingOperations--,this.relay.ongoingOperations===0&&(this.relay.idleSince=Date.now()),this.onclose?.(e)}},a(Zh,"Subscription"),Zh),v2;try{v2=WebSocket}catch{}var Qh,y2=(Qh=class extends QT{constructor(e,n){super(e,{verifyEvent:ou,websocketImplementation:v2,...n})}static async connect(e,n){const i=new y2(e,n);return await i.connect(),i}},a(Qh,"Relay"),Qh),YV=a(t=>(t[Qa]=!0,!0),"alwaysTrue$1"),Jh,ZV=(Jh=class{relays=new Map;seenOn=new Map;trackRelays=!1;verifyEvent;enablePing;enableReconnect;automaticallyAuth;trustedRelayURLs=new Set;onRelayConnectionFailure;onRelayConnectionSuccess;allowConnectingToRelay;maxWaitForConnection;_WebSocket;constructor(e){this.verifyEvent=e.verifyEvent,this._WebSocket=e.websocketImplementation,this.enablePing=e.enablePing,this.enableReconnect=e.enableReconnect||!1,this.automaticallyAuth=e.automaticallyAuth,this.onRelayConnectionFailure=e.onRelayConnectionFailure,this.onRelayConnectionSuccess=e.onRelayConnectionSuccess,this.allowConnectingToRelay=e.allowConnectingToRelay,this.maxWaitForConnection=e.maxWaitForConnection||3e3}async ensureRelay(e,n){e=ed(e);let i=this.relays.get(e);if(i||(i=new QT(e,{verifyEvent:this.trustedRelayURLs.has(e)?YV:this.verifyEvent,websocketImplementation:this._WebSocket,enablePing:this.enablePing,enableReconnect:this.enableReconnect}),i.onclose=()=>{this.relays.delete(e)},this.relays.set(e,i)),this.automaticallyAuth){const s=this.automaticallyAuth(e);s&&(i.onauth=s)}try{await i.connect({timeout:n?.connectionTimeout,abort:n?.abort})}catch(s){throw this.relays.delete(e),s}return i}close(e){e.map(ed).forEach(n=>{this.relays.get(n)?.close(),this.relays.delete(n)})}subscribe(e,n,i){const s=[],r=[];for(let o=0;o<e.length;o++){const l=ed(e[o]);s.find(d=>d.url===l)||r.indexOf(l)===-1&&(r.push(l),s.push({url:l,filter:n}))}return this.subscribeMap(s,i)}subscribeMany(e,n,i){return this.subscribe(e,n,i)}subscribeMap(e,n){const i=new Map;for(const p of e){const{url:g,filter:v}=p;i.has(g)||i.set(g,[]),i.get(g).push(v)}const s=Array.from(i.entries()).map(([p,g])=>({url:p,filters:g}));this.trackRelays&&(n.receivedEvent=(p,g)=>{let v=this.seenOn.get(g);v||(v=new Set,this.seenOn.set(g,v)),v.add(p)});const r=new Set,o=[],l=[];let d=a(p=>{l[p]||(l[p]=!0,l.filter(g=>g).length===s.length&&(n.oneose?.(),d=a(()=>{},"handleEose")))},"handleEose");const c=[];let u=a((p,g)=>{c[p]||(d(p),c[p]=g,c.filter(v=>v).length===s.length&&(n.onclose?.(c),u=a(()=>{},"handleClose")))},"handleClose");
3const f=a(p=>{if(n.alreadyHaveEvent?.(p))return!0;const g=r.has(p);return r.add(p),g},"localAlreadyHaveEventHandler"),h=Promise.all(s.map(async({url:p,filters:g},v)=>{if(this.allowConnectingToRelay?.(p,["read",g])===!1){u(v,"connection skipped by allowConnectingToRelay");return}let y;try{y=await this.ensureRelay(p,{connectionTimeout:this.maxWaitForConnection<(n.maxWait||0)?Math.max(n.maxWait*.8,n.maxWait-1e3):this.maxWaitForConnection,abort:n.abort})}catch(E){this.onRelayConnectionFailure?.(p),u(v,E?.message||String(E));return}this.onRelayConnectionSuccess?.(p);let b=y.subscribe(g,{...n,oneose:()=>d(v),onclose:E=>{E.startsWith("auth-required: ")&&n.onauth?y.auth(n.onauth).then(()=>{y.subscribe(g,{...n,oneose:()=>d(v),onclose:T=>{u(v,T)},alreadyHaveEvent:f,eoseTimeout:n.maxWait,abort:n.abort})}).catch(T=>{u(v,`auth was required and attempted, but failed with: ${T}`)}):u(v,E)},alreadyHaveEvent:f,eoseTimeout:n.maxWait,abort:n.abort});o.push(b)}));return{async close(p){await h,o.forEach(g=>{g.close(p)})}}}subscribeEose(e,n,i){let s;return s=this.subscribe(e,n,{...i,oneose(){const r="closed automatically on eose";s?s.close(r):i.onclose?.(e.map(o=>r))}}),s}subscribeManyEose(e,n,i){return this.subscribeEose(e,n,i)}async querySync(e,n,i){return new Promise(async s=>{const r=[];this.subscribeEose(e,n,{...i,onevent(o){r.push(o)},onclose(o){s(r)}})})}async get(e,n,i){n.limit=1;const s=await this.querySync(e,n,i);return s.sort((r,o)=>o.created_at-r.created_at),s[0]||null}publish(e,n,i){return e.map(ed).map(async(s,r,o)=>{if(o.indexOf(s)!==r)return Promise.reject("duplicate url");if(this.allowConnectingToRelay?.(s,["write",n])===!1)return Promise.reject("connection skipped by allowConnectingToRelay");let l;try{l=await this.ensureRelay(s,{connectionTimeout:this.maxWaitForConnection<(i?.maxWait||0)?Math.max(i.maxWait*.8,i.maxWait-1e3):this.maxWaitForConnection,abort:i?.abort})}catch(d){return this.onRelayConnectionFailure?.(s),"connection failure: "+String(d)}return l.publish(n).catch(async d=>{if(d instanceof Error&&d.message.startsWith("auth-required: ")&&i?.onauth)return await l.auth(i.onauth),l.publish(n);throw d}).then(d=>{if(this.trackRelays){let c=this.seenOn.get(n.id);c||(c=new Set,this.seenOn.set(n.id,c)),c.add(l)}return d})})}listConnectionStatus(){const e=new Map;return this.relays.forEach((n,i)=>e.set(i,n.connected)),e}destroy(){this.relays.forEach(e=>e.close()),this.relays=new Map}pruneIdleRelays(e=1e4){const n=[];for(const[i,s]of this.relays)s.idleSince&&Date.now()-s.idleSince>=e&&(this.relays.delete(i),n.push(i),s.close());return n}},a(Jh,"AbstractSimplePool"),Jh),b2;try{b2=WebSocket}catch{}var Xh,QV=(Xh=class extends ZV{constructor(e){super({verifyEvent:ou,websocketImplementation:b2,maxWaitForConnection:3e3,...e})}},a(Xh,"SimplePool"),Xh),Ce={};pn(Ce,{BECH32_REGEX:()=>E2,Bech32MaxSize:()=>JT,NostrTypeGuard:()=>JV,decode:()=>ay,decodeNostrURI:()=>eW,encodeBytes:()=>cy,naddrEncode:()=>oW,neventEncode:()=>rW,noteEncode:()=>iW,nprofileEncode:()=>sW,npubEncode:()=>nW,nsecEncode:()=>tW});var JV={isNProfile:t=>/^nprofile1[a-z\d]+$/.test(t||""),isNEvent:t=>/^nevent1[a-z\d]+$/.test(t||""),isNAddr:t=>/^naddr1[a-z\d]+$/.test(t||""),isNSec:t=>/^nsec1[a-z\d]{58}$/.test(t||""),isNPub:t=>/^npub1[a-z\d]{58}$/.test(t||""),isNote:t=>/^note1[a-z\d]+$/.test(t||""),isNcryptsec:t=>/^ncryptsec1[a-z\d]+$/.test(t||"")},JT=5e3,E2=/[\x21-\x7E]{1,83}1[023456789acdefghjklmnpqrstuvwxyz]{6,}/;function XV(t){const e=new Uint8Array(4);return e[0]=t>>24&255,e[1]=t>>16&255,e[2]=t>>8&255,e[3]=t&255,e}a(XV,"integerToUint8Array");function eW(t){try{return t.startsWith("nostr:")&&(t=t.substring(6)),ay(t)}catch{return{type:"invalid",data:null}}}a(eW,"decodeNostrURI");function ay(t){let{prefix:e,words:n}=Dd.decode(t,JT),i=new Uint8Array(Dd.fromWords(n));switch(e){case"nprofile":{let s=Eb(i);if(!s[0]?.[0])throw new Error("missing TLV 0 for nprofile");if(s[0][0].length!==32)throw new Error("TLV 0 should be 32 bytes");return{type:"nprofile",data:{pubkey:qt(s[0][0]),relays:s[1]?s[1].map(r=>fo.decode(r)):[]}}}case"nevent":{let s=Eb(i);if(!s[0]?.[0])throw new Error("missing TLV 0 for nevent");
3if(s[0][0].length!==32)throw new Error("TLV 0 should be 32 bytes");if(s[2]&&s[2][0].length!==32)throw new Error("TLV 2 should be 32 bytes");if(s[3]&&s[3][0].length!==4)throw new Error("TLV 3 should be 4 bytes");return{type:"nevent",data:{id:qt(s[0][0]),relays:s[1]?s[1].map(r=>fo.decode(r)):[],author:s[2]?.[0]?qt(s[2][0]):void 0,kind:s[3]?.[0]?parseInt(qt(s[3][0]),16):void 0}}}case"naddr":{let s=Eb(i);if(!s[0]?.[0])throw new Error("missing TLV 0 for naddr");if(!s[2]?.[0])throw new Error("missing TLV 2 for naddr");if(s[2][0].length!==32)throw new Error("TLV 2 should be 32 bytes");if(!s[3]?.[0])throw new Error("missing TLV 3 for naddr");if(s[3][0].length!==4)throw new Error("TLV 3 should be 4 bytes");return{type:"naddr",data:{identifier:fo.decode(s[0][0]),pubkey:qt(s[2][0]),kind:parseInt(qt(s[3][0]),16),relays:s[1]?s[1].map(r=>fo.decode(r)):[]}}}case"nsec":return{type:e,data:i};case"npub":case"note":return{type:e,data:qt(i)};default:throw new Error(`unknown prefix ${e}`)}}a(ay,"decode");function Eb(t){let e={},n=t;for(;n.length>0;){let i=n[0],s=n[1],r=n.slice(2,2+s);if(n=n.slice(2+s),r.length<s)throw new Error(`not enough data to read on TLV ${i}`);e[i]=e[i]||[],e[i].push(r)}return e}a(Eb,"parseTLV");function tW(t){return cy("nsec",t)}a(tW,"nsecEncode");function nW(t){return cy("npub",rn(t))}a(nW,"npubEncode");function iW(t){return cy("note",rn(t))}a(iW,"noteEncode");function ly(t,e){let n=Dd.toWords(e);return Dd.encode(t,n,JT)}a(ly,"encodeBech32");function cy(t,e){return ly(t,e)}a(cy,"encodeBytes");function sW(t){let e=XT({0:[rn(t.pubkey)],1:(t.relays||[]).map(n=>ks.encode(n))});return ly("nprofile",e)}a(sW,"nprofileEncode");function rW(t){let e;t.kind!==void 0&&(e=XV(t.kind));let n=XT({0:[rn(t.id)],1:(t.relays||[]).map(i=>ks.encode(i)),2:t.author?[rn(t.author)]:[],3:e?[new Uint8Array(e)]:[]});return ly("nevent",n)}a(rW,"neventEncode");function oW(t){let e=new ArrayBuffer(4);new DataView(e).setUint32(0,t.kind,!1);let n=XT({0:[ks.encode(t.identifier)],1:(t.relays||[]).map(i=>ks.encode(i)),2:[rn(t.pubkey)],3:[new Uint8Array(e)]});return ly("naddr",n)}a(oW,"naddrEncode");function XT(t){let e=[];return Object.entries(t).reverse().forEach(([n,i])=>{i.forEach(s=>{let r=new Uint8Array(s.length+2);r.set([parseInt(n)],0),r.set([s.length],1),r.set(s,2),e.push(r)})}),pi(...e)}a(XT,"encodeTLV");var g_={};pn(g_,{decrypt:()=>aW,encrypt:()=>_2});function _2(t,e,n){const i=t instanceof Uint8Array?t:rn(t),s=iy.getSharedSecret(i,rn("02"+e)),r=w2(s);let o=Uint8Array.from(ec(16)),l=ks.encode(n),d=YO(r,o).encrypt(l),c=Fr.encode(ne
3w Uint8Array(d)),u=Fr.encode(new Uint8Array(o.buffer));return`${c}?iv=${u}`}a(_2,"encrypt$2");function aW(t,e,n){const i=t instanceof Uint8Array?t:rn(t);let[s,r]=n.split("?iv="),o=iy.getSharedSecret(i,rn("02"+e)),l=w2(o),d=Fr.decode(r),c=Fr.decode(s),u=YO(l,d).decrypt(c);return fo.decode(u)}a(aW,"decrypt$2");function w2(t){return t.slice(1,33)}a(w2,"getNormalizedX");var S2={};pn(S2,{NIP05_REGEX:()=>e1,isNip05:()=>lW,isValid:()=>uW,queryProfile:()=>T2,searchDomain:()=>dW,useFetchImplementation:()=>cW});var e1=/^(?:([\w.+-]+)@)?([\w_-]+(\.[\w_-]+)+)$/,lW=a(t=>e1.test(t||""),"isNip05"),dy;try{dy=fetch}catch{}function cW(t){dy=t}a(cW,"useFetchImplementation");async function dW(t,e=""){try{const n=`https://${t}/.well-known/nostr.json?name=${e}`,i=await dy(n,{redirect:"manual"});if(i.status!==200)throw Error("Wrong response code");return(await i.json()).names}catch{return{}}}a(dW,"searchDomain");async function T2(t){const e=t.match(e1);if(!e)return null;const[,n="_",i]=e;try{const s=`https://${i}/.well-known/nostr.json?name=${n}`,r=await dy(s,{redirect:"manual"});if(r.status!==200)throw Error("Wrong response code");const o=await r.json(),l=o.names[n];return l?{pubkey:l,relays:o.relays?.[l]}:null}catch{return null}}a(T2,"queryProfile");async function uW(t,e){const n=await T2(e);return n?n.pubkey===t:!1}a(uW,"isValid$1");var fW={};pn(fW,{parse:()=>hW});function hW(t){const e={reply:void 0,root:void 0,mentions:[],profiles:[],quotes:[]};let n,i;for(let s=t.tags.length-1;s>=0;s--){const r=t.tags[s];if(r[0]==="e"&&r[1]){const[o,l,d,c,u]=r,f={id:l,relays:d?[d]:[],author:u};if(c==="root"){e.root=f;continue}if(c==="reply"){e.reply=f;continue}if(c==="mention"){e.mentions.push(f);continue}n?i=f:n=f,e.mentions.push(f);continue}if(r[0]==="q"&&r[1]){const[o,l,d]=r;e.quotes.push({id:l,relays:d?[d]:[]})}if(r[0]==="p"&&r[1]){e.profiles.push({pubkey:r[1],relays:r[2]?[r[2]]:[]});continue}}return e.root||(e.root=i||n||e.reply),e.reply||(e.reply=n||e.root),[e.reply,e.root].forEach(s=>{if(!s)return;let r=e.mentions.indexOf(s);if(r!==-1&&e.mentions.splice(r,1),s.author){let o=e.profiles.find(l=>l.pubkey===s.author);o&&o.relays&&(s.relays||(s.relays=[]),o.relays.forEach(l=>{s.relays?.indexOf(l)===-1&&s.relays.push(l)}),o.relays=s.relays)}}),e.mentions.forEach(s=>{if(s.author){let r=e.profiles.find(o=>o.pubkey===s.author);r&&r.relays&&(s.relays||(s.relays=[]),r.relays.forEach(o=>{s.relays.indexOf(o)===-1&&s.relays.push(o)}),r.relays=s.relays)}}),e}a(hW,"parse$2");var pW={};pn(pW,{fetchRelayInformation:()=>mW,useFetchImplementation:()=>gW});var A2;try{A2=fetch}catch{}function gW(t){A2=t}a(gW,"useFetchImplementation2");async function mW(t){return await(await fetch(t.replace("ws://","http://").replace("wss://","https://"),{headers:{Accept:"application/nostr+json"}})).json()}a(mW,"fetchRelayInformation");var vW={};pn(vW,{getPow:()=>yW,minePow:()=>EW});function yW(t){let e=0;for(let n=0;n<64;n+=8){const i=parseInt(t.substring(n,n+8),16);if(i===0)e+=32;else{e+=Math.clz32(i);break}}return e}a(yW,"getPow");function bW(t){let e=0;for(let n=0;n<t.length;n++){const i=t[n];if(i===0)e+=8;else{e+=Math.clz32(i)-24;break}}return e}a(bW,"getPowFromBytes");function EW(t,e){let n=0;const i=t,s=["nonce",n.toString(),e.toString()];for(i.tags.push(s);;){const r=Math.floor(new Date().getTime()/1e3);r!==i.created_at&&(n=0,i.created_at=r),s[1]=(++n).toString();const o=ns(ks.encode(JSON.stringify([0,i.pubkey,i.created_at,i.kind,i.tags,i.content])));if(bW(o)>=e){i.id=qt(o);break}}return i}a(EW,"minePow");var _W={};pn(_W,{unwrapEvent:()=>CW,unwrapManyEvents:()=>PW,wrapEvent:()=>U2,wrapManyEvents:()=>MW});var wW={};pn(wW,{createRumor:()=>D2,createSeal:()=>O2,createWrap:()=>N2,unwrapEvent:()=>r1,unwrapManyEvents:()=>F2,wrapEvent:()=>d0,wrapManyEvents:()=>RW});var td={};pn(td,{decrypt:()=>s1,encrypt:()=>i1,getConversationKey:()=>t1,v2:()=>IW});var x2=1,I2=65535;function t1(t,e){const n=iy.getSharedSecret(t,rn("02"+e)).subarray(1,33);return JO(ns,n,ks.encode("nip44-v2"))}a(t1,"getConversationKey$1");function L2(t,e){const n=XO(ns,t,e,76);return{chacha_key:n.subarray(0,32),chacha_nonce:n.subarray(32,44),hmac_key:n.subarray(44,76)}}a(L2,"getMessageKeys$1");function n1(t){if(!Number.isSafeInteger(t)||t<1)throw new Error("expected positive integer");if(t<=32)return 32;const e=1<<Math.floor(Math.log2(t-1))+1,n=e<=256?32:e/8;return n*(Math.floor((t-1)/n)+1)}
3a(n1,"calcPaddedLen$1");function SW(t){if(!Number.isSafeInteger(t)||t<x2||t>I2)throw new Error("invalid plaintext size: must be between 1 and 65535 bytes");const e=new Uint8Array(2);return new DataView(e.buffer).setUint16(0,t,!1),e}a(SW,"writeU16BE$1");function TW(t){const e=ks.encode(t),n=e.length,i=SW(n),s=new Uint8Array(n1(n)-n);return pi(i,e,s)}a(TW,"pad$1");function AW(t){const e=new DataView(t.buffer).getUint16(0),n=t.subarray(2,2+e);if(e<x2||e>I2||n.length!==e||t.length!==2+n1(e))throw new Error("invalid padding");return fo.decode(n)}a(AW,"unpad$1");function R2(t,e,n){if(n.length!==32)throw new Error("AAD associated data must be 32 bytes");const i=pi(n,e);return ru(ns,t,i)}a(R2,"hmacAad$1");function xW(t){if(typeof t!="string")throw new Error("payload must be a valid string");const e=t.length;if(e<132||e>87472)throw new Error("invalid payload length: "+e);if(t[0]==="#")throw new Error("unknown encryption version");let n;try{n=Fr.decode(t)}catch(r){throw new Error("invalid base64: "+r.message)}const i=n.length;if(i<99||i>65603)throw new Error("invalid data length: "+i);const s=n[0];if(s!==2)throw new Error("unknown encryption version "+s);return{nonce:n.subarray(1,33),ciphertext:n.subarray(33,-32),mac:n.subarray(-32)}}a(xW,"decodePayload$1");function i1(t,e,n=ec(32)){const{chacha_key:i,chacha_nonce:s,hmac_key:r}=L2(e,n),o=TW(t),l=sy(i,s,o),d=R2(r,l,n);return Fr.encode(pi(new Uint8Array([2]),n,l,d))}a(i1,"encrypt2");function s1(t,e){const{nonce:n,ciphertext:i,mac:s}=xW(t),{chacha_key:r,chacha_nonce:o,hmac_key:l}=L2(e,n),d=R2(l,i,n);if(!WO(d,s))throw new Error("invalid MAC");const c=sy(r,o,i);return AW(c)}a(s1,"decrypt2");var IW={utils:{getConversationKey:t1,calcPaddedLen:n1},encrypt:i1,decrypt:s1},LW=2*24*60*60,k2=a(()=>Math.round(Date.now()/1e3),"now$3"),M2=a(()=>Math.round(k2()-Math.random()*LW),"randomNow"),C2=a((t,e)=>t1(t,e),"nip44ConversationKey"),P2=a((t,e,n)=>i1(JSON.stringify(t),C2(e,n)),"nip44Encrypt"),ok=a((t,e)=>JSON.parse(s1(t.content,C2(e,t.pubkey))),"nip44Decrypt");function D2(t,e){const n={created_at:k2(),content:"",tags:[],...t,pubkey:nc(e)};return n.id=sm(n),n}a(D2,"createRumor");function O2(t,e,n){return qs({kind:i2,content:P2(t,e,n),created_at:M2(),tags:[]},e)}a(O2,"createSeal");function N2(t,e){const n=Ks();return qs({kind:d2,content:P2(t,n,e),created_at:M2(),tags:[["p",e]]},n)}a(N2,"createWrap");function d0(t,e,n){const i=D2(t,e),s=O2(i,e,n);return N2(s,n)}a(d0,"wrapEvent");function RW(t,e,n){if(!n||n.length===0)throw new Error("At least one recipient is required.");const i=nc(e),s=[d0(t,e,i)];return n.forEach(r=>{s.push(d0(t,e,r))}),s}a(RW,"wrapManyEvents");function r1(t,e){const n=ok(t,e);return ok(n,e)}a(r1,"unwrapEvent");function F2(t,e){let n=[];return t.forEach(i=>{n.push(r1(i,e))}),n.sort((i,s)=>i.created_at-s.created_at),n}a(F2,"unwrapManyEvents");function kW(t,e,n,i){const s={created_at:Math.ceil(Date.now()/1e3),kind:s2,tags:[],content:e};return(Array.isArray(t)?t:[t]).forEach(({publicKey:o,relayUrl:l})=>{s.tags.push(l?["p",o,l]:["p",o])}),i&&s.tags.push(["e",i.eventId,i.relayUrl||"","reply"]),n&&s.tags.push(["subject",n]),s}a(kW,"createEvent");function U2(t,e,n,i,s){const r=kW(e,n,i,s);return d0(r,t,e.publicKey)}a(U2,"wrapEvent2");function MW(t,e,n,i,s){if(!e||e.length===0)throw new Error("At least one recipient is required.");return[{publicKey:nc(t)},...e].map(o=>U2(t,o,n,i,s))}a(MW,"wrapManyEvents2");var CW=r1,PW=F2,DW={};pn(DW,{finishRepostEvent:()=>OW,getRepostedEvent:()=>NW,getRepostedEventPointer:()=>B2});function OW(t,e,n,i){let s;const r=[...t.tags??[],["e",e.id,n],["p",e.pubkey]];return e.kind===n2?s=qT:(s=YT,r.push(["k",String(e.kind)])),qs({kind:s,tags:r,content:t.content===""||e.tags?.find(o=>o[0]==="-")?"":JSON.stringify(e),created_at:t.created_at},i)}a(OW,"finishRepostEvent");function B2(t){if(![qT,YT].includes(t.kind))return;let e,n;for(let i=t.tags.length-1;i>=0&&(e===void 0||n===void 0);i--){const s=t.tags[i];s.length>=2&&(s[0]==="e"&&e===void 0?e=s:s[0]==="p"&&n===void 0&&(n=s))}if(e!==void 0)return{id:e[1],relays:[e[2],n?.[2]].filter(i=>typeof i=="string"),author:n?.[1]}}a(B2,"getRepostedEventPointer");function NW(t,{skipVerification:e}={}){const n=B2(t);if(n===void 0||t.content==="")return;let i;try{i=JSON.parse(t.content)}catch{return}if(i.id===n.id&&!(!e&&!ou(i)))return i}a(NW,"getRepostedEvent");var FW={};pn(FW,{NOSTR_URI_REGEX:()=>o1,parse:()=>BW,test:()=>UW});var o1=new RegExp(`nostr:(${E2.source})`);function UW(t){return typeof t=="string"&&new RegExp(`^${o1.source}$`).test(t)}a(UW,"test");function BW(t){const e=t.match(new RegExp(`^${o1.source}$`));if(!e)throw new Error(`Invalid Nostr URI: ${t}`);return{uri:e[0],value:e[1],decoded:ay(e[1])}}a(BW,"parse2");var $W={};pn($W,{finishReactionEvent:()=>HW,getReactedEventPointer:()=>GW});function HW(t,e,n){const i=e.tags.filter(s=>s.length>=2&&(s[0]==="e"||s[0]==="p"));return qs({...t,kind:jT,tags:[...t.tags??[],...i,["e",e.id],["p",e.pubkey]],content:t.content??"+"},n)}a(HW,"finishReactionEvent");function GW(t){if(t.kind!==jT)return;let e,n;for(let i=t.tags.length-1;i>=0&&(e===void 0||n===void 0);i--){const s=t.tags[i];s.length>=2&&(s[0]==="e"&&e===void 0?e=s:s[0]==="p"&&n===void 0&&(n=s))}if(!(e===void 0||n===void 0))return{id:e[1],relays:[e[2],n[2]].filter(i=>i!==void 0),author:n[1]}}a(GW,"getReactedEventPointer");var VW={};pn(VW,{parse:()=>zW});var _b=/\W/m,ak=/[^\w\/] |[^\w\/]$|$|,| /m,WW=42;function*zW(t){let e=[];
3if(typeof t!="string"){for(let r=0;r<t.tags.length;r++){const o=t.tags[r];o[0]==="emoji"&&o.length>=3&&e.push({type:"emoji",shortcode:o[1],url:o[2]})}t=t.content}const n=t.length;let i=0,s=0;e:for(;s<n;){const r=t.indexOf(":",s),o=t.indexOf("#",s);if(r===-1&&o===-1)break e;if(r===-1||o>=0&&o<r){if(o===0||t[o-1].match(_b)){const l=t.slice(o+1,o+WW).match(_b),d=l?o+1+l.index:n;yield{type:"text",text:t.slice(i,o)},yield{type:"hashtag",value:t.slice(o+1,d)},s=d,i=s;continue e}s=o+1;continue e}if(t.slice(r-5,r)==="nostr"){const l=t.slice(r+60).match(_b),d=l?r+60+l.index:n;try{let c,{data:u,type:f}=ay(t.slice(r+1,d));switch(f){case"npub":c={pubkey:u};break;case"note":c={id:u};break;case"nsec":s=d+1;continue;default:c=u}i!==r-5&&(yield{type:"text",text:t.slice(i,r-5)}),yield{type:"reference",pointer:c},s=d,i=s;continue e}catch{s=r+1;continue e}}else if(t.slice(r-5,r)==="https"||t.slice(r-4,r)==="http"){const l=t.slice(r+4).match(ak),d=l?r+4+l.index:n,c=t[r-1]==="s"?5:4;try{let u=new URL(t.slice(r-c,d));if(u.hostname.indexOf(".")===-1)throw new Error("invalid url");if(i!==r-c&&(yield{type:"text",text:t.slice(i,r-c)}),/\.(png|jpe?g|gif|webp|heic|svg)$/i.test(u.pathname)){yield{type:"image",url:u.toString()},s=d,i=s;continue e}if(/\.(mp4|avi|webm|mkv|mov)$/i.test(u.pathname)){yield{type:"video",url:u.toString()},s=d,i=s;continue e}if(/\.(mp3|aac|ogg|opus|wav|flac)$/i.test(u.pathname)){yield{type:"audio",url:u.toString()},s=d,i=s;continue e}yield{type:"url",url:u.toString()},s=d,i=s;continue e}catch{s=d+1;continue e}}else if(t.slice(r-3,r)==="wss"||t.slice(r-2,r)==="ws"){const l=t.slice(r+4).match(ak),d=l?r+4+l.index:n,c=t[r-1]==="s"?3:2;try{let u=new URL(t.slice(r-c,d));if(u.hostname.indexOf(".")===-1)throw new Error("invalid ws url");i!==r-c&&(yield{type:"text",text:t.slice(i,r-c)}),yield{type:"relay",url:u.toString()},s=d,i=s;continue e}catch{s=d+1;continue e}}else{for(let l=0;l<e.length;l++){const d=e[l];if(t[r+d.shortcode.length+1]===":"&&t.slice(r+1,r+d.shortcode.length+1)===d.shortcode){i!==r&&(yield{type:"text",text:t.slice(i,r)}),yield d,s=r+d.shortcode.length+2,i=s;continue e}}s=r+1;continue e}}i!==n&&(yield{type:"text",text:t.slice(i)})}a(zW,"parse3");var KW={};pn(KW,{channelCreateEvent:()=>qW,channelHideMessageEvent:()=>ZW,channelMessageEvent:()=>YW,channelMetadataEvent:()=>jW,channelMuteUserEvent:()=>QW});var qW=a((t,e)=>{let n;if(typeof t.content=="object")n=JSON.stringify(t.content);else if(typeof t.content=="string")n=t.content;else return;return qs({kind:r2,tags:[...t.tags??[]],content:n,created_at:t.created_at},e)},"channelCreateEvent"),jW=a((t,e)=>{let n;if(typeof t.content=="object")n=JSON.stringify(t.content);else if(typeof t.content=="string")n=t.content;else return;return qs({kind:o2,tags:[["e",t.channel_create_event_id],...t.tags??[]],content:n,created_at:t.created_at},e)},"channelMetadataEvent"),YW=a((t,e)=>{const n=[["e",t.channel_create_event_id,t.relay_url,"root"]];return t.reply_to_channel_message_event_id&&n.push(["e",t.reply_to_channel_message_event_id,t.relay_url,"reply"]),qs({kind:a2,tags:[...n,...t.tags??[]],content:t.content,created_at:t.created_at},e)},"channelMessageEvent"),ZW=a((t,e)=>{let n;if(typeof t.content=="object")n=JSON.stringify(t.content);else if(typeof t.content=="string")n=t.content;else return;return qs({kind:l2,tags:[["e",t.channel_message_event_id],...t.tags??[]],content:n,created_at:t.created_at},e)},"channelHideMessageEvent"),QW=a((t,e)=>{let n;if(typeof t.content=="object")n=JSON.stringify(t.content);else if(typeof t.content=="string")n=t.content;else return;return qs({kind:c2,tags:[["p",t.pubkey_to_mute],...t.tags??[]],content:n,created_at:t.created_at},e)},"channelMuteUserEvent"),JW={};pn(JW,{EMOJI_SHORTCODE_REGEX:()=>$2,matchAll:()=>XW,regex:()=>a1,replaceAll:()=>ez});var $2=/:(\w+):/,a1=a(()=>new RegExp(`\\B${$2.source}\\B`,"g"),"regex");function*XW(t){const e=t.matchAll(a1());for(const n of e)try{const[i,s]=n;yield{shortcode:i,name:s,start:n.index,end:n.index+i.length}}catch{}}a(XW,"matchAll");function ez(t,e){return t.replaceAll(a1(),(n,i)=>e({shortcode:n,name:i}))}a(ez,"replaceAll");var tz={};pn(tz,{useFetchImplementation:()=>nz,validateGithub:()=>iz});var l1;try{l1=fetch}catch{}function nz(t){l1=t}a(nz,"useFetchImplementation3");async function iz(t,e,n){try{return await(await l1(`https://gist.github.com/${e}/${n}/raw`)).text()===`Verifying that I control the following Nostr public key: ${t}`}catch{return!1}}a(iz,"validateGithub");var sz={};pn(sz,{makeNwcRequestEvent:()=>oz,parseConnectionString:()=>rz});function rz(t){const{host:e,pathname:n,searchParams:i}=new URL(t),s=n||e,r=i.get("relay"),o=i.get("secret");if(!s||!r||!o)throw new Error("invalid connection string");return{pubkey:s,relay:r,secret:o}}a(rz,"parseConnectionString");async function oz(t,e,n){const s=_2(e,t,JSON.stringify({method:"pay_invoice",params:{invoice:n}})),r={kind:f2,created_at:Math.round(Date.now()/1e3),content:s,tags:[["p",t]]};return qs(r,e)}a(oz,"makeNwcRequestEvent");var az={};pn(az,{normalizeIdentifier:()=>lz});function lz(t){return t=t.trim().toLowerCase(),t=t.normalize("NFKC"),Array.from(t).map(e=>/\p{Letter}/u.test(e)||/\p{Number}/u.test(e)?e:"-").join("")}a(lz,"normalizeIdentifier");var cz={};pn(cz,{getSatoshisAmountFromBolt11:()=>gz,getZapEndpoint:()=>uz,makeZapReceipt:()=>pz,makeZapRequest:()=>fz,useFetchImplementation:()=>dz,validateZapRequest:()=>hz});var c1;try{c1=fetch}catch{}function dz(t){c1=t}a(dz,"useFetchImplementation4");async function uz(t){try{let e="",{lud06:n,lud16:i}=JSON.parse(t.content);if(i){let[o,l]=i.split("@");e=new URL(`/.well-known/lnurlp/${o}`,`https://${l}`).toString()}else if(n){let{words:o}=Dd.decode(n,1e3),l=Dd.fromWords(o);e=fo.decode(l)}else return null;let r=await(await c1(e)).json();if(r.allowsNostr&&r.nostrPubkey)return r.callback}catch{}return null}a(uz,"getZapEndpoint");function fz(t){let e={kind:9734,created_at:Math.round(Date.now()/1e3),content:t.comment||"",tags:[["p","pubkey"in t?t.pubkey:t.event.pubkey],["amount",t.amount.toString()],["relays",...t.relays]]};
3if("event"in t){if(e.tags.push(["e",t.event.id]),zT(t.event.kind)){const n=["a",`${t.event.kind}:${t.event.pubkey}:`];e.tags.push(n)}else if(KT(t.event.kind)){let n=t.event.tags.find(([s,r])=>s==="d"&&r);if(!n)throw new Error("d tag not found or is empty");const i=["a",`${t.event.kind}:${t.event.pubkey}:${n[1]}`];e.tags.push(i)}e.tags.push(["k",t.event.kind.toString()])}return e}a(fz,"makeZapRequest");function hz(t){let e;try{e=JSON.parse(t)}catch{return"Invalid zap request JSON."}if(!VT(e))return"Zap request is not a valid Nostr event.";if(!ou(e))return"Invalid signature on zap request.";let n=e.tags.find(([r,o])=>r==="p"&&o);if(!n)return"Zap request doesn't have a 'p' tag.";if(!n[1].match(/^[a-f0-9]{64}$/))return"Zap request 'p' tag is not valid hex.";let i=e.tags.find(([r,o])=>r==="e"&&o);return i&&!i[1].match(/^[a-f0-9]{64}$/)?"Zap request 'e' tag is not valid hex.":e.tags.find(([r,o])=>r==="relays"&&o)?null:"Zap request doesn't have a 'relays' tag."}a(hz,"validateZapRequest");function pz({zapRequest:t,preimage:e,bolt11:n,paidAt:i}){let s=JSON.parse(t),r=s.tags.filter(([l])=>l==="e"||l==="p"||l==="a"),o={kind:9735,created_at:Math.round(i.getTime()/1e3),content:"",tags:[...r,["P",s.pubkey],["bolt11",n],["description",t]]};return e&&o.tags.push(["preimage",e]),o}a(pz,"makeZapReceipt");function gz(t){if(t.length<50)return 0;t=t.substring(0,50);const e=t.lastIndexOf("1");if(e===-1)return 0;const n=t.substring(0,e);if(!n.startsWith("lnbc"))return 0;const i=n.substring(4);if(i.length<1)return 0;const s=i[i.length-1],r=s.charCodeAt(0)-"0".charCodeAt(0),o=r>=0&&r<=9;let l=i.length-1;if(o&&l++,l<1)return 0;const d=parseInt(i.substring(0,l));switch(s){case"m":return d*1e5;case"u":return d*100;case"n":return d/10;case"p":return d/1e4;default:return d*1e8}}a(gz,"getSatoshisAmountFromBolt11");var mz={};pn(mz,{Negentropy:()=>G2,NegentropyStorageVector:()=>bz,NegentropySync:()=>Ez});var wb=97,fd=32,H2=16,Ka={Skip:0,Fingerprint:1,IdList:2},ep,co=(ep=class{_raw;length;constructor(e){typeof e=="number"?(this._raw=new Uint8Array(e),this.length=0):e instanceof Uint8Array?(this._raw=new Uint8Array(e),this.length=e.length):(this._raw=new Uint8Array(512),this.length=0)}unwrap(){return this._raw.subarray(0,this.length)}get capacity(){return this._raw.byteLength}extend(e){if(e instanceof co&&(e=e.unwrap()),typeof e.length!="number")throw Error("bad length");const n=e.length+this.length;if(this.capacity<n){const i=this._raw,s=Math.max(this.capacity*2,n);this._raw=new Uint8Array(s),this._raw.set(i)}this._raw.set(e,this.length),this.length+=e.length}shift(){const e=this._raw[0];return this._raw=this._raw.subarray(1),this.length--,e}shiftN(e=1){const n=this._raw.subarray(0,e);return this._raw=this._raw.subarray(e),this.length-=e,n}},a(ep,"WrappedBuffer"),ep);function og(t){let e=0;for(;;){if(t.length===0)throw Error("parse ends prematurely");let n=t.shift();if(e=e<<7|n&127,!(n&128))break}return e}a(og,"decodeVarInt");function Xr(t){if(t===0)return new co(new Uint8Array([0]));let e=[];for(;t!==0;)e.push(t&127),t>>>=7;e.reverse();for(let n=0;n<e.length-1;n++)e[n]|=128;return new co(new Uint8Array(e))}a(Xr,"encodeVarInt");function vz(t){return rm(t,1)[0]}a(vz,"getByte");function rm(t,e){if(t.length<e)throw Error("parse ends prematurely");return t.shiftN(e)}a(rm,"getBytes");var tp,yz=(tp=class{buf;constructor(){this.setToZero()}setToZero(){this.buf=new Uint8Array(fd)}add(e){let n=0,i=0,s=new DataView(this.buf.buffer),r=new DataView(e.buffer);for(let o=0;o<8;o++){let l=o*4,d=s.getUint32(l,!0),c=r.getUint32(l,!0),u=d;u+=n,u+=c,u>4294967295&&(i=1),s.setUint32(l,u&4294967295,!0),n=i,i=0}}negate(){let e=new DataView(this.buf.buffer);for(let i=0;i<8;i++){let s=i*4;e.setUint32(s,~e.getUint32(s,!0))}let n=new Uint8Array(fd);n[0]=1,this.add(n)}getFingerprint(e){let n=new co;return n.extend(this.buf),n.extend(Xr(e)),ns(n.unwrap()).subarray(0,H2)}},a(tp,"Accumulator"),tp),np,bz=(np=class{items;sealed;constructor(){this.items=[],this.sealed=!1}insert(e,n){if(this.sealed)throw Error("already sealed");const i=rn(n);if(i.byteLength!==fd)throw Error("bad id size for added item");this.items.push({timestamp:e,id:i})}seal(){if(this.sealed)throw Error("already sealed");this.sealed=!0,this.items.sort(Sb);for(let e=1;e<this.items.length;e++)if(Sb(this.items[e-1],this.items[e])===0)throw Error("duplicate item inserted")}unseal(){this.sealed=!1}size(){return this._checkSealed(),this.items.length}getItem(e){if(this._checkSealed(),e>=this.items.length)throw Error("out of range");return this.items[e]}iterate(e,n,i){this._checkSealed(),this._checkBounds(e,n);for(let s=e;s<n&&i(this.items[s],s);++s);}findLowerBound(e,n,i){return this._checkSealed(),this._checkBounds(e,n),this._binarySearch(this.items,e,n,s=>Sb(s,i)<0)}fingerprint(e,n){let i=new yz;return i.setToZero(),this.iterate(e,n,s=>(i.add(s.id),!0)),i.getFingerprint(n-e)}_checkSealed(){if(!this.sealed)throw Error("not sealed")}_checkBounds(e,n){if(e>n||n>this.items.length)throw Error("bad range")}_binarySearch(e,n,i,s){let r=i-n;for(;r>0;){let o=n,l=Math.floor(r/2);o+=l,s(e[o])?(n=++o,r-=l+1):r=l}return n}},a(np,"NegentropyStorageVector"),np),ip,G2=(ip=class{storage;frameSizeLimit;lastTimestampIn;lastTimestampOut;constructor(e,n=6e4){if(n<4096)throw Error("frameSizeLimit too small");this.storage=e,this.frameSizeLimit=n,this.lastTimestampIn=0,this.lastTimestampOut=0}_bound(e,n){return{timestamp:e,id:n||new Uint8Array(0)}}initiate(){let e=new co;return e.extend(new Uint8Array([wb])),this.splitRange(0,this.storage.size(),this._bound(Number.MAX_VALUE),e),qt(e.unwrap())}reconcile(e,n,i){const s=new co(rn(e));this.lastTimestampIn=this.lastTimestampOut=0;let r=new co;r.extend(new Uint8Array([wb]));let o=vz(s);if(o<96||o>111)throw Error("invalid negentropy protocol version byte");if(o!==wb)throw Error("unsupported negentropy protocol version requested: "+(o-96));let l=this.storage.size(),d=this._bound(0),c=0,u=!1;for(;s.length!==0;){let f=new co,h=a(()=>{u&&(u=!1,f.extend(this.encodeBound(d)),f.extend(Xr(Ka.Skip)))},"doSkip"),p=this.decodeBound(s),g=og(s),v=c,y=this.storage.findLowerBound(c,l,p);if(g===Ka.Skip)u=!0;else if(g===Ka.Fingerprint){let b=rm(s,H2),E=this.storage.fingerprint(v,y);V2(b,E)!==0?(h(),this.splitRange(v,y,p,f)):u=!0}else if(g===Ka.IdList){let b=og(s),E={};for(let T=0;T<b;T++){let I=rm(s,fd);E[qt(I)]=I}if(u=!0,this.storage.iterate(v,y,T=>{let I=T.id;const M=qt(I);return E[M]?delete E[qt(I)]:n?.(M),!0}),i)for(let T of Object.values(E))i(qt(T))}else throw Error("unexpected mode");if(this.exceededFrameSizeLimit(r.length+f.length)){let b=this.storage.fingerprint(y,l);r.extend(this.encodeBound(this._bound(Number.MAX_VALUE))),r.extend(Xr(Ka.Fingerprint)),r.extend(b);break}else r.extend(f);c=y,d=p}return r.length===1?null:qt(r.unwrap())}splitRange(e,n,i,s){let r=n-e,o=16;if(r<o*2)s.extend(this.encodeBound(i)),s.extend(Xr(Ka.IdList)),s.extend(Xr(r)),this.storage.iterate(e,n,l=>(s.extend(l.id),!0));else{let l=Math.floor(r/o),d=r%o,c=e;for(let u=0;u<o;u++){let f=l+(u<d?1:0),h=this.storage.fingerprint(c,c+f);c+=f;let p;if(c===n)p=i;else{let g,v;this.storage.iterate(c-1,c+1,(y,b)=>(b===c-1?g=y:v=y,!0)),p=this.getMinimalBound(g,v)}s.extend(this.encodeBound(p)),s.extend(Xr(Ka.Fingerprint)),s.extend(h)}}}exceededFrameSizeLimit(e){return e>this.frameSizeLimit-200}decodeTimestampIn(e){let n=og(e);return n=n===0?Number.MAX_VALUE:n-1,this.lastTimestampIn===Number.MAX_VALUE||n===Number.MAX_VALUE?(this.lastTimestampIn=Number.MAX_VALUE,Number.MAX_VALUE):(n+=this.lastTimestampIn,this.lastTimestampIn=n,n)}decodeBound(e){let n=this.decodeTimestampIn(e),i=og(e);
3if(i>fd)throw Error("bound key too long");let s=rm(e,i);return{timestamp:n,id:s}}encodeTimestampOut(e){if(e===Number.MAX_VALUE)return this.lastTimestampOut=Number.MAX_VALUE,Xr(0);let n=e;return e-=this.lastTimestampOut,this.lastTimestampOut=n,Xr(e+1)}encodeBound(e){let n=new co;return n.extend(this.encodeTimestampOut(e.timestamp)),n.extend(Xr(e.id.length)),n.extend(e.id),n}getMinimalBound(e,n){if(n.timestamp!==e.timestamp)return this._bound(n.timestamp);{let i=0,s=n.id,r=e.id;for(let o=0;o<fd&&s[o]===r[o];o++)i++;return this._bound(n.timestamp,n.id.subarray(0,i+1))}}},a(ip,"Negentropy"),ip);function V2(t,e){for(let n=0;n<t.byteLength;n++){if(t[n]<e[n])return-1;if(t[n]>e[n])return 1}return t.byteLength>e.byteLength?1:t.byteLength<e.byteLength?-1:0}a(V2,"compareUint8Array");function Sb(t,e){return t.timestamp===e.timestamp?V2(t.id,e.id):t.timestamp-e.timestamp}a(Sb,"itemCompare");var sp,Ez=(sp=class{relay;storage;neg;filter;subscription;onhave;onneed;constructor(e,n,i,s={}){this.relay=e,this.storage=n,this.neg=new G2(n),this.onhave=s.onhave,this.onneed=s.onneed,this.filter=i,this.subscription=this.relay.prepareSubscription([{}],{label:s.label||"negentropy"}),this.subscription.oncustom=r=>{switch(r[0]){case"NEG-MSG":{r.length<3&&console.warn(`got invalid NEG-MSG from ${this.relay.url}: ${r}`);try{const o=this.neg.reconcile(r[2],this.onhave,this.onneed);o?this.relay.send(`["NEG-MSG", "${this.subscription.id}", "${o}"]`):(this.close(),s.onclose?.())}catch(o){console.error("negentropy reconcile error:",o),s?.onclose?.(`reconcile error: ${o}`)}break}case"NEG-CLOSE":{const o=r[2];console.warn("negentropy error:",o),s.onclose?.(o);break}case"NEG-ERR":s.onclose?.()}}}async start(){const e=this.neg.initiate();this.relay.send(`["NEG-OPEN","${this.subscription.id}",${JSON.stringify(this.filter)},"${e}"]`)}close(){this.relay.send(`["NEG-CLOSE","${this.subscription.id}"]`),this.subscription.close()}},a(sp,"NegentropySync"),sp),_z={};pn(_z,{getToken:()=>wz,hashPayload:()=>d1,unpackEventFromToken:()=>z2,validateEvent:()=>Q2,validateEventKind:()=>q2,validateEventMethodTag:()=>Y2,validateEventPayloadTag:()=>Z2,validateEventTimestamp:()=>K2,validateEventUrlTag:()=>j2,validateToken:()=>Sz});var W2="Nostr ";async function wz(t,e,n,i=!1,s){const r={kind:ZT,tags:[["u",t],["method",e]],created_at:Math.round(new Date().getTime()/1e3),content:""};s&&r.tags.push(["payload",d1(s)]);const o=await n(r);return(i?W2:"")+Fr.encode(ks.encode(JSON.stringify(o)))}a(wz,"getToken");async function Sz(t,e,n){const i=await z2(t).catch(r=>{throw r});return await Q2(i,e,n).catch(r=>{throw r})}a(Sz,"validateToken");async function z2(t){if(!t)throw new Error("Missing token");t=t.replace(W2,"");const e=fo.decode(Fr.decode(t));if(!e||e.length===0||!e.startsWith("{"))throw new Error("Invalid token");return JSON.parse(e)}a(z2,"unpackEventFromToken");function K2(t){return t.created_at?Math.round(new Date().getTime()/1e3)-t.created_at<60:!1}a(K2,"validateEventTimestamp");function q2(t){return t.kind===ZT}a(q2,"validateEventKind");function j2(t,e){const n=t.tags.find(i=>i[0]==="u");return n?n.length>0&&n[1]===e:!1}a(j2,"validateEventUrlTag");function Y2(t,e){const n=t.tags.find(i=>i[0]==="method");return n?n.length>0&&n[1].toLowerCase()===e.toLowerCase():!1}a(Y2,"validateEventMethodTag");function d1(t){const e=ns(ks.encode(JSON.stringify(t)));return qt(e)}a(d1,"hashPayload");function Z2(t,e){const n=t.tags.find(s=>s[0]==="payload");if(!n)return!1;const i=d1(e);return n.length>0&&n[1]===i}a(Z2,"validateEventPayloadTag");async function Q2(t,e,n,i){if(!ou(t))throw new Error("Invalid nostr event, signature invalid");if(!q2(t))throw new Error("Invalid nostr event, kind invalid");if(!K2(t))throw new Error("Invalid nostr event, created_at timestamp invalid");if(!j2(t,e))throw new Error("Invalid nostr event, url tag invalid");if(!Y2(t,n))throw new Error("Invalid nostr event, method tag invalid");if(i&&typeof i=="object"&&Object.keys(i).length>0&&!Z2(t,i))throw new Error("Invalid nostr event, payload tag does not match request body hash");return!0}a(Q2,"validateEvent2");var Ja=Symbol("verified"),Tz=a(t=>t instanceof Object,"isRecord");function Az(t){if(!Tz(t)||typeof t.kind!="number"||typeof t.content!="string"||typeof t.created_at!="number"||typeof t.pubkey!="string"||!t.pubkey.match(/^[a-f0-9]{64}$/)||!Array.isArray(t.tags))return!1;for(let e=0;e<t.tags.length;e++){let n=t.tags[e];if(!Array.isArray(n))return!1;for(let i=0;i<n.length;
3i++)if(typeof n[i]!="string")return!1}return!0}a(Az,"validateEvent");var xz=new TextDecoder("utf-8"),u1=new TextEncoder;function Zu(t){try{t.indexOf("://")===-1&&(t="wss://"+t);let e=new URL(t);return e.protocol==="http:"?e.protocol="ws:":e.protocol==="https:"&&(e.protocol="wss:"),e.pathname=e.pathname.replace(/\/+/g,"/"),e.pathname.endsWith("/")&&(e.pathname=e.pathname.slice(0,-1)),(e.port==="80"&&e.protocol==="ws:"||e.port==="443"&&e.protocol==="wss:")&&(e.port=""),e.searchParams.sort(),e.hash="",e.toString()}catch{throw new Error(`Invalid URL: ${t}`)}}a(Zu,"normalizeURL");var rp,Iz=(rp=class{generateSecretKey(){return Tr.utils.randomSecretKey()}getPublicKey(e){return qt(Tr.getPublicKey(e))}finalizeEvent(e,n){const i=e;return i.pubkey=qt(Tr.getPublicKey(n)),i.id=Tb(i),i.sig=qt(Tr.sign(rn(Tb(i)),n)),i[Ja]=!0,i}verifyEvent(e){if(typeof e[Ja]=="boolean")return e[Ja];const n=Tb(e);if(n!==e.id)return e[Ja]=!1,!1;try{const i=Tr.verify(rn(e.sig),rn(n),rn(e.pubkey));return e[Ja]=i,i}catch{return e[Ja]=!1,!1}}},a(rp,"JS"),rp);function Lz(t){if(!Az(t))throw new Error("can't serialize event with wrong or missing properties");return JSON.stringify([0,t.pubkey,t.created_at,t.kind,t.tags,t.content])}a(Lz,"serializeEvent");function Tb(t){let e=ns(u1.encode(Lz(t)));return qt(e)}a(Tb,"getEventHash");var uy=new Iz;uy.generateSecretKey;var lk=uy.getPublicKey,Rz=uy.finalizeEvent,J2=uy.verifyEvent,X2=1,eN=65535;function Ab(t,e){const n=iy.getSharedSecret(t,rn("02"+e)).subarray(1,33);return JO(ns,n,u1.encode("nip44-v2"))}a(Ab,"getConversationKey");function tN(t,e){const n=XO(ns,t,e,76);return{chacha_key:n.subarray(0,32),chacha_nonce:n.subarray(32,44),hmac_key:n.subarray(44,76)}}a(tN,"getMessageKeys");function nN(t){if(!Number.isSafeInteger(t)||t<1)throw new Error("expected positive integer");if(t<=32)return 32;const e=1<<Math.floor(Math.log2(t-1))+1,n=e<=256?32:e/8;return n*(Math.floor((t-1)/n)+1)}a(nN,"calcPaddedLen");function kz(t){if(!Number.isSafeInteger(t)||t<X2||t>eN)throw new Error("invalid plaintext size: must be between 1 and 65535 bytes");const e=new Uint8Array(2);return new DataView(e.buffer).setUint16(0,t,!1),e}a(kz,"writeU16BE");function Mz(t){const e=u1.encode(t),n=e.length,i=kz(n),s=new Uint8Array(nN(n)-n);return pi(i,e,s)}a(Mz,"pad");function Cz(t){const e=new DataView(t.buffer).getUint16(0),n=t.subarray(2,2+e);if(e<X2||e>eN||n.length!==e||t.length!==2+nN(e))throw new Error("invalid padding");return xz.decode(n)}a(Cz,"unpad");function iN(t,e,n){if(n.length!==32)throw new Error("AAD associated data must be 32 bytes");const i=pi(n,e);return ru(ns,t,i)}a(iN,"hmacAad");function Pz(t){if(typeof t!="string")throw new Error("payload must be a valid string");const e=t.length;if(e<132||e>87472)throw new Error("invalid payload length: "+e);if(t[0]==="#")throw new Error("unknown encryption version");let n;try{n=Fr.decode(t)}catch(r){throw new Error("invalid base64: "+r.message)}const i=n.length;if(i<99||i>65603)throw new Error("invalid data length: "+i);const s=n[0];if(s!==2)throw new Error("unknown encryption version "+s);return{nonce:n.subarray(1,33),ciphertext:n.subarray(33,-32),mac:n.subarray(-32)}}a(Pz,"decodePayload");function Dz(t,e,n=ec(32)){const{chacha_key:i,chacha_nonce:s,hmac_key:r}=tN(e,n),o=Mz(t),l=sy(i,s,o),d=iN(r,l,n);return Fr.encode(pi(new Uint8Array([2]),n,l,d))}a(Dz,"encrypt$1");function ck(t,e){const{nonce:n,ciphertext:i,mac:s}=Pz(t),{chacha_key:r,chacha_nonce:o,hmac_key:l}=tN(e,n),d=iN(l,i,n);if(!WO(d,s))throw new Error("invalid MAC");const c=sy(r,o,i);return Cz(c)}a(ck,"decrypt$1");var Oz=/^(?:([\w.+-]+)@)?([\w_-]+(\.[\w_-]+)+)$/,Nz;try{Nz=fetch}catch{}var Fz=22242,xb=24133;function Uz(t,e){if(t.ids&&t.ids.indexOf(e.id)===-1||t.kinds&&t.kinds.indexOf(e.kind)===-1||t.authors&&t.authors.indexOf(e.pubkey)===-1)return!1;for(let n in t)if(n[0]==="#"){let i=n.slice(1),s=t[`#${i}`];if(s&&!e.tags.find(([r,o])=>r===n.slice(1)&&s.indexOf(o)!==-1))return!1}return!(t.since&&e.created_at<t.since||t.until&&e.created_at>t.until)}a(Uz,"matchFilter");function Bz(t,e){for(let n=0;n<t.length;n++)if(Uz(t[n],e))return!0;return!1}a(Bz,"matchFilters");function $z(t,e){let n=e.length+3,i=t.indexOf(`"${e}":`)+n,s=t.slice(i).indexOf('"')+i+1;return t.slice(s,s+64)}a($z,"getHex64");function Hz(t){let e=t.slice(0,22).indexOf('"EVENT"');if(e===-1)return null;let n=t.slice(e+7+1).indexOf('"');if(n===-1)return null;let i=e+7+1+n,s=t.slice(i+1,80).indexOf('"');if(s===-1)return null;let r=i+1+s;return t.slice(i+1,r)}a(Hz,"getSubscriptionId");function Gz(t,e){return{kind:Fz,created_at:Math.floor(Date.now()/1e3),tags:[["relay",t],["challenge",e]],content:""}}a(Gz,"makeAuthEvent");
3var op,sN=(op=class extends Error{constructor(e,n){super(`Tried to send message '${e} on a closed connection to ${n}.`),this.name="SendingOnClosedConnection"}},a(op,"SendingOnClosedConnection"),op),ap,rN=(ap=class{url;_connected=!1;onclose=null;onnotice=e=>console.debug(`NOTICE from ${this.url}: ${e}`);onauth;baseEoseTimeout=4400;publishTimeout=4400;pingFrequency=29e3;pingTimeout=2e4;resubscribeBackoff=[1e4,1e4,1e4,2e4,2e4,3e4,6e4];openSubs=new Map;enablePing;enableReconnect;idleSince=Date.now();ongoingOperations=0;reconnectTimeoutHandle;pingIntervalHandle;reconnectAttempts=0;skipReconnection=!1;connectionPromise;openCountRequests=new Map;openEventPublishes=new Map;ws;challenge;authPromise;serial=0;verifyEvent;_WebSocket;constructor(e,n){this.url=Zu(e),this.verifyEvent=n.verifyEvent,this._WebSocket=n.websocketImplementation||WebSocket,this.enablePing=n.enablePing,this.enableReconnect=n.enableReconnect||!1}static async connect(e,n){const i=new rN(e,n);return await i.connect(n),i}closeAllSubscriptions(e){for(let[n,i]of this.openSubs)i.close(e);this.openSubs.clear();for(let[n,i]of this.openEventPublishes)i.reject(new Error(e));this.openEventPublishes.clear();for(let[n,i]of this.openCountRequests)i.reject(new Error(e));this.openCountRequests.clear()}get connected(){return this._connected}async reconnect(){const e=this.resubscribeBackoff[Math.min(this.reconnectAttempts,this.resubscribeBackoff.length-1)];this.reconnectAttempts++,this.reconnectTimeoutHandle=setTimeout(async()=>{try{await this.connect()}catch{}},e)}handleHardClose(e){this.pingIntervalHandle&&(clearInterval(this.pingIntervalHandle),this.pingIntervalHandle=void 0),this._connected=!1,this.connectionPromise=void 0,this.idleSince=void 0,this.enableReconnect&&!this.skipReconnection?this.reconnect():(this.onclose?.(),this.closeAllSubscriptions(e))}async connect(e){let n;return this.connectionPromise?this.connectionPromise:(this.challenge=void 0,this.authPromise=void 0,this.skipReconnection=!1,this.connectionPromise=new Promise((i,s)=>{e?.timeout&&(n=setTimeout(()=>{s("connection timed out"),this.connectionPromise=void 0,this.skipReconnection=!0,this.onclose?.(),this.handleHardClose("relay connection timed out")},e.timeout)),e?.abort&&(e.abort.onabort=s);try{this.ws=new this._WebSocket(this.url)}catch(r){clearTimeout(n),s(r);return}this.ws.onopen=()=>{this.reconnectTimeoutHandle&&(clearTimeout(this.reconnectTimeoutHandle),this.reconnectTimeoutHandle=void 0),clearTimeout(n),this._connected=!0;const r=this.reconnectAttempts>0;this.reconnectAttempts=0;for(const o of this.openSubs.values()){if(o.eosed=!1,r)for(let l=0;l<o.filters.length;l++)o.lastEmitted&&(o.filters[l].since=o.lastEmitted+1);o.fire()}this.enablePing&&(this.pingIntervalHandle=setInterval(()=>this.pingpong(),this.pingFrequency)),i()},this.ws.onerror=()=>{clearTimeout(n),s("connection failed"),this.connectionPromise=void 0,this.skipReconnection=!0,this.onclose?.(),this.handleHardClose("relay connection failed")},this.ws.onclose=r=>{clearTimeout(n),s(r.message||"websocket closed"),this.handleHardClose("relay connection closed")},this.ws.onmessage=this._onmessage.bind(this)}),this.connectionPromise)}waitForPingPong(){return new Promise(e=>{this.ws.once("pong",()=>e(!0)),this.ws.ping()})}waitForDummyReq(){return new Promise((e,n)=>{if(!this.connectionPromise)return n(new Error(`no connection to ${this.url}, can't ping`));try{const i=this.subscribe([{ids:["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"],limit:0}],{label:"<forced-ping>",oneose:()=>{e(!0),i.close()},onclose(){e(!0)},eoseTimeout:this.pingTimeout+1e3})}catch(i){n(i)}})}async pingpong(){this.ws?.readyState===1&&(await Promise.any([this.ws&&this.ws.ping&&this.ws.once?this.waitForPingPong():this.waitForDummyReq(),new Promise(n=>setTimeout(()=>n(!1),this.pingTimeout))])||this.ws?.readyState===this._WebSocket.OPEN&&this.ws?.close())}async send(e){if(!this.connectionPromise)throw new sN(e,this.url);this.connectionPromise.then(()=>{this.ws?.send(e)})}async auth(e){const n=this.challenge;if(!n)throw new Error("can't perform auth, no challenge was received");return this.authPromise?this.authPromise:(this.authPromise=new Promise(async(i,s)=>{try{let r=await e(Gz(this.url,n)),o=setTimeout(()=>{let l=this.openEventPublishes.get(r.id);l&&(l.reject(new Error("auth timed out")),this.openEventPublishes.delete(r.id))},this.publishTimeout);this.openEventPublishes.set(r.id,{resolve:i,reject:s,timeout:o}),this.send('["AUTH",'+JSON.stringify(r)+"]")}catch(r){console.warn("subscribe auth function failed:",r)}}),this.authPromise)}async publish(e){this.idleSince=void 0,this.ongoingOperations++;const n=new Promise((i,s)=>{const r=setTimeout(()=>{const o=this.openEventPublishes.get(e.id);o&&(o.reject(new Error("publish timed out")),this.openEventPublishes.delete(e.id))},this.publishTimeout);this.openEventPublishes.set(e.id,{resolve:i,reject:s,timeout:r})});return this.send('["EVENT",'+JSON.stringify(e)+"]"),this.ongoingOperations--,this.ongoingOperations===0&&(this.idleSince=Date.now()),n}async count(e,n){this.serial++;const i=n?.id||"count:"+this.serial,s=new Promise((r,o)=>{this.openCountRequests.set(i,{resolve:r,reject:o})});return this.send('["COUNT","'+i+'",'+JSON.stringify(e).substring(1)),s}subscribe(e,n){n.label!=="<forced-ping>"&&(this.idleSince=void 0,this.ongoingOperations++);const i=this.prepareSubscription(e,n);return i.fire(),n.abort&&(n.abort.onabort=()=>i.close(String(n.abort.reason||"<aborted>"))),i}prepareSubscription(e,n){this.serial++;const i=n.id||(n.label?n.label+":":"sub:")+this.serial,s=new Vz(this,i,e,n);return this.openSubs.set(i,s),s}close(){this.skipReconnection=!0,this.reconnectTimeoutHandle&&(clearTimeout(this.reconnectTimeoutHandle),this.reconnectTimeoutHandle=void 0),this.pingIntervalHandle&&(clearInterval(this.pingIntervalHandle),this.pingIntervalHandle=void 0),this.closeAllSubscriptions("relay connection closed by us"),this._connected=!1,this.idleSince=void 0,this.onclose?.(),this.ws?.readyState===this._WebSocket.OPEN&&this.ws?.close()}_onmessage(e){const n=e.data;if(!n)return;const i=Hz(n);if(i){const s=this.openSubs.get(i);if(!s)return;const r=$z(n,"id"),o=s.alreadyHaveEvent?.(r);
3if(s.receivedEvent?.(this,r),o)return}try{let s=JSON.parse(n);switch(s[0]){case"EVENT":{const r=this.openSubs.get(s[1]),o=s[2];this.verifyEvent(o)&&Bz(r.filters,o)&&r.onevent(o),(!r.lastEmitted||r.lastEmitted<o.created_at)&&(r.lastEmitted=o.created_at);return}case"COUNT":{const r=s[1],o=s[2],l=this.openCountRequests.get(r);l&&(l.resolve(o.count),this.openCountRequests.delete(r));return}case"EOSE":{const r=this.openSubs.get(s[1]);if(!r)return;r.receivedEose();return}case"OK":{const r=s[1],o=s[2],l=s[3],d=this.openEventPublishes.get(r);d&&(clearTimeout(d.timeout),o?d.resolve(l):d.reject(new Error(l)),this.openEventPublishes.delete(r));return}case"CLOSED":{const r=s[1],o=this.openSubs.get(r);if(!o)return;o.closed=!0,o.close(s[2]);return}case"NOTICE":{this.onnotice(s[1]);return}case"AUTH":{this.challenge=s[1],this.onauth&&this.auth(this.onauth);return}default:{this.openSubs.get(s[1])?.oncustom?.(s);return}}}catch(s){const[r,o,l]=JSON.parse(n);window.printer.maybe(l.pubkey,":: caught err",l,this.url,s);return}}},a(ap,"AbstractRelay"),ap),lp,Vz=(lp=class{relay;id;lastEmitted;closed=!1;eosed=!1;filters;alreadyHaveEvent;receivedEvent;onevent;oneose;onclose;oncustom;eoseTimeout;eoseTimeoutHandle;constructor(e,n,i,s){if(i.length===0)throw new Error("subscription can't be created with zero filters");this.relay=e,this.filters=i,this.id=n,this.alreadyHaveEvent=s.alreadyHaveEvent,this.receivedEvent=s.receivedEvent,this.eoseTimeout=s.eoseTimeout||e.baseEoseTimeout,this.oneose=s.oneose,this.onclose=s.onclose,this.onevent=s.onevent||(r=>{console.warn(`onevent() callback not defined for subscription '${this.id}' in relay ${this.relay.url}. event received:`,r)})}fire(){this.relay.send('["REQ","'+this.id+'",'+JSON.stringify(this.filters).substring(1)),this.eoseTimeoutHandle=setTimeout(this.receivedEose.bind(this),this.eoseTimeout)}receivedEose(){this.eosed||(clearTimeout(this.eoseTimeoutHandle),this.eosed=!0,this.oneose?.())}close(e="closed by caller"){if(!this.closed&&this.relay.connected){try{this.relay.send('["CLOSE",'+JSON.stringify(this.id)+"]")}catch(n){if(!(n instanceof sN))throw n}this.closed=!0}this.relay.openSubs.delete(this.id),this.relay.ongoingOperations--,this.relay.ongoingOperations===0&&(this.relay.idleSince=Date.now()),this.onclose?.(e)}},a(lp,"Subscription"),lp),Wz=a(t=>(t[Ja]=!0,!0),"alwaysTrue"),cp,zz=(cp=class{relays=new Map;seenOn=new Map;trackRelays=!1;verifyEvent;enablePing;enableReconnect;automaticallyAuth;trustedRelayURLs=new Set;onRelayConnectionFailure;onRelayConnectionSuccess;allowConnectingToRelay;maxWaitForConnection;_WebSocket;constructor(e){this.verifyEvent=e.verifyEvent,this._WebSocket=e.websocketImplementation,this.enablePing=e.enablePing,this.enableReconnect=e.enableReconnect||!1,this.automaticallyAuth=e.automaticallyAuth,this.onRelayConnectionFailure=e.onRelayConnectionFailure,this.onRelayConnectionSuccess=e.onRelayConnectionSuccess,this.allowConnectingToRelay=e.allowConnectingToRelay,this.maxWaitForConnection=e.maxWaitForConnection||3e3}async ensureRelay(e,n){e=Zu(e);let i=this.relays.get(e);if(i||(i=new rN(e,{verifyEvent:this.trustedRelayURLs.has(e)?Wz:this.verifyEvent,websocketImplementation:this._WebSocket,enablePing:this.enablePing,enableReconnect:this.enableReconnect}),i.onclose=()=>{this.relays.delete(e)},this.relays.set(e,i)),this.automaticallyAuth){const s=this.automaticallyAuth(e);s&&(i.onauth=s)}try{await i.connect({timeout:n?.connectionTimeout,abort:n?.abort})}catch(s){throw this.relays.delete(e),s}return i}close(e){e.map(Zu).forEach(n=>{this.relays.get(n)?.close(),this.relays.delete(n)})}subscribe(e,n,i){const s=[],r=[];for(let o=0;o<e.length;o++){const l=Zu(e[o]);s.find(d=>d.url===l)||r.indexOf(l)===-1&&(r.push(l),s.push({url:l,filter:n}))}return this.subscribeMap(s,i)}subscribeMany(e,n,i){return this.subscribe(e,n,i)}subscribeMap(e,n){const i=new Map;for(const p of e){const{url:g,filter:v}=p;i.has(g)||i.set(g,[]),i.get(g).push(v)}const s=Array.from(i.entries()).map(([p,g])=>({url:p,filters:g}));this.trackRelays&&(n.receivedEvent=(p,g)=>{let v=this.seenOn.get(g);v||(v=new Set,this.seenOn.set(g,v)),v.add(p)});const r=new Set,o=[],l=[];let d=a(p=>{l[p]||(l[p]=!0,l.filter(g=>g).length===s.length&&(n.oneose?.(),d=a(()=>{},"handleEose")))},"handleEose");const c=[];let u=a((p,g)=>{c[p]||(d(p),c[p]=g,c.filter(v=>v).length===s.length&&(n.onclose?.(c),u=a(()=>{},"handleClose")))},"handleClose");
3const f=a(p=>{if(n.alreadyHaveEvent?.(p))return!0;const g=r.has(p);return r.add(p),g},"localAlreadyHaveEventHandler"),h=Promise.all(s.map(async({url:p,filters:g},v)=>{if(this.allowConnectingToRelay?.(p,["read",g])===!1){u(v,"connection skipped by allowConnectingToRelay");return}let y;try{y=await this.ensureRelay(p,{connectionTimeout:this.maxWaitForConnection<(n.maxWait||0)?Math.max(n.maxWait*.8,n.maxWait-1e3):this.maxWaitForConnection,abort:n.abort})}catch(E){this.onRelayConnectionFailure?.(p),u(v,E?.message||String(E));return}this.onRelayConnectionSuccess?.(p);let b=y.subscribe(g,{...n,oneose:()=>d(v),onclose:E=>{E.startsWith("auth-required: ")&&n.onauth?y.auth(n.onauth).then(()=>{y.subscribe(g,{...n,oneose:()=>d(v),onclose:T=>{u(v,T)},alreadyHaveEvent:f,eoseTimeout:n.maxWait,abort:n.abort})}).catch(T=>{u(v,`auth was required and attempted, but failed with: ${T}`)}):u(v,E)},alreadyHaveEvent:f,eoseTimeout:n.maxWait,abort:n.abort});o.push(b)}));return{async close(p){await h,o.forEach(g=>{g.close(p)})}}}subscribeEose(e,n,i){let s;return s=this.subscribe(e,n,{...i,oneose(){const r="closed automatically on eose";s?s.close(r):i.onclose?.(e.map(o=>r))}}),s}subscribeManyEose(e,n,i){return this.subscribeEose(e,n,i)}async querySync(e,n,i){return new Promise(async s=>{const r=[];this.subscribeEose(e,n,{...i,onevent(o){r.push(o)},onclose(o){s(r)}})})}async get(e,n,i){n.limit=1;const s=await this.querySync(e,n,i);return s.sort((r,o)=>o.created_at-r.created_at),s[0]||null}publish(e,n,i){return e.map(Zu).map(async(s,r,o)=>{if(o.indexOf(s)!==r)return Promise.reject("duplicate url");if(this.allowConnectingToRelay?.(s,["write",n])===!1)return Promise.reject("connection skipped by allowConnectingToRelay");let l;try{l=await this.ensureRelay(s,{connectionTimeout:this.maxWaitForConnection<(i?.maxWait||0)?Math.max(i.maxWait*.8,i.maxWait-1e3):this.maxWaitForConnection,abort:i?.abort})}catch(d){return this.onRelayConnectionFailure?.(s),"connection failure: "+String(d)}return l.publish(n).catch(async d=>{if(d instanceof Error&&d.message.startsWith("auth-required: ")&&i?.onauth)return await l.auth(i.onauth),l.publish(n);throw d}).then(d=>{if(this.trackRelays){let c=this.seenOn.get(n.id);c||(c=new Set,this.seenOn.set(n.id,c)),c.add(l)}return d})})}listConnectionStatus(){const e=new Map;return this.relays.forEach((n,i)=>e.set(i,n.connected)),e}destroy(){this.relays.forEach(e=>e.close()),this.relays=new Map}pruneIdleRelays(e=1e4){const n=[];for(const[i,s]of this.relays)s.idleSince&&Date.now()-s.idleSince>=e&&(this.relays.delete(i),n.push(i),s.close());return n}},a(cp,"AbstractSimplePool"),cp),oN;try{oN=WebSocket}catch{}var dp,Kz=(dp=class extends zz{constructor(e){super({verifyEvent:J2,websocketImplementation:oN,maxWaitForConnection:3e3,...e})}},a(dp,"SimplePool"),dp),aN;try{aN=fetch}catch{}var qz=/^bunker:\/\/([0-9a-f]{64})\??([?\/\w:.=&%-]*)$/;async function jz(t){let e=t.match(qz);if(e)try{const n=e[1],i=new URLSearchParams(e[2]);return{pubkey:n,relays:i.getAll("relay"),secret:i.get("secret")}}catch{}return Yz(t)}a(jz,"parseBunkerInput");async function Yz(t){const e=t.match(Oz);if(!e)return null;const[n,i="_",s]=e;try{const r=`https://${s}/.well-known/nostr.json?name=${i}`,o=await(await aN(r,{redirect:"error"})).json();let l=o.names[i],d=o.nip46[l]||[];return{pubkey:l,relays:d,secret:null}}catch{return null}}a(Yz,"queryBunkerProfile");function Zz(t){const e=new URLSearchParams;return t.relays.forEach(n=>{e.append("relay",n)}),e.append("secret",t.secret),t.perms&&t.perms.length>0&&e.append("perms",t.perms.join(",")),t.name&&e.append("name",t.name),t.url&&e.append("url",t.url),t.image&&e.append("image",t.image),`nostrconnect://${t.clientPubkey}?${e.toString()}`}a(Zz,"createNostrConnectURI");var up,m_=(up=class{params;pool;subCloser;isOpen;serial;idPrefix;listeners;waitingForAuth;secretKey;conversationKey;bp;cachedPubKey;constructor(e,n){this.params=n,this.pool=n.pool||new Kz,this.secretKey=e,this.isOpen=!1,this.idPrefix=Math.random().toString(36).substring(7),this.serial=0,this.listeners={},this.waitingForAuth={}}static fromBunker(e,n,i={}){if(n.relays.length===0)throw new Error("no relays specified for this bunker");const s=new m_(e,i);return s.conversationKey=Ab(e,n.pubkey),s.bp=n,s.setupSubscription(),s}static async fromURI(e,n,i={},s=3e5){const r=new m_(e,i),o=new URL(n),l=lk(e);return new Promise((d,c)=>{let u=!1;const f=r.pool.subscribe(o.searchParams.getAll("relay"),{kinds:[xb],"#p":[l],limit:0},{onevent:async h=>{try{const p=Ab(e,h.pubkey),g=ck(h.content,p);JSON.parse(g).result===o.searchParams.get("secret")&&(f.close(),r.bp={pubkey:h.pubkey,relays:o.searchParams.getAll("relay"),secret:o.searchParams.get("secret")},r.conversationKey=Ab(e,h.pubkey),r.setupSubscription(),u=!0,await Promise.race([new Promise(y=>setTimeout(y,1e3)),r.switchRelays()]),d(r))}catch(p){console.warn("failed to process potential connection event",p)}},onclose:()=>{u||c(new Error("subscription closed before connection was established."))},maxWait:typeof s=="number"?s:void 0,abort:typeof s!="number"?s:void 0})})}setupSubscription(){const e=this.listeners,n=this.waitingForAuth,i=this.conversationKey;this.subCloser=this.pool.subscribe(this.bp.relays,{kinds:[xb],authors:[this.bp.pubkey],"#p":[lk(this.secretKey)],limit:0},{onevent:async s=>{const r=JSON.parse(ck(s.content,i)),{id:o,result:l,error:d}=r;if(l==="auth_url"&&n[o]){delete n[o],this.params.onauth?this.params.onauth(d):console.warn(`nostr-tools/nip46: remote signer ${this.bp.pubkey} tried to send an "auth_url"='${d}' but there was no onauth() callback configured.`);return}let c=e[o];c&&(d?c.reject(d):l&&c.resolve(l),delete e[o])},onclose:()=>{this.subCloser=void 0}}),this.isOpen=!0}async switchRelays(){try{const e=await this.sendRequest("switch_relays",[]);let n=JSON.parse(e);if(!n||JSON.stringify(n.sort())===JSON.stringify(this.bp.relays))return!1;this.bp.relays=n;let i=this.subCloser;return setTimeout(()=>{i.close()},5e3),this.subCloser=void 0,this.setupSubscription(),!0}catch{return!1}}async close(){this.isOpen=!1,this.subCloser.close()}async sendRequest(e,n){return new Promise(async(i,s)=>{try{if(!this.isOpen)throw new Error("this signer is not open anymore, create a new one");this.subCloser||this.setupSubscription(),this.serial++;const r=`${this.idPrefix}-${this.serial}`,o=Dz(JSON.stringify({id:r,method:e,params:n}),this.conversationKey),l=Rz({kind:xb,tags:[["p",this.bp.pubkey]],content:o,created_at:Math.floor(Date.now()/1e3)},this.secretKey);this.listeners[r]={resolve:i,reject:s},this.waitingForAuth[r]=!0,await Promise.any(this.pool.publish(this.bp.relays,l))}catch(r){s(r)}})}async ping(){let e=await this.sendRequest("ping",[]);if(e!=="pong")throw new Error(`result is not pong: ${e}`)}async connect(){await this.sendRequest("connect",[this.bp.pubkey,this.bp.secret||""])}async getPublicKey(){return this.cachedPubKey||(this.cachedPubKey=await this.sendRequest("get_public_key",[])),this.cachedPubKey}async signEvent(e){let n=await this.sendRequest("sign_event",[JSON.stringify(e)]),i=JSON.parse(n);if(J2(i))return i;throw new Error(`event returned from bunker is improperly signed: ${JSON.stringify(i)}`)}async nip04Encrypt(e,n){return await this.sendRequest("nip04_encrypt",[e,n])}async nip04Decrypt(e,n){return await this.sendRequest("nip04_decrypt",[e,n])}async nip44Encrypt(e,n){return await this.sendRequest("nip44_encrypt",[e,n])}async nip44Decrypt(e,n){return await this.sendRequest("nip44_decrypt",[e,n])}},a(up,"BunkerSigner"),up);const xve=a(t=>new y2(t),"relayInit"),lN=a(()=>Ce.nsecEncode(Ks()),"generateNsec"),Ii=a(t=>{try{return t?Ce.npubEncode(t):""}catch(e){return console.warn(`Invalid pubkey hex ${t}: `,e),""}},"hexToNpub"),au=a(t=>{try{const e=Ce.decode(t);
3return e?typeof e.data=="string"?e.data:e.data.pubkey:""}catch{return console.error("nip19 decode error"),""}},"npubToHex"),Mp=a(t=>{try{return Ce.decode(t)}catch(e){return ii("Failed to decode identifier: ",e),{type:"error",data:t}}},"decodeIdentifier"),cN=a(t=>{let e=t;try{const n=Ce.decode(t);switch(n.type){case"note":e=n.data;break;case"nevent":e=n.data.id;break}}catch(n){console.log("Error decoding: ",t,n)}return e},"noteIdToHex"),Qz=a((t,e,n=0,i=20,s=0,r=0)=>{let o={limit:i,offset:r,pubkey:t,kind:G.LongForm};n>0&&(o.until=n),s>0&&(o.since=s),Ae(JSON.stringify(["REQ",e,{cache:["drafts",o]}]))},"getDrafts"),Jz=a((t,e,n,i,s=0,r=20,o=0,l=0)=>{let d={spec:e,limit:r,offset:l,kinds:i};s>0&&(d.until=s),o>0&&(d.since=o),t&&(d.user_pubkey=t),Ae(JSON.stringify(["REQ",n,{cache:["multi_kind_mega_feed_directive",d]}]))},"getMultiFeed"),Xz=a((t,e,n,i=0,s=20,r=0,o=0)=>{if(e.includes('"kind":"drafts"')){Qz(t,n,i,s,r,o);return}let l={spec:e,limit:s,offset:o};i>0&&(l.until=i),r>0&&(l.since=r),t&&(l.user_pubkey=t),Ae(JSON.stringify(["REQ",n,{cache:["mega_feed_directive",l]}]))},"getMegaFeed"),lu=a((t,e,n,i)=>{let s={event_ids:e};t&&(s.user_pubkey=t),i&&(s.extended_response=i),Ae(JSON.stringify(["REQ",n,{cache:["events",s]}]))},"getEvents"),eK=a((t,e,n,i,s=0,r=20,o=0)=>{if(!e)return;let l={pubkey:e,limit:r,notes:i};t&&(l.user_pubkey=t),s>0&&(l.until=s),o>0&&(l.offset=o),Ae(JSON.stringify(["REQ",n,{cache:["long_form_content_feed",l]}]))},"getUserArticleFeed"),tK=a((t,e,n,i)=>{if(!e)return;let s={pubkey:e,since:i,notes:"authored",limit:100};t&&(s.user_pubkey=t),Ae(JSON.stringify(["REQ",n,{cache:["feed",s]}]))},"getFutureUserFeed"),nK=a((t,e,n,i=0,s=100)=>{let r=e.startsWith("nevet1")?cN(e):e;if(r.length===0)return;let o={event_id:r,limit:s,kinds:[G.Text,G.Repost,G.UserPoll,G.ZapPoll]};t&&(o.user_pubkey=t),Ae(JSON.stringify(["REQ",n,{cache:["multi_kind_thread_view",o]}]))},"getMultiThread"),iK=a((t,e,n,i=0,s=100)=>{let r=cN(e);if(r.length===0)return;let o={event_id:r,limit:s};t&&(o.user_pubkey=t),Ae(JSON.stringify(["REQ",n,{cache:["thread_view",o]}]))},"getThread"),sK=a((t,e,n,i,s,r=0,o=100)=>{let l={pubkey:e,identifier:n,kind:i,limit:o};t&&(l.user_pubkey=t),Ae(JSON.stringify(["REQ",s,{cache:["long_form_content_thread_view",l]}]))},"getArticleThread"),rK=a((t,e,n,i,s=0,r=20)=>{let o={timeframe:i,scope:n,limit:r};if(t&&(o.user_pubkey=t),s>0&&(o.until=s),i==="trending"){const l=Math.floor((new Date().getTime()-w9)/1e3);o.created_after=l}if(i==="mostzapped4h"){const l=Math.floor((new Date().getTime()-4*XD)/1e3);o.timeframe="mostzapped",o.created_after=l}Ae(JSON.stringify(["REQ",e,{cache:["explore",o]}]))},"getExploreFeed"),Ive=a(t=>{Ae(JSON.stringify(["REQ",t,{cache:["get_reads_topics"]}]))},"getReadsTopics"),Lve=a(t=>{Ae(JSON.stringify(["REQ",t,{cache:["get_featured_authors"]}]))},"getFeaturedAuthors"),Rve=a((t,e)=>{t&&Ae(JSON.stringify(["REQ",e,{cache:["creator_paid_tiers",{pubkey:t}]}]))},"getAuthorSubscriptionTiers"),dk=a(t=>{Ae(JSON.stringify(["REQ",t,{cache:["get_reads_feeds"]}]))},"fetchDefaultArticleFeeds"),uk=a(t=>{Ae(JSON.stringify(["REQ",t,{cache:["get_home_feeds"]}]))},"fetchDefaultHomeFeeds"),kve=a((t,e,n)=>{const i=n?{kind:n}:{};t&&(i.user_pubkey=t),Ae(JSON.stringify(["REQ",e,{cache:["get_featured_dvm_feeds",{...i}]}]))},"fetchDVMFeeds"),Mve=a((t,e,n,i)=>{const s={identifier:n,pubkey:i};t&&(s.user_pubkey=t),Ae(JSON.stringify(["REQ",e,{cache:["dvm_feed_info",{...s}]}]))},"fetchDVM"),oK={media:{},mediaStats:{video:0,image:0,other:0},thumbnails:{},windowSize:{w:window.innerWidth,h:window.innerHeight},liveEvents:[],videoAutoplay:[],hlsVideos:{}},dN=Pn(),aK=a(t=>{const e=a((E,T,I)=>{const M=y.media[E]||[],H=a($=>T?T===$:!0,"isOfSize"),N=a($=>I!==void 0?I===!!$:!0,"isAnimated");return M.find($=>H($.s)&&N($.a))},"getMedia"),n=a((E,T,I)=>E?e(E,T,I)?.media_url:void 0,"getMediaUrl"),i=a(()=>{b("windowSize",()=>({w:window.innerWidth,h:window.innerHeight}))},"onResize");let s=!1;const r=a(E=>{s&&E.target.scrollIntoView(),s=!s},"onFullscreenChange"),o=a(E=>{},"addVideo"),l=a(E=>{if(E)return y.thumbnails[E]},"getThumbnail"),d=a((E,T)=>{const I=y.liveEvents;let M=I.find(H=>H.hosts?.[0]===E&&(T?H.status==="live":!0));return M||I.find(H=>H.pubkey===E&&(T?H.status==="live":!0))},"getStream"),c=a(E=>y.liveEvents.find(I=>I.id===E),"getStreamByIdentifier"),u=a(E=>
3y.liveEvents.filter(I=>I.status==="live"&&I.hosts?.find(M=>M===E)!==void 0).length>0,"isStreaming"),f=a(E=>{b("videoAutoplay",T=>T.filter(I=>I!==E))},"removeAutoplayVideo"),h=a(E=>{const T=localStorage.getItem("hlsProvider");if(!T)return E;const I=y.hlsVideos[`${E}`]?.find(M=>M.provider===T);return I?I.hls_url:E},"findHLS"),p=a(E=>{if(E.kind===G.MediaInfo){const T=JSON.parse(E.content);let I={};for(let M=0;M<T.resources.length;M++){const H=T.resources[M];I[H.url]=H.variants}try{b("media",()=>({...I})),T.thumbnails&&b("thumbnails",M=>({...M,...T.thumbnails}))}catch(M){console.warn("Error updating media: ",M)}}if(E.kind===G.MediaStats){const T=JSON.parse(E.content);b("mediaStats",()=>({...T}))}if(E.kind===G.LiveEvent){const T={id:(E.tags?.find(M=>M[0]==="d")||[])[1],url:(E.tags?.find(M=>M[0]==="streaming")||[])[1],image:(E.tags?.find(M=>M[0]==="image")||[])[1],status:(E.tags?.find(M=>M[0]==="status")||[])[1],starts:parseInt((E.tags?.find(M=>M[0]==="starts")||["","0"])[1]),summary:(E.tags?.find(M=>M[0]==="summary")||[])[1],title:(E.tags?.find(M=>M[0]==="title")||[])[1],client:(E.tags?.find(M=>M[0]==="client")||[])[1],currentParticipants:parseInt((E.tags?.find(M=>M[0]==="current_participants")||["","0"])[1]||"0"),pubkey:E.pubkey,event:{...E},hosts:(E.tags||[]).filter(M=>M[0]==="p"&&M[3].toLowerCase()==="host").map(M=>M[1]),participants:(E.tags||[]).filter(M=>M[0]==="p").map(M=>M[1])},I=y.liveEvents.findIndex(M=>M.id===T.id&&M.pubkey===T.pubkey);if(I<0){b("liveEvents",y.liveEvents.length,()=>({...T}));return}b("liveEvents",I,()=>({...T}));return}if(E.kind===G.HLSVideo){const T=JSON.parse(E.content);if(!T)return;const I=Object.keys(T);for(let M=0;M<I.length;M++){const H=I[M];H!=="event_id"&&b("hlsVideos",()=>({[H]:T[H]}))}}},"handleMediaEvent"),g=a(async E=>{const T=await su(E),I=JSON.parse(T),[M,H,N]=I;if(M==="EVENTS")for(let $=0;$<N.length;$++){const F=N[$];p(F)}M==="EVENT"&&p(N)},"onMessage"),v=a(E=>{const T=E.target;Da(T,{message:g,close:v})},"onSocketClose");Or(()=>{window.addEventListener("resize",i),window.addEventListener("fullscreenchange",r)}),Tt(()=>{window.removeEventListener("resize",i),window.removeEventListener("fullscreenchange",r)}),We(()=>{Pa()&&Qv(yn(),{message:g,close:v})}),Tt(()=>{Da(yn(),{message:g,close:v})});const[y,b]=li({...oK,actions:{getMedia:e,getMediaUrl:n,addVideo:o,getThumbnail:l,getStream:d,getStreamByIdentifier:c,isStreaming:u,removeAutoplayVideo:f,findHLS:h}});return X(dN.Provider,{value:y,get children(){return t.children}})},"MediaProvider"),f1=a(()=>Dn(dN),"useMediaContext"),lK=a(t=>t!=null,"isNonNullable"),Cve=a(t=>t.filter(lK),"filterNonNullable");function cK(t){return(...e)=>{for(const n of t)n&&n(...e)}}a(cK,"chain$3");const St=a(t=>typeof t=="function"&&!t.length?t():t,"access$1"),Pve=a(t=>Array.isArray(t)?t:t?[t]:[],"asArray$1");function dK(t,...e){return typeof t=="function"?t(...e):t}a(dK,"accessWith");const Dve=Tt;function Ove(t,e,n,i){const s=t.length,r=e.length;let o=0;if(!r){for(;o<s;o++)n(t[o]);return}if(!s){for(;o<r;o++)i(e[o]);return}for(;o<r&&e[o]===t[o];o++);let l,d;e=e.slice(o),t=t.slice(o);for(l of e)t.includes(l)||i(l);for(d of t)e.includes(d)||n(d)}a(Ove,"handleDiffArray");const uK=/((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g;function fk(t){const e={};let n;for(;n=uK.exec(t);)e[n[1]]=n[2];return e}a(fk,"stringStyleToObject");function uN(t,e){if(typeof t=="string"){if(typeof e=="string")return`${t};${e}`;t=fk(t)}else typeof e=="string"&&(e=fk(e));return{...t,...e}}a(uN,"combineStyle");function js(...t){return cK(t)}a(js,"mergeRefs");const u0=a(t=>t instanceof Element,"defaultElementPredicate");function v_(t,e){if(e(t))return t;if(typeof t=="function"&&!t.length)return v_(t(),e);if(Array.isArray(t)){const n=[];for(const i of t){const s=v_(i,e);s&&(Array.isArray(s)?n.push.apply(n,s):n.push(s))}return n.length?n:null}return null}a(v_,"getResolvedElements");function Nve(t,e=u0,n=u0){const i=ht(t),s=ht(()=>v_(i(),e));return s.toArray=()=>{const r=s();return Array.isArray(r)?r:r?[r]:[]},s}a(Nve,"resolveElements");function y_(t,e){if(e(t))return t;if(typeof t=="function"&&!t.length)return y_(t(),e);if(Array.isArray(t))for(const n of t){const i=y_(n,e);if(i)return i}return null}a(y_,"getFirstChild");function Fve(t,e=u0,n=u0){const i=ht(t);return ht(()=>y_(i(),e))}a(Fve,"resolveFirst");function Uve(t,e,n=-1){return n in t?[...t.slice(0,n),e,...t.slice(n)]:[...t,e]}a(Uve,"addItemToArray");function hk(t,e){const n=[...t],i=n.indexOf(e);return i!==-1&&n.splice(i,1),n}a(hk,"removeItemFromArray");function Bve(t){return typeof t=="number"}a(Bve,"isNumber");function fK(t){return Object.prototype.toString.call(t)==="[object String]"}a(fK,"isString");function fN(t){return typeof t=="function"}a(fN,"isFunction");function fy(t){return e=>`${t()}-${e}`}a(fy,"createGenerateId");function ho(t,e){return t?t===e||t.contains(e):!1}
3a(ho,"contains$1");function Qu(t,e=!1){const{activeElement:n}=Eo(t);if(!n?.nodeName)return null;if(hN(n)&&n.contentDocument)return Qu(n.contentDocument.body,e);if(e){const i=n.getAttribute("aria-activedescendant");if(i){const s=Eo(n).getElementById(i);if(s)return s}}return n}a(Qu,"getActiveElement$1");function $ve(t){return Eo(t).defaultView||window}a($ve,"getWindow");function Eo(t){return t?t.ownerDocument||t:document}a(Eo,"getDocument");function hN(t){return t.tagName==="IFRAME"}a(hN,"isFrame");var h1=(t=>(t.Escape="Escape",t.Enter="Enter",t.Tab="Tab",t.Space=" ",t.ArrowDown="ArrowDown",t.ArrowLeft="ArrowLeft",t.ArrowRight="ArrowRight",t.ArrowUp="ArrowUp",t.End="End",t.Home="Home",t.PageDown="PageDown",t.PageUp="PageUp",t))(h1||{});function p1(t){return typeof window>"u"||window.navigator==null?!1:window.navigator.userAgentData?.brands.some(e=>t.test(e.brand))||t.test(window.navigator.userAgent)}a(p1,"testUserAgent");function g1(t){return typeof window<"u"&&window.navigator!=null?t.test(window.navigator.userAgentData?.platform||window.navigator.platform):!1}a(g1,"testPlatform");function m1(){return g1(/^Mac/i)}a(m1,"isMac");function hK(){return g1(/^iPhone/i)}a(hK,"isIPhone");function pK(){return g1(/^iPad/i)||m1()&&navigator.maxTouchPoints>1}a(pK,"isIPad");function gK(){return hK()||pK()}a(gK,"isIOS$1");function Hve(){return m1()||gK()}a(Hve,"isAppleDevice");function Gve(){return p1(/AppleWebKit/i)&&!mK()}a(Gve,"isWebKit");function mK(){return p1(/Chrome/i)}a(mK,"isChrome");function vK(){return p1(/Android/i)}a(vK,"isAndroid");function Pr(t,e){return e&&(fN(e)?e(t):e[0](e[1],t)),t?.defaultPrevented}a(Pr,"callHandler");function f0(t){return e=>{for(const n of t)Pr(e,n)}}a(f0,"composeEventHandlers");function yK(t){return m1()?t.metaKey&&!t.ctrlKey:t.ctrlKey&&!t.metaKey}a(yK,"isCtrlKey");function no(t){if(t)if(bK())t.focus({preventScroll:!0});else{const e=EK(t);t.focus(),_K(e)}}a(no,"focusWithoutScrolling");var ag=null;function bK(){if(ag==null){ag=!1;try{document.createElement("div").focus({get preventScroll(){return ag=!0,!0}})}catch{}}return ag}a(bK,"supportsPreventScroll");function EK(t){let e=t.parentNode;const n=[],i=document.scrollingElement||document.documentElement;for(;e instanceof HTMLElement&&e!==i;)(e.offsetHeight<e.scrollHeight||e.offsetWidth<e.scrollWidth)&&n.push({element:e,scrollTop:e.scrollTop,scrollLeft:e.scrollLeft}),e=e.parentNode;return i instanceof HTMLElement&&n.push({element:i,scrollTop:i.scrollTop,scrollLeft:i.scrollLeft}),n}a(EK,"getScrollableElements");function _K(t){for(const{element:e,scrollTop:n,scrollLeft:i}of t)e.scrollTop=n,e.scrollLeft=i}a(_K,"restoreScrollPosition");var pN=["input:not([type='hidden']):not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","a[href]","area[href]","[tabindex]","iframe","object","embed","audio[controls]","video[controls]","[contenteditable]:not([contenteditable='false'])"],wK=[...pN,'[tabindex]:not([tabindex="-1"]):not([disabled])'],v1=`${pN.join(":not([hidden]),")},[tabindex]:not([disabled]):not([hidden])`,SK=wK.join(':not([hidden]):not([tabindex="-1"]),');function gN(t,e){const i=Array.from(t.querySelectorAll(v1)).filter(pk);return e&&pk(t)&&i.unshift(t),i.forEach((s,r)=>{if(hN(s)&&s.contentDocument){const o=s.contentDocument.body,l=gN(o,!1);i.splice(r,1,...l)}}),i}a(gN,"getAllTabbableIn");function pk(t){return mN(t)&&!TK(t)}a(pk,"isTabbable");function mN(t){return t.matches(v1)&&y1(t)}a(mN,"isFocusable");function TK(t){return Number.parseInt(t.getAttribute("tabindex")||"0",10)<0}a(TK,"hasNegativeTabIndex");function y1(t,e){return t.nodeName!=="#comment"&&AK(t)&&xK(t,e)&&(!t.parentElement||y1(t.parentElement,t))}a(y1,"isElementVisible$1");function AK(t){if(!(t instanceof HTMLElement)&&!(t instanceof SVGElement))return!1;const{display:e,visibility:n}=t.style;let i=e!=="none"&&n!=="hidden"&&n!=="collapse";if(i){if(!t.ownerDocument.defaultView)return i;const{getComputedStyle:s}=t.ownerDocument.defaultView,{display:r,visibility:o}=s(t);i=r!=="none"&&o!=="hidden"&&o!=="collapse"}return i}a(AK,"isStyleVisible");function xK(t,e){return!t.hasAttribute("hidden")&&(t.nodeName==="DETAILS"&&e&&e.nodeName!=="SUMMARY"?t.hasAttribute("open"):!0)}a(xK,"isAttributeVisible");function IK(t,e){return e.some(n=>n.contains(t))}a(IK,"isElementInScope");function Vve(t,e,n){const i=e?.tabbable?SK:v1,s=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode(r){return e?.from?.contains(r)?NodeFilter.FILTER_REJECT:r.matches(i)&&y1(r)&&(!n||IK(r,n))&&(!e?.accept||e.accept(r))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});return e?.from&&(s.currentNode=e.from),s}a(Vve,"getFocusableTreeWalker");function gk(t){let e=t;for(;e&&!LK(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}a(gk,"getScrollParent");function LK(t){const e=window.getComputedStyle(t);return/(auto|scroll)/.test(e.overflow+e.overflowX+e.overflowY)}a(LK,"isScrollable");function RK(){}a(RK,"noop$1");function Wve(t,e=Number.NEGATIVE_INFINITY,n=Number.POSITIVE_INFINITY){return Math.min(Math.max(t,e),n)}a(Wve,"clamp");function zve(t,e,n,i){const s=(t-(Number.isNaN(e)?0:e))%i;let r=Math.abs(s)*2>=i?t+Math.sign(s)*(i-Math.abs(s)):t-s;Number.isNaN(e)?!Number.isNaN(n)&&r>n&&(r=Math.floor(n/i)*i):r<e?r=e:!Number.isNaN(n)&&r>n&&(r=e+Math.floor((n-e)/i)*i);const o=i.toString(),l=o.indexOf("."),d=l>=0?o.length-l:0;if(d>0){const c=10**d;r=Math.round(r*c)/c}return r}a(zve,"snapValueToStep");function Kve(t,e){const[n,i]=t;let s=!1;const r=e.length;for(let o=r,l=0,d=o-1;l<o;d=l++){const[c,u]=e[l],[f,h]=e[d],[,p]=e[d===0?o-1:d-1]||[0,0],g=(u-h)*(n-c)-(c-f)*(i-u);if(h<u){if(i>=h&&i<u){if(g===0)return!0;g>0&&(i===h?i>p&&(s=!s):s=!s)}}else if(u<h){if(i>u&&i<=h){if(g===0)return!0;g<0&&(i===h?i<p&&(s=!s):s=!s)}}else if(i===u&&(n>=f&&n<=c||n>=c&&n<=f))return!0}return s}a(Kve,"isPointInPolygon");function mi(t,e){return Yt(t,e)}a(mi,"mergeDefaultProps");var Cu=new Map,mk=new Set;function vk(){if(typeof window>"u")return;const t=a(n=>{if(!n.target)return;let i=Cu.get(n.target);
3i||(i=new Set,Cu.set(n.target,i),n.target.addEventListener("transitioncancel",e)),i.add(n.propertyName)},"onTransitionStart"),e=a(n=>{if(!n.target)return;const i=Cu.get(n.target);if(i&&(i.delete(n.propertyName),i.size===0&&(n.target.removeEventListener("transitioncancel",e),Cu.delete(n.target)),Cu.size===0)){for(const s of mk)s();mk.clear()}},"onTransitionEnd");document.body.addEventListener("transitionrun",t),document.body.addEventListener("transitionend",e)}a(vk,"setupGlobalEvents");typeof document<"u"&&(document.readyState!=="loading"?vk():document.addEventListener("DOMContentLoaded",vk));function kK(t,e){const n=yk(t,e,"left"),i=yk(t,e,"top"),s=e.offsetWidth,r=e.offsetHeight;let o=t.scrollLeft,l=t.scrollTop;const d=o+t.offsetWidth,c=l+t.offsetHeight;n<=o?o=n:n+s>d&&(o+=n+s-d),i<=l?l=i:i+r>c&&(l+=i+r-c),t.scrollLeft=o,t.scrollTop=l}a(kK,"scrollIntoView");function yk(t,e,n){const i=n==="left"?"offsetLeft":"offsetTop";let s=0;for(;e.offsetParent&&(s+=e[i],e.offsetParent!==t);){if(e.offsetParent.contains(t)){s-=t[i];break}e=e.offsetParent}return s}a(yk,"relativeOffset");function qve(t,e){if(document.contains(t)){const n=document.scrollingElement||document.documentElement;if(window.getComputedStyle(n).overflow==="hidden"){let s=gk(t);for(;t&&s&&t!==n&&s!==n;)kK(s,t),t=s,s=gk(t)}else{const{left:s,top:r}=t.getBoundingClientRect();t?.scrollIntoView?.({block:"nearest"});const{left:o,top:l}=t.getBoundingClientRect();(Math.abs(s-o)>1||Math.abs(r-l)>1)&&(e?.containingElement?.scrollIntoView?.({block:"center",inline:"center"}),t.scrollIntoView?.({block:"nearest"}))}}}a(qve,"scrollIntoViewport");var b1={border:"0",clip:"rect(0 0 0 0)","clip-path":"inset(50%)",height:"1px",margin:"0 -1px -1px 0",overflow:"hidden",padding:"0",position:"absolute",width:"1px","white-space":"nowrap"};const MK="modulepreload",CK=a(function(t){return"/"+t},"assetsURL"),bk={},rt=a(function(e,n,i){if(!n||n.length===0)return e();const s=document.getElementsByTagName("link");return Promise.all(n.map(r=>{if(r=CK(r),r in bk)return;bk[r]=!0;const o=r.endsWith(".css"),l=o?'[rel="stylesheet"]':"";if(!!i)for(let u=s.length-1;u>=0;u--){const f=s[u];if(f.href===r&&(!o||f.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${r}"]${l}`))return;const c=document.createElement("link");if(c.rel=o?"stylesheet":MK,o||(c.as="script",c.crossOrigin=""),c.href=r,document.head.appendChild(c),o)return new Promise((u,f)=>{c.addEventListener("load",u),c.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${r}`)))})})).then(()=>e()).catch(r=>{const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=r,window.dispatchEvent(o),!o.defaultPrevented)throw r})},"preload"),yc=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function hy(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}a(hy,"isBytes$2");function hd(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}a(hd,"anumber$2");function Oi(t,...e){if(!hy(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}a(Oi,"abytes");function E1(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");hd(t.outputLen),hd(t.blockLen)}a(E1,"ahash");function h0(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}a(h0,"aexists");function PK(t,e){Oi(t);const n=e.outputLen;if(t.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}a(PK,"aoutput");function _o(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}a(_o,"clean");function kl(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}a(kl,"createView");function nr(t,e){return t<<32-e|t>>>e}a(nr,"rotr");function lg(t,e){return t<<e|t>>>32-e>>>0}a(lg,"rotl");const vN=(()=>typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function")(),DK=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function ka(t){if(Oi(t),vN)return t.toHex();let e="";for(let n=0;n<t.length;n++)e+=DK[t[n]];return e}a(ka,"bytesToHex$1");const Kr={_0:48,_9:57,A:65,F:70,a:97,f:102};function Ek(t){if(t>=Kr._0&&t<=Kr._9)return t-Kr._0;if(t>=Kr.A&&t<=Kr.F)return t-(Kr.A-10);if(t>=Kr.a&&t<=Kr.f)return t-(Kr.a-10)}a(Ek,"asciiToBase16$1");function Nd(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);
3if(vN)return Uint8Array.fromHex(t);const e=t.length,n=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const i=new Uint8Array(n);for(let s=0,r=0;s<n;s++,r+=2){const o=Ek(t.charCodeAt(r)),l=Ek(t.charCodeAt(r+1));if(o===void 0||l===void 0){const d=t[r]+t[r+1];throw new Error('hex string expected, got non-hex character "'+d+'" at index '+r)}i[s]=o*16+l}return i}a(Nd,"hexToBytes$2");function py(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}a(py,"utf8ToBytes");function _1(t){return typeof t=="string"&&(t=py(t)),Oi(t),t}a(_1,"toBytes");function _k(t){return typeof t=="string"&&(t=py(t)),Oi(t),t}a(_k,"kdfInputToBytes");function Ji(...t){let e=0;for(let i=0;i<t.length;i++){const s=t[i];Oi(s),e+=s.length}const n=new Uint8Array(e);for(let i=0,s=0;i<t.length;i++){const r=t[i];n.set(r,s),s+=r.length}return n}a(Ji,"concatBytes");function OK(t,e){if(e!==void 0&&{}.toString.call(e)!=="[object Object]")throw new Error("options should be object or undefined");return Object.assign(t,e)}a(OK,"checkOpts");const ZA=class ZA{};a(ZA,"Hash");let p0=ZA;function gy(t){const e=a(i=>t().update(_1(i)).digest(),"hashC"),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}a(gy,"createHasher");function Cp(t=32){if(yc&&typeof yc.getRandomValues=="function")return yc.getRandomValues(new Uint8Array(t));if(yc&&typeof yc.randomBytes=="function")return Uint8Array.from(yc.randomBytes(t));throw new Error("crypto.getRandomValues must be defined")}a(Cp,"randomBytes");const QA=class QA extends Error{};a(QA,"TimeoutError");let b_=QA;function NK(t,e,n){const i=new AbortController;n&&n.addEventListener("abort",o=>i.abort(o));const s=setTimeout(()=>{i.abort(new b_(e))},t);return{cancel:a(()=>clearTimeout(s),"cancel"),signal:i.signal}}a(NK,"wrapSignalWithTimeout");function FK(t,e){if(e?.timeout){const{cancel:n,signal:i}=NK(e.timeout,e.timeoutMessage??"Timeout",e.signal??void 0);return fetch(t,{...e,signal:i}).finally(n)}else return fetch(t,e)}a(FK,"fetchWithTimeout");let Ib=0;const g0=a((t,e)=>{if(t===e)return!0;let n=t,i=e;return t.endsWith("/")&&(n=t.slice(0,-1)),e.endsWith("/")&&(i=e.slice(0,-1)),n===i},"areUrlsSame"),jve=a((t,e)=>{Ib&&window.clearTimeout(Ib),Ib=window.setTimeout(t,e)},"debounce"),Yve=a((t,e)=>{const{bottom:n,height:i,top:s}=t.getBoundingClientRect(),r=e.getBoundingClientRect();return s<=r.top?r.top-s<=i:n-r.bottom<=i},"isVisibleInContainer"),w1=a(()=>([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,t=>(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16)),"uuidv4"),Zve=a(t=>t[0].toUpperCase()+t.slice(1).toLowerCase(),"titleCase"),vs=a(t=>{if(!t.startsWith("lnbc"))return;let e=[],n="",i=4;do{const o=t[i],l=parseInt(o);if(l!==0&&!l)break;e.push(o),i++}while(i<t.length);n=t[i];let r=parseInt(e.join(""))*1e8;switch(n){case"m":r=r/1e3;break;case"u":r=r/1e6;break;case"n":r=r/1e9;break;case"p":r=r/1e12;break;default:r=r;break}return r},"parseBolt11"),UK=a(t=>{let e={};for(e.x=t.offsetLeft,e.y=t.offsetTop;t.offsetParent&&(e.x=e.x+t.offsetParent.offsetLeft,e.y=e.y+t.offsetParent.offsetTop,t!=document.getElementsByTagName("body")[0]);)t=t.offsetParent;return e},"getScreenCordinates"),BK=a(()=>Math.floor(new Date().getTime()/1e3),"timeNow"),Qve=a(async t=>{const e=await t.arrayBuffer();return crypto.subtle.digest("SHA-256",e).then(n=>Array.from(new Uint8Array(n)).map(r=>r.toString(16).padStart(2,"0")).join(""))},"sha256$3"),Jve=a(t=>/&(lt|gt);/.test(t)?t.replace(/&lt;/g,"<").replace(/&gt;/g,">"):t,"convertHtmlEntityToAngleBrackets"),Xve=a((t,e,n)=>{let i=new Set,s=n;for(n>e&&(s=e);i.size<s;){const r=t+Math.floor(Math.random()*e);i.add(r)}return[...i]},"getRandomIntegers"),$K=a(()=>localStorage.getItem("devMode")==="true","isDev$1"),eye=a(t=>{if(t<1)return"0";let e=1;const n=["","bytes","KB","MB","GB","TB"];for(let r=1;r<6;r++)if(t<Math.pow(1024,r)){e=r;break}const i=Math.round(t/Math.pow(1024,e-1));return`${new Intl.NumberFormat("en-US").format(i)} ${n[e]}`},"formatStorage"),fi=a((t,e,n,i)=>{const s=Me(t,{onEvent:(r,o)=>{n&&n(o)},onEose:()=>{i&&i(),s()}});e()},"handleSubscription"),wk=a((t,e,n,i)=>new Promise(s=>{const r=Me(t,{onEvent:(o,l)=>{n&&n(l)},onEose:()=>{i&&i(),r(),s(!0)}});e()}),"handleSubscriptionAsync"),tye=a(t=>{const e=String(Math.floor(t/60)).padStart(2,"0"),n=String(Math.ceil(t%60)).padStart(2,"0");return`${e}:${n}`},"humanizeTime"),E_=a((t,e)=>{let n=0;for(let i=t.length-1;i>=0;i--){const s=t[i];if(e.sortBy==="created_at"&&s.msg.created_at!==e.since||e.sortBy==="satszapped"&&s.post?.satszapped!==e.since||e.sortBy==="score"&&s.post?.score!==e.since)break;n++}return n},"calculateEventsOffset"),nye=a((t,e)=>{let n=0;for(let i=t.length-1;i>=0;i--){const s=t[i];if(e.sortBy==="created_at"&&s.msg.created_at!==e.since||e.sortBy==="satszapped"&&s.post.satszapped!==e.since||e.sortBy==="score"&&s.post.score!==e.since)break;n++}return n},"calculateNotesOffset"),qf=a((t,e)=>{let n=0;for(let i=t.length-1;i>=0;i--){const s=t[i];if(e.sortBy==="created_at"&&s.msg.created_at!==e.since||e.sortBy==="published_at"&&s.published!==e.since||e.sortBy==="satszapped"&&s.satszapped!==e.since||e.sortBy==="score"&&s.score!==e.since)break;n++}return n},"calculateReadsOffset"),iye=a((t,e)=>{let n=0;for(let i=t.length-1;i>=0;i--){const s=t[i];if(e.sortBy==="created_at"&&s.created_at!==e.since||e.sortBy==="satszapped"&&s.amount!==e.since||e.sortBy==="amount_sats"&&s.amount!==e.since)break;n++}return n},"calculateZapsOffset"),HK=a((t,e)=>{let n=0;for(let i=t.length-1;i>=0;i--){const s=t[i];if(e.sortBy==="created_at"&&s.created_at!==e.since)break;n++}return n},"calculateDMConversationOffset"),GK=a((t,e)=>{let n=0;for(let i=t.length-1;i>=0;i--){const s=t[i];if(e.sortBy==="latest_at"&&s.dmInfo.latest_at!==e.since)break;n++}return n},"calculateDMContactsOffset"),sye=a((t,e)=>{let n=0;for(let i=t.length-1;i>=0;i--){const s=t[i];if(e.sortBy==="donated_btc"&&s.donated_btc!==e.since||e.sortBy==="last_donation"&&s.last_donation!==e.since||e.sortBy==="premium_since"&&s.premium_since!==e.since)break;n++}return n},"calculateLeaderboardOffset"),rye=a(t=>/(\s+|\r\n|\r|\n|^)lnbc[a-zA-Z0-9]+/.test(t),"msgHasInvoice"),oye=a(t=>/(\s+|\r\n|\r|\n|^)cashuA[a-zA-Z0-9]+/.test(t),"msgHasCashu"),Gl=a(()=>Math.floor(new Date().getTime()/1e3),"now$2"),VK=a(()=>/(iPad|iPhone|iPod)/.test(navigator.userAgent),"isIOS"),aye=a(()=>VK()||vK()||window.innerWidth<=720,"isPhone"),WK=a((t,e=2,n=!0)=>t.reduce((i,s)=>s[0]==="r"&&(!n||s[3]!=="read")&&(s[1].startsWith("wss://")||s[1].startsWith("ws://"))?[...i,s[1]]:i,[]).slice(0,e),"selectRelayTags"),qr={_0:48,_9:57,A:65,F:70,a:97,f:102};function Sk(t){if(t>=qr._0&&t<=qr._9)return t-qr._0;if(t>=qr.A&&t<=qr.F)return t-(qr.A-10);if(t>=qr.a&&t<=qr.f)return t-(qr.a-10)}a(Sk,"asciiToBase16");function lye(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length,n=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const i=new Uint8Array(n);for(let s=0,r=0;
3s<n;s++,r+=2){const o=Sk(t.charCodeAt(r)),l=Sk(t.charCodeAt(r+1));if(o===void 0||l===void 0){const d=t[r]+t[r+1];throw new Error('hex string expected, got non-hex character "'+d+'" at index '+r)}i[s]=o*16+l}return i}a(lye,"hexToBytes$1");const cye=a(t=>{const e=t.selectionStart||0;if(e===0)return"";const n=t.value.slice(0,e).split(" ");return n.length>0?n[n.length-1]:""},"previousWord"),dye=a(t=>"Nostr "+btoa(unescape(encodeURIComponent(JSON.stringify(t)))),"encodeAuthorizationHeader"),zK=a(async t=>(await FK(t,{method:"GET",timeout:3e3})).status===200,"checkBlossomServer"),Tk=a((t,e)=>{if(!window.matchMedia){e();return}const n=window.matchMedia("(prefers-color-scheme: dark)");t(n.matches),n.addEventListener("change",i=>t(i.matches))},"runColorMode"),uye=a(()=>navigator.languages!==void 0?navigator.languages[0]:navigator.language,"getLang"),fye=a(t=>t.replace(/[^a-zA-Z0-9-]/g,e=>"%"+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")),"urlEncode"),hye=a(async(t,e,n)=>{const i=[];let s=0,r;for(;(r=e.exec(t))!==null;)i.push(t.slice(s,r.index)),i.push(n(r[0])),s=e.lastIndex,r[0].length===0&&e.lastIndex++;return i.push(t.slice(s)),(await Promise.all(i)).join("")},"replaceAsync"),pye=a(t=>{const e=UK(t),n=100;return(e.y||0)+n<window.innerHeight+window.scrollY?"down":"up"},"determineOrient"),Ak=a((t,e)=>{const n=window[t];n&&n(e)},"hook"),Ys=a(t=>localStorage.getItem("devMode")!=="true"?t:e=>{const n=e.id||`${t.name}_${w1()}`,i={name:t.name,props:e,domId:n};Or(()=>{Ak("onPrimalComponentMount",i)}),Tt(()=>{Ak("onPrimalComponentCleanup",i)});try{e.id=n}catch(s){ii("Error setting hook id:",s)}return t(e)},"hookForDev"),KK="_linkPreview_1slv9_1",qK="_bordered_1slv9_19",jK="_linkPreviewH_1slv9_23",YK="_noImage_1slv9_45",ZK="_previewImage_1slv9_48",QK="_previewInfo_1slv9_52",JK="_previewUrlLine_1slv9_58",XK="_previewTitle_1slv9_66",eq="_previewDescription_1slv9_73",tq="_short_1slv9_78",ir={linkPreview:KK,bordered:qK,linkPreviewH:jK,noImage:YK,previewImage:ZK,previewInfo:QK,previewUrlLine:JK,previewTitle:XK,previewDescription:eq,short:tq};var nq=It("<img style=width:180px;height:120px>"),Lb=It("<div>"),iq=It("<a target=_blank><div><div>");const xk=3,sq=a(t=>{const e=f1(),n=encodeURI(new URL(t.preview.url.toLowerCase()).origin),i=a(()=>e?.actions.getMedia(t.preview.images[0]||"","m"),"image"),s=a(()=>{let h=ir.linkPreviewH;return f()||(h+=` ${ir.noImage}`),t.bordered&&(h+=` ${ir.bordered}`),h+=" embeddedContent",h+=t.isLast?" noBottomMargin":"",h},"klass"),[r,o]=Je(0),l=a(h=>{if(r()>xk)return;o(g=>g+1);const p=h.target;return p.onerror="",p.src=t.preview.images[0],!0},"onError");let d;const[c,u]=Je(!1);We(oi(()=>t.preview.title,(h,p)=>{!h||h===p||d===void 0||new ResizeObserver(()=>{u(()=>(d?.clientHeight||0)>25)}).observe(d)}));const f=a(()=>r()<xk&&(i()||t.preview.images[0]),"hasImage");return(()=>{var h=iq(),p=h.firstChild,g=p.firstChild;return Fe(h,X(sn,{get when(){return f()},get children(){var v=nq();return v.addEventListener("error",l),ze(y=>{var b=ir.previewImage,E=i()?.media_url||t.preview.images[0];return b!==y.e&&xe(v,y.e=b),E!==y.t&&Ct(v,"src",y.t=E),y},{e:void 0,t:void 0}),v}}),p),Fe(p,X(sn,{get when(){return t.preview.title},get children(){var v=Lb(),y=d;return typeof y=="function"?Ld(y,v):d=v,Fe(v,()=>t.preview.title),ze(()=>xe(v,ir.previewTitle)),v}}),g),Fe(p,X(sn,{get when(){return t.preview.description},get children(){var v=Lb();return Fe(v,()=>t.preview.description),ze(()=>xe(v,`${ir.previewDescription} ${c()?ir.short:""}`)),v}}),g),Fe(g,X(sn,{when:n,get children(){var v=Lb();return Fe(v,n),ze(()=>xe(v,ir.previewUrl)),v}})),ze(v=>{var y=t.id,b=t.preview.url,E=s(),T=ir.previewInfo,I=ir.previewUrlLine;return y!==v.e&&Ct(h,"id",v.e=y),b!==v.t&&Ct(h,"href",v.t=b),E!==v.a&&xe(h,v.a=E),T!==v.o&&xe(p,v.o=T),I!==v.i&&xe(g,v.i=I),v},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),h})()},"LinkPreview"),rq=Ys(sq),oq=a(async(t,e,n)=>{if(!t)return;const i={kind:G.Settings,tags:[["p",t],["d",Zt,Qe.getMembershipStatus]],created_at:Math.floor(new Date().getTime()/1e3),content:JSON.stringify({desription:"Get Primal memebeship status"})};try{return Nt(i,{isRead:!0}).then(s=>{const r=JSON.stringify(["REQ",e,{cache:["membership_status",{event_from_user:s}]}]);if(n){const o=new CustomEvent("send",{detail:{message:r,ws:n}});n.send(r),n.dispatchEvent(o)}else throw"no_socket"}).catch(s=>{Tn("ENQUEUE Failed get membership status: ",s)}),!0}catch(s){return console.error("Failed to upload: ",s),!1}},"getMembershipStatus"),gye=a(async(t,e,n,i)=>{if(!t)return;const r={content:JSON.stringify(["exchange_rate",{target_currency:n}]),kind:G.WALLET_OPERATION,created_at:Math.ceil(new Date().getTime()/1e3),tags:[]},o=await Nt(r,{isRead:!0}),l=JSON.stringify(["REQ",e,{cache:["wallet",{operation_event:o}]}]);if(i){const d=new CustomEvent("send",{detail:{message:l,ws:i}});i.send(l),i.dispatchEvent(d)}else throw"no_socket"}
3,"getExchangeRate"),aq={small:250,medium:250,large:250,huge:250,final:100},lq={following:[],followingSince:0,muted:[],mutedPrivate:"",mutedSince:0,streamMuted:[],streamMutedPrivate:"",streamMutedSince:0,relaySettings:{},likes:[],feeds:[],homeFeeds:[],readsFeeds:[],msgContacts:{profiles:{other:{},follows:{},any:{}},counts:{}},dmConversations:{profiles:{},counts:{}},theme:"sunrise",homeSidebarSelection:void 0,userProfile:void 0,recomended:{profiles:[],stats:{}},emojiHistory:[],noteDraft:{},noteDraftUserRefs:{},noteDraftMediaTags:[],uploadTime:aq,selectedFeed:void 0,bookmarks:[],animated:!0,selectedHomeFeed:void 0,selectedReadsFeed:void 0,selectedBookmarksFeed:void 0,dmLastConversation:void 0,dmLastRelation:void 0,premiumReminder:0,dvms:void 0,usePrimalRelay:!1,usePrimalProxy:!1,nwc:[],nwcActive:void 0,useSystemDarkMode:!1,liveStreams:void 0,liveAuthors:void 0,legendCustomization:void 0,membershipStatus:void 0,eventQueue:void 0},yN=a(t=>t?`store_${t}`:"anon","storageName"),Be=a(t=>{if(!t)return{};const e=yN(t),n=localStorage.getItem(e);return n?JSON.parse(n):{...lq}},"getStorage"),Lt=a((t,e)=>{if(!t)return;const n=yN(t),i=JSON.stringify(e);localStorage.setItem(n,i)},"setStorage"),S1=a((t,e,n)=>{if(!t)return;const i=Be(t);i.following=[...e],i.followingSince=n,Lt(t,i)},"saveFollowing"),bN=a((t,e,n,i)=>{if(!t)return;const s=Be(t);s.muted=[...e],s.mutedPrivate=n,s.mutedSince=i,Lt(t,s)},"saveMuteList"),m0=a((t,e,n)=>{if(!t)return;const i=Be(t);i.muted=[...e],i.mutedSince=n,Lt(t,i)},"saveMuted"),EN=a((t,e,n)=>{if(!t)return;const i=Be(t);i.streamMuted=[...e],i.streamMutedSince=n,Lt(t,i)},"saveStreamMuted"),__=a((t,e)=>{if(!t)return;const n=Be(t);n.relaySettings={...e},Lt(t,n)},"saveRelaySettings"),cq=a(t=>t?Be(t).relaySettings:void 0,"readRelaySettings"),dq=a((t,e)=>{if(!t)return;const n=Be(t);n.usePrimalRelay=e,Lt(t,n)},"savePrimalRelaySettings"),uq=a(t=>t&&Be(t).usePrimalRelay||!1,"readPrimalRelaySettings"),fq=a((t,e)=>{if(!t)return;const n=Be(t);n.usePrimalProxy=e,Lt(t,n)},"savePrimalProxySettings"),hq=a(t=>t&&Be(t).usePrimalProxy||!1,"readPrimalProxySettings"),Ik=a((t,e)=>{if(!t)return;const n=Be(t);
3n.likes=[...e],Lt(t,n)},"saveLikes"),my=a((t,e)=>{if(!t)return;const n=Be(t);n.feeds=[...e],Lt(t,n)},"saveFeeds"),om=a((t,e)=>{if(!t)return;const n=Be(t);n.homeFeeds=[...e],Lt(t,n)},"saveHomeFeeds"),_N=a((t,e)=>{if(!t)return;const n=Be(t);n.readsFeeds=[...e],Lt(t,n)},"saveReadsFeeds"),pq=a((t,e)=>{if(!t)return;const n=Be(t);n.theme=e,Lt(t,n)},"saveTheme"),mye=a(t=>t?Be(t).theme||"sunrise":!1,"readTheme"),gq=a((t,e)=>{if(!t)return;const n=Be(t);n.useSystemDarkMode=e,Lt(t,n)},"saveSystemDarkMode"),mq=a(t=>t&&Be(t).useSystemDarkMode||!1,"readSystemDarkMode"),vq=a((t,e)=>{if(!t)return;const n=Be(t);n.animated=e,Lt(t,n)},"saveAnimated"),cg=a((t,e)=>{if(!t)return;const n=Be(t);n.recomended=e,Lt(t,n)},"saveRecomendedUsers"),yq=a(t=>{if(!t)return;const n=Be(t).recomended;return n||void 0},"readRecomendedUsers"),Lk=a((t,e)=>{if(!t)return;const n=Be(t);n.emojiHistory=e,Lt(t,n)},"saveEmojiHistory"),bq=a(t=>t?Be(t).emojiHistory||[]:[],"readEmojiHistory"),vye=a((t,e,n)=>{if(!t)return;const i=Be(t),s=n||"root";(!i.noteDraft||typeof i.noteDraft=="string")&&(i.noteDraft={}),i.noteDraft[s]=e,Lt(t,i)},"saveNoteDraft"),yye=a((t,e)=>{if(!t)return"";const n=Be(t);(!n.noteDraft||typeof n.noteDraft=="string")&&(n.noteDraft={});const i=e||"root";return n.noteDraft[i]||""},"readNoteDraft"),bye=a((t,e,n)=>{if(!t)return;const i=Be(t),s=n||"root";(!i.noteDraftUserRefs||typeof i.noteDraftUserRefs=="string")&&(i.noteDraftUserRefs={}),i.noteDraftUserRefs[s]=e,Lt(t,i)},"saveNoteDraftUserRefs"),Eye=a((t,e)=>{if(!t)return{};const n=Be(t);(!n.noteDraftUserRefs||typeof n.noteDraftUserRefs=="string")&&(n.noteDraftUserRefs={});const i=e||"root";return n.noteDraftUserRefs[i]||{}},"readNoteDraftUserRefs"),_ye=a((t,e)=>{if(!t)return;const n=Be(t);n.noteDraftMediaTags=[...e],Lt(t,n)},"saveNoteDraftMediaTags"),wye=a(t=>t?Be(t).noteDraftMediaTags:[],"readNoteDraftMediaTags"),Sye=a((t,e)=>{if(!t)return;const n=Be(t);n.homeSidebarSelection=e?{...e}:void 0,Lt(t,n)},"saveHomeSidebarSelection"),Tye=a(t=>{if(!t)return;const n=Be(t).homeSidebarSelection;return n||void 0},"readHomeSidebarSelection"),Eq=a((t,e)=>{if(!t)return;const n=Be(t);n.premiumReminder=e,Lt(t,n)},"savePremiumReminder"),_q=a(t=>t?Be(t).premiumReminder:void 0,"readPremiumReminder"),$a=a(()=>localStorage.getItem("primalSec")||void 0,"readSecFromStorage"),Aye=a(t=>{if(!t){localStorage.removeItem("primalSec");return}localStorage.setItem("primalSec",t)},"storeSec"),wq=a(()=>{localStorage.removeItem("primalSec")},"clearSec"),T1=a(t=>{const n=Be(t).userProfile;if(n&&n.pubkey===t)return n},"getStoredProfile"),Sq=a(t=>{const e=Be(t.pubkey);e.userProfile={...t},Lt(t.pubkey,e)},"setStoredProfile"),Tq=a((t,e)=>{const n=Be(t);n.dmLastConversation=e,Lt(t,n)},"saveLastDMConversations"),Rk=a((t,e)=>{const n=Be(t);n.dmLastRelation=e,Lt(t,n)},"saveLastDMRelation"),wN=a((t,e)=>{if(!t)return;const n=Be(t);return e==="reads"?n.selectedReadsFeed:n.selectedHomeFeed},"fetchStoredFeed"),SN=a((t,e,n)=>{if(!t)return;const i=Be(t);e==="home"?i.selectedHomeFeed={...n}:e==="reads"&&(i.selectedReadsFeed={...n}),Lt(t,i)},"saveStoredFeed"),xye=a(t=>t?Be(t).selectedBookmarksFeed:void 0,"fetchBookmarksFeed"),Iye=a((t,e)=>{if(!t)return;const n=Be(t);n.selectedBookmarksFeed=e,Lt(t,n)},"saveBookmarksFeed"),Aq=a((t,e)=>{if(!t)return;const n=Be(t);n.bookmarks=[...e],Lt(t,n)},"saveBookmarks"),xq=a(t=>t?Be(t).bookmarks||[]:[],"readBookmarks"),Lye=a((t,e)=>{if(!t)return;const n=Be(t);n.dvms=[...e],Lt(t,n)},"saveDVMs"),Rye=a(t=>t?Be(t).dvms||[]:[],"readDVMs"),Iq=a(t=>{localStorage.setItem("nostrStats",JSON.stringify(t))},"saveNostrStats"),Lq=a(()=>{const t=localStorage.getItem("nostrStats")||JSON.stringify({users:0,pubkeys:0,pubnotes:0,reactions:0,reposts:0,any:0,zaps:0,satszapped:0});return JSON.parse(t)},"loadNostrStats"),kye=a(t=>{localStorage.setItem("trendingUsers",JSON.stringify(t))},"saveTrendingUsers"),Mye=a(()=>JSON.parse(localStorage.getItem("trendingUsers")||"[]"),"loadTrendingUsers"),Rq=a(t=>{localStorage.setItem("hotTopics",JSON.stringify(t))},"saveHotTopics"),kq=a(()=>JSON.parse(localStorage.getItem("hotTopics")||"[]"),"loadHotTopics"),Mq=a((t,e)=>{const n=Be(t);if(!e)return n.nwc||[];const i=(n.nwc||[]).find(s=>s[0]===e);return i?[i]:[]},"loadNWC"),jf=a((t,e)=>{let n=Be(t);n.nwc=[...e],Lt(t,n)},"saveNWC"),w_=a(t=>Be(t).nwcActive,"loadNWCActive"),Pp=a((t,e,n)=>{let i=Be(t);!e||!n?i.nwcActive=[]:i.nwcActive=[e,n],Lt(t,i)},"saveNWCActive"),Cye=a((t,e)=>{if(!t)return;const n=Be(t);n.liveStreams=[...e],Lt(t,n)},"saveLiveStreams"),Pye=a(t=>t?Be(t).liveStreams||[]:[],"loadLiveStreams"),Dye=a((t,e)=>{if(!t)return;const n=Be(t);n.liveAuthors=[...e],Lt(t,n)},"saveLiveAuthors"),Oye=a(t=>t?Be(t).liveAuthors||[]:[],"loadLiveAuthors"),kk=a((t,e)=>{if(!t)return;const n=Be(t);n.legendCustomization={...e},Lt(t,n)},"saveLegendCustomization"),Cq=a(t=>t?Be(t).legendCustomization:void 0,"loadLegendCustomization"),Pq=a((t,e)=>{if(!t)return;const n=Be(t);n.membershipStatus={...e},Lt(t,n)},"saveMembershipStatus"),Dq=a(t=>t?Be(t).membershipStatus:void 0,"loadMembershipStatus"),Oq=a(t=>Be(t).eventQueue||[],"loadEventQueue"),Ur=a((t,e)=>{let n=Be(t);n.eventQueue=[...e],Lt(t,n)},"saveEventQueue"),Na=a((t,e)=>{Ae(JSON.stringify(["REQ",e,{cache:["user_infos",{pubkeys:t}]}]))},"getUserProfiles"),Nye=a((t,e)=>{Ae(JSON.stringify(["REQ",e,{cache:["get_user_relays_2",{pubkeys:t}]}]))},"getUsersRelayInfo"),A1=a((t,e,n)=>{if(!t)return;let i={pubkey:t};e&&(i.user_pubkey=e),Ae(JSON.stringify(["REQ",n,{cache:["user_profile",i]}]))},"getUserProfileInfo"),Nq=a((t,e,n)=>{!t||!e||Ae(JSON.stringify(["REQ",n,{cache:["is_user_following",{pubkey:t,user_pubkey:e}]}]))},"isUserFollowing"),vy=a((t,e,n=!1)=>{t&&Ae(JSON.stringify(["REQ",e,{cache:["contact_list",{pubkey:t,extended_response:n}]}]))},"getProfileContactList"),Fq=a((t,e,n=!1)=>{t&&Ae(JSON.stringify(["REQ",e,{cache:["user_followers",{pubkey:t}]}]))},"getProfileFollowerList"),Uq=a((t,e,n=0,i=0,s=20,r=!1)=>
3{if(!t)return;let o={sender:t,limit:s,offset:i};n>0&&(o.until=n),Ae(JSON.stringify(["REQ",e,{cache:["user_zaps_sent",o]}]))},"getProfileZapList"),x1=a((t,e,n)=>{t&&Ae(JSON.stringify(["REQ",e,{cache:["mutelist",{pubkey:t,extended_response:n}]}]))},"getProfileMuteList"),Fye=a((t,e,n,i)=>{t&&Ae(JSON.stringify(["REQ",n,{cache:["parameterized_replaceable_list",{pubkey:t,identifier:e,extended_response:i}]}]))},"getCategorizedList"),Bq=a((t,e,n,i=5)=>{t&&Ae(JSON.stringify(["REQ",n,{cache:["user_profile_scored_content",{pubkey:t,limit:i,user_pubkey:e}]}]))},"getProfileScoredNotes"),$q=a((t,e,n,i=5)=>{!t||!e||Ae(JSON.stringify(["REQ",n,{cache:["user_profile_followed_by",{pubkey:t,limit:i,user_pubkey:e}]}]))},"getCommonFollowers"),Uye=a((t,e)=>{Ae(JSON.stringify(["REQ",t,{cache:["scored_users_24h",{user_pubkey:e}]}]))},"getTrendingUsers"),Bye=a(t=>t===void 0?"":t.split("@"),"trimVerification"),Hq=a(async t=>{try{const e=t.toLowerCase(),n=window.location.origin.startsWith("http://localhost")?"https://dev.primal.net":window.location.origin;return await(await fetch(`${n}/.well-known/nostr.json?name=${e}`)).json()}catch(e){return Tn("Failed to fetch known users: ",t,e),{...Xv}}},"fetchKnownProfiles"),Gq=a(async t=>{if(!t)return null;try{return await S2.queryProfile(t)||null}catch(e){return Tn("Failed to nip05 verify user: ",e),null}},"isAccountVerified"),$ye=a(async t=>{const e={content:JSON.stringify(t),kind:G.Metadata,tags:[],created_at:Math.floor(new Date().getTime()/1e3)};return await Vn(e)},"sendProfile"),Hye=a(async(t,e)=>{if(!t)return{success:!1,reason:"no_pubkey"};const n={content:"",kind:G.ReportContent,tags:[["p",t,e]],created_at:Math.floor(new Date().getTime()/1e3)};return await Vn(n)},"reportUser"),yy=a((t,e,n)=>{t&&Ae(JSON.stringify(["REQ",e,{cache:["mutelists",{pubkey:t,extended_response:n}]}]))},"getFilterlists"),I1=a(async(t,e,n)=>{const i=t.reduce((r,o)=>{let l=[];return o.content&&l.push("content"),o.trending&&l.push("trending"),o.pubkey?[...r,["p",o.pubkey,o.relay||"",o.petname||"",JSON.stringify(l)]]:r},[["d","mutelists"]]),s={content:n,kind:G.CategorizedPeople,tags:i,created_at:e};return await Vn(s)},"sendFilterlists"),L1=a((t,e,n)=>{t&&Ae(JSON.stringify(["REQ",e,{cache:["allowlist",{pubkey:t,extended_response:n}]}]))},"getAllowlist"),TN=a(async(t,e,n)=>{const i=t.reduce((r,o)=>[...r,["p",o]],[["d","allowlist"]]),s={content:n,kind:G.CategorizedPeople,tags:i,created_at:e};return await Vn(s)},"sendAllowList"),Gye=a(async t=>{Ae(JSON.stringify(["REQ",t,{cache:["get_suggested_users"]}]))},"getSuggestions"),by=a(async(t,e)=>{t&&Ae(JSON.stringify(["REQ",e,{cache:["get_user_relays",{pubkey:t}]}]))},"getRelays"),AN=a(async t=>{const e=Object.entries(t).reduce((s,[r,o])=>{if(o.read&&o.write)return[...s,["r",r]];if(!o.read&&!o.write)return s;const l=o.read?"read":"write";return[...s,["r",r,l]]},[]),n={content:"",kind:G.RelayList,tags:[...e],created_at:Math.floor(new Date().getTime()/1e3)};return await Vn(n)},"sendRelays"),Vye=a(async(t,e,n,i)=>{const s={content:n,kind:G.Bookmarks,tags:[...t],created_at:e};return await Vn(s,void 0,i)},"sendBookmarks"),Vq=a(async(t,e)=>{t&&Ae(JSON.stringify(["REQ",e,{cache:["get_bookmarks",{pubkey:t}]}]))},"getBookmarks"),xN=a(t=>t.reduce((e,n)=>{if(n[0]!=="r")return e;let i={write:!0,read:!0};return n[2]==="write"&&(i.read=!1),n[2]==="read"&&(i.write=!1),{...e,[n[1]]:i}},{}),"extractRelayConfigFromTags"),Wq=a(async(t,e,n,i,s,r)=>{let o={limit:i||10,offset:r||0};n>0&&(o.until=n),s>0&&(o.since=s),e&&(o.user_pubkey=e),Ae(JSON.stringify(["REQ",t,{cache:["explore_people",{...o}]}]))},"getExplorePeople"),zq=a(async(t,e,n,i,s,r)=>{let o={limit:i||20,offset:r||0};n>0&&(o.until=n),s>0&&(o.since=s),Ae(JSON.stringify(["REQ",t,{cache:["explore_zaps",{...o}]}]))},"getExploreZaps"),Kq=a(async(t,e,n,i,s,r)=>{let o={limit:i||20,offset:r||0};n>0&&(o.until=n),s>0&&(o.since=s),e&&(o.user_pubkey=e),Ae(JSON.stringify(["REQ",t,{cache:["explore_media",{...o}]}]))},"getExploreMedia"),qq=a(async(t,e)=>{Ae(JSON.stringify(["REQ",t,{cache:["explore_topics"]}]))},"getExploreTopics"),IN=a(()=>("wss://relay.primal.net".split(",")||[]).reduce((e,n)=>({...e,[n]:{read:!0,write:!0}}),{}),"getPreConfiguredRelays"),jq=a(t=>{Ae(JSON.stringify(["REQ",t,{cache:["get_default_relays"]}]))},"getDefaultRelays"),Yq=a(t=>{Ae(JSON.stringify(["REQ",t,{cache:["get_recommended_blossom_servers"]}]))},"getDefaultBlossomServers"),Zq="/assets/logo_remote-afdf5895.png";let Mi;const LN=a(t=>{Mi=t},"setAppSigner"),Wye=a(t=>{if(localStorage.getItem("appNsec")&&!t?.reset)return;let e=Ks(),n=nc(e);localStorage.setItem("appNsec",qt(e)),localStorage.setItem("appPubkey",n)},"generateAppKeys"),Qq=a(()=>localStorage.getItem("appPubkey"),"getAppPK"),Jq=a(()=>{const t=localStorage.getItem("appNsec");if(t)try{return rn(t)}catch(e){ii("Failed to decode App nsec: ",e);return}},"getAppSK"),zye=a(()=>{const t=Qq();if(!t)return"";let e=localStorage.getItem("clientConnectionUrl")||Zz({clientPubkey:t,relays:["wss://nrs.primal.net"],secret:`sec-${w1()}`,name:"PrimalWeb",url:location.origin,image:`${location.origin}${Zq}`});return e+="&nwc=1",localStorage.setItem("clientConnectionUrl",e),e},"generateClientConnectionUrl"),Kye=a(t=>{const e=t.bp.pubkey,n=t.bp.relays.reduce((r,o,l)=>l===0?`relay=${o}`:`${r}&relay=${o}`,""),i=t.bp.secret,s=`bunker://${e}?${n}&secret=${i}`;return localStorage.setItem("bunkerUrl",s),LN(t),s},"storeBunker"),Xq=a(t=>({getPublicKey:a(async()=>
3{if(!Mi)throw"no-bunker-found";return await Mi?.getPublicKey()},"gPk"),getRelays:a(()=>new Promise(d=>{d({})}),"gRl"),nip04:{encrypt:a(async(d,c)=>{if(!Mi)throw"no-bunker-found";return Mi?.nip04Encrypt(d,c)},"encrypt"),decrypt:a(async(d,c)=>{if(!Mi)throw"no-bunker-found";return Mi?.nip04Decrypt(d,c)},"decrypt")},nip44:{encrypt:a(async(d,c)=>{if(!Mi)throw"no-bunker-found";return Mi?.nip44Encrypt(d,c)},"encrypt44"),decrypt:a(async(d,c)=>{if(!Mi)throw"no-bunker-found";return Mi.nip44Decrypt(d,c)},"decrypt44")},signEvent:a(async d=>{if(!Mi)throw"no-bunker-found";return await Promise.race([Mi.signEvent(d),xo()])},"signEvent")}),"PrimalNip46"),ej="_settingsContainer_1twd6_1",tj="_fullHeader_1twd6_7",nj="_label_1twd6_21",ij="_blossomMainServer_1twd6_28",sj="_resetRelays_1twd6_35",rj="_bigCaption_1twd6_43",oj="_secondBigCaption_1twd6_51",aj="_settingsCaption_1twd6_55",lj="_settingsCaptionDarker_1twd6_65",cj="_settingsDescription_1twd6_75",dj="_settingsContent_1twd6_83",uj="_settingsContentFull_1twd6_89",fj="_settingsContentBorderless_1twd6_95",hj="_settingsContentFullBorderless_1twd6_100",pj="_settingsContentPaddingOnly_1twd6_105",gj="_rightFloater_1twd6_109",mj="_settingsAccountCaption_1twd6_115",vj="_caption_1twd6_121",yj="_copy_1twd6_128",bj="_checkIcon_1twd6_144",Ej="_settingsKeyArea_1twd6_154",_j="_key_1twd6_163",wj="_icon_1twd6_175",Sj="_keyIcon_1twd6_178",Tj="_secondCaption_1twd6_188",Aj="_separator_1twd6_192",xj="_feedManage_1twd6_198",Ij="_restoreFeedsButton_1twd6_212",Lj="_devider_1twd6_228",Rj="_subpageLinks_1twd6_234",kj="_bubble_1twd6_258",Mj="_chevron_1twd6_274",Cj="_emptyListBanner_1twd6_288",Pj="_mutedUser_1twd6_302",Dj="_userInfo_1twd6_309",Oj="_userName_1twd6_316",Nj="_title_1twd6_322",Fj="_verification_1twd6_332",Uj="_closeIcon_1twd6_351",Bj="_addIcon_1twd6_360",$j="_backIcon_1twd6_369",Hj="_copyIcon_1twd6_378",Gj="_addIconBig_1twd6_387",Vj="_webIcon_1twd6_397",Wj="_connectIcon_1twd6_406",zj="_helpIcon_1twd6_415",Kj="_searchIcon_1twd6_424",qj="_relayItem_1twd6_433",jj="_extended_1twd6_445",Yj="_relayEntry_1twd6_448",Zj="_connected_1twd6_458",Qj="_disconnected_1twd6_465",Jj="_suspended_1twd6_472",Xj="_relayUrl_1twd6_479",eY="_relayActions_1twd6_485",tY="_remove_1twd6_515",nY="_add_1twd6_360",iY="_relayInput_1twd6_546",sY="_noIcon_1twd6_567",rY="_invalidInput_1twd6_604",oY="_settingsMenuFooter_1twd6_612",aY="_webVersion_1twd6_620",lY="_value_1twd6_637",cY="_noMyRelays_1twd6_644",dY="_moderationDescription_1twd6_652",uY="_filterListTable_1twd6_660",fY="_filterListHeader_1twd6_666",hY="_secondFilter_1twd6_694",pY="_filterListItem_1twd6_697",gY="_filterListName_1twd6_710",mY="_filterListCheck_1twd6_733",vY="_searchFilteredAccount_1twd6_737",yY="_algoLogo_1twd6_741",bY="_allowlistItem_1twd6_750",EY="_allowlistEntry_1twd6_763",_Y="_inactive_1twd6_787",wY="_allowlistInfo_1twd6_794",SY="_avatar_1twd6_803",TY="_allowlistUserInfo_1twd6_806",AY="_firstLine_1twd6_810",xY="_name_1twd6_815",IY="_npub_1twd6_829",LY="_removeIcon_1twd6_851",RY="_npubInput_1twd6_875",kY="_fiterSearchCaption_1twd6_940",MY="_veil_1twd6_948",CY="_clearButton_1twd6_959",PY="_securityWarning_1twd6_971",DY="_securityMessage_1twd6_976",OY="_securityIcon_1twd6_984",NY="_appearanceCheckLabel_1twd6_994",FY="_devToolsList_1twd6_1007",UY="_devToolsItem_1twd6_1012",BY="_walletList_1twd6_1027",$Y="_nwcInputs_1twd6_1034",HY="_nwcInput_1twd6_1034",GY="_nwcTextArea_1twd6_1069",VY="_nwcInputActions_1twd6_1092",WY="_mirrorServer_1twd6_1101",zY="_actions_1twd6_1114",KY="_settingsTabs_1twd6_1156",qY="_settingsTab_1twd6_1156",jY="_settingsTabIndicator_1twd6_1187",YY="_wordInput_1twd6_1204",mt={settingsContainer:ej,fullHeader:tj,label:nj,blossomMainServer:ij,resetRelays:sj,bigCaption:rj,secondBigCaption:oj,settingsCaption:aj,settingsCaptionDarker:lj,settingsDescription:cj,settingsContent:dj,settingsContentFull:uj,settingsContentBorderless:fj,settingsContentFullBorderless:hj,settingsContentPaddingOnly:pj,rightFloater:gj,settingsAccountCaption:mj,caption:vj,copy:yj,checkIcon:bj,settingsKeyArea:Ej,key:_j,icon:wj,keyIcon:Sj,secondCaption:Tj,separator:Aj,feedManage:xj,restoreFeedsButton:Ij,devider:Lj,subpageLinks:Rj,bubble:kj,chevron:Mj,emptyListBanner:Cj,mutedUser:Pj,userInfo:Dj,userName:Oj,title:Nj,verification:Fj,closeIcon:Uj,addIcon:Bj,backIcon:$j,copyIcon:Hj,addIconBig:Gj,webIcon:Vj,connectIcon:Wj,helpIcon:zj,searchIcon:Kj,relayItem:qj,extended:jj,relayEntry:Yj,connected:Zj,disconnected:Qj,suspended:Jj,relayUrl:Xj,relayActions:eY,remove:tY,add:nY,relayInput:iY,noIcon:sY,invalidInput:rY,settingsMenuFooter:oY,webVersion:aY,value:lY,noMyRelays:cY,moderationDescription:dY,filterListTable:uY,filterListHeader:fY,secondFilter:hY,filterListItem:pY,filterListName:gY,filterListCheck:mY,searchFilteredAccount:vY,algoLogo:yY,allowlistItem:bY,allowlistEntry:EY,inactive:_Y,allowlistInfo:wY,avatar:SY,allowlistUserInfo:TY,firstLine:AY,name:xY,npub:IY,removeIcon:LY,npubInput:RY,fiterSearchCaption:kY,veil:MY,clearButton:CY,securityWarning:PY,securityMessage:DY,securityIcon:OY,appearanceCheckLabel:NY,devToolsList:FY,devToolsItem:UY,w
3alletList:BY,nwcInputs:$Y,nwcInput:HY,nwcTextArea:GY,nwcInputActions:VY,mirrorServer:WY,actions:zY,settingsTabs:KY,settingsTab:qY,settingsTabIndicator:jY,wordInput:YY};var S_=a(function(t,e){return S_=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(n[s]=i[s])},S_(t,e)},"extendStatics");function Zs(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");S_(t,e);function n(){this.constructor=t}a(n,"__"),t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}a(Zs,"__extends");var je=a(function(){return je=Object.assign||a(function(e){for(var n,i=1,s=arguments.length;i<s;i++){n=arguments[i];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},"__assign"),je.apply(this,arguments)},"__assign$3");function ZY(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]]);return n}a(ZY,"__rest$1");function Zi(t,e,n){if(n||arguments.length===2)for(var i=0,s=e.length,r;i<s;i++)(r||!(i in e))&&(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}a(Zi,"__spreadArray$2");function Pi(t,e){var n=e&&e.cache?e.cache:nZ,i=e&&e.serializer?e.serializer:tZ,s=e&&e.strategy?e.strategy:JY;return s(t,{cache:n,serializer:i})}a(Pi,"memoize");function QY(t){return t==null||typeof t=="number"||typeof t=="boolean"}a(QY,"isPrimitive");function RN(t,e,n,i){var s=QY(i)?i:n(i),r=e.get(s);return typeof r>"u"&&(r=t.call(this,i),e.set(s,r)),r}a(RN,"monadic");function kN(t,e,n){var i=Array.prototype.slice.call(arguments,3),s=n(i),r=e.get(s);return typeof r>"u"&&(r=t.apply(this,i),e.set(s,r)),r}a(kN,"variadic");function R1(t,e,n,i,s){return n.bind(e,t,i,s)}a(R1,"assemble");function JY(t,e){var n=t.length===1?RN:kN;return R1(t,this,n,e.cache.create(),e.serializer)}a(JY,"strategyDefault");function XY(t,e){return R1(t,this,kN,e.cache.create(),e.serializer)}a(XY,"strategyVariadic");function eZ(t,e){return R1(t,this,RN,e.cache.create(),e.serializer)}a(eZ,"strategyMonadic");var tZ=a(function(){return JSON.stringify(arguments)},"serializerDefault");function k1(){this.cache=Object.create(null)}a(k1,"ObjectWithoutPrototypeCache");k1.prototype.get=function(t){return this.cache[t]};k1.prototype.set=function(t,e){this.cache[t]=e};var nZ={create:a(function(){return new k1},"create")},Di={variadic:XY,monadic:eZ},At;(function(t){t[t.EXPECT_ARGUMENT_CLOSING_BRACE=1]="EXPECT_ARGUMENT_CLOSING_BRACE",t[t.EMPTY_ARGUMENT=2]="EMPTY_ARGUMENT",t[t.MALFORMED_ARGUMENT=3]="MALFORMED_ARGUMENT",t[t.EXPECT_ARGUMENT_TYPE=4]="EXPECT_ARGUMENT_TYPE",t[t.INVALID_ARGUMENT_TYPE=5]="INVALID_ARGUMENT_TYPE",t[t.EXPECT_ARGUMENT_STYLE=6]="EXPECT_ARGUMENT_STYLE",t[t.INVALID_NUMBER_SKELETON=7]="INVALID_NUMBER_SKELETON",t[t.INVALID_DATE_TIME_SKELETON=8]="INVALID_DATE_TIME_SKELETON",t[t.EXPECT_NUMBER_SKELETON=9]="EXPECT_NUMBER_SKELETON",t[t.EXPECT_DATE_TIME_SKELETON=10]="EXPECT_DATE_TIME_SKELETON",t[t.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE=11]="UNCLOSED_QUOTE_IN_ARGUMENT_STYLE",t[t.EXPECT_SELECT_ARGUMENT_OPTIONS=12]="EXPECT_SELECT_ARGUMENT_OPTIONS",t[t.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE=13]="EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE",t[t.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE=14]="INVALID_PLURAL_ARGUMENT_OFFSET_VALUE",t[t.EXPECT_SELECT_ARGUMENT_SELECTOR=15]="EXPECT_SELECT_ARGUMENT_SELECTOR",t[t.EXPECT_PLURAL_ARGUMENT_SELECTOR=16]="EXPECT_PLURAL_ARGUMENT_SELECTOR",t[t.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT=17]="EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT",t[t.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT=18]="EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT",t[t.INVALID_PLURAL_ARGUMENT_SELECTOR=19]="INVALID_PLURAL_ARGUMENT_SELECTOR",t[t.DUPLICATE_PLURAL_ARGUMENT_SELECTOR=20]="DUPLICATE_PLURAL_ARGUMENT_SELECTOR",t[t.DUPLICATE_SELECT_ARGUMENT_SELECTOR=21]="DUPLICATE_SELECT_ARGUMENT_SELECTOR",t[t.MISSING_OTHER_CLAUSE=22]="MISSING_OTHER_CLAUSE",t[t.INVALID_TAG=23]="INVALID_TAG",t[t.INVALID_TAG_NAME=25]="INVALID_TAG_NAME",t[t.UNMATCHED_CLOSING_TAG=26]="UNMATCHED_CLOSING_TAG",t[t.UNCLOSED_TAG=27]="UNCLOSED_TAG"})(At||(At={}));var fn;(function(t){t[t.literal=0]="literal",t[t.argument=1]="argument",t[t.number=2]="number",t[t.date=3]="date",t[t.time=4]="time",t[t.select=5]="select",t[t.plural=6]="plural",t[t.pound=7]="pound",t[t.tag=8]="tag"})(fn||(fn={}));var Fd;(function(t){t[t.number=0]="number",t[t.dateTime=1]="dateTime"})(Fd||(Fd={}));function Mk(t){return t.type===fn.literal}a(Mk,"isLiteralElement");function iZ(t){return t.type===fn.argument}a(iZ,"isArgumentElement");function MN(t){return t.type===fn.number}a(MN,"isNumberElement");function CN(t){return t.type===fn.date}a(CN,"isDateElement");function PN(t){return t.type===fn.time}a(PN,"isTimeElement");function DN(t){return t.type===fn.select}a(DN,"isSelectElement");function ON(t){return t.type===fn.plural}a(ON,"isPluralElement");function sZ(t){return t.type===fn.pound}a(sZ,"isPoundElement");function NN(t){return t.type===fn.tag}a(NN,"isTagElement");function FN(t){return!!(t&&typeof t=="object"&&t.type===Fd.number)}a(FN,"isNumberSkeleton");function T_(t){return!!(t&&typeof t=="object"&&t.type===Fd.dateTime)}a(T_,"isDateTimeSkeleton");var UN=/[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/,rZ=/(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;function oZ(t){var e={};return t.replace(rZ,function(n){var i=n.length;switch(n[0]){case"G":e.era=i===4?"long":i===5?"narrow":"short";break;case"y":e.year=i===2?"2-digit":"numeric";break;case"Y":case"u":case"U":case"r":throw new RangeError("`Y/u/U/r` (year) patterns are not supported, use `y` instead");case"q":case"Q":throw new RangeError("`q/Q` (quarter) patterns are not supported");case"M":case"L":e.month=["numeric","2-digit","short","long","narrow"][i-1];break;case"w":case"W":throw new RangeError("`w/W` (week) patterns are not supported");case"d":e.day=["numeric","2-digit"][i-1];break;case"D":case"F":case"g":throw new RangeError("`D/F/g` (day) patterns are not supported, use `d` instead");case"E":e.weekday=i===4?"long":i===5?"narrow":"short";break;case"e":if(i<4)throw new RangeError("`e..eee` (weekday) patterns are not supported");e.weekday=["short","long","narrow","short"][i-4];break;case"c":if(i<4)throw new RangeError("`c..ccc` (weekday) patterns are not supported");e.weekday=["short","long","narrow","short"][i-4];break;case"a":e.hour12=!0;break;case"b":case"B":throw new RangeError("`b/B` (period) patterns are not supported, use `a` instead");case"h":e.hourCycle="h12",e.hour=["numeric","2-digit"][i-1];break;case"H":e.hourCycle="h23",e.hour=["numeric","2-digit"][i-1];break;case"K":e.hourCycle="h11",e.hour=["numeric","2-digit"][i-1];break;case"k":e.hourCycle="h24",e.hour=["numeric","2-digit"][i-1];break;case"j":case"J":case"C":throw new RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead");case"m":e.minute=["numeric","2-digit"][i-1];break;case"s":e.second=["numeric","2-digit"][i-1];break;case"S":case"A":throw new RangeError("`S/A` (second) patterns are not supported, use `s` instead");case"z":e.timeZoneName=i<4?"short":"long";break;case"Z":case"O":case"v":case"V":case"X":case"x":throw new RangeError("`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead")}return""}),e}a(oZ,"parseDateTimeSkeleton");var aZ=/[\t-\r \x85\u200E\u200F\u2028\u2029]/i;function lZ(t){if(t.length===0)throw new Error("Number skeleton cannot be empty");for(var e=t.split(aZ).filter(function(h){return h.length>0}),n=[],i=0,s=e;i<s.length;i++){var r=s[i],o=r.split("/");if(o.length===0)throw new Error("Invalid number skeleton");for(var l=o[0],d=o.slice(1),c=0,u=d;c<u.length;c++){var f=u[c];if(f.length===0)throw new Error("Invalid number skeleton")}n.push({stem:l,options:d})}return n}a(lZ,"parseNumberSkeletonFromString");function cZ(t){return t.replace(/^(.*?)-/,"")}a(cZ,"icuUnitToEcma");var Ck=/^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g,BN=/^(@+)?(\+|#+)?[rs]?$/g,dZ=/(\*)(0+)|(#+)(0+)|(0+)/g,$N=/^(0+)$/;function Pk(t){var e={};return t[t.length-1]==="r"?e.roundingPriority="morePrecision":t[t.length-1]==="s"&&(e.roundingPriority="lessPrecision"),t.replace(BN,function(n,i,s){return typeof s!="str
3ing"?(e.minimumSignificantDigits=i.length,e.maximumSignificantDigits=i.length):s==="+"?e.minimumSignificantDigits=i.length:i[0]==="#"?e.maximumSignificantDigits=i.length:(e.minimumSignificantDigits=i.length,e.maximumSignificantDigits=i.length+(typeof s=="string"?s.length:0)),""}),e}a(Pk,"parseSignificantPrecision");function HN(t){switch(t){case"sign-auto":return{signDisplay:"auto"};case"sign-accounting":case"()":return{currencySign:"accounting"};case"sign-always":case"+!":return{signDisplay:"always"};case"sign-accounting-always":case"()!":return{signDisplay:"always",currencySign:"accounting"};case"sign-except-zero":case"+?":return{signDisplay:"exceptZero"};case"sign-accounting-except-zero":case"()?":return{signDisplay:"exceptZero",currencySign:"accounting"};case"sign-never":case"+_":return{signDisplay:"never"}}}a(HN,"parseSign");function uZ(t){var e;if(t[0]==="E"&&t[1]==="E"?(e={notation:"engineering"},t=t.slice(2)):t[0]==="E"&&(e={notation:"scientific"},t=t.slice(1)),e){var n=t.slice(0,2);if(n==="+!"?(e.signDisplay="always",t=t.slice(2)):n==="+?"&&(e.signDisplay="exceptZero",t=t.slice(2)),!$N.test(t))throw new Error("Malformed concise eng/scientific notation");e.minimumIntegerDigits=t.length}return e}a(uZ,"parseConciseScientificAndEngineeringStem");function Dk(t){var e={},n=HN(t);return n||e}a(Dk,"parseNotationOptions");function fZ(t){for(var e={},n=0,i=t;n<i.length;n++){var s=i[n];switch(s.stem){case"percent":case"%":e.style="percent";continue;case"%x100":e.style="percent",e.scale=100;continue;case"currency":e.style="currency",e.currency=s.options[0];continue;case"group-off":case",_":e.useGrouping=!1;continue;case"precision-integer":case".":e.maximumFractionDigits=0;continue;case"measure-unit":case"unit":e.style="unit",e.unit=cZ(s.options[0]);continue;case"compact-short":case"K":e.notation="compact",e.compactDisplay="short";continue;case"compact-long":case"KK":e.notation="compact",e.compactDisplay="long";continue;case"scientific":e=je(je(je({},e),{notation:"scientific"}),s.options.reduce(function(d,c){return je(je({},d),Dk(c))},{}));continue;case"engineering":e=je(je(je({},e),{notation:"engineering"}),s.options.reduce(function(d,c){return je(je({},d),Dk(c))},{}));continue;case"notation-simple":e.notation="standard";continue;case"unit-width-narrow":e.currencyDisplay="narrowSymbol",e.unitDisplay="narrow";continue;case"unit-width-short":e.currencyDisplay="code",e.unitDisplay="short";continue;case"unit-width-full-name":e.currencyDisplay="name",e.unitDisplay="long";continue;case"unit-width-iso-code":e.currencyDisplay="symbol";continue;case"scale":e.scale=parseFloat(s.options[0]);continue;case"rounding-mode-floor":e.roundingMode="floor";continue;case"rounding-mode-ceiling":e.roundingMode="ceil";continue;case"rounding-mode-down":e.roundingMode="trunc";continue;case"rounding-mode-up":e.roundingMode="expand";continue;case"rounding-mode-half-even":e.roundingMode="halfEven";continue;case"rounding-mode-half-down":e.roundingMode="halfTrunc";continue;case"rounding-mode-half-up":e.roundingMode="halfExpand";continue;case"integer-width":if(s.options.length>1)throw new RangeError("integer-width stems only accept a single optional option");s.options[0].replace(dZ,function(d,c,u,f,h,p){if(c)e.minimumIntegerDigits=u.length;else{if(f&&h)throw new Error("We currently do not support maximum integer digits");if(p)throw new Error("We currently do not support exact integer digits")}return""});continue}if($N.test(s.stem)){e.minimumIntegerDigits=s.stem.length;continue}if(Ck.test(s.stem)){if(s.options.length>1)throw new RangeError("Fraction-precision stems only accept a single optional option");s.stem.replace(Ck,function(d,c,u,f,h,p){return u==="*"?e.minimumFractionDigits=c.length:f&&f[0]==="#"?e.maximumFractionDigits=f.length:h&&p?(e.minimumFractionDigits=h.length,e.maximumFractionDigits=h.length+p.length):(e.minimumFractionDigits=c.length,e.maximumFractionDigits=c.length),""});var r=s.options[0];r==="w"?e=je(je({},e),{trailingZeroDisplay:"stripIfInteger"}):r&&(e=je(je({},e),Pk(r)));continue}if(BN.test(s.stem)){e=je(je({},e),Pk(s.stem));continue}var o=HN(s.stem);o&&(e=je(je({},e),o));var l=uZ(s.stem);l&&(e=je(je({},e),l))}return e}a(fZ,"parseNumberSkeleton");var dg={"001":["H","h"],419:["h","H","hB","hb"],AC:["H","h","hb","hB"],AD:["H","hB"],AE:["h","hB","hb","H"],AF:["H","hb","hB","h"],AG:["h","hb","H","hB"],AI:["H","h","hb","hB"],AL:["h","H","hB"],AM:["H","hB"],AO:["H","hB"],AR:["h","H","hB","hb"],AS:["h","H"],AT:["H","hB"],AU:["h","hb","H","hB"],AW:["H","hB"],AX:["H"],AZ:["H","hB","h"],BA:["H","hB","h"],BB:["h","hb","H","hB"],BD:["h","hB","H"],BE:["H","hB"],BF:["H","hB"],BG:["H","hB","h"],BH:["h","hB","hb","H"],BI:["H","h"],BJ:["H","hB"],BL:["H","hB"],BM:["h","hb","H","hB"],BN:["hb","hB","h","H"],BO:["h","H","hB","hb"],BQ:["H"],BR:["H","hB"],BS:["h","hb","H","hB"],BT:["h","H"],BW:["H","h","hb","hB"],BY:["H","h"],BZ:["H","h","hb","hB"],CA:["h","hb","H","hB"],CC:["H","h","hb","hB"],CD:["hB","H"],CF:["H","h","hB"],CG:["H","hB"],CH:["H","hB","h"],CI:["H","hB"],CK:["H","h","hb","hB"],CL:["h","H","hB","hb"],CM:["H","h","hB"],CN:["H","hB","hb","h"],CO:["h","H","hB","hb"],CP:["H"],CR:["h","H","hB","hb"],CU:["h","H","hB","hb"],CV:["H","hB"],CW:["H","hB"],CX:["H","h","hb","hB"],CY:["h","H","hb","hB"],CZ:["H"],DE:["H","hB"],DG:["H","h","hb","hB"],DJ:["h","H"],DK:["H"],DM:["h","hb","H","hB"],DO:["h","H","hB","hb"],DZ:["h","hB","hb","H"],EA:["H","h","hB","hb"],EC:["h","H","hB","hb"],EE:["H","hB"],EG:["h","hB","hb","H"],EH:["h","hB","hb","H"],ER:["h","H"],ES:["H","hB","h","hb"],ET:["hB","hb","h","H"],FI:["H"],FJ:["h","hb","H","hB"],FK:["H","h","hb","hB"],FM:["h","hb","H","hB"],FO:["H","h"],FR:["H","hB"],GA:["H","hB"],GB:["H","h","hb","hB"],GD:["h","hb","H","hB"],GE:["H","hB","h"],GF:["H","hB"],GG:["H","h","hb","hB"],GH:["h","H"],GI:["H","h","hb","hB"],GL:["H","h"],GM:["h","hb","H","hB"],GN:["H","hB"],GP:["H","hB"],GQ:["H","hB","h","hb"],GR:["h","H","hb","hB"],GT:["h","H","hB","hb"],GU:["h","hb","H","hB"],GW:["H","hB"],GY:["h","hb","H","hB"],HK:["h","hB","hb","H"],HN:["h","H","hB","hb"],HR:["H","hB"],HU:["H","h"],IC:["H","h","hB","hb"],ID:["H"],IE:["H","h","hb","hB"],IL:["H","hB"],IM:["H","h","hb","hB"],IN:["h","H"],IO:["H","h","hb","hB"],IQ:["h","hB","hb","H"],IR:["hB","H"],IS:["H"],IT:["H","hB"],JE:["H","h","hb","hB"],JM:["h","hb","H","hB"],JO:["h","hB","hb","H"],JP:["H","K","h"],KE:["hB","hb","H","h"],KG:["H","h","hB","hb"],KH:["hB","h","H","hb"],KI:["h","hb","H","hB"],KM:["H","h","hB","hb"],KN:["h","hb","H","hB"],KP:["h","H","hB","hb"],KR:["h","H","hB","hb"],KW:["h","hB","hb","H"],KY:["h","hb","H","hB"],KZ:["H","hB"],LA:["H","hb","hB","h"],LB:["h","hB","hb","H"],LC:["h","hb","H","hB"],LI:["H","hB","h"],LK:["H","h","hB","hb"],LR:["h","hb","H","hB"],LS:["h","H"],LT:["H","h","hb","hB"],LU:["H","h","hB"],LV:["H","hB","hb","h"],LY:["h","hB","hb","H"],MA
3:["H","h","hB","hb"],MC:["H","hB"],MD:["H","hB"],ME:["H","hB","h"],MF:["H","hB"],MG:["H","h"],MH:["h","hb","H","hB"],MK:["H","h","hb","hB"],ML:["H"],MM:["hB","hb","H","h"],MN:["H","h","hb","hB"],MO:["h","hB","hb","H"],MP:["h","hb","H","hB"],MQ:["H","hB"],MR:["h","hB","hb","H"],MS:["H","h","hb","hB"],MT:["H","h"],MU:["H","h"],MV:["H","h"],MW:["h","hb","H","hB"],MX:["h","H","hB","hb"],MY:["hb","hB","h","H"],MZ:["H","hB"],NA:["h","H","hB","hb"],NC:["H","hB"],NE:["H"],NF:["H","h","hb","hB"],NG:["H","h","hb","hB"],NI:["h","H","hB","hb"],NL:["H","hB"],NO:["H","h"],NP:["H","h","hB"],NR:["H","h","hb","hB"],NU:["H","h","hb","hB"],NZ:["h","hb","H","hB"],OM:["h","hB","hb","H"],PA:["h","H","hB","hb"],PE:["h","H","hB","hb"],PF:["H","h","hB"],PG:["h","H"],PH:["h","hB","hb","H"],PK:["h","hB","H"],PL:["H","h"],PM:["H","hB"],PN:["H","h","hb","hB"],PR:["h","H","hB","hb"],PS:["h","hB","hb","H"],PT:["H","hB"],PW:["h","H"],PY:["h","H","hB","hb"],QA:["h","hB","hb","H"],RE:["H","hB"],RO:["H","hB"],RS:["H","hB","h"],RU:["H"],RW:["H","h"],SA:["h","hB","hb","H"],SB:["h","hb","H","hB"],SC:["H","h","hB"],SD:["h","hB","hb","H"],SE:["H"],SG:["h","hb","H","hB"],SH:["H","h","hb","hB"],SI:["H","hB"],SJ:["H"],SK:["H"],SL:["h","hb","H","hB"],SM:["H","h","hB"],SN:["H","h","hB"],SO:["h","H"],SR:["H","hB"],SS:["h","hb","H","hB"],ST:["H","hB"],SV:["h","H","hB","hb"],SX:["H","h","hb","hB"],SY:["h","hB","hb","H"],SZ:["h","hb","H","hB"],TA:["H","h","hb","hB"],TC:["h","hb","H","hB"],TD:["h","H","hB"],TF:["H","h","hB"],TG:["H","hB"],TH:["H","h"],TJ:["H","h"],TL:["H","hB","hb","h"],TM:["H","h"],TN:["h","hB","hb","H"],TO:["h","H"],TR:["H","hB"],TT:["h","hb","H","hB"],TW:["hB","hb","h","H"],TZ:["hB","hb","H","h"],UA:["H","hB","h"],UG:["hB","hb","H","h"],UM:["h","hb","H","hB"],US:["h","hb","H","hB"],UY:["h","H","hB","hb"],UZ:["H","hB","h"],VA:["H","h","hB"],VC:["h","hb","H","hB"],VE:["h","H","hB","hb"],VG:["h","hb","H","hB"],VI:["h","hb","H","hB"],VN:["H","h"],VU:["h","H"],WF:["H","hB"],WS:["h","H"],XK:["H","hB","h"],YE:["h","hB","hb","H"],YT:["H","hB"],ZA:["H","h","hb","hB"],ZM:["h","hb","H","hB"],ZW:["H","h"],"af-ZA":["H","h","hB","hb"],"ar-001":["h","hB","hb","H"],"ca-ES":["H","h","hB"],"en-001":["h","hb","H","hB"],"en-HK":["h","hb","H","hB"],"en-IL":["H","h","hb","hB"],"en-MY":["h","hb","H","hB"],"es-BR":["H","h","hB","hb"],"es-ES":["H","h","hB","hb"],"es-GQ":["H","h","hB","hb"],"fr-CA":["H","h","hB"],"gl-ES":["H","h","hB"],"gu-IN":["hB","hb","h","H"],"hi-IN":["hB","h","H"],"it-CH":["H","h","hB"],"it-IT":["H","h","hB"],"kn-IN":["hB","h","H"],"ml-IN":["hB","h","H"],"mr-IN":["hB","hb","h","H"],"pa-IN":["hB","hb","h","H"],"ta-IN":["hB","h","hb","H"],"te-IN":["hB","h","H"],"zu-ZA":["H","hB","hb","h"]};function hZ(t,e){for(var n="",i=0;i<t.length;i++){var s=t.charAt(i);if(s==="j"){for(var r=0;i+1<t.length&&t.charAt(i+1)===s;)r++,i++;var o=1+(r&1),l=r<2?1:3+(r>>1),d="a",c=pZ(e);for((c=="H"||c=="k")&&(l=0);l-- >0;)n+=d;for(;o-- >0;)n=c+n}else s==="J"?n+="H":n+=s}return n}a(hZ,"getBestPattern");function pZ(t){var e=t.hourCycle;if(e===void 0&&t.hourCycles&&t.hourCycles.length&&(e=t.hourCycles[0]),e)switch(e){case"h24":return"k";case"h23":return"H";case"h12":return"h";case"h11":return"K";default:throw new Error("Invalid hourCycle")}var n=t.language,i;n!=="root"&&(i=t.maximize().region);var s=dg[i||""]||dg[n||""]||dg["".concat(n,"-001")]||dg["001"];return s[0]}a(pZ,"getDefaultHourSymbolFromLocale");var Rb,gZ=new RegExp("^".concat(UN.source,"*")),mZ=new RegExp("".concat(UN.source,"*$"));function kt(t,e){return{start:t,end:e}}a(kt,"createLocation$1");var vZ=!!String.prototype.startsWith&&"_a".startsWith("a",1),yZ=!!String.fromCodePoint,bZ=!!Object.fromEntries,EZ=!!String.prototype.codePointAt,_Z=!!String.prototype.trimStart,wZ=!!String.prototype.trimEnd,SZ=!!Number.isSafeInteger,TZ=SZ?Number.isSafeInteger:function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t&&Math.abs(t)<=9007199254740991},A_=!0;try{var AZ=VN("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu");A_=((Rb=AZ.exec("a"))===null||Rb===void 0?void 0:Rb[0])==="a"}catch{A_=!1}var Ok=a(vZ?function(e,n,i){return e.startsWith(n,i)}:function(e,n,i){return e.slice(i,i+n.length)===n},"startsWith"),x_=yZ?String.fromCodePoint:a(function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];for(var i="",s=e.length,r=0,o;s>r;){if(o=e[r++],o>1114111)throw RangeError(o+" is not a valid code point");i+=o<65536?String.fromCharCode(o):String.fromCharCode(((o-=65536)>>10)+55296,o%1024+56320)}return i},"fromCodePoint"),Nk=bZ?Object.fromEntries:a(function(e){for(var n={},i=0,s=e;i<s.length;i++){var r=s[i],o=r[0],l=r[1];n[o]=l}return n},"fromEntries"),GN=a(EZ?function(e,n){return e.codePointAt(n)}:function(e,n){var i=e.length;if(!(n<0||n>=i)){var s=e.charCodeAt(n),r;return s<55296||s>56319||n+1===i||(r=e.charCodeAt(n+1))<56320||r>57343?s:(s-55296<<10)+(r-56320)+65536}},"codePointAt"),xZ=a(_Z?function(e){return e.trimStart()}:function(e){return e.replace(gZ,"")},"trimStart"),IZ=a(wZ?function(e){return e.trimEnd()}:function(e){return e.replace(mZ,"")},"trimEnd");function VN(t,e){return new RegExp(t,e)}a(VN,"RE");var I_;if(A_){var Fk=VN("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu");I_=a(function(e,n){var i;Fk.lastIndex=n;var s=Fk.exec(e);return(i=s[1])!==null&&i!==void 0?i:""}
vendor: 16,509 bytes, line 3
3,"matchIdentifierAtIndex")}else I_=a(function(e,n){for(var i=[];;){var s=GN(e,n);if(s===void 0||WN(s)||MZ(s))break;i.push(s),n+=s>=65536?2:1}return x_.apply(void 0,i)},"matchIdentifierAtIndex");var LZ=function(){function t(e,n){n===void 0&&(n={}),this.message=e,this.position={offset:0,line:1,column:1},this.ignoreTag=!!n.ignoreTag,this.locale=n.locale,this.requiresOtherClause=!!n.requiresOtherClause,this.shouldParseSkeletons=!!n.shouldParseSkeletons}return a(t,"Parser"),t.prototype.parse=function(){if(this.offset()!==0)throw Error("parser can only be used once");return this.parseMessage(0,"",!1)},t.prototype.parseMessage=function(e,n,i){for(var s=[];!this.isEOF();){var r=this.char();if(r===123){var o=this.parseArgument(e,i);if(o.err)return o;s.push(o.val)}else{if(r===125&&e>0)break;if(r===35&&(n==="plural"||n==="selectordinal")){var l=this.clonePosition();this.bump(),s.push({type:fn.pound,location:kt(l,this.clonePosition())})}else if(r===60&&!this.ignoreTag&&this.peek()===47){if(i)break;return this.error(At.UNMATCHED_CLOSING_TAG,kt(this.clonePosition(),this.clonePosition()))}else if(r===60&&!this.ignoreTag&&L_(this.peek()||0)){var o=this.parseTag(e,n);if(o.err)return o;s.push(o.val)}else{var o=this.parseLiteral(e,n);if(o.err)return o;s.push(o.val)}}}return{val:s,err:null}},t.prototype.parseTag=function(e,n){var i=this.clonePosition();this.bump();var s=this.parseTagName();if(this.bumpSpace(),this.bumpIf("/>"))return{val:{type:fn.literal,value:"<".concat(s,"/>"),location:kt(i,this.clonePosition())},err:null};if(this.bumpIf(">")){var r=this.parseMessage(e+1,n,!0);if(r.err)return r;var o=r.val,l=this.clonePosition();if(this.bumpIf("</")){if(this.isEOF()||!L_(this.char()))return this.error(At.INVALID_TAG,kt(l,this.clonePosition()));var d=this.clonePosition(),c=this.parseTagName();return s!==c?this.error(At.UNMATCHED_CLOSING_TAG,kt(d,this.clonePosition())):(this.bumpSpace(),this.bumpIf(">")?{val:{type:fn.tag,value:s,children:o,location:kt(i,this.clonePosition())},err:null}:this.error(At.INVALID_TAG,kt(l,this.clonePosition())))}else return this.error(At.UNCLOSED_TAG,kt(i,this.clonePosition()))}else return this.error(At.INVALID_TAG,kt(i,this.clonePosition()))},t.prototype.parseTagName=function(){var e=this.offset();for(this.bump();!this.isEOF()&&kZ(this.char());)this.bump();return this.message.slice(e,this.offset())},t.prototype.parseLiteral=function(e,n){for(var i=this.clonePosition(),s="";;){var r=this.tryParseQuote(n);if(r){s+=r;continue}var o=this.tryParseUnquoted(e,n);if(o){s+=o;continue}var l=this.tryParseLeftAngleBracket();if(l){s+=l;continue}break}var d=kt(i,this.clonePosition());return{val:{type:fn.literal,value:s,location:d},err:null}},t.prototype.tryParseLeftAngleBracket=function(){return!this.isEOF()&&this.char()===60&&(this.ignoreTag||!RZ(this.peek()||0))?(this.bump(),"<"):null},t.prototype.tryParseQuote=function(e){if(this.isEOF()||this.char()!==39)return null;switch(this.peek()){case 39:return this.bump(),this.bump(),"'";case 123:case 60:case 62:case 125:break;case 35:if(e==="plural"||e==="selectordinal")break;return null;default:return null}this.bump();var n=[this.char()];for(this.bump();!this.isEOF();){var i=this.char();if(i===39)if(this.peek()===39)n.push(39),this.bump();else{this.bump();break}else n.push(i);this.bump()}return x_.apply(void 0,n)},t.prototype.tryParseUnquoted=function(e,n){if(this.isEOF())return null;var i=this.char();return i===60||i===123||i===35&&(n==="plural"||n==="selectordinal")||i===125&&e>0?null:(this.bump(),x_(i))},t.prototype.parseArgument=function(e,n){var i=this.clonePosition();if(this.bump(),this.bumpSpace(),this.isEOF())return this.error(At.EXPECT_ARGUMENT_CLOSING_BRACE,kt(i,this.clonePosition()));if(this.char()===125)return this.bump(),this.error(At.EMPTY_ARGUMENT,kt(i,this.clonePosition()));var s=this.parseIdentifierIfPossible().value;if(!s)return this.error(At.MALFORMED_ARGUMENT,kt(i,this.clonePosition()));if(this.bumpSpace(),this.isEOF())return this.error(At.EXPECT_ARGUMENT_CLOSING_BRACE,kt(i,this.clonePosition()));switch(this.char()){case 125:return this.bump(),{val:{type:fn.argument,value:s,location:kt(i,this.clonePosition())},err:null};case 44:return this.bump(),this.bumpSpace(),this.isEOF()?this.error(At.EXPECT_ARGUMENT_CLOSING_BRACE,kt(i,this.clonePosition())):this.parseArgumentOptions(e,n,s,i);default:return this.error(At.MALFORMED_ARGUMENT,kt(i,this.clonePosition()))}},t.prototype.parseIdentifierIfPossible=function(){var e=this.clonePosition(),n=this.offset(),i=I_(this.message,n),s=n+i.length;this.bumpTo(s);var r=this.clonePosition(),o=kt(e,r);return{value:i,location:o}},t.prototype.parseArgumentOptions=function(e,n,i,s){var r,o=this.clonePosition(),l=this.parseIdentifierIfPossible().value,d=this.clonePosition();switch(l){case"":return this.error(At.EXPECT_ARGUMENT_TYPE,kt(o,d));case"number":case"date":case"time":{this.bumpSpace();var c=null;if(this.bumpIf(",")){this.bumpSpace();var u=this.clonePosition(),f=this.parseSimpleArgStyleIfPossible();if(f.err)return f;var h=IZ(f.val);if(h.length===0)return this.error(At.EXPECT_ARGUMENT_STYLE,kt(this.clonePosition(),this.clonePosition()));var p=kt(u,this.clonePosition());c={style:h,styleLocation:p}}var g=this.tryParseArgumentClose(s);if(g.err)return g;var v=kt(s,this.clonePosition());if(c&&Ok(c?.style,"::",0)){var y=xZ(c.style.slice(2));if(l==="number"){var f=this.parseNumberSkeletonFromString(y,c.styleLocation);return f.err?f:{val:{type:fn.number,value:i,location:v,style:f.val},err:null}}else{if(y.length===0)return this.error(At.EXPECT_DATE_TIME_SKELETON,v);var b=y;this.locale&&(b=hZ(y,this.locale));var h={type:Fd.dateTime,pattern:b,location:c.styleLocation,parsedOptions:this.shouldParseSkeletons?oZ(b):{}},E=l==="date"?fn.date:fn.time;return{val:{type:E,value:i,location:v,style:h},err:null}}}return{val:{type:l==="number"?fn.number:l==="date"?fn.date:fn.time,value:i,location:v,style:(r=c?.style)!==null&&r!==void 0?r:null},err:null}}case"plural":case"selectordinal":case"select":{var T=this.clonePosition();if(this.bumpSpace(),!this.bumpIf(","))return this.error(At.EXPECT_SELECT_ARGUMENT_OPTIONS,kt(T,je({},T)));this.bumpSpace();var I=this.parseIdentifierIfPossible(),M=0;if(l!=="select"&&I.value==="offset"){if(!this.bumpIf(":"))return this.error(At.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,kt(this.clonePosition(),this.clonePosition()));this.bumpSpace();var f=this.tryParseDecimalInteger(At.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,At.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE);if(f.err)return f;this.bumpSpace(),I=this.parseIdentifierIfPossible(),M=f.val}var H=this.tryParsePluralOrSelectOptions(e,l,n,I);if(H.err)return H;var g=this.tryParseArgumentClose(s);if(g.err)return g;var N=kt(s,this.clonePosition());return l==="select"?{val:{type:fn.select,value:i,options:Nk(H.val),location:N},err:null}:{val:{type:fn.plural,value:i,options:Nk(H.val),offset:M,pluralType:l==="plural"?"cardinal":"ordinal",location:N},err:null}}default:return this.error(At.INVALID_ARGUMENT_TYPE,kt(o,d))}},t.prototype.tryParseArgumentClose=function(e){return this.isEOF()||this.char()!==125?this.error(At.EXPECT_ARGUMENT_CLOSING_BRACE,kt(e,this.clonePosition())):(this.bump(),{val:!0,err:null})},t.prototype.parseSimpleArgStyleIfPossible=function(){for(var e=0,n=this.clonePosition();!this.isEOF();){var i=this.char();switch(i){case 39:{this.bump();var s=this.clonePosition();if(!this.bumpUntil("'"))return this.error(At.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE,kt(s,this.clonePosition()));this.bump();break}case 123:{e+=1,this.bump();break}case 125:{if(e>0)e-=1;else return{val:this.message.slice(n.offset,this.offset()),err:null};break}default:this.bump();break}}return{val:this.message.slice(n.offset,this.offset()),err:null}},t.prototype.parseNumberSkeletonFromString=function(e,n){var i=[];try{i=lZ(e)}catch{return this.error(At.INVALID_NUMBER_SKELETON,n)}return{val:{type:Fd.number,tokens:i,location:n,parsedOptions:this.shouldParseSkeletons?fZ(i):{}},err:null}},t.prototype.tryParsePluralOrSelectOptions=function(e,n,i,s){for(var r,o=!1,l=[],d=new Set,c=s.value,u=s.location;;){if(c.length===0){var f=this.clonePosition();if(n!=="select"&&this.bumpIf("=")){var h=this.tryParseDecimalInteger(At.EXPECT_PLURAL_ARGUMENT_SELECTOR,At.INVALID_PLURAL_ARGUMENT_SELECTOR);if(h.err)return h;u=kt(f,this.clonePosition()),c=this.message.slice(f.offset,this.offset())}else break}if(d.has(c))return this.error(n==="select"?At.DUPLICATE_SELECT_ARGUMENT_SELECTOR:At.DUPLICATE_PLURAL_ARGUMENT_SELECTOR,u);c==="other"&&(o=!0),this.bumpSpace();var p=this.clonePosition();if(!this.bumpIf("{"))return this.error(n==="select"?At.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT:At.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT,kt(this.clonePosition(),this.clonePosition()));var g=this.parseMessage(e+1,n,i);if(g.err)return g;var v=this.tryParseArgumentClose(p);if(v.err)return v;l.push([c,{value:g.val,location:kt(p,this.clonePosition())}]),d.add(c),this.bumpSpace(),r=this.parseIdentifierIfPossible(),c=r.value,u=r.location}return l.length===0?this.error(n==="select"?At.EXPECT_SELECT_ARGUMENT_SELECTOR:At.EXPECT_PLURAL_ARGUMENT_SELECTOR,kt(this.clonePosition(),this.clonePosition())):this.requiresOtherClause&&!o?this.error(At.MISSING_OTHER_CLAUSE,kt(this.clonePosition(),this.clonePosition())):{val:l,err:null}},t.prototype.tryParseDecimalInteger=function(e,n){var i=1,s=this.clonePosition();this.bumpIf("+")||this.bumpIf("-")&&(i=-1);for(var r=!1,o=0;!this.isEOF();){var l=this.char();if(l>=48&&l<=57)r=!0,o=o*10+(l-48),this.bump();else break}var d=kt(s,this.clonePosition());return r?(o*=i,TZ(o)?{val:o,err:null}:this.error(n,d)):this.error(e,d)},t.prototype.offset=function(){return this.position.offset},t.prototype.isEOF=function(){return this.offset()===this.message.length},t.prototype.clonePosition=function(){return{offset:this.position.offset,line:this.position.line,column:this.position.column}},t.prototype.char=function(){var e=this.position.offset;if(e>=this.message.length)throw Error("out of bound");var n=GN(this.message,e);if(n===void 0)throw Error("Offset ".concat(e," is at invalid UTF-16 code unit boundary"));return n},t.prototype.error=function(e,n){return{val:null,err:{kind:e,message:this.message,location:n}}},t.prototype.bump=function(){if(!this.isEOF()){var e=this.char();e===10?(this.position.line+=1,this.position.column=1,this.position.offset+=1):(this.position.column+=1,this.position.offset+=e<65536?1:2)}},t.prototype.bumpIf=function(e){if(Ok(this.message,e,this.offset())){for(var n=0;n<e.length;n++)this.bump();return!0}return!1},t.prototype.bumpUntil=function(e){var n=this.offset(),i=this.message.indexOf(e,n);return i>=0?(this.bumpTo(i),!0):(this.bumpTo(this.message.length),!1)},t.prototype.bumpTo=function(e){if(this.offset()>e)throw Error("targetOffset ".concat(e," must be greater than or equal to the current offset ").concat(this.offset()));for(e=Math.min(e,this.message.length);;){var n=this.offset();if(n===e)break;if(n>e)throw Error("targetOffset ".concat(e," is at invalid UTF-16 code unit boundary"));if(this.bump(),this.isEOF())break}},t.prototype.bumpSpace=function(){for(;!this.isEOF()&&WN(this.char());)this.bump()},t.prototype.peek=function(){if(this.isEOF())return null;var e=this.char(),n=this.offset(),i=this.message.charCodeAt(n+(e>=65536?2:1));return i??null},t}();function L_(t){return t>=97&&t<=122||t>=65&&t<=90}a(L_,"_isAlpha");function RZ(t){return L_(t)||t===47}a(RZ,"_isAlphaOrSlash");function kZ(t){return t===45||t===46||t>=48&&t<=57||t===95||t>=97&&t<=122||t>=65&&t<=90||t==183||t>=192&&t<=214||t>=216&&t<=246||t>=248&&t<=893||t>=895&&t<=8191||t>=8204&&t<=8205||t>=8255&&t<=8256||t>=8304&&t<=8591||t>=11264&&t<=12271||t>=12289&&t<=55295||t>=63744&&t<=64975||t>=65008&&t<=65533||t>=65536&&t<=983039}a(kZ,"_isPotentialElementNameChar");function WN(t){return t>=9&&t<=13||t===32||t===133||t>=8206&&t<=8207||t===8232||t===8233}a(WN,"_isWhiteSpace");function MZ(t){return t>=33&&t<=35||t===36||t>=37&&t<=39||t===40||t===41||t===42||t===43||t===44||t===45||t>=46&&t<=47||t>=58&&t<=59||t>=60&&t<=62||t>=63&&t<=64||t===91||t===92||t===93||t===94||t===96||t===123||t===124||t===125||t===126||t===161||t>=162&&t<=165||t===166||t===167||t===169||t===171||t===172||t===174||t===176||t===177||t===182||t===187||t===191||t===215||t===247||t>=8208&&t<=8213||t>=8214&&t<=8215||t===8216||t===8217||t===8218||t>=8219&&t<=8220||t===8221||t===8222||t===8223||t>=8224&&t<=8231||t>=8240&&t<=8248||t===8249||t===8250||t>=8251&&t<=8254||t>=8257&&t<=8259||t===8260||t===8261||t===8262||t>=8263&&t<=8273||t===8274||t===8275||t>=8277&&t<=8286||t>=8592&&t<=8596||t>=8597&&t<=8601||t>=8602&&t<=8603||t>=8604&&t<=8607||t===8608||t>=8609&&t<=8610||t===8611||t>=8612&&t<=8613||t===8614||t>=8615&&t<=8621||t===8622||t>=8623&&t<=8653||t>=8654&&t<=8655||t>=8656&&t<=8657||t===8658||t===8659||t===8660||t>=8661&&t<=8691||t>=8692&&t<=8959||t>=8960&&t<=8967||t===8968||t===8969||t===8970||t===8971||t>=8972&&t<=8991||t>=8992&&t<=8993||t>=8994&&t<=9e3||t===9001||t===9002||t>=9003&&t<=9083||t===9084||t>=9085&&t<=9114||t>=9115&&t<=9139||t>=9140&&t<=9179||t>=9180&&t<=9185||t>=9186&&t<=9254||t>=9255&&t<=9279||t>=9280&&t<=9290||t>=9291&&t<=9311||t>=9472&&t<=9654||t===9655||t>=9656&&t<=9664||t===9665||t>=9666&&t<=9719||t>=9720&&t<=9727||t>=9728&&t<=9838||t===9839||t>=9840&&t<=10087||t===10088||t===10089||t===10090||t===10091||t===10092||t===10093||t===10094||t===10095||t===10096||t===10097||t===10098||t===10099||t===10100||t===10101||t>=10132&&t<=10175||t>=10176&&t<=10180||t===10181||t===10182||t>=10183&&t<=10213||t===10214||t===10215||t===10216||t===10217||t===10218||t===10219||t===10220||t===10221||t===10222||t===10223||t>=10224&&t<=10239||t>=10240&&t<=10495||t>=10496&&t<=10626||t===10627||t===10628||t===10629||t===10630||t===10631||t===10632||t===10633||t===10634||t===10635||t===10636||t===10637||t===10638||t===10639||t===10640||t===10641||t===10642||t===10643||t===10644||t===10645||t===10646||t===10647||t===10648||t>=10649&&t<=10711||t===10712||t===10713||t===10714||t===10715||t>=10716&&t<=10747||t===10748||t===10749||t>=10750&&t<=11007||t>=11008&&t<=11055||t>=11056&&t<=11076||t>=11077&&t<=11078||t>=11079&&t<=11084||t>=11085&&t<=11123||t>=11124&&t<=11125||t>=11126&&t<=11157||t===11158||t>=11159&&t<=11263||t>=11776&&t<=11777||t===11778||t===11779||t===11780||t===11781||t>=11782&&t<=11784||t===11785||t===11786||t===11787||t===11788||t===11789||t>=11790&&t<=11798||t===11799||t>=11800&&t<=11801||t===11802||t===11803||t===11804||t===11805||t>=11806&&t<=11807||t===11808||t===11809||t===11810||t===11811||t===11812||t===11813||t===11814||t===11815||t===11816||t===11817||t>=11818&&t<=11822||t===11823||t>=11824&&t<=11833||t>=11834&&t<=11835||t>=11836&&t<=11839||t===11840||t===11841||t===11842||t>=11843&&t<=11855||t>=11856&&t<=11857||t===11858||t>=11859&&t<=11903||t>=12289&&t<=12291||t===12296||t===12297||t===12298||t===12299||t===12300||t===12301||t===12302||t===12303||t===12304||t===12305||t>=12306&&t<=12307||t===12308||t===12309||t===12310||t===12311||t===12312||t===12313||t===12314||t===12315||t===12316||t===12317||t>=12318&&t<=12319||t===12320||t===12336||t===64830||t===64831||t>=65093&&t<=65094}a(MZ,"_isPatternSyntax");function R_(t){t.forEach(function(e){if(delete e.location,DN(e)||ON(e))for(var n in e.options)delete e.options[n].location,R_(e.options[n].value);else MN(e)&&FN(e.style)||(CN(e)||PN(e))&&T_(e.style)?delete e.style.location:NN(e)&&R_(e.children)})}a(R_,"pruneLocation");function CZ(t,e){e===void 0&&(e={}),e=je({shouldParseSkeletons:!0,requiresOtherClause:!0},e);var n=new LZ(t,e).parse();if(n.err){var i=SyntaxError(At[n.err.kind]);throw i.location=n.err.location,i.originalMessage=n.err.message,i}return e?.captureLocation||R_(n.val),n.val}a(CZ,"parse$1");var Br;(function(t){t.MISSING_VALUE="MISSING_VALUE",t.INVALID_VALUE="INVALID_VALUE",t.MISSING_INTL_API="MISSING_INTL_API"})(Br||(Br={}));var Ha=function(t){Zs(e,t);function e(n,i,s){var r=t.call(this,n)||this;return r.code=i,r.originalMessage=s,r}return a(e,"FormatError"),e.prototype.toString=function(){return"[formatjs Error: ".concat(this.code,"] ").concat(this.message)},e}(Error),Uk=function(t){Zs(e,t);function e(n,i,s,r){return t.call(this,'Invalid values for "'.concat(n,'": "').concat(i,'". Options are "').concat(Object.keys(s).join('", "'),'"'),Br.INVALID_VALUE,r)||this}return a(e,"InvalidValueError"),e}(Ha),PZ=function(t){Zs(e,t);function e(n,i,s){return t.call(this,'Value for "'.concat(n,'" must be of type ').concat(i),Br.INVALID_VALUE,s)||this}return a(e,"InvalidValueTypeError"),e}(Ha),DZ=function(t){Zs(e,t);
vendor: 5,109 bytes, lines 3-5
3function e(n,i){return t.call(this,'The intl string context variable "'.concat(n,'" was not provided to the string "').concat(i,'"'),Br.MISSING_VALUE,i)||this}return a(e,"MissingValueError"),e}(Ha),Ci;(function(t){t[t.literal=0]="literal",t[t.object=1]="object"})(Ci||(Ci={}));function OZ(t){return t.length<2?t:t.reduce(function(e,n){var i=e[e.length-1];return!i||i.type!==Ci.literal||n.type!==Ci.literal?e.push(n):i.value+=n.value,e},[])}a(OZ,"mergeLiteral");function NZ(t){return typeof t=="function"}a(NZ,"isFormatXMLElementFn");function am(t,e,n,i,s,r,o){if(t.length===1&&Mk(t[0]))return[{type:Ci.literal,value:t[0].value}];for(var l=[],d=0,c=t;d<c.length;d++){var u=c[d];if(Mk(u)){l.push({type:Ci.literal,value:u.value});continue}if(sZ(u)){typeof r=="number"&&l.push({type:Ci.literal,value:n.getNumberFormat(e).format(r)});continue}var f=u.value;if(!(s&&f in s))throw new DZ(f,o);var h=s[f];if(iZ(u)){(!h||typeof h=="string"||typeof h=="number")&&(h=typeof h=="string"||typeof h=="number"?String(h):""),l.push({type:typeof h=="string"?Ci.literal:Ci.object,value:h});continue}if(CN(u)){var p=typeof u.style=="string"?i.date[u.style]:T_(u.style)?u.style.parsedOptions:void 0;l.push({type:Ci.literal,value:n.getDateTimeFormat(e,p).format(h)});continue}if(PN(u)){var p=typeof u.style=="string"?i.time[u.style]:T_(u.style)?u.style.parsedOptions:i.time.medium;l.push({type:Ci.literal,value:n.getDateTimeFormat(e,p).format(h)});continue}if(MN(u)){var p=typeof u.style=="string"?i.number[u.style]:FN(u.style)?u.style.parsedOptions:void 0;p&&p.scale&&(h=h*(p.scale||1)),l.push({type:Ci.literal,value:n.getNumberFormat(e,p).format(h)});continue}if(NN(u)){var g=u.children,v=u.value,y=s[v];if(!NZ(y))throw new PZ(v,"function",o);var b=am(g,e,n,i,s,r),E=y(b.map(function(M){return M.value}));Array.isArray(E)||(E=[E]),l.push.apply(l,E.map(function(M){return{type:typeof M=="string"?Ci.literal:Ci.object,value:M}}))}if(DN(u)){var T=u.options[h]||u.options.other;if(!T)throw new Uk(u.value,h,Object.keys(u.options),o);l.push.apply(l,am(T.value,e,n,i,s));continue}if(ON(u)){var T=u.options["=".concat(h)];if(!T){if(!Intl.PluralRules)throw new Ha(`Intl.PluralRules is not available in this environment.
4Try polyfilling it using "@formatjs/intl-pluralrules"
5`,Br.MISSING_INTL_API,o);var I=n.getPluralRules(e,{type:u.pluralType}).select(h-(u.offset||0));T=u.options[I]||u.options.other}if(!T)throw new Uk(u.value,h,Object.keys(u.options),o);l.push.apply(l,am(T.value,e,n,i,s,h-(u.offset||0)));continue}}return OZ(l)}a(am,"formatToParts");function FZ(t,e){return e?je(je(je({},t||{}),e||{}),Object.keys(t).reduce(function(n,i){return n[i]=je(je({},t[i]),e[i]||{}),n},{})):t}a(FZ,"mergeConfig$1");function UZ(t,e){return e?Object.keys(t).reduce(function(n,i){return n[i]=FZ(t[i],e[i]),n},je({},t)):t}a(UZ,"mergeConfigs");function kb(t){return{create:function(){return{get:function(e){return t[e]},set:function(e,n){t[e]=n}}}}}a(kb,"createFastMemoizeCache$1");function BZ(t){return t===void 0&&(t={number:{},dateTime:{},pluralRules:{}}),{getNumberFormat:Pi(function(){for(var e,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];return new((e=Intl.NumberFormat).bind.apply(e,Zi([void 0],n,!1)))},{cache:kb(t.number),strategy:Di.variadic}),getDateTimeFormat:Pi(function(){for(var e,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];return new((e=Intl.DateTimeFormat).bind.apply(e,Zi([void 0],n,!1)))},{cache:kb(t.dateTime),strategy:Di.variadic}),getPluralRules:Pi(function(){for(var e,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];return new((e=Intl.PluralRules).bind.apply(e,Zi([void 0],n,!1)))},{cache:kb(t.pluralRules),strategy:Di.variadic})}}a(BZ,"createDefaultFormatters");var zN=function(){function t(e,n,i,s){n===void 0&&(n=t.defaultLocale);var r=this;if(this.formatterCache={number:{},dateTime:{},pluralRules:{}},this.format=function(d){var c=r.formatToParts(d);if(c.length===1)return c[0].value;var u=c.reduce(function(f,h){return!f.length||h.type!==Ci.literal||typeof f[f.length-1]!="string"?f.push(h.value):f[f.length-1]+=h.value,f},[]);return u.length<=1?u[0]||"":u},this.formatToParts=function(d){return am(r.ast,r.locales,r.formatters,r.formats,d,void 0,r.message)},this.resolvedOptions=function(){var d;return{locale:((d=r.resolvedLocale)===null||d===void 0?void 0:d.toString())||Intl.NumberFormat.supportedLocalesOf(r.locales)[0]}},this.getAst=function(){return r.ast},this.locales=n,this.resolvedLocale=t.resolveLocale(n),typeof e=="string"){if(this.message=e,!t.__parse)throw new TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");var o=s||{};o.formatters;var l=ZY(o,["formatters"]);this.ast=t.__parse(e,je(je({},l),{locale:this.resolvedLocale}))}else this.ast=e;if(!Array.isArray(this.ast))throw new TypeError("A message must be provided as a String or AST.");this.formats=UZ(t.formats,i),this.formatters=s&&s.formatters||BZ(this.formatterCache)}return a(t,"IntlMessageFormat"),Object.defineProperty(t,"defaultLocale",{get:function(){return t.memoizedDefaultLocale||(t.memoizedDefaultLocale=new Intl.NumberFormat().resolvedOptions().locale),t.memoizedDefaultLocale}
5,enumerable:!1,configurable:!0}),t.memoizedDefaultLocale=null,t.resolveLocale=function(e){if(!(typeof Intl.Locale>"u")){var n=Intl.NumberFormat.supportedLocalesOf(e);return n.length>0?new Intl.Locale(n[0]):new Intl.Locale(typeof e=="string"?e:e[0])}},t.__parse=CZ,t.formats={number:{integer:{maximumFractionDigits:0},currency:{style:"currency"},percent:{style:"percent"}},date:{short:{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{short:{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},long:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}},t}(),Vl;(function(t){t.FORMAT_ERROR="FORMAT_ERROR",t.UNSUPPORTED_FORMATTER="UNSUPPORTED_FORMATTER",t.INVALID_CONFIG="INVALID_CONFIG",t.MISSING_DATA="MISSING_DATA",t.MISSING_TRANSLATION="MISSING_TRANSLATION"})(Vl||(Vl={}));var Dp=function(t){Zs(e,t);function e(n,i,s){var r=this,o=s?s instanceof Error?s:new Error(String(s)):void 0;return r=t.call(this,"[@formatjs/intl Error ".concat(n,"] ").concat(i,`
6`).concat(o?`
7`.concat(o.message,`
8`).concat(o.stack):""))||this,r.code=n,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(r,e),r}return a(e,"IntlError"),e}(Error),$Z=function(t){Zs(e,t);function e(n,i){return t.call(this,Vl.UNSUPPORTED_FORMATTER,n,i)||this}return a(e,"UnsupportedFormatterError"),e}(Dp),HZ=function(t){Zs(e,t);function e(n,i){return t.call(this,Vl.INVALID_CONFIG,n,i)||this}return a(e,"InvalidConfigError"),e}(Dp),Bk=function(t){Zs(e,t);function e(n,i){return t.call(this,Vl.MISSING_DATA,n,i)||this}return a(e,"MissingDataError"),e}(Dp),Cs=function(t){Zs(e,t);function e(n,i,s){var r=t.call(this,Vl.FORMAT_ERROR,"".concat(n,`
9Locale: `).concat(i,`
10`),s)||this;return r.locale=i,r}return a(e,"IntlFormatError"),e}(Dp),Mb=function(t){Zs(e,t);function e(n,i,s,r){var o=t.call(this,"".concat(n,`
11MessageID: `).concat(s?.id,`
12Default Message: `).concat(s?.defaultMessage,`
13Description: `).concat(s?.description,`
14`),i,r)||this;return o.descriptor=s,o.locale=i,o}return a(e,"MessageFormatError"),e}(Cs),GZ=function(t){Zs(e,t);function e(n,i){var s=t.call(this,Vl.MISSING_TRANSLATION,'Missing message: "'.concat(n.id,'" for locale "').concat(i,'", using ').concat(n.defaultMessage?"default message (".concat(typeof n.defaultMessage=="string"?n.defaultMessage:n.defaultMessage.map(function(r){var o;return(o=r.value)!==null&&o!==void 0?o:JSON.stringify(r)}).join(),")"):"id"," as fallback."))||this;return s.descriptor=n,s}return a(e,"MissingTranslationError"),e}(Dp);function ic(t,e,n){return n===void 0&&(n={}),e.reduce(function(i,s){return s in t?i[s]=t[s]:s in n&&(i[s]=n[s]),i},{})}a(ic,"filterProps");var VZ=a(function(t){},"defaultErrorHandler"),WZ=a(function(t){},"defaultWarnHandler"),KN={formats:{},messages:{},timeZone:void 0,defaultLocale:"en",defaultFormats:{},fallbackOnEmptyString:!0,onError:VZ,onWarn:WZ};function qN(){return{dateTime:{},number:{},message:{},relativeTime:{},pluralRules:{},list:{},displayNames:{}}}a(qN,"createIntlCache");function qa(t){return{create:function(){return{get:function(e){return t[e]},set:function(e,n){t[e]=n}}}}}a(qa,"createFastMemoizeCache");function zZ(t){t===void 0&&(t=qN());var e=Intl.RelativeTimeFormat,n=Intl.ListFormat,i=Intl.DisplayNames,s=Pi(function(){for(var l,d=[],c=0;c<arguments.length;c++)d[c]=arguments[c];return new((l=Intl.DateTimeFormat).bind.apply(l,Zi([void 0],d,!1)))},{cache:qa(t.dateTime),strategy:Di.variadic}),r=Pi(function(){for(var l,d=[],c=0;c<arguments.length;c++)d[c]=arguments[c];return new((l=Intl.NumberFormat).bind.apply(l,Zi([void 0],d,!1)))},{cache:qa(t.number),strategy:Di.variadic}),o=Pi(function(){for(var l,d=[],c=0;c<arguments.length;c++)d[c]=arguments[c];return new((l=Intl.PluralRules).bind.apply(l,Zi([void 0],d,!1)))},{cache:qa(t.pluralRules),strategy:Di.variadic});return{getDateTimeFormat:s,getNumberFormat:r,getMessageFormat:Pi(function(l,d,c,u){return new zN(l,d,c,je({formatters:{getNumberFormat:r,getDateTimeFormat:s,getPluralRules:o}},u||{}))},{cache:qa(t.message),strategy:Di.variadic}),getRelativeTimeFormat:Pi(function(){for(var l=[],d=0;d<arguments.length;d++)l[d]=arguments[d];return new(e.bind.apply(e,Zi([void 0],l,!1)))},{cache:qa(t.relativeTime),strategy:Di.variadic}),getPluralRules:o,getListFormat:Pi(function(){for(var l=[],d=0;d<arguments.length;d++)l[d]=arguments[d];return new(n.bind.apply(n,Zi([void 0],l,!1)))},{cache:qa(t.list),strategy:Di.variadic}),getDisplayNames:Pi(function(){for(var l=[],d=0;d<arguments.length;d++)l[d]=arguments[d];return new(i.bind.apply(i,Zi([void 0],l,!1)))},{cache:qa(t.displayNames),strategy:Di.variadic})}}a(zZ,"createFormatters");function M1(t,e,n,i){var s=t&&t[e],r;if(s&&(r=s[n]),r)return r;i(new $Z("No ".concat(e," format named: ").concat(n)))}a(M1,"getNamedFormat");function KZ(t,e,n){if(n===void 0&&(n=Error),!t)throw new n(e)}a(KZ,"invariant$1");Pi(function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return new((t=Intl.NumberFormat).bind.apply(t,Zi([void 0],e,!1)))},{strategy:Di.variadic});Pi(function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return new((t=Intl.DateTimeFormat).bind.apply(t,Zi([void 0],e,!1)))},{strategy:Di.variadic});Pi(function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return new((t=Intl.PluralRules).bind.apply(t,Zi([void 0],e,!1)))},{strategy:Di.variadic});Pi(function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return new((t=Intl.Locale).bind.apply(t,Zi([void 0],e,!1)))},{strategy:Di.variadic});Pi(function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return new((t=Intl.ListFormat).bind.apply(t,Zi([void 0],e,!1)))},{strategy:Di.variadic});function ug(t,e){return Object.keys(t).reduce(function(n,i){return n[i]=je({timeZone:e},t[i]),n},{})}a(ug,"setTimeZoneInOptions");function $k(t,e){var n=Object.keys(je(je({},t),e));return n.reduce(function(i,s){return i[s]=je(je({},t[s]||{}),e[s]||{}),i},{})}a($k,"deepMergeOptions");function Hk(t,e){if(!e)return t;var n=zN.formats;return je(je(je({},n),t),{date:$k(ug(n.date,e),ug(t.date||{},e)),time:$k(ug(n.time,e),ug(t.time||{},e))})}a(Hk,"deepMergeFormatsAndSetTimeZone");var Gk=a(function(t,e,n,i,s){var r=t.locale,o=t.formats,l=t.messages,d=t.defaultLocale,c=t.defaultFormats,u=t.fallbackOnEmptyString,f=t.onError,h=t.timeZone,p=t.defaultRichTextElements;n===void 0&&(n={id:""});var g=n.id,v=n.defaultMessage;KZ(!!g,"[@formatjs/intl] An `id` must be provided to format a message. You can either:\n1. Configure your build toolchain with [babel-plugin-formatjs](https://formatjs.io/docs/tooling/babel-plugin)\nor [@formatjs/ts-transformer](https://formatjs.io/docs/tooling/ts-transformer) OR\n2. Configure your `eslint` config to include [eslint-plugin-formatjs](https://formatjs.io/docs/tooling/linter#enforce-id)\nto autofix this issue");
vendor: 8,021 bytes, lines 14-24
14var y=String(g),b=l&&Object.prototype.hasOwnProperty.call(l,y)&&l[y];if(Array.isArray(b)&&b.length===1&&b[0].type===fn.literal)return b[0].value;if(!i&&b&&typeof b=="string"&&!p)return b.replace(/'\{(.*?)\}'/gi,"{$1}");if(i=je(je({},p),i||{}),o=Hk(o,h),c=Hk(c,h),!b){if(u===!1&&b==="")return b;if((!v||r&&r.toLowerCase()!==d.toLowerCase())&&f(new GZ(n,r)),v)try{var E=e.getMessageFormat(v,d,c,s);return E.format(i)}catch(T){return f(new Mb('Error formatting default message for: "'.concat(y,'", rendering default message verbatim'),r,n,T)),typeof v=="string"?v:y}return y}try{var E=e.getMessageFormat(b,r,o,je({formatters:e},s||{}));return E.format(i)}catch(T){f(new Mb('Error formatting message: "'.concat(y,'", using ').concat(v?"default message":"id"," as fallback."),r,n,T))}if(v)try{var E=e.getMessageFormat(v,d,c,s);return E.format(i)}catch(T){f(new Mb('Error formatting the default message for: "'.concat(y,'", rendering message verbatim'),r,n,T))}return typeof b=="string"?b:typeof v=="string"?v:y},"formatMessage"),jN=["formatMatcher","timeZone","hour12","weekday","era","year","month","day","hour","minute","second","timeZoneName","hourCycle","dateStyle","timeStyle","calendar","numberingSystem","fractionalSecondDigits"];function Ey(t,e,n,i){var s=t.locale,r=t.formats,o=t.onError,l=t.timeZone;i===void 0&&(i={});var d=i.format,c=je(je({},l&&{timeZone:l}),d&&M1(r,e,d,o)),u=ic(i,jN,c);return e==="time"&&!u.hour&&!u.minute&&!u.second&&!u.timeStyle&&!u.dateStyle&&(u=je(je({},u),{hour:"numeric",minute:"numeric"})),n(s,u)}a(Ey,"getFormatter$2");function qZ(t,e){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];var s=n[0],r=n[1],o=r===void 0?{}:r,l=typeof s=="string"?new Date(s||0):s;try{return Ey(t,"date",e,o).format(l)}catch(d){t.onError(new Cs("Error formatting date.",t.locale,d))}return String(l)}a(qZ,"formatDate");function jZ(t,e){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];var s=n[0],r=n[1],o=r===void 0?{}:r,l=typeof s=="string"?new Date(s||0):s;try{return Ey(t,"time",e,o).format(l)}catch(d){t.onError(new Cs("Error formatting time.",t.locale,d))}return String(l)}a(jZ,"formatTime$1");function YZ(t,e){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];var s=n[0],r=n[1],o=n[2],l=o===void 0?{}:o,d=t.timeZone,c=t.locale,u=t.onError,f=ic(l,jN,d?{timeZone:d}:{});try{return e(c,f).formatRange(s,r)}catch(h){u(new Cs("Error formatting date time range.",t.locale,h))}return String(s)}a(YZ,"formatDateTimeRange");function ZZ(t,e){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];var s=n[0],r=n[1],o=r===void 0?{}:r,l=typeof s=="string"?new Date(s||0):s;try{return Ey(t,"date",e,o).formatToParts(l)}catch(d){t.onError(new Cs("Error formatting date.",t.locale,d))}return[]}a(ZZ,"formatDateToParts");function QZ(t,e){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];var s=n[0],r=n[1],o=r===void 0?{}:r,l=typeof s=="string"?new Date(s||0):s;try{return Ey(t,"time",e,o).formatToParts(l)}catch(d){t.onError(new Cs("Error formatting time.",t.locale,d))}return[]}a(QZ,"formatTimeToParts");var JZ=["style","type","fallback","languageDisplay"];function XZ(t,e,n,i){var s=t.locale,r=t.onError,o=Intl.DisplayNames;o||r(new Ha(`Intl.DisplayNames is not available in this environment.
15Try polyfilling it using "@formatjs/intl-displaynames"
16`,Br.MISSING_INTL_API));var l=ic(i,JZ);try{return e(s,l).of(n)}catch(d){r(new Cs("Error formatting display name.",s,d))}}a(XZ,"formatDisplayName");var eQ=["type","style"],Vk=Date.now();function tQ(t){return"".concat(Vk,"_").concat(t,"_").concat(Vk)}a(tQ,"generateToken");function nQ(t,e,n,i){i===void 0&&(i={});var s=YN(t,e,n,i).reduce(function(r,o){var l=o.value;return typeof l!="string"?r.push(l):typeof r[r.length-1]=="string"?r[r.length-1]+=l:r.push(l),r},[]);return s.length===1?s[0]:s.length===0?"":s}a(nQ,"formatList");function YN(t,e,n,i){var s=t.locale,r=t.onError;i===void 0&&(i={});var o=Intl.ListFormat;o||r(new Ha(`Intl.ListFormat is not available in this environment.
17Try polyfilling it using "@formatjs/intl-listformat"
18`,Br.MISSING_INTL_API));var l=ic(i,eQ);try{var d={},c=n.map(function(u,f){if(typeof u=="object"){var h=tQ(f);return d[h]=u,h}return String(u)});return e(s,l).formatToParts(c).map(function(u){return u.type==="literal"?u:je(je({},u),{value:d[u.value]||u.value})})}catch(u){r(new Cs("Error formatting list.",s,u))}return n}a(YN,"formatListToParts");var iQ=["type"];function sQ(t,e,n,i){var s=t.locale,r=t.onError;i===void 0&&(i={}),Intl.PluralRules||r(new Ha(`Intl.PluralRules is not available in this environment.
19Try polyfilling it using "@formatjs/intl-pluralrules"
20`,Br.MISSING_INTL_API));var o=ic(i,iQ);try{return e(s,o).select(n)}catch(l){r(new Cs("Error formatting plural.",s,l))}return"other"}a(sQ,"formatPlural");var rQ=["numeric","style"];function oQ(t,e,n){var i=t.locale,s=t.formats,r=t.onError;n===void 0&&(n={});var o=n.format,l=!!o&&M1(s,"relative",o,r)||{},d=ic(n,rQ,l);return e(i,d)}a(oQ,"getFormatter$1");function aQ(t,e,n,i,s){s===void 0&&(s={}),i||(i="second");var r=Intl.RelativeTimeFormat;r||t.onError(new Ha(`Intl.RelativeTimeFormat is not available in this environment.
21Try polyfilling it using "@formatjs/intl-relativetimeformat"
22`,Br.MISSING_INTL_API));try{return oQ(t,e,s).format(n,i)}catch(o){t.onError(new Cs("Error formatting relative time.",t.locale,o))}return String(n)}a(aQ,"formatRelativeTime");var lQ=["style","currency","unit","unitDisplay","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","currencyDisplay","currencySign","notation","signDisplay","unit","unitDisplay","numberingSystem","trailingZeroDisplay","roundingPriority","roundingIncrement","roundingMode"];function ZN(t,e,n){var i=t.locale,s=t.formats,r=t.onError;n===void 0&&(n={});var o=n.format,l=o&&M1(s,"number",o,r)||{},d=ic(n,lQ,l);return e(i,d)}a(ZN,"getFormatter");function cQ(t,e,n,i){i===void 0&&(i={});try{return ZN(t,e,i).format(n)}catch(s){t.onError(new Cs("Error formatting number.",t.locale,s))}return String(n)}a(cQ,"formatNumber");function dQ(t,e,n,i){i===void 0&&(i={});try{return ZN(t,e,i).formatToParts(n)}catch(s){t.onError(new Cs("Error formatting number.",t.locale,s))}return[]}a(dQ,"formatNumberToParts");function uQ(t){var e=t?t[Object.keys(t)[0]]:void 0;return typeof e=="string"}a(uQ,"messagesContainString");function fQ(t){t.onWarn&&t.defaultRichTextElements&&uQ(t.messages||{})&&t.onWarn(`[@formatjs/intl] "defaultRichTextElements" was specified but "message" was not pre-compiled. 
23Please consider using "@formatjs/cli" to pre-compile your messages for performance.
24For more details see https://formatjs.io/docs/getting-started/message-distribution`)}a(fQ,"verifyConfigMessages");function Wk(t,e){var n=zZ(e),i=je(je({},KN),t),s=i.locale,r=i.defaultLocale,o=i.onError;return s?!Intl.NumberFormat.supportedLocalesOf(s).length&&o?o(new Bk('Missing locale data for locale: "'.concat(s,'" in Intl.NumberFormat. Using default locale: "').concat(r,'" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details'))):!Intl.DateTimeFormat.supportedLocalesOf(s).length&&o&&o(new Bk('Missing locale data for locale: "'.concat(s,'" in Intl.DateTimeFormat. Using default locale: "').concat(r,'" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details'))):(o&&o(new HZ('"locale" was not configured, using "'.concat(r,'" as fallback. See https://formatjs.io/docs/react-intl/api#intlshape for more details'))),i.locale=i.defaultLocale||"en"),fQ(i),je(je({},i),{formatters:n,formatNumber:cQ.bind(null,i,n.getNumberFormat),formatNumberToParts:dQ.bind(null,i,n.getNumberFormat),formatRelativeTime:aQ.bind(null,i,n.getRelativeTimeFormat),formatDate:qZ.bind(null,i,n.getDateTimeFormat),formatDateToParts:ZZ.bind(null,i,n.getDateTimeFormat),formatTime:jZ.bind(null,i,n.getDateTimeFormat),formatDateTimeRange:YZ.bind(null,i,n.getDateTimeFormat),formatTimeToParts:QZ.bind(null,i,n.getDateTimeFormat),formatPlural
24:sQ.bind(null,i,n.getPluralRules),formatMessage:Gk.bind(null,i,n),$t:Gk.bind(null,i,n),formatList:nQ.bind(null,i,n.getListFormat),formatListToParts:YN.bind(null,i,n.getListFormat),formatDisplayName:XZ.bind(null,i,n.getDisplayNames)})}a(Wk,"createIntl");function zk(t){return Yt(KN,{locale:t.locale,timeZone:t.timeZone,fallbackOnEmptyString:t.fallbackOnEmptyString,formats:t.formats,messages:t.messages,defaultLocale:t.defaultLocale,defaultFormats:t.defaultFormats,defaultRichTextElements:t.defaultRichTextElements,onError:t.onError,onWarn:t.onWarn})}a(zk,"processConfig");const hQ=a(t=>({}).toString.call(t).match(/\s([A-Za-z]+)/)?.[1].toLowerCase()??"","typeOf"),bc=hQ,pQ={nullish(t){return t==null},string(t){return bc(t)==="string"},number(t){return bc(t)==="number"},bool(t){return bc(t)==="boolean"},object(t){return bc(t)==="object"},array(t){return Array.isArray(t)},date(t){return bc(t)==="date"},function(t){return bc(t)==="function"}},gQ=pQ,QN=Pn(),mQ=a(t=>{if(gQ.nullish(t.locale))throw new ReferenceError('[solid-intl]: <IntlProvider /> expects a "locale" which was not configured. See https://formatjs.io/docs/react-intl/api#intlshape for more details');const e=b9(qN()),[n,i]=li(Wk(zk(t),e));return OE(()=>{i(Wk(zk(t),e))}),X(QN.Provider,{value:n,get children(){return t.children}})},"IntlProvider"),vQ=mQ,yQ=a(()=>{const t=Dn(QN);if(!t)throw new ReferenceError("[solid-intl]: Have you forgot to wrap your application with <IntlProvider /> ?");return t},"useIntl"),_y=yQ,qye={alreadyHaveAccount:{id:"account.alreadyHaveAccount",defaultMessage:"Already have a Nostr account?",description:"Already have a Nostr accountlabel"},prominentNostriches:{id:"actions.prominentNostriches",defaultMessage:"Prominent Nostriches",description:"Prominent Nostriches label"},follow:{id:"actions.follow",defaultMessage:"follow",description:"Follow button label"},unfollow:{id:"actions.unfollow",defaultMessage:"unfollow",description:"Unfollow button label"},followAll:{id:"actions.followAll",defaultMessage:"follow all",description:"Follow all button label"},unfollowAll:{id:"actions.unfollowAll",defaultMessage:"unfollow all",description:"Unfollow all button label"},followFailed:{id:"account.followFailed",defaultMessage:"Failed to complete the follow possibly due to a network error. Please try again.",description:"Feedback to user that the follow action has failed"},unfollowFailed:{id:"account.unfollowFailed",defaultMessage:"Failed to complete the unfollow possibly due to a network error. Please try again.",description:"Feedback to user that the unfollow action has failed"},needToLogin:{id:"account.needToLogin",defaultMessage:"You need to be signed in to perform this action",description:"Message to user that an action cannot be preformed without a public key"},createNewDescription:{id:"account.createNewDescription",defaultMessage:"It will only take a minute:",description:"Label inviting users to join Nostr"},getStartedSteps:{step_one:{id:"settings.account.getStartedSteps.step_one",defaultMessage:"Install the Primal mobile app",description:"First step in getting started"},step_two:{id:"settings.account.getStartedSteps.step_two",defaultMessage:"Create your account within the app ",description:"Second step in getting started"},step_three:{id:"settings.account.getStartedSteps.step_three",defaultMessage:"Go to the login page and scan the QR code",description:"First step in getting started"}},create:{title:{id:"settings.account.title",defaultMessage:"Create Account",description:"Title of the create account page"},descriptions:{step_one:{id:"settings.account.descriptions.step_one",defaultMessage:"Let’s start with the basics. Only the username is required!",description:"Description on step one"},step_two:{id:"settings.account.descriptions.step_two",defaultMessage:"Tell us a bit more about yourself. Everything on this page is optional!",description:"Description on step two"},step_three:{id:"settings.account.descriptions.step_three",defaultMessage:"We found some Nostr accounts for you to follow:",description:"Description on step three"}}}},jye={title:{id:"login.title",defaultMessage:"Login to Primal.net",description:"Login "},tabs:{simple:{id:"login.tabs.simple",defaultMessage:"Remote Signer",description:"Simple login"},extension:{id:"login.tabs.extension",defaultMessage:"Browser Extension",description:"Browser Extension"},nsec:{id:"login.tabs.nsec",defaultMessage:"Nsec Login",description:"Nsec login"},npub:{id:"login.tabs.npub",defaultMessage:"Npub Login",description:"Npub login"}},description:{id:"login.description",defaultMessage:"Enter your Nostr private key (starting with “nsec”):",description:"Label describing the login proccess"},invalidNsec:{id:"login.invalidNsec",defaultMessage:"Please enter a valid Nostr private key",description:"Label informing the user of an invali
24d nsec key"}},Yye={title:{id:"pin.title",defaultMessage:"Create Pin",description:"Create Pin modal title"},description:{id:"pin.description",defaultMessage:"Create a PIN to secure your account. You will need to enter this PIN every time you login to the Primal web app:",description:"Label describing what the pin is used for"},enter:{id:"pin.enter",defaultMessage:"Enter your PIN to login: ",description:"Label instructing the user to enter the pin"},enterTitle:{id:"pin.enterTitle",defaultMessage:"Enter Pin",description:"Enter Pin modal title"},reEnter:{id:"pin.reEnter",defaultMessage:"Re-type your PIN:",description:"Label instructing the user to re-enter the pin"},invalidPin:{id:"pin.invalidPin",defaultMessage:"PIN must be at least 4 characters",description:"Label instructing the user on the valid pin requirements"},invalidRePin:{id:"pin.invalidRePin",defaultMessage:"PINs don't match",description:"Label instructing the user that the two pins don't match"}},bQ={resetRelays:{id:"actions.resetRelays",defaultMessage:"Reset relays",description:"Reset relays label"},seeMore:{id:"actions.seeMore",defaultMessage:"see more",description:"See more label"},newNote:{id:"actions.newNote",defaultMessage:"New Note",description:"New note action label"},myArticles:{id:"actions.newArticle",defaultMessage:"My Articles",description:"New article action label"},createPin:{id:"actions.createPin",defaultMessage:"Set PIN",description:"Create PIN action, button label"},optoutPin:{id:"actions.optoutPin",defaultMessage:"Continue without a PIN",description:"opt-out of PIN action, button label"},createAccount:{id:"actions.createAccount",defaultMessage:"Create Account",description:"Create account action, button label"},login:{id:"actions.login",defaultMessage:"Login",description:"Login action, button label"},loginNow:{id:"actions.loginNow",defaultMessage:"Login now",description:"Login Now action, button label"},logout:{id:"actions.logout",defaultMessage:"Logout",description:"Logout action, button label"},getStarted:{id:"actions.getStarted",defaultMessage:"Get Started",description:"Get Started action, button label"},getStartedTitle:{id:"actions.getStartedTitle",defaultMessage:"Create Account – Download the Primal Mobile App",description:"Get Started action title"},forgotPin:{id:"actions.forgotPin",defaultMessage:"I forgot my PIN",description:"Forgot PIN action, button label"},cancel:{id:"actions.cancel",defaultMessage:"Cancel",description:"Cancel action, button label"},copy:{id:"actions.copy",defaultMessage:"copy",description:"Copy action, button label"},copyPubkey:{id:"actions.copyPubkey",defaultMessage:"copy public key",description:"Copy pubkey action, button label"},copyPrivkey:{id:"actions.copyPrivkey",defaultMessage:"copy private key",description:"Copy private key action, button label"},addFeedToHome:{id:"actions.addFeedToHome",defaultMessage:"add this feed to my home page",description:"Add feed to home, button label"},addFeedToHomeNamed:{id:"actions.addFeedToHomeNamed",defaultMessage:"add {name} feed to home page",description:"Add named feed to home, button label"},disabledAddFeedToHome:{id:"actions.disabledHomeFeedAdd",defaultMessage:"Available on your home page",description:"Add feed to home label, when feed is already added"},removeFromHomeFeedNamed:{id:"actions.removeFromHomeFeedNamed",defaultMessage:"remove {name} feed from your home page",description:"Remove named feed from home, button label"},noteCopyNostrLink:{id:"actions.noteCopyNostrLink",defaultMessage:"Copy Nostr link",description:"Label for the copy Nostr note link context menu item"},noteCopyPrimalLink:{id:"actions.noteCopyPrimalLink",defaultMessage:"Copy Primal link",description:"Label for the copy Primal note link context menu item"},notePostNew:{id:"actions.notePostNew",defaultMessage:"Post",description:"Send new note, button label"},noteReply:{id:"actions.noteReply",defaultMessage:"reply to {name}",description:"Reply to button label"},sendDirectMessage:{id:"actions.sendDirectMessage",defaultMessage:"send",description:"Send direct message action, button label"},save:{id:"actions.save",defaultMessage:"save",description:"Save changes action label"},previous:{id:"actions.previous",defaultMessage:"Previous",description:"Go to previous step action label"},next:{id:"actions.next",defaultMessage:"Next",description:"Go to next step action label"},finish:{id:"actions.finish",defaultMessage:"Finish",description:"Finish the wizard action label"},editProfile:{id:"actions.editProfile",defaultMessage:"edit profile",description:"Edit profile action label"},reportContentConfirmTitle:{id:"actions.reportContentConfirmTitle",defaultMessage:"Report abuse?",description:"Title for report content confirmation"},reportContentConfirmDesc:{id:"actions.reportContentConfirmDesc",defaultMessage:"All reports will be publicly visible.",description:"Description for report content confirmation"},reportUserConfirm:{id:"actions.reportUserConfirm",defaultMessage:"Report user {name}?",description:"Label for report user confirmation"},requestNoteDelete:{id:"actions.requestNoteDelete",defaultMessage:"Send ?",description:"Label for report user confirmation"},muteUserConfirmTitle:{id:"actions.muteUserConfirmTitle",defaultMessage:"Mute {name}",description:"Title for mute user confirmation dialog"},muteUserConfirm:{id:"actions.muteUserConfirm",defaultMessage:"Add {name} to your mute list?",description:"Label for mute user confirmation"},muteThreadConfirm:{id:"actions.muteUserConfirm",defaultMessage:"Mute this thread?",description:"Label for mute thread confirmation"},unmute:{id:"actions.unmute",defaultMessage:"unmute",description:"Label un-mute button"},addToAllowlist:{id:"actions.addToAllowlist",defaultMessage:"Add to allowlist",description:"Label add-to-allowlist button"},addRelay:{id:"actions.addRelay",defaultMessage:"add",description:"Label for add relay action"},removeRelay:{id:"actions.removeRelay",defaultMessage:"remove",description:"Label for remove relay action"},confirmRemoveRelay:{id:"actions.confirmRemoveRelay",defaultMessage:"Remove <b>{url}</b> from your relay list? This will disconnect you from the relay.",description:"Label for remove relay confirmation"}
24,restoreCachingService:{id:"actions.restoreCachingService",defaultMessage:"Restore default caching service",description:"Label for restore default caching service"},restoreBlossomServer:{id:"actions.restoreBlossomServer",defaultMessage:"restore default media server",description:"Label for restore default blossom server"},profileContext:{copyPubkey:{id:"actions.profileContext.copyPubkey",defaultMessage:"Copy user public key",description:"Label for copy user's pubkey from profile context menu"},copyLink:{id:"actions.profileContext.copyLink",defaultMessage:"Copy user link",description:"Label for copy user's link from profile context menu"},addFeed:{id:"actions.profileContext.addFeed",defaultMessage:"Add user feed",description:"Label for adding user's feed to home, from profile context menu"},removeFeed:{id:"actions.profileContext.removeFeed",defaultMessage:"Remove user feed",description:"Label for removing user's feed from home, from profile context menu"},muteUser:{id:"actions.profileContext.muteUser",defaultMessage:"Mute user",description:"Label for muting user from profile context menu"},unmuteUser:{id:"actions.profileContext.unmuteUser",defaultMessage:"Unmute user",description:"Label for unmuting user from profile context menu"},followMute:{id:"actions.profileContext.followMute",defaultMessage:"Follow user's mute list",description:"Label for following user's mute list"},unfollowMute:{id:"actions.profileContext.unfollowMute",defaultMessage:"Unfollow user's mute list",description:"Label for unfollowing user's mute list"},reportUser:{id:"actions.profileContext.reportUser",defaultMessage:"Report user",description:"Label for reporting user from profile context menu"}},noteVideoContext:{downloadVideo:{id:"actions.noteVideoContext.downloadVideo",defaultMessage:"Download Video",description:"Label for downloading video from context menu"}},streamContext:{copyLink:{id:"actions.streamContext.copyLink",defaultMessage:"Copy Stream Link",description:"Label for copy stream link from context menu"},copyId:{id:"actions.streamContext.copyId",defaultMessage:"Copy Stream ID",description:"Label for copy stream ID from context menu"},copyRaw:{id:"actions.streamContext.copyRaw",defaultMessage:"Copy Raw Data",description:"Label for copy stream raw data from context menu"},muteAuthor:{id:"actions.streamContext.muteAuthor",defaultMessage:"Mute User",description:"Label for muting user from context menu"},unmuteAuthor:{id:"actions.streamContext.unmuteAuthor",defaultMessage:"Unmute User",description:"Label for unmuting user from context menu"},reportContent:{id:"actions.streamContext.reportContent",defaultMessage:"Report Content",description:"Label for reporting user from context menu"},requestDelete:{id:"actions.streamContext.requestDelete",defaultMessage:"Request Delete",description:"Label for edit article from context menu"},quoteStream:{id:"actions.streamContext.quoteStream",defaultMessage:"Quote Stream",description:"Label for quoting stream from context menu"}},noteContext:{reactions:{id:"actions.noteContext.reactions",defaultMessage:"Reactions",description:"Label for note reactions from context menu"},zap:{id:"actions.noteContext.zapNote",defaultMessage:"Custom Zap",description:"Label for note zap from context menu"},copyLink:{id:"actions.noteContext.copyLink",defaultMessage:"Copy Note Link",description:"Label for copy note link from context menu"},copyText:{id:"actions.noteContext.copytext",defaultMessage:"Copy Note Text",description:"Label for copy note text from context menu"},copyId:{id:"actions.noteContext.copyId",defaultMessage:"Copy Note ID",description:"Label for copy note ID from context menu"},copyRaw:{id:"actions.noteContext.copyRaw",defaultMessage:"Copy Raw Data",description:"Label for copy note raw data from context menu"},copyPubkey:{id:"actions.noteContext.copyPubkey",defaultMessage:"Copy User Public Key",description:"Label for copy note author's pubkey from context menu"},breadcast:{id:"actions.noteContext.breadcast",defaultMessage:"Broadcast Note",description:"Label for note broadcast from context menu"},muteAuthor:{id:"actions.noteContext.muteAuthor",defaultMessage:"Mute User",description:"Label for muting user from context menu"},unmuteAuthor:{id:"actions.noteContext.unmuteAuthor",defaultMessage:"Unmute User",description:"Label for unmuting user from context menu"},muteThread:{id:"actions.noteContext.muteThread",defaultMessage:"Mute Thread",description:"Label for muting thread from context menu"},unmuteThread:{id:"actions.noteContext.unmuteThread",defaultMessage:"Unmute Thread",description:"Label for unmuting thread from context menu"},editArticle:{id:"actions.noteContext.editArticle",defaultMessage:"Edit Article",description:"Label for edit article from context menu"},reportAuthor:{id:"actions.noteContext.reportAuthor",defaultMessage:"Report User",description:"Label for reporting user from context menu"},reportContent:{id:"actions.noteContext.reportContent",defaultMessage:"Report Content",description:"Label for reporting user from context menu"},repostNote:{id:"actions.noteContext.repostNote",defaultMessage:"Repost",description:"Label for reposting note from context menu"},requestDelete:{id:"actions.noteContext.requestDelete",defaultMessage:"Request Delete",description:"Label for edit article from context menu"},requestDeleteRepost:{id:"actions.noteContext.requestDeleteRepost",defaultMessage:"Request Delete Repost",description:"Label for edit article from context menu"},quoteNote:{id:"actions.noteContext.quoteNote",defaultMessage:"Quote",description:"Label for quoting note from context menu"}},pollContext:{reactions:{id:"actions.noteContext.reactions",defaultMessage:"Reactions",description:"Label for note reactions from context menu"},zap:{id:"actions.noteContext.zapNote",defaultMessage:"Custom Zap",description:"Label for note zap from context menu"},copyLink:{id:"actions.noteContext.copyLink",defaultMessage:"Copy Poll Link",description:"Label for copy note link from context menu"},copyText:{id:"actions.noteContext.copytext",defaultMessage:"Copy Poll Question",description:"Label for copy note text from context menu"},copyId:{id:"actions.noteContext.copyId",defaultMessage:"Copy Poll ID",description:"Label for copy note ID from context menu"},copyRaw:{id:"actions.noteContext.copyRaw",defaultMessage:"Copy Raw Data",description:"Label for copy note raw data from context menu"},copyPubkey:{id:"actions.noteContext.copyPubkey",defaultMessage:"Copy User Public Key",description:"Label for copy note author's pubkey from context menu"},breadcast:{id:"actions.noteContext.breadcast",defaultMessage:"Broadcast Note",description:"Label for note broadcast from context menu"},muteAuthor:{id:"actions.noteContext.muteAuthor",defaultMessage:"Mute User",description:"Label for muting user from context menu"},unmuteAuthor:{id:"actions.noteContext.unmuteAuthor",defaultMessage:"Unmute User",description:"Label for unmuting user from context menu"},muteThread:{id:"actions.noteContext.muteThread",defaultMessage:"Mute Thread",description:"Label for muting thread from context menu"},unmuteThread:{id:"actions.noteContext.unmuteThread",defaultMessage:"Unmute Thread",description:"Label for unmuting thread from context menu"},editArticle:{id:"actions.noteContext.editArticle",defaultMessage:"Edit Article",description:"Label for edit article from context menu"},reportAuthor:{id:"actions.noteContext.reportAuthor",defaultMessage:"Report User",description:"Label for reporting user from context menu"},reportContent:{id:"actions.noteContext.reportContent",defaultMessage:"Report Content",description:"Label for reporting user from context menu"},repostNote:{id:"actions.noteContext.repostNote",defaultMessage:"Repost",description:"Label for reposting note from context menu"},requestDelete:{id:"actions.noteContext.requestDelete",defaultMessage:"Request Delete",description:"Label for edit article from context menu"},requestDeleteRepost:{id:"actions.noteContext.requestDeleteRepost",defaultMessage:"Request Delete Repost",description:"Label for edit article from context menu"},quoteNote:{id:"actions.noteContext.quoteNote",defaultMessage:"Quote",description:"Label for quoting note from context menu"}},articleOverviewContext:{edit:{id:"actions.articleOverviewContext.edit",defaultMessage:"Edit Article",description:"Label for editing an article"},editDraft:{id:"actions.articleOverviewContext.editDraft",defaultMessage:"Edit Draft",description:"Label for editing a draft"},quoteArticle:{id:"actions.articleOverviewContext.quoteArticle",defaultMessage:"Quote Article",description:"Label for quoting article from context menu"},shareArticle:{id:"actions.articleOverviewContext.shareArticle",defaultMessage:"Copy Article link",description:"Label for sharing article from context menu"},copyId:{id:"actions.articleOverviewContext.copyId",defaultMessage:"Copy Event ID",description:"Label for copying article from context menu"},copyRawEvent:{id:"actions.articleOverviewContext.copyRawEvent",defaultMessage:"Copy Raw Event",description:"Label for copying raw event from context menu"},unpublish:{id:"actions.articleOverviewContext.unpublish",defaultMessage:"Unpublish",description:"Label for copying raw event from context menu"},delete:{id:"actions.articleOverviewContext.delete",defaultMessage:"Request Delete",description:"Label for copying raw event from context menu"}},zap:{id:"actions.zap",defaultMessage:"Zap",description:"Label for zap"},reactions:{id:"actions.reactions",defaultMessage:"Reactions ({count})",description:"Label for reactions"},vote:{id:"actions.vote",defaultMessage:"Vote",description:"Label for vote"}},Zye={id:"branding",defaultMessage:"Primal",description:"Brand name"},Qye={title:{id:"downloads.title",defaultMessage:"Downloads",description:"Title of the downloads page"},build:{id:"downloads.build",defaultMessage:"Build",description:"Build label"},released:{id:"downloads.released",defaultMessage:"released",description:"Released label"},getApk:{id:"downloads.getApk",defaultMessage:"Get APK instead",description:"APK download label"},callToActionIOSTitle:{id:"downloads.ctaIOSTitle",defaultMessage:"Primal iOS",description:"Title for the iOS downloads' page call-to-action"},callToActionIOSDescription:{id:"downloads.ctaAndroidDescription",defaultMessage:"The app features easy onboarding, fast & snappy UI, ability to explore Nostr, and create & manage custom feeds",de
24scription:"Description for the iOS downloads' page call-to-action"},callToActionAndroidTitle:{id:"downloads.ctaAndroidTitle",defaultMessage:"Primal Android",description:"Title for the Android downloads' page call-to-action"},callToActionAndroidDescription:{id:"downloads.ctaAndroidDescription",defaultMessage:"The app features easy onboarding, fast & snappy UI, ability to explore Nostr, and create & manage custom feeds",description:"Description for the Android downloads' page call-to-action"},callToActionQRTitle:{id:"downloads.ctaQRTitle",defaultMessage:"Scan to install app",description:"Title for the QR code downloads' page call-to-action"},appStoreCaption:{id:"downloads.appStoreCaption",defaultMessage:"TestFlight Available Now",description:"AppStore promo caption"},playStoreCaption:{id:"downloads.playStoreCaption",defaultMessage:"Coming soon to Android",description:"PlayStore promo caption"},apkDownload:{id:"downloads.apkDownload",defaultMessage:"Alpha Build Available Now",description:"APK download caption"},links:{title:{id:"downloads.sidebarTitle",defaultMessage:"Source code",description:"Daownload sidebar links title"},webApp:{id:"downloads.webAppLink",defaultMessage:"Primal Web App",description:"Label for the link to the web app"},iosApp:{id:"downloads.iosAppLink",defaultMessage:"Primal iOS App",description:"Label for the link to the iOS app"},andApp:{id:"downloads.andAppLink",defaultMessage:"Primal Android App",description:"Label for the link to the Android app"},cachingService:{id:"downloads.cachingService",defaultMessage:"Primal Caching Service",description:"Label for the link to the caching service"},primalServer:{id:"downloads.primalServer",defaultMessage:"Primal Server",description:"Label for the link to the primal server"}}},Cb={title:{id:"confirm.title",defaultMessage:"Are you sure?",description:"Default title of the confirmation dialog"},confirm:{id:"confirm.yes",defaultMessage:"Yes",description:"Default label for positive response to the confirmation dialog"},abort:{id:"confirm.no",defaultMessage:"No",description:"Default label for negative response to the confirmation dialog"},cancel:{id:"confirm.cancel",defaultMessage:"Cancel",description:"Default label for cancel response to the confirmation dialog"}},Jye={id:"explore.sidebar.caption",defaultMessage:"trending users",description:"Caption for the explore page sidebar showing a list of trending users"},Xye={genericCaption:{id:"explore.genericCaption",defaultMessage:"explore",description:"Generic caption for the explore page"},pageTitle:{id:"explore.pageTitle",defaultMessage:"Explore",description:"Title of the explore page"},title:{id:"explore.title",defaultMessage:"{timeframe}: {scope}",description:"Title of the explore page"},statDisplay:{users:{id:"explore.stats.users",defaultMessage:"Users",description:"Label for number of users stats"},pubkeys:{id:"explore.stats.pubkeys",defaultMessage:"Public Keys",description:"Label for number of pubkeys stats"},zaps:{id:"explore.stats.zaps",defaultMessage:"Zaps",description:"Label for number of zaps stats"},btcZapped:{id:"explore.stats.btcZapped",defaultMessage:"BTC Zapped",description:"Label for number of zapped bitcoins stats"},pubnotes:{id:"explore.stats.pubnotes",defaultMessage:"Public Notes",description:"Label for number of public notes stats"},reposts:{id:"explore.stats.reposts",defaultMessage:"Reposts",description:"Label for number of repost stats"},reactions:{id:"explore.stats.reactions",defaultMessage:"Reactions",description:"Label for number of reactions stats"},any:{id:"explore.stats.any",defaultMessage:"All Events",description:"Label for number of all stats"}}},EQ={id:"feedProfile",defaultMessage:"{name}'s feed",description:"Generic name for a feed created from a profile"},_Q={id:"feedProfileDesription",defaultMessage:"Notes feed of {name}",description:"Generic description for a feed created from a profile"},ebe={id:"feed.newPosts",defaultMessage:`{number, plural,
25    =0 {}
26    one {# New Note}
27    =99 {99+ New Notes}
28    other {# New Notes}}`,description:"Label for a button to load new notes"},tbe={dropzone:{id:"feedback.dropzone",defaultMessage:"drop file to upload",description:"Label accompanying the draging file"},uploading:{id:"feedback.uploading",defaultMessage:"uploading...",description:"Label accompanying the uploading spinner"}},nbe={title:{id:"messages.title",defaultMessage:"Messages",description:"Title of messages page"},follows:{id:"messages.follows",defaultMessage:"follows",description:"DM relation selection label for follows"},other:{id:"messages.other",defaultMessage:"other",description:"DM relation selection label for other"},markAsRead:{id:"messages.markAsRead",defaultMessage:"Mark All Read",description:"DM mark as read label"},sendComment:{id:"messages.sendComment",defaultMessage:"Send a comment...",description:"Placeholder for comment input"}},ibe={home:{id:"navbar.home",defaultMessage:"Home",description:"Label for the nav bar item link to Home page"},reads:{id:"navbar.reads",defaultMessage:"Reads",description:"Label for the nav bar item link to Reads page"},explore:{id:"navbar.explore",defaultMessage:"Explore",description:"Label for the nav bar item link to Explore page"},messages:{id:"navbar.messages",defaultMessage:"Messages",description:"Label for the nav bar item link to Messages page"},bookmarks:{id:"navbar.bookmarks",defaultMessage:"Bookmarks",description:"Label for the nav bar item link to Bookmarks page"},notifications:{id:"navbar.notifications",defaultMessage:"Notifications",description:"Label for the nav bar item link to Notifications page"},downloads:{id:"navbar.downloads",defaultMessage:"Downloads",description:"Label for the nav bar item link to Downloads page"},premium:{id:"navbar.premium",defaultMessage:"Premium",description:"Label for the nav bar item link to Premium page"},settings:{id:"navbar.settings",defaultMessage:"Settings",description:"Label for the nav bar item link to Settings page"},help:{id:"navbar.help",defaultMessage:"Help",description:"Label for the nav bar item link to Help page"}},sbe={newPreview:{id:"note.newPreview",defaultMessage:"Note preview",description:"Caption for preview when creating a new note"},mentionIndication:{id:"note.mentionIndication",defaultMessage:"[note by {name}
28]",description:"Label indicating that a note has been metioned in the small note display"},reposted:{id:"note.reposted",defaultMessage:"Reposted",description:"Label indicating that the note is a repost"},repostedOthers:{id:"note.repostedOthers",defaultMessage:`{number, plural,
29      =0 {}
30      one { and # other}
31      other { and # others}}`,description:"Label indicating that the note is reposted more than once"},reply:{id:"note.reply",defaultMessage:"replying to",description:"Label indicating that the note is a reply"},saveNoteDraft:{title:{id:"note.saveNoteDraft.title",defaultMessage:"Save Note Draft?",description:"Title of the confirmation when the note is canceled"},description:{id:"note.saveNoteDraft.description",defaultMessage:"Do you wish to save this note to continue editing it later?",description:"Description of the confirmation when the note is canceled"},optionYes:{id:"note.saveNoteDraft.yes",defaultMessage:"Save",description:"Confirm saving note as draft"},optionNo:{id:"note.saveNoteDraft.no",defaultMessage:"Discard",description:"Decline saving note as draft"},optionCancel:{id:"note.saveNoteDraft.cancel",defaultMessage:"Continue Editing",description:"Continue editing the note"}},savePollDraft:{title:{id:"note.savePollDraft.title",defaultMessage:"Save Poll Draft?",description:"Title of the confirmation when the poll is canceled"},description:{id:"note.savePollDraft.description",defaultMessage:"Do you wish to save this poll to continue editing it later?",description:"Description of the confirmation when the poll is canceled"},optionYes:{id:"note.savePollDraft.yes",defaultMessage:"Save",description:"Confirm saving poll as draft"},optionNo:{id:"note.savePollDraft.no",defaultMessage:"Discard",description:"Decline saving poll as draft"},optionCancel:{id:"note.savePollDraft.cancel",defaultMessage:"Continue Editing",description:"Continue editing the note"}},confirmSwitchToPoll:{title:{id:"note.confirmSwitchToPoll.title",defaultMessage:"Forget Note?",description:"Title of the confirmation when changing input to poll"},description:{id:"note.confirmSwitchToPoll.description",defaultMessage:"Do you wish to save this note to continue editing it later?",description:"Description of the confirmation when changing input to poll"},optionYes:{id:"note.confirmSwitchToPoll.yes",defaultMessage:"Save",description:"Confirm saving note as draft"},optionNo:{id:"note.confirmSwitchToPoll.no",defaultMessage:"Discard",description:"Decline saving note as draft"},optionCancel:{id:"note.confirmSwitchToPoll.cancel",defaultMessage:"Continue Editing",description:"Continue editing the note"}},confirmRemovePoll:{title:{id:"note.confirmRemovePoll.title",defaultMessage:"Remove poll?",description:"Title of the confirmation when removing a poll"},description:{id:"note.confirmRemovePoll.description",defaultMessage:"Do you wish to save this poll to continue editing it later?",description:"Description of the confirmation when removing a poll"},optionYes:{id:"note.confirmRemovePoll.yes",defaultMessage:"Save",description:"Confirm saving poll as draft"},optionNo:{id:"note.confirmRemovePoll.no",defaultMessage:"Discard",description:"Decline saving poll as draft"},optionCancel:{id:"note.confirmRemovePoll.cancel",defaultMessage:"Continue Editing",description:"Continue editing the poll"}}},JN={[un.NEW_USER_FOLLOWED_YOU]:"followed you",[un.USER_UNFOLLOWED_YOU]:"unfollowed you",[un.YOUR_POST_WAS_ZAPPED]:"zapped your",[un.YOUR_POST_WAS_LIKED]:"liked your",[un.YOUR_POST_WAS_REPOSTED]:"reposted your",[un.YOUR_POST_WAS_REPLIED_TO]:"replied to your",[un.REPLY_TO_REPLY]:"replied in your thread",[un.YOU_WERE_MENTIONED_IN_POST]:"mentioned you in a",[un.YOUR_POST_WAS_MENTIONED_IN_POST]:"mentioned your",[un.POST_YOU_WERE_MENTIONED_IN_WAS_ZAPPED]:"zapped a note you were mentioned in",[un.POST_YOU_WERE_MENTIONED_IN_WAS_LIKED]:"liked a note you were mentioned in",[un.POST_YOU_WERE_MENTIONED_IN_WAS_REPOSTED]:"reposted a note you were mentioned in",[un.POST_YOU_WERE_MENTIONED_IN_WAS_REPLIED_TO]:"replied to a note you were mentioned in",[un.POST_YOUR_POST_WAS_MENTIONED_IN_WAS_ZAPPED]:"zapped a note your note was mentioned in",[un.POST_YOUR_POST_WAS_MENTIONED_IN_WAS_LIKED]:"liked a note your note was mentioned in",[un.POST_YOUR_POST_WAS_MENTIONED_IN_WAS_REPOSTED]:"reposted a note your note was mentioned in",[un.POST_YOUR_POST_WAS_MENTIONED_IN_WAS_REPLIED_TO]:"replied to a note your note was mentioned in",[un.YOUR_POST_WAS_HIGHLIGHTED]:"highlighted your",[un.YOUR_POST_WAS_BOOKMARKED]:"bookmarked your",[un.YOUR_POST_HAD_REACTION]:"reacted to your",[un.LIVE_EVENT_HAPPENING]:"is live"},rbe=Object.values(un).reduce((t,e)=>({...t,[e]:{id:`notifications.new.${e}`,defaultMessage:`{number, plural,
32      =0 {}
33      one {and # other}
34      other {and # others}}
35      ${JN[e]}`,description:`New Notifiaction label for notifications of type ${e}`}}),{}),obe=Object.values(un).reduce((t,e)=>({...t,[e]:{id:`notifications.old.${e}`,defaultMessage:`${JN[e]}`,description:`Old Notifiaction label for notifications of type ${e}`}}),{}),abe={activities:{id:"notifications.sidebar.activities",defaultMessage:"Reactions",description:"Sidebar activities stats caption on the notification page"},heading:{id:"notificationsSidebar.heading",defaultMessage:"Summary",description:"Sidebar caption on the notification page"},empty:{id:"notificationsSidebar.empty",defaultMessage:"No new notifications",description:"Sidebar caption indicating no new notifications"},followers:{id:"notificationsSidebar.followers",defaultMessage:"Followers",description:"Sidebar follower stats caption on the notification page"},gainedFollowers:{id:"notificationsSidebar.gainedFollowers",defaultMessage:`new {number, plural,
36      =0 {}
37      one {follower}
38      other {followers}}`,description:"Sidebar new follower stats description on the notification page"},lostFollowers:{id:"notificationsSidebar.lostFollowers",defaultMessage:`lost {number, plural,
39      =0 {}
40      one {follower}
41      other {followers}}`,description:"Sidebar lost follwers stats description on the notification page"},likes:{id:"notifications.sidebar.likes",defaultMessage:`{number, plural,
42      =0 {}
43      one {like}
44      other {likes}}`,description:"Sidebar likes stats caption on the notification page"},mentions:{id:"notifications.sidebar.mentions",defaultMessage:"Mentions",description:"Sidebar mentions stats caption on the notification page"},mentionsYou:{id:"notifications.sidebar.mentionsYou",defaultMessage:`{number, plural,
45      =0 {}
46      one {mention}
47      other {mentions}} of you`,description:"Sidebar mentions you stats description on the notification page"},mentionsYourPost:{id:"notifications.sidebar.mentionsYourPost",defaultMessage:`{number, plural,
48      =0 {}
49      one {mention of your note}
50      other {mentions of your notes}}`,description:"Sidebar mentions your note stats description on the notification page"},replies:{id:"notifications.sidebar.replies",defaultMessage:`{number, plural,
51      =0 {}
52      one {reply}
53      other {replies}}`,description:"Sidebar replies stats caption on the notification page"},reposts:{id:"notifications.sidebar.reposts",defaultMessage:`{number, plural,
54      =0 {}
55      one {repost}
56      other {reposts}}`,description:"Sidebar reposts stats caption on the notification page"},other:{id:"notifications.sidebar.other",defaultMessage:"Other",description:"Sidebar other stats caption on the notification page"},zaps:{id:"notificationsSidebar.zaps",defaultMessage:"Zaps",description:"Sidebar zaps stats caption on the notification page"},zapNumber:{id:"notificationsSidebar.zapNumber",defaultMessage:`{number, plural,
57      =0 {}
58      one {zap}
59      other {zaps}}`,description:"Sidebar zaps stats description on the notification page"},statsNumber:{id:"notificationsSidebar.statsNumber",defaultMessage:`{number, plural,
60      =0 {}
61      one {sat}
62      other {sats}}`,description:"Sidebar sats stats description on the notification page"}},lbe={title:{id:"pages.notifications.title",defaultMessage:"Notifications",description:"Title of the notifications page"},newNotifs:{id:"notification.newNotifs",defaultMessage:`{number, plural,
63      =0 {}
64      one {# new notification}
65      =100 {99+ new notifications}
66      other {# new notifications}}`,description:"Label for a button to load new notifications"},all:{id:"pages.notifications.all",defaultMessage:"All",description:"Title of the All notifications tab"},zaps:{id:"pages.notifications.zaps",defaultMessage:"Zaps",description:"Title of the Zaps notifications tab"},replies:{id:"pages.notifications.replies",defaultMessage:"Replies",description:"Title of the Replies notifications tab"},mentions:{id:"pages.notifications.mentions",defaultMessage:"Mentions",description:"Title of the Mentions notifications tab"},reposts:{id:"pages.notifications.reposts",defaultMessage:"Reposts",description:"Title of the Reposts notifications tab"},reactions:{id:"pages.notifications.reactions",defaultMessage:"Reactions",description:"Title of the Reactions notifications tab"}}
66,Kk={missingNote:{firstLine:{id:"placeholders.missingNote.firstLine",defaultMessage:"We can't seem to find this note.",description:"Placeholder when the note is missing"},secondLine:{id:"placeholders.missingNote.secondLine",defaultMessage:"It may have been deleted by the author.",description:"Placeholder when the note is missing"}},noReactionDetails:{id:"placeholders.noReactionDetails",defaultMessage:"No details for rections found",description:"Placeholder when there are no reaction details in reactions modal"},noLikeDetails:{id:"placeholders.noLikeDetails",defaultMessage:"No details for likes found",description:"Placeholder when there are no like details in reactions modal"},noZapDetails:{id:"placeholders.noZapDetails",defaultMessage:"No details for zaps found",description:"Placeholder when there are no zap details in reactions modal"},noRepostDetails:{id:"placeholders.noRepostDetails",defaultMessage:"No details for reposts found",description:"Placeholder when there are no repost details in reactions modal"},noQuoteDetails:{id:"placeholders.noQuoteDetails",defaultMessage:"No details for quotes found",description:"Placeholder when there are no quote details in reactions modal"},addComment:{id:"placeholders.addComment",defaultMessage:"Add a comment...",description:"Placeholder for adding a comment"},searchByNpub:{id:"placeholders.searchByNpub",defaultMessage:"search by npub...",description:"Placeholder for searching by npub"},addNpub:{id:"placeholders.addNpub",defaultMessage:"add npub...",description:"Placeholder for adding npub"},mustHaveOneCachingService:{id:"placeholders.mustHaveOneCachingService",defaultMessage:"At this time, client needs to have at least one caching service to operate. In the future we will add the ability to use Primal without a caching service, but this is not yet supported.",description:"Description when trying to remove the last caching service from the pool"},cachingPoolHelp:{id:"placeholders.cachingPoolHelp",defaultMessage:"Client will randomly connect to one of the caching services in this pool. This helps with fail-over if some of the services are down. You can add or remove services. If you wish to always connect to exatly one caching service, you should leave only one entry in this pool.",description:"text for caching pool help bubble"},resetRelaysHelp:{id:"placeholders.resetRelaysHelp",defaultMessage:"This action will disconnect you from any relays you are currently connected to and connect you to a set of recomended relays.",description:"text for caching pool help bubble"},comingSoon:{id:"placeholders.comingSoon",defaultMessage:"Coming soon. Seriously. Help is on the way. ;)",description:"Placholder text for missing content"},endOfFeed:{id:"placeholders.endOfFeed",defaultMessage:"Your reached the end. You are a quick reader",description:"Message displayed when user reaches the end of the feed"},guestUserGreeting:{id:"placeholders.guestUserGreeting",defaultMessage:"Welcome to nostr!",description:"Header placeholder for guest user"},noteCallToAction:{id:"placeholders.callToAction.note",defaultMessage:"Say something on nostr...",description:"Placeholder for new note call-to-action"},pageWIPTitle:{id:"pages.wip.title",defaultMessage:"{title}",description:"Title of page under construction"},welcomeMessage:{id:"placeholders.welcomeMessage",defaultMessage:"Welcome to nostr!",description:"Default welcome message"},findUser:{id:"placeholders.findUser",defaultMessage:"find user",description:"Find user input placeholder"},findUsers:{id:"placeholders.findUsers",defaultMessage:"find users",description:"Find users input placeholder"},search:{id:"placeholders.search",defaultMessage:"Search...",description:"Search input placeholder"},selectFeed:{id:"placeholders.selectFeed",defaultMessage:"Select feed",description:"Placeholder for feed selection"},pageNotFound:{id:"placeholders.pageNotFound",defaultMessage:"Page not found",description:"Placholder text for missing page"},relayUrl:{id:"placeholders.relayUrl",defaultMessage:"wss://relay.url",description:"Placholder relay url input"},cachingServiceUrl:{id:"placeholders.cachingServiceUrl",defaultMessage:"wss://cachingservice.url",description:"Placholder relay url input"},blossomServerUrl:{id:"placeholders.blossomServerUrl",defaultMessage:"enter blossom server url...",description:"Placholder server url input"}},cbe={sidebarCaptionReads:{id:"profile.sidebar.captionReads",defaultMessage:"Latest Reads",description:"Caption for the profile page sidebar showing a list of latest reads by the profile"},sidebarCaptionNotes:{id:"profile.sidebar.captionNotes",defaultMessage:"Popular Notes",description:"Caption for the profile page sidebar showing a list of trending notes by the profile"},sidebarNoNotes:{id:"profile.sidebar.noNotes",defaultMessage:"No trending notes",description:"Placeholde for profile sidebar when the profile is missing trending notes"},title:{id:"profile.title",defaultMessage:"{name} - Nostr Profile",description:"Page title for Profile page"},followsYou:{id:"profile.followsYou",defaultMessage:"Follows you",description:"Label indicating that a profile is following your profile"},jointDate:{id:"profile.joinDate",defaultMessage:"Joined Nostr on {date}",description:"Label indicating when the profile joined Nostr (oldest event)"},stats:{gallery:{id:"profile.gallery",defaultMessage:"Media",description:"Label for gallery profile stat"},follow:{id:"profile.followStats",defaultMessage:"Following",description:"Label for following profile stat"},followers:{id:"profile.stats.followers",defaultMessage:"Followers",description:"Label for followers profile stat"},zaps:{id:"profile.stats.zaps",defaultMessage:"Zaps",description:"Label for zaps profile stat"},sats:{id:"profile.stats.sats",defaultMessage:"Sats",description:"Label for sats profile stat"},totalSats:{id:"profile.stats.totalSats",defaultMessage:"Total",description:"Label for total sats profile stat"},articles:{id:"profile.stats.articles",defaultMessage:"Reads",description:"Label for reads profile stat"},notes:{id:"profile.stats.notes",defaultMessage:"Notes",description:"Label for notes profile stat"},replies:{id:"profile.stats.replies",defaultMessage:"Replies",description:"Label for replies profile stat"},relays:{id:"profile.stats.relays",defaultMessage:"Relays",description:"Label for sats profile relays"}},isMuted:{id:"profile.isMuted",defaultMessage:"{name} is muted",description:"Label indicating that the profile is muted"},isFiltered:{id:"profile.isFiltered",defaultMessage:"This account is hidden per your filter settings.",description:"Label indicating that the profile is filtered"},noNotes:{id:"profile.noNotes",defaultMessage:"{name} hasn't posted any notes",description:"Label indicating that the profile has no notes"},noArticles:{id:"profile.noArticles",defaultMessage:"{name} hasn't published any reads",description:"Label indicating that the profile has no reads"}
66,noReplies:{id:"profile.noReplies",defaultMessage:"{name} hasn't posted any replies",description:"Label indicating that the profile has no replies"},noFollowers:{id:"profile.noFollowers",defaultMessage:"{name} has no followers",description:"Label indicating that the profile has no followers"},noFollows:{id:"profile.noFollows",defaultMessage:"{name} isn't following anyone",description:"Label indicating that the profile has no followers"},noZaps:{id:"profile.noZaps",defaultMessage:"{name} zapped no one",description:"Label indicating that the profile has no zaps"},noRelays:{id:"profile.noRelays",defaultMessage:"{name} is on no relays",description:"Label indicating that the profile has no relays"},qrModal:{pubkey:{id:"profile.qrModal.pubkey",defaultMessage:"Public key",description:"Public key tab title in profile qr code modal"},ln:{id:"profile.qrModal.ln",defaultMessage:"Lightning address",description:"Lightning address tab title in profile qr code modal"}}},dbe={followers:{id:"search.followers",defaultMessage:"followers",description:"Followers label for user search results"},invalid:{id:"search.invalid",defaultMessage:"Please enter search term.",description:"Alert letting the user know that the search term is empty"},emptyQueryResult:{id:"search.emptyQueryResult",defaultMessage:"type to",description:"Label shown is search resuls when no term is provided"},searchNostr:{id:"search.searchNostr",defaultMessage:"Search nostr",description:"Label explaining full search action"},sidebarCaption:{id:"search.sidebarCaption",defaultMessage:"Users found",description:"Caption for the search page sidebar showing a list of users"},feedLabel:{id:"search.feedLabel",defaultMessage:"Search: {query}",description:"Label for a search results feed"},title:{id:"search.title",defaultMessage:'search for "{query}"',description:"Title of the Search page"},noResults:{id:"search.noResults",defaultMessage:"No results found",description:"Message shown when no search results were found"}},ube={title:{id:"eventQueue.title",defaultMessage:"Publish Pending",description:"Title of the event queue page"},caption:{id:"eventQueue.caption",defaultMessage:"Publish Pending ({number})",description:"Caption of the event queue page"},label:{id:"eventQueue.label",defaultMessage:"These actions failed to publish:",description:"Label of the event queue page"},retry:{id:"eventQueue.retry",defaultMessage:"Retrying in {seconds} seconds...",description:"Retry label of the event queue page"},retrying:{id:"eventQueue.retrying",defaultMessage:"Retrying...",description:"Retry label of the event queue page"},empty:{id:"eventQueue.empty",defaultMessage:"No events pending",description:"Retry label of the event queue page"}},Ki={index:{title:{id:"settings.index.title",defaultMessage:"Settings",description:"Title of the settings page"}},account:{title:{id:"settings.account.title",defaultMessage:"Account",description:"Title of the account settings sub-page"},description:{id:"settings.account.description",defaultMessage:"You can improve your account security by installing a Nostr browser extension, like {link}. By storing your Nostr private key within a browser extension, you will be able to securely sign into any Nostr web app, including Primal.",description:"Warning about account security"},pubkey:{id:"settings.account.pubkey",defaultMessage:"Your Public Key",description:"Your public key section caption"},pubkeyDesc:{id:"settings.account.pubkeyDesc",defaultMessage:"Anyone on Nostr can find you via your public key. Feel free to share anywhere.",description:"Label describing the public key"},privkey:{id:"settings.account.privkey",defaultMessage:"Your Private Key",description:"Your private key section caption"},privkeyDesc:{id:"settings.account.privkeyDesc",defaultMessage:"This key fully controls your Nostr account. Don’t share it with anyone. Only copy this key to store it securely or to login to another Nostr app.",description:"Label describing the private key"}},appearance:{title:{id:"settings.appearance.title",defaultMessage:"Appearance",description:"Title of the appearance settings sub-page"},caption:{id:"settings.appearance.caption",defaultMessage:"Select a theme",description:"Caption for theme selection"}},homeFeeds:{title:{id:"settings.homeFeeds.title",defaultMessage:"Home Feeds",description:"Title of the home feeds settings sub-page"},caption:{id:"settings.homeFeeds.caption",defaultMessage:"Edit and order your home page feeds",de
66scription:"Caption for home feed ordering"}},readsFeeds:{title:{id:"settings.readsFeeds.title",defaultMessage:"Reads Feeds",description:"Title of the reads feeds settings sub-page"},caption:{id:"settings.readsFeeds.caption",defaultMessage:"Edit and order your reads page feeds",description:"Caption for reads feed ordering"}},moderation:{title:{id:"settings.filters.title",defaultMessage:"Content Moderation",description:"Title of the content filtering settings sub-page"},description:{id:"settings.filters.description",defaultMessage:"Primal offers customizable content filtering services. In addition to your own mute list, you may subscribe to other users’ mute lists. Primal runs real time spam detection systems as well as Not-Safe-For-Work content, to which you may also subscribe.",description:"Description of the content filtering settings sub-page"},shortDescription:{id:"settings.filters.shortDescription",defaultMessage:"Subscribe to a user’s mute list by going to their profile page:",description:"Short Description of the content filtering settings sub-page"},applyFiltering:{id:"settings.filters.applyFiltering",defaultMessage:"Apply Content Filtering",description:"Caption for home feed ordering"},searchFilteredAccount:{id:"settings.filters.searchFilteredAccount",defaultMessage:"Search Filtered Accounts",description:"Caption for home feed ordering"},allowList:{id:"settings.filters.allowList",defaultMessage:"My Allowlist",description:"Caption for home feed ordering"},moderationItem:{id:"settings.contentModeration.item",defaultMessage:"{name}'s mute list",description:"Caption for my mute list algo"},searchForFiltered:{id:"settings.contentModeration.searchForFiltered",defaultMessage:"Search to find out if a user account is included in any of the filter lists:",description:"Description for search for filtered users"},allowListsDescription:{id:"settings.contentModeration.allowListsDescription",defaultMessage:"Add user accounts that should be excluded from filtering:",description:"Description for allow lists"},table:{mutelists:{id:"settings.contentModeration.table.mutelists",defaultMessage:"Mute Lists",description:"Caption for mutelists column on moderation settings page"},algos:{id:"settings.contentModeration.table.algos",defaultMessage:"Algorithms",description:"Caption for algorithms column on moderation settings page"},content:{id:"settings.contentModeration.table.content",defaultMessage:"Hide Content",description:"Caption for content column on moderation settings page"},trending:{id:"settings.contentModeration.table.trending",defaultMessage:"Don't Recommend",description:"Caption for trending column on moderation settings page"},trendingHelp:{id:"settings.contentModeration.table.trendingHelp",defaultMessage:"Content won't be recommended in trending and most-zapped feeds",description:"Help description for trending filter"},contentHelp:{id:"settings.contentModeration.table.contentHelp",defaultMessage:"Content will be hidden from all feeds, threads, and search results",description:"Help description for content filter"}},algos:{my:{id:"settings.contentModeration.algos.my",defaultMessage:"My mute list",description:"Caption for my mute list algo"},primal_spam:{id:"settings.contentModeration.algos.spam",defaultMessage:"Primal spam filter",description:"Caption for spam algo"},primal_nsfw:{id:"settings.contentModeration.algos.nsfw",defaultMessage:"Primal NSFW filter",description:"Caption for NSFW algo"}}},muted:{title:{id:"settings.muted.title",defaultMessage:"Muted Content",description:"Title of the muted accounts settings sub-page"},emptyUsers:{id:"settings.muted.emptyUsers",defaultMessage:"No muted users",description:"Caption indicating that there are no muted users"},emptyWords:{id:"settings.muted.emptyWords",defaultMessage:"No muted words",description:"Caption indicating that there are no muted users"},emptyHashtags:{id:"settings.muted.emptyHashtags",defaultMessage:"No muted hashtags",description:"Caption indicating that there are no muted users"},emptyThreads:{id:"settings.muted.emptyThreads",defaultMessage:"No muted threads",description:"Caption indicating that there are no muted users"},emptyOther:{id:"settings.muted.emptyOther",defaultMessage:"This user didn't mute anyone or they use a non-standard mute list",description:"Caption indicating that there are no muted users on 
66someone else's list"}},nwcSettings:{title:{id:"settings.nwcSettings.title",defaultMessage:"Connected Wallets",description:"Title of the nwc settings sub-page"}},blossomPage:{mediaServer:{id:"settings.blossom.mediaServer",defaultMessage:"Media Server",description:"Title of the media server"},mediaMirrors:{id:"settings.blossom.mediaMirrors",defaultMessage:"Media Mirrors",description:"Title of the media mirrors"},mediaMirrorsDescription:{id:"settings.blossom.mediaMirrorsDescription",defaultMessage:"You can enable one or more media mirror servers. When enabled, your uploads to the primary media server will be automatically copied to the mirror(s).",description:"Description for blossom media mirrors"},switchServer:{id:"settings.blossom.switchServer",defaultMessage:"Switch media server",description:"Title of the switching media server section of the Blossom settings sub-page"},addMirror:{id:"settings.blossom.addMirror",defaultMessage:"Add media mirror server",description:"Title of the adding media mirror server section of the Blossom settings sub-page"},suggestedMirrors:{id:"settings.blossom.suggestedMirrors",defaultMessage:"Suggested media mirror servers",description:"Title of the suggested media mirror server list section of the Blossom settings sub-page"}},network:{title:{id:"settings.network.title",defaultMessage:"Network",description:"Title of the network settings sub-page"},relays:{id:"settings.network.relays",defaultMessage:"Relays",description:"Title of the relays section of the network settings sub-page"},myRelays:{id:"settings.network.myRelays",defaultMessage:"My relays",description:"Title of the my relays section of the network settings sub-page"},noMyRelays:{id:"settings.networks.noMyRelays",defaultMessage:"Your Nostr account doesn't have any relays specified, so we connected you to a default set of relays. To configure your desired set of relays, please select them from the list below.",description:"Caption informing the user that he has no relays configured"},recomended:{id:"settings.network.recomended",defaultMessage:"Recomended Relays",description:"Title of the recomended relays section of the network settings sub-page"},customRelay:{id:"settings.network.customRelay",defaultMessage:"Connect to relay",description:"Title of the custom relays section of the network settings sub-page"},cachingService:{id:"settings.network.cachingService",defaultMessage:"Caching Service",description:"Title of the caching service section of the network settings sub-page"},connectedCachingService:{id:"settings.network.connectedCachingService",defaultMessage:"Connected caching service",description:"Title of the caching service section of the network settings sub-page"},alternativeCachingService:{id:"settings.network.alternativeCachingService",defaultMessage:"Connect to a different caching service",description:"Title of the alternative caching service section of the Network settings sub-page"},proxyEvents:{id:"settings.filters.proxyEvents",defaultMessage:"Use Enhanced Privacy",description:"Caption for option to proy event publishing through Primal"},proxyDescription:{id:"settings.filters.proxyDescription",defaultMessage:"When enabled, your IP address will be visible to the caching service, but not to relays. Your content will be published to your specified relays using the caching service as a proxy. ",description:"Description of the proxy events settings sub-page"}},relays:{id:"settings.relays",defaultMessage:"Relays",description:"Title of the relays sections of the settings sidebar"},cashingService:{id:"settings.cashingService",defaultMessage:"Caching services",description:"Title of the caching service sections of the settings sidebar"},title:{id:"settings.title",defaultMessage:"Settings",description:"Title of the settings page"},theme:{id:"settings.sections.theme",defaultMessage:"Theme",description:"Title of the theme section on the settings page"},feeds:{id:"settings.sections.feeds",defaultMessage:"Home page feeds",de
66scription:"Title of the feeds section on the settings page"},feedsAddNew:{id:"settings.feedsAddNew",defaultMessage:"Add New Feed",description:"Label for the button for adding new feed to the feeds list"},feedsRestore:{id:"settings.feedsRestore",defaultMessage:"Restore Default Feeds",description:"Label for the button for restoring default feeds to the feeds list"},feedsRestoreConfirm:{id:"settings.feedsRestoreConfirm",defaultMessage:"Restoring default feeds will erase all your custom feed settings",description:"Label explaining the impact of restoring default feeds"},zapsRestoreConfirm:{id:"settings.zapsRestoreConfirm",defaultMessage:"This action will restore all your zap settings to their default values",description:"Label explaining the impact of restoring default zaps"},zapEmojiFilterTitle:{id:"settings.zapEmojiFilterTitle",defaultMessage:"Select an emoji",description:"Title for the select emoji modal"},zapEmojiFilterPlaceholder:{id:"settings.zapEmojiFilterPlaceholder",defaultMessage:"Search...",description:"Placeholder for the emoji modal filter"},feedLatest:{id:"feeds.feedLatest",defaultMessage:"Latest",description:"Label for the `latest;following` (active user's) feed"},feedLatestWithReplies:{id:"feeds.feedLatestWithReplies",defaultMessage:"Latest with Replies",description:"Label for the `latest;following` with `include_replies` flag (active user's) feed"},zaps:{id:"settings.sections.zaps",defaultMessage:"Zaps",description:"Title of the zaps section on the settings page"},blossom:{id:"settings.sections.blossom",defaultMessage:"Media Uploads",description:"Title of the blossom section on the settings page"},devTools:{id:"settings.sections.devTools",defaultMessage:"Dev Tools",description:"Title of the dev tools section on the settings page"},notifications:{title:{id:"pages.settings.sections.notifications",defaultMessage:"Notifications",description:"Title of the notifications section on the settings page"},core:{id:"settings.sections.notifications.core",defaultMessage:"Show notifications for:",description:"Title of the notification settings sub-section for core notifications"},yourMentions:{id:"settings.sections.notifications.yourMentions",defaultMessage:"A note you were mentioned in was:",description:"Title of the notification settings sub-section for notes you were mentioned in"},yourPostMentions:{id:"settings.sections.notifications.yourPostMentions",defaultMessage:"A note your note was mentioned in was:",description:"Title of the notification settings sub-section for notes your note was mentioned in"},additionalNotifs:{id:"settings.sections.notifications.additionalNotifs",defaultMessage:"Notification preferences:",description:"Title of the notification settings sub-section for additional settings"}},profile:{title:{id:"pages.settings.profile.title",defaultMessage:"Edit Profile",description:"Title of the edit profile page"},uploadAvatar:{id:"pages.settings.profile.uploadAvatar",defaultMessage:"Upload Avatar",description:"Label for avatar upload on edit profile page"},uploadBanner:{id:"pages.settings.profile.uploadBanner",defaultMessage:"Upload Banner",description:"Label for banner upload on edit profile page"},displayName:{label:{id:"pages.settings.profile.displayName.label",defaultMessage:"Display Name",description:"Label for display name input on edit profile page"},help:{id:"pages.settings.profile.displayName.help",defaultMessage:"Pick a longer display name (e. g. “Satoshi Nakamoto”)",description:"Help for displayName input on edit profile page"},placeholder:{id:"pages.settings.profile.displayName.placeholder",defaultMessage:"Enter display name",description:"Placeholder for display name input on edit profile page"}},required:{id:"pages.settings.profile.reqired",defaultMessage:"required",description:"Label indicating an input is required"},name:{label:{id:"pages.settings.profile.name.label",defaultMessage:"Username",description:"Label for name input on edit profile page"},help:{id:"pages.settings.profile.name.help",defaultMessage:"Pick a short user handle (e. g. “satoshi”)",description:"Help for name input on edit profile page"},placeholder:{id:"pages.settings.profile.name.placeholder",defaultMessage:"Enter username",description:"Placeholder for name input on edit profile page"},error:{id:"pages.settings.profile.name.error",defaultMessage:"Space
66s and special characters are not allowed in the username",description:"Error label for name input on edit profile page"},formError:{id:"pages.settings.profile.name.formError",defaultMessage:"Username is not valid",description:"Error label for invalid form on edit profile page"}},website:{label:{id:"pages.settings.profile.website.label",defaultMessage:"Website",description:"Label for website input on edit profile page"},placeholder:{id:"pages.settings.profile.website.placeholder",defaultMessage:"https://www.mysite.com",description:"Placeholder for website input on edit profile page"}},about:{label:{id:"pages.settings.profile.about.label",defaultMessage:"About Me",description:"Label for about input on edit profile page"},placeholder:{id:"pages.settings.profile.about.placeholder",defaultMessage:"Say something about yourself",description:"Placeholder for about input on edit profile page"}},lud16:{label:{id:"pages.settings.profile.lud16.label",defaultMessage:"Bitcoin Lightning Address",description:"Label for lud16 input on edit profile page"},placeholder:{id:"pages.settings.profile.lud16.placeholder",defaultMessage:"Enter your LN address",description:"Placeholder for lud16 input on edit profile page"}},nip05:{label:{id:"pages.settings.profile.nip05.label",defaultMessage:"Verified Nostr Address (NIP-05)",description:"Label for nip-05 input on edit profile page"},placeholder:{id:"pages.settings.profile.nip05.placeholder",defaultMessage:"Enter your NIP-05 Verified Nostr ID",description:"Placeholder for nip-05 input on edit profile page"}},picture:{label:{id:"pages.settings.profile.picture.label",defaultMessage:"Avatar Image Url",description:"Label for avatar input on edit profile page"},placeholder:{id:"pages.settings.profile.picture.placeholder",defaultMessage:"Enter your avatar url",description:"Placeholder for avatar input on edit profile page"}},banner:{label:{id:"pages.settings.profile.banner.label",defaultMessage:"Banner Image Url",description:"Label for banner input on edit profile page"},placeholder:{id:"pages.settings.profile.banner.placeholder",defaultMessage:"Enter your banner url",description:"Placeholder for banner input on edit profile page"}}}},fbe={id:"toast.zapFail",defaultMessage:"We were unable to send this Zap",description:"Toast message indicating failed zap"},hbe={id:"toast.zapProfile",defaultMessage:"{name} zapped successfully",description:"Toast message indicating successful zap"},pbe={sidebar:{id:"thread.sidebar",defaultMessage:"Replying to this Note",description:"Title of the Thread page sidebar"},sidebarMentions:{id:"thread.sidebarMentions",defaultMessage:"People in this Note",description:"Title of the Thread page sidebar"},pageTitle:{id:"thread.page.title",defaultMessage:"Note by {name}",description:"Title of the Thread page sidebar"}},gbe={addFeedToHomeSuccess:{id:"toasts.addFeedToHome.success",defaultMessage:'"{name}" has been added to your home page',description:"Toast message confirming successfull adding of the feed to home to the list of available feeds"},removeFeedFromHomeSuccess:{id:"toasts.removeFeedToHome.success",defaultMessage:'"{name}" has been removed from your home page',description:"Toast message confirming successfull removal of the feed from home's list of available feeds"},fileTypeUpsupported:{id:"toast.unsupportedFileType",defaultMessage:"You can only upload images and videos. This file type is not supported.",description:"Feedback when user tries to upload an unsupported file type"},publishNoteSuccess:{id:"toast.publishNoteSuccess",defaultMessage:"Note posted successfully",description:"Toast message confirming successfull publication of the note"},publishPollSuccess:{id:"toast.publishPollSuccess",defaultMessage:"Poll posted successfully",description:"Toast message confirming successfull publication of the poll"},publishNoteTimeout:{id:"toast.publishNoteTimeout",defaultMessage:"No relay confirmed reception of your note after 8 seconds",description:"Toast message indicating that no relay confirmed note reception"},publishNoteFail:{id:"toast.publishNoteFail",defaultMessage:"Failed to publish note",description:"Toast message indicating that note publishing has failed"},noRelays:{id:"toast.noRelays",defaultMessage:"You need to declare at least one relay to perform this action",description:"Toast message indicating user has no relays configured"},noRelaysConnected:{id:"toast.noRelaysConnected",defaultMessage:'"We are trying to connect to your relays. Please try again in a few moments.',description:"Toast message indicating user is not connected to aany relay"},noExtension:{id:"toast.noExtension",defaultMessage:"Nostr extension is required to send events",description:"Toast message indicating no extension was found"},streamPrimalLinkCoppied:{id:"toast.streamPrimalLinkCoppied",defaultMessage:"Stream link copied",description:"Confirmation message that the stream's link has been copied"},streamIdCoppied:{id:"toast.streamIdCoppied",defaultMessage:"Stream id copied",description:"Confirmation message that the stream's id has been copied"},streamRawDataCoppied:{id:"toast.streamRawDataCoppied",defaultMessage:"Stream raw data copied",description:"Confirmation message that the stream's raw data has been copied"},streamAuthorNpubCoppied:{id:"toast.streamAuthorNpubCoppied",defaultMessage:"Stream author npub copied",description:"Confirmation message that the stream's author npub has been copied"},noteNostrLinkCoppied:{id:"toast.noteNostrLinkCoppied",defaultMessage:"Note nostr link copied",description:"Confirmation message that the note's link has been copied"},notePrimalLinkCoppied:{id:"toast.notePrimalLinkCoppied",defaultMessage:"Note link copied",description:"Confirmation message that the note's link has been copied"},notePrimalTextCoppied:{id:"toast.notePrimalTextCoppied",defaultMessage:"Note text copied",description:"Confirmation message that the note's text has been copied"},noteIdCoppied:{id:"toast.noteIdCoppied",defaultMessage:"Note id copied",description:"Confirmation message that the note's id has been copied"},noteRawDataCoppied:{id:"toast.noteRawDataCoppied",defaultMessage:"Note raw data copied",description:"Confirmation message that the note's raw data has been copied"},noteAuthorNpubCoppied:{id:"toast.noteAuthorNpubCoppied",defaultMessage:"Note author npub copied",description:"Confirmation message that the note's author npub has been copied"},profileNpubCoppied:{id:"toast.noteAuthorNpubCoppied",defaultMessage:"User npub copied",description:"Confirmation message that the user's npub has been copied"},noteBroadcastSuccess:{id:"toast.noteBroadcastSuccess",defaultMessage:"Note has been broadcasted to your relays",description:"Confirmation message that the note has been broadcasted"},noteBroadcastFail:{id:"toast.noteBroadcastFail",defaultMessage:"We were unable to broadcast this note",description:"Failure message that the note has not been broadcasted"},repostSuccess:{id:"toast.repostSuccess",defaultMessage:"Reposted successfully",description:"Toast message indicating successfull repost"},repostFailed:{id:"toast.repostFailed",defaultMessage:"Failed to repost",description:"Toast message indicating failed repost"},noteAuthorReported:{id:"toast.noteAuthorReported",defaultMessage:"User {name} reported",description:"Toast message indicating successfull user report"},zapAsGuest:{id:"toast.zapAsGuest",defaultMessage:"You must be logged-in to perform a zap",description:"Toast message indicating user must be logged-in to perform a zap"},zapUnavailable:{id:"toast.zapUnavailable",defaultMessage:"Author of this note cannot be zapped because they didn't setup their lightning address",description:"Toast message indicating user cannot receieve a zap"},zapDVMUnavailable:{id:"toast.zapDVMUnavailable",defaultMessage:"Author of this note cannot be zapped because they didn't setup their lightning address",description:"Toast message indicating user cannot receieve a zap"},updateProfileSuccess:{id:"toast.updateProfileSuccess",defaultMessage:"Profile updated successfully",description:"Toast message indicating that profile was successfully updated"},updateProfileFail:{id:"toast.updateProfileFail",defaultMessage:"Failed to update profile, please try again",description:"Toast message indicating that profile has failed to updated"}},mbe={id:"zap.custom.option",defaultMessage:"Zap {user} ",description:"Caption for custom zap amount modal"},vbe={id:"zap.custom.amount",defaultMessage:"Custom amount:",description:"Caption for custom zap amount input"},wQ={invalidRelayUrl:{id:"placeholders.invalidRelayUrl",defaultMessage:"Invalid url",description:"Error text for invalid url"},invalidServerUrl:{id:"placeholders.invalidServerUrl",defaultMessage:"Invalid url",description:"Error text for invalid url"}},ybe={preset:{id:"emoji.recent",defaultMessage:"Recently Used",description:"Recently used emoji group title"},face:{id:"emoji.face",defaultMessage:"Faces",description:"Faces emoji group title"}},bbe={fail:{id:"upload.fail",defaultMessage:"Failed to upload file {file}",description:"Error feedback when upload fails"},fileTooBigRegular:{id:"upload.fileTooBigRegular",defaultMessage:"File too big. Upload limit is 100MB.",description:"Error feedback when file is too big for regular users"},fileTooBigPremium:{id:"upload.fileTooBigPremium",defaultMessage:"File too big. Upload limit is 1GB.",description:"Error feedback when file is too big for premiumUsers"}},Ebe={title:{id:"forgotPin.title",defaultMessage:"This action will erase you key",description:"Forgot pin modal title"},description:{id:"forgotPin.description",defaultMessage:"You will still be able to browse Nostr through Primal but you will not be able to take any actions (post notes, like
66s,...) until you re-login with your private key. Are you sure you wish to continue?",description:"Explanation of what happens when pin is erased"},confirm:{id:"forgotPin.confirm",defaultMessage:"Yes, continue",description:"Confirm forgot pin action"},abort:{id:"forgotPin.abort",defaultMessage:"Cancel",description:"Abort forgot pin action"}},_be={title:{id:"followWarning.title",defaultMessage:"This action may result in an error",description:"Follow error modal title"},description:{id:"followWarning.description",defaultMessage:"If you continue, you will end up following just one nostr account. Are you sure you want to continue?",description:"Explanation of what happens when follow error occurs"},confirm:{id:"followWarning.confirm",defaultMessage:"Yes, continue",description:"Confirm forgot pin action"},abort:{id:"followWarning.abort",defaultMessage:"Abort",description:"Abort forgot pin action"}},wbe={pageTitle:{id:"reads.pageTitle",defaultMessage:"Reads",description:"Reads page title"}},Sbe={pageTitle:{id:"bookmarks.pageTitle",defaultMessage:"Bookmarks",description:"Bookmarks page title"},noBookmarks:{id:"bookmarks.noBookmarks",defaultMessage:"You don't have any bookmarks",description:"No bookmarks caption"},confirm:{title:{id:"bookmarks.confirm.title",defaultMessage:"Saving First Bookmark",description:"Follow error modal title"},description:{id:"bookmarks.confirm.description",defaultMessage:"You are about to save your first public bookmark. These bookmarks can be seen by other nostr users. Do you wish to continue?",description:"Explanation of what happens when bookmark error occurs"},confirm:{id:"bookmarks.confirm.confirm",defaultMessage:"Save Bookmark",description:"Confirm forgot pin action"},abort:{id:"bookmarks.confirm.abort",defaultMessage:"Cancel",description:"Abort forgot pin action"},titleZero:{id:"bookmarks.confirm.title",defaultMessage:"Removing Last Bookmark",description:"Follow error modal title"},descriptionZero:{id:"bookmarks.confirm.description",defaultMessage:"You are about to remove your last public bookmark. Do you wish to continue?",description:"Explanation of what happens when bookmark error occurs"},confirmZero:{id:"bookmarks.confirm.confirm",defaultMessage:"Remove Bookmark",description:"Confirm forgot pin action"},abortZero:{id:"bookmarks.confirm.abort",defaultMessage:"Cancel",description:"Abort forgot pin action"}}},Tbe={pay:{id:"lnInvoice.pay",defaultMessage:"Pay",description:"Pay invoice action"},title:{id:"lnInvoice.title",defaultMessage:"Lightning Invoice",description:"Lightning Invoice title"},expired:{id:"lnInvoice.expired",defaultMessage:"Expired: {date} ago",description:"Expired time"},expires:{id:"lnInvoice.expires",defaultMessage:"Expires: in {date}",description:"Expires time"},confirm:{title:{id:"lnInvoice.confirm.title",defaultMessage:"Are you sure?",description:"Lightning invoice pay confirmation"},description:{id:"lnInvoice.confirm.description",defaultMessage:"Pay {amount}",description:"Lightning Invoice confirm description"},confirmLabel:{id:"lnInvoice.confirm.confirmLabel",defaultMessage:"Yes, pay",description:"Lightning Invoice confirm button label"},abortLabel:{id:"lnInvoice.confirm.abortLabel",defaultMessage:"Cancel",description:"Lightning Invoice confirm button label"}}},Abe={redeem:{id:"cashuInvoice.redeem",defaultMessage:"Reedem",description:"Reedem ecash action"},pending:{id:"cashuInvoice.pending",defaultMessage:"Pending",description:"Pending ecash"},spent:{id:"cashuInvoice.spent",defaultMessage:"Spent",description:"Spent ecash"},title:{id:"cashuInvoice.title",defaultMessage:"Cashu Ecash",description:"Cashu Ecash title"},mint:{id:"cashuInvoice.mint",defaultMessage:"Mint: {url}",description:"Mint url"},confirm:{title:{id:"cashuInvoice.confirm.title",defaultMessage:"Are you sure?",description:"Cashu invoice pay confirmation"},description:{id:"cashuInvoice.confirm.description",defaultMessage:"Redeem {amount}",description:"Cashu Invoice confirm description"},confirmLabel:{id:"cashuInvoice.confirm.confirmLabel",defaultMessage:"Yes, redeem",description:"Cashu Invoice confirm button label"},abortLabel:{id:"cashuInvoice.confirm.abortLabel",defaultMessage:"Cancel",description:"Cashu Invoice confirm button label"}}},xbe={tabs:{likes:{id:"reactionsModal.tabs.likes",defaultMessage:"Likes ({count})",description:"Likes tab label in reactions modal"},zaps:{id:"reactionsModal.tabs.zaps",defaultMessage:"Zaps ({count})",description:"Zaps tab label in reactions modal"},reposts:{id:"reactionsModal.tabs.reposts",defaultMessage:"Reposts ({count})",description:"Reposts tab label in reactions modal"},quotes:{id:"reactionsModal.tabs.quotes",defaultMessage:"Quotes ({count})",description:"Quotes tab label in reactions modal"}}},Ibe={labels:{foreverPremium:{id:"pages.premium.labes.foreverPremium",defaultMessage:"Forever Premium",description:"Forever Premium perk title"},foreverPremiumDescription:{id:"pages.premium.labes.foreverPremiumDescription",defaultMessage:"Premium subscription never expires for legends.",description:"Forever Premium perk description"},privateBetaBuilds:{id:"pages.premium.labes.privateBetaBuilds",defaultMessage:"Private Beta Builds",description:"Private Beta Builds perk title"},privateBetaBuildsDescription:{id:"pages.premium.labes.privateBetaBuildsDescription",defaultMessage:"Get access to new features before they are public.",description:"Private Beta perk description"},moreMediaSpace:{id:"pages.premium.labes.moreMediaSpace",defaultMessage:"Way More Storage",description:"More Media perk title"},moreMediaSpaceDescription:{id:"pages.premium.labes.moreMediaSpaceDescription",defaultMessage:"Get 100GB of Primal Premium media storage.",description:"More Media perk description"},customLegendProfile:{id:"pages.premium.labes.customLegendProfile",defaultMessage:"Legendary Custom Profile",description:"Legendary Custom Profile perk title"},customLegendDescription:{id:"pages.premium.labes.customLegendDescription",defaultMessage:"Option to pick the color of your verified badge and set the glow around your avatar",description:"Legendary Custom Profile perk description"},legendPageCaption:{id:"pages.premium.labes.legendPageCaption",defaultMessage:"Donate $1000 or more to gain:",description:"Legend page caption"},legendPageExplanation:{id:"pages.premium.labes.legendPageExplanation",defaultMessage:"The Legend tier was created to recognize users who have made a significant contribution to Primal.",description:"Legend page explanation"}
66,supportFirstLine:{id:"pages.premium.labes.supportFirstLine",defaultMessage:"Want to get more out of Primal?",description:"Support label first line"},supportSecondLine:{id:"pages.premium.labes.supportSecondLine",defaultMessage:"Check out ",description:"Support label second line"},supportCaption:{id:"pages.premium.labes.supportCaption",defaultMessage:"Be a part of the Nostr revolution and help us continue building for this ecosystem.",description:"Support page caption"},leaveStars:{id:"pages.premium.labes.leaveStars",defaultMessage:"Leave a 5 Star Review",description:"Support page 5 star review caption"},leaveStarsDescription:{id:"pages.premium.labes.leaveStarsDescription",defaultMessage:"App Store reviews really help improve the visibility of Nostr apps at this early stage.",description:"Support page 5 star review description"},extendSubscription:{id:"pages.premium.labes.extendSubscription",defaultMessage:"Extend Subscription",description:"Support page extend subscription caption"},extendSubscriptionDescription:{id:"pages.premium.labes.extendSubscriptionDescription",defaultMessage:"Extend your existing subscription to gain peace of mind and help fund Primal.",description:"Support page extend subscription description"},becomeLegend:{id:"pages.premium.labes.becomeLegend",defaultMessage:"Become a Legend",description:"Support page become legend caption"},becomeLegendDescription:{id:"pages.premium.labes.becomeLegendDescription",defaultMessage:"Donate $1000 or more to gain permanent membership and exclusive perks!",description:"Support page become legend description"}},actions:{payNow:{id:"pages.premium.actions.payNow",defaultMessage:"Pay Now",description:"Action to pay now"},becomeLegend:{id:"pages.premium.actions.becomeLegend",defaultMessage:"Become a Legend Now",description:"Action that takes user to the Become a Legend page"},getIOS:{id:"pages.premium.actions.getIOS",defaultMessage:"Go to iOS App",description:"Action that takes user to the iOS APP page"},getAndroid:{id:"pages.premium.actions.getAndroid",defaultMessage:"Go to Android App",description:"Action that takes user to the Android App page"},support:{id:"pages.premium.actions.support",defaultMessage:"support us",description:"Action that takes user to the support page"},primalPro:{id:"pages.premium.actions.primalPro",defaultMessage:"Primal Pro",description:"Action that takes user to the Primal Pro dialog"},start:{id:"pages.premium.actions.start",defaultMessage:"Find Primal Name",description:"Find primal name action on the premium page"},back:{id:"pages.premium.actions.back",defaultMessage:"Back",description:"To the previous step on the premium page"},next:{id:"pages.premium.actions.next",defaultMessage:"Next",description:"To the next step on the premium page"},subscribe:{id:"pages.premium.actions.subscribe",defaultMessage:"Continue to Payment",description:"Subscribe action on the premium page"},done:{id:"pages.premium.actions.done",defaultMessage:"Done",description:"Done action on the premium page"},tryAgain:{id:"pages.premium.actions.tryAgain",defaultMessage:"Try Again",description:"Try again action on the premium page"},rename:{id:"pages.premium.actions.rename",defaultMessage:"Rename",description:"To the rename step on the premium page"},changeName:{id:"pages.premium.actions.changeName",defaultMessage:"Change Your Primal Name",description:"Change Primal name action on the premium page"},extendPlan:{id:"pages.premium.actions.extendPlan",defaultMessage:"Extend Your Subscription",description:"Extend your subscription action on the premium page"},renewPlan:{id:"pages.premium.actions.renewPlan",defaultMessage:"Renew Your Subscription",description:"Extend your subscription action on the premium page"},managePremium:{id:"pages.premium.actions.managePremium",defaultMessage:"Manage Premium",description:"Manage your Premium Account"}},title:{general:{id:"pages.premium.title",defaultMessage:"Primal {productGroup}",description:"Title of the premium page"},name:{id:"pages.premium.name",defaultMessage:"Choose a primal name",description:"Title of the premium find name page"},subscription:{id:"pages.premium.subscription",defaultMessage:"Congrats!",de
66scription:"Title of the premium subscription page"},subscriptionSubtitle:{id:"pages.premium.subscriptionSubtitle",defaultMessage:"Your Primal Name is available",description:"Subtitle of the premium subscription page"},rename:{id:"pages.premium.rename",defaultMessage:"Change your primal name",description:"Title of the premium rename page"},support:{id:"pages.premium.support",defaultMessage:"Support Primal",description:"Title of the premium support page"},premiums:{id:"pages.premium.premiums",defaultMessage:"Premium Users",description:"Title of the premium leaderboards page"},legends:{id:"pages.premium.legends",defaultMessage:"Primal Legends",description:"Title of the legends leaderboards page"},legend:{id:"pages.premium.legend",defaultMessage:"Become a Primal Legend",description:"Title of the premium legend page"},legendShort:{id:"pages.premium.legendShort",defaultMessage:"Primal Legend",description:"Short title of the premium legend page"},relay:{id:"pages.premium.relay",defaultMessage:"Primal Relay",description:"Title of the premium relay page"},media:{id:"pages.premium.media",defaultMessage:"Media Managment",description:"Title of the premium media managment page"},contacts:{id:"pages.premium.contacts",defaultMessage:"Recover Follow List",description:"Title of the premium recover contacts page"},content:{id:"pages.premium.content",defaultMessage:"Content Backup",description:"Title of the premium content backup page"},og:{id:"pages.premium.og",defaultMessage:"Primal OG",description:"Title of the Primal OG page"},ogLegend:{id:"pages.premium.ogLegend",defaultMessage:"Primal Legend",description:"Title of the Primal Legend page"}},subOptions:{prices:{m7:{id:"pages.premium.subOption.m7",defaultMessage:"$7/month",description:"$7 per month"},m6:{id:"pages.premium.subOption.m6",defaultMessage:"$6/month",description:"$6 per month"},m70:{id:"pages.premium.subOption.m70",defaultMessage:"$69.99/month",description:"$69.99 per month"},y750:{id:"pages.premium.subOption.y750",defaultMessage:"$750/year",description:"$750 per year"}},durations:{m3:{id:"pages.premium.duration.m3",defaultMessage:"3 months",description:"3 month duration"},m12:{id:"pages.premium.duration.m12",defaultMessage:"12 months",description:"12 month duration"},m1:{id:"pages.premium.duration.m1",defaultMessage:"monthly",description:"monthly payments"},y1:{id:"pages.premium.duration.y1",defaultMessage:"annually",description:"annual payments"}},success:{caption:{id:"pages.premium.success.caption",defaultMessage:"Success!",description:"Payment success caption"},m3:{id:"pages.premium.success.m3",defaultMessage:"You subscribed to Primal Premium for 3 months.",description:"Payment success description for 3 month plan"},m12:{id:"pages.premium.success.m12",defaultMessage:"You subscribed to Primal Premium for 12 months.",description:"Payment success description for 12 month plan"},m70:{id:"pages.premium.success.m70",defaultMessage:"You subscribed to Primal Pro for 1 month.",description:"Payment success description for 1 month pro plan"},y750:{id:"pages.premium.success.y750",defaultMessage:"You subscribed to Primal Pro for 12 months.",description:"Payment success description for 12 month pro plan"},legend:{id:"pages.premium.success.legend",defaultMessage:"You are now a Primal Legend.",description:"Payment success description for legends"},donation:{id:"pages.premium.success.donation",defaultMessage:"Thank you, Legend!",description:"Payment success description for additional donations by legends"}},fail:{caption:{id:"pages.premium.fail.caption",defaultMessage:"Payment failed!",description:"Payment failure caption"},description:{id:"pages.premium.success.description",defaultMessage:"There was a problem procesing your payment",description:"Payment failure description"}}},errors:{nameTooShort:{id:"pages.premium.error.nameTooShort",defaultMessage:"Name needs to be at least 3 characters long",description:"Name is too short error"},nameUnavailable:{id:"pages.premium.error.nameUnavailable",defaultMessage:"Sorry, that name is currently unavailable",description:"Name is unavailable error"},nameNotChanged:{id:"pages.premium.error.nameNotChanged",defaultMessage:"Failed to change name",description:"Name is unavailable error"}}},Lbe={pageCaption:{id:"pages.readsMy.pageCaption",defaultMessage:"My Articles",description:"My reads page caption"},noPublishedArticle:{id:"pages.readsMy.noPublishedArticle",defaultMessage:"No articles published",description:"No published articles label"},noDrafts:{id:"pages.readsMy.noDrafts",defaultMessage:"You don't have any drafts",description:"No published articles label"}},SQ="_fullHeader_1l6ts_1",TQ="_extended_1l6ts_15",AQ="_logo_1l6ts_30",xQ="_title_1l6ts_34",fg={fullHeader:SQ,extended:TQ,logo:AQ,title:xQ};
66var IQ=It("<div><div></div><div>");const LQ=a(t=>(()=>{var e=IQ(),n=e.firstChild,i=n.nextSibling;return Fe(i,X(sn,{get when(){return t.children},get fallback(){return t.title},get children(){return t.children}})),ze(s=>{var r=t.id,o=`${fg.fullHeader} ${t.extended?fg.extended:""}`,l=fg.logo,d=fg.title;return r!==s.e&&Ct(e,"id",s.e=r),o!==s.t&&xe(e,s.t=o),l!==s.a&&xe(n,s.a=l),d!==s.o&&xe(i,s.o=d),s},{e:void 0,t:void 0,a:void 0,o:void 0}),e})(),"PageCaption"),XN=Ys(LQ);function eF(){let t=new Set;function e(s){return t.add(s),()=>t.delete(s)}a(e,"subscribe");let n=!1;function i(s,r){if(n)return!(n=!1);const o={to:s,options:r,defaultPrevented:!1,preventDefault:()=>o.defaultPrevented=!0};for(const l of t)l.listener({...o,from:l.location,retry:d=>{d&&(n=!0),l.navigate(s,{...r,resolve:!1})}});return!o.defaultPrevented}return a(i,"confirm"),{subscribe:e,confirm:i}}a(eF,"createBeforeLeave");let k_;function C1(){(!window.history.state||window.history.state._depth==null)&&window.history.replaceState({...window.history.state,_depth:window.history.length-1},""),k_=window.history.state._depth}a(C1,"saveCurrentDepth");C1();function RQ(t){return{...t,_depth:window.history.state&&window.history.state._depth}}a(RQ,"keepDepth");function kQ(t,e){let n=!1;return()=>{const i=k_;C1();const s=i==null?null:k_-i;if(n){n=!1;return}s&&e(s)?(n=!0,window.history.go(-s)):t()}}a(kQ,"notifyIfNotBlocked");const MQ=/^(?:[a-z0-9]+:)?\/\//i,CQ=/^\/+|(\/)\/+$/g,tF="http://sr";function Ml(t,e=!1){const n=t.replace(CQ,"$1");return n?e||/^[?#]/.test(n)?n:"/"+n:""}a(Ml,"normalizePath");function lm(t,e,n){if(MQ.test(e))return;const i=Ml(t),s=n&&Ml(n);let r="";return!s||e.startsWith("/")?r=i:s.toLowerCase().indexOf(i.toLowerCase())!==0?r=i+s:r=s,(r||"/")+Ml(e,!r)}a(lm,"resolvePath");function PQ(t,e){if(t==null)throw new Error(e);return t}a(PQ,"invariant");function DQ(t,e){return Ml(t).replace(/\/*(\*.*)?$/g,"")+Ml(e)}a(DQ,"joinPaths");function nF(t){const e={};return t.searchParams.forEach((n,i)=>{i in e?Array.isArray(e[i])?e[i].push(n):e[i]=[e[i],n]:e[i]=n}
66),e}a(nF,"extractSearchParams");function OQ(t,e,n){const[i,s]=t.split("/*",2),r=i.split("/").filter(Boolean),o=r.length;return l=>{const d=l.split("/").filter(Boolean),c=d.length-o;if(c<0||c>0&&s===void 0&&!e)return null;const u={path:o?"":"/",params:{}},f=a(h=>n===void 0?void 0:n[h],"matchFilter");for(let h=0;h<o;h++){const p=r[h],g=p[0]===":",v=g?d[h]:d[h].toLowerCase(),y=g?p.slice(1):p.toLowerCase();if(g&&Pb(v,f(y)))u.params[y]=v;else if(g||!Pb(v,y))return null;u.path+=`/${v}`}if(s){const h=c?d.slice(-c).join("/"):"";if(Pb(h,f(s)))u.params[s]=h;else return null}return u}}a(OQ,"createMatcher");function Pb(t,e){const n=a(i=>i===t,"isEqual");return e===void 0?!0:typeof e=="string"?n(e):typeof e=="function"?e(t):Array.isArray(e)?e.some(n):e instanceof RegExp?e.test(t):!1}a(Pb,"matchSegment");function NQ(t){const[e,n]=t.pattern.split("/*",2),i=e.split("/").filter(Boolean);return i.reduce((s,r)=>s+(r.startsWith(":")?2:3),i.length-(n===void 0?0:1))}a(NQ,"scoreRoute");function iF(t){const e=new Map,n=Pf();return new Proxy({},{get(i,s){return e.has(s)||Wv(n,()=>e.set(s,ht(()=>t()[s]))),e.get(s)()},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}},ownKeys(){return Reflect.ownKeys(t())}})}a(iF,"createMemoObject");function FQ(t,e){const n=new URLSearchParams(t);Object.entries(e).forEach(([s,r])=>{r==null||r===""||r instanceof Array&&!r.length?n.delete(s):r instanceof Array?(n.delete(s),r.forEach(o=>{n.append(s,String(o))})):n.set(s,String(r))});const i=n.toString();return i?`?${i}`:""}a(FQ,"mergeSearchString");function sF(t){let e=/(\/?\:[^\/]+)\?/.exec(t);if(!e)return[t];let n=t.slice(0,e.index),i=t.slice(e.index+e[0].length);const s=[n,n+=e[1]];for(;e=/^(\/\:[^\/]+)\?/.exec(i);)s.push(n+=e[1]),i=i.slice(e[0].length);return sF(i).reduce((r,o)=>[...r,...s.map(l=>l+o)],[])}a(sF,"expandOptionals");const UQ=100,rF=Pn(),P1=Pn(),cu=a(()=>PQ(Dn(rF),"<A> and 'use' router primitives can be only used inside a Route."),"useRouter"),BQ=a(()=>Dn(P1)||cu().base,"useRoute"),$Q=a(t=>{const e=BQ();return ht(()=>e.resolvePath(t()))},"useResolvedPath"),HQ=a(t=>{const e=cu();return ht(()=>{const n=t();return n!==void 0?e.renderPath(n):n})},"useHref"),wy=a(()=>cu().navigatorFactory(),"useNavigate"),Sy=a(()=>cu().location,"useLocation"),Rbe=a(()=>cu().params,"useParams"),kbe=a(()=>{const t=Sy(),e=wy(),n=a((i,s)=>{const r=An(()=>FQ(t.search,i)+t.hash);e(r,{scroll:!1,resolve:!1,...s})},"setSearchParams");return[t.query,n]},"useSearchParams"),Mbe=a(t=>{const e=cu().beforeLeave.subscribe({listener:t,location:Sy(),navigate:wy()});Tt(e)},"useBeforeLeave");function GQ(t,e=""){const{component:n,preload:i,load:s,children:r,info:o}=t,l=!r||Array.isArray(r)&&!r.length,d={key:t,component:n,preload:i||s,info:o};return oF(t.path).reduce((c,u)=>{for(const f of sF(u)){const h=DQ(e,f);let p=l?h:h.split("/*",1)[0];p=p.split("/").map(g=>g.startsWith(":")||g.startsWith("*")?g:encodeURIComponent(g)).join("/"),c.push({...d,originalPath:u,pattern:p,matcher:OQ(p,!l,t.matchFilters)})}return c},[])}a(GQ,"createRoutes");function VQ(t,e=0){return{routes:t,score:NQ(t[t.length-1])*1e4-e,matcher(n){const i=[];for(let s=t.length-1;s>=0;s--){const r=t[s],o=r.matcher(n);if(!o)return null;i.unshift({...o,route:r})}return i}}}a(VQ,"createBranch");function oF(t){return Array.isArray(t)?t:[t]}a(oF,"asArray");function aF(t,e="",n=[],i=[]){const s=oF(t);for(let r=0,o=s.length;r<o;r++){const l=s[r];if(l&&typeof l=="object"){l.hasOwnProperty("path")||(l.path="");const d=GQ(l,e);for(const c of d){n.push(c);const u=Array.isArray(l.children)&&l.children.length===0;if(l.children&&!u)aF(l.children,c.pattern,n,i);else{const f=VQ([...n],i.length);i.push(f)}n.pop()}}}return n.length?i:i.sort((r,o)=>o.score-r.score)}a(aF,"createBranches");function Db(t,e){for(let n=0,i=t.length;n<i;n++){const s=t[n].matcher(e);if(s)return s}return[]}a(Db,"getRouteMatches");function WQ(t,e,n){const i=new URL(tF),s=ht(u=>{const f=t();try{return new URL(f,i)}catch{return console.error(`Invalid path ${f}`),u}},i,{equals:(u,f)=>u.href===f.href}),r=ht(()=>s().pathname),o=ht(()=>s().search,!0),l=ht(()=>s().hash),d=a(()=>"","key"),c=oi(o,()=>nF(s()));return{get pathname(){return r()},get search(){return o()},get hash(){return l()},get state(){return e()},get key(){return d()},query:n?n(c):iF(c)}}a(WQ,"createLocation");let ll;function lF(){return ll}a(lF,"getIntent");let Ud=!1;function zQ(){return Ud}a(zQ,"getInPreloadFn");function qk(t){Ud=t}a(qk,"setInPreloadFn");function KQ(t,e,n,i={}){const{signal:[s,r],utils:o={}}=t,l=o.parsePath||(_=>_),d=o.renderPath||(_=>_),c=o.beforeLeave||eF(),u=lm("",i.base||"");if(u===void 0)throw new Error(`${u} is not a valid base path`);u&&!s().value&&r({value:u,replace:!0,scroll:!1});const[f,h]=Je(!1);let p;const g=a((_,A)=>{A.value===v()&&A.state===b()||(p===void 0&&h(!0),ll=_,p=A,pf(()=>{p===A&&(y(p.value),E(p.state),M[1]([]))}).finally(()=>{p===A&&Aa(()=>{ll=void 0,_==="navigate"&&m(p),h(!1),p=void 0})}))},"transition"),[v,y]=Je(s().value),[b,E]=Je(s().state),T=WQ(v,b,o.queryWrapper),I=[],M=Je([]),H=ht(()=>typeof i.transformUrl=="function"?Db(e(),i.transformUrl(T.pathname)):Db(e(),T.pathname)),N=a(()=>{const _=H(),A={};for(let x=0;x<_.length;x++)Object.assign(A,_[x].params);return A},"buildParams"),$=o.paramsWrapper?o.paramsWrapper(N,e):iF(N),F={pattern:u,path:()=>u,outlet:()=>null,resolvePath(_){return lm(u,_)}};return ze(oi(s,_=>g("native",_),{defer:!0})),{base:F,location:T,params:$,isRouting:f,renderPath:d,parsePath:l,navigatorFactory:L,matches:H,beforeLeave:c,preloadRoute:S,singleFlight:i.singleFlight===void 0?!0:i.singleFlight,submissions:M};function D(_,A,x){An(()=>
66{if(typeof A=="number"){A&&(o.go?o.go(A):console.warn("Router integration does not support relative routing"));return}const C=!A||A[0]==="?",{replace:U,resolve:R,scroll:w,state:P}={replace:!1,resolve:!C,scroll:!0,...x},V=R?_.resolvePath(A):lm(C&&T.pathname||"",A);if(V===void 0)throw new Error(`Path '${A}' is not a routable path`);if(I.length>=UQ)throw new Error("Too many redirects");const Z=v();(V!==Z||P!==b())&&(iD||c.confirm(V,x)&&(I.push({value:Z,replace:U,scroll:w,state:b()}),g("navigate",{value:V,state:P})))})}a(D,"navigateFromRoute");function L(_){return _=_||Dn(P1)||F,(A,x)=>D(_,A,x)}a(L,"navigatorFactory");function m(_){const A=I[0];A&&(r({..._,replace:A.replace,scroll:A.scroll}),I.length=0)}a(m,"navigateEnd");function S(_,A){const x=Db(e(),_.pathname),C=ll;ll="preload";for(let U in x){const{route:R,params:w}=x[U];R.component&&R.component.preload&&R.component.preload();const{preload:P}=R;Ud=!0,A&&P&&Wv(n(),()=>P({params:w,location:{pathname:_.pathname,search:_.search,hash:_.hash,query:nF(_),state:null,key:""},intent:"preload"})),Ud=!1}ll=C}a(S,"preloadRoute")}a(KQ,"createRouterContext");function qQ(t,e,n,i){const{base:s,location:r,params:o}=t,{pattern:l,component:d,preload:c}=i().route,u=ht(()=>i().path);d&&d.preload&&d.preload(),Ud=!0;const f=c?c({params:o,location:r,intent:ll||"initial"}):void 0;return Ud=!1,{parent:e,pattern:l,path:u,outlet:()=>d?X(d,{params:o,location:r,data:f,get children(){return n()}}):n(),resolvePath(p){return lm(s.path(),p,u())}}}a(qQ,"createRouteContext");const jQ=a(t=>e=>{const{base:n}=e,i=Tp(()=>e.children),s=ht(()=>aF(i(),e.base||""));let r;const o=KQ(t,s,()=>r,{base:n,singleFlight:e.singleFlight,transformUrl:e.transformUrl});return t.create&&t.create(o),X(rF.Provider,{value:o,get children(){return X(YQ,{routerState:o,get root(){return e.root},get preload(){return e.rootPreload||e.rootLoad},get children(){return[ps(()=>(r=Pf())&&null),X(ZQ,{routerState:o,get branches(){return s()}})]}})}})},"createRouterComponent");function YQ(t){const e=t.routerState.location,n=t.routerState.params,i=ht(()=>t.preload&&An(()=>{qk(!0),t.preload({params:n,location:e,intent:lF()||"initial"}),qk(!1)}));return X(sn,{get when(){return t.root},keyed:!0,get fallback(){return t.children},children:s=>X(s,{params:n,location:e,get data(){return i()},get children(){return t.children}})})}a(YQ,"Root");function ZQ(t){const e=[];let n;const i=ht(oi(t.routerState.matches,(s,r,o)=>{let l=r&&s.length===r.length;const d=[];for(let c=0,u=s.length;c<u;c++){const f=r&&r[c],h=s[c];o&&f&&h.route.key===f.route.key?d[c]=o[c]:(l=!1,e[c]&&e[c](),ld(p=>{e[c]=p,d[c]=qQ(t.routerState,d[c-1]||t.routerState.base,jk(()=>i()[c+1]),()=>t.routerState.matches()[c])}))}return e.splice(s.length).forEach(c=>c()),o&&l?o:(n=d[0],d)}));return jk(()=>i()&&n)()}a(ZQ,"Routes");const jk=a(t=>()=>X(sn,{get when(){return t()},keyed:!0,children:e=>X(P1.Provider,{value:e,get children(){return e.outlet()}})}),"createOutlet"),$e=a(t=>{const e=Tp(()=>t.children);return Yt(t,{get children(){return e()}})},"Route");function QQ([t,e],n,i){return[n?()=>n(t()):t,i?s=>e(i(s)):e]}a(QQ,"intercept");function JQ(t){let e=!1;const n=a(s=>typeof s=="string"?{value:s}:s,"wrap"),i=QQ(Je(n(t.get()),{equals:(s,r)=>s.value===r.value&&s.state===r.state}),void 0,s=>(!e&&t.set(s),ot.registry&&!ot.done&&(ot.done=!0),s));return t.init&&Tt(t.init((s=t.get())=>{e=!0,i[1](n(s)),e=!1})),jQ({signal:i,create:t.create,utils:t.utils})}a(JQ,"createRouter");function XQ(t,e,n){return t.addEventListener(e,n),()=>t.removeEventListener(e,n)}a(XQ,"bindEvent");function eJ(t,e){const n=t&&document.getElementById(t);n?n.scrollIntoView():e&&window.scrollTo(0,0)}a(eJ,"scrollToHash");const tJ="Location",nJ=5e3,iJ=18e4;let M_=new Map;setInterval(()=>{const t=Date.now();for(let[e,n]of M_.entries())!n[3].count&&t-n[0]>iJ&&M_.delete(e)},3e5);function D1(){return M_}a(D1,"getCache");function O1(t,e){t.GET&&(t=t.GET);const n=a((...i)=>{const s=D1(),r=lF(),o=zQ(),d=Pf()?wy():void 0,c=Date.now(),u=e+Yk(i);let f=s.get(u),h;if(Id()&&!iD&&(h=!0,Tt(()=>f[3].count--)),f&&f[0]&&(r==="native"||f[3].count||Date.now()-f[0]<nJ)){h&&(f[3].count++,f[3][0]()),f[2]==="preload"&&r!=="preload"&&(f[0]=c);let v=f[1];return r!=="preload"&&(v="then"in f[1]?f[1].then(g(!1),g(!0)):g(!1)(f[1]),r==="navigate"&&pf(()=>f[3][1](f[0]))),o&&"then"in v&&v.catch(()=>{}),v}let p=ot.context&&ot.has(u)?ot.load(u):t(...i);return f?(f[0]=c,f[1]=p,f[2]=r,r==="navigate"&&pf(()=>f[3][1](f[0]))):(s.set(u,f=[c,p,r,Je(c)]),f[3].count=0),h&&(f[3].count++,f[3][0]()),r!=="preload"&&(p="then"in p?p.then(g(!1),g(!0)):g(!1)(p)),o&&"then"in p&&p.catch(()=>{}),p;function g(v){return async y=>
66{if(y instanceof Response){const b=y.headers.get(tJ);if(b!==null){d&&b.startsWith("/")?pf(()=>{d(b,{replace:!0})}):window.location.href=b;return}y.customBody&&(y=await y.customBody())}if(v)throw y;return y}}a(g,"handleResponse")},"cachedFn");return n.keyFor=(...i)=>e+Yk(i),n.key=e,n}a(O1,"cache");O1.set=(t,e)=>{const n=D1(),i=Date.now();let s=n.get(t);s?(s[0]=i,s[1]=e,s[2]="preload"):(n.set(t,s=[i,e,,Je(i)]),s[3].count=0)};O1.clear=()=>D1().clear();function Yk(t){return JSON.stringify(t,(e,n)=>sJ(n)?Object.keys(n).sort().reduce((i,s)=>(i[s]=n[s],i),{}):n)}a(Yk,"hashKey");function sJ(t){let e;return t!=null&&typeof t=="object"&&(!(e=Object.getPrototypeOf(t))||e===Object.prototype)}a(sJ,"isPlainObject");const rJ=new Map;function oJ(t=!0,e=!1,n="/_server",i){return s=>{const r=s.base.path(),o=s.navigatorFactory(s.base);let l,d;function c(v){return v.namespaceURI==="http://www.w3.org/2000/svg"}a(c,"isSvg");function u(v){if(v.defaultPrevented||v.button!==0||v.metaKey||v.altKey||v.ctrlKey||v.shiftKey)return;const y=v.composedPath().find(H=>H instanceof Node&&H.nodeName.toUpperCase()==="A");if(!y||e&&!y.hasAttribute("link"))return;const b=c(y),E=b?y.href.baseVal:y.href;if((b?y.target.baseVal:y.target)||!E&&!y.hasAttribute("state"))return;const I=(y.getAttribute("rel")||"").split(/\s+/);if(y.hasAttribute("download")||I&&I.includes("external"))return;const M=b?new URL(E,document.baseURI):new URL(E);if(!(M.origin!==window.location.origin||r&&M.pathname&&!M.pathname.toLowerCase().startsWith(r.toLowerCase())))return[y,M]}a(u,"handleAnchor");function f(v){const y=u(v);if(!y)return;const[b,E]=y,T=s.parsePath(E.pathname+E.search+E.hash),I=b.getAttribute("state");v.preventDefault(),o(T,{resolve:!1,replace:b.hasAttribute("replace"),scroll:!b.hasAttribute("noscroll"),state:I?JSON.parse(I):void 0})}a(f,"handleAnchorClick");function h(v){const y=u(v);if(!y)return;const[b,E]=y;i&&(E.pathname=i(E.pathname)),s.preloadRoute(E,b.getAttribute("preload")!=="false")}a(h,"handleAnchorPreload");function p(v){clearTimeout(l);const y=u(v);if(!y)return d=null;const[b,E]=y;d!==b&&(i&&(E.pathname=i(E.pathname)),l=setTimeout(()=>{s.preloadRoute(E,b.getAttribute("preload")!=="false"),d=b},20))}a(p,"handleAnchorMove");function g(v){if(v.defaultPrevented)return;let y=v.submitter&&v.submitter.hasAttribute("formaction")?v.submitter.getAttribute("formaction"):v.target.getAttribute("action");if(!y)return;if(!y.startsWith("https://action/")){const E=new URL(y,tF);if(y=s.parsePath(E.pathname+E.search),!y.startsWith(n))return}if(v.target.method.toUpperCase()!=="POST")throw new Error("Only POST forms are supported for Actions");const b=rJ.get(y);if(b){v.preventDefault();const E=new FormData(v.target,v.submitter);b.call({r:s,f:v.target},v.target.enctype==="multipart/form-data"?E:new URLSearchParams(E))}}a(g,"handleFormSubmit"),Kv(["click","submit"]),document.addEventListener("click",f),t&&(document.addEventListener("mousemove",p,{passive:!0}),document.addEventListener("focusin",h,{passive:!0}),document.addEventListener("touchstart",h,{passive:!0})),document.addEventListener("submit",g),Tt(()=>{document.removeEventListener("click",f),t&&(document.removeEventListener("mousemove",p),document.removeEventListener("focusin",h),document.removeEventListener("touchstart",h)),document.removeEventListener("submit",g)})}}a(oJ,"setupNativeEvents");function aJ(t){const e=a(()=>{const i=window.location.pathname.replace(/^\/+/,"/")+window.location.search,s=window.history.state&&window.history.state._depth&&Object.keys(window.history.state).length===1?void 0:window.history.state;return{value:i+window.location.hash,state:s}},"getSource"),n=eF();return JQ({get:e,set({value:i,replace:s,scroll:r,state:o}){s?window.history.replaceState(RQ(o),"",i):window.history.pushState(o,"",i),eJ(decodeURIComponent(window.location.hash.slice(1)),r),C1()},init:i=>XQ(window,"popstate",kQ(i,s=>{if(s&&s<0)return!n.confirm(s);{const r=e();return!n.confirm(r.value,{state:r.state})}})),create:oJ(t.preload,t.explicitLinks,t.actionBase,t.transformUrl),utils:{go:i=>window.history.go(i),beforeLeave:n}})(t)}a(aJ,"Router");var lJ=It("<a>");function v0(t){t=Yt({inactiveClass:"inactive",activeClass:"active"},t);const[,e]=Gn(t,["href","state","class","activeClass","inactiveClass","end"]),n=$Q(()=>t.href),i=HQ(n),s=Sy(),r=ht(()=>{const o=n();if(o===void 0)return[!1,!1];const l=Ml(o.split(/[?#]/,1)[0]).toLowerCase(),d=decodeURI(Ml(s.pathname).toLowerCase());return[t.end?l===d:d.startsWith(l+"/")||d===l,l===d]});return(()=>{var o=lJ();return nD(o,Yt(e,{get href(){return i()||t.href},get state(){return JSON.stringify(t.state)},get classList(){return{...t.class&&{[t.class]:!0},[t.inactiveClass]:!r()[0],[t.activeClass]:r()[0],...e.classList}},link:"",get"aria-current"(){return r()[1]?"page":void 0}}),!1,!1),o})()}a(v0,"A");function Ob(t){const e=wy(),n=Sy(),{href:i,state:s}=t,r=typeof i=="function"?i({navigate:e,location:n}):i;return e(r,{replace:!0,state:s}),null}a(Ob,"Navigate");const Ju=document.querySelector("title");let cJ=Ju?.innerText||"";const cF=a(t=>(We(()=>{Ju&&(Ju.innerText=t.title)}),Tt(()=>{Ju&&(Ju.innerText=cJ)}),[]),"PageTitle"),dF="/assets/logo-d368885b.svg",Cbe=Object.freeze(Object.defineProperty({__proto__:null,default:dF},Symbol.toStringTag,{value:"Module"})),C_="/assets/nwc-877b8f59.svg",Pbe=Object.freeze(Object.defineProperty({__proto__:null,default:C_},Symbol.toStringTag,{value:"Module"})),dJ="_nwcWallet_1ihl9_1",uJ="_logo_1ihl9_8",fJ="_walletInfos_1ihl9_12",hJ="_walletInfo_1ihl9_12",pJ="_walletName_1ihl9_22",gJ="_walletDesc_1ihl9_31",mJ="_walletAction_1ihl9_39",vJ="_walletActive_1ihl9_39",yJ="_checkCircleIcon_1ihl9_52",sr={nwcWallet:dJ,logo:uJ,walletInfos:fJ,walletInfo:hJ,walletName:pJ,walletDesc:gJ,walletAction:mJ,walletActive:vJ,checkCircleIcon:yJ};function uF(t,e){const[n,i]=Je(Zk(e?.()));return We(()=>{i(t()?.tagName.toLowerCase()||Zk(e?.()))}),n}a(uF,"createTagName");function Zk(t){return fK(t)?t:void 0}a(Zk,"stringOrUndefined");function is(t){const[e,n]=Gn(t,["as"]);if(!e.as)throw new Error("[kobalte]: Polymorphic is missing the required `as` prop.");return X(w8,Yt(n,{get component(){return e.as}}))}a(is,"Polymorphic");var bJ=Object.defineProperty,Ty=a((t,e)=>{for(var n in e)bJ(t,n,{get:e[n],enumerable:!0})},"__export"),EJ={};Ty(EJ,{Button:()=>xy,Root:()=>Ay});var _J=["button","color","file","image","reset","submit"];function wJ(t){const e=t.tagName.toLowerCase();
66return e==="button"?!0:e==="input"&&t.type?_J.indexOf(t.type)!==-1:!1}a(wJ,"isButton");function Ay(t){let e;const n=mi({type:"button"},t),[i,s]=Gn(n,["ref","type","disabled"]),r=uF(()=>e,()=>"button"),o=ht(()=>{const c=r();return c==null?!1:wJ({tagName:c,type:i.type})}),l=ht(()=>r()==="input"),d=ht(()=>r()==="a"&&e?.getAttribute("href")!=null);return X(is,Yt({as:"button",ref(c){var u=js(f=>e=f,i.ref);typeof u=="function"&&u(c)},get type(){return ps(()=>!!(o()||l()))()?i.type:void 0},get role(){return!o()&&!d()?"button":void 0},get tabIndex(){return!o()&&!d()&&!i.disabled?0:void 0},get disabled(){return ps(()=>!!(o()||l()))()?i.disabled:void 0},get"aria-disabled"(){return!o()&&!l()&&i.disabled?!0:void 0},get"data-disabled"(){return i.disabled?"":void 0}},s))}a(Ay,"ButtonRoot");var xy=Ay;const SJ="_primary_928m4_1",TJ="_secondary_928m4_19",AJ="_noPadding_928m4_35",xJ="_light_928m4_38",IJ="_shrunk_928m4_42",LJ="_copy_928m4_47",RJ="_copyIcon_928m4_62",kJ="_left_928m4_69",MJ="_right_928m4_72",CJ="_checkIcon_928m4_75",PJ="_dark_928m4_105",DJ="_red_928m4_111",OJ="_link_928m4_117",NJ="_profile_928m4_129",FJ="_flipInactive_928m4_152",UJ="_flipActive_928m4_172",BJ="_flipInactive2_928m4_200",$J="_flipActive2_928m4_220",HJ="_proVersion_928m4_264",GJ="_tertiary_928m4_268",VJ="_ghost_928m4_284",WJ="_highlight_928m4_301",zJ="_premium_928m4_305",KJ="_green_928m4_326",qJ="_spinner_928m4_344",Ta={primary:SJ,secondary:TJ,noPadding:AJ,light:xJ,shrunk:IJ,copy:LJ,copyIcon:RJ,left:kJ,right:MJ,checkIcon:CJ,dark:PJ,red:DJ,link:OJ,profile:NJ,flipInactive:FJ,flipActive:UJ,flipInactive2:BJ,flipActive2:$J,proVersion:HJ,tertiary:GJ,ghost:VJ,highlight:WJ,premium:zJ,green:KJ,spinner:qJ,"spinner-rotation":"_spinner-rotation_928m4_1"};var jJ=It("<div>");const YJ=a(t=>X(xy,{get id(){return t.id},get class(){return Ta.primary},get onClick(){return t.onClick},get disabled(){return t.disabled},get type(){return t.type},ref(e){var n=t.ref;typeof n=="function"?n(e):t.ref=e},get children(){return X(sn,{get when(){return t.loading},get fallback(){return t.children},get children(){var e=jJ();return ze(()=>xe(e,Ta.spinner)),e}})}}),"ButtonPrimary"),N1=Ys(YJ),ZJ=a(t=>X(xy,{get id(){return t.id},get class(){return`${Ta.link} ${t.pro?Ta.proVersion:""}`},get onClick(){return t.onClick},get disabled(){return t.disabled},get title(){return t.title},get children(){return t.children}}),"ButtonLink"),P_=Ys(ZJ);var QJ=It("<div><div></div><div>Active"),JJ=It("<div><img><div><div><div></div><div></div></div><div></div></div><div>"),XJ=It("<div>");const Qk=a(t=>(()=>{var e=JJ(),n=e.firstChild,i=n.nextSibling,s=i.firstChild,r=s.firstChild,o=r.nextSibling,l=s.nextSibling,d=i.nextSibling;return Fe(r,()=>t.name),Fe(o,()=>
66t.desc),Fe(l,X(Qm,{get children(){return[X(_a,{get when(){return ps(()=>!!t.onRemove)()&&t.status!=="connected"},get children(){return X(P_,{onClick:()=>t.onRemove&&t.onRemove(),children:"remove"})}}),X(_a,{get when(){return ps(()=>!!t.onDisconnect)()&&t.status==="connected"},get children(){return X(P_,{onClick:()=>t.onDisconnect&&t.onDisconnect(),children:"disconnect"})}})]}})),Fe(d,X(Qm,{get fallback(){return XJ()},get children(){return[X(_a,{get when(){return t.status==="connected"},get children(){var c=QJ(),u=c.firstChild;return ze(f=>{var h=sr.walletActive,p=sr.checkCircleIcon;return h!==f.e&&xe(c,f.e=h),p!==f.t&&xe(u,f.t=p),f},{e:void 0,t:void 0}),c}}),X(_a,{get when(){return t.status==="active"||t.status==="none"},get children(){return X(N1,{get onClick(){return t.onConnect},children:"Connect"})}})]}})),ze(c=>{var u=sr.nwcWallet,f=t.status,h=t.logo,p=sr.logo,g=sr.walletInfos,v=sr.walletInfo,y=sr.walletName,b=sr.walletDesc,E=sr.walletRemove,T=sr.walletAction;return u!==c.e&&xe(e,c.e=u),f!==c.t&&Ct(e,"data-status",c.t=f),h!==c.a&&Ct(n,"src",c.a=h),p!==c.o&&xe(n,c.o=p),g!==c.i&&xe(i,c.i=g),v!==c.n&&xe(s,c.n=v),y!==c.s&&xe(r,c.s=y),b!==c.h&&xe(o,c.h=b),E!==c.r&&xe(l,c.r=E),T!==c.d&&xe(d,c.d=T),c},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0}),e})(),"NWCItem"),eX="_excludeIcon_j1miu_37",tX="_chevronIcon_j1miu_45",nX="_checkIcon_j1miu_53",iX="_userSelector_j1miu_61",sX="_userList_j1miu_64",rX="_userPill_j1miu_78",oX="_remove_j1miu_89",aX="_dropdownMenuTrigger_j1miu_106",lX="_selctionLabel_j1miu_126",cX="_dropdownMenuContent_j1miu_136",dX="_search_j1miu_141",uX="_searchIcon_j1miu_154",fX="_searchIconDark_j1miu_188",hX="_searchHolder_j1miu_196",pX="_focused_j1miu_204",gX="_searchSuggestions_j1miu_207",mX="_hidden_j1miu_213",vX="_loadingOverlay_j1miu_217",yX="_advancedSearchSlider_j1miu_239",bX="_slider_j1miu_245",EX="_track_j1miu_248",_X="_fill_j1miu_255",wX="_thumb_j1miu_261",SX="_shortInput_j1miu_277",TX="_dark_j1miu_285",AX="_input_j1miu_288",xX="_long_j1miu_303",IX="_dialogOverlay_j1miu_310",LX="_overlayHide_j1miu_1",RX="_overlayShow_j1miu_1",kX="_dialog_j1miu_310",MX="_dialogContent_j1miu_330",CX="_contentHide_j1miu_1",PX="_contentShow_j1m
66iu_1",DX="_dialogHeader_j1miu_339",OX="_topAligned_j1miu_345",NX="_dialogCloseButton_j1miu_348",FX="_dialogTitle_j1miu_370",UX="_dialogDescription_j1miu_377",BX="_noPadding_j1miu_384",$X="_selectBox_j1miu_398",HX="_trigger_j1miu_407",GX="_shortTrigger_j1miu_428",VX="_selectContent_j1miu_434",WX="_selectItem_j1miu_446",zX="_searchCommand_j1miu_476",KX="_faintButton_j1miu_494",rr={excludeIcon:eX,chevronIcon:tX,checkIcon:nX,userSelector:iX,userList:sX,userPill:rX,remove:oX,dropdownMenuTrigger:aX,selctionLabel:lX,dropdownMenuContent:cX,search:dX,searchIcon:uX,searchIconDark:fX,searchHolder:hX,focused:pX,searchSuggestions:gX,hidden:mX,loadingOverlay:vX,advancedSearchSlider:yX,slider:bX,track:EX,fill:_X,thumb:wX,shortInput:SX,dark:TX,input:AX,long:xX,dialogOverlay:IX,overlayHide:LX,overlayShow:RX,dialog:kX,dialogContent:MX,contentHide:CX,contentShow:PX,dialogHeader:DX,topAligned:OX,dialogCloseButton:NX,dialogTitle:FX,dialogDescription:UX,noPadding:BX,selectBox:$X,trigger:HX,shortTrigger:GX,selectContent:VX,selectItem:WX,searchCommand:zX,faintButton:KX};var y0="data-kb-top-layer",fF,D_=!1,wo=[];function Yf(t){return wo.findIndex(e=>e.node===t)}a(Yf,"indexOf");function qX(t){return wo[Yf(t)]}a(qX,"find");function jX(t){return wo[wo.length-1].node===t}a(jX,"isTopMostLayer");function hF(){return wo.filter(t=>t.isPointerBlocking)}a(hF,"getPointerBlockingLayers");function YX(){return[...hF()].slice(-1)[0]}a(YX,"getTopMostPointerBlockingLayer");function F1(){return hF().length>0}a(F1,"hasPointerBlockingLayer");function pF(t){const e=Yf(YX()?.node);return Yf(t)<e}a(pF,"isBelowPointerBlockingLayer");function ZX(t){wo.push(t)}a(ZX,"addLayer");function QX(t){const e=Yf(t);e<0||wo.splice(e,1)}a(QX,"removeLayer");function JX(){for(const{node:t}of wo)t.style.pointerEvents=pF(t)?"none":"auto"}a(JX,"assignPointerEventToLayers");function XX(t){if(F1()&&!D_){const e=Eo(t);fF=document.body.style.pointerEvents,e.body.style.pointerEvents="none",D_=!0}}a(XX,"disableBodyPointerEvents");function eee(t){if(F1())return;const e=Eo(t);e.body.style.pointerEvents=fF,e.body.style.length===0&&e.body.removeAttribute("style"),D_=!1}a(eee,"restoreBodyPointerEvents");var rs={layers:wo,isTopMostLayer:jX,hasPointerBlockingLayer:F1,isBelowPointerBlockingLayer:pF,addLayer:ZX,removeLayer:QX,indexOf:Yf,find:qX,assignPointerEventToLayers:JX,disableBodyPointerEvents:XX,restoreBodyPointerEvents:eee},gF=7e3,Nb=null,tee="data-live-announcer";function Dbe(t,e="assertive",n=gF){Nb||(Nb=new nee),Nb.announce(t,e,n)}a(Dbe,"announce");var fp,nee=(fp=class{node;assertiveLog;politeLog;constructor(){this.node=document.createElement("div"),this.node.dataset.liveAnnouncer="true",Object.assign(this.node.style,b1),this.assertiveLog=this.createLog("assertive"),this.node.appendChild(this.assertiveLog),this.politeLog=this.createLog("polite"),this.node.appendChild(this.politeLog),document.body.prepend(this.node)}createLog(e){const n=document.createElement("div");return n.setAttribute("role","log"),n.setAttribute("aria-live",e),n.setAttribute("aria-relevant","additions"),n}destroy(){this.node&&(document.body.removeChild(this.node),this.node=null)}announce(e,n="assertive",i=gF){if(!this.node)return;const s=document.createElement("div");s.textContent=e,n==="assertive"?this.assertiveLog.appendChild(s):this.politeLog.appendChild(s),e!==""&&setTimeout(()=>{s.remove()},i)}clear(e){this.node&&((!e||e==="assertive")&&(this.assertiveLog.innerHTML=""),(!e||e==="polite")&&(this.politeLog.innerHTML=""))}},a(fp,"LiveAnnouncer"),fp);function iee(t){We(()=>{St(t.isDisabled)||Tt(see(St(t.targets),St(t.root)))})}a(iee,"createHideOutside");var Pu=new WeakMap,Es=[];function see(t,e=document.body){const n=new Set(t),i=new Set,s=a(d=>{for(const h of d.querySelectorAll(`[${tee}], [${y0}]`))n.add(h);const c=a(h=>{if(n.has(h)||h.parentElement&&i.has(h.parentElement)&&h.parentElement.getAttribute("role")!=="row")return NodeFilter.FILTER_REJECT;for(const p of n)if(h.contains(p))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_ACCEPT},"acceptNode"),u=document.createTreeWalker(d,NodeFilter.SHOW_ELEMENT,{acceptNode:c}),f=c(d);if(f===NodeFilter.FILTER_ACCEPT&&r(d),f!==NodeFilter.FILTER_REJECT){let h=u.nextNode();for(;h!=null;)r(h),h=u.nextNode()}},"walk"),r=a(d=>{const c=Pu.get(d)??0;d.getAttribute("aria-hidden")==="true"&&c===0||(c===0&&d.setAttribute("aria-hidden","true"),i.add(d),Pu.set(d,c+1))},"hide");Es.length&&Es[Es.length-1].disconnect(),s(e);const o=new MutationObserver(d=>{for(const c of d)if(!(c.type!=="childList"||c.addedNodes.length===0)&&![...n,...i].some(u=>
66u.contains(c.target))){for(const u of c.removedNodes)u instanceof Element&&(n.delete(u),i.delete(u));for(const u of c.addedNodes)(u instanceof HTMLElement||u instanceof SVGElement)&&(u.dataset.liveAnnouncer==="true"||u.dataset.reactAriaTopLayer==="true")?n.add(u):u instanceof Element&&s(u)}});o.observe(e,{childList:!0,subtree:!0});const l={observe(){o.observe(e,{childList:!0,subtree:!0})},disconnect(){o.disconnect()}};return Es.push(l),()=>{o.disconnect();for(const d of i){const c=Pu.get(d);if(c==null)return;c===1?(d.removeAttribute("aria-hidden"),Pu.delete(d)):Pu.set(d,c-1)}l===Es[Es.length-1]?(Es.pop(),Es.length&&Es[Es.length-1].observe()):Es.splice(Es.indexOf(l),1)}}a(see,"ariaHideOutside");var Fb="focusScope.autoFocusOnMount",Ub="focusScope.autoFocusOnUnmount",Jk={bubbles:!1,cancelable:!0},Xk={stack:[],active(){return this.stack[0]},add(t){t!==this.active()&&this.active()?.pause(),this.stack=hk(this.stack,t),this.stack.unshift(t)},remove(t){this.stack=hk(this.stack,t),this.active()?.resume()}};function ree(t,e){const[n,i]=Je(!1),s={pause(){i(!0)},resume(){i(!1)}};let r=null;const o=a(g=>t.onMountAutoFocus?.(g),"onMountAutoFocus"),l=a(g=>t.onUnmountAutoFocus?.(g),"onUnmountAutoFocus"),d=a(()=>Eo(e()),"ownerDocument"),c=a(()=>{const g=d().createElement("span");return g.setAttribute("data-focus-trap",""),g.tabIndex=0,Object.assign(g.style,b1),g},"createSentinel"),u=a(()=>{const g=e();return g?gN(g,!0).filter(v=>!v.hasAttribute("data-focus-trap")):[]},"tabbables"),f=a(()=>{const g=u();return g.length>0?g[0]:null},"firstTabbable"),h=a(()=>{const g=u();return g.length>0?g[g.length-1]:null},"lastTabbable"),p=a(()=>{const g=e();if(!g)return!1;const v=Qu(g);return!v||ho(g,v)?!1:mN(v)},"shouldPreventUnmountAutoFocus");We(()=>{const g=e();if(!g)return;Xk.add(s);const v=Qu(g);if(!ho(g,v)){const b=new CustomEvent(Fb,Jk);g.addEventListener(Fb,o),g.dispatchEvent(b),b.defaultPrevented||setTimeout(()=>{no(f()),Qu(g)===v&&no(g)},0)}Tt(()=>{g.removeEventListener(Fb,o),setTimeout(()=>{const b=new CustomEvent(Ub,Jk);p()&&b.preventDefault(),g.addEventListener(Ub,l),g.dispatchEvent(b),b.defaultPrevented||no(v??d().body),g.removeEventListener(Ub,l),Xk.remove(s)},0)})}),We(()=>{const g=e();if(!g||!St(t.trapFocus)||n())return;const v=a(b=>{const E=b.target;E?.closest(`[${y0}]`)||(ho(g,E)?r=E:no(r))},"onFocusIn"),y=a(b=>{const T=b.relatedTarget??Qu(g);T?.closest(`[${y0}]`)||ho(g,T)||no(r)},"onFocusOut");d().addEventListener("focusin",v),d().addEventListener("focusout",y),Tt(()=>{d().removeEventListener("focusin",v),d().removeEventListener("focusout",y)})}),We(()=>{const g=e();if(!g||!St(t.trapFocus)||n())return;const v=c();g.insertAdjacentElement("afterbegin",v);const y=c();g.insertAdjacentElement("beforeend",y);function b(T){const I=f(),M=h();T.relatedTarget===I?no(M):no(I)}a(b,"onFocus"),v.addEventListener("focusin",b),y.addEventListener("focusin",b);const E=new MutationObserver(T=>{for(const I of T)I.previousSibling===y&&(y.remove(),g.insertAdjacentElement("beforeend",y)),I.nextSibling===v&&(v.remove(),g.insertAdjacentElement("afterbegin",v))});E.observe(g,{childList:!0,subtree:!1}),Tt(()=>{v.removeEventListener("focusin",b),y.removeEventListener("focusin",b),v.remove(),y.remove(),E.disconnect()})})}a(ree,"createFocusScope");var eM="interactOutside.pointerDownOutside",tM="interactOutside.focusOutside";function oee(t,e){let n,i=RK;const s=a(()=>Eo(e()),"ownerDocument"),r=a(f=>t.onPointerDownOutside?.(f),"onPointerDownOutside"),o=a(f=>t.onFocusOutside?.(f),"onFocusOutside"),l=a(f=>t.onInteractOutside?.(f),"onInteractOutside"),d=a(f=>{const h=f.target;return!(h instanceof HTMLElement)||h.closest(`[${y0}]`)||!ho(s(),h)||ho(e(),h)?!1:!t.shouldExcludeElement?.(h)},"isEventOutside"),c=a(f=>{function h(){const p=e(),g=f.target;if(!p||!g||!d(f))return;const v=f0([r,l]);g.addEventListener(eM,v,{once:!0});const y=new CustomEvent(eM,{bubbles:!1,cancelable:!0,detail:{originalEvent:f,isContextMenu:f.button===2||yK(f)&&f.button===0}});g.dispatchEvent(y)}a(h,"handler"),f.pointerType==="touch"?(s().removeEventListener("click",h),i=h,s().addEventListener("click",h,{once:!0})):h()},"onPointerDown"),u=a(f=>{const h=e(),p=f.target;if(!h||!p||!d(f))return;const g=f0([o,l]);p.addEventListener(tM,g,{once:!0});const v=new CustomEvent(tM,{bubbles:!1,cancelable:!0,detail:{originalEvent:f,isContextMenu:!1}});p.dispatchEvent(v)},"onFocusIn");We(()=>{St(t.isDisabled)||(n=window.setTimeout(()=>{s().addEventListener("pointerdown",c,!0)},0),s().addEventListener("focusin",u,!0),Tt(()=>{window.clearTimeout(n),s().removeEventListener("click",i),s().removeEventListener("pointerdown",c,!0),s().removeEventListener("focusin",u,!0)}))})}a(oee,"createInteractOutside");function aee(t){const e=a(n=>{n.key===h1.Escape&&t.onEscapeKeyDown?.(n)},"handleKeyDown");We(()=>{if(St(t.isDisabled))return;const n=t.ownerDocument?.()??Eo();n.addEventListener("keydown",e),Tt(()=>{n.removeEventListener("keydown",e)})})}a(aee,"createEscapeKeyDown");var mF=Pn();function lee(){return Dn(mF)}a(lee,"useOptionalDismissableLayerContext");function cee(t){let e;const n=lee(),[i,s]=Gn(t,["ref","disableOutsidePointerEvents","excludedElements","onEscapeKeyDown","onPointerDownOutside","onFocusOutside","onInteractOutside","onDismiss","bypassTopMostLayerCheck"]),r=new Set([]),o=a(f=>{r.add(f);const h=n?.registerNestedLayer(f);return()=>{r.delete(f),h?.()}},"registerNestedLayer");
66oee({shouldExcludeElement:a(f=>e?i.excludedElements?.some(h=>ho(h(),f))||[...r].some(h=>ho(h,f)):!1,"shouldExcludeElement"),onPointerDownOutside:a(f=>{!e||rs.isBelowPointerBlockingLayer(e)||!i.bypassTopMostLayerCheck&&!rs.isTopMostLayer(e)||(i.onPointerDownOutside?.(f),i.onInteractOutside?.(f),f.defaultPrevented||i.onDismiss?.())},"onPointerDownOutside"),onFocusOutside:a(f=>{i.onFocusOutside?.(f),i.onInteractOutside?.(f),f.defaultPrevented||i.onDismiss?.()},"onFocusOutside")},()=>e),aee({ownerDocument:()=>Eo(e),onEscapeKeyDown:f=>{!e||!rs.isTopMostLayer(e)||(i.onEscapeKeyDown?.(f),!f.defaultPrevented&&i.onDismiss&&(f.preventDefault(),i.onDismiss()))}}),Or(()=>{if(!e)return;rs.addLayer({node:e,isPointerBlocking:i.disableOutsidePointerEvents,dismiss:i.onDismiss});const f=n?.registerNestedLayer(e);rs.assignPointerEventToLayers(),rs.disableBodyPointerEvents(e),Tt(()=>{e&&(rs.removeLayer(e),f?.(),rs.assignPointerEventToLayers(),rs.restoreBodyPointerEvents(e))})}),We(oi([()=>e,()=>i.disableOutsidePointerEvents],([f,h])=>{if(!f)return;const p=rs.find(f);p&&p.isPointerBlocking!==h&&(p.isPointerBlocking=h,rs.assignPointerEventToLayers()),h&&rs.disableBodyPointerEvents(f),Tt(()=>{rs.restoreBodyPointerEvents(f)})},{defer:!0}));const u={registerNestedLayer:o};return X(mF.Provider,{value:u,get children(){return X(is,Yt({as:"div",ref(f){var h=js(p=>e=p,i.ref);typeof h=="function"&&h(f)}},s))}})}a(cee,"DismissableLayer");function U1(t){const[e,n]=Je(t.defaultValue?.()),i=ht(()=>t.value?.()!==void 0),s=ht(()=>i()?t.value?.():e());return[s,a(o=>{An(()=>{const l=dK(o,s());return Object.is(l,s())||(i()||n(l),t.onChange?.(l)),l})},"setValue")]}a(U1,"createControllableSignal");function vF(t){const[e,n]=U1(t);return[a(()=>e()??!1,"value"),n]}a(vF,"createControllableBooleanSignal");function Obe(t){const[e,n]=U1(t);return[a(()=>e()??[],"value"),n]}a(Obe,"createControllableArraySignal");function dee(t={}){const[e,n]=vF({value:()=>St(t.open),defaultValue:()=>!!St(t.defaultOpen),onChange:o=>t.onOpenChange?.(o)}),i=a(()=>{n(!0)},"open"),s=a(()=>{n(!1)},"close");return{isOpen:e,setIsOpen:n,open:i,close:s,toggle:a(()=>{e()?s():i()},"toggle")}}a(dee,"createDisclosureState");function ml(t){return e=>(t(e),()=>t(void 0))}a(ml,"createRegisterId");var Ei=a(t=>typeof t=="function"?t():t,"access"),O_=a((t,e)=>{if(t.contains(e))return!0;let n=e;for(;n;){if(n===t)return!0;n=n._$host??n.parentElement}return!1},"contains"),hg=new Map,uee=a(t=>{We(()=>{const e=Ei(t.style)??{},n=Ei(t.properties)??[],i={};for(const r in e)i[r]=t.element.style[r];const s=hg.get(t.key);s?s.activeCount++:hg.set(t.key,{activeCount:1,originalStyles:i,properties:n.map(r=>r.key)}),Object.assign(t.element.style,t.style);for(const r of n)t.element.style.setProperty(r.key,r.value);Tt(()=>{const r=hg.get(t.key);if(r){if(r.activeCount!==1){r.activeCount--;return}hg.delete(t.key);for(const[o,l]of Object.entries(r.originalStyles))t.element.style[o]=l;for(const o of r.properties)t.element.style.removeProperty(o);t.element.style.length===0&&t.element.removeAttribute("style"),t.cleanup?.()}})})},"createStyle"),nM=uee,fee=a((t,e)=>{switch(e){case"x":return[t.clientWidth,t.scrollLeft,t.scrollWidth];case"y":return[t.clientHeight,t.scrollTop,t.scrollHeight]}},"getScrollDimensions"),hee=a((t,e)=>{const n=getComputedStyle(t),i=e==="x"?n.overflowX:n.overflowY;return i==="auto"||i==="scroll"||t.tagName==="HTML"&&i==="visible"},"isScrollContainer"),pee=a((t,e,n)=>{const i=e==="x"&&window.getComputedStyle(t).direction==="rtl"?-1:1;let s=t,r=0,o=0,l=!1;do{const[d,c,u]=fee(s,e),f=u-d-i*c;(c!==0||f!==0)&&hee(s,e)&&(r+=f,o+=c),s===(n??document.documentElement)?l=!0:s=s._$host??s.parentElement}while(s&&!l);return[r,o]},"getScrollAtLocation"),[iM,sM]=Je([]),gee=a(t=>iM().indexOf(t)===iM().length-1,"isActive"),mee=a(t=>{const e=Yt({element:null,enabled:!0,hideScrollbar:!0,preventScrollbarShift:!0,preventScrollbarShiftMode:"padding",restoreScrollPosition:!0,allowPinchZoom:!1},t),n=Ap();let i=[0,0],s=null,r=null;We(()=>{Ei(e.enabled)&&(sM(c=>[...c,n]),Tt(()=>{sM(c=>c.filter(u=>u!==n))}))}),We(()=>{if(!Ei(e.enabled)||!Ei(e.hideScrollbar))return;const{body:c}=document,u=window.innerWidth-c.offsetWidth;if(Ei(e.preventScrollbarShift)){const f={overflow:"hidden"},h=[];u>0&&(Ei(e.preventScrollbarShiftMode)==="padding"?f.paddingRight=`calc(${window.getComputedStyle(c).paddingRight} + ${u}px)`:f.marginRight=`calc(${window.getComputedStyle(c).marginRight} + ${u}px)`,h.push({key:"--scrollbar-width",value:`${u}px`}));const p=window.scrollY,g=window.scrollX;nM({key:"prevent-scroll",element:c,style:f,properties:h,cleanup:()=>{Ei(e.restoreScrollPosition)&&u>0&&window.scrollTo(g,p)}})}
66else nM({key:"prevent-scroll",element:c,style:{overflow:"hidden"}})}),We(()=>{!gee(n)||!Ei(e.enabled)||(document.addEventListener("wheel",l,{passive:!1}),document.addEventListener("touchstart",o,{passive:!1}),document.addEventListener("touchmove",d,{passive:!1}),Tt(()=>{document.removeEventListener("wheel",l),document.removeEventListener("touchstart",o),document.removeEventListener("touchmove",d)}))});const o=a(c=>{i=rM(c),s=null,r=null},"logTouchStart"),l=a(c=>{const u=c.target,f=Ei(e.element),h=vee(c),p=Math.abs(h[0])>Math.abs(h[1])?"x":"y",g=p==="x"?h[0]:h[1],v=oM(u,p,g,f);let y;f&&O_(f,u)?y=!v:y=!0,y&&c.cancelable&&c.preventDefault()},"maybePreventWheel"),d=a(c=>{const u=Ei(e.element),f=c.target;let h;if(c.touches.length===2)h=!Ei(e.allowPinchZoom);else{if(s==null||r===null){const p=rM(c).map((v,y)=>i[y]-v),g=Math.abs(p[0])>Math.abs(p[1])?"x":"y";s=g,r=g==="x"?p[0]:p[1]}if(f.type==="range")h=!1;else{const p=oM(f,s,r,u);u&&O_(u,f)?h=!p:h=!0}}h&&c.cancelable&&c.preventDefault()},"maybePreventTouch")},"createPreventScroll"),vee=a(t=>[t.deltaX,t.deltaY],"getDeltaXY"),rM=a(t=>t.changedTouches[0]?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0],"getTouchXY"),oM=a((t,e,n,i)=>{const s=i!==null&&O_(i,t),[r,o]=pee(t,e,s?i:void 0);return!(n>0&&Math.abs(r)<=1||n<0&&Math.abs(o)<1)},"wouldScroll"),yee=mee,bee=yee,Eee=a(t=>{const e=ht(()=>{const o=Ei(t.element);if(o)return getComputedStyle(o)}),n=a(()=>e()?.animationName??"none","getAnimationName"),[i,s]=Je(Ei(t.show)?"present":"hidden");let r="none";return We(o=>{const l=Ei(t.show);return An(()=>{if(o===l)return l;const d=r,c=n();l?s("present"):c==="none"||e()?.display==="none"?s("hidden"):s(o===!0&&d!==c?"hiding":"hidden")}),l}),We(()=>{const o=Ei(t.element);if(!o)return;const l=a(c=>{c.target===o&&(r=n())},"handleAnimationStart"),d=a(c=>{const f=n().includes(c.animationName);c.target===o&&f&&i()==="hiding"&&s("hidden")},"handleAnimationEnd");o.addEventListener("animationstart",l),o.addEventListener("animationcancel",d),o.addEventListener("animationend",d),Tt(()=>{o.removeEventListener("animationstart",l),o.removeEventListener("animationcancel",d),o.removeEventListener("animationend",d)})}),{present:()=>i()==="present"||i()==="hiding",state:i,setState:s}},"createPresence"),_ee=Eee,N_=_ee,wee={};Ty(wee,{CloseButton:()=>bF,Content:()=>EF,Description:()=>_F,Dialog:()=>eo,Overlay:()=>wF,Portal:()=>SF,Root:()=>TF,Title:()=>AF,Trigger:()=>xF});var yF=Pn();function sc(){const t=Dn(yF);if(t===void 0)throw new Error("[kobalte]: `useDialogContext` must be used within a `Dialog` component");return t}a(sc,"useDialogContext");function bF(t){const e=sc(),[n,i]=Gn(t,["aria-label","onClick"]);return X(Ay,Yt({get"aria-label"(){return n["aria-label"]||e.translations().dismiss},onClick:a(r=>{Pr(r,n.onClick),e.close()},"onClick")},i))}a(bF,"DialogCloseButton");function EF(t){let e;const n=sc(),i=mi({id:n.generateId("content")},t),[s,r]=Gn(i,["ref","onOpenAutoFocus","onCloseAutoFocus","onPointerDownOutside","onFocusOutside","onInteractOutside"]);let o=!1,l=!1;const d=a(h=>{s.onPointerDownOutside?.(h),n.modal()&&h.detail.isContextMenu&&h.preventDefault()},"onPointerDownOutside"),c=a(h=>{s.onFocusOutside?.(h),n.modal()&&h.preventDefault()},"onFocusOutside"),u=a(h=>{s.onInteractOutside?.(h),!n.modal()&&(h.defaultPrevented||(o=!0,h.detail.originalEvent.type==="pointerdown"&&(l=!0)),ho(n.triggerRef(),h.target)&&h.preventDefault(),h.detail.originalEvent.type==="focusin"&&l&&h.preventDefault())},"onInteractOutside"),f=a(h=>{s.onCloseAutoFocus?.(h),n.modal()?(h.preventDefault(),no(n.triggerRef())):(h.defaultPrevented||(o||no(n.triggerRef()),h.preventDefault()),o=!1,l=!1)},"onCloseAutoFocus");return iee({isDisabled:()=>!(n.isOpen()&&n.modal()),targets:()=>e?[e]:[]}),bee({element:()=>e??null,enabled:()=>n.contentPresent()&&n.preventScroll()}),ree({trapFocus:()=>n.isOpen()&&n.modal(),onMountAutoFocus:s.onOpenAutoFocus,onUnmountAutoFocus:f},()=>e),We(()=>Tt(n.registerContentId(r.id))),X(sn,{get when(){return n.contentPresent()},get children(){return X(cee,Yt({ref(h){var p=js(g=>{n.setContentRef(g),e=g},s.ref);typeof p=="function"&&p(h)},role:"dialog",tabIndex:-1,get disableOutsidePointerEvents(){return ps(()=>!!n.modal())()&&n.isOpen()},get excludedElements(){return[n.triggerRef]},get"aria-labelledby"(){return n.titleId()},get"aria-describedby"(){return n.descriptionId()},get"data-expanded"(){return n.isOpen()?"":void 0},get"data-closed"(){return n.isOpen()?void 0:""},onPointerDownOutside:d,onFocusOutside:c,onInteractOutside:u,get onDismiss(){return n.close}},r))}})}a(EF,"DialogContent");function _F(t){const e=sc(),n=mi({id:e.generateId("description")},t),[i,s]=Gn(n,["id"]);return We(()=>Tt(e.registerDescriptionId(i.id))),X(is,Yt({as:"p",get id(){return i.id}},s))}a(_F,"DialogDescription");function wF(t){const e=sc(),[n,i]=Gn(t,["ref","style","onPointerDown"]),s=a(r=>{Pr(r,n.onPointerDown),r.target===r.currentTarget&&r.preventDefault()},"onPointerDown");return X(sn,{get when(){return e.overlayPresent()},get children(){return X(is,Yt({as:"div",ref(r){var o=js(e.setOverlayRef,n.ref);typeof o=="function"&&o(r)},get style(){return uN({"pointer-events":"auto"},n.style)},get"data-expanded"(){return e.isOpen()?"":void 0},get"data-closed"(){return e.isOpen()?void 0:""},onPointerDown:s},i))}})}a(wF,"DialogOverlay");function SF(t){const e=sc();return X(sn,{get when(){return e.contentPresent()||e.overlayPresent()},get children(){return X(E8,t)}})}a(SF,"DialogPortal");var aM={dismiss:"Dismiss"};function TF(t){const e=`dialog-${Ap()}
66`,n=mi({id:e,modal:!0,translations:aM},t),[i,s]=Je(),[r,o]=Je(),[l,d]=Je(),[c,u]=Je(),[f,h]=Je(),[p,g]=Je(),v=dee({open:()=>n.open,defaultOpen:()=>n.defaultOpen,onOpenChange:I=>n.onOpenChange?.(I)}),y=a(()=>n.forceMount||v.isOpen(),"shouldMount"),{present:b}=N_({show:y,element:()=>c()??null}),{present:E}=N_({show:y,element:()=>f()??null}),T={translations:()=>n.translations??aM,isOpen:v.isOpen,modal:()=>n.modal??!0,preventScroll:()=>n.preventScroll??T.modal(),contentId:i,titleId:r,descriptionId:l,triggerRef:p,overlayRef:c,setOverlayRef:u,contentRef:f,setContentRef:h,overlayPresent:b,contentPresent:E,close:v.close,toggle:v.toggle,setTriggerRef:g,generateId:fy(()=>n.id),registerContentId:ml(s),registerTitleId:ml(o),registerDescriptionId:ml(d)};return X(yF.Provider,{value:T,get children(){return n.children}})}a(TF,"DialogRoot");function AF(t){const e=sc(),n=mi({id:e.generateId("title")},t),[i,s]=Gn(n,["id"]);return We(()=>Tt(e.registerTitleId(i.id))),X(is,Yt({as:"h2",get id(){return i.id}},s))}a(AF,"DialogTitle");function xF(t){const e=sc(),[n,i]=Gn(t,["ref","onClick"]);return X(Ay,Yt({ref(r){var o=js(e.setTriggerRef,n.ref);typeof o=="function"&&o(r)},"aria-haspopup":"dialog",get"aria-expanded"(){return e.isOpen()},get"aria-controls"(){return ps(()=>!!e.isOpen())()?e.contentId():void 0},get"data-expanded"(){return e.isOpen()?"":void 0},get"data-closed"(){return e.isOpen()?void 0:""},onClick:a(r=>{Pr(r,n.onClick),e.toggle()},"onClick")},i))}a(xF,"DialogTrigger");var eo=Object.assign(TF,{CloseButton:bF,Content:EF,Description:_F,Overlay:wF,Portal:SF,Title:AF,Trigger:xF}),Bb=It("<div>");const See=a(t=>X(eo,{get open(){return t.open},get onOpenChange(){return t.setOpen},preventScroll:!1,get children(){return[X(eo.Trigger,{get class(){return t.triggerClass},get children(){return t.triggerContent}}),X(eo.Portal,{get children(){return[X(eo.Overlay,{get class(){return rr.dialogOverlay}}),(()=>{var e=Bb();return Fe(e,X(eo.Content,{get class(){return`${rr.dialogContent} ${t.noPadding?rr.noPadding:""}`},get children(){return[X(sn,{get when(){return!t.hideHeader},get children(){var n=Bb();return Fe(n,X(eo.Title,{get class(){return rr.dialogTitle},get children(){return t.title}}),null),Fe(n,X(eo.CloseButton,{get class(){return rr.dialogCloseButton},get children(){var i=Bb();return ze(()=>xe(i,rr.excludeIcon)),i}}),null),ze(()=>xe(n,`${rr.dialogHeader} ${t.topAlignedHeader?rr.topAligned:""}`)),n}}),X(eo.Description,{get class(){return rr.dialogDescription},get children(){return t.children}})]}})),ze(()=>xe(e,rr.dialog)),e})()]}})]}}),"AdvancedSearchDialog"),IF=Ys(See);var LF=["id","name","validationState","required","disabled","readOnly"];function RF(t){const e=`form-control-${Ap()}`,n=mi({id:e},t),[i,s]=Je(),[r,o]=Je(),[l,d]=Je(),[c,u]=Je(),f=a((v,y,b)=>{const E=b!=null||i()!=null;return[b,i(),E&&y!=null?v:void 0].filter(Boolean).join(" ")||void 0},"getAriaLabelledBy"),h=a(v=>[l(),c(),v].filter(Boolean).join(" ")||void 0,"getAriaDescribedBy"),p=ht(()=>({"data-valid":St(n.validationState)==="valid"?"":void 0,"data-invalid":St(n.validationState)==="invalid"?"":void 0,"data-required":St(n.required)?"":void 0,"data-disabled":St(n.disabled)?"":void 0,"data-readonly":St(n.readOnly)?"":void 0}));return{formControlContext:{name:()=>St(n.name)??St(n.id),dataset:p,validationState:()=>St(n.validationState),isRequired:()=>St(n.required),isDisabled:()=>St(n.disabled),isReadOnly:()=>St(n.readOnly),labelId:i,fieldId:r,descriptionId:l,errorMessageId:c,getAriaLabelledBy:f,getAriaDescribedBy:h,generateId:fy(()=>St(n.id)),registerLabel:ml(s),registerField:ml(o),registerDescription:ml(d),registerErrorMessage:ml(u)}}}a(RF,"createFormControl");var B1=Pn();function Ga(){const t=Dn(B1);if(t===void 0)throw new Error("[kobalte]: `useFormControlContext` must be used within a `FormControlContext.Provider` component");return t}a(Ga,"useFormControlContext");function $1(t){const e=Ga(),n=mi({id:e.generateId("description")},t);return We(()=>Tt(e.registerDescription(n.id))),X(is,Yt({as:"div"},()=>e.dataset(),n))}a($1,"FormControlDescription");var kF=["id","aria-label","aria-labelledby","aria-describedby"];function MF(t){const e=Ga(),n=mi({id:e.generateId("field")},t);return We(()=>Tt(e.registerField(St(n.id)))),{fieldProps:{id:()=>St(n.id),ariaLabel:()=>St(n["aria-label"]),ariaLabelledBy:()=>e.getAriaLabelledBy(St(n.id),St(n["aria-label"]),St(n["aria-labelledby"])),ariaDescribedBy:()=>e.getAriaDescribedBy(St(n["aria-describedby"]))}}}a(MF,"createFormControlField");function H1(t){let e;const n=Ga(),i=mi({id:n.generateId("label")},t),[s,r]=Gn(i,["ref"]),o=uF(()=>e,()=>"label");return We(()=>Tt(n.registerLabel(r.id))),X(is,Yt({as:"label",ref(l){var d=js(c=>e=c,s.ref);typeof d=="function"&&d(l)},get for(){return ps(()=>o()==="label")()?n.fieldId():void 0}},()=>n.dataset(),r))}
66a(H1,"FormControlLabel");function CF(t,e){We(oi(t,n=>{if(n==null)return;const i=Tee(n);i!=null&&(i.addEventListener("reset",e,{passive:!0}),Tt(()=>{i.removeEventListener("reset",e)}))}))}a(CF,"createFormResetListener");function Tee(t){return Aee(t)?t.form:t.closest("form")}a(Tee,"getClosestForm");function Aee(t){return t.matches("textarea, input, select, button")}a(Aee,"isFormElement");function G1(t){const e=Ga(),n=mi({id:e.generateId("error-message")},t),[i,s]=Gn(n,["forceMount"]),r=a(()=>e.validationState()==="invalid","isInvalid");return We(()=>{r()&&Tt(e.registerErrorMessage(s.id))}),X(sn,{get when(){return i.forceMount||r()},get children(){return X(is,Yt({as:"div"},()=>e.dataset(),s))}})}a(G1,"FormControlErrorMessage");var xee={};Ty(xee,{Description:()=>$1,ErrorMessage:()=>G1,Input:()=>OF,Label:()=>H1,Root:()=>FF,TextArea:()=>UF,TextField:()=>Xu});var PF=Pn();function DF(){const t=Dn(PF);if(t===void 0)throw new Error("[kobalte]: `useTextFieldContext` must be used within a `TextField` component");return t}a(DF,"useTextFieldContext");function OF(t){return X(NF,Yt({type:"text"},t))}a(OF,"TextFieldInput");function NF(t){const e=Ga(),n=DF(),i=mi({id:n.generateId("input")},t),[s,r,o]=Gn(i,["onInput"],kF),{fieldProps:l}=MF(r);return X(is,Yt({as:"input",get id(){return l.id()},get name(){return e.name()},get value(){return n.value()},get required(){return e.isRequired()},get disabled(){return e.isDisabled()},get readonly(){return e.isReadOnly()},get"aria-label"(){return l.ariaLabel()},get"aria-labelledby"(){return l.ariaLabelledBy()},get"aria-describedby"(){return l.ariaDescribedBy()},get"aria-invalid"(){return e.validationState()==="invalid"||void 0},get"aria-required"(){return e.isRequired()||void 0},get"aria-disabled"(){return e.isDisabled()||void 0},get"aria-readonly"(){return e.isReadOnly()||void 0},get onInput(){return f0([s.onInput,n.onInput])}},()=>e.dataset(),o))}a(NF,"TextFieldInputBase");function FF(t){let e;const n=`textfield-${Ap()}`,i=mi({id:n},t),[s,r,o]=Gn(i,["ref","value","defaultValue","onChange"],LF),l=s.value,[d,c]=U1({value:()=>l===void 0?void 0:s.value??"",defaultValue:()=>s.defaultValue,onChange:p=>s.onChange?.(p)}),{formControlContext:u}=RF(r);CF(()=>e,()=>c(s.defaultValue??""));const f=a(p=>{if(u.isReadOnly()||u.isDisabled())return;const g=p.target;c(g.value),g.value=d()??""},"onInput"),h={value:d,generateId:fy(()=>St(r.id)),onInput:f};return X(B1.Provider,{value:u,get children(){return X(PF.Provider,{value:h,get children(){return X(is,Yt({as:"div",ref(p){var g=js(v=>e=v,s.ref);typeof g=="function"&&g(p)},role:"group",get id(){return St(r.id)}},()=>u.dataset(),o))}})}})}a(FF,"TextFieldRoot");function UF(t){let e;const n=DF(),i=mi({id:n.generateId("textarea")},t),[s,r]=Gn(i,["ref","autoResize","submitOnEnter","onKeyPress"]);We(oi([()=>e,()=>s.autoResize,()=>n.value()],([l,d])=>{!l||!d||Iee(l)}));const o=a(l=>{e&&s.submitOnEnter&&l.key==="Enter"&&!l.shiftKey&&e.form&&(e.form.requestSubmit(),l.preventDefault())},"onKeyPress");return X(NF,Yt({as:"textarea",get"aria-multiline"(){return s.submitOnEnter?"false":void 0},get onKeyPress(){return f0([s.onKeyPress,o])},ref(l){var d=js(c=>e=c,s.ref);typeof d=="function"&&d(l)}},r))}a(UF,"TextFieldTextArea");function Iee(t){const e=t.style.alignSelf,n=t.style.overflow;"MozAppearance"in t.style||(t.style.overflow="hidden"),t.style.alignSelf="start",t.style.height="auto",t.style.height=`${t.scrollHeight+(t.offsetHeight-t.clientHeight)}px`,t.style.overflow=n,t.style.alignSelf=e}a(Iee,"adjustHeight");var Xu=Object.assign(FF,{Description:$1,ErrorMessage:G1,Input:OF,Label:H1,TextArea:UF});const Lee=a(t=>{const e=a(()=>{let n=Ta.secondary;return t.shrink&&(n+=` ${Ta.shrunk}`),t.light&&(n+=` ${Ta.light}`),t.noPadding&&(n+=` ${Ta.noPadding}`),n},"klass");return X(xy,{get id(){return t.id},get class(){return e()},get onClick(){return t.onClick},get disabled(){return t.disabled},get type(){return t.type||"button"},get children(){return t.children}})},"ButtonSecondary"),bf=Ys(Lee),Ree=a((t,e,n)=>{const i=a(s=>{const r=JSON.parse(s.data),[o,l,d]=r;e===l&&n(o,l,d)},"listener");return t.addEventListener("message",i),()=>{t.removeEventListener("message",i)}},"subTo"),kee=a((t,e)=>{t.readyState===WebSocket.OPEN&&t.send(e)},"sendMessage"),Mee="2",Cee=a(async(t,e)=>new Promise(async n=>{const i=`check_availability_${Ee}`;let s=setTimeout(()=>{n(!1)},5e3),r=!1;const o=Ree(e,i,(c,u,f)=>{c==="EOSE"&&(o(),e.close(),clearTimeout(s),n(r)),c==="EVENT"&&(r=f?.content===Mee),c==="NOTICE"&&(o(),clearTimeout(s),e.close(),n(!1))}),d={content:JSON.stringify(["is_user",{pubkey:t}]),kind:G.WALLET_NWC_ACTIVE,created_at:Math.ceil(new Date().getTime()/1e3),tags:[]};try{const c=await Nt(d,{isRead:!0});kee(e,JSON.stringify(["REQ",i,{cache:["wallet",{operation_event:c}]}]))}catch{n(!1)}}),"checkPrimalWalletActive"),Pee=a(t=>{let e=decodeURIComponent(t);e.includes("%3A%2F%2F")&&(e=decodeURIComponent(e));const n=e.indexOf("://"),i=e.slice(0,n),s=e.slice(n+3);let r={pubkey:"",relays:[],secret:""};if(i!=="nostr+walletconnect")return r;const[o,l]=s.split("?");r.pubkey=o;const d=new URLSearchParams(l);for(const c of d.entries()){if(c[0]==="relay"){r.relays.push(c[1]);continue}if(c[0]==="secret"){r.secret=c[1];continue}if(c[0]==="lud16"){r.lud16=c[1];continue}}return r},"decodeNWCUri"),Dee=a(async t=>{const e=a(n=>{n.data.type==="NWC_INFO_RESPONSE"&&(kn.removeEventListener("message",e),xi("GOT EVENT: ",n))},"handleNWCInfo");kn.addEventListener("message",e),kn.postMessage({type:"NWC_INFO",nwcData:{nwcConfig:t}})},"sendNWCInfoEvent"),Oee=a(async(t,e)=>{const n={description:"Sync app settings",...t},i={content:JSON.stringify(n),kind:G.Settings,tags:[["d",Zt,Qe.sendSettings]],created_at:Math.floor(new Date().getTime()/1e3)};try{const s=await Nt(i,{isRead:!0});return Ae(JSON.stringify(["REQ",e,{cache:["set_app_settings",{settings_event:s}]}
66])),!0}catch(s){return console.error("Failed to send settings: ",s),!1}},"sendSettings"),Nee=a(async(t,e)=>{const i={content:'{ "description": "Sync app settings" }',kind:G.Settings,tags:[["d",Zt,Qe.getSettings]],created_at:Math.floor(new Date().getTime()/1e3)};try{const s=await Nt(i,{isRead:!0});return Ae(JSON.stringify(["REQ",e,{cache:["get_app_settings",{event_from_user:s}]}])),!0}catch(s){return console.error("Failed to get settings: ",s),!1}},"getSettings"),Fee=a(async t=>{const n={content:JSON.stringify({subkey:"user-home-feeds"}),kind:G.Settings,tags:[["d",Zt,Qe.getHomeSettings]],created_at:Math.floor(new Date().getTime()/1e3)};try{const i=await Nt(n,{isRead:!0});return Ae(JSON.stringify(["REQ",t,{cache:["get_app_subsettings",{event_from_user:i}]}])),!0}catch(i){return console.error("Failed to get home settings: ",i),!1}},"getHomeSettings"),Uee=a(async(t,e)=>{const i={content:JSON.stringify({subkey:"user-home-feeds",settings:e}),kind:G.Settings,tags:[["d",Zt,Qe.setHomeSettings]],created_at:Math.floor(new Date().getTime()/1e3)};try{const s=await Nt(i,{isRead:!0});return Ae(JSON.stringify(["REQ",t,{cache:["set_app_subsettings",{event_from_user:s}]}])),!0}catch(s){return console.error("Failed to set settings: ",s),!1}},"setHomeSettings"),Bee=a(async t=>{const n={content:JSON.stringify({subkey:"user-reads-feeds"}),kind:G.Settings,tags:[["d",Zt,Qe.getReadsSettings]],created_at:Math.floor(new Date().getTime()/1e3)};try{const i=await Nt(n,{isRead:!0});return Ae(JSON.stringify(["REQ",t,{cache:["get_app_subsettings",{event_from_user:i}]}])),!0}catch(i){return console.error("Failed to get reads settings: ",i),!1}},"getReadsSettings"),$ee=a(async(t,e)=>{const i={content:JSON.stringify({subkey:"user-reads-feeds",settings:e}),kind:G.Settings,tags:[["d",Zt,Qe.setReadsSettings]],created_at:Math.floor(new Date().getTime()/1e3)};try{const s=await Nt(i,{isRead:!0});return Ae(JSON.stringify(["REQ",t,{cache:["set_app_subsettings",{event_from_user:s}]}])),!0}catch(s){return console.error("Failed to set settings: ",s),!1}},"setReadsSettings"),lM=a(async t=>{Ae(JSON.stringify(["REQ",t,{cache:["get_default_app_settings",{client:"Primal-Web App"}]}]))},"getDefaultSettings"),Hee=a(async t=>{const n={content:JSON.stringify({subkey:"user-nwc"}),kind:G.Settings,tags:[["d",Zt,Qe.getNWCSettings]],created_at:Math.floor(new Date().getTime()/1e3)};try{const i=await Nt(n,{isRead:!0});return Ae(JSON.stringify(["REQ",t,{cache:["get_app_subsettings",{event_from_user:i}]}])),!0}catch(i){return console.error("Failed to get nwc settings: ",i),!1}},"getNWCSettings"),Gee=a(async(t,e)=>{const i={content:JSON.stringify({subkey:"user-nwc",settings:{...e}}),kind:G.Settings,tags:[["d",Zt,Qe.setNWCSettings]],created_at:Math.floor(new Date().getTime()/1e3)};try{const s=await Nt(i,{isRead:!0});return Ae(JSON.stringify(["REQ",t,{cache:["set_app_subsettings",{event_from_user:s}]}])),!0}catch(s){return console.error("Failed to set settings: ",s),!1}},"setNWCSettings");var $b=It("<div>"),Vee=It("<div><div><div>To enable zapping from the Primal web app, connect a wallet:</div></div><div><div>"),Wee=It("<div>Enter Nostr Wallet Connect String:");const BF=a(async(t,e)=>{if(!z.publicKey)return;const n=z.nwcList.findIndex(r=>r[0]===t);let i=encodeURIComponent(e);const s=await Z1(z.publicKey,i);if(n>-1){pM([t,s],n),jf(z.publicKey,z.nwcList),Wl();return}pM([t,s]),jf(z.publicKey,z.nwcList),Wl()},"addNWC"),$F=a(t=>{z?.publicKey&&(j1(z.nwcList.filter(e=>e[0]!==t)),Up([]),jf(z.publicKey,z.nwcList),Pp(z.publicKey),Wl())},"removeNWC"),HF=a(t=>{z?.publicKey&&(j1([]),Up([]),jf(z.publicKey,z.nwcList),Pp(z.publicKey),t&&Wl())},"clearNWC"),Wl=a(()=>{const t=`update_nwc_settings_${Ee}`,e=Me(t,{onEose:()=>{e()}});Gee(t,{nwcList:z.nwcList||[],nwcActive:z.activeNWC||[]})},"updateNWCSettings"),F_=a(async(t,e,n)=>{const i=z.publicKey;if(!i)return;let s=`${e}`;if(!s.startsWith("nostr+walletconnect"))try{s=await oU(i,s)}catch{s=""}s=encodeURIComponent(s);const r=await Z1(i,s),o=w_(i);o&&o.length>0&&o[0]!==t&&n?.(o[0],"active"),Pp(i,t,r),Up([t,r]),n?.(t,"connected");const l=Pee(s);Dee(l),Wl()},"connectToNWCWallet"),zee=a(()=>
66{const t=_y(),[e,n]=Je(!1),[i,s]=Je(""),[r,o]=Je(""),[l,d]=li({primal:"inactive"});We(()=>{if(!z.publicKey)return;const g=Mq(z.publicKey);j1(g);const v=w_(z.publicKey);v&&v.length>0&&c(v)}),We(()=>{z.publicKey&&u(z.publicKey)});const c=a(g=>{const v=z.publicKey;if(!v)return;const[y,b]=g,E=w_(v);E&&E.length>0&&E[0]!==y&&d(E[0],"active"),d(y,()=>"connected")},"applyActiveWallet"),u=a(g=>{const v=new WebSocket("wss://wallet.primal.net/v1");v.addEventListener("open",async()=>{xi("WALLET SOCKET OPENED");const y=await Cee(g,v);l.primal!=="connected"&&(y?d("primal",()=>"active"):d("primal",()=>"inactive"))}),v.addEventListener("close",()=>{xi("WALLET SOCKET CLOSED")})},"checkActiveWallet"),f=a((g,v)=>{d(g,v)},"updateStatus"),h=a(g=>{z?.publicKey&&(d(g,()=>"active"),Up([]),Pp(z.publicKey),Wl())},"disconnectNWC"),p=a(()=>{s(()=>""),o(()=>"")},"clearNewNWC");return(()=>{var g=Vee(),v=g.firstChild,y=v.firstChild,b=v.nextSibling,E=b.firstChild;return Fe(g,X(cF,{get title(){return`${t.formatMessage(Ki.nwcSettings.title)} ${t.formatMessage(Ki.title)}`}}),v),Fe(g,X(XN,{get children(){return[X(v0,{href:"/settings",get children(){return t.formatMessage(Ki.index.title)}}),": ",(()=>{var T=$b();return Fe(T,()=>t.formatMessage(Ki.nwcSettings.title)),T})()]}}),v),Fe(E,X(UE,{get each(){return z.nwcList},children:([T,I])=>X(Qk,{logo:T===Y9?dF:C_,name:T,desc:"Nostr Wallet Connect",get status(){return l[T]||"active"},onConnect:()=>F_(T,I,f),onRemove:()=>$F(T),onDisconnect:()=>h(T)})}),null),Fe(E,X(Qk,{logo:C_,name:"Nostr Wallet Connect",desc:"Connect an external wallet that supports NWC",status:"none",onConnect:()=>n(!0)}),null),Fe(g,X(IF,{get open(){return e()},setOpen:T=>{n(T)},triggerClass:"hidden",get title(){return Wee()},get children(){return[(()=>{var T=$b();return Fe(T,X(Xu,{get class(){return mt.nwcInput},get value(){return r()},onChange:I=>o(I),get children(){return X(Xu.Input,{placeholder:"wallet name"})}}),null),Fe(T,X(Xu,{get class(){return mt.nwcTextArea},get value(){return i()},onChange:I=>s(I),get children(){return X(Xu.TextArea,{autoResize:!0,autofocus:!0,placeholder:"nostr+walletconnect://[pubkey]?relay=[relay]&secret=[secret]"})}}),null),ze(()=>xe(T,mt.nwcInputs)),T})(),(()=>{var T=$b();return Fe(T,X(bf,{onClick:()=>{p(),n(!1)},children:"Cancel"}),null),Fe(T,X(N1,{onClick:()=>{F_(r(),i(),f),BF(r(),i()),p(),n(!1)},get disabled(){return i().length===0},children:"Connect"}),null),ze(()=>xe(T,mt.nwcInputActions)),T})()]}}),null),ze(T=>{var I=mt.settingsContent,M=mt.moderationDescription,H=mt.settingsContentFullBorderless,N=mt.walletList;return I!==T.e&&xe(v,T.e=I),M!==T.t&&xe(y,T.t=M),H!==T.a&&xe(b,T.a=H),N!==T.o&&xe(E,T.o=N),T},{e:void 0,t:void 0,a:void 0,o:void 0}),g})()},"NostrWalletConnect$1"),Kee=Object.freeze(Object.defineProperty({__proto__:null,addNWC:BF,clearNWC:HF,connectToNWCWallet:F_,default:zee,removeNWC:$F,updateNWCSettings:Wl},Symbol.toStringTag,{value:"Module"})),b0=a(t=>t.length<26?t:`${t.slice(0,15)}..${t.slice(-10)}`,"truncateNpub"),dt=a((t,e,n)=>{if(!t)return Op(e);let i={};try{i=JSON.parse(t.content||"{}")}catch(s){Tn("Error in user meta JSON: ",s),i={}}return{id:t.id,pubkey:t.pubkey,tags:t.tags,npub:Ii(t.pubkey),name:i.name||"",about:i.about||"",picture:i.picture||"",nip05:i.nip05||"",banner:i.banner||"",displayName:i.display_name||"",location:i.location||"",lud06:i.lud06||"",lud16:i.lud16||"",website:i.website||"",msg:{...t},userStats:n?{...n[t.pubkey]}:void 0}},"convertToUser"),Op=a(t=>({id:"",pubkey:t,tags:[],npub:Ii(t),name:"",about:"",picture:"",nip05:"",banner:"",displayName:"",location:"",lud06:"",lud16:"",website:"",msg:{kind:G.Metadata,content:"",id:"",pubkey:t,sig:"",tags:[]}}),"emptyUser"),qee=a((t,e)=>{if(!t)return e?Ii(e):"";const n=t.npub||Ii(t.pubkey)||"",i=t.display_name||t.displayName||t.name||b0(n);return i||b0(Ii(t.pubkey)||"")},"userName$1"),Nbe=a(t=>{if(!t)return"";const e=t.npub||Ii(t.pubkey)||"",n=t.display_name||t.displayName||t.name||b0(e);return n||b0(Ii(t.pubkey)||"")},"authorName"),Fbe=a(t=>!t||typeof t.nip05!="string"?"":t.nip05?.startsWith("_@")?t.nip05.slice(2):t.nip05,"nip05Verification"),jee=["extension","local","npub","guest","nip46","none"];let U_=[],sa;const Yee={loginType:"none",likes:[],defaultRelays:[],activeRelays:[],relaySettings:{},publicKey:void 0,activeUser:void 0,showNewNoteForm:!1,following:[],followingSince:0,followInProgress:"",muted:[],mutedTags:[],mutedPrivate:"",mutedSince:0,streamMuted:[],streamMutedTags:[],streamMutedPrivate:"",streamMutedSince:0,isKeyLookupDone:!1,quotedNote:void 0,connectToPrimaryRelays:!0,contactsTags:[],contactsContent:"",mutelists:[],mutelistSince:0,allowlist:[],allowlistSince:0,sec:void 0,showPin:"",showForgot:!1,showGettingStarted:!1,showLogin:!1,showCreateAccount:!1,showMissingNWC:!1,emojiHistory:[],membershipStatus:{},bookmarks:[],proxyThroughPrimal:!1,proxySettingSet:!1,premiumReminder:!1,activeNWC:[],nwcList:[],blossomServers:[],mirrorBlossom:!1,followData:{tags:[],date:0,relayInfo:"",openDialog:!1,following:[]},eventQueue:[],eventQueueRetry:16,sendErrors:{},signerTimeout:!1,showConfirmDialog:!1,confirmDialogInfo:void 0,showSignerUnreachableDialog:!1,signerUnreachableDialogInfo:void 0,resetReactionStates:!1},Zee=a(t=>{re("signerUnreachableDialogInfo",Si({...t})),re("showSignerUnreachableDialog",()=>!0)},"openSignerUnreachableDialog"),Hb=a(()=>{re("showSignerUnreachableDialog",()=>!1)},"closeSignerUnreachableDialog"),GF=a((t,e=z.eventQueue)=>e.findIndex(i=>{if(i.id===t.id)return!0;
66if(t.kind===G.Settings){const s=i.tags.find(o=>o[0]==="d"),r=t.tags.find(o=>o[0]==="d");return i.kind===t.kind&&i.content===t.content&&(s&&r?s[1]===r[1]:!0)}return!1}),"eventInQueueIndex"),Qee=new Set([Qe.getSettings,Qe.getHomeSettings,Qe.getReadsSettings,Qe.getNWCSettings,Qe.sendSettings,Qe.setHomeSettings,Qe.setReadsSettings,Qe.setNWCSettings,Qe.getMembershipStatus,Qe.getPremiumQRCode,Qe.getLegendQRCode,Qe.getPremiumStatus,Qe.getPremiumMediaStats,Qe.getPremiumMediaList,Qe.getContactListHistory,Qe.getContentDownloadData,Qe.getContentListHistory,Qe.startListeningForContentBroadcastStaus,Qe.getOrderListHistory,Qe.initStripe,Qe.resolveStripe,Qe.resetDirectMessages,Qe.markAllAsRead,Qe.nofiticationsLastSeen]),Jee=a(t=>{if(t.kind!==G.Settings)return!1;const e=t.tags.find(n=>n[0]==="d");return!!e&&Qee.has(e[2])},"isReadQueuedEvent"),VF=a(t=>{const e=z.publicKey;if(!e)return;const n=GF(t);if(n>-1){re("eventQueue",i=>[...i.slice(0,n),{...t},...i.slice(n+1)]),Ur(e,z.eventQueue);return}z.eventQueue.length===0&&Np(),re("eventQueue",z.eventQueue.length,()=>({...t})),Ur(e,z.eventQueue)},"enqueEvent"),WF=a(t=>{const e=z.publicKey;if(!z.eventQueue.find(s=>s.id===t.id)||!e)return;const i=z.eventQueue.filter(s=>s.id!==t.id);re("eventQueue",()=>[...i]),Ur(e,z.eventQueue)},"dequeEvent"),Ube=a(t=>{const e=z.publicKey,n=t.map(s=>s.id);z.eventQueue.filter(s=>n.includes(s.id)).length===0||!e||(re("eventQueue",s=>s.filter(r=>!n.includes(r.id))),Ur(e,z.eventQueue))},"dequeEvents");let Ef={},Zf=new Set;const cM=a(t=>Zf.has(t)?(Zf.delete(t),!0):!1,"consumeAbortedEvent"),Xee=a((t,e,n)=>{const i=z.publicKey,s={...t,id:e,pubkey:i};if(!i)return;n&&(Ef[e]=n);const r=GF(s);if(r>-1){re("eventQueue",o=>[...o.slice(0,r),{...s},...o.slice(r+1)]),Ur(i,z.eventQueue);return}z.eventQueue.length===0&&Np(),re("eventQueue",z.eventQueue.length,()=>({...s})),Ur(i,z.eventQueue)},"enqueUnsignedEvent"),dM=a((t,e)=>{delete Ef[e],Zf.delete(e);const n=z.publicKey;if(!z.eventQueue.find(r=>r.id===e)||!n)return;const s=z.eventQueue.filter(r=>r.id!==e);re("eventQueue",()=>s),Ur(n,z.eventQueue)},"dequeUnsignedEvent"),uM=a(()=>{const t=z.publicKey;z.eventQueue.forEach(e=>{e.id&&Zf.add(e.id)}),Object.keys(Ef).forEach(e=>Zf.add(e)),Object.values(Ef).forEach(e=>{try{e()}catch(n){ii("Failed to revert optimistic effect on abort: ",n)}}),Ef={},clearInterval(E0),re("eventQueueRetry",()=>0),re("eventQueue",()=>[]),t&&Ur(t,z.eventQueue)},"abortAllPendingEvents");let E0=0;const ete=a(async(t,e)=>{let n=[...t],i=[];for(;n.length>0;){const s=n[0];try{await e(s),i.push(s),n.shift()}catch(r){ii("Failed to send item from queue: ",r);break}}return[...i]},"processArrayUntilFailure"),zF=a(async()=>{const t=z.publicKey;if(!t)return;clearInterval(E0);let e=Pt(z.eventQueue);if(e.length===0)return;const i=(await ete([...e],r=>new Promise(async(o,l)=>{if(!r.sig)try{const c=await Nt(r);c&&(r={...c})}catch{l("relay_sign_timeout");return}let d=setTimeout(()=>{l("relay_send_timeout")},8e3);dU(r,{success:()=>{clearTimeout(d),o()}})}))).map(r=>r.id),s=z.eventQueue.filter(r=>!i.includes(r.id));re("eventQueue",()=>[...s]),Ur(t,z.eventQueue),Np()},"refreshQueue"),Np=a(()=>{if(!z.publicKey)return;clearInterval(E0);let e=16;E0=setInterval(()=>{e===0&&(e=16),e--,re("eventQueueRetry",()=>e)},1e3)},"startEventQueueMonitor"),KF=a(()=>{const t=a(e=>{e.data==="RELAYS_CLOSED"&&(kn.removeEventListener("message",t),re("activeRelays",()=>[]))},"handleClosed");kn.addEventListener("message",t),kn.postMessage({type:"CLOSE_RELAYS",relays:[...z.activeRelays]})},"suspendRelays"),qF=a(async()=>{await Fp(z.relaySettings)},"reconnectSuspendedRelays"),fM=a(async t=>{re("proxyThroughPrimal",()=>t),z.proxySettingSet||re("proxySettingSet",()=>!0),t?KF():qF()},"setProxyThroughPrimal"),V1=a(async t=>{if(t!==z.publicKey)return;const e=`user_profile_${Ee}`,{users:n}=await gle([t],e),i=n[0]||Op(t);re("activeUser",()=>({...i})),Sq(i)},"updateAccountProfile"),tte=a(t=>{sa=new WebSocket("wss://wallet.primal.net/v1"),sa.addEventListener("close",()=>{xi("MEMBERSHIP SOCKET CLOSED")}),sa.addEventListener("open",()=>{xi("MEMBERSHIP SOCKET OPENED"),t()})},"openMembershipSocket"),nte=a(()=>{tte(()=>{if(!sa||sa.readyState!==WebSocket.OPEN)return;const t=`ps_${Ee}`;let e=!1;const n=Jv(sa,t,(i,s,r)=>{if(i==="EVENT"){const o=JSON.parse(r?.content||"{}");e=!0,re("membershipStatus",()=>({...o})),Pq(z.publicKey,o)}i==="EOSE"&&(n(),sa?.close(),e||re("membershipStatus",()=>({tier:"none"})),jF())});oq(z.publicKey,t,sa)})},"checkMembershipStatus"),jF=a(()=>
66{if(["premium","premium-legend"].includes(z.membershipStatus.tier||"")){re("premiumReminder",()=>!1);return}const t=new Date().getTime(),e=_q(z.publicKey)||0;t-e>dO&&re("premiumReminder",()=>!0)},"checkPremiumRemider"),Bbe=a(()=>{const t=new Date().getTime();re("premiumReminder",()=>!1),Eq(z.publicKey,t),setTimeout(()=>{jF()},dO)},"clearPremiumRemider"),$be=a(()=>{re("showGettingStarted",()=>!0)},"showGetStarted"),Hbe=a(()=>{re("showMissingNWC",()=>!0)},"showMissingNWC"),Gbe=a(()=>{re("showLogin",()=>!0)},"showLogin"),Vbe=a(()=>{re("showCreateAccount",()=>!0)},"showCreateAccount"),YF=a(()=>{re("sec",()=>{}),wq(),So(void 0),re("eventQueue",()=>[]),localStorage.removeItem("bunkerUrl"),localStorage.removeItem("clientConnectionUrl"),localStorage.removeItem("appNsec"),localStorage.removeItem("appPubkey"),HF(),Lr("guest"),re("resetReactionStates",!0),setTimeout(()=>{re("resetReactionStates",!1)},10)},"logout"),ite=a((t,e)=>{if(!t){YF();return}const n=Ce.decode(t);if(n.type==="nsec"&&n.data){re("sec",()=>t);const i=nc(n.data);(i!==z.publicKey||e)&&So(i);const s=T1(i);s&&re("activeUser",()=>({...s})),V1(i)}},"setSec"),So=a(t=>{t&&t.length>0?(re("publicKey",()=>t),localStorage.setItem("pubkey",t)):(re("publicKey",()=>{}),localStorage.removeItem("pubkey"))},"setPublicKey"),Ma=a(()=>!!z.publicKey,"hasPublicKey"),Wbe=a(t=>{const e=t.reduce((n,i)=>({...n,[i.url]:{write:!0,read:!0}}),{});Qf({...e},!0),Fp({...e})},"resetRelays"),Qf=a((t,e)=>{let n={...t};if(Object.keys(n).length===0&&(n=W1(n)),e){let r=new Set;for(let l in z.relaySettings)n[l]||(re("relaySettings",()=>({[l]:void 0})),r.add(l));const o=a(l=>{if(l.data!=="RELAYS_CLOSED")return;kn.removeEventListener("message",o);const d=z.activeRelays.filter(c=>!r.has(c));re("activeRelays",()=>d),re("relaySettings",()=>({...n})),Fp(n),__(z.publicKey,n)},"handleClosed");kn.addEventListener("message",o),kn.postMessage({type:"CLOSE_RELAYS",relays:Array.from(r)})}const i=z.relaySettings;let s=Object.keys(n).reduce((r,o)=>i[o]?r:{...r,[o]:n[o]},i);return Object.keys(s).length===0||(re("relaySettings",()=>({...s})),__(z.publicKey,s)),!0},"setRelaySettings"),W1=a(t=>{const e=IN();return{...t,...e}},"attachDefaultRelays"),ste=a(t=>{const e=IN(),n=Object.keys(e),i={};for(let s=0;s<n.length;s++){const r=n[s];t[r]||(i[r]={read:!0,write:!0})}return{...i}},"detachDefaultRelays"),zbe=a(t=>{re("connectToPrimaryRelays",()=>t),dq(z.publicKey,t);let e=z.relaySettings;return t?e=W1(e):e=ste(e),e},"setConnectToPrimaryRelays");let Gb;const Fp=a(async(t,e)=>{if(z.proxyThroughPrimal)return;const n=Object.keys(t);if(n.length===0){const s=`default_relays_${Ee}`;fi(s,()=>jq(s),bte);return}Gb&&kn.removeEventListener("message",Gb);const i=a(s=>{const{type:r,relay:o}=s.data;r!=="RELAY_OPENED"||!o||z.activeRelays.find(l=>l===o)||re("activeRelays",z.activeRelays.length,()=>o)},"handleOpened");Gb=i,kn.addEventListener("message",i),kn.postMessage({type:"OPEN_RELAYS",relays:[...n]})},"connectToRelays"),Iy=a(t=>{re("showPin",()=>t)},"setShowPin"),Kbe=a(()=>{re("showNewNoteForm",()=>!0)},"showNewNoteForm"),qbe=a(()=>{re("showNewNoteForm",()=>!1)},"hideNewNoteForm"),jbe=a(async(t,e)=>{if(z.likes.includes(t.id))return!1;const n=a(()=>{re("likes",s=>s.filter(r=>r!==t.id)),Ik(z.publicKey,z.likes),e&&e()},"revert"),{success:i}=await Jte(t,{onAbort:n});return i&&(re("likes",s=>[...s,t.id]),Ik(z.publicKey,z.likes)),i},"addLike"),Ybe=a(t=>{const e=c0.normalizeURL(t);if(z.relaySettings[e])return;const n={...z.relaySettings,[e]:{write:!0,read:!0}};Qf(n),U_=U_.filter(s=>s!==t);const i=Me(`before_add_relay_${Ee}`,{onEvent:(s,r)=>{const o=JSON.parse(r?.content||"{}"),l={...z.relaySettings,...o};Qf(l,!0)},onEose:()=>{AN(z.relaySettings),i()}});by(z.publicKey,`before_add_relay_${Ee}`)},"addRelay"),Zbe=a(t=>{const e=c0.normalizeURL(t),n=a(i=>{if(i.data!=="RELAYS_CLOSED")return;kn.removeEventListener("message",n);const s=z.activeRelays.filter(l=>l!==e);re("activeRelays",()=>s);const r=Object.keys(z.relaySettings).reduce((l,d)=>{const c=c0.normalizeURL(d);return c===e?{...l}:{...l,[c]:z.relaySettings[c]}},{});re("relaySettings",Si(r)),U_.push(e),__(z.publicKey,z.relaySettings);const o=Me(`before_remove_relay_${Ee}`,{onEvent:(l,d)=>{let c=JSON.parse(d?.content||"{}");delete c[t];const u={...z.relaySettings,...c};Qf(u,!0)},onEose:()=>{AN(z.relaySettings),o()}});by(z.publicKey,`before_remove_relay_${Ee}`)},"handleClosed");kn.addEventListener("message",n),kn.postMessage({type:"CLOSE_RELAYS",relays:[e]})},"removeRelay"),rte=a(t=>{const e=t.created_at,n=t.tags,i=t.content,s=n.reduce((r,o)=>o[0]==="p"?[...r,o[1]]:r,[]);re("following",()=>s),re("followingSince",()=>
66e||0),re("contactsTags",()=>[...n]),re("contactsContent",()=>i),S1(z.publicKey,s,e||0)},"updateContacts"),ZF=a(t=>{if(t.created_at&&t.created_at<z.followingSince){const n=Be(z.publicKey);return{following:n.following,created_at:n.followingSince||0,tags:z.contactsTags,content:z.contactsContent}}return{following:t.tags.reduce((n,i)=>i[0]==="p"?[...n,i[1]]:n,[]),created_at:t.created_at||0,tags:t.tags,content:t.content}},"extractContacts"),z1=a(t=>{const e=t.created_at,n=t.tags;if(t.kind===G.CategorizedPeople&&n.find(s=>s[0]==="d"&&s[1]==="mute"))return;const i=n.reduce((s,r)=>{if(r[0]!=="p")return s;const o=r[1];return z.muted.includes(o)?s:[...s,o]},[]);re("mutedTags",()=>[...n]),re("muted",s=>[...s,...i]),re("mutedPrivate",()=>t.content),re("mutedSince",()=>e||0),bN(z.publicKey,i,t.content,e||0)},"updateMuted"),K1=a(t=>{const e=t.created_at,n=t.tags,i=n.reduce((s,r)=>{if(r[0]!=="p")return s;const o=r[1];return z.muted.includes(o)?s:[...s,o]},[]);re("streamMutedTags",()=>[...n]),re("streamMuted",s=>[...s,...i]),re("streamMutedPrivate",()=>t.content),re("streamMutedSince",()=>e||0),bN(z.publicKey,i,t.content,e||0)},"updateStreamMuted"),B_=a(async(t,e,n,i,s,r,o)=>{const{success:l,note:d}=await lU(i,n,s,{onAbort:o});l&&d&&(re("following",()=>e),re("followingSince",()=>n),re("contactsTags",()=>[...i]),re("contactsContent",()=>s),S1(z.publicKey,e,n),Bp([d],`import_follow_contacts_${Ee}`,()=>{r&&r(!1,t)}))},"resolveContacts"),Qbe=a(async(t,e,n,i)=>{const{success:s,note:r}=await lU(e,t,n);if(s&&r){const o=r.tags.reduce((l,d)=>d[0]==="p"?[...l,d[1]]:l,[]);re("following",()=>o),re("followingSince",()=>t),re("contactsTags",()=>[...e]),re("contactsContent",()=>n),S1(z.publicKey,o,t),Bp([r],`import_follow_contacts_${Ee}`,()=>{i&&i(!1,z.publicKey)})}},"replaceContactList"),Jbe=a((t,e)=>{if(!z.publicKey||z.following.includes(t))return;re("followInProgress",()=>t);const n=a(()=>{re("following",o=>o.filter(l=>l!==t)),re("followInProgress",()=>"")},"revertFollow");let i={content:"",created_at:0,tags:[],following:[]},s=[];const r=Me(`before_follow_${Ee}`,{onEvent:(o,l)=>{if(!(!l||l.kind!==G.Contacts)&&(s.push(l),xi("FOLLOW DATE CONTENT: ",l.created_at),xi("FOLLOW DATE STORE: ",z.followingSince),xi("FOLLOW DATE DIFF: ",(l.created_at||0)-z.followingSince),i=ZF(l),ii("FOLLOW DATA PRE CHANGE: ",i),!i.following.includes(t))){const d=i.content,c=Math.floor(new Date().getTime()/1e3),u=i.tags;let f=[...i.following];f.includes(t)||f.push(t);const h=[...u,["p",t]];f.length<2||h.length<2?(ii("FOLLOW ISSUE: ",`before_follow_${Ee}`),ii("FOLLOW CONTENT: ",s),ii("FOLLOW DATA: ",i),re("followData",()=>({openDialog:!0,date:c,tags:h,relayInfo:d,following:f}))):B_(t,f,c,h,d,e,n)}},onEose:()=>{if(z.following.filter(o=>o!==t).length===0){const o=Math.floor(new Date().getTime()/1e3);B_(t,[t],o,[["p",t]],z.activeRelays[0],e,n)}re("followInProgress",()=>""),r()}});re("following",z.following.length,()=>t),vy(z.publicKey,`before_follow_${Ee}`)},"addFollow"),Xbe=a((t,e)=>{if(!z.publicKey||!z.following.includes(t)||z.publicKey===t)return;re("followInProgress",()=>t);const n=a(()=>{re("following",o=>o.includes(t)?o:[...o,t]),re("followInProgress",()=>"")},"revertUnfollow");let i={content:"",created_at:0,tags:[],following:[]},s=[];const r=Me(`before_unfollow_${Ee}`,{onEvent:(o,l)=>{if(!(!l||l.kind!==G.Contacts)&&(s.push(l),xi("FOLLOW DATE CONTENT: ",l.created_at),xi("FOLLOW DATE STORE: ",z.followingSince),xi("FOLLOW DATE DIFF: ",(l.created_at||0)-z.followingSince),i=ZF(l),ii("FOLLOW DATA PRE CHANGE: ",i),i.following.includes(t))){const d=i.content,c=Math.floor(new Date().getTime()/1e3),u=i.tags,f=i.following.filter(p=>p!==t),h=u.filter(p=>p[0]!=="p"||p[1]!==t);f.length<2||h.length<2?(ii("FOLLOW ISSUE: ",`before_unfollow_${Ee}`),ii("FOLLOW CONTENT: ",s),ii("FOLLOW DATA: ",i),re("followData",()=>({openDialog:!0,date:c,tags:h,relayInfo:d,following:f}))):B_(t,f,c,h,d,e,n)}},onEose:()=>{re("followInProgress",()=>""),r()}});re("following",o=>o.filter(l=>l!==t)),vy(z.publicKey,`before_unfollow_${Ee}`)},"removeFollow"),eEe=a(t=>{re("quotedNote",()=>t)},"quoteNote"),tEe=a((t,e,n)=>{if(!z.publicKey)return;if(!z.sec||z.sec.length===0){const l=$a();if(l){Iy(l);return}}const i=e||"user",s=`before_mute_${Ee}`,r=a(()=>{const l={word:"word",hashtag:"t",thread:"e"};if(i==="user")re("muted",d=>d.filter(c=>c!==t)),re("mutedTags",d=>d.filter(c=>!(c[0]==="p"&&c[1]===t))),m0(z.publicKey,z.muted,z.mutedSince);else{const d=l[i];re("mutedTags",c=>c.filter(u=>!(u[0]===d&&u[1]===t)))}},"revertMute"),o=Me(s,{onEvent:(l,d)=>{d&&(d.kind===G.MuteList||d.kind===G.CategorizedPeople)&&d.created_at&&d.created_at>z.mutedSince&&z1(d)},onEose:async()=>
66{if(o(),i==="user"){const l=Math.floor(new Date().getTime()/1e3),d=[...Pt(z.muted),t],c=[...Pt(z.mutedTags),["p",t]],{success:u,note:f}=await T0(c,l,z.mutedPrivate,{onAbort:r});u&&(re("muted",()=>d),re("mutedTags",()=>c),re("mutedSince",()=>l),m0(z.publicKey,d,l)),n&&n(u)}if(["word","hashtag","thread"].includes(i)){const l=Math.floor(new Date().getTime()/1e3),d={word:"word",hashtag:"t",thread:"e"},c=[...Pt(z.mutedTags),[d[i],t]],{success:u,note:f}=await T0(c,l,z.mutedPrivate,{onAbort:r});u&&(re("mutedTags",()=>c),re("mutedSince",()=>l)),n&&n(u)}}});if(i==="user"&&!z.muted.includes(t)){const l=[...Pt(z.muted),t],d=[...Pt(z.mutedTags),["p",t]];re("muted",()=>l),re("mutedTags",()=>d)}if(["word","hashtag","thread"].includes(i)){const l={word:"word",hashtag:"t",thread:"e"},d=[...Pt(z.mutedTags),[l[i],t]];re("mutedTags",()=>d)}x1(z.publicKey,s)},"addToMuteList"),nEe=a((t,e,n)=>{if(!z.publicKey)return;if(!z.sec||z.sec.length===0){const o=$a();if(o){Iy(o);return}}const i=e||"user",s=a(()=>{const o={word:"word",hashtag:"t",thread:"e"};if(i==="user")re("muted",l=>l.includes(t)?l:[...l,t]),re("mutedTags",l=>l.some(d=>d[0]==="p"&&d[1]===t)?l:[...l,["p",t]]),m0(z.publicKey,z.muted,z.mutedSince);else{const l=o[i];re("mutedTags",d=>d.some(c=>c[0]===l&&c[1]===t)?d:[...d,[l,t]])}},"revertUnmute"),r=Me(`before_unmute_${Ee}`,{onEvent:(o,l)=>{l&&[G.MuteList,G.CategorizedPeople].includes(l.kind)&&l.created_at&&l.created_at>z.followingSince&&z1(l)},onEose:async()=>{if(r(),i==="user"){const o=Math.floor(new Date().getTime()/1e3),l=Pt(z.muted).filter(f=>f!==t),d=Pt(z.mutedTags).filter(f=>f[0]!=="p"||f[1]!==t),{success:c,note:u}=await T0(d,o,z.mutedPrivate,{onAbort:s});c&&(re("muted",()=>l),re("mutedTags",()=>d),re("mutedSince",()=>o),m0(z.publicKey,l,o)),n&&n(c)}if(["word","hashtag","thread"].includes(i)){const o=Math.floor(new Date().getTime()/1e3),l={word:"word",hashtag:"t",thread:"e"},d=Pt(z.mutedTags).filter(f=>f[0]!==l[i]||f[1]!==t).filter(f=>f[1]!==""),{success:c,note:u}=await T0(d,o,z.mutedPrivate,{onAbort:s});c&&(re("mutedTags",()=>d),re("mutedSince",()=>o)),n&&n(c)}}});if(i==="user"&&z.muted.includes(t)){const o=Pt(z.muted).filter(d=>d!==t),l=Pt(z.mutedTags).filter(d=>d[0]!=="p"||d[1]!==t);re("muted",()=>o),re("mutedTags",()=>l)}if(["word","hashtag","thread"].includes(i)){const o={word:"word",hashtag:"t",thread:"e"},l=Pt(z.mutedTags).filter(d=>d[0]!==o[i]||d[1]!==t).filter(d=>d[1]!=="");re("mutedTags",()=>l)}x1(z.publicKey,`before_unmute_${Ee}`)},"removeFromMuteList"),iEe=a((t,e)=>{if(!z.publicKey)return;if(!z.sec||z.sec.length===0){const s=$a();if(s){Iy(s);return}}const n=`before_stream_mute_${Ee}`,i=Me(n,{onEvent:(s,r)=>{r&&[G.StreamMuteList].includes(r.kind)&&r.created_at&&r.created_at>z.streamMutedSince&&K1(r)},onEose:async()=>{if(i(),z.streamMuted.includes(t))return;const s=Math.floor(new Date().getTime()/1e3),r=[...Pt(z.streamMuted),t],o=[...Pt(z.streamMutedTags),["p",t]],{success:l,note:d}=await cU(o,s,z.streamMutedPrivate);l&&(re("streamMuted",()=>r),re("streamMutedTags",()=>o),re("streamMutedSince",()=>s),EN(z.publicKey,r,s)),e&&e(l)}});if(!z.streamMuted.includes(t)){const s=[...Pt(z.streamMuted),t],r=[...Pt(z.streamMutedTags),["p",t]];re("streamMuted",()=>s),re("streamMutedTags",()=>r)}Q1(z.publicKey,G.StreamMuteList,n)},"addToStreamMuteList"),sEe=a((t,e)=>{if(!z.publicKey)return;if(!z.sec||z.sec.length===0){const s=$a();if(s){Iy(s);return}}const n=`before_stream_unmute_${Ee}`,i=Me(n,{onEvent:(s,r)=>{r&&[G.StreamMuteList].includes(r.kind)&&r.created_at&&r.created_at>z.followingSince&&K1(r)},onEose:async()=>{if(i(),!z.streamMuted.includes(t))return;const s=Math.floor(new Date().getTime()/1e3),r=Pt(z.streamMuted).filter(c=>c!==t),o=Pt(z.streamMutedTags).filter(c=>c[0]!=="p"||c[1]!==t),{success:l,note:d}=await cU(o,s,z.streamMutedPrivate);l&&(re("streamMuted",()=>r),re("streamMutedTags",()=>o),re("streamMutedSince",()=>s),EN(z.publicKey,r,s)),e&&e(l)}});if(z.streamMuted.includes(t)){const s=Pt(z.streamMuted).filter(o=>o!==t),r=Pt(z.streamMutedTags).filter(o=>o[0]!=="p"||o[1]!==t);re("streamMuted",()=>s),re("streamMutedTags",()=>r)}Q1(z.publicKey,G.StreamMuteList,n)},"removeFromStreamMuteList"),rEe=a(t=>{t?localStorage.setItem("cacheServer",t):localStorage.removeItem("cacheServer"),A5()},"changeCachingService"),Ly=a(t=>{let e=[...z.mutelists];const n=t.created_at,i=t.tags;if(t.kind!==G.CategorizedPeople||!i.find(s=>s[0]==="d"&&s[1]==="mutelists"))return[...z.mutelists];if(re("mutelistSince",()=>n||0),!i||i.length===0)return[];for(let s=0;s<i.length;s++){const r=i[s];if(r[0]!=="d"&&r[0]==="p"){const o=!!(r[4]&&r[4].includes("content")),l=!!(r[4]&&r[4].includes("trending")),d=z.mutelists.findIndex(u=>u.pubkey===r[1]),c={pubkey:r[1],relay:r[2]||"",petname:r[3]||"",content:o,trending:l};if(d===-1){e.push(c);continue}e[d]=c;continue}}return e},"updateFilterlists"),ote=a(t=>{if(!t)return;const n=`fl_${Ks()}_${Ee}`;let i=[];const s=Me(n,{onEvent:(r,o)=>{i=Ly(o)},onEose:()=>{z.publicKey&&!i.find(r=>r.pubkey===z.publicKey)&&i.unshift({pubkey:z.publicKey,content:!0,trending:!0}),re("mutelists",()=>[...i]),s()}});yy(t,n)},"getFilterLists"),oEe=a(async t=>{if(!t)return;const n=`bma_${Ks()}_${Ee}`;let i=[...z.mutelists];const s=Me(n,{onEvent:(r,o)=>{o&&o.kind===G.CategorizedPeople&&o.created_at&&o.created_at>z.mutelistSince&&(i=[...Ly(o)])},onEose:async()=>
66{if(re("mutelists",()=>[...i]),z.mutelists.find(o=>o.pubkey===t))return;const r=Math.floor(new Date().getTime()/1e3);re("mutelists",o=>[...o,{pubkey:t,content:!0,trending:!0}]),I1(z.mutelists,r,""),s()}});yy(z.publicKey,n)},"addFilterList"),aEe=a(t=>{if(!t||t===z.publicKey)return;const n=`bmr_${Ks()}_${Ee}`;let i=[...z.mutelists];const s=Me(n,{onEvent:(r,o)=>{o&&o.kind===G.CategorizedPeople&&o.created_at&&o.created_at>z.mutelistSince&&(i=Ly(o))},onEose:async()=>{re("mutelists",()=>[...i]);const r=z.mutelists.filter(l=>l.pubkey!==t),o=Math.floor(new Date().getTime()/1e3);re("mutelists",()=>[...r]),await I1(z.mutelists,o,""),s()}});yy(z.publicKey,n)},"removeFilterList"),lEe=a((t,e=!0,n=!0)=>{if(!t)return;const s=`bmu_${Ks()}_${Ee}`,r=Me(s,{onEvent:(o,l)=>{l&&l.kind===G.CategorizedPeople&&l.created_at&&l.created_at>z.mutelistSince&&Ly(l)},onEose:async()=>{if(!z.mutelists.find(l=>l.pubkey===t)){r();return}const o=Math.floor(new Date().getTime()/1e3);re("mutelists",l=>l.pubkey===t,()=>({content:e,trending:n})),await I1(z.mutelists,o,""),r()}});yy(z.publicKey,s)},"updateFilterList"),q1=a(t=>{const e=t.created_at,n=t.tags;if(t.kind!==G.CategorizedPeople||!n.find(s=>s[0]==="d"&&s[1]==="allowlist"))return;re("mutelistSince",()=>e||0);const i=n.reduce((s,r)=>r[0]==="p"?[...s,r[1]]:s,[]);re("allowlist",()=>i)},"updateAllowlist"),ate=a(t=>{if(!t)return;const e=`allowlist_${Ee}`,n=Me(e,{onEvent:(i,s)=>{q1(s)},onEose:()=>{n()}});L1(t,e)},"getAllowList"),cEe=a((t,e)=>{if(!t)return;const i=`baa_${Ks()}_${Ee}`,s=Me(i,{onEvent:(r,o)=>{o&&o.kind===G.CategorizedPeople&&o.created_at&&o.created_at>z.allowlistSince&&q1(o)},onEose:async()=>{if(z.allowlist.includes(t))return;const r=Math.floor(new Date().getTime()/1e3);re("allowlist",z.allowlist.length,()=>t),await TN(z.allowlist,r,""),e&&e(),s()}});L1(z.publicKey,i)},"addToAllowlist"),dEe=a(t=>{if(!t)return;const n=`allow_list_remove_${Ks()}_${Ee}`,i=Me(n,{onEvent:(s,r)=>{r&&r.kind===G.CategorizedPeople&&r.created_at&&r.created_at>z.allowlistSince&&q1(r)},onEose:async()=>{if(!z.allowlist.includes(t))return;const s=Math.floor(new Date().getTime()/1e3),r=z.allowlist.filter(o=>o!==t);re("allowlist",()=>[...r]),await TN(z.allowlist,s,""),i()}});L1(z.publicKey,n)},"removeFromAllowlist"),uEe=a(t=>{const e=z.emojiHistory;if(e.find(n=>n.name===t.name)){let n=[...e];n.sort((i,s)=>i.name===t.name?-1:s.name===t.name?1:0),re("emojiHistory",()=>[...n]),Lk(z.publicKey,z.emojiHistory);return}re("emojiHistory",n=>[t,...n].slice(0,40)),Lk(z.publicKey,z.emojiHistory)},"saveEmoji"),hM=a(()=>{const t=`user_bookmarks_${Ee}`;fi(t,()=>Vq(z.publicKey,t),Ete,_te)},"fetchBookmarks"),fEe=a(t=>{re("bookmarks",()=>[...t])},"updateBookmarks"),QF=a(()=>{const t=`user_relays_${Ee}`;fi(t,()=>by(z.publicKey,t),mte)},"updateRelays"),lte=a(()=>{const t=`user_contacts_${Ee}`;fi(t,()=>vy(z.publicKey,t),gte)}
66,"updateContactsList"),hEe=a((t,e)=>{re(t,()=>e)},"setString"),pEe=a((t,e)=>{re(t,()=>e)},"setFlag"),gEe=a(t=>{re("followData",()=>({...t}))},"setFollowData"),Up=a(t=>{re("activeNWC",()=>[...t])},"setActiveNWC"),j1=a(t=>{re("nwcList",()=>[...t])},"updateNWCList"),pM=a((t,e)=>{if(e===void 0||e<0){re("nwcList",z.nwcList.length,()=>[...t]);return}re("nwcList",e,()=>[...t])},"insertIntoNWCList"),Vb=a((t,e)=>{if(e){$_(t);return}if(z.blossomServers.find(n=>g0(n,t))){re("blossomServers",n=>[t,...n.filter(i=>!g0(i,t))]),Bd();return}re("blossomServers",n=>[t,...n]),Bd()},"addBlossomServers"),$_=a(t=>{if(z.blossomServers.find(e=>g0(e,t))){re("blossomServers",e=>[...e.filter(n=>!g0(n,t)),t]),Bd();return}re("blossomServers",e=>[...e,t]),Bd()},"appendBlossomServers"),cte=a(t=>{z.blossomServers.includes(t)&&(re("blossomServers",e=>e.filter(n=>n!==t)),Bd())},"removeBlossomServers"),dte=a(t=>{const e=z.blossomServers[0]||tm;re("blossomServers",()=>[e]),Bd()},"removeBlossomMirrors"),Bd=a(async t=>{Xte(z.blossomServers)},"updateBlossomEvent"),Lr=a(t=>{localStorage.setItem("loginType",t),re("loginType",()=>t)},"setLoginType"),$d=a(async t=>{const e=Be(t),n=Oq(t),i=n.filter(u=>!Jee(u));i.length!==n.length&&Ur(t,i),re("eventQueue",()=>[...i]),i.length>0&&Np(),re("isKeyLookupDone",!1),re("isKeyLookupDone",!0),V1(t),nte();const s=xq(t);re("bookmarks",()=>[...s]),hM();const r=hq(t);re("proxyThroughPrimal",r);let o=cq(t)||{};re("connectToPrimaryRelays",()=>uq(t)),z.connectToPrimaryRelays&&(o=W1(o)),re("relaySettings",()=>({...e.relaySettings})),Fp(o),QF();let l=e.nwcActive;l&&Up(l),z.followingSince<e.followingSince&&(re("following",()=>({...e.following})),re("followingSince",()=>e.followingSince)),lte(),re("emojiHistory",()=>bq(t)),z.mutedSince<e.mutedSince&&(re("muted",()=>({...e.muted})),re("mutedSince",()=>e.mutedSince),re("mutedPrivate",()=>e.mutedPrivate));const d=`mutelist_${Ee}`;fi(d,()=>x1(t,d),vte),z.mutedSince<e.mutedSince&&(re("streamMuted",()=>({...e.streamMuted})),re("streamMutedSince",()=>e.streamMutedSince),re("streamMutedPrivate",()=>e.streamMutedPrivate));const c=`streammutelist_${Ee}`;fi(c,()=>Q1(t,G.StreamMuteList,c),yte),ote(t),ate(t),hM()},"doAfterLogin"),ute=a(()=>{const t=localStorage.getItem("loginType")||"none";let e=z.loginType;jee.includes(t)&&(Lr(t),e=t);const n=pte();switch(e){case"npub":fte();break;case"extension":n&&$d(n),_0(1);break;case"local":XF();break;case"nip46":hte(n);break;case"guest":H_();break;default:JF();break}},"logUserIn"),JF=a((t=0)=>{const e=$a();if(e){XF(e);return}const i=window.nostr;if(!i&&t<4){H_(),setTimeout(()=>{JF(t+1)},500);return}if(i){_0();return}H_()},"findActiveLogin"),H_=a(()=>{So(void 0),re("activeUser",()=>{}),re("loginType",()=>"guest"),re("isKeyLookupDone",()=>!0)},"loginGuest"),_0=a(async(t=0,e)=>{const i=window.nostr;if(re("isKeyLookupDone",()=>!1),!i){if(t>4){xi("Nostr extension not found");return}xi("Nostr extension retry attempt: ",t),setTimeout(()=>_0(t+1),250);return}try{Lr("extension");let s=await Promise.race([Rte(),Lte(3e3)]);if(s===void 0){setTimeout(()=>{_0(t+1)},250);return}So(s);const r=T1(s);r&&re("activeUser",()=>({...r})),$d(s)}catch(s){Lr("guest"),So(void 0),localStorage.removeItem("pubkey"),Tn("error fetching public key: ",s)}},"loginUsingExtension"),XF=a(t=>{const e=t||$a();e&&(Lr("local"),e.startsWith(zf)?re("showPin",()=>e):(ite(e),z.publicKey&&$d(z.publicKey)))},"loginUsingLocalNsec"),fte=a(t=>{if(Lr("npub"),t){const n=Ce.decode(t);if(n.type!=="npub")return;const i=n.data;So(i),$d(i);return}let e=localStorage.getItem("pubkey");e&&(So(e),$d(e))},"loginUsingNpub"),hte=a(async t=>{Lr("nip46");const e=Jq(),n=localStorage.getItem("bunkerUrl");if(!e||!n){Lr("guest");return}const i=await jz(n);if(!i){Lr("guest");return}const s=new QV;if(LN(m_.fromBunker(e,i,{pool:s})),!Mi){Lr("guest");return}const r=t||await Mi.getPublicKey();So(r),$d(r)},"loginUsingNip46"),pte=a(()=>{const t=localStorage.getItem("pubkey");if(!t)return;So(t);const e=T1(t);e&&re("activeUser",()=>({...e}));const n=Dq(t);return n&&re("membershipStatus",()=>({...n})),V1(t),t},"fetchNostrKey"),gte=a(t=>{if(t&&t.kind===G.Contacts){if(!t.created_at||t.created_at<z.followingSince)return;rte(t)}},"handleUserContactsEvent"),mte=a(t=>{if(t&&t.kind===G.UserRelays){const e=xN(t.tags);Qf(e,!0)}},"handleUserRelaysEvent"),vte=a(t=>{if(t&&[G.MuteList,G.CategorizedPeople].includes(t.kind)){if(!t.created_at||t.created_at<z.mutedSince)return;z1(t)}},"handleMuteListEvent"),yte=a(t=>{if(t&&[G.StreamMuteList].includes(t.kind)){if(!t.created_at||t.created_at<z.streamMutedSince)return;K1(t)}},"handleStreamMuteListEvent"),bte=a(t=>{const e=JSON.parse(t.content||"[]");re("defaultRelays",()=>[...e]);const n=e.reduce((i,s)=>({...i,[s]:{read:!0,write:!0}}),{});Object.keys(n).length>0&&Fp(n)},"handleDefaultRelaysEvent"),Ete=a(t=>{if(!t||t.kind!==G.Bookmarks||!t.created_at||t.created_at<z.followingSince)return;const e=t.tags.reduce((n,i)=>j9.includes(i[0])?[...n,i[1]]:[...n],[]);re("bookmarks",()=>[...e])},"handleUserBookmarksEvent"),_te=a(()=>{Aq(z.publicKey,z.bookmarks)},"handleUserBookmarksEose"),[z,re]=li({...Yee});/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function eU(...t){const e=a((s,r)=>o=>s(r(o)),"wrap"),n=Array.from(t).reverse().reduce((s,r)=>s?e(s,r.encode):r.encode,void 0),i=t.reduce((s,r)=>s?e(s,r.decode):r.decode,void 0);return{encode:n,decode:i}}a(eU,"chain$2");function tU(t){return{encode:e=>{if(!Array.isArray(e)||e.length&&typeof e[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return e.map(n=>{if(n<0||n>=t.length)throw new Error(`Digit index outside alphabet: ${n} (alphabet: ${t.length})`);return t[n]})},decode:e=>
66{if(!Array.isArray(e)||e.length&&typeof e[0]!="string")throw new Error("alphabet.decode input should be array of strings");return e.map(n=>{if(typeof n!="string")throw new Error(`alphabet.decode: not string element=${n}`);const i=t.indexOf(n);if(i===-1)throw new Error(`Unknown letter: "${n}". Allowed: ${t}`);return i})}}}a(tU,"alphabet$2");function nU(t=""){if(typeof t!="string")throw new Error("join separator should be string");return{encode:e=>{if(!Array.isArray(e)||e.length&&typeof e[0]!="string")throw new Error("join.encode input should be array of strings");for(let n of e)if(typeof n!="string")throw new Error(`join.encode: non-string input=${n}`);return e.join(t)},decode:e=>{if(typeof e!="string")throw new Error("join.decode input should be string");return e.split(t)}}}a(nU,"join$2");function wte(t,e="="){if(typeof e!="string")throw new Error("padding chr should be string");return{encode(n){if(!Array.isArray(n)||n.length&&typeof n[0]!="string")throw new Error("padding.encode input should be array of strings");for(let i of n)if(typeof i!="string")throw new Error(`padding.encode: non-string input=${i}`);for(;n.length*t%8;)n.push(e);return n},decode(n){if(!Array.isArray(n)||n.length&&typeof n[0]!="string")throw new Error("padding.encode input should be array of strings");for(let s of n)if(typeof s!="string")throw new Error(`padding.decode: non-string input=${s}`);let i=n.length;if(i*t%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;i>0&&n[i-1]===e;i--)if(!((i-1)*t%8))throw new Error("Invalid padding: string has too much padding");return n.slice(0,i)}}}a(wte,"padding$1");const iU=a((t,e)=>e?iU(e,t%e):t,"gcd$1"),w0=a((t,e)=>t+(e-iU(t,e)),"radix2carry$1");function G_(t,e,n,i){if(!Array.isArray(t))throw new Error("convertRadix2: data should be array");if(e<=0||e>32)throw new Error(`convertRadix2: wrong from=${e}`);if(n<=0||n>32)throw new Error(`convertRadix2: wrong to=${n}`);if(w0(e,n)>32)throw new Error(`convertRadix2: carry overflow from=${e} to=${n} carryBits=${w0(e,n)}`);let s=0,r=0;const o=2**n-1,l=[];for(const d of t){if(d>=2**e)throw new Error(`convertRadix2: invalid data word=${d} from=${e}`);if(s=s<<e|d,r+e>32)throw new Error(`convertRadix2: carry overflow pos=${r} from=${e}`);for(r+=e;r>=n;r-=n)l.push((s>>r-n&o)>>>0);s&=2**r-1}if(s=s<<n-r&o,!i&&r>=e)throw new Error("Excess padding");if(!i&&s)throw new Error(`Non-zero padding: ${s}`);return i&&r>0&&l.push(s>>>0),l}a(G_,"convertRadix2$1");function sU(t,e=!1){if(t<=0||t>32)throw new Error("radix2: bits should be in (0..32]");if(w0(8,t)>32||w0(t,8)>32)throw new Error("radix2: carry overflow");return{encode:n=>{if(!(n instanceof Uint8Array))throw new Error("radix2.encode input should be Uint8Array");return G_(Array.from(n),8,t,!e)},decode:n=>{if(!Array.isArray(n)||n.length&&typeof n[0]!="number")throw new Error("radix2.decode input should be array of strings");return Uint8Array.from(G_(n,t,8,e))}}}a(sU,"radix2$1");function gM(t){if(typeof t!="function")throw new Error("unsafeWrapper fn should be function");return function(...e){try{return t.apply(null,e)}catch{}}}a(gM,"unsafeWrapper");const S0=eU(sU(6),tU("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),wte(6),nU("")),V_=eU(tU("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),nU("")),mM=[996825010,642813549,513874426,1027748829,705979059];function Du(t){const e=t>>25;let n=(t&33554431)<<5;for(let i=0;i<mM.length;i++)(e>>i&1)===1&&(n^=mM[i]);return n}a(Du,"bech32Polymod");function vM(t,e,n=1){const i=t.length;let s=1;for(let r=0;r<i;r++){const o=t.charCodeAt(r);if(o<33||o>126)throw new Error(`Invalid prefix (${t})`);s=Du(s)^o>>5}s=Du(s);for(let r=0;r<i;r++)s=Du(s)^t.charCodeAt(r)&31;for(let r of e)s=Du(s)^r;for(let r=0;r<6;r++)s=Du(s);return s^=n,V_.encode(G_([s%2**30],30,5,!1))}a(vM,"bechChecksum");function Ste(t){const e=t==="bech32"?1:734539939,n=sU(5),i=n.decode,s=n.encode,r=gM(i);function o(u,f,h=90){if(typeof u!="string")throw new Error(`bech32.encode prefix should be string, not ${typeof u}`);if(!Array.isArray(f)||f.length&&typeof f[0]!="number")throw new Error(`bech32.encode words should be array of numbers, not ${typeof f}`);const p=u.length+7+f.length;if(h!==!1&&p>h)throw new TypeError(`Length ${p} exceeds limit ${h}`);const g=u.toLowerCase(),v=vM(g,f,e);return`${g}1${V_.encode(f)}${v}`}a(o,"encode");function l(u,f=90){if(typeof u!="string")throw new Error(`bech32.decode input should be string, not ${typeof u}`);if(u.length<8||f!==!1&&u.length>
66f)throw new TypeError(`Wrong string length: ${u.length} (${u}). Expected (8..${f})`);const h=u.toLowerCase();if(u!==h&&u!==u.toUpperCase())throw new Error("String must be lowercase or uppercase");u=h;const p=u.lastIndexOf("1");if(p===0||p===-1)throw new Error('Letter "1" must be present between prefix and data only');const g=u.slice(0,p),v=u.slice(p+1);if(v.length<6)throw new Error("Data must be at least 6 characters long");const y=V_.decode(v).slice(0,-6),b=vM(g,y,e);if(!v.endsWith(b))throw new Error(`Invalid checksum in ${u}: expected "${b}"`);return{prefix:g,words:y}}a(l,"decode");const d=gM(l);function c(u){const{prefix:f,words:h}=l(u,!1);return{prefix:f,words:h,bytes:i(h)}}return a(c,"decodeToBytes"),{encode:o,decode:l,decodeToBytes:c,decodeUnsafe:d,fromWords:i,fromWordsUnsafe:r,toWords:s}}a(Ste,"genBech32");const mEe=Ste("bech32"),[Tte,vEe]=Je(""),[Ate,yEe]=Je(),bEe=a(t=>{let e=Ks(),n=$a();t&&(n=Ce.nsecEncode(e));const i=nc(e);return{sec:e,nsec:n,pubkey:i}},"generateKeys"),EEe=a(async(t,e)=>{try{const n=window.crypto;if(!n)throw"not-secure-env";const i=new TextEncoder,s=await n.subtle.digest("SHA-256",i.encode(t));let r=Uint8Array.from(n.getRandomValues(new Uint8Array(16))),o=i.encode(e),l=await n.subtle.importKey("raw",s,{name:"AES-CBC"},!1,["encrypt"]),d=await n.subtle.encrypt({name:"AES-CBC",iv:r},l,o),c=S0.encode(new Uint8Array(d)),u=S0.encode(new Uint8Array(r.buffer));return`${zf}${c}${cO}${u}`}catch(n){return Tn("Failed to encrypt with PIN: ",n),""}},"encryptWithPin"),xte=a(async(t,e)=>{try{if(!e.startsWith(zf))throw"bad-cipher";const n=window.crypto;if(!n)throw"not-secure-env";const i=new TextEncoder,s=new TextDecoder("utf-8"),r=e.slice(zf.length),o=await n.subtle.digest("SHA-256",i.encode(t));let[l,d]=r.split(cO),c=await n.subtle.importKey("raw",o,{name:"AES-CBC"},!1,["decrypt"]),u=S0.decode(l),f=S0.decode(d),h=await n.subtle.decrypt({name:"AES-CBC",iv:f},c,u);return s.decode(h)}catch(n){return Tn("Failed to decrypt with PIN: ",n),""}},"decryptWithPin"),Ite=a(t=>{const e=a(async()=>{let c=t||$a()||Ate()||lN();c.startsWith(zf)&&(c=await xte(Tte(),c));const u=Ce.decode(c);if(u.type!=="nsec"||!u.data)throw"invalid-nsec";const f=u.data;return f.length>0?f:void 0},"getSec");return{getPublicKey:a(async()=>{const c=await e();if(!c)throw"pubkey-no-nsec";return await nc(c)},"gPk"),getRelays:a(()=>new Promise(c=>{c({})}),"gRl"),nip04:{encrypt:a(async(c,u)=>{const f=await e();if(!f)throw"encrypt-no-nsec";return await g_.encrypt(f,c,u)},"encrypt"),decrypt:a(async(c,u)=>{const f=await e();if(!f)throw"decrypt-no-nsec";return await g_.decrypt(f,c,u)},"decrypt")},nip44:{encrypt:a(async(c,u)=>{const f=await e();if(!f)throw"encrypt-no-nsec";const h=td.getConversationKey(f,c);return td.v2.encrypt(u,h)},"encrypt44"),decrypt:a(async(c,u)=>{const f=await e();if(!f)throw"decrypt-no-nsec";const h=td.getConversationKey(f,c);return td.v2.decrypt(u,h)},"decrypt44")},signEvent:a(async c=>{const u=await e();if(!u)throw"sign-no-nsec";let f=qs({...c},u);if(!ou(f))throw"event-sig-not-verified";return f},"signEvent")}},"PrimalNostr");var aa,la;const JA=class JA{constructor(){Ze(this,aa,void 0);Ze(this,la,void 0);st(this,aa,[]),st(this,la,!1)}enqueue(e){return new Promise((n,i)=>{setTimeout(()=>{Re(this,aa).push({action:e,resolve:n,reject:i}),this.dequeue()},0)})}async dequeue(){if(Re(this,la))return!1;let e=Re(this,aa).shift();if(!e)return!1;try{st(this,la,!0);let n=await e.action();st(this,la,!1),e.resolve(n)}catch(n){st(this,la,!1),e.reject(n)}finally{this.dequeue()}return!0}abortCurrent(){return Re(this,aa).shift()}get size(){return Re(this,aa).length}};aa=new WeakMap,la=new WeakMap,a(JA,"Queue");let W_=JA;const Y1=new W_,rU=a(async t=>{const n=window.webln;if(n===void 0)throw"no_webln_extension";return await Y1.enqueue(()=>t(n))},"enqueueWebLn"),du=a(async t=>{const e=z.loginType;if(["none","guest","npub"].includes(e))throw"no_login";let n;if(e==="extension"&&(n=window.nostr,n===void 0))throw"no_nostr_extension";if(e==="local"&&(n=Ite(),n===void 0))throw"no_nostr_local";if(e==="nip46"&&(n=Xq(),n===void 0))throw"no_nostr_nip46";if(n===void 0)throw"unknown_login";return await Y1.enqueue(()=>t(n))},"enqueueNostr"),xo=a((t=8e3)=>
66new Promise((e,n)=>{setTimeout(()=>{n("promise_timeout")},t)}),"timeoutPromise"),To=a((t,e,n=!1)=>{$K()&&re("sendErrors",()=>({[e]:`${t}`})),!n&&(t==="promise_timeout"&&z.loginType==="nip46"&&Zee({title:"Remote signer unreachable",description:"Primal can't reach the remote signer. Please make sure your signer is online and the Primal session is active",confirmLabel:"Retry",onConfirm:()=>{zF(),Hb()},abortLabel:"Abort",onAbort:()=>{uM(),Hb()},cancelLabel:"Log out",onCancel:()=>{uM(),YF(),Hb()}}),t==="promise_timeout"&&z.loginType==="extension"&&re("signerTimeout",!0))},"handleSignerFailure"),Lte=a((t=8e3)=>new Promise((e,n)=>{setTimeout(()=>{e(void 0)},t)}),"timeoutPromiseResolve"),Nt=a(async(t,e)=>{let n={...t};const i=n.id||`${w1()}`;n.tags.find(r=>r[0]==="client")||n.tags.push(["client","Primal Web"]);try{return await du(async r=>{try{const o=await Promise.race([r.signEvent(Pt(n)),xo()]);if(re("signerTimeout",!1),cM(i))throw"event_aborted";return dM(Pt(n),i),o}catch(o){throw o}})}catch(r){throw Y1.abortCurrent(),r==="event_aborted"?r:r==="user rejected"||r?.message?.includes("denied")||r?.message?.includes("reject")?(dM(Pt(n),i),r):cM(i)?r:e?.isRead?(To(r,i,!0),r):(Xee(Pt(n),i,e?.onAbort),To(r,i),r)}},"signEvent"),Rte=a(async()=>{try{return await du(async t=>{try{const e=await Promise.race([t.getPublicKey(),xo()]);return re("signerTimeout",!1),e}catch(e){throw To(e,"getPublicKey",!0),e}})}catch(t){throw t}},"getPublicKey"),Z1=a(async(t,e)=>{try{return await du(async n=>{try{const i=await Promise.race([n.nip04.encrypt(t,e),xo()]);return re("signerTimeout",!1),i}catch(i){throw To(i,"encrypt",!0),i}})}catch(n){throw n}},"encrypt"),oU=a(async(t,e)=>{try{return await du(async n=>{try{const i=await Promise.race([n.nip04.decrypt(t,e),xo()]);return re("signerTimeout",!1),i}catch(i){throw To(i,"decrypt",!0),i}})}catch(n){throw n}},"decrypt"),kte=a(async(t,e)=>{try{return await du(async n=>{try{const i=await Promise.race([n.nip44.encrypt(t,e),xo()]);return re("signerTimeout",!1),i}catch(i){throw To(i,"encrypt44",!0),i}})}catch(n){throw n}},"encrypt44"),Mte=a(async(t,e)=>{try{return await du(async n=>{try{const i=await Promise.race([n.nip44.decrypt(t,e),xo()]);return re("signerTimeout",!1),i}catch(i){throw To(i,"decrypt44",!0),i}})}catch(n){throw n}},"decrypt44"),_Ee=a(async()=>{try{return await rU(async t=>{try{await Promise.race([t.enable(),xo()]),re("signerTimeout",!1);return}catch(e){throw To(e,"webln",!0),e}})}catch(t){throw t}},"enableWebLn"),wEe=a(async t=>{try{return await rU(async e=>{try{const n=await Promise.race([e.sendPayment(t),xo()]);return re("signerTimeout",!1),n}catch(n){throw To(n,"sendPayment",!0),n}})}catch(e){throw e}},"sendPayment"),Cte=a((t,e="o",n=1)=>
66{if(!t)return;const i=localStorage.getItem("mediaServer");if(!i)return t;const s=encodeURIComponent(t);return`${i}/media-cache?s=${e}&a=${n}&u=${s}`},"getMediaUrl"),SEe=a((t,e)=>{const i=(t||[]).filter(l=>l[0]==="imeta").find(l=>l.find(d=>d===`url ${e}`));if(!i)return;const s=i.find(l=>l.startsWith("dim "))?.split(" ")[1].split("x");if(!s||s.length!==2)return;e.split(".");const r=i.find(l=>l.startsWith("m "))?.split(" ")[1]||"",o=i.find(l=>l.startsWith("duration "))?.split(" ")[1]||"0";return{s:"o",a:0,w:parseInt(s[0]),h:parseInt(s[1]),mt:r,media_url:e,dur:parseFloat(o)}},"getMediaVariantFromTags");var Pte=It("<div class=bordered>");const Sn=a(t=>t?t.replaceAll("<","&lt;").replaceAll(">","&gt;"):"","sanitize"),[z_,Dte]=li({}),TEe=a(t=>({...z_[t]}),"getLinkPreview"),Ote=a(async t=>{if(z_[t])return{...z_[t]};try{const e=window.location.origin.startsWith("http://localhost")?"https://dev.primal.net":window.location.origin,i=await(await fetch(`${e}/link-preview?u=${encodeURIComponent(t)}`)).json();return{url:t,description:i.description,title:i.title,images:[i.image],favicons:[i.icon_url]}}catch{return ii("Failed to get preview for: ",t),{url:t}}},"addLinkPreviews"),Io=a(t=>{if(t.resources.length!==0)for(let e=0;e<t.resources.length;e++){const n=t.resources[e];if(!n)continue;const i={url:n.url,title:n.md_title,description:n.md_description,mediaType:n.mimetype,contentType:n.mimetype,images:[n.md_image],favicons:[n.icon_url]};Dte(()=>({[n.url]:i}))}},"parseLinkPreviews"),AEe=a(t=>D9.test(t),"isUrl"),xEe=a(t=>$9.test(t),"isHashtag"),IEe=a(t=>H9.test(t),"isTagMention"),LEe=a(t=>G9.test(t),"isNoteMention"),REe=a(t=>V9.test(t),"isUserMention"),kEe=a(t=>W9.test(t),"isAddrMention"),MEe=a(t=>N9.test(t),"isInterpunction"),CEe=a(t=>F9.test(t),"isCustomEmoji"),PEe=a(t=>U9.test(t),"isLnbc"),DEe=a(t=>B9.test(t),"isUnitifedLnAddress"),Nte=a(t=>[".jpg",".jpeg",".webp",".png",".gif",".format=png"].some(e=>t.includes(e)),"isImage"),Fte=a(t=>[".mp4",".mov"].some(e=>t.includes(e)),"isMp4Video"),Ute=a(t=>[".ogg"].some(e=>t.includes(e)),"isOggVideo"),Bte=a(t=>[".webm"].some(e=>t.includes(e)),"isWebmVideo"),$te=a(t=>[".3gp"].some(e=>t.includes(e)),"is3gppVideo"),Hte=a(t=>[".mp3",".wav"].some(e=>t.includes(e)),"isAudio"),Gte=a(t=>eO.test(t),"isYouTube"),Vte=a(t=>I9.test(t),"isSpotify"),Wte=a(t=>L9.test(t),"isTwitch"),OEe=a(t=>R9.test(t),"isTwitchPlayer"),zte=a(t=>e_.test(t),"isMixCloud"),Kte=a(t=>k9.test(t),"isSoundCloud"),qte=a(t=>M9.test(t),"isAppleMusic"),jte=a(t=>C9.test(t),"isWavelake"),NEe=a(t=>P9.test(t),"isRumble"),Yte=a(t=>x9.test(t),"isZapStream"),Zte=a((t,e,n=!1,i=!1,s=!1)=>t.replace(O9,r=>{if(!i){if(Nte(r)){const o=localStorage.getItem("devMode")==="true";let l=e&&e(r);return l?`<img src="${l}" class="postImage"/>`:`<img src="${Cte(r)}" class="postImage${o?" redBorder":""}"/>`}if(Fte(r))return`<video class="w-max" controls><source src="${r}" type="video/mp4"></video>`;if(Ute(r))return`<video class="w-max" controls><source src="${r}" type="video/ogg"></video>`;if(Bte(r))return`<video class="w-max" controls><source src="${r}" type="video/webm"></video>`;if($te(r))return`<video class="w-max" controls><source src="${r}" type="video/3gpp"></video>`;if(Hte(r))return`<audio class="mtop-12" controls src="${r}"></audio>`;if(Gte(r)){const o=eO.test(r)&&RegExp.$1;return`<iframe
67          class="w-max"
68          src="https://www.youtube.com/embed/${o}"
69          title="YouTube video player"
70          key="${o}"
71          frameBorder="0"
72          allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
73          allowFullScreen
74        ></iframe>`}if(Vte(r))return`<iframe style="borderRadius: 12" src="${r.replace(/\/(track|album|playlist|episode)\/([a-zA-Z0-9]+)/,"/embed/$1/$2")}" width="100%" height="352" frameBorder="0" allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture" loading="lazy"></iframe>`;if(Wte(r))return`<iframe src="https://player.twitch.tv/${`?channel=${r.split("/").slice(-1)}&parent=${window.location.hostname}&muted=true`}" className="w-max" allowFullScreen></iframe>`;if(zte(r))return`
75            <br />
76            <iframe
77              title="SoundCloud player"
78              width="100%"
79              height="120"
80              frameBorder="0"
81              src="https://www.mixcloud.com/widget/iframe/?hide_cover=1&feed=%2F${(e_.test(r)&&RegExp.$1)+"%2F"
81+(e_.test(r)&&RegExp.$2)}%2F"
82            ></iframe>`;if(Kte(r))return`<iframe
83            width="100%"
84            height="166"
85            scrolling="no"
86            allow="autoplay"
87            src="https://w.soundcloud.com/player/?url=${r}"></iframe>`;if(qte(r)){const o=r.replace("music.apple.com","embed.music.apple.com");return`
88          <iframe
89            allow="autoplay *; encrypted-media *; fullscreen *; clipboard-write"
90            frameBorder="0"
91            height="${/\?i=\d+$/.test(o)?175:450}"
92            style="width: 100%; maxWidth: 660; overflow: hidden; background: transparent;"
93            sandbox="allow-forms allow-popups allow-same-origin allow-scripts allow-storage-access-by-user-activation allow-top-navigation-by-user-activation"
94            src="${o}"></iframe>
95        `}if(jte(r))return`
96          <iframe
97            style="borderRadius: 12"
98            src="${r.replace(/(?:player\.|www\.)?wavlake\.com/,"embed.wavlake.com")}"
99            width="100%"
100            height="380"
101            frameBorder="0"
102            loading="lazy"></iframe>`;if(Yte(r))return`__EXTERNAL_STREAM__${r}__EXTERNAL_STREAM__`}return n?`<span class="linkish">${r}</span>`:s?`<a link href="${r}" target="_blank" >${r}</a>`:`__LINK__${r}__LINK__`}),"urlify"),FEe=a(async t=>{let e=t;const n=/__LINK__.*?__LINK__/ig,i=e.match(n)||[];for(let s=0;s<i.length;s++){const r=i[s],o=r.split("__LINK__")[1];let l;s===i.length-1&&t.endsWith(r)&&(l=await Ote(o));const c=l&&l.url&&(l.description&&l.description.length>0||l.image||l.title)?(()=>{var u=Pte();return Fe(u,X(rq,{preview:l})),u})()?.outerHTML:`<a link href="${o}" target="_blank" >${o}</a>`;e=e.replace(r,c)}return e},"replaceLinkPreviews"),Qte=a(t=>{const e=/(\r\n|\r|\n)/g;return t.replaceAll(e,"<br> ")},"addlineBreaks"),UEe=a((t,e)=>Zte(Qte(t),e),"parseNote1"),aU=a((t,e)=>{Ae(JSON.stringify(["REQ",e,{cache:["import_events",{events:t}]}]))},"importEvents"),BEe=a(async(t,e,n)=>{const i={content:"",kind:G.ReportContent,tags:[["e",t,n],["p",e]],created_at:Math.floor(new Date().getTime()/1e3)};return await Vn(i)},"sendContentReport"),Jte=a(async(t,e)=>{const n={content:"+",kind:G.Reaction,tags:[["e",t.id],["p",t.pubkey]],created_at:Math.floor(new Date().getTime()/1e3)};return t.coordinate&&n.tags.push(["a",t.coordinate]),await Vn(n,void 0,e)},"sendLike"),$Ee=a(async(t,e)=>{const n={content:JSON.stringify(t.msg),kind:G.Repost,tags:[["e",t.msg.id],["p",t.user.pubkey]],created_at:Math.floor(new Date().getTime()/1e3)};return await Vn(n,void 0,e)},"sendRepost"),Xte=a(async t=>{const e={content:"",kind:G.Blossom,tags:t.map(n=>["server",n]),created_at:Math.floor(new Date().getTime()/1e3)};return await Vn(e)},"sendBlossomEvent"),HEe=a(async(t,e)=>{const n={content:JSON.stringify(t.msg),kind:G.Repost,tags:[["e",t.id],["a",t.coordinate],["p",t.pubkey]],created_at:Math.floor(new Date().getTime()/1e3)};return await Vn(n,void 0,e)},"sendArticleRepost"),ene=a(async(t,e,n)=>{const i=t.tags.reduce((d,c)=>c[0]==="e"&&c[2]&&c[2].length>0&&!e.find(u=>u.url===c[2])?[...d,c[2]]:[...d],[]);let r=Object.keys(n||{}).filter(d=>n?.[d].write);const o=new Set([...r,...i]),l=new Promise((d,c)=>{if(!t){c("Note not signed");return}const u=`publish_event_${t.id}`,f=Me(u,{onEvent:()=>{f(),d(!0)},onNotice:()=>{f(),c("Failed to publish note")},onEose:()=>{f(),c("No publish confirmation")}});Ae(JSON.stringify(["REQ",u,{cache:["broadcast_events",{events:[t],relays:Array.from(o)}]}]))});try{return await Promise.race([l]),{success:!0,note:t}}catch(d){return Tn("Failed to publish the note: ",d),{success:!1,reasons:[d],note:t}}},"proxyEvent"),GEe=a((t,e,n)=>{const i={content:t,kind:G.Text,tags:e,created_at:Math.floor(new Date().getTime()/1e3)};return new Promise(s=>{Vn(i,{success:r=>{if(r){z.proxyThroughPrimal&&Bp([r],`import_${Ee}`),s({success:!0,note:r});return}s({success:!1,reasons:["failed-to-publish"]})},fail:r=>{s({success:!1,note:r})}})})},"sendNote"),VEe=a(async(t,e)=>{const n=Math.floor(new Date().getTime()/1e3),s=[...t.msg?.tags||[]].find(l=>l[0]==="published_at");let r=s?[[...s]]:[["published_at",`${n}`]];const o={content:t.content,kind:G.LongForm,tags:[...e,...r],created_at:n};return await Vn(o)},"sendArticle"),WEe=a((t,e,n,i,s)=>{const r={content:t,kind:e,tags:n,created_at:i||Math.floor(new Date().getTime()/1e3)};return new Promise(o=>{Vn(r,{success:l=>{if(l){const d=s?()=>{o({success:!0,note:l})}:()=>{};Bp([l],`import_${Ee}`,d),!s&&o({success:!0,note:l});return}o({success:!1,reasons:["failed-to-publish"]})},fail:l=>{o({success:!1,note:l})}})})},"sendPoll"),zEe=a(async(t,e)=>{const n={content:"",kind:G.UserPollVote,tags:[["e",t.id],["response",e.id]],created_at:Math.floor(new Date().getTime()/1e3)},i=await Nt(n);Ae(JSON.stringify(["REQ",`vote_${e.id}_${Ee}`,{cache:["import_poll_vote_event",{event_from_user:i}]}]))}
102,"sendUserPollVote"),tne=a(t=>t.toLowerCase().replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,""),"generateIdentifier"),KEe=a(async(t,e,n)=>{const s=e.split(":").length===3?"a":"e",r={kind:G.EventDeletion,pubkey:t,tags:[[s,e],["k",`${n}`]],content:"Deleted by the author",created_at:Math.floor(new Date().getTime()/1e3)};return await Vn(r)},"sendDeleteEvent"),qEe=a(async(t,e,n)=>{const i=t.pubkey,s=tne(e.title),r=Math.floor(new Date().getTime()/1e3),o=e.tags.map(f=>["t",f]),l={content:n,kind:G.LongForm,tags:[["title",e.title],["summary",e.summary],["image",e.image],["d",s],["client","Primal Web"],...o],created_at:r},d=await kte(i,JSON.stringify(l)),c={kind:G.Draft,created_at:Math.floor(new Date().getTime()/1e3),tags:[["d",s],["k",`${G.LongForm}`],["client","Primal Web"]],content:d};return await Vn(c)},"sendDraft"),lU=a(async(t,e,n,i)=>{const s={content:n,kind:G.Contacts,tags:[...t],created_at:e};return await Vn(s,void 0,i)},"sendContacts"),T0=a(async(t,e,n,i)=>{const s={content:n,kind:G.MuteList,tags:t,created_at:e};return await Vn(s,void 0,i)},"sendMuteList"),cU=a(async(t,e,n)=>{const i={content:n,kind:G.StreamMuteList,tags:t,created_at:e};return await Vn(i)},"sendStreamMuteList"),dU=a((t,e)=>{const n=[...z.activeRelays],i=t.tags.reduce((r,o)=>o[0]==="e"&&o[2]&&o[2].length>0&&!n.find(l=>l===o[2])?[...r,o[2]]:[...r],[]),s=[...n.map(r=>r),...i];if(e){const r=a(o=>{const{type:l,event:d,reason:c}=o.data;if(l==="EVENT_SENT"&&d.id===t.id){e.success?.(d),kn.removeEventListener("message",r);return}if(l==="EVENT_NOT_SENT"&&d.id===t.id){re("sendErrors",()=>({[d.id]:`${c}`})),e.success?.(d),kn.removeEventListener("message",r);return}},"onSuccess");kn.addEventListener("message",r)}kn.postMessage({type:"SEND_EVENT",eventData:{event:Pt(t),relays:s}})},"sendSignedEvent"),Vn=a(async(t,e,n)=>{const i=z.activeRelays,s=z.relaySettings,r=z.proxyThroughPrimal;return Nt(t,n).then(async o=>{if(!o)return{success:!1,reasons:["event_not_signed"]};if(r){try{VF(o),await ene(o,i,s),WF(o),e?.success&&e.success(o)}catch{e?.fail&&e.fail(o)}return}dU(o,e)}).catch(o=>{ii("EVENT FAILED REASON: ",o)}),{success:!0,note:t}},"sendEvent"),Bp=a((t,e,n)=>{let i=!1,s;const r=a(()=>{i||(i=!0,clearTimeout(s),o(),n&&n())},"finish"),o=Me(e,{onEose:()=>r()});s=setTimeout(r,8e3),aU(t,e)},"triggerImportEvents"),jEe=a((t,e,n,i)=>new Promise(s=>{let r={...ci()};const o=Me(n,{onEvent:(f,h)=>{h&&vi(r,h)},onEose:()=>{o(),s(Bi(r))},onNotice:(f,h)=>{o(),s({...gs()})}}),l=i?.until||0,d=i?.since||0,c=i?.limit||0;let u=0;typeof i?.offset=="number"?u=i.offset:Array.isArray(i?.offset)&&(l>0&&(u=(i?.offset||[]).filter(f=>f===l).length),d>0&&(u=(i?.offset||[]).filter(f=>f===d).length)),Ae(JSON.stringify(["REQ",n,{cache:["poll_votes",{event_id:t,option:e,limit:c,offset:u}]}]))}),"getPollVotes"),YEe=a((t,e,n,i)=>new Promise(s=>{let r={},o=[];const l=Me(n,{onEvent:(h,p)=>{if(p.kind===G.FeedRange&&(JSON.parse(p.content)||{elements:[]}).elements,p?.kind===G.Metadata){let g=JSON.parse(p.content);(!g.displayName||typeof g.displayName=="string"&&g.displayName.trim().length===0)&&(g.displayName=g.display_name),g.pubkey=p.pubkey,g.npub=Ii(p.pubkey),g.created_at=p.created_at,r[p.pubkey]={...g};return}if(p?.kind===G.Zap){const g=p.tags.find(E=>E[0]==="description");if(!g)return;const v=JSON.parse(g[1]||"{}");let y="0",b=p?.tags?.find(E=>E[0]==="bolt11");if(b)try{y=`${vs(b[1])||0}`}catch{const T=v.tags.find(I=>I[0]==="amount");y=T?T[1]:"0"}o.push({amount:y,pubkey:v.pubkey,receiver:(v.tags.find(E=>E[0]==="p")||["p",""])[1],message:v.content,tags:[...v.tags],msg:{...v}});return}},onEose:()=>{o.map(p=>({...p,amount:parseInt(p.amount||"0"),sender:r[p.pubkey]}));const h=o.reduce((p,g)=>{const v={user:r[g.pubkey]||Op(g.pubkey),msg:{...g.msg},tags:[...g.tags],id:g.msg.id,pubkey:g.receiver,response:(g.tags.find(y=>y[0]==="poll_option")||["poll_option",""])[1],amount:g.amount,message:g.message};return[...p,v]},[]);s(h),l()}}),d=i?.until||0,c=i?.since||0,u=i?.limit||0;let f=0;typeof i?.offset=="number"?f=i.offset:Array.isArray(i?.offset)&&(d>0&&(f=(i?.offset||[]).filter(h=>h===d).length),c>0&&(f=(i?.offset||[]).filter(h=>h===c).length)),Ae(JSON.stringify(["REQ",n,{cache:["poll_votes",{event_id:t,option:e,limit:u,offset:f}]}]))}),"getZapPollVotes"),ZEe=a((t,e,n,i=0)=>{let s=t,r,o;if(t.startsWith("note1")&&(s=au(t)),t.startsWith("naddr")){const d=Mp(s);r=d.data.pubkey,o=d.data.identifier,s=void 0}let l={kind:e,limit:20,offset:i};s?l.event_id=s:(l.pubkey=r,l.identifier=o),Ae(JSON.stringify(["REQ",n,{cache:["event_actions",{...l}]}]))},"getEventReactions"),QEe=a((t,e,n=0,i)=>{let s=t,r,o;if(t.startsWith("note1")&&(s=au(t)),t.startsWith("naddr")){const d=Mp(s);r=d.data.pubkey,o=d.data.identifier,s=void 0}let l={limit:20,offset:n};s?l.event_id=s:(l.pubkey=r,l.identifier=o),i&&(l.user_pubkey=i),Ae(JSON.stringify(["REQ",e,{cache:["note_mentions",{...l}]}]))},"getEventQuotes"),nne=a((t,e,n,i,s=0)=>{let r=t,o,l;if(t.startsWith("note1")&&(r=au(t)),t.startsWith("naddr")){const c=Mp(r);o=c.data.pubkey,l=c.data.identifier,r=void 0}let d={limit:i,offset:s};r?d.event_id=r:(d.pubkey=o,d.identifier=l),e&&(d.user_pubkey=e),Ae(JSON.stringify(["REQ",n,{cache:["event_zaps_by_satszapped",{...d}]}]))},"getEventZaps"),JEe=a((t,e)=>{const n=t.startsWith("note1")?au(t):t;Ae(JSON.stringify(["REQ",e,{cache:["note_mentions_count",{event_id:n}]}]))},"getEventQuoteStats"),XEe=a((t,e,n,i)=>{Ae(JSON.stringify(["REQ",i,{cache:["parametrized_replaceable_event",{pubkey:t,kind:n,identifier:e,extended_response:!0}]}
102]))},"getParametrizedEvent"),ine=a((t,e)=>{Ae(JSON.stringify(["REQ",e,{cache:["parametrized_replaceable_events",{events:t,extended_response:!0}]}]))},"getParametrizedEvents"),Q1=a((t,e,n)=>{Ae(JSON.stringify(["REQ",n,{cache:["replaceable_event",{pubkey:t,kind:e}]}]))},"getReplacableEvent"),e_e=a((t,e,n,i,s)=>{Ae(JSON.stringify(["REQ",i,{cache:["get_highlights",{pubkey:t,identifier:e,kind:n,user_pubkey:s}]}]))},"getHighlights"),t_e=a((t,e)=>{const n=`find_repost_${Ee}`;return new Promise(i=>{if(!e){i(void 0);return}let s="";const r=Me(n,{onEvent:(o,l)=>{l.kind===G.Repost&&(s=l.id||"")},onEose:()=>{if(r(),!s||s.length===0){i(void 0);return}i(s)},onNotice:()=>{r(),i(void 0)}});Ae(JSON.stringify(["REQ",n,{cache:["find_reposts",{event_id:t,pubkey:e}]}]))})},"getMyRepostOfEvent"),vo=a(t=>({event_id:t,liked:!1,replied:!1,reposted:!1,zapped:!1}),"noActions$1"),J1=a((t,e=1)=>{try{return JSON.parse(t.content)}catch{return{kind:e,content:"",id:t.id,created_at:t.created_at,pubkey:t.pubkey,sig:t.sig,tags:t.tags}}},"parseRepost"),Hd=a((t,e)=>{const n=(t.tags.find(d=>d[0]==="d")||[])[1],i=t.pubkey,s=e||t.kind,r=t.tags.reduce((d,c)=>c[0]==="r"&&d.length<2?[...d,c[1]]:d,[]),o=`${s}:${i}:${n}`,l=Ce.naddrEncode({kind:s,pubkey:i,identifier:n,relays:r});return{coordinate:o,naddr:l}},"encodeCoordinate"),Ry=a((t,e)=>{const n=t?.users[e.pubkey];let i={};try{i=JSON.parse(n?.content||"{}")}catch(l){ii("Bad user metadata: ",l)}const s=t?.noteStats[e.id],r={id:e.id,author:e.pubkey,kind:e.kind,relays:WK(e.tags)},o={id:e.id};return{user:{id:n?.id||"",pubkey:n?.pubkey||e.pubkey,npub:Ii(n?.pubkey||e.pubkey),name:i.name||n?.pubkey,about:i.about||"",picture:i.picture||"",nip05:i.nip05||"",banner:i.banner||"",displayName:i.display_name||"",location:i.location||"",lud06:i.lud06||"",lud16:i.lud16||"",website:i.website||"",tags:n?.tags||[],msg:{...n}},note:{id:e.id,pubkey:e.pubkey,created_at:e.created_at||0,tags:e.tags,content:Sn(e.content),kind:e.kind,sig:e.sig,likes:s?.likes||0,mentions:s?.mentions||0,reposts:s?.reposts||0,replies:s?.replies||0,zaps:s?.zaps||0,score:s?.score||0,score24h:s?.score24h||0,satszapped:s?.satszapped||0,noteId:Ce.neventEncode(r),noteIdShort:Ce.neventEncode(o),noteActions:t.noteActions&&t.noteActions[e.id]||vo(e.id),relayHints:t.relayHints}}},"extractRepostInfo"),$p=a(t=>{let e=[];for(let n=0;n<t.length;n++){const i=t[n];if(["e","a"].includes(i[0])&&i[3]!=="mention"){if(i[3]==="reply"){e=[...i];break}if(i[3]==="root"){e=[...i];continue}}}if(!e){const n=t.filter(s=>s[0]==="e"&&s[3]!=="mention"),i=t.filter(s=>s[0]==="a"&&s[3]!=="mention");n.length===1?e=[...n[0]]:n.length>1?e=[...i[i.length-1]]:n.length>1&&(e=[...n[n.length-1]])}return e},"extractReplyTo"),ky=a((t,e,n="")=>{const i=Object.keys(t.mentions||{}),s=e.tags.reduce((y,b)=>b[0]==="p"?[...y,b[1]]:y,[]),r=t.wordCount||{},o=n.length>0?t.topZaps[n]||[]:t.topZaps[e.id]||[],l=Object.entries(t.users).reduce((y,[b,E])=>({...y,[b]:{...dt(E,b)}}),{});let d={},c={},u={},f={},h={},p={},g={},v={};for(let y=0;y<i.length;y++){let b=i[y];const E=t.mentions&&t.mentions[b];if(!E)continue;const T=t.noteStats[b];c[E.pubkey]=dt(t.users[E.pubkey],E.pubkey);for(let H=0;H<E.tags.length;H++){const N=E.tags[H];N[0]!=="p"||c[N[1]]||(c[N[1]]=dt(t.users[N[1]],N[1]))}const I=t.noteStats[b],M=(t.noteActions&&t.noteActions[b])??vo(b);if([G.Text].includes(E.kind)){const H={id:E.id,author:E.pubkey,kind:E.kind,relays:E.tags.reduce((D,L,m)=>L[0]==="r"&&(L[1].startsWith("wss://")||L[1].startsWith("ws://"))?[...D,L[1]]:D,[]).slice(0,3)},N={id:E.id};let $=E.id,F=E.id;try{$=Ce.neventEncode(H),F=Ce.neventEncode(N)}catch{Tn("ERROR encoding nevent: ",H)}d[b]={post:{...E,noteId:$,noteIdShort:F,likes:I?.likes||0,mentions:I?.mentions||0,reposts:I?.reposts||0,replies:I?.replies||0,zaps:I?.zaps||0,score:I?.score||0,score24h:I?.score24h||0,satszapped:I?.satszapped||0,noteActions:M},msg:{...E},content:E.content,user:c[E.pubkey],mentionedUsers:l,pubkey:E.pubkey,id:E.id,noteId:$,noteIdShort:F}}if([G.LongForm,G.LongFormShell].includes(E.kind)){const{coordinate:H,naddr:N}=Hd(E,G.LongForm),[$,F,D]=H.split(":"),L=Ce.naddrEncode({kind:parseInt($),pubkey:F,identifier:D}),m=r[E.id]||0,S=E.tags.reduce((A,x)=>{if(x[0]!=="published_at")return A;const C=parseInt(x[1]);return C>A?C:A},0);let _={id:E.id,pubkey:E.pubkey,title:"",summary:"",image:"",tags:[],published:S||E.created_at||0,content:Sn(E.content||""),user:c[E.pubkey],topZaps:t.topZaps[E.id]||[],naddr:N,noteId:N,noteIdShort:L,coordinate:H,msg:E,mentionedNotes:d,mentionedUsers:{...l}
102,wordCount:m,noteActions:M,bookmarks:T?.bookmarks||0,likes:T?.likes||0,mentions:T?.mentions||0,reposts:T?.reposts||0,replies:T?.replies||0,zaps:T?.zaps||0,score:T?.score||0,score24h:T?.score24h||0,satszapped:T?.satszapped||0,relayHints:t.relayHints};E.tags.forEach(A=>{switch(A[0]){case"t":_.tags.push(A[1]);break;case"title":_.title=A[1];break;case"summary":_.summary=A[1];break;case"image":_.image=A[1];break;case"published":_.published=parseInt(A[1]);break;case"client":_.client=A[1];break}}),f[_.naddr]={..._}}if([G.Highlight].includes(E.kind)&&(u[b]={user:dt(t.users[E.pubkey],E.pubkey),event:{...E}}),[G.Zap].includes(E.kind)){const H=(E.tags.find(C=>C[0]==="bolt11")||[])[1],N=JSON.parse((E.tags.find(C=>C[0]==="description")||[])[1]||"{}"),$=N.pubkey,F=N.tags.find(C=>C[0]==="p")[1];let D="",L=0;const m=N.tags.find(C=>C[0]==="a"),S=N.tags.find(C=>C[0]==="e"),_=N.tags.find(C=>C[0]==="p");if(m){const[C,U,R]=m[1].split(":");D=Ce.naddrEncode({kind:C,pubkey:U,identifier:R}),L=t.reads.find(P=>P.id===D)?.kind||0}else if(S){D=S[1];const C=t.reads.find(R=>R.id===D),U=t.notes.find(R=>R.id===D);L=C?.kind||U?.kind||0}else _&&(D=_[1],L=G.Metadata);const A=t.users[$]?dt(t.users[$],$):$,x=t.users[F]?dt(t.users[F],F):F;p[b]={id:E.id,message:E.content||"",amount:vs(H)||0,sender:A,reciver:x,created_at:E.created_at,zappedId:D,zappedKind:L}}if([G.LiveEvent].includes(E.kind)){const{coordinate:H,naddr:N}=Hd(E,G.LiveEvent),[$,F,D]=H.split(":");Ce.naddrEncode({kind:parseInt($),pubkey:F,identifier:D});const L={id:(E.tags?.find(m=>m[0]==="d")||[])[1],url:(E.tags?.find(m=>m[0]==="streaming")||[])[1],image:(E.tags?.find(m=>m[0]==="image")||[])[1],status:(E.tags?.find(m=>m[0]==="status")||[])[1],starts:parseInt((E.tags?.find(m=>m[0]==="starts")||["","0"])[1]),summary:(E.tags?.find(m=>m[0]==="summary")||[])[1],title:(E.tags?.find(m=>m[0]==="title")||[])[1],client:(E.tags?.find(m=>m[0]==="client")||[])[1],currentParticipants:parseInt((E.tags?.find(m=>m[0]==="current_participants")||["","0"])[1]||"0"),pubkey:E.pubkey,hosts:(E.tags||[]).filter(m=>m[0]==="p"&&m[3].toLowerCase()==="host").map(m=>m[1]),participants:(E.tags||[]).filter(m=>m[0]==="p").map(m=>m[1])};h[N]={...L}}if([G.UserPoll].includes(E.kind)){const H={id:E.id,author:E.pubkey,kind:E.kind,relays:E.tags.reduce((_,A,x)=>A[0]==="r"&&(A[1].startsWith("wss://")||A[1].startsWith("ws://"))?[..._,A[1]]:_,[]).slice(0,3)},N={id:E.id};let $=E.id,F=E.id;try{$=Ce.neventEncode(H),F=Ce.neventEncode(N)}catch{Tn("ERROR encoding nevent: ",H)}const D=E.tags.reduce((_,A,x)=>A[0]!=="option"?_:[..._,{id:A[1],label:A[2],index:x}],[]),L=t.pollResults[E.id],m=parseInt((E.tags.find(_=>_[0]==="endsAt")||["endsAt",`${Gl()}`])[1]),S=t.noteStats[E.id];g[b]={user:c[E.pubkey],msg:{...E},mentionedNotes:d,mentionedUsers:{...l},mentionedHighlights:u,mentionedArticles:f,mentionedZaps:p,mentionedLiveEvents:h,id:E.id,tags:E.tags,noteId:Ce.neventEncode(H),noteIdShort:Ce.neventEncode(N),pubkey:E.pubkey,question:Sn(E.content),choices:D,results:L,relayHints:t.relayHints,noteActions:(t.noteActions&&t.noteActions[E.id])??vo(E.id),endsAt:m,topZaps:o,stats:S}}if([G.ZapPoll].includes(E.kind)){const H={id:E.id,author:E.pubkey,kind:E.kind,relays:E.tags.reduce((x,C,U)=>C[0]==="r"&&(C[1].startsWith("wss://")||C[1].startsWith("ws://"))?[...x,C[1]]:x,[]).slice(0,3)},N={id:E.id};let $=E.id,F=E.id;try{$=Ce.neventEncode(H),F=Ce.neventEncode(N)}catch{Tn("ERROR encoding nevent: ",H)}const D=E.tags.reduce((x,C,U)=>C[0]!=="poll_option"?x:[...x,{id:C[1],label:C[2],index:U}],[]),L=t.pollResults[E.id],m=parseInt((E.tags.find(x=>x[0]==="closed_at")||["closed_at",`${Gl()}`])[1]),S=t.noteStats[E.id],_=parseInt((E.tags.find(x=>x[0]==="value_minimum")||["value_minimum","0"])[1]),A=parseInt((E.tags.find(x=>x[0]==="value_maximum")||["value_maximum","0"])[1]);v[b]={user:c[E.pubkey],msg:{...E},mentionedNotes:d,mentionedUsers:{...l},mentionedHighlights:u,mentionedArticles:f,mentionedZaps:p,mentionedLiveEvents:h,id:E.id,tags:E.tags,noteId:Ce.neventEncode(H),noteIdShort:Ce.neventEncode(N),pubkey:E.pubkey,question:Sn(E.content),choices:D,results:L,relayHints:t.relayHints,noteActions:(t.noteActions&&t.noteActions[E.id])??vo(E.id),endsAt:m,topZaps:o,stats:S,zapLimits:{min:_,max:A}}}}if(s&&s.length>0)for(let y=0;y<s.length;y++){const b=s[y],E=t.users&&t.users[b];c[b]=dt(E,b)}for(let y=0;y<o.length;y++){const b=o[y];c[b.pubkey]||(c[b.pubkey]=dt(t.users[b.pubkey],b.pubkey))}return{mentionedNotes:d,mentionedArticles:f,mentionedUsers:c,mentionedHighlights:u,mentionedZaps:p,mentionedLiveEvents:h,mentionedUserPolls:g,mentionedZapPolls:v}},"extractMentions"),uU=a(t=>{if(t===void 0)return[];let e=t.userStats||{},n=Object.keys(t.userFollowerCounts);return n.length>
1020&&n.forEach(i=>{e[i]?e[i].followers_count=t.userFollowerCounts[i]:e[i]={pubkey:i,followers_count:t.userFollowerCounts[i],follows_count:0,note_count:0,reply_count:0,time_joined:0,total_zap_count:0,total_satszapped:0,relay_count:0,media_count:0,long_form_note_count:0,followers_increase:{increase:0,ratio:0,count:0}}}),n=Object.keys(t.userFollowerIncrease),n.length>0&&n.forEach(i=>{e[i]?e[i].followers_increase=t.userFollowerIncrease[i]:e[i]={pubkey:i,followers_count:0,follows_count:0,note_count:0,reply_count:0,time_joined:0,total_zap_count:0,total_satszapped:0,relay_count:0,media_count:0,long_form_note_count:0,followers_increase:t.userFollowerIncrease[i]}}),Object.values(t.users).map(i=>dt(i,i.pubkey,e))},"convertToUsersMega"),fU=a(t=>{if(t===void 0)return[];let e=0,n=[];for(e=0;e<t.notes.length;e++){const i=t.notes[e],s=i.kind===G.Repost?J1(i):i,r=i.kind===G.Repost?Ry(t,i):void 0,o=dt(t.users[s.pubkey],s.pubkey),l=t.noteStats[s.id],d=t.topZaps[s.id]||[],c=s.tags||[],u=$p(c);let{mentionedNotes:f,mentionedArticles:h,mentionedUsers:p,mentionedHighlights:g,mentionedZaps:v,mentionedLiveEvents:y,mentionedUserPolls:b,mentionedZapPolls:E}=ky(t,s);const T={id:s.id,author:s.pubkey,kind:s.kind,relays:c.reduce((H,N)=>N[0]==="r"&&(N[1].startsWith("wss://")||N[1].startsWith("ws://"))?[...H,N[1]]:H,[]).slice(0,2)},I={id:s.id},M={user:o,post:{id:s.id,pubkey:s.pubkey,created_at:s.created_at||0,tags:s.tags,content:Sn(s.content),kind:s.kind,sig:s.sig,likes:l?.likes||0,mentions:l?.mentions||0,reposts:l?.reposts||0,replies:l?.replies||0,zaps:l?.zaps||0,score:l?.score||0,score24h:l?.score24h||0,satszapped:l?.satszapped||0,noteId:Ce.neventEncode(T),noteIdShort:Ce.neventEncode(I),noteActions:(t.noteActions&&t.noteActions[s.id])??vo(s.id),relayHints:t.relayHints},repost:r,msg:s,mentionedNotes:f,mentionedUsers:p,mentionedHighlights:g,mentionedArticles:h,mentionedZaps:v,mentionedLiveEvents:y,mentionedUserPolls:b,mentionedZapPolls:E,replyTo:u&&u[1],tags:s.tags,id:s.id,noteId:Ce.neventEncode(T),noteIdShort:Ce.neventEncode(I),pubkey:s.pubkey,topZaps:d,content:Sn(s.content),relayHints:t.relayHints};n.push(M)}return n},"convertToNotesMega"),n_e=a((t,e,n)=>{const i=t.tags||[],s=$p(i),r=n?.relayHints,o={id:t.id,author:t.pubkey,kind:t.kind,relays:i.reduce((f,h)=>h[0]==="r"&&(h[1].startsWith("wss://")||h[1].startsWith("ws://"))?[...f,h[1]]:f,[]).slice(0,2)},l={id:t.id},d=Ce.neventEncode(o),c=Ce.neventEncode(l),u=Sn(t.content);return{user:e,post:{id:t.id,pubkey:t.pubkey,created_at:t.created_at||0,tags:i,content:u,kind:t.kind,sig:t.sig,likes:0,mentions:0,reposts:0,replies:0,zaps:0,score:0,score24h:0,satszapped:0,noteId:d,noteIdShort:c,noteActions:vo(t.id),relayHints:r},msg:t,mentionedNotes:n?.noteRefs,mentionedUsers:n?.userRefs,mentionedArticles:n?.articleRefs,mentionedHighlights:n?.highlightRefs,replyTo:s&&s[1],id:t.id,pubkey:t.pubkey,noteId:d,noteIdShort:c,tags:i,topZaps:[],content:u,relayHints:r}},"buildPostedNote"),hU=a(t=>{if(t===void 0)return[];let e=0,n=[];for(e=0;e<t.reads.length;e++){const i=t.reads[e],{coordinate:s,naddr:r}=Hd(i,G.LongForm),[o,l,d]=s.split(":"),c=Ce.naddrEncode({kind:parseInt(o),pubkey:l,identifier:d}),u=dt(t.users[i.pubkey],i.pubkey),f=t.noteStats[i.id],h=t.topZaps[c]||t.topZaps[i.id]||[],p=(t.wordCount||{})[i.id]||0;i.kind===G.Repost&&Ry(t,i);const g=i.tags||[],v=g.reduce((D,L)=>L[0]==="p"?[...D,L[1]]:D,[]);$p(g);for(let D=0;D<h.length;D++)v.includes(h[D].pubkey)||v.push(h[D].pubkey);const{mentionedNotes:y,mentionedArticles:b,mentionedUsers:E,mentionedHighlights:T,mentionedZaps:I,mentionedLiveEvents:M,mentionedUserPolls:H,mentionedZapPolls:N}=ky(t,i,c),$=i.tags.reduce((D,L)=>{if(L[0]!=="published_at")return D;const m=parseInt(L[1]);return m>D?m:D},0);let F={id:i.id,pubkey:i.pubkey,title:"",summary:"",image:"",tags:[],published:$||i.created_at||0,content:Sn(i.content||""),user:u,topZaps:h,naddr:r,noteId:r,noteIdShort:c,coordinate:s,msg:{...i,kind:G.LongForm},mentionedNotes:y,mentionedUsers:E,mentionedHighlights:T,mentionedArticles:b,mentionedZaps:I,mentionedLiveEvents:M,mentionedUserPolls:H,mentionedZapPolls:N,wordCount:p,noteActions:(t.noteActions&&t.noteActions[i.id])??vo(i.id),bookmarks:f?.bookmarks||0,likes:f?.likes||0,mentions:f?.mentions||0,reposts:f?.reposts||0,replies:f?.replies||0,zaps:f?.zaps||0,score:f?.score||0,score24h:f?.score24h||0,satszapped:f?.satszapped||0,relayHints:t.relayHints};g.forEach(D=>{switch(D[0]){case"t":F.tags.push(D[1]);break;case"title":F.title=D[1];break;case"summary":F.summary=D[1];break;case"image":F.image=D[1];break;case"published":F.published=parseInt(D[1]);break;case"client":F.client=D[1];break}}),n.push(F)}return n},"convertToReadsMega"),pU=a(t=>{if(t===void 0)return[];let e=0,n=[];for(e=0;e<t.drafts.length;e++){const i=t.drafts[e],s={id:i.id,kind:i.kind,content:i.content,plain:"",client:(i.tags.find(r=>r[0]==="client")||["cilent","unknown"])[1],pubkey:i.pubkey,created_at:i.created_at||0,msg:{...i},noteId:`ndraft1${i.id}`};n.push(s)}return n},"convertToDraftsMega"),gU=a(t=>{if(t===void 0)return[];let e=0,n=[];for(e=0;e<t.userPolls.length;e++){const i=t.userPolls[e],s=i.kind===G.Repost?J1(i,G.UserPoll):i,r=i.kind===G.Repost?Ry(t,i):void 0,o=dt(t.users[s.pubkey],s.pubkey),l=t.pollResults[s.id],d=t.topZaps[s.id]||[],c=t.noteStats[s.id],u=s.tags||[],f=$p(u),h=parseInt((u.find(F=>F[0]==="endsAt")||["endsAt",`${Gl()}`])[1]),p=s.tags.reduce((F,D,L)=>D[0]!=="option"?F:[...F,{id:D[1],label:D[2],index:L}],[]);let{mentionedNotes:g,mentionedArticles:v,mentionedUsers:y,mentionedHighlights:b,mentionedZaps:E,mentionedLiveEvents:T,mentionedUserPolls:I,mentionedZapPolls:M}=ky(t,s);const H={id:s.id,author:s.pubkey,kind:s.kind,relays:u.reduce((F,D)=>D[0]==="r"&&(D[1].startsWith("wss://")||D[1].startsWith("ws://"))?[...F,D[1]]:F,[]).slice(0,2)},N={id:s.id},$={user:o,msg:s,mentionedNotes:g,mentionedUsers:y,mentionedHighlights:b,mentionedArticles:v,mentionedZaps:E,mentionedLiveEvents:T,mentionedUserPolls:I,mentionedZapPolls:M,replyTo:f&&f[1],tags:s.tags,id:s.id,noteId:Ce.neventEncode(H),noteIdShort:Ce.neventEncode(N),pubkey:s.pubkey,question:Sn(s.content),choices:p,results:l,relayHints:t.relayHints,noteActions:(t.noteActions&&t.noteActions[s.id])??vo(s.id),endsAt:h,topZaps:d,stats:c,repost:r};n.push($)}return n},"convertToUserPollsMega"),mU=a(t=>{if(t===void 0)return[];let e=0,n=[];for(e=0;e<t.zapPolls.length;e++){const i=t.zapPolls[e],s=i.kind===G.Repost?J1(i,G.ZapPoll):i,r=i.kind===G.Repost?Ry(t,i):void 0,o=dt(t.users[s.pubkey],s.pubkey),l=t.pollResults[s.id],d=t.topZaps[s.id]||[],c=t.noteStats[s.id],u=s.tags||[],f=$p(u),h=parseInt((u.find(L=>
102L[0]==="closed_at")||["closed_at",`${Gl()}`])[1]),p=parseInt((u.find(L=>L[0]==="value_minimum")||["value_minimum","0"])[1]),g=parseInt((u.find(L=>L[0]==="value_maximum")||["value_maximum","0"])[1]),v=s.tags.reduce((L,m,S)=>m[0]!=="poll_option"?L:[...L,{id:m[1],label:m[2],index:S}],[]);let{mentionedNotes:y,mentionedArticles:b,mentionedUsers:E,mentionedHighlights:T,mentionedZaps:I,mentionedLiveEvents:M,mentionedUserPolls:H,mentionedZapPolls:N}=ky(t,s);const $={id:s.id,author:s.pubkey,kind:s.kind,relays:u.reduce((L,m)=>m[0]==="r"&&(m[1].startsWith("wss://")||m[1].startsWith("ws://"))?[...L,m[1]]:L,[]).slice(0,2)},F={id:s.id},D={user:o,msg:s,mentionedNotes:y,mentionedUsers:E,mentionedHighlights:T,mentionedArticles:b,mentionedZaps:I,mentionedLiveEvents:M,mentionedUserPolls:H,mentionedZapPolls:N,replyTo:f&&f[1],tags:s.tags,id:s.id,noteId:Ce.neventEncode($),noteIdShort:Ce.neventEncode(F),pubkey:s.pubkey,question:Sn(s.content),choices:v,results:l,relayHints:t.relayHints,noteActions:(t.noteActions&&t.noteActions[s.id])??vo(s.id),endsAt:h,topZaps:d,stats:c,repost:r,zapLimits:{min:p,max:g}};n.push(D)}return n},"convertToZapPollsMega"),vU=a(t=>{if(t===void 0)return[];let e=0,n=[];for(e=0;e<t.pollVotes.length;e++){const i=t.pollVotes[e],s=dt(t.users[i.pubkey],i.pubkey),r=(i.tags.find(l=>l[0]==="response")||["response",""])[1],o={user:s,msg:i,tags:i.tags,id:i.id,pubkey:i.pubkey,response:r};n.push(o)}return n},"convertToPollVotesMega"),sne=a((t,e)=>{const n=t?.users[e.pubkey],i=JSON.parse(n?.content||"{}"),s=t?.postStats[e.id],r={id:e.id,author:e.pubkey,kind:e.kind,relays:e.tags.reduce((o,l)=>l[0]==="r"&&(l[1].startsWith("wss://")||l[1].startsWith("ws://"))?[...o,l[1]]:o,[]).slice(0,3)};return{user:{id:n?.id||"",pubkey:n?.pubkey||e.pubkey,npub:Ii(n?.pubkey||e.pubkey),name:i.name||n?.pubkey,about:i.about||"",picture:i.picture||"",nip05:i.nip05||"",banner:i.banner||"",displayName:i.display_name||"",location:i.location||"",lud06:i.lud06||"",lud16:i.lud16||"",website:i.website||"",tags:n?.tags||[],msg:{...n}},note:{id:e.id,pubkey:e.pubkey,created_at:e.created_at||0,tags:e.tags,content:Sn(e.content),kind:e.kind,sig:e.sig,likes:s?.likes||0,mentions:s?.mentions||0,reposts:s?.reposts||0,replies:s?.replies||0,zaps:s?.zaps||0,score:s?.score||0,score24h:s?.score24h||0,satszapped:s?.satszapped||0,noteId:Ce.neventEncode(r),noteActions:t.noteActions&&t.noteActions[e.id]||pd(e.id),relayHints:t.relayHints}}},"getRepostInfo"),rne=a((t,e)=>{const n=t.reduce((s,r)=>{if(r.kind!==G.Repost)return s;const o=r.tags.find(l=>l[0]==="e");return o?[...s,o]:s},[]);if(e.kind===G.Repost){const s=e.tags.find(r=>r[0]==="e");return s&&(!!n.find(r=>r[1]===s[1])||t.find(r=>r.id===s[1]))}const i=e.id;return!!n.find(s=>s[1]===i)||t.find(s=>s.id===i)},"isRepostInCollection"),yU=a(t=>{let e={};return t.messages.forEach(n=>{if(n.kind===6&&n.content.length===0){const i=n.tags.find(s=>s[0]==="e");i&&(e[i[1]]=n.id)}}),e},"parseEmptyReposts$1"),X1=a((t,e=1)=>{try{return JSON.parse(t.content)}catch{return{kind:e,content:"",id:t.id,created_at:t.created_at,pubkey:t.pubkey,sig:t.sig,tags:t.tags}}},"parseKind6"),pd=a(t=>({event_id:t,liked:!1,replied:!1,reposted:!1,zapped:!1}),"noActions"),Va=a((t,e)=>{if(t===void 0)return[];const n=t.mentions||{};return t.messages.filter(s=>[G.Text,G.Repost].includes(s.kind)).map(s=>{const r=s.kind===G.Repost?X1(s):s,o=t?.users[r.pubkey],l=t?.postStats[r.id];let d={};try{d=JSON.parse(o?.content||"{}")}catch(D){Tn("Error in user meta JSON: ",D),d={}}const c=Object.keys(n);let u=r.tags?.reduce((D,L)=>L[0]==="p"?[...D,L[1]]:D,[]);const f=s.kind===G.Repost?sne(t,s):void 0;let h;const p=r.tags||[];for(let D=0;D<p.length;D++){const L=p[D];if(L[0]==="e"&&L[3]!=="mention"){if(L[3]==="reply"){h=[...L];break}if(L[3]==="root"){h=[...L];continue}}}if(!h){const D=p.filter(L=>L[0]==="e"&&L[3]!=="mention");D.length===1?h=[...D[0]]:D.length>1&&(h=[...D[D.length-1]])}let g=[];if(e&&e[r.id]){g=e[r.id]||[];for(let D=0;D<g.length;D++)u.includes(g[D].pubkey)||u.push(g[D].pubkey)}let v={},y={},b={},E={},T={},I={},M={};if(c.length>0)for(let D=0;D<c.length;D++){let L=c[D];const m=n&&n[L];if(m){for(let S=0;S<m.tags.length;S++){const _=m.tags[S];_[0]==="p"&&(y[_[1]]=dt(t.users[_[1]],_[1]))}if([G.Text].includes(m.kind)){const S=t.postStats[L],_=(t.noteActions&&t.noteActions[L])??{event_id:L,liked:!1,replied:!1,reposted:!1,zapped:!1}
102,A={id:m.id,author:m.pubkey,kind:m.kind,relays:m.tags.reduce((R,w)=>w[0]==="r"&&(w[1].startsWith("wss://")||w[1].startsWith("ws://"))?[...R,w[1]]:R,[]).slice(0,3)},x={id:m.id},C=Ce.neventEncode(A),U=Ce.neventEncode(x);v[L]={post:{...m,likes:S?.likes||0,mentions:S?.mentions||0,reposts:S?.reposts||0,replies:S?.replies||0,zaps:S?.zaps||0,score:S?.score||0,score24h:S?.score24h||0,satszapped:S?.satszapped||0,noteId:C,noteIdShort:U,noteActions:_},msg:{...m},content:m.content,user:dt(t.users[m.pubkey],m.pubkey),mentionedUsers:y,pubkey:m.pubkey,id:m.id,noteId:C,noteIdShort:U}}if([G.LongForm,G.LongFormShell].includes(m.kind)){t.postStats[L];const S=(t.noteActions&&t.noteActions[L])??{event_id:L,liked:!1,replied:!1,reposted:!1,zapped:!1},_=(m.tags.find(w=>w[0]==="d")||[])[1],A=m.pubkey,x=G.LongForm,C=t.wordCount&&t.wordCount[m.id]||0,U=Ce.naddrEncode({identifier:_,pubkey:A,kind:x});let R={id:m.id,pubkey:m.pubkey,title:"",summary:"",image:"",tags:[],published:m.created_at||0,content:Sn(m.content||""),user:dt(t.users[m.pubkey],m.pubkey),topZaps:[...g],naddr:U,noteId:U,coordinate:`${x}:${A}:${_}`,msg:m,mentionedNotes:v,mentionedUsers:y,wordCount:C,noteActions:S,bookmarks:l?.bookmarks||0,likes:l?.likes||0,mentions:l?.mentions||0,reposts:l?.reposts||0,replies:l?.replies||0,zaps:l?.zaps||0,score:l?.score||0,score24h:l?.score24h||0,satszapped:l?.satszapped||0,relayHints:t.relayHints};m.tags.forEach(w=>{switch(w[0]){case"t":R.tags.push(w[1]);break;case"title":R.title=w[1];break;case"summary":R.summary=w[1];break;case"image":R.image=w[1];break;case"published":R.published=parseInt(w[1]);break;case"client":R.client=w[1];break}}),E[R.naddr]={...R}}if([G.Highlight].includes(m.kind)&&(b[L]={user:dt(t.users[m.pubkey],m.pubkey),event:{...m}}),[G.PollResults].includes(m.kind)){const S=JSON.parse(m.content);t.pollResults={...t.pollResults,...S};return}if([G.LiveEvent].includes(m.kind)){const{coordinate:S,naddr:_}=Hd(m,G.LiveEvent),[A,x,C]=S.split(":");Ce.naddrEncode({kind:parseInt(A),pubkey:x,identifier:C});const U={id:(m.tags?.find(R=>R[0]==="d")||[])[1],url:(m.tags?.find(R=>R[0]==="streaming")||[])[1],image:(m.tags?.find(R=>R[0]==="image")||[])[1],status:(m.tags?.find(R=>R[0]==="status")||[])[1],starts:parseInt((m.tags?.find(R=>R[0]==="starts")||["","0"])[1]),summary:(m.tags?.find(R=>R[0]==="summary")||[])[1],title:(m.tags?.find(R=>R[0]==="title")||[])[1],client:(m.tags?.find(R=>R[0]==="client")||[])[1],currentParticipants:parseInt((m.tags?.find(R=>R[0]==="current_participants")||["","0"])[1]||"0"),pubkey:m.pubkey,hosts:(m.tags||[]).filter(R=>R[0]==="p"&&R[3].toLowerCase()==="host").map(R=>R[1]),participants:(m.tags||[]).filter(R=>R[0]==="p").map(R=>R[1])};T[_]={...U}}if([G.UserPoll].includes(m.kind)){const S=t.postStats[L],_=(t.noteActions&&t.noteActions[m.id])??pd(m.id),A={id:m.id,author:m.pubkey,kind:m.kind,relays:m.tags.reduce((ne,se)=>se[0]==="r"&&(se[1].startsWith("wss://")||se[1].startsWith("ws://"))?[...ne,se[1]]:ne,[]).slice(0,3)},x={id:m.id},C=Ce.neventEncode(A),U=Ce.neventEncode(x),R=m.kind===G.ZapPoll?"poll_option":"option",w=m.kind===G.ZapPoll?"closed_at":"endsAt",P=m.tags.reduce((ne,se,ge)=>se[0]!==R?ne:[...ne,{id:se[1],label:se[2],index:ge}],[]),V=t.pollResults?.[m.id]||{},Z=parseInt((m.tags.find(ne=>ne[0]===w)||[w,`${Gl()}`])[1]),ee={user:y[m.pubkey],msg:{...m},mentionedNotes:v,mentionedUsers:y,mentionedHighlights:b,mentionedArticles:E,mentionedLiveEvents:T,id:m.id,tags:m.tags,noteId:C,noteIdShort:U,pubkey:m.pubkey,question:Sn(m.content),choices:P,results:V,relayHints:t.relayHints,noteActions:_,endsAt:Z,topZaps:[],stats:{...S}};I[m.id]={...ee}}if([G.ZapPoll].includes(m.kind)){const S=t.postStats[L],_=(t.noteActions&&t.noteActions[m.id])??pd(m.id),A={id:m.id,author:m.pubkey,kind:m.kind,relays:m.tags.reduce((ne,se)=>se[0]==="r"&&(se[1].startsWith("wss://")||se[1].startsWith("ws://"))?[...ne,se[1]]:ne,[]).slice(0,3)},x={id:m.id},C=Ce.neventEncode(A),U=Ce.neventEncode(x),R=m.tags.reduce((ne,se,ge)=>se[0]!=="option"?ne:[...ne,{id:se[1],label:se[2],index:ge}],[]),w=t.pollResults?.[m.id]||{},P=parseInt((m.tags.find(ne=>ne[0]==="closed_at")||["closed_at",`${Gl()}`])[1]),V=parseInt((m.tags.find(ne=>ne[0]==="value_minimum")||["value_minimum","0"])[1]),Z=parseInt((m.tags.find(ne=>ne[0]==="value_maximum")||["value_maximum","0"])[1]),ee={user:y[m.pubkey],msg:{...m},mentionedNotes:v,mentionedUsers:y,mentionedHighlights:b,mentionedArticles:E,mentionedLiveEvents:T,id:m.id,tags:m.tags,noteId:C,noteIdShort:U,pubkey:m.pubkey,question:Sn(m.content),choices:R,results:w,relayHints:t.relayHints,noteActions:_,endsAt:P,topZaps:[],stats:{...S},zapLimits:{min:V,max:Z}};M[m.id]={...ee}}}}if(u&&u.length>0)for(let D=0;D<u.length;D++){const L=u[D],m=t.users&&t.users[L];y[L]=dt(m,L)}const H={id:r.id,author:r.pubkey,kind:r.kind,relays:r.tags.reduce((D,L)=>L[0]==="r"&&(L[1].startsWith("wss://")||L[1].startsWith("ws://"))?[...D,L[1]]:D,[]).slice(0,3)},N={id:r.id},$=Ce.neventEncode(H),F=Ce.neventEncode(N);return{user:{id:o?.id||"",pubkey:o?.pubkey||r.pubkey,npub:Ii(o?.pubkey||r.pubkey),name:d.name||o?.pubkey||"",about:d.about||"",picture:d.picture||"",nip05:d.nip05||"",banner:d.banner||"",displayName:d.display_name||"",location:d.location||"",lud06:d.lud06||"",lud16:d.lud16||"",website:d.website||"",tags:o?.tags||[],msg:{...o}},post:{id:r.id,pubkey:r.pubkey,created_at:r.created_at||0,tags:r.tags,content:Sn(r.content),kind:r.kind,sig:r.sig,likes:l?.likes||0,mentions:l?.mentions||0,reposts:l?.reposts||0,replies:l?.replies||0,zaps:l?.zaps||0,score:l?.score||0,score24h:l?.score24h||0,satszapped:l?.satszapped||0,noteId:$,noteIdShort:F,noteActions:(t.noteActions&&t.noteActions[r.id])??pd(r.id),relayHints:t.relayHints},repost:f,msg:r,mentionedNotes:v,mentionedUsers:y,mentionedHighlights:b,mentionedArticles:E,mentionedLiveEvents:T,mentionedUserPolls:I,mentionedZapPolls:M,replyTo:h&&h[1],tags:r.tags,id:r.id,noteId:$,noteIdShort:F,pubkey:r.pubkey,topZaps:[...g],content:Sn(r.content),relayHints:t.relayHints}})},"convertToNotes"),uu=a((t,e)=>{if(t===void 0)return[];const n=t.mentions||{};return t.messages.filter(s=>[G.LongForm,G.Repost,G.LongFormShell].includes(s.kind)).map(s=>{const r=s.kind===G.Repost?X1(s,G.LongForm):s,o=r.pubkey,l=(r.tags.find(N=>N[0]==="d")||[])[1],d=G.LongForm,c=(r.tags||[]).reduce((N,$)=>$[0]==="r"&&N.length<2?[...N,$[1]]:N,[]),u=Ce.naddrEncode({identifier:l,pubkey:o,kind:d,relays:c}),f=t?.users[r.pubkey],h=t?.postStats[r.id],p=Object.keys(n);let g=r.tags?.reduce((N,$)=>$[0]==="p"?[...N,$[1]]:N,[]),v=[];
102if(e&&(e[u]||e[r.id])){v=e[u]||e[r.id]||[];for(let N=0;N<v.length;N++)g.includes(v[N].pubkey)||g.push(v[N].pubkey)}let y={},b={},E={},T={},I={};if(p.length>0)for(let N=0;N<p.length;N++){let $=p[N];const F=n&&n[$];if(F){for(let D=0;D<F.tags.length;D++){const L=F.tags[D];L[0]==="p"&&(b[L[1]]=dt(t.users[L[1]],L[1]))}if([G.Text].includes(F.kind)){const D=t.postStats[$],L=(t.noteActions&&t.noteActions[$])??{event_id:$,liked:!1,replied:!1,reposted:!1,zapped:!1},m={id:F.id,author:F.pubkey,kind:F.kind,relays:F.tags.reduce((x,C)=>C[0]==="r"&&(C[1].startsWith("wss://")||C[1].startsWith("ws://"))?[...x,C[1]]:x,[]).slice(0,3)},S={id:F.id},_=Ce.neventEncode(m),A=Ce.neventEncode(S);y[$]={post:{...F,noteId:_,noteIdShort:A,likes:D?.likes||0,mentions:D?.mentions||0,reposts:D?.reposts||0,replies:D?.replies||0,zaps:D?.zaps||0,score:D?.score||0,score24h:D?.score24h||0,satszapped:D?.satszapped||0,noteActions:L},user:dt(t.users[F.pubkey],F.pubkey),mentionedUsers:b,pubkey:F.pubkey,id:F.id,noteId:_,noteIdShort:A}}if([G.LongForm,G.LongFormShell].includes(F.kind)){t.postStats[$];const D=(t.noteActions&&t.noteActions[$])??{event_id:$,liked:!1,replied:!1,reposted:!1,zapped:!1},L=(F.tags.find(x=>x[0]==="d")||[])[1],m=F.pubkey,S=G.LongForm,_=t.wordCount&&t.wordCount[F.id]||0;let A={id:F.id,pubkey:F.pubkey,title:"",summary:"",image:"",tags:[],published:F.created_at||0,content:Sn(F.content||""),user:dt(f,F.pubkey),topZaps:[...v],naddr:Ce.naddrEncode({identifier:L,pubkey:m,kind:S}),noteId:Ce.naddrEncode({identifier:L,pubkey:m,kind:S}),coordinate:`${S}:${m}:${L}`,msg:F,mentionedNotes:y,mentionedUsers:b,mentionedLiveEvents:I,wordCount:_,noteActions:D,bookmarks:h?.bookmarks||0,likes:h?.likes||0,mentions:h?.mentions||0,reposts:h?.reposts||0,replies:h?.replies||0,zaps:h?.zaps||0,score:h?.score||0,score24h:h?.score24h||0,satszapped:h?.satszapped||0,relayHints:t.relayHints};
102F.tags.forEach(x=>{switch(x[0]){case"t":A.tags.push(x[1]);break;case"title":A.title=x[1];break;case"summary":A.summary=x[1];break;case"image":A.image=x[1];break;case"published":A.published=parseInt(x[1]);break;case"client":A.client=x[1];break}}),T[A.naddr]={...A}}if([G.Highlight].includes(F.kind)&&(E[$]={user:dt(t.users[F.pubkey],F.pubkey),event:{...F}}),[G.LiveEvent].includes(F.kind)){const{coordinate:D,naddr:L}=Hd(F,G.LiveEvent),[m,S,_]=D.split(":");Ce.naddrEncode({kind:parseInt(m),pubkey:S,identifier:_});const A={id:(F.tags?.find(x=>x[0]==="d")||[])[1],url:(F.tags?.find(x=>x[0]==="streaming")||[])[1],image:(F.tags?.find(x=>x[0]==="image")||[])[1],status:(F.tags?.find(x=>x[0]==="status")||[])[1],starts:parseInt((F.tags?.find(x=>x[0]==="starts")||["","0"])[1]),summary:(F.tags?.find(x=>x[0]==="summary")||[])[1],title:(F.tags?.find(x=>x[0]==="title")||[])[1],client:(F.tags?.find(x=>x[0]==="client")||[])[1],currentParticipants:parseInt((F.tags?.find(x=>x[0]==="current_participants")||["","0"])[1]||"0"),pubkey:F.pubkey,hosts:(F.tags||[]).filter(x=>x[0]==="p"&&x[3].toLowerCase()==="host").map(x=>x[1]),participants:(F.tags||[]).filter(x=>x[0]==="p").map(x=>x[1])};I[L]={...A}}}}if(g&&g.length>0)for(let N=0;N<g.length;N++){const $=g[N],F=t.users&&t.users[$];b[$]=dt(F,$)}const M=t.wordCount&&t.wordCount[s.id]||0;let H={id:r.id,pubkey:r.pubkey,title:"",summary:"",image:"",tags:[],published:parseInt((r.tags.find(N=>N[0]==="published_at")||[])[1]||`${r.created_at}`||"0"),content:Sn(r.content||""),user:dt(f,r.pubkey),topZaps:[...v],naddr:Ce.naddrEncode({identifier:l,pubkey:o,kind:d}),noteId:Ce.naddrEncode({identifier:l,pubkey:o,kind:d}),coordinate:`${d}:${o}:${l}`,msg:{...r,kind:d},mentionedNotes:y,mentionedUsers:b,mentionedHighlights:E,mentionedArticles:T,mentionedLiveEvents:I,wordCount:M,noteActions:(t.noteActions&&t.noteActions[r.id])??pd(r.id),bookmarks:h?.bookmarks||0,likes:h?.likes||0,mentions:h?.mentions||0,reposts:h?.reposts||0,replies:h?.replies||0,zaps:h?.zaps||0,score:h?.score||0,score24h:h?.score24h||0,satszapped:h?.satszapped||0,relayHints:t.relayHints};return r.tags.forEach(N=>{switch(N[0]){case"t":H.tags.push(N[1]);break;case"title":H.title=N[1];break;case"summary":H.summary=N[1];break;case"image":H.image=N[1];break;case"published":H.published=parseInt(N[1]);break;case"client":H.client=N[1];break}}),H})},"convertToArticles"),i_e=a((t,e)=>{if(t===void 0)return[];const n=t.mentions||{};return t.messages.filter(s=>[G.UserPoll,G.ZapPoll].includes(s.kind)).map(s=>{const r=s.kind===G.Repost?X1(s,G.LongForm):s,o=r.pubkey,l=(r.tags.find(A=>A[0]==="d")||[])[1],d=G.LongForm,c=(r.tags||[]).reduce((A,x)=>x[0]==="r"&&A.length<2?[...A,x[1]]:A,[]),u=Ce.naddrEncode({identifier:l,pubkey:o,kind:d,relays:c}),f=t?.users[r.pubkey],h=t?.postStats[r.id],p=Object.keys(n);let g=r.tags?.reduce((A,x)=>x[0]==="p"?[...A,x[1]]:A,[]),v=[];if(e&&(e[u]||e[r.id])){v=e[u]||e[r.id]||[];for(let A=0;A<v.length;A++)g.includes(v[A].pubkey)||g.push(v[A].pubkey)}let y={},b={},E={},T={},I={};if(p.length>0)for(let A=0;A<p.length;A++){let x=p[A];const C=n&&n[x];if(C){for(let U=0;U<C.tags.length;U++){const R=C.tags[U];R[0]==="p"&&(b[R[1]]=dt(t.users[R[1]],R[1]))}if([G.Text].includes(C.kind)){const U=t.postStats[x],R=(t.noteActions&&t.noteActions[x])??{event_id:x,liked:!1,replied:!1,reposted:!1,zapped:!1},w={id:C.id,author:C.pubkey,kind:C.kind,relays:C.tags.reduce((ee,ne)=>ne[0]==="r"&&(ne[1].startsWith("wss://")||ne[1].startsWith("ws://"))?[...ee,ne[1]]:ee,[]).slice(0,3)},P={id:C.id},V=Ce.neventEncode(w),Z=Ce.neventEncode(P);y[x]={post:{...C,noteId:V,noteIdShort:Z,likes:U?.likes||0,mentions:U?.mentions||0,reposts:U?.reposts||0,replies:U?.replies||0,zaps:U?.zaps||0,score:U?.score||0,score24h:U?.score24h||0,satszapped:U?.satszapped||0,noteActions:R},user:dt(t.users[C.pubkey],C.pubkey),mentionedUsers:b,mentionedNotes:y,mentionedArticles:T,mentionedHighlights:E,mentionedLiveEvents:I,pubkey:C.pubkey,id:C.id,noteId:V,noteIdShort:Z}}if([G.LongForm,G.LongFormShell].includes(C.kind)){t.postStats[x];const U=(t.noteActions&&t.noteActions[x])??{event_id:x,liked:!1,replied:!1,reposted:!1,zapped:!1},R=(C.tags.find(ee=>ee[0]==="d")||[])[1],w=C.pubkey,P=G.LongForm,V=t.wordCount&&t.wordCount[C.id]||0;let Z={id:C.id,pubkey:C.pubkey,title:"",summary:"",image:"",tags:[],published:C.created_at||0,content:Sn(C.content||""),user:dt(f,C.pubkey),topZaps:[...v],nad
102dr:Ce.naddrEncode({identifier:R,pubkey:w,kind:P}),noteId:Ce.naddrEncode({identifier:R,pubkey:w,kind:P}),coordinate:`${P}:${w}:${R}`,msg:C,mentionedNotes:y,mentionedUsers:b,mentionedLiveEvents:I,wordCount:V,noteActions:U,bookmarks:h?.bookmarks||0,likes:h?.likes||0,mentions:h?.mentions||0,reposts:h?.reposts||0,replies:h?.replies||0,zaps:h?.zaps||0,score:h?.score||0,score24h:h?.score24h||0,satszapped:h?.satszapped||0,relayHints:t.relayHints};C.tags.forEach(ee=>{switch(ee[0]){case"t":Z.tags.push(ee[1]);break;case"title":Z.title=ee[1];break;case"summary":Z.summary=ee[1];break;case"image":Z.image=ee[1];break;case"published":Z.published=parseInt(ee[1]);break;case"client":Z.client=ee[1];break}}),T[Z.naddr]={...Z}}if([G.Highlight].includes(C.kind)&&(E[x]={user:dt(t.users[C.pubkey],C.pubkey),event:{...C}}),[G.LiveEvent].includes(C.kind)){const{coordinate:U,naddr:R}=Hd(C,G.LiveEvent),[w,P,V]=U.split(":");Ce.naddrEncode({kind:parseInt(w),pubkey:P,identifier:V});const Z={id:(C.tags?.find(ee=>ee[0]==="d")||[])[1],url:(C.tags?.find(ee=>ee[0]==="streaming")||[])[1],image:(C.tags?.find(ee=>ee[0]==="image")||[])[1],status:(C.tags?.find(ee=>ee[0]==="status")||[])[1],starts:parseInt((C.tags?.find(ee=>ee[0]==="starts")||["","0"])[1]),summary:(C.tags?.find(ee=>ee[0]==="summary")||[])[1],title:(C.tags?.find(ee=>ee[0]==="title")||[])[1],client:(C.tags?.find(ee=>ee[0]==="client")||[])[1],currentParticipants:parseInt((C.tags?.find(ee=>ee[0]==="current_participants")||["","0"])[1]||"0"),pubkey:C.pubkey,hosts:(C.tags||[]).filter(ee=>ee[0]==="p"&&ee[3].toLowerCase()==="host").map(ee=>ee[1]),participants:(C.tags||[]).filter(ee=>ee[0]==="p").map(ee=>ee[1])};I[R]={...Z}}}}if(g&&g.length>0)for(let A=0;A<g.length;A++){const x=g[A],C=t.users&&t.users[x];b[x]=dt(C,x)}const M=r.kind===G.ZapPoll?"poll_option":"option",H=r.kind===G.ZapPoll?"closed_at":"endsAt",N=r.tags.reduce((A,x,C)=>x[0]!==M?A:[...A,{id:x[1],label:x[2],index:C}],[]),$=t.pollResults[r.id],F=parseInt((r.tags.find(A=>A[0]===H)||[H,`${Gl()}`])[1]),D=parseInt((r.tags.find(A=>A[0]==="value_minimum")||["value_minimum","0"])[1]),L=parseInt((r.tags.find(A=>A[0]==="value_maximum")||["value_maximum","0"])[1]),m={id:r.id,author:r.pubkey,kind:r.kind,relays:r.tags.reduce((A,x,C)=>x[0]==="r"&&(x[1].startsWith("wss://")||x[1].startsWith("ws://"))?[...A,x[1]]:A,[]).slice(0,3)},S={id:r.id};return{user:b[r.pubkey],msg:{...r},mentionedNotes:y,mentionedUsers:b,mentionedHighlights:E,mentionedArticles:T,mentionedLiveEvents:I,id:r.id,tags:r.tags,noteId:Ce.neventEncode(m),noteIdShort:Ce.neventEncode(S),pubkey:r.pubkey,question:Sn(r.content),choices:N,results:$,relayHints:t.relayHints,noteActions:(t.noteActions&&t.noteActions[r.id])??pd(r.id),endsAt:F,topZaps:[],zapLimits:{min:D,max:L},stats:{bookmarks:h?.bookmarks||0,likes:h?.likes||0,mentions:h?.mentions||0,reposts:h?.reposts||0,replies:h?.replies||0,zaps:h?.zaps||0,score:h?.score||0,score24h:h?.score24h||0,satszapped:h?.satszapped||0}}})},"convertToPolls"),s_e=a(t=>t===void 0?[]:t.messages.filter(n=>[G.LiveEvent].includes(n.kind)).map(n=>{const i=n,s=i.pubkey,r=(i.tags.find(d=>d[0]==="d")||[])[1],o=G.LiveEvent,l=(i.tags||[]).reduce((d,c)=>c[0]==="r"&&d.length<2?[...d,c[1]]:d,[]);return Ce.naddrEncode({identifier:r,pubkey:s,kind:o,relays:l}),{id:(i.tags?.find(d=>d[0]==="d")||[])[1],url:(i.tags?.find(d=>d[0]==="streaming")||[])[1],image:(i.tags?.find(d=>d[0]==="image")||[])[1],status:(i.tags?.find(d=>d[0]==="status")||[])[1],starts:parseInt((i.tags?.find(d=>d[0]==="starts")||["","0"])[1]),summary:(i.tags?.find(d=>d[0]==="summary")||[])[1],title:(i.tags?.find(d=>d[0]==="title")||[])[1],client:(i.tags?.find(d=>d[0]==="client")||[])[1],currentParticipants:parseInt((i.tags?.find(d=>d[0]==="current_participants")||["","0"])[1]||"0"),pubkey:i.pubkey,hosts:(i.tags||[]).filter(d=>d[0]==="p"&&d[3].toLowerCase()==="host").map(d=>d[1]),participants:(i.tags||[]).filter(d=>d[0]==="p").map(d=>d[1])}}),"convertToLiveEvents"),My=a((t,e,n)=>{const i=t.repost?t.repost.note:t.post;return(e.repost?e.repost.note:e.post)[n]-i[n]},"sortBy"),one=a((t,e=!1)=>t.sort((n,i)=>{const s=i.msg.created_at-n.msg.created_at;return e?-1*s:s}),"sortEventsByRecency"),bU=a((t,e=!1)=>t.sort((n,i)=>{const s=My(n,i,"created_at");return e?-1*s:s}),"sortByRecency"),ane=a((t,e=!1)=>t.sort((n,i)=>{const s=My(n,i,"score24h");return e?-1*s:s}),"sortByScore24h"),EU=a((t,e=!1)=>t.sort((n,i)=>{const s=My(n,i,"score");return e?-1*s:s}),"sortByScore"),yM=a((t,e=!1)=>t.sort((n,i)=>{const s=My(n,i,"satszapped");return e?-1*s:s}),"sortByZapped"),lne=a((t="")=>{const e={trending:ane,popular:EU,latest:bU,mostzapped:yM,mostzapped4h:yM};return e[t||"latest"]||e.latest},"sortingPlan"),cne=a(t=>{const e={trending:"score24h",popular:"score",latest:"created_at",mostzapped:"satszapped",mostzapped4h:"satszapped"};return e[t||"latest"]||e.latest},"paginationPlan"),r_e=a((t,e)=>{const n=/(?:\s|^)#[^\s!@#$%^&*(),.?":{}|<>]+/ig,i=/\b(nostr:)?((note|npub|nevent|nprofile|naddr)1['qpzry9x8gf2tvdw0s3jn54
102khce6mua7l']+)\b|#\[(\d+)\]/g;let s=[],r=[],o;for(;(o=n.exec(t))!=null;)r.push(["t",o[0].trim().slice(1)]);for(;(o=i.exec(t))!==null;)s.push(o[0]);return s.forEach(l=>{let d=`${l}`;const c=l.search(z9);c>0&&(d=l.slice(c));const u=Ce.decode(d);if(u.type==="npub"){r.push(["p",u.data,"","mention"]);return}if(u.type==="nprofile"){const f=u.data.relays&&u.data.relays[0]||"";r.push(["p",u.data.pubkey,f,"mention"]);return}if(u.type==="note"){r.push(["e",u.data,e&&e[u.data]||"","mention"]);return}if(u.type==="nevent"){const f=u.data.relays&&u.data.relays[0]||"";r.push(["e",u.data.id,f,"mention"]);return}if(u.type==="naddr"){const f=u.data.relays&&u.data.relays[0]||"";r.push(["a",`${u.data.kind}:${u.data.pubkey}:${u.data.identifier}`,f,"mention"]);return}}),r},"referencesToTags"),bM=["82341f882b6eabcd2ba7f1ef90aad961cf074af15b9ef44a09f9d2a8fbfbe6a2","bf2376e17ba4ec269d10fcc996a4746b451152be9031fa48e74553dde5526bce","c48e29f04b482cc01ca1f9ef8c86ef8318c059e0e9353235162f080f26e14c11","85080d3bad70ccdcd7f74c29a44f55bb85cbcd3dd0cbb957da1d215bdb931204","eab0e756d32b80bcd464f3d844b8040303075a13eabc3599a762c9ac7ab91f4f","04c915daefee38317fa734444acee390a8269fe5810b2241e5e6dd343dfbecc9","472f440f29ef996e92a186b8d320ff180c855903882e59d50de1b8bd5669301e","e88a691e98d9987c964521dff60025f60700378a4879180dcbbb4a5027850411","91c9a5e1a9744114c6fe2d61ae4de82629eaaa0fb52f48288093c7e7e036f832","fa984bd7dbb282f07e16e7ae87b26a2a7b9b90b7246a44771f0cf5ae58018f52"],dne={contentQuery:"",users:[],scores:{},contentUsers:[],contentScores:{},notes:[],isFetchingUsers:!1,isFetchingContent:!1,page:{messages:[],users:{},postStats:{},mentions:{},noteActions:{},topZaps:{}},reposts:{},mentionedNotes:{},filteringReasons:[],advancedSearchCommand:""},_U=Pn();function une(t){const e=a(g=>
102{const v=`find_npub_${Ee}`;let y;try{y=Ce.decode(g)}catch{i(g);return}if(!y){i(g);return}const b=typeof y.data=="string"?y.data:y.data.pubkey;let E=[];const T=Me(v,{onEvent:(I,M)=>{if(M){if(M.kind===G.Metadata){const H=M;E.push(dt(H,M.pubkey))}if(M.kind===G.UserScore){const H=JSON.parse(M.content);p("scores",()=>({...H}))}}},onEose:()=>{E.length>0&&p("users",()=>[E[0]]),p("isFetchingUsers",()=>!1),T()}});Na([b],v)},"findUserByNupub"),n=a(g=>{const v=`recomended_users_${Ee}`;let y=[];const b=Me(v,{onEvent:(E,T)=>{if(T){if(T.kind===G.Metadata){const I=T;y.push(dt(I,T.pubkey))}if(T.kind===G.UserScore){const I=JSON.parse(T.content);p("scores",()=>({...I}))}}},onEose:()=>{let E=[];y.forEach(T=>{const I=bM.indexOf(T.pubkey);E[I]={...T}}),g&&(E=[...g,...E].slice(0,9)),p("users",()=>E),p("isFetchingUsers",()=>!1),b()}});p("isFetchingUsers",()=>!0),Na(bM,v)},"getRecomendedUsers"),i=a((g,v)=>{const y=`search_users_${Ee}`;let b=[];const E=Me(y,{onEvent:(I,M)=>{if(M){if(M.kind===G.Metadata){const H=M;b.push(dt(H,M.pubkey));return}if(M.kind===G.UserScore){const H=JSON.parse(M.content);p("scores",()=>({...H}));return}}},onEose:()=>{const I=b.sort((M,H)=>{const N=h.scores[M.pubkey];return h.scores[H.pubkey]-N});p("users",()=>I.slice(0,10)),p("isFetchingUsers",()=>!1),E()}}),T=g.length>0?void 0:v;p("isFetchingUsers",()=>!0),K_(T,y,g)},"findUsers"),s=a((g,v)=>{const y=`search_users_c_${Ee}`;let b=[];const E=Me(y,{onEvent:(I,M)=>{if(M){if(M.kind===G.Metadata){const H=M;b.push(dt(H,M.pubkey));return}if(M.kind===G.UserScore){const H=JSON.parse(M.content);p("contentScores",()=>({...H}));return}}},onEose:()=>{const I=b.sort((M,H)=>{const N=h.scores[M.pubkey];return h.scores[H.pubkey]-N});p("contentUsers",()=>I.slice(0,10)),E()}}),T=g.length>0?void 0:v;p("isFetchingUsers",()=>!0),K_(T,y,g)},"findContentUsers"),r=a(g=>{p("notes",()=>[...g]),p("isFetchingContent",()=>!1)},"saveNotes"),o=a(g=>{if(g.kind===G.Metadata){const v=g;p("page","users",y=>({...y,[v.pubkey]:{...v}}));return}if([G.LongForm,G.LongFormShell,G.Text,G.Repost].includes(g.kind)){const v=g;p("page","messages",y=>[...y,{...v}]);return}if(g.kind===G.NoteStats){const y=JSON.parse(g.content);p("page","postStats",b=>({...b,[y.event_id]:{...y}}));return}if(g.kind===G.Mentions){const y=JSON.parse(g.content);p("page","mentions",b=>({...b,[y.id]:{...y}}));return}if(g.kind===G.NoteActions){const y=JSON.parse(g.content);p("page","noteActions",b=>({...b,[y.event_id]:{...y}}));return}},"updatePage"),l=a(g=>{const v=Va(g);r(v)},"savePage"),d=a(g=>{const v=`search_content_${Ee}`,y=Me(v,{onEvent:(b,E)=>{o(E)},onEose:()=>{l(h.page),y()}});p("isFetchingContent",()=>!0),p("notes",()=>[]),p("page",{messages:[],users:{},postStats:{},mentions:{},noteActions:{}}),hne(z.publicKey,v,g)},"findContent"),c=a(g=>{p("contentQuery",()=>g)},"setContentQuery"),u=a(g=>{const v=au(g);let y=[];if(v.length>0){const b=`search_filtered_users_${Ee}`,E=Me(b,{onEvent:(T,I)=>{if(I?.kind===G.FilteringReason){const M=JSON.parse(I.content);if(M.action==="allow")return;if(M.pubkey){y.push(M.pubkey);return}if(M.group){y.push(M.group);return}}},onEose:()=>{p("filteringReasons",()=>[...y]),E()}});SU(v,z.publicKey,b)}},"findFilteredUserByNpub"),f=a(g=>{p("advancedSearchCommand",()=>g)},"setAdvancedSearchCommand"),[h,p]=li({...dne,actions:{findUsers:i,findUserByNupub:e,findContent:d,findContentUsers:s,setContentQuery:c,getRecomendedUsers:n,findFilteredUserByNpub:u,setAdvancedSearchCommand:f}});return X(_U.Provider,{value:h,get children(){return t.children}})}a(une,"SearchProvider");function fne(){return Dn(_U)}a(fne,"useSearchContext");const wU=a(t=>Sn(t),"cleanQuery"),K_=a((t,e,n,i=10)=>{let s={query:wU(n),limit:i};t&&(s.pubkey=t),Ae(JSON.stringify(["REQ",e,{cache:["user_search",s]}]))},"searchUsers"),hne=a((t,e,n,i=100)=>{let s={query:wU(n),limit:i};t&&(s.user_pubkey=t),Ae(JSON.stringify(["REQ",e,{cache:["search",s]}]))},"searchContent"),SU=a((t,e,n)=>{!t||!e||Ae(JSON.stringify(["REQ",n,{cache:["search_filterlist",{pubkey:t,user_pubkey:e}]}]))},"searchFilteredUsers"),pne=a((t,e,n,i)=>{t||(t=Xv.names.primal),Ae(JSON.stringify(["REQ",i,{cache:["scored",{user_pubkey:t,selector:e}]}]))},"getScoredUsers"),gne=a(t=>{Ae(JSON.stringify(["REQ",t,{cache:["get_recommended_reads"]}]))},"getRecomendedArticleIds"),o_e=a(t=>{Ae(JSON.stringify(["REQ",t,{cache:["get_advanced_feeds"]}]))},"getAdvancedFeeds"),TU=a((t,e,n,i=20,s=0,r=0)=>{let o={specification:e,limit:i};n&&(o.user_pubkey=n),s>0&&(o.until=s),r>0&&(o.offset=r),Ae(JSON.stringify(["REQ",t,{cache:["advanced_feed",o]}]))},"getFeedItems"),a_e=a((t,e,n)=>new Promise((i,s)=>{let r=ci();const o=Me(n,{onEvent:(l,d)=>{d&&vi(r,d)},onEose:()=>{o();const l=Bi(r);i(l.drafts)}});lu(t,[...e],n,!0)}),"fetchDrafts"),l_e=a((t,e,n)=>new Promise(i=>{let s={...ci()};const r=Me(n,{onEvent:(o,l)=>{l&&vi(s,l)},onEose:()=>{r(),i(Bi(s))},onNotice:(o,l)=>{r(),i({...gs()})}});lu(t,[...e],n,!0)}),"fetchEvents"),c_e=a((t,e,n)=>new Promise((i,s)=>{let r={users:{},messages:[],postStats:{},mentions:{},noteActions:{},relayHints:{},topZaps:{},since:0,until:0},o;const l=Me(n,{onEvent:(c,u)=>{u&&d(u)},onEose:()=>{l();const c=Va(r,r.topZaps);i(c)}});lu(t,[...e],n,!0);const d=a(c=>{if(c.kind===G.Metadata){const u=c;r.users[u.pubkey]={...u};return}if([G.Text,G.Repost].includes(c.kind)){const u=c;o?.id!==u.id&&r.messages.push({...u});return}if(c.kind===G.NoteStats){const f=JSON.parse(c.content);r.postStats[f.event_id]={...f};return}if(c.kind===G.Mentions){const f=JSON.parse(c.content);r.mentions||(r.mentions={}),r.mentions[f.id]={...f};return}if(c.kind===G.NoteActions){const f=JSON.parse(c.content);r.noteActions[f.event_id]={...f};return}if(c.kind===G.LinkMetadata){Io(JSON.parse(c.content));return}if(c.kind===G.RelayHint){const u=JSON.parse(c.content);r.relayHints={...r.relayHints,...u};return}if(c?.kind===G.Zap){const u=c.tags.find(b=>b[0]==="description");if(!u)return;const f=JSON.parse(u[1]||"{}");let h="0",p=c?.tags?.find(b=>b[0]==="bolt11");
102if(p)try{h=`${vs(p[1])||0}`}catch{const E=f.tags.find(T=>T[0]==="amount");h=E?E[1]:"0"}const g=(f.tags.find(b=>b[0]==="e")||[])[1],v={id:f.id,amount:parseInt(h||"0"),pubkey:f.pubkey,message:f.content,eventId:g};if(r.topZaps[g]===void 0){r.topZaps[g]=[{...v}];return}if(r.topZaps[g].find(b=>b.id===v.id))return;const y=[...r.topZaps[g],{...v}].sort((b,E)=>E.amount-b.amount);r.topZaps[g]=[...y];return}if(c.kind===G.NoteQuoteStats){JSON.parse(c.content);return}},"updatePage")}),"fetchNotes"),mne=a((t,e)=>new Promise((n,i)=>{let s={users:{},messages:[],postStats:{},mentions:{},noteActions:{},relayHints:{},topZaps:{},since:0,until:0,wordCount:{}};const r=t.reduce((c,u)=>{const f=Mp(u);if(!f.data||f.type!=="naddr"||typeof f.data=="string")return c;const{pubkey:h,identifier:p,kind:g}=f.data;return[...c,{identifier:p,pubkey:h,kind:g}]},[]);let o;const l=Me(e,{onEvent:(c,u)=>{u&&d(u)},onEose:()=>{l();const c=uu(s,s.topZaps);n(c)}});ine(r,e);const d=a(c=>{if(c.kind===G.Metadata){const u=c;s.users[u.pubkey]={...u};return}if([G.LongForm,G.LongFormShell,G.Repost].includes(c.kind)){const u=c;o?.id!==u.id&&s.messages.push({...u});return}if(c.kind===G.NoteStats){const f=JSON.parse(c.content);s.postStats[f.event_id]={...f};return}if(c.kind===G.Mentions){const f=JSON.parse(c.content);s.mentions||(s.mentions={}),s.mentions[f.id]={...f};return}if(c.kind===G.NoteActions){const f=JSON.parse(c.content);s.noteActions[f.event_id]={...f};return}if(c.kind===G.LinkMetadata){Io(JSON.parse(c.content));return}if(c.kind===G.RelayHint){const u=JSON.parse(c.content);s.relayHints={...s.relayHints,...u};return}if(c?.kind===G.Zap){const u=c.tags.find(b=>b[0]==="description");if(!u)return;const f=JSON.parse(u[1]||"{}");let h="0",p=c?.tags?.find(b=>b[0]==="bolt11");if(p)try{h=`${vs(p[1])||0}`}catch{const E=f.tags.find(T=>T[0]==="amount");h=E?E[1]:"0"}const g=(f.tags.find(b=>b[0]==="e")||[])[1],v={id:f.id,amount:parseInt(h||"0"),pubkey:f.pubkey,message:f.content,eventId:g};if(s.topZaps[g]===void 0){s.topZaps[g]=[{...v}];return}if(s.topZaps[g].find(b=>b.id===v.id))return;const y=[...s.topZaps[g],{...v}].sort((b,E)=>E.amount-b.amount);s.topZaps[g]=[...y];return}if(c.kind===G.WordCount){const u=JSON.parse(c.content);s.wordCount||(s.wordCount={}),s.wordCount[u.event_id]=u.words;return}if(c.kind===G.NoteQuoteStats){JSON.parse(c.content);return}},"updatePage")}),"fetchArticles"),d_e=a((t,e,n,i,s=0,r=10)=>new Promise((o,l)=>{e||l("Missing pubkey");let d={users:{},messages:[],postStats:{},mentions:{},noteActions:{},relayHints:{},topZaps:{},since:0,until:0,wordCount:{}},c;const u=Me(i,{onEvent:(h,p)=>{p&&f(p)},onEose:()=>{u();const h=uu(d,d.topZaps);o(h)}});eK(t,e,i,n,s,r);const f=a(h=>{if(h.kind===G.Metadata){const p=h;d.users[p.pubkey]={...p};return}if([G.LongForm,G.LongFormShell,G.LongFormShell,G.Repost].includes(h.kind)){const p=h;c?.id!==p.id&&d.messages.push({...p});return}if(h.kind===G.NoteStats){const g=JSON.parse(h.content);d.postStats[g.event_id]={...g};return}if(h.kind===G.Mentions){const g=JSON.parse(h.content);d.mentions||(d.mentions={}),d.mentions[g.id]={...g};return}if(h.kind===G.NoteActions){const g=JSON.parse(h.content);d.noteActions[g.event_id]={...g};return}if(h.kind===G.LinkMetadata){Io(JSON.parse(h.content));return}if(h.kind===G.RelayHint){const p=JSON.parse(h.content);d.relayHints={...d.relayHints,...p};return}if(h?.kind===G.Zap){const p=h.tags.find(I=>I[0]==="description");if(!p)return;const g=JSON.parse(p[1]||"{}");let v="0",y=h?.tags?.find(I=>I[0]==="bolt11");if(y)try{v=`${vs(y[1])||0}`}catch{const M=g.tags.find(H=>H[0]==="amount");v=M?M[1]:"0"}const b=(g.tags.find(I=>I[0]==="e")||[])[1],E={id:g.id,amount:parseInt(v||"0"),pubkey:g.pubkey,message:g.content,eventId:b};if(d.topZaps[b]===void 0){d.topZaps[b]=[{...E}];return}if(d.topZaps[b].find(I=>I.id===E.id))return;const T=[...d.topZaps[b],{...E}].sort((I,M)=>M.amount-I.amount);d.topZaps[b]=[...T];return}if(h.kind===G.WordCount){const p=JSON.parse(h.content);d.wordCount||(d.wordCount={}),d.wordCount[p.event_id]=p.words;return}if(h.kind===G.NoteQuoteStats){JSON.parse(h.content);return}},"updatePage")}),"fetchUserArticles"),vne=a((t,e,n)=>new Promise((i,s)=>{e||s("Missing pubkey");let r,o;const l=Me(n,{onEvent:(c,u)=>{u&&d(u)},onEose:()=>{if(l(),!r){s("user not found");return}o&&(r.userStats=o),i(r)}});A1(e,t,n);const d=a(c=>{if(c?.kind===G.Metadata){let u=JSON.parse(c.content);(!u.displayName||typeof u.displayName=="string"&&u.displayName.trim().length===0)&&(u.displayName=u.dis
102play_name),u.pubkey=c.pubkey,u.npub=Ii(c.pubkey),u.created_at=c.created_at,r={...u};return}c.kind===G.UserStats&&(o={...JSON.parse(c.content)})},"updatePage")}),"fetchUserProfile$1"),yne=a(t=>{Ae(JSON.stringify(["REQ",`netstats_${t}`,{cache:["net_stats"]}]))},"startListeningForNostrStats"),bne=a(t=>{Ae(JSON.stringify(["CLOSE",`netstats_${t}`]))},"stopListeningForNostrStats"),Ene=a((t,e)=>{t&&Ae(JSON.stringify(["REQ",`legendstats_${e}`,{cache:["explore_legend_counts",{pubkey:t}]}]))},"getLegendStats"),_ne=a((t,e)=>{t&&Ae(JSON.stringify(["REQ",e,{cache:["articles_stats",{pubkey:t}]}]))},"getArticlesStats"),wne=a((t,e,n)=>{t&&Ae(JSON.stringify(["REQ",n,{cache:["top_article",{pubkey:t,by:e}]}]))},"getTopArticle"),u_e=a((t,e=!0)=>!e||t<1e4?t.toLocaleString():t<1e5?`${parseFloat((t/1e3).toFixed(1))} k`:t<1e6?`${Math.floor(t/1e3)} k`:t<1e8?`${parseFloat((t/1e6).toFixed(1))} m`:`${Math.floor(t/1e6)} m`,"humanizeNumber"),f_e=a((t,e,n)=>new Promise((i,s)=>{let r={users:{},messages:[],postStats:{},mentions:{},noteActions:{},relayHints:{},topZaps:{},since:0,until:0,wordCount:{}},o;const l=Me(n,{onEvent:(c,u)=>{u&&d(u)},onEose:()=>{l();const c=uu(r,r.topZaps);i(c[0])}});wne(t,e,n);const d=a(c=>{if(c.kind===G.Metadata){const u=c;r.users[u.pubkey]={...u};return}if([G.LongForm,G.LongFormShell,G.Repost].includes(c.kind)){const u=c;o?.id!==u.id&&r.messages.push({...u});return}if(c.kind===G.NoteStats){const f=JSON.parse(c.content);r.postStats[f.event_id]={...f};return}if(c.kind===G.Mentions){const f=JSON.parse(c.content);r.mentions||(r.mentions={}),r.mentions[f.id]={...f};return}if(c.kind===G.NoteActions){const f=JSON.parse(c.content);r.noteActions[f.event_id]={...f};return}if(c.kind===G.LinkMetadata){Io(JSON.parse(c.content));return}if(c.kind===G.RelayHint){const u=JSON.parse(c.content);r.relayHints={...r.relayHints,...u};return}if(c?.kind===G.Zap){const u=c.tags.find(b=>b[0]==="description");if(!u)return;const f=JSON.parse(u[1]||"{}");let h="0",p=c?.tags?.find(b=>b[0]==="bolt11");if(p)try{h=`${vs(p[1])||0}`}catch{const E=f.tags.find(T=>T[0]==="amount");h=E?E[1]:"0"}const g=(f.tags.find(b=>b[0]==="e")||[])[1],v={id:f.id,amount:parseInt(h||"0"),pubkey:f.pubkey,message:f.content,eventId:g};if(r.topZaps[g]===void 0){r.topZaps[g]=[{...v}];return}if(r.topZaps[g].find(b=>b.id===v.id))return;const y=[...r.topZaps[g],{...v}].sort((b,E)=>E.amount-b.amount);r.topZaps[g]=[...y];return}if(c.kind===G.WordCount){const u=JSON.parse(c.content);r.wordCount||(r.wordCount={}),r.wordCount[u.event_id]=u.words;return}if(c.kind===G.NoteQuoteStats){JSON.parse(c.content);return}},"updatePage")}),"fetchTopArticle"),h_e=a((t,e)=>new Promise((n,i)=>{let s={articles:0,drafts:0,satszapped:0};const r=Me(e,{onEvent:(o,l)=>{l.kind===G.ArticlesStats&&(s=JSON.parse(l.content||"{ articles: 0, drafts: 0, satszapped: 0}"))},onEose:()=>{r(),n(s)}});_ne(t,e)}),"fetchArticlesStats"),p_e=a((t,e,n,i=20,s=0,r=0)=>new Promise((o,l)=>{let d={users:{},messages:[],postStats:{},mentions:{},noteActions:{},relayHints:{},topZaps:{},since:0,until:0},c;const u=Me(n,{onEvent:(h,p)=>{p&&f(p)},onEose:()=>{u();const h=Va(d,d.topZaps);o(h)}});TU(n,e,t,i,s,r);const f=a(h=>{if(h.kind===G.Metadata){const p=h;d.users[p.pubkey]={...p};return}if([G.Text,G.Repost].includes(h.kind)){const p=h;c?.id!==p.id&&d.messages.push({...p});return}if(h.kind===G.NoteStats){const g=JSON.parse(h.content);d.postStats[g.event_id]={...g};return}if(h.kind===G.Mentions){const g=JSON.parse(h.content);d.mentions||(d.mentions={}),d.mentions[g.id]={...g};return}if(h.kind===G.NoteActions){const g=JSON.parse(h.content);d.noteActions[g.event_id]={...g};return}if(h.kind===G.LinkMetadata){Io(JSON.parse(h.content));return}if(h.kind===G.RelayHint){const p=JSON.parse(h.content);d.relayHints={...d.relayHints,...p};return}if(h?.kind===G.Zap){const p=h.tags.find(I=>I[0]==="description");if(!p)return;const g=JSON.parse(p[1]||"{}");let v="0",y=h?.tags?.find(I=>I[0]==="bolt11");if(y)try{v=`${vs(y[1])||0}`}catch{const M=g.tags.find(H=>H[0]==="amount");v=M?M[1]:"0"}const b=(g.tags.find(I=>I[0]==="e")||[])[1],E={id:g.id,amount:parseInt(v||"0"),pubkey:g.pubkey,message:g.content,eventId:b};if(d.topZaps[b]===void 0){d.topZaps[b]=[{...E}];return}if(d.topZaps[b].find(I=>I.id===E.id))return;const T=[...d.topZaps[b],{...E}].sort((I,M)=>M.amount-I.amount);d.topZaps[b]=[...T];return}if(h.kind===G.NoteQuoteStats){JSON.parse(h.content);return}},"updatePage")}),"fetchNotesFeed"),g_e=a((t,e,n,i=20,s=0,r=0)=>new Promise((o,l)=>{let d={users:{},messages:[],postStats:{},mentions:{},noteActions:{},relayHints:{},topZaps:{},since:0,until:0,wordCount:{}},c;const u=Me(n,{onEvent:(h,p)=>{p&&f(p)},onEose:()=>{u();const h=uu(d,d.topZaps);o(h)}});TU(n,e,t,i,s,r);const f=a(h=>{if(h.kind===G.Metadata){const p=h;d.users[p.pubkey]={...p};return}if([G.LongForm,G.LongFormShell,G.Repost].includes(h.kind)){const p=h;c?.id!==p.id&&d.messages.push({...p});return}if(h.kind===G.NoteStats){const g=JSON.parse(h.content);d.postStats[g.event_id]={...g};return}if(h.kind===G.Mentions){const g=JSON.parse(h.content);d.mentions||(d.mentions={}),d.mentions[g.id]={...g};return}if(h.kind===G.NoteActions){const g=JSON.parse(h.content);d.noteActions[g.event_id]={...g};return}if(h.kind===G.LinkMetadata){Io(JSON.parse(h.content));return}if(h.kind===G.RelayHint){const p=JSON.parse(h.content);d.relayHints={...d.relayHints,...p};return}if(h?.kind===G.Zap){const p=h.tags.find(I=>I[0]==="description");if(!p)return;const g=JSON.parse(p[1]||"{}");
102let v="0",y=h?.tags?.find(I=>I[0]==="bolt11");if(y)try{v=`${vs(y[1])||0}`}catch{const M=g.tags.find(H=>H[0]==="amount");v=M?M[1]:"0"}const b=(g.tags.find(I=>I[0]==="e")||[])[1],E={id:g.id,amount:parseInt(v||"0"),pubkey:g.pubkey,message:g.content,eventId:b};if(d.topZaps[b]===void 0){d.topZaps[b]=[{...E}];return}if(d.topZaps[b].find(I=>I.id===E.id))return;const T=[...d.topZaps[b],{...E}].sort((I,M)=>M.amount-I.amount);d.topZaps[b]=[...T];return}if(h.kind===G.WordCount){const p=JSON.parse(h.content);d.wordCount||(d.wordCount={}),d.wordCount[p.event_id]=p.words;return}if(h.kind===G.NoteQuoteStats){JSON.parse(h.content);return}},"updatePage")}),"fetchArticlesFeed"),Sne=a((t,e,n=0,i=0,s=10)=>new Promise((r,o)=>{t||o("Missing pubkey");let l=[],d={users:{},messages:[],postStats:{},mentions:{},noteActions:{},relayHints:{},topZaps:{},since:0,until:0,sortBy:"created_at",wordCount:{},elements:[]};const c=Me(e,{onEvent:(f,h)=>{h&&u(h)},onEose:()=>{c();const f=d.messages.filter(b=>b.kind===G.Text),h=d.messages.filter(b=>b.kind===G.LongForm),p=Va({...d,messages:[...f]},d.topZaps),g=uu({...d,messages:[...h]},d.topZaps),v={since:d.since||0,until:d.until||0,sortBy:d.sortBy||"created_at",elements:d.elements||[]};let y=[];for(let b=0;b<l.length;b++){const E=l[b],T=(E.tags.find(_=>_[0]==="bolt11")||[])[1],I=JSON.parse((E.tags.find(_=>_[0]==="description")||[])[1]||"{}"),M=I.pubkey,H=I.tags.find(_=>_[0]==="p")[1];let N="",$=0;const F=I.tags.find(_=>_[0]==="a"),D=I.tags.find(_=>_[0]==="e");if(F){const[_,A,x]=F[1].split(":");N=Ce.naddrEncode({kind:_,pubkey:A,identifier:x}),$=h.find(U=>U.id===N)?.kind||0}else if(D){N=D[1];const _=h.find(x=>x.id===N),A=f.find(x=>x.id===N);$=_?.kind||A?.kind||0}if(![G.Text,G.LongForm].includes($))continue;const L=d.users[M]?dt(d.users[M],M):M,m=d.users[H]?dt(d.users[H],H):H,S={id:E.id,message:I.content||"",amount:vs(T)||0,sender:L,reciver:m,created_at:E.created_at,zappedId:N,zappedKind:$};y.find(_=>_.id===S.id)||y.push(S)}r({notes:p,articles:g,zaps:y,paging:v})}});Uq(t,e,n,0,s);const u=a(f=>{if(f?.kind===G.Zap){l.push(f);return}if(f.kind===G.Metadata){const h=f;d.users[h.pubkey]={...h};return}if([G.Text,G.Repost,G.LongForm,G.LongFormShell,G.Repost].includes(f.kind)){const h=f;d.messages.push({...h});return}if(f.kind===G.NoteStats){const p=JSON.parse(f.content);d.postStats[p.event_id]={...p};return}if(f.kind===G.Mentions){const p=JSON.parse(f.content);d.mentions||(d.mentions={}),d.mentions[p.id]={...p};return}if(f.kind===G.NoteActions){const p=JSON.parse(f.content);d.noteActions[p.event_id]={...p};return}if(f.kind===G.LinkMetadata){Io(JSON.parse(f.content));return}if(f.kind===G.RelayHint){const h=JSON.parse(f.content);d.relayHints={...d.relayHints,...h};return}if(f.kind===G.WordCount){const h=JSON.parse(f.content);d.wordCount||(d.wordCount={}),d.wordCount[h.event_id]=h.words;return}if(f.kind===G.NoteQuoteStats){JSON.parse(f.content);return}if(f.kind===G.FeedRange){const h=JSON.parse(f.content||"{}");d.since=h.since,d.until=h.until,d.sortBy=h.order_by,d.elements=[...h.elements];return}},"updatePage")}),"fetchUserZaps"),m_e=a((t,e,n)=>new Promise((i,s)=>{e||s("Missing pubkey");let r;const o=Me(n,{onEvent:(d,c)=>{c&&l(c)},onEose:()=>{o(),r?i(r):s("user not found")}});A1(e,t,n);const l=a(d=>{if(d?.kind===G.Metadata){let c=JSON.parse(d.content);(!c.displayName||typeof c.displayName=="string"&&c.displayName.trim().length===0)&&(c.displayName=c.display_name),c.pubkey=d.pubkey,c.npub=Ii(d.pubkey),c.created_at=d.created_at,r={...c};return}},"updatePage")}),"fetchUserProfile");var Tne=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function v_e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}a(v_e,"getDefaultExportFromCjs$1");function Ane(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=a(function i(){return this instanceof i?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)},"a");n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(i){var s=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(n,i,s.get?s:{enumerable:!0,get:function(){return t[i]}})}),n}a(Ane,"getAugmentedNamespace");
vendor: 4,191 bytes, lines 102-107
102var EM="qpzry9x8gf2tvdw0s3jn54khce6mua7l",_M={};for(var pg=0;pg<EM.length;pg++){var Wb=EM.charAt(pg);if(_M[Wb]!==void 0)throw new TypeError(Wb+" is ambiguous");_M[Wb]=pg}var Hp={},Cy={};Cy.byteLength=Lne;Cy.toByteArray=kne;Cy.fromByteArray=Pne;var Ar=[],Ss=[],xne=typeof Uint8Array<"u"?Uint8Array:Array,zb="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var Ec=0,Ine=zb.length;Ec<Ine;++Ec)Ar[Ec]=zb[Ec],Ss[zb.charCodeAt(Ec)]=Ec;Ss["-".charCodeAt(0)]=62;Ss["_".charCodeAt(0)]=63;function AU(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");n===-1&&(n=e);var i=n===e?0:4-n%4;return[n,i]}a(AU,"getLens");function Lne(t){var e=AU(t),n=e[0],i=e[1];return(n+i)*3/4-i}a(Lne,"byteLength");function Rne(t,e,n){return(e+n)*3/4-n}a(Rne,"_byteLength");function kne(t){var e,n=AU(t),i=n[0],s=n[1],r=new xne(Rne(t,i,s)),o=0,l=s>0?i-4:i,d;for(d=0;d<l;d+=4)e=Ss[t.charCodeAt(d)]<<18|Ss[t.charCodeAt(d+1)]<<12|Ss[t.charCodeAt(d+2)]<<6|Ss[t.charCodeAt(d+3)],r[o++]=e>>16&255,r[o++]=e>>8&255,r[o++]=e&255;return s===2&&(e=Ss[t.charCodeAt(d)]<<2|Ss[t.charCodeAt(d+1)]>>4,r[o++]=e&255),s===1&&(e=Ss[t.charCodeAt(d)]<<10|Ss[t.charCodeAt(d+1)]<<4|Ss[t.charCodeAt(d+2)]>>2,r[o++]=e>>8&255,r[o++]=e&255),r}a(kne,"toByteArray");function Mne(t){return Ar[t>>18&63]+Ar[t>>12&63]+Ar[t>>6&63]+Ar[t&63]}a(Mne,"tripletToBase64");function Cne(t,e,n){for(var i,s=[],r=e;r<n;r+=3)i=(t[r]<<16&16711680)+(t[r+1]<<8&65280)+(t[r+2]&255),s.push(Mne(i));return s.join("")}a(Cne,"encodeChunk");function Pne(t){for(var e,n=t.length,i=n%3,s=[],r=16383,o=0,l=n-i;o<l;o+=r)s.push(Cne(t,o,o+r>l?l:o+r));return i===1?(e=t[n-1],s.push(Ar[e>>2]+Ar[e<<4&63]+"==")):i===2&&(e=(t[n-2]<<8)+t[n-1],s.push(Ar[e>>10]+Ar[e>>4&63]+Ar[e<<2&63]+"=")),s.join("")}a(Pne,"fromByteArray");var eA={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */eA.read=function(t,e,n,i,s){var r,o,l=s*8-i-1,d=(1<<l)-1,c=d>>1,u=-7,f=n?s-1:0,h=n?-1:1,p=t[e+f];for(f+=h,r=p&(1<<-u)-1,p>>=-u,u+=l;u>0;r=r*256+t[e+f],f+=h,u-=8);for(o=r&(1<<-u)-1,r>>=-u,u+=i;u>0;o=o*256+t[e+f],f+=h,u-=8);if(r===0)r=1-c;else{if(r===d)return o?NaN:(p?-1:1)*(1/0);o=o+Math.pow(2,i),r=r-c}return(p?-1:1)*o*Math.pow(2,r-i)};eA.write=function(t,e,n,i,s,r){var o,l,d,c=r*8-s-1,u=(1<<c)-1,f=u>>1,h=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:r-1,g=i?1:-1,v=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(l=isNaN(e)?1:0,o=u):(o=Math.floor(Math.log(e)/Math.LN2),e*(d=Math.pow(2,-o))<1&&(o--,d*=2),o+f>=1?e+=h/d:e+=h*Math.pow(2,1-f),e*d>=2&&(o++,d/=2),o+f>=u?(l=0,o=u):o+f>=1?(l=(e*d-1)*Math.pow(2,s),o=o+f):(l=e*Math.pow(2,f-1)*Math.pow(2,s),o=0));s>=8;t[n+p]=l&255,p+=g,l/=256,s-=8);for(o=o<<s|l,c+=s;c>0;t[n+p]=o&255,p+=g,o/=256,c-=8);t[n+p-g]|=v*128};/*!
103 * The buffer module from node.js, for the browser.
104 *
105 * @author   Feross Aboukhadijeh <https://feross.org>
106 * @license  MIT
107 */(function(t){const e=Cy,n=eA,i=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=l,t.SlowBuffer=E,t.INSPECT_MAX_BYTES=50;const s=2147483647;t.kMaxLength=s,l.TYPED_ARRAY_SUPPORT=r(),!l.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function r(){try{const W=new Uint8Array(1),k={foo:function(){return 42}};return Object.setPrototypeOf(k,Uint8Array.prototype),Object.setPrototypeOf(W,k),W.foo()===42}catch{return!1}}a(r,"typedArraySupport"),Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}});function o(W){if(W>s)throw new RangeError('The value "'+W+'" is invalid for option "size"');const k=new Uint8Array(W);return Object.setPrototypeOf(k,l.prototype),k}a(o,"createBuffer");function l(W,k,O){if(typeof W=="number"){if(typeof k=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return f(W)}
107return d(W,k,O)}a(l,"Buffer"),l.poolSize=8192;function d(W,k,O){if(typeof W=="string")return h(W,k);if(ArrayBuffer.isView(W))return g(W);if(W==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof W);if(ve(W,ArrayBuffer)||W&&ve(W.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ve(W,SharedArrayBuffer)||W&&ve(W.buffer,SharedArrayBuffer)))return v(W,k,O);if(typeof W=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const K=W.valueOf&&W.valueOf();if(K!=null&&K!==W)return l.from(K,k,O);const Q=y(W);if(Q)return Q;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof W[Symbol.toPrimitive]=="function")return l.from(W[Symbol.toPrimitive]("string"),k,O);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof W)}a(d,"from"),l.from=function(W,k,O){return d(W,k,O)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array);function c(W){if(typeof W!="number")throw new TypeError('"size" argument must be of type number');if(W<0)throw new RangeError('The value "'+W+'" is invalid for option "size"')}a(c,"assertSize");function u(W,k,O){return c(W),W<=0?o(W):k!==void 0?typeof O=="string"?o(W).fill(k,O):o(W).fill(k):o(W)}a(u,"alloc"),l.alloc=function(W,k,O){return u(W,k,O)};function f(W){return c(W),o(W<0?0:b(W)|0)}a(f,"allocUnsafe"),l.allocUnsafe=function(W){return f(W)},l.allocUnsafeSlow=function(W){return f(W)};function h(W,k){if((typeof k!="string"||k==="")&&(k="utf8"),!l.isEncoding(k))throw new TypeError("Unknown encoding: "+k);const O=T(W,k)|0;let K=o(O);const Q=K.write(W,k);return Q!==O&&(K=K.slice(0,Q)),K}a(h,"fromString");function p(W){const k=W.length<0?0:b(W.length)|0,O=o(k);for(let K=0;K<k;K+=1)O[K]=W[K]&255;return O}a(p,"fromArrayLike");function g(W){if(ve(W,Uint8Array)){const k=new Uint8Array(W);return v(k.buffer,k.byteOffset,k.byteLength)}return p(W)}a(g,"fromArrayView");function v(W,k,O){if(k<0||W.byteLength<k)throw new RangeError('"offset" is outside of buffer bounds');if(W.byteLength<k+(O||0))throw new RangeError('"length" is outside of buffer bounds');let K;return k===void 0&&O===void 0?K=new Uint8Array(W):O===void 0?K=new Uint8Array(W,k):K=new Uint8Array(W,k,O),Object.setPrototypeOf(K,l.prototype),K}a(v,"fromArrayBuffer");function y(W){if(l.isBuffer(W)){const k=b(W.length)|0,O=o(k);return O.length===0||W.copy(O,0,0,k),O}if(W.length!==void 0)return typeof W.length!="number"||lt(W.length)?o(0):p(W);if(W.type==="Buffer"&&Array.isArray(W.data))return p(W.data)}a(y,"fromObject");function b(W){if(W>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return W|0}a(b,"checked");function E(W){return+W!=W&&(W=0),l.alloc(+W)}a(E,"SlowBuffer"),l.isBuffer=a(function(k){return k!=null&&k._isBuffer===!0&&k!==l.prototype},"isBuffer"),l.compare=a(function(k,O){if(ve(k,Uint8Array)&&(k=l.from(k,k.offset,k.byteLength)),ve(O,Uint8Array)&&(O=l.from(O,O.offset,O.byteLength)),!l.isBuffer(k)||!l.isBuffer(O))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(k===O)return 0;let K=k.length,Q=O.length;for(let ce=0,oe=Math.min(K,Q);ce<oe;++ce)if(k[ce]!==O[ce]){K=k[ce],Q=O[ce];break}return K<Q?-1:Q<K?1:0},"compare"),l.isEncoding=a(function(k){switch(String(k).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},"isEncoding"),l.concat=a(function(k,O){if(!Array.isArray(k))throw new TypeError('"list" argument must be an Array of Buffers');if(k.length===0)return l.alloc(0);let K;if(O===void 0)for(O=0,K=0;K<k.length;++K)O+=k[K].length;const Q=l.allocUnsafe(O);let ce=0;for(K=0;K<k.length;++K){let oe=k[K];if(ve(oe,Uint8Array))ce+oe.length>Q.length?(l.isBuffer(oe)||(oe=l.from(oe)),oe.copy(Q,ce)):Uint8Array.prototype.set.call(Q,oe,ce);else if(l.isBuffer(oe))oe.copy(Q,ce);else throw new TypeError('"list" argument must be an Array of Buffers');ce+=oe.length}return Q},"concat");
vendor: 12,502 bytes, line 107
107function T(W,k){if(l.isBuffer(W))return W.length;if(ArrayBuffer.isView(W)||ve(W,ArrayBuffer))return W.byteLength;if(typeof W!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof W);const O=W.length,K=arguments.length>2&&arguments[2]===!0;if(!K&&O===0)return 0;let Q=!1;for(;;)switch(k){case"ascii":case"latin1":case"binary":return O;case"utf8":case"utf-8":return we(W).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O*2;case"hex":return O>>>1;case"base64":return he(W).length;default:if(Q)return K?-1:we(W).length;k=(""+k).toLowerCase(),Q=!0}}a(T,"byteLength"),l.byteLength=T;function I(W,k,O){let K=!1;if((k===void 0||k<0)&&(k=0),k>this.length||((O===void 0||O>this.length)&&(O=this.length),O<=0)||(O>>>=0,k>>>=0,O<=k))return"";for(W||(W="utf8");;)switch(W){case"hex":return R(this,k,O);case"utf8":case"utf-8":return _(this,k,O);case"ascii":return C(this,k,O);case"latin1":case"binary":return U(this,k,O);case"base64":return S(this,k,O);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,k,O);default:if(K)throw new TypeError("Unknown encoding: "+W);W=(W+"").toLowerCase(),K=!0}}a(I,"slowToString"),l.prototype._isBuffer=!0;function M(W,k,O){const K=W[k];W[k]=W[O],W[O]=K}a(M,"swap"),l.prototype.swap16=a(function(){const k=this.length;if(k%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let O=0;O<k;O+=2)M(this,O,O+1);return this},"swap16"),l.prototype.swap32=a(function(){const k=this.length;if(k%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let O=0;O<k;O+=4)M(this,O,O+3),M(this,O+1,O+2);return this},"swap32"),l.prototype.swap64=a(function(){const k=this.length;if(k%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let O=0;O<k;O+=8)M(this,O,O+7),M(this,O+1,O+6),M(this,O+2,O+5),M(this,O+3,O+4);return this},"swap64"),l.prototype.toString=a(function(){const k=this.length;return k===0?"":arguments.length===0?_(this,0,k):I.apply(this,arguments)},"toString"),l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=a(function(k){if(!l.isBuffer(k))throw new TypeError("Argument must be a Buffer");return this===k?!0:l.compare(this,k)===0},"equals"),l.prototype.inspect=a(function(){let k="";const O=t.INSPECT_MAX_BYTES;return k=this.toString("hex",0,O).replace(/(.{2})/g,"$1 ").trim(),this.length>O&&(k+=" ... "),"<Buffer "+k+">"},"inspect"),i&&(l.prototype[i]=l.prototype.inspect),l.prototype.compare=a(function(k,O,K,Q,ce){if(ve(k,Uint8Array)&&(k=l.from(k,k.offset,k.byteLength)),!l.isBuffer(k))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof k);if(O===void 0&&(O=0),K===void 0&&(K=k?k.length:0),Q===void 0&&(Q=0),ce===void 0&&(ce=this.length),O<0||K>k.length||Q<0||ce>this.length)throw new RangeError("out of range index");if(Q>=ce&&O>=K)return 0;if(Q>=ce)return-1;if(O>=K)return 1;if(O>>>=0,K>>>=0,Q>>>=0,ce>>>=0,this===k)return 0;let oe=ce-Q,ke=K-O;const ft=Math.min(oe,ke),et=this.slice(Q,ce),it=k.slice(O,K);for(let _t=0;_t<ft;++_t)if(et[_t]!==it[_t]){oe=et[_t],ke=it[_t];break}return oe<ke?-1:ke<oe?1:0},"compare");function H(W,k,O,K,Q){if(W.length===0)return-1;if(typeof O=="string"?(K=O,O=0):O>2147483647?O=2147483647:O<-2147483648&&(O=-2147483648),O=+O,lt(O)&&(O=Q?0:W.length-1),O<0&&(O=W.length+O),O>=W.length){if(Q)return-1;O=W.length-1}else if(O<0)if(Q)O=0;else return-1;if(typeof k=="string"&&(k=l.from(k,K)),l.isBuffer(k))return k.length===0?-1:N(W,k,O,K,Q);if(typeof k=="number")return k=k&255,typeof Uint8Array.prototype.indexOf=="function"?Q?Uint8Array.prototype.indexOf.call(W,k,O):Uint8Array.prototype.lastIndexOf.call(W,k,O):N(W,[k],O,K,Q);throw new TypeError("val must be string, number or Buffer")}a(H,"bidirectionalIndexOf");function N(W,k,O,K,Q){let ce=1,oe=W.length,ke=k.length;if(K!==void 0&&(K=String(K).toLowerCase(),K==="ucs2"||K==="ucs-2"||K==="utf16le"||K==="utf-16le")){if(W.length<2||k.length<2)return-1;ce=2,oe/=2,ke/=2,O/=2}function ft(it,_t){return ce===1?it[_t]:it.readUInt16BE(_t*ce)}a(ft,"read");let et;if(Q){let it=-1;for(et=O;et<oe;et++)if(ft(W,et)===ft(k,it===-1?0:et-it)){if(it===-1&&(it=et),et-it+1===ke)return it*ce}else it!==-1&&(et-=et-it),it=-1}else for(O+ke>oe&&(O=oe-ke),et=O;et>=0;et--){let it=!0;for(let _t=0;_t<ke;_t++)if(ft(W,et+_t)!==ft(k,_t)){it=!1;break}if(it)return et}return-1}a(N,"arrayIndexOf"),l.prototype.includes=a(function(k,O,K){return this.indexOf(k,O,K)!==-1},"includes"),l.prototype.indexOf=a(function(k,O,K){return H(this,k,O,K,!0)},"indexOf"),l.prototype.lastIndexOf=a(function(k,O,K){return H(this,k,O,K,!1)},"lastIndexOf");function $(W,k,O,K){O=Number(O)||0;const Q=W.length-O;K?(K=Number(K),K>Q&&(K=Q)):K=Q;const ce=k.length;K>ce/2&&(K=ce/2);let oe;for(oe=0;oe<K;++oe){const ke=parseInt(k.substr(oe*2,2),16);if(lt(ke))return oe;W[O+oe]=ke}return oe}a($,"hexWrite");function F(W,k,O,K){return ae(we(k,W.length-O),W,O,K)}a(F,"utf8Write");function D(W,k,O,K){return ae(ye(k),W,O,K)}a(D,"asciiWrite");function L(W,k,O,K){return ae(he(k),W,O,K)}a(L,"base64Write");function m(W,k,O,K){return ae(te(k,W.length-O),W,O,K)}a(m,"ucs2Write"),l.prototype.write=a(function(k,O,K,Q){if(O===void 0)Q="utf8",K=this.length,O=0;else if(K===void 0&&typeof O=="string")Q=O,K=this.length,O=0;else if(isFinite(O))O=O>>>0,isFinite(K)?(K=K>>>0,Q===void 0&&(Q="utf8")):(Q=K,K=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const ce=this.length-O;if((K===void 0||K>ce)&&(K=ce),k.length>0&&(K<0||O<0)||O>this.length)throw new RangeError("Attempt to write outside buffer bounds");Q||(Q="utf8");let oe=!1;for(;;)switch(Q){case"hex":return $(this,k,O,K);case"utf8":case"utf-8":return F(this,k,O,K);case"ascii":case"latin1":case"binary":return D(this,k,O,K);case"base64":return L(this,k,O,K);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return m(this,k,O,K);default:if(oe)throw new TypeError("Unknown encoding: "+Q);Q=(""+Q).toLowerCase(),oe=!0}},"write"),l.prototype.toJSON=a(function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},"toJSON");function S(W,k,O){return k===0&&O===W.length?e.fromByteArray(W):e.fromByteArray(W.slice(k,O))}a(S,"base64Slice");function _(W,k,O){O=Math.min(W.length,O);const K=[];let Q=k;for(;Q<O;){const ce=W[Q];let oe=null,ke=ce>239?4:ce>223?3:ce>191?2:1;if(Q+ke<=O){let ft,et,it,_t;switch(ke){case 1:ce<128&&(oe=ce);break;case 2:ft=W[Q+1],(ft&192)===128&&(_t=(ce&31)<<6|ft&63,_t>127&&(oe=_t));break;case 3:ft=W[Q+1],et=W[Q+2],(ft&192)===128&&(et&192)===128&&(_t=(ce&15)<<12|(ft&63)<<6|et&63,_t>2047&&(_t<55296||_t>57343)&&(oe=_t));break;case 4:ft=W[Q+1],et=W[Q+2],it=W[Q+3],(ft&192)===128&&(et&192)===128&&(it&192)===128&&(_t=(ce&15)<<18|(ft&63)<<12|(et&63)<<6|it&63,_t>65535&&_t<1114112&&(oe=_t))}}oe===null?(oe=65533,ke=1):oe>65535&&(oe-=65536,K.push(oe>>>10&1023|55296),oe=56320|oe&1023),K.push(oe),Q+=ke}return x(K)}a(_,"utf8Slice");const A=4096;function x(W){const k=W.length;if(k<=A)return String.fromCharCode.apply(String,W);let O="",K=0;for(;K<k;)O+=String.fromCharCode.apply(String,W.slice(K,K+=A));return O}a(x,"decodeCodePointsArray");function C(W,k,O){let K="";O=Math.min(W.length,O);for(let Q=k;Q<O;++Q)K+=String.fromCharCode(W[Q]&127);return K}a(C,"asciiSlice");function U(W,k,O){let K="";O=Math.min(W.length,O);for(let Q=k;Q<O;++Q)K+=String.fromCharCode(W[Q]);return K}a(U,"latin1Slice");function R(W,k,O){const K=W.length;(!k||k<0)&&(k=0),(!O||O<0||O>K)&&(O=K);let Q="";for(let ce=k;ce<O;++ce)Q+=Ye[W[ce]];return Q}a(R,"hexSlice");function w(W,k,O){const K=W.slice(k,O);let Q="";for(let ce=0;ce<K.length-1;ce+=2)Q+=String.fromCharCode(K[ce]+K[ce+1]*256);return Q}a(w,"utf16leSlice"),l.prototype.slice=a(function(k,O){const K=this.length;k=~~k,O=O===void 0?K:~~O,k<0?(k+=K,k<0&&(k=0)):k>K&&(k=K),O<0?(O+=K,O<0&&(O=0)):O>K&&(O=K),O<k&&(O=k);const Q=this.subarray(k,O);return Object.setPrototypeOf(Q,l.prototype),Q},"slice");function P(W,k,O){if(W%1!==0||W<0)throw new RangeError("offset is not uint");if(W+k>O)throw new RangeError("Trying to access beyond buffer length")}a(P,"checkOffset"),l.prototype.readUintLE=l.prototype.readUIntLE=a(function(k,O,K){k=k>>>0,O=O>>>0,K||P(k,O,this.length);let Q=this[k],ce=1,oe=0;for(;++oe<O&&(ce*=256);)Q+=this[k+oe]*ce;return Q},"readUIntLE"),l.prototype.readUintBE=l.prototype.readUIntBE=a(function(k,O,K){k=k>>>0,O=O>>>0,K||P(k,O,this.length);let Q=this[k+--O],ce=1;for(;O>0&&(ce*=256);)Q+=this[k+--O]*ce;return Q},"readUIntBE"),l.prototype.readUint8=l.prototype.readUInt8=a(function(k,O){return k=k>>>0,O||P(k,1,this.length),this[k]},"readUInt8"),l.prototype.readUint16LE=l.prototype.readUInt16LE=a(function(k,O){return k=k>>>0,O||P(k,2,this.length),this[k]|this[k+1]<<8},"readUInt16LE"),l.prototype.readUint16BE=l.prototype.readUInt16BE=a(function(k,O){return k=k>>>0,O||P(k,2,this.length),this[k]<<8|this[k+1]},"readUInt16BE"),l.prototype.readUint32LE=l.prototype.readUInt32LE=a(function(k,O){return k=k>>>0,O||P(k,4,this.length),(this[k]|this[k+1]<<8|this[k+2]<<16)+this[k+3]*16777216},"readUInt32LE"),l.prototype.readUint32BE=l.prototype.readUInt32BE=a(function(k,O){return k=k>>>0,O||P(k,4,this.length),this[k]*16777216+(this[k+1]<<16|this[k+2]<<8|this[k+3])},"readUInt32BE"),l.prototype.readBigUInt64LE=nt(a(function(k){k=k>>>0,Te(k,"offset");const O=this[k],K=this[k+7];(O===void 0||K===void 0)&&Le(k,this.length-8);const Q=O+this[++k]*2**8+this[++k]*2**16+this[++k]*2**24,ce=this[++k]+this[++k]*2**8+this[++k]*2**16+K*2**24;return BigInt(Q)+(BigInt(ce)<<BigInt(32))},"readBigUInt64LE")),l.prototype.readBigUInt64BE=nt(a(function(k){k=k>>>0,Te(k,"offset");const O=this[k],K=this[k+7];(O===void 0||K===void 0)&&Le(k,this.length-8);const Q=O*2**24+this[++k]*2**16+this[++k]*2**8+this[++k],ce=this[++k]*2**24+this[++k]*2**16+this[++k]*2**8+K;return(BigInt(Q)<<BigInt(32))+BigInt(ce)},"readBigUInt64BE")),l.prototype.readIntLE=a(function(k,O,K){k=k>>>0,O=O>>>0,K||P(k,O,this.length);let Q=this[k],ce=1,oe=0;for(;++oe<O&&(ce*=256);)Q+=this[k+oe]*ce;return ce*=128,Q>=ce&&(Q-=Math.pow(2,8*O)),Q},"readIntLE"),l.prototype.readIntBE=a(function(k,O,K){k=k>>>0,O=O>>>0,K||P(k,O,this.length);let Q=O,ce=1,oe=this[k+--Q];for(;Q>0&&(ce*=256);)oe+=this[k+--Q]*ce;return ce*=128,oe>=ce&&(oe-=Math.pow(2,8*O)),oe},"readIntBE"),l.prototype.readInt8=a(function(k,O){return k=k>>>0,O||P(k,1,this.length),this[k]&128?(255-this[k]+1)*-1:this[k]},"readInt8"),l.prototype.readInt16LE=a(function(k,O){k=k>>>0,O||P(k,2,this.length);const K=this[k]|this[k+1]<<8;return K&32768?K|4294901760:K},"readInt16LE"),l.prototype.readInt16BE=a(function(k,O){k=k>>>0,O||P(k,2,this.length);const K=this[k+1]|this[k]<<8;return K&32768?K|4294901760:K},"readInt16BE"),l.prototype.readInt32LE=a(function(k,O){return k=k>>>0,O||P(k,4,this.length),this[k]|this[k+1]<<8|this[k+2]<<16|this[k+3]<<24},"readInt32LE"),l.prototype.readInt32BE=a(function(k,O){return k=k>>>0,O||P(k,4,this.length),this[k]<<24|this[k+1]<<16|this[k+2]<<8|this[k+3]},"readInt32BE"),l.prototype.readBigInt64LE=nt(a(function(k){k=k>>>0,Te(k,"offset");const O=this[k],K=this[k+7];(O===void 0||K===void 0)&&Le(k,this.length-8);const Q=this[k+4]+this[k+5]*2**8+this[k+6]*2**16+(K<<24);return(BigInt(Q)<<BigInt(32))+BigInt(O+this[++k]*2**8+this[++k]*2**16+this[++k]*2**24)},"readBigInt64LE")),l.prototype.readBigInt64BE=nt(a(function(k){k=k>>>0,Te(k,"offset");const O=this[k],K=this[k+7];(O===void 0||K===void 0)&&Le(k,this.length-8);const Q=(O<<24)+this[++k]*2**16+this[++k]*2**8+this[++k];return(BigInt(Q)<<BigInt(32))+BigInt(this[++k]*2**24+this[++k]*2**16+this[++k]*2**8+K)},"readBigInt64BE")),l.prototype.readFloatLE=a(function(k,O){return k=k>>>0,O||P(k,4,this.length),n.read(this,k,!0,23,4)},"readFloatLE"),l.prototype.readFloatBE=a(function(k,O){return k=k>>>0,O||P(k,4,this.length),n.read(this,k,!1,23,4)},"readFloatBE"),l.prototype.readDoubleLE=a(function(k,O){return k=k>>>0,O||P(k,8,this.length),n.read(this,k,!0,52,8)},"readDoubleLE"),l.prototype.readDoubleBE=a(function(k,O){return k=k>>>0,O||P(k,8,this.length),n.read(this,k,!1,52,8)},"readDoubleBE");function V(W,k,O,K,Q,ce){if(!l.isBuffer(W))throw new TypeError('"buffer" argument must be a Buffer instance');if(k>Q||k<ce)throw new RangeError('"value" argument is out of bounds');if(O+K>W.length)throw new RangeError("Index out of range")}a(V,"checkInt"),l.prototype.writeUintLE=l.prototype.writeUIntLE=a(function(k,O,K,Q){if(k=+k,O=O>>>0,K=K>>>0,!Q){const ke=Math.pow(2,8*K)-1;V(this,k,O,K,ke,0)}let ce=1,oe=0;
107for(this[O]=k&255;++oe<K&&(ce*=256);)this[O+oe]=k/ce&255;return O+K},"writeUIntLE"),l.prototype.writeUintBE=l.prototype.writeUIntBE=a(function(k,O,K,Q){if(k=+k,O=O>>>0,K=K>>>0,!Q){const ke=Math.pow(2,8*K)-1;V(this,k,O,K,ke,0)}let ce=K-1,oe=1;for(this[O+ce]=k&255;--ce>=0&&(oe*=256);)this[O+ce]=k/oe&255;return O+K},"writeUIntBE"),l.prototype.writeUint8=l.prototype.writeUInt8=a(function(k,O,K){return k=+k,O=O>>>0,K||V(this,k,O,1,255,0),this[O]=k&255,O+1},"writeUInt8"),l.prototype.writeUint16LE=l.prototype.writeUInt16LE=a(function(k,O,K){return k=+k,O=O>>>0,K||V(this,k,O,2,65535,0),this[O]=k&255,this[O+1]=k>>>8,O+2},"writeUInt16LE"),l.prototype.writeUint16BE=l.prototype.writeUInt16BE=a(function(k,O,K){return k=+k,O=O>>>0,K||V(this,k,O,2,65535,0),this[O]=k>>>8,this[O+1]=k&255,O+2},"writeUInt16BE"),l.prototype.writeUint32LE=l.prototype.writeUInt32LE=a(function(k,O,K){return k=+k,O=O>>>0,K||V(this,k,O,4,4294967295,0),this[O+3]=k>>>24,this[O+2]=k>>>16,this[O+1]=k>>>8,this[O]=k&255,O+4},"writeUInt32LE"),l.prototype.writeUint32BE=l.prototype.writeUInt32BE=a(function(k,O,K){return k=+k,O=O>>>0,K||V(this,k,O,4,4294967295,0),this[O]=k>>>24,this[O+1]=k>>>16,this[O+2]=k>>>8,this[O+3]=k&255,O+4},"writeUInt32BE");function Z(W,k,O,K,Q){pe(k,K,Q,W,O,7);let ce=Number(k&BigInt(4294967295));W[O++]=ce,ce=ce>>8,W[O++]=ce,ce=ce>>8,W[O++]=ce,ce=ce>>8,W[O++]=ce;let oe=Number(k>>BigInt(32)&BigInt(4294967295));return W[O++]=oe,oe=oe>>8,W[O++]=oe,oe=oe>>8,W[O++]=oe,oe=oe>>8,W[O++]=oe,O}a(Z,"wrtBigUInt64LE");function ee(W,k,O,K,Q){pe(k,K,Q,W,O,7);let ce=Number(k&BigInt(4294967295));W[O+7]=ce,ce=ce>>8,W[O+6]=ce,ce=ce>>8,W[O+5]=ce,ce=ce>>8,W[O+4]=ce;let oe=Number(k>>BigInt(32)&BigInt(4294967295));return W[O+3]=oe,oe=oe>>8,W[O+2]=oe,oe=oe>>8,W[O+1]=oe,oe=oe>>8,W[O]=oe,O+8}a(ee,"wrtBigUInt64BE"),l.prototype.writeBigUInt64LE=nt(a(function(k,O=0){return Z(this,k,O,BigInt(0),BigInt("0xffffffffffffffff"))},"writeBigUInt64LE")),l.prototype.writeBigUInt64BE=nt(a(function(k,O=0){return ee(this,k,O,BigInt(0),BigInt("0xffffffffffffffff"))},"writeBigUInt64BE")),l.prototype.writeIntLE=a(function(k,O,K,Q){if(k=+k,O=O>>>0,!Q){const ft=Math.pow(2,8*K-1);V(this,k,O,K,ft-1,-ft)}let ce=0,oe=1,ke=0;
vendor: 4,167 bytes, line 107
107for(this[O]=k&255;++ce<K&&(oe*=256);)k<0&&ke===0&&this[O+ce-1]!==0&&(ke=1),this[O+ce]=(k/oe>>0)-ke&255;return O+K},"writeIntLE"),l.prototype.writeIntBE=a(function(k,O,K,Q){if(k=+k,O=O>>>0,!Q){const ft=Math.pow(2,8*K-1);V(this,k,O,K,ft-1,-ft)}let ce=K-1,oe=1,ke=0;for(this[O+ce]=k&255;--ce>=0&&(oe*=256);)k<0&&ke===0&&this[O+ce+1]!==0&&(ke=1),this[O+ce]=(k/oe>>0)-ke&255;return O+K},"writeIntBE"),l.prototype.writeInt8=a(function(k,O,K){return k=+k,O=O>>>0,K||V(this,k,O,1,127,-128),k<0&&(k=255+k+1),this[O]=k&255,O+1},"writeInt8"),l.prototype.writeInt16LE=a(function(k,O,K){return k=+k,O=O>>>0,K||V(this,k,O,2,32767,-32768),this[O]=k&255,this[O+1]=k>>>8,O+2},"writeInt16LE"),l.prototype.writeInt16BE=a(function(k,O,K){return k=+k,O=O>>>0,K||V(this,k,O,2,32767,-32768),this[O]=k>>>8,this[O+1]=k&255,O+2},"writeInt16BE"),l.prototype.writeInt32LE=a(function(k,O,K){return k=+k,O=O>>>0,K||V(this,k,O,4,2147483647,-2147483648),this[O]=k&255,this[O+1]=k>>>8,this[O+2]=k>>>16,this[O+3]=k>>>24,O+4},"writeInt32LE"),l.prototype.writeInt32BE=a(function(k,O,K){return k=+k,O=O>>>0,K||V(this,k,O,4,2147483647,-2147483648),k<0&&(k=4294967295+k+1),this[O]=k>>>24,this[O+1]=k>>>16,this[O+2]=k>>>8,this[O+3]=k&255,O+4},"writeInt32BE"),l.prototype.writeBigInt64LE=nt(a(function(k,O=0){return Z(this,k,O,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64LE")),l.prototype.writeBigInt64BE=nt(a(function(k,O=0){return ee(this,k,O,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64BE"));function ne(W,k,O,K,Q,ce){if(O+K>W.length)throw new RangeError("Index out of range");if(O<0)throw new RangeError("Index out of range")}a(ne,"checkIEEE754");function se(W,k,O,K,Q){return k=+k,O=O>>>0,Q||ne(W,k,O,4),n.write(W,k,O,K,23,4),O+4}a(se,"writeFloat"),l.prototype.writeFloatLE=a(function(k,O,K){return se(this,k,O,!0,K)},"writeFloatLE"),l.prototype.writeFloatBE=a(function(k,O,K){return se(this,k,O,!1,K)},"writeFloatBE");function ge(W,k,O,K,Q){return k=+k,O=O>>>0,Q||ne(W,k,O,8),n.write(W,k,O,K,52,8),O+8}a(ge,"writeDouble"),l.prototype.writeDoubleLE=a(function(k,O,K){return ge(this,k,O,!0,K)},"writeDoubleLE"),l.prototype.writeDoubleBE=a(function(k,O,K){return ge(this,k,O,!1,K)},"writeDoubleBE"),l.prototype.copy=a(function(k,O,K,Q){if(!l.isBuffer(k))throw new TypeError("argument should be a Buffer");if(K||(K=0),!Q&&Q!==0&&(Q=this.length),O>=k.length&&(O=k.length),O||(O=0),Q>0&&Q<K&&(Q=K),Q===K||k.length===0||this.length===0)return 0;if(O<0)throw new RangeError("targetStart out of bounds");if(K<0||K>=this.length)throw new RangeError("Index out of range");if(Q<0)throw new RangeError("sourceEnd out of bounds");Q>this.length&&(Q=this.length),k.length-O<Q-K&&(Q=k.length-O+K);const ce=Q-K;return this===k&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(O,K,Q):Uint8Array.prototype.set.call(k,this.subarray(K,Q),O),ce},"copy"),l.prototype.fill=a(function(k,O,K,Q){if(typeof k=="string"){if(typeof O=="string"?(Q=O,O=0,K=this.length):typeof K=="string"&&(Q=K,K=this.length),Q!==void 0&&typeof Q!="string")throw new TypeError("encoding must be a string");if(typeof Q=="string"&&!l.isEncoding(Q))throw new TypeError("Unknown encoding: "+Q);if(k.length===1){const oe=k.charCodeAt(0);(Q==="utf8"&&oe<128||Q==="latin1")&&(k=oe)}}else typeof k=="number"?k=k&255:typeof k=="boolean"&&(k=Number(k));if(O<0||this.length<O||this.length<K)throw new RangeError("Out of range index");if(K<=O)return this;O=O>>>0,K=K===void 0?this.length:K>>>0,k||(k=0);let ce;if(typeof k=="number")for(ce=O;ce<K;++ce)this[ce]=k;else{const oe=l.isBuffer(k)?k:l.from(k,Q),ke=oe.length;if(ke===0)throw new TypeError('The value "'+k+'" is invalid for argument "value"');for(ce=0;ce<K-O;++ce)this[ce+O]=oe[ce%ke]}return this},"fill");const ie={};function j(W,k,O){var K;ie[W]=(K=class extends O{constructor(){super(),Object.defineProperty(this,"message",{value:k.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${W}]`,this.stack,delete this.name}get code(){return W}set code(ce){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:ce,writable:!0})}toString(){return`${this.name} [${W}]: ${this.message}`}}
107,a(K,"NodeError"),K)}a(j,"E"),j("ERR_BUFFER_OUT_OF_BOUNDS",function(W){return W?`${W} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),j("ERR_INVALID_ARG_TYPE",function(W,k){return`The "${W}" argument must be of type number. Received type ${typeof k}`},TypeError),j("ERR_OUT_OF_RANGE",function(W,k,O){let K=`The value of "${W}" is out of range.`,Q=O;return Number.isInteger(O)&&Math.abs(O)>2**32?Q=Y(String(O)):typeof O=="bigint"&&(Q=String(O),(O>BigInt(2)**BigInt(32)||O<-(BigInt(2)**BigInt(32)))&&(Q=Y(Q)),Q+="n"),K+=` It must be ${k}. Received ${Q}`,K},RangeError);function Y(W){let k="",O=W.length;const K=W[0]==="-"?1:0;for(;O>=K+4;O-=3)k=`_${W.slice(O-3,O)}${k}`;return`${W.slice(0,O)}${k}`}a(Y,"addNumericalSeparator");function le(W,k,O){Te(k,"offset"),(W[k]===void 0||W[k+O]===void 0)&&Le(k,W.length-(O+1))}a(le,"checkBounds");function pe(W,k,O,K,Q,ce){if(W>O||W<k){const oe=typeof k=="bigint"?"n":"";let ke;throw ce>3?k===0||k===BigInt(0)?ke=`>= 0${oe} and < 2${oe} ** ${(ce+1)*8}${oe}`:ke=`>= -(2${oe} ** ${(ce+1)*8-1}${oe}) and < 2 ** ${(ce+1)*8-1}${oe}`:ke=`>= ${k}${oe} and <= ${O}${oe}`,new ie.ERR_OUT_OF_RANGE("value",ke,W)}le(K,Q,ce)}a(pe,"checkIntBI");function Te(W,k){if(typeof W!="number")throw new ie.ERR_INVALID_ARG_TYPE(k,"number",W)}a(Te,"validateNumber");function Le(W,k,O){throw Math.floor(W)!==W?(Te(W,O),new ie.ERR_OUT_OF_RANGE(O||"offset","an integer",W)):k<0?new ie.ERR_BUFFER_OUT_OF_BOUNDS:new ie.ERR_OUT_OF_RANGE(O||"offset",`>= ${O?1:0} and <= ${k}`,W)}a(Le,"boundsError");const De=/[^+/0-9A-Za-z-_]/g;function _e(W){if(W=W.split("=")[0],W=W.trim().replace(De,""),W.length<2)return"";for(;W.length%4!==0;)W=W+"=";return W}a(_e,"base64clean");function we(W,k){k=k||1/0;let O;const K=W.length;let Q=null;const ce=[];for(let oe=0;oe<K;++oe){if(O=W.charCodeAt(oe),O>55295&&O<57344){if(!Q){if(O>56319){(k-=3)>-1&&ce.push(239,191,189);continue}else if(oe+1===K){(k-=3)>-1&&ce.push(239,191,189);continue}Q=O;continue}if(O<56320){(k-=3)>-1&&ce.push(239,191,189),Q=O;continue}O=(Q-55296<<10|O-56320)+65536}else Q&&(k-=3)>-1&&ce.push(239,191,189);if(Q=null,O<128){if((k-=1)<0)break;ce.push(O)}else if(O<2048){if((k-=2)<0)break;ce.push(O>>6|192,O&63|128)}else if(O<65536){if((k-=3)<0)break;ce.push(O>>12|224,O>>6&63|128,O&63|128)}else if(O<1114112){if((k-=4)<0)break;ce.push(O>>18|240,O>>12&63|128,O>>6&63|128,O&63|128)}else throw new Error("Invalid code point")}return ce}a(we,"utf8ToBytes");function ye(W){const k=[];for(let O=0;O<W.length;++O)k.push(W.charCodeAt(O)&255);return k}a(ye,"asciiToBytes");function te(W,k){let O,K,Q;const ce=[];for(let oe=0;oe<W.length&&!((k-=2)<0);++oe)O=W.charCodeAt(oe),K=O>>8,Q=O%256,ce.push(Q),ce.push(K);return ce}a(te,"utf16leToBytes");function he(W){return e.toByteArray(_e(W))}a(he,"base64ToBytes");function ae(W,k,O,K){let Q;for(Q=0;Q<K&&!(Q+O>=k.length||Q>=W.length);++Q)k[Q+O]=W[Q];return Q}a(ae,"blitBuffer");function ve(W,k){return W instanceof k||W!=null&&W.constructor!=null&&W.constructor.name!=null&&W.constructor.name===k.name}a(ve,"isInstance");function lt(W){return W!==W}a(lt,"numberIsNaN");const Ye=function(){const W="0123456789abcdef",k=new Array(256);for(let O=0;O<16;++O){const K=O*16;for(let Q=0;Q<16;++Q)k[K+Q]=W[O]+W[Q]}return k}();function nt(W){return typeof BigInt>"u"?Qt:W}a(nt,"defineBigIntMethod");function Qt(){throw new Error("BigInt not supported")}a(Qt,"BufferBigIntNotDefined")})(Hp);var tA={exports:{}};const Dne={},One=Object.freeze(Object.defineProperty({__proto__:null,default:Dne},Symbol.toStringTag,{value:"Module"})),Nne=Ane(One);tA.exports;(function(t){(function(e,n){function i(L,m){if(!L)throw new Error(m||"Assertion failed")}a(i,"assert");function s(L,m){L.super_=m;var S=a(function(){},"TempCtor");S.prototype=m.prototype,L.prototype=new S,L.prototype.constructor=L}a(s,"inherits");function r(L,m,S){if(r.isBN(L))return L;
107this.negative=0,this.words=null,this.length=0,this.red=null,L!==null&&((m==="le"||m==="be")&&(S=m,m=10),this._init(L||0,m||10,S||"be"))}a(r,"BN"),typeof e=="object"?e.exports=r:n.BN=r,r.BN=r,r.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=Nne.Buffer}catch{}r.isBN=a(function(m){return m instanceof r?!0:m!==null&&typeof m=="object"&&m.constructor.wordSize===r.wordSize&&Array.isArray(m.words)},"isBN"),r.max=a(function(m,S){return m.cmp(S)>0?m:S},"max"),r.min=a(function(m,S){return m.cmp(S)<0?m:S},"min"),r.prototype._init=a(function(m,S,_){if(typeof m=="number")return this._initNumber(m,S,_);if(typeof m=="object")return this._initArray(m,S,_);S==="hex"&&(S=16),i(S===(S|0)&&S>=2&&S<=36),m=m.toString().replace(/\s+/g,"");var A=0;m[0]==="-"&&(A++,this.negative=1),A<m.length&&(S===16?this._parseHex(m,A,_):(this._parseBase(m,S,A),_==="le"&&this._initArray(this.toArray(),S,_)))},"init"),r.prototype._initNumber=a(function(m,S,_){m<0&&(this.negative=1,m=-m),m<67108864?(this.words=[m&67108863],this.length=1):m<4503599627370496?(this.words=[m&67108863,m/67108864&67108863],this.length=2):(i(m<9007199254740992),this.words=[m&67108863,m/67108864&67108863,1],this.length=3),_==="le"&&this._initArray(this.toArray(),S,_)},"_initNumber"),r.prototype._initArray=a(function(m,S,_){if(i(typeof m.length=="number"),m.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(m.length/3),this.words=new Array(this.length);for(var A=0;A<this.length;A++)this.words[A]=0;var x,C,U=0;if(_==="be")for(A=m.length-1,x=0;A>=0;A-=3)C=m[A]|m[A-1]<<8|m[A-2]<<16,this.words[x]|=C<<U&67108863,this.words[x+1]=C>>>26-U&67108863,U+=24,U>=26&&(U-=26,x++);else if(_==="le")for(A=0,x=0;A<m.length;A+=3)C=m[A]|m[A+1]<<8|m[A+2]<<16,this.words[x]|=C<<U&67108863,this.words[x+1]=C>>>26-U&67108863,U+=24,U>=26&&(U-=26,x++);return this.strip()},"_initArray");function l(L,m){var S=L.charCodeAt(m);return S>=65&&S<=70?S-55:S>=97&&S<=102?S-87:S-48&15}a(l,"parseHex4Bits");function d(L,m,S){var _=l(L,S);return S-1>=m&&(_|=l(L,S-1)<<4),_}a(d,"parseHexByte"),r.prototype._parseHex=a(function(m,S,_){this.length=Math.ceil((m.length-S)/6),this.words=new Array(this.length);for(var A=0;A<this.length;A++)this.words[A]=0;var x=0,C=0,U;if(_==="be")for(A=m.length-1;A>=S;A-=2)U=d(m,S,A)<<x,this.words[C]|=U&67108863,x>=18?(x-=18,C+=1,this.words[C]|=U>>>26):x+=8;else{var R=m.length-S;for(A=R%2===0?S+1:S;A<m.length;A+=2)U=d(m,S,A)<<x,this.words[C]|=U&67108863,x>=18?(x-=18,C+=1,this.words[C]|=U>>>26):x+=8}this.strip()},"_parseHex");function c(L,m,S,_){for(var A=0,x=Math.min(L.length,S),C=m;C<x;C++){var U=L.charCodeAt(C)-48;A*=_,U>=49?A+=U-49+10:U>=17?A+=U-17+10:A+=U}return A}a(c,"parseBase"),r.prototype._parseBase=a(function(m,S,_){this.words=[0],this.length=1;for(var A=0,x=1;x<=67108863;x*=S)A++;A--,x=x/S|0;for(var C=m.length-_,U=C%A,R=Math.min(C,C-U)+_,w=0,P=_;P<R;P+=A)w=c(m,P,P+A,S),this.imuln(x),this.words[0]+w<67108864?this.words[0]+=w:this._iaddn(w);if(U!==0){var V=1;for(w=c(m,P,m.length,S),P=0;P<U;P++)V*=S;this.imuln(V),this.words[0]+w<67108864?this.words[0]+=w:this._iaddn(w)}this.strip()},"_parseBase"),r.prototype.copy=a(function(m){m.words=new Array(this.length);for(var S=0;S<this.length;S++)m.words[S]=this.words[S];m.length=this.length,m.negative=this.negative,m.red=this.red},"copy"),r.prototype.clone=a(function(){var m=new r(null);return this.copy(m),m},"clone"),r.prototype._expand=a(function(m){for(;this.length<m;)this.words[this.length++]=0;return this},"_expand"),r.prototype.strip=a(function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},"strip"),r.prototype._normSign=a(function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},"_normSign"),r.prototype.inspect=a(function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"},"inspect");var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16
107777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];r.prototype.toString=a(function(m,S){m=m||10,S=S|0||1;var _;if(m===16||m==="hex"){_="";for(var A=0,x=0,C=0;C<this.length;C++){var U=this.words[C],R=((U<<A|x)&16777215).toString(16);x=U>>>24-A&16777215,A+=2,A>=26&&(A-=26,C--),x!==0||C!==this.length-1?_=u[6-R.length]+R+_:_=R+_}for(x!==0&&(_=x.toString(16)+_);_.length%S!==0;)_="0"+_;return this.negative!==0&&(_="-"+_),_}if(m===(m|0)&&m>=2&&m<=36){var w=f[m],P=h[m];_="";var V=this.clone();for(V.negative=0;!V.isZero();){var Z=V.modn(P).toString(m);V=V.idivn(P),V.isZero()?_=Z+_:_=u[w-Z.length]+Z+_}for(this.isZero()&&(_="0"+_);_.length%S!==0;)_="0"+_;return this.negative!==0&&(_="-"+_),_}i(!1,"Base should be between 2 and 36")},"toString"),r.prototype.toNumber=a(function(){var m=this.words[0];return this.length===2?m+=this.words[1]*67108864:this.length===3&&this.words[2]===1?m+=4503599627370496+this.words[1]*67108864:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-m:m},"toNumber"),r.prototype.toJSON=a(function(){return this.toString(16)},"toJSON"),r.prototype.toBuffer=a(function(m,S){return i(typeof o<"u"),this.toArrayLike(o,m,S)},"toBuffer"),r.prototype.toArray=a(function(m,S){return this.toArrayLike(Array,m,S)},"toArray"),r.prototype.toArrayLike=a(function(m,S,_){var A=this.byteLength(),x=_||Math.max(1,A);i(A<=x,"byte array longer than desired length"),i(x>0,"Requested array length <= 0"),this.strip();var C=S==="le",U=new m(x),R,w,P=this.clone();if(C){for(w=0;!P.isZero();w++)R=P.andln(255),P.iushrn(8),U[w]=R;for(;w<x;w++)U[w]=0}else{for(w=0;w<x-A;w++)U[w]=0;for(w=0;!P.isZero();w++)R=P.andln(255),P.iushrn(8),U[x-w-1]=R}return U},"toArrayLike"),Math.clz32?r.prototype._countBits=a(function(m){return 32-Math.clz32(m)},"_countBits"):r.prototype._countBits=a(function(m){var S=m,_=0;return S>=4096&&(_+=13,S>>>=13),S>=64&&(_+=7,S>>>=7),S>=8&&(_+=4,S>>>=4),S>=2&&(_+=2,S>>>=2),_+S},"_countBits"),r.prototype._zeroBits=a(function(m){if(m===0)return 26;var S=m,_=0;return S&8191||(_+=13,S>>>=13),S&127||(_+=7,S>>>=7),S&15||(_+=4,S>>>=4),S&3||(_+=2,S>>>=2),S&1||_++,_},"_zeroBits"),r.prototype.bitLength=a(function(){var m=this.words[this.length-1],S=this._countBits(m);return(this.length-1)*26+S},"bitLength");function p(L){for(var m=new Array(L.bitLength()),S=0;S<m.length;S++){var _=S/26|0,A=S%26;m[S]=(L.words[_]&1<<A)>>>A}return m}a(p,"toBitArray"),r.prototype.zeroBits=a(function(){if(this.isZero())return 0;for(var m=0,S=0;S<this.length;S++){var _=this._zeroBits(this.words[S]);if(m+=_,_!==26)break}return m},"zeroBits"),r.prototype.byteLength=a(function(){return Math.ceil(this.bitLength()/8)},"byteLength"),r.prototype.toTwos=a(function(m){return this.negative!==0?this.abs().inotn(m).iaddn(1):this.clone()},"toTwos"),r.prototype.fromTwos=a(function(m){return this.testn(m-1)?this.notn(m).iaddn(1).ineg():this.clone()},"fromTwos"),r.prototype.isNeg=a(function(){return this.negative!==0},"isNeg"),r.prototype.neg=a(function(){return this.clone().ineg()},"neg"),r.prototype.ineg=a(function(){return this.isZero()||(this.negative^=1),this},"ineg"),r.prototype.iuor=a(function(m){for(;this.length<m.length;)this.words[this.length++]=0;for(var S=0;S<m.length;S++)this.words[S]=this.words[S]|m.words[S];return this.strip()},"iuor"),r.prototype.ior=a(function(m){return i((this.negative|m.negative)===0),this.iuor(m)},"ior"),r.prototype.or=a(function(m){return this.length>m.length?this.clone().ior(m):m.clone().ior(this)},"or"),r.prototype.uor=a(function(m){return this.length>m.length?this.clone().iuor(m):m.clone().iuor(this)},"uor"),r.prototype.iuand=a(function(m){var S;this.length>m.length?S=m:S=this;for(var _=0;_<S.length;_++)this.words[_]=this.words[_]&m.words[_];return this.length=S.length,this.strip()},"iuand"),r.prototype.iand=a(function(m){return i((this.negative|m.negative)===0),this.iuand(m)},"iand"),r.prototype.and=a(function(m){return this.length>m.length?this.clone().iand(m):m.clone().iand(this)},"and"),r.prototype.uand=a(function(m){return this.length>m.length?this.clone().iuand(m):m.clone().iuand(this)},"uand"),r.prototype.iuxor=a(function(m){var S,_;this.length>m.length?(S=this,_=m):(S=m,_=this);for(var A=0;A<_.length;A++)this.words[A]=S.words[A]^_.words[A];if(this!==S)for(;A<S.length;A++)this.words[A]=S.words[A];return this.length=S.length,this.strip()},"iuxor"),r.prototype.ixor=a(function(m){return i((this.negative|m.negative)===0),this.iuxor(m)},"ixor"),r.prototype.xor=a(function(m){return this.length>m.length?this.clone().ixor(m):m.clone().ixor(this)},"xor"),r.prototype.uxor=a(function(m){return this.length>m.length?this.clone().iuxor(m):m.clone().iuxor(this)},"uxor"),r.prototype.inotn=a(function(m){i(typeof m=="number"&&m>=0);var S=Math.ceil(m/26)|0,_=m%26;this._expand(S),_>0&&S--;for(var A=0;A<S;A++)this.words[A]=~this.words[A]&67108863;return _>0&&(this.words[A]=~this.words[A]&67108863>>26-_),this.strip()},"inotn"),r.prototype.notn=a(function(m){return this.clone().inotn(m)},"notn"),r.prototype.setn=a(function(m,S){i(typeof m=="number"&&m>=0);var _=m/26|0,A=m%26;return this._expand(_+1),S?this.words[_]=this.words[_]|1<<A:this.words[_]=this.words[_]&~(1<<A),this.strip()},"setn"),r.prototype.iadd=a(function(m){var S;if(this.negative!==0&&m.negative===0)return this.negative=0,S=this.isub(m),this.negative^=1,this._normSign();if(this.negative===0&&m.negative!==0)return m.negative=0,S=this.isub(m),m.negative=1,S._normSign();var _,A;this.length>m.length?(_=this,A=m):(_=m,A=this);for(var x=0,C=0;C<A.length;C++)S=(_.words[C]|0)+(A.words[C]|0)+x,this.words[C]=S&67108863,x=S>>>26;for(;x!==0&&C<_.length;C++)S=(_.words[C]|0)+x,this.words[C]=S&67108863,x=S>>>26;if(this.length=_.length,x!==0)this.words[this.length]=x,this.length++;else if(_!==this)for(;C<_.length;C++)this.words[C]=_.words[C];return this},"iadd"),r.prototype.add=a(function(m){var S;return m.negative!==0&&this.negative===0?(m.negative=0,S=this.sub(m),m.negative^=1,S):m.negative===0&&this.negative!==0?(this.negative=0,S=m.sub(this),this.negative=1,S):this.length>m.length?this.clone().iadd(m):m.clone().iadd(this)},"add"),r.prototype.isub=a(function(m){if(m.negative!==0){m.negative=0;
vendor: 17,291 bytes, line 107
107var S=this.iadd(m);return m.negative=1,S._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(m),this.negative=1,this._normSign();var _=this.cmp(m);if(_===0)return this.negative=0,this.length=1,this.words[0]=0,this;var A,x;_>0?(A=this,x=m):(A=m,x=this);for(var C=0,U=0;U<x.length;U++)S=(A.words[U]|0)-(x.words[U]|0)+C,C=S>>26,this.words[U]=S&67108863;for(;C!==0&&U<A.length;U++)S=(A.words[U]|0)+C,C=S>>26,this.words[U]=S&67108863;if(C===0&&U<A.length&&A!==this)for(;U<A.length;U++)this.words[U]=A.words[U];return this.length=Math.max(this.length,U),A!==this&&(this.negative=1),this.strip()},"isub"),r.prototype.sub=a(function(m){return this.clone().isub(m)},"sub");function g(L,m,S){S.negative=m.negative^L.negative;var _=L.length+m.length|0;S.length=_,_=_-1|0;var A=L.words[0]|0,x=m.words[0]|0,C=A*x,U=C&67108863,R=C/67108864|0;S.words[0]=U;for(var w=1;w<_;w++){for(var P=R>>>26,V=R&67108863,Z=Math.min(w,m.length-1),ee=Math.max(0,w-L.length+1);ee<=Z;ee++){var ne=w-ee|0;A=L.words[ne]|0,x=m.words[ee]|0,C=A*x+V,P+=C/67108864|0,V=C&67108863}S.words[w]=V|0,R=P|0}return R!==0?S.words[w]=R|0:S.length--,S.strip()}a(g,"smallMulTo");var v=a(function(m,S,_){var A=m.words,x=S.words,C=_.words,U=0,R,w,P,V=A[0]|0,Z=V&8191,ee=V>>>13,ne=A[1]|0,se=ne&8191,ge=ne>>>13,ie=A[2]|0,j=ie&8191,Y=ie>>>13,le=A[3]|0,pe=le&8191,Te=le>>>13,Le=A[4]|0,De=Le&8191,_e=Le>>>13,we=A[5]|0,ye=we&8191,te=we>>>13,he=A[6]|0,ae=he&8191,ve=he>>>13,lt=A[7]|0,Ye=lt&8191,nt=lt>>>13,Qt=A[8]|0,W=Qt&8191,k=Qt>>>13,O=A[9]|0,K=O&8191,Q=O>>>13,ce=x[0]|0,oe=ce&8191,ke=ce>>>13,ft=x[1]|0,et=ft&8191,it=ft>>>13,_t=x[2]|0,Gt=_t&8191,Rt=_t>>>13,Lo=x[3]|0,zt=Lo&8191,dn=Lo>>>13,Ri=x[4]|0,Jt=Ri&8191,Vt=Ri>>>13,Gr=x[5]|0,$t=Gr&8191,on=Gr>>>13,rc=x[6]|0,gn=rc&8191,xn=rc>>>13,yu=x[7]|0,mn=yu&8191,bn=yu>>>13,oc=x[8]|0,In=oc&8191,cn=oc>>>13,Kp=x[9]|0,Ln=Kp&8191,ut=Kp>>>13;_.negative=m.negative^S.negative,_.length=19,R=Math.imul(Z,oe),w=Math.imul(Z,ke),w=w+Math.imul(ee,oe)|0,P=Math.imul(ee,ke);var Js=(U+R|0)+((w&8191)<<13)|0;U=(P+(w>>>13)|0)+(Js>>>26)|0,Js&=67108863,R=Math.imul(se,oe),w=Math.imul(se,ke),w=w+Math.imul(ge,oe)|0,P=Math.imul(ge,ke),R=R+Math.imul(Z,et)|0,w=w+Math.imul(Z,it)|0,w=w+Math.imul(ee,et)|0,P=P+Math.imul(ee,it)|0;var bu=(U+R|0)+((w&8191)<<13)|0;U=(P+(w>>>13)|0)+(bu>>>26)|0,bu&=67108863,R=Math.imul(j,oe),w=Math.imul(j,ke),w=w+Math.imul(Y,oe)|0,P=Math.imul(Y,ke),R=R+Math.imul(se,et)|0,w=w+Math.imul(se,it)|0,w=w+Math.imul(ge,et)|0,P=P+Math.imul(ge,it)|0,R=R+Math.imul(Z,Gt)|0,w=w+Math.imul(Z,Rt)|0,w=w+Math.imul(ee,Gt)|0,P=P+Math.imul(ee,Rt)|0;var ac=(U+R|0)+((w&8191)<<13)|0;U=(P+(w>>>13)|0)+(ac>>>26)|0,ac&=67108863,R=Math.imul(pe,oe),w=Math.imul(pe,ke),w=w+Math.imul(Te,oe)|0,P=Math.imul(Te,ke),R=R+Math.imul(j,et)|0,w=w+Math.imul(j,it)|0,w=w+Math.imul(Y,et)|0,P=P+Math.imul(Y,it)|0,R=R+Math.imul(se,Gt)|0,w=w+Math.imul(se,Rt)|0,w=w+Math.imul(ge,Gt)|0,P=P+Math.imul(ge,Rt)|0,R=R+Math.imul(Z,zt)|0,w=w+Math.imul(Z,dn)|0,w=w+Math.imul(ee,zt)|0,P=P+Math.imul(ee,dn)|0;var Wa=(U+R|0)+((w&8191)<<13)|0;U=(P+(w>>>13)|0)+(Wa>>>26)|0,Wa&=67108863,R=Math.imul(De,oe),w=Math.imul(De,ke),w=w+Math.imul(_e,oe)|0,P=Math.imul(_e,ke),R=R+Math.imul(pe,et)|0,w=w+Math.imul(pe,it)|0,w=w+Math.imul(Te,et)|0,P=P+Math.imul(Te,it)|0,R=R+Math.imul(j,Gt)|0,w=w+Math.imul(j,Rt)|0,w=w+Math.imul(Y,Gt)|0,P=P+Math.imul(Y,Rt)|0,R=R+Math.imul(se,zt)|0,w=w+Math.imul(se,dn)|0,w=w+Math.imul(ge,zt)|0,P=P+Math.imul(ge,dn)|0,R=R+Math.imul(Z,Jt)|0,w=w+Math.imul(Z,Vt)|0,w=w+Math.imul(ee,Jt)|0,P=P+Math.imul(ee,Vt)|0;var lc=(U+R|0)+((w&8191)<<13)|0;U=(P+(w>>>13)|0)+(lc>>>26)|0,lc&=67108863,R=Math.imul(ye,oe),w=Math.imul(ye,ke),w=w+Math.imul(te,oe)|0,P=Math.imul(te,ke),R=R+Math.imul(De,et)|0,w=w+Math.imul(De,it)|0,w=w+Math.imul(_e,et)|0,P=P+Math.imul(_e,it)|0,R=R+Math.imul(pe,Gt)|0,w=w+Math.imul(pe,Rt)|0,w=w+Math.imul(Te,Gt)|0,P=P+Math.imul(Te,Rt)|0,R=R+Math.imul(j,zt)|0,w=w+Math.imul(j,dn)|0,w=w+Math.imul(Y,zt)|0,P=P+Math.imul(Y,dn)|0,R=R+Math.imul(se,Jt)|0,w=w+Math.imul(se,Vt)|0,w=w+Math.imul(ge,Jt)|0,P=P+Math.imul(ge,Vt)|0,R=R+Math.imul(Z,$t)|0,w=w+Math.imul(Z,on)|0,w=w+Math.imul(ee,$t)|0,P=P+Math.imul(ee,on)|0;var cc=(U+R|0)+((w&8191)<<13)|0;U=(P+(w>>>13)|0)+(cc>>>26)|0,cc&=67108863,R=Math.imul(ae,oe),w=Math.imul(ae,ke),w=w+Math.imul(ve,oe)|0,P=Math.imul(ve,ke),R=R+Math.imul(ye,et)|0,w=w+Math.imul(ye,it)|0,w=w+Math.imul(te,et)|0,P=P+Math.imul(te,it)|0,R=R+Math.imul(De,Gt)|0,w=w+Math.imul(De,Rt)|0,w=w+Math.imul(_e,Gt)|0,P=P+Math.imul(_e,Rt)|0,R=R+Math.imul(pe,zt)|0,w=w+Math.imul(pe,dn)|0,w=w+Math.imul(Te,zt)|0,P=P+Math.imul(Te,dn)|0,R=R+Math.imul(j,Jt)|0,w=w+Math.imul(j,Vt)|0,w=w+Math.imul(Y,Jt)|0,P=P+Math.imul(Y,Vt)|0,R=R+Math.imul(se,$t)|0,w=w+Math.imul(se,on)|0,w=w+Math.imul(ge,$t)|0,P=P+Math.imul(ge,on)|0,R=R+Math.imul(Z,gn)|0,w=w+Math.imul(Z,xn)|0,w=w+Math.imul(ee,gn)|0,P=P+Math.imul(ee,xn)|0;var Eu=(U+R|0)+((w&8191)<<13)|0;U=(P+(w>>>13)|0)+(Eu>>>26)|0,Eu&=67108863,R=Math.imul(Ye,oe),w=Math.imul(Ye,ke),w=w+Math.imul(nt,oe)|0,P=Math.imul(nt,ke),R=R+Math.imul(ae,et)|0,w=w+Math.imul(ae,it)|0,w=w+Math.imul(ve,et)|0,P=P+Math.imul(ve,it)|0,R=R+Math.imul(ye,Gt)|0,w=w+Math.imul(ye,Rt)|0,w=w+Math.imul(te,Gt)|0,P=P+Math.imul(te,Rt)|0,R=R+Math.imul(De,zt)|0,w=w+Math.imul(De,dn)|0,w=w+Math.imul(_e,zt)|0,P=P+Math.imul(_e,dn)|0,R=R+Math.imul(pe,Jt)|0,w=w+Math.imul(pe,Vt)|0,w=w+Math.imul(Te,Jt)|0,P=P+Math.imul(Te,Vt)|0,R=R+Math.imul(j,$t)|0,w=w+Math.imul(j,on)|0,w=w+Math.imul(Y,$t)|0,P=P+Math.imul(Y,on)|0,R=R+Math.imul(se,gn)|0,w=w+Math.imul(se,xn)|0,w=w+Math.imul(ge,gn)|0,P=P+Math.imul(ge,xn)|0,R=R+Math.imul(Z,mn)|0,w=w+Math.imul(Z,bn)|0,w=w+Math.imul(ee,mn)|0,P=P+Math.imul(ee,bn)|0;var _u=(U+R|0)+((w&8191)<<13)|0;U=(P+(w>>>13)|0)+(_u>>>26)|0,_u&=67108863,R=Math.imul(W,oe),w=Math.imul(W,ke),w=w+Math.imul(k,oe)|0,P=Math.imul(k,ke),R=R+Math.imul(Ye,et)|0,w=w+Math.imul(Ye,it)|0,w=w+Math.imul(nt,et)|0,P=P+Math.imul(nt,it)|0,R=R+Math.imul(ae,Gt)|0,w=w+Math.imul(ae,Rt)|0,w=w+Math.imul(ve,Gt)|0,P=P+Math.imul(ve,Rt)|0,R=R+Math.imul(ye,zt)|0,w=w+Math.imul(ye,dn)|0,w=w+Math.imul(te,zt)|0,P=P+Math.imul(te,dn)|0,R=R+Math.imul(De,Jt)|0,w=w+Math.imul(De,Vt)|0,w=w+Math.imul(_e,Jt)|0,P=P+Math.imul(_e,Vt)|0,R=R+Math.imul(pe,$t)|0,w=w+Math.imul(pe,on)|0,w=w+Math.imul(Te,$t)|0,P=P+Math.imul(Te,on)|0,R=R+Math.imul(j,gn)|0,w=w+Math.imul(j,xn)|0,w=w+Math.imul(Y,gn)|0,P=P+Math.imul(Y,xn)|0,R=R+Math.imul(se,mn)|0,w=w+Math.imul(se,bn)|0,w=w+Math.imul(ge,mn)|0,P=P+Math.imul(ge,bn)|0,R=R+Math.imul(Z,In)|0,w=w+Math.imul(Z,cn)|0,w=w+Math.imul(ee,In)|0,P=P+Math.imul(ee,cn)|0;var wu=(U+R|0)+((w&8191)<<13)|0;U=(P+(w>>>13)|0)+(wu>>>26)|0,wu&=67108863,R=Math.imul(K,oe),w=Math.imul(K,ke),w=w+Math.imul(Q,oe)|0,P=Math.imul(Q,ke),R=R+Math.imul(W,et)|0,w=w+Math.imul(W,it)|0,w=w+Math.imul(k,et)|0,P=P+Math.imul(k,it)|0,R=R+Math.imul(Ye,Gt)|0,w=w+Math.imul(Ye,Rt)|0,w=w+Math.imul(nt,Gt)|0,P=P+Math.imul(nt,Rt)|0,R=R+Math.imul(ae,zt)|0,w=w+Math.imul(ae,dn)|0,w=w+Math.imul(ve,zt)|0,P=P+Math.imul(ve,dn)|0,R=R+Math.imul(ye,Jt)|0,w=w+Math.imul(ye,Vt)|0,w=w+Math.imul(te,Jt)|0,P=P+Math.imul(te,Vt)|0,R=R+Math.imul(De,$t)|0,w=w+Math.imul(De,on)|0,w=w+Math.imul(_e,$t)|0,P=P+Math.imul(_e,on)|0,R=R+Math.imul(pe,gn)|0,w=w+Math.imul(pe,xn)|0,w=w+Math.imul(Te,gn)|0,P=P+Math.imul(Te,xn)|0,R=R+Math.imul(j,mn)|0,w=w+Math.imul(j,bn)|0,w=w+Math.imul(Y,mn)|0,P=P+Math.imul(Y,bn)|0,R=R+Math.imul(se,In)|0,w=w+Math.imul(se,cn)|0,w=w+Math.imul(ge,In)|0,P=P+Math.imul(ge,cn)|0,R=R+Math.imul(Z,Ln)|0,w=w+Math.imul(Z,ut)|0,w=w+Math.imul(ee,Ln)|0,P=P+Math.imul(ee,ut)|0;var Su=(U+R|0)+((w&8191)<<13)|0;U=(P+(w>>>13)|0)+(Su>>>26)|0,Su&=67108863,R=Math.imul(K,et),w=Math.imul(K,it),w=w+Math.imul(Q,et)|0,P=Math.imul(Q,it),R=R+Math.imul(W,Gt)|0,w=w+Math.imul(W,Rt)|0,w=w+Math.imul(k,Gt)|0,P=P+Math.imul(k,Rt)|0,R=R+Math.imul(Ye,zt)|0,w=w+Math.imul(Ye,dn)|0,w=w+Math.imul(nt,zt)|0,P=P+Math.imul(nt,dn)|0,R=R+Math.imul(ae,Jt)|0,w=w+Math.imul(ae,Vt)|0,w=w+Math.imul(ve,Jt)|0,P=P+Math.imul(ve,Vt)|0,R=R+Math.imul(ye,$t)|0,w=w+Math.imul(ye,on)|0,w=w+Math.imul(te,$t)|0,P=P+Math.imul(te,on)|0,R=R+Math.imul(De,gn)|0,w=w+Math.imul(De,xn)|0,w=w+Math.imul(_e,gn)|0,P=P+Math.imul(_e,xn)|0,R=R+Math.imul(pe,mn)|0,w=w+Math.imul(pe,bn)|0,w=w+Math.imul(Te,mn)|0,P=P+Math.imul(Te,bn)|0,R=R+Math.imul(j,In)|0,w=w+Math.imul(j,cn)|0,w=w+Math.imul(Y,In)|0,P=P+Math.imul(Y,cn)|0,R=R+Math.imul(se,Ln)|0,w=w+Math.imul(se,ut)|0,w=w+Math.imul(ge,Ln)|0,P=P+Math.imul(ge,ut)|0;var ys=(U+R|0)+((w&8191)<<13)|0;U=(P+(w>>>13)|0)+(ys>>>26)|0,ys&=67108863,R=Math.imul(K,Gt),w=Math.imul(K,Rt),w=w+Math.imul(Q,Gt)|0,P=Math.imul(Q,Rt),R=R+Math.imul(W,zt)|0,w=w+Math.imul(W,dn)|0,w=w+Math.imul(k,zt)|0,P=P+Math.imul(k,dn)|0,R=R+Math.imul(Ye,Jt)|0,w=w+Math.imul(Ye,Vt)|0,w=w+Math.imul(nt,Jt)|0,P=P+Math.imul(nt,Vt)|0,R=R+Math.imul(ae,$t)|0,w=w+Math.imul(ae,on)|0,w=w+Math.imul(ve,$t)|0,P=P+Math.imul(ve,on)|0,R=R+Math.imul(ye,gn)|0,w=w+Math.imul(ye,xn)|0,w=w+Math.imul(te,gn)|0,P=P+Math.imul(te,xn)|0,R=R+Math.imul(De,mn)|0,w=w+Math.imul(De,bn)|0,w=w+Math.imul(_e,mn)|0,P=P+Math.imul(_e,bn)|0,R=R+Math.imul(pe,In)|0,w=w+Math.imul(pe,cn)|0,w=w+Math.imul(Te,In)|0,P=P+Math.imul(Te,cn)|0,R=R+Math.imul(j,Ln)|0,w=w+Math.imul(j,ut)|0,w=w+Math.imul(Y,Ln)|0,P=P+Math.imul(Y,ut)|0;var Ro=(U+R|0)+((w&8191)<<13)|0;U=(P+(w>>>13)|0)+(Ro>>>26)|0,Ro&=67108863,R=Math.imul(K,zt),w=Math.imul(K,dn),w=w+Math.imul(Q,zt)|0,P=Math.imul(Q,dn),R=R+Math.imul(W,Jt)|0,w=w+Math.imul(W,Vt)|0,w=w+Math.imul(k,Jt)|0,P=P+Math.imul(k,Vt)|0,R=R+Math.imul(Ye,$t)|0,w=w+Math.imul(Ye,on)|0,w=w+Math.imul(nt,$t)|0,P=P+Math.imul(nt,on)|0,R=R+Math.imul(ae,gn)|0,w=w+Math.imul(ae,xn)|0,w=w+Math.imul(ve,gn)|0,P=P+Math.imul(ve,xn)|0,R=R+Math.imul(ye,mn)|0,w=w+Math.imul(ye,bn)|0,w=w+Math.imul(te,mn)|0,P=P+Math.imul(te,bn)|0,R=R+Math.imul(De,In)|0,w=w+Math.imul(De,cn)|0,w=w+Math.imul(_e,In)|0,P=P+Math.imul(_e,cn)|0,R=R+Math.imul(pe,Ln)|0,w=w+Math.imul(pe,ut)|0,w=w+Math.imul(Te,Ln)|0,P=P+Math.imul(Te,ut)|0;var Ps=(U+R|0)+((w&8191)<<13)|0;U=(P+(w>>>13)|0)+(Ps>>>26)|0,Ps&=67108863,R=Math.imul(K,Jt),w=Math.imul(K,Vt),w=w+Math.imul(Q,Jt)|0,P=Math.imul(Q,Vt),R=R+Math.imul(W,$t)|0,w=w+Math.imul(W,on)|0,w=w+Math.imul(k,$t)|0,P=P+Math.imul(k,on)|0,R=R+Math.imul(Ye,gn)|0,w=w+Math.imul(Ye,xn)|0,w=w+Math.imul(nt,gn)|0,P=P+Math.imul(nt,xn)|0,R=R+Math.imul(ae,mn)|0,w=w+Math.imul(ae,bn)|0,w=w+Math.imul(ve,mn)|0,P=P+Math.imul(ve,bn)|0,R=R+Math.imul(ye,In)|0,w=w+Math.imul(ye,cn)|0,w=w+Math.imul(te,In)|0,P=P+Math.imul(te,cn)|0,R=R+Math.imul(De,Ln)|0,w=w+Math.imul(De,ut)|0,w=w+Math.imul(_e,Ln)|0,P=P+Math.imul(_e,ut)|0;var Tu=(U+R|0)+((w&8191)<<13)|0;U=(P+(w>>>13)|0)+(Tu>>>26)|0,Tu&=67108863,R=Math.imul(K,$t),w=Math.imul(K,on),w=w+Math.imul(Q,$t)|0,P=Math.imul(Q,on),R=R+Math.imul(W,gn)|0,w=w+Math.imul(W,xn)|0,w=w+Math.imul(k,gn)|0,P=P+Math.imul(k,xn)|0,R=R+Math.imul(Ye,mn)|0,w=w+Math.imul(Ye,bn)|0,w=w+Math.imul(nt,mn)|0,P=P+Math.imul(nt,bn)|0,R=R+Math.imul(ae,In)|0,w=w+Math.imul(ae,cn)|0,w=w+Math.imul(ve,In)|0,P=P+Math.imul(ve,cn)|0,R=R+Math.imul(ye,Ln)|0,w=w+Math.imul(ye,ut)|0,w=w+Math.imul(te,Ln)|0,P=P+Math.imul(te,ut)|0;var Vr=(U+R|0)+((w&8191)<<13)|0;U=(P+(w>>>13)|0)+(Vr>>>26)|0,Vr&=67108863,R=Math.imul(K,gn),w=Math.imul(K,xn),w=w+Math.imul(Q,gn)|0,P=Math.imul(Q,xn),R=R+Math.imul(W,mn)|0,w=w+Math.imul(W,bn)|0,w=w+Math.imul(k,mn)|0,P=P+Math.imul(k,bn)|0,R=R+Math.imul(Ye,In)|0,w=w+Math.imul(Ye,cn)|0,w=w+Math.imul(nt,In)|0,P=P+Math.imul(nt,cn)|0,R=R+Math.imul(ae,Ln)|0,w=w+Math.imul(ae,ut)|0,w=w+Math.imul(ve,Ln)|0,P=P+Math.imul(ve,ut)|0;var Au=(U+R|0)+((w&8191)<<13)|0;U=(P+(w>>>13)|0)+(Au>>>26)|0,Au&=67108863,R=Math.imul(K,mn),w=Math.imul(K,bn),w=w+Math.imul(Q,mn)|0,P=Math.imul(Q,bn),R=R+Math.imul(W,In)|0,w=w+Math.imul(W,cn)|0,w=w+Math.imul(k,In)|0,P=P+Math.imul(k,cn)|0,R=R+Math.imul(Ye,Ln)|0,w=w+Math.imul(Ye,ut)|0,w=w+Math.imul(nt,Ln)|0,P=P+Math.imul(nt,ut)|0;var dc=(U+R|0)+((w&8191)<<13)|0;U=(P+(w>>>13)|0)+(dc>>>26)|0,dc&=67108863,R=Math.imul(K,In),w=Math.imul(K,cn),w=w+Math.imul(Q,In)|0,P=Math.imul(Q,cn),R=R+Math.imul(W,Ln)|0,w=w+Math.imul(W,ut)|0,w=w+Math.imul(k,Ln)|0,P=P+Math.imul(k,ut)|0;var uc=(U+R|0)+((w&8191)<<13)|0;U=(P+(w>>>13)|0)+(uc>>>26)|0,uc&=67108863,R=Math.imul(K,Ln),w=Math.imul(K,ut),w=w+Math.imul(Q,Ln)|0,P=Math.imul(Q,ut);var ko=(U+R|0)+((w&8191)<<13)|0;return U=(P+(w>>>13)|0)+(ko>>>26)|0,ko&=67108863,C[0]=Js,C[1]=bu,C[2]=ac,C[3]=Wa,C[4]=lc,C[5]=cc,C[6]=Eu,C[7]=_u,C[8]=wu,C[9]=Su,C[10]=ys,C[11]=Ro,C[12]=Ps,C[13]=Tu,C[14]=Vr,C[15]=Au,C[16]=dc,C[17]=uc,C[18]=ko,U!==0&&(C[19]=U,_.length++),_},"comb10MulTo");Math.imul||(v=g);function y(L,m,S){S.negative=m.negative^L.negative,S.length=L.length+m.length;for(var _=0,A=0,x=0;x<S.length-1;x++){var C=A;A=0;for(var U=_&67108863,R=Math.min(x,m.length-1),w=Math.max(0,x-L.length+1);w<=R;w++){var P=x-w,V=L.words[P]|0,Z=m.words[w]|0,ee=V*Z,ne=ee&67108863;C=C+(ee/67108864|0)|0,ne=ne+U|0,U=ne&67108863,C=C+(ne>>>26)|0,A+=C>>>26,C&=67108863}S.words[x]=U,_=C,C=A}return _!==0?S.words[x]=_:S.length--,S.strip()}a(y,"bigMulTo");function b(L,m,S){var _=new E;return _.mulp(L,m,S)}a(b,"jumboMulTo"),r.prototype.mulTo=a(function(m,S){var _,A=this.length+m.length;return this.length===10&&m.length===10?_=v(this,m,S):A<63?_=g(this,m,S):A<1024?_=y(this,m,S):_=b(this,m,S),_},"mulTo");function E(L,m){this.x=L,this.y=m}a(E,"FFTM"),E.prototype.makeRBT=a(function(m){for(var S=new Array(m),_=r.prototype._countBits(m)-1,A=0;A<m;A++)S[A]=this.revBin(A,_,m);return S},"makeRBT"),E.prototype.revBin=a(function(m,S,_){if(m===0||m===_-1)return m;for(var A=0,x=0;x<S;x++)A|=(m&1)<<S-x-1,m>>=1;return A},"revBin"),E.prototype.permute=a(function(m,S,_,A,x,C){for(var U=0;U<C;U++)A[U]=S[m[U]],x[U]=_[m[U]]},"permute"),E.prototype.transform=a(function(m,S,_,A,x,C){this.permute(C,m,S,_,A,x);for(var U=1;U<x;U<<=1)for(var R=U<<1,w=Math.cos(2*Math.PI/R),P=Math.sin(2*Math.PI/R),V=0;V<x;V+=R)for(var Z=w,ee=P,ne=0;ne<U;ne++){var se=_[V+ne],ge=A[V+ne],ie=_[V+ne+U],j=A[V+ne+U],Y=Z*ie-ee*j;j=Z*j+ee*ie,ie=Y,_[V+ne]=se+ie,A[V+ne]=ge+j,_[V+ne+U]=se-ie,A[V+ne+U]=ge-j,ne!==R&&(Y=w*Z-P*ee,ee=w*ee+P*Z,Z=Y)}},"transform"),E.prototype.guessLen13b=a(function(m,S){var _=Math.max(S,m)|1,A=_&1,x=0;for(_=_/2|0;_;_=_>>>1)x++;return 1<<x+1+A},"guessLen13b"),E.prototype.conjugate=a(function(m,S,_){if(!(_<=1))for(var A=0;A<_/2;A++){var x=m[A];m[A]=m[_-A-1],m[_-A-1]=x,x=S[A],S[A]=-S[_-A-1],S[_-A-1]=-x}},"conjugate"),E.prototype.normalize13b=a(function(m,S){for(var _=0,A=0;A<S/2;A++){var x=Math.round(m[2*A+1]/S)*8192+Math.round(m[2*A]/S)+_;m[A]=x&67108863,x<67108864?_=0:_=x/67108864|0}return m},"normalize13b"),E.prototype.convert13b=a(function(m,S,_,A){for(var x=0,C=0;C<S;C++)x=x+(m[C]|0),_[2*C]=x&8191,x=x>>>13,_[2*C+1]=x&8191,x=x>>>13;for(C=2*S;C<A;++C)_[C]=0;i(x===0),i((x&-8192)===0)},"convert13b"),E.prototype.stub=a(function(m){for(var S=new Array(m),_=0;_<m;_++)S[_]=0;return S},"stub"),E.prototype.mulp=a(function(m,S,_){var A=2*this.guessLen13b(m.length,S.length),x=this.makeRBT(A),C=this.stub(A),U=new Array(A),R=new Array(A),w=new Array(A),P=new Array(A),V=new Array(A),Z=new Array(A),ee=_.words;ee.length=A,this.convert13b(m.words,m.length,U,A),this.convert13b(S.words,S.length,P,A),this.transform(U,C,R,w,A,x),this.transform(P,C,V,Z,A,x);for(var ne=0;ne<A;ne++){var se=R[ne]*V[ne]-w[ne]*Z[ne];w[ne]=R[ne]*Z[ne]+w[ne]*V[ne],R[ne]=se}return this.conjugate(R,w,A),this.transform(R,w,ee,C,A,x),this.conjugate(ee,C,A),this.normalize13b(ee,A),_.negative=m.negative^S.negative,_.length=m.length+S.length,_.strip()},"mulp"),r.prototype.mul=a(function(m){var S=new r(null);return S.words=new Array(this.length+m.length),this.mulTo(m,S)},"mul"),r.prototype.mulf=a(function(m){var S=new r(null);return S.words=new Array(this.length+m.length),b(this,m,S)},"mulf"),r.prototype.imul=a(function(m){return this.clone().mulTo(m,this)},"imul"),r.prototype.imuln=a(function(m){i(typeof m=="number"),i(m<67108864);for(var S=0,_=0;_<this.length;_++){var A=(this.words[_]|0)*m,x=(A&67108863)+(S&67108863);S>>=26,S+=A/67108864|0,S+=x>>>26,this.words[_]=x&67108863}return S!==0&&(this.words[_]=S,this.length++),this.length=m===0?1:this.length,this},"imuln"),r.prototype.muln=a(function(m){return this.clone().imuln(m)},"muln"),r.prototype.sqr=a(function(){return this.mul(this)},"sqr"),r.prototype.isqr=a(function(){return this.imul(this.clone())},"isqr"),r.prototype.pow=a(function(m){var S=p(m);if(S.length===0)return new r(1);for(var _=this,A=0;A<S.length&&S[A]===0;A++,_=_.sqr());if(++A<S.length)for(var x=_.sqr();A<S.length;A++,x=x.sqr())S[A]!==0&&(_=_.mul(x));return _},"pow"),r.prototype.iushln=a(function(m){i(typeof m=="number"&&m>=0);var S=m%26,_=(m-S)/26,A=67108863>>>26-S<<26-S,x;if(S!==0){var C=0;for(x=0;x<this.length;x++){var U=this.words[x]&A,R=(this.words[x]|0)-U<<S;this.words[x]=R|C,C=U>>>26-S}C&&(this.words[x]=C,this.length++)}if(_!==0){for(x=this.length-1;x>=0;x--)this.words[x+_]=this.words[x];for(x=0;x<_;x++)this.words[x]=0;this.length+=_}return this.strip()},"iushln"),r.prototype.ishln=a(function(m){return i(this.negative===0),this.iushln(m)},"ishln"),r.prototype.iushrn=a(function(m,S,_){i(typeof m=="number"&&m>=0);var A;S?A=(S-S%26)/26:A=0;var x=m%26,C=Math.min((m-x)/26,this.length),U=67108863^67108863>>>x<<x,R=_;if(A-=C,A=Math.max(0,A),R){for(var w=0;w<C;w++)R.words[w]=this.words[w];R.length=C}if(C!==0)if(this.length>C)for(this.length-=C,w=0;w<this.length;w++)this.words[w]=this.words[w+C];else this.words[0]=0,this.length=1;var P=0;for(w=this.length-1;w>=0&&(P!==0||w>=A);w--){var V=this.words[w]|0;this.words[w]=P<<26-x|V>>>
vendor: 4,837 bytes, line 107
107x,P=V&U}return R&&P!==0&&(R.words[R.length++]=P),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},"iushrn"),r.prototype.ishrn=a(function(m,S,_){return i(this.negative===0),this.iushrn(m,S,_)},"ishrn"),r.prototype.shln=a(function(m){return this.clone().ishln(m)},"shln"),r.prototype.ushln=a(function(m){return this.clone().iushln(m)},"ushln"),r.prototype.shrn=a(function(m){return this.clone().ishrn(m)},"shrn"),r.prototype.ushrn=a(function(m){return this.clone().iushrn(m)},"ushrn"),r.prototype.testn=a(function(m){i(typeof m=="number"&&m>=0);var S=m%26,_=(m-S)/26,A=1<<S;if(this.length<=_)return!1;var x=this.words[_];return!!(x&A)},"testn"),r.prototype.imaskn=a(function(m){i(typeof m=="number"&&m>=0);var S=m%26,_=(m-S)/26;if(i(this.negative===0,"imaskn works only with positive numbers"),this.length<=_)return this;if(S!==0&&_++,this.length=Math.min(_,this.length),S!==0){var A=67108863^67108863>>>S<<S;this.words[this.length-1]&=A}return this.strip()},"imaskn"),r.prototype.maskn=a(function(m){return this.clone().imaskn(m)},"maskn"),r.prototype.iaddn=a(function(m){return i(typeof m=="number"),i(m<67108864),m<0?this.isubn(-m):this.negative!==0?this.length===1&&(this.words[0]|0)<m?(this.words[0]=m-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(m),this.negative=1,this):this._iaddn(m)},"iaddn"),r.prototype._iaddn=a(function(m){this.words[0]+=m;for(var S=0;S<this.length&&this.words[S]>=67108864;S++)this.words[S]-=67108864,S===this.length-1?this.words[S+1]=1:this.words[S+1]++;return this.length=Math.max(this.length,S+1),this},"_iaddn"),r.prototype.isubn=a(function(m){if(i(typeof m=="number"),i(m<67108864),m<0)return this.iaddn(-m);if(this.negative!==0)return this.negative=0,this.iaddn(m),this.negative=1,this;if(this.words[0]-=m,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var S=0;S<this.length&&this.words[S]<0;S++)this.words[S]+=67108864,this.words[S+1]-=1;return this.strip()},"isubn"),r.prototype.addn=a(function(m){return this.clone().iaddn(m)},"addn"),r.prototype.subn=a(function(m){return this.clone().isubn(m)},"subn"),r.prototype.iabs=a(function(){return this.negative=0,this},"iabs"),r.prototype.abs=a(function(){return this.clone().iabs()},"abs"),r.prototype._ishlnsubmul=a(function(m,S,_){var A=m.length+_,x;this._expand(A);var C,U=0;for(x=0;x<m.length;x++){C=(this.words[x+_]|0)+U;var R=(m.words[x]|0)*S;C-=R&67108863,U=(C>>26)-(R/67108864|0),this.words[x+_]=C&67108863}for(;x<this.length-_;x++)C=(this.words[x+_]|0)+U,U=C>>26,this.words[x+_]=C&67108863;if(U===0)return this.strip();for(i(U===-1),U=0,x=0;x<this.length;x++)C=-(this.words[x]|0)+U,U=C>>26,this.words[x]=C&67108863;return this.negative=1,this.strip()},"_ishlnsubmul"),r.prototype._wordDiv=a(function(m,S){var _=this.length-m.length,A=this.clone(),x=m,C=x.words[x.length-1]|0,U=this._countBits(C);_=26-U,_!==0&&(x=x.ushln(_),A.iushln(_),C=x.words[x.length-1]|0);var R=A.length-x.length,w;if(S!=="mod"){w=new r(null),w.length=R+1,w.words=new Array(w.length);for(var P=0;P<w.length;P++)w.words[P]=0}var V=A.clone()._ishlnsubmul(x,1,R);V.negative===0&&(A=V,w&&(w.words[R]=1));for(var Z=R-1;Z>=0;Z--){var ee=(A.words[x.length+Z]|0)*67108864+(A.words[x.length+Z-1]|0);for(ee=Math.min(ee/C|0,67108863),A._ishlnsubmul(x,ee,Z);A.negative!==0;)ee--,A.negative=0,A._ishlnsubmul(x,1,Z),A.isZero()||(A.negative^=1);w&&(w.words[Z]=ee)}return w&&w.strip(),A.strip(),S!=="div"&&_!==0&&A.iushrn(_),{div:w||null,mod:A}},"_wordDiv"),r.prototype.divmod=a(function(m,S,_){if(i(!m.isZero()),this.isZero())return{div:new r(0),mod:new r(0)};var A,x,C;return this.negative!==0&&m.negative===0?(C=this.neg().divmod(m,S),S!=="mod"&&(A=C.div.neg()),S!=="div"&&(x=C.mod.neg(),_&&x.negative!==0&&x.iadd(m)),{div:A,mod:x}):this.negative===0&&m.negative!==0?(C=this.divmod(m.neg(),S),S!=="mod"&&(A=C.div.neg()),{div:A,mod:C.mod}):this.negative&m.negative?(C=this.neg().divmod(m.neg(),S),S!=="div"&&(x=C.mod.neg(),_&&x.negative!==0&&x.isub(m)),{div:C.div,mod:x}):m.length>this.length||this.cmp(m)<0?{div:new r(0),mod:this}:m.length===1?S==="div"?{div:this.divn(m.words[0]),mod:null}:S==="mod"?{div:null,mod:new r(this.modn(m.words[0]))}:{div:this.divn(m.words[0]),mod:new r(this.modn(m.words[0]))}:this._wordDiv(m,S)},"divmod"),r.prototype.div=a(function(m){return this.divmod(m,"div",!1).div},"div"),r.prototype.mod=a(function(m){return this.divmod(m,"mod",!1).mod},"mod"),r.prototype.umod=a(function(m){return this.divmod(m,"mod",!0).mod},"umod"),r.prototype.divRound=a(function(m){var S=this.divmod(m);if(S.mod.isZero())return S.div;var _=S.div.negative!==0?S.mod.isub(m):S.mod,A=m.ushrn(1),x=m.andln(1),C=_.cmp(A);return C<0||x===1&&C===0?S.div:S.div.negative!==0?S.div.isubn(1):S.div.iaddn(1)},"divRound"),r.prototype.modn=a(function(m){i(m<=67108863);for(var S=(1<<26)%m,_=0,A=this.length-1;A>=0;
107A--)_=(S*_+(this.words[A]|0))%m;return _},"modn"),r.prototype.idivn=a(function(m){i(m<=67108863);for(var S=0,_=this.length-1;_>=0;_--){var A=(this.words[_]|0)+S*67108864;this.words[_]=A/m|0,S=A%m}return this.strip()},"idivn"),r.prototype.divn=a(function(m){return this.clone().idivn(m)},"divn"),r.prototype.egcd=a(function(m){i(m.negative===0),i(!m.isZero());var S=this,_=m.clone();S.negative!==0?S=S.umod(m):S=S.clone();for(var A=new r(1),x=new r(0),C=new r(0),U=new r(1),R=0;S.isEven()&&_.isEven();)S.iushrn(1),_.iushrn(1),++R;for(var w=_.clone(),P=S.clone();!S.isZero();){for(var V=0,Z=1;!(S.words[0]&Z)&&V<26;++V,Z<<=1);if(V>0)for(S.iushrn(V);V-- >0;)(A.isOdd()||x.isOdd())&&(A.iadd(w),x.isub(P)),A.iushrn(1),x.iushrn(1);for(var ee=0,ne=1;!(_.words[0]&ne)&&ee<26;++ee,ne<<=1);if(ee>0)for(_.iushrn(ee);ee-- >0;)(C.isOdd()||U.isOdd())&&(C.iadd(w),U.isub(P)),C.iushrn(1),U.iushrn(1);S.cmp(_)>=0?(S.isub(_),A.isub(C),x.isub(U)):(_.isub(S),C.isub(A),U.isub(x))}return{a:C,b:U,gcd:_.iushln(R)}},"egcd"),r.prototype._invmp=a(function(m){i(m.negative===0),i(!m.isZero());var S=this,_=m.clone();S.negative!==0?S=S.umod(m):S=S.clone();for(var A=new r(1),x=new r(0),C=_.clone();S.cmpn(1)>0&&_.cmpn(1)>0;){for(var U=0,R=1;!(S.words[0]&R)&&U<26;++U,R<<=1);if(U>0)for(S.iushrn(U);U-- >0;)A.isOdd()&&A.iadd(C),A.iushrn(1);for(var w=0,P=1;!(_.words[0]&P)&&w<26;++w,P<<=1);if(w>0)for(_.iushrn(w);w-- >0;)x.isOdd()&&x.iadd(C),x.iushrn(1);S.cmp(_)>=0?(S.isub(_),A.isub(x)):(_.isub(S),x.isub(A))}var V;return S.cmpn(1)===0?V=A:V=x,V.cmpn(0)<0&&V.iadd(m),V},"_invmp"),r.prototype.gcd=a(function(m){if(this.isZero())return m.abs();if(m.isZero())return this.abs();var S=this.clone(),_=m.clone();S.negative=0,_.negative=0;for(var A=0;S.isEven()&&_.isEven();A++)S.iushrn(1),_.iushrn(1);do{for(;S.isEven();)S.iushrn(1);for(;_.isEven();)_.iushrn(1);var x=S.cmp(_);if(x<0){var C=S;S=_,_=C}else if(x===0||_.cmpn(1)===0)break;S.isub(_)}while(!0);return _.iushln(A)},"gcd"),r.prototype.invm=a(function(m){return this.egcd(m).a.umod(m)},"invm"),r.prototype.isEven=a(function(){return(this.words[0]&1)===0},"isEven"),r.prototype.isOdd=a(function(){return(this.words[0]&1)===1},"isOdd"),r.prototype.andln=a(function(m){return this.words[0]&m},"andln"),r.prototype.bincn=a(function(m){i(typeof m=="number");var S=m%26,_=(m-S)/26,A=1<<S;if(this.length<=_)return this._expand(_+1),this.words[_]|=A,this;for(var x=A,C=_;x!==0&&C<this.length;C++){var U=this.words[C]|0;U+=x,x=U>>>26,U&=67108863,this.words[C]=U}return x!==0&&(this.words[C]=x,this.length++),this},"bincn"),r.prototype.isZero=a(function(){return this.length===1&&this.words[0]===0},"isZero"),r.prototype.cmpn=a(function(m){var S=m<0;if(this.negative!==0&&!S)return-1;if(this.negative===0&&S)return 1;this.strip();var _;if(this.length>1)_=1;else{S&&(m=-m),i(m<=67108863,"Number is too big");var A=this.words[0]|0;_=A===m?0:A<m?-1:1}return this.negative!==0?-_|0:_},"cmpn"),r.prototype.cmp=a(function(m){if(this.negative!==0&&m.negative===0)return-1;if(this.negative===0&&m.negative!==0)return 1;var S=this.ucmp(m);return this.negative!==0?-S|0:S},"cmp"),r.prototype.ucmp=a(function(m){if(this.length>m.length)return 1;if(this.length<m.length)return-1;for(var S=0,_=this.length-1;_>=0;_--){var A=this.words[_]|0,x=m.words[_]|0;if(A!==x){A<x?S=-1:A>x&&(S=1);break}}return S},"ucmp"),r.prototype.gtn=a(function(m){return this.cmpn(m)===1},"gtn"),r.prototype.gt=a(function(m){return this.cmp(m)===1},"gt"),r.prototype.gten=a(function(m){return this.cmpn(m)>=0},"gten"),r.prototype.gte=a(function(m){return this.cmp(m)>=0},"gte"),r.prototype.ltn=a(function(m){return this.cmpn(m)===-1},"ltn"),r.prototype.lt=a(function(m){return this.cmp(m)===-1},"lt"),r.prototype.lten=a(function(m){return this.cmpn(m)<=0},"lten"),r.prototype.lte=a(function(m){return this.cmp(m)<=0},"lte"),r.prototype.eqn=a(function(m){return this.cmpn(m)===0},"eqn"),r.prototype.eq=a(function(m){return this.cmp(m)===0},"eq"),r.red=a(function(m){return new F(m)},"red"),r.prototype.toRed=a(function(m){return i(!this.red,"Already a number in reduction context"),i(this.negative===0,"red works only with positives"),m.convertTo(this)._forceRed(m)},"toRed"),r.prototype.fromRed=a(function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},"fromRed"),r.prototype._forceRed=a(function(m){return this.red=m,this},"_forceRed"),r.prototype.forceRed=a(function(m){return i(!this.red,"Already a number in reduction context"),this._forceRed(m)},"forceRed"),r.prototype.redAdd=a(function(m){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,m)},"redAdd"),r.prototype.redIAdd=a(function(m){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,m)},"redIAdd"),r.prototype.redSub=a(function(m){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,m)},"redSub"),r.prototype.redISub=a(function(m){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,m)},"redISub"),r.prototype.redShl=a(function(m){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,m)},"redShl"),r.prototype.redMul=a(function(m){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,m),this.red.mul(this,m)},"redMul"),r.prototype.redIMul=a(function(m){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,m),this.red.imul(this,m)}
107,"redIMul"),r.prototype.redSqr=a(function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},"redSqr"),r.prototype.redISqr=a(function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},"redISqr"),r.prototype.redSqrt=a(function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},"redSqrt"),r.prototype.redInvm=a(function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},"redInvm"),r.prototype.redNeg=a(function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},"redNeg"),r.prototype.redPow=a(function(m){return i(this.red&&!m.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,m)},"redPow");var T={k256:null,p224:null,p192:null,p25519:null};function I(L,m){this.name=L,this.p=new r(m,16),this.n=this.p.bitLength(),this.k=new r(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}a(I,"MPrime"),I.prototype._tmp=a(function(){var m=new r(null);return m.words=new Array(Math.ceil(this.n/13)),m},"_tmp"),I.prototype.ireduce=a(function(m){var S=m,_;do this.split(S,this.tmp),S=this.imulK(S),S=S.iadd(this.tmp),_=S.bitLength();while(_>this.n);var A=_<this.n?-1:S.ucmp(this.p);return A===0?(S.words[0]=0,S.length=1):A>0?S.isub(this.p):S.strip!==void 0?S.strip():S._strip(),S},"ireduce"),I.prototype.split=a(function(m,S){m.iushrn(this.n,0,S)},"split"),I.prototype.imulK=a(function(m){return m.imul(this.k)},"imulK");function M(){I.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}a(M,"K256"),s(M,I),M.prototype.split=a(function(m,S){for(var _=4194303,A=Math.min(m.length,9),x=0;x<A;x++)S.words[x]=m.words[x];if(S.length=A,m.length<=9){m.words[0]=0,m.length=1;return}var C=m.words[9];for(S.words[S.length++]=C&_,x=10;x<m.length;x++){var U=m.words[x]|0;m.words[x-10]=(U&_)<<4|C>>>22,C=U}C>>>=22,m.words[x-10]=C,C===0&&m.length>10?m.length-=10:m.length-=9},"split"),M.prototype.imulK=a(function(m){m.words[m.length]=0,m.words[m.length+1]=0,m.length+=2;for(var S=0,_=0;_<m.length;_++){var A=m.words[_]|0;S+=A*977,m.words[_]=S&67108863,S=A*64+(S/67108864|0)}return m.words[m.length-1]===0&&(m.length--,m.words[m.length-1]===0&&m.length--),m},"imulK");function H(){I.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}a(H,"P224"),s(H,I);function N(){I.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}a(N,"P192"),s(N,I);function $(){I.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}a($,"P25519"),s($,I),$.prototype.imulK=a(function(m){for(var S=0,_=0;_<m.length;_++){var A=(m.words[_]|0)*19+S,x=A&67108863;A>>>=26,m.words[_]=x,S=A}return S!==0&&(m.words[m.length++]=S),m},"imulK"),r._prime=a(function(m){if(T[m])return T[m];var S;if(m==="k256")S=new M;else if(m==="p224")S=new H;else if(m==="p192")S=new N;else if(m==="p25519")S=new $;else throw new Error("Unknown prime "+m);return T[m]=S,S},"prime");function F(L){if(typeof L=="string"){var m=r._prime(L);this.m=m.p,this.prime=m}else i(L.gtn(1),"modulus must be greater than 1"),this.m=L,this.prime=null}a(F,"Red"),F.prototype._verify1=a(function(m){i(m.negative===0,"red works only with positives"),i(m.red,"red works only with red numbers")},"_verify1"),F.prototype._verify2=a(function(m,S){i((m.negative|S.negative)===0,"red works only with positives"),i(m.red&&m.red===S.red,"red works only with red numbers")},"_verify2"),F.prototype.imod=a(function(m){return this.prime?this.prime.ireduce(m)._forceRed(this):m.umod(this.m)._forceRed(this)},"imod"),F.prototype.neg=a(function(m){return m.isZero()?m.clone():this.m.sub(m)._forceRed(this)},"neg"),F.prototype.add=a(function(m,S){this._verify2(m,S);var _=m.add(S);return _.cmp(this.m)>=0&&_.isub(this.m),_._forceRed(this)},"add"),F.prototype.iadd=a(function(m,S){this._verify2(m,S);var _=m.iadd(S);return _.cmp(this.m)>=0&&_.isub(this.m),_},"iadd"),F.prototype.sub=a(function(m,S){this._verify2(m,S);var _=m.sub(S);return _.cmpn(0)<0&&_.iadd(this.m),_._forceRed(this)},"sub"),F.prototype.isub=a(function(m,S){this._verify2(m,S);var _=m.isub(S);return _.cmpn(0)<0&&_.iadd(this.m),_},"isub"),F.prototype.shl=a(function(m,S){return this._verify1(m),this.imod(m.ushln(S))},"shl"),F.prototype.imul=a(function(m,S){return this._verify2(m,S),this.imod(m.imul(S))},"imul"),F.prototype.mul=a(function(m,S){return this._verify2(m,S),this.imod(m.mul(S))},"mul"),F.prototype.isqr=a(function(m){return this.imul(m,m.clone())},"isqr"),F.prototype.sqr=a(function(m){return this.mul(m,m)},"sqr"),F.prototype.sqrt=a(function(m){if(m.isZero())return m.clone();var S=this.m.andln(3);if(i(S%2===1),S===3){var _=this.m.add(new r(1)).iushrn(2);return this.pow(m,_)}for(var A=this.m.subn(1),x=0;!A.isZero()&&A.andln(1)===0;)x++,A.iushrn(1);i(!A.isZero());var C=new r(1).toRed(this),U=C.redNeg(),R=this.m.subn(1).iushrn(1),w=this.m.bitLength();for(w=new r(2*w*w).toRed(this);this.pow(w,R).cmp(U)!==0;)w.redIAdd(U);for(var P=this.pow(w,A),V=this.pow(m,A.addn(1).iushrn(1)),Z=this.pow(m,A),ee=x;Z.cmp(C)!==0;){for(var ne=Z,se=0;ne.cmp(C)!==0;se++)ne=ne.redSqr();i(se<ee);var ge=this.pow(P,new r(1).iushln(ee-se-1));V=V.redMul(ge),P=ge.redSqr(),Z=Z.redMul(P),ee=se}return V},"sqrt"),F.prototype.invm=a(function(m){var S=m._invmp(this.m);return S.negative!==0?(S.negative=0,this.imod(S).redNeg()):this.imod(S)},"invm"),F.prototype.pow=a(function(m,S){if(S.isZero())return new r(1).toRed(this);if(S.cmpn(1)===0)return m.clone();var _=4,A=new Array(1<<_);A[0]=new r(1).toRed(this),A[1]=m;for(var x=2;x<A.length;x++)A[x]=this.mul(A[x-1],m);var C=A[0],U=0,R=0,w=S.bitLength()%26;for(w===0&&(w=26),x=S.length-1;x>=0;x--){for(var P=S.words[x],V=w-1;V>=0;V--){var Z=P>>V&1;if(C!==A[0]&&(C=this.sqr(C)),Z===0&&U===0){R=0;continue}U<<=1,U|=Z,R++,!(R!==_&&(x!==0||V!==0))&&(C=this.mul(C,A[U]),R=0,U=0)}w=26}return C},"pow"),F.prototype.convertTo=a(function(m){var S=m.umod(this.m);return S===m?S.clone():S},"convertTo"),F.prototype.convertFrom=a(function(m){var S=m.clone();return S.red=null,S},"convertFrom"),r.mont=a(function(m){return new D(m)},"mont");function D(L){F.call(this,L),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new r(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}a(D,"Mont"),s(D,F),D.prototype.convertTo=a(function(m){return this.imod(m.ushln(this.shift))},"convertTo"),D.prototype.convertFrom=a(function(m){var S=this.imod(m.mul(this.rinv));return S.red=null,S},"convertFrom"),D.prototype.imul=a(function(m,S){if(m.isZero()||S.isZero())return m.words[0]=0,m.length=1,m;var _=m.imul(S),A=_.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),x=_.isub(A).iushrn(this.shift),C=x;return x.cmp(this.m)>=0?C=x.isub(this.m):x.cmpn(0)<0&&(C=x.iadd(this.m)),C._forceRed(this)},"imul"),D.prototype.mul=a(function(m,S){if(m.isZero()||S.isZero())return new r(0)._forceRed(this);var _=m.mul(S),A=_.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),x=_.isub(A).iushrn(this.shift),C=x;return x.cmp(this.m)>=0?C=x.isub(this.m):x.cmpn(0)<0&&(C=x.iadd(this.m)),C._forceRed(this)},"mul"),D.prototype.invm=a(function(m){var S=this.imod(m._invmp(this.m).mul(this.r2));return S._forceRed(this)},"invm")})(t,Tne)})(tA);var nd=tA.exports;new nd.BN(1e3,10),new nd.BN(1e6,10),new nd.BN(1e9,10),new nd.BN(1e12,10);new nd.BN("2100000000000000000",10);new nd.BN(1e11,10);var wM={payment_hash:1,payment_secret:16,description:13,payee:19,description_hash:23,expiry:6,min_final_cltv_expiry:24,fallback_address:9,route_hint:3,feature_bits:5,metadata:27};for(var gg=0,Kb=Object.keys(wM);gg<Kb.length;gg++)Kb[gg],wM[Kb[gg]].toString();function xU(t){return Hp.Buffer.from(t).toString("base64")}a(xU,"encodeUint8toBase64");function Fne(t){return Hp.Buffer.from(t,"base64")}a(Fne,"encodeBase64toUint8");function Une(t){var e=Hp.Buffer.from(Bne(t),"base64").toString(),n=JSON.parse(e);return n}a(Une,"encodeBase64ToJson");function Bne(t){return t.replace(/-/g,"+").replace(/_/g,"/")}a(Bne,"base64urlToBase64");/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const nA=BigInt(0),q_=BigInt(1);function A0(t,e=""){if(typeof t!="boolean"){const n=e&&`"${e}"`;throw new Error(n+"expected boolean, got type="+typeof t)}return t}a(A0,"_abool2");function vl(t,e,n=""){const i=hy(t),s=t?.length,r=e!==void 0;if(!i||r&&s!==e){const o=n&&`"${n}" `,l=r?` of length ${e}`:"",d=i?`length=${s}`:`type=${typeof t}`;throw new Error(o+"expected Uint8Array"+l+", got "+d)}return t}a(vl,"_abytes2");function mg(t){const e=t.toString(16);return e.length&1?"0"+e:e}a(mg,"numberToHexUnpadded");function iA(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return t===""?nA:BigInt("0x"+t)}a(iA,"hexToNumber$2");function fu(t){return iA(ka(t))}a(fu,"bytesToNumberBE");function IU(t){return Oi(t),iA(ka(Uint8Array.from(t).reverse()))}a(IU,"bytesToNumberLE");function Py(t,e){return Nd(t.toString(16).padStart(e*2,"0"))}a(Py,"numberToBytesBE");function LU(t,e){return Py(t,e).reverse()}a(LU,"numberToBytesLE");function Wn(t,e,n){let i;if(typeof e=="string")try{i=Nd(e)}catch(r){throw new Error(t+" must be hex string or Uint8Array, cause: "+r)}else if(hy(e))i=Uint8Array.from(e);else throw new Error(t+" must be hex string or Uint8Array");const s=i.length;if(typeof n=="number"&&s!==n)throw new Error(t+" of length "+n+" expected, got "+s);return i}a(Wn,"ensureBytes");const qb=a(t=>typeof t=="bigint"&&nA<=t,"isPosBig");function j_(t,e,n){return qb(t)&&qb(e)&&qb(n)&&e<=t&&t<n}a(j_,"inRange");
107function $ne(t,e,n,i){if(!j_(e,n,i))throw new Error("expected valid "+t+": "+n+" <= n < "+i+", got "+e)}a($ne,"aInRange");function RU(t){let e;for(e=0;t>nA;t>>=q_,e+=1);return e}a(RU,"bitLen");const Gp=a(t=>(q_<<BigInt(t))-q_,"bitMask");function Hne(t,e,n){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");const i=a(p=>new Uint8Array(p),"u8n"),s=a(p=>Uint8Array.of(p),"u8of");let r=i(t),o=i(t),l=0;const d=a(()=>{r.fill(1),o.fill(0),l=0},"reset"),c=a((...p)=>n(o,r,...p),"h"),u=a((p=i(0))=>{o=c(s(0),p),r=c(),p.length!==0&&(o=c(s(1),p),r=c())},"reseed"),f=a(()=>{if(l++>=1e3)throw new Error("drbg: tried 1000 values");let p=0;const g=[];for(;p<e;){r=c();const v=r.slice();g.push(v),p+=r.length}return Ji(...g)},"gen");return a((p,g)=>{d(),u(p);let v;for(;!(v=g(f()));)u();return d(),v},"genUntil")}a(Hne,"createHmacDrbg");function sA(t,e,n={}){if(!t||typeof t!="object")throw new Error("expected valid options object");function i(s,r,o){const l=t[s];if(o&&l===void 0)return;const d=typeof l;if(d!==r||l===null)throw new Error(`param "${s}" is invalid: expected ${r}, got ${d}`)}a(i,"checkField"),Object.entries(e).forEach(([s,r])=>i(s,r,!1)),Object.entries(n).forEach(([s,r])=>i(s,r,!0))}a(sA,"_validateObject");function SM(t){const e=new WeakMap;return(n,...i)=>{const s=e.get(n);if(s!==void 0)return s;const r=t(n,...i);return e.set(n,r),r}}a(SM,"memoized");const kU=ka,y_e=Nd,Gne=iA;function Vne(t,e,n,i){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,n,i);const s=BigInt(32),r=BigInt(4294967295),o=Number(n>>s&r),l=Number(n&r),d=i?4:0,c=i?0:4;t.setUint32(e+d,o,i),t.setUint32(e+c,l,i)}a(Vne,"setBigUint64");function Wne(t,e,n){return t&e^~t&n}a(Wne,"Chi");function zne(t,e,n){return t&e^t&n^e&n}a(zne,"Maj");const XA=class XA extends p0{constructor(e,n,i,s){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=n,this.padOffset=i,this.isLE=s,this.buffer=new Uint8Array(e),this.view=kl(this.buffer)}update(e){h0(this),e=_1(e),Oi(e);const{view:n,buffer:i,blockLen:s}=this,r=e.length;for(let o=0;o<r;){const l=Math.min(s-this.pos,r-o);if(l===s){const d=kl(e);for(;s<=r-o;o+=s)this.process(d,o);continue}i.set(e.subarray(o,o+l),this.pos),this.pos+=l,o+=l,this.pos===s&&(this.process(n,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){h0(this),PK(e,this),this.finished=!0;const{buffer:n,view:i,blockLen:s,isLE:r}=this;let{pos:o}=this;n[o++]=128,_o(this.buffer.subarray(o)),this.padOffset>s-o&&(this.process(i,0),o=0);for(let f=o;f<s;f++)n[f]=0;Vne(i,s-8,BigInt(this.length*8),r),this.process(i,0);const l=kl(e),d=this.outputLen;if(d%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=d/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<c;f++)l.setUint32(4*f,u[f],r)}digest(){const{buffer:e,outputLen:n}=this;this.digestInto(e);const i=e.slice(0,n);return this.destroy(),i}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:n,buffer:i,length:s,finished:r,destroyed:o,pos:l}=this;return e.destroyed=o,e.finished=r,e.length=s,e.pos=l,s%n&&e.buffer.set(i),e}clone(){return this._cloneInto()}};a(XA,"HashMD");let Jf=XA;const Do=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Oo=Uint32Array.from([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]),yi=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),vg=BigInt(2**32-1),TM=BigInt(32);function Kne(t,e=!1){return e?{h:Number(t&vg),l:Number(t>>TM&vg)}:{h:Number(t>>TM&vg)|0,l:Number(t&vg)|0}}a(Kne,"fromBig");function qne(t,e=!1){const n=t.length;let i=new Uint32Array(n),s=new Uint32Array(n);for(let r=0;r<n;r++){const{h:o,l}=Kne(t[r],e);[i[r],s[r]]=[o,l]}return[i,s]}a(qne,"split");const AM=a((t,e,n)=>t>>>n,"shrSH"),xM=a((t,e,n)=>t<<32-n|e>>>n,"shrSL"),_c=a((t,e,n)=>t>>>n|e<<32-n,"rotrSH"),wc=a((t,e,n)=>t<<32-n|e>>>n,"rotrSL"),yg=a((t,e,n)=>t<<64-n|e>>>
107n-32,"rotrBH"),bg=a((t,e,n)=>t>>>n-32|e<<64-n,"rotrBL");function jr(t,e,n,i){const s=(e>>>0)+(i>>>0);return{h:t+n+(s/2**32|0)|0,l:s|0}}a(jr,"add");const jne=a((t,e,n)=>(t>>>0)+(e>>>0)+(n>>>0),"add3L"),Yne=a((t,e,n,i)=>e+n+i+(t/2**32|0)|0,"add3H"),Zne=a((t,e,n,i)=>(t>>>0)+(e>>>0)+(n>>>0)+(i>>>0),"add4L"),Qne=a((t,e,n,i,s)=>e+n+i+s+(t/2**32|0)|0,"add4H"),Jne=a((t,e,n,i,s)=>(t>>>0)+(e>>>0)+(n>>>0)+(i>>>0)+(s>>>0),"add5L"),Xne=a((t,e,n,i,s,r)=>e+n+i+s+r+(t/2**32|0)|0,"add5H"),eie=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),No=new Uint32Array(64);var hp;let rA=(hp=class extends Jf{constructor(e=32){super(64,e,8,!1),this.A=Do[0]|0,this.B=Do[1]|0,this.C=Do[2]|0,this.D=Do[3]|0,this.E=Do[4]|0,this.F=Do[5]|0,this.G=Do[6]|0,this.H=Do[7]|0}get(){const{A:e,B:n,C:i,D:s,E:r,F:o,G:l,H:d}=this;return[e,n,i,s,r,o,l,d]}set(e,n,i,s,r,o,l,d){this.A=e|0,this.B=n|0,this.C=i|0,this.D=s|0,this.E=r|0,this.F=o|0,this.G=l|0,this.H=d|0}process(e,n){for(let f=0;f<16;f++,n+=4)No[f]=e.getUint32(n,!1);for(let f=16;f<64;f++){const h=No[f-15],p=No[f-2],g=nr(h,7)^nr(h,18)^h>>>3,v=nr(p,17)^nr(p,19)^p>>>10;No[f]=v+No[f-7]+g+No[f-16]|0}let{A:i,B:s,C:r,D:o,E:l,F:d,G:c,H:u}=this;for(let f=0;f<64;f++){const h=nr(l,6)^nr(l,11)^nr(l,25),p=u+h+Wne(l,d,c)+eie[f]+No[f]|0,v=(nr(i,2)^nr(i,13)^nr(i,22))+zne(i,s,r)|0;u=c,c=d,d=l,l=o+p|0,o=r,r=s,s=i,i=p+v|0}i=i+this.A|0,s=s+this.B|0,r=r+this.C|0,o=o+this.D|0,l=l+this.E|0,d=d+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(i,s,r,o,l,d,c,u)}roundClean(){_o(No)}destroy(){this.set(0,0,0,0,0,0,0,0),_o(this.buffer)}},a(hp,"SHA256"),hp);var pp;let MU=(pp=class extends rA{constructor(){super(28),this.A=Oo[0]|0,this.B=Oo[1]|0,this.C=Oo[2]|0,this.D=Oo[3]|0,this.E=Oo[4]|0,this.F=Oo[5]|0,this.G=Oo[6]|0,this.H=Oo[7]|0}},a(pp,"SHA224"),pp);const CU=(()=>qne(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e3585
1075771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))))(),tie=(()=>CU[0])(),nie=(()=>CU[1])(),Fo=new Uint32Array(80),Uo=new Uint32Array(80),ex=class ex extends Jf{constructor(e=64){super(128,e,16,!1),this.Ah=yi[0]|0,this.Al=yi[1]|0,this.Bh=yi[2]|0,this.Bl=yi[3]|0,this.Ch=yi[4]|0,this.Cl=yi[5]|0,this.Dh=yi[6]|0,this.Dl=yi[7]|0,this.Eh=yi[8]|0,this.El=yi[9]|0,this.Fh=yi[10]|0,this.Fl=yi[11]|0,this.Gh=yi[12]|0,this.Gl=yi[13]|0,this.Hh=yi[14]|0,this.Hl=yi[15]|0}get(){const{Ah:e,Al:n,Bh:i,Bl:s,Ch:r,Cl:o,Dh:l,Dl:d,Eh:c,El:u,Fh:f,Fl:h,Gh:p,Gl:g,Hh:v,Hl:y}=this;return[e,n,i,s,r,o,l,d,c,u,f,h,p,g,v,y]}set(e,n,i,s,r,o,l,d,c,u,f,h,p,g,v,y){this.Ah=e|0,this.Al=n|0,this.Bh=i|0,this.Bl=s|0,this.Ch=r|0,this.Cl=o|0,this.Dh=l|0,this.Dl=d|0,this.Eh=c|0,this.El=u|0,this.Fh=f|0,this.Fl=h|0,this.Gh=p|0,this.Gl=g|0,this.Hh=v|0,this.Hl=y|0}process(e,n){for(let T=0;T<16;T++,n+=4)Fo[T]=e.getUint32(n),Uo[T]=e.getUint32(n+=4);for(let T=16;T<80;T++){const I=Fo[T-15]|0,M=Uo[T-15]|0,H=_c(I,M,1)^_c(I,M,8)^AM(I,M,7),N=wc(I,M,1)^wc(I,M,8)^xM(I,M,7),$=Fo[T-2]|0,F=Uo[T-2]|0,D=_c($,F,19)^yg($,F,61)^AM($,F,6),L=wc($,F,19)^bg($,F,61)^xM($,F,6),m=Zne(N,L,Uo[T-7],Uo[T-16]),S=Qne(m,H,D,Fo[T-7],Fo[T-16]);Fo[T]=S|0,Uo[T]=m|0}let{Ah:i,Al:s,Bh:r,Bl:o,Ch:l,Cl:d,Dh:c,Dl:u,Eh:f,El:h,Fh:p,Fl:g,Gh:v,Gl:y,Hh:b,Hl:E}=this;for(let T=0;T<80;T++){const I=_c(f,h,14)^_c(f,h,18)^yg(f,h,41),M=wc(f,h,14)^wc(f,h,18)^bg(f,h,41),H=f&p^~f&v,N=h&g^~h&y,$=Jne(E,M,N,nie[T],Uo[T]),F=Xne($,b,I,H,tie[T],Fo[T]),D=$|0,L=_c(i,s,28)^yg(i,s,34)^yg(i,s,39),m=wc(i,s,28)^bg(i,s,34)^bg(i,s,39),S=i&r^i&l^r&l,_=s&o^s&d^o&d;b=v|0,E=y|0,v=p|0,y=g|0,p=f|0,g=h|0,{h:f,l:h}=jr(c|0,u|0,F|0,D|0),c=l|0,u=d|0,l=r|0,d=o|0,r=i|0,o=s|0;const A=jne(D,m,_);i=Yne(A,F,L,S),s=A|0}({h:i,l:s}=jr(this.Ah|0,this.Al|0,i|0,s|0)),{h:r,l:o}=jr(this.Bh|0,this.Bl|0,r|0,o|0),{h:l,l:d}=jr(this.Ch|0,this.Cl|0,l|0,d|0),{h:c,l:u}=jr(this.Dh|0,this.Dl|0,c|0,u|0),{h:f,l:h}=jr(this.Eh|0,this.El|0,f|0,h|0),{h:p,l:g}=jr(this.Fh|0,this.Fl|0,p|0,g|0),{h:v,l:y}=jr(this.Gh|0,this.Gl|0,v|0,y|0),{h:b,l:E}=jr(this.Hh|0,this.Hl|0,b|0,E|0),this.set(i,s,r,o,l,d,c,u,f,h,p,g,v,y,b,E)}roundClean(){_o(Fo,Uo)}destroy(){_o(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};a(ex,"SHA512");let Y_=ex;const zl=gy(()=>new rA),iie=gy(()=>new MU),Z_=gy(()=>new Y_),sie=rA,x0=zl,rie=MU,oie=iie,b_e=Object.freeze(Object.defineProperty({__proto__:null,SHA224:rie,SHA256:sie,sha224:oie,sha256:x0},Symbol.toStringTag,{value:"Module"}));var I0=globalThis&&globalThis.__assign||function(){return I0=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s])}return t},I0.apply(this,arguments)},IM=globalThis&&globalThis.__spreadArray||function(t,e,n){if(n||arguments.length===2)for(var i=0,s=e.length,r;i<s;i++)(r||!(i in e))&&(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))};function PU(t,e){var n=[];e&&(n.push.apply(n,lie(t,e)),t=t-n.reduce(function(r,o){return r+o},0));for(var i=0;i<32;i++){var s=1<<i;t&s&&n.push(Math.pow(2,i))}return n}a(PU,"splitAmount");function aie(t){return t&&!(t&t-1)}a(aie,"isPowerOfTwo");function lie(t,e){var n=[],i=0;return e.forEach(function(s){if(!aie(s.amount))throw new Error("Provided amount preferences contain non-power-of-2 numbers. Use only ^2 numbers");for(var r=1;r<=s.count;r++){if(i+=s.amount,i>t)return;n.push(s.amount)}}),n}a(lie,"getPreference");function cie(t){var e=PU(t);return e.map(function(n){return{amount:n,count:1}})}a(cie,"getDefaultAmountPreference");function oA(t){return die(kU(t))}a(oA,"bytesToNumber$1");function die(t){return BigInt("0x".concat(t))}a(die,"hexToNumber");function LM(t){var e=["web+cashu://","cashu://","cashu:","cashuA"];return e.forEach(function(n){t.startsWith(n)&&(t=t.slice(n.length))}),uie(t)}a(LM,"getDecodedToken");function uie(t){var e,n,i=Une(t);return"token"in i?i:Array.isArray(i)?{token:[{proofs:i,mint:""}]}:{token:[{proofs:i.proofs,mint:(n=(e=i?.mints[0])===null||e===void 0?void 0:e.url)!==null&&n!==void 0?n:""}]}}a(uie,"handleTokens");function Eg(t){var e=Object.entries(t).sort(function(i,s){return+i[0]-+s[0]}).map(function(i){var s=i[1];return s}).join(""),n=x0(new TextEncoder().encode(e));return Hp.Buffer.from(n).toString("base64").slice(0,12)}a(Eg,"deriveKeysetId");function fie(t){for(var e,n,i={},s=0,r=t.token;s<r.length;s++){var o=r[s];if(!(!(!((n=o?.proofs)===null||n===void 0)&&n.length)||!o?.mint)){if(i[o.mint]){(e=i[o.mint].proofs).push.apply(e,IM([],o.proofs,!0));continue}i[o.mint]={mint:o.mint,proofs:IM([],o.proofs,!0)}}}return{memo:t?.memo,token:Object.values(i).map(function(l){return I0(I0({},l),{proofs:hie(l.proofs)})})}}a(fie,"cleanToken");function hie(t){return t.sort(function(e,n){return e.id.localeCompare(n.id)})}a(hie,"sortProofsById");function Xa(t){return typeof t=="object"}a(Xa,"isObj");function pie(t){if(Xa(t)){if("error"in t&&t.error)throw new Error(t.error);if("detail"in t&&t.detail)throw new Error(t.detail)}}a(pie,"checkResponse");function Ds(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.map(function(n){return n.replace(/(^\/+|\/+$)/g,"")}).join("/")}a(Ds,"joinUrls");var Cl=globalThis&&globalThis.__assign||function(){return Cl=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s])}return t},Cl.apply(this,arguments)},DU=globalThis&&globalThis.__awaiter||function(t,e,n,i){function s(r){return r instanceof n?r:new n(function(o){o(r)})}
107return a(s,"adopt"),new(n||(n=Promise))(function(r,o){function l(u){try{c(i.next(u))}catch(f){o(f)}}a(l,"fulfilled");function d(u){try{c(i.throw(u))}catch(f){o(f)}}a(d,"rejected");function c(u){u.done?r(u.value):s(u.value).then(l,d)}a(c,"step"),c((i=i.apply(t,e||[])).next())})},OU=globalThis&&globalThis.__generator||function(t,e){var n={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},i,s,r,o;return o={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function l(c){return function(u){return d([c,u])}}function d(c){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(n=0)),n;)try{if(i=1,s&&(r=c[0]&2?s.return:c[0]?s.throw||((r=s.return)&&r.call(s),0):s.next)&&!(r=r.call(s,c[1])).done)return r;switch(s=0,r&&(c=[c[0]&2,r.value]),c[0]){case 0:case 1:r=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,s=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(r=n.trys,!(r=r.length>0&&r[r.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!r||c[1]>r[0]&&c[1]<r[3])){n.label=c[1];break}if(c[0]===6&&n.label<r[1]){n.label=r[1],r=c;break}if(r&&n.label<r[2]){n.label=r[2],n.ops.push(c);break}r[2]&&n.ops.pop(),n.trys.pop();continue}c=e.call(t,n)}catch(u){c=[6,u],s=0}finally{i=r=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},gie=globalThis&&globalThis.__rest||function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]]);return n},mie={};function vie(t){var e=t.endpoint,n=t.requestBody,i=t.headers,s=gie(t,["endpoint","requestBody","headers"]);return DU(this,void 0,void 0,function(){var r,o,l,d,c,u,f;return OU(this,function(h){switch(h.label){case 0:return r=n?JSON.stringify(n):void 0,o=Cl(Cl({Accept:"application/json, text/plain, */*"},r?{"Content-Type":"application/json"}:void 0),i),[4,fetch(e,Cl({body:r,headers:o},s))];case 1:return l=h.sent(),l.ok?[3,3]:[4,l.json()];case 2:throw d=h.sent(),c=d.error,u=d.detail,f=c||u||"bad response",new Error(f);case 3:return[2,l]}})})}a(vie,"_request");function or(t){return DU(this,void 0,void 0,function(){var e,n;return OU(this,function(i){switch(i.label){case 0:return[4,vie(Cl(Cl({},t),mie))];case 1:return e=i.sent(),[4,e.json().catch(function(){return{error:"bad response"}})];case 2:return n=i.sent(),pie(n),[2,n]}})})}a(or,"request$1");var Nn=globalThis&&globalThis.__awaiter||function(t,e,n,i){function s(r){return r instanceof n?r:new n(function(o){o(r)})}return a(s,"adopt"),new(n||(n=Promise))(function(r,o){function l(u){try{c(i.next(u))}catch(f){o(f)}}a(l,"fulfilled");function d(u){try{c(i.throw(u))}catch(f){o(f)}}a(d,"rejected");function c(u){u.done?r(u.value):s(u.value).then(l,d)}a(c,"step"),c((i=i.apply(t,e||[])).next())})},Fn=globalThis&&globalThis.__generator||function(t,e){var n={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},i,s,r,o;return o={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function l(c){return function(u){return d([c,u])}}function d(c){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(n=0)),n;)try{if(i=1,s&&(r=c[0]&2?s.return:c[0]?s.throw||((r=s.return)&&r.call(s),0):s.next)&&!(r=r.call(s,c[1])).done)return r;switch(s=0,r&&(c=[c[0]&2,r.value]),c[0]){case 0:case 1:r=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,s=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(r=n.trys,!(r=r.length>0&&r[r.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!r||c[1]>r[0]&&c[1]<r[3])){n.label=c[1];break}if(c[0]===6&&n.label<r[1]){n.label=r[1],r=c;break}if(r&&n.label<r[2]){n.label=r[2],n.ops.push(c);break}r[2]&&n.ops.pop(),n.trys.pop();continue}c=e.call(t,n)}catch(u){c=[6,u],s=0}finally{i=r=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},Q_=function(){function t(e){this._mintUrl=e}return a(t,"CashuMint"),Object.defineProperty(t.prototype,"mintUrl",{get:function(){return this._mintUrl}
107,enumerable:!1,configurable:!0}),t.getInfo=function(e){return Nn(this,void 0,void 0,function(){return Fn(this,function(n){return[2,or({endpoint:Ds(e,"info")})]})})},t.prototype.getInfo=function(){return Nn(this,void 0,void 0,function(){return Fn(this,function(e){return[2,t.getInfo(this._mintUrl)]})})},t.requestMint=function(e,n){return Nn(this,void 0,void 0,function(){return Fn(this,function(i){return[2,or({endpoint:"".concat(Ds(e,"mint"),"?amount=").concat(n)})]})})},t.prototype.requestMint=function(e){return Nn(this,void 0,void 0,function(){return Fn(this,function(n){return[2,t.requestMint(this._mintUrl,e)]})})},t.mint=function(e,n,i){return Nn(this,void 0,void 0,function(){var s;return Fn(this,function(r){switch(r.label){case 0:return[4,or({endpoint:"".concat(Ds(e,"mint"),"?hash=").concat(i),method:"POST",requestBody:n})];case 1:if(s=r.sent(),!Xa(s)||!Array.isArray(s?.promises))throw new Error("bad response");return[2,s]}})})},t.prototype.mint=function(e,n){return Nn(this,void 0,void 0,function(){return Fn(this,function(i){return[2,t.mint(this._mintUrl,e,n)]})})},t.getKeys=function(e,n){return Nn(this,void 0,void 0,function(){return Fn(this,function(i){return n&&(n=n.replace(/\//g,"_").replace(/\+/g,"-")),[2,or({endpoint:n?Ds(e,"keys",n):Ds(e,"keys")})]})})},t.prototype.getKeys=function(e){return Nn(this,void 0,void 0,function(){return Fn(this,function(n){return[2,t.getKeys(this._mintUrl,e)]})})},t.getKeySets=function(e){return Nn(this,void 0,void 0,function(){return Fn(this,function(n){return[2,or({endpoint:Ds(e,"keysets")})]})})},t.prototype.getKeySets=function(){return Nn(this,void 0,void 0,function(){return Fn(this,function(e){return[2,t.getKeySets(this._mintUrl)]})})},t.split=function(e,n){return Nn(this,void 0,void 0,function(){var i;return Fn(this,function(s){switch(s.label){case 0:return[4,or({endpoint:Ds(e,"split"),method:"POST",requestBody:n})];case 1:if(i=s.sent(),!Xa(i)||!Array.isArray(i?.promises))throw new Error("bad response");return[2,i]}})})},t.prototype.split=function(e){return Nn(this,void 0,void 0,function(){return Fn(this,function(n){return[2,t.split(this._mintUrl,e)]})})},t.melt=function(e,n){return Nn(this,void 0,void 0,function(){var i;return Fn(this,function(s){switch(s.label){case 0:return[4,or({endpoint:Ds(e,"melt"),method:"POST",requestBody:n})];case 1:if(i=s.sent(),!Xa(i)||typeof i?.paid!="boolean"||i?.preimage!==null&&typeof i?.preimage!="string")throw new Error("bad response");return[2,i]}})})},t.prototype.melt=function(e){return Nn(this,void 0,void 0,function(){return Fn(this,function(n){return[2,t.melt(this._mintUrl,e)]})})},t.checkFees=function(e,n){return Nn(this,void 0,void 0,function(){var i;return Fn(this,function(s){switch(s.label){case 0:return[4,or({endpoint:Ds(e,"checkfees"),method:"POST",requestBody:n})];case 1:if(i=s.sent(),!Xa(i)||typeof i?.fee!="number")throw new Error("bad response");return[2,i]}})})},t.prototype.checkFees=function(e){return Nn(this,void 0,void 0,function(){return Fn(this,function(n){return[2,t.checkFees(this._mintUrl,e)]})})},t.check=function(e,n){return Nn(this,void 0,void 0,function(){var i;return Fn(this,function(s){switch(s.label){case 0:return[4,or({endpoint:Ds(e,"check"),method:"POST",requestBody:n})];case 1:if(i=s.sent(),!Xa(i)||!Array.isArray(i?.spendable))throw new Error("bad response");return[2,i]}})})},t.prototype.check=function(e){return Nn(this,void 0,void 0,function(){return Fn(this,function(n){return[2,t.check(this._mintUrl,e)]})})},t.restore=function(e,n){return Nn(this,void 0,void 0,function(){var i;return Fn(this,function(s){switch(s.label){case 0:return[4,or({endpoint:Ds(e,"restore"),method:"POST",requestBody:n})];case 1:if(i=s.sent(),!Xa(i)||!Array.isArray(i?.outputs)||!Array.isArray(i?.promises))throw new Error("bad response");return[2,i]}})})},t.prototype.restore=function(e){return Nn(this,void 0,void 0,function(){return Fn(this,function(n){return[2,t.restore(this._mintUrl,e)]})})},t}();const tx=class tx extends p0{constructor(e,n){super(),this.finished=!1,this.destroyed=!1,E1(e);const i=_1(n);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;
vendor: 19,063 bytes, line 107
107const s=this.blockLen,r=new Uint8Array(s);r.set(i.length>s?e.create().update(i).digest():i);for(let o=0;o<r.length;o++)r[o]^=54;this.iHash.update(r),this.oHash=e.create();for(let o=0;o<r.length;o++)r[o]^=106;this.oHash.update(r),_o(r)}update(e){return h0(this),this.iHash.update(e),this}digestInto(e){h0(this),Oi(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:i,finished:s,destroyed:r,blockLen:o,outputLen:l}=this;return e=e,e.finished=s,e.destroyed=r,e.blockLen=o,e.outputLen=l,e.oHash=n._cloneInto(e.oHash),e.iHash=i._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};a(tx,"HMAC");let L0=tx;const Xf=a((t,e,n)=>new L0(t,e).update(n).digest(),"hmac");Xf.create=(t,e)=>new L0(t,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ts=BigInt(0),Ui=BigInt(1),yl=BigInt(2),NU=BigInt(3),FU=BigInt(4),UU=BigInt(5),yie=BigInt(7),BU=BigInt(8),bie=BigInt(9),$U=BigInt(16);function ds(t,e){const n=t%e;return n>=ts?n:e+n}a(ds,"mod");function _s(t,e,n){let i=t;for(;e-- >ts;)i*=i,i%=n;return i}a(_s,"pow2");function RM(t,e){if(t===ts)throw new Error("invert: expected non-zero number");if(e<=ts)throw new Error("invert: expected positive modulus, got "+e);let n=ds(t,e),i=e,s=ts,r=Ui;for(;n!==ts;){const l=i/n,d=i%n,c=s-r*l;i=n,n=d,s=r,r=c}if(i!==Ui)throw new Error("invert: does not exist");return ds(s,e)}a(RM,"invert");function aA(t,e,n){if(!t.eql(t.sqr(e),n))throw new Error("Cannot find square root")}a(aA,"assertIsSquare");function HU(t,e){const n=(t.ORDER+Ui)/FU,i=t.pow(e,n);return aA(t,i,e),i}a(HU,"sqrt3mod4");function Eie(t,e){const n=(t.ORDER-UU)/BU,i=t.mul(e,yl),s=t.pow(i,n),r=t.mul(e,s),o=t.mul(t.mul(r,yl),s),l=t.mul(r,t.sub(o,t.ONE));return aA(t,l,e),l}a(Eie,"sqrt5mod8");function _ie(t){const e=Vp(t),n=GU(t),i=n(e,e.neg(e.ONE)),s=n(e,i),r=n(e,e.neg(i)),o=(t+yie)/$U;return(l,d)=>{let c=l.pow(d,o),u=l.mul(c,i);const f=l.mul(c,s),h=l.mul(c,r),p=l.eql(l.sqr(u),d),g=l.eql(l.sqr(f),d);c=l.cmov(c,u,p),u=l.cmov(h,f,g);const v=l.eql(l.sqr(u),d),y=l.cmov(c,u,v);return aA(l,y,d),y}}a(_ie,"sqrt9mod16");function GU(t){if(t<NU)throw new Error("sqrt is not defined for small field");let e=t-Ui,n=0;for(;e%yl===ts;)e/=yl,n++;let i=yl;const s=Vp(t);for(;kM(s,i)===1;)if(i++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return HU;let r=s.pow(i,e);const o=(e+Ui)/yl;return a(function(d,c){if(d.is0(c))return c;if(kM(d,c)!==1)throw new Error("Cannot find square root");let u=n,f=d.mul(d.ONE,r),h=d.pow(c,e),p=d.pow(c,o);for(;!d.eql(h,d.ONE);){if(d.is0(h))return d.ZERO;let g=1,v=d.sqr(h);for(;!d.eql(v,d.ONE);)if(g++,v=d.sqr(v),g===u)throw new Error("Cannot find square root");const y=Ui<<BigInt(u-g-1),b=d.pow(f,y);u=g,f=d.sqr(b),h=d.mul(h,f),p=d.mul(p,b)}return p},"tonelliSlow")}a(GU,"tonelliShanks");function wie(t){return t%FU===NU?HU:t%BU===UU?Eie:t%$U===bie?_ie(t):GU(t)}a(wie,"FpSqrt");const Sie=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Tie(t){const e={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},n=Sie.reduce((i,s)=>(i[s]="function",i),e);return sA(t,n),t}a(Tie,"validateField");function Aie(t,e,n){if(n<ts)throw new Error("invalid exponent, negatives unsupported");if(n===ts)return t.ONE;if(n===Ui)return e;let i=t.ONE,s=e;for(;n>ts;)n&Ui&&(i=t.mul(i,s)),s=t.sqr(s),n>>=Ui;return i}a(Aie,"FpPow");function VU(t,e,n=!1){const i=new Array(e.length).fill(n?t.ZERO:void 0),s=e.reduce((o,l,d)=>t.is0(l)?o:(i[d]=o,t.mul(o,l)),t.ONE),r=t.inv(s);return e.reduceRight((o,l,d)=>t.is0(l)?o:(i[d]=t.mul(o,i[d]),t.mul(o,l)),r),i}a(VU,"FpInvertBatch");function kM(t,e){const n=(t.ORDER-Ui)/yl,i=t.pow(e,n),s=t.eql(i,t.ONE),r=t.eql(i,t.ZERO),o=t.eql(i,t.neg(t.ONE));if(!s&&!r&&!o)throw new Error("invalid Legendre symbol result");return s?1:r?0:-1}a(kM,"FpLegendre");function WU(t,e){e!==void 0&&hd(e);const n=e!==void 0?e:t.toString(2).length,i=Math.ceil(n/8);return{nBitLength:n,nByteLength:i}}a(WU,"nLength");function Vp(t,e,n=!1,i={}){if(t<=ts)throw new Error("invalid field: expected ORDER > 0, got "+t);let s,r,o=!1,l;if(typeof e=="object"&&e!=null){if(i.sqrt||n)throw new Error("cannot specify opts in two arguments");const h=e;h.BITS&&(s=h.BITS),h.sqrt&&(r=h.sqrt),typeof h.isLE=="boolean"&&(n=h.isLE),typeof h.modFromBytes=="boolean"&&(o=h.modFromBytes),l=h.allowedLengths}else typeof e=="number"&&(s=e),i.sqrt&&(r=i.sqrt);const{nBitLength:d,nByteLength:c}=WU(t,s);if(c>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let u;const f=Object.freeze({ORDER:t,isLE:n,BITS:d,BYTES:c,MASK:Gp(d),ZERO:ts,ONE:Ui,allowedLengths:l,create:h=>ds(h,t),isValid:h=>{if(typeof h!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof h);return ts<=h&&h<t},is0:h=>h===ts,isValidNot0:h=>!f.is0(h)&&f.isValid(h),isOdd:h=>(h&Ui)===Ui,neg:h=>ds(-h,t),eql:(h,p)=>h===p,sqr:h=>ds(h*h,t),add:(h,p)=>ds(h+p,t),sub:(h,p)=>ds(h-p,t),mul:(h,p)=>ds(h*p,t),pow:(h,p)=>Aie(f,h,p),div:(h,p)=>ds(h*RM(p,t),t),sqrN:h=>h*h,addN:(h,p)=>h+p,subN:(h,p)=>h-p,mulN:(h,p)=>h*p,inv:h=>RM(h,t),sqrt:r||(h=>(u||(u=wie(t)),u(f,h))),toBytes:h=>n?LU(h,c):Py(h,c),fromBytes:(h,p=!0)=>{if(l){if(!l.includes(h.length)||h.length>c)throw new Error("Field.fromBytes: expected "+l+" bytes, got "+h.length);const v=new Uint8Array(c);v.set(h,n?0:v.length-h.length),h=v}if(h.length!==c)throw new Error("Field.fromBytes: expected "+c+" bytes, got "+h.length);let g=n?IU(h):fu(h);if(o&&(g=ds(g,t)),!p&&!f.isValid(g))throw new Error("invalid field element: outside of range 0..ORDER");return g},invertBatch:h=>VU(f,h),cmov:(h,p,g)=>g?p:h});return Object.freeze(f)}a(Vp,"Field");function zU(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}a(zU,"getFieldBytesLength");function KU(t){const e=zU(t);return e+Math.ceil(e/2)}a(KU,"getMinHashLength");function qU(t,e,n=!1){const i=t.length,s=zU(e),r=KU(e);if(i<16||i<r||i>1024)throw new Error("expected "+r+"-1024 bytes of input, got "+i);const o=n?IU(t):fu(t),l=ds(o,e-Ui)+Ui;return n?LU(l,s):Py(l,s)}a(qU,"mapHashToField");/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Gd=BigInt(0),bl=BigInt(1);function R0(t,e){const n=e.negate();return t?n:e}a(R0,"negateCt");function jb(t,e){const n=VU(t.Fp,e.map(i=>i.Z));return e.map((i,s)=>t.fromAffine(i.toAffine(n[s])))}a(jb,"normalizeZ");function jU(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}a(jU,"validateW");function Yb(t,e){jU(t,e);const n=Math.ceil(e/t)+1,i=2**(t-1),s=2**t,r=Gp(t),o=BigInt(t);return{windows:n,windowSize:i,mask:r,maxNumber:s,shiftBy:o}}a(Yb,"calcWOpts");function MM(t,e,n){const{windowSize:i,mask:s,maxNumber:r,shiftBy:o}=n;let l=Number(t&s),d=t>>o;l>i&&(l-=r,d+=bl);const c=e*i,u=c+Math.abs(l)-1,f=l===0,h=l<0,p=e%2!==0;return{nextN:d,offset:u,isZero:f,isNeg:h,isNegF:p,offsetF:c}}a(MM,"calcOffsets");function xie(t,e){if(!Array.isArray(t))throw new Error("array expected");t.forEach((n,i)=>{if(!(n instanceof e))throw new Error("invalid point at index "+i)})}a(xie,"validateMSMPoints");function Iie(t,e){if(!Array.isArray(t))throw new Error("array of scalars expected");t.forEach((n,i)=>{if(!e.isValid(n))throw new Error("invalid scalar at index "+i)})}a(Iie,"validateMSMScalars");const Zb=new WeakMap,YU=new WeakMap;function Qb(t){return YU.get(t)||1}a(Qb,"getW");function CM(t){if(t!==Gd)throw new Error("invalid wNAF")}a(CM,"assert0");const nx=class nx{constructor(e,n){this.BASE=e.BASE,this.ZERO=e.ZERO,this.Fn=e.Fn,this.bits=n}_unsafeLadder(e,n,i=this.ZERO){let s=e;for(;n>Gd;)n&bl&&(i=i.add(s)),s=s.double(),n>>=bl;return i}precomputeWindow(e,n){const{windows:i,windowSize:s}=Yb(n,this.bits),r=[];let o=e,l=o;for(let d=0;d<i;d++){l=o,r.push(l);for(let c=1;c<s;c++)l=l.add(o),r.push(l);o=l.double()}return r}wNAF(e,n,i){if(!this.Fn.isValid(i))throw new Error("invalid scalar");let s=this.ZERO,r=this.BASE;const o=Yb(e,this.bits);for(let l=0;l<o.windows;l++){const{nextN:d,offset:c,isZero:u,isNeg:f,isNegF:h,offsetF:p}=MM(i,l,o);i=d,u?r=r.add(R0(h,n[p])):s=s.add(R0(f,n[c]))}return CM(i),{p:s,f:r}}wNAFUnsafe(e,n,i,s=this.ZERO){const r=Yb(e,this.bits);for(let o=0;o<r.windows&&i!==Gd;o++){const{nextN:l,offset:d,isZero:c,isNeg:u}=MM(i,o,r);if(i=l,!c){const f=n[d];s=s.add(u?f.negate():f)}}return CM(i),s}getPrecomputes(e,n,i){let s=Zb.get(n);return s||(s=this.precomputeWindow(n,e),e!==1&&(typeof i=="function"&&(s=i(s)),Zb.set(n,s))),s}cached(e,n,i){const s=Qb(e);return this.wNAF(s,this.getPrecomputes(s,e,i),n)}unsafe(e,n,i,s){const r=Qb(e);return r===1?this._unsafeLadder(e,n,s):this.wNAFUnsafe(r,this.getPrecomputes(r,e,i),n,s)}createCache(e,n){jU(n,this.bits),YU.set(e,n),Zb.delete(e)}hasCache(e){return Qb(e)!==1}};a(nx,"wNAF");let J_=nx;function Lie(t,e,n,i){let s=e,r=t.ZERO,o=t.ZERO;for(;n>Gd||i>Gd;)n&bl&&(r=r.add(s)),i&bl&&(o=o.add(s)),s=s.double(),n>>=bl,i>>=bl;return{p1:r,p2:o}}a(Lie,"mulEndoUnsafe");function Rie(t,e,n,i){xie(n,t),Iie(i,e);const s=n.length,r=i.length;if(s!==r)throw new Error("arrays of points and scalars must have equal length");const o=t.ZERO,l=RU(BigInt(s));let d=1;l>12?d=l-3:l>4?d=l-2:l>0&&(d=2);const c=Gp(d),u=new Array(Number(c)+1).fill(o),f=Math.floor((e.BITS-1)/d)*d;let h=o;for(let p=f;p>=0;p-=d){u.fill(o);for(let v=0;v<r;v++){const y=i[v],b=Number(y>>BigInt(p)&c);u[b]=u[b].add(n[v])}let g=o;for(let v=u.length-1,y=o;v>0;v--)y=y.add(u[v]),g=g.add(y);if(h=h.add(g),p!==0)for(let v=0;v<d;v++)h=h.double()}return h}a(Rie,"pippenger");function PM(t,e,n){if(e){if(e.ORDER!==t)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return Tie(e),e}else return Vp(t,{isLE:n})}a(PM,"createField");function kie(t,e,n={},i){if(i===void 0&&(i=t==="edwards"),!e||typeof e!="object")throw new Error(`expected valid ${t} CURVE object`);for(const d of["p","n","h"]){const c=e[d];if(!(typeof c=="bigint"&&c>Gd))throw new Error(`CURVE.${d} must be positive bigint`)}const s=PM(e.p,n.Fp,i),r=PM(e.n,n.Fn,i),l=["Gx","Gy","a",t==="weierstrass"?"b":"d"];for(const d of l)if(!s.isValid(e[d]))throw new Error(`CURVE.${d} must be valid field element of CURVE.Fp`);return e=Object.freeze(Object.assign({},e)),{CURVE:e,Fp:s,Fn:r}}a(kie,"_createCurveFields");/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const DM=a((t,e)=>(t+(t>=0?e:-e)/ZU)/e,"divNearest");function Mie(t,e,n){const[[i,s],[r,o]]=e,l=DM(o*t,n),d=DM(-s*t,n);let c=t-l*i-d*r,u=-l*s-d*o;const f=c<po,h=u<po;f&&(c=-c),h&&(u=-u);const p=Gp(Math.ceil(RU(n)/2))+gd;if(c<po||c>=p||u<po||u>=p)throw new Error("splitScalar (endomorphism): failed, k="+t);return{k1neg:f,k1:c,k2neg:h,k2:u}}a(Mie,"_splitEndoScalar");function X_(t){if(!["compact","recovered","der"].includes(t))throw new Error('Signature format must be "compact", "recovered", or "der"');return t}a(X_,"validateSigFormat");function Jb(t,e){const n={};for(let i of Object.keys(e))n[i]=t[i]===void 0?e[i]:t[i];return A0(n.lowS,"lowS"),A0(n.prehash,"prehash"),n.format!==void 0&&X_(n.format),n}a(Jb,"validateSigOpts");const ix=class ix extends Error{constructor(e=""){super(e)}};a(ix,"DERErr");let ew=ix;const lo={Err:ew,_tlv:{encode:(t,e)=>{const{Err:n}=lo;if(t<0||t>256)throw new n("tlv.encode: wrong tag");if(e.length&1)throw new n("tlv.encode: unpadded data");const i=e.length/2,s=mg(i);if(s.length/2&128)throw new n("tlv.encode: long form length too big");const r=i>127?mg(s.length/2|128):"";return mg(t)+r+s+e},decode(t,e){const{Err:n}=lo;let i=0;if(t<0||t>256)throw new n("tlv.encode: wrong tag");if(e.length<2||e[i++]!==t)throw new n("tlv.decode: wrong tlv");const s=e[i++],r=!!(s&128);let o=0;if(!r)o=s;else{const d=s&127;if(!d)throw new n("tlv.decode(long): indefinite length not supported");if(d>4)throw new n("tlv.decode(long): byte length is too big");const c=e.subarray(i,i+d);if(c.length!==d)throw new n("tlv.decode: length bytes not complete");if(c[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const u of c)o=o<<8|u;if(i+=d,o<128)throw new n("tlv.decode(long): not minimal encoding")}const l=e.subarray(i,i+o);if(l.length!==o)throw new n("tlv.decode: wrong value length");return{v:l,l:e.subarray(i+o)}}},_int:{encode(t){const{Err:e}=lo;if(t<po)throw new e("integer: negative integers are not allowed");let n=mg(t);if(Number.parseInt(n[0],16)&8&&(n="00"+n),n.length&1)throw new e("unexpected DER parsing assertion: unpadded hex");return n},decode(t){const{Err:e}=lo;if(t[0]&128)throw new e("invalid signature integer: negative");if(t[0]===0&&!(t[1]&128))throw new e("invalid signature integer: unnecessary leading zero");return fu(t)}},toSig(t){const{Err:e,_int:n,_tlv:i}=lo,s=Wn("signature",t),{v:r,l:o}=i.decode(48,s);if(o.length)throw new e("invalid signature: left bytes after parsing");const{v:l,l:d}=i.decode(2,r),{v:c,l:u}=i.decode(2,d);if(u.length)throw new e("invalid signature: left bytes after parsing");return{r:n.decode(l),s:n.decode(c)}},hexFromSig(t){const{_tlv:e,_int:n}=lo,i=e.encode(2,n.encode(t.r)),s=e.encode(2,n.encode(t.s)),r=i+s;return e.encode(48,r)}},po=BigInt(0),gd=BigInt(1),ZU=BigInt(2),_g=BigInt(3),Cie=BigInt(4);function El(t,e){const{BYTES:n}=t;let i;if(typeof e=="bigint")i=e;else{let s=Wn("private key",e);try{i=t.fromBytes(s)}catch{throw new Error(`invalid private key: expected ui8a of size ${n}, got ${typeof e}`)}}if(!t.isValidNot0(i))throw new Error("invalid private key: out of range [1..N-1]");return i}a(El,"_normFnElement");function Pie(t,e={}){const n=kie("weierstrass",t,e),{Fp:i,Fn:s}=n;let r=n.CURVE;const{h:o,n:l}=r;sA(e,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:d}=e;if(d&&(!i.is0(r.a)||typeof d.beta!="bigint"||!Array.isArray(d.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const c=JU(i,s);function u(){if(!i.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}a(u,"assertCompressionIsSupported");function f(S,_,A){const{x,y:C}=_.toAffine(),U=i.toBytes(x);if(A0(A,"isCompressed"),A){u();const R=!i.isOdd(C);return Ji(QU(R),U)}else return Ji(Uint8Array.of(4),U,i.toBytes(C))}a(f,"pointToBytes");function h(S){vl(S,void 0,"Point");const{publicKey:_,publicKeyUncompressed:A}=c,x=S.length,C=S[0],U=S.subarray(1);if(x===_&&(C===2||C===3)){const R=i.fromBytes(U);if(!i.isValid(R))throw new Error("bad point: is not on curve, wrong x");const w=v(R);let P;try{P=i.sqrt(w)}catch(ee){const ne=ee instanceof Error?": "+ee.message:"";throw new Error("bad point: is not on curve, sqrt error"+ne)}u();const V=i.isOdd(P);return(C&1)===1!==V&&(P=i.neg(P)),{x:R,y:P}}else if(x===A&&C===4){const R=i.BYTES,w=i.fromBytes(U.subarray(0,R)),P=i.fromBytes(U.subarray(R,R*2));if(!y(w,P))throw new Error("bad point: is not on curve");return{x:w,y:P}}else throw new Error(`bad point: got length ${x}, expected compressed=${_} or uncompressed=${A}`)}a(h,"pointFromBytes");const p=e.toBytes||f,g=e.fromBytes||h;function v(S){const _=i.sqr(S),A=i.mul(_,S);return i.add(i.add(A,i.mul(S,r.a)),r.b)}a(v,"weierstrassEquation");function y(S,_){const A=i.sqr(_),x=v(S);return i.eql(A,x)}if(a(y,"isValidXY"),!y(r.Gx,r.Gy))throw new Error("bad curve params: generator point");const b=i.mul(i.pow(r.a,_g),Cie),E=i.mul(i.sqr(r.b),BigInt(27));if(i.is0(i.add(b,E)))throw new Error("bad curve params: a or b");function T(S,_,A=!1){if(!i.isValid(_)||A&&i.is0(_))throw new Error(`bad point coordinate ${S}`);return _}a(T,"acoord");function I(S){if(!(S instanceof F))throw new Error("ProjectivePoint expected")}a(I,"aprjpoint");function M(S){if(!d||!d.basises)throw new Error("no endo");return Mie(S,d.basises,s.ORDER)}a(M,"splitEndoScalarN");const H=SM((S,_)=>{const{X:A,Y:x,Z:C}=S;if(i.eql(C,i.ONE))return{x:A,y:x};const U=S.is0();_==null&&(_=U?i.ONE:i.inv(C));const R=i.mul(A,_),w=i.mul(x,_),P=i.mul(C,_);if(U)return{x:i.ZERO,y:i.ZERO};if(!i.eql(P,i.ONE))throw new Error("invZ was invalid");return{x:R,y:w}}),N=SM(S=>{if(S.is0()){if(e.allowInfinityPoint&&!i.is0(S.Y))return;throw new Error("bad point: ZERO")}const{x:_,y:A}=S.toAffine();if(!i.isValid(_)||!i.isValid(A))throw new Error("bad point: x or y not field elements");if(!y(_,A))throw new Error("bad point: equation left != right");if(!S.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function $(S,_,A,x,C){return A=new F(i.mul(A.X,S),A.Y,A.Z),_=R0(x,_),A=R0(C,A),_.add(A)}a($,"finishEndo");const m=class m{constructor(_,A,x){this.X=T("x",_),this.Y=T("y",A,!0),this.Z=T("z",x),Object.freeze(this)}static CURVE(){return r}static fromAffine(_){const{x:A,y:x}=_||{};if(!_||!i.isValid(A)||!i.isValid(x))throw new Error("invalid affine point");if(_ instanceof m)throw new Error("projective point not allowed");return i.is0(A)&&i.is0(x)?m.ZERO:new m(A,x,i.ONE)}static fromBytes(_){const A=m.fromAffine(g(vl(_,void 0,"point")));return A.assertValidity(),A}static fromHex(_){return m.fromBytes(Wn("pointHex",_))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(_=8,A=!0){return L.createCache(this,_),A||this.multiply(_g),this}assertValidity(){N(this)}hasEvenY(){const{y:_}=this.toAffine();if(!i.isOdd)throw new Error("Field doesn't support isOdd");return!i.isOdd(_)}equals(_){I(_);const{X:A,Y:x,Z:C}=this,{X:U,Y:R,Z:w}=_,P=i.eql(i.mul(A,w),i.mul(U,C)),V=i.eql(i.mul(x,w),i.mul(R,C));return P&&V}negate(){return new m(this.X,i.neg(this.Y),this.Z)}double(){const{a:_,b:A}=r,x=i.mul(A,_g),{X:C,Y:U,Z:R}=this;let w=i.ZERO,P=i.ZERO,V=i.ZERO,Z=i.mul(C,C),ee=i.mul(U,U),ne=i.mul(R,R),se=i.mul(C,U);return se=i.add(se,se),V=i.mul(C,R),V=i.add(V,V),w=i.mul(_,V),P=i.mul(x,ne),P=i.add(w,P),w=i.sub(ee,P),P=i.add(ee,P),P=i.mul(w,P),w=i.mul(se,w),V=i.mul(x,V),ne=i.mul(_,ne),se=i.sub(Z,ne),se=i.mul(_,se),se=i.add(se,V),V=i.add(Z,Z),Z=i.add(V,Z),Z=i.add(Z,ne),Z=i.mul(Z,se),P=i.add(P,Z),ne=i.mul(U,R),ne=i.add(ne,ne),Z=i.mul(ne,se),w=i.sub(w,Z),V=i.mul(ne,ee),V=i.add(V,V),V=i.add(V,V),new m(w,P,V)}add(_){I(_);const{X:A,Y:x,Z:C}=this,{X:U,Y:R,Z:w}=_;let P=i.ZERO,V=i.ZERO,Z=i.ZERO;const ee=r.a,ne=i.mul(r.b,_g);let se=i.mul(A,U),ge=i.mul(x,R),ie=i.mul(C,w),j=i.add(A,x),Y=i.add(U,R);j=i.mul(j,Y),Y=i.add(se,ge),j=i.sub(j,Y),Y=i.add(A,C);let le=i.add(U,w);return Y=i.mul(Y,le),le=i.add(se,ie),Y=i.sub(Y,le),le=i.add(x,C),P=i.add(R,w),le=i.mul(le,P),P=i.add(ge,ie),le=i.sub(le,P),Z=i.mul(ee,Y),P=i.mul(ne,ie),Z=i.add(P,Z),P=i.sub(ge,Z),Z=i.add(ge,Z),V=i.mul(P,Z),ge=i.add(se,se),ge=i.add(ge,se),ie=i.mul(ee,ie),Y=i.mul(ne,Y),ge=i.add(ge,ie),ie=i.sub(se,ie),ie=i.mul(ee,ie),Y=i.add(Y,ie),se=i.mul(ge,Y),V=i.add(V,se),se=i.mul(le,Y),P=i.mul(j,P),P=i.sub(P,se),se=i.mul(j,ge),Z=i.mul(le,Z),Z=i.add(Z,se),new m(P,V,Z)}subtract(_){return this.add(_.negate())}is0(){return this.equals(m.ZERO)}
107multiply(_){const{endo:A}=e;if(!s.isValidNot0(_))throw new Error("invalid scalar: out of range");let x,C;const U=a(R=>L.cached(this,R,w=>jb(m,w)),"mul");if(A){const{k1neg:R,k1:w,k2neg:P,k2:V}=M(_),{p:Z,f:ee}=U(w),{p:ne,f:se}=U(V);C=ee.add(se),x=$(A.beta,Z,ne,R,P)}else{const{p:R,f:w}=U(_);x=R,C=w}return jb(m,[x,C])[0]}multiplyUnsafe(_){const{endo:A}=e,x=this;if(!s.isValid(_))throw new Error("invalid scalar: out of range");if(_===po||x.is0())return m.ZERO;if(_===gd)return x;if(L.hasCache(this))return this.multiply(_);if(A){const{k1neg:C,k1:U,k2neg:R,k2:w}=M(_),{p1:P,p2:V}=Lie(m,x,U,w);return $(A.beta,P,V,C,R)}else return L.unsafe(x,_)}multiplyAndAddUnsafe(_,A,x){const C=this.multiplyUnsafe(A).add(_.multiplyUnsafe(x));return C.is0()?void 0:C}toAffine(_){return H(this,_)}isTorsionFree(){const{isTorsionFree:_}=e;return o===gd?!0:_?_(m,this):L.unsafe(this,l).is0()}clearCofactor(){const{clearCofactor:_}=e;return o===gd?this:_?_(m,this):this.multiplyUnsafe(o)}isSmallOrder(){return this.multiplyUnsafe(o).is0()}toBytes(_=!0){return A0(_,"isCompressed"),this.assertValidity(),p(m,this,_)}toHex(_=!0){return ka(this.toBytes(_))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(_=!0){return this.toBytes(_)}_setWindowSize(_){this.precompute(_)}static normalizeZ(_){return jb(m,_)}static msm(_,A){return Rie(m,s,_,A)}static fromPrivateKey(_){return m.BASE.multiply(El(s,_))}};a(m,"Point");let F=m;F.BASE=new F(r.Gx,r.Gy,i.ONE),F.ZERO=new F(i.ZERO,i.ONE,i.ZERO),F.Fp=i,F.Fn=s;const D=s.BITS,L=new J_(F,e.endo?Math.ceil(D/2):D);return F.BASE.precompute(8),F}a(Pie,"weierstrassN");function QU(t){return Uint8Array.of(t?2:3)}a(QU,"pprefix");function JU(t,e){return{secretKey:e.BYTES,publicKey:1+t.BYTES,publicKeyUncompressed:1+2*t.BYTES,publicKeyHasPrefix:!0,signature:2*e.BYTES}}a(JU,"getWLengths");function Die(t,e={}){const{Fn:n}=t,i=e.randomBytes||Cp,s=Object.assign(JU(t.Fp,n),{seed:KU(n.ORDER)});function r(p){try{return!!El(n,p)}catch{return!1}}a(r,"isValidSecretKey");function o(p,g){const{publicKey:v,publicKeyUncompressed:y}=s;try{const b=p.length;return g===!0&&b!==v||g===!1&&b!==y?!1:!!t.fromBytes(p)}catch{return!1}}a(o,"isValidPublicKey");function l(p=i(s.seed)){return qU(vl(p,s.seed,"seed"),n.ORDER)}a(l,"randomSecretKey");function d(p,g=!0){return t.BASE.multiply(El(n,p)).toBytes(g)}a(d,"getPublicKey");function c(p){const g=l(p);return{secretKey:g,publicKey:d(g)}}a(c,"keygen");function u(p){if(typeof p=="bigint")return!1;if(p instanceof t)return!0;const{secretKey:g,publicKey:v,publicKeyUncompressed:y}=s;if(n.allowedLengths||g===v)return;const b=Wn("key",p).length;return b===v||b===y}a(u,"isProbPub");function f(p,g,v=!0){if(u(p)===!0)throw new Error("first arg must be private key");if(u(g)===!1)throw new Error("second arg must be public key");const y=El(n,p);return t.fromHex(g).multiply(y).toBytes(v)}return a(f,"getSharedSecret"),Object.freeze({getPublicKey:d,getSharedSecret:f,keygen:c,Point:t,utils:{isValidSecretKey:r,isValidPublicKey:o,randomSecretKey:l,isValidPrivateKey:r,randomPrivateKey:l,normPrivateKeyToScalar:p=>El(n,p),precompute(p=8,g=t.BASE){return g.precompute(p,!1)}},lengths:s})}a(Die,"ecdh");function Oie(t,e,n={}){E1(e),sA(n,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const i=n.randomBytes||Cp,s=n.hmac||((A,...x)=>Xf(e,A,Ji(...x))),{Fp:r,Fn:o}=t,{ORDER:l,BITS:d}=o,{keygen:c,getPublicKey:u,getSharedSecret:f,utils:h,lengths:p}=Die(t,n),g={prehash:!1,lowS:typeof n.lowS=="boolean"?n.lowS:!1,format:void 0,extraEntropy:!1},v="compact";function y(A){const x=l>>gd;return A>x}a(y,"isBiggerThanHalfOrder");function b(A,x){if(!o.isValidNot0(x))throw new Error(`invalid signature ${A}: out of range 1..Point.Fn.ORDER`);return x}a(b,"validateRS");function E(A,x){X_(x);const C=p.signature,U=x==="compact"?C:x==="recovered"?C+1:void 0;return vl(A,U,`${x} signature`)}a(E,"validateSigLength");const _=class _{constructor(x,C,U){this.r=b("r",x),this.s=b("s",C),U!=null&&(this.recovery=U),Object.freeze(this)}static fromBytes(x,C=v){E(x,C);let U;if(C==="der"){const{r:V,s:Z}=lo.toSig(vl(x));return new _(V,Z)}
vendor: 6,365 bytes, line 107
107C==="recovered"&&(U=x[0],C="compact",x=x.subarray(1));const R=o.BYTES,w=x.subarray(0,R),P=x.subarray(R,R*2);return new _(o.fromBytes(w),o.fromBytes(P),U)}static fromHex(x,C){return this.fromBytes(Nd(x),C)}addRecoveryBit(x){return new _(this.r,this.s,x)}recoverPublicKey(x){const C=r.ORDER,{r:U,s:R,recovery:w}=this;if(w==null||![0,1,2,3].includes(w))throw new Error("recovery id invalid");if(l*ZU<C&&w>1)throw new Error("recovery id is ambiguous for h>1 curve");const V=w===2||w===3?U+l:U;if(!r.isValid(V))throw new Error("recovery id 2 or 3 invalid");const Z=r.toBytes(V),ee=t.fromBytes(Ji(QU((w&1)===0),Z)),ne=o.inv(V),se=M(Wn("msgHash",x)),ge=o.create(-se*ne),ie=o.create(R*ne),j=t.BASE.multiplyUnsafe(ge).add(ee.multiplyUnsafe(ie));if(j.is0())throw new Error("point at infinify");return j.assertValidity(),j}hasHighS(){return y(this.s)}toBytes(x=v){if(X_(x),x==="der")return Nd(lo.hexFromSig(this));const C=o.toBytes(this.r),U=o.toBytes(this.s);if(x==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return Ji(Uint8Array.of(this.recovery),C,U)}return Ji(C,U)}toHex(x){return ka(this.toBytes(x))}assertValidity(){}static fromCompact(x){return _.fromBytes(Wn("sig",x),"compact")}static fromDER(x){return _.fromBytes(Wn("sig",x),"der")}normalizeS(){return this.hasHighS()?new _(this.r,o.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return ka(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return ka(this.toBytes("compact"))}};a(_,"Signature");let T=_;const I=n.bits2int||a(function(x){if(x.length>8192)throw new Error("input is too large");const C=fu(x),U=x.length*8-d;return U>0?C>>BigInt(U):C},"bits2int_def"),M=n.bits2int_modN||a(function(x){return o.create(I(x))},"bits2int_modN_def"),H=Gp(d);function N(A){return $ne("num < 2^"+d,A,po,H),o.toBytes(A)}a(N,"int2octets");function $(A,x){return vl(A,void 0,"message"),x?vl(e(A),void 0,"prehashed message"):A}a($,"validateMsgAndHash");function F(A,x,C){if(["recovered","canonical"].some(ge=>ge in C))throw new Error("sign() legacy options not supported");const{lowS:U,prehash:R,extraEntropy:w}=Jb(C,g);A=$(A,R);const P=M(A),V=El(o,x),Z=[N(V),N(P)];if(w!=null&&w!==!1){const ge=w===!0?i(p.secretKey):w;Z.push(Wn("extraEntropy",ge))}const ee=Ji(...Z),ne=P;function se(ge){const ie=I(ge);if(!o.isValidNot0(ie))return;const j=o.inv(ie),Y=t.BASE.multiply(ie).toAffine(),le=o.create(Y.x);if(le===po)return;const pe=o.create(j*o.create(ne+le*V));if(pe===po)return;let Te=(Y.x===le?0:2)|Number(Y.y&gd),Le=pe;return U&&y(pe)&&(Le=o.neg(pe),Te^=1),new T(le,Le,Te)}return a(se,"k2sig"),{seed:ee,k2sig:se}}a(F,"prepSig");function D(A,x,C={}){A=Wn("message",A);const{seed:U,k2sig:R}=F(A,x,C);return Hne(e.outputLen,o.BYTES,s)(U,R)}a(D,"sign");function L(A){let x;const C=typeof A=="string"||hy(A),U=!C&&A!==null&&typeof A=="object"&&typeof A.r=="bigint"&&typeof A.s=="bigint";if(!C&&!U)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(U)x=new T(A.r,A.s);else if(C){try{x=T.fromBytes(Wn("sig",A),"der")}catch(R){if(!(R instanceof lo.Err))throw R}if(!x)try{x=T.fromBytes(Wn("sig",A),"compact")}catch{return!1}}return x||!1}a(L,"tryParsingSig");function m(A,x,C,U={}){const{lowS:R,prehash:w,format:P}=Jb(U,g);if(C=Wn("publicKey",C),x=$(Wn("message",x),w),"strict"in U)throw new Error("options.strict was renamed to lowS");const V=P===void 0?L(A):T.fromBytes(Wn("sig",A),P);if(V===!1)return!1;try{const Z=t.fromBytes(C);if(R&&V.hasHighS())return!1;const{r:ee,s:ne}=V,se=M(x),ge=o.inv(ne),ie=o.create(se*ge),j=o.create(ee*ge),Y=t.BASE.multiplyUnsafe(ie).add(Z.multiplyUnsafe(j));return Y.is0()?!1:o.create(Y.x)===ee}catch{return!1}}a(m,"verify");function S(A,x,C={}){const{prehash:U}=Jb(C,g);return x=$(x,U),T.fromBytes(A,"recovered").recoverPublicKey(x).toBytes()}return a(S,"recoverPublicKey"),Object.freeze({keygen:c,getPublicKey:u,getSharedSecret:f,utils:h,lengths:p,Point:t,sign:D,verify:m,recoverPublicKey:S,Signature:T,hash:e})}a(Oie,"ecdsa");function Nie(t){const e={a:t.a,b:t.b,p:t.Fp.ORDER,n:t.n,h:t.h,Gx:t.Gx,Gy:t.Gy},n=t.Fp;let i=t.allowedPrivateKeyLengths?Array.from(new Set(t.allowedPrivateKeyLengths.map(o=>Math.ceil(o/2)))):void 0;const s=Vp(e.n,{BITS:t.nBitLength,allowedLengths:i,modFromBytes:t.wrapPrivateKey}),r={Fp:n,Fn:s,allowInfinityPoint:t.allowInfinityPoint,endo:t.endo,isTorsionFree:t.isTorsionFree,clearCofactor:t.clearCofactor,fromBytes:t.fromBytes,toBytes:t.toBytes};return{CURVE:e,curveOpts:r}}a(Nie,"_weierstrass_legacy_opts_to_new");function Fie(t){const{CURVE:e,curveOpts:n}=Nie(t),i={hmac:t.hmac,randomBytes:t.randomBytes,lowS:t.lowS,bits2int:t.bits2int,bits2int_modN:t.bits2int_modN};return{CURVE:e,curveOpts:n,hash:t.hash,ecdsaOpts:i}}a(Fie,"_ecdsa_legacy_opts_to_new");function Uie(t,e){const n=e.Point;return Object.assign({},e,{ProjectivePoint:n,CURVE:Object.assign({},t,WU(n.Fn.ORDER,n.Fn.BITS))})}a(Uie,"_ecdsa_new_output_to_legacy");function Bie(t){const{CURVE:e,curveOpts:n,hash:i,ecdsaOpts:s}=Fie(t),r=Pie(e,n),o=Oie(r,i,s);return Uie(t,o)}a(Bie,"weierstrass");/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function $ie(t,e){const n=a(i=>Bie({...t,hash:i}),"create");return{...n(e),create:n}}a($ie,"createCurve");/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Vd={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},Hie={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},Gie=BigInt(0),OM=BigInt(1),tw=BigInt(2);function Vie(t){const e=Vd.p,n=BigInt(3),i=BigInt(6),s=BigInt(11),r=BigInt(22),o=BigInt(23),l=BigInt(44),d=BigInt(88),c=t*t*t%e,u=c*c*t%e,f=_s(u,n,e)*u%e,h=_s(f,n,e)*u%e,p=_s(h,tw,e)*c%e,g=_s(p,s,e)*p%e,v=_s(g,r,e)*g%e,y=_s(v,l,e)*v%e,b=_s(y,d,e)*y%e,E=_s(b,l,e)*v%e,T=_s(E,n,e)*u%e,I=_s(T,o,e)*g%e,M=_s(I,i,e)*c%e,H=_s(M,tw,e);
107if(!k0.eql(k0.sqr(H),t))throw new Error("Cannot find square root");return H}a(Vie,"sqrtMod");const k0=Vp(Vd.p,{sqrt:Vie}),ji=$ie({...Vd,Fp:k0,lowS:!0,endo:Hie},zl),NM={};function M0(t,...e){let n=NM[t];if(n===void 0){const i=zl(py(t));n=Ji(i,i),NM[t]=n}return zl(Ji(n,...e))}a(M0,"taggedHash");const lA=a(t=>t.toBytes(!0).slice(1),"pointToBytes"),hu=(()=>ji.Point)(),cA=a(t=>t%tw===Gie,"hasEven");function nw(t){const{Fn:e,BASE:n}=hu,i=El(e,t),s=n.multiply(i);return{scalar:cA(s.y)?i:e.neg(i),bytes:lA(s)}}a(nw,"schnorrGetExtPubKey");function XU(t){const e=k0;if(!e.isValidNot0(t))throw new Error("invalid x: Fail if x ≥ p");const n=e.create(t*t),i=e.create(n*t+BigInt(7));let s=e.sqrt(i);cA(s)||(s=e.neg(s));const r=hu.fromAffine({x:t,y:s});return r.assertValidity(),r}a(XU,"lift_x");const _f=fu;function eB(...t){return hu.Fn.create(_f(M0("BIP0340/challenge",...t)))}a(eB,"challenge");function FM(t){return nw(t).bytes}a(FM,"schnorrGetPublicKey");function Wie(t,e,n=Cp(32)){const{Fn:i}=hu,s=Wn("message",t),{bytes:r,scalar:o}=nw(e),l=Wn("auxRand",n,32),d=i.toBytes(o^_f(M0("BIP0340/aux",l))),c=M0("BIP0340/nonce",d,r,s),{bytes:u,scalar:f}=nw(c),h=eB(u,r,s),p=new Uint8Array(64);if(p.set(u,0),p.set(i.toBytes(i.create(f+h*o)),32),!tB(p,s,r))throw new Error("sign: Invalid signature produced");return p}a(Wie,"schnorrSign");function tB(t,e,n){const{Fn:i,BASE:s}=hu,r=Wn("signature",t,64),o=Wn("message",e),l=Wn("publicKey",n,32);try{const d=XU(_f(l)),c=_f(r.subarray(0,32));if(!j_(c,OM,Vd.p))return!1;const u=_f(r.subarray(32,64));if(!j_(u,OM,Vd.n))return!1;const f=eB(i.toBytes(c),lA(d),o),h=s.multiplyUnsafe(u).add(d.multiplyUnsafe(i.neg(f))),{x:p,y:g}=h.toAffine();return!(h.is0()||!cA(g)||p!==c)}catch{return!1}}a(tB,"schnorrVerify");const E_e=(()=>{const n=a((s=Cp(48))=>qU(s,Vd.n),"randomSecretKey");ji.utils.randomSecretKey;function i(s){const r=n(s);return{secretKey:r,publicKey:FM(r)}}return a(i,"keygen"),{keygen:i,getPublicKey:FM,sign:Wie,verify:tB,Point:hu,utils:{randomSecretKey:n,randomPrivateKey:n,taggedHash:M0,lift_x:XU,pointToBytes:lA,numberToBytesBE:Py,bytesToNumberBE:fu,mod:ds},lengths:{secretKey:32,publicKey:32,publicKeyHasPrefix:!1,signature:32*2,seed:48}}})();function nB(t){for(var e;!e;){var n=x0(t),i=kU(n),s="02"+i;try{e=C0(s)}catch{t=x0(t)}}return e}a(nB,"hashToCurve");function C0(t){return ji.ProjectivePoint.fromHex(t)}a(C0,"pointFromHex");function iB(t,e){var n=xU(t),i=new TextEncoder().encode(n),s=nB(i);e||(e=oA(ji.utils.randomPrivateKey()));var r=ji.ProjectivePoint.BASE.multiply(e),o=s.add(r);return{B_:o,r:e}}a(iB,"blindMessage");function sB(t,e,n){var i=t.subtract(n.multiply(e));return i}a(sB,"unblindSignature");function zie(t,e,n,i){return t.map(function(s,r){var o=C0(s.C_),l=C0(i[s.amount]),d=sB(o,e[r],l),c={id:s.id,amount:s.amount,secret:xU(n[r]),C:d.toHex(!0)};return c})}a(zie,"constructProofs");const Ou=Object.freeze(Object.defineProperty({__proto__:null,blindMessage:iB,constructProofs:zie,hashToCurve:nB,pointFromHex:C0,unblindSignature:sB},Symbol.toStringTag,{value:"Module"}));var Kie=function(){function t(e,n){this.amount=e,this.B_=n}return a(t,"BlindedMessage"),t.prototype.getSerializedBlindedMessage=function(){return{amount:this.amount,B_:this.B_.toHex(!0)}},t}();const qie=Uint8Array.from([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),rB=(()=>Uint8Array.from(new Array(16).fill(0).map((t,e)=>e)))(),jie=(()=>rB.map(t=>(9*t+5)%16))(),oB=(()=>{const n=[[rB],[jie]];for(let i=0;i<4;i++)for(let s of n)s.push(s[i].map(r=>qie[r]));return n})(),aB=(()=>oB[0])(),lB=(()=>oB[1])(),cB=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(t=>Uint8Array.from(t)),Yie=aB.map((t,e)=>t.map(n=>cB[e][n])),Zie=lB.map((t,e)=>t.map(n=>cB[e][n])),Qie=Uint32Array.from([0,1518500249,1859775393,2400959708,2840853838]),Jie=Uint32Array.from([1352829926,1548603684,1836072691,2053994217,0]);function UM(t,e,n,i){return t===0?e^n^i:t===1?e&n|~e&i:t===2?(e|~n)^i:t===3?e&i|n&~i:e^(n|~i)}a(UM,"ripemd_f");const wg=new Uint32Array(16),sx=class sx extends Jf{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:e,h1:n,h2:i,h3:s,h4:r}=this;return[e,n,i,s,r]}set(e,n,i,s,r){this.h0=e|0,this.h1=n|0,this.h2=i|0,this.h3=s|0,this.h4=r|0}process(e,n){for(let p=0;p<16;p++,n+=4)wg[p]=e.getUint32(n,!0);let i=this.h0|0,s=i,r=this.h1|0,o=r,l=this.h2|0,d=l,c=this.h3|0,u=c,f=this.h4|0,h=f;for(let p=0;p<5;p++){const g=4-p,v=Qie[p],y=Jie[p],b=aB[p],E=lB[p],T=Yie[p],I=Zie[p];for(let M=0;M<16;M++){const H=lg(i+UM(p,r,l,c)+wg[b[M]]+v,T[M])+f|0;i=f,f=c,c=lg(l,10)|0,l=r,r=H}for(let M=0;M<16;M++){const H=lg(s+UM(g,o,d,u)+wg[E[M]]+y,I[M])+h|0;s=h,h=u,u=lg(d,10)|0,d=o,o=H}}this.set(this.h1+l+u|0,this.h2+c+h|0,this.h3+f+s|0,this.h4+i+o|0,this.h0+r+d|0)}roundClean(){_o(wg)}
107destroy(){this.destroyed=!0,_o(this.buffer),this.set(0,0,0,0,0)}};a(sx,"RIPEMD160");let iw=sx;const Xie=gy(()=>new iw);/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function sw(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}a(sw,"isBytes$1");function dB(t,e){return Array.isArray(e)?e.length===0?!0:t?e.every(n=>typeof n=="string"):e.every(n=>Number.isSafeInteger(n)):!1}a(dB,"isArrayOf$1");function ese(t){if(typeof t!="function")throw new Error("function expected");return!0}a(ese,"afn$1");function rw(t,e){if(typeof e!="string")throw new Error(`${t}: string expected`);return!0}a(rw,"astr$1");function dA(t){if(!Number.isSafeInteger(t))throw new Error(`invalid integer: ${t}`)}a(dA,"anumber$1");function ow(t){if(!Array.isArray(t))throw new Error("array expected")}a(ow,"aArr$1");function uB(t,e){if(!dB(!0,e))throw new Error(`${t}: array of strings expected`)}a(uB,"astrArr$1");function tse(t,e){if(!dB(!1,e))throw new Error(`${t}: array of numbers expected`)}a(tse,"anumArr$1");function fB(...t){const e=a(r=>r,"id"),n=a((r,o)=>l=>r(o(l)),"wrap"),i=t.map(r=>r.encode).reduceRight(n,e),s=t.map(r=>r.decode).reduce(n,e);return{encode:i,decode:s}}a(fB,"chain$1");function nse(t){const e=typeof t=="string"?t.split(""):t,n=e.length;uB("alphabet",e);const i=new Map(e.map((s,r)=>[s,r]));return{encode:s=>(ow(s),s.map(r=>{if(!Number.isSafeInteger(r)||r<0||r>=n)throw new Error(`alphabet.encode: digit index outside alphabet "${r}". Allowed: ${t}`);return e[r]})),decode:s=>(ow(s),s.map(r=>{rw("alphabet.decode",r);const o=i.get(r);if(o===void 0)throw new Error(`Unknown letter: "${r}". Allowed: ${t}`);return o}))}}a(nse,"alphabet$1");function ise(t=""){return rw("join",t),{encode:e=>(uB("join.decode",e),e.join(t)),decode:e=>(rw("join.decode",e),e.split(t))}}a(ise,"join$1");function BM(t,e,n){if(e<2)throw new Error(`convertRadix: invalid from=${e}, base cannot be less than 2`);if(n<2)throw new Error(`convertRadix: invalid to=${n}, base cannot be less than 2`);if(ow(t),!t.length)return[];let i=0;const s=[],r=Array.from(t,l=>{if(dA(l),l<0||l>=e)throw new Error(`invalid integer: ${l}`);return l}),o=r.length;for(;;){let l=0,d=!0;for(let c=i;c<o;c++){const u=r[c],f=e*l,h=f+u;if(!Number.isSafeInteger(h)||f/e!==l||h-u!==f)throw new Error("convertRadix: carry overflow");const p=h/n;l=h%n;const g=Math.floor(p);if(r[c]=g,!Number.isSafeInteger(g)||g*n+l!==h)throw new Error("convertRadix: carry overflow");if(d)g?d=!1:i=c;else continue}if(s.push(l),d)break}for(let l=0;l<t.length-1&&t[l]===0;l++)s.push(0);return s.reverse()}a(BM,"convertRadix$1");function sse(t){dA(t);const e=2**8;return{encode:n=>{if(!sw(n))throw new Error("radix.encode input should be Uint8Array");return BM(Array.from(n),e,t)},decode:n=>(tse("radix.decode",n),Uint8Array.from(BM(n,t,e)))}}a(sse,"radix$1");function rse(t,e){return dA(t),ese(e),{encode(n){if(!sw(n))throw new Error("checksum.encode: input should be Uint8Array");const i=e(n).slice(0,t),s=new Uint8Array(n.length+t);return s.set(n),s.set(i,n.length),s},decode(n){if(!sw(n))throw new Error("checksum.decode: input should be Uint8Array");const i=n.slice(0,-t),s=n.slice(-t),r=e(i).slice(0,t);for(let o=0;o<t;o++)if(r[o]!==s[o])throw new Error("Invalid checksum");return i}}}a(rse,"checksum$1");const ose=a(t=>fB(sse(58),nse(t),ise("")),"genBase58"),ase=ose("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),lse=a(t=>fB(rse(4,e=>t(t(e))),ase),"createBase58check");/*! scure-bip32 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) */const Sg=ji.ProjectivePoint,Xb=lse(zl);function $M(t){Oi(t);const e=t.length===0?"0":ka(t);return BigInt("0x"+e)}a($M,"bytesToNumber");function cse(t){if(typeof t!="bigint")throw new Error("bigint expected");return Nd(t.toString(16).padStart(64,"0"))}a(cse,"numberToBytes");const dse=py("Bitcoin seed"),eE={private:76066276,public:76067358},tE=2147483648,use=a(t=>Xie(zl(t)),"hash160"),fse=a(t=>kl(t).getUint32(0,!1),"fromU32"),Tg=a(t=>{if(!Number.isSafeInteger(t)||t<0||t>2**32-1)throw new Error("invalid number, should be from 0 to 2**32-1, got "+t);const e=new Uint8Array(4);return kl(e).setUint32(0,t,!1),e},"toU32"),Xo=class Xo{get fingerprint(){if(!this.pubHash)throw new Error("No publicKey set!");return fse(this.pubHash)}get identifier(){return this.pubHash}get pubKeyHash(){return this.pubHash}get privateKey(){return this.privKeyBytes||null}get publicKey(){return this.pubKey||null}get privateExtendedKey(){const e=this.privateKey;if(!e)throw new Error("No private key");return Xb.encode(this.serialize(this.versions.private,Ji(new Uint8Array([0]),e)))}get publicExtendedKey(){if(!this.pubKey)throw new Error("No public key");return Xb.encode(this.serialize(this.versions.public,this.pubKey))}static fromMasterSeed(e,n=eE){if(Oi(e),8*e.length<128||8*e.length>512)throw new Error("HDKey: seed length must be between 128 and 512 bits; 256 bits is advised, got "+e.length);const i=Xf(Z_,dse,e);return new Xo({versions:n,chainCode:i.slice(32),privateKey:i.slice(0,32)})}static fromExtendedKey(e,n=eE){const i=Xb.decode(e),s=kl(i),r=s.getUint32(0,!1),o={versions:n,depth:i[4],parentFingerprint:s.getUint32(5,!1),index:s.getUint32(9,!1),chainCode:i.slice(13,45)},l=i.slice(45),d=l[0]===0;if(r!==n[d?"private":"public"])throw new Error("Version mismatch");return d?new Xo({...o,privateKey:l.slice(1)}):new Xo({...o,publicKey:l})}
107static fromJSON(e){return Xo.fromExtendedKey(e.xpriv)}constructor(e){if(this.depth=0,this.index=0,this.chainCode=null,this.parentFingerprint=0,!e||typeof e!="object")throw new Error("HDKey.constructor must not be called directly");if(this.versions=e.versions||eE,this.depth=e.depth||0,this.chainCode=e.chainCode||null,this.index=e.index||0,this.parentFingerprint=e.parentFingerprint||0,!this.depth&&(this.parentFingerprint||this.index))throw new Error("HDKey: zero depth with non-zero index/parent fingerprint");if(e.publicKey&&e.privateKey)throw new Error("HDKey: publicKey and privateKey at same time.");if(e.privateKey){if(!ji.utils.isValidPrivateKey(e.privateKey))throw new Error("Invalid private key");this.privKey=typeof e.privateKey=="bigint"?e.privateKey:$M(e.privateKey),this.privKeyBytes=cse(this.privKey),this.pubKey=ji.getPublicKey(e.privateKey,!0)}else if(e.publicKey)this.pubKey=Sg.fromHex(e.publicKey).toRawBytes(!0);else throw new Error("HDKey: no public or private key provided");this.pubHash=use(this.pubKey)}derive(e){if(!/^[mM]'?/.test(e))throw new Error('Path must start with "m" or "M"');if(/^[mM]'?$/.test(e))return this;const n=e.replace(/^[mM]'?\//,"").split("/");let i=this;for(const s of n){const r=/^(\d+)('?)$/.exec(s),o=r&&r[1];if(!r||r.length!==3||typeof o!="string")throw new Error("invalid child index: "+s);let l=+o;if(!Number.isSafeInteger(l)||l>=tE)throw new Error("Invalid index");r[2]==="'"&&(l+=tE),i=i.deriveChild(l)}return i}deriveChild(e){if(!this.pubKey||!this.chainCode)throw new Error("No publicKey or chainCode set");let n=Tg(e);if(e>=tE){const l=this.privateKey;if(!l)throw new Error("Could not derive hardened child key");n=Ji(new Uint8Array([0]),l,n)}else n=Ji(this.pubKey,n);const i=Xf(Z_,this.chainCode,n),s=$M(i.slice(0,32)),r=i.slice(32);if(!ji.utils.isValidPrivateKey(s))throw new Error("Tweak bigger than curve order");const o={versions:this.versions,chainCode:r,depth:this.depth+1,parentFingerprint:this.fingerprint,index:e};try{if(this.privateKey){const l=ds(this.privKey+s,ji.CURVE.n);if(!ji.utils.isValidPrivateKey(l))throw new Error("The tweak was out of range or the resulted private key is invalid");o.privateKey=l}else{const l=Sg.fromHex(this.pubKey).add(Sg.fromPrivateKey(s));if(l.equals(Sg.ZERO))throw new Error("The tweak was equal to negative P, which made the result key invalid");o.publicKey=l.toRawBytes(!0)}return new Xo(o)}catch{return this.deriveChild(e+1)}}sign(e){if(!this.privateKey)throw new Error("No privateKey set!");return Oi(e,32),ji.sign(e,this.privKey).toCompactRawBytes()}verify(e,n){if(Oi(e,32),Oi(n,64),!this.publicKey)throw new Error("No publicKey set!");let i;try{i=ji.Signature.fromCompact(n)}catch{return!1}return ji.verify(i,e,this.publicKey)}wipePrivateData(){return this.privKey=void 0,this.privKeyBytes&&(this.privKeyBytes.fill(0),this.privKeyBytes=void 0),this}toJSON(){return{xpriv:this.privateExtendedKey,xpub:this.publicExtendedKey}}serialize(e,n){if(!this.chainCode)throw new Error("No chainCode set");return Oi(n,33),Ji(Tg(e),new Uint8Array([this.depth]),Tg(this.parentFingerprint),Tg(this.index),this.chainCode,n)}};a(Xo,"HDKey");let aw=Xo;function hse(t,e,n,i){E1(t);const s=OK({dkLen:32,asyncTick:10},i),{c:r,dkLen:o,asyncTick:l}=s;if(hd(r),hd(o),hd(l),r<1)throw new Error("iterations (c) should be >= 1");const d=_k(e),c=_k(n),u=new Uint8Array(o),f=Xf.create(t,d),h=f._cloneInto().update(c);return{c:r,dkLen:o,asyncTick:l,DK:u,PRF:f,PRFSalt:h}}a(hse,"pbkdf2Init");function pse(t,e,n,i,s){return t.destroy(),e.destroy(),i&&i.destroy(),_o(s),n}a(pse,"pbkdf2Output");function gse(t,e,n,i){const{c:s,dkLen:r,DK:o,PRF:l,PRFSalt:d}=hse(t,e,n,i);let c;const u=new Uint8Array(4),f=kl(u),h=new Uint8Array(l.outputLen);for(let p=1,g=0;g<r;p++,g+=l.outputLen){const v=o.subarray(g,g+l.outputLen);f.setInt32(0,p,!1),(c=d._cloneInto(c)).update(u).digestInto(h),v.set(h.subarray(0,v.length));for(let y=1;y<s;y++){l._cloneInto(c).update(h).digestInto(h);for(let b=0;b<v.length;b++)v[b]^=h[b]}}return pse(l,d,o,c,h)}a(gse,"pbkdf2");/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function P0(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}a(P0,"isBytes");function hB(t,e){return Array.isArray(e)?e.length===0?!0:t?e.every(n=>typeof n=="string"):e.every(n=>Number.isSafeInteger(n)):!1}a(hB,"isArrayOf");function mse(t){if(typeof t!="function")throw new Error("function expected");return!0}a(mse,"afn");function D0(t,e){if(typeof e!="string")throw new Error(`${t}: string expected`);return!0}a(D0,"astr");function pu(t){if(!Number.isSafeInteger(t))throw new Error(`invalid integer: ${t}`)}
107a(pu,"anumber");function O0(t){if(!Array.isArray(t))throw new Error("array expected")}a(O0,"aArr");function N0(t,e){if(!hB(!0,e))throw new Error(`${t}: array of strings expected`)}a(N0,"astrArr");function pB(t,e){if(!hB(!1,e))throw new Error(`${t}: array of numbers expected`)}a(pB,"anumArr");function vse(...t){const e=a(r=>r,"id"),n=a((r,o)=>l=>r(o(l)),"wrap"),i=t.map(r=>r.encode).reduceRight(n,e),s=t.map(r=>r.decode).reduce(n,e);return{encode:i,decode:s}}a(vse,"chain");function yse(t){const e=typeof t=="string"?t.split(""):t,n=e.length;N0("alphabet",e);const i=new Map(e.map((s,r)=>[s,r]));return{encode:s=>(O0(s),s.map(r=>{if(!Number.isSafeInteger(r)||r<0||r>=n)throw new Error(`alphabet.encode: digit index outside alphabet "${r}". Allowed: ${t}`);return e[r]})),decode:s=>(O0(s),s.map(r=>{D0("alphabet.decode",r);const o=i.get(r);if(o===void 0)throw new Error(`Unknown letter: "${r}". Allowed: ${t}`);return o}))}}a(yse,"alphabet");function bse(t=""){return D0("join",t),{encode:e=>(N0("join.decode",e),e.join(t)),decode:e=>(D0("join.decode",e),e.split(t))}}a(bse,"join");function Ese(t,e="="){return pu(t),D0("padding",e),{encode(n){for(N0("padding.encode",n);n.length*t%8;)n.push(e);return n},decode(n){N0("padding.decode",n);let i=n.length;if(i*t%8)throw new Error("padding: invalid, string should have whole number of bytes");for(;i>0&&n[i-1]===e;i--)if((i-1)*t%8===0)throw new Error("padding: invalid, string has too much padding");return n.slice(0,i)}}}a(Ese,"padding");function lw(t,e,n){if(e<2)throw new Error(`convertRadix: invalid from=${e}, base cannot be less than 2`);if(n<2)throw new Error(`convertRadix: invalid to=${n}, base cannot be less than 2`);if(O0(t),!t.length)return[];let i=0;const s=[],r=Array.from(t,l=>{if(pu(l),l<0||l>=e)throw new Error(`invalid integer: ${l}`);return l}),o=r.length;for(;;){let l=0,d=!0;for(let c=i;c<o;c++){const u=r[c],f=e*l,h=f+u;if(!Number.isSafeInteger(h)||f/e!==l||h-u!==f)throw new Error("convertRadix: carry overflow");const p=h/n;l=h%n;const g=Math.floor(p);if(r[c]=g,!Number.isSafeInteger(g)||g*n+l!==h)throw new Error("convertRadix: carry overflow");if(d)g?d=!1:i=c;else continue}if(s.push(l),d)break}for(let l=0;l<t.length-1&&t[l]===0;l++)s.push(0);return s.reverse()}a(lw,"convertRadix");const gB=a((t,e)=>e===0?t:gB(e,t%e),"gcd"),F0=a((t,e)=>t+(e-gB(t,e)),"radix2carry"),nE=(()=>{let t=[];for(let e=0;e<40;e++)t.push(2**e);return t})();function cw(t,e,n,i){if(O0(t),e<=0||e>32)throw new Error(`convertRadix2: wrong from=${e}`);if(n<=0||n>32)throw new Error(`convertRadix2: wrong to=${n}`);if(F0(e,n)>32)throw new Error(`convertRadix2: carry overflow from=${e} to=${n} carryBits=${F0(e,n)}`);let s=0,r=0;const o=nE[e],l=nE[n]-1,d=[];for(const c of t){if(pu(c),c>=o)throw new Error(`convertRadix2: invalid data word=${c} from=${e}`);if(s=s<<e|c,r+e>32)throw new Error(`convertRadix2: carry overflow pos=${r} from=${e}`);for(r+=e;r>=n;r-=n)d.push((s>>r-n&l)>>>0);const u=nE[r];if(u===void 0)throw new Error("invalid carry");s&=u-1}if(s=s<<n-r&l,!i&&r>=e)throw new Error("Excess padding");if(!i&&s>0)throw new Error(`Non-zero padding: ${s}`);return i&&r>0&&d.push(s>>>0),d}a(cw,"convertRadix2");function _se(t){pu(t);const e=2**8;return{encode:n=>{if(!P0(n))throw new Error("radix.encode input should be Uint8Array");return lw(Array.from(n),e,t)},decode:n=>(pB("radix.decode",n),Uint8Array.from(lw(n,t,e)))}}a(_se,"radix");function wse(t,e=!1){if(pu(t),t<=0||t>32)throw new Error("radix2: bits should be in (0..32]");if(F0(8,t)>32||F0(t,8)>32)throw new Error("radix2: carry overflow");return{encode:n=>{if(!P0(n))throw new Error("radix2.encode input should be Uint8Array");return cw(Array.from(n),8,t,!e)},decode:n=>(pB("radix2.decode",n),Uint8Array.from(cw(n,t,8,e)))}}a(wse,"radix2");function Sse(t,e){return pu(t),mse(e),{encode(n){if(!P0(n))throw new Error("checksum.encode: input should be Uint8Array");const i=e(n).slice(0,t),s=new Uint8Array(n.length+t);return s.set(n),s.set(i,n.length),s},decode(n){if(!P0(n))throw new Error("checksum.decode: input should be Uint8Array");const i=n.slice(0,-t),s=n.slice(-t),r=e(i).slice(0,t);for(let o=0;o<t;o++)if(r[o]!==s[o])throw new Error("Invalid checksum");return i}}}a(Sse,"checksum");const Ag={alphabet:yse,chain:vse,checksum:Sse,convertRadix:lw,convertRadix2:cw,radix:_se,radix2:wse,join:bse,padding:Ese};/*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) */function mB(t){if(typeof t!="string")throw new TypeError("invalid mnemonic type: "+typeof t);return t.normalize("NFKD")}a(mB,"nfkd");function vB(t){const e=mB(t),n=e.split(" ");if(![12,15,18,21,24].includes(n.length))throw new Error("Invalid mnemonic");return{nfkd:e,words:n}}a(vB,"normalize");function Tse(t){Oi(t,16,20,24,28,32)}a(Tse,"aentropy");const Ase=a(t=>{const e=8-t.length/4;return new Uint8Array([zl(t)[0]>>e<<e])},"calcChecksum");function xse(t){if(!Array.isArray(t)||t.length!==2048||typeof t[0]!="str
107ing")throw new Error("Wordlist: expected array of 2048 strings");return t.forEach(e=>{if(typeof e!="string")throw new Error("wordlist: non-string element: "+e)}),Ag.chain(Ag.checksum(1,Ase),Ag.radix2(11,!0),Ag.alphabet(t))}a(xse,"getCoder");function Ise(t,e){const{words:n}=vB(t),i=xse(e).decode(n);return Tse(i),i}a(Ise,"mnemonicToEntropy");function Lse(t,e){try{Ise(t,e)}catch{return!1}return!0}a(Lse,"validateMnemonic");const Rse=a(t=>mB("mnemonic"+t),"psalt");function kse(t,e=""){return gse(Z_,vB(t).nfkd,Rse(e),{c:2048,dkLen:64})}a(kse,"mnemonicToSeedSync");const Mse=
vendor: 13,124 bytes, lines 107-2154
107`abandon
108ability
109able
110about
111above
112absent
113absorb
114abstract
115absurd
116abuse
117access
118accident
119account
120accuse
121achieve
122acid
123acoustic
124acquire
125across
126act
127action
128actor
129actress
130actual
131adapt
132add
133addict
134address
135adjust
136admit
137adult
138advance
139advice
140aerobic
141affair
142afford
143afraid
144again
145age
146agent
147agree
148ahead
149aim
150air
151airport
152aisle
153alarm
154album
155alcohol
156alert
157alien
158all
159alley
160allow
161almost
162alone
163alpha
164already
165also
166alter
167always
168amateur
169amazing
170among
171amount
172amused
173analyst
174anchor
175ancient
176anger
177angle
178angry
179animal
180ankle
181announce
182annual
183another
184answer
185antenna
186antique
187anxiety
188any
189apart
190apology
191appear
192apple
193approve
194april
195arch
196arctic
197area
198arena
199argue
200arm
201armed
202armor
203army
204around
205arrange
206arrest
207arrive
208arrow
209art
210artefact
211artist
212artwork
213ask
214aspect
215assault
216asset
217assist
218assume
219asthma
220athlete
221atom
222attack
223attend
224attitude
225attract
226auction
227audit
228august
229aunt
230author
231auto
232autumn
233average
234avocado
235avoid
236awake
237aware
238away
239awesome
240awful
241awkward
242axis
243baby
244bachelor
245bacon
246badge
247bag
248balance
249balcony
250ball
251bamboo
252banana
253banner
254bar
255barely
256bargain
257barrel
258base
259basic
260basket
261battle
262beach
263bean
264beauty
265because
266become
267beef
268before
269begin
270behave
271behind
272believe
273below
274belt
275bench
276benefit
277best
278betray
279better
280between
281beyond
282bicycle
283bid
284bike
285bind
286biology
287bird
288birth
289bitter
290black
291blade
292blame
293blanket
294blast
295bleak
296bless
297blind
298blood
299blossom
300blouse
301blue
302blur
303blush
304board
305boat
306body
307boil
308bomb
309bone
310bonus
311book
312boost
313border
314boring
315borrow
316boss
317bottom
318bounce
319box
320boy
321bracket
322brain
323brand
324brass
325brave
326bread
327breeze
328brick
329bridge
330brief
331bright
332bring
333brisk
334broccoli
335broken
336bronze
337broom
338brother
339brown
340brush
341bubble
342buddy
343budget
344buffalo
345build
346bulb
347bulk
348bullet
349bundle
350bunker
351burden
352burger
353burst
354bus
355business
356busy
357butter
358buyer
359buzz
360cabbage
361cabin
362cable
363cactus
364cage
365cake
366call
367calm
368camera
369camp
370can
371canal
372cancel
373candy
374cannon
375canoe
376canvas
377canyon
378capable
379capital
380captain
381car
382carbon
383card
384cargo
385carpet
386carry
387cart
388case
389cash
390casino
391castle
392casual
393cat
394catalog
395catch
396category
397cattle
398caught
399cause
400caution
401cave
402ceiling
403celery
404cement
405census
406century
407cereal
408certain
409chair
410chalk
411champion
412change
413chaos
414chapter
415charge
416chase
417chat
418cheap
419check
420cheese
421chef
422cherry
423chest
424chicken
425chief
426child
427chimney
428choice
429choose
430chronic
431chuckle
432chunk
433churn
434cigar
435cinnamon
436circle
437citizen
438city
439civil
440claim
441clap
442clarify
443claw
444clay
445clean
446clerk
447clever
448click
449client
450cliff
451climb
452clinic
453clip
454clock
455clog
456close
457cloth
458cloud
459clown
460club
461clump
462cluster
463clutch
464coach
465coast
466coconut
467code
468coffee
469coil
470coin
471collect
472color
473column
474combine
475come
476comfort
477comic
478common
479company
480concert
481conduct
482confirm
483congress
484connect
485consider
486control
487convince
488cook
489cool
490copper
491copy
492coral
493core
494corn
495correct
496cost
497cotton
498couch
499country
500couple
501course
502cousin
503cover
504coyote
505crack
506cradle
507craft
508cram
509crane
510crash
511crater
512crawl
513crazy
514cream
515credit
516creek
517crew
518cricket
519crime
520crisp
521critic
522crop
523cross
524crouch
525crowd
526crucial
527cruel
528cruise
529crumble
530crunch
531crush
532cry
533crystal
534cube
535culture
536cup
537cupboard
538curious
539current
540curtain
541curve
542cushion
543custom
544cute
545cycle
546dad
547damage
548damp
549dance
550danger
551daring
552dash
553daughter
554dawn
555day
556deal
557debate
558debris
559decade
560december
561decide
562decline
563decorate
564decrease
565deer
566defense
567define
568defy
569degree
570delay
571deliver
572demand
573demise
574denial
575dentist
576deny
577depart
578depend
579deposit
580depth
581deputy
582derive
583describe
584desert
585design
586desk
587despair
588destroy
589detail
590detect
591develop
592device
593devote
594diagram
595dial
596diamond
597diary
598dice
599diesel
600diet
601differ
602digital
603dignity
604dilemma
605dinner
606dinosaur
607direct
608dirt
609disagree
610discover
611disease
612dish
613dismiss
614disorder
615display
616distance
617divert
618divide
619divorce
620dizzy
621doctor
622document
623dog
624doll
625dolphin
626domain
627donate
628donkey
629donor
630door
631dose
632double
633dove
634draft
635dragon
636drama
637drastic
638draw
639dream
640dress
641drift
642drill
643drink
644drip
645drive
646drop
647drum
648dry
649duck
650dumb
651dune
652during
653dust
654dutch
655duty
656dwarf
657dynamic
658eager
659eagle
660early
661earn
662earth
663easily
664east
665easy
666echo
667ecology
668economy
669edge
670edit
671educate
672effort
673egg
674eight
675either
676elbow
677elder
678electric
679elegant
680element
681elephant
682elevator
683elite
684else
685embark
686embody
687embrace
688emerge
689emotion
690employ
691empower
692empty
693enable
694enact
695end
696endless
697endorse
698enemy
699energy
700enforce
701engage
702engine
703enhance
704enjoy
705enlist
706enough
707enrich
708enroll
709ensure
710enter
711entire
712entry
713envelope
714episode
715equal
716equip
717era
718erase
719erode
720erosion
721error
722erupt
723escape
724essay
725essence
726estate
727eternal
728ethics
729evidence
730evil
731evoke
732evolve
733exact
734example
735excess
736exchange
737excite
738exclude
739excuse
740execute
741exercise
742exhaust
743exhibit
744exile
745exist
746exit
747exotic
748expand
749expect
750expire
751explain
752expose
753express
754extend
755extra
756eye
757eyebrow
758fabric
759face
760faculty
761fade
762faint
763faith
764fall
765false
766fame
767family
768famous
769fan
770fancy
771fantasy
772farm
773fashion
774fat
775fatal
776father
777fatigue
778fault
779favorite
780feature
781february
782federal
783fee
784feed
785feel
786female
787fence
788festival
789fetch
790fever
791few
792fiber
793fiction
794field
795figure
796file
797film
798filter
799final
800find
801fine
802finger
803finish
804fire
805firm
806first
807fiscal
808fish
809fit
810fitness
811fix
812flag
813flame
814flash
815flat
816flavor
817flee
818flight
819flip
820float
821flock
822floor
823flower
824fluid
825flush
826fly
827foam
828focus
829fog
830foil
831fold
832follow
833food
834foot
835force
836forest
837forget
838fork
839fortune
840forum
841forward
842fossil
843foster
844found
845fox
846fragile
847frame
848frequent
849fresh
850friend
851fringe
852frog
853front
854frost
855frown
856frozen
857fruit
858fuel
859fun
860funny
861furnace
862fury
863future
864gadget
865gain
866galaxy
867gallery
868game
869gap
870garage
871garbage
872garden
873garlic
874garment
875gas
876gasp
877gate
878gather
879gauge
880gaze
881general
882genius
883genre
884gentle
885genuine
886gesture
887ghost
888giant
889gift
890giggle
891ginger
892giraffe
893girl
894give
895glad
896glance
897glare
898glass
899glide
900glimpse
901globe
902gloom
903glory
904glove
905glow
906glue
907goat
908goddess
909gold
910good
911goose
912gorilla
913gospel
914gossip
915govern
916gown
917grab
918grace
919grain
920grant
921grape
922grass
923gravity
924great
925green
926grid
927grief
928grit
929grocery
930group
931grow
932grunt
933guard
934guess
935guide
936guilt
937guitar
938gun
939gym
940habit
941hair
942half
943hammer
944hamster
945hand
946happy
947harbor
948hard
949harsh
950harvest
951hat
952have
953hawk
954hazard
955head
956health
957heart
958heavy
959hedgehog
960height
961hello
962helmet
963help
964hen
965hero
966hidden
967high
968hill
969hint
970hip
971hire
972history
973hobby
974hockey
975hold
976hole
977holiday
978hollow
979home
980honey
981hood
982hope
983horn
984horror
985horse
986hospital
987host
988hotel
989hour
990hover
991hub
992huge
993human
994humble
995humor
996hundred
997hungry
998hunt
999hurdle
1000hurry
1001hurt
1002husband
1003hybrid
1004ice
1005icon
1006idea
1007identify
1008idle
1009ignore
1010ill
1011illegal
1012illness
1013image
1014imitate
1015immense
1016immune
1017impact
1018impose
1019improve
1020impulse
1021inch
1022include
1023income
1024increase
1025index
1026indicate
1027indoor
1028industry
1029infant
1030inflict
1031inform
1032inhale
1033inherit
1034initial
1035inject
1036injury
1037inmate
1038inner
1039innocent
1040input
1041inquiry
1042insane
1043insect
1044inside
1045inspire
1046install
1047intact
1048interest
1049into
1050invest
1051invite
1052involve
1053iron
1054island
1055isolate
1056issue
1057item
1058ivory
1059jacket
1060jaguar
1061jar
1062jazz
1063jealous
1064jeans
1065jelly
1066jewel
1067job
1068join
1069joke
1070journey
1071joy
1072judge
1073juice
1074jump
1075jungle
1076junior
1077junk
1078just
1079kangaroo
1080keen
1081keep
1082ketchup
1083key
1084kick
1085kid
1086kidney
1087kind
1088kingdom
1089kiss
1090kit
1091kitchen
1092kite
1093kitten
1094kiwi
1095knee
1096knife
1097knock
1098know
1099lab
1100label
1101labor
1102ladder
1103lady
1104lake
1105lamp
1106language
1107laptop
1108large
1109later
1110latin
1111laugh
1112laundry
1113lava
1114law
1115lawn
1116lawsuit
1117layer
1118lazy
1119leader
1120leaf
1121learn
1122leave
1123lecture
1124left
1125leg
1126legal
1127legend
1128leisure
1129lemon
1130lend
1131length
1132lens
1133leopard
1134lesson
1135letter
1136level
1137liar
1138liberty
1139library
1140license
1141life
1142lift
1143light
1144like
1145limb
1146limit
1147link
1148lion
1149liquid
1150list
1151little
1152live
1153lizard
1154load
1155loan
1156lobster
1157local
1158lock
1159logic
1160lonely
1161long
1162loop
1163lottery
1164loud
1165lounge
1166love
1167loyal
1168lucky
1169luggage
1170lumber
1171lunar
1172lunch
1173luxury
1174lyrics
1175machine
1176mad
1177magic
1178magnet
1179maid
1180mail
1181main
1182major
1183make
1184mammal
1185man
1186manage
1187mandate
1188mango
1189mansion
1190manual
1191maple
1192marble
1193march
1194margin
1195marine
1196market
1197marriage
1198mask
1199mass
1200master
1201match
1202material
1203math
1204matrix
1205matter
1206maximum
1207maze
1208meadow
1209mean
1210measure
1211meat
1212mechanic
1213medal
1214media
1215melody
1216melt
1217member
1218memory
1219mention
1220menu
1221mercy
1222merge
1223merit
1224merry
1225mesh
1226message
1227metal
1228method
1229middle
1230midnight
1231milk
1232million
1233mimic
1234mind
1235minimum
1236minor
1237minute
1238miracle
1239mirror
1240misery
1241miss
1242mistake
1243mix
1244mixed
1245mixture
1246mobile
1247model
1248modify
1249mom
1250moment
1251monitor
1252monkey
1253monster
1254month
1255moon
1256moral
1257more
1258morning
1259mosquito
1260mother
1261motion
1262motor
1263mountain
1264mouse
1265move
1266movie
1267much
1268muffin
1269mule
1270multiply
1271muscle
1272museum
1273mushroom
1274music
1275must
1276mutual
1277myself
1278mystery
1279myth
1280naive
1281name
1282napkin
1283narrow
1284nasty
1285nation
1286nature
1287near
1288neck
1289need
1290negative
1291neglect
1292neither
1293nephew
1294nerve
1295nest
1296net
1297network
1298neutral
1299never
1300news
1301next
1302nice
1303night
1304noble
1305noise
1306nominee
1307noodle
1308normal
1309north
1310nose
1311notable
1312note
1313nothing
1314notice
1315novel
1316now
1317nuclear
1318number
1319nurse
1320nut
1321oak
1322obey
1323object
1324oblige
1325obscure
1326observe
1327obtain
1328obvious
1329occur
1330ocean
1331october
1332odor
1333off
1334offer
1335office
1336often
1337oil
1338okay
1339old
1340olive
1341olympic
1342omit
1343once
1344one
1345onion
1346online
1347only
1348open
1349opera
1350opinion
1351oppose
1352option
1353orange
1354orbit
1355orchard
1356order
1357ordinary
1358organ
1359orient
1360original
1361orphan
1362ostrich
1363other
1364outdoor
1365outer
1366output
1367outside
1368oval
1369oven
1370over
1371own
1372owner
1373oxygen
1374oyster
1375ozone
1376pact
1377paddle
1378page
1379pair
1380palace
1381palm
1382panda
1383panel
1384panic
1385panther
1386paper
1387parade
1388parent
1389park
1390parrot
1391party
1392pass
1393patch
1394path
1395patient
1396patrol
1397pattern
1398pause
1399pave
1400payment
1401peace
1402peanut
1403pear
1404peasant
1405pelican
1406pen
1407penalty
1408pencil
1409people
1410pepper
1411perfect
1412permit
1413person
1414pet
1415phone
1416photo
1417phrase
1418physical
1419piano
1420picnic
1421picture
1422piece
1423pig
1424pigeon
1425pill
1426pilot
1427pink
1428pioneer
1429pipe
1430pistol
1431pitch
1432pizza
1433place
1434planet
1435plastic
1436plate
1437play
1438please
1439pledge
1440pluck
1441plug
1442plunge
1443poem
1444poet
1445point
1446polar
1447pole
1448police
1449pond
1450pony
1451pool
1452popular
1453portion
1454position
1455possible
1456post
1457potato
1458pottery
1459poverty
1460powder
1461power
1462practice
1463praise
1464predict
1465prefer
1466prepare
1467present
1468pretty
1469prevent
1470price
1471pride
1472primary
1473print
1474priority
1475prison
1476private
1477prize
1478problem
1479process
1480produce
1481profit
1482program
1483project
1484promote
1485proof
1486property
1487prosper
1488protect
1489proud
1490provide
1491public
1492pudding
1493pull
1494pulp
1495pulse
1496pumpkin
1497punch
1498pupil
1499puppy
1500purchase
1501purity
1502purpose
1503purse
1504push
1505put
1506puzzle
1507pyramid
1508quality
1509quantum
1510quarter
1511question
1512quick
1513quit
1514quiz
1515quote
1516rabbit
1517raccoon
1518race
1519rack
1520radar
1521radio
1522rail
1523rain
1524raise
1525rally
1526ramp
1527ranch
1528random
1529range
1530rapid
1531rare
1532rate
1533rather
1534raven
1535raw
1536razor
1537ready
1538real
1539reason
1540rebel
1541rebuild
1542recall
1543receive
1544recipe
1545record
1546recycle
1547reduce
1548reflect
1549reform
1550refuse
1551region
1552regret
1553regular
1554reject
1555relax
1556release
1557relief
1558rely
1559remain
1560remember
1561remind
1562remove
1563render
1564renew
1565rent
1566reopen
1567repair
1568repeat
1569replace
1570report
1571require
1572rescue
1573resemble
1574resist
1575resource
1576response
1577result
1578retire
1579retreat
1580return
1581reunion
1582reveal
1583review
1584reward
1585rhythm
1586rib
1587ribbon
1588rice
1589rich
1590ride
1591ridge
1592rifle
1593right
1594rigid
1595ring
1596riot
1597ripple
1598risk
1599ritual
1600rival
1601river
1602road
1603roast
1604robot
1605robust
1606rocket
1607romance
1608roof
1609rookie
1610room
1611rose
1612rotate
1613rough
1614round
1615route
1616royal
1617rubber
1618rude
1619rug
1620rule
1621run
1622runway
1623rural
1624sad
1625saddle
1626sadness
1627safe
1628sail
1629salad
1630salmon
1631salon
1632salt
1633salute
1634same
1635sample
1636sand
1637satisfy
1638satoshi
1639sauce
1640sausage
1641save
1642say
1643scale
1644scan
1645scare
1646scatter
1647scene
1648scheme
1649school
1650science
1651scissors
1652scorpion
1653scout
1654scrap
1655screen
1656script
1657scrub
1658sea
1659search
1660season
1661seat
1662second
1663secret
1664section
1665security
1666seed
1667seek
1668segment
1669select
1670sell
1671seminar
1672senior
1673sense
1674sentence
1675series
1676service
1677session
1678settle
1679setup
1680seven
1681shadow
1682shaft
1683shallow
1684share
1685shed
1686shell
1687sheriff
1688shield
1689shift
1690shine
1691ship
1692shiver
1693shock
1694shoe
1695shoot
1696shop
1697short
1698shoulder
1699shove
1700shrimp
1701shrug
1702shuffle
1703shy
1704sibling
1705sick
1706side
1707siege
1708sight
1709sign
1710silent
1711silk
1712silly
1713silver
1714similar
1715simple
1716since
1717sing
1718siren
1719sister
1720situate
1721six
1722size
1723skate
1724sketch
1725ski
1726skill
1727skin
1728skirt
1729skull
1730slab
1731slam
1732sleep
1733slender
1734slice
1735slide
1736slight
1737slim
1738slogan
1739slot
1740slow
1741slush
1742small
1743smart
1744smile
1745smoke
1746smooth
1747snack
1748snake
1749snap
1750sniff
1751snow
1752soap
1753soccer
1754social
1755sock
1756soda
1757soft
1758solar
1759soldier
1760solid
1761solution
1762solve
1763someone
1764song
1765soon
1766sorry
1767sort
1768soul
1769sound
1770soup
1771source
1772south
1773space
1774spare
1775spatial
1776spawn
1777speak
1778special
1779speed
1780spell
1781spend
1782sphere
1783spice
1784spider
1785spike
1786spin
1787spirit
1788split
1789spoil
1790sponsor
1791spoon
1792sport
1793spot
1794spray
1795spread
1796spring
1797spy
1798square
1799squeeze
1800squirrel
1801stable
1802stadium
1803staff
1804stage
1805stairs
1806stamp
1807stand
1808start
1809state
1810stay
1811steak
1812steel
1813stem
1814step
1815stereo
1816stick
1817still
1818sting
1819stock
1820stomach
1821stone
1822stool
1823story
1824stove
1825strategy
1826street
1827strike
1828strong
1829struggle
1830student
1831stuff
1832stumble
1833style
1834subject
1835submit
1836subway
1837success
1838such
1839sudden
1840suffer
1841sugar
1842suggest
1843suit
1844summer
1845sun
1846sunny
1847sunset
1848super
1849supply
1850supreme
1851sure
1852surface
1853surge
1854surprise
1855surround
1856survey
1857suspect
1858sustain
1859swallow
1860swamp
1861swap
1862swarm
1863swear
1864sweet
1865swift
1866swim
1867swing
1868switch
1869sword
1870symbol
1871symptom
1872syrup
1873system
1874table
1875tackle
1876tag
1877tail
1878talent
1879talk
1880tank
1881tape
1882target
1883task
1884taste
1885tattoo
1886taxi
1887teach
1888team
1889tell
1890ten
1891tenant
1892tennis
1893tent
1894term
1895test
1896text
1897thank
1898that
1899theme
1900then
1901theory
1902there
1903they
1904thing
1905this
1906thought
1907three
1908thrive
1909throw
1910thumb
1911thunder
1912ticket
1913tide
1914tiger
1915tilt
1916timber
1917time
1918tiny
1919tip
1920tired
1921tissue
1922title
1923toast
1924tobacco
1925today
1926toddler
1927toe
1928together
1929toilet
1930token
1931tomato
1932tomorrow
1933tone
1934tongue
1935tonight
1936tool
1937tooth
1938top
1939topic
1940topple
1941torch
1942tornado
1943tortoise
1944toss
1945total
1946tourist
1947toward
1948tower
1949town
1950toy
1951track
1952trade
1953traffic
1954tragic
1955train
1956transfer
1957trap
1958trash
1959travel
1960tray
1961treat
1962tree
1963trend
1964trial
1965tribe
1966trick
1967trigger
1968trim
1969trip
1970trophy
1971trouble
1972truck
1973true
1974truly
1975trumpet
1976trust
1977truth
1978try
1979tube
1980tuition
1981tumble
1982tuna
1983tunnel
1984turkey
1985turn
1986turtle
1987twelve
1988twenty
1989twice
1990twin
1991twist
1992two
1993type
1994typical
1995ugly
1996umbrella
1997unable
1998unaware
1999uncle
2000uncover
2001under
2002undo
2003unfair
2004unfold
2005unhappy
2006uniform
2007unique
2008unit
2009universe
2010unknown
2011unlock
2012until
2013unusual
2014unveil
2015update
2016upgrade
2017uphold
2018upon
2019upper
2020upset
2021urban
2022urge
2023usage
2024use
2025used
2026useful
2027useless
2028usual
2029utility
2030vacant
2031vacuum
2032vague
2033valid
2034valley
2035valve
2036van
2037vanish
2038vapor
2039various
2040vast
2041vault
2042vehicle
2043velvet
2044vendor
2045venture
2046venue
2047verb
2048verify
2049version
2050very
2051vessel
2052veteran
2053viable
2054vibrant
2055vicious
2056victory
2057video
2058view
2059village
2060vintage
2061violin
2062virtual
2063virus
2064visa
2065visit
2066visual
2067vital
2068vivid
2069vocal
2070voice
2071void
2072volcano
2073volume
2074vote
2075voyage
2076wage
2077wagon
2078wait
2079walk
2080wall
2081walnut
2082want
2083warfare
2084warm
2085warrior
2086wash
2087wasp
2088waste
2089water
2090wave
2091way
2092wealth
2093weapon
2094wear
2095weasel
2096weather
2097web
2098wedding
2099weekend
2100weird
2101welcome
2102west
2103wet
2104whale
2105what
2106wheat
2107wheel
2108when
2109where
2110whip
2111whisper
2112wide
2113width
2114wife
2115wild
2116will
2117win
2118window
2119wine
2120wing
2121wink
2122winner
2123winter
2124wire
2125wisdom
2126wise
2127wish
2128witness
2129wolf
2130woman
2131wonder
2132wood
2133wool
2134word
2135work
2136world
2137worry
2138worth
2139wrap
2140wreck
2141wrestle
2142wrist
2143write
2144wrong
2145yard
2146year
2147yellow
2148you
2149young
2150youth
2151zebra
2152zero
2153zone
2154zoo`.split(
2154`
2155`);var Cse="m/129372'/0'",U0;(function(t){t[t.SECRET=0]="SECRET",t[t.BLINDING_FACTOR=1]="BLINDING_FACTOR"})(U0||(U0={}));var Pse=a(function(t){var e=kse(t);return e},"deriveSeedFromMnemonic"),Dse=a(function(t,e,n){return yB(t,e,n,U0.SECRET)},"deriveSecret"),Ose=a(function(t,e,n){return yB(t,e,n,U0.BLINDING_FACTOR)},"deriveBlindingFactor"),yB=a(function(t,e,n,i){var s=aw.fromMasterSeed(t),r=Nse(e),o="".concat(Cse,"/").concat(r,"'/").concat(n,"'/").concat(i),l=s.derive(o);if(l.privateKey===null)throw new Error("Could not derive private key");return l.privateKey},"derive"),Nse=a(function(t){var e;return/^[a-fA-F0-9]+$/.test(t)?e=Gne(t)%BigInt(Math.pow(2,31)-1):e=oA(Fne(t))%BigInt(Math.pow(2,31)-1),e},"getKeysetIdInt"),B0=globalThis&&globalThis.__assign||function(){return B0=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s])}return t},B0.apply(this,arguments)},Os=globalThis&&globalThis.__awaiter||function(t,e,n,i){function s(r){return r instanceof n?r:new n(function(o){o(r)})}return a(s,"adopt"),new(n||(n=Promise))(function(r,o){function l(u){try{c(i.next(u))}catch(f){o(f)}}a(l,"fulfilled");function d(u){try{c(i.throw(u))}catch(f){o(f)}}a(d,"rejected");function c(u){u.done?r(u.value):s(u.value).then(l,d)}a(c,"step"),c((i=i.apply(t,e||[])).next())})},Ns=globalThis&&globalThis.__generator||function(t,e){var n={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},i,s,r,o;return o={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function l(c){return function(u){return d([c,u])}}function d(c){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(n=0)),n;)try{if(i=1,s&&(r=c[0]&2?s.return:c[0]?s.throw||((r=s.return)&&r.call(s),0):s.next)&&!(r=r.call(s,c[1])).done)return r;switch(s=0,r&&(c=[c[0]&2,r.value]),c[0]){case 0:case 1:r=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,s=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(r=n.trys,!(r=r.length>0&&r[r.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!r||c[1]>r[0]&&c[1]<r[3])){n.label=c[1];break}if(c[0]===6&&n.label<r[1]){n.label=r[1],r=c;break}if(r&&n.label<r[2]){n.label=r[2],n.ops.push(c);break}r[2]&&n.ops.pop(),n.trys.pop();continue}c=e.call(t,n)}catch(u){c=[6,u],s=0}finally{i=r=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},Gi=globalThis&&globalThis.__spreadArray||function(t,e,n){if(n||arguments.length===2)for(var i=0,s=e.length,r;i<s;i++)(r||!(i in e))&&(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))};(function(){function t(e,n,i){if(this._keysetId="",this._keys=n||{},this.mint=e,n&&(this._keysetId=Eg(this._keys)),!!i){if(i instanceof Uint8Array){this._seed=i;return}if(!Lse(i,Mse))throw new Error("Tried to instantiate with mnemonic, but mnemonic was invalid");this._seed=Pse(i)}}return a(t,"CashuWallet"),Object.defineProperty(t.prototype,"keys",{get:function(){return this._keys},set:function(e){this._keys=e,this._keysetId=Eg(this._keys)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"keysetId",{get:function(){return this._keysetId},enumerable:!1,configurable:!0}),t.prototype.checkProofsSpent=function(e){return Os(this,void 0,void 0,function(){var n,i;return Ns(this,function(s){switch(s.label){case 0:return n={proofs:e.map(function(r){return{secret:r.secret}})},[4,this.mint.check(n)];case 1:return i=s.sent().spendable,[2,e.filter(function(r,o){return!i[o]})]}})})},t.prototype.requestMint=function(e){return this.mint.requestMint(e)},t.prototype.payLnInvoice=function(e,n,i,s){var r;return Os(this,void 0,void 0,function(){var o,l,d,c,u,f,h,p,g,v,y;return Ns(this,function(b){switch(b.label){case 0:return o=this.createPaymentPayload(e,n),i?[3,2]:[4,this.getFee(e)];case 1:i=b.sent(),b.label=2;case 2:return l=this.createBlankOutputs(i,s),d=l.blindedMessages,c=l.secrets,u=l.rs,[4,this.mint.melt(B0(B0({},o),{outputs:d}))];case 3:return f=b.sent(),y={isPaid:(r=f.paid)!==null&&r!==void 0?r:!1,preimage:f.preimage},f?.change?(g=(p=Ou).constructProofs,v=[f.change,u,c],[4,this.getKeys(f.change)]):[3,5];case 4:return h=g.apply(p,v.concat([b.sent()])),[3,6];case 5:h=[],b.label=6;case 6:return y.change=h,[4,this.changedKeys(f?.change)];case 7:return[2,(y.newKeys=b.sent(),y)]}})})},t.prototype.getFee=function(e){return Os(this,void 0,void 0,function(){var n;return Ns(this,function(i){switch(i.label){case 0:return[4,this.mint.checkFees({pr:e})];case 1:return n=i.sent().fee,[2,n]}})})},t.prototype.createPaymentPayload=function(e,n){return{pr:e,proofs:n}},t.prototype.payLnInvoiceWithToken=function(e,n,i){var s=this,r=LM(n),o=r.token.filter(function(l){return l.mint===s.mint.mintUrl}).flatMap(function(l){return l.proofs});return this.payLnInvoice(e,o,void 0,i)},t.prototype.receive=function(e,n,i){var s;return Os(this,void 0,void 0,function(){var r,o,l,d,c,u,f,h,p,g,v,y;return Ns(this,function(b){switch(b.label){case 0:typeof e=="string"?r=fie(LM(e)).token:r=e.token,o=[],l=[],c=0,u=r,b.label=1;case 1:if(!(c<u.length))return[3,6];if(f=u[c],!(!((s=f?.proofs)===null||s===void 0)&&s.length))return[3,5];b.label=2;case 2:return b.trys.push([2,4,,5]),[4,this.receiveTokenEntry(f,n,i)];case 3:return h=b.sent(),p=h.proofsWithError,g=h.proofs,v=h.newKeys,p?.length?(l.push(f),[3,5]):(o.push({mint:f.mint,proofs:Gi([],g,!0)}),d||(d=v),[3,5]);case 4:return y=b.sent(),console.error(y),l.push(f),[3,5];case 5:return c++,[3,1];case 6:return[2,{token:{token:o},tokensWithErrors:l.length?{token:l}:void 0,newKeys:d}]}})})},t.prototype.receiveTokenEntry=function(e,n,i){return Os(this,void 0,void 0,function(){var s,r,o,l,d,c,u,f,h,p,g,v,y,b,E;return Ns(this,function(T){switch(T.label){case 0:s=[],r=[],T.label=1;case 1:return T.trys.push([1,7,,8]),l=e.proofs.reduce(function(I,M){return I+M.amount},0),n||(n=cie(l)),d=this.createSplitPayload(l,e.proofs,n,i),c=d.payload,u=d.blindedMessages,[4,Q_.split(e.mint,c)];case 2:return f=T.sent(),h=f.promises,f.error,v=(g=Ou).constructProofs,y=[h,u.rs,u.secrets],[4,this.getKeys(h,e.mint)];case 3:return p=v.apply(g,y.concat([T.sent()])),r.push.apply(r,p),e.mint!==this.mint.mintUrl?[3,5]:[4,this.changedKeys(Gi([],h||[],!0))];case 4:return b=T.sent(),[3,6];case 5:b=void 0,T.label=6;case 6:return o=b,[3,8];case 7:return E=T.sent(),console.error(E),s.push.apply(s,e.proofs),[3,8];case 8:return[2,{proofs:r,proofsWithError:s.length?s:void 0,newKeys:o}]}})})},t.prototype.send=function(e,n,i,s){return Os(this,void 0,void 0,function(){var r,o,l,d,c,u,f,h,p,g,v,y,b,E,T,I,M,H;return Ns(this,function(N){switch(N.label){case 0:if(i&&(e=i?.reduce(function($,F){return $+F.amount*F.count}
2155,0)),r=0,o=[],l=[],n.forEach(function($){if(r>=e){l.push($);return}r=r+$.amount,o.push($)}),e>r)throw new Error("Not enough funds available");return e<r||i?(d=this.splitReceive(e,r),c=d.amountKeep,u=d.amountSend,f=this.createSplitPayload(u,o,i,s),h=f.payload,p=f.blindedMessages,[4,this.mint.split(h)]):[3,4];case 1:return g=N.sent().promises,b=(y=Ou).constructProofs,E=[g,p.rs,p.secrets],[4,this.getKeys(g)];case 2:return v=b.apply(y,E.concat([N.sent()])),T=[],I=[],M=0,v.forEach(function($){if(M<c){M+=$.amount,T.push($);return}I.push($)}),H={returnChange:Gi(Gi([],T,!0),l,!0),send:I},[4,this.changedKeys(Gi([],g||[],!0))];case 3:return[2,(H.newKeys=N.sent(),H)];case 4:return[2,{returnChange:l,send:o}]}})})},t.prototype.requestTokens=function(e,n,i,s){return Os(this,void 0,void 0,function(){var r,o,l,d,c,u,f,h,p,g;return Ns(this,function(v){switch(v.label){case 0:return r=this.createRandomBlindedMessages(e,i,s),o=r.blindedMessages,l=r.secrets,d=r.rs,c={outputs:o},[4,this.mint.mint(c,n)];case 1:return u=v.sent().promises,g={},h=(f=Ou).constructProofs,p=[u,d,l],[4,this.getKeys(u)];case 2:return g.proofs=h.apply(f,p.concat([v.sent()])),[4,this.changedKeys(u)];case 3:return[2,(g.newKeys=v.sent(),g)]}})})},t.prototype.restore=function(e,n,i){return Os(this,void 0,void 0,function(){var s,r,o,l,d,c,u,f,h,p,g,v,y,b;return Ns(this,function(E){switch(E.label){case 0:if(!this._seed)throw new Error("CashuWallet must be initialized with mnemonic to use restore");return s=Array(n).fill(0),r=this.createBlindedMessages(s,e,i),o=r.blindedMessages,l=r.rs,d=r.secrets,[4,this.mint.restore({outputs:o})];case 1:return c=E.sent(),u=c.outputs,f=c.promises,h=l.filter(function(T,I){return u.map(function(M){return M.B_}).includes(o[I].B_)}),p=d.filter(function(T,I){return u.map(function(M){return M.B_}).includes(o[I].B_)}),b={},v=(g=Ou).constructProofs,y=[f,h,p],[4,this.getKeys(f)];case 2:return b.proofs=v.apply(g,y.concat([E.sent()])),[4,this.changedKeys(f)];case 3:return[2,(b.newKeys=E.sent(),b)]}})})},t.prototype.initKeys=function(){return Os(this,void 0,void 0,function(){var e;return Ns(this,function(n){switch(n.label){case 0:return!this.keysetId||!Object.keys(this.keys).length?(e=this,[4,this.mint.getKeys()]):[3,2];case 1:e.keys=n.sent(),this._keysetId=Eg(this.keys),n.label=2;case 2:return[2]}})})},t.prototype.changedKeys=function(e){return e===void 0&&(e=[]),Os(this,void 0,void 0,function(){var n,i,s=this;return Ns(this,function(r){switch(r.label){case 0:return[4,this.initKeys()];case 1:return r.sent(),e?.length?e.some(function(o){return o.id!==s.keysetId})?[4,this.mint.getKeys()]:[2,void 0]:[2,void 0];case 2:return n=r.sent(),i=Eg(n),[2,i===this.keysetId?void 0:n]}})})},t.prototype.getKeys=function(e,n){var i;return Os(this,void 0,void 0,function(){var s,r,o;return Ns(this,function(l){switch(l.label){case 0:return[4,this.initKeys()];case 1:return l.sent(),!e?.length||!(!((i=e[0])===null||i===void 0)&&i.id)?[2,this.keys]:(s=e[0].id,this.keysetId===s?[2,this.keys]:!n||n===this.mint.mintUrl?[4,this.mint.getKeys(e[0].id)]:[3,3]);case 2:return o=l.sent(),[3,5];case 3:return[4,Q_.getKeys(n,e[0].id)];case 4:o=l.sent(),l.label=5;case 5:return r=o,[2,r]}})})},t.prototype.createSplitPayload=function(e,n,i,s){var r=n.reduce(function(u,f){return u+f.amount},0),o=this.createRandomBlindedMessages(r-e,void 0,s);this._seed&&s&&(s=s+o.secrets.length);var l=this.createRandomBlindedMessages(e,i,s),d={blindedMessages:Gi(Gi([],o.blindedMessages,!0),l.blindedMessages,!0),secrets:Gi(Gi([],o.secrets,!0),l.secrets,!0),rs:Gi(Gi([],o.rs,!0),l.rs,!0),amounts:Gi(Gi([],o.amounts,!0),l.amounts,!0)},c={proofs:n,outputs:Gi([],d.blindedMessages,!0)};return{payload:c,blindedMessages:d}},t.prototype.splitReceive=function(e,n){var i=n-e,s=e;return{amountKeep:i,amountSend:s}},t.prototype.createRandomBlindedMessages=function(e,n,i){var s=PU(e,n);return this.createBlindedMessages(s,i)},t.prototype.createBlindedMessages=function(e,n,i){if(n!=null&&!this._seed)throw new Error("Cannot create deterministic messages without seed. Instantiate CashuWallet with a mnemonic, or omit counter param.");for(var s=[],r=[],o=[],l=0;l<e.length;l++){var d=void 0,c=void 0;this._seed&&n!=null?(c=Dse(this._seed,i??this.keysetId,n+l),d=oA(Ose(this._seed,i??this.keysetId,n+l))):c=Cp(32),r.push(c);var u=iB(c,d),f=u.B_,h=u.r;o.push(h);var p=new Kie(e[l],f);s.push(p.getSerializedBlindedMessage())}return{blindedMessages:s,secrets:r,rs:o,amounts:e}},t.prototype.createBlankOutputs=function(e,n){var i=Math.ceil(Math.log2(e))||1;i<0&&(i=0);var s=i?Array(i).fill(1):[],r=this.createBlindedMessages(s,n),o=r.blindedMessages,l=r.rs,d=r.secrets;return{blindedMessages:o,secrets:d,rs:l}},t})();const Fse={events:{},isInactive:!1,appState:"woke",showReactionsModal:void 0,reactionStats:{likes:0,zaps:0,reposts:0,quotes:0,openOn:"default"},showVotesModal:void 0,votesModalConfig:void 0,showCustomZapModal:!1,customZap:void 0,showZapVoteModal:!1,voteZap:void 0,showNoteContextMenu:!1,noteContextMenuInfo:void 0,showArticleOverviewContextMenu:!1,articleOverviewContextMenuInfo:void 0,showArticleDraftContextMenu:!1,articleDraftContextMenuInfo:void 0,showStreamContextMenu:!1,showNoteVideoContextMenu:!1,streamContextMenuInfo:void 0,noteVideoContextMenuInfo:void 0,showLnInvoiceModal:!1,lnbc:void 0,showCashuInvoiceModal:!1,cashu:void 0,showConfirmModal:!1,confirmInfo:void 0,cashuMints:new Map,subscribeToAuthor:void 0,verifiedUsers:{},legendCustomization:{},memberCohortInfo:{},subscribeToTier:()=>{},showProfileQr:void 0,reportContent:void 0,signer:void 0},bB=Pn(),Use=a(t=>{let e=0;const n=a(()=>{clearTimeout(e),ge.isInactive&&ie("isInactive",()=>!1),e=setTimeout(()=>{ie("isInactive",()=>!0)},5*6e4)},"monitorActivity"),i=a((j,Y)=>{ie("reactionStats",()=>({...Y})),ie("showReactionsModal",()=>j)},"openReactionModal"),s=a(()=>{ie("reactionStats",()=>({likes:0,zaps:0,reposts:0,quotes:0})),ie("showReactionsModal",()=>{})},"closeReactionModal"),r=a((j,Y)=>{ie("votesModalConfig",()=>({...Y})),ie("showVotesModal",()=>({...j}))},"openVotesModal"),o=a(()=>{ie("showVotesModal",()=>{}),ie("votesModalConfig",()=>{})},"closeVotesModal"),l=a(j=>{ie("customZap",()=>({...j})),ie("showCustomZapModal",()=>!0)},"openCustomZapModal"),d=a(()=>{ie("showCustomZapModal",()=>!1)},"closeCustomZapModal"),c=a(()=>{ie("customZap",()=>{})},"resetCustomZap"),u=a(j=>{ie("voteZap",()=>({...j})),ie("showZapVoteModal",()=>!0)}
2155,"openVoteZapModal"),f=a(()=>{ie("showZapVoteModal",()=>!1)},"closeVoteZapModal"),h=a(()=>{ie("voteZap",()=>{})},"resetVoteZap"),p=a((j,Y,le,pe,Te)=>{ie("noteContextMenuInfo",Si({note:j,position:Y,openCustomZap:le,openReactions:pe,onDelete:Te})),ie("showNoteContextMenu",()=>!0)},"openContextMenu"),g=a((j,Y,le,pe)=>{ie("streamContextMenuInfo",Si({stream:j,streamAuthor:Y,position:le,onDelete:pe})),ie("showStreamContextMenu",()=>!0)},"openStreamContextMenu"),v=a((j,Y,le)=>{ie("noteVideoContextMenuInfo",Si({src:j,position:Y,onDownload:le})),ie("showNoteVideoContextMenu",()=>!0)},"openNoteVideoContextMenu"),y=a((j,Y,le,pe,Te)=>{ie("articleOverviewContextMenuInfo",Si({note:j,position:Y,openCustomZap:le,openReactions:pe,onDelete:Te})),ie("showArticleOverviewContextMenu",()=>!0)},"openArticleOverviewContextMenu"),b=a((j,Y,le,pe,Te)=>{ie("articleDraftContextMenuInfo",Si({note:j,position:Y,openCustomZap:le,openReactions:pe,onDelete:Te})),ie("showArticleDraftContextMenu",()=>!0)},"openArticleDraftContextMenu"),E=a((j,Y)=>{ie("showLnInvoiceModal",()=>!0),ie("lnbc",()=>({invoice:j,onPay:Y,onCancel:()=>ie("showLnInvoiceModal",()=>!1)}))},"openLnbcModal"),T=a(()=>{ie("showLnInvoiceModal",()=>!1),ie("lnbc",()=>{})},"closeLnbcModal"),I=a((j,Y)=>{ie("showCashuInvoiceModal",()=>!0),ie("cashu",()=>({invoice:j,onPay:Y,onCancel:()=>ie("showCashuInvoiceModal",()=>!1)}))},"openCashuModal"),M=a(()=>{ie("showCashuInvoiceModal",()=>!1),ie("cashu",()=>{})},"closeCashuModal"),H=a(j=>{ie("showConfirmModal",()=>!0),ie("confirmInfo",()=>({...j}))},"openConfirmModal"),N=a(()=>{ie("showConfirmModal",()=>!1),ie("confirmInfo",()=>{})},"closeConfirmModal"),$=a(()=>{ie("showNoteContextMenu",()=>!1)},"closeContextMenu"),F=a(()=>{ie("showStreamContextMenu",()=>!1)},"closeStreamContextMenu"),D=a(()=>{ie("showNoteVideoContextMenu",()=>!1)},"closeNoteVideoContextMenu"),L=a(()=>{ie("showArticleOverviewContextMenu",()=>!1)},"closeArticleOverviewContextMenu"),m=a(()=>{ie("showArticleDraftContextMenu",()=>!1)},"closeArticleDraftContextMenu"),S=a(j=>{const Y=new URL(j).toString();if(!ge.cashuMints.has(Y)){const le=new Q_(Y);ge.cashuMints.set(Y,le)}return ge.cashuMints.get(Y)},"getCashuMint"),_=a((j,Y)=>{j&&(ie("subscribeToAuthor",()=>({...j})),ie("subscribeToTier",()=>Y))},"openAuthorSubscribeModal"),A=a(()=>{ie("subscribeToAuthor",()=>{})},"closeAuthorSubscribeModal"),x=a((j,Y)=>{if(!j)return"/home";let le=`${j}`;le.startsWith("npub")&&(le=Ce.decode(le).data);const pe=ge.verifiedUsers[le];if(pe)return`/${pe}`;try{const Te=Ce.nprofileEncode({pubkey:le});return`/${Y?"":"p/"}${Te}`}catch{return`/${Y?"":"p/"}${le}`}},"profileLink"),C=a((j,Y)=>{ie("legendCustomization",()=>({[j]:{...Y}})),kk(j,Y)},"setLegendCustomization"),U=a(j=>{const Y=(ge.events[G.Blossom]||[]).find(le=>le.pubkey===j);return!Y||!Y.tags?[]:Y.tags.reduce((le,pe)=>pe[0]==="server"?[...le,pe[1]]:le,[])},"getUserBlossomUrls"),R=a(j=>{ie("showProfileQr",()=>({...j}))},"openProfileQr"),w=a(()=>{ie("showProfileQr",()=>{})},"closeProfileQr"),P=a(j=>{ie("reportContent",()=>({...j}))},"openReportContent"),V=a(()=>{ie("reportContent",()=>{})},"closeReportContent"),Z=a((j,Y)=>{if(j.kind===G.VerifiedUsersDict){const pe=JSON.parse(j.content);ie("verifiedUsers",Te=>({...Te,...pe}))}if(j.kind===G.LegendCustomization){const pe=JSON.parse(j.content);ie("legendCustomization",Te=>({...Te,...pe}))}if(j.kind===G.MembershipCohortInfo){const pe=JSON.parse(j.content);ie("memberCohortInfo",Te=>({...Te,...pe}))}const le=ge.events[j.kind]||[];j.kind===G.Mentions&&(j={...JSON.parse(j.content)}),le.length===0?ie("events",j.kind,()=>[{...j}]):le.find(pe=>pe.id===j.id)||ie("events",j.kind,le.length,()=>({...j}))},"handleVerifiedUsersEvent"),ee=a(async j=>{const Y=await su(j),le=JSON.parse(Y),[pe,Te,Le]=le;if(pe==="EVENTS")for(let De=0;De<Le.length;De++){const _e=Le[De];Z(_e)}pe==="EVENT"&&Z(Le)},"onMessage"),ne=a(j=>{const Y=j.target;Da(Y,{message:ee,close:ne})},"onSocketClose");Or(()=>{document.addEventListener("mousemove",n),document.addEventListener("scroll",n),document.addEventListener("keydown",n)}),Or(()=>{ute()}),Tt(()=>{document.removeEventListener("mousemove",n),document.removeEventListener("scroll",n),document.removeEventListener("keydown",n)}),We(()=>{const j=ge.legendCustomization,Y=z.publicKey;!Y||!j||!j[Y]||kk(Y,j[Y])}),We(()=>{if(Ma()){const j=z.publicKey,Y=Cq(j);if(!j||!Y)return;ie("legendCustomization",()=>({[j]:{...Y}}))}});let se=0;We(()=>{ge.isInactive?(ie("appState","sleep"),clearTimeout(se)):(ie("appState","waking"),se=setTimeout(()=>{ie("appState","woke")},36e3))}),We(oi(()=>ge.appState,(j,Y)=>{if(j!==Y){if(j==="sleep"){xi("Disconnected from Primal socket due to inactivity at: ",new Date().toLocaleTimeString()),LT(!1),KF();return}if(j==="waking"&&yn()?.readyState===WebSocket.CLOSED){xi("Reconnected to Primal socket at: ",new Date().toLocaleTimeString()),Zv(),qF();return}}})),We(()=>{Pa()&&Qv(yn(),{message:ee,close:ne})}),Tt(()=>{Da(yn(),{message:ee,close:ne})});const[ge,ie]=li({...Fse,actions:{openReactionModal:i,closeReactionModal:s,openVotesModal:r,closeVotesModal:o,openCustomZapModal:l,closeCustomZapModal:d,resetCustomZap:c,openVoteZapMo
2155dal:u,closeVoteZapModal:f,resetVoteZap:h,openContextMenu:p,closeContextMenu:$,openStreamContextMenu:g,closeStreamContextMenu:F,openNoteVideoContextMenu:v,closeNoteVideoContextMenu:D,openArticleOverviewContextMenu:y,closeArticleOverviewContextMenu:L,openArticleDraftContextMenu:b,closeArticleDraftContextMenu:m,openLnbcModal:E,closeLnbcModal:T,openConfirmModal:H,closeConfirmModal:N,openCashuModal:I,closeCashuModal:M,getCashuMint:S,openAuthorSubscribeModal:_,closeAuthorSubscribeModal:A,profileLink:x,setLegendCustomization:C,getUserBlossomUrls:U,openProfileQr:R,closeProfileQr:w,openReportContent:P,closeReportContent:V}});return X(bB.Provider,{value:ge,get children(){return t.children}})},"AppProvider"),gu=a(()=>Dn(bB),"useAppContext"),cm="/assets/default_avatar-6d041539.svg",__e=Object.freeze(Object.defineProperty({__proto__:null,default:cm},Symbol.toStringTag,{value:"Module"})),Bse="_noteImage_d7kz0_1",$se="_shortHeight_d7kz0_7",Hse="_placeholderImage_d7kz0_11",Gse="_imageHolder_d7kz0_21",Vse="_noteImageHolder_d7kz0_27",Wse="_seeMore_d7kz0_31",zse="_hidden_d7kz0_47",Sc={noteImage:Bse,shortHeight:$se,placeholderImage:Hse,imageHolder:Gse,noteImageHolder:Vse,seeMore:Wse,hidden:zse};var Kse=It("<a target=_blank><div><div>+</div></div><img><div class=pswp-caption-content>"),qse=It("<div>");const jse=a(t=>{const e=gu(),n=Ks();let i,s;const[r,o]=Je(!1),[l,d]=Je(!1),[c,u]=Je(),f=a(()=>!t.isDev||t.media,"isCached"),h=3;let p=0;const g=a($=>{const F=$.target;return F&&(F.onerror=""),d(!0),o(!1),t.onError&&t.onError($),!0},"giveUp"),v=a(async $=>{const F=$.target;if(p++,p>h||t.altSrc&&(F.src===t.altSrc||F.src.endsWith(t.altSrc)))return g($);const D=e?.actions.getUserBlossomUrls(t.authorPk||"")||[],L=F.src||"",m=L.slice(L.lastIndexOf("/")+1),S=D.map(_=>new Promise((A,x)=>{const C=_.endsWith("/")?"":"/",U=`${_}${C}${m}`;fetch(U,{method:"HEAD"}).then(R=>{R.status===200?A(U):x("")}).catch(R=>{x("")})}));try{const _=await Promise.any(S);if(_.length>0)return u(()=>_),F.onerror="",F.src=_,o(!0),!0}catch{return t.altSrc?(F.onerror="",F.src=t.altSrc,u(()=>t.altSrc||""),o(!0),!0):g($)}},"onError"),y=a(()=>{const $=t.media;return $?$.w/$.h:i?i.width/i.height:2},"ratio"),b=a(()=>t.width||538,"width"),E=a(()=>{if(t.forceHeight)return`${t.forceHeight}px`;if(t.isGallery)return"250px";if(!t.media||t.ignoreRatio)return"100%";const $=t.media;return!$||y()<=.8?"680px":!$||y()<=1.2?"auto":`${b()/y()}px`},"height"),T=a(()=>y()>1?window.innerWidth:window.innerHeight*y(),"zoomW"),I=a(()=>y()>1?window.innerWidth/y():window.innerHeight,"zoomH"),M=a(()=>b()/y()>680,"willBeTooBig"),H=a(()=>t.mediaThumb?typeof t.mediaThumb=="string"?t.mediaThumb:t.mediaThumb.media_url:c(),"thumbSrc"),N=a(()=>`${Sc.noteImage} ${t.shortHeight?Sc.shortHeight:""} ${f()?"":"redBorder"}`,"klass");return Or(()=>{t.media&&o(!0),u(()=>t.media?.media_url||t.src)}),We(()=>{i=new Image,i.src=c()||"",i.onload=()=>{o(!0)},i.onerror=v}),We(()=>{r()&&t.onImageLoaded&&t.onImageLoaded(c())}),X(sn,{get when(){return ps(()=>!l())()&&(t.noPlaceholders||r())},get fallback(){return(()=>{var $=qse();return ze(()=>xe($,Sc.placeholderImage)),$})()},get children(){var $=Kse(),F=$.firstChild,D=F.firstChild;D.firstChild;var L=F.nextSibling,m=L.nextSibling;$.$$click=_=>{_.preventDefault(),_.stopPropagation(),console.log("CLICK IMAGE")},Ct($,"data-cropped",!0),Fe(D,()=>t.seeMore||"0",null),L.addEventListener("error",v);var S=s;return typeof S=="function"?Ld(S,L):s=L,Ct(L,"id",`${n}`),Fe(m,()=>t.caption),ze(_=>{var A=`${Sc.noteImageHolder} ${t.class||""} ${t.plainBorder?"":"roundedImage"}`,x=c(),C=T(),U=I(),R=t.imageGroup,w=H(),P=y(),V=t.seeMore?Sc.seeMore:Sc.hidden,Z=H(),ee=N(),ne=`${M()&&!t.ignoreRatio?"width: 528px; height: 680px":`width: ${b()}px; height: ${E()}`}`;return A!==_.e&&xe($,_.e=A),x!==_.t&&Ct($,"href",_.t=x),C!==_.a&&Ct($,"data-pswp-width",_.a=C),U!==_.o&&Ct($,"data-pswp-height",_.o=U),R!==_.i&&Ct($,"data-image-group",_.i=R),w!==_.n&&Ct($,"data-thumb-src",_.n=w),P!==_.s&&Ct($,"data-ratio",_.s=P),V!==_.h&&xe(F,_.h=V),Z!==_.r&&Ct(L,"src",_.r=Z),ee!==_.d&&xe(L,_.d=ee),_.l=tD(L,ne,_.l),_},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0,l:void 0}),$}})},"NoteImage");Kv(["click"]);const Yse="_verifiedIcon_1wc0e_1",Zse="_verificationIcon_1wc0e_10",Qse="_inline_1wc0e_19",Jse="_verificationIconL_1wc0e_23",Xse="_verifiedIconPrimal_1wc0e_36",ere="_checkIcon_1wc0e_46",tre="_legend_GOLD_1wc0e_53",nre="_legend_AQUA_1wc0e_56",ire="_legend_SILVER_1wc0e_59",sre="_legend_PURPLE_1wc0e_62",rre="_legend_PURPLEHAZE_1wc0e_65",ore="_legend_TEAL_1wc0e_68",are="_legend_BROWN_1wc0e_71",lre="_legend_BLUE_1wc0e_74",cre="_legend_SUNFIRE_1wc0e_77",dre="_whiteCheck_1wc0e_81",ure="_whiteCheckL_1wc0e_92",fre="_verificationFailed_1wc0e_103",ar={verifiedIcon:Yse,verificationIcon:Zse,inline:Qse,verificationIconL:Jse,verifiedIconPrimal:Xse,checkIcon:ere,legend_GOLD:tre,legend_AQUA:nre,legend_SILVER:ire,legend_PURPLE:sre,legend_PURPLEHAZE:rre,legend_TEAL:ore,legend_BROWN:are,legend_BLUE:lre,legend_SUNFIRE:cre,whiteCheck:dre,whiteCheckL:ure,verificationFailed:fre};var hre=It("<div><div>"),pre=It("<div>"),gre=It("<div><div><div>"),mre=It("<span>");const vre=a(t=>{const e=gu(),[n,i]=Je(!1),s=a(()=>{const c=t.user?.nip05;return n()&&c&&c.endsWith&&c.endsWith("primal.net")},"isVerifiedByPrimal"),r=a(()=>{const c=t.user?.nip05;if(!c){i(!1);return}Gq(c).then(u=>{if(u){i(()=>u.pubkey===t.user?.pubkey);return}i(()=>!1)})},"checkVerification"),o=a(()=>{const c=t.user?.pubkey;if(c)return t.legendConfig||e?.legendCustomization[c]},"legendConfig"),l=a(()=>{let c=ar.verifiedIconPrimal;const u=o();if(u?.custom_badge){const f=u.style;f!==""&&(c+=` ${ar[`legend_${f}`]}`)}return c},"primalCheckKlass"),d=a(()=>o()!==void 0,"isLegend");return Or(()=>{r()}),X(Qm,{get fallback(){return t.fallback}
2155,get children(){return[X(_a,{get when(){return n()||d()},get children(){var c=pre();return Fe(c,X(sn,{get when(){return s()||d()},get fallback(){return(()=>{var u=mre();return ze(()=>xe(u,ar.verifiedIcon)),u})()},get children(){var u=hre(),f=u.firstChild;return ze(h=>{var p=l(),g=ar.checkIcon;return p!==h.e&&xe(u,h.e=p),g!==h.t&&xe(f,h.t=g),h},{e:void 0,t:void 0}),u}})),ze(u=>{var f=t.id,h=t.user?.pubkey,p=`${t.large?ar.verificationIconL:ar.verificationIcon} ${t.inline?ar.inline:""}`;return f!==u.e&&Ct(c,"id",u.e=f),h!==u.t&&Ct(c,"data-user",u.t=h),p!==u.a&&xe(c,u.a=p),u},{e:void 0,t:void 0,a:void 0}),c}}),X(_a,{get when(){return t.mock},get children(){var c=gre(),u=c.firstChild,f=u.firstChild;return ze(h=>{var p=t.id,g=t.user?.pubkey,v=`${t.large?ar.verificationIconL:ar.verificationIcon}`,y=l(),b=ar.checkIcon;return p!==h.e&&Ct(c,"id",h.e=p),g!==h.t&&Ct(c,"data-user",h.t=g),v!==h.a&&xe(c,h.a=v),y!==h.o&&xe(u,h.o=y),b!==h.i&&xe(f,h.i=b),h},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),c}})]}})},"VerificationCheck"),yre=Ys(vre),bre="_legend_GOLD_1i93d_1",Ere="_legend_AQUA_1i93d_7",_re="_legend_SILVER_1i93d_13",wre="_legend_PURPLE_1i93d_19",Sre="_legend_PURPLEHAZE_1i93d_25",Tre="_legend_TEAL_1i93d_31",Are="_legend_BROWN_1i93d_37",xre="_legend_BLUE_1i93d_43",Ire="_legend_SUNFIRE_1i93d_49",Lre="_legend_WHITE_1i93d_55",Rre="_legend_glow_GOLD_1i93d_61",kre="_legend_glow_AQUA_1i93d_65",Mre="_legend_glow_SILVER_1i93d_69",Cre="_legend_glow_PURPLE_1i93d_73",Pre="_legend_glow_PURPLEHAZE_1i93d_77",Dre="_legend_glow_TEAL_1i93d_81",Ore="_legend_glow_BROWN_1i93d_85",Nre="_legend_glow_BLUE_1i93d_89",Fre="_legend_glow_SUNFIRE_1i93d_93",Ure="_verifiedIcon_1i93d_97",Bre="_nanoAvatar_1i93d_110",$re="_centerBottom_1i93d_125",Hre="_liveBadge_1i93d_134",Gre="_liveDot_1i93d_146",Vre="_caption_1i93d_155",Wre="_missingBack_1i93d_161",zre="_iconBackground_1i93d_165",Kre="_legend_1i93d_1",qre="_microAvatar_1i93d_187",jre="_xxsAvatar_1i93d_265",Yre="_xssAvatar_1i93d_343",Zre="_xsAvatar_1i93d_422",Qre="_s30Avatar_1i93d_510",Jre="_vvsAvatar_1i93d_598",Xre="_s38Avatar_1i93d_686",eoe="_vs2Avatar_1i93d_769",toe="_vsAvatar_1i93d_855",noe="_smallAvatar_1i93d_941",ioe="_s50Avatar_1i93d_1027",soe="_midAvatar_1i93d_1113",roe="_mlAvatar_1i93d_1199",ooe="_mllAvatar_1i93d_1284",aoe="_largeAvatar_1i93d_1369",loe="_extraLargeAvatar_1i93d_1456",coe="_borderRing_1i93d_1531",doe="_xxlAvatar_1i93d_1535",uoe="_xxxlAvatar_1i93d_1614",foe="_nanoMissing_1i93d_1698",hoe="_microMissing_1i93d_1715",poe="_xxsMissing_1i93d_1732",goe="_xssMissing_1i93d_1749",moe="_xsMissing_1i93d_1766",voe="_vvsMissing_1i93d_1783",yoe="_s38Missing_1i93d_1800",boe="_vs2Missing_1i93d_1817",Eoe="_vsMissing_1i93d_1834",_oe="_smallMissing_1i93d_1851",woe="_midMissing_1i93d_1868",Soe="_mlMissing_1i93d_1885",Toe="_mllMissing_1i93d_1902",Aoe="_largeMissing_1i93d_1919",xoe="_extraLargeMissing_1i93d_1936",Ioe="_xxlMissing_1i93d_1953",Loe="_xxxlMissing_1i93d_1970",Roe="_highlightBorder_1i93d_1987",koe="_cacheFlag_1i93d_1991",Ke={legend_GOLD:bre,legend_AQUA:Ere,legend_SILVER:_re,legend_PURPLE:wre,legend_PURPLEHAZE:Sre,legend_TEAL:Tre,legend_BROWN:Are,legend_BLUE:xre,legend_SUNFIRE:Ire,legend_WHITE:Lre,legend_glow_GOLD:Rre,legend_glow_AQUA:kre,legend_glow_SILVER:Mre,legend_glow_PURPLE:Cre,legend_glow_PURPLEHAZE:Pre,legend_glow_TEAL:Dre,legend_glow_BROWN:Ore,legend_glow_BLUE:Nre,legend_glow_SUNFIRE:Fre,verifiedIcon:Ure,nanoAvatar:Bre,centerBottom:$re,liveBadge:Hre,liveDot:Gre,caption:Vre,missingBack:Wre,iconBackground:zre,legend:Kre,microAvatar:qre,xxsAvatar:jre,xssAvatar:Yre,xsAvatar:Zre,s30Avatar:Qre,vvsAvatar:Jre,s38Avatar:Xre,vs2Avatar:eoe,vsAvatar:toe,smallAvatar:noe,s50Avatar:ioe,midAvatar:soe,mlAvatar:roe,mllAvatar:ooe,largeAvatar:aoe,extraLargeAvatar:loe,borderRing:coe,xxlAvatar:doe,xxxlAvatar:uoe,nanoMissing:foe,microMissing:hoe,xxsMissing:poe,xssMissing:goe,xsMissing:moe,vvsMissing:voe,s38Missing:yoe,vs2Missing:boe,vsMissing:Eoe,smallMissing:_oe,midMissing:woe,mlMissing:Soe,mllMissing:Toe,largeMissing:Aoe,extraLargeMissing:xoe,xxlMissing:Ioe,xxxlMissing:Loe,highlightBorder:Roe,cacheFlag:koe};var iE=It("<div>"),Moe=It("<div><a><div></div><div>LIVE"),Coe=It("<div><div>"),Poe=It("<img alt=avatar>");const Doe=a(t=>{const e=f1(),n=gu();let i=window.location.search;new URLSearchParams(i);const[s,r]=Je(!1),o=t.size||"sm",l={nano:Ke.nanoAvatar,micro:Ke.microAvatar,xxs:Ke.xxsAvatar,xss:Ke.xssAvatar,xs:Ke.xsAvatar,vvs:Ke.vvsAvatar,vs2:Ke.vs2Avatar,vs:Ke.vsAvatar,sm:Ke.smallAvatar,md:Ke.midAvatar,ml:Ke.mlAvatar,mll:Ke.mllAvatar,lg:Ke.largeAvatar,xl:Ke.extraLargeAvatar,xxl:Ke.xxlAvatar,xxxl:Ke.xxxlAvatar,s30:Ke.s30Avatar,s38:Ke.s38Avatar,s50:Ke.s50Avatar},d={nano:Ke.nanoMissing,micro:Ke.microMissing,xxs:Ke.xxsMissing,xss:Ke.xssMissing,xs:Ke.xsMissing,vvs:Ke.vvsMissing,vs2:Ke.vs2Missing,vs:Ke.vsMissing,sm:Ke.smallMissing,md:Ke.midMissing,ml:Ke.mlMissing,mll:Ke.mllMissing,lg:Ke.largeMissing,xl:Ke.extraLargeMissing,xxl:Ke.xxlMissing,xxxl:Ke.xxxlMissing,s30:Ke.s38Missing,s38:Ke.s38Missing,s50:Ke.s38Missing},c=a(b=>{const E=b.target;let T=t.user?.picture||t.src||"";return(E.src===T||E.src.endsWith(T))&&(T=cm),E.onerror="",E.src=T,!0},"imgError"),u=a(()=>
2155{if(t.user){const b=t.legendConfig||n?.legendCustomization[t.user?.pubkey];if(b)return b.avatar_glow?Ke.legend:""}return""},"legendClass"),f=a(()=>{if(t.legendWhite)return`${Ke.legend} ${Ke.legend_WHITE}`;if(t.user){const b=t.legendConfig||n?.legendCustomization[t.user?.pubkey];if(b){const E=b.style,T=E!==""&&b.avatar_glow,I=E!==""&&b.avatar_glow;let M="";return T&&(M+=`${Ke.legend} ${Ke[`legend_${E}`]}`),I&&(M+=` ${Ke.legendGlow} ${Ke[`legend_glow_${E}`]}`),M}}return t.highlightBorder?Ke.highlightBorder:""},"highlightClass"),h=ht(()=>{let b="m";switch(o){case"nano":case"micro":case"xxs":case"xss":case"xs":case"vvs":case"vs2":case"vs":case"sm":case"md":case"ml":case"mll":case"lg":case"s30":b="s";break;default:b="m";break}const E=t.user?.picture||t.src;if(!E)return"";const T=e?.actions.getMediaUrl(E,b,!0);r(!!T);const I=T??E;return navigator?.serviceWorker?.controller?.postMessage({type:"CACHE_AVATAR",url:I}),I}),p=a(()=>{const b=localStorage.getItem("devMode")==="true";return s()||!b?"":Ke.cacheFlag},"notCachedFlag"),g=a(()=>{const b=t.user?.picture||t.src||cm;return e?.actions.getMedia(b,"o")},"imageMedia"),v=a(()=>{const b=t.user?.picture||t.src||cm;return e?.actions.getMedia(b,"m")||e?.actions.getMedia(b,"o")||b},"imageThumb"),y=a(()=>{const b=e?.actions.getStream(t.user?.pubkey||"n/a");return b?`${n?.actions.profileLink(t.user?.pubkey||b.pubkey)}/live/${b.id}`:""},"liveHref");return(()=>{var b=iE();return Fe(b,X(sn,{get when(){return h()},get fallback(){return(()=>{var E=Coe(),T=E.firstChild;return ze(I=>{var M=Ke.missingBack,H=d[o];return M!==I.e&&xe(E,I.e=M),H!==I.t&&xe(T,I.t=H),I},{e:void 0,t:void 0}),E})()},get children(){var E=iE();return Fe(E,X(sn,{get when(){return t.zoomable},get fallback(){return(()=>{var T=Poe();return T.addEventListener("error",c),ze(()=>Ct(T,"src",h())),T})()},get children(){return X(jse,{get class(){return t.zoomable?"profile_image":""},get media(){return g()},get src(){return h()},get altSrc(){return t.user?.picture||t.src},onError:c,get mediaThumb(){return v()},ignoreRatio:!0,get authorPk(){return t.user?.pubkey}})}})),ze(()=>xe(E,`${Ke.missingBack} ${p()}`)),E}}),null),Fe(b,X(sn,{get when(){return ps(()=>!!t.user)()&&t.showCheck},get children(){var E=iE();return Fe(E,X(yre,{get user(){return t.user}})),ze(()=>xe(E,Ke.iconBackground)),E}}),null),Fe(b,X(sn,{get when(){return ps(()=>!!e?.actions.isStreaming(t.user?.pubkey||"n/a"))()&&!t.legendWhite},get children(){var E=Moe(),T=E.firstChild,I=T.firstChild,M=I.nextSibling;return ze(H=>{var N=Ke.centerBottom,$=t.id,F=y(),D=Ke.liveBadge,L=Ke.liveDot,m=Ke.caption;return N!==H.e&&xe(E,H.e=N),$!==H.t&&Ct(T,"id",H.t=$),F!==H.a&&Ct(T,"href",H.a=F),D!==H.o&&xe(T,H.o=D),L!==H.i&&xe(I,H.i=L),m!==H.n&&xe(M,H.n=m),H},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),E}}),null),ze(E=>{var T=t.id,I=`${l[o]} ${u()} ${f()} ${t.showBorderRing?Ke.borderRing:""}`,M=t.user?.pubkey;return T!==E.e&&Ct(b,"id",E.e=T),I!==E.t&&xe(b,E.t=I),M!==E.a&&Ct(b,"data-user",E.a=M),E},{e:void 0,t:void 0,a:void 0}),b})()},"Avatar"),w_e=Ys(Doe),Ooe="_userMention_19p7n_1",Noe="_userPreview_19p7n_4",Foe="_userName_19p7n_29",Uoe="_verification_19p7n_35",sE={userMention:Ooe,userPreview:Noe,userName:Foe,verification:Uoe};var Boe=It("<div class=linkish>"),$oe=It("<a target=_blank>");const Hoe=a(t=>{const e=gu();return X(a(i=>!t.user&&t.npub?X(v0,{get id(){return t.id},get class(){return sE.userMention},get href(){return e?.actions.profileLink(t.npub)||""},get children(){return i.children}}):t.user?t.openInNewTab?(()=>{var s=$oe();return Fe(s,()=>i.children),ze(r=>{var o=t.id,l=sE.userMention,d=e?.actions.profileLink(t.user?.npub)||"";return o!==r.e&&Ct(s,"id",r.e=o),l!==r.t&&xe(s,r.t=l),d!==r.a&&Ct(s,"href",r.a=d),r},{e:void 0,t:void 0,a:void 0}),s})():X(v0,{get id(){return t.id},get class(){return sE.userMention},get href(){return e?.actions.profileLink(t.user?.npub||t.npub)||""},get children(){return i.children}}):(()=>{var s=Boe();return Fe(s,()=>i.children),ze(()=>Ct(s,"id",t.id)),s})(),"LinkComponent"),{get children(){return["@",ps(()=>qee(t.user)||t.npub||"UNKNOWN")]}})},"MentionedUserLink"),S_e=Ys(Hoe),Goe="_skeletonHolder_i6mpt_1",Voe="_ios_i6mpt_10",Woe="_fullHeader_i6mpt_22",zoe="_fullHeaderPhone_i6mpt_28",Koe="_editProfileButton_i6mpt_34",qoe="_emptyHeader_i6mpt_38",joe="_banner_i6mpt_45",Yoe="_profileActions_i6mpt_45",Zoe="_bigAbout_i6mpt_45",Qoe="_smallAbout_i6mpt_45",Joe="_fadeIn_i6mpt_1",Xoe="_avatar_i6mpt_52",eae="_userImage_i6mpt_72",tae="_keyIcon_i6mpt_78",nae="_copyIcon_
2155i6mpt_88",iae="_checkIcon_i6mpt_98",sae="_linkIcon_i6mpt_108",rae="_profileAboutHolder_i6mpt_139",oae="_smallSecondaryButton_i6mpt_145",aae="_smallPrimaryButton_i6mpt_164",lae="_zapIcon_i6mpt_212",cae="_qrIcon_i6mpt_222",dae="_contextIcon_i6mpt_232",uae="_messageIcon_i6mpt_242",fae="_addFeedIcon_i6mpt_252",hae="_removeFeedIcon_i6mpt_262",pae="_primaryButton_i6mpt_272",gae="_profileCard_i6mpt_286",mae="_columnLeft_i6mpt_305",vae="_nipLine_i6mpt_313",yae="_columnRight_i6mpt_316",bae="_basicInfo_i6mpt_325",Eae="_basicInfoName_i6mpt_331",_ae="_text_i6mpt_337",wae="_followsBadge_i6mpt_348",Sae="_joined_i6mpt_351",Tae="_followings_i6mpt_359",Aae="_stats_i6mpt_365",xae="_number_i6mpt_378",Iae="_label_i6mpt_384",Lae="_left_i6mpt_393",Rae="_publicKey_i6mpt_397",kae="_npub_i6mpt_406",Mae="_verificationInfo_i6mpt_432",Cae="_verified_i6mpt_441",Pae="_nip05_i6mpt_445",Dae="_profileLinks_i6mpt_455",Oae="_website_i6mpt_461",Nae="_commonFollows_i6mpt_475",Fae="_avatars_i6mpt_488",Uae="_phone_i6mpt_500",Bae="_profileAbout_i6mpt_139",$ae="_userStats_i6mpt_512",Hae="_userStat_i6mpt_512",Gae="_statNumber_i6mpt_524",Vae="_statName_i6mpt_530",Wae="_userFeed_i6mpt_539",zae="_bannerPlaceholder_i6mpt_543",Kae="_phoneAvatar_i6mpt_569",qae="_desktopAvatar_i6mpt_574",jae="_addToFeedButton_i6mpt_580",Yae="_mutedProfile_i6mpt_584",Zae="_contextArea_i6mpt_608",Qae="_profileVerification_i6mpt_673",Jae="_cacheFlag_i6mpt_692",T_e={skeletonHolder:Goe,ios:Voe,fullHeader:Woe,fullHeaderPhone:zoe,editProfileButton:Koe,emptyHeader:qoe,banner:joe,profileActions:Yoe,bigAbout:Zoe,smallAbout:Qoe,fadeIn:Joe,avatar:Xoe,userImage:eae,keyIcon:tae,copyIcon:nae,checkIcon:iae,linkIcon:sae,profileAboutHolder:rae,smallSecondaryButton:oae,smallPrimaryButton:aae,zapIcon:lae,qrIcon:cae,contextIcon:dae,messageIcon:uae,addFeedIcon:fae,removeFeedIcon:hae,primaryButton:pae,profileCard:gae,columnLeft:mae,nipLine:vae,columnRight:yae,basicInfo:bae,basicInfoName:Eae,text:_ae,followsBadge:wae,joined:Sae,followings:Tae,stats:Aae,number:xae,label:Iae,left:Lae,publicKey:Rae,npub:kae,verificationInfo:Mae,verified:Cae,nip05:Pae,profileLinks:Dae,website:Oae,commonFollows:Nae,avatars:Fae,phone:Uae,profileAbout:Bae,userStats:$ae,userStat:Hae,statNumber:Gae,statName:Vae,userFeed:Wae,bannerPlaceholder:zae,phoneAvatar:Kae,desktopAvatar:qae,addToFeedButton:jae,mutedProfile:Yae,contextArea:Zae,profileVerification:Qae,cacheFlag:Jae},dm={pubkey:"",follows_count:0,followers_count:0,note_count:0,reply_count:0,time_joined:0,total_zap_count:0,total_satszapped:0,relay_count:0,media_count:0},EB=Pn(),Xae=a(t=>{let e=[];const n={profileKey:void 0,userProfile:void 0,userStats:{...dm},fetchedUserStats:!1,knownProfiles:{names:{}},articles:[],drafts:[],notes:[],replies:[],gallery:[],contactListDate:0,isFetching:!1,isProfileFetched:!1,isFetchingReplies:!1,isProfileFollowing:!1,isFetchingZaps:!1,isFetchingGallery:!1,isFetchingDrafts:!1,page:{messages:[],users:{},postStats:{},mentions:{},noteActions:{},topZaps:{}},repliesPage:{messages:[],users:{},postStats:{},mentions:{},noteActions:{},topZaps:{}},reposts:{},zaps:[],zappedNotes:[],zappedArticles:[],zappers:{},zapListOffset:0,lastNote:void 0,lastArticle:void 0,lastReply:void 0,lastZap:void 0,lastGallery:void 0,following:[],filterReason:null,contacts:[],profileStats:{},isFetchingContacts:!1,isFetchingSidebarNotes:!1,followers:[],isFetchingFollowers:!1,relays:{},isFetchingRelays:!1,fetchingProfileForKey:"",isAboutParsed:!1,commonFollowers:[],sidebarNotes:{messages:[],users:{},postStats:{},notes:[],topZaps:{},noteActions:{}},sidebarArticles:{messages:[],users:{},postStats:{},notes:[],topZaps:{},noteActions:{}},isFetchingSidebarArticles:!1,future:{notes:[],articles:[],replies:[],reposts:{},page:{messages:[],users:{},postStats:{},mentions:{},noteActions:{},topZaps:{}},repliesPage:{messages:[],users:{},postStats:{},mentions:{},noteActions:{},topZaps:{}}},profileHistory:{profiles:[],stats:{}},parsedAbout:void 0,paging:{notes:{...jn()},reads:{...jn()},gallery:{...jn()},replies:{...jn()},drafts:{...jn()}},scrollTop:{reads:0,notes:0,replies:0,zaps:0,media:0}},i=a(async(Y,le,pe=0,Te=20,Le=0,De=0)=>{if(Y){if(le==="notes"){const _e={id:"feed",kind:"notes",notes:"authored",pubkey:Y};j("isFetching",()=>!0);const{notes:we,userPolls:ye,zapPolls:te,paging:he}=await eh(z.publicKey,JSON.stringify(_e),`profile_notes_${Ee}`,[G.Text,G.Repost,G.UserPoll,G.ZapPoll],{limit:Te,until:pe,offset:Le||ie.notes.map(ve=>ve.repost?ve.repost.note.created_at:ve.msg.created_at||0)}),ae=$0([...we,...ye,...te],he);j("paging","notes",()=>({...he})),j("notes",ve=>[...ve,...ae]),j("isFetching",()=>!1);return}if(le==="replies"){const _e={id:"feed",kind:"notes",notes:"replies",pubkey:Y};j("isFetchingReplies",()=>!0);const{notes:we,userPolls:ye,zapPolls:te,paging:he}=await eh(z.publicKey,JSON.stringify(_e),`profile_replies_${Ee}`,[G.Text,G.Repost,G.UserPoll,G.ZapPoll],{limit:Te,until:pe,offset:Le||ie.replies.map(ve=>ve.repost?ve.repost.note.created_at:ve.msg.created_at||0)}),ae=$0([...we,...ye,...te],he);j("paging","replies",()=>({...he})),j("replies",ve=>[...ve,...ae]),j("isFetchingReplies",()=>!1);return}if(le==="reads"){const _e={id:"feed",kind:"reads",notes:"authored",pubkey:Y,minwords:De};j("isFetching",()=>!0);const we=Le||qf(ie.articles,ie.paging.reads),{reads:ye,paging:te}=await _l(z.publicKey,JSON.stringify(_e),`profile_reads_${Ee}`,{limit:Te,until:pe,offset:we}),he=H0(ye,te);j("paging","reads",()=>({...te})),j("articles",ae=>[...ae,...he]),j("isFetching",()=>!1);return}if(le==="drafts"){const _e={id:"feed",kind:"drafts",notes:"authored",pubkey:Y};j("isFetchingDrafts",()=>!0);const we=Le||qf(ie.articles,ie.paging.drafts),{drafts:ye,paging:te}=await _l(z.publicKey,JSON.stringify(_e),`profile_drafts_${Ee}`,{limit:Te,until:pe,offset:we});for(let ae=0;ae<ye.length;ae++){let ve=ye[ae];ve.plain=await Mte(Y,ve.content),ve.noteId=`ndraft1${ve.id}`}const he=ye.filter(ae=>!ie.drafts.find(ve=>ve.id===ae.id));j("paging","drafts",()=>({...te})),j("drafts",ae=>[...ae,...he]),j("isFetchingDrafts",()=>!1);return}if(le==="media"){const _e={id:"feed",kind:"notes",notes:"user_media_thumbnails",pubkey:Y};j("isFetchingGallery",()=>!0);const{notes:we,paging:ye}=await _l(z.publicKey,JSON.stringify(_e),`profile_media_${Ee}`,{limit:Te,until:pe,offset:Le||ie.gallery.map(he=>he.repost?he.repost.note.created_at:he.post.created_at||0)}),te=SB(we,ye);j("paging","media",()=>({...ye})),j("gallery",he=>[...he,...te]),j("isFetchingGallery",()=>!1);return}}},"getProfileMegaFeed"),s=a((Y,le,pe)=>{if(pe){j(le,Te=>Te.repost?.note?.noteId===Y,"repost",()=>{});return}j(le,Te=>Te.filter(Le=>Le.noteId!==Y))},"removeEvent"),r=a(async(Y,le)=>{if(!Y)return;const pe=ie.paging[le]||{until:0,since:0,sortBy:"created_at"};pe.since&&i(Y,le,pe.since,20)},"getProfileMegaFeedNextPage"),o=a(async(Y,le=0,pe=0,Te=!0)=>
2155{if(!Y)return;const Le=`profile_zaps_${Ee}`;j("isFetchingZaps",()=>!0);const{zaps:De,notes:_e,articles:we,paging:ye}=await Sne(Y,Le,le,pe,20),te=TB(De,ye);j("zaps",he=>[...he,...te]),j("zappedNotes",he=>[...he,..._e]),j("zappedArticles",he=>[...he,...we]),j("isFetchingZaps",()=>!1)},"fetchZapList"),l=a(()=>{const Y=ie.zaps[ie.zaps.length-1];if(!Y)return;j("lastZap",()=>({...Y}));const le=Y.created_at||0;le>0&&ie.profileKey&&o(ie.profileKey,le,0,!1)},"fetchNextZapsPage"),d=a((Y,le)=>{const pe=le.find(Te=>Te.pubkey===Y);pe&&j("contacts",ie.contacts.length,Si(pe))},"addContact"),c=a(Y=>{const le=ie.contacts.filter(pe=>pe.pubkey!==Y);j("contacts",Si(le))},"removeContact"),u=a((Y,le=!0)=>{if(!Y)return;j("isFetchingContacts",()=>!0);const pe=`profile_contacts_${Ee}`,Te=Me(pe,{onEvent:(Le,De)=>{if(De?.kind===G.Contacts){const _e=De.tags;let we=[];for(let ye=0;ye<_e.length;ye++){const te=_e[ye];te[0]==="p"&&we.push(te[1])}j("following",()=>we),j("contactListDate",()=>De.created_at||0)}if(De?.kind===G.Metadata){let _e=JSON.parse(De.content);(!_e.displayName||typeof _e.displayName=="string"&&_e.displayName.trim().length===0)&&(_e.displayName=_e.display_name),_e.pubkey=De.pubkey,_e.npub=Ii(De.pubkey),_e.created_at=De.created_at,j("contacts",ie.contacts.length,()=>({..._e}));return}if(De?.kind===G.UserFollowerCounts){const _e=JSON.parse(De.content);j("profileStats",()=>({..._e}));return}},onEose:()=>{j("isFetchingContacts",()=>!1),Te()}});vy(Y,pe,le)},"fetchContactList"),f=a(Y=>{if(!Y)return;const le=`profile_relays_${Ee}`,pe=Me(le,{onEvent:(Te,Le)=>{if(Le?.kind===G.UserRelays){const De=xN(Le.tags);j("relays",Si(De));return}},onEose:()=>{j("isFetchingRelays",()=>!1),pe()}});j("isFetchingRelays",()=>!0),by(Y,le)},"fetchRelayList"),h=a(Y=>{if(!Y)return;const le=`profile_followers_${Ee}`,pe=Me(le,{onEvent:(Te,Le)=>{if(Le?.kind===G.Metadata){let De=JSON.parse(Le.content);(!De.displayName||typeof De.displayName=="string"&&De.displayName.trim().length===0)&&(De.displayName=De.display_name),De.pubkey=Le.pubkey,De.npub=Ii(Le.pubkey),De.created_at=Le.created_at,j("followers",ie.followers.length,()=>({...De}))}if(Le?.kind===G.UserFollowerCounts){const De=JSON.parse(Le.content);j("profileStats",()=>({...De}))}},onEose:()=>{j("isFetchingFollowers",()=>!1),pe()}});j("isFetchingFollowers",()=>!0),Fq(Y,le)},"fetchFollowerList"),p=a(()=>{j("gallery",()=>[]),j("lastGallery",()=>{})},"clearGallery"),g=a(()=>{j("page",()=>({messages:[],users:{},postStats:{},noteActions:{}})),j("notes",()=>[]),j("reposts",()=>{}),j("lastNote",()=>{})},"clearNotes"),v=a(()=>{j("articles",()=>[]),j("lastArticle",()=>{})},"clearArticles"),y=a(()=>{j("drafts",()=>[])},"clearDrafts"),b=a(()=>{j("repliesPage",()=>({messages:[],users:{},postStats:{},noteActions:{}})),j("replies",()=>[]),j("lastReply",()=>{})},"clearReplies"),E=a(()=>{j("zaps",()=>[]),j("zappers",Si({})),j("lastZap",()=>{})},"clearZaps"),T=a(()=>{j("contacts",()=>[]),j("followers",()=>[]),j("profileStats",()=>{}),j("profileStats",()=>({}))},"clearContacts"),I=a(()=>{j("filterReason",()=>null)},"clearFilterReason"),M=a(()=>{j("future",()=>({notes:[],replies:[],reposts:{},page:{messages:[],users:{},postStats:{},mentions:{},noteActions:{},topZaps:{}},repliesPage:{messages:[],users:{},postStats:{},mentions:{},noteActions:{},topZaps:{}}}))},"clearFuture"),H=a(Y=>{if(ie.future.notes.length>100)return;let le=0;ie.notes[0]&&(le=ie.notes[0].repost?ie.notes[0].repost.note.created_at:ie.notes[0].msg.created_at||0),M(),tK(z.publicKey,Y,`profile_future_${Ee}`,le)},"checkForNewNotes"),N=a((Y,le="sidebarNotes")=>{if(Y.kind===G.Metadata){const pe=Y;j(le,"users",()=>({[pe.pubkey]:pe}));return}if([G.Text,G.Repost,G.LongForm].includes(Y.kind)){const pe=Y;ie.lastNote?.id!==pe.id&&j(le,"messages",Te=>[...Te,pe]);return}if(Y.kind===G.NoteStats){const Te=JSON.parse(Y.content);j(le,"postStats",()=>({[Te.event_id]:Te}));return}if(Y.kind===G.Mentions){const Te=JSON.parse(Y.content);j("page","mentions",()=>({[Te.id]:Te}));return}if(Y.kind===G.NoteActions){const Te=JSON.parse(Y.content);j("page","noteActions",()=>({[Te.event_id]:Te}));return}},"updateSidebar"),$=a((Y,le="sidebarNotes")=>{if(le==="sidebarNotes"){const pe=EU(Va(Y));j(le,"notes",()=>[...pe])}if(le==="sidebarArticles"){const pe=uu(Y);j(le,"notes",()=>[...pe])}},"saveSidebar"),F=a((Y,le="sidebarNotes")=>{if(Y.kind===G.Metadata){const pe=Y;if(pe.pubkey===ie.profileKey)return;e.push(dt(pe,Y.pubkey));return}},"updateCommonFollowers"),D=a(()=>{j("commonFollowers",()=>[...e]),e=[]},"saveCommonFollowers");We(oi(()=>ie.profileKey,(Y,le)=>{Y&&Y!==le&&j("isProfileFetched",()=>!1)}));const L=a(async Y=>{if(Y!==ie.profileKey&&(j("profileKey",()=>Y),Y)){Aa(()=>{j("sidebarNotes",()=>({...ng})),j("sidebarArticles",()=>({...ng})),j("parsedAbout",()=>{}),j("filterReason",()=>null),j("userProfile",()=>{}),j("userStats",()=>({...dm})),j("fetchedUserStats",()=>!1),j("isProfileFetched",()=>!1),j("isFetchingSidebarNotes",()=>!0),j("isFetchingSidebarArticles",()=>!0),j("isAboutParsed",()=>!1),j("commonFollowers",()=>[])});const le=`profile_info_${Ee}`,pe=`profile_scored_${Ee}`,Te=`profile_common_followers_${Ee}`;fi(le,()=>A1(Y,z.publicKey,le),U,R),fi(pe,()=>Bq(Y,z.publicKey,pe,8),P,V),fi(Te,()=>$q(Y,z.publicKey,Te,6),Z,ee);const Le={id:"feed",kind:"reads",notes:"authored",pubkey:Y},{reads:De,paging:_e}=await _l(z.publicKey,JSON.stringify(Le),`profile_reads_latest_${Ee}`,{until:0,limit:2}),we=H0(De,_e);j("sidebarArticles",()=>({notes:[...we]})),j("isFetchingSidebarArticles",()=>!1);const ye=`is_profile_following_${Ee}`;fi(ye,()=>Nq(Y,z.publicKey,ye),w)}},"setProfileKey"),m=a(()=>{j("sidebarNotes",()=>({...ng})),j("sidebarArticles",()=>({...ng})),j("isProfileFetched",()=>!1),j("userProfile",()=>{}),j("isFetching",()=>!1),j("commonFollowers",()=>[]),j("userStats",Si(dm))},"resetProfile"),S=a(Y=>{if(Y?.content&&Y.kind===G.Metadata){const le=JSON.parse(Y.content);j("userProfile",()=>({...le,pubkey:Y.pubkey,msg:Y}))}},"handleUserProfileEvent"),_=a(Y=>{if(Y!==ie.profileKey)return;const le=`user_profile_${Ee}`;fi(le,()=>Na([Y],le),S)},"updateProfile"),A=a(()=>{},"refreshNotes"),x=a(Y=>{let le=[...ie.profileHistory.profiles];const pe=le.findIndex(Te=>Te.pubkey===Y.pubkey);if(pe!==0){if(pe>0){le.splice(pe,1),j("profileHistory","profiles",()=>[Y,...le]),cg(z.publicKey,{...ie.profileHistory}),Y.userStats&&C(Y.userStats);return}if(le.unshift(Y),le.length>10){const Te=le[le.length-1].pubkey;let Le={...ie.profileHistory.stats};delete Le[Te],j("profileHistory","stats",Si(Le)),cg(z.publicKey,{...ie.profileHistory}),le.pop()}j("profileHistory","profiles",()=>[...le]),cg(z.publicKey,{...ie.profileHistory}),Y.userStats&&C(Y.userStats)}},"addProfileToHistory"),C=a(Y=>{j("profileHistory","stats",()=>({[Y.pubkey]:Y})),cg(z.publicKey,{...ie.profileHistory})},"addStatsToHistory"),U=a(Y=>{if(Y?.kind===G.FilteringReason){const le=JSON.parse(Y.content)||null;le?.action==="block"?j("filterReason",()=>({...le})):j("filterReason",()=>null)}if(Y?.kind===G.Metadata){let le=JSON.parse(Y.content);(!le.displayName||typeof le.displayName=="string"&&le.displayName.trim().length===0)&&(le.displayName=le.display_name),le.pubkey=Y.pubkey,le.npub=Ii(Y.pubkey),le.created_at=Y.created_at,j("userProfile",()=>({...le,msg:Y})),x(le);return}if(Y?.kind===G.UserStats){const le=JSON.parse(Y.content);j("userStats",()=>({...le})),C(le),j("fetchedUserStats",()=>!0);return}},"handleProfileInfoEvent"),R=a(()=>{j("isProfileFetched",()=>!0)},"handleProfileInfoEose"),w=a(Y=>{j("isProfileFollowing",JSON.parse(Y?.content||"false"))},"handleProfileFollowingEvent"),P=a(Y=>{N(Y)},"handleProfileScoredEvent"),V=a(()=>{$(ie.sidebarNotes),j("isFetchingSidebarNotes",()=>!1)},"handleProfileScoredEose"),Z=a(Y=>{F(Y)},"handleProfileCommonFollowersEvent"),ee=a(()=>{D()},"handleProfileCommonFollowersEose");We(()=>{if(Ma()){const Y=yq(z.publicKey);Y&&j("profileHistory",Si(Y))}});const ne=a(()=>{g(),v(),p(),b(),E(),y(),m()},"clearProfile"),se=a(()=>{j("scrollTop",()=>({reads:0,notes:0,replies:0,zaps:0,media:0})),window.scrollTo({top:0})},"resetScroll"),ge=a((Y,le)=>{j("scrollTop",le,()=>Y)},"updateScrollTop"),[ie,j]=li({...n,actions:{clearNotes:g,clearArticles:v,clearGallery:p,clearReplies:b,clearDrafts:y,setProfileKey:L,refreshNotes:A,checkForNewNotes:H,fetchContactList:u,fetchFollowerList:h,fetchRelayList:f,clearContacts:T,addContact:d,removeContact:c,fetchZapList:o,fetchNextZapsPage:l,clearZaps:E,resetProfile:m,clearFilterReason:I,addProfileToHistory:x,clearProfile:ne,updateScrollTop:ge,resetScroll:se,updateProfile:_,removeEvent:s,getProfileMegaFeed:i,getProfileMegaFeedNextPage:r}});return X(EB.Provider,{value:ie,get children(){return t.children}})},"ProfileProvider"),ele=a(()=>Dn(EB),"useProfileContext"),tle=a((t,e)=>{Ae(JSON.stringify(["REQ",e,{cache:["directmsg_count",{pubkey:t}]}]))},"subscribeToMessagesStats"),nle=a(t=>{Ae(JSON.stringify(["CLOSE",t,{cache:["directmsg_count"]}]))},"unsubscribeToMessagesStats"),ile=a(async(t,e)=>{const n={content:`{ "description": "reset messages from '${t}'"}`,kind:G.Settings,tags:[["d",Zt,Qe.resetDirectMessages]],created_at:Math.ceil(new Date().getTime()/1e3)};try{const i=await Nt(n,{isRead:!0});return Ae(JSON.stringify(["REQ",e,{cache:["reset_directmsg_count",{event_from_user:i,sender:t}]}])),!0}catch(i){return console.error("Failed to reset message count: ",i),!1}},"resetMessageCount"),sle=a((t,e,n,i=0,s=0,r=0)=>{let o={user_pubkey:t,relation:e};i>0&&(o.limit=i),s>0&&(o.until=s),r>0&&(o.offset=r),Ae(JSON.stringify(["REQ",n,{cache:["get_directmsg_contacts",{...o}]}]))},"getMessageCounts"),rle=a((t,e,n,i=0,s=20,r=0)=>{const l={limit:s,[i===0?"since":"until"]:i,receiver:t,sender:e,offset:r};Ae(JSON.stringify(["REQ",n,{cache:["get_directmsgs",l]}]))},"getOldMessages"),ole=a((t,e,n,i=0,s=20,r=0)=>{let o={receiver:t,sender:e,since:i,limit:s};r>0&&(o.offset=r),Ae(JSON.stringify(["REQ",n,{cache:["get_directmsgs",{...o}]}]))},"getNewMessages"),ale=a(async t=>{const e={content:'{ "description": "mark all messages as read"}',kind:G.Settings,tags:[["d",Zt,Qe.markAllAsRead]],created_at:Math.ceil(new Date().getTime()/1e3)};try{return Nt(e,{isRead:!0}).then(n=>{Ae(JSON.stringify(["REQ",t,{cache:["reset_directmsg_counts",{event_from_user:n}]}]))}),!0}catch(n){return console.error("Failed to mark as read: ",n),!1}},"markAllAsRead"),lle=a((t,e,n,i)=>{let s={name:t};e&&(s.pubkey=e);const r=JSON.stringify(["REQ",n,{cache:["membership_name_available",{...s}]}]);if(i){const o=new CustomEvent("send",{detail:{message:r,ws:i}});i.send(r),i.dispatchEvent(o)}else throw"no_socket"},"sendPremiumNameCheck"),A_e=a(async(t,e,n)=>{const i={kind:G.Settings,tags:[["d",Zt,Qe.changePremiumName]],created_at:Math.floor(new Date().getTime()/1e3),content:JSON.stringify({name:t})};try{const s=await Nt(i),r=JSON.stringify(["REQ",e,{cache:["membership_change_name",{event_from_user:s}]}]);if(n){const o=new CustomEvent("send",{detail:{message:r,ws:n}});n.send(r),n.dispatchEvent(o)}else throw"no_socket";return!0}catch(s){return console.error("Failed to upload: ",s),!1}},"changePremiumName"),x_e=a(async(t,e,n,i,s)=>{if(!t)return;const r={kind:G.Settings,tags:[["p",t],["d",Zt,Qe.getPremiumQRCode]],created_at:Math.floor(new Date().getTime()/1e3),content:JSON.stringify({name:e,product_id:n,receiver_pubkey:t})};try{const o=await Nt(r,{isRead:!0}),l=JSON.stringify(["REQ",i,{cache:["membership_purchase_product",{event_from_user:o}]}]);if(s){const d=new CustomEvent("send",{detail:{message:l,ws:s}});s.send(l),s.dispatchEvent(d)}else throw"no_socket";return!0}catch(o){return console.error("Failed to upload: ",o),!1}},"getPremiumQRCode"),I_e=a((t,e,n)=>{const i=JSON.stringify(["REQ",e,{cache:["membership_purchase_monitor",{membership_quote_id:t}]}]);if(n){const s=new CustomEvent("send",{detail:{message:i,ws:n}});n.send(i),n.dispatchEvent(s)}else throw"no_socket"},"startListeningForPremiumPurchase"),L_e=a((t,e)=>{const n=JSON.stringify(["CLOSE",t]);if(e&&e.readyState===WebSocket.OPEN){const i=new CustomEvent("send",{detail:{message:n,ws:e}});e.send(n),e.dispatchEvent(i)}else throw"no_socket"},"stopListeningForPremiumPurchase"),R_e=a(async(t,e,n,i,s,r=!0)=>
2155{if(!t)return;const o={kind:G.Settings,tags:[["p",t],["d",Zt,Qe.getLegendQRCode]],created_at:Math.floor(new Date().getTime()/1e3),content:JSON.stringify({name:e,product_id:"legend-premium",receiver_pubkey:t,amount_usd:`${n}`,onchain:r})};try{const l=await Nt(o,{isRead:!0}),d=JSON.stringify(["REQ",i,{cache:["membership_purchase_product",{event_from_user:l}]}]);if(s){const c=new CustomEvent("send",{detail:{message:d,ws:s}});s.send(d),s.dispatchEvent(c)}else throw"no_socket";return!0}catch(l){return console.error("Failed to upload: ",l),!1}},"getLegendQRCode"),k_e=a((t,e,n)=>{const i=JSON.stringify(["REQ",e,{cache:["membership_purchase_monitor",{membership_quote_id:t}]}]);if(n){const s=new CustomEvent("send",{detail:{message:i,ws:n}});n.send(i),n.dispatchEvent(s)}else throw"no_socket"},"startListeningForLegendPurchase"),M_e=a((t,e)=>{const n=JSON.stringify(["CLOSE",t]);if(e&&e.readyState===WebSocket.OPEN){const i=new CustomEvent("send",{detail:{message:n,ws:e}});e.send(n),e.dispatchEvent(i)}else throw"no_socket"},"stopListeningForLegendPurchase"),C_e=a(async(t,e,n)=>{if(!t)return;const i={kind:G.Settings,tags:[["p",t],["d",Zt,Qe.getPremiumStatus]],created_at:Math.floor(new Date().getTime()/1e3),content:JSON.stringify({})};try{const s=await Nt(i,{isRead:!0}),r=JSON.stringify(["REQ",e,{cache:["membership_status",{event_from_user:s}]}]);if(n){const o=new CustomEvent("send",{detail:{message:r,ws:n}});n.send(r),n.dispatchEvent(o)}else throw"no_socket";return!0}catch(s){return console.error("Failed to upload: ",s),!1}},"getPremiumStatus"),P_e=a(async(t,e,n)=>{if(!t)return;const i={kind:G.Settings,tags:[["p",t],["d",Zt,Qe.getPremiumMediaStats]],created_at:Math.floor(new Date().getTime()/1e3),content:`{ "description": "get media stats'"}`};try{const s=await Nt(i,{isRead:!0}),r=JSON.stringify(["REQ",e,{cache:["membership_media_management_stats",{event_from_user:s}]}]);if(n){const o=new CustomEvent("send",{detail:{message:r,ws:n}});n.send(r),n.dispatchEvent(o)}else throw"no_socket";return!0}catch(s){return console.error("Failed to fetch media stats: ",s),!1}},"getPremiumMediaStats"),D_e=a(async(t,e,n,i,s)=>{if(!t)return;const r={kind:G.Settings,tags:[["p",t],["d",Zt,Qe.getPremiumMediaList]],created_at:Math.floor(new Date().getTime()/1e3),content:'{ "description": "get media list"}'};try{let l={event_from_user:await Nt(r,{isRead:!0}),limit:20};e>0&&(l.until=e),n>0&&(l.offset=n);const d=JSON.stringify(["REQ",i,{cache:["membership_media_management_uploads",{...l}]}]);if(s){const c=new CustomEvent("send",{detail:{message:d,ws:s}});s.send(d),s.dispatchEvent(c)}else throw"no_socket";return!0}catch(o){return console.error("Failed to fetch media list: ",o),!1}},"getPremiumMediaList"),O_e=a(async(t,e,n,i)=>{if(!t)return;const s={kind:G.Settings,tags:[["p",t],["d",Zt,Qe.deletePremiumMedia]],created_at:Math.floor(new Date().getTime()/1e3),content:`{ "url": "${e}"}`};try{let o={event_from_user:await Nt(s)};const l=JSON.stringify(["REQ",n,{cache:["membership_media_management_delete",{...o}]}]);if(i){const d=new CustomEvent("send",{detail:{message:l,ws:i}});i.send(l),i.dispatchEvent(d)}else throw"no_socket";return!0}catch(r){return console.error("Failed to delete media: ",r),!1}},"deletePremiumMedia"),N_e=a(async(t,e,n,i,s)=>{if(!t)return;const r={kind:G.Settings,tags:[["p",t],["d",Zt,Qe.getContactListHistory]],created_at:Math.floor(new Date().getTime()/1e3),content:'{ "description": "get contacts history list"}'};try{let l={event_from_user:await Nt(r,{isRead:!0})};const d=JSON.stringify(["REQ",i,{cache:["membership_recovery_contact_lists",{...l}]}]);if(s){const c=new CustomEvent("send",{detail:{message:d,ws:s}});s.send(d),s.dispatchEvent(c)}else throw"no_socket";return!0}catch(o){return console.error("Failed to fetch media list: ",o),!1}},"getContactListHistory"),F_e=a(async(t,e,n)=>{if(!t)return;const i={kind:G.Settings,tags:[["p",t],["d",Zt,Qe.getContentListHistory]],created_at:Math.floor(new Date().getTime()/1e3),content:'{ "description": "get content list"}'};try{let r={event_from_user:await Nt(i,{isRead:!0})};const o=JSON.stringify(["REQ",e,{cache:["membership_content_stats",{...r}]}]);if(n){const l=new CustomEvent("send",{detail:{message:o,ws:n}});n.send(o),n.dispatchEvent(l)}else throw"no_socket";return!0}catch(s){return console.error("Failed to fetch content list: ",s),!1}},"getContentListHistory"),U_e=a(async(t,e,n,i)=>{if(!t)return;const s={kind:G.Settings,tags:[["p",t],["d",Zt,Qe.getContentDownloadData]],created_at:Math.floor(new Date().getTime()/1e3),content:'{ "description": "get content download data"}'};try{let o={event_from_user:await Nt(s,{isRead:!0})};e.length>0&&(o.kinds=[...e]);const l=JSON.stringify(["REQ",n,{cache:["membership_content_backup",{...o}]}]);if(i){const d=new CustomEvent("send",{detail:{message:l,ws:i}});i.send(l),i.dispatchEvent(d)}else throw"no_socket";return!0}catch(r){return console.error("Failed to fetch content download list: ",r),!1}},"getContentDownloadData"),B_e=a(async(t,e,n,i)=>{if(!t)return;const s={kind:G.Settings,tags:[["p",t],["d",Zt,Qe.startContentBroadcast]],created_at:Math.floor(new Date().getTime()/1e3),content:'{ "description": "broadcats content data"}'};try{let o={event_from_user:await Nt(s)};e.length>0&&(o.kinds=[...e]);const l=JSON.stringify(["REQ",n,{cache:["membership_content_rebroadcast_start",{...o}]}]);if(i){const d=new CustomEvent("send",{detail:{message:l,ws:i}});i.send(l),i.dispatchEvent(d)}else throw"no_socket";return!0}catch(r){return console.error("Failed to fetch content download list: ",r),!1}},"startContentBroadcast"),$_e=a(async(t,e,n)=>{if(!t)return;const i={kind:G.Settings,tags:[["p",t],["d",Zt,Qe.cancelContentBroadcast]],created_at:Math.floor(new Date().getTime()/1e3),content:'{ "description": "broadcats content data"}'};try{let r={event_from_user:await Nt(i)};const o=JSON.stringify(["REQ",e,{cache:["membership_content_rebroadcast_cancel",{...r}]}]);if(n){const l=new CustomEvent("send",{detail:{message:o,ws:n}});n.send(o),n.dispatchEvent(l)}else throw"no_socket";return!0}catch(s){return console.error("Failed to fetch content download list: ",s),!1}},"cancelContentBroadcast"),H_e=a(async(t,e,n)=>{if(!t)return;const i={kind:G.Settings,tags:[["p",t],["d",Zt,Qe.startListeningForContentBroadcastStaus]],created_at:Math.floor(new Date().getTime()/1e3),content:'{ "description": "broadcast content status"}'};try{let r={event_from_user:await Nt(i,{isRead:!0})};const o=JSON.stringify(["REQ",e,{cache:["rebroadcasting_status",{...r}]}]);if(n){const l=new CustomEvent("send",{detail:{message:o,ws:n}});n.send(o),n.dispatchEvent(l)}else throw"no_socket";return!0}catch(s){return console.error("Failed to start listening to broadcast status: ",s),!1}},"startListeningForContentBroadcastStaus"),G_e=a(async(t,e,n)=>{if(t)try{const i=JSON.stringify(["CLOSE",e,{cache:["rebroadcasting_status"]}]);if(n){const s=new CustomEvent("send",{detail:{message:i,ws:n}});n.send(i),n.dispatchEvent(s)}else throw"no_socket";return!0}catch(i){return console.error("Failed to stop listening to broadcast status: ",i),!1}},"stopListeningForContentBroadcastStaus"),V_e=a(async(t,e,n,i,s)=>{if(!t)return;let r={limit:20};e>0&&(r.until=e),n>0&&(r.offset=n);const o={kind:G.Settings,tags:[["p",t],["d",Zt,Qe.getOrderListHistory]],created_at:Math.floor(new Date().getTime()/1e3),content:JSON.stringify(r)};try{let d={event_from_user:await Nt(o,{isRead:!0})};const c=JSON.stringify(["REQ",i,{cache:["membership_purchase_history",{...d}]}]);if(s){const u=new CustomEvent("send",{detail:{message:c,ws:s}});s.send(c),s.dispatchEvent(u)}else throw"no_socket";return!0}catch(l){return console.error("Failed to fetch media list: ",l),!1}},"getOrderListHistory"),W_e=a(async(t,e,n,i)=>{if(!t)return;const s={kind:G.Settings,tags:[["p",t],["d",Zt,Qe.setLegendCustumization]],created_at:Math.floor(new Date().getTime()/1e3),content:JSON.stringify(e)};try{let o={event_from_user:await Nt(s)};const l=JSON.stringify(["REQ",n,{cache:["membership_legend_customization",{...o}]}]);if(i){const d=new CustomEvent("send",{detail:{message:l,ws:i}});i.send(l),i.dispatchEvent(d)}else throw"no_socket";return!0}catch(r){return console.error("Failed to fetch media list: ",r),!1}},"setLegendCutumization"),z_e=a((t,e,n,i)=>new Promise((s,r)=>{if(!n){s(!1);return}let o=!1;const l=Jv(n,i,(d,c,u)=>{d==="EVENT"&&(o=JSON.parse(u?.content||'{ "available": false}').available||!1),d==="NOTICE"&&(l(),r(u?.content)),d==="EOSE"&&(l(),s(o))});lle(t,e,i,n)}),"isPremiumNameAvailable"),K_e=a((t,e,n="USD")=>{const i=JSON.stringify(["REQ",t,{cache:["membership_exchange_rate",{target_currency:n}]}]);if(e){const s=new CustomEvent("send",{detail:{message:i,ws:e}});e.send(i),e.dispatchEvent(s)}else throw"no_socket"},"fetchExchangeRate"),cle=a((t,e,n,i=0,s=20,r=0)=>{let o={order_by:n,limit:s};const l=e==="premium"?"membership_premium_leaderboard":"membership_legends_leaderboard";i>0&&(o.until=i),r>0&&(o.offset=r);const d=JSON.stringify(["REQ",t,{cache:[l,{...o}]}]);Ae(d)},"fetchLeaderboard"),q_e=a(async(t,e,n,i)=>new Promise(async(s,r)=>{if(!t){r("missing_pubkey");return}const o=`init_stripe_${Ee}`;let l;const d=Jv(i,o,(u,f,h)=>{u==="EOSE"&&(d(),s(l)),u==="EVENT"&&(l=JSON.parse(h?.content||"{ client_secret: '', session_id: '',}")),u==="NOTICE"&&(d(),r(""))}),c={kind:G.Settings,tags:[["p",t],["d",Zt,Qe.initStripe]],created_at:Math.floor(new Date().getTime()/1e3),content:JSON.stringify({name:e,product_id:n,receiver_pubkey:t,stripe_subscription:!0}
2155)};try{const u=await Nt(c,{isRead:!0}),f=JSON.stringify(["REQ",o,{cache:["membership_purchase_product",{event_from_user:u}]}]);if(i){const h=new CustomEvent("send",{detail:{message:f,ws:i}});i.send(f),i.dispatchEvent(h)}else throw"no_socket";return!0}catch(u){return console.error("Failed to upload: ",u),!1}}),"initStripe"),j_e=a(async(t,e,n)=>new Promise(async(i,s)=>{if(!t||!e){s("missing_pubkey_or_session_id");return}const r=`resolve_stripe_${Ee}`;let o;const l=Jv(n,r,(c,u,f)=>{c==="EOSE"&&(l(),i(o)),c==="EVENT"&&(o=JSON.parse(f?.content||"{ client_secret: '', session_id: '',}")),c==="NOTICE"&&(l(),s("failed_to_resolve_stripe_session"))}),d={kind:G.Settings,tags:[["p",t],["d",Zt,Qe.resolveStripe]],created_at:Math.floor(new Date().getTime()/1e3),content:JSON.stringify({session_id:e})};try{const c=await Nt(d,{isRead:!0}),u=JSON.stringify(["REQ",r,{cache:["membership_stripe_checkout_session_check_status",{event_from_user:c}]}]);if(n){const f=new CustomEvent("send",{detail:{message:u,ws:n}});n.send(u),n.dispatchEvent(f)}else throw"no_socket";return!0}catch(c){return console.error("Failed to upload: ",c),!1}}),"resolveStripe"),ci=a(()=>({users:{},notes:[],reads:[],drafts:[],zaps:[],userPolls:[],zapPolls:[],pollResults:{},pollVotes:[],topicStats:{},noteStats:{},mentions:{},noteActions:{},relayHints:{},topZaps:{},wordCount:{},userStats:{},userFollowerCounts:{},userFollowerIncrease:{},since:0,until:0,sortBy:"created_at",elements:[],dmContacts:{},encryptedMessages:[],legendCustomization:{},memberCohortInfo:{},leaderboard:[]}),"emptyMegaFeedPage"),jn=a(()=>({since:0,until:0,sortBy:"created_at",elements:[]}),"emptyPaging"),gs=a(()=>({users:[],notes:[],reads:[],drafts:[],zaps:[],userPolls:[],zapPolls:[],pollVotes:[],topicStats:[],dmContacts:[],paging:{...jn()},page:{...ci()},encryptedMessages:[],legendCustomization:{},memberCohortInfo:{},leaderboard:[]}),"emptyMegaFeedResults"),_B=a(t=>{let e={};return t.notes.forEach(n=>{if(n.kind===G.Repost&&n.content.length===0){const i=n.tags.find(s=>s[0]==="e");i&&(e[i[1]]=n.id)}}),e},"parseEmptyReposts"),dle=a((t,e,n=0,i=100)=>{const s=`multi_thread_${e}_${Ee}`;return new Promise(r=>{let o={...ci()};const l=Me(s,{onEose:()=>{l(),r(wB(o))},onEvent:(d,c)=>{vi(o,c)}});nK(t,e,s,n,i)})},"fetchMultiThread"),eh=a((t,e,n,i,s)=>new Promise(r=>{let o={...ci()};const l=Me(n,{onEose:()=>{l(),r(wB(o))},onEvent:(h,p)=>{vi(o,p)}}),d=s?.until||0,c=s?.since||0,u=s?.limit||0;let f=0;typeof s?.offset=="number"?f=s.offset:Array.isArray(s?.offset)&&(d>0&&(f=(s?.offset||[]).filter(h=>h===d).length),c>0&&(f=(s?.offset||[]).filter(h=>h===c).length)),Jz(t,e,n,i,d,u,c,f)}),"fetchMegaMultiFeed"),_l=a((t,e,n,i)=>new Promise(s=>{let r={...ci()};const o=Me(n,{onEose:()=>{o(),s(Bi(r))},onEvent:(f,h)=>{vi(r,h)}}),l=i?.until||0,d=i?.since||0,c=i?.limit||0;let u=0;typeof i?.offset=="number"?u=i.offset:Array.isArray(i?.offset)&&(l>0&&(u=(i?.offset||[]).filter(f=>f===l).length),d>0&&(u=(i?.offset||[]).filter(f=>f===d).length)),Xz(t,e,n,l,c,d,u)}),"fetchMegaFeed"),ule=a((t,e,n)=>new Promise(i=>{let s={...ci()};const r=Me(n,{onEose:()=>{r(),i(Bi(s))},onEvent:(o,l)=>{vi(s,l)}});pne(t,e,10,n)}),"fetchScoredContent"),fle=a(t=>new Promise(e=>{let n=[];const i=Me(t,{onEose:()=>{i(),mne(n,`get_reads_pe_${Ee}`).then(s=>{e(s)})},onEvent:(s,r)=>{n=JSON.parse(r?.content||"{}").reads.reduce((l,d)=>d[0]?[...l,d[0]]:l,[])}});gne(t)}),"fetchRecomendedReads"),Y_e=a((t,e,n)=>new Promise(i=>{let s={...ci()};const r=Mp(e),{pubkey:o,identifier:l,kind:d}=r.data,c=Me(n,{onEvent:(u,f)=>{f&&vi(s,f)},onEose:()=>{c(),i(Bi(s))},onNotice:(u,f)=>{c(),i({...gs()})}});sK(t,o,l,d,n)}),"fetchReadThread"),Z_e=a((t,e,n)=>new Promise(i=>{let s={...ci()};const r=Me(e,{onEvent:(u,f)=>{f&&vi(s,f)},onEose:()=>{r(),i(Bi(s))},onNotice:(u,f)=>{r(),i({...gs()})}}),o=n?.until||0,l=n?.since||0,d=n?.limit||0;let c=0;typeof n?.offset=="number"?c=n.offset:Array.isArray(n?.offset)&&(o>0&&(c=(n?.offset||[]).filter(u=>u===o).length),l>0&&(c=(n?.offset||[]).filter(u=>u===l).length)),Wq(e,t,o,d,l,c)}),"fetchExplorePeople"),Q_e=a((t,e,n)=>new Promise(i=>{let s={...ci()};const r=Me(e,{onEvent:(u,f)=>{f&&vi(s,f)},onEose:()=>{r(),i(Bi(s))},onNotice:(u,f)=>{r(),i({...gs()})}}),o=n?.until||0,l=n?.since||0,d=n?.limit||0;let c=0;typeof n?.offset=="number"?c=n.offset:Array.isArray(n?.offset)&&(o>0&&(c=(n?.offset||[]).filter(u=>u===o).length),l>0&&(c=(n?.offset||[]).filter(u=>u===l).length)),zq(e,t,o,d,l,c)}),"fetchExploreZaps"),J_e=a((t,e,n)=>new Promise(i=>{let s={...ci()};const r=Me(e,{onEvent:(u,f)=>{f&&vi(s,f)},onEose:()=>{r(),i(Bi(s))},onNotice:(u,f)=>{r(),i({...gs()})}}),o=n?.until||0,l=n?.since||0,d=n?.limit||0;let c=0;typeof n?.offset=="number"?c=n.offset:Array.isArray(n?.offset)&&(o>0&&(c=(n?.offset||[]).filter(u=>u===o).length),l>0&&(c=(n?.offset||[]).filter(u=>u===l).length)),Kq(e,t,o,d,l,c)}),"fetchExploreMedia"),X_e=a((t,e)=>new Promise(n=>{let i={...ci()};const s=Me(e,{onEvent:(r,o)=>{o&&vi(i,o)},onEose:()=>{s(),n(Bi(i))},onNotice:(r,o)=>{s(),n({...gs()})}});qq(e)}),"fetchExploreTopics"),xg=a((t,e,n,i)=>new Promise(s=>{let r={...ci()};const o=Me(n,{onEvent:(f,h)=>{h&&vi(r,h)},onEose:()=>{o(),s(Bi(r))},onNotice:(f,h)=>{o(),s({...gs()})}}),l=i?.until||0,d=i?.since||0,c=i?.limit||0;let u=0;typeof i?.offset=="number"?u=i.offset:Array.isArray(i?.offset)&&(l>0&&(u=(i?.offset||[]).filter(f=>f===l).length),d>0&&(u=(i?.offset||[]).filter(f=>f===d).length)),sle(t,e,n,c,d,u)}),"fetchDMContacts"),hle=a((t,e,n,i)=>new Promise(s=>{let r={...ci()};const o=Me(n,{onEvent:(f,h)=>{h&&vi(r,h)},onEose:()=>{o(),s(Bi(r))},onNotice:(f,h)=>{o(),s({...gs()})}}),l=i?.until||0,d=i?.since||0,c=i?.limit||0;let u=0;typeof i?.offset=="number"?u=i.offset:Array.isArray(i?.offset)&&(l>0&&(u=(i?.offset||[]).filter(f=>f===l).length),d>0&&(u=(i?.offset||[]).filter(f=>f===d).length)),rle(t,e,n,d,c,u)}),"fetchDMConversation"),ple=a((t,e,n,i)=>new Promise(s=>{if(!t||!e){s({...gs()});return}let r={...ci()};const o=Me(n,{onEvent:(f,h)=>{h&&vi(r,h)},onEose:()=>{o(),s(Bi(r))},onNotice:(f,h)=>{o(),s({...gs()})}}),l=i?.until||0,d=i?.since||0,c=i?.limit||0;let u=0;typeof i?.offset=="number"?u=i.offset:Array.isArray(i?.offset)&&(l>0&&(u=(i?.offset||[]).filter(f=>f===l).length),d>0&&(u=(i?.offset||[]).filter(f=>f===d).length)),ole(t,e,n,d,c,u)}),"fetchDMConversationNew"),ewe=a((t,e,n,i)=>new Promise(s=>{let r={...ci()};const o=Me(t,{onEvent:(u,f)=>{f&&vi(r,f)},onEose:()=>{o(),s(Bi(r))},onNotice:(u,f)=>{o(),s({...gs()})}});i?.until;const l=i?.since||0,d=i?.limit||0;let c=0;typeof i?.offset=="number"&&(c=i.offset),cle(t,n,e,l,d,c)}),"fetchLeaderboardThread"),gle=a((t,e)=>new Promise(n=>{let i={...ci()};const s=Me(e,{onEvent:(r,o)=>{o&&vi(i,o)},onEose:()=>{s(),n(Bi(i))},onNotice:(r,o)=>{s(),n({...gs()})}});Na(t,e)}),"fetchPeople"),wB=a(t=>{const e=_B(t),n=Object.keys(e);n.length>
21550&&n.forEach(b=>{const E=t.mentions[b];if(E){const T=t.notes.findIndex(I=>I.id===e[b]);t.notes[T].content=JSON.stringify(E)}});const i=uU(t),s=fU(t),r=hU(t),o=pU(t),l=AB(t),d=xB(t),c=IB(t),u=[...t.encryptedMessages],f={...t.legendCustomization},h={...t.memberCohortInfo},p=[...t.leaderboard],g=gU(t),v=mU(t),y=vU(t);return{users:i,notes:s,reads:r,drafts:o,zaps:l,userPolls:g,zapPolls:v,pollVotes:y,topicStats:d,dmContacts:c,encryptedMessages:u,legendCustomization:f,memberCohortInfo:h,leaderboard:p,paging:{since:t.since,until:t.until,sortBy:t.sortBy,elements:t.elements},page:t}},"pageMultiFeedResolve"),Bi=a(t=>{const e=_B(t),n=Object.keys(e);n.length>0&&n.forEach(b=>{const E=t.mentions[b];if(E){const T=t.notes.findIndex(I=>I.id===e[b]);t.notes[T].content=JSON.stringify(E)}});const i=uU(t),s=fU(t),r=hU(t),o=pU(t),l=AB(t),d=xB(t),c=IB(t),u=[...t.encryptedMessages],f={...t.legendCustomization},h={...t.memberCohortInfo},p=[...t.leaderboard],g=gU(t),v=mU(t),y=vU(t);return{users:i,notes:s,reads:r,drafts:o,zaps:l,userPolls:g,zapPolls:v,pollVotes:y,topicStats:d,dmContacts:c,encryptedMessages:u,legendCustomization:f,memberCohortInfo:h,leaderboard:p,paging:{since:t.since,until:t.until,sortBy:t.sortBy,elements:t.elements},page:t}},"pageResolve"),vi=a((t,e)=>{if(e.kind===G.FeedRange){const n=JSON.parse(e.content||"{}");t.since=n.since,t.until=n.until,t.sortBy=n.order_by,t.elements=[...n.elements];return}if(e.kind===G.Metadata){const n=e;t.users[n.pubkey]={...n};return}if([G.Repost].includes(e.kind)){const n=e;let i;try{i=JSON.parse(n.content)}catch{}if(rne(t.notes,n))return;i?.kind===G.Text&&t.notes.push({...n}),i?.kind===G.UserPoll&&t.userPolls.push({...n}),i?.kind===G.ZapPoll&&t.zapPolls.push({...n});return}if([G.Text,G.Comment].includes(e.kind)){const n=e;t.notes.push({...n});return}if([G.LongForm,G.LongFormShell].includes(e.kind)){const n=e;t.reads.push({...n});return}if([G.Draft].includes(e.kind)){const n=e;t.drafts.push({...n});return}if([G.UserPoll].includes(e.kind)){const n=e;t.userPolls.push({...n});return}if([G.UserPollVote].includes(e.kind)){const n=e;t.pollVotes.push({...n});return}if([G.ZapPoll].includes(e.kind)){const n=e;t.zapPolls.push({...n});return}if([G.PollResults].includes(e.kind)){const i=JSON.parse(e.content);t.pollResults={...t.pollResults,...i};return}if(e.kind===G.NoteStats){const i=JSON.parse(e.content);t.noteStats[i.event_id]={...i};return}if(e.kind===G.Mentions){const i=JSON.parse(e.content);t.mentions[i.id]={...i};return}if(e.kind===G.NoteActions){const i=JSON.parse(e.content);t.noteActions[i.event_id]={...i};return}if(e.kind===G.LinkMetadata){Io(JSON.parse(e.content));return}if(e.kind===G.Zap){t.zaps.push(e);const n=e.tags.find(u=>u[0]==="description");if(!n)return;const i=JSON.parse(n[1]||"{}");let s="0",r=e?.tags?.find(u=>u[0]==="bolt11");if(r)try{s=`${vs(r[1])||0}`}catch{const f=i.tags.find(h=>h[0]==="amount");s=f?f[1]:"0"}let o=(i.tags.find(u=>u[0]==="a")||[])[1];if(o&&o.includes(":")){const[u,f,h]=o.split(":");o=Ce.naddrEncode({kind:u,pubkey:f,identifier:h})}else o=(i.tags.find(u=>u[0]==="e")||[])[1];if(i.tags.find(u=>u[0]==="poll_option"))return;const l={id:i.id,amount:parseInt(s||"0"),pubkey:i.pubkey,message:i.content,eventId:o},d=t.topZaps[o];if(d===void 0){t.topZaps[o]=[{...l}];return}if(d.find(u=>u.id===l.id))return;const c=[...d,{...l}].sort((u,f)=>f.amount-u.amount);t.topZaps[o]=[...c];return}if(e.kind===G.NoteTopicStat){const n=JSON.parse(e.content);t.topicStats=n;return}if(e.kind===G.UserStats){let n=JSON.parse(e.content);t.userStats[n.pubkey]={...n}}if(e.kind===G.UserFollowerCounts){let n=JSON.parse(e.content);t.userFollowerCounts={...n}}if(e.kind===G.UserFollowerIncrease){let n=JSON.parse(e.content);t.userFollowerIncrease={...n}}if(e?.kind===G.MesagePerSenderStats){const n=JSON.parse(e.content);t.dmContacts={...n}}if(e?.kind===G.EncryptedDirectMessage&&t.encryptedMessages.push({...e}),e.kind===G.WordCount){const n=JSON.parse(e.content);t.wordCount||(t.wordCount={}),t.wordCount[n.event_id]=n.words;return}if(e.kind===G.LegendCustomization){const n=JSON.parse(e.content);
2155Object.entries(n).forEach(([i,s])=>{t.legendCustomization[i]={...s}})}if(e.kind===G.MembershipCohortInfo){const n=JSON.parse(e.content);Object.entries(n).forEach(([i,s])=>{t.memberCohortInfo[i]={...s}})}if([G.LegendLeaderboard,G.PremiumLeaderboard].includes(e.kind)){let n=JSON.parse(e.content||"[]");n=n.map(i=>({index:i.index,pubkey:i.pubkey,donated_btc:i.donated_btc?parseFloat(i.donated_btc):0,last_donation:i.last_donation||0,premium_since:i.premium_since||0})),t.leaderboard=[...n]}},"updateFeedPage"),$0=a((t,e)=>{let n=[];return e.elements.reduce((i,s)=>{let r=t.find(o=>[o.id,o.repost?.note.id].includes(s));return!r||n.includes(r.id)?i:(n.push(r.id),[...i,{...r}])},[])},"filterAndSortEvents"),SB=a((t,e)=>{let n=[];return e.elements.reduce((i,s)=>{let r=t.find(o=>[o.id,o.repost?.note.id].includes(s));return!r||n.includes(r.id)?i:(n.push(r.id),[...i,{...r}])},[])},"filterAndSortNotes"),H0=a((t,e)=>e.elements.reduce((n,i)=>{const s=t.find(r=>r.id===i);return s?[...n,{...s}]:n},[]),"filterAndSortReads"),TB=a((t,e)=>e.elements.reduce((n,i)=>{const s=t.find(r=>r.id===i);return s?[...n,{...s}]:n},[]),"filterAndSortZaps"),mle=a((t,e,n)=>e.elements.reduce((i,s)=>{let r=t.find(o=>o.pubkey===s);if(!r){r=Op(s);const o={...dm};r.userStats={...o,followers_increase:n.userFollowerIncrease[s],followers_count:n.userFollowerCounts[s]}}return r?[...i,{...r}]:i},[]),"filterAndSortUsers"),twe=a((t,e)=>e.elements.reduce((n,i)=>{let s=t.find(r=>r.pubkey===i);return s?[...n,{...s}]:n},[]),"filterAndSortLeaderboard"),AB=a(t=>{const e=t.zaps;let n=[];for(let i=0;i<e.length;i++){const s=e[i],r=(s.tags.find(y=>y[0]==="bolt11")||[])[1],o=JSON.parse((s.tags.find(y=>y[0]==="description")||[])[1]||"{}"),l=o.pubkey,d=o.tags.find(y=>y[0]==="p")[1];let c="",u=0;const f=o.tags.find(y=>y[0]==="a"),h=o.tags.find(y=>y[0]==="e");if(f){const[y,b,E]=f[1].split(":");c=Ce.naddrEncode({kind:y,pubkey:b,identifier:E}),u=t.reads.find(I=>I.id===c)?.kind||0}else if(h){c=h[1];const y=t.reads.find(I=>I.id===c),b=t.notes.find(I=>I.id===c),E=t.zapPolls.find(I=>I.id===c),T=t.userPolls.find(I=>I.id===c);u=y?.kind||b?.kind||E?.kind||T?.kind||0}if(![G.Text,G.LongForm,G.UserPoll,G.ZapPoll].includes(u))continue;const p=t.users[l]?dt(t.users[l],l):l,g=t.users[d]?dt(t.users[d],d):d,v={id:s.id,message:o.content||"",amount:vs(r)||0,sender:p,reciver:g,created_at:s.created_at,zappedId:c,zappedKind:u};n.find(y=>y.id===v.id)||n.push(v)}return n},"convertToZapsMega"),xB=a(t=>Object.entries(t.topicStats),"convertToTopicStatsMega"),IB=a(t=>Object.keys(t.dmContacts).map(n=>({pubkey:n,user:dt(t.users[n],n),dmInfo:t.dmContacts[n]})),"convertToContactsMega"),vle=a((t,e)=>{const n=Be(t);return!n.homeFeeds||n.homeFeeds.length===0?(om(t,e),e):n.homeFeeds},"initHomeFeeds"),yle=a(t=>Be(t).homeFeeds||[],"loadHomeFeeds"),ble=a((t,e)=>{const n=Be(t);return!n.readsFeeds||n.readsFeeds.length===0?(_N(t,e),e):n.readsFeeds},"initReadsFeeds"),Ele=a(t=>Be(t).readsFeeds||[],"loadReadsFeeds"),_le=a((t,e,n)=>{if(n.find(s=>e.name===s.name))return[...n];const i=[{...e},...n];return my(t,i),i},"updateAvailableFeedsTop"),wle=a((t,e,n)=>{if(n.find(s=>e.name===s.name))return[...n];const i=[...n,{...e}];return my(t,i),i},"updateAvailableFeeds"),Sle=a((t,e,n)=>{const i=n.filter(s=>s.hex!==e.hex||s.includeReplies!==e.includeReplies);return my(t,i),i},"removeFromAvailableFeeds"),HM=a((t,e)=>{const n=[...e];return my(t,n),n},"replaceAvailableFeeds"),Tle=a(t=>{Ae(JSON.stringify(["REQ",t,{cache:["get_app_releases"]}]))},"getMobileReleases"),Ale={locale:"en-us",theme:"sunrise",themes:T9,useSystemTheme:!1,isAnimated:!0,availableFeeds:[],readsFeeds:[],readsFeedsReloaded:!1,homeFeeds:[],homeFeedsReloaded:!1,defaultFeed:A9[0],defaultZap:rO,availableZapOptions:oO,defaultZapAmountOld:21,zapOptionsOld:[21,420,1e3,5e3,1e4,1e5],notificationSettings:{...t_},notificationAdditionalSettings:{...n_},applyContentModeration:!0,contentModeration:[...lO],mobileReleases:{ios:{date:`${tO}`,version:nO},android:{date:`${iO}`,version:sO}},recomendedBlossomServers:[]},LB=Pn(),xle=a(t=>{const e=h9(),n=_y(),i=a(()=>["sunrise","ice"].includes(we.theme),"isLightTheme"),s=a(te=>{ye("useSystemTheme",()=>te),gq(z.publicKey,te),["sunrise","sunset"].includes(we.theme)?f(te?"sunset":"sunrise",!0):f(te?"midnight":"ice",!0)},"setUseSystemTheme"),r=a(()=>{const te=`recommended_blossom_${Ee}`,he=Me(te,{onEvent:(ae,ve)=>{const lt=JSON.parse(ve.content||"[]");ye("recomendedBlossomServers",()=>[...lt])},onEose:()=>{he()}});Yq(te)},"getRecomendedBlossomServers"),o=a((te,he)=>{fM(te),he||(Y(),fq(z.publicKey,te))},"setTheProxyThroughPrimal"),l=a((te,he)=>{ye("defaultZap",()=>te),!he&&Y()},"setDefaultZapAmount"),d=a((te,he,ae)=>{ye("availableZapOptions",he,()=>({...te})),!ae&&Y()},"setZapOptions"),c=a(te=>{const he=`restore_default_${Ee}`,ae=Me(he,{onEvent:(ve,lt)=>{if(lt)try{const Ye=JSON.parse(lt?.content||"{}");let nt=Ye.zapConfig,Qt=Ye.zapDefault;ye("availableZapOptions",()=>nt),ye("defaultZap",()=>Qt),!te&&Y()}catch(Ye){Tn("Error parsing settings response: ",Ye)}},onNotice:()=>{e?.sendWarning(n.formatMessage({id:"settings.loadFail",defaultMessage:"Failed to load settings. Will be using local settings.",description:"Toast message after settings have failed to be loaded from the server"}))},onEose:()=>{ae()}});lM(he)},"resetZapOptionsToDefault"),u=a((te,he)=>{const ae=localStorage.getItem("forceTheme");if(ae&&["sunrise","sunset","midnight","ice"].includes(ae)){ye("theme",()=>ae);return}te&&(ye("theme",()=>te.name),he||(pq(z.publicKey,te.name),Y()))},"setTheme"),f=a((te,he)=>{if(!te)return;const ae=we.themes.find(ve=>ve.name===te);ae&&u(ae,he)},"setThemeByName"),h=a((te,he)=>{vq(z.publicKey,te),ye("isAnimated",()=>te),!he&&Y()},"setAnimation"),p=a((te=!0)=>{ye("applyContentModeration",()=>te),Y()},"setApplyContentModeration"),g=a((te,he=!1,ae)=>{if(te&&Ma()){const ve=he?_le:wle;ye("availableFeeds",lt=>ve(z.publicKey,te,lt)),!ae&&Y()}},"addAvailableFeed"),v=a((te,he)=>{te&&Ma()&&(ye("availableFeeds",ae=>Sle(z.publicKey,te,ae)),!he&&Y())},"removeAvailableFeed"),y=a((te,he)=>{Ma()&&(ye("availableFeeds",()=>HM(z.publicKey,te)),!he&&Y())},"setAvailableFeeds"),b=a((te,he)=>{let ae=[...we.availableFeeds];ae.splice(he,0,ae.splice(te,1)[0]),y(ae)},"moveAvailableFeed"),E=a((te,he)=>{const ae=we.availableFeeds.map(ve=>ve.hex===te.hex&&ve.includeReplies===te.includeReplies?{...ve,name:he}:{...ve});y(ae)},"renameAvailableFeed"),T=a(te=>JSON.stringify({id:"feed",kind:"notes",pubkey:te}),"specifyUserFeed"),I=a((te,he)=>{if(!he)return;const ae={name:n.formatMessage(EQ,{name:te}),spec:T(he),description:n.formatMessage(_Q,{name:te}),enabled:!0,feedkind:"user"},ve=[...we.homeFeeds,{...ae}];_(ve)},"addProfileHomeFeed"),M=a(te=>{if(!te)return;const he=T(te),ae=we.homeFeeds.filter(ve=>ve.spec!==he);_(ae)},"removeProfileHomeFeed"),H=a((te,he)=>{if(he==="home"){const ae=we.homeFeeds.filter(ve=>ve.spec!==te.spec);_(ae)}if(he==="reads"){const ae=we.readsFeeds.filter(ve=>ve.spec!==te.spec);A(ae)}},"removeFeed"),N=a((te,he,ae)=>{ae==="home"&&x(te,he),ae==="reads"&&C(te,he)},"moveFeed"),$=a((te,he,ae)=>{ae==="home"&&U(te,he),ae==="reads"&&R(te,he)},"renameFeed"),F=a((te,he,ae)=>{ae==="home"&&w(te,he),ae==="reads"&&P(te,he)},"enableFeed"),D=a((te,he)=>{he==="home"&&Z(te),he==="reads"&&ee(te)},"addFeed"),L=a(te=>{if(!te)return!1;const he=T(te);return we.homeFeeds.find(ae=>ae.spec===he)!==void 0},"hasProfileFeedAtHome"),m=a(()=>{const te=`restore_feeds_${Ee}`;let he=[];const ae=Me(te,{onEvent:(ve,lt)=>{he=JSON.parse(lt.content||"[]"),ye("homeFeeds",()=>[...he])},onEose:()=>{ae(),_(he)}});uk(te)},"restoreHomeFeeds"),S=a(()=>{const te=`restore_feeds_${Ee}`;let he=[];const ae=Me(te,{onEvent:(ve,lt)=>{he=JSON.parse(lt.content||"[]"),ye("readsFeeds",()=>[...he])},onEose:()=>{ae(),A(he)}});dk(te)},"restoreReadsFeeds"),_=a(te=>{ye("homeFeeds",()=>[...te]),om(z.publicKey,te);const he=`set_home_feeds_${Ee}`,ae=Me(he,{onEose:()=>{ae()}});Uee(he,we.homeFeeds)},"updateHomeFeeds"),A=a(te=>{ye("readsFeeds",()=>[...te]),om(z.publicKey,te);const he=`set_home_feeds_${Ee}`,ae=Me(he,{onEose:()=>{ae()}});$ee(he,we.readsFeeds)},"updateReadsFeeds"),x=a((te,he)=>{let ae=[...we.homeFeeds];ae.splice(he,0,ae.splice(te,1)[0]),_(ae)},"moveHomeFeed"),C=a((te,he)=>{let ae=[...we.readsFeeds];ae.splice(he,0,ae.splice(te,1)[0]),A(ae)},"moveReadsFeed"),U=a((te,he)=>{const ae=we.homeFeeds.map(ve=>ve.spec===te.spec?{...ve,name:he}:{...ve});_(ae)},"renameHomeFeed"),R=a((te,he)=>{const ae=we.readsFeeds.map(ve=>ve.spec===te.spec?{...ve,name:he}:{...ve});A(ae)},"renameReadsFeed"),w=a((te,he)=>{const ae=we.homeFeeds.map(ve=>ve.spec===te.spec?{...ve,enabled:he}:{...ve});_(ae)},"enableHomeFeed"),P=a((te,he)=>{const ae=we.readsFeeds.map(ve=>ve.spec===te.spec?{...ve,enabled:he}:{...ve});A(ae)},"enableReadsFeed"),V=a((te,he)=>he==="reads"?we.readsFeeds.find(ae=>ae.spec===te.spec)!==void 0:we.homeFeeds.find(ae=>ae.spec===te.spec)!==void 0,"isFeedAdded"),Z=a(te=>{const he=[...we.homeFeeds,{...te}];_(he)},"addHomeFeed"),ee=a(te=>{const he=[...we.readsFeeds,{...te}];A(he)},"addReadsFeed"),ne=a((te,he)=>{const ae=Object.entries(te).reduce((ve,[lt,Ye])=>({...ve,[lt]:Ye}),{});
2155ye("notificationSettings",()=>({...ae})),!he&&Y()},"updateNotificationSettingsBulk"),se=a((te,he,ae)=>{ye("notificationSettings",()=>({[te]:he})),!ae&&Y()},"updateNotificationSettings"),ge=a((te,he,ae)=>{ye("notificationAdditionalSettings",()=>({[te]:he})),!ae&&Y()},"updateNotificationAdditionalSettings"),ie=a(()=>{},"restoreDefaultFeeds"),j=a((te,he=!0,ae=!0)=>{let ve=[];he&&ve.push(aO),ae&&ve.push(kT),ye("contentModeration",lt=>lt.name===te,()=>({scopes:ve})),Y()},"modifyContentModeration"),Y=a(te=>{let he={...we.notificationAdditionalSettings};for(let Ye in un)he[Ye]!==void 0&&delete he[Ye];const ae={theme:we.theme,feeds:we.availableFeeds,zapDefault:we.defaultZap,zapConfig:we.availableZapOptions,defaultZapAmount:we.defaultZapAmountOld,zapOptions:we.zapOptionsOld,notifications:we.notificationSettings,notificationsAdditional:he,applyContentModeration:we.applyContentModeration,contentModeration:we.contentModeration,proxyThroughPrimal:z.proxyThroughPrimal||!1,animated:we.isAnimated},ve=`save_settings_${Ee}`,lt=Me(ve,{onNotice:()=>{e?.sendWarning(n.formatMessage({id:"settings.saveFail",defaultMessage:"Failed to save settings",description:"Toast message after settings have failed to be saved on the server"}))},onEose:()=>{lt()}});Oee(ae,ve)},"saveSettings"),le=a(()=>{const te=`load_defaults_${Ee}`,he=Me(te,{onEvent:(ae,ve)=>{if(ve)try{const lt=JSON.parse(ve.content||"{}"),Ye=lt.feeds,nt=lt.notifications,Qt=lt.notificationsAdditional;ye("availableFeeds",()=>HM(z.publicKey,Ye)),ye("defaultFeed",()=>we.availableFeeds.find(O=>O.hex===S9)||we.availableFeeds[0]),ye("notificationSettings",()=>Object.keys(nt).length>0?{...nt}:{...t_}),ye("notificationAdditionalSettings",()=>Object.keys(Qt)?{...Qt}:{...n_}),ye("applyContentModeration",()=>!0);let W=lt.zapConfig,k=lt.zapDefault;ye("defaultZap",()=>k),ye("availableZapOptions",()=>W)}catch(lt){Tn("Error parsing settings response: ",lt)}},onNotice:()=>{e?.sendWarning(n.formatMessage({id:"settings.loadFail",defaultMessage:"Failed to load settings. Will be using local settings.",description:"Toast message after settings have failed to be loaded from the server"}))},onEose:()=>{he()}});lM(te),De(),Le(),r()},"loadDefaults"),pe=a(async(te,he)=>{if(!te)return;ye("homeFeedsReloaded",()=>!1),ye("readsFeedsReloaded",()=>!1),ye("homeFeeds",()=>[...yle(te)]),ye("readsFeeds",()=>[...Ele(te)]),ye("homeFeedsReloaded",()=>!0),ye("readsFeedsReloaded",()=>!0);const ae=`load_settings_${Ee}`,ve=`load_home_settings_${Ee}`,lt=`load_reads_settings_${Ee}`,Ye=`load_nwc_settings_${Ee}`,nt=Me(ae,{onEvent:(Q,ce)=>{if(ce)try{const{animated:oe,theme:ke,zapDefault:ft,zapConfig:et,defaultZapAmount:it,zapOptions:_t,notifications:Gt,notificationsAdditional:Rt,applyContentModeration:Lo,contentModeration:zt,proxyThroughPrimal:dn}=JSON.parse(ce.content||"{}");if(we.useSystemTheme?Tk(Ri=>{["sunrise","sunset"].includes(ke)?f(Ri?"sunset":"sunrise",!0):f(Ri?"midnight":"ice",!0)},()=>{ke&&f(ke,!0)}):ke&&f(ke,!0),h(oe,!0),l(ft||{...rO,amount:it},!0),et)ye("availableZapOptions",()=>[...et]);else{const Ri=oO.map((Jt,Vt)=>({...Jt,amount:_t[Vt]}));ye("availableZapOptions",()=>[...Ri])}if(ye("defaultZapAmountOld",()=>it),ye("zapOptionsOld",()=>_t),Gt?ye("notificationSettings",()=>({...Gt})):ye("notificationSettings",()=>({...t_})),Rt?ye("notificationAdditionalSettings",()=>({...Rt})):ye("notificationAdditionalSettings",()=>({...n_})),ye("applyContentModeration",()=>Lo!==!1),Array.isArray(zt)&&zt.length===0)ye("contentModeration",()=>[...lO]);else if(Array.isArray(zt))for(let Ri=0;Ri<zt.length;Ri++){const Jt=zt[Ri],Vt=we.contentModeration.findIndex(Gr=>Gr.name===Jt.name);ye("contentModeration",Vt<0?we.contentModeration.length:Vt,()=>({...Jt}))}fM(dn)}catch(oe){Tn("Error parsing settings response: ",oe)}},onNotice:()=>{e?.sendWarning(n.formatMessage({id:"settings.loadFail",defaultMessage:"Failed to load settings. Will be using local settings.",description:"Toast message after settings have failed to be loaded from the server"}))},onEose:()=>{he&&he(),nt()}});te&&Nee(te,ae);const Qt=Me(ve,{onEvent:(Q,ce)=>{const oe=JSON.parse(ce?.content||"[]");ye("homeFeeds",()=>[...oe])},onEose:()=>{we.homeFeeds.length===0&&De(),om(te,we.homeFeeds),ye("homeFeedsReloaded",()=>!0),Qt()}});te&&(ye("readsFeedsReloaded",()=>!1),await Fee(ve)||(Qt(),De()));const W=Me(lt,{onEvent:(Q,ce)=>{const oe=JSON.parse(ce?.content||"[]");ye("readsFeeds",[...oe])},onEose:()=>{we.readsFeeds.length===0&&Le(),_N(te,we.readsFeeds),ye("readsFeedsReloaded",()=>!0),W()}});te&&(ye("readsFeedsReloaded",()=>!1),await Bee(lt)||(W(),Le()));let k=[],O=[];const K=Me(Ye,{onEvent:(Q,ce)=>{const oe=JSON.parse(ce?.content||"{}");k=oe.nwcList,O=oe.nwcActive},onEose:()=>{we.readsFeeds.length===0&&Le(),jf(te,k),O.length>0&&Pp(te,O[0],O[1]),K()}});te&&Hee(Ye),r()},"loadSettings"),Te=a(()=>{const te=`mobile_releases_${Ee}`,he=Me(te,{onEvent:(ae,ve)=>{const lt=JSON.parse(ve?.content||"{}");ye("mobileReleases",()=>({...lt}))},onEose:()=>{he()}});Tle(te)},"refreshMobileReleases"),Le=a(()=>{const te=`article_feeds_${Ee}`,he=Me(te,{onEvent:(ae,ve)=>{const lt=JSON.parse(ve.content||"[]");ye("readsFeeds",()=>[...lt])},onEose:()=>{he(),ble(z.publicKey,we.readsFeeds),ye("readsFeedsReloaded",()=>!0)}});dk(te)},"getDefaultReadsFeeds"),De=a(()=>{const te=`home_feeds_${Ee}`,he=Me(te,{onEvent:(ae,ve)=>{const lt=JSON.parse(ve.content||"[]");ye("homeFeeds",()=>[...lt])},onEose:()=>{he(),vle(z.publicKey,we.homeFeeds),ye("homeFeedsReloaded",()=>!0)}});ye("homeFeedsReloaded",()=>!1),uk(te)},"getDefaultHomeFeeds"),_e=a(()=>{const te=localStorage.getItem("theme")||"sunrise",he=localStorage.getItem("pubkey")||void 0,ae=mq(he);ye("useSystemTheme",()=>ae||!1),ae?Tk(ve=>{["sunrise","sunset"].includes(te)?f(ve?"sunset":"sunrise",!0):f(ve?"midnight":"ice",!0)},()=>{f(te,!0)}):f(te,!0)},"resolveTheme");Or(()=>{const te=localStorage.getItem("forceTheme");if(te&&["sunrise","sunset","midnight","ice"].includes(te)){ye("theme",()=>te);return}_e();const ae=(localStorage.getItem("animated")||"true")==="true";h(ae,!0),Te()}),We(oi(()=>z.isKeyLookupDone,te=>{if(!te)return;const he=z.publicKey;if(!he){ye("homeFeeds",()=>[]),ye("readsFeeds",()=>[]),le();return}pe(he,()=>{})})),We(()=>{const te=document.querySelector("html");localStorage.setItem("theme",we.theme),te?.setAttribute("data-theme",we.theme)}),We(()=>{const te=document.querySelector("html");localStorage.setItem("animated",`${we.isAnimated}`),te?.setAttribute("data-animated",`${we.isAnimated}`)});const[we,ye]=li({...Ale,actions:{setTheme:u,setThemeByName:f,isLightTheme:i,addAvailableFeed:g,removeAvailableFeed:v,setAvailableFeeds:y,moveAvailableFeed:b,renameAvailableFeed:E,addProfileHomeFeed:I,removeProfileHomeFeed:M,hasProfileFeedAtHome:L,moveHomeFeed:x,renameHomeFeed:U,saveSettings:Y,loadSettings:pe,restoreDefaultFeeds:ie,setDefaultZapAmount:l,setZapOptions:d,resetZapOptionsToDefault:c,updateNotificationSettings:se,updateNotificationSettingsBulk:ne,updateNotificationAdditionalSettings:ge,setApplyContentModeration:p,modifyContentModeration:j,refreshMobileReleases:Te,setProxyThroughPrimal:o,getDefaultReadsFeeds:Le,getDefaultHomeFeeds:De,restoreReadsFeeds:S,restoreHomeFeeds:m,moveFeed:N,renameFeed:$,enableFeed:F,addFeed:D,removeFeed:H,isFeedAdded:V,setAnimation:h,getRecomendedBlossomServers:r,setUseSystemTheme:s}});return X(LB.Provider,{value:we,get children(){return t.children}})}
2155,"SettingsProvider"),Wp=a(()=>Dn(LB),"useSettingsContext"),Ile={notes:[],futureNotes:[],sidebarNotes:[],isFetching:!1,isFetchingSidebar:!1,scrollTop:0,selectedFeed:void 0,sidebarQuery:void 0,page:{messages:[],users:{},postStats:{},mentions:{},noteActions:{},topZaps:{}},reposts:{},lastNote:void 0,mentionedNotes:{},future:{notes:[],reposts:{},page:{messages:[],users:{},postStats:{},mentions:{},noteActions:{},topZaps:{}},scope:"",timeframe:"",latest_at:0},sidebar:{notes:[],page:{messages:[],users:{},postStats:{},mentions:{},noteActions:{},topZaps:{}},isFetching:!1,query:void 0},paging:{notes:{...jn()},future:{...jn()},sidebar:{...jn()}}},RB=Pn(),Lle=a(t=>{const e=Wp(),n=a((T,I)=>{E(I,M=>M.filter(H=>H.noteId!==T))},"removeEvent"),i=a(T=>{E("sidebarQuery",()=>({...T}))},"updateSidebarQuery"),s=a(async T=>{E("isFetchingSidebar",()=>!0);const{notes:I,paging:M}=await ule(z.publicKey,T,`home_sidebar_${Ee}`);E("sidebarNotes",()=>[...I]),E("paging","sidebar",()=>({...M})),E("isFetchingSidebar",()=>!1)},"doSidebarSearch"),r=a(()=>{E("futureNotes",()=>[]),E("paging","future",()=>({since:0,until:0,sortBy:"created_at"}))},"clearFuture"),o=a(async T=>{if(b.paging.notes.sortBy!=="created_at"||b.futureNotes.length>100)return;let I=b.paging.future.until||b.paging.notes.until||0;const M=b.futureNotes.length>0?b.futureNotes:b.notes.slice(0,20),H=E_(M,b.futureNotes.length>0?b.paging.future:b.paging.notes),{notes:N,paging:$}=await eh(z.publicKey,T,`home_future_${Ee}`,[G.Text,G.Repost,G.UserPoll,G.ZapPoll],{since:I,limit:100,offset:H}),F=M.map(L=>L.id),D=N.filter(L=>!F.includes(L.id));E("paging","future",()=>({...$})),E("futureNotes",L=>[...L,...D])},"checkForNewNotes"),l=a(()=>{b.futureNotes.length!==0&&(E("notes",T=>[...b.futureNotes,...T]),r())},"loadFutureContent"),d=a(async(T,I=0,M=!0)=>{E("isFetching",()=>M);const H=z.publicKey||Xv.names.primal,N=E_(b.notes,b.paging.notes),{notes:$,userPolls:F,zapPolls:D,paging:L}=await eh(H,T,`home_feed_${Ee}`,[G.Text,G.Repost,G.UserPoll,G.ZapPoll],{until:I,limit:20,offset:N}),m=$0([...$,...F,...D],L);E("paging","notes",()=>({...L})),E("notes",S=>[...S,...m]),E("isFetching",()=>!1)},"fetchNotes"),c=a(()=>{E("scrollTop",()=>0),window.scrollTo({top:0}),E("notes",()=>[]),E("paging","notes",()=>({since:0,until:0,sortBy:"created_at"})),r()},"clearNotes"),u=a(T=>{if(b.isFetching)return;const I=T||b.selectedFeed?.spec||"",M=b.paging.notes.since||0;M>0&&d(I,M)},"fetchNextPage"),f=a(T=>{E("scrollTop",()=>T)},"updateScrollTop");let h;const p=a((T,I)=>{T?.spec!==void 0&&T.spec!==h?.spec&&(h={...T},E("selectedFeed",Si({...T})),SN(z.publicKey,"home",T),c(),d(T.spec,0))},"selectFeed"),g=a(()=>{b.selectedFeed&&(c(),d(b.selectedFeed.spec,0))},"refetchSelectedFeed"),v=a(()=>{h=void 0,E("selectedFeed",()=>{})},"resetSelectedFeed"),y=a(()=>{const T=b.selectedFeed;T?.spec&&(c(),d(T.spec,0,!1))},"getFirstPage");We(oi(()=>e?.homeFeedsReloaded,T=>{if(!T)return;const I=wN(z.publicKey,"home")||e?.homeFeeds[0];p(I)}));const[b,E]=li({...Ile,actions:{clearNotes:c,fetchNotes:d,fetchNextPage:u,selectFeed:p,updateScrollTop:f,checkForNewNotes:o,loadFutureContent:l,doSidebarSearch:s,updateSidebarQuery:i,getFirstPage:y,resetSelectedFeed:v,refetchSelectedFeed:g,removeEvent:n}});return X(RB.Provider,{value:b,get children(){return t.children}})},"HomeProvider"),Rle=a(()=>Dn(RB),"useHomeContext"),kle={previewDVM:void 0,previewDVMStats:void 0,previewDVMMetadata:void 0,previewDVMAuthor:void 0,previewDVMActions:void 0,previewDVMUsers:{},previewDVMFollows:[],explorePeople:[],peoplePaging:{since:0,until:0,sortBy:"created_at",elements:[]},exploreZaps:[],zapPaging:{since:0,until:0,sortBy:"created_at",elements:[]},zapSubjects:{notes:[],reads:[],users:[]},exploreMedia:[],mediaPaging:{since:0,until:0,sortBy:"created_at",elements:[]},exploreTopics:[],notes:[],isFetching:!1,scope:"global",timeframe:"latest",selectedTab:"feeds",page:{messages:[],users:{},postStats:{},mentions:{},noteActions:{},topZaps:{}},reposts:{},lastNote:void 0,isNetStatsStreamOpen:!1,stats:{users:0,pubkeys:0,pubnotes:0,reactions:0,reposts:0,any:0,zaps:0,satszapped:0},legend:{your_follows:0,your_inner_network:0,your_outer_network:0}},kB=Pn(),Mle=a(t=>{Or(()=>{const D=Lq(),L=kq();F("stats",()=>({...D})),F("exploreTopics",()=>[...L])});const e=a((D,L)=>{F(L,m=>m.filter(S=>S.noteId!==D))},"removeEvent"),n=a((D,L,m)=>{const S=mle(D,L,m);F("explorePeople",_=>[..._,...S]),F("peoplePaging",()=>({...L}))},"setExplorePeople"),i=a((D,L,m)=>{const S=TB(D,L);F("exploreZaps",_=>[..._,...S]),F("zapPaging",()=>({...L})),F("zapSubjects",_=>({notes:[..._.notes,...m.notes],reads:[..._.reads,...m.reads],users:[..._.users,...m.users]}))},"setExploreZaps"),s=a((D,L)=>{const m=SB(D,L);F("exploreMedia",S=>[...S,...m]),F("mediaPaging",()=>({...L}))},"setExploreMedia"),r=a(D=>{F("exploreTopics",()=>[...D]),Rq(D)},"setExploreTopics"),o=a((D,L,m,S,_,A,x)=>{Aa(()=>{F("previewDVM",()=>D?{...D}:void 0),F("previewDVMStats",()=>L?{...L}:void 0),F("previewDVMMetadata",()=>m?{...m}:void 0),F("previewDVMAuthor",()=>S?{...S}:void 0),F("previewDVMActions",()=>_?{..._}:void 0),F("previewDVMUsers",()=>A?{...A}:{}),F("previewDVMFollows",()=>x?[...x]:[])})},"setPreviewDVM"),l=a(D=>{F("selectedTab",()=>D)},"selectTab"),d=a(D=>{F("notes",L=>[...L,...D]),F("isFetching",()=>!1)},"saveNotes"),c=a((D,L=0,m=20)=>{const[S,_]=D.split(";");if(S&&_){F("isFetching",!0),F("page",()=>({messages:[],users:{},postStats:{}})),F("scope",()=>S),F("timeframe",()=>_);const A=`explore_${Ee}`;fi(A,()=>rK(z.publicKey||"",A,S,_,L,m),b,E);return}},"fetchNotes"),u=a(()=>{F("page",()=>({messages:[],users:{},postStats:{},noteActions:{}})),F("notes",()=>[]),F("reposts",()=>{}),F("lastNote",()=>{})},"clearNotes"),f=a(()=>{const D=$.notes[$.notes.length-1];if(!D)return;F("lastNote",()=>({...D}));const L=cne($.timeframe),S=(D.repost?D.repost.note:D.post)[L];S>0&&c(`${$.scope};${$.timeframe}`,S)},"fetchNextPage"),h=a(D=>
2155{if(D.kind===G.Metadata){const L=D;F("page","users",m=>({...m,[L.pubkey]:{...L}}));return}if([G.Text,G.Repost].includes(D.kind)){const L=D;$.lastNote?.id!==L.id&&F("page","messages",m=>[...m,{...L}]);return}if(D.kind===G.NoteStats){const m=JSON.parse(D.content);F("page","postStats",S=>({...S,[m.event_id]:{...m}}));return}if(D.kind===G.Mentions){const m=JSON.parse(D.content);F("page","mentions",S=>({...S,[m.id]:{...m}}));return}if(D.kind===G.NoteActions){const m=JSON.parse(D.content);F("page","noteActions",S=>({...S,[m.event_id]:{...m}}));return}if(D?.kind===G.Zap){const L=D.tags.find(R=>R[0]==="description");if(!L)return;const m=JSON.parse(L[1]||"{}");let S="0",_=D?.tags?.find(R=>R[0]==="bolt11");if(_)try{S=`${vs(_[1])||0}`}catch{const w=m.tags.find(P=>P[0]==="amount");S=w?w[1]:"0"}const A=(m.tags.find(R=>R[0]==="e")||[])[1],x={id:m.id,amount:parseInt(S||"0"),pubkey:m.pubkey,message:m.content,eventId:A},C=$.page.topZaps[A];if(C===void 0){F("page","topZaps",()=>({[A]:[{...x}]}));return}if(C.find(R=>R.id===x.id))return;const U=[...C,{...x}].sort((R,w)=>w.amount-R.amount);F("page","topZaps",A,()=>[...U]);return}},"updatePage"),p=a(D=>{const m=lne($.timeframe)(Va(D,D.topZaps));d(m)},"savePage"),g=a(()=>{yne(Ee)},"openNetStatsStream"),v=a(()=>{bne(Ee)},"closeNetStatsStream"),y=a(D=>{D&&Ene(D,Ee)},"fetchLegendStats"),b=a(D=>{h(D)},"handleExploreEvent"),E=a(()=>{const D=yU($.page),L=Object.keys(D);if(L.length===0){p($.page);return}F("reposts",()=>D);const m=`explore_reposts_${Ee}`;fi(m,()=>lu(z.publicKey,L,m),T,I)},"handleExploreEose"),T=a(D=>{const L=D.id,m=$.reposts||{},S=$.page.messages.find(_=>_.id===m[L]);S&&F("page","messages",_=>_.id===S.id,"content",()=>JSON.stringify(D))},"handleExploreRepostEvent"),I=a(()=>{p($.page)},"handleExploreRepostEose"),M=a(D=>{const L=JSON.parse(D.content||"{}");D.kind===G.NetStats&&(F("stats",()=>({...L})),Iq(L)),D.kind===G.LegendStats&&F("legend",()=>({...L}))},"handleExploreStatsEvent"),H=a(async D=>{const L=await su(D),m=JSON.parse(L),[S,_,A]=m;if([`netstats_${Ee}`,`legendstats_${Ee}`].includes(_)){if(S==="EVENTS")for(let x=0;x<A.length;x++){const C=A[x];M(C)}S==="EVENT"&&M(A)}},"onMessage"),N=a(D=>{const L=D.target;Da(L,{message:H,close:N})},"onSocketClose");We(()=>{Pa()&&Qv(yn(),{message:H,close:N})}),Tt(()=>{Da(yn(),{message:H,close:N})});const[$,F]=li({...kle,actions:{saveNotes:d,fetchNotes:c,clearNotes:u,fetchNextPage:f,updatePage:h,savePage:p,openNetStatsStream:g,closeNetStatsStream:v,fetchLegendStats:y,selectTab:l,setPreviewDVM:o,setExplorePeople:n,setExploreZaps:i,setExploreMedia:s,setExploreTopics:r,removeEvent:e}});return X(kB.Provider,{value:$,get children(){return t.children}})},"ExploreProvider"),Cle=a(()=>Dn(kB),"useExploreContext"),Ple={primaryNote:void 0,noteId:"",notes:[],users:[],isFetching:!1,isFetchingTopZaps:!1,page:{messages:[],users:{},postStats:{},mentions:{},noteActions:{},topZaps:{}},reposts:{},lastNote:void 0,topZaps:{},quoteCount:0,highlights:[]},MB=Pn(),Dle=a(t=>{const e=a((N,$)=>{H($,F=>F.filter(D=>D.noteId!==N))},"removeEvent"),n=a(N=>{const $=M.notes.map(D=>D.post.id),F=N.filter(D=>!$.includes(D.post.id));H("notes",D=>[...F,...D]),H("isFetching",()=>!1)},"saveNotes"),i=a(async(N,$=0,F=100)=>{H("isFetching",()=>!0);const{notes:D,userPolls:L,zapPolls:m,users:S}=await dle(z.publicKey,N),_=one([...D,...L,...m]);H("notes",()=>[..._]),H("users",()=>[...S]),H("isFetching",()=>!1)},"fetchNotes"),s=a(N=>{H("notes",$=>[{...N},...$])},"insertNote"),r=a((N,$=0,F=100)=>{H("page",()=>({messages:[],users:{},postStats:{},noteActions:{},mentions:{}}));const D=`thread_diff_${Ee}`;fi(D,()=>iK(z.publicKey,N,D,$,F),p,g)},"updateNotes"),o=a(()=>{H("page",()=>({messages:[],users:{},postStats:{},noteActions:{},mentions:{}})),H("notes",()=>[]),H("reposts",()=>{}),H("lastNote",()=>{})},"clearNotes"),l=a(()=>{const N=M.notes[M.notes.length-1];N&&H("lastNote",()=>({...N}))},"fetchNextPage"),d=a(N=>{if(N.kind===G.WordCount){const $=JSON.parse(N.content);H("page","wordCount",()=>({[$.event_id]:$.words}));return}if(N.kind===G.Metadata){const $=N;H("page","users",F=>({...F,[$.pubkey]:{...$}}));return}if([G.Text,G.Repost].includes(N.kind)){const $=N;M.lastNote?.id!==$.id&&H("page","messages",F=>[...F,{...$}]);return}if(N.kind===G.NoteStats){const F=JSON.parse(N.content);H("page","postStats",D=>({...D,[F.event_id]:{...F}}));return}if(N.kind===G.Mentions){const F=JSON.parse(N.content);if(F.kind===G.LongFormShell){const D=`${F.kind}:${F.pubkey}:${(F.tags.find(L=>L[0]==="d")||[])[1]}`;H("page","mentions",L=>({...L,[D]:{...F}}));return}H("page","mentions",D=>({...D,[F.id]:{...F}}));return}if(N.kind===G.NoteActions){const F=JSON.parse(N.content);H("page","noteActions",D=>({...D,[F.event_id]:{...F}}));return}if(N.kind===G.LinkMetadata){Io(JSON.parse(N.content));return}if(N.kind===G.RelayHint){const $=JSON.parse(N.content);H("page","relayHints",F=>({...F,...$}))}if(N?.kind===G.Zap){const $=N.tags.find(x=>x[0]==="description");if(!$)return;const F=JSON.parse($[1]||"{}");let D="0",L=N?.tags?.find(x=>x[0]==="bolt11");
2155if(L)try{D=`${vs(L[1])||0}`}catch{const C=F.tags.find(U=>U[0]==="amount");D=C?C[1]:"0"}const m=(F.tags.find(x=>x[0]==="e")||[])[1],S={id:F.id,amount:parseInt(D||"0"),pubkey:F.pubkey,message:F.content,eventId:m},_=M.topZaps[m];if(_===void 0){H("topZaps",()=>({[m]:[{...S}]}));return}if(_.find(x=>x.id===S.id))return;const A=[..._,{...S}].sort((x,C)=>C.amount-x.amount);H("topZaps",m,()=>[...A]);return}if(N.kind===G.NoteQuoteStats){const $=JSON.parse(N.content);H("quoteCount",()=>$.count||0)}},"updatePage"),c=a(N=>{const $=bU(Va(N,M.topZaps)),F=Object.values(N.users).map(D=>dt(D,D.pubkey));H("users",()=>[...F]),n($)},"savePage"),u=a(N=>{H("primaryNote",()=>({...N}))},"setPrimaryNote"),f=a(N=>{H("isFetchingTopZaps",()=>!0);const $=`thread_zapps_${Ee}`;fi($,()=>nne(N,z.publicKey,$,10,0),b,E)},"fetchTopZaps"),h=a(N=>{const $=`thread_pk_${Ee}`;fi($,()=>Na(N,$),T,I)},"fetchUsers"),p=a(N=>{d(N)},"handleThreadEvent"),g=a(()=>{const N=yU(M.page),$=Object.keys(N);if($.length===0){c(M.page);return}H("reposts",()=>N);const F=`thread_reposts_${Ee}`;fi(F,()=>lu(z.publicKey,$,F),v,y)},"handleThreadEose"),v=a(N=>{const $=N.id,F=M.reposts||{},D=M.page.messages.find(L=>L.id===F[$]);D&&H("page","messages",L=>L.id===D.id,"content",()=>JSON.stringify(N))},"handleThreadRepostEvent"),y=a(()=>{c(M.page)},"handleThreadRepostEose"),b=a(N=>{d(N)},"handleThreadZapsEvent"),E=a(()=>{c(M.page),H("isFetchingTopZaps",()=>!1)},"handleThreadZapsEose"),T=a(N=>{d(N)},"handleThreadPKEvent"),I=a(()=>{c(M.page)},"handleThreadPKEose"),[M,H]=li({...Ple,actions:{saveNotes:n,fetchNotes:i,updateNotes:r,clearNotes:o,fetchNextPage:l,updatePage:d,savePage:c,setPrimaryNote:u,fetchTopZaps:f,fetchUsers:h,insertNote:s,removeEvent:e}});return X(MB.Provider,{value:M,get children(){return t.children}})},"ThreadProvider"),Ole=a(()=>Dn(MB),"useThreadContext"),nwe=a((t,e,n,i="all",s=0,r=100)=>{if(!e)return;let o={pubkey:e,limit:r,since:s,type_group:i};t&&(o.user_pubkey=t),Ae(JSON.stringify(["REQ",n,{cache:["get_notifications",o]}]))},"getNotifications"),iwe=a((t,e,n,i="all",s=0,r=20)=>{if(!e)return;let o={pubkey:e,limit:r,until:s,type_group:i};t&&(o.user_pubkey=t),Ae(JSON.stringify(["REQ",n,{cache:["get_notifications",o]}]))},"getOldNotifications"),Nle=a((t,e)=>{t&&Ae(JSON.stringify(["REQ",e,{cache:["get_notifications_seen",{pubkey:t}]}]))},"getLastSeen"),swe=a(async(t,e)=>{const n={content:'{ "description": "update notifications last seen timestamp"}',kind:G.Settings,tags:[["d",Zt,Qe.nofiticationsLastSeen]],created_at:e};try{const i=await Nt(n,{isRead:!0});return Ae(JSON.stringify(["REQ",t,{cache:["set_notifications_seen",{event_from_user:i}]}])),!0}catch(i){return console.error("Failed to set last seen: ",i),!1}},"setLastSeen"),Fle=a((t,e)=>{Ae(JSON.stringify(["REQ",e,{cache:["notification_counts",{pubkey:t,subid:e}]}]))},"subscribeToNotificationStats"),GM=a(t=>{Ae(JSON.stringify(["CLOSE",t,{cache:["notification_counts",{subid:t}]}]))},"unsubscribeToNotificationStats"),rwe=a((t,e)=>{const s=Math.pow(1e3,e||1);return t<s?t.toLocaleString():t<Math.pow(1e3,2)?`${Math.floor(t/1e3).toLocaleString()}K`:t<Math.pow(1e3,3)?`${Math.floor(t/Math.pow(1e3,2)).toLocaleString()}M`:t<Math.pow(1e3,4)?`${Math.floor(t/Math.pow(1e3,3)).toLocaleString()}B`:"1T+"},"truncateNumber"),owe=a((t,e)=>{const s=Math.pow(1e3,e||1);return t<s?t.toLocaleString():t<Math.pow(1e3,2)?`${(t/1e3).toFixed(1)}K`:t<Math.pow(1e3,3)?`${(t/Math.pow(1e3,2)).toFixed(1)}M`:t<Math.pow(1e3,4)?`${(t/Math.pow(1e3,3)).toFixed(1)}B`:"1T+"},"truncateNumber2"),Ule={notificationCount:0,downloadsCount:0};let CB=BK();const VM=a(t=>{CB=t},"setNotifSince"),PB=Pn(),Ble=a(t=>{const e=Wp(),n=gu(),i=a(()=>new Date().getTime(),"today");let s="|";const r=a(()=>`notif_stats_${s}_${Ee}`,"notfiStatsSubId"),o=a(()=>{s!==z.publicKey&&(GM(r()),s=""),z.publicKey&&(s=z.publicKey,Fle(z.publicKey,r()))},"subToNotificationStats"),l=a(()=>{const g=localStorage.getItem("iosDownload"),v=localStorage.getItem("andDownload"),y=e?.mobileReleases.ios||{date:tO,version:nO},b=e?.mobileReleases.android||{date:iO,version:sO};let E=0;g!==y.version&&i()>new Date(y.date).getTime()&&E++,v!==b.version&&i()>new Date(b.date).getTime()&&E++,p("downloadsCount",()=>E)},"calculateDownloadCount"),d=a(()=>p("notificationCount",()=>0),"resetNotificationCounter"),c=a(g=>{if(g?.kind===G.NotificationStats){const v=Object.keys(g).reduce((y,b)=>b==="pubkey"||b=="kind"?y:y+g[b],0);v!==h.notificationCount&&p("notificationCount",()=>v),l()}},"handleNotifStatsEvent"),u=a(async g=>{const v=await su(g),y=JSON.parse(v),[b,E,T]=y;if(E===r()){if(b==="EVENTS")for(let I=0;I<T.length;I++){const M=T[I];c(M)}b==="EVENT"&&c(T)}},"onMessage"),f=a(g=>{const v=g.target;Da(v,{message:u,close:f})},"onSocketClose");
2155We(()=>{Pa()&&z.isKeyLookupDone&&Ma()&&!n?.isInactive?o():GM(r())}),We(()=>{Pa()&&Qv(yn(),{message:u,close:f})}),We(()=>{const g=z.publicKey;if(g){const v=`notif_ls_${Ee}`,y=Me(v,{onEvent:(b,E)=>{if(E?.kind===G.Timestamp){const T=parseInt(E.content);isNaN(T)||VM(T),y();return}},onEose:()=>{CB||VM(0)}});Nle(g,v);return}p("notificationCount",()=>0)}),Tt(()=>{Da(yn(),{message:u,close:f})});const[h,p]=li({...Ule,actions:{resetNotificationCounter:d,calculateDownloadCount:l}});return X(PB.Provider,{value:h,get children(){return t.children}})},"NotificationsProvider"),$le=a(()=>Dn(PB),"useNotificationsContext"),Hle=a(()=>({any:[],follows:[],other:[]}),"emptyDMContacts"),Gle=a(()=>({dmCountPerContact:{},dmCountUnread:0,dmContacts:{...Hle()},contactsPaging:{...jn()},dmCount:0,lastMessageCheck:0,lastConversationContact:void 0,lastConversationRelation:"follows",encryptedMessages:[],messages:[],conversationPaging:{...jn()},isFetchingMessages:!1,referecedUsers:{},referecedNotes:{},referecedReads:{},referencePage:{messages:[],users:{},postStats:{},mentions:{},noteActions:{},topZaps:{}}}),"emptyDMStore"),DB=Pn(),Vle=a(t=>{const e=gu();let n,i="";const s=a(()=>`dm_count_${Math.random()*35e3}_${Ee}`,"subidMsgCount"),r=a((R,w,P)=>{const V=P?.update||"add",Z=C.dmContacts[w],ee=Z.map(ge=>ge.pubkey);let ne=[];V==="replace"?(ne=[...R].sort((ie,j)=>j.dmInfo.latest_at-ie.dmInfo.latest_at),ne=[...Z.filter(ie=>!R.map(j=>j.pubkey).includes(ie.pubkey)),...ne]):V==="add"?(ne=[...R.filter(ie=>!ee.includes(ie.pubkey))].sort((ie,j)=>j.dmInfo.latest_at-ie.dmInfo.latest_at),ne=[...Z,...ne]):ne=[...R].sort((ge,ie)=>ie.dmInfo.latest_at-ge.dmInfo.latest_at),U("dmContacts",w,()=>[...ne]);const se=R.find(ge=>ge.pubkey===C.lastConversationContact?.pubkey);se&&(U("lastConversationContact","dmInfo","cnt",()=>se.dmInfo.cnt),U("lastConversationContact","dmInfo","latest_at",()=>se.dmInfo.latest_at),U("lastConversationContact","dmInfo","latest_event_id",()=>se.dmInfo.latest_event_id))},"setDmContacts"),o=a(()=>{U("lastConversationRelation",()=>"any")},"resetRelation"),l=a(async R=>{if(z.publicKey)return U("contactsPaging",()=>({...jn()})),U("lastConversationRelation",()=>R),Rk(z.publicKey,R),await f(R)},"setDmRelation"),d=a(R=>{z.publicKey&&(U("contactsPaging",()=>({...jn()})),U("lastConversationRelation",()=>R),Rk(z.publicKey,R),c(R))},"setDmRelation2"),c=a(async R=>{const w=C.dmContacts[R]||[],{dmContacts:P,paging:V}=await xg(z.publicKey,R,`dm_contacts_${R}_${Ee}`,{limit:w.length});U("contactsPaging",()=>({...V})),r(P,R,{update:"clear"})},"replaceContacts"),u=a(async R=>{const w=C.dmContacts[R]||[],{dmContacts:P,paging:V}=await xg(z.publicKey,R,`dm_contacts_${R}_${Ee}`,{limit:w.length});U("contactsPaging",()=>({...V})),r(P,R,{update:"replace"})},"refreshContacts"),f=a(async R=>{const w=C.dmContacts[R]||[],P=C.contactsPaging.since||0,V=GK(w,C.conversationPaging),{dmContacts:Z,paging:ee}=await xg(z.publicKey,R,`dm_contacts_${R}_${Ee}`,{limit:20,since:P,offset:V});return U("contactsPaging",()=>({...ee})),r(Z,R,{update:"replace"})},"getContacts"),h=a(async R=>{const w=C.contactsPaging.since||0,P=1;if(w===0)return;const{dmContacts:V,paging:Z}=await xg(z.publicKey,R,`dm_contacts_${R}_${Ee}`,{limit:20,since:w,offset:P});U("contactsPaging",()=>({...Z})),r(V,R)},"getContactsNextPage");let p="";const g=a(async R=>{if(C.isFetchingMessages||!z.publicKey||p===R)return;p=R;const w=C.lastConversationRelation;let P=C.dmContacts[w].find(V=>V.pubkey===R);if(!P)try{let V=await vne(z.publicKey,R,`dm_contact_info_${Ee}`);v(V),P={pubkey:V.pubkey,user:V,dmInfo:{cnt:0,latest_at:0,latest_event_id:""}}}catch{P={pubkey:R,user:{...Op(R)},dmInfo:{cnt:0,latest_at:0,latest_event_id:""}}}await L(P.pubkey,w),U("lastConversationContact",()=>({...P})),Tq(z.publicKey,R),U("messages",()=>[]),U("conversationPaging",()=>({...jn()})),U("isFetchingMessages",()=>!0),await T(R),p=""},"selectContact"),v=a(async R=>{const w=z.following.includes(R.pubkey),P={pubkey:R.pubkey,user:{...R},dmInfo:{cnt:0,latest_at:0,latest_event_id:""}};if(w){if(await l("follows"),C.dmContacts.follows.find(V=>V.pubkey===R.pubkey)){g(R.pubkey);return}U("dmContacts","follows",V=>[{...P},...V])}else{if(await l("other"),C.dmContacts.other.find(V=>V.pubkey===R.pubkey)){g(R.pubkey);return}U("dmContacts","other",V=>[{...P},...V])}g(R.pubkey)},"addContact"),y=a((R,w)=>new Promise(P=>{oU(R,w).then(V=>{P(V)}).catch(V=>{ii("Failed to decrypt, will retry: ",w,V),P("")})}),"actualDecrypt"),b=a(async(R,w,P)=>{let V=[];for(let Z=0;Z<w.length;Z++){const ee=w[Z];try{const ne=await y(R,ee.content);if(ne==="")throw ee.content;const se={sender:ee.pubkey,content:Sn(ne),created_at:ee.created_at,id:ee.id};V.push(se)}catch(ne){console.warn("Falied to decrypt message: ",ne);continue}}await E(V),P(V)},"decryptMessages"),E=a(async R=>
2155{const w=/\bnostr:((note|nevent)1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]+)\b|#\[(\d+)\]/g,P=/\bnostr:((npub|nprofile)1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]+)\b|#\[(\d+)\]/g;let V=[],Z=[],ee;for(let j=0;j<R.length;j++){const Y=R[j];for(;(ee=w.exec(Y.content))!==null;)V.push(ee[1]);for(;(ee=P.exec(Y.content))!==null;)Z.push(ee[1])}const ne=Z.map(j=>{try{const Y=Ce.decode(j);return Y.type==="npub"?Y.data:Y.type==="nprofile"?Y.data.pubkey:""}catch(Y){return ii("Unable to decode npub: ",Y),""}}).filter(j=>j.length>0),se=V.map(j=>{const Y=Ce.decode(j);return Y.type==="note"?Y.data:Y.type==="nevent"?Y.data.id:""});U("referencePage",()=>({messages:[],users:{},postStats:{},mentions:{},noteActions:{}}));const ge=`msg_note_ ${Ee}`,ie=`msg_user_ ${Ee}`;await wk(ie,()=>Na(ne,ie),m,S),await wk(ge,()=>lu(z.publicKey,se,ge,!0),_,A)},"parseForMentions"),T=a(async R=>{if(!z.isKeyLookupDone||!Ma()||!R)return;U("encryptedMessages",()=>[]);const w=`dm_conversation_ ${Ee}`,P=C.conversationPaging.since||0,V=HK(C.messages,C.conversationPaging),{encryptedMessages:Z,paging:ee}=await hle(z.publicKey,R,w,{limit:20,since:P,offset:V});U("encryptedMessages",()=>[...Z]),U("conversationPaging",()=>({...ee})),b(R,C.encryptedMessages,ne=>{U("messages",se=>[...se,...ne]),U("isFetchingMessages",()=>!1)})},"getConversation"),I=a(()=>{C.messages.length===0||!C.conversationPaging.since||T(C.lastConversationContact?.pubkey)},"getConversationNextPage"),M=a(async R=>{if(!R)return;U("encryptedMessages",()=>[]);const w=`dm_conversation_new_ ${Ee}`,P=C.conversationPaging.until||0,{encryptedMessages:V,paging:Z}=await ple(z.publicKey,R,w,{limit:20,since:P,offset:0});U("encryptedMessages",()=>[...V]),U("conversationPaging",()=>({...Z})),b(R,C.encryptedMessages,ee=>{const ne=C.messages.map(ge=>ge.id),se=ee.filter(ge=>!ne.includes(ge.id));U("messages",ge=>[...se,...ge]),U("isFetchingMessages",()=>!1),L(R,C.lastConversationRelation)})},"getConversationNewMessages"),H=a(()=>{const R=C.referencePage.users,w=Object.keys(R).reduce((P,V)=>{const Z=dt(R[V],V);return{...P,[Z.pubkey]:{...Z}}},{});U("referecedUsers",P=>({...P,...w}))},"updateRefUsers"),N=a(()=>{const w=(Va(C.referencePage)||[]).reduce((P,V)=>({...P,[V.post.noteId]:V}),{});U("referecedNotes",P=>({...P,...w}))},"updateRefNotes"),$=a((R,w)=>{for(let P=0;P<R.length;P++){const V=R[P];if(w&&V.sender===z.publicKey)return;U("messages",Z=>[{...V},...Z])}},"addToConversation"),F=a(async(R,w)=>{try{const V={content:await Z1(R,w.content),kind:G.EncryptedDirectMessage,tags:[["p",R]],created_at:Math.floor(new Date().getTime()/1e3)},{success:Z,note:ee}=await Vn(V);if(Z&&ee){const ne=`import_dm_${Ee}`,se=Me(ne,{onEose:()=>{se();const ge={...w,content:Sn(w.content)};$([ge]),u(C.lastConversationRelation)}});aU([ee],ne)}return Z}catch(P){return Tn("Failed to send message: ",P),!1}},"sendMessage"),D=a(async()=>await ale(`dm_all_read_${Ee}`),"resetAllMessages"),L=a(async(R,w)=>{const P=await ile(R,`dm_reset_msg_${R}_${Ee}`);return P&&(U("dmContacts",w,V=>V.pubkey===R,"dmInfo","cnt",()=>0),C.lastConversationContact&&U("lastConversationContact","dmInfo","cnt",()=>0)),P},"resetContactMessages"),m=a(R=>{if(R?.kind===G.Metadata){const w=R;U("referencePage","users",P=>({...P,[w.pubkey]:{...w}}))}},"handleUserRefEvent"),S=a(()=>{H()},"handleUserRefEose"),_=a(R=>{if(R?.kind===G.Metadata){const w=R;U("referencePage","users",P=>({...P,[w.pubkey]:{...w}}))}if([G.Text,G.Repost].includes(R.kind)){const w=R;U("referencePage","messages",P=>[...P,{...w}]);return}if(R.kind===G.NoteStats){const P=JSON.parse(R.content);U("referencePage","postStats",V=>({...V,[P.event_id]:{...P}}));return}if(R.kind===G.Mentions){const P=JSON.parse(R.content);U("referencePage","mentions",V=>({...V,[P.id]:{...P}}));return}if(R.kind===G.NoteActions){const P=JSON.parse(R.content);U("referencePage","noteActions",V=>({...V,[P.event_id]:{...P}}));return}},"handleNoteRefEvent"),A=a(()=>{N(),H()},"handleNoteRefEose"),x=a(()=>{!z.publicKey||n!==void 0||(i=s(),n=Me(i,{onEvent:(R,w)=>{if(w?.kind===G.MessageStats){const P=parseInt(w.cnt);P!==C.dmCount&&U("dmCount",()=>P)}}}),tle(z.publicKey,i))},"subToMessagesStats");We(()=>{Pa()&&z.isKeyLookupDone&&Ma()&&!e?.isInactive?x():e?.isInactive&&(nle(i),n=void 0)}),We(oi(()=>C.lastConversationContact?.dmInfo.cnt,(R,w)=>{!R||R===w||w&&R<w||M(C.lastConversationContact?.pubkey)})),We(()=>{if(!z.publicKey){n&&n(),n=void 0,U("dmCount",()=>0);return}n||x()});const[C,U]=li({...Gle(),actions:{setDmContacts:r,setDmRelation:l,setDmRelation2:d,getContacts:f,getContactsNextPage:h,refreshContacts:u,selectContact:g,addContact:v,getConversation:T,getConversationNextPage:I,sendMessage:F,resetAllMessages:D,resetRelation:o}});return X(DB.Provider,{value:C,get children(){return t.children}})},"DMProvider"),Wle=a(()=>Dn(DB),"useDMContext");function zle(t={}){const[e,n]=vF({value:()=>St(t.isSelected),defaultValue:()=>!!St(t.defaultIsSelected),onChange:r=>t.onSelectedChange?.(r)});return{isSelected:e,setIsSelected:a(r=>{!St(t.isReadOnly)&&!St(t.isDisabled)&&n(r)},"setIsSelected"),toggle:a(()=>{!St(t.isReadOnly)&&!St(t.isDisabled)&&n(!e())},"toggle")}}a(zle,"createToggleState");var Kle={};Ty(Kle,{Checkbox:()=>Oc,Control:()=>NB,Description:()=>
2155FB,ErrorMessage:()=>UB,Indicator:()=>BB,Input:()=>$B,Label:()=>HB,Root:()=>GB});var OB=Pn();function mu(){const t=Dn(OB);if(t===void 0)throw new Error("[kobalte]: `useCheckboxContext` must be used within a `Checkbox` component");return t}a(mu,"useCheckboxContext");function NB(t){const e=Ga(),n=mu(),i=mi({id:n.generateId("control")},t),[s,r]=Gn(i,["onClick","onKeyDown"]);return X(is,Yt({as:"div",onClick:a(d=>{Pr(d,s.onClick),n.toggle(),n.inputRef()?.focus()},"onClick"),onKeyDown:a(d=>{Pr(d,s.onKeyDown),d.key===h1.Space&&(n.toggle(),n.inputRef()?.focus())},"onKeyDown")},()=>e.dataset(),()=>n.dataset(),r))}a(NB,"CheckboxControl");function FB(t){const e=mu();return X($1,Yt(()=>e.dataset(),t))}a(FB,"CheckboxDescription");function UB(t){const e=mu();return X(G1,Yt(()=>e.dataset(),t))}a(UB,"CheckboxErrorMessage");function BB(t){const e=Ga(),n=mu(),[i,s]=Je(),r=mi({id:n.generateId("indicator")},t),[o,l]=Gn(r,["ref","forceMount"]),{present:d}=N_({show:()=>o.forceMount||n.indeterminate()||n.checked(),element:()=>i()??null});return X(sn,{get when(){return d()},get children(){return X(is,Yt({as:"div",ref(c){var u=js(s,o.ref);typeof u=="function"&&u(c)}},()=>e.dataset(),()=>n.dataset(),l))}})}a(BB,"CheckboxIndicator");function $B(t){let e;const n=Ga(),i=mu(),s=mi({id:i.generateId("input")},t),[r,o,l]=Gn(s,["ref","style","onChange","onFocus","onBlur"],kF),{fieldProps:d}=MF(o),[c,u]=Je(!1),f=a(g=>{if(Pr(g,r.onChange),g.stopPropagation(),!c()){const v=g.target;i.setIsChecked(v.checked),v.checked=i.checked()}u(!1)},"onChange"),h=a(g=>{Pr(g,r.onFocus),i.setIsFocused(!0)},"onFocus"),p=a(g=>{Pr(g,r.onBlur),i.setIsFocused(!1)},"onBlur");return We(oi([()=>i.checked(),()=>i.value()],()=>{u(!0),e?.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!0})),e?.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}))},{defer:!0})),We(oi([()=>e,()=>i.indeterminate(),()=>i.checked()],([g,v])=>{g&&(g.indeterminate=v)})),X(is,Yt({as:"input",ref(g){var v=js(y=>{i.setInputRef(y),e=y},r.ref);typeof v=="function"&&v(g)},type:"checkbox",get id(){return d.id()},get name(){return n.name()}
2155,get value(){return i.value()},get checked(){return i.checked()},get required(){return n.isRequired()},get disabled(){return n.isDisabled()},get readonly(){return n.isReadOnly()},get style(){return uN(b1,r.style)},get"aria-label"(){return d.ariaLabel()},get"aria-labelledby"(){return d.ariaLabelledBy()},get"aria-describedby"(){return d.ariaDescribedBy()},get"aria-invalid"(){return n.validationState()==="invalid"||void 0},get"aria-required"(){return n.isRequired()},get"aria-disabled"(){return n.isDisabled()},get"aria-readonly"(){return n.isReadOnly()},onChange:f,onFocus:h,onBlur:p},()=>n.dataset(),()=>i.dataset(),l))}a($B,"CheckboxInput");function HB(t){const e=mu();return X(H1,Yt(()=>e.dataset(),t))}a(HB,"CheckboxLabel");function GB(t){let e;const n=`checkbox-${Ap()}`,i=mi({value:"on",id:n},t),[s,r,o]=Gn(i,["ref","children","value","checked","defaultChecked","indeterminate","onChange","onPointerDown"],LF),[l,d]=Je(),[c,u]=Je(!1),{formControlContext:f}=RF(r),h=zle({isSelected:()=>s.checked,defaultIsSelected:()=>s.defaultChecked,onSelectedChange:y=>s.onChange?.(y),isDisabled:()=>f.isDisabled(),isReadOnly:()=>f.isReadOnly()});CF(()=>e,()=>h.setIsSelected(s.defaultChecked??!1));const p=a(y=>{Pr(y,s.onPointerDown),c()&&y.preventDefault()},"onPointerDown"),g=ht(()=>({"data-checked":h.isSelected()?"":void 0,"data-indeterminate":s.indeterminate?"":void 0})),v={value:()=>s.value,dataset:g,checked:()=>h.isSelected(),indeterminate:()=>s.indeterminate??!1,inputRef:l,generateId:fy(()=>St(r.id)),toggle:()=>h.toggle(),setIsChecked:y=>h.setIsSelected(y),setIsFocused:u,setInputRef:d};return X(B1.Provider,{value:f,get children(){return X(OB.Provider,{value:v,get children(){return X(is,Yt({as:"div",ref(y){var b=js(E=>e=E,s.ref);typeof b=="function"&&b(y)},role:"group",get id(){return St(r.id)},onPointerDown:p},()=>f.dataset(),g,o,{get children(){return X(qle,{state:v,get children(){return s.children}})}}))}})}})}a(GB,"CheckboxRoot");function qle(t){const e=Tp(()=>{const n=t.children;return fN(n)?n(t.state):n});return ps(e)}a(qle,"CheckboxRootChild");var Oc=Object.assign(GB,{Control:NB,Description:FB,ErrorMessage:UB,Indicator:BB,Input:$B,Label:HB});const jle="_checkbox_o7c3r_1",Yle="_checkbox2_o7c3r_18",Zle="_control_o7c3r_22",Qle="_label_o7c3r_31",Jle="_checkIcon_o7c3r_38",Xle="_icon_o7c3r_46",ece="_radioGroup_o7c3r_52",tce="_radioGroupLabel_o7c3r_57",nce="_radioItems_o7c3r_63",ice="_radioItemsWithDesc_o7c3r_68",sce="_radioItem_o7c3r_63",rce="_radioControl_o7c3r_78",oce="_radioIndicator_o7c3r_93",ace="_radioLabel_o7c3r_99",lce="_radioItemWithDesc_o7c3r_105",cce="_description_o7c3r_125",Tc={checkbox:jle,checkbox2:Yle,control:Zle,label:Qle,checkIcon:Jle,icon:Xle,radioGroup:ece,radioGroupLabel:tce,radioItems:nce,radioItemsWithDesc:ice,radioItem:sce,radioControl:rce,radioIndicator:oce,radioLabel:ace,radioItemWithDesc:lce,description:cce};var dce=It("<div>"),uce=It("<img>");const fce=a(t=>X(Oc,{get class(){return Tc.checkbox2},get checked(){return t.checked},get onChange(){return t.onChange},get children(){return[X(Oc.Input,{get class(){return Tc.input}}),X(Oc.Control,{get class(){return Tc.control},get children(){return X(Oc.Indicator,{get children(){var e=dce();return ze(()=>xe(e,Tc.checkIcon)),e}})}}),X(Oc.Label,{get class(){return Tc.label},get children(){return[X(sn,{get when(){return t.icon},get children(){var e=uce();return ze(n=>{var i=Tc.icon,s=t.icon;return i!==n.e&&xe(e,n.e=i),s!==n.t&&Ct(e,"src",n.t=s),n},{e:void 0,t:void 0}),e}}),X(Qm,{get children(){return[X(_a,{get when(){return t.children},get children(){return t.children}}),X(_a,{get when(){return t.label},get children(){return t.label}})]}})]}})]}}),"CheckBox"),hce=Ys(fce),pce="_feedsRestoreModal_517ug_1",gce="_feedConfirmationTitle_517ug_10",mce="_feedConfirmationDescription_517ug_18",vce="_feedConfirmationActions_517ug_25",yce="_feedRestoreConfirm_517ug_32",bce="_feedRestoreAbort_517ug_43",Ece="_confirmAlternateModal_517ug_57",_ce="_hidden_517ug_110",Nu={feedsRestoreModal:pce,feedConfirmationTitle:gce,feedConfirmationDescription:mce,feedConfirmationActions:vce,feedRestoreConfirm:yce,feedRestoreAbort:bce,confirmAlternateModal:Ece,hidden:_ce};var wce=It("<div><div></div><div>"),Sce=It("<div>");const Tce=a(t=>
2155{const e=_y();return X(IF,{get open(){return t.open},setOpen:a(i=>{if(t.onAbort&&!i){t.onAbort();return}if(t.setOpen){t.setOpen(i);return}},"setOpen"),get title(){return(()=>{var i=Sce();return Fe(i,()=>t.title||e.formatMessage(Cb.title)),ze(()=>xe(i,Nu.feedConfirmationTitle)),i})()},get triggerClass(){return Nu.hidden},get children(){var i=wce(),s=i.firstChild,r=s.nextSibling;return Fe(s,()=>t.description),Fe(r,X(sn,{get when(){return t.onConfirm},get children(){return X(N1,{get onClick(){return t.onConfirm},get children(){return t.confirmLabel||e.formatMessage(Cb.confirm)}})}}),null),Fe(r,X(sn,{get when(){return t.onAbort},get children(){return X(bf,{get onClick(){return t.onAbort},light:!0,get children(){return t.abortLabel||e.formatMessage(Cb.abort)}})}}),null),ze(o=>{var l=t.id,d=Nu.feedsRestoreModal,c=Nu.feedConfirmationDescription,u=Nu.feedConfirmationActions;return l!==o.e&&Ct(i,"id",o.e=l),d!==o.t&&xe(i,o.t=d),c!==o.a&&xe(s,o.a=c),u!==o.o&&xe(r,o.o=u),o},{e:void 0,t:void 0,a:void 0,o:void 0}),i}})},"ConfirmModal"),Ace=Ys(Tce);var lr=It("<div>"),xce=It("<div><div></div><div></div><div></div><div><div></div><input type=text><button><div></div></button></div><div style=height:20px>"),Ice=It("<div><div></div><input type=text><button><div>"),rE=It("<div><div></div><div>");const VB=a(()=>{const t=Wp(),e=_y();let n,i;const[s,r]=Je(!1),[o,l]=Je(!1),[d,c]=Je(!1),[u,f]=li({});We(oi(()=>z.blossomServers,b=>{if(!b||o())return;const E=b.slice(1)||[];l(()=>E.length>0)})),We(oi(()=>z.blossomServers,b=>{b&&h(b)}));const h=a(b=>{for(let E=0;E<b.length;E++){const T=b[E];zK(T).then(I=>f(()=>({[T]:I})))}},"checkServers"),p=a(()=>{if(!(!n||n.value===""))try{const b=new URL(n.value);if(!b.origin.startsWith("https://"))throw new Error("must be a https");n.value="",Vb(b.href),r(!1)}
2155catch(b){Tn("invalid caching service input",b),r(!0)}},"onSwitchServerInput"),g=a(()=>{if(!(!i||i.value===""))try{const b=new URL(i.value);if(!b.origin.startsWith("https://"))throw new Error("must be a https");i.value="",$_(b.href),r(!1)}catch(b){Tn("invalid caching service input",b),r(!0)}},"onAddMirrorInput"),v=a(()=>z.blossomServers.slice(1)||[],"mirrorServers"),y=a(()=>{const b=z.blossomServers||[],E=(t?.recomendedBlossomServers||[]).filter(T=>!b.includes(T));return h(E),E},"reommendedMirrors");return[X(cF,{get title(){return`${e.formatMessage(Ki.blossom)} ${e.formatMessage(Ki.title)}`}}),X(XN,{get children(){return[X(v0,{href:"/settings",get children(){return e.formatMessage(Ki.index.title)}}),": ",(()=>{var b=lr();return Fe(b,()=>e.formatMessage(Ki.blossom)),b})()]}}),(()=>{var b=xce(),E=b.firstChild,T=E.nextSibling,I=T.nextSibling,M=I.nextSibling,H=M.firstChild,N=H.nextSibling,$=N.nextSibling,F=$.firstChild,D=M.nextSibling;Fe(E,()=>e.formatMessage(Ki.blossomPage.mediaServer)),Fe(T,X(sn,{get when(){return z.blossomServers[0]||tm},get fallback(){return(()=>{var m=lr();return ze(()=>xe(m,mt.suspended)),m})()},get children(){var m=lr();return ze(()=>xe(m,mt.connected)),m}}),null),Fe(T,()=>z.blossomServers[0]||tm,null),Fe(I,()=>e.formatMessage(Ki.blossomPage.switchServer)),N.addEventListener("change",()=>p());var L=n;return typeof L=="function"?Ld(L,N):n=N,$.$$click=()=>p(),Fe(b,X(sn,{get when(){return s()},get children(){var m=lr();return Fe(m,()=>e.formatMessage(wQ.invalidRelayUrl)),ze(()=>xe(m,mt.invalidInput)),m}}),D),Fe(b,X(P_,{onClick:()=>Vb(tm),get children(){return e.formatMessage(bQ.restoreBlossomServer)}}),null),ze(m=>{var S=mt.settingsContent,_=`${mt.bigCaption}`,A=`${mt.label} ${mt.blossomMainServer}`,x=`${mt.settingsCaption} ${mt.secondCaption}`,C=mt.relayInput,U=mt.webIcon,R=e.formatMessage(Kk.blossomServerUrl),w=mt.connectIcon;return S!==m.e&&xe(b,m.e=S),_!==m.t&&xe(E,m.t=_),A!==m.a&&xe(T,m.a=A),x!==m.o&&xe(I,m.o=x),C!==m.i&&xe(M,m.i=C),U!==m.n&&xe(H,m.n=U),R!==m.s&&Ct(N,"placeholder",m.s=R),w!==m.h&&xe(F,m.h=w),m},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0}),b})(),(()=>{var b=rE(),E=b.firstChild,T=E.nextSibling;return Fe(E,()=>e.formatMessage(Ki.blossomPage.mediaMirrors)),Fe(b,X(hce,{id:"toggleMirror",onChange:()=>{if(v().length>0){c(!0);return}l(I=>!I)},get checked(){return o()},label:"Enable media mirrors"}),T),Fe(T,()=>e.formatMessage(Ki.blossomPage.mediaMirrorsDescription)),Fe(b,X(sn,{get when(){return o()},get children(){return[X(UE,{get each(){return v()},children:I=>(()=>{var M=rE(),H=M.firstChild,N=H.nextSibling;return Fe(H,X(sn,{get when(){return u[I]},get fallback(){return(()=>{var $=lr();return ze(()=>xe($,mt.suspended)),$})()},get children(){var $=lr();return ze(()=>xe($,mt.connected)),$}}),null),Fe(H,I,null),Fe(N,X(bf,{onClick:()=>Vb(I),shrink:!0,children:"set as media server"}),null),Fe(N,X(bf,{onClick:()=>cte(I),shrink:!0,children:"remove"}),null),ze($=>{var F=mt.mirrorServer,D=mt.label,L=mt.actions;return F!==$.e&&xe(M,$.e=F),D!==$.t&&xe(H,$.t=D),L!==$.a&&xe(N,$.a=L),$},{e:void 0,t:void 0,a:void 0}),M})()}),(()=>{var I=lr();return Fe(I,()=>e.formatMessage(Ki.blossomPage.addMirror)),ze(()=>xe(I,`${mt.settingsCaption} ${mt.secondCaption}`)),I})(),(()=>{var I=Ice(),M=I.firstChild,H=M.nextSibling,N=H.nextSibling,$=N.firstChild;H.addEventListener("change",()=>g());var F=i;return typeof F=="function"?Ld(F,H):i=H,N.$$click=()=>g(),ze(D=>{var L=mt.relayInput,m=mt.webIcon,S=e.formatMessage(Kk.blossomServerUrl),_=mt.connectIcon;return L!==D.e&&xe(I,D.e=L),m!==D.t&&xe(M,D.t=m),S!==D.a&&Ct(H,"placeholder",D.a=S),_!==D.o&&xe($,D.o=_),D},{e:void 0,t:void 0,a:void 0,o:void 0}),I})(),(()=>{var I=lr();return Fe(I,()=>e.formatMessage(Ki.blossomPage.suggestedMirrors)),ze(()=>xe(I,`${mt.settingsCaptionDarker} ${mt.secondCaption}`)),I})(),X(UE,{get each(){return y()},children:I=>(()=>{var M=rE(),H=M.firstChild,N=H.nextSibling;return Fe(H,X(sn,{get when(){return u[I]},get fallback(){return(()=>{var $=lr();return ze(()=>xe($,mt.suspended)),$})()},get children(){var $=lr();return ze(()=>xe($,mt.connected)),$}}
2155),null),Fe(H,I,null),Fe(N,X(bf,{onClick:()=>$_(I),shrink:!0,children:"add this media mirror server"})),ze($=>{var F=mt.mirrorServer,D=mt.label,L=mt.actions;return F!==$.e&&xe(M,$.e=F),D!==$.t&&xe(H,$.t=D),L!==$.a&&xe(N,$.a=L),$},{e:void 0,t:void 0,a:void 0}),M})()})]}}),null),Fe(b,X(Ace,{get open(){return d()},title:"Remove Media Mirrors?",description:"Are you sure? This will remove your mirror media servers.",confirmLabel:"Yes",abortLabel:"No",onConfirm:()=>{dte(),c(!1)},onAbort:()=>c(!1)}),null),ze(I=>{var M=mt.settingsContentBorderless,H=`${mt.bigCaption}`,N=mt.moderationDescription;return M!==I.e&&xe(b,I.e=M),H!==I.t&&xe(E,I.t=H),N!==I.a&&xe(T,I.a=N),I},{e:void 0,t:void 0,a:void 0}),b})()]},"Blossom");Kv(["click"]);const Lce=Object.freeze(Object.defineProperty({__proto__:null,default:VB},Symbol.toStringTag,{value:"Module"})),Rce=at(()=>rt(()=>import("./Home-fc1d840b.js"),["assets/Home-fc1d840b.js","assets/Note-6b7bec0b.js","assets/ParsedNote-f8432f05.js","assets/dates-1db4cfca.js","assets/streaming-edce9f1b.js","assets/streaming-3d9f5a5b.css","assets/ButtonGhost-e0602e45.js","assets/Loader-746b890a.js","assets/Loader-56f55794.css","assets/NoteContextTrigger-be931882.js","assets/NoteContextTrigger-ba145f36.css","assets/index-c18aeead.js","assets/NoteVideo-8c7b86df.js","assets/NoteVideo-81c534e0.css","assets/ParsedNote-23ea7f44.css","assets/Home.module-988c9848.js","assets/Home-cb51965e.css","assets/HomeHeader.module-e92be5af.js","assets/HomeHeader-e3da17ec.css","assets/SelectionBox2-2087428b.js","assets/WRC6BLVS-21afdac6.js","assets/QZDH5R5B-918b6b86.js","assets/LR7LBJN3-c025b240.js","assets/KFH362HI-5923aab5.js","assets/SelectionItem-3473d4c9.js","assets/SelectionItem-a12315d4.css","assets/Paginator-4d027cda.js","assets/Paginator-a978daac.css","assets/HomeSidebar.module-58d95c74.js","assets/HomeSidebar-54c3dcc7.css","assets/FeedNoteSkeleton-06a6e499.js","assets/Skeleton.module-cebd7135.js","assets/Skeleton-1172f471.css","assets/FeedNoteSkeleton-23d7b809.css","assets/Wormhole-d55dc416.js","assets/scroll-88dc0c55.js","assets/StickySidebar-b02cc1c4.js","assets/StickySidebar-2cf5d086.css","assets/Search-5927af94.js","assets/SearchOption-e3bc02cf.js","assets/SearchOption-f427c2c6.css","assets/Search-e3b998f0.css","assets/Layout-0ff543e3.js","assets/OA5MXRPO-ed767b36.js","assets/SOM3K36D-692cba79.js","assets/TextInput-acc64952.js","assets/TextInput-d3f7af9b.css","assets/ButtonCopy-79e5a795.js","assets/qr_nostrich-54e27ae3.js","assets/qr_lightning-fba50a71.js","assets/ButtonCopy-e7489e54.css","assets/playstore_download-3e7489d0.js","assets/EditBox-d726956b.js","assets/index-3d01d2c1.js","assets/textArea-802fec28.js","assets/EmojiPickHeader-d9fd70a2.js","assets/EmojiPickHeader-ae4f6b40.css","assets/ArticleHighlight-156161b9.js","assets/UploaderBlossom-3e5c402f.js","assets/AZ2W4WWA-36ac2a55.js","assets/UploaderBlossom-ba6b35e4.css","assets/HelpTip-744d5769.js","assets/HelpTip-18991287.css","assets/AdvancedSearchSelect-e518d025.js","assets/EditBox-9cbca8f4.css","assets/N3VDADWV-80e6b217.js","assets/ProfileQrCodeModal-9e1537a5.js","assets/ProfileQrCodeModal-b75c7ff2.css","assets/WTMIS75X-0c166f05.js","assets/Layout-6874b2b4.css","assets/Home-a7615c96.css"])),kce=at(()=>rt(()=>import("./Reads-2e84e60e.js"),["assets/Reads-2e84e60e.js","assets/Home.module-988c9848.js","assets/Home-cb51965e.css","assets/Paginator-4d027cda.js","assets/Paginator-a978daac.css","assets/Wormhole-d55dc416.js","assets/scroll-88dc0c55.js","assets/StickySidebar-b02cc1c4.js","assets/StickySidebar-2cf5d086.css","assets/Search-5927af94.js","assets/Loader-746b890a.js","assets/Loader-56f55794.css","assets/SearchOption-e3bc02cf.js","assets/SearchOption-f427c2c6.css","assets/Search-e3b998f0.css","assets/Layout-0ff543e3.js","assets/ParsedNote-f8432f05.js","assets/dates-1db4cfca.js","assets/streaming-edce9f1b.js","assets/streaming-3d9f5a5b.css","assets/ButtonGhost-e0602e45.js","assets/NoteContextTrigger-be931882.js","assets/NoteContextTrigger-ba145f36.css","assets/index-c18aeead.js","assets/NoteVideo-8c7b86df.js","assets/NoteVideo-81c534e0.css","assets/ParsedNote-23ea7f44.css","assets/OA5MXRPO-ed767b36.js","assets/QZDH5R5B-918b6b86.js","assets/LR7LBJN3-c025b240.js","assets/SOM3K36D-692cba79.js","assets/Note-6b7bec0b.js","assets/TextInput-acc64952.js","assets/TextInput-d3f7af9b.css","assets/ButtonCopy-79e5a795.js","assets/qr_nostrich-54e27ae3.js","assets/qr_lightning-fba50a71.js","assets/ButtonCopy-e7489e54.css","assets/WRC6BLVS-21afdac6.js","assets/KFH362HI-5923aab5.js","assets/playstore_download-3e7489d0.js","assets/EditBox-d726956b.js","assets/index-3d01d2c1.js","assets/textArea-802fec28.js","assets/EmojiPickHeader-d9fd70a2.js","assets/EmojiPickHeader-ae4f6b40.css","assets/ArticleHighlight-156161b9.js","assets/UploaderBlossom-3e5c402f.js","assets/AZ2W4WWA-36ac2a55.js","assets/UploaderBlossom-ba6b35e4.css","assets/HelpTip-744d5769.js","assets/HelpTip-18991287.css","assets/AdvancedSearchSelect-e518d025.js","assets/EditBox-9cbca8f4.css","assets/N3VDADWV-80e6b217.js","assets/ProfileQrCodeModal-9e1537a5.js","assets/ProfileQrCodeModal-b75c7ff2.css","assets/WTMIS75X-0c166f05.js","assets/Layout-6874b2b4.css","assets/ArticlePreview-3872b297.js","assets/HomeSidebar.module-58d95c74.js","assets/HomeSidebar-54c3dcc7.css","assets/ArticleShort-dcbaf061.js","assets/Skeleton.module-cebd7135.js","assets/Skeleton-1172f471.css","assets/ArticlePreviewSidebarSkeleton-20727d86.js","assets/HomeHeader.module-e92be5af.js","assets/HomeHeader-e3da17ec.css","assets/SelectionBox2-2087428b.js","assets/SelectionItem-3473d4c9.js","assets/SelectionItem-a12315d4.css","assets/ArticlePreviewSkeleton-bf27beac.js","assets/ArticlePreviewPhone-69f39cf6.js","assets/Reads-6992ded2.css"])),Mce=at(()=>rt(()=>import("./Layout-0ff543e3.js"),["assets/Layout-0ff543e3.js","assets/ParsedNote-f8432f05.js","assets/dates-1db4cfca.js","assets/streaming-edce9f1b.js","assets/streaming-3d9f5a5b.css","assets/ButtonGhost-e0602e45.js","assets/Loader-746b890a.js","assets/Loader-56f55794.css","assets/NoteContextTrigger-be931882.js","assets/NoteContextTrigger-ba145f36.css","assets/index-c18aeead.js","assets/NoteVideo-8c7b86df.js","assets/NoteVideo-81c534e0.css","assets/ParsedNote-23ea7f44.css","assets/OA5MXRPO-ed767b36.js","assets/QZDH5R5B-918b6b86.js","assets/LR7LBJN3-c025b240.js","assets/SOM3K36D-692cba79.js","assets/Note-6b7bec0b.js","assets/Paginator-4d027cda.js","assets/Paginator-a978daac.css","assets/TextInput-acc64952.js","assets/TextInput-d3f7af9b.css","assets/ButtonCopy-79e5a795.js","assets/qr_nostrich-54e27ae3.js","assets/qr_lightning-fba50a71.js","assets/ButtonCopy-e7489e54.css","assets/WRC6BLVS-21afdac6.js","assets/KFH362HI-5923aab5.js","assets/playstore_download-3e7489d0.js","assets/EditBox-d726956b.js","assets/SearchOption-e3bc02cf.js","assets/SearchOption-f427c2c6.css","assets/index-3d01d2c1.js","assets/textArea-802fec28.js","assets/EmojiPickHeader-d9fd70a2.js","assets/EmojiPickHeader-ae4f6b40.css","assets/ArticleHighlight-156161b9.js","assets/UploaderBlossom-3e5c402f.js","assets/AZ2W4WWA-36ac2a55.js","assets/UploaderBlossom-ba6b35e4.css","assets/HelpTip-744d5769.js","assets/HelpTip-18991287.css","assets/AdvancedSearchSelect-e518d025.js","assets/EditBox-9cbca8f4.css","assets/N3VDADWV-80e6b217.js","assets/ProfileQrCodeModal-9e1537a5.js","assets/ProfileQrCodeModal-b75c7ff2.css","assets/WTMIS75X-0c166f05.js","assets/Layout-6874b2b4.css"])),Cce=at(()=>rt(()=>import("./Explore-d7c21b30.js"),["assets/Explore-d7c21b30.js","assets/ExploreHotTopics-1671d747.js","assets/ExploreHotTopics-533473ba.css","assets/StickySidebar-b02cc1c4.js","assets/Wormhole-d55dc416.js","assets/StickySidebar-2cf5d086.css","assets/Search-5927af94.js","assets/Loader-746b890a.js","assets/Loader-56f55794.css","assets/SearchOption-e3bc02cf.js","assets/SearchOption-f427c2c6.css","assets/Search-e3b998f0.css","assets/OA5MXRPO-ed767b36.js","assets/QZDH5R5B-918b6b86.js","assets/LR7LBJN3-c025b240.js","assets/SOM3K36D-692cba79.js","assets/FeedMarketPlace-d7fd7ccb.js","assets/FeedMarketPlaceItem-d760b22e.js","assets/ParsedNote-f8432f05.js","assets/dates-1db4cfca.js","assets/streaming-edce9f1b.js","assets/streaming-3d9f5a5b.css","assets/ButtonGhost-e0602e45.js","assets/NoteContextTrigger-be931882.js","assets/NoteContextTrigger-ba145f36.css","assets/index-c18aeead.js","assets/NoteVideo-8c7b86df.js","assets/NoteVideo-81c534e0.css","assets/ParsedNote-23ea7f44.css","assets/FeedMarketPlaceItem-49caeebd.css","assets/Paginator-4d027cda.js","assets/Paginator-a978daac.css","assets/FollowButton-7df8d743.js","assets/ButtonFlip-78eab4c5.js","assets/FollowButton-e8a437c1.css","assets/NoteGallery-be24528e.js","assets/SelectionBox2-2087428b.js","assets/WRC6BLVS-21afdac6.js","assets/KFH362HI-5923aab5.js","assets/SelectionItem-3473d4c9.js","assets/SelectionItem-a12315d4.css"])),Pce=at(()=>rt(()=>import("./ExploreFeeds-b51d7d00.js"),["assets/ExploreFeeds-b51d7d00.js","assets/ExploreHotTopics-1671d747.js","assets/ExploreHotTopics-533473ba.css","assets/StickySidebar-b02cc1c4.js","assets/Wormhole-d55dc416.js","assets/StickySidebar-2cf5d086.css","assets/FeedMarketPlacePreview-2dc9d6a7.js","assets/ArticlePreview-3872b297.js","assets/dates-1db4cfca.js","assets/NoteContextTrigger-be931882.js","assets/NoteContextTrigger-ba145f36.css","assets/ParsedNote-f8432f05.js","assets/streaming-edce9f1b.js","assets/streaming-3d9f5a5b.css","assets/ButtonGhost-e0602e45.js","assets/Loader-746b890a.js","assets/Loader-56f55794.css","assets/index-c18aeead.js","assets/NoteVideo-8c7b86df.js","assets/NoteVideo-81c534e0.css","assets/ParsedNote-23ea7f44.css","assets/Note-6b7bec0b.js","assets/Paginator-4d027cda.js","assets/Paginator-a978daac.css","assets/FeedMarketPlaceItem-d760b22e.js","assets/FeedMarketPlaceItem-49caeebd.css","assets/ButtonFlip-78eab4c5.js"])),Ig=at(()=>rt(()=>import("./Thread-c570bfd8.js"),["assets/Thread-c570bfd8.js","assets/NotFound-fec02225.js","assets/MissingPage-5bb277f9.js","assets/Search-5927af94.js","assets/Loader-746b890a.js","assets/Loader-56f55794.css","assets/SearchOption-e3bc02cf.js","assets/SearchOption-f427c2c6.css","assets/Search-e3b998f0.css","assets/Wormhole-d55dc416.js","assets/MissingPage-c1947c0e.css","assets/NotFound-ed20e1a0.css","assets/Note-6b7bec0b.js","assets/ParsedNote-f8432f05.js","assets/dates-1db4cfca.js","assets/streaming-edce9f1b.js","assets/streaming-3d9f5a5b.css","assets/ButtonGhost-e0602e45.js","assets/NoteContextTrigger-be931882.js","assets/NoteContextTrigger-ba145f36.css","assets/index-c18aeead.js","assets/NoteVideo-8c7b86df.js","assets/NoteVideo-81c534e0.css","assets/ParsedNote-23ea7f44.css","assets/PeopleList-f4812ee4.js","assets/Skeleton.module-cebd7135.js","assets/Skeleton-1172f471.css","assets/FollowButton-7df8d743.js","assets/ButtonFlip-78eab4c5.js","assets/FollowButton-e8a437c1.css","assets/PeopleList-3bdbb441.css","assets/EditBox-d726956b.js","assets/index-3d01d2c1.js","assets/textArea-802fec28.js","assets/EmojiPickHeader-d9fd70a2.js","assets/EmojiPickHeader-ae4f6b40.css","assets/ArticleHighlight-156161b9.js","assets/UploaderBlossom-3e5c402f.js","assets/AZ2W4WWA-36ac2a55.js","assets/LR7LBJN3-c025b240.js","assets/UploaderBlossom-ba6b35e4.css","assets/HelpTip-744d5769.js","assets/HelpTip-18991287.css","assets/AdvancedSearchSelect-e518d025.js","assets/WRC6BLVS-21afdac6.js","assets/QZDH5R5B-918b6b86.js","assets/KFH362HI-5923aab5.js","assets/EditBox-9cbca8f4.css","assets/PrimalMarkdown-c774817c.js","assets/ArticlePreview-3872b297.js","assets/PrimalMarkdown-3894318f.css","assets/HomeSidebar.module-58d95c74.js","assets/HomeSidebar-54c3dcc7.css","assets/ArticleShort-dcbaf061.js","assets/ArticlePreviewSidebarSkeleton-20727d86.js","assets/Thread-a82b61d1.css"])),Dce=at(()=>rt(()=>import("./DirectMessages-025052d1.js"),["assets/DirectMessages-025052d1.js","assets/dates-1db4cfca.js","assets/OA5MXRPO-ed767b36.js","assets/QZDH5R5B-918b6b86.js","assets/LR7LBJN3-c025b240.js","assets/SOM3K36D-692cba79.js","assets/Wormhole-d55dc416.js","assets/Search-5927af94.js","assets/Loader-746b890a.js","assets/Loader-56f55794.css","assets/SearchOption-e3bc02cf.js","assets/SearchOption-f427c2c6.css","assets/Search-e3b998f0.css","assets/ParsedNote-f8432f05.js","assets/streaming-edce9f1b.js","assets/streaming-3d9f5a5b.css","assets/ButtonGhost-e0602e45.js","assets/NoteContextTrigger-be931882.js","assets/NoteContextTrigger-ba145f36.css","assets/index-c18aeead.js","assets/NoteVideo-8c7b86df.js","assets/NoteVideo-81c534e0.css","assets/ParsedNote-23ea7f44.css","assets/Paginator-4d027cda.js","assets/Paginator-a978daac.css","assets/textArea-802fec28.js","assets/index-3d01d2c1.js","assets/DirectMessages-eddfb468.css"])),Oce=at(()=>rt(()=>import("./Bookmarks-d4a8046d.js"),["assets/Bookmarks-d4a8046d.js","assets/index-c18aeead.js","assets/ArticlePreview-3872b297.js","assets/dates-1db4cfca.js","assets/NoteContextTrigger-be931882.js","assets/NoteContextTrigger-ba145f36.css","assets/ParsedNote-f8432f05.js","assets/streaming-edce9f1b.js","assets/streaming-3d9f5a5b.css","assets/ButtonGhost-e0602e45.js","assets/Loader-746b890a.js","assets/Loader-56f55794.css","assets/NoteVideo-8c7b86df.js","assets/NoteVideo-81c534e0.css","assets/ParsedNote-23ea7f44.css","assets/HomeHeader.module-e92be5af.js","assets/HomeHeader-e3da17ec.css","assets/WRC6BLVS-21afdac6.js","assets/QZDH5R5B-918b6b86.js","assets/LR7LBJN3-c025b240.js","assets/KFH362HI-5923aab5.js","assets/SelectionItem-3473d4c9.js","assets/SelectionItem-a12315d4.css","assets/Note-6b7bec0b.js","assets/Paginator-4d027cda.js","assets/Paginator-a978daac.css","assets/Bookmarks-c93844a0.css"])),Nce=at(()=>rt(()=>import("./Notifications-bf69f271.js"),["assets/Notifications-bf69f271.js","assets/Loader-746b890a.js","assets/Loader-56f55794.css","assets/NotificationItemOld-e5d75ef2.js","assets/mentioned_post_replied-c4a4837a.js","assets/Note-6b7bec0b.js","assets/ParsedNote-f8432f05.js","assets/dates-1db4cfca.js","assets/streaming-edce9f1b.js","assets/streaming-3d9f5a5b.css","assets/ButtonGhost-e0602e45.js","assets/NoteContextTrigger-be931882.js","assets/NoteContextTrigger-ba145f36.css","assets/index-c18aeead.js","assets/NoteVideo-8c7b86df.js","assets/NoteVideo-81c534e0.css","assets/ParsedNote-23ea7f44.css","assets/ArticlePreview-3872b297.js","assets/ArticleHighlight-156161b9.js","assets/NotificationItemOld-1213617a.css","assets/Paginator-4d027cda.js","assets/Paginator-a978daac.css","assets/Search-5927af94.js","assets/SearchOption-e3bc02cf.js","assets/SearchOption-f427c2c6.css","assets/Search-e3b998f0.css","assets/StickySidebar-b02cc1c4.js","assets/Wormhole-d55dc416.js","assets/StickySidebar-2cf5d086.css","assets/OA5MXRPO-ed767b36.js","assets/QZDH5R5B-918b6b86.js","assets/LR7LBJN3-c025b240.js","assets/SOM3K36D-692cba79.js","assets/Notifications-65133037.css"])),Fce=at(()=>rt(()=>import("./Downloads-54e4ea3d.js"),["assets/Downloads-54e4ea3d.js","assets/Wormhole-d55dc416.js","assets/Search-5927af94.js","assets/Loader-746b890a.js","assets/Loader-56f55794.css","assets/SearchOption-e3bc02cf.js","assets/SearchOption-f427c2c6.css","assets/Search-e3b998f0.css","assets/playstore_download-3e7489d0.js","assets/github_light-88794deb.js","assets/github-c41fe0bf.js","assets/StickySidebar-b02cc1c4.js","assets/StickySidebar-2cf5d086.css","assets/NoteVideo-8c7b86df.js","assets/NoteVideo-81c534e0.css","assets/Downloads-93a1d8b8.css"])),Uce=at(()=>rt(()=>import("./Settings-aa6c8393.js"),["assets/Settings-aa6c8393.js","assets/Wormhole-d55dc416.js","assets/Search-5927af94.js","assets/Loader-746b890a.js","assets/Loader-56f55794.css","assets/SearchOption-e3bc02cf.js","assets/SearchOption-f427c2c6.css","assets/Search-e3b998f0.css","assets/StickySidebar-b02cc1c4.js","assets/StickySidebar-2cf5d086.css","assets/SettingsSidebar-9b0bf5a4.js","assets/SettingsSidebar-f7312c32.css"])),Bce=at(()=>rt(()=>import("./Help-413da20c.js"),["assets/Help-413da20c.js","assets/MissingPage-5bb277f9.js","assets/Search-5927af94.js","assets/Loader-746b890a.js","assets/Loader-56f55794.css","assets/SearchOption-e3bc02cf.js","assets/SearchOption-f427c2c6.css","assets/Search-e3b998f0.css","assets/Wormhole-d55dc416.js","assets/MissingPage-c1947c0e.css"]));at(()=>rt(()=>import("./Search-d0e2a866.js"),["assets/Search-d0e2a866.js","assets/Note-6b7bec0b.js","assets/ParsedNote-f8432f05.js","assets/dates-1db4cfca.js","assets/streaming-edce9f1b.js","assets/streaming-3d9f5a5b.css","assets/ButtonGhost-e0602e45.js","assets/Loader-746b890a.js","assets/Loader-56f55794.
2155css","assets/NoteContextTrigger-be931882.js","assets/NoteContextTrigger-ba145f36.css","assets/index-c18aeead.js","assets/NoteVideo-8c7b86df.js","assets/NoteVideo-81c534e0.css","assets/ParsedNote-23ea7f44.css","assets/Wormhole-d55dc416.js","assets/StickySidebar-b02cc1c4.js","assets/StickySidebar-2cf5d086.css","assets/PeopleList-f4812ee4.js","assets/Skeleton.module-cebd7135.js","assets/Skeleton-1172f471.css","assets/FollowButton-7df8d743.js","assets/ButtonFlip-78eab4c5.js","assets/FollowButton-e8a437c1.css","assets/PeopleList-3bdbb441.css","assets/Search-5927af94.js","assets/SearchOption-e3bc02cf.js","assets/SearchOption-f427c2c6.css","assets/Search-e3b998f0.css","assets/SaveFeedDialog-d204f59e.js","assets/ButtonPremium-730ce1ae.js","assets/SaveFeedDialog-07ec1b26.css","assets/Paginator-4d027cda.js","assets/Paginator-a978daac.css","assets/Search-60c1132b.css"]));const $ce=at(()=>rt(()=>import("./NotFound-fec02225.js"),["assets/NotFound-fec02225.js","assets/MissingPage-5bb277f9.js","assets/Search-5927af94.js","assets/Loader-746b890a.js","assets/Loader-56f55794.css","assets/SearchOption-e3bc02cf.js","assets/SearchOption-f427c2c6.css","assets/Search-e3b998f0.css","assets/Wormhole-d55dc416.js","assets/MissingPage-c1947c0e.css","assets/NotFound-ed20e1a0.css"])),Hce=at(()=>rt(()=>import("./EditProfile-3c2d3ad1.js"),["assets/EditProfile-3c2d3ad1.js","assets/Loader-746b890a.js","assets/Loader-56f55794.css","assets/UploaderBlossom-3e5c402f.js","assets/AZ2W4WWA-36ac2a55.js","assets/LR7LBJN3-c025b240.js","assets/ButtonGhost-e0602e45.js","assets/UploaderBlossom-ba6b35e4.css","assets/EditProfile-37e441af.css"])),oE=at(()=>rt(()=>import("./Profile-b29ac44a.js"),["assets/Profile-b29ac44a.js","assets/dates-1db4cfca.js","assets/FollowButton-7df8d743.js","assets/ButtonFlip-78eab4c5.js","assets/FollowButton-e8a437c1.css","assets/OA5MXRPO-ed767b36.js","assets/QZDH5R5B-918b6b86.js","assets/LR7LBJN3-c025b240.js","assets/SOM3K36D-692cba79.js","assets/ArticlePreview-3872b297.js","assets/NoteContextTrigger-be931882.js","assets/NoteContextTrigger-ba145f36.css","assets/ParsedNote-f8432f05.js","assets/streaming-edce9f1b.js","assets/streaming-3d9f5a5b.css","assets/ButtonGhost-e0602e45.js","assets/Loader-746b890a.js","assets/Loader-56f55794.css","assets/index-c18aeead.js","assets/NoteVideo-8c7b86df.js","assets/NoteVideo-81c534e0.css","assets/ParsedNote-23ea7f44.css","assets/ButtonCopy-79e5a795.js","assets/qr_nostrich-54e27ae3.js","assets/qr_lightning-fba50a71.js","assets/ButtonCopy-e7489e54.css","assets/Note-6b7bec0b.js","assets/Paginator-4d027cda.js","assets/Paginator-a978daac.css","assets/NoteGallery-be24528e.js","assets/FeedNoteSkeleton-06a6e499.js","assets/Skeleton.module-cebd7135.js","assets/Skeleton-1172f471.css","assets/FeedNoteSkeleton-23d7b809.css","assets/ArticlePreviewSkeleton-bf27beac.js","assets/scroll-88dc0c55.js","assets/ProfileQrCodeModal-9e1537a5.js","assets/ProfileQrCodeModal-b75c7ff2.css","assets/PremiumCohortInfo-2a852759.js","assets/PremiumCohortInfo-35e53cb1.css","assets/Wormhole-d55dc416.js","assets/StickySidebar-b02cc1c4.js","assets/StickySidebar-2cf5d086.css","assets/ArticleShort-dcbaf061.js","assets/ArticlePreviewSidebarSkeleton-20727d86.js","assets/Search-5927af94.js","assets/SearchOption-e3bc02cf.js","assets/SearchOption-f427c2c6.css","assets/Search-e3b998f0.css","assets/Profile-1a490445.css"])),Gce=at(()=>rt(()=>import("./Mutelist-58b34227.js"),[])),Vce=at(()=>rt(()=>import("./CreateAccount-903218bf.js"),["assets/CreateAccount-903218bf.js","assets/TextInput-acc64952.js","assets/TextInput-d3f7af9b.css","assets/ButtonFlip-78eab4c5.js","assets/UploaderBlossom-3e5c402f.js","assets/AZ2W4WWA-36ac2a55.js","assets/LR7LBJN3-c025b240.js","assets/ButtonGhost-e0602e45.js","assets/UploaderBlossom-ba6b35e4.css","assets/CreateAccount-817e2f2e.css"])),Wce=at(()=>rt(()=>import("./Premium-4ebae634.js"),["assets/Premium-4ebae634.js","assets/Wormhole-d55dc416.js","assets/PremiumCohortInfo-2a852759.js","assets/dates-1db4cfca.js","assets/PremiumCohortInfo-35e53cb1.css","assets/Search-5927af94.js","assets/Loader-746b890a.js","assets/Loader-56f55794.css","assets/SearchOption-e3bc02cf.js","assets/SearchOption-f427c2c6.css","assets/Search-e3b998f0.css","assets/TextInput-acc64952.js","assets/TextInput-d3f7af9b.css","assets/ButtonPremium-730ce1ae.js","assets/ButtonFlip-78eab4c5.js","assets/OA5MXRPO-ed767b36.js","assets/QZDH5R5B-918b6b86.js","assets/LR7LBJN3-c025b240.js","assets/SOM3K36D-692cba79.js","assets/ButtonCopy-79e5a795.js","assets/qr_nostrich-54e27ae3.js","assets/qr_lightning-fba50a71.js","assets/ButtonCopy-e7489e54.css","assets/check_circle-8b1b7b08.js","assets/close_circle-a2afe71d.js","assets/WTMIS75X-0c166f05.js","assets/StickySidebar-b02cc1c4.js","assets/StickySidebar-2cf5d086.css","assets/PremiumLegendLeaderboard-679de1f7.js","assets/HelpTip-744d5769.js","assets/HelpTip-18991287.css","assets/Paginator-4d027cda.js","assets/Paginator-a978daac.css","assets/PremiumSidebarInactive-cf7ad204.js","assets/purple_check-feeeb883.js","assets/missing_video-c40627a8.js","assets/missing_image-3f937278.js","assets/AZ2W4WWA-36ac2a55.js","assets/ButtonGhost-e0602e45.js","assets/logo_gold-d4884ab5.js","assets/Premium-d514f441.css"])),zce=at(()=>rt(()=>import("./Legends-2f2115e1.js"),["assets/Legends-2f2115e1.js","assets/Wormhole-d55dc416.js","assets/PremiumCohortInfo-2a852759.js","assets/dates-1db4cfca.js","assets/PremiumCohortInfo-35e53cb1.css","assets/Search-5927af94.js","assets/Loader-746b890a.js","assets/Loader-56f55794.css","assets/SearchOption-e3bc02cf.js","assets/SearchOption-f427c2c6.css","assets/Search-e3b998f0.css","assets/StickySidebar-b02cc1c4.js","assets/StickySidebar-2cf5d086.css","assets/PremiumLegendLeaderboard-679de1f7.js","assets/OA5MXRPO-ed767b36.js","assets/QZDH5R5B-918b6b86.js","assets/LR7LBJN3-c025b240.js","assets/SOM3K36D-692cba79.js","assets/HelpTip-744d5769.js","assets/HelpTip-18991287.css","assets/Paginator-4d027cda.js","assets/Paginator-a978daac.css"])),Kce=at(()=>rt(()=>import("./Premiums-e344d4c3.js"),["assets/Premiums-e344d4c3.js","assets/Wormhole-d55dc416.js","assets/PremiumCohortInfo-2a852759.js","assets/dates-1db4cfca.js","assets/PremiumCohortInfo-35e53cb1.css","assets/Search-5927af94.js","assets/Loader-746b890a.js","assets/Loader-56f55794.css","assets/SearchOption-e3bc02cf.js","assets/SearchOption-f427c2c6.css","assets/Search-e3b998f0.css","assets/StickySidebar-b02cc1c4.js","assets/StickySidebar-2cf5d086.css","assets/PremiumLegendLeaderboard-679de1f7.js","assets/OA5MXRPO-ed767b36.js","assets/QZDH5R5B-918b6b86.js","assets/LR7LBJN3-c025b240.js","assets/SOM3K36D-692cba79.js","assets/HelpTip-744d5769.js","assets/HelpTip-18991287.css","assets/Paginator-4d027cda.js","assets/Paginator-a978daac.css","assets/PremiumSidebarInactive-cf7ad204.js"])),qce=at(()=>rt(()=>import("./Notifications-50d26bdb.js"),["assets/Notifications-50d26bdb.js","assets/mentioned_post_replied-c4a4837a.js","assets/Notifications-a20dd887.css"])),jce=at(()=>rt(()=>import("./Account-0501629c.js"),[])),Yce=at(()=>rt(()=>import("./Appearance-4cf978fe.js"),["assets/Appearance-4cf978fe.js","assets/check-a71e0e8b.js","assets/Appearance-f6172766.css"])),Zce=at(()=>rt(()=>import("./HomeFeeds-8e10fc7f.js"),["assets/HomeFeeds-8e10fc7f.js","assets/FeedMarketPlaceDialog-73955587.js","assets/FeedMarketPlaceItem-d760b22e.js","assets/ParsedNote-f8432f05.js","assets/dates-1db4cfca.js","assets/streaming-edce9f1b.js","assets/streaming-3d9f5a5b.css","assets/ButtonGhost-e0602e45.js","assets/Loader-746b890a.js","assets/Loader-56f55794.css","assets/NoteContextTrigger-be931882.js","assets/NoteContextTrigger-ba145f36.css","assets/index-c18aeead.js","assets/NoteVideo-8c7b86df.js","assets/NoteVideo-81c534e0.css","assets/ParsedNote-23ea7f44.css","assets/FeedMarketPlaceItem-49caeebd.css","assets/FeedMarketPlacePreview-2dc9d6a7.js","assets/ArticlePreview-3872b297.js","assets/Note-6b7bec0b.js","assets/Paginator-4d027cda.js","assets/Paginator-a978daac.css","assets/FeedMarketPlace-d7fd7ccb.js","assets/FeedMarketPlaceDialog-4d89d6b7.css"])),Qce=at(()=>rt(()=>import("./ReadsFeeds-7429c223.js"),["assets/ReadsFeeds-7429c223.js","assets/FeedMarketPlaceDialog-73955587.js","assets/FeedMarketPlaceItem-d760b22e.js","assets/ParsedNote-f8432f05.js","assets/dates-1db4cfca.js","assets/streaming-edce9f1b.js","assets/streaming-3d9f5a5b.css","assets/ButtonGhost-e0602e45.js","assets/Loader-746b890a.js","assets/Loader-56f55794.css","assets/NoteContextTrigger-be931882.js","assets/NoteContextTrigger-ba145f36.css","assets/index-c18aeead.js","assets/NoteVideo-8c7b86df.js","assets/NoteVideo-81c534e0.css","assets/ParsedNote-23ea7f44.css","assets/FeedMarketPlaceItem-49caeebd.css","assets/FeedMarketPlacePreview-2dc9d6a7.js","assets/ArticlePreview-3872b297.js","assets/Note-6b7bec0b.js","assets/Paginator-4d027cda.js","assets/Paginator-a978daac.css","assets/FeedMarketPlace-d7fd7ccb.js","assets/FeedMarketPlaceDialog-4d89d6b7.css"])),Jce=at(()=>rt(()=>import("./DevTools-8c9dd72c.js"),[])),Xce=at(()=>rt(()=>import("./Zaps-1ccd0b59.js"),["assets/Zaps-1ccd0b59.js","assets/EmojiPickHeader-d9fd70a2.js","assets/index-3d01d2c1.js","assets/ButtonGhost-e0602e45.js","assets/EmojiPickHeader-ae4f6b40.css","assets/Zaps-7b25cd5a.css"])),ede=at(()=>rt(()=>import("./Muted-7b952183.js"),["assets/Muted-7b952183.js","assets/OA5MXRPO-ed767b36.js","assets/QZDH5R5B-918b6b86.js","assets/LR7LBJN3-c025b240.js","assets/SOM3K36D-692cba79.js","assets/Note-6b7bec0b.js","assets/ParsedNote-f8432f05.js","assets/dates-1db4cfca.js","assets/streaming-edce9f1b.js","assets/streaming-3d9f5a5b.css","assets/ButtonGhost-e0602e45.js","assets/Loader-746b890a.js","assets/Loader-56f55794.css","assets/NoteContextTrigger-be931882.js","assets/NoteContextTrigger-ba145f36.css","assets/index-c18aeead.js","assets/NoteVideo-8c7b86df.js","assets/NoteVideo-81c534e0.css","assets/ParsedNote-23ea7f44.css","assets/Paginator-4d027cda.js","assets/Paginator-a978daac.css","assets/TextInput-acc64952.js","assets/TextInput-d3f7af9b.css"])),tde=at(()=>rt(()=>import("./Network-cc274f89.js"),["assets/Network-cc274f89.js","assets/HelpTip-744d5769.js","assets/HelpTip-18991287.css"])),nde=at(()=>rt(()=>import("./Moderation-0a04d37f.js"),["assets/Moderation-0a04d37f.js","assets/HelpTip-744d5769.js","assets/HelpTip-18991287.css"])),ide=at(()=>rt(()=>Promise.resolve().then(()=>Kee),void 0)),sde=at(()=>rt(()=>import("./Menu-228707f0.js"),[]));at(()=>rt(()=>Promise.resolve().then(()=>Lce),void 0));const rde=at(()=>rt(()=>import("./appDownloadQr-d3088e2b.js"),[])),ode=at(()=>rt(()=>import("./EventQueue-0c4bea7b.js"),["assets/EventQueue-0c4bea7b.js","assets/Search-5927af94.js","assets/Loader-746b890a.js","assets/Loader-56f55794.css","assets/SearchOption-e3bc02cf.js","assets/SearchOption-f427c2c6.css","assets/Search-e3b998f0.css","assets/Wormhole-d55dc416.js","assets/StickySidebar-b02cc1c4.js","assets/StickySidebar-2cf5d086.css","assets/SettingsSidebar-9b0bf5a4.js","assets/SettingsSidebar-f7312c32.css","assets/NotificationItemOld-e5d75ef2.js","assets/mentioned_post_replied-c4a4837a.js","assets/Note-6b7bec0b.js","assets/ParsedNote-f8432f05.js","assets/dates-1db4cfca.js","assets/streaming-edce9f1b.js","assets/streaming-3d9f5a5b.css","assets/ButtonGhost-e0602e45.js","assets/NoteContextTrigger-be931882.js","assets/NoteContextTrigger-ba145f36.css","assets/index-c18aeead.js","assets/NoteVideo-8c7b86df.js","assets/NoteVideo-81c534e0.css","assets/ParsedNote-23ea7f44.css","assets/ArticlePreview-3872b297.js","assets/ArticleHighlight-156161b9.js","assets/NotificationItemOld-1213617a.css","assets/send_cir
2155cle-b124a388.js","assets/highlight_create-247f70f4.js","assets/report-2aed971d.js","assets/like-02f0a0e6.js","assets/reposts-2b64c68b.js","assets/upload-d637f2d1.js","assets/download-4e3ce708.js","assets/post-0d03ff5f.js","assets/delete-fb2b4c45.js","assets/list-89e600c9.js","assets/profile-8587006c.js","assets/settings-a410d54d.js","assets/EventQueue-d19af8d8.css"])),ade=at(()=>rt(()=>import("./MiniSiteLayout-4ce8e26c.js"),["assets/MiniSiteLayout-4ce8e26c.js","assets/MiniSiteLayout-08adb7c6.css"])),lde=at(()=>rt(()=>import("./About-71ffbaba.js"),["assets/About-71ffbaba.js","assets/About-c716ac13.css"])),cde=at(()=>rt(()=>import("./Terms-c9a334c9.js"),["assets/Terms-c9a334c9.js","assets/LegalPage-3531bcc2.js","assets/LegalPage-56ee19be.css"])),dde=at(()=>rt(()=>import("./Privacy-aef0bbba.js"),["assets/Privacy-aef0bbba.js","assets/LegalPage-3531bcc2.js","assets/LegalPage-56ee19be.css"])),ude=at(()=>rt(()=>import("./Support-5a9654cd.js"),["assets/Support-5a9654cd.js","assets/Terms.module-34e7516c.js","assets/Terms-b9d5dacb.css"])),fde=at(()=>rt(()=>import("./Csae-c37c8370.js"),["assets/Csae-c37c8370.js","assets/Terms.module-34e7516c.js","assets/Terms-b9d5dacb.css"])),hde=at(()=>rt(()=>import("./FeedsTest-d3ec0b4c.js"),["assets/FeedsTest-d3ec0b4c.js","assets/Search-5927af94.js","assets/Loader-746b890a.js","assets/Loader-56f55794.css","assets/SearchOption-e3bc02cf.js","assets/SearchOption-f427c2c6.css","assets/Search-e3b998f0.css","assets/Wormhole-d55dc416.js","assets/FeedsTest.module-3a376918.js","assets/FeedsTest-d15d48c7.css"])),pde=at(()=>rt(()=>import("./FeedQueryTest-e08c935c.js"),["assets/FeedQueryTest-e08c935c.js","assets/ArticlePreview-3872b297.js","assets/dates-1db4cfca.js","assets/NoteContextTrigger-be931882.js","assets/NoteContextTrigger-ba145f36.css","assets/ParsedNote-f8432f05.js","assets/streaming-edce9f1b.js","assets/streaming-3d9f5a5b.css","assets/ButtonGhost-e0602e45.js","assets/Loader-746b890a.js","assets/Loader-56f55794.css","assets/index-c18aeead.js","assets/NoteVideo-8c7b86df.js","assets/NoteVideo-81c534e0.css","assets/ParsedNote-23ea7f44.css","assets/Note-6b7bec0b.js","assets/Paginator-4d027cda.js","assets/Paginator-a978daac.css","assets/FeedsTest.module-3a376918.js","assets/FeedsTest-d15d48c7.css"])),gde=at(()=>rt(()=>import("./AdvancedSearch-52e0b927.js").then(t=>t.a),["assets/AdvancedSearch-52e0b927.js","assets/StickySidebar-b02cc1c4.js","assets/Wormhole-d55dc416.js","assets/StickySidebar-2cf5d086.css","assets/TextInput-acc64952.js","assets/TextInput-d3f7af9b.css","assets/AdvancedSearchSelect-e518d025.js","assets/WRC6BLVS-21afdac6.js","assets/QZDH5R5B-918b6b86.js","assets/LR7LBJN3-c025b240.js","assets/KFH362HI-5923aab5.js","assets/FeedsTest.module-3a376918.js","assets/FeedsTest-d15d48c7.css","assets/Loader-746b890a.js","assets/Loader-56f55794.css","assets/N3VDADWV-80e6b217.js","assets/SOM3K36D-692cba79.js","assets/SearchOption-e3bc02cf.js","assets/SearchOption-f427c2c6.css"])),mde=at(()=>rt(()=>import("./AdvancedSearchResults-0aa04b62.js"),["assets/AdvancedSearchResults-0aa04b62.js","assets/Loader-746b890a.js","assets/Loader-56f55794.css","assets/Note-6b7bec0b.js","assets/ParsedNote-f8432f05.js","assets/dates-1db4cfca.js","assets/streaming-edce9f1b.js","assets/streaming-3d9f5a5b.css","assets/ButtonGhost-e0602e45.js","assets/NoteContextTrigger-be931882.js","assets/NoteContextTrigger-ba145f36.css","assets/index-c18aeead.js","assets/NoteVideo-8c7b86df.js","assets/NoteVideo-81c534e0.css","assets/ParsedNote-23ea7f44.css","assets/StickySidebar-b02cc1c4.js","assets/Wormhole-d55dc416.js","assets/StickySidebar-2cf5d086.css","assets/FeedsTest.module-3a376918.js","assets/FeedsTest-d15d48c7.css","assets/ArticlePreview-3872b297.js","assets/Paginator-4d027cda.js","assets/Paginator-a978daac.css","assets/SaveFeedDialog-d204f59e.js","assets/ButtonPremium-730ce1ae.js","assets/SaveFeedDialog-07ec1b26.css","assets/AdvancedSearch-52e0b927.js","assets/TextInput-acc64952.js","assets/TextInput-d3f7af9b.css","assets/AdvancedSearchSelect-e518d025.js","assets/WRC6BLVS-21afdac6.js","assets/QZDH5R5B-918b6b86.js","assets/LR7LBJN3-c025b240.js","assets/KFH362HI-5923aab5.js","assets/N3VDADWV-80e6b217.js","assets/SOM3K36D-692cba79.js","assets/SearchOption-e3bc02cf.js","assets/SearchOption-f427c2c6.css"])),vde=at(()=>rt(()=>import("./ReadsEditor-92fc7c2b.js"),["assets/ReadsEditor-92fc7c2b.js","assets/Wormhole-d55dc416.js","assets/PrimalMarkdown-c774817c.js","assets/ButtonGhost-e0602e45.js","assets/ParsedNote-f8432f05.js","assets/dates-1db4cfca.js","assets/streaming-edce9f1b.js","assets/streaming-3d9f5a5b.css","assets/Loader-746b890a.js","assets/Loader-56f55794.css","assets/NoteContextTrigger-be931882.js","assets/NoteContextTrigger-ba145f36.css","assets/index-c18aeead.js","assets/NoteVideo-8c7b86df.js","assets/NoteVideo-81c534e0.css","assets/ParsedNote-23ea7f44.css","assets/ArticlePreview-3872b297.js","assets/PrimalMarkdown-3894318f.css","assets/ArticlePreviewPhone-69f39cf6.js","assets/ArticleShort-dcbaf061.js","assets/editor-phone-message-a0bd670e.js","assets/WRC6BLVS-21afdac6.js","assets/QZDH5R5B-918b6b86.js","assets/LR7LBJN3-c025b240.js","assets/KFH362HI-5923aab5.js","assets/OA5MXRPO-ed767b36.js","assets/SOM3K36D-692cba79.js","assets/Note-6b7bec0b.js","assets/SearchOption-e3bc02cf.js","assets/SearchOption-f427c2c6.css","assets/Skeleton.module-cebd7135.js","assets/Skeleton-1172f471.css","assets/HTHOJQJE-bb915be7.js","assets/UploaderBlossom-3e5c402f.js","assets/AZ2W4WWA-36ac2a55.js","assets/UploaderBlossom-ba6b35e4.css","assets/ReadsEditor-77df2ee0.css"])),yde=
2155at(()=>rt(()=>import("./ReadsMy-d3ec7bd6.js"),["assets/ReadsMy-d3ec7bd6.js","assets/Wormhole-d55dc416.js","assets/StickySidebar-b02cc1c4.js","assets/StickySidebar-2cf5d086.css","assets/Search-5927af94.js","assets/Loader-746b890a.js","assets/Loader-56f55794.css","assets/SearchOption-e3bc02cf.js","assets/SearchOption-f427c2c6.css","assets/Search-e3b998f0.css","assets/OA5MXRPO-ed767b36.js","assets/QZDH5R5B-918b6b86.js","assets/LR7LBJN3-c025b240.js","assets/SOM3K36D-692cba79.js","assets/index-c18aeead.js","assets/Paginator-4d027cda.js","assets/Paginator-a978daac.css","assets/dates-1db4cfca.js","assets/NoteContextTrigger-be931882.js","assets/NoteContextTrigger-ba145f36.css","assets/Skeleton.module-cebd7135.js","assets/Skeleton-1172f471.css","assets/editor-phone-message-a0bd670e.js","assets/ReadsMy-6284dc8f.css"])),WM=at(()=>rt(()=>import("./StreamPage-ee6bc4b1.js"),["assets/StreamPage-ee6bc4b1.js","assets/streaming-edce9f1b.js","assets/streaming-3d9f5a5b.css","assets/FollowButton-7df8d743.js","assets/ButtonFlip-78eab4c5.js","assets/FollowButton-e8a437c1.css","assets/dates-1db4cfca.js","assets/NoteVideo-8c7b86df.js","assets/NoteVideo-81c534e0.css","assets/textArea-802fec28.js","assets/index-3d01d2c1.js","assets/SearchOption-e3bc02cf.js","assets/SearchOption-f427c2c6.css","assets/HTHOJQJE-bb915be7.js","assets/KFH362HI-5923aab5.js","assets/LR7LBJN3-c025b240.js","assets/WTMIS75X-0c166f05.js","assets/index-c18aeead.js","assets/Paginator-4d027cda.js","assets/Paginator-a978daac.css","assets/StreamPage-67aaeea9.css"])),ja=window,bde=localStorage.getItem("devMode")==="true",zM=O1(({params:t})=>Hq(t.vanityName),"vanityName"),Ede=a(()=>{const t=ele(),e=Wp(),n=Rle(),i=Cle(),s=Ole(),r=Wle(),o=f1(),l=$le(),d=fne(),c=a(()=>lN(),"genNsec");return bde&&(ja.primal={account:{...z},explore:i,home:n,media:o,messages:r,notifications:l,profile:t,search:d,settings:e,thread:s,genNsec:c,nip19:Ce,nip44:td},ja.onPrimalComponentMount=()=>{},ja.onPrimalComponentCleanup=()=>{},ja.onPrimalCacheServerConnected=()=>{},ja.onPrimalUploadServerConnected=()=>{},ja.onPrimalCacheServerMessageReceived=()=>{},ja.onPrimalCacheServerMessageSent=()=>{}),X(aJ,{get children(){return[X($e,{path:"/app-download-qr",component:rde}),X($e,{path:"/",component:ade,get children(){return[X($e,{path:"/about",component:lde}),X($e,{path:"/terms",component:cde}),X($e,{path:"/privacy",component:dde})]}}),X($e,{path:"/csae-policy",component:fde}),X($e,{path:"/support",component:ude}),X($e,{path:"/",component:Mce,get children(){return[X($e,{path:"/",component:()=>X(Ob,{href:"/home"})}),X($e,{path:"/home",component:Rce}),X($e,{path:"/reads/edit/:id?",component:vde}),X($e,{path:"/reads/:topic?",component:kce}),X($e,{path:"/myarticles/:tab?",component:yde}),X($e,{path:"/thread/:id",component:Ig}),X($e,{path:"/e/:id",component:Ig}),X($e,{path:"/a/:id",component:Ig}),X($e,{path:"/explore",get children(){return[X($e,{path:"/",component:Cce}),X($e,{path:"/feed/:id",component:Pce})]}}),X($e,{path:"/dms/:contact?",component:Dce}),X($e,{path:"/notifications",component:Nce}),X($e,{path:"/downloads",component:Fce}),X($e,{path:"/download",component:()=>X(Ob,{href:"/downloads"})}),";",X($e,{path:"/settings",component:Uce,get children(){return[X($e,{path:"/",component:sde}),X($e,{path:"/account",component:jce}),X($e,{path:"/appearance",component:Yce}),X($e,{path:"/home_feeds",component:Zce}),X($e,{path:"/reads_feeds",component:Qce}),X($e,{path:"/notifications",component:qce}),X($e,{path:"/zaps",component:Xce}),X($e,{path:"/muted",component:ede}),X($e,{path:"/network",component:tde}),X($e,{path:"/filters",component:nde}),X($e,{path:"/nwc",component:ide}),X($e,{path:"/devtools",component:Jce}),X($e,{path:"/uploads",component:VB})]}}),X($e,{path:"/bookmarks",component:Oce}),X($e,{path:"/settings/profile",component:Hce}),X($e,{path:"/profile/:npub?",component:oE}),X($e,{path:"/p/:npub?",get children(){return[X($e,{path:"/",component:oE}),X($e,{path:"/live/streamId?",component:WM})]}}),X($e,{path:"/help",component:Bce}),X($e,{path:"/mutelist/:npub",component:Gce}),X($e,{path:"/new",component:Vce}
2155),X($e,{path:"/feeds",get children(){return[X($e,{path:"/",component:hde}),X($e,{path:"/:query",component:pde})]}}),X($e,{path:"/search",get children(){return[X($e,{path:"/",component:gde}),X($e,{path:"/:query",component:mde})]}}),X($e,{path:"/premium/:step?",component:Wce}),X($e,{path:"/premiums",component:Kce}),X($e,{path:"/legends",component:zce}),X($e,{path:"/:vanityName",get children(){return[X($e,{path:"/",component:oE,preload:zM}),X($e,{path:"/live/:streamId?",component:WM}),X($e,{path:"/:identifier",component:Ig,preload:zM})]}}),X($e,{path:"/pending",component:ode}),X($e,{path:"/rc/:code?",component:()=>X(Ob,{href:"/app-download-qr"})}),X($e,{path:"/404",component:$ce})]}})]}})},"AppRouter"),_de={locale:"en",messages:{}},wde=Pn();function Sde(t){const e=a(s=>{i("locale",()=>s)},"setLocale"),[n,i]=li({..._de,actions:{setLocale:e}});return X(wde.Provider,{value:n,get children(){return X(vQ,{get locale(){return n.locale},get messages(){return n.messages},get children(){return t.children}})}})}a(Sde,"TranslatorProvider");const Tde={notes:[],futureNotes:[],sidebarNotes:[],isFetching:!1,isFetchingSidebar:!1,scrollTop:0,selectedFeed:void 0,page:{messages:[],users:{},postStats:{},mentions:{},noteActions:{},topZaps:{},wordCount:{}},reposts:{},lastNote:void 0,mentionedNotes:{},future:{notes:[],reposts:{},page:{messages:[],users:{},postStats:{},mentions:{},noteActions:{},topZaps:{},wordCount:{}},scope:"",timeframe:"",latest_at:0},sidebar:{notes:[],page:{messages:[],users:{},postStats:{},mentions:{},noteActions:{},topZaps:{},wordCount:{}},isFetching:!1,query:void 0},paging:{notes:{...jn()},future:{...jn()},sidebar:{...jn()}},recomendedReads:[],articleHeights:{},topPicks:[],topics:[],featuredAuthor:void 0},WB=Pn(),Ade=a(t=>{const e=Wp(),n=a(H=>{M("notes",N=>N.filter($=>$.id!==H))},"removeEvent"),i=a(H=>{M("topics",()=>[...H])},"setTopics"),s=a(H=>{M("featuredAuthor",()=>({...H}))},"setFeaturedAuthor"),r=a(H=>{M("sidebar","query",()=>({...H}))},"updateSidebarQuery"),o=a(async H=>{M("isFetchingSidebar",()=>!0);const N=await fle(`reads_recomended_${Ee}`);M("topPicks",()=>[...N]),M("isFetchingSidebar",()=>!1)},"doSidebarSearch"),l=a(()=>{M("futureNotes",()=>[]),M("paging","future",()=>({since:0,until:0,sortBy:"published_at"}))},"clearFuture"),d=a(async H=>{if(I.paging.notes.sortBy!=="created_at"||I.futureNotes.length>100)return;let N=I.paging.future.until||I.paging.notes.until||0;const $=I.futureNotes.length>0?I.futureNotes:I.notes.slice(0,20),F=qf($,I.futureNotes.length>0?I.paging.future:I.paging.notes),{reads:D,paging:L}=await _l(z.publicKey,H,`home_future_${Ee}`,{since:N,limit:100,offset:F}),m=$.map(_=>_.id),S=D.filter(_=>!m.includes(_.id));M("paging","future",()=>({...L})),M("futureNotes",_=>[..._,...S])},"checkForNewNotes"),c=a(()=>{I.futureNotes.length!==0&&(M("notes",H=>[...I.futureNotes,...H]),l())},"loadFutureContent"),u=a(async(H,N=0,$=!0)=>{M("isFetching",()=>$);const F=z.publicKey||Xv.names.primal,D=qf(I.notes,I.paging.notes),{reads:L,paging:m}=await _l(F,H,`reads_feed_${Ee}`,{until:N,limit:20,offset:D}),S=H0(L,m);M("paging","notes",()=>({...m})),M("notes",_=>[..._,...S]),M("isFetching",()=>!1)},"fetchNotes"),f=a(()=>{M("scrollTop",()=>0),window.scrollTo({top:0}),M("notes",()=>[]),M("paging","notes",()=>({since:0,until:0,sortBy:"published_at"})),l()},"clearNotes"),h=a(H=>{if(I.isFetching)return;const N=H||I.selectedFeed?.spec||"",$=I.paging.notes.since||0;$>0&&u(N,$)},"fetchNextPage"),p=a(H=>{M("scrollTop",()=>H)},"updateScrollTop");let g;const v=a(H=>{H?.spec!==void 0&&H.spec!==g?.spec&&(g={...H},SN(z.publicKey,"reads",g),M("selectedFeed",Si({...H})),f(),u(H.spec,0))},"selectFeed"),y=a(()=>{I.selectedFeed&&(f(),u(I.selectedFeed.spec,0))},"refetchSelectedFeed"),b=a(()=>{g=void 0,M("selectedFeed",()=>{})},"resetSelectedFeed"),E=a(()=>{const H=I.selectedFeed;H?.spec&&(f(),u(H.spec,0))},"getFirstPage"),T=a((H,N)=>{M("articleHeights",H,()=>N)},"setArticleHeight");We(oi(()=>e?.readsFeedsReloaded,H=>{if(!H)return;const N=wN(z.publicKey,"reads")||e?.readsFeeds[0];v(N)}));const[I,M]=li({...Tde,actions:{clearNotes:f,fetchNotes:u,fetchNextPage:h,selectFeed:v,resetSelectedFeed:b,updateScrollTop:p,checkForNewNotes:d,loadFutureContent:c,doSidebarSearch:o,updateSidebarQuery:r,getFirstPage:E,setArticleHeight:T,setTopics:i,setFeaturedAuthor:s,refetchSelectedFeed:y,removeEvent:n}});return X(WB.Provider,{value:I,get children(){return t.children}})},"ReadsProvider"),awe=a(()=>Dn(WB),"useReadsContext"),KM=["82341f882b6eabcd2ba7f1ef90aad961cf074af15b9ef44a09f9d2a8fbfbe6a2","bf2376e17ba4ec269d10fcc996a4746b451152be9031fa48e74553dde5526bce","c48e29f04b482cc01ca1f9ef8c86ef8318c059e0e9353235162f080f26e14c11","85080d3bad70ccdcd7f74c29a44f55bb85cbcd3dd0cbb957da1d215bdb931204","eab0e756d32b80bcd464f3d844b8040303075a13eabc3599a762c9ac7ab91f4f","04c915daefee38317fa734444acee390a8269fe5810b2241e5e6dd343dfbecc9","472f440f29ef996e92a186b8d320ff180c855903882e59d50de1b8bd5669301e","e88a691e98d9987c964521dff60025f60
2155700378a4879180dcbbb4a5027850411","91c9a5e1a9744114c6fe2d61ae4de82629eaaa0fb52f48288093c7e7e036f832","fa984bd7dbb282f07e16e7ae87b26a2a7b9b90b7246a44771f0cf5ae58018f52"],xde={contentQuery:"",users:[],scores:{},contentUsers:[],contentScores:{},notes:[],reads:[],isFetchingUsers:!1,isFetchingContent:!1,reposts:{},mentionedNotes:{},filteringReasons:[],errors:[],searchCommand:"",paging:{...jn()}},zB=Pn();function Ide(t){const e=a((g,v)=>{p(v,y=>y.filter(b=>b.id!==g))},"removeEvent"),n=a(g=>{const v=`find_npub_${Ee}`;let y;try{y=Ce.decode(g)}catch{s(g);return}if(!y){s(g);return}const b=typeof y.data=="string"?y.data:y.data.pubkey;let E=[];const T=Me(v,{onEvent:(I,M)=>{if(M){if(M.kind===G.Metadata){const H=M;E.push(dt(H,M.pubkey));return}if(M.kind===G.UserScore){const H=JSON.parse(M.content);p("scores",()=>({...H}));return}}},onEose:()=>{E.length>0&&p("users",()=>[E[0]]),p("isFetchingUsers",()=>!1),T()}});Na([b],v)},"findUserByNupub"),i=a(g=>{const v=`recomended_users_${Ee}`;let y=[];const b=Me(v,{onEvent:(E,T)=>{if(T){if(T.kind===G.Metadata){const I=T;y.push(dt(I,T.pubkey));return}if(T.kind===G.UserScore){const I=JSON.parse(T.content);p("scores",()=>({...I}));return}}},onEose:()=>{let E=[];y.forEach(T=>{const I=KM.indexOf(T.pubkey);E[I]={...T}}),g&&(E=[...g,...E].slice(0,9)),p("users",()=>E),p("isFetchingUsers",()=>!1),b()}});p("isFetchingUsers",()=>!0),Na(KM,v)},"getRecomendedUsers"),s=a((g,v)=>{const y=`search_users_${Ee}`;let b=[];const E=Me(y,{onEvent:(I,M)=>{if(M){if(M.kind===G.Metadata){const H=M;b.push(dt(H,M.pubkey));return}if(M.kind===G.UserScore){const H=JSON.parse(M.content);p("scores",()=>({...H}));return}}},onEose:()=>{const I=b.sort((M,H)=>{const N=h.scores[M.pubkey];return h.scores[H.pubkey]-N});p("users",()=>I.slice(0,10)),p("isFetchingUsers",()=>!1),E()}}),T=g.length>0?void 0:v;p("isFetchingUsers",()=>!0),K_(T,y,g)},"findUsers"),r=a(async(g,v)=>{const y=`search_users_c_${Ee}`;try{const b=JSON.stringify({id:"advsearch",query:`kind:0 ${g}`}),{users:E}=await _l(z.publicKey,b,y,{limit:10});p("contentUsers",()=>E)}catch(b){Tn("ERROR fetching search results: ",b)}},"findContentUsers"),o=a(g=>{if(h.isFetchingContent)return;const v=h.paging.since||0;v>0&&d(g,v)},"fetchContentNextPage"),l=a(()=>{p("paging",()=>({...jn()})),p("reads",()=>[]),p("notes",()=>[])},"clearSearch"),d=a(async(g,v=0)=>{try{const y=JSON.stringify({id:"advsearch",query:g});p("isFetchingContent",()=>!0);const b=g.includes("kind:30023")?"reads":"notes";let E=0;b==="reads"?E=qf(h.reads,h.paging):b==="notes"&&(E=E_(h.notes,h.paging));const{notes:T,reads:I,userPolls:M,zapPolls:H,paging:N}=await eh(z.publicKey,y,`adv_search_${Ee}`,[G.Text,G.LongForm,G.UserPoll,G.ZapPoll],{limit:20,until:v,offset:E}),$=$0([...T,...M,...H],N),F=H0(I,N);p("paging",()=>({...N})),p("reads",D=>[...D,...F]),p("notes",D=>[...D,...$])}catch(y){Tn("ERROR fetching search results: ",y)}p("isFetchingContent",()=>!1)},"findContent"),c=a(g=>{p("contentQuery",()=>g)},"setContentQuery"),u=a(g=>{const v=au(g);let y=[];if(v.length>0){const b=`search_filtered_users_${Ee}`,E=Me(b,{onEvent:(T,I)=>{if(I?.kind===G.FilteringReason){const M=JSON.parse(I.content);if(M.action==="allow")return;if(M.pubkey){y.push(M.pubkey);return}if(M.group){y.push(M.group);return}}},onEose:()=>{p("filteringReasons",()=>[...y]),E()}});SU(v,z.publicKey,b)}},"findFilteredUserByNpub"),f=a(g=>p("searchCommand",()=>g),"setSearchCommand"),[h,p]=li({...xde,actions:{findUsers:s,findUserByNupub:n,findContent:d,fetchContentNextPage:o,findContentUsers:r,setContentQuery:c,getRecomendedUsers:i,findFilteredUserByNpub:u,clearSearch:l,setSearchCommand:f,removeEvent:e}});return X(zB.Provider,{value:h,get children(){return t.children}})}a(Ide,"AdvancedSearchProvider");function lwe(){return Dn(zB)}a(lwe,"useAdvancedSearchContext");const Ve={MEDIA_PLAY_REQUEST:"mediaplayrequest",MEDIA_PAUSE_REQUEST:"mediapauserequest",MEDIA_MUTE_REQUEST:"mediamuterequest",MEDIA_UNMUTE_REQUEST:"mediaunmuterequest",MEDIA_VOLUME_REQUEST:"mediavolumerequest",MEDIA_SEEK_REQUEST:"mediaseekrequest",MEDIA_AIRPLAY_REQUEST:"mediaairplayrequest",MEDIA_ENTER_FULLSCREEN_REQUEST:"mediaenterfullscreenrequest",MEDIA_EXIT_FULLSCREEN_REQUEST:"mediaexitfullscreenrequest",MEDIA_PREVIEW_REQUEST:"mediapreviewrequest",MEDIA_ENTER_PIP_REQUEST:"mediaenterpiprequest",MEDIA_EXIT_PIP_REQUEST:"mediaexitpiprequest",MEDIA_ENTER_CAST_REQUEST:"mediaentercastrequest",MEDIA_EXIT_CAST_REQUEST:"mediaexitcastrequest",MEDIA_SHOW_TEXT_TRACKS_REQUEST:"mediash
2155owtexttracksrequest",MEDIA_HIDE_TEXT_TRACKS_REQUEST:"mediahidetexttracksrequest",MEDIA_SHOW_SUBTITLES_REQUEST:"mediashowsubtitlesrequest",MEDIA_DISABLE_SUBTITLES_REQUEST:"mediadisablesubtitlesrequest",MEDIA_TOGGLE_SUBTITLES_REQUEST:"mediatogglesubtitlesrequest",MEDIA_PLAYBACK_RATE_REQUEST:"mediaplaybackraterequest",MEDIA_RENDITION_REQUEST:"mediarenditionrequest",MEDIA_AUDIO_TRACK_REQUEST:"mediaaudiotrackrequest",MEDIA_SEEK_TO_LIVE_REQUEST:"mediaseektoliverequest",REGISTER_MEDIA_STATE_RECEIVER:"registermediastatereceiver",UNREGISTER_MEDIA_STATE_RECEIVER:"unregistermediastatereceiver"},Wt={MEDIA_CHROME_ATTRIBUTES:"mediachromeattributes",MEDIA_CONTROLLER:"mediacontroller"},KB={MEDIA_AIRPLAY_UNAVAILABLE:"mediaAirplayUnavailable",MEDIA_AUDIO_TRACK_ENABLED:"mediaAudioTrackEnabled",MEDIA_AUDIO_TRACK_LIST:"mediaAudioTrackList",MEDIA_AUDIO_TRACK_UNAVAILABLE:"mediaAudioTrackUnavailable",MEDIA_BUFFERED:"mediaBuffered",MEDIA_CAST_UNAVAILABLE:"mediaCastUnavailable",MEDIA_CHAPTERS_CUES:"mediaChaptersCues",MEDIA_CURRENT_TIME:"mediaCurrentTime",MEDIA_DURATION:"mediaDuration",MEDIA_ENDED:"mediaEnded",MEDIA_ERROR:"mediaError",MEDIA_ERROR_CODE:"mediaErrorCode",MEDIA_ERROR_MESSAGE:"mediaErrorMessage",MEDIA_FULLSCREEN_UNAVAILABLE:"mediaFullscreenUnavailable",MEDIA_HAS_P
2155LAYED:"mediaHasPlayed",MEDIA_HEIGHT:"mediaHeight",MEDIA_IS_AIRPLAYING:"mediaIsAirplaying",MEDIA_IS_CASTING:"mediaIsCasting",MEDIA_IS_FULLSCREEN:"mediaIsFullscreen",MEDIA_IS_PIP:"mediaIsPip",MEDIA_LOADING:"mediaLoading",MEDIA_MUTED:"mediaMuted",MEDIA_PAUSED:"mediaPaused",MEDIA_PIP_UNAVAILABLE:"mediaPipUnavailable",MEDIA_PLAYBACK_RATE:"mediaPlaybackRate",MEDIA_PREVIEW_CHAPTER:"mediaPreviewChapter",MEDIA_PREVIEW_COORDS:"mediaPreviewCoords",MEDIA_PREVIEW_IMAGE:"mediaPreviewImage",MEDIA_PREVIEW_TIME:"mediaPreviewTime",MEDIA_RENDITION_LIST:"mediaRenditionList",MEDIA_RENDITION_SELECTED:"mediaRenditionSelected",MEDIA_RENDITION_UNAVAILABLE:"mediaRenditionUnavailable",MEDIA_SEEKABLE:"mediaSeekable",MEDIA_STREAM_TYPE:"mediaStreamType",MEDIA_SUBTITLES_LIST:"mediaSubtitlesList",MEDIA_SUBTITLES_SHOWING:"mediaSubtitlesShowing",MEDIA_TARGET_LIVE_WINDOW:"mediaTargetLiveWindow",MEDIA_TIME_IS_LIVE:"mediaTimeIsLive",MEDIA_VOLUME:"mediaVolume",MEDIA_VOLUME_LEVEL:"mediaVolumeLevel",MEDIA_VOLUME_UNAVAILABLE:"mediaVolumeUnavailable",MEDIA_LANG:"mediaLang",MEDIA_WIDTH:"mediaWidth"},qB=Object.entries(KB),J=qB.reduce((t,[e,n])=>(t[e]=n.toLowerCase(),t),{}),Lde={USER_INACTIVE_CHANGE:"userinactivechange",BREAKPOINTS_CHANGE:"breakpointchange",BREAKPOINTS_COMPUTED:"breakpointscomputed"},Kl=qB.reduce((t,[e,n])=>(t[e]=n.toLowerCase(),t),{...Lde});Object.entries(Kl).reduce((t,[e,n])=>{const i=J[e];return i&&(t[n]=i),t},{userinactivechange:"userinactive"});const Rde=Object.entries(J).reduce((t,[e,n])=>{const i=Kl[e];return i&&(t[n]=i),t},{userinactive:"userinactivechange"}),Dr={SUBTITLES:"subtitles",CAPTIONS:"captions",DESCRIPTIONS:"descriptions",CHAPTERS:"chapters",METADATA:"metadata"},md={DISABLED:"disabled",HIDDEN:"hidden",SHOWING:"showing"},qM={MOUSE:"mouse",PEN:"pen",TOUCH:"touch"},ws={UNAVAILABLE:"unavailable",UNSUPPORTED:"unsupported"},io={LIVE:"live",ON_DEMAND:"on-demand",UNKNOWN:"unknown"},kde={INLINE:"inline",FULLSCREEN:"fullscreen",PICTURE_IN_PICTURE:"picture-in-picture"};function Mde(t){return t?.map(Cde).join(" ")}a(Mde,"stringifyRenditionList");function Cde(t){if(t){const{id:e,width:n,height:i}=t;return[e,n,i].filter(s=>s!=null).join(":")}}a(Cde,"stringifyRendition");function Pde(t){return t?.map(Dde).join(" ")}a(Pde,"stringifyAudioTrackList");function Dde(t){if(t){const{id:e,kind:n,language:i,label:s}=t;return[e,n,i,s].filter(r=>r!=null).join(":")}}a(Dde,"stringifyAudioTrack");function Ode(t){return t.replace(/[-_]([a-z])/g,(e,n)=>n.toUpperCase())}a(Ode,"camelCase");function uA(t){return typeof t=="number"&&!Number.isNaN(t)&&Number.isFinite(t)}a(uA,"isValidNumber");function jB(t){return typeof t!="string"?!1:!isNaN(t)&&!isNaN(parseFloat(t))}a(jB,"isNumericString");const YB=a(t=>new Promise(e=>setTimeout(e,t)),"delay"),jM=[{singular:"hour",plural:"hours"},{singular:"minute",plural:"minutes"},{singular:"second",plural:"seconds"}],Nde=a((t,e)=>{const n=t===1?jM[e].singular:jM[e].plural;return`${t} ${n}`},"toTimeUnitPhrase"),wf=a(t=>{if(!uA(t))return"";const e=Math.abs(t),n=e!==t,i=new Date(0,0,0,0,0,e,0);return`${[i.getHours(),i.getMinutes(),i.getSeconds()].map((l,d)=>l&&Nde(l,d)).filter(l=>l).join(", ")}${n?" remaining":""}`},"formatAsTimePhrase");function Ca(t,e){let n=!1;t<0&&(n=!0,t=0-t),t=t<0?0:t;let i=Math.floor(t%60),s=Math.floor(t/60%60),r=Math.floor(t/3600);const o=Math.floor(e/60%60),l=Math.floor(e/3600);return(isNaN(t)||t===1/0)&&(r=s=i="0"),r=r>0||l>0?r+":":"",s=((r||o>=10)&&s<10?"0"+s:s)+":",i=i<10?"0"+i:i,(n?"-":"")+r+s+i}a(Ca,"formatTime");const Fde={"Start airplay":"Start airplay","Stop airplay":"Stop airplay",Audio:"Audio",Captions:"Captions","Enable captions":"Enable captions","Disable captions":"Disable captions","Start casting":"Start casting","Stop casting":"Stop casting","Enter fullscreen mode":"Enter fullscreen mode","Exit fullscreen mode":"Exit fullscreen mode",Mute:"Mute",Unmute:"Unmute","Enter picture in picture mode":"Enter picture in picture mode","Exit picture in picture mode":"Exit picture in picture mode",Play:"Play",Pause:"Pause","Playback rate":"Playback rate","Playback rate {playbackRate}":"Playback rate {playbackRate}",Quality:"Quality","Seek backward":"Seek backward","Seek forward":"Seek forward",Settings:"Settings",Auto:"Auto","audio player":"audio player","video player":"video player",volume:"volume",seek:"seek","closed captions":"closed captions","current playback rate":"current playback rate","playback time":"playback time","media loading":"media loading",settings:"settings","audio tracks":"audio tracks",quality:"quality",play:"play",pause:"pause",mute:"mute",unmute:"unmute","chapter: {chapterName}":"chapter: {chapterName}",live:"live",Off:"Off","start airplay":"start airplay","stop airplay":"stop airplay","start casting":"start casting","stop casting":"stop casting","enter fullscreen mode":"enter fullscreen mode","exit fullscreen mode":"exit fullscreen mode","enter picture in picture mode":"enter picture in picture mode","exit picture in picture mode":"exit picture in picture mode","seek to live":"seek to live","playing live":"playing live","seek back {seekOffset} seconds":"seek back {seekOffset} seconds","seek forward {seekOffset} seconds":"seek forward {seekOffset} seconds","Network Error":"Network Error","Decode Error":"Decode Error","S
2155ource Not Supported":"Source Not Supported","Encryption Error":"Encryption Error","A network error caused the media download to fail.":"A network error caused the media download to fail.","A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.":"A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.","An unsupported error occurred. The server or network failed, or your browser does not support this format.":"An unsupported error occurred. The server or network failed, or your browser does not support this format.","The media is encrypted and there are no keys to decrypt it.":"The media is encrypted and there are no keys to decrypt it."};var YM;const aE={en:Fde};let dw=((YM=globalThis.navigator)==null?void 0:YM.language)||"en";const Ude=a(t=>{dw=t},"setLanguage"),Bde=a(t=>{var e,n,i;const[s]=dw.split("-");return((e=aE[dw])==null?void 0:e[t])||((n=aE[s])==null?void 0:n[t])||((i=aE.en)==null?void 0:i[t])||t},"resolveTranslation"),Xe=a((t,e={})=>Bde(t).replace(/\{(\w+)\}/g,(n,i)=>i in e?String(e[i]):`{${i}}`),"t");var gp;let ZB=(gp=class{addEventListener(){}removeEventListener(){}dispatchEvent(){return!0}},a(gp,"EventTarget"),gp);var mp;let QB=(mp=class extends ZB{},a(mp,"Node"),mp);var vp;let ZM=(vp=class extends QB{constructor(){super(...arguments),this.role=null}},a(vp,"Element"),vp);var yp;let $de=(yp=class{observe(){}unobserve(){}disconnect(){}},a(yp,"ResizeObserver"),yp);const JB={createElement:function(){return new th.HTMLElement},createElementNS:function(){return new th.HTMLElement},addEventListener(){},removeEventListener(){},dispatchEvent(t){return!1}};var bp,Ep,_p;const th={ResizeObserver:$de,document:JB,Node:QB,Element:ZM,HTMLElement:(bp=class extends ZM{constructor(){super(...arguments),this.innerHTML=""}get content(){return new th.DocumentFragment}},a(bp,"HTMLElement"),bp),DocumentFragment:(Ep=class extends ZB{},a(Ep,"DocumentFragment"),Ep),customElements:{get:function(){},define:function(){},whenDefined:function(){}},localStorage:{getItem(t){return null},setItem(t,e){},removeItem(t){}},CustomEvent:a(function(){},"CustomEvent"),getComputedStyle:function(){},navigator:{languages:[],get userAgent(){return""}},matchMedia(t){return{matches:!1,media:t}},DOMParser:(_p=class{parseFromString(e,n){return{body:{textContent:e}}}},a(_p,"DOMParser"),_p)},XB=typeof window>"u"||typeof window.customElements>"u",e$=Object.keys(th).every(t=>t in globalThis),me=XB&&!e$?th:globalThis,Li=XB&&!e$?JB:globalThis.document,QM=new WeakMap,fA=a(t=>{let e=QM.get(t);return e||QM.set(t,e=new Set),e},"getCallbacks"),t$=new me.ResizeObserver(t=>{for(const e of t)for(const n of fA(e.target))n(e)});function n$(t,e){fA(t).add(e),t$.observe(t)}a(n$,"observeResize");function i$(t,e){const n=fA(t);n.delete(e),n.size||t$.unobserve(t)}a(i$,"unobserveResize");function Qs(t){const e={};for(const n of t)e[n.name]=n.value;return e}a(Qs,"namedNodeMapToObject$1");function Hde(t){var e;return(e=Gde(t))!=null?e:zp(t,"media-controller")}a(Hde,"getMediaController");function Gde(t){var e;const{MEDIA_CONTROLLER:n}=Wt,i=t.getAttribute(n);if(i)return(e=Wde(t))==null?void 0:e.getElementById(i)}a(Gde,"getAttributeMediaController");const s$=a((t,e,n=".value")=>{const i=t.querySelector(n);i&&(i.textContent=e)},"updateIconText"),Vde=a((t,e)=>{const n=`slot[name="${e}"]`,i=t.shadowRoot.querySelector(n);return i?i.children:[]},"getAllSlotted"),r$=a((t,e)=>Vde(t,e)[0],"getSlotted"),vu=a((t,e)=>!t||!e?!1:t?.contains(e)?!0:vu(t,e.getRootNode().host),"containsComposedNode"),zp=a((t,e)=>{if(!t)return null;const n=t.closest(e);return n||zp(t.getRootNode().host,e)},"closestComposedNode");function o$(t=document){var e;const n=t?.activeElement;return n?(e=o$(n.shadowRoot))!=null?e:n:null}a(o$,"getActiveElement");function Wde(t){var e;const n=(e=t?.getRootNode)==null?void 0:e.call(t);return n instanceof ShadowRoot||n instanceof Document?n:null}a(Wde,"getDocumentOrShadowRoot");function a$(t,{depth:e=3,checkOpacity:n=!0,checkVisibilityCSS:i=!0}={}){if(t.checkVisibility)return t.checkVisibility({checkOpacity:n,checkVisibilityCSS:i});let s=t;for(;s&&e>0;){const r=getComputedStyle(s);if(n&&r.opacity==="0"||i&&r.visibility==="hidden"||r.display==="none")return!1;s=s.parentElement,e--}return!0}a(a$,"isElementVisible");function zde(t,e,n,i){const s=i.x-n.x,r=i.y-n.y,o=s*s+r*r;if(o===0)return 0;const l=((t-n.x)*s+(e-n.y)*r)/o;return Math.max(0,Math.min(1,l))}a(zde,"getPointProgressOnLine");function Bn(t,e){const n=Kde(t,i=>i===e);return n||qde(t,e)}a(Bn,"getOrInsertCSSRule");function Kde(t,e){var n,i;let s;for(s of(n=t.querySelectorAll("style:not([media])"))!=null?n:[]){let r;try{r=(i=s.sheet)==null?void 0:i.cssRules}catch{continue}for(const o of r??[])if(e(o.selectorText))return o}}a(Kde,"getCSSRule");function qde(t,e){var n,i;const s=(n=t.querySelectorAll("style:not([media])"))!=null?n:[],r=s?.[s.length-1];return r?.sheet?(r?.sheet.insertRule(`${e}{}`,r.sheet.cssRules.length),(i=r.sheet.cssRules)==null?void 0:i[r.sheet.cssRules.length-1]):(console.warn("Media Chrome: No style sheet found on style tag of",t),{style:{setProperty:()=>{},removeProperty:()=>"",getPropertyValue:()=>""}})}a(qde,"insertCSSRule");function Rn(t,e,n=Number.NaN){const i=t.getAttribute(e);return i!=null?+i:n}a(Rn,"getNumericAttr");function si(t,e,n){const i=+n;
2155if(n==null||Number.isNaN(i)){t.hasAttribute(e)&&t.removeAttribute(e);return}Rn(t,e,void 0)!==i&&t.setAttribute(e,`${i}`)}a(si,"setNumericAttr");function Dt(t,e){return t.hasAttribute(e)}a(Dt,"getBooleanAttr");function Ot(t,e,n){if(n==null){t.hasAttribute(e)&&t.removeAttribute(e);return}Dt(t,e)!=n&&t.toggleAttribute(e,n)}a(Ot,"setBooleanAttr");function Mn(t,e,n=null){var i;return(i=t.getAttribute(e))!=null?i:n}a(Mn,"getStringAttr");function Cn(t,e,n){if(n==null){t.hasAttribute(e)&&t.removeAttribute(e);return}const i=`${n}`;Mn(t,e,void 0)!==i&&t.setAttribute(e,i)}a(Cn,"setStringAttr");var l$=a((t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},"__accessCheck$k"),Bo=a((t,e,n)=>(l$(t,e,"read from private field"),n?n.call(t):e.get(t)),"__privateGet$k"),jde=a((t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},"__privateAdd$k"),Lg=a((t,e,n,i)=>(l$(t,e,"write to private field"),i?i.call(t,n):e.set(t,n),n),"__privateSet$j"),Wi;function Yde(t){return`
2156    <style>
2157      :host {
2158        display: var(--media-control-display, var(--media-gesture-receiver-display, inline-block));
2159        box-sizing: border-box;
2160      }
2161    </style>
2162  `}a(Yde,"getTemplateHTML$b");const rx=class rx extends me.HTMLElement{constructor(){if(super(),jde(this,Wi,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Qs(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[Wt.MEDIA_CONTROLLER,J.MEDIA_PAUSED]}attributeChangedCallback(e,n,i){var s,r,o,l,d;e===Wt.MEDIA_CONTROLLER&&(n&&((r=(s=Bo(this,Wi))==null?void 0:s.unassociateElement)==null||r.call(s,this),Lg(this,Wi,null)),i&&this.isConnected&&(Lg(this,Wi,(o=this.getRootNode())==null?void 0:o.getElementById(i)),(d=(l=Bo(this,Wi))==null?void 0:l.associateElement)==null||d.call(l,this)))}connectedCallback(){var e,n,i,s;this.tabIndex=-1,this.setAttribute("aria-hidden","true"),Lg(this,Wi,Zde(this)),this.getAttribute(Wt.MEDIA_CONTROLLER)&&((n=(e=Bo(this,Wi))==null?void 0:e.associateElement)==null||n.call(e,this)),(i=Bo(this,Wi))==null||i.addEventListener("pointerdown",this),(s=Bo(this,Wi))==null||s.addEventListener("click",this)}disconnectedCallback(){var e,n,i,s;this.getAttribute(Wt.MEDIA_CONTROLLER)&&((n=(e=Bo(this,Wi))==null?void 0:e.unassociateElement)==null||n.call(e,this)),(i=Bo(this,Wi))==null||i.removeEventListener("pointerdown",this),(s=Bo(this,Wi))==null||s.removeEventListener("click",this),Lg(this,Wi,null)}handleEvent(e){var n;const i=(n=e.composedPath())==null?void 0:n[0];if(["video","media-controller"].includes(i?.localName)){if(e.type==="pointerdown")this._pointerType=e.pointerType;else if(e.type==="click"){const{clientX:r,clientY:o}=e,{left:l,top:d,width:c,height:u}=this.getBoundingClientRect(),f=r-l,h=o-d;if(f<0||h<0||f>c||h>u||c===0&&u===0)return;const{pointerType:p=this._pointerType}=e;if(this._pointerType=void 0,p===qM.TOUCH){this.handleTap(e);return}else if(p===qM.MOUSE){this.handleMouseClick(e);return}}}}get mediaPaused(){return Dt(this,J.MEDIA_PAUSED)}set mediaPaused(e){Ot(this,J.MEDIA_PAUSED,e)}handleTap(e){}handleMouseClick(e){const n=this.mediaPaused?Ve.MEDIA_PLAY_REQUEST:Ve.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new me.CustomEvent(n,{composed:!0,bubbles:!0}))}};a(rx,"MediaGestureReceiver");let Wd=rx;Wi=new WeakMap;Wd.shadowRootOptions={mode:"open"};Wd.getTemplateHTML=Yde;function Zde(t){var e;const n=t.getAttribute(Wt.MEDIA_CONTROLLER);return n?(e=t.getRootNode())==null?void 0:e.getElementById(n):zp(t,"media-controller")}a(Zde,"getMediaControllerEl");me.customElements.get("media-gesture-receiver")||me.customElements.define("media-gesture-receiver",Wd);var JM=Wd,hA=a((t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},"__accessCheck$j"),cs=a((t,e,n)=>(hA(t,e,"read from private field"),n?n.call(t):e.get(t)),"__privateGet$j"),os=a((t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},"__privateAdd$j"),el=a((t,e,n,i)=>(hA(t,e,"write to private field"),i?i.call(t,n):e.set(t,n),n),"__privateSet$i"),Is=a((t,e,n)=>(hA(t,e,"access private method"),n),"__privateMethod$6"),G0,Nc,nh,id,um,uw,c$,ef,fm,fw,d$,hw,u$,ih,Dy,Oy,pA,zd,sh;const tt={AUDIO:"audio",AUTOHIDE:"autohide",BREAKPOINTS:"breakpoints",GESTURES_DISABLED:"gesturesdisabled",KEYBOARD_CONTROL:"keyboardcontrol",NO_AUTOHIDE:"noautohide",USER_INACTIVE:"userinactive",AUTOHIDE_OVER_CONTROLS:"autohideovercontrols"};function Qde(t){return`
2163    <style>
2164      
2165      :host([${J.MEDIA_IS_FULLSCREEN}]) ::slotted([slot=media]) {
2166        outline: none;
2167      }
2168
2169      :host {
2170        box-sizing: border-box;
2171        position: relative;
2172        display: inline-block;
2173        line-height: 0;
2174        background-color: var(--media-background-color, #000);
2175      }
2176
2177      :host(:not([${tt.AUDIO}])) [part~=layer]:not([part~=media-layer]) {
2178        position: absolute;
2179        top: 0;
2180        left: 0;
2181        bottom: 0;
2182        right: 0;
2183        display: flex;
2184        flex-flow: column nowrap;
2185        align-items: start;
2186        pointer-events: none;
2187        background: none;
2188      }
2189
2190      slot[name=media] {
2191        display: var(--media-slot-display, contents);
2192      }
2193
2194      
2195      :host([${tt.AUDIO}]) slot[name=media] {
2196        display: var(--media-slot-display, none);
2197      }
2198
2199      
2200      :host([${tt.AUDIO}]) [part~=layer][part~=gesture-layer] {
2201        height: 0;
2202        display: block;
2203      }
2204
2205      
2206      :host(:not([${tt.AUDIO}])[${tt.GESTURES_DISABLED}]) ::slotted([slot=gestures-chrome]),
2207          :host(:not([${tt.AUDIO}])[${tt.GESTURES_DISABLED}]) media-gesture-receiver[slot=gestures-chrome] {
2208        display: none;
2209      }
2210
2211      
2212      ::slotted(:not([slot=media]):not([slot=poster]):not(media-loading-indicator):not([role=dialog]):not([hidden])) {
2213        pointer-events: auto;
2214      }
2215
2216      :host(:not([${tt.AUDIO}])) *[part~=layer][part~=centered-layer] {
2217        align-items: center;
2218        justify-content: center;
2219      }
2220
2221      :host(:not([${tt.AUDIO}])) ::slotted(media-gesture-receiver[slot=gestures-chrome]),
2222      :host(:not([${tt.AUDIO}])) media-gesture-receiver[slot=gestures-chrome] {
2223        align-self: stretch;
2224        flex-grow: 1;
2225      }
2226
2227      slot[name=middle-chrome] {
2228        display: inline;
2229        flex-grow: 1;
2230        pointer-events: none;
2231        background: none;
2232      }
2233
2234      
2235      ::slotted([slot=media]),
2236      ::slotted([slot=poster]) {
2237        width: 100%;
2238        height: 100%;
2239      }
2240
2241      
2242      :host(:not([${tt.AUDIO}])) .spacer {
2243        flex-grow: 1;
2244      }
2245
2246      
2247      :host(:-webkit-full-screen) {
2248        
2249        width: 100% !important;
2250        height: 100% !important;
2251      }
2252
2253      
2254      ::slotted(:not([slot=media]):not([slot=poster]):not([${tt.NO_AUTOHIDE}]):not([hidden]):not([role=dialog])) {
2255        opacity: 1;
2256        transition: var(--media-control-transition-in, opacity 0.25s);
2257      }
2258
2259      
2260      :host([${tt.USER_INACTIVE}]:not([${J.MEDIA_PAUSED}]):not([${J.MEDIA_IS_AIRPLAYING}
2260]):not([${J.MEDIA_IS_CASTING}]):not([${tt.AUDIO}])) ::slotted(:not([slot=media]):not([slot=poster]):not([${tt.NO_AUTOHIDE}]):not([role=dialog])) {
2261        opacity: 0;
2262        transition: var(--media-control-transition-out, opacity 1s);
2263      }
2264
2265      :host([${tt.USER_INACTIVE}]:not([${tt.NO_AUTOHIDE}]):not([${J.MEDIA_PAUSED}]):not([${J.MEDIA_IS_CASTING}]):not([${tt.AUDIO}])) ::slotted([slot=media]) {
2266        cursor: none;
2267      }
2268
2269      :host([${tt.USER_INACTIVE}][${tt.AUTOHIDE_OVER_CONTROLS}]:not([${tt.NO_AUTOHIDE}]):not([${J.MEDIA_PAUSED}]):not([${J.MEDIA_IS_CASTING}]):not([${tt.AUDIO}])) * {
2270        --media-cursor: none;
2271        cursor: none;
2272      }
2273
2274
2275      ::slotted(media-control-bar)  {
2276        align-self: stretch;
2277      }
2278
2279      
2280      :host(:not([${tt.AUDIO}])[${J.MEDIA_HAS_PLAYED}]) slot[name=poster] {
2281        display: none;
2282      }
2283
2284      ::slotted([role=dialog]) {
2285        width: 100%;
2286        height: 100%;
2287        align-self: center;
2288      }
2289
2290      ::slotted([role=menu]) {
2291        align-self: end;
2292      }
2293    </style>
2294
2295    <slot name="media" part="layer media-layer"></slot>
2296    <slot name="poster" part="layer poster-layer"></slot>
2297    <slot name="gestures-chrome" part="layer gesture-layer">
2298      <media-gesture-receiver slot="gestures-chrome">
2299        <template shadowrootmode="${JM.shadowRootOptions.mode}">
2300          ${JM.getTemplateHTML({})}
2301        </template>
2302      </media-gesture-receiver>
2303    </slot>
2304    <span part="layer vertical-layer">
2305      <slot name="top-chrome" part="top chrome"></slot>
2306      <slot name="middle-chrome" part="middle chrome"></slot>
2307      <slot name="centered-chrome" part="layer centered-layer center centered chrome"></slot>
2308      
2309      <slot part="bottom chrome"></slot>
2310    </span>
2311    <slot name="dialog" part="layer dialog-layer"></slot>
2312  `}a(Qde,"getTemplateHTML$a");const Jde=Object.values(J),Xde="sm:384 md:576 lg:768 xl:960";function eue(t){f$(t.target,t.contentRect.width)}a(eue,"resizeCallback");function f$(t,e){var n;if(!t.isConnected)return;const i=(n=t.getAttribute(tt.BREAKPOINTS))!=null?n:Xde,s=tue(i),r=nue(s,e);let o=!1;if(Object.keys(s).forEach(l=>{if(r.includes(l)){t.hasAttribute(`breakpoint${l}`)||(t.setAttribute(`breakpoint${l}`,""),o=!0);return}t.hasAttribute(`breakpoint${l}`)&&(t.removeAttribute(`breakpoint${l}`),o=!0)}),o){const l=new CustomEvent(Kl.BREAKPOINTS_CHANGE,{detail:r});t.dispatchEvent(l)}t.breakpointsComputed||(t.breakpointsComputed=!0,t.dispatchEvent(new CustomEvent(Kl.BREAKPOINTS_COMPUTED,{bubbles:!0,composed:!0})))}a(f$,"setBreakpoints");function tue(t){const e=t.split(/\s+/);return Object.fromEntries(e.map(n=>n.split(":")))}a(tue,"createBreakpointMap");function nue(t,e){return Object.keys(t).filter(n=>e>=parseInt(t[n]))}
2312a(nue,"getBreakpoints");const ox=class ox extends me.HTMLElement{constructor(){if(super(),os(this,uw),os(this,fw),os(this,hw),os(this,ih),os(this,Oy),os(this,zd),os(this,G0,0),os(this,Nc,null),os(this,nh,null),os(this,id,void 0),this.breakpointsComputed=!1,os(this,um,new MutationObserver(Is(this,uw,c$).bind(this))),os(this,ef,!1),os(this,fm,n=>{cs(this,ef)||(setTimeout(()=>{eue(n),el(this,ef,!1)},0),el(this,ef,!0))}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const n=Qs(this.attributes),i=this.constructor.getTemplateHTML(n);this.shadowRoot.setHTMLUnsafe?this.shadowRoot.setHTMLUnsafe(i):this.shadowRoot.innerHTML=i}const e=this.querySelector(":scope > slot[slot=media]");e&&e.addEventListener("slotchange",()=>{if(!e.assignedElements({flatten:!0}).length){cs(this,Nc)&&this.mediaUnsetCallback(cs(this,Nc));return}this.handleMediaUpdated(this.media)})}static get observedAttributes(){return[tt.AUTOHIDE,tt.GESTURES_DISABLED].concat(Jde).filter(e=>![J.MEDIA_RENDITION_LIST,J.MEDIA_AUDIO_TRACK_LIST,J.MEDIA_CHAPTERS_CUES,J.MEDIA_WIDTH,J.MEDIA_HEIGHT,J.MEDIA_ERROR,J.MEDIA_ERROR_MESSAGE].includes(e))}attributeChangedCallback(e,n,i){e.toLowerCase()==tt.AUTOHIDE&&(this.autohide=i)}get media(){let e=this.querySelector(":scope > [slot=media]");return e?.nodeName=="SLOT"&&(e=e.assignedElements({flatten:!0})[0]),e}async handleMediaUpdated(e){e&&(el(this,Nc,e),e.localName.includes("-")&&await me.customElements.whenDefined(e.localName),this.mediaSetCallback(e))}connectedCallback(){var e;cs(this,um).observe(this,{childList:!0,subtree:!0}),n$(this,cs(this,fm));const n=this.getAttribute(tt.AUDIO)!=null,i=Xe(n?"audio player":"video player");this.setAttribute("role","region"),this.setAttribute("aria-label",i),this.handleMediaUpdated(this.media),this.setAttribute(tt.USER_INACTIVE,""),f$(this,this.getBoundingClientRect().width),this.addEventListener("pointerdown",this),this.addEventListener("pointermove",this),this.addEventListener("pointerup",this),this.addEventListener("mouseleave",this),this.addEventListener("keyup",this),(e=me.window)==null||e.addEventListener("mouseup",this)}disconnectedCallback(){var e;cs(this,um).disconnect(),i$(this,cs(this,fm)),this.media&&this.mediaUnsetCallback(this.media),(e=me.window)==null||e.removeEventListener("mouseup",this)}mediaSetCallback(e){}mediaUnsetCallback(e){el(this,Nc,null)}handleEvent(e){switch(e.type){case"pointerdown":el(this,G0,e.timeStamp);break;case"pointermove":Is(this,fw,d$).call(this,e);break;case"pointerup":Is(this,hw,u$).call(this,e);break;case"mouseleave":Is(this,ih,Dy).call(this);break;case"mouseup":this.removeAttribute(tt.KEYBOARD_CONTROL);break;case"keyup":Is(this,zd,sh).call(this),this.setAttribute(tt.KEYBOARD_CONTROL,"");break}}set autohide(e){const n=Number(e);el(this,id,isNaN(n)?0:n)}get autohide(){return(cs(this,id)===void 0?2:cs(this,id)).toString()}get breakpoints(){return Mn(this,tt.BREAKPOINTS)}set breakpoints(e){Cn(this,tt.BREAKPOINTS,e)}get audio(){return Dt(this,tt.AUDIO)}set audio(e){Ot(this,tt.AUDIO,e)}get gesturesDisabled(){return Dt(this,tt.GESTURES_DISABLED)}set gesturesDisabled(e){Ot(this,tt.GESTURES_DISABLED,e)}get keyboardControl(){return Dt(this,tt.KEYBOARD_CONTROL)}set keyboardControl(e){Ot(this,tt.KEYBOARD_CONTROL,e)}get noAutohide(){return Dt(this,tt.NO_AUTOHIDE)}set noAutohide(e){Ot(this,tt.NO_AUTOHIDE,e)}get autohideOverControls(){return Dt(this,tt.AUTOHIDE_OVER_CONTROLS)}set autohideOverControls(e){Ot(this,tt.AUTOHIDE_OVER_CONTROLS,e)}get userInteractive(){return Dt(this,tt.USER_INACTIVE)}set userInteractive(e){Ot(this,tt.USER_INACTIVE,e)}};a(ox,"MediaContainer");let Kd=ox;G0=new WeakMap;Nc=new WeakMap;nh=new WeakMap;id=new WeakMap;um=new WeakMap;uw=new WeakSet;c$=a(function(t){const e=this.media;for(const n of t){if(n.type!=="childList")continue;const i=n.removedNodes;for(const s of i){if(s.slot!="media"||n.target!=this)continue;let r=n.previousSibling&&n.previousSibling.previousElementSibling;if(!r||!e)this.mediaUnsetCallback(s);else{let o=r.slot!=="media";for(;(r=r.previousSibling)!==null;)r.slot=="media"&&(o=!1);o&&this.mediaUnsetCallback(s)}}if(e)for(const s of n.addedNodes)s===e&&this.handleMediaUpdated(e)}},"handleMutation_fn");ef=new WeakMap;fm=new WeakMap;fw=new WeakSet;d$=a(function(t){if(t.pointerType!=="mouse"&&t.timeStamp-cs(this,G0)<250)return;Is(this,Oy,pA).call(this),clearTimeout(cs(this,nh));const e=this.hasAttribute(tt.AUTOHIDE_OVER_CONTROLS);([this,this.media].includes(t.target)||e)&&Is(this,zd,sh).call(this)},"handlePointerMove_fn$2");hw=new WeakSet;u$=a(function(t){if(t.pointerType==="touch"){const e=!this.hasAttribute(tt.USER_INACTIVE);[this,this.media].includes(t.target)&&e?Is(this,ih,Dy).call(this):Is(this,zd,sh).call(this)}else t.composedPath().some(e=>["media-play-button","media-fullscreen-button"].includes(e?.localName))&&Is(this,zd,sh).call(this)},"handlePointerUp_fn$1");ih=new WeakSet;Dy=a(function(){if(cs(this,id)<0||this.hasAttribute(tt.USER_INACTIVE))return;this.setAttribute(tt.USER_INACTIVE,"");const t=new me.CustomEvent(Kl.USER_INACTIVE_CHANGE,{composed:!0,bubbles:!0,detail:!0});this.dispatchEvent(t)},"setInactive_fn");Oy=new WeakSet;pA=a(function(){if(!this.hasAttribute(tt.USER_INACTIVE))return;this.removeAttribute(tt.USER_INACTIVE);const t=new me.CustomEvent(Kl.USER_INACTIVE_CHANGE,{composed:!0,bubbles:!0,detail:!1});this.dispatchEvent(t)},"setActive_fn");zd=new WeakSet;sh=a(function(){Is(this,Oy,pA).call(this),clearTimeout(cs(this,nh));const t=parseInt(this.autohide);t<0||el(this,nh,setTimeout(()=>{Is(this,ih,Dy).call(this)},t*1e3))},"scheduleInactive_fn");Kd.shadowRootOptions={mode:"open"};Kd.getTemplateHTML=Qde;me.customElements.get("media-container")||me.customElements.define("media-container",Kd);var h$=a((t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},"__accessCheck$i"),ei=a((t,e,n)=>(h$(t,e,"read from private field"),n?n.call(t):e.get(t)),"__privateGet$i"),Fu=a((t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},"__privateAdd$i"),Rg=a((t,e,n,i)=>(h$(t,e,"write to private field"),i?i.call(t,n):e.set(t,n),n),"__privateSet$h"),Fc,Uc,V0,wl,to,Wo;const ax=class ax{constructor(e,n,{defaultValue:i}={defaultValue:void 0}){Fu(this,to),Fu(this,Fc,void 0),Fu(this,Uc,void 0),Fu(this,V0,void 0),Fu(this,wl,new Set),Rg(this,Fc,e),Rg(this,Uc,n),Rg(this,V0,new Set(i))}[Symbol.iterator](){return ei(this,to,Wo).values()}get length(){return ei(this,to,Wo).size}get value(){var e;return(e=[...ei(this,to,Wo)].join(" "))!=null?e:""}set value(e){var n;e!==this.value&&(Rg(this,wl,new Set),this.add(...(n=e?.split(" "))!=null?n:[]))}toString(){return this.value}item(e){return[...ei(this,to,Wo)][e]}values(){return ei(this,to,Wo).values()}
2312forEach(e,n){ei(this,to,Wo).forEach(e,n)}add(...e){var n,i;e.forEach(s=>ei(this,wl).add(s)),!(this.value===""&&!((n=ei(this,Fc))!=null&&n.hasAttribute(`${ei(this,Uc)}`)))&&((i=ei(this,Fc))==null||i.setAttribute(`${ei(this,Uc)}`,`${this.value}`))}remove(...e){var n;e.forEach(i=>ei(this,wl).delete(i)),(n=ei(this,Fc))==null||n.setAttribute(`${ei(this,Uc)}`,`${this.value}`)}contains(e){return ei(this,to,Wo).has(e)}toggle(e,n){return typeof n<"u"?n?(this.add(e),!0):(this.remove(e),!1):this.contains(e)?(this.remove(e),!1):(this.add(e),!0)}replace(e,n){return this.remove(e),this.add(n),e===n}};a(ax,"AttributeTokenList");let W0=ax;Fc=new WeakMap;Uc=new WeakMap;V0=new WeakMap;wl=new WeakMap;to=new WeakSet;Wo=a(function(){return ei(this,wl).size?ei(this,wl):ei(this,V0)},"tokens_get");const iue=a((t="")=>t.split(/\s+/),"splitTextTracksStr"),p$=a((t="")=>{const[e,n,i]=t.split(":"),s=i?decodeURIComponent(i):void 0;return{kind:e==="cc"?Dr.CAPTIONS:Dr.SUBTITLES,language:n,label:s}},"parseTextTrackStr"),g$=a((t="",e={})=>iue(t).map(n=>{const i=p$(n);return{...e,...i}}),"parseTextTracksStr"),m$=a(t=>t?Array.isArray(t)?t.map(e=>typeof e=="string"?p$(e):e):typeof t=="string"?g$(t):[t]:[],"parseTracks"),sue=a(({kind:t,label:e,language:n}={kind:"subtitles"})=>e?`${t==="captions"?"cc":"sb"}:${n}:${encodeURIComponent(e)}`:n,"formatTextTrackObj"),pw=a((t=[])=>Array.prototype.map.call(t,sue).join(" "),"stringifyTextTrackList"),rue=a((t,e)=>n=>n[t]===e,"isMatchingPropOf"),v$=a(t=>{const e=Object.entries(t).map(([n,i])=>rue(n,i));return n=>e.every(i=>i(n))},"textTrackObjAsPred"),Sf=a((t,e=[],n=[])=>{const i=m$(n).map(v$),s=a(r=>i.some(o=>o(r)),"isTrackToUpdate");Array.from(e).filter(s).forEach(r=>{r.mode=t})},"updateTracksModeTo"),Ny=a((t,e=()=>!0)=>{if(!t?.textTracks)return[];const n=typeof e=="function"?e:v$(e);return Array.from(t.textTracks).filter(n)},"getTextTracksList"),oue=a(t=>{var e;return!!((e=t.mediaSubtitlesShowing)!=null&&e.length)||t.hasAttribute(J.MEDIA_SUBTITLES_SHOWING)},"areSubsOn"),aue=a(t=>{var e;const{media:n,fullscreenElement:i}=t;try{const s=i&&"requestFullscreen"in i?"requestFullscreen":i&&"webkitRequestFullScreen"in i?"webkitRequestFullScreen":void 0;if(s){const r=(e=i[s])==null?void 0:e.call(i);if(r instanceof Promise)return r.catch(()=>{})}else n?.webkitEnterFullscreen?n.webkitEnterFullscreen():n?.requestFullscreen&&n.requestFullscreen()}catch(s){console.error(s)}},"enterFullscreen"),XM="exitFullscreen"in Li?"exitFullscreen":"webkitExitFullscreen"in Li?"webkitExitFullscreen":"webkitCancelFullScreen"in Li?"webkitCancelFullScreen":void 0,lue=a(t=>{var e;const{documentElement:n}=t;if(XM){const i=(e=n?.[XM])==null?void 0:e.call(n);if(i instanceof Promise)return i.catch(()=>{})}},"exitFullscreen"),tf="fullscreenElement"in Li?"fullscreenElement":"webkitFullscreenElement"in Li?"webkitFullscreenElement":void 0,cue=a(t=>{const{documentElement:e,media:n}=t,i=e?.[tf];return!i&&"webkitDisplayingFullscreen"in n&&"webkitPresentationMode"in n&&n.webkitDisplayingFullscreen&&n.webkitPresentationMode===kde.FULLSCREEN?n:i},"getFullscreenElement"),due=a(t=>{var e;const{media:n,documentElement:i,fullscreenElement:s=n}=t;if(!n||!i)return!1;const r=cue(t);if(!r)return!1;if(r===s||r===n)return!0;if(r.localName.includes("-")){let o=r.shadowRoot;if(!(tf in o))return vu(r,s);for(;o?.[tf];){if(o[tf]===s)return!0;o=(e=o[tf])==null?void 0:e.shadowRoot}}return!1},"isFullscreen"),uue="fullscreenEnabled"in Li?"fullscreenEnabled":"webkitFullscreenEnabled"in Li?"webkitFullscreenEnabled":void 0,fue=a(t=>{const{documentElement:e,media:n}=t;return!!e?.[uue]||n&&"webkitSupportsFullscreen"in n},"isFullscreenEnabled");let kg;const gA=a(()=>{var t,e;return kg||(kg=(e=(t=Li)==null?void 0:t.createElement)==null?void 0:e.call(t,"video"),kg)},"getTestMediaEl"),hue=a(async(t=gA())=>{if(!t)return!1;const e=t.volume;t.volume=e/2+.1;const n=new AbortController,i=await Promise.race([pue(t,n.signal),gue(t,e)]);return n.abort(),i},"hasVolumeSupportAsync"),pue=a((t,e)=>new Promise(n=>{t.addEventListener("volumechange",()=>n(!0),{signal:e})}),"dispatchedVolumeChange"),gue=a(async(t,e)=>{for(let n=0;n<10;n++){if(t.volume===e)return!1;await YB(10)}return t.volume!==e},"volumeChanged"),mue=/.*Version\/.*Safari\/.*/.test(me.navigator.userAgent),y$=a((t=gA())=>me.matchMedia("(display-mode: standalone)").matches&&mue?!1:typeof t?.requestPictureInPicture=="function","hasPipSupport"),b$=a((t=gA())=>fue({documentElement:Li,media:t}),"hasFullscreenSupport"),vue=b$(),yue=y$(),bue=!!me.WebKitPlaybackTargetAvailabilityEvent,Eue=!!me.chrome,z0=a(t=>Ny(t.media,e=>[Dr.SUBTITLES,Dr.CAPTIONS].includes(e.kind)).sort((e,n)=>e.kind>=n.kind?1:-1),"getSubtitleTracks"),E$=a(t=>Ny(t.media,e=>e.mode===md.SHOWING&&[Dr.SUBTITLES,Dr.CAPTIONS].includes(e.kind)),"getShowingSubtitleTracks"),_$=a((t,e)=>{const n=z0(t),i=E$(t),s=!!i.length;if(n.length){if(e===!1||s&&e!==!0)Sf(md.DISABLED,n,i);else if(e===!0||!s&&e!==!1){let r=n[0];const{options:o}=t;if(!o?.noSubtitlesLangPref){const u=globalThis.localStorage.getItem("media-chrome-pref-subtitles-lang"),f=u?[u,...globalThis.navigator.languages]:globalThis.navigator.languages,h=n.filter(p=>f.some(g=>p.language.toLowerCase().startsWith(g.split("-")[0]))).sort((p,g)=>{const v=f.findIndex(b=>p.language.toLowerCase().startsWith(b.split("-")[0])),y=f.findIndex(b=>g.language.toLowerCase().startsWith(b.split("-")[0]));return v-y});h[0]&&(r=h[0])}const{language:l,label:d,kind:c}=r;
2312Sf(md.DISABLED,n,i),Sf(md.SHOWING,n,[{language:l,label:d,kind:c}])}}},"toggleSubtitleTracks"),mA=a((t,e)=>t===e?!0:t==null||e==null||typeof t!=typeof e?!1:typeof t=="number"&&Number.isNaN(t)&&Number.isNaN(e)?!0:typeof t!="object"?!1:Array.isArray(t)?_ue(t,e):Object.entries(t).every(([n,i])=>n in e&&mA(i,e[n])),"areValuesEq"),_ue=a((t,e)=>{const n=Array.isArray(t),i=Array.isArray(e);return n!==i?!1:n||i?t.length!==e.length?!1:t.every((s,r)=>mA(s,e[r])):!0},"areArraysEq"),wue=Object.values(io);let K0;const Sue=hue().then(t=>(K0=t,K0)),Tue=a(async(...t)=>{await Promise.all(t.filter(e=>e).map(async e=>{if(!("localName"in e&&e instanceof me.HTMLElement))return;const n=e.localName;if(!n.includes("-"))return;const i=me.customElements.get(n);i&&e instanceof i||(await me.customElements.whenDefined(n),me.customElements.upgrade(e))}))},"prepareStateOwners"),Aue=new me.DOMParser,xue=a(t=>t&&(Aue.parseFromString(t,"text/html").body.textContent||t),"parseHtmlToText"),nf={mediaError:{get(t,e){const{media:n}=t;if(e?.type!=="playing")return n?.error},mediaEvents:["emptied","error","playing"]},mediaErrorCode:{get(t,e){var n;const{media:i}=t;if(e?.type!=="playing")return(n=i?.error)==null?void 0:n.code},mediaEvents:["emptied","error","playing"]},mediaErrorMessage:{get(t,e){var n,i;const{media:s}=t;if(e?.type!=="playing")return(i=(n=s?.error)==null?void 0:n.message)!=null?i:""},mediaEvents:["emptied","error","playing"]},mediaWidth:{get(t){var e;const{media:n}=t;return(e=n?.videoWidth)!=null?e:0},mediaEvents:["resize"]},mediaHeight:{get(t){var e;const{media:n}=t;return(e=n?.videoHeight)!=null?e:0},mediaEvents:["resize"]},mediaPaused:{get(t){var e;const{media:n}=t;return(e=n?.paused)!=null?e:!0},set(t,e){var n;const{media:i}=e;i&&(t?i.pause():(n=i.play())==null||n.catch(()=>{}))},mediaEvents:["play","playing","pause","emptied"]},mediaHasPlayed:{get(t,e){const{media:n}=t;return n?e?e.type==="playing":!n.paused:!1},mediaEvents:["playing","emptied"]},mediaEnded:{get(t){var e;const{media:n}=t;return(e=n?.ended)!=null?e:!1},mediaEvents:["seeked","ended","emptied"]},mediaPlaybackRate:{get(t){var e;const{media:n}=t;return(e=n?.playbackRate)!=null?e:1},set(t,e){const{media:n}=e;n&&Number.isFinite(+t)&&(n.playbackRate=+t)},mediaEvents:["ratechange","loadstart"]},mediaMuted:{get(t){var e;const{media:n}=t;return(e=n?.muted)!=null?e:!1},set(t,e){const{media:n}=e;if(n){try{me.localStorage.setItem("media-chrome-pref-muted",t?"true":"false")}catch(i){console.debug("Error setting muted pref",i)}n.muted=t}},mediaEvents:["volumechange"],stateOwnersUpdateHandlers:[(t,e)=>{const{options:{noMutedPref:n}}=e,{media:i}=e;if(!(!i||i.muted||n))try{const s=me.localStorage.getItem("media-chrome-pref-muted")==="true";nf.mediaMuted.set(s,e),t(s)}catch(s){console.debug("Error getting muted pref",s)}}]},mediaVolume:{get(t){var e;const{media:n}=t;return(e=n?.volume)!=null?e:1},set(t,e){const{media:n}=e;if(n){try{t==null?me.localStorage.removeItem("media-chrome-pref-volume"):me.localStorage.setItem("media-chrome-pref-volume",t.toString())}catch(i){console.debug("Error setting volume pref",i)}Number.isFinite(+t)&&(n.volume=+t)}},mediaEvents:["volumechange"],stateOwnersUpdateHandlers:[(t,e)=>{const{options:{noVolumePref:n}}=e;if(!n)try{const{media:i}=e;if(!i)return;const s=me.localStorage.getItem("media-chrome-pref-volume");if(s==null)return;nf.mediaVolume.set(+s,e),t(+s)}catch(i){console.debug("Error getting volume pref",i)}}]},mediaVolumeLevel:{get(t){const{media:e}=t;return typeof e?.volume>"u"?"high":e.muted||e.volume===0?"off":e.volume<.5?"low":e.volume<.75?"medium":"high"},mediaEvents:["volumechange"]},mediaCurrentTime:{get(t){var e;const{media:n}=t;return(e=n?.currentTime)!=null?e:0},set(t,e){const{media:n}=e;!n||!uA(t)||(n.currentTime=t)},mediaEvents:["timeupdate","loadedmetadata"]},mediaDuration:{get(t){const{media:e,options:{defaultDuration:n}={}}=t;return n&&(!e||!e.duration||Number.isNaN(e.duration)||!Number.isFinite(e.duration))?n:Number.isFinite(e?.duration)?e.duration:Number.NaN},mediaEvents:["durationchange","loadedmetadata","emptied"]},mediaLoading:{get(t){const{media:e}=t;return e?.readyState<3},mediaEvents:["waiting","playing","emptied"]},mediaSeekable:{get(t){var e;const{media:n}=t;if(!((e=n?.seekable)!=null&&e.length))return;const i=n.seekable.start(0),s=n.seekable.end(n.seekable.length-1);if(!(!i&&!s))return[Number(i.toFixed(3)),Number(s.toFixed(3))]},mediaEvents:["loadedmetadata","emptied","progress","seekablechange"]},mediaBuffered:{get(t){var e;const{media:n}=t,i=(e=n?.buffered)!=null?e:[];return Array.from(i).map((s,r)=>[Number(i.start(r).toFixed(3)),Number(i.end(r).toFixed(3))])},mediaEvents:["progress","emptied"]},mediaStreamType:{get(t){const{media:e,options:{defaultStreamType:n}={}}=t,i=[io.LIVE,io.ON_DEMAND].includes(n)?n:void 0;if(!e)return i;const{streamType:s}=e;if(wue.includes(s))return s===io.UNKNOWN?i:s;const r=e.duration;return r===1/0?io.LIVE:Number.isFinite(r)?io.ON_DEMAND:i}
2312,mediaEvents:["emptied","durationchange","loadedmetadata","streamtypechange"]},mediaTargetLiveWindow:{get(t){const{media:e}=t;if(!e)return Number.NaN;const{targetLiveWindow:n}=e,i=nf.mediaStreamType.get(t);return(n==null||Number.isNaN(n))&&i===io.LIVE?0:n},mediaEvents:["emptied","durationchange","loadedmetadata","streamtypechange","targetlivewindowchange"]},mediaTimeIsLive:{get(t){const{media:e,options:{liveEdgeOffset:n=10}={}}=t;if(!e)return!1;if(typeof e.liveEdgeStart=="number")return Number.isNaN(e.liveEdgeStart)?!1:e.currentTime>=e.liveEdgeStart;if(!(nf.mediaStreamType.get(t)===io.LIVE))return!1;const s=e.seekable;if(!s)return!0;if(!s.length)return!1;const r=s.end(s.length-1)-n;return e.currentTime>=r},mediaEvents:["playing","timeupdate","progress","waiting","emptied"]},mediaSubtitlesList:{get(t){return z0(t).map(({kind:e,label:n,language:i})=>({kind:e,label:n,language:i}))},mediaEvents:["loadstart"],textTracksEvents:["addtrack","removetrack"]},mediaSubtitlesShowing:{get(t){return E$(t).map(({kind:e,label:n,language:i})=>({kind:e,label:n,language:i}))},mediaEvents:["loadstart"],textTracksEvents:["addtrack","removetrack","change"],stateOwnersUpdateHandlers:[(t,e)=>{var n,i;const{media:s,options:r}=e;if(!s)return;const o=a(l=>{var d;!r.defaultSubtitles||l&&![Dr.CAPTIONS,Dr.SUBTITLES].includes((d=l?.track)==null?void 0:d.kind)||_$(e,!0)},"updateDefaultSubtitlesCallback");return s.addEventListener("loadstart",o),(n=s.textTracks)==null||n.addEventListener("addtrack",o),(i=s.textTracks)==null||i.addEventListener("removetrack",o),()=>{var l,d;s.removeEventListener("loadstart",o),(l=s.textTracks)==null||l.removeEventListener("addtrack",o),(d=s.textTracks)==null||d.removeEventListener("removetrack",o)}}]},mediaChaptersCues:{get(t){var e;const{media:n}=t;if(!n)return[];const[i]=Ny(n,{kind:Dr.CHAPTERS});return Array.from((e=i?.cues)!=null?e:[]).map(({text:s,startTime:r,endTime:o})=>({text:xue(s),startTime:r,endTime:o}))},mediaEvents:["loadstart","loadedmetadata"],textTracksEvents:["addtrack","removetrack","change"],stateOwnersUpdateHandlers:[(t,e)=>{var n;const{media:i}=e;if(!i)return;const s=i.querySelector('track[kind="chapters"][default][src]'),r=(n=i.shadowRoot)==null?void 0:n.querySelector(':is(video,audio) > track[kind="chapters"][default][src]');return s?.addEventListener("load",t),r?.addEventListener("load",t),()=>{s?.removeEventListener("load",t),r?.removeEventListener("load",t)}}]},mediaIsPip:{get(t){var e,n;const{media:i,documentElement:s}=t;if(!i||!s||!s.pictureInPictureElement)return!1;if(s.pictureInPictureElement===i)return!0;if(s.pictureInPictureElement instanceof HTMLMediaElement)return(e=i.localName)!=null&&e.includes("-")?vu(i,s.pictureInPictureElement):!1;if(s.pictureInPictureElement.localName.includes("-")){let r=s.pictureInPictureElement.shadowRoot;for(;r?.pictureInPictureElement;){if(r.pictureInPictureElement===i)return!0;r=(n=r.pictureInPictureElement)==null?void 0:n.shadowRoot}}return!1},set(t,e){const{media:n}=e;if(n)if(t){if(!Li.pictureInPictureEnabled){console.warn("MediaChrome: Picture-in-picture is not enabled");return}if(!n.requestPictureInPicture){console.warn("MediaChrome: The current media does not support picture-in-picture");return}const i=a(()=>{console.warn("MediaChrome: The media is not ready for picture-in-picture. It must have a readyState > 0.")},"warnNotReady");n.requestPictureInPicture().catch(s=>{if(s.code===11){if(!n.src){console.warn("MediaChrome: The media is not ready for picture-in-picture. It must have a src set.");return}if(n.readyState===0&&n.preload==="none"){const r=a(()=>{n.removeEventListener("loadedmetadata",o),n.preload="none"},"cleanup"),o=a(()=>{n.requestPictureInPicture().catch(i),r()},"tryPip");n.addEventListener("loadedmetadata",o),n.preload="metadata",setTimeout(()=>{n.readyState===0&&i(),r()},1e3)}else throw s}else throw s})}else Li.pictureInPictureElement&&Li.exitPictureInPicture()},mediaEvents:["enterpictureinpicture","leavepictureinpicture"]},mediaRenditionList:{get(t){var e;const{media:n}=t;return[...(e=n?.videoRenditions)!=null?e:[]].map(i=>({...i}))},mediaEvents:["emptied","loadstart"],videoRenditionsEvents:["addrendition","removerendition"]},mediaRenditionSelected:{get(t){var e,n,i;const{media:s}=t;return(i=(n=s?.videoRenditions)==null?void 0:n[(e=s.videoRenditions)==null?void 0:e.selectedIndex])==null?void 0:i.id},set(t,e){const{media:n}=e;if(!n?.videoRenditions){console.warn("MediaController: Rendition selection not supported by this media.");return}const i=t,s=Array.prototype.findIndex.call(n.videoRenditions,r=>r.id==i);n.videoRenditions.selectedIndex!=s&&(n.videoRenditions.selectedIndex=s)},mediaEvents:["emptied"],videoRenditionsEvents:["addrendition","removerendition","change"]},mediaAudioTrackList:{get(t){var e;const{media:n}=t;return[...(e=n?.audioTracks)!=null?e:[]]},mediaEvents:["emptied","loadstart"],audioTracksEvents:["addtrack","removetrack"]},mediaAudioTrackEnabled:{get(t){var e,n;const{media:i}=t;return(n=[...(e=i?.audioTracks)!=null?e:[]].find(s=>s.enabled))==null?void 0:n.id},set(t,e){const{media:n}=e;if(!n?.audioTracks){console.warn("MediaChrome: Audio track selection not supported by this media.");return}const i=t;for(const s of n.audioTracks)s.enabled=i==s.id},mediaEvents:["emptied"],audioTracksEvents:["addtrack","removetrack","change"]},mediaIsFullscreen:{get(t){return due(t)},set(t,e){t?aue(e):lue(e)},rootEvents:["fullscreenchange","webkitfullscreenchange"],mediaEvents:["webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"]},mediaIsCasting:{get(t){var e;const{media:n}=t;return!n?.remote||((e=n.remote)==null?void 0:e.state)==="disconnected"?!1:!!n.remote.state},set(t,e){var n,i;const{media:s}=e;if(s&&!(t&&((n=s.remote)==null?void 0:n.state)!=="disconnected")&&!(!t&&((i=s.remote)==null?void 0:i.state)!=="connected")){if(typeof s.remote.prompt!="function"){console.warn("MediaChrome: Casting is not supported in this environment");return}s.remote.prompt().catch(()=>{})}},remoteEvents:["connect","connecting","disconnect"]},mediaIsAirplaying:{get(){return!1},set(t,e){const{media:n}=e;if(n){if(!(n.webkitShowPlaybackTargetPicker&&me.WebKitPlaybackTargetAvailabilityEvent)){console.error("MediaChrome: received a request to select AirPlay but AirPlay is not supported in this environment");return}n.webkitShowPlaybackTargetPicker()}},mediaEvents:["webkitcurrentplaybacktargetiswirelesschanged"]},mediaFullscreenUnavailable:{get(t){const{media:e}=t;if(!vue||!b$(e))return ws.UNSUPPORTED}},mediaPipUnavailable:{get(t){const{media:e}=t;if(!yue||!y$(e))return ws.UNSUPPORTED}},mediaVolumeUnavailable:{get(t){const{media:e}=t;if(K0===!1||e?.volume==null)return ws.UNSUPPORTED},stateOwnersUpdateHandlers:[t=>{K0==null&&Sue.then(e=>t(e?void 0:ws.UNSUPPORTED))}]},mediaCastUnavailable:{get(t,{availability:e="not-available"}={}){var n;const{media:i}=t;if(!Eue||!((n=i?.remote)!=null&&n.state))return ws.UNSUPPORTED;if(!(e==null||e==="available"))return ws.UNAVAILABLE},stateOwnersUpdateHandlers:[(t,e)=>{var n;const{media:i}=e;return i?(i.disableRemotePlayback||i.hasAttribute("disableremoteplayback")||(n=i?.remote)==null||n.watchAvailability(r=>{t({availability:r?"available":"not-available"})}).catch(r=>{r.name==="NotSupportedError"?t({availability:null}):t({availability:"not-available"})}),()=>{var r;(r=i?.remote)==null||r.cancelWatchAvailability().catch(()=>{})}):void 0}]},mediaAirplayUnavailable:{get(t,e){if(!bue)return ws.UNSUPPORTED;if(e?.availability==="not-available")return ws.UNAVAILABLE},mediaEvents:["webkitplaybacktargetavailabilitychanged"],stateOwnersUpdateHandlers:[(t,e)=>{var n;const{media:i}=e;return i?(i.disableRemotePlayback||i.hasAttribute("disableremoteplayback")||(n=i?.remote)==null||n.watchAvailability(r=>{t({availability:r?"available":"not-available"})}).catch(r=>{r.name==="NotSupportedError"?t({availability:null}):t({availability:"not-available"})}),()=>{var r;(r=i?.remote)==null||r.cancelWatchAvailability().catch(()=>{})}):void 0}]},mediaRenditionUnavailable:{get(t){var e;const{media:n}=t;if(!n?.videoRenditions)return ws.UNSUPPORTED;if(!((e=n.videoRenditions)!=null&&e.length))return ws.UNAVAILABLE},mediaEvents:["emptied","loadstart"],videoRenditionsEvents:["addrendition","removerendition"]},mediaAudioTrackUnavailable:{get(t){var e,n;const{media:i}=t;if(!i?.audioTracks)return ws.UNSUPPORTED;if(((n=(e=i.audioTracks)==null?void 0:e.length)!=null?n:0)<=1)return ws.UNAVAILABLE},mediaEvents:["emptied","loadstart"],audioTracksEvents:["addtrack","removetrack"]},mediaLang:{get(t){const{options:{mediaLang:e}={}}=t;return e??"en"}}},Iue={[Ve.MEDIA_PREVIEW_REQUEST](t,e,{detail:n}){var i,s,r;const{media:o}=e,l=n??void 0;let d,c;if(o&&l!=null){const[p]=Ny(o,{kind:Dr.METADATA,label:"thumbnails"}
2312),g=Array.prototype.find.call((i=p?.cues)!=null?i:[],(v,y,b)=>y===0?v.endTime>l:y===b.length-1?v.startTime<=l:v.startTime<=l&&v.endTime>l);if(g){const v=/'^(?:[a-z]+:)?\/\//i.test(g.text)||(s=o?.querySelector('track[label="thumbnails"]'))==null?void 0:s.src,y=new URL(g.text,v);c=new URLSearchParams(y.hash).get("#xywh").split(",").map(E=>+E),d=y.href}}const u=t.mediaDuration.get(e);let h=(r=t.mediaChaptersCues.get(e).find((p,g,v)=>g===v.length-1&&u===p.endTime?p.startTime<=l&&p.endTime>=l:p.startTime<=l&&p.endTime>l))==null?void 0:r.text;return n!=null&&h==null&&(h=""),{mediaPreviewTime:l,mediaPreviewImage:d,mediaPreviewCoords:c,mediaPreviewChapter:h}},[Ve.MEDIA_PAUSE_REQUEST](t,e){t["mediaPaused"].set(!0,e)},[Ve.MEDIA_PLAY_REQUEST](t,e){var n,i,s,r;const o="mediaPaused",d=t.mediaStreamType.get(e)===io.LIVE,c=!((n=e.options)!=null&&n.noAutoSeekToLive),u=t.mediaTargetLiveWindow.get(e)>0;if(d&&c&&!u){const f=(i=t.mediaSeekable.get(e))==null?void 0:i[1];if(f){const h=(r=(s=e.options)==null?void 0:s.seekToLiveOffset)!=null?r:0,p=f-h;t.mediaCurrentTime.set(p,e)}}t[o].set(!1,e)},[Ve.MEDIA_PLAYBACK_RATE_REQUEST](t,e,{detail:n}){const i="mediaPlaybackRate",s=n;t[i].set(s,e)},[Ve.MEDIA_MUTE_REQUEST](t,e){t["mediaMuted"].set(!0,e)},[Ve.MEDIA_UNMUTE_REQUEST](t,e){const n="mediaMuted";t.mediaVolume.get(e)||t.mediaVolume.set(.25,e),t[n].set(!1,e)},[Ve.MEDIA_VOLUME_REQUEST](t,e,{detail:n}){const i="mediaVolume",s=n;s&&t.mediaMuted.get(e)&&t.mediaMuted.set(!1,e),t[i].set(s,e)},[Ve.MEDIA_SEEK_REQUEST](t,e,{detail:n}){const i="mediaCurrentTime",s=n;t[i].set(s,e)},[Ve.MEDIA_SEEK_TO_LIVE_REQUEST](t,e){var n,i,s;const r="mediaCurrentTime",o=(n=t.mediaSeekable.get(e))==null?void 0:n[1];if(Number.isNaN(Number(o)))return;const l=(s=(i=e.options)==null?void 0:i.seekToLiveOffset)!=null?s:0,d=o-l;t[r].set(d,e)},[Ve.MEDIA_SHOW_SUBTITLES_REQUEST](t,e,{detail:n}){var i;const{options:s}=e,r=z0(e),o=m$(n),l=(i=o[0])==null?void 0:i.language;l&&!s.noSubtitlesLangPref&&me.localStorage.setItem("media-chrome-pref-subtitles-lang",l),Sf(md.SHOWING,r,o)},[Ve.MEDIA_DISABLE_SUBTITLES_REQUEST](t,e,{detail:n}){const i=z0(e),s=n??[];Sf(md.DISABLED,i,s)},[Ve.MEDIA_TOGGLE_SUBTITLES_REQUEST](t,e,{detail:n}){_$(e,n)},[Ve.MEDIA_RENDITION_REQUEST](t,e,{detail:n}){const i="mediaRenditionSelected",s=n;t[i].set(s,e)},[Ve.MEDIA_AUDIO_TRACK_REQUEST](t,e,{detail:n}){const i="mediaAudioTrackEnabled",s=n;t[i].set(s,e)},[Ve.MEDIA_ENTER_PIP_REQUEST](t,e){const n="mediaIsPip";t.mediaIsFullscreen.get(e)&&t.mediaIsFullscreen.set(!1,e),t[n].set(!0,e)},[Ve.MEDIA_EXIT_PIP_REQUEST](t,e){t["mediaIsPip"].set(!1,e)},[Ve.MEDIA_ENTER_FULLSCREEN_REQUEST](t,e){const n="mediaIsFullscreen";t.mediaIsPip.get(e)&&t.mediaIsPip.set(!1,e),t[n].set(!0,e)},[Ve.MEDIA_EXIT_FULLSCREEN_REQUEST](t,e){t["mediaIsFullscreen"].set(!1,e)},[Ve.MEDIA_ENTER_CAST_REQUEST](t,e){const n="mediaIsCasting";t.mediaIsFullscreen.get(e)&&t.mediaIsFullscreen.set(!1,e),t[n].set(!0,e)},[Ve.MEDIA_EXIT_CAST_REQUEST](t,e){t["mediaIsCasting"].set(!1,e)},[Ve.MEDIA_AIRPLAY_REQUEST](t,e){t["mediaIsAirplaying"].set(!0,e)}},Lue=a(({media:t,fullscreenElement:e,documentElement:n,stateMediator:i=nf,requestMap:s=Iue,options:r={},monitorStateOwnersOnlyWithSubscriptions:o=!0})=>{const l=[],d={options:{...r}};let c=Object.freeze({mediaPreviewTime:void 0,mediaPreviewImage:void 0,mediaPreviewCoords:void 0,mediaPreviewChapter:void 0});const u=a(v=>{v!=null&&(mA(v,c)||(c=Object.freeze({...c,...v}),l.forEach(y=>y(c))))},"updateState"),f=a(()=>{const v=Object.entries(i).reduce((y,[b,{get:E}])=>(y[b]=E(d),y),{});u(v)},"updateStateFromFacade"),h={};let p;const g=a(async(v,y)=>{var b,E,T,I,M,H,N,$,F,D,L,m,S,_,A,x;const C=!!p;if(p={...d,...p??{},...v},C)return;await Tue(...Object.values(v));const U=l.length>0&&y===0&&o,R=d.media!==p.media,w=((b=d.media)==null?void 0:b.textTracks)!==((E=p.media)==null?void 0:E.textTracks),P=((T=d.media)==null?void 0:T.videoRenditions)!==((I=p.media)==null?void 0:I.videoRenditions),V=((M=d.media)==null?void 0:M.audioTracks)!==((H=p.media)==null?void 0:H.audioTracks),Z=((N=d.media)==null?void 0:N.remote)!==(($=p.media)==null?void 0:$.remote),ee=d.documentElement!==p.documentElement,ne=!!d.media&&(R||U),se=!!((F=d.media)!=null&&F.textTracks)&&(w||U),ge=!!((D=d.media)!=null&&D.videoRenditions)&&(P||U),ie=!!((L=d.media)!=null&&L.audioTracks)&&(V||U),j=!!((m=d.media)!=null&&m.remote)&&(Z||U),Y=!!d.documentElement&&(ee||U),le=ne||se||ge||ie||j||Y,pe=l.length===0&&y===1&&o,Te=!!p.media&&(R||pe),Le=!!((S=p.media)!=null&&S.textTracks)&&(w||pe),De=!!((_=p.media)!=null&&_.videoRenditions)&&(P||pe),_e=!!((A=p.media)!=null&&A.audioTracks)&&(V||pe),we=!!((x=p.media)!=null&&x.remote)&&(Z||pe),ye=!!p.documentElement&&(ee||pe),te=Te||Le||De||_e||we||ye;
2312if(!(le||te)){Object.entries(p).forEach(([ae,ve])=>{d[ae]=ve}),f(),p=void 0;return}Object.entries(i).forEach(([ae,{get:ve,mediaEvents:lt=[],textTracksEvents:Ye=[],videoRenditionsEvents:nt=[],audioTracksEvents:Qt=[],remoteEvents:W=[],rootEvents:k=[],stateOwnersUpdateHandlers:O=[]}])=>{h[ae]||(h[ae]={});const K=a(oe=>{const ke=ve(d,oe);u({[ae]:ke})},"handler");let Q;Q=h[ae].mediaEvents,lt.forEach(oe=>{Q&&ne&&(d.media.removeEventListener(oe,Q),h[ae].mediaEvents=void 0),Te&&(p.media.addEventListener(oe,K),h[ae].mediaEvents=K)}),Q=h[ae].textTracksEvents,Ye.forEach(oe=>{var ke,ft;Q&&se&&((ke=d.media.textTracks)==null||ke.removeEventListener(oe,Q),h[ae].textTracksEvents=void 0),Le&&((ft=p.media.textTracks)==null||ft.addEventListener(oe,K),h[ae].textTracksEvents=K)}),Q=h[ae].videoRenditionsEvents,nt.forEach(oe=>{var ke,ft;Q&&ge&&((ke=d.media.videoRenditions)==null||ke.removeEventListener(oe,Q),h[ae].videoRenditionsEvents=void 0),De&&((ft=p.media.videoRenditions)==null||ft.addEventListener(oe,K),h[ae].videoRenditionsEvents=K)}),Q=h[ae].audioTracksEvents,Qt.forEach(oe=>{var ke,ft;Q&&ie&&((ke=d.media.audioTracks)==null||ke.removeEventListener(oe,Q),h[ae].audioTracksEvents=void 0),_e&&((ft=p.media.audioTracks)==null||ft.addEventListener(oe,K),h[ae].audioTracksEvents=K)}),Q=h[ae].remoteEvents,W.forEach(oe=>{var ke,ft;Q&&j&&((ke=d.media.remote)==null||ke.removeEventListener(oe,Q),h[ae].remoteEvents=void 0),we&&((ft=p.media.remote)==null||ft.addEventListener(oe,K),h[ae].remoteEvents=K)}),Q=h[ae].rootEvents,k.forEach(oe=>{Q&&Y&&(d.documentElement.removeEventListener(oe,Q),h[ae].rootEvents=void 0),ye&&(p.documentElement.addEventListener(oe,K),h[ae].rootEvents=K)});const ce=h[ae].stateOwnersUpdateHandlers;O.forEach(oe=>{ce&&le&&ce(),te&&(h[ae].stateOwnersUpdateHandlers=oe(K,p))})}),Object.entries(p).forEach(([ae,ve])=>{d[ae]=ve}),f(),p=void 0},"updateStateOwners");return g({media:t,fullscreenElement:e,documentElement:n,options:r}),{dispatch(v){const{type:y,detail:b}=v;if(s[y]&&c.mediaErrorCode==null){u(s[y](i,d,v));return}y==="mediaelementchangerequest"?g({media:b}):y==="fullscreenelementchangerequest"?g({fullscreenElement:b}):y==="documentelementchangerequest"?g({documentElement:b}):y==="optionschangerequest"&&(Object.entries(b??{}).forEach(([E,T])=>{d.options[E]=T}),f())},getState(){return c},subscribe(v){return g({},l.length+1),l.push(v),v(c),()=>{const y=l.indexOf(v);y>=0&&(g({},l.length-1),l.splice(y,1))}}}},"createMediaStore");var vA=a((t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},"__accessCheck$h"),yt=a((t,e,n)=>(vA(t,e,"read from private field"),n?n.call(t):e.get(t)),"__privateGet$h"),Yr=a((t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},"__privateAdd$h"),$o=a((t,e,n,i)=>(vA(t,e,"write to private field"),i?i.call(t,n):e.set(t,n),n),"__privateSet$g"),ra=a((t,e,n)=>(vA(t,e,"access private method"),n),"__privateMethod$5"),Sl,sf,tn,rf,fr,hm,pm,gw,qd,rh,gm,mw;const w$=["ArrowLeft","ArrowRight","Enter"," ","f","m","k","c"],eC=10,Oe={DEFAULT_SUBTITLES:"defaultsubtitles",DEFAULT_STREAM_TYPE:"defaultstreamtype",DEFAULT_DURATION:"defaultduration",FULLSCREEN_ELEMENT:"fullscreenelement",HOTKEYS:"hotkeys",KEYS_USED:"keysused",LIVE_EDGE_OFFSET:"liveedgeoffset",SEEK_TO_LIVE_OFFSET:"seektoliveoffset",NO_AUTO_SEEK_TO_LIVE:"noautoseektolive",NO_HOTKEYS:"nohotkeys",NO_VOLUME_PREF:"novolumepref",NO_SUBTITLES_LANG_PREF:"nosubtitleslangpref",NO_DEFAULT_STORE:"nodefaultstore",KEYBOARD_FORWARD_SEEK_OFFSET:"keyboardforwardseekoffset",KEYBOARD_BACKWARD_SEEK_OFFSET:"keyboardbackwardseekoffset",LANG:"lang"},lx=class lx extends Kd{constructor(){super(),Yr(this,pm),Yr(this,qd),Yr(this,gm),this.mediaStateReceivers=[],this.associatedElementSubscriptions=new Map,Yr(this,Sl,new W0(this,Oe.HOTKEYS)),Yr(this,sf,void 0),Yr(this,tn,void 0),Yr(this,rf,void 0),Yr(this,fr,void 0),Yr(this,hm,n=>{var i;(i=yt(this,tn))==null||i.dispatch(n)}),this.associateElement(this);let e={};$o(this,rf,n=>{Object.entries(n).forEach(([i,s])=>{if(i in e&&e[i]===s)return;this.propagateMediaState(i,s);const r=i.toLowerCase(),o=new me.CustomEvent(Rde[r],{composed:!0,detail:s});this.dispatchEvent(o)}),e=n}),this.enableHotkeys()}static get observedAttributes(){return super.observedAttributes.concat(Oe.NO_HOTKEYS,Oe.HOTKEYS,Oe.DEFAULT_STREAM_TYPE,Oe.DEFAULT_SUBTITLES,Oe.DEFAULT_DURATION,Oe.LANG)}get mediaStore(){return yt(this,tn)}set mediaStore(e){var n,i;if(yt(this,tn)&&((n=yt(this,fr))==null||n.call(this),$o(this,fr,void 0)),$o(this,tn,e),!yt(this,tn)&&!this.hasAttribute(Oe.NO_DEFAULT_STORE)){ra(this,pm,gw).call(this);return}$o(this,fr,(i=yt(this,tn))==null?void 0:i.subscribe(yt(this,rf)))}get fullscreenElement(){var e;return(e=yt(this,sf))!=null?e:this}set fullscreenElement(e){var n;this.hasAttribute(Oe.FULLSCREEN_ELEMENT)&&this.removeAttribute(Oe.FULLSCREEN_ELEMENT),$o(this,sf,e),(n=yt(this,tn))==null||n.dispatch({type:"fullscreenelementchangerequest",detail:this.fullscreenElement})}get defaultSubtitles(){return Dt(this,Oe.DEFAULT_SUBTITLES)}set defaultSubtitles(e){Ot(this,Oe.DEFAULT_SUBTITLES,e)}get defaultStreamType(){return Mn(this,Oe.DEFAULT_STREAM_TYPE)}set defaultStreamType(e){Cn(this,Oe.DEFAULT_STREAM_TYPE,e)}get defaultDuration(){return Rn(this,Oe.DEFAULT_DURATION)}set defaultDuration(e){si(this,Oe.DEFAULT_DURATION,e)}get noHotkeys(){return Dt(this,Oe.NO_HOTKEYS)}set noHotkeys(e){Ot(this,Oe.NO_HOTKEYS,e)}get keysUsed(){return Mn(this,Oe.KEYS_USED)}set keysUsed(e){Cn(this,Oe.KEYS_USED,e)}get liveEdgeOffset(){return Rn(this,Oe.LIVE_EDGE_OFFSET)}set liveEdgeOffset(e){si(this,Oe.LIVE_EDGE_OFFSET,e)}get noAutoSeekToLive(){return Dt(this,Oe.NO_AUTO_SEEK_TO_LIVE)}set noAutoSeekToLive(e){Ot(this,Oe.NO_AUTO_SEEK_TO_LIVE,e)}get noVolumePref(){return Dt(this,Oe.NO_VOLUME_PREF)}set noVolumePref(e){Ot(this,Oe.NO_VOLUME_PREF,e)}get noSubtitlesLangPref(){return Dt(this,Oe.NO_SUBTITLES_LANG_PREF)}set noSubtitlesLangPref(e){Ot(this,Oe.NO_SUBTITLES_LANG_PREF,e)}get noDefaultStore(){return Dt(this,Oe.NO_DEFAULT_STORE)}set noDefaultStore(e){Ot(this,Oe.NO_DEFAULT_STORE,e)}attributeChangedCallback(e,n,i){var s,r,o,l,d,c,u,f,h;if(super.attributeChangedCallback(e,n,i),e===Oe.NO_HOTKEYS)i!==n&&i===""?(this.hasAttribute(Oe.HOTKEYS)&&console.warn("Media Chrome: Both `hotkeys` and `nohotkeys` have been set. All hotkeys will be disabled."),this.disableHotkeys()):i!==n&&i===null&&this.enableHotkeys();else if(e===Oe.HOTKEYS)yt(this,Sl).value=i;else if(e===Oe.DEFAULT_SUBTITLES&&i!==n)(s=yt(this,tn))==null||s.dispatch({type:"optionschangerequest",detail:{defaultSubtitles:this.hasAttribute(Oe.DEFAULT_SUBTITLES)}});else if(e===Oe.DEFAULT_STREAM_TYPE)(o=yt(this,tn))==null||o.dispatch({type:"optionschangerequest",detail:{defaultStreamType:(r=this.getAttribute(Oe.DEFAULT_STREAM_TYPE))!=null?r:void 0}});else if(e===Oe.LIVE_EDGE_OFFSET)(l=yt(this,tn))==null||l.dispatch({type:"optionschangerequest",detail:{liveEdgeOffset:this.hasAttribute(Oe.LIVE_EDGE_OFFSET)?+this.getAttribute(Oe.LIVE_EDGE_OFFSET):void 0,seekToLiveOffset:this.hasAttribute(Oe.SEEK_TO_LIVE_OFFSET)?void 0:+this.getAttribute(Oe.LIVE_EDGE_OFFSET)}});else if(e===Oe.SEEK_TO_LIVE_OFFSET)(d=yt(this,tn))==null||d.dispatch({type:"optionschangerequest",detail:{seekToLiveOffset:this.hasAttribute(Oe.SEEK_TO_LIVE_OFFSET)?+this.getAttribute(Oe.SEEK_TO_LIVE_OFFSET):void 0}});else if(e===Oe.NO_AUTO_SEEK_TO_LIVE)(c=yt(this,tn))==null||c.dispatch({type:"optionschangerequest",detail:{noAutoSeekToLive:this.hasAttribute(Oe.NO_AUTO_SEEK_TO_LIVE)}});else if(e===Oe.FULLSCREEN_ELEMENT){const p=i?(u=this.getRootNode())==null?void 0:u.getElementById(i):void 0;$o(this,sf,p),(f=yt(this,tn))==null||f.dispatch({type:"fullscreenelementchangerequest",detail:this.fullscreenElement})}else e===Oe.LANG&&i!==n&&(Ude(i),(h=yt(this,tn))==null||h.dispatch({type:"optionschangerequest",detail:{mediaLang:i}}
2312))}connectedCallback(){var e,n;!yt(this,tn)&&!this.hasAttribute(Oe.NO_DEFAULT_STORE)&&ra(this,pm,gw).call(this),(e=yt(this,tn))==null||e.dispatch({type:"documentelementchangerequest",detail:Li}),super.connectedCallback(),yt(this,tn)&&!yt(this,fr)&&$o(this,fr,(n=yt(this,tn))==null?void 0:n.subscribe(yt(this,rf))),this.enableHotkeys()}disconnectedCallback(){var e,n,i,s;(e=super.disconnectedCallback)==null||e.call(this),yt(this,tn)&&((n=yt(this,tn))==null||n.dispatch({type:"documentelementchangerequest",detail:void 0}),(i=yt(this,tn))==null||i.dispatch({type:Ve.MEDIA_TOGGLE_SUBTITLES_REQUEST,detail:!1})),yt(this,fr)&&((s=yt(this,fr))==null||s.call(this),$o(this,fr,void 0))}mediaSetCallback(e){var n;super.mediaSetCallback(e),(n=yt(this,tn))==null||n.dispatch({type:"mediaelementchangerequest",detail:e}),e.hasAttribute("tabindex")||(e.tabIndex=-1)}mediaUnsetCallback(e){var n;super.mediaUnsetCallback(e),(n=yt(this,tn))==null||n.dispatch({type:"mediaelementchangerequest",detail:void 0})}propagateMediaState(e,n){iC(this.mediaStateReceivers,e,n)}associateElement(e){if(!e)return;const{associatedElementSubscriptions:n}=this;if(n.has(e))return;const i=this.registerMediaStateReceiver.bind(this),s=this.unregisterMediaStateReceiver.bind(this),r=Due(e,i,s);Object.values(Ve).forEach(o=>{e.addEventListener(o,yt(this,hm))}),n.set(e,r)}unassociateElement(e){if(!e)return;const{associatedElementSubscriptions:n}=this;if(!n.has(e))return;n.get(e)(),n.delete(e),Object.values(Ve).forEach(s=>{e.removeEventListener(s,yt(this,hm))})}registerMediaStateReceiver(e){if(!e)return;const n=this.mediaStateReceivers;n.indexOf(e)>-1||(n.push(e),yt(this,tn)&&Object.entries(yt(this,tn).getState()).forEach(([s,r])=>{iC([e],s,r)}))}unregisterMediaStateReceiver(e){const n=this.mediaStateReceivers,i=n.indexOf(e);i<0||n.splice(i,1)}enableHotkeys(){this.addEventListener("keydown",ra(this,gm,mw))}disableHotkeys(){this.removeEventListener("keydown",ra(this,gm,mw)),this.removeEventListener("keyup",ra(this,qd,rh))}get hotkeys(){return Mn(this,Oe.HOTKEYS)}set hotkeys(e){Cn(this,Oe.HOTKEYS,e)}keyboardShortcutHandler(e){var n,i,s,r,o;const l=e.target;if(((s=(i=(n=l.getAttribute(Oe.KEYS_USED))==null?void 0:n.split(" "))!=null?i:l?.keysUsed)!=null?s:[]).map(h=>h==="Space"?" ":h).filter(Boolean).includes(e.key))return;let c,u,f;if(!yt(this,Sl).contains(`no${e.key.toLowerCase()}`)&&!(e.key===" "&&yt(this,Sl).contains("nospace")))switch(e.key){case" ":case"k":c=yt(this,tn).getState().mediaPaused?Ve.MEDIA_PLAY_REQUEST:Ve.MEDIA_PAUSE_REQUEST,this.dispatchEvent(new me.CustomEvent(c,{composed:!0,bubbles:!0}));break;case"m":c=this.mediaStore.getState().mediaVolumeLevel==="off"?Ve.MEDIA_UNMUTE_REQUEST:Ve.MEDIA_MUTE_REQUEST,this.dispatchEvent(new me.CustomEvent(c,{composed:!0,bubbles:!0}));break;case"f":c=this.mediaStore.getState().mediaIsFullscreen?Ve.MEDIA_EXIT_FULLSCREEN_REQUEST:Ve.MEDIA_ENTER_FULLSCREEN_REQUEST,this.dispatchEvent(new me.CustomEvent(c,{composed:!0,bubbles:!0}));break;case"c":this.dispatchEvent(new me.CustomEvent(Ve.MEDIA_TOGGLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0}));break;case"ArrowLeft":{const h=this.hasAttribute(Oe.KEYBOARD_BACKWARD_SEEK_OFFSET)?+this.getAttribute(Oe.KEYBOARD_BACKWARD_SEEK_OFFSET):eC;u=Math.max(((r=this.mediaStore.getState().mediaCurrentTime)!=null?r:0)-h,0),f=new me.CustomEvent(Ve.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:u}),this.dispatchEvent(f);break}case"ArrowRight":{const h=this.hasAttribute(Oe.KEYBOARD_FORWARD_SEEK_OFFSET)?+this.getAttribute(Oe.KEYBOARD_FORWARD_SEEK_OFFSET):eC;u=Math.max(((o=this.mediaStore.getState().mediaCurrentTime)!=null?o:0)+h,0),f=new me.CustomEvent(Ve.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:u}),this.dispatchEvent(f);break}}}};a(lx,"MediaController");let vw=lx;Sl=new WeakMap;sf=new WeakMap;tn=new WeakMap;rf=new WeakMap;fr=new WeakMap;hm=new WeakMap;pm=new WeakSet;gw=a(function(){var t;this.mediaStore=Lue({media:this.media,fullscreenElement:this.fullscreenElement,options:{defaultSubtitles:this.hasAttribute(Oe.DEFAULT_SUBTITLES),defaultDuration:this.hasAttribute(Oe.DEFAULT_DURATION)?+this.getAttribute(Oe.DEFAULT_DURATION):void 0,defaultStreamType:(t=this.getAttribute(Oe.DEFAULT_STREAM_TYPE))!=null?t:void 0,liveEdgeOffset:this.hasAttribute(Oe.LIVE_EDGE_OFFSET)?+this.getAttribute(Oe.LIVE_EDGE_OFFSET):void 0,seekToLiveOffset:this.hasAttribute(Oe.SEEK_TO_LIVE_OFFSET)?+this.getAttribute(Oe.SEEK_TO_LIVE_OFFSET):this.hasAttribute(Oe.LIVE_EDGE_OFFSET)?+this.getAttribute(Oe.LIVE_EDGE_OFFSET):void 0,noAutoSeekToLive:this.hasAttribute(Oe.NO_AUTO_SEEK_TO_LIVE),noVolumePref:this.hasAttribute(Oe.NO_VOLUME_PREF),noSubtitlesLangPref:this.hasAttribute(Oe.NO_SUBTITLES_LANG_PREF)}})},"setupDefaultStore_fn");qd=new WeakSet;rh=a(function(t){const{key:e}=t;if(!w$.includes(e)){this.removeEventListener("keyup",ra(this,qd,rh));return}this.keyboardShortcutHandler(t)},"keyUpHandler_fn");gm=new WeakSet;mw=a(function(t){const{metaKey:e,altKey:n,key:i}=t;if(e||n||!w$.includes(i)){this.removeEventListener("keyup",ra(this,qd,rh));return}[" ","ArrowLeft","ArrowRight"].includes(i)&&!(yt(this,Sl).contains(`no${i.toLowerCase()}
2312`)||i===" "&&yt(this,Sl).contains("nospace"))&&t.preventDefault(),this.addEventListener("keyup",ra(this,qd,rh),{once:!0})},"keyDownHandler_fn");const Rue=Object.values(J),kue=Object.values(KB),S$=a(t=>{var e,n,i,s;let{observedAttributes:r}=t.constructor;!r&&((e=t.nodeName)!=null&&e.includes("-"))&&(me.customElements.upgrade(t),{observedAttributes:r}=t.constructor);const o=(s=(i=(n=t?.getAttribute)==null?void 0:n.call(t,Wt.MEDIA_CHROME_ATTRIBUTES))==null?void 0:i.split)==null?void 0:s.call(i,/\s+/);return Array.isArray(r||o)?(r||o).filter(l=>Rue.includes(l)):[]},"getMediaUIAttributesFrom"),Mue=a(t=>{var e,n;return(e=t.nodeName)!=null&&e.includes("-")&&me.customElements.get((n=t.nodeName)==null?void 0:n.toLowerCase())&&!(t instanceof me.customElements.get(t.nodeName.toLowerCase()))&&me.customElements.upgrade(t),kue.some(i=>i in t)},"hasMediaUIProps"),yw=a(t=>Mue(t)||!!S$(t).length,"isMediaStateReceiver"),tC=a(t=>{var e;return(e=t?.join)==null?void 0:e.call(t,":")},"serializeTuple"),nC={[J.MEDIA_SUBTITLES_LIST]:pw,[J.MEDIA_SUBTITLES_SHOWING]:pw,[J.MEDIA_SEEKABLE]:tC,[J.MEDIA_BUFFERED]:t=>t?.map(tC).join(" "),[J.MEDIA_PREVIEW_COORDS]:t=>t?.join(" "),[J.MEDIA_RENDITION_LIST]:Mde,[J.MEDIA_AUDIO_TRACK_LIST]:Pde},Cue=a(async(t,e,n)=>{var i,s;if(t.isConnected||await YB(0),typeof n=="boolean"||n==null)return Ot(t,e,n);if(typeof n=="number")return si(t,e,n);if(typeof n=="string")return Cn(t,e,n);if(Array.isArray(n)&&!n.length)return t.removeAttribute(e);const r=(s=(i=nC[e])==null?void 0:i.call(nC,n))!=null?s:n;return t.setAttribute(e,r)},"setAttr"),Pue=a(t=>{var e;return!!((e=t.closest)!=null&&e.call(t,'*[slot="media"]'))},"isMediaSlotElementDescendant"),tl=a((t,e)=>{if(Pue(t))return;const n=a((s,r)=>{var o,l;yw(s)&&r(s);const{children:d=[]}=s??{},c=(l=(o=s?.shadowRoot)==null?void 0:o.children)!=null?l:[];[...d,...c].forEach(f=>tl(f,r))},"traverseForMediaStateReceiversSync"),i=t?.nodeName.toLowerCase();if(i.includes("-")&&!yw(t)){me.customElements.whenDefined(i).then(()=>{n(t,e)});return}n(t,e)},"traverseForMediaStateReceivers"),iC=a((t,e,n)=>{t.forEach(i=>{if(e in i){i[e]=n;return}const s=S$(i),r=e.toLowerCase();s.includes(r)&&Cue(i,r,n)})},"propagateMediaState"),Due=a((t,e,n)=>{tl(t,e);const i=a(u=>{var f;const h=(f=u?.composedPath()[0])!=null?f:u.target;e(h)},"registerMediaStateReceiverHandler"),s=a(u=>{var f;const h=(f=u?.composedPath()[0])!=null?f:u.target;n(h)},"unregisterMediaStateReceiverHandler");t.addEventListener(Ve.REGISTER_MEDIA_STATE_RECEIVER,i),t.addEventListener(Ve.UNREGISTER_MEDIA_STATE_RECEIVER,s);const r=a(u=>{u.forEach(f=>{const{addedNodes:h=[],removedNodes:p=[],type:g,target:v,attributeName:y}=f;g==="childList"?(Array.prototype.forEach.call(h,b=>tl(b,e)),Array.prototype.forEach.call(p,b=>tl(b,n))):g==="attributes"&&y===Wt.MEDIA_CHROME_ATTRIBUTES&&(yw(v)?e(v):n(v))})},"mutationCallback");let o=[];const l=a(u=>{const f=u.target;f.name!=="media"&&(o.forEach(h=>tl(h,n)),o=[...f.assignedElements({flatten:!0})],o.forEach(h=>tl(h,e)))},"slotChangeHandler");t.addEventListener("slotchange",l);const d=new MutationObserver(r);return d.observe(t,{childList:!0,attributes:!0,subtree:!0}),a(()=>{tl(t,n),t.removeEventListener("slotchange",l),d.disconnect(),t.removeEventListener(Ve.REGISTER_MEDIA_STATE_RECEIVER,i),t.removeEventListener(Ve.UNREGISTER_MEDIA_STATE_RECEIVER,s)},"unsubscribe")},"monitorForMediaStateReceivers");me.customElements.get("media-controller")||me.customElements.define("media-controller",vw);const Ac={PLACEMENT:"placement",BOUNDS:"bounds"};function Oue(t){return`
2313    <style>
2314      :host {
2315        --_tooltip-background-color: var(--media-tooltip-background-color, var(--media-secondary-color, rgba(20, 20, 30, .7)));
2316        --_tooltip-background: var(--media-tooltip-background, var(--_tooltip-background-color));
2317        --_tooltip-arrow-half-width: calc(var(--media-tooltip-arrow-width, 12px) / 2);
2318        --_tooltip-arrow-height: var(--media-tooltip-arrow-height, 5px);
2319        --_tooltip-arrow-background: var(--media-tooltip-arrow-color, var(--_tooltip-background-color));
2320        position: relative;
2321        pointer-events: none;
2322        display: var(--media-tooltip-display, inline-flex);
2323        justify-content: center;
2324        align-items: center;
2325        box-sizing: border-box;
2326        z-index: var(--media-tooltip-z-index, 1);
2327        background: var(--_tooltip-background);
2328        color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238)));
2329        font: var(--media-font,
2330          var(--media-font-weight, 400)
2331          var(--media-font-size, 13px) /
2332          var(--media-text-content-height, var(--media-control-height, 18px))
2333          var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif));
2334        padding: var(--media-tooltip-padding, .35em .7em);
2335        border: var(--media-tooltip-border, none);
2336        border-radius: var(--media-tooltip-border-radius, 5px);
2337        filter: var(--media-tooltip-filter, drop-shadow(0 0 4px rgba(0, 0, 0, .2)));
2338        white-space: var(--media-tooltip-white-space, nowrap);
2339      }
2340
2341      :host([hidden]) {
2342        display: none;
2343      }
2344
2345      img, svg {
2346        display: inline-block;
2347      }
2348
2349      #arrow {
2350        position: absolute;
2351        width: 0px;
2352        height: 0px;
2353        border-style: solid;
2354        display: var(--media-tooltip-arrow-display, block);
2355      }
2356
2357      :host(:not([placement])),
2358      :host([placement="top"]) {
2359        position: absolute;
2360        bottom: calc(100% + var(--media-tooltip-distance, 12px));
2361        left: 50%;
2362        transform: translate(calc(-50% - var(--media-tooltip-offset-x, 0px)), 0
2362);
2363      }
2364      :host(:not([placement])) #arrow,
2365      :host([placement="top"]) #arrow {
2366        top: 100%;
2367        left: 50%;
2368        border-width: var(--_tooltip-arrow-height) var(--_tooltip-arrow-half-width) 0 var(--_tooltip-arrow-half-width);
2369        border-color: var(--_tooltip-arrow-background) transparent transparent transparent;
2370        transform: translate(calc(-50% + var(--media-tooltip-offset-x, 0px)), 0);
2371      }
2372
2373      :host([placement="right"]) {
2374        position: absolute;
2375        left: calc(100% + var(--media-tooltip-distance, 12px));
2376        top: 50%;
2377        transform: translate(0, -50%);
2378      }
2379      :host([placement="right"]) #arrow {
2380        top: 50%;
2381        right: 100%;
2382        border-width: var(--_tooltip-arrow-half-width) var(--_tooltip-arrow-height) var(--_tooltip-arrow-half-width) 0;
2383        border-color: transparent var(--_tooltip-arrow-background) transparent transparent;
2384        transform: translate(0, -50%);
2385      }
2386
2387      :host([placement="bottom"]) {
2388        position: absolute;
2389        top: calc(100% + var(--media-tooltip-distance, 12px));
2390        left: 50%;
2391        transform: translate(calc(-50% - var(--media-tooltip-offset-x, 0px)), 0);
2392      }
2393      :host([placement="bottom"]) #arrow {
2394        bottom: 100%;
2395        left: 50%;
2396        border-width: 0 var(--_tooltip-arrow-half-width) var(--_tooltip-arrow-height) var(--_tooltip-arrow-half-width);
2397        border-color: transparent transparent var(--_tooltip-arrow-background) transparent;
2398        transform: translate(calc(-50% + var(--media-tooltip-offset-x, 0px)), 0);
2399      }
2400
2401      :host([placement="left"]) {
2402        position: absolute;
2403        right: calc(100% + var(--media-tooltip-distance, 12px));
2404        top: 50%;
2405        transform: translate(0, -50%);
2406      }
2407      :host([placement="left"]) #arrow {
2408        top: 50%;
2409        left: 100%;
2410        border-width: var(--_tooltip-arrow-half-width) 0 var(--_tooltip-arrow-half-width) var(--_tooltip-arrow-height);
2411        border-color: transparent transparent transparent var(--_tooltip-arrow-background);
2412        transform: translate(0, -50%);
2413      }
2414      
2415      :host([placement="none"]) #arrow {
2416        display: none;
2417      }
2418    </style>
2419    <slot></slot>
2420    <div id="arrow"></div>
2421  `}a(Oue,"getTemplateHTML$9");const cx=class cx extends me.HTMLElement{constructor(){if(super(),this.updateXOffset=()=>{var e;if(!a$(this,{checkOpacity:!1,checkVisibilityCSS:!1}))return;const n=this.placement;if(n==="left"||n==="right"){this.style.removeProperty("--media-tooltip-offset-x");return}const i=getComputedStyle(this),s=(e=zp(this,"#"+this.bounds))!=null?e:Hde(this);if(!s)return;const{x:r,width:o}=s.getBoundingClientRect(),{x:l,width:d}=this.getBoundingClientRect(),c=l+d,u=r+o,f=i.getPropertyValue("--media-tooltip-offset-x"),h=f?parseFloat(f.replace("px","")):0,p=i.getPropertyValue("--media-tooltip-container-margin"),g=p?parseFloat(p.replace("px","")):0,v=l-r+h-g,y=c-u+h+g;if(v<0){this.style.setProperty("--media-tooltip-offset-x",`${v}px`);return}if(y>0){this.style.setProperty("--media-tooltip-offset-x",`${y}px`);return}this.style.removeProperty("--media-tooltip-offset-x")},!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Qs(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}if(this.arrowEl=this.shadowRoot.querySelector("#arrow"),Object.prototype.hasOwnProperty.call(this,"placement")){const e=this.placement;delete this.placement,this.placement=e}}static get observedAttributes(){return[Ac.PLACEMENT,Ac.BOUNDS]}get placement(){return Mn(this,Ac.PLACEMENT)}set placement(e){Cn(this,Ac.PLACEMENT,e)}get bounds(){return Mn(this,Ac.BOUNDS)}set bounds(e){Cn(this,Ac.BOUNDS,e)}};a(cx,"MediaTooltip");let jd=cx;jd.shadowRootOptions={mode:"open"};jd.getTemplateHTML=Oue;me.customElements.get("media-tooltip")||me.customElements.define("media-tooltip",jd);var sC=jd,yA=a((t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},"__accessCheck$g"),Un=a((t,e,n)=>(yA(t,e,"read from private field"),n?n.call(t):e.get(t)),"__privateGet$g"),xc=a((t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},"__privateAdd$g"),Mg=a((t,e,n,i)=>(yA(t,e,"write to private field"),i?i.call(t,n):e.set(t,n),n),"__privateSet$f"),Nue=a((t,e,n)=>(yA(t,e,"access private method"),n),"__privateMethod$4"),hr,sd,oa,Bc,mm,bw,T$;const Ho={TOOLTIP_PLACEMENT:"tooltipplacement",DISABLED:"disabled",NO_TOOLTIP:"notooltip"};function Fue(t,e={}){return`
2422    <style>
2423      :host {
2424        position: relative;
2425        font: var(--media-font,
2426          var(--media-font-weight, bold)
2427          var(--media-font-size, 14px) /
2428          var(--media-text-content-height, var(--media-control-height, 24px))
2429          var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif));
2430        color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238)));
2431        background: var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7)));
2432        padding: var(--media-button-padding, var(--media-control-padding, 10px));
2433        justify-content: var(--media-button-justify-content, center);
2434        display: inline-flex;
2435        align-items: center;
2436        vertical-align: middle;
2437        box-sizing: border-box;
2438        transition: background .15s linear;
2439        pointer-events: auto;
2440        cursor: var(--media-cursor, pointer);
2441        -webkit-tap-highlight-color: transparent;
2442      }
2443
2444      
2445      :host(:focus-visible) {
2446        box-shadow: inset 0 0 0 2px rgb(27 127 204 / .9);
2447        outline: 0;
2448      }
2449      
2450      :host(:where(:focus)) {
2451        box-shadow: none;
2452        outline: 0;
2453      }
2454
2455      :host(:hover) {
2456        background: var(--media-control-hover-background, rgba(50 50 70 / .7));
2457      }
2458
2459      svg, img, ::slotted(svg), ::slotted(img) {
2460        width: var(--media-button-icon-width);
2461        height: var(--media-button-icon-height, var(--media-control-height, 24px));
2462        transform: var(--media-button-icon-transform);
2463        transition: var(--media-button-icon-transition);
2464        fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238)));
2465        vertical-align: middle;
2466        max-width: 100%;
2467        max-height: 100%;
2468        min-width: 100%;
2469      }
2470
2471      media-tooltip {
2472        
2473        max-width: 0;
2474        overflow-x: clip;
2475        opacity: 0;
2476        transition: opacity .3s, max-width 0s 9s;
2477      }
2478
2479      :host(:hover) media-tooltip,
2480      :host(:focus-visible) media-tooltip {
2481        max-width: 100vw;
2482        opacity: 1;
2483        transition: opacity .3s;
2484      }
2485
2486      :host([notooltip]) slot[name="tooltip"] {
2487        display: none;
2488      }
2489    </style>
2490
2491    ${this.getSlotTemplateHTML(t,e)}
2492
2493    <slot name="tooltip">
2494      <media-tooltip part="tooltip" aria-hidden="true">
2495        <template shadowrootmode="${sC.shadowRootOptions.mode}">
2496          ${sC.getTemplateHTML({})}
2497        </template>
2498        <slot name="tooltip-content">
2499          ${this.getTooltipContentHTML(t)}
2500        </slot>
2501      </media-tooltip>
2502    </slot>
2503  `}a(Fue,"getTemplateHTML$8");function Uue(t,e){return`
2504    <slot></slot>
2505  `}a(Uue,"getSlotTemplateHTML$g");function Bue(){return""}a(Bue,"getTooltipContentHTML$a");const dx=class dx extends me.HTMLElement{constructor(){if(super(),xc(this,bw),xc(this,hr,void 0),this.preventClick=!1,this.tooltipEl=null,xc(this,sd,e=>{this.preventClick||this.handleClick(e),setTimeout(Un(this,oa),0)}),xc(this,oa,()=>{var e,n;(n=(e=this.tooltipEl)==null?void 0:e.updateXOffset)==null||n.call(e)}),xc(this,Bc,e=>{const{key:n}=e;if(!this.keysUsed.includes(n)){this.removeEventListener("keyup",Un(this,Bc));return}this.preventClick||this.handleClick(e)}),xc(this,mm,e=>{const{metaKey:n,altKey:i,key:s}=e;if(n||i||!this.keysUsed.includes(s)){this.removeEventListener("keyup",Un(this,Bc));return}this.addEventListener("keyup",Un(this,Bc),{once:!0})}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Qs(this.attributes),n=this.constructor.getTemplateHTML(e);this.shadowRoot.setHTMLUnsafe?this.shadowRoot.setHTMLUnsafe(n):this.shadowRoot.innerHTML=n}this.tooltipEl=this.shadowRoot.querySelector("media-tooltip")}static get observedAttributes(){return["disabled",Ho.TOOLTIP_PLACEMENT,Wt.MEDIA_CONTROLLER,J.MEDIA_LANG]}enable(){this.addEventListener("click",Un(this,sd)),this.addEventListener("keydown",Un(this,mm)),this.tabIndex=0}disable(){this.removeEventListener("click",Un(this,sd)),this.removeEventListener("keydown",Un(this,mm)),this.removeEventListener("keyup",Un(this,Bc)),this.tabIndex=-1}attributeChangedCallback(e,n,i){var s,r,o,l,d;e===Wt.MEDIA_CONTROLLER?(n&&((r=(s=Un(this,hr))==null?void 0:s.unassociateElement)==null||r.call(s,this),Mg(this,hr,null)),i&&this.isConnected&&(Mg(this,hr,(o=this.getRootNode())==null?void 0:o.getElementById(i)),(d=(l=Un(this,hr))==null?void 0:l.associateElement)==null||d.call(l,this))):e==="disabled"&&i!==n?i==null?this.enable():this.disable():e===Ho.TOOLTIP_PLACEMENT&&this.tooltipEl&&i!==n?this.tooltipEl.placement=i:e===J.MEDIA_LANG&&(this.shadowRoot.querySelector('slot[name="tooltip-content"]').innerHTML=this.constructor.getTooltipContentHTML()),Un(this,oa).call(this)}connectedCallback(){var e,n,i;const{style:s}=Bn(this.shadowRoot,":host");s.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`),this.hasAttribute("disabled")?this.disable():this.enable(),this.setAttribute("role","button");const r=this.getAttribute(Wt.MEDIA_CONTROLLER);r&&(Mg(this,hr,(e=this.getRootNode())==null?void 0:e.getElementById(r)),(i=(n=Un(this,hr))==null?void 0:n.associateElement)==null||i.call(n,this)),me.customElements.whenDefined("media-tooltip").then(()=>Nue(this,bw,T$).call(this))}disconnectedCallback(){var e,n;this.disable(),(n=(e=Un(this,hr))==null?void 0:e.unassociateElement)==null||n.call(e,this),Mg(this,hr,null),this.removeEventListener("mouseenter",Un(this,oa)),this.removeEventListener("focus",Un(this,oa)),this.removeEventListener("click",Un(this,sd))}get keysUsed(){return["Enter"," "]}get tooltipPlacement(){return Mn(this,Ho.TOOLTIP_PLACEMENT)}set tooltipPlacement(e){Cn(this,Ho.TOOLTIP_PLACEMENT,e)}get mediaController(){return Mn(this,Wt.MEDIA_CONTROLLER)}set mediaController(e){Cn(this,Wt.MEDIA_CONTROLLER,e)}get disabled(){return Dt(this,Ho.DISABLED)}set disabled(e){Ot(this,Ho.DISABLED,e)}get noTooltip(){return Dt(this,Ho.NO_TOOLTIP)}set noTooltip(e){Ot(this,Ho.NO_TOOLTIP,e)}handleClick(e){}};a(dx,"MediaChromeButton");let ai=dx;hr=new WeakMap;sd=new WeakMap;oa=new WeakMap;Bc=new WeakMap;mm=new WeakMap;bw=new WeakSet;T$=a(function(){this.addEventListener("mouseenter",Un(this,oa)),this.addEventListener("focus",Un(this,oa)),this.addEventListener("click",Un(this,sd));const t=this.tooltipPlacement;t&&this.tooltipEl&&(this.tooltipEl.placement=t)},"setupTooltip_fn");ai.shadowRootOptions={mode:"open"};ai.getTemplateHTML=Fue;ai.getSlotTemplateHTML=Uue;ai.getTooltipContentHTML=Bue;me.customElements.get("media-chrome-button")||me.customElements.define("media-chrome-button",ai);const rC=`<svg aria-hidden="true" viewBox="0 0 26 24">
2506  <path d="M22.13 3H3.87a.87.87 0 0 0-.87.87v13.26a.87.87 0 0 0 .87.87h3.4L9 16H5V5h16v11h-4l1.72 2h3.4a.87.87 0 0 0 .87-.87V3.87a.87.87 0 0 0-.86-.87Zm-8.75 11.44a.5.5 0 0 0-.76 0l-4.91 5.73a.5.5 0 0 0 .38.83h9.82a.501.501 0 0 0 .38-.83l-4.91-5.73Z"/>
2507</svg>
2508`;function $ue(t){return`
2509    <style>
2510      :host([${J.MEDIA_IS_AIRPLAYING}]) slot[name=icon] slot:not([name=exit]) {
2511        display: none !important;
2512      }
2513
2514      
2515      :host(:not([${J.MEDIA_IS_AIRPLAYING}])) slot[name=icon] slot:not([name=enter]) {
2516        display: none !important;
2517      }
2518
2519      :host([${J.MEDIA_IS_AIRPLAYING}]) slot[name=tooltip-enter],
2520      :host(:not([${J.MEDIA_IS_AIRPLAYING}])) slot[name=tooltip-exit] {
2521        display: none;
2522      }
2523    </style>
2524
2525    <slot name="icon">
2526      <slot name="enter">${rC}</slot>
2527      <slot name="exit">${rC}</slot>
2528    </slot>
2529  `}a($ue,"getSlotTemplateHTML$f");function Hue(){return`
2530    <slot name="tooltip-enter">${Xe("start airplay")}</slot>
2531    <slot name="tooltip-exit">${Xe("stop airplay")}</slot>
2532  `}a(Hue,"getTooltipContentHTML$9");const oC=a(t=>{const e=t.mediaIsAirplaying?Xe("stop airplay"):Xe("start airplay");t.setAttribute("aria-label",e)},"updateAriaLabel$5"),ux=class ux extends ai{static get observedAttributes(){return[...super.observedAttributes,J.MEDIA_IS_AIRPLAYING,J.MEDIA_AIRPLAY_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),oC(this)}attributeChangedCallback(e,n,i){super.attributeChangedCallback(e,n,i),e===J.MEDIA_IS_AIRPLAYING&&oC(this)}get mediaIsAirplaying(){return Dt(this,J.MEDIA_IS_AIRPLAYING)}set mediaIsAirplaying(e){Ot(this,J.MEDIA_IS_AIRPLAYING,e)}get mediaAirplayUnavailable(){return Mn(this,J.MEDIA_AIRPLAY_UNAVAILABLE)}set mediaAirplayUnavailable(e){Cn(this,J.MEDIA_AIRPLAY_UNAVAILABLE,e)}handleClick(){const e=new me.CustomEvent(Ve.MEDIA_AIRPLAY_REQUEST,{composed:!0,bubbles:!0});this.dispatchEvent(e)}};a(ux,"MediaAirplayButton");let oh=ux;oh.getSlotTemplateHTML=$ue;oh.getTooltipContentHTML=Hue;me.customElements.get("media-airplay-button")||me.customElements.define("media-airplay-button",oh);const Gue=`<svg aria-hidden="true" viewBox="0 0 26 24">
2533  <path d="M22.83 5.68a2.58 2.58 0 0 0-2.3-2.5c-3.62-.24-11.44-.24-15.06 0a2.58 2.58 0 0 0-2.3 2.5c-.23 4.21-.23 8.43 0 12.64a2.58 2.58 0 0 0 2.3 2.5c3.62.24 11.44.24 15.06 0a2.58 2.58 0 0 0 2.3-2.5c.23-4.21.23-8.43 0-12.64Zm-11.39 9.45a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.92 3.92 0 0 1 .92-2.77 3.18 3.18 0 0 1 2.43-1 2.94 2.94 0 0 1 2.13.78c.364.359.62.813.74 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.17 1.61 1.61 0 0 0-1.29.58 2.79 2.79 
25330 0 0-.5 1.89 3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.48 1.48 0 0 0 1-.37 2.1 2.1 0 0 0 .59-1.14l1.4.44a3.23 3.23 0 0 1-1.07 1.69Zm7.22 0a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.88 3.88 0 0 1 .93-2.77 3.14 3.14 0 0 1 2.42-1 3 3 0 0 1 2.16.82 2.8 2.8 0 0 1 .73 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.21 1.61 1.61 0 0 0-1.29.58A2.79 2.79 0 0 0 15 12a3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.44 1.44 0 0 0 1-.37 2.1 2.1 0 0 0 .6-1.15l1.4.44a3.17 3.17 0 0 1-1.1 1.7Z"/>
2534</svg>`,Vue=`<svg aria-hidden="true" viewBox="0 0 26 24">
2535  <path d="M17.73 14.09a1.4 1.4 0 0 1-1 .37 1.579 1.579 0 0 1-1.27-.58A3 3 0 0 1 15 12a2.8 2.8 0 0 1 .5-1.85 1.63 1.63 0 0 1 1.29-.57 1.47 1.47 0 0 1 1.51 1.2l1.43-.34A2.89 2.89 0 0 0 19 9.07a3 3 0 0 0-2.14-.78 3.14 3.14 0 0 0-2.42 1 3.91 3.91 0 0 0-.93 2.78 3.74 3.74 0 0 0 .92 2.66 3.07 3.07 0 0 0 2.34 1 3.07 3.07 0 0 0 1.91-.57 3.17 3.17 0 0 0 1.07-1.74l-1.4-.45c-.083.43-.3.822-.62 1.12Zm-7.22 0a1.43 1.43 0 0 1-1 .37 1.58 1.58 0 0 1-1.27-.58A3 3 0 0 1 7.76 12a2.8 2.8 0 0 1 .5-1.85 1.63 1.63 0 0 1 1.29-.57 1.47 1.47 0 0 1 1.51 1.2l1.43-.34a2.81 2.81 0 0 0-.74-1.32 2.94 2.94 0 0 0-2.13-.78 3.18 3.18 0 0 0-2.43 1 4 4 0 0 0-.92 2.78 3.74 3.74 0 0 0 .92 2.66 3.07 3.07 0 0 0 2.34 1 3.07 3.07 0 0 0 1.91-.57 3.23 3.23 0 0 0 1.07-1.74l-1.4-.45a2.06 2.06 0 0 1-.6 1.07Zm12.32-8.41a2.59 2.59 0 0 0-2.3-2.51C18.72 3.05 15.86 3 13 3c-2.86 0-5.72.05-7.53.17a2.59 2.59 0 0 0-2.3 2.51c-.23 4.207-.23 8.423 0 12.63a2.57 2.57 0 0 0 2.3 2.5c1.81.13 4.67.19 7.53.19 2.86 0 5.72-.06 7.53-.19a2.57 2.57 0 0 0 2.3-2.5c.23-4.207.23-8.423 0-12.63Zm-1.49 12.53a1.11 1.11 0 0 1-.91 1.11c-1.67.11-4.45.18-7.43.18-2.98 0-5.76-.07-7.43-.18a1.11 1.11 0 0 1-.91-1.11c-.21-4.14-.21-8.29 0-12.43a1.11 1.11 0 0 1 .91-1.11C7.24 4.56 10 4.49 13 4.49s5.76.07 7.43.18a1.11 1.11 0 0 1 .91 1.11c.21 4.14.21 8.29 0 12.43Z"/>
2536</svg>`;function Wue(t){return`
2537    <style>
2538      :host([aria-checked="true"]) slot[name=off] {
2539        display: none !important;
2540      }
2541
2542      
2543      :host(:not([aria-checked="true"])) slot[name=on] {
2544        display: none !important;
2545      }
2546
2547      :host([aria-checked="true"]) slot[name=tooltip-enable],
2548      :host(:not([aria-checked="true"])) slot[name=tooltip-disable] {
2549        display: none;
2550      }
2551    </style>
2552
2553    <slot name="icon">
2554      <slot name="on">${Gue}</slot>
2555      <slot name="off">${Vue}</slot>
2556    </slot>
2557  `}a(Wue,"getSlotTemplateHTML$e");function zue(){return`
2558    <slot name="tooltip-enable">${Xe("Enable captions")}</slot>
2559    <slot name="tooltip-disable">${Xe("Disable captions")}</slot>
2560  `}a(zue,"getTooltipContentHTML$8");const aC=a(t=>{t.setAttribute("aria-checked",oue(t).toString())},"updateAriaChecked"),fx=class fx extends ai{static get observedAttributes(){return[...super.observedAttributes,J.MEDIA_SUBTITLES_LIST,J.MEDIA_SUBTITLES_SHOWING]}connectedCallback(){super.connectedCallback(),this.setAttribute("role","switch"),this.setAttribute("aria-label",Xe("closed captions")),aC(this)}attributeChangedCallback(e,n,i){super.attributeChangedCallback(e,n,i),e===J.MEDIA_SUBTITLES_SHOWING&&aC(this)}get mediaSubtitlesList(){return lC(this,J.MEDIA_SUBTITLES_LIST)}set mediaSubtitlesList(e){cC(this,J.MEDIA_SUBTITLES_LIST,e)}get mediaSubtitlesShowing(){return lC(this,J.MEDIA_SUBTITLES_SHOWING)}set mediaSubtitlesShowing(e){cC(this,J.MEDIA_SUBTITLES_SHOWING,e)}handleClick(){this.dispatchEvent(new me.CustomEvent(Ve.MEDIA_TOGGLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0}))}};a(fx,"MediaCaptionsButton");let ah=fx;ah.getSlotTemplateHTML=Wue;ah.getTooltipContentHTML=zue;const lC=a((t,e)=>{const n=t.getAttribute(e);return n?g$(n):[]},"getSubtitlesListAttr"),cC=a((t,e,n)=>{if(!n?.length){t.removeAttribute(e);return}const i=pw(n);t.getAttribute(e)!==i&&t.setAttribute(e,i)},"setSubtitlesListAttr");me.customElements.get("media-captions-button")||me.customElements.define("media-captions-button",ah);const Kue='<svg aria-hidden="true" viewBox="0 0 24 24"><g><path class="cast_caf_icon_arch0" d="M1,18 L1,21 L4,21 C4,19.3 2.66,18 1,18 L1,18 Z"/><path class="cast_caf_icon_arch1" d="M1,14 L1,16 C3.76,16 6,18.2 6,21 L8,21 C8,17.13 4.87,14 1,14 L1,14 Z"/><path class="cast_caf_icon_arch2" d="M1,10 L1,12 C5.97,12 10,16.0 10,21 L12,21 C12,14.92 7.07,10 1,10 L1,10 Z"/><path class="cast_caf_icon_box" d="M21,3 L3,3 C1.9,3 1,3.9 1,5 L1,8 L3,8 L3,5 L21,5 L21,19 L14,19 L14,21 L21,21 C22.1,21 23,20.1 23,19 L23,5 C23,3.9 22.1,3 21,3 L21,3 Z"/></g></svg>',que='<svg aria-hidden="true" viewBox="0 0 24 24"><g><path class="cast_caf_icon_arch0" d="M1,18 L1,21 L4,21 C4,19.3 2.66,18 1,18 L1,18 Z"/><path class="cast_caf_icon_arch1" d="M1,14 L1,16 C3.76,16 6,18.2 6,21 L8,21 C8,17.13 4.87,14 1,14 L1,14 Z"/><path class="cast_caf_icon_arch2" d="M1,10 L1,12 C5.97,12 10,16.0 10,21 L12,21 C12,14.92 7.07,10 1,10 L1,10 Z"/><path class="cast_caf_icon_box" d="M21,3 L3,3 C1.9,3 1,3.9 1,5 L1,8 L3,8 L3,5 L21,5 L21,19 L14,19 L14,21 L21,21 C22.1,21 23,20.1 23,19 L23,5 C23,3.9 22.1,3 21,3 L21,3 Z"/><path class="cast_caf_icon_boxfill" d="M5,7 L5,8.63 C8,8.6 13.37,14 13.37,17 L19,17 L19,7 Z"/></g></svg>';function jue(t){return`
2561    <style>
2562      :host([${J.MEDIA_IS_CASTING}]) slot[name=icon] slot:not([name=exit]) {
2563        display: none !important;
2564      }
2565
2566      
2567      :host(:not([${J.MEDIA_IS_CASTING}])) slot[name=icon] slot:not([name=enter]) {
2568        display: none !important;
2569      }
2570
2571      :host([${J.MEDIA_IS_CASTING}]) slot[name=tooltip-enter],
2572      :host(:not([${J.MEDIA_IS_CASTING}])) slot[name=tooltip-exit] {
2573        display: none;
2574      }
2575    </style>
2576
2577    <slot name="icon">
2578      <slot name="enter">${Kue}</slot>
2579      <slot name="exit">${que}</slot>
2580    </slot>
2581  `}a(jue,"getSlotTemplateHTML$d");function Yue(){return`
2582    <slot name="tooltip-enter">${Xe("Start casting")}</slot>
2583    <slot name="tooltip-exit">${Xe("Stop casting")}</slot>
2584  `}a(Yue,"getTooltipContentHTML$7");const dC=a(t=>{const e=t.mediaIsCasting?Xe("stop casting"):Xe("start casting");t.setAttribute("aria-label",e)},"updateAriaLabel$4"),hx=class hx extends ai{static get observedAttributes(){return[...super.observedAttributes,J.MEDIA_IS_CASTING,J.MEDIA_CAST_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),dC(this)}attributeChangedCallback(e,n,i){super.attributeChangedCallback(e,n,i),e===J.MEDIA_IS_CASTING&&dC(this)}get mediaIsCasting(){return Dt(this,J.MEDIA_IS_CASTING)}set mediaIsCasting(e){Ot(this,J.MEDIA_IS_CASTING,e)}get mediaCastUnavailable(){return Mn(this,J.MEDIA_CAST_UNAVAILABLE)}set mediaCastUnavailable(e){Cn(this,J.MEDIA_CAST_UNAVAILABLE,e)}handleClick(){const e=this.mediaIsCasting?Ve.MEDIA_EXIT_CAST_REQUEST:Ve.MEDIA_ENTER_CAST_REQUEST;this.dispatchEvent(new me.CustomEvent(e,{composed:!0,bubbles:!0}))}};a(hx,"MediaCastButton");let lh=hx;lh.getSlotTemplateHTML=jue;lh.getTooltipContentHTML=Yue;me.customElements.get("media-cast-button")||me.customElements.define("media-cast-button",lh);var bA=a((t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},"__accessCheck$f"),Pl=a((t,e,n)=>(bA(t,e,"read from private field"),n?n.call(t):e.get(t)),"__privateGet$f"),Zr=a((t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},"__privateAdd$f"),EA=a((t,e,n,i)=>(bA(t,e,"write to private field"),i?i.call(t,n):e.set(t,n),n),"__privateSet$e"),Ya=a((t,e,n)=>(bA(t,e,"access private method"),n),"__privateMethod$3"),q0,ch,ql,vm,Ew,_w,A$,ww,x$,Sw,I$,Tw,L$,Aw,R$;function Zue(t){return`
2585    <style>
2586      :host {
2587        font: var(--media-font,
2588          var(--media-font-weight, normal)
2589          var(--media-font-size, 14px) /
2590          var(--media-text-content-height, var(--media-control-height, 24px))
2591          var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif));
2592        color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238)));
2593        display: var(--media-dialog-display, inline-flex);
2594        justify-content: center;
2595        align-items: center;
2596        
2597        transition-behavior: allow-discrete;
2598        visibility: hidden;
2599        opacity: 0;
2600        transform: translateY(2px) scale(.99);
2601        pointer-events: none;
2602      }
2603
2604      :host([open]) {
2605        transition: display .2s, visibility 0s, opacity .2s ease-out, transform .15s ease-out;
2606        visibility: visible;
2607        opacity: 1;
2608        transform: translateY(0) scale(1);
2609        pointer-events: auto;
2610      }
2611
2612      #content {
2613        display: flex;
2614        position: relative;
2615        box-sizing: border-box;
2616        width: min(320px, 100%);
2617        word-wrap: break-word;
2618        max-height: 100%;
2619        overflow: auto;
2620        text-align: center;
2621        line-height: 1.4;
2622      }
2623    </style>
2624    ${this.getSlotTemplateHTML(t)}
2625  `}a(Zue,"getTemplateHTML$7");function Que(t){return`
2626    <slot id="content"></slot>
2627  `}a(Que,"getSlotTemplateHTML$c");const Uu={OPEN:"open",ANCHOR:"anchor"},px=class px extends me.HTMLElement{constructor(){super(),Zr(this,vm),Zr(this,_w),Zr(this,ww),Zr(this,Sw),Zr(this,Tw),Zr(this,Aw),Zr(this,q0,!1),Zr(this,ch,null),Zr(this,ql,null),this.addEventListener("invoke",this),this.addEventListener("focusout",this),this.addEventListener("keydown",this)}static get observedAttributes(){return[Uu.OPEN,Uu.ANCHOR]}get open(){return Dt(this,Uu.OPEN)}set open(e){Ot(this,Uu.OPEN,e)}handleEvent(e){switch(e.type){case"invoke":Ya(this,Sw,I$).call(this,e);break;case"focusout":Ya(this,Tw,L$).call(this,e);break;case"keydown":Ya(this,Aw,R$).call(this,e);break}}connectedCallback(){Ya(this,vm,Ew).call(this),this.role||(this.role="dialog")}attributeChangedCallback(e,n,i){Ya(this,vm,Ew).call(this),e===Uu.OPEN&&i!==n&&(this.open?Ya(this,_w,A$).call(this):Ya(this,ww,x$).call(this))}focus(){EA(this,ch,o$());const e=!this.dispatchEvent(new Event("focus",{composed:!0,cancelable:!0})),n=!this.dispatchEvent(new Event("focusin",{composed:!0,bubbles:!0,cancelable:!0}));if(e||n)return;const i=this.querySelector('[autofocus], [tabindex]:not([tabindex="-1"]), [role="menu"]');i?.focus()}get keysUsed(){return["Escape","Tab"]}};a(px,"MediaChromeDialog");let jl=px;q0=new WeakMap;ch=new WeakMap;ql=new WeakMap;vm=new WeakSet;Ew=a(function(){if(!Pl(this,q0)&&(EA(this,q0,!0),!this.shadowRoot)){this.attachShadow(this.constructor.shadowRootOptions);const t=Qs(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(t),queueMicrotask(()=>{const{style:e}=Bn(this.shadowRoot,":host");e.setProperty("transition","display .15s, visibility .15s, opacity .15s ease-in, transform .15s ease-in")})}},"init_fn");_w=new WeakSet;A$=a(function(){var t;(t=Pl(this,ql))==null||t.setAttribute("aria-expanded","true"),this.dispatchEvent(new Event("open",{composed:!0,bubbles:!0})),this.addEventListener("transitionend",()=>this.focus(),{once:!0})},"handleOpen_fn");ww=new WeakSet;x$=a(function(){var t;(t=Pl(this,ql))==null||t.setAttribute("aria-expanded","false"),this.dispatchEvent(new Event("close",{composed:!0,bubbles:!0}))},"handleClosed_fn");Sw=new WeakSet;I$=a(function(t){EA(this,ql,t.relatedTarget),vu(this,t.relatedTarget)||(this.open=!this.open)},"handleInvoke_fn");Tw=new WeakSet;L$=a(function(t){var e;vu(this,t.relatedTarget)||((e=Pl(this,ch))==null||e.focus(),Pl(this,ql)&&Pl(this,ql)!==t.relatedTarget&&this.open&&(this.open=!1))},"handleFocusOut_fn");Aw=new WeakSet;R$=a(function(t){var e,n,i,s,r;const{key:o,ctrlKey:l,altKey:d,metaKey:c}=t;l||d||c||this.keysUsed.includes(o)&&(t.preventDefault(),t.stopPropagation(),o==="Tab"?(t.shiftKey?(n=(e=this.previousElementSibling)==null?void 0:e.focus)==null||n.call(e):(s=(i=this.nextElementSibling)==null?void 0:i.focus)==null||s.call(i),this.blur()):o==="Escape"&&((r=Pl(this,ch))==null||r.focus(),this.open=!1))},"handleKeyDown_fn");jl.shadowRootOptions={mode:"open"};jl.getTemplateHTML=Zue;jl.getSlotTemplateHTML=Que;me.customElements.get("media-chrome-dialog")||me.customElements.define("media-chrome-dialog",jl);var _A=a((t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},"__accessCheck$e"),_n=a((t,e,n)=>(_A(t,e,"read from private field"),n?n.call(t):e.get(t)),"__privateGet$e"),di=a((t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},"__privateAdd$e"),zo=a((t,e,n,i)=>(_A(t,e,"write to private field"),i?i.call(t,n):e.set(t,n),n),"__privateSet$d"),Bs=a((t,e,n)=>(_A(t,e,"access private method"),n),"__privateMethod$2"),pr,Fy,ym,bm,Gs,j0,Em,_m,wm,wA,k$,Sm,xw,Tm,Iw,Y0,SA,Lw,M$,Rw,C$,kw,P$,Mw,D$;function Jue(t){return`
2628    <style>
2629      :host {
2630        --_focus-box-shadow: var(--media-focus-box-shadow, inset 0 0 0 2px rgb(27 127 204 / .9));
2631        --_media-range-padding: var(--media-range-padding, var(--media-control-padding, 10px));
2632
2633        box-shadow: var(--_focus-visible-box-shadow, none);
2634        background: var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7)));
2635        height: calc(var(--media-control-height, 24px) + 2 * var(--_media-range-padding));
2636        display: inline-flex;
2637        align-items: center;
2638        
2639        vertical-align: middle;
2640        box-sizing: border-box;
2641        position: relative;
2642        width: 100px;
2643        transition: background .15s linear;
2644        cursor: var(--media-cursor, pointer);
2645        pointer-events: auto;
2646        touch-action: none; 
2647      }
2648
2649      
2650      input[type=range]:focus {
2651        outline: 0;
2652      }
2653      input[type=range]:focus::-webkit-slider-runnable-track {
2654        outline: 0;
2655      }
2656
2657      :host(:hover) {
2658        background: var(--media-control-hover-background, rgb(50 50 70 / .7));
2659      }
2660
2661      #leftgap {
2662        padding-left: var(--media-range-padding-left, var(--_media-range-padding));
2663      }
2664
2665      #rightgap {
2666        padding-right: var(--media-range-padding-right, var(--_media-range-padding));
2667      }
2668
2669      #startpoint,
2670      #endpoint {
2671        position: absolute;
2672      }
2673
2674      #endpoint {
2675        right: 0;
2676      }
2677
2678      #container {
2679        
2680        width: var(--media-range-track-width, 100%);
2681        transform: translate(var(--media-range-track-translate-x, 0px), var(--media-range-track-translate-y, 0px));
2682        position: relative;
2683        height: 100%;
2684        display: flex;
2685        align-items: center;
2686        min-width: 40px;
2687      }
2688
2689      #range {
2690        
2691        display: var(--media-time-range-hover-display, block);
2692        bottom: var(--media-time-range-hover-bottom, -7px);
2693        height: var(--media-time-range-hover-height, max(100% + 7px, 25px));
2694        width: 100%;
2695        position: absolute;
2696        cursor: var(--media-cursor, pointer);
2697
2698        -webkit-appearance: none; 
2699        -webkit-tap-highlight-color: transparent;
2700        background: transparent; 
2701        margin: 0;
2702        z-index: 1;
2703      }
2704
2705      @media (hover: hover) {
2706        #range {
2707          bottom: var(--media-time-range-hover-bottom, -5px);
2708          height: var(--media-time-range-hover-height, max(100% + 5px, 20px));
2709        }
2710      }
2711
2712      
2713      
2714      #range::-webkit-slider-thumb {
2715        -webkit-appearance: none;
2716        background: transparent;
2717        width: .1px;
2718        height: .1px;
2719      }
2720
2721      
2722      #range::-moz-range-thumb {
2723        background: transparent;
2724        border: transparent;
2725        width: .1px;
2726        height: .1px;
2727      }
2728
2729      #appearance {
2730        height: var(--media-range-track-height, 4px);
2731        display: flex;
2732        flex-direction: column;
2733        justify-content: center;
2734        width: 100%;
2735        position: absolute;
2736        
2737        will-change: transform;
2738      }
2739
2740      #track {
2741        background: var(--media-range-track-background, rgb(255 255 255 / .2));
2742        border-radius: var(--media-range-track-border-radius, 1px);
2743        border: var(--media-range-track-border, none);
2744        outline: var(--media-range-track-outline);
2745        outline-offset: var(--media-range-track-outline-offset);
2746        backdrop-filter: var(--media-range-track-backdrop-filter);
2747        -webkit-backdrop-filter: var(--media-range-track-backdrop-filter);
2748        box-shadow: var(--media-range-track-box-shadow, none);
2749        position: absolute;
2750        width: 100%;
2751        height: 100%;
2752        overflow: hidden;
2753      }
2754
2755      #progress,
2756      #pointer {
2757        position: absolute;
2758        height: 100%;
2759        will-change: width;
2760      }
2761
2762      #progress {
2763        background: var(--media-range-bar-color, var(--media-primary-color, rgb(238 238 238)));
2764        transition: var(--media-range-track-transition);
2765      }
2766
2767      #pointer {
2768        background: var(--media-range-track-pointer-background);
2769        border-right: var(--media-range-track-pointer-border-right);
2770        transition: visibility .25s, opacity .25s;
2771        visibility: hidden;
2772        opacity: 0;
2773      }
2774
2775      @media (hover: hover) {
2776        :host(:hover) #pointer {
2777          transition: visibility .5s, opacity .5s;
2778          visibility: visible;
2779          opacity: 1;
2780        }
2781      }
2782
2783      #thumb,
2784      ::slotted([slot=thumb]) {
2785        width: var(--media-range-thumb-width, 10px);
2786        height: var(--media-range-thumb-height, 10px);
2787        transition: var(--media-range-thumb-transition);
2788        transform: var(--media-range-thumb-transform, none);
2789        opacity: var(--media-range-thumb-opacity, 1);
2790        translate: -50%;
2791        position: absolute;
2792        left: 0;
2793        cursor: var(--media-cursor, pointer);
2794      }
2795
2796      #thumb {
2797        border-radius: var(--media-range-thumb-border-radius, 10px);
2798        background: var(--media-range-thumb-background, var(--media-primary-color, rgb(238 238 238)));
2799        box-shadow: var(--media-range-thumb-box-shadow, 1px 1px 1px transparent);
2800        border: var(--media-range-thumb-border, none);
2801      }
2802
2803      :host([disabled]) #thumb {
2804        background-color: #777;
2805      }
2806
2807      .segments #appearance {
2808        height: var(--media-range-segment-hover-height, 7px);
2809      }
2810
2811      #track {
2812        clip-path: url(#segments-clipping);
2813      }
2814
2815      #segments {
2816        --segments-gap: var(--media-range-segments-gap, 2px);
2817        position: absolute;
2818        width: 100%;
2819        height: 100%;
2820      }
2821
2822      #segments-clipping {
2823        transform: translateX(calc(var(--segments-gap) / 2));
2824      }
2825
2826      #segments-clipping:empty {
2827        display: none;
2828      }
2829
2830      #segments-clipping rect {
2831        height: var(--media-range-track-height, 4px);
2832        y: calc((var(--media-range-segment-hover-height, 7px) - var(--media-range-track-height, 4px)) / 2);
2833        transition: var(--media-range-segment-transition, transform .1s ease-in-out);
2834        transform: var(--media-range-segment-transform, scaleY(1));
2835        transform-origin: center;
2836      }
2837    </style>
2838    <div id="leftgap"></div>
2839    <div id="container">
2840      <div id="startpoint"></div>
2841      <div id="endpoint"></div>
2842      <div id="appearance">
2843        <div id="track" part="track">
2844          <div id="pointer"></div>
2845          <div id="progress" part="progress"></div>
2846        </div>
2847        <slot name="thumb">
2848          <div id="thumb" part="thumb"></div>
2849        </slot>
2850        <svg id="segments"><clipPath id="segments-clipping"></clipPath></svg>
2851      </div>
2852      <input id="range" type="range" min="0" max="1" step="any" value="0">
2853    </div>
2854    <div id="rightgap"></div>
2855  `}a(Jue,"getTemplateHTML$6");const gx=class gx extends me.HTMLElement{constructor(){if(super(),di(this,wA),di(this,Sm),di(this,Tm),di(this,Y0),di(this,Lw),di(this,Rw),di(this,kw),di(this,Mw),di(this,pr,void 0),di(this,Fy,void 0),di(this,ym,void 0),di(this,bm,void 0),di(this,Gs,{}),di(this,j0,[]),di(this,Em,()=>{if(this.range.matches(":focus-visible")){const{style:e}=Bn(this.shadowRoot,":host");e.setProperty("--_focus-visible-box-shadow","var(--_focus-box-shadow)")}}),di(this,_m,()=>{const{style:e}=Bn(this.shadowRoot,":host");e.removeProperty("--_focus-visible-box-shadow")}),di(this,wm,()=>{const e=this.shadowRoot.querySelector("#segments-clipping");e&&e.parentNode.append(e)}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Qs(this.attributes),n=this.constructor.getTemplateHTML(e);this.shadowRoot.setHTMLUnsafe?this.shadowRoot.setHTMLUnsafe(n):this.shadowRoot.innerHTML=n}this.container=this.shadowRoot.querySelector("#container"),zo(this,ym,this.shadowRoot.querySelector("#startpoint")),zo(this,bm,this.shadowRoot.querySelector("#endpoint")),this.range=this.shadowRoot.querySelector("#range"),this.appearance=this.shadowRoot.querySelector("#appearance")}static get observedAttributes(){return["disabled","aria-disabled",Wt.MEDIA_CONTROLLER]}attributeChangedCallback(e,n,i){var s,r,o,l,d;e===Wt.MEDIA_CONTROLLER?(n&&((r=(s=_n(this,pr))==null?void 0:s.unassociateElement)==null||r.call(s,this),zo(this,pr,null)),i&&this.isConnected&&(zo(this,pr,(o=this.getRootNode())==null?void 0:o.getElementById(i)),(d=(l=_n(this,pr))==null?void 0:l.associateElement)==null||d.call(l,this))):(e==="disabled"||e==="aria-disabled"&&n!==i)&&(i==null?(this.range.removeAttribute(e),Bs(this,Sm,xw).call(this)):(this.range.setAttribute(e,i),Bs(this,Tm,Iw).call(this)))}connectedCallback(){var e,n,i;const{style:s}=Bn(this.shadowRoot,":host");s.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`),_n(this,Gs).pointer=Bn(this.shadowRoot,"#pointer"),_n(this,Gs).progress=Bn(this.shadowRoot,"#progress"),_n(this,Gs).thumb=Bn(this.shadowRoot,'#thumb, ::slotted([slot="thumb"])'),_n(this,Gs).activeSegment=Bn(this.shadowRoot,"#segments-clipping rect:nth-child(0)");const r=this.getAttribute(Wt.MEDIA_CONTROLLER);r&&(zo(this,pr,(e=this.getRootNode())==null?void 0:e.getElementById(r)),(i=(n=_n(this,pr))==null?void 0:n.associateElement)==null||i.call(n,this)),this.updateBar(),this.shadowRoot.addEventListener("focusin",_n(this,Em)),this.shadowRoot.addEventListener("focusout",_n(this,_m)),Bs(this,Sm,xw).call(this),n$(this.container,_n(this,wm))}disconnectedCallback(){var e,n;Bs(this,Tm,Iw).call(this),(n=(e=_n(this,pr))==null?void 0:e.unassociateElement)==null||n.call(e,this),zo(this,pr,null),this.shadowRoot.removeEventListener("focusin",_n(this,Em)),this.shadowRoot.removeEventListener("focusout",_n(this,_m)),i$(this.container,_n(this,wm))}updatePointerBar(e){var n;(n=_n(this,Gs).pointer)==null||n.style.setProperty("width",`${this.getPointerRatio(e)*100}%`)}updateBar(){var e,n;const i=this.range.valueAsNumber*100;(e=_n(this,Gs).progress)==null||e.style.setProperty("width",`${i}%`),(n=_n(this,Gs).thumb)==null||n.style.setProperty("left",`${i}%`)}updateSegments(e){const n=this.shadowRoot.querySelector("#segments-clipping");if(n.textContent="",this.container.classList.toggle("segments",!!e?.length),!e?.length)return;const i=[...new Set([+this.range.min,...e.flatMap(r=>[r.start,r.end]),+this.range.max])];zo(this,j0,[...i]);const s=i.pop();for(const[r,o]of i.entries()){const[l,d]=[r===0,r===i.length-1],c=l?"calc(var(--segments-gap) / -1)":`${o*100}%`,f=`calc(${((d?s:i[r+1])-o)*100}%${l||d?"":" - var(--segments-gap)"})`,h=Li.createElementNS("http://www.w3.org/2000/svg","rect"),p=Bn(this.shadowRoot,`#segments-clipping rect:nth-child(${r+1})`);p.style.setProperty("x",c),p.style.setProperty("width",f),n.append(h)}}getPointerRatio(e){return zde(e.clientX,e.clientY,_n(this,ym).getBoundingClientRect(),_n(this,bm).getBoundingClientRect())}get dragging(){return this.hasAttribute("dragging")}handleEvent(e){switch(e.type){case"pointermove":Bs(this,Mw,D$).call(this,e);break;case"input":this.updateBar();break;case"pointerenter":Bs(this,Lw,M$).call(this,e);break;case"pointerdown":Bs(this,Y0,SA).call(this,e);break;case"pointerup":Bs(this,Rw,C$).call(this);break;case"pointerleave":Bs(this,kw,P$).call(this);break}}get keysUsed(){return["ArrowUp","ArrowRight","ArrowDown","ArrowLeft"]}};a(gx,"MediaChromeRange");let Fa=gx;pr=new WeakMap;Fy=new WeakMap;ym=new WeakMap;bm=new WeakMap;Gs=new WeakMap;j0=new WeakMap;Em=new WeakMap;_m=new WeakMap;wm=new WeakMap;wA=new WeakSet;k$=a(function(t){const e=_n(this,Gs).activeSegment;if(!e)return;const n=this.getPointerRatio(t),s=`#segments-clipping rect:nth-child(${_n(this,j0).findIndex((r,o,l)=>{const d=l[o+1];return d!=null&&n>=r&&n<=d})+1})`;(e.selectorText!=s||!e.style.transform)&&(e.selectorText=s,e.style.setProperty("transform","var(--media-range-segment-hover-transform, scaleY(2))"))},"updateActiveSegment_fn");Sm=new WeakSet;xw=a(function(){this.hasAttribute("disabled")||(this.addEventListener("input",this),this.addEventListener("pointerdown",this),this.addEventListener("pointerenter",this))},"enableUserEvents_fn");Tm=new WeakSet;Iw=a(function(){var t,e;this.removeEventListener("input",this),this.removeEventListener("pointerdown",this),this.removeEventListener("pointerenter",this),(t=me.window)==null||t.removeEventListener("pointerup",this),(e=me.window)==null||e.removeEventListener("pointermove",this)},"disableUserEvents_fn");Y0=new WeakSet;SA=a(function(t){var e;zo(this,Fy,t.composedPath().includes(this.range)),(e=me.window)==null||e.addEventListener("pointerup",this)},"handlePointerDown_fn");Lw=new WeakSet;M$=a(function(t){var e;t.pointerType!=="mouse"&&Bs(this,Y0,SA).call(this,t),this.addEventListener("pointerleave",this),(e=me.window)==null||e.addEventListener("pointermove",this)},"handlePointerEnter_fn");Rw=new WeakSet;C$=a(function(){var t;(t=me.window)==null||t.removeEventListener("pointerup",this),this.toggleAttribute("dragging",!1),this.range.disabled=this.hasAttribute("disabled")},"handlePointerUp_fn");kw=new WeakSet;P$=a(function(){var t,e;this.removeEventListener("pointerleave",this),(t=me.window)==null||t.removeEventListener("pointermove",this),this.toggleAttribute("dragging",!1),this.range.disabled=this.hasAttribute("disabled"),(e=_n(this,Gs).activeSegment)==null||e.style.removeProperty("transform")},"handlePointerLeave_fn");Mw=new WeakSet;D$=a(function(t){this.toggleAttribute("dragging",t.buttons===1||t.pointerType!=="mouse"),this.updatePointerBar(t),Bs(this,wA,k$).call(this,t),this.dragging&&(t.pointerType!=="mouse"||!_n(this,Fy))&&(this.range.disabled=!0,this.range.valueAsNumber=this.getPointerRatio(t),this.range.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})))},"handlePointerMove_fn$1");Fa.shadowRootOptions={mode:"open"};Fa.getTemplateHTML=Jue;me.customElements.get("media-chrome-range")||me.customElements.define("media-chrome-range",Fa);var O$=a((t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},"__accessCheck$d"),Cg=a((t,e,n)=>(O$(t,e,"read from private field"),n?n.call(t):e.get(t)),"__privateGet$d"),Xue=a((t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},"__privateAdd$d"),Pg=a((t,e,n,i)=>(O$(t,e,"write to private field"),i?i.call(t,n):e.set(t,n),n),"__privateSet$c"),gr;function efe(t){return`
2856    <style>
2857      :host {
2858        
2859        box-sizing: border-box;
2860        display: var(--media-control-display, var(--media-control-bar-display, inline-flex));
2861        color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238)));
2862        --media-loading-indicator-icon-height: 44px;
2863      }
2864
2865      ::slotted(media-time-range),
2866      ::slotted(media-volume-range) {
2867        min-height: 100%;
2868      }
2869
2870      ::slotted(media-time-range),
2871      ::slotted(media-clip-selector) {
2872        flex-grow: 1;
2873      }
2874
2875      ::slotted([role="menu"]) {
2876        position: absolute;
2877      }
2878    </style>
2879
2880    <slot></slot>
2881  `}a(efe,"getTemplateHTML$5");const mx=class mx extends me.HTMLElement{constructor(){if(super(),Xue(this,gr,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Qs(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[Wt.MEDIA_CONTROLLER]}attributeChangedCallback(e,n,i){var s,r,o,l,d;e===Wt.MEDIA_CONTROLLER&&(n&&((r=(s=Cg(this,gr))==null?void 0:s.unassociateElement)==null||r.call(s,this),Pg(this,gr,null)),i&&this.isConnected&&(Pg(this,gr,(o=this.getRootNode())==null?void 0:o.getElementById(i)),(d=(l=Cg(this,gr))==null?void 0:l.associateElement)==null||d.call(l,this)))}connectedCallback(){var e,n,i;const s=this.getAttribute(Wt.MEDIA_CONTROLLER);s&&(Pg(this,gr,(e=this.getRootNode())==null?void 0:e.getElementById(s)),(i=(n=Cg(this,gr))==null?void 0:n.associateElement)==null||i.call(n,this))}disconnectedCallback(){var e,n;(n=(e=Cg(this,gr))==null?void 0:e.unassociateElement)==null||n.call(e,this),Pg(this,gr,null)}};a(mx,"MediaControlBar");let dh=mx;gr=new WeakMap;dh.shadowRootOptions={mode:"open"};dh.getTemplateHTML=efe;me.customElements.get("media-control-bar")||me.customElements.define("media-control-bar",dh);var N$=a((t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},"__accessCheck$c"),Dg=a((t,e,n)=>(N$(t,e,"read from private field"),n?n.call(t):e.get(t)),"__privateGet$c"),tfe=a((t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},"__privateAdd$c"),Og=a((t,e,n,i)=>(N$(t,e,"write to private field"),i?i.call(t,n):e.set(t,n),n),"__privateSet$b"),mr;function nfe(t,e={}){return`
2882    <style>
2883      :host {
2884        font: var(--media-font,
2885          var(--media-font-weight, normal)
2886          var(--media-font-size, 14px) /
2887          var(--media-text-content-height, var(--media-control-height, 24px))
2888          var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif));
2889        color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238)));
2890        background: var(--media-text-background, var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7))));
2891        padding: var(--media-control-padding, 10px);
2892        display: inline-flex;
2893        justify-content: center;
2894        align-items: center;
2895        vertical-align: middle;
2896        box-sizing: border-box;
2897        text-align: center;
2898        pointer-events: auto;
2899      }
2900
2901      
2902      :host(:focus-visible) {
2903        box-shadow: inset 0 0 0 2px rgb(27 127 204 / .9);
2904        outline: 0;
2905      }
2906
2907      
2908      :host(:where(:focus)) {
2909        box-shadow: none;
2910        outline: 0;
2911      }
2912    </style>
2913
2914    ${this.getSlotTemplateHTML(t,e)}
2915  `}a(nfe,"getTemplateHTML$4");function ife(t,e){return`
2916    <slot></slot>
2917  `}a(ife,"getSlotTemplateHTML$b");const vx=class vx extends me.HTMLElement{constructor(){if(super(),tfe(this,mr,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Qs(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[Wt.MEDIA_CONTROLLER]}attributeChangedCallback(e,n,i){var s,r,o,l,d;e===Wt.MEDIA_CONTROLLER&&(n&&((r=(s=Dg(this,mr))==null?void 0:s.unassociateElement)==null||r.call(s,this),Og(this,mr,null)),i&&this.isConnected&&(Og(this,mr,(o=this.getRootNode())==null?void 0:o.getElementById(i)),(d=(l=Dg(this,mr))==null?void 0:l.associateElement)==null||d.call(l,this)))}connectedCallback(){var e,n,i;const{style:s}=Bn(this.shadowRoot,":host");s.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`);const r=this.getAttribute(Wt.MEDIA_CONTROLLER);r&&(Og(this,mr,(e=this.getRootNode())==null?void 0:e.getElementById(r)),(i=(n=Dg(this,mr))==null?void 0:n.associateElement)==null||i.call(n,this))}disconnectedCallback(){var e,n;(n=(e=Dg(this,mr))==null?void 0:e.unassociateElement)==null||n.call(e,this),Og(this,mr,null)}};a(vx,"MediaTextDisplay");let $r=vx;mr=new WeakMap;$r.shadowRootOptions={mode:"open"};$r.getTemplateHTML=nfe;$r.getSlotTemplateHTML=ife;me.customElements.get("media-text-display")||me.customElements.define("media-text-display",$r);var F$=a((t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},"__accessCheck$b"),uC=a((t,e,n)=>(F$(t,e,"read from private field"),n?n.call(t):e.get(t)),"__privateGet$b"),sfe=a((t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},"__privateAdd$b"),rfe=a((t,e,n,i)=>(F$(t,e,"write to private field"),i?i.call(t,n):e.set(t,n),n),"__privateSet$a"),of;function ofe(t,e){return`
2918    <slot>${Ca(e.mediaDuration)}</slot>
2919  `}a(ofe,"getSlotTemplateHTML$a");const yx=class yx extends $r{constructor(){var e;super(),sfe(this,of,void 0),rfe(this,of,this.shadowRoot.querySelector("slot")),uC(this,of).textContent=Ca((e=this.mediaDuration)!=null?e:0)}static get observedAttributes(){return[...super.observedAttributes,J.MEDIA_DURATION]}attributeChangedCallback(e,n,i){e===J.MEDIA_DURATION&&(uC(this,of).textContent=Ca(+i)),super.attributeChangedCallback(e,n,i)}get mediaDuration(){return Rn(this,J.MEDIA_DURATION)}set mediaDuration(e){si(this,J.MEDIA_DURATION,e)}};a(yx,"MediaDurationDisplay");let Z0=yx;of=new WeakMap;Z0.getSlotTemplateHTML=ofe;me.customElements.get("media-duration-display")||me.customElements.define("media-duration-display",Z0);const afe={2:Xe("Network Error"),3:Xe("Decode Error"),4:Xe("Source Not Supported"),5:Xe("Encryption 
2919Error")},lfe={2:Xe("A network error caused the media download to fail."),3:Xe("A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format."),4:Xe("An unsupported error occurred. The server or network failed, or your browser does not support this format."),5:Xe("The media is encrypted and there are no keys to decrypt it.")},U$=a(t=>{var e,n;return t.code===1?null:{title:(e=afe[t.code])!=null?e:`Error ${t.code}`,message:(n=lfe[t.code])!=null?n:t.message}},"formatError");var B$=a((t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},"__accessCheck$a"),cfe=a((t,e,n)=>(B$(t,e,"read from private field"),n?n.call(t):e.get(t)),"__privateGet$a"),dfe=a((t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},"__privateAdd$a"),ufe=a((t,e,n,i)=>(B$(t,e,"write to private field"),i?i.call(t,n):e.set(t,n),n),"__privateSet$9"),Am;function ffe(t){return`
2920    <style>
2921      :host {
2922        background: rgb(20 20 30 / .8);
2923      }
2924
2925      #content {
2926        display: block;
2927        padding: 1.2em 1.5em;
2928      }
2929
2930      h3,
2931      p {
2932        margin-block: 0 .3em;
2933      }
2934    </style>
2935    <slot name="error-${t.mediaerrorcode}" id="content">
2936      ${$$({code:+t.mediaerrorcode,message:t.mediaerrormessage})}
2937    </slot>
2938  `}a(ffe,"getSlotTemplateHTML$9");function hfe(t){return t.code&&U$(t)!==null}a(hfe,"shouldOpenErrorDialog");function $$(t){var e;const{title:n,message:i}=(e=U$(t))!=null?e:{};let s="";return n&&(s+=`<slot name="error-${t.code}-title"><h3>${n}</h3></slot>`),i&&(s+=`<slot name="error-${t.code}-message"><p>${i}</p></slot>`),s}a($$,"formatErrorMessage");const fC=[J.MEDIA_ERROR_CODE,J.MEDIA_ERROR_MESSAGE],bx=class bx extends jl{constructor(){super(...arguments),dfe(this,Am,null)}static get observedAttributes(){return[...super.observedAttributes,...fC]}formatErrorMessage(e){return this.constructor.formatErrorMessage(e)}attributeChangedCallback(e,n,i){var s;if(super.attributeChangedCallback(e,n,i),!fC.includes(e))return;const r=(s=this.mediaError)!=null?s:{code:this.mediaErrorCode,message:this.mediaErrorMessage};this.open=hfe(r),this.open&&(this.shadowRoot.querySelector("slot").name=`error-${this.mediaErrorCode}`,this.shadowRoot.querySelector("#content").innerHTML=this.formatErrorMessage(r))}get mediaError(){return cfe(this,Am)}set mediaError(e){ufe(this,Am,e)}get mediaErrorCode(){return Rn(this,"mediaerrorcode")}set mediaErrorCode(e){si(this,"mediaerrorcode",e)}get mediaErrorMessage(){return Mn(this,"mediaerrormessage")}set mediaErrorMessage(e){Cn(this,"mediaerrormessage",e)}};a(bx,"MediaErrorDialog");let uh=bx;Am=new WeakMap;uh.getSlotTemplateHTML=ffe;uh.formatErrorMessage=$$;me.customElements.get("media-error-dialog")||me.customElements.define("media-error-dialog",uh);const pfe=`<svg aria-hidden="true" viewBox="0 0 26 24">
2939  <path d="M16 3v2.5h3.5V9H22V3h-6ZM4 9h2.5V5.5H10V3H4v6Zm15.5 9.5H16V21h6v-6h-2.5v3.5ZM6.5 15H4v6h6v-2.5H6.5V15Z"/>
2940</svg>`,gfe=`<svg aria-hidden="true" viewBox="0 0 26 24">
2941  <path d="M18.5 6.5V3H16v6h6V6.5h-3.5ZM16 21h2.5v-3.5H22V15h-6v6ZM4 17.5h3.5V21H10v-6H4v2.5Zm3.5-11H4V9h6V3H7.5v3.5Z"/>
2942</svg>`;function mfe(t){return`
2943    <style>
2944      :host([${J.MEDIA_IS_FULLSCREEN}]) slot[name=icon] slot:not([name=exit]) {
2945        display: none !important;
2946      }
2947
2948      
2949      :host(:not([${J.MEDIA_IS_FULLSCREEN}])) slot[name=icon] slot:not([name=enter]) {
2950        display: none !important;
2951      }
2952
2953      :host([${J.MEDIA_IS_FULLSCREEN}]) slot[name=tooltip-enter],
2954      :host(:not([${J.MEDIA_IS_FULLSCREEN}])) slot[name=tooltip-exit] {
2955        display: none;
2956      }
2957    </style>
2958
2959    <slot name="icon">
2960      <slot name="enter">${pfe}</slot>
2961      <slot name="exit">${gfe}</slot>
2962    </slot>
2963  `}a(mfe,"getSlotTemplateHTML$8");function vfe(){return`
2964    <slot name="tooltip-enter">${Xe("Enter fullscreen mode")}</slot>
2965    <slot name="tooltip-exit">${Xe("Exit fullscreen mode")}</slot>
2966  `}a(vfe,"getTooltipContentHTML$6");const hC=a(t=>{const e=t.mediaIsFullscreen?Xe("exit fullscreen mode"):Xe("enter fullscreen mode");t.setAttribute("aria-label",e)},"updateAriaLabel$3"),Ex=class Ex extends ai{static get observedAttributes(){return[...super.observedAttributes,J.MEDIA_IS_FULLSCREEN,J.MEDIA_FULLSCREEN_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),hC(this)}attributeChangedCallback(e,n,i){super.attributeChangedCallback(e,n,i),e===J.MEDIA_IS_FULLSCREEN&&hC(this)}get mediaFullscreenUnavailable(){return Mn(this,J.MEDIA_FULLSCREEN_UNAVAILABLE)}set mediaFullscreenUnavailable(e){Cn(this,J.MEDIA_FULLSCREEN_UNAVAILABLE,e)}get mediaIsFullscreen(){return Dt(this,J.MEDIA_IS_FULLSCREEN)}set mediaIsFullscreen(e){Ot(this,J.MEDIA_IS_FULLSCREEN,e)}handleClick(){const e=this.mediaIsFullscreen?Ve.MEDIA_EXIT_FULLSCREEN_REQUEST:Ve.MEDIA_ENTER_FULLSCREEN_REQUEST;this.dispatchEvent(new me.CustomEvent(e,{composed:!0,bubbles:!0}))}};a(Ex,"MediaFullscreenButton");let fh=Ex;fh.getSlotTemplateHTML=mfe;fh.getTooltipContentHTML=vfe;me.customElements.get("media-fullscreen-button")||me.customElements.define("media-fullscreen-button",fh);const{MEDIA_TIME_IS_LIVE:xm,MEDIA_PAUSED:Tf}=J,{MEDIA_SEEK_TO_LIVE_REQUEST:yfe,MEDIA_PLAY_REQUEST:bfe}=Ve,Efe='<svg viewBox="0 0 6 12"><circle cx="3" cy="6" r="2"></circle></svg>';function _fe(t){return`
2967    <style>
2968      :host { --media-tooltip-display: none; }
2969      
2970      slot[name=indicator] > *,
2971      :host ::slotted([slot=indicator]) {
2972        
2973        min-width: auto;
2974        fill: var(--media-live-button-icon-color, rgb(140, 140, 140));
2975        color: var(--media-live-button-icon-color, rgb(140, 140, 140));
2976      }
2977
2978      :host([${xm}]:not([${Tf}])) slot[name=indicator] > *,
2979      :host([${xm}]:not([${Tf}])) ::slotted([slot=indicator]) {
2980        fill: var(--media-live-button-indicator-color, rgb(255, 0, 0));
2981        color: var(--media-live-button-indicator-color, rgb(255, 0, 0));
2982      }
2983
2984      :host([${xm}]:not([${Tf}])) {
2985        cursor: var(--media-cursor, not-allowed);
2986      }
2987
2988      slot[name=text]{
2989        text-transform: uppercase;
2990      }
2991
2992    </style>
2993
2994    <slot name="indicator">${Efe}</slot>
2995    
2996    <slot name="spacer">&nbsp;</slot><slot name="text">${Xe("live")}</slot>
2997  `}a(_fe,"getSlotTemplateHTML$7");const pC=a(t=>{var e;const n=t.mediaPaused||!t.mediaTimeIsLive,i=Xe(n?"seek to live":"playing live");t.setAttribute("aria-label",i);const s=(e=t.shadowRoot)==null?void 0:e.querySelector('slot[name="text"]');s&&(s.textContent=Xe("live")),n?t.removeAttribute("aria-disabled"):t.setAttribute("aria-disabled","true")},"updateAriaAttributes"),_x=class _x extends ai{static get observedAttributes(){return[...super.observedAttributes,xm,Tf]}connectedCallback(){super.connectedCallback(),pC(this)}attributeChangedCallback(e,n,i){super.attributeChangedCallback(e,n,i),pC(this)}get mediaPaused(){return Dt(this,J.MEDIA_PAUSED)}set mediaPaused(e){Ot(this,J.MEDIA_PAUSED,e)}get mediaTimeIsLive(){return Dt(this,J.MEDIA_TIME_IS_LIVE)}set mediaTimeIsLive(e){Ot(this,J.MEDIA_TIME_IS_LIVE,e)}handleClick(){!this.mediaPaused&&this.mediaTimeIsLive||(this.dispatchEvent(new me.CustomEvent(yfe,{composed:!0,bubbles:!0})),this.hasAttribute(Tf)&&this.dispatchEvent(new me.CustomEvent(bfe,{composed:!0,bubbles:!0})))}};a(_x,"MediaLiveButton");let Q0=_x;Q0.getSlotTemplateHTML=_fe;me.customElements.get("media-live-button")||me.customElements.define("media-live-button",Q0);var H$=a((t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},"__accessCheck$9"),Bu=a((t,e,n)=>(H$(t,e,"read from private field"),n?n.call(t):e.get(t)),"__privateGet$9"),gC=a((t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},"__privateAdd$9"),$u=a((t,e,n,i)=>(H$(t,e,"write to private field"),i?i.call(t,n):e.set(t,n),n),"__privateSet$8"),vr,Im;const Ng={LOADING_DELAY:"loadingdelay",NO_AUTOHIDE:"noautohide"},G$=500,wfe=`
2998<svg aria-hidden="true" viewBox="0 0 100 100">
2999  <path d="M73,50c0-12.7-10.3-23-23-23S27,37.3,27,50 M30.9,50c0-10.5,8.5-19.1,19.1-19.1S69.1,39.5,69.1,50">
3000    <animateTransform
3001       attributeName="transform"
3002       attributeType="XML"
3003       type="rotate"
3004       dur="1s"
3005       from="0 50 50"
3006       to="360 50 50"
3007       repeatCount="indefinite" />
3008  </path>
3009</svg>
3010`;function Sfe(t){return`
3011    <style>
3012      :host {
3013        display: var(--media-control-display, var(--media-loading-indicator-display, inline-block));
3014        vertical-align: middle;
3015        box-sizing: border-box;
3016        --_loading-indicator-delay: var(--media-loading-indicator-transition-delay, ${G$}ms);
3017      }
3018
3019      #status {
3020        color: rgba(0,0,0,0);
3021        width: 0px;
3022        height: 0px;
3023      }
3024
3025      :host slot[name=icon] > *,
3026      :host ::slotted([slot=icon]) {
3027        opacity: var(--media-loading-indicator-opacity, 0);
3028        transition: opacity 0.15s;
3029      }
3030
3031      :host([${J.MEDIA_LOADING}]:not([${J.MEDIA_PAUSED}])) slot[name=icon] > *,
3032      :host([${J.MEDIA_LOADING}]:not([${J.MEDIA_PAUSED}])) ::slotted([slot=icon]) {
3033        opacity: var(--media-loading-indicator-opacity, 1);
3034        transition: opacity 0.15s var(--_loading-indicator-delay);
3035      }
3036
3037      :host #status {
3038        visibility: var(--media-loading-indicator-opacity, hidden);
3039        transition: visibility 0.15s;
3040      }
3041
3042      :host([${J.MEDIA_LOADING}]:not([${J.MEDIA_PAUSED}])) #status {
3043        visibility: var(--media-loading-indicator-opacity, visible);
3044        transition: visibility 0.15s var(--_loading-indicator-delay);
3045      }
3046
3047      svg, img, ::slotted(svg), ::slotted(img) {
3048        width: var(--media-loading-indicator-icon-width);
3049        height: var(--media-loading-indicator-icon-height, 100px);
3050        fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238)));
3051        vertical-align: middle;
3052      }
3053    </style>
3054
3055    <slot name="icon">${wfe}</slot>
3056    <div id="status" role="status" aria-live="polite">${Xe("media loading")}</div>
3057  `}a(Sfe,"getTemplateHTML$3");const wx=class wx extends me.HTMLElement{constructor(){if(super(),gC(this,vr,void 0),gC(this,Im,G$),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Qs(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[Wt.MEDIA_CONTROLLER,J.MEDIA_PAUSED,J.MEDIA_LOADING,Ng.LOADING_DELAY]}attributeChangedCallback(e,n,i){var s,r,o,l,d;e===Ng.LOADING_DELAY&&n!==i?this.loadingDelay=Number(i):e===Wt.MEDIA_CONTROLLER&&(n&&((r=(s=Bu(this,vr))==null?void 0:s.unassociateElement)==null||r.call(s,this),$u(this,vr,null)),i&&this.isConnected&&($u(this,vr,(o=this.getRootNode())==null?void 0:o.getElementById(i)),(d=(l=Bu(this,vr))==null?void 0:l.associateElement)==null||d.call(l,this)))}connectedCallback(){var e,n,i;const s=this.getAttribute(Wt.MEDIA_CONTROLLER);s&&($u(this,vr,(e=this.getRootNode())==null?void 0:e.getElementById(s)),(i=(n=Bu(this,vr))==null?void 0:n.associateElement)==null||i.call(n,this))}disconnectedCallback(){var e,n;(n=(e=Bu(this,vr))==null?void 0:e.unassociateElement)==null||n.call(e,this),$u(this,vr,null)}get loadingDelay(){return Bu(this,Im)}set loadingDelay(e){$u(this,Im,e);const{style:n}=Bn(this.shadowRoot,":host");n.setProperty("--_loading-indicator-delay",`var(--media-loading-indicator-transition-delay, ${e}ms)`)}get mediaPaused(){return Dt(this,J.MEDIA_PAUSED)}set mediaPaused(e){Ot(this,J.MEDIA_PAUSED,e)}get mediaLoading(){return Dt(this,J.MEDIA_LOADING)}set mediaLoading(e){Ot(this,J.MEDIA_LOADING,e)}get mediaController(){return Mn(this,Wt.MEDIA_CONTROLLER)}set mediaController(e){Cn(this,Wt.MEDIA_CONTROLLER,e)}get noAutohide(){return Dt(this,Ng.NO_AUTOHIDE)}set noAutohide(e){Ot(this,Ng.NO_AUTOHIDE,e)}};a(wx,"MediaLoadingIndicator");let hh=wx;vr=new WeakMap;Im=new WeakMap;hh.shadowRootOptions={mode:"open"};hh.getTemplateHTML=Sfe;me.customElements.get("media-loading-indicator")||me.customElements.define("media-loading-indicator",hh);const Tfe=`<svg aria-hidden="true" viewBox="0 0 24 24">
3058  <path d="M16.5 12A4.5 4.5 0 0 0 14 8v2.18l2.45 2.45a4.22 4.22 0 0 0 .05-.63Zm2.5 0a6.84 6.84 0 0 1-.54 2.64L20 16.15A8.8 8.8 0 0 0 21 12a9 9 0 0 0-7-8.77v2.06A7 7 0 0 1 19 12ZM4.27 3 3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25A6.92 6.92 0 0 1 14 18.7v2.06A9 9 0 0 0 17.69 19l2 2.05L21 19.73l-9-9L4.27 3ZM12 4 9.91 6.09 12 8.18V4Z"/>
3059</svg>`,mC=`<svg aria-hidden="true" viewBox="0 0 24 24">
3060  <path d="M3 9v6h4l5 5V4L7 9H3Zm13.5 3A4.5 4.5 0 0 0 14 8v8a4.47 4.47 0 0 0 2.5-4Z"/>
3061</svg>`,Afe=`<svg aria-hidden="true" viewBox="0 0 24 24">
3062  <path d="M3 9v6h4l5 5V4L7 9H3Zm13.5 3A4.5 4.5 0 0 0 14 8v8a4.47 4.47 0 0 0 2.5-4ZM14 3.23v2.06a7 7 0 0 1 0 13.42v2.06a9 9 0 0 0 0-17.54Z"/>
3063</svg>`;function xfe(t){return`
3064    <style>
3065      :host(:not([${J.MEDIA_VOLUME_LEVEL}])) slot[name=icon] slot:not([name=high]),
3066      :host([${J.MEDIA_VOLUME_LEVEL}=high]) slot[name=icon] slot:not([name=high]) {
3067        display: none !important;
3068      }
3069
3070      :host([${J.MEDIA_VOLUME_LEVEL}=off]) slot[name=icon] slot:not([name=off]) {
3071        display: none !important;
3072      }
3073
3074      :host([${J.MEDIA_VOLUME_LEVEL}=low]) slot[name=icon] slot:not([name=low]) {
3075        display: none !important;
3076      }
3077
3078      :host([${J.MEDIA_VOLUME_LEVEL}=medium]) slot[name=icon] slot:not([name=medium]) {
3079        display: none !important;
3080      }
3081
3082      :host(:not([${J.MEDIA_VOLUME_LEVEL}=off])) slot[name=tooltip-unmute],
3083      :host([${J.MEDIA_VOLUME_LEVEL}=off]) slot[name=tooltip-mute] {
3084        display: none;
3085      }
3086    </style>
3087
3088    <slot name="icon">
3089      <slot name="off">${Tfe}</slot>
3090      <slot name="low">${mC}</slot>
3091      <slot name="medium">${mC}</slot>
3092      <slot name="high">${Afe}</slot>
3093    </slot>
3094  `}a(xfe,"getSlotTemplateHTML$6");function Ife(){return`
3095    <slot name="tooltip-mute">${Xe("Mute")}</slot>
3096    <slot name="tooltip-unmute">${Xe("Unmute")}</slot>
3097  `}a(Ife,"getTooltipContentHTML$5");const vC=a(t=>{const e=t.mediaVolumeLevel==="off",n=Xe(e?"unmute":"mute");t.setAttribute("aria-label",n)},"updateAriaLabel$2"),Sx=class Sx extends ai{static get observedAttributes(){return[...super.observedAttributes,J.MEDIA_VOLUME_LEVEL]}connectedCallback(){super.connectedCallback(),vC(this)}attributeChangedCallback(e,n,i){super.attributeChangedCallback(e,n,i),e===J.MEDIA_VOLUME_LEVEL&&vC(this)}get mediaVolumeLevel(){return Mn(this,J.MEDIA_VOLUME_LEVEL)}set mediaVolumeLevel(e){Cn(this,J.MEDIA_VOLUME_LEVEL,e)}handleClick(){const e=this.mediaVolumeLevel==="off"?Ve.MEDIA_UNMUTE_REQUEST:Ve.MEDIA_MUTE_REQUEST;this.dispatchEvent(new me.CustomEvent(e,{composed:!0,bubbles:!0}))}};a(Sx,"MediaMuteButton");let ph=Sx;ph.getSlotTemplateHTML=xfe;ph.getTooltipContentHTML=Ife;me.customElements.get("media-mute-button")||me.customElements.define("media-mute-button",ph);const yC=`<svg aria-hidden="true" viewBox="0 0 28 24">
3098  <path d="M24 3H4a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h20a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1Zm-1 16H5V5h18v14Zm-3-8h-7v5h7v-5Z"/>
3099</svg>`;function Lfe(t){return`
3100    <style>
3101      :host([${J.MEDIA_IS_PIP}]) slot[name=icon] slot:not([name=exit]) {
3102        display: none !important;
3103      }
3104
3105      :host(:not([${J.MEDIA_IS_PIP}])) slot[name=icon] slot:not([name=enter]) {
3106        display: none !important;
3107      }
3108
3109      :host([${J.MEDIA_IS_PIP}]) slot[name=tooltip-enter],
3110      :host(:not([${J.MEDIA_IS_PIP}])) slot[name=tooltip-exit] {
3111        display: none;
3112      }
3113    </style>
3114
3115    <slot name="icon">
3116      <slot name="enter">${yC}</slot>
3117      <slot name="exit">${yC}</slot>
3118    </slot>
3119  `}a(Lfe,"getSlotTemplateHTML$5");function Rfe(){return`
3120    <slot name="tooltip-enter">${Xe("Enter picture in picture mode")}</slot>
3121    <slot name="tooltip-exit">${Xe("Exit picture in picture mode")}</slot>
3122  `}a(Rfe,"getTooltipContentHTML$4");const bC=a(t=>{const e=t.mediaIsPip?Xe("exit picture in picture mode"):Xe("enter picture in picture mode");t.setAttribute("aria-label",e)},"updateAriaLabel$1"),Tx=class Tx extends ai{static get observedAttributes(){return[...super.observedAttributes,J.MEDIA_IS_PIP,J.MEDIA_PIP_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),bC(this)}attributeChangedCallback(e,n,i){super.attributeChangedCallback(e,n,i),e===J.MEDIA_IS_PIP&&bC(this)}get mediaPipUnavailable(){return Mn(this,J.MEDIA_PIP_UNAVAILABLE)}set mediaPipUnavailable(e){Cn(this,J.MEDIA_PIP_UNAVAILABLE,e)}get mediaIsPip(){return Dt(this,J.MEDIA_IS_PIP)}set mediaIsPip(e){Ot(this,J.MEDIA_IS_PIP,e)}handleClick(){const e=this.mediaIsPip?Ve.MEDIA_EXIT_PIP_REQUEST:Ve.MEDIA_ENTER_PIP_REQUEST;this.dispatchEvent(new me.CustomEvent(e,{composed:!0,bubbles:!0}))}};
3122a(Tx,"MediaPipButton");let gh=Tx;gh.getSlotTemplateHTML=Lfe;gh.getTooltipContentHTML=Rfe;me.customElements.get("media-pip-button")||me.customElements.define("media-pip-button",gh);var kfe=a((t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},"__accessCheck$8"),Ic=a((t,e,n)=>(kfe(t,e,"read from private field"),n?n.call(t):e.get(t)),"__privateGet$8"),Mfe=a((t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},"__privateAdd$8"),Ko;const lE={RATES:"rates"},Cfe=[1,1.2,1.5,1.7,2],af=1;function Pfe(t){return`
3123    <style>
3124      :host {
3125        min-width: 5ch;
3126        padding: var(--media-button-padding, var(--media-control-padding, 10px 5px));
3127      }
3128    </style>
3129    <slot name="icon">${t.mediaplaybackrate||af}x</slot>
3130  `}a(Pfe,"getSlotTemplateHTML$4");function Dfe(){return Xe("Playback rate")}a(Dfe,"getTooltipContentHTML$3");const Ax=class Ax extends ai{constructor(){var e;super(),Mfe(this,Ko,new W0(this,lE.RATES,{defaultValue:Cfe})),this.container=this.shadowRoot.querySelector('slot[name="icon"]'),this.container.innerHTML=`${(e=this.mediaPlaybackRate)!=null?e:af}x`}static get observedAttributes(){return[...super.observedAttributes,J.MEDIA_PLAYBACK_RATE,lE.RATES]}attributeChangedCallback(e,n,i){if(super.attributeChangedCallback(e,n,i),e===lE.RATES&&(Ic(this,Ko).value=i),e===J.MEDIA_PLAYBACK_RATE){const s=i?+i:Number.NaN,r=Number.isNaN(s)?af:s;this.container.innerHTML=`${r}x`,this.setAttribute("aria-label",Xe("Playback rate {playbackRate}",{playbackRate:r}))}}get rates(){return Ic(this,Ko)}set rates(e){e?Array.isArray(e)?Ic(this,Ko).value=e.join(" "):typeof e=="string"&&(Ic(this,Ko).value=e):Ic(this,Ko).value=""}get mediaPlaybackRate(){return Rn(this,J.MEDIA_PLAYBACK_RATE,af)}set mediaPlaybackRate(e){si(this,J.MEDIA_PLAYBACK_RATE,e)}handleClick(){var e,n;const i=Array.from(Ic(this,Ko).values(),o=>+o).sort((o,l)=>o-l),s=(n=(e=i.find(o=>o>this.mediaPlaybackRate))!=null?e:i[0])!=null?n:af,r=new me.CustomEvent(Ve.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:s});this.dispatchEvent(r)}};a(Ax,"MediaPlaybackRateButton");let mh=Ax;Ko=new WeakMap;mh.getSlotTemplateHTML=Pfe;mh.getTooltipContentHTML=Dfe;me.customElements.get("media-playback-rate-button")||me.customElements.define("media-playback-rate-button",mh);const Ofe=`<svg aria-hidden="true" viewBox="0 0 24 24">
3131  <path d="m6 21 15-9L6 3v18Z"/>
3132</svg>`,Nfe=`<svg aria-hidden="true" viewBox="0 0 24 24">
3133  <path d="M6 20h4V4H6v16Zm8-16v16h4V4h-4Z"/>
3134</svg>`;function Ffe(t){return`
3135    <style>
3136      :host([${J.MEDIA_PAUSED}]) slot[name=pause],
3137      :host(:not([${J.MEDIA_PAUSED}])) slot[name=play] {
3138        display: none !important;
3139      }
3140
3141      :host([${J.MEDIA_PAUSED}]) slot[name=tooltip-pause],
3142      :host(:not([${J.MEDIA_PAUSED}])) slot[name=tooltip-play] {
3143        display: none;
3144      }
3145    </style>
3146
3147    <slot name="icon">
3148      <slot name="play">${Ofe}</slot>
3149      <slot name="pause">${Nfe}</slot>
3150    </slot>
3151  `}a(Ffe,"getSlotTemplateHTML$3");function Ufe(){return`
3152    <slot name="tooltip-play">${Xe("Play")}</slot>
3153    <slot name="tooltip-pause">${Xe("Pause")}</slot>
3154  `}a(Ufe,"getTooltipContentHTML$2");const EC=a(t=>{const e=t.mediaPaused?Xe("play"):Xe("pause");t.setAttribute("aria-label",e)},"updateAriaLabel"),xx=class xx extends ai{static get observedAttributes(){return[...super.observedAttributes,J.MEDIA_PAUSED,J.MEDIA_ENDED]}connectedCallback(){super.connectedCallback(),EC(this)}attributeChangedCallback(e,n,i){super.attributeChangedCallback(e,n,i),(e===J.MEDIA_PAUSED||e===J.MEDIA_LANG)&&EC(this)}get mediaPaused(){return Dt(this,J.MEDIA_PAUSED)}set mediaPaused(e){Ot(this,J.MEDIA_PAUSED,e)}handleClick(){const e=this.mediaPaused?Ve.MEDIA_PLAY_REQUEST:Ve.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new me.CustomEvent(e,{composed:!0,bubbles:!0}))}};a(xx,"MediaPlayButton");let vh=xx;vh.getSlotTemplateHTML=Ffe;vh.getTooltipContentHTML=Ufe;me.customElements.get("media-play-button")||me.customElements.define("media-play-button",vh);const cr={PLACEHOLDER_SRC:"placeholdersrc",SRC:"src"};function Bfe(t){return`
3155    <style>
3156      :host {
3157        pointer-events: none;
3158        display: var(--media-poster-image-display, inline-block);
3159        box-sizing: border-box;
3160      }
3161
3162      img {
3163        max-width: 100%;
3164        max-height: 100%;
3165        min-width: 100%;
3166        min-height: 100%;
3167        background-repeat: no-repeat;
3168        background-position: var(--media-poster-image-background-position, var(--media-object-position, center));
3169        background-size: var(--media-poster-image-background-size, var(--media-object-fit, contain));
3170        object-fit: var(--media-object-fit, contain);
3171        object-position: var(--media-object-position, center);
3172      }
3173    </style>
3174
3175    <img part="poster img" aria-hidden="true" id="image"/>
3176  `}a(Bfe,"getTemplateHTML$2");const $fe=a(t=>{t.style.removeProperty("background-image")}
3176,"unsetBackgroundImage"),Hfe=a((t,e)=>{t.style["background-image"]=`url('${e}')`},"setBackgroundImage"),Ix=class Ix extends me.HTMLElement{static get observedAttributes(){return[cr.PLACEHOLDER_SRC,cr.SRC]}constructor(){if(super(),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Qs(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}this.image=this.shadowRoot.querySelector("#image")}attributeChangedCallback(e,n,i){e===cr.SRC&&(i==null?this.image.removeAttribute(cr.SRC):this.image.setAttribute(cr.SRC,i)),e===cr.PLACEHOLDER_SRC&&(i==null?$fe(this.image):Hfe(this.image,i))}get placeholderSrc(){return Mn(this,cr.PLACEHOLDER_SRC)}set placeholderSrc(e){Cn(this,cr.SRC,e)}get src(){return Mn(this,cr.SRC)}set src(e){Cn(this,cr.SRC,e)}};a(Ix,"MediaPosterImage");let yh=Ix;yh.shadowRootOptions={mode:"open"};yh.getTemplateHTML=Bfe;me.customElements.get("media-poster-image")||me.customElements.define("media-poster-image",yh);var V$=a((t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},"__accessCheck$7"),Gfe=a((t,e,n)=>(V$(t,e,"read from private field"),n?n.call(t):e.get(t)),"__privateGet$7"),Vfe=a((t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},"__privateAdd$7"),Wfe=a((t,e,n,i)=>(V$(t,e,"write to private field"),i?i.call(t,n):e.set(t,n),n),"__privateSet$7"),Lm;const Lx=class Lx extends $r{constructor(){super(),Vfe(this,Lm,void 0),Wfe(this,Lm,this.shadowRoot.querySelector("slot"))}static get observedAttributes(){return[...super.observedAttributes,J.MEDIA_PREVIEW_CHAPTER,J.MEDIA_LANG]}attributeChangedCallback(e,n,i){if(super.attributeChangedCallback(e,n,i),(e===J.MEDIA_PREVIEW_CHAPTER||e===J.MEDIA_LANG)&&i!==n&&i!=null)if(Gfe(this,Lm).textContent=i,i!==""){const s=Xe("chapter: {chapterName}",{chapterName:i});this.setAttribute("aria-valuetext",s)}else this.removeAttribute("aria-valuetext")}get mediaPreviewChapter(){return Mn(this,J.MEDIA_PREVIEW_CHAPTER)}set mediaPreviewChapter(e){Cn(this,J.MEDIA_PREVIEW_CHAPTER,e)}};a(Lx,"MediaPreviewChapterDisplay");let Cw=Lx;Lm=new WeakMap;me.customElements.get("media-preview-chapter-display")||me.customElements.define("media-preview-chapter-display",Cw);var W$=a((t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},"__accessCheck$6"),Fg=a((t,e,n)=>(W$(t,e,"read from private field"),n?n.call(t):e.get(t)),"__privateGet$6"),zfe=a((t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},"__privateAdd$6"),Ug=a((t,e,n,i)=>(W$(t,e,"write to private field"),i?i.call(t,n):e.set(t,n),n),"__privateSet$6"),yr;function Kfe(t){return`
3177    <style>
3178      :host {
3179        box-sizing: border-box;
3180        display: var(--media-control-display, var(--media-preview-thumbnail-display, inline-block));
3181        overflow: hidden;
3182      }
3183
3184      img {
3185        display: none;
3186        position: relative;
3187      }
3188    </style>
3189    <img crossorigin loading="eager" decoding="async">
3190  `}a(Kfe,"getTemplateHTML$1");const Rx=class Rx extends me.HTMLElement{constructor(){if(super(),zfe(this,yr,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Qs(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[Wt.MEDIA_CONTROLLER,J.MEDIA_PREVIEW_IMAGE,J.MEDIA_PREVIEW_COORDS]}connectedCallback(){var e,n,i;const s=this.getAttribute(Wt.MEDIA_CONTROLLER);s&&(Ug(this,yr,(e=this.getRootNode())==null?void 0:e.getElementById(s)),(i=(n=Fg(this,yr))==null?void 0:n.associateElement)==null||i.call(n,this))}disconnectedCallback(){var e,n;(n=(e=Fg(this,yr))==null?void 0:e.unassociateElement)==null||n.call(e,this),Ug(this,yr,null)}attributeChangedCallback(e,n,i){var s,r,o,l,d;[J.MEDIA_PREVIEW_IMAGE,J.MEDIA_PREVIEW_COORDS].includes(e)&&this.update(),e===Wt.MEDIA_CONTROLLER&&(n&&((r=(s=Fg(this,yr))==null?void 0:s.unassociateElement)==null||r.call(s,this),Ug(this,yr,null)),i&&this.isConnected&&(Ug(this,yr,(o=this.getRootNode())==null?void 0:o.getElementById(i)),(d=(l=Fg(this,yr))==null?void 0:l.associateElement)==null||d.call(l,this)))}get mediaPreviewImage(){return Mn(this,J.MEDIA_PREVIEW_IMAGE)}set mediaPreviewImage(e){Cn(this,J.MEDIA_PREVIEW_IMAGE,e)}get mediaPreviewCoords(){const e=this.getAttribute(J.MEDIA_PREVIEW_COORDS);if(e)return e.split(/\s+/).map(n=>+n)}set mediaPreviewCoords(e){if(!e){this.removeAttribute(J.MEDIA_PREVIEW_COORDS);return}this.setAttribute(J.MEDIA_PREVIEW_COORDS,e.join(" "))}update(){const e=this.mediaPreviewCoords,n=this.mediaPreviewImage;if(!(e&&n))return;
3190const[i,s,r,o]=e,l=n.split("#")[0],d=getComputedStyle(this),{maxWidth:c,maxHeight:u,minWidth:f,minHeight:h}=d,p=Math.min(parseInt(c)/r,parseInt(u)/o),g=Math.max(parseInt(f)/r,parseInt(h)/o),v=p<1,y=v?p:g>1?g:1,{style:b}=Bn(this.shadowRoot,":host"),E=Bn(this.shadowRoot,"img").style,T=this.shadowRoot.querySelector("img"),I=v?"min":"max";b.setProperty(`${I}-width`,"initial","important"),b.setProperty(`${I}-height`,"initial","important"),b.width=`${r*y}px`,b.height=`${o*y}px`;const M=a(()=>{E.width=`${this.imgWidth*y}px`,E.height=`${this.imgHeight*y}px`,E.display="block"},"resize");T.src!==l&&(T.onload=()=>{this.imgWidth=T.naturalWidth,this.imgHeight=T.naturalHeight,M()},T.src=l,M()),M(),E.transform=`translate(-${i*y}px, -${s*y}px)`}};a(Rx,"MediaPreviewThumbnail");let Yd=Rx;yr=new WeakMap;Yd.shadowRootOptions={mode:"open"};Yd.getTemplateHTML=Kfe;me.customElements.get("media-preview-thumbnail")||me.customElements.define("media-preview-thumbnail",Yd);var _C=Yd,z$=a((t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},"__accessCheck$5"),wC=a((t,e,n)=>(z$(t,e,"read from private field"),n?n.call(t):e.get(t)),"__privateGet$5"),qfe=a((t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},"__privateAdd$5"),jfe=a((t,e,n,i)=>(z$(t,e,"write to private field"),i?i.call(t,n):e.set(t,n),n),"__privateSet$5"),lf;const kx=class kx extends $r{constructor(){super(),qfe(this,lf,void 0),jfe(this,lf,this.shadowRoot.querySelector("slot")),wC(this,lf).textContent=Ca(0)}static get observedAttributes(){return[...super.observedAttributes,J.MEDIA_PREVIEW_TIME]}attributeChangedCallback(e,n,i){super.attributeChangedCallback(e,n,i),e===J.MEDIA_PREVIEW_TIME&&i!=null&&(wC(this,lf).textContent=Ca(parseFloat(i)))}get mediaPreviewTime(){return Rn(this,J.MEDIA_PREVIEW_TIME)}set mediaPreviewTime(e){si(this,J.MEDIA_PREVIEW_TIME,e)}};a(kx,"MediaPreviewTimeDisplay");let Pw=kx;lf=new WeakMap;me.customElements.get("media-preview-time-display")||me.customElements.define("media-preview-time-display",Pw);const Lc={SEEK_OFFSET:"seekoffset"},cE=30,Yfe=a(t=>`
3191  <svg aria-hidden="true" viewBox="0 0 20 24">
3192    <defs>
3193      <style>.text{font-size:8px;font-family:Arial-BoldMT, Arial;font-weight:700;}</style>
3194    </defs>
3195    <text class="text value" transform="translate(2.18 19.87)">${t}</text>
3196    <path d="M10 6V3L4.37 7 10 10.94V8a5.54 5.54 0 0 1 1.9 10.48v2.12A7.5 7.5 0 0 0 10 6Z"/>
3197  </svg>`,"backwardIcon");function Zfe(t,e){return`
3198    <slot name="icon">${Yfe(e.seekOffset)}</slot>
3199  `}a(Zfe,"getSlotTemplateHTML$2");function Qfe(){return Xe("Seek backward")}a(Qfe,"getTooltipContentHTML$1");const Jfe=0,Mx=class Mx extends ai{static get observedAttributes(){return[...super.observedAttributes,J.MEDIA_CURRENT_TIME,Lc.SEEK_OFFSET]}connectedCallback(){super.connectedCallback(),this.seekOffset=Rn(this,Lc.SEEK_OFFSET,cE)}attributeChangedCallback(e,n,i){super.attributeChangedCallback(e,n,i),e===Lc.SEEK_OFFSET&&(this.seekOffset=Rn(this,Lc.SEEK_OFFSET,cE))}get seekOffset(){return Rn(this,Lc.SEEK_OFFSET,cE)}set seekOffset(e){si(this,Lc.SEEK_OFFSET,e),this.setAttribute("aria-label",Xe("seek back {seekOffset} seconds",{seekOffset:this.seekOffset})),s$(r$(this,"icon"),this.seekOffset)}get mediaCurrentTime(){return Rn(this,J.MEDIA_CURRENT_TIME,Jfe)}set mediaCurrentTime(e){si(this,J.MEDIA_CURRENT_TIME,e)}handleClick(){const e=Math.max(this.mediaCurrentTime-this.seekOffset,0),n=new me.CustomEvent(Ve.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(n)}};a(Mx,"MediaSeekBackwardButton");let bh=Mx;bh.getSlotTemplateHTML=Zfe;bh.getTooltipContentHTML=Qfe;me.customElements.get("media-seek-backward-button")||me.customElements.define("media-seek-backward-button",bh);const Rc={SEEK_OFFSET:"seekoffset"},dE=30,Xfe=a(t=>`
3200  <svg aria-hidden="true" viewBox="0 0 20 24">
3201    <defs>
3202      <style>.text{font-size:8px;font-family:Arial-BoldMT, Arial;font-weight:700;}</style>
3203    </defs>
3204    <text class="text value" transform="translate(8.9 19.87)">${t}</text>
3205    <path d="M10 6V3l5.61 4L10 10.94V8a5.54 5.54 0 0 0-1.9 10.48v2.12A7.5 7.5 0 0 1 10 6Z"/>
3206  </svg>`,"forwardIcon");function ehe(t,e){return`
3207    <slot name="icon">${Xfe(e.seekOffset)}</slot>
3208  `}a(ehe,"getSlotTemplateHTML$1");function the(){return Xe("Seek forward")}a(the,"getTooltipContentHTML");const nhe=0,Cx=class Cx extends ai{static get observedAttributes(){return[...super.observedAttributes,J.MEDIA_CURRENT_TIME,Rc.SEEK_OFFSET]}connectedCallback(){super.connectedCallback(),this.seekOffset=Rn(this,Rc.SEEK_OFFSET,dE)}attributeChangedCallback(e,n,i){super.attributeChangedCallback(e,n,i),e===Rc.SEEK_OFFSET&&(this.seekOffset=Rn(this,Rc.SEEK_OFFSET,dE))}get seekOffset(){return Rn(this,Rc.SEEK_OFFSET,dE)}set seekOffset(e){si(this,Rc.SEEK_OFFSET,e),this.setAttribute("aria-label",Xe("seek forward {seekOffset} seconds",{seekOffset:this.seekOffset})),s$(r$(this,"icon"),this.seekOffset)}get mediaCurrentTime(){return Rn(this,J.MEDIA_CURRENT_TIME,nhe)}set mediaCurrentTime(e){si(this,J.MEDIA_CURRENT_TIME,e)}handleClick(){const e=this.mediaCurrentTime+this.seekOffset,n=new me.CustomEvent(Ve.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(n)}};a(Cx,"MediaSeekForwardButton");let Eh=Cx;Eh.getSlotTemplateHTML=ehe;Eh.getTooltipContentHTML=the;me.customElements.get("media-seek-forward-button")||me.customElements.define("media-seek-forward-button",Eh);var K$=a((t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},"__accessCheck$4"),uE=a((t,e,n)=>(K$(t,e,"read from private field"),n?n.call(t):e.get(t)),"__privateGet$4"),ihe=a((t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},"__privateAdd$4"),she=a((t,e,n,i)=>(K$(t,e,"write to private field"),i?i.call(t,n):e.set(t,n),n),"__privateSet$4"),$c;const nl={REMAINING:"remaining",SHOW_DURATION:"showduration",NO_TOGGLE:"notoggle"},SC=[...Object.values(nl),J.MEDIA_CURRENT_TIME,J.MEDIA_DURATION,J.MEDIA_SEEKABLE],TC=["Enter"," "],rhe="&nbsp;/&nbsp;",Dw=a((t,{timesSep:e=rhe}={})=>{var n,i;const s=(n=t.mediaCurrentTime)!=null?n:0,[,r]=(i=t.mediaSeekable)!=null?i:[];let o=0;Number.isFinite(t.mediaDuration)?o=t.mediaDuration:Number.isFinite(r)&&(o=r);const l=t.remaining?Ca(0-(o-s)):Ca(s);return t.showDuration?`${l}${e}${Ca(o)}`:l},"formatTimesLabel"),ohe="video not loaded, unknown time.",ahe=a(t=>{var e;const n=t.mediaCurrentTime,[,i]=(e=t.mediaSeekable)!=null?e:[];let s=null;if(Number.isFinite(t.mediaDuration)?s=t.mediaDuration:Number.isFinite(i)&&(s=i),n==null||s===null){t.setAttribute("aria-valuetext",ohe);return}const r=t.remaining?wf(0-(s-n)):wf(n);if(!t.showDuration){t.setAttribute("aria-valuetext",r);return}const o=wf(s),l=`${r} of ${o}`;t.setAttribute("aria-valuetext",l)},"updateAriaValueText$1");function lhe(t,e){return`
3209    <slot>${Dw(e)}</slot>
3210  `}a(lhe,"getSlotTemplateHTML");const Px=class Px extends $r{constructor(){super(),ihe(this,$c,void 0),she(this,$c,this.shadowRoot.querySelector("slot")),uE(this,$c).innerHTML=`${Dw(this)}`}static get observedAttributes(){return[...super.observedAttributes,...SC,"disabled"]}connectedCallback(){const{style:e}=Bn(this.shadowRoot,":host(:hover:not([notoggle]))");e.setProperty("cursor","var(--media-cursor, pointer)"),e.setProperty("background","var(--media-control-hover-background, rgba(50 50 70 / .7))"),this.hasAttribute("disabled")||this.enable(),this.setAttribute("role","progressbar"),this.setAttribute("aria-label",Xe("playback time"));const n=a(i=>{const{key:s}=i;
3210if(!TC.includes(s)){this.removeEventListener("keyup",n);return}this.toggleTimeDisplay()},"keyUpHandler");this.addEventListener("keydown",i=>{const{metaKey:s,altKey:r,key:o}=i;if(s||r||!TC.includes(o)){this.removeEventListener("keyup",n);return}this.addEventListener("keyup",n)}),this.addEventListener("click",this.toggleTimeDisplay),super.connectedCallback()}toggleTimeDisplay(){this.noToggle||(this.hasAttribute("remaining")?this.removeAttribute("remaining"):this.setAttribute("remaining",""))}disconnectedCallback(){this.disable(),super.disconnectedCallback()}attributeChangedCallback(e,n,i){SC.includes(e)?this.update():e==="disabled"&&i!==n&&(i==null?this.enable():this.disable()),super.attributeChangedCallback(e,n,i)}enable(){this.tabIndex=0}disable(){this.tabIndex=-1}get remaining(){return Dt(this,nl.REMAINING)}set remaining(e){Ot(this,nl.REMAINING,e)}get showDuration(){return Dt(this,nl.SHOW_DURATION)}set showDuration(e){Ot(this,nl.SHOW_DURATION,e)}get noToggle(){return Dt(this,nl.NO_TOGGLE)}set noToggle(e){Ot(this,nl.NO_TOGGLE,e)}get mediaDuration(){return Rn(this,J.MEDIA_DURATION)}set mediaDuration(e){si(this,J.MEDIA_DURATION,e)}get mediaCurrentTime(){return Rn(this,J.MEDIA_CURRENT_TIME)}set mediaCurrentTime(e){si(this,J.MEDIA_CURRENT_TIME,e)}get mediaSeekable(){const e=this.getAttribute(J.MEDIA_SEEKABLE);if(e)return e.split(":").map(n=>+n)}set mediaSeekable(e){if(e==null){this.removeAttribute(J.MEDIA_SEEKABLE);return}this.setAttribute(J.MEDIA_SEEKABLE,e.join(":"))}update(){const e=Dw(this);ahe(this),e!==uE(this,$c).innerHTML&&(uE(this,$c).innerHTML=e)}};a(Px,"MediaTimeDisplay");let J0=Px;$c=new WeakMap;J0.getSlotTemplateHTML=lhe;me.customElements.get("media-time-display")||me.customElements.define("media-time-display",J0);var q$=a((t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},"__accessCheck$3"),Jn=a((t,e,n)=>(q$(t,e,"read from private field"),n?n.call(t):e.get(t)),"__privateGet$3"),dr=a((t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},"__privateAdd$3"),as=a((t,e,n,i)=>(q$(t,e,"write to private field"),i?i.call(t,n):e.set(t,n),n),"__privateSet$3"),che=a((t,e,n,i)=>({set _(s){as(t,e,s,n)},get _(){return Jn(t,e,i)}}),"__privateWrapper"),Hc,Rm,Gc,cf,km,Mm,Cm,Vc,il,Pm;const Dx=class Dx{constructor(e,n,i){dr(this,Hc,void 0),dr(this,Rm,void 0),dr(this,Gc,void 0),dr(this,cf,void 0),dr(this,km,void 0),dr(this,Mm,void 0),dr(this,Cm,void 0),dr(this,Vc,void 0),dr(this,il,0),dr(this,Pm,(s=performance.now())=>{as(this,il,requestAnimationFrame(Jn(this,Pm))),as(this,cf,performance.now()-Jn(this,Gc));const r=1e3/this.fps;if(Jn(this,cf)>r){as(this,Gc,s-Jn(this,cf)%r);const o=1e3/((s-Jn(this,Rm))/++che(this,km)._),l=(s-Jn(this,Mm))/1e3/this.duration;let d=Jn(this,Cm)+l*this.playbackRate;d-Jn(this,Hc).valueAsNumber>0?as(this,Vc,this.playbackRate/this.duration/o):(as(this,Vc,.995*Jn(this,Vc)),d=Jn(this,Hc).valueAsNumber+Jn(this,Vc)),this.callback(d)}}),as(this,Hc,e),this.callback=n,this.fps=i}start(){Jn(this,il)===0&&(as(this,Gc,performance.now()),as(this,Rm,Jn(this,Gc)),as(this,km,0),Jn(this,Pm).call(this))}stop(){Jn(this,il)!==0&&(cancelAnimationFrame(Jn(this,il)),as(this,il,0))}update({start:e,duration:n,playbackRate:i}){const s=e-Jn(this,Hc).valueAsNumber,r=Math.abs(n-this.duration);(s>0||s<-.03||r>=.5)&&this.callback(e),as(this,Cm,e),as(this,Mm,performance.now()),this.duration=n,this.playbackRate=i}};a(Dx,"RangeAnimation");let Ow=Dx;Hc=new WeakMap;Rm=new WeakMap;Gc=new WeakMap;cf=new WeakMap;km=new WeakMap;Mm=new WeakMap;Cm=new WeakMap;Vc=new WeakMap;il=new WeakMap;Pm=new WeakMap;var TA=a((t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},"__accessCheck$2"),zn=a((t,e,n)=>(TA(t,e,"read from private field"),n?n.call(t):e.get(t)),"__privateGet$2"),Yn=a((t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},"__privateAdd$2"),br=a((t,e,n,i)=>(TA(t,e,"write to private field"),i?i.call(t,n):e.set(t,n),n),"__privateSet$2"),_i=a((t,e,n)=>(TA(t,e,"access private method"),n),"__privateMethod$1"),Wc,Dl,X0,Af,ev,Dm,_h,wh,zc,Kc,df,AA,j$,Nw,tv,xA,nv,IA,iv,LA,Fw,Y$,Sh,sv,Uw,Z$;const dhe="video not loaded, unknown time.",uhe=a(t=>{const e=t.range,n=wf(+Q$(t)),i=wf(+t.mediaSeekableEnd),s=n&&i?`${n} of ${i}`:dhe;e.setAttribute("aria-valuetext",s)},"updateAriaValueText");function fhe(t){return`
3211    ${Fa.getTemplateHTML(t)}
3212    <style>
3213      :host {
3214        --media-box-border-radius: 4px;
3215        --media-box-padding-left: 10px;
3216        --media-box-padding-right: 10px;
3217        --media-preview-border-radius: var(--media-box-border-radius);
3218        --media-box-arrow-offset: var(--media-box-border-radius);
3219        --_control-background: var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7)));
3220        --_preview-background: var(--media-preview-background, var(--_control-background));
3221
3222        
3223        contain: layout;
3224      }
3225
3226      #buffered {
3227        background: var(--media-time-range-buffered-color, rgb(255 255 255 / .4));
3228        position: absolute;
3229        height: 100%;
3230        will-change: width;
3231      }
3232
3233      #preview-rail,
3234      #current-rail {
3235        width: 100%;
3236        position: absolute;
3237        left: 0;
3238        bottom: 100%;
3239        pointer-events: none;
3240        will-change: transform;
3241      }
3242
3243      [part~="box"] {
3244        width: min-content;
3245        
3246        position: absolute;
3247        bottom: 100%;
3248        flex-direction: column;
3249        align-items: center;
3250        transform: translateX(-50%);
3251      }
3252
3253      [part~="current-box"] {
3254        display: var(--media-current-box-display, var(--media-box-display, flex));
3255        margin: var(--media-current-box-margin, var(--media-box-margin, 0 0 5px));
3256        visibility: hidden;
3257      }
3258
3259      [part~="preview-box"] {
3260        display: var(--media-preview-box-display, var(--media-box-display, flex));
3261        margin: var(--media-preview-box-margin, var(--media-box-margin, 0 0 5px));
3262        transition-property: var(--media-preview-transition-property, visibility, opacity);
3263        transition-duration: var(--media-preview-transition-duration-out, .25s);
3264        transition-delay: var(--media-preview-transition-delay-out, 0s);
3265        visibility: hidden;
3266        opacity: 0;
3267      }
3268
3269      :host(:is([${J.MEDIA_PREVIEW_IMAGE}], [${J.MEDIA_PREVIEW_TIME}])[dragging]) [part~="preview-box"] {
3270        transition-duration: var(--media-preview-transition-duration-in, .5s);
3271        transition-delay: var(--media-preview-transition-delay-in, .25s);
3272        visibility: visible;
3273        opacity: 1;
3274      }
3275
3276      @media (hover: hover) {
3277        :host(:is([${J.MEDIA_PREVIEW_IMAGE}], [${J.MEDIA_PREVIEW_TIME}]):hover) [part~="preview-box"] {
3278          transition-duration: var(--media-preview-transition-duration-in, .5s);
3279          transition-delay: var(--media-preview-transition-delay-in, .25s);
3280          visibility: visible;
3281          opacity: 1;
3282        }
3283      }
3284
3285      media-preview-thumbnail,
3286      ::slotted(media-preview-thumbnail) {
3287        visibility: hidden;
3288        
3289        transition: visibility 0s .25s;
3290        transition-delay: calc(var(--media-preview-transition-delay-out, 0s) + var(--media-preview-transition-duration-out, .25s));
3291        background: var(--media-preview-thumbnail-background, var(--_preview-background));
3292        box-shadow: var(--media-preview-thumbnail-box-shadow, 0 0 4px rgb(0 0 0 / .2));
3293        max-width: var(--media-preview-thumbnail-max-width, 180px);
3294        max-height: var(--media-preview-thumbnail-max-height, 160px);
3295        min-width: var(--media-preview-thumbnail-min-width, 120px);
3296        min-height: var(--media-preview-thumbnail-min-height, 80px);
3297        border: var(--media-preview-thumbnail-border);
3298        border-radius: var(--media-preview-thumbnail-border-radius,
3299          var(--media-preview-border-radius) var(--media-preview-border-radius) 0 0);
3300      }
3301
3302      :host([${J.MEDIA_PREVIEW_IMAGE}][dragging]) media-preview-thumbnail,
3303      :host([${J.MEDIA_PREVIEW_IMAGE}][dragging]) ::slotted(media-preview-thumbnail) {
3304        transition-delay: var(--media-preview-transition-delay-in, .25s);
3305        visibility: visible;
3306      }
3307
3308      @media (hover: hover) {
3309        :host([${J.MEDIA_PREVIEW_IMAGE}]:hover) media-preview-thumbnail,
3310        :host([${J.MEDIA_PREVIEW_IMAGE}]:hover) ::slotted(media-preview-thumbnail) {
3311          transition-delay: var(--media-preview-transition-delay-in, .25s);
3312          visibility: visible;
3313        }
3314
3315        :host([${J.MEDIA_PREVIEW_TIME}]:hover) {
3316          --media-time-range-hover-display: block;
3317        }
3318      }
3319
3320      media-preview-chapter-display,
3321      ::slotted(media-preview-chapter-display) {
3322        font-size: var(--media-font-size, 13px);
3323        line-height: 17px;
3324        min-width: 0;
3325        visibility: hidden;
3326        
3327        transition: min-width 0s, border-radius 0s, margin 0s, padding 0s, visibility 0s;
3328        transition-delay: calc(var(--media-preview-transition-delay-out, 0s) + var(--media-preview-transition-duration-out, .25s));
3329        background: var(--media-preview-chapter-background, var(--_preview-background));
3330        border-radius: var(--media-preview-chapter-border-radius,
3331          var(--media-preview-border-radius) var(--media-preview-border-radius)
3332          var(--media-preview-border-radius) var(--media-preview-border-radius));
3333        padding: var(--media-preview-chapter-padding, 3.5px 9px);
3334        margin: var(--media-preview-chapter-margin, 0 0 5px);
3335        text-shadow: var(--media-preview-chapter-text-shadow, 0 0 4px rgb(0 0 0 / .75));
3336      }
3337
3338      :host([${J.MEDIA_PREVIEW_IMAGE}]) media-preview-chapter-display,
3339      :host([${J.MEDIA_PREVIEW_IMAGE}]) ::slotted(media-preview-chapter-display) {
3340        transition-delay: var(--media-preview-transition-delay-in, .25s);
3341        border-radius: var(--media-preview-chapter-border-radius, 0);
3342        padding: var(--media-preview-chapter-padding, 3.5px 9px 0);
3343        margin: var(--media-preview-chapter-margin, 0);
3344        min-width: 100%;
3345      }
3346
3347      media-preview-chapter-display[${J.MEDIA_PREVIEW_CHAPTER}],
3348      ::slotted(media-preview-chapter-display[${J.MEDIA_PREVIEW_CHAPTER}]) {
3349        visibility: visible;
3350      }
3351
3352      media-preview-chapter-display:not([aria-valuetext]),
3353      ::slotted(media-preview-chapter-display:not([aria-valuetext])) {
3354        display: none;
3355      }
3356
3357      media-preview-time-display,
3358      ::slotted(media-preview-time-display),
3359      media-time-display,
3360      ::slotted(media-time-display) {
3361        font-size: var(--media-font-size, 13px);
3362        line-height: 17px;
3363        min-width: 0;
3364        
3365        transition: min-width 0s, border-radius 0s;
3366        transition-delay: calc(var(--media-preview-transition-delay-out, 0s) + var(--media-preview-transition-duration-out, .25s));
3367        background: var(--media-preview-time-background, var(--_preview-background));
3368        border-radius: var(--media-preview-time-border-radius,
3369          var(--media-preview-border-radius) var(--media-preview-border-radius)
3370          var(--media-preview-border-radius) var(--media-preview-border-radius));
3371        padding: var(--media-preview-time-padding, 3.5px 9px);
3372        margin: var(--media-preview-time-margin, 0);
3373        text-shadow: var(--media-preview-time-text-shadow, 0 0 4px rgb(0 0 0 / .75));
3374        transform: translateX(min(
3375          max(calc(50% - var(--_box-width) / 2),
3376          calc(var(--_box-shift, 0))),
3377          calc(var(--_box-width) / 2 - 50%)
3378        ));
3379      }
3380
3381      :host([${J.MEDIA_PREVIEW_IMAGE}]) media-preview-time-display,
3382      :host([${J.MEDIA_PREVIEW_IMAGE}]) ::slotted(media-preview-time-display) {
3383        transition-delay: var(--media-preview-transition-delay-in, .25s);
3384        border-radius: var(--media-preview-time-border-radius,
3385          0 0 var(--media-preview-border-radius) var(--media-preview-border-radius));
3386        min-width: 100%;
3387      }
3388
3389      :host([${J.MEDIA_PREVIEW_TIME}]:hover) {
3390        --media-time-range-hover-display: block;
3391      }
3392
3393      [part~="arrow"],
3394      ::slotted([part~="arrow"]) {
3395        display: var(--media-box-arrow-display, inline-block);
3396        transform: translateX(min(
3397          max(calc(50% - var(--_box-width) / 2 + var(--media-box-arrow-offset)),
3398          calc(var(--_box-shift, 0))),
3399          calc(var(--_box-width) / 2 - 50% - var(--media-box-arrow-offset))
3400        ));
3401        
3402        border-color: transparent;
3403        border-top-color: var(--media-box-arrow-background, var(--_control-background));
3404        border-width: var(--media-box-arrow-border-width,
3405          var(--media-box-arrow-height, 5px) var(--media-box-arrow-width, 6px) 0);
3406        border-style: solid;
3407        justify-content: center;
3408        height: 0;
3409      }
3410    </style>
3411    <div id="preview-rail">
3412      <slot name="preview" part="box preview-box">
3413        <media-preview-thumbnail>
3414          <template shadowrootmode="${_C.shadowRootOptions.mode}">
3415            ${_C.getTemplateHTML({})}
3416          </template>
3417        </media-preview-thumbnail>
3418        <media-preview-chapter-display></media-preview-chapter-display>
3419        <media-preview-time-display></media-preview-time-display>
3420        <slot name="preview-arrow"><div part="arrow"></div></slot>
3421      </slot>
3422    </div>
3423    <div id="current-rail">
3424      <slot name="current" part="box current-box">
3425        
3426      </slot>
3427    </div>
3428  `}a(fhe,"getTemplateHTML");const Bg=a((t,e=t.mediaCurrentTime)=>{const n=Number.isFinite(t.mediaSeekableStart)?t.mediaSeekableStart:0,i=Number.isFinite(t.mediaDuration)?t.mediaDuration:t.mediaSeekableEnd;if(Number.isNaN(i))return 0;const s=(e-n)/(i-n);return Math.max(0,Math.min(s,1))},"calcRangeValueFromTime"),Q$=a((t,e=t.range.valueAsNumber)=>{const n=Number.isFinite(t.mediaSeekableStart)?t.mediaSeekableStart:0,i=Number.isFinite(t.mediaDuration)?t.mediaDuration:t.mediaSeekableEnd;return Number.isNaN(i)?0:e*(i-n)+n},"calcTimeFromRangeValue"),Ox=class Ox extends Fa{constructor(){super(),Yn(this,Kc),Yn(this,AA),Yn(this,tv),Yn(this,nv),Yn(this,iv),Yn(this,Fw),Yn(this,Sh),Yn(this,Uw),Yn(this,Wc,void 0),Yn(this,Dl,void 0),Yn(this,X0,void 0),Yn(this,Af,void 0),Yn(this,ev,void 0),Yn(this,Dm,void 0),Yn(this,_h,void 0),Yn(this,wh,void 0),Yn(this,zc,void 0),Yn(this,Nw,i=>{this.dragging||(uA(i)&&(this.range.valueAsNumber=i),this.updateBar())}),this.shadowRoot.querySelector("#track").insertAdjacentHTML("afterbegin",'<div id="buffered" part="buffered"></div>'),br(this,X0,this.shadowRoot.querySelectorAll('[part~="box"]')),br(this,ev,this.shadowRoot.querySelector('[part~="preview-box"]')),br(this,Dm,this.shadowRoot.querySelector('[part~="current-box"]'));const n=getComputedStyle(this);br(this,_h,parseInt(n.getPropertyValue("--media-box-padding-left"))),br(this,wh,parseInt(n.getPropertyValue("--media-box-padding-right"))),br(this,Dl,new Ow(this.range,zn(this,Nw),60))}static get observedAttributes(){return[...super.observedAttributes,J.MEDIA_PAUSED,J.MEDIA_DURATION,J.MEDIA_SEEKABLE,J.MEDIA_CURRENT_TIME,J.MEDIA_PREVIEW_IMAGE,J.MEDIA_PREVIEW_TIME,J.MEDIA_PREVIEW_CHAPTER,J.MEDIA_BUFFERED,J.MEDIA_PLAYBACK_RATE,J.MEDIA_LOADING,J.MEDIA_ENDED]}connectedCallback(){var e;super.connectedCallback(),this.range.setAttribute("aria-label",Xe("seek")),_i(this,Kc,df).call(this),br(this,Wc,this.getRootNode()),(e=zn(this,Wc))==null||e.addEventListener("transitionstart",this)}disconnectedCallback(){var e;super.disconnectedCallback(),_i(this,Kc,df).call(this),(e=zn(this,Wc))==null||e.removeEventListener("transitionstart",this),br(this,Wc,null)}attributeChangedCallback(e,n,i){super.attributeChangedCallback(e,n,i),n!=i&&(e===J.MEDIA_CURRENT_TIME||e===J.MEDIA_PAUSED||e===J.MEDIA_ENDED||e===J.MEDIA_LOADING||e===J.MEDIA_DURATION||e===J.MEDIA_SEEKABLE?(zn(this,Dl).update({start:Bg(this),duration:this.mediaSeekableEnd-this.mediaSeekableStart,playbackRate:this.mediaPlaybackRate}),_i(this,Kc,df).call(this),uhe(this)):e===J.MEDIA_BUFFERED&&this.updateBufferedBar(),(e===J.MEDIA_DURATION||e===J.MEDIA_SEEKABLE)&&(this.mediaChaptersCues=zn(this,zc),this.updateBar()))}get mediaChaptersCues(){return zn(this,zc)}set mediaChaptersCues(e){var n;br(this,zc,e),this.updateSegments((n=zn(this,zc))==null?void 0:n.map(i=>({start:Bg(this,i.startTime),end:Bg(this,i.endTime)})))}get mediaPaused(){return Dt(this,J.MEDIA_PAUSED)}set mediaPaused(e){Ot(this,J.MEDIA_PAUSED,e)}get mediaLoading(){return Dt(this,J.MEDIA_LOADING)}set mediaLoading(e){Ot(this,J.MEDIA_LOADING,e)}get mediaDuration(){return Rn(this,J.MEDIA_DURATION)}set mediaDuration(e){si(this,J.MEDIA_DURATION,e)}get mediaCurrentTime(){return Rn(this,J.MEDIA_CURRENT_TIME)}set mediaCurrentTime(e){si(this,J.MEDIA_CURRENT_TIME,e)}get mediaPlaybackRate(){return Rn(this,J.MEDIA_PLAYBACK_RATE,1)}set mediaPlaybackRate(e){si(this,J.MEDIA_PLAYBACK_RATE,e)}get mediaBuffered(){const e=this.getAttribute(J.MEDIA_BUFFERED);return e?e.split(" ").map(n=>n.split(":").map(i=>+i)):[]}set mediaBuffered(e){if(!e){this.removeAttribute(J.MEDIA_BUFFERED);return}const n=e.map(i=>i.join(":")).join(" ");this.setAttribute(J.MEDIA_BUFFERED,n)}get mediaSeekable(){const e=this.getAttribute(J.MEDIA_SEEKABLE);if(e)return e.split(":").map(n=>+n)}set mediaSeekable(e){if(e==null){this.removeAttribute(J.MEDIA_SEEKABLE);return}this.setAttribute(J.MEDIA_SEEKABLE,e.join(":"))}get mediaSeekableEnd(){var e;const[,n=this.mediaDuration]=(e=this.mediaSeekable)!=null?e:[];return n}get mediaSeekableStart(){var e;const[n=0]=(e=this.mediaSeekable)!=null?e:[];return n}get mediaPreviewImage(){return Mn(this,J.MEDIA_PREVIEW_IMAGE)}set mediaPreviewImage(e){Cn(this,J.MEDIA_PREVIEW_IMAGE,e)}get mediaPreviewTime(){return Rn(this,J.MEDIA_PREVIEW_TIME)}set mediaPreviewTime(e){si(this,J.MEDIA_PREVIEW_TIME,e)}get mediaEnded(){return Dt(this,J.MEDIA_ENDED)}set mediaEnded(e){Ot(this,J.MEDIA_ENDED,e)}updateBar(){super.updateBar(),this.updateBufferedBar(),this.updateCurrentBox()}updateBufferedBar(){var e;const n=this.mediaBuffered;if(!n.length)return;let i;if(this.mediaEnded)i=1;else{const r=this.mediaCurrentTime,[,o=this.mediaSeekableStart]=(e=n.find(([l,d])=>l<=r&&r<=d))!=null?e:[];i=Bg(this,o)}const{style:s}=Bn(this.shadowRoot,"#buffered");s.setProperty("width",`${i*100}%`)}updateCurrentBox(){if(!this.shadowRoot.querySelector('slot[name="current"]').assignedElements().length)return;const n=Bn(this.shadowRoot,"#current-rail"),i=Bn(this.shadowRoot,'[part~="current-box"]'),s=_i(this,tv,xA).call(this,zn(this,Dm)),r=_i(this,nv,IA).call(this,s,this.range.valueAsNumber),o=_i(this,iv,LA).call(this,s,this.range.valueAsNumber);n.style.transform=`translateX(${r})`,n.style.setProperty("--_range-width",`${s.range.width}`),i.style.setProperty("--_box-shift",`${o}`),i.style.setProperty("--_box-width",`${s.box.width}px`),i.style.setProperty("visibility","initial")}handleEvent(e){switch(super.handleEvent(e),e.type){case"input":_i(this,Uw,Z$).call(this);break;case"pointermove":_i(this,Fw,Y$).call(this,e);break;case"pointerup":case"pointerleave":_i(this,Sh,sv).call(this,null);break;case"transitionstart":vu(e.target,this)&&setTimeout(()=>
3428_i(this,Kc,df).call(this),0);break}}};a(Ox,"MediaTimeRange");let Th=Ox;Wc=new WeakMap;Dl=new WeakMap;X0=new WeakMap;Af=new WeakMap;ev=new WeakMap;Dm=new WeakMap;_h=new WeakMap;wh=new WeakMap;zc=new WeakMap;Kc=new WeakSet;df=a(function(){_i(this,AA,j$).call(this)?zn(this,Dl).start():zn(this,Dl).stop()},"toggleRangeAnimation_fn");AA=new WeakSet;j$=a(function(){return this.isConnected&&!this.mediaPaused&&!this.mediaLoading&&!this.mediaEnded&&this.mediaSeekableEnd>0&&a$(this)},"shouldRangeAnimate_fn");Nw=new WeakMap;tv=new WeakSet;xA=a(function(t){var e;const i=((e=this.getAttribute("bounds")?zp(this,`#${this.getAttribute("bounds")}`):this.parentElement)!=null?e:this).getBoundingClientRect(),s=this.range.getBoundingClientRect(),r=t.offsetWidth,o=-(s.left-i.left-r/2),l=i.right-s.left-r/2;return{box:{width:r,min:o,max:l},bounds:i,range:s}},"getElementRects_fn");nv=new WeakSet;IA=a(function(t,e){let n=`${e*100}%`;const{width:i,min:s,max:r}=t.box;if(!i)return n;if(Number.isNaN(s)||(n=`max(${`calc(1 / var(--_range-width) * 100 * ${s}% + var(--media-box-padding-left))`}, ${n})`),!Number.isNaN(r)){const l=`calc(1 / var(--_range-width) * 100 * ${r}% - var(--media-box-padding-right))`;n=`min(${n}, ${l})`}return n},"getBoxPosition_fn");iv=new WeakSet;LA=a(function(t,e){const{width:n,min:i,max:s}=t.box,r=e*t.range.width;if(r<i+zn(this,_h)){const o=t.range.left-t.bounds.left-zn(this,_h);return`${r-n/2+o}px`}if(r>s-zn(this,wh)){const o=t.bounds.right-t.range.right-zn(this,wh);return`${r+n/2-o-t.range.width}px`}return 0},"getBoxShiftPosition_fn");Fw=new WeakSet;Y$=a(function(t){const e=[...zn(this,X0)].some(u=>t.composedPath().includes(u));if(!this.dragging&&(e||!t.composedPath().includes(this))){_i(this,Sh,sv).call(this,null);return}const n=this.mediaSeekableEnd;if(!n)return;const i=Bn(this.shadowRoot,"#preview-rail"),s=Bn(this.shadowRoot,'[part~="preview-box"]'),r=_i(this,tv,xA).call(this,zn(this,ev));let o=(t.clientX-r.range.left)/r.range.width;o=Math.max(0,Math.min(1,o));const l=_i(this,nv,IA).call(this,r,o),d=_i(this,iv,LA).call(this,r,o);i.style.transform=`translateX(${l})`,i.style.setProperty("--_range-width",`${r.range.width}`),s.style.setProperty("--_box-shift",`${d}`),s.style.setProperty("--_box-width",`${r.box.width}px`);const c=Math.round(zn(this,Af))-Math.round(o*n);Math.abs(c)<1&&o>.01&&o<.99||(br(this,Af,o*n),_i(this,Sh,sv).call(this,zn(this,Af)))},"handlePointerMove_fn");Sh=new WeakSet;sv=a(function(t){this.dispatchEvent(new me.CustomEvent(Ve.MEDIA_PREVIEW_REQUEST,{composed:!0,bubbles:!0,detail:t}))},"previewRequest_fn");Uw=new WeakSet;Z$=a(function(){zn(this,Dl).stop();const t=Q$(this);this.dispatchEvent(new me.CustomEvent(Ve.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:t}))},"seekRequest_fn");Th.shadowRootOptions={mode:"open"};Th.getTemplateHTML=fhe;me.customElements.get("media-time-range")||me.customElements.define("media-time-range",Th);const hhe=1,phe=a(t=>t.mediaMuted?0:t.mediaVolume,"toVolume"),ghe=a(t=>`${Math.round(t*100)}%`,"formatAsPercentString"),Nx=class Nx extends Fa{static get observedAttributes(){return[...super.observedAttributes,J.MEDIA_VOLUME,J.MEDIA_MUTED,J.MEDIA_VOLUME_UNAVAILABLE]}constructor(){super(),this.range.addEventListener("input",()=>{const e=this.range.value,n=new me.CustomEvent(Ve.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(n)})}connectedCallback(){super.connectedCallback(),this.range.setAttribute("aria-label",Xe("volume"))}attributeChangedCallback(e,n,i){super.attributeChangedCallback(e,n,i),(e===J.MEDIA_VOLUME||e===J.MEDIA_MUTED)&&(this.range.valueAsNumber=phe(this),this.range.setAttribute("aria-valuetext",ghe(this.range.valueAsNumber)),this.updateBar())}get mediaVolume(){return Rn(this,J.MEDIA_VOLUME,hhe)}set mediaVolume(e){si(this,J.MEDIA_VOLUME,e)}get mediaMuted(){return Dt(this,J.MEDIA_MUTED)}set mediaMuted(e){Ot(this,J.MEDIA_MUTED,e)}get mediaVolumeUnavailable(){return Mn(this,J.MEDIA_VOLUME_UNAVAILABLE)}set mediaVolumeUnavailable(e){Cn(this,J.MEDIA_VOLUME_UNAVAILABLE,e)}};a(Nx,"MediaVolumeRange");let Bw=Nx;me.customElements.get("media-volume-range")||me.customElements.define("media-volume-range",Bw);
3428var J$=a((t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},"__accessCheck$1"),bt=a((t,e,n)=>(J$(t,e,"read from private field"),n?n.call(t):e.get(t)),"__privateGet$1"),xr=a((t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},"__privateAdd$1"),go=a((t,e,n,i)=>(J$(t,e,"write to private field"),i?i.call(t,n):e.set(t,n),n),"__privateSet$1"),qc,Om,sl,uf,qo,jo,Yo,rl,jc,Nm,Us;const AC=1,xC=0,mhe=1,vhe={processCallback(t,e,n){if(n){for(const[i,s]of e)if(i in n){const r=n[i];typeof r=="boolean"&&s instanceof yo&&typeof s.element[s.attributeName]=="boolean"?s.booleanValue=r:typeof r=="function"&&s instanceof yo?s.element[s.attributeName]=r:s.value=r}}}},Fx=class Fx extends me.DocumentFragment{constructor(e,n,i=vhe){var s;super(),xr(this,qc,void 0),xr(this,Om,void 0),this.append(e.content.cloneNode(!0)),go(this,qc,X$(this)),go(this,Om,i),(s=i.createCallback)==null||s.call(i,this,bt(this,qc),n),i.processCallback(this,bt(this,qc),n)}update(e){bt(this,Om).processCallback(this,bt(this,qc),e)}};a(Fx,"TemplateInstance");let Ah=Fx;qc=new WeakMap;Om=new WeakMap;const X$=a((t,e=[])=>{let n,i;for(const s of t.attributes||[])if(s.value.includes("{{")){const r=new $w;for([n,i]of LC(s.value))if(!n)r.append(i);else{const o=new yo(t,s.name,s.namespaceURI);r.append(o),e.push([i,o])}s.value=r.toString()}for(const s of t.childNodes)if(s.nodeType===AC&&!(s instanceof HTMLTemplateElement))X$(s,e);else{const r=s.data;if(s.nodeType===AC||r.includes("{{")){const o=[];if(r)for([n,i]of LC(r))if(!n)o.push(new Text(i));else{const l=new rv(t);o.push(l),e.push([i,l])}else if(s instanceof HTMLTemplateElement){const l=new ov(t,s);o.push(l),e.push([l.expression,l])}s.replaceWith(...o.flatMap(l=>l.replacementNodes||[l]))}}return e},"parse"),IC={},LC=a(t=>{let e="",n=0,i=IC[t],s=0,r;if(i)return i;for(i=[];r=t[s];s++)r==="{"&&t[s+1]==="{"&&t[s-1]!=="\\"&&t[s+2]&&++n==1?(e&&i.push([xC,e]),e="",s++):r==="}"&&t[s+1]==="}"&&t[s-1]!=="\\"&&!--n?(i.push([mhe,e.trim()]),e="",s++):e+=r||"";return e&&i.push([xC,(n>0?"{{":"")+e]),IC[t]=i},"tokenize$1"),yhe=11;var wp;let e3=(wp=class{get value(){return""}set value(e){}toString(){return this.value}},a(wp,"Part"),wp);const t3=new WeakMap,Ux=class Ux{constructor(){xr(this,sl,[])}[Symbol.iterator](){return bt(this,sl).values()}get length(){return bt(this,sl).length}item(e){return bt(this,sl)[e]}append(...e){for(const n of e)n instanceof yo&&t3.set(n,this),bt(this,sl).push(n)}toString(){return bt(this,sl).join("")}};a(Ux,"AttrPartList");let $w=Ux;sl=new WeakMap;const Bx=class Bx extends e3{constructor(e,n,i){super(),xr(this,rl),xr(this,uf,""),xr(this,qo,void 0),xr(this,jo,void 0),xr(this,Yo,void 0),go(this,qo,e),go(this,jo,n),go(this,Yo,i)}get attributeName(){return bt(this,jo)}get attributeNamespace(){return bt(this,Yo)}get element(){return bt(this,qo)}get value(){return bt(this,uf)}set value(e){bt(this,uf)!==e&&(go(this,uf,e),!bt(this,rl,jc)||bt(this,rl,jc).length===1?e==null?bt(this,qo).removeAttributeNS(bt(this,Yo),bt(this,jo)):bt(this,qo).setAttributeNS(bt(this,Yo),bt(this,jo),e):bt(this,qo).setAttributeNS(bt(this,Yo),bt(this,jo),bt(this,rl,jc).toString()))}get booleanValue(){return bt(this,qo).hasAttributeNS(bt(this,Yo),bt(this,jo))}set booleanValue(e){if(!bt(this,rl,jc)||bt(this,rl,jc).length===1)this.value=e?"":null;else throw new DOMException("Value is not fully templatized")}};a(Bx,"AttrPart");let yo=Bx;uf=new WeakMap;qo=new WeakMap;jo=new WeakMap;Yo=new WeakMap;rl=new WeakSet;jc=a(function(){return t3.get(this)},"list_get");const $x=class $x extends e3{constructor(e,n){super(),xr(this,Nm,void 0),xr(this,Us,void 0),go(this,Nm,e),go(this,Us,n?[...n]:[new Text])}get replacementNodes(){return bt(this,Us)}get parentNode(){return bt(this,Nm)}get nextSibling(){return bt(this,Us)[bt(this,Us).length-1].nextSibling}get previousSibling(){return bt(this,Us)[0].previousSibling}get value(){return bt(this,Us).map(e=>e.textContent).join("")}set value(e){this.replace(e)}replace(...e){const n=e.flat().flatMap(i=>i==null?[new Text]:i.forEach?[...i]:i.nodeType===yhe?[...i.childNodes]:i.nodeType?[i]:[new Text(i)]);n.length||n.push(new Text),go(this,Us,bhe(bt(this,Us)[0].parentNode,bt(this,Us),n,this.nextSibling))}};a($x,"ChildNodePart");let rv=$x;Nm=new WeakMap;Us=new WeakMap;const Hx=class Hx extends rv{constructor(e,n){const i=n.getAttribute("directive")||n.getAttribute("type");let s=n.getAttribute("expression")||n.getAttribute(i)||"";s.startsWith("{{")&&(s=s.trim().slice(2,-2).trim()),super(e),this.expression=s,this.template=n,this.directive=i}};a(Hx,"InnerTemplatePart");let ov=Hx;function bhe(t,e,n,i=null){let s=0,r,o,l,d=n.length,c=e.length;for(;s<d&&s<c&&e[s]==n[s];)s++;for(;s<d&&s<c&&n[d-1]==e[c-1];)i=n[--c,--d];if(s==c)for(;s<d;)t.insertBefore(n[s++],i);if(s==d)for(;s<c;)t.removeChild(e[s++]);else{for(r=e[s];s<d;)l=n[s++],o=r?r.nextSibling:i,r==l?r=o:s<d&&n[s]==o?(t.replaceChild(l,r),r=o):t.insertBefore(l,r);for(;r!=i;)o=r.nextSibling,t.removeChild(r),r=o}return n}a(bhe,"swapdom");const RC={string:t=>String(t)},Gx=class Gx{constructor(e){this.template=e,this.state=void 0}};a(Gx,"PartialTemplate");let av=Gx;const Tl=new WeakMap,Al=new WeakMap,Hw={partial:(t,e)=>{e[t.expression]=new av(t.template)},if:(t,e)=>{var n;if(n3(t.expression,e))if(Tl.get(t)!==t.template){Tl.set(t,t.template);const i=new Ah(t.template,e,RA);t.replace(i),Al.set(t,i)}else(n=Al.get(t))==null||n.update(e);else t.replace(""),Tl.delete(t),Al.delete(t)}},Ehe=Object.keys(Hw),RA={processCallback(t,e,n){var i,s;if(n)for(const[r,o]of e){if(o instanceof ov){if(!o.directive){const d=E
3428he.find(c=>o.template.hasAttribute(c));d&&(o.directive=d,o.expression=o.template.getAttribute(d))}(i=Hw[o.directive])==null||i.call(Hw,o,n);continue}let l=n3(r,n);if(l instanceof av){Tl.get(o)!==l.template?(Tl.set(o,l.template),l=new Ah(l.template,l.state,RA),o.value=l,Al.set(o,l)):(s=Al.get(o))==null||s.update(l.state);continue}l?(o instanceof yo&&o.attributeName.startsWith("aria-")&&(l=String(l)),o instanceof yo?typeof l=="boolean"?o.booleanValue=l:typeof l=="function"?o.element[o.attributeName]=l:o.value=l:(o.value=l,Tl.delete(o),Al.delete(o))):o instanceof yo?o.value=void 0:(o.value=void 0,Tl.delete(o),Al.delete(o))}}},kC={"!":t=>!t,"!!":t=>!!t,"==":(t,e)=>t==e,"!=":(t,e)=>t!=e,">":(t,e)=>t>e,">=":(t,e)=>t>=e,"<":(t,e)=>t<e,"<=":(t,e)=>t<=e,"??":(t,e)=>t??e,"|":(t,e)=>{var n;return(n=RC[e])==null?void 0:n.call(RC,t)}};function _he(t){return whe(t,{boolean:/true|false/,number:/-?\d+\.?\d*/,string:/(["'])((?:\\.|[^\\])*?)\1/,operator:/[!=><][=!]?|\?\?|\|/,ws:/\s+/,param:/[$a-z_][$\w]*/i}).filter(({type:e})=>e!=="ws")}a(_he,"tokenizeExpression");function n3(t,e={}){var n,i,s,r,o,l,d;const c=_he(t);if(c.length===0||c.some(({type:u})=>!u))return Hu(t);if(((n=c[0])==null?void 0:n.token)===">"){const u=e[(i=c[1])==null?void 0:i.token];if(!u)return Hu(t);const f={...e};u.state=f;const h=c.slice(2);for(let p=0;p<h.length;p+=3){const g=(s=h[p])==null?void 0:s.token,v=(r=h[p+1])==null?void 0:r.token,y=(o=h[p+2])==null?void 0:o.token;g&&v==="="&&(f[g]=Gu(y,e))}return u}if(c.length===1)return $g(c[0])?Gu(c[0].token,e):Hu(t);if(c.length===2){const u=(l=c[0])==null?void 0:l.token,f=kC[u];if(!f||!$g(c[1]))return Hu(t);const h=Gu(c[1].token,e);return f(h)}if(c.length===3){const u=(d=c[1])==null?void 0:d.token,f=kC[u];if(!f||!$g(c[0])||!$g(c[2]))return Hu(t);const h=Gu(c[0].token,e);if(u==="|")return f(h,c[2].token);const p=Gu(c[2].token,e);return f(h,p)}}a(n3,"evaluateExpression");function Hu(t){return console.warn(`Warning: invalid expression \`${t}\``),!1}a(Hu,"invalidExpression");function $g({type:t}){return["number","boolean","string","param"].includes(t)}a($g,"isValidParam");function Gu(t,e){const n=t[0],i=t.slice(-1);return t==="true"||t==="false"?t==="true":n===i&&["'",'"'].includes(n)?t.slice(1,-1):jB(t)?parseFloat(t):e[t]}a(Gu,"getParamValue");function whe(t,e){let n,i,s;const r=[];for(;t;){s=null,n=t.length;for(const o in e)i=e[o].exec(t),i&&i.index<n&&(s={token:i[0],type:o,matches:i.slice(1)},n=i.index);n&&r.push({token:t.substr(0,n),type:void 0}),s&&r.push(s),t=t.substr(n+(s?s.token.length:0))}return r}a(whe,"tokenize");var kA=a((t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},"__accessCheck"),Gw=a((t,e,n)=>(kA(t,e,"read from private field"),n?n.call(t):e.get(t)),"__privateGet"),Vu=a((t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},"__privateAdd"),xl=a((t,e,n,i)=>(kA(t,e,"write to private field"),i?i.call(t,n):e.set(t,n),n),"__privateSet"),fE=a((t,e,n)=>(kA(t,e,"access private method"),n),"__privateMethod"),vd,Fm,yd,Vw,i3,Um,Ww;const hE={mediatargetlivewindow:"targetlivewindow",mediastreamtype:"streamtype"},s3=Li.createElement("template");s3.innerHTML=`
3429  <style>
3430    :host {
3431      display: inline-block;
3432      line-height: 0;
3433    }
3434
3435    media-controller {
3436      width: 100%;
3437      height: 100%;
3438    }
3439
3440    media-captions-button:not([mediasubtitleslist]),
3441    media-captions-menu:not([mediasubtitleslist]),
3442    media-captions-menu-button:not([mediasubtitleslist]),
3443    media-audio-track-menu[mediaaudiotrackunavailable],
3444    media-audio-track-menu-button[mediaaudiotrackunavailable],
3445    media-rendition-menu[mediarenditionunavailable],
3446    media-rendition-menu-button[mediarenditionunavailable],
3447    media-volume-range[mediavolumeunavailable],
3448    media-airplay-button[mediaairplayunavailable],
3449    media-fullscreen-button[mediafullscreenunavailable],
3450    media-cast-button[mediacastunavailable],
3451    media-pip-button[mediapipunavailable] {
3452      display: none;
3453    }
3454  </style>
3455`;const Vx=class Vx extends me.HTMLElement{constructor(){super(),Vu(this,Vw),Vu(this,Um),Vu(this,vd,void 0),Vu(this,Fm,void 0),Vu(this,yd,void 0),this.shadowRoot?this.renderRoot=this.shadowRoot:(this.renderRoot=this.attachShadow({mode:"open"}),this.createRenderer());const e=new MutationObserver(n=>{var i;this.mediaController&&!((i=this.mediaController)!=null&&i.breakpointsComputed)||n.some(s=>{const r=s.target;return r===this?!0:r.localName!=="media-controller"?!1:!!(hE[s.attributeName]||s.attributeName.startsWith("breakpoint"))})&&this.render()});e.observe(this,{attributes:!0}),e.observe(this.renderRoot,{attributes:!0,subtree:!0}),this.addEventListener(Kl.BREAKPOINTS_COMPUTED,this.render),fE(this,Vw,i3).call(this,"template")}get mediaController(){return this.renderRoot.querySelector("media-controller")}get template(){var e;return(e=Gw(this,vd))!=null?e:this.constructor.template}set template(e){xl(this,yd,null),xl(this,vd,e),this.createRenderer()}get props(){var e,n,i;const s=[...Array.from((n=(e=this.mediaController)==null?void 0:e.attributes)!=null?n:[]).filter(({name:o})=>hE[o]||o.startsWith("breakpoint")),...Array.from(this.attributes)],r={};for(const o of s){const l=(i=hE[o.name])!=null?i:Ode(o.name);let{value:d}=o;d!=null?(jB(d)&&(d=parseFloat(d)),r[l]=d===""?!0:d):r[l]=!1}return r}attributeChangedCallback(e,n,i){e==="template"&&n!=i&&fE(this,Um,Ww).call(this)}connectedCallback(){fE(this,Um,Ww).call(this)}createRenderer(){this.template&&this.template!==Gw(this,Fm)&&(xl(this,Fm,this.template),this.renderer=new Ah(this.template,this.props,this.constructor.processor),this.renderRoot.textContent="",this.renderRoot.append(s3.content.cloneNode(!0),this.renderer))}render(){var e;(e=this.renderer)==null||e.update(this.props)}};a(Vx,"MediaThemeElement");let xh=Vx;vd=new WeakMap;Fm=new WeakMap;yd=new WeakMap;Vw=new WeakSet;i3=a(function(t){if(Object.prototype.hasOwnProperty.call(this,t)){const e=this[t];delete this[t],this[t]=e}},"upgradeProperty_fn");Um=new WeakSet;Ww=a(function(){var t;const e=this.getAttribute("template");if(!e||e===Gw(this,yd))return;const n=this.getRootNode(),i=(t=n?.getElementById)==null?void 0:t.call(n,e);if(i){xl(this,yd,e),xl(this,vd,i),this.createRenderer();return}She(e)&&(xl(this,yd,e),The(e).then(s=>{const r=Li.createElement("template");r.innerHTML=s,xl(this,vd,r),this.createRenderer()}).catch(console.error))},"updateTemplate_fn");xh.observedAttributes=["template"];xh.processor=RA;function She(t){if(!/^(\/|\.\/|https?:\/\/)/.test(t))return!1;const e=/^https?:\/\//.test(t)?void 0:location.origin;try{new URL(t,e)}catch{return!1}return!0}a(She,"isValidUrl");async function The(t){const e=await fetch(t);if(e.status!==200)throw new Error(`Failed to load resource: the server responded with a status of ${e.status}`);return e.text()}a(The,"request");me.customElements.get("media-theme")||me.customElements.define("media-theme",xh);const Ahe=["abort","canplay","canplaythrough","durationchange","emptied","encrypted","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting","waitingforkey","resize","enterpictureinpicture","leavepictureinpicture","webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"],r3=["autopictureinpicture","disablepictureinpicture","disableremoteplayback","autoplay","controls","controlslist","crossorigin","loop","muted","playsinline","poster","preload","src"];function xhe(t){return`
3456    <style>
3457      :host {
3458        display: inline-flex;
3459        line-height: 0;
3460        flex-direction: column;
3461        justify-content: end;
3462      }
3463
3464      audio {
3465        width: 100%;
3466      }
3467    </style>
3468    <slot name="media">
3469      <audio${u3(t)}></audio>
3470    </slot>
3471    <slot></slot>
3472  `}a(xhe,"getAudioTemplateHTML");function Ihe(t){return`
3473    <style>
3474      :host {
3475        display: inline-block;
3476        line-height: 0;
3477      }
3478
3479      video {
3480        max-width: 100%;
3481        max-height: 100%;
3482        min-width: 100%;
3483        min-height: 100%;
3484        object-fit: var(--media-object-fit, contain);
3485        object-position: var(--media-object-position, 50% 50%);
3486      }
3487
3488      video::-webkit-media-text-track-container {
3489        transform: var(--media-webkit-text-track-transform);
3490        transition: var(--media-webkit-text-track-transition);
3491      }
3492    </style>
3493    <slot name="media">
3494      <video${u3(t)}></video>
3495    </slot>
3496    <slot></slot>
3497  `}a(Ihe,"getVideoTemplateHTML");function d3(t,{tag:e,is:n}){var r,o,l,o3,c,u,f,h,p,ol,v,zw,b,a3,T,Kw,M,l3,N,c3;const i=globalThis.document?.createElement?.(e,{is:n}),s=i?Lhe(i):[];return r=class extends t{constructor(){super(...arguments);Ze(this,p);Ze(this,v);Ze(this,b);Ze(this,T);Ze(this,M);Ze(this,N);Ze(this,c,!1);Ze(this,u,null);Ze(this,f,new Map);Ze(this,h,void 0);vt(this,"get");vt(this,"set");vt(this,"call")}static get observedAttributes(){var m;return en(m=r,l,o3).call(m),[...i?.constructor?.observedAttributes??[],...r3]}get nativeEl(){return en(this,p,ol).call(this),Re(this,u)??this.querySelector(":scope > [slot=media]")??this.querySelector(e)??this.shadowRoot?.querySelector(e)??null}set nativeEl(L){st(this,u,L)}get defaultMuted(){return this.hasAttribute("muted")}set defaultMuted(L){this.toggleAttribute("muted",L)}get src(){return this.getAttribute("src")}set src(L){this.setAttribute("src",`${L}`)}get preload(){return this.getAttribute("preload")??this.nativeEl?.preload}set preload(L){this.setAttribute("preload",`${L}`)}init(){if(!this.shadowRoot){this.attachShadow({mode:"open"});const L=Rhe(this.attributes);n&&(L.is=n),e&&(L.part=e),this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(L)}this.nativeEl.muted=this.hasAttribute("muted");for(const L of s)en(this,M,l3).call(this,L);st(this,h,new MutationObserver(en(this,b,a3).bind(this))),this.shadowRoot.addEventListener("slotchange",()=>en(this,v,zw).call(this)),en(this,v,zw).call(this);for(const L of this.constructor.Events)this.shadowRoot.addEventListener(L,this,!0)}handleEvent(L){L.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(L.type,{detail:L.detail}))}attributeChangedCallback(L,m,S){en(this,p,ol).call(this),en(this,N,c3).call(this,L,m,S)}connectedCallback(){en(this,p,ol).call(this)}},o=new WeakMap,l=new WeakSet,o3=a(function(){if(Re(this,o))return;st(this,o,!0);const L=new Set(this.observedAttributes);L.delete("muted");for(const m of s)if(!(m in this.prototype))if(typeof i[m]=="function")this.prototype[m]=function(...S){return en(this,p,ol).call(this),a(()=>this.call?this.call(m,...S):this.nativeEl?.[m]?.apply(this.nativeEl,S),"fn")()};else{const S={get(){en(this,p,ol).call(this);const _=m.toLowerCase();if(L.has(_)){const A=this.getAttribute(_);return A===null?!1:A===""?!0:A}return this.get?.(m)??this.nativeEl?.[m]}};m!==m.toUpperCase()&&(S.set=function(_){en(this,p,ol).call(this);const A=m.toLowerCase();if(L.has(A)){_===!0||_===!1||_==null?this.toggleAttribute(A,!!_):this.setAttribute(A,_);return}if(this.set){this.set(m,_);return}this.nativeEl&&(this.nativeEl[m]=_)}),Object.defineProperty(this.prototype,m,S)}},"#define"),c=new WeakMap,u=new WeakMap,f=new WeakMap,h=new WeakMap,p=new WeakSet,ol=a(function(){Re(this,c)||(st(this,c,!0),this.init())},"#init"),v=new WeakSet,zw=a(function(){const L=new Map(Re(this,f));(this.shadowRoot?.querySelector("slot:not([name])")?.assignedElements({flatten:!0}).filter(_=>
3497["track","source"].includes(_.localName))).forEach(_=>{L.delete(_);let A=Re(this,f).get(_);A||(A=_.cloneNode(),Re(this,f).set(_,A),Re(this,h)?.observe(_,{attributes:!0})),this.nativeEl?.append(A),en(this,T,Kw).call(this,A)}),L.forEach((_,A)=>{_.remove(),Re(this,f).delete(A)})},"#syncMediaChildren"),b=new WeakSet,a3=a(function(L){for(const m of L)if(m.type==="attributes"){const{target:S,attributeName:_}=m,A=Re(this,f).get(S);A&&_&&(A.setAttribute(_,S.getAttribute(_)??""),en(this,T,Kw).call(this,A))}},"#syncMediaChildAttribute"),T=new WeakSet,Kw=a(function(L){L&&L.localName==="track"&&L.default&&(L.kind==="chapters"||L.kind==="metadata")&&L.track.mode==="disabled"&&(L.track.mode="hidden")},"#enableDefaultTrack"),M=new WeakSet,l3=a(function(L){if(Object.prototype.hasOwnProperty.call(this,L)){const m=this[L];delete this[L],this[L]=m}},"#upgradeProperty"),N=new WeakSet,c3=a(function(L,m,S){["id","class"].includes(L)||!r.observedAttributes.includes(L)&&this.constructor.observedAttributes.includes(L)||(S===null?this.nativeEl?.removeAttribute(L):this.nativeEl?.getAttribute(L)!==S&&this.nativeEl?.setAttribute(L,S))},"#forwardAttribute"),Ze(r,l),a(r,"CustomMedia"),vt(r,"getTemplateHTML",e.endsWith("audio")?xhe:Ihe),vt(r,"shadowRootOptions",{mode:"open"}),vt(r,"Events",Ahe),Ze(r,o,!1),r}a(d3,"CustomMediaMixin");function Lhe(t){const e=[];for(let n=Object.getPrototypeOf(t);n&&n!==HTMLElement.prototype;n=Object.getPrototypeOf(n)){const i=Object.getOwnPropertyNames(n);e.push(...i)}return e}a(Lhe,"getNativeElProps$1");function u3(t){let e="";for(const n in t){if(!r3.includes(n))continue;const i=t[n];i===""?e+=` ${n}`:e+=` ${n}="${i}"`}return e}a(u3,"serializeAttributes");function Rhe(t){const e={};for(const n of t)e[n.name]=n.value;return e}a(Rhe,"namedNodeMapToObject");const khe=d3(globalThis.HTMLElement??class{},{tag:"video"});d3(globalThis.HTMLElement??class{},{tag:"audio"});const Wx=class Wx extends Event{track;constructor(e,n){super(e),this.track=n.track}};a(Wx,"TrackEvent");let Zd=Wx;const qw=new WeakMap;function Ne(t){return qw.get(t)??Mhe(t,{})}a(Ne,"getPrivate");function Mhe(t,e){let n=qw.get(t);return n||qw.set(t,n={}),Object.assign(n,e)}a(Mhe,"setPrivate");function jw(t,e){const n=t.videoTracks;Ne(e).media=t,Ne(e).renditionSet||(Ne(e).renditionSet=new Set);const i=Ne(n).trackSet;i.add(e);const s=i.size-1;s in Ih.prototype||Object.defineProperty(Ih.prototype,s,{get(){return[...Ne(this).trackSet][s]}}),queueMicrotask(()=>{n.dispatchEvent(new Zd("addtrack",{track:e}))})}a(jw,"addVideoTrack");function Yw(t){const e=Ne(t).media?.videoTracks;if(!e)return;Ne(e).trackSet.delete(t),queueMicrotask(()=>{e.dispatchEvent(new Zd("removetrack",{track:t}))})}a(Yw,"removeVideoTrack");function Che(t){const e=Ne(t).media.videoTracks??[];let n=!1;for(const i of e)i!==t&&(i.selected=!1,n=!0);if(n){if(Ne(e).changeRequested)return;Ne(e).changeRequested=!0,queueMicrotask(()=>{delete Ne(e).changeRequested,e.dispatchEvent(new Event("change"))})}}a(Che,"selectedChanged$2");var ca,da,ua,Ll,ff;const zx=class zx extends EventTarget{constructor(){super();Ze(this,Ll);Ze(this,ca,void 0);Ze(this,da,void 0);Ze(this,ua,void 0);Ne(this).trackSet=new Set}[Symbol.iterator](){return Re(this,Ll,ff).values()}get length(){return Re(this,Ll,ff).size}getTrackById(n){return[...Re(this,Ll,ff)].find(i=>i.id===n)??null}get selectedIndex(){return[...Re(this,Ll,ff)].findIndex(n=>n.selected)}get onaddtrack(){return Re(this,ca)}set onaddtrack(n){Re(this,ca)&&(this.removeEventListener("addtrack",Re(this,ca)),st(this,ca,void 0)),typeof n=="function"&&(st(this,ca,n),this.addEventListener("addtrack",n))}get onremovetrack(){return Re(this,da)}set onremovetrack(n){Re(this,da)&&(this.removeEventListener("removetrack",Re(this,da)),st(this,da,void 0)),typeof n=="function"&&(st(this,da,n),this.addEventListener("removetrack",n))}get onchange(){return Re(this,ua)}set onchange(n){Re(this,ua)&&(this.removeEventListener("change",Re(this,ua)),st(this,ua,void 0)),typeof n=="function"&&(st(this,ua,n),this.addEventListener("change",n))}};ca=new WeakMap,da=new WeakMap,ua=new WeakMap,Ll=new WeakSet,ff=a(function(){return Ne(this).trackSet},"#tracks"),a(zx,"VideoTrackList");let Ih=zx;
3497const Kx=class Kx extends Event{rendition;constructor(e,n){super(e),this.rendition=n.rendition}};a(Kx,"RenditionEvent");let Qd=Kx;function Phe(t,e){const n=Ne(t).media.videoRenditions;Ne(e).media=Ne(t).media,Ne(e).track=t;const i=Ne(t).renditionSet;i.add(e);const s=i.size-1;s in Lh.prototype||Object.defineProperty(Lh.prototype,s,{get(){return Yc(this)[s]}}),queueMicrotask(()=>{t.selected&&n.dispatchEvent(new Qd("addrendition",{rendition:e}))})}a(Phe,"addRendition$1");function Dhe(t){const e=Ne(t).media.videoRenditions,n=Ne(t).track;Ne(n).renditionSet.delete(t),queueMicrotask(()=>{Ne(t).track.selected&&e.dispatchEvent(new Qd("removerendition",{rendition:t}))})}a(Dhe,"removeRendition$1");function Ohe(t){const e=Ne(t).media.videoRenditions;!e||Ne(e).changeRequested||(Ne(e).changeRequested=!0,queueMicrotask(()=>{delete Ne(e).changeRequested,Ne(t).track.selected&&e.dispatchEvent(new Event("change"))}))}a(Ohe,"selectedChanged$1");function Yc(t){return[...Ne(t).media.videoTracks].filter(n=>n.selected).flatMap(n=>[...Ne(n).renditionSet])}a(Yc,"getCurrentRenditions$1");var fa,ha,pa;
3497const qx=class qx extends EventTarget{constructor(){super(...arguments);Ze(this,fa,void 0);Ze(this,ha,void 0);Ze(this,pa,void 0)}[Symbol.iterator](){return Yc(this).values()}get length(){return Yc(this).length}getRenditionById(n){return Yc(this).find(i=>`${i.id}`==`${n}`)??null}get selectedIndex(){return Yc(this).findIndex(n=>n.selected)}set selectedIndex(n){for(const[i,s]of Yc(this).entries())s.selected=i===n}get onaddrendition(){return Re(this,fa)}set onaddrendition(n){Re(this,fa)&&(this.removeEventListener("addrendition",Re(this,fa)),st(this,fa,void 0)),typeof n=="function"&&(st(this,fa,n),this.addEventListener("addrendition",n))}get onremoverendition(){return Re(this,ha)}set onremoverendition(n){Re(this,ha)&&(this.removeEventListener("removerendition",Re(this,ha)),st(this,ha,void 0)),typeof n=="function"&&(st(this,ha,n),this.addEventListener("removerendition",n))}get onchange(){return Re(this,pa)}set onchange(n){Re(this,pa)&&(this.removeEventListener("change",Re(this,pa)),st(this,pa,void 0)),typeof n=="function"&&(st(this,pa,n),this.addEventListener("change",n))}};fa=new WeakMap,ha=new WeakMap,pa=new WeakMap,a(qx,"VideoRenditionList");let Lh=qx;var wd;const jx=class jx{constructor(){vt(this,"src");vt(this,"id");vt(this,"width");vt(this,"height");vt(this,"bitrate");vt(this,"frameRate");vt(this,"codec");Ze(this,wd,!1)}get selected(){return Re(this,wd)}set selected(e){Re(this,wd)!==e&&(st(this,wd,e),Ohe(this))}};wd=new WeakMap,a(jx,"VideoRendition");let Zw=jx;var Sd;const Yx=class Yx{constructor(){vt(this,"id");vt(this,"kind");vt(this,"label","");vt(this,"language","");vt(this,"sourceBuffer");Ze(this,Sd,!1)}addRendition(e,n,i,s,r,o){const l=new Zw;return l.src=e,l.width=n,l.height=i,l.frameRate=o,l.bitrate=r,l.codec=s,Phe(this,l),l}removeRendition(e){Dhe(e)}get selected(){return Re(this,Sd)}set selected(e){Re(this,Sd)!==e&&(st(this,Sd,e),e===!0&&Che(this))}};Sd=new WeakMap,a(Yx,"VideoTrack");let lv=Yx;function Nhe(t,e){const n=Ne(t).media.audioRenditions;Ne(e).media=Ne(t).media,Ne(e).track=t;const i=Ne(t).renditionSet;i.add(e);const s=i.size-1;s in Rh.prototype||Object.defineProperty(Rh.prototype,s,{get(){return Zc(this)[s]}}),queueMicrotask(()=>{t.enabled&&n.dispatchEvent(new Qd("addrendition",{rendition:e}))})}a(Nhe,"addRendition");function Fhe(t){const e=Ne(t).media.audioRenditions,n=Ne(t).track;Ne(n).renditionSet.delete(t),queueMicrotask(()=>{Ne(t).track.enabled&&e.dispatchEvent(new Qd("removerendition",{rendition:t}))})}a(Fhe,"removeRendition");function Uhe(t){const e=Ne(t).media.audioRenditions;!e||Ne(e).changeRequested||(Ne(e).changeRequested=!0,queueMicrotask(()=>{delete Ne(e).changeRequested,Ne(t).track.enabled&&e.dispatchEvent(new Event("change"))}))}a(Uhe,"selectedChanged");function Zc(t){return[...Ne(t).media.audioTracks].filter(n=>n.enabled).flatMap(n=>[...Ne(n).renditionSet])}a(Zc,"getCurrentRenditions");var ga,ma,va;const Zx=class Zx extends EventTarget{constructor(){super(...arguments);Ze(this,ga,void 0);Ze(this,ma,void 0);Ze(this,va,void 0)}[Symbol.iterator](){return Zc(this).values()}get length(){return Zc(this).length}getRenditionById(n){return Zc(this).find(i=>`${i.id}`==`${n}`)??null}get selectedIndex(){return Zc(this).findIndex(n=>n.selected)}set selectedIndex(n){for(const[i,s]of Zc(this).entries())s.selected=i===n}get onaddrendition(){return Re(this,ga)}set onaddrendition(n){Re(this,ga)&&(this.removeEventListener("addrendition",Re(this,ga)),st(this,ga,void 0)),typeof n=="function"&&(st(this,ga,n),this.addEventListener("addrendition",n))}get onremoverendition(){return Re(this,ma)}set onremoverendition(n){Re(this,ma)&&(this.removeEventListener("removerendition",Re(this,ma)),st(this,ma,void 0)),typeof n=="function"&&(st(this,ma,n),this.addEventListener("removerendition",n))}get onchange(){return Re(this,va)}set onchange(n){Re(this,va)&&(this.removeEventListener("change",Re(this,va)),st(this,va,void 0)),typeof n=="function"&&(st(this,va,n),this.addEventListener("change",n))}};ga=new WeakMap,ma=new WeakMap,va=new WeakMap,a(Zx,"AudioRenditionList");let Rh=Zx;var Td;const Qx=class Qx{constructor(){vt(this,"src");vt(this,"id");vt(this,"bitrate");vt(this,"codec");Ze(this,Td,!1)}get selected(){return Re(this,Td)}set selected(e){Re(this,Td)!==e&&(st(this,Td,e),Uhe(this))}};
3497Td=new WeakMap,a(Qx,"AudioRendition");let Qw=Qx;function Jw(t,e){const n=t.audioTracks;Ne(e).media=t,Ne(e).renditionSet||(Ne(e).renditionSet=new Set);const i=Ne(n).trackSet;i.add(e);const s=i.size-1;s in kh.prototype||Object.defineProperty(kh.prototype,s,{get(){return[...Ne(this).trackSet][s]}}),queueMicrotask(()=>{n.dispatchEvent(new Zd("addtrack",{track:e}))})}a(Jw,"addAudioTrack");function Xw(t){const e=Ne(t).media?.audioTracks;if(!e)return;Ne(e).trackSet.delete(t),queueMicrotask(()=>{e.dispatchEvent(new Zd("removetrack",{track:t}))})}a(Xw,"removeAudioTrack");function Bhe(t){const e=Ne(t).media.audioTracks;!e||Ne(e).changeRequested||(Ne(e).changeRequested=!0,queueMicrotask(()=>{delete Ne(e).changeRequested,e.dispatchEvent(new Event("change"))}))}a(Bhe,"enabledChanged");var ya,ba,Ea,Ad,Bm;const Jx=class Jx extends EventTarget{constructor(){super();Ze(this,Ad);Ze(this,ya,void 0);Ze(this,ba,void 0);Ze(this,Ea,void 0);Ne(this).trackSet=new Set}[Symbol.iterator](){return Re(this,Ad,Bm).values()}get length(){return Re(this,Ad,Bm).size}getTrackById(n){return[...Re(this,Ad,Bm)].find(i=>i.id===n)??null}get onaddtrack(){return Re(this,ya)}set onaddtrack(n){Re(this,ya)&&(this.removeEventListener("addtrack",Re(this,ya)),st(this,ya,void 0)),typeof n=="function"&&(st(this,ya,n),this.addEventListener("addtrack",n))}get onremovetrack(){return Re(this,ba)}set onremovetrack(n){Re(this,ba)&&(this.removeEventListener("removetrack",Re(this,ba)),st(this,ba,void 0)),typeof n=="function"&&(st(this,ba,n),this.addEventListener("removetrack",n))}get onchange(){return Re(this,Ea)}set onchange(n){Re(this,Ea)&&(this.removeEventListener("change",Re(this,Ea)),st(this,Ea,void 0)),typeof n=="function"&&(st(this,Ea,n),this.addEventListener("change",n))}};ya=new WeakMap,ba=new WeakMap,Ea=new WeakMap,Ad=new WeakSet,Bm=a(function(){return Ne(this).trackSet},"#tracks"),a(Jx,"AudioTrackList");let kh=Jx;var xd;const Xx=class Xx{constructor(){vt(this,"id");vt(this,"kind");vt(this,"label","");vt(this,"language","");vt(this,"sourceBuffer");Ze(this,xd,!1)}addRendition(e,n,i){const s=new Qw;return s.src=e,s.codec=n,s.bitrate=i,Nhe(this,s),s}removeRendition(e){Fhe(e)}get enabled(){return Re(this,xd)}set enabled(e){Re(this,xd)!==e&&(st(this,xd,e),Bhe(this))}};xd=new WeakMap,a(Xx,"AudioTrack");let cv=Xx;const MC=dv(globalThis.HTMLMediaElement,"video"),CC=dv(globalThis.HTMLMediaElement,"audio");function f3(t){if(!t?.prototype)return t;const e=dv(t,"video");(!e||`${e}`.includes("[native code]"))&&Object.defineProperty(t.prototype,"videoTracks",{get(){return $he(this)}});const n=dv(t,"audio");(!n||`${n}`.includes("[native code]"))&&Object.defineProperty(t.prototype,"audioTracks",{get(){return Hhe(this)}}),"addVideoTrack"in t.prototype||(t.prototype.addVideoTrack=function(r,o="",l=""){const d=new lv;return d.kind=r,d.label=o,d.language=l,jw(this,d),d}),"removeVideoTrack"in t.prototype||(t.prototype.removeVideoTrack=Yw),"addAudioTrack"in t.prototype||(t.prototype.addAudioTrack=function(r,o="",l=""){const d=new cv;return d.kind=r,d.label=o,d.language=l,Jw(this,d),d}),"removeAudioTrack"in t.prototype||(t.prototype.removeAudioTrack=Xw),"videoRenditions"in t.prototype||Object.defineProperty(t.prototype,"videoRenditions",{get(){return i(this)}});const i=a(r=>{let o=Ne(r).videoRenditions;return o||(o=new Lh,Ne(o).media=r,Ne(r).videoRenditions=o),o},"initVideoRenditions");"audioRenditions"in t.prototype||Object.defineProperty(t.prototype,"audioRenditions",{get(){return s(this)}});const s=a(r=>{let o=Ne(r).audioRenditions;return o||(o=new Rh,Ne(o).media=r,Ne(r).audioRenditions=o),o},"initAudioRenditions");return t}a(f3,"MediaTracksMixin");function dv(t,e){if(t?.prototype)return Object.getOwnPropertyDescriptor(t.prototype,`${e}Tracks`)?.get}a(dv,"getBaseMediaTracksFn");function $he(t){let e=Ne(t).videoTracks;if(!e&&(e=new Ih,Ne(t).videoTracks=e,MC)){const n=MC.call(t.nativeEl??t);for(const i of n)jw(t,i);n.addEventListener("change",()=>{e.dispatchEvent(new Event("change"))}),n.addEventListener("addtrack",i=>{if([...e].some(s=>s instanceof lv)){for(const s of n)Yw(s);return}jw(t,i.track)}),n.addEventListener("removetrack",i=>{Yw(i.track)})}return e}a($he,"getVideoTracks");function Hhe(t){let e=Ne(t).audioTracks;
3497if(!e&&(e=new kh,Ne(t).audioTracks=e,CC)){const n=CC.call(t.nativeEl??t);for(const i of n)Jw(t,i);n.addEventListener("change",()=>{e.dispatchEvent(new Event("change"))}),n.addEventListener("addtrack",i=>{if([...e].some(s=>s instanceof cv)){for(const s of n)Xw(s);return}Jw(t,i.track)}),n.addEventListener("removetrack",i=>{Xw(i.track)})}return e}a(Hhe,"getAudioTracks");const Pe=Number.isFinite||function(t){return typeof t=="number"&&isFinite(t)},Ghe=Number.isSafeInteger||function(t){return typeof t=="number"&&Math.abs(t)<=Vhe},Vhe=Number.MAX_SAFE_INTEGER||9007199254740991;let Ge=function(t){return t.NETWORK_ERROR="networkError",t.MEDIA_ERROR="mediaError",t.KEY_SYSTEM_ERROR="keySystemError",t.MUX_ERROR="muxError",t.OTHER_ERROR="otherError",t}({}),de=function(t){return t.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",t.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",t.KEY_SYSTEM_NO_SESSION="keySystemNoSession",t.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",t.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",t.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",t.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",t.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",t.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",t.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",t.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",t.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",t.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",t.MANIFEST_LOAD_ERROR="manifestLoadError",t.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",t.MANIFEST_PARSING_ERROR="manifestParsingError",t.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",t.LEVEL_EMPTY_ERROR="levelEmptyError",t.LEVEL_LOAD_ERROR="levelLoadError",t.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",t.LEVEL_PARSING_ERROR="levelParsingError",t.LEVEL_SWITCH_ERROR="levelSwitchError",t.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",t.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",t.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",t.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",t.FRAG_LOAD_ERROR="fragLoadError",t.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",t.FRAG_DECRYPT_ERROR="fragDecryptError",t.FRAG_PARSING_ERROR="fragParsingError",t.FRAG_GAP="fragGap",t.REMUX_ALLOC_ERROR="remuxAllocError",t.KEY_LOAD_ERROR="keyLoadError",t.KEY_LOAD_TIMEOUT="keyLoadTimeOut",t.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",t.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",t.BUFFER_APPEND_ERROR="bufferAppendError",t.BUFFER_APPENDING_ERROR="bufferAppendingError",t.BUFFER_STALLED_ERROR="bufferStalledError",t.BUFFER_FULL_ERROR="bufferFullError",t.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",t.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",t.ASSET_LIST_LOAD_ERROR="assetListLoadError",t.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",t.ASSET_LIST_PARSING_ERROR="assetListParsingError",t.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",t.INTERNAL_EXCEPTION="internalException",t.INTERNAL_ABORTED="aborted",t.ATTACH_MEDIA_ERROR="attachMediaError",t.UNKNOWN="unknown",t}({}
3497),B=function(t){return t.MEDIA_ATTACHING="hlsMediaAttaching",t.MEDIA_ATTACHED="hlsMediaAttached",t.MEDIA_DETACHING="hlsMediaDetaching",t.MEDIA_DETACHED="hlsMediaDetached",t.MEDIA_ENDED="hlsMediaEnded",t.STALL_RESOLVED="hlsStallResolved",t.BUFFER_RESET="hlsBufferReset",t.BUFFER_CODECS="hlsBufferCodecs",t.BUFFER_CREATED="hlsBufferCreated",t.BUFFER_APPENDING="hlsBufferAppending",t.BUFFER_APPENDED="hlsBufferAppended",t.BUFFER_EOS="hlsBufferEos",t.BUFFERED_TO_END="hlsBufferedToEnd",t.BUFFER_FLUSHING="hlsBufferFlushing",t.BUFFER_FLUSHED="hlsBufferFlushed",t.MANIFEST_LOADING="hlsManifestLoading",t.MANIFEST_LOADED="hlsManifestLoaded",t.MANIFEST_PARSED="hlsManifestParsed",t.LEVEL_SWITCHING="hlsLevelSwitching",t.LEVEL_SWITCHED="hlsLevelSwitched",t.LEVEL_LOADING="hlsLevelLoading",t.LEVEL_LOADED="hlsLevelLoaded",t.LEVEL_UPDATED="hlsLevelUpdated",t.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",t.LEVELS_UPDATED="hlsLevelsUpdated",t.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",t.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",t.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",t.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",t.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",t.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",t.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",t.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",t.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",t.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",t.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",t.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",t.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",t.CUES_PARSED="hlsCuesParsed",t.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",t.INIT_PTS_FOUND="hlsInitPtsFound",t.FRAG_LOADING="hlsFragLoading",t.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",t.FRAG_LOADED="hlsFragLoaded",t.FRAG_DECRYPTED="hlsFragDecrypted",t.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",t.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",t.FRAG_PARSING_METADATA="hlsFragParsingMetadata",t.FRAG_PARSED="hlsFragParsed",t.FRAG_BUFFERED="hlsFragBuffered",t.FRAG_CHANGED="hlsFragChanged",t.FPS_DROP="hlsFpsDrop",t.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",t.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",t.ERROR="hlsError",t.DESTROYING="hlsDestroying",t.KEY_LOADING="hlsKeyLoading",t.KEY_LOADED="hlsKeyLoaded",t.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",t.BACK_BUFFER_REACHED="hlsBackBufferReached",t.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",t.ASSET_LIST_LOADING="hlsAssetListLoading",t.ASSET_LIST_LOADED="hlsAssetListLoaded",t.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",t.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",t.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",t.INTERSTITIAL_STARTED="hlsInterstitialStarted",t.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",t.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",t.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",t.INTERSTITIAL_ENDED="hlsInterstitialEnded",t.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",t.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",t.EVENT_CUE_ENTER="hlsEventCueEnter",t}({});var wt={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},Ue={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};const eI=class eI{constructor(e,n=0,i=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=n,this.totalWeight_=i}sample(e,n){const i=Math.pow(this.alpha_,e);this.estimate_=n*(1-i)+i*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}};a(eI,"EWMA");let Qo=eI;const tI=class tI{constructor(e,n,i,s=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_
3497=new Qo(e),this.fast_=new Qo(n),this.defaultTTFB_=s,this.ttfb_=new Qo(e)}update(e,n){const{slow_:i,fast_:s,ttfb_:r}=this;i.halfLife!==e&&(this.slow_=new Qo(e,i.getEstimate(),i.getTotalWeight())),s.halfLife!==n&&(this.fast_=new Qo(n,s.getEstimate(),s.getTotalWeight())),r.halfLife!==e&&(this.ttfb_=new Qo(e,r.getEstimate(),r.getTotalWeight()))}sample(e,n){e=Math.max(e,this.minDelayMs_);const i=8*n,s=e/1e3,r=i/s;this.fast_.sample(s,r),this.slow_.sample(s,r)}sampleTTFB(e){const n=e/1e3,i=Math.sqrt(2)*Math.exp(-Math.pow(n,2)/2);this.ttfb_.sample(i,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}};a(tI,"EwmaBandWidthEstimator");let eS=tI;function Whe(t,e,n){return(e=Khe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}a(Whe,"_defineProperty");function jt(){return jt=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},jt.apply(null,arguments)}a(jt,"_extends");function PC(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,i)}return n}a(PC,"ownKeys");function nn(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?PC(Object(n),!0).forEach(function(i){Whe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):PC(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}a(nn,"_objectSpread2");function zhe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}a(zhe,"_toPrimitive");function Khe(t){var e=zhe(t,"string");return typeof e=="symbol"?e:e+""}a(Khe,"_toPropertyKey");const nI=class nI{constructor(e,n){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;const i=`[${e}]:`;this.trace=Jo,this.debug=n.debug.bind(null,i),this.log=n.log.bind(null,i),this.warn=n.warn.bind(null,i),this.info=n.info.bind(null,i),this.error=n.error.bind(null,i)}};a(nI,"Logger");let ms=nI;const Jo=a(function(){},"noop"),qhe={trace:Jo,debug:Jo,log:Jo,warn:Jo,info:Jo,error:Jo};function tS(){return jt({},qhe)}a(tS,"createLogger");function jhe(t,e){const n=self.console[t];return n?n.bind(self.console,`${e?"["+e+"] ":""}[${t}] >`):Jo}a(jhe,"consolePrintFn");function DC(t,e,n){return e[t]?e[t].bind(e):jhe(t,n)}a(DC,"getLoggerFn");const nS=tS();function Yhe(t,e,n){const i=tS();if(typeof console=="object"&&t===!0||typeof t=="object"){const s=["debug","log","info","warn","error"];s.forEach(r=>{i[r]=DC(r,t,n)});try{i.log(`Debug logs enabled for "${e}" in hls.js version 1.6.7`)}catch{return tS()}s.forEach(r=>{nS[r]=DC(r,t)})}else jt(nS,i);return i}a(Yhe,"enableLogs");const Bt=nS;function Ua(t=!0){return typeof self>"u"?void 0:(t||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}a(Ua,"getMediaSource");function Zhe(t){return typeof self<"u"&&t===self.ManagedMediaSource}a(Zhe,"isManagedMediaSource");function h3(t,e){const n=Object.keys(t),i=Object.keys(e),s=n.length,r=i.length;return!s||!r||s===r&&!n.some(o=>i.indexOf(o)===-1)}a(h3,"isCompatibleTrackChange");function hs(t,e=!1){if(typeof TextDecoder<"u"){const c=new TextDecoder("utf-8").decode(t);if(e){const u=c.indexOf("\0");return u!==-1?c.substring(0,u):c}return c.replace(/\0/g,"")}const n=t.length;let i,s,r,o="",l=0;for(;l<n;){if(i=t[l++],i===0&&e)return o;if(i===0||i===3)continue;switch(i>>
vendor: 9,961 bytes, line 3497
34974){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:o+=String.fromCharCode(i);break;case 12:case 13:s=t[l++],o+=String.fromCharCode((i&31)<<6|s&63);break;case 14:s=t[l++],r=t[l++],o+=String.fromCharCode((i&15)<<12|(s&63)<<6|(r&63)<<0);break}}return o}a(hs,"utf8ArrayToStr");const cl={hexDump:function(t){let e="";for(let n=0;n<t.length;n++){let i=t[n].toString(16);i.length<2&&(i="0"+i),e+=i}return e}};function p3(t){return Uint8Array.from(t.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}a(p3,"hexToArrayBuffer");function Qhe(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}a(Qhe,"getDefaultExportFromCjs");var pE={exports:{}},OC;function Jhe(){return OC||(OC=1,function(t,e){(function(n){var i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,s=/^(?=([^\/?#]*))\1([^]*)$/,r=/(?:\/|^)\.(?=\/)/g,o=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,l={buildAbsoluteURL:function(d,c,u){if(u=u||{},d=d.trim(),c=c.trim(),!c){if(!u.alwaysNormalize)return d;var f=l.parseURL(d);if(!f)throw new Error("Error trying to parse base URL.");return f.path=l.normalizePath(f.path),l.buildURLFromParts(f)}var h=l.parseURL(c);if(!h)throw new Error("Error trying to parse relative URL.");if(h.scheme)return u.alwaysNormalize?(h.path=l.normalizePath(h.path),l.buildURLFromParts(h)):c;var p=l.parseURL(d);if(!p)throw new Error("Error trying to parse base URL.");if(!p.netLoc&&p.path&&p.path[0]!=="/"){var g=s.exec(p.path);p.netLoc=g[1],p.path=g[2]}p.netLoc&&!p.path&&(p.path="/");var v={scheme:p.scheme,netLoc:h.netLoc,path:null,params:h.params,query:h.query,fragment:h.fragment};if(!h.netLoc&&(v.netLoc=p.netLoc,h.path[0]!=="/"))if(!h.path)v.path=p.path,h.params||(v.params=p.params,h.query||(v.query=p.query));else{var y=p.path,b=y.substring(0,y.lastIndexOf("/")+1)+h.path;v.path=l.normalizePath(b)}return v.path===null&&(v.path=u.alwaysNormalize?l.normalizePath(h.path):h.path),l.buildURLFromParts(v)},parseURL:function(d){var c=i.exec(d);return c?{scheme:c[1]||"",netLoc:c[2]||"",path:c[3]||"",params:c[4]||"",query:c[5]||"",fragment:c[6]||""}:null},normalizePath:function(d){for(d=d.split("").reverse().join("").replace(r,"");d.length!==(d=d.replace(o,"")).length;);return d.split("").reverse().join("")},buildURLFromParts:function(d){return d.scheme+d.netLoc+d.path+d.params+d.query+d.fragment}};t.exports=l})()}(pE)),pE.exports}a(Jhe,"requireUrlToolkit");var MA=Jhe();const iI=class iI{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}}};a(iI,"LoadStats");let Mh=iI;var ln={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};const sI=class sI{constructor(e){this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,typeof e=="string"&&(e={url:e}),this.base=e,Xhe(this,"stats")}setByteRange(e,n){const i=e.split("@",2);let s;i.length===1?s=n?.byteRangeEndOffset||0:s=parseInt(i[1]),this._byteRange=[s,parseInt(i[0])+s]}get baseurl(){return this.base.url}get byteRange(){return this._byteRange===null?[]:this._byteRange}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get elementaryStreams(){return this._streams===null&&(this._streams={[ln.AUDIO]:null,[ln.VIDEO]:null,[ln.AUDIOVIDEO]:null}),this._streams}set elementaryStreams(e){this._streams=e}get hasStats(){return this._stats!==null}get hasStreams(){return this._streams!==null}get stats(){return this._stats===null&&(this._stats=new Mh),this._stats}set stats(e){this._stats=e}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=MA.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[ln.AUDIO]=null,e[ln.VIDEO]=null,e[ln.AUDIOVIDEO]=null}};a(sI,"BaseSegment");let uv=sI;function $n(t){return t.sn!=="initSegment"}a($n,"isMediaFragment");const rI=class rI extends uv{constructor(e,n){super(n),this._decryptdata=null,this._programDateTime=null,this._ref=null,this._bitrate=void 0,this.rawProgramDateTime=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.playlistOffset=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get byteLength(){if(this.hasStats){const e=this.stats.total;if(e)return e}if(this.byteRange){const e=this.byteRange[0],n=this.byteRange[1];if(Pe(e)&&Pe(n))return n-e}return null}get bitrate(){return this.byteLength?this.byteLength*8/this.duration:this._bitrate?this._bitrate:null}set bitrate(e){this._bitrate=e}get decryptdata(){const{levelkeys:e}=this;if(!e&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){const n=this.levelkeys.identity;if(n)this._decryptdata=n.getDecryptData(this.sn);else{const i=Object.keys(this.levelkeys);if(i.length===1)return this._decryptdata=this.levelkeys[i[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null)return null;const e=Pe(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 n=Object.keys(this.levelkeys),i=n.length;if(i>1||i===1&&this.levelkeys[n[0]].encrypted)return!0}return!1}get programDateTime(){return this._programDateTime===null&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(e){if(!Pe(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return $n(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}addStart(e){this.setStart(this.start+e)}setStart(e){this.start=e,this._ref&&(this._ref.start=e)}setDuration(e){this.duration=e,this._ref&&(this._ref.duration=e)}setKeyFormat(e){if(this.levelkeys){const n=this.levelkeys[e];n&&!this._decryptdata&&(this._decryptdata=n.getDecryptData(this.sn))}}abortRequests(){var e,n;(e=this.loader)==null||e.abort(),(n=this.keyLoader)==null||n.abort()}setElementaryStreamInfo(e,n,i,s,r,o=!1){const{elementaryStreams:l}=this,d=l[e];if(!d){l[e]={startPTS:n,endPTS:i,startDTS:s,endDTS:r,partial:o};return}d.startPTS=Math.min(d.startPTS,n),d.endPTS=Math.max(d.endPTS,i),d.startDTS=Math.min(d.startDTS,s),d.endDTS=Math.max(d.endDTS,r)}};a(rI,"Fragment");let xf=rI;const oI=class oI extends uv{constructor(e,n,i,s,r){super(i),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=n,this.index=s;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)}};a(oI,"Part");let iS=oI;function g3(t,e){const n=Object.getPrototypeOf(t);if(n){const i=Object.getOwnPropertyDescriptor(n,e);return i||g3(n,e)}}a(g3,"getOwnPropertyDescriptorFromPrototypeChain");function Xhe(t,e){const n=g3(t,e);n&&(n.enumerable=!0,Object.defineProperty(t,e,n))}a(Xhe,"makeEnumerable");const NC=Math.pow(2,32)-1,epe=[].push,m3={video:1,audio:2,id3:3,text:4};function ti(t){return String.fromCharCode.apply(null,t)}a(ti,"bin2str");function v3(t,e){const n=t[e]<<8|t[e+1];return n<0?65536+n:n}a(v3,"readUint16");function ct(t,e){const n=y3(t,e);return n<0?4294967296+n:n}a(ct,"readUint32");function FC(t,e){let n=ct(t,e);return n*=Math.pow(2,32),n+=ct(t,e+4),n}a(FC,"readUint64");function y3(t,e){return t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}a(y3,"readSint32");function tpe(t){const e=t.byteLength;for(let n=0;n<e;){const i=ct(t,n);if(i>8&&t[n+4]===109&&t[n+5]===111&&t[n+6]===111&&t[n+7]===102)return!0;n=i>1?n+i:e}return!1}a(tpe,"hasMoofData");function Et(t,e){const n=[];if(!e.length)return n;const i=t.byteLength;for(let s=0;s<i;){const r=ct(t,s),o=ti(t.subarray(s+4,s+8)),l=r>1?s+r:i;if(o===e[0])if(e.length===1)n.push(t.subarray(s+8,l));else{const d=Et(t.subarray(s+8,l),e.slice(1));d.length&&epe.apply(n,d)}s=l}return n}a(Et,"findBox");function npe(t){const e=[],n=t[0];let i=8;const s=ct(t,i);i+=4;let r=0,o=0;n===0?(r=ct(t,i),o=ct(t,i+4),i+=8):(r=FC(t,i),o=FC(t,i+8),i+=16),i+=2;let l=t.length+o;const d=v3(t,i);i+=2;for(let c=0;c<d;c++){let u=i;const f=ct(t,u);u+=4;const h=f&2147483647;if((f&2147483648)>>>31===1)return Bt.warn("SIDX has hierarchical references (not supported)"),null;const g=ct(t,u);u+=4,e.push({referenceSize:h,subsegmentDuration:g,info:{duration:g/s,start:l,end:l+h-1}}),l+=h,u+=4,i=u}return{earliestPresentationTime:r,timescale:s,version:n,referencesCount:d,references:e}}a(npe,"parseSegmentIndex");function b3(t){const e=[],n=Et(t,["moov","trak"]);for(let s=0;s<n.length;s++){const r=n[s],o=Et(r,["tkhd"])[0];if(o){let l=o[0];const d=ct(o,l===0?12:20),c=Et(r,["mdia","mdhd"])[0];if(c){l=c[0];const u=ct(c,l===0?12:20),f=Et(r,["mdia","hdlr"])[0];if(f){const h=ti(f.subarray(8,12)),p={soun:ln.AUDIO,vide:ln.VIDEO}[h],g=Et(r,["mdia","minf","stbl","stsd"])[0],v=ipe(g);p?(e[d]={timescale:u,type:p,stsd:v},e[p]=nn({timescale:u,id:d},v)):e[d]={timescale:u,type:h,stsd:v}}}}}
vendor: 8,414 bytes, line 3497
3497return Et(t,["moov","mvex","trex"]).forEach(s=>{const r=ct(s,4),o=e[r];o&&(o.default={duration:ct(s,12),flags:ct(s,20)})}),e}a(b3,"parseInitSegment");function ipe(t){const e=t.subarray(8),n=e.subarray(8+78),i=ti(e.subarray(4,8));let s=i,r;const o=i==="enca"||i==="encv";if(o){const c=Et(e,[i])[0].subarray(i==="enca"?28:78);Et(c,["sinf"]).forEach(f=>{const h=Et(f,["schm"])[0];if(h){const p=ti(h.subarray(4,8));if(p==="cbcs"||p==="cenc"){const g=Et(f,["frma"])[0];g&&(s=ti(g))}}})}const l=s;switch(s){case"avc1":case"avc2":case"avc3":case"avc4":{const d=Et(n,["avcC"])[0];d&&d.length>3&&(s+="."+Gg(d[1])+Gg(d[2])+Gg(d[3]),r=Hg(l==="avc1"?"dva1":"dvav",n));break}case"mp4a":{const d=Et(e,[i])[0],c=Et(d.subarray(28),["esds"])[0];if(c&&c.length>7){let u=4;if(c[u++]!==3)break;u=gE(c,u),u+=2;const f=c[u++];if(f&128&&(u+=2),f&64&&(u+=c[u++]),c[u++]!==4)break;u=gE(c,u);const h=c[u++];if(h===64)s+="."+Gg(h);else break;if(u+=12,c[u++]!==5)break;u=gE(c,u);const p=c[u++];let g=(p&248)>>3;g===31&&(g+=1+((p&7)<<3)+((c[u]&224)>>5)),s+="."+g}break}case"hvc1":case"hev1":{const d=Et(n,["hvcC"])[0];if(d&&d.length>12){const c=d[1],u=["","A","B","C"][c>>6],f=c&31,h=ct(d,2),p=(c&32)>>5?"H":"L",g=d[12],v=d.subarray(6,12);s+="."+u+f,s+="."+spe(h).toString(16).toUpperCase(),s+="."+p+g;let y="";for(let b=v.length;b--;){const E=v[b];(E||y)&&(y="."+E.toString(16).toUpperCase()+y)}s+=y}r=Hg(l=="hev1"?"dvhe":"dvh1",n);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{s=Hg(s,n)||s;break}case"vp09":{const d=Et(n,["vpcC"])[0];if(d&&d.length>6){const c=d[4],u=d[5],f=d[6]>>4&15;s+="."+Er(c)+"."+Er(u)+"."+Er(f)}break}case"av01":{const d=Et(n,["av1C"])[0];if(d&&d.length>2){const c=d[1]>>>5,u=d[1]&31,f=d[2]>>>7?"H":"M",h=(d[2]&64)>>6,p=(d[2]&32)>>5,g=c===2&&h?p?12:10:h?10:8,v=(d[2]&16)>>4,y=(d[2]&8)>>3,b=(d[2]&4)>>2,E=d[2]&3,T=1,I=1,M=1,H=0;s+="."+c+"."+Er(u)+f+"."+Er(g)+"."+v+"."+y+b+E+"."+Er(T)+"."+Er(I)+"."+Er(M)+"."+H,r=Hg("dav1",n)}break}}return{codec:s,encrypted:o,supplemental:r}}a(ipe,"parseStsd");function Hg(t,e){const n=Et(e,["dvvC"]),i=n.length?n[0]:Et(e,["dvcC"])[0];if(i){const s=i[2]>>1&127,r=i[2]<<5&32|i[3]>>3&31;return t+"."+Er(s)+"."+Er(r)}}a(Hg,"parseSupplementalDoViCodec");function spe(t){let e=0;for(let n=0;n<32;n++)e|=(t>>n&1)<<32-1-n;return e>>>0}a(spe,"reverse32BitInt");function gE(t,e){const n=e+5;for(;t[e++]&128&&e<n;);return e}a(gE,"skipBERInteger");function Gg(t){return("0"+t.toString(16).toUpperCase()).slice(-2)}a(Gg,"toHex");function Er(t){return(t<10?"0":"")+t}a(Er,"addLeadingZero");function rpe(t,e){if(!t||!e)return t;const n=e.keyId;return n&&e.isCommonEncryption&&Et(t,["moov","trak"]).forEach(s=>{const o=Et(s,["mdia","minf","stbl","stsd"])[0].subarray(8);let l=Et(o,["enca"]);const d=l.length>0;d||(l=Et(o,["encv"])),l.forEach(c=>{const u=d?c.subarray(28):c.subarray(78);Et(u,["sinf"]).forEach(h=>{const p=ope(h);if(p){const g=p.subarray(8,24);g.some(v=>v!==0)||(Bt.log(`[eme] Patching keyId in 'enc${d?"a":"v"}>sinf>>tenc' box: ${cl.hexDump(g)} -> ${cl.hexDump(n)}`),p.set(n,8))}})})}),t}a(rpe,"patchEncyptionData");function ope(t){const e=Et(t,["schm"])[0];if(e){const n=ti(e.subarray(4,8));if(n==="cbcs"||n==="cenc")return Et(t,["schi","tenc"])[0]}return null}a(ope,"parseSinf");function ape(t,e,n){const i={},s=Et(t,["moof","traf"]);for(let r=0;r<s.length;r++){const o=s[r],l=Et(o,["tfhd"])[0],d=ct(l,4),c=e[d];if(!c)continue;const u=i[d]||(i[d]={start:NaN,duration:0,sampleCount:0,timescale:c.timescale,type:c.type}),f=Et(o,["tfdt"])[0];if(f){const T=f[0];let I=ct(f,4);T===1&&(I===NC?n.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(I*=NC+1,I+=ct(f,8))),Pe(I)&&(!Pe(u.start)||I<u.start)&&(u.start=I)}const h=c.default,p=ct(l,0)|h?.flags;let g=h?.duration||0;p&8&&(p&2?g=ct(l,12):g=ct(l,8));const v=Et(o,["trun"]);let y=u.start||0,b=0,E=g;for(let T=0;T<v.length;T++){const I=v[T],M=ct(I,4),H=u.sampleCount;u.sampleCount+=M;const N=I[3]&1,$=I[3]&4,F=I[2]&1,D=I[2]&2,L=I[2]&4,m=I[2]&8;let S=8,_=M;for(N&&(S+=4),$&&M&&(!(I[S+1]&1)&&u.keyFrameIndex===void 0&&(u.keyFrameIndex=H),S+=4,F?(E=ct(I,S),S+=4):E=g,D&&(S+=4),m&&(S+=4),y+=E,b+=E,_--);_--;)F?(E=ct(I,S),S+=4):E=g,D&&(S+=4),L&&(I[S+1]&1||u.keyFrameIndex===void 0&&(u.keyFrameIndex=u.sampleCount-(_+1),u.keyFrameStart=y),S+=4),m&&(S+=4),y+=E,b+=E;!b&&g&&(b+=g*M)}u.duration+=b}if(!Object.keys(i).some(r=>i[r].duration)){let r=1/0,o=0;const l=Et(t,["sidx"]);for(let d=0;d<l.length;d++){const c=npe(l[d]);if(c!=null&&c.references){r=Math.min(r,c.earliestPresentationTime/c.timescale);const u=c.references.reduce((f,h)=>f+h.info.duration||0,0);o=Math.max(o,u+c.earliestPresentationTime/c.timescale)}}o&&Pe(o)&&Object.keys(i).forEach(d=>{i[d].duration||(i[d].duration=o*i[d].timescale-i[d].start)})}return i}a(ape,"getSampleData");function lpe(t){const e={valid:null,remainder:null},n=Et(t,["moof"]);if(n.length<2)return e.remainder=t,e;const i=n[n.length-1];return e.valid=t.slice(0,i.byteOffset-8),e.remainder=t.slice(i.byteOffset-8),e}a(lpe,"segmentValidRange");function Ms(t,e){const n=new Uint8Array(t.length+e.length);return n.set(t),n.set(e,t.length),n}a(Ms,"appendUint8Array");function UC(t,e){const n=[],i=e.samples,s=e.timescale,r=e.id;let o=!1;return Et(i,["moof"]).map(d=>{const c=d.byteOffset-8;Et(d,["traf"]).map(f=>{const h=Et(f,["tfdt"]).map(p=>{const g=p[0];let v=ct(p,4);return g===1&&(v*=Math.pow(2,32),v+=ct(p,8)),v/s})[0];return h!==void 0&&(t=h),Et(f,["tfhd"]).map(p=>{const g=ct(p,4),v=ct(p,0)&16777215,y=(v&1)!==0,b=(v&2)!==0,E=(v&8)!==0;let T=0;const I=(v&16)!==0;let M=0;const H=(v&32)!==0;let N=8;g===r&&(y&&(N+=8),b&&(N+=4),E&&(T=ct(p,N),N+=4),I&&(M=ct(p,N),N+=4),H&&(N+=4),e.type==="video"&&(o=Uy(e.codec)),Et(f,["trun"]).map($=>{const F=$[0],D=ct($,0)&16777215,L=(D&1)!==0;let m=0;const S=(D&4)!==0,_=(D&256)!==0;let A=0;const x=(D&512)!==0;let C=0;const U=(D&1024)!==0,R=(D&2048)!==0;let w=0;const P=ct($,4);let V=8;L&&(m=ct($,V),V+=4),S&&(V+=4);let Z=m+c;for(let ee=0;ee<P;ee++){if(_?(A=ct($,V),V+=4):A=T,x?(C=ct($,V),V+=4):C=M,U&&(V+=4),R&&(F===0?w=ct($,V):w=y3($,V),V+=4),e.type===ln.VIDEO){let ne=0;for(;ne<C;){const se=ct(i,Z);if(Z+=4,cpe(o,i[Z])){const ge=i.subarray(Z,Z+se);CA(ge,o?2:1,t+w/s,n)}Z+=se,ne+=se+4}}t+=A/s}}))})})}),n}a(UC,"parseSamples");function Uy(t){if(!t)return!1;const e=t.substring(0,4);return e==="hvc1"||e==="hev1"||e==="dvh1"||e==="dvhe"}a(Uy,"isHEVC");function cpe(t,e){if(t){const n=e>>1&63;return n===39||n===40}else return(e&31)===6}a(cpe,"isSEIMessage");function CA(t,e,n,i){const s=E3(t);let r=0;r+=e;let o=0,l=0,d=0;for(;r<s.length;){o=0;do{if(r>=s.length)break;d=s[r++],o+=d}while(d===255);l=0;do{if(r>=s.length)break;d=s[r++],l+=d}while(d===255);const c=s.length-r;let u=r;if(l<c)r+=l;else if(l>c){Bt.error(`Malformed SEI payload. ${l} is too small, only ${c} bytes left to parse.`);break}if(o===4){if(s[u++]===181){const h=v3(s,u);if(u+=2,h===49){const p=ct(s,u);if(u+=4,p===1195456820){const g=s[u++];if(g===3){const v=s[u++],y=31&v,b=64&v,E=b?2+y*3:0,T=new Uint8Array(E);if(b){T[0]=v;for(let I=1;I<E;I++)T[I]=s[u++]}i.push({type:g,payloadType:o,pts:n,bytes:T})}}}}}else if(o===5&&l>16){const f=[];for(let g=0;g<16;g++){const v=s[u++].toString(16);f.push(v.length==1?"0"+v:v),(g===3||g===5||g===7||g===9)&&f.push("-")}const h=l-16,p=new Uint8Array(h);for(let g=0;g<h;g++)p[g]=s[u++];i.push({payloadType:o,pts:n,uuid:f.join(""),userData:hs(p),userDataBytes:p})}}}a(CA,"parseSEIMessageFromNALu");function E3(t){const e=t.byteLength,n=[];let i=1;for(;i<e-2;)t[i]===0&&t[i+1]===0&&t[i+2]===3?(n.push(i+2),i+=2):i++;if(n.length===0)return t;const s=e-n.length,r=new Uint8Array(s);let o=0;for(i=0;i<s;o++,i++)o===n[0]&&(o++,n.shift()),r[i]=t[o];return r}a(E3,"discardEPB");function dpe(t){const e=t[0];let n="",i="",s=0,r=0,o=0,l=0,d=0,c=0;if(e===0){for(;ti(t.subarray(c,c+1))!=="\0";)n+=ti(t.subarray(c,c+1)),c+=1;for(n+=ti(t.subarray(c,c+1)),c+=1;ti(t.subarray(c,c+1))!=="\0";)i+=ti(t.subarray(c,c+1)),c+=1;i+=ti(t.subarray(c,c+1)),c+=1,s=ct(t,12),r=ct(t,16),l=ct(t,20),d=ct(t,24),c=28}else if(e===1){c+=4,s=ct(t,c),c+=4;const f=ct(t,c);c+=4;const h=ct(t,c);for(c+=4,o=2**32*f+h,Ghe(o)||(o=Number.MAX_SAFE_INTEGER,Bt.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),l=ct(t,c),c+=4,d=ct(t,c),c+=4;ti(t.subarray(c,c+1))!=="\0";)n+=ti(t.subarray(c,c+1)),c+=1;for(n+=ti(t.subarray(c,c+1)),c+=1;ti(t.subarray(c,c+1))!=="\0";)i+=ti(t.subarray(c,c+1)),c+=1;
3497i+=ti(t.subarray(c,c+1)),c+=1}const u=t.subarray(c,t.byteLength);return{schemeIdUri:n,value:i,timeScale:s,presentationTime:o,presentationTimeDelta:r,eventDuration:l,id:d,payload:u}}a(dpe,"parseEmsg");function upe(t,...e){const n=e.length;let i=8,s=n;for(;s--;)i+=e[s].byteLength;const r=new Uint8Array(i);for(r[0]=i>>24&255,r[1]=i>>16&255,r[2]=i>>8&255,r[3]=i&255,r.set(t,4),s=0,i=8;s<n;s++)r.set(e[s],i),i+=e[s].byteLength;return r}a(upe,"mp4Box");function fpe(t,e,n){if(t.byteLength!==16)throw new RangeError("Invalid system id");let i,s;i=0,s=new Uint8Array;let r;i>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 n&&n.byteLength>0&&new DataView(o.buffer).setUint32(0,n.byteLength,!1),upe([112,115,115,104],new Uint8Array([i,0,0,0]),t,r,s,o,n||new Uint8Array)}a(fpe,"mp4pssh");const _3=a(()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),"userAgentHevcSupportIsInaccurate"),Jd={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function PA(t,e){const n=Jd[e];return!!n&&!!n[t.slice(0,4)]}a(PA,"isCodecType");function sS(t,e,n=!0){return!t.split(",").some(i=>!DA(i,e,n))}a(sS,"areCodecsMediaSourceSupported");function DA(t,e,n=!0){var i;const s=Ua(n);return(i=s?.isTypeSupported(Ch(t,e)))!=null?i:!1}a(DA,"isCodecMediaSourceSupported");function Ch(t,e){return`${e}/mp4;codecs=${t}`}a(Ch,"mimeTypeForCodec");function BC(t){if(t){const e=t.substring(0,4);return Jd.video[e]}return 2}a(BC,"videoCodecPreferenceValue");function fv(t){const e=_3();return t.split(",").reduce((n,i)=>{const r=e&&Uy(i)?9:Jd.video[i];return r?(r*2+n)/(n?3:2):(Jd.audio[i]+n)/(n?2:1)},0)}a(fv,"codecsSetSelectionPreferenceValue");const mE={};function hpe(t,e=!0){if(mE[t])return mE[t];const n={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[t];for(let s=0;s<n.length;s++){var i;if(DA(n[s],"audio",e))return mE[t]=n[s],n[s];if(n[s]==="mp3"&&(i=Ua(e))!=null&&i.isTypeSupported("audio/mpeg"))return""}return t}a(hpe,"getCodecCompatibleNameLower");const ppe=/flac|opus|mp4a\.40\.34/i;function hv(t,e=!0){return t.replace(ppe,n=>hpe(n.toLowerCase(),e))}a(hv,"getCodecCompatibleName");function gpe(t,e){const n=[];if(t){const i=t.split(",");for(let s=0;s<i.length;s++)PA(i[s],"video")||n.push(i[s])}return e&&n.push(e),n.join(",")}a(gpe,"replaceVideoCodec");function $m(t,e){if(t&&(t.length>4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(t)!==-1)&&($C(t,"audio")||$C(t,"video")))return t;if(e){const n=e.split(",");if(n.length>1){if(t){for(let i=n.length;i--;)if(n[i].substring(0,4)===t.substring(0,4))return n[i]}return n[0]}}return e||t}a($m,"pickMostCompleteCodecName");function $C(t,e){return PA(t,e)&&DA(t,e)}a($C,"isCodecSupportedAsType");function mpe(t){const e=t.split(",");for(let n=0;n<e.length;n++){const i=e[n].split(".");i.length>2&&i[0]==="avc1"&&(e[n]=`avc1.${parseInt(i[1]).toString(16)}${("000"+parseInt(i[2]).toString(16)).slice(-4)}`)}return e.join(",")}a(mpe,"convertAVC1ToAVCOTI");function vpe(t){if(t.startsWith("av01.")){const e=t.split("."),n=["0","111","01","01","01","0"];for(let i=e.length;i>4&&i<10;i++)e[i]=n[i-4];return e.join(".")}return t}a(vpe,"fillInMissingAV01Params");function HC(t){const e=Ua(t)||{isTypeSupported:()=>!1};return{mpeg:e.isTypeSupported("audio/mpeg"),mp3:e.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:e.isTypeSupported('audio/mp4; codecs="ac-3"')}}a(HC,"getM2TSSupportedAudioTypes");function rS(t){return t.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}a(rS,"getCodecsForMimeType");const w3={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]};function S3(t,e){return{supported:!1,configurations:e,decodingInfoResults:[{supported:!1,smooth:!1,powerEfficient:!1}],error:t}}a(S3,"getUnsupportedResult");function ype(t,e,n,i,s,r){const o=t.videoCodec,l=t.audioCodec?t.audioGroups:null,d=r?.audioCodec,c=r?.channels,u=c?parseInt(c):d?1/0:2;let f=null;if(l!=null&&l.length)try{l.length===1&&l[0]?f=e.groups[l[0]].channels:f=l.reduce((h,p)=>{if(p){const g=e.groups[p];if(!g)throw new Error(`Audio track group ${p} not found`);
vendor: 16,902 bytes, lines 3497-3507
3497Object.keys(g.channels).forEach(v=>{h[v]=(h[v]||0)+g.channels[v]})}return h},{2:0})}catch{return!0}return o!==void 0&&(o.split(",").some(h=>Uy(h))||t.width>1920&&t.height>1088||t.height>1920&&t.width>1088||t.frameRate>Math.max(i,30)||t.videoRange!=="SDR"&&t.videoRange!==n||t.bitrate>Math.max(s,8e6))||!!f&&Pe(u)&&Object.keys(f).some(h=>parseInt(h)>u)}a(ype,"requiresMediaCapabilitiesDecodingInfo");function T3(t,e,n,i={}){const s=t.videoCodec;if(!s&&!t.audioCodec||!n)return Promise.resolve(w3);const r=[],o=bpe(t),l=o.length,d=Epe(t,e,l>0),c=d.length;for(let u=l||1*c||1;u--;){const f={type:"media-source"};if(l&&(f.video=o[u%l]),c){f.audio=d[u%c];const h=f.audio.bitrate;f.video&&h&&(f.video.bitrate-=h)}r.push(f)}if(s){const u=navigator.userAgent;if(s.split(",").some(f=>Uy(f))&&_3())return Promise.resolve(S3(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${u})`),r))}return Promise.all(r.map(u=>{const f=wpe(u);return i[f]||(i[f]=n.decodingInfo(u))})).then(u=>({supported:!u.some(f=>!f.supported),configurations:r,decodingInfoResults:u})).catch(u=>({supported:!1,configurations:r,decodingInfoResults:[],error:u}))}a(T3,"getMediaDecodingInfoPromise");function bpe(t){var e;const n=(e=t.videoCodec)==null?void 0:e.split(","),i=A3(t),s=t.width||640,r=t.height||480,o=t.frameRate||30,l=t.videoRange.toLowerCase();return n?n.map(d=>{const c={contentType:Ch(vpe(d),"video"),width:s,height:r,bitrate:i,framerate:o};return l!=="sdr"&&(c.transferFunction=l),c}):[]}a(bpe,"makeVideoConfigurations");function Epe(t,e,n){var i;const s=(i=t.audioCodec)==null?void 0:i.split(","),r=A3(t);return s&&t.audioGroups?t.audioGroups.reduce((o,l)=>{var d;const c=l?(d=e.groups[l])==null?void 0:d.tracks:null;return c?c.reduce((u,f)=>{if(f.groupId===l){const h=parseFloat(f.channels||"");s.forEach(p=>{const g={contentType:Ch(p,"audio"),bitrate:n?_pe(p,r):r};h&&(g.channels=""+h),u.push(g)})}return u},o):o},[]):[]}a(Epe,"makeAudioConfigurations");function _pe(t,e){if(e<=1)return 1;let n=128e3;return t==="ec-3"?n=768e3:t==="ac-3"&&(n=64e4),Math.min(e/2,n)}a(_pe,"estimatedAudioBitrate");function A3(t){return Math.ceil(Math.max(t.bitrate*.9,t.averageBitrate)/1e3)*1e3||1}a(A3,"getVariantDecodingBitrate");function wpe(t){let e="";const{audio:n,video:i}=t;if(i){const s=rS(i.contentType);e+=`${s}_r${i.height}x${i.width}f${Math.ceil(i.framerate)}${i.transferFunction||"sd"}_${Math.ceil(i.bitrate/1e5)}`}if(n){const s=rS(n.contentType);e+=`${i?"_":""}${s}_c${n.channels}`}return e}a(wpe,"getMediaDecodingInfoKey");const oS=["NONE","TYPE-0","TYPE-1",null];function Spe(t){return oS.indexOf(t)>-1}a(Spe,"isHdcpLevel");const pv=["SDR","PQ","HLG"];function Tpe(t){return!!t&&pv.indexOf(t)>-1}a(Tpe,"isVideoRange");var Hm={No:"",Yes:"YES",v2:"v2"};function GC(t){const{canSkipUntil:e,canSkipDateRanges:n,age:i}=t,s=i<e/2;return e&&s?n?Hm.v2:Hm.Yes:Hm.No}a(GC,"getSkipValue");const aI=class aI{constructor(e,n,i){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=n,this.skip=i}addDirectives(e){const n=new self.URL(e);return this.msn!==void 0&&n.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&n.searchParams.set("_HLS_part",this.part.toString()),this.skip&&n.searchParams.set("_HLS_skip",this.skip),n.href}};a(aI,"HlsUrlParameters");let gv=aI;const lI=class lI{constructor(e){if(this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.supplemental=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=e.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.codecSet=[e.videoCodec,e.audioCodec].filter(i=>!!i).map(i=>i.substring(0,4)).join(","),"supplemental"in e){var n;this.supplemental=e.supplemental;const i=(n=e.supplemental)==null?void 0:n.videoCodec;i&&i!==e.videoCodec&&(this.codecSet+=`,${i.substring(0,4)}`)}this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return VC(this._audioGroups,e)}hasSubtitleGroup(e){return VC(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,n){if(n){if(e==="audio"){let i=this._audioGroups;i||(i=this._audioGroups=[]),i.indexOf(n)===-1&&i.push(n)}else if(e==="text"){let i=this._subtitleGroups;i||(i=this._subtitleGroups=[]),i.indexOf(n)===-1&&i.push(n)}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return(e=this.audioGroups)==null?void 0:e[0]}get textGroupId(){var e;return(e=this.subtitleGroups)==null?void 0:e[0]}addFallback(){}};a(lI,"Level");let Yl=lI;function VC(t,e){return!e||!t?!1:t.indexOf(e)!==-1}a(VC,"hasGroup");function Ape(){if(typeof matchMedia=="function"){const t=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(t.media!==e.media)return t.matches===!0}return!1}a(Ape,"isHdrSupported");function xpe(t,e){let n=!1,i=[];if(t&&(n=t!=="SDR",i=[t]),e){i=e.allowedVideoRanges||pv.slice(0);const s=i.join("")!=="SDR"&&!e.videoCodec;n=e.preferHDR!==void 0?e.preferHDR:s&&Ape(),n||(i=["SDR"])}return{preferHDR:n,allowedVideoRanges:i}}a(xpe,"getVideoSelectionOptions");const Ipe=a(t=>{const e=new WeakSet;return(n,i)=>{if(t&&(i=t(n,i)),typeof i=="object"&&i!==null){if(e.has(i))return;e.add(i)}return i}},"omitCircularRefsReplacer"),hn=a((t,e)=>JSON.stringify(t,Ipe(e)),"stringify");function Lpe(t,e,n,i,s){const r=Object.keys(t),o=i?.channels,l=i?.audioCodec,d=s?.videoCodec,c=o&&parseInt(o)===2;let u=!1,f=!1,h=1/0,p=1/0,g=1/0,v=1/0,y=0,b=[];const{preferHDR:E,allowedVideoRanges:T}=xpe(e,s);for(let $=r.length;$--;){const F=t[r[$]];u||(u=F.channels[2]>0),h=Math.min(h,F.minHeight),p=Math.min(p,F.minFramerate),g=Math.min(g,F.minBitrate),T.filter(L=>F.videoRanges[L]>0).length>0&&(f=!0)}h=Pe(h)?h:0,p=Pe(p)?p:0;const I=Math.max(1080,h),M=Math.max(30,p);g=Pe(g)?g:n,n=Math.max(g,n),f||(e=void 0);const H=r.length>1;return{codecSet:r.reduce(($,F)=>{const D=t[F];if(F===$)return $;if(b=f?T.filter(L=>D.videoRanges[L]>0):[],H){if(D.minBitrate>n)return ur(F,`min bitrate of ${D.minBitrate} > current estimate of ${n}`),$;if(!D.hasDefaultAudio)return ur(F,"no renditions with default or auto-select sound found"),$;if(l&&F.indexOf(l.substring(0,4))%5!==0)return ur(F,`audio codec preference "${l}" not found`),$;if(o&&!c){if(!D.channels[o])return ur(F,`no renditions with ${o} channel sound found (channels options: ${Object.keys(D.channels)})`),$}else if((!l||c)&&u&&D.channels[2]===0)return ur(F,"no renditions with stereo sound found"),$;if(D.minHeight>I)return ur(F,`min resolution of ${D.minHeight} > maximum of ${I}`),$;if(D.minFramerate>M)return ur(F,`min framerate of ${D.minFramerate} > maximum of ${M}`),$;if(!b.some(L=>D.videoRanges[L]>0))return ur(F,`no variants with VIDEO-RANGE of ${hn(b)} found`),$;if(d&&F.indexOf(d.substring(0,4))%5!==0)return ur(F,`video codec preference "${d}" not found`),$;if(D.maxScore<y)return ur(F,`max score of ${D.maxScore} < selected max of ${y}`),$}return $&&(fv(F)>=fv($)||D.fragmentError>t[$].fragmentError)?$:(v=D.minIndex,y=D.maxScore,F)},void 0),videoRanges:b,preferHDR:E,minFramerate:p,minBitrate:g,minIndex:v}}a(Lpe,"getStartCodecTier");function ur(t,e){Bt.log(`[abr] start candidates with "${t}" ignored because ${e}`)}a(ur,"logStartCodecCandidateIgnored");function x3(t){return t.reduce((e,n)=>{let i=e.groups[n.groupId];i||(i=e.groups[n.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),i.tracks.push(n);const s=n.channels||"2";return i.channels[s]=(i.channels[s]||0)+1,i.hasDefault=i.hasDefault||n.default,i.hasAutoSelect=i.hasAutoSelect||n.autoselect,i.hasDefault&&(e.hasDefaultAudio=!0),i.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}a(x3,"getAudioTracksByGroup");function Rpe(t,e,n,i){return t.slice(n,i+1).reduce((s,r,o)=>{if(!r.codecSet)return s;const l=r.audioGroups;let d=s[r.codecSet];d||(s[r.codecSet]=d={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:o,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!l,fragmentError:0}),d.minBitrate=Math.min(d.minBitrate,r.bitrate);const c=Math.min(r.height,r.width);return d.minHeight=Math.min(d.minHeight,c),d.minFramerate=Math.min(d.minFramerate,r.frameRate),d.minIndex=Math.min(d.minIndex,o),d.maxScore=Math.max(d.maxScore,r.score),d.fragmentError+=r.fragmentError,d.videoRanges[r.videoRange]=(d.videoRanges[r.videoRange]||0)+1,l&&l.forEach(u=>{if(!u)return;const f=e.groups[u];f&&(d.hasDefaultAudio=d.hasDefaultAudio||e.hasDefaultAudio?f.hasDefault:f.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(f.channels).forEach(h=>{d.channels[h]=(d.channels[h]||0)+f.channels[h]}))}),s},{})}a(Rpe,"getCodecTiers");function WC(t){if(!t)return t;const{lang:e,assocLang:n,characteristics:i,channels:s,audioCodec:r}=t;return{lang:e,assocLang:n,characteristics:i,channels:s,audioCodec:r}}a(WC,"getBasicSelectionOption");function Rr(t,e,n){if("attrs"in t){const i=e.indexOf(t);if(i!==-1)return i}for(let i=0;i<e.length;i++){const s=e[i];if(Ol(t,s,n))return i}return-1}a(Rr,"findMatchingOption");function Ol(t,e,n){const{groupId:i,name:s,lang:r,assocLang:o,default:l}=t,d=t.forced;return(i===void 0||e.groupId===i)&&(s===void 0||e.name===s)&&(r===void 0||kpe(r,e.lang))&&(r===void 0||e.assocLang===o)&&(l===void 0||e.default===l)&&(d===void 0||e.forced===d)&&(!("characteristics"in t)||Mpe(t.characteristics||"",e.characteristics))&&(n===void 0||n(t,e))}a(Ol,"matchesOption");function kpe(t,e="--"){return t.length===e.length?t===e:t.startsWith(e)||e.startsWith(t)}a(kpe,"languagesMatch");function Mpe(t,e=""){const n=t.split(","),i=e.split(",");return n.length===i.length&&!n.some(s=>i.indexOf(s)===-1)}a(Mpe,"characteristicsMatch");function al(t,e){const{audioCodec:n,channels:i}=t;return(n===void 0||(e.audioCodec||"").substring(0,4)===n.substring(0,4))&&(i===void 0||i===(e.channels||"2"))}a(al,"audioMatchPredicate");function Cpe(t,e,n,i,s){const r=e[i],l=e.reduce((h,p,g)=>{const v=p.uri;return(h[v]||(h[v]=[])).push(g),h},{})[r.uri];l.length>1&&(i=Math.max.apply(Math,l));const d=r.videoRange,c=r.frameRate,u=r.codecSet.substring(0,4),f=zC(e,i,h=>{if(h.videoRange!==d||h.frameRate!==c||h.codecSet.substring(0,4)!==u)return!1;const p=h.audioGroups,g=n.filter(v=>!p||p.indexOf(v.groupId)!==-1);return Rr(t,g,s)>-1});return f>-1?f:zC(e,i,h=>{const p=h.audioGroups,g=n.filter(v=>!p||p.indexOf(v.groupId)!==-1);return Rr(t,g,s)>-1})}a(Cpe,"findClosestLevelWithAudioGroup");function zC(t,e,n){for(let i=e;i>-1;i--)if(n(t[i]))return i;for(let i=e+1;i<t.length;i++)if(n(t[i]))return i;return-1}a(zC,"searchDownAndUpList");function mv(t,e){var n;return!!t&&t!==((n=e.loadLevelObj)==null?void 0:n.uri)}a(mv,"useAlternateAudio");const cI=class cI extends ms{constructor(e){super("abr",e.logger),this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.rebufferNotice=-1,this.supportedCache={},this.bwEstimator=void 0,this._abandonRulesCheck=n=>{var i;const{fragCurrent:s,partCurrent:r,hls:o}=this,{autoLevelEnabled:l,media:d}=o;if(!s||!d)return;const c=performance.now(),u=r?r.stats:s.stats,f=r?r.duration:s.duration,h=c-u.loading.start,p=o.minAutoLevel,g=s.level,v=this._nextAutoLevel;if(u.aborted||u.loaded&&u.loaded===u.total||g<=p){this.clearTimer(),this._nextAutoLevel=-1;return}if(!l)return;const y=v>-1&&v!==g,b=!!n||y;if(!b&&(d.paused||!d.playbackRate||!d.readyState))return;const E=o.mainForwardBufferInfo;if(!b&&E===null)return;const T=this.bwEstimator.getEstimateTTFB(),I=Math.abs(d.playbackRate);if(h<=Math.max(T,1e3*(f/(I*2))))return;const M=E?E.len/I:0,H=u.loading.first?u.loading.first-u.loading.start:-1,N=u.loaded&&H>-1,$=this.getBwEstimate(),F=o.levels,D=F[g],L=Math.max(u.loaded,Math.round(f*(s.bitrate||D.averageBitrate)/8));let m=N?h-H:h;m<1&&N&&(m=Math.min(h,u.loaded*8/$));const S=N?u.loaded*1e3/m:0,_=T/1e3,A=S?(L-u.loaded)/S:L*8/$+_;if(A<=M)return;const x=S?S*8:$,C=((i=n?.details||this.hls.latestLevelDetails)==null?void 0:i.live)===!0,U=this.hls.config.abrBandWidthUpFactor;let R=Number.POSITIVE_INFINITY,w;for(w=g-1;w>p;w--){const ee=F[w].maxBitrate,ne=!F[w].details||C;if(R=this.getTimeToLoadFrag(_,x,f*ee,ne),R<Math.min(M,f+_))break}if(R>=A||R>f*10)return;N?this.bwEstimator.sample(h-Math.min(T,H),u.loaded):this.bwEstimator.sampleTTFB(h);const P=F[w].maxBitrate;this.getBwEstimate()*U>P&&this.resetEstimator(P);const V=this.findBestLevel(P,p,w,0,M,1,1);V>-1&&(w=V),this.warn(`Fragment ${s.sn}${r?" part "+r.index:""} of level ${g} is loading too slowly;
3498      Fragment duration: ${s.duration.toFixed(3)}
3499      Time to underbuffer: ${M.toFixed(3)} s
3500      Estimated load time for current fragment: ${A.toFixed(3)} s
3501      Estimated load time for down switch fragment: ${R.toFixed(3)} s
3502      TTFB estimate: ${H|0} ms
3503      Current BW estimate: ${Pe($)?$|0:"Unknown"} bps
3504      New BW estimate: ${this.getBwEstimate()|0} bps
3505      Switching to level ${w} @ ${P|0} bps`),o.nextLoadLevel=o.nextAutoLevel=w,this.clearTimer();const Z=a(()=>{if(this.clearTimer(),this.fragCurrent===s&&this.hls.loadLevel===w&&w>0){const ee=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${w>0?"and switching down":""}
3506      Fragment duration: ${s.duration.toFixed(3)} s
3507      Time to underbuffer: ${ee.toFixed(3)} s`),s.abortRequests(),this.fragCurrent=this.partCurrent=null,w>p){let ne=this.findBestLevel(this.hls.levels[p].bitrate,p,w,0,ee,1,1);ne===-1&&(ne=p),this.hls.nextLoadLevel=this.hls.nextAutoLevel=ne,this.resetEstimator(this.hls.levels[ne].bitrate)}}},"abortAndSwitch");y||A>R*2?Z():this.timer=self.setInterval(Z,R*1e3),o.trigger(B.FRAG_LOAD_EMERGENCY_ABORTED,{frag:s,part:r,stats:u})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(this.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const e=this.hls.config;return new eS(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(B.MANIFEST_LOADING,this.onManifestLoading,this),e.on(B.FRAG_LOADING,this.onFragLoading,this),e.on(B.FRAG_LOADED,this.onFragLoaded,this),e.on(B.FRAG_BUFFERED,this.onFragBuffered,this),e.on(B.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(B.LEVEL_LOADED,this.onLevelLoaded,this),e.on(B.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(B.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(B.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(B.MANIFEST_LOADING,this.onManifestLoading,this),e.off(B.FRAG_LOADING,this.onFragLoading,this),e.off(B.FRAG_LOADED,this.onFragLoaded,this),e.off(B.FRAG_BUFFERED,this.onFragBuffered,this),e.off(B.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(B.LEVEL_LOADED,this.onLevelLoaded,this),e.off(B.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(B.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(B.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=this.supportedCache=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,n){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.supportedCache={},this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(e,n){const i=n.frag;
vendor: 3,240 bytes, line 3507
3507if(!this.ignoreFragment(i)){if(!i.bitrateTest){var s;this.fragCurrent=i,this.partCurrent=(s=n.part)!=null?s:null}this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,n){this.clearTimer()}onError(e,n){if(!n.fatal)switch(n.details){case de.BUFFER_ADD_CODEC_ERROR:case de.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case de.FRAG_LOAD_TIMEOUT:{const i=n.frag,{fragCurrent:s,partCurrent:r}=this;if(i&&s&&i.sn===s.sn&&i.level===s.level){const o=performance.now(),l=r?r.stats:i.stats,d=o-l.loading.start,c=l.loading.first?l.loading.first-l.loading.start:-1;if(l.loaded&&c>-1){const f=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(d-Math.min(f,c),l.loaded)}else this.bwEstimator.sampleTTFB(d)}break}}}getTimeToLoadFrag(e,n,i,s){const r=e+i/n,o=s?e+this.lastLevelLoadSec:0;return r+o}onLevelLoaded(e,n){const i=this.hls.config,{loading:s}=n.stats,r=s.end-s.first;Pe(r)&&(this.lastLevelLoadSec=r/1e3),n.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(n.levelInfo)}onFragLoaded(e,{frag:n,part:i}){const s=i?i.stats:n.stats;if(n.type===Ue.MAIN&&this.bwEstimator.sampleTTFB(s.loading.first-s.loading.start),!this.ignoreFragment(n)){if(this.clearTimer(),n.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const r=i?i.duration:n.duration,o=this.hls.levels[n.level],l=(o.loaded?o.loaded.bytes:0)+s.loaded,d=(o.loaded?o.loaded.duration:0)+r;o.loaded={bytes:l,duration:d},o.realBitrate=Math.round(8*l/d)}if(n.bitrateTest){const r={stats:s,frag:n,part:i,id:n.type};this.onFragBuffered(B.FRAG_BUFFERED,r),n.bitrateTest=!1}else this.lastLoadedFragLevel=n.level}}onFragBuffered(e,n){const{frag:i,part:s}=n,r=s!=null&&s.stats.loaded?s.stats:i.stats;if(r.aborted||this.ignoreFragment(i))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.getBwEstimate(),i.bitrateTest?this.bitrateTestDelay=o/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==Ue.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:n}=this.hls,i=this.getBwEstimate(),s=this.hls.config.maxStarvationDelay,r=this.findBestLevel(i,n,e,0,s,1,1);if(r>-1)return r;const o=this.hls.firstLevel,l=Math.min(Math.max(o,n),e);return this.warn(`Could not find best starting auto level. Defaulting to first in playlist ${o} clamped to ${l}`),l}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,i=this.bwEstimator.canEstimate(),s=this.lastLoadedFragLevel>-1;if(e!==-1&&(!i||!s||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const r=i&&s?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const o=this.hls.levels;if(o.length>Math.max(e,r)&&o[e].loadError<=o[r].loadError)return e}return this._nextAutoLevel=r,this.nextAutoLevelKey=this.getAutoLevelKey(),r}getAutoLevelKey(){return`${this.getBwEstimate()}
3507_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:n,hls:i}=this;if(i.levels.length<=1)return i.loadLevel;const{maxAutoLevel:s,config:r,minAutoLevel:o}=i,l=n?n.duration:e?e.duration:0,d=this.getBwEstimate(),c=this.getStarvationDelay();let u=r.abrBandWidthFactor,f=r.abrBandWidthUpFactor;if(c){const y=this.findBestLevel(d,o,s,c,0,u,f);if(y>=0)return this.rebufferNotice=-1,y}let h=l?Math.min(l,r.maxStarvationDelay):r.maxStarvationDelay;if(!c){const y=this.bitrateTestDelay;y&&(h=(l?Math.min(l,r.maxLoadingDelay):r.maxLoadingDelay)-y,this.info(`bitrate test took ${Math.round(1e3*y)}ms, set first fragment max fetchDuration to ${Math.round(1e3*h)} ms`),u=f=1)}const p=this.findBestLevel(d,o,s,c,h,u,f);if(this.rebufferNotice!==p&&(this.rebufferNotice=p,this.info(`${c?"rebuffering expected":"buffer is empty"}, optimal quality level ${p}`)),p>-1)return p;const g=i.levels[o],v=i.loadLevelObj;return v&&g?.bitrate<v.bitrate?o:i.loadLevel}getStarvationDelay(){const e=this.hls,n=e.media;if(!n)return 1/0;const i=n&&n.playbackRate!==0?Math.abs(n.playbackRate):1,s=e.mainForwardBufferInfo;return(s?s.len:0)/i}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,n,i,s,r,o,l){var d;const c=s+r,u=this.lastLoadedFragLevel,f=u===-1?this.hls.firstLevel:u,{fragCurrent:h,partCurrent:p}=this,{levels:g,allAudioTracks:v,loadLevel:y,config:b}=this.hls;if(g.length===1)return 0;const E=g[f],T=!!((d=this.hls.latestLevelDetails)!=null&&d.live),I=y===-1||u===-1;let M,H="SDR",N=E?.frameRate||0;const{audioPreference:$,videoPreference:F}=b,D=this.audioTracksByGroup||(this.audioTracksByGroup=x3(v));let L=-1;if(I){if(this.firstSelection!==-1)return this.firstSelection;const C=this.codecTiers||(this.codecTiers=Rpe(g,D,n,i)),U=Lpe(C,H,e,$,F),{codecSet:R,videoRanges:w,minFramerate:P,minBitrate:V,minIndex:Z,preferHDR:ee}=U;L=Z,M=R,H=ee?w[w.length-1]:w[0],N=P,e=Math.max(e,V),this.log(`picked start tier ${hn(U)}`)}else M=E?.codecSet,H=E?.videoRange;const m=p?p.duration:h?h.duration:0,S=this.bwEstimator.getEstimateTTFB()/1e3,_=[];for(let C=i;C>=n;C--){var A,x;const U=g[C],R=C>f;if(!U)continue;if(b.useMediaCapabilities&&!U.supportedResult&&!U.supportedPromise){const se=navigator.mediaCapabilities;typeof se?.decodingInfo=="function"&&ype(U,D,H,N,e,$)?(U.supportedPromise=T3(U,D,se,this.supportedCache),U.supportedPromise.then(ge=>{if(!this.hls)return;U.supportedResult=ge;const ie=this.hls.levels,j=ie.indexOf(U);ge.error?this.warn(`MediaCapabilities decodingInfo error: "${ge.error}" for level ${j} ${hn(ge)}`):ge.supported?ge.decodingInfoResults.some(Y=>Y.smooth===!1||Y.powerEfficient===!1)&&this.log(`MediaCapabilities decodingInfo for level ${j} not smooth or powerEfficient: ${hn(ge)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${j} ${hn(ge)}`),j>-1&&ie.length>1&&(this.log(`Removing unsupported level ${j}`),this.hls.removeLevel(j),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))})):U.supportedResult=w3}if((M&&U.codecSet!==M||H&&U.videoRange!==H||R&&N>U.frameRate||!R&&N>0&&N<U.frameRate||(A=U.supportedResult)!=null&&(x=A.decodingInfoResults)!=null&&x.some(se=>se.smooth===!1))&&(!I||C!==L)){_.push(C);continue}const w=U.details,P=(p?w?.partTarget:w?.averagetargetduration)||m;let V;R?V=l*e:V=o*e;const Z=m&&s>=m*2&&r===0?U.averageBitrate:U.maxBitrate,ee=this.getTimeToLoadFrag(S,V,Z*P,w===void 0);if(V>=Z&&(C===u||U.loadError===0&&U.fragmentError===0)&&(ee<=S||!Pe(ee)||T&&!this.bitrateTestDelay||ee<c)){const se=this.forcedAutoLevel;return C!==y&&(se===-1||se!==y)&&(_.length&&this.trace(`Skipped level(s) ${_.join(",")} of ${i} max with CODECS and VIDEO-RANGE:"${g[_[0]].codecs}" ${g[_[0]].videoRange}; not compatible with "${M}" ${H}`),this.info(`switch candidate:${f}->${C} adjustedbw(${Math.round(V)})-bitrate=${Math.round(V-Z)} ttfb:${S.toFixed(1)} avgDuration:${P.toFixed(1)} maxFetchDuration:${c.toFixed(1)} fetchDuration:${ee.toFixed(1)} firstSelection:${I} codecSet:${U.codecSet} videoRange:${U.videoRange} hls.loadLevel:${y}`)),I&&(this.firstSelection=C),C}}return-1}set nextAutoLevel(e){const n=this.deriveNextAutoLevel(e);this._nextAutoLevel!==n&&(this.nextAutoLevelKey="",this._nextAutoLevel=n)}deriveNextAutoLevel(e){const{maxAutoLevel:n,minAutoLevel:i}=this.hls;return Math.min(Math.max(e,i),n)}};a(cI,"AbrController");let aS=cI;const I3={search:function(t,e){let n=0,i=t.length-1,s=null,r=null;for(;n<=i;){s=(n+i)/2|0,r=t[s];const o=e(r);if(o>0)n=s+1;else if(o<0)i=s-1;else return r}return null}};function Ppe(t,e,n){if(e===null||!Array.isArray(t)||!t.length||!Pe(e))return null;const i=t[0].programDateTime;if(e<(i||0))return null;const s=t[t.length-1].endProgramDateTime;if(e>=(s||0))return null;for(let r=0;r<t.length;++r){const o=t[r];if(Ope(e,n,o))return o}return null}a(Ppe,"findFragmentByPDT");function Zl(t,e,n=0,i=0,s=.005){let r=null;if(t){r=e[1+t.sn-e[0].sn]||null;const l=t.endDTS-n;l>0&&l<15e-7&&(n+=15e-7),r&&t.level!==r.level&&r.end<=t.end&&(r=e[2+t.sn-e[0].sn]||null)}else n===0&&e[0].start===0&&(r=e[0]);if(r&&((!t||t.level===r.level)&&KC(n,i,r)===0||Dpe(r,t,Math.min(s,i))))return r;const o=I3.search(e,KC.bind(null,n,i));return o&&(o!==t||!r)?o:r}a(Zl,"findFragmentByPTS");function Dpe(t,e,n){if(e&&e.start===0&&e.level<t.level&&(e.endPTS||0)>0){const i=e.tagList.reduce((s,r)=>(r[0]==="INF"&&(s+=parseFloat(r[1])),s),n);return t.start<=i}return!1}a(Dpe,"fragmentWithinFastStartSwitch");function KC(t=0,e=0,n){if(n.start<=t&&n.start+n.duration>t)return 0;const i=Math.min(e,n.duration+(n.deltaPTS?n.deltaPTS:0));return n.start+n.duration-i<=t?1:n.start-i>t&&n.start?-1:0}a(KC,"fragmentWithinToleranceTest");function Ope(t,e,n){const i=Math.min(e,n.duration+(n.deltaPTS?n.deltaPTS:0))*1e3;return(n.endProgramDateTime||0)-i>t}a(Ope,"pdtWithinToleranceTest");function L3(t,e,n){if(t&&t.startCC<=e&&t.endCC>=e){let i=t.fragments;const{fragmentHint:s}=t;s&&(i=i.concat(s));let r;return I3.search(i,o=>o.cc<e?1:o.cc>
vendor: 6,869 bytes, line 3507
3507e?-1:(r=o,o.end<=n?1:o.start>n?-1:0)),r||null}return null}a(L3,"findNearestWithCC");function vv(t){switch(t.details){case de.FRAG_LOAD_TIMEOUT:case de.KEY_LOAD_TIMEOUT:case de.LEVEL_LOAD_TIMEOUT:case de.MANIFEST_LOAD_TIMEOUT:return!0}return!1}a(vv,"isTimeoutError");function qC(t,e){const n=vv(e);return t.default[`${n?"timeout":"error"}Retry`]}a(qC,"getRetryConfig");function OA(t,e){const n=t.backoff==="linear"?1:Math.pow(2,e);return Math.min(n*t.retryDelayMs,t.maxRetryDelayMs)}a(OA,"getRetryDelay");function jC(t){return nn(nn({},t),{errorRetry:null,timeoutRetry:null})}a(jC,"getLoaderConfigWithoutReties");function yv(t,e,n,i){if(!t)return!1;const s=i?.code,r=e<t.maxNumRetry&&(Npe(s)||!!n);return t.shouldRetry?t.shouldRetry(t,e,n,i,r):r}a(yv,"shouldRetry");function Npe(t){return t===0&&navigator.onLine===!1||!!t&&(t<400||t>499)}a(Npe,"retryForHttpStatus");var wi={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},Vs={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4};const dI=class dI extends ms{constructor(e){super("error-controller",e.logger),this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(B.ERROR,this.onError,this),e.on(B.MANIFEST_LOADING,this.onManifestLoading,this),e.on(B.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(B.ERROR,this.onError,this),e.off(B.ERROR,this.onErrorOut,this),e.off(B.MANIFEST_LOADING,this.onManifestLoading,this),e.off(B.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return e?.type===Ue.MAIN?e.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(e,n){var i;if(n.fatal)return;const s=this.hls,r=n.context;switch(n.details){case de.FRAG_LOAD_ERROR:case de.FRAG_LOAD_TIMEOUT:case de.KEY_LOAD_ERROR:case de.KEY_LOAD_TIMEOUT:n.errorAction=this.getFragRetryOrSwitchAction(n);return;case de.FRAG_PARSING_ERROR:if((i=n.frag)!=null&&i.gap){n.errorAction=Ph();return}case de.FRAG_GAP:case de.FRAG_DECRYPT_ERROR:{n.errorAction=this.getFragRetryOrSwitchAction(n),n.errorAction.action=wi.SendAlternateToPenaltyBox;return}case de.LEVEL_EMPTY_ERROR:case de.LEVEL_PARSING_ERROR:{var o,l;const c=n.parent===Ue.MAIN?n.level:s.loadLevel;n.details===de.LEVEL_EMPTY_ERROR&&((o=n.context)!=null&&(l=o.levelDetails)!=null&&l.live)?n.errorAction=this.getPlaylistRetryOrSwitchAction(n,c):(n.levelRetry=!1,n.errorAction=this.getLevelSwitchAction(n,c))}return;case de.LEVEL_LOAD_ERROR:case de.LEVEL_LOAD_TIMEOUT:typeof r?.level=="number"&&(n.errorAction=this.getPlaylistRetryOrSwitchAction(n,r.level));return;case de.AUDIO_TRACK_LOAD_ERROR:case de.AUDIO_TRACK_LOAD_TIMEOUT:case de.SUBTITLE_LOAD_ERROR:case de.SUBTITLE_TRACK_LOAD_TIMEOUT:if(r){const c=s.loadLevelObj;if(c&&(r.type===wt.AUDIO_TRACK&&c.hasAudioGroup(r.groupId)||r.type===wt.SUBTITLE_TRACK&&c.hasSubtitleGroup(r.groupId))){n.errorAction=this.getPlaylistRetryOrSwitchAction(n,s.loadLevel),n.errorAction.action=wi.SendAlternateToPenaltyBox,n.errorAction.flags=Vs.MoveAllAlternatesMatchingHost;return}}return;case de.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const c=s.loadLevelObj,u=c?.attrs["HDCP-LEVEL"];u?n.errorAction={action:wi.SendAlternateToPenaltyBox,flags:Vs.MoveAllAlternatesMatchingHDCP,hdcpLevel:u}:this.keySystemError(n)}return;case de.BUFFER_ADD_CODEC_ERROR:case de.REMUX_ALLOC_ERROR:case de.BUFFER_APPEND_ERROR:if(!n.errorAction){var d;n.errorAction=this.getLevelSwitchAction(n,(d=n.level)!=null?d:s.loadLevel)}return;case de.INTERNAL_EXCEPTION:case de.BUFFER_APPENDING_ERROR:case de.BUFFER_FULL_ERROR:case de.LEVEL_SWITCH_ERROR:case de.BUFFER_STALLED_ERROR:case de.BUFFER_SEEK_OVER_HOLE:case de.BUFFER_NUDGE_ON_STALL:n.errorAction=Ph();return}n.type===Ge.KEY_SYSTEM_ERROR&&this.keySystemError(n)}keySystemError(e){const n=this.getVariantLevelIndex(e.frag);e.levelRetry=!1,e.errorAction=this.getLevelSwitchAction(e,n)}getPlaylistRetryOrSwitchAction(e,n){const i=this.hls,s=qC(i.config.playlistLoadPolicy,e),r=this.playlistError++;if(yv(s,r,vv(e),e.response))return{action:wi.RetryRequest,flags:Vs.None,retryConfig:s,retryCount:r};const l=this.getLevelSwitchAction(e,n);return s&&(l.retryConfig=s,l.retryCount=r),l}getFragRetryOrSwitchAction(e){const n=this.hls,i=this.getVariantLevelIndex(e.frag),s=n.levels[i],{fragLoadPolicy:r,keyLoadPolicy:o}=n.config,l=qC(e.details.startsWith("key")?o:r,e),d=n.levels.reduce((u,f)=>u+f.fragmentError,0);if(s&&(e.details!==de.FRAG_GAP&&s.fragmentError++,yv(l,d,vv(e),e.response)))return{action:wi.RetryRequest,flags:Vs.None,retryConfig:l,retryCount:d};const c=this.getLevelSwitchAction(e,i);return l&&(c.retryConfig=l,c.retryCount=d),c}getLevelSwitchAction(e,n){const i=this.hls;n==null&&(n=i.loadLevel);const s=this.hls.levels[n];if(s){var r,o;const c=e.details;s.loadError++,c===de.BUFFER_APPEND_ERROR&&s.fragmentError++;let u=-1;const{levels:f,loadLevel:h,minAutoLevel:p,maxAutoLevel:g}=i;!i.autoLevelEnabled&&!i.config.preserveManualLevelOnError&&(i.loadLevel=-1);const v=(r=e.frag)==null?void 0:r.type,b=(v===Ue.AUDIO&&c===de.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(c===de.BUFFER_ADD_CODEC_ERROR||c===de.BUFFER_APPEND_ERROR))&&f.some(({audioCodec:H})=>s.audioCodec!==H),T=e.sourceBufferName==="video"&&(c===de.BUFFER_ADD_CODEC_ERROR||c===de.BUFFER_APPEND_ERROR)&&f.some(({codecSet:H,audioCodec:N})=>s.codecSet!==H&&s.audioCodec===N),{type:I,groupId:M}=(o=e.context)!=null?o:{};for(let H=f.length;H--;){const N=(H+h)%f.length;if(N!==h&&N>=p&&N<=g&&f[N].loadError===0){var l,d;const $=f[N];if(c===de.FRAG_GAP&&v===Ue.MAIN&&e.frag){const F=f[N].details;if(F){const D=Zl(e.frag,F.fragments,e.frag.start);if(D!=null&&D.gap)continue}}else{if(I===wt.AUDIO_TRACK&&$.hasAudioGroup(M)||I===wt.SUBTITLE_TRACK&&$.hasSubtitleGroup(M))continue;if(v===Ue.AUDIO&&(l=s.audioGroups)!=null&&l.some(F=>$.hasAudioGroup(F))||v===Ue.SUBTITLE&&(d=s.subtitleGroups)!=null&&d.some(F=>$.hasSubtitleGroup(F))||b&&s.audioCodec===$.audioCodec||!b&&s.audioCodec!==$.audioCodec||T&&s.codecSet===$.codecSet)continue}u=N;break}}if(u>-1&&i.loadLevel!==u)return e.levelRetry=!0,this.playlistError=0,{action:wi.SendAlternateToPenaltyBox,flags:Vs.None,nextAutoLevel:u}}return{action:wi.SendAlternateToPenaltyBox,flags:Vs.MoveAllAlternatesMatchingHost}}onErrorOut(e,n){var i;switch((i=n.errorAction)==null?void 0:i.action){case wi.DoNothing:break;case wi.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(n),!n.errorAction.resolved&&n.details!==de.FRAG_GAP?n.fatal=!0:/MediaSource readyState: ended/.test(n.error.message)&&(this.warn(`MediaSource ended after "${n.sourceBufferName}
3507" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError());break}if(n.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const n=this.hls,i=e.errorAction;if(!i)return;const{flags:s,hdcpLevel:r,nextAutoLevel:o}=i;switch(s){case Vs.None:this.switchLevel(e,o);break;case Vs.MoveAllAlternatesMatchingHDCP:r&&(n.maxHdcpLevel=oS[oS.indexOf(r)-1],i.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${n.maxHdcpLevel}" or lower`);break}i.resolved||this.switchLevel(e,o)}switchLevel(e,n){if(n!==void 0&&e.errorAction&&(this.warn(`switching to level ${n} after ${e.details}`),this.hls.nextAutoLevel=n,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel,e.details===de.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&e.sourceBufferName!=="audiovideo")){const i=rS(e.mimeType),s=this.hls.levels;for(let r=s.length;r--;)s[r][`${e.sourceBufferName}Codec`]===i&&this.hls.removeLevel(r)}}};a(dI,"ErrorController");let lS=dI;function Ph(t){const e={action:wi.DoNothing,flags:Vs.None};return t&&(e.resolved=!0),e}a(Ph,"createDoNothingErrorAction");var Kn={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};const uI=class uI{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(B.MANIFEST_LOADING,this.onManifestLoading,this),e.on(B.BUFFER_APPENDED,this.onBufferAppended,this),e.on(B.FRAG_BUFFERED,this.onFragBuffered,this),e.on(B.FRAG_LOADED,this.onFragLoaded,this)}_unregisterListeners(){const{hls:e}=this;e.off(B.MANIFEST_LOADING,this.onManifestLoading,this),e.off(B.BUFFER_APPENDED,this.onBufferAppended,this),e.off(B.FRAG_BUFFERED,this.onFragBuffered,this),e.off(B.FRAG_LOADED,this.onFragLoaded,this)}destroy(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,n){const i=this.activePartLists[n];if(i)for(let s=i.length;s--;){const r=i[s];if(!r)break;const o=r.end;if(r.start<=e&&o!==null&&e<=o)return r}return this.getBufferedFrag(e,n)}getBufferedFrag(e,n){return this.getFragAtPos(e,n,!0)}getFragAtPos(e,n,i){const{fragments:s}=this,r=Object.keys(s);for(let o=r.length;o--;){const l=s[r[o]];if(l?.body.type===n&&(!i||l.buffered)){const d=l.body;if(d.start<=e&&e<=d.end)return d}}return null}detectEvictedFragments(e,n,i,s,r){this.timeRanges&&(this.timeRanges[e]=n);const o=s?.fragment.sn||-1;Object.keys(this.fragments).forEach(l=>{const d=this.fragments[l];if(!d||o>=d.body.sn)return;if(!d.buffered&&(!d.loaded||r)){d.body.type===i&&this.removeFragment(d.body);return}const c=d.range[e];if(c){if(c.time.length===0){this.removeFragment(d.body);return}c.time.some(u=>{const f=!this.isTimeBuffered(u.startPTS,u.endPTS,n);return f&&this.removeFragment(d.body),f})}})}detectPartialFragments(e){const n=this.timeRanges;if(!n||e.frag.sn==="initSegment")return;const i=e.frag,s=kc(i),r=this.fragments[s];if(!r||r.buffered&&i.gap)return;const o=!i.relurl;Object.keys(n).forEach(l=>{const d=i.elementaryStreams[l];if(!d)return;const c=n[l],u=o||d.partial===!0;r.range[l]=this.getBufferedTimes(i,e.part,u,c)}),r.loaded=null,Object.keys(r.range).length?(r.buffered=!0,(r.body.endList=i.endList||r.body.endList)&&(this.endListFragments[r.body.type]=r),Vg(r)||this.removeParts(i.sn-1,i.type)):this.removeFragment(r.body)}removeParts(e,n){const i=this.activePartLists[n];i&&(this.activePartLists[n]=YC(i,s=>s.fragment.sn>=e))}fragBuffered(e,n){const i=kc(e);let s=this.fragments[i];!s&&n&&(s=this.fragments[i]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),s&&(s.loaded=null,s.buffered=!0)}getBufferedTimes(e,n,i,s){const r={time:[],partial:i},o=e.start,l=e.end,d=e.minEndPTS||l,c=e.maxStartPTS||o;for(let u=0;u<s.length;u++){const f=s.start(u)-this.bufferPadding,h=s.end(u)+this.bufferPadding;if(c>=f&&d<=h){r.time.push({startPTS:Math.max(o,s.start(u)),endPTS:Math.min(l,s.end(u))});break}else if(o<h&&l>f){const p=Math.max(o,s.start(u)),g=Math.min(l,s.end(u));g>p&&(r.partial=!0,r.time.push({startPTS:p,endPTS:g}))}else if(l<=f)break}return r}getPartialFragment(e){let n=null,i,s,r,o=0;const{bufferPadding:l,fragments:d}=this;
vendor: 23,157 bytes, line 3507
3507return Object.keys(d).forEach(c=>{const u=d[c];u&&Vg(u)&&(s=u.body.start-l,r=u.body.end+l,e>=s&&e<=r&&(i=Math.min(e-s,r-e),o<=i&&(n=u.body,o=i)))}),n}isEndListAppended(e){const n=this.endListFragments[e];return n!==void 0&&(n.buffered||Vg(n))}getState(e){const n=kc(e),i=this.fragments[n];return i?i.buffered?Vg(i)?Kn.PARTIAL:Kn.OK:Kn.APPENDING:Kn.NOT_LOADED}isTimeBuffered(e,n,i){let s,r;for(let o=0;o<i.length;o++){if(s=i.start(o)-this.bufferPadding,r=i.end(o)+this.bufferPadding,e>=s&&n<=r)return!0;if(n<=s)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(e,n){if(n.frag.sn==="initSegment"||n.frag.bitrateTest)return;const i=n.frag,s=n.part?null:n,r=kc(i);this.fragments[r]={body:i,appendedPTS:null,loaded:s,buffered:!1,range:Object.create(null)}}onBufferAppended(e,n){const{frag:i,part:s,timeRanges:r,type:o}=n;if(i.sn==="initSegment")return;const l=i.type;if(s){let c=this.activePartLists[l];c||(this.activePartLists[l]=c=[]),c.push(s)}this.timeRanges=r;const d=r[o];this.detectEvictedFragments(o,d,l,s)}onFragBuffered(e,n){this.detectPartialFragments(n)}hasFragment(e){const n=kc(e);return!!this.fragments[n]}hasFragments(e){const{fragments:n}=this,i=Object.keys(n);if(!e)return i.length>0;for(let s=i.length;s--;){const r=n[i[s]];if(r?.body.type===e)return!0}return!1}hasParts(e){var n;return!!((n=this.activePartLists[e])!=null&&n.length)}removeFragmentsInRange(e,n,i,s,r){s&&!this.hasGaps||Object.keys(this.fragments).forEach(o=>{const l=this.fragments[o];if(!l)return;const d=l.body;d.type!==i||s&&!d.gap||d.start<n&&d.end>e&&(l.buffered||r)&&this.removeFragment(d)})}removeFragment(e){const n=kc(e);e.clearElementaryStreamInfo();const i=this.activePartLists[e.type];if(i){const s=e.sn;this.activePartLists[e.type]=YC(i,r=>r.fragment.sn!==s)}delete this.fragments[n],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){var e,n;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;const i=(e=this.hls)==null||(n=e.latestLevelDetails)==null?void 0:n.partList;i&&i.forEach(s=>s.clearElementaryStreamInfo())}};a(uI,"FragmentTracker");let cS=uI;function Vg(t){var e,n,i;return t.buffered&&(t.body.gap||((e=t.range.video)==null?void 0:e.partial)||((n=t.range.audio)==null?void 0:n.partial)||((i=t.range.audiovideo)==null?void 0:i.partial))}a(Vg,"isPartial");function kc(t){return`${t.type}_${t.level}_${t.sn}`}a(kc,"getFragmentKey");function YC(t,e){return t.filter(n=>{const i=e(n);return i||n.clearElementaryStreamInfo(),i})}a(YC,"filterParts");var Ba={cbc:0,ctr:1};const fI=class fI{constructor(e,n,i){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=e,this.aesIV=n,this.aesMode=i}decrypt(e,n){switch(this.aesMode){case Ba.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},n,e);case Ba.ctr:return this.subtle.decrypt({name:"AES-CTR",counter:this.aesIV,length:64},n,e);default:throw new Error(`[AESCrypto] invalid aes mode ${this.aesMode}`)}}};a(fI,"AESCrypto");let dS=fI;function Fpe(t){const e=t.byteLength,n=e&&new DataView(t.buffer).getUint8(e-1);return n?t.slice(0,e-n):t}a(Fpe,"removePadding");const hI=class hI{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 n=new DataView(e),i=new Uint32Array(4);for(let s=0;s<4;s++)i[s]=n.getUint32(s*4);return i}initTable(){const e=this.sBox,n=this.invSBox,i=this.subMix,s=i[0],r=i[1],o=i[2],l=i[3],d=this.invSubMix,c=d[0],u=d[1],f=d[2],h=d[3],p=new Uint32Array(256);let g=0,v=0,y=0;for(y=0;y<256;y++)y<128?p[y]=y<<1:p[y]=y<<1^283;for(y=0;y<256;y++){let b=v^v<<1^v<<2^v<<3^v<<4;b=b>>>8^b&255^99,e[g]=b,n[b]=g;const E=p[g],T=p[E],I=p[T];let M=p[b]*257^b*16843008;s[g]=M<<24|M>>>8,r[g]=M<<16|M>>>16,o[g]=M<<8|M>>>24,l[g]=M,M=I*16843009^T*65537^E*257^g*16843008,c[b]=M<<24|M>>>8,u[b]=M<<16|M>>>16,f[b]=M<<8|M>>>24,h[b]=M,g?(g=E^p[p[p[I^E]]],v^=p[p[v]]):g=v=1}}expandKey(e){const n=this.uint8ArrayToUint32Array_(e);let i=!0,s=0;for(;s<n.length&&i;)i=n[s]===this.key[s],s++;if(i)return;this.key=n;const r=this.keySize=n.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 l,d;const c=this.keySchedule=new Uint32Array(o),u=this.invKeySchedule=new Uint32Array(o),f=this.sBox,h=this.rcon,p=this.invSubMix,g=p[0],v=p[1],y=p[2],b=p[3];let E,T;for(l=0;l<o;l++){if(l<r){E=c[l]=n[l];continue}T=E,l%r===0?(T=T<<8|T>>>24,T=f[T>>>24]<<24|f[T>>>16&255]<<16|f[T>>>8&255]<<8|f[T&255],T^=h[l/r|0]<<24):r>6&&l%r===4&&(T=f[T>>>24]<<24|f[T>>>16&255]<<16|f[T>>>8&255]<<8|f[T&255]),c[l]=E=(c[l-r]^T)>>>0}for(d=0;d<o;d++)l=o-d,d&3?T=c[l]:T=c[l-4],d<4||l<=4?u[d]=T:u[d]=g[f[T>>>24]]^v[f[T>>>16&255]]^y[f[T>>>8&255]]^b[f[T&255]],u[d]=u[d]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,n,i){const s=this.keySize+6,r=this.invKeySchedule,o=this.invSBox,l=this.invSubMix,d=l[0],c=l[1],u=l[2],f=l[3],h=this.uint8ArrayToUint32Array_(i);let p=h[0],g=h[1],v=h[2],y=h[3];const b=new Int32Array(e),E=new Int32Array(b.length);let T,I,M,H,N,$,F,D,L,m,S,_,A,x;const C=this.networkToHostOrderSwap;for(;n<b.length;){for(L=C(b[n]),m=C(b[n+1]),S=C(b[n+2]),_=C(b[n+3]),N=L^r[0],$=_^r[1],F=S^r[2],D=m^r[3],A=4,x=1;x<s;x++)T=d[N>>>24]^c[$>>16&255]^u[F>>8&255]^f[D&255]^r[A],I=d[$>>>24]^c[F>>16&255]^u[D>>8&255]^f[N&255]^r[A+1],M=d[F>>>24]^c[D>>16&255]^u[N>>8&255]^f[$&255]^r[A+2],H=d[D>>>24]^c[N>>16&255]^u[$>>8&255]^f[F&255]^r[A+3],N=T,$=I,F=M,D=H,A=A+4;T=o[N>>>24]<<24^o[$>>16&255]<<16^o[F>>8&255]<<8^o[D&255]^r[A],I=o[$>>>24]<<24^o[F>>16&255]<<16^o[D>>8&255]<<8^o[N&255]^r[A+1],M=o[F>>>24]<<24^o[D>>16&255]<<16^o[N>>8&255]<<8^o[$&255]^r[A+2],H=o[D>>>24]<<24^o[N>>16&255]<<16^o[$>>8&255]<<8^o[F&255]^r[A+3],E[n]=C(T^p),E[n+1]=C(H^g),E[n+2]=C(M^v),E[n+3]=C(I^y),p=L,g=m,v=S,y=_,n=n+4}return E.buffer}};a(hI,"AESDecryptor");let uS=hI;const pI=class pI{constructor(e,n,i){this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=e,this.key=n,this.aesMode=i}expandKey(){const e=Upe(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])}};a(pI,"FastAESKey");let fS=pI;function Upe(t){switch(t){case Ba.cbc:return"AES-CBC";case Ba.ctr:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${t}`)}}a(Upe,"getSubtleAlgoName");const Bpe=16,gI=class gI{constructor(e,{removePKCS7Padding:n=!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.enableSoftwareAES=void 0,this.enableSoftwareAES=e.enableSoftwareAES,this.removePKCS7Padding=n,n)try{const i=self.crypto;i&&(this.subtle=i.subtle||i.webkitSubtle)}catch{}this.useSoftware=!this.subtle}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){const{currentResult:e,remainderData:n}=this;if(!e||n)return this.reset(),null;const i=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?Fpe(i):i}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,n,i,s){return this.useSoftware?new Promise((r,o)=>{const l=ArrayBuffer.isView(e)?e:new Uint8Array(e);this.softwareDecrypt(l,n,i,s);const d=this.flush();d?r(d.buffer):o(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),n,i,s)}softwareDecrypt(e,n,i,s){const{currentIV:r,currentResult:o,remainderData:l}=this;if(s!==Ba.cbc||n.byteLength!==16)return Bt.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),l&&(e=Ms(l,e),this.remainderData=null);const d=this.getValidChunk(e);if(!d.length)return null;r&&(i=r);let c=this.softwareDecrypter;c||(c=this.softwareDecrypter=new uS),c.expandKey(n);const u=o;return this.currentResult=c.decrypt(d.buffer,0,i),this.currentIV=d.slice(-16).buffer,u||null}webCryptoDecrypt(e,n,i,s){if(this.key!==n||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,n,i,s));this.key=n,this.fastAesKey=new fS(this.subtle,n,s)}return this.fastAesKey.expandKey().then(r=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new dS(this.subtle,new Uint8Array(i),s).decrypt(e.buffer,r)):Promise.reject(new Error("web crypto not initialized"))).catch(r=>(Bt.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${r.name}: ${r.message}`),this.onWebCryptoError(e,n,i,s)))}onWebCryptoError(e,n,i,s){const r=this.enableSoftwareAES;if(r){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,n,i,s);const o=this.flush();if(o)return o.buffer}throw new Error("WebCrypto"+(r?" and softwareDecrypt":"")+": failed to decrypt data")}getValidChunk(e){let n=e;const i=e.length-e.length%Bpe;return i!==e.length&&(n=e.slice(0,i),this.remainderData=e.slice(i)),n}logOnce(e){this.logEnabled&&(Bt.log(`[decrypter]: ${e}`),this.logEnabled=!1)}};a(gI,"Decrypter");let Dh=gI;const ZC=Math.pow(2,17),mI=class mI{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,n){const i=e.url;if(!i)return Promise.reject(new Ws({type:Ge.NETWORK_ERROR,details:de.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${i?"part list":"url"}`),networkDetails:null}));this.abort();const s=this.config,r=s.fLoader,o=s.loader;return new Promise((l,d)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(g=>g[0]==="GAP")){d(JC(e));return}else e.gap=!1;const c=this.loader=r?new r(s):new o(s),u=QC(e);e.loader=c;const f=jC(s.fragLoadPolicy.default),h={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:ZC};e.stats=c.stats;const p={onSuccess:(g,v,y,b)=>{this.resetLoader(e,c);let E=g.data;y.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(E.slice(0,16)),E=E.slice(16)),l({frag:e,part:null,payload:E,networkDetails:b})},onError:(g,v,y,b)=>{this.resetLoader(e,c),d(new Ws({type:Ge.NETWORK_ERROR,details:de.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:nn({url:i,data:void 0},g),error:new Error(`HTTP Error ${g.code} ${g.text}`),networkDetails:y,stats:b}))},onAbort:(g,v,y)=>{this.resetLoader(e,c),d(new Ws({type:Ge.NETWORK_ERROR,details:de.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:y,stats:g}))},onTimeout:(g,v,y)=>{this.resetLoader(e,c),d(new Ws({type:Ge.NETWORK_ERROR,details:de.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${h.timeout}ms`),networkDetails:y,stats:g}))}};n&&(p.onProgress=(g,v,y,b)=>n({frag:e,part:null,payload:y,networkDetails:b})),c.load(u,h,p)})}loadPart(e,n,i){this.abort();const s=this.config,r=s.fLoader,o=s.loader;return new Promise((l,d)=>{if(this.loader&&this.loader.destroy(),e.gap||n.gap){d(JC(e,n));return}const c=this.loader=r?new r(s):new o(s),u=QC(e,n);e.loader=c;const f=jC(s.fragLoadPolicy.default),h={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:ZC};n.stats=c.stats,c.load(u,h,{onSuccess:(p,g,v,y)=>{this.resetLoader(e,c),this.updateStatsFromPart(e,n);const b={frag:e,part:n,payload:p.data,networkDetails:y};i(b),l(b)},onError:(p,g,v,y)=>{this.resetLoader(e,c),d(new Ws({type:Ge.NETWORK_ERROR,details:de.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:n,response:nn({url:u.url,data:void 0},p),error:new Error(`HTTP Error ${p.code} ${p.text}`),networkDetails:v,stats:y}))},onAbort:(p,g,v)=>{e.stats.aborted=n.stats.aborted,this.resetLoader(e,c),d(new Ws({type:Ge.NETWORK_ERROR,details:de.INTERNAL_ABORTED,fatal:!1,frag:e,part:n,error:new Error("Aborted"),networkDetails:v,stats:p}))},onTimeout:(p,g,v)=>{this.resetLoader(e,c),d(new Ws({type:Ge.NETWORK_ERROR,details:de.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:n,error:new Error(`Timeout after ${h.timeout}ms`),networkDetails:v,stats:p}))}})})}updateStatsFromPart(e,n){const i=e.stats,s=n.stats,r=s.total;if(i.loaded+=s.loaded,r){const d=Math.round(e.duration/n.duration),c=Math.min(Math.round(i.loaded/r),d),f=(d-c)*Math.round(i.loaded/c);i.total=i.loaded+f}else i.total=Math.max(i.loaded,i.total);const o=i.loading,l=s.loading;o.start?o.first+=l.first-l.start:(o.start=l.start,o.first=l.first),o.end=l.end}resetLoader(e,n){e.loader=null,this.loader===n&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),n.destroy()}};a(mI,"FragmentLoader");let hS=mI;function QC(t,e=null){const n=e||t,i={frag:t,part:e,responseType:"arraybuffer",url:n.url,headers:{},rangeStart:0,rangeEnd:0},s=n.byteRangeStartOffset,r=n.byteRangeEndOffset;if(Pe(s)&&Pe(r)){var o;let l=s,d=r;if(t.sn==="initSegment"&&$pe((o=t.decryptdata)==null?void 0:o.method)){const c=r-s;c%16&&(d=r+(16-c%16)),s!==0&&(i.resetIV=!0,l=s-16)}i.rangeStart=l,i.rangeEnd=d}return i}a(QC,"createLoaderContext");function JC(t,e){const n=new Error(`GAP ${t.gap?"tag":"attribute"} found`),i={type:Ge.MEDIA_ERROR,details:de.FRAG_GAP,fatal:!1,frag:t,error:n,networkDetails:null};return e&&(i.part=e),(e||t).stats.aborted=!0,new Ws(i)}a(JC,"createGapLoadError");function $pe(t){return t==="AES-128"||t==="AES-256"}a($pe,"isMethodFullSegmentAesCbc");const vI=class vI extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}};a(vI,"LoadError");let Ws=vI;const yI=class yI extends ms{constructor(e,n){super(e,n),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(){}};a(yI,"TaskLoop");let bv=yI;const bI=class bI{constructor(e,n,i,s=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=Wg(),this.buffering={audio:Wg(),video:Wg(),audiovideo:Wg()},this.level=e,this.sn=n,this.id=i,this.size=s,this.part=r,this.partial=o}};a(bI,"ChunkMetadata");let Oh=bI;function Wg(){return{start:0,executeStart:0,executeEnd:0,end:0}}a(Wg,"getNewPerformanceTiming");const XC={length:0,start:()=>0,end:()=>0},ea=class ea{static isBuffered(e,n){if(e){const i=ea.getBuffered(e);for(let s=i.length;s--;)if(n>=i.start(s)&&n<=i.end(s))return!0}return!1}static bufferedRanges(e){if(e){const n=ea.getBuffered(e);return ea.timeRangesToArray(n)}return[]}static timeRangesToArray(e){const n=[];for(let i=0;i<e.length;i++)n.push({start:e.start(i),end:e.end(i)});return n}static bufferInfo(e,n,i){if(e){const s=ea.bufferedRanges(e);if(s.length)return ea.bufferedInfo(s,n,i)}return{len:0,start:n,end:n,bufferedIndex:-1}}static bufferedInfo(e,n,i){n=Math.max(0,n),e.length>1&&e.sort((u,f)=>u.start-f.start||f.end-u.end);let s=-1,r=[];if(i)for(let u=0;u<e.length;u++){n>=e[u].start&&n<=e[u].end&&(s=u);const f=r.length;if(f){const h=r[f-1].end;e[u].start-h<i?e[u].end>h&&(r[f-1].end=e[u].end):r.push(e[u])}else r.push(e[u])}else r=e;let o=0,l,d=n,c=n;for(let u=0;u<r.length;u++){const f=r[u].start,h=r[u].end;if(s===-1&&n>=f&&n<=h&&(s=u),n+i>=f&&n<h)d=f,c=h,o=c-n;else if(n+i<f){l=f;break}}return{len:o,start:d||0,end:c||0,nextStart:l,buffered:e,bufferedIndex:s}}static getBuffered(e){try{return e.buffered||XC}catch(n){return Bt.log("failed to get media.buffered",n),XC}}};a(ea,"BufferHelper");let gt=ea;const R3=/\{\$([a-zA-Z0-9-_]+)\}/g;function eP(t){return R3.test(t)}a(eP,"hasVariableReferences");function pS(t,e){if(t.variableList!==null||t.hasVariableRefs){const n=t.variableList;return e.replace(R3,i=>{const s=i.substring(2,i.length-1),r=n?.[s];return r===void 0?(t.playlistParsingError||(t.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${s}"`)),i):r})}return e}a(pS,"substituteVariables");function tP(t,e,n){let i=t.variableList;i||(t.variableList=i={});let s,r;if("QUERYPARAM"in e){s=e.QUERYPARAM;try{const o=new self.URL(n).searchParams;if(o.has(s))r=o.get(s);else throw new Error(`"${s}" does not match any query parameter in URI: "${n}"`)}catch(o){t.playlistParsingError||(t.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${o.message}`))}}else s=e.NAME,r=e.VALUE;s in i?t.playlistParsingError||(t.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${s}"`)):i[s]=r||""}a(tP,"addVariableDefinition");function Hpe(t,e,n){const i=e.IMPORT;if(n&&i in n){let s=t.variableList;s||(t.variableList=s={}),s[i]=n[i]}else t.playlistParsingError||(t.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${i}"`))}a(Hpe,"importVariableDefinition");const Gpe=/^(\d+)x(\d+)$/,nP=/(.+?)=(".*?"|.*?)(?:,|$)/g,$v=class $v{constructor(e,n){typeof e=="string"&&(e=$v.parseAttrList(e,n)),jt(this,e)}get clientAttrs(){return Object.keys(this).filter(e=>e.substring(0,2)==="X-")}decimalInteger(e){const n=parseInt(this[e],10);return n>Number.MAX_SAFE_INTEGER?1/0:n}hexadecimalInteger(e){if(this[e]){let n=(this[e]||"0x").slice(2);n=(n.length&1?"0":"")+n;const i=new Uint8Array(n.length/2);for(let s=0;s<n.length/2;s++)i[s]=parseInt(n.slice(s*2,s*2+2),16);return i}return null}hexadecimalIntegerAsNumber(e){const n=parseInt(this[e],16);return n>Number.MAX_SAFE_INTEGER?1/0:n}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,n){const i=this[e];return i?parseFloat(i):n}enumeratedString(e){return this[e]}enumeratedStringList(e,n){const i=this[e];return(i?i.split(/[ ,]+/):[]).reduce((s,r)=>(s[r.toLowerCase()]=!0,s),n)}bool(e){return this[e]==="YES"}decimalResolution(e){const n=Gpe.exec(this[e]);if(n!==null)return{width:parseInt(n[1],10),height:parseInt(n[2],10)}}static parseAttrList(e,n){let i;const s={},r='"';for(nP.lastIndex=0;(i=nP.exec(e))!==null;){const o=i[1].trim();let l=i[2];const d=l.indexOf(r)===0&&l.lastIndexOf(r)===l.length-1;let c=!1;if(d)l=l.slice(1,-1);else switch(o){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":c=!0}if(n&&(d||c))l=pS(n,l);else if(!c&&!d)switch(o){case"CLOSED-CAPTIONS":if(l==="NONE")break;case"ALLOWED-CPC":case"CLASS":case"ASSOC-LANGUAGE":case"AUDIO":case"BYTERANGE":case"CHANNELS":case"CHARACTERISTICS":case"CODECS":case"DATA-ID":case"END-DATE":case"GROUP-ID":case"ID":case"IMPORT":case"INSTREAM-ID":case"KEYFORMAT":case"KEYFORMATVERSIONS":case"LANGUAGE":case"NAME":case"PATHWAY-ID":case"QUERYPARAM":case"RECENTLY-REMOVED-DATERANGES":case"SERVER-URI":case"STABLE-RENDITION-ID":case"STABLE-VARIANT-ID":case"START-DATE":case"SUBTITLES":case"SUPPLEMENTAL-CODECS":case"URI":case"VALUE":case"VIDEO":case"X-ASSET-LIST":case"X-ASSET-URI":Bt.warn(`${e}: attribute ${o} is missing quotes`)}s[o]=l}return s}};a($v,"AttrList");let wn=$v;const Vpe="com.apple.hls.interstitial";function Wpe(t){return t!=="ID"&&t!=="CLASS"&&t!=="CUE"&&t!=="START-DATE"&&t!=="DURATION"&&t!=="END-DATE"&&t!=="END-ON-NEXT"}a(Wpe,"isDateRangeCueAttribute");function zpe(t){return t==="SCTE35-OUT"||t==="SCTE35-IN"||t==="SCTE35-CMD"}a(zpe,"isSCTE35Attribute");const EI=class EI{constructor(e,n,i=0){var s;if(this.attr=void 0,this.tagAnchor=void 0,this.tagOrder=void 0,this._startDate=void 0,this._endDate=void 0,this._dateAtEnd=void 0,this._cue=void 0,this._badValueForSameId=void 0,this.tagAnchor=n?.tagAnchor||null,this.tagOrder=(s=n?.tagOrder)!=null?s:i,n){const r=n.attr;for(const o in r)if(Object.prototype.hasOwnProperty.call(e,o)&&e[o]!==r[o]){Bt.warn(`DATERANGE tag attribute: "${o}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=o;break}e=jt(new wn({}),r,e)}if(this.attr=e,n?(this._startDate=n._startDate,this._cue=n._cue,this._endDate=n._endDate,this._dateAtEnd=n._dateAtEnd):this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const r=n?.endDate||new Date(this.attr["END-DATE"]);Pe(r.getTime())&&(this._endDate=r)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get cue(){const e=this._cue;return e===void 0?this._cue=this.attr.enumeratedStringList(this.attr.CUE?"CUE":"X-CUE",{pre:!1,post:!1,once:!1}):e}get startTime(){const{tagAnchor:e}=this;return e===null||e.programDateTime===null?(Bt.warn(`Expected tagAnchor Fragment with PDT set for DateRange "${this.id}": ${e}`),NaN):e.start+(this.startDate.getTime()-e.programDateTime)/1e3}get startDate(){return this._startDate}get endDate(){const e=this._endDate||this._dateAtEnd;if(e)return e;const n=this.duration;return n!==null?this._dateAtEnd=new Date(this._startDate.getTime()+n*1e3):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(Pe(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 isInterstitial(){return this.class===Vpe}get isValid(){return!!this.id&&!this._badValueForSameId&&Pe(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)&&(!this.attr.CUE||!this.cue.pre&&!this.cue.post||this.cue.pre!==this.cue.post)&&(!this.isInterstitial||"X-ASSET-URI"in this.attr||"X-ASSET-LIST"in this.attr)}};a(EI,"DateRange");let Ev=EI;const Kpe=10,_I=class _I{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.dateRangeTagCount=0,this.live=!0,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!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.drift
vendor: 4,395 bytes, line 3507
3507StartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}const n=this.lastPartSn-e.lastPartSn,i=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!i||!!n||!this.live,this.advanced=this.endSN>e.endSN||n>0||n===0&&i>0,this.updated||this.advanced?this.misses=Math.floor(e.misses*.6):this.misses=e.misses+1}get hasProgramDateTime(){return this.fragments.length?Pe(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||Kpe}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 fragmentStart(){var e;return(e=this.fragments)!=null&&e.length?this.fragments[0].start: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 maxPartIndex(){const e=this.partList;if(e){const n=this.lastPartIndex;if(n!==-1){for(let i=e.length;i--;)if(e[i].index>n)return e[i].index;return n}}return 0}get lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){const e=this.partEnd-this.fragmentStart;return this.age>Math.max(e,this.totalduration)+this.levelTargetDuration}return!1}};a(_I,"LevelDetails");let gS=_I;function bd(t){return t==="AES-128"||t==="AES-256"||t==="AES-256-CTR"}a(bd,"isFullSegmentEncryption");function NA(t){switch(t){case"AES-128":case"AES-256":return Ba.cbc;case"AES-256-CTR":return Ba.ctr;default:throw new Error(`invalid full segment method ${t}`)}}a(NA,"getAesModeFromFullSegmentMethod");function k3(t){return Uint8Array.from(atob(t),e=>e.charCodeAt(0))}a(k3,"base64Decode");function mS(t){return Uint8Array.from(unescape(encodeURIComponent(t)),e=>e.charCodeAt(0))}a(mS,"strToUtf8array");function qpe(t){const e=mS(t).subarray(0,16),n=new Uint8Array(16);return n.set(e,16-e.length),n}a(qpe,"getKeyIdBytes");function jpe(t){const e=a(function(i,s,r){const o=i[s];i[s]=i[r],i[r]=o},"swap");e(t,0,3),e(t,1,2),e(t,4,5),e(t,6,7)}a(jpe,"changeEndianness");function Ype(t){const e=t.split(":");let n=null;if(e[0]==="data"&&e.length===2){const i=e[1].split(";"),s=i[i.length-1].split(",");if(s.length===2){const r=s[0]==="base64",o=s[1];r?(i.splice(-1,1),n=k3(o)):n=qpe(o)}}return n}a(Ype,"convertDataUriToArrayBytes");const _v=typeof self<"u"?self:void 0;var On={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Qi={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function vS(t){switch(t){case Qi.FAIRPLAY:return On.FAIRPLAY;case Qi.PLAYREADY:return On.PLAYREADY;case Qi.WIDEVINE:return On.WIDEVINE;case Qi.CLEARKEY:return On.CLEARKEY}}a(vS,"keySystemFormatToKeySystemDomain");function iP(t){switch(t){case On.FAIRPLAY:return Qi.FAIRPLAY;case On.PLAYREADY:return Qi.PLAYREADY;case On.WIDEVINE:return Qi.WIDEVINE;case On.CLEARKEY:return Qi.CLEARKEY}}a(iP,"keySystemDomainToKeySystemFormat");function Gm(t){const{drmSystems:e,widevineLicenseUrl:n}=t,i=e?[On.FAIRPLAY,On.WIDEVINE,On.PLAYREADY,On.CLEARKEY].filter(s=>!!e[s]):[];return!i[On.WIDEVINE]&&n&&i.push(On.WIDEVINE),i}a(Gm,"getKeySystemsForConfig");const M3=function(t){return _v!=null&&(t=_v.navigator)!=null&&t.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function Zpe(t,e,n,i){let s;switch(t){case On.FAIRPLAY:s=["cenc","sinf"];break;case On.WIDEVINE:case On.PLAYREADY:s=["cenc"];break;case On.CLEARKEY:s=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${t}`)}return Qpe(s,e,n,i)}
vendor: 7,644 bytes, line 3507
3507a(Zpe,"getSupportedMediaKeySystemConfigurations");function Qpe(t,e,n,i){return[{initDataTypes:t,persistentState:i.persistentState||"optional",distinctiveIdentifier:i.distinctiveIdentifier||"optional",sessionTypes:i.sessionTypes||[i.sessionType||"temporary"],audioCapabilities:e.map(r=>({contentType:`audio/mp4; codecs=${r}`,robustness:i.audioRobustness||"",encryptionScheme:i.audioEncryptionScheme||null})),videoCapabilities:n.map(r=>({contentType:`video/mp4; codecs=${r}`,robustness:i.videoRobustness||"",encryptionScheme:i.videoEncryptionScheme||null}))}]}a(Qpe,"createMediaKeySystemConfigurations");function Jpe(t){var e;return t.sessionType==="persistent-license"||!!((e=t.sessionTypes)!=null&&e.some(n=>n==="persistent-license"))}a(Jpe,"isPersistentSessionType");function Xpe(t){const e=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2),n=String.fromCharCode.apply(null,Array.from(e)),i=n.substring(n.indexOf("<"),n.length),o=new DOMParser().parseFromString(i,"text/xml").getElementsByTagName("KID")[0];if(o){const l=o.childNodes[0]?o.childNodes[0].nodeValue:o.getAttribute("VALUE");if(l){const d=k3(l).subarray(0,16);return jpe(d),d}}return null}a(Xpe,"parsePlayReadyWRM");let zg={};const Hv=class Hv{static clearKeyUriToKeyIdMap(){zg={}}constructor(e,n,i,s=[1],r=null,o){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=n,this.keyFormat=i,this.keyFormatVersions=s,this.iv=r,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&!bd(e),o!=null&&o.startsWith("0x")&&(this.keyId=new Uint8Array(p3(o)))}matches(e){var n,i;return e.uri===this.uri&&e.method===this.method&&e.encrypted===this.encrypted&&e.keyFormat===this.keyFormat&&e.keyFormatVersions.join(",")===this.keyFormatVersions.join(",")&&((n=e.iv)==null?void 0:n.join(","))===((i=this.iv)==null?void 0:i.join(","))}isSupported(){if(this.method){if(bd(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case Qi.FAIRPLAY:case Qi.WIDEVINE:case Qi.PLAYREADY:case Qi.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(bd(this.method)&&this.uri&&!this.iv){typeof e!="number"&&(Bt.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0);const i=ege(e);return new Hv(this.method,this.uri,"identity",this.keyFormatVersions,i)}if(this.pssh&&this.keyId)return this;const n=Ype(this.uri);if(n)switch(this.keyFormat){case Qi.WIDEVINE:if(this.pssh=n,!this.keyId&&n.length>=22){const i=n.length-22;this.keyId=n.subarray(i,i+16)}break;case Qi.PLAYREADY:{const i=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=fpe(i,null,n),this.keyId=Xpe(n);break}default:{let i=n.subarray(0,16);if(i.length!==16){const s=new Uint8Array(16);s.set(i,16-i.length),i=s}this.keyId=i;break}}if(!this.keyId||this.keyId.byteLength!==16){let i=zg[this.uri];if(!i){const s=Object.keys(zg).length%Number.MAX_SAFE_INTEGER;i=new Uint8Array(16),new DataView(i.buffer,12,4).setUint32(0,s),zg[this.uri]=i}this.keyId=i}return this}};a(Hv,"LevelKey");let wv=Hv;function ege(t){const e=new Uint8Array(16);for(let n=12;n<16;n++)e[n]=t>>8*(15-n)&255;return e}a(ege,"createInitializationVector");const sP=/#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,rP=/#EXT-X-MEDIA:(.*)/g,tge=/^#EXT(?:INF|-X-TARGETDURATION):/m,vE=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),nge=new RegExp([/#EXT-X-(PROGRAM-DATE-TIME|BYTERANGE|DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),dl=class dl{static findGroup(e,n){for(let i=0;i<e.length;i++){const s=e[i];if(s.id===n)return s}}static resolve(e,n){return MA.buildAbsoluteURL(n,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return tge.test(e)}static parseMasterPlaylist(e,n){const i=eP(e),s={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:i},r=[];sP.lastIndex=0;let o;for(;(o=sP.exec(e))!=null;)if(o[1]){var l;const c=new wn(o[1],s),u=pS(s,o[2]),f={attrs:c,bitrate:c.decimalInteger("BANDWIDTH")||c.decimalInteger("AVERAGE-BANDWIDTH"),name:c.NAME,url:dl.resolve(u,n)},h=c.decimalResolution("RESOLUTION");h&&(f.width=h.width,f.height=h.height),lP(c.CODECS,f);const p=c["SUPPLEMENTAL-CODECS"];p&&(f.supplemental={},lP(p,f.supplemental)),(l=f.unknownCodecs)!=null&&l.length||r.push(f),s.levels.push(f)}else if(o[3]){const c=o[3],u=o[4];switch(c){case"SESSION-DATA":{const f=new wn(u,s),h=f["DATA-ID"];h&&(s.sessionData===null&&(s.sessionData={}),s.sessionData[h]=f);break}case"SESSION-KEY":{const f=oP(u,n,s);f.encrypted&&f.isSupported()?(s.sessionKeys===null&&(s.sessionKeys=[]),s.sessionKeys.push(f)):Bt.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${u}"`);break}case"DEFINE":{{const f=new wn(u,s);tP(s,f,n)}break}case"CONTENT-STEERING":{const f=new wn(u,s);s.contentSteering={uri:dl.resolve(f["SERVER-URI"],n),pathwayId:f["PATHWAY-ID"]||"."};break}case"START":{s.startTimeOffset=aP(u);break}}}const d=r.length>0&&r.length<s.levels.length;return s.levels=d?r:s.levels,s.levels.length===0&&(s.playlistParsingError=new Error("no levels found in manifest")),s}static parseMasterPlaylistMedia(e,n,i){let s;const r={},o=i.levels,l={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 d=0;for(rP.lastIndex=0;(s=rP.exec(e))!==null;){const c=new wn(s[1],i),u=c.TYPE;if(u){const f=l[u],h=r[u]||[];r[u]=h;const p=c.LANGUAGE,g=c["ASSOC-LANGUAGE"],v=c.CHANNELS,y=c.CHARACTERISTICS,b=c["INSTREAM-ID"],E={attrs:c,bitrate:0,id:d++,groupId:c["GROUP-ID"]||"",name:c.NAME||p||"",type:u,default:c.bool("DEFAULT"),autoselect:c.bool("AUTOSELECT"),forced:c.bool("FORCED"),lang:p,url:c.URI?dl.resolve(c.URI,n):""};if(g&&(E.assocLang=g),v&&(E.channels=v),y&&(E.characteristics=y),b&&(E.instreamId=b),f!=null&&f.length){const T=dl.findGroup(f,E.groupId)||f[0];cP(E,T,"audioCodec"),cP(E,T,"textCodec")}h.push(E)}}return r}static parseLevelPlaylist(e,n,i,s,r,o){var l;const d={url:n},c=new gS(n),u=c.fragments,f=[];let h=null,p=0,g=0,v=0,y=0,b=0,E=null,T=new xf(s,d),I,M,H,N=-1,$=!1,F=null,D;if(vE.lastIndex=0,c.m3u8=e,c.hasVariableRefs=eP(e),((l=vE.exec(e))==null?void 0:l[0])!=="#EXTM3U")return c.playlistParsingError=new Error("Missing format identifier #EXTM3U"),c;for(;(I=vE.exec(e))!==null;){$&&($=!1,T=new xf(s,d),T.playlistOffset=v,T.start=v,T.sn=p,T.cc=y,b&&(T.bitrate=b),T.level=i,h&&(T.initSegment=h,h.rawProgramDateTime&&(T.rawProgramDateTime=h.rawProgramDateTime,h.rawProgramDateTime=null),F&&(T.setByteRange(F),F=null)));const _=I[1];if(_){T.duration=parseFloat(_);const A=(" "+I[2]).slice(1);T.title=A||null,T.tagList.push(A?["INF",_,A]:["INF",_])}else if(I[3]){if(Pe(T.duration)){T.playlistOffset=v,T.start=v,H&&uP(T,H,c),T.sn=p,T.level=i,T.cc=y,u.push(T);const A=(" "+I[3]).slice(1);T.relurl=pS(c,A),yS(T,E,f),E=T,v+=T.duration,p++,g=0,$=!0}}
vendor: 5,204 bytes, line 3507
3507else{if(I=I[0].match(nge),!I){Bt.warn("No matches on slow regex match for level playlist!");continue}for(M=1;M<I.length&&I[M]===void 0;M++);const A=(" "+I[M]).slice(1),x=(" "+I[M+1]).slice(1),C=I[M+2]?(" "+I[M+2]).slice(1):null;switch(A){case"BYTERANGE":E?T.setByteRange(x,E):T.setByteRange(x);break;case"PROGRAM-DATE-TIME":T.rawProgramDateTime=x,T.tagList.push(["PROGRAM-DATE-TIME",x]),N===-1&&(N=u.length);break;case"PLAYLIST-TYPE":c.type&&Qr(c,A,I),c.type=x.toUpperCase();break;case"MEDIA-SEQUENCE":c.startSN!==0?Qr(c,A,I):u.length>0&&fP(c,A,I),p=c.startSN=parseInt(x);break;case"SKIP":{c.skippedSegments&&Qr(c,A,I);const U=new wn(x,c),R=U.decimalInteger("SKIPPED-SEGMENTS");if(Pe(R)){c.skippedSegments+=R;for(let P=R;P--;)u.push(null);p+=R}const w=U.enumeratedString("RECENTLY-REMOVED-DATERANGES");w&&(c.recentlyRemovedDateranges=(c.recentlyRemovedDateranges||[]).concat(w.split("	")));break}case"TARGETDURATION":c.targetduration!==0&&Qr(c,A,I),c.targetduration=Math.max(parseInt(x),1);break;case"VERSION":c.version!==null&&Qr(c,A,I),c.version=parseInt(x);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":c.live||Qr(c,A,I),c.live=!1;break;case"#":(x||C)&&T.tagList.push(C?[x,C]:[x]);break;case"DISCONTINUITY":y++,T.tagList.push(["DIS"]);break;case"GAP":T.gap=!0,T.tagList.push([A]);break;case"BITRATE":T.tagList.push([A,x]),b=parseInt(x)*1e3,Pe(b)?T.bitrate=b:b=0;break;case"DATERANGE":{const U=new wn(x,c),R=new Ev(U,c.dateRanges[U.ID],c.dateRangeTagCount);c.dateRangeTagCount++,R.isValid||c.skippedSegments?c.dateRanges[R.id]=R:Bt.warn(`Ignoring invalid DATERANGE tag: "${x}"`),T.tagList.push(["EXT-X-DATERANGE",x]);break}case"DEFINE":{{const U=new wn(x,c);"IMPORT"in U?Hpe(c,U,o):tP(c,U,n)}break}case"DISCONTINUITY-SEQUENCE":c.startCC!==0?Qr(c,A,I):u.length>0&&fP(c,A,I),c.startCC=y=parseInt(x);break;case"KEY":{const U=oP(x,n,c);if(U.isSupported()){if(U.method==="NONE"){H=void 0;break}H||(H={});const R=H[U.keyFormat];R!=null&&R.matches(U)||(R&&(H=jt({},H)),H[U.keyFormat]=U)}else Bt.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${x}"`);break}case"START":c.startTimeOffset=aP(x);break;case"MAP":{const U=new wn(x,c);if(T.duration){const R=new xf(s,d);dP(R,U,i,H),h=R,T.initSegment=h,h.rawProgramDateTime&&!T.rawProgramDateTime&&(T.rawProgramDateTime=h.rawProgramDateTime)}else{const R=T.byteRangeEndOffset;if(R){const w=T.byteRangeStartOffset;F=`${R-w}@${w}`}else F=null;dP(T,U,i,H),h=T,$=!0}h.cc=y;break}case"SERVER-CONTROL":{D&&Qr(c,A,I),D=new wn(x),c.canBlockReload=D.bool("CAN-BLOCK-RELOAD"),c.canSkipUntil=D.optionalFloat("CAN-SKIP-UNTIL",0),c.canSkipDateRanges=c.canSkipUntil>0&&D.bool("CAN-SKIP-DATERANGES"),c.partHoldBack=D.optionalFloat("PART-HOLD-BACK",0),c.holdBack=D.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{c.partTarget&&Qr(c,A,I);const U=new wn(x);c.partTarget=U.decimalFloatingPoint("PART-TARGET");break}case"PART":{let U=c.partList;U||(U=c.partList=[]);const R=g>0?U[U.length-1]:void 0,w=g++,P=new wn(x,c),V=new iS(P,T,d,w,R);U.push(V),T.duration+=V.duration;break}case"PRELOAD-HINT":{const U=new wn(x,c);c.preloadHint=U;break}case"RENDITION-REPORT":{const U=new wn(x,c);c.renditionReports=c.renditionReports||[],c.renditionReports.push(U);break}default:Bt.warn(`line parsed but not handled: ${I}`);break}}}E&&!E.relurl?(u.pop(),v-=E.duration,c.partList&&(c.fragmentHint=E)):c.partList&&(yS(T,E,f),T.cc=y,c.fragmentHint=T,H&&uP(T,H,c)),c.targetduration||(c.playlistParsingError=new Error("#EXT-X-TARGETDURATION is required"));const L=u.length,m=u[0],S=u[L-1];if(v+=c.skippedSegments*c.targetduration,v>0&&L&&S){c.averagetargetduration=v/L;const _=S.sn;c.endSN=_!=="initSegment"?_:0,c.live||(S.endList=!0),m&&c.startCC===void 0&&(c.startCC=m.cc),N>0&&(sge(u,N),m&&f.unshift(m))}else c.endSN=0,c.startCC=0;return c.fragmentHint&&(v+=c.fragmentHint.duration),c.totalduration=v,f.length&&c.dateRangeTagCount&&m&&C3(f,c),c.endCC=y,c}};a(dl,"M3U8Parser");let Il=dl;function C3(t,e){const n=t.length;if(!n)return;const i=t[n-1],s=e.live?1/0:e.totalduration,r=Object.keys(e.dateRanges);for(let o=r.length;o--;){const l=e.dateRanges[r[o]],d=l.startDate.getTime();l.tagAnchor=i.ref;for(let c=n;c--;){const u=ige(e,d,t,c,s);if(u!==-1){l.tagAnchor=e.fragments[u].ref;break}}}}a(C3,"mapDateRanges");function ige(t,e,n,i,s){const r=n[i];if(r){const l=r.programDateTime;if(e>=l||i===0){var o;const d=(((o=n[i+1])==null?void 0:o.start)||s)-r.start;if(e<=l+d*1e3){const c=n[i].sn-t.startSN,u=t.fragments;if(u.length>n.length){const h=(n[i+1]||u[u.length-1]).sn-t.startSN;for(let p=h;p>c;p--){const g=u[p].programDateTime;if(e>=g&&e<g+u[p].duration*1e3)return p}}return c}}}return-1}a(ige,"findFragmentWithStartDate");function oP(t,e,n){var i,s;const r=new wn(t,n),o=(i=r.METHOD)!=null?i:"",l=r.URI,d=r.hexadecimalInteger("IV"),c=r.KEYFORMATVERSIONS,u=(s=r.KEYFORMAT)!=null?s:"identity";l&&r.IV&&!d&&Bt.error(`Invalid IV: ${r.IV}`);const f=l?Il.resolve(l,e):"",h=(c||"1").split("/").map(Number).filter(Number.isFinite);return new wv(o,f,u,h,d,r.KEYID)}a(oP,"parseKey");function aP(t){const n=new wn(t).decimalFloatingPoint("TIME-OFFSET");return Pe(n)?n:null}a(aP,"parseStartTimeOffset");function lP(t,e){let n=(t||"").split(/[ ,]+/).filter(i=>i);["video","audio","text"].forEach(i=>
vendor: 3,427 bytes, line 3507
3507{const s=n.filter(r=>PA(r,i));s.length&&(e[`${i}Codec`]=s.map(r=>r.split("/")[0]).join(","),n=n.filter(r=>s.indexOf(r)===-1))}),e.unknownCodecs=n}a(lP,"setCodecs");function cP(t,e,n){const i=e[n];i&&(t[n]=i)}a(cP,"assignCodec");function sge(t,e){let n=t[e];for(let i=e;i--;){const s=t[i];if(!s)return;s.programDateTime=n.programDateTime-s.duration*1e3,n=s}}a(sge,"backfillProgramDateTimes");function yS(t,e,n){t.rawProgramDateTime?n.push(t):e!=null&&e.programDateTime&&(t.programDateTime=e.endProgramDateTime)}a(yS,"assignProgramDateTime");function dP(t,e,n,i){t.relurl=e.URI,e.BYTERANGE&&t.setByteRange(e.BYTERANGE),t.level=n,t.sn="initSegment",i&&(t.levelkeys=i),t.initSegment=null}a(dP,"setInitSegment");function uP(t,e,n){t.levelkeys=e;const{encryptedFragments:i}=n;(!i.length||i[i.length-1].levelkeys!==e)&&Object.keys(e).some(s=>e[s].isCommonEncryption)&&i.push(t)}a(uP,"setFragLevelKeys");function Qr(t,e,n){t.playlistParsingError=new Error(`#EXT-X-${e} must not appear more than once (${n[0]})`)}a(Qr,"assignMultipleMediaPlaylistTagOccuranceError");function fP(t,e,n){t.playlistParsingError=new Error(`#EXT-X-${e} must appear before the first Media Segment (${n[0]})`)}a(fP,"assignMustAppearBeforeSegmentsError");function yE(t,e){const n=e.startPTS;if(Pe(n)){let i=0,s;e.sn>t.sn?(i=n-t.start,s=t):(i=t.start-n,s=e),s.duration!==i&&s.setDuration(i)}else e.sn>t.sn?t.cc===e.cc&&t.minEndPTS?e.setStart(t.start+(t.minEndPTS-t.start)):e.setStart(t.start+t.duration):e.setStart(Math.max(t.start-e.duration,0))}a(yE,"updateFromToPTS");function P3(t,e,n,i,s,r){i-n<=0&&(Bt.warn("Fragment should have a positive duration",e),i=n+e.duration,r=s+e.duration);let l=n,d=i;const c=e.startPTS,u=e.endPTS;if(Pe(c)){const y=Math.abs(c-n);Pe(e.deltaPTS)?e.deltaPTS=Math.max(y,e.deltaPTS):e.deltaPTS=y,l=Math.max(n,c),n=Math.min(n,c),s=Math.min(s,e.startDTS),d=Math.min(i,u),i=Math.max(i,u),r=Math.max(r,e.endDTS)}const f=n-e.start;e.start!==0&&e.setStart(n),e.setDuration(i-e.start),e.startPTS=n,e.maxStartPTS=l,e.startDTS=s,e.endPTS=i,e.minEndPTS=d,e.endDTS=r;const h=e.sn;if(!t||h<t.startSN||h>t.endSN)return 0;let p;const g=h-t.startSN,v=t.fragments;for(v[g]=e,p=g;p>0;p--)yE(v[p],v[p-1]);for(p=g;p<v.length-1;p++)yE(v[p],v[p+1]);return t.fragmentHint&&yE(v[v.length-1],t.fragmentHint),t.PTSKnown=t.alignedSliding=!0,f}a(P3,"updateFragPTSDTS");function rge(t,e){if(t===e)return;let n=null;const i=t.fragments;for(let c=i.length-1;c>=0;c--){const u=i[c].initSegment;if(u){n=u;break}}t.fragmentHint&&delete t.fragmentHint.endPTS;let s;lge(t,e,(c,u,f,h)=>{if((!e.startCC||e.skippedSegments)&&u.cc!==c.cc){const p=c.cc-u.cc;for(let g=f;g<h.length;g++)h[g].cc+=p;e.endCC=h[h.length-1].cc}Pe(c.startPTS)&&Pe(c.endPTS)&&(u.setStart(u.startPTS=c.startPTS),u.startDTS=c.startDTS,u.maxStartPTS=c.maxStartPTS,u.endPTS=c.endPTS,u.endDTS=c.endDTS,u.minEndPTS=c.minEndPTS,u.setDuration(c.endPTS-c.startPTS),u.duration&&(s=u),e.PTSKnown=e.alignedSliding=!0),c.hasStreams&&(u.elementaryStreams=c.elementaryStreams),u.loader=c.loader,c.hasStats&&(u.stats=c.stats),c.initSegment&&(u.initSegment=c.initSegment,n=c.initSegment)});const r=e.fragments,o=e.fragmentHint?r.concat(e.fragmentHint):r;if(n&&o.forEach(c=>{var u;c&&(!c.initSegment||c.initSegment.relurl===((u=n)==null?void 0:u.relurl))&&(c.initSegment=n)}),e.skippedSegments){if(e.deltaUpdateFailed=r.some(c=>!c),e.deltaUpdateFailed){Bt.warn("[level-helper] Previous playlist missing segments ski
3507pped in delta playlist");for(let c=e.skippedSegments;c--;)r.shift();e.startSN=r[0].sn}else{e.canSkipDateRanges&&(e.dateRanges=oge(t.dateRanges,e));const c=t.fragments.filter(u=>u.rawProgramDateTime);if(t.hasProgramDateTime&&!e.hasProgramDateTime)for(let u=1;u<o.length;u++)o[u].programDateTime===null&&yS(o[u],o[u-1],c);C3(c,e)}e.endCC=r[r.length-1].cc}if(!e.startCC){var l;const c=N3(t,e.startSN-1);e.startCC=(l=c?.cc)!=null?l:r[0].cc}age(t.partList,e.partList,(c,u)=>{u.elementaryStreams=c.elementaryStreams,u.stats=c.stats}),s?P3(e,s,s.startPTS,s.endPTS,s.startDTS,s.endDTS):D3(t,e),r.length&&(e.totalduration=e.edge-r[0].start),e.driftStartTime=t.driftStartTime,e.driftStart=t.driftStart;const d=e.advancedDateTime;if(e.advanced&&d){const c=e.edge;e.driftStart||(e.driftStartTime=d,e.driftStart=c),e.driftEndTime=d,e.driftEnd=c}else e.driftEndTime=t.driftEndTime,e.driftEnd=t.driftEnd,e.advancedDateTime=t.advancedDateTime;e.requestScheduled===-1&&(e.requestScheduled=t.requestScheduled)}a(rge,"mergeDetails");function oge(t,e){const{dateRanges:n,recentlyRemovedDateranges:i}=e,s=jt({},t);i&&i.forEach(l=>{delete s[l]});const o=Object.keys(s).length;return o&&Object.keys(n).forEach(l=>{const d=s[l],c=new Ev(n[l].attr,d);c.isValid?(s[l]=c,d||(c.tagOrder+=o)):Bt.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${hn(n[l].attr)}"`)}),s}a(oge,"mergeDateRanges");function age(t,e,n){if(t&&e){let i=0;for(let s=0,r=t.length;s<=r;s++){const o=t[s],l=e[s+i];o&&l&&o.index===l.index&&o.fragment.sn===l.fragment.sn?n(o,l):i--}}}a(age,"mapPartIntersection");function lge(t,e,n){const i=e.skippedSegments,s=Math.max(t.startSN,e.startSN)-e.startSN,r=(t.fragmentHint?1:0)+(i?e.endSN:Math.min(t.endSN,e.endSN))-e.startSN,o=e.startSN-t.startSN,l=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,d=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments;for(let c=s;c<=r;c++){const u=d[o+c];let f=l[c];if(i&&!f&&u&&(f=e.fragments[c]=u),u&&f){if(n(u,f,c,l),u.url&&u.url!==f.url){e.playlistParsingError=hP(`media sequence mismatch ${f.sn}:`,t,e,u,f);return}else if(u.cc!==f.cc){e.playlistParsingError=hP(`discontinuity sequence mismatch (${u.cc}!=${f.cc})`,t,e,u,f);return}}}}a(lge,"mapFragmentIntersection");function hP(t,e,n,i,s){return new Error(`${t} ${s.url}
3508Playlist starting @${e.startSN}
3509${e.m3u8}
3510
3511Playlist starting @${n.startSN}
3512${n.m3u8}`)}a(hP,"getSequenceError");function D3(t,e,n=!0){const i=e.startSN+e.skippedSegments-t.startSN,s=t.fragments,r=i>=0;let o=0;if(r&&i<s.length)o=s[i].start;else if(r&&e.startSN===t.endSN+1)o=t.fragmentEnd;else if(r&&n)o=t.fragmentStart+i*e.levelTargetDuration;else if(!e.skippedSegments&&e.fragmentStart===0)o=t.fragmentStart;else return;bS(e,o)}a(D3,"adjustSliding");function bS(t,e){if(e){const n=t.fragments;for(let i=t.skippedSegments;i<n.length;i++)n[i].addStart(e);t.fragmentHint&&t.fragmentHint.addStart(e)}}a(bS,"addSliding");function O3(t,e=1/0){let n=1e3*t.targetduration;if(t.updated){const i=t.fragments,s=4;if(i.length&&n*s>e){const r=i[i.length-1].duration*1e3;r<n&&(n=r)}}else n/=2;return Math.round(n)}a(O3,"computeReloadInterval");function N3(t,e,n){if(!t)return null;let i=t.fragments[e-t.startSN];return i||(i=t.fragmentHint,i&&i.sn===e)?i:e<t.startSN&&n&&n.sn===e?n:null}a(N3,"getFragmentWithSN");function pP(t,e,n){return t?F3(t.partList,e,n):null}a(pP,"getPartWith");function F3(t,e,n){if(t)for(let i=t.length;i--;){const s=t[i];if(s.index===n&&s.fragment.sn===e)return s}return null}a(F3,"findPart");function U3(t){t.forEach((e,n)=>{var i;(i=e.details)==null||i.fragments.forEach(s=>{s.level=n,s.initSegment&&(s.initSegment.level=n)})})}a(U3,"reassignFragmentLevelIndexes");function If(t,e){for(let i=0,s=t.length;i<s;i++){var n;if(((n=t[i])==null?void 0:n.cc)===e)return t[i]}return null}a(If,"findFirstFragWithCC");function cge(t,e){return!!(t&&e.startCC<t.endCC&&e.endCC>t.startCC)}a(cge,"shouldAlignOnDiscontinuities");function gP(t,e){if(t){const n=t.start+e;t.start=t.startPTS=n,t.endPTS=n+t.duration}}a(gP,"adjustFragmentStart");function B3(t,e){const n=e.fragments;for(let i=0,s=n.length;i<s;i++)gP(n[i],t);e.fragmentHint&&gP(e.fragmentHint,t),e.alignedSliding=!0}a(B3,"adjustSlidingStart");
vendor: 4,418 bytes, line 3512
3512function dge(t,e){t&&($3(e,t),!e.alignedSliding&&t&&Sv(e,t),!e.alignedSliding&&t&&!e.skippedSegments&&D3(t,e,!1))}a(dge,"alignStream");function $3(t,e){if(!cge(e,t))return;const n=Math.min(e.endCC,t.endCC),i=If(e.fragments,n),s=If(t.fragments,n);if(!i||!s)return;Bt.log(`Aligning playlist at start of dicontinuity sequence ${n}`);const r=i.start-s.start;B3(r,t)}a($3,"alignDiscontinuities");function Sv(t,e){if(!t.hasProgramDateTime||!e.hasProgramDateTime)return;const n=t.fragments,i=e.fragments;if(!n.length||!i.length)return;let s,r;const o=Math.min(e.endCC,t.endCC);e.startCC<o&&t.startCC<o&&(s=If(i,o),r=If(n,o)),(!s||!r)&&(s=i[Math.floor(i.length/2)],r=If(n,s.cc)||n[Math.floor(n.length/2)]);const l=s.programDateTime,d=r.programDateTime;if(!l||!d)return;const c=(d-l)/1e3-(r.start-s.start);B3(c,t)}a(Sv,"alignMediaPlaylistByPDT");const uge={toString:function(t){let e="";const n=t.length;for(let i=0;i<n;i++)e+=`[${t.start(i).toFixed(3)}-${t.end(i).toFixed(3)}]`;return e}},be={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"},wI=class wI extends bv{constructor(e,n,i,s,r){super(s,e.logger),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=be.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.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.buffering=!0,this.loadingParts=!1,this.loopSn=void 0,this.onMediaSeeking=()=>{const{config:o,fragCurrent:l,media:d,mediaBuffer:c,state:u}=this,f=d?d.currentTime:0,h=gt.bufferInfo(c||d,f,o.maxBufferHole),p=!h.len;if(this.log(`Media seeking to ${Pe(f)?f.toFixed(3):f}, state: ${u}, ${p?"out of":"in"} buffer`),this.state===be.ENDED)this.resetLoadingState();else if(l){const g=o.maxFragLookUpTolerance,v=l.start-g,y=l.start+l.duration+g;if(p||y<h.start||v>h.end){const b=f>y;(f<v||b)&&(b&&l.loader&&(this.log(`Cancelling fragment load for seek (sn: ${l.sn})`),l.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}if(d){this.fragmentTracker.removeFragmentsInRange(f,1/0,this.playlistType,!0);const g=this.lastCurrentTime;if(f>g&&(this.lastCurrentTime=f),!this.loadingParts){const v=Math.max(h.end,f),y=this.shouldLoadParts(this.getLevelDetails(),v);y&&(this.log(`LL-Part loading ON after seeking to ${f.toFixed(2)} with buffer @${v.toFixed(2)}`),this.loadingParts=y)}}this.hls.hasEnoughToStart||(this.log(`Setting ${p?"startPosition":"nextLoadPosition"} to ${f} for seek without enough to start`),this.nextLoadPosition=f,p&&(this.startPosition=f)),this.tickImmediate()},this.onMediaEnded=()=>{this.log("setting startPosition to 0 because media ended"),this.startPosition=this.lastCurrentTime=0},this.playlistType=r,this.hls=e,this.fragmentLoader=new hS(e.config),this.keyLoader=i,this.fragmentTracker=n,this.config=e.config,this.decrypter=new Dh(e.config)}registerListeners(){const{hls:e}=this;e.on(B.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(B.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(B.MANIFEST_LOADING,this.onManifestLoading,this),e.on(B.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(B.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(B.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(B.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(B.MANIFEST_LOADING,this.onManifestLoading,this),e.off(B.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(B.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){if(this.state===be.STOPPED)return;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=be.STOPPED}get startPositionValue(){const{nextLoadPosition:e,startPosition:n}=this;return n===-1&&e?e:n}get bufferingEnabled(){return this.buffering}
vendor: 25,178 bytes, line 3512
3512pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}get inFlightFrag(){return{frag:this.fragCurrent,state:this.state}}_streamEnded(e,n){if(n.live||!this.media)return!1;const i=e.end||0,s=this.config.timelineOffset||0;if(i<=s)return!1;const r=e.buffered;this.config.maxBufferHole&&r&&r.length>1&&(e=gt.bufferedInfo(r,e.start,0));const o=e.nextStart;if(o&&o>s&&o<n.edge||this.media.currentTime<e.start)return!1;const d=n.partList;if(d!=null&&d.length){const u=d[d.length-1];return gt.isBuffered(this.media,u.start+u.duration/2)}const c=n.fragments[n.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(c)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null){var e;return(e=this.levelLastLoaded)==null?void 0:e.details}}get timelineOffset(){const e=this.config.timelineOffset;if(e){var n;return((n=this.getLevelDetails())==null?void 0:n.appliedTimelineOffset)||e}return 0}onMediaAttached(e,n){const i=this.media=this.mediaBuffer=n.media;i.removeEventListener("seeking",this.onMediaSeeking),i.removeEventListener("ended",this.onMediaEnded),i.addEventListener("seeking",this.onMediaSeeking),i.addEventListener("ended",this.onMediaEnded);const s=this.config;this.levels&&s.autoStartLoad&&this.state===be.STOPPED&&this.startLoad(s.startPosition)}onMediaDetaching(e,n){const i=!!n.transferMedia,s=this.media;if(s!==null){if(s.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),s.removeEventListener("seeking",this.onMediaSeeking),s.removeEventListener("ended",this.onMediaEnded),this.keyLoader&&!i&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loopSn=void 0,i){this.resetLoadingState(),this.resetTransmuxer();return}this.loadingParts=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}}onManifestLoading(){this.initPTS=[],this.levels=this.levelLastLoaded=this.fragCurrent=null,this.lastCurrentTime=this.startPosition=0,this.startFragRequested=!1}onError(e,n){}onManifestLoaded(e,n){this.startTimeOffset=n.startTimeOffset}onHandlerDestroying(){this.stopLoad(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),super.onHandlerDestroying(),this.hls=this.onMediaSeeking=this.onMediaEnded=null}onHandlerDestroyed(){this.state=be.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,n,i){this.startFragRequested=!0,this._loadFragForPlayback(e,n,i)}_loadFragForPlayback(e,n,i){const s=a(r=>{const o=r.frag;if(this.fragContextChanged(o)){this.warn(`${o.type} sn: ${o.sn}${r.part?" part: "+r.part.index:""} of ${this.fragInfo(o,!1,r.part)}) was dropped during download.`),this.fragmentTracker.removeFragment(o);return}o.stats.chunkCount++,this._handleFragmentLoadProgress(r)},"progressCallback");this._doFragLoad(e,n,i,s).then(r=>{if(!r)return;const o=this.state,l=r.frag;if(this.fragContextChanged(l)){(o===be.FRAG_LOADING||!this.fragCurrent&&o===be.PARSING)&&(this.fragmentTracker.removeFragment(l),this.state=be.IDLE);return}"payload"in r&&(this.log(`Loaded ${l.type} sn: ${l.sn} of ${this.playlistLabel()} ${l.level}`),this.hls.trigger(B.FRAG_LOADED,r)),this._handleFragmentLoadComplete(r)}).catch(r=>{this.state===be.STOPPED||this.state===be.ERROR||(this.warn(`Frag error: ${r?.message||r}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var n;const{fragmentTracker:i}=this;if(i.getState(e)===Kn.APPENDING){const r=e.type,o=this.getFwdBufferInfo(this.mediaBuffer,r),l=Math.max(e.duration,o?o.len:this.config.maxBufferLength),d=this.backtrackFragment;((d?e.sn-d.sn:0)===1||this.reduceMaxBufferLength(l,e.duration))&&i.removeFragment(e)}else((n=this.mediaBuffer)==null?void 0:n.buffered.length)===0?i.removeAllFragments():i.hasParts(e.type)&&(i.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),i.getState(e)===Kn.PARTIAL&&i.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const n=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:n,part:null,stats:n.stats,id:n.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}waitForLive(e){const n=e.details;return n?.live&&n.type!=="EVENT"&&(this.levelLastLoaded!==e||n.expired)}flushMainBuffer(e,n,i=null){if(!(e-n))return;const s={startOffset:e,endOffset:n,type:i};this.hls.trigger(B.BUFFER_FLUSHING,s)}_loadInitSegment(e,n){this._doFragLoad(e,n).then(i=>{const s=i?.frag;if(!s||this.fragContextChanged(s)||!this.levels)throw new Error("init load aborted");return i}).then(i=>{const{hls:s}=this,{frag:r,payload:o}=i,l=r.decryptdata;if(o&&o.byteLength>0&&l!=null&&l.key&&l.iv&&bd(l.method)){const d=self.performance.now();return this.decrypter.decrypt(new Uint8Array(o),l.key.buffer,l.iv.buffer,NA(l.method)).catch(c=>{throw s.trigger(B.ERROR,{type:Ge.MEDIA_ERROR,details:de.FRAG_DECRYPT_ERROR,fatal:!1,error:c,reason:c.message,frag:r}),c}).then(c=>{const u=self.performance.now();return s.trigger(B.FRAG_DECRYPTED,{frag:r,payload:c,stats:{tstart:d,tdecrypt:u}}),i.payload=c,this.completeInitSegmentLoad(i)})}return this.completeInitSegmentLoad(i)}).catch(i=>{this.state===be.STOPPED||this.state===be.ERROR||(this.warn(i),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:n}=this;if(!n)throw new Error("init load aborted, missing levels");const i=e.frag.stats;this.state!==be.STOPPED&&(this.state=be.IDLE),e.frag.data=new Uint8Array(e.payload),i.parsing.start=i.buffering.start=self.performance.now(),i.parsing.end=i.buffering.end=self.performance.now(),this.tick()}fragContextChanged(e){const{fragCurrent:n}=this;return!e||!n||e.sn!==n.sn||e.level!==n.level}fragBufferedComplete(e,n){const i=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${n?" part: "+n.index:""} of ${this.fragInfo(e,!1,n)} > buffer:${i?uge.toString(gt.getBuffered(i)):"(detached)"})`),$n(e)){var s;if(e.type!==Ue.SUBTITLE){const o=e.elementaryStreams;if(!Object.keys(o).some(l=>!!o[l])){this.state=be.IDLE;return}}const r=(s=this.levels)==null?void 0:s[e.level];r!=null&&r.fragmentError&&(this.log(`Resetting level fragment error count of ${r.fragmentError} on frag buffered`),r.fragmentError=0)}this.state=be.IDLE}_handleFragmentLoadComplete(e){const{transmuxer:n}=this;if(!n)return;const{frag:i,part:s,partsLoaded:r}=e,o=!r||r.length===0||r.some(d=>!d),l=new Oh(i.level,i.sn,i.stats.chunkCount+1,0,s?s.index:-1,!o);n.flush(l)}_handleFragmentLoadProgress(e){}_doFragLoad(e,n,i=null,s){var r;this.fragCurrent=e;const o=n?.details;if(!this.levels||!o)throw new Error(`frag load aborted, missing level${o?"":" detail"}s`);let l=null;e.encrypted&&!((r=e.decryptdata)!=null&&r.key)?(this.log(`Loading key for ${e.sn} of [${o.startSN}-${o.endSN}], ${this.playlistLabel()} ${e.level}`),this.state=be.KEY_LOADING,this.fragCurrent=e,l=this.keyLoader.load(e).then(f=>{if(!this.fragContextChanged(f.frag))return this.hls.trigger(B.KEY_LOADED,f),this.state===be.KEY_LOADING&&(this.state=be.IDLE),f}),this.hls.trigger(B.KEY_LOADING,{frag:e}),this.fragCurrent===null&&(l=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))):e.encrypted||(l=this.keyLoader.loadClear(e,o.encryptedFragments,this.startFragRequested),l&&this.log("[eme] blocking frag load until media-keys acquired"));const d=this.fragPrevious;if($n(e)&&(!d||e.sn!==d.sn)){const f=this.shouldLoadParts(n.details,e.end);f!==this.loadingParts&&(this.log(`LL-Part loading ${f?"ON":"OFF"} loading sn ${d?.sn}->${e.sn}`),this.loadingParts=f)}if(i=Math.max(e.start,i||0),this.loadingParts&&$n(e)){const f=o.partList;if(f&&s){i>e.end&&o.fragmentHint&&(e=o.fragmentHint);const h=this.getNextPart(f,e,i);if(h>-1){const p=f[h];e=this.fragCurrent=p.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${p.index} (${h}/${f.length-1}) of ${this.fragInfo(e,!1,p)}) cc: ${e.cc} [${o.startSN}-${o.endSN}], target: ${parseFloat(i.toFixed(3))}`),this.nextLoadPosition=p.start+p.duration,this.state=be.FRAG_LOADING;let g;return l?g=l.then(v=>!v||this.fragContextChanged(v.frag)?null:this.doFragPartsLoad(e,p,n,s)).catch(v=>this.handleFragLoadError(v)):g=this.doFragPartsLoad(e,p,n,s).catch(v=>this.handleFragLoadError(v)),this.hls.trigger(B.FRAG_LOADING,{frag:e,part:p,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):g}else if(!e.url||this.loadedEndOfParts(f,i))return Promise.resolve(null)}}if($n(e)&&this.loadingParts)this.log(`LL-Part loading OFF after next part miss @${i.toFixed(2)}`),this.loadingParts=!1;else if(!e.url)return Promise.resolve(null);this.log(`Loading ${e.type} sn: ${e.sn} of ${this.fragInfo(e,!1)}) cc: ${e.cc} ${o?"["+o.startSN+"-"+o.endSN+"]":""}, target: ${parseFloat(i.toFixed(3))}`),Pe(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=be.FRAG_LOADING;const c=this.config.progressive;let u;return c&&l?u=l.then(f=>!f||this.fragContextChanged(f?.frag)?null:this.fragmentLoader.load(e,s)).catch(f=>this.handleFragLoadError(f)):u=Promise.all([this.fragmentLoader.load(e,c?s:void 0),l]).then(([f])=>(!c&&f&&s&&s(f),f)).catch(f=>this.handleFragLoadError(f)),this.hls.trigger(B.FRAG_LOADING,{frag:e,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):u}doFragPartsLoad(e,n,i,s){return new Promise((r,o)=>{var l;const d=[],c=(l=i.details)==null?void 0:l.partList,u=a(f=>{this.fragmentLoader.loadPart(e,f,s).then(h=>{d[f.index]=h;const p=h.part;this.hls.trigger(B.FRAG_LOADED,h);const g=pP(i.details,e.sn,f.index+1)||F3(c,e.sn,f.index+1);if(g)u(g);else return r({frag:e,part:p,partsLoaded:d})}).catch(o)},"loadPart");u(n)})}handleFragLoadError(e){if("data"in e){const n=e.data;e.data&&n.details===de.INTERNAL_ABORTED?this.handleFragLoadAborted(n.frag,n.part):this.hls.trigger(B.ERROR,n)}else this.hls.trigger(B.ERROR,{type:Ge.OTHER_ERROR,details:de.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const n=this.getCurrentContext(e);if(!n||this.state!==be.PARSING){!this.fragCurrent&&this.state!==be.STOPPED&&this.state!==be.ERROR&&(this.state=be.IDLE);return}const{frag:i,part:s,level:r}=n,o=self.performance.now();i.stats.parsing.end=o,s&&(s.stats.parsing.end=o);const l=this.getLevelDetails(),c=l&&i.sn>l.endSN||this.shouldLoadParts(l,i.end);c!==this.loadingParts&&(this.log(`LL-Part loading ${c?"ON":"OFF"} after parsing segment ending @${i.end.toFixed(2)}`),this.loadingParts=c),this.updateLevelTiming(i,s,r,e.partial)}shouldLoadParts(e,n){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e!=null&&e.partList){var i;const r=e.partList[0],o=r.end+(((i=e.fragmentHint)==null?void 0:i.duration)||0);if(n>=o){var s;if((this.hls.hasEnoughToStart?((s=this.media)==null?void 0:s.currentTime)||this.lastCurrentTime:this.getLoadPosition())>r.start-r.fragment.duration)return!0}}}return!1}getCurrentContext(e){const{levels:n,fragCurrent:i}=this,{level:s,sn:r,part:o}=e;if(!(n!=null&&n[s]))return this.warn(`Levels object was unset while buffering fragment ${r} of ${this.playlistLabel()} ${s}. The current chunk will not be buffered.`),null;const l=n[s],d=l.details,c=o>-1?pP(d,r,o):null,u=c?c.fragment:N3(d,r,i);return u?(i&&i!==u&&(u.stats=i.stats),{frag:u,part:c,level:l}):null}bufferFragmentData(e,n,i,s,r){var o;if(!e||this.state!==be.PARSING)return;const{data1:l,data2:d}=e;let c=l;if(l&&d&&(c=Ms(l,d)),!((o=c)!=null&&o.length))return;const u=this.initPTS[n.cc],f=u?-u.baseTime/u.timescale:void 0,h={type:e.type,frag:n,part:i,chunkMeta:s,offset:f,parent:n.type,data:c};if(this.hls.trigger(B.BUFFER_APPENDING,h),e.dropped&&e.independent&&!i){if(r)return;this.flushBufferGap(n)}}flushBufferGap(e){const n=this.media;if(!n)return;if(!gt.isBuffered(n,n.currentTime)){this.flushMainBuffer(0,e.start);return}const i=n.currentTime,s=gt.bufferInfo(n,i,0),r=e.duration,o=Math.min(this.config.maxFragLookUpTolerance*2,r*.25),l=Math.max(Math.min(e.start-o,s.end-o),i+o);e.start-l>o&&this.flushMainBuffer(l,e.start)}getFwdBufferInfo(e,n){var i;const s=this.getLoadPosition();if(!Pe(s))return null;const o=this.lastCurrentTime>s||(i=this.media)!=null&&i.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,s,n,o)}getFwdBufferInfoAtPos(e,n,i,s){const r=gt.bufferInfo(e,n,s);if(r.len===0&&r.nextStart!==void 0){const o=this.fragmentTracker.getBufferedFrag(n,i);if(o&&(r.nextStart<=o.end||o.gap)){const l=Math.max(Math.min(r.nextStart,o.end)-n,s);return gt.bufferInfo(e,n,l)}}return r}getMaxBufferLength(e){const{config:n}=this;let i;return e?i=Math.max(8*n.maxBufferSize/e,n.maxBufferLength):i=n.maxBufferLength,Math.min(i,n.maxMaxBufferLength)}reduceMaxBufferLength(e,n){const i=this.config,s=Math.max(Math.min(e-n,i.maxBufferLength),n),r=Math.max(e-n*3,i.maxMaxBufferLength/2,s);return r>=s?(i.maxMaxBufferLength=r,this.warn(`Reduce max buffer length to ${r}s`),!0):!1}getAppendedFrag(e,n=Ue.MAIN){var i;const s=(i=this.fragmentTracker)==null?void 0:i.getAppendedFrag(e,n);return s&&"fragment"in s?s.fragment:s}getNextFragment(e,n){const i=n.fragments,s=i.length;if(!s)return null;const{config:r}=this,o=i[0].start,l=r.lowLatencyMode&&!!n.partList;let d=null;if(n.live){const f=r.initialLiveManifestSize;if(s<f)return this.warn(`Not enough fragments to start playback (have: ${s}, need: ${f})`),null;if(!n.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<o){var c;l&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),d=this.getInitialLiveFragment(n);const h=this.hls.startPosition,p=this.hls.liveSyncPosition,g=d?(h!==-1&&h>=o?h:p)||d.start:e;this.log(`Setting startPosition to ${g} to match start frag at live edge. mainStart: ${h} liveSyncPosition: ${p} frag.start: ${(c=d)==null?void 0:c.start}`),this.startPosition=this.nextLoadPosition=g}}else e<=o&&(d=i[0]);if(!d){const f=this.loadingParts?n.partEnd:n.fragmentEnd;d=this.getFragmentAtPosition(e,f,n)}let u=this.filterReplacedPrimary(d,n);if(!u&&d){const f=d.sn-n.startSN;u=this.filterReplacedPrimary(i[f+1]||null,n)}return this.mapToInitFragWhenRequired(u)}isLoopLoading(e,n){const i=this.fragmentTracker.getState(e);return(i===Kn.OK||i===Kn.PARTIAL&&!!e.gap)&&this.nextLoadPosition>n}getNextFragmentLoopLoading(e,n,i,s,r){let o=null;if(e.gap&&(o=this.getNextFragment(this.nextLoadPosition,n),o&&!o.gap&&i.nextStart)){const l=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,i.nextStart,s,0);if(l!==null&&i.len+l.len>=r){const d=o.sn;return this.loopSn!==d&&(this.log(`buffer full after gaps in "${s}" playlist starting at sn: ${d}`),this.loopSn=d),null}}return this.loopSn=void 0,o}get primaryPrefetch(){if(mP(this.hls.config)){var e,n;if((e=this.hls.interstitialsManager)==null||(n=e.playingItem)==null?void 0:n.event)return!0}return!1}filterReplacedPrimary(e,n){if(!e)return e;if(mP(this.hls.config)&&e.type!==Ue.SUBTITLE){const i=this.hls.interstitialsManager,s=i?.bufferingItem;if(s){const o=s.event;if(o){if(o.appendInPlace||Math.abs(e.start-s.start)>1||s.start===0)return null}else if(e.end<=s.start&&n?.live===!1||e.start>s.end&&s.nextEvent&&(s.nextEvent.appendInPlace||e.start-s.end>1))return null}const r=i?.playerQueue;if(r)for(let o=r.length;o--;){const l=r[o].interstitial;if(l.appendInPlace&&e.start>=l.startTime&&e.end<=l.resumeTime)return null}}return e}mapToInitFragWhenRequired(e){return e!=null&&e.initSegment&&!(e!=null&&e.initSegment.data)&&!this.bitrateTest?e.initSegment:e}getNextPart(e,n,i){let s=-1,r=!1,o=!0;for(let l=0,d=e.length;l<d;l++){const c=e[l];if(o=o&&!c.independent,s>-1&&i<c.start)break;const u=c.loaded;u?s=-1:(r||c.independent||o)&&c.fragment===n&&(s=l),r=u}return s}loadedEndOfParts(e,n){const i=e[e.length-1];return i&&n>i.start&&i.loaded}getInitialLiveFragment(e){const n=e.fragments,i=this.fragPrevious;let s=null;if(i){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${i.programDateTime}`),s=Ppe(n,i.endProgramDateTime,this.config.maxFragLookUpTolerance)),!s){const r=i.sn+1;if(r>=e.startSN&&r<=e.endSN){const o=n[r-e.startSN];i.cc===o.cc&&(s=o,this.log(`Live playlist, switching playlist, load frag with next SN: ${s.sn}`))}s||(s=L3(e,i.cc,i.end),s&&this.log(`Live playlist, switching playlist, load frag with same CC: ${s.sn}`))}}else{const r=this.hls.liveSyncPosition;r!==null&&(s=this.getFragmentAtPosition(r,this.bitrateTest?e.fragmentEnd:e.edge,e))}return s}getFragmentAtPosition(e,n,i){const{config:s}=this;let{fragPrevious:r}=this,{fragments:o,endSN:l}=i;const{fragmentHint:d}=i,{maxFragLookUpTolerance:c}=s,u=i.partList,f=!!(this.loadingParts&&u!=null&&u.length&&d);f&&d&&!this.bitrateTest&&u[u.length-1].fragment.sn===d.sn&&(o=o.concat(d),l=d.sn);let h;if(e<n){var p;const v=e<this.lastCurrentTime||e>n-c||(p=this.media)!=null&&p.paused||!this.startFragRequested?0:c;h=Zl(r,o,e,v)}else h=o[o.length-1];if(h){const g=h.sn-i.startSN,v=this.fragmentTracker.getState(h);if((v===Kn.OK||v===Kn.PARTIAL&&h.gap)&&(r=h),r&&h.sn===r.sn&&(!f||u[0].fragment.sn>h.sn||!i.live&&!f)&&r&&h.level===r.level){const b=o[g+1];h.sn<l&&this.fragmentTracker.getState(b)!==Kn.OK?h=b:h=null}}return h}alignPlaylists(e,n,i){const s=e.fragments.length;if(!s)return this.warn("No fragments in live playlist"),0;const r=e.fragmentStart,o=!n,l=e.alignedSliding&&Pe(r);if(o||!l&&!r){dge(i,e);const d=e.fragmentStart;return this.log(`Live playlist sliding: ${d.toFixed(2)} start-sn: ${n?n.startSN:"na"}->${e.startSN} fragments: ${s}`),d}return r}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,n){let i=this.startPosition;i<n&&(i=-1);const s=this.timelineOffset;if(i===-1){const r=this.startTimeOffset!==null,o=r?this.startTimeOffset:e.startTimeOffset;o!==null&&Pe(o)?(i=n+o,o<0&&(i+=e.edge),i=Math.min(Math.max(n,i),n+e.totalduration),this.log(`Setting startPosition to ${i} for start time offset ${o} found in ${r?"multivariant":"media"} playlist`),this.startPosition=i):e.live?(i=this.hls.liveSyncPosition||n,this.log(`Setting startPosition to -1 to start at live edge ${i}`),this.startPosition=-1):(this.log("setting startPosition to 0 by default"),this.startPosition=i=0),this.lastCurrentTime=i+s}this.nextLoadPosition=i+s}getLoadPosition(){var e;const{media:n}=this;let i=0;return(e=this.hls)!=null&&e.hasEnoughToStart&&n?i=n.currentTime:this.nextLoadPosition>=0&&(i=this.nextLoadPosition),i}handleFragLoadAborted(e,n){this.transmuxer&&e.type===this.playlistType&&$n(e)&&e.stats.aborted&&(this.log(`Fragment ${e.sn}${n?" part "+n.index:""} of ${this.playlistLabel()} ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==be.FRAG_LOADING_WAITING_RETRY)&&(this.state=be.IDLE)}onFragmentOrKeyLoadError(e,n){if(n.chunkMeta&&!n.frag){const g=this.getCurrentContext(n.chunkMeta);g&&(n.frag=g.frag)}const i=n.frag;if(!i||i.type!==e||!this.levels)return;if(this.fragContextChanged(i)){var s;this.warn(`Frag load error must match current frag to retry ${i.url} > ${(s=this.fragCurrent)==null?void 0:s.url}`);return}const r=n.details===de.FRAG_GAP;r&&this.fragmentTracker.fragBuffered(i,!0);const o=n.errorAction,{action:l,flags:d,retryCount:c=0,retryConfig:u}=o||{},f=!!o&&!!u,h=f&&l===wi.RetryRequest,p=f&&!o.resolved&&d===Vs.MoveAllAlternatesMatchingHost;if(!h&&p&&$n(i)&&!i.endList)this.resetFragmentErrors(e),this.treatAsGap(i),o.resolved=!0;else if((h||p)&&c<u.maxNumRetry){this.resetStartWhenNotLoaded(this.levelLastLoaded);const g=OA(u,c);this.warn(`Fragment ${i.sn} of ${e} ${i.level} errored with ${n.details}, retrying loading ${c+1}/${u.maxNumRetry} in ${g}ms`),o.resolved=!0,this.retryDate=self.performance.now()+g,this.state=be.FRAG_LOADING_WAITING_RETRY}else if(u&&o)if(this.resetFragmentErrors(e),c<u.maxNumRetry)!r&&l!==wi.RemoveAlternatePermanently&&(o.resolved=!0);else{this.warn(`${n.details} reached or exceeded max retry (${c})`);return}else l===wi.SendAlternateToPenaltyBox?this.state=be.WAITING_LEVEL:this.state=be.ERROR;this.tickImmediate()}reduceLengthAndFlushBuffer(e){if(this.state===be.PARSING||this.state===be.PARSED){const n=e.frag,i=e.parent,s=this.getFwdBufferInfo(this.mediaBuffer,i),r=s&&s.len>.5;r&&this.reduceMaxBufferLength(s.len,n?.duration||10);const o=!r;return o&&this.warn(`Buffer full error while media.currentTime is not buffered, flush ${i} buffer`),n&&(this.fragmentTracker.removeFragment(n),this.nextLoadPosition=n.start),this.resetLoadingState(),o}return!1}resetFragmentErrors(e){e===Ue.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==be.STOPPED&&(this.state=be.IDLE)}afterBufferFlushed(e,n,i){if(!e)return;const s=gt.getBuffered(e);this.fragmentTracker.detectEvictedFragments(n,s,i),this.state===be.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==be.STOPPED&&(this.state=be.IDLE)}resetStartWhenNotLoaded(e){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;const n=e?e.details:null;n!=null&&n.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(n,n.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.warn(`The loading context changed while buffering fragment ${e.sn} of ${this.playlistLabel()} ${e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,n,i,s){const r=i.details;if(!r){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((d,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})`),d||!1;const h=s?0:P3(r,e,u.startPTS,u.endPTS,u.startDTS,u.endDTS);return this.hls.trigger(B.LEVEL_PTS_UPDATED,{details:r,level:i,drift:h,type:c,frag:e,start:u.startPTS,end:u.endPTS}),!0}return d},!1)){var l;if(i.fragmentError===0&&this.treatAsGap(e,i),((l=this.transmuxer)==null?void 0:l.error)===null){const d=new Error(`Found no media in fragment ${e.sn} of ${this.playlistLabel()} ${e.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(d.message),this.hls.trigger(B.ERROR,{type:Ge.MEDIA_ERROR,details:de.FRAG_PARSING_ERROR,fatal:!1,error:d,frag:e,reason:`Found no media in msn ${e.sn} of ${this.playlistLabel()} "${i.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=be.PARSED,this.log(`Parsed ${e.type} sn: ${e.sn}${n?" part: "+n.index:""} of ${this.fragInfo(e,!1,n)})`),this.hls.trigger(B.FRAG_PARSED,{frag:e,part:n})}playlistLabel(){return this.playlistType===Ue.MAIN?"level":"track"}fragInfo(e,n=!0,i){var s,r;return`${this.playlistLabel()} ${e.level} (${i?"part":"frag"}:[${((s=n&&!i?e.startPTS:(i||e).start)!=null?s:NaN).toFixed(3)}-${((r=n&&!i?e.endPTS:(i||e).end)!=null?r:NaN).toFixed(3)}]${i&&e.type==="main"?"INDEPENDENT="+(i.independent?"YES":"NO"):""}`}treatAsGap(e,n){n&&n.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)}resetTransmuxer(){var e;(e=this.transmuxer)==null||e.reset()}recoverWorkerError(e){e.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState())}set state(e){const n=this._state;n!==e&&(this._state=e,this.log(`${n}->${e}`))}get state(){return this._state}};a(wI,"BaseStreamController");let Nh=wI;function mP(t){return!!t.interstitialsController&&t.enableInterstitialPlayback!==!1}a(mP,"interstitialsEnabled");const SI=class SI{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:n}=this;let i;if(e.length)e.length===1?i=e[0]:i=fge(e,n);else return new Uint8Array(0);return this.reset(),i}reset(){this.chunks.length=0,this.dataLength=0}};a(SI,"ChunkCache");let Tv=SI;function fge(t,e){const n=new Uint8Array(e);let i=0;for(let s=0;s<t.length;s++){const r=t[s];n.set(r,i),i+=r.length}return n}a(fge,"concatUint8Arrays");var bE={exports:{}},vP;function hge(){return vP||(vP=1,function(t){var e=Object.prototype.hasOwnProperty,n="~";function i(){}a(i,"Events"),Object.create&&(i.prototype=Object.create(null),new i().__proto__||(n=!1));function s(d,c,u){this.fn=d,this.context=c,this.once=u||!1}a(s,"EE");function r(d,c,u,f,h){if(typeof u!="function")throw new TypeError("The listener must be a function");var p=new s(u,f||d,h),g=n?n+c:c;return d._events[g]?d._events[g].fn?d._events[g]=[d._events[g],p]:d._events[g].push(p):(d._events[g]=p,d._eventsCount++),d}a(r,"addListener");function o(d,c){--d._eventsCount===0?d._events=new i:delete d._events[c]}a(o,"clearEvent");function l(){this._events=new i,this._eventsCount=0}
vendor: 12,500 bytes, line 3512
3512a(l,"EventEmitter"),l.prototype.eventNames=a(function(){var c=[],u,f;if(this._eventsCount===0)return c;for(f in u=this._events)e.call(u,f)&&c.push(n?f.slice(1):f);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(u)):c},"eventNames"),l.prototype.listeners=a(function(c){var u=n?n+c:c,f=this._events[u];if(!f)return[];if(f.fn)return[f.fn];for(var h=0,p=f.length,g=new Array(p);h<p;h++)g[h]=f[h].fn;return g},"listeners"),l.prototype.listenerCount=a(function(c){var u=n?n+c:c,f=this._events[u];return f?f.fn?1:f.length:0},"listenerCount"),l.prototype.emit=a(function(c,u,f,h,p,g){var v=n?n+c:c;if(!this._events[v])return!1;var y=this._events[v],b=arguments.length,E,T;if(y.fn){switch(y.once&&this.removeListener(c,y.fn,void 0,!0),b){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,p),!0;case 6:return y.fn.call(y.context,u,f,h,p,g),!0}for(T=1,E=new Array(b-1);T<b;T++)E[T-1]=arguments[T];y.fn.apply(y.context,E)}else{var I=y.length,M;for(T=0;T<I;T++)switch(y[T].once&&this.removeListener(c,y[T].fn,void 0,!0),b){case 1:y[T].fn.call(y[T].context);break;case 2:y[T].fn.call(y[T].context,u);break;case 3:y[T].fn.call(y[T].context,u,f);break;case 4:y[T].fn.call(y[T].context,u,f,h);break;default:if(!E)for(M=1,E=new Array(b-1);M<b;M++)E[M-1]=arguments[M];y[T].fn.apply(y[T].context,E)}}return!0},"emit"),l.prototype.on=a(function(c,u,f){return r(this,c,u,f,!1)},"on"),l.prototype.once=a(function(c,u,f){return r(this,c,u,f,!0)},"once"),l.prototype.removeListener=a(function(c,u,f,h){var p=n?n+c:c;if(!this._events[p])return this;if(!u)return o(this,p),this;var g=this._events[p];if(g.fn)g.fn===u&&(!h||g.once)&&(!f||g.context===f)&&o(this,p);else{for(var v=0,y=[],b=g.length;v<b;v++)(g[v].fn!==u||h&&!g[v].once||f&&g[v].context!==f)&&y.push(g[v]);y.length?this._events[p]=y.length===1?y[0]:y:o(this,p)}return this},"removeListener"),l.prototype.removeAllListeners=a(function(c){var u;return c?(u=n?n+c:c,this._events[u]&&o(this,u)):(this._events=new i,this._eventsCount=0),this},"removeAllListeners"),l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=n,l.EventEmitter=l,t.exports=l}(bE)),bE.exports}a(hge,"requireEventemitter3");var pge=hge(),FA=Qhe(pge);const Fh="1.6.7",Xd={};function gge(){return typeof __HLS_WORKER_BUNDLE__=="function"}a(gge,"hasUMDWorker");function mge(){const t=Xd[Fh];if(t)return t.clientCount++,t;const e=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),n=self.URL.createObjectURL(e),s={worker:new self.Worker(n),objectURL:n,clientCount:1};return Xd[Fh]=s,s}a(mge,"injectWorker");function vge(t){const e=Xd[t];if(e)return e.clientCount++,e;const n=new self.URL(t,self.location.href).href,s={worker:new self.Worker(n),scriptURL:n,clientCount:1};return Xd[t]=s,s}a(vge,"loadWorker");function yge(t){const e=Xd[t||Fh];if(e&&e.clientCount--===1){const{worker:i,objectURL:s}=e;delete Xd[t||Fh],s&&self.URL.revokeObjectURL(s),i.terminate()}}a(yge,"removeWorkerFromStore");function H3(t,e){return e+10<=t.length&&t[e]===51&&t[e+1]===68&&t[e+2]===73&&t[e+3]<255&&t[e+4]<255&&t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]<128}a(H3,"isId3Footer");function UA(t,e){return e+10<=t.length&&t[e]===73&&t[e+1]===68&&t[e+2]===51&&t[e+3]<255&&t[e+4]<255&&t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]<128}a(UA,"isId3Header");function By(t,e){let n=0;return n=(t[e]&127)<<21,n|=(t[e+1]&127)<<14,n|=(t[e+2]&127)<<7,n|=t[e+3]&127,n}a(By,"readId3Size");function Uh(t,e){const n=e;let i=0;for(;UA(t,e);){i+=10;const s=By(t,e+6);i+=s,H3(t,e+10)&&(i+=10),e+=i}if(i>0)return t.subarray(n,n+i)}a(Uh,"getId3Data");function bge(t,e,n,i){const s=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],r=e[n+2],o=r>>2&15;if(o>12){const p=new Error(`invalid ADTS sampling index:${o}`);t.emit(B.ERROR,B.ERROR,{type:Ge.MEDIA_ERROR,details:de.FRAG_PARSING_ERROR,fatal:!0,error:p,reason:p.message});return}const l=(r>>6&3)+1,d=e[n+3]>>6&3|(r&1)<<2,c="mp4a.40."+l,u=s[o];let f=o;(l===5||l===29)&&(f-=3);const h=[l<<3|(f&14)>>1,(f&1)<<7|d<<3];return Bt.log(`manifest codec:${i}, parsed codec:${c}, channels:${d}, rate:${u} (ADTS object type:${l} sampling index:${o})`),{config:h,samplerate:u,channelCount:d,codec:c,parsedCodec:c,manifestCodec:i}}a(bge,"getAudioConfig");function G3(t,e){return t[e]===255&&(t[e+1]&246)===240}a(G3,"isHeaderPattern$1");function V3(t,e){return t[e+1]&1?7:9}a(V3,"getHeaderLength");function BA(t,e){return(t[e+3]&3)<<11|t[e+4]<<3|(t[e+5]&224)>>>5}a(BA,"getFullFrameLength");function Ege(t,e){return e+5<t.length}a(Ege,"canGetFrameLength");function Av(t,e){return e+1<t.length&&G3(t,e)}a(Av,"isHeader$1");function _ge(t,e){return Ege(t,e)&&G3(t,e)&&BA(t,e)<=t.length-e}a(_ge,"canParse$1");function wge(t,e){if(Av(t,e)){const n=V3(t,e);if(e+n>=t.length)return!1;const i=BA(t,e);if(i<=n)return!1;const s=e+i;return s===t.length||Av(t,s)}return!1}a(wge,"probe$1");function W3(t,e,n,i,s){if(!t.samplerate){const r=bge(e,n,i,s);if(!r)return;jt(t,r)}}a(W3,"initTrackConfig");function z3(t){return 1024*9e4/t}a(z3,"getFrameDuration");function Sge(t,e){const n=V3(t,e);if(e+n<=t.length){const i=BA(t,e)-n;if(i>0)return{headerLength:n,frameLength:i}}}a(Sge,"parseFrameHeader");function K3(t,e,n,i,s){const r=z3(t.samplerate),o=i+s*r,l=Sge(e,n);let d;if(l){const{frameLength:f,headerLength:h}=l,p=h+f,g=Math.max(0,n+p-e.length);g?(d=new Uint8Array(p-h),d.set(e.subarray(n+h,e.length),0)):d=e.subarray(n+h,n+p);const v={unit:d,pts:o};return g||t.samples.push(v),{sample:v,length:p,missing:g}}const c=e.length-n;return d=new Uint8Array(c),d.set(e.subarray(n,e.length),0),{sample:{unit:d,pts:o},length:c,missing:-1}}a(K3,"appendFrame$2");function Tge(t,e){return UA(t,e)&&By(t,e+6)+10<=t.length-e}a(Tge,"canParseId3");function Age(t){return t instanceof ArrayBuffer?t:t.byteOffset==0&&t.byteLength==t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer}a(Age,"toArrayBuffer");function EE(t,e=0,n=1/0){return xge(t,e,n,Uint8Array)}a(EE,"toUint8");function xge(t,e,n,i){const s=Ige(t);let r=1;"BYTES_PER_ELEMENT"in i&&(r=i.BYTES_PER_ELEMENT);const o=Lge(t)?t.byteOffset:0,l=(o+t.byteLength)/r,d=(o+e)/r,c=Math.floor(Math.max(0,Math.min(d,l))),u=Math.floor(Math.min(c+Math.max(n,0),l));return new i(s,c,u-c)}a(xge,"view");function Ige(t){return t instanceof ArrayBuffer?t:t.buffer}a(Ige,"unsafeGetArrayBuffer");function Lge(t){return t&&t.buffer instanceof ArrayBuffer&&t.byteLength!==void 0&&t.byteOffset!==void 0}a(Lge,"isArrayBufferView");function Rge(t){const e={key:t.type,description:"",data:"",mimeType:null,pictureType:null},n=3;if(t.size<2)return;if(t.data[0]!==n){console.log("Ignore frame with unrecognized character encoding");return}const i=t.data.subarray(1).indexOf(0);if(i===-1)return;const s=hs(EE(t.data,1,i)),r=t.data[2+i],o=t.data.subarray(3+i).indexOf(0);if(o===-1)return;const l=hs(EE(t.data,3+i,o));let d;return s==="-->"?d=hs(EE(t.data,4+i+o)):d=Age(t.data.subarray(4+i+o)),e.mimeType=s,e.pictureType=r,e.description=l,e.data=d,e}a(Rge,"decodeId3ImageFrame");function kge(t){if(t.size<2)return;const e=hs(t.data,!0),n=new Uint8Array(t.data.subarray(e.length+1));return{key:t.type,info:e,data:n.buffer}}a(kge,"decodeId3PrivFrame");function Mge(t){if(t.size<2)return;if(t.type==="TXXX"){let n=1;const i=hs(t.data.subarray(n),!0);n+=i.length+1;const s=hs(t.data.subarray(n));return{key:t.type,info:i,data:s}}const e=hs(t.data.subarray(1));return{key:t.type,info:"",data:e}}a(Mge,"decodeId3TextFrame");function Cge(t){if(t.type==="WXXX"){if(t.size<2)return;let n=1;const i=hs(t.data.subarray(n),!0);n+=i.length+1;const s=hs(t.data.subarray(n));return{key:t.type,info:i,data:s}}const e=hs(t.data);return{key:t.type,info:"",data:e}}a(Cge,"decodeId3UrlFrame");function Pge(t){return t.type==="PRIV"?kge(t):t.type[0]==="W"?Cge(t):t.type==="APIC"?Rge(t):Mge(t)}a(Pge,"decodeId3Frame");function Dge(t){const e=String.fromCharCode(t[0],t[1],t[2],t[3]),n=By(t,4),i=10;return{type:e,size:n,data:t.subarray(i,i+n)}}a(Dge,"getId3FrameData");const Kg=10,Oge=10;function q3(t){let e=0;const n=[];for(;UA(t,e);){const i=By(t,e+6);t[e+5]>>6&1&&(e+=Kg),e+=Kg;const s=e+i;for(;e+Oge<s;){const r=Dge(t.subarray(e)),o=Pge(r);o&&n.push(o),e+=r.size+Kg}H3(t,e)&&(e+=Kg)}return n}a(q3,"getId3Frames");function j3(t){return t&&t.key==="PRIV"&&t.info==="com.apple.streaming.transportStreamTimestamp"}a(j3,"isId3TimestampFrame");function Nge(t){if(t.data.byteLength===8){const e=new Uint8Array(t.data),n=e[3]&1;let i=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return i/=45,n&&(i+=4772185884e-2),Math.round(i)}}a(Nge,"readId3Timestamp");function $A(t){const e=q3(t);for(let n=0;n<e.length;n++){const i=e[n];if(j3(i))return Nge(i)}}a($A,"getId3Timestamp");let us=function(t){return t.audioId3="org.id3",t.dateRange="com.apple.quicktime.HLS",t.emsg="https://aomedia.org/emsg/ID3",t.misbklv="urn:misb:KLV:bin:1910.1",t}({});function wr(t="",e=9e4){return{type:t,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}a(wr,"dummyTrack");const TI=class TI{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,n,i,s){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,n){return!1}appendFrame(e,n,i){}demux(e,n){this.cachedData&&(e=Ms(this.cachedData,e),this.cachedData=null);let i=Uh(e,0),s=i?i.length:0,r;const o=this._audioTrack,l=this._id3Track,d=i?$A(i):void 0,c=e.length;for((this.basePTS===null||this.frameIndex===0&&Pe(d))&&(this.basePTS=Fge(d,n,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),i&&i.length>0&&l.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:us.audioId3,duration:Number.POSITIVE_INFINITY});s<c;){if(this.canParse(e,s)){const u=this.appendFrame(o,e,s);u?(this.frameIndex++,this.lastPTS=u.sample.pts,s+=u.length,r=s):s=c}else Tge(e,s)?(i=Uh(e,s),l.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:us.audioId3,duration:Number.POSITIVE_INFINITY}),s+=i.length,r=s):s++;if(s===c&&r!==c){const u=e.slice(r);this.cachedData?this.cachedData=Ms(this.cachedData,u):this.cachedData=u}}return{audioTrack:o,videoTrack:wr(),id3Track:l,textTrack:wr()}}demuxSampleAes(e,n,i){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(e){const n=this.cachedData;return n&&(this.cachedData=null,this.demux(n,0)),{audioTrack:this._audioTrack,videoTrack:wr(),id3Track:this._id3Track,textTrack:wr()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}};a(TI,"BaseAudioDemuxer");let Bh=TI;const Fge=a((t,e,n)=>{if(Pe(t))return t*90;const i=n?n.baseTime*9e4/n.timescale:0;return e*9e4+i},"initPTSFn");let qg=null;const Uge=[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],Bge=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],$ge=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Hge=[0,1,1,4];function Y3(t,e,n,i,s){if(n+24>e.length)return;const r=Z3(e,n);if(r&&n+r.frameLength<=e.length){const o=r.samplesPerFrame*9e4/r.sampleRate,l=i+s*o,d={unit:e.subarray(n,n+r.frameLength),pts:l,dts:l};return t.config=[],t.channelCount=r.channelCount,t.samplerate=r.sampleRate,t.samples.push(d),{sample:d,length:r.frameLength,missing:0}}}a(Y3,"appendFrame$1");function Z3(t,e){const n=t[e+1]>>3&3,i=t[e+1]>>1&3,s=t[e+2]>>4&15,r=t[e+2]>>2&3;if(n!==1&&s!==0&&s!==15&&r!==3){const o=t[e+2]>>1&1,l=t[e+3]>>6,d=n===3?3-i:i===3?3:4,c=Uge[d*14+s-1]*1e3,f=Bge[(n===3?0:n===2?1:2)*3+r],h=l===3?1:2,p=$ge[n][i],g=Hge[i],v=p*8*g,y=Math.floor(p*c/f+o)*g;if(qg===null){const T=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);qg=T?parseInt(T[1]):0}return!!qg&&qg<=87&&i===2&&c>=224e3&&l===0&&(t[e+3]=t[e+3]|128),{sampleRate:f,channelCount:h,frameLength:y,samplesPerFrame:v}}}a(Z3,"parseHeader");function HA(t,e){return t[e]===255&&(t[e+1]&224)===224&&(t[e+1]&6)!==0}a(HA,"isHeaderPattern");function Q3(t,e){return e+1<t.length&&HA(t,e)}
vendor: 27,341 bytes, line 3512
3512a(Q3,"isHeader");function Gge(t,e){return HA(t,e)&&4<=t.length-e}a(Gge,"canParse");function J3(t,e){if(e+1<t.length&&HA(t,e)){const i=Z3(t,e);let s=4;i!=null&&i.frameLength&&(s=i.frameLength);const r=e+s;return r===t.length||Q3(t,r)}return!1}a(J3,"probe");const AI=class AI extends Bh{constructor(e,n){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=n}resetInitSegment(e,n,i,s){super.resetInitSegment(e,n,i,s),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:n,duration:s,inputTimeScale:9e4,dropped:0}}static probe(e,n){if(!e)return!1;const i=Uh(e,0);let s=i?.length||0;if(J3(e,s))return!1;for(let r=e.length;s<r;s++)if(wge(e,s))return n.log("ADTS sync word found !"),!0;return!1}canParse(e,n){return _ge(e,n)}appendFrame(e,n,i){W3(e,this.observer,n,i,e.manifestCodec);const s=K3(e,n,i,this.basePTS,this.frameIndex);if(s&&s.missing===0)return s}};a(AI,"AACDemuxer");let ES=AI;const X3=a((t,e)=>{let n=0,i=5;e+=i;const s=new Uint32Array(1),r=new Uint32Array(1),o=new Uint8Array(1);for(;i>0;){o[0]=t[e];const l=Math.min(i,8),d=8-l;r[0]=4278190080>>>24+d<<d,s[0]=(o[0]&r[0])>>d,n=n?n<<l|s[0]:s[0],e+=1,i-=l}return n},"getAudioBSID"),xI=class xI extends Bh{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,n,i,s){super.resetInitSegment(e,n,i,s),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:n,duration:s,inputTimeScale:9e4,dropped:0}}canParse(e,n){return n+64<e.length}appendFrame(e,n,i){const s=e4(e,n,i,this.basePTS,this.frameIndex);if(s!==-1)return{sample:e.samples[e.samples.length-1],length:s,missing:0}}static probe(e){if(!e)return!1;const n=Uh(e,0);if(!n)return!1;const i=n.length;return e[i]===11&&e[i+1]===119&&$A(n)!==void 0&&X3(e,i)<16}};a(xI,"AC3Demuxer");let _S=xI;function e4(t,e,n,i,s){if(n+8>e.length||e[n]!==11||e[n+1]!==119)return-1;const r=e[n+4]>>6;if(r>=3)return-1;const l=[48e3,44100,32e3][r],d=e[n+4]&63,u=[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][d*3+r]*2;if(n+u>e.length)return-1;const f=e[n+6]>>5;let h=0;f===2?h+=2:(f&1&&f!==1&&(h+=2),f&4&&(h+=2));const p=(e[n+6]<<8|e[n+7])>>12-h&1,v=[2,1,2,3,3,4,4,5][f]+p,y=e[n+5]>>3,b=e[n+5]&7,E=new Uint8Array([r<<6|y<<1|b>>2,(b&3)<<6|f<<3|p<<2|d>>4,d<<4&224]),T=1536/l*9e4,I=i+s*T,M=e.subarray(n,n+u);return t.config=E,t.channelCount=v,t.samplerate=l,t.samples.push({unit:M,pts:I}),u}a(e4,"appendFrame");const II=class II extends Bh{resetInitSegment(e,n,i,s){super.resetInitSegment(e,n,i,s),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:n,duration:s,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const n=Uh(e,0);let i=n?.length||0;if(n&&e[i]===11&&e[i+1]===119&&$A(n)!==void 0&&X3(e,i)<=16)return!1;for(let s=e.length;i<s;i++)if(J3(e,i))return Bt.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,n){return Gge(e,n)}appendFrame(e,n,i){if(this.basePTS!==null)return Y3(e,n,i,this.basePTS,this.frameIndex)}};a(II,"MP3Demuxer");let wS=II;const Vge=/\/emsg[-/]ID3/i,LI=class LI{constructor(e,n){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=n}resetTimeStamp(){}resetInitSegment(e,n,i,s){const r=this.videoTrack=wr("video",1),o=this.audioTrack=wr("audio",1),l=this.txtTrack=wr("text",1);if(this.id3Track=wr("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const d=b3(e);if(d.video){const{id:c,timescale:u,codec:f,supplemental:h}=d.video;r.id=c,r.timescale=l.timescale=u,r.codec=f,r.supplemental=h}if(d.audio){const{id:c,timescale:u,codec:f}=d.audio;o.id=c,o.timescale=u,o.codec=f}l.id=m3.text,r.sampleDuration=0,r.duration=o.duration=s}resetContiguity(){this.remainderData=null}static probe(e){return tpe(e)}demux(e,n){this.timeOffset=n;let i=e;const s=this.videoTrack,r=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=Ms(this.remainderData,e));const l=lpe(i);this.remainderData=l.remainder,s.samples=l.valid||new Uint8Array}else s.samples=i;const o=this.extractID3Track(s,n);return r.samples=UC(n,s),{videoTrack:s,audioTrack:this.audioTrack,id3Track:o,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,n=this.videoTrack,i=this.txtTrack;n.samples=this.remainderData||new Uint8Array,this.remainderData=null;const s=this.extractID3Track(n,this.timeOffset);return i.samples=UC(e,n),{videoTrack:n,audioTrack:wr(),id3Track:s,textTrack:wr()}}extractID3Track(e,n){const i=this.id3Track;if(e.samples.length){const s=Et(e.samples,["emsg"]);s&&s.forEach(r=>{const o=dpe(r);if(Vge.test(o.schemeIdUri)){const l=yP(o,n);let d=o.eventDuration===4294967295?Number.POSITIVE_INFINITY:o.eventDuration/o.timeScale;d<=.001&&(d=Number.POSITIVE_INFINITY);const c=o.payload;i.samples.push({data:c,len:c.byteLength,dts:l,pts:l,type:us.emsg,duration:d})}else if(this.config.enableEmsgKLVMetadata&&o.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const l=yP(o,n);i.samples.push({data:o.payload,len:o.payload.byteLength,dts:l,pts:l,type:us.misbklv,duration:Number.POSITIVE_INFINITY})}})}return i}demuxSampleAes(e,n,i){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0}};a(LI,"MP4Demuxer");let SS=LI;function yP(t,e){return Pe(t.presentationTime)?t.presentationTime/t.timeScale:e+t.presentationTimeDelta/t.timeScale}a(yP,"getEmsgStartTime");const RI=class RI{constructor(e,n,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new Dh(n,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,Ba.cbc)}decryptAacSample(e,n,i){const s=e[n].unit;if(s.length<=16)return;const r=s.subarray(16,s.length-s.length%16),o=r.buffer.slice(r.byteOffset,r.byteOffset+r.length);this.decryptBuffer(o).then(l=>{const d=new Uint8Array(l);s.set(d,16),this.decrypter.isSync()||this.decryptAacSamples(e,n+1,i)})}decryptAacSamples(e,n,i){for(;;n++){if(n>=e.length){i();return}if(!(e[n].unit.length<32)&&(this.decryptAacSample(e,n,i),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const n=Math.floor((e.length-48)/160)*16+16,i=new Int8Array(n);let s=0;for(let r=32;r<e.length-16;r+=160,s+=16)i.set(e.subarray(r,r+16),s);return i}getAvcDecryptedUnit(e,n){const i=new Uint8Array(n);let s=0;for(let r=32;r<e.length-16;r+=160,s+=16)e.set(i.subarray(s,s+16),r);return e}decryptAvcSample(e,n,i,s,r){const o=E3(r.data),l=this.getAvcEncryptedData(o);this.decryptBuffer(l.buffer).then(d=>{r.data=this.getAvcDecryptedUnit(o,d),this.decrypter.isSync()||this.decryptAvcSamples(e,n,i+1,s)})}decryptAvcSamples(e,n,i,s){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;n++,i=0){if(n>=e.length){s();return}const r=e[n].units;for(;!(i>=r.length);i++){const o=r[i];if(!(o.data.length<=48||o.type!==1&&o.type!==5)&&(this.decryptAvcSample(e,n,i,s,o),!this.decrypter.isSync()))return}}}};a(RI,"SampleAesDecrypter");let TS=RI;const kI=class kI{constructor(){this.VideoSample=null}createVideoSample(e,n,i){return{key:e,frame:!1,pts:n,dts:i,units:[],length:0}}getLastNalUnit(e){var n;let i=this.VideoSample,s;if((!i||i.units.length===0)&&(i=e[e.length-1]),(n=i)!=null&&n.units){const r=i.units;s=r[r.length-1]}return s}pushAccessUnit(e,n){if(e.units.length&&e.frame){if(e.pts===void 0){const i=n.samples,s=i.length;if(s){const r=i[s-1];e.pts=r.pts,e.dts=r.dts}else{n.dropped++;return}}n.samples.push(e)}}parseNALu(e,n,i){const s=n.byteLength;let r=e.naluState||0;const o=r,l=[];let d=0,c,u,f,h=-1,p=0;for(r===-1&&(h=0,p=this.getNALuType(n,0),r=0,d=1);d<s;){if(c=n[d++],!r){r=c?0:1;continue}if(r===1){r=c?0:2;continue}if(!c)r=3;else if(c===1){if(u=d-r-1,h>=0){const g={data:n.subarray(h,u),type:p};l.push(g)}else{const g=this.getLastNalUnit(e.samples);g&&(o&&d<=4-o&&g.state&&(g.data=g.data.subarray(0,g.data.byteLength-o)),u>0&&(g.data=Ms(g.data,n.subarray(0,u)),g.state=0))}d<s?(f=this.getNALuType(n,d),h=d,p=f,r=0):r=-1}else r=0}if(h>=0&&r>=0){const g={data:n.subarray(h,s),type:p,state:r};l.push(g)}if(l.length===0){const g=this.getLastNalUnit(e.samples);g&&(g.data=Ms(g.data,n))}return e.naluState=r,l}};a(kI,"BaseVideoParser");let xv=kI;const MI=class MI{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,n=this.bytesAvailable,i=e.byteLength-n,s=new Uint8Array(4),r=Math.min(4,n);if(r===0)throw new Error("no bytes available");s.set(e.subarray(i,i+r)),this.word=new DataView(s.buffer).getUint32(0),this.bitsAvailable=r*8,this.bytesAvailable-=r}skipBits(e){let n;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,n=e>>3,e-=n<<3,this.bytesAvailable-=n,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let n=Math.min(this.bitsAvailable,e);const i=this.word>>>32-n;if(e>32&&Bt.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=n,this.bitsAvailable>0)this.word<<=n;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return n=e-n,n>0&&this.bitsAvailable?i<<n|this.readBits(n):i}skipLZ(){let e;for(e=0;e<this.bitsAvailable;++e)if(this.word&2147483648>>>e)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}};a(MI,"ExpGolomb");let Nl=MI;const CI=class CI extends xv{parsePES(e,n,i,s){const r=this.parseNALu(e,i.data,s);let o=this.VideoSample,l,d=!1;i.data=null,o&&r.length&&!e.audFound&&(this.pushAccessUnit(o,e),o=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),r.forEach(c=>{var u,f;switch(c.type){case 1:{let v=!1;l=!0;const y=c.data;if(d&&y.length>4){const b=this.readSliceType(y);(b===2||b===4||b===7||b===9)&&(v=!0)}if(v){var h;(h=o)!=null&&h.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null)}o||(o=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),o.frame=!0,o.key=v;break}case 5:l=!0,(u=o)!=null&&u.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null),o||(o=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),o.key=!0,o.frame=!0;break;case 6:{l=!0,CA(c.data,1,i.pts,n.samples);break}case 7:{var p,g;l=!0,d=!0;const v=c.data,y=this.readSPS(v);if(!e.sps||e.width!==y.width||e.height!==y.height||((p=e.pixelRatio)==null?void 0:p[0])!==y.pixelRatio[0]||((g=e.pixelRatio)==null?void 0:g[1])!==y.pixelRatio[1]){e.width=y.width,e.height=y.height,e.pixelRatio=y.pixelRatio,e.sps=[v];const b=v.subarray(1,4);let E="avc1.";for(let T=0;T<3;T++){let I=b[T].toString(16);I.length<2&&(I="0"+I),E+=I}e.codec=E}break}case 8:l=!0,e.pps=[c.data];break;case 9:l=!0,e.audFound=!0,(f=o)!=null&&f.frame&&(this.pushAccessUnit(o,e),o=null),o||(o=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts));break;case 12:l=!0;break;default:l=!1;break}o&&l&&o.units.push(c)}),s&&o&&(this.pushAccessUnit(o,e),this.VideoSample=null)}getNALuType(e,n){return e[n]&31}readSliceType(e){const n=new Nl(e);return n.readUByte(),n.readUEG(),n.readUEG()}skipScalingList(e,n){let i=8,s=8,r;for(let o=0;o<e;o++)s!==0&&(r=n.readEG(),s=(i+r+256)%256),i=s===0?i:s}readSPS(e){const n=new Nl(e);let i=0,s=0,r=0,o=0,l,d,c;const u=n.readUByte.bind(n),f=n.readBits.bind(n),h=n.readUEG.bind(n),p=n.readBoolean.bind(n),g=n.skipBits.bind(n),v=n.skipEG.bind(n),y=n.skipUEG.bind(n),b=this.skipScalingList.bind(this);u();const E=u();if(f(5),g(3),u(),y(),E===100||E===110||E===122||E===244||E===44||E===83||E===86||E===118||E===128){const $=h();if($===3&&g(1),y(),y(),g(1),p())for(d=$!==3?8:12,c=0;c<d;c++)p()&&(c<6?b(16,n):b(64,n))}y();const T=h();if(T===0)h();else if(T===1)for(g(1),v(),v(),l=h(),c=0;c<l;c++)v();y(),g(1);const I=h(),M=h(),H=f(1);H===0&&g(1),g(1),p()&&(i=h(),s=h(),r=h(),o=h());let N=[1,1];if(p()&&p())switch(u()){case 1:N=[1,1];break;case 2:N=[12,11];break;case 3:N=[10,11];break;case 4:N=[16,11];break;case 5:N=[40,33];break;case 6:N=[24,11];break;case 7:N=[20,11];break;case 8:N=[32,11];break;case 9:N=[80,33];break;case 10:N=[18,11];break;case 11:N=[15,11];break;case 12:N=[64,33];break;case 13:N=[160,99];break;case 14:N=[4,3];break;case 15:N=[3,2];break;case 16:N=[2,1];break;case 255:{N=[u()<<8|u(),u()<<8|u()];break}}return{width:Math.ceil((I+1)*16-i*2-s*2),height:(2-H)*(M+1)*16-(H?2:4)*(r+o),pixelRatio:N}}};a(CI,"AvcVideoParser");let Iv=CI;const PI=class PI extends xv{constructor(...e){super(...e),this.initVPS=null}parsePES(e,n,i,s){const r=this.parseNALu(e,i.data,s);let o=this.VideoSample,l,d=!1;i.data=null,o&&r.length&&!e.audFound&&(this.pushAccessUnit(o,e),o=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),r.forEach(c=>{var u,f;switch(c.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:o||(o=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),o.frame=!0,l=!0;break;case 16:case 17:case 18:case 21:if(l=!0,d){var h;(h=o)!=null&&h.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null)}o||(o=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),o.key=!0,o.frame=!0;break;case 19:case 20:l=!0,(u=o)!=null&&u.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null),o||(o=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),o.key=!0,o.frame=!0;break;case 39:l=!0,CA(c.data,2,i.pts,n.samples);break;case 32:l=!0,e.vps||(typeof e.params!="object"&&(e.params={}),e.params=jt(e.params,this.readVPS(c.data)),this.initVPS=c.data),e.vps=[c.data];break;case 33:if(l=!0,d=!0,e.vps!==void 0&&e.vps[0]!==this.initVPS&&e.sps!==void 0&&!this.matchSPS(e.sps[0],c.data)&&(this.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){const p=this.readSPS(c.data);e.width=p.width,e.height=p.height,e.pixelRatio=p.pixelRatio,e.codec=p.codecString,e.sps=[],typeof e.params!="object"&&(e.params={});for(const g in p.params)e.params[g]=p.params[g]}this.pushParameterSet(e.sps,c.data,e.vps),o||(o=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),o.key=!0;break;case 34:if(l=!0,typeof e.params=="object"){if(!e.pps){e.pps=[];const p=this.readPPS(c.data);for(const g in p)e.params[g]=p[g]}this.pushParameterSet(e.pps,c.data,e.vps)}break;case 35:l=!0,e.audFound=!0,(f=o)!=null&&f.frame&&(this.pushAccessUnit(o,e),o=null),o||(o=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts));break;default:l=!1;break}o&&l&&o.units.push(c)}),s&&o&&(this.pushAccessUnit(o,e),this.VideoSample=null)}pushParameterSet(e,n,i){(i&&i[0]===this.initVPS||!i&&!e.length)&&e.push(n)}getNALuType(e,n){return(e[n]&126)>>>1}ebsp2rbsp(e){const n=new Uint8Array(e.byteLength);let i=0;for(let s=0;s<e.byteLength;s++)s>=2&&e[s]===3&&e[s-1]===0&&e[s-2]===0||(n[i]=e[s],i++);return new Uint8Array(n.buffer,0,i)}pushAccessUnit(e,n){super.pushAccessUnit(e,n),this.initVPS&&(this.initVPS=null)}readVPS(e){const n=new Nl(e);n.readUByte(),n.readUByte(),n.readBits(4),n.skipBits(2),n.readBits(6);const i=n.readBits(3),s=n.readBoolean();return{numTemporalLayers:i+1,temporalIdNested:s}}readSPS(e){const n=new Nl(this.ebsp2rbsp(e));n.readUByte(),n.readUByte(),n.readBits(4);const i=n.readBits(3);n.readBoolean();const s=n.readBits(2),r=n.readBoolean(),o=n.readBits(5),l=n.readUByte(),d=n.readUByte(),c=n.readUByte(),u=n.readUByte(),f=n.readUByte(),h=n.readUByte(),p=n.readUByte(),g=n.readUByte(),v=n.readUByte(),y=n.readUByte(),b=n.readUByte(),E=[],T=[];for(let _e=0;_e<i;_e++)E.push(n.readBoolean()),T.push(n.readBoolean());if(i>0)for(let _e=i;_e<8;_e++)n.readBits(2);for(let _e=0;_e<i;_e++)E[_e]&&(n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte()),T[_e]&&n.readUByte();n.readUEG();const I=n.readUEG();I==3&&n.skipBits(1);const M=n.readUEG(),H=n.readUEG(),N=n.readBoolean();let $=0,F=0,D=0,L=0;N&&($+=n.readUEG(),F+=n.readUEG(),D+=n.readUEG(),L+=n.readUEG());const m=n.readUEG(),S=n.readUEG(),_=n.readUEG(),A=n.readBoolean();for(let _e=A?0:i;_e<=i;_e++)n.skipUEG(),n.skipUEG(),n.skipUEG();if(n.skipUEG(),n.skipUEG(),n.skipUEG(),n.skipUEG(),n.skipUEG(),n.skipUEG(),n.readBoolean()&&n.readBoolean())for(let we=0;we<4;we++)for(let ye=0;ye<(we===3?2:6);ye++)if(!n.readBoolean())n.readUEG();else{const he=Math.min(64,1<<4+(we<<1));we>1&&n.readEG();for(let ae=0;ae<he;ae++)n.readEG()}n.readBoolean(),n.readBoolean(),n.readBoolean()&&(n.readUByte(),n.skipUEG(),n.skipUEG(),n.readBoolean());const U=n.readUEG();let R=0;for(let _e=0;_e<U;_e++){let we=!1;if(_e!==0&&(we=n.readBoolean()),we){_e===U&&n.readUEG(),n.readBoolean(),n.readUEG();let ye=0;for(let te=0;te<=R;te++){const he=n.readBoolean();let ae=!1;he||(ae=n.readBoolean()),(he||ae)&&ye++}R=ye}else{const ye=n.readUEG(),te=n.readUEG();R=ye+te;for(let he=0;he<ye;he++)n.readUEG(),n.readBoolean();for(let he=0;he<te;he++)n.readUEG(),n.readBoolean()}}if(n.readBoolean()){const _e=n.readUEG();for(let we=0;we<_e;we++){for(let ye=0;ye<_+4;ye++)n.readBits(1);n.readBits(1)}}let P=0,V=1,Z=1,ee=!0,ne=1,se=0;n.readBoolean(),n.readBoolean();let ge=!1;if(n.readBoolean()){if(n.readBoolean()){const ve=n.readUByte(),lt=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],Ye=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];ve>0&&ve<16?(V=lt[ve-1],Z=Ye[ve-1]):ve===255&&(V=n.readBits(16),Z=n.readBits(16))}if(n.readBoolean()&&n.readBoolean(),n.readBoolean()&&(n.readBits(3),n.readBoolean(),n.readBoolean()&&(n.readUByte(),n.readUByte(),n.readUByte())),n.readBoolean()&&(n.readUEG(),n.readUEG()),n.readBoolean(),n.readBoolean(),n.readBoolean(),ge=n.readBoolean(),ge&&($+=n.readUEG(),F+=n.readUEG(),D+=n.readUEG(),L+=n.readUEG()),n.readBoolean()&&(ne=n.readBits(32),se=n.readBits(32),n.readBoolean()&&n.readUEG(),n.readBoolean())){const Ye=n.readBoolean(),nt=n.readBoolean();let Qt=!1;(Ye||nt)&&(Qt=n.readBoolean(),Qt&&(n.readUByte(),n.readBits(5),n.readBoolean(),n.readBits(5)),n.readBits(4),n.readBits(4),Qt&&n.readBits(4),n.readBits(5),n.readBits(5),n.readBits(5));for(let W=0;W<=i;W++){ee=n.readBoolean();const k=ee||n.readBoolean();let O=!1;k?n.readEG():O=n.readBoolean();const K=O?1:n.readUEG()+1;if(Ye)for(let Q=0;Q<K;Q++)n.readUEG(),n.readUEG(),Qt&&(n.readUEG(),n.readUEG()),n.skipBits(1);if(nt)for(let Q=0;Q<K;Q++)n.readUEG(),n.readUEG(),Qt&&(n.readUEG(),n.readUEG()),n.skipBits(1)}}n.readBoolean()&&(n.readBoolean(),n.readBoolean(),n.readBoolean(),P=n.readUEG())}let j=M,Y=H;if(N||ge){let _e=1,we=1;I===1?_e=we=2:I==2&&(_e=2),j=M-_e*F-_e*$,Y=H-we*L-we*D}const le=s?["A","B","C"][s]:"",pe=l<<24|d<<16|c<<8|u;let Te=0;for(let _e=0;_e<32;_e++)Te=(Te|(pe>>_e&1)<<31-_e)>>>0;let Le=Te.toString(16);return o===1&&Le==="2"&&(Le="6"),{codecString:`hvc1.${le}${o}.${Le}.${r?"H":"L"}${b}.B0`,params:{general_tier_flag:r,general_profile_idc:o,general_profile_space:s,general_profile_compatibility_flags:[l,d,c,u],general_constraint_indicator_flags:[f,h,p,g,v,y],general_level_idc:b,bit_depth:m+8,bit_depth_luma_minus8:m,bit_depth_chroma_minus8:S,min_spatial_segmentation_idc:P,chroma_format_idc:I,frame_rate:{fixed:ee,fps:se/ne}},width:j,height:Y,pixelRatio:[V,Z]}}readPPS(e){const n=new Nl(this.ebsp2rbsp(e));n.readUByte(),n.readUByte(),n.skipUEG(),n.skipUEG(),n.skipBits(2),n.skipBits(3),n.skipBits(2),n.skipUEG(),n.skipUEG(),n.skipEG(),n.skipBits(2),n.readBoolean()&&n.skipUEG(),n.skipEG(),n.skipEG(),n.skipBits(4);const s=n.readBoolean(),r=n.readBoolean();let o=1;return r&&s?o=0:r?o=3:s&&(o=2),{parallelismType:o}}matchSPS(e,n){return String.fromCharCode.apply(null,e).substr(3)===String.fromCharCode.apply(null,n).substr(3)}};a(PI,"HevcVideoParser");let Lv=PI;const Zn=188,ro=class ro{constructor(e,n,i,s){this.logger=void 0,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._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=n,this.typeSupported=i,this.logger=s,this.videoParser=null}static probe(e,n){const i=ro.syncOffset(e);return i>0&&n.warn(`MPEG2-TS detected but first sync word found @ offset ${i}`),i!==-1}static syncOffset(e){const n=e.length;let i=Math.min(Zn*5,n-Zn)+1,s=0;for(;s<i;){let r=!1,o=-1,l=0;for(let d=s;d<n;d+=Zn)if(e[d]===71&&(n-d===Zn||e[d+Zn]===71)){if(l++,o===-1&&(o=d,o!==0&&(i=Math.min(o+Zn*99,e.length-Zn)+1)),r||(r=xS(e,d)===0),r&&l>1&&(o===0&&l>2||d+Zn>i))return o}else{if(l)return-1;break}s++}return-1}static createTrack(e,n){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:m3[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?n:void 0}}resetInitSegment(e,n,i,s){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=ro.createTrack("video"),this._videoTrack.duration=s,this._audioTrack=ro.createTrack("audio",s),this._id3Track=ro.createTrack("id3"),this._txtTrack=ro.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=n,this.videoCodec=i}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:n,_id3Track:i}=this;e&&(e.pesData=null),n&&(n.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,n,i=!1,s=!1){i||(this.sampleAes=null);let r;const o=this._videoTrack,l=this._audioTrack,d=this._id3Track,c=this._txtTrack;let u=o.pid,f=o.pesData,h=l.pid,p=d.pid,g=l.pesData,v=d.pesData,y=null,b=this.pmtParsed,E=this._pmtId,T=e.length;if(this.remainderData&&(e=Ms(this.remainderData,e),T=e.length,this.remainderData=null),T<Zn&&!s)return this.remainderData=e,{audioTrack:l,videoTrack:o,id3Track:d,textTrack:c};const I=Math.max(0,ro.syncOffset(e));T-=(T-I)%Zn,T<e.byteLength&&!s&&(this.remainderData=new Uint8Array(e.buffer,T,e.buffer.byteLength-T));let M=0;for(let N=I;N<T;N+=Zn)if(e[N]===71){const $=!!(e[N+1]&64),F=xS(e,N),D=(e[N+3]&48)>>4;let L;if(D>1){if(L=N+5+e[N+4],L===N+Zn)continue}else L=N+4;switch(F){case u:if($){if(f&&(r=Mc(f,this.logger))){if(this.videoParser===null)switch(o.segmentCodec){case"avc":this.videoParser=new Iv;break;case"hevc":this.videoParser=new Lv;break}this.videoParser!==null&&this.videoParser.parsePES(o,c,r,!1)}f={data:[],size:0}}f&&(f.data.push(e.subarray(L,N+Zn)),f.size+=N+Zn-L);break;case h:if($){if(g&&(r=Mc(g,this.logger)))switch(l.segmentCodec){case"aac":this.parseAACPES(l,r);break;case"mp3":this.parseMPEGPES(l,r);break;case"ac3":this.parseAC3PES(l,r);break}g={data:[],size:0}}g&&(g.data.push(e.subarray(L,N+Zn)),g.size+=N+Zn-L);break;case p:$&&(v&&(r=Mc(v,this.logger))&&this.parseID3PES(d,r),v={data:[],size:0}),v&&(v.data.push(e.subarray(L,N+Zn)),v.size+=N+Zn-L);break;case 0:$&&(L+=e[L]+1),E=this._pmtId=Wge(e,L);break;case E:{$&&(L+=e[L]+1);const m=zge(e,L,this.typeSupported,i,this.observer,this.logger);u=m.videoPid,u>0&&(o.pid=u,o.segmentCodec=m.segmentVideoCodec),h=m.audioPid,h>0&&(l.pid=h,l.segmentCodec=m.segmentAudioCodec),p=m.id3Pid,p>0&&(d.pid=p),y!==null&&!b&&(this.logger.warn(`MPEG-TS PMT found at ${N} after unknown PID '${y}'. Backtracking to sync byte @${I} to parse all TS packets.`),y=null,N=I-188),b=this.pmtParsed=!0;break}case 17:case 8191:break;default:y=F;break}}else M++;M>0&&IS(this.observer,new Error(`Found ${M} TS packet/s that do not start with 0x47`),void 0,this.logger),o.pesData=f,l.pesData=g,d.pesData=v;const H={audioTrack:l,videoTrack:o,id3Track:d,textTrack:c};return s&&this.extractRemainingSamples(H),H}flush(){const{remainderData:e}=this;this.remainderData=null;let n;return e?n=this.demux(e,-1,!1,!0):n={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(n),this.sampleAes?this.decrypt(n,this.sampleAes):n}extractRemainingSamples(e){const{audioTrack:n,videoTrack:i,id3Track:s,textTrack:r}=e,o=i.pesData,l=n.pesData,d=s.pesData;let c;if(o&&(c=Mc(o,this.logger))){if(this.videoParser===null)switch(i.segmentCodec){case"avc":this.videoParser=new Iv;break;case"hevc":this.videoParser=new Lv;break}this.videoParser!==null&&(this.videoParser.parsePES(i,r,c,!0),i.pesData=null)}else i.pesData=o;if(l&&(c=Mc(l,this.logger))){switch(n.segmentCodec){case"aac":this.parseAACPES(n,c);break;case"mp3":this.parseMPEGPES(n,c);break;case"ac3":this.parseAC3PES(n,c);break}n.pesData=null}else l!=null&&l.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),n.pesData=l;d&&(c=Mc(d,this.logger))?(this.parseID3PES(s,c),s.pesData=null):s.pesData=d}demuxSampleAes(e,n,i){const s=this.demux(e,i,!0,!this.config.progressive),r=this.sampleAes=new TS(this.observer,this.config,n);return this.decrypt(s,r)}decrypt(e,n){return new Promise(i=>{const{audioTrack:s,videoTrack:r}=e;s.samples&&s.segmentCodec==="aac"?n.decryptAacSamples(s.samples,0,()=>{r.samples?n.decryptAvcSamples(r.samples,0,0,()=>{i(e)}):i(e)}):r.samples&&n.decryptAvcSamples(r.samples,0,0,()=>{i(e)})})}destroy(){this.observer&&this.observer.removeAllListeners(),this.config=this.logger=this.observer=null,this.aacOverFlow=this.videoParser=this.remainderData=this.sampleAes=null,this._videoTrack=this._audioTrack=this._id3Track=this._txtTrack=void 0}parseAACPES(e,n){let i=0;const s=this.aacOverFlow;let r=n.data;if(s){this.aacOverFlow=null;const f=s.missing,h=s.sample.unit.byteLength;if(f===-1)r=Ms(s.sample.unit,r);else{const p=h-f;s.sample.unit.set(r.subarray(0,f),p),e.samples.push(s.sample),i=s.missing}}let o,l;for(o=i,l=r.length;o<l-1&&!Av(r,o);o++);if(o!==i){let f;const h=o<l-1;if(h?f=`AAC PES did not start with ADTS header,offset:${o}`:f="No ADTS header found in AAC PES",IS(this.observer,new Error(f),h,this.logger),!h)return}W3(e,this.observer,r,o,this.audioCodec);let d;if(n.pts!==void 0)d=n.pts;else if(s){const f=z3(e.samplerate);d=s.sample.pts+f}else{this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}let c=0,u;for(;o<l;)if(u=K3(e,r,o,d,c),o+=u.length,u.missing){this.aacOverFlow=u;break}else for(c++;o<l-1&&!Av(r,o);o++);}parseMPEGPES(e,n){const i=n.data,s=i.length;let r=0,o=0;const l=n.pts;if(l===void 0){this.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;o<s;)if(Q3(i,o)){const d=Y3(e,i,o,l,r);if(d)o+=d.length,r++;else break}else o++}parseAC3PES(e,n){{const i=n.data,s=n.pts;if(s===void 0){this.logger.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const r=i.length;let o=0,l=0,d;for(;l<r&&(d=e4(e,i,l,s,o++))>0;)l+=d}}parseID3PES(e,n){if(n.pts===void 0){this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const i=jt({}
vendor: 4,783 bytes, line 3512
3512,n,{type:this._videoTrack?us.emsg:us.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}};a(ro,"TSDemuxer");let AS=ro;function xS(t,e){return((t[e+1]&31)<<8)+t[e+2]}a(xS,"parsePID");function Wge(t,e){return(t[e+10]&31)<<8|t[e+11]}a(Wge,"parsePAT");function zge(t,e,n,i,s,r){const o={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},l=(t[e+1]&15)<<8|t[e+2],d=e+3+l-4,c=(t[e+10]&15)<<8|t[e+11];for(e+=12+c;e<d;){const u=xS(t,e),f=(t[e+3]&15)<<8|t[e+4];switch(t[e]){case 207:if(!i){_E("ADTS AAC",r);break}case 15:o.audioPid===-1&&(o.audioPid=u);break;case 21:o.id3Pid===-1&&(o.id3Pid=u);break;case 219:if(!i){_E("H.264",r);break}case 27:o.videoPid===-1&&(o.videoPid=u);break;case 3:case 4:!n.mpeg&&!n.mp3?r.log("MPEG audio found, not supported in this browser"):o.audioPid===-1&&(o.audioPid=u,o.segmentAudioCodec="mp3");break;case 193:if(!i){_E("AC-3",r);break}case 129:n.ac3?o.audioPid===-1&&(o.audioPid=u,o.segmentAudioCodec="ac3"):r.log("AC-3 audio found, not supported in this browser");break;case 6:if(o.audioPid===-1&&f>0){let h=e+5,p=f;for(;p>2;){switch(t[h]){case 106:n.ac3!==!0?r.log("AC-3 audio found, not supported in this browser for now"):(o.audioPid=u,o.segmentAudioCodec="ac3");break}const v=t[h+1]+2;h+=v,p-=v}}break;case 194:case 135:return IS(s,new Error("Unsupported EC-3 in M2TS found"),void 0,r),o;case 36:o.videoPid===-1&&(o.videoPid=u,o.segmentVideoCodec="hevc",r.log("HEVC in M2TS found"));break}e+=f+5}return o}a(zge,"parsePMT");function IS(t,e,n,i){i.warn(`parsing error: ${e.message}`),t.emit(B.ERROR,B.ERROR,{type:Ge.MEDIA_ERROR,details:de.FRAG_PARSING_ERROR,fatal:!1,levelRetry:n,error:e,reason:e.message})}a(IS,"emitParsingError");function _E(t,e){e.log(`${t} with AES-128-CBC encryption found in unencrypted stream`)}a(_E,"logEncryptedSamplesFoundInUnencryptedStream");function Mc(t,e){let n=0,i,s,r,o,l;const d=t.data;if(!t||t.size===0)return null;for(;d[0].length<19&&d.length>1;)d[0]=Ms(d[0],d[1]),d.splice(1,1);if(i=d[0],(i[0]<<16)+(i[1]<<8)+i[2]===1){if(s=(i[4]<<8)+i[5],s&&s>t.size-6)return null;const u=i[7];u&192&&(o=(i[9]&14)*536870912+(i[10]&255)*4194304+(i[11]&254)*16384+(i[12]&255)*128+(i[13]&254)/2,u&64?(l=(i[14]&14)*536870912+(i[15]&255)*4194304+(i[16]&254)*16384+(i[17]&255)*128+(i[18]&254)/2,o-l>60*9e4&&(e.warn(`${Math.round((o-l)/9e4)}s delta between PTS and DTS, align them`),o=l)):l=o),r=i[8];let f=r+9;if(t.size<=f)return null;t.size-=f;const h=new Uint8Array(t.size);for(let p=0,g=d.length;p<g;p++){i=d[p];let v=i.byteLength;if(f)if(f>v){f-=v;continue}else i=i.subarray(f),v-=f,f=0;h.set(i,n),n+=v}return s&&(s-=r+3),{data:h,pts:o,dts:l,len:s}}return null}a(Mc,"parsePES");const DI=class DI{static getSilentFrame(e,n){switch(e){case"mp4a.40.2":if(n===1)return new Uint8Array([0,200,0,128,35,128]);if(n===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(n===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(n===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(n===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(n===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(n===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(n===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(n===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}}};a(DI,"AAC");let LS=DI;const Go=Math.pow(2,32)-1,fe=class fe{static init(){fe.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};let e;for(e in fe.types)fe.types.hasOwnProperty(e)&&(fe.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);const n=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);fe.HDLR_TYPES={video:n,audio:i};const s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),r=new 
vendor: 4,477 bytes, line 3512
3512Uint8Array([0,0,0,0,0,0,0,0]);fe.STTS=fe.STSC=fe.STCO=r,fe.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),fe.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),fe.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),fe.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const o=new Uint8Array([105,115,111,109]),l=new Uint8Array([97,118,99,49]),d=new Uint8Array([0,0,0,1]);fe.FTYP=fe.box(fe.types.ftyp,o,d,o,l),fe.DINF=fe.box(fe.types.dinf,fe.box(fe.types.dref,s))}static box(e,...n){let i=8,s=n.length;const r=s;for(;s--;)i+=n[s].byteLength;const o=new Uint8Array(i);for(o[0]=i>>24&255,o[1]=i>>16&255,o[2]=i>>8&255,o[3]=i&255,o.set(e,4),s=0,i=8;s<r;s++)o.set(n[s],i),i+=n[s].byteLength;return o}static hdlr(e){return fe.box(fe.types.hdlr,fe.HDLR_TYPES[e])}static mdat(e){return fe.box(fe.types.mdat,e)}static mdhd(e,n){n*=e;const i=Math.floor(n/(Go+1)),s=Math.floor(n%(Go+1));return fe.box(fe.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,i>>24,i>>16&255,i>>8&255,i&255,s>>24,s>>16&255,s>>8&255,s&255,85,196,0,0]))}static mdia(e){return fe.box(fe.types.mdia,fe.mdhd(e.timescale||0,e.duration||0),fe.hdlr(e.type),fe.minf(e))}static mfhd(e){return fe.box(fe.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"?fe.box(fe.types.minf,fe.box(fe.types.smhd,fe.SMHD),fe.DINF,fe.stbl(e)):fe.box(fe.types.minf,fe.box(fe.types.vmhd,fe.VMHD),fe.DINF,fe.stbl(e))}static moof(e,n,i){return fe.box(fe.types.moof,fe.mfhd(e),fe.traf(i,n))}static moov(e){let n=e.length;const i=[];for(;n--;)i[n]=fe.trak(e[n]);return fe.box.apply(null,[fe.types.moov,fe.mvhd(e[0].timescale||0,e[0].duration||0)].concat(i).concat(fe.mvex(e)))}static mvex(e){let n=e.length;const i=[];for(;n--;)i[n]=fe.trex(e[n]);return fe.box.apply(null,[fe.types.mvex,...i])}static mvhd(e,n){n*=e;const i=Math.floor(n/(Go+1)),s=Math.floor(n%(Go+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,i>>24,i>>16&255,i>>8&255,i&255,s>>24,s>>16&255,s>>8&255,s&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 fe.box(fe.types.mvhd,r)}static sdtp(e){const n=e.samples||[],i=new Uint8Array(4+n.length);let s,r;for(s=0;s<n.length;s++)r=n[s].flags,i[s+4]=r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy;return fe.box(fe.types.sdtp,i)}static stbl(e){return fe.box(fe.types.stbl,fe.stsd(e),fe.box(fe.types.stts,fe.STTS),fe.box(fe.types.stsc,fe.STSC),fe.box(fe.types.stsz,fe.STSZ),fe.box(fe.types.stco,fe.STCO))}static avc1(e){let n=[],i=[],s,r,o;for(s=0;s<e.sps.length;s++)r=e.sps[s],o=r.byteLength,n.push(o>>>8&255),n.push(o&255),n=n.concat(Array.prototype.slice.call(r));for(s=0;s<e.pps.length;s++)r=e.pps[s],o=r.byteLength,i.push(o>>>8&255),i.push(o&255),i=i.concat(Array.prototype.slice.call(r));const l=fe.box(fe.types.avcC,new Uint8Array([1,n[3],n[4],n[5],255,224|e.sps.length].concat(n).concat([e.pps.length]).concat(i))),d=e.width,c=e.height,u=e.pixelRatio[0],f=e.pixelRatio[1];return fe.box(fe.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,d>>8&255,d&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]),l,fe.box(fe.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),fe.box(fe.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 n=e.config;return new Uint8Array([0,0,0,0,3,25,0,1,0,4,17,64,21,0,0,0,0,0,0,0,0,0,0,0,5,2,...n,6,1,2])}static audioStsd(e){const n=e.samplerate||0;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount||0,0,16,0,0,0,0,n>>8&255,n&255,0,0])}static mp4a(e){return fe.box(fe.types.mp4a,fe.audioStsd(e),fe.box(fe.types.esds,fe.esds(e)))}static mp3(e){return fe.box(fe.types[".mp3"],fe.audioStsd(e))}static ac3(e){return fe.box(fe.types["ac-3"],fe.audioStsd(e),fe.box(fe.types.dac3,e.config))}static stsd(e){const{segmentCodec:n}=e;if(e.type==="audio"){if(n==="aac")return fe.box(fe.types.stsd,fe.STSD,fe.mp4a(e));if(n==="ac3"&&e.config)return fe.box(fe.types.stsd,fe.STSD,fe.ac3(e));if(n==="mp3"&&e.codec==="mp3")return fe.box(fe.types.stsd,fe.STSD,fe.mp3(e))}else if(e.pps&&e.sps){if(n==="avc")return fe.box(fe.types.stsd,fe.STSD,fe.avc1(e));if(n==="hevc"&&e.vps)return fe.box(fe.types.stsd,fe.STSD,fe.hvc1(e))}
vendor: 4,543 bytes, line 3512
3512else throw new Error("video track missing pps or sps");throw new Error(`unsupported ${e.type} segment codec (${n}/${e.codec})`)}static tkhd(e){const n=e.id,i=(e.duration||0)*(e.timescale||0),s=e.width||0,r=e.height||0,o=Math.floor(i/(Go+1)),l=Math.floor(i%(Go+1));return fe.box(fe.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,n>>24&255,n>>16&255,n>>8&255,n&255,0,0,0,0,o>>24,o>>16&255,o>>8&255,o&255,l>>24,l>>16&255,l>>8&255,l&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,s>>8&255,s&255,0,0,r>>8&255,r&255,0,0]))}static traf(e,n){const i=fe.sdtp(e),s=e.id,r=Math.floor(n/(Go+1)),o=Math.floor(n%(Go+1));return fe.box(fe.types.traf,fe.box(fe.types.tfhd,new Uint8Array([0,0,0,0,s>>24,s>>16&255,s>>8&255,s&255])),fe.box(fe.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])),fe.trun(e,i.length+16+20+8+16+8+8),i)}static trak(e){return e.duration=e.duration||4294967295,fe.box(fe.types.trak,fe.tkhd(e),fe.mdia(e))}static trex(e){const n=e.id;return fe.box(fe.types.trex,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,n&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,n){const i=e.samples||[],s=i.length,r=12+16*s,o=new Uint8Array(r);let l,d,c,u,f,h;for(n+=8+r,o.set([e.type==="video"?1:0,0,15,1,s>>>24&255,s>>>16&255,s>>>8&255,s&255,n>>>24&255,n>>>16&255,n>>>8&255,n&255],0),l=0;l<s;l++)d=i[l],c=d.duration,u=d.size,f=d.flags,h=d.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*l);return fe.box(fe.types.trun,o)}static initSegment(e){fe.types||fe.init();const n=fe.moov(e);return Ms(fe.FTYP,n)}static hvc1(e){const n=e.params,i=[e.vps,e.sps,e.pps],s=4,r=new Uint8Array([1,n.general_profile_space<<6|(n.general_tier_flag?32:0)|n.general_profile_idc,n.general_profile_compatibility_flags[0],n.general_profile_compatibility_flags[1],n.general_profile_compatibility_flags[2],n.general_profile_compatibility_flags[3],n.general_constraint_indicator_flags[0],n.general_constraint_indicator_flags[1],n.general_constraint_indicator_flags[2],n.general_constraint_indicator_flags[3],n.general_constraint_indicator_flags[4],n.general_constraint_indicator_flags[5],n.general_level_idc,240|n.min_spatial_segmentation_idc>>8,255&n.min_spatial_segmentation_idc,252|n.parallelismType,252|n.chroma_format_idc,248|n.bit_depth_luma_minus8,248|n.bit_depth_chroma_minus8,0,parseInt(n.frame_rate.fps),s-1|n.temporal_id_nested<<2|n.num_temporal_layers<<3|(n.frame_rate.fixed?64:0),i.length]);let o=r.length;for(let g=0;g<i.length;g+=1){o+=3;for(let v=0;v<i[g].length;v+=1)o+=2+i[g][v].length}const l=new Uint8Array(o);l.set(r,0),o=r.length;const d=i.length-1;for(let g=0;g<i.length;g+=1){l.set(new Uint8Array([32+g|(g===d?128:0),0,i[g].length]),o),o+=3;for(let v=0;v<i[g].length;v+=1)l.set(new Uint8Array([i[g][v].length>>8,i[g][v].length&255]),o),o+=2,l.set(i[g][v],o),o+=i[g][v].length}const c=fe.box(fe.types.hvcC,l),u=e.width,f=e.height,h=e.pixelRatio[0],p=e.pixelRatio[1];return fe.box(fe.types.hvc1,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,u>>8&255,u&255,f>>8&255,f&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]),c,fe.box(fe.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),fe.box(fe.types.pasp,new Uint8Array([h>>24,h>>16&255,h>>8&255,h&255,p>>24,p>>16&255,p>>8&255,p&255])))}};a(fe,"MP4");let qn=fe;qn.types=void 0;qn.HDLR_TYPES=void 0;qn.STTS=void 0;qn.STSC=void 0;qn.STCO=void 0;qn.STSZ=void 0;qn.VMHD=void 0;qn.SMHD=void 0;qn.STSD=void 0;qn.FTYP=void 0;qn.DINF=void 0;const t4=9e4;function GA(t,e,n=1,i=!1){const s=t*e*n;return i?Math.round(s):s}a(GA,"toTimescaleFromBase");function Kge(t,e,n=1,i=!1){return GA(t,e,1/n,i)}a(Kge,"toTimescaleFromScale");function Wu(t,e=!1){return GA(t,1e3,1/t4,e)}a(Wu,"toMsFromMpegTsClock");function qge(t,e=1){return GA(t,t4,1/e)}a(qge,"toMpegTsClockFromTimescale");const jge=10*1e3,Yge=1024,Zge=1152,Qge=1536;let Cc=null,wE=null;function bP(t,e,n,i){return{duration:e,size:n,cts:i,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:t?2:1,isNonSync:t?0:1}}}a(bP,"createMp4Sample");const OI=class OI extends ms{constructor(e,n,i,s){if(super("mp4-remuxer",s),this.observer=void 0,this.config=void 0,this.typeSupp
vendor: 4,188 bytes, line 3512
3512orted=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextVideoTs=null,this.nextAudioTs=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=n,this.typeSupported=i,this.ISGenerated=!1,Cc===null){const o=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Cc=o?parseInt(o[1]):0}if(wE===null){const r=navigator.userAgent.match(/Safari\/(\d+)/i);wE=r?parseInt(r[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){this.log("initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){this.log("reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.log("ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let n=!1;const i=e[0].pts,s=e.reduce((r,o)=>{let l=o.pts,d=l-r;return d<-4294967296&&(n=!0,l=Ts(l,i),d=l-r),d>0?r:l},i);return n&&this.debug("PTS rollover detected"),s}remux(e,n,i,s,r,o,l,d){let c,u,f,h,p,g,v=r,y=r;const b=e.pid>-1,E=n.pid>-1,T=n.samples.length,I=e.samples.length>0,M=l&&T>0||T>1;if((!b||I)&&(!E||M)||this.ISGenerated||l){if(this.ISGenerated){var N,$,F,D;const _=this.videoTrackConfig;(_&&(n.width!==_.width||n.height!==_.height||((N=n.pixelRatio)==null?void 0:N[0])!==(($=_.pixelRatio)==null?void 0:$[0])||((F=n.pixelRatio)==null?void 0:F[1])!==((D=_.pixelRatio)==null?void 0:D[1]))||!_&&M||this.nextAudioTs===null&&I)&&this.resetInitSegment()}this.ISGenerated||(f=this.generateIS(e,n,r,o));const L=this.isVideoContiguous;let m=-1,S;if(M&&(m=Jge(n.samples),!L&&this.config.forceKeyFrameOnDiscontinuity))if(g=!0,m>0){this.warn(`Dropped ${m} out of ${T} video samples due to a missing keyframe`);const _=this.getVideoStartPts(n.samples);n.samples=n.samples.slice(m),n.dropped+=m,y+=(n.samples[0].pts-_)/n.inputTimeScale,S=y}else m===-1&&(this.warn(`No keyframe found out of ${T} video samples`),g=!1);if(this.ISGenerated){if(I&&M){const _=this.getVideoStartPts(n.samples),x=(Ts(e.samples[0].pts,_)-_)/n.inputTimeScale;v+=Math.max(0,x),y+=Math.max(0,-x)}if(I){if(e.samplerate||(this.warn("regenerate InitSegment as audio detected"),f=this.generateIS(e,n,r,o)),u=this.remuxAudio(e,v,this.isAudioContiguous,o,E||M||d===Ue.AUDIO?y:void 0),M){const _=u?u.endPTS-u.startPTS:0;n.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),f=this.generateIS(e,n,r,o)),c=this.remuxVideo(n,y,L,_)}}else M&&(c=this.remuxVideo(n,y,L,0));c&&(c.firstKeyFrame=m,c.independent=m!==-1,c.firstKeyFramePTS=S)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(p=n4(i,r,this._initPTS,this._initDTS)),s.samples.length&&(h=i4(s,r,this._initPTS))),{audio:u,video:c,initSegment:f,independent:g,text:h,id3:p}}generateIS(e,n,i,s){const r=e.samples,o=n.samples,l=this.typeSupported,d={},c=this._initPTS;let u=!c||s,f="audio/mp4",h,p,g,v;if(u&&(h=p=1/0),e.config&&r.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":l.mpeg?(f="audio/mpeg",e.codec=""):l.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3";break}d.audio={id:"audio",container:f,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&l.mpeg?new Uint8Array(0):qn.initSegment([e]),metadata:{channelCount:e.channelCount}},u&&(v=e.id,g=e.inputTimeScale,!c||g!==c.timescale?h=p=r[0].pts-Math.round(g*i):u=!1)}if(n.sps&&n.pps&&o.length){if(n.timescale=n.inputTimeScale,d.video={id:"main",container:"video/mp4",codec:n.codec,initSegment:qn.initSegment([n]),metadata:{width:n.width,height:n.height}},u)if(v=n.id,g=n.inputTimeScale,!c||g!==c.timescale){const y=this.getVideoStartPts(o),b=Math.round(g*i);p=Math.min(p,Ts(o[0].dts,y)-b),h=Math.min(h,y-b)}else u=!1;this.videoTrackConfig={width:n.width,height:n.height,pixelRatio:n.pixelRatio}}if(Object.keys(d).length)return this.ISGenerated=!0,u?(this._initPTS={baseTime:h,timescale:g},this._initDTS={baseTime:p,timescale:g}):h=g=void 0,{tracks:d,initPTS:h,timescale:g,trackId:v}}remuxVideo(e,n,i,s){const r=e.inputTimeScale,o=e.samples,l=[],d=o.length,c=this._initPTS,u=c.baseTime*r/c.timescale;let f=this.nextVideoTs,h=8,p=this.videoSampleDuration,g,v,y=Number.POSITIVE_INFINITY,b
vendor: 4,427 bytes, line 3512
3512=Number.NEGATIVE_INFINITY,E=!1;if(!i||f===null){const P=u+n*r,V=o[0].pts-Ts(o[0].dts,o[0].pts);Cc&&f!==null&&Math.abs(P-V-(f+u))<15e3?i=!0:f=P-V-u}const T=f+u;for(let P=0;P<d;P++){const V=o[P];V.pts=Ts(V.pts,T),V.dts=Ts(V.dts,T),V.dts<o[P>0?P-1:P].dts&&(E=!0)}E&&o.sort(function(P,V){const Z=P.dts-V.dts,ee=P.pts-V.pts;return Z||ee}),g=o[0].dts,v=o[o.length-1].dts;const I=v-g,M=I?Math.round(I/(d-1)):p||e.inputTimeScale/30;if(i){const P=g-T,V=P>M,Z=P<-1;if((V||Z)&&(V?this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${Wu(P,!0)} ms (${P}dts) hole between fragments detected at ${n.toFixed(3)}`):this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${Wu(-P,!0)} ms (${P}dts) overlapping between fragments detected at ${n.toFixed(3)}`),!Z||T>=o[0].pts||Cc)){g=T;const ee=o[0].pts-P;if(V)o[0].dts=g,o[0].pts=ee;else{let ne=!0;for(let se=0;se<o.length&&!(o[se].dts>ee&&ne);se++){const ge=o[se].pts;if(o[se].dts-=P,o[se].pts-=P,se<o.length-1){const ie=o[se+1].pts,j=o[se].pts,Y=ie<=j,le=ie<=ge;ne=Y==le}}}this.log(`Video: Initial PTS/DTS adjusted: ${Wu(ee,!0)}/${Wu(g,!0)}, delta: ${Wu(P,!0)} ms`)}}g=Math.max(0,g);let H=0,N=0,$=g;for(let P=0;P<d;P++){const V=o[P],Z=V.units,ee=Z.length;let ne=0;for(let se=0;se<ee;se++)ne+=Z[se].data.length;N+=ne,H+=ee,V.length=ne,V.dts<$?(V.dts=$,$+=M/4|0||1):$=V.dts,y=Math.min(V.pts,y),b=Math.max(V.pts,b)}v=o[d-1].dts;const F=N+4*H+8;let D;try{D=new Uint8Array(F)}catch(P){this.observer.emit(B.ERROR,B.ERROR,{type:Ge.MUX_ERROR,details:de.REMUX_ALLOC_ERROR,fatal:!1,error:P,bytes:F,reason:`fail allocating video mdat ${F}`});return}const L=new DataView(D.buffer);L.setUint32(0,F),D.set(qn.types.mdat,4);let m=!1,S=Number.POSITIVE_INFINITY,_=Number.POSITIVE_INFINITY,A=Number.NEGATIVE_INFINITY,x=Number.NEGATIVE_INFINITY;for(let P=0;P<d;P++){const V=o[P],Z=V.units;let ee=0;for(let ge=0,ie=Z.length;ge<ie;ge++){const j=Z[ge],Y=j.data,le=j.data.byteLength;L.setUint32(h,le),h+=4,D.set(Y,h),h+=le,ee+=4+le}let ne;if(P<d-1)p=o[P+1].dts-V.dts,ne=o[P+1].pts-V.pts;else{const ge=this.config,ie=P>0?V.dts-o[P-1].dts:M;if(ne=P>0?V.pts-o[P-1].pts:M,ge.stretchShortVideoTrack&&this.nextAudioTs!==null){const j=Math.floor(ge.maxBufferHole*r),Y=(s?y+s*r:this.nextAudioTs+u)-V.pts;Y>j?(p=Y-ie,p<0?p=ie:m=!0,this.log(`It is approximately ${Y/90} ms to the next segment; using duration ${p/90} ms for the last video frame.`)):p=ie}else p=ie}const se=Math.round(V.pts-V.dts);S=Math.min(S,p),A=Math.max(A,p),_=Math.min(_,ne),x=Math.max(x,ne),l.push(bP(V.key,p,ee,se))}if(l.length){if(Cc){if(Cc<70){const P=l[0].flags;P.dependsOn=2,P.isNonSync=0}}else if(wE&&x-_<A-S&&M/A<.025&&l[0].cts===0){this.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let P=g;for(let V=0,Z=l.length;V<Z;V++){const ee=P+l[V].duration,ne=P+l[V].cts;if(V<Z-1){const se=ee+l[V+1].cts;l[V].duration=se-ne}else l[V].duration=V?l[V-1].duration:M;l[V].cts=0,P=ee}}}p=m||!p?M:p;const C=v+p;this.nextVideoTs=f=C-u,this.videoSampleDuration=p,this.isVideoContiguous=!0;const U=qn.moof(e.sequenceNumber++,g,jt(e,{samples:l})),R="video",w={data1:U,data2:D,startPTS:(y-u)/r,endPTS:(b+p-u)/r,startDTS:(g-u)/r,endDTS:f/r,type:R,hasAudio:!1,hasVideo:!0,nb:l.length,dropped:e.dropped};return e.samples=[],e.dropped=0,w}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return Zge;case"ac3":return Qge;default:return Yge}}remuxAudio(e,n,i,s,r){const o=e.inputTimeScale,l=e.samplerate?e.samplerate:o,d=o/l,c=this.getSamplesPerFrame(e),u=c*d,f=this._initPTS,h=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,p=[],g=r!==void 0;let v=e.samples,y=h?0:8,b=this.nextAudioTs||-1;const E=f.baseTime*o/f.timescale,T=E+n*o;if(this.isAudioContiguous=i=i||v.length&&b>0&&(s&&Math.abs(T-(b+E))<9e3||Math.abs(Ts(v[0].pts,T)-(b+E))<20*u),v.forEach(function(x){x.pts=Ts(x.pts,T)}),!i||b<0){if(v=v.filter(x=>x.pts>=0),!v.length)return;r===0?b=0:s&&!g?b=Math.max(0,T-E):b=v[0].pts-E}if(e.segmentCodec==="aac"){const x=this.config.maxAudioFramesDrift;for(let C=0,U=b+E;C<v.length;C++){const R=v[C],w=R.pts,P=w-U,V=Math.abs(1e3*P/o);if(P<=-x*u&&g)C===0&&(this.warn(`Audio frame @ ${(w/o).toFixed(3)}s overlaps marker by ${Math.round(1e3*P/o)} ms.`),this.nextAudioTs=b=w-E,U=w);else if(P>=x*u&&V<jge&&g){let Z=Math.round(P/u);for(U=w-Z*u;U<0&&Z&&u;)Z--,U+=u;C===0&&(this.nextAudioTs=b=U-E),this.warn(`Injecting ${Z} audio frames @ ${((U-E)/o).toFixed(3)}s due to ${Math.round(1e3*P/o)} ms gap.`);for(let ee=0;ee<Z;
3512ee++){let ne=LS.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);ne||(this.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),ne=R.unit.subarray()),v.splice(C,0,{unit:ne,pts:U}),U+=u,C++}}R.pts=U,U+=u}}let I=null,M=null,H,N=0,$=v.length;for(;$--;)N+=v[$].unit.byteLength;for(let x=0,C=v.length;x<C;x++){const U=v[x],R=U.unit;let w=U.pts;if(M!==null){const V=p[x-1];V.duration=Math.round((w-M)/d)}else if(i&&e.segmentCodec==="aac"&&(w=b+E),I=w,N>0){N+=y;try{H=new Uint8Array(N)}catch(V){this.observer.emit(B.ERROR,B.ERROR,{type:Ge.MUX_ERROR,details:de.REMUX_ALLOC_ERROR,fatal:!1,error:V,bytes:N,reason:`fail allocating audio mdat ${N}`});return}h||(new DataView(H.buffer).setUint32(0,N),H.set(qn.types.mdat,4))}else return;H.set(R,y);const P=R.byteLength;y+=P,p.push(bP(!0,c,P,0)),M=w}const F=p.length;if(!F)return;const D=p[p.length-1];b=M-E,this.nextAudioTs=b+d*D.duration;const L=h?new Uint8Array(0):qn.moof(e.sequenceNumber++,I/d,jt({},e,{samples:p}));e.samples=[];const m=(I-E)/o,S=b/o,A={data1:L,data2:H,startPTS:m,endPTS:S,startDTS:m,endDTS:S,type:"audio",hasAudio:!0,hasVideo:!1,nb:F};return this.isAudioContiguous=!0,A}};a(OI,"MP4Remuxer");let Ed=OI;function Ts(t,e){let n;if(e===null)return t;for(e<t?n=-8589934592:n=8589934592;Math.abs(t-e)>4294967296;)t+=n;return t}a(Ts,"normalizePts");function Jge(t){for(let e=0;e<t.length;e++)if(t[e].key)return e;return-1}a(Jge,"findKeyframeIndex");function n4(t,e,n,i){const s=t.samples.length;if(!s)return;const r=t.inputTimeScale;for(let l=0;l<s;l++){const d=t.samples[l];d.pts=Ts(d.pts-n.baseTime*r/n.timescale,e*r)/r,d.dts=Ts(d.dts-i.baseTime*r/i.timescale,e*r)/r}const o=t.samples;return t.samples=[],{samples:o}}a(n4,"flushTextTrackMetadataCueSamples");function i4(t,e,n){const i=t.samples.length;if(!i)return;const s=t.inputTimeScale;for(let o=0;o<i;o++){const l=t.samples[o];l.pts=Ts(l.pts-n.baseTime*s/n.timescale,e*s)/s}t.samples.sort((o,l)=>o.pts-l.pts);const r=t.samples;return t.samples=[],{samples:r}}a(i4,"flushTextTrackUserdataCueSamples");const NI=class NI extends ms{constructor(e,n,i,s){super("passthrough-remuxer",s),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,this.isVideoContiguous=!1}destroy(){}resetTimeStamp(e){this.lastEndTime=null;const n=this.initPTS;n&&e&&n.baseTime===e.baseTime&&n.timescale===e.timescale||(this.initPTS=e)}resetNextTimestamp(){this.isVideoContiguous=!1,this.lastEndTime=null}resetInitSegment(e,n,i,s){this.audioCodec=n,this.videoCodec=i,this.generateInitSegment(rpe(e,s)),this.emitInitSegment=!0}generateInitSegment(e){let{audioCodec:n,videoCodec:i}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const s=this.initData=b3(e);s.audio&&(n=EP(s.audio,ln.AUDIO,this)),s.video&&(i=EP(s.video,ln.VIDEO,this));const r={};s.audio&&s.video?r.audiovideo={container:"video/mp4",codec:n+","+i,supplemental:s.video.supplemental,initSegment:e,id:"main"}:s.audio?r.audio={container:"audio/mp4",codec:n,initSegment:e,id:"audio"}:s.video?r.video={container:"video/mp4",codec:i,supplemental:s.video.supplemental,initSegment:e,id:"main"}:this.warn("initSegment does not contain moov or trak boxes."),this.initTracks=r}remux(e,n,i,s,r,o){var l,d;let{initPTS:c,lastEndTime:u}=this;const f={audio:void 0,video:void 0,text:s,id3:i,initSegment:void 0};Pe(u)||(u=this.lastEndTime=r||0);const h=n.samples;if(!(h!=null&&h.length))return f;const p={initPTS:void 0,timescale:void 0,trackId:void 0};let g=this.initData;if((l=g)!=null&&l.length||(this.generateInitSegment(h),g=this.initData),!((d=g)!=null&&d.length))return this.warn("Failed to generate initSegment."),f;this.emitInitSegment&&(p.tracks=this.initTracks,this.emitInitSegment=!1);const v=ape(h,g,this),y=g.audio?v[g.audio.id]:null,b=g.video?v[g.video.id]:null,E=jg(b,1/0),T=jg(y,1/0),I=jg(b,0,!0),M=jg(y,0,!0);let H,N=r,$=0;if(y&&(!b||!c&&T<E||c&&c.trackId===g.audio.id)?(p.trackId=g.audio.id,H=y,$=M-T):b&&(p.trackId=g.video.id,H=b,$=I-E),H){const x=H.timescale;N=H.start/x,p.initPTS=H.start-r*x,p.timescale=x,c||(this.initPTS=c={baseTime:p.initPTS,timescale:x,trackId:p.trackId})}(o||!c)&&(Xge(c,N,r,$)||p.timescale!==c.timescale)&&(p.initPTS=N-r,p.timescale=1,c&&c.timescale===1&&this.warn(`Adjusting initPTS @${r} from ${c.baseTime/c.timescale} to ${p.initPTS}`),this.initPTS=c={baseTime:p.initPTS,timescale:1});const F=e?N-c.baseTime/c.timescale:u,D=F+$;$>0?this.lastEndTime=D:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const L=!!g.audio,m=!!g.video;let S="";L&&(S+="audio"),m&&(S+="video");const _={data1:h,startPTS:F,startDTS:F,endPTS:D,endDTS:D,type:S,hasAudio:L,hasVideo:m,nb:1,dropped:0};f.audio=L&&!m?_:void 0,f.video=m?_:void 0;
vendor: 5,116 bytes, line 3512
3512const A=b?.sampleCount;if(A){const x=b.keyFrameIndex,C=x!==-1;_.nb=A,_.dropped=x===0||this.isVideoContiguous?0:C?x:A,_.independent=C,_.firstKeyFrame=x,C&&b.keyFrameStart&&(_.firstKeyFramePTS=(b.keyFrameStart-c.baseTime)/c.timescale),this.isVideoContiguous||(f.independent=C),this.isVideoContiguous||(this.isVideoContiguous=C),_.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${x}/${A} dropped: ${_.dropped} start: ${_.firstKeyFramePTS||"NA"}`)}return f.initSegment=p,f.id3=n4(i,r,c,c),s.samples.length&&(f.text=i4(s,r,c)),f}};a(NI,"PassThroughRemuxer");let RS=NI;function jg(t,e,n=!1){return t?.start!==void 0?(t.start+(n?t.duration:0))/t.timescale:e}a(jg,"toStartEndOrDefault");function Xge(t,e,n,i){if(t===null)return!0;const s=Math.max(i,1),r=e-t.baseTime/t.timescale;return Math.abs(r-n)>s}a(Xge,"isInvalidInitPts");function EP(t,e,n){const i=t?.codec;return i&&i.length>4?i:e===ln.AUDIO?i==="ec-3"||i==="ac-3"||i==="alac"?i:i==="fLaC"||i==="Opus"?hv(i,!1):(n.warn(`Unhandled audio codec "${i}" in mp4 MAP`),i||"mp4a"):(n.warn(`Unhandled video codec "${i}" in mp4 MAP`),i||"avc1")}a(EP,"getParsedTrackCodec");let so;try{so=self.performance.now.bind(self.performance)}catch{so=Date.now}const Vm=[{demux:SS,remux:RS},{demux:AS,remux:Ed},{demux:ES,remux:Ed},{demux:wS,remux:Ed}];Vm.splice(2,0,{demux:_S,remux:Ed});const FI=class FI{constructor(e,n,i,s,r,o){this.asyncResult=!1,this.logger=void 0,this.observer=void 0,this.typeSupported=void 0,this.config=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=n,this.config=i,this.id=r,this.logger=o}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,n,i,s){const r=i.transmuxing;r.executeStart=so();let o=new Uint8Array(e);const{currentTransmuxState:l,transmuxConfig:d}=this;s&&(this.currentTransmuxState=s);const{contiguous:c,discontinuity:u,trackSwitch:f,accurateTimeOffset:h,timeOffset:p,initSegmentChange:g}=s||l,{audioCodec:v,videoCodec:y,defaultInitPts:b,duration:E,initSegmentData:T}=d,I=eme(o,n);if(I&&bd(I.method)){const $=this.getDecrypter(),F=NA(I.method);if($.isSync()){let D=$.softwareDecrypt(o,I.key.buffer,I.iv.buffer,F);if(i.part>-1){const m=$.flush();D=m&&m.buffer}if(!D)return r.executeEnd=so(),SE(i);o=new Uint8Array(D)}else return this.asyncResult=!0,this.decryptionPromise=$.webCryptoDecrypt(o,I.key.buffer,I.iv.buffer,F).then(D=>{const L=this.push(D,null,i);return this.decryptionPromise=null,L}),this.decryptionPromise}const M=this.needsProbing(u,f);if(M){const $=this.configureTransmuxer(o);if($)return this.logger.warn(`[transmuxer] ${$.message}`),this.observer.emit(B.ERROR,B.ERROR,{type:Ge.MEDIA_ERROR,details:de.FRAG_PARSING_ERROR,fatal:!1,error:$,reason:$.message}),r.executeEnd=so(),SE(i)}(u||f||g||M)&&this.resetInitSegment(T,v,y,E,n),(u||g||M)&&this.resetInitialTimestamp(b),c||this.resetContiguity();const H=this.transmux(o,I,p,h,i);this.asyncResult=$h(H);const N=this.currentTransmuxState;return N.contiguous=!0,N.discontinuity=!1,N.trackSwitch=!1,r.executeEnd=so(),H}flush(e){const n=e.transmuxing;n.executeStart=so();const{decrypter:i,currentTransmuxState:s,decryptionPromise:r}=this;if(r)return this.asyncResult=!0,r.then(()=>this.flush(e));const o=[],{timeOffset:l}=s;if(i){const f=i.flush();f&&o.push(this.push(f.buffer,null,e))}const{demuxer:d,remuxer:c}=this;if(!d||!c){n.executeEnd=so();const f=[SE(e)];return this.asyncResult?Promise.resolve(f):f}const u=d.flush(l);return $h(u)?(this.asyncResult=!0,u.then(f=>(this.flushRemux(o,f,e),o))):(this.flushRemux(o,u,e),this.asyncResult?Promise.resolve(o):o)}flushRemux(e,n,i){const{audioTrack:s,videoTrack:r,id3Track:o,textTrack:l}=n,{accurateTimeOffset:d,timeOffset:c}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${i.sn}${i.part>-1?" part: "+i.part:""} of ${this.id===Ue.MAIN?"level":"track"} ${i.level}`);const u=this.remuxer.remux(s,r,o,l,c,d,!0,this.id);e.push({remuxResult:u,chunkMeta:i}),i.transmuxing.executeEnd=so()}resetInitialTimestamp(e){const{demuxer:n,remuxer:i}=this;!n||!i||(n.resetTimeStamp(e),i.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:n}=this;!e||!n||(e.resetContiguity(),n.resetNextTimestamp())}resetInitSegment(e,n,i,s,r){const{demuxer:o,remuxer:l}=this;!o||!l||(o.resetInitSegment(e,n,i,s),l.resetInitSegment(e,n,i,r))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,n,i,s,r){let o;return n&&n.method==="SAMPLE-AES"?o=this.transmuxSampleAes(e,n,i,s,r):o=this.transmuxUnencrypted(e,i,s,r),o}transmuxUnencrypted(e,n,i,s){const{audioTrack:r,videoTrack:o,id3Track:l,textTrack:d}=this.demuxer.demux(e,n,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(r,o,l,d,n,i,!1,this.id),chunkMeta:s}}transmuxSampleAes(e,n,i,s,r){return this.demuxer.demuxSampleAes(e,n,i).then(o=>({remuxResult:this.remuxer.remux(o.audioTrack,o.videoTrack,o.id3Track,o.textTrack,i,s,!1,this.id),chunkMeta:r}))}
3512configureTransmuxer(e){const{config:n,observer:i,typeSupported:s}=this;let r;for(let f=0,h=Vm.length;f<h;f++){var o;if((o=Vm[f].demux)!=null&&o.probe(e,this.logger)){r=Vm[f];break}}if(!r)return new Error("Failed to find demuxer by probing fragment data");const l=this.demuxer,d=this.remuxer,c=r.remux,u=r.demux;(!d||!(d instanceof c))&&(this.remuxer=new c(i,n,s,this.logger)),(!l||!(l instanceof u))&&(this.demuxer=new u(i,n,s,this.logger),this.probe=u.probe)}needsProbing(e,n){return!this.demuxer||!this.remuxer||e||n}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new Dh(this.config)),e}};a(FI,"Transmuxer");let Rv=FI;function eme(t,e){let n=null;return t.byteLength>0&&e?.key!=null&&e.iv!==null&&e.method!=null&&(n=e),n}a(eme,"getEncryptionType");const SE=a(t=>({remuxResult:{},chunkMeta:t}),"emptyResult");function $h(t){return"then"in t&&t.then instanceof Function}a($h,"isPromise");const UI=class UI{constructor(e,n,i,s,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=n,this.initSegmentData=i,this.duration=s,this.defaultInitPts=r||null}};a(UI,"TransmuxConfig");let kS=UI;const BI=class BI{constructor(e,n,i,s,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=n,this.accurateTimeOffset=i,this.trackSwitch=s,this.timeOffset=r,this.initSegmentChange=o}};a(BI,"TransmuxState");let MS=BI,_P=0;const $I=class $I{constructor(e,n,i,s){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=_P++,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.onWorkerMessage=d=>{const c=d.data,u=this.hls;if(!(!u||!(c!=null&&c.event)||c.instanceNo!==this.instanceNo))switch(c.event){case"init":{var f;const h=(f=this.workerContext)==null?void 0:f.objectURL;h&&self.URL.revokeObjectURL(h);break}case"transmuxComplete":{this.handleTransmuxComplete(c.data);break}case"flush":{this.onFlush(c.data);break}case"workerLog":{u.logger[c.data.logType]&&u.logger[c.data.logType](c.data.message);break}default:{c.data=c.data||{},c.data.frag=this.frag,c.data.part=this.part,c.data.id=this.id,u.trigger(c.event,c.data);break}}},this.onWorkerError=d=>{if(!this.hls)return;const c=new Error(`${d.message}  (${d.filename}:${d.lineno})`);this.hls.config.enableWorker=!1,this.hls.logger.warn(`Error in "${this.id}" Web Worker, fallback to inline`),this.hls.trigger(B.ERROR,{type:Ge.OTHER_ERROR,details:de.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:c})};const r=e.config;this.hls=e,this.id=n,this.useWorker=!!r.enableWorker,this.onTransmuxComplete=i,this.onFlush=s;const o=a((d,c)=>{c=c||{},c.frag=this.frag||void 0,d===B.ERROR&&(c=c,c.parent=this.id,c.part=this.part,this.error=c.error),this.hls.trigger(d,c)},"forwardMessage");this.observer=new FA,this.observer.on(B.FRAG_DECRYPTED,o),this.observer.on(B.ERROR,o);const l=HC(r.preferManagedMediaSource);if(this.useWorker&&typeof Worker<"u"){const d=this.hls.logger;if(r.workerPath||gge()){try{r.workerPath?(d.log(`loading Web Worker ${r.workerPath} for "${n}"`),this.workerContext=vge(r.workerPath)):(d.log(`injecting Web Worker for "${n}"`),this.workerContext=mge());const{worker:u}=this.workerContext;u.addEventListener("message",this.onWorkerMessage),u.addEventListener("error",this.onWorkerError),u.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:l,id:n,config:hn(r)})}catch(u){d.warn(`Error setting up "${n}" Web Worker, fallback to inline`,u),this.terminateWorker(),this.error=null,this.transmuxer=new Rv(this.observer,l,r,"",n,e.logger)}return}}this.transmuxer=new Rv(this.observer,l,r,"",n,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const e=this.instanceNo;this.instanceNo=_P++;const n=this.hls.config,i=HC(n.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupp
vendor: 5,801 bytes, lines 3512-3518
3512orted:i,id:this.id,config:hn(n)})}}terminateWorker(){if(this.workerContext){const{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),yge(this.hls.config.workerPath)}}destroy(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{const n=this.transmuxer;n&&(n.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}push(e,n,i,s,r,o,l,d,c,u){var f,h;c.transmuxing.start=self.performance.now();const{instanceNo:p,transmuxer:g}=this,v=o?o.start:r.start,y=r.decryptdata,b=this.frag,E=!(b&&r.cc===b.cc),T=!(b&&c.level===b.level),I=b?c.sn-b.sn:-1,M=this.part?c.part-this.part.index:-1,H=I===0&&c.id>1&&c.id===b?.stats.chunkCount,N=!T&&(I===1||I===0&&(M===1||H&&M<=0)),$=self.performance.now();(T||I||r.stats.parsing.start===0)&&(r.stats.parsing.start=$),o&&(M||!N)&&(o.stats.parsing.start=$);const F=!(b&&((f=r.initSegment)==null?void 0:f.url)===((h=b.initSegment)==null?void 0:h.url)),D=new MS(E,N,d,T,v,F);if(!N||E||F){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${r.type} sn: ${c.sn}${c.part>-1?" part: "+c.part:""} ${this.id===Ue.MAIN?"level":"track"}: ${c.level} id: ${c.id}
3513        discontinuity: ${E}
3514        trackSwitch: ${T}
3515        contiguous: ${N}
3516        accurateTimeOffset: ${d}
3517        timeOffset: ${v}
3518        initSegmentChange: ${F}`);const L=new kS(i,s,n,l,u);this.configureTransmuxer(L)}if(this.frag=r,this.part=o,this.workerContext)this.workerContext.worker.postMessage({instanceNo:p,cmd:"demux",data:e,decryptdata:y,chunkMeta:c,state:D},e instanceof ArrayBuffer?[e]:[]);else if(g){const L=g.push(e,y,c,D);$h(L)?L.then(m=>{this.handleTransmuxComplete(m)}).catch(m=>{this.transmuxerError(m,c,"transmuxer-interface push error")}):this.handleTransmuxComplete(L)}}flush(e){e.transmuxing.start=self.performance.now();const{instanceNo:n,transmuxer:i}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:n,cmd:"flush",chunkMeta:e});else if(i){const s=i.flush(e);$h(s)?s.then(r=>{this.handleFlushResult(r,e)}).catch(r=>{this.transmuxerError(r,e,"transmuxer-interface flush error")}):this.handleFlushResult(s,e)}}transmuxerError(e,n,i){this.hls&&(this.error=e,this.hls.trigger(B.ERROR,{type:Ge.MEDIA_ERROR,details:de.FRAG_PARSING_ERROR,chunkMeta:n,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:e,err:e,reason:i}))}handleFlushResult(e,n){e.forEach(i=>{this.handleTransmuxComplete(i)}),this.onFlush(n)}configureTransmuxer(e){const{instanceNo:n,transmuxer:i}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:n,cmd:"configure",config:e}):i&&i.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}};a($I,"TransmuxerInterface");let kv=$I;const wP=100,HI=class HI extends Nh{constructor(e,n,i){super(e,n,i,"audio-stream-controller",Ue.AUDIO),this.mainAnchor=null,this.mainFragLoading=null,this.audioOnly=!1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=!1,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.resetItem()}resetItem(){this.mainDetails=this.mainAnchor=this.mainFragLoading=this.bufferedTrack=this.switchingTrack=this.waitingData=this.cachedTrackLoadedData=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(B.LEVEL_LOADED,this.onLevelLoaded,this),e.on(B.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(B.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(B.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(B.BUFFER_RESET,this.onBufferReset,this),e.on(B.BUFFER_CREATED,this.onBufferCreated,this),e.on(B.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(B.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(B.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(B.FRAG_LOADING,this.onFragLoading,this),e.on(B.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){const{hls:e}=this;e&&(super.unregisterListeners(),e.off(B.LEVEL_LOADED,this.onLevelLoaded,this),e.off(B.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(B.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(B.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(B.BUFFER_RESET,this.onBufferReset,this),e.off(B.BUFFER_CREATED,this.onBufferCreated,this),e.off(B.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(B.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(B.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(B.FRAG_LOADING,this.onFragLoading,this),e.off(B.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(e,{frag:n,id:i,initPTS:s,timescale:r}){if(i===Ue.MAIN){const o=n.cc,l=this.fragCurrent;if(this.initPTS[o]={baseTime:s,timescale:r},this.log(`InitPTS for cc: ${o} found from main: ${s}/${r}`),this.mainAnchor=n,this.state===be.WAITING_INIT_PTS){const d=this.waitingData;(!d&&!this.loadingParts||d&&d.frag.cc!==o)&&this.syncWithAnchor(n,d?.frag)}else!this.hls.hasEnoughToStart&&l&&l.cc!==o?(l.abortRequests(),this.syncWithAnchor(n,l)):this.state===be.IDLE&&this.tick()}}getLoadPosition(){return!this.startFragRequested&&this.nextLoadPosition>=0?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(e,n){var i;const s=((i=this.mainFragLoading)==null?void 0:i.frag)||null;if(n&&s?.cc===n.cc)return;const r=(s||e).cc,o=this.getLevelDetails(),l=this.getLoadPosition(),d=L3(o,r,l);d&&(this.log(`Syncing with main frag at ${d.start} cc ${d.cc}`),this.startFragRequested=!1,this.nextLoadPosition=d.start,this.resetLoadingState(),this.state===be.IDLE&&this.doTickIdle())}
vendor: 28,655 bytes, lines 3518-3521
3518startLoad(e,n){if(!this.levels){this.startPosition=e,this.state=be.STOPPED;return}const i=this.lastCurrentTime;this.stopLoad(),this.setInterval(wP),i>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${i.toFixed(3)}`),e=i,this.state=be.IDLE):this.state=be.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=n?-1:e,this.tick()}doTick(){switch(this.state){case be.IDLE:this.doTickIdle();break;case be.WAITING_TRACK:{const{levels:n,trackId:i}=this,s=n?.[i],r=s?.details;if(r&&!this.waitForLive(s)){if(this.waitForCdnTuneIn(r))break;this.state=be.WAITING_INIT_PTS}break}case be.FRAG_LOADING_WAITING_RETRY:{var e;const n=performance.now(),i=this.retryDate;if(!i||n>=i||(e=this.media)!=null&&e.seeking){const{levels:s,trackId:r}=this;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded(s?.[r]||null),this.state=be.IDLE}break}case be.WAITING_INIT_PTS:{const n=this.waitingData;if(n){const{frag:i,part:s,cache:r,complete:o}=n,l=this.mainAnchor;if(this.initPTS[i.cc]!==void 0){this.waitingData=null,this.state=be.FRAG_LOADING;const d=r.flush().buffer,c={frag:i,part:s,payload:d,networkDetails:null};this._handleFragmentLoadProgress(c),o&&super._handleFragmentLoadComplete(c)}else l&&l.cc!==n.frag.cc&&this.syncWithAnchor(l,n.frag)}else this.state=be.IDLE}}this.onTickEnd()}resetLoadingState(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){var e;const{hls:n,levels:i,media:s,trackId:r}=this,o=n.config;if(!this.buffering||!s&&!this.primaryPrefetch&&(this.startFragRequested||!o.startFragPrefetch)||!(i!=null&&i[r]))return;const l=i[r],d=l.details;if(!d||this.waitForLive(l)||this.waitForCdnTuneIn(d)){this.state=be.WAITING_TRACK,this.startFragRequested=!1;return}const c=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&c&&(this.bufferFlushed=!1,this.afterBufferFlushed(c,ln.AUDIO,Ue.AUDIO));const u=this.getFwdBufferInfo(c,Ue.AUDIO);if(u===null)return;if(!this.switchingTrack&&this._streamEnded(u,d)){n.trigger(B.BUFFER_EOS,{type:"audio"}),this.state=be.ENDED;return}const f=u.len,h=n.maxBufferLength,p=d.fragments,g=p[0].start,v=this.getLoadPosition(),y=this.flushing?v:u.end;if(this.switchingTrack&&s){const T=v;d.PTSKnown&&T<g&&(u.end>g||u.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),s.currentTime=g+.05)}if(f>=h&&!this.switchingTrack&&y<p[p.length-1].start)return;let b=this.getNextFragment(y,d);if(b&&this.isLoopLoading(b,y)&&(b=this.getNextFragmentLoopLoading(b,d,u,Ue.MAIN,h)),!b){this.bufferFlushed=!0;return}let E=((e=this.mainFragLoading)==null?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&E&&$n(b)&&!b.endList&&(!d.live||!this.loadingParts&&y<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(E)===Kn.OK&&(this.mainFragLoading=E=null),E&&$n(E))){if(b.start>E.end){const I=this.fragmentTracker.getFragAtPos(y,Ue.MAIN);I&&I.end>E.end&&(E=I,this.mainFragLoading={frag:I,targetBufferTime:null})}if(b.start>E.end)return}this.loadFragment(b,l,y)}onMediaDetaching(e,n){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,n)}onAudioTracksUpdated(e,{audioTracks:n}){this.resetTransmuxer(),this.levels=n.map(i=>new Yl(i))}onAudioTrackSwitching(e,n){const i=!!n.url;this.trackId=n.id;const{fragCurrent:s}=this;s&&(s.abortRequests(),this.removeUnbufferedFrags(s.start)),this.resetLoadingState(),i?(this.switchingTrack=n,this.flushAudioIfNeeded(n),this.state!==be.STOPPED&&(this.setInterval(wP),this.state=be.IDLE,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=n,this.clearInterval())}onManifestLoading(){super.onManifestLoading(),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1}onLevelLoaded(e,n){this.mainDetails=n.details;const i=this.cachedTrackLoadedData;i&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(B.AUDIO_TRACK_LOADED,i))}onAudioTrackLoaded(e,n){var i;const{levels:s}=this,{details:r,id:o,groupId:l,track:d}=n;if(!s){this.warn(`Audio tracks reset while loading track ${o} "${d.name}" of "${l}"`);return}const c=this.mainDetails;if(!c||r.endCC>c.endCC||c.expired){this.cachedTrackLoadedData=n,this.state!==be.STOPPED&&(this.state=be.WAITING_TRACK);return}this.cachedTrackLoadedData=null,this.log(`Audio track ${o} "${d.name}" of "${l}" loaded [${r.startSN},${r.endSN}]${r.lastPartSn?`[part-${r.lastPartSn}-${r.lastPartIndex}]`:""},duration:${r.totalduration}`);const u=s[o];let f=0;if(r.live||(i=u.details)!=null&&i.live){if(this.checkLiveUpdate(r),r.deltaUpdateFailed)return;if(u.details){var h;f=this.alignPlaylists(r,u.details,(h=this.levelLastLoaded)==null?void 0:h.details)}r.alignedSliding||($3(r,c),r.alignedSliding||Sv(r,c),f=r.fragmentStart)}u.details=r,this.levelLastLoaded=u,this.startFragRequested||this.setStartPosition(c,f),this.hls.trigger(B.AUDIO_TRACK_UPDATED,{details:r,id:o,groupId:n.groupId}),this.state===be.WAITING_TRACK&&!this.waitForCdnTuneIn(r)&&(this.state=be.IDLE),this.tick()}_handleFragmentLoadProgress(e){var n;const i=e.frag,{part:s,payload:r}=e,{config:o,trackId:l,levels:d}=this;if(!d){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);return}const c=d[l];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(i.start);return}const f=o.defaultAudioCodec||c.audioCodec||"mp4a.40.2";let h=this.transmuxer;h||(h=this.transmuxer=new kv(this.hls,Ue.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const p=this.initPTS[i.cc],g=(n=i.initSegment)==null?void 0:n.data;if(p!==void 0){const y=s?s.index:-1,b=y!==-1,E=new Oh(i.level,i.sn,i.stats.chunkCount,r.byteLength,y,b);h.push(r,g,f,"",i,s,u.totalduration,!1,E,p)}else{this.log(`Unknown video PTS for cc ${i.cc}, waiting for video PTS before demuxing audio frag ${i.sn} of [${u.startSN} ,${u.endSN}],track ${l}`);const{cache:v}=this.waitingData=this.waitingData||{frag:i,part:s,cache:new Tv,complete:!1};v.push(new Uint8Array(r)),this.state!==be.STOPPED&&(this.state=be.WAITING_INIT_PTS)}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=null}onBufferCreated(e,n){this.bufferFlushed=this.flushing=!1;const i=n.tracks.audio;i&&(this.mediaBuffer=i.buffer||null)}onFragLoading(e,n){!this.audioOnly&&n.frag.type===Ue.MAIN&&$n(n.frag)&&(this.mainFragLoading=n,this.state===be.IDLE&&this.tick())}onFragBuffered(e,n){const{frag:i,part:s}=n;if(i.type!==Ue.AUDIO){!this.audioOnly&&i.type===Ue.MAIN&&!i.elementaryStreams.video&&!i.elementaryStreams.audiovideo&&(this.audioOnly=!0,this.mainFragLoading=null);return}if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${s?" p: "+s.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if($n(i)){this.fragPrevious=i;const r=this.switchingTrack;r&&(this.bufferedTrack=r,this.switchingTrack=null,this.hls.trigger(B.AUDIO_TRACK_SWITCHED,nn({},r)))}this.fragBufferedComplete(i,s),this.media&&this.tick()}onError(e,n){var i;if(n.fatal){this.state=be.ERROR;return}switch(n.details){case de.FRAG_GAP:case de.FRAG_PARSING_ERROR:case de.FRAG_DECRYPT_ERROR:case de.FRAG_LOAD_ERROR:case de.FRAG_LOAD_TIMEOUT:case de.KEY_LOAD_ERROR:case de.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Ue.AUDIO,n);break;case de.AUDIO_TRACK_LOAD_ERROR:case de.AUDIO_TRACK_LOAD_TIMEOUT:case de.LEVEL_PARSING_ERROR:!n.levelRetry&&this.state===be.WAITING_TRACK&&((i=n.context)==null?void 0:i.type)===wt.AUDIO_TRACK&&(this.state=be.IDLE);break;case de.BUFFER_ADD_CODEC_ERROR:case de.BUFFER_APPEND_ERROR:if(n.parent!=="audio")return;this.reduceLengthAndFlushBuffer(n)||this.resetLoadingState();break;case de.BUFFER_FULL_ERROR:if(n.parent!=="audio")return;this.reduceLengthAndFlushBuffer(n)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case de.INTERNAL_EXCEPTION:this.recoverWorkerError(n);break}}onBufferFlushing(e,{type:n}){n!==ln.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:n}){if(n!==ln.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===be.ENDED&&(this.state=be.IDLE);const i=this.mediaBuffer||this.media;i&&(this.afterBufferFlushed(i,n,Ue.AUDIO),this.tick())}}_handleTransmuxComplete(e){var n;const i="audio",{hls:s}=this,{remuxResult:r,chunkMeta:o}=e,l=this.getCurrentContext(o);if(!l){this.resetWhenMissingContext(o);return}const{frag:d,part:c,level:u}=l,{details:f}=u,{audio:h,text:p,id3:g,initSegment:v}=r;if(this.fragContextChanged(d)||!f){this.fragmentTracker.removeFragment(d);return}if(this.state=be.PARSING,this.switchingTrack&&h&&this.completeAudioSwitch(this.switchingTrack),v!=null&&v.tracks){const y=d.initSegment||d;this._bufferInitSegment(u,v.tracks,y,o),s.trigger(B.FRAG_PARSING_INIT_SEGMENT,{frag:y,id:i,tracks:v.tracks})}if(h){const{startPTS:y,endPTS:b,startDTS:E,endDTS:T}=h;c&&(c.elementaryStreams[ln.AUDIO]={startPTS:y,endPTS:b,startDTS:E,endDTS:T}),d.setElementaryStreamInfo(ln.AUDIO,y,b,E,T),this.bufferFragmentData(h,d,c,o)}if(g!=null&&(n=g.samples)!=null&&n.length){const y=jt({id:i,frag:d,details:f},g);s.trigger(B.FRAG_PARSING_METADATA,y)}if(p){const y=jt({id:i,frag:d,details:f},p);s.trigger(B.FRAG_PARSING_USERDATA,y)}}_bufferInitSegment(e,n,i,s){if(this.state!==be.PARSING||(n.video&&delete n.video,n.audiovideo&&delete n.audiovideo,!n.audio))return;const r=n.audio;r.id=Ue.AUDIO;const o=e.audioCodec;this.log(`Init audio buffer, container:${r.container}, codecs[level/parsed]=[${o}/${r.codec}]`),o&&o.split(",").length===1&&(r.levelCodec=o),this.hls.trigger(B.BUFFER_CODECS,n);const l=r.initSegment;if(l!=null&&l.byteLength){const d={type:"audio",frag:i,part:null,chunkMeta:s,parent:i.type,data:l};this.hls.trigger(B.BUFFER_APPENDING,d)}this.tickImmediate()}loadFragment(e,n,i){const s=this.fragmentTracker.getState(e);if(this.switchingTrack||s===Kn.NOT_LOADED||s===Kn.PARTIAL){var r;if(!$n(e))this._loadInitSegment(e,n);else if((r=n.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=be.WAITING_INIT_PTS;const o=this.mainDetails;o&&o.fragmentStart!==n.details.fragmentStart&&Sv(n.details,o)}else super.loadFragment(e,n,i)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack){const{name:n,lang:i,assocLang:s,characteristics:r,audioCodec:o,channels:l}=this.bufferedTrack;Ol({name:n,lang:i,assocLang:s,characteristics:r,audioCodec:o,channels:l},e,al)||(mv(e.url,this.hls)?(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null):this.bufferedTrack=e)}}completeAudioSwitch(e){const{hls:n}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,n.trigger(B.AUDIO_TRACK_SWITCHED,nn({},e))}};a(HI,"AudioStreamController");let CS=HI;const GI=class GI extends ms{constructor(e,n){super(n,e.logger),this.hls=void 0,this.canLoad=!1,this.timer=-1,this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,n,i){const s=n?.renditionReports;if(s){let r=-1;for(let o=0;o<s.length;o++){const l=s[o];let d;try{d=new self.URL(l.URI,n.url).href}catch(c){this.warn(`Could not construct new URL for Rendition Report: ${c}`),d=l.URI||""}if(d===e){r=o;break}else d===e.substring(0,d.length)&&(r=o)}if(r!==-1){const o=s[r],l=parseInt(o["LAST-MSN"])||n?.lastPartSn;let d=parseInt(o["LAST-PART"])||n?.lastPartIndex;if(this.hls.config.lowLatencyMode){const u=Math.min(n.age-n.partTarget,n.targetduration);d>=0&&u>n.partTarget&&(d+=1)}const c=i&&GC(i);return new gv(l,d>=0?d:void 0,c)}}}loadPlaylist(e){this.clearTimer()}loadingPlaylist(e,n){this.clearTimer()}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}getUrlWithDirectives(e,n){if(n)try{return n.addDirectives(e)}catch(i){this.warn(`Could not construct new URL with HLS Delivery Directives: ${i}`)}return e}playlistLoaded(e,n,i){const{details:s,stats:r}=n,o=self.performance.now(),l=r.loading.first?Math.max(0,o-r.loading.first):0;s.advancedDateTime=Date.now()-l;const d=this.hls.config.timelineOffset;if(d!==s.appliedTimelineOffset){const u=Math.max(d||0,0);s.appliedTimelineOffset=u,s.fragments.forEach(f=>{f.start=f.playlistOffset+u})}if(s.live||i!=null&&i.live){const u="levelInfo"in n?n.levelInfo:n.track;if(s.reloaded(i),i&&s.fragments.length>0){rge(i,s);const E=s.playlistParsingError;if(E){this.warn(E);const T=this.hls;if(!T.config.ignorePlaylistParsingErrors){var c;const{networkDetails:I}=n;T.trigger(B.ERROR,{type:Ge.NETWORK_ERROR,details:de.LEVEL_PARSING_ERROR,fatal:!1,url:s.url,error:E,reason:E.message,level:n.level||void 0,parent:(c=s.fragments[0])==null?void 0:c.type,networkDetails:I,stats:r});return}s.playlistParsingError=null}}s.requestScheduled===-1&&(s.requestScheduled=r.loading.start);const f=this.hls.mainForwardBufferInfo,h=f?f.end-f.len:0,p=(s.edge-h)*1e3,g=O3(s,p);if(s.requestScheduled+g<o?s.requestScheduled=o:s.requestScheduled+=g,this.log(`live playlist ${e} ${s.advanced?"REFRESHED "+s.lastPartSn+"-"+s.lastPartIndex:s.updated?"UPDATED":"MISSED"}`),!this.canLoad||!s.live)return;let v,y,b;if(s.canBlockReload&&s.endSN&&s.advanced){const E=this.hls.config.lowLatencyMode,T=s.lastPartSn,I=s.endSN,M=s.lastPartIndex,H=M!==-1,N=T===I;H?N?(y=I+1,b=E?0:M):(y=T,b=E?M+1:s.maxPartIndex):y=I+1;const $=s.age,F=$+s.ageHeader;let D=Math.min(F-s.partTarget,s.targetduration*1.5);if(D>0){if(F>s.targetduration*3)this.log(`Playlist last advanced ${$.toFixed(2)}s ago. Omitting segment and part directives.`),y=void 0,b=void 0;else if(i!=null&&i.tuneInGoal&&F-s.partTarget>i.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${i.tuneInGoal} to: ${D} with playlist age: ${s.age}`),D=0;else{const L=Math.floor(D/s.targetduration);if(y+=L,b!==void 0){const m=Math.round(D%s.targetduration/s.partTarget);b+=m}this.log(`CDN Tune-in age: ${s.ageHeader}s last advanced ${$.toFixed(2)}s goal: ${D} skip sn ${L} to part ${b}`)}s.tuneInGoal=D}if(v=this.getDeliveryDirectives(s,n.deliveryDirectives,y,b),E||!N){s.requestScheduled=o,this.loadingPlaylist(u,v);return}}else(s.canBlockReload||s.canSkipUntil)&&(v=this.getDeliveryDirectives(s,n.deliveryDirectives,y,b));v&&y!==void 0&&s.canBlockReload&&(s.requestScheduled=r.loading.first+Math.max(g-l*2,g/2)),this.scheduleLoading(u,v,s)}else this.clearTimer()}scheduleLoading(e,n,i){const s=i||e.details;if(!s){this.loadingPlaylist(e,n);return}const r=self.performance.now(),o=s.requestScheduled;if(r>=o){this.loadingPlaylist(e,n);return}const l=o-r;this.log(`reload live playlist ${e.name||e.bitrate+"bps"} in ${Math.round(l)} ms`),this.clearTimer(),this.timer=self.setTimeout(()=>this.loadingPlaylist(e,n),l)}getDeliveryDirectives(e,n,i,s){let r=GC(e);return n!=null&&n.skip&&e.deltaUpdateFailed&&(i=n.msn,s=n.part,r=Hm.No),new gv(i,s,r)}checkRetry(e){const n=e.details,i=vv(e),s=e.errorAction,{action:r,retryCount:o=0,retryConfig:l}=s||{},d=!!s&&!!l&&(r===wi.RetryRequest||!s.resolved&&r===wi.SendAlternateToPenaltyBox);if(d){var c;if(o>=l.maxNumRetry)return!1;if(i&&(c=e.context)!=null&&c.deliveryDirectives)this.warn(`Retrying playlist loading ${o+1}/${l.maxNumRetry} after "${n}" without delivery-directives`),this.loadPlaylist();else{const u=OA(l,o);this.clearTimer(),this.timer=self.setTimeout(()=>this.loadPlaylist(),u),this.warn(`Retrying playlist loading ${o+1}/${l.maxNumRetry} after "${n}" in ${u}ms`)}e.levelRetry=!0,s.resolved=!0}return d}};a(GI,"BasePlaylistController");let Hh=GI;function s4(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!Gh(t[n].attrs,e[n].attrs))return!1;return!0}a(s4,"subtitleOptionsIdentical");function Gh(t,e,n){const i=t["STABLE-RENDITION-ID"];return i&&!n?i===e["STABLE-RENDITION-ID"]:!(n||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(s=>t[s]!==e[s])}a(Gh,"mediaAttributesIdentical");function PS(t,e){return e.label.toLowerCase()===t.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(t.lang||"").toLowerCase())}a(PS,"subtitleTrackMatchesTextTrack");const VI=class VI extends Hh{constructor(e){super(e,"audio-track-controller"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(B.MANIFEST_LOADING,this.onManifestLoading,this),e.on(B.MANIFEST_PARSED,this.onManifestParsed,this),e.on(B.LEVEL_LOADING,this.onLevelLoading,this),e.on(B.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(B.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(B.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(B.MANIFEST_LOADING,this.onManifestLoading,this),e.off(B.MANIFEST_PARSED,this.onManifestParsed,this),e.off(B.LEVEL_LOADING,this.onLevelLoading,this),e.off(B.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(B.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(B.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,n){this.tracks=n.audioTracks||[]}onAudioTrackLoaded(e,n){const{id:i,groupId:s,details:r}=n,o=this.tracksInGroup[i];if(!o||o.groupId!==s){this.warn(`Audio track with id:${i} and group:${s} not found in active group ${o?.groupId}`);return}const l=o.details;o.details=n.details,this.log(`Audio track ${i} "${o.name}" lang:${o.lang} group:${s} loaded [${r.startSN}-${r.endSN}]`),i===this.trackId&&this.playlistLoaded(i,n,l)}onLevelLoading(e,n){this.switchLevel(n.level)}onLevelSwitching(e,n){this.switchLevel(n.level)}switchLevel(e){const n=this.hls.levels[e];if(!n)return;const i=n.audioGroups||null,s=this.groupIds;let r=this.currentTrack;if(!i||s?.length!==i?.length||i!=null&&i.some(l=>s?.indexOf(l)===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const l=this.tracks.filter(h=>!i||i.indexOf(h.groupId)!==-1);if(l.length)this.selectDefaultTrack&&!l.some(h=>h.default)&&(this.selectDefaultTrack=!1),l.forEach((h,p)=>{h.id=p});else if(!r&&!this.tracksInGroup.length)return;this.tracksInGroup=l;const d=this.hls.config.audioPreference;if(!r&&d){const h=Rr(d,l,al);if(h>-1)r=l[h];else{const p=Rr(d,this.tracks);r=this.tracks[p]}}let c=this.findTrackId(r);c===-1&&r&&(c=this.findTrackId(null));const u={audioTracks:l};this.log(`Updating audio tracks, ${l.length} track(s) found in group(s): ${i?.join(",")}`),this.hls.trigger(B.AUDIO_TRACKS_UPDATED,u);const f=this.trackId;if(c!==-1&&f===-1)this.setAudioTrack(c);else if(l.length&&f===-1){var o;const h=new Error(`No audio track selected for current audio group-ID(s): ${(o=this.groupIds)==null?void 0:o.join(",")} track count: ${l.length}`);this.warn(h.message),this.hls.trigger(B.ERROR,{type:Ge.MEDIA_ERROR,details:de.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:h})}}}onError(e,n){n.fatal||!n.context||n.context.type===wt.AUDIO_TRACK&&n.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(n.context.groupId)!==-1)&&this.checkRetry(n)}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){const n=this.hls;if(n.config.audioPreference=e,e){const i=this.allAudioTracks;if(this.selectDefaultTrack=!1,i.length){const s=this.currentTrack;if(s&&Ol(e,s,al))return s;const r=Rr(e,this.tracksInGroup,al);if(r>-1){const o=this.tracksInGroup[r];return this.setAudioTrack(r),o}else if(s){let o=n.loadLevel;o===-1&&(o=n.firstAutoLevel);const l=Cpe(e,n.levels,i,o,al);if(l===-1)return null;n.nextLoadLevel=l}if(e.channels||e.audioCodec){const o=Rr(e,i);if(o>-1)return i[o]}}}return null}setAudioTrack(e){const n=this.tracksInGroup;if(e<0||e>=n.length){this.warn(`Invalid audio track id: ${e}`);return}this.selectDefaultTrack=!1;const i=this.currentTrack,s=n[e],r=s.details&&!s.details.live;if(e===this.trackId&&s===i&&r||(this.log(`Switching to audio-track ${e} "${s.name}" lang:${s.lang} group:${s.groupId} channels:${s.channels}`),this.trackId=e,this.currentTrack=s,this.hls.trigger(B.AUDIO_TRACK_SWITCHING,nn({},s)),r))return;const o=this.switchParams(s.url,i?.details,s.details);this.loadPlaylist(o)}findTrackId(e){const n=this.tracksInGroup;for(let i=0;i<n.length;i++){const s=n[i];if(!(this.selectDefaultTrack&&!s.default)&&(!e||Ol(e,s,al)))return i}if(e){const{name:i,lang:s,assocLang:r,characteristics:o,audioCodec:l,channels:d}=e;for(let c=0;c<n.length;c++){const u=n[c];if(Ol({name:i,lang:s,assocLang:r,characteristics:o,audioCodec:l,channels:d},u,al))return c}for(let c=0;c<n.length;c++){const u=n[c];if(Gh(e.attrs,u.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return c}for(let c=0;c<n.length;c++){const u=n[c];if(Gh(e.attrs,u.attrs,["LANGUAGE"]))return c}}return-1}loadPlaylist(e){super.loadPlaylist();const n=this.currentTrack;this.shouldLoadPlaylist(n)&&mv(n.url,this.hls)&&this.scheduleLoading(n,e)}loadingPlaylist(e,n){super.loadingPlaylist(e,n);const i=e.id,s=e.groupId,r=this.getUrlWithDirectives(e.url,n),o=e.details,l=o?.age;this.log(`Loading audio-track ${i} "${e.name}" lang:${e.lang} group:${s}${n?.msn!==void 0?" at sn "+n.msn+" part "+n.part:""}${l&&o.live?" age "+l.toFixed(1)+(o.type&&" "+o.type||""):""} ${r}`),this.hls.trigger(B.AUDIO_TRACK_LOADING,{url:r,id:i,groupId:s,deliveryDirectives:n||null,track:e})}};a(VI,"AudioTrackController");let DS=VI;const WI=class WI{constructor(e){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=e}destroy(){this.tracks=this.queues=null}append(e,n,i){if(this.queues===null||this.tracks===null)return;const s=this.queues[n];s.push(e),s.length===1&&!i&&this.executeNext(n)}appendBlocker(e){return new Promise(n=>{const i={label:"async-blocker",execute:n,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.append(i,e)})}prependBlocker(e){return new Promise(n=>{if(this.queues){const i={label:"async-blocker-prepend",execute:n,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.queues[e].unshift(i)}})}removeBlockers(){this.queues!==null&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(e=>{var n;const i=(n=e[0])==null?void 0:n.label;(i==="async-blocker"||i==="async-blocker-prepend")&&(e[0].execute(),e.splice(0,1))})}unblockAudio(e){if(this.queues===null)return;this.queues.audio[0]===e&&this.shiftAndExecuteNext("audio")}executeNext(e){if(this.queues===null||this.tracks===null)return;const n=this.queues[e];if(n.length){const s=n[0];try{s.execute()}catch(r){var i;if(s.onError(r),this.queues===null||this.tracks===null)return;const o=(i=this.tracks[e])==null?void 0:i.buffer;o!=null&&o.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues!==null&&(this.queues[e].shift(),this.executeNext(e))}current(e){var n;return((n=this.queues)==null?void 0:n[e][0])||null}toString(){const{queues:e,tracks:n}=this;return e===null||n===null?"<destroyed>":`
3519${this.list("video")}
3520${this.list("audio")}
3521${this.list("audiovideo")}}`}list(e){var n,i;return(n=this.queues)!=null&&n[e]||(i=this.tracks)!=null&&i[e]?`${e}: (${this.listSbInfo(e)}) ${this.listOps(e)}`:""}listSbInfo(e){var n;const i=(n=this.tracks)==null?void 0:n[e],s=i?.buffer;return s?`SourceBuffer${s.updating?" updating":""}${i.ended?" ended":""}${i.ending?" ending":""}`:"none"}listOps(e){var n;return((n=this.queues)==null?void 0:n[e].map(i=>i.label).join(", "))||""}};a(WI,"BufferOperationQueue");let OS=WI;const SP=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,r4="HlsJsTrackRemovedError",zI=class zI extends Error{constructor(e){super(e),this.name=r4}};a(zI,"HlsJsTrackRemovedError");let NS=zI;const KI=class KI extends ms{constructor(e,n){super("buffer-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.details=null,this._objectUrl=null,this.operationQueue=null,this.bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.blockedAudioAppend=null,this.lastVideoAppendEnd=0,this.appendSource=void 0,this.transferData=void 0,this.overrides=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.sourceBuffers=[[null,null],[null,null]],this._onEndStreaming=i=>{var s;this.hls&&((s=this.mediaSource)==null?void 0:s.readyState)==="open"&&this.hls.pauseBuffering()},this._onStartStreaming=i=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=i=>{const{media:s,mediaSource:r}=this;i&&this.log("Media source opened"),!(!s||!r)&&(r.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger(B.MEDIA_ATTACHED,{media:s,mediaSource:r}),this.mediaSource!==null&&this.checkPendingTracks())},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:i,_objectUrl:s}=this;i!==s&&this.error(`Media element src was set while attaching MediaSource (${s} > ${i})`)},this.hls=e,this.fragmentTracker=n,this.appendSource=Zhe(Ua(e.config.preferManagedMediaSource)),this.initTracks(),this.registerListeners()}hasSourceTypes(){return Object.keys(this.tracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.transferData=this.overrides=void 0,this.operationQueue&&(this.operationQueue.destroy(),this.operationQueue=null),this.hls=this.fragmentTracker=null,this._onMediaSourceOpen=this._onMediaSourceClose=null,this._onMediaSourceEnded=null,this._onStartStreaming=this._onEndStreaming=null}registerListeners(){const{hls:e}=this;e.on(B.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(B.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(B.MANIFEST_LOADING,this.onManifestLoading,this),e.on(B.MANIFEST_PARSED,this.onManifestParsed,this),e.on(B.BUFFER_RESET,this.onBufferReset,this),e.on(B.BUFFER_APPENDING,this.onBufferAppending,this),e.on(B.BUFFER_CODECS,this.onBufferCodecs,this),e.on(B.BUFFER_EOS,this.onBufferEos,this),e.on(B.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(B.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(B.FRAG_PARSED,this.onFragParsed,this),e.on(B.FRAG_CHANGED,this.onFragChanged,this),e.on(B.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(B.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(B.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(B.MANIFEST_LOADING,this.onManifestLoading,this),e.off(B.MANIFEST_PARSED,this.onManifestParsed,this),e.off(B.BUFFER_RESET,this.onBufferReset,this),e.off(B.BUFFER_APPENDING,this.onBufferAppending,this),e.off(B.BUFFER_CODECS,this.onBufferCodecs,this),e.off(B.BUFFER_EOS,this.onBufferEos,this),e.off(B.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(B.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(B.FRAG_PARSED,this.onFragParsed,this),e.off(B.FRAG_CHANGED,this.onFragChanged,this),e.off(B.ERROR,this.onError,this)}transferMedia(){const{media:e,mediaSource:n}=this;if(!e)return null;const i={};if(this.operationQueue){const r=this.isUpdating();r||this.operationQueue.removeBlockers();const o=this.isQueued();(r||o)&&this.warn(`Transfering MediaSource with${o?" operations in queue":""}${r?" updating SourceBuffer(s)":""} ${this.operationQueue}`),this.operationQueue.destroy()}const s=this.transferData;return!this.sourceBufferCount&&s&&s.mediaSource===n?jt(i,s.tracks):this.sourceBuffers.forEach(r=>{const[o]=r;o&&(i[o]=jt({},this.tracks[o]),this.removeBuffer(o)),r[0]=r[1]=null}),{media:e,mediaSource:n,tracks:i}}initTracks(){const e={};this.sourceBuffers=[[null,null],[null,null]],this.tracks=e,this.resetQueue(),this.resetAppendErrors(),this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.lastVideoAppendEnd=0}onManifestLoading(){this.bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,n){var i;let s=2;(n.audio&&!n.video||!n.altAudio)&&(s=1),this.bufferCodecEventsTotal=s,this.log(`${s}
3521 bufferCodec event(s) expected.`),(i=this.transferData)!=null&&i.mediaSource&&this.sourceBufferCount&&s&&this.bufferCreated()}onMediaAttaching(e,n){const i=this.media=n.media,s=Ua(this.appendSource);if(this.transferData=this.overrides=void 0,i&&s){const r=!!n.mediaSource;(r||n.overrides)&&(this.transferData=n,this.overrides=n.overrides);const o=this.mediaSource=n.mediaSource||new s;if(this.assignMediaSource(o),r)this._objectUrl=i.src,this.attachTransferred();else{const l=this._objectUrl=self.URL.createObjectURL(o);if(this.appendSource)try{i.removeAttribute("src");const d=self.ManagedMediaSource;i.disableRemotePlayback=i.disableRemotePlayback||d&&o instanceof d,TP(i),tme(i,l),i.load()}catch{i.src=l}else i.src=l}i.addEventListener("emptied",this._onMediaEmptied)}}assignMediaSource(e){var n,i;this.log(`${((n=this.transferData)==null?void 0:n.mediaSource)===e?"transferred":"created"} media source: ${(i=e.constructor)==null?void 0:i.name}`),e.addEventListener("sourceopen",this._onMediaSourceOpen),e.addEventListener("sourceended",this._onMediaSourceEnded),e.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(e.addEventListener("startstreaming",this._onStartStreaming),e.addEventListener("endstreaming",this._onEndStreaming))}attachTransferred(){const e=this.media,n=this.transferData;if(!n||!e)return;const i=this.tracks,s=n.tracks,r=s?Object.keys(s):null,o=r?r.length:0,l=a(()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()},"mediaSourceOpenCallback");if(s&&r&&o){if(!this.tracksReady){this.hls.config.startFragPrefetch=!0,this.log("attachTransferred: waiting for SourceBuffer track info");return}if(this.log(`attachTransferred: (bufferCodecEventsTotal ${this.bufferCodecEventsTotal})
3522required tracks: ${hn(i,(d,c)=>d==="initSegment"?void 0:c)};
3523transfer tracks: ${hn(s,(d,c)=>d==="initSegment"?void 0:c)}}`),!h3(s,i)){n.mediaSource=null,n.tracks=void 0;const d=e.currentTime,c=this.details,u=Math.max(d,c?.fragments[0].start||0);if(u-d>1){this.log(`attachTransferred: waiting for playback to reach new tracks start time ${d} -> ${u}`);return}this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(s)}"->"${Object.keys(i)}") start time: ${u} currentTime: ${d}`),this.onMediaDetaching(B.MEDIA_DETACHING,{}),this.onMediaAttaching(B.MEDIA_ATTACHING,n),e.currentTime=u;return}this.transferData=void 0,r.forEach(d=>{const c=d,u=s[c];if(u){const f=u.buffer;if(f){const h=this.fragmentTracker,p=u.id;if(h.hasFragments(p)||h.hasParts(p)){const y=gt.getBuffered(f);h.detectEvictedFragments(c,y,p,null,!0)}const g=TE(c),v=[c,f];this.sourceBuffers[g]=v,f.updating&&this.operationQueue&&this.operationQueue.prependBlocker(c),this.trackSourceBuffer(c,u)}}}),l(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),l()}get mediaSourceOpenOrEnded(){var e;const n=(e=this.mediaSource)==null?void 0:e.readyState;return n==="open"||n==="ended"}onMediaDetaching(e,n){const i=!!n.transferMedia;this.transferData=this.overrides=void 0;const{media:s,mediaSource:r,_objectUrl:o}=this;if(r){if(this.log(`media source ${i?"transferring":"detaching"}`),i)this.sourceBuffers.forEach(([l])=>{l&&this.removeBuffer(l)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){const l=r.readyState==="open";try{const d=r.sourceBuffers;for(let c=d.length;c--;)l&&d[c].abort(),r.removeSourceBuffer(d[c]);l&&r.endOfStream()}catch(d){this.warn(`onMediaDetaching: ${d.message} while calling endOfStream`)}}this.sourceBufferCount&&this.onBufferReset()}r.removeEventListener("sourceopen",this._onMediaSourceOpen),r.removeEventListener("sourceended",this._onMediaSourceEnded),r.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(r.removeEventListener("startstreaming",this._onStartStreaming),r.removeEventListener("endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}s&&(s.removeEventListener("emptied",this._onMediaEmptied),i||(o&&self.URL.revokeObjectURL(o),this.mediaSrc===o?(s.removeAttribute("src"),this.appendSource&&TP(s),s.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger(B.MEDIA_DETACHED,n)}
vendor: 1,534 bytes, line 3523
3523onBufferReset(){this.sourceBuffers.forEach(([e])=>{e&&this.resetBuffer(e)}),this.initTracks()}resetBuffer(e){var n;const i=(n=this.tracks[e])==null?void 0:n.buffer;if(this.removeBuffer(e),i)try{var s;(s=this.mediaSource)!=null&&s.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(i)}catch(r){this.warn(`onBufferReset ${e}`,r)}delete this.tracks[e]}removeBuffer(e){this.removeBufferListeners(e),this.sourceBuffers[TE(e)]=[null,null];const n=this.tracks[e];n&&(n.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new OS(this.tracks)}onBufferCodecs(e,n){const i=this.tracks,s=Object.keys(n);this.log(`BUFFER_CODECS: "${s}" (current SB count ${this.sourceBufferCount})`);const r="audiovideo"in n&&(i.audio||i.video)||i.audiovideo&&("audio"in n||"video"in n),o=!r&&this.sourceBufferCount&&this.media&&s.some(l=>!i[l]);if(r||o){this.warn(`Unsupported transition between "${Object.keys(i)}" and "${s}" SourceBuffers`);return}s.forEach(l=>{var d,c,u;const f=n[l],{id:h,codec:p,levelCodec:g,container:v,metadata:y,supplemental:b}=f;let E=i[l];const T=(d=this.transferData)==null||(c=d.tracks)==null?void 0:c[l],I=T!=null&&T.buffer?T:E,M=I?.pendingCodec||I?.codec,H=I?.levelCodec;E||(E=i[l]={buffer:void 0,listeners:[],codec:p,supplemental:b,container:v,levelCodec:g,metadata:y,id:h});const N=$m(M,H),$=N?.replace(SP,"$1");let F=$m(p,g);const D=(u=F)==null?void 0:u.replace(SP,"$1");F&&N&&$!==D&&(l.slice(0,5)==="audio"&&(F=hv(F,this.appendSource)),this.log(`switching codec ${M} to ${F}
3523`),F!==(E.pendingCodec||E.codec)&&(E.pendingCodec=F),E.container=v,this.appendChangeType(l,v,F))}),(this.tracksReady||this.sourceBufferCount)&&(n.tracks=this.sourceBufferTracks),!this.sourceBufferCount&&this.mediaSourceOpenOrEnded&&this.checkPendingTracks()}get sourceBufferTracks(){return Object.keys(this.tracks).reduce((e,n)=>{const i=this.tracks[n];return e[n]={id:i.id,container:i.container,codec:i.codec,levelCodec:i.levelCodec},e},{})}appendChangeType(e,n,i){const s=`${n};codecs=${i}`,r={label:`change-type=${s}`,execute:()=>{const o=this.tracks[e];if(o){const l=o.buffer;l!=null&&l.changeType&&(this.log(`changing ${e} sourceBuffer type to ${s}`),l.changeType(s),o.codec=i,o.container=n)}this.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:o=>{this.warn(`Failed to change ${e} SourceBuffer type`,o)}};this.append(r,e,this.isPending(this.tracks[e]))}blockAudio(e){var n;const i=e.start,s=i+e.duration*.05;if(((n=this.fragmentTracker.getAppendedFrag(i,Ue.MAIN))==null?void 0:n.gap)===!0)return;const o={label:"block-audio",execute:()=>{var l;const d=this.tracks.video;(this.lastVideoAppendEnd>s||d!=null&&d.buffer&&gt.isBuffered(d.buffer,s)||((l=this.fragmentTracker.getAppendedFrag(s,Ue.MAIN))==null?void 0:l.gap)===!0)&&(this.blockedAudioAppend=null,this.shiftAndExecuteNext("audio"))},onStart:()=>{},onComplete:()=>{},onError:l=>{this.warn("Error executing block-audio operation",l)}};this.blockedAudioAppend={op:o,frag:e},this.append(o,"audio",!0)}unblockAudio(){const{blockedAudioAppend:e,operationQueue:n}=this;e&&n&&(this.blockedAudioAppend=null,n.unblockAudio(e.op))}onBufferAppending(e,n){const{tracks:i}=this,{data:s,type:r,parent:o,frag:l,part:d,chunkMeta:c,offset:u}=n,f=c.buffering[r],{sn:h,cc:p}=l,g=self.performance.now();f.start=g;const v=l.stats.buffering,y=d?d.stats.buffering:null;v.start===0&&(v.start=g),y&&y.start===0&&(y.start=g);const b=i.audio;let E=!1;r==="audio"&&b?.container==="audio/mpeg"&&(E=!this.lastMpegAudioChunk||c.id===1||this.lastMpegAudioChunk.sn!==c.sn,this.lastMpegAudioChunk=c);const T=i.video,I=T?.buffer;if(I&&h!=="initSegment"){const N=d||l,$=this.blockedAudioAppend;if(r==="audio"&&o!=="main"&&!this.blockedAudioAppend){const D=N.start+N.duration*.05,L=I.buffered,m=this.currentOp("video");!L.length&&!m?this.blockAudio(N):!m&&!gt.isBuffered(I,D)&&this.lastVideoAppendEnd<D&&this.blockAudio(N)}else if(r==="video"){const F=N.end;if($){const D=$.frag.start;(F>D||F<this.lastVideoAppendEnd||gt.isBuffered(I,D))&&this.unblockAudio()}this.lastVideoAppendEnd=F}}const M=(d||l).start,H={label:`append-${r}`,execute:()=>{var N;f.executeStart=self.performance.now();const $=(N=this.tracks[r])==null?void 0:N.buffer;$&&(E?this.updateTimestampOffset($,M,.1,r,h,p):u!==void 0&&Pe(u)&&this.updateTimestampOffset($,u,1e-6,r,h,p)),this.appendExecutor(s,r)},onStart:()=>{},onComplete:()=>{const N=self.performance.now();f.executeEnd=f.end=N,v.first===0&&(v.first=N),y&&y.first===0&&(y.first=N);const $={};this.sourceBuffers.forEach(([F,D])=>{F&&($[F]=gt.getBuffered(D))}),this.appendErrors[r]=0,r==="audio"||r==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(B.BUFFER_APPENDED,{type:r,frag:l,part:d,chunkMeta:c,parent:l.type,timeRanges:$})},onError:N=>{var $;const F={type:Ge.MEDIA_ERROR,parent:l.type,details:de.BUFFER_APPEND_ERROR,sourceBufferName:r,frag:l,part:d,chunkMeta:c,error:N,err:N,fatal:!1},D=($=this.media)==null?void 0:$.error;if(N.code===DOMException.QUOTA_EXCEEDED_ERR||N.name=="QuotaExceededError"||"quota"in N)F.details=de.BUFFER_FULL_ERROR;else if(N.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!D)F.errorAction=Ph(!0);else if(N.name===r4&&this.sourceBufferCount===0)F.errorAction=Ph(!0);else{const L=++this.appendErrors[r];this.warn(`Failed ${L}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${r}" sourceBuffer (${D||"no media error"}
3523)`),(L>=this.hls.config.appendErrorMaxRetry||D)&&(F.fatal=!0)}this.hls.trigger(B.ERROR,F)}};this.append(H,r,this.isPending(this.tracks[r]))}getFlushOp(e,n,i){return this.log(`queuing "${e}" remove ${n}-${i}`),{label:"remove",execute:()=>{this.removeExecutor(e,n,i)},onStart:()=>{},onComplete:()=>{this.hls.trigger(B.BUFFER_FLUSHED,{type:e})},onError:s=>{this.warn(`Failed to remove ${n}-${i} from "${e}" SourceBuffer`,s)}}}onBufferFlushing(e,n){const{type:i,startOffset:s,endOffset:r}=n;i?this.append(this.getFlushOp(i,s,r),i):this.sourceBuffers.forEach(([o])=>{o&&this.append(this.getFlushOp(o,s,r),o)})}onFragParsed(e,n){const{frag:i,part:s}=n,r=[],o=s?s.elementaryStreams:i.elementaryStreams;o[ln.AUDIOVIDEO]?r.push("audiovideo"):(o[ln.AUDIO]&&r.push("audio"),o[ln.VIDEO]&&r.push("video"));const l=a(()=>{const d=self.performance.now();i.stats.buffering.end=d,s&&(s.stats.buffering.end=d);const c=s?s.stats:i.stats;this.hls.trigger(B.FRAG_BUFFERED,{frag:i,part:s,stats:c,id:i.type})},"onUnblocked");r.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${i.type} level: ${i.level} sn: ${i.sn}`),this.blockBuffers(l,r).catch(d=>{this.warn(`Fragment buffered callback ${d}`),this.stepOperationQueue(this.sourceBufferTypes)})}onFragChanged(e,n){this.trimBuffers()}get bufferedToEnd(){return this.sourceBufferCount>0&&!this.sourceBuffers.some(([e])=>{var n,i;return e&&(!((n=this.tracks[e])!=null&&n.ended)||((i=this.tracks[e])==null?void 0:i.ending))})}onBufferEos(e,n){var i;this.sourceBuffers.forEach(([o])=>{if(o){const l=this.tracks[o];(!n.type||n.type===o)&&(l.ending=!0,l.ended||(l.ended=!0,this.log(`${o} buffer reached EOS`)))}});const s=((i=this.overrides)==null?void 0:i.endOfStream)!==!1;this.sourceBufferCount>0&&!this.sourceBuffers.some(([o])=>{var l;return o&&!((l=this.tracks[o])!=null&&l.ended)})&&(s?(this.log("Queueing EOS"),this.blockUntilOpen(()=>{this.tracksEnded();const{mediaSource:o}=this;if(!o||o.readyState!=="open"){o&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${o.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),o.endOfStream(),this.hls.trigger(B.BUFFERED_TO_END,void 0)})):(this.tracksEnded(),this.hls.trigger(B.BUFFERED_TO_END,void 0)))}tracksEnded(){this.sourceBuffers.forEach(([e])=>{if(e!==null){const n=this.tracks[e];n&&(n.ending=!1)}})}onLevelUpdated(e,{details:n}){n.fragments.length&&(this.details=n,this.updateDuration())}updateDuration(){this.blockUntilOpen(()=>{const e=this.getDurationAndRange();e&&this.updateMediaSource(e)})}onError(e,n){if(n.details===de.BUFFER_APPEND_ERROR&&n.frag){var i;const s=(i=n.errorAction)==null?void 0:i.nextAutoLevel;Pe(s)&&s!==n.frag.level&&this.resetAppendErrors()}}resetAppendErrors(){this.appendErrors={audio:0,video:0,audiovideo:0}}trimBuffers(){const{hls:e,details:n,media:i}=this;if(!i||n===null||!this.sourceBufferCount)return;const s=e.config,r=i.currentTime,o=n.levelTargetDuration,l=n.live&&s.liveBackBufferLength!==null?s.liveBackBufferLength:s.backBufferLength;if(Pe(l)&&l>=0){const d=Math.max(l,o),c=Math.floor(r/o)*o-d;this.flushBackBuffer(r,o,c)}if(Pe(s.frontBufferFlushThreshold)&&s.frontBufferFlushThreshold>0){const d=Math.max(s.maxBufferLength,s.frontBufferFlushThreshold),c=Math.max(d,o),u=Math.floor(r/o)*o+c;this.flushFrontBuffer(r,o,u)}}flushBackBuffer(e,n,i){this.sourceBuffers.forEach(([s,r])=>{if(r){const l=gt.getBuffered(r);if(l.length>0&&i>l.start(0)){var o;this.hls.trigger(B.BACK_BUFFER_REACHED,{bufferEnd:i});const d=this.tracks[s];if((o=this.details)!=null&&o.live)this.hls.trigger(B.LIVE_BACK_BUFFER_REACHED,{bufferEnd:i});else if(d!=null&&d.ended){this.log(`Cannot flush ${s} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(B.BUFFER_FLUSHING,{startOffset:0,endOffset:i,type:s})}}})}flushFrontBuffer(e,n,i){this.sourceBuffers.forEach(([s,r])=>{if(r){const o=gt.getBuffered(r),l=o.length;if(l<2)return;const d=o.start(l-1),c=o.end(l-1);if(i>d||e>=d&&e<=c)return;this.hls.trigger(B.BUFFER_FLUSHING,{startOffset:d,endOffset:1/0,type:s})}})}getDurationAndRange(){var e;const{details:n,mediaSource:i}=this;if(!n||!this.media||i?.readyState!=="open")return null;const s=n.edge;
vendor: 5,145 bytes, line 3523
3523if(n.live&&this.hls.config.liveDurationInfinity){if(n.fragments.length&&n.live&&i.setLiveSeekableRange){const c=Math.max(0,n.fragmentStart),u=Math.max(c,s);return{duration:1/0,start:c,end:u}}return{duration:1/0}}const r=(e=this.overrides)==null?void 0:e.duration;if(r)return Pe(r)?{duration:r}:null;const o=this.media.duration,l=Pe(i.duration)?i.duration:0;return s>l&&s>o||!Pe(o)?{duration:s}:null}updateMediaSource({duration:e,start:n,end:i}){const s=this.mediaSource;!this.media||!s||s.readyState!=="open"||(s.duration!==e&&(Pe(e)&&this.log(`Updating MediaSource duration to ${e.toFixed(3)}`),s.duration=e),n!==void 0&&i!==void 0&&(this.log(`MediaSource duration is set to ${s.duration}. Setting seekable range to ${n}-${i}.`),s.setLiveSeekableRange(n,i)))}get tracksReady(){const e=this.pendingTrackCount;return e>0&&(e>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}checkPendingTracks(){const{bufferCodecEventsTotal:e,pendingTrackCount:n,tracks:i}=this;if(this.log(`checkPendingTracks (pending: ${n} codec events expected: ${e}) ${hn(i)}`),this.tracksReady){var s;const r=(s=this.transferData)==null?void 0:s.tracks;r&&Object.keys(r).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){const e={};this.sourceBuffers.forEach(([n,i])=>{if(n){const s=this.tracks[n];e[n]={buffer:i,container:s.container,codec:s.codec,supplemental:s.supplemental,levelCodec:s.levelCodec,id:s.id,metadata:s.metadata}}}),this.hls.trigger(B.BUFFER_CREATED,{tracks:e}),this.log(`SourceBuffers created. Running queue: ${this.operationQueue}`),this.sourceBuffers.forEach(([n])=>{this.executeNext(n)})}else{const e=new Error("could not create source buffer for media codec(s)");this.hls.trigger(B.ERROR,{type:Ge.MEDIA_ERROR,details:de.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}createSourceBuffers(){const{tracks:e,sourceBuffers:n,mediaSource:i}=this;if(!i)throw new Error("createSourceBuffers called when mediaSource was null");for(const r in e){const o=r,l=e[o];if(this.isPending(l)){const d=this.getTrackCodec(l,o),c=`${l.container};codecs=${d}`;l.codec=d,this.log(`creating sourceBuffer(${c})${this.currentOp(o)?" Queued":""} ${hn(l)}`);try{const u=i.addSourceBuffer(c),f=TE(o),h=[o,u];n[f]=h,l.buffer=u}catch(u){var s;this.error(`error while trying to add sourceBuffer: ${u.message}`),this.shiftAndExecuteNext(o),(s=this.operationQueue)==null||s.removeBlockers(),delete this.tracks[o],this.hls.trigger(B.ERROR,{type:Ge.MEDIA_ERROR,details:de.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:u,sourceBufferName:o,mimeType:c,parent:l.id});return}this.trackSourceBuffer(o,l)}}this.bufferCreated()}getTrackCodec(e,n){const i=e.supplemental;let s=e.codec;i&&(n==="video"||n==="audiovideo")&&sS(i,"video")&&(s=gpe(s,i));const r=$m(s,e.levelCodec);return r?n.slice(0,5)==="audio"?hv(r,this.appendSource):r:""}trackSourceBuffer(e,n){const i=n.buffer;if(!i)return;const s=this.getTrackCodec(n,e);this.tracks[e]={buffer:i,codec:s,container:n.container,levelCodec:n.levelCodec,supplemental:n.supplemental,metadata:n.metadata,id:n.id,listeners:[]},this.removeBufferListeners(e),this.addBufferListener(e,"updatestart",this.onSBUpdateStart),this.addBufferListener(e,"updateend",this.onSBUpdateEnd),this.addBufferListener(e,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(e,"bufferedchange",(r,o)=>{const l=o.removedRanges;l!=null&&l.length&&this.hls.trigger(B.BUFFER_FLUSHED,{type:r})})}get mediaSrc(){var e,n;const i=((e=this.media)==null||(n=e.querySelector)==null?void 0:n.call(e,"source"))||this.media;return i?.src}onSBUpdateStart(e){const n=this.currentOp(e);n&&n.onStart()}onSBUpdateEnd(e){var n;if(((n=this.mediaSource)==null?void 0:n.readyState)==="closed"){this.resetBuffer(e);return}const i=this.currentOp(e);i&&(i.onComplete(),this.shiftAndExecuteNext(e))}onSBUpdateError(e,n){var i;const s=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(i=this.mediaSource)==null?void 0:i.readyState}`);this.error(`${s}`,n),this.hls.trigger(B.ERROR,{type:Ge.MEDIA_ERROR,details:de.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:s,fatal:!1});const r=this.currentOp(e);r&&r.onError(s)}updateTimestampOffset(e,n,i,s,r,o){const l=n-e.timestampOffset;Math.abs(l)>=i&&(this.log(`Updating ${s} SourceBuffer timestampOffset to ${n} (sn: ${r} cc: ${o})`),e.timestampOffset=n)}removeExecutor(e,n,i){const{media:s,mediaSource:r}=this,o=this.tracks[e],l=o?.buffer;if(!s||!r||!l){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),this.shiftAndExecuteNext(e);return}const d=Pe(s.duration)?s.duration:1/0,c=Pe(r.duration)?r.duration:1/0,u=Math.max(0,n),f=Math.min(i,d,c);f>u&&(!o.ending||o.ended)?(o.ended=!1,this.log(`Removing [${u},${f}] from the ${e} SourceBuffer`),l.remove(u,f)):this.shiftAndExecuteNext(e)}appendExecutor(e,n){const i=this.tracks[n],s=i?.buffer;if(!s)throw new NS(`Attempting to append to the ${n} SourceBuffer, but it does not exist`);i.ending=!1,i.ended=!1,s.appendBuffer(e)}blockUntilOpen(e){if(this.isUpdating()||this.isQueued())this.blockBuffers(e).catch(n=>{this.warn(`SourceBuffer blocked callback ${n}
3523`),this.stepOperationQueue(this.sourceBufferTypes)});else try{e()}catch(n){this.warn(`Callback run without blocking ${this.operationQueue} ${n}`)}}isUpdating(){return this.sourceBuffers.some(([e,n])=>e&&n.updating)}isQueued(){return this.sourceBuffers.some(([e])=>e&&!!this.currentOp(e))}isPending(e){return!!e&&!e.buffer}blockBuffers(e,n=this.sourceBufferTypes){if(!n.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);const{operationQueue:i}=this,s=n.map(o=>this.appendBlocker(o));return n.length>1&&!!this.blockedAudioAppend&&this.unblockAudio(),Promise.all(s).then(o=>{i===this.operationQueue&&(e(),this.stepOperationQueue(this.sourceBufferTypes))})}stepOperationQueue(e){e.forEach(n=>{var i;const s=(i=this.tracks[n])==null?void 0:i.buffer;!s||s.updating||this.shiftAndExecuteNext(n)})}append(e,n,i){this.operationQueue&&this.operationQueue.append(e,n,i)}appendBlocker(e){if(this.operationQueue)return this.operationQueue.appendBlocker(e)}currentOp(e){return this.operationQueue?this.operationQueue.current(e):null}executeNext(e){e&&this.operationQueue&&this.operationQueue.executeNext(e)}shiftAndExecuteNext(e){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(e)}get pendingTrackCount(){return Object.keys(this.tracks).reduce((e,n)=>e+(this.isPending(this.tracks[n])?1:0),0)}get sourceBufferCount(){return this.sourceBuffers.reduce((e,[n])=>e+(n?1:0),0)}get sourceBufferTypes(){return this.sourceBuffers.map(([e])=>e).filter(e=>!!e)}addBufferListener(e,n,i){const s=this.tracks[e];if(!s)return;const r=s.buffer;if(!r)return;const o=i.bind(this,e);s.listeners.push({event:n,listener:o}),r.addEventListener(n,o)}removeBufferListeners(e){const n=this.tracks[e];if(!n)return;const i=n.buffer;i&&(n.listeners.forEach(s=>{i.removeEventListener(s.event,s.listener)}),n.listeners.length=0)}};a(KI,"BufferController");let FS=KI;function TP(t){const e=t.querySelectorAll("source");[].slice.call(e).forEach(n=>{t.removeChild(n)})}a(TP,"removeSourceChildren");function tme(t,e){const n=self.document.createElement("source");n.type="video/mp4",n.src=e,t.appendChild(n)}a(tme,"addSource");function TE(t){return t==="audio"?1:0}a(TE,"sourceBufferNameToIndex");const Gv=class Gv{constructor(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:e}=this;e.on(B.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(B.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(B.MANIFEST_PARSED,this.onManifestParsed,this),e.on(B.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(B.BUFFER_CODECS,this.onBufferCodecs,this),e.on(B.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(B.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(B.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(B.MANIFEST_PARSED,this.onManifestParsed,this),e.off(B.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(B.BUFFER_CODECS,this.onBufferCodecs,this),e.off(B.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,n){const i=this.hls.levels[n.droppedLevel];this.isLevelAllowed(i)&&this.restrictedLevels.push({bitrate:i.bitrate,height:i.height,width:i.width})}onMediaAttaching(e,n){this.media=n.media instanceof HTMLVideoElement?n.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,n){const i=this.hls;this.restrictedLevels=[],this.firstLevel=n.firstLevel,i.config.capLevelToPlayerSize&&n.video&&this.startCapping()}onLevelsUpdated(e,n){this.timer&&Pe(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,n){this.hls.config.capLevelToPlayerSize&&n.video&&this.startCapping()}onMediaDetaching(){this.stopCapping(),this.media=null}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0){this.clientRect=null;return}const e=this.hls.levels;if(e.length){const n=this.hls,i=this.getMaxLevel(e.length-1);i!==this.autoLevelCapping&&n.logger.log(`Setting autoLevelCapping to ${i}: ${e[i].height}p@${e[i].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),n.autoLevelCapping=i,n.autoLevelEnabled&&n.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=n.autoLevelCapping}}}getMaxLevel(e){const n=this.hls.levels;if(!n.length)return-1;const i=n.filter((s,r)=>this.isLevelAllowed(s)&&r<=e);return this.clientRect=null,Gv.getMaxLevelByMediaSize(i,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,n={width:0,height:0};if(e){const i=e.getBoundingClientRect();n.width=i.width,n.height=i.height,!n.width&&!n.height&&(n.width=i.right-i.left||e.
3523width||0,n.height=i.bottom-i.top||e.height||0)}return this.clientRect=n,n}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 Math.min(e,this.hls.config.maxDevicePixelRatio)}isLevelAllowed(e){return!this.restrictedLevels.some(i=>e.bitrate===i.bitrate&&e.width===i.width&&e.height===i.height)}static getMaxLevelByMediaSize(e,n,i){if(!(e!=null&&e.length))return-1;const s=a((l,d)=>d?l.width!==d.width||l.height!==d.height:!0,"atGreatestBandwidth");let r=e.length-1;const o=Math.max(n,i);for(let l=0;l<e.length;l+=1){const d=e[l];if((d.width>=o||d.height>=o)&&s(d,e[l+1])){r=l;break}}return r}};a(Gv,"CapLevelController");let US=Gv;const nme={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},Vi=nme,ime={HLS:"h"},sme=ime,rme="CMCD-Object",ome="CMCD-Request",ame="CMCD-Session",lme="CMCD-Status",hf={OBJECT:rme,REQUEST:ome,SESSION:ame,STATUS:lme},cme={[hf.OBJECT]:["br","ab","d","ot","tb","tpb","lb","tab","lab","url"],[hf.REQUEST]:["pb","bl","tbl","dl","ltc","mtp","nor","nrr","rc","sn","sta","su","ttfb","ttfbb","ttlb","cmsdd","cmsds","smrt","df","cs"],[hf.SESSION]:["cid","pr","sf","sid","st","v","msd"],[hf.STATUS]:["bs","bsd","cdn","rtp","bg","pt","ec","e"]},kf=class kf{constructor(e,n){Array.isArray(e)&&(e=e.map(i=>i instanceof kf?i:new kf(i))),this.value=e,this.params=n}};a(kf,"SfItem");let Vh=kf;const dme="Dict";function ume(t){return Array.isArray(t)?JSON.stringify(t):t instanceof Map?"Map{}":t instanceof Set?"Set{}":typeof t=="object"?JSON.stringify(t):String(t)}a(ume,"format");function fme(t,e,n,i){return new Error(`failed to ${t} "${ume(e)}" as ${n}`,{cause:i})}a(fme,"throwError");function Hr(t,e,n){return fme("serialize",t,e,n)}a(Hr,"serializeError");const qI=class qI{constructor(e){this.description=e}};a(qI,"SfToken");let Mv=qI;const AP="Bare Item",hme="Boolean";function pme(t){if(typeof t!="boolean")throw Hr(t,hme);return t?"?1":"?0"}a(pme,"serializeBoolean");function gme(t){return btoa(String.fromCharCode(...t))}a(gme,"encodeBase64");const mme="Byte Sequence";function vme(t){if(ArrayBuffer.isView(t)===!1)throw Hr(t,mme);return`:${gme(t)}:`}a(vme,"serializeByteSequence");const yme="Integer";function bme(t){return t<-999999999999999||999999999999999<t}a(bme,"isInvalidInt");function o4(t){if(bme(t))throw Hr(t,yme);return t.toString()}a(o4,"serializeInteger");function Eme(t){return`@${o4(t.getTime()/1e3)}`}a(Eme,"serializeDate");function a4(t,e){if(t<0)return-a4(-t,e);const n=Math.pow(10,e);if(Math.abs(t*n%1-.5)<Number.EPSILON){const s=Math.floor(t*n);return(s%2===0?s:s+1)/n}else return Math.round(t*n)/n}a(a4,"roundToEven");const _me="Decimal";function wme(t){const e=a4(t,3);if(Math.floor(Math.abs(e)).toString().length>12)throw Hr(t,_me);const n=e.toString();return n.includes(".")?n:`${n}.0`}a(wme,"serializeDecimal");const Sme="String",Tme=/[\x00-\x1f\x7f]+/;function Ame(t){if(Tme.test(t))throw Hr(t,Sme);return`"${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}a(Ame,"serializeString");function xme(t){return t.description||t.toString().slice(7,-1)}a(xme,"symbolToStr");const Ime="Token";function xP(t){const e=xme(t);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw Hr(e,Ime);return e}a(xP,"serializeToken");function BS(t){switch(typeof t){case"number":if(!Pe(t))throw Hr(t,AP);return Number.isInteger(t)?o4(t):wme(t);case"string":return Ame(t);case"symbol":return xP(t);case"boolean":return pme(t);case"object":if(t instanceof Date)return Eme(t);if(t instanceof Uint8Array)return vme(t);if(t instanceof Mv)return xP(t);default:throw Hr(t,AP)}}a(BS,"serializeBareItem");const Lme="Key";function $S(t){if(/^[a-z*][a-z0-9\-_.*]*$/.test(t)===!1)throw Hr(t,Lme);return t}a($S,"serializeKey");function VA(t){return t==null?"":Object.entries(t).map(([e,n])=>n===!0?`;${$S(e)}`:`;${$S(e)}=${BS(n)}`).join("")}a(VA,"serializeParams");function l4(t){return t instanceof Vh?`${BS(t.value)}${VA(t.params)}`:BS(t)}a(l4,"serializeItem");function Rme(t){return`(${t.value.map(l4).join(" ")})${VA(t.params)}`}a(Rme,"serializeInnerList");function kme(t,e={whitespace:!0}){if(typeof t!="object")throw Hr(t,dme);const n=t instanceof Map?t.entries():Object.entries(t),i=e?.whitespace?" ":"";return Array.from(n).map(([s,r])=>{r instanceof Vh||(r=new Vh(r));let o=$S(s);return r.value===!0?o+=VA(r.params):(o+="=",Array.isArray(r.value)?o+=Rme(r):o+=l4(r)),o}).join(`,${i}`)}a(kme,"serializeDict");function Mme(t,e){return kme(t,e)}a(Mme,"encodeSfDict");function Cme(t){return["ot","sf","st","e","sta"].includes(t)}a(Cme,"isTokenField");function Pme(t){return typeof t=="number"?Pe(t):t!=null&&t!==""&&t!==!1}a(Pme,"isValid");function Dme(t,e){const n=new URL(t),i=new URL(e);if(n.origin!==i.origin)return t;const s=n.pathname.split("/").slice(1),r=i.pathname.split("/").slice(1,-1);for(;s[0]===r[0];)s.shift(),r.shift();for(;r.length;)r.shift(),s.unshift("..");return s.join("/")}a(Dme,"urlToRelativePath");const Wm=a(t=>Math.round(t),"toRounded"),Ome=a((t,e)=>(e?.baseUrl&&(t=Dme(t,e.baseUrl)),encodeURIComponent(t)),"toUrlSafe"),Yg=a(t=>Wm(t/100)*100,"toHundred"),Nme={br:Wm,d:Wm,bl:Yg,dl:Yg,mtp:Yg,nor:Ome,rtp:Yg,tb
3523:Wm};function Fme(t,e){const n={};if(t==null||typeof t!="object")return n;const i=Object.keys(t).sort(),s=jt({},Nme,e?.formatters),r=e?.filter;return i.forEach(o=>{if(r?.(o)===!1)return;let l=t[o];const d=s[o];d&&(l=d(l,e)),!(o==="v"&&l===1)&&(o=="pr"&&l===1||Pme(l)&&(Cme(o)&&typeof l=="string"&&(l=new Mv(l)),n[o]=l))}),n}a(Fme,"processCmcd");function c4(t,e={}){return t?Mme(Fme(t,e),jt({whitespace:!1},e)):""}a(c4,"encodeCmcd");function Ume(t,e={}){const n={};if(!t)return n;const i=Object.entries(t),s=Object.entries(cme).concat(Object.entries(e?.customHeaderMap||{})),r=i.reduce((o,l)=>{var d,c;const[u,f]=l,h=((d=s.find(p=>p[1].includes(u)))===null||d===void 0?void 0:d[0])||hf.REQUEST;return(c=o[h])!==null&&c!==void 0||(o[h]={}),o[h][u]=f,o},{});return Object.entries(r).reduce((o,[l,d])=>(o[l]=c4(d,e),o),n)}a(Ume,"toCmcdHeaders");function Bme(t,e,n){return jt(t,Ume(e,n))}a(Bme,"appendCmcdHeaders");const $me="CMCD";function Hme(t,e={}){if(!t)return"";const n=c4(t,e);return`${$me}=${encodeURIComponent(n)}`}a(Hme,"toCmcdQuery");const IP=/CMCD=[^&#]+/;function Gme(t,e,n){const i=Hme(e,n);if(!i)return t;if(IP.test(t))return t.replace(IP,i);const s=t.includes("?")?"&":"?";return`${t}${s}${i}`}a(Gme,"appendCmcdQuery");const jI=class jI{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=s=>{try{this.apply(s,{ot:Vi.MANIFEST,su:!this.initialized})}catch(r){this.hls.logger.warn("Could not generate manifest CMCD data.",r)}},this.applyFragmentData=s=>{try{const{frag:r,part:o}=s,l=this.hls.levels[r.level],d=this.getObjectType(r),c={d:(o||r).duration*1e3,ot:d};(d===Vi.VIDEO||d===Vi.AUDIO||d==Vi.MUXED)&&(c.br=l.bitrate/1e3,c.tb=this.getTopBandwidth(d)/1e3,c.bl=this.getBufferLength(d));const u=o?this.getNextPart(o):this.getNextFrag(r);u!=null&&u.url&&u.url!==r.url&&(c.nor=u.url),this.apply(s,c)}catch(r){this.hls.logger.warn("Could not generate segment CMCD data.",r)}},this.hls=e;const n=this.config=e.config,{cmcd:i}=n;i!=null&&(n.pLoader=this.createPlaylistLoader(),n.fLoader=this.createFragmentLoader(),this.sid=i.sessionId||e.sessionId,this.cid=i.contentId,this.useHeaders=i.useHeaders===!0,this.includeKeys=i.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(B.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(B.MEDIA_DETACHED,this.onMediaDetached,this),e.on(B.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(B.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(B.MEDIA_DETACHED,this.onMediaDetached,this),e.off(B.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=this.media=null}onMediaAttached(e,n){this.media=n.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,n){var i,s;this.audioBuffer=(i=n.tracks.audio)==null?void 0:i.buffer,this.videoBuffer=(s=n.tracks.video)==null?void 0:s.buffer}createData(){var e;return{v:1,sf:sme.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,n={}){jt(n,this.createData());const i=n.ot===Vi.INIT||n.ot===Vi.VIDEO||n.ot===Vi.MUXED;this.starved&&i&&(n.bs=!0,n.su=!0,this.starved=!1),n.su==null&&(n.su=this.buffering);const{includeKeys:s}=this;s&&(n=Object.keys(n).reduce((o,l)=>(s.includes(l)&&(o[l]=n[l]),o),{}));const r={baseUrl:e.url};this.useHeaders?(e.headers||(e.headers={}),Bme(e.headers,n,r)):e.url=Gme(e.url,n,r)}getNextFrag(e){var n;const i=(n=this.hls.levels[e.level])==null?void 0:n.details;if(i){const s=e.sn-i.startSN;return i.fragments[s+1]}}getNextPart(e){var n,i;const{index:s,fragment:r}=e,o=(n=this.hls.levels[r.level])==null||(i=n.details)==null?void 0:i.partList;if(o){const{sn:l}=r;for(let d=o.length-1;d>=0;d--){const c=o[d];if(c.index===s&&c.fragment.sn===l)return o[d+1]}}}getObjectType(e){const{type:n}=e;if(n==="subtitle")return Vi.TIMED_TEXT;if(e.sn==="initSegment")return Vi.INIT;
3523if(n==="audio")return Vi.AUDIO;if(n==="main")return this.hls.audioTracks.length?Vi.VIDEO:Vi.MUXED}getTopBandwidth(e){let n=0,i;const s=this.hls;if(e===Vi.AUDIO)i=s.audioTracks;else{const r=s.maxAutoLevel,o=r>-1?r+1:s.levels.length;i=s.levels.slice(0,o)}return i.forEach(r=>{r.bitrate>n&&(n=r.bitrate)}),n>0?n:NaN}getBufferLength(e){const n=this.media,i=e===Vi.AUDIO?this.audioBuffer:this.videoBuffer;return!i||!n?NaN:gt.bufferInfo(i,n.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){var s;const{pLoader:e}=this.config,n=this.applyPlaylistData,i=e||this.config.loader;return s=class{constructor(o){this.loader=void 0,this.loader=new i(o)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(o,l,d){n(o),this.loader.load(o,l,d)}},a(s,"CmcdPlaylistLoader"),s}createFragmentLoader(){var s;const{fLoader:e}=this.config,n=this.applyFragmentData,i=e||this.config.loader;return s=class{constructor(o){this.loader=void 0,this.loader=new i(o)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(o,l,d){n(o),this.loader.load(o,l,d)}},a(s,"CmcdFragmentLoader"),s}};
vendor: 7,853 bytes, line 3523
3523a(jI,"CMCDController");let HS=jI;const Vme=3e5,YI=class YI extends ms{constructor(e){super("content-steering",e.logger),this.hls=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.registerListeners()}registerListeners(){const e=this.hls;e.on(B.MANIFEST_LOADING,this.onManifestLoading,this),e.on(B.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(B.MANIFEST_PARSED,this.onManifestParsed,this),e.on(B.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(B.MANIFEST_LOADING,this.onManifestLoading,this),e.off(B.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(B.MANIFEST_PARSED,this.onManifestParsed,this),e.off(B.ERROR,this.onError,this))}pathways(){return(this.levels||[]).reduce((e,n)=>(e.indexOf(n.pathwayId)===-1&&e.push(n.pathwayId),e),[])}get pathwayPriority(){return this._pathwayPriority}set pathwayPriority(e){this.updatePathwayPriority(e)}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const n=this.levels;n&&(this.levels=n.filter(i=>i!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,n){const{contentSteering:i}=n;i!==null&&(this.pathwayId=i.pathwayId,this.uri=i.uri,this.started&&this.startLoad())}onManifestParsed(e,n){this.audioTracks=n.audioTracks,this.subtitleTracks=n.subtitleTracks}onError(e,n){const{errorAction:i}=n;if(i?.action===wi.SendAlternateToPenaltyBox&&i.flags===Vs.MoveAllAlternatesMatchingHost){const s=this.levels;let r=this._pathwayPriority,o=this.pathwayId;if(n.context){const{groupId:l,pathwayId:d,type:c}=n.context;l&&s?o=this.getPathwayForGroupId(l,c,o):d&&(o=d)}o in this.penalizedPathways||(this.penalizedPathways[o]=performance.now()),!r&&s&&(r=this.pathways()),r&&r.length>1&&(this.updatePathwayPriority(r),i.resolved=this.pathwayId!==o),n.details===de.BUFFER_APPEND_ERROR&&!n.fatal?i.resolved=!0:i.resolved||this.warn(`Could not resolve ${n.details} ("${n.error.message}") with content-steering for Pathway: ${o} levels: ${s&&s.length} priorities: ${hn(r)} penalized: ${hn(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let n=this.getLevelsForPathway(this.pathwayId);if(n.length===0){const i=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${i}"`),n=this.getLevelsForPathway(i),this.pathwayId=i}return n.length!==e.length&&this.log(`Found ${n.length}/${e.length} levels in Pathway "${this.pathwayId}"`),n}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(n=>e===n.pathwayId)}updatePathwayPriority(e){this._pathwayPriority=e;let n;const i=this.penalizedPathways,s=performance.now();Object.keys(i).forEach(r=>{s-i[r]>Vme&&delete i[r]});for(let r=0;r<e.length;r++){const o=e[r];if(o in i)continue;if(o===this.pathwayId)return;const l=this.hls.nextLoadLevel,d=this.hls.levels[l];if(n=this.getLevelsForPathway(o),n.length>0){this.log(`Setting Pathway to "${o}"`),this.pathwayId=o,U3(n),this.hls.trigger(B.LEVELS_UPDATED,{levels:n});const c=this.hls.levels[l];d&&c&&this.levels&&(c.attrs["STABLE-VARIANT-ID"]!==d.attrs["STABLE-VARIANT-ID"]&&c.bitrate!==d.bitrate&&this.log(`Unstable Pathways change from bitrate ${d.bitrate} to ${c.bitrate}`),this.hls.nextLoadLevel=l);break}}}getPathwayForGroupId(e,n,i){const s=this.getLevelsForPathway(i).concat(this.levels||[]);for(let r=0;r<s.length;r++)if(n===wt.AUDIO_TRACK&&s[r].hasAudioGroup(e)||n===wt.SUBTITLE_TRACK&&s[r].hasSubtitleGroup(e))return s[r].pathwayId;return i}clonePathways(e){const n=this.levels;if(!n)return;const i={},s={};e.forEach(r=>{const{ID:o,"BASE-ID":l,"URI-REPLACEMENT":d}=r;if(n.some(u=>u.pathwayId===o))return;const c=this.getLevelsForPathway(l).map(u=>{const f=new wn(u.attrs);f["PATHWAY-ID"]=o;const h=f.AUDIO&&`${f.AUDIO}_clone_${o}`,p=f.SUBTITLES&&`${f.SUBTITLES}_clone_${o}`;h&&(i[f.AUDIO]=h,f.AUDIO=h),p&&(s[f.SUBTITLES]=p,f.SUBTITLES=p);const g=d4(u.uri,f["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",d),v=new Yl({attrs:f,audioCodec:u.audioCodec,bitrate:u.bitrate,height:u.height,name:u.name,url:g,videoCodec:u.videoCodec,width:u.width});if(u.audioGroups)for(let y=1;y<u.audioGroups.length;y++)v.addGroupId("audio",`${u.audioGroups[y]}_clone_${o}`);if(u.subtitleGroups)for(let y=1;y<u.subtitleGroups.length;y++)v.addGroupId("text",`${u.subtitleGroups[y]}_clone_${o}`);return v});n.push(...c),LP(this.audioTracks,i,d,o),LP(this.subtitleTracks,s,d,o)})}loadSteeringManifest(e){const n=this.hls.config,i=n.loader;this.loader&&this.loader.destroy(),this.loader=new i(n);let s;try{s=new self.URL(e)}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(s.protocol!=="data:"){const u=(this.hls.bandwidthEstimate||n.abrEwmaDefaultEstimate)|0;s.searchParams.set("_HLS_pathway",this.pathwayId),s.searchParams.set("_HLS_throughput",""+u)}const r={responseType:"json",url:s.href},o=n.steeringManifestLoadPolicy.default,l=o.errorRetry||o.timeoutRetry||{},d={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:l.maxNumRetry||0,retryDelay:l.retryDelayMs||0,maxRetryDelay:l.maxRetryDelayMs||0},c={onSuccess:(u,f,h,p)=>{this.log(`Loaded steering manifest: "${s}"`);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":v,"PATHWAY-CLONES":y,"PATHWAY-PRIORITY":b}=g;if(v)try{this.uri=new self.URL(v,s).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${v}`);return}this.scheduleRefresh(this.uri||h.url),y&&this.clonePathways(y);const E={steeringManifest:g,url:s.toString()};this.hls.trigger(B.STEERING_MANIFEST_LOADED,E),b&&this.updatePathwayPriority(b)},onError:(u,f,h,p)=>{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 v=this.loader;if(typeof v?.getResponseHeader=="function"){const y=v.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: ${s}`),this.loader.load(r,d,c)}scheduleRefresh(e,n=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var i;const s=(i=this.hls)==null?void 0:i.media;if(s&&!s.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},n)}};a(YI,"ContentSteeringController");let GS=YI;function LP(t,e,n,i){t&&Object.keys(e).forEach(s=>{const r=t.filter(o=>o.groupId===s).map(o=>{const l=jt({},o);return l.details=void 0,l.attrs=new wn(l.attrs),l.url=l.attrs.URI=d4(o.url,o.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",n),l.groupId=l.attrs["GROUP-ID"]=e[s],l.attrs["PATHWAY-ID"]=i,l});t.push(...r)})}a(LP,"cloneRenditionGroups");function d4(t,e,n,i){const{HOST:s,PARAMS:r,[n]:o}=i;let l;e&&(l=o?.[e],l&&(t=l));const d=new self.URL(t);
3523return s&&!l&&(d.host=s),r&&Object.keys(r).sort().forEach(c=>{c&&d.searchParams.set(c,r[c])}),d.href}a(d4,"performUriReplacement");function Ls(t,e,n){zs(t,e,n),t.addEventListener(e,n)}a(Ls,"addEventListener");function zs(t,e,n){t.removeEventListener(e,n)}a(zs,"removeEventListener");const ad=class ad extends ms{constructor(e){super("eme",e.logger),this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.mediaKeys=null,this.setMediaKeysQueue=ad.CDMCleanupPromise?[ad.CDMCleanupPromise]:[],this.onWaitingForKey=n=>{this.log(`"${n.type}" event`)},this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.onDestroying(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onWaitingForKey=null}registerListeners(){this.hls.on(B.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(B.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(B.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(B.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.on(B.DESTROYING,this.onDestroying,this)}unregisterListeners(){this.hls.off(B.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(B.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(B.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(B.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.off(B.DESTROYING,this.onDestroying,this)}getLicenseServerUrl(e){const{drmSystems:n,widevineLicenseUrl:i}=this.config,s=n[e];if(s)return s.licenseUrl;if(e===On.WIDEVINE&&i)return i}getLicenseServerUrlOrThrow(e){const n=this.getLicenseServerUrl(e);if(n===void 0)throw new Error(`no license server URL configured for key-system "${e}"`);return n}getServerCertificateUrl(e){const{drmSystems:n}=this.config,i=n[e];if(i)return i.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const n=this.hls.levels,i=a((o,l,d)=>!!o&&d.indexOf(o)===l,"uniqueCodec"),s=n.map(o=>o.audioCodec).filter(i),r=n.map(o=>o.videoCodec).filter(i);return s.length+r.length===0&&r.push("avc1.42e01e"),new Promise((o,l)=>{const d=a(c=>{const u=c.shift();this.getMediaKeysPromise(u,s,r).then(f=>o({keySystem:u,mediaKeys:f})).catch(f=>{c.length?d(c):f instanceof zi?l(f):l(new zi({type:Ge.KEY_SYSTEM_ERROR,details:de.KEY_SYSTEM_NO_ACCESS,error:f,fatal:!0},f.message))})},"attempt");d(e)})}requestMediaKeySystemAccess(e,n){const{requestMediaKeySystemAccessFunc:i}=this.config;if(typeof i!="function"){let s=`Configured requestMediaKeySystemAccess is not a function ${i}`;return M3===null&&self.location.protocol==="http:"&&(s=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(s))}return i(e,n)}getMediaKeysPromise(e,n,i){const s=Zpe(e,n,i,this.config.drmSystemOptions),r=this.keySystemAccessPromises[e];let o=r?.keySystemAccess;if(!o){this.log(`Requesting encrypted media "${e}" key-system access with config: ${hn(s)}`),o=this.requestMediaKeySystemAccess(e,s);const l=this.keySystemAccessPromises[e]={keySystemAccess:o};return o.catch(d=>{this.log(`Failed to obtain access to key-system "${e}": ${d}`)}),o.then(d=>{this.log(`Access for key-system "${d.keySystem}" obtained`);const c=this.fetchServerCertificate(e);return this.log(`Create media-keys for "${e}"`),l.mediaKeys=d.createMediaKeys().then(u=>(this.log(`Media-keys created for "${e}"`),l.hasMediaKeys=!0,c.then(f=>f?this.setMediaKeysServerCertificate(u,e,f):u))),l.mediaKeys.catch(u=>{this.error(`Failed to create media-keys for "${e}"}: ${u}`)}),l.mediaKeys})}return o.then(()=>r.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:n,mediaKeys:i}){this.log(`Creating key-system session "${n}" keyId: ${cl.hexDump(e.keyId||[])}`);const s=i.createSession(),r={decryptdata:e,keySystem:n,mediaKeys:i,mediaKeysSession:s,keyStatus:"status-pending"};return this.mediaKeySessions.push(r),r}renewKeySession(e){const n=e.decryptdata;if(n.pssh){const i=this.createMediaKeySessionContext(e),s=this.getKeyIdString(n),r="cenc";this.keyIdToKeySessionPromise[s]=this.generateRequestWithPreferredKeySession(i,r,n.pssh.buffer,"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 cl.hexDump(e.keyId)}updateKeySession(e,n){var i;const s=e.mediaKeysSession;return this.log(`Updating key-session "${s.sessionId}" for keyID ${cl.hexDump(((i=e.decryptdata)==null?void 0:i.keyId)||[])}
3524      } (data length: ${n&&n.byteLength})`),s.update(n)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(e=>({keySystem:e,hasMediaKeys:this.keySystemAccessPromises[e].hasMediaKeys})).filter(({hasMediaKeys:e})=>!!e).map(({keySystem:e})=>iP(e)).filter(e=>!!e)}getKeySystemAccess(e){return this.getKeySystemSelectionPromise(e).then(({keySystem:n,mediaKeys:i})=>this.attemptSetMediaKeys(n,i))}selectKeySystem(e){return new Promise((n,i)=>this.getKeySystemSelectionPromise(e).then(({keySystem:s})=>{const r=iP(s);r?n(r):i(new Error(`Unable to find format for key-system "${s}"`))}).catch(i))}selectKeySystemFormat(e){const n=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${n.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(n)),this.keyFormatPromise}getKeyFormatPromise(e){const n=Gm(this.config),i=e.map(vS).filter(s=>!!s&&n.indexOf(s)!==-1);return this.selectKeySystem(i)}loadKey(e){const n=e.keyInfo.decryptdata,i=this.getKeyIdString(n),s=`(keyId: ${i} format: "${n.keyFormat}" method: ${n.method} uri: ${n.uri})`;this.log(`Starting session for key ${s}`);let r=this.keyIdToKeySessionPromise[i];return r||(r=this.getKeySystemForKeyPromise(n).then(({keySystem:l,mediaKeys:d})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${s}`),this.attemptSetMediaKeys(l,d).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:l,mediaKeys:d,decryptdata:n}))))),(this.keyIdToKeySessionPromise[i]=r.then(l=>{const d="cenc",c=n.pssh?n.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(l,d,c,"playlist-key")}
vendor: 4,505 bytes, line 3524
3524)).catch(l=>this.handleError(l))),r}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof zi?this.hls.trigger(B.ERROR,e.data):this.hls.trigger(B.ERROR,{type:Ge.KEY_SYSTEM_ERROR,details:de.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const n=this.getKeyIdString(e),i=this.keyIdToKeySessionPromise[n];if(!i){const s=vS(e.keyFormat),r=s?[s]:Gm(this.config);return this.attemptKeySystemAccess(r)}return i}getKeySystemSelectionPromise(e){if(e.length||(e=Gm(this.config)),e.length===0)throw new zi({type:Ge.KEY_SYSTEM_ERROR,details:de.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${hn({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,n){if(this.mediaKeys===n)return Promise.resolve();const i=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const s=Promise.all(i).then(()=>{if(!this.media)throw this.mediaKeys=null,new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(n)});return this.mediaKeys=n,this.setMediaKeysQueue.push(s),s.then(()=>{this.log(`Media-keys set for "${e}"`),i.push(s),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(r=>i.indexOf(r)===-1)})}generateRequestWithPreferredKeySession(e,n,i,s){var r,o;const l=(r=this.config.drmSystems)==null||(o=r[e.keySystem])==null?void 0:o.generateRequest;if(l)try{const g=l.call(this.hls,n,i,e);if(!g)throw new Error("Invalid response from configured generateRequest filter");n=g.initDataType,i=g.initData?g.initData:null,e.decryptdata.pssh=i?new Uint8Array(i):null}catch(g){var d;if(this.warn(g.message),(d=this.hls)!=null&&d.config.debug)throw g}if(i===null)return this.log(`Skipping key-session request for "${s}" (no initData)`),Promise.resolve(e);const c=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${s}": ${c} (init data type: ${n} length: ${i?i.byteLength:null})`);const u=new FA,f=e._onmessage=g=>{const v=e.mediaKeysSession;if(!v){u.emit("error",new Error("invalid state"));return}const{messageType:y,message:b}=g;this.log(`"${y}" message event for session "${v.sessionId}" message size: ${b.byteLength}`),y==="license-request"||y==="license-renewal"?this.renewLicense(e,b).catch(E=>{u.eventNames().length?u.emit("error",E):this.handleError(E)}):y==="license-release"?e.keySystem===On.FAIRPLAY&&(this.updateKeySession(e,mS("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${y}"`)},h=e._onkeystatuseschange=g=>{if(!e.mediaKeysSession){u.emit("error",new Error("invalid state"));return}this.onKeyStatusChange(e);const y=e.keyStatus;u.emit("keyStatus",y),y==="expired"&&(this.warn(`${e.keySystem} expired for key ${c}`),this.renewKeySession(e))};Ls(e.mediaKeysSession,"message",f),Ls(e.mediaKeysSession,"keystatuseschange",h);const p=new Promise((g,v)=>{u.on("error",v),u.on("keyStatus",y=>{y.startsWith("usable")?g():y==="output-restricted"?v(new zi({type:Ge.KEY_SYSTEM_ERROR,details:de.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):y==="internal-error"?v(new zi({type:Ge.KEY_SYSTEM_ERROR,details:de.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${y}"`)):y==="expired"?v(new Error("key expired while generating request")):this.warn(`unhandled key status change "${y}"`)})});return e.mediaKeysSession.generateRequest(n,i).then(()=>{var g;this.log(`Request generated for key-session "${(g=e.mediaKeysSession)==null?void 0:g.sessionId}" keyId: ${c}`)}).catch(g=>{throw new zi({type:Ge.KEY_SYSTEM_ERROR,details:de.KEY_SYSTEM_NO_SESSION,error:g,fatal:!1},`Error generating key-session request: ${g}`)}).then(()=>p).catch(g=>{throw u.removeAllListeners(),this.removeSession(e),g}).then(()=>(u.removeAllListeners(),e))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach((n,i)=>{if(typeof i=="string"&&typeof n=="object"){const s=i;i=n,n=s}this.log(`key status change "${n}" for keyStatuses keyId: ${cl.hexDump("buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i))} session keyId: ${cl.hexDump(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=n})}fetchServerCertificate(e){const n=this.config,i=n.loader,s=new i(n),r=this.getServerCertificateUrl(e);return r?(this.log(`Fetching server certificate for "${e}"`),new Promise((o,l)=>{const d={responseType:"arraybuffer",url:r}
vendor: 4,467 bytes, line 3524
3524,c=n.certLoadPolicy.default,u={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(h,p,g,v)=>{o(h.data)},onError:(h,p,g,v)=>{l(new zi({type:Ge.KEY_SYSTEM_ERROR,details:de.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:g,response:nn({url:d.url,data:void 0},h)},`"${e}" certificate request failed (${r}). Status: ${h.code} (${h.text})`))},onTimeout:(h,p,g)=>{l(new zi({type:Ge.KEY_SYSTEM_ERROR,details:de.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:g,response:{url:d.url,data:void 0}},`"${e}" certificate request timed out (${r})`))},onAbort:(h,p,g)=>{l(new Error("aborted"))}};s.load(d,u,f)})):Promise.resolve()}setMediaKeysServerCertificate(e,n,i){return new Promise((s,r)=>{e.setServerCertificate(i).then(o=>{this.log(`setServerCertificate ${o?"success":"not supported by CDM"} (${i?.byteLength}) on "${n}"`),s(e)}).catch(o=>{r(new zi({type:Ge.KEY_SYSTEM_ERROR,details:de.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:o,fatal:!0},o.message))})})}renewLicense(e,n){return this.requestLicense(e,new Uint8Array(n)).then(i=>this.updateKeySession(e,new Uint8Array(i)).catch(s=>{throw new zi({type:Ge.KEY_SYSTEM_ERROR,details:de.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:s,fatal:!0},s.message)}))}unpackPlayReadyKeyMessage(e,n){const i=String.fromCharCode.apply(null,new Uint16Array(n.buffer));if(!i.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),n;const s=new DOMParser().parseFromString(i,"application/xml"),r=s.querySelectorAll("HttpHeader");if(r.length>0){let u;for(let f=0,h=r.length;f<h;f++){var o,l;u=r[f];const p=(o=u.querySelector("name"))==null?void 0:o.textContent,g=(l=u.querySelector("value"))==null?void 0:l.textContent;p&&g&&e.setRequestHeader(p,g)}}const d=s.querySelector("Challenge"),c=d?.textContent;if(!c)throw new Error("Cannot find <Challenge> in key message");return mS(atob(c))}setupLicenseXHR(e,n,i,s){const r=this.config.licenseXhrSetup;return r?Promise.resolve().then(()=>{if(!i.decryptdata)throw new Error("Key removed");return r.call(this.hls,e,n,i,s)}).catch(o=>{if(!i.decryptdata)throw o;return e.open("POST",n,!0),r.call(this.hls,e,n,i,s)}).then(o=>(e.readyState||e.open("POST",n,!0),{xhr:e,licenseChallenge:o||s})):(e.open("POST",n,!0),Promise.resolve({xhr:e,licenseChallenge:s}))}requestLicense(e,n){const i=this.config.keyLoadPolicy.default;return new Promise((s,r)=>{const o=this.getLicenseServerUrlOrThrow(e.keySystem);this.log(`Sending license request to URL: ${o}`);const l=new XMLHttpRequest;l.responseType="arraybuffer",l.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return r(new Error("invalid state"));if(l.readyState===4)if(l.status===200){this._requestLicenseFailureCount=0;let d=l.response;this.log(`License received ${d instanceof ArrayBuffer?d.byteLength:d}`);const c=this.config.licenseResponseCallback;if(c)try{d=c.call(this.hls,l,o,e)}catch(u){this.error(u)}s(d)}else{const d=i.errorRetry,c=d?d.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>c||l.status>=400&&l.status<500)r(new zi({type:Ge.KEY_SYSTEM_ERROR,details:de.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:l,response:{url:o,data:void 0,code:l.status,text:l.statusText}},`License Request XHR failed (${o}). Status: ${l.status} (${l.statusText})`));else{const u=c-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${u} attempts left`),this.requestLicense(e,n).then(s,r)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=l,this.setupLicenseXHR(l,o,e,n).then(({xhr:d,licenseChallenge:c})=>{e.keySystem==On.PLAYREADY&&(c=this.unpackPlayReadyKeyMessage(d,c)),d.send(c)})})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(e,n){if(!this.config.emeEnabled)return;const i=n.media;this.media=i,Ls(i,"waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media;e&&(zs(e,"waitingforkey",this.onWaitingForKey),this.media=null,this.mediaKeys=null)}_clear(){var e;if(this._requestLicenseFailureCount=0,this.keyIdToKeySessionPromise={},!this.mediaKeys&&!this.mediaKeySessions.length)return;const n=this.media,i=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,wv.clearKeyUriToKeyIdMap();const s=i.length;ad.CDMCleanupPromise=Promise.all(i.map(r=>this.removeSession(r)).concat(n==null||(e=n.setMediaKeys(null))==null?void 0:e.catch(r=>{var o;
vendor: 8,996 bytes, line 3524
3524this.log(`Could not clear media keys: ${r}`),(o=this.hls)==null||o.trigger(B.ERROR,{type:Ge.OTHER_ERROR,details:de.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${r}`)})}))).catch(r=>{var o;this.log(`Could not close sessions and clear media keys: ${r}`),(o=this.hls)==null||o.trigger(B.ERROR,{type:Ge.OTHER_ERROR,details:de.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close sessions and clear media keys: ${r}`)})}).then(()=>{s&&this.log("finished closing key sessions and clearing media keys")})}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:n}){if(!(!n||!this.config.emeEnabled)&&!this.keyFormatPromise){const i=n.reduce((s,r)=>(s.indexOf(r.keyFormat)===-1&&s.push(r.keyFormat),s),[]);this.log(`Selecting key-system from session-keys ${i.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(i)}}removeSession(e){const{mediaKeysSession:n,licenseXhr:i}=e;if(n){this.log(`Remove licenses and keys and close session ${n.sessionId}`),e._onmessage&&(n.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(n.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),i&&i.readyState!==XMLHttpRequest.DONE&&i.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const s=this.mediaKeySessions.indexOf(e);s>-1&&this.mediaKeySessions.splice(s,1);const{drmSystemOptions:r}=this.config;return(Jpe(r)?new Promise((l,d)=>{self.setTimeout(()=>d(new Error("MediaKeySession.remove() timeout")),8e3),n.remove().then(l)}):Promise.resolve()).catch(l=>{var d;this.log(`Could not remove session: ${l}`),(d=this.hls)==null||d.trigger(B.ERROR,{type:Ge.OTHER_ERROR,details:de.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${l}`)})}).then(()=>n.close()).catch(l=>{var d;this.log(`Could not close session: ${l}`),(d=this.hls)==null||d.trigger(B.ERROR,{type:Ge.OTHER_ERROR,details:de.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${l}`)})})}}};a(ad,"EMEController");let Cv=ad;Cv.CDMCleanupPromise=void 0;const ZI=class ZI extends Error{constructor(e,n){super(n),this.data=void 0,e.error||(e.error=new Error(n)),this.data=e,e.err=e.error}};a(ZI,"EMEKeyError");let zi=ZI;const QI=class QI{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(B.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(B.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off(B.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(B.MEDIA_DETACHING,this.onMediaDetaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,n){const i=this.hls.config;if(i.capLevelOnFPSDrop){const s=n.media instanceof self.HTMLVideoElement?n.media:null;this.media=s,s&&typeof s.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(e,n,i){const s=performance.now();if(n){if(this.lastTime){const r=s-this.lastTime,o=i-this.lastDroppedFrames,l=n-this.lastDecodedFrames,d=1e3*o/r,c=this.hls;if(c.trigger(B.FPS_DROP,{currentDropped:o,currentDecoded:l,totalDroppedFrames:i}),d>0&&o>c.config.fpsDroppedMonitoringThreshold*l){let u=c.currentLevel;c.logger.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(B.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:c.currentLevel}),c.autoLevelCapping=u,this.streamController.nextLevelSwitch())}}this.lastTime=s,this.lastDroppedFrames=i,this.lastDecodedFrames=n}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const n=e.getVideoPlaybackQuality();this.checkFPS(e,n.totalVideoFrames,n.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}};a(QI,"FPSController");let VS=QI;function u4(t,e){let n;try{n=new Event("addtrack")}catch{n=document.createEvent("Event"),n.initEvent("addtrack",!1,!1)}n.track=t,e.dispatchEvent(n)}a(u4,"sendAddTrackEvent");function f4(t,e){const n=t.mode;if(n==="disabled"&&(t.mode="hidden"),t.cues&&!t.cues.getCueById(e.id))try{if(t.addCue(e),!t.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(i){Bt.debug(`[texttrack-utils]: ${i}`);try{const s=new self.TextTrackCue(e.startTime,e.endTime,e.text);s.id=e.id,t.addCue(s)}catch(s){Bt.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${s}`)}}n==="disabled"&&(t.mode=n)}a(f4,"addCueToTrack");function rd(t,e){const n=t.mode;if(n==="disabled"&&(t.mode="hidden"),t.cues)for(let i=t.cues.length;i--;)e&&t.cues[i].removeEventListener("enter",e),t.removeCue(t.cues[i]);n==="disabled"&&(t.mode=n)}a(rd,"clearCurrentCues");function WS(t,e,n,i){const s=t.mode;if(s==="disabled"&&(t.mode="hidden"),t.cues&&t.cues.length>0){const r=zme(t.cues,e,n);for(let o=0;o<r.length;o++)(!i||i(r[o]))&&t.removeCue(r[o])}s==="disabled"&&(t.mode=s)}a(WS,"removeCuesInRange");function Wme(t,e){if(e<=t[0].startTime)return 0;const n=t.length-1;if(e>t[n].endTime)return-1;let i=0,s=n,r;for(;i<=s;)if(r=Math.floor((s+i)/2),e<t[r].startTime)s=r-1;else if(e>t[r].startTime&&i<n)i=r+1;else return r;return t[i].startTime-e<e-t[s].startTime?i:s}a(Wme,"getFirstCueIndexFromTime");function zme(t,e,n){const i=[],s=Wme(t,e);if(s>-1)for(let r=s,o=t.length;r<o;r++){const l=t[r];if(l.startTime>=e&&l.endTime<=n)i.push(l);else if(l.startTime>n)return i}return i}a(zme,"getCuesInRange");function zm(t){const e=[];for(let n=0;n<t.length;n++){const i=t[n];(i.kind==="subtitles"||i.kind==="captions")&&i.label&&e.push(t[n])}return e}a(zm,"filterSubtitleTracks");const JI=class JI extends Hh{constructor(e){super(e,"subtitle-track-controller"),this.media=null,this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let n=null;const i=zm(this.media.textTracks);for(let r=0;r<i.length;r++)if(i[r].mode==="hidden")n=i[r];else if(i[r].mode==="showing"){n=i[r];break}const s=this.findTrackForTextTrack(n);this.subtitleTrack!==s&&this.setSubtitleTrack(s)},this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes()}registerListeners(){const{hls:e}=this;e.on(B.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(B.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(B.MANIFEST_LOADING,this.onManifestLoading,this),e.on(B.MANIFEST_PARSED,this.onManifestParsed,this),e.on(B.LEVEL_LOADING,this.onLevelLoading,this),e.on(B.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(B.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(B.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(B.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(B.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(B.MANIFEST_LOADING,this.onManifestLoading,this),e.off(B.MANIFEST_PARSED,this.onManifestParsed,this),e.off(B.LEVEL_LOADING,this.onLevelLoading,this),e.off(B.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(B.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(B.ERROR,this.onError,this)}onMediaAttached(e,n){this.media=n.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(e,n){const i=this.media;if(!i)return;const s=!!n.transferMedia;if(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||i.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,s)return;
vendor: 2,246 bytes, line 3524
3524zm(i.textTracks).forEach(o=>{rd(o)})}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,n){this.tracks=n.subtitleTracks}onSubtitleTrackLoaded(e,n){const{id:i,groupId:s,details:r}=n,o=this.tracksInGroup[i];if(!o||o.groupId!==s){this.warn(`Subtitle track with id:${i} and group:${s} not found in active group ${o?.groupId}`);return}const l=o.details;o.details=n.details,this.log(`Subtitle track ${i} "${o.name}" lang:${o.lang} group:${s} loaded [${r.startSN}-${r.endSN}]`),i===this.trackId&&this.playlistLoaded(i,n,l)}onLevelLoading(e,n){this.switchLevel(n.level)}onLevelSwitching(e,n){this.switchLevel(n.level)}switchLevel(e){const n=this.hls.levels[e];if(!n)return;const i=n.subtitleGroups||null,s=this.groupIds;let r=this.currentTrack;if(!i||s?.length!==i?.length||i!=null&&i.some(o=>s?.indexOf(o)===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const o=this.tracks.filter(u=>!i||i.indexOf(u.groupId)!==-1);if(o.length)this.selectDefaultTrack&&!o.some(u=>u.default)&&(this.selectDefaultTrack=!1),o.forEach((u,f)=>{u.id=f});else if(!r&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const l=this.hls.config.subtitlePreference;if(!r&&l){this.selectDefaultTrack=!1;const u=Rr(l,o);if(u>-1)r=o[u];else{const f=Rr(l,this.tracks);r=this.tracks[f]}}let d=this.findTrackId(r);d===-1&&r&&(d=this.findTrackId(null));const c={subtitleTracks:o};this.log(`Updating subtitle tracks, ${o.length} track(s) found in "${i?.join(",")}" group-id`),this.hls.trigger(B.SUBTITLE_TRACKS_UPDATED,c),d!==-1&&this.trackId===-1&&this.setSubtitleTrack(d)}}findTrackId(e){const n=this.tracksInGroup,i=this.selectDefaultTrack;for(let s=0;s<n.length;s++){const r=n[s];if(!(i&&!r.default||!i&&!e)&&(!e||Ol(r,e)))return s}if(e){for(let s=0;s<n.length;s++){const r=n[s];if(Gh(e.attrs,r.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return s}for(let s=0;s<n.length;s++){const r=n[s];if(Gh(e.attrs,r.attrs,["LANGUAGE"]))return s}}return-1}findTrackForTextTrack(e){if(e){const n=this.tracksInGroup;for(let i=0;i<n.length;i++){const s=n[i];if(PS(s,e))return i}}return-1}onError(e,n){n.fatal||!n.context||n.context.type===wt.SUBTITLE_TRACK&&n.c
vendor: 7,333 bytes, line 3524
3524ontext.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(n.context.groupId)!==-1)&&this.checkRetry(n)}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(e){this.selectDefaultTrack=!1,this.setSubtitleTrack(e)}setSubtitleOption(e){if(this.hls.config.subtitlePreference=e,e){if(e.id===-1)return this.setSubtitleTrack(-1),null;const n=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,n.length){const i=this.currentTrack;if(i&&Ol(e,i))return i;const s=Rr(e,this.tracksInGroup);if(s>-1){const r=this.tracksInGroup[s];return this.setSubtitleTrack(s),r}else{if(i)return null;{const r=Rr(e,n);if(r>-1)return n[r]}}}}return null}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}loadingPlaylist(e,n){super.loadingPlaylist(e,n);const i=e.id,s=e.groupId,r=this.getUrlWithDirectives(e.url,n),o=e.details,l=o?.age;this.log(`Loading subtitle ${i} "${e.name}" lang:${e.lang} group:${s}${n?.msn!==void 0?" at sn "+n.msn+" part "+n.part:""}${l&&o.live?" age "+l.toFixed(1)+(o.type&&" "+o.type||""):""} ${r}`),this.hls.trigger(B.SUBTITLE_TRACK_LOADING,{url:r,id:i,groupId:s,deliveryDirectives:n||null,track:e})}toggleTrackModes(){const{media:e}=this;if(!e)return;const n=zm(e.textTracks),i=this.currentTrack;let s;if(i&&(s=n.filter(r=>PS(i,r))[0],s||this.warn(`Unable to find subtitle TextTrack with name "${i.name}" and language "${i.lang}"`)),[].slice.call(n).forEach(r=>{r.mode!=="disabled"&&r!==s&&(r.mode="disabled")}),s){const r=this.subtitleDisplay?"showing":"hidden";s.mode!==r&&(s.mode=r)}}setSubtitleTrack(e){const n=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=n.length||!Pe(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.selectDefaultTrack=!1;const i=this.currentTrack,s=n[e]||null;if(this.trackId=e,this.currentTrack=s,this.toggleTrackModes(),!s){this.hls.trigger(B.SUBTITLE_TRACK_SWITCH,{id:e});return}const r=!!s.details&&!s.details.live;if(e===this.trackId&&s===i&&r)return;this.log(`Switching to subtitle-track ${e}`+(s?` "${s.name}" lang:${s.lang} group:${s.groupId}`:""));const{id:o,groupId:l="",name:d,type:c,url:u}=s;this.hls.trigger(B.SUBTITLE_TRACK_SWITCH,{id:o,groupId:l,name:d,type:c,url:u});const f=this.switchParams(s.url,i?.details,s.details);this.loadPlaylist(f)}};a(JI,"SubtitleTrackController");let zS=JI;function Kme(){try{return crypto.randomUUID()}catch{try{const e=URL.createObjectURL(new Blob),n=e.toString();return URL.revokeObjectURL(e),n.slice(n.lastIndexOf("/")+1)}catch{let n=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,s=>{const r=(n+Math.random()*16)%16|0;return n=Math.floor(n/16),(s=="x"?r:r&3|8).toString(16)})}}}a(Kme,"uuid");function Lf(t){let e=5381,n=t.length;for(;n;)e=e*33^t.charCodeAt(--n);return(e>>>0).toString()}a(Lf,"hash");const _d=.025;let Pv=function(t){return t[t.Point=0]="Point",t[t.Range=1]="Range",t}({});function qme(t,e,n){return`${t.identifier}-${n+1}-${Lf(e)}`}a(qme,"generateAssetIdentifier");const XI=class XI{constructor(e,n){this.base=void 0,this._duration=null,this._timelineStart=null,this.appendInPlaceDisabled=void 0,this.appendInPlaceStarted=void 0,this.dateRange=void 0,this.hasPlayed=!1,this.cumulativeDuration=0,this.resumeOffset=NaN,this.playoutLimit=NaN,this.restrictions={skip:!1,jump:!1},this.snapOptions={out:!1,in:!1},this.assetList=[],this.assetListLoader=void 0,this.assetListResponse=null,this.resumeAnchor=void 0,this.error=void 0,this.resetOnResume=void 0,this.base=n,this.dateRange=e,this.setDateRange(e)}setDateRange(e){this.dateRange=e,this.resumeOffset=e.attr.optionalFloat("X-RESUME-OFFSET",this.resumeOffset),this.playoutLimit=e.attr.optionalFloat("X-PLAYOUT-LIMIT",this.playoutLimit),this.restrictions=e.attr.enumeratedStringList("X-RESTRICT",this.restrictions),this.snapOptions=e.attr.enumeratedStringList("X-SNAP",this.snapOptions)}reset(){var e;this.appendInPlaceStarted=!1,(e=this.assetListLoader)==null||e.destroy(),this.assetListLoader=void 0,this.supplementsPrimary||(this.assetListResponse=null,this.assetList=[],this._duration=null)}isAssetPastPlayoutLimit(e){var n;if(e>0&&e>=this.assetList.length)return!0;const i=this.playoutLimit;return e<=0||isNaN(i)?!1:i===0?!0:(((n=this.assetList[e])==null?void 0:n.startOffset)||0)>i}findAssetIndex(e){return this.assetList.indexOf(e)}get identifier(){return this.dateRange.id}get startDate(){return this.dateRange.startDate}get startTime(){const e=this.dateRange.startTime;if(this.snapOptions.out){const n=this.dateRange.tagAnchor;if(n)return AE(e,n)}return e}get startOffset(){return this.cue.pre?0:this.startTime}get startIsAligned(){if(this.startTime===0||this.snapOptions.out)return!0;const e=this.dateRange.tagAnchor;if(e){const n=this.dateRange.startTime,i=AE(n,e);return n-i<.1}return!1}get resumptionOffset(){const e=this.resumeOffset,n=Pe(e)?e:this.duration;return this.cumulativeDuration+n}get resumeTime(){const e=this.startOffset+this.resumptionOffset;if(this.snapOptions.in){const n=this.resumeAnchor;if(n)return AE(e,n)}return e}get appendInPlace(){return this.appendInPlaceStarted?!0:this.appendInPlaceDisabled?!1:!!(!this.cue.once&&!this.cue.pre&&this.startIsAligned&&(isNaN(this.playoutLimit)&&isNaN(this.resumeOffset)||this.resumeOffset&&this.duration&&Math.abs(this.resumeOffset-this.duration)<_d))}set appendInPlace(e){if(this.appendInPlaceStarted){this.resetOnResume=!e;return}this.appendInPlaceDisabled=!e}get timelineStart(){return this._timelineStart!==null?this._timelineStart:this.startTime}set timelineStart(e){this._timelineStart=e}get duration(){const e=this.playoutLimit;let n;return this._duration!==null?n=this._duration:this.dateRange.duration?n=this.dateRange.duration:n=this.dateRange.plannedDuration||0,!isNaN(e)&&e<n&&(n=e),n}set duration(e){this._duration=e}get cue(){return this.dateRange.cue}get timelineOccupancy(){return this.dateRange.attr["X-TIMELINE-OCCUPIES"]==="RANGE"?Pv.Range:Pv.Point}get supplementsPrimary(){return this.dateRange.attr["X-TIMELINE-STYLE"]==="PRIMARY"}get contentMayVary(){return this.dateRange.attr["X-CONTENT-MAY-VARY"]!=="NO"}get assetUrl(){return this.dateRange.attr["X-ASSET-URI"]}get assetListUrl(){return this.dateRange.attr["X-ASSET-LIST"]}get baseUrl(){return this.base.url}get assetListLoaded(){return this.assetList.length>0||this.assetListResponse!==null}toString(){return jme(this)}};a(XI,"InterstitialEvent");let KS=XI;function AE(t,e){return t-e.start<e.duration/2&&!(Math.abs(t-(e.start+e.duration))<_d)?e.start:e.start+e.duration}a(AE,"getSnapToFragmentTime");function h4(t,e,n){const i=new self.URL(t,n);return i.protocol!=="data:"&&i.searchParams.set("_HLS_primary_id",e),i}a(h4,"getInterstitialUrl");function xE(t,e){for(;(n=t.assetList[++e])!=null&&n.error;)var n;return e}a(xE,"getNextAssetIndex");function jme(t){return`["${t.identifier}" ${t.cue.pre?"<pre>":t.cue.post?"<post>":""}${t.timelineStart.toFixed(2)}-${t.resumeTime.toFixed(2)}]`}a(jme,"eventToString");function Qc(t){const e=t.timelineStart,n=t.duration||0;return`["${t.identifier}" ${e.toFixed(2)}-${(e+n).toFixed(2)}]`}a(Qc,"eventAssetToString");const eL=class eL{constructor(e,n,i,s){this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetail
3524s=!1,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=()=>{this.reachedPlayout(this.currentTime)&&this.hls.trigger(B.PLAYOUT_LIMIT_REACHED,{})};const r=this.hls=new e(n);this.interstitial=i,this.assetItem=s;let o=s.uri;try{o=h4(o,n.primarySessionId).href}catch{}r.loadSource(o);const l=a(()=>{this.hasDetails=!0},"detailsLoaded");r.once(B.LEVEL_LOADED,l),r.once(B.AUDIO_TRACK_LOADED,l),r.once(B.SUBTITLE_TRACK_LOADED,l),r.on(B.MEDIA_ATTACHING,(d,{media:c})=>{this.removeMediaListeners(),this.mediaAttached=c,this.interstitial.playoutLimit&&(c.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&r.on(B.BUFFER_APPENDED,()=>{const f=this.bufferedEnd;this.reachedPlayout(f)&&(this._bufferedEosTime=f,r.trigger(B.BUFFERED_TO_END,void 0))}))})}get appendInPlace(){var e;return((e=this.interstitial)==null?void 0:e.appendInPlace)||!1}bufferedInPlaceToEnd(e){var n;if(!this.appendInPlace)return!1;if((n=this.hls)!=null&&n.bufferedToEnd)return!0;if(!e||!this._bufferedEosTime)return!1;const i=this.timelineOffset,s=gt.bufferInfo(e,i,0);return this.getAssetTime(s.end)>=this._bufferedEosTime-.02}reachedPlayout(e){const i=this.interstitial.playoutLimit;return this.startOffset+e>=i}get destroyed(){var e;return!((e=this.hls)!=null&&e.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){var e;return((e=this.hls)==null?void 0:e.media)||null}get bufferedEnd(){const e=this.media||this.mediaAttached;if(!e)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;const n=gt.bufferInfo(e,e.currentTime,.001);return this.getAssetTime(n.end)}get currentTime(){const e=this.media||this.mediaAttached;return e?this.getAssetTime(e.currentTime):this._currentTime||0}get duration(){const e=this.assetItem.duration;return e||0}get remaining(){const e=this.duration;return e?Math.max(0,e-this.currentTime):0}get startOffset(){return this.assetItem.startOffset}get timelineOffset(){var e;return((e=this.hls)==null?void 0:e.config.timelineOffset)||0}set timelineOffset(e){const n=this.timelineOffset;if(e!==n){const i=e-n;if(Math.abs(i)>1/9e4){if(this.hasDetails)throw new Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=e}}}getAssetTime(e){const n=this.timelineOffset,i=this.duration;return Math.min(Math.max(0,e-n),i)}removeMediaListeners(){const e=this.mediaAttached;e&&(this._currentTime=e.currentTime,this.bufferSnapShot(),e.removeEventListener("timeupdate",this.checkPlayout))}bufferSnapShot(){if(this.mediaAttached){var e;(e=this.hls)!=null&&e.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd)}}destroy(){this.removeMediaListeners(),this.hls.destroy(),this.hls=this.interstitial=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(e){this.hls.attachMedia(e)}detachMedia(){this.removeMediaListeners(),this.mediaAttached=null,this.hls.detachMedia()}resumeBuffering(){this.hls.resumeBuffering()}pauseBuffering(){this.hls.pauseBuffering()}transferMedia(){return this.bufferSnapShot(),this.hls.transferMedia()}resetDetails(){const e=this.hls;if(this.hasDetails){e.stopLoad();const n=a(i=>delete i.details,"deleteDetails");e.levels.forEach(n),e.allAudioTracks.forEach(n),e.allSubtitleTracks.forEach(n),this.hasDetails=!1}}on(e,n,i){this.hls.on(e,n)}once(e,n,i){this.hls.once(e,n)}off(e,n,i){this.hls.off(e,n)}toString(){var e;return`HlsAssetPlayer: ${Qc(this.assetItem)} ${(e=this.hls)==null?void 0:e.sessionId} ${this.appendInPlace?"append-in-place":""}`}};a(eL,"HlsAssetPlayer");let qS=eL;const RP=.033,tL=class tL extends ms{constructor(e,n){super("interstitials-sched",n),this.onScheduleUpdate=void 0,this.eventMap={},this.events=null,this.items=null,this.durations={primary:0,playout:0,integrated:0},this.onScheduleUpdate=e}destroy(){this.reset(),this.onScheduleUpdate=null}reset(){this.eventMap={},this.setDurations(0,0,0),this.events&&this.events.forEach(e=>e.reset()),this.events=this.items=null}resetErrorsInRange(e,n){return this.events?this.events.reduce((i,s)=>e<=s.startOffset&&n>
vendor: 36,937 bytes, lines 3524-3525
3524s.startOffset?(delete s.error,i+1):i,0):0}get duration(){const e=this.items;return e?e[e.length-1].end:0}get length(){return this.items?this.items.length:0}getEvent(e){return e&&this.eventMap[e]||null}hasEvent(e){return e in this.eventMap}findItemIndex(e,n){if(e.event)return this.findEventIndex(e.event.identifier);let i=-1;e.nextEvent?i=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(i=this.findEventIndex(e.previousEvent.identifier)+1);const s=this.items;if(s)for(s[i]||(n===void 0&&(n=e.start),i=this.findItemIndexAtTime(n));i>=0&&(r=s[i])!=null&&r.event;){var r;i--}return i}findItemIndexAtTime(e,n){const i=this.items;if(i)for(let s=0;s<i.length;s++){let r=i[s];if(n&&n!=="primary"&&(r=r[n]),e===r.start||e>r.start&&e<r.end)return s}return-1}findJumpRestrictedIndex(e,n){const i=this.items;if(i)for(let s=e;s<=n&&i[s];s++){const r=i[s].event;if(r!=null&&r.restrictions.jump&&!r.appendInPlace)return s}return-1}findEventIndex(e){const n=this.items;if(n)for(let s=n.length;s--;){var i;if(((i=n[s].event)==null?void 0:i.identifier)===e)return s}return-1}findAssetIndex(e,n){const i=e.assetList,s=i.length;if(s>1)for(let r=0;r<s;r++){const o=i[r];if(!o.error){const l=o.timelineStart;if(n===l||n>l&&n<l+(o.duration||0))return r}}return 0}get assetIdAtEnd(){var e,n;const i=(e=this.items)==null||(n=e[this.length-1])==null?void 0:n.event;if(i){const s=i.assetList,r=s[s.length-1];if(r)return r.identifier}return null}parseInterstitialDateRanges(e,n){const i=e.main.details,{dateRanges:s}=i,r=this.events,o=this.parseDateRanges(s,{url:i.url},n),l=Object.keys(s),d=r?r.filter(c=>!l.includes(c.identifier)):[];o.length&&o.sort((c,u)=>{const f=c.cue.pre,h=c.cue.post,p=u.cue.pre,g=u.cue.post;if(f&&!p)return-1;if(p&&!f||h&&!g)return 1;if(g&&!h)return-1;if(!f&&!p&&!h&&!g){const v=c.startTime,y=u.startTime;if(v!==y)return v-y}return c.dateRange.tagOrder-u.dateRange.tagOrder}),this.events=o,d.forEach(c=>{this.removeEvent(c)}),this.updateSchedule(e,d)}updateSchedule(e,n=[]){const i=this.events||[];if(i.length||n.length||this.length<2){const s=this.items,r=this.parseSchedule(i,e);(n.length||s?.length!==r.length||r.some((l,d)=>Math.abs(l.playout.start-s[d].playout.start)>.005||Math.abs(l.playout.end-s[d].playout.end)>.005))&&(this.items=r,this.onScheduleUpdate(n,s))}}parseDateRanges(e,n,i){const s=[],r=Object.keys(e);for(let o=0;o<r.length;o++){const l=r[o],d=e[l];if(d.isInterstitial){let c=this.eventMap[l];c?c.setDateRange(d):(c=new KS(d,n),this.eventMap[l]=c,i===!1&&(c.appendInPlace=i)),s.push(c)}}return s}parseSchedule(e,n){const i=[],s=n.main.details,r=s.live?1/0:s.edge;let o=0;if(e=e.filter(d=>!d.error&&!(d.cue.once&&d.hasPlayed)),e.length){this.resolveOffsets(e,n);let d=0,c=0;if(e.forEach((u,f)=>{const h=u.cue.pre,p=u.cue.post,g=e[f-1]||null,v=u.appendInPlace,y=p?r:u.startOffset,b=u.duration,E=u.timelineOccupancy===Pv.Range?b:0,T=u.resumptionOffset,I=g?.startTime===y,M=y+u.cumulativeDuration;let H=v?M+b:y+T;if(h||!p&&y<=0){const $=c;c+=E,u.timelineStart=M;const F=o;o+=b,i.push({event:u,start:M,end:H,playout:{start:F,end:o},integrated:{start:$,end:c}})}else if(y<=r){if(!I){const D=y-d;if(D>RP){const L=d,m=c;c+=D;const S=o;o+=D;const _={previousEvent:e[f-1]||null,nextEvent:u,start:L,end:L+D,playout:{start:S,end:o},integrated:{start:m,end:c}};i.push(_)}else D>0&&g&&(g.cumulativeDuration+=D,i[i.length-1].end=y)}p&&(H=M),u.timelineStart=M;const $=c;c+=E;const F=o;o+=b,i.push({event:u,start:M,end:H,playout:{start:F,end:o},integrated:{start:$,end:c}})}else return;const N=u.resumeTime;p||N>r?d=r:d=N}),d<r){var l;const u=d,f=c,h=r-d;c+=h;const p=o;o+=h,i.push({previousEvent:((l=i[i.length-1])==null?void 0:l.event)||null,nextEvent:null,start:d,end:u+h,playout:{start:p,end:o},integrated:{start:f,end:c}})}this.setDurations(r,o,c)}else i.push({previousEvent:null,nextEvent:null,start:0,end:r,playout:{start:0,end:r},integrated:{start:0,end:r}}),this.setDurations(r,r,r);return i}setDurations(e,n,i){this.durations={primary:e,playout:n,integrated:i}}resolveOffsets(e,n){const i=n.main.details,s=i.live?1/0:i.edge;let r=0,o=-1;e.forEach((l,d)=>{const c=l.cue.pre,u=l.cue.post,f=c?0:u?s:l.startTime;this.updateAssetDurations(l),o===f?l.cumulativeDuration=r:(r=0,o=f),!u&&l.snapOptions.in&&(l.resumeAnchor=Zl(null,i.fragments,l.startOffset+l.resumptionOffset,0,0)||void 0),l.appendInPlace&&!l.appendInPlaceStarted&&(this.primaryCanResumeInPlaceAt(l,n)||(l.appendInPlace=!1)),!l.appendInPlace&&d+1<e.length&&e[d+1].startTime-e[d].resumeTime<RP&&(e[d+1].appendInPlace=!1,e[d+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${l}`));const p=Pe(l.resumeOffset)?l.resumeOffset:l.duration;r+=p})}primaryCanResumeInPlaceAt(e,n){const i=e.resumeTime,s=e.startTime+e.resumptionOffset;return Math.abs(i-s)>_d?(this.log(`"${e.identifier}" resumption ${i} not aligned with estimated timeline end ${s}`),!1):n?!Object.keys(n).some(o=>{const l=n[o].details,d=l.edge;if(i>=d)return this.log(`"${e.identifier}" resumption ${i} past ${o} playlist end ${d}`),!1;const c=Zl(null,l.fragments,i);if(!c)return this.log(`"${e.identifier}" resumption ${i} does not align with any fragments in ${o} playlist (${l.fragStart}-${l.fragmentEnd})`),!0;const u=o==="audio"?.175:0;return Math.abs(c.start-i)<_d+u||Math.abs(c.end-i)<_d+u?!1:(this.log(`"${e.identifier}" resumption ${i} not aligned with ${o} fragment bounds (${c.start}-${c.end} sn: ${c.sn} cc: ${c.cc})`),!0)}):(this.log(`"${e.identifier}" resumption ${i} can not be aligned with media (none selected)`),!1)}updateAssetDurations(e){if(!e.assetListLoaded)return;const n=e.timelineStart;let i=0,s=!1,r=!1;e.assetList.forEach((o,l)=>{const d=n+i;o.startOffset=i,o.timelineStart=d,s||(s=o.duration===null),r||(r=!!o.error);const c=o.error?0:o.duration||0;i+=c}),s&&!r?e.duration=Math.max(i,e.duration):e.duration=i}removeEvent(e){e.reset(),delete this.eventMap[e.identifier]}};a(tL,"InterstitialsSchedule");let jS=tL;function Vo(t){return`[${t.event?'"'+t.event.identifier+'"':"primary"}: ${t.start.toFixed(2)}-${t.end.toFixed(2)}]`}a(Vo,"segmentToString");const nL=class nL{constructor(e){this.hls=void 0,this.hls=e}destroy(){this.hls=null}loadAssetList(e,n){const i=e.assetListUrl;let s;try{s=h4(i,this.hls.sessionId,e.baseUrl)}catch(h){const p=this.assignAssetListError(e,de.ASSET_LIST_LOAD_ERROR,h,i);this.hls.trigger(B.ERROR,p);return}n&&s.protocol!=="data:"&&s.searchParams.set("_HLS_start_offset",""+n);const r=this.hls.config,o=r.loader,l=new o(r),d={responseType:"json",url:s.href},c=r.interstitialAssetListLoadPolicy.default,u={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(h,p,g,v)=>{const y=h.data,b=y?.ASSETS;if(!Array.isArray(b)){const E=this.assignAssetListError(e,de.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),g.url,p,v);this.hls.trigger(B.ERROR,E);return}e.assetListResponse=y,this.hls.trigger(B.ASSET_LIST_LOADED,{event:e,assetListResponse:y,networkDetails:v})},onError:(h,p,g,v)=>{const y=this.assignAssetListError(e,de.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${h.code} ${h.text} (${p.url})`),p.url,v,g);this.hls.trigger(B.ERROR,y)},onTimeout:(h,p,g)=>{const v=this.assignAssetListError(e,de.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${p.url})`),p.url,h,g);this.hls.trigger(B.ERROR,v)}};return l.load(d,u,f),this.hls.trigger(B.ASSET_LIST_LOADING,{event:e}),l}assignAssetListError(e,n,i,s,r,o){return e.error=i,{type:Ge.NETWORK_ERROR,details:n,fatal:!1,interstitial:e,url:s,error:i,networkDetails:o,stats:r}}};a(nL,"AssetListLoader");let YS=nL;function kP(t){t?.play().catch(()=>{})}a(kP,"playWithCatch");const iL=class iL extends ms{constructor(e,n){super("interstitials",e.logger),this.HlsPlayerClass=void 0,this.hls=void 0,this.assetListLoader=void 0,this.mediaSelection=null,this.altSelection=null,this.media=null,this.detachedData=null,this.requiredTracks=null,this.manager=null,this.playerQueue=[],this.bufferedPos=-1,this.timelinePos=-1,this.schedule=void 0,this.playingItem=null,this.bufferingItem=null,this.waitingItem=null,this.endedItem=null,this.playingAsset=null,this.endedAsset=null,this.bufferingAsset=null,this.shouldPlay=!1,this.onPlay=()=>{this.shouldPlay=!0},this.onPause=()=>{this.shouldPlay=!1},this.onSeeking=()=>{const i=this.currentTime;if(i===void 0||this.playbackDisabled)return;const s=i-this.timelinePos;if(Math.abs(s)<1/7056e5)return;const o=s<=-.01;this.timelinePos=i,this.bufferedPos=i;const l=this.playingItem;if(!l){this.checkBuffer();return}if(o&&this.schedule.resetErrorsInRange(i,i-s)&&this.updateSchedule(),this.checkBuffer(),o&&i<l.start||i>=l.end){var d;const h=this.schedule.findItemIndexAtTime(this.timelinePos);if(!this.isInterstitial(l)&&(d=this.media)!=null&&d.paused&&(this.shouldPlay=!1),!o){const p=this.findItemIndex(l);if(h>p){const g=this.schedule.findJumpRestrictedIndex(p+1,h);if(g>p){this.setSchedulePosition(g);return}}}this.setSchedulePosition(h);return}const c=this.playingAsset;if(!c){if(this.playingLastItem&&this.isInterstitial(l)){const h=l.event.assetList[0];h&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(i,h))}return}const u=c.timelineStart,f=c.duration||0;(o&&i<u||i>=u+f)&&this.setScheduleToAssetAtTime(i,c)},this.onTimeupdate=()=>{const i=this.currentTime;if(i===void 0||this.playbackDisabled)return;if(i>this.timelinePos)this.timelinePos=i,i>this.bufferedPos&&this.checkBuffer();else return;const s=this.playingItem;if(!s||this.playingLastItem)return;if(i>=s.end){this.timelinePos=s.end;const l=this.findItemIndex(s);this.setSchedulePosition(l+1)}const r=this.playingAsset;if(!r)return;const o=r.timelineStart+(r.duration||0);i>=o&&this.setScheduleToAssetAtTime(i,r)},this.onScheduleUpdate=(i,s)=>{const r=this.schedule,o=this.playingItem,l=r.events||[],d=r.items||[],c=r.durations,u=i.map(g=>g.identifier),f=!!(l.length||u.length);(f||s)&&this.log(`INTERSTITIALS_UPDATED (${l.length}): ${l}
3525Schedule: ${d.map(g=>Vo(g))} pos: ${this.timelinePos}`),u.length&&this.log(`Removed events ${u}`),this.playerQueue.forEach(g=>{if(g.interstitial.appendInPlace){const v=g.assetItem.timelineStart,y=g.timelineOffset-v;if(y)try{g.timelineOffset=v}catch(b){Math.abs(y)>_d&&this.warn(`${b} ("${g.assetId}" ${g.timelineOffset}->${v})`)}}});let h=null;if(o){const g=this.updateItem(o,this.timelinePos);this.itemsMatch(o,g)&&(this.playingItem=g,this.waitingItem=this.endedItem=null,h=a(()=>this.trimInPlace(g,o),"trimInPlaceForPlayout"))}else this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const p=this.bufferingItem;if(p){const g=this.updateItem(p,this.bufferedPos);this.itemsMatch(p,g)?(this.bufferingItem=g,h||(h=a(()=>this.trimInPlace(g,p),"trimInPlaceForPlayout"))):p.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(p.event,null))}if(i.forEach(g=>{g.assetList.forEach(v=>{this.clearAssetPlayer(v.identifier,null)})}),f||s){if(this.hls.trigger(B.INTERSTITIALS_UPDATED,{events:l.slice(0),schedule:d.slice(0),durations:c,removedIds:u}),this.isInterstitial(o)&&u.includes(o.event.identifier)){this.warn(`Interstitial "${o.event.identifier}" removed while playing`),this.primaryFallback(o.event);return}h&&h(),this.checkBuffer()}},this.hls=e,this.HlsPlayerClass=n,this.assetListLoader=new YS(e),this.schedule=new jS(this.onScheduleUpdate,e.logger),this.registerListeners()}registerListeners(){const e=this.hls;e.on(B.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(B.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(B.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(B.MANIFEST_LOADING,this.onManifestLoading,this),e.on(B.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(B.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(B.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(B.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(B.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(B.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(B.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(B.BUFFER_APPENDED,this.onBufferAppended,this),e.on(B.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(B.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(B.MEDIA_ENDED,this.onMediaEnded,this),e.on(B.ERROR,this.onError,this),e.on(B.DESTROYING,this.onDestroying,this)}unregisterListeners(){const e=this.hls;e&&(e.off(B.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(B.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(B.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(B.MANIFEST_LOADING,this.onManifestLoading,this),e.off(B.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(B.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(B.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(B.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(B.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(B.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(B.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(B.BUFFER_CODECS,this.onBufferCodecs,this),e.off(B.BUFFER_APPENDED,this.onBufferAppended,this),e.off(B.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(B.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(B.MEDIA_ENDED,this.onMediaEnded,this),e.off(B.ERROR,this.onError,this),e.off(B.DESTROYING,this.onDestroying,this))}startLoad(){this.resumeBuffering()}stopLoad(){this.pauseBuffering()}resumeBuffering(){var e;(e=this.getBufferingPlayer())==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.getBufferingPlayer())==null||e.pauseBuffering()}destroy(){this.unregisterListeners(),this.stopLoad(),this.assetListLoader&&this.assetListLoader.destroy(),this.emptyPlayerQueue(),this.clearScheduleState(),this.schedule&&this.schedule.destroy(),this.media=this.detachedData=this.mediaSelection=this.requiredTracks=this.altSelection=this.manager=null,this.hls=this.HlsPlayerClass=this.schedule=this.log=null,this.assetListLoader=null,this.onPlay=this.onPause=this.onSeeking=this.onTimeupdate=null,this.onScheduleUpdate=null}onDestroying(){const e=this.primaryMedia||this.media;e&&this.removeMediaListeners(e)}removeMediaListeners(e){zs(e,"play",this.onPlay),zs(e,"pause",this.onPause),zs(e,"seeking",this.onSeeking),zs(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,n){const i=this.media=n.media;Ls(i,"seeking",this.onSeeking),Ls(i,"timeupdate",this.onTimeupdate),Ls(i,"play",this.onPlay),Ls(i,"pause",this.onPause)}onMediaAttached(e,n){const i=this.effectivePlayingItem,s=this.detachedData;if(this.detachedData=null,i===null)this.checkStart();else if(!s){this.clearScheduleState();const r=this.findItemIndex(i);this.setSchedulePosition(r)}}clearScheduleState(){this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(e,n){const i=!!n.transferMedia,s=this.media;if(this.media=null,!i&&(s&&this.removeMediaListeners(s),this.detachedData)){const r=this.getBufferingPlayer();r&&(this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,r.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.manager){if(!this.hls)return null;const e=this,n=a(()=>e.bufferingItem||e.waitingItem,"effectiveBufferingItem"),i=a(f=>f&&e.getAssetPlayer(f.identifier),"getAssetPlayer"),s=a((f,h,p,g,v)=>{if(f){let y=f[h].start;const b=f.event;if(b){if(h==="playout"||b.timelineOccupancy!==Pv.Point){const E=i(p);E?.interstitial===b&&(y+=E.assetItem.startOffset+E[v])}}else{const E=g==="bufferedPos"?o():e[g];y+=E-f.start}return y}return 0},"getMappedTime"),r=a((f,h)=>{if(f!==0&&h!=="primary"&&e.schedule.length){var p;const g=e.schedule.findItemIndexAtTime(f),v=(p=e.schedule.items)==null?void 0:p[g];if(v){const y=v[h].start-v.start;return f+y}}return f},"findMappedTime"),o=a(()=>{const f=e.bufferedPos;return f===Number.MAX_VALUE?l("primary"):Math.max(f,0)},"getBufferedEnd"),l=a(f=>{var h;return(h=e.primaryDetails)!=null&&h.live?e.primaryDetails.edge:e.schedule.durations[f]},"getMappedDuration"),d=a((f,h)=>{var p,g;const v=e.effectivePlayingItem;if(v!=null&&(p=v.event)!=null&&p.restrictions.skip)return;e.log(`seek to ${f} "${h}"`);const y=e.effectivePlayingItem,b=e.schedule.findItemIndexAtTime(f,h),E=(g=e.schedule.items)==null?void 0:g[b],T=e.getBufferingPlayer(),I=T?.interstitial,M=I?.appendInPlace,H=y&&e.itemsMatch(y,E);if(y&&(M||H)){const $=i(e.playingAsset),F=$?.media||e.primaryMedia;if(F){const D=h==="primary"?F.currentTime:s(y,h,e.playingAsset,"timelinePos","currentTime"),L=f-D,m=(M?D:F.currentTime)+L;if(m>=0&&(!$||M||m<=$.duration)){F.currentTime=m;return}}}if(E){let $=f;if(h!=="primary"){const D=E[h].start,L=f-D;$=E.start+L}const F=!e.isInterstitial(E);if((!e.isInterstitial(y)||y.event.appendInPlace)&&(F||E.event.appendInPlace)){const D=e.media||(M?T?.media:null);D&&(D.currentTime=$)}else if(y){const D=e.findItemIndex(y);if(b>D){const m=e.schedule.findJumpRestrictedIndex(D+1,b);if(m>D){e.setSchedulePosition(m);return}}let L=0;if(F)e.timelinePos=$,e.checkBuffer();else{var N;const m=E==null||(N=E.event)==null?void 0:N.assetList;if(m){const S=f-(E[h]||E).start;for(let _=m.length;_--;){const A=m[_];if(A.duration&&S>=A.startOffset&&S<A.startOffset+A.duration){L=_;break}}}}e.setSchedulePosition(b,L)}}},"seekTo"),c=a(()=>{const f=e.effectivePlayingItem;if(e.isInterstitial(f))return f;const h=n();return e.isInterstitial(h)?h:null},"getActiveInterstitial"),u={get currentTime(){const f=c(),h=e.effectivePlayingItem;return h&&h===f?s(h,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-h.playout.start:0},set currentTime(f){const h=c(),p=e.effectivePlayingItem;p&&p===h&&d(f+p.playout.start,"playout")},get duration(){const f=c();return f?f.playout.end-f.playout.start:0},get assetPlayers(){var f;const h=(f=c())==null?void 0:f.event.assetList;return h?h.map(p=>e.getAssetPlayer(p.identifier)):[]},get playingIndex(){var f;const h=(f=c())==null?void 0:f.event;return h&&e.effectivePlayingAsset?h.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return c()}};this.manager={get events(){var f,h;return((f=e.schedule)==null||(h=f.events)==null?void 0:h.slice(0))||[]},get schedule(){var f,h;return((f=e.schedule)==null||(h=f.items)==null?void 0:h.slice(0))||[]},get interstitialPlayer(){return c()?u:null},get playerQueue(){return e.playerQueue.slice(0)},get bufferingAsset(){return e.bufferingAsset},get bufferingItem(){return n()},get bufferingIndex(){const f=n();return e.findItemIndex(f)},get playingAsset(){return e.effectivePlayingAsset},get playingItem(){return e.effectivePlayingItem},get playingIndex(){const f=e.effectivePlayingItem;return e.findItemIndex(f)},primary:{get bufferedEnd(){return o()},get currentTime(){const f=e.timelinePos;return f>0?f:0},set currentTime(f){d(f,"primary")},get duration(){return l("primary")},get seekableStart(){var f;return((f=e.primaryDetails)==null?void 0:f.fragmentStart)||0}},integrated:{get bufferedEnd(){return s(n(),"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return s(e.effectivePlayingItem,"integrated",e.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(f){d(f,"integrated")},get duration(){return l("integrated")},get seekableStart(){var f;return r(((f=e.primaryDetails)==null?void 0:f.fragmentStart)||0,"integrated")}},skip:()=>{const f=e.effectivePlayingItem,h=f?.event;if(h&&!h.restrictions.skip){const p=e.findItemIndex(f);if(h.appendInPlace){const g=f.playout.start+f.event.duration;d(g+.001,"playout")}else e.advanceAfterAssetEnded(h,p,1/0)}}}}return this.manager}get effectivePlayingItem(){return this.waitingItem||this.playingItem||this.endedItem}get effectivePlayingAsset(){return this.playingAsset||this.endedAsset}get playingLastItem(){var e;const n=this.playingItem,i=(e=this.schedule)==null?void 0:e.items;return!this.playbackStarted||!n||!i?!1:this.findItemIndex(n)===i.length-1}get playbackStarted(){return this.effectivePlayingItem!==null}get currentTime(){var e,n,i;if(this.mediaSelection===null)return;const s=this.waitingItem||this.playingItem;if(this.isInterstitial(s)&&!s.event.appendInPlace)return;let r=this.media;!r&&(e=this.bufferingItem)!=null&&(n=e.event)!=null&&n.appendInPlace&&(r=this.primaryMedia);const o=(i=r)==null?void 0:i.currentTime;if(!(o===void 0||!Pe(o)))return o}get primaryMedia(){var e;return this.media||((e=this.detachedData)==null?void 0:e.media)||null}isInterstitial(e){return!!(e!=null&&e.event)}retreiveMediaSource(e,n){const i=this.getAssetPlayer(e);i&&this.transferMediaFromPlayer(i,n)}transferMediaFromPlayer(e,n){const i=e.interstitial.appendInPlace,s=e.media;if(i&&s===this.primaryMedia){if(this.bufferingAsset=null,(!n||this.isInterstitial(n)&&!n.event.appendInPlace)&&n&&s){this.detachedData={media:s};return}const r=e.transferMedia();this.log(`transfer MediaSource from ${e} ${hn(r)}`),this.detachedData=r}else n&&s&&(this.shouldPlay||(this.shouldPlay=!s.paused))}transferMediaTo(e,n){var i,s;if(e.media===n)return;let r=null;const o=this.hls,l=e!==o,d=l&&e.interstitial.appendInPlace,c=(i=this.detachedData)==null?void 0:i.mediaSource;let u;if(o.media)d&&(r=o.transferMedia(),this.detachedData=r),u="Primary";else if(c){const p=this.getBufferingPlayer();p?(r=p.transferMedia(),u=`${p}`):u="detached MediaSource"}else u="detached media";if(!r){if(c)r=this.detachedData,this.log(`using detachedData: MediaSource ${hn(r)}`);else if(!this.detachedData||o.media===n){const p=this.playerQueue;p.length>1&&p.forEach(g=>{if(l&&g.interstitial.appendInPlace!==d){const v=g.interstitial;this.clearInterstitial(g.interstitial,null),v.appendInPlace=!1,v.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${v}`)}}),this.hls.detachMedia(),this.detachedData={media:n}}}const f=r&&"mediaSource"in r&&((s=r.mediaSource)==null?void 0:s.readyState)!=="closed",h=f&&r?r:n;if(this.log(`${f?"transfering MediaSource":"attaching media"} to ${l?e:"Primary"} from ${u}`),h===r){const p=l&&e.assetId===this.schedule.assetIdAtEnd;h.overrides={duration:this.schedule.duration,endOfStream:!l||p,cueRemoval:!l}}e.attachMedia(h)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){const e=this.schedule,n=e.events;if(!n||this.playbackDisabled||!this.media)return;this.bufferedPos===-1&&(this.bufferedPos=0);const i=this.timelinePos,s=this.effectivePlayingItem;if(i===-1){const r=this.hls.startPosition;if(this.timelinePos=r,n.length&&n[0].cue.pre){const o=e.findEventIndex(n[0].identifier);this.setSchedulePosition(o)}else if(r>=0||!this.primaryLive){const o=this.timelinePos=r>0?r:0,l=e.findItemIndexAtTime(o);this.setSchedulePosition(l)}}else if(s&&!this.playingItem){const r=e.findItemIndex(s);this.setSchedulePosition(r)}}advanceAfterAssetEnded(e,n,i){const s=xE(e,i);if(!e.isAssetPastPlayoutLimit(s))this.setSchedulePosition(n,s);else{const r=this.schedule.items;if(r){const o=n+1,l=r.length;if(o>=l){this.setSchedulePosition(-1);return}const d=e.resumeTime;this.timelinePos<d&&(this.timelinePos=d,this.checkBuffer()),this.setSchedulePosition(o)}}}setScheduleToAssetAtTime(e,n){const i=this.schedule,s=n.parentIdentifier,r=i.getEvent(s);if(r){const o=i.findEventIndex(s),l=i.findAssetIndex(r,e);this.advanceAfterAssetEnded(r,o,l-1)}}setSchedulePosition(e,n){const i=this.schedule.items;if(!i||this.playbackDisabled)return;this.log(`setSchedulePosition ${e}, ${n}`);const s=e>=0?i[e]:null,r=this.playingItem,o=this.playingLastItem;if(this.isInterstitial(r)){var l;const c=r.event,u=this.playingAsset,f=u?.identifier,h=f?this.getAssetPlayer(f):null;if(h&&f&&(!this.eventItemsMatch(r,s)||n!==void 0&&f!==((l=c.assetList)==null?void 0:l[n].identifier))){var d;const p=c.findAssetIndex(u);if(this.log(`INTERSTITIAL_ASSET_ENDED ${p+1}/${c.assetList.length} ${Qc(u)}`),this.endedAsset=u,this.playingAsset=null,this.hls.trigger(B.INTERSTITIAL_ASSET_ENDED,{asset:u,assetListIndex:p,event:c,schedule:i.slice(0),scheduleIndex:e,player:h}),r!==this.playingItem){this.itemsMatch(r,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(c,this.findItemIndex(this.playingItem),p);return}this.retreiveMediaSource(f,s),h.media&&!((d=this.detachedData)!=null&&d.mediaSource)&&h.detachMedia()}if(!this.eventItemsMatch(r,s)&&(this.endedItem=r,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${c} ${Vo(r)}`),c.hasPlayed=!0,this.hls.trigger(B.INTERSTITIAL_ENDED,{event:c,schedule:i.slice(0),scheduleIndex:e}),c.cue.once)){this.updateSchedule();const p=this.schedule.items;if(s&&p){const g=this.findItemIndex(s);this.advanceSchedule(g,p,n,r,o)}return}}this.advanceSchedule(e,i,n,r,o)}advanceSchedule(e,n,i,s,r){const o=e>=0?n[e]:null,l=this.primaryMedia,d=this.playerQueue;if(d.length&&d.forEach(c=>{const u=c.interstitial,f=this.schedule.findEventIndex(u.identifier);(f<e||f>e+1)&&this.clearInterstitial(u,o)}),this.isInterstitial(o)){this.timelinePos=Math.min(Math.max(this.timelinePos,o.start),o.end);const c=o.event;if(i===void 0){i=this.schedule.findAssetIndex(c,this.timelinePos);const p=xE(c,i-1);if(c.isAssetPastPlayoutLimit(p)){this.advanceAfterAssetEnded(c,e,i);return}i=p}const u=this.waitingItem;this.assetsBuffered(o,l)||this.setBufferingItem(o);let f=this.preloadAssets(c,i);if(this.eventItemsMatch(o,u||s)||(this.waitingItem=o,this.log(`INTERSTITIAL_STARTED ${Vo(o)} ${c.appendInPlace?"append in place":""}`),this.hls.trigger(B.INTERSTITIAL_STARTED,{event:c,schedule:n.slice(0),scheduleIndex:e})),!c.assetListLoaded){this.log(`Waiting for ASSET-LIST to complete loading ${c}`);return}if(c.assetListLoader&&(c.assetListLoader.destroy(),c.assetListLoader=void 0),!l){this.log(`Waiting for attachMedia to start Interstitial ${c}`);return}this.waitingItem=this.endedItem=null,this.playingItem=o;const h=c.assetList[i];if(!h){const p=n[e+1],g=this.media;p&&g&&!this.isInterstitial(p)&&g.currentTime<p.start&&(g.currentTime=this.timelinePos=p.start),this.advanceAfterAssetEnded(c,e,i||0);return}if(f||(f=this.getAssetPlayer(h.identifier)),f===null||f.destroyed){const p=c.assetList.length;this.warn(`asset ${i+1}/${p} player destroyed ${c}`),f=this.createAssetPlayer(c,h,i)}if(!this.eventItemsMatch(o,this.bufferingItem)&&c.appendInPlace&&this.isAssetBuffered(h))return;this.startAssetPlayer(f,i,n,e,l),this.shouldPlay&&kP(f.media)}else o!==null?(this.resumePrimary(o,e,s),this.shouldPlay&&kP(this.hls.media)):r&&this.isInterstitial(s)&&(this.endedItem=null,this.playingItem=s,s.event.appendInPlace||this.attachPrimary(this.schedule.durations.primary,null))}get playbackDisabled(){return this.hls.config.enableInterstitialPlayback===!1}get primaryDetails(){var e,n;return(e=this.mediaSelection)==null||(n=e.main)==null?void 0:n.details}get primaryLive(){var e;return!!((e=this.primaryDetails)!=null&&e.live)}resumePrimary(e,n,i){var s;if(this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(e),this.log(`resuming ${Vo(e)}`),!((s=this.detachedData)!=null&&s.mediaSource)){let o=this.timelinePos;(o<e.start||o>=e.end)&&(o=this.getPrimaryResumption(e,n),this.timelinePos=o),this.attachPrimary(o,e)}if(!i)return;const r=this.schedule.items;r&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${Vo(e)}`),this.hls.trigger(B.INTERSTITIALS_PRIMARY_RESUMED,{schedule:r.slice(0),scheduleIndex:n}),this.checkBuffer())}getPrimaryResumption(e,n){const i=e.start;if(this.primaryLive){const s=this.primaryDetails;if(n===0)return this.hls.startPosition;if(s&&(i<s.fragmentStart||i>s.edge))return this.hls.liveSyncPosition||-1}return i}isAssetBuffered(e){const n=this.getAssetPlayer(e.identifier);return n!=null&&n.hls?n.hls.bufferedToEnd:gt.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)}attachPrimary(e,n,i){n?this.setBufferingItem(n):this.bufferingItem=this.playingItem,this.bufferingAsset=null;const s=this.primaryMedia;if(!s)return;const r=this.hls;r.media?this.checkBuffer():(this.transferMediaTo(r,s),i&&this.startLoadingPrimaryAt(e,i)),i||(this.timelinePos=e,this.startLoadingPrimaryAt(e,i))}startLoadingPrimaryAt(e,n){var i;const s=this.hls;!s.loadingEnabled||!s.media||Math.abs((((i=s.mainForwardBufferInfo)==null?void 0:i.start)||s.media.currentTime)-e)>.5?s.startLoad(e,n):s.bufferingEnabled||s.resumeBuffering()}onManifestLoading(){this.stopLoad(),this.schedule.reset(),this.emptyPlayerQueue(),this.clearScheduleState(),this.shouldPlay=!1,this.bufferedPos=this.timelinePos=-1,this.mediaSelection=this.altSelection=this.manager=this.requiredTracks=null,this.hls.off(B.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(B.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(e,n){if(n.level===-1)return;const i=this.hls.levels[n.level],s=nn(nn({},this.mediaSelection||this.altSelection),{},{main:i});this.mediaSelection=s,this.schedule.parseInterstitialDateRanges(s,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart()}onAudioTrackUpdated(e,n){const i=this.hls.audioTracks[n.id],s=this.mediaSelection;if(!s){this.altSelection=nn(nn({},this.altSelection),{},{audio:i});return}const r=nn(nn({},s),{},{audio:i});this.mediaSelection=r}onSubtitleTrackUpdated(e,n){const i=this.hls.subtitleTracks[n.id],s=this.mediaSelection;if(!s){this.altSelection=nn(nn({},this.altSelection),{},{subtitles:i});return}const r=nn(nn({},s),{},{subtitles:i});this.mediaSelection=r}onAudioTrackSwitching(e,n){const i=WC(n);this.playerQueue.forEach(s=>s.hls.setAudioOption(n)||s.hls.setAudioOption(i))}onSubtitleTrackSwitch(e,n){const i=WC(n);this.playerQueue.forEach(s=>s.hls.setSubtitleOption(n)||n.id!==-1&&s.hls.setSubtitleOption(i))}onBufferCodecs(e,n){const i=n.tracks;i&&(this.requiredTracks=i)}onBufferAppended(e,n){this.checkBuffer()}onBufferFlushed(e,n){const i=this.playingItem;if(i&&!this.itemsMatch(i,this.bufferingItem)&&!this.isInterstitial(i)){const s=this.timelinePos;this.bufferedPos=s,this.checkBuffer()}}onBufferedToEnd(e){const n=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&n){for(let s=0;s<n.length;s++){const r=n[s];if(r.cue.post){var i;const o=this.schedule.findEventIndex(r.identifier),l=(i=this.schedule.items)==null?void 0:i[o];this.isInterstitial(l)&&this.eventItemsMatch(l,this.bufferingItem)&&this.bufferedToItem(l,0);break}}this.bufferedPos=Number.MAX_VALUE}}onMediaEnded(e){const n=this.playingItem;if(!this.playingLastItem&&n){const i=this.findItemIndex(n);this.setSchedulePosition(i+1)}else this.shouldPlay=!1}updateItem(e,n){const i=this.schedule.items;if(e&&i){const s=this.findItemIndex(e,n);return i[s]||null}return null}trimInPlace(e,n){if(this.isInterstitial(e)&&e.event.appendInPlace&&n.end-e.end>.25){e.event.assetList.forEach((r,o)=>{e.event.isAssetPastPlayoutLimit(o)&&this.clearAssetPlayer(r.identifier,null)});const i=e.end+.25,s=gt.bufferInfo(this.primaryMedia,i,0);(s.end>i||(s.nextStart||0)>i)&&(this.attachPrimary(i,null),this.flushFrontBuffer(i))}}itemsMatch(e,n){return!!n&&(e===n||e.event&&n.event&&this.eventItemsMatch(e,n)||!e.event&&!n.event&&this.findItemIndex(e)===this.findItemIndex(n))}eventItemsMatch(e,n){var i;return!!n&&(e===n||e.event.identifier===((i=n.event)==null?void 0:i.identifier))}findItemIndex(e,n){return e?this.schedule.findItemIndex(e,n):-1}updateSchedule(){const e=this.mediaSelection;e&&this.schedule.updateSchedule(e,[])}checkBuffer(e){const n=this.schedule.items;if(!n)return;const i=gt.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=i.len<1),this.updateBufferedPos(i.end,n,e)}updateBufferedPos(e,n,i){const s=this.schedule,r=this.bufferingItem;if(this.bufferedPos>e)return;if(n.length===1&&this.itemsMatch(n[0],r)){this.bufferedPos=e;return}const o=this.playingItem,l=this.findItemIndex(o);let d=s.findItemIndexAtTime(e);if(this.bufferedPos<e){var c,u;const f=this.findItemIndex(r),h=Math.min(f+1,n.length-1),p=n[h];if((d===-1&&r&&e>=r.end||(c=p.event)!=null&&c.appendInPlace&&e+.01>=p.start)&&(d=h),h-l>1&&(r==null||(u=r.event)==null?void 0:u.appendInPlace)===!1)return;if(this.bufferedPos=e,d>f&&d>l)this.bufferedToItem(p);else{const g=this.primaryDetails;this.primaryLive&&g&&e>g.edge-g.targetduration&&p.start<g.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(p)&&this.preloadAssets(p.event,0)}}else i&&o&&!this.itemsMatch(o,r)&&(d===l?this.bufferedToItem(o):d===l+1&&this.bufferedToItem(n[d]))}assetsBuffered(e,n){return e.event.assetList.length===0?!1:!e.event.assetList.some(s=>{const r=this.getAssetPlayer(s.identifier);return!(r!=null&&r.bufferedInPlaceToEnd(n))})}setBufferingItem(e){const n=this.bufferingItem,i=this.schedule;if(this.itemsMatch(e,n))this.bufferingItem!==e&&(this.bufferingItem=e);else{const{items:s,events:r}=i;if(!s||!r)return n;const o=this.isInterstitial(e),l=this.getBufferingPlayer();this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos));const d=l?l.remaining:n?n.end-this.timelinePos:0;this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${Vo(e)}`+(n?` (${d.toFixed(2)} remaining)`:"")),this.playbackDisabled||(o?e.event.assetList.forEach(c=>{const u=this.getAssetPlayer(c.identifier);u&&u.resumeBuffering()}):(this.hls.resumeBuffering(),this.playerQueue.forEach(c=>c.pauseBuffering()))),this.hls.trigger(B.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:r.slice(0),schedule:s.slice(0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)})}return n}bufferedToItem(e,n=0){const i=this.setBufferingItem(e);if(!this.playbackDisabled){if(this.isInterstitial(e))this.bufferedToEvent(e,n);else if(i!==null){this.bufferingAsset=null;const s=this.detachedData;s?s.mediaSource?this.attachPrimary(e.start,e,!0):this.preloadPrimary(e):this.preloadPrimary(e)}}}preloadPrimary(e){const n=this.findItemIndex(e),i=this.getPrimaryResumption(e,n);this.startLoadingPrimaryAt(i)}bufferedToEvent(e,n){const i=e.event,s=i.assetList.length===0&&!i.assetListLoader,r=i.cue.once;if(s||!r){const o=this.preloadAssets(i,n);if(o!=null&&o.interstitial.appendInPlace){const l=i.assetList[n],d=this.primaryMedia;l&&d&&this.bufferAssetPlayer(o,d)}}}preloadAssets(e,n){const i=e.assetUrl,s=e.assetList.length,r=s===0&&!e.assetListLoader,o=e.cue.once;if(r){const d=e.timelineStart;if(e.appendInPlace){var l;const h=this.playingItem;!this.isInterstitial(h)&&(h==null||(l=h.nextEvent)==null?void 0:l.identifier)===e.identifier&&this.flushFrontBuffer(d+.25)}let c,u=0;if(!this.playingItem&&this.primaryLive&&(u=this.hls.startPosition,u===-1&&(u=this.hls.liveSyncPosition||0)),u&&!(e.cue.pre||e.cue.post)){const h=u-d;h>0&&(c=Math.round(h*1e3)/1e3)}if(this.log(`Load interstitial asset ${n+1}/${i?1:s} ${e}${c?` live-start: ${u} start-offset: ${c}`:""}`),i)return this.createAsset(e,0,0,d,e.duration,i);const f=this.assetListLoader.loadAssetList(e,c);f&&(e.assetListLoader=f)}else if(!o&&s){for(let d=n;d<s;d++){const c=e.assetList[d],u=this.getAssetPlayerQueueIndex(c.identifier);(u===-1||this.playerQueue[u].destroyed)&&!c.error&&this.createAssetPlayer(e,c,d)}return this.getAssetPlayer(e.assetList[n].identifier)}return null}flushFrontBuffer(e){const n=this.requiredTracks;if(!n)return;this.log(`Removing front buffer starting at ${e}`),Object.keys(n).forEach(s=>{this.hls.trigger(B.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:s})})}getAssetPlayerQueueIndex(e){const n=this.playerQueue;for(let i=0;i<n.length;i++)if(e===n[i].assetId)return i;return-1}getAssetPlayer(e){const n=this.getAssetPlayerQueueIndex(e);return this.playerQueue[n]||null}getBufferingPlayer(){const{playerQueue:e,primaryMedia:n}=this;if(n){for(let i=0;i<e.length;i++)if(e[i].media===n)return e[i]}return null}createAsset(e,n,i,s,r,o){const l={parentIdentifier:e.identifier,identifier:qme(e,o,n),duration:r,startOffset:i,timelineStart:s,uri:o};return this.createAssetPlayer(e,l,n)}createAssetPlayer(e,n,i){const s=this.hls,r=s.userConfig;let o=r.videoPreference;const l=s.loadLevelObj||s.levels[s.currentLevel];(o||l)&&(o=jt({},o),l.videoCodec&&(o.videoCodec=l.videoCodec),l.videoRange&&(o.allowedVideoRanges=[l.videoRange]));const d=s.audioTracks[s.audioTrack],c=s.subtitleTracks[s.subtitleTrack];let u=0;if(this.primaryLive||e.appendInPlace){const T=this.timelinePos-n.timelineStart;if(T>1){const I=n.duration;I&&T<I&&(u=T)}}const f=n.identifier,h=nn(nn({},r),{},{autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:s.sessionId,assetPlayerId:f,abrEwmaDefaultEstimate:s.bandwidthEstimate,interstitialsController:void 0,startPosition:u,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:o,audioPreference:d||r.audioPreference,subtitlePreference:c||r.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,n.timelineStart&&(h.timelineOffset=n.timelineStart));const p=h.cmcd;p!=null&&p.sessionId&&p.contentId&&(h.cmcd=jt({},p,{contentId:Lf(n.uri)})),this.getAssetPlayer(f)&&this.warn(`Duplicate date range identifier ${e} and asset ${f}`);const g=new qS(this.HlsPlayerClass,h,e,n);this.playerQueue.push(g),e.assetList[i]=n;const v=a(T=>{if(T.live){const H=new Error(`Interstitials MUST be VOD assets ${e}`),N={fatal:!0,type:Ge.OTHER_ERROR,details:de.INTERSTITIAL_ASSET_ITEM_ER
3525ROR,error:H};this.handleAssetItemError(N,e,this.schedule.findEventIndex(e.identifier),i,H.message);return}const I=T.edge-T.fragmentStart,M=n.duration;(M===null||I>M)&&(this.log(`Interstitial asset "${f}" duration change ${M} > ${I}`),n.duration=I,this.updateSchedule())},"updateAssetPlayerDetails");g.on(B.LEVEL_UPDATED,(T,{details:I})=>v(I)),g.on(B.LEVEL_PTS_UPDATED,(T,{details:I})=>v(I));const y=a((T,I)=>{const M=this.getAssetPlayer(f);if(M&&I.tracks){M.off(B.BUFFER_CODECS,y),M.tracks=I.tracks;const H=this.primaryMedia;this.bufferingAsset===M.assetItem&&H&&!M.media&&this.bufferAssetPlayer(M,H)}},"onBufferCodecs");g.on(B.BUFFER_CODECS,y);const b=a(()=>{var T;const I=this.getAssetPlayer(f);if(this.log(`buffered to end of asset ${I}`),!I)return;const M=this.schedule.findEventIndex(e.identifier),H=(T=this.schedule.items)==null?void 0:T[M];if(this.isInterstitial(H)){const $=e.findAssetIndex(n),F=xE(e,$);if(!e.isAssetPastPlayoutLimit(F))this.bufferedToItem(H,F);else{var N;const D=(N=this.schedule.items)==null?void 0:N[M+1];D&&this.bufferedToItem(D)}}},"bufferedToEnd");g.on(B.BUFFERED_TO_END,b);const E=a(T=>()=>{if(!this.getAssetPlayer(f))return;this.shouldPlay=!0;const M=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,M,T)},"endedWithAssetIndex");return g.once(B.MEDIA_ENDED,E(i)),g.once(B.PLAYOUT_LIMIT_REACHED,E(1/0)),g.on(B.ERROR,(T,I)=>{const M=this.getAssetPlayer(f);if(I.details===de.BUFFER_STALLED_ERROR){if(M!=null&&M.media){const H=M.currentTime,N=M.duration-H;H&&e.appendInPlace&&N/M.media.playbackRate<.5?(this.log(`Advancing buffer past end of asset ${f} ${e} at ${M.media.currentTime}`),b()):(this.warn(`Stalled at ${H} of ${H+N} in asset ${f} ${e}`),this.onTimeupdate(),this.checkBuffer(!0))}return}this.handleAssetItemError(I,e,this.schedule.findEventIndex(e.identifier),i,`Asset player error ${I.error} ${e}`)}),g.on(B.DESTROYING,()=>{if(!this.getAssetPlayer(f))return;const I=new Error(`Asset player destroyed unexpectedly ${f}`),M={fatal:!0,type:Ge.OTHER_ERROR,details:de.INTERSTITIAL_ASSET_ITEM_ERROR,error:I};this.handleAssetItemError(M,e,this.schedule.findEventIndex(e.identifier),i,I.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${Qc(n)}`),this.hls.trigger(B.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:n,assetListIndex:i,event:e,player:g}),g}clearInterstitial(e,n){e.assetList.forEach(i=>{this.clearAssetPlayer(i.identifier,n)}),e.reset()}resetAssetPlayer(e){const n=this.getAssetPlayerQueueIndex(e);if(n!==-1){this.log(`reset asset player "${e}" after error`);const i=this.playerQueue[n];this.transferMediaFromPlayer(i,null),i.resetDetails()}}clearAssetPlayer(e,n){const i=this.getAssetPlayerQueueIndex(e);if(i!==-1){this.log(`clear asset player "${e}" toSegment: ${n&&Vo(n)}`);const s=this.playerQueue[i];this.transferMediaFromPlayer(s,n),this.playerQueue.splice(i,1),s.destroy()}}emptyPlayerQueue(){let e;for(;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}startAssetPlayer(e,n,i,s,r){const{interstitial:o,assetItem:l,assetId:d}=e,c=o.assetList.length,u=this.playingAsset;this.endedAsset=null,this.playingAsset=l,(!u||u.identifier!==d)&&(u&&(this.clearAssetPlayer(u.identifier,i[s]),delete u.error),this.log(`INTERSTITIAL_ASSET_STARTED ${n+1}/${c} ${Qc(l)}`),this.hls.trigger(B.INTERSTITIAL_ASSET_STARTED,{asset:l,assetListIndex:n,event:o,schedule:i.slice(0),scheduleIndex:s,player:e})),this.bufferAssetPlayer(e,r)}bufferAssetPlayer(e,n){var i,s;const{interstitial:r,assetItem:o}=e,l=this.schedule.findEventIndex(r.identifier),d=(i=this.schedule.items)==null?void 0:i[l];if(!d)return;this.setBufferingItem(d),this.bufferingAsset=o;const c=this.getBufferingPlayer();if(c===e)return;const u=r.appendInPlace;if(u&&c?.interstitial.appendInPlace===!1)return;const f=c?.tracks||((s=this.detachedData)==null?void 0:s.tracks)||this.requiredTracks;if(u&&o!==this.playingAsset){if(!e.tracks)return;if(f&&!h3(f,e.tracks)){const h=new Error(`Asset ${Qc(o)} SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(f)}')`),p={fatal:!0,type:Ge.OTHER_ERROR,details:de.INTERSTITIAL_ASSET_ITEM_ER
3525ROR,error:h},g=r.findAssetIndex(o);this.handleAssetItemError(p,r,l,g,h.message);return}}this.transferMediaTo(e,n)}handleAssetItemError(e,n,i,s,r){if(e.details===de.BUFFER_STALLED_ERROR)return;const o=n.assetList[s];this.warn(`INTERSTITIAL_ASSET_ERROR ${o&&Qc(o)} ${e.error}`);const l=o?.identifier,d=this.getAssetPlayerQueueIndex(l),c=this.playerQueue[d]||null,u=this.schedule.items,f=jt({},e,{fatal:!1,errorAction:Ph(!0),asset:o,assetListIndex:s,event:n,schedule:u,scheduleIndex:i,player:c});if(this.hls.trigger(B.INTERSTITIAL_ASSET_ERROR,f),!e.fatal)return;const h=this.playingAsset,p=new Error(r);if(o&&(this.clearAssetPlayer(l,null),o.error=p),!n.assetList.some(g=>!g.error))n.error=p;else{for(let g=s;g<n.assetList.length;g++)this.resetAssetPlayer(n.assetList[g].identifier);this.updateSchedule()}n.error?this.primaryFallback(n):h&&h.identifier===l&&this.advanceAfterAssetEnded(n,i,s)}primaryFallback(e){const n=e.timelineStart,i=this.effectivePlayingItem;if(this.updateSchedule(),i){this.log(`Fallback to primary from event "${e.identifier}" start: ${n} pos: ${this.timelinePos} playing: ${i?Vo(i):"<none>"} error: ${e.error}`);let s=this.timelinePos;s===-1&&(s=this.hls.startPosition);const r=this.updateItem(i,s);this.itemsMatch(i,r)&&this.clearInterstitial(e,null),e.appendInPlace&&(this.attachPrimary(n,null),this.flushFrontBuffer(n));const o=this.schedule.findItemIndexAtTime(s);this.setSchedulePosition(o)}else this.checkStart()}onAssetListLoaded(e,n){var i;const s=n.event,r=s.identifier,o=n.assetListResponse.ASSETS;if(!this.schedule.hasEvent(r))return;const l=s.timelineStart,d=s.duration;let c=0;o.forEach((g,v)=>{const y=parseFloat(g.DURATION);this.createAsset(s,v,c,l+c,y,g.URI),c+=y}),s.duration=c,this.log(`Loaded asset-list with duration: ${c} (was: ${d}) ${s}`);
vendor: 5,576 bytes, line 3525
3525const u=this.waitingItem,f=u?.event.identifier===r;this.updateSchedule();const h=(i=this.bufferingItem)==null?void 0:i.event;if(f){var p;const g=this.schedule.findEventIndex(r),v=(p=this.schedule.items)==null?void 0:p[g];if(v){if(!this.playingItem&&this.timelinePos>v.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==g){s.error=new Error(`Interstitial no longer within playback range ${this.timelinePos} ${s}`),this.primaryFallback(s);return}this.setBufferingItem(v)}this.setSchedulePosition(g)}else if(h?.identifier===r&&h.appendInPlace){const g=s.assetList[0],v=this.getAssetPlayer(g.identifier),y=this.primaryMedia;g&&v&&y&&this.bufferAssetPlayer(v,y)}}onError(e,n){switch(n.details){case de.ASSET_LIST_PARSING_ERROR:case de.ASSET_LIST_LOAD_ERROR:case de.ASSET_LIST_LOAD_TIMEOUT:{const i=n.interstitial;i&&this.primaryFallback(i);break}case de.BUFFER_STALLED_ERROR:{this.onTimeupdate(),this.checkBuffer(!0);break}}}};a(iL,"InterstitialsController");let ZS=iL;const MP=500,sL=class sL extends Nh{constructor(e,n,i){super(e,n,i,"subtitle-stream-controller",Ue.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(B.LEVEL_LOADED,this.onLevelLoaded,this),e.on(B.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(B.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(B.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(B.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(B.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(B.LEVEL_LOADED,this.onLevelLoaded,this),e.off(B.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(B.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(B.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(B.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(B.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(e,n){this.stopLoad(),this.state=be.IDLE,this.setInterval(MP),this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=n?-1:e,this.tick()}onManifestLoading(){super.onManifestLoading(),this.mainDetails=null}onMediaDetaching(e,n){this.tracksBuffered=[],super.onMediaDetaching(e,n)}onLevelLoaded(e,n){this.mainDetails=n.details}onSubtitleFragProcessed(e,n){const{frag:i,success:s}=n;if(this.fragContextChanged(i)||($n(i)&&(this.fragPrevious=i),this.state=be.IDLE),!s)return;const r=this.tracksBuffered[this.currentTrackId];if(!r)return;let o;const l=i.start;for(let c=0;c<r.length;c++)if(l>=r[c].start&&l<=r[c].end){o=r[c];break}const d=i.start+i.duration;o?o.end=d:(o={start:l,end:d},r.push(o)),this.fragmentTracker.fragBuffered(i),this.fragBufferedComplete(i,null),this.media&&this.tick()}onBufferFlushing(e,n){const{startOffset:i,endOffset:s}=n;if(i===0&&s!==Number.POSITIVE_INFINITY){const r=s-1;if(r<=0)return;n.endOffsetSubtitles=Math.max(0,r),this.tracksBuffered.forEach(o=>{for(let l=0;l<o.length;){if(o[l].end<=r){o.shift();continue}else if(o[l].start<r)o[l].start=r;else break;l++}}),this.fragmentTracker.removeFragmentsInRange(i,r,Ue.SUBTITLE)}}onError(e,n){const i=n.frag;i?.type===Ue.SUBTITLE&&(n.details===de.FRAG_GAP&&this.fragmentTracker.fragBuffered(i,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==be.STOPPED&&(this.state=be.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:n}){if(this.levels&&s4(this.levels,n)){this.levels=n.map(i=>new Yl(i));return}this.tracksBuffered=[],this.levels=n.map(i=>{const s=new Yl(i);return this.tracksBuffered[s.id]=[],s}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,Ue.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,n){var i;if(this.currentTrackId=n.id,!((i=this.levels)!=null&&i.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.state!==be.STOPPED&&this.setInterval(MP)}onSubtitleTrackLoaded(e,n){var i;const{currentTrackId:s,levels:r}=this,{details:o,id:l}=n;if(!r){this.warn(`Subtitle tracks were reset while loading level ${l}`);return}const d=r[l];if(l>=r.length||!d)return;this.log(`Subtitle track ${l} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""},duration:${o.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let c=0;if(o.live||(i=d.details)!=null&&i.live){if(o.deltaUpdateFailed)return;const f=this.mainDetails;if(!f){this.startFragRequested=!1;return}const h=f.fragments[0];if(!d.details)o.hasProgramDateTime&&f.hasProgramDateTime?(Sv(o,f),c=o.fragmentStart):h&&(c=h.start,bS(o,c));else{var u;c=this.alignPlaylists(o,d.details,(u=this.levelLastLoaded)==null?void 0:u.details),c===0&&h&&(c=h.start,bS(o,c))}f&&!this.startFragRequested&&this.setStartPosition(f,c)}d.details=o,this.levelLastLoaded=d,l===s&&(this.hls.trigger(B.SUBTITLE_TRACK_UPDATED,{details:o,id:l,groupId:n.groupId}),this.tick(),o.live&&!this.fragCurrent&&this.media&&this.state===be.IDLE&&(Zl(null,o.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),d.details=void 0)))}_handleFragmentLoadComplete(e){const{frag:n,payload:i}=e,s=n.decryptdata,r=this.hls;if(!this.fragContextChanged(n)&&i&&i.byteLength>0&&s!=null&&s.key&&s.iv&&bd(s.method)){const o=performance.now();
3525this.decrypter.decrypt(new Uint8Array(i),s.key.buffer,s.iv.buffer,NA(s.method)).catch(l=>{throw r.trigger(B.ERROR,{type:Ge.MEDIA_ERROR,details:de.FRAG_DECRYPT_ERROR,fatal:!1,error:l,reason:l.message,frag:n}),l}).then(l=>{const d=performance.now();r.trigger(B.FRAG_DECRYPTED,{frag:n,payload:l,stats:{tstart:o,tdecrypt:d}})}).catch(l=>{this.warn(`${l.name}: ${l.message}`),this.state=be.IDLE})}}doTick(){if(!this.media){this.state=be.IDLE;return}if(this.state===be.IDLE){const{currentTrackId:e,levels:n}=this,i=n?.[e];if(!i||!n.length||!i.details||this.waitForLive(i))return;const{config:s}=this,r=this.getLoadPosition(),o=gt.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],r,s.maxBufferHole),{end:l,len:d}=o,c=i.details,u=this.hls.maxBufferLength+c.levelTargetDuration;if(d>u)return;const f=c.fragments,h=f.length,p=c.edge;let g=null;const v=this.fragPrevious;if(l<p){const E=s.maxFragLookUpTolerance,T=l>p-E?0:E;g=Zl(v,f,Math.max(f[0].start,l),T),!g&&v&&v.start<f[0].start&&(g=f[0])}else g=f[h-1];if(g=this.filterReplacedPrimary(g,i.details),!g)return;const y=g.sn-c.startSN,b=f[y-1];if(b&&b.cc===g.cc&&this.fragmentTracker.getState(b)===Kn.NOT_LOADED&&(g=b),this.fragmentTracker.getState(g)===Kn.NOT_LOADED){const E=this.mapToInitFragWhenRequired(g);E&&this.loadFragment(E,i,l)}}}loadFragment(e,n,i){$n(e)?super.loadFragment(e,n,i):this._loadInitSegment(e,n)}get mediaBufferTimeRanges(){return new JS(this.tracksBuffered[this.currentTrackId]||[])}};a(sL,"SubtitleStreamController");let QS=sL;const rL=class rL{constructor(e){this.buffered=void 0;const n=a((i,s,r)=>{if(s=s>>>0,s>r-1)throw new DOMException(`Failed to execute '${i}' on 'TimeRanges': The index provided (${s}) is greater than the maximum bound (${r})`);return e[s][i]},"getRange");this.buffered={get length(){return e.length},end(i){return n("end",i,e.length)},start(i){return n("start",i,e.length)}}}};a(rL,"BufferableInstance");let JS=rL;const Yme={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},p4=a(t=>String.fromCharCode(Yme[t]||t),"getCharForByte"),$s=15,Jr=100,Zme={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},Qme={17:2,18:4,21:6,22:8,23:10,19:13,20:15},Jme={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},Xme={25:2,26:4,29:6,30:8,31:10,27:13,28:15},e0e=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],oL=class oL{constructor(){this.time=null,this.verboseLevel=0}log(e,n){if(this.verboseLevel>=e){const i=typeof n=="function"?n():n;Bt.log(`${this.time} [${e}] ${i}`)}}};a(oL,"CaptionsLogger");let XS=oL;const Za=a(function(e){const n=[];for(let i=0;i<e.length;i++)n.push(e[i].toString(16));return n},"numArrayToHexArray"),aL=class aL{constructor(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}reset(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}setStyles(e){const n=["foreground","underline","italics","background","flash"];for(let i=0;i<n.length;i++){const s=n[i];e.hasOwnProperty(s)&&(this[s]=e[s])}}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}};a(aL,"PenState");let Dv=aL;const lL=class lL{constructor(){this.uchar=" ",this.penState=new Dv}reset(){this.uchar=" ",this.penState.reset()}setChar(e,n){this.uchar=e,this.penState.copy(n)}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()}};a(lL,"StyledUnicodeChar");let eT=lL;const cL=class cL{constructor(e){this.chars=[],this.pos=0,this.currPenState=new Dv,this.cueStartTime=null,this.logger=void 0;for(let n=0;n<Jr;n++)this.chars.push(new eT);this.logger=e}equals(e){for(let n=0;n<Jr;n++)if(!this.chars[n].equals(e.chars[n]))return!1;return!0}copy(e){for(let n=0;n<Jr;n++)this.chars[n].copy(e.chars[n])}isEmpty(){let e=!0;for(let n=0;n<Jr;n++)if(!this.chars[n].isEmpty()){e=!1;break}return e}
vendor: 10,078 bytes, lines 3525-3526
3525setCursor(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>Jr&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Jr)}moveCursor(e){const n=this.pos+e;if(e>1)for(let i=this.pos+1;i<n+1;i++)this.chars[i].setPenState(this.currPenState);this.setCursor(n)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(e){e>=144&&this.backSpace();const n=p4(e);if(this.pos>=Jr){this.logger.log(0,()=>"Cannot insert "+e.toString(16)+" ("+n+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(n,this.currPenState),this.moveCursor(1)}clearFromPos(e){let n;for(n=e;n<Jr;n++)this.chars[n].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const e=[];let n=!0;for(let i=0;i<Jr;i++){const s=this.chars[i].uchar;s!==" "&&(n=!1),e.push(s)}return n?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}};a(cL,"Row");let tT=cL;const dL=class dL{constructor(e){this.rows=[],this.currRow=$s-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let n=0;n<$s;n++)this.rows.push(new tT(e));this.logger=e}reset(){for(let e=0;e<$s;e++)this.rows[e].clear();this.currRow=$s-1}equals(e){let n=!0;for(let i=0;i<$s;i++)if(!this.rows[i].equals(e.rows[i])){n=!1;break}return n}copy(e){for(let n=0;n<$s;n++)this.rows[n].copy(e.rows[n])}isEmpty(){let e=!0;for(let n=0;n<$s;n++)if(!this.rows[n].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 = "+hn(e));let n=e.row-1;if(this.nrRollUpRows&&n<this.nrRollUpRows-1&&(n=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==n){for(let l=0;l<$s;l++)this.rows[l].clear();const r=this.currRow+1-this.nrRollUpRows,o=this.lastOutputScreen;if(o){const l=o.rows[r].cueStartTime,d=this.logger.time;if(l!==null&&d!==null&&l<d)for(let c=0;c<this.nrRollUpRows;c++)this.rows[n-this.nrRollUpRows+c+1].copy(o.rows[r+c])}}this.currRow=n;const i=this.rows[this.currRow];if(e.indent!==null){const r=e.indent,o=Math.max(r-1,0);i.setCursor(e.indent),e.color=i.chars[o].penState.foreground}const s={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(s)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+hn(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,n=this.rows.splice(e,1)[0];n.clear(),this.rows.splice(this.currRow,0,n),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const n=[];let i="",s=-1;for(let r=0;r<$s;r++){const o=this.rows[r].getTextString();o&&(s=r+1,e?n.push("Row "+s+": '"+o+"'"):n.push(o.trim()))}return n.length>0&&(e?i="["+n.join(" | ")+"]":i=n.join(`
3526`)),i}getTextAndFormat(){return this.rows}};a(dL,"CaptionScreen");let Rf=dL;const uL=class uL{constructor(e,n,i){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=n,this.mode=null,this.verbose=0,this.displayedMemory=new Rf(i),this.nonDisplayedMemory=new Rf(i),this.lastOutputScreen=new Rf(i),this.currRollUpRow=this.displayedMemory.rows[$s-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[$s-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,()=>"MODE="+e),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let i=0;i<e.length;i++)this.writeScreen.insertChar(e[i]);const n=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,()=>n+": "+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 n={flash:!1};if(n.underline=e%2===1,n.italics=e>=46,n.italics)n.foreground="white";else{const i=Math.floor(e/2)-16,s=["white","green","blue","cyan","red","yellow","magenta"];n.foreground=s[i]}this.logger.log(2,"MIDROW: "+hn(n)),this.writeScreen.setPen(n)}outputDataUpdate(e=!1){const n=this.logger.time;n!==null&&this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=n:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,n,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:n),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))}};a(uL,"Cea608Channel");let Ov=uL;const fL=class fL{constructor(e,n,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory=n0e(),this.logger=void 0;const s=this.logger=new XS;this.channels=[null,new Ov(e,n,s),new Ov(e+1,i,s)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,n){this.channels[e].setHandler(n)}addData(e,n){this.logger.time=e;for(let i=0;i<n.length;i+=2){const s=n[i]&127,r=n[i+1]&127;let o=!1,l=null;if(s===0&&r===0)continue;this.logger.log(3,()=>"["+Za([n[i],n[i+1]])+"] -> ("+Za([s,r])+")");const d=this.cmdHistory;if(s>=16&&s<=31){if(t0e(s,r,d)){Zg(null,null,d),this.logger.log(3,()=>"Repeated command ("+Za([s,r])+") is dropped");continue}Zg(s,r,this.cmdHistory),o=this.parseCmd(s,r),o||(o=this.parseMidrow(s,r)),o||(o=this.parsePAC(s,r)),o||(o=this.parseBackgroundAttributes(s,r))}else Zg(null,null,d);if(!o&&(l=this.parseChars(s,r),l)){const u=this.currentChannel;u&&u>0?this.channels[u].insertChars(l):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!o&&!l&&this.logger.log(2,()=>"Couldn't parse cleaned data "+Za([s,r])+" orig: "+Za([n[i],n[i+1]]))}}parseCmd(e,n){const i=(e===20||e===28||e===21||e===29)&&n>=32&&n<=47,s=(e===23||e===31)&&n>=33&&n<=35;if(!(i||s))return!1;const r=e===20||e===21||e===23?1:2,o=this.channels[r];return e===20||e===21||e===28||e===29?n===32?o.ccRCL():n===33?o.ccBS():n===34?o.ccAOF():n===35?o.ccAON():n===36?o.ccDER():n===37?o.ccRU(2):n===38?o.ccRU(3):n===39?o.ccRU(4):n===40?o.ccFON():n===41?o.ccRDC():n===42?o.ccTR():n===43?o.ccRTD():n===44?o.ccEDM():n===45?o.ccCR():n===46?o.ccENM():n===47&&o.ccEOC():o.ccTO(n-32),this.currentChannel=r,!0}parseMidrow(e,n){let i=0;if((e===17||e===25)&&n>=32&&n<=47){if(e===17?i=1:i=2,i!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const s=this.channels[i];return s?(s.ccMIDROW(n),this.logger.log(3,()=>"MIDROW ("+Za([e,n])+")"),!0):!1}return!1}parsePAC(e,n){let i;const s=(e>=17&&e<=23||e>=25&&e<=31)&&n>=64&&n<=127,r=(e===16||e===24)&&n>=64&&n<=95;if(!(s||r))return!1;const o=e<=23?1:2;n>=64&&n<=95?i=o===1?Zme[e]:Jme[e]:i=o===1?Qme[e]:Xme[e];const l=this.channels[o];return l?(l.setPAC(this.interpretPAC(i,n)),this.currentChannel=o,!0):!1}interpretPAC(e,n){let i;const s={color:null,italics:!1,indent:null,underline:!1,row:e};return n>95?i=n-96:i=n-64,s.underline=(i&1)===1,i<=13?s.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(s.italics=!0,s.color="white"):s.indent=Math.floor((i-16)/2)*4,s}
vendor: 10,205 bytes, lines 3526-3534
3526parseChars(e,n){let i,s=null,r=null;if(e>=25?(i=2,r=e-8):(i=1,r=e),r>=17&&r<=19){let o;r===17?o=n+80:r===18?o=n+112:o=n+144,this.logger.log(2,()=>"Special char '"+p4(o)+"' in channel "+i),s=[o]}else e>=32&&e<=127&&(s=n===0?[e]:[e,n]);return s&&this.logger.log(3,()=>"Char codes =  "+Za(s).join(",")),s}parseBackgroundAttributes(e,n){const i=(e===16||e===24)&&n>=32&&n<=47,s=(e===23||e===31)&&n>=45&&n<=47;if(!(i||s))return!1;let r;const o={};e===16||e===24?(r=Math.floor((n-32)/2),o.background=e0e[r],n%2===1&&(o.background=o.background+"_semi")):n===45?o.background="transparent":(o.foreground="black",n===47&&(o.underline=!0));const l=e<=23?1:2;return this.channels[l].setBkgData(o),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){const n=this.channels[e];n&&n.reset()}Zg(null,null,this.cmdHistory)}cueSplitAtTime(e){for(let n=0;n<this.channels.length;n++){const i=this.channels[n];i&&i.cueSplitAtTime(e)}}};a(fL,"Cea608Parser");let Nv=fL;function Zg(t,e,n){n.a=t,n.b=e}a(Zg,"setLastCmd");function t0e(t,e,n){return n.a===t&&n.b===e}a(t0e,"hasCmdRepeated");function n0e(){return{a:null,b:null}}a(n0e,"createCmdHistory");var WA=function(){if(_v!=null&&_v.VTTCue)return self.VTTCue;const t=["","lr","rl"],e=["start","middle","end","left","right"];function n(l,d){if(typeof d!="string"||!Array.isArray(l))return!1;const c=d.toLowerCase();return~l.indexOf(c)?c:!1}a(n,"isAllowedValue");function i(l){return n(t,l)}a(i,"findDirectionSetting");function s(l){return n(e,l)}a(s,"findAlignSetting");function r(l,...d){let c=1;for(;c<arguments.length;c++){const u=arguments[c];for(const f in u)l[f]=u[f]}return l}a(r,"extend");function o(l,d,c){const u=this,f={enumerable:!0};u.hasBeenReset=!1;let h="",p=!1,g=l,v=d,y=c,b=null,E="",T=!0,I="auto",M="start",H=50,N="middle",$=50,F="middle";Object.defineProperty(u,"id",r({},f,{get:function(){return h},set:function(D){h=""+D}})),Object.defineProperty(u,"pauseOnExit",r({},f,{get:function(){return p},set:function(D){p=!!D}})),Object.defineProperty(u,"startTime",r({},f,{get:function(){return g},set:function(D){if(typeof D!="number")throw new TypeError("Start time must be set to a number.");g=D,this.hasBeenReset=!0}})),Object.defineProperty(u,"endTime",r({},f,{get:function(){return v},set:function(D){if(typeof D!="number")throw new TypeError("End time must be set to a number.");v=D,this.hasBeenReset=!0}})),Object.defineProperty(u,"text",r({},f,{get:function(){return y},set:function(D){y=""+D,this.hasBeenReset=!0}})),Object.defineProperty(u,"region",r({},f,{get:function(){return b},set:function(D){b=D,this.hasBeenReset=!0}})),Object.defineProperty(u,"vertical",r({},f,{get:function(){return E},set:function(D){const L=i(D);if(L===!1)throw new SyntaxError("An invalid or illegal string was specified.");E=L,this.hasBeenReset=!0}})),Object.defineProperty(u,"snapToLines",r({},f,{get:function(){return T},set:function(D){T=!!D,this.hasBeenReset=!0}})),Object.defineProperty(u,"line",r({},f,{get:function(){return I},set:function(D){if(typeof D!="number"&&D!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");I=D,this.hasBeenReset=!0}})),Object.defineProperty(u,"lineAlign",r({},f,{get:function(){return M},set:function(D){const L=s(D);if(!L)throw new SyntaxError("An invalid or illegal string was specified.");M=L,this.hasBeenReset=!0}})),Object.defineProperty(u,"position",r({},f,{get:function(){return H},set:function(D){if(D<0||D>100)throw new Error("Position must be between 0 and 100.");H=D,this.hasBeenReset=!0}})),Object.defineProperty(u,"positionAlign",r({},f,{get:function(){return N},set:function(D){const L=s(D);if(!L)throw new SyntaxError("An invalid or illegal string was specified.");N=L,this.hasBeenReset=!0}})),Object.defineProperty(u,"size",r({},f,{get:function(){return $},set:function(D){if(D<0||D>100)throw new Error("Size must be between 0 and 100.");$=D,this.hasBeenReset=!0}})),Object.defineProperty(u,"align",r({},f,{get:function(){return F},set:function(D){const L=s(D);if(!L)throw new SyntaxError("An invalid or illegal string was specified.");F=L,this.hasBeenReset=!0}})),u.displayState=void 0}return a(o,"VTTCue"),o.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},o}();const hL=class hL{decode(e,n){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}};a(hL,"StringDecoder");let nT=hL;function g4(t){function e(i,s,r,o){return(i|0)*3600+(s|0)*60+(r|0)+parseFloat(o||0)}a(e,"computeSeconds");const n=t.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return n?parseFloat(n[2])>59?e(n[2],n[3],0,n[4]):e(n[1],n[2],n[3],n[4]):null}a(g4,"parseTimeStamp");const pL=class pL{constructor(){this.values=Object.create(null)}set(e,n){!this.get(e)&&n!==""&&(this.values[e]=n)}get(e,n,i){return i?this.has(e)?this.values[e]:n[i]:this.has(e)?this.values[e]:n}has(e){return e in this.values}alt(e,n,i){for(let s=0;s<i.length;++s)if(n===i[s]){this.set(e,n);break}}integer(e,n){/^-?\d+$/.test(n)&&this.set(e,parseInt(n,10))}percent(e,n){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(n)){const i=parseFloat(n);if(i>=0&&i<=100)return this.set(e,i),!0}return!1}};a(pL,"Settings");let iT=pL;function m4(t,e,n,i){const s=i?t.split(i):[t];for(const r in s){if(typeof s[r]!="string")continue;const o=s[r].split(n);if(o.length!==2)continue;const l=o[0],d=o[1];e(l,d)}}a(m4,"parseOptions");const sT=new WA(0,0,""),Qg=sT.align==="middle"?"middle":"center";function i0e(t,e,n){const i=t;function s(){const l=g4(t);if(l===null)throw new Error("Malformed timestamp: "+i);return t=t.replace(/^[^\sa-zA-Z-]+/,""),l}a(s,"consumeTimeStamp");function r(l,d){const c=new iT;m4(l,function(h,p){let g;switch(h){case"region":for(let v=n.length-1;v>=0;v--)if(n[v].id===p){c.set(h,n[v].region);break}break;case"vertical":c.alt(h,p,["rl","lr"]);break;case"line":g=p.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",Qg,"end"]);break;case"position":g=p.split(","),c.percent(h,g[0]),g.length===2&&c.alt("positionAlign",g[1],["start",Qg,"end","line-left","line-right","auto"]);break;case"size":c.percent(h,p);break;case"align":c.alt(h,p,["start",Qg,"end","left","right"]);break}},/:/,/\s/),d.region=c.get("region",null),d.vertical=c.get("vertical","");let u=c.get("line","auto");u==="auto"&&sT.line===-1&&(u=-1),d.line=u,d.lineAlign=c.get("lineAlign","start"),d.snapToLines=c.get("snapToLines",!0),d.size=c.get("size",100),d.align=c.get("align",Qg);let f=c.get("position","auto");f==="auto"&&sT.position===50&&(f=d.align==="start"||d.align==="left"?0:d.align==="end"||d.align==="right"?100:50),d.position=f}a(r,"consumeCueSettings");function o(){t=t.replace(/^\s+/,"")}if(a(o,"skipWhitespace"),o(),e.startTime=s(),o(),t.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+i);t=t.slice(3),o(),e.endTime=s(),o(),r(t,e)}a(i0e,"parseCue");function v4(t){return t.replace(/<br(?: \/)?>/gi,`
3527`)}a(v4,"fixLineBreaks");const gL=class gL{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new nT,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const n=this;e&&(n.buffer+=n.decoder.decode(e,{stream:!0}));function i(){let r=n.buffer,o=0;for(r=v4(r);o<r.length&&r[o]!=="\r"&&r[o]!==`
3528`;)++o;const l=r.slice(0,o);return r[o]==="\r"&&++o,r[o]===`
3529`&&++o,n.buffer=r.slice(o),l}a(i,"collectNextLine");function s(r){m4(r,function(o,l){},/:/)}a(s,"parseHeader");try{let r="";if(n.state==="INITIAL"){if(!/\r\n|\n/.test(n.buffer))return this;r=i();const l=r.match(/^()?WEBVTT([ \t].*)?$/);if(!(l!=null&&l[0]))throw new Error("Malformed WebVTT signature.");n.state="HEADER"}let o=!1;for(;n.buffer;){if(!/\r\n|\n/.test(n.buffer))return this;switch(o?o=!1:r=i(),n.state){case"HEADER":/:/.test(r)?s(r):r||(n.state="ID");continue;case"NOTE":r||(n.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(r)){n.state="NOTE";break}if(!r)continue;if(n.cue=new WA(0,0,""),n.state="CUE",r.indexOf("-->")===-1){n.cue.id=r;continue}case"CUE":if(!n.cue){n.state="BADCUE";continue}try{i0e(r,n.cue,n.regionList)}catch{n.cue=null,n.state="BADCUE";continue}n.state="CUETEXT";continue;case"CUETEXT":{const l=r.indexOf("-->")!==-1;if(!r||l&&(o=!0)){n.oncue&&n.cue&&n.oncue(n.cue),n.cue=null,n.state="ID";continue}if(n.cue===null)continue;n.cue.text&&(n.cue.text+=`
3530`),n.cue.text+=r}continue;case"BADCUE":r||(n.state="ID")}}}catch{n.state==="CUETEXT"&&n.cue&&n.oncue&&n.oncue(n.cue),n.cue=null,n.state=n.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this}flush(){const e=this;try{if((e.cue||e.state==="HEADER")&&(e.buffer+=`
3531
3532`,e.parse()),e.state==="INITIAL"||e.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(n){e.onparsingerror&&e.onparsingerror(n)}return e.onflush&&e.onflush(),this}};a(gL,"VTTParser");let rT=gL;const s0e=/\r\n|\n\r|\n|\r/g,IE=a(function(e,n,i=0){return e.slice(i,i+n.length)===n},"startsWith"),r0e=a(function(e){let n=parseInt(e.slice(-3));const i=parseInt(e.slice(-6,-4)),s=parseInt(e.slice(-9,-7)),r=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!Pe(n)||!Pe(i)||!Pe(s)||!Pe(r))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return n+=1e3*i,n+=60*1e3*s,n+=60*60*1e3*r,n},"cueString2millis");function zA(t,e,n){return Lf(t.toString())+Lf(e.toString())+Lf(n)}a(zA,"generateCueId");const o0e=a(function(e,n,i){let s=e[n],r=e[s.prevCC];if(!r||!r.new&&s.new){e.ccOffset=e.presentationOffset=s.start,s.new=!1;return}for(;(o=r)!=null&&o.new;){var o;e.ccOffset+=s.start-r.start,s.new=!1,s=r,r=e[s.prevCC]}e.presentationOffset=i},"calculateOffset");function a0e(t,e,n,i,s,r,o){const l=new rT,d=hs(new Uint8Array(t)).trim().replace(s0e,`
3533`).split(`
3534`),c=[],u=e?qge(e.baseTime,e.timescale):0;let f="00:00.000",h=0,p=0,g,v=!0;l.oncue=function(y){const b=n[i];let E=n.ccOffset;const T=(h-u)/9e4;if(b!=null&&b.new&&(p!==void 0?E=n.ccOffset=b.start:o0e(n,i,T)),T){if(!e){g=new Error("Missing initPTS for VTT MPEGTS");return}E=T-n.presentationOffset}const I=y.endTime-y.startTime,M=Ts((y.startTime+E-p)*9e4,s*9e4)/9e4;y.startTime=Math.max(M,0),y.endTime=Math.max(M+I,0);const H=y.text.trim();
vendor: 9,091 bytes, lines 3534-3536
3534y.text=decodeURIComponent(encodeURIComponent(H)),y.id||(y.id=zA(y.startTime,y.endTime,H)),y.endTime>0&&c.push(y)},l.onparsingerror=function(y){g=y},l.onflush=function(){if(g){o(g);return}r(c)},d.forEach(y=>{if(v)if(IE(y,"X-TIMESTAMP-MAP=")){v=!1,y.slice(16).split(",").forEach(b=>{IE(b,"LOCAL:")?f=b.slice(6):IE(b,"MPEGTS:")&&(h=parseInt(b.slice(7)))});try{p=r0e(f)/1e3}catch(b){g=b}return}else y===""&&(v=!1);l.parse(y+`
3535`)}),l.flush()}a(a0e,"parseWebVTT");const LE="stpp.ttml.im1t",y4=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,b4=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,l0e={left:"start",center:"center",right:"end",start:"start",end:"end"};function CP(t,e,n,i){const s=Et(new Uint8Array(t),["mdat"]);if(s.length===0){i(new Error("Could not parse IMSC1 mdat"));return}const r=s.map(l=>hs(l)),o=Kge(e.baseTime,1,e.timescale);try{r.forEach(l=>n(c0e(l,o)))}catch(l){i(l)}}a(CP,"parseIMSC1");function c0e(t,e){const s=new DOMParser().parseFromString(t,"text/xml").getElementsByTagName("tt")[0];if(!s)throw new Error("Invalid ttml");const r={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},o=Object.keys(r).reduce((f,h)=>(f[h]=s.getAttribute(`ttp:${h}`)||r[h],f),{}),l=s.getAttribute("xml:space")!=="preserve",d=PP(RE(s,"styling","style")),c=PP(RE(s,"layout","region")),u=RE(s,"body","[begin]");return[].map.call(u,f=>{const h=E4(f,l);if(!h||!f.hasAttribute("begin"))return null;const p=ME(f.getAttribute("begin"),o),g=ME(f.getAttribute("dur"),o);let v=ME(f.getAttribute("end"),o);if(p===null)throw DP(f);if(v===null){if(g===null)throw DP(f);v=p+g}const y=new WA(p-e,v-e,h);y.id=zA(y.startTime,y.endTime,y.text);const b=c[f.getAttribute("region")],E=d[f.getAttribute("style")],T=d0e(b,E,d),{textAlign:I}=T;if(I){const M=l0e[I];M&&(y.lineAlign=M),y.align=I}return jt(y,T),y}).filter(f=>f!==null)}a(c0e,"parseTTML");function RE(t,e,n){const i=t.getElementsByTagName(e)[0];return i?[].slice.call(i.querySelectorAll(n)):[]}a(RE,"getElementCollection");function PP(t){return t.reduce((e,n)=>{const i=n.getAttribute("xml:id");return i&&(e[i]=n),e},{})}a(PP,"collectionToDictionary");function E4(t,e){return[].slice.call(t.childNodes).reduce((n,i,s)=>{var r;return i.nodeName==="br"&&s?n+`
3536`:(r=i.childNodes)!=null&&r.length?E4(i,e):e?n+i.textContent.trim().replace(/\s+/g," "):n+i.textContent},"")}a(E4,"getTextContent");function d0e(t,e,n){const i="http://www.w3.org/ns/ttml#styling";let s=null;const r=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],o=t!=null&&t.hasAttribute("style")?t.getAttribute("style"):null;return o&&n.hasOwnProperty(o)&&(s=n[o]),r.reduce((l,d)=>{const c=kE(e,i,d)||kE(t,i,d)||kE(s,i,d);return c&&(l[d]=c),l},{})}a(d0e,"getTtmlStyles");function kE(t,e,n){return t&&t.hasAttributeNS(e,n)?t.getAttributeNS(e,n):null}a(kE,"getAttributeNS");function DP(t){return new Error(`Could not parse ttml timestamp ${t}`)}a(DP,"timestampParsingError");function ME(t,e){if(!t)return null;let n=g4(t);return n===null&&(y4.test(t)?n=u0e(t,e):b4.test(t)&&(n=f0e(t,e))),n}a(ME,"parseTtmlTime");function u0e(t,e){const n=y4.exec(t),i=(n[4]|0)+(n[5]|0)/e.subFrameRate;return(n[1]|0)*3600+(n[2]|0)*60+(n[3]|0)+i/e.frameRate}a(u0e,"parseHoursMinutesSecondsFrames");function f0e(t,e){const n=b4.exec(t),i=Number(n[1]);switch(n[2]){case"h":return i*3600;case"m":return i*60;case"ms":return i*1e3;case"f":return i/e.frameRate;case"t":return i/e.tickRate}return i}a(f0e,"parseTimeUnits");const mL=class mL{constructor(e,n){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=n}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,n,i){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=n,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}};a(mL,"OutputFilter");let od=mL;const vL=class vL{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=NP(),this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(B.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(B.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(B.MANIFEST_LOADING,this.onManifestLoading,this),e.on(B.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(B.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(B.FRAG_LOADING,this.onFragLoading,this),e.on(B.FRAG_LOADED,this.onFragLoaded,this),e.on(B.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(B.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(B.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(B.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(B.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(B.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(B.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(B.MANIFEST_LOADING,this.onManifestLoading,this),e.off(B.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(B.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(B.FRAG_LOADING,this.onFragLoading,this),e.off(B.FRAG_LOADED,this.onFragLoaded,this),e.off(B.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(B.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(B.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(B.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(B.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){const e=new od(this,"textTrack1"),n=new od(this,"textTrack2"),i=new od(this,"textTrack3"),s=new od(this,"textTrack4");this.cea608Parser1=new Nv(1,e,n),this.cea608Parser2=new Nv(3,i,s)}addCues(e,n,i,s,r){let o=!1;for(let l=r.length;l--;){const d=r[l],c=h0e(d[0],d[1],n,i);if(c>=0&&(d[0]=Math.min(d[0],n),d[1]=Math.max(d[1],i),o=!0,c/(i-n)>.5))return}if(o||r.push([n,i]),this.config.renderTextTracksNatively){const l=this.captionsTracks[e];this.Cues.newCue(l,n,i,s)}else{const l=this.Cues.newCue(null,n,i,s);this.hls.trigger(B.CUES_PARSED,{type:"captions",cues:l,track:e})}}onInitPtsFound(e,{frag:n,id:i,initPTS:s,timescale:r}){const{unparsedVttFrags:o}=this;i===Ue.MAIN&&(this.initPTS[n.cc]={baseTime:s,timescale:r}),o.length&&(this.unparsedVttFrags=[],o.forEach(l=>{this.initPTS[l.frag.cc]?this.onFragLoaded(B.FRAG_LOADED,l):this.hls.trigger(B.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l.frag,error:new Error("Subtitle discontinuity domain does not match main")})}))}getExistingTrack(e,n){const{media:i}=this;if(i)for(let s=0;s<i.textTracks.length;s++){const r=i.textTracks[s];if(OP(r,{name:e,lang:n,characteristics:"transcribes-spoken-dialog,describes-music-and-sound"}))return r}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:n,captionsTracks:i,media:s}=this,{label:r,languageCode:o}=n[e],l=this.getExistingTrack(r,o);if(l)i[e]=l,rd(i[e]),u4(i[e],s);else{const d=this.createTextTrack("captions",r,o);d&&(d[e]=!0,i[e]=d)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const n=this.captionsProperties[e];if(!n)return;const i=n.label,s={_id:e,label:i,kind:"captions",default:n.media?!!n.media.default:!1,closedCaptions:n.media};this.nonNativeCaptionsTracks[e]=s,this.hls.trigger(B.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[s]})}createTextTrack(e,n,i){const s=this.media;if(s)return s.addTextTrack(e,n,i)}onMediaAttaching(e,n){this.media=n.media,n.mediaSource||this._cleanTracks()}onMediaDetaching(e,n){const i=!!n.transferMedia;if(this.media=null,i)return;const{captionsTracks:s}=this;Object.keys(s).forEach(r=>{rd(s[r]),delete s[r]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=NP(),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 n=e.textTracks;if(n)for(let i=0;i<n.length;i++)rd(n[i])}
vendor: 13,588 bytes, line 3536
3536onSubtitleTracksUpdated(e,n){const i=n.subtitleTracks||[],s=i.some(r=>r.textCodec===LE);if(this.config.enableWebVTT||s&&this.config.enableIMSC1){if(s4(this.tracks,i)){this.tracks=i;return}if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){const o=this.media,l=o?zm(o.textTracks):null;if(this.tracks.forEach((d,c)=>{let u;if(l){let f=null;for(let h=0;h<l.length;h++)if(l[h]&&OP(l[h],d)){f=l[h],l[h]=null;break}f&&(u=f)}if(u)rd(u);else{const f=_4(d);u=this.createTextTrack(f,d.name,d.lang),u&&(u.mode="disabled")}u&&this.textTracks.push(u)}),l!=null&&l.length){const d=l.filter(c=>c!==null).map(c=>c.label);d.length&&this.hls.logger.warn(`Media element contains unused subtitle tracks: ${d.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const o=this.tracks.map(l=>({label:l.name,kind:l.type.toLowerCase(),default:l.default,subtitleTrack:l}));this.hls.trigger(B.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:o})}}}onManifestLoaded(e,n){this.config.enableCEA708Captions&&n.captions&&n.captions.forEach(i=>{const s=/(?:CC|SERVICE)([1-4])/.exec(i.instreamId);if(!s)return;const r=`textTrack${s[1]}`,o=this.captionsProperties[r];o&&(o.label=i.name,i.lang&&(o.languageCode=i.lang),o.media=i)})}closedCaptionsForLevel(e){const n=this.hls.levels[e.level];return n?.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,n){if(this.enabled&&n.frag.type===Ue.MAIN){var i,s;const{cea608Parser1:r,cea608Parser2:o,lastSn:l}=this,{cc:d,sn:c}=n.frag,u=(i=(s=n.part)==null?void 0:s.index)!=null?i:-1;r&&o&&(c!==l+1||c===l&&u!==this.lastPartIndex+1||d!==this.lastCc)&&(r.reset(),o.reset()),this.lastCc=d,this.lastSn=c,this.lastPartIndex=u}}onFragLoaded(e,n){const{frag:i,payload:s}=n;if(i.type===Ue.SUBTITLE)if(s.byteLength){const r=i.decryptdata,o="stats"in n;if(r==null||!r.encrypted||o){const l=this.tracks[i.level],d=this.vttCCs;d[i.cc]||(d[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),l&&l.textCodec===LE?this._parseIMSC1(i,s):this._parseVTTs(n)}}else this.hls.trigger(B.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,n){const i=this.hls;CP(n,this.initPTS[e.cc],s=>{this._appendCues(s,e.level),i.trigger(B.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},s=>{i.logger.log(`Failed to parse IMSC1: ${s}`),i.trigger(B.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:s})})}_parseVTTs(e){var n;const{frag:i,payload:s}=e,{initPTS:r,unparsedVttFrags:o}=this,l=r.length-1;if(!r[i.cc]&&l===-1){o.push(e);return}const d=this.hls,c=(n=i.initSegment)!=null&&n.data?Ms(i.initSegment.data,new Uint8Array(s)).buffer:s;a0e(c,this.initPTS[i.cc],this.vttCCs,i.cc,i.start,u=>{this._appendCues(u,i.level),d.trigger(B.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})},u=>{const f=u.message==="Missing initPTS for VTT MPEGTS";f?o.push(e):this._fallbackToIMSC1(i,s),d.logger.log(`Failed to parse VTT cue: ${u}`),!(f&&l>i.cc)&&d.trigger(B.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:u})})}_fallbackToIMSC1(e,n){const i=this.tracks[e.level];i.textCodec||CP(n,this.initPTS[e.cc],()=>{i.textCodec=LE,this._parseIMSC1(e,n)},()=>{i.textCodec="wvtt"})}_appendCues(e,n){const i=this.hls;if(this.config.renderTextTracksNatively){const s=this.textTracks[n];if(!s||s.mode==="disabled")return;e.forEach(r=>f4(s,r))}else{const s=this.tracks[n];if(!s)return;const r=s.default?"default":"subtitles"+n;i.trigger(B.CUES_PARSED,{type:"subtitles",cues:e,track:r})}}onFragDecrypted(e,n){const{frag:i}=n;i.type===Ue.SUBTITLE&&this.onFragLoaded(B.FRAG_LOADED,n)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,n){if(!this.enabled||!this.config.enableCEA708Captions)return;const{frag:i,samples:s}=n;if(!(i.type===Ue.MAIN&&this.closedCaptionsForLevel(i)==="NONE"))for(let r=0;r<s.length;r++){const o=s[r].bytes;if(o){this.cea608Parser1||this.initCea608Parsers();const l=this.extractCea608Data(o);this.cea608Parser1.addData(s[r].pts,l[0]),this.cea608Parser2.addData(s[r].pts,l[1])}}}onBufferFlushing(e,{startOffset:n,endOffset:i,endOffsetSubtitles:s,type:r}){const{media:o}=this;if(!(!o||o.currentTime<i)){if(!r||r==="video"){const{captionsTracks:l}=this;Object.keys(l).forEach(d=>WS(l[d],n,i))}if(this.config.renderTextTracksNatively&&n===0&&s!==void 0){const{textTracks:l}=this;Object.keys(l).forEach(d=>WS(l[d],n,s))}}}extractCea608Data(e){const n=[[],[]],i=e[0]&31;let s=2;for(let r=0;r<i;r++){const o=e[s++],l=127&e[s++],d=127&e[s++];if(l===0&&d===0)continue;if((4&o)!==0){const u=3&o;(u===0||u===1)&&(n[u].push(l),n[u].push(d))}}return n}};a(vL,"TimelineController");let oT=vL;function _4(t){return t.characteristics&&/transcribes-spoken-dialog/gi.test(t.characteristics)&&/describes-music-and-sound/gi.test(t.characteristics)?"captions":"subtitles"}a(_4,"captionsOrSubtitlesFromCharacteristics");function OP(t,e){return!!t&&t.kind===_4(e)&&PS(e,t)}a(OP,"canReuseVttTextTrack");function h0e(t,e,n,i){return Math.min(e,i)-Math.max(t,n)}a(h0e,"intersection");function NP(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}a(NP,"newVTTCCs");const p0e=/\s/,g0e={newCue(t,e,n,i){const s=[];let r,o,l,d,c;const u=self.VTTCue||self.TextTrackCue;for(let h=0;h<i.rows.length;h++)if(r=i.rows[h],l=!0,d=0,c="",!r.isEmpty()){var f;for(let v=0;v<r.chars.length;v++)p0e.test(r.chars[v].uchar)&&l?d++:(c+=r.chars[v].uchar,l=!1);r.cueStartTime=e,e===n&&(n+=1e-4),d>=16?d--:d++;const p=v4(c.trim()),g=zA(e,n,p);t!=null&&(f=t.cues)!=null&&f.getCueById(g)||(o=new u(e,n,p),o.id=g,o.line=h+1,o.align="left",o.position=10+Math.min(80,Math.floor(d*8/32)*10),s.push(o))}return t&&s.length&&(s.sort((h,p)=>h.line==="auto"||p.line==="auto"?0:h.line>8&&p.line>8?p.line-h.line:h.line-p.line),s.forEach(h=>f4(t,h))),s}};function m0e(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}a(m0e,"fetchSupported");const v0e=/(\d+)-(\d+)\/(\d+)/,yL=class yL{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||_0e,this.controller=new self.AbortController,this.stats=new Mh}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,n,i){const s=this.stats;if(s.loading.start)throw new Error("Loader can only be used once.");s.loading.start=self.performance.now();const r=y0e(e,this.controller.signal),o=e.responseType==="arraybuffer",l=o?"byteLength":"length",{maxTimeToFirstByteMs:d,maxLoadTimeMs:c}=n.loadPolicy;this.context=e,this.config=n,this.callbacks=i,this.request=this.fetchSetup(e,r),self.clearTimeout(this.requestTimeout),n.timeout=d&&Pe(d)?d:c,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(s,e,this.response))},n.timeout),($h(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(f=>{var h;this.response=this.loader=f;const p=Math.max(self.performance.now(),s.loading.start);if(self.clearTimeout(this.requestTimeout),n.timeout=c,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(s,e,this.response))},c-(p-s.loading.start)),!f.ok){const{status:v,statusText:y}=f;throw new aT(y||"fetch, bad network response",v,f)}s.loading.first=p,s.total=E0e(f.headers)||s.total;const g=(h=this.callbacks)==null?void 0:h.onProgress;return g&&Pe(n.highWaterMark)?this.loadProgressively(f,s,e,n.highWaterMark,g):o?f.arrayBuffer():e.responseType==="json"?f.json():f.text()}).then(f=>{var h,p;const g=this.response;if(!g)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),s.loading.end=Math.max(self.performance.now(),s.loading.first);const v=f[l];v&&(s.loaded=s.total=v);const y={url:g.url,data:f,code:g.status},b=(h=this.callbacks)==null?void 0:h.onProgress;b&&!Pe(n.highWaterMark)&&b(s,e,f,g),(p=this.callbacks)==null||p.onSuccess(y,s,e,g)}).catch(f=>{var h;if(self.clearTimeout(this.requestTimeout),s.aborted)return;const p=f&&f.code||0,g=f?f.message:null;(h=this.callbacks)==null||h.onError({code:p,text:g},e,f?f.details:null,s)})}getCacheAge(){let e=null;if(this.response){const n=this.response.headers.get("age");e=n?parseFloat(n):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,n,i,s=0,r){const o=new Tv,l=e.body.getReader(),d=a(()=>l.read().then(c=>{if(c.done)return o.dataLength&&r(n,i,o.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));const u=c.value,f=u.length;return n.loaded+=f,f<s||o.dataLength?(o.push(u),o.dataLength>=s&&r(n,i,o.flush().buffer,e)):r(n,i,u.buffer,e),d()}).catch(()=>Promise.reject()),"pump");return d()}};a(yL,"FetchLoader");let Fv=yL;function y0e(t,e){const n={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(jt({},t.headers))};return t.rangeEnd&&n.headers.set("Range","bytes="+t.rangeStart+"-"+String(t.rangeEnd-1)),n}a(y0e,"getRequestParameters");function b0e(t){const e=v0e.exec(t);if(e)return parseInt(e[2])-parseInt(e[1])+1}a(b0e,"getByteRangeLength");function E0e(t){const e=t.get("Content-Range");if(e){const i=b0e(e);if(Pe(i))return i}const n=t.get("Content-Length");if(n)return parseInt(n)}a(E0e,"getContentLength");function _0e(t,e){return new self.Request(t.url,e)}a(_0e,"getRequest");const bL=class bL extends Error{constructor(e,n,i){super(e),this.code=void 0,this.details=void 0,this.code=n,this.details=i}};a(bL,"FetchError");let aT=bL;const w0e=/^age:\s*[\d.]+\s*$/im,EL=class EL{constructor(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new Mh,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,n,i){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=n,this.callbacks=i,this.loadInternal()}loadInternal(){const{config:e,context:n}=this;if(!e||!n)return;const i=this.loader=new self.XMLHttpRequest,s=this.stats;s.loading.first=0,s.loaded=0,s.aborted=!1;const r=this.xhrSetup;r?Promise.resolve().then(()=>{if(!(this.loader!==i||this.stats.aborted))return r(i,n.url)}).catch(o=>{if(!(this.loader!==i||this.stats.aborted))return i.open("GET",n.url,!0),r(i,n.url)}).then(()=>{this.loader!==i||this.stats.aborted||this.openAndSendXhr(i,n,e)}).catch(o=>{var l;(l=this.callbacks)==null||l.onError({code:i.status,text:o.message},n,i,s)}):this.openAndSendXhr(i,n,e)}openAndSendXhr(e,n,i){e.readyState||e.open("GET",n.url,!0);const s=n.headers,{maxTimeToFirstByteMs:r,maxLoadTimeMs:o}=i.loadPolicy;if(s)for(const l in s)e.setRequestHeader(l,s[l]);n.rangeEnd&&e.setRequestHeader("Range","bytes="+n.rangeStart+"-"+(n.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=n.responseType,self.clearTimeout(this.requestTimeout),i.timeout=r&&Pe(r)?r:o,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.timeout),e.send()}readystatechange(){const{context:e,loader:n,stats:i}=this;if(!e||!n)return;const s=n.readyState,r=this.config;if(!i.aborted&&s>=2&&(i.loading.first===0&&(i.loading.first=Math.max(self.performance.now(),i.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-(i.loading.first-i.loading.start)))),s===4)){self.clearTimeout(this.requestTimeout),n.onreadystatechange=null,n.onprogress=null;const c=n.status,u=n.responseType==="text"?n.responseText:null;if(c>=200&&c<300){const g=u??n.response;if(g!=null){var o,l;i.loading.end=Math.max(self.performance.now(),i.loading.first);const v=n.responseType==="arraybuffer"?g.byteLength:g.length;i.loaded=i.total=v,i.bwEstimate=i.total*8e3/(i.loading.end-i.loading.first);const y=(o=this.callbacks)==null?void 0:o.onProgress;y&&y(i,e,g,n);const b={url:n.responseURL,data:g,code:c};(l=this.callbacks)==null||l.onSuccess(b,i,e,n);return}}const f=r.loadPolicy.errorRetry,h=i.retry,p={url:e.url,data:void 0,code:c};if(yv(f,h,!1,p))this.retry(f);else{var d;Bt.error(`${c} while loading ${e.url}`),(d=this.callbacks)==null||d.onError({code:c,text:n.statusText},e,n,i)}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,n=this.stats.retry;if(yv(e,n,!0))this.retry(e);else{var i;Bt.warn(`timeout while loading ${(i=this.context)==null?void 0:i.url}`);const s=this.callbacks;s&&(this.abortInternal(),s.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:n,stats:i}=this;
vendor: 5,098 bytes, line 3536
3536this.retryDelay=OA(e,i.retry),i.retry++,Bt.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${n?.url}, retrying ${i.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const n=this.stats;n.loaded=e.loaded,e.lengthComputable&&(n.total=e.total)}getCacheAge(){let e=null;if(this.loader&&w0e.test(this.loader.getAllResponseHeaders())){const n=this.loader.getResponseHeader("age");e=n?parseFloat(n):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}};a(EL,"XhrLoader");let Uv=EL;const S0e={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},T0e=nn(nn({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:Number.POSITIVE_INFINITY,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,startOnSegmentBoundary:!1,maxBufferSize:60*1e3*1e3,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,liveSyncMode:"edge",liveSyncDurationCount:3,liveSyncOnStallIncrease:1,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,ignorePlaylistParsingErrors:!1,loader:Uv,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:aS,bufferController:FS,capLevelController:US,errorController:lS,fpsController:VS,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:M3,requireKeySystemAccessOnStart:!1,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,useMediaCapabilities:!0,preserveManualLevelOnError:!1,certLoadPolicy:{default:S0e},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}}},interstitialAssetListLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:3e4,timeoutRetry:{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:0,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},A0e()),{},{subtitleStreamController:QS,subtitleTrackController:zS,timelineController:oT,audioStreamController:CS,audioTrackController:DS,emeController:Cv,cmcdController:HS,contentSteeringController:GS,interstitialsController:ZS});function A0e(){return{cueHandler:g0e,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}
vendor: 27,367 bytes, line 3536
3536a(A0e,"timelineConfig");function x0e(t,e,n){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 i=lT(t),s=["manifest","level","frag"],r=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return s.forEach(o=>{const l=`${o==="level"?"playlist":o}LoadPolicy`,d=e[l]===void 0,c=[];r.forEach(u=>{const f=`${o}Loading${u}`,h=e[f];if(h!==void 0&&d){c.push(f);const p=i[l].default;switch(e[l]={default:p},u){case"TimeOut":p.maxLoadTimeMs=h,p.maxTimeToFirstByteMs=h;break;case"MaxRetry":p.errorRetry.maxNumRetry=h,p.timeoutRetry.maxNumRetry=h;break;case"RetryDelay":p.errorRetry.retryDelayMs=h,p.timeoutRetry.retryDelayMs=h;break;case"MaxRetryTimeout":p.errorRetry.maxRetryDelayMs=h,p.timeoutRetry.maxRetryDelayMs=h;break}}}),c.length&&n.warn(`hls.js config: "${c.join('", "')}" setting(s) are deprecated, use "${l}": ${hn(e[l])}`)}),nn(nn({},i),e)}a(x0e,"mergeConfig");function lT(t){return t&&typeof t=="object"?Array.isArray(t)?t.map(lT):Object.keys(t).reduce((e,n)=>(e[n]=lT(t[n]),e),{}):t}a(lT,"deepCpy");function I0e(t,e){const n=t.loader;n!==Fv&&n!==Uv?(e.log("[config]: Custom loader detected, cannot enable progressive streaming"),t.progressive=!1):m0e()&&(t.loader=Fv,t.progressive=!0,t.enableSoftwareAES=!0,e.log("[config]: Progressive streaming enabled, using FetchLoader"))}a(I0e,"enableStreamingMode");const Km=2,L0e=.1,R0e=.05,k0e=100,_L=class _L extends bv{constructor(e,n){super("gap-controller",e.logger),this.hls=null,this.fragmentTracker=null,this.media=null,this.mediaSource=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.buffered={},this.lastCurrentTime=0,this.ended=0,this.waiting=0,this.onMediaPlaying=()=>{this.ended=0,this.waiting=0},this.onMediaWaiting=()=>{var i;(i=this.media)!=null&&i.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{if(this.hls){var i;this.ended=((i=this.media)==null?void 0:i.currentTime)||1,this.hls.trigger(B.MEDIA_ENDED,{stalled:!1})}},this.hls=e,this.fragmentTracker=n,this.registerListeners()}registerListeners(){const{hls:e}=this;e&&(e.on(B.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(B.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(B.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(B.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(B.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(B.BUFFER_APPENDED,this.onBufferAppended,this))}destroy(){super.destroy(),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0}onMediaAttached(e,n){this.setInterval(k0e),this.mediaSource=n.mediaSource;const i=this.media=n.media;Ls(i,"playing",this.onMediaPlaying),Ls(i,"waiting",this.onMediaWaiting),Ls(i,"ended",this.onMediaEnded)}onMediaDetaching(e,n){this.clearInterval();const{media:i}=this;i&&(zs(i,"playing",this.onMediaPlaying),zs(i,"waiting",this.onMediaWaiting),zs(i,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(e,n){this.buffered=n.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}tick(){var e;if(!((e=this.media)!=null&&e.readyState)||!this.hasBuffered)return;const n=this.media.currentTime;this.poll(n,this.lastCurrentTime),this.lastCurrentTime=n}poll(e,n){var i,s;const r=(i=this.hls)==null?void 0:i.config;if(!r)return;const o=this.media;if(!o)return;const{seeking:l}=o,d=this.seeking&&!l,c=!this.seeking&&l,u=o.paused&&!l||o.ended||o.playbackRate===0;if(this.seeking=l,e!==n){n&&(this.ended=0),this.moved=!0,l||(this.nudgeRetry=0,r.nudgeOnVideoHole&&!u&&e>n&&this.nudgeOnVideoHole(e,n)),this.waiting===0&&this.stallResolved(e);return}if(c||d){d&&this.stallResolved(e);return}if(u){this.nudgeRetry=0,this.stallResolved(e),!this.ended&&o.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(B.MEDIA_ENDED,{stalled:!1}));return}if(!gt.getBuffered(o).length){this.nudgeRetry=0;return}const f=gt.bufferInfo(o,e,0),h=f.nextStart||0,p=this.fragmentTracker;if(l&&p&&this.hls){const H=FP(this.hls.inFlightFragments,e),N=f.len>Km,$=!h||H||h-e>Km&&!p.getPartialFragment(e);if(N||$)return;this.moved=!1}const g=(s=this.hls)==null?void 0:s.latestLevelDetails;if(!this.moved&&this.stalled!==null&&p){if(!(f.len>0)&&!h)return;const N=Math.max(h,f.start||0)-e,F=!!(g!=null&&g.live)?g.targetduration*2:Km,D=p.getPartialFragment(e);if(N>0&&(N<=F||D)){o.paused||this._trySkipBufferHole(D);return}}const v=r.detectStallWithCurrentTimeMs,y=self.performance.now(),b=this.waiting;let E=this.stalled;if(E===null)if(b>0&&y-b<v)E=this.stalled=b;else{this.stalled=y;return}const T=y-E;if(!l&&(T>=v||b)&&this.hls){var I;if(((I=this.mediaSource)==null?void 0:I.readyState)==="ended"&&!(g!=null&&g.live)&&Math.abs(e-(g?.edge||0))<1){if(this.ended)return;this.ended=e||1,this.hls.trigger(B.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(f),!this.media||!this.hls)return}const M=gt.bufferInfo(o,e,r.maxBufferHole);this._tryFixBufferStall(M,T,e)}stallResolved(e){const n=this.stalled;if(n&&this.hls&&(this.stalled=null,this.stallReported)){const i=self.performance.now()-n;this.log(`playback not stuck anymore @${e}, after ${Math.round(i)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(B.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,n){var i;const s=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&(i=this.buffered.audio)!=null&&i.length&&s&&s.length>1&&e>s.end(0)){const r=gt.bufferedInfo(gt.timeRangesToArray(this.buffered.audio),e,0);if(r.len>1&&n>=r.start){const o=gt.timeRangesToArray(s),l=gt.bufferedInfo(o,n,0).bufferedIndex;if(l>-1&&l<o.length-1){const d=gt.bufferedInfo(o,e,0).bufferedIndex,c=o[l].end,u=o[l+1].start;if((d===-1||d>l)&&u-c<1&&e-c<2){const f=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${c} -> ${u} buffered index: ${d}`);this.warn(f.message),this.media.currentTime+=1e-6;const h=this.fragmentTracker.getPartialFragment(e)||void 0,p=gt.bufferInfo(this.media,e,0);this.hls.trigger(B.ERROR,{type:Ge.MEDIA_ERROR,details:de.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:f,reason:f.message,frag:h,buffer:p.len,bufferInfo:p})}}}}}_tryFixBufferStall(e,n,i){var s,r;const{fragmentTracker:o,media:l}=this,d=(s=this.hls)==null?void 0:s.config;if(!l||!o||!d)return;const c=(r=this.hls)==null?void 0:r.latestLevelDetails,u=o.getPartialFragment(i);if((u||c!=null&&c.live&&i<c.fragmentStart)&&(this._trySkipBufferHole(u)||!this.media))return;const f=e.buffered,h=this.adjacentTraversal(e,i);(f&&f.length>1&&e.len>d.maxBufferHole||e.nextStart&&(e.nextStart-i<d.maxBufferHole||h))&&(n>d.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}adjacentTraversal(e,n){const i=this.fragmentTracker,s=e.nextStart;if(i&&s){const r=i.getFragAtPos(n,Ue.MAIN),o=i.getFragAtPos(s,Ue.MAIN);if(r&&o)return o.sn-r.sn<2}return!1}_reportStall(e){const{hls:n,media:i,stallReported:s,stalled:r}=this;if(!s&&r!==null&&i&&n){this.stallReported=!0;const o=new Error(`Playback stalling at @${i.currentTime} due to low buffer (${hn(e)})`);this.warn(o.message),n.trigger(B.ERROR,{type:Ge.MEDIA_ERROR,details:de.BUFFER_STALLED_ERROR,fatal:!1,error:o,buffer:e.len,bufferInfo:e,stalled:{start:r}})}}_trySkipBufferHole(e){var n;const{fragmentTracker:i,media:s}=this,r=(n=this.hls)==null?void 0:n.config;if(!s||!i||!r)return 0;const o=s.currentTime,l=gt.bufferInfo(s,o,0),d=o<l.start?l.start:l.nextStart;if(d&&this.hls){const u=l.len<=r.maxBufferHole,f=l.len>0&&l.len<1&&s.readyState<3,h=d-o;if(h>0&&(u||f)){if(h>r.maxBufferHole){let g=!1;if(o===0){const v=i.getAppendedFrag(0,Ue.MAIN);v&&d<v.end&&(g=!0)}if(!g){const v=e||i.getAppendedFrag(o,Ue.MAIN);if(v){var c;if(!((c=this.hls.loadLevelObj)!=null&&c.details)||FP(this.hls.inFlightFragments,d))return 0;let b=!1,E=v.end;for(;E<d;){const T=i.getAppendedFrag(E,Ue.MAIN)||i.getPartialFragment(E);if(T)E+=T.duration;else{b=!0;break}}if(b)return 0}}}const p=Math.max(d+R0e,o+L0e);if(this.warn(`skipping hole, adjusting currentTime from ${o} to ${p}`),this.moved=!0,s.currentTime=p,!(e!=null&&e.gap)){const g=new Error(`fragment loaded with buffer holes, seeking from ${o} to ${p}`);this.hls.trigger(B.ERROR,{type:Ge.MEDIA_ERROR,details:de.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:g,reason:g.message,frag:e||void 0,buffer:l.len,bufferInfo:l})}return p}}return 0}_tryNudgeBuffer(e){const{hls:n,media:i,nudgeRetry:s}=this,r=n?.config;if(!i||!r)return 0;const o=i.currentTime;if(this.nudgeRetry++,s<r.nudgeMaxRetry){const l=o+(s+1)*r.nudgeOffset,d=new Error(`Nudging 'currentTime' from ${o} to ${l}`);this.warn(d.message),i.currentTime=l,n.trigger(B.ERROR,{type:Ge.MEDIA_ERROR,details:de.BUFFER_NUDGE_ON_STALL,error:d,fatal:!1,buffer:e.len,bufferInfo:e})}else{const l=new Error(`Playhead still not moving while enough data buffered @${o} after ${r.nudgeMaxRetry} nudges`);this.error(l.message),n.trigger(B.ERROR,{type:Ge.MEDIA_ERROR,details:de.BUFFER_STALLED_ERROR,error:l,fatal:!0,buffer:e.len,bufferInfo:e})}}};a(_L,"GapController");let cT=_L;function FP(t,e){const n=UP(t.main);if(n&&n.start<=e)return n;const i=UP(t.audio);return i&&i.start<=e?i:null}a(FP,"getInFlightDependency");function UP(t){if(!t)return null;switch(t.state){case be.IDLE:case be.STOPPED:case be.ENDED:case be.ERROR:return null}return t.frag}a(UP,"inFlight");const M0e=.25;function dT(){if(!(typeof self>"u"))return self.VTTCue||self.TextTrackCue}a(dT,"getCueClass");function BP(t,e,n,i,s){let r=new t(e,n,"");try{r.value=i,s&&(r.type=s)}catch{r=new t(e,n,hn(s?nn({type:s},i):i))}return r}a(BP,"createCueWithDataFields");const Jg=(()=>{const t=dT();try{t&&new t(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})(),wL=class wL{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger(B.EVENT_CUE_ENTER,{})},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null}_registerListeners(){const{hls:e}=this;e.on(B.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(B.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(B.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(B.MANIFEST_LOADING,this.onManifestLoading,this),e.on(B.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(B.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(B.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(B.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this)}_unregisterListeners(){const{hls:e}=this;e.off(B.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(B.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(B.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(B.MANIFEST_LOADING,this.onManifestLoading,this),e.off(B.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(B.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(B.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(B.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this)}onMediaAttaching(e,n){var i;this.media=n.media,((i=n.overrides)==null?void 0:i.cueRemoval)===!1&&(this.removeCues=!1)}onMediaAttached(){const e=this.hls.latestLevelDetails;e&&this.updateDateRangeCues(e)}onMediaDetaching(e,n){this.media=null,!n.transferMedia&&(this.id3Track&&(this.removeCues&&rd(this.id3Track,this.onEventCueEnter),this.id3Track=null),this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const n=this.getID3Track(e.textTracks);return n.mode="hidden",n}getID3Track(e){if(this.media){for(let n=0;n<e.length;n++){const i=e[n];if(i.kind==="metadata"&&i.label==="id3")return u4(i,this.media),i}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,n){if(!this.media)return;const{hls:{config:{enableEmsgMetadataCues:i,enableID3MetadataCues:s}}}=this;if(!i&&!s)return;const{samples:r}=n;this.id3Track||(this.id3Track=this.createTrack(this.media));const o=dT();if(o)for(let l=0;l<r.length;l++){const d=r[l].type;if(d===us.emsg&&!i||!s)continue;const c=q3(r[l].data);if(c){const u=r[l].pts;let f=u+r[l].duration;f>Jg&&(f=Jg),f-u<=0&&(f=u+M0e);for(let p=0;p<c.length;p++){const g=c[p];if(!j3(g)){this.updateId3CueEnds(u,d);const v=BP(o,u,f,g,d);v&&this.id3Track.addCue(v)}}}}}updateId3CueEnds(e,n){var i;const s=(i=this.id3Track)==null?void 0:i.cues;if(s)for(let r=s.length;r--;){const o=s[r];o.type===n&&o.startTime<e&&o.endTime===Jg&&(o.endTime=e)}}onBufferFlushing(e,{startOffset:n,endOffset:i,type:s}){const{id3Track:r,hls:o}=this;if(!o)return;const{config:{enableEmsgMetadataCues:l,enableID3MetadataCues:d}}=o;if(r&&(l||d)){let c;s==="audio"?c=a(u=>u.type===us.audioId3&&d,"predicate"):s==="video"?c=a(u=>u.type===us.emsg&&l,"predicate"):c=a(u=>u.type===us.audioId3&&d||u.type===us.emsg&&l,"predicate"),WS(r,n,i,c)}}onLevelUpdated(e,{details:n}){this.updateDateRangeCues(n,!0)}onLevelPtsUpdated(e,n){Math.abs(n.drift)>.01&&this.updateDateRangeCues(n.details)}updateDateRangeCues(e,n){if(!this.media||!e.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{id3Track:i}=this,{dateRanges:s}=e,r=Object.keys(s);let o=this.dateRangeCuesAppended;if(i&&n){var l;if((l=i.cues)!=null&&l.length){const u=Object.keys(o).filter(f=>!r.includes(f));for(let f=u.length;f--;){const h=u[f],p=o[h].cues;delete o[h],Object.keys(p).forEach(g=>{try{const v=p[g];v.removeEventListener("enter",this.onEventCueEnter),i.removeCue(v)}catch{}})}}else o=this.dateRangeCuesAppended={}}const d=e.fragments[e.fragments.length-1];if(r.length===0||!Pe(d?.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const c=dT();for(let u=0;u<r.length;u++){const f=r[u],h=s[f],p=h.startTime,g=o[f],v=g?.cues||{};let y=g?.durationKnown||!1,b=Jg;const{duration:E,endDate:T}=h;if(T&&E!==null)b=p+E,y=!0;else if(h.endOnNext&&!y){const M=r.reduce((H,N)=>{if(N!==h.id){const $=s[N];if($.class===h.class&&$.startDate>h.startDate&&(!H||h.startDate<H.startDate))return $}return H},null);M&&(b=M.startTime,y=!0)}const I=Object.keys(h.attr);for(let M=0;M<I.length;M++){const H=I[M];if(!Wpe(H))continue;const N=v[H];if(N)y&&!g.durationKnown?N.endTime=b:Math.abs(N.startTime-p)>.01&&(N.startTime=p,N.endTime=b);else if(c){let $=h.attr[H];zpe(H)&&($=p3($));const D=BP(c,p,b,{key:H,data:$},us.dateRange);D&&(D.id=f,this.id3Track.addCue(D),v[H]=D,this.hls.config.interstitialsController&&(H==="X-ASSET-LIST"||H==="X-ASSET-URL")&&D.addEventListener("enter",this.onEventCueEnter))}}o[f]={cues:v,dateRange:h,durationKnown:y}}}};a(wL,"ID3TrackController");let uT=wL;const SL=class SL{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.currentTime=0,this.stallCount=0,this._latency=null,this._targetLatencyUpdated=!1,this.onTimeupdate=()=>{const{media:n}=this,i=this.levelDetails;if(!n||!i)return;this.currentTime=n.currentTime;const s=this.computeLatency();if(s===null)return;this._latency=s;const{lowLatencyMode:r,maxLiveSyncPlaybackRate:o}=this.config;if(!r||o===1||!i.live)return;const l=this.targetLatency;if(l===null)return;const d=s-l,c=Math.min(this.maxLatency,l+i.targetduration);if(d<c&&d>.05&&this.forwardBufferLength>1){const f=Math.min(2,Math.max(1,o)),h=Math.round(2/(1+Math.exp(-.75*d-this.edgeStalled))*20)/20,p=Math.min(f,Math.max(1,h));this.changeMediaPlaybackRate(n,p)}else n.playbackRate!==1&&n.playbackRate!==0&&this.changeMediaPlaybackRate(n,1)},this.hls=e,this.config=e.config,this.registerListeners()}get levelDetails(){var e;return((e=this.hls)==null?void 0:e.latestLevelDetails)||null}get latency(){return this._latency||0}get maxLatency(){const{config:e}=this;if(e.liveMaxLatencyDuration!==void 0)return e.liveMaxLatencyDuration;const n=this.levelDetails;return n?e.liveMaxLatencyDurationCount*n.targetduration:0}get targetLatency(){const e=this.levelDetails;if(e===null||this.hls===null)return null;const{holdBack:n,partHoldBack:i,targetduration:s}=e,{liveSyncDuration:r,liveSyncDurationCount:o,lowLatencyMode:l}=this.config,d=this.hls.userConfig;let c=l&&i||n;(this._targetLatencyUpdated||d.liveSyncDuration||d.liveSyncDurationCount||c===0)&&(c=r!==void 0?r:o*s);const u=s;return c+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,u)}set targetLatency(e){this.stallCount=0,this.config.liveSyncDuration=e,this._targetLatencyUpdated=!0}get liveSyncPosition(){const e=this.estimateLiveEdge(),n=this.targetLatency;if(e===null||n===null)return null;const i=this.levelDetails;if(i===null)return null;const s=i.edge,r=e-n-this.edgeStalled,o=s-i.totalduration,l=s-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(o,r),l)}get drift(){const e=this.levelDetails;return e===null?1:e.drift}get edgeStalled(){const e=this.levelDetails;if(e===null)return 0;const n=(this.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-n,0)}get forwardBufferLength(){const{media:e}=this,n=this.levelDetails;if(!e||!n)return 0;const i=e.buffered.length;return(i?e.buffered.end(i-1):n.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){const{hls:e}=this;e&&(e.on(B.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(B.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(B.MANIFEST_LOADING,this.onManifestLoading,this),e.on(B.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(B.ERROR,this.onError,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(B.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(B.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(B.MANIFEST_LOADING,this.onManifestLoading,this),e.off(B.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(B.ERROR,this.onError,this))}onMediaAttached(e,n){this.media=n.media,this.media.addEventListener("timeupdate",this.onTimeupdate)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.onTimeupdate),this.media=null)}onManifestLoading(){this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:n}){n.advanced&&this.onTimeupdate(),!n.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)}onError(e,n){var i;n.details===de.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&(i=this.levelDetails)!=null&&i.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}changeMediaPlaybackRate(e,n){var i,s;e.playbackRate!==n&&((i=this.hls)==null||i.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${(s=this.targetLatency)==null?void 0:s.toFixed(3)}, forwardBufferLength=${this.forwardBufferLength.toFixed(3)}: adjusting playback rate from ${e.playbackRate} to ${n}`),e.playbackRate=n)}estimateLiveEdge(){const e=this.levelDetails;return e===null?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}};a(SL,"LatencyController");let fT=SL;const TL=class TL extends Hh{constructor(e,n){super(e,"level-controller"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=n,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(B.MANIFEST_LOADING,this.onManifestLoading,this),e.on(B.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(B.LEVEL_LOADED,this.onLevelLoaded,this),e.on(B.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(B.FRAG_BUFFERED,this.onFragBuffered,this),e.on(B.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(B.MANIFEST_LOADING,this.onManifestLoading,this),e.off(B.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(B.LEVEL_LOADED,this.onLevelLoaded,this),e.off(B.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(B.FRAG_BUFFERED,this.onFragBuffered,this),e.off(B.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(n=>{n.loadError=0,n.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,n){this.resetLevels()}onManifestLoaded(e,n){const i=this.hls.config.preferManagedMediaSource,s=[],r={},o={};let l=!1,d=!1,c=!1;n.levels.forEach(u=>{const f=u.attrs;let{audioCodec:h,videoCodec:p}=u;h&&(u.audioCodec=h=hv(h,i)||void 0),p&&(p=u.videoCodec=mpe(p));const{width:g,height:v,unknownCodecs:y}=u;let b=y?y.length:0;if(y)for(let D=b;D--;){const L=y[D];this.isAudioSupported(L)?(u.audioCodec=h=h?`${h},${L}`:L,b--,Jd.audio[h.substring(0,4)]=2):this.isVideoSupported(L)&&(u.videoCodec=p=p?`${p},${L}`:L,b--,Jd.video[p.substring(0,4)]=2)}if(l||(l=!!(g&&v)),d||(d=!!p),c||(c=!!h),b||h&&!this.isAudioSupported(h)||p&&!this.isVideoSupported(p)){this.log(`Some or all CODECS not supported "${f.CODECS}"`);return}const{CODECS:E,"FRAME-RATE":T,"HDCP-LEVEL":I,"PATHWAY-ID":M,RESOLUTION:H,"VIDEO-RANGE":N}=f,F=`${`${M||"."}-`}${u.bitrate}-${H}-${T}-${E}-${N}-${I}`;if(r[F])if(r[F].uri!==u.url&&!u.attrs["PATHWAY-ID"]){const D=o[F]+=1;u.attrs["PATHWAY-ID"]=new Array(D+1).join(".");const L=this.createLevel(u);r[F]=L,s.push(L)}else r[F].addGroupId("audio",f.AUDIO),r[F].addGroupId("text",f.SUBTITLES);else{const D=this.createLevel(u);r[F]=D,o[F]=1,s.push(D)}}),this.filterAndSortMediaOptions(s,n,l,d,c)}createLevel(e){const n=new Yl(e),i=e.supplemental;if(i!=null&&i.videoCodec&&!this.isVideoSupported(i.videoCodec)){const s=new Error(`SUPPLEMENTAL-CODECS not supported "${i.videoCodec}"`);this.log(s.message),n.supportedResult=S3(s,[])}return n}isAudioSupported(e){return sS(e,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return sS(e,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,n,i,s,r){let o=[],l=[],d=e;if((i||s)&&r&&(d=d.filter(({videoCodec:y,videoRange:b,width:E,height:T})=>(!!y||!!(E&&T))&&Tpe(b))),d.length===0){Promise.resolve().then(()=>{if(this.hls){let y="no level with compatible codecs found in manifest",b=y;n.levels.length&&(b=`one or more CODECS in variant not supported: ${hn(n.levels.map(T=>T.attrs.CODECS).filter((T,I,M)=>M.indexOf(T)===I))}`,this.warn(b),y+=` (${b})`);const E=new Error(y);this.hls.trigger(B.ERROR,{type:Ge.MEDIA_ERROR,details:de.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:n.url,error:E,reason:b})}});return}n.audioTracks&&(o=n.audioTracks.filter(y=>!y.audioCodec||this.isAudioSupported(y.audioCodec)),$P(o)),n.subtitles&&(l=n.subtitles,$P(l));const c=d.slice(0);d.sort((y,b)=>{if(y.attrs["HDCP-LEVEL"]!==b.attrs["HDCP-LEVEL"])return(y.attrs["HDCP-LEVEL"]||"")>(b.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&y.height!==b.height)return y.height-b.height;if(y.frameRate!==b.frameRate)return y.frameRate-b.frameRate;if(y.videoRange!==b.videoRange)return pv.indexOf(y.videoRange)-pv.indexOf(b.videoRange);if(y.videoCodec!==b.videoCodec){const E=BC(y.videoCodec),T=BC(b.videoCodec);if(E!==T)return T-E}if(y.uri===b.uri&&y.codecSet!==b.codecSet){const E=fv(y.codecSet),T=fv(b.codecSet);if(E!==T)return T-E}return y.averageBitrate!==b.averageBitrate?y.averageBitrate-b.averageBitrate:0});let u=c[0];if(this.steering&&(d=this.steering.filterParsedLevels(d),d.length!==c.length)){for(let y=0;y<c.length;y++)if(c[y].pathwayId===d[0].pathwayId){u=c[y];break}}this._levels=d;for(let y=0;y<d.length;y++)if(d[y]===u){var f;this._firstLevel=y;const b=u.bitrate,E=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${d.length} level(s) found, first bitrate: ${b}`),((f=this.hls.userConfig)==null?void 0:f.abrEwmaDefaultEstimate)===void 0){const T=Math.min(b,this.hls.config.abrEwmaDefaultEstimateMax);T>E&&E===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=T)}break}const h=r&&!s,p=this.hls.config,g=!!(p.audioStreamController&&p.audioTrackController),v={levels:d,audioTracks:o,subtitleTracks:l,sessionData:n.sessionData,sessionKeys:n.sessionKeys,firstLevel:this._firstLevel,stats:n.stats,audio:r,video:s,altAudio:g&&!h&&o.some(y=>!!y.url)};this.hls.trigger(B.MANIFEST_PARSED,v)}get levels(){return this._levels.length===0?null:this._levels}get loadLevelObj(){return this.currentLevel}get level(){return this.currentLevelIndex}set level(e){const n=this._levels;if(n.length===0)return;if(e<0||e>=n.length){const u=new Error("invalid level idx"),f=e<0;if(this.hls.trigger(B.ERROR,{type:Ge.OTHER_ERROR,details:de.LEVEL_SWITCH_ERROR,level:e,fatal:f,error:u,reason:u.message}),f)return;e=Math.min(e,n.length-1)}const i=this.currentLevelIndex,s=this.currentLevel,r=s?s.attrs["PATHWAY-ID"]:void 0,o=n[e],l=o.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=o,i===e&&s&&r===l)return;this.log(`Switching to level ${e} (${o.height?o.height+"p ":""}${o.videoRange?o.videoRange+" ":""}${o.codecSet?o.codecSet+" ":""}@${o.bitrate})${l?" with Pathway "+l:""} from level ${i}${r?" with Pathway "+r:""}`);const d={level:e,attrs:o.attrs,details:o.details,bitrate:o.bitrate,averageBitrate:o.averageBitrate,maxBitrate:o.maxBitrate,realBitrate:o.realBitrate,width:o.width,height:o.height,codecSet:o.codecSet,audioCodec:o.audioCodec,videoCodec:o.videoCodec,audioGroups:o.audioGroups,subtitleGroups:o.subtitleGroups,loaded:o.loaded,loadError:o.loadError,fragmentError:o.fragmentError,name:o.name,id:o.id,uri:o.uri,url:o.url,urlId:0,audioGroupIds:o.audioGroupIds,textGroupIds:o.textGroupIds};this.hls.trigger(B.LEVEL_SWITCHING,d);const c=o.details;if(!c||c.live){const u=this.switchParams(o.uri,s?.details,c);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.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}get pathways(){return this.steering?this.steering.pathways():[]}get pathwayPriority(){return this.steering?this.steering.pathwayPriority:null}set pathwayPriority(e){if(this.steering){const n=this.steering.pathways(),i=e.filter(s=>n.indexOf(s)!==-1);if(e.length<1){this.warn(`pathwayPriority ${e} should contain at least one pathway from list: ${n}`);return}this.steering.pathwayPriority=i}}onError(e,n){n.fatal||!n.context||n.context.type===wt.LEVEL&&n.context.level===this.level&&this.checkRetry(n)}onFragBuffered(e,{frag:n}){if(n!==void 0&&n.type===Ue.MAIN){const i=n.elementaryStreams;if(!Object.keys(i).some(r=>!!i[r]))return;const s=this._levels[n.level];s!=null&&s.loadError&&(this.log(`Resetting level error count of ${s.loadError} on frag buffered`),s.loadError=0)}}onLevelLoaded(e,n){var i;const{level:s,details:r}=n,o=n.levelInfo;if(!o){var l;this.warn(`Invalid level index ${s}
3536`),(l=n.deliveryDirectives)!=null&&l.skip&&(r.deltaUpdateFailed=!0);return}if(o===this.currentLevel||n.withoutMultiVariant){o.fragmentError===0&&(o.loadError=0);let d=o.details;d===n.details&&d.advanced&&(d=void 0),this.playlistLoaded(s,n,d)}else(i=n.deliveryDirectives)!=null&&i.skip&&(r.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)}loadingPlaylist(e,n){super.loadingPlaylist(e,n);const i=this.getUrlWithDirectives(e.uri,n),s=this.currentLevelIndex,r=e.attrs["PATHWAY-ID"],o=e.details,l=o?.age;this.log(`Loading level index ${s}${n?.msn!==void 0?" at sn "+n.msn+" part "+n.part:""}${r?" Pathway "+r:""}${l&&o.live?" age "+l.toFixed(1)+(o.type&&" "+o.type||""):""} ${i}`),this.hls.trigger(B.LEVEL_LOADING,{url:i,level:s,levelInfo:e,pathwayId:e.attrs["PATHWAY-ID"],id:0,deliveryDirectives:n||null})}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var n;if(this._levels.length===1)return;const i=this._levels.filter((r,o)=>o!==e?!0:(this.steering&&this.steering.removeLevel(r),r===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,r.details&&r.details.fragments.forEach(l=>l.level=-1)),!1));U3(i),this._levels=i,this.currentLevelIndex>-1&&(n=this.currentLevel)!=null&&n.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);const s=i.length-1;this._firstLevel=Math.min(this._firstLevel,s),this._startLevel&&(this._startLevel=Math.min(this._startLevel,s)),this.hls.trigger(B.LEVELS_UPDATED,{levels:i})}onLevelsUpdated(e,{levels:n}){this._levels=n}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:n,maxHdcpLevel:i}=this.hls;this._maxAutoLevel!==n&&(this._maxAutoLevel=n,this.hls.trigger(B.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:n,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:i}))}};a(TL,"LevelController");let hT=TL;function $P(t){const e={};t.forEach(n=>{const i=n.groupId||"";n.id=e[i]=e[i]||0,e[i]++})}a($P,"assignTrackIdsByGroup");function w4(){return self.SourceBuffer||self.WebKitSourceBuffer}a(w4,"getSourceBuffer");function S4(){if(!Ua())return!1;const e=w4();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}a(S4,"isMSESupported");function C0e(){if(!S4())return!1;const t=Ua();return typeof t?.isTypeSupported=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>t.isTypeSupported(Ch(e,"video")))||["mp4a.40.2","fLaC"].some(e=>t.isTypeSupported(Ch(e,"audio"))))}a(C0e,"isSupported");function P0e(){var t;const e=w4();return typeof(e==null||(t=e.prototype)==null?void 0:t.changeType)=="function"}a(P0e,"changeTypeSupported");const D0e=100,AL=class AL extends Nh{constructor(e,n,i){super(e,n,i,"stream-controller",Ue.MAIN),this.audioCodecSwap=!1,this.level=-1,this._forceStartLoad=!1,this._hasEnoughToStart=!1,this.altAudio=0,this.audioOnly=!1,this.fragPlaying=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this.onMediaPlaying=()=>{this.tick()},this.onMediaSeeked=()=>{const s=this.media,r=s?s.currentTime:null;if(r===null||!Pe(r)||(this.log(`Media seeked to ${r.toFixed(3)}`),!this.getBufferedFrag(r)))return;
vendor: 7,126 bytes, line 3536
3536const o=this.getFwdBufferInfoAtPos(s,r,Ue.MAIN,0);if(o===null||o.len===0){this.warn(`Main forward buffer length at ${r} on "seeked" event ${o?o.len:"empty"})`);return}this.tick()},this.registerListeners()}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(B.MANIFEST_PARSED,this.onManifestParsed,this),e.on(B.LEVEL_LOADING,this.onLevelLoading,this),e.on(B.LEVEL_LOADED,this.onLevelLoaded,this),e.on(B.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(B.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(B.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(B.BUFFER_CREATED,this.onBufferCreated,this),e.on(B.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(B.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(B.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(B.MANIFEST_PARSED,this.onManifestParsed,this),e.off(B.LEVEL_LOADED,this.onLevelLoaded,this),e.off(B.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(B.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(B.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(B.BUFFER_CREATED,this.onBufferCreated,this),e.off(B.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(B.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(B.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}startLoad(e,n){if(this.levels){const{lastCurrentTime:i,hls:s}=this;if(this.stopLoad(),this.setInterval(D0e),this.level=-1,!this.startFragRequested){let r=s.startLevel;r===-1&&(s.config.testBandwidth&&this.levels.length>1?(r=0,this.bitrateTest=!0):r=s.firstAutoLevel),s.nextLoadLevel=r,this.level=s.loadLevel,this._hasEnoughToStart=!!n}i>0&&e===-1&&!n&&(this.log(`Override startPosition with lastCurrentTime @${i.toFixed(3)}`),e=i),this.state=be.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=n?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=be.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case be.WAITING_LEVEL:{const{levels:n,level:i}=this,s=n?.[i],r=s?.details;if(r&&(!r.live||this.levelLastLoaded===s&&!this.waitForLive(s))){if(this.waitForCdnTuneIn(r))break;this.state=be.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=be.IDLE;break}break}case be.FRAG_LOADING_WAITING_RETRY:{var e;const n=self.performance.now(),i=this.retryDate;if(!i||n>=i||(e=this.media)!=null&&e.seeking){const{levels:s,level:r}=this,o=s?.[r];this.resetStartWhenNotLoaded(o||null),this.state=be.IDLE}}break}this.state===be.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var e;super.onTickEnd(),(e=this.media)!=null&&e.readyState&&this.media.seeking===!1&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:n,levels:i,media:s}=this;if(n===null||!s&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const r=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(i!=null&&i[r]))return;const o=i[r],l=this.getMainFwdBufferInfo();if(l===null)return;const d=this.getLevelDetails();if(d&&this._streamEnded(l,d)){const v={};this.altAudio===2&&(v.type="video"),this.hls.trigger(B.BUFFER_EOS,v),this.state=be.ENDED;return}if(!this.buffering)return;e.loadLevel!==r&&e.manualLevel===-1&&this.log(`Adapting to level ${r} from level ${this.level}`),this.level=e.nextLoadLevel=r;const c=o.details;if(!c||this.state===be.WAITING_LEVEL||this.waitForLive(o)){this.level=r,this.state=be.WAITING_LEVEL,this.startFragRequested=!1;return}const u=l.len,f=this.getMaxBufferLength(o.maxBitrate);if(u>=f)return;this.backtrackFragment&&this.backtrackFragment.start>l.end&&(this.backtrackFragment=null);const h=this.backtrackFragment?this.backtrackFragment.start:l.end;let p=this.getNextFragment(h,c);if(this.couldBacktrack&&!this.fragPrevious&&p&&$n(p)&&this.fragmentTracker.getState(p)!==Kn.OK){var g;const y=((g=this.backtrackFragment)!=null?g:p).sn-c.startSN,b=c.fragments[y-1];b&&p.cc===b.cc&&(p=b,this.fragmentTracker.removeFragment(b))}else this.backtrackFragment&&l.len&&(this.backtrackFragment=null);if(p&&this.isLoopLoading(p,h)){if(!p.gap){const y=this.audioOnly&&!this.altAudio?ln.AUDIO:ln.VIDEO,b=(y===ln.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;b&&this.afterBufferFlushed(b,y,Ue.MAIN)}p=this.getNextFragmentLoopLoading(p,c,l,Ue.MAIN,f)}p&&(p.initSegment&&!p.initSegment.data&&!this.bitrateTest&&(p=p.initSegment),this.loadFragment(p,o,h))}loadFragment(e,n,i){const s=this.fragmentTracker.getState(e);s===Kn.NOT_LOADED||s===Kn.PARTIAL?$n(e)?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,n)):super.loadFragment(e,n,i):this._loadInitSegment(e,n):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,Ue.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:n}=this;if(n!=null&&n.readyState){let i;const s=this.getAppendedFrag(n.currentTime);s&&s.start>1&&this.flushMainBuffer(0,s.start-1);const r=this.getLevelDetails();if(r!=null&&r.live){const l=this.getMainFwdBufferInfo();if(!l||l.len<r.targetduration*2)return}if(!n.paused&&e){const l=this.hls.nextLoadLevel,d=e[l],c=this.fragLastKbps;c&&this.fragCurrent?i=this.fragCurrent.duration*d.maxBitrate/(1e3*c)+1:i=0}else i=0;const o=this.getBufferedFrag(n.currentTime+i);if(o){const l=this.followingBufferedFrag(o);if(l){this.abortCurrentFrag();const d=l.maxStartPTS?l.maxStartPTS:l.start,c=l.duration,u=Math.max(o.end,d+Math.min(Math.max(c-this.config.maxFragLookUpTolerance,c*(this.couldBacktrack?.5:.125)),c*(this.couldBacktrack?.75:.25)));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 be.KEY_LOADING:case be.FRAG_LOADING:case be.FRAG_LOADING_WAITING_RETRY:case be.PARSING:case be.PARSED:this.state=be.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,n){super.flushMainBuffer(e,n,this.altAudio===2?"video":null)}onMediaAttached(e,n){super.onMediaAttached(e,n);const i=n.media;Ls(i,"playing",this.onMediaPlaying),Ls(i,"seeked",this.onMediaSeeked)}onMediaDetaching(e,n){const{media:i}=this;i&&(zs(i,"playing",this.onMediaPlaying),zs(i,"seeked",this.onMediaSeeked)),this.videoBuffer=null,this.fragPlaying=null,super.onMediaDetaching(e,n),!n.transferMedia&&(this._hasEnoughToStart=!1)}onManifestLoading(){super.onManifestLoading(),this.log("Trigger BUFFER_RESET"),this.hls.trigger(B.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.fragLastKbps=0,this.fragPlaying=this.backtrackFragment=null,this.altAudio=0,this.audioOnly=!1}onManifestParsed(e,n){let i=!1,s=!1;
vendor: 2,232 bytes, line 3536
3536n.levels.forEach(r=>{const o=r.audioCodec;o&&(i=i||o.indexOf("mp4a.40.2")!==-1,s=s||o.indexOf("mp4a.40.5")!==-1)}),this.audioCodecSwitch=i&&s&&!P0e(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=n.levels,this.startFragRequested=!1}onLevelLoading(e,n){const{levels:i}=this;if(!i||this.state!==be.IDLE)return;const s=n.levelInfo;(!s.details||s.details.live&&(this.levelLastLoaded!==s||s.details.expired)||this.waitForCdnTuneIn(s.details))&&(this.state=be.WAITING_LEVEL)}onLevelLoaded(e,n){var i;const{levels:s,startFragRequested:r}=this,o=n.level,l=n.details,d=l.totalduration;if(!s){this.warn(`Levels were reset while loading level ${o}`);return}this.log(`Level ${o} loaded [${l.startSN},${l.endSN}]${l.lastPartSn?`[part-${l.lastPartSn}-${l.lastPartIndex}]`:""}, cc [${l.startCC}, ${l.endCC}] duration:${d}`);const c=n.levelInfo,u=this.fragCurrent;u&&(this.state===be.FRAG_LOADING||this.state===be.FRAG_LOADING_WAITING_RETRY)&&u.level!==n.level&&u.loader&&this.abortCurrentFrag();let f=0;if(l.live||(i=c.details)!=null&&i.live){var h;if(this.checkLiveUpdate(l),l.deltaUpdateFailed)return;f=this.alignPlaylists(l,c.details,(h=this.levelLastLoaded)==null?void 0:h.details)}if(c.details=l,this.levelLastLoaded=c,r||this.setStartPosition(l,f),this.hls.trigger(B.LEVEL_UPDATED,{details:l,level:o}),this.state===be.WAITING_LEVEL){if(this.waitForCdnTuneIn(l))return;this.state=be.IDLE}r&&l.live&&this.synchronizeToLiveEdge(l),this.tick()}synchronizeToLiveEdge(e){const{config:n,media:i}=this;if(!i)return;const s=this.hls.liveSyncPosition,r=this.getLoadPosition(),o=e.fragmentStart,l=e.edge,d=r>=o-n.maxFragLookUpTolerance&&r<=l;if(s!==null&&i.duration>s&&(r<s||!d)){const u=n.liveMaxLatencyDuration!==void 0?n.liveMaxLatencyDuration:n.liveMaxLatencyDurationCount*e.targetduration;if((!d&&i.readyState<4||r<l-u)&&(this._hasEnoughToStart||(this.nextLoadPosition=s),i.readyState))if(this.warn(`Playback: ${r.toFixed(3)} is located too far from the end of live sliding playlist: ${l}, reset currentTime to : ${s.toFixed(3)}`),this.config.liveSyncMode==="buffered"){var c;const f=gt.bufferInfo(i,s,0);if(!(f!=null&&(c=f.buffered)!=null&&c.length)){i.currentTime=s;return}
vendor: 16,189 bytes, line 3536
3536if(f.start<=r){i.currentTime=s;return}const{nextStart:p}=gt.bufferedInfo(f.buffered,r,0);p&&(i.currentTime=p)}else i.currentTime=s}}_handleFragmentLoadProgress(e){var n;const i=e.frag,{part:s,payload:r}=e,{levels:o}=this;if(!o){this.warn(`Levels were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);return}const l=o[i.level];if(!l){this.warn(`Level ${i.level} not found on progress`);return}const d=l.details;if(!d){this.warn(`Dropping fragment ${i.sn} of level ${i.level} after level details were reset`),this.fragmentTracker.removeFragment(i);return}const c=l.videoCodec,u=d.PTSKnown||!d.live,f=(n=i.initSegment)==null?void 0:n.data,h=this._getAudioCodec(l),p=this.transmuxer=this.transmuxer||new kv(this.hls,Ue.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),g=s?s.index:-1,v=g!==-1,y=new Oh(i.level,i.sn,i.stats.chunkCount,r.byteLength,g,v),b=this.initPTS[i.cc];p.push(r,f,h,c,i,s,d.totalduration,u,y,b)}onAudioTrackSwitching(e,n){const i=this.hls,s=this.altAudio===2;if(mv(n.url,i))this.altAudio=1;else{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();if(s){this.fragmentTracker.removeAllFragments(),i.once(B.BUFFER_FLUSHED,()=>{var o;(o=this.hls)==null||o.trigger(B.AUDIO_TRACK_SWITCHED,n)}),i.trigger(B.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});return}i.trigger(B.AUDIO_TRACK_SWITCHED,n)}}onAudioTrackSwitched(e,n){const i=mv(n.url,this.hls);if(i){const s=this.videoBuffer;s&&this.mediaBuffer!==s&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=s)}this.altAudio=i?2:0,this.tick()}onBufferCreated(e,n){const i=n.tracks;let s,r,o=!1;for(const l in i){const d=i[l];if(d.id==="main"){if(r=l,s=d,l==="video"){const c=i[l];c&&(this.videoBuffer=c.buffer)}}else o=!0}o&&s?(this.log(`Alternate track found, use ${r}.buffered to schedule main fragment loading`),this.mediaBuffer=s.buffer):this.mediaBuffer=this.media}onFragBuffered(e,n){const{frag:i,part:s}=n,r=i.type===Ue.MAIN;if(r){if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${s?" p: "+s.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}`),this.state===be.PARSED&&(this.state=be.IDLE);return}const l=s?s.stats:i.stats;this.fragLastKbps=Math.round(8*l.total/(l.buffering.end-l.loading.first)),$n(i)&&(this.fragPrevious=i),this.fragBufferedComplete(i,s)}const o=this.media;o&&(!this._hasEnoughToStart&&gt.getBuffered(o).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),r&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,n){var i;if(n.fatal){this.state=be.ERROR;return}switch(n.details){case de.FRAG_GAP:case de.FRAG_PARSING_ERROR:case de.FRAG_DECRYPT_ERROR:case de.FRAG_LOAD_ERROR:case de.FRAG_LOAD_TIMEOUT:case de.KEY_LOAD_ERROR:case de.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Ue.MAIN,n);break;case de.LEVEL_LOAD_ERROR:case de.LEVEL_LOAD_TIMEOUT:case de.LEVEL_PARSING_ERROR:!n.levelRetry&&this.state===be.WAITING_LEVEL&&((i=n.context)==null?void 0:i.type)===wt.LEVEL&&(this.state=be.IDLE);break;case de.BUFFER_ADD_CODEC_ERROR:case de.BUFFER_APPEND_ERROR:if(n.parent!=="main")return;this.reduceLengthAndFlushBuffer(n)&&this.resetLoadingState();break;case de.BUFFER_FULL_ERROR:if(n.parent!=="main")return;this.reduceLengthAndFlushBuffer(n)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case de.INTERNAL_EXCEPTION:this.recoverWorkerError(n);break}}onFragLoadEmergencyAborted(){this.state=be.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:n}){if(n!==ln.AUDIO||!this.altAudio){const i=(n===ln.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;i&&(this.afterBufferFlushed(i,n,Ue.MAIN),this.tick())}}onLevelsUpdated(e,n){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,this.level===-1&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=n.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const n=e.currentTime;let i=this.startPosition;if(i>=0&&n<i){if(e.seeking){this.log(`could not seek to ${i}, already seeking at ${n}`);return}const s=this.timelineOffset;s&&i&&(i+=s);const r=this.getLevelDetails(),o=gt.getBuffered(e),l=o.length?o.start(0):0,d=l-i,c=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||d>0&&(d<c||this.loadingParts&&d<2*(r?.partTarget||0)))&&(this.log(`adjusting start position by ${d} to match buffer start`),i+=d,this.startPosition=i),n<i&&(this.log(`seek to target start position ${i} from current time ${n} buffer start ${l}`),e.currentTime=i)}}_getAudioCodec(e){let n=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&n&&(this.log("Swapping audio codec"),n.indexOf("mp4a.40.5")!==-1?n="mp4a.40.2":n="mp4a.40.5"),n}_loadBitrateTestFrag(e,n){e.bitrateTest=!0,this._doFragLoad(e,n).then(i=>{const{hls:s}=this,r=i?.frag;if(!r||this.fragContextChanged(r))return;n.fragmentError=0,this.state=be.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const o=r.stats;o.parsing.start=o.parsing.end=o.buffering.start=o.buffering.end=self.performance.now(),s.trigger(B.FRAG_LOADED,i),r.bitrateTest=!1})}_handleTransmuxComplete(e){var n;const i=this.playlistType,{hls:s}=this,{remuxResult:r,chunkMeta:o}=e,l=this.getCurrentContext(o);if(!l){this.resetWhenMissingContext(o);return}const{frag:d,part:c,level:u}=l,{video:f,text:h,id3:p,initSegment:g}=r,{details:v}=u,y=this.altAudio?void 0:r.audio;if(this.fragContextChanged(d)){this.fragmentTracker.removeFragment(d);return}if(this.state=be.PARSING,g){if(g!=null&&g.tracks){const I=d.initSegment||d;this._bufferInitSegment(u,g.tracks,I,o),s.trigger(B.FRAG_PARSING_INIT_SEGMENT,{frag:I,id:i,tracks:g.tracks})}const b=g.initPTS,E=g.timescale,T=this.initPTS[d.cc];Pe(b)&&(!T||T.baseTime!==b||T.timescale!==E)&&(this.initPTS[d.cc]={baseTime:b,timescale:E},s.trigger(B.INIT_PTS_FOUND,{frag:d,id:i,initPTS:b,timescale:E}))}if(f&&v){y&&f.type==="audiovideo"&&this.logMuxedErr(d);const b=v.fragments[d.sn-1-v.startSN],E=d.sn===v.startSN,T=!b||d.cc>b.cc;if(r.independent!==!1){const{startPTS:I,endPTS:M,startDTS:H,endDTS:N}=f;if(c)c.elementaryStreams[f.type]={startPTS:I,endPTS:M,startDTS:H,endDTS:N};else if(f.firstKeyFrame&&f.independent&&o.id===1&&!T&&(this.couldBacktrack=!0),f.dropped&&f.independent){const $=this.getMainFwdBufferInfo(),F=($?$.end:this.getLoadPosition())+this.config.maxBufferHole,D=f.firstKeyFramePTS?f.firstKeyFramePTS:I;if(!E&&F<D-this.config.maxBufferHole&&!T){this.backtrack(d);return}else T&&(d.gap=!0);d.setElementaryStreamInfo(f.type,d.start,M,d.start,N,!0)}else E&&I-(v.appliedTimelineOffset||0)>Km&&(d.gap=!0);d.setElementaryStreamInfo(f.type,I,M,H,N),this.backtrackFragment&&(this.backtrackFragment=d),this.bufferFragmentData(f,d,c,o,E||T)}else if(E||T)d.gap=!0;else{this.backtrack(d);return}}if(y){const{startPTS:b,endPTS:E,startDTS:T,endDTS:I}=y;c&&(c.elementaryStreams[ln.AUDIO]={startPTS:b,endPTS:E,startDTS:T,endDTS:I}),d.setElementaryStreamInfo(ln.AUDIO,b,E,T,I),this.bufferFragmentData(y,d,c,o)}if(v&&p!=null&&(n=p.samples)!=null&&n.length){const b={id:i,frag:d,details:v,samples:p.samples};s.trigger(B.FRAG_PARSING_METADATA,b)}if(v&&h){const b={id:i,frag:d,details:v,samples:h.samples};s.trigger(B.FRAG_PARSING_USERDATA,b)}}logMuxedErr(e){this.warn(`${$n(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,n,i,s){if(this.state!==be.PARSING)return;this.audioOnly=!!n.audio&&!n.video,this.altAudio&&!this.audioOnly&&(delete n.audio,n.audiovideo&&this.logMuxedErr(i));const{audio:r,video:o,audiovideo:l}=n;if(r){const c=e.audioCodec;let u=$m(r.codec,c);u==="mp4a"&&(u="mp4a.40.5");const f=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){u&&(u.indexOf("mp4a.40.5")!==-1?u="mp4a.40.2":u="mp4a.40.5");const h=r.metadata;h&&"channelCount"in h&&(h.channelCount||1)!==1&&f.indexOf("firefox")===-1&&(u="mp4a.40.5")}u&&u.indexOf("mp4a.40.5")!==-1&&f.indexOf("android")!==-1&&r.container!=="audio/mpeg"&&(u="mp4a.40.2",this.log(`Android: force audio codec to ${u}`)),c&&c!==u&&this.log(`Swapping manifest audio codec "${c}" for "${u}"`),r.levelCodec=u,r.id=Ue.MAIN,this.log(`Init audio buffer, container:${r.container}, codecs[selected/level/parsed]=[${u||""}/${c||""}/${r.codec}]`),delete n.audiovideo}if(o){o.levelCodec=e.videoCodec,o.id=Ue.MAIN;const c=o.codec;if(c?.length===4)switch(c){case"hvc1":case"hev1":o.codec="hvc1.1.6.L120.90";break;case"av01":o.codec="av01.0.04M.08";break;case"avc1":o.codec="avc1.42e01e";break}this.log(`Init video buffer, container:${o.container}, codecs[level/parsed]=[${e.videoCodec||""}/${c}]${o.codec!==c?" parsed-corrected="+o.codec:""}${o.supplemental?" supplemental="+o.supplemental:""}`),delete n.audiovideo}l&&(this.log(`Init audiovideo buffer, container:${l.container}, codecs[level/parsed]=[${e.codecs}/${l.codec}]`),delete n.video,delete n.audio);const d=Object.keys(n);if(d.length){if(this.hls.trigger(B.BUFFER_CODECS,n),!this.hls)return;d.forEach(c=>{const f=n[c].initSegment;f!=null&&f.byteLength&&this.hls.trigger(B.BUFFER_APPENDING,{type:c,data:f,frag:i,part:null,chunkMeta:s,parent:i.type})})}this.tickImmediate()}getMainFwdBufferInfo(){const e=this.mediaBuffer&&this.altAudio===2?this.mediaBuffer:this.media;return this.getFwdBufferInfo(e,Ue.MAIN)}get maxBufferLength(){const{levels:e,level:n}=this,i=e?.[n];return i?this.getMaxBufferLength(i.maxBitrate):this.config.maxBufferLength}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=be.IDLE}checkFragmentChanged(){const e=this.media;let n=null;if(e&&e.readyState>1&&e.seeking===!1){const i=e.currentTime;if(gt.isBuffered(e,i)?n=this.getAppendedFrag(i):gt.isBuffered(e,i+.1)&&(n=this.getAppendedFrag(i+.1)),n){this.backtrackFragment=null;const s=this.fragPlaying,r=n.level;(!s||n.sn!==s.sn||s.level!==r)&&(this.fragPlaying=n,this.hls.trigger(B.FRAG_CHANGED,{frag:n}),(!s||s.level!==r)&&this.hls.trigger(B.LEVEL_SWITCHED,{level:r}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){var e;if(this.fragPlaying)return this.fragPlaying;const n=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;return Pe(n)?this.getAppendedFrag(n):null}get currentProgramDateTime(){var e;const n=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;if(Pe(n)){const i=this.getLevelDetails(),s=this.currentFrag||(i?Zl(null,i.fragments,n):null);if(s){const r=s.programDateTime;if(r!==null){const o=r+(n-s.start)*1e3;return new Date(o)}}}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}};a(AL,"StreamController");let pT=AL;const xL=class xL{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const i in this.keyUriToKeyInfo){const s=this.keyUriToKeyInfo[i].loader;if(s){var n;if(e&&e!==((n=s.context)==null?void 0:n.frag.type))return;s.abort()}}}detach(){for(const e in this.keyUriToKeyInfo){const n=this.keyUriToKeyInfo[e];(n.mediaKeySessionContext||n.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyUriToKeyInfo){const n=this.keyUriToKeyInfo[e].loader;n&&n.destroy()}this.keyUriToKeyInfo={}}createKeyLoadError(e,n=de.KEY_LOAD_ERROR,i,s,r){return new Ws({type:Ge.NETWORK_ERROR,details:n,fatal:!1,frag:e,response:r,error:i,networkDetails:s})}loadClear(e,n,i){if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length){if(n.length)for(let s=0,r=n.length;s<r;s++){const o=n[s];if(e.cc<=o.cc&&(!$n(e)||!$n(o)||e.sn<o.sn)||!i&&s==r-1)return this.emeController.selectKeySystemFormat(o).then(l=>{if(!this.emeController)return;o.setKeyFormat(l);const d=vS(l);if(d)return this.emeController.getKeySystemAccess([d])})}if(this.config.requireKeySystemAccessOnStart){const s=Gm(this.config);if(s.length)return this.emeController.getKeySystemAccess(s)}}return null}load(e){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(n=>this.loadInternal(e,n)):this.loadInternal(e)}loadInternal(e,n){var i,s;n&&e.setKeyFormat(n);const r=e.decryptdata;if(!r){const c=new Error(n?`Expected frag.decryptdata to be defined after setting format ${n}`:"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(e,de.KEY_LOAD_ERROR,c))}const o=r.uri;if(!o)return Promise.reject(this.createKeyLoadError(e,de.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${o}"`)));let l=this.keyUriToKeyInfo[o];if((i=l)!=null&&i.decryptdata.key)return r.key=l.decryptdata.key,Promise.resolve({frag:e,keyInfo:l});if((s=l)!=null&&s.keyLoadPromise){var d;switch((d=l.mediaKeySessionContext)==null?void 0:d.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return l.keyLoadPromise.then(c=>(r.key=c.keyInfo.decryptdata.key,{frag:e,keyInfo:l}))}}switch(l=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(l,e):this.loadKeyEME(l,e);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(l,e);default:return Promise.reject(this.createKeyLoadError(e,de.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${r.method}"`)))}}loadKeyEME(e,n){const i={frag:n,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const s=this.emeController.loadKey(i);if(s)return(e.keyLoadPromise=s.then(r=>(e.mediaKeySessionContext=r,i))).catch(r=>{throw e.keyLoadPromise=null,r})}return Promise.resolve(i)}loadKeyHTTP(e,n){const i=this.config,s=i.loader,r=new s(i);return n.keyLoader=e.loader=r,e.keyLoadPromise=new Promise((o,l)=>{const d={keyInfo:e,frag:n,responseType:"arraybuffer",url:e.decryptdata.uri},c=i.keyLoadPolicy.default,u={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(h,p,g,v)=>{const{frag:y,keyInfo:b,url:E}=g;if(!y.decryptdata||b!==this.keyUriToKeyInfo[E])return l(this.createKeyLoadError(y,de.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),v));b.decryptdata.key=y.decryptdata.key=new Uint8Array(h.data),y.keyLoader=null,b.loader=null,o({frag:y,keyInfo:b})},onError:(h,p,g,v)=>{this.resetLoader(p),l(this.createKeyLoadError(n,de.KEY_LOAD_ERROR,new Error(`HTTP Error ${h.code} loading key ${h.text}`),g,nn({url:d.url,data:void 0},h)))},onTimeout:(h,p,g)=>{this.resetLoader(p),l(this.createKeyLoadError(n,de.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),g))},onAbort:(h,p,g)=>{this.resetLoader(p),l(this.createKeyLoadError(n,de.INTERNAL_ABORTED,new Error("key loading aborted"),g))}};r.load(d,u,f)})}resetLoader(e){const{frag:n,keyInfo:i,url:s}=e,r=i.loader;n.keyLoader===r&&(n.keyLoader=null,i.loader=null),delete this.keyUriToKeyInfo[s],r&&r.destroy()}};a(xL,"KeyLoader");let gT=xL;function HP(t){const{type:e}=t;switch(e){case wt.AUDIO_TRACK:return Ue.AUDIO;case wt.SUBTITLE_TRACK:return Ue.SUBTITLE;default:return Ue.MAIN}}a(HP,"mapContextToLevelType");function CE(t,e){let n=t.url;return(n===void 0||n.indexOf("data:")===0)&&(n=e.url),n}a(CE,"getResponseUrl");const IL=class IL{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=e,this.registerListeners()}
vendor: 18,369 bytes, line 3536
3536startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(B.MANIFEST_LOADING,this.onManifestLoading,this),e.on(B.LEVEL_LOADING,this.onLevelLoading,this),e.on(B.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(B.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(B.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){const{hls:e}=this;e.off(B.MANIFEST_LOADING,this.onManifestLoading,this),e.off(B.LEVEL_LOADING,this.onLevelLoading,this),e.off(B.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(B.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(B.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(e){const n=this.hls.config,i=n.pLoader,s=n.loader,r=i||s,o=new r(n);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 n=this.loaders[e];n&&n.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,n){const{url:i}=n;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:wt.MANIFEST,url:i,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,n){const{id:i,level:s,pathwayId:r,url:o,deliveryDirectives:l,levelInfo:d}=n;this.load({id:i,level:s,pathwayId:r,responseType:"text",type:wt.LEVEL,url:o,deliveryDirectives:l,levelOrTrack:d})}onAudioTrackLoading(e,n){const{id:i,groupId:s,url:r,deliveryDirectives:o,track:l}=n;this.load({id:i,groupId:s,level:null,responseType:"text",type:wt.AUDIO_TRACK,url:r,deliveryDirectives:o,levelOrTrack:l})}onSubtitleTrackLoading(e,n){const{id:i,groupId:s,url:r,deliveryDirectives:o,track:l}=n;this.load({id:i,groupId:s,level:null,responseType:"text",type:wt.SUBTITLE_TRACK,url:r,deliveryDirectives:o,levelOrTrack:l})}onLevelsUpdated(e,n){const i=this.loaders[wt.LEVEL];if(i){const s=i.context;s&&!n.levels.some(r=>r===s.levelOrTrack)&&(i.abort(),delete this.loaders[wt.LEVEL])}}load(e){var n;const i=this.hls.config;let s=this.getInternalLoader(e);if(s){const c=this.hls.logger,u=s.context;if(u&&u.levelOrTrack===e.levelOrTrack&&(u.url===e.url||u.deliveryDirectives&&!e.deliveryDirectives)){u.url===e.url?c.log(`[playlist-loader]: ignore ${e.url} ongoing request`):c.log(`[playlist-loader]: ignore ${e.url} in favor of ${u.url}`);return}c.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),s.abort()}let r;if(e.type===wt.MANIFEST?r=i.manifestLoadPolicy.default:r=jt({},i.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),s=this.createInternalLoader(e),Pe((n=e.deliveryDirectives)==null?void 0:n.part)){let c;if(e.type===wt.LEVEL&&e.level!==null?c=this.hls.levels[e.level].details:e.type===wt.AUDIO_TRACK&&e.id!==null?c=this.hls.audioTracks[e.id].details:e.type===wt.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=jt({},r,{maxTimeToFirstByteMs:Math.min(h,r.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(h,r.maxTimeToFirstByteMs)})}}}const o=r.errorRetry||r.timeoutRetry||{},l={loadPolicy:r,timeout:r.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},d={onSuccess:(c,u,f,h)=>{const p=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(),Il.isMediaPlaylist(g)||f.type!==wt.MANIFEST?this.handleTrackOrLevelPlaylist(c,u,f,h||null,p):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)}};s.load(e,l,d)}checkAutostartLoad(){if(!this.hls)return;const{config:{autoStartLoad:e,startPosition:n},forceStartLoad:i}=this.hls;(e||i)&&(this.hls.logger.log(`${e?"auto":"force"} startLoad with configured startPosition ${n}`),this.hls.startLoad(n))}handleMasterPlaylist(e,n,i,s){const r=this.hls,o=e.data,l=CE(e,i),d=Il.parseMasterPlaylist(o,l);if(d.playlistParsingError){this.handleManifestParsingError(e,i,d.playlistParsingError,s,n);return}const{contentSteering:c,levels:u,sessionData:f,sessionKeys:h,startTimeOffset:p,variableList:g}=d;this.variableList=g;const{AUDIO:v=[],SUBTITLES:y,"CLOSED-CAPTIONS":b}=Il.parseMasterPlaylistMedia(o,l,d);v.length&&!v.some(T=>!T.url)&&u[0].audioCodec&&!u[0].attrs.AUDIO&&(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),v.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new wn({}),bitrate:0,url:""})),r.trigger(B.MANIFEST_LOADED,{levels:u,audioTracks:v,subtitles:y,captions:b,contentSteering:c,url:l,stats:n,networkDetails:s,sessionData:f,sessionKeys:h,startTimeOffset:p,variableList:g})}handleTrackOrLevelPlaylist(e,n,i,s,r){const o=this.hls,{id:l,level:d,type:c}=i,u=CE(e,i),f=Pe(d)?d:Pe(l)?l:0,h=HP(i),p=Il.parseLevelPlaylist(e.data,u,f,h,0,this.variableList);if(c===wt.MANIFEST){const g={attrs:new wn({}),bitrate:0,details:p,name:"",url:u};p.requestScheduled=n.loading.start+O3(p,0),o.trigger(B.MANIFEST_LOADED,{levels:[g],audioTracks:[],url:u,stats:n,networkDetails:s,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}n.parsing.end=performance.now(),i.levelDetails=p,this.handlePlaylistLoaded(p,e,n,i,s,r)}handleManifestParsingError(e,n,i,s,r){this.hls.trigger(B.ERROR,{type:Ge.NETWORK_ERROR,details:de.MANIFEST_PARSING_ERROR,fatal:n.type===wt.MANIFEST,url:e.url,err:i,error:i,reason:i.message,response:e,context:n,networkDetails:s,stats:r})}handleNetworkError(e,n,i=!1,s,r){let o=`A network ${i?"timeout":"error"+(s?" (status "+s.code+")":"")} occurred while loading ${e.type}`;e.type===wt.LEVEL?o+=`: ${e.level} id: ${e.id}`:(e.type===wt.AUDIO_TRACK||e.type===wt.SUBTITLE_TRACK)&&(o+=` id: ${e.id} group-id: "${e.groupId}"`);const l=new Error(o);this.hls.logger.warn(`[playlist-loader]: ${o}`);let d=de.UNKNOWN,c=!1;const u=this.getInternalLoader(e);switch(e.type){case wt.MANIFEST:d=i?de.MANIFEST_LOAD_TIMEOUT:de.MANIFEST_LOAD_ERROR,c=!0;break;case wt.LEVEL:d=i?de.LEVEL_LOAD_TIMEOUT:de.LEVEL_LOAD_ERROR,c=!1;break;case wt.AUDIO_TRACK:d=i?de.AUDIO_TRACK_LOAD_TIMEOUT:de.AUDIO_TRACK_LOAD_ERROR,c=!1;break;case wt.SUBTITLE_TRACK:d=i?de.SUBTITLE_TRACK_LOAD_TIMEOUT:de.SUBTITLE_LOAD_ERROR,c=!1;break}u&&this.resetInternalLoader(e.type);const f={type:Ge.NETWORK_ERROR,details:d,fatal:c,url:e.url,loader:u,context:e,error:l,networkDetails:n,stats:r};if(s){const h=n?.url||e.url;f.response=nn({url:h,data:void 0},s)}this.hls.trigger(B.ERROR,f)}handlePlaylistLoaded(e,n,i,s,r,o){const l=this.hls,{type:d,level:c,id:u,groupId:f,deliveryDirectives:h}=s,p=CE(n,s),g=HP(s),v=typeof s.level=="number"&&g===Ue.MAIN?c:void 0;if(!e.fragments.length){const b=e.playlistParsingError=new Error("No Segments found in Playlist");l.trigger(B.ERROR,{type:Ge.NETWORK_ERROR,details:de.LEVEL_EMPTY_ERROR,fatal:!1,url:p,error:b,reason:b.message,response:n,context:s,level:v,parent:g,networkDetails:r,stats:i});return}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const y=e.playlistParsingError;if(y){if(this.hls.logger.warn(y),!l.config.ignorePlaylistParsingErrors){l.trigger(B.ERROR,{type:Ge.NETWORK_ERROR,details:de.LEVEL_PARSING_ERROR,fatal:!1,url:p,error:y,reason:y.message,response:n,context:s,level:v,parent:g,networkDetails:r,stats:i});return}e.playlistParsingError=null}switch(e.live&&o&&(o.getCacheAge&&(e.ageHeader=o.getCacheAge()||0),(!o.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),d){case wt.MANIFEST:case wt.LEVEL:l.trigger(B.LEVEL_LOADED,{details:e,levelInfo:s.levelOrTrack||l.levels[0],level:v||0,id:u||0,stats:i,networkDetails:r,deliveryDirectives:h,withoutMultiVariant:d===wt.MANIFEST});break;case wt.AUDIO_TRACK:l.trigger(B.AUDIO_TRACK_LOADED,{details:e,track:s.levelOrTrack,id:u||0,groupId:f||"",stats:i,networkDetails:r,deliveryDirectives:h});break;case wt.SUBTITLE_TRACK:l.trigger(B.SUBTITLE_TRACK_LOADED,{details:e,track:s.levelOrTrack,id:u||0,groupId:f||"",stats:i,networkDetails:r,deliveryDirectives:h});break}}};a(IL,"PlaylistLoader");let mT=IL;const ta=class ta{static get version(){return Fh}static isMSESupported(){return S4()}static isSupported(){return C0e()}static getMediaSource(){return Ua()}static get Events(){return B}static get MetadataSchema(){return us}static get ErrorTypes(){return Ge}static get ErrorDetails(){return de}static get DefaultConfig(){return ta.defaultConfig?ta.defaultConfig:T0e}static set DefaultConfig(e){ta.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.logger=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new FA,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioStreamController=void 0,this.subtititleStreamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.interstitialsController=void 0,this.gapController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this._url=null,this._sessionId=void 0,this.triggeringException=void 0,this.started=!1;const n=this.logger=Yhe(e.debug||!1,"Hls instance",e.assetPlayerId),i=this.config=x0e(ta.DefaultConfig,e,n);this.userConfig=e,i.progressive&&I0e(i,n);const{abrController:s,bufferController:r,capLevelController:o,errorController:l,fpsController:d}=i,c=new l(this),u=this.abrController=new s(this),f=new cS(this),h=i.interstitialsController,p=h?this.interstitialsController=new h(this,ta):null,g=this.bufferController=new r(this,f),v=this.capLevelController=new o(this),y=new d(this),b=new mT(this),E=i.contentSteeringController,T=E?new E(this):null,I=this.levelController=new hT(this,T),M=new uT(this),H=new gT(this.config),N=this.streamController=new pT(this,f,H),$=this.gapController=new cT(this,f);v.setStreamController(N),y.setStreamController(N);const F=[b,I,N];p&&F.splice(1,0,p),T&&F.splice(1,0,T),this.networkControllers=F;const D=[u,g,$,v,y,M,f];this.audioTrackController=this.createController(i.audioTrackController,F);const L=i.audioStreamController;L&&F.push(this.audioStreamController=new L(this,f,H)),this.subtitleTrackController=this.createController(i.subtitleTrackController,F);const m=i.subtitleStreamController;m&&F.push(this.subtititleStreamController=new m(this,f,H)),this.createController(i.timelineController,D),H.emeController=this.emeController=this.createController(i.emeController,D),this.cmcdController=this.createController(i.cmcdController,D),this.latencyController=this.createController(fT,D),this.coreComponents=D,F.push(c);const S=c.onErrorOut;typeof S=="function"&&this.on(B.ERROR,S,c),this.on(B.MANIFEST_LOADED,b.onManifestLoaded,b)}createController(e,n){if(e){const i=new e(this);return n&&n.push(i),i}return null}on(e,n,i=this){this._emitter.on(e,n,i)}once(e,n,i=this){this._emitter.once(e,n,i)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,n,i=this,s){this._emitter.off(e,n,i,s)}listeners(e){return this._emitter.listeners(e)}emit(e,n,i){return this._emitter.emit(e,n,i)}trigger(e,n){if(this.config.debug)return this.emit(e,e,n);try{return this.emit(e,e,n)}catch(i){if(this.logger.error("An internal error happened while handling event "+e+'. Error message: "'+i.message+'". Here is a stacktrace:',i),!this.triggeringException){this.triggeringException=!0;const s=e===B.ERROR;this.trigger(B.ERROR,{type:Ge.OTHER_ERROR,details:de.INTERNAL_EXCEPTION,fatal:s,event:e,error:i}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){this.logger.log("destroy"),this.trigger(B.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,this.networkControllers.forEach(n=>n.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(n=>n.destroy()),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){if(!e||"media"in e&&!e.media){const r=new Error(`attachMedia failed: invalid argument (${e})`);this.trigger(B.ERROR,{type:Ge.OTHER_ERROR,details:de.ATTACH_MEDIA_ERROR,fatal:!0,error:r});return}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());const n="media"in e,i=n?e.media:e,s=n?e:{media:i};this._media=i,this.trigger(B.MEDIA_ATTACHING,s)}detachMedia(){this.logger.log("detachMedia"),this.trigger(B.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;const e=this.bufferController.transferMedia();return this.trigger(B.MEDIA_DETACHING,{transferMedia:e}),e}loadSource(e){this.stopLoad();const n=this.media,i=this._url,s=this._url=MA.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${s}`),n&&i&&(i!==s||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(n)),this.trigger(B.MANIFEST_LOADING,{url:e})}get url(){return this._url}get hasEnoughToStart(){return this.streamController.hasEnoughToStart}get startPosition(){return this.streamController.startPositionValue}startLoad(e=-1,n){this.logger.log(`startLoad(${e+(n?", <skip seek to start>":"")})`),this.started=!0,this.resumeBuffering();for(let i=0;i<this.networkControllers.length&&(this.networkControllers[i].startLoad(e,n),!(!this.started||!this.networkControllers));i++);}stopLoad(){this.logger.log("stopLoad"),this.started=!1;for(let e=0;e<this.networkControllers.length&&(this.networkControllers[e].stopLoad(),!(this.started||!this.networkControllers));e++);}get loadingEnabled(){return this.started}get bufferingEnabled(){return this.streamController.bufferingEnabled}resumeBuffering(){this.bufferingEnabled||(this.logger.log("resume buffering"),this.networkControllers.forEach(e=>{e.resumeBuffering&&e.resumeBuffering()}))}pauseBuffering(){this.bufferingEnabled&&(this.logger.log("pause buffering"),this.networkControllers.forEach(e=>{e.pauseBuffering&&e.pauseBuffering()}))}get inFlightFragments(){const e={[Ue.MAIN]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[Ue.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[Ue.SUBTITLE]=this.subtititleStreamController.inFlightFrag),e}swapAudioCodec(){this.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){this.logger.log("recoverMediaError");const e=this._media,n=e?.currentTime;this.detachMedia(),e&&(this.attachMedia(e),n&&this.startLoad(n))}removeLevel(e){this.levelController.removeLevel(e)}get sessionId(){let e=this._sessionId;return e||(e=this._sessionId=Kme()),e}get levels(){const e=this.levelController.levels;return e||[]}get latestLevelDetails(){return this.streamController.getLevelDetails()||null}get loadLevelObj(){return this.levelController.loadLevelObj}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){this.logger.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){this.logger.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){this.logger.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){this.logger.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){this.logger.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 n=!!e;n!==this.config.capLevelToPlayerSize&&(n?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=n)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get abrEwmaDefaultEstimate(){const{bwEstimator:e}=this.abrController;return e?e.defaultEstimate:NaN}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(this.logger.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){Spe(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:n}}=this;if(!e)return 0;const i=e.length;for(let s=0;s<i;s++)if(e[s].maxBitrate>=n)return s;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:n,maxHdcpLevel:i}=this;let s;if(n===-1&&e!=null&&e.length?s=e.length-1:s=n,i)for(let r=s;r--;){const o=e[r].attrs["HDCP-LEVEL"];if(o&&o<=i)return r}return s}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(e){var n;return((n=this.audioTrackController)==null?void 0:n.setAudioOption(e))||null}
3536setSubtitleOption(e){var n;return((n=this.subtitleTrackController)==null?void 0:n.setSubtitleOption(e))||null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const n=this.audioTrackController;n&&(n.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const n=this.subtitleTrackController;n&&(n.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){const n=this.subtitleTrackController;n&&(n.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}set targetLatency(e){this.latencyController.targetLatency=e}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}get pathways(){return this.levelController.pathways}get pathwayPriority(){return this.levelController.pathwayPriority}set pathwayPriority(e){this.levelController.pathwayPriority=e}get bufferedToEnd(){var e;return!!((e=this.bufferController)!=null&&e.bufferedToEnd)}get interstitialsManager(){var e;return((e=this.interstitialsController)==null?void 0:e.interstitialsManager)||null}getMediaDecodingInfo(e,n=this.allAudioTracks){const i=x3(n);return T3(e,i,navigator.mediaCapabilities)}};a(ta,"Hls");let _r=ta;_r.defaultConfig=void 0;const O0e=a(t=>{var e,n,i,s,T4,o,l,A4;return e=class extends t{constructor(){super();Ze(this,s);Ze(this,l);Ze(this,n,null);Ze(this,i,null);Ze(this,o,a(()=>{var f,h,p;(f=this.nativeEl)!=null&&f.webkitCurrentPlaybackTargetIsWireless?(h=this.api)==null||h.stopLoad():(p=this.api)==null||p.startLoad()},"#toggleHlsLoad"));en(this,l,A4).call(this,"config")}get config(){return Re(this,i)}set config(f){st(this,i,f)}attributeChangedCallback(f,h,p){f!=="src"&&super.attributeChangedCallback(f,h,p),f==="src"&&h!=p&&this.load()}async load(){var f,h;const p=!this.api;if(en(this,s,T4).call(this),!!this.src){if(p&&!Re(this,i)&&st(this,i,JSON.parse(((f=this.shadowRoot.getElementById("config"))==null?void 0:f.textContent)||"{}")),_r.isSupported()){switch(this.api=new _r({liveDurationInfinity:!0,autoStartLoad:!1,...this.config}),await Promise.resolve(),this.api.loadSource(this.src),this.api.attachMedia(this.nativeEl),this.nativeEl.preload){case"none":{const b=a(()=>this.api.startLoad(),"loadSourceOnPlay");this.nativeEl.addEventListener("play",b,{once:!0}),this.api.on(_r.Events.DESTROYING,()=>{this.nativeEl.removeEventListener("play",b)});break}case"metadata":{const b=this.api.config.maxBufferLength,E=this.api.config.maxBufferSize;this.api.config.maxBufferLength=1,this.api.config.maxBufferSize=1;const T=a(()=>{this.api.config.maxBufferLength=b,this.api.config.maxBufferSize=E},"increaseBufferOnPlay");this.nativeEl.addEventListener("play",T,{once:!0}),this.api.on(_r.Events.DESTROYING,()=>{this.nativeEl.removeEventListener("play",T)}),this.api.startLoad();break}default:this.api.startLoad()}this.nativeEl.webkitCurrentPlaybackTargetIsWireless&&this.api.stopLoad(),this.nativeEl.addEventListener("webkitcurrentplaybacktargetiswirelesschanged",Re(this,o)),st(this,n,document.createElement("source")),Re(this,n).setAttribute("type","application/x-mpegURL"),Re(this,n).setAttribute("src",this.src),this.nativeEl.disableRemotePlayback=!1,this.nativeEl.append(Re(this,n));const g=new WeakMap;this.api.on(_r.Events.MANIFEST_PARSED,(b,E)=>{this.nativeEl.autoplay&&this.nativeEl.paused&&this.nativeEl.play().catch(I=>{console.warn("Autoplay failed:",I)}),y();let T=this.videoTracks.getTrackById("main");T||(T=this.addVideoTrack("main"),T.id="main",T.selected=!0);for(const[I,M]of E.levels.entries()){const H=T.addRendition(M.url[0],M.width,M.height,M.videoCodec,M.bitrate);g.set(M,`${I}`),H.id=`${I}`}for(let[I,M]of E.audioTracks.entries()){const H=M.default?"main":"alternative",N=this.addAudioTrack(H,M.name,M.lang);N.id=`${I}`,M.default&&(N.enabled=!0)}}),this.audioTracks.addEventListener("change",()=>{var b;const E=+((b=[...this.audioTracks].find(I=>I.enabled))==null?void 0:b.id),T=this.api.audioTracks.map(I=>I.id);E!=this.api.audioTrack&&T.includes(E)&&(this.api.audioTrack=E)}),this.api.on(_r.Events.LEVELS_UPDATED,(b,E)=>{const T=this.videoTracks[this.videoTracks.selectedIndex??0];if(!T)return;const I=E.levels.map(M=>g.get(M));for(const M of this.videoRenditions)M.id&&!I.includes(M.id)&&T.removeRendition(M)});const v=a(b=>{const E=b.target.selectedIndex;E!=this.api.nextLevel&&(this.api.nextLevel=E)},"switchRendition");(h=this.videoRenditions)==null||h.addEventListener("change",v);const y=a(()=>{for(const b of this.videoTracks)this.removeVideoTrack(b);for(const b of this.audioTracks)this.removeAudioTrack(b)},"removeAllMediaTracks");this.api.once(_r.Events.DESTROYING,y);return}await Promise.resolve(),this.nativeEl.canPlayType("application/vnd.apple.mpegurl")&&(this.nativeEl.src=this.src)}}},n=new WeakMap,i=new WeakMap,s=new WeakSet,T4=a(function(){var f,h;(f=Re(this,n))==null||f.remove(),(h=this.nativeEl)==null||h.removeEventListener("webkitcurrentplaybacktargetiswirelesschanged",Re(this,o)),this.api&&(this.api.detachMedia(),this.api.destroy(),this.api=null)},"#destroy"),o=new WeakMap,l=new WeakSet,A4=a(function(f){if(Object.prototype.hasOwnProperty.call(this,f)){const h=this[f];delete this[f],this[f]=h}},"#upgradeProperty"),a(e,"HlsVideo"),vt(e,"shadowRootOptions",{...t.shadowRootOptions}),vt(e,"getTemplateHTML",(f,h={})=>{const{src:p,...g}=f;return`
3537        <script type="application/json" id="config">
3538          ${JSON.stringify(h.config||{})}
3539        <\/script>
3540        ${t.getTemplateHTML(g)}
3541      `}),e},"HlsVideoMixin"),N0e=O0e(f3(khe));globalThis.customElements&&!globalThis.customElements.get("hls-video")&&globalThis.customElements.define("hls-video",N0e);const F0e=["abort","canplay","canplaythrough","durationchange","emptied","encrypted","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting","waitingforkey","resize","enterpictureinpicture","leavepictureinpicture","webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"],vT=globalThis.document?.createElement("template");vT&&(vT.innerHTML=`
3542    <style>
3543      :host {
3544        display: inline-block;
3545        line-height: 0;
3546      }
3547
3548      video,
3549      audio {
3550        max-width: 100%;
3551        max-height: 100%;
3552        min-width: 100%;
3553        min-height: 100%;
3554      }
3555    </style>
3556    <slot></slot>
3557  `);const x4=a((t,{tag:e,is:n})=>{var r,o,l,I4,c,u,f,h,p,g,v,Jc,b,L4,T,R4,M,k4,N,M4,F,C4;const i=globalThis.document?.createElement(e,{is:n}),s=i?GP(i):[];return r=class extends t{constructor(){super();Ze(this,v);Ze(this,b);Ze(this,T);Ze(this,M);Ze(this,N);Ze(this,F);Ze(this,c,void 0);Ze(this,u,void 0);Ze(this,f,!1);Ze(this,h,!1);Ze(this,p,void 0);Ze(this,g,void 0);this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.append(this.constructor.template.content.cloneNode(!0))),this.load!==r.prototype.load&&(this.loadComplete=new Bv)}static get observedAttributes(){var _;return en(_=r,l,I4).call(_),[...i?.constructor?.observedAttributes??[],"autopictureinpicture","disablepictureinpicture","disableremoteplayback","autoplay","controls","controlslist","crossorigin","loop","muted","playsinline","poster","preload","src"]}get loadComplete(){return Re(this,u)}set loadComplete(S){st(this,h,!1),st(this,u,S),S?.then(()=>{st(this,h,!0)})}get isLoaded(){return Re(this,h)}get nativeEl(){return Re(this,p)??this.shadowRoot.querySelector(e)??this.querySelector(e)}set nativeEl(S){st(this,p,S)}get defaultMuted(){return this.hasAttribute("muted")}set defaultMuted(S){this.toggleAttribute("muted",!!S)}get src(){return this.getAttribute("src")}set src(S){this.setAttribute("src",`${S}`)}get preload(){return this.getAttribute("preload")??this.nativeEl?.preload}set preload(S){this.setAttribute("preload",`${S}`)}attributeChangedCallback(S,_,A){en(this,v,Jc).call(this),S==="src"&&this.load!==r.prototype.load&&en(this,N,M4).call(this),en(this,F,C4).call(this,S,_,A)}connectedCallback(){en(this,v,Jc).call(this)}},o=new WeakMap,l=new WeakSet,I4=a(function(){if(Re(this,o))return;st(this,o,!0);const S=new Set(this.observedAttributes);S.delete("muted");for(let _ of s){if(_ in this.prototype)continue;if(typeof i[_]=="function")this.prototype[_]=function(...x){en(this,v,Jc).call(this);const C=a(()=>this.call?this.call(_,...x):this.nativeEl[_].apply(this.nativeEl,x),"fn");return this.loadComplete&&!this.isLoaded?this.loadComplete.then(C):C()};else{let x={get(){en(this,v,Jc).call(this);let C=_.toLowerCase();if(S.has(C)){const U=this.getAttribute(C);return U===null?!1:U===""?!0:U}return this.get?.(_)??this.nativeEl?.[_]??Re(this,g)[_]}};_!==_.toUpperCase()&&(x.set=async function(C){en(this,v,Jc).call(this);let U=_.toLowerCase();if(S.has(U)){C===!0||C===!1||C==null?this.toggleAttribute(U,!!C):this.setAttribute(U,C);return}if(this.loadComplete&&!this.isLoaded&&await this.loadComplete,this.set){this.set(_,C);return}this.nativeEl[_]=C}),Object.defineProperty(this.prototype,_,x)}}},"#define"),c=new WeakMap,u=new WeakMap,f=new WeakMap,h=new WeakMap,p=new WeakMap,g=new WeakMap,v=new WeakSet,Jc=a(async function(){if(Re(this,c))return;st(this,c,!0),en(this,T,R4).call(this),en(this,M,k4).call(this);for(let A of s)en(this,b,L4).call(this,A);const S=new Map,_=this.shadowRoot.querySelector("slot:not([name])");_?.addEventListener("slotchange",()=>{const A=new Map(S);_.assignedElements().filter(x=>
3557["track","source"].includes(x.localName)).forEach(async x=>{A.delete(x);let C=S.get(x);C||(C=x.cloneNode(),S.set(x,C)),this.loadComplete&&!this.isLoaded&&await this.loadComplete,this.nativeEl.append?.(C)}),A.forEach(x=>x.remove())});for(let A of this.constructor.Events)this.shadowRoot.addEventListener?.(A,x=>{x.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(x.type,{detail:x.detail}))},!0)},"#init"),b=new WeakSet,L4=a(function(S){if(Object.prototype.hasOwnProperty.call(this,S)){const _=this[S];delete this[S],this[S]=_}},"#upgradeProperty"),T=new WeakSet,R4=a(function(){const S=document.createElement(e,{is:n});S.muted=this.hasAttribute("muted");for(let{name:_,value:A}of this.attributes)S.setAttribute(_,A);st(this,g,{});for(let _ of GP(S))Re(this,g)[_]=S[_];S.removeAttribute("src"),S.load()},"#initStandinEl"),M=new WeakSet,k4=a(async function(){if(this.loadComplete&&!this.isLoaded&&await this.loadComplete,!this.nativeEl){const S=document.createElement(e,{is:n});S.part=e,this.shadowRoot.append(S)}this.nativeEl.muted=this.hasAttribute("muted")},"#initNativeEl"),N=new WeakSet,M4=a(async function(){Re(this,f)&&(this.loadComplete=new Bv),st(this,f,!0),await Promise.resolve(),await this.load(),this.loadComplete?.resolve(),await this.loadComplete},"#loadSrc"),F=new WeakSet,C4=a(async function(S,_,A){this.loadComplete&&!this.isLoaded&&await this.loadComplete,!["id","class",...this.constructor.skipAttributes].includes(S)&&(A===null?this.nativeEl.removeAttribute?.(S):this.nativeEl.setAttribute?.(S,A))},"#forwardAttribute"),Ze(r,l),a(r,"SuperMedia"),vt(r,"Events",F0e),vt(r,"template",vT),vt(r,"skipAttributes",[]),Ze(r,o,void 0),r},"SuperMediaMixin");function GP(t){let e=[];for(let n=Object.getPrototypeOf(t);n&&n!==HTMLElement.prototype;n=Object.getPrototypeOf(n))e.push(...Object.getOwnPropertyNames(n));return e}a(GP,"getNativeElProps");const LL=class LL extends Promise{constructor(e=()=>{}){let n,i;super((s,r)=>{e(s,r),n=s,i=r}),this.resolve=n,this.reject=i}};a(LL,"PublicPromise");let Bv=LL;const VP=globalThis.document?x4(HTMLElement,{tag:"video"}):class{};globalThis.document&&x4(HTMLElement,{tag:"audio"});var WP,zP;const yT=(WP=globalThis.document)==null?void 0:WP.createElement("template");yT&&(yT.innerHTML=`
3558  <style>
3559    :host {
3560      display: inline-block;
3561      min-width: 300px;
3562      min-height: 150px;
3563      position: relative;
3564    }
3565    video {
3566      max-width: 100%;
3567      max-height: 100%;
3568      min-width: 100%;
3569      min-height: 100%;
3570    }
3571    div.video-js {
3572      position: absolute;
3573      top: 0;
3574      left: 0;
3575      bottom: 0;
3576      right: 0;
3577    }
3578  </style>
3579  <slot name="video">
3580    <video></video>
3581  </slot>
3582  <slot></slot>
3583  `);var Sp;const Mf=class Mf extends(((zP=f3)==null?void 0:zP(VP??class{}))??class{}){constructor(){super(...arguments);Ze(this,Sp,void 0)}static get observedAttributes(){return[...VP.observedAttributes,"stylesheet"]}get nativeEl(){return this.querySelector(":scope > [slot=video]")??this.shadowRoot.querySelector("video")}async load(){const n={autoplay:this.autoplay,preload:this.preload??"metadata",playsinline:this.playsInline,controls:this.controls,muted:this.defaultMuted,loop:this.loop,html5:{nativeTextTracks:!0}};if(this.controls||(n.children=["mediaLoader"]),Re(this,Sp))this.api.src(this.src);else{st(this,Sp,!0);const i=this.nativeEl;i.classList.add("video-js",...this.classList);let s=globalThis.videojs;if(!s){const d=`https://cdn.jsdelivr.net/npm/video.js@${this.version}/dist/video.min.js`;s=await U0e(d,"videojs")}this.api=s(i,n),this.src&&this.api.src(this.src),this.api.audioTracks().on("addtrack",({track:d})=>{if(this.audioTracks.getTrackById(d.id))return;const c=this.addAudioTrack(d.kind,d.label,d.language);c.id=`${d.id}`,c.enabled=d.enabled}),this.api.audioTracks().on("removetrack",({track:d})=>{const c=this.audioTracks.getTrackById(d.id);c&&this.removeAudioTrack(c)}),this.audioTracks.addEventListener("change",()=>{const d=this.api.audioTracks();for(let c=0;c<d.length;c++){const u=d[c];u.enabled=this.audioTracks.getTrackById(u.id).enabled}});const r=this.api.qualityLevels();r.on("addqualitylevel",d=>{let c=this.videoTracks[0];c||(c=this.addVideoTrack("main"),c.selected=!0);const u=d.qualityLevel,f=c.addRendition(u.id,u.width,u.height,void 0,u.bitrate);f.id=`${u.id}`});const o=a(({target:d})=>{const c=d.selectedIndex===-1;for(let u of d){const f=r.getQualityLevelById(u.id);f.enabled=c||u.selected}},"switchRendition");this.videoRenditions.addEventListener("change",o);const l=a(()=>{for(const d of this.videoTracks)this.removeVideoTrack(d);for(const d of this.audioTracks)this.removeAudioTrack(d)},"removeAllMediaTracks");this.api.on("emptied",l),this.api.on("loadstart",l)}this.api.ready(()=>{this.loadComplete.resolve()})}connectedCallback(){if(super.connectedCallback(),this.querySelector("source")&&this.load(),this.controls){const n=DE("link",{href:`https://cdn.jsdelivr.net/npm/video.js@${this.version}/dist/video-js.min.css`,rel:"stylesheet",crossorigin:""});
3583this.shadowRoot.prepend(n),n.onload=()=>{[...this.shadowRoot.styleSheets[0].cssRules].filter(({cssText:i})=>i.startsWith("@font-face")).forEach(({cssText:i})=>{document.head.append(DE("style",{},i))})}}}async attributeChangedCallback(n,i,s){var r;if(n==="stylesheet"){(r=this.shadowRoot.querySelector("#stylesheet"))==null||r.remove(),s&&this.shadowRoot.prepend(DE("link",{id:"stylesheet",href:s,rel:"stylesheet",crossorigin:""}));return}if(n==="controls"){await this.loadComplete,this.api.controls(s!=null);return}if(n==="poster"){await this.loadComplete,this.api.poster(s);return}super.attributeChangedCallback(n,i,s)}call(n,...i){var s,r;return(r=(s=this.api)==null?void 0:s[n])==null?void 0:r.call(s,...i)}get(n){var i;return(i=this.nativeEl)==null?void 0:i[n]}set(n,i){var s,r;(r=(s=this.api)==null?void 0:s[n])==null||r.call(s,i)}get version(){return this.getAttribute("version")??"8"}};Sp=new WeakMap,a(Mf,"VideojsVideoElement"),vt(Mf,"template",yT),vt(Mf,"skipAttributes",["src","controls","poster"]);let bT=Mf;const PE={};async function U0e(t,e){return e?PE[t]?PE[t]:self[e]?self[e]:PE[t]=new Promise((n,i)=>{const s=document.createElement("script");s.defer=!0,s.src=t,s.onload=()=>n(self[e]),s.onerror=i,document.head.append(s)}):rt(()=>import(t),[])}a(U0e,"loadScript");function DE(t,e={},...n){const i=document.createElement(t);return Object.keys(e).forEach(s=>e[s]!=null&&i.setAttribute(s,e[s])),i.append(...n),i}a(DE,"createElement");globalThis.customElements&&!globalThis.customElements.get("videojs-video")&&globalThis.customElements.define("videojs-video",bT);const B0e="3.0.124",Ee=`web_${B0e}_${Math.floor(Math.random()*1e10)}`,kn=new Worker(new URL("/assets/relayWorker-47161012.js",self.location),{type:"module"}),$0e=a(()=>{const t=new URL(window.location.href),e=new URLSearchParams(t.search);e.delete("_sw"),t.search=e.toString(),window.history.replaceState({},"",t.toString())},"removeSWTimestamp"),H0e=a(()=>{Or(()=>{Zv(),t(),$0e()}),Tt(()=>{LT(),kn?.terminate()}),We(()=>{Object.keys(z.relaySettings).length===0&&setTimeout(()=>{QF()},200)});const t=a(()=>{kn.addEventListener("message",e=>{const n=e.data;n.type==="ENQUE_EVENT"&&n.event&&(VF(n.event),Np()),n.type==="DEQUE_EVENT"&&n.event&&WF(n.event),n.type==="EVENT_SENT"&&n.event&&Bp([n.event],`import_event_${n.event.id}_${Ee}`)}),kn.postMessage({type:"INIT"})},"initRelayWorker");return We(oi(()=>z.eventQueueRetry,e=>{e>0||zF()})),X(Use,{get children(){return X(Sde,{get children(){return X(f9,{get children(){return X(aK,{get children(){return X(une,{get children(){return X(Ide,{get children(){return X(xle,{get children(){return X(Xae,{get children(){return X(Vle,{get children(){return X(Ble,{get children(){return X(Ade,{get children(){return X(Lle,{get children(){return X(Mle,{get children(){return X(Dle,{get children(){return X(Ede,{})}})}})}})}})}})}})}})}})}})}})}})}})}})}})},"App");if("serviceWorker"in navigator){const t=!!navigator.serviceWorker.controller;navigator.serviceWorker.register("/imageCacheWorker.js",{scope:"/"}),navigator.serviceWorker.addEventListener("message",e=>{if(e.data?.type==="SW_ACTIVATED"&&t){const n=new URL(window.location.href);n.searchParams.set("_sw",Date.now().toString()),window.location.replace(n.toString())}})}c8(()=>X(H0e,{}),document.getElementById("root"));export{Fbe as $,v0 as A,N1 as B,Ld as C,gu as D,li as E,UE as F,We as G,Je as H,oi as I,Tye as J,Pye as K,Oye as L,Me as M,G as N,Cye as O,Sye as P,Ee as Q,gle as R,sn as S,Dye as T,Zye as U,cF as V,aye as W,XN as X,Qm as Y,_a as Z,yre as _,Wp as a,$d as a$,u_e as a0,awe as a1,Ive as a2,Lve as a3,Xv as a4,vne as a5,Rbe as a6,wy as a7,wbe as a8,Ii as a9,fye as aA,gbe as aB,Ave as aC,Si as aD,Tbe as aE,LM as aF,Abe as aG,Rve as aH,xi as aI,bf as aJ,Jv as aK,gye as aL,Yye as aM,vEe as aN,Tn as aO,xte as aP,qye as aQ,bve as aR,Eve as aS,Wye as aT,zye as aU,Jq as aV,QV as aW,m_ as aX,Kye as aY,Lr as aZ,So as a_,ZEe as aa,vs as ab,nne as ac,Io as ad,Va as ae,QEe as af,JEe as ag,xbe as ah,owe as ai,IF as aj,d9 as ak,O9 as al,h9 as am,oO as an,mbe as ao,vbe as ap,Hbe as aq,$a as ar,Iy as as,fbe as at,Nbe as au,Ace as av,tEe as aw,KEe as ax,nEe as ay,Ce as az,z as b,Op as b$,ii as b0,jye as b1,_0 as b2,fte as b3,ite as b4,EEe as b5,Aye as b6,XF as b7,jz as b8,Mi as b9,Gbe as bA,tD as bB,jEe as bC,YEe as bD,Gl as bE,Pt as bF,ele as bG,hEe as bH,pEe as bI,_be as bJ,B_ as bK,gEe as bL,Ebe as bM,YF as bN,re as bO,Cle as bP,Z_e as bQ,Q_e as bR,iye as bS,J_e as bT,ove as bU,X_e as bV,Pa as bW,Xye as bX,dt as bY,Mve as bZ,Mye as b_,qbe as ba,Sy as bb,$le as bc,f1 as bd,ibe as be,kbe as bf,VK as bg,rt as bh,Wle as bi,Bye as bj,eEe as bk,qEe as bl,Hd as bm,Tc as bn,Zve as bo,Hye as bp,BEe as bq,w1 as br,nc as bs,qs as bt,ou as bu,td as bv,BF as bw,Y9 as bx,F_ as by,Vbe as bz,X as c,eve as c$,kye as c0,Uye as c1,Jye as c2,b0 as c3,Ole as c4,ht as c5,pbe as c6,cN as c7,one as c8,l_e as c9,_ye as cA,Sn as cB,tbe as cC,sbe as cD,bbe as cE,dbe as cF,Q0e as cG,Nye as cH,ive as cI,r_e as cJ,GEe as cK,FEe as cL,UEe as cM,uEe as cN,UK as cO,Yve as cP,WEe as cQ,S_e as cR,nve as cS,s_e as cT,XEe as cU,hye as cV,tve as cW,J0e as cX,lve as cY,Sde as cZ,m_e as c_,n_e as ca,d_e as cb,Xve as cc,Y_e as cd,Mp as ce,Aa as cf,e_e as cg,bU as ch,jse as ci,c_e as cj,hve as ck,Na as cl,uu as cm,Hq as cn,lu as co,Cb as cp,Nu as cq,Xu as cr,fne as cs,yve as ct,jve as cu,yye as cv,Eye as cw,wye as cx,vye as cy,bye as cz,Kv as d,mt as d$,W9 as d0,MEe as d1,AEe as d2,Z0e as d3,Nte as d4,Fte as d5,Ute as d6,Bte as d7,$te as d8,Gte as d9,xye as dA,qf as dB,E_ as dC,eh as dD,$0 as dE,H0 as dF,Sbe as dG,jn as dH,Iye as dI,un as dJ,h8 as dK,rbe as dL,K0e as dM,rwe as dN,abe as dO,swe as dP,BK as dQ,lbe as dR,i_e as dS,VM as dT,CB as dU,nwe as dV,iwe as dW,q0e as dX,Qye as dY,vK as dZ,Ki as d_,Vte as da,Wte as db,zte as dc,Kte as dd,qte as de,jte as df,TEe as dg,LEe as dh,REe as di,kEe as dj,IEe as dk,xEe as dl,CEe as dm,DEe as dn,B9 as d
3583p,PEe as dq,Ks as dr,Cte as ds,rq as dt,uve as du,fve as dv,rye as dw,oye as dx,au as dy,nbe as dz,_y as e,C_e as e$,lwe as e0,Y0e as e1,$ye as e2,V1 as e3,T_e as e4,X0e as e5,Sve as e6,cbe as e7,cEe as e8,Mbe as e9,eo as eA,Ybe as eB,yn as eC,P_e as eD,D_e as eE,O_e as eF,N_e as eG,Qbe as eH,G_e as eI,F_e as eJ,H_e as eK,E5 as eL,U_e as eM,B_e as eN,$_e as eO,hce as eP,q_e as eQ,j_e as eR,Bbe as eS,L_e as eT,M_e as eU,z_e as eV,A_e as eW,I_e as eX,k_e as eY,x_e as eZ,R_e as e_,Gq as ea,hbe as eb,oEe as ec,aEe as ed,Sc as ee,rve as ef,SEe as eg,tye as eh,wve as ei,Fye as ej,x1 as ek,A1 as el,_ve as em,bEe as en,yEe as eo,lU as ep,Bp as eq,lte as er,AN as es,QF as et,Gye as eu,P_ as ev,eye as ew,Ibe as ex,Ta as ey,EJ as ez,wN as f,V9 as f$,K_e as f0,V_e as f1,W_e as f2,Tne as f3,v_e as f4,xy as f5,ewe as f6,twe as f7,sye as f8,T9 as f9,sve as fA,E8 as fB,An as fC,OE as fD,Cf as fE,W0e as fF,Fve as fG,Nve as fH,Pf as fI,Vq as fJ,fEe as fK,Aq as fL,Vye as fM,pye as fN,t_e as fO,$Ee as fP,Ree as fQ,Nt as fR,kee as fS,mve as fT,pve as fU,gve as fV,Hte as fW,OEe as fX,NEe as fY,Yte as fZ,vve as f_,mye as fa,kve as fb,Rye as fc,Lye as fd,_l as fe,SB as ff,jbe as fg,yN as fh,ybe as fi,vi as fj,uU as fk,nye as fl,ci as fm,xve as fn,jq as fo,wQ as fp,rEe as fq,c0 as fr,zbe as fs,Zbe as ft,Fp as fu,Wbe as fv,lEe as fw,dEe as fx,aO as fy,kT as fz,f8 as g,Obe as g$,zEe as g0,cz as g1,_Ee as g2,wEe as g3,mEe as g4,oU as g5,Pee as g6,sz as g7,lye as g8,kn as g9,bee as gA,ree as gB,cee as gC,uN as gD,H1 as gE,kF as gF,MF as gG,Ay as gH,Tp as gI,fN as gJ,LF as gK,dee as gL,N_ as gM,RF as gN,CF as gO,B1 as gP,Cve as gQ,Pve as gR,Ove as gS,Vve as gT,U1 as gU,$ve as gV,Dve as gW,fK as gX,Bve as gY,kK as gZ,Hve as g_,g_ as ga,Ae as gb,ld as gc,Gn as gd,Ga as ge,Pr as gf,js as gg,nD as gh,Yt as gi,b1 as gj,St as gk,Ty as gl,Ap as gm,mi as gn,m1 as go,Gve as gp,fy as gq,ml as gr,is as gs,f0 as gt,Pn as gu,Dn as gv,no as gw,$1 as gx,G1 as gy,iee as gz,Ys as h,zl as h$,Eo as h0,Uve as h1,zle as h2,uF as h3,qve as h4,ho as h5,hk as h6,Kve as h7,h1 as h8,Ane as h9,dU as hA,Ur as hB,o_e as hC,p_e as hD,g_e as hE,zve as hF,Dbe as hG,mne as hH,cye as hI,uye as hJ,a_e as hK,Mte as hL,VEe as hM,f_e as hN,h_e as hO,Lbe as hP,_r as hQ,Qv as hR,Da as hS,su as hT,iEe as hU,sEe as hV,kU as hW,y_e as hX,x0 as hY,ji as hZ,Xf as h_,ka as ha,FK as hb,Tve as hc,tm as hd,dye as he,Qve as hf,Wve as hg,rr as hh,j9 as hi,HEe as hj,Xbe as hk,Jbe as hl,Vn as hm,Jve as hn,cve as ho,ave as hp,dve as hq,j0e as hr,obe as hs,Vf as ht,Qe as hu,GF as hv,ube as hw,Ube as hx,Np as hy,ete as hz,$K as i,aw as i0,E_e as i1,Nd as i2,Cp as i3,z0e as i4,Cbe as i5,Pbe as i6,b_e as i7,__e as i8,Fe as j,w_e as k,ze as l,ps as m,Ct as n,xe as o,Kk as p,Or as q,Tt as r,Kbe as s,It as t,Rle as u,Ma as v,$be as w,bQ as x,ebe as y,qee as z};
3584//# sourceMappingURL=index-c5647853.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.