Back to Intent preferences
SOURCE / PINNED RELEASE

Made of little things.

Intent preferences

Release
74a3b5ab197a…
Author-recorded commit
Not provided
License
Check the original source

The hash-verified playable HTML, which may contain bundled or minified code. This view does not execute it.

index.html
<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" /><title>Intent preferences</title><meta name="description" content="Manage public napplet handler preferences and ordered fallbacks."><meta name="napplet-id" content="intent-preferences"><meta name="napplet-requires" content="outbox"><meta name="napplet-optional" content="identity theme">
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    
    <script type="module" crossorigin>var vf=Object.defineProperty;var Ws=e=>{throw TypeError(e)};var pf=(e,t,n)=>t in e?vf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var $=(e,t,n)=>pf(e,typeof t!="symbol"?t+"":t,n),_i=(e,t,n)=>t.has(e)||Ws("Cannot "+n);var h=(e,t,n)=>(_i(e,t,"read from private field"),n?n.call(e):t.get(e)),J=(e,t,n)=>t.has(e)?Ws("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),j=(e,t,n,r)=>(_i(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),z=(e,t,n)=>(_i(e,t,"access private method"),n);var ni=Array.isArray,gf=Array.prototype.indexOf,fr=Array.prototype.includes,ri=Array.from,Io=Object.defineProperty,sn=Object.getOwnPropertyDescriptor,_f=Object.getOwnPropertyDescriptors,wf=Object.prototype,bf=Array.prototype,Co=Object.getPrototypeOf,Xs=Object.isExtensible;function Zn(e){return typeof e=="function"}const Mo=()=>{};function mf(e){for(var t=0;t<e.length;t++)e[t]()}function Lo(){var e,t,n=new Promise((r,i)=>{e=r,t=i});return{promise:n,resolve:e,reject:t}}function yf(e,t,n=!1){return e===void 0?n?t():t:e}function Js(e,t){if(Array.isArray(e))return e;if(t===void 0||!(Symbol.iterator in e))return Array.from(e);const n=[];for(const r of e)if(n.push(r),n.length===t)break;return n}const Te=2,In=4,ii=8,os=1<<24,ot=16,ft=32,Yt=64,Mi=128,as=256,lt=512,Se=1024,he=2048,Ge=4096,Pe=8192,Be=16384,Dn=32768,Yr=1<<25,Ht=65536,Hr=1<<17,Ef=1<<18,qn=1<<19,xf=1<<20,_t=1<<25,Zr=1<<21,xn=1<<22,Vt=1<<23,Sn=Symbol("$state"),Po=Symbol("component"),Sf=Symbol("legacy props"),kf=Symbol(""),Mr=Symbol("attributes"),Li=Symbol("class"),Pi=Symbol("style"),Xn=Symbol("text"),Lr=Symbol("form reset"),_r=new class extends Error{constructor(){super(...arguments);$(this,"name","StaleReactionError");$(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};var Bo;const si=!!((Bo=globalThis.document)!=null&&Bo.contentType)&&globalThis.document.contentType.includes("xml"),Af=1,Rf=2,Do=4,Of=8,Nf=16,Bf=1,$f=2,qo={},me=Symbol("uninitialized"),zo="http://www.w3.org/1999/xhtml",Tf="http://www.w3.org/2000/svg",If="@attach";function Cf(){console.warn("https://svelte.dev/e/derived_inert")}function Mf(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function Lf(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}let Pf=!1;function Vo(e){return e===this.v}function Df(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function Uo(e){return!Df(e,this.v)}function Yo(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function qf(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function zf(e,t,n){throw new Error("https://svelte.dev/e/each_key_duplicate")}function Vf(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Uf(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Yf(e){throw new Error("https://svelte.dev/e/effect_orphan")}function Hf(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Zf(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function jf(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Ff(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function Kf(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}function Gf(e){let t=e.p;for(;t!==null&&t.c===null;)t=t.p;return(t==null?void 0:t.c)??null}function Wf(e,t){return e===null&&Yo(),e.c??(e.c=new Map(Gf(e)||void 0))}let $e=null;function Cn(e){$e=e}function Xf(e){return Wf($e).get(e)}function ls(e,t=!1,n){$e={p:$e,i:!1,c:null,e:null,s:e,x:null,r:oe,l:null}}function fs(e){var t=$e,n=t.e;if(n!==null){t.e=null;for(var r of n)pa(r)}return t.i=!0,$e=t.p,Ho(e)}function Ho(e={}){return Io(e,Po,{value:!0}),e}function Zo(){return!0}let Kt=[];function jo(){var e=Kt;Kt=[],mf(e)}function wt(e){if(Kt.length===0&&!sr){var t=Kt;queueMicrotask(()=>{t===Kt&&jo()})}Kt.push(e)}function Jf(){for(;Kt.length>0;)jo()}const Qf=-7169;function ge(e,t){e.f=e.f&Qf|t}function us(e){(e.f&lt)!==0||e.deps===null?ge(e,Se):ge(e,Ge)}function Fo(e,t){(e.f&he)!==0?t.set(e,he):(e.f&Ge)!==0&&t.get(e)!==he&&t.set(e,Ge),ge(e,Se)}function eu(e,t){if(t){const n=document.body;e.autofocus=!0,wt(()=>{document.activeElement===n&&e.focus()})}}let Qs=!1;function tu(){Qs||(Qs=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{var t;if(!e.defaultPrevented)for(const n of e.target.elements)(t=n[Lr])==null||t.call(n)})},{capture:!0}))}function zn(e){var t=F,n=oe;tt(null),yt(null);try{return e()}finally{tt(t),yt(n)}}function Ko(e,t,n,r=n){e.addEventListener(t,()=>zn(n));const i=e[Lr];i?e[Lr]=()=>{i(),r(!0)}:e[Lr]=()=>r(!0),tu()}function Go(e,t,n,r){const i=oi;var s=e.filter(v=>!v.settled),o=t.map(i);if(n.length===0&&s.length===0){r(o);return}var a=oe,l=nu(),f=s.length===1?s[0].promise:s.length>1?Promise.all(s.map(v=>v.promise)):null;function c(v){if((a.f&Be)===0){l();try{r([...o,...v])}catch(g){gt(g,a)}jr()}}var d=Wo();if(n.length===0){f.then(()=>c([])).finally(d);return}function _(){Promise.all(n.map(v=>ru(v))).then(c).catch(v=>gt(v,a)).finally(d)}f?f.then(()=>{if((a.f&Be)!==0){d();return}l(),_(),jr()}):_()}function nu(){var e=oe,t=F,n=$e,r=T;return function(s=!0){yt(e),tt(t),Cn(n),s&&(e.f&Be)===0&&(r==null||r.activate(),r==null||r.apply())}}function jr(e=!0){yt(null),tt(null),Cn(null),e&&(T==null||T.deactivate())}function Wo(){var e=oe,t=e.b,n=T,r=!!(t!=null&&t.is_rendered());return t==null||t.update_pending_count(1,n),n.increment(r,e),()=>{t==null||t.update_pending_count(-1,n),n.decrement(r,e)}}function oi(e){var t=Te|he;return oe!==null&&(oe.f|=qn),{ctx:$e,deps:null,effects:null,equals:Vo,f:t,fn:e,reactions:null,rv:0,v:me,wv:0,parent:oe,ac:null}}const Jn=Symbol("obsolete");function ru(e,t,n){let r=oe;r===null&&qf();var i=void 0,s=un(me),o=!F,a=new Set;return mu(()=>{var v,g;var l=oe,f=Lo();i=f.promise;try{Promise.resolve(e()).then(f.resolve,m=>{m!==_r&&f.reject(m)}).finally(jr)}catch(m){f.reject(m),jr()}var c=T;if(o){if((l.f&Dn)!==0)var d=Wo();if((v=r.b)!=null&&v.is_rendered())(g=c.async_deriveds.get(l))==null||g.reject(Jn);else for(const m of a.values())m.reject(Jn);a.add(f),c.async_deriveds.set(l,f)}const _=(m,p=void 0)=>{d==null||d(),a.delete(f),p!==Jn&&(c.activate(),p?(s.f|=Vt,Mn(s,p)):((s.f&Vt)!==0&&(s.f^=Vt),Mn(s,m)),c.deactivate())};f.promise.then(_,m=>_(null,m||"unknown"))}),ps(()=>{for(const l of a)l.reject(Jn)}),new Promise(l=>{function f(c){function d(){c===i?l(s):f(i)}c.then(d,d)}f(i)})}function de(e){const t=oi(e);return Ea(t),t}function iu(e){const t=oi(e);return t.equals=Uo,t}function su(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)Ae(t[n])}}function cs(e){var t,n=oe,r=e.parent;if(!Zt&&r!==null&&e.v!==me&&(r.f&(Be|Pe))!==0)return Cf(),e.v;yt(r);try{su(e),t=Aa(e)}finally{yt(n)}return t}function Xo(e){var t=cs(e);if(!e.equals(t)&&(e.wv=Sa(),(!(T!=null&&T.is_fork)||e.deps===null)&&(T!==null?(T.capture(e,t,!0),Ut==null||Ut.capture(e,t,!0)):e.v=t,e.deps===null))){ge(e,Se);return}Zt||(ke!==null?(vs()||T!=null&&T.is_fork)&&ke.set(e,t):us(e))}function ou(e){var t;if(e.effects!==null)for(const n of e.effects)(n.teardown||n.ac)&&((t=n.teardown)==null||t.call(n),n.ac!==null&&zn(()=>{n.ac.abort(_r),n.ac=null}),n.fn!==null&&(n.teardown=Mo),ur(n,0),_s(n))}function Jo(e){if(e.effects!==null)for(const t of e.effects)t.teardown&&t.fn!==null&&Ln(t)}let wi=null,gn=null,T=null,Ut=null,ke=null,Di=null,sr=!1,bi=!1,or=null,Pr=null;var eo=0;let au=1;var Rn,On,Nn,Ot,Bn,Nt,hr,dt,ht,$n,en,Q,qi,Qo,zi,Qn,Vi,ea,ta,na,bn,lu,er;const Qr=class Qr{constructor(){J(this,Q);$(this,"id",au++);$(this,"started",!1);$(this,"linked",!0);$(this,"prev",null);$(this,"next",null);$(this,"async_deriveds",new Map);$(this,"current",new Map);$(this,"previous",new Map);J(this,Rn,new Set);J(this,On,new Set);J(this,Nn,0);J(this,Ot,new Map);J(this,Bn,null);J(this,Nt,[]);J(this,hr,[]);J(this,dt,new Map);J(this,ht,new Map);J(this,$n,new Set);$(this,"is_fork",!1);J(this,en,!1);gn===null?wi=gn=this:(gn.next=this,this.prev=gn),gn=this}skip_effect(t){h(this,ht).has(t)||h(this,ht).set(t,{d:[],m:[]}),h(this,$n).delete(t)}unskip_effect(t,n=r=>this.schedule(r)){var r=h(this,ht).get(t);if(r){h(this,ht).delete(t);for(var i of r.d)ge(i,he),n(i);for(i of r.m)ge(i,Ge),n(i)}h(this,$n).add(t)}capture(t,n,r=!1){t.v!==me&&!this.previous.has(t)&&this.previous.set(t,t.v),(t.f&Vt)===0&&(this.current.set(t,[n,r]),ke==null||ke.set(t,n)),this.is_fork||(t.v=n)}activate(){T=this}deactivate(){T=null,ke=null}flush(){try{bi=!0,T=this,z(this,Q,Qn).call(this)}finally{eo=0,Di=null,or=null,Pr=null,bi=!1,T=null,ke=null,bt.clear()}}discard(){var t;for(const n of h(this,On))n(this);h(this,On).clear();for(const n of this.async_deriveds.values())n.reject(Jn);z(this,Q,er).call(this),(t=h(this,Bn))==null||t.resolve()}register_created_effect(t){h(this,hr).push(t)}increment(t,n){if(j(this,Nn,h(this,Nn)+1),t){let r=h(this,Ot).get(n)??0;h(this,Ot).set(n,r+1)}}decrement(t,n){if(j(this,Nn,h(this,Nn)-1),t){let r=h(this,Ot).get(n)??0;r===1?h(this,Ot).delete(n):h(this,Ot).set(n,r-1)}h(this,en)||(j(this,en,!0),wt(()=>{j(this,en,!1),this.linked&&this.flush()}))}transfer_reactions(t){for(const[n,r]of t)this.add_dirty_reaction(n,r);t.clear()}add_dirty_reaction(t,n){(n===he||h(this,dt).get(t)!==he)&&h(this,dt).set(t,n)}oncommit(t){h(this,Rn).add(t)}ondiscard(t){h(this,On).add(t)}settled(){return(h(this,Bn)??j(this,Bn,Lo())).promise}static ensure(){if(T===null){const t=T=new Qr;!bi&&!sr&&wt(()=>{t.started||t.flush()})}return T}apply(){{ke=null;return}}schedule(t){var n;if(Di=t,(n=t.b)!=null&&n.is_pending&&(t.f&(In|ii|os))!==0&&(t.f&Dn)===0){t.b.defer_effect(t);return}h(this,Nt).push(t)}};Rn=new WeakMap,On=new WeakMap,Nn=new WeakMap,Ot=new WeakMap,Bn=new WeakMap,Nt=new WeakMap,hr=new WeakMap,dt=new WeakMap,ht=new WeakMap,$n=new WeakMap,en=new WeakMap,Q=new WeakSet,qi=function(){if(this.is_fork)return!0;for(const t of h(this,Ot).keys())if(!z(this,Q,Qo).call(this,t))return!0;return!1},Qo=function(t){for(var n=t;n!==null;n=n.parent)if(h(this,ht).has(n))return!0;return!1},zi=function(){var t=[];for(const s of h(this,Nt))if(!((s.f&Be)!==0||(s.f&(he|Ge))===0)){for(var n=s,r=!1;n.parent!==null;){n=n.parent;var i=n.f;if((i&(Yt|ft))!==0){if((i&Se)===0){r=!0;break}n.f^=Se}}r||t.push(n)}return j(this,Nt,[]),t},Qn=function(){var a,l,f,c;this.started=!0;for(const[d,_]of h(this,dt))ge(d,_),this.schedule(d);this.apply();for(var t=or=[],n=[],r=Pr=[];h(this,Nt).length>0;){eo++>1e3&&(z(this,Q,er).call(this),uu());for(const d of z(this,Q,zi).call(this))try{z(this,Q,Vi).call(this,d,t,n)}catch(_){throw sa(d),z(this,Q,qi).call(this)||this.discard(),_}}if(T=null,r.length>0){var i=Qr.ensure();for(const d of r)i.schedule(d)}if(or=null,Pr=null,z(this,Q,qi).call(this)){z(this,Q,bn).call(this,n),z(this,Q,bn).call(this,t);for(const[d,_]of h(this,ht))ia(d,_);r.length>0&&z(a=T,Q,Qn).call(a);return}const s=z(this,Q,ea).call(this);if(s){z(this,Q,bn).call(this,n),z(this,Q,bn).call(this,t),z(l=s,Q,na).call(l,this);return}h(this,dt).clear();for(const d of h(this,Rn))d(this);h(this,Rn).clear(),Ut=this,to(n),to(t),Ut=null,(f=h(this,Bn))==null||f.resolve();var o=T;h(this,Nn)===0&&(h(this,Nt).length===0||o!==null)&&z(this,Q,er).call(this),o!==null&&(bt.clear(),z(c=o,Q,Qn).call(c))},Vi=function(t,n,r){t.f^=Se;for(var i=t.first;i!==null;){var s=i.f,o=(s&(ft|Yt))!==0,a=o&&(s&Se)!==0,l=a||(s&Pe)!==0||h(this,ht).has(i);if(!l&&i.fn!==null){o?i.f^=Se:(s&In)!==0?n.push(i):mr(i)&&((s&ot)!==0&&this.add_dirty_reaction(i,Ge),Ln(i));var f=i.first;if(f!==null){i=f;continue}}for(;i!==null;){var c=i.next;if(c!==null){i=c;break}i=i.parent}}},ea=function(){for(var t=this.prev;t!==null;t=t.prev)if(!t.is_fork&&z(this,Q,ta).call(this,t))return t;return null},ta=function(t){for(const[n,[,r]]of this.current)if(!r&&t.current.has(n))return!0;return!1},na=function(t){var r;for(const[i,s]of t.current)!this.previous.has(i)&&t.previous.has(i)&&this.previous.set(i,t.previous.get(i)),this.current.set(i,s);for(const[i,s]of t.async_deriveds){const o=this.async_deriveds.get(i);o&&s.promise.then(o.resolve).catch(o.reject)}t.async_deriveds.clear(),this.transfer_reactions(h(t,dt));const n=i=>{var s=i.reactions;if(s!==null&&!((i.f&Te)!==0&&(i.f&(he|Ge))===0))for(const l of s){var o=l.f;if((o&Te)!==0)n(l);else{var a=l;o&(xn|ot)&&!this.async_deriveds.has(a)&&(h(this,dt).delete(a),ge(a,he),this.schedule(a))}}};for(const i of this.current.keys())n(i);this.oncommit(()=>t.discard()),z(r=t,Q,er).call(r),T=this,z(this,Q,Qn).call(this)},bn=function(t){for(var n=0;n<t.length;n+=1)Fo(t[n],h(this,dt))},lu=function(){var d,_;for(let v=wi;v!==null;v=v.next){var t=v.id<this.id,n=[];for(const[g,[m,p]]of this.current){if(v.current.has(g)){var r=v.current.get(g)[0];if(t&&m!==r)v.current.set(g,[m,p]);else continue}n.push(g)}if(t)for(const[g,m]of this.async_deriveds){const p=v.async_deriveds.get(g);p&&m.promise.then(p.resolve).catch(p.reject)}var i=[...v.current.keys()].filter(g=>!v.current.get(g)[1]);if(!(!v.started||i.length===0)){var s=i.filter(g=>!this.current.has(g));if(s.length===0)t&&v.discard();else if(n.length>0){if(t)for(const g of h(this,$n))v.unskip_effect(g,m=>{var p;(m.f&(ot|xn))!==0?v.schedule(m):z(p=v,Q,bn).call(p,[m])});v.activate();var o=new Set,a=new Map;for(var l of n)ra(l,s,o,a);a=new Map;var f=[...v.current].filter(([g,m])=>{const p=this.current.get(g);return p?p[0]!==m[0]||p[1]!==m[1]:!0}).map(([g])=>g);if(f.length>0)for(const g of h(this,hr))(g.f&(Be|Pe|Hr))===0&&ds(g,f,a)&&((g.f&(xn|ot))!==0?(ge(g,he),v.schedule(g)):v.add_dirty_reaction(g,he));if(h(v,Nt).length>0&&!h(v,en)){v.apply();for(var c of z(d=v,Q,zi).call(d))z(_=v,Q,Vi).call(_,c,[],[])}v.deactivate()}}}},er=function(){if(this.linked){var t=this.prev,n=this.next;t===null?wi=n:t.next=n,n===null?gn=t:n.prev=t,this.linked=!1}};let fn=Qr;function fu(e){var t=sr,n=Ut;Ut=null,sr=!0;try{for(var r;;){if(Jf(),T===null)return r;T.flush()}}finally{sr=t,Ut=n}}function uu(){try{Hf()}catch(e){gt(e,Di)}}let rt=null;function to(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var r=e[n++];if((r.f&(Be|Pe))===0&&mr(r)&&(rt=new Set,Ln(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&ba(r),(rt==null?void 0:rt.size)>0)){bt.clear();for(const i of rt){if((i.f&(Be|Pe))!==0)continue;const s=[i];let o=i.parent;for(;o!==null;)rt.has(o)&&(rt.delete(o),s.push(o)),o=o.parent;for(let a=s.length-1;a>=0;a--){const l=s[a];(l.f&(Be|Pe))===0&&Ln(l)}}rt.clear()}}rt=null}}function ra(e,t,n,r){if(!n.has(e)&&(n.add(e),e.reactions!==null))for(const i of e.reactions){const s=i.f;(s&Te)!==0?ra(i,t,n,r):(s&(xn|ot))!==0&&(s&he)===0&&ds(i,t,r)&&(ge(i,he),hs(i))}}function ds(e,t,n){const r=n.get(e);if(r!==void 0)return r;if(e.deps!==null)for(const i of e.deps){if(fr.call(t,i))return!0;if((i.f&Te)!==0&&ds(i,t,n))return n.set(i,!0),!0}return n.set(e,!1),!1}function hs(e){T.schedule(e)}function ia(e,t){if(!((e.f&ft)!==0&&(e.f&Se)!==0)){(e.f&he)!==0?t.d.push(e):(e.f&Ge)!==0&&t.m.push(e),ge(e,Se);for(var n=e.first;n!==null;)ia(n,t),n=n.next}}function sa(e){ge(e,Se);for(var t=e.first;t!==null;)sa(t),t=t.next}let Fr=new Set;const bt=new Map;let oa=!1;function un(e,t){var n={f:0,v:e,reactions:null,equals:Vo,rv:0,wv:0};return n}function xe(e,t){const n=un(e);return Ea(n),n}function cu(e,t=!1,n=!0){const r=un(e);return t||(r.equals=Uo),r}function X(e,t,n=!1){F!==null&&(!at||(F.f&Hr)!==0)&&Zo()&&(F.f&(Te|ot|xn|Hr))!==0&&(mt===null||!mt.has(e))&&Ff();let r=n?yn(t):t;return Mn(e,r,Pr)}var Ft=null,Ui=0;function Mn(e,t,n=null){if(!e.equals(t)){Zt?bt.set(e,t):bt.has(e)||bt.set(e,e.v);var r=fn.ensure();if(r.capture(e,t),(e.f&Te)!==0){const i=e;(e.f&he)!==0&&cs(i),ke===null&&us(i)}e.wv=Sa(),Ft=null,Ui=0,aa(e,he,n),Ft=null,oe!==null&&(oe.f&Se)!==0&&(oe.f&(ft|Yt))===0&&(Je===null?xu([e]):Je.push(e)),!r.is_fork&&Fr.size>0&&!oa&&du()}return t}function du(){oa=!1;for(const e of Fr){(e.f&Se)!==0&&ge(e,Ge);let t;try{t=mr(e)}catch{t=!0}t&&Ln(e)}Fr.clear()}function ar(e){X(e,e.v+1)}function aa(e,t,n){var r=e.reactions;if(r!==null){var i=r.length;if(Ui+=i,Ui>1e5&&Ft===null&&(Ft=new Set),Ft!==null){if(Ft.has(e))return;Ft.add(e)}for(var s=0;s<i;s++){var o=r[s],a=o.f,l=(a&he)===0;if(l&&ge(o,t),(a&Hr)!==0)Fr.add(o);else if((a&Te)!==0){var f=o;ke==null||ke.delete(f),aa(f,Ge,n)}else if(l){var c=o;(a&ot)!==0&&rt!==null&&rt.add(c),n!==null?n.push(c):hs(c)}}}}function yn(e){if(typeof e!="object"||e===null||Sn in e||Po in e)return e;const t=Co(e);if(t!==wf&&t!==bf)return e;var n=new Map,r=ni(e),i=xe(0),s=an,o=a=>{if(an===s)return a();var l=F,f=an;tt(null),so(s);var c=a();return tt(l),so(f),c};return r&&n.set("length",xe(e.length)),new Proxy(e,{defineProperty(a,l,f){(!("value"in f)||f.configurable===!1||f.enumerable===!1||f.writable===!1)&&Zf();var c=n.get(l);return c===void 0?o(()=>{var d=xe(f.value);return n.set(l,d),d}):X(c,f.value,!0),!0},deleteProperty(a,l){var f=n.get(l);if(f===void 0){if(l in a){const c=o(()=>xe(me));n.set(l,c),ar(i)}}else X(f,me),ar(i);return!0},get(a,l,f){var v;if(l===Sn)return e;var c=n.get(l),d=l in a;if(c===void 0&&(!d||(v=sn(a,l))!=null&&v.writable)&&(c=o(()=>{var g=yn(d?a[l]:me),m=xe(g);return m}),n.set(l,c)),c!==void 0){var _=u(c);return _===me?void 0:_}return Reflect.get(a,l,f)},getOwnPropertyDescriptor(a,l){var _;(_=this.has)==null||_.call(this,a,l);var f=Reflect.getOwnPropertyDescriptor(a,l),c=n.get(l);if(c!==void 0){var d=u(c);if(d===me)return;if(f&&"value"in f)f.value=d;else return{enumerable:!0,configurable:!0,value:d,writable:!0}}return f},has(a,l){var _;if(l===Sn)return!0;var f=n.get(l),c=f!==void 0&&f.v!==me||Reflect.has(a,l);if(f!==void 0||(oe!==null||F!==null)&&(!c||(_=sn(a,l))!=null&&_.writable)){f===void 0&&(f=o(()=>{var v=c?yn(a[l]):me,g=xe(v);return g}),n.set(l,f));var d=u(f);if(d===me)return!1}return c},set(a,l,f,c){var M;var d=n.get(l),_=l in a;if(r&&l==="length")for(var v=f;v<d.v;v+=1){var g=n.get(v+"");g!==void 0?X(g,me):v in a&&(g=o(()=>xe(me)),n.set(v+"",g))}if(d===void 0)(!_||(M=sn(a,l))!=null&&M.writable)&&(d=o(()=>xe(void 0)),X(d,yn(f)),n.set(l,d));else{_=d.v!==me;var m=o(()=>yn(f));X(d,m)}var p=Reflect.getOwnPropertyDescriptor(a,l);if(p!=null&&p.set&&p.set.call(c,f),!_){if(r&&typeof l=="string"){var x=n.get("length"),C=Number(l);Number.isInteger(C)&&C>=x.v&&X(x,C+1)}ar(i)}return!0},ownKeys(a){u(i);var l=Reflect.ownKeys(a).filter(d=>{var _=n.get(d);return _===void 0||_.v!==me});for(var[f,c]of n)c.v!==me&&!(f in a)&&l.push(f);return l},setPrototypeOf(){jf()}})}function no(e){try{if(e!==null&&typeof e=="object"&&Sn in e)return e[Sn]}catch{}return e}function la(e,t){return Object.is(no(e),no(t))}var ro,fa,ua,ca;function hu(){if(ro===void 0){ro=window,fa=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;ua=sn(t,"firstChild").get,ca=sn(t,"nextSibling").get,Xs(e)&&(e[Li]=void 0,e[Mr]=null,e[Pi]=void 0,e.__e=void 0),Xs(n)&&(n[Xn]=void 0)}}function Tt(e=""){return document.createTextNode(e)}function cn(e){return ua.call(e)}function wr(e){return ca.call(e)}function W(e,t){return cn(e)}function da(e,t=!1){{var n=cn(e);return n instanceof Comment&&n.data===""?wr(n):n}}function pe(e,t=!1){return cn(e)}function I(e,t=1,n=!1){let r=e;for(;t--;)r=wr(r);return r}function vu(e){e.textContent=""}function ha(){return!1}function va(e,t,n){return t==null||t===zo?n?document.createElement(e,{is:n}):document.createElement(e):n?document.createElementNS(t,e,{is:n}):document.createElementNS(t,e)}function pu(e){var t=oe;if(t===null)return F.f|=Vt,e;if((t.f&Dn)===0&&(t.f&In)===0)throw e;gt(e,t)}function gt(e,t){if(e===qo)throw e;if(!(t!==null&&(t.f&Be)!==0)){for(;t!==null;){if((t.f&Mi)!==0&&(t.f&(Be|Yr))===0){if((t.f&Dn)===0)throw e;try{t.b.error(e);return}catch(n){e=n}}t=t.parent}throw e}}function gu(e){oe===null&&(F===null&&Yf(),Uf()),Zt&&Vf()}function _u(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function Et(e,t){var n=oe;n!==null&&(n.f&Pe)!==0&&(e|=Pe);var r={ctx:$e,deps:null,nodes:null,f:e|he|lt,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};T==null||T.register_created_effect(r);var i=r;if((e&In)!==0)or!==null?or.push(r):fn.ensure().schedule(r);else if(t!==null){try{Ln(r)}catch(o){throw Ae(r),o}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&(i.f&qn)===0&&(i=i.first,(e&ot)!==0&&(e&Ht)!==0&&i!==null&&(i.f|=Ht))}if(i!==null&&(i.parent=n,n!==null&&_u(i,n),F!==null&&(F.f&Te)!==0&&(e&Yt)===0)){var s=F;(s.effects??(s.effects=[])).push(i)}return r}function vs(){return F!==null&&!at}function ps(e){const t=Et(ii,null);return ge(t,Se),t.teardown=e,t}function wu(e){gu();var t=oe.f,n=!F&&(t&ft)!==0&&$e!==null&&!$e.i;if(n){var r=$e;(r.e??(r.e=[])).push(e)}else return pa(e)}function pa(e){return Et(In|xf,e)}function bu(e){fn.ensure();const t=Et(Yt|qn,e);return(n={})=>new Promise(r=>{n.outro?on(t,()=>{Ae(t),r(void 0)}):(Ae(t),r(void 0))})}function gs(e){return Et(In,e)}function mu(e){return Et(xn|qn,e)}function ga(e,t=0){return Et(ii|t,e)}function qe(e,t=[],n=[],r=[]){Go(r,t,n,i=>{Et(ii,()=>{e(...i.map(u))})})}function br(e,t=0){var n=Et(ot|t,e);return n}function _a(e,t=0){var n=Et(os|t,e);return n}function ze(e){return Et(ft|qn,e)}function wa(e){var t=e.teardown;if(t!==null){const n=Zt,r=F;io(!0),tt(null);try{t.call(null)}catch(i){gt(i,e.parent)}finally{io(n),tt(r)}}}function _s(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){const i=n.ac;i!==null&&zn(()=>{i.abort(_r)});var r=n.next;(n.f&Yt)!==0?n.parent=null:Ae(n,t),n=r}}function yu(e){for(var t=e.first;t!==null;){var n=t.next;(t.f&ft)===0&&Ae(t),t=n}}function Ae(e,t=!0){var n=!1;(t||(e.f&Ef)!==0)&&e.nodes!==null&&e.nodes.end!==null&&(Eu(e.nodes.start,e.nodes.end),n=!0),e.f|=Yr,_s(e,t&&!n),ur(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(const s of r)s.stop();wa(e),e.f^=Yr,e.f|=Be;var i=e.parent;i!==null&&i.first!==null&&ba(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function Eu(e,t){for(;e!==null;){var n=e===t?null:wr(e);e.remove(),e=n}}function ba(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function on(e,t,n=!0){var r=[];e.f|=as,ma(e,r,!0);var i=()=>{n&&Ae(e),t&&t()},s=r.length;if(s>0){var o=()=>--s||i();for(var a of r)a.out(o)}else i()}function ma(e,t,n){if((e.f&Pe)===0){e.f^=Pe;var r=e.nodes&&e.nodes.t;if(r!==null)for(const a of r)(a.is_global||n)&&t.push(a);for(var i=e.first;i!==null;){var s=i.next;if((i.f&Yt)===0){var o=(i.f&Ht)!==0||(i.f&ft)!==0&&(e.f&ot)!==0;ma(i,t,o?n:!1)}i=s}}}function Kr(e){e.f&=~as,ya(e,!0)}function ya(e,t){if((e.f&as)===0&&(e.f&Pe)!==0){e.f^=Pe,(e.f&Se)===0&&(ge(e,he),fn.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,i=(n.f&Ht)!==0||(n.f&ft)!==0;ya(n,i?t:!1),n=r}var s=e.nodes&&e.nodes.t;if(s!==null)for(const o of s)(o.is_global||t)&&o.in()}}function ws(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:wr(n);t.append(n),n=i}}let Zt=!1;function io(e){Zt=e}let F=null,at=!1;function tt(e){F=e}let oe=null;function yt(e){oe=e}let mt=null;function Ea(e){F!==null&&((F.f&Zr)!==0||(F.f&Te)!==0)&&(mt??(mt=new Set)).add(e)}let Ve=null,Ke=0,Je=null;function xu(e){Je=e}let xa=1,Gt=0,an=Gt;function so(e){an=e}function Sa(){return++xa}function mr(e){var t=e.f;if((t&he)!==0)return!0;if((t&Ge)!==0){for(var n=e.deps,r=n.length,i=0;i<r;i++){var s=n[i];if(mr(s)&&Xo(s),s.wv>e.wv)return!0}(t&lt)!==0&&ke===null&&ge(e,Se)}return!1}function ka(e,t,n=!0){var r=e.reactions;if(r!==null&&!(mt!==null&&mt.has(e)))for(var i=0;i<r.length;i++){var s=r[i];(s.f&Te)!==0?ka(s,t,!1):t===s&&(n?ge(s,he):(s.f&Se)!==0&&ge(s,Ge),hs(s))}}function Aa(e){var t=Ve,n=Ke,r=Je,i=F,s=mt,o=$e,a=at,l=an,f=e.f;Ve=null,Ke=0,Je=null,F=(f&(ft|Yt))===0?e:null,mt=null,Cn(e.ctx),at=!1,an=++Gt,e.ac!==null&&(zn(()=>{e.ac.abort(_r)}),e.ac=null);try{e.f|=Zr;var c=e.fn,d=c();e.f|=Dn;var _=oo(e);if(Zo()&&Je!==null&&!at&&_!==null&&(e.f&(Te|Ge|he))===0)for(var v=0;v<Je.length;v++)ka(Je[v],e);if(i!==null&&i!==e){if(Gt++,i.deps!==null)for(let g=0;g<n;g+=1)i.deps[g].rv=Gt;if(t!==null)for(const g of t)g.rv=Gt;Je!==null&&(r===null?r=Je:r.push(...Je))}return(e.f&Vt)!==0&&(e.f^=Vt),d}catch(g){return oo(e),pu(g)}finally{e.f^=Zr,Ve=t,Ke=n,Je=r,F=i,mt=s,Cn(o),at=a,an=l}}function oo(e){var i;var t=e.deps,n=T==null?void 0:T.is_fork;if(Ve!==null){var r;if(n||ur(e,Ke),t!==null&&Ke>0)for(t.length=Ke+Ve.length,r=0;r<Ve.length;r++)t[Ke+r]=Ve[r];else e.deps=t=Ve;if(vs()&&(e.f&lt)!==0)for(r=Ke;r<t.length;r++)((i=t[r]).reactions??(i.reactions=[])).push(e)}else!n&&t!==null&&Ke<t.length&&(ur(e,Ke),t.length=Ke);return t}function Su(e,t){let n=t.reactions;if(n!==null){var r=gf.call(n,e);if(r!==-1){var i=n.length-1;i===0?n=t.reactions=null:(n[r]=n[i],n.pop())}}if(n===null&&(t.f&Te)!==0&&(Ve===null||!fr.call(Ve,t))){var s=t;(s.f&lt)!==0&&(s.f^=lt),s.v!==me&&us(s),s.ac!==null&&zn(()=>{s.ac.abort(_r),s.ac=null,ge(s,he)}),ou(s),ur(s,0)}}function ur(e,t){var n=e.deps;if(n!==null)for(var r=t;r<n.length;r++)Su(e,n[r])}function Ln(e){var t=e.f;if((t&Be)===0){ge(e,Se);var n=oe;oe=e;try{(t&(ot|os))!==0?yu(e):_s(e),wa(e);var r=Aa(e);e.teardown=typeof r=="function"?r:null,e.wv=xa;var i}finally{oe=n}}}async function ku(){await Promise.resolve(),fu()}function u(e){var t=e.f,n=(t&Te)!==0;if(F!==null&&!at){var r=oe!==null&&(oe.f&Be)!==0;if(!r&&(mt===null||!mt.has(e))){var i=F.deps;if((F.f&Zr)!==0)e.rv<Gt&&(e.rv=Gt,Ve===null&&i!==null&&i[Ke]===e?Ke++:Ve===null?Ve=[e]:Ve.push(e));else{F.deps??(F.deps=[]),fr.call(F.deps,e)||F.deps.push(e);var s=e.reactions;s===null?e.reactions=[F]:fr.call(s,F)||s.push(F)}}}if(Zt&&bt.has(e))return bt.get(e);if(n){var o=e;if(Zt){var a=o.v;return((o.f&Se)===0&&o.reactions!==null||Oa(o))&&(a=cs(o)),bt.set(o,a),a}var l=(o.f&lt)===0&&!at&&F!==null&&(F.f&lt)!==0,f=(o.f&Dn)===0;mr(o)&&(l&&(o.f|=lt),Xo(o)),l&&!f&&(Jo(o),Ra(o))}if(ke!=null&&ke.has(e))return ke.get(e);if((e.f&Vt)!==0)throw e.v;return e.v}function Ra(e){if(e.f|=lt,e.deps!==null)for(const n of e.deps){var t=n.reactions;t===null?n.reactions=[e]:fr.call(t,e)||t.push(e),(n.f&Te)!==0&&(n.f&lt)===0&&(Jo(n),Ra(n))}}function Oa(e){if(e.v===me)return!0;if(e.deps===null)return!1;for(const t of e.deps)if(bt.has(t)||(t.f&Te)!==0&&Oa(t))return!0;return!1}function bs(e){var t=at;try{return at=!0,e()}finally{at=t}}function Au(e){return e.endsWith("capture")&&e!=="gotpointercapture"&&e!=="lostpointercapture"}const Ru=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function Ou(e){return Ru.includes(e)}const Nu={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly",defaultvalue:"defaultValue",defaultchecked:"defaultChecked",srcobject:"srcObject",novalidate:"noValidate",allowfullscreen:"allowFullscreen",disablepictureinpicture:"disablePictureInPicture",disableremoteplayback:"disableRemotePlayback"};function Bu(e){return e=e.toLowerCase(),Nu[e]??e}const $u=["touchstart","touchmove"];function Tu(e){return $u.includes(e)}const Wt=Symbol("events"),Na=new Set,Yi=new Set;function Iu(e,t,n,r={}){function i(s){if(r.capture||Hi.call(t,s),!s.cancelBubble)return zn(()=>n==null?void 0:n.call(this,s))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?(i.__removed=!1,wt(()=>{i.__removed||t.addEventListener(e,i,r)})):t.addEventListener(e,i,r),i}function Ee(e,t,n){(t[Wt]??(t[Wt]={}))[e]=n}function Ba(e){for(var t=0;t<e.length;t++)Na.add(e[t]);for(var n of Yi)n(e)}let mi=null,yi=!1;function Hi(e){var m,p;var t=this,n=t.ownerDocument,r=e.type,i=((m=e.composedPath)==null?void 0:m.call(e))||[],s=i[0]||e.target;mi=e,yi||(yi=!0,setTimeout(()=>{yi=!1,mi=null}));var o=0,a=mi===e&&e[Wt];if(a){var l=i.indexOf(a);if(l!==-1&&(t===document||t===window)){e[Wt]=t;return}var f=i.indexOf(t);if(f===-1)return;l<=f&&(o=l)}if(s=i[o]||e.target,s!==t){Io(e,"currentTarget",{configurable:!0,get(){return s||n}});var c=F,d=oe;tt(null),yt(null);try{for(var _,v=[];s!==null&&s!==t;){try{var g=(p=s[Wt])==null?void 0:p[r];g!=null&&(!s.disabled||e.target===s)&&g.call(s,e)}catch(x){_?v.push(x):_=x}if(e.cancelBubble)break;o++,s=o<i.length?i[o]:null}if(_){for(let x of v)queueMicrotask(()=>{throw x});throw _}}finally{e[Wt]=t,delete e.currentTarget,tt(c),yt(d)}}}var $o;const Ei=(($o=globalThis==null?void 0:globalThis.window)==null?void 0:$o.trustedTypes)&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:e=>e});function Cu(e){return(Ei==null?void 0:Ei.createHTML(e))??e}function $a(e){var t=va("template");return t.innerHTML=Cu(e.replaceAll("<!>","<!---->")),t.content}function cr(e,t){var n=oe;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function ye(e,t){var n=(t&Bf)!==0,r=(t&$f)!==0,i,s=!e.startsWith("<!>");return()=>{i===void 0&&(i=$a(s?e:"<!>"+e),n||(i=cn(i)));var o=r||fa?document.importNode(i,!0):i.cloneNode(!0);if(n){var a=cn(o),l=o.lastChild;cr(a,l)}else cr(o,o);return o}}function Mu(e,t,n="svg"){var r=!e.startsWith("<!>"),i=`<${n}>${r?e:"<!>"+e}</${n}>`,s;return()=>{if(!s){var o=$a(i),a=cn(o);s=cn(a)}var l=s.cloneNode(!0);return cr(l,l),l}}function Lu(e,t){return Mu(e,t,"svg")}function Pu(){var e=document.createDocumentFragment(),t=document.createComment(""),n=Tt();return e.append(t,n),cr(t,n),e}function ue(e,t){e!==null&&e.before(t)}function Du(e){let t=0,n=un(0),r;return()=>{vs()&&(u(n),ga(()=>(t===0&&(r=bs(()=>e(()=>ar(n)))),t+=1,()=>{wt(()=>{t-=1,t===0&&(r==null||r(),r=void 0,ar(n))})})))}}var qu=Ht|qn;function zu(e,t,n,r){new Vu(e,t,n,r)}var Qe,ss,et,tn,Ne,Ze,Me,je,vt,nn,zt,Tn,vr,Bt,ei,ne,Uu,Yu,Zi,Dt,Hu,ji,tr,Dr,Fi,Ki;class Vu{constructor(t,n,r,i){J(this,ne);$(this,"parent");$(this,"is_pending",!1);$(this,"transform_error");J(this,Qe);J(this,ss,null);J(this,et);J(this,tn);J(this,Ne);J(this,Ze,null);J(this,Me,null);J(this,je,null);J(this,vt,null);J(this,nn,0);J(this,zt,0);J(this,Tn,!1);J(this,vr,new Map);J(this,Bt,null);J(this,ei,Du(()=>(j(this,Bt,un(h(this,nn))),()=>{j(this,Bt,null)})));var s;j(this,Qe,t),j(this,et,n),j(this,tn,o=>{var a=oe;a.b=this,a.f|=Mi,r(o)}),this.parent=oe.b,this.transform_error=i??((s=this.parent)==null?void 0:s.transform_error)??(o=>o),j(this,Ne,br(()=>{z(this,ne,ji).call(this)},qu))}defer_effect(t){Fo(t,h(this,vr))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!h(this,et).pending}update_pending_count(t,n){z(this,ne,Fi).call(this,t,n),j(this,nn,h(this,nn)+t),!(!h(this,Bt)||h(this,Tn))&&(j(this,Tn,!0),wt(()=>{j(this,Tn,!1),h(this,Bt)&&Mn(h(this,Bt),h(this,nn))}))}get_effect_pending(){return h(this,ei).call(this),u(h(this,Bt))}error(t){if(t===qo||!h(this,et).onerror&&!h(this,et).failed)throw t;T!=null&&T.is_fork?(h(this,Ze)&&T.skip_effect(h(this,Ze)),h(this,Me)&&T.skip_effect(h(this,Me)),h(this,je)&&T.skip_effect(h(this,je)),T.oncommit(()=>{z(this,ne,Dt).call(this)||z(this,ne,Ki).call(this,t)})):z(this,ne,Ki).call(this,t)}}Qe=new WeakMap,ss=new WeakMap,et=new WeakMap,tn=new WeakMap,Ne=new WeakMap,Ze=new WeakMap,Me=new WeakMap,je=new WeakMap,vt=new WeakMap,nn=new WeakMap,zt=new WeakMap,Tn=new WeakMap,vr=new WeakMap,Bt=new WeakMap,ei=new WeakMap,ne=new WeakSet,Uu=function(){try{j(this,Ze,ze(()=>h(this,tn).call(this,h(this,Qe))))}catch(t){this.error(t)}},Yu=function(t){const n=h(this,et).failed,{reset:r,invoke_onerror:i}=z(this,ne,Zi).call(this,t);wt(i),n&&j(this,je,ze(()=>{n(h(this,Qe),()=>t,()=>r)}))},Zi=function(t){var n=!1,r=!1;const i=()=>{if(!z(this,ne,Dt).call(this)){if(n){Lf();return}n=!0,r&&Kf(),h(this,je)!==null&&on(h(this,je),()=>{j(this,je,null)}),z(this,ne,Dr).call(this,()=>{z(this,ne,ji).call(this)})}};return{reset:i,invoke_onerror:()=>{var o,a;if(!z(this,ne,Dt).call(this))try{r=!0,(a=(o=h(this,et)).onerror)==null||a.call(o,t,i),r=!1}catch(l){gt(l,h(this,Ne)&&h(this,Ne).parent)}}}},Dt=function(){return(h(this,Ne).f&(Be|Yr))!==0},Hu=function(){const t=h(this,et).pending;t&&(this.is_pending=!0,j(this,Me,ze(()=>t(h(this,Qe)))),wt(()=>{if(!z(this,ne,Dt).call(this)){var n=j(this,vt,document.createDocumentFragment()),r=Tt(),i=!1;if(n.append(r),j(this,Ze,z(this,ne,Dr).call(this,()=>{try{return ze(()=>h(this,tn).call(this,r))}catch(s){try{this.error(s),i=!0}catch(o){gt(o,h(this,Ne).parent)}return null}})),h(this,Ze)===null){j(this,vt,null),i&&z(this,ne,tr).call(this,T);return}h(this,zt)===0&&(h(this,Qe).before(n),j(this,vt,null),on(h(this,Me),()=>{j(this,Me,null)}),z(this,ne,tr).call(this,T))}}))},ji=function(){try{if(this.is_pending=this.has_pending_snippet(),j(this,zt,0),j(this,nn,0),j(this,Ze,ze(()=>{h(this,tn).call(this,h(this,Qe))})),h(this,zt)>0){var t=j(this,vt,document.createDocumentFragment());ws(h(this,Ze),t);const n=h(this,et).pending;j(this,Me,ze(()=>n(h(this,Qe))))}else z(this,ne,tr).call(this,T)}catch(n){this.error(n)}},tr=function(t){this.is_pending=!1,t.transfer_reactions(h(this,vr))},Dr=function(t){var n=oe,r=F,i=$e;yt(h(this,Ne)),tt(h(this,Ne)),Cn(h(this,Ne).ctx);try{return fn.ensure(),t()}finally{yt(n),tt(r),Cn(i)}},Fi=function(t,n){var r;if(!this.has_pending_snippet()){this.parent&&z(r=this.parent,ne,Fi).call(r,t,n);return}j(this,zt,h(this,zt)+t),h(this,zt)===0&&(z(this,ne,tr).call(this,n),h(this,Me)&&on(h(this,Me),()=>{j(this,Me,null)}),h(this,vt)&&(h(this,Qe).before(h(this,vt)),j(this,vt,null)))},Ki=function(t){h(this,Ze)&&(Ae(h(this,Ze)),j(this,Ze,null)),h(this,Me)&&(Ae(h(this,Me)),j(this,Me,null)),h(this,je)&&(Ae(h(this,je)),j(this,je,null));let n=h(this,et).failed;const r=i=>{if(z(this,ne,Dt).call(this))return;const{reset:s,invoke_onerror:o}=z(this,ne,Zi).call(this,i);o(),n&&!z(this,ne,Dt).call(this)&&j(this,je,z(this,ne,Dr).call(this,()=>{try{return ze(()=>{var a=oe;a.b=this,a.f|=Mi,n(h(this,Qe),()=>i,()=>s)})}catch(a){return gt(a,h(this,Ne).parent),null}}))};wt(()=>{if(!z(this,ne,Dt).call(this)){var i;try{i=this.transform_error(t)}catch(s){gt(s,h(this,Ne)&&h(this,Ne).parent);return}i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(r,s=>gt(s,h(this,Ne)&&h(this,Ne).parent)):r(i)}})};function ve(e,t){var n=t==null?"":typeof t=="object"?`${t}`:t;n!==(e[Xn]??(e[Xn]=e.nodeValue))&&(e[Xn]=n,e.nodeValue=`${n}`)}function Zu(e,t){return ju(e,t)}const $r=new Map;function ju(e,{target:t,anchor:n,props:r={},events:i,context:s,intro:o=!0,transformError:a}){hu();var l=void 0,f=bu(()=>{var c=n??t.appendChild(Tt());zu(c,{pending:()=>{}},v=>{ls({});var g=$e;s&&(g.c=s),i&&(r.$$events=i),l=e(v,r)||Ho(),fs()},a);var d=new Set,_=v=>{for(var g=0;g<v.length;g++){var m=v[g];if(!d.has(m)){d.add(m);var p=Tu(m);for(const M of[t,document]){var x=$r.get(M);x===void 0&&(x=new Map,$r.set(M,x));var C=x.get(m);C===void 0?(M.addEventListener(m,Hi,{passive:p}),x.set(m,1)):x.set(m,C+1)}}}};return _(ri(Na)),Yi.add(_),()=>{var p;for(var v of d)for(const x of[t,document]){var g=$r.get(x),m=g.get(v);--m==0?(x.removeEventListener(v,Hi),g.delete(v),g.size===0&&$r.delete(x)):g.set(v,m)}Yi.delete(_),c!==n&&((p=c.parentNode)==null||p.removeChild(c))}});return Gi.set(l,f),l}let Gi=new WeakMap;function Fu(e,t){const n=Gi.get(e);return n?(Gi.delete(e),n(t)):Promise.resolve()}var st,pt,Fe,rn,pr,gr,ti;class ms{constructor(t,n=!0){$(this,"anchor");J(this,st,new Map);J(this,pt,new Map);J(this,Fe,new Map);J(this,rn,new Set);J(this,pr,!0);J(this,gr,t=>{if(h(this,st).has(t)){var n=h(this,st).get(t),r=h(this,pt).get(n);if(r)Kr(r),h(this,rn).delete(n);else{var i=h(this,Fe).get(n);i&&(Kr(i.effect),h(this,pt).set(n,i.effect),h(this,Fe).delete(n),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),r=i.effect)}for(const[s,o]of h(this,st)){if(h(this,st).delete(s),s===t)break;const a=h(this,Fe).get(o);a&&(Ae(a.effect),h(this,Fe).delete(o))}for(const[s,o]of h(this,pt)){if(s===n||h(this,rn).has(s))continue;const a=()=>{if(Array.from(h(this,st).values()).includes(s)){var f=document.createDocumentFragment();ws(o,f),f.append(Tt()),h(this,Fe).set(s,{effect:o,fragment:f})}else Ae(o);h(this,rn).delete(s),h(this,pt).delete(s)};h(this,pr)||!r?(h(this,rn).add(s),on(o,a,!1)):a()}}});J(this,ti,t=>{h(this,st).delete(t);const n=Array.from(h(this,st).values());for(const[r,i]of h(this,Fe))n.includes(r)||(Ae(i.effect),h(this,Fe).delete(r))});this.anchor=t,j(this,pr,n)}ensure(t,n){var r=T,i=ha();if(n&&!h(this,pt).has(t)&&!h(this,Fe).has(t))if(i){var s=document.createDocumentFragment(),o=Tt();s.append(o),h(this,Fe).set(t,{effect:ze(()=>n(o)),fragment:s})}else h(this,pt).set(t,ze(()=>n(this.anchor)));if(h(this,st).set(r,t),i){for(const[a,l]of h(this,pt))a===t?r.unskip_effect(l):r.skip_effect(l);for(const[a,l]of h(this,Fe))a===t?r.unskip_effect(l.effect):r.skip_effect(l.effect);r.oncommit(h(this,gr)),r.ondiscard(h(this,ti))}else h(this,gr).call(this,r)}}st=new WeakMap,pt=new WeakMap,Fe=new WeakMap,rn=new WeakMap,pr=new WeakMap,gr=new WeakMap,ti=new WeakMap;function nt(e,t,n=!1){var r=new ms(e),i=n?Ht:0;function s(o,a){r.ensure(o,a)}br(()=>{var o=!1;t((a,l=0)=>{o=!0,s(l,a)}),o||s(-1,null)},i)}function qt(e,t){return t}function Ku(e,t,n){for(var r=[],i=t.length,s,o=t.length,a=0;a<i;a++){let d=t[a];on(d,()=>{if(s){if(s.pending.delete(d),s.done.add(d),s.pending.size===0){var _=e.outrogroups;Wi(e,ri(s.done)),_.delete(s),_.size===0&&(e.outrogroups=null)}}else o-=1},!1)}if(o===0){var l=r.length===0&&n!==null&&e.pending.size===0;if(l){var f=n,c=f.parentNode;vu(c),c.append(f),e.items.clear()}Wi(e,t,!l)}else s={pending:new Set(t),done:new Set},(e.outrogroups??(e.outrogroups=new Set)).add(s)}function Wi(e,t,n=!0){var r;if(e.pending.size>0){r=new Set;for(const o of e.pending.values())for(const a of o)r.add(e.items.get(a).e)}for(var i=0;i<t.length;i++){var s=t[i];if(r!=null&&r.has(s)){s.f|=_t;const o=document.createDocumentFragment();ws(s,o)}else Ae(t[i],n)}}var ao;function Rt(e,t,n,r,i,s=null){var o=e,a=new Map,l=(t&Do)!==0;if(l){var f=e;o=f.appendChild(Tt())}var c=null,d=iu(()=>{var C=n();return ni(C)?C:C==null?[]:ri(C)}),_=new Map,v=!0;function g(C){if((x.effect.f&Be)===0){x.pending.delete(C);var M=u(d);x.fallback=c,Gu(x,M,o,t,r),c!==null&&(M.length===0?(c.f&_t)===0?Kr(c):(c.f^=_t,nr(c,null,o)):on(c,()=>{c=null}))}}function m(C){x.pending.delete(C)}var p=br(()=>{for(var C=u(d),M=C.length,U=new Set,ce=T,y=ha(),S=0;S<M;S+=1){var k=C[S],R=r(k,S),N=v?null:a.get(R);N?(N.v&&Mn(N.v,k),N.i&&Mn(N.i,S),y&&ce.unskip_effect(N.e)):(N=Wu(a,v?o:ao??(ao=Tt()),k,R,S,i,t,n),v||(N.e.f|=_t),a.set(R,N)),U.add(R)}if(M===0&&s&&!c&&(v?c=ze(()=>s(o)):(c=ze(()=>s(ao??(ao=Tt()))),c.f|=_t)),M>U.size&&zf(),!v)if(_.set(ce,U),y){for(const[re,A]of a)U.has(re)||ce.skip_effect(A.e);ce.oncommit(g),ce.ondiscard(m)}else g(ce);u(d)}),x={effect:p,items:a,pending:_,outrogroups:null,fallback:c};v=!1}function jn(e){for(;e!==null&&(e.f&ft)===0;)e=e.next;return e}function Gu(e,t,n,r,i){var N,re,A,B,w,E,P,V,ie;var s=(r&Of)!==0,o=t.length,a=e.items,l=jn(e.effect.first),f,c=null,d,_=[],v=[],g,m,p,x;if(s)for(x=0;x<o;x+=1)g=t[x],m=i(g,x),p=a.get(m).e,(p.f&_t)===0&&((re=(N=p.nodes)==null?void 0:N.a)==null||re.measure(),(d??(d=new Set)).add(p));for(x=0;x<o;x+=1){if(g=t[x],m=i(g,x),p=a.get(m).e,e.outrogroups!==null)for(const L of e.outrogroups)L.pending.delete(p),L.done.delete(p);if((p.f&Pe)!==0&&(Kr(p),s&&((B=(A=p.nodes)==null?void 0:A.a)==null||B.unfix(),(d??(d=new Set)).delete(p))),(p.f&_t)!==0)if(p.f^=_t,p===l)nr(p,null,n);else{var C=c?c.next:l;p===e.effect.last&&(e.effect.last=p.prev),p.prev&&(p.prev.next=p.next),p.next&&(p.next.prev=p.prev),It(e,c,p),It(e,p,C),nr(p,C,n),c=p,_=[],v=[],l=jn(c.next);continue}if(p!==l){if(f!==void 0&&f.has(p)){if(_.length<v.length){var M=v[0],U;c=M.prev;var ce=_[0],y=_[_.length-1];for(U=0;U<_.length;U+=1)nr(_[U],M,n);for(U=0;U<v.length;U+=1)f.delete(v[U]);It(e,ce.prev,y.next),It(e,c,ce),It(e,y,M),l=M,c=y,x-=1,_=[],v=[]}else f.delete(p),nr(p,l,n),It(e,p.prev,p.next),It(e,p,c===null?e.effect.first:c.next),It(e,c,p),c=p;continue}for(_=[],v=[];l!==null&&l!==p;)(f??(f=new Set)).add(l),v.push(l),l=jn(l.next);if(l===null)continue}(p.f&_t)===0&&_.push(p),c=p,l=jn(p.next)}if(e.outrogroups!==null){for(const L of e.outrogroups)L.pending.size===0&&(Wi(e,ri(L.done)),(w=e.outrogroups)==null||w.delete(L));e.outrogroups.size===0&&(e.outrogroups=null)}if(l!==null||f!==void 0){var S=[];if(f!==void 0)for(p of f)(p.f&Pe)===0&&S.push(p);for(;l!==null;)(l.f&Pe)===0&&l!==e.fallback&&S.push(l),l=jn(l.next);var k=S.length;if(k>0){var R=(r&Do)!==0&&o===0?n:null;if(s){for(x=0;x<k;x+=1)(P=(E=S[x].nodes)==null?void 0:E.a)==null||P.measure();for(x=0;x<k;x+=1)(ie=(V=S[x].nodes)==null?void 0:V.a)==null||ie.fix()}Ku(e,S,R)}}s&&wt(()=>{var L,Y;if(d!==void 0)for(p of d)(Y=(L=p.nodes)==null?void 0:L.a)==null||Y.apply()})}function Wu(e,t,n,r,i,s,o,a){var l=(o&Af)!==0?(o&Nf)===0?cu(n,!1,!1):un(n):null,f=(o&Rf)!==0?un(i):null;return{v:l,i:f,e:ze(()=>(s(t,l??n,f??i,a),()=>{e.delete(r)}))}}function nr(e,t,n){if(e.nodes)for(var r=e.nodes.start,i=e.nodes.end,s=t&&(t.f&_t)===0?t.nodes.start:n;r!==null;){var o=wr(r);if(s.before(r),r===i)return;r=o}}function It(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function Xu(e,t,...n){var r=new ms(e);br(()=>{const i=t()??null;r.ensure(i,i&&(s=>i(s,...n)))},Ht)}function Ju(e,t,n,r,i,s){var o=null,a=e,l=new ms(a,!1);br(()=>{const f=t()||null;var c=Tf;if(f===null){l.ensure(null,null);return}return l.ensure(f,d=>{if(f){var _=Pf;if(o=va(f,c),cr(o,o),r){var v=null,g=o.appendChild(Tt());r(o,g),v==null||v.remove()}oe.nodes.end=o,_||d.before(o)}}),()=>{}},Ht),ps(()=>{})}function Qu(e,t){var n=void 0,r;_a(()=>{n!==(n=t())&&(r&&(Ae(r),r=null),n&&(r=ze(()=>{gs(()=>n(e))})))})}function Ta(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Ta(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function ec(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Ta(e))&&(r&&(r+=" "),r+=t);return r}function tc(e){return typeof e=="object"?ec(e):e??""}const lo=[...` 	
\r\f \v\uFEFF`];function nc(e,t,n){var r=e==null?"":""+e;if(t&&(r=r?r+" "+t:t),n){for(var i of Object.keys(n))if(n[i])r=r?r+" "+i:i;else if(r.length)for(var s=i.length,o=0;(o=r.indexOf(i,o))>=0;){var a=o+s;(o===0||lo.includes(r[o-1]))&&(a===r.length||lo.includes(r[a]))?r=(o===0?"":r.substring(0,o))+r.substring(a+1):o=a}}return r===""?null:r}function fo(e,t=!1){var n=t?" !important;":";",r="";for(var i of Object.keys(e)){var s=e[i];s!=null&&s!==""&&(r+=" "+i+": "+s+n)}return r}function xi(e){return e[0]!=="-"||e[1]!=="-"?e.toLowerCase():e}function rc(e,t){if(t){var n="",r,i;if(Array.isArray(t)?(r=t[0],i=t[1]):r=t,e){e=String(e).replaceAll(/\/\*.*?\*\//g,"").trim();var s=!1,o=0,a=!1,l=[];r&&l.push(...Object.keys(r).map(xi)),i&&l.push(...Object.keys(i).map(xi));var f=0,c=-1;const m=e.length;for(var d=0;d<m;d++){var _=e[d];if(a?_==="/"&&e[d-1]==="*"&&(a=!1):s?s===_&&(s=!1):_==="/"&&e[d+1]==="*"?a=!0:_==='"'||_==="'"?s=_:_==="("?o++:_===")"&&o--,!a&&s===!1&&o===0){if(_===":"&&c===-1)c=d;else if(_===";"||d===m-1){if(c!==-1){var v=xi(e.substring(f,c).trim());if(!l.includes(v)){_!==";"&&d++;var g=e.substring(f,d).trim();n+=" "+g+";"}}f=d+1,c=-1}}}}return r&&(n+=fo(r)),i&&(n+=fo(i,!0)),n=n.trim(),n===""?null:n}return e==null?null:String(e)}function Ia(e,t,n,r,i,s){var o=e[Li];if(o!==n||o===void 0){var a=nc(n,r,s);a==null?e.removeAttribute("class"):t?e.className=a:e.setAttribute("class",a),e[Li]=n}else if(s&&i!==s)for(var l in s){var f=!!s[l];(i==null||f!==!!i[l])&&e.classList.toggle(l,f)}return s}function Si(e,t={},n,r){for(var i in n){var s=n[i];t[i]!==s&&(n[i]==null?e.style.removeProperty(i):e.style.setProperty(i,s,r))}}function ic(e,t,n,r){var i=e[Pi];if(i!==t){var s=rc(t,r);s==null?e.removeAttribute("style"):e.style.cssText=s,e[Pi]=t}else r&&(Array.isArray(r)?(Si(e,n==null?void 0:n[0],r[0]),Si(e,n==null?void 0:n[1],r[1],"important")):Si(e,n,r));return r}function Ca(e,t){t?e.hasAttribute("selected")||e.setAttribute("selected",""):e.removeAttribute("selected")}function uo(e,t){var n=!("__defaultValue"in e);!n&&e.__defaultValue===t||(e.__defaultValue=t,Ma(e,!n||"__value"in e))}function Ma(e,t){var n=e.__defaultValue,r=e.multiple,i=r?n??[]:null;if(!(r&&!ni(i))){var s=e.selectedIndex,o=t&&r?new Set(e.selectedOptions):null;for(var a of e.options){var l=kn(a);Ca(a,r?i.includes(l):la(l,n))}if(t)if(o!==null)for(a of e.options){var f=o.has(a);a.selected!==f&&(a.selected=f)}else e.selectedIndex!==s&&(e.selectedIndex=s)}}function dr(e,t,n=!1){if(e.multiple){if(t==null)return;if(!ni(t))return Mf();for(var r of e.options)r.selected=t.includes(kn(r));return}for(r of e.options){var i=kn(r);if(la(i,t)){r.selected=!0;return}}(!n||t!==void 0)&&(e.selectedIndex=-1)}function Xi(e){var t=new MutationObserver(n=>{n.every(oc)||("__defaultValue"in e&&Ma(e,!1),"__value"in e&&dr(e,e.__value))});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),ps(()=>{t.disconnect()})}function sc(e,t,n=t){var r=new WeakSet,i=!0;Ko(e,"change",s=>{var o=s?"[selected]":":checked",a;if(e.multiple)a=[].map.call(e.querySelectorAll(o),kn);else{var l=e.querySelector(o)??e.querySelector("option:not([disabled])");a=l&&kn(l)}n(a),e.__value=a,T!==null&&r.add(T)}),gs(()=>{var s=t();if(e===document.activeElement){var o=T;if(r.has(o))return}if(dr(e,s,i),i&&s===void 0){var a=e.querySelector(":checked");a!==null&&(s=kn(a),n(s))}e.__value=s,i=!1})}function kn(e){return"__value"in e?e.__value:e.value}function oc(e){if(e.target.closest("selectedcontent")!==null)return!0;if(e.type==="childList"){var t=[...e.addedNodes,...e.removedNodes];return t.length>0&&t.every(n=>n.nodeName==="SELECTEDCONTENT")}return!1}const Fn=Symbol("class"),Kn=Symbol("style"),La=Symbol("is custom element"),Pa=Symbol("is html"),ac=si?"input":"INPUT",lc=si?"option":"OPTION",Da=si?"select":"SELECT",fc=si?"progress":"PROGRESS";function An(e,t,n,r){var i=qa(e),s=i[t];s!==(i[t]=n)&&(t==="loading"&&(e[kf]=n),n==null?e.removeAttribute(t):typeof n!="string"&&za(e).has(t)?e[t]=n:e.setAttribute(t,n))}function uc(e,t,n,r,i=!1,s=!1){var o=qa(e),a=o[La],l=!o[Pa],f=t||{},c=e.nodeName===lc,d=e.nodeName===Da;try{for(var _ in t)!(_ in n)&&_[0]+_[1]!=="$$"&&(n[_]=null);n.class?n.class=tc(n.class):(r||n[Fn])&&(n.class=null),n[Kn]&&(n.style??(n.style=null));var v=za(e);if(e.nodeName===ac&&"type"in n&&("value"in n||"__value"in n)){var g=n.type;(g!==f.type||g===void 0&&e.hasAttribute("type"))&&(f.type=g,An(e,"type",g,s))}for(const y in n){let S=n[y];if(c&&y==="value"&&S==null){e.value=e.__value="",f[y]=S;continue}if(y==="class"){var m=e.namespaceURI==="http://www.w3.org/1999/xhtml";Ia(e,m,S,r,t==null?void 0:t[Fn],n[Fn]),f[y]=S,f[Fn]=n[Fn];continue}if(y==="style"){ic(e,S,t==null?void 0:t[Kn],n[Kn]),f[y]=S,f[Kn]=n[Kn];continue}var p=f[y];if(!(S===p&&!(S===void 0&&e.hasAttribute(y)))){f[y]=S;var x=y[0]+y[1];if(x!=="$$")if(x==="on"){const k={},R="$$"+y;let N=y.slice(2);var C=Ou(N);if(Au(N)&&(N=N.slice(0,-7),k.capture=!0),!C&&p){if(S!=null)continue;e.removeEventListener(N,f[R],k),f[R]=null}if(C)Ee(N,e,S),Ba([N]);else if(S!=null){let re=function(A){f[y].call(this,A)};var ce=re;f[R]=Iu(N,e,re,k)}}else if(y==="style")An(e,y,S);else if(y==="autofocus")eu(e,!!S);else if(!a&&(y==="__value"||y==="value"&&S!=null))e.__value=S,(p==null||e.value!==S||S===0&&e.nodeName===fc)&&(e.value=S);else if(y==="selected"&&c)Ca(e,S);else{var M=y;l||(M=Bu(M));var U=M==="defaultValue"||M==="defaultChecked";if(d&&M==="defaultValue")continue;if(S==null&&!a&&!U)if(o[y]=null,M==="value"||M==="checked"){let k=e;const R=t===void 0;if(M==="value"){let N=k.defaultValue;k.removeAttribute(M),k.defaultValue=N,k.value=k.__value=R?N:null}else{let N=k.defaultChecked;k.removeAttribute(M),k.defaultChecked=N,k.checked=R?N:!1}}else e.removeAttribute(y);else U||(a||typeof S!="string")&&v.has(M)?(e[M]=S,M in o&&(o[M]=me)):typeof S!="function"&&An(e,M,S,s)}}}}finally{}return f}function co(e,t,n=[],r=[],i=[],s,o=!1,a=!1){Go(i,n,r,l=>{var f=void 0,c={},d=e.nodeName===Da,_=!1;if(_a(()=>{var g=t(...l.map(u)),m=uc(e,f,g,s,o,a);if(_&&d){var p=e;"defaultValue"in g&&uo(p,g.defaultValue),"value"in g&&dr(p,g.value)}for(let C of Object.getOwnPropertySymbols(c))g[C]||Ae(c[C]);for(let C of Object.getOwnPropertySymbols(g)){var x=g[C];C.description===If&&(!f||x!==f[C])&&(c[C]&&Ae(c[C]),c[C]=ze(()=>Qu(e,()=>x))),m[C]=x}f=m}),d){var v=e;gs(()=>{var g=f;"defaultValue"in g&&uo(v,g.defaultValue),dr(v,g.value,!0),Xi(v)})}_=!0})}function qa(e){return e[Mr]??(e[Mr]={[La]:e.nodeName.includes("-"),[Pa]:e.namespaceURI===zo})}var ho=new Map;function za(e){var t=e.getAttribute("is")||e.nodeName,n=ho.get(t);if(n)return n;ho.set(t,n=new Set);for(var r,i=e,s=Element.prototype;s!==i;){r=_f(i);for(var o in r)r[o].set&&o!=="innerHTML"&&o!=="textContent"&&o!=="innerText"&&n.add(o);i=Co(i)}return n}function vo(e,t,n=t){var r=new WeakSet;Ko(e,"input",async i=>{var s=i?e.defaultValue:e.value;if(s=ki(e)?Ai(s):s,n(s),T!==null&&r.add(T),await ku(),s!==(s=t())){var o=e.selectionStart,a=e.selectionEnd,l=e.value.length;if(e.value=s??"",a!==null){var f=e.value.length;o===a&&a===l&&f>l?(e.selectionStart=f,e.selectionEnd=f):(e.selectionStart=o,e.selectionEnd=Math.min(a,f))}}}),bs(t)==null&&e.value&&(n(ki(e)?Ai(e.value):e.value),T!==null&&r.add(T)),ga(()=>{var i=t();if(e===document.activeElement){var s=T;if(r.has(s))return}ki(e)&&i===Ai(e.value)||e.type==="date"&&!i&&!e.value||i!==e.value&&(e.value=i??"")})}function ki(e){var t=e.type;return t==="number"||t==="range"}function Ai(e){return e===""?null:+e}const cc={get(e,t){if(!e.exclude.has(t))return e.props[t]},set(e,t){return!1},getOwnPropertyDescriptor(e,t){if(!e.exclude.has(t)&&t in e.props)return{enumerable:!0,configurable:!0,value:e.props[t]}},has(e,t){return e.exclude.has(t)?!1:t in e.props},ownKeys(e){return Reflect.ownKeys(e.props).filter(t=>!e.exclude.has(t))}};function ut(e,t,n){return new Proxy({props:e,exclude:t},cc)}const dc={get(e,t){let n=e.props.length;for(;n--;){let r=e.props[n];if(Zn(r)&&(r=r()),typeof r=="object"&&r!==null&&t in r)return r[t]}},set(e,t,n){let r=e.props.length;for(;r--;){let i=e.props[r];Zn(i)&&(i=i());const s=sn(i,t);if(s&&s.set)return s.set(n),!0}return!1},getOwnPropertyDescriptor(e,t){let n=e.props.length;for(;n--;){let r=e.props[n];if(Zn(r)&&(r=r()),typeof r=="object"&&r!==null&&t in r){const i=sn(r,t);return i&&!i.configurable&&(i.configurable=!0),i}}},has(e,t){if(t===Sn||t===Sf)return!1;for(let n of e.props)if(Zn(n)&&(n=n()),n!=null&&t in n)return!0;return!1},ownKeys(e){const t=[];for(let n of e.props)if(Zn(n)&&(n=n()),!!n){for(const r in n)t.includes(r)||t.push(r);for(const r of Object.getOwnPropertySymbols(n))t.includes(r)||t.push(r)}return t}};function xt(...e){return new Proxy({props:e},dc)}function kt(e,t,n,r){var i=void 0,s=()=>(i??(i=oi(r)),u(i)),o;o=e[t],o===void 0&&r!==void 0&&(o=s());var a;return a=()=>{var l=e[t];return l===void 0?s():l},a}function hc(e){$e===null&&Yo(),wu(()=>{const t=bs(e);if(typeof t=="function")return t})}function vc(){const e=new Map;function t(i,s){if(e.has(i))throw new Error(`NAP domain "${i}" is already registered`);e.set(i,s)}function n(i){const s=i.type.indexOf(".");if(s<=0)return!1;const o=i.type.slice(0,s),a=e.get(o);return a?(a(i),!0):!1}function r(){return Array.from(e.keys())}return{registerNap:t,dispatch:n,getRegisteredDomains:r}}var pc=vc(),gc=pc.registerNap,Va="theme";function Ua(){var t;const e=window;if(!((t=e.napplet)!=null&&t.theme))throw new Error("window.napplet.theme is unavailable -- runtime did not inject this domain");return e.napplet.theme}function _c(){return Ua().get()}function wc(e){return Ua().onChanged(e)}gc(Va,e=>{});function bc(){const e=window;if(!e.napplet)throw new Error("window.napplet is unavailable -- runtime did not inject the napplet namespace");return e.napplet}function Le(e){const n=bc()[e];if(!n)throw new Error(`window.napplet.${String(e)} is unavailable -- runtime did not inject this domain`);return n}var Tr={getPublicKey(){return Le("identity").getPublicKey()},onChanged(e){return Le("identity").onChanged(e)},getRelays(){return Le("identity").getRelays()},getProfile(){return Le("identity").getProfile()},getFollows(){return Le("identity").getFollows()},getList(e){return Le("identity").getList(e)},getZaps(){return Le("identity").getZaps()},getMutes(){return Le("identity").getMutes()},getBlocked(){return Le("identity").getBlocked()},getBadges(){return Le("identity").getBadges()}},Ct={getEvent(e,t){return Le("outbox").getEvent(e,t)},query(e,t){return Le("outbox").query(e,t)},subscribe(e,t){return Le("outbox").subscribe(e,t)},publish(e,t){return Le("outbox").publish(e,t)},resolveRelays(e){return Le("outbox").resolveRelays(e)}};function mc(e,t){return!!(e!=null&&e[t])}function Ji(e){return mc(window.napplet,e)}const yc="5";var To;typeof window<"u"&&((To=window.__svelte??(window.__svelte={})).v??(To.v=new Set)).add(yc);/**
 * @file
 * @license @lucide/svelte v1.67.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const jt={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};/**
 * @file
 * @license @lucide/svelte v1.67.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Qi=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/**
 * @file
 * @license @lucide/svelte v1.67.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */function Ri(e){return e!=null}function Ec(e,t={}){var _,v;const n=t.attributeNames??{},r=g=>n[g]??g,i=e.size??e.width??jt.width,s=e.size??e.height??jt.height,o=((_=e.aliases)==null?void 0:_.filter(g=>typeof g=="string"&&g.trim()!=="").map(g=>`lucide-${g}`))??[],a=[...e.name?[`lucide-${e.name}`]:[],...o],l=((v=t.className)==null?void 0:v.split(" ").filter(Boolean))??[],f=t.includeDefaultClasses===!1?Qi(...l):Qi("lucide",...a,...l),c=t.absoluteStrokeWidth?Number(t.strokeWidth??jt["stroke-width"])*Number(e.size??e.width??jt.width)/Number(t.size??t.width??jt.width):t.strokeWidth??jt["stroke-width"];return["svg",{...Object.entries(jt).reduce((g,[m,p])=>(g[r(m)]=p,g),{}),..."color"in t&&t.color&&{[r("stroke")]:t.color},..."size"in t&&Ri(t.size)&&{[r("width")]:t.size,[r("height")]:t.size},..."width"in t&&Ri(t.width)&&{[r("width")]:t.width},..."height"in t&&Ri(t.height)&&{[r("height")]:t.height},[r("stroke-width")]:c,...f&&{[r("class")]:f},[r("viewBox")]:`0 0 ${i} ${s}`,...t.hasA11yProp===!1?{[r("aria-hidden")]:"true"}:{},..."attributes"in t&&t.attributes},e.node.map(g=>{const[m,p,x]=g,C=t.nonScalingStroke?{[r("vector-effect")]:"non-scaling-stroke",...p}:p;return x?[m,C,x]:[m,C]})]}/**
 * @file
 * @license @lucide/svelte v1.67.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xc=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};/**
 * @file
 * @license @lucide/svelte v1.67.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Sc=Symbol("lucide-context"),kc=()=>Xf(Sc);var Ac=new Set(["$$slots","$$events","$$legacy","color","size","width","height","strokeWidth","absoluteStrokeWidth","nonScalingStroke","iconNode","icon","class","children"]),Rc=Lu("<svg><!><!></svg>");function St(e,t){ls(t,!0);const n=kc()??{},r=kt(t,"color",19,()=>n.color??"currentColor"),i=kt(t,"size",19,()=>n.size??24),s=kt(t,"width",19,i),o=kt(t,"height",19,i),a=kt(t,"strokeWidth",19,()=>n.strokeWidth??2),l=kt(t,"absoluteStrokeWidth",19,()=>n.absoluteStrokeWidth??!1),f=kt(t,"nonScalingStroke",19,()=>n.nonScalingStroke??!1),c=kt(t,"iconNode",19,()=>[]),d=kt(t,"icon",19,()=>({node:c(),aliases:[],size:24})),_=ut(t,Ac),v=de(()=>!!t.children||xc(_)),g=de(()=>Ec(d(),{color:r(),width:s(),height:o(),strokeWidth:a(),absoluteStrokeWidth:l(),nonScalingStroke:f(),className:Qi("lucide-icon",n.class),hasA11yProp:u(v),attributes:_})),m=de(()=>Js(u(g),3)),p=de(()=>u(m)[1]),x=de(()=>yf(u(m)[2],()=>[],!0)),C=de(()=>({...u(p),class:[...u(p).class.split(" "),t.class]}));var M=Rc();co(M,()=>({...u(C)}));var U=W(M);Rt(U,17,()=>u(x),qt,(y,S)=>{var k=de(()=>Js(u(S),2));let R=()=>u(k)[0],N=()=>u(k)[1];var re=Pu(),A=da(re);Ju(A,R,!0,(B,w)=>{co(B,()=>({...N()}))}),ue(y,re)});var ce=I(U);Xu(ce,()=>t.children??Mo),ue(e,M),fs()}const Ya={name:"arrow-down",size:24,node:[["path",{d:"M12 5v14"}],["path",{d:"m19 12-7 7-7-7"}]]};Ya.node;var Oc=new Set(["$$slots","$$events","$$legacy"]);function Nc(e,t){let n=ut(t,Oc);St(e,xt(()=>n,{get icon(){return Ya}}))}const Ha={name:"arrow-up",size:24,node:[["path",{d:"m5 12 7-7 7 7"}],["path",{d:"M12 19V5"}]]};Ha.node;var Bc=new Set(["$$slots","$$events","$$legacy"]);function $c(e,t){let n=ut(t,Bc);St(e,xt(()=>n,{get icon(){return Ha}}))}const Za={name:"check",size:24,node:[["path",{d:"M20 6 9 17l-5-5"}]]};Za.node;var Tc=new Set(["$$slots","$$events","$$legacy"]);function Ic(e,t){let n=ut(t,Tc);St(e,xt(()=>n,{get icon(){return Za}}))}const ja={name:"chevron-right",size:24,node:[["path",{d:"m9 18 6-6-6-6"}]]};ja.node;var Cc=new Set(["$$slots","$$events","$$legacy"]);function Mc(e,t){let n=ut(t,Cc);St(e,xt(()=>n,{get icon(){return ja}}))}const Fa={name:"globe",size:24,node:[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}],["path",{d:"M2 12h20"}]]};Fa.node;var Lc=new Set(["$$slots","$$events","$$legacy"]);function Pc(e,t){let n=ut(t,Lc);St(e,xt(()=>n,{get icon(){return Fa}}))}const Ka={name:"layers",size:24,node:[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17"}]],aliases:["layers-3"]};Ka.node;var Dc=new Set(["$$slots","$$events","$$legacy"]);function qc(e,t){let n=ut(t,Dc);St(e,xt(()=>n,{get icon(){return Ka}}))}const Ga={name:"plus",size:24,node:[["path",{d:"M5 12h14"}],["path",{d:"M12 5v14"}]]};Ga.node;var zc=new Set(["$$slots","$$events","$$legacy"]);function po(e,t){let n=ut(t,zc);St(e,xt(()=>n,{get icon(){return Ga}}))}const Wa={name:"refresh-cw",size:24,node:[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}],["path",{d:"M21 3v5h-5"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}],["path",{d:"M8 16H3v5"}]]};Wa.node;var Vc=new Set(["$$slots","$$events","$$legacy"]);function Uc(e,t){let n=ut(t,Vc);St(e,xt(()=>n,{get icon(){return Wa}}))}const Xa={name:"search",size:24,node:[["path",{d:"m21 21-4.34-4.34"}],["circle",{cx:"11",cy:"11",r:"8"}]]};Xa.node;var Yc=new Set(["$$slots","$$events","$$legacy"]);function Hc(e,t){let n=ut(t,Yc);St(e,xt(()=>n,{get icon(){return Xa}}))}const Ja={name:"x",size:24,node:[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]]};Ja.node;var Zc=new Set(["$$slots","$$events","$$legacy"]);function jc(e,t){let n=ut(t,Zc);St(e,xt(()=>n,{get icon(){return Ja}}))}/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Fc(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function ys(e,t=""){if(!Number.isSafeInteger(e)||e<0){const n=t&&`"${t}" `;throw new Error(`${n}expected integer >= 0, got ${e}`)}}function Ye(e,t,n=""){const r=Fc(e),i=e==null?void 0:e.length,s=t!==void 0;if(!r||s&&i!==t){const o=n&&`"${n}" `,a=s?` of length ${t}`:"",l=r?`length=${i}`:`type=${typeof e}`;throw new Error(o+"expected Uint8Array"+a+", got "+l)}return e}function go(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Kc(e,t){Ye(e,void 0,"digestInto() output");const n=t.outputLen;if(e.length<n)throw new Error('"digestInto() output" expected to be of length >='+n)}function es(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Oi(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function ct(e,t){return e<<32-t|e>>>t}const Qa=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Gc=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function ln(e){if(Ye(e),Qa)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=Gc[e[n]];return t}const At={_0:48,_9:57,A:65,F:70,a:97,f:102};function _o(e){if(e>=At._0&&e<=At._9)return e-At._0;if(e>=At.A&&e<=At.F)return e-(At.A-10);if(e>=At.a&&e<=At.f)return e-(At.a-10)}function En(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(Qa)return Uint8Array.fromHex(e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let i=0,s=0;i<n;i++,s+=2){const o=_o(e.charCodeAt(s)),a=_o(e.charCodeAt(s+1));if(o===void 0||a===void 0){const l=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+l+'" at index '+s)}r[i]=o*16+a}return r}function Gr(...e){let t=0;for(let r=0;r<e.length;r++){const i=e[r];Ye(i),t+=i.length}const n=new Uint8Array(t);for(let r=0,i=0;r<e.length;r++){const s=e[r];n.set(s,i),i+=s.length}return n}function Wc(e,t={}){const n=(i,s)=>e(s).update(i).digest(),r=e(void 0);return n.outputLen=r.outputLen,n.blockLen=r.blockLen,n.create=i=>e(i),Object.assign(n,t),Object.freeze(n)}function el(e=32){const t=typeof globalThis=="object"?globalThis.crypto:null;if(typeof(t==null?void 0:t.getRandomValues)!="function")throw new Error("crypto.getRandomValues must be defined");return t.getRandomValues(new Uint8Array(e))}const Xc=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function Jc(e,t,n){return e&t^~e&n}function Qc(e,t,n){return e&t^e&n^t&n}class ed{constructor(t,n,r,i){$(this,"blockLen");$(this,"outputLen");$(this,"padOffset");$(this,"isLE");$(this,"buffer");$(this,"view");$(this,"finished",!1);$(this,"length",0);$(this,"pos",0);$(this,"destroyed",!1);this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(t),this.view=Oi(this.buffer)}update(t){go(this),Ye(t);const{view:n,buffer:r,blockLen:i}=this,s=t.length;for(let o=0;o<s;){const a=Math.min(i-this.pos,s-o);if(a===i){const l=Oi(t);for(;i<=s-o;o+=i)this.process(l,o);continue}r.set(t.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===i&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){go(this),Kc(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:i,isLE:s}=this;let{pos:o}=this;n[o++]=128,es(this.buffer.subarray(o)),this.padOffset>i-o&&(this.process(r,0),o=0);for(let d=o;d<i;d++)n[d]=0;r.setBigUint64(i-8,BigInt(this.length*8),s),this.process(r,0);const a=Oi(t),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen must be aligned to 32bit");const f=l/4,c=this.get();if(f>c.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<f;d++)a.setUint32(4*d,c[d],s)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:i,finished:s,destroyed:o,pos:a}=this;return t.destroyed=o,t.finished=s,t.length=i,t.pos=a,i%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}}const Mt=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),td=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]),Lt=new Uint32Array(64);class nd extends ed{constructor(t){super(64,t,8,!1)}get(){const{A:t,B:n,C:r,D:i,E:s,F:o,G:a,H:l}=this;return[t,n,r,i,s,o,a,l]}set(t,n,r,i,s,o,a,l){this.A=t|0,this.B=n|0,this.C=r|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=a|0,this.H=l|0}process(t,n){for(let d=0;d<16;d++,n+=4)Lt[d]=t.getUint32(n,!1);for(let d=16;d<64;d++){const _=Lt[d-15],v=Lt[d-2],g=ct(_,7)^ct(_,18)^_>>>3,m=ct(v,17)^ct(v,19)^v>>>10;Lt[d]=m+Lt[d-7]+g+Lt[d-16]|0}let{A:r,B:i,C:s,D:o,E:a,F:l,G:f,H:c}=this;for(let d=0;d<64;d++){const _=ct(a,6)^ct(a,11)^ct(a,25),v=c+_+Jc(a,l,f)+td[d]+Lt[d]|0,m=(ct(r,2)^ct(r,13)^ct(r,22))+Qc(r,i,s)|0;c=f,f=l,l=a,a=o+v|0,o=s,s=i,i=r,r=v+m|0}r=r+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,l=l+this.F|0,f=f+this.G|0,c=c+this.H|0,this.set(r,i,s,o,a,l,f,c)}roundClean(){es(Lt)}destroy(){this.set(0,0,0,0,0,0,0,0),es(this.buffer)}}class rd extends nd{constructor(){super(32);$(this,"A",Mt[0]|0);$(this,"B",Mt[1]|0);$(this,"C",Mt[2]|0);$(this,"D",Mt[3]|0);$(this,"E",Mt[4]|0);$(this,"F",Mt[5]|0);$(this,"G",Mt[6]|0);$(this,"H",Mt[7]|0)}}const ts=Wc(()=>new rd,Xc(1));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Es=BigInt(0),ns=BigInt(1);function wo(e,t=""){if(typeof e!="boolean"){const n=t&&`"${t}" `;throw new Error(n+"expected boolean, got type="+typeof e)}return e}function id(e){if(typeof e=="bigint"){if(!ad(e))throw new Error("positive bigint expected, got "+e)}else ys(e);return e}function tl(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?Es:BigInt("0x"+e)}function xs(e){return tl(ln(e))}function nl(e){return tl(ln(sd(Ye(e)).reverse()))}function Ss(e,t){ys(t),e=id(e);const n=En(e.toString(16).padStart(t*2,"0"));if(n.length!==t)throw new Error("number too large");return n}function rl(e,t){return Ss(e,t).reverse()}function sd(e){return Uint8Array.from(e)}function od(e){return Uint8Array.from(e,(t,n)=>{const r=t.charCodeAt(0);if(t.length!==1||r>127)throw new Error(`string contains non-ASCII character "${e[n]}" with code ${r} at position ${n}`);return r})}const ad=e=>typeof e=="bigint"&&Es<=e;function ld(e){let t;for(t=0;e>Es;e>>=ns,t+=1);return t}const il=e=>(ns<<BigInt(e))-ns;function sl(e,t={},n={}){if(!e||typeof e!="object")throw new Error("expected valid options object");function r(s,o,a){const l=e[s];if(a&&l===void 0)return;const f=typeof l;if(f!==o||l===null)throw new Error(`param "${s}" is invalid: expected ${o}, got ${f}`)}const i=(s,o)=>Object.entries(s).forEach(([a,l])=>r(a,l,o));i(t,!1),i(n,!0)}function bo(e){const t=new WeakMap;return(n,...r)=>{const i=t.get(n);if(i!==void 0)return i;const s=e(n,...r);return t.set(n,s),s}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ue=BigInt(0),De=BigInt(1),Xt=BigInt(2),ol=BigInt(3),al=BigInt(4),ll=BigInt(5),fd=BigInt(7),fl=BigInt(8),ud=BigInt(9),ul=BigInt(16);function it(e,t){const n=e%t;return n>=Ue?n:t+n}function Xe(e,t,n){let r=e;for(;t-- >Ue;)r*=r,r%=n;return r}function mo(e,t){if(e===Ue)throw new Error("invert: expected non-zero number");if(t<=Ue)throw new Error("invert: expected positive modulus, got "+t);let n=it(e,t),r=t,i=Ue,s=De;for(;n!==Ue;){const a=r/n,l=r%n,f=i-s*a;r=n,n=l,i=s,s=f}if(r!==De)throw new Error("invert: does not exist");return it(i,t)}function ks(e,t,n){if(!e.eql(e.sqr(t),n))throw new Error("Cannot find square root")}function cl(e,t){const n=(e.ORDER+De)/al,r=e.pow(t,n);return ks(e,r,t),r}function cd(e,t){const n=(e.ORDER-ll)/fl,r=e.mul(t,Xt),i=e.pow(r,n),s=e.mul(t,i),o=e.mul(e.mul(s,Xt),i),a=e.mul(s,e.sub(o,e.ONE));return ks(e,a,t),a}function dd(e){const t=ai(e),n=dl(e),r=n(t,t.neg(t.ONE)),i=n(t,r),s=n(t,t.neg(r)),o=(e+fd)/ul;return(a,l)=>{let f=a.pow(l,o),c=a.mul(f,r);const d=a.mul(f,i),_=a.mul(f,s),v=a.eql(a.sqr(c),l),g=a.eql(a.sqr(d),l);f=a.cmov(f,c,v),c=a.cmov(_,d,g);const m=a.eql(a.sqr(c),l),p=a.cmov(f,c,m);return ks(a,p,l),p}}function dl(e){if(e<ol)throw new Error("sqrt is not defined for small field");let t=e-De,n=0;for(;t%Xt===Ue;)t/=Xt,n++;let r=Xt;const i=ai(e);for(;yo(i,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return cl;let s=i.pow(r,t);const o=(t+De)/Xt;return function(l,f){if(l.is0(f))return f;if(yo(l,f)!==1)throw new Error("Cannot find square root");let c=n,d=l.mul(l.ONE,s),_=l.pow(f,t),v=l.pow(f,o);for(;!l.eql(_,l.ONE);){if(l.is0(_))return l.ZERO;let g=1,m=l.sqr(_);for(;!l.eql(m,l.ONE);)if(g++,m=l.sqr(m),g===c)throw new Error("Cannot find square root");const p=De<<BigInt(c-g-1),x=l.pow(d,p);c=g,d=l.sqr(x),_=l.mul(_,d),v=l.mul(v,x)}return v}}function hd(e){return e%al===ol?cl:e%fl===ll?cd:e%ul===ud?dd(e):dl(e)}const vd=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function pd(e){const t={ORDER:"bigint",BYTES:"number",BITS:"number"},n=vd.reduce((r,i)=>(r[i]="function",r),t);return sl(e,n),e}function gd(e,t,n){if(n<Ue)throw new Error("invalid exponent, negatives unsupported");if(n===Ue)return e.ONE;if(n===De)return t;let r=e.ONE,i=t;for(;n>Ue;)n&De&&(r=e.mul(r,i)),i=e.sqr(i),n>>=De;return r}function hl(e,t,n=!1){const r=new Array(t.length).fill(n?e.ZERO:void 0),i=t.reduce((o,a,l)=>e.is0(a)?o:(r[l]=o,e.mul(o,a)),e.ONE),s=e.inv(i);return t.reduceRight((o,a,l)=>e.is0(a)?o:(r[l]=e.mul(o,r[l]),e.mul(o,a)),s),r}function yo(e,t){const n=(e.ORDER-De)/Xt,r=e.pow(t,n),i=e.eql(r,e.ONE),s=e.eql(r,e.ZERO),o=e.eql(r,e.neg(e.ONE));if(!i&&!s&&!o)throw new Error("invalid Legendre symbol result");return i?1:s?0:-1}function _d(e,t){t!==void 0&&ys(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}class wd{constructor(t,n={}){$(this,"ORDER");$(this,"BITS");$(this,"BYTES");$(this,"isLE");$(this,"ZERO",Ue);$(this,"ONE",De);$(this,"_lengths");$(this,"_sqrt");$(this,"_mod");var o;if(t<=Ue)throw new Error("invalid field: expected ORDER > 0, got "+t);let r;this.isLE=!1,n!=null&&typeof n=="object"&&(typeof n.BITS=="number"&&(r=n.BITS),typeof n.sqrt=="function"&&(this.sqrt=n.sqrt),typeof n.isLE=="boolean"&&(this.isLE=n.isLE),n.allowedLengths&&(this._lengths=(o=n.allowedLengths)==null?void 0:o.slice()),typeof n.modFromBytes=="boolean"&&(this._mod=n.modFromBytes));const{nBitLength:i,nByteLength:s}=_d(t,r);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=t,this.BITS=i,this.BYTES=s,this._sqrt=void 0,Object.preventExtensions(this)}create(t){return it(t,this.ORDER)}isValid(t){if(typeof t!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof t);return Ue<=t&&t<this.ORDER}is0(t){return t===Ue}isValidNot0(t){return!this.is0(t)&&this.isValid(t)}isOdd(t){return(t&De)===De}neg(t){return it(-t,this.ORDER)}eql(t,n){return t===n}sqr(t){return it(t*t,this.ORDER)}add(t,n){return it(t+n,this.ORDER)}sub(t,n){return it(t-n,this.ORDER)}mul(t,n){return it(t*n,this.ORDER)}pow(t,n){return gd(this,t,n)}div(t,n){return it(t*mo(n,this.ORDER),this.ORDER)}sqrN(t){return t*t}addN(t,n){return t+n}subN(t,n){return t-n}mulN(t,n){return t*n}inv(t){return mo(t,this.ORDER)}sqrt(t){return this._sqrt||(this._sqrt=hd(this.ORDER)),this._sqrt(this,t)}toBytes(t){return this.isLE?rl(t,this.BYTES):Ss(t,this.BYTES)}fromBytes(t,n=!1){Ye(t);const{_lengths:r,BYTES:i,isLE:s,ORDER:o,_mod:a}=this;if(r){if(!r.includes(t.length)||t.length>i)throw new Error("Field.fromBytes: expected "+r+" bytes, got "+t.length);const f=new Uint8Array(i);f.set(t,s?0:f.length-t.length),t=f}if(t.length!==i)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+t.length);let l=s?nl(t):xs(t);if(a&&(l=it(l,o)),!n&&!this.isValid(l))throw new Error("invalid field element: outside of range 0..ORDER");return l}invertBatch(t){return hl(this,t)}cmov(t,n,r){return r?n:t}}function ai(e,t={}){return new wd(e,t)}function vl(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function bd(e){const t=vl(e);return t+Math.ceil(t/2)}function md(e,t,n=!1){Ye(e);const r=e.length,i=vl(t),s=bd(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const o=n?nl(e):xs(e),a=it(o,t-De)+De;return n?rl(a,i):Ss(a,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Pn=BigInt(0),Jt=BigInt(1);function Wr(e,t){const n=t.negate();return e?n:t}function Eo(e,t){const n=hl(e.Fp,t.map(r=>r.Z));return t.map((r,i)=>e.fromAffine(r.toAffine(n[i])))}function pl(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function Ni(e,t){pl(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),i=2**e,s=il(e),o=BigInt(e);return{windows:n,windowSize:r,mask:s,maxNumber:i,shiftBy:o}}function xo(e,t,n){const{windowSize:r,mask:i,maxNumber:s,shiftBy:o}=n;let a=Number(e&i),l=e>>o;a>r&&(a-=s,l+=Jt);const f=t*r,c=f+Math.abs(a)-1,d=a===0,_=a<0,v=t%2!==0;return{nextN:l,offset:c,isZero:d,isNeg:_,isNegF:v,offsetF:f}}const Bi=new WeakMap,gl=new WeakMap;function $i(e){return gl.get(e)||1}function So(e){if(e!==Pn)throw new Error("invalid wNAF")}class yd{constructor(t,n){$(this,"BASE");$(this,"ZERO");$(this,"Fn");$(this,"bits");this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=n}_unsafeLadder(t,n,r=this.ZERO){let i=t;for(;n>Pn;)n&Jt&&(r=r.add(i)),i=i.double(),n>>=Jt;return r}precomputeWindow(t,n){const{windows:r,windowSize:i}=Ni(n,this.bits),s=[];let o=t,a=o;for(let l=0;l<r;l++){a=o,s.push(a);for(let f=1;f<i;f++)a=a.add(o),s.push(a);o=a.double()}return s}wNAF(t,n,r){if(!this.Fn.isValid(r))throw new Error("invalid scalar");let i=this.ZERO,s=this.BASE;const o=Ni(t,this.bits);for(let a=0;a<o.windows;a++){const{nextN:l,offset:f,isZero:c,isNeg:d,isNegF:_,offsetF:v}=xo(r,a,o);r=l,c?s=s.add(Wr(_,n[v])):i=i.add(Wr(d,n[f]))}return So(r),{p:i,f:s}}wNAFUnsafe(t,n,r,i=this.ZERO){const s=Ni(t,this.bits);for(let o=0;o<s.windows&&r!==Pn;o++){const{nextN:a,offset:l,isZero:f,isNeg:c}=xo(r,o,s);if(r=a,!f){const d=n[l];i=i.add(c?d.negate():d)}}return So(r),i}getPrecomputes(t,n,r){let i=Bi.get(n);return i||(i=this.precomputeWindow(n,t),t!==1&&(typeof r=="function"&&(i=r(i)),Bi.set(n,i))),i}cached(t,n,r){const i=$i(t);return this.wNAF(i,this.getPrecomputes(i,t,r),n)}unsafe(t,n,r,i){const s=$i(t);return s===1?this._unsafeLadder(t,n,i):this.wNAFUnsafe(s,this.getPrecomputes(s,t,r),n,i)}createCache(t,n){pl(n,this.bits),gl.set(t,n),Bi.delete(t)}hasCache(t){return $i(t)!==1}}function Ed(e,t,n,r){let i=t,s=e.ZERO,o=e.ZERO;for(;n>Pn||r>Pn;)n&Jt&&(s=s.add(i)),r&Jt&&(o=o.add(i)),i=i.double(),n>>=Jt,r>>=Jt;return{p1:s,p2:o}}function ko(e,t,n){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return pd(t),t}else return ai(e,{isLE:n})}function xd(e,t,n={},r){if(r===void 0&&(r=e==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${e} CURVE object`);for(const l of["p","n","h"]){const f=t[l];if(!(typeof f=="bigint"&&f>Pn))throw new Error(`CURVE.${l} must be positive bigint`)}const i=ko(t.p,n.Fp,r),s=ko(t.n,n.Fn,r),a=["Gx","Gy","a","b"];for(const l of a)if(!i.isValid(t[l]))throw new Error(`CURVE.${l} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:i,Fn:s}}function Sd(e,t){return function(r){const i=e(r);return{secretKey:i,publicKey:t(i)}}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ao=(e,t)=>(e+(e>=0?t:-t)/Ad)/t;function kd(e,t,n){const[[r,i],[s,o]]=t,a=Ao(o*e,n),l=Ao(-i*e,n);let f=e-a*r-l*s,c=-a*i-l*o;const d=f<rr,_=c<rr;d&&(f=-f),_&&(c=-c);const v=il(Math.ceil(ld(n)/2))+qr;if(f<rr||f>=v||c<rr||c>=v)throw new Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:d,k1:f,k2neg:_,k2:c}}const rr=BigInt(0),qr=BigInt(1),Ad=BigInt(2),Ir=BigInt(3),Rd=BigInt(4);function Od(e,t={}){const n=xd("weierstrass",e,t),{Fp:r,Fn:i}=n;let s=n.CURVE;const{h:o,n:a}=s;sl(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});const{endo:l}=t;if(l&&(!r.is0(s.a)||typeof l.beta!="bigint"||!Array.isArray(l.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const f=Bd(r,i);function c(){if(!r.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function d(B,w,E){const{x:P,y:V}=w.toAffine(),ie=r.toBytes(P);if(wo(E,"isCompressed"),E){c();const L=!r.isOdd(V);return Gr(Nd(L),ie)}else return Gr(Uint8Array.of(4),ie,r.toBytes(V))}function _(B){Ye(B,void 0,"Point");const{publicKey:w,publicKeyUncompressed:E}=f,P=B.length,V=B[0],ie=B.subarray(1);if(P===w&&(V===2||V===3)){const L=r.fromBytes(ie);if(!r.isValid(L))throw new Error("bad point: is not on curve, wrong x");const Y=m(L);let D;try{D=r.sqrt(Y)}catch(_e){const fe=_e instanceof Error?": "+_e.message:"";throw new Error("bad point: is not on curve, sqrt error"+fe)}c();const ee=r.isOdd(D);return(V&1)===1!==ee&&(D=r.neg(D)),{x:L,y:D}}else if(P===E&&V===4){const L=r.BYTES,Y=r.fromBytes(ie.subarray(0,L)),D=r.fromBytes(ie.subarray(L,L*2));if(!p(Y,D))throw new Error("bad point: is not on curve");return{x:Y,y:D}}else throw new Error(`bad point: got length ${P}, expected compressed=${w} or uncompressed=${E}`)}const v=t.toBytes||d,g=t.fromBytes||_;function m(B){const w=r.sqr(B),E=r.mul(w,B);return r.add(r.add(E,r.mul(B,s.a)),s.b)}function p(B,w){const E=r.sqr(w),P=m(B);return r.eql(E,P)}if(!p(s.Gx,s.Gy))throw new Error("bad curve params: generator point");const x=r.mul(r.pow(s.a,Ir),Rd),C=r.mul(r.sqr(s.b),BigInt(27));if(r.is0(r.add(x,C)))throw new Error("bad curve params: a or b");function M(B,w,E=!1){if(!r.isValid(w)||E&&r.is0(w))throw new Error(`bad point coordinate ${B}`);return w}function U(B){if(!(B instanceof R))throw new Error("Weierstrass Point expected")}function ce(B){if(!l||!l.basises)throw new Error("no endo");return kd(B,l.basises,i.ORDER)}const y=bo((B,w)=>{const{X:E,Y:P,Z:V}=B;if(r.eql(V,r.ONE))return{x:E,y:P};const ie=B.is0();w==null&&(w=ie?r.ONE:r.inv(V));const L=r.mul(E,w),Y=r.mul(P,w),D=r.mul(V,w);if(ie)return{x:r.ZERO,y:r.ZERO};if(!r.eql(D,r.ONE))throw new Error("invZ was invalid");return{x:L,y:Y}}),S=bo(B=>{if(B.is0()){if(t.allowInfinityPoint&&!r.is0(B.Y))return;throw new Error("bad point: ZERO")}const{x:w,y:E}=B.toAffine();if(!r.isValid(w)||!r.isValid(E))throw new Error("bad point: x or y not field elements");if(!p(w,E))throw new Error("bad point: equation left != right");if(!B.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function k(B,w,E,P,V){return E=new R(r.mul(E.X,B),E.Y,E.Z),w=Wr(P,w),E=Wr(V,E),w.add(E)}const A=class A{constructor(w,E,P){$(this,"X");$(this,"Y");$(this,"Z");this.X=M("x",w),this.Y=M("y",E,!0),this.Z=M("z",P),Object.freeze(this)}static CURVE(){return s}static fromAffine(w){const{x:E,y:P}=w||{};if(!w||!r.isValid(E)||!r.isValid(P))throw new Error("invalid affine point");if(w instanceof A)throw new Error("projective point not allowed");return r.is0(E)&&r.is0(P)?A.ZERO:new A(E,P,r.ONE)}static fromBytes(w){const E=A.fromAffine(g(Ye(w,void 0,"point")));return E.assertValidity(),E}static fromHex(w){return A.fromBytes(En(w))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(w=8,E=!0){return re.createCache(this,w),E||this.multiply(Ir),this}assertValidity(){S(this)}hasEvenY(){const{y:w}=this.toAffine();if(!r.isOdd)throw new Error("Field doesn't support isOdd");return!r.isOdd(w)}equals(w){U(w);const{X:E,Y:P,Z:V}=this,{X:ie,Y:L,Z:Y}=w,D=r.eql(r.mul(E,Y),r.mul(ie,V)),ee=r.eql(r.mul(P,Y),r.mul(L,V));return D&&ee}negate(){return new A(this.X,r.neg(this.Y),this.Z)}double(){const{a:w,b:E}=s,P=r.mul(E,Ir),{X:V,Y:ie,Z:L}=this;let Y=r.ZERO,D=r.ZERO,ee=r.ZERO,te=r.mul(V,V),_e=r.mul(ie,ie),fe=r.mul(L,L),K=r.mul(V,ie);return K=r.add(K,K),ee=r.mul(V,L),ee=r.add(ee,ee),Y=r.mul(w,ee),D=r.mul(P,fe),D=r.add(Y,D),Y=r.sub(_e,D),D=r.add(_e,D),D=r.mul(Y,D),Y=r.mul(K,Y),ee=r.mul(P,ee),fe=r.mul(w,fe),K=r.sub(te,fe),K=r.mul(w,K),K=r.add(K,ee),ee=r.add(te,te),te=r.add(ee,te),te=r.add(te,fe),te=r.mul(te,K),D=r.add(D,te),fe=r.mul(ie,L),fe=r.add(fe,fe),te=r.mul(fe,K),Y=r.sub(Y,te),ee=r.mul(fe,_e),ee=r.add(ee,ee),ee=r.add(ee,ee),new A(Y,D,ee)}add(w){U(w);const{X:E,Y:P,Z:V}=this,{X:ie,Y:L,Z:Y}=w;let D=r.ZERO,ee=r.ZERO,te=r.ZERO;const _e=s.a,fe=r.mul(s.b,Ir);let K=r.mul(E,ie),q=r.mul(P,L),H=r.mul(V,Y),Re=r.add(E,P),we=r.add(ie,L);Re=r.mul(Re,we),we=r.add(K,q),Re=r.sub(Re,we),we=r.add(E,V);let We=r.add(ie,Y);return we=r.mul(we,We),We=r.add(K,H),we=r.sub(we,We),We=r.add(P,V),D=r.add(L,Y),We=r.mul(We,D),D=r.add(q,H),We=r.sub(We,D),te=r.mul(_e,we),D=r.mul(fe,H),te=r.add(D,te),D=r.sub(q,te),te=r.add(q,te),ee=r.mul(D,te),q=r.add(K,K),q=r.add(q,K),H=r.mul(_e,H),we=r.mul(fe,we),q=r.add(q,H),H=r.sub(K,H),H=r.mul(_e,H),we=r.add(we,H),K=r.mul(q,we),ee=r.add(ee,K),K=r.mul(We,we),D=r.mul(Re,D),D=r.sub(D,K),K=r.mul(Re,q),te=r.mul(We,te),te=r.add(te,K),new A(D,ee,te)}subtract(w){return this.add(w.negate())}is0(){return this.equals(A.ZERO)}multiply(w){const{endo:E}=t;if(!i.isValidNot0(w))throw new Error("invalid scalar: out of range");let P,V;const ie=L=>re.cached(this,L,Y=>Eo(A,Y));if(E){const{k1neg:L,k1:Y,k2neg:D,k2:ee}=ce(w),{p:te,f:_e}=ie(Y),{p:fe,f:K}=ie(ee);V=_e.add(K),P=k(E.beta,te,fe,L,D)}else{const{p:L,f:Y}=ie(w);P=L,V=Y}return Eo(A,[P,V])[0]}multiplyUnsafe(w){const{endo:E}=t,P=this;if(!i.isValid(w))throw new Error("invalid scalar: out of range");if(w===rr||P.is0())return A.ZERO;if(w===qr)return P;if(re.hasCache(this))return this.multiply(w);if(E){const{k1neg:V,k1:ie,k2neg:L,k2:Y}=ce(w),{p1:D,p2:ee}=Ed(A,P,ie,Y);return k(E.beta,D,ee,V,L)}else return re.unsafe(P,w)}toAffine(w){return y(this,w)}isTorsionFree(){const{isTorsionFree:w}=t;return o===qr?!0:w?w(A,this):re.unsafe(this,a).is0()}clearCofactor(){const{clearCofactor:w}=t;return o===qr?this:w?w(A,this):this.multiplyUnsafe(o)}isSmallOrder(){return this.multiplyUnsafe(o).is0()}toBytes(w=!0){return wo(w,"isCompressed"),this.assertValidity(),v(A,this,w)}toHex(w=!0){return ln(this.toBytes(w))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}};$(A,"BASE",new A(s.Gx,s.Gy,r.ONE)),$(A,"ZERO",new A(r.ZERO,r.ONE,r.ZERO)),$(A,"Fp",r),$(A,"Fn",i);let R=A;const N=i.BITS,re=new yd(R,t.endo?Math.ceil(N/2):N);return R.BASE.precompute(8),R}function Nd(e){return Uint8Array.of(e?2:3)}function Bd(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const li={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},$d={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},Td=BigInt(0),rs=BigInt(2);function Id(e){const t=li.p,n=BigInt(3),r=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),l=BigInt(88),f=e*e*e%t,c=f*f*e%t,d=Xe(c,n,t)*c%t,_=Xe(d,n,t)*c%t,v=Xe(_,rs,t)*f%t,g=Xe(v,i,t)*v%t,m=Xe(g,s,t)*g%t,p=Xe(m,a,t)*m%t,x=Xe(p,l,t)*p%t,C=Xe(x,a,t)*m%t,M=Xe(C,n,t)*c%t,U=Xe(M,o,t)*g%t,ce=Xe(U,r,t)*f%t,y=Xe(ce,rs,t);if(!Xr.eql(Xr.sqr(y),e))throw new Error("Cannot find square root");return y}const Xr=ai(li.p,{sqrt:Id}),Vn=Od(li,{Fp:Xr,endo:$d}),Ro={};function Jr(e,...t){let n=Ro[e];if(n===void 0){const r=ts(od(e));n=Gr(r,r),Ro[e]=n}return ts(Gr(n,...t))}const As=e=>e.toBytes(!0).slice(1),Rs=e=>e%rs===Td;function is(e){const{Fn:t,BASE:n}=Vn,r=t.fromBytes(e),i=n.multiply(r);return{scalar:Rs(i.y)?r:t.neg(r),bytes:As(i)}}function _l(e){const t=Xr;if(!t.isValidNot0(e))throw new Error("invalid x: Fail if x ≥ p");const n=t.create(e*e),r=t.create(n*e+BigInt(7));let i=t.sqrt(r);Rs(i)||(i=t.neg(i));const s=Vn.fromAffine({x:e,y:i});return s.assertValidity(),s}const lr=xs;function wl(...e){return Vn.Fn.create(lr(Jr("BIP0340/challenge",...e)))}function Oo(e){return is(e).bytes}function Cd(e,t,n=el(32)){const{Fn:r}=Vn,i=Ye(e,void 0,"message"),{bytes:s,scalar:o}=is(t),a=Ye(n,32,"auxRand"),l=r.toBytes(o^lr(Jr("BIP0340/aux",a))),f=Jr("BIP0340/nonce",l,s,i),{bytes:c,scalar:d}=is(f),_=wl(c,s,i),v=new Uint8Array(64);if(v.set(c,0),v.set(r.toBytes(r.create(d+_*o)),32),!bl(v,i,s))throw new Error("sign: Invalid signature produced");return v}function bl(e,t,n){const{Fp:r,Fn:i,BASE:s}=Vn,o=Ye(e,64,"signature"),a=Ye(t,void 0,"message"),l=Ye(n,32,"publicKey");try{const f=_l(lr(l)),c=lr(o.subarray(0,32));if(!r.isValidNot0(c))return!1;const d=lr(o.subarray(32,64));if(!i.isValidNot0(d))return!1;const _=wl(i.toBytes(c),As(f),a),v=s.multiplyUnsafe(d).add(f.multiplyUnsafe(i.neg(_))),{x:g,y:m}=v.toAffine();return!(v.is0()||!Rs(m)||g!==c)}catch{return!1}}const Gn=(()=>{const n=(r=el(48))=>md(r,li.n);return{keygen:Sd(n,Oo),getPublicKey:Oo,sign:Cd,verify:bl,Point:Vn,utils:{randomSecretKey:n,taggedHash:Jr,lift_x:_l,pointToBytes:As},lengths:{secretKey:32,publicKey:32,publicKeyHasPrefix:!1,signature:64,seed:48}}})();new TextDecoder("utf-8");var Md=new TextEncoder;function Ld(e){if(e.length!==64)return!1;for(let t=0;t<64;t++){let n=e.charCodeAt(t);if(isNaN(n)||n<48||n>102||n>57&&n<97)return!1}return!0}var _n=Symbol("verified"),Pd=e=>e instanceof Object;function Dd(e){if(!Pd(e)||typeof e.kind!="number"||typeof e.content!="string"||typeof e.created_at!="number"||typeof e.pubkey!="string"||!Ld(e.pubkey)||!Array.isArray(e.tags))return!1;for(let t=0;t<e.tags.length;t++){let n=e.tags[t];if(!Array.isArray(n))return!1;for(let r=0;r<n.length;r++)if(typeof n[r]!="string")return!1}return!0}var qd=class{generateSecretKey(){return Gn.utils.randomSecretKey()}getPublicKey(e){return ln(Gn.getPublicKey(e))}finalizeEvent(e,t){const n=e;return n.pubkey=ln(Gn.getPublicKey(t)),n.id=Ti(n),n.sig=ln(Gn.sign(En(Ti(n)),t)),n[_n]=!0,n}verifyEvent(e){if(typeof e[_n]=="boolean")return e[_n];try{const t=Ti(e);if(t!==e.id)return e[_n]=!1,!1;const n=Gn.verify(En(e.sig),En(t),En(e.pubkey));return e[_n]=n,n}catch{return e[_n]=!1,!1}}};function zd(e){if(!Dd(e))throw new Error("can't serialize event with wrong or missing properties");return JSON.stringify([0,e.pubkey,e.created_at,e.kind,e.tags,e.content])}function Ti(e){let t=ts(Md.encode(zd(e)));return ln(t)}var fi=new qd;fi.generateSecretKey;fi.getPublicKey;fi.finalizeEvent;var Vd=fi.verifyEvent;const ml=/^[a-f0-9]{64}$(?![\s\S])/,yl=/^[a-z0-9][a-z0-9-]*$(?![\s\S])/;function yr(e){if(ml.test(e))return{type:"snapshot"};const t=/^(35129|15129):([a-f0-9]{64}):([\s\S]*)$/.exec(e);if(!t)return;const n=Number(t[1]),r=t[3];if(!(n===35129?!r:r!==""))return{type:"coordinate",kind:n,pubkey:t[2],identifier:r}}function $t(e){var t;return(t=/^napplet:([a-z0-9][a-z0-9-]*)\/[a-z0-9][a-z0-9-]*$(?![\s\S])/.exec(e))==null?void 0:t[1]}function El(e,t,n){if(!yl.test(t)||n!==""&&$t(n)!==t||(n?e[0]!=="i"||e[1]!==n:e[0]!=="a"&&e[0]!=="e"))return;const r=e[n?2:1];if(!r)return;const i=yr(r);if(!(!i||!n&&e[0]==="a"!=(i.type==="coordinate")))return{reference:r,tag:[...e],scope:n}}function Qt(e,t,n=""){const r=new Set;return e.flatMap(i=>{const s=El(i,t,n);return!s||r.has(s.reference)?[]:(r.add(s.reference),[s])})}function Ud(e,t,n){var m;let r=e.map(p=>[...p]);if(n.action==="clear")return r.filter(p=>!["a","e","i"].includes(p[0]));const i=n.scope??"";if(!yl.test(t)||i!==""&&$t(i)!==t)throw new Error("Invalid handler scope.");const s=p=>El(p,t,i);if(n.action==="reset")return r.filter(p=>!s(p));const o=n.reference,a=o&&yr(o);if(!o||!a)throw new Error("Invalid handler reference.");const l=p=>{var x;return((x=s(p))==null?void 0:x.reference)===o},f=Qt(r,t,i),c=f.findIndex(p=>p.reference===o);if(n.action==="remove")return r.filter(p=>!l(p));if(n.action==="add"){const p=n.tag??(i?["i",i,o]:[a.type==="coordinate"?"a":"e",o]);if(((m=s(p))==null?void 0:m.reference)!==o)throw new Error("Handler tag does not match its reference and scope.");return c>=0||r.push([...p]),r}const d=f[c+(n.action==="up"?-1:1)];if(c<0||!d)return r;let _=!1;r=r.filter(p=>l(p)?_?!1:(_=!0,!0):!0);const v=r.findIndex(l),g=r.findIndex(p=>{var x;return((x=s(p))==null?void 0:x.reference)===d.reference});return[r[v],r[g]]=[r[g],r[v]],r}function zr(e){var r;if(e.kind===5129&&ml.test(e.id))return e.id;const t=((r=e.tags.find(i=>i[0]==="d"))==null?void 0:r[1])??"",n=`${e.kind}:${e.pubkey}:${t}`;if(!yr(n))throw new Error("Invalid napplet manifest reference.");return n}function Vr(e){const t=new Set(e.tags.filter(n=>n[0]==="z").map(n=>n[1]));return[...new Set(e.tags.flatMap(n=>{if(n[0]!=="i"||!n[1])return[];const r=$t(n[1]);return r&&t.has(r)?[n[1]]:[]}))]}function Ii(e,t){return!t||e.created_at>t.created_at||e.created_at===t.created_at&&e.id<t.id}const mn=31129,xl=[5129,15129,35129],ir=/^[a-f0-9]{64}$(?![\s\S])/,Sl=/^[a-z0-9][a-z0-9-]*$(?![\s\S])/,wn=8e3;function Wn(e){try{const t=e,n={id:t.id,pubkey:t.pubkey,created_at:t.created_at,kind:t.kind,tags:t.tags.map(r=>[...r]),content:t.content,sig:t.sig};return Vd(n)?n:void 0}catch{return}}function Ci(e){const t=e.tags.filter(n=>n[0]==="d");return e.kind===mn&&t.length===1&&Sl.test(t[0][1]??"")?t[0][1]:void 0}function Yd(e){if(!xl.includes(e.kind)||!e.content.trim())return;const t=e.tags.filter(r=>r[0]==="x"),n=e.tags.filter(r=>r[0]==="d");if(!(t.length!==1||!ir.test(t[0][1]??""))&&!(e.kind===35129?n.length!==1||!n[0][1]:n.length!==0))try{return zr(e)}catch{return}}function Pt(e){return e.error||(e.incomplete?"Relay results are incomplete. Refresh before saving.":"")}function Hd(e){const t={pubkey:"",loading:!1,saving:!1,error:"",preferences:new Map,manifests:new Map,recommendations:[],canPublish:!1};let n=!1,r=!1,i=0,s=0,o=0,a,l;const f=y=>!n&&y===i,c=()=>{n||e({...t,preferences:new Map(t.preferences),manifests:new Map(t.manifests),recommendations:[...t.recommendations]})},d=y=>y instanceof Error?y.message:String(y);async function _(y){if(n)return;const S=i;s++,t.loading=!0,t.error="",c();try{await y(S)}catch(k){throw f(S)&&(t.error=d(k)),k}finally{f(S)&&(s--,t.loading=s>0,c())}}function v(y,S){const k=Wn(y);if(!k||k.pubkey!==S)return;const R=Ci(k);if(R)return Ii(k,t.preferences.get(R))&&t.preferences.set(R,k),k}function g(y,S){const k=Wn(y);if(!k)return;const R=Yd(k);if(!(!R||S!==void 0&&S!==R))return Ii(k,t.manifests.get(R))&&t.manifests.set(R,k),k}async function m(y,S){var B;const k=yr(y);if(!k)throw new Error("Enter an exact napplet coordinate or snapshot event ID.");const R=[...t.preferences.values(),...t.recommendations].flatMap(w=>w.tags).filter(w=>w[0]===(k.type==="snapshot"?"e":"a")&&w[1]===y),N=[...new Set(R.map(w=>w[2]).filter(Boolean))].slice(0,8),re=k.type==="snapshot"?(B=R.find(w=>ir.test(w[3]??"")))==null?void 0:B[3]:void 0;let A=!1;if(k.type==="snapshot"){const w=await Ct.getEvent(y,{timeoutMs:wn,...re?{author:re}:{},...N.length?{relays:N}:{}});if(!f(S))return;if(w.error)throw new Error(w.error);if(w.incomplete)throw new Error("Manifest lookup is incomplete. Retry through the shell.");w.result&&(A=!!g(w.result.event,y))}else{const w={kinds:[k.kind],authors:[k.pubkey],limit:8};k.kind===35129&&(w["#d"]=[k.identifier]);const E=await Ct.query([w],{authors:[k.pubkey],limit:8,timeoutMs:wn,...N.length?{relays:N}:{}});if(!f(S))return;if(Pt(E))throw new Error(Pt(E));for(const P of E.events)A=!!g(P.event,y)||A}if(!A)throw new Error("No signature-valid manifest matching that exact reference was found.")}async function p(){return _(async y=>{const S=t.pubkey,k=await Promise.allSettled([Ct.query([{kinds:xl,limit:80}],{limit:80,timeoutMs:wn}),S?Ct.query([{kinds:[mn],authors:[S],limit:128}],{authors:[S],limit:128,timeoutMs:wn}):Promise.resolve(void 0)]);if(!f(y))return;const R=[];k.forEach((A,B)=>{if(A.status==="rejected"){R.push(d(A.reason));return}if(A.value){for(const w of A.value.events)B===0?g(w.event):v(w.event,S);Pt(A.value)&&R.push(Pt(A.value))}}),c();const N=[...new Set([...t.preferences.entries()].flatMap(([A,B])=>B.tags.flatMap(w=>Qt([w],A,w[0]==="i"?w[1]:"").map(E=>E.reference))))].filter(A=>!t.manifests.has(A)).slice(0,32);let re=0;if(await Promise.all(Array.from({length:Math.min(4,N.length)},async()=>{for(;f(y)&&re<N.length;){const A=N[re++];try{await m(A,y)}catch{}}})),!!f(y)&&R.length)throw new Error([...new Set(R)].join(" "))})}async function x(y){if(n)return;i++,l==null||l.close(),l=void 0,s=0,t.pubkey=ir.test(y)?y:"",t.preferences.clear(),t.recommendations=[],t.saving=!1,t.loading=!1,t.error="",t.canPublish=Ji("outbox");const S=i;if(t.pubkey)try{const k=t.pubkey,R=Ct.subscribe([{kinds:[mn],authors:[k],limit:128}],{authors:[k],limit:128});l=R,R.on("event",N=>{f(S)&&v(N.event,k)&&c()}),R.on("closed",N=>{f(S)&&l===R&&(t.error=`Live preference updates stopped${N?`: ${N}`:"."} Refresh to check for changes.`,c())})}catch(k){t.error=d(k)}c(),await p()}async function C(){if(!(r||n)){r=!0;try{if(!Ji("identity")){await x("");return}let y=!1;a=Tr.onChanged(k=>{y=!0,x(k).catch(R=>{n||(t.error=d(R),c())})});const S=await Tr.getPublicKey();!y&&!n&&await x(S)}catch(y){throw n||(t.error=d(y),c()),y}}}async function M(y){const S=++o;return _(async k=>{if(y!==void 0&&!ir.test(y))throw new Error("Recommendation author must be a lowercase 64-character hex public key.");if(y===void 0&&!t.pubkey)throw new Error("Sign in to read follow recommendations, or enter an author.");const R=y?[y]:[...new Set(await Tr.getFollows())].filter(A=>ir.test(A)).slice(0,32);if(!f(k)||S!==o||(t.recommendations=[],!R.length))return;const N=await Ct.query([{kinds:[mn],authors:R,limit:128}],{authors:R,limit:128,timeoutMs:wn});if(!f(k)||S!==o)return;const re=new Map;for(const A of N.events){const B=Wn(A.event);if(!B||!R.includes(B.pubkey))continue;const w=Ci(B);if(!w)continue;const E=`${B.pubkey}:${w}`;Ii(B,re.get(E))&&re.set(E,B)}if(t.recommendations=[...re.values()],Pt(N))throw new Error(Pt(N))})}async function U(y,S,k){const R=i,N=t.pubkey,re=()=>{if(!f(R)||t.pubkey!==N)throw new Error("Account changed. Review the draft for the current account before saving.")};if(n)throw new Error("Preferences service has been destroyed.");if(t.saving)throw t.error="A save is already in progress.",c(),new Error(t.error);t.saving=!0,t.error="",c();try{if(!N||!t.canPublish)throw new Error("Sign in to a shell with OUTBOX publishing available.");if(!Sl.test(y))throw new Error("Invalid archetype.");const A=S.map(q=>[...q]),B=A.filter(q=>q[0]==="d");if(B.length!==1||B[0][1]!==y)throw new Error("The draft must have exactly one matching archetype d tag.");const w=await Ct.query([{kinds:[mn],authors:[N],"#d":[y],limit:16}],{authors:[N],limit:16,timeoutMs:wn});if(re(),Pt(w))throw new Error(`Cannot safely save: ${Pt(w)}`);for(const q of w.events){const H=Wn(q.event);H&&Ci(H)===y&&v(H,N)}let E=t.preferences.get(y);if(((E==null?void 0:E.id)??null)!==k)throw new Error("Preferences changed since editing began. Refresh and reapply your draft before saving.");const P=q=>Qt([q],y,q[0]==="i"?q[1]:"")[0],V=q=>JSON.stringify([q.scope,q.reference]),ie=new Set(((E==null?void 0:E.tags)??[]).flatMap(q=>{const H=P(q);return H?[V(H)]:[]})),L=new Map;for(const q of A){const H=JSON.stringify(q);L.set(H,(L.get(H)??0)+1)}for(const q of(E==null?void 0:E.tags)??[]){if(["d","a","e","i"].includes(q[0]))continue;const H=JSON.stringify(q),Re=L.get(H)??0;Re?L.set(H,Re-1):A.push([...q])}const Y=new Set(((E==null?void 0:E.tags)??[]).map(q=>JSON.stringify(q))),D=new Map;for(const q of A){if(!["a","e","i"].includes(q[0]))continue;const H=P(q);if(!H){if(!Y.has(JSON.stringify(q)))throw new Error("A newly added handler reference or intent scope is malformed.");continue}ie.has(V(H))||D.set(V(H),H)}for(const q of D.values()){await m(q.reference,R),re();const H=t.manifests.get(q.reference),Re=H?Vr(H):[];if(q.scope?!Re.includes(q.scope):!Re.some(we=>$t(we)===y))throw new Error(`The referenced manifest does not advertise ${q.scope||`an intent for ${y}`} with matching z/i tags.`)}const ee=await Tr.getPublicKey();if(re(),ee!==N)throw new Error("The active shell account changed. Refresh before saving.");if(E=t.preferences.get(y),((E==null?void 0:E.id)??null)!==k)throw new Error("Preferences changed during the save check. Review your draft and retry.");const te=Math.floor(Date.now()/1e3);if(E&&E.created_at>te+60)throw new Error("The current preference event is future-dated; cannot safely replace it yet.");const _e={kind:mn,tags:A,content:(E==null?void 0:E.content)??"",created_at:Math.max(te,((E==null?void 0:E.created_at)??0)+1)},fe=await Ct.publish(_e);if(re(),!fe.ok)throw new Error(fe.error||"The shell denied publishing or the publish failed. Your draft has not been discarded.");const K=Wn(fe.event);if(!K||K.pubkey!==N||K.kind!==_e.kind||K.content!==_e.content||K.created_at!==_e.created_at||JSON.stringify(K.tags)!==JSON.stringify(A))throw new Error("The shell did not return the expected signed preference event. Refresh to check publication.");v(K,N)}catch(A){throw f(R)&&(t.error=d(A)),A}finally{f(R)&&(t.saving=!1,c())}}function ce(){n=!0,i++,a==null||a.close(),l==null||l.close()}return{start:C,refresh:p,resolve:y=>_(S=>m(y,S)),loadRecommendations:M,save:U,destroy:ce}}var Cr=ye("<option> </option>"),Zd=ye('<button><!><span> </span><span class="nav-count"> </span></button>'),jd=ye('<p class="muted">No categories found.</p>'),Fd=ye('<div class="create-row"><input aria-label="New category" placeholder="Category name, e.g. notes"/><button><!>Add</button></div>'),Kd=ye('<p class="muted">Loading your settings…</p>'),Gd=ye("<p>Sign in through your host app to save your choices.</p>"),Wd=ye('<p role="status"> </p>'),Xd=ye('<div class="notice" role="alert">Your settings changed elsewhere. Your changes are kept here. Cancel to load the latest settings before editing again.</div>'),Jd=ye('<p class="privacy-note">You also have private choices. They stay unchanged and may be used first.</p>'),Qd=ye('<li><span class="rank"> </span><span class="initial" aria-hidden="true"> </span> <div class="handler-identity"><strong> </strong><span class="handler-meta"> </span></div> <div class="row-actions"><button title="Move up"><!></button><button title="Move down"><!></button><button title="Remove"><!></button></div></li>'),eh=ye('<li class="empty muted"> </li>'),th=ye('<div class="notice confirmation"><span> </span><button>Clear choices</button><button>Keep</button></div>'),nh=ye("<li><span> </span></li>"),rh=ye('<li class="muted">Your host app will ask which app to use.</li>'),ih=ye('<div class="inline"><span> </span><button>Add</button></div>'),sh=ye('<div class="recommendation"></div>'),oh=ye('<p class="muted">No recommendations to show yet.</p>'),ah=ye('<div class="editor-heading"><!><strong> </strong><span class="badge" title="Others can see these choices"><!>Public</span><span class="editor-state muted"> </span></div> <p class="hint">Choose which apps to use. Your public choices can help others find useful apps.</p> <!> <!> <div class="editor-grid"><section class="chain-panel" aria-label="Preferred apps"><label class="field">Use these apps for<select aria-label="Action"><option>All actions</option><!></select></label> <div class="section-label"><span> </span><button>Reset</button></div> <ol class="chain"></ol> <label class="field add-handler">Add an app<select aria-label="Add an app"><option> </option><!></select></label> <button class="quiet">Clear public choices…</button> <!></section> <section class="inspection" aria-label="App order"><div class="section-label">How your apps are chosen</div> <p class="hint">We try your first choice, then the next available app. Choices for a specific action come before your defaults. Your host app may ask you to install an app first.</p> <ol class="preview-order"></ol> <details><summary>Recommended apps</summary><p class="hint">See what people you follow use. Nothing changes until you add an app and save.</p><button>Find recommendations</button> <!></details></section></div>',1),lh=ye('<p class="empty muted">Choose a category to set your preferred apps.</p>'),fh=ye('<div class="workspace"><div class="toolbar"><label class="search-field"><!><input type="search" aria-label="Search categories" placeholder="Find a category…"/></label> <select aria-label="Selected category"><option>Choose a category</option><!><!></select> <button class="icon-button" aria-label="Refresh settings" title="Refresh"><!></button> <button class="add-archetype" aria-label="Add category" title="Add category"><!><span>Add</span></button></div> <div class="body"><aside class="navigation" aria-label="Categories"><div class="section-label">Categories <span class="muted"> </span></div> <!> <!></aside> <main><!> <div class="status" aria-live="polite"><!> <!> <!></div> <!></main></div> <div class="savebar"><span class="save-status"><!> </span><button>Cancel</button><button class="primary"> </button></div></div>');function uh(e,t){ls(t,!0);let n=xe({pubkey:"",loading:!0,saving:!1,error:"",preferences:new Map,manifests:new Map,recommendations:[],canPublish:!1});const r=Hd(b=>{X(n,b)});let i=xe(""),s=xe(""),o=xe(""),a=xe(""),l=xe(""),f=xe(!1),c=xe(""),d=xe(!1),_=xe({}),v=xe(yn([]));const g=de(()=>`${u(n).pubkey}:${u(i)}`),m=de(()=>u(n).preferences.get(u(i))),p=de(()=>u(_)[u(g)]),x=de(()=>{var b,O;return((b=u(p))==null?void 0:b.tags)??((O=u(m))==null?void 0:O.tags)??[["d",u(i)]]}),C=de(()=>!!u(p)&&JSON.stringify(u(p).tags)!==u(p).original),M=de(()=>{var b;return!!u(p)&&u(p).baseId!==(((b=u(m))==null?void 0:b.id)??null)}),U=de(()=>u(f)||u(n).saving||u(n).loading),ce=de(()=>[...new Map([...u(n).manifests.values()].map(b=>[b.id,b])).values()]),y=de(()=>[...new Set([...u(n).preferences.keys(),...u(v),...u(ce).flatMap(b=>[...b.tags.filter(O=>O[0]==="z").map(O=>O[1]??""),...Vr(b).map(O=>$t(O)??"")])])].filter(Boolean).sort()),S=de(()=>u(y).filter(b=>b.toLowerCase().includes(u(s).toLowerCase().trim()))),k=de(()=>[...new Set([...u(x).filter(b=>b[0]==="i"&&$t(b[1]??"")===u(i)).map(b=>b[1]),...u(ce).flatMap(Vr).filter(b=>$t(b)===u(i)),...u(a)?[u(a)]:[]])].sort()),R=de(()=>Qt(u(x),u(i),u(a))),N=de(()=>[...u(R),...u(a)?Qt(u(x),u(i)):[]].filter((b,O,ae)=>ae.findIndex(le=>le.reference===b.reference)===O)),re=de(()=>u(ce).filter(b=>Vr(b).some(O=>$t(O)===u(i)&&(!u(a)||O===u(a))))),A=de(()=>u(n).recommendations.filter(b=>b.tags.some(O=>O[0]==="d"&&O[1]===u(i))));function B(b){var O,ae;return b?((O=b.tags.find(le=>le[0]==="title"))==null?void 0:O[1])||((ae=b.tags.find(le=>le[0]==="name"))==null?void 0:ae[1])||"Unnamed app":"App unavailable"}const w=b=>b.replace(/^napplet:[^/]+\//,"").replace(/[-_]/g," ").replace(/\b\w/g,O=>O.toUpperCase());function E(b){return/denied|permission|grant|not.*allow|cannot modify/i.test(b)?"Your host app doesn’t allow these settings to be saved. Your changes are still here.":/changed|stale|refresh.*reapply/i.test(b)?"Your settings changed elsewhere. Cancel to load the latest settings, then try again.":/account|sign in/i.test(b)?"Sign in through your host app to save your choices.":/manifest|reference|convention|matching.*intent|snapshot/i.test(b)?"This app isn’t available for that action. Choose another app.":"We couldn’t finish that. Please refresh and try again. Your changes are still here."}function P(b){return u(n).manifests.get(b)??u(ce).find(O=>zr(O)===b)}function V(b){X(i,b,!0),X(a,""),X(c,""),X(l,"")}function ie(){const b=u(o).trim().toLowerCase().replace(/\s+/g,"-");if($t(`napplet:${b}/open`)!==b||!b){X(l,"Use a short category name with letters, numbers, or dashes.");return}X(v,[...new Set([...u(v),b])],!0),V(b),X(o,""),X(d,!1)}function L(b,O,ae){var le,Oe;if(!(u(U)||!u(i)))try{const Ie=u(p)??{tags:u(x).map(dn=>[...dn]),baseId:((le=u(m))==null?void 0:le.id)??null,content:((Oe=u(m))==null?void 0:Oe.content)??"",original:JSON.stringify(u(x))};X(_,{...u(_),[u(g)]:{...Ie,tags:Ud(Ie.tags,u(i),{action:b,scope:u(a),reference:O,tag:ae})}}),X(l,"")}catch(Ie){X(l,E(String(Ie)),!0)}}async function Y(b){if(u(f))return;const O=u(n).pubkey;X(f,!0),X(l,"");try{await b()}catch(ae){O===u(n).pubkey&&X(l,E(String(ae)),!0)}finally{X(f,!1)}}function D(){const b={...u(_)};delete b[u(g)],X(_,b),X(c,""),X(l,"")}async function ee(){const b=u(p),O=u(g),ae=u(i);!b||!u(C)||u(M)||await Y(async()=>{await r.save(ae,b.tags,b.baseId);const le={...u(_)};delete le[O],X(_,le),X(l,"Your choices have been saved.")})}hc(()=>(Y(()=>r.start()),()=>r.destroy()));var te=fh(),_e=W(te),fe=W(_e),K=W(fe);Hc(K,{size:16,"aria-hidden":"true"});var q=I(K),H=I(fe,2),Re=W(H);Re.value=Re.__value="";var we=I(Re);Rt(we,17,()=>u(S),qt,(b,O)=>{var ae=Cr(),le=pe(ae),Oe={};qe(Ie=>{ve(le,`${Ie??""}${u(_)[`${u(n).pubkey}:${u(O)}`]?" •":""}`),Oe!==(Oe=u(O))&&(ae.value=(ae.__value=Oe)??"")},[()=>w(u(O))]),ue(b,ae)});var We=I(we);{var kl=b=>{var O=Cr(),ae=pe(O,!0),le={};qe(Oe=>{ve(ae,Oe),le!==(le=u(i))&&(O.value=(O.__value=le)??"")},[()=>w(u(i))]),ue(b,O)},Al=de(()=>u(i)&&!u(S).includes(u(i)));nt(We,b=>{u(Al)&&b(kl)})}var Er;Xi(H);var xr=I(H,2),Rl=W(xr);Uc(Rl,{size:16,"aria-hidden":"true"});var Ns=I(xr,2),Ol=W(Ns);po(Ol,{size:16,"aria-hidden":"true"});var Bs=I(_e,2),$s=W(Bs),Ts=W($s),Nl=I(W(Ts)),Bl=pe(Nl,!0),Is=I(Ts,2);Rt(Is,17,()=>u(S),qt,(b,O)=>{var ae=Zd();let le;var Oe=W(ae);qc(Oe,{size:15,"aria-hidden":"true"});var Ie=I(Oe),dn=pe(Ie,!0),di=I(Ie),hi=pe(di,!0);qe((hn,Sr)=>{le=Ia(ae,1,"",null,le,{active:u(i)===u(O)}),ve(dn,hn),ve(hi,Sr)},[()=>w(u(O)),()=>{var hn;return u(_)[`${u(n).pubkey}:${u(O)}`]?"•":Qt(((hn=u(n).preferences.get(u(O)))==null?void 0:hn.tags)??[],u(O)).length}]),Ee("click",ae,()=>V(u(O))),ue(b,ae)});var $l=I(Is,2);{var Tl=b=>{var O=jd();ue(b,O)};nt($l,b=>{u(S).length||b(Tl)})}var Il=I($s,2),Cs=W(Il);{var Cl=b=>{var O=Fd(),ae=W(O),le=I(ae),Oe=W(le);po(Oe,{size:14,"aria-hidden":"true"}),qe(Ie=>le.disabled=Ie,[()=>u(U)||!u(o).trim()]),vo(ae,()=>u(o),Ie=>X(o,Ie)),Ee("click",le,ie),ue(b,O)};nt(Cs,b=>{(u(d)||!u(i))&&b(Cl)})}var Ms=I(Cs,2),Ls=W(Ms);{var Ml=b=>{var O=Kd();ue(b,O)};nt(Ls,b=>{u(n).loading&&b(Ml)})}var Ps=I(Ls,2);{var Ll=b=>{var O=Gd();ue(b,O)};nt(Ps,b=>{!u(n).pubkey&&!u(n).loading&&b(Ll)})}var Pl=I(Ps,2);{var Dl=b=>{var O=Wd(),ae=pe(O,!0);qe(le=>ve(ae,le),[()=>u(l)||E(u(n).error)]),ue(b,O)};nt(Pl,b=>{(u(l)||u(n).error)&&b(Dl)})}var ql=I(Ms,2);{var zl=b=>{var O=ah(),ae=da(O),le=W(ae);Mc(le,{size:16,"aria-hidden":"true"});var Oe=I(le),Ie=pe(Oe,!0),dn=I(Oe),di=W(dn);Pc(di,{size:11,"aria-hidden":"true"});var hi=I(dn),hn=pe(hi,!0),Sr=I(ae,4);{var jl=G=>{var Z=Xd();ue(G,Z)};nt(Sr,G=>{u(M)&&G(jl)})}var zs=I(Sr,2);{var Fl=G=>{var Z=Jd();ue(G,Z)};nt(zs,G=>{var Z,se;(((Z=u(p))==null?void 0:Z.content)??((se=u(m))==null?void 0:se.content))&&G(Fl)})}var Kl=I(zs,2),Vs=W(Kl),Us=W(Vs),kr=I(W(Us)),vi=W(kr);vi.value=vi.__value="";var Gl=I(vi);Rt(Gl,17,()=>u(k),qt,(G,Z)=>{var se=Cr(),He=pe(se,!0),be={};qe(Ce=>{ve(He,Ce),be!==(be=u(Z))&&(se.value=(se.__value=be)??"")},[()=>w(u(Z))]),ue(G,se)}),Xi(kr);var Ys=I(Us,2),Hs=W(Ys),Wl=pe(Hs,!0),Zs=I(Hs),js=I(Ys,2);Rt(js,23,()=>u(R),(G,Z)=>`${Z}:${G.reference}`,(G,Z,se)=>{const He=de(()=>P(u(Z).reference));var be=Qd(),Ce=W(be),vn=pe(Ce,!0),pn=I(Ce),Rr=pe(pn,!0),Or=I(pn,2),Gs=W(Or),sf=pe(Gs,!0),of=I(Gs),af=pe(of),lf=I(Or,2),Yn=W(lf),ff=W(Yn);$c(ff,{size:15,"aria-hidden":"true"});var Hn=I(Yn),uf=W(Hn);Nc(uf,{size:15,"aria-hidden":"true"});var Nr=I(Hn),cf=W(Nr);jc(cf,{size:15,"aria-hidden":"true"}),qe((Br,df,hf)=>{ve(vn,u(se)+1),ve(Rr,Br),ve(sf,df),ve(af,`${u(se)===0?"First choice":"Try next"} · ${hf??""}`),An(Yn,"aria-label",`Move app ${u(se)+1} up`),Yn.disabled=u(U)||u(se)===0,An(Hn,"aria-label",`Move app ${u(se)+1} down`),Hn.disabled=u(U)||u(se)===u(R).length-1,An(Nr,"aria-label",`Remove app ${u(se)+1}`),Nr.disabled=u(U)},[()=>B(u(He)).slice(0,1).toUpperCase(),()=>u(He)?B(u(He)):"App unavailable",()=>{var Br;return((Br=yr(u(Z).reference))==null?void 0:Br.type)==="snapshot"?"Keep this version":"Keep up to date"}]),Ee("click",Yn,()=>L("up",u(Z).reference)),Ee("click",Hn,()=>L("down",u(Z).reference)),Ee("click",Nr,()=>L("remove",u(Z).reference)),ue(G,be)},G=>{var Z=eh(),se=pe(Z,!0);qe(()=>ve(se,u(a)?"Uses your default apps. Add an app to choose differently for this action.":"No preferred apps yet. Choose one below.")),ue(G,Z)});var Fs=I(js,2),Un=I(W(Fs)),Ar=W(Un),Xl=pe(Ar,!0);Ar.value=Ar.__value="";var Jl=I(Ar);Rt(Jl,17,()=>u(re),qt,(G,Z)=>{var se=Cr(),He=pe(se),be={};qe((Ce,vn,pn)=>{se.disabled=Ce,ve(He,`${vn??""}${u(Z).kind===5129?" · Keep this version":""}`),be!==(be=pn)&&(se.value=(se.__value=be)??"")},[()=>u(R).some(Ce=>Ce.reference===zr(u(Z))),()=>B(u(Z)),()=>zr(u(Z))]),ue(G,se)}),Un.value=Un.__value="";var pi=I(Fs,2),Ql=I(pi,2);{var ef=G=>{var Z=th(),se=W(Z),He=pe(se),be=I(se),Ce=I(be);qe(()=>{ve(He,`${u(c)==="clear"?"Remove all public app choices for this category?":"Remove your choices for this action?"} Your private choices won’t change. Choose Save to apply.`),be.disabled=u(U)}),Ee("click",be,()=>{L(u(c)==="clear"?"clear":"reset"),X(c,"")}),Ee("click",Ce,()=>X(c,"")),ue(G,Z)};nt(Ql,G=>{(u(c)==="clear"||u(c)==="reset")&&G(ef)})}var tf=I(Vs,2),Ks=I(W(tf),4);Rt(Ks,21,()=>u(N),qt,(G,Z)=>{var se=nh(),He=W(se),be=pe(He,!0);qe(Ce=>ve(be,Ce),[()=>B(P(u(Z).reference))]),ue(G,se)},G=>{var Z=rh();ue(G,Z)});var nf=I(Ks,2),gi=I(W(nf),2),rf=I(gi,2);Rt(rf,17,()=>u(A),qt,(G,Z)=>{var se=sh();Rt(se,21,()=>Qt(u(Z).tags,u(i),u(a)),qt,(He,be)=>{var Ce=ih(),vn=W(Ce),pn=pe(vn,!0),Rr=I(vn);qe(Or=>{ve(pn,Or),Rr.disabled=u(U)},[()=>B(P(u(be).reference))]),Ee("click",Rr,()=>L("add",u(be).reference,u(be).tag)),ue(He,Ce)}),ue(G,se)},G=>{var Z=oh();ue(G,Z)}),qe((G,Z)=>{ve(Ie,G),ve(hn,u(C)?"Unsaved changes":"Saved choices"),ve(Wl,Z),Zs.disabled=u(U)||!u(R).length,Un.disabled=u(U),ve(Xl,u(R).length?"Choose another app…":"Choose an app…"),pi.disabled=u(U),gi.disabled=u(U)||!u(n).pubkey},[()=>w(u(i)),()=>u(a)?`${w(u(a))} apps`:"Default apps"]),Ee("change",kr,()=>{X(c,"")}),sc(kr,()=>u(a),G=>X(a,G)),Ee("click",Zs,()=>X(c,"reset")),Ee("change",Un,G=>{G.currentTarget.value&&L("add",G.currentTarget.value),G.currentTarget.value=""}),Ee("click",pi,()=>X(c,"clear")),Ee("click",gi,()=>Y(()=>r.loadRecommendations())),ue(b,O)},Vl=b=>{var O=lh();ue(b,O)};nt(ql,b=>{u(i)?b(zl):b(Vl,-1)})}var Ul=I(Bs,2),Ds=W(Ul),qs=W(Ds);{var Yl=b=>{Ic(b,{size:14,"aria-hidden":"true"})};nt(qs,b=>{!u(C)&&!u(M)&&b(Yl)})}var Hl=I(qs,1,!0),ui=I(Ds),ci=I(ui),Zl=pe(ci,!0);qe(()=>{Er!==(Er=u(i))&&(H.value=(H.__value=Er)??"",dr(H,Er)),xr.disabled=u(U),ve(Bl,u(y).length),ve(Hl,u(M)?"Newer event available":u(C)?"Unsaved changes":"All changes saved"),ui.disabled=u(U)||!u(p),ci.disabled=u(U)||!u(C)||u(M)||!u(n).pubkey||!u(n).canPublish,ve(Zl,u(n).saving?"Saving…":"Save")}),vo(q,()=>u(s),b=>X(s,b)),Ee("change",H,b=>V(b.currentTarget.value)),Ee("click",xr,()=>Y(()=>r.refresh())),Ee("click",Ns,()=>X(d,!u(d))),Ee("click",ui,D),Ee("click",ci,ee),ue(e,te),fs()}Ba(["change","click"]);function No(e){const t=document.documentElement.style;t.setProperty("--bg",e.colors.background),t.setProperty("--fg",e.colors.text),t.setProperty("--primary",e.colors.primary)}let Ur;if(Ji(Va))try{_c().then(No).catch(()=>{}),Ur=wc(No)}catch{}const Os=document.getElementById("app");if(!Os)throw new Error("Missing app root");Os.replaceChildren();const ch=Zu(uh,{target:Os});window.addEventListener("pagehide",()=>{Ur==null||Ur.close(),Fu(ch)},{once:!0});
</script>
    <style>:root{font:13px/1.5 Inter,ui-sans-serif,system-ui,sans-serif;font-synthesis:none;color-scheme:light dark;--bg: #171918;--fg: #e9eee8;--primary: #acd890;--border: color-mix(in srgb, var(--fg) 16%, transparent);--surface: color-mix(in srgb, var(--fg) 4%, var(--bg));--raised: color-mix(in srgb, var(--fg) 7%, var(--bg));--muted: color-mix(in srgb, var(--fg) 60%, var(--bg));--accent-soft: color-mix(in srgb, var(--primary) 10%, var(--bg));-webkit-user-select:none;user-select:none}*{box-sizing:border-box}html,body,#app{height:100%;margin:0;background:var(--bg);color:var(--fg);overflow:hidden}html,body{overscroll-behavior-y:none}#app{container-type:inline-size}button,input,select{font:inherit;color:inherit;min-width:0;min-height:32px;border:1px solid var(--border);border-radius:8px;background:transparent;padding:5px 10px}input,select{width:100%;background:var(--bg)}input::placeholder{color:var(--muted)}button{display:inline-flex;align-items:center;justify-content:center;gap:6px;cursor:pointer;flex-shrink:0;transition:background .15s,border-color .15s}button:hover:not(:disabled){background:var(--surface);border-color:var(--muted)}button:disabled{opacity:.38;cursor:default}svg{flex-shrink:0}:focus-visible{outline:2px solid var(--primary);outline-offset:2px}button.primary{background:var(--primary);color:var(--bg);border-color:transparent;font-weight:600;padding-inline:20px}button.primary:hover:not(:disabled){background:color-mix(in srgb,var(--primary) 85%,var(--fg))}p{margin:4px 0 8px;overflow-wrap:anywhere}strong{font-weight:600}.workspace{height:100%;display:grid;grid-template-rows:auto minmax(0,1fr) auto}.toolbar{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,.65fr) auto auto;gap:8px;padding:8px 12px;border-bottom:1px solid var(--border)}.search-field{display:flex;align-items:center;gap:4px;min-width:0;padding-left:10px;background:var(--surface);border:1px solid var(--border);border-radius:8px;color:var(--muted)}.search-field input{border:0;background:transparent;padding-left:4px;color:var(--fg)}.search-field:focus-within{outline:2px solid var(--primary);outline-offset:2px}.search-field input:focus-visible{outline:0}.icon-button{width:32px;padding:5px}.body{display:grid;grid-template-columns:minmax(0,1fr);min-height:0}main{overflow:auto;min-width:0;padding:12px;overscroll-behavior:contain}.navigation{display:none;overflow:auto;min-width:0;border-right:1px solid var(--border);padding:12px 8px;overscroll-behavior:contain}.navigation>.section-label{color:var(--muted);padding:0 8px;font-size:11px;font-weight:500;margin-bottom:8px}.navigation button{width:100%;justify-content:start;gap:8px;text-align:left;border-color:transparent;margin-bottom:4px;padding:8px}.navigation button>span:first-of-type{overflow:hidden;text-overflow:ellipsis}.navigation button>svg{color:var(--muted)}.navigation button.active{background:var(--accent-soft);border-color:color-mix(in srgb,var(--primary) 45%,transparent)}.navigation button.active>svg{color:var(--primary)}.nav-count{margin-left:auto;color:var(--muted);font-size:11px}.create-row,.inline{display:flex;align-items:center;gap:6px;min-width:0;margin:8px 0}.inline>input,.create-row>input{flex:1;width:0}.status:empty{display:none}.editor-heading{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin-bottom:12px;overflow-wrap:anywhere;min-height:28px}.editor-heading>svg{color:var(--muted)}.editor-heading>strong{font-size:14px;letter-spacing:-.015em}.editor-state{margin-left:auto;font-size:11px}.editor-grid{display:grid;gap:16px;min-width:0}.chain-panel,.inspection{min-width:0}.chain-panel{background:var(--surface);border:1px solid var(--border);border-radius:10px;padding:12px}.badge{display:inline-flex;align-items:center;gap:4px;font-size:10px;padding:1px 6px;color:var(--muted);border:1px solid var(--border);border-radius:5px}.muted,.hint,.permission-note,.reference,.privacy-note{color:var(--muted)}.hint,.permission-note,.privacy-note{font-size:12px;line-height:1.6}.privacy-note{margin:-4px 0 12px}.permission-note{margin:16px 0 0;font-size:11px}.field{display:grid;gap:6px;margin-bottom:8px;font-size:12px;font-weight:500}.field select{font-size:13px;font-weight:400}.section-label{display:flex;justify-content:space-between;gap:8px;align-items:center;font-weight:600;min-height:28px;margin:4px 0}.section-label button{font-size:11px;min-height:28px;padding:3px 8px}.chain{list-style:none;margin:0 0 12px;padding:0}.chain li{display:flex;align-items:center;gap:8px;padding:10px 0;border-top:1px solid var(--border);min-width:0;flex-wrap:wrap}.rank{color:var(--muted);font-size:11px;width:12px}.initial{display:grid;place-items:center;width:36px;height:36px;border:1px solid var(--border);border-radius:8px;background:var(--accent-soft);color:var(--primary);font-size:17px;font-weight:500}.handler-identity{display:grid;flex:1;min-width:80px;gap:2px}.handler-identity strong{overflow-wrap:anywhere;font-size:13px}.reference{font:11px/1.5 ui-monospace,monospace;overflow-wrap:anywhere;min-width:0}.handler-identity .reference{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.handler-meta{color:var(--muted);font-size:11px;overflow-wrap:anywhere}.row-actions{display:flex;gap:4px;margin-left:auto}.row-actions button{width:28px;min-height:28px;padding:4px;border-radius:6px}.empty{padding:12px 0}.quiet{color:var(--muted);border-color:transparent;font-size:11px;padding:4px 0}.notice{border:1px solid var(--border);background:var(--surface);border-radius:8px;padding:10px;margin:8px 0;overflow-wrap:anywhere}.confirmation{display:flex;flex-wrap:wrap;gap:6px;font-size:12px}.confirmation span{flex-basis:100%}details{border-top:1px solid var(--border);padding:10px 0;min-width:0}summary{display:flex;align-items:center;gap:6px;cursor:pointer;min-height:28px;font-weight:500;overflow-wrap:anywhere;list-style:none}summary::-webkit-details-marker{display:none}summary:before{content:"";width:6px;height:6px;border-right:1.5px solid var(--muted);border-bottom:1.5px solid var(--muted);transform:rotate(-45deg);margin-right:4px;flex-shrink:0}details[open]>summary:before{transform:rotate(45deg)}.add-override{border:0;padding:0 0 8px;color:var(--muted);font-size:12px}.reference-entry{border:0;padding:0 0 4px;color:var(--muted);font-size:12px}.add-handler{padding-top:4px}pre{font:11px/1.5 ui-monospace,monospace;background:var(--surface);border-radius:6px;padding:8px;white-space:pre-wrap;overflow-wrap:anywhere;margin:8px 0}.inspection>.section-label{font-size:12px}.preview-order{padding-left:20px;margin:12px 0 16px}.preview-order li{padding:5px 0;overflow-wrap:anywhere;font-size:12px}.preview-order li::marker{color:var(--muted)}.preview-kind{display:inline-block;color:var(--muted);font-size:10px;margin-left:8px}.recommendation{border-top:1px solid var(--border);padding-top:8px}.recommendation .inline>span{flex:1}.savebar{border-top:1px solid var(--border);padding:8px 12px;display:flex;align-items:center;gap:8px;background:var(--bg)}.save-status{display:flex;align-items:center;gap:6px;flex:1;min-width:0;color:var(--muted);font-size:11px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}[data-napplet-select=text],input,textarea{-webkit-user-select:text;user-select:text}[data-napplet-select=all]{-webkit-user-select:all;user-select:all}@media(min-width:480px){.body{grid-template-columns:minmax(140px,22%) minmax(0,1fr)}.navigation{display:block}main{padding:12px 16px}.toolbar{grid-template-columns:minmax(0,1fr) auto auto}.toolbar>select{display:none}}@media(min-width:900px){.editor-grid{grid-template-columns:minmax(0,1.5fr) minmax(0,1fr);gap:20px;align-items:start}.inspection{padding:4px 0}.body{grid-template-columns:minmax(176px,18%) minmax(0,1fr)}}@media(max-width:479px){.toolbar{grid-template-columns:minmax(0,1fr) auto auto;padding:8px}.search-field{grid-column:1 / -1}main{padding:8px}.editor-state{display:none}.chain-panel{padding:8px}.add-archetype span{display:none}}@media(max-width:239px){.toolbar{padding:4px;gap:4px}.search-field{display:none}main{padding:4px}.initial{display:none}.chain li{gap:4px}.savebar{padding:4px;gap:4px}.save-status{display:none}.savebar button{flex:1}.create-row{flex-wrap:wrap}.create-row input{flex-basis:100%}.inline{flex-wrap:wrap}.inline input{flex-basis:100%}}@media(max-height:240px){.toolbar,.savebar{padding-top:4px;padding-bottom:4px}.search-field{display:none}.editor-heading{margin-bottom:4px}}
</style>
  </head>
  <body>
    <div id="app"></div>
  </body>
</html>