@deslop/deploy 0.1.1512 → 0.1.1521

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,27 +0,0 @@
1
- import{$ as e,$a as t,$i as n,$n as r,$o as i,$r as a,$t as o,A as s,Aa as c,Ai as l,An as u,Ao as d,Ar as f,At as p,B as m,Ba as h,Bi as g,Bn as _,Bo as v,Br as y,Bt as b,C as x,Ca as ee,Ci as te,Cn as S,Co as C,Cr as w,Ct as ne,D as re,Da as T,Di as ie,Dn as ae,Do as oe,Dr as E,Dt as D,E as se,Ea as ce,Ei as le,En as ue,Eo as de,Er as fe,Et as pe,F as me,Fa as O,Fi as he,Fn as ge,Fo as _e,Fr as ve,Ft as ye,G as be,Ga as k,Gi as xe,Gn as Se,Go as Ce,Gr as A,Gt as we,H as Te,Ha as Ee,Hi as De,Hn as Oe,Ho as ke,Hr as Ae,Ht as je,I as j,Ia as Me,Ii as Ne,In as Pe,Io as Fe,Ir as Ie,It as Le,J as Re,Ja as ze,Ji as Be,Jn as Ve,Jo as M,Jr as He,Jt as Ue,K as We,Ka as Ge,Ki as Ke,Kn as qe,Ko as N,Kr as P,Kt as Je,L as Ye,La as Xe,Li as Ze,Ln as Qe,Lo as $e,Lr as et,Lt as tt,M as nt,Ma as rt,Mi as it,Mn as F,Mo as I,Mr as at,Mt as ot,N as st,Na as ct,Ni as lt,Nn as ut,No as L,Nr as dt,Nt as ft,O as pt,Oa as R,Oi as mt,On as ht,Oo as gt,Or as _t,Ot as vt,P as yt,Pa as bt,Pi as xt,Pn as St,Po as Ct,Pr as wt,Pt as Tt,Q as Et,Qa as Dt,Qi as Ot,Qn as kt,Qo as At,Qr as jt,Qt as Mt,R as Nt,Ra as Pt,Ri as Ft,Rn as It,Ro as z,Rr as Lt,Rt,S as zt,Sa as Bt,Si as Vt,Sn as Ht,So as Ut,Sr as Wt,St as Gt,T as Kt,Ta as qt,Ti as Jt,Tn as Yt,To as B,Tr as Xt,Tt as Zt,U as Qt,Ua as $t,Ui as en,Un as tn,Uo as nn,Ur as rn,Ut as an,V as on,Va as sn,Vi as cn,Vn as ln,Vo as un,Vr as dn,Vt as fn,W as pn,Wa as mn,Wi as hn,Wn as gn,Wo as _n,Wr as vn,Wt as yn,X as bn,Xa as xn,Xi as Sn,Xn as Cn,Xo as V,Xr as wn,Xt as Tn,Y as En,Ya as Dn,Yi as On,Yn as kn,Yo as An,Yr as jn,Yt as Mn,Z as Nn,Za as Pn,Zi as Fn,Zn as In,Zo as Ln,Zr as Rn,Zt as zn,_ as Bn,_a as Vn,_i as Hn,_n as Un,_o as Wn,_r as Gn,_t as Kn,a as qn,aa as Jn,ai as Yn,an as Xn,ao as Zn,ar as Qn,as as $n,at as er,b as tr,ba as nr,bi as rr,bn as ir,bo as ar,br as or,bt as sr,c as cr,ca as lr,ci as ur,cn as dr,co as fr,cr as pr,cs as mr,ct as hr,d as gr,da as _r,di as vr,dn as yr,do as br,dr as xr,ds as H,dt as Sr,ea as Cr,ei as wr,en as U,eo as Tr,er as Er,es as Dr,et as Or,f as kr,fa as Ar,fi as jr,fn as Mr,fo as Nr,fr as Pr,fs as Fr,ft as Ir,g as Lr,ga as Rr,gi as zr,gn as Br,go as Vr,gr as Hr,gs as Ur,gt as Wr,h as Gr,ha as Kr,hi as qr,hn as Jr,ho as Yr,hr as Xr,hs as W,ht as Zr,i as Qr,ia as $r,ii as ei,in as ti,io as ni,ir as G,it as ri,j as ii,ja as ai,ji as oi,jn as si,jo as ci,jr as li,jt as ui,k as di,ka as fi,ki as K,kn as pi,ko as mi,kr as hi,kt as gi,l as _i,la as vi,li as yi,ln as bi,lo as xi,lr as Si,ls as Ci,lt as wi,m as Ti,ma as Ei,mi as Di,mn as Oi,mo as ki,mr as Ai,ms as ji,mt as Mi,n as Ni,na as Pi,ni as Fi,nn as q,no as Ii,nr as Li,ns as Ri,nt as zi,o as Bi,oa as Vi,oi as Hi,on as Ui,oo as Wi,or as Gi,os as Ki,ot as qi,p as Ji,pa as Yi,pi as Xi,pn as Zi,po as Qi,pr as $i,ps as ea,pt as ta,q as na,qa as ra,qi as ia,qn as aa,qo as J,qr as oa,qt as sa,r as ca,ra as la,ri as ua,rn as Y,ro as da,rr as fa,rs as pa,rt as ma,s as ha,sa as ga,si as _a,sn as va,so as ya,sr as ba,ss as xa,st as Sa,t as Ca,ta as wa,ti as Ta,tn as Ea,to as Da,tr as Oa,ts as ka,tt as Aa,u as ja,ua as Ma,ui as Na,un as Pa,uo as Fa,ur as Ia,us as La,ut as Ra,v as za,va as Ba,vi as Va,vn as Ha,vo as Ua,vr as Wa,vt as Ga,w as Ka,wa as qa,wi as Ja,wn as Ya,wo as Xa,wr as Za,wt as Qa,x as $a,xa as eo,xi as to,xn as no,xo as ro,xr as io,xt as ao,y as oo,ya as so,yi as co,yn as lo,yo as uo,yr as fo,yt as po,z as mo,za as ho,zi as go,zn as _o,zo as vo,zr as yo,zt as bo}from"./effect-D7LphKtZ.js";var xo=new WeakMap,So=e=>e.pollUnsafe()===void 0,Co=e=>(xo.get(e)??[]).filter(So),wo=(e,t)=>{if(t.length!==0)for(let n=e;n!==void 0;n=n.parent)xo.set(n,[...Co(n),...t])},To={scheduler:void 0,schedule:e=>{Promise.resolve().then(e)}},Eo=ro(`@effect/ui/internal/Executor`,{defaultValue:()=>To}),Do=e=>e(),Oo=(e,t)=>e.follow===void 0?Do:e.follow(t),ko=(e,t,n,r)=>jo(e,Lt(Ao(t))(r?n:G(Ta,n))),Ao=e=>{let t=B(e,Eo).scheduler;return t===void 0?e:C(e,Bt,t)},jo=(e,t)=>{let n=e.owned??=new Set;return n.add(t),t.addObserver(()=>n.delete(t)),t},Mo=e=>{for(;e.ctx===void 0;)e=e.parent;return e.ctx},No=Object.freeze({}),Po=(e,t,n,r)=>{let{onEmit:i}=t;return{_tag:`Child`,component:e,key:t.key??``,props:t.props??No,onEmit:typeof i==`object`?e=>i[e._tag](e):i??Bo,fallback:t.fallback,onFailure:t.onFailure,view:t.view,slots:t.slots,alive:n,owner:r}},Fo=`~@effect/ui/Component/Composed`,Io=e=>typeof e==`object`&&!!e&&`~@effect/ui/Component/Composed`in e,Lo=[`view`,`slots`,`fallback`],Ro=(e,t,n)=>{for(let e of Lo)if(n[e]!==void 0)throw Error(`p.child(${t.definition.name}) takes no \`${e}\``);return{[Fo]:Fo,child:Po(t,n,void 0,e),parts:n.parts}},zo=(e,t,n)=>Io(e)?{...e.child,view:r=>{let i;try{i=e.parts(r)}catch(t){if(n===void 0)throw t;return n(e.child.owner,t)}return zo(i,t,n)}}:t(e),Bo=()=>void 0,Vo=`~@effect/ui/Feature`,Ho=e=>$n(e,Vo),Uo=new Set([`class`,`rel`,`aria-controls`,`aria-describedby`,`aria-flowto`,`aria-labelledby`,`aria-owns`]),Wo=[],Go=Object.freeze([]),X=Object.freeze({}),Ko=e=>({_tag:`Text`,text:e}),qo=e=>{let t=[];for(let n=0;n<e.length;n++){let r=e[n];if(Array.isArray(r))for(let e=0;e<r.length;e++)Jo(t,r[e]);else Jo(t,r)}return t},Jo=(e,t)=>{if(t===!1||t==null)return;if(typeof t==`string`){if(t===``)return;let n=e.length===0?void 0:e[e.length-1];n!==void 0&&n._tag===`Text`?e[e.length-1]=Ko(n.text+t):e.push(Ko(t));return}let n=Yo(t);if(n._tag===`Text`){if(n.text===``)return;let t=e.length===0?void 0:e[e.length-1];if(t!==void 0&&t._tag===`Text`){e[e.length-1]=Ko(t.text+n.text);return}}e.push(n)},Yo=e=>e instanceof Ds?Xo(e,Go):e,Xo=(e,t)=>{let n=e.content,r=n===void 0?t:t.length===0?n:qo([...n,...t]),i=e.hooks;return i===void 0?Zo(e,r):ns(e,i,r)},Zo=(e,t)=>({_tag:`Element`,tag:e.tag,elementKey:e.elementKey,attrs:e.owned.length===0?e.elementAttrs:cs(e.elementAttrs,e.owned),props:e.props,handlers:e.handlers,eventOptions:e.eventOptions,refKey:e.refKey,mount:e.mount,owned:e.owned,children:t}),Qo=Symbol(`partForwardLayer`),$o=(e,t)=>Object.assign(t=>e(t),{[Qo]:t}),es=e=>{let t=e[Qo];return t===void 0?e:e.owned[t]},ts=(e,t)=>{let n=e[Qo];if(n===void 0)return us(e,t);let r=e.owned.slice();return r[n]={...r[n],...t},us(e,{owned:r})},ns=(e,t,n)=>{let r=ds(e);r.hooks=t.length===1?void 0:t.slice(0,-1),r.content=n,r.elementKey=void 0;let i=t[t.length-1];r[Qo]=i[Qo];let a=Yo(i(r));if(a._tag!==`Element`)throw Error(`forward: the <${e.tag}> was built into a ${a._tag}, and its hook has to return an element`);return e.elementKey===void 0?a:{...a,elementKey:e.elementKey}},rs=(e,t)=>{let n=ds(e),r=e[Qo],i=r===void 0?t:$o(t,r);return n.hooks=e.hooks===void 0?[i]:[...e.hooks,i],n},is=(e,t)=>{let n=ds(e),r=e.content;return n.content=r===void 0?t.length===0?Go:ss(t):t.length===0?r:qo([...r,...t]),n},as=(e,t,n)=>{let r=is(e,t),i,a,o=r.content??Go;for(let t=0;t<o.length;t++){let r=o[t];if(r._tag===`Text`)throw Error(os(e.tag,n));r._tag===`Outlet`&&(a??=[...o],a[t]={_tag:`Outlet`,name:r.name,noText:i??=os(e.tag,n)})}return a!==void 0&&(r.content=a),r},os=(e,t)=>`<${e}> can't hold text in the ${t.name} vocabulary; text goes inside ${(t.textParents??[]).join(`, `)}`,ss=e=>{let t=!1;for(let n=0;n<e.length;n++){let r=e[n];if(typeof r==`string`){if(r===``||t)return qo(e);e[n]=Ko(r),t=!0}else if(r===!1||r==null||Array.isArray(r))return qo(e);else{let i=Yo(r);if(i._tag===`Text`){if(i.text===``||t)return qo(e);t=!0}else t=!1;e[n]=i}}return e},cs=(e,t)=>{let n;for(let r=0;r<t.length;r++){let i=t[r].tokens;if(i!==X)for(let t in i)n??={...e},n[t]=ls(n[t],i[t])}return n??e},ls=(e,t)=>{let n=e===void 0?[]:e.split(/\s+/).filter(e=>e!==``);for(let e of t.split(/\s+/))e!==``&&!n.includes(e)&&n.push(e);return n.join(` `)},us=(e,t)=>Object.assign(ds(e),t),ds=e=>{let t=0;for(let n in e)t++;if(t===fs.length){let t=Object.getPrototypeOf(e),n=t===ms?hs:ps.get(t);if(n===void 0&&ps.set(t,n=gs(t,e)),ms=t,hs=n,n!==null)return new n(e)}return Object.assign(Object.create(Object.getPrototypeOf(e)),e)},fs=[`elementKey`,`elementAttrs`,`props`,`handlers`,`eventOptions`,`refKey`,`mount`,`owned`,`content`,`hooks`,`removals`,`tag`],ps=new WeakMap,ms,hs=null,gs=(e,t)=>{for(let e of fs)if(!Object.hasOwn(t,e))return null;let n=function(e){this.elementKey=e.elementKey,this.elementAttrs=e.elementAttrs,this.props=e.props,this.handlers=e.handlers,this.eventOptions=e.eventOptions,this.refKey=e.refKey,this.mount=e.mount,this.owned=e.owned,this.content=e.content,this.hooks=e.hooks,this[Qo]=e[Qo],this.removals=e.removals,this.tag=e.tag};return n.prototype=e,n},_s=(e,t,n)=>(r,...i)=>{let a=r;if(!(a instanceof Ds))throw Error(e.path+`: a part takes an element builder, such as h.button`);if(t!==void 0&&!t.includes(a.tag))throw Error(e.path+`: a part for <`+t.join(`> or <`)+`> was given <`+a.tag+`>`);let o=n(Object.assign(Object.create(Object.getPrototypeOf(a)),Ss,{tag:a.tag,removals:[]}),...i);if(!(o instanceof Ds))throw Error(e.path+`: a part returns the builder it was given`);if(o.elementKey!==void 0)throw Error(e.path+`: a part can't set an element's key`);if(o.owned.length>0)throw Error(e.path+`: a part can't apply another part`);let s={...a.elementAttrs},c;for(let e of o.removals??[])Uo.has(e)||delete s[e];for(let e in o.elementAttrs)Uo.has(e)?(c??={})[e]=o.elementAttrs[e]:s[e]=o.elementAttrs[e];let l={owner:e,handlers:o.handlers,eventOptions:o.eventOptions,refKey:o.refKey,mount:o.mount,tokens:c??X},u=us(a,{elementAttrs:s,props:o.props===X?a.props:a.props===X?o.props:{...a.props,...o.props},owned:[...a.owned,l]});if(o.content!==void 0&&(u.content=a.content===void 0?o.content:qo([...a.content,...o.content])),o.hooks!==void 0){let e=o.hooks.map(e=>$o(e,a.owned.length));u.hooks=a.hooks===void 0?e:[...a.hooks,...e]}return u},vs=(e,t,n)=>{if(!Object.hasOwn(e,t))return n===void 0?e:ys(e,t,n);let r={};for(let n in e)n!==t&&xs(r,n,e[n]);return n!==void 0&&xs(r,t,n),r},ys=(e,t,n)=>{if(e===X)return bs(t,n);let r={...e};return xs(r,t,n),r},bs=(e,t)=>{switch(e){case`class`:return{class:t};case`id`:return{id:t};case`click`:return{click:t};case`input`:return{input:t}}let n={};return xs(n,e,t),n},xs=(e,t,n)=>{t===`__proto__`?Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[t]=n},Ss={elementKey:void 0,elementAttrs:X,props:X,handlers:X,eventOptions:X,refKey:void 0,mount:void 0,owned:Wo,content:void 0,hooks:void 0,[Qo]:void 0,removals:void 0},Cs=``,ws=``,Ts=(e,t,n)=>(e!==Cs&&(Cs=e,ws=Es(e)),ws+`-`+Es(t)+(n===void 0?``:`-`+Es(String(n)))),Es=e=>e.replace(/[^A-Za-z0-9]/g,e=>`_`+e.codePointAt(0).toString(36)+`_`),Ds=class e{elementKey=void 0;elementAttrs=X;props=X;handlers=X;eventOptions=X;refKey=void 0;mount=void 0;owned=Wo;content=void 0;hooks=void 0;[Qo]=void 0;removals=void 0;tag;constructor(e){this.tag=e}on(e,t,n){let r=es(this),i=r.eventOptions;return i===X?n!==void 0&&(i=ys(i,e,n)):(n!==void 0||Object.hasOwn(i,e))&&(i=vs(i,e,n)),ts(this,{handlers:ys(r.handlers,e,t),eventOptions:i})}key(e){let t=ds(this);return t.elementKey=e,t}attr(e,t){let n=this.elementAttrs,r=this.removals;if(t===void 0&&r===void 0&&(n===X||!Object.hasOwn(n,e))&&typeof this!=`function`)return this;let i=ds(this);return t===void 0&&r!==void 0&&(i.removals=[...r,e]),n===X?t!==void 0&&(i.elementAttrs=ys(n,e,t)):(t!==void 0||Object.hasOwn(n,e))&&(i.elementAttrs=vs(n,e,t)),i}attrs(t){if(this.attr!==e.prototype.attr){let e;for(let n in t)Object.hasOwn(t,n)&&(e=(e??this).attr(n,t[n]));return e??ds(this)}let n=ds(this),r=this.elementAttrs,i,a;for(let e in t){if(!Object.hasOwn(t,e))continue;let n=t[e];n===void 0?(this.removals!==void 0&&(i??=this.removals.slice(),i.push(e)),r!==X&&Object.hasOwn(a??r,e)&&(a??={...r},delete a[e])):(a??=r===X?{}:{...r},Object.hasOwn(a,e)&&delete a[e],xs(a,e,n))}return i!==void 0&&(n.removals=i),a!==void 0&&(n.elementAttrs=a),n}prop(e,t){let n=ds(this);return n.props=ys(this.props,e,t),n}ref(e){return ts(this,{refKey:e.key})}onMount(e){let t=es(this).mount;if(t!==void 0)throw Error(`onMount(${e.name}): this element already has the mount ${t.name}, and an element takes one`);return ts(this,{mount:e})}forward(e){return rs(this,e)}},Os=class extends Ds{onMount(e){return super.onMount(e)}children(...e){return is(this,e)}forward(e){return rs(this,e)}},ks=e=>{let t=(...e)=>t.children(...e);return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),Object.assign(t,e)},As=class{entries=new Map;round=1;used=0;begin(){this.round++,this.used=0}end(){let e=this.entries,t=this.round;if(this.used!==e.size){if(this.used*4<=e.size){let n=new Map;for(let[r,i]of e)i.round===t&&n.set(r,i);this.entries=n}else for(let[n,r]of e)r.round!==t&&e.delete(n)}}},js=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0},Ms=()=>!1,Ns=class{props;elements;runningFn;at;store;constructor(e,t,n,r,i){this.props=e,this.elements=t,this.runningFn=n??Ms,this.at=r,this.store=i}lazy(e,...t){let n=this.store;if(n===void 0)return Yo(e(this,...t));let r=n.lazy??=new As,i=t.length===0?e:t[0],a=r.entries.get(i),o=r.round;if(a!==void 0&&a.fn===e&&js(a.args,t))return a.round!==o&&(a.round=o,r.used++),a.node;let s=Yo(e(this,...t));return a!==void 0&&a.round===o||(a===void 0?r.entries.set(i,{fn:e,args:t,node:s,round:o}):(a.fn=e,a.args=t,a.node=s,a.round=o),r.used++),s}keepAlive(e,t){let n=Object.create(this);return n[`~alive`]=!t||e,(t??e)(n)}isRunning(e,t){return this.runningFn(Hu(e),Uu(e,t))}id(e,t){let n=this.at;return Ts(typeof n==`string`?n:n.path,e,t)}el(e,...t){let n=this.elements?.textParents,r=n===void 0||n.includes(e)?new Os(e):new Ps(e,this.elements);return t.length===0?r:r.children(...t)}text(e){return Ko(e)}},Ps=class extends Os{vocabulary;constructor(e,t){super(e),this.vocabulary=t}children(...e){return as(this,e,this.vocabulary)}},Fs=new WeakMap,Is,Ls,Rs=new WeakSet,zs=e=>(Rs.add(e),e),Bs=e=>Rs.has(e),Vs=(e,t,n,r,i)=>{if(t===void 0)return new Ns(e,void 0,n,r??``,i);let a=t===Is?Ls:Fs.get(t);if(a===void 0){let e=class extends Ns{};Object.assign(e.prototype,t.tags),Fs.set(t,a=e)}return Is=t,Ls=a,new a(e,t,n,r??``,i)},Hs=[],Us=e=>{if(e.slots===void 0)return Hs;let t=[];for(let n in e.slots)t.push(...qo([e.slots[n]]));return t},Ws=(e,t)=>{if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||e===null||t===null)return pa(e,t);let n=0;for(let r in e){if(!Object.hasOwn(e,r))continue;if(!Object.hasOwn(t,r))return!1;let i=e[r],a=t[r];if(i!==a&&(qs(i,a)||!pa(i,a)))return!1;n++}for(let e in t)Object.hasOwn(t,e)&&n--;return n===0},Gs=e=>e===null||typeof e!=`object`&&typeof e!=`function`,Ks=e=>{if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},qs=(e,t)=>{if(typeof e!=`object`||typeof t!=`object`||e===null||t===null||Object.getPrototypeOf(e)!==Object.prototype||Object.getPrototypeOf(t)!==Object.prototype||`~effect/Equal`in e||`~effect/Equal`in t)return!1;for(let n in e){if(!Object.hasOwn(t,n))continue;let r=e[n],i=t[n];if(r!==i&&Gs(r)&&Gs(i)&&(r===r||i===i))return!0}return!1},Js=(e,t)=>Ks(e)&&Ks(t)?Ws(e,t):pa(e,t),Ys=`~@effect/ui/Component/Lazy`,Xs=e=>$n(e,Ys),Zs=e=>e.state,Qs=e=>{if(!Xs(e))return e;let t=Zs(e);return t._tag===`Loaded`?t.component:void 0},$s=new WeakMap,ec=e=>{$s.get(e)?.(),$s.delete(e)},tc=e=>{let t=e.definition;return t===void 0?(`~@effect/ui/Feature`in e?e[Vo]:e[Ys]).name:t.name},nc=e=>rc(e.component,e.key),rc=(e,t)=>oc(tc(e))+`[`+sc(t)+`]`,ic=e=>typeof e==`string`?e:e.path,ac=e=>`[`+sc(e)+`]`,oc=e=>e.includes(`%`)||e.includes(`[`)?e.replace(/[%[]/g,cc):e,sc=e=>e.includes(`%`)||e.includes(`]/`)?e.replace(/%|(?<=\])\//g,cc):e,cc=e=>`%`+e.charCodeAt(0).toString(16).toUpperCase(),lc=(e,t)=>{let n=new Map;for(let e of t){let t=tc(e.component),r=n.get(t);r===void 0&&n.set(t,r=new Map),r.set(e.key,e)}return{at:e,paths:n,placed:void 0}},uc=(e,t)=>{throw Error(`${ic(e)} renders two children ${t}`)},dc=(e,t,n,r,i)=>{if(t._tag===`Element`){let a=t.children,o=i?.children;for(let t=0;t<a.length;t++){let i=a[t],s=o?.[t];i!==s&&(i._tag===`Child`||i._tag===`Outlet`||i._tag===`Element`&&i.children.length>0)&&dc(e,i,n,r,fc(i,s)?s:void 0)}}else if(t._tag===`Child`){let i=tc(t.component),a=e.paths??=new Map,o=a.get(i);o===void 0&&a.set(i,o=new Map);let s=o.get(t.key);if(s!==void 0&&s!==n&&uc(e.at,`at ${nc(t)}${r}${pc(i,t)}`),o.set(t.key,t),t.slots!==void 0)for(let n in t.slots)hc(e,t.slots[n])}else t._tag===`Outlet`&&mc(e,t.name)},fc=(e,t)=>t!==void 0&&t._tag===`Element`&&e._tag===`Element`&&t.tag===e.tag&&t.elementKey===e.elementKey,pc=(e,t)=>t.key===``?`. A child without a key must be the only ${e} where it is rendered: give each ${e} its own \`key\``:`. Give each ${e} its own \`key\``,mc=(e,t)=>{let n=e.placed??=new Set;if(n.has(t))throw Error(`${ic(e.at)} places its slot ${t} twice`);n.add(t)},hc=(e,t)=>{if(typeof t!=`object`||!t)return;if(Array.isArray(t)){for(let n of t)hc(e,n);return}let n=t;if(n._tag===`Outlet`)mc(e,n.name);else if(n._tag===`Element`)for(let t of n.children)hc(e,t);else if(n._tag===`Child`&&n.slots!==void 0)for(let t in n.slots)hc(e,n.slots[t])},gc=(e,t,n)=>{dc(e,n,t,`, in the fallback of ${nc(t)}`)},_c=class{constructor(e,t,n,r){this.v=e,this.node=t,this.kids=n,this.inst=r}},vc=class{model=void 0;rendered=void 0;dirty=!1;closed=!1;failure=void 0;live=0;lazy=void 0;placed=void 0;closers=void 0;writing=0;named=void 0;constructor(e,t,n,r,i,a){this.tree=e,this.component=t,this.parent=n,this.at=r,this.under=Z,this.depth=n===void 0?0:n.depth+1,this.props=i,this.env=a}get path(){if(this.named!==void 0)return this.named;let e=this.at;if(e===void 0)return this.named=`/`+this.component.definition.name;let t=e.v;return this.named=(t.alive===void 0&&this.under||this.parent.path)+`/`+rc(t.component,t.key)}fire(e,t,n,r=`event`){if(this.closed)return!1;let i=e;if(typeof e==`function`)try{i=e(t)}catch(e){return Q(this,r,K(e)),!1}return i!==void 0&&(Nc(this,i,n),!0)}},Z,yc=0,bc,xc=[],Sc,Cc={_tag:`Render`},wc={_tag:`Rendered`},Tc={_tag:`Text`,text:``},Ec=(e,t,n)=>{let r=t.fallback;if(r===void 0)return Tc;try{return qo([r(n===void 0?Et(!0):bn(n))])[0]??Tc}catch(t){return e.tree.schedule(()=>Q(e,`fallback`,K(t))),Tc}},Dc=(e,t,n,r)=>{if(t.alive===void 0)return Oc(e,()=>r(Ec(e,t,n)));let i=Z;Z=void 0;try{return Oc(e,()=>r(Ec(e,t,n)))}finally{Z=i}},Oc=(e,t)=>{let n=Sc;Sc=e;try{return t()}finally{Sc=n}},kc=(e,t)=>{let n=e.tree;try{return n.fallback?.(t)??Tc}catch(t){let r=K(t);return n.log?.(e,{_tag:`Failed`,props:e.props,in:`fallback`,cause:r}),n.report(e.path,`fallback`,r),Tc}},Ac=(e,t)=>{let n=e.parent,r=Z,i=xc.length;Z=e.under;try{return n===void 0?hl(e,kc(e,t)):hl(n,Ec(n,e.at.v,t))}catch(t){return Mc(i),e.tree.report(e.path,`fallback`,K(t)),hl(e,Tc)}finally{Z=r}},Q=(e,t,n,r,i,a,o)=>{if(e.closed)return;let s=e.tree,c=s.log;c!==void 0&&c(e,{_tag:`Failed`,props:e.props,in:t,name:a,cause:n,update:r,issued:o}),e.failure=n;let l=e.rendered,u=e.path;Xc(e),i!==void 0&&Mc(i);let d=e.at;if(l!==void 0){let t=s.host,r=$c(l),i=t.parentOf(r),a=Ac(e,n);i!=null&&(tl(t,i,a,r),il(t,i,l)),d===void 0?e.rendered=a:(e.rendered=void 0,d.kids=[a])}let f=d===void 0?void 0:d.v.onFailure;if(f!==void 0){let t=jc(e);s.schedule(()=>t.fire(f,bn(n),e,`onFailure`))}s.report(u,t,n)},jc=e=>e.at.v.owner??e.parent,Mc=e=>{for(let t=e;t<xc.length;t+=2)Qc(xc[t],xc[t+1]);xc.length=e},Nc=(e,t,n)=>{let r=e.tree.transitions;if(r?.waits(e))return r.wait(()=>Nc(e,t,n));if(zc(e),e.closed)return;let i;try{i=e.component.update(e.model,t,e.props,e.results,e.look)}catch(r){return Q(e,`update`,K(r),{message:t,source:n})}if(i===void 0)return;let a=e.tree.log?.(e,{_tag:`Update`,source:n,message:t,props:e.props,model:i.model,commands:i.commands,events:i.events,lists:i.lists,sends:i.sends,viewTransition:i.viewTransition});i.model!==e.model&&(e.model=i.model,Lc(e)),i.viewTransition!==void 0&&r?.request(i.viewTransition),Pc(e,i,a),Fc(e,i,a)},Pc=(e,t,n)=>{let r=t.commands;for(let t=0;t<r.length;t++){if(e.closed)return;r[t][`~run`](e,n,t)}},Fc=(e,t,n)=>{if(e.closed)return;e.component[`~sync`]?.(e,t,n);let r=t.events;if(r.length===0||e.at===void 0)return;let i=jc(e);for(let t=0;t<r.length;t++){if(e.closed)return;let n=e.at.v.onEmit;if(n===void 0)return;let a;try{a=n(r[t])}catch(e){Q(i,`onEmit`,K(e));return}a!==void 0&&Nc(i,a,e)}},Ic=e=>{e.scheduled||(e.scheduled=!0,e.schedule(()=>Hc(e)))},Lc=e=>{e.dirty||(e.dirty=!0,e.tree.dirty.push(e),Ic(e.tree))},Rc=(e,t)=>e.depth-t.depth,zc=e=>{let t=e.tree.dirty;if(yc>0||t.length===0)return;let n=[],r=-1,i=e.under!==void 0;for(let t=e.parent;t!==void 0;t=t.parent)t.dirty&&(r=n.length),n.push(t),t.under!==void 0&&(i=!0);if(i){let i=e.path;n.length=0;for(let e=0;e<t.length;e++){let r=t[e];r.dirty&&i.startsWith(r.path+`/`)&&n.push(r)}n.sort(Bc),r=n.length-1}if(r<0)return;let a=bc;bc=e;try{for(let e=r;e>=0;e--){let t=n[e];if(t.closed)return;t.dirty&&Vc(t)}}finally{bc=a}},Bc=(e,t)=>t.path.length-e.path.length,Vc=e=>{let t=e.tree.log;e.tree.drew=!0,t!==void 0&&t(e,Cc),Jc(e),t!==void 0&&t(e,wc)},Hc=e=>{for(e.scheduled=!0,e.flushing=!0;;){if(e.closed)return;if(e.transitions?.hold()){e.flushing=!1;return}let t=e.dirty;if(!e.work?.(t.length===0)){if(t.length===0)break;e.dirty=[],t.length>1&&t.sort(Rc);for(let e=0;e<t.length;e++){let n=t[e];n.dirty&&!n.closed&&Vc(n)}}}e.scheduled=e.flushing=!1,e.host.commit?.();let t=e.committed;if(t!==void 0){e.committed=void 0;for(let e=0;e<t.length;e++)t[e]()}},Uc=Function.prototype.call,Wc=(e,t,n)=>{let r=t.view??t[`~content`];return Uc.call(r,t,e.model,e.props,e.runs?.running,e.results,Bs(r)?e:e.path,e.look,n)},Gc=e=>{try{return Wc(e,e.component,e)}catch(t){Q(e,`view`,K(t));return}},Kc=e=>e.at!==void 0&&e.at.v.view!==void 0?e.parent:e,qc=e=>{let t,n=e.component,r=Z,i=xc.length,a=Kc(e);Z=a===e?void 0:e.path,yc++;try{try{e.tree.drew=!0,t=e.tree.init(e)}catch(t){Q(e,`init`,K(t));return}e.model=t.model;let r=e.tree.log?.(e,{_tag:`Mounted`,props:e.props,model:t.model,commands:t.commands,events:t.events,adopted:!1});if(n.boot?.(e),Pc(e,t,r),n[`~first`]?.(e),e.closed)return;e.dirty=!1;let o=Gc(e);if(o===void 0)return;let s;a.writing++;try{s=hl(a,o)}catch(t){Q(e,`view`,K(t),void 0,i);return}finally{a.writing--}if(e.closed){Qc(e,s);return}return e.rendered=s,e.kept?.done(),Fc(e,t,r),s}finally{yc--,xc.length=i,Z=r}},Jc=e=>{e.dirty=!1;let t=Z,n=xc.length,r=Kc(e);Z=r===e?void 0:e.path,yc++,r.writing++;try{e.component[`~render`]?.(e);let t=Gc(e);if(t===void 0)return;e.rendered=vl(r,e.rendered,t),e.kept?.done()}catch(t){Q(e,`view`,K(t),void 0,n)}finally{yc--,r.writing--,xc.length=n,Z=t}},Yc=e=>{e.rendered=vl(Kc(e),e.rendered,Tc)},Xc=e=>{if(e.closed)return;e.closed=!0,e.tree.drew=!0,e.lazy=void 0,e.parent!==void 0&&e.parent.live--;let t=Kc(e);e.rendered!==void 0&&t.live>0&&Qc(t,e.rendered);let n=e.tree.log;n!==void 0&&n(e,{_tag:`Unmounted`});let r=e.closers;if(r!==void 0)for(let e=r.length-1;e>=0;e--)r[e]()},Zc=void 0,Qc=(e,t)=>{if(e.live===0)return;let n=t.v,r=t.kids;if(n._tag===`Child`){if(al(n)?.release(e,t))return;if(r===void 0)return Xc(t.inst);t.inst===e&&(e.live--,t.inst=Zc)}else if(n._tag===`Element`)n.mount!==void 0&&(e.live--,n.mount[`~detach`](t));else if(n._tag===`Outlet`){if(t.inst!==e)return;t.inst=Zc,e.live--,e.placed.get(n.name)?.rec===t&&e.placed.delete(n.name),e=e.parent}if(r!==void 0)for(let t=r.length-1;t>=0;t--)Qc(e,r[t])},$c=e=>{for(;e.node===void 0;)e=e.kids===void 0?e.inst.rendered:e.kids[0];return e.node},el=e=>{for(;e.node===void 0;)e=e.kids===void 0?e.inst.rendered:e.kids[e.kids.length-1];return e.node},tl=(e,t,n,r)=>{if(n.node!==void 0)e.insert(t,n.node,r);else if(n.kids===void 0)tl(e,t,n.inst.rendered,r);else for(let i=0;i<n.kids.length;i++)tl(e,t,n.kids[i],r)},nl=(e,t,n)=>{let r=rl(n,[]);Qc(e,n);for(let n of r)e.tree.host.remove(t,n)},rl=(e,t)=>{if(e.node!==void 0)t.push(e.node);else if(e.kids===void 0)rl(e.inst.rendered,t);else for(let n=0;n<e.kids.length;n++)rl(e.kids[n],t);return t},il=(e,t,n)=>{for(let r of rl(n,[]))e.remove(t,r)},al=e=>e.alive===void 0?void 0:e.component[`~kept`],ol=(e,t,n)=>{let r=t.v,i=r.component;if(!n){let n=al(r);if(n!==void 0)return n.mount(e,t,Z)}let a=e.env;if(e===Sc)for(;a.ctx===void 0&&a.parent!==void 0;)a=a.parent;let o=Z,s,c=i[`~load`]!==void 0;if(c&&(i=i[`~load`](e,t,o)??i),c&&i===r.component)s=Dc(e,r,i[`~cause`](),t=>hl(e,t));else if(`~@effect/ui/Feature`in i){let n=a.ctx;if(n===void 0)s=Oc(e,()=>hl(e,Ec(e,r,a.cause))),a.cause===void 0&&a.waiting.push(()=>sl(e,t,o));else{let t=oe(n,i);if(t===void 0)throw Error(e.path+`: nothing provides `+i.key);i=t.component,a={ctx:ci(n,t.context),cause:void 0,waiting:[]}}}else e.tree.host.hold?.(e,t,o,i)&&(s=hl(e,Tc));let l=t.inst=s===void 0?new vc(e.tree,i,e,t,r.props,a):e;e.live++,xc.push(e,t),s===void 0?qc(l)===void 0?t.kids=[Ac(l,l.failure)]:e.closed&&Xc(l):t.kids=[s]},sl=(e,t,n)=>{if(t.inst!==e||e.closed)return;let r=e.tree.host,i=t.kids[0],a=Z;Z=n;try{if(e.env.ctx===void 0&&`~@effect/ui/Feature`in t.v.component){t.kids[0]=Oc(e,()=>vl(e,i,Ec(e,t.v,e.env.cause)));return}let n=$c(i),a=r.parentOf(n);t.kids=void 0,e.live--;try{ol(e,t)}catch(n){throw t.kids=[i],e.live++,n}tl(r,a,t,n),il(r,a,i),Qc(e,i)}catch(t){Q(e,`view`,K(t))}finally{Z=a}},cl=[Tc],ll=(e,t)=>{if(t===void 0)return cl;let n=qo([t]);if(n.length===0)return cl;let r=e.noText;return r!==void 0&&(n=n.map(e=>{if(e._tag===`Text`)throw Error(Z+`: `+r);return e._tag===`Outlet`&&e.noText!==r?{_tag:`Outlet`,name:e.name,noText:r}:e})),n},ul=(e,t)=>e.tree.schedule(()=>Q(e,`view`,K(t))),dl=(e,t)=>e.at===void 0?void 0:e.at.v.slots?.[t],fl=(e,t)=>{let n=t.rec,r=n.v,i=dl(e,r.name);if(i===t.content)return;t.content=i;let a=e.parent,o=e.tree.host,s=n.kids,c=o.nextOf(el(s[s.length-1])),l=Z;Z=e.path+`/`+ac(r.name);try{let e=cl;try{e=ll(r,i)}catch(e){ul(a,e)}n.kids=kl(a,o.parentOf($c(s[0])),s,e,c)}finally{Z=l}},pl=(e,t,n)=>{e.normalizeAttrs!==void 0&&(n=e.normalizeAttrs(t,n));for(let r in n)e.setAttr(t,r,n[r])},ml=(e,t,n)=>{for(let r in n)e.setProp(t,r,n[r])},hl=(e,t)=>{let n=e.tree.host;switch(t._tag){case`Text`:return new _c(t,n.createText(t.text),void 0,e);case`Element`:{t.owned?.length&&(t=Dl(e,t,t.owned));let r=n.createElement(t.tag);t.attrs!==X&&pl(n,r,t.attrs);let i=t.children,a;if(i.length>0){a=Array(i.length);for(let t=0;t<i.length;t++)tl(n,r,a[t]=hl(e,i[t]),null)}t.props!==X&&ml(n,r,t.props),n.made?.(r,e);let o=new _c(t,r,a,e);return(t.handlers!==X||t.eventOptions!==X)&&n.setEvents(r,o,!0),t.mount!==void 0&&(e.live++,t.mount[`~attach`](o)),o}case`Child`:{let n=new _c(t,void 0,void 0,e);return ol(e,n),n}case`Outlet`:return gl(e,t)}},gl=(e,t)=>{let n=e.parent,r=dl(e,t.name),i=new _c(t,void 0,void 0,e);e.live++,(e.placed??=new Map).set(t.name,{rec:i,content:r});let a=Z,o=xc.length;Z=e.path+`/`+ac(t.name);try{let e=ll(t,r),a=i.kids=Array(e.length);for(let t=0;t<e.length;t++)a[t]=hl(n,e[t])}catch(e){Mc(o),i.kids=[hl(n,Tc)],ul(n,e)}finally{Z=a}return i},_l=(e,t)=>{if(e===t)return!0;switch(e._tag){case`Element`:return t._tag===`Element`&&e.tag===t.tag&&e.elementKey===t.elementKey;case`Text`:return t._tag===`Text`;case`Child`:return t._tag===`Child`&&e.component===t.component&&e.key===t.key;case`Outlet`:return t._tag===`Outlet`&&e.name===t.name}},vl=(e,t,n)=>{let r=t.v;if(r===n)return e.tree.host.controlled!==void 0&&n._tag===`Element`&&Sl(e.tree.host,t),t;if(!_l(r,n))return bl(e,t,n);switch(n._tag){case`Text`:return r.text!==n.text&&e.tree.host.setText(t.node,n.text),t.v=n,t;case`Element`:return El(e,t,r,n),t;case`Child`:return(al(n)??al(r))?.patch(e,t,n,Z)??yl(e,t,n);case`Outlet`:{let i=e.placed.get(n.name);return i?.rec===t&&(r.noText!==n.noText&&(i.content=xl),t.v=n,fl(e,i)),t}}},yl=(e,t,n)=>{let r=t.inst,i=t.kids;if(i===void 0&&e.tree.holds?.(r,e,n)===!0)return t;if(t.v=n,i!==void 0)return i[0]=r===e?n.component[`~load`]===void 0?Oc(e,()=>vl(e,i[0],Ec(e,n,e.env.cause))):Dc(e,n,n.component[`~cause`]()??e.env.cause,t=>vl(e,i[0],t)):vl(e,i[0],Ec(e,n,r.failure)),t;if(r.closed)return t;let a=!Ws(r.props,n.props);if(a){r.props=n.props;let i=e.tree.log;if(i!==void 0&&i(r,{_tag:`PropsChanged`,props:n.props}),r.component[`~sync`]?.(r),r.closed)return t}(a||n.view!==void 0)&&(r===bc?Lc(r):Jc(r));let o=r.placed;if(o!==void 0&&!r.closed)for(let e of o.values())fl(r,e);return t},bl=(e,t,n)=>{let r=e.tree.host,i=$c(t),a=r.parentOf(i),o=hl(e,n);return tl(r,a,o,i),nl(e,a,t),o},xl={},Sl=(e,t)=>{let n=t.kids;if(n!==void 0)for(let t=0;t<n.length;t++){let r=n[t];r.v._tag===`Element`&&Sl(e,r)}let r=t.v.props;r!==X&&Tl(e,t.node,r,r)},Cl=(e,t)=>{let n=0;for(let r in e){if(e[r]!==t[r])return!1;n++}for(let e in t)n--;return n===0},wl=(e,t,n,r)=>{if(!Cl(n,r)){e.normalizeAttrs!==void 0&&(n=e.normalizeAttrs(t,n),r=e.normalizeAttrs(t,r));for(let i in n)typeof r[i]!=`string`&&e.setAttr(t,i,void 0,n[i]);for(let i in r){let a=r[i],o=n[i];o!==a&&e.setAttr(t,i,a,o)}}},Tl=(e,t,n,r)=>{let i=e.controlled;for(let i in n)i in r||e.setProp(t,i,void 0);for(let a in r)(n[a]!==r[a]||i?.has(a)===!0)&&e.setProp(t,a,r[a])},El=(e,t,n,r)=>{let i=e.tree.host,a=t.node,o=r.owned?.length?r.owned:n.owned;o?.length&&(r=Dl(e,r,o)),t.v=r,n.attrs!==r.attrs&&wl(i,a,n.attrs,r.attrs),(r.handlers!==n.handlers||r.eventOptions!==n.eventOptions)&&i.setEvents(a,t,n.handlers===X&&n.eventOptions===X);let s=r.children,c=t.kids;if(c===void 0){if(s.length>0){let n=Array(s.length);for(let t=0;t<s.length;t++)tl(i,a,n[t]=hl(e,s[t]),null);t.kids=n}}else if(s.length===0){for(let t=0;t<c.length;t++)Qc(e,c[t]);if(i.clear!==void 0)i.clear(a);else for(let e=0;e<c.length;e++)il(i,a,c[e]);t.kids=void 0}else if(s.length===1&&c.length===1){let t=c[0],n=s[0];n._tag===`Text`&&t.v._tag===`Text`?(t.v.text!==n.text&&i.setText(t.node,n.text),t.v=n):n._tag===`Element`&&t.v!==n&&_l(t.v,n)?El(e,t,t.v,n):c[0]=vl(e,t,n)}else t.kids=kl(e,a,c,s,null,!0);(n.props!==r.props||i.controlled!==void 0&&r.props!==X)&&Tl(i,a,n.props,r.props);let l=r.mount,u=n.mount;l!==u&&(l===void 0?(e.live--,u[`~detach`](t)):(u===void 0&&e.live++,l[`~attach`](t)))},Dl=(e,t,n)=>n[0].owner.component[`~owned`](e,t),Ol=e=>e._tag===`Element`?e.elementKey:e._tag===`Child`?e.key===``?e.component:e.key:void 0,kl=(e,t,n,r,i,a)=>{let o=e.tree.host,s=0,c=n.length-1,l=r.length-1,u=c===l?n:Array(r.length);for(;s<=c&&s<=l&&_l(n[s].v,r[s]);)u[s]=vl(e,n[s],r[s]),s++;if(u===n){if(s>l)return u;u=Array(r.length);for(let e=0;e<s;e++)u[e]=n[e]}for(;s<=c&&s<=l&&(n.length===r.length||Ol(r[l])!==void 0)&&_l(n[c].v,r[l]);)c--,l--;let d=l-s+1,f=d>0&&s<=c?new Int32Array(d):void 0,p,m;for(let e=f===void 0?-1:l;e>=s;e--){let t=Ol(r[e]);if(t===void 0)continue;let n=(p??=new Map).get(t);n!==void 0&&((m??=new Int32Array(d))[e-s]=n+1),p.set(t,e)}let h=!1,g=0,_;for(let e=s;e<=c;e++){let t=n[e],i=Ol(t.v),a=i===void 0?e<=l?e:void 0:p?.get(i);for(;a!==void 0&&(f[a-s]!==0||!_l(t.v,r[a]));){let e=i===void 0||m===void 0?0:m[a-s];a=e===0?void 0:e-1}a===void 0?(_??=[]).push(t):(f[a-s]=e+1,a<g?h=!0:g=a)}for(let t=s;t<=l;t++){let i=f===void 0?0:f[t-s];u[t]=i===0?hl(e,r[t]):vl(e,n[i-1],r[t])}if(_!==void 0){if(a&&_.length===n.length&&o.clear!==void 0){for(let t=0;t<n.length;t++)Qc(e,n[t]);o.clear(t)}else for(let n of _)nl(e,t,n)}for(let t=l+1;t<r.length;t++)u[t]=vl(e,n[t+n.length-r.length],r[t]);if(!h){for(let e=s,n=s;e<=l+1;e++)if(e>l||f!==void 0&&f[e-s]!==0){let a=e<r.length?$c(u[e]):i;for(;n<e;)tl(o,t,u[n++],a);n=e+1}return u}let v=Al(f),y=v.length-1,b=l+1<r.length?$c(u[l+1]):i;for(let e=d-1;e>=0;e--){let n=s+e;f[e]!==0&&y>=0&&v[y]===e?y--:tl(o,t,u[n],b),b=$c(u[n])}return u},Al=e=>{let t=new Int32Array(e.length),n=[];for(let r=0;r<e.length;r++){let i=e[r];if(i===0)continue;let a=0,o=n.length;for(;a<o;){let t=a+o>>1;e[n[t]]<i?a=t+1:o=t}t[r]=a>0?n[a-1]:-1,n[a]=r}for(let e=n.length-1,r=n[e];e>=0;e--)n[e]=r,r=t[r];return n},jl=e=>e.component.init(e.props),Ml=(e,t,n,r,i)=>{let a={...i,host:r,init:i.init??jl,schedule:i.schedule??(e=>queueMicrotask(e)),dirty:[],scheduled:!0,flushing:!0,closed:!1};a.transitions=r.transitions?.(a);let o=new vc(a,e,void 0,void 0,t,{ctx:i.context??Xa(),cause:void 0,waiting:[]});return qc(o)===void 0&&(o.rendered=Ac(o,o.failure)),tl(r,n,o.rendered,null),Hc(a),{instance:o,send:(e,t)=>Nc(o,e,t),close:()=>{a.closed||(a.closed=!0,Xc(o),il(r,n,o.rendered),r.commit?.())}}},Nl=new WeakMap,Pl=new WeakSet,Fl=(e,t)=>{let n=Nl.get(e);if(n===void 0){let t=n=[];Nl.set(e,t);let r=e.work;e.work=e=>t.length===0?r?.(e)===!0:(t.shift()(),!0)}let r=Oo(e);n.push(()=>r(t)),Ic(e)},Il=`~@effect/ui/Component/Noop`,Ll=Object.freeze({[Il]:Il}),Rl=e=>$n(e,Il)&&e[Il]===Il,zl,Bl=e=>e[`~queries`],Vl=`~@effect/ui/Query/Cache`,Hl=`~@effect/ui/Query/CacheCell`,Ul=Ut(`@effect/ui/Query/Cache`),Wl=(e,t)=>(e.add(t),()=>{e.delete(t)}),Gl=(e=!0)=>{let t=e,n=new Set;return{get:()=>t,subscribe:e=>Wl(n,e),set:e=>{if(e!==t){t=e;for(let t of Array.from(n))t(e)}}}},Kl={get:()=>!0,subscribe:()=>()=>{}},ql=ro(`@effect/ui/Query/Visibility`,{defaultValue:()=>Kl}),Jl=ro(`@effect/ui/Query/Connectivity`,{defaultValue:()=>Kl}),Yl=ro(`@effect/ui/Query/Problems`,{defaultValue:()=>e=>console.warn(e.message)}),Xl=(e,t)=>{try{B(e,Yl)(t)}catch{}},Zl=e=>{switch(typeof e){case`number`:return`a non-finite number`;case`undefined`:return`undefined`;case`object`:return`a class instance`;default:return`a `+typeof e}},Ql=class{kind;constructor(e){this.kind=Zl(e)}},$l=e=>{if(e===null||typeof e==`boolean`)return String(e);if(typeof e==`string`)return JSON.stringify(e);if(typeof e==`number`){if(!Number.isFinite(e))throw new Ql(e);return Object.is(e,-0)?`-0`:String(e)}if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++)t.push($l(e[n]));return`[`+t.join(`,`)+`]`}if(typeof e==`object`){let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)throw new Ql(e);let n=e,r=[];for(let e of Object.keys(n).sort())n[e]!==void 0&&r.push(JSON.stringify(e)+`:`+$l(n[e]));return`{`+r.join(`,`)+`}`}throw new Ql(e)},eu=(e,t)=>{e.scheduled?(e.committed??=[]).push(t):t()},tu=(e,t,n)=>{let r=e.v;if(r._tag===`Element`){if(e.inst===n&&r.refKey===t)return e.node;let i=r.owned;if(i!==void 0)for(let r=0;r<i.length;r++){let a=i[r];if(a.owner===n&&a.refKey===t)return e.node}}else if(r._tag===`Child`&&e.kids===void 0){if(r.view!==void 0){let r=e.inst.rendered;return r===void 0?void 0:tu(r,t,n)}let i=e.inst.placed;if(i===void 0)return;for(let e of i.values()){let r=nu(e.rec.kids,t,n);if(r!==void 0)return r}return}return nu(e.kids,t,n)},nu=(e,t,n)=>{if(e!==void 0)for(let r=0;r<e.length;r++){let i=tu(e[r],t,n);if(i!==void 0)return i}},ru=e=>({lookup:t=>pr(n=>eu(e.tree,()=>{let r=e.closed?void 0:e.rendered;n(rn($e(r===void 0?void 0:tu(r,t.key,e))))}))}),iu=(e,t,n)=>e.name===t&&e.key===n,au=e=>e.status===`running`||e.status===`stopping`,ou=(e,t)=>{let n=e.filter(e=>e.status!==`stopping`);if(t._tag===`Interrupt`)return{action:`none`,interrupt:n.filter(e=>e.name===t.name&&(t.groupKey===void 0||e.key===t.groupKey))};let r=e.filter(e=>iu(e,t.name,t.groupKey));switch(t.mode){case`concurrent`:return{action:`start`,interrupt:[]};case`switch`:return{action:r.some(au)?`queue`:`start`,interrupt:r.filter(e=>e.status!==`stopping`)};case`queue`:return{action:r.some(au)?`queue`:`start`,interrupt:[]}}},su=(e,t)=>{let n=e.filter(e=>iu(e,t.name,t.key));if(!n.some(au))return n.find(e=>e.status===`queued`)},cu=(e,t,n)=>{let r=t.mode===`queue`?e.find(e=>iu(e,t.name,t.key)&&e.status===`awaiting`):e.find(e=>e.value===t.value&&e.status===`awaiting`);return r!==void 0&&n(r.value)?r:void 0},lu=Ut(`@effect/ui/Renderer`),uu=Ut(`@effect/ui/Renderer/Refs`),du=Symbol.for(`@effect/ui/Router/prefetch`),fu=Ut(`@effect/ui/internal/RootHooks`),pu=ro(`@effect/ui/internal/CurrentRoot`,{defaultValue:()=>()=>void 0}),mu=Symbol.for(`@effect/ui/Subscription/onServer`),hu=Symbol.for(`@effect/ui/Subscription/direct`),gu=e=>e.service!==void 0&&e.name.startsWith(`@effect/ui/Router/`),_u=class{inst;cleanupFailed;list=[];left;constructor(e,t){this.inst=e,this.cleanupFailed=t,(e.closers??=[]).push(()=>this.close()),(e.swaps??=[]).push(e=>this.swap(e))}close(){let e=this.inst;this.left=Oo(e.tree);let t=Co(e),n=()=>{for(let e of this.list.slice())this.stop(e,`unmount`)};if(t.length===0)n();else{let r=t.length;for(let i of t)i.addObserver(()=>--r===0&&Oo(e.tree)(n))}for(let e of this.list)e.fiber!==void 0&&So(e.fiber)&&t.push(e.fiber);wo(e,t)}swap(e){let t=this.list.filter(e=>!e.gated);for(let e of t)e.status!==`running`&&this.drop(e);for(let e of t)e.done||this.drop(e);for(let t of this.list)t.status===`stopping`&&e.push(t.fiber)}drop(e){if(e.held===void 0)return this.stop(e,`layer`);e.held=void 0,this.remove(e),Eu(this.inst,e),yu(this.inst)}running=(e,t)=>this.list.some(n=>n.command.name===e&&(t===void 0||n.command.groupKey===t));pending(){return this.list.map(e=>({name:e.command.name,status:e.status}))}remove(e){e.done=!0,Su.get(this.inst.tree)?.delete(e);let t=this.list.indexOf(e);t>=0&&this.list.splice(t,1)}promote(e){for(;;){let t=su(xu(this),bu(e));if(t===void 0)return;if(this.inst.closed)this.stop(t.value,`unmount`);else{t.value.status=`running`,this.start(t.value);return}}}stop(e,t){if(e.done)return;let n=this.inst;if(e.held!==void 0){let r=n.closed||n.tree.closed;vu(e,r?`closed`:t===`switch`?t:`interrupt`),r?(e.held=void 0,this.remove(e),Eu(n,e)):this.deliver(e);return}let r=e.fiber;r!==void 0&&r.pollUnsafe()===void 0?(e.done=!0,e.status=`stopping`,e.cut=Oo(n.tree),e.reason=t,r.interruptUnsafe()):(this.remove(e),r===void 0&&e.handle?.finish({_tag:`Stopped`}),Du(n,e,t),yu(n),this.promote(e))}start(e){let t=this.inst;if(e.done)return;if(t.hold?.(()=>{e.gated=!1,this.start(e)})){e.gated=!0;return}let n=t.env,r=n.ctx;if(r===void 0){if(n.cause===void 0){n.waiting.push(()=>n.cause===void 0?this.start(e):this.stop(e,`layer`));return}r=Mo(n)}let i=e.command,o=t.tree,s=Ar(`sequential`),c={_tag:`Command`,name:i.name,issued:e.issued,spanId:void 0,traceId:void 0},l=n=>{if(e.done)return;let r=Rl(n);e.silent=r&&e.silent!==!1,r||Oo(o)(()=>Nc(t,n,c))},u=a(i.name,{attributes:{path:t.path,mode:i.mode}},n=>{if(e.done||t.closed)return Za;e.spanId=n.spanId,e.traceId=n.traceId;let r=o.log;r!==void 0&&d(()=>r(t,{_tag:`CommandStarted`,name:i.name,issued:e.issued,spanId:n.spanId,traceId:n.traceId})),c={_tag:`Command`,name:i.name,issued:e.issued,spanId:n.spanId,traceId:n.traceId};let a=i._tag===`Effect`?i.work:Ga(i.work,e=>P(()=>l(i.resolve(e)))),s=i.writes;return e.handle===void 0?s===void 0?a:jt(n=>Gn(Xr(n(a)),n=>{let r;if(e.handle===void 0&&n._tag===`Success`){try{r=s(n.value)}catch(t){return Su.get(o)?.delete(e),$i(t)}r.length>0&&(zl.run.cacheOf(t),wu(o))}let i=e.handle,a=r;return i===void 0?(Su.get(o)?.delete(e),n):i.run(n,a===void 0?s:()=>a)})):e.handle.run(a,s)}),d=Do,f=n=>{if(e.done||t.closed)return;d=Oo(o,!0);let i=C(C(r,ga,s),uu,ru(t)),a=ko(o,n?C(i,eo,!0):i,wt(u,e=>vi(s,e)),n);e.fiber=a,a.addObserver(t=>{Oo(o)(()=>this.exited(e,t,c))})};Pl.has(o)&&gu(i)?Fl(o,()=>f(!0)):f()}exited(e,t,n){let r=this.inst,i=e.command;if(e.handle?.finish({_tag:`Stopped`}),e.status===`stopping`){this.remove(e),e.cut(()=>Du(r,e,e.reason)),Vn(t)&&he(t.cause)&&Xl(r.env.ctx??Xa(),this.cleanupFailed(r.path,i.name,t.cause)),yu(r),this.promote(e);return}if(e.done)return;let a=Vn(t)&&!he(t.cause)&&!Ne(t.cause),o=i._tag===`Effect`&&i.afterRefetch!==void 0&&Ba(t);if(r.closed||a){this.remove(e),a?!r.closed||e.spanId!==void 0?Du(r,e,`self`):(this.left??Do)(()=>Du(r,e,`unmount`)):(Vn(t)&&ko(r.tree,r.env.ctx,fe(`${r.path} is gone, and its Command ${i.name} failed`,t.cause)),o&&(e.waited={waitEnded:`closed`,outstanding:e.handle?.outstanding()??[]}),Eu(r,e)),yu(r),this.promote(e);return}let s=i.reject;if(Vn(t)&&(he(t.cause)||s===void 0)){this.remove(e),Q(r,`command`,t.cause,void 0,void 0,i.name,e.issued);return}if(Ba(t)&&i._tag===`Stream`){this.remove(e),Eu(r,e),yu(r),this.promote(e);return}let c;try{c=Vn(t)?s(v(lt(t.cause))):i.resolve(t.value)}catch(t){this.remove(e),Q(r,`command`,K(t),void 0,void 0,i.name,e.issued);return}e.silent=Rl(c)&&e.silent!==!1,e.status=`awaiting`,e.held={message:c,source:n},this.promote(e),o&&this.wait(e),this.release(e)}wait(e){let t=this.inst,n=e.handle,r=n?.awaited()??[];if(n===void 0||r.length===0){e.waited={waitEnded:`nothing`,outstanding:[]};return}if(t.tree.log?.(t,{_tag:`CommandAwaiting`,name:e.command.name,issued:e.issued,entries:r}),e.waiting=!0,n.outstanding().length===0)return vu(e,`settled`);let i=e.command.afterRefetch,a=Qi(i)?Math.max(0,Wn(i)-n.sinceApplied()):1/0;if(a===0)return vu(e,`budget`);let o=Oo(t.tree),s=n=>o(()=>{vu(e,n),Fl(t.tree,()=>this.release(e))}),c=n.onRefetched(()=>s(`settled`)),l=Number.isFinite(a)?ko(t.tree,t.env.ctx??Xa(),G(Ae(ki(a)),P(()=>s(`budget`)))):void 0;e.cancelWait=()=>{c(),l?.interruptUnsafe()}}release(e){for(;;){if(e.command.mode!==`queue`&&e.done)return;let t=cu(xu(this),bu(e),e=>!e.waiting);if(t===void 0)return;if(this.inst.closed||this.inst.tree.closed)return this.stop(t.value,`unmount`);this.deliver(t.value)}}deliver(e){let t=this.inst,n=e.held;e.held=void 0,Rl(n.message)||Nc(t,n.message,n.source),e.done||(this.remove(e),Eu(t,e),yu(t))}},vu=(e,t)=>{if(!e.waiting)return;e.waiting=!1,e.waited={waitEnded:t,outstanding:t===`settled`?[]:e.handle.outstanding()};let n=e.cancelWait;e.cancelWait=void 0,n?.()},yu=e=>{e.closed||Lc(e)},bu=e=>({name:e.command.name,key:e.command.groupKey,mode:e.command.mode,status:e.status,value:e}),xu=e=>e.list.map(bu),Su=new WeakMap,Cu=(e,t)=>zl.run.cacheOf(e).beginRun({command:t.name,invalidates:t.invalidates,optimistic:t.optimistic,afterRefetch:t._tag===`Effect`&&t.afterRefetch!==void 0}),wu=e=>{let t=Su.get(e);if(t!==void 0){Su.delete(e),e.cached=void 0;for(let[e,n]of t)e.handle=Cu(n,e.command),e.spanId!==void 0&&e.handle.start()}},Tu=(e,t,n,r)=>{if(e.closed)return;let i=e.tree.host.server;if(i!==void 0)return i.drop(e,t.name,n);let a=e.runs??=new _u(e,r),o=ou(xu(a),t);if(t._tag===`Interrupt`){for(let e of o.interrupt)a.stop(e.value,`interrupt`);return}let s;t.service;for(let e of o.interrupt)a.stop(e.value,`switch`);let c={command:t,issued:n,status:o.action===`start`?`running`:`queued`,fiber:void 0,done:!1,held:void 0,silent:void 0,spanId:void 0,traceId:void 0,cut:void 0,reason:void 0,gated:!1,handle:s,waiting:!1,waited:void 0,cancelWait:void 0};if(a.list.push(c),t.service!==void 0&&t.writes!==void 0){let t=Su.get(e.tree);if(t===void 0){let n=e.tree;Su.set(n,t=new Map),n.cached=()=>wu(n)}t.set(c,e)}c.status===`running`?a.start(c):a.promote(c),yu(e)},Eu=(e,t)=>{e.tree.log?.(e,{_tag:`CommandEnded`,name:t.command.name,issued:t.issued,spanId:t.spanId,traceId:t.traceId,silent:t.silent===!0,...t.waited})},Du=(e,t,n)=>{e.tree.log?.(e,{_tag:`CommandInterrupted`,name:t.command.name,issued:t.issued,spanId:t.spanId,traceId:t.traceId,reason:n})},Ou=`~@effect/ui/Command`,ku=`~@effect/ui/Command/Definition`,Au=`~@effect/ui/Command/Unmatched`,ju=e=>e,Mu={_Msg:e=>e,_Source:e=>e,_SourceE:e=>e};function Nu(){return Ur(this,arguments)}function Pu(e,t,n){Tu(e,this,{seq:typeof t==`number`?t:-1,index:n},Xu)}var Fu={[Ou]:Mu,pipe:Nu,"~run":Pu},Iu={[Ou]:Mu,pipe:Nu,"~run":Pu,[Au]:{_A:e=>e,_E:e=>e,_R:e=>e}},Lu=(e,t=!1)=>{let{reject:n,resolve:r,work:i}=e,a,o;if(e._tag===`Effect`){let e=r===ju?i:_t(i,r);a=n===void 0?e:Si(e,e=>P(()=>n(e)))}else{let e=r===ju?i:Mi(i,r);o=n===void 0?e:er(e,e=>sr(()=>n(e)))}return Object.assign(Object.create(t?Iu:Fu),e,{effect:a,stream:o})},Ru=[],zu=e=>S(e)?e:Y(e),Bu=(e,t,n)=>{if(n.length===0)return()=>void 0;let r={};for(let i of n){if(!Object.hasOwn(t.fields,i))throw Error(`${e}: the group field "${i}" isn't one of its args`);r[i]=t.fields[i]}let i=Y(r),a;return e=>{a===void 0&&(a=Br(ht(i)));let t={},r=e??{};for(let e of n)Object.hasOwn(r,e)&&(t[e]=r[e]);return{key:$l(a(t)),schema:i,picked:t}}},Vu=(e,t,n,r)=>{let i=t.stream===!0,a=t.mode??`concurrent`,o=t.group??[],s=zu(t.args),c=Bu(e,s,o);return{[ku]:ku,stream:i,mode:a,group:o,args:s,"~group":c,make(t={}){let o=c(t);return Lu({_tag:i?`Stream`:`Effect`,name:e,args:t,mode:a,groupKey:o?.key,"~group":o,argsSchema:s,afterRefetch:void 0,resolve:ju,reject:void 0,...r(t)},n)}}},Hu=e=>mi(e)?e.key:e.name,Uu=(e,t)=>t===void 0?void 0:e[`~group`](t)?.key,Wu=(e,t,n)=>({name:e,...Vu(e,t,!1,e=>({service:void 0,invalidates:Ru,optimistic:Ru,writes:void 0,work:n(e)}))}),Gu=()=>(e,t)=>{let n=Ut()(e),{error:r,invalidates:i,optimistic:a,stream:o,success:s,writes:c}=t,l=n;class u extends n{static success=s;static error=r??zn;static toLayer(e){return Xt(e)?On(n,e):Jn(n,e)}}return Object.assign(u,Vu(e,t,!0,e=>({service:n,invalidates:i?.(e)??Ru,optimistic:a?.(e)??Ru,writes:c===void 0?void 0:t=>c(t,e),work:o?Qa(_t(l,t=>t(e))):Gn(l,t=>t(e))})))},Ku=Fr(2,(e,t)=>{if(e._tag===`Interrupt`)return e;let{reject:n,resolve:r}=e;return Lu({...e,resolve:e=>t(r(e)),reject:n===void 0?void 0:e=>t(n(e))})}),qu=Fr(2,(e,t)=>Ku(e,()=>t)),Ju=e=>qu(e,Ll),Yu=class extends ar(`CleanupFailed`){};function Xu(e,t,n){return new Yu({path:e,command:t,cause:n,message:`[@effect/ui] ${e}'s Command ${t} was stopped, and it died before its fiber exited.`})}var Zu=new WeakMap,Qu=e=>{let t=e.tree;Zu.set(t,(Zu.get(t)??0)+1),(e.closers??=[]).push(()=>Zu.set(t,Zu.get(t)-1))},$u=e=>e.loading??e.inst.at,ed=e=>e.loading===void 0?e.inst.under:e.under,td=new WeakSet,nd=Ko(``),rd=e=>e.alive===!0?void 0:e.alive,id=class{author;kids=new Map;round=0;constructor(e){this.author=e,(e.closers??=[]).push(()=>{for(let t of this.kids.values())cd(e,t)})}children(){let e=[];for(let t of this.kids.values())t.loading===void 0&&e.push(t);return e}parked(){let e=[];for(let t of this.kids.values())t.loading!==void 0&&t.rec===void 0&&e.push(t.loading);return e}done(){let e=this.author,t=new Set;e.rendered!==void 0&&ld(e.rendered,t);for(let[n,r]of this.kids)if(r.round===this.round)t.has(n)&&ud(e,n);else if(r.alive!==void 0){let t=ed(r);(t===void 0||e.tree.held?.(t)!==!0)&&this.ask(r.alive,$u(r).v,r)}this.round++}ask(e,t,n){let r=this.author,i=!1;try{let n=e({key:t.key,get model(){return i=!0,r.model},get props(){return i=!0,r.props},get queries(){return i=!0,r.results}});if(!i)throw Error(r.path+`: an h.keepAlive predicate reads the Model from its argument: ({ model, key }) => key in model.items`);if(n===!0)return!0}catch(e){ul(r,e)}return r.tree.ended?.(r,r.path+`/`+nc(t)),n!==void 0&&ad(this,nc(t),n),!1}},ad=(e,t,n)=>{e.kids.delete(t),n.rec!==void 0&&dd(e.author,n.rec,!0),n.rec=void 0,cd(e.author,n)},od=(e,t)=>{let n=$c(t),r=e.parentOf(n);r!=null&&il(e,r,t)},sd=(e,t,n)=>{let r=t.kids;if(r!==void 0){t.kids=void 0;for(let t=r.length-1;t>=0;t--){let i=r[t];Qc(e,i),n&&od(e.tree.host,i)}}},cd=(e,t)=>{let n=t.loading;if(n===void 0){let n=t.rec===void 0&&td.has(t.inst),r=t.inst.rendered;n&&td.delete(t.inst),Xc(t.inst),n&&r!==void 0&&od(e.tree.host,r);let i=t.inst.at;t.rec===void 0&&i!==void 0&&i.inst===t.inst&&sd(e,i,n)}else if(ec(n),t.rec===void 0){let r=t.parked,i=n.kids?.[0];t.parked=!1,Qc(e,n),r&&i!==void 0&&od(e.tree.host,i)}},ld=(e,t)=>{let n=e.v;if(n._tag===`Child`)n.alive===void 0&&t.add(nc(n));else if(n._tag===`Element`&&e.kids!==void 0)for(let n=0;n<e.kids.length;n++)ld(e.kids[n],t)},ud=(e,t)=>ul(e,Error(e.path+` writes `+t+` twice in one render`)),dd=(e,t,n)=>{let r=e.tree.host,i=$c(t),a=r.parentOf(i),o=hl(e,nd),s=t.kids;if(a!=null&&(r.insert(a,o.node,i),(n||s!==void 0)&&il(r,a,t)),s!==void 0)for(let t=s.length-1;t>=0;t--)Qc(e,s[t]);t.kids=[o],t.inst=e},fd=(e,t)=>{let n=e.v;if(n._tag===`Child`&&(t?td.delete(e.inst):td.add(e.inst)),n._tag===`Element`&&n.mount!==void 0){let r=n.mount;t?r[`~attach`](e):r[`~detach`](e)}let r=e.kids;if(r!==void 0)for(let e=0;e<r.length;e++)fd(r[e],t);else n._tag===`Child`&&e.inst.rendered!==void 0&&fd(e.inst.rendered,t)},pd=new WeakMap,md=(e,t)=>{let n=t.inst,r=t.loading,i=nc(r.v);if(t.rec!==void 0||t.parked||n.closed||n.kept.kids.get(i)!==t)return;let a=e.host.createContainer;if(a===void 0)return ul(n,Error(n.path+`/`+i+` is kept, and this host has no createContainer`));let o=r.kids[0];tl(e.host,a(),o,null),t.parked=!0,fd(o,!1)},hd=(e,t)=>{for(let n of t.splice(0)){if(n.loading!==void 0){md(e,n);continue}let t=n.inst;if(n.rec!==void 0||t.closed||td.has(t))continue;let r=e.host.createContainer;r===void 0?ul(t.parent,Error(t.path+` is kept, and this host has no createContainer`)):(tl(e.host,r(),t.rendered,null),td.add(t),fd(t.rendered,!1),e.drawn?.(t,!1),e.log?.(t,{_tag:`Kept`}))}},gd=(e,t)=>{let n=pd.get(e);if(n===void 0){let t=n=[];pd.set(e,t);let r=e.work;e.work=n=>(hd(e,t),r?.(n)===!0)}n.push(t),Ic(e)},_d=(e,t)=>t.inst===e&&t.kids[0].v!==nd,vd=(e,t)=>{t.kids=[hl(e,nd)]},yd=(e,t,n,r,i)=>{let a=t.loading,o=a.kids[0];if(ec(a),t.rec===void 0)a.kids=void 0;else{let t=e.tree.host,n=$c(o),r=t.parentOf(n),i=hl(e,nd);r!=null&&(t.insert(r,i.node,n),il(t,r,o)),a.kids=[i]}n.inst=e,n.kids=[o],t.loading=t.rec=n,t.under=r,t.parked&&(t.parked=!1,fd(o,!0)),Zs(i.component)._tag!==`Failed`&&i.component[`~load`](e,n,r),yl(e,n,i)},bd=(e,t,n)=>{let r=t.v,i=t.kids;if(r._tag===`Element`){if(i!==void 0)for(let t=0;t<i.length;t++)bd(e,i[t],n)}else r._tag===`Child`&&r.alive===void 0&&(i===void 0?n.push(r):(t.inst===e&&n.push(r),bd(e,i[0],n)))},xd=(e,t)=>{let n=[];e.rendered!==void 0&&bd(e,e.rendered,n);let r=e.kept;if(r!==void 0)for(let[i,a]of r.kids)i!==t&&(n.push($u(a).v),a.loading!==void 0&&bd(e,a.loading.kids[0],n));return n},Sd={mount(e,t,n){let r=t.v,i=e.tree,a=e.kept??=new id(e),o=nc(r),s=a.kids.get(o);s!==void 0&&s.loading===t&&(a.kids.delete(o),s=void 0);let c=rd(r),l=e.writing>0?a.round:-1;if(s!==void 0&&(l===s.round&&l>=0&&s.rec!==void 0||$u(s).v.component!==r.component))return ud(e,o),vd(e,t);if(l<0&&n!==void 0&&(s===void 0||$u(s).v!==r)){for(let r of a.kids.values())if(r.loading===void 0&&td.has(r.inst)&&n.startsWith(r.inst.path+`/`))return vd(e,t)}if(c!==void 0&&!a.ask(c,r,s))return vd(e,t);if(s?.loading!==void 0&&Qs(r.component)!==void 0&&(ad(a,o,s),s=void 0),s===void 0){ol(e,t,!0),t.inst===e?Qs(r.component)===void 0&&a.kids.set(o,{inst:e,rec:t,loading:t,under:n,parked:!1,alive:c,round:l}):a.kids.set(o,{inst:t.inst,rec:t,loading:void 0,under:void 0,parked:!1,alive:c,round:l});return}if(s.alive=c,s.round=l,s.loading!==void 0)return yd(e,s,t,n,r);let u=s.inst,d=u.at;s.rec===void 0?sd(e,d,td.has(u)):dd(e,s.rec,!1),t.inst=u,u.at=t,u.under=n,s.rec=t,u.closed?(td.delete(u),t.kids=[Ac(u,u.failure)]):(td.has(u)&&(td.delete(u),fd(u.rendered,!0),i.log?.(u,{_tag:`Drawn`})),i.drawn?.(u,!0),yl(e,t,r))},patch(e,t,n,r){let i=nc(n),a=e.kept,o=a?.kids.get(i);if(n.alive===void 0)return o===void 0||o.rec!==t?bl(e,t,n):(a.kids.delete(i),ed(o)===void 0?void 0:bl(e,t,n));let s=t.inst===e&&t.kids!==void 0;if(t.v.alive===void 0&&o===void 0&&!t.inst.closed&&(s?r===void 0:t.kids===void 0&&t.inst.parent===e&&t.inst.under===void 0)&&(a=e.kept??=new id(e),a.kids.set(i,o={inst:t.inst,rec:t,loading:s?t:void 0,under:void 0,parked:!1,alive:void 0,round:-1})),o===void 0||o.rec!==t)return _d(e,t)?void 0:bl(e,t,n);let c=rd(n);if(c!==void 0&&!a.ask(c,n,o))return t.v=n,t;o.alive=c,o.round=e.writing>0?a.round:-1},release(e,t){let n=e.kept?.kids.get(nc(t.v));if(t.inst===e)return n===void 0||n.loading!==t||n.rec!==t||e.closed?!_d(e,t):(n.rec=void 0,ec(t),gd(e.tree,n),!0);if(n===void 0||n.rec!==t||e.closed)return!1;if(n.rec=void 0,!n.inst.closed)gd(e.tree,n);else{let n=t.kids;for(let t=n.length-1;t>=0;t--)Qc(e,n[t]);t.kids=void 0}return!0},shows(e,t,n){try{return gc(lc(e,xd(e,nc(t))),t,n),n}catch(t){return ul(e,t),nd}}},Cd=(e,t,n)=>{if(e.state._tag===`Empty`)e.state={_tag:`Open`,finalizerKey:t,finalizer:n,finalizers:void 0};else if(e.state._tag===`Open`){let r=e.state;r.finalizer===void 0||(r.finalizers=new Map([[r.finalizerKey,r.finalizer]]),r.finalizerKey=void 0,r.finalizer=void 0),r.finalizers.set(t,n)}},wd=()=>{let e=Error(`[@effect/ui] A provided Layer failed on the server`);return e.stack=`${e.name}: ${e.message}`,K(e)},Td=[],Ed=e=>{try{return e.component.layerKeys.map(t=>t(e.props,e.model))}catch(e){return{defect:e}}},Dd=(e,t)=>Array.isArray(e)&&Array.isArray(t)?e.every((e,n)=>pa(e,t[n])):!Array.isArray(e)&&!Array.isArray(t),Od=e=>({ctx:void 0,cause:void 0,waiting:[],parent:e}),kd=(e,t,n)=>{e.ctx===void 0?e.cause===void 0?e.waiting.push(()=>kd(e,t,n)):n(e.cause):t(e.ctx)},Ad=(e,t,n)=>{e.ctx=t,e.cause=n;for(let t of e.waiting.splice(0))t()},jd=(e,t)=>{e.add(t),t.addObserver(()=>e.delete(t))},Md=-19521,Nd=(e,t,n)=>{let r=Lt(Ao(t))(n,{uninterruptible:!0});if(r.pollUnsafe()===void 0)return jd(e.closing??=new Set,r),jo(e,r)},Pd=(e,t,n,r)=>{n.state._tag===`Closed`?Nd(e,t,r):Cd(n,{},()=>r)},Fd=(e,t,n,r,i,a)=>{let o=new Set;Pd(e,n,i,A(()=>tt([...o])));let s=c=>{let l=_r(i,`sequential`),u=r===void 0?ia(t,l):Ke(t,r,l),d=c,f=Lt(Ao(n))(c?G(G(Ta,A(()=>tt([...e.closing??=new Set]))),A(()=>(d=!1,u))):u),p=t=>{if(Ba(t))return a(t);let r=Nd(e,n,vi(l,nr));if(r!==void 0&&jd(o,r),!d){if(i.state._tag===`Closed`||!Ft(t.cause)||!go(t.cause).has(Md))return a(t);s(!0)}},m=f.pollUnsafe();if(m!==void 0)return p(m);let h=Oo(e);f.addObserver(e=>h(()=>p(e))),Pd(e,n,l,P(()=>{f.pollUnsafe()===void 0&&(jd(e.closing??=new Set,f),jd(o,f),f.interruptUnsafe(Md))}))};s(!1)},Id=new WeakMap,Ld=new WeakMap,Rd=(e,t)=>{let n=Ld.get(e);return n===void 0&&Ld.set(e,n=hn.forkOrCreate(t)),n},zd=(e,t,n,r)=>{let i={flush:e.flush?.()??0},a=e.building??=new Set;a.add(i);let o=()=>a.delete(i),s=()=>{a.delete(i)&&Ic(e)};return kd(n,s,s),Pd(e,t,r,P(o)),o},Bd=new WeakSet,Vd=new WeakMap,Hd=class{inst;component;parent;context;scope=Ar(`sequential`);booting=!0;failedEarly=void 0;ready=!1;shared=void 0;keys=Td;model=void 0;props=void 0;held=[];retired=void 0;releases=new Set;constructor(e){this.inst=e,this.component=e.component,this.parent=e.env,this.context=Mo(e.env)}log(e){this.inst.tree.log?.(this.inst,e)}start(e,t,n){let r=this.inst,i=r.tree,a=()=>!r.closed&&r.env===e,o=!1,s,c=i.builds=(i.builds??0)+1,l=t=>{s?.(),i.failedBuild=Math.max(i.failedBuild??0,c),a()&&this.failed(e,t)},u=this.shared;if(u!==void 0)kd(e,()=>{a()&&o&&this.log({_tag:`LayerReady`}),this.ready=!0},l);else{let t=this.scope;kd(this.parent,s=>{if(!a())return;let c;try{let e=this.keys;if(!Array.isArray(e))throw e.defect;c=this.component.layer(r.props,e)}catch(e){return l(K(e))}Fd(i,c,s,void 0,t,t=>{if(a()){if(Vn(t))return l(t.cause);(o||n)&&this.log({_tag:`LayerReady`}),this.ready=!0,Ad(e,ci(s,t.value))}})},l)}a()&&e.ctx===void 0&&e.cause===void 0&&this.failedEarly===void 0&&(o=!0,this.log({_tag:`LayerPending`,status:t}),s=zd(i,this.context,e,u?.scope??this.scope))}failed(e,t){let n=this.inst,r=n.tree;this.ready=!1;let i=this.component.layerFailure,a=r.host.server!==void 0&&i!==void 0;this.log(a?{_tag:`LayerFailed`,cause:t,redacted:!0}:{_tag:`LayerFailed`,cause:t}),i===void 0?this.booting?this.failedEarly=t:r.schedule(()=>n.env===e&&Q(n,`layer`,t)):(a&&(e.cause=wd()),e.cause===void 0&&Ad(e,void 0,t),r.schedule(()=>{n.env===e&&n.fire(i,bn(t),void 0,`onFailure`)}))}hold(e){let t=this.inst;return t.model===this.model&&t.props===this.props?!1:(this.held.push(e),!0)}reselect(){let e=this.inst;if(e.model===this.model&&e.props===this.props)return;this.model=e.model,this.props=e.props;let t=Ed(e),n=!Dd(this.keys,t),r=!1;n&&(this.keys=t,r=this.swap());let i=this.held;this.held=[];for(let e of i)e();if(!n)return;let a=e.env,o=()=>this.releaseRetired();kd(a,o,o),this.start(a,`Rebuilding`,r),e.component[`~sync`]?.(e)}swap(){let e=this.inst,t=e.env;e.env=Od(this.parent);let n=[];if(e.swaps!==void 0)for(let t of e.swaps)t(n);Yc(e),n.push(...Co(e));let r={scope:this.scope,waits:n};t.ctx!==void 0&&this.retired===void 0?this.retired=r:(this.release({scope:this.scope,waits:[]}),this.retired?.waits.push(...n)),this.scope=Ar(`sequential`);let i=this.ready;return this.ready=!1,!i}releaseRetired(){let e=this.retired;e!==void 0&&(this.retired=void 0,this.release(e))}release(e){let t=Nd(this.inst.tree,this.context,Ud(e));t!==void 0&&jd(this.releases,t)}close(){let e=this.inst,t=Co(e),n=this.retired;this.retired=void 0;let r=this.shared,i=Nd(e.tree,this.context,G(tt(t),A(()=>G(r===void 0?vi(this.scope,nr):Gd(this.parent,this.component,r),G(n===void 0?wr:Ud(n),A(()=>tt([...this.releases])))))));i!==void 0&&wo(e.parent,[i])}},Ud=({scope:e,waits:t})=>G(tt(t),vi(e,nr)),Wd=(e,t,n)=>{let r=Id.get(t);r===void 0&&Id.set(t,r=new Map);let i=r.get(n);if(i!==void 0)return i.refs++,i;let a={env:Od(t),scope:Ar(`sequential`),refs:1};return r.set(n,a),kd(t,i=>{Fd(e,n,i,Rd(t,i),a.scope,e=>{if(Ba(e))return Ad(a.env,ci(i,e.value));r.get(n)===a&&r.delete(n),Ad(a.env,void 0,e.cause)})},e=>Ad(a.env,void 0,e)),a},Gd=(e,t,n)=>{if(--n.refs>0)return wr;let r=Id.get(e);return r?.get(t.sharedLayer)===n&&r.delete(t.sharedLayer),vi(n.scope,nr)},Kd=e=>{let t=e.tree;if(t.host.inert){e.env=Od(e.env);return}let n=t.host.server;if(n!==void 0&&(!e.component.layerOnServer||Bd.has(e.env)))return Bd.add(e.env=Od(e.env)),n.defer(e);let r=new Hd(e),i=r.component;(e.closers??=[]).push(()=>r.close()),i.layerKeys!==void 0&&(r.model=e.model,r.props=e.props,r.keys=Ed(e),Vd.set(e,r),e.hold=e=>r.hold(e));let a=t.served?.(e),o=i.sharedLayer;if(a===`Failed`){let t=wd();r.log({_tag:`LayerFailed`,cause:t,redacted:!0}),Ad(e.env=Od(r.parent),void 0,t)}else o===void 0?e.env=Od(r.parent):(r.shared=Wd(t,r.parent,o),e.env=r.shared.env);a!==`Failed`&&r.start(e.env,a===`Ready`?`Awaiting`:`Pending`,!1),r.booting=!1,r.failedEarly!==void 0&&Q(e,`layer`,r.failedEarly)},qd=e=>{Vd.get(e)?.reselect()},Jd=class{layers=[];"~fire"(e,t,n){let r=!1,i=!1;for(let a of this.layers)a.inst.fire(a.handler,e,t)&&(r=!0,a.prevents&&!i&&(i=!0,n?.()));return r}},Yd=new WeakMap,Xd=class{own;owned;constructor(e,t){this.own=e,this.owned=t}"~attach"(e){let t=Yd.get(e)??[],n=[];this.own!==void 0&&this.own[`~attach`](e);for(let{owner:r,mount:i}of this.owned){if(i===void 0)continue;let a=i.name,o=t.find(e=>e.owner===r&&e.name===a)?.rec??new _c(e.v,e.node,void 0,r);i[`~attach`](o),n.push({owner:r,name:a,rec:o,mount:i})}for(let e of t)n.some(t=>t.rec===e.rec)||e.mount[`~detach`](e.rec);Yd.set(e,n)}"~detach"(e){this.own?.[`~detach`](e);for(let t of Yd.get(e)??[])t.mount[`~detach`](t.rec);Yd.delete(e)}},Zd=(e,t)=>{let n=t.owned??[],r=t.mount!==void 0||n.some(e=>e.mount!==void 0)?new Xd(t.mount,n):void 0;if(n.length===0)return r===void 0?t:{...t,mount:r};let i=[...n.length>1?n.slice().sort((e,t)=>t.owner.path.length-e.owner.path.length):n,t],a,o;for(let n of i){let r=n===t?e:n.owner;for(let e in n.handlers)((a??={})[e]??=new Jd).layers.push({inst:r,handler:n.handlers[e],prevents:n.eventOptions[e]?.preventDefault===!0});for(let e in n.eventOptions){let t=(o??={})[e]??={},r=n.eventOptions[e];for(let e in r){let n=r[e];n!==void 0&&(e!==`preventDefault`||n===`always`||t[e]!==`always`&&t[e]!==!0)&&(t[e]=n)}}}return{...t,handlers:a??X,eventOptions:o??X,mount:r}},Qd=(e,t)=>(ul(e,t),$d),$d={_tag:`Text`,text:``},ef=[],tf=new WeakMap,nf=(e,t)=>{let n=e.reads;if(n===void 0)return ef;let r=tf.get(n);return r===void 0&&(r=Object.entries(n).map(([e,n])=>typeof n==`function`?{name:e,owner:n,optional:!1,report:void 0,onChange:void 0}:{name:e,owner:n.owner===`self`?t:n.owner,optional:n.optional===!0,report:n.report,onChange:n.onChange}),tf.set(n,r)),r},rf=(e,t)=>{throw Error(`${e} reads the shared state of ${t.owner.definition.name}, and nothing supplies it: render it below a ${t.owner.definition.name}`)},af=(e,t,n)=>{let r={};for(let i of t)r[i.name]=n===void 0?i.optional?void 0:rf(e,i):n(i.owner,i.optional);return r},of=(e,t,n,r)=>e.shares({model:t,props:n,reads:af(e.name,nf(e),r)}),sf=(e,t)=>{let n={};for(let r of t)r.optional?n[r.name]=void 0:Object.defineProperty(n,r.name,{enumerable:!0,get:()=>rf(e,r)});return Object.freeze(n)},cf=e=>{let{name:t,reads:n}=e;if(n===void 0)return;let r=new Map;for(let[i,a]of Object.entries(n)){if(typeof a==`function`)continue;if(a.owner===`self`){if(e.shares===void 0)throw Error(`${t} reads its own kind under ${i}, so it must share state: add shares`);if(a.optional!==!0)throw Error(`${t} reads its own kind under ${i}, and the outermost one has none above it: add optional: true`)}if(a.onChange===void 0)continue;let n=a.owner===`self`?e:a.owner.definition,o=r.get(n);if(o!==void 0)throw Error(`${t} lists ${n.name} under ${o} and ${i}, each with an onChange. A reader gets one message per change of an owner: keep one onChange.`);r.set(n,i)}},lf=100,uf=e=>{let t=e.shared;if(t===void 0){let n=t={owners:new Set,readers:new Set,hidden:new WeakSet,rounds:[],due:new Set,passes:new Map,sends:new Map};e.shared=n;let r=e.work;e.work=e=>r?.(e)===!0||df(n,e);let i=e.drawn;e.drawn=(e,t)=>{i?.(e,t);for(let r of n.readers)r.failure===void 0&&mf(r,e)&&(t?n.hidden.delete(r):n.hidden.add(r),(!t||vf(r))&&Tf(r))}}return t},df=(e,t)=>{if(e.rounds.length>0){for(let t of e.rounds.splice(0))Of(t);return!0}if(!t)return!1;if(e.due.size>0){for(let t of Array.from(e.due))e.due.delete(t),kf(t);return!0}return e.passes.clear(),e.sends.clear(),!1},ff=(e,t,n,r)=>Q(e,t,K(n),void 0,void 0,r),pf=e=>e.component.definition,mf=(e,t)=>{for(let n=e;n!==void 0;n=n.parent)if(n===t)return!0;return!1},hf=(e,t)=>{let n,r=[e.path];for(let t=e.parent;t!==void 0;t=t.parent)t.under!==void 0&&r.push(t.under+`/`);e.under!==void 0&&r.push(e.under+`/`);for(let i of uf(e.tree).owners){let e=i.path+`/`;!i.closed&&r.some(t=>t.startsWith(e))&&t(i)&&(n===void 0||i.path.length>n.path.length)&&(n=i)}return n},gf=(e,t)=>hf(e,e=>pf(e)===t),_f=(e,t)=>{let n=hf(e,e=>pf(e).name===t.name);return n===void 0?`and no `+t.name+` is above it`:`but a different component with the same name is above it at `+n.path},vf=e=>{let t=e.reading;for(let n of nf(pf(e))){let r=n.owner.definition,i=t.owners.get(r),a=gf(e,r);if(a===i&&(a!==void 0||n.optional))continue;if(Lc(e),i!==void 0&&(t.owners.delete(r),t.seen.delete(i),i.owning.readers.delete(e),n.report!==void 0&&bf(i)),a===void 0){if(n.optional)continue;return ff(e,`shared`,Error(e.path+` reads the shared state of `+r.name+`, `+_f(e,r))),!1}let o=a.owning;t.owners.set(r,a),o.readers.add(e),n.onChange!==void 0&&t.seen.set(a,o.value)}return!0},yf=e=>{let t=pf(e);if(nf(t).length>0){let t={owners:new Map,seen:new Map};if(e.reading=t,!vf(e))return;uf(e.tree).readers.add(e),e.look=e=>t.owners.get(e.definition)?.owning?.value}if(t.shares!==void 0){let t=e.owning;e.owning={value:void 0,readers:new Set,seq:void 0,round:!1,collected:t?.collected,held:t?.held===!0},uf(e.tree).owners.add(e),Cf(e,void 0),t?.collected!==void 0&&!t.held&&bf(e)}Tf(e),(e.closers??=[]).push(()=>xf(e))},bf=e=>{let t=e.tree;uf(t).due.add(e),Ic(t)},xf=e=>{Tf(e);let t=e.reading;if(t!==void 0)for(let n of t.owners.values())n.owning.readers.delete(e);let n=uf(e.tree);n.readers.delete(e),e.owning!==void 0&&n.owners.delete(e)},Sf=(e,t,n)=>{if(e.owning!==void 0&&!Cf(e,n))return;Tf(e);let r=t?.sends;r!==void 0&&r.length>0&&Af(e,r,n)},Cf=(e,t)=>{let n=e.owning,r;try{r=of(pf(e),e.model,e.props,e.look)}catch(t){return ff(e,`shares`,t),!1}if(Js(n.value,r))return!0;n.value=r,n.seq=t;let i=!1;for(let t of n.readers)t.closed||(Lc(t),t.reading.seen.has(e)&&(i=!0));return i&&!n.round&&(n.round=!0,uf(e.tree).rounds.push(e)),!0},wf=e=>{e.owning!==void 0&&e.reading!==void 0&&Cf(e,void 0)},Tf=e=>{let t=e.reading;if(t!==void 0)for(let n of nf(pf(e))){if(n.report===void 0)continue;let e=t.owners.get(n.owner.definition);e!==void 0&&pf(e).collects!==void 0&&bf(e)}},Ef=(e,t,n,r)=>{let i=(e.get(t)??0)+1;return e.set(t,i),i<=lf||(ff(t,n,Error(t.path+r)),!1)},Df=e=>Ef(uf(e.tree).passes,e,`shares`,` sent its readers' onChange or its own collects.onChange 100 times in one flush. A reader whose onChange or report answers the shared value with a change of it loops: answer with a value that settles.`),Of=e=>{let t=e.owning;if(t.round=!1,e.closed)return;let n=t.value,r=t.seq,i=!1;for(let a of Array.from(t.readers)){let t=a.reading;if(a.closed||!t.seen.has(e)||Js(t.seen.get(e),n))continue;if(!i&&(i=!0,!Df(e)))return;t.seen.set(e,n);let o=nf(pf(a)).find(n=>n.onChange!==void 0&&t.owners.get(n.owner.definition)===e),s;try{s=o.onChange(n)}catch(e){ff(a,`shared`,e,o.name)}if(s!==void 0&&!a.closed&&Nc(a,s,{_tag:`Shared`,name:o.name,path:e.path,seq:r}),e.closed)return}},kf=e=>{let t=pf(e).collects,n=e.owning;if(t===void 0||e.closed||n.held)return;let r=[],i=uf(e.tree).hidden;for(let t of n.readers){if(t.closed||i.has(t))continue;let n=t.reading;for(let i of nf(pf(t)))if(i.report!==void 0&&n.owners.get(i.owner.definition)===e)try{r.push(i.report(t.model,t.props,(e,n)=>Ts(t.path,e,n)))}catch(e){return ff(t,`shared`,e,i.name)}}let a;try{n.collected??={message:t.onChange([])},a=t.onChange(r)}catch(t){return ff(e,`shares`,t)}Js(n.collected.message,a)||(n.collected={message:a},Df(e)&&Nc(e,a,{_tag:`Collected`}))},Af=(e,t,n)=>{if(Ef(uf(e.tree).sends,e,`send`,` sent to its owners 100 times in one flush. Updates that answer each other loop: answer a send with state, or send from a user event.`))for(let r=0;r<t.length;r++){if(e.closed)return;let i=t[r].owner.definition,a=gf(e,i);if(a!==void 0)Nc(a,t[r].message,{_tag:`Send`,path:e.path,seq:n});else if(nf(pf(e)).some(e=>e.optional&&e.owner.definition===i))e.tree.log?.(e,{_tag:`SendDropped`,owner:i.name,issued:{seq:n,index:r}});else return ff(e,`send`,Error(e.path+` sent to `+i.name+`, `+_f(e,i)))}},jf,Mf=e=>{jf=e},Nf=(e,t)=>Error(`${e}: two Subscriptions share the key ${t}. A key runs one Stream, so give each its own name or deps.`),Pf=e=>typeof e==`string`?JSON.stringify(e):Object.is(e,-0)?`-0`:String(e),Ff=e=>e.replaceAll(`:`,`::`),If=(e,t)=>t===void 0?Ff(e):`${Ff(e)}:${(Array.isArray(t)?t:[t]).map(Pf).join(`,`)}`,Lf=Fr(2,(e,t)=>{let n=e;for(let r of Reflect.ownKeys(t)){let i=t[r],a=e[r],o=typeof i==`function`?i(a):i;Object.is(o,a)||(n===e&&(n={...e}),n[r]=o)}return n}),Rf=`~@effect/ui/Component`,zf=`~@effect/ui/Component/Step`,Bf={[zf]:zf,pipe(){return Ur(this,arguments)},set(e){return Uf(this,{model:e})},evolve(e){return Uf(this,{model:Lf(this.model,e)})},run(...e){return Uf(this,{commands:[...this.commands,...e]})},emit(...e){return Uf(this,{emitted:[...this.emitted,...e]})},loadMore(e){return Uf(this,{lists:[...this.lists,{name:e,op:`loadMore`}]})},reset(e){return Uf(this,{lists:[...this.lists,{name:e,op:`reset`}]})},send(e,t){return Uf(this,{sends:[...this.sends,{owner:e,message:t}]})},viewTransition(e=[]){return Uf(this,{viewTransitionTypes:Vf(this.viewTransitionTypes,e)})}},Vf=(e,t)=>e===void 0?t:t===void 0?e:[...new Set([...e,...t])],Hf=(e,t,n,r,i,a)=>Object.assign(Object.create(Bf),{model:e,commands:t,emitted:n,lists:r,sends:i,viewTransitionTypes:a}),Uf=(e,t)=>Object.assign(Hf(e.model,e.commands,e.emitted,e.lists,e.sends,e.viewTransitionTypes),t),Wf={...Bf,send(e,t){return Bf.send.call(this,e===`self`?this[`~self`]:e,t)},combine(...e){let t=this[`~message`],n=this.model,r=[...this.commands],i=[...this.emitted],a=[...this.lists],o=[...this.sends],s=this.viewTransitionTypes;for(let c of e){let e=Zf(c(Gf(n,this.props,this.queries,this.reads,t,this[`~self`]),t));n=e.model,r.push(...e.commands),i.push(...e.events),e.lists!==void 0&&a.push(...e.lists),e.sends!==void 0&&o.push(...e.sends),s=Vf(s,e.viewTransition)}return Hf(n,r,i,a,o,s)}},Gf=(e,t,n,r,i,a)=>Object.assign(Object.create(Wf),{model:e,commands:Yf,emitted:Yf,lists:Yf,sends:Yf,viewTransitionTypes:void 0,props:t,queries:n,reads:r,"~message":i,"~self":a}),Kf=e=>typeof e==`function`?e:(t,n)=>e[n._tag](t,n),qf=e=>Hf(e,Yf,Yf,Yf,Yf,void 0),Jf=e=>({props:e,set:qf}),Yf=Object.freeze([]),Xf=e=>$n(e,zf),Zf=e=>Xf(e)?{model:e.model,commands:e.commands,events:e.emitted,lists:e.lists,sends:e.sends,viewTransition:e.viewTransitionTypes}:{model:e,commands:Yf,events:Yf},Qf=`~@effect/ui/Component/Headless`,$f=e=>$n(e,Rf),ep=Object.assign(Object.create(Function.prototype),{[Rf]:{_Props:e=>e,_Events:e=>e,_R:e=>e,_Sl:e=>e},pipe(){return Ur(this,arguments)},"~sync"(e,t,n){this[`~queries`]===void 0?this.subscriptions!==void 0&&jf?.(e):zl.run.sync(e,t),(tp(this)||t?.sends?.length)&&Sf(e,t,n)},"~first"(e){tp(this)&&yf(e),this[`~queries`]!==void 0&&zl.run.first(e),this.head,this.elements?.head!==void 0&&Qu(e)},"~kept":Sd}),tp=({definition:e})=>e.shares!==void 0||e.reads!==void 0,np=Object.assign(Object.create(Function.prototype),{[Qf]:{_Props:e=>e,_Events:e=>e,_Parts:e=>e,_R:e=>e,_Rcv:e=>e,_Sh:e=>e,_SV:e=>e,_Rp:e=>e},pipe:ep.pipe,"~sync":ep[`~sync`],"~render":wf,"~first":ep[`~first`],"~kept":Sd,"~owned":Zd,"~content"(e,t,n,r,i,a,o){return Yo(zo(this.parts(e,t,{owner:o,running:n,queries:r,shared:a}),o.at.v.view,Qd))}}),rp=(e,t)=>{let n=e===ep,r=(e,t)=>Po(r,t,n?e[`~alive`]:void 0);Object.setPrototypeOf(r,e);for(let e of Object.keys(t))Object.defineProperty(r,e,{value:t[e],enumerable:!0,writable:!0,configurable:!0});return r},ip=e=>{let t=e.shares,n={name:e.name,props:e.props??Y({}),model:e.model,message:e.message,events:e.events??zn,receives:ap(e.message,typeof t==`object`?t.receives??[]:[]),queries:e.queries,elements:e.elements,slots:e.slots??[],reads:e.reads,shares:typeof t==`function`?t:t?.value,sharesSchema:typeof t==`function`?void 0:t?.schema,collects:t!==void 0&&typeof t!=`function`&&`collects`in t?t.collects:void 0,restore:e.restore,init:e=>e,update:(...e)=>{let t=Kf(e[e.length-1]);return(e,n)=>t(Gf(e.model,e.props,e.queries,e.reads,n,e[`~self`]),n)},subscriptions:e=>e,view:e=>e,fragment:e=>e,make:e=>sp(n,e)};return cf(n),n},ap=(e,t)=>t.length===0?zn:e.check(Yt(e=>$n(e,`_tag`)&&t.includes(e._tag),{expected:`a message with one of the tags ${t.join(`, `)}`})),op=(e,t)=>{if(t!==void 0&&!(typeof t==`object`&&t&&Object.keys(t).length===0))throw Error(`${e}: queries must be a record of { query, args } or { queryMany, args } entries.`)},sp=(e,t)=>{let n=op(e.name,e.queries),r=(e,t,r)=>n===void 0?{}:n.context(e,t,r).queries,i=Kf(t.update),a=t.subscriptions,o=t.head,s=e.elements,c=t.view,l=t.parts??(c===void 0?()=>({}):void 0);if(l!==void 0&&e.slots.length>0)throw Error(`${e.name} declares slots, so it needs a view to place them and can't take parts`);let u={};for(let t of e.slots)u[t]={_tag:`Outlet`,name:t};if(e.shares!==void 0&&c!==void 0)throw Error(`${e.name}: only a headless component can share state, so finish it without view`);let d=[],f={},p=rp(c===void 0?np:ep,{definition:e,props:e.props,model:e.model,message:e.message,events:e.events,receives:e.receives,init:e=>Zf(t.init(Jf(e))),update:(t,n,a,o,s)=>Zf(i(Gf(t,a,r(t,a,o),s===void 0?f:typeof s==`function`?af(e.name,d,s):s,n,p),n)),view:c===void 0?void 0:zs((t,r,i,a,o,l,f)=>{let p=Vs(r,s,i,o??`/`+e.name,f);if(e.slots.length>0&&(p.slots=u),n!==void 0){let e=n.context(t,r,a);p.queries=e.queries,p.previous=e.previous,p.patched=e.patched}d.length>0&&(p.reads=af(e.name,d,l));let m=f?.lazy;m?.begin();try{let e=Yo(c(p,t));return m?.end(),e}catch(e){throw f!==void 0&&(f.lazy=void 0),e}}),parts:l===void 0?void 0:(t,r,i)=>{let a=i.owner,o={props:r,isRunning:(e,t)=>i.running!==void 0&&i.running(Hu(e),Uu(e,t)),id:(e,t)=>Ts(a.path,e,t),part:(...e)=>typeof e[0]==`function`?_s(a,void 0,e[0]):_s(a,typeof e[0]==`string`?[e[0]]:e[0],e[1]),child:(e,t)=>Ro(a,e,t)};if(n!==void 0){let e=n.context(t,r,i.queries);o.queries=e.queries,o.previous=e.previous,o.patched=e.patched}return d.length>0&&(o.reads=af(e.name,d,i.shared)),l(o,t)},subscriptions:a===void 0?void 0:(e,t,n)=>a({model:e,props:t,queries:r(e,t,n)}).filter(e=>!!e),head:o===void 0?void 0:(e,t,n)=>o({model:e,props:t,queries:r(e,t,n)}),elements:s,layer:void 0,layerKeys:void 0,layerFailure:void 0,sharedLayer:void 0,layerOnServer:!0,"~queries":n});return d=nf(e,p),f=sf(e.name,d),p},cp=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&!n(e)&&`key`in e,lp=Pi,up=e=>Array.isArray(e)?lp(...e):e,dp=(...e)=>{let t=(e,t,n)=>{let r=e.layerKeys,i,a,o=r;if(cp(t)){let e=r?.length??0,n=t.layer;a=(t,r)=>n(r[e]),o=[...r??[],t.key]}else if(typeof t==`function`){let e=t;a=t=>e(t)}else{let e=up(t);i=e,a=()=>e}let s=e.layer,c=e.layerFailure??n?.onFailure,l=i!==void 0&&n?.local!==!0&&(s===void 0||e.sharedLayer!==void 0)?e.sharedLayer===void 0?i:$r(e.sharedLayer,i):void 0;return rp(ep,{...e,layer:s===void 0?a:(e,t)=>$r(s(e,t),a(e,t)),layerKeys:o,layerFailure:c,sharedLayer:l,layerOnServer:e.layerOnServer&&n?.server!==!1,boot:Kd,"~render":o===void 0?void 0:qd})};return $f(e[0])?t(e[0],e[1],e[2]):n=>t(n,e[0],e[1])},fp={enabled:!1,record:()=>{}},pp=ro(`@effect/ui/MessageLog`,{defaultValue:()=>fp}),mp=e=>e(),hp={record:()=>void 0,step:mp,session:mp,follow:()=>mp,tree:()=>{},numberOf:()=>void 0},gp=e=>e._tag===`Declaration`&&e.annotations?.representation?.id===`effect/schema/Redacted`,_p=ji(e=>{let t=new Set,n=e=>{if(t.has(e))return!1;if(t.add(e),gp(e)||e.encoding?.some(e=>n(e.to)))return!0;switch(e._tag){case`Objects`:return e.propertySignatures.some(e=>n(e.type))||e.indexSignatures.some(e=>n(e.parameter)||n(e.type));case`Arrays`:return e.elements.some(n)||e.rest.some(n);case`Union`:return e.types.some(n);case`Suspend`:return n(e.thunk());case`Declaration`:return e.typeParameters.some(n);default:return!1}};return n(e)}),vp=e=>({latest:e,closed:!1,published:0,readers:new Set,order:new Set}),yp=(e,t)=>{e.latest=t;let n=++e.published;for(let n of e.readers)n.resume===void 0&&(e.order.delete(n),n.behind?n.unread[n.unread.length-1]=t:(n.behind=!0,n.unread.push(t)));for(let r of e.order){let e=r.resume;e===void 0||r.since>=n||(r.resume=void 0,e(rn(t)))}},bp=l(),xp=e=>{e.closed=!0;for(let t of Array.from(e.readers).reverse())t.resume?.(bp);e.readers.clear(),e.order.clear()},Sp=(e,t)=>{let n=t.concat(e.unread);return e.unread=[],e.behind=!1,n},Cp=e=>Ir(Zt((t,n)=>{let r={unread:[e.latest],behind:!1,resume:void 0,since:0};e.closed||e.readers.add(r);let i=A(()=>e.closed?bp:r.unread.length>0?rn(Sp(r,[])):Gn(pr(t=>(r.resume=t,r.since=e.published,e.order.add(r),P(()=>{r.resume=void 0}))),t=>e.closed?bp:rn(Sp(r,[t]))));return Gi(lr(n,P(()=>{e.readers.delete(r),e.order.delete(r)})),i)})),wp=class{rec;mount;args=void 0;fiber=void 0;cut=void 0;ctx=void 0;scope=Ar(`sequential`);constructor(e,t){this.rec=e,this.mount=t}start(e){let t=this.rec.inst,n=t.env,r=n.ctx;if(r===void 0){if(n.cause===void 0){n.waiting.push(()=>n.cause===void 0&&this.start(e));return}r=Mo(n)}if(this.cut!==void 0||t.closed)return;let i=t.tree,{args:a,argsSchema:o,name:s}=this.mount,c=e(()=>i.log?.(t,{_tag:`MountStarted`,name:s,args:a,argsSchema:o})),l,u=e=>P(()=>{let n=this.mount,r=n.resolve(e),a=Rl(r);if(l=a&&l!==!1,a||this.cut!==void 0)return;let o={_tag:`Mount`,seq:c,name:n.name,args:n.args,argsSchema:n.argsSchema};Oo(i)(()=>Nc(t,r,o))}),d=po(()=>{let e=this.mount[`~args`],t=this.args;if(t===void 0){let n=t=this.args=e.make(this.mount.args);yo(lr(this.scope,P(()=>e.close(n))))}return e.changes(t)}),f=this.scope;this.ctx=r;let p=this.fiber=ko(i,C(C(r,ga,f),uu,ru(t)),A(()=>this.mount.run(this.rec.node,a,d,u)),!0);yo(lr(f,bo(p))),p.addObserver(e=>{let n=Vn(e)&&!Ft(e.cause)?e.cause:void 0,r=n===void 0?this.cut===void 0&&Ba(e)?`completed`:`closed`:`failed`;(r===`closed`&&this.cut!==void 0?this.cut:Oo(i))(()=>{i.log?.(t,{_tag:`MountEnded`,name:s,started:c,reason:r,silent:l===!0}),n!==void 0&&Q(t,`mount`,n,void 0,void 0,s)})})}update(e){let t=this.mount;t!==e&&(this.mount=e,this.args!==void 0&&!t[`~sameArgs`](e)&&e[`~args`].publish(this.args,e.args))}stop(){if(this.cut!==void 0)return;let e=this.rec.inst.tree;this.cut=Oo(e);let t=e.closed?Rt():void 0;t!==void 0&&this.fiber?.interruptUnsafe(t.id);let n=vi(this.scope,nr);this.ctx===void 0?yo(n):ko(e,this.ctx,n,!0)}},Tp=new WeakMap,Ep=(e,t)=>{let n=t.inst.tree;if(n.host.runsMounts!==!0){n.host.inert===!0&&eu(n,()=>Dp(e,t));return}let r=Tp.get(t);if(r!==void 0&&r.mount.name===e.name)return r.update(e);r?.stop();let i=new wp(t,e);Tp.set(t,i);let a=Oo(n);eu(n,()=>i.start(a))},Dp=(e,t)=>{let n=t.inst;if(!n.closed){if(e.paint!==void 0)try{return e.paint(t.node,e.args)}catch{}n.tree.host.skipped?.(n.path)}},Op=e=>{let t=Tp.get(e);t!==void 0&&(Tp.delete(e),t.stop())},kp=`~@effect/ui/Mount`,Ap=`~@effect/ui/Mount/Definition`,jp=e=>e,Mp={[kp]:{_Msg:jp,_R:jp,_Node:jp,_Source:jp},"~args":{make:vp,publish:yp,close:xp,changes:Cp},"~sameArgs"(e){return Ip(this,e)},"~attach"(e){Ep(this,e)},"~detach"(e){Op(e)},pipe(){return Ur(this,arguments)}},Np=e=>Object.assign(Object.create(Mp),e),Pp=(e,t,n)=>Fp(e,t,!0,(e,t,r,i)=>Ga(n(e,t,r),i)),Fp=(e,t,n,r)=>{let i=S(t.args)?t.args:Y(t.args),a=(a={})=>Np({name:e,args:a,argsSchema:i,stream:n,run:r,resolve:jp,paint:t.paint});return Object.defineProperty(a,"name",{value:e}),Object.assign(a,{[Ap]:Ap,args:i})},Ip=(e,t)=>e.name===t.name?e.args===t.args||u(e.argsSchema)(e.args,t.args):!1,Lp=new WeakMap,Rp=e=>{let t=Lp.get(e);if(t===void 0){let n=ht(e);t={encode:ge(n),decode:St(n)},Lp.set(e,t)}return t},zp=new WeakMap,Bp=new It({message:`the Schema holds a Schema.Redacted`}),Vp=Hr(Bp),Hp={redacted:!0,encode:()=>Vp,decode:()=>Vp},Up=e=>{let t=zp.get(e);if(t===void 0){let n=e.model,r=Bl(e);if(_p(n.ast)||r!==void 0&&_p(r.schema.ast))t=Hp;else if(r===void 0){let e=Rp(n);t={redacted:!1,encode:t=>e.encode(t),decode:t=>hi(e.decode(t),e=>({model:e,results:void 0}))}}else{let e=Rp(Y({model:n,queries:r.schema}));t={redacted:!1,encode:(t,n)=>e.encode({model:t,queries:n??r.empty}),decode:t=>hi(e.decode(t),e=>({model:e.model,results:e.queries}))}}zp.set(e,t)}return t},Wp=(e,t,n,r)=>{let i=Up(e).encode(t,n),a=r?.collected;if(a===void 0)return hi(i,e=>({state:e,reported:void 0}));let o=e.definition.message,s=_p(o.ast)?Vp:Rp(o).encode(a.message);return Wa(i,e=>hi(s,t=>({state:e,reported:t})))},Gp=(e,t,n)=>{if(t===void 0||e.definition.collects===void 0)return;let r=y(Rp(e.definition.message).decode(t));return r._tag===`Success`?{collected:{message:r.value},held:n}:void 0},Kp=e=>{let t=y(e);if(Vn(t)){let e=it(t.cause);if(Wi(e)&&g(e.success))return e.success.fiber}return t},qp=new WeakMap,Jp=(e,t,n,r)=>{let i=t.component,a=qp.get(i);a===void 0&&qp.set(i,a=new Set),a.has(e)||(a.add(e),Lt(n)(E(`${i.definition.name}: ${r()}`)))},Yp=_o(),Xp=e=>{let t=lt(e);return ke(t)&&t.value===Bp},Zp=e=>J(lt(e),{onNone:()=>De(e),onSome:Yp}),Qp=(e,t,n)=>{Xp(n)||Jp(`unencoded`,e,t,()=>`its state doesn't encode as JSON, so the server sends no state for it and the client builds it and everything under it fresh, without hydration, and history doesn't restore it. `+Zp(n))},$p=new WeakMap,em=e=>{e.detach?.(),e.fiber?.interruptUnsafe(Rt()?.id)},tm=e=>{if(e.closed||e.tree.host.inert)return;let t=e.tree.host.server;if(t!==void 0&&(e.parent!==void 0||nm.has(e.tree)))return;let n;try{n=e.component.subscriptions(e.model,e.props,e.results)}catch(n){if(t!==void 0)throw n;return Q(e,`subscription`,K(n))}let r=new Map,i;for(let t of n){let n=t[du];if(n!==void 0){if(i!==void 0)return Q(e,`subscription`,K(Error(`${e.path}: subscriptions returned Router.prefetch twice. An instance declares its routes' reads in one map.`)),void 0,void 0,`@effect/ui/Router/prefetch`);i=n}else{if(r.has(t.key))return Q(e,`subscription`,K(Nf(e.path,t.key)),void 0,void 0,t.key);r.set(t.key,t)}}if(t!==void 0)return rm(e,t,r);B(Mo(e.env),pu)()?.declare?.(e,i);let a=$p.get(e);if(a===void 0){if(r.size===0)return;let t=a=new Map;$p.set(e,t),(e.closers??=[]).push(()=>{let n=[];im(t,n),wo(e,n)}),(e.swaps??=[]).push(n=>{for(let[n,r]of t)e.tree.log?.(e,{_tag:`SubscriptionStopped`,key:n,name:r.name,deps:r.deps});im(t,n)})}let o=e.tree.log;for(let[t,n]of a)r.has(t)||(a.delete(t),o?.(e,{_tag:`SubscriptionStopped`,key:t,name:n.name,deps:n.deps}),em(n),n.fiber!==void 0&&So(n.fiber)&&wo(e,[n.fiber]));for(let[t,n]of r){let r=a.get(t);if(r!==void 0){r.latest=n;continue}let{deps:i,name:s}=n,c={name:s,deps:i,latest:n,fiber:void 0,detach:void 0};a.set(t,c),o?.(e,{_tag:`SubscriptionStarted`,key:t,name:s,deps:i}),am(e,a,t,c)}},nm=new WeakSet,rm=(e,t,n)=>{nm.add(e.tree);for(let r of n.values()){let n=r[mu];if(n===void 0)continue;let i=e.env,a=()=>i.ctx!==void 0&&n(i.ctx,t.report);i.cause===void 0&&i.ctx===void 0?i.waiting.push(a):a()}},im=(e,t)=>{for(let n of e.values())em(n),n.fiber!==void 0&&So(n.fiber)&&t.push(n.fiber);e.clear()},am=(e,t,n,r)=>{let i=()=>!e.closed&&t.get(n)===r,a=()=>am(e,t,n,r);if(!i()||e.hold?.(a))return;let o=e.env,s=o.ctx;if(s===void 0){if(o.cause===void 0){o.waiting.push(()=>o.ctx!==void 0&&a());return}if(s=e.hold===void 0?Mo(o):void 0,s===void 0)return}let c=e.tree,l=r.latest,u={_tag:`Subscription`,key:n,name:r.name,deps:r.deps},d=Ar(`sequential`),f=C(s,ga,d),p=t=>Oo(c)(()=>{zc(e),i()&&t(r.latest)}),m=(t,n)=>p(()=>{n?.(),Nc(e,t,u)}),h=t=>Oo(c)(()=>Q(e,`subscription`,t,void 0,void 0,n)),g=l[hu]?.(f,(e,t)=>{i()&&m(e,t)},e=>{i()&&h(e)},p);r.detach=g?.close;let _=ko(c,f,wt(g===void 0?Ga(l.stream,e=>P(()=>m(e))):g.initial,e=>vi(d,e)));r.fiber=_,_.addObserver(e=>{Vn(e)&&!Ft(e.cause)&&i()&&h(e.cause)})};Mf(tm);var om=`~@effect/ui/Subscription`,sm=If,cm=(e,t,n)=>n===void 0?{[om]:om,key:sm(e),name:e,deps:void 0,stream:t}:{[om]:om,key:sm(e,t),name:e,deps:Array.isArray(t)?t:[t],stream:po(()=>n(t))},lm=new WeakMap,um=class{tree;start;types=void 0;holding=!1;starting=!1;waiting=[];constructor(e,t){this.tree=e,this.start=t}request(e){if(this.holding)return;let t=this.types??=new Set;for(let n of e)t.add(n)}waits(e){if(!this.holding&&this.types===void 0)return!1;for(let t=e.parent;t!==void 0;t=t.parent)if(t.dirty)return!0;return!1}wait(e){this.waiting.push(e)}hold(){let e=this.types;return e!==void 0&&(this.types=void 0,this.holding=this.starting=!0,this.start(()=>this.resume(),[...e]),this.starting=!1,this.holding)}settle(){this.types=void 0,this.resume()}resume(){if(!this.holding)return;this.holding=!1;let e=this.tree;if(e.closed)return;let t=this.waiting;this.waiting=[];for(let n=0;n<t.length;n++)Fl(e,t[n]);this.starting||Hc(e)}},dm=e=>t=>new um(t,e),fm=[],pm={_tag:`Ignored`,reason:`unchanged`},mm={title:void 0},hm=0,gm=e=>(t,n,r)=>{Lt(e)(fe(`${t} failed in ${n}`,r))},_m=(e,t,n,r)=>{let i,a=()=>(i===void 0&&(i=zl.buildCache(e,{visibility:B(e,ql),connectivity:B(e,Jl),report:B(e,Yl),idleTimeToLive:t?.query?.idleTimeToLive,settleOnce:n!==void 0,fetches:n===void 0||n.fetches}),r(i.cache)),i.cache);return{cell:{[Vl]:Vl,[Hl]:a},cache:()=>void 0,made:()=>i?.cache,dispose:A(()=>i?.dispose??wr)}},vm=e=>e.state._tag===`Closed`,ym=(e,t)=>Xt(e)?Gn(e,t):t(e),bm=(e,t)=>({elements:t,make:(t,n,r)=>{let i=e(t,{head:n,step:r});return{base:i,dom:i}}}),xm=(e,t,n,r,i)=>ym(t,t=>{let a=`/`+e.definition.name,o=o=>Rn(xr(s=>{let c=B(s,ga);if(vm(c))return Za;let l,u=!1,d;Cd(c,{},()=>{let e=A(()=>l?.close??wr);return A(()=>u?e:Gn(pr(e=>{u?e(wr):(d??=[]).push(()=>e(wr))}),()=>e))});try{l=Cm(e,t,n,s,i,r(s),void 0,o&&[a,o])}finally{if(u=!0,d!==void 0)for(let e of d)e()}return vm(c)?Za:rn(l.root)})),s=i?.hydrate;return s===void 0?o(void 0):s.decode(e,a,o)}),Sm=(e,t,n,r,i,a)=>xm(e,t,n,()=>bm(r,i),a),Cm=(e,t,n,r,i,a,o,s)=>{let c=Em(r,i?.scheduler);B(c,pp);let l=B(c,Eo),u=B(c,ie),d=`${u.currentTimeMillisUnsafe().toString(36)}-k${(hm++).toString(36)}`,f=i?.recordEmitted===!0?[]:void 0,p=0,m=!0,h=()=>m?p:p+1,g=hp,_,v=i?.hydrate,y=i?.hot,b=(e,t)=>{if(_!==void 0&&t._tag===`Mounted`&&(t={...t,commands:_},_=void 0),E!==void 0){let n=E.record(e,t);if(!(`_tag`in n))return n.seq;t=n}f!==void 0&&e.parent===void 0&&(t._tag===`Update`||t._tag===`Mounted`)&&f.push(...t.events),t._tag===`Mounted`&&(D?.restored(e)===!0||y?.restored(e)===!0)&&(t={...t,adopted:!0});let n=g.record(e,t);return e===x&&ee===void 0&&(t._tag===`Update`||t._tag===`Failed`)&&(ee={_tag:t._tag===`Update`?`Updated`:`Failed`,seq:n??-1}),n},x,ee,te=(e,t)=>{let n=e.closed?`closed`:E?.isWaiting(e)===!0?`waiting`:ue?`frozen`:void 0;if(n!==void 0)return{_tag:`Ignored`,reason:n};x=e,ee=void 0;try{g.step(()=>Nc(e,t))}finally{x=void 0}return ee??pm},S=oe(c,fu),w=e=>{let t=0;for(let n of fe?.instance.tree.building??[])n.flush>=e&&t++;return t},ne=i?.head!==!1,{base:re,dom:T}=a.make(n,ne,g.step),ae=new Set,E,D=S?.kernel?.(S,{path:`/`+e.definition.name,container:n,context:c,flush:()=>p,since:h,buildsPendingSince:w,hydrated:()=>fe!==void 0&&E?.adopts(fe.instance)===!0,static:v?.static===!0,navigated:()=>{E?.closeWindow(),y?.clear()}}),se={...re,hold:y===void 0?D?.hold:(e,t,n,r)=>y.hold(e,t,n,r)??D?.hold(e,t,n,r)??!1,commit:()=>{re.commit?.(),E?.commit(),D?.flushed(),y?.flushed(w),ce?.check()},server:o?.hooks(c,b,ae)};E=v?.open({path:`/`+e.definition.name,container:n,bridged:se,base:re,dom:T!==void 0,record:g.record,at:u.currentTimeMillisUnsafe(),decodedRoot:s,heldFor:D?.heldFor,cache:()=>de.made()});let ce=o?.idle(l,()=>fe?.instance,()=>de.made()),le=i?.fallback,ue=!1,de=_m(c,i,o,e=>{e.onFetch(e=>{ue||g.tree({_tag:`FetchStarted`,...e})}),ce!==void 0&&e.onFetchEnd(ce.check),E?.onCache(e)});E?.hasQuery&&de.cache();let fe;fe=g.session(()=>Ml(e,t,n,se,{context:C(C(c,Ul,de.cell),pu,()=>D?.handle),init:e=>{let t=e.component,n=t.elements;if(n!==void 0&&a.elements!==`any`&&!a.elements.includes(n.name))throw Error(`${t.definition.name} renders ${n.name} elements, and this host shows ${a.elements.join(`, `)}`);let r=e.component.init(e.props),i=E?.init(e,r)??y?.init(e,r);return i===void 0?o!==void 0&&r.commands.length>0?(_=r.commands,{model:r.model,commands:fm,events:r.events,lists:r.lists,sends:r.sends,viewTransition:r.viewTransition}):D===void 0?r:D.init(e,r):D===void 0?i:D.init(e,i,!0)},log:b,schedule:e=>{let t=g.follow();l.schedule(()=>{p++,m=!0;try{t(e)}finally{m=!1}})},follow:g.follow,report:gm(c),fallback:le===void 0?void 0:t=>Yo(le(bn(t),Vs({},e.elements)))})),m=!1,E?.end();let pe=fe,me=pe.instance,O=me.tree;D!==void 0&&(D.attach(me),D.flushed()),y!==void 0&&(y.attach(me),y.flushed(w)),O.flush=h;let he=()=>O.head?.value??e.elements?.head?.merge({entries:[],children:[]})??mm,ge={path:me.path,session:d,instance:me,emitted:f??fm,model:()=>me.failure===void 0?me.model:void 0,send:e=>g.step(()=>pe.send(e)),find:e=>wm(me,e,g.numberOf),dispatch:(e,t)=>pr(n=>{let r=e,i=()=>n(rn(te(r,t)));O.transitions?.waits(r)?O.transitions.wait(i):i()}),get cache(){return de.cache()??{pending:()=>[]}},crashed:()=>me.failure,flush:()=>p,buildsPendingSince:w,head:he,adoptionHead:()=>E===void 0?he():E.adoptionHead(),adopted:E===void 0?wr:E.adopted,waiting:()=>E===void 0?fm:E.waiting(),freeze:()=>(ue||=(O.transitions?.settle(),!O.closed&&(O.scheduled||O.dirty.length>0)&&Hc(O),O.closed=!0),de.made())};E?.finish(ge.head);let _e=A(()=>O.owned===void 0||O.owned.size===0?wr:G(tt([...O.owned]),_e));return{root:ge,deferred:ae,idle:ce,close:A(()=>(E?.close(),D?.detach(),y?.detach(),T?.dispose(),ue&&(O.closed=!1),pe.close(),G(_e,de.dispose)))}},wm=(e,t,n)=>{if(e.closed)return;if(n(e)===t)return e;let r=e.rendered===void 0?void 0:Tm(e.rendered,t,n);if(r!==void 0)return r;for(let r of e.kept?.children()??[]){let e=wm(r.inst,t,n);if(e!==void 0)return e}},Tm=(e,t,n)=>{if(e.v._tag===`Child`&&e.inst.at===e)return wm(e.inst,t,n);let r=e.kids;if(r!==void 0)for(let e of r){let r=Tm(e,t,n);if(r!==void 0)return r}},Em=(e,t=B(e,Bt))=>{let n;return C(e,Bt,B(e,Eo).scheduler??{executionMode:t.executionMode,shouldYield:e=>t.shouldYield(e),makeDispatcher:()=>n??=t.makeDispatcher()})},Dm={request:()=>{},waits:()=>!0,wait:()=>{},hold:()=>!1,settle:()=>{}},Om=(e,t,n,r,i)=>xr(a=>{let o=Em(a),s=B(o,Eo),c=[],l=new Set,u,{base:d,dom:f}=i(o).make(n,!1,hp.step),p=()=>{m.close(),f?.dispose()},m=Ml(e,t,n,{...d,setEvents:()=>{},transitions:()=>Dm,inert:!0,skipped:e=>l.add(e)},{context:o,init:e=>{let t;try{t=r(e.path)}catch(e){throw u={error:e},e}return t===void 0?(c.push(e.path),t=e.component.init(e.props)):(Object.hasOwn(t,`props`)&&(e.props=t.props),e.results=t.queries),{model:t.model,commands:fm,events:fm}},schedule:e=>s.schedule(e),report:gm(o)});if(u!==void 0)return p(),$i(u.error);let h=new Set;return Am(m.instance,h),Gi(lr(B(o,ga),P(p)),{fellBack:c,fallbacks:Array.from(h),skipped:Array.from(l)})}),km=(e,t,n,r,i,a)=>Om(e,t,n,r,()=>bm(i,a)),Am=(e,t)=>{!e.closed&&e.rendered!==void 0&&jm(e.rendered,t)},jm=(e,t)=>{if(e.v._tag===`Child`){if(e.inst.at===e)return Am(e.inst,t);t.add(e.inst.path)}let n=e.kids;if(n!==void 0)for(let e of n)jm(e,t)},Mm=lu,Nm=`~@effect/ui/Route`,Pm=e=>{if(!e.startsWith(`/`))throw Error(`Route template "${e}" must start with "/"`);let t=e===`/`?[]:e.replace(/\/$/,``).slice(1).split(`/`);return t.map((n,r)=>{if(n===`*`){if(r!==t.length-1)throw Error(`Route template "${e}": "*" must be the last segment`);return{_tag:`Rest`}}if(n.startsWith(`:`)){if(n.length===1)throw Error(`Route template "${e}": a param needs a name`);return{_tag:`Param`,name:n.slice(1)}}return{_tag:`Static`,value:n}})},Fm=(e,...[t])=>{let n=t?.params??{};for(let t of Pm(e))if(t._tag===`Param`&&!(t.name in n))throw Error(`Route "${e}" has no Schema for its :${t.name} param`);return{[Nm]:Nm,path:e,params:n,search:t?.search??{}}},Im=e=>{try{return decodeURIComponent(e)}catch{return}},Lm=e=>{let t=Object.create(null);if(e===``)return t;for(let n of e.split(`&`)){if(n===``)continue;let e=n.indexOf(`=`),r=Im((e<0?n:n.slice(0,e)).replaceAll(`+`,` `)),i=Im((e<0?``:n.slice(e+1)).replaceAll(`+`,` `));if(r===void 0||i===void 0)return;let a=Object.hasOwn(t,r)?t[r]:void 0;t[r]=a===void 0?i:typeof a==`string`?[a,i]:[...a,i]}return t},Rm=e=>{if(typeof e!=`object`||!e)return``;let t=[];for(let[n,r]of Object.entries(e))for(let e of Array.isArray(r)?r:[r])typeof e==`string`&&t.push(`${encodeURIComponent(n)}=${encodeURIComponent(e)}`);return t.length===0?``:`?${t.join(`&`)}`},zm=e=>{if(e===``||e===`/`)return``;if(e.startsWith(`#`))return`#`;let t=e.startsWith(`/`)?e:`/${e}`;return t.endsWith(`/`)?t.slice(0,-1):t},Bm=e=>e.map(e=>e._tag===`Static`?0:e._tag===`Param`?1:2),Vm=(e,t)=>{let n=Math.max(e.rank.length,t.rank.length);for(let r=0;r<n;r++){let n=e.rank[r]??-1,i=t.rank[r]??-1;if(n!==i)return n-i}return e.order-t.order},Hm=(e,t)=>{let n={};for(let r=0;r<e.length;r++){let i=e[r];if(i._tag===`Rest`)return n[`*`]=t.slice(r).join(`/`),n;let a=t[r];if(a===void 0)return;if(i._tag===`Static`){if(a!==i.value)return}else{if(a===``)return;n[i.name]=a}}return t.length===e.length?n:void 0},Um=e=>Oi(e)({}),Wm=(e,t)=>{if(t.ast.context?.constructorDefault!==void 0)return t;let n=Um(Y({[e]:t}));if(un(n)||!Object.hasOwn(n.value,e))return t;let r=n.value[e];return t.pipe(F(rn(r)))},Gm=e=>{let t=Y(Object.fromEntries(Object.entries(e).map(([e,t])=>[e,Wm(e,t)]))),n=t.makeOption({});return ke(n)?t.pipe(F(rn(n.value))):t},Km=e=>e.path.endsWith(`*`)?{...e.params,"*":q}:e.params,qm=(e,t)=>{let n=pi(Y({[e]:t})),r=Um(n),i;if(ke(r)&&Object.hasOwn(r.value,e))try{i=Br(n)(r.value)[e]}catch{}return{key:e,decode:Oi(n),omit:i}},Jm=(e,t)=>e===t||Array.isArray(e)&&Array.isArray(t)&&e.length===t.length&&e.every((e,n)=>e===t[n]),Ym=(e,t)=>{let n=[],r=[];for(let i of e){let e=Object.hasOwn(t,i.key)?t[i.key]:void 0,a=i.decode(e===void 0?{}:{[i.key]:e});if(un(a)&&typeof e==`string`&&(a=i.decode({[i.key]:[e]})),un(a)&&e!==void 0&&(a=i.decode({}),r.push(i.key)),un(a))return M();n.push(...Object.entries(a.value))}return V({value:Object.fromEntries(n),invalid:r})},Xm=(e,t)=>{let n=e[t._tag];if(n===void 0)throw Error(`No route for ${t._tag}`);return n},Zm=(e,t,n)=>{let r={},i=[],a={},o={},s,c=0;for(let[t,l]of Object.entries(e)){let e=Km(l);r[t]={params:Gm(e),search:Gm(l.search)};let u=Pm(l.path);l.path===`/*`&&s===void 0&&(s=t);let d=pi(Y(e)),f=pi(Y(l.search)),p=Object.entries(l.search).map(([e,t])=>qm(e,t));i.push({segments:u,rank:Bm(u),order:c++,route:{tag:t,decodeParams:Oi(d),decodeSearch:e=>Ym(p,e)},redirect:void 0});let m=Br(d),h=Br(f);a[t]=e=>{let t=m(e.params??{}),r=u.map(e=>e._tag===`Static`?e.value:e._tag===`Param`?encodeURIComponent(t[e.name]):(t[`*`]??``).split(`/`).map(encodeURIComponent).join(`/`)).filter((e,t,n)=>!(e===``&&t===n.length-1&&t>0)).join(`/`);return n.value===`#`?`#/${r}`:`${n.value}/${r}`.replace(/(.)\/$/,`$1`)},o[t]=e=>{let t=h(e.search??{});for(let e of p)e.omit!==void 0&&Jm(t[e.key],e.omit)&&delete t[e.key];return Rm(t)}}for(let e of t){let t=Pm(e.path);i.push({segments:t,rank:Bm(t),order:c++,route:void 0,redirect:e})}i.sort(Vm);let l=Xn(r),u=e=>{let t=n.value===`#`;if(t&&!e.startsWith(`#`))return M();let r=t?e.slice(1):e,a=r.indexOf(`#`),o=a<0?r:r.slice(0,a),c=o.indexOf(`?`),u=c<0?o:o.slice(0,c),d=c<0?``:o.slice(c+1),f=t?``:n.value;if(f!==``){if(u!==f&&!u.startsWith(`${f}/`))return M();u=u.slice(f.length)}u.startsWith(`/`)||(u=`/${u}`);let p=u.length>1&&u.endsWith(`/`)?u.replace(/\/+$/,``)||`/`:u,m=[];if(p!==`/`)for(let e of p.slice(1).split(`/`)){let t=Im(e);if(t===void 0)return M();m.push(t)}let h=Lm(d),g=()=>s===void 0?M():V({route:l.make({_tag:s,params:{"*":m.join(`/`)},search:{}}),redirected:!1,notFound:!0,invalid:[]});if(h===void 0)return g();for(let e of i){let t=Hm(e.segments,m);if(t===void 0)continue;if(e.redirect!==void 0){let n=e.redirect.to(t,h);return V({route:n,redirected:!0,notFound:n._tag===s,invalid:[]})}let n=e.route,r=n.decodeParams(t);if(un(r))continue;let i=n.decodeSearch(h);return un(i)?g():V({route:{_tag:n.tag,params:r.value,search:i.value.value},redirected:p!==u,notFound:n.tag===s,invalid:i.value.invalid})}return M()},d=Object.assign(l,{routes:e,resolve:u,parse:e=>N(u(e),e=>e.route),print:e=>Xm(a,e)(e)+o[e._tag](e),printPath:e=>Xm(a,e)(e),subset:t=>Zm(Object.fromEntries(t.map(t=>[t,e[t]])),[],n),base:()=>n.value,setBase:e=>{n.value=zm(e)}});for(let t of Object.keys(e)){if(t in d||t===`then`)throw Error(`Route tag "${t}" is reserved`);let e=l.cases[t].make;d[t]=t=>e(t??{})}return d},Qm=(e,...t)=>Zm(e,t,{value:``}),$m=3e4,eh=(e,t,n,r,i)=>{let a=new Map;return e({routes:()=>i.declaration.routes,run:(e,o)=>{if(r.closed||r.failure!==void 0)return;let s=n.now();for(let[e,t]of a)s-t>=$m&&a.delete(e);let c=i.declaration.routes.print(e);if(!(o&&a.has(c)))return a.set(c,s),th(t,n,r,i.declaration,e,o)}})},th=(e,t,n,r,i,a)=>{let o=n.env.ctx;if(o===void 0)return;let s=r.map[i._tag];if(s===void 0)return;let c;try{c=s(i)}catch(r){t.report(nh(e,n,`Router.prefetch ${i._tag}`,r));return}if(a){for(let r of c)rh(e,t,n,o,r);return}let l=t.since(),u=c.map(r=>rh(e,t,n,o,r)),d=t.record();return{settled:()=>{try{ih(e,t,n,u,l)}finally{d()}},dropped:d}},nh=(e,t,n,r)=>new e.PrefetchThrew({message:`${t.path}: ${n} threw while Router.prefetch walked it, so the rest of its walk was skipped`,path:t.path,page:n,error:r}),rh=(e,t,n,r,i)=>{let a=i.component,o={name:a.definition.name,entries:new Map},s=(i,a,l)=>{let u=l||i.layer!==void 0,d=i.init(a).model,f=Bl(i);if(f!==void 0){let s=f.context(d,a,void 0);for(let a of f.entries){let c=s.argsOf(a.name),l=c.entries??(c.argsKey===void 0?[]:[{args:c.args,argsKey:c.argsKey}]);if(l.length===0)continue;let d=zl.defOf(a.query),f=de(r,a.query);if(un(f))u||t.report(new e.PrefetchQueryNotProvided({message:`${n.path}: Router.prefetch skipped the query ${JSON.stringify(d.name)} of ${i.definition.name}, because the declaring component can't see it. Provide it at the declarer.`,path:n.path,page:o.name,query:d.name}));else for(let e of l)t.cache().prefetch(d,e.args,f.value),o.entries.set(t.entryKey(d.name,e.argsKey),{query:d.name,logKey:d.logKey(e.args,e.argsKey)})}}let p=e=>{switch(e._tag){case`Text`:case`Outlet`:return;case`Element`:for(let t of e.children)p(t);return;case`Child`:for(let t of Us(e))p(t);if(Ho(e.component)||e.view!==void 0)return;let t=Qs(e.component);return t===void 0?void 0:s(t,e.props,u)}};p(i.view(d,a,void 0,void 0,void 0,c))},c=e=>{for(let t=n;t!==void 0;t=t.parent)if(t.component.definition===e.definition)return t.shares;throw Error(`${e.definition.name} isn't above ${n.path}, so its shared state can't be read`)};try{s(a,i.props,!1)}catch(r){t.report(nh(e,n,a.definition.name,r))}return o},ih=(e,t,n,r,i)=>{if(t.lastFailedBuild()>i.build)return;let a=new Map;for(let e of t.recorded){if(e.closed||e.born<=i.born)continue;let t=a.get(e.component.definition.name);t===void 0?a.set(e.component.definition.name,[e]):t.push(e)}let o,s=()=>{if(o!==void 0)return o;let e=new Set,n=t=>{if(!t.closed){e.add(t.component.definition.name);for(let e of t.children)n(e)}};return n(t.root()),o=e};for(let i of r){let r=a.get(i.name);if(r===void 0){if(s().has(i.name))continue;t.report(new e.PrefetchPageNotMounted({message:`${n.path}: Router.prefetch declared the page ${i.name}, and none was mounted`,path:n.path,page:i.name}));continue}let o=new Set,c=e=>{if(e.watched!==void 0)for(let t of e.watched)o.add(t);for(let t of e.children)c(t)};for(let e of r)c(e);for(let[r,a]of i.entries)o.has(r)||t.report(new e.PrefetchEntryNotWatched({message:`${n.path}: Router.prefetch fetched ${a.logKey} for ${i.name}, and the page never watched it`,path:n.path,page:i.name,query:a.query,logKey:a.logKey}))}},ah=(e,t=[])=>{if(e===void 0)return t;let n=e.kids;if(n!==void 0)for(let e of n)ah(e,t);else e.v._tag===`Child`&&!e.inst.closed&&t.push(e.inst);return t},oh=(e,t)=>e[t]===void 0?void 0:{state:e[t],reported:e[`~reported`]?.[t]},sh=(e,t)=>{let n=Bl(e.component);if(n===void 0||t===void 0)return t;let r=zl,i=r.run.cacheOf(e),a={};for(let e of n.entries){let o=t[e.name];if(e.keyed){let t=r.snapshotMapData(o),s=[];for(let e of t?.entries.values()??[])r.snapshotData(e).patched||(i.seed(e),s.push(e));a[e.name]=t!==void 0&&s.length===t.entries.size?o:n.snapshotMany(e,s);continue}let s=r.snapshotData(o);s!==void 0&&!s.patched?(i.seed(o),a[e.name]=o):a[e.name]=n.empty[e.name]}return a},ch=e=>{let{entry:t,onAsyncEncode:n,onDecodeFailure:r,onEncodeFailure:i,onRestoreThrow:a,restore:o,rootPath:s}=e,c=new WeakSet,l=(e,t,n)=>{Ba(n)?(t[e.path]=n.value.state,n.value.reported!==void 0&&((t[`~reported`]??={})[e.path]=n.value.reported)):i?.(e,n.cause)},u=(e,t,r)=>{if(Rr(r))return l(e,t,r);n?.(e)!==!1&&r.addObserver(n=>l(e,t,n))},d=(e,t)=>{let n=e.component,r=n.definition.restore;if(r===!1)return;let i=e.model;if(r!==void 0)try{i=r(e.model,e.props)}catch(t){a?.(e,t);return}u(e,t,Kp(Wp(n,i,e.results,e.owning)))},f=(e,t,n)=>(e[e===t?`~kept`+s:`~kept`]??={})[n]??={},p=(e,t,n)=>{if(e.closed||e.failure!==void 0||(d(e,t),e.env.ctx===void 0&&e.env.cause===void 0))return;for(let r of x.values())r.owner===e&&ee(r,t,n);for(let r of ah(e.rendered))r.at.v.alive===void 0&&p(r,t,n);let r=e.kept,i=g.get(e);if(r===void 0&&i===void 0)return;let a=f(t,n,e.path);for(let e in i)a[e]=i[e];if(r!==void 0)for(let e of r.children())p(e.inst,a[e.inst.path]={},n)},m,h=()=>{S.clear();let e=t();m=e&&{...e[`~kept`+s]}},g=new WeakMap,_=new WeakMap,v=(e,t)=>{let n=t?.[e.path];n!==void 0&&(delete t[e.path],g.set(e,{...n}))},b=e=>{if(e.at?.v?.alive!==void 0){let t=g.get(e.parent),n=t?.[e.path];if(n!==void 0)return delete t[e.path],_.set(e,n),n}for(let t=e.parent;t!==void 0;t=t.parent){let e=_.get(t);if(e!==void 0)return e}},x=new Map,ee=(e,t,n)=>{let{path:r,saved:i}=e,a=e.rec.v,o=a.alive===void 0?t:f(t,n,e.owner.path)[r]={},s=i[`~reported`];for(let e in i)e!==r&&e[0]!==`~`&&(o[e]=i[e],s?.[e]!==void 0&&((o[`~reported`]??={})[e]=s[e]));for(let t in e.notes)Object.assign(f(o,n,t),e.notes[t]);let c=Qs(a.component);if(c===void 0)return;let d=c.definition.restore,p=i[r];if(p===void 0||d===!1)return;let m={state:p,reported:s?.[r]},h={path:r,component:c};if(d===void 0)return l(h,o,so(m));let g=Up(c);u(h,o,Kp(Wa(g.decode(p),e=>hi(g.encode(d(e.model,a.props),e.results),e=>({state:e,reported:m.reported})))))},te=(e,t,n,r)=>(x.set(t,{owner:e,rec:t,path:n,saved:{[n]:r.state,"~reported":{[n]:r.reported}},notes:void 0}),()=>x.delete(t)),S=new Map;return h(),{snapshot:(e,t)=>p(e,t,t),init:(e,t,n)=>{let i=e.component,a=b(e);v(e,a===void 0?m:a[`~kept`]);let s=S.get(e.path);if(S.delete(e.path),n===!0||i.definition.restore===!1)return t;let l=s===void 0?a===void 0?o(e.path):oh(a,e.path):s[0];if(l===void 0)return t;let u=s?.[1]??y(Up(i).decode(l.state));return Vn(u)?(r?.(e,u.cause),t):(c.add(e),e.results=sh(e,u.value.results),e.owning=Gp(i,l.reported,!1),{model:u.value.model,commands:t.commands,events:[],lists:t.lists,sends:t.sends})},restored:e=>c.has(e),hold:(e,n,r,i)=>{let a=n.v,s=i;if(s.definition?.restore===!1)return!1;let c=(a.alive===void 0&&r||e.path)+`/`+rc(a.component,a.key),l;a.alive!==void 0&&(l=g.get(e)?.[c]);for(let t=e;!l&&t;t=t.parent)l=_.get(t);let u=l===void 0?o(c):oh(l,c);if(u===void 0)return!1;let d=Kp(Up(s).decode(u.state));if(Rr(d))return S.set(c,[u,d]),!1;let f=l??t(),p={[c]:u.state};for(let e in f)e.startsWith(c+`/`)&&(p[e]=f[e]);p[`~reported`]={...f?.[`~reported`],[c]:u.reported};let h=l===void 0?m:l[`~kept`],v={};for(let e in h)(e===c||e.startsWith(c+`/`))&&(v[e]=h[e]);return x.set(n,{owner:e,rec:n,path:c,saved:p,notes:v}),d.addObserver(t=>{let i=e.tree;i.schedule(()=>{x.delete(n),S.set(c,[u,t]),sl(e,n,r),S.delete(c),Hc(i)})}),!0},holding:()=>x.size>0,heldFor:te,pop:h,clear:()=>{m=void 0,S.clear()},watch:e=>{let t=e.ended;e.ended=(e,n)=>{t?.(e,n),delete g.get(e)?.[n]}}}},lh=(e,t)=>`${e}\u0000${t}`,uh=(e,t)=>{let n=t.context,r=B(n,Yl),i,a,o=ch({rootPath:t.path,entry:e.entry,restore:e.restore,onEncodeFailure:(e,t)=>Qp(e,n,t),onAsyncEncode:e=>(Jp(`late`,e,n,()=>`its state encodes asynchronously, so history keeps it in memory only. Back and forward restore it, and after a reload it starts from init.`),!0),onRestoreThrow:(e,t)=>Jp(`restore`,e,n,()=>`its restore threw, so history doesn't restore it. `+De(K(t)))}),s=0,c=0,l=new Set,u=new WeakMap,d=e=>{let t=u.get(e);return t===void 0&&(t={path:e.path,get closed(){return e.closed},get failure(){return e.failure},get parent(){return e.parent===void 0?void 0:d(e.parent)},get env(){return e.env},component:e.component,get children(){return ah(e.rendered).map(d)},born:++s,shares:void 0,watched:void 0},u.set(e,t)),t},f,p=()=>f??={now:()=>B(n,ie).currentTimeMillisUnsafe(),report:e=>Xl(n,e),cache:()=>zl.run.cacheOf(i),entryKey:lh,root:()=>d(i),since:()=>({born:s,build:i?.tree.builds??0}),lastFailedBuild:()=>i?.tree.failedBuild??0,record:()=>{c++;let e=!0;return()=>{if(e&&(e=!1,!(--c>0))){for(let e of l)e.watched=void 0;l.clear()}}},recorded:l},m=new WeakMap,h=(t,n)=>{let r=m.get(t);if(n===void 0)return r===void 0?void 0:(m.delete(t),r.release?.());if(r!==void 0){r.declaration=n;return}let i={declaration:n,release:void 0};m.set(t,i),i.release=e.prefetch(p(),d(t),i),(t.closers??=[]).push(()=>h(t,void 0))},g={get hydrated(){return t.hydrated?.()??!1},static:t.static??!1,path:t.path,container:t.container,flush:t.flush,since:t.since,snapshot:e=>{i!==void 0&&o.snapshot(i,e)},navigated:()=>{t.navigated?.(),o.pop()},restored:()=>{o.clear()},report:r,declare:h};return{handle:g,init:(e,t,n)=>{let r=d(e);return c>0&&(r.watched=new Set,l.add(r)),o.init(e,t,n)},restored:o.restored,hold:o.hold,heldFor:o.heldFor,attach:t=>{i=t,Pl.add(t.tree),t.tree.watched=(e,t,n)=>u.get(e)?.watched?.add(lh(t,n)),o.watch(t.tree),a=e.attach(g)},flushed:()=>{i!==void 0&&e.afterFlush(g,{flush:t.flush(),title:i.tree.head?.title,buildsPendingSince:t.buildsPendingSince})},detach:()=>{i=void 0,a?.(),a=void 0}}},dh=e=>{let t=e.indexOf(`=`);try{return decodeURIComponent((t<0?e:e.slice(0,t)).replaceAll(`+`,` `))}catch{return}},fh=(e,t)=>{let n=e.indexOf(`?`);return n<0?[]:e.slice(n+1).split(`&`).filter(e=>{let n=dh(e);return e!==``&&(n===void 0||!t.has(n))})},ph=(e,t)=>t.length===0?e:`${e}${e.includes(`?`)?`&`:`?`}${t.join(`&`)}`,mh=(e,t,n)=>{if(t.redirected)return e.print(t.route);let r=n.indexOf(`?`);return r<0||t.invalid.length===0?n:ph(n.slice(0,r),fh(n,new Set(t.invalid)))},hh=Tn([`navigated`,`blocked`]),gh=Tn([...hh.literals,`stale`]),_h=Ut(`@effect/ui/Router`),vh=yr(e=>$n(e,`_tag`)&&typeof e._tag==`string`),yh=class extends Gu()(`@effect/ui/Router/Push`,{args:{route:vh},success:hh}){static layer=this.toLayer(_t(_h,e=>({route:t})=>e.push(t)))},bh=class extends Gu()(`@effect/ui/Router/Replace`,{args:{route:vh},success:hh}){static layer=this.toLayer(_t(_h,e=>({route:t})=>e.replace(t)))},xh=yr(e=>typeof e==`object`&&!!e&&!Array.isArray(e)),Sh=class extends Gu()(`@effect/ui/Router/PatchSearch`,{args:{route:vh,patch:xh,history:Tn([`push`,`replace`]),scroll:fn},success:gh}){static layer=this.toLayer(_t(_h,e=>({history:t,patch:n,route:r,scroll:i})=>e.patchSearch(r,n,{history:t,scroll:i})))},Ch=(e,t,n,r)=>Sh.make({route:t,patch:n,history:r?.history??`replace`,scroll:r?.scroll===!0}),wh=class extends Gu()(`@effect/ui/Router/Back`,{args:{},success:hh}){static layer=this.toLayer(_t(_h,e=>()=>e.back))},Th=class extends Gu()(`@effect/ui/Router/Forward`,{args:{},success:hh}){static layer=this.toLayer(_t(_h,e=>()=>e.forward))},Eh=class extends Gu()(`@effect/ui/Router/Load`,{args:{href:q},success:hh}){static layer=this.toLayer(_t(_h,e=>({href:t})=>e.load(t)))},Dh=new WeakMap,Oh=(e,t,n)=>e.routes===t?V(n.route):t.parse(n.url),kh=e=>_t(_h,t=>vo(Oh(t,e,t.location()))),Ah=e=>_t(kh(e),e=>({route:e})),jh=(e,t,n)=>{let r=e,i=r.print(t),a=e=>e._tag===t._tag&&r.print(e)===i,o=e=>e._tag===t._tag&&r.printPath(e)===r.printPath(t),s=e=>{let t=r.print(e);return new Ih({have:i,router:t,message:`The component holds "${i}" but the Router is at "${t}". Initialize the root with Router.props or Router.currentRoute.`})},c=(e,t,i,c,l)=>{let u=Oh(e,r,c);if(un(u))return M();if(l){if(a(u.value))return M();let n=i?.hydrated===!0&&(e.routes.base()===`#`||i.static&&o(u.value));if(c.seq===0&&!n)try{t(s(u.value))}catch{}}return V(n(u.value))},l=Qa(Wt(function*(){let e=yield*_h,t=yield*Yl,n=(yield*pu)(),r=!0;return e.changes.pipe(Mi(i=>{let a=r;return r=!1,c(e,t,n,i,a)}),Sr(ke),Mi(e=>e.value))})),u=(e,t,n)=>{let r=B(e,_h),i=Dh.get(r);if(i===void 0)return;let a=B(e,Yl),o=B(e,pu),s=!0,l=e=>{let l=s;s=!1;let u;try{u=c(r,a,o(),e,l)}catch(e){return n(K(e))}ke(u)&&t(u.value,()=>i.delivered(e.seq))};return{initial:P(()=>{s&&l(r.location())}),close:i.listen(l)}};return Object.assign(cm(`@effect/ui/Router`,l),{[hu]:u,[mu]:(e,t)=>{let n=de(e,_h);if(un(n))return;let i=Oh(n.value,r,n.value.location());ke(i)&&!a(i.value)&&t(s(i.value))}})},Mh=class extends ar(`PrefetchThrew`){},Nh=class extends ar(`PrefetchQueryNotProvided`){},Ph=class extends ar(`PrefetchPageNotMounted`){},Fh=class extends ar(`PrefetchEntryNotWatched`){},Ih=class extends ar(`RouteMismatch`){},Lh=class extends ar(`PatchSearchLostBlock`){},Rh=class extends ar(`HistoryWriteFailed`){},zh=`@effect/ui`,Bh=e=>{if(typeof e!=`object`||!e)return;let t=e[zh];return typeof t==`object`&&t&&typeof t.index==`number`?t:void 0},Vh=e=>({[zh]:e}),Hh=class extends ar(`SnapshotWriteFailed`){},Uh=e=>{let t=e.indexOf(`#`,1);return t<0?[e,``]:[e.slice(0,t),e.slice(t)]},Wh=e=>{let t=e.indexOf(`?`);return t<0?e:e.slice(0,t)},Gh={PrefetchThrew:Mh,PrefetchQueryNotProvided:Nh,PrefetchPageNotMounted:Ph,PrefetchEntryNotWatched:Fh},Kh=Pi(yh.layer,bh.layer,Sh.layer,wh.layer,Th.layer,Eh.layer),qh=e=>$r(Kh,Sn(A(()=>Jh(e)))),Jh=e=>Wt(function*(){let{history:t,routes:n}=e,r=e=>n.base()===`#`?[e,``]:Uh(e),i=t.current(),[a,o]=r(i.url),s=n.resolve(a);if(un(s))return yield*$i(Error(`The Router's routes don't parse the initial URL "${i.url}"`));let c=yield*Yl,l=Bh(i.state)?.index??0,u=mh(n,s.value,a);(s.value.redirected||Bh(i.state)===void 0||u!==a)&&t.replace(u+o,Vh({index:l}));let f={route:s.value.route,url:u,hash:o,action:`initial`,seq:0},p=new Map,m=new Map,h=new Set,g=Bh(i.state)?.snapshot;g&&={...g};let _=e=>{if(v===void 0&&(e.restored(),g!==void 0)){for(let t in g)(t===e.path||t.startsWith(e.path+`/`)||t===`~kept`+e.path)&&delete g[t];Object.keys(g).every(e=>e===`~reported`)&&(g=void 0)}},v,y=0,b,x=()=>h.values().next().value,ee=()=>{let e={};for(let t of h)t.snapshot(e);return e},te=()=>{e.onLeave?.(l),m.set(l,ee())},S=e=>{let t=x();try{t===void 0?c(e):t.report(e)}catch{}},w,ne=(e,n)=>{w=void 0;try{t.replace(e,n)}catch(t){S(new Rh({url:e,error:t,message:`[@effect/ui] the Router couldn't write "${e}" into the history. The route changed anyway, so the address bar shows an older URL until the next write.`}))}},re=yield*Ia(),T=e.throttle===void 0?void 0:br(e.throttle.interval),ie,ae=()=>{w!==void 0&&ne(w.url,w.state)},oe=e=>{ie=Lt(re)(G(Ae(e),P(()=>{ie=void 0,w!==void 0&&(ae(),oe(e))})))},E=(e,t)=>{if(T===void 0)return ne(e,t);ie===void 0?(ne(e,t),oe(T)):w={url:e,state:t}},D=e.throttle?.flushOn?.(ae);yield*fa(()=>P(()=>{D?.(),ie?.interruptUnsafe(),ie=void 0,ae()}));let se=(e,n)=>{w=void 0;try{t.replace(e,Vh(n))}catch(t){ne(e,Vh({index:n.index})),S(new Hh({error:t,message:`[@effect/ui] the Router couldn't write the saved state into history.state. It is kept in memory only, so a reload starts the entry fresh.`}))}},ce=new Set,le=(e,t)=>{let r=[];for(let i of Array.from(ce)){let a=i.routes(),o=a===n?V(e.route):a.parse(e.url);if(un(o))continue;let s=i.run(o.value,t);s!==void 0&&r.push(s)}return r},ue=()=>{if(v!==void 0)for(let e of v.checks)e.dropped()},de=new Set,fe=[],pe=[],me=!1,O=e=>{if(pe.push({location:e,targets:Array.from(de)}),!me){me=!0;try{for(;pe.length>0;){let{location:e,targets:t}=pe.shift();for(let n of t)de.has(n)&&n(e);for(;fe.length>0;){let e=fe.splice(0);for(let t of e)t()}}}finally{me=!1}}},he=Ir(Zt((e,t)=>Rn(A(()=>{let e=[f],n,r=()=>{if(n===void 0||e.length===0)return;let t=n;n=void 0,t(rn(e.splice(0)))},i=t=>{e.push(t),n!==void 0&&fe.push(r)};de.add(i);let a=pr(t=>{if(e.length>0)t(rn(e.splice(0)));else return n=t,P(()=>{n===t&&(n=void 0)})});return Gi(lr(t,P(()=>{de.delete(i)})),a)})))),ge=(e,t)=>e._tag===f.route._tag&&Wh(t)===Wh(f.url),_e=(e,t,n)=>{g=n&&{...n};for(let e of h)e.navigated();let r=e.action===`push`||e.action===`replace`&&!t.quiet?le(e,!1):[],i=Wh(f.url);f=e;let a=v,o=[...a?.blocks??[],...t.blocks??[]];a!==void 0&&!a.quiet&&t.quiet?v={...a,location:e,index:l,since:void 0,checks:[...a.checks,...r],blocks:o}:(ue(),v={location:e,from:i,index:l,quiet:t.quiet,scroll:t.scroll,since:void 0,checks:r,blocks:o}),O(e)},ve=(e,n,r)=>{let i=f.seq+1,a=e.url+e.hash;if(n)m.delete(l),r.quiet?E(a,Vh({index:l})):ne(a,Vh({index:l}));else{te(),se(f.url+f.hash,{index:l,snapshot:{...m.get(l)}}),l++;for(let e of m.keys())e>=l&&m.delete(e);t.push(a,Vh({index:l}))}_e({...e,action:n?`replace`:`push`,seq:i},r)},ye=(i,a,o)=>{if(p.size>0)return`blocked`;let[s,c]=r(i),u=n.resolve(s);if(un(u))return ae(),t.load(i),`navigated`;let d=u.value.route,m=mh(n,u.value,s);if(m===f.url||d._tag===f.route._tag&&n.print(d)===n.print(f.route))return c!==f.hash&&(a?ne(f.url+c,Vh({index:l})):(ae(),te(),l++,t.push(f.url+c,Vh({index:l}))),f={...f,hash:c},e.onHash?.(c,`push`,l)),o===`href`&&O(f),`navigated`;let h=a&&ge(d,m);return ve({route:d,url:m,hash:c},a,{quiet:h,scroll:!h}),`navigated`},be=(e,t,r,i)=>{let a=f.route;if(a._tag!==e._tag||n.printPath(a)!==n.printPath(e))return`stale`;let o=n,s=new Set(Object.keys(o.routes[a._tag]?.search??{})),c={...a.search};for(let[e,n]of Object.entries(t))s.has(e)&&(n===void 0?delete c[e]:c[e]=n);let l=o.make({_tag:a._tag,params:a.params,search:c}),u=ph(n.print(l),fh(f.url,s));return u===f.url||ve({route:l,url:u,hash:f.hash},r,{quiet:!0,scroll:i,blocks:Array.from(p.keys())}),`navigated`},k=t.listen((i,a)=>{let o=w;w=void 0;let s=Bh(a),c=s?.index??0;if(y>0){if(y--,l=c,y===0&&b!==void 0){let e=b;b=void 0,e.index===c&&E(e.url,e.state)}return}let[u,d]=r(i),h=n.resolve(u),g=ke(h)?mh(n,h.value,u):void 0,_=ke(h)&&ge(h.value.route,g);if(p.size>0&&!_){c!==l&&(o!==void 0&&(b={index:l,...o}),y++,t.go(l-c));return}if(un(h)||g===void 0)return;if(g===f.url){if(d===f.hash){l=c;return}e.onLeave?.(l),l=c,f={...f,hash:d},e.onHash?.(d,`pop`,c);return}te(),l=c;let v=m.get(c)??s?.snapshot;_e({route:h.value.route,url:g,hash:d,action:`pop`,seq:f.seq+1},{quiet:_,scroll:!0},v)});yield*fa(()=>P(()=>{k(),ue(),v=void 0}));let xe=e=>(ce.add(e),()=>{ce.delete(e)}),Se={attach:e=>(h.add(e),()=>{h.delete(e),_(e)}),restore:e=>{let t=g?.[e];if(t!==void 0)return delete g[e],{state:t,reported:g[`~reported`]?.[e]}},entry:()=>g,prefetch:(e,t,n)=>eh(xe,Gh,e,t,n),kernel:uh,afterFlush:(t,n)=>{if(n.buildsPendingSince(0)===0&&_(t),v===void 0||v.since===void 0||t!==x()||n.flush<v.since||n.buildsPendingSince(v.since)>0)return;let r=v;v=void 0,g=void 0;for(let e of h)e.restored();for(let e of r.checks)e.settled();let i=Array.from(new Set(r.blocks)).filter(e=>!p.has(e));i.length>0&&S(new Lh({keys:i,message:`[@effect/ui] a block held when Router.patchSearch ran is gone now it has settled: ${i.join(`, `)}. A page keyed by its search remounts on every patch; key it by printPath instead.`})),e.onSettled?.({location:r.location,from:r.from,index:r.index,container:t.container,title:n.title,quiet:r.quiet,scroll:r.scroll})}},Ce={routes:n,location:()=>f,changes:he,navigate:(e,t)=>P(()=>ye(e,t?.replace===!0,`href`)),push:e=>P(()=>ye(n.print(e),!1,`route`)),replace:e=>P(()=>ye(n.print(e),!0,`route`)),patchSearch:(e,t,n)=>P(()=>be(e,t,n?.history!==`push`,n?.scroll===!0)),back:P(()=>p.size>0?`blocked`:(ae(),t.go(-1),`navigated`)),forward:P(()=>p.size>0?`blocked`:(ae(),t.go(1),`navigated`)),load:e=>P(()=>p.size>0?`blocked`:(ae(),t.load(e),`navigated`)),block:e=>Gn(dn,t=>(p.set(e,(p.get(e)??0)+1),lr(t,P(()=>{let t=p.get(e)-1;t===0?p.delete(e):p.set(e,t)})))),blocked:()=>p.size>0,intent:e=>P(()=>{let[t]=r(e),i=n.resolve(t);if(un(i))return;let a=n.print(i.value.route);a!==n.print(f.route)&&le({route:i.value.route,url:a},!0)})};return Dh.set(Ce,{delivered:e=>{let t=x();v!==void 0&&v.location.seq===e&&v.since===void 0&&t!==void 0&&(v.since=t.since())},listen:e=>(de.add(e),()=>{de.delete(e)})}),d(_h,Ce).pipe(C(fu,Se))}),Yh=e=>{let t=Object.keys(e);for(let n of t)if(Object.hasOwn(e[n],`_tag`))throw Error(`Case ${n} can't declare _tag`);let n=Xn(e),{tag:r,cases:i,isAnyOf:a,guards:o,match:s,matchOrElse:c}=n,l={tag:r,cases:i,isAnyOf:a,guards:o,match:s,matchOrElse:c,is:Xh};for(let e of t)l[e]=t=>({...t,_tag:e});return Ya(n.ast,l)},Xh=e=>t=>mr(t,e),Zh=()=>void 0,Qh=()=>void 0,$h=(e,t)=>typeof e==`function`?e(t):e,eg=class extends Ut()(`@effect/ui/html/Html/Host`){},tg=class extends Ds{onMount(e){return super.onMount(e)}forward(e){return rs(this,e)}id(e){return this.attr(`id`,e)}style(e){let t=[];for(let[n,r]of Object.entries(e)){if(!r)continue;let e=n.startsWith(`--`)?n:n.replace(/[A-Z]/g,e=>`-`+e.toLowerCase()).replace(/^(webkit|moz|ms)-/,`-$1-`);t.push(e+`:`+r)}return this.attr(`style`,t.length===0?void 0:t.join(`;`))}class(...e){let t=e.length===1?e[0]||``:rg(e);return this.attr(`class`,t===``?void 0:t)}disabled(e){return this.attr(`disabled`,e?``:void 0)}value(e){return this.prop(`value`,e)}checked(e){return this.prop(`checked`,e)}selected(e){return this.prop(`selected`,e)}open(e){return this.prop(`open`,e)}modal(e){return this.prop(`open`,e?`modal`:!1)}popover(e,t){return this.attr(`popover`,e).prop(`popoverOpen`,t)}draggable(e,t){let n={data:e,effectAllowed:t?.effectAllowed};return ts(this,{eventOptions:{...es(this).eventOptions,dragstart:n}}).attr(`draggable`,`true`)}on(e,t,n){if(n===void 0&&(e===`dragstart`||e===`drop`)){let t=es(this).eventOptions[e];t!==void 0&&(e===`dragstart`?`data`:`accepts`)in t&&(n=t)}return super.on(e,t,n)}dropTarget(e){let t={...e,preventDefault:`always`};return ts(this,{eventOptions:{...es(this).eventOptions,drop:t}})}},ng=class extends tg{onMount(e){return super.onMount(e)}children(...e){return is(this,e)}forward(e){return rs(this,e)}},rg=e=>{let t=``;for(let n=0;n<e.length;n++){let r=e[n];r&&(t=t===``?r:t+` `+r)}return t},ig=`a.abbr.address.article.aside.audio.b.bdi.bdo.blockquote.button.canvas.caption.cite.code.colgroup.data.datalist.dd.del.details.dfn.dialog.div.dl.dt.em.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hgroup.i.iframe.ins.kbd.label.legend.li.main.mark.menu.meter.nav.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.small.span.strong.sub.summary.sup.table.tbody.td.textarea.tfoot.th.thead.time.tr.u.ul.var.video`.split(`.`),ag=[`br`,`col`,`hr`,`img`,`input`,`source`,`track`,`wbr`],og=`html`,sg={name:og,tags:(()=>{let e={};for(let t of ig)e[t]=ks(new ng(t));for(let t of ag)e[t]=new tg(t);return e})()},cg=e=>ip({...e,elements:sg}),lg=()=>new fg(5),ug=e=>e<0?`user-blocking`:e===0?`user-visible`:`background`,dg=()=>performance.now(),fg=class{executionMode=`async`;budget;queue=[];deadline=-1/0;active=void 0;keep=void 0;sampled=-1;sampledAt=0;sampledTime=0;stride=1;pending=new Set;channel=void 0;constructor(e){this.budget=e}shouldYield(e){let t=e.currentOpCount;if(t>=e.cache.maxOpsBeforeYield)return this.yieldInLane(e);let n=e.id!==this.sampled||t<=this.sampledAt;if(!n&&t<this.sampledAt+this.stride)return!1;let r=dg();if(r>=this.deadline){if(!n||this.active!==void 0||this.pending.size>0)return this.yieldInLane(e);this.deadline=r+this.budget}if(n)this.stride=1;else{let e=(r-this.sampledTime)/(t-this.sampledAt);this.stride=Math.max(1,Math.min(this.stride*2,32,Math.floor((this.deadline-r)/e/2)))}return this.sampled=e.id,this.sampledAt=t,this.sampledTime=r,!1}yieldInLane(e){return this.keep=this.active?.fiber===e.id?this.active.priority:void 0,!0}makeDispatcher(){return this}scheduleTask(e,t){this.keep!==void 0&&(t=this.keep,this.keep=void 0),pg(this.queue,t).tasks.push({run:e,priority:t,fiber:Rt()?.id}),this.active===void 0&&this.post(ug(t))}post(e){let t=globalThis.scheduler;if(typeof t?.postTask==`function`){if(this.pending.has(e))return;this.pending.add(e),t.postTask(()=>{this.pending.delete(e),this.drain(dg()+this.budget,e===`user-blocking`?-1:e===`user-visible`?0:1)},{priority:e})}else this.pending.size===0&&(this.pending.add(e),typeof MessageChannel==`function`?(this.channel===void 0&&(this.channel=new MessageChannel,this.channel.port1.onmessage=this.run),this.channel.port2.postMessage(void 0)):setTimeout(this.run,0))}run=()=>{this.pending.clear(),this.drain(dg()+this.budget)};drain(e,t=1){let n=this.active,r=this.queue;this.queue=[],this.deadline=e;let i=0,a=0;try{for(;i<r.length;i++,a=0){if(Math.sign(r[i].priority)>t)return;let n=r[i].tasks;for(;a<n.length;){let t=n[a];if(t.priority>0&&this.queue.length>0&&this.queue[0].priority<=0||(this.active=t,a++,t.run(),dg()>=e))return}}}finally{for(this.active=n;i<r.length;i++,a=0){let e=r[i];if(a<e.tasks.length){let t=pg(this.queue,e.priority);t.tasks=e.tasks.slice(a).concat(t.tasks)}}for(let e of this.queue)this.post(ug(e.priority))}}flush(){let e=this.deadline;try{for(;this.queue.length>0;)this.drain(1/0)}finally{this.deadline=e}}},pg=(e,t)=>{let n=e.length;for(;n>0&&e[n-1].priority>t;)n--;let r=e[n-1];if(r!==void 0&&r.priority===t)return r;let i={priority:t,tasks:[]};return e.splice(n,0,i),i},mg=/[\s"'<>/=\u0000-\u001f\u007f-\u009f]/,hg=/[A-Z]/g,gg=e=>e.toLowerCase(),_g=(e,t)=>{let n=(t?yg:vg).get(e);if(n!==void 0)return n===null?void 0:n;let r=e.length===0||mg.test(e)?void 0:t||e.search(hg)===-1?e:e.replace(hg,gg);return xg(t?yg:vg,e,r),r},vg=new Map,yg=new Map,bg=1024,xg=(e,t,n)=>{e.size>=bg&&e.clear(),e.set(t,n??null)},Sg=new Set([`svg`,`g`,`path`,`circle`,`ellipse`,`line`,`polyline`,`polygon`,`rect`,`text`,`tspan`,`textPath`,`defs`,`use`,`symbol`,`clipPath`,`mask`,`pattern`,`marker`,`linearGradient`,`radialGradient`,`stop`,`filter`,`image`,`foreignObject`]),Cg=e=>e.includes(`-`),wg=/[\u0000-\u0020]/g,Tg=/^[a-zA-Z][a-zA-Z0-9+.-]*$/,Eg=e=>{let t=e.indexOf(`:`);if(t===-1)return;let n=e.slice(0,t).replace(wg,``);return Tg.test(n)?n.toLowerCase():void 0},Dg=e=>{let t=Eg(e);return t===`javascript`||t===`vbscript`},Og=new Set([`href`,`src`,`action`,`formaction`,`xlink:href`,`data`]),kg=new Set([`href`,`src`,`action`,`formAction`,`data`]),Ag=(e,t)=>Og.has(e)&&Dg(t),jg=(e,t,n)=>typeof n==`string`&&kg.has(t)&&!Cg(e)&&Dg(n),Mg=(e,t)=>{let n=e.querySelector(`title`),r=n!==null&&n.hasAttribute(`data-eui`)?``:e.title,i=!1,a=!1,o=n=>{let o=n.title;if(!i){i=!0;let n=e.querySelector(`title`);o!==void 0&&n!==null&&!n.hasAttribute(`data-eui`)&&e.querySelector(`title[data-eui]`)!==null&&t(`Head: an unmarked <title> comes before the marked one, so the browser shows the shell's`)}o===void 0?a&&(a=!1,e.title!==r&&(e.title=r)):(a=!0,e.title!==o&&(e.title=o))};return{sync:o,restore:()=>{i&&o({title:void 0})}}},Ng=new WeakMap,Pg=(e,t)=>{let n=Ng.get(e);n===void 0&&(n={...Mg(e,t),hosts:0},Ng.set(e,n));let r=n;r.hosts++;let i=!1;return{sync:r.sync,release:()=>{i||(i=!0,--r.hosts>0||(Ng.delete(e),r.restore()))}}},Fg=ro(`@effect/ui/html/HtmlFiles/Files`,{defaultValue:()=>Ig}),Ig={pick:()=>at},Lg,Rg=ro(`@effect/ui/html/HtmlSubscription/AnimationFrames`,{defaultValue:()=>zg}),zg={now:()=>0,listen:()=>()=>{}},Bg=ro(`@effect/ui/html/HtmlSubscription/GlobalEvents`,{defaultValue:()=>Vg}),Vg={listen:()=>()=>{}},Hg=ro(`@effect/ui/html/HtmlImages/Images`,{defaultValue:()=>Ug}),Ug={load:()=>at},Wg,Gg=ro(`@effect/ui/html/HtmlSubscription/MediaQueries`,{defaultValue:()=>Kg}),Kg={matches:()=>void 0,listen:()=>()=>{}},qg=Symbol.for(`@effect/ui/html/HtmlSubscription/mediaQuery`),Jg=e=>e[qg],Yg=new Set([`button`,`checkbox`,`color`,`file`,`image`,`radio`,`range`,`reset`,`submit`]),Xg=e=>{let t=e.pointerType;return t===`mouse`||t===`touch`||t===`pen`||t===``?t:void 0},Zg=e=>{let t=e;return{shift:t.shiftKey===!0,ctrl:t.ctrlKey===!0,alt:t.altKey===!0,meta:t.metaKey===!0}},Qg=`http://www.w3.org/1999/xhtml`,$g=(e,t,n)=>{let r=Xg(t);return r===``||e===`click`&&t.detail===0?``:n??r??`mouse`},e_=(e,t)=>{let n;try{n=new FormData(e,t)}catch{n=new FormData(e)}let r=Object.create(null),i=[];return n.forEach((e,t)=>{typeof e==`string`&&(i.push([t,e]),Object.hasOwn(r,t)||(r[t]=e))}),{fields:r,entries:i}},t_=(e,t)=>{let n=e,r=t,i=r?.isComposing===!0,a=typeof r?.inputType==`string`?r.inputType:``;return n.localName===`input`?{value:n.value,checked:n.checked===!0,files:n.files?Array.from(n.files):n_,composing:i,inputType:a}:{value:String(n.value??``),composing:i,inputType:a}},n_=[],r_={selectionStart:null,selectionEnd:null},i_=e=>{let t=e;if(t?.namespaceURI===Qg){let e=t.localName;if(e===`textarea`||e===`select`)return!0;if(e===`input`)return!Yg.has(t.type)}return t?.isContentEditable===!0},a_=e=>{let t=e,n=t?.localName;if(n!==`input`&&n!==`textarea`)return r_;try{let e=t.selectionStart,n=t.selectionEnd;return typeof e==`number`&&typeof n==`number`?{selectionStart:e,selectionEnd:n}:r_}catch{return r_}},o_=e=>{try{return e.clipboardData?.getData(`text/plain`)??``}catch{return``}},s_=(e,t)=>{try{return e.contains(t)}catch{return!1}},c_=e=>typeof e?.matches==`function`&&e.matches(`:disabled`),l_=e=>{if(typeof e?.matches!=`function`)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}},u_=(e,t)=>e!==null&&`value`in e?e:t,d_=(e,t,n,r,i)=>{switch(e){case`click`:case`dblclick`:case`contextmenu`:case`mousedown`:case`mouseup`:case`pointerdown`:case`pointerup`:case`pointercancel`:{let n=t;return{button:n.button??0,x:n.clientX??0,y:n.clientY??0,...Zg(t),pointerType:$g(e,t,i)}}case`mouseenter`:case`mouseleave`:{let e=t;return{x:e.clientX??0,y:e.clientY??0}}case`keydown`:case`keyup`:{let e=t,r=e.isComposing===!0||e.keyCode===229;return{key:e.key??``,...Zg(t),composing:r,repeat:e.repeat===!0,editable:i_(t.composedPath()[0]??n),...a_(n)}}case`input`:case`change`:return t_(u_(n,r),t);case`compositionend`:return{value:String(u_(n,r).value??``)};case`paste`:return{text:o_(t)};case`submit`:return e_(r.localName===`form`?r:n,t.submitter??null);case`toggle`:{let e=t,n=r.hasAttribute(`popover`)?e.newState===`open`:r.open===!0,i=e.newState===`open`||e.newState===`closed`?e.newState:n?`open`:`closed`;return{open:n,newState:i,oldState:e.oldState===`open`||e.oldState===`closed`?e.oldState:i===`open`?`closed`:`open`}}case`close`:return{returnValue:r.returnValue??``};case`cancel`:return{cancelable:t.cancelable};case`scroll`:return{top:r.scrollTop,left:r.scrollLeft};case`focus`:return{focusVisible:l_(n)};case`blur`:return n===r?{disabled:c_(n)}:{};case`focusin`:return{within:s_(r,t.relatedTarget)};case`focusout`:return{within:s_(r,t.relatedTarget),disabled:c_(n)};default:return{}}},f_=e=>{let{selectionEnd:t,selectionStart:n}=a_(e);if(n===null||t===null)return;let r=e;return{value:r.value,start:n,end:t,direction:r.selectionDirection??`none`}},p_=(e,t,n)=>{let r=Math.min(e.length,t.length),i=0;for(;i<r&&e.charCodeAt(i)===t.charCodeAt(i);)i++;if(n<=i)return n;let a=0;for(;a<r-i&&e.charCodeAt(e.length-1-a)===t.charCodeAt(t.length-1-a);)a++;let o=e.length-n;return o<=a?t.length-o:Math.min(n,t.length-a)},m_=e=>{let t=Gl(e.visibilityState!==`hidden`),n=Gl(!0),r=e.defaultView,i=()=>t.set(e.visibilityState!==`hidden`),a=()=>n.set(!0),o=()=>n.set(!1);return e.addEventListener(`visibilitychange`,i),r?.addEventListener(`online`,a),r?.addEventListener(`offline`,o),{visibility:t,connectivity:n,dispose:()=>{e.removeEventListener(`visibilitychange`,i),r?.removeEventListener(`online`,a),r?.removeEventListener(`offline`,o)}}},h_=(e,t)=>e.isTrusted&&(e instanceof t.MouseEvent||e instanceof t.KeyboardEvent||typeof t.TouchEvent==`function`&&e instanceof t.TouchEvent),g_=(e,t)=>({listen:(n,r,{capture:i,custom:a},o)=>{let s=n===`document`?e:e.defaultView;if(s===null)return()=>{};let c=e.defaultView,l=n=>c!==null&&t()&&h_(n,c)?void 0:o({...a===!0?{detail:n.detail??null}:d_(r,n,n.target,e.documentElement,void 0),defaultPrevented:n.defaultPrevented},()=>n.preventDefault());return s.addEventListener(r,l,{capture:i}),()=>s.removeEventListener(r,l,{capture:i})}}),__=e=>{let t=e.defaultView;return{now:()=>t?.performance.now()??0,listen:e=>{if(t===null||typeof t.requestAnimationFrame!=`function`)return()=>{};let n=i=>{r=t.requestAnimationFrame(n),e(i)},r=t.requestAnimationFrame(n);return()=>t.cancelAnimationFrame(r)}}},v_=e=>{let t=e.defaultView;return t===null||typeof t.matchMedia!=`function`?Kg:{matches:e=>t.matchMedia(e).matches,listen:(e,n)=>{let r=t.matchMedia(e),i=e=>n(e.matches);return r.addEventListener(`change`,i),()=>r.removeEventListener(`change`,i)}}},y_=(e,t,n)=>A(()=>{let r=m_(e),i=d(eg,t).pipe(C(ql,r.visibility),C(Jl,r.connectivity),C(Bg,g_(e,n)),C(Rg,__(e)),C(Gg,v_(e)),C(Hg,{load:t=>Wg(e,t)}),C(Fg,{pick:n=>Lg(e,t,n)}));return Gi(fa(()=>P(r.dispose)),i)}),b_=new Set([`focus`,`blur`,`mouseenter`,`mouseleave`,`scroll`,`toggle`,`load`,`error`,`close`,`cancel`]),x_=new Set([`click`,`dblclick`,`contextmenu`,`mousedown`,`mouseup`,`pointerdown`,`keydown`,`keyup`,`focusin`,`focusout`,`dragstart`,`dragend`,`dragenter`,`dragleave`,`dragover`,`drop`,`paste`,`input`,`change`,`compositionend`,`submit`,`reset`]),S_=new WeakSet,C_=(e,t)=>Object.getPrototypeOf(e).getAttribute.call(e,t),w_=(e,t)=>{let n=(t?.getAttribute(`formmethod`)??C_(e,`method`)??``).toLowerCase();if(n===`dialog`)return n;if(n===`post`)return`native`;let r=t?.getAttribute(`formtarget`)??C_(e,`target`);return r===null||r===``||r.toLowerCase()===`_self`?`get`:`native`},T_=`http://www.w3.org/2000/svg`,E_=(e,t)=>{let n=_g(t,!1);return n===t||e.namespaceURI!==`http://www.w3.org/2000/svg`?n:_g(t,!0)},D_=new Set([`value`,`checked`,`selected`,`open`,`popoverOpen`]),O_=new Set([`input`,`change`,`compositionend`,`toggle`,`close`,`reset`]),k_=new Set([`dragenter`,`dragleave`,`dragover`,`drop`]),A_=e=>Array.from(e.dataTransfer?.types??[],e=>e.toLowerCase()),j_=(e,t)=>{let n=t.getBoundingClientRect();return{x:(e.clientX??0)-n.left,y:(e.clientY??0)-n.top,width:n.width,height:n.height}},M_=e=>e.localName===`dialog`,N_=(e,t)=>{try{return e.matches(t)}catch{return!1}},P_=e=>e.sort((e,t)=>e.compareDocumentPosition(t)&4?-1:1),F_=e=>e.localName===`input`&&e.type===`radio`,I_=e=>{if(e.name===``)return[e];let t=e.getRootNode();return Array.from(t.querySelectorAll(`input[type="radio"]`)).filter(t=>t.name===e.name&&t.form===e.form)},L_=e=>{let t=Object.create(null);for(let n in e){let r=_g(n,!1);r!==void 0&&(t[r]=e[n])}return t},R_=()=>{},z_=new WeakMap,B_=new WeakMap,V_=(e,t)=>{let n=e.ownerDocument,r=n.defaultView,i=new Set,a=new WeakSet,o=new WeakSet,s=new WeakMap,c,l,u=t.step??(e=>e()),d=(e,t)=>{if(t===void 0)return;let n=s.get(e);n===void 0&&s.set(e,n=new Map),n.set(t.value,t)},f,p,m,h=typeof r?.requestAnimationFrame==`function`?e=>r.requestAnimationFrame(e):e=>setTimeout(e,0),g=(e,t,n)=>{if(t===`value`&&(a.has(e)||n!==``&&e.type===`file`))return;let r=t===`value`&&e.getRootNode().activeElement===e?f_(e):void 0;if(r===void 0){e[t]=n;return}let{scrollLeft:i,scrollTop:o}=e;e.value=n;let c=e.value,l=s.get(e)?.get(c);if(l!==void 0)e.setSelectionRange(l.start,l.end,l.direction);else if(r.start!==r.end||r.end!==r.value.length){let t=p_(r.value,c,r.start);e.setSelectionRange(t,r.end===r.start?t:p_(r.value,c,r.end),r.direction)}else return;e.scrollLeft=i,e.scrollTop=o},_=e=>{let t=n.activeElement,i=r?.scrollX??0,a=r?.scrollY??0;e(),n.activeElement!==t&&r?.scrollTo?.({left:i,top:a,behavior:`instant`})},v=new WeakSet,y=new WeakMap,b=new Set,x=new Set,ee,te=e=>{let t=y.get(e);return t===void 0&&y.set(e,t=[]),t},S=e=>{if(!e.open)return;let t=te(e);t.at(-1)?.closed!==!1&&t.push({byHost:!1,closed:!1}),x.add(e)},C=(e,t)=>{if(!e.open)return;v.delete(e),S(e),x.delete(e);let n=te(e).at(-1);n.closed=!0,n.byHost=t,e.close()},w=(e,t)=>{for(let n of[...x].reverse())(t||n!==e)&&e.contains(n)&&C(n,!0)},ne=(e,t)=>{S(e);let n=e.open?v.has(e)&&(ee!==!0||N_(e,`:modal`))?`modal`:!0:!1;if(n!==t){if(t===!1)return C(e,!1);n!==!1&&C(e,!0),t===`modal`?(_(()=>e.showModal()),v.add(e),ee??=N_(e,`:modal`)):e.show(),te(e).push({byHost:!1,closed:!1}),x.add(e)}},re=new Set,T=!1,ie=new Set,ae=new WeakMap,oe=e=>{ie.add(e),i.has(`toggle`)&&!ae.has(e)&&ae.set(e,{state:void 0})},E=e=>{if(!ie.delete(e))return;let t=ae.get(e);t!==void 0&&(t.state=`closed`)},D=new Set,se=new WeakMap,ce=(e,t,n)=>{t===!0?n?e.isConnected&&e.hasAttribute(`popover`)&&!N_(e,`:popover-open`)&&_(()=>e.showPopover()):re.add(e):(re.delete(e),N_(e,`:popover-open`)&&e.hidePopover())},le=e=>{let t=z_.get(e);if(t!==void 0)for(let[n,r]of t)n===`open`&&M_(e)?e.isConnected&&!(T&&r===`modal`)&&ne(e,r):n===`popoverOpen`?e.getAttribute(`popover`)===`manual`&&ce(e,r,!0):e[n]!==r&&g(e,n,r)},ue=e=>{le(e);let t=e;if(F_(t))for(let e of I_(t))le(e);else if(t.localName===`select`)for(let t of e.options)le(t);else if(t.localName===`form`)for(let t of e.elements)ue(t)},de=e=>{if(p===void 0){let e=p=new Set;h(()=>{p=void 0;for(let t of e)ue(t),a.has(t)||s.delete(t)})}p.add(e)},fe=e=>e.$r?.v,pe=(e,t,n,r)=>{let i=e.$r,a=i?.v,o=a?.handlers[t];if(o===void 0)return!1;let s=a.eventOptions[t]?.preventDefault;s===`always`&&r?.preventDefault();let c=i.inst;return u(()=>{if(c.closed)return!1;if(o?.[`~fire`]!==void 0)return o[`~fire`](n(),t,()=>r?.preventDefault());let e=o;if(typeof o==`function`)try{e=o(n())}catch(e){return Q(c,`event`,K(e)),!1}return e!==void 0&&(s===!0&&r?.preventDefault(),Nc(c,e,t),!0)}),!0},me,O=null,he,ge=!1,_e=!1,ve,ye,be=(e,t)=>{let n=fe(e);return n?.handlers.drop!==void 0&&n.eventOptions.drop?.accepts?.some(e=>t.includes(e.toLowerCase()))===!0},k=(t,n)=>{let r=A_(t);for(let t of n){if(t===e)return;if(be(t,r))return t}},xe=e=>{if(e===me)return;let t=me;me=e,ve=ye=void 0,t!==void 0&&pe(t,`dragleave`,()=>({})),e!==void 0&&pe(e,`dragenter`,()=>({}))},Se=()=>{clearTimeout(he),O=null,xe(void 0)},Ce=(e,t)=>{fe(e)?.handlers.dragover!==void 0&&(ve=[e,j_(t,e),A_(t)],_e||(_e=!0,h(()=>{_e=!1;let e=ve;if(ve=void 0,e===void 0)return;let[t,n,r]=e;me===t&&t.isConnected&&be(t,r)&&(ye===void 0||ye.x!==n.x||ye.y!==n.y||ye.width!==n.width||ye.height!==n.height)&&(ye=n,pe(t,`dragover`,()=>n))})))},A=(e,t,n)=>{if(e===`dragleave`){if(t.target!==O)return;clearTimeout(he),he=setTimeout(Se,0);return}let r=k(t,n);if(e===`drop`){if(r!==void 0){t.preventDefault(),ge=!0;let e=t.dataTransfer,n=Object.create(null);for(let t of e?.types??[])t!==`Files`&&(n[t]=e.getData(t));let i={data:n,files:Array.from(e?.files??[]),...j_(t,r)};pe(r,`drop`,()=>i)}return Se()}if(clearTimeout(he),e===`dragenter`&&(O=t.target),r!==void 0){t.preventDefault();let e=fe(r).eventOptions.drop.dropEffect;e!==void 0&&t.dataTransfer!==null&&(t.dataTransfer.dropEffect=e)}xe(r),e===`dragover`&&r!==void 0&&Ce(r,t)},we=(t,n)=>{ge=!1;let r=t.dataTransfer;if(r!==null)for(let t of n){if(t===e)return;let n=fe(t)?.eventOptions.dragstart;if(n?.data!==void 0){for(let e in n.data)r.setData(e,n.data[e]);n.effectAllowed!==void 0&&(r.effectAllowed=n.effectAllowed);return}}},Te=(t,n,r,i)=>{let a,o=()=>i(a),s=r?Math.max(n.indexOf(t.target),0):0;for(let i=s;i<n.length&&(a=n[i],a!==e);i++){if(pe(a,t.type,o,t))return!0;if(r)break}return!1},Ee=e=>{let t=e.type,n=e.composedPath(),i=r!==null&&e instanceof r.CustomEvent,s=e=>i&&Cg(e.localName??``);if(s(e.target)){Te(e,n,!e.bubbles||b_.has(t),()=>({detail:e.detail}));return}if(k_.has(t))return A(t,e,n);let l=n[0]??e.target,u=t===`toggle`?ae.get(l):void 0;if(u!==void 0&&(u.state??=e.oldState,ie.has(l)||(ae.delete(l),e.newState===u.state)))return;let p=e.isComposing===!0;if(M_(l)){if(t===`cancel`)z_.get(l)?.get(`open`)===`modal`&&e.preventDefault();else if(t===`close`){let e=y.get(l),t=e?.shift();if(t!==void 0&&(t.byHost||e.length>0))return;l.open||v.delete(l)}}if(t===`pointerdown`)f=Xg(e)||void 0;else if(t===`beforeinput`){let t=p||a.has(l)?void 0:f_(l),n=c=t===void 0?void 0:{node:l,state:t,event:e};n!==void 0&&setTimeout(()=>c===n&&(c=void 0),0)}else if(t===`compositionstart`||t===`compositionend`||t===`input`){if(t===`compositionstart`)d(l,f_(l));else if(t===`input`){let t=c;c=void 0,t?.node===l&&!t.event.defaultPrevented&&t.event.inputType===e.inputType&&d(l,t.state)}t===`compositionstart`||p?a.add(l):a.delete(l)}t===`dragstart`&&we(e,n);let m=Te(e,n,b_.has(t)||!e.bubbles&&(i||!x_.has(t)),n=>s(n)?{detail:e.detail}:t===`dragend`?{dropped:ge||(e.dataTransfer?.dropEffect??`none`)!==`none`}:d_(t,e,l,n,f));if(t===`submit`&&e.target!==null&&o.has(e.target)){if(S_.delete(e),m)e.preventDefault();else{let t=w_(e.target,e.submitter??null);t!==`native`&&e.preventDefault(),t===`get`&&S_.add(e)}}t===`dragend`&&Se(),O_.has(t)&&l!=null&&de(l)},De=t=>{if(!i.has(t)){if(i.add(t),e.addEventListener(t,Ee,!0),t===`click`)De(`pointerdown`);else if(t===`dragend`)De(`dragstart`);else if(t===`drop`){for(let e of k_)De(e);De(`dragend`)}}},Oe=e=>{o.add(e),De(`submit`)},ke=t.head?Pg(n,t.warn):void 0;return{createElement(e){if(Sg.has(e))return n.createElementNS(T_,e);let t=n.createElement(e);return e.length===4&&e.toLowerCase()===`form`&&Oe(t),t},form:Oe,createText:e=>n.createTextNode(e),setText(e,t){e.data=t},normalizeAttrs(e,t){for(let n in t)if(_g(n,!1)!==n)return e.namespaceURI===`http://www.w3.org/2000/svg`?t:L_(t);return t},setAttr(e,t,r,i){let a=e,o=E_(a,t);if(o===void 0)return;if(r!==void 0&&Ag(o,r)&&(r=void 0),o!==`style`||a.style===void 0||a.getAttribute(`style`)===(i??null)){r===void 0?a.removeAttribute(o):a.setAttribute(o,r);return}let s=a.style,c=l??=n.createElement(`div`).style;c.cssText=i??``;let u=[];for(let e=0;e<s.length;e++){let t=s[e],n=s.getPropertyValue(t),r=s.getPropertyPriority(t);(n!==c.getPropertyValue(t)||r!==c.getPropertyPriority(t))&&u.push(t,n,r)}r===void 0?a.removeAttribute(`style`):a.setAttribute(`style`,r);for(let e=0;e<u.length;e+=3)s.setProperty(u[e],u[e+1],u[e+2])},setProp(e,t,n){let r=e,i=D_.has(t);if(i&&t!==`popoverOpen`&&Cg(r.localName)){let r=B_.get(e);if(r===void 0&&B_.set(e,r=new Map),r.has(t)&&r.get(t)===n)return;r.set(t,n)}else if(i){let i=z_.get(e),o=t===`open`&&M_(e),c=t===`popoverOpen`;if(n===void 0&&!o&&!c)i?.delete(t),n=t===`value`&&``;else{i===void 0&&z_.set(e,i=new Map);for(let e of O_)De(e);if(De(`compositionstart`),De(`beforeinput`),c){n=n===!0;let a=r.getAttribute(`popover`),o=i.get(t)===n&&se.get(e)===a;i.set(t,n),se.set(e,a),D[a===`manual`?`add`:`delete`](r),a===`auto`&&o||(E(e),ce(r,n));return}if(o){n=n===`modal`?n:n===!0,i.get(t)!==n&&E(e),i.set(t,n),n===`modal`?(b.add(e),De(`cancel`)):(b.delete(e),ne(e,n));return}i.set(t,n)}r[t]!==n&&g(r,t,n),t===`value`&&!a.has(e)&&s.delete(e);return}jg(r.localName,t,n)?r.removeAttribute(t.toLowerCase()):r[t]=n===void 0?typeof r[t]==`string`?``:typeof r[t]!=`boolean`&&null:n},setEvents(e,t,n){n&&(e.$r=t);let{eventOptions:r,handlers:i}=t.v;for(let e in i)De(e);r.dragstart!==void 0&&De(`dragend`)},insert(e,t,n){e.insertBefore(t,n)},remove(e,t){x.size>0&&w(t,!0),e.removeChild(t)},clear(e){x.size>0&&w(e,!1),e.textContent=``},parentOf:e=>e.parentNode,nextOf:e=>e.nextSibling,createContainer:()=>n.createDocumentFragment(),controlled:D_,runsMounts:!0,commit(){for(let e of x)e.open&&e.isConnected||x.delete(e);if(b.size>0)for(let e of P_([...b]))e.isConnected?T||ne(e,`modal`):b.delete(e);for(let e of D)e.isConnected?z_.get(e)?.get(`popoverOpen`)===!0?re.add(e):ce(e,!1):D.delete(e);if(re.size>0){let e=P_([...re]);re.clear();for(let t of e)T&&!D.has(t)?re.add(t):ce(t,!0,!0)}},pause(t){if(T=t,!t){this.commit(),ie.clear();return}let n=Array.from(e.querySelectorAll(`[popover]`)).filter(e=>!D.has(e)&&z_.get(e)?.get(`popoverOpen`)===!0&&N_(e,`:popover-open`));for(let e of[...x].reverse())v.has(e)&&(C(e,!0),oe(e));for(let e of n.reverse())N_(e,`:popover-open`)&&e.hidePopover(),re.add(e),oe(e)},head:ke===void 0?void 0:e=>ke.sync(e),transitions:dm((e,t)=>{if(typeof n.startViewTransition!=`function`||r?.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches===!0)return e();let i=!1,a=()=>{i=!0,e()};try{m=n.startViewTransition(t.length>0&&`types`in(r?.ViewTransition?.prototype??{})?{update:a,types:[...t]}:a)}catch(t){if(i)throw t;return e()}m.ready.catch(R_),m.finished.catch(R_)}),dispose(){m?.skipTransition(),m=void 0,ke?.release();for(let t of e.querySelectorAll(`*`))delete t.$r;for(let t of i)e.removeEventListener(t,Ee,!0);i.clear(),Se()}}},H_={closed:!1},U_=(e,t,n)=>{let r={};for(let i in e){let a=e[i];r[i]={"~fire":(e,r,i)=>t(r,a,e,n[r]?.preventDefault===!0?i:void 0)}}return r},W_=(e,t)=>{let n=t?.warn??(e=>console.warn(e)),r=new Map,i=0,a,o,s=()=>o??=V_(e.documentElement,{warn:n}),c={createElement:e=>s().createElement(e),createText:t=>e.createTextNode(t),createContainer:()=>e.createDocumentFragment(),setText:(e,t)=>s().setText(e,t),normalizeAttrs:(e,t)=>s().normalizeAttrs(e,t),setAttr:(e,t,n,r)=>s().setAttr(e,t,n,r),setProp:(e,t,n)=>s().setProp(e,t,n),insertBefore:(e,t,n)=>s().insert(e,t,n??null),remove:e=>{let t=e.parentNode;t!==null&&s().remove(t,e)},parentOf:e=>e.parentNode??void 0,nextOf:e=>e.nextSibling??void 0,setEvents:(e,t,n,r)=>s().setEvents(e,{v:{handlers:U_(t,n,r),eventOptions:r},inst:H_},!0),elements:[og],controlled:D_,runsMounts:!0,commit:()=>o?.commit?.(),head:t=>(a??=Pg(e,n)).sync(t),dispose:()=>{a?.release(),a=void 0,o?.dispose(),o=void 0}},l=(e,t)=>V_(e,{...t,warn:n}),u=(e,t)=>{let n=e,i=l(n,t);return r.set(n,i),{...i,dispose:()=>{r.get(n)===i&&r.delete(n),i.dispose()}}};return lm.set(c,{make:(e,t)=>e.nodeType===void 0?void 0:u(e,t)}),{host:c,raw:l,make:u,held:()=>i>0,hold:(e,t)=>{i+=t?1:-1,r.get(e)?.pause(t)}}},G_={focus:(e,t)=>e.focus(t),blur:e=>e.blur(),scrollIntoView:(e,t)=>e.scrollIntoView(t),measure:e=>{let t=e.getBoundingClientRect();return{x:t.x,y:t.y,width:t.width,height:t.height,top:t.top,right:t.right,bottom:t.bottom,left:t.left}},select:e=>{let t=e,n=z_.get(t)?.get(`value`);typeof n==`string`&&t.value!==n&&(t.value=n),typeof t.select==`function`&&t.select()},requestSubmit:e=>{let t=e.localName===`form`?e:e.form??null;return t===null||typeof t.requestSubmit!=`function`?!1:(t.requestSubmit(),!0)},showPicker:e=>{let t=e;try{if(typeof t.showPicker==`function`)t.showPicker();else if(t.type===`file`&&!t.matches(`:disabled`))t.click();else return!1;return!0}catch{return!1}}},K_=(e,t,n,r)=>Fn(J_(e,t,n,r)),q_,J_=(e,t,n,r)=>Y_(e,t,n,r,void 0),Y_=(e,t,n,r,i)=>Wt(function*(){let{host:a,raw:o,make:s,held:c,hold:l}=W_(n.ownerDocument);yield*fa(()=>P(a.dispose));let u=C(yield*y_(n.ownerDocument,G_,c),Mm,{host:a}),d=yield*Ia(),f=Qh(n),p=Zh(e,n),m=p?.hasSnapshot===!0?void 0:i;m!==i&&(n.textContent=``);let h=oe(d,Bt)===void 0?q_??=lg():void 0,g=h===void 0?u:C(u,Bt,h),_=f!==void 0&&B(d,pp)===fp?C(u,pp,f.messageLog):u,v=yield*Ie(Sm(e,t,n,s,[og],{...r,hydrate:m,hot:p,scheduler:h}),_),y=ev(e,v,n,ci(d,g),(e,t)=>$_(o(e,t)),()=>l(n,!0),()=>l(n,!1)),b=B(d,Q_),x=(f!==void 0&&b===Z_?f.controllables:b).register(y);return yield*fa(()=>G(P(x),y.resume)),v}),X_=()=>{},Z_={register:()=>X_},Q_=ro(`@effect/ui/html/BrowserHost/Controllables`,{defaultValue:()=>Z_}),$_=e=>({...e,runsMounts:!1,setAttr:(t,n,r,i)=>e.setAttr(t,n,n===`popover`&&r!==void 0?`manual`:r,i),setProp:(t,n,r)=>{if(n!==`open`||r!==`modal`)return e.setProp(t,n,r);e.setAttr(t,`popover`,`manual`),e.setProp(t,`popoverOpen`,!0)}}),ev=(e,t,n,r,i,a,o)=>{let s=B(r,ga),c=n.style,l,u,d=e=>e===void 0?wr:G(vi(e.scope,nr),P(()=>e.copy.remove())),f=(e,[t,n])=>{t===``?e.removeProperty(`display`):e.setProperty(`display`,t,n)},p=()=>(u===void 0&&(u=[c.getPropertyValue(`display`),c.getPropertyPriority(`display`)],a(),c.setProperty(`display`,`none`,`important`)),u),m=P(()=>{u!==void 0&&(f(c,u),u=void 0,o())}),h=A(()=>{let e=l;return l=void 0,G(d(e),m)});return{session:t.session,path:t.path,pause:a=>Rn(Wt(function*(){let o=yield*Ma(s,`sequential`),c=n.cloneNode(!1);f(c.style,p()),c.setAttribute(`inert`,``),(l?.copy??n).after(c);let u=yield*km(e,t.instance.props,c,a,i,[og]).pipe(Ie(C(r,ga,o)),dt(()=>G(d({scope:o,copy:c}),l===void 0?m:wr))),h=l;return l={scope:o,copy:c},yield*d(h),u})),resume:h,instance:e=>{let n=t.find(e);return n===void 0?void 0:{instance:e,path:n.path,component:n.component.definition.name,message:n.component.definition.message,dispatch:e=>t.dispatch(n,e)}}}},tv=`50 millis`,nv=`200 millis`,rv=e=>av(e,!1),iv=new WeakSet,av=(e,t)=>Sn(Wt(function*(){let n=e.window??globalThis.window,r=n.document;if(iv.has(r))return yield*$i(Error(`BrowserRouter: this document already has a Router`));iv.add(r),yield*fa(()=>P(()=>iv.delete(r)));let{routes:i}=e,a=e.scroll!==!1,o=e.announce!==!1,s=e.focus!==!1,c=n.location,l=n.history;if(t)i.setBase(`#`);else if(typeof e.base==`string`)i.setBase(e.base);else if(e.base!==void 0){let t=c.pathname.split(`/`)[1]??``;i.setBase(t!==``&&e.base(t)?`/${t}`:``)}else i.setBase(``);let u=()=>t?c.hash===``?`#/`:c.hash:c.pathname+c.search+c.hash,d=new Map;if(a&&`scrollRestoration`in l){let e=l.scrollRestoration;l.scrollRestoration=`manual`,yield*fa(()=>P(()=>l.scrollRestoration=e))}let f=e=>{if(e.length<=1)return null;let t=decodeURIComponent(e.slice(1));return r.getElementById(t)??r.getElementsByName(t)[0]??null},p=e=>{let t=f(e);t===null?n.scrollTo(0,0):t.scrollIntoView()},m;if(o){let e=r.createElement(`div`);e.setAttribute(`aria-live`,`assertive`),e.setAttribute(`aria-atomic`,`true`),e.setAttribute(`style`,`position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0`),r.body.appendChild(e),m=e,yield*fa(()=>P(()=>e.remove()))}let h=e=>{if(typeof n.requestAnimationFrame==`function`){let t=n.requestAnimationFrame(e);return()=>n.cancelAnimationFrame(t)}let t=setTimeout(e,0);return()=>clearTimeout(t)},g;yield*fa(()=>P(()=>g?.()));let _=e=>e.focus({preventScroll:!0}),v=()=>{let e=r.body;if(r.activeElement!==null&&r.activeElement!==e)return;let t=e.getAttribute(`tabindex`);e.setAttribute(`tabindex`,`-1`),_(e),t===null?e.removeAttribute(`tabindex`):e.setAttribute(`tabindex`,t)},y=e=>{let{action:r,hash:i}=e.location;if(e.quiet){if(a&&e.scroll){let t=r===`pop`?d.get(e.index):void 0;n.scrollTo(t?.x??0,t?.y??0)}return}let o=e.container,l=s?o.querySelector(`[autofocus]`):null,u=s&&r===`push`&&!t?f(i):null;if(a){if(r===`pop`){let t=d.get(e.index);n.scrollTo(t?.x??0,t?.y??0)}else p(t?``:i)}if(s&&(l===null?u===null?v():(u.tabIndex<0&&!u.hasAttribute(`tabindex`)&&u.setAttribute(`tabindex`,`-1`),_(u)):_(l)),m!==void 0){let t=m,n=(e.title??``).trim()||(o.querySelector(`h1`)?.textContent??``).trim()||new URL(e.location.url,c.href).pathname,r=e.location.seq;t.textContent=``,g?.(),g=h(()=>{g=void 0,S.location().seq===r&&(t.textContent=n)})}},b={current:()=>({url:u(),state:l.state}),push:(e,t)=>l.pushState(t,``,e),replace:(e,t)=>l.replaceState(t,``,e),go:e=>l.go(e),load:e=>c.assign(e),listen:e=>{let t=()=>e(u(),l.state);return n.addEventListener(`popstate`,t),()=>n.removeEventListener(`popstate`,t)}},x=()=>{},ee=qh({routes:i,history:b,throttle:{interval:nv,flushOn:e=>(x=e,n.addEventListener(`pagehide`,e),()=>n.removeEventListener(`pagehide`,e))},onSettled:y,onHash:(e,t,r)=>{if(!a)return;let i=t===`pop`?d.get(r):void 0;i===void 0?p(e):n.scrollTo(i.x,i.y)},onLeave:e=>{d.set(e,{x:n.scrollX,y:n.scrollY})}}),te=yield*xe(ee),S=B(te,_h),w=e=>{if(e.origin===c.origin)return t?e.pathname===c.pathname&&e.search===c.search&&e.hash!==``?e.hash:void 0:e.pathname+e.search+e.hash},ne=(e,t)=>{t===void 0||un(i.parse(t))||(e.preventDefault(),yo(S.navigate(t)))},re=e=>e.composedPath().find(e=>`localName`in e&&e.localName===`a`&&e.hasAttribute(`href`)),T=e=>{let t=e.getAttribute(`target`);if(t!==null&&t!==``&&t!==`_self`||e.hasAttribute(`download`))return;let n=w(new URL(e.getAttribute(`href`),r.baseURI));return n===void 0||un(i.parse(n))?void 0:n},ie=e=>{if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=re(e);t!==void 0&&(x(),ne(e,T(t)))},ae=yield*Ia(),oe,E,D=()=>{oe=void 0,E?.interruptUnsafe(),E=void 0},se=e=>{let t=re(e);if(t===oe||(D(),t===void 0))return;oe=t;let n=T(t);n!==void 0&&(E=Lt(ae)(G(Ae(tv),A(()=>(E=void 0,S.intent(n))))))},ce=e=>{if(oe===void 0)return;let t=e.relatedTarget;t!==null&&`nodeType`in t&&oe.contains(t)||D()},le=e=>{D();let t=re(e),n=t===void 0?void 0:T(t);n!==void 0&&yo(S.intent(n))},ue=e=>{let t=S_.has(e);if(e.defaultPrevented&&!t)return;let n=e.target;if(n===null||n.localName!==`form`)return;x();let i=e.submitter;if(w_(n,i)!==`get`)return;let a=i?.getAttribute(`formaction`)??C_(n,`action`)??``,o=new URL(a,r.baseURI),s=new FormData(n,i??void 0),c=new URLSearchParams;for(let[e,t]of s)typeof t==`string`&&c.append(e,t);o.search=c.toString(),o.hash=``;let l=w(o);t?yo(l===void 0?S.load(o.href):S.navigate(l)):ne(e,l)},de=new WeakSet,fe=e=>{de.delete(e)},pe=e=>t=>{de.has(t)||(de.add(t),e(t))},me=[[`click`,pe(ie)],[`submit`,pe(ue)],[`mouseover`,pe(se)],[`focusin`,pe(se)],[`mouseout`,pe(ce)],[`focusout`,pe(ce)],[`touchstart`,pe(le),{passive:!0}]],O=e=>{for(let[t,n,r]of me)e.addEventListener(t,fe,{capture:!0,passive:!0}),e.addEventListener(t,n,r)},he=e=>{for(let[t,n]of me)e.removeEventListener(t,fe,!0),e.removeEventListener(t,n)},ge=new Map;O(r),yield*fa(()=>P(()=>{D(),he(r);for(let e of ge.keys())he(e)}));let _e=gt(te,fu);return C(te,fu,{..._e,attach:e=>{let t=_e.attach(e),n=e.container.getRootNode?.();if(n===void 0||!(`host`in n))return t;let r=n,i=ge.get(r)??0;return i===0&&O(r),ge.set(r,i+1),()=>{t();let e=ge.get(r);e>1?ge.set(r,e-1):(ge.delete(r),he(r))}}})})),ov=(e,t,n,r)=>i=>n(n=>{try{let t=$h(r(n),i);t!==void 0&&e(t,sv)}catch(e){t(K(e))}}),sv=()=>{},cv=Gg,lv=(e,t)=>{let n={query:e,handler:t},r=(t,r,i,a)=>{let o=B(t,cv),s=ov(r,i,a,e=>(Jg(e)??n).handler),c,l=e=>{if(c!==void 0)return void c.push(...e);c=e;for(let e=0;e<c.length;e++)s(c[e]);c=void 0},u=o.matches(e),d=()=>{let e=u;return u=void 0,e===void 0?[]:[e]};return{initial:P(()=>l(d())),close:o.listen(e,e=>l([...d(),e]))}};return Object.assign(cm(`@effect/ui/html/mediaQuery`,e,()=>Wr),{[qg]:n,[hu]:r})},uv=class extends ti()(`AuthError`,{cause:ue(an()),error:ae(Tn([`access_denied`,`temporarily_unavailable`])),message:q}){get name(){return this.error===`temporarily_unavailable`?`AuthUnavailable`:`AuthError`}},dv=W(Mt,Pa(`UserId`)),fv=W(Ue,Pa(`GitHubId`));W(sa,Zi(fv));var pv=Y({admin:fn,id:dv,name:Mt});Ut()(`@deslop/runtime/shared/auth/CurrentAdmin`);var mv=class extends ha()(`@deslop/runtime/shared/auth/RpcAdmin`,{error:uv}){};Y({address:U(Mt),onBehalfOf:U(dv),session:U(Mt)}),dv.make(`github:0`);function hv(e){return`${new URL(e).origin}/auth/sign-in?${new URLSearchParams({next:e})}`}function gv(e){return Ha(uv)(e)&&e.error===void 0}function _v(e){return Ha(uv)(e)&&e.error!==`temporarily_unavailable`}function vv(e){return t=>W(t,He(`10 seconds`),f(t=>Ha(uv)(t)?t:uv.make({cause:t,error:`temporarily_unavailable`,message:e})))}Yr(5),Yr(15),Ut()(`@deslop/runtime/shared/auth/CurrentUser`);var yv=class extends ha()(`@deslop/runtime/shared/auth/RpcAuth`,{error:uv}){},bv=q.check(Yt(e=>L(Zn(s(e)),e=>qa([`http:`,`https:`],e.protocol)&&e.username===``&&e.password===``&&e.hash===``),{expected:`an HTTP(S) URL without credentials or a fragment`})).check(Yt(e=>L(Zn(s(e)),e=>e.pathname===`/`&&e.search===``),{expected:`an HTTP(S) origin without a path or query`}));bv.check(Yt(e=>L(Zn(s(e)),e=>e.protocol===`https:`||qa([`localhost`,`127.0.0.1`,`[::1]`],e.hostname)),{expected:`HTTPS outside loopback`})),q.check(Ht(/^\d{1,5}$/u),Yt(e=>L(Ja(e),e=>e>=1&&e<=65535),{expected:`a port between 1 and 65535`}));var xv=q.check(Ht(/^0\.1\.\d+$/u)),Sv=`/api/runtime`,Cv=`/api/account`,wv=Y({auth:U(bv),name:q,traces:U(bv),version:xv}),Tv=`/api/rpc`,Ev=Y({...pv.fields,signOut:fn});Y({config:Y({port:Ue}),name:q,version:xv}),Tn([`web`,`mobile`,`server`]);function Dv(e,t,n,r){return Be(Vi(Wt(function*(){let i=`${yield*mt}`,a=yield*_,o={attributes:{"scope.run.started_unix_nano":i,"scope.runtime":n,"service.instance.id":i},serviceName:e,serviceVersion:v(nn(r,e=>e!==`0.1.0`))};return la(Pi(Qr({resource:o,url:new URL(`/v1/traces`,t).href}),qn({resource:o,url:new URL(`/v1/logs`,t).href}),Jn(_,[...a,`code`,`state`,`request`,`access_token`,`refresh_token`,`id_token`,`client_secret`,`client_assertion`,`code_verifier`,`session`,`token`,`api_key`,`key`])),[Bi,Kt])})),e=>Ze(e)?Fn(Za):Fn(E(`Telemetry is unavailable`)))}function Ov(e){return Vi(Wt(function*(){let t=yield*W((yield*se).get(Sv),Gn(pt),Gn(di(wv)),He(`3 seconds`),oa(e=>E(`Telemetry is off: the runtime config did not load`,e)),ve);return J(t,{onNone:()=>Ot,onSome:t=>J(t.traces,{onNone:()=>Ot,onSome:n=>Dv(`${e}-client`,n,`web`,t.version)})})}))}function kv(e,t){return W(re(`${e}${Cv}`,{headers:t}),Gn(fo(function*(e){return e.status===401?yield*uv.make({message:`Sign in first`}):e.status===403?yield*uv.make({error:`access_denied`,message:`This account is refused`}):yield*W(e,pt,Gn(di(Ev)))})),vv(`The server could not be reached`))}var Av=class extends ha()(`@deslop/runtime/shared/rpc/RpcStream`){};Jn(Av,Av.of((e,t)=>Bn(t.rpc.successSchema)?G(Qn(`rpc.stream`,!0),e):e));var jv=cr(Av,e=>Wt(function*(){return Bn(e.rpc.successSchema)&&(yield*Qn(`rpc.stream`,!0)),yield*e.next(e.request)})),Mv=Yr(1),Nv=On(gr,Wt(function*(){let e=yield*gr,t=yield*dn,n=Fi(),r=Fi();function i(e){let t=ua(r,e);return Yn(r,e),t}function a(t,r){return A(()=>J(i(r),{onNone:()=>wr,onSome:i=>{let a=Gr.make({reason:j(i.sent,{onFalse:()=>m.make({cause:`The socket did not open`,kind:`Timeout`}),onTrue:()=>on.make({cause:`No answer within ${Fa(Mv)}`})})}),o=W(n,ua(t),J({onNone:()=>wr,onSome:e=>e({_tag:`ClientProtocolError`,error:a,requestIds:[r]})}));return i.sent?G(o,w(e.send(t,{_tag:`Interrupt`,requestId:r}),{log:`Warn`,message:`The server was not told to stop an unanswered request`})):o}}))}function o(e){return or(e,e=>J(i(e),{onNone:()=>wr,onSome:e=>bo(e.deadline)}),{concurrency:1,discard:!0})}function s(e){return W(ei(r),rt,R(t=>W(r,ua(t),L(t=>t.clientId===e))))}return gr.of({...e,run:(t,r)=>A(()=>(Hi(n,t,r),Ai(e.run(t,e=>W(e,me({Chunk:e=>o([e.requestId]),ClientProtocolError:e=>o(e.requestIds??s(t)),Defect:()=>o(s(t)),Exit:e=>o([e.requestId]),Pong:()=>wr,Request:()=>wr}),G(r(e)))),P(()=>Yn(n,t))))),send:(n,i,s)=>me(i,{Ack:()=>e.send(n,i,s),Eof:()=>e.send(n,i,s),Interrupt:t=>G(o([t.requestId]),e.send(n,i)),Ping:()=>e.send(n,i,s),Request:i=>Wt(function*(){let c={clientId:n,deadline:yield*W(a(n,i.id),Pr(Mv),io(t)),sent:!1};Hi(r,i.id,c),yield*dt(e.send(n,i,s),()=>o([i.id])),c.sent=!0})})})}));function Pv(e){return W(Nv,la(kr({pingTimeout:`15 seconds`})),la(e),$r(Ji()),$r(jv))}ti()(`WriteError`,{cause:an(),message:q});var Fv=tr(Kt).atom(kv(``)),Iv=Pv(la(be(P(()=>`${location.origin}${Tv}`)),We));function Lv(e){tr.addGlobalLayer(la(Ov(e),Kt))}var Rv=za(e=>{let t=oo(Zr(ne(e),()=>Cn));return oo(e=>(e.subscribe(t,t=>{Aa(t)&&e.setSelf(t.value)}),In()))}),zv;(function(e){e.Unimplemented=`UNIMPLEMENTED`,e.Unavailable=`UNAVAILABLE`})(zv||={});var Bv=class extends Error{constructor(e,t,n){super(e),this.message=e,this.code=t,this.data=n}},Vv=e=>e?.androidBridge?`android`:e?.webkit?.messageHandlers?.bridge?`ios`:`web`,Hv=e=>{let t=e.CapacitorCustomPlatform||null,n=e.Capacitor||{},r=n.Plugins=n.Plugins||{},i=()=>t===null?Vv(e):t.name,a=()=>i()!==`web`,o=e=>!!(l.get(e)?.platforms.has(i())||s(e)),s=e=>n.PluginHeaders?.find(t=>t.name===e),c=t=>e.console.error(t),l=new Map;return n.convertFileSrc||=e=>e,n.getPlatform=i,n.handleError=c,n.isNativePlatform=a,n.isPluginAvailable=o,n.registerPlugin=(e,a={})=>{let o=l.get(e);if(o)return console.warn(`Capacitor plugin "${e}" already registered. Cannot register plugins twice.`),o.proxy;let c=i(),u=s(e),d,f=async()=>(!d&&c in a?d=d=typeof a[c]==`function`?await a[c]():a[c]:t!==null&&!d&&`web`in a&&(d=d=typeof a.web==`function`?await a.web():a.web),d),p=(t,r)=>{if(u){let i=u?.methods.find(e=>r===e.name);if(i)return i.rtype===`promise`?t=>n.nativePromise(e,r.toString(),t):(t,i)=>n.nativeCallback(e,r.toString(),t,i);if(t)return t[r]?.bind(t)}else if(t)return t[r]?.bind(t);else throw new Bv(`"${e}" plugin is not implemented on ${c}`,zv.Unimplemented)},m=t=>{let n,r=(...r)=>{let i=f().then(i=>{let a=p(i,t);if(a){let e=a(...r);return n=e?.remove,e}throw new Bv(`"${e}.${t}()" is not implemented on ${c}`,zv.Unimplemented)});return t===`addListener`&&(i.remove=async()=>n()),i};return r.toString=()=>`${t.toString()}() { [capacitor code] }`,Object.defineProperty(r,"name",{value:t,writable:!1,configurable:!1}),r},h=m(`addListener`),g=m(`removeListener`),_=(e,t)=>{let n=h({eventName:e},t).then(e=>e),r=async()=>{let t=await n;await g({eventName:e,callbackId:t})},i=new Promise(e=>n.then(()=>e({remove:r})));return i.remove=async()=>{console.warn(`Using addListener() without 'await' is deprecated.`),await r()},i},v=new Proxy({},{get(e,t){switch(t){case`$$typeof`:return;case`toJSON`:return()=>({});case`addListener`:return u?_:h;case`removeListener`:return g;default:return m(t)}}});return r[e]=v,l.set(e,{name:e,proxy:v,platforms:new Set([...Object.keys(a),...u?[c]:[]])}),v},n.Exception=Bv,n.DEBUG=!!n.DEBUG,n.isLoggingEnabled=!!n.isLoggingEnabled,n},Uv=(e=>e.Capacitor=Hv(e))(typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:typeof global<`u`?global:{}),Wv=Uv.registerPlugin,Gv=class{constructor(){this.listeners={},this.retainedEventArguments={},this.windowListeners={}}addListener(e,t){let n=!1;this.listeners[e]||(this.listeners[e]=[],n=!0),this.listeners[e].push(t);let r=this.windowListeners[e];return r&&!r.registered&&this.addWindowListener(r),n&&this.sendRetainedArgumentsForEvent(e),Promise.resolve({remove:async()=>this.removeListener(e,t)})}async removeAllListeners(){this.listeners={};for(let e in this.windowListeners)this.removeWindowListener(this.windowListeners[e]);this.windowListeners={}}notifyListeners(e,t,n){let r=this.listeners[e];if(r)r.forEach(e=>e(t));else if(n){let n=this.retainedEventArguments[e];n||=[],n.push(t),this.retainedEventArguments[e]=n}}hasListeners(e){return!!this.listeners[e]?.length}registerWindowListener(e,t){this.windowListeners[t]={registered:!1,windowEventName:e,pluginEventName:t,handler:e=>{this.notifyListeners(t,e)}}}unimplemented(e=`not implemented`){return new Uv.Exception(e,zv.Unimplemented)}unavailable(e=`not available`){return new Uv.Exception(e,zv.Unavailable)}async removeListener(e,t){let n=this.listeners[e];if(!n)return;let r=n.indexOf(t);r!==-1&&this.listeners[e].splice(r,1),this.listeners[e].length||this.removeWindowListener(this.windowListeners[e])}addWindowListener(e){window.addEventListener(e.windowEventName,e.handler),e.registered=!0}removeWindowListener(e){e&&(window.removeEventListener(e.windowEventName,e.handler),e.registered=!1)}sendRetainedArgumentsForEvent(e){let t=this.retainedEventArguments[e];t&&(delete this.retainedEventArguments[e],t.forEach(t=>{this.notifyListeners(e,t)}))}},Kv=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),qv=e=>e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent),Jv=class extends Gv{async getCookies(){let e=document.cookie,t={};return e.split(`;`).forEach(e=>{if(e.length<=0)return;let[n,r]=e.replace(/=/,`CAP_COOKIE`).split(`CAP_COOKIE`);n=qv(n).trim(),r=qv(r).trim(),t[n]=r}),t}async setCookie(e){try{let t=Kv(e.key),n=Kv(e.value),r=e.expires?`; expires=${e.expires.replace(`expires=`,``)}`:``,i=(e.path||`/`).replace(`path=`,``),a=e.url!=null&&e.url.length>0?`domain=${e.url}`:``;document.cookie=`${t}=${n||``}${r}; path=${i}; ${a};`}catch(e){return Promise.reject(e)}}async deleteCookie(e){try{document.cookie=`${e.key}=; Max-Age=0`}catch(e){return Promise.reject(e)}}async clearCookies(){try{let e=document.cookie.split(`;`)||[];for(let t of e)document.cookie=t.replace(/^ +/,``).replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(e){return Promise.reject(e)}}async clearAllCookies(){try{await this.clearCookies()}catch(e){return Promise.reject(e)}}};Wv(`CapacitorCookies`,{web:()=>new Jv});var Yv=async e=>new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{let e=r.result;t(e.indexOf(`,`)>=0?e.split(`,`)[1]:e)},r.onerror=e=>n(e),r.readAsDataURL(e)}),Xv=(e={})=>{let t=Object.keys(e);return Object.keys(e).map(e=>e.toLocaleLowerCase()).reduce((n,r,i)=>(n[r]=e[t[i]],n),{})},Zv=(e,t=!0)=>e?Object.entries(e).reduce((e,n)=>{let[r,i]=n,a,o;return Array.isArray(i)?(o=``,i.forEach(e=>{a=t?encodeURIComponent(e):e,o+=`${r}=${a}&`}),o.slice(0,-1)):(a=t?encodeURIComponent(i):i,o=`${r}=${a}`),`${e}&${o}`},``).substr(1):null,Qv=(e,t={})=>{let n=Object.assign({method:e.method||`GET`,headers:e.headers},t),r=Xv(e.headers)[`content-type`]||``;if(typeof e.data==`string`)n.body=e.data;else if(r.includes(`application/x-www-form-urlencoded`)){let t=new URLSearchParams;for(let[n,r]of Object.entries(e.data||{}))t.set(n,r);n.body=t.toString()}else if(r.includes(`multipart/form-data`)||e.data instanceof FormData){let t=new FormData;if(e.data instanceof FormData)e.data.forEach((e,n)=>{t.append(n,e)});else for(let n of Object.keys(e.data))t.append(n,e.data[n]);n.body=t;let r=new Headers(n.headers);r.delete(`content-type`),n.headers=r}else(r.includes(`application/json`)||typeof e.data==`object`)&&(n.body=JSON.stringify(e.data));return n},$v=class extends Gv{async request(e){let t=Qv(e,e.webFetchExtra),n=Zv(e.params,e.shouldEncodeUrlParams),r=n?`${e.url}?${n}`:e.url,i=await fetch(r,t),a=i.headers.get(`content-type`)||``,{responseType:o=`text`}=i.ok?e:{};a.includes(`application/json`)&&(o=`json`);let s,c;switch(o){case`arraybuffer`:case`blob`:c=await i.blob(),s=await Yv(c);break;case`json`:s=await i.json();break;default:s=await i.text()}let l={};return i.headers.forEach((e,t)=>{l[t]=e}),{data:s,headers:l,status:i.status,url:i.url}}async get(e){return this.request(Object.assign(Object.assign({},e),{method:`GET`}))}async post(e){return this.request(Object.assign(Object.assign({},e),{method:`POST`}))}async put(e){return this.request(Object.assign(Object.assign({},e),{method:`PUT`}))}async patch(e){return this.request(Object.assign(Object.assign({},e),{method:`PATCH`}))}async delete(e){return this.request(Object.assign(Object.assign({},e),{method:`DELETE`}))}};Wv(`CapacitorHttp`,{web:()=>new $v});var ey;(function(e){e.Dark=`DARK`,e.Light=`LIGHT`,e.Default=`DEFAULT`})(ey||={});var ty;(function(e){e.StatusBar=`StatusBar`,e.NavigationBar=`NavigationBar`})(ty||={});var ny=class extends Gv{async setStyle(){this.unavailable(`not available for web`)}async setAnimation(){this.unavailable(`not available for web`)}async show(){this.unavailable(`not available for web`)}async hide(){this.unavailable(`not available for web`)}};Wv(`SystemBars`,{web:()=>new ny});var ry=e=>e.isTrusted;function iy(e){for(let t=e.parentElement;t;t=t.parentElement)if(t instanceof HTMLFieldSetElement&&t.disabled&&!t.querySelector(`:scope > legend`)?.contains(e))return!0;return!1}var ay=new WeakMap;function oy(e,t){let n,r,i=!0,a=()=>{if(r){r.disconnect();for(let t=e.parentElement;t?.closest(`fieldset`);t=t.parentElement)r.observe(t,{childList:!0,attributeFilter:[`disabled`]})}let i=iy(e);i!==n&&t(n=i)},o=()=>{i&&(typeof MutationObserver<`u`&&(r=new MutationObserver(a)),a(),ay.set(e,a))};return e.isConnected?o():queueMicrotask(o),()=>{i=!1,r?.disconnect(),ay.delete(e)}}var sy=e=>e.disabled||e.formDisabled,cy=(e,t)=>oy(e,e=>t.set({formDisabled:e}));globalThis[Symbol.for(`ui-sdk.label-ids@1`)]??={count:0};var ly=new Set([`image-load`,`image-error`,`imperative`,`item-removed`,`unmount`,`reset`,`restore`,`timeout`,`resize`,`page-hide`]),uy;function dy(e,t){if(uy===`agent`)return uy;if(ly.has(e))return`programmatic`;if(t){let e=t();return e===`programmatic`&&uy?uy:e}return uy??`programmatic`}function fy(e,t){let n=uy;uy=e;try{return t()}finally{uy=n}}var py=(function(){let e=typeof document<`u`&&document.createElement(`link`).relList;return e&&e.supports&&e.supports(`modulepreload`)?`modulepreload`:`preload`})(),my=function(e){return`/`+e},hy={},gy=function(e){return e.pathname.endsWith(`.css`)},_y=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},vy=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=my(t,n);let r=s(t),i=gy(r);return _y(hy,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:py,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{let i=a=>{t.removeEventListener(`load`,i),t.removeEventListener(`error`,i),a.type===`error`?n(Error(`Unable to preload CSS for ${r}`)):e(a)};t.addEventListener(`load`,i),t.addEventListener(`error`,i)})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},yy=`Loading`,by=1e3,xy=new WeakSet,Sy=e=>!!e&&typeof e.then==`function`&&!xy.has(e),Cy=Symbol(`canceled action`);function wy(e,t,n){let r=e=>{n.failed(e)},i=()=>fy(t,n.done),a;try{a=e({source:t})}catch(e){return r(e)}if(a!==Cy){if(!Sy(a))return i();n.pending(!0),a.then(()=>{n.pending(!1),i()},e=>{n.pending(!1),r(e)})}}function Ty(e,t){let n=()=>{let t=e.options().pendingAnnouncement??yy;vy(async()=>{let{announce:e}=await import(`./announce-Bgi2X_K2.js`);return{announce:e}},[]).then(({announce:e})=>i&&e(t),()=>{})},r,i=!1,a=e.store.subscribe(()=>{let e=t();e!==i&&(i=e,clearTimeout(r),e&&(r=setTimeout(n,by)))});e.onDestroy(()=>{i=!1,clearTimeout(r),a()})}function Ey(e){return e.tagName===`BUTTON`?`button`:e.matches(`a[href]`)?`link`:`other`}function Dy(e){return{role:(t,n)=>e(t,n)===`other`?`button`:void 0,roles:[`button`]}}function Oy(e,t){let n=e===`button`,r=e===`unknown`,i=n||r,a=t.disabled&&!t.focusable,o=a&&!i?`-1`:e===`other`?`0`:void 0;return{type:i?t.type:void 0,disabled:i&&a?``:void 0,"aria-disabled":t.disabled&&(r||!(n&&a))?`true`:void 0,tabindex:t.tabindex??o}}function ky(e,t){let n=()=>typeof t.click==`function`?t.click():t.dispatchEvent(new MouseEvent(`click`,{bubbles:!0,cancelable:!0}));ry(e)?fy(`keyboard`,n):n()}function Ay(e,t){e.target===t&&Ey(t)===`other`&&(e.key===`Enter`?(e.preventDefault(),e.repeat||ky(e,t)):e.key===` `&&e.preventDefault())}function jy(e,t){e.target===t&&e.key===` `&&Ey(t)===`other`&&ky(e,t)}var My=new WeakMap,Ny,Py=0;function Fy(e){Py++;try{e()}finally{Py--}}function Iy(e){let t=Ny,n={starts:[]};Ny=n;let r;try{r=e()}finally{Ny=t}return My.set(r,n),t?t.starts.push(()=>(zy(r),()=>By(r))):typeof document<`u`&&zy(r),r}function Ly(e){Ny&&Ny.starts.push(e)}function Ry(e,t){let n=Ny,r={starts:[]};Ny=r;try{t()}finally{Ny=n}let i=My.get(e);if(i){i.starts.push(...r.starts);for(let e of i.stops?r.starts:[]){let t=e();t&&i.stops.push(t)}}}function zy(e){let t=My.get(e);if(!t||t.stops)return;let n=t.stops=[];for(let e of t.starts){let t=e();t&&n.push(t)}}function By(e){let t=My.get(e),n=t?.stops;n&&(t.stops=void 0,n.forEach(e=>e()))}function Vy(e){By(e),My.delete(e)}var Hy=Symbol.for(`ui-sdk.controller.attach`),Uy=Symbol.for(`ui-sdk.controller.detach`);function Wy(e,t){e?.[Hy]?.(t)}function Gy(e,t){e?.[Uy]?.(t)}function Ky(e,t){let n=e.options().controller,r=!1;Ly(()=>(r=!0,Wy(n,t),()=>{r=!1,Gy(n,t)})),e.onOptions(({controller:e})=>{e!==n&&(Gy(n,t),n=e,r&&Wy(e,t))})}var qy=new WeakMap;function Jy(e,t,n,r){let i=qy.get(e);if(!i)return n;let a=n??{};for(let o of i){if(!n&&o.from===`state`)continue;let i={...r,...a},s=o.from===`state`?e.view(i,()=>o.derive(i)):o.derive(a,r,t);a={...a};for(let e of o.keys)s&&e in s?a[e]=s[e]:o.from===`state`&&(a[e]=i[e])}return n||Object.keys(a).length?a:void 0}var Yy=new Set;function Xy(e){Yy.add(e),queueMicrotask(()=>{Yy.delete(e)&&e()})}var Zy=()=>globalThis[Symbol.for(`ui-sdk.styles@1`)]??=new WeakMap,Qy=new WeakMap;function $y(e){if(Qy.has(e))return Qy.get(e);let t;for(let n=e;n&&!t;n=n.defaultView?.frameElement?.ownerDocument)t=n.head?.querySelector(`meta[property="csp-nonce"]`);let n=t?t.nonce||t.getAttribute(`nonce`)||``:null;return Qy.set(e,n),n}function eb(e,t,n){if(!e.head)return;let r=e.defaultView;$y(e)===``&&r&&`adoptedStyleSheets`in e?rb(e,r,t,n):nb(e,t,n)}var tb=new WeakMap;function nb(e,t,n){let r=e.getElementById(t);if(r){if(tb.get(r)===n)return;r.textContent!==n&&(r.textContent=n),tb.set(r,n);return}let i=e.createElement(`style`);i.id=t;let a=$y(e);a&&(i.nonce=a),i.textContent=n,tb.set(i,n);let o=e.head.querySelectorAll(`:scope > style[id^="ui-sdk-"]`);o.length?o[o.length-1].after(i):e.head.prepend(i)}function rb(e,t,n,r){let i=Zy().get(e);i||Zy().set(e,i=new Map);let a=i.get(n);a||i.set(n,a={sheet:new t.CSSStyleSheet,css:``}),a.css!==r&&(a.sheet.replaceSync(r),a.css=r),e.adoptedStyleSheets.includes(a.sheet)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,a.sheet])}function ib(e){eb(e,`ui-sdk-hidden`,`@layer ui-sdk { :where([data-slot][hidden]:not([hidden="until-found"])) { display: none !important } }`)}function ab(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}function ob(e){let t=`nativeEvent`in e?e.nativeEvent:e;return t.isComposing===!0||t.keyCode===229}var sb=new WeakSet;function cb(e,t){return Object.is(e,t)?!0:!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length||sb.has(e)||sb.has(t)?!1:e.every((e,n)=>Object.is(e,t[n]))}function lb(e,t){let n=e,r=0,i=0,a,o,s=!1,c,l=new Set,u=new Map,d,f={get(){return c??p()},set(e,r=!1){if(a&&!r&&!s){let t=p();if(t!==n){let n={...t};for(let t in e)delete n[t];f.set(n,!0)}}let i=[];for(let t in e)cb(n[t],e[t])||i.push(t);if(!i.length)return;let o=n;n={...n,...e},m(i,o,i.every(e=>t.includes(e)),r)},subscribe(e){return l.add(e),()=>{l.delete(e)}},setFanout(e){d=e},follow(e){a=e},view(e,t){let n=c;c=e;try{return t()}finally{c=n}}};function p(){if(!a||s)return n;s=!0;let e;try{e=a(n)}finally{s=!1}if(!e)return n;if(o?.state===n&&o.over===e)return o.result;let t=n;for(let r in e)if(!cb(n[r],e[r])){t={...n,...e};break}return o={state:n,over:e,result:t},t}function m(e,t,n,a){n||r++,a||i++;let o=t=>t(n,a,e);l.forEach(o);for(let[t,n]of u)(!e.length||e.some(e=>!Object.hasOwn(t,e)))&&n.forEach(o);d?.(e,t,o)}return ub.set(f,{state:()=>n,renders:()=>r,writes:()=>i,touch:()=>m([],n,!1,!1),skipping:u}),f}var ub=new WeakMap;function db(e,t,n){return fb(ub.get(e).skipping,t,n)}function fb(e,t,n){let r=e.get(t);return r||e.set(t,r=new Set),r.add(n),()=>{r.delete(n),!r.size&&e.get(t)===r&&e.delete(t)}}var pb=e=>ub.get(e).state(),mb=e=>ub.get(e).renders(),hb=(e,t)=>{ub.set(e,ub.get(t))},gb=e=>ub.get(e).touch(),_b=e=>e.owner,vb=e=>_b(e).slots[e.slot],yb=(e,t)=>({id:e.id,key:e.key,props:t,api:e.api}),bb=(e,t=e.props)=>({el:e.el,id:e.id,key:e.key,props:t,store:e.store,api:e.api});function xb(e){let{parts:t}=e.owner,n=`${e.slot}:${e.key}`;t.has(n)||t.set(n,e),e.leases++;let r=!0;return()=>{if(!r||(r=!1,--e.leases))return;let{owner:t}=e;t.released.length||queueMicrotask(()=>Cb(t)),t.released.push(e)}}function Sb(e){let{owner:t}=e;t.released.length||queueMicrotask(()=>Cb(t)),t.released.push(e)}function Cb(e){for(let t of e.released){let n=`${t.slot}:${t.key}`;!t.leases&&e.parts.get(n)===t&&e.parts.delete(n)}e.released=[]}function wb(e,t=e.props,n=e.store.get()){let r=vb(e),i=yb(e,t),a=r.attrs?.(n,i),o=r.role,s=typeof o==`function`?o(n,i):o,{name:c}=_b(e),l={"data-slot":e.slot===`root`?c:`${c}-${e.slot}`,...o===void 0?void 0:{role:s},...a};return o!==void 0&&(l.role=s),Ib(e,l)}var Tb=new Set([`aria-label`,`aria-labelledby`,`aria-description`,`title`,`autocomplete`,`autocapitalize`,`autocorrect`,`spellcheck`,`inputmode`,`enterkeyhint`]),Eb=e=>typeof e==`string`&&e.split(/\s+/).every(e=>e.startsWith(`ui-sdk-`)),Db={};function Ob(e,t,n=e.props){let r=vb(e).selects,i=[xb(e),r?r.subscribe(e,t,n):db(e.store,Db,t)];return()=>i.forEach(e=>e())}function kb(e){let{on:t,press:n}=vb(e),r={};for(let n in t){let i=t[n];r[n]=t=>{t.defaultPrevented||Ub(t)||(_b(e).sleeping?.wake(),i(t,bb(e)))}}return typeof n==`function`&&!r.click&&(r.click=t=>{t.defaultPrevented||(_b(e).sleeping?.wake(),n(bb(e),t))}),r}function Ab(e){e.propsListeners?.forEach(e=>e())}var jb=new WeakMap;function Mb(e){let t=vb(e),n=jb.get(t);return n===void 0&&(n=!!t.attrs&&`hidden`in t.attrs(e.store.get(),yb(e,e.props)),jb.set(t,n)),n}function Nb(e,t,n={by:`core`}){let r=e,{parts:i}=r.owner,a=`${e.slot}:${e.key}`;!e.el&&(i.get(a)??r)===r&&(i.delete(a),i.set(a,r));let o={};e.el=t,r.binding=o;let s=[xb(r)];Mb(e)&&ib(t.ownerDocument);for(let[r,i]of Object.entries(kb(e)))(n.by===`core`||n.attaches!==`all`&&!n.attaches.includes(r))&&s.push(ab(t,r,i));let c=vb(e);c.live&&s.push(c.live.attach(e,t)),n.by===`framework`&&c.direct&&s.push(c.direct.attach(e,t));let l=c.asleep?.(t,e);l&&s.push(l);let u=()=>{let n=c.bind?.(t,e);n&&s.push(n)},{sleeping:d}=r.owner;return d&&c.bind?(d.binds.add(u),s.push(()=>d.binds.delete(u))):u(),c.attrs&&typeof MutationObserver<`u`&&s.push(Rb(r,t)),()=>{s.forEach(e=>e()),r.binding===o&&(e.el=r.binding=void 0,r.own!==void 0&&zb(r))}}var Pb=[`aria-activedescendant`,`aria-controls`,`aria-describedby`,`aria-details`,`aria-errormessage`,`aria-flowto`,`aria-labelledby`,`aria-owns`,`for`,`headers`],Fb=e=>vb(e).attrs?.(e.store.get(),yb(e,{...e.props,id:void 0})).id;function Ib(e,t){let{owner:n}=e;if(!n.named?.size||!Pb.some(e=>t[e]))return t;let r=Lb(n,e.store);if(!r.size)return t;let i={...t};for(let e of Pb){let t=i[e];t&&(i[e]=t.split(` `).map(e=>r.get(e)??e).join(` `))}return i}function Lb(e,t){let n=mb(t);if(e.aliases?.version===n)return e.aliases.map;let r=new Map;for(let t of e.named){let e=Fb(t);e!==void 0&&e!==t.own&&r.set(e,t.own)}return e.aliases={version:n,map:r},r}function Rb(e,t){(t.hasAttribute(`id`)||e.own!==void 0)&&zb(e);let n=new MutationObserver(()=>zb(e));return n.observe(t,{attributeFilter:[`id`]}),()=>n.disconnect()}function zb(e){let{owner:t}=e;t.unread||(t.unread=new Set,Xy(()=>Bb(t,e.store))),t.unread.add(e)}function Bb(e,t){let n=e.unread;e.unread=void 0;let r=e.renamed===!0;e.renamed=void 0;for(let e of n)r=Hb(e,e.el&&Vb(e.el))||r;r&&gb(t)}var Vb=e=>e.localName===`form`?e.getAttribute(`id`):e.id;function Hb(e,t){let n=Fb(e),r=t&&t!==n?t:void 0;if(r===e.own)return!1;let{owner:i}=e;return e.own=r,i.named??=new Set,r===void 0?i.named.delete(e):i.named.add(e),i.aliases=void 0,n!==void 0}function Ub(e){return(e.type===`keydown`||e.type===`keyup`)&&(typeof e.key!=`string`||ob(e))}var Wb={},Gb=new Set,Kb=new WeakMap;function qb(e,t,n){let r,i,a=()=>{r?.(),r=void 0,i&&Gb.delete(i),i=void 0};Ly(()=>{if(Wb.add)r=Wb.add(e,t,n);else if(typeof document<`u`&&(Gb.add(i=new WeakRef(e)),Kb.set(e,()=>r=Wb.add?.(e,t,n)),Gb.size%1e3==0))for(let e of Gb)e.deref()||Gb.delete(e);return a})}function Jb(e){let t=e.slots(e=>e),n=e.name,r=e.label??n,i=i=>{let a=i,o=i.id,s=lb({...e.state(a),...e.sync?.(a)},e.live??[]),c=[],l=[],u=Object.create(t),d=new Set;function f(e){d.has(e)||(d.add(e),Object.assign(u,e.slots),ee(),e.extend?.(b))}let p={name:n,label:r,slots:u,parts:new Map,released:[]},{parts:m}=p;function h(e={}){return e.id??(e.value==null?``:String(e.value))}let g;function _(e,t={},n=!1){let r=h(t),i=`${e}:${r}`,a=m.get(i);if(!a)m.set(i,a={slot:e,key:r,id:o,get api(){return b},store:s,props:t,el:void 0,owner:p,leases:0}),n&&Sb(a);else if(n)return a;return a.props=t,Ab(a),a}function v(e,t){if(t===void 0){for(let t of m.values())if(t.slot===e&&t.el?.isConnected)return t.el;return}let n=m.get(`${e}:${t}`)?.el;return n?.isConnected?n:void 0}let y={id:o,label:r,store:s,options:()=>a,onOptions:e=>l.push(e),onDestroy:e=>c.push(e),parts:()=>m.values(),element:v,props:(e,t=``)=>{let n=g?.[e];return n&&h(n)===t?n:m.get(`${e}:${t}`)?.props}},b;function x(){b=e.api(y),Ky(y,b)}function ee(){let{sleeping:e}=p;if(e){p.sleeping=void 0,Ry(C,x);for(let t of[...e.binds])t()}}e.asleep?.(a)?p.sleeping={wake:ee,binds:new Set}:x();let te=!1,S=(t,n)=>Jy(s,t,e.sync?.(t),n),C={types:void 0,name:n,id:o,get:s.get,subscribe:s.subscribe,get api(){return ee(),b},part:_,use:f,preview(e){let t=S({...e,id:o},s.get()),n=s.get();for(let e in t)if(!cb(n[e],t[e]))return{...n,...t}},view(e,t,n){let r=g;g=n;try{return s.view(e,t)}finally{g=r}},setOptions(t){let n=pb(s);a=t.id===o?t:{...t,id:o},p.sleeping&&!e.asleep(a)&&ee();let r=S(a,n),i;try{for(let e of l)i=e(a,r)??i;let e=pb(s)===n?r:S(a,pb(s));e&&fy(i,()=>s.set(e,!0))}finally{}},startState:t=>e.state({...t,id:o}),follow(e){let t,n,r=(r=pb(s),i)=>{if(i)return S({...i,id:o},r);if(te)return n;let a=e();return(t?.options!==a||t.state!==r)&&(t={options:a,state:r},n=S({...a,id:o},r)),n};return s.follow(r),r},destroy(){te||(te=!0,Vy(C),Fy(()=>c.forEach(e=>e())))}};return hb(C,s),qb(C,m,e),C},a=e=>Iy(()=>i(e));return Object.defineProperty(a,"name",{value:n}),Object.assign(a,{options:e.options,slots:t})}function Yb(e,t,n,r){r.source??dy(r.reason),r.reason}var Xb=`pointer`,Zb=!1,Qb=!1,$b=`mouse`,ex=!1,tx=()=>ex=!1,nx=null,rx=()=>nx=null;function ix(e){(e.key===`Enter`||e.key===` `)&&(nx=e.target,setTimeout(rx))}function ax(e){ix(e);let t=e.metaKey||e.ctrlKey||e.altKey||/^(Meta|Control|Alt|Shift)$/.test(e.key);e.key!==`Tab`&&t||(Xb=`keyboard`)}function ox(e){if(Xb=`pointer`,!(`pointerType`in e)){ex||($b=`touch`);return}ex=!0,setTimeout(tx);let t=e.pointerType;$b=lx(e)?`virtual`:t===`touch`||t===`pen`?t:`mouse`}function sx(){Zb||typeof document>`u`||(Zb=!0,document.addEventListener(`keydown`,ax,!0),document.addEventListener(`keyup`,ix,!0),document.addEventListener(`pointerdown`,ox,!0),document.addEventListener(`touchstart`,ox,{capture:!0,passive:!0}),window.addEventListener(`blur`,e=>{e.target}))}function cx(){Zb||Qb||(Qb=!0,queueMicrotask(sx))}function lx(e){return e.type===`pointermove`?!1:e.width===0&&e.height===0&&e.pressure===0||e.pointerType===`mouse`&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0}function ux(e){return e.detail>0?$b:nx&&nx.contains(e.target)?`keyboard`:`virtual`}var dx=()=>Xb===`keyboard`?`keyboard`:$b;function fx(e){if(sx(),!e)return dx();if(!ry(e))return`programmatic`;if(e.type.startsWith(`key`))return`keyboard`;if(e.type.startsWith(`touch`))return`touch`;if(e.type===`click`)return ux(e);let t=e.pointerType;return t===`mouse`||t===`touch`||t===`pen`?lx(e)?`virtual`:t:`button`in e?$b:dx()}var px=(e,t)=>dy(e,t&&(()=>fx(t)));function mx(){return cx(),px}function hx(e){let{store:t,options:n}=e,r=mx(),i=(n,r,i)=>{cb(t.get()[n],r)||(t.set({[n]:r}),Yb(e,n,r,{reason:`action`,source:i}))};return Ty(e,()=>t.get().pending),{internal:{press(e,a=t=>n().action?.(e,t)){let o=t.get();if(sy(o)||o.pending)return e?.preventDefault();let s=r(`action`,e);i(`error`,void 0,s),wy(a,s,{pending:e=>i(`pending`,e,s),done:()=>{},failed:e=>i(`error`,e,s)})}}}}var gx=hx,_x=Jb({name:`button`,options:{disabled:`boolean`,focusableWhenDisabled:`boolean`,type:`string`,pendingAnnouncement:`string`,action:`action`},state:e=>({disabled:!!e.disabled,formDisabled:!1,focusableWhenDisabled:!!e.focusableWhenDisabled,type:e.type??`button`,element:`unknown`,pending:!1,error:void 0}),sync:e=>({disabled:!!e.disabled,focusableWhenDisabled:!!e.focusableWhenDisabled,type:e.type??`button`}),api:e=>gx(e),slots:e=>({root:e({...Dy(e=>e.element),focus:`tab-stop`,state:e=>({disabled:sy(e),pending:e.pending,error:e.error}),attrs:e=>({...Oy(e.element,{type:e.type,disabled:sy(e),focusable:e.focusableWhenDisabled}),...e.pending&&!sy(e)&&{"aria-disabled":`true`},"aria-busy":e.pending?`true`:void 0,"data-disabled":sy(e)?``:void 0,"data-pending":e.pending?``:void 0}),press:({api:e},t)=>e.internal.press(t),on:{keydown:(e,{el:t})=>Ay(e,t),keyup:(e,{el:t})=>jy(e,t)},bind(e,{store:t}){return t.set({element:Ey(e)}),cy(e,t)}})})}),vx=new WeakMap,yx=new WeakMap,bx;function xx(e,t,n=`render`){Cx(e,t,n,!1)}function Sx(e,t){Cx(e,{},t,!0)}function Cx(e,t,n,r){let i=bx;bx=e;try{wx(e,t,n,r)}finally{bx=i}}function wx(e,t,n,r){let i=vx.get(e)??{},a=i[n]??new Map,o=new Map,s=t.style===void 0?[]:kx(t.style);for(let[e,t]of s)o.set(`style:${e}`,t);for(let[e,n]of Object.entries(t))n!==void 0&&e!==`style`&&o.set(e,n);let c=o.has(`id`)||a.has(`id`)?e.getAttribute(`id`):null,l=Dx(c,i,n);l&&o.delete(`id`);let u=new Set,d=new Map;for(let t of new Set([...o.keys(),...a.keys()])){if(!Tb.has(t))continue;let n=e.getAttribute(t);d.set(t,n),n===null||n===o.get(t)||t===`aria-labelledby`&&Eb(n)||Object.values(i).some(e=>e.get(t)===n)||u.add(t)}for(let e of u)o.delete(e);for(let t of a.keys()){if(o.has(t)||u.has(t)||t===`id`&&l)continue;if(t.startsWith(`style:`)){e.style.removeProperty(t.slice(6));continue}if(!r){e.removeAttribute(t),Tx(e,n,t,null);continue}let i=e.getAttribute(t);if(i!==a.get(t))continue;let s=yx.get(e)?.[n]?.get(t);s===void 0?e.removeAttribute(t):i!==s&&e.setAttribute(t,s)}for(let[t,n]of s)e.style.getPropertyValue(t)!==n&&e.style.setProperty(t,n);for(let[r,i]of Object.entries(t)){if(i===void 0||!o.has(r))continue;let t=r===`id`?c:d.has(r)?d.get(r):e.getAttribute(r);t!==(a.get(r)??null)&&Tx(e,n,r,t),t!==i&&(r===`value`&&Ox(e)&&e.value!==i&&(e.value=i),e.setAttribute(r,i))}i[n]=o,vx.set(e,i),r&&delete yx.get(e)?.[n]}function Tx(e,t,n,r){let i=r==null||n===`id`?void 0:Pb.includes(n)?Ex(r):r;if(i===void 0){yx.get(e)?.[t]?.delete(n);return}let a=yx.get(e);a||yx.set(e,a={}),(a[t]??=new Map).set(n,i)}var Ex=e=>e.split(/\s+/).filter(e=>e&&!e.startsWith(`ui-sdk-`)).join(` `)||void 0;function Dx(e,t,n){return e===null||e===t[n]?.get(`id`)?!1:!e.startsWith(`ui-sdk-`)||Object.values(t).some(t=>t.get(`id`)===e)}var Ox=e=>e.localName===`textarea`||e.localName===`input`&&e.type!==`file`;function kx(e){let t=[];for(let n of e.split(`;`)){let e=n.indexOf(`:`);e>0&&t.push([n.slice(0,e).trim(),n.slice(e+1).trim()])}return t}var Ax=ft(0),jx=Tn([`button`,`submit`,`reset`]),Mx=Pp(`BindButton`,{args:{disabled:fn,type:jx}},(e,t,n)=>Qa(_t(Li(P(()=>{let n=`ui-sdk-button-${ui(Ax)}`,r=_x({...t,id:n}),i=r.part(`root`),a=Nb(i,e);function o(){xx(e,wb(i))}let s=Ob(i,o);return o(),{id:n,instance:r,unbind:a,unsubscribe:s}}),({instance:t,unbind:n,unsubscribe:r})=>P(()=>{r(),n(),Sx(e,`render`),t.destroy()})),({id:e,instance:t})=>W(n,ao(n=>P(()=>t.setOptions({...n,id:e}))),hr))));function Nx(e,t={}){let n=t.type??`button`;return e.button.attr(`type`,n).attr(`aria-pressed`,v(N($e(t.pressed),e=>`${e}`))).onMount(Mx({disabled:t.disabled??!1,type:n}))}var Px=`#version 300 es
2
- void main() {
3
- vec2 p = vec2(float((gl_VertexID << 1) & 2), float(gl_VertexID & 2));
4
- gl_Position = vec4(p * 2. - 1., 0., 1.);
5
- }`,Fx=`#version 300 es
6
- precision highp float;
7
- uniform vec2 resolution;
8
- uniform float scale;
9
- uniform float corner;
10
- out vec4 color;
11
- void main() {
12
- vec2 p = (gl_FragCoord.xy - resolution * .5) / scale;
13
- vec2 halfSize = resolution * .5 / scale;
14
- float radius = min(min(halfSize.x, halfSize.y), corner);
15
- vec2 q = p - clamp(p, -halfSize + radius, halfSize - radius);
16
- float r = length(q);
17
- float depth = radius - r;
18
- float coverage = smoothstep(0., 1., depth);
19
- vec2 normal = q / max(r, 1.);
20
- float bevel = exp(-depth / 2.2);
21
- float sheen = max(dot(normal, normalize(vec2(-.35, 1.))), 0.);
22
- vec3 refracted = refract(vec3(0., 0., -1.), normalize(vec3(normal * bevel, 1.)), .68);
23
- float ambient = clamp(.5 + .74 * (p.y / (2. * halfSize.y) - refracted.y), 0., 1.);
24
- float reflection = bevel * (.10 + .40 * sheen);
25
- float opacity = coverage * (.018 + .115 * ambient + reflection);
26
- color = vec4(vec3((.79 + .13 * ambient) * opacity), opacity);
27
- }`;function Ix(e,t,n){let r=e.createShader(t);if(r!==null)return e.shaderSource(r,n),e.compileShader(r),r}function Lx(e){let t=e.getContext(`webgl2`,{alpha:!0,antialias:!1});if(t===null)return;let n=Ix(t,t.VERTEX_SHADER,Px),r=Ix(t,t.FRAGMENT_SHADER,Fx),i=t.createProgram();if(n===void 0||r===void 0)return;t.attachShader(i,n),t.attachShader(i,r),t.linkProgram(i),t.deleteShader(n),t.deleteShader(r),t.useProgram(i);let a=t.getUniformLocation(i,`resolution`),o=t.getUniformLocation(i,`scale`),s=t.getUniformLocation(i,`corner`),c=e,l=new ResizeObserver(()=>{if(e.clientWidth===0||e.clientHeight===0)return;let n=window.devicePixelRatio;c.width=Math.ceil(e.clientWidth*n),c.height=Math.ceil(e.clientHeight*n),t.viewport(0,0,e.width,e.height),t.uniform2f(a,e.width,e.height),t.uniform1f(o,n),t.uniform1f(s,W(getComputedStyle(e).borderTopLeftRadius,Di(`px`,``),Ja,z(H(0)))),t.drawArrays(t.TRIANGLES,0,3)});return l.observe(e),()=>{l.disconnect(),t.deleteProgram(i)}}var Rx=Pp(`Lens`,{args:{}},e=>Qa(Gi(Li(P(()=>Lx(e)),e=>P(()=>e?.())),Wr)));function zx(e,t){return e.div.class(`glass`,t).children(e.canvas.class(`glass-lens`).attr(`aria-hidden`,`true`).onMount(Rx({})))}function Bx(e,t,n,r){return zx(e,`glass-panel`).id(t).attrs({"aria-label":n,popover:`auto`,role:`group`}).children(e.div.class(`glass-panel-body`).children(r))}function Vx(e,t,n,r){return zx(e).children(Nx(e,{pressed:t}).class(r).attr(`aria-label`,`Sidebar`).on(`click`,()=>n).children(e.el(`svg`).attrs({"aria-hidden":`true`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,viewBox:`0 0 24 24`}).children(e.el(`path`).attr(`d`,`M4 4h16a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1Zm5 0v16`))))}var Hx=ft(0);Tn([`open`,`message`,`close`,`error`]);var Ux=class extends ti()(`ToolbarError`,{cause:an(),message:q}){},Wx=Wv(`DeslopNative`);function Gx(e,t){return wn({catch:t=>uv.make({cause:t,error:`temporarily_unavailable`,message:e}),try:t})}function Kx(e,t){return wn({catch:e,try:t})}function qx(e,t){return wn({catch:t=>Ux.make({cause:t,message:e}),try:t})}function Jx(e){return qx(`Could not update the native toolbar`,()=>Wx.setToolbar({items:e}))}function Yx(e,t){return W(Li(qx(`Could not listen for native toolbar actions`,()=>Wx.addListener(`toolbarAction`,e=>t(e.title))),e=>W(Jx([]),Ai(w(qx(`Could not stop listening for native toolbar actions`,()=>e.remove()),{log:`Warn`})),w({log:`Warn`}))),Gi(W(e,qi(pa),ao(Jx),hr)),Qa,er(e=>hr(ta(E(e)))))}var Xx=Gx(`This app has no server configured`,()=>Wx.config());_t(Xx,e=>e.server),_t(Xx,e=>e.bundle),_t(Gx(`Could not open Auth sign-in`,()=>Wx.signIn()),e=>e.signedIn),_t(Gx(`Sign-out was incomplete`,()=>Wx.signOut()),e=>e.status),vv(`The server could not be reached`)(Wt(function*(){let e=yield*Gx(`Could not read the account`,()=>Wx.account());return e.status===401?yield*uv.make({message:`Sign in first`}):e.status===403?yield*uv.make({error:`access_denied`,message:`This account is refused`}):e.status===200?yield*Mr(Un(Ev))(e.body):yield*uv.make({error:`temporarily_unavailable`,message:`The server could not be reached`})}));function Zx(e){return mo.make({reason:m.make({cause:e,kind:`Unknown`})})}function Qx(e){return mo.make({reason:on.make({cause:e})})}function $x(e){return mo.make({reason:Qt.make({cause:e})})}function eS(e){return xa(e)?new TextEncoder().encode(e):e}function tS(e,t,n){if(e.type===`open`){Ei(t,wr);return}if(e.type===`message`&&L(Oi(Ui)(e.data),e=>vt(n,e)))return;if(e.type===`close`){let r=mo.make({reason:Nt.make({code:e.code??1006})});Ei(t,Hr(Zx(r))),D(n,oi(r));return}let r=Qx(e.message??`The native socket could not deliver a frame`);Ei(t,Hr(Zx(r))),D(n,oi(r))}Pv(On(Ye,P(()=>{let e=Le(!1),t=ft(M()),n=Wt(function*(){let n=yield*P(()=>`rpc-${ui(Hx)}`),r=yield*Kr(),i=yield*pe(256);return yield*Li(Kx(Zx,()=>Wx.addListener(`socket`,e=>{e.id===n&&tS(e,r,i)})),r=>W(Kx(Qx,()=>Wx.closeSocket({id:n})),w({log:`Warn`}),Ai(G(P(()=>{L(p(t),e=>e===n)&&(Tt(t,M()),e.closeUnsafe())}),w(Kx(Qx,()=>r.remove()),{log:`Warn`}))))),yield*Kx(Zx,()=>Wx.openSocket({id:n})),yield*jn(Yi(r),{duration:`10 seconds`,orElse:()=>Hr(mo.make({reason:m.make({cause:`The native socket did not open`,kind:`Timeout`})}))}),Tt(t,V(n)),e.openUnsafe(),{pull:gi(i),upgrade:Te.unsupported}});function r(n){return e.whenOpen(A(()=>J(p(t),{onNone:()=>Hr($x(`The native socket closed`)),onSome:e=>pn(n)?Kx($x,()=>Wx.closeSocket({code:n.code,id:e})):W(Jr(Ui)(eS(n)),f(e=>mo.make({reason:Qt.make({cause:e})})),Gn(t=>Kx($x,()=>Wx.sendSocket({data:t,id:e}))))})))}return na({reader:n,writer:rn({write:r,writeAll:e=>or(e,r,{concurrency:1,discard:!0})})})})));var nS={"Airport travel":`location`,"New note":`square.and.pencil`,"Next page":`chevron.left`,"Note options":`ellipsis`,"Out of date. Retry":`exclamationmark.circle`,"Paste booking":`document.on.clipboard`,"Paste link":`plus`,"Previous page":`chevron.right`,"Queue options":`line.3.horizontal.decrease`,Share:`square.and.arrow.up`,Sidebar:`sidebar.left`,"Sign out":`rectangle.portrait.and.arrow.right`};function rS(e){return rt(e.querySelectorAll(`button[aria-label]:not([popover] *)`))}var iS=Pp(`NativeToolbar`,{args:{}},e=>Yx(ma(t=>Li(P(()=>{function n(){for(let t of e.querySelectorAll(`[popover]`))t.style.setProperty(`pointer-events`,`auto`);vt(t,fi(rS(e),e=>{let t=e.getAttribute(`aria-label`)??``,n=nS[t];return n===void 0||(e.setAttribute(`tabindex`,`-1`),e.style.setProperty(`pointer-events`,`none`),e.setAttribute(`aria-hidden`,`true`),e.getClientRects().item(0)===null)?ni(void 0):fr({disabled:e.disabled,leading:t===`Sidebar`,selected:e.getAttribute(`aria-pressed`)===`true`,symbol:n,title:t})}))}let r=new MutationObserver(n);return r.observe(e,{attributeFilter:[`aria-label`,`aria-pressed`,`disabled`],childList:!0,subtree:!0}),addEventListener(`resize`,n),n(),()=>{removeEventListener(`resize`,n),r.disconnect()}}),e=>P(e))),t=>{v(c(rS(e),e=>e.getAttribute(`aria-label`)===t&&e.getClientRects().item(0)!==null))?.click()}));function aS(e,t){let n=e.div.class(`shell-controls`).children(t.sidebar,t.actions!==void 0&&zx(e,`shell-actions`).children(t.actions));return e.div.class(`app-shell`).children(j(Uv.getPlatform()===`ios`,{onFalse:()=>n,onTrue:()=>n.attr(`style`,`position:fixed;inset-block-start:env(safe-area-inset-top,0px);inset-inline-end:env(safe-area-inset-right,0px);opacity:0;pointer-events:none;overflow:visible`).onMount(iS({}))}),t.content)}function oS(e,t){return Qa($a.useSync(n=>W(n,Ka(e),Mi(t))))}function sS(t,n){e(t.get(n))&&t.refresh(n)}Tn([`10m`,`1h`,`24h`,`7d`,`30d`]),Nr(1),xi(7),Yr(10),xi(1),xi(30);var cS=W(Je.check(lo({maximum:864e13,minimum:-864e13})),Zi(je,{decode:Pe(e=>kn(Ve(0),()=>e)),encode:Pe(kt)})),lS=W(Je,Zi(we));W(Je.check(lo({maximum:864e10,minimum:-864e10})),Zi(je,{decode:Pe(e=>kn(Ve(0),()=>e*1e3)),encode:Pe(e=>kt(e)/1e3)})),W(Ue.check(lo({maximum:864e10,minimum:-864e10})),Zi(je,{decode:Pe(e=>Ve(e*1e3)),encode:Pe(r)})),W(Je,Zi(yn,{decode:Pe(Vr),encode:Pe(uo)}));var uS=Pa(`DeployItemId`)(q),dS=Pa(`DeployAppId`)(q),fS=Pa(`DeployUnitId`)(q),pS=Pa(`DeployProcessId`)(Ue),mS=Pa(`DeployExposureName`)(q),hS=W(q,Zi(o(q),{decode:Pe(e=>nn(e,jr)),encode:Pe(e=>z(e,H(``)))})),gS=W(U(q),Zi(o(q),{decode:Pe(e=>Ct(e,jr)),encode:Pe(ea)})),_S=class extends ti()(`DeployError`,{cause:ue(an()),message:q}){},vS=Y({detail:q,name:q}),yS=Y({cpu:U(Je),label:vS,memory:Je,name:q,parent:pS,pid:pS}),bS=Tn([`user`,`system`]),xS=Y({active:W(fn,F(rn(!1))),address:W(U(q),F(vn)),bindings:W(U(b(Y({address:q,port:Ue,protocol:Tn([`tcp`,`udp`])}))),F(vn)),detail:q,failure:W(U(Y({at:U(cS),reason:q})),F(vn)),health:W(Tn([`quiet`,`warning`,`error`]),F(rn(`quiet`))),hostname:W(U(q),F(vn)),http:W(U(fn),F(vn)),id:uS,kind:Tn([`service`,`container`,`port`,`exposure`,`peer`]),links:W(U(b(q)),F(vn)),name:q,next:W(U(cS),F(vn)),owned:W(U(fn),F(vn)),port:W(U(Ue),F(vn)),process:W(gS,F(vn)),processes:W(U(b(yS)),F(vn)),protocol:W(U(Tn([`tcp`,`udp`])),F(vn)),publicAccess:W(U(fn),F(vn)),running:W(fn,F(rn(!1))),scheduled:W(U(fn),F(vn)),scope:W(U(bS),F(vn)),self:W(U(fn),F(vn)),state:q,ui:W(U(fn),F(vn)),unit:W(gS,Zi(o(fS)),F(vn)),url:hS}),SS=va([xS.mapFields(e=>({...e,kind:Mn(`service`),name:fS})),xS.mapFields(e=>({...e,kind:Mn(`exposure`),name:mS})),xS.mapFields(e=>({...e,kind:Tn([`container`,`peer`])}))]),CS=xS.mapFields(e=>({...e,kind:Mn(`port`),process:W(U(hS),Zi(o(q),{decode:Pe(Fe),encode:Pe(V)}),F(vn))})),wS=va([...SS.members,CS]);xS.mapFields(ut([`address`,`port`,`protocol`]));var TS=Y({items:b(va([...SS.members,CS.mapFields(e=>({...e,unit:W(U(W(hS,Zi(o(fS)))),Zi(o(si(fS)),{decode:Pe(Fe),encode:Pe(V)}),F(vn))}))])),sources:b(Y({error:hS,name:q})),time:cS}),ES=Y({name:fS,scope:bS}),DS=Y({id:dS});va([dS,Tn([`other`,`system`])]);var OS=Tn([10,60,1440,10080,43200]),kS=Y({minutes:W(OS,Zi(yn,{decode:Pe(Yr),encode:Qe(e=>W(e,Ua,St(OS)))}))}),AS=W(Ue,Zi(lS)),jS=Y({cpu:U(Je),id:dS,memory:Je}),MS=Y({...jS.fields,cpuCoverage:AS}),NS=class extends Ca(`MachineSample`)({appsCoverage:AS,cpu:Ni(Je),cpuCoverage:AS,memoryCoverage:AS,memoryTotal:Je,memoryUsed:Je,since:W(Ue,Zi(cS)),step:W(Ue,Zi(lS)),storageCoverage:AS,storageUsed:Ni(Je),time:W(Ue,Zi(cS))}){static table=`samples`},PS=class extends Ca(`Sample`)({...NS.fields,apps:Ni(ca(b(MS)))}){},FS=Y({mount:q,total:Je,used:Je}),IS=Y({disks:b(FS),error:hS,load:b(Je),samples:b(PS.json),stale:fn,time:cS}),LS=ut(yS.fields,[`cpu`,`memory`]),RS=Y({processes:b(Y({key:q,label:vS,samples:b(Y({...LS,time:cS}))})),restarts:b(cS),time:cS}),zS=Y({hostname:q.check(ir(253),Ht(/^(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)*[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/u)),kind:Tn([`tailnet`,`public`]),name:mS.check(no(),ir(260)),port:Ue.check(lo({maximum:65535,minimum:1024})),publicAccess:fn}),BS=_i(Lr(`metrics.watch`,{error:va([uv,_S]),payload:kS,stream:!0,success:IS}),Lr(`metrics.app`,{error:va([uv,_S]),payload:DS,stream:!0,success:RS})),VS=_i(Lr(`inventory.watch`,{error:va([uv,_S]),stream:!0,success:TS}),Lr(`inventory.logs`,{error:va([uv,_S]),payload:DS,success:q}).middleware(mv),Lr(`inventory.restart`,{error:va([uv,_S]),payload:DS}).middleware(mv),Lr(`inventory.stop`,{error:va([uv,_S]),payload:DS}).middleware(mv),Lr(`inventory.run`,{error:va([uv,_S]),payload:ES}).middleware(mv)),HS=_i(Lr(`exposures.expose`,{error:va([uv,_S]),payload:zS,success:q}).middleware(mv)),US=BS.merge(VS,HS).middleware(yv);function WS(e){return ke(Xi(/^(?:127\.0\.0\.1|0\.0\.0\.0|\*):/u)(e))}function GS(e){return e.kind===`port`&&I(e.protocol,`tcp`)&&L(e.port,e=>e>=1024)&&L(e.address,WS)}function KS(e){return GS(e)&&ke(e.process)&&!L(e.port,e=>qa([5353,5355],e))&&!L(e.process,e=>ke(Xi(/^(?:ssh|cloudflared|tailscaled|caddy)$/u)(e)))}function qS(e){return e.health===`error`?!0:e.kind===`exposure`?I(e.owned,!0)||I(e.publicAccess,!0):e.kind===`container`?e.active:e.kind===`port`?KS(e):e.kind===`service`?ke(Xi(/^(?:deslop-|preview-|t3code)/u)(e.name))?!0:I(e.scope,`user`)&&e.active&&un(Xi(/^(?:dbus|dirmngr|gpg-|keyboxd|gcr-|gnome-|secret-service|ssh-agent|openvpn3-)/u)(e.name)):!1}function JS(e){return W(e,R(e=>KS(e)&&I(e.http,!0)),Pn(Ri(i,e=>`${v(e.port)}:${v(e.address)}`)),ce((e,t)=>_n((e,t)=>e===t)(e.port,t.port)))}function YS(e){return e.kind===`service`?z(e.unit,()=>e.name):fS.make(e.name)}function XS(e){return e.kind===`container`?dS.make(`container:${zr(0,12)(z($t(Hn(e.id,`docker:`)),H(``)))}`):dS.make(`service:${z(e.scope,H(`system`))}:${YS(e)}`)}function ZS(e){return e.kind===`port`?z(e.process,()=>e.name):e.kind===`container`&&Va(`deslop-`)(e.name)?Di(/-[0-9]+$/u,``)(zr(7)(e.name)):Va(`preview-`)(e.name)?J(Xi(/@deslop\/([a-z0-9-]+)/u)(e.detail),{onNone:()=>`Preview ${Di(/\.service$/u,``)(zr(8)(e.name))}`,onSome:e=>`${e[1]} preview`}):qr(/^deslop-|\.service$/gu,``)(e.name)}function QS(e){return W(ZS(e),qr(/\b([a-f0-9]{7})[a-f0-9]+\b/giu,`$1`),qr(/\b(?=[a-z0-9]{10,}\b)(?=[a-z0-9]*[0-9])([a-z0-9]{7})[a-z0-9]+\b/giu,`$1`))}function $S(e,t){return I(e.address,`container`)||t.address===`container`||!I(e.port,t.port)||!I(e.protocol,t.protocol)?!1:I(e.address,t.address)?!0:L(e.address,WS)&&WS(t.address)}function eC(e){let t=L(e.address,WS);return da(e.protocol,e.port,t,j(t,{onFalse:()=>e.address,onTrue:()=>V(``)}))}function tC(e,t){return`${z(e,H(`system`))}:${t}`}function nC(e){let t=R(e,e=>e.kind===`port`),n=O(t,e=>J(e.unit,{onNone:H(`none`),onSome:t=>`unit:${tC(e.scope,t)}`})),r=tn(k(Dn(R(t,e=>!I(e.address,`container`))),e=>[eC(e),e])),i=W(e,R(e=>e.kind===`service`||e.kind===`container`),k(e=>{let t=n[`unit:${tC(e.scope,YS(e))}`]??[],i=W(e.bindings,z(T),k(t=>({...e,...W(gn(r,eC({address:V(t.address),port:V(t.port),protocol:V(t.protocol)})),Ct(()=>t.address!==`container`),z(()=>({}))),address:V(t.address),bindings:V([]),id:uS.make(`${e.id}:port:${t.address}`),kind:`port`,port:V(t.port),process:V(e.name),protocol:V(t.protocol),unit:W(e,nn(e=>e.kind===`service`),N(YS)),url:M()})));return{item:e,listeners:[...t,...i]}})),a=ln(W(i,R(e=>e.item.kind===`service`),k(e=>tC(e.item.scope,YS(e.item))))),o=ln(ai(i,e=>W(e.listeners,R(e=>!I(e.address,`container`)),k(e=>eC({address:e.address,port:e.port,protocol:e.protocol}))))),s=R(t,e=>!L(e.unit,t=>Oe(a,tC(e.scope,t)))&&(I(e.address,`container`)||!Oe(o,eC(e)))),c=[...i,...k(s,e=>({item:e,listeners:[e]}))],l=[...R(e,e=>e.kind===`exposure`&&I(e.owned,!0)),...R(e,e=>e.kind===`exposure`&&!I(e.owned,!0))],u=W(l,k((e,t)=>({index:t,item:e})),O(e=>`${z(e.item.port,H(0))}`)),d=W(c,k(e=>{let t=qt(W(e.listeners,R(e=>L(e.port,t=>$S(e,{address:`127.0.0.1:${t}`,port:t,protocol:`tcp`}))),k(e=>e.port),bt)),n=W(ai(t,e=>u[`${e}`]??[]),Dt(e=>e.index,At),k(e=>e.item));return{...e,exposures:ce([...W(e.item.links,z(T),k(t=>({...e.item,id:uS.make(`${e.item.id}:url:${t}`),kind:`exposure`,name:mS.make(e.item.name),owned:V(!1),publicAccess:V(!0),url:V(t)}))),...n],(e,t)=>pa(e.url,t.url)&&pa(e.publicAccess,t.publicAccess))}}),R(e=>qS(e.item)&&(e.item.kind!==`port`||I(e.item.http,!0)&&ke(e.item.process)&&!I(e.item.process,`node`)))),f=ln(ai(d,e=>k(e.exposures,e=>e.id))),p=ln(ai(d,e=>k(e.exposures,e=>e.url))),m=W(l,R(e=>!Oe(f,e.id)&&!Oe(p,e.url)),k(e=>({exposures:[e],item:e,listeners:[]})),R(e=>qS(e.item)));return k([...d,...m],e=>{if(e.item.kind===`container`)return e;let t=JS(e.listeners),n=xn(t,e=>I(e.ui,!0)),r=ln(bt(k(e.exposures,e=>e.port)));return{...e,listeners:R(t,e=>!n||I(e.ui,!0)||L(e.port,e=>Oe(r,e)))}})}function rC(e){return{cpu:W(e,k(e=>e.cpu),bt,Ge({onEmpty:()=>M(),onNonEmpty:e=>V(le(e))})),memory:le(k(e,e=>e.memory))}}var iC=W(ka(At),Ri(e=>e.memory),Dr(Ri(Ce(ka(At)),e=>e.cpu)));function aC(e,t){return W(e,Pn(iC),k(e=>({...e,small:e.memory<t*.02&&!L(e.cpu,e=>e>=.5)})))}function oC(e,t){return e.name===t.name&&e.detail===t.detail}function sC(e,t){let[n,r]=ra(t,ee(t=>oC(t.label,e)));return Pt(n)?t:[...r,...sC(e,ai(n,e=>e.children))]}function cC(e){return{...e,children:sC(e.label,k(e.children,cC))}}function lC(e){let n=st(k(e,e=>e.pid)),r=O(e,e=>yi(e.parent)),i=nt();function a(e){ii(i,e.pid);let t=W(Da(r,`${e.pid}`),z(T),R(e=>!yt(i,e.pid)),k(a)),n={children:[],cpu:e.cpu,label:e.label,memory:e.memory,pid:e.pid,small:!1};return{...n,...rC([n,...t]),children:t}}let o=W(R(e,e=>!yt(n,e.parent)),Ge({onEmpty:()=>t(e,1),onNonEmpty:ea}),k(e=>cC(a(e)))),s=rC(o).memory;function c(e){return{...e,children:aC(k(e.children,c),s)}}return aC(k(o,c),s)}function uC(e){return ai(e,e=>[{key:`${e.label.name.length}:${e.label.name}${e.label.detail.length}:${e.label.detail}`,node:e},...uC(e.children)])}function dC(e){return W(uC(e),O(e=>e.key),Ii,k(e=>({key:e[0].key,label:e[0].node.label,...rC(k(e,e=>e.node))})))}function fC(e){return e.item.health===`error`?0:e.item.health===`warning`?1:2}var pC=Ri(ka(At),e=>W(z(e.item.processes,T),k(e=>e.memory),le));function mC(e){return{name:fS.make(e.name),scope:z(e.scope,H(`system`))}}function hC(e){return JS(ai(e,e=>W(e.listeners,R(t=>L(t.port,e=>e>=1024)&&(!xn(e.listeners,e=>I(e.ui,!0))||I(t.ui,!0))&&!L(e.item.links,sn)&&!xn(e.exposures,e=>_n((e,t)=>e===t)(e.port,t.port))),k(t=>({...t,process:V(QS(e.item))})))))}function gC(t,n,r=ea){function i(e){let t=R(e.reasons,e=>cn(e)&&_v(e.error));return Pt(t)?M():V(xt(t))}let a=ft(W(t.self(),Ct(e),_e(e=>i(e.cause))));function o(e){return J(p(a),{onNone:()=>e,onSome:t=>xt([...t.reasons,...R(e.reasons,e=>!cn(e)||!_v(e.error))])})}let s=ft(0),c=Gt(n,e=>P(()=>{ye(a,t=>An(i(e),()=>t));let n=o(e);ke(p(a))?t.setSelf(bn(n)):ot(s)<2||t.setSelf(Nn(n,{previous:t.self()}))}));return W(r(c),ao(()=>P(()=>{Tt(a,M()),Tt(s,0)})),ri(e=>Ra(o(e))),Sa(po(()=>J(p(a),{onNone:()=>wi,onSome:Ra}))))}function _C(e){return Ha(uv)(e)?e.error===`temporarily_unavailable`:Ha(Gr)(e)&&!Ha(Ti)(e.reason)}function vC(e){return Kn(e,e=>ur(e(_a(`1 second`)),e=>_C(e.input)))}function yC(e,t,n){return e.runtime.atom(r=>gC(r,Qa(_t(e,e=>e(t,n))),vC))}var bC=Nr(1),xC=Wn(bC);function SC(e,t){return(1-(kt(t)-kt(e))/xC)*100}function CC(e,t){return W(e,k(e=>SC(e,t)),R(e=>e>=0&&e<=100))}function wC(e){return e===``?e:`${e}V100Z`}function TC(e,t){let n=ze(e,{area:``,lastRight:-1,line:``},(e,n)=>{let r=Vt(0,SC(n.from,t)),i=te(100,SC(n.time,t));return i<=r?e:J(n.value,{onNone:()=>e,onSome:t=>{let n=100-to(t,{maximum:100,minimum:0});return r===e.lastRight?{area:`${e.area}V${n}H${i}`,lastRight:i,line:`${e.line}V${n}H${i}`}:{area:`${wC(e.area)}M${r} 100V${n}H${i}`,lastRight:i,line:`${e.line}M${r} ${n}H${i}`}}})});return{area:wC(n.area),line:n.line}}var EC=class extends ja()(`@deslop/deploy/web/inventory/client/RpcClient`,{group:US.middleware(Av),protocol:Iv}){},DC=yC(EC,`inventory.watch`),OC=yC(EC,`metrics.watch`,{minutes:bC}),kC=za(e=>yC(EC,`metrics.app`,{id:e})),AC=Xn({Expose:{input:zS},Logs:{id:dS},Restart:{id:dS},Run:{request:ES},Stop:{id:dS}}),jC=EC.runtime.fn(e=>Gn(EC,t=>AC.match(e,{Expose:e=>Gi(t(`exposures.expose`,e.input),M()),Logs:e=>ba(t(`inventory.logs`,{id:e.id})),Restart:e=>Gi(t(`inventory.restart`,{id:e.id}),M()),Run:e=>Gi(t(`inventory.run`,e.request),M()),Stop:e=>Gi(t(`inventory.stop`,{id:e.id}),M())}))),MC=`en`,NC={millisecond:{fractionalSecondDigits:3,hour:`2-digit`,hourCycle:`h23`,minute:`2-digit`,second:`2-digit`},minute:{hour:`2-digit`,hourCycle:`h23`,minute:`2-digit`},second:{hour:`2-digit`,hourCycle:`h23`,minute:`2-digit`,second:`2-digit`},day:{day:`numeric`,month:`short`},dayWithYear:{day:`numeric`,month:`short`,year:`numeric`},month:{month:`short`,year:`numeric`},year:{year:`numeric`}},PC=Fi(),FC=Tn([`millisecond`,`minute`,`second`]);va([FC,Tn([`day`,`dayWithYear`,`month`,`year`])]),new Intl.NumberFormat(MC,{maximumFractionDigits:0}),new Intl.NumberFormat(MC,{maximumFractionDigits:1,notation:`compact`});var IC=new Intl.NumberFormat(MC,{maximumFractionDigits:1});new Intl.NumberFormat(MC,{currency:`USD`,maximumFractionDigits:2,minimumFractionDigits:2,style:`currency`});function LC(e,t){let n=W(e,nn(aa),J({onNone:Er,onSome:e=>e.zone}),Oa),r=`${n}/${t}`;return W(PC,ua(r),z(()=>{let e=new Intl.DateTimeFormat(`en-GB`,{...NC[t],timeZone:n});return Hi(PC,r,e),e}))}function RC(e,t){return LC(e,t).format(kt(e))}function zC(e,t){let n=Vt(0,Math.floor(Ua(qe(e,t))));return n<1?`now`:n<60?`${n}m`:n<1440?`${Math.floor(n/60)}h`:`${Math.floor(n/1440)}d`}function BC(e){let t=Wn(e);return t<999.5?`${Jt(t,0)} ms`:t<9950?`${Jt(t/1e3,1)} s`:t<59500?`${Jt(t/1e3,0)} s`:t<357e4?`${Jt(t/6e4,0)} min`:`${Jt(t/36e5,1)} h`}function VC(e,t=`minute`){return RC(e,t)}function HC(e){return e>=1024**4?`${IC.format(e/1024**4)} TiB`:e>=1024**3?`${IC.format(e/1024**3)} GiB`:e>=1024**2?`${IC.format(e/1024**2)} MiB`:e>=1024?`${IC.format(e/1024)} KiB`:`${IC.format(e)} B`}function UC(e){return`${IC.format(e)}%`}var WC=Qm({Home:Fm(`/`,{search:{app:ue(uS),pane:ue(Tn([`apps`,`process`]))}}),NotFound:Fm(`/*`)}),GC=uS.make(`machine`),KC=Re({error:dr,success:TS}),qC=Re({error:dr,success:IS}),JC=Re({error:dr,success:RS}),YC=Xn({Expose:{kind:zS.fields.kind,port:wS},Failure:{text:q}}),XC=`(width < 640px) and (not (horizontal-viewport-segments: 2))`,ZC=Y({admin:fn,appHistory:JC,defaultApp:o(uS),dialog:o(YC),effectiveApp:o(dS),inventory:KC,listHidden:fn,logs:o(Ea(q,q)),metrics:qC,narrow:fn,now:cS,pending:fn,route:WC}),$=Yh({Account:{admin:fn},AppHistory:{id:dS,result:JC},Clock:{now:cS},ClosedDialog:{},ExposureKind:{kind:zS.fields.kind},Inventory:{result:KC},Metrics:{result:qC},OpenedExposure:{port:wS},OpenedLogs:{id:dS},Operation:{operation:AC},OperationDone:{operation:AC,text:o(q)},OperationFailed:{error:q,operation:AC},Posture:{narrow:fn},Retry:{},Route:{route:WC},Select:{id:uS},ToggleList:{id:o(uS)}}),QC=class extends Gu()(`Deploy/Execute`,{args:{operation:AC},success:$}){static layer=this.toLayer(_t($a,e=>t=>li(A(()=>(e.set(jC,t.operation),zt(e,jC,{suspendOnWaiting:!0}))),{onFailure:e=>{let n=en(e);return Ki(n)?$.OperationFailed({error:n.message,operation:t.operation}):$.OperationFailed({error:yi(n),operation:t.operation})},onSuccess:e=>$.OperationDone({operation:t.operation,text:e})})))},$C=class extends Gu()(`Deploy/Refresh`,{args:{id:o(dS)},success:bi}){static layer=this.toLayer(_t($a,e=>t=>P(()=>{sS(e,DC),sS(e,OC),J(t.id,{onNone:La,onSome:t=>sS(e,kC(t))})})))},ew=Wu(`Deploy/SignIn`,{args:{}},()=>P(()=>location.replace(hv(location.href))));function tw(t){return e(t)&&gv(en(t.cause))}function nw(e,t){let n=t?.samples??[];return k(n,(t,r)=>{let i=kt(t.since),a=W(n,ct(r-1),J({onNone:()=>i-1e3,onSome:e=>kt(e.time)}));return{from:Ve(j(i-a<1500,{onFalse:()=>i-1e3,onTrue:()=>a})),time:t.time,value:e(t)}})}function rw(e,t){let n=XS(e);return nw(e=>_e(e.apps,e=>W(e,c(e=>e.id===n),J({onNone:H(V(0)),onSome:e=>e.cpu}))),t)}function iw(e){return nw(e=>e.cpu,e)}function aw(e,t){let n=z(e.processes,T),r=_e(t?.apps??M(),t=>c(t,t=>t.id===XS(e))),i=ai(n,e=>Ln(e.cpu));return{cpu:j(ho(i),{onFalse:()=>_e(r,e=>e.cpu),onTrue:()=>V(le(i))}),memory:j(sn(n),{onFalse:()=>N(r,e=>e.memory),onTrue:()=>W(n,k(e=>e.memory),le,V)})}}function ow(e){return W(e.items,c(e=>I(e.self,!0)),_e(e=>e.hostname))}var sw=W(At,Ri(fC),Dr(pC),Dr(Ri(Ce(Se),e=>e.item.next)));function cw(e){return W(e,Di(/^https:\/\//u,``),Hn(`/`))[0]}function lw(e,t){return J(e,{onNone:H(`—`),onSome:t})}function uw(e){return J(e.failure,{onNone:()=>e.detail,onSome:e=>e.reason})}function dw(e,t){return W(e.failure,_e(e=>e.at),J({onNone:()=>uw(e),onSome:n=>`${uw(e)} · ${zC(n,t)}`}))}var fw=[`−60`,`−45`,`−30`,`−15`,`now`],pw=[100,75,50,25];function mw(e){return e%15==0?0:e%5==0?5:8}function hw(e,t=!1){return e.div.class(`deploy-ruler`,t&&`deploy-ruler-detail`).attr(`aria-hidden`,`true`).children(k(fw,(t,n)=>e.span.key(t).style({"--at":`${n*25}%`}).children(t)),e.el(`svg`).attrs({preserveAspectRatio:`none`,viewBox:`0 0 60 12`}).children(e.el(`path`).attrs({d:W(61,mn(e=>`M${e} 12V${mw(e)}`),Ee(``)),"vector-effect":`non-scaling-stroke`})))}function gw(e,t,n,r=!1){let i=TC(t,n);return e.el(`svg`).attrs({"aria-hidden":`true`,class:j(r,{onFalse:H(`deploy-trace`),onTrue:H(`deploy-trace deploy-trace-main`)}),preserveAspectRatio:`none`,viewBox:`0 0 100 100`}).children(e.el(`path`).attrs({class:`deploy-area`,d:i.area}),e.el(`path`).attrs({class:`deploy-trace-line`,d:i.line,"vector-effect":`non-scaling-stroke`}))}function _w(e){return e.div.class(`deploy-cpu-scale`).attr(`aria-hidden`,`true`).children(k(pw,(t,n)=>e.span.key(yi(t)).style({"--at":`${n*25}%`}).children(yi(t))))}function vw(e,t,n,r=!1){return e.div.class(`deploy-restarts`,r&&`deploy-restarts-dots`).attr(`aria-hidden`,`true`).children(k(CC(t,n),(t,n)=>e.span.key(yi(n)).style({"--at":`${t}%`})))}function yw(e,t){let n=R(e,e=>SC(e,t)>=100-100/6&&SC(e,t)<=100);if(!Pt(n))return n.length===1?`Restarted once in 10 min`:`Restarted ${n.length} times in 10 min`}function bw(e){return k(e,(t,n)=>{let r=kt(t.time),i=j(n===0,{onFalse:()=>kt(e[n-1]?.time??t.time),onTrue:()=>r-5e3});return{from:Ve(j(r-i<=8e3,{onFalse:()=>r-5e3,onTrue:()=>i})),time:t.time,value:t.cpu}})}function xw(e,t){return e.el(`svg`).attrs({"aria-hidden":`true`,fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,viewBox:`0 0 24 24`}).children(e.el(`path`).attr(`d`,t))}function Sw(e,t,n){return e.div.class(`axis-value deploy-figures`).children(e.span.children(J(t,{onNone:H(`—`),onSome:t=>{let n=UC(t);return e.span.children(zr(0,-1)(n),e.small.children(`%`))}})),n!==void 0&&e.small.class(`axis-muted`).children(lw(n,HC)))}function Cw(e,t,n=!1){if(t!==`quiet`||n)return e.span.class(`deploy-dot`).attr(`data-status`,j(t===`warning`&&!n,{onFalse:H(`error`),onTrue:H(`warning`)}))}function ww(e,t){return J(t.url,{onNone:()=>v(N(t.port,e=>`:${e}`)),onSome:t=>e.a.attrs({href:t,rel:`noreferrer`,target:`_blank`,title:t}).children(cw(t))})}function Tw(e,t,n,r,i){return e.div.class(`deploy-name`).children(e.span.class(`axis-title`,(n||r)&&`deploy-strong`).children(Cw(e,t.health,r),QS(t)),e.span.class(`axis-muted`).children(i))}function Ew(e,t){return e.health===`quiet`?e.running?`job · running`:`job · next run`:dw(e,t)}function Dw(e,t,n,r,i){let a=QS(t.item);return e.div.key(t.item.id).class(`axis-row deploy-job`).children(e.div.class(`deploy-name`).children(Nx(e,{}).attr(`aria-label`,`Open ${a}`).on(`click`,()=>$.Select({id:t.item.id})).children(e.span.class(`axis-title`).children(Cw(e,t.item.health),a),e.span.class(`axis-muted`).children(Ew(t.item,i)))),e.div.class(`deploy-job-tail`).children(e.span.class(`axis-value`).children(lw(t.item.next,e=>VC(e))),n&&Nx(e,{disabled:t.item.running||r}).attr(`aria-label`,`Run ${a} now`).on(`click`,()=>$.Operation({operation:AC.cases.Run.make({request:mC(t.item)})})).children(xw(e,`m8 5 12 7-12 7Z`))))}function Ow(e){return J(ow(e),{onNone:H(`Machine`),onSome:e=>Xe(Hn(e,`.`))})}function kw(e){let t=v($t(e?.samples??[])),n=W(e?.disks??[],k(e=>e.total),le),r=W(e?.disks??[],k(e=>e.used),le);return{cpu:t?.cpu??M(),disk:W(n,nn(e=>e>0),N(e=>100*r/e)),memory:$e(t?.memoryUsed),memoryTotal:$e(t?.memoryTotal)}}function Aw(e,t,n){if(e.item.health!==`quiet`)return dw(e.item,t);if(n!==void 0)return n;let r=ai(e.exposures,e=>Ln(e.url))[0];if(r!==void 0)return cw(r);let i=ai(e.listeners,e=>Ln(e.port))[0];if(i!==void 0)return`:${i}`;let a=z(e.item.processes,T).length;if(a===1)return`1 process`;if(a>1)return`${a} processes`}function jw(e,t){let n=v($t(t.history?.samples??[])),r=kw(t.history),i=I(t.selected,GC);return e.div.class(`deploy-list-body`).children(e.div.class(`deploy-list-ruler`).children(hw(e)),h(t.rows)&&e.p.class(`deploy-notice`).attr(`role`,`status`).children(`No apps`),k(t.rows,r=>{let i=r.item;if(I(i.scheduled,!0))return Dw(e,r,t.admin,t.pending,t.now);let a=I(t.selected,i.id),o=j(i.kind===`service`||i.kind===`container`,{onFalse:T,onTrue:()=>rw(i,t.history)}),s=j(a,{onFalse:T,onTrue:()=>t.processes?.restarts??[]}),c=yw(s,t.now),l=aw(i,n);return e.div.key(i.id).class(`axis-row deploy-list-row`).attr(`data-selected`,j(a,{onFalse:Ci,onTrue:H(``)})).children(Nx(e,{}).attrs({"aria-current":j(a,{onFalse:Ci,onTrue:H(`true`)}),"aria-label":`Open ${QS(i)}`}).on(`click`,()=>$.Select({id:i.id})).children(Tw(e,i,L(l.cpu,e=>e>=5)||a,c!==void 0,Aw(r,t.now,c)),e.div.class(`deploy-list-trace`).children(gw(e,o,t.now),vw(e,s,t.now)),Sw(e,l.cpu,l.memory)))}),e.div.class(`axis-row deploy-list-row deploy-machine-row`).attr(`data-selected`,j(i,{onFalse:Ci,onTrue:H(``)})).children(Nx(e,{}).attrs({"aria-current":j(i,{onFalse:Ci,onTrue:H(`true`)}),"aria-label":`Open ${Ow(t.snapshot)}`}).on(`click`,()=>$.Select({id:GC})).children(e.div.class(`deploy-name`).children(e.span.class(`axis-title deploy-strong`).children(Ow(t.snapshot)),e.span.class(`axis-muted`).children(W([N(r.memoryTotal,HC),N(r.disk,e=>`disk ${UC(e)}`)],bt,Ee(` · `)))),e.div.class(`deploy-list-trace`).children(gw(e,iw(t.history),t.now)),Sw(e,r.cpu,r.memory))))}var Mw=`deploy-logs`;function Nw(e,t,n,r){if(I(t.scheduled,!0))return Nx(e,{disabled:n||t.running}).attr(`aria-label`,`Run now`).on(`click`,()=>$.Operation({operation:AC.cases.Run.make({request:mC(t)})})).children(xw(e,`m8 5 12 7-12 7Z`));if(t.kind!==`service`||!I(t.owned,!0))return;let i=XS(t);return[Nx(e,{disabled:n}).attr(`aria-label`,`Restart`).on(`click`,()=>$.Operation({operation:AC.cases.Restart.make({id:i})})).children(xw(e,`M20 4v5h-5m5 0a8 8 0 1 0 .4 6`)),Nx(e,{disabled:n}).attrs({"aria-label":`Logs`,popovertarget:Mw}).children(xw(e,`M4 6h16M4 12h16M4 18h10`)),Nx(e,{disabled:n||!(t.active||t.running)}).attr(`aria-label`,`Stop`).on(`click`,()=>$.Operation({operation:AC.cases.Stop.make({id:i})})).children(xw(e,`M7 7h10v10H7Z`).attr(`fill`,`currentColor`)),Bx(e,Mw,`${QS(t)} logs`,J(r,{onNone:()=>e.p.attr(`role`,`status`).children(`Loading logs…`),onSome:t=>ya(t,{onFailure:t=>e.p.attr(`role`,`alert`).children(t),onSuccess:t=>e.pre.attr(`tabindex`,`0`).children(j(vr(rr(t)),{onFalse:()=>t,onTrue:H(`No logs`)}))})})).key(i).on(`toggle`,e=>{if(e.open)return $.OpenedLogs({id:i})})]}function Pw(e,t,n,r=!1){return e.div.key(t).class(`deploy-fact`).children(e.dt.class(`axis-muted`).children(t),e.dd.class(r&&`deploy-issue`).children(n))}function Fw(e){let t=ai(e,e=>Ln(e.value));return Pt(t)?`—`:`${UC(ze(t,0,Vt))}, ${UC(le(t)/t.length)}`}function Iw(e,t,n,r,i,a){return e.div.class(`deploy-axis`).children(hw(e,!0),e.div.class(`deploy-axis-body`).children(e.div.class(`deploy-large-trace`).children(gw(e,n,t,!0),_w(e),a),r,vw(e,i,t,!0)))}function Lw(e,t,n,r){let i=W(t.processes,z(T),lC,dC),a=Tr(r?.processes??[],e=>[e.key,e]),o=W(i,k(e=>e.key),ln);return k([...k(i,e=>({...e,memory:V(e.memory),samples:a[e.key]?.samples??[]})),...W(r?.processes??[],R(e=>!Oe(o,e.key)),k(e=>({...e,cpu:M(),memory:M()})))],t=>{let r=t.label.name===`node`&&jr(t.label.detail);return e.div.key(t.key).class(`axis-row deploy-process`).children(e.div.class(`deploy-name`).children(e.span.class(`axis-title`,L(t.cpu,e=>e>=5)&&`deploy-strong`).children(j(r,{onFalse:()=>t.label.name,onTrue:()=>`${t.label.name} ${t.label.detail}`})),e.span.class(`axis-muted`).children(W([j(r,{onFalse:()=>t.label.detail,onTrue:H(``)}),J(t.memory,{onNone:H(``),onSome:HC})],R(jr),Ee(` · `)))),Sw(e,t.cpu),gw(e,bw(t.samples),n))})}function Rw(e,t,n,r){let i=k(t.exposures,t=>e.span.key(t.id).children(Cw(e,t.health),ww(e,t),t.health!==`quiet`&&` · ${uw(t)}`)),a=nt(),o=Tr(n,e=>[e.id,e]);return{exposures:i,listeners:ai(t.listeners,n=>{let i=v(n.port);if(i===void 0||yt(a,i)||I(n.address,`container`))return[];ii(a,i);let s=o[n.id];return r&&s!==void 0?[Nx(e,{}).key(n.id).attr(`aria-label`,`Expose ${QS(t.item)} :${i}`).on(`click`,()=>$.OpenedExposure({port:s})).children(`:${i}`)]:[e.span.key(n.id).children(`:${i}`)]})}}function zw(e,t,n){return e.item.health===`quiet`?n===void 0?W(e.exposures,ai(e=>Ln(e.url)),Me,N(cw),v):n:dw(e.item,t)}function Bw(e,t,n,r,i,a,o){let s=$t(i),c=I(t.scheduled,!0);return e.div.children(sn(i)&&Pw(e,`Restarts`,o??`${i.length} in 1 h`,!0),t.running&&v(N(s,t=>Pw(e,`Uptime`,BC(qe(t,n))))),sn(r)&&Pw(e,`Peak, mean`,Fw(r)),v(N(a,t=>Pw(e,`Memory`,HC(t)))),c&&Pw(e,`Next run`,lw(t.next,e=>VC(e))))}function Vw(e,t){let n=t.row,r=Rw(e,n,t.free,t.admin);return e.div.children(n.item.kind===`service`&&Pw(e,`Unit`,n.item.name),ho(r.exposures)&&Pw(e,`URL`,e.span.class(`deploy-endpoints`).children(r.exposures)),(ho(r.listeners)||ke(n.item.port))&&Pw(e,`Port`,e.span.class(`deploy-endpoints`).children(j(ho(r.listeners),{onFalse:()=>lw(n.item.port,yi),onTrue:()=>r.listeners}))),sn(n.exposures)&&Pw(e,`Exposure`,W(n.exposures,k(e=>W(e.publicAccess,I(!0),j({onFalse:H(`tailnet`),onTrue:H(`public`)}))),qt,Ee(` · `))))}function Hw(e,t){let n=t.row.item,r=I(n.scheduled,!0),i=aw(n,v($t(t.history?.samples??[]))),a=!r&&(n.kind===`service`||n.kind===`container`),o=j(a,{onFalse:T,onTrue:()=>rw(n,t.history)}),s=t.app?.restarts??[],c=yw(s,t.now),l=R(t.rows,e=>n.kind===`service`&&I(e.item.scheduled,!0)&&e.item.name===Di(/\.service$/u,`-update.service`)(n.name));return e.div.key(n.id).class(`deploy-detail-scroll`).children(e.div.class(`axis-row deploy-detail-lead`).children(e.div.class(`deploy-name`).children(e.span.class(`axis-title deploy-strong`).children(Cw(e,n.health,c!==void 0),QS(n)),e.span.class(`axis-muted`).children(zw(t.row,t.now,c))),!r&&Sw(e,i.cpu,i.memory)),a&&Iw(e,t.now,o,Lw(e,n,t.now,t.app),s,t.status),e.dl.class(`deploy-facts`).children(Bw(e,n,t.now,o,s,i.memory,c),Vw(e,t)),k(l,n=>Dw(e,n,t.admin,t.pending,t.now)))}function Uw(e,t,n,r,i){let a=kw(i),o=iw(i);return e.div.class(`deploy-detail-scroll`).children(e.div.class(`axis-row deploy-detail-lead`).children(e.span.class(`axis-title deploy-strong`).children(Ow(n)),Sw(e,a.cpu,a.memory)),Iw(e,t,o,void 0,[],r),e.dl.class(`deploy-facts`).children(e.div.children(Pw(e,`Peak, mean`,Fw(o)),Pw(e,`Memory`,lw(a.memoryTotal,HC))),e.div.children(Pw(e,`Disk used`,lw(a.disk,UC)),Pw(e,`Load`,W(i?.load??[],k(e=>e.toFixed(2)),Ee(` · `))))))}function Ww(e,t,n){return Nx(e,{disabled:n??!1}).on(`click`,()=>$.ClosedDialog()).children(t)}function Gw(e,t,n,r,i){let a=t.kind===`public`,o=z(ow(n),H(``));return e.div.children(e.p.class(`axis-muted`).children(`Port ${i}`),e.div.class(`deploy-expose-kinds`).children(k(zS.fields.kind.literals,n=>Nx(e,{disabled:r,pressed:n===t.kind}).key(n).on(`click`,()=>$.ExposureKind({kind:n})).children(Na(n)))),e.form.on(`submit`,e=>{let n=j(a,{onFalse:()=>o,onTrue:()=>W(e.fields.hostname??``,rr,co)});if(!(r||n===``))return $.Operation({operation:AC.cases.Expose.make({input:{hostname:n,kind:t.kind,name:mS.make(j(a,{onFalse:()=>`tailnet:${i}`,onTrue:()=>`public:${n}`})),port:i,publicAccess:a}})})}).children(j(a,{onFalse:()=>e.p.children(j(o===``,{onFalse:()=>`https://${o}:${i}`,onTrue:H(`No tailnet address`)})),onTrue:()=>e.label.children(`Hostname`,e.input.attrs({autocapitalize:`none`,name:`hostname`,placeholder:`app.example.com`,required:``,spellcheck:`false`,type:`text`}).disabled(r))}),e.div.class(`deploy-dialog-actions`).children(Ww(e,`Cancel`,r),Nx(e,{disabled:r||!a&&o===``,type:`submit`}).children(j(r,{onFalse:H(`Expose`),onTrue:H(`Exposing…`)})))))}function Kw(e,t,n,r){let i=e.strong.id(`deploy-dialog-title`);return e.dialog.class(`deploy-dialog`).modal(!0).on(`cancel`,()=>$.ClosedDialog()).attr(`aria-labelledby`,`deploy-dialog-title`).children(YC.match(t,{Expose:t=>v(N(t.port.port,a=>[i.children(z(t.port.process,()=>t.port.name)),Gw(e,t,n,r,a)])),Failure:t=>[i.children(`Couldn’t complete the action`),e.p.attr(`role`,`alert`).children(t.text),Ww(e,`Close`)]}))}function qw(e,t,n){return WC.isAnyOf([`Home`])(t)?W($e(t.search.app),An(()=>n),_e(t=>c(e,e=>e.item.id===t))):M()}function Jw(e,t,n){let r=W(zi(e),N(e=>Pn(nC(e.items),sw)),z(T)),i=An(n.defaultApp,()=>W(r,c(e=>!I(e.item.scheduled,!0)),N(e=>e.item.id))),a=W(qw(r,t,i),N(e=>e.item),Ct(e=>e.kind===`service`&&I(e.owned,!0)),N(XS));return{...n,appHistory:W(n.effectiveApp,pa(a),j({onFalse:()=>Et(),onTrue:()=>n.appHistory})),defaultApp:i,effectiveApp:a,inventory:e,route:t}}function Yw(e,t,n=!1){return e.div.class(`deploy-notice`).attr(`role`,`status`).children(e.p.children(t),n&&Nx(e,{}).on(`click`,()=>$.Retry()).children(`Retry`))}function Xw(t,n,r){let i=v(zi(n.metrics));if(e(n.inventory)||e(n.metrics)||e(n.appHistory))return i===void 0?Yw(t,`Couldn’t load history`,!0):Yw(t,`Out of date`,!0);if(sn(r))return Yw(t,Ee(r,` · `));if(Or(n.metrics))return Yw(t,`Loading history…`);if(i!==void 0){if(h(i.samples))return Yw(t,`No history in the last hour`);if(i.stale)return Yw(t,`History is out of date`)}}function Zw(e,t){if(!WC.isAnyOf([`Home`])(t.route))return e.main.class(`deploy-notice`).children(e.a.attr(`href`,`/`).children(`Back to Deploy`));let n=[t.inventory,t.metrics,t.appHistory];if(xn(n,e=>L(En(e),_v)))return xn(n,tw)?Yw(e,`Signing in…`):Yw(e,`Access denied`);let r=v(zi(t.inventory));if(r===void 0)return Or(t.inventory)?Yw(e,`Loading apps…`):Yw(e,`Couldn’t load apps`,!0);let i=zi(t.metrics),a=zi(t.appHistory),o=Pn(nC(r.items),sw),s=qw(o,t.route,t.defaultApp),c=t.route.search.app===GC,l=t.route.search.app===void 0,u=t.route.search.pane===`apps`||l,d=j(c,{onFalse:()=>N(s,e=>e.item.id),onTrue:()=>V(GC)}),f=Xw(e,t,[...ai(r.sources,e=>Ln(N(e.error,t=>`${e.name}: ${t}`))),...Ln(_e(i,e=>e.error))]),p=j(t.narrow,{onFalse:()=>!t.listHidden,onTrue:()=>u}),m=v(W(s,Ct(()=>t.admin&&!(t.narrow&&u)),N(n=>Nw(e,n.item,t.pending,t.logs)))),h=j(c,{onFalse:()=>J(s,{onNone:()=>e.div.class(`axis-row deploy-detail-lead`).children(e.span.children(j(l,{onFalse:H(`App not found`),onTrue:H(`No apps`)}))),onSome:n=>Hw(e,{admin:t.admin,...W(a,N(e=>({app:e})),z(H({}))),free:hC(o),...W(i,N(e=>({history:e})),z(H({}))),now:t.now,pending:t.pending,row:n,rows:o,status:f})}),onTrue:()=>Uw(e,t.now,r,f,v(i))});return aS(e,{actions:m,content:e.main.class(`deploy fold`).attrs({"data-list-hidden":j(!t.narrow&&t.listHidden,{onFalse:Ci,onTrue:H(``)}),"data-show":j(u,{onFalse:H(`detail`),onTrue:H(`list`)})}).children(e.section.class(`fold-list`).attr(`aria-label`,`Apps`).children(jw(e,{admin:t.admin,...W(i,N(e=>({history:e})),z(H({}))),now:t.now,pending:t.pending,...W(a,N(e=>({processes:e})),z(H({}))),rows:o,selected:d,snapshot:r})),e.section.class(`fold-detail`).attr(`aria-label`,`App detail`).children(h),v(N(t.dialog,n=>Kw(e,n,r,t.pending)))),sidebar:Vx(e,p,$.ToggleList({id:d}))})}var Qw=cg({message:$,model:ZC,name:`Deploy`,props:Y({route:WC})}),$w=W(Qw.make({init:e=>({admin:!1,appHistory:Et(),defaultApp:M(),dialog:M(),effectiveApp:M(),inventory:Et(),listHidden:!1,logs:M(),metrics:Et(),narrow:matchMedia(XC).matches,now:In(),pending:!1,route:e.props.route}),subscriptions:e=>[jh(WC,e.model.route,e=>$.Route({route:e})),lv(XC,e=>$.Posture({narrow:e})),WC.isAnyOf([`Home`])(e.model.route)&&cm(`inventory`,oS(DC,e=>$.Inventory({result:e}))),WC.isAnyOf([`Home`])(e.model.route)&&cm(`metrics`,oS(OC,e=>$.Metrics({result:e}))),WC.isAnyOf([`Home`])(e.model.route)&&cm(`account`,oS(Fv,e=>$.Account({admin:L(zi(e),e=>e.admin)}))),cm(`clock`,oS(Rv(`1 second`),e=>$.Clock({now:e}))),v(N(e.model.effectiveApp,e=>cm(`app`,e,e=>oS(kC(e),t=>$.AppHistory({id:e,result:t})))))],update:{Account:(e,t)=>e.evolve({admin:t.admin}),AppHistory:(e,t)=>{if(!I(e.model.effectiveApp,t.id))return e.model;let n=e.evolve({appHistory:t.result});return tw(t.result)?n.run(Ju(ew.make({}))):n},Clock:(e,t)=>e.evolve({now:t.now}),ClosedDialog:e=>e.model.pending&&L(e.model.dialog,YC.isAnyOf([`Expose`]))?e.model:e.evolve({dialog:M()}),ExposureKind:(e,t)=>e.evolve({dialog:N(e.model.dialog,e=>YC.isAnyOf([`Expose`])(e)?YC.cases.Expose.make({kind:t.kind,port:e.port}):e)}),Inventory:(e,t)=>{let n=e.set(Jw(t.result,e.model.route,e.model));return tw(t.result)?n.run(Ju(ew.make({}))):n},Metrics:(e,t)=>{let n=e.evolve({metrics:t.result});return tw(t.result)?n.run(Ju(ew.make({}))):n},OpenedExposure:(e,t)=>!e.model.admin||e.model.pending?e.model:e.evolve({dialog:V(YC.cases.Expose.make({kind:`tailnet`,port:t.port}))}),OpenedLogs:(e,t)=>!e.model.admin||e.model.pending?e.model:e.evolve({logs:M(),pending:!0}).run(QC.make({operation:AC.cases.Logs.make({id:t.id})})),Operation:(e,t)=>!e.model.admin||e.model.pending?e.model:e.evolve({pending:!0}).run(QC.make({operation:t.operation})),OperationDone:(e,t)=>AC.isAnyOf([`Logs`])(t.operation)?e.evolve({logs:N(t.text,fr),pending:!1}):e.evolve({dialog:M(),pending:!1}),OperationFailed:(e,t)=>AC.isAnyOf([`Logs`])(t.operation)?e.evolve({logs:V(ni(t.error)),pending:!1}):e.evolve({dialog:V(YC.cases.Failure.make({text:t.error})),pending:!1}),Posture:(e,t)=>e.evolve({narrow:t.narrow}),Retry:e=>e.run(Ju($C.make({id:e.model.effectiveApp}))),Route:(e,t)=>e.set({...Jw(e.model.inventory,t.route,e.model),dialog:M()}),Select:(e,t)=>WC.isAnyOf([`Home`])(e.model.route)?e.run(Ju(Ch(WC,e.model.route,{app:t.id,pane:`process`},{history:`push`}))):e.model,ToggleList:(e,t)=>{if(!e.model.narrow)return e.evolve({listHidden:!e.model.listHidden});if(!WC.isAnyOf([`Home`])(e.model.route))return e.model;let n=j(e.model.route.search.pane===`apps`||e.model.route.search.app===void 0,{onFalse:H(`apps`),onTrue:H(`process`)});return e.run(Ju(Ch(WC,e.model.route,{app:v(t.id),pane:n},{history:`push`})))}},view:Zw}),dp(W(QC.layer,wa($C.layer),$r(x))));Lv(`@deslop/deploy`);var eT=document.getElementById(`root`);eT!==null&&W(K_($w,Ah(WC),eT,{head:!1}),la(rv({routes:WC})),Cr,et);