@fabiofiorita/porcelain 0.71.0 → 0.71.1
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.
- package/README.md +1 -1
- package/package.json +1 -1
- package/web/dist/assets/_-Cgj9Amlg.js +1 -0
- package/web/dist/assets/_layerId-WtWgdySc.js +1 -0
- package/web/dist/assets/_paired-BhXDazsm.js +1 -0
- package/web/dist/assets/_paired-C2SpPGqV.js +1 -0
- package/web/dist/assets/{_paired-D4B6U2tK.js → _paired-CQqaert8.js} +1 -1
- package/web/dist/assets/{_paired-B5NlVJC_.js → _paired-jHMYqNRe.js} +1 -1
- package/web/dist/assets/_reviewId-DYfy6yXm.js +1 -0
- package/web/dist/assets/_revision-Cl64oJuE.js +1 -0
- package/web/dist/assets/_section-BZ9yGLgf.js +1 -0
- package/web/dist/assets/_worktreeId-9KlGkDDm.js +1 -0
- package/web/dist/assets/_worktreeId-BhXDazsm.js +1 -0
- package/web/dist/assets/_worktreeId-C2SpPGqV.js +1 -0
- package/web/dist/assets/{_worktreeId-CO2pdZDS.js → _worktreeId-CDTAw3Hd.js} +1 -1
- package/web/dist/assets/access-Cf1mwFvV.js +1 -0
- package/web/dist/assets/{connected-workspace-Ct9I-K0k.js → connected-workspace-C1KgZzkv.js} +1 -1
- package/web/dist/assets/{desktop-actions-9fnMnk0K.js → desktop-actions-3aiwi-wY.js} +1 -1
- package/web/dist/assets/{file-editor-BRZ1wGrJ.js → file-editor-CpwgQA6Z.js} +2 -2
- package/web/dist/assets/{files-CbiIDuCN.js → files-D4CzkVZ-.js} +1 -1
- package/web/dist/assets/index-4fobVNe9.js +10 -0
- package/web/dist/assets/index-rsNq4als.css +2 -0
- package/web/dist/assets/lazyRouteComponent-B-XUbSrq.js +1 -0
- package/web/dist/assets/link-DkgNzeiC.js +1 -0
- package/web/dist/assets/pair-BhXDazsm.js +1 -0
- package/web/dist/assets/pair-GnPjxKlt.js +1 -0
- package/web/dist/assets/{review-route-BmOqxMxv.js → review-route-pjHfjF9J.js} +1 -1
- package/web/dist/assets/reviews-CCry97BC.js +1382 -0
- package/web/dist/assets/root-DLTE-HSj.js +1 -0
- package/web/dist/assets/{store-B70lwceg.js → store-C-FZWhob.js} +29 -29
- package/web/dist/assets/useRouterState-3SkCgP-l.js +1 -0
- package/web/dist/assets/{workspace-error-DxSI59T-.js → workspace-error-D6f2voC4.js} +1 -1
- package/web/dist/assets/{workspace-pending-BD49-liX.js → workspace-pending-eUi5r6LE.js} +1 -1
- package/web/dist/index.html +10 -10
- package/web/dist/assets/_-B7WKStG_.js +0 -1
- package/web/dist/assets/_layerId-Cpzkbx-o.js +0 -1
- package/web/dist/assets/_paired-DIrKwyOd.js +0 -1
- package/web/dist/assets/_paired-dOYqBIXq.js +0 -1
- package/web/dist/assets/_reviewId-CcQvm0cu.js +0 -1
- package/web/dist/assets/_revision-BFFo1iEH.js +0 -1
- package/web/dist/assets/_section-B-luVh6R.js +0 -1
- package/web/dist/assets/_worktreeId-BKxKSVKs.js +0 -1
- package/web/dist/assets/_worktreeId-DIrKwyOd.js +0 -1
- package/web/dist/assets/_worktreeId-dOYqBIXq.js +0 -1
- package/web/dist/assets/access-P0rZuFJT.js +0 -1
- package/web/dist/assets/index-BXo5ZqVf.css +0 -2
- package/web/dist/assets/index-YZrLUmqQ.js +0 -10
- package/web/dist/assets/lazyRouteComponent-HdZJNYM2.js +0 -1
- package/web/dist/assets/link-D9sCFypD.js +0 -1
- package/web/dist/assets/pair-dOYqBIXq.js +0 -1
- package/web/dist/assets/pair-xkkjkm9Y.js +0 -1
- package/web/dist/assets/reviews-CQOio1Aq.js +0 -1382
- package/web/dist/assets/useMatch-N1ge3lF_.js +0 -1
- package/web/dist/assets/useRouterState-DuzGu1Qw.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$a as t,$c as n,$o as r,$r as i,$s as a,$t as o,$u as s,Aa as c,Ac as l,Al as u,Ao as d,Ar as f,As as p,At as m,Au as h,Ba as g,Bc as _,Bi as v,Bl as y,Bn as b,Bo as x,Br as S,Bs as C,Bt as w,Bu as T,Ca as E,Ci as D,Cl as O,Co as k,Cr as A,Cs as j,Cu as M,D as N,Dc as P,Di as F,Dl as I,Dn as L,Do as R,Dr as ee,Ds as z,Du as te,E as ne,Ea as re,Ec as ie,Ed as ae,El as B,En as V,Eo as oe,Er as se,Eu as ce,Fa as le,Fc as ue,Fd as de,Fi as fe,Fl as pe,Fn as me,Fr as he,Ft as ge,Fu as _e,G as ve,Ga as ye,Gc as be,Gi as xe,Gl as Se,Gn as Ce,Go as we,Gr as Te,Gs as Ee,Gu as De,Ha as Oe,Hc as ke,Hi as Ae,Hl as je,Hn as Me,Ho as Ne,Hr as Pe,Hs as Fe,Hu as Ie,I as Le,Ic as Re,Ii as ze,Il as Be,Io as Ve,It as He,Iu as Ue,J as We,Ja as Ge,Jc as Ke,Ji as qe,Jl as Je,Jn as Ye,Jr as Xe,Js as Ze,Jt as Qe,Ju as $e,K as et,Kc as tt,Ki as nt,Kl as rt,Kn as it,Kr as at,Ks as ot,Kt as st,Ku as ct,L as lt,Li as ut,Ll as dt,Lr as ft,Lt as pt,Lu as mt,M as ht,Ma as gt,Mc as H,Mi as _t,Ml as vt,Mo as yt,Mt as bt,Mu as xt,N as St,Na as Ct,Nc as wt,Nd as Tt,Ni as Et,Nl as Dt,No as Ot,Nr as kt,Nt as At,Nu as jt,O as Mt,Oa as Nt,Oc as Pt,Od as Ft,Oi as It,Ol as Lt,On as Rt,Or as zt,Os as Bt,Ou as Vt,Pa as Ht,Pc as Ut,Pd as Wt,Pi as Gt,Pl as Kt,Pn as qt,Pr as Jt,Pt as Yt,Pu as Xt,Q as Zt,Qa as Qt,Qc as $t,Qi as en,Ql as tn,Qo as nn,Qr as rn,Qs as an,Qt as on,Qu as sn,Ra as cn,Rc as ln,Ri as un,Rl as dn,Rn as fn,Ro as pn,Rr as mn,Rs as hn,Rt as gn,Sa as _n,Sc as U,Si as vn,Sl as yn,So as bn,Sr as xn,Ss as Sn,Su as Cn,Ta as wn,Tc as W,Td as Tn,Ti as En,Tl as Dn,Tn as On,To as kn,Tr as An,Ts as jn,Tu as Mn,Ua as Nn,Uc as Pn,Ui as Fn,Ul as In,Un as Ln,Ur as Rn,Us as zn,Uu as Bn,V as Vn,Vc as Hn,Vi as Un,Vl as Wn,Vn as Gn,Vr as Kn,Vu as qn,Wa as Jn,Wc as Yn,Wi as Xn,Wl as Zn,Wr as Qn,Ws as $n,X as er,Xa as tr,Xc as nr,Xi as rr,Xl as ir,Xn as ar,Xr as or,Xt as sr,Xu as cr,Ya as lr,Yc as ur,Yi as dr,Yl as fr,Yn as pr,Yo as mr,Yr as hr,Ys as gr,Yt as _r,Yu as vr,Z as yr,Za as br,Zc as xr,Zi as G,Zl as Sr,Zn as Cr,Zo as wr,Zr as Tr,Zs as Er,Zu as Dr,_a as Or,_c as kr,_d as Ar,_i as jr,_l as Mr,_n as Nr,_o as Pr,_u as Fr,aa as Ir,ac as Lr,ad as Rr,ai as zr,al as Br,an as Vr,ao as Hr,ar as Ur,as as Wr,at as Gr,au as Kr,bc as qr,bd as Jr,bi as Yr,bl as Xr,bn as Zr,bo as Qr,br as $r,bu as ei,ca as ti,cc as ni,ci as ri,cl as ii,cn as ai,cr as oi,cs as si,ct as ci,cu as li,da as ui,dc as di,dl as fi,do as pi,dt as mi,du as hi,ea as gi,ec as _i,ed as vi,ei as yi,el as bi,en as xi,eo as Si,er as Ci,es as wi,et as Ti,eu as Ei,fa as Di,fc as Oi,fd as ki,fi as Ai,fl as ji,fo as Mi,fr as Ni,ft as Pi,fu as Fi,ga as Ii,gc as Li,gd as Ri,gi as zi,gl as Bi,go as Vi,gs as Hi,ha as Ui,hc as Wi,hd as Gi,hl as Ki,ho as qi,hr as Ji,ht as Yi,ia as Xi,ic as Zi,id as Qi,ii as $i,il as ea,in as K,io as ta,ir as na,is as ra,iu as ia,ja as aa,jc as oa,jl as sa,jn as ca,jo as la,jr as ua,js as da,jt as fa,ju as pa,ka as ma,kd as ha,kl as ga,kr as _a,kt as va,ku as ya,la as ba,lc as xa,li as q,ll as Sa,ln as Ca,lo as wa,lr as Ta,lt as Ea,lu as Da,mc as Oa,mi as ka,ml as Aa,mn as ja,mo as Ma,mr as Na,ms as Pa,mt as Fa,mu as Ia,na as La,nc as Ra,nd as za,ni as Ba,nl as Va,no as Ha,nr as Ua,nt as Wa,nu as Ga,od as Ka,oi as qa,ol as Ja,oo as Ya,or as Xa,ou as Za,pa as Qa,pc as $a,pd as eo,pi as J,pl as Y,pn as to,po as no,ps as ro,pt as io,pu as ao,qa as oo,qc as so,qi as co,ql as lo,qn as uo,qr as fo,qt as X,qu as po,ra as mo,rc as ho,rd as go,ri as _o,rl as vo,rn as yo,ro as bo,rr as xo,rs as So,rt as Co,ru as wo,sa as To,sc as Eo,sd as Do,si as Oo,sl as ko,sn as Ao,sr as jo,st as Mo,su as No,tc as Po,td as Fo,ti as Io,tl as Lo,tn as Ro,to as zo,tr as Bo,tt as Vo,tu as Ho,uc as Uo,ud as Wo,ul as Go,un as Ko,uo as qo,ur as Jo,us as Yo,ut as Xo,uu as Zo,vc as Qo,vd as $o,vi as es,vl as ts,vn as ns,vo as rs,vr as is,vu as as,wc as os,wd as ss,wl as cs,wn as ls,wo as us,wr as ds,wu as fs,xa as ps,xc as ms,xd as hs,xi as gs,xl as _s,xn as vs,xo as ys,xr as bs,xu as xs,ya as Ss,yc as Cs,yd as ws,yi as Ts,yl as Es,yo as Ds,yr as Os,yu as ks,za as As,zc as js,zi as Ms,zl as Ns,zr as Ps,zs as Fs,zt as Is,zu as Ls}from"./files-D4CzkVZ-.js";var Rs=e=>t=>!sn(e(t)),zs=e=>t=>t.has(e)?vi(t):Dr(t),Bs=Wt(2,(e,t)=>n=>{let r=e(n);return sn(r)?r:t(r.success)}),Vs=(e,t,n)=>{let r=n*(t-e)+e;if(r!==t||e>=t||!Number.isFinite(t))return r;if(t===0)return-Number.MIN_VALUE;let i=new DataView(new ArrayBuffer(8));i.setFloat64(0,t);let a=i.getBigUint64(0);return i.setBigUint64(0,t>0?a-BigInt(1):a+BigInt(1)),i.getFloat64(0)},Hs=`~effect/PlatformError`,Us=class extends Ue(`BadArgument`){get message(){return`${this.module}.${this.method}${this.description?`: ${this.description}`:``}`}},Ws=class extends _e{get message(){return`${this._tag}: ${this.module}.${this.method}${this.pathOrDescriptor===void 0?``:` (${this.pathOrDescriptor})`}${this.description?`: ${this.description}`:``}`}},Gs=class extends Ue(`PlatformError`){constructor(e){`cause`in e?super({reason:e,cause:e.cause}):super({reason:e})}[Hs]=Hs;get message(){return this.reason.message}},Ks=e=>new Gs(new Ws(e)),qs=e=>new Gs(new Us(e)),Js=`~effect/socket/Socket`,Ys=za(`effect/socket/Socket`),Xs=e=>Ys.of({[Js]:Js,reader:e.reader,writer:e.writer}),Zs=new TextEncoder,Qs=`~effect/socket/Socket/CloseEvent`,$s=e=>ha(e,Qs),ec=`~effect/socket/Socket/SocketError`,tc=e=>ha(e,ec),nc=class extends pn(`effect/socket/Socket/SocketReadError`)({_tag:p(`SocketReadError`),cause:Ve()}){message=`An error occurred during Read`},rc=class extends pn(`effect/socket/Socket/SocketWriteError`)({_tag:p(`SocketWriteError`),cause:Ve()}){message=`An error occurred during Write`},ic=class extends pn(`effect/socket/Socket/SocketOpenError`)({_tag:p(`SocketOpenError`),kind:Ne([`Unknown`,`Timeout`]),cause:Ve()}){get message(){return this.kind===`Timeout`?`timeout waiting for "open"`:`An error occurred during Open`}},ac=class e extends pn(`effect/socket/Socket/SocketUpgradeError`)({_tag:p(`SocketUpgradeError`),cause:Bt(Ve())}){static unsupported=()=>U(new cc({reason:new e({})}));get message(){return this.cause===void 0?`Socket does not support TLS upgrade`:`An error occurred during TLS upgrade`}},oc=class extends pn(`effect/socket/Socket/SocketCloseError`)({_tag:p(`SocketCloseError`),code:x,closeReason:Bt(nn)}){get message(){return this.closeReason?`${this.code}: ${this.closeReason}`:`${this.code}`}},sc=ra([nc,rc,ic,ac,oc]),cc=class extends wi(ec)(`SocketError`,{_tag:p(`SocketError`),reason:sc}){constructor(e){`cause`in e.reason?super({...e,cause:e.reason.cause}):super(e)}[ec]=ec;static is(e){return tc(e)}message=this.reason.message},lc=(e,t)=>new cc({reason:new oc({code:e,closeReason:t})}),uc=class extends za()(`@effect/platform/Socket/WebSocketConstructor`){},dc=(e,t)=>uc.use(n=>pc(Po((typeof e==`string`?fi(e):e).pipe(_(e=>n(e,t?.protocols))),e=>Y(()=>e.close(1e3))),t)),fc=e=>`pause`in e&&typeof e.pause==`function`,pc=(e,t)=>Lt(n=>{let r,i=qi(!1),a=n.context,o=H(function*(){let n=yield*ko,a=yield*Ei(e,n);`binaryType`in a&&(a.binaryType=`arraybuffer`);let o=fc(a),s=t?.highWaterMark??(o?mc:void 0),c=a.readyState===1,l=o&&`isPaused`in a&&a.isPaused===!0,u=[],d=0,f,p,m;function h(){o&&!l&&(a.pause(),l=!0)}function g(){o&&l&&(a.resume(),l=!1)}function _(){let e=u;return u=[],d=0,f===void 0&&g(),e}function v(){if(p===void 0||u.length===0)return;let e=p;p=void 0,e(fi(_()))}function y(e){u.push(e),s!==void 0&&(d+=typeof e==`string`?Zs.encode(e).byteLength:e.byteLength),p!==void 0&&v(),o&&d>=s?h():!o&&!p&&s!==void 0&&d>s&&b(new cc({reason:new nc({cause:Error(`Socket highWaterMark of ${s} bytes exceeded`)})}))}function b(e){if(f===void 0&&(f=e),m!==void 0){let{cleanup:e,resume:t}=m;m=void 0,e(),t(U(f))}if(p!==void 0){let e=p;p=void 0,e(u.length>0?fi(_()):U(f))}}function x(e){let t=e.data;if(typeof Blob<`u`&&t instanceof Blob){t.arrayBuffer().then(e=>y(new Uint8Array(e)),e=>{b(new cc({reason:new nc({cause:e})}))});return}y(t instanceof ArrayBuffer?new Uint8Array(t):t)}function S(e){b(new cc({reason:c?new nc({cause:e}):new ic({kind:`Unknown`,cause:e})}))}function C(e){b(lc(typeof e.code==`number`?e.code:1006,e.reason))}return a.addEventListener(`message`,x),a.addEventListener(`error`,S,{once:!0}),a.addEventListener(`close`,C,{once:!0}),yield*fr(n,Y(()=>{if(b(lc(1006)),a.removeEventListener(`message`,x),a.removeEventListener(`error`,S),a.removeEventListener(`close`,C),o)try{g()}catch{}i.closeUnsafe(),r=void 0})),a.readyState>=2?yield*U(f??lc(1006)):(c||=(yield*Uo(e=>{let t=()=>{m?.resume===e&&(m=void 0,a.removeEventListener(`open`,t),e(B))},n=()=>a.removeEventListener(`open`,t);return m={resume:e,cleanup:n},a.addEventListener(`open`,t,{once:!0}),Y(()=>{m?.resume===e&&(m=void 0),n()})}).pipe(Es({duration:t?.openTimeout??1e4,orElse:()=>U(new cc({reason:new ic({kind:`Timeout`,cause:Error(`timeout waiting for "open"`)})}))})),!0),f===void 0&&d<s&&g(),r=a,i.openUnsafe(),{pull:Uo(e=>u.length>0?e(fi(_())):f===void 0?(p=e,Y(()=>{p===e&&(p=void 0)})):e(U(f))),upgrade:ac.unsupported})}).pipe(cs(e=>Wo(a,e))),s=e=>ji(()=>{let t=r;if(t===void 0)return i.whenOpen(s(e));try{return $s(e)?t.close(e.code,e.reason):t.send(e),B}catch(e){return U(new cc({reason:new rc({cause:e})}))}}),c=e=>ji(()=>{let t=r;if(t===void 0)return i.whenOpen(c(e));try{for(let n=0;n<e.length;n++)t.send(e[n]);return B}catch(e){return U(new cc({reason:new rc({cause:e})}))}}),l=fi({write:s,writeAll:c});return fi(Xs({reader:o,writer:l}))}),mc=65536,hc=class extends za()(`effect/workers/Transferable/Collector`){},gc=()=>{let e=[],t=t=>{e.push(...t)},n=()=>e,r=()=>{let t=e;return e=[],t};return hc.of({addAllUnsafe:t,addAll:e=>Y(()=>t(e)),readUnsafe:n,read:Y(n),clearUnsafe:r,clear:Y(r)})},_c=ra([class extends pn(`effect/workers/WorkerError/WorkerSpawnError`)({_tag:p(`WorkerSpawnError`),message:nn,cause:Bt(Ve())}){},class extends pn(`effect/workers/WorkerError/WorkerSendError`)({_tag:p(`WorkerSendError`),message:nn,cause:Bt(Ve())}){},class extends pn(`effect/workers/WorkerError/WorkerReceiveError`)({_tag:p(`WorkerReceiveError`),message:nn,cause:Bt(Ve())}){},class extends pn(`effect/workers/WorkerError/WorkerUnknownError`)({_tag:p(`WorkerUnknownError`),message:nn,cause:Bt(Ve())}){}]),vc=`~effect/rpc/RpcClientError`,yc=class extends pn(`effect/rpc/RpcClientError/RpcClientDefect`)({_tag:p(`RpcClientDefect`),message:nn,cause:Ve()}){},bc=class extends pn(vc)({_tag:p(`RpcClientError`),reason:ra([_c,sc,Xn,yc])}){[vc]=vc;get message(){return`${this.reason._tag}: ${this.reason.message}`}},xc=e=>e,Sc={_tag:`Ping`},Cc=da,wc,Tc=e=>(wc??=new TextDecoder).decode(e),Ec=class extends za()(`effect/rpc/RpcSerialization`){},Dc=Ec.of({contentType:`application/json`,includesFraming:!1,codecFor:Cc,makeUnsafe:()=>({decode:e=>{let t=JSON.parse(typeof e==`string`?e:Tc(e));return Array.isArray(t)?t:[t]},encode:e=>JSON.stringify(e)})}),Oc=e=>ji(()=>{let t=new Set,n=new Map,r=new Map,i=(e,t)=>kr(r=>{let i=n.get(e);return i||(i=[],n.set(e,i)),i.push([t,r]),B});return _(e((e,t)=>{let n=r.get(e);return n?n(t):i(e,t)},t),e=>({...e,run(e,i){return H(function*(){t.add(e),r.set(e,i);let a=n.get(e);if(a){n.delete(e);for(let[e,t]of a)yield*$t(ji(()=>i(e)),t)}return yield*tt(Yn,()=>(t.delete(e),r.delete(e),B))})}}))}),kc=0,Ac=ie(function*(e,t){let n=t?.spanPrefix??`RpcClient`,r=t?.supportsAck??!0,i=t?.disableTracing??!1,a=t?.generateRequestId??(()=>kc++),o=yield*Li(),s=Rr(o,Je),u=new Map,d=!1;yield*fr(s,Lt(e=>(d=!0,f(Zo(e.id)))));let f=ie(function*(e){for(let[t,n]of u)u.delete(t),n._tag===`Queue`?yield*e._tag===`Success`?Hr(n.queue):Ya(n.queue,e.cause):n.resume(e)}),p=e=>{let r=ze(e.successSchema),a=g(e);return(o,s)=>{let l=s?.headers?Fs(s.headers):hn,u=s?.context??Qi();if(!r){let r=t=>m(e,a,t,e.payloadSchema.make(o),l,u,s?.discard??!1);return i?r(void 0):Dn(`${n}.${e._tag}`,{attributes:t.spanAttributes},r)}let d=h(e,a,e.payloadSchema.make(o),l,s?.streamBufferSize??16,u);return s?.asQueue?d:ye(_(d,c))}},m=(e,n,r,i,o,s,c)=>Lt(l=>{if(d)return ue;let f=a(),p=n(e=>t.onFromClient({message:e,context:s,discard:c}),{_tag:`Request`,id:f,tag:e._tag,payload:i,...r?{traceId:r.traceId,spanId:r.spanId,sampled:r.sampled}:{},headers:C(l.getRef(Pc),o)});if(c)return p;let m;return so(Uo(t=>{let n={_tag:`Effect`,rpc:e,context:s,resume(e){t(e),m&&!m.pollUnsafe()&&l.currentDispatcher.scheduleTask(()=>{m.interruptUnsafe(l.id)},0)}};u.set(f,n),m=p.pipe(r?ga(r,{captureStackTrace:!1}):de,ea(l.context)),m.addObserver(e=>{if(e._tag===`Failure`)return t(e)})}),e=>(u.delete(f),Lr(rs(m),v(f,Array.from(e),s))))}),h=ie(function*(e,r,o,s,c,f){if(d)return yield*ue;let p=i?void 0:yield*js(`${n}.${e._tag}`,{attributes:t.spanAttributes}),m=Pr(),h=a(),g=Do(m.context,Je),_=yield*ta(c);return yield*ir(g,e=>(Mi(_),u.has(h)?(u.delete(h),v(h,hi(e)?Array.from(xs(e.cause)):[],f)):B)),u.set(h,{_tag:`Queue`,rpc:e,queue:_,scope:g,context:f}),yield*r(e=>t.onFromClient({message:e,context:f,discard:!1}),{_tag:`Request`,id:h,tag:e._tag,payload:o,...p?{traceId:p.traceId,spanId:p.spanId,sampled:p.sampled}:{},headers:C(m.getRef(Pc),s)}).pipe(p?ga(p,{captureStackTrace:!1}):de,be(e=>Ya(_,e)),Re,l(g,{startImmediately:!0})),_}),g=e=>{let t=[];for(let n of e.middlewares.values()){let e=Ka(o,`${n.key}/Client`);e&&t.push(e)}return t.length===0?(e,t)=>e(t):function n(r,i,a=t.length-1){return a===-1?r(i):t[a]({rpc:e,request:i,next(e){return n(r,e,a-1)}})}},v=(e,n,r)=>Uo(i=>{let a=Pr();t.onFromClient({message:{_tag:`Interrupt`,requestId:e,interruptors:n},context:r,discard:!1}).pipe(Mr(1e3),ea(a.context)).addObserver(()=>{i(B)})}),y=e=>{switch(e._tag){case`Chunk`:{let n=e.requestId,i=u.get(n);return!i||i._tag!==`Queue`?B:wa(i.queue,e.values).pipe(r?os(()=>t.onFromClient({message:{_tag:`Ack`,requestId:e.requestId},context:i.context,discard:!1})):de,di(e=>Ya(i.queue,e)))}case`Exit`:{let t=e.requestId,n=u.get(t);return n?(u.delete(t),n._tag===`Effect`?(n.resume(e.exit),B):e.exit._tag===`Success`?Hr(n.queue):Ya(n.queue,e.exit.cause)):B}case`Defect`:return f(No(e.defect));case`ClientEnd`:return B}},b;if(t.flatten){let t=new Map;b=function(n,r,i){let a=t.get(n);return a||(a=p(e.requests.get(n)),t.set(n,a)),a(r,i)}}else b={},e.requests.forEach(e=>{ae(b,e._tag,p(e))});return{client:b,write:y}}),jc=0,Mc=ie(function*(e,t){let n=jc++,{codecFor:r,run:i,send:a,supportsAck:o,supportsTransferables:s}=yield*Fc,c=Nc(r),l=si(r(Ve())),u=new Map,d=e=>u.has(e)?(u.delete(e),a(n,{_tag:`Interrupt`,requestId:e})):B,{client:f,write:p}=yield*Ac(e,{...t,supportsAck:o,onFromClient({message:t}){switch(t._tag){case`Request`:{let r=e.requests.get(t.tag),i=s?gc():void 0,o=Pr(),l={rpc:r,context:i?go(o.context,hc,i):o.context,schemas:c(r)};return u.set(t.id,l),l.schemas.encodePayload(t.payload).pipe($t(l.context),ur,os(e=>a(n,{...t,id:t.id,payload:e,headers:Object.entries(t.headers)},i&&i.readUnsafe())))}case`Ack`:return u.get(t.requestId)?a(n,{_tag:`Ack`,requestId:t.requestId}):B;case`Interrupt`:return d(t.requestId);case`Eof`:return B}}});return yield*i(n,e=>{switch(e._tag){case`Chunk`:{let t=xc(e.requestId),n=u.get(t);if(!n||Ri(n.schemas.decodeChunk))return B;let r=n.schemas.decodeChunk.value;return O(i=>i(r(e.values).pipe($t(n.context),ur,os(e=>p({_tag:`Chunk`,clientId:0,requestId:t,values:e})))).pipe(be(e=>p({_tag:`Exit`,clientId:0,requestId:t,exit:Da(e)}).pipe(Lr(ks(e)?B:wt(d(t))))),Oi(e=>!ks(e),()=>B)))}case`Exit`:{let t=xc(e.requestId),n=u.get(t);return n?(u.delete(t),n.schemas.decodeExit(e.exit).pipe($t(n.context),ur,Pn({onSuccess:e=>p({_tag:`Exit`,clientId:0,requestId:t,exit:e}),onFailure:e=>p({_tag:`Exit`,clientId:0,requestId:t,exit:Da(e)})}))):B}case`Defect`:return p({_tag:`Defect`,clientId:0,defect:l(e.defect)});case`ClientProtocolError`:{let t=li(e.error);return P(Array.from(u.keys()),e=>p({_tag:`Exit`,clientId:0,requestId:e,exit:t}))}default:return B}}).pipe(di(ln),Re,oa),f}),Nc=e=>{let t=new WeakMap;return n=>{let r=t.get(n);if(r!==void 0)return r;let i=fe(n.successSchema);return r={decodeChunk:$o(i,t=>Yo(e(we(t.success)))),encodePayload:ro(e(n.payloadSchema)),decodeExit:Yo(e(Gt(n)))},t.set(n,r),r}},Pc=Fo(`effect/rpc/RpcClient/CurrentHeaders`,{defaultValue:()=>hn}),Fc=class extends za()(`effect/rpc/RpcClient/Protocol`){static make=Oc},Ic=e=>Fc.make(ie(function*(t,n){let r=yield*Ys,i=yield*Ec,a=yield*Sa(zc),o=new Map,c=yield*r.writer,l=i.makeUnsafe(),u=yield*Rc(ji(()=>c.write(l.encode(Sc)))),d,f=e=>P(n,n=>t(n,e)),p=e=>(d=e,f({_tag:`ClientProtocolError`,error:e})),m=e=>{try{let n=l.decode(e);if(n.length===0)return B;let r=0;return I({while:()=>r<n.length,body:()=>{let e=n[r++];if(e._tag===`Pong`)return u.onPong(),B;if(Object.hasOwn(e,`requestId`)){let n=e.requestId,r=o.get(n);if(r!==void 0)return e._tag===`Exit`&&o.delete(n),t(r,e)}return f(e)},step:Tt})}catch(e){return f({_tag:`ClientProtocolError`,error:new bc({reason:new yc({message:`Error decoding message`,cause:e})})})}};return yield*ji(()=>(l=i.makeUnsafe(),u.reset(),H(function*(){let{pull:e}=yield*r.reader;for(d=void 0,Ar(a)&&(yield*a.value.onConnect);;){let t=yield*e;for(let e=0;e<t.length;e++)yield*m(t[e])}}).pipe(ii,bi(os(u.timeout,()=>U(new cc({reason:new nc({cause:Error(`ping timeout`)})}))))))).pipe(Ar(a)?qr(a.value.onDisconnect):de,Ki(t=>{let n=as(t),r=s(n),i=new bc({reason:r?n.success.reason:new yc({message:`Unknown socket error`,cause:Cn(t)})});return e?.retryTransientErrors&&r&&n.success.reason._tag===`SocketOpenError`?(e.onTransientError?.(i)??B).pipe(Ut({log:!0,message:`RpcClient onTransientError hook failed`})):p(i)}),Va(e?.retryPolicy??Lc,e=>p(new bc({reason:e.reason}))),Eo({module:`RpcClient`,method:`makeProtocolSocket`}),oa),{send(e,t){if(d)return U(d);t._tag===`Request`&&o.set(t.id,e);let n=l.encode(t);return n===void 0?B:ur(c.write(n))},supportsAck:!0,supportsTransferables:!1,codecFor:i.codecFor}})),Lc=Dt([sa(500,1.5),pe(5e3)]),Rc=ie(function*(e){let t=!0,n=qi();return yield*ji(()=>t?(t=!1,e):n.open).pipe(Qo(`5 seconds`),wt,Pt,Re,oa),{timeout:n.await,reset:()=>{t=!0,n.closeUnsafe()},onPong:()=>{t=!0}}}),zc=class extends za()(`effect/rpc/RpcClient/ConnectionHooks`){},Z=e(Et(),1),Bc=Z.createContext(null);function Vc(e){return Z.useContext(Bc)}var Q=_t(),Hc=e(It(),1),Uc=`data-open`,Wc=`data-closed`,Gc=xn,Kc=bs,qc=`data-anchor-hidden`,Jc={[is]:``},Yc={[is]:``,[Os]:``},Xc={[Uc]:``},Zc={[Wc]:``},Qc={[qc]:``},$c={open(e){return e?Jc:null}},el={open(e){return e?Yc:null}},tl={open(e){return e?Xc:Zc},anchorHidden(e){return e?Qc:null}},nl={...tl,...$r};function rl(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...rl(e,t.id,n)])}function il(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function al(e){e.preventDefault(),e.stopPropagation()}function ol(e){return`nativeEvent`in e}function sl(e){return e.pointerType===``&&e.isTrusted?!0:Jt&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function cl(e){return ua?!1:!Jt&&e.width===0&&e.height===0||Jt&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function ll(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function ul(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}var dl=Math.min,fl=Math.max,pl=Math.round,ml=Math.floor,hl=e=>({x:e,y:e}),gl={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function _l(e,t,n){return fl(e,dl(t,n))}function vl(e,t){return typeof e==`function`?e(t):e}function yl(e){return e.split(`-`)[0]}function bl(e){return e.split(`-`)[1]}function xl(e){return e===`x`?`y`:`x`}function Sl(e){return e===`y`?`height`:`width`}function Cl(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function wl(e){return xl(Cl(e))}function Tl(e,t,n){n===void 0&&(n=!1);let r=bl(e),i=wl(e),a=Sl(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Pl(o)),[o,Pl(o)]}function El(e){let t=Pl(e);return[Dl(e),t,Dl(t)]}function Dl(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Ol=[`left`,`right`],kl=[`right`,`left`],Al=[`top`,`bottom`],jl=[`bottom`,`top`];function Ml(e,t,n){switch(e){case`top`:case`bottom`:return n?t?kl:Ol:t?Ol:kl;case`left`:case`right`:return t?Al:jl;default:return[]}}function Nl(e,t,n,r){let i=bl(e),a=Ml(yl(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Dl)))),a}function Pl(e){let t=yl(e);return gl[t]+e.slice(t.length)}function Fl(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function Il(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Fl(e)}function Ll(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Rl(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}function zl(e){let t=ka(Bl,e).current;return t.next=e,J(t.effect),t}function Bl(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var Vl=0;function Hl(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(Vl);function a(){(!i||i())&&e?.focus({preventScroll:n})}if(r)return a(),es;let o=requestAnimationFrame(a);return Vl=o,()=>{Vl===o&&(cancelAnimationFrame(o),Vl=0)}}var Ul={inert:new WeakMap,"aria-hidden":new WeakMap},Wl=`data-base-ui-inert`,Gl={inert:new WeakSet,"aria-hidden":new WeakSet},Kl=new WeakMap,ql=0;function Jl(e){return Gl[e]}function Yl(e){return e?$i(e)?e.host:Yl(e.parentNode):null}var Xl=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=Yl(t);return e.contains(n)?n:null}).filter(e=>e!=null),Zl=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},Ql=(e,t,n)=>{let r=[],i=e=>{e&&!n.has(e)&&Array.from(e.children).forEach(e=>{Xe(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function $l(e,t,n,r,{mark:i=!0}){let a=null;r?a=`inert`:n&&(a=`aria-hidden`);let o=null,s=null,c=Xl(t,e),l=i?Ql(t,Zl(c),new Set(c)):[],u=[],d=[];if(a){let e=Ul[a],n=Jl(a);s=n,o=e;let r=Xl(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=c.concat(r);Ql(t,Zl(i),new Set(i)).forEach(t=>{let r=t.getAttribute(a),i=r!==null&&r!==`false`,o=(e.get(t)||0)+1;e.set(t,o),u.push(t),o===1&&i&&n.add(t),i||t.setAttribute(a,a===`inert`?``:`true`)})}return i&&l.forEach(e=>{let t=(Kl.get(e)||0)+1;Kl.set(e,t),d.push(e),t===1&&e.setAttribute(Wl,``)}),ql+=1,()=>{o&&u.forEach(e=>{let t=(o.get(e)||0)-1;o.set(e,t),t||(!s?.has(e)&&a&&e.removeAttribute(a),s?.delete(e))}),i&&d.forEach(e=>{let t=(Kl.get(e)||0)-1;Kl.set(e,t),t||e.removeAttribute(Wl)}),--ql,ql||(Ul.inert=new WeakMap,Ul[`aria-hidden`]=new WeakMap,Gl.inert=new WeakSet,Gl[`aria-hidden`]=new WeakSet,Kl=new WeakMap)}}function eu(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0}=t,a=Pe(e[0]).body;return $l(e,a,n,r,{mark:i})}function tu(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var nu=class{nodesRef={current:[]};events=tu();addNode(e){this.nodesRef.current.push(e)}removeNode(e){let t=this.nodesRef.current.findIndex(t=>t===e);t!==-1&&this.nodesRef.current.splice(t,1)}},ru=Z.createContext(null),iu=Z.createContext(null),au=()=>Z.useContext(ru)?.id||null,ou=e=>{let t=Z.useContext(iu);return e??t};function su(e){let t=ca(),n=ou(e),r=au();return J(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function cu(e){let{children:t,id:n}=e,r=au();return(0,Q.jsx)(ru.Provider,{value:Z.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function lu(e){let{children:t,externalTree:n}=e,r=ka(()=>n??new nu).current;return(0,Q.jsx)(iu.Provider,{value:r,children:t})}function uu(e,t){let n=rn(f(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var du=20,fu=[];function pu(){fu=fu.filter(e=>e.deref()?.isConnected)}function mu(e){pu(),e&&Xe(e)!==`body`&&(fu.push(new WeakRef(e)),fu.length>du&&(fu=fu.slice(-20)))}function hu(){return pu(),fu[fu.length-1]?.deref()}function gu(e){return e?Bo(e)?e:Ua(e)[0]||e:null}function _u(e){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!e.getAttribute(`role`)?.includes(`dialog`))return;let t=pr(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return Bo(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),n=e.getAttribute(`tabindex`);t.length===0?n!==`0`&&(e.setAttribute(`tabindex`,`0`),e.setAttribute(`data-tabindex`,`0`)):(n!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function vu(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,restoreFocus:o=!1,modal:s=!0,closeOnFocusOut:c=!0,openInteractionType:l=``,nextFocusableElement:u,previousFocusableElement:d,beforeContentFocusGuardRef:p,externalTree:m,getInsideElements:h}=e,g=`rootStore`in t?t.rootStore:t,_=g.useState(`open`),v=g.useState(`domReferenceElement`),y=g.useState(`floatingElement`),{events:x,dataRef:C}=g.context,w=q(()=>C.current.floatingContext?.nodeId),T=i===!1,E=Na(v)&&T,D=zl(i),O=zl(a),k=zl(l),A=zl(_),j=ou(m),M=Ao(),N=Z.useRef(!1),P=Z.useRef(!1),F=Z.useRef(!1),I=Z.useRef(null),L=Z.useRef(``),R=Z.useRef(``),ee=Z.useRef(null),z=Z.useRef(null),te=Ce(ee,p,M?.beforeInsideRef),ne=Ce(z,M?.afterInsideRef),re=mn(),ie=mn(),ae=S(),B=M!=null,V=Ta(y),oe=q((e=V)=>e?Ua(e):[]),se=q(()=>h?.().filter(e=>e!=null)??[]);Z.useEffect(()=>{if(r||!s)return;function e(e){e.key===`Tab`&&_a(V,zt(Pe(V)))&&oe().length===0&&!E&&al(e)}let t=Pe(V);return Kn(t,`keydown`,e)},[r,V,s,E,oe]),Z.useEffect(()=>{if(r||!_)return;let e=Pe(V);function t(){F.current=!1}function n(e){let t=f(e),n=se(),r=_a(y,t)||_a(v,t)||_a(M?.portalNode,t)||n.some(e=>e===t||_a(e,t));F.current=!r,R.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(P.current=!0,ie.start(0,()=>{P.current=!1}))}function i(){R.current=`keyboard`}return Rn(Kn(e,`pointerdown`,n,!0),Kn(e,`pointerup`,t,!0),Kn(e,`pointercancel`,t,!0),Kn(e,`keydown`,i,!0),t)},[r,y,v,V,_,M,ie,se]),Z.useEffect(()=>{if(r||!c)return;let e=Pe(V);function t(){P.current=!0,ie.start(0,()=>{P.current=!1})}function n(e){let t=f(e);Bo(t)&&(I.current=t)}function i(t){let n=t.relatedTarget,r=t.currentTarget,i=f(t);s&&n==null&&i!=null&&_a(y,i)&&mu(i),queueMicrotask(()=>{let a=w(),c=g.context.triggerElements,l=se(),f=n?.hasAttribute(ai(`focus-guard`))&&[ee.current,z.current,M?.beforeInsideRef.current,M?.afterInsideRef.current,M?.beforeOutsideRef.current,M?.afterOutsideRef.current,b(d),b(u)].includes(n),p=!(_a(v,n)||_a(y,n)||_a(n,y)||_a(M?.portalNode,n)||l.some(e=>e===n||_a(e,n))||c.hasMatchingElement(e=>_a(e,n))||f||j&&(rl(j.nodesRef.current,a).find(e=>_a(e.context?.elements.floating,n)||_a(e.context?.elements.domReference,n))||il(j.nodesRef.current,a).find(e=>[e.context?.elements.floating,Ta(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===v&&V&&_u(V),o&&r!==v&&!Xa(i)&&zt(e)===e.body){if(Io(V)&&(V.focus(),o===`popup`)){ae.request(()=>{V.focus()});return}let e=oe(),t=I.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||V;Io(n)&&n.focus()}if(C.current.insideReactTree){C.current.insideReactTree=!1;return}(E||!s)&&n&&p&&!P.current&&(E||n!==hu())&&(N.current=!0,g.setOpen(!1,Ca(ja,t)))})}function a(){F.current||(C.current.insideReactTree=!0,re.start(0,()=>{C.current.insideReactTree=!1}))}let l=Io(v)?v:null;if(y||l)return Rn(l&&Kn(l,`focusout`,i),l&&Kn(l,`pointerdown`,t),y&&Kn(y,`focusin`,n),y&&Kn(y,`focusout`,i),y&&M&&Kn(y,`focusout`,a,!0))},[r,v,y,V,s,j,M,g,c,o,oe,E,w,C,re,ie,ae,u,d,se]),Z.useEffect(()=>{if(r||!y||!_)return;let e=Array.from(M?.portalNode?.querySelectorAll(`[${ai(`portal`)}]`)||[]),t=(j?il(j.nodesRef.current,w()):[]).find(e=>Na(e.context?.elements.domReference||null))?.context?.elements.domReference,n=eu([y,...e,ee.current,z.current,M?.beforeOutsideRef.current,M?.afterOutsideRef.current,...se(),t,b(d),b(u),E?v:null].filter(e=>e!=null),{ariaHidden:s||E,mark:!1}),i=eu([y,...e].filter(e=>e!=null));return()=>{i(),n()}},[_,r,v,y,s,M,E,j,w,u,d,se]),J(()=>{if(!_||r||!Io(V))return;L.current=``,R.current=``;let e=Pe(V),t=zt(e);queueMicrotask(()=>{let n=D.current,r=typeof n==`function`?n(k.current||``):n;if(r===void 0||r===!1||_a(V,t))return;let i=null,a=()=>(i??=oe(V),i[0]||V),o;o=r===!0||r===null?a():b(r),o||=a();let s=_a(V,zt(e));Hl(o,{preventScroll:o===V,shouldFocus(){if(!A.current)return!1;if(s)return!0;let t=zt(e);return!(t!==o&&_a(V,t))}})})},[r,_,V,oe,D,k,A]),J(()=>{if(r||!V)return;let e=Pe(V),t=zt(e),n=k.current==null;mu(t);function i(e){if(e.open||(L.current=uu(e.nativeEvent,R.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(N.current=!0),e.reason===`outside-press`){if(e.nested)N.current=!1;else if(sl(e.nativeEvent)||cl(e.nativeEvent))N.current=!1;else{let e=!1;Pe(V).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?N.current=!1:N.current=!0}}}x.on(`openchange`,i);function a(e){let r=O.current,i=typeof r==`function`?r(e):r;if(i===void 0||i===!1)return null;i===null&&(i=!0);let a=v?.isConnected?v:null,o=t?.isConnected&&Xe(t)!==`body`?t:null,s=n?o||a:a||o;return s||=hu()||null,typeof i==`boolean`?s:b(i)||s||null}return()=>{x.off(`openchange`,i);let t=zt(e),n=se(),r=_a(y,t)||n.some(e=>e===t||_a(e,t))||j&&rl(j.nodesRef.current,w(),!1).some(e=>_a(e.context?.elements.floating,t)),o=O.current,s=L.current,c=a(s);queueMicrotask(()=>{let n=gu(c),i=typeof o!=`boolean`;if(o&&!N.current&&Io(n)&&(i||n===t||t===e.body||r)){let e={preventScroll:!0};s===`keyboard`&&(e.focusVisible=!0),n.focus(e)}N.current=!1})}},[r,y,V,O,k,x,j,v,w,se]),J(()=>{if(!kt||_||!y)return;let e=zt(Pe(y));Io(e)&&Ji(e)&&_a(y,e)&&e.blur()},[_,y]),J(()=>{if(!r&&M)return M.setFocusManagerState({modal:s,closeOnFocusOut:c,open:_,onOpenChange:g.setOpen,domReference:v}),()=>{M.setFocusManagerState(null)}},[r,M,s,_,g,c,v]),J(()=>{if(!r&&V)return _u(V),()=>{queueMicrotask(pu)}},[r,V]);let ce=!r&&(!s||!E)&&(B||s);return(0,Q.jsxs)(Z.Fragment,{children:[ce&&(0,Q.jsx)(it,{"data-type":`inside`,ref:te,onFocus:e=>{if(s){let e=oe();Hl(e[e.length-1])}else M?.portalNode&&(N.current=!1,Ci(e,M.portalNode)?ar(v)?.focus():b(d??M.beforeOutsideRef)?.focus())}}),n,ce&&(0,Q.jsx)(it,{"data-type":`inside`,ref:ne,onFocus:e=>{s?Hl(oe()[0]):M?.portalNode&&(c&&(N.current=!0),Ci(e,M.portalNode)?Cr(v)?.focus():b(u??M.afterOutsideRef)?.focus())}})]})}function yu(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=On}=t,l=`rootStore`in e?e.rootStore:e,u=l.context.dataRef,d=Z.useRef(void 0),p=S(),m=mn(),h=Z.useMemo(()=>{function e(e,t,n,r){let i=Ca(c,t,n);e&&r===`touch`&&s>0?m.start(s,()=>{l.setOpen(!0,i)}):l.setOpen(e,i)}function t(e,t,n){let r=u.current.openEvent,a=l.select(`domReferenceElement`)!==t;return e&&a||!e||!i?!0:r&&o?!n(r.type):!1}return{onPointerDown(e){d.current=ll(e.pointerType,!0)&&cl(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(n){let i=d.current,o=n.nativeEvent,s=l.select(`open`);if(n.button!==0||r===`click`||ll(i,!0)&&a)return;let c=t(s,n.currentTarget,e=>e===`click`||e===`mousedown`),u=f(o);if(Ji(u)){e(c,o,u,i);return}let m=n.currentTarget;p.request(()=>{e(c,o,m,i)})},onClick(n){if(r===`mousedown-only`)return;let i=d.current;if(r===`mousedown`&&i){d.current=void 0;return}ll(i,!0)&&a||e(t(l.select(`open`),n.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),n.nativeEvent,n.currentTarget,i)},onKeyDown(){d.current=void 0}}},[u,r,a,c,l,o,i,p,m,s]);return Z.useMemo(()=>n?{reference:h}:jr,[n,h])}function bu(){return!1}function xu(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function Su(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=bu,bubbles:s,externalTree:c}=t,l=`rootStore`in e?e.rootStore:e,u=l.useState(`open`),d=l.useState(`floatingElement`),{dataRef:p,events:m}=l.context,h=ou(c),g=q(typeof i==`function`?i:()=>!1),_=typeof i==`function`?g:i,v=_!==!1,y=q(()=>a),{escapeKey:b,outsidePress:x}=xu(s),S=Z.useRef(!1),C=Z.useRef(!1),w=Z.useRef(!1),T=Z.useRef(!1),E=Z.useRef(!1),D=Z.useRef(``),O=Z.useRef(null),k=mn(),A=mn(),j=q(()=>{A.clear(),p.current.insideReactTree=!1}),M=q(e=>{let t=p.current.floatingContext?.nodeId;return(h?rl(h.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),N=q(e=>Jo(e,l.select(`floatingElement`))||Jo(e,l.select(`domReferenceElement`))),P=q(e=>{o()&&l.setOpen(!1,Ca(On,e.nativeEvent))}),F=q(e=>{if(!u||!n||!r||e.key!==`Escape`||E.current||!b&&M(`__escapeKeyBubbles`))return;let t=ol(e)?e.nativeEvent:e,i=Ca(to,t);l.setOpen(!1,i),i.isCanceled||e.preventDefault(),!b&&!i.isPropagationAllowed&&e.stopPropagation()}),I=q(()=>{p.current.insideReactTree=!0,A.start(0,j)}),L=q(e=>{if(!u||!n||e.button!==0)return;let t=f(e.nativeEvent);_a(l.select(`floatingElement`),t)&&(S.current||(S.current=!0,C.current=!1))}),R=q(e=>{u&&n&&(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&S.current&&(C.current=!0)});Z.useEffect(()=>{function e(e){e.open||(T.current=!1)}return m.on(`openchange`,e),()=>{m.off(`openchange`,e)}},[m]),Z.useEffect(()=>{if(!u||!n)return u||(T.current=!1),j;p.current.__escapeKeyBubbles=b,p.current.__outsidePressBubbles=x;let e=new ft,t=new ft,i=Pe(d);function a(){e.clear(),E.current=!0}function o(){e.start(kt?5:0,()=>{E.current=!1})}function s(){w.current=!0,t.start(0,()=>{w.current=!1})}function c(){S.current=!1,C.current=!1}function m(){let e=D.current,t=e===`pen`||!e?`mouse`:e,n=y(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function g(e){let t=m();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function A(e){let t=p.current.floatingContext?.nodeId,n=h&&rl(h.nodesRef.current,t).some(t=>Jo(e,t.context?.elements.floating));return N(e)||n}function P(e){if(g(e)){e.type!==`click`&&!N(e)&&(t.clear(),w.current=!1),j();return}if(p.current.insideReactTree){j();return}let n=f(e),r=`[${ai(`inert`)}]`,i=yi(n)?n.getRootNode():null,a=Array.from(($i(i)?i:Pe(l.select(`floatingElement`))).querySelectorAll(r)),o=l.context.triggerElements;if(n&&(o.hasElement(n)||o.hasMatchingElement(e=>_a(e,n))))return;let s=yi(n)?n:null;for(;s&&!Ba(s);){let e=Tr(s);if(Ba(e)||!yi(e))break;s=e}if(!(a.length&&yi(n)&&!Ni(n)&&!_a(n,l.select(`floatingElement`))&&a.every(e=>!_a(s,e)))){if(Io(n)&&!(`touches`in e)){let t=Ba(n),r=Qn(n),i=/auto|scroll/,a=t||i.test(r.overflowX),o=t||i.test(r.overflowY),s=a&&n.clientWidth>0&&n.scrollWidth>n.clientWidth,c=o&&n.clientHeight>0&&n.scrollHeight>n.clientHeight,l=r.direction===`rtl`,u=c&&(l?e.offsetX<=n.offsetWidth-n.clientWidth:e.offsetX>n.clientWidth),d=s&&e.offsetY>n.clientHeight;if(u||d)return}if(!A(e)){if(m()===`intentional`){if(e.detail!==0&&!sl(e)&&!T.current)return;if(w.current){t.clear(),w.current=!1;return}}(typeof _!=`function`||_(e))&&(M(`__outsidePressBubbles`)||(l.setOpen(!1,Ca(vs,e)),j()))}}}function I(e){m()===`sloppy`&&e.pointerType!==`touch`&&l.select(`open`)&&n&&!N(e)&&P(e)}function L(e){if(m()!==`sloppy`||!l.select(`open`)||!n||N(e))return;let t=e.touches[0];t&&(O.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},k.start(1e3,()=>{O.current&&(O.current.dismissOnTouchEnd=!1,O.current.dismissOnMouseDown=!1)}))}function R(e,t){let n=f(e);if(!n)return;let r=Kn(n,e.type,()=>{t(e),r()})}function ee(e){D.current=`touch`,R(e,L)}function z(e){k.clear(),e.type===`pointerdown`&&(e.button===0&&(T.current=!0),D.current=e.pointerType),(e.type!==`mousedown`||!O.current||O.current.dismissOnMouseDown)&&R(e,e=>{e.type===`pointerdown`?I(e):P(e)})}function te(e){if(e.type===`pointercancel`&&(T.current=!1),!S.current)return;let n=C.current;if(c(),m()===`intentional`){if(e.type===`pointercancel`){n&&s();return}if(!A(e)){if(n){s();return}(typeof _!=`function`||_(e))&&(t.clear(),w.current=!0,j())}}}function ne(e){if(m()!==`sloppy`||!O.current||N(e))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-O.current.startX),r=Math.abs(t.clientY-O.current.startY),i=Math.sqrt(n*n+r*r);i>5&&(O.current.dismissOnTouchEnd=!0),i>10&&(P(e),k.clear(),O.current=null)}function re(e){R(e,ne)}function ie(e){m()===`sloppy`&&O.current&&!N(e)&&(O.current.dismissOnTouchEnd&&P(e),k.clear(),O.current=null)}function ae(e){R(e,ie)}let B=Rn(r&&Rn(Kn(i,`keydown`,F),Kn(i,`compositionstart`,a),Kn(i,`compositionend`,o)),v&&Rn(Kn(i,`click`,z,!0),Kn(i,`pointerdown`,z,!0),Kn(i,`pointerup`,te,!0),Kn(i,`pointercancel`,te,!0),Kn(i,`mousedown`,z,!0),Kn(i,`mouseup`,te,!0),Kn(i,`touchstart`,ee,{capture:!0,passive:!0}),Kn(i,`touchmove`,re,{capture:!0,passive:!0}),Kn(i,`touchend`,ae,{capture:!0,passive:!0})));return()=>{B(),e.clear(),t.clear(),c(),w.current=!1,j()}},[p,d,r,v,_,u,n,b,x,F,j,y,M,N,h,l,k]);let ee=Z.useMemo(()=>({onKeyDown:F,onPointerDown:P,onClick:P}),[F,P]),z=Z.useMemo(()=>({onKeyDown:F,onPointerDown:R,onMouseDown:R,onClickCapture:I,onMouseDownCapture(e){I(),L(e)},onPointerDownCapture(e){I(),L(e)},onMouseUpCapture:I,onTouchEndCapture:I,onTouchMoveCapture:I}),[F,I,L,R]);return Z.useMemo(()=>n?{reference:ee,floating:z,trigger:ee}:{},[n,ee,z])}function Cu(e,t,n){let{reference:r,floating:i}=e,a=Cl(t),o=wl(t),s=Sl(o),c=yl(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=bl(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function wu(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=vl(t,e),p=Il(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Ll(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Ll(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Tu=50,Eu=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:wu},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Cu(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<Tu&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=Cu(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Du=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=vl(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=yl(r),_=Cl(o),v=yl(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Pl(o)]:El(o)),x=p!==`none`;!d&&x&&b.push(...Nl(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Tl(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===Cl(t)||T.every(e=>Cl(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Cl(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}},Ou=new Set([`left`,`top`]);async function ku(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=yl(n),s=bl(n),c=Cl(n)===`y`,l=Ou.has(o)?-1:1,u=a&&c?-1:1,d=vl(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Au=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await ku(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},ju=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=vl(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Cl(i),p=xl(f),m=u[p],h=u[f],g=(e,t)=>_l(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},Mu=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=vl(e,t),u={x:n,y:r},d=Cl(i),f=xl(d),p=u[f],m=u[d],h=vl(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Ou.has(yl(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Nu=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=vl(e,t),c=await i.detectOverflow(t,s),l=yl(n),u=bl(n),d=Cl(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=dl(p-c[m],g),y=dl(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*fl(c.left,c.right):S=p-2*fl(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function Pu(e){let t=Qn(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Io(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=pl(n)!==a||pl(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Fu(e){return yi(e)?e:e.contextElement}function Iu(e){let t=Fu(e);if(!Io(t))return hl(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Pu(t),o=(a?pl(n.width):n.width)/r,s=(a?pl(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Lu=hl(0);function Ru(e){let t=rn(e);return!Oo()||!t.visualViewport?Lu:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function zu(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===rn(e)}function Bu(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Fu(e),o=hl(1);t&&(r?yi(r)&&(o=Iu(r)):o=Iu(e));let s=zu(a,n,r)?Ru(a):hl(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=rn(a),t=yi(r)?rn(r):r,n=e,i=fo(n);for(;i&&t!==n;){let e=Iu(i),t=i.getBoundingClientRect(),r=Qn(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=rn(i),i=fo(n)}}return Ll({width:u,height:d,x:c,y:l})}function Vu(e,t){let n=hr(e).scrollLeft;return t?t.left+n:Bu(at(e)).left+n}function Hu(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Vu(e,n),y:n.top+t.scrollTop}}function Uu(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=at(r),s=t?qa(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=hl(1),u=hl(0),d=Io(r);if((d||!a)&&((Xe(r)!==`body`||_o(o))&&(c=hr(r)),d)){let e=Bu(r);l=Iu(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Hu(o,c):hl(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Wu(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Gu(e){let t=hr(e),n=e.ownerDocument.body,r=fl(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=fl(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Vu(e),o=-t.scrollTop;return Qn(n).direction===`rtl`&&(a+=fl(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var Ku=25;function qu(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=rn(e),a=at(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Oo()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Vu(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=Ku&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Ju(e,t){let n=Bu(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Iu(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Yu(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=qu(e,n,t);else if(t===`document`)r=Gu(at(e));else if(yi(t))r=Ju(t,n);else{let n=Ru(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Ll(r)}function Xu(e,t){let n=t.get(e);if(n)return n;let r=or(e,[],!1).filter(e=>yi(e)&&Xe(e)!==`body`),a=null,o=Qn(e).position===`fixed`,s=o?Tr(e):e;for(;yi(s)&&!Ba(s);){let e=Qn(s),t=i(s),n=a?a.position:o?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==s):a=e,s=Tr(s)}return t.set(e,r),r}function Zu(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?qa(t)?[]:Xu(t,this._c):[].concat(n),r],o=Yu(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Yu(t,a[e],i);s=fl(n.top,s),c=dl(n.right,c),l=dl(n.bottom,l),u=fl(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Qu(e){let{width:t,height:n}=Pu(e);return{width:t,height:n}}function $u(e,t,n){let r=Io(t),i=at(t),a=n===`fixed`,o=Bu(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=hl(0);if((r||!a)&&((Xe(t)!==`body`||_o(i))&&(s=hr(t)),r)){let e=Bu(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=Vu(i));let l=i&&!r&&!a?Hu(i,s):hl(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function ed(e){return Qn(e).position===`static`}function td(e,t){if(!Io(e)||Qn(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return at(e)===n&&(n=n.ownerDocument.body),n}function nd(e,t){let n=rn(e);if(qa(e))return n;if(!Io(e)){let t=Tr(e);for(;t&&!Ba(t);){if(yi(t)&&!ed(t))return t;t=Tr(t)}return n}let r=td(e,t);for(;r&&zr(r)&&ed(r);)r=td(r,t);return r&&Ba(r)&&ed(r)&&!i(r)?n:r||Te(e)||n}var rd=async function(e){let t=this.getOffsetParent||nd,n=this.getDimensions,r=await n(e.floating);return{reference:$u(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function id(e){return Qn(e).direction===`rtl`}var ad={convertOffsetParentRelativeRectToViewportRelativeRect:Uu,getDocumentElement:at,getClippingRect:Zu,getOffsetParent:nd,getElementRects:rd,getClientRects:Wu,getDimensions:Qu,getScale:Iu,isElement:yi,isRTL:id};function od(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function sd(e,t,n){let r=null,i,a=at(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=ml(d),h=ml(a.clientWidth-(u+f)),g=ml(a.clientHeight-(d+p)),_=ml(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:fl(0,dl(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!od(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=rn(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function cd(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Fu(e),u=i||a?[...l?or(l):[],...t?or(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?sd(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Bu(e):null;c&&g();function g(){let t=Bu(e);h&&!od(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var ld=Au,ud=ju,dd=Du,fd=Nu,pd=Mu,md=(e,t,n)=>{let r=new Map,i=n??{},a={...ad,...i.platform,_c:r};return Eu(e,t,{...i,platform:a})},hd=typeof document<`u`?Z.useLayoutEffect:function(){};function gd(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!gd(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!gd(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function _d(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function vd(e,t){let n=_d(e);return Math.round(t*n)/n}function yd(e){let t=Z.useRef(e);return hd(()=>{t.current=e}),t}function bd(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=Z.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=Z.useState(r);gd(f,r)||p(r);let[m,h]=Z.useState(null),[g,_]=Z.useState(null),v=Z.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=Z.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=Z.useRef(null),C=Z.useRef(null),w=Z.useRef(u),T=c!=null,E=yd(c),D=yd(i),O=yd(l),k=Z.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),md(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!gd(w.current,t)&&(w.current=t,Hc.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);hd(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=Z.useRef(!1);hd(()=>(A.current=!0,()=>{A.current=!1}),[]),hd(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=Z.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=Z.useMemo(()=>({reference:b,floating:x}),[b,x]),N=Z.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=vd(M.floating,u.x),r=vd(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,..._d(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return Z.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var xd=(e,t)=>{let n=ld(e);return{name:n.name,fn:n.fn,options:[e,t]}},Sd=(e,t)=>{let n=ud(e);return{name:n.name,fn:n.fn,options:[e,t]}},Cd=(e,t)=>({fn:pd(e).fn,options:[e,t]}),wd=(e,t)=>{let n=dd(e);return{name:n.name,fn:n.fn,options:[e,t]}},Td=(e,t)=>{let n=fd(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ed={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId},Dd=class extends ri{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:tu(),nested:n,triggerElements:i},Ed),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&ul(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{if(this.syncOnly){this.context.onOpenChange?.(e,t);return}this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};function Od(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:i,nested:a,onOpenChange:o}=e,s=t.useState(`open`),c=t.useState(`activeTriggerElement`),l=t.useState(n?`popupElement`:`positionerElement`),u=t.context.triggerElements,d=o,f=Z.useRef(null);r===void 0&&f.current===null&&(f.current=new Dd({open:s,transitionStatus:void 0,referenceElement:c,floatingElement:l,triggerElements:u,onOpenChange:d,floatingId:i,syncOnly:!0,nested:a}));let p=r??f.current;return t.useSyncedValue(`floatingId`,i),J(()=>{let e={open:s,floatingId:i,referenceElement:c,floatingElement:l};yi(c)&&(e.domReferenceElement=c),p.state.positionReference===p.state.referenceElement&&(e.positionReference=c),p.update(e)},[s,i,c,l,p]),p.context.onOpenChange=d,p.context.nested=a,p}function kd(e,t=!1,n=!1,r=!1){let[i,a]=Z.useState(e&&t?`idle`:void 0),[o,s]=Z.useState(e&&!r);return e&&!o&&(s(!0),a(`starting`)),!e&&o&&i!==`ending`&&!n&&a(`ending`),!e&&!o&&i===`ending`&&a(void 0),J(()=>{if(!e&&o&&i!==`ending`&&n){let e=Ps.request(()=>{a(`ending`)});return()=>{Ps.cancel(e)}}},[e,o,i,n]),J(()=>{if(!e||t)return;let n=Ps.request(()=>{a(void 0)});return()=>{Ps.cancel(n)}},[t,e]),J(()=>{if(!e||!t)return;e&&o&&i!==`idle`&&a(`starting`);let n=Ps.request(()=>{a(`idle`)});return()=>{Ps.cancel(n)}},[t,e,o,i]),{mounted:o,setMounted:s,transitionStatus:i}}var Ad={tabIndex:-1,[ee]:``};function jd(e){return t=>t!==`touch`||e.current}function Md(e,t=!1){let n=ca(),r=au()!=null,i=ka(()=>e(n,r)).current;return Od({popupStore:i,treatPopupAsFloatingElement:t,floatingRootContext:i.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:i.setOpen}),i}function Nd({handle:e,store:t}){return J(()=>e.attachStore(t),[e,t]),null}function Pd(e){let t=e.context.triggerElements.size;e.select(`open`)&&e.state.triggerCount!==t&&e.set(`triggerCount`,t)}function Fd(e,t){let n=Z.useRef(null);return q(r=>{let i=n.current;if(i!==null){if(i.element===r&&i.store===t&&i.id===e)return;n.current=null;let a=i.store;a.context.triggerElements.getById(i.id)===i.element&&(a.context.triggerElements.delete(i.id),Pd(a))}r!==null&&e!==void 0&&(n.current={store:t,id:e,element:r},t.context.triggerElements.add(e,r),Pd(t))})}function Id(e,t,n,r=!1){let i=e.preventUnmountingOnClose;t?i=!1:r&&(i=!0);let a=n?.id??null,o=e.activeTriggerId,s=e.activeTriggerElement;return(a||t)&&(o=a,s=n??null),{open:t,preventUnmountingOnClose:i,activeTriggerId:o,activeTriggerElement:s}}function Ld(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function Rd(e,t,n,r={}){let i=n.reason,a=i===ls,o=t&&i===`trigger-focus`,s=!t&&(i===`trigger-press`||i===`escape-key`),c=Ld(n);if(e.context.onOpenChange?.(t,n),n.isCanceled)return;r.onBeforeDispatch?.(),e.state.floatingRootContext.dispatchOpenChange(t,n);let l=()=>{let i=Id(e.state,t,n.trigger,c()),l={...r.extraState,...i};o?l.instantType=`focus`:s?l.instantType=`dismiss`:a&&(l.instantType=void 0),e.update(l)};a?Hc.flushSync(l):l()}function zd(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=Fd(e,n),o=q(t=>{let i=n.select(`open`),a=n.select(`activeTriggerId`);if(a===e){let e={activeTriggerElement:t,...i?r:null};n.update(e);return}if(a==null&&i){let i={activeTriggerId:e??null,activeTriggerElement:t,...r};n.update(i)}}),s=q(e=>{a(e),e&&o(e)});return J(()=>(s(t.current),()=>s(null)),[s,t,n,e]),J(()=>{if(i){let e={activeTriggerElement:t.current,...r};n.update(e)}},[i,n,t,...Object.values(r)]),{registerTrigger:s,isMountedByThisTrigger:i}}function Bd(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,r=Z.useRef(null),i=e.useState(`open`),a=e.useState(`triggerCount`),o=e.useState(`activeTriggerId`),s=e.useState(`activeTriggerElement`);J(()=>{if(!i){r.current=null,e.state.triggerCount!==0&&e.set(`triggerCount`,0);return}let t=e.context.triggerElements.size,a={};e.state.triggerCount!==t&&(a.triggerCount=t);let o=e.select(`activeTriggerId`),s=null;if(o){let t=e.context.triggerElements.getById(o);if(t)r.current=o,t!==e.state.activeTriggerElement&&(a.activeTriggerElement=t);else{for(let[t,n]of e.context.triggerElements.entries())if(n===e.state.activeTriggerElement){a.activeTriggerId=t,a.activeTriggerElement=n,r.current=t;break}a.activeTriggerId===void 0&&(r.current===o?s=o:r.current=null)}}else r.current=null;if(!s&&!o&&t===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[e,n]=t.value;a.activeTriggerId=e,a.activeTriggerElement=n,r.current=e}}(a.triggerCount!==void 0||a.activeTriggerId!==void 0||a.activeTriggerElement!==void 0)&&e.update(a),s&&n&&queueMicrotask(()=>{if(e.select(`open`)&&e.select(`activeTriggerId`)===s&&!e.context.triggerElements.getById(s)){let t=Ca(Zr);e.setOpen(!1,t),t.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[i,e,a,o,s,n])}function Vd(e,t,n,r){let{mounted:i,setMounted:a,transitionStatus:o}=kd(e,!1,!1,r),s=t.useState(`preventUnmountingOnClose`),c=!e&&s;t.useSyncedValues({mounted:i,transitionStatus:o,preventUnmountingOnClose:c});let l=q(()=>{a(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return fn({enabled:i&&!e&&!c,open:e,ref:t.context.popupRef,onComplete(){e||l()}}),{forceUnmount:l,transitionStatus:o}}function Hd(e,t){e.useSyncedValues(t),J(()=>()=>{e.update({activeTriggerProps:jr,inactiveTriggerProps:jr,popupProps:jr})},[e])}function Ud(e,t){J(()=>{!t&&e.state.openMethod!==null&&e.set(`openMethod`,null)},[t,e]),J(()=>()=>{e.state.openMethod!==null&&e.set(`openMethod`,null)},[e])}var Wd=class{constructor(){this.idMap=new Map}add(e,t){this.idMap.set(e,t)}delete(e){this.idMap.delete(e)}hasElement(e){for(let t of this.idMap.values())if(t===e)return!0;return!1}hasMatchingElement(e){for(let t of this.idMap.values())if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}};function Gd(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=ca(),a=au()!=null,o=ka(()=>new Dd({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new Wd,floatingId:i,syncOnly:!1,nested:a})).current;return J(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=yi(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}function Kd(e){return qd(e,e.rootContext)}function qd(e,t){let{nodeId:n,externalTree:r}=e,i=t.useState(`referenceElement`),a=t.useState(`floatingElement`),o=t.useState(`domReferenceElement`),s=t.useState(`open`),c=t.useState(`floatingId`),[l,u]=Z.useState(null),[d,f]=Z.useState(void 0),[p,m]=Z.useState(void 0),h=Z.useRef(null),g=ou(r),_=Z.useMemo(()=>({reference:i,floating:a,domReference:o}),[i,a,o]),v=bd({...e,elements:{..._,...l&&{reference:l}}}),y=yi(d)?d:null,b=p===void 0?t.state.floatingElement:p;t.useSyncedValue(`referenceElement`,d??null),t.useSyncedValue(`domReferenceElement`,d===void 0?o:y),t.useSyncedValue(`floatingElement`,b);let x=Z.useCallback(e=>{let t=yi(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),v.refs.setReference(t)},[v.refs]),S=Z.useCallback(e=>{(yi(e)||e===null)&&(h.current=e,f(e)),(yi(v.refs.reference.current)||v.refs.reference.current===null||e!==null&&!yi(e))&&v.refs.setReference(e)},[v.refs,f]),C=Z.useCallback(e=>{m(e),v.refs.setFloating(e)},[v.refs]),w=Z.useMemo(()=>({...v.refs,setReference:S,setFloating:C,setPositionReference:x,domReference:h}),[v.refs,S,C,x]),T=Z.useMemo(()=>({...v.elements,domReference:o}),[v.elements,o]),E=Z.useMemo(()=>({...v,dataRef:t.context.dataRef,open:s,onOpenChange:t.setOpen,events:t.context.events,floatingId:c,refs:w,elements:T,nodeId:n,rootStore:t}),[v,w,T,n,t,s,c]);return J(()=>{o&&(h.current=o)},[o]),J(()=>{t.context.dataRef.current.floatingContext=E;let e=g?.nodesRef.current.find(e=>e.id===n);e&&(e.context=E)}),Z.useMemo(()=>({...v,context:E,refs:w,elements:T,rootStore:t}),[v,w,T,E,t])}var Jd=`Escape`;function Yd(e){return kt&&e.movementX===0&&e.movementY===0}function Xd(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function Zd(e,t){return Xd(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function Qd(e,t,n){return Xd(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function $d(e,t,n){return Xd(t,n?e===ds:e===An,e===A)}function ef(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===Jd:Xd(t,n?e===An:e===ds,e===se)}function tf(e,t){let{listRef:n,activeIndex:r,onNavigate:i=()=>{},enabled:a=!0,selectedIndex:o=null,allowEscape:s=!1,loopFocus:c=!1,nested:l=!1,rtl:u=!1,virtual:d=!1,focusItemOnOpen:p=`auto`,focusItemOnHover:m=!0,openOnArrowKeyDown:h=!0,disabledIndices:g=void 0,orientation:_=`vertical`,parentOrientation:v,id:y,resetOnPointerLeave:b=!0,externalTree:x,grid:C}=t,w=C!=null,T=`rootStore`in e?e.rootStore:e,E=T.useState(`open`),D=T.useState(`floatingElement`),O=T.useState(`domReferenceElement`),k=T.context.dataRef,A=Ta(D),j=Na(O),M=zl(A),N=au(),P=ou(x),F=Z.useRef(p),I=Z.useRef(o??-1),L=Z.useRef(null),R=Z.useRef(!0),ee=q(e=>{i(I.current===-1?null:I.current,e)}),z=Z.useRef(!!D),te=Z.useRef(E),ne=Z.useRef(!1),re=Z.useRef(!1),ie=Z.useRef(null),ae=zl(g),B=zl(E),V=zl(o),oe=zl(b),se=S(),ce=S(),le=q(()=>{function e(e){d?P?.events.emit(`virtualfocus`,e):ie.current=Hl(e,{sync:ne.current,preventScroll:!0})}let t=n.current[I.current],r=re.current;t&&e(t),(ne.current?e=>e():e=>se.request(e))(()=>{let i=n.current[I.current]||t;i&&(t||e(i),he&&(r||!R.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});J(()=>{k.current.orientation=_},[k,_]),J(()=>{a&&(E&&D?(I.current=o??-1,F.current&&o!=null&&(re.current=!0,ee())):z.current&&(I.current=-1,ee()))},[a,E,D,o,ee]),J(()=>{if(a){if(!E){ne.current=!1;return}if(D){if(r==null){if(ne.current=!1,V.current!=null)return;if(z.current&&(I.current=-1,le()),(!te.current||!z.current)&&F.current&&(L.current!=null||F.current===!0&&L.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>ce.request(e):queueMicrotask)(t),e+=1):(I.current=L.current==null||Qd(L.current,_,u)||l?Ur(n):na(n),L.current=null,ee())};t()}}else jo(n.current,r)||(I.current=r,le(),re.current=!1)}}},[a,E,D,r,V,l,n,_,u,ee,le,ce]),J(()=>{if(!a||D||!P||d||!z.current)return;let e=P.nodesRef.current,t=e.find(e=>e.id===N)?.context?.elements.floating,n=zt(Pe(O??t??null)),r=e.some(e=>e.context&&_a(e.context.elements.floating,n));t&&!r&&R.current&&t.focus({preventScroll:!0})},[a,D,O,P,N,d]),J(()=>{te.current=E,z.current=!!D}),J(()=>{E||(L.current=null,F.current=p)},[E,p]);let ue=r!=null,de=q(e=>{if(!B.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(I.current!==t||r!==t)&&(I.current=t,ee(e))}),fe=q(()=>v??P?.nodesRef.current.find(e=>e.id===N)?.context?.dataRef?.current.orientation),pe=q(()=>Ur(n,ae.current)),me=q(e=>{if(R.current=!1,ne.current=!0,e.which===229||!B.current&&e.currentTarget===M.current)return;if(l&&ef(e.key,_,u,w)){Zd(e.key,fe())||al(e),T.setOpen(!1,Ca(ns,e.nativeEvent)),Io(O)&&(d?P?.events.emit(`virtualfocus`,O):O.focus());return}let t=I.current,r=Ur(n,g),i=na(n,g);if(j||(e.key===`Home`&&(al(e),I.current=r,ee(e)),e.key===`End`&&(al(e),I.current=i,ee(e))),C!=null){let t=C(e,I.current,n,_,c,u,g,r,i);if(t!=null&&(I.current=t,ee(e)),_===`both`)return}if(Zd(e.key,_)){if(al(e),E&&!d&&zt(e.currentTarget.ownerDocument)===e.currentTarget){I.current=Qd(e.key,_,u)?r:i,ee(e);return}Qd(e.key,_,u)?c?t>=i?s&&t!==n.current.length?I.current=-1:(ne.current=!1,I.current=r):I.current=xo(n.current,{startingIndex:t,disabledIndices:g}):I.current=Math.min(i,xo(n.current,{startingIndex:t,disabledIndices:g})):c?t<=r?s&&t!==-1?I.current=n.current.length:(ne.current=!1,I.current=i):I.current=xo(n.current,{startingIndex:t,decrement:!0,disabledIndices:g}):I.current=Math.max(r,xo(n.current,{startingIndex:t,decrement:!0,disabledIndices:g})),jo(n.current,I.current)&&(I.current=-1),ee(e)}}),he=Z.useMemo(()=>({onFocus(e){ne.current=!0,de(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){Yd(e)||(ne.current=!0,re.current=!1,m&&de(e))},onPointerLeave(e){if(!B.current||!R.current||e.pointerType===`touch`)return;ne.current=!0;let t=e.relatedTarget;if(m&&!n.current.includes(t)&&oe.current&&(ie.current?.(),ie.current=null,I.current=-1,ee(e),!d)){let e=M.current,t=zt(Pe(e));e&&_a(e,t)&&e.focus({preventScroll:!0})}}}),[de,B,M,m,n,ee,oe,d]),ge=Z.useMemo(()=>d&&E&&ue&&{"aria-activedescendant":`${y}-${r}`},[d,E,ue,y,r]),_e=Z.useMemo(()=>({...j?{}:ge,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&E&&!d){let t=f(e.nativeEvent);if(t&&!_a(M.current,t))return;al(e),T.setOpen(!1,Ca(ja,e.nativeEvent)),Io(O)&&O.focus();return}me(e)},onPointerMove(e){Yd(e)||(R.current=!0)}}),[ge,me,M,j,T,E,d,O]),ve=Z.useMemo(()=>{function e(e){T.setOpen(!0,Ca(ns,e.nativeEvent,e.currentTarget))}function t(e){p===`auto`&&sl(e.nativeEvent)&&(F.current=!d)}function n(e){F.current=p,p===`auto`&&cl(e.nativeEvent)&&(F.current=!0)}return{onKeyDown(t){let n=T.select(`open`);R.current=!1;let r=t.key.startsWith(`Arrow`),i=$d(t.key,fe(),u),a=Zd(t.key,_),o=(l?i:a)||t.key===`Enter`||t.key.trim()===``;if(d&&n)return me(t);if(n||h||!r){if(o){let e=Zd(t.key,fe());L.current=l&&e?null:t.key}if(l){i&&(al(t),n?(I.current=pe(),ee(t)):e(t));return}a&&(V.current!=null&&(I.current=V.current),al(t),!n&&h?e(t):me(t),n&&ee(t))}},onFocus(e){T.select(`open`)&&!d&&(I.current=-1,ee(e))},onPointerDown:n,onPointerEnter:n,onMouseDown:t,onClick:t}},[me,p,pe,l,ee,T,h,_,fe,u,V,d]),ye=Z.useMemo(()=>({...ge,...ve}),[ge,ve]);return Z.useMemo(()=>a?{reference:ye,floating:_e,item:he,trigger:ve}:{},[a,ye,_e,ve,he])}function nf(e,t){let{listRef:n,elementsRef:r,activeIndex:i,onMatch:a,disabledIndices:o,onTyping:s,enabled:c=!0,resetMs:l=750,selectedIndex:u=null}=t,d=`rootStore`in e?e.rootStore:e,f=d.useState(`open`),p=mn(),m=Z.useRef(``),h=Z.useRef(u??i??-1),g=Z.useRef(null),_=q(e=>{function t(e){return r?.current[e]}function c(e){let n=t(e);return n&&!Xa(n)||n?.matches(`:disabled`)?!1:o==null||!oi(zi,e,o)}function d(e,t,n=0){if(e.length===0)return-1;let r=(n%e.length+e.length)%e.length,i=t.toLowerCase();for(let t=0;t<e.length;t+=1){let n=(r+t)%e.length;if(e[n]?.toLowerCase().startsWith(i)&&c(n))return n}return-1}let _=n.current;if(m.current.length>0&&e.key===` `&&(al(e),s?.(!0)),m.current.length>0&&m.current[0]!==` `&&d(_,m.current)===-1&&e.key!==` `&&s?.(!1),_==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;f&&e.key!==` `&&(al(e),s?.(!0));let v=m.current===``;v&&(h.current=u??i??-1),_.every((e,t)=>e&&c(t)?e[0]?.toLowerCase()!==e[1]?.toLowerCase():!0)&&m.current===e.key&&(m.current=``,h.current=g.current),m.current+=e.key,p.start(l,()=>{m.current=``,h.current=g.current,s?.(!1)});let y=((v?u??i??-1:h.current)??0)+1,b=d(_,m.current,y);b===-1?e.key!==` `&&(m.current=``,s?.(!1)):(a?.(b),g.current=b)}),v=q(e=>{let t=e.relatedTarget,n=d.select(`domReferenceElement`),r=d.select(`floatingElement`);_a(n,t)||_a(r,t)||(p.clear(),m.current=``,h.current=g.current,s?.(!1))});J(()=>{(f||u===null)&&(p.clear(),g.current=null,m.current!==``&&(m.current=``))},[f,u,p]);let y=Z.useMemo(()=>({onKeyDown:_,onBlur:v}),[_,v]);return Z.useMemo(()=>c?{reference:y,floating:y}:{},[c,y])}var rf=Z.createContext(void 0);function af(){return Z.useContext(rf)?.direction??`ltr`}var of=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0,offsetParent:d=`real`}=vl(e,t)||{};if(l==null)return{};let f=Il(u),p={x:n,y:r},m=wl(i),h=Sl(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];(!w||!await o.isElement?.(C))&&(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=_l(k,j,A),N=!c.arrow&&bl(i)!=null&&j!==M&&a.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}}),sf=(e,t)=>{let{name:n,fn:r}=of(e);return{name:n,fn:r,options:[e,t]}},cf={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0,o=await e.platform.detectOverflow(e,{elementContext:`reference`});return{data:{referenceHidden:o.top-n>=0||o.right-t>=0||o.bottom-n>=0||o.left-t>=0||a}}}},lf={sideX:`left`,sideY:`top`},uf=`--available-width`,df=`--available-height`,ff=`--anchor-width`,pf=`--anchor-height`,mf=`--transform-origin`,hf=uf,gf=df;function _f(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function vf(e,t,n){let{rects:r,placement:i}=e;return{side:_f(t,yl(i),n),align:bl(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function yf(e){return bf(e,Kd)}function bf(e,t){let{anchor:n,positionMethod:r=`absolute`,side:i=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,collisionBoundary:c,collisionPadding:l=5,sticky:u=!1,arrowPadding:d=5,disableAnchorTracking:f=!1,inline:p,keepMounted:m=!1,floatingRootContext:h,mounted:g,collisionAvoidance:_,shift:v,nodeId:y,adaptiveOrigin:b,lazyFlip:x=!1,externalTree:S}=e,[C,w]=Z.useState(null);!g&&C!==null&&w(null);let T=_.side||`flip`,E=_.align||`flip`,D=_.fallbackAxisSide||`end`,O=v?.crossAxis??!1,k=v?.rootBoundary,A=typeof n==`function`?n:void 0,j=q(A),M=A?j:n,N=zl(n),P=zl(g),F=af()===`rtl`,I=C||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":F?`left`:`right`,"inline-start":F?`right`:`left`}[i],L=o===`center`?I:`${I}-${o}`,R=l;typeof R==`number`?R={top:R,right:R,bottom:R,left:R}:R&&={top:R.top||0,right:R.right||0,bottom:R.bottom||0,left:R.left||0};let ee=+(i===`bottom`),z=+(i===`top`),te=+(i===`right`),ne=+(i===`left`),re={boundary:c===`clipping-ancestors`?`clippingAncestors`:c,padding:R},ie=Z.useRef(null),ae=zl(a),B=zl(s),V=typeof a==`function`?0:a,oe=typeof s==`function`?0:s,se=[];p&&se.push(p),se.push(xd(e=>{let t=vf(e,i,F),n=typeof ae.current==`function`?ae.current(t):ae.current,r=typeof B.current==`function`?B.current(t):B.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[V,oe,F,i]));let ce=E===`none`&&T!==`shift`,le=!ce&&(u||O||T===`shift`),ue=T===`none`?null:wd({...re,padding:{top:R.top+1+ee,right:R.right+1+ne,bottom:R.bottom+1+z,left:R.left+1+te},mainAxis:!O&&T===`flip`,crossAxis:E===`flip`&&`alignment`,fallbackAxisSideDirection:D}),de=ce?null:Sd({...re,rootBoundary:k,mainAxis:E!==`none`,crossAxis:le,limiter:u||O?void 0:Cd(e=>{if(!ie.current)return{};let{width:t,height:n}=ie.current.getBoundingClientRect(),r=Cl(yl(e.placement)),i=r===`y`?t:n,a=r===`y`?R.left+R.right:R.top+R.bottom;return{offset:i/2+a/2}})},[re,u,O,k,R,E]);T===`shift`||E===`shift`||o===`center`?se.push(de,ue):se.push(ue,de),se.push(Td({...re,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!P.current)return;let i=e.style;i.setProperty(hf,`${t}px`),i.setProperty(gf,`${n}px`);let a=rn(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(ff,`${u}px`),i.setProperty(pf,`${d}px`)}}),sf(e=>({element:ie.current||Pe(e.elements.floating).createElement(`div`),padding:ie.current?d:0,offsetParent:`floating`}),[d]),{name:`transformOrigin`,fn(e){let{elements:{floating:t},middlewareData:n,placement:r,platform:o,rects:s,y:c}=e,l=yl(r),u=bl(r),d=Cl(l)===`y`,f=ie.current,p=typeof a==`function`?a(vf(e,i,F)):a,m;m=!f&&u&&Math.abs(d?n.shift?.x||0:n.shift?.y||0)<=1?u===`start`===(d&&o.isRTL?.(t)===!0)?`100%`:`0%`:`${(d?n.arrow?.x||0:n.arrow?.y||0)+(d?f?.clientWidth||0:f?.clientHeight||0)/2}px`;let h=l===`top`||l===`left`?`calc(100% + ${p}px)`:`${-p}px`;return le&&d&&Math.abs(n.shift?.y||0)>p&&(h=`${s.reference.y+s.reference.height/2-c}px`),t.style.setProperty(mf,d?`${m} ${h}`:`${h} ${m}`),{}}},cf,b),J(()=>{!g&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,h]);let fe=Z.useMemo(()=>({ancestorScroll:!f,elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:pe,elements:me,x:he,y:ge,middlewareData:_e,update:ve,placement:ye,context:be,isPositioned:xe,floatingStyles:Se}=t({rootContext:h,open:m?g:void 0,placement:L,middleware:se,strategy:r,whileElementsMounted:m?void 0:(...e)=>cd(...e,fe),nodeId:y,externalTree:S}),{sideX:Ce,sideY:we}=_e.adaptiveOrigin||lf,Te=xe?r:`fixed`,Ee=Z.useMemo(()=>{let e;return e=xe?b?{position:Te,[Ce]:he,[we]:ge}:{...Se,position:Te}:{position:Te,top:0,left:0},e[hf]=`100vw`,e[gf]=`100vh`,xe||(e.opacity=0),e},[b,Te,Ce,he,we,ge,Se,xe]),De=Z.useRef(null);J(()=>{if(!g)return;let e=N.current,t=typeof e==`function`?e():e,n=(xf(t)?t.current:t)||null;n!==De.current&&(pe.setPositionReference(n),De.current=n)},[g,pe,M,N]),Z.useEffect(()=>{if(!g)return;let e=N.current;typeof e!=`function`&&xf(e)&&e.current!==De.current&&(pe.setPositionReference(e.current),De.current=e.current)},[g,pe,M,N]),Z.useEffect(()=>{if(m&&g&&me.reference&&me.floating)return cd(me.reference,me.floating,ve,fe)},[m,g,me,ve,fe]);let Oe=yl(ye),ke=_f(i,Oe,F),Ae=bl(ye)||`center`,je=!!_e.hide?.referenceHidden;J(()=>{x&&g&&xe&&Oe!==I&&w(Oe)},[x,g,xe,Oe,I]);let Me=Z.useMemo(()=>({position:`absolute`,top:_e.arrow?.y,left:_e.arrow?.x}),[_e.arrow]),Ne=_e.arrow?.centerOffset!==0;return Z.useMemo(()=>({positionerStyles:Ee,arrowStyles:Me,arrowRef:ie,arrowUncentered:Ne,side:ke,align:Ae,physicalSide:Oe,anchorHidden:je,refs:pe,context:be,isPositioned:xe,update:ve}),[Ee,Me,ie,Ne,ke,Ae,Oe,je,pe,be,xe,ve])}function xf(e){return e!=null&&`current`in e}function Sf(e){return e===`starting`?qt:jr}function Cf(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),Me(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},Sf(r),i],stateAttributesMapping:tl})}var wf={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};wf.node;var Tf=xi(wf),Ef={name:`chevron-up`,size:24,node:[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]};Ef.node;var Df=xi(Ef),Of={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};Of.node;var kf=xi(Of),Af={name:`copy`,size:24,node:[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]};Af.node;var jf=xi(Af),Mf={name:`key-round`,size:24,node:[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]};Mf.node;var Nf=xi(Mf),Pf={name:`link`,size:24,node:[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]};Pf.node;var Ff=xi(Pf),If={name:`monitor`,size:24,node:[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]};If.node;var Lf=xi(If),Rf={name:`server-off`,size:24,node:[[`path`,{d:`M7 2h13a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-5`,key:`bt2siv`}],[`path`,{d:`M10 10 2.5 2.5C2 2 2 2.5 2 5v3a2 2 0 0 0 2 2h6z`,key:`1hjrv1`}],[`path`,{d:`M22 17v-1a2 2 0 0 0-2-2h-1`,key:`1iynyr`}],[`path`,{d:`M4 14a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16.5l1-.5.5.5-8-8H4z`,key:`161ggg`}],[`path`,{d:`M6 18h.01`,key:`uhywen`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};Rf.node;var zf=xi(Rf),Bf={name:`shield-alert`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]};Bf.node;var Vf=xi(Bf),Hf={name:`unplug`,size:24,node:[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]};Hf.node;var Uf=xi(Hf);function Wf(e){return ca(e,`base-ui`)}function Gf(e){let[t,n]=Z.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}var $=F(),Kf=G(e=>La(t=>{window.addEventListener(`focus`,e),window.addEventListener(`online`,e),window.addEventListener(`visibilitychange`,e),t.addFinalizer(()=>{window.removeEventListener(`focus`,e),window.removeEventListener(`online`,e),window.removeEventListener(`visibilitychange`,e)})}));function qf(e){let t=(0,$.c)(2),n;t[0]===e?n=t[1]:(n=Kf(e),t[0]=e,t[1]=n),Yr(n)}var Jf=`~effect/Cache`,Yf=(e,t)=>fs(n=>{let r=Object.create(Zf);return r.lookup=t=>xt(e(t),e=>Wo(n,e)),r.map=tr(),r.capacity=t.capacity,r.timeToLive=t.timeToLive?(e,n)=>Ls(t.timeToLive(e,n)):Qf,h(r)}),Xf=e=>Yf(e.lookup,{...e,timeToLive:e.timeToLive===void 0?Qf:()=>e.timeToLive}),Zf={...ss,[Jf]:Jf,toJSON(){return{_id:`Cache`,capacity:this.capacity,map:this.map}}},Qf=(e,t)=>qn,$f=Wt(2,(e,t)=>Tn(n=>{let r=Ge(e.map,t);if(Ar(r)&&(br(e.map,t),!np(r.value,n)))return Qt(e.map,t,r.value),r.value.await();let i=new ep(n,e.lookup(t));i.onInterrupt=()=>tp(e,t,i);let a=!1;i.fiber.addObserver(r=>{if(i.onInterrupt=void 0,Mn(r)){tp(e,t,i);return}let o=e.timeToLive(r,t);Bn(o)?(a=!0,tp(e,t,i)):Ie(o)&&(i.expiresAt=n.getRef(M).currentTimeMillisUnsafe()+po(o))});let o=i.fiber.pollUnsafe();return!a&&(o===void 0||!Mn(o))&&Qt(e.map,t,i),Number.isFinite(e.capacity)&&rp(e),i.await()})),ep=class{expiresAt;awaiters;fiber;onInterrupt;constructor(e,t){this.fiber=Vt(e,t,!0,!0),this.awaiters=0,this.expiresAt=void 0}await(){return this.fiber.pollUnsafe()||(this.awaiters++,ya(te(this.fiber),()=>(this.awaiters--,this.awaiters>0||this.fiber.pollUnsafe()?jt:(this.onInterrupt?.(),ce(this.fiber)))))}},tp=(e,t,n)=>{let r=Ge(e.map,t);Ar(r)&&r.value===n&&br(e.map,t)},np=(e,t)=>e.expiresAt!==void 0&&t.getRef(M).currentTimeMillisUnsafe()>=e.expiresAt,rp=e=>{let n=t(e.map)-e.capacity;if(!(n<=0)){for(let[t]of e.map)if(br(e.map,t),n--,n===0)return}},ip=Wt(2,(e,t)=>pa(()=>{br(e.map,t)})),ap=2**48-1,op=`0123456789ABCDEFGHJKMNPQRSTVWXYZ`,sp=(e,t)=>{if(t.length!==10)throw Error(`ULID randomness must be exactly 10 bytes, received ${t.length}`);let n=Math.min(Math.max(0,Math.trunc(e)),ap),r=``;for(let e=45;e>=0;e-=5)r+=op[Math.floor(n/2**e)&31];let i=0,a=0;for(let e of t){for(i=i<<8|e,a+=8;a>=5;)a-=5,r+=op[i>>>a&31];i&=(1<<a)-1}return r},cp=e=>e.toString(16).padStart(2,`0`),lp=e=>[e.subarray(0,4),e.subarray(4,6),e.subarray(6,8),e.subarray(8,10),e.subarray(10,16)].map(e=>Array.from(e,cp).join(``)).join(`-`),up=()=>globalThis.crypto.getRandomValues(new Uint8Array(16));function dp(e=up()){return e[6]=e[6]&15|64,e[8]=e[8]&63|128,e}var fp=e=>lp(e===void 0?dp():dp(e)),pp=2**48-1;function mp(e,t=up()){let n=Math.min(Math.max(0,Math.trunc(e)),pp);return t[0]=Math.floor(n/2**40),t[1]=Math.floor(n/2**32)&255,t[2]=Math.floor(n/2**24)&255,t[3]=Math.floor(n/2**16)&255,t[4]=Math.floor(n/256)&255,t[5]=n&255,t[6]=t[6]&15|112,t[8]=t[8]&63|128,t}var hp=(e,t)=>lp(t===void 0?mp(e):mp(e,t)),gp=`~effect/Crypto`,_p=za(`effect/Crypto`),vp=e=>{let t=e.randomBytes,n=e=>_(yp(`randomBytes`,e),t),r=e=>(e[0]&31)*2**48+e[1]*2**40+e[2]*2**32+e[3]*2**24+e[4]*2**16+e[5]*256+e[6],i=()=>r(t(7))/2**53,a=()=>{for(;;){let e=t(7),n=r(e);if(!(e[0]&32))return n+-(2**53-1);if(n<2**53-1)return n+1}};return _p.of({[gp]:gp,randomBytes:n,nextDoubleUnsafe:i,nextIntUnsafe:a,digest:e.digest,random:Y(()=>i()),randomBoolean:Y(()=>i()>.5),randomInt:Y(()=>a()),randomBetween:(e,t)=>Y(()=>Vs(e,t,i())),randomIntBetween(e,t,n){let r=n?.halfOpen===!0?0:1;return Y(()=>{let n=Math.ceil(e),a=Math.floor(t);return Math.floor(i()*(a-n+r))+n})},randomShuffle:e=>Y(()=>{let t=Array.from(e);for(let e=t.length-1;e>=1;--e){let n=Math.min(e,Math.floor(i()*(e+1))),r=t[e];t[e]=t[n],t[n]=r}return t}),randomUUIDv4:Y(()=>fp(t(16))),randomUUIDv7:Wi(e=>fi(hp(e.currentTimeMillisUnsafe(),t(16)))),randomULID:Wi(e=>fi(sp(e.currentTimeMillisUnsafe(),t(10))))})},yp=(e,t)=>Number.isSafeInteger(t)&&t>=0?fi(t):U(qs({module:`Crypto`,method:e,description:`size must be a non-negative safe integer`})),bp=`~effect/FiberMap`,xp=e=>ha(e,bp),Sp={[bp]:bp,[Symbol.iterator](){return this.state._tag===`Closed`?cr():this.state.backing[Symbol.iterator]()},...ss,toJSON(){return{_id:`FiberMap`,state:this.state}}},Cp=(e,t)=>{let n=Object.create(Sp);return n.state={_tag:`Open`,backing:e},n.deferred=t,n},wp=()=>Po(Y(()=>Cp(oo(),Za())),e=>ji(()=>{let t=e.state;return t._tag===`Closed`?B:(e.state={_tag:`Closed`},Ds(Si(t.backing)).pipe(ia(e.deferred)))})),Tp=-1,Ep=Rs(Bs(Fr,zs(Tp))),Dp=Wt(e=>xp(e[0]),(e,t,n,r)=>{if(e.state._tag===`Closed`){n.interruptUnsafe(Tp);return}let i=Ge(e.state.backing,t);if(i._tag===`Some`){if(i.value===n)return;if(r?.onlyIfMissing===!0){n.interruptUnsafe(Tp);return}}Qt(e.state.backing,t,n),i._tag===`Some`&&i.value.interruptUnsafe(Tp),n.addObserver(i=>{if(e.state._tag===`Closed`)return;let a=Ge(e.state.backing,t);Ar(a)&&n===a.value&&br(e.state.backing,t),hi(i)&&(r?.propagateInterruption===!0?!Ep(i.cause):!ei(i.cause))&&Ga(e.deferred,i)})}),Op=Wt(2,(e,t)=>e.state._tag!==`Closed`&&lr(e.state.backing,t)),kp=function(){let e;return()=>(e===void 0&&(e=vo(ue)),e)}(),Ap=e=>()=>_(Li(),t=>{let n=ea(t);return(t,r,i)=>{if(e.state._tag===`Closed`||i?.onlyIfMissing===!0&&Op(e,t))return kp();let a=n(r,i);return Dp(e,t,a,i),a}}),jp=class extends za()(`@porcelain/client/EnvironmentStorage`){},Mp=class extends za()(`@porcelain/client/AccessPlatform`){},Np=r({address:nn,credential:wr(nn),deviceId:Bt(nn)}),Pp=r({...Np.fields,environmentId:nn,name:nn,alternateRoutes:Bt(Ot(Np)),operationIdentity:Bt(nn)});function Fp({address:e,credential:t,deviceId:n}){return{address:e,credential:t,...n?{deviceId:n}:{}}}function Ip(e){return[Fp(e),...(e.alternateRoutes??[]).map(Fp)]}function Lp(e){return e.operationIdentity??(e.deviceId?JSON.stringify([e.environmentId,e.address,e.deviceId]):void 0)}function Rp(e,t){let[n,...r]=t;if(!n)throw Error(`A saved environment needs at least one connection.`);return{environmentId:e.environmentId,name:e.name,...Fp(n),...Lp(e)?{operationIdentity:Lp(e)}:{},...r.length?{alternateRoutes:r.map(Fp)}:{}}}function zp(e){return JSON.stringify(Pa(Ot(Pp))(e))}function Bp(e,t){if(t===void 0)return{kind:`checking`};if(t.kind===`reconnecting`)return{kind:`reconnecting`};if(t.kind===`foreign`)return{kind:`other-server`};if(t.kind===`unauthorized`)return{kind:`needs-pairing`};if(t.kind===`unreachable`)return{kind:`offline`};let{environment:n}=t;return n.environmentId===e.environmentId?n.protocol===2?{kind:`online`,name:n.name,version:n.version}:{kind:`incompatible`}:{kind:`other-server`}}function Vp(e,t){let n=Reflect.get(e,t);return typeof n==`string`?n:void 0}function Hp(e){if(!e||typeof e!=`object`)return;let t=Vp(e,`address`),n=Vp(e,`credential`),r=Vp(e,`deviceId`);return t&&n?{address:t,credential:Fe(n),...r?{deviceId:r}:{}}:void 0}function Up(e){if(!e||typeof e!=`object`)return[];let t=Vp(e,`environmentId`),n=Vp(e,`name`),r=Hp(e),i=Reflect.get(e,`alternateRoutes`);return t&&n!==void 0&&r?[{environmentId:t,name:n,...r,...Vp(e,`operationIdentity`)?{operationIdentity:Vp(e,`operationIdentity`)}:{},...Array.isArray(i)?{alternateRoutes:i.flatMap(e=>{let t=Hp(e);return t?[t]:[]})}:{}}]:[]}function Wp(e){return Array.isArray(e)?e.flatMap(Up):[]}function Gp(e,t){let n=e.find(e=>e.environmentId===t.environmentId);if(!n)return[...e,t];let r=Ip(t),i=Ip(n).map(e=>r.find(t=>t.address===e.address)??e);return i.push(...r.filter(e=>!i.some(t=>t.address===e.address))),[...e.filter(e=>e.environmentId!==t.environmentId),Rp({...n,name:t.name},i)]}var Kp=zn((e,t)=>e===t);function qp(e,t){return e.environmentId===t.environmentId&&e.address===t.address&&Kp(e.credential,t.credential)&&e.deviceId===t.deviceId&&(e.alternateRoutes??[]).length===(t.alternateRoutes??[]).length&&(e.alternateRoutes??[]).every((e,n)=>{let r=t.alternateRoutes?.[n];return r!==void 0&&e.address===r.address&&e.deviceId===r.deviceId&&Kp(e.credential,r.credential)})}function Jp(e){switch(e.kind){case`checking`:return`Checking`;case`reconnecting`:return`Reconnecting`;case`online`:return`Online`;case`offline`:return`Offline`;case`needs-pairing`:return`Needs pairing`;case`other-server`:return`Another server`;case`incompatible`:return`Update needed`}}function Yp(e){switch(e.kind){case`offline`:return`It did not answer. Check that it runs and that this device reaches its address.`;case`needs-pairing`:return`It no longer accepts this app. Run porcelain pair on it and add the new link.`;case`other-server`:return`Another Porcelain answers at this address now, so this app stays away from it.`;case`incompatible`:return`It runs a Porcelain this app cannot talk to. Update both to the same version.`;default:return}}var Xp=class e extends za()(`@porcelain/client/AccessStore`){static layer=dn(e,H(function*(){let e=yield*jp,t=yield*st({initial:{remotes:[]},read:()=>_(e.read(),e=>({remotes:e})),write:({remotes:t})=>e.write(t),messages:{beforeRead:`Saved environments must be read before changing them.`,readFailed:`Saved environments could not be read. Try reading them again.`,writeFailed:`The saved environments could not be updated. Read them again before making changes.`}}),n=e=>t.write(({remotes:t})=>fi({remotes:e(t)}));return{state:t.state,load:t.load,save:W(`AccessStore.save`)(e=>n(t=>Gp(t,e))),route:W(`AccessStore.route`)(e=>t.write(({remotes:t})=>H(function*(){let n=t.find(t=>t.environmentId===e.environmentId);if(!n)return yield*U(new X({message:`That environment is no longer saved.`}));let r=Ip(n),i=r.find(t=>t.address===e.address);if(!i)return yield*U(new X({message:`That connection is no longer saved.`}));let a=r.filter(t=>t.address!==e.address);if(e.kind===`remove`&&!a.length)return yield*U(new X({message:`Forget the environment to remove its last connection.`}));let o=Rp(n,e.kind===`prefer`?[i,...a]:a);return{remotes:t.map(t=>t.environmentId===e.environmentId?o:t)}}))),forget:W(`AccessStore.forget`)(e=>n(t=>t.filter(t=>t.environmentId!==e)))}}))},Zp=class extends za()(`@porcelain/client/ConnectionFactory`){},Qp=class extends za()(`@porcelain/client/RemoteConnectionFactory`){},$p=class e extends za()(`@porcelain/client/AccessSession`){static layer=dn(e,H(function*(){let e=yield*Zp,t=yield*Je,r,i=ut({connection:null,generation:0,writerIdentity:void 0});return{state:i,beginConnection:W(`AccessSession.beginConnection`)((a=!1)=>Y(()=>{if(a&&i.value.generation!==0)return null;let o=i.value.generation;return W(`AccessSession.completeConnection`)(function*(a){if(o!==i.value.generation)return!1;let s=JSON.stringify(a.principal),c=i.value.connection?.environmentId===a.inventory.environmentId&&i.value.writerIdentity===s,l=r,u=i.value.connection;if(c||(l=yield*tn(t,`sequential`),u=yield*e.local(a).pipe(n(Je,l))),o!==i.value.generation)return!c&&l&&(yield*Sr(l,ao)),!1;let d=r;return r=l,i.update(e=>({...e,connection:u,writerIdentity:s,generation:o+1})),d&&d!==r&&(yield*Sr(d,ao)),!0},yn)})),clear:W(`AccessSession.clear`)(function*(){let e=r;r=void 0,i.update(e=>({...e,connection:null,writerIdentity:void 0,generation:e.generation+1})),e&&(yield*Sr(e,ao))},yn)}}))},em=class e extends za()(`@porcelain/client/RemoteConnections`){static layer=dn(e,H(function*(){let e=yield*Qp,t=yield*Je,r=yield*zo(1),i=[],a=ut([]);return{state:a,synchronize:W(`RemoteConnections.synchronize`)(o=>H(function*(){let r=yield*P(o,r=>H(function*(){let a=i.find(e=>qp(e.remote,r));if(a)return{...a,remote:r};let o=yield*tn(t,`sequential`);return{remote:r,connection:yield*e.open(r).pipe(n(Je,o)),scope:o}})),s=i.filter(e=>!r.some(t=>t.scope===e.scope));i=r,a.set(r.map(({remote:e,connection:t})=>({remote:e,connection:t}))),yield*P(s,e=>Sr(e.scope,ao),{discard:!0})}).pipe(bo(r),yn))}}))},tm=y(H(function*(){let e=yield*Xp,t=yield*em;yield*t.synchronize(e.state.value.remotes),yield*E(W(`RemoteConnections.subscribe`)(function*(t){yield*Po(Y(()=>e.state.subscribe(({remotes:e})=>{qo(t,e)})),e=>Y(e))})).pipe(As(t.synchronize),oa({startImmediately:!0}))}));function nm(e,t,n){return(r,i)=>{let a=new URL(r,e),o=new Headers(i?.headers);return t&&a.pathname!==`/api/health`&&o.set(`authorization`,`Bearer ${$n(t)}`),n(a,{...i,headers:o,mode:`cors`,credentials:`omit`,redirect:`error`,cache:`no-store`})}}var rm=class extends za()(`@porcelain/client/PairingPlatform`){};function im(e){let t;try{t=new URL(e.trim())}catch{return}if(t.protocol!==`http:`&&t.protocol!==`https:`||t.pathname!==`/pair`)return;let n=am(t.hash);return n?{address:t.origin,...n}:void 0}function am(e){let t=new URLSearchParams(e.replace(/^#/,``)),n=t.get(`c`),r=t.get(`e`);return n&&r?{code:n,environmentId:r}:null}var om=G(e=>ut(void 0)),sm=G(e=>rr()),cm=un(Yi),lm=class e extends za()(`@porcelain/client/BootstrapClient`){static layer=G(t=>Se(dn(e,cm),io(t)))},um=G(e=>To(lm.layer(e)));function dm(e,t){return kn(t)?{kind:`offline`}:Bp(e,Gi(la(t)))}function fm(e,t){return H(function*(){let e=yield*lm,n=yield*Pi(e.publicAccess.readEnvironment());return n.environmentId===t&&n.protocol===2&&(yield*Pi(e.session.readSession())),{kind:`described`,environment:n}}).pipe(xr(lm.layer(e)),Oa(e=>fi(e instanceof Fa&&e.status===401?{kind:`unauthorized`}:{kind:`unreachable`})),ts(Xo),_(e=>eo(e,()=>({kind:`unreachable`}))))}function pm(e,t){om(e.send).set({remote:t,revision:Symbol()})}var mm=W(`Environments.readVerifiedRoute`)(function*(e,t,n){let r=nm(e.address,e.credential,n);return yield*H(function*(){let e=yield*lm;return(yield*Pi(e.publicAccess.readHealth())).environmentId===t?yield*fm(r,t):{kind:`foreign`}}).pipe(xr(lm.layer(r)),Oa(()=>fi({kind:`unreachable`})))}),hm=W(`Environments.readRoutes`)(function*(e,t){let n={kind:`unreachable`};for(let r of Ip(t)){let i=yield*mm(r,t.environmentId,e.send).pipe(ts(ci),_(e=>eo(e,()=>({kind:`unreachable`}))));if(Bp(t,i).kind===`online`)return i;i.kind!==`unreachable`&&(n=i)}return n}),gm=G(({platform:e,remote:t})=>{let{send:n,statusActivity:r}=e;return sm(e)(Wn).atom(()=>{let i=!1,a=!1,o,s=E(e=>H(function*(){let o=()=>{let t=r?.isActive()??!0,n=t&&!a;a=t,(!t||n||!i)&&qo(e,t)};yield*Po(Y(()=>{let e=r?.subscribe(o),i=om(n).subscribe(()=>{let e=om(n).value;e&&qp(e.remote,t)&&o()});return()=>{e?.(),i?.()}}),e=>Y(e)),o()}),{bufferSize:1,strategy:`sliding`}),c=H(function*(){i=!0;let n=yield*hm(e,t);return o=n,n}).pipe(qr(Y(()=>{i=!1})));return s.pipe(Nn(e=>e?Oe(()=>o?.kind===`unreachable`?wn(aa({kind:`reconnecting`}),ma(c)):ma(c)).pipe(cn(pe(Ea))):le))}).pipe(ti(0))});function _m(e,t){return gm({platform:e,remote:t})}function vm(e){return e instanceof Fa?!0:e instanceof X?!1:e._tag===`InvalidPairingError`||e._tag===`InvalidDeviceDetailsError`}function ym(e,t,n){return H(function*(){let r=im(t);if(!r)return yield*U(new X({message:`Paste the whole link porcelain pair printed, starting with http.`}));if(n&&r.environmentId!==n)return yield*U(new X({message:`That pairing link belongs to another computer. Add it as a separate environment.`}));let i=nm(r.address,void 0,e.send);if((yield*Pi(H(function*(){return yield*(yield*lm).publicAccess.readHealth()}).pipe(xr(lm.layer(i))))).environmentId!==r.environmentId)return yield*U(new X({message:`Another Porcelain answered at that address than the one that made the link.`}));let a=yield*Pi(H(function*(){return yield*(yield*lm).pairing.redeemPairing({payload:{code:r.code,platform:e.name()}})}).pipe(xr(lm.layer(i)))).pipe(Hn(e=>vm(e)?new X({message:`That link was not accepted. It works once, for a few minutes; run porcelain pair again.`}):e instanceof X?new X({message:`Could not reach ${r.address}. Check that Porcelain runs there and that this device reaches it.`,cause:e.cause}):e));if(!a.credential)return yield*U(new X({message:`The remote paired but sent no credential.`}));let o=Fe(a.credential),s=Bp(r,yield*fm(nm(r.address,o,e.send),r.environmentId));return s.kind===`online`?{environmentId:r.environmentId,address:r.address,name:s.name,credential:o,deviceId:a.device.id}:yield*U(new X({message:s.kind===`other-server`?`Another Porcelain answered at that address than the one that made the link.`:s.kind===`incompatible`?`That Porcelain runs a version this app cannot talk to. Update both to the same version.`:`The remote paired but did not answer afterwards. Try again.`}))})}var bm=W(`Environments.pairAndSave`)(function*(e,t){let n=yield*Xp,r=yield*Mp;if(n.state.value.status!==`ready`)return yield*U(new X({message:`Read saved environments before pairing.`}));let i=yield*ym(r,e,t);return yield*n.save(i),i}),xm=W(`BrowserSession.pair`)(function*(e){let t=yield*rm,n=yield*lm;if((yield*Pi(n.publicAccess.readHealth()).pipe(Hn(e=>!(e instanceof X)&&!(e instanceof Fa)&&e._tag!==`MissingEnvironmentIdentityError`?new X({message:`That address answered, but it is not a Porcelain server.`}):new X({message:`Could not reach Porcelain. Check that the server is running, then open the link again.`,cause:e})))).environmentId!==e.environmentId)return yield*U(new X({message:`This link was made for a different Porcelain installation.`}));let r=yield*Pi(n.pairing.redeemPairing({payload:{code:e.code,platform:t.name()}})).pipe(Hn(e=>vm(e)?new X({message:`This pairing link is not usable. Ask for a new one.`}):e));return{inventory:yield*Pi(n.projects.readInventory()).pipe(Hn(e=>e instanceof Fa?new X({message:`Pairing succeeded but the workspace could not be loaded. Reload the page.`}):e)),principal:{kind:`device`,deviceId:r.device.id}}}),Sm=G(({transport:e,platform:t})=>To(In(lm.layer(e),lo(rm,t))).fn(e=>xm(e))),Cm=class e extends za()(`@porcelain/client/AccessSnapshots`){static layer=dn(e,H(function*(){return{remote:yield*nt(Jr()),update:yield*nt(Jr())}}))},wm=G(e=>e.atoms(t=>rt(Cm.layer,t(Ti(e).layer)))),Tm=Wr,Em=So,Dm=class extends Yt.add(pt(`live`).add(v(`liveUpdates`,`/api/live`,{disableCodecs:!0,query:bt.fields,success:At.pipe(Ae({decode:()=>void 0}),Fn(`SwitchingProtocols`))})).middleware(ge)){};Yt.add(pt(`reviewMcp`).add(Un(`reviewMcp`,`/mcp`,{disableCodecs:!0,payload:Tm,success:[Tm,Em.pipe(Ae({decode:()=>void 0}),Fn(`Accepted`))]})).middleware(ge));var Om=[`lan`,`tailnet`,`cloudflare`],km={lan:`Local network`,tailnet:`Tailscale`,cloudflare:`Cloudflare tunnel`},Am={loopback:`This computer`,lan:`Local network`,tailnet:`Tailscale`,tunnel:`Cloudflare tunnel`};function jm(e){return`${e.subnet} on ${e.interfaceName}`}function Mm(e){let{lan:t}=e.routes,n=e.localNetwork,r=e.lanNetwork,i=`Porcelain cannot tell this network from another one yet, because the hardware address of its router is not known.`;return t.enabled?t.status.kind===`paused`?n?n.gatewayHardware?r?jm(r)===jm(n)?`Paused on this network. It looks like ${jm(r)}, but its router is another one, so this is another network; turn it on for this network to listen here.`:`Paused on this network. It was turned on for ${jm(r)}, and listens again there, or here once you turn it on for this network.`:`Paused on this network. It was turned on before Porcelain kept the network it was turned on for; turn it on for this network to listen here.`:`Paused. ${i}`:r?`Paused: this computer is not on a local network. Porcelain listens again when it is back on ${jm(r)}.`:`Paused: this computer is not on a local network.`:r?`Listening on ${jm(r)} only.`:`Listening on this network only.`:n?n.gatewayHardware?`Turning it on listens on ${jm(n)} only, and pauses on any other network.`:`${i} Try again in a moment.`:`This computer is not on a local network right now.`}function Nm(e){return e?Om.some(t=>{let n=e.routes[t];return n.enabled?n.status.kind===`starting`||n.status.kind===`off`:n.status.kind!==`off`}):!1}function Pm(e){return e===void 0?[]:Om.flatMap(t=>{let{status:n}=e.routes[t];return n.kind===`on`?n.urls.map(e=>({route:t,url:e})):[]})}function Fm(e){let[t]=e.grants;return t?{label:t.grant.label,link:He(t.link),expiresAt:t.grant.expiresAt}:null}function Im(e){return`tailscale serve --bg --https=443 ${e}`}function Lm(e,t){let n=`Your devices may reach that program instead of Porcelain: run tailscale serve --https=443 off now, then turn Tailscale off and on here to pick a free port and run the new command Porcelain names.`;switch(t){case`address-in-use`:return e===`tailnet`?`Another program already listens on the port Tailscale forwards to. ${n}`:`Another program already listens on this port.`;case`address-unavailable`:return e===`tailnet`?`Porcelain could not open the local listener Tailscale forwards to. ${n}`:`This computer could not listen at its address.`;case`unreachable`:return e===`tailnet`?`Nothing answered at this Tailscale name yet. Check that you ran the command below, that Tailscale is connected on this computer and uses MagicDNS, and that MagicDNS and HTTPS Certificates are on in the Tailscale admin console. Porcelain keeps checking.`:`Nothing answered at this hostname. Check that cloudflared is running and routes it here.`;case`other-server`:return e===`tailnet`?`Another server answered at this Tailscale name. Run the command below so Tailscale forwards to this Porcelain; Porcelain keeps checking.`:`Another server answered at this hostname.`}}function Rm(e,t,n){return H(function*(){let r=yield*ms(n.pipe(Aa(()=>yr(e))));return hi(r)&&ks(r.cause)?yield*ue:(Fi(r)&&(yield*co(t,hs(r.value))),k(r,$o(yield*xe(t),d)))})}function zm(e,t,n,r){return Xi(e.atom(ye(_(r,e=>ma(t).pipe(cn(pe(n)),Jn(t=>!e(Gi(la(t)))))))).pipe(mo(e=>bn(e,e=>e)))).pipe(ti(0))}function Bm(e,t,n){return os(Cm,r=>Rm(e,t(r),n))}var Vm=G(e=>Ti(e).atom(Wa(e,e=>e.administration.listAccess())).pipe(ti(0))),Hm=G(e=>zm(wm(e),Bm(e,e=>e.remote,Wa(e,e=>e.administration.readRemoteAccess()).pipe(Oa(e=>e instanceof Fa&&e.status===403?fi(null):U(e)))),Mo,fi(Nm))),Um=G(e=>zm(wm(e),Bm(e,e=>e.update,Wa(e,e=>e.serviceUpdates.readServiceUpdate())),mi,H(function*(){let e=yield*Cm,t=Gi(yield*xe(e.update)),n=t?.running?t.last?.target:void 0;return e=>e?.managed===!0?e.running?(n=e.last?.target,!0):n!==void 0&&e.last?.stage===`updated`&&e.last.target===n&&e.version===e.last.from&&e.version!==n:!1})));function Wm(e){return H(function*(){let t=yield*Vo(e),n=yield*Qe,r=yield*Cm,i=yield*Di;function a(t,r){return n.run([t],H(function*(){yield*yr(e);let t=yield*r;return yield*yr(e),t}))}function o(t){return Y(()=>{e.isClosed()||i.refresh(t)})}function s(e,t,n){return Ra(Y(()=>{let t=i.mount(e),n=La(d(i.get(e),{waiting:!0}));return i.set(e,n),{transition:n,unmount:t}}),({transition:e})=>n.pipe(Aa(n=>H(function*(){yield*co(t,hs(n)),i.set(e,d(d(n),{waiting:!0}))}))),({transition:e,unmount:t},n)=>Y(()=>{i.set(e,Fi(n)?d(d(n.value)):ys(n.cause)),t()}))}return{issue:n=>a(`paired-access`,t.request(e=>e.administration.issuePairing({payload:{labels:[n.label],addresses:n.addresses,...n.trusted?{trusted:!0}:{}}})).pipe(Aa(()=>o(Vm(e))))),revoke:n=>a(`paired-access`,t.request(e=>e.administration.revokeAccess({payload:{id:n}})).pipe(qr(o(Vm(e))))),trust:n=>a(`paired-access`,t.request(e=>e.administration.setDeviceTrust({payload:n})).pipe(qr(o(Vm(e))))),setRemote:n=>a(`remote-access`,s(Hm(e),r.remote,t.request(e=>e.administration.setRemoteAccess({payload:n})).pipe(Aa(()=>yr(e))))),startUpdate:n=>a(`service-update`,s(Um(e),r.update,t.request(e=>e.serviceUpdates.startServiceUpdate({payload:{version:n}})).pipe(Aa(()=>yr(e)),Bi(()=>o(Um(e))))))}})}var Gm=class e extends za()(`@porcelain/client/AccessCommands`){static layer(t){return dn(e,Wm(t))}},Km=G(e=>e.atoms(t=>rt(Gm.layer(e),t(wm(e).layer)))),qm=G(e=>Km(e).fn(e=>Gm.use(t=>t.issue(e)).pipe(_(Fm)),{concurrent:!0})),Jm=G(({connection:e,id:t})=>Km(e).fn(()=>Gm.use(e=>e.revoke(t)),{concurrent:!0})),Ym=G(({connection:e,id:t})=>Km(e).fn(e=>Gm.use(n=>n.trust({id:t,trusted:e})),{concurrent:!0})),Xm=G(e=>Km(e).fn(e=>Gm.use(t=>t.setRemote(e)),{concurrent:!0})),Zm=G(e=>Km(e).fn(e=>Gm.use(t=>t.startUpdate(e)),{concurrent:!0}));function Qm(e,t,n,r=Jr(),i=[t,er.environment(e.environmentId)]){return H(function*(){let a=yield*Qe,o=yield*ps,s=yield*Or({epoch:0,result:ws(r,{onNone:()=>us(),onSome:e=>d(e)})}),c=(t=n,r=!1)=>H(function*(){let n=(yield*Ii(s)).epoch;yield*Ss(s,e=>({...e,result:yt(e.result)}));let i=yield*ms(t.pipe(Aa(()=>yr(e))));yield*Ss(s,e=>e.epoch===n?{...e,epoch:e.epoch+ +!!r,result:k(i,hs(e.result))}:e)});function l(n,r){return a.run(er.withIdentity(t,e),H(function*(){yield*yr(e),yield*Ss(s,e=>({...e,epoch:e.epoch+1}));let t=yield*n;return yield*yr(e),yield*Ss(s,e=>({epoch:e.epoch+1,result:ws(r(la(e.result),t),{onNone:()=>e.result,onSome:e=>d(e)})})),t}).pipe(qr(o.invalidate([t]))))}return{confirm:l,refresh:e=>H(function*(){yield*Ss(s,e=>({...e,epoch:e.epoch+1})),yield*c(e,!0)}),stream:Ht(Ui(s).pipe(gt(e=>e.result)),o.stream(i,c()).pipe(re))}})}var $m=Fo(`@porcelain/client/InventorySeed`,{defaultValue:()=>Jr()}),eh=class e extends za()(`@porcelain/client/InventoryState`){static layer(t){return dn(e,H(function*(){let e=yield*$m,n=yield*Vo(t),r=e=>yr(t,e.environmentId===t.environmentId),i=n.request(e=>e.projects.readInventory()),a=yield*Qm(t,er.inventory(t.environmentId),i.pipe(Aa(r)),e);function o(e,t){return a.confirm(e,(e,n)=>$o(e,e=>t(e,n)))}return{stream:a.stream,confirm:o,refresh:()=>a.refresh(n.request(e=>e.projects.refreshInventory()).pipe($a(`RequestError`,e=>e.status===404?i:U(e)),Aa(r)))}}))}},th=G(e=>e.atoms(t=>rt(eh.layer(e),t(Ti(e).layer)))),nh=G(e=>th(e).fn(t=>H(function*(){let n=yield*Vo(e);return yield*(yield*eh).confirm(n.request(e=>e.environmentName.renameEnvironment({payload:{name:t}})),(e,t)=>({...e,environment:t}))}),{concurrent:!0})),rh=W(`BrowserSession.restore`)(function*(){let e=yield*lm;return{principal:yield*Pi(e.session.readSession()),inventory:yield*Pi(e.projects.readInventory())}},Oa(e=>e instanceof Fa&&e.status===401?fi(null):U(e instanceof Fa||jn(e)?new X({message:`Could not reach Porcelain to restore this browser session.`,cause:e}):e))),ih=G(e=>um(e).atom(rh())),ah=`Save or discard unsaved file drafts before disconnecting.`;function oh(e){return e instanceof Error&&(e.name===`ConnectionError`||e.name===`RequestError`)?e.message:`Could not connect to the environment. Try again.`}var sh=G(e=>e.atoms(t=>In(t(Vo(e).runtime.layer),We.layer)).fn(W(`BrowserSession.disconnect`)(function*(){let t=yield*We,n=yield*Vo(e);if(!(yield*t.save(e.environmentId)))return yield*U(new X({message:ah}));yield*n.request(e=>e.browserAccess.clearBrowserSession())},Hn(e=>e instanceof X?e:new X({message:`Could not disconnect. Check the connection and try again.`,cause:e}))))),ch=W(`BrowserSession.connect`)(function*(e,t,n,r){let i=yield*$p,a=yield*i.beginConnection(),o=yield*Ra(Y(()=>e.set(t,n)),()=>Qa(e,t,{suspendOnWaiting:!0}),()=>Y(()=>e.set(t,qe))).pipe(Es({duration:r,orElse:()=>ue}),di(e=>U(new X({message:oh(Cn(e)),cause:Cn(e)}))));if(a&&(yield*a(o)),i.state.value.connection?.environmentId!==o.inventory.environmentId)return yield*U(new X({message:`Could not connect to the environment. Try again.`}))}),lh=W(`BrowserSession.restoreConnection`)(function*(e,t){let n=yield*$p;if(n.state.value.connection)return!0;let r=yield*n.beginConnection(!0);if(!r)return!1;let i=e.get(t);kn(i)&&!i.waiting&&e.refresh(t);let a=yield*Qa(e,t,{suspendOnWaiting:!0});return a!==null&&(yield*r(a),n.state.value.connection!==null)}),uh=class e extends za()(`@porcelain/client/EnvironmentMutations`){static layer=dn(e,H(function*(){let e=yield*zo(1),t=ut(0);return{pendingSelections:t,run:(n,r)=>Ra(Y(()=>{n===`selection`&&t.update(e=>e+1)}),()=>e.withPermit(r),()=>Y(()=>{n===`selection`&&t.update(e=>e-1)}))}}))},dh=class extends za()(`@porcelain/client/WorkspaceSelectionCleanup`){},fh=H(function*(){let e=yield*Xp,t=yield*Mp,r=yield*uh,i=yield*We,a=yield*dh;return{read:W(`Environments.read`)(()=>r.run(`access`,e.load())),pair:W(`Environments.pair`)(i=>r.run(`access`,H(function*(){return i.localEnvironmentId&&im(i.value)?.environmentId===i.localEnvironmentId?yield*U(new X({message:`That link is for this computer.`})):yield*bm(i.value,i.environmentId).pipe(n(Xp,e),n(Mp,t))}))),route:W(`Environments.route`)(t=>r.run(`access`,H(function*(){if(!(yield*i.save(t.environmentId)))return yield*U(new X({message:ah}));yield*e.route(t)}))),forget:W(`Environments.forget`)(t=>r.run(`selection`,H(function*(){if(!(yield*i.save(t)))return yield*U(new X({message:ah}));yield*H(function*(){yield*e.forget(t),yield*a.forgetEnvironment(t),yield*i.drop(t)}).pipe(yn)})))}}),ph=class e extends za()(`@porcelain/client/EnvironmentCommands`){static layer=dn(e,fh)},mh=Ms(Dm).live.liveUpdates,hh=Ms(m).pairing.redeemPairing,gh=new Set;function _h(e){return gh.add(e),()=>gh.delete(e)}function vh(){for(let e of[...gh])e()}function yh(e,t={}){return async(n,r)=>{let i=new Headers(r?.headers);i.delete(`authorization`),i.set(`x-porcelain-browser`,`1`);let a=await e(n,{...r,headers:i,credentials:`same-origin`});return a.status===401&&n!==hh()&&t.reportUnauthorized!==!1&&vh(),a}}var bh=G(e=>th(e).atom(ye(_(eh,e=>e.stream))).pipe(mo(e=>bn(e,e=>e)),ti(0)));G(e=>Ir(t=>e.map(e=>({connection:e,result:t(bh(e))}))));var xh=class extends za()(`@porcelain/client/ProjectSelectionStorage`){},Sh=class e extends za()(`@porcelain/client/ProjectSelectionStore`){static layer=dn(e,H(function*(){let e=yield*xh,t=yield*st({initial:{currentEnvironmentId:void 0,selections:{}},read:e.read,write:e.write,messages:{beforeRead:`Saved workspace selections must be read before changing them.`,readFailed:`Saved workspace selections could not be read. Try reading them again.`,writeFailed:`Saved workspace selections could not be updated. Read them again before making changes.`}}),n=t.write;return{state:t.state,load:t.load,selectEnvironment:W(`ProjectSelectionStore.selectEnvironment`)(e=>n(({selections:t})=>fi({currentEnvironmentId:e,selections:t}))),selectWorkspace:W(`ProjectSelectionStore.selectWorkspace`)((e,t,r)=>n(({selections:n})=>fi({currentEnvironmentId:e,selections:{...n,[e]:{projectId:t,worktreeId:r}}}))),forgetEnvironment:W(`ProjectSelectionStore.forgetEnvironment`)(e=>n(({currentEnvironmentId:t,selections:n})=>fi({currentEnvironmentId:t===e?void 0:t,selections:Object.fromEntries(Object.entries(n).filter(([t])=>t!==e))})))}}))};function Ch(e){return H(function*(){let t=yield*Vo(e),n=yield*eh,r=yield*We;return{register:e=>n.confirm(t.request(t=>t.projects.registerProject({payload:{path:e}})),(e,t)=>({...e,projects:e.projects.some(e=>e.id===t.id)?e.projects.map(e=>e.id===t.id?t:e):[...e.projects,t]})),rename:e=>n.confirm(t.request(t=>t.projects.renameProject({params:{projectId:e.projectId},payload:{name:e.name}})),(e,t)=>({...e,projects:e.projects.map(e=>e.id===t.id?{...e,name:t.name}:e)})),remove:i=>n.confirm(H(function*(){let n=`[${JSON.stringify(i)},`;for(let[t,i]of r.entries(e))if(t.startsWith(n)&&!(yield*i.save()))return yield*U(new X({message:`Save or discard unsaved file drafts before removing this project.`}));return yield*t.request(e=>e.projects.removeProject({params:{projectId:i}}))}),e=>({...e,projects:e.projects.filter(e=>e.id!==i)}))}})}var wh=class extends za()(`@porcelain/client/ProjectCommands`){},Th=G(e=>e.atoms(t=>rt(dn(wh,Ch(e)),In(t(th(e).layer),We.layer)))),Eh=G(e=>Th(e).fn(e=>wh.use(t=>t.register(e)),{concurrent:!0})),Dh=G(e=>Th(e).fn(e=>wh.use(t=>t.rename(e)),{concurrent:!0})),Oh=G(e=>Th(e).fn(e=>wh.use(t=>t.remove(e)),{concurrent:!0})),kh=G(e=>th(e).fn(e=>eh.use(e=>e.refresh()),{concurrent:!0})),Ah=G(e=>ui(t=>e.map(e=>t(kh(e))),(t,n)=>{for(let n of e)t.set(kh(n),void 0)})),jh=class e extends za()(`@porcelain/client/FilePreferencesState`){static layer(t,n){return dn(e,H(function*(){let e=yield*Vo(t);return yield*Qm(t,er.filePreferences(t.environmentId,n),e.request(e=>e.projects.listFilePreferences({params:{projectId:n}})))}))}},Mh=G(({connection:e,projectId:t})=>e.atoms(n=>rt(jh.layer(e,t),n(Ti(e).layer)))),Nh=G(({connection:e,projectId:t})=>Mh({connection:e,projectId:t}).fn(n=>H(function*(){let r=yield*Vo(e);return yield*(yield*jh).confirm(r.request(e=>e.projects.setFilePreference({params:{projectId:t},payload:n})),(e,t)=>hs(t))}),{concurrent:!0})),Ph=G(e=>Mh(e).atom(ye(_(jh,e=>e.stream))).pipe(mo(e=>bn(e,e=>e)),ti(0))),Fh=G(({connection:e,path:t})=>Ti(e).atom(H(function*(){return yield*(yield*Vo(e)).request(e=>e.projects.browseProjectFolders({query:t===void 0?{}:{path:t}}))})));function Ih(e,t){return Fh({connection:e,path:t})}r({currentEnvironmentId:Bt(Is),selections:mr(nn,r({projectId:Is,worktreeId:w})).check(j(Is))});var Lh=H(function*(){let e=yield*Xp,t=yield*Sh,n=yield*uh;return{pending:n.pendingSelections,execute:W(`WorkspaceSelection.execute`)(r=>n.run(`selection`,H(function*(){if(r.kind===`read`){if(yield*t.load(),e.state.value.status!==`ready`||t.state.value.status!==`ready`)return;let n=new Set(e.state.value.remotes.map(e=>e.environmentId)),r=new Set(Object.keys(t.state.value.selections));t.state.value.currentEnvironmentId&&r.add(t.state.value.currentEnvironmentId);for(let e of r)n.has(e)||(yield*t.forgetEnvironment(e));return}if(e.state.value.status!==`ready`||!e.state.value.remotes.some(e=>e.environmentId===r.environmentId))return yield*U(new X({message:`That environment is no longer paired. Open the workspace picker again.`}));if(r.kind===`environment`){yield*t.selectEnvironment(r.environmentId);return}yield*t.selectWorkspace(r.environmentId,r.projectId,r.worktreeId)})))}});(class e extends za()(`@porcelain/client/ProjectSelectionCommands`){static layer=dn(e,Lh)});var Rh=G(e=>en((t,n)=>H(function*(){let r=yield*n.setResult(Eh(e),t.path.trim()),i=r.worktrees.find(e=>e.available);t.complete(),i&&(yield*t.select({remote:t.remote,projectId:r.id,worktreeId:i.id}))})));dn(dh,_(Sh,e=>({forgetEnvironment:e.forgetEnvironment})));var zh={isActive:()=>document.visibilityState!==`hidden`&&!0,subscribe:e=>(window.addEventListener(`focus`,e),window.addEventListener(`online`,e),window.addEventListener(`offline`,e),document.addEventListener(`visibilitychange`,e),()=>{window.removeEventListener(`focus`,e),window.removeEventListener(`online`,e),window.removeEventListener(`offline`,e),document.removeEventListener(`visibilitychange`,e)})};function Bh(e,t){if(!e.running)return null;let n=e.last?.target??e.latest??`the new version`;return t||e.last?.stage===`restarting`?`Restarting Porcelain on ${n}. This page reconnects when it is back.`:e.last?.stage===`installing`?`Installing ${n}…`:`Downloading ${n}…`}function Vh(e){let{last:t}=e;return e.running||t==null?null:t.stage===`updated`&&t.target===e.version?{kind:`updated`,from:t.from,target:t.target}:t.stage===`failed`?{kind:`failed`,target:t.target,reason:t.reason??`The updater gave no reason.`}:null}function Hh(e){return e.kind===`online`?`secondary`:e.kind===`checking`?`outline`:`destructive`}function Uh(e,t){return t&&e.kind===`online`}function Wh(e){if(e.status===`unreadable`)return{kind:`unreadable`,message:e.message};if(e.status===`empty`)return{kind:`readable`,remotes:void 0};try{return{kind:`readable`,remotes:Wp(JSON.parse(e.value))}}catch{return{kind:`unreadable`,message:`The saved remote computers are not in a form this app reads.`}}}var Gh=jp.of({read:()=>Xr({try:async()=>{let e=ht();if(!e){let e=localStorage.getItem(`porcelain.remotes`);return e===null?[]:Wp(JSON.parse(e))}let t=Wh(await e.read());if(t.kind===`unreadable`)throw Error(t.message);return t.remotes??[]},catch:e=>new Ia(e)}),write:e=>Xr({try:async()=>{let t=ht(),n=zp(e);t?await t.write(n):localStorage.setItem(`porcelain.remotes`,n)},catch:e=>new Ia(e)})}),Kh=class extends za()(`@porcelain/client/OperationStore`){},qh=class extends za()(`@porcelain/client/OperationStorage`){},Jh=Hi(Ot(r({requestId:va.fields.requestId,projectId:nn.check(Sn(1)),worktreeId:gn.fields.worktreeId,request:va}).check(z(e=>e.requestId===e.request.requestId))));function Yh(e){return e.state!==`running`}var Xh=(e,t)=>JSON.stringify([e.projectId,e.worktreeId,t]),Zh=dn(Kh,H(function*(){let e=yield*qh,t=yield*zo(1),n=yield*Or(0),r=yield*e.read().pipe(os(e=>Yo(Jh)(e??`[]`)),Lo),i=ut({operations:s(r)?new Map(r.success.map(e=>[Xh(e,e.request.input.action),e])):new Map,closed:!1,restorationError:sn(r)?new X({message:`Could not restore pending Git operations. Check the previous operation before starting another.`,cause:r.failure}):void 0}),a=W(`OperationStore.publish`)(function*(e){i.set(e),yield*Ss(n,e=>e+1)});yield*ho(()=>t.withPermit(a({...i.value,operations:new Map,closed:!0})));let o=W(`OperationStore.persist`)(function*(t){if(i.value.restorationError)return yield*U(i.value.restorationError);let n=[...t.values()].filter(e=>!e.receipt||!Yh(e.receipt)).map(({receipt:e,...t})=>t),r=yield*ro(Jh)(n).pipe(Hn(e=>new X({message:`Could not save the Git operation. Check device storage before trying again.`,cause:e})));yield*(n.length?e.write(r):e.clear()).pipe(Hn(({cause:e})=>new X({message:`Could not save the Git operation. Check device storage before trying again.`,cause:e}))),yield*a({...i.value,operations:t})}),c=e=>t.withPermit(H(function*(){return i.value.closed?yield*ue:yield*e().pipe(yn)}));return{state:i,set:W(`OperationStore.set`)((e,t)=>c(()=>H(function*(){let n=new Map(i.value.operations);t?n.set(e,t):n.delete(e),yield*o(n)}))),accept:W(`OperationStore.accept`)(e=>c(()=>H(function*(){let t=Xh(e,e.action),n=i.value.operations.get(t);if(!n||n.requestId!==e.requestId||n.receipt&&Yh(n.receipt))return!1;let r=new Map(i.value.operations);return r.set(t,{...n,receipt:e}),yield*o(r),!0}))),wait:W(`OperationStore.wait`)(function*(e,t){let r=yield*Ui(n).pipe(Ct(()=>H(function*(){let n=i.value.operations.get(e);return yield*Zt(!i.value.closed&&n?.requestId===t),n?.receipt&&Yh(n.receipt)?hs(n.receipt):Jr()})),Nt(Ar),gt(e=>e.value),g);return yield*ws(r,{onSome:fi,onNone:()=>Zt(!1).pipe(Lr(Yn))})})}}));function Qh(e,t){return H(function*(){let n=yield*(yield*Vo(e)).request(e=>e.gitActions.readGitActionReceipt({params:{worktreeId:t.worktreeId,requestId:t.requestId}}));return yield*yr(e,n.projectId===t.projectId&&n.worktreeId===t.worktreeId&&n.requestId===t.requestId),n})}var $h=class extends Xt{},eg=class e extends za()(`@porcelain/client/GitReceiptRefresh`){static layer(t){return dn(e,H(function*(){let e=yield*ko,n=yield*ps,r=yield*lt,i=yield*Xf({capacity:1/0,timeToLive:qn,lookup:a=>H(function*(){let o=new Set(N(t.environmentId,a).map(e=>String(e[4]))),s=[...Ee(yield*r.snapshot)].filter(e=>e.projectId===a.projectId&&e.worktreeId===a.worktreeId&&o.has(e.surface)),c=yield*l(H(function*(){n.invalidateUnsafe([er.inventory(t.environmentId),...N(t.environmentId,a)]),yield*P(s,e=>e.settled,{concurrency:`unbounded`,discard:!0})}),e);return yield*l(Vi(c).pipe(Lr(ip(i,a))),e),c})});return{refresh:W(`GitReceiptRefresh.refresh`)(function*(e){if(e.state===`running`||e.state===`rejected`||e.state===`no-change`)return;let t=new $h({projectId:e.projectId,worktreeId:e.worktreeId,requestId:e.requestId,action:e.action,state:e.state}),n=yield*$f(i,t);n.pollUnsafe()&&(yield*ip(i,t)),yield*Qr(n)})}}))}},tg=G(e=>e.atoms(t=>rt(eg.layer(e),t(Ti(e).layer))));function ng(e,t,n){let r=new Map;for(let t of[...e.state.value.operations.values()])t.receipt&&Yh(t.receipt)||r.set(JSON.stringify([t.projectId,t.worktreeId]),{projectId:t.projectId,worktreeId:t.worktreeId,paths:new Set});for(let e of n){let t=JSON.stringify([e.projectId,e.worktreeId]),n=r.get(t)??{projectId:e.projectId,worktreeId:e.worktreeId,paths:new Set};for(let t of e.paths)t!==``&&n.paths.add(t);r.set(t,n)}return{projects:t?.projects.map(e=>e.id).slice(0,128)??[],worktrees:[...r.values()].slice(0,32).map(e=>({projectId:e.projectId,worktreeId:e.worktreeId,paths:[...e.paths].slice(0,64)}))}}var rg=W(`Live.connect`)(function*(e,t){let r=yield*Di,i=yield*lt,a=yield*Kh,o=yield*eg,s=yield*ps,c=yield*Po(tn(e.scope,`sequential`),e=>Sr(e,ao)),l=yield*Ap(yield*wp().pipe(n(Je,c)))(),d=yield*Li(),f=W(`Live.applyNotice`)(function*(t){if(t.type===`git-action`)return yield*o.refresh(t.receipt);(t.type===`inventory`||t.type===`worktree`)&&(yield*s.invalidate([er.inventory(e.environmentId)])),t.type===`project`&&t.change===`preferences`&&(yield*s.invalidate([er.filePreferences(e.environmentId,t.projectId)])),yield*s.invalidate(ne(e.environmentId,t))}),p=()=>{for(let t of a.state.value.operations.values())t.receipt&&Yh(t.receipt)||l(Symbol(),H(function*(){let n=yield*Qh(e,{...t}).pipe($t(d));yield*yr(e),yield*o.refresh(n),yield*a.accept(n)}).pipe(wt,xa))},m=yield*e.liveUpdates.connect({onNotice:t=>{e.isClosed()||c.state._tag===`Closed`||(t.type===`inventory`&&e.onStatusChange?.(),t.type===`ready`&&p(),l(Symbol(),H(function*(){yield*f(t),t.type===`git-action`&&!e.isClosed()&&c.state._tag!==`Closed`&&(yield*a.accept(t.receipt))}).pipe(di(()=>Y(()=>{!e.isClosed()&&c.state._tag!==`Closed`&&p()})),xa)))},onReconnect:()=>{!e.isClosed()&&c.state._tag!==`Closed`&&(e.onStatusChange?.(),l(Symbol(),s.invalidate([er.environment(e.environmentId)])))},onUnauthorized:()=>{e.isClosed()||c.state._tag===`Closed`||(e.onStatusChange?.(),t?t():l(Symbol(),s.invalidate([er.inventory(e.environmentId)])))}}).pipe(n(Je,c)),h=``,g=H(function*(){if(e.isClosed()||c.state._tag===`Closed`)return;let t=ng(a,Gi(la(r.get(bh(e)))),Ee(yield*i.snapshot)),n=JSON.stringify(t);n!==h&&(h=n,m.subscribe(t))}),_=()=>{!e.isClosed()&&c.state._tag!==`Closed`&&l(`subscription`,Lr(u,g),{onlyIfMissing:!0})};yield*Po(Y(()=>r.subscribe(bh(e),_)),e=>Y(e)).pipe(n(Je,c)),yield*Po(Y(()=>a.state.subscribe(_)),e=>Y(()=>e?.())).pipe(n(Je,c)),l(Symbol(),As(i.changes,()=>Y(_))),_()}),ig=G(e=>e.atoms(t=>Zn(t(th(e).layer),t(tg(e).layer),Ns(e.runtime.contextEffect)))),ag=G(({connection:e,onUnauthorized:t})=>ig(e).atom(rg(e,t)).pipe(ti(0))),og=La(d(void 0));function sg(e){return e instanceof Fa?e.status===401:e instanceof bc||tc(e)?e.reason._tag===`SocketCloseError`&&e.reason.code===4001:!1}function cg(e,t=Qi(),r){return{connect:W(`LiveUpdates.connect`)(function*({onNotice:i,onReconnect:a,onUnauthorized:o}){let s=yield*nt({projects:[],worktrees:[]}),c=yield*no(1),l=Ma(c).pipe(Aa(()=>Y(()=>r?.onForeground?.())),ni(`foreground`));if(r?.activity){let e=r.activity,t=e.isActive();yield*Po(Y(()=>e.subscribe(()=>{let n=e.isActive();n&&!t&&qo(c,void 0),t=n})),e=>Y(e))}let u=yield*no(1),d=0,f=500,p=ii(H(function*(){let t=yield*e,r=yield*Kr(),o=yield*Ic({retryPolicy:vt.pipe(Kt(),Be(({input:e})=>wo(r,e)),dt({times:0}))}).pipe(n(Ys,t),n(Ec,Dc)),c=yield*Mc(fa,{disableTracing:!0}).pipe(n(Fc,o)),l=c.notices(void 0).pipe(As(e=>H(function*(){e.type===`ready`&&(d>0&&a(),d+=1,f=500,yield*c.follow(yield*xe(s))),i(e)}))),p=Pt(os(Ma(u),e=>c.follow(e)));yield*Zi([l,p],{concurrency:`unbounded`}).pipe(bi(Ho(r)))}));return yield*ii(H(function*(){for(yield*ho(()=>pi(u));;){let e=yield*ms(p.pipe(bi(l)));if(hi(e)&&sg(Cn(e.cause))&&!(yield*r?.recoverUnauthorized?.()??fi(!1))){o();return}Fi(e)&&e.value===`foreground`||(yield*Go(f).pipe(bi(l)),f=Math.min(f*2,Gr))}})).pipe($t(t),di(e=>ks(e)?B:ln(`Live updates stopped unexpectedly`)),oa),{subscribe(e){u.state._tag!==`Done`&&(Ja(co(s,e)),qo(u,e))}}})}}function lg(e,t){let n=ut(void 0),r=Ip(e),i=new Set,a=()=>{i.clear(),n.set(void 0)},o=e=>{i.add(e.address),n.value?.address===e.address&&n.set(void 0)},s=Ha(1),c=W(`RemoteRoute.select`)((o=!1)=>H(function*(){if(o&&a(),n.value)return n.value;r.every(e=>i.has(e.address))&&i.clear();let s=0;for(let a of r){if(i.has(a.address))continue;let r=yield*mm(a,e.environmentId,t).pipe(ts(ci));if(Ar(r)&&Bp(e,r.value).kind===`online`)return n.set(a),a;Ar(r)&&r.value.kind===`unauthorized`&&s++}return i.clear(),s===r.length?yield*U(new Fa({status:401,message:`This computer no longer accepts the saved connections. Pair it again.`})):yield*U(new X({message:`None of this computer’s saved connections could be reached and authorized.`}))}).pipe(bo(s))),l=e=>nm(e.address,e.credential,t);return{active:n,reset:a,failed:o,select:c,transport:async(e,t)=>{let n={...t?.signal?{signal:t.signal}:{}},i=await Br(c(),n),a=t?.method===void 0||t.method===`GET`||t.method===`HEAD`,s=async n=>{try{let r=await l(n)(e,t);return r.status===401&&o(n),r}catch(e){throw t?.signal?.aborted||o(n),e}},u;try{u=await s(i)}catch(e){if(!a||t?.signal?.aborted||r.length===1)throw e;let o=await Br(c(),n);if(o.address===i.address)throw e;return s(o)}if(u.status!==401||!a||r.length===1)return u;let d=await Br(c().pipe(Ke),n);return Ar(d)&&d.value.address!==i.address?s(d.value):u},transportFor:l}}function ug(e,t,n,r,i){return cg(H(function*(){let i=r?yield*r.select():void 0;i&&r&&(yield*ho(e=>Y(()=>{hi(e)&&!ks(e.cause)&&r.failed(i)})));let{ticket:a}=yield*H(function*(){let e=yield*lm;return yield*Pi(e.session.issueLiveTicket())}).pipe(xr(lm.layer(i&&r?r.transportFor(i):t))),o=new URL(i?.address??e);return yield*n(`${o.protocol===`https:`?`wss:`:`ws:`}//${o.host}${mh({query:{ticket:a}})}`)}),void 0,{...i?{activity:i}:{},...r?{onForeground:r.reset}:{},...r?{recoverUnauthorized:()=>r.select().pipe(ke({onSuccess:()=>!0,onFailure:e=>!(e instanceof Fa&&e.status===401)}))}:{}})}function dg(e,t,n){let r=In(je(Zh),We.layer).pipe(rt(t)),{connection:i}=Le(e,n,r),a=Ft({...i,get address(){return e.activeRoute?.value?.address??e.address},...e.activeRoute?{activeRoute:e.activeRoute}:{},liveUpdates:e.liveUpdates,...e.onStatusChange?{onStatusChange:e.onStatusChange}:{},operations:i.runtime.runSync(Kh)});return i.runtime.runSync(We).adopt(a),a}function fg(e,t,n){let r=lg({...e,name:``},e.send),i=r.transport;return dg({environmentId:e.environmentId,address:e.address,transport:i,cacheIdentity:[e.address,e.deviceId??``],activeRoute:r.active,liveUpdates:ug(e.address,i,e.socket,r,e.activity),...e.onStatusChange?{onStatusChange:e.onStatusChange}:{},timeoutMs:e.timeoutMs},t,n)}function pg(e){return dc(e).pipe(n(uc,e=>new WebSocket(e)))}function mg(){let e=location.protocol===`https:`?`wss:`:`ws:`;return cg(pg(St()??`${e}//${location.host}${mh({query:{}})}`))}var hg=G(e=>Ti(e).atom(Wa(e,e=>e.gitActions.listCommitModels())).pipe(ti(Co),ba({staleTime:Co,revalidateOnFocus:!1})));function gg(e){return hg(e)}var _g=G(({connection:e,scope:t})=>Ti(e).fn(W(`GitActions.generateCommitDraft`)(function*({lifetime:n,...r}){let i=yield*(yield*Vo(e)).request(e=>e.gitActions.generateCommitDraft({params:{worktreeId:t.worktreeId},payload:r}),n);return yield*yr(e),i}),{concurrent:!0})),vg=G(({connection:e,scope:t})=>Ti(e).fn(W(`GitActions.dismissInterrupted`)(function*(n){yield*(yield*Vo(e)).request(e=>e.gitActions.dismissInterruptedGitAction({params:{worktreeId:t.worktreeId,requestId:n}})),yield*yr(e),yield*_n([er.reviewSurface(e.environmentId,t,[`changes`])])}))),yg=G(e=>La(H(function*(){let t=yield*Di,n=_g(e);return W(`CommitDraft.submit`)(function*(e,r){return t.set(n,{...e,lifetime:r}),yield*Qa(t,n,{suspendOnWaiting:!0})})}))),bg=class extends wi()(`GitOperationStateError`,{reason:Ne([`pending`,`missing`,`mismatch`])}){get message(){switch(this.reason){case`pending`:return`Check the existing receipt before starting another operation.`;case`missing`:return`No operation to recover`;case`mismatch`:return`Action mismatch`}}},xg=W(`GitActionController.make`)(function*({connection:e,scope:t,action:n}){let r=yield*Vo(e),i=yield*Kh,a=yield*_p,o=yield*eg,s=yield*zo(1),c=Xh(t,n),l=W(`GitActionController.accept`)(function*(t){yield*yr(e,t.requestId===i.state.value.operations.get(c)?.requestId),yield*o.refresh(t),yield*yr(e,t.requestId===i.state.value.operations.get(c)?.requestId),yield*i.accept(t)}),u=W(`GitActionController.send`)(function*(a){let o=yield*r.request(e=>e.gitActions.runGitAction({params:{worktreeId:t.worktreeId},payload:a}));return`requestId`in o?(yield*yr(e,o.projectId===t.projectId&&o.worktreeId===t.worktreeId&&o.requestId===a.requestId&&o.action===n),yield*l(o),yield*i.wait(c,a.requestId)):yield*U(new Fa({status:o.statusCode,message:o.message}))});return{execute:W(`GitActionController.execute`)(function*(r){return yield*e.request(H(function*(){let o=yield*s.withPermit(H(function*(){yield*yr(e);let o=i.state.value.operations.get(c);if(o&&(!o.receipt||!Yh(o.receipt)))return yield*U(new bg({reason:`pending`}));if(r.input.action!==n)return yield*U(new bg({reason:`mismatch`}));let s={...r,requestId:yield*a.randomUUIDv4.pipe(Hn(e=>new X({message:`Could not create a Git recovery identity.`,cause:e})))};return yield*i.set(c,{...t,requestId:s.requestId,request:s}),s}));return yield*u(o)}))}),recover:W(`GitActionController.recover`)(function*(){return yield*e.request(H(function*(){yield*yr(e);let t=i.state.value.operations.get(c);return t?yield*u(t.request):yield*U(new bg({reason:`missing`}))}))}),startNew:W(`GitActionController.startNew`)(function*(){return yield*s.withPermit(H(function*(){let e=i.state.value.operations.get(c)?.receipt;return!e||!Yh(e)?!1:(yield*i.set(c,null),!0)}))})}}),Sg=class e extends za()(`@porcelain/client/GitActionController`){static layer(t){return dn(e,xg(t))}},Cg=G(e=>e.connection.atoms(t=>rt(Sg.layer(e),Zn(t(tg(e.connection).layer),Ns(e.connection.runtime.contextEffect))))),wg=G(e=>Cg(e).fn(e=>Sg.use(t=>t.execute(e)),{concurrent:!0})),Tg=G(e=>Cg(e).fn(e=>Sg.use(e=>e.recover()),{concurrent:!0})),Eg=G(e=>Cg(e).fn(e=>Sg.use(e=>e.startNew())));function Dg(e,t){let n=wg(e),r=Tg(e),i=Eg(e),a=()=>{t.set(n,dr),t.set(r,dr)};return{run:W(`GitActions.run`)(function*(e,r){return t.set(n,{input:e,expected:r}),yield*Qa(t,n,{suspendOnWaiting:!0})}),recover:W(`GitActions.recover`)(function*(){return t.set(r,void 0),yield*Qa(t,r,{suspendOnWaiting:!0})}),startNew:W(`GitActions.startNew`)(function*(){t.set(i,void 0),(yield*Qa(t,i,{suspendOnWaiting:!0}))&&a()}),reset:a}}var Og=G(e=>La(H(function*(){return Dg(e,yield*Di)})));function kg(e,t,n){return{mode:e===`amend`?`amend`:`single`,message:e===`commit`?t:``,amendMessage:e===`amend`?t:n,excluded:new Set,added:new Set,groups:null}}function Ag(e,t,n=new Set){return t.some(t=>!n.has(t.path)&&e.files?.find(e=>e.path===t.path)?.fingerprint!==t.fingerprint)}function jg(e,t=[],n,r=t.length>0){let i=new Set(t);return{headOid:e.headOid??void 0,inProgress:e.inProgress??void 0,mergeHeadOid:e.mergeHeadOid??void 0,branch:e.branch?.name?.replace(/^refs\/heads\//,``)??void 0,...n===void 0?{}:{upstreamOid:n},...r?{files:(e.files??[]).flatMap(e=>i.has(e.path)&&e.fingerprint!==null&&e.fingerprint!==void 0?[{path:e.path,fingerprint:e.fingerprint}]:[])}:{}}}var Mg=e=>![`succeeded`,`no-change`].includes(e.state),Ng=e=>e.message??(e.reason?e.reason.replaceAll(`_`,` `).toLowerCase():`Git ${e.state}`),Pg=e=>e.state===`rejected`&&e.reason===`CHANGED_SINCE_LOOKED`;function Fg(e){return e instanceof Error?e.message:`Git could not complete this action. Check the current state and try again.`}var Ig=e=>t=>Y(()=>{ks(t)||e.setError(Cn(t))}),Lg=W(`CommitForm.generate`)(function*(e,t,n=e.paths){let{model:r,working:i,setBusy:a,setError:o,generator:s,status:c,setDrafted:l,setDone:u,setActiveGroup:d,setMessage:f,setGroups:p}=e;if(!r||!n.length||i)return;a(!0),o(null),yield*ho(()=>Y(()=>a(!1)));let m=yield*s.submit({mode:t,model:r,paths:n,expectedStatusToken:c.statusToken});l(t,m.expectedFiles),u(new Set),d(null),t===`message`?(f(m.groups[0]?.message??``),p(null)):p(m.groups.map(t=>({...t,id:e.createId()})))},ii,(e,t)=>e.pipe(di(Ig(t)))),Rg=W(`CommitForm.commit`)(function*(e){let{working:t,uncertain:n,setBusy:r,setError:i,currentMessage:a,mode:o,commitAction:s,model:c,paths:l,generator:u,status:d,setMessage:f,setDrafted:p,groups:m,done:h,ownHead:g,onBusy:_,setActiveGroup:v,git:y,setOwnHead:b,setDone:x}=e;if(t||n)return;r(!0),i(null),yield*ho(()=>Y(()=>r(!1)));let S=a;if(o!==`groups`&&!S.trim()){if(s===`amend`)return yield*U(new Ia(void 0,`Give the amended commit a message.`));if(!c||!l.length)return yield*U(new Ia(void 0,`Give every commit a message and at least one file.`));let e=yield*u.submit({mode:`message`,model:c,paths:l,expectedStatusToken:d.statusToken});if(S=e.groups[0]?.message??``,f(S),p(`message`,e.expectedFiles),Ag(d,e.expectedFiles))return}let C=s===`amend`?[{id:`single`,message:S,paths:l}]:o===`groups`&&m?m.filter(e=>!h.has(e.id)):[{id:`single`,message:S,paths:l}],w=g??d.headOid??null;_(!0),yield*ho(()=>Y(()=>_(!1)));for(let e of C){if(!e.message.trim()||s!==`amend`&&d.inProgress!==`merge`&&!e.paths.length)return yield*U(new Ia(void 0,`Give every commit a message and at least one file.`));v(e.id);let t=yield*y.run({action:s,message:e.message,paths:e.paths},jg({...d,headOid:w},d.inProgress===`merge`?d.files?.map(e=>e.path)??[]:e.paths,void 0,!0));if(Mg(t))return yield*U(new Ia(void 0,Ng(t)));t.result?.headOid&&(w=t.result.headOid,b(w)),x(t=>new Set([...t,e.id])),v(null)}},ii,(e,t)=>e.pipe(di(Ig(t)))),zg=W(`CommitForm.lookAgain`)(function*(e){let{onLookAgain:t,working:n,setBusy:r,setError:i,git:a,setOwnHead:o}=e;t&&!n&&(r(!0),i(null),yield*ho(()=>Y(()=>r(!1))),yield*t,yield*a.startNew(),o(null))},ii,(e,t)=>e.pipe(di(Ig(t)))),Bg=W(`CommitForm.recover`)(function*(e){let{setError:t,git:n,activeGroup:r,setDone:i,setActiveGroup:a}=e;t(null);let o=yield*n.recover();r&&[`succeeded`,`no-change`].includes(o.state)&&(i(e=>new Set([...e,r])),a(null))},(e,t)=>e.pipe(di(Ig(t))));function Vg(e){return{statusToken:e.statusToken,inProgress:e.inProgress,mergeHeadOid:e.mergeHeadOid,headOid:e.headOid,branch:e.branch,changes:e.changes.flatMap(e=>e.comparisons),files:e.changes.map(({path:e,fingerprint:t})=>({path:e,fingerprint:t}))}}function Hg(e,t){return e==null?t:t==null||t.name!==e.name||t.upstream!==e.upstream?e:{...t,name:e.name,upstream:e.upstream,ahead:e.ahead,behind:e.behind}}function Ug(e){return e.branch??null}function Wg(e){return e.changes.some(e=>e.scope===`unmerged`)}function Gg(e,t){let n=Ug(t);if(t.inProgress===`rebase`)return`Continue or abort the rebase in a terminal.`;if(t.inProgress===`merge`&&e!==`commit`)return`Finish or abort the merge first.`;if(t.inProgress===`merge`&&!t.mergeHeadOid)return`Finish this merge in a terminal.`;switch(e){case`commit`:return Wg(t)&&t.inProgress!==`merge`?`Resolve the conflicts before committing.`:null;case`amend`:return Wg(t)?`Resolve the conflicts before amending.`:t.headOid===null||t.headOid===void 0?`There is no commit to amend.`:null;case`push`:return n?n.name===null||n.name===void 0?`Detached HEAD: check out a branch before pushing.`:n.behind>0?`Pull the upstream changes before pushing.`:n.ahead>0||n.upstream===null||n.upstream===void 0?null:`No local commits to push.`:null;case`pull`:return n?.upstream===null||n?.upstream===void 0?`No upstream branch to pull from.`:t.changes.length?`Commit or stash local changes before pulling.`:n?.name===null?`Detached HEAD: check out a branch before pulling.`:null;case`fetch`:return n?.upstream===null||n?.upstream===void 0?`No upstream branch to fetch.`:null;case`stash-create`:return null;case`stash-apply`:case`stash-pop`:return n?.stashes&&n.stashes.length===0?`No stash is available.`:null;case`discard`:return null}}function Kg(e,t){let n=Ug(t);if(t.inProgress===`rebase`)return`Continue or abort the rebase in a terminal.`;if(t.inProgress===`merge`&&e!==`commit`)return`Finish or abort the merge first.`;switch(e){case`commit`:return t.changes.length?null:`Nothing to commit.`;case`amend`:return t.changes.length?`Choose which changed files to add to the last commit.`:`Change the last commit message.`;case`push`:return n==null?`Enter the configured remote and full branch ref.`:null;case`pull`:case`fetch`:return n==null?`Enter the configured remote and full branch ref.`:null;case`stash-create`:return t.changes.length===0?`Nothing changed; the server will report no change.`:null;case`stash-apply`:case`stash-pop`:return n?.stashes===null||n?.stashes===void 0?`Enter a full stash object ID.`:null;case`discard`:return null}}function qg(e,t){let n=Ug(t);return e.kind!==`run`||n==null?null:e.action===`pull`?n.behind:n.ahead}function Jg(e){if(e.inProgress===`rebase`||e.inProgress===`merge`&&!e.mergeHeadOid)return{kind:`hint`,label:`Git recovery`,hint:`Finish or abort this operation in a terminal.`};if(e.inProgress===`merge`||e.changes.length>0)return{kind:`commit`,label:`Commit`};let t=Ug(e);return t==null?{kind:`hint`,label:`Commit`,hint:`Nothing to commit. Choose a Git action to continue.`}:t.name===null||t.name===void 0?{kind:`hint`,label:`Commit`,hint:`Detached HEAD: check out a branch before pushing.`}:t.behind>0?{kind:`run`,action:`pull`,label:`Pull`}:t.ahead>0?{kind:`run`,action:`push`,label:`Push`}:(t.stashes?.length??0)>0?{kind:`stash`,label:`Apply stash`}:{kind:`hint`,label:`Commit`,hint:`Nothing to commit, pull or push.`}}var Yg=W(`GitActions.restoreStash`)(function*(e,t,n,r,i){let a=yield*e.run({action:`stash-apply`,...t},n).pipe(_(e=>Mg(e)?Ng(e):null),Oa(e=>fi(Fg(e))));r(a===null?{title:i.restored,type:`success`}:{title:i.failed,description:a,type:`error`})}),Xg=W(`Discard.restore`)(function*({what:e,readChanges:t,notify:n,dismissNotice:r,restore:i},a,o,s){let c=yield*t().pipe(_(Vg),Oa(t=>Y(()=>(n({title:`Could not restore ${e}`,description:Fg(t),type:`error`}),null))));if(!c)return;let l=c.files?.filter(e=>e.fingerprint!==null&&e.fingerprint!==void 0).map(e=>e.path)??[];r(s),yield*Yg(i,{stashOid:a,restoreIndex:o},jg(c,l,void 0,!0),n,{restored:`Restored ${e}`,failed:`Could not restore ${e}`})});function Zg(e,t){let{what:n,notify:r,close:i}=e;if(Mg(t))return{text:Ng(t),moved:Pg(t)};i();let a=t.result?.restoreStashOid;if(t.state===`no-change`)return r({title:`Nothing to discard`,description:`${n} already matches the last commit.`,type:`info`}),null;let o=t.result?.restoreIndex??!1,s=r({title:`Discarded ${n}`,type:`success`,timeout:e.restoreTimeoutMs,...a?{actionProps:{children:`Restore`,onClick:()=>e.run(Xg(e,a,o,s))}}:{}});return null}var Qg=W(`Discard.finish`)(function*(e,t){return Zg(t,yield*e)});function $g(e){return e===`fetch`||e===`pull`||e===`push`}function e_(e,t,n){return e?n&&(e.branch?.name!==t?.name||e.branch?.upstream!==t?.upstream)?{ready:!1,reason:`The branch target changed. Review it and try again.`}:{ready:!0,looked:e}:{ready:!1,reason:`The branch target is still loading. Try again.`}}function t_(e,t,n){if(!t?.name)throw Error(`Check out a branch before using the remote.`);let r=t.name.replace(/^refs\/heads\//,``);if(e===`fetch`||e===`pull`){if(!t?.upstream||!t.remoteName||!t.sourceRef)throw Error(`Configure an upstream branch first.`);if(`${t.remoteName}/${t.sourceRef.replace(/^refs\/heads\//,``)}`!==t.upstream)throw Error(`The configured upstream changed. Review it and try again.`);return e===`fetch`?{action:e,remoteName:t.remoteName,sourceRef:t.sourceRef}:{action:e,remoteName:t.remoteName,sourceRef:t.sourceRef,strategy:n}}let i=t.sourceRef??`refs/heads/${r}`;return{action:e,remoteName:t.remoteName??`origin`,destinationRef:i,allowCreate:t?.upstream===null||t?.upstream===void 0}}var n_=e=>e===`fetch`?`Fetch`:e===`pull`?`Pull`:`Push`,r_=e=>e===`fetch`?`Fetching`:e===`pull`?`Pulling`:`Pushing`,i_=(e,t)=>`${e} ${t}${e===1?``:`s`}`;function a_(e,t){if(e.kind===`hint`)return e.hint;if(e.kind===`commit`)return`Commit ${i_(t.changes.length,`changed file`)}`;let n=Ug(t);if(e.kind===`stash`){let e=n?.stashes?.[0]?.message;return e?`Apply the stash “${e}”`:`Apply the latest stash`}let r=n?.upstream??`the configured remote`;return e.action===`pull`?`Pull from ${r}`:`Push ${i_(n?.ahead??0,`commit`)} to ${r}`}var o_=W(`GitMenu.runNetwork`)(function*(e,t,n,r){let{details:i}=e,a=e.onResult,o=n_(n),s=R(i.result)?i.result.value:void 0,c=!s;c&&e.enableDetails();let l=e_(s??(yield*i.read()),r,c);if(!l.ready){a({title:`${o} did not run`,description:l.reason,type:`error`});return}let{looked:u}=l,d=t_(n,u.branch,e.pullStrategy),f=yield*Ra(Y(()=>e.onProgress(!0)),()=>t.run(d,jg(u,[],u.branch?.upstreamOid??null)),()=>Y(()=>e.onProgress(!1)));a({title:Mg(f)?`${o} did not run`:o,description:Ng(f),type:Mg(f)?`error`:`success`})},(e,t,n,r)=>e.pipe(Oa(e=>Y(()=>t.onResult({title:`${n_(r)} did not run`,description:Fg(e),type:`error`}))))),s_=W(`GitMenu.restoreDiscarded`)(function*(e,t,n){let{details:r,notify:i}=e,a=n.kind===`rename`?`rename of ${n.path}`:`hunk of ${n.path}`,o=Gi(la(r.result));(!o||kn(r.result))&&(e.enableDetails(),o=yield*r.read()),yield*Yg(t,{stashOid:n.oid,restoreIndex:n.kind===`rename`},jg(o,[n.path],void 0,!0),i,{restored:`Restored the discarded ${a}`,failed:`Could not restore the discarded ${a}`})},(e,t,n,r)=>e.pipe(Oa(e=>Y(()=>t.notify({title:`Could not restore the discarded ${r.kind===`rename`?`rename of ${r.path}`:`hunk of ${r.path}`}`,description:Fg(e),type:`error`}))))),c_=W(`GitActions.lookAgain`)(function*(e,t){yield*e,yield*t}),l_=W(`GitActions.refreshLook`)(function*(e,t){t(Vg(yield*e))});function u_(e){return qh.of({read:()=>_s(()=>{if(!e)throw Error(`Pair this environment again to identify its pending Git operations.`);return window.sessionStorage.getItem(e)}),write:t=>_s(()=>{if(!e)throw Error(`Pending Git operations require an identified connection.`);window.sessionStorage.setItem(e,t)}),clear:()=>_s(()=>{if(!e)throw Error(`Pending Git operations require an identified connection.`);window.sessionStorage.removeItem(e)})})}var d_=Fo(`@effect/platform-browser/Crypto/WebCrypto`,{defaultValue:()=>globalThis.crypto}),f_=dn(_p,H(function*(){let e=yield*d_;return e?vp({randomBytes:t=>{let n=new Uint8Array(t);for(let t=0;t<n.length;t+=65536)e.getRandomValues(n.subarray(t,t+65536));return n},digest:(t,n)=>typeof e.subtle?.digest==`function`?_(Xr({try:()=>e.subtle.digest(t,new Uint8Array(n)),catch:e=>Ks({module:`Crypto`,method:`digest`,_tag:`Unknown`,description:`Could not compute digest`,cause:e})}),e=>new Uint8Array(e)):U(Ks({module:`Crypto`,method:`digest`,_tag:`Unknown`,description:`crypto.subtle.digest is not available`}))}):yield*Cs(Error(`Web Crypto API is not available`))}));function p_(e){if(!e)throw Error(`A connected environment is required`);return e}var m_={name:()=>typeof navigator>`u`?`Browser`:navigator.userAgent.slice(0,120)||`Browser`,send:fetch,statusActivity:zh};function h_(e,t){return dg({environmentId:e,address:t.address,transport:t.transport,liveUpdates:t.liveUpdates,timeoutMs:et},In(f_,lo(qh,u_(t.operationsKey))),x_.memoMap)}function g_({inventory:e,principal:t}){let n=t.kind===`owner`?`owner`:t.deviceId,r=h_(e.environmentId,{address:window.location.href,transport:yh(fetch),liveUpdates:mg(),operationsKey:`porcelain-git-requests:${JSON.stringify([e.environmentId,t.kind,n])}`});return r.atoms.addGlobalLayer(lo($m,hs(e))),r}function __(e){return fg({...e,send:fetch,...m_.statusActivity?{activity:m_.statusActivity}:{},socket:pg,onStatusChange:()=>pm(m_,e),timeoutMs:et},In(f_,lo(qh,u_(Lp(e)?`porcelain-git-requests:${Lp(e)}`:void 0))),x_.memoMap)}var v_=In(Xp.layer,uh.layer).pipe(Se(lo(jp,Gh))),y_=Zn(v_,lo(Mp,m_),We.layer,lo(Zp,{local:e=>Po(Y(()=>g_(e)),e=>nr(()=>e.close()))}),lo(Qp,{open:e=>Po(Y(()=>__(e)),e=>nr(()=>e.close()))}),lo(dh,{forgetEnvironment:()=>B})),b_=tm.pipe(rt(Zn(ph.layer,$p.layer,em.layer).pipe(rt(y_)))),x_=_r(b_),S_=rr({memoMap:x_.memoMap})(b_),C_=x_.runSync(Xp),w_=x_.runSync($p),T_=x_.runSync(em),E_=S_.atom(H(function*(){yield*(yield*ph).read()}));function D_(){En(E_)}function O_(){return gs(C_.state)}function k_(){return gs(w_.state).connection}function A_(){return gs(T_.state)}function j_(e){let t=(0,$.c)(5),n=gs(T_.state),r;if(t[0]!==e||t[1]!==n){let i;t[3]===e?i=t[4]:(i=t=>t.remote.environmentId===e,t[3]=e,t[4]=i),r=n.find(i),t[0]=e,t[1]=n,t[2]=r}else r=t[2];return r}function M_(e){let t=(0,$.c)(6),n=k_();if(e){let n;return t[0]===e?n=t[1]:(n={connection:e},t[0]=e,t[1]=n),n}let r;t[2]===n?r=t[3]:(r=p_(n),t[2]=n,t[3]=r);let i;return t[4]===r?i=t[5]:(i={connection:r},t[4]=r,t[5]=i),i}var N_=Sm({transport:yh(fetch),platform:m_});function P_(e,t,n){return x_.runPromise(ch(e,N_,t,et),{signal:n})}var F_=G(e=>La(t=>{let n=()=>{window.location.hash&&e()};window.addEventListener(`hashchange`,n),t.addFinalizer(()=>window.removeEventListener(`hashchange`,n))})),I_=ih(yh(fetch,{reportUnauthorized:!1}));function L_(e){return x_.runPromise(lh(e,I_))}var R_=G(e=>S_.fn(e=>H(function*(){let t=yield*(yield*ph).pair({value:e,localEnvironmentId:w_.state.value.connection?.environmentId}).pipe(Mr(et));return pm(m_,t),t}))),z_=G(e=>S_.fn(t=>H(function*(){yield*(yield*ph).forget(e.environmentId)}))),B_=S_.fn(e=>H(function*(){yield*(yield*ph).read()})),V_=en(e=>Y(()=>{pm(m_,e)}));function H_(e){let t=(0,$.c)(12),[n]=(0,Z.useState)(Symbol),r;t[0]===n?r=t[1]:(r=R_(n),t[0]=n,t[1]=r);let i=r,a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a={mode:`promiseExit`},t[2]=a):a=t[2];let[o,s]=Ts(i,a),c=D(i),l;t[3]!==e||t[4]!==s?(l=async t=>{let n=await s(t);Fi(n)&&e()},t[3]=e,t[4]=s,t[5]=l):l=t[5];let u;t[6]===c?u=t[7]:(u=()=>c(dr),t[6]=c,t[7]=u);let d;return t[8]!==o||t[9]!==l||t[10]!==u?(d={result:o,submit:l,reset:u},t[8]=o,t[9]=l,t[10]=u,t[11]=d):d=t[11],d}function U_(e,t){let n=(0,$.c)(9),r;n[0]===e?r=n[1]:(r=z_(e),n[0]=e,n[1]=r);let i;n[2]===Symbol.for(`react.memo_cache_sentinel`)?(i={mode:`promiseExit`},n[2]=i):i=n[2];let[a,o]=Ts(r,i),s;n[3]!==t||n[4]!==o?(s=async()=>{let e=await o(void 0);Fi(e)&&t()},n[3]=t,n[4]=o,n[5]=s):s=n[5];let c;return n[6]!==a||n[7]!==s?(c={result:a,submit:s},n[6]=a,n[7]=s,n[8]=c):c=n[8],c}function W_(){return D(V_)}function G_(){let e=(0,$.c)(5),[t,n]=Ts(B_),r;e[0]===n?r=e[1]:(r=()=>n(void 0),e[0]=n,e[1]=r);let i;return e[2]!==t||e[3]!==r?(i={result:t,read:r},e[2]=t,e[3]=r,e[4]=i):i=e[4],i}var K_=La(e=>{e.addFinalizer(_h(()=>{x_.runFork(w_.clear())}))});function q_(){return Yr(K_),vh}function J_(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=_m(m_,e),t[0]=e,t[1]=n);let r=En(n),i;return t[2]!==e||t[3]!==r?(i=dm(e,r),t[2]=e,t[3]=r,t[4]=i):i=t[4],i}var Y_=yo(`group/alert relative grid w-full gap-0.5 rounded-2xl border px-4 py-3 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2.5 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-card text-card-foreground`,destructive:`bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current`}},defaultVariants:{variant:`default`}});function X_({className:e,variant:t,...n}){return(0,Q.jsx)(`div`,{"data-slot":`alert`,role:`alert`,className:K(Y_({variant:t}),e),...n})}function Z_({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`alert-title`,className:K(`font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground`,e),...t})}function Q_({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`alert-description`,className:K(`text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4`,e),...t})}function $_({className:e,...t}){return(0,Q.jsx)(on,{"data-slot":`spinner`,role:`status`,"aria-label":`Loading`,className:K(`size-4 animate-spin`,e),...t})}var ev=G(e=>S_.fn((t,n)=>H(function*(){yield*n.setResult(sh(e),void 0),yield*(yield*$p).clear()})));function tv(e){let t=(0,$.c)(8),n;t[0]===e?n=t[1]:(n=ev(e),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r={mode:`promiseExit`},t[2]=r):r=t[2];let[i,a]=Ts(n,r),o;t[3]===a?o=t[4]:(o=()=>{a()},t[3]=a,t[4]=o);let s;return t[5]!==i||t[6]!==o?(s={result:i,submit:o},t[5]=i,t[6]=o,t[7]=s):s=t[7],s}function nv(){let e=(0,$.c)(12),{connection:t}=M_(),{result:n,submit:r}=tv(t),i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium`,children:`This browser`}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Ends its session here. Pair it again with a new link.`})]}),e[0]=i):i=e[0];let a;e[1]===n.waiting?a=e[2]:(a=n.waiting?(0,Q.jsx)($_,{}):(0,Q.jsx)(Uf,{}),e[1]=n.waiting,e[2]=a);let o;e[3]!==n.waiting||e[4]!==r||e[5]!==a?(o=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-6`,children:[i,(0,Q.jsxs)(Ro,{variant:`outline`,className:`shrink-0`,disabled:n.waiting,onClick:r,children:[a,`Disconnect this browser`]})]}),e[3]=n.waiting,e[4]=r,e[5]=a,e[6]=o):o=e[6];let s;e[7]===n?s=e[8]:(s=kn(n)&&(0,Q.jsx)(X_,{variant:`destructive`,children:(0,Q.jsx)(Q_,{children:oh(Cn(n.cause))})}),e[7]=n,e[8]=s);let c;return e[9]!==o||e[10]!==s?(c=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[o,s]}),e[9]=o,e[10]=s,e[11]=c):c=e[11],c}function rv(e){let t=(0,$.c)(3),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(`div`,{className:`absolute right-4 top-3`,children:(0,Q.jsx)(`h1`,{className:`font-medium`,children:`Porcelain`})}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,Q.jsxs)(Q.Fragment,{children:[r,(0,Q.jsx)(`main`,{className:`mx-auto flex min-h-svh max-w-6xl flex-col items-start gap-6 px-6 py-24`,children:n})]}),t[1]=n,t[2]=i),i}function iv(){return typeof window>`u`?`http://127.0.0.1:3000`:window.location.origin}function av(e){let t=(0,$.c)(9),{reason:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h2`,{className:`text-lg font-medium`,children:`This browser is not paired`}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Run this on the machine hosting Porcelain, then open the link it prints on this device.`})]}),t[0]=r):r=t[0];let i;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(`pre`,{className:`overflow-x-auto rounded-md border bg-muted p-3 text-sm`,children:(0,Q.jsx)(`code`,{children:`porcelain pair "This browser" --address ${iv()}`})}),t[1]=i):i=t[1];let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(`code`,{children:`porcelain devices`}),t[2]=a):a=t[2];let o,s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`The link works once and expires. Revoke this device at any time with`,` `,a,` and `,(0,Q.jsx)(`code`,{children:`porcelain revoke`}),`.`]}),s=!1,t[3]=o,t[4]=s):(o=t[3],s=t[4]);let c;t[5]===n?c=t[6]:(c=n&&(0,Q.jsx)(X_,{variant:`destructive`,children:(0,Q.jsx)(Q_,{children:n})}),t[5]=n,t[6]=c);let l;return t[7]===c?l=t[8]:(l=(0,Q.jsxs)(`section`,{className:`mx-auto flex w-full max-w-md flex-col gap-6`,children:[r,i,o,s,c]}),t[7]=c,t[8]=l),l}function ov(e){let t=(0,$.c)(2),{reason:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(rv,{children:n?(0,Q.jsx)(av,{reason:n}):(0,Q.jsxs)(`section`,{className:`mx-auto flex w-full max-w-md flex-col gap-2`,children:[(0,Q.jsx)(`h2`,{className:`text-lg font-medium`,children:`Pairing this browser…`}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Checking that the link belongs to this Porcelain installation.`})]})}),t[0]=n,t[1]=r),r}function sv(e){let t=(0,$.c)(3),n;t[0]===e?n=t[1]:(n=qm(e),t[0]=e,t[1]=n);let r;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r={mode:`promise`},t[2]=r):r=t[2],Ts(n,r)}function cv(e,t){let n=(0,$.c)(3),r;return n[0]!==e||n[1]!==t?(r=Jm({connection:e,id:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2],Ts(r)}function lv(e,t){let n=(0,$.c)(3),r;return n[0]!==e||n[1]!==t?(r=Ym({connection:e,id:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2],Ts(r)}function uv(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=Xm(e),t[0]=e,t[1]=n),Ts(n)}function dv(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=Zm(e),t[0]=e,t[1]=n),Ts(n)}function fv(e){let t=(0,$.c)(3),n;t[0]===e?n=t[1]:(n=nh(e),t[0]=e,t[1]=n);let r;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r={mode:`promise`},t[2]=r):r=t[2],Ts(n,r)}function pv(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=Vm(e),t[0]=e,t[1]=n),En(n)}function mv(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=Hm(e),t[0]=e,t[1]=n),En(n)}function hv(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=Um(e),t[0]=e,t[1]=n),En(n)}function gv(e){return e.kind===`local`?`Only a browser on the computer that runs Porcelain, or a device its owner trusts, can update it.`:e.deviceId?`Trust this app on ${e.name} to update it from here: run porcelain trust ${e.deviceId} there.`:`Trust this app on ${e.name} to update it from here: run porcelain devices there, then porcelain trust with this app's id.`}function _v(e){let t=(0,$.c)(17),{state:n,started:r}=e,i;t[0]===n?i=t[1]:(i=Vh(n),t[0]=n,t[1]=i);let a=i;if(a?.kind===`updated`){let e=`Updated from ${a.from} to ${a.target}.${r?` Reload to use the new version here.`:``}`,n;t[2]===e?n=t[3]:(n=(0,Q.jsx)(X_,{className:`min-w-0 flex-1`,children:(0,Q.jsx)(Q_,{children:e})}),t[2]=e,t[3]=n);let i;t[4]===r?i=t[5]:(i=r&&(0,Q.jsx)(Ro,{size:`sm`,variant:`outline`,onClick:vv,children:`Reload`}),t[4]=r,t[5]=i);let o;return t[6]!==n||t[7]!==i?(o=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[n,i]}),t[6]=n,t[7]=i,t[8]=o):o=t[8],o}if(a?.kind===`failed`){let e=n.version??`the version it had`,r;t[9]!==a.target||t[10]!==e?(r=(0,Q.jsxs)(`p`,{children:[`The update to `,a.target,` failed, so Porcelain still runs`,` `,e,`.`]}),t[9]=a.target,t[10]=e,t[11]=r):r=t[11];let i;t[12]===a.reason?i=t[13]:(i=(0,Q.jsx)(`p`,{children:a.reason}),t[12]=a.reason,t[13]=i);let o;return t[14]!==r||t[15]!==i?(o=(0,Q.jsx)(X_,{variant:`destructive`,children:(0,Q.jsxs)(Q_,{children:[r,i]})}),t[14]=r,t[15]=i,t[16]=o):o=t[16],o}return null}function vv(){return window.location.reload()}function yv(e){let t=(0,$.c)(22),{connection:n,target:r,state:i,onStart:a}=e,[o,s]=dv(n),{latest:c}=i;if(!i.available||c==null){let e=c==null?`Could not check for a newer version.`:`This is the newest version.`,n;return t[0]===e?n=t[1]:(n=(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e}),t[0]=e,t[1]=n),n}let l;t[2]===c?l=t[3]:(l=(0,Q.jsxs)(`p`,{className:`text-sm`,children:[`Porcelain `,c,` is available.`]}),t[2]=c,t[3]=l);let u;t[4]!==c||t[5]!==a||t[6]!==o||t[7]!==s||t[8]!==i.canUpdate?(u=i.canUpdate&&(0,Q.jsxs)(Ro,{size:`sm`,disabled:o.waiting,onClick:()=>{a(),s(c)},children:[o.waiting&&(0,Q.jsx)($_,{}),`Update to `,c]}),t[4]=c,t[5]=a,t[6]=o,t[7]=s,t[8]=i.canUpdate,t[9]=u):u=t[9];let d;t[10]!==l||t[11]!==u?(d=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[l,u]}),t[10]=l,t[11]=u,t[12]=d):d=t[12];let f;t[13]!==i.canUpdate||t[14]!==r?(f=!i.canUpdate&&(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:gv(r)}),t[13]=i.canUpdate,t[14]=r,t[15]=f):f=t[15];let p;t[16]===o?p=t[17]:(p=kn(o)&&(0,Q.jsx)(X_,{variant:`destructive`,children:(0,Q.jsx)(Q_,{children:oh(Cn(o.cause))})}),t[16]=o,t[17]=p);let m;return t[18]!==d||t[19]!==f||t[20]!==p?(m=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[d,f,p]}),t[18]=d,t[19]=f,t[20]=p,t[21]=m):m=t[21],m}function bv(e){let t=(0,$.c)(15),{connection:n,target:r,state:i,progress:a,started:o,onStart:s}=e;if(!i.managed){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`This server runs outside the installed service. Update it with npm, then run porcelain service update.`}),t[0]=e):e=t[0],e}if(a){let e;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)($_,{}),t[1]=e):e=t[1];let n;return t[2]===a?n=t[3]:(n=(0,Q.jsxs)(`div`,{"aria-live":`polite`,className:`flex items-center gap-2 text-sm`,children:[e,(0,Q.jsx)(`p`,{children:a})]}),t[2]=a,t[3]=n),n}let c;t[4]!==o||t[5]!==i?(c=(0,Q.jsx)(_v,{state:i,started:o}),t[4]=o,t[5]=i,t[6]=c):c=t[6];let l;t[7]!==n||t[8]!==s||t[9]!==i||t[10]!==r?(l=(0,Q.jsx)(yv,{connection:n,target:r,state:i,onStart:s}),t[7]=n,t[8]=s,t[9]=i,t[10]=r,t[11]=l):l=t[11];let u;return t[12]!==c||t[13]!==l?(u=(0,Q.jsxs)(Q.Fragment,{children:[c,l]}),t[12]=c,t[13]=l,t[14]=u):u=t[14],u}function xv(e){let t=(0,$.c)(16),{connection:n,target:r}=e,i=hv(n),[a,o]=(0,Z.useState)(!1),s,c,l;if(t[0]!==i){l=Symbol.for(`react.early_return_sentinel`);bb0:{if(s=Gi(la(i)),!s){l=kn(i)?(0,Q.jsx)(X_,{variant:`destructive`,children:(0,Q.jsx)(Q_,{children:oh(Cn(i.cause))})}):(0,Q.jsx)($_,{});break bb0}c=Bh(s,kn(i))}t[0]=i,t[1]=s,t[2]=c,t[3]=l}else s=t[1],c=t[2],l=t[3];if(l!==Symbol.for(`react.early_return_sentinel`))return l;let u=c,d=s.version??`development build`,f;t[4]===d?f=t[5]:(f=(0,Q.jsxs)(`p`,{className:`text-sm font-medium`,children:[`Porcelain `,d]}),t[4]=d,t[5]=f);let p=a&&r.kind===`local`,m;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>o(!0),t[6]=m):m=t[6];let h;t[7]!==n||t[8]!==u||t[9]!==s||t[10]!==p||t[11]!==r?(h=(0,Q.jsx)(bv,{connection:n,target:r,state:s,progress:u,started:p,onStart:m}),t[7]=n,t[8]=u,t[9]=s,t[10]=p,t[11]=r,t[12]=h):h=t[12];let g;return t[13]!==f||t[14]!==h?(g=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[f,h]}),t[13]=f,t[14]=h,t[15]=g):g=t[15],g}function Sv(){let e=(0,$.c)(2),t=k_(),n;return e[0]===t?n=e[1]:(n=t&&(0,Q.jsx)(xv,{connection:t,target:{kind:`local`}}),e[0]=t,e[1]=n),n}function Cv(e){let t=(0,$.c)(6),{connection:n,name:r,deviceId:i}=e,a;t[0]!==i||t[1]!==r?(a={kind:`remote`,name:r,deviceId:i},t[0]=i,t[1]=r,t[2]=a):a=t[2];let o;return t[3]!==n||t[4]!==a?(o=(0,Q.jsx)(xv,{connection:n,target:a}),t[3]=n,t[4]=a,t[5]=o):o=t[5],o}function wv({className:e,...t}){return(0,Q.jsx)(`label`,{"data-slot":`label`,className:K(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function Tv({className:e,...t}){return(0,Q.jsx)(`fieldset`,{"data-slot":`field-set`,className:K(`flex flex-col gap-6 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3`,e),...t})}function Ev({className:e,variant:t=`legend`,...n}){return(0,Q.jsx)(`legend`,{"data-slot":`field-legend`,"data-variant":t,className:K(`mb-3 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base`,e),...n})}function Dv({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`field-group`,className:K(`group/field-group @container/field-group flex w-full flex-col gap-6 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,e),...t})}var Ov=yo(`group/field flex w-full gap-3 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:`flex-col *:w-full [&>.sr-only]:w-auto`,horizontal:`flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`,responsive:`flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`}},defaultVariants:{orientation:`vertical`}});function kv({className:e,orientation:t=`vertical`,...n}){return(0,Q.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":t,className:K(Ov({orientation:t}),e),...n})}function Av({className:e,...t}){return(0,Q.jsx)(wv,{"data-slot":`field-label`,className:K(`group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:bg-input/30 has-[>[data-slot=field]]:rounded-2xl has-[>[data-slot=field]]:border has-[>[data-slot=field]]:not-has-[:disabled,[data-disabled]]:hover:bg-input/40 has-[>[data-slot=field]]:has-[:focus-visible]:border-ring has-[>[data-slot=field]]:has-[:focus-visible]:ring-3 has-[>[data-slot=field]]:has-[:focus-visible]:ring-ring/50 *:data-[slot=field]:p-4`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col`,e),...t})}function jv({className:e,...t}){return(0,Q.jsx)(`p`,{"data-slot":`field-description`,className:K(`text-left text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5`,`last:mt-0 nth-last-2:-mt-1`,`[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...t})}function Mv({className:e,children:t,errors:n,...r}){let i=(0,Z.useMemo)(()=>{if(t)return t;if(!n?.length)return null;let e=[...new Map(n.map(e=>[e?.message,e])).values()];return e?.length==1?e[0]?.message:(0,Q.jsx)(`ul`,{className:`ml-4 flex list-disc flex-col gap-1`,children:e.map((e,t)=>e?.message&&(0,Q.jsx)(`li`,{children:e.message},t))})},[t,n]);return i?(0,Q.jsx)(`div`,{role:`alert`,"data-slot":`field-error`,className:K(`text-sm font-normal text-destructive`,e),...r,children:i}):null}function Nv(e){return Me(e.defaultTagName??`div`,e,e)}function Pv({className:e,...t}){return(0,Q.jsx)(`div`,{role:`list`,"data-slot":`item-group`,className:K(`group/item-group flex w-full flex-col gap-4 has-data-[size=sm]:gap-2.5 has-data-[size=xs]:gap-2`,e),...t})}var Fv=yo(`group/item flex w-full flex-wrap items-center rounded-2xl border text-sm transition-colors duration-100 outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 [a]:transition-colors [a]:hover:bg-muted`,{variants:{variant:{default:`border-transparent`,outline:`border-border`,muted:`border-transparent bg-muted/50`},size:{default:`gap-3.5 px-4 py-3.5`,sm:`gap-3.5 px-3.5 py-3`,xs:`gap-2 px-2.5 py-2 in-data-[slot=dropdown-menu-content]:p-0`}},defaultVariants:{variant:`default`,size:`default`}});function Iv({className:e,variant:t=`default`,size:n=`default`,render:r,...i}){return Nv({defaultTagName:`div`,props:Ln({className:K(Fv({variant:t,size:n,className:e}))},i),render:r,state:{slot:`item`,variant:t,size:n}})}var Lv=yo(`flex shrink-0 items-center justify-center gap-2 group-has-data-[slot=item-description]/item:translate-y-0.5 group-has-data-[slot=item-description]/item:self-start [&_svg]:pointer-events-none`,{variants:{variant:{default:`bg-transparent`,icon:`[&_svg:not([class*='size-'])]:size-4`,image:`size-10 overflow-hidden rounded-xl group-data-[size=sm]/item:size-8 group-data-[size=xs]/item:size-6 group-data-[size=xs]/item:rounded-lg [&_img]:size-full [&_img]:object-cover`}},defaultVariants:{variant:`default`}});function Rv({className:e,variant:t=`default`,...n}){return(0,Q.jsx)(`div`,{"data-slot":`item-media`,"data-variant":t,className:K(Lv({variant:t,className:e})),...n})}function zv({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`item-content`,className:K(`flex flex-1 flex-col gap-1 group-data-[size=xs]/item:gap-0.5 [&+[data-slot=item-content]]:flex-none`,e),...t})}function Bv({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`item-title`,className:K(`line-clamp-1 flex w-fit items-center gap-2 text-sm leading-snug font-medium underline-offset-4`,e),...t})}function Vv({className:e,...t}){return(0,Q.jsx)(`p`,{"data-slot":`item-description`,className:K(`line-clamp-2 text-left text-sm font-normal text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...t})}function Hv({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`item-actions`,className:K(`flex items-center gap-2`,e),...t})}function Uv({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`item-footer`,className:K(`flex basis-full items-center justify-between gap-2`,e),...t})}var Wv=To(Mt.layer),Gv=Wv.atom(H(function*(){let e=yield*Mt;return{isDesktopShell:e.isDesktopShell,hasAppUpdateFeed:e.hasAppUpdateFeed}})),Kv=Wv.atom(H(function*(){return yield*(yield*Mt).checkUpdate})).pipe(gi),qv=Wv.atom(ye(H(function*(){return(yield*Mt).updateStates}))).pipe(ti(0));function Jv(){let e=(0,$.c)(3),t=En(Kv),n=vn(Kv),r;return e[0]!==t||e[1]!==n?(r={result:t,check:n},e[0]=t,e[1]=n,e[2]=r):r=e[2],r}function Yv(){let e=(0,$.c)(2),t=En(qv),n;return e[0]===t?n=e[1]:(n=eo(la(t),Xv),e[0]=t,e[1]=n),n}function Xv(){return{status:`idle`}}function Zv(){return En(Gv)}var Qv=`data-valid`,$v=`data-invalid`,ey={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},ty={disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},ny={valid(e){return e===null?null:e?{[Qv]:``}:{[$v]:``}}},ry={invalid:void 0,name:void 0,validityData:{state:ey,errors:[],error:``,value:``,initialValue:null},setValidityData:es,disabled:void 0,setTouched:es,setDirty:es,setFilled:es,setFocused:es,validationMode:`onSubmit`,shouldValidateOnChange:()=>!1,state:ty,registerFieldControl:es,validation:{getValidationProps:(e,t=jr)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:es,getInputControl:()=>null,commit:async()=>{},change:es}},iy=Z.createContext(ry);function ay(e=!0){let t=Z.useContext(iy);if(t.setValidityData===es&&!e)throw Error(Ai(28));return t}var oy=Z.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:es,validationMode:`onSubmit`,submitCountRef:{current:0}});function sy(){return Z.useContext(oy)}var cy=Z.createContext({controlId:void 0,registerControlId:es,resetControlId:es,labelId:void 0,setLabelId:es,messageIds:[],setMessageIds:es,getDescriptionProps:e=>e});function ly(){return Z.useContext(cy)}function uy(e,t,n,r=!0,i){let[a,o]=Z.useState(),s=Wf(i?`${i}-label`:void 0),c=e??t??a;return J(()=>{let i=e||t||!r?void 0:dy(n.current,s);a!==i&&o(i)}),c}function dy(e,t){let n=fy(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function fy(e){if(!e)return;let t=e.parentElement;if(t&&t.tagName===`LABEL`)return t;let n=e.id;if(n){let t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}let r=e.labels;return r&&r[0]}function py(e={}){let{id:t,enabled:n=!0}=e,{controlId:r,registerControlId:i,resetControlId:a}=ly(),o=Wf(),s=ka(()=>Symbol()),c=Z.useRef(!1),l=Z.useRef(!1),u=q(()=>{c.current&&i!==es&&(c.current=!1,i(s.current,void 0))});return J(()=>{if(!n||i===es){u();return}let e;if(t!==void 0)l.current=!0,e=t;else if(l.current)e=o;else{a();return}if(e===void 0){u();return}c.current=!0,i(s.current,e)},[t,n,i,a,o,s,u]),J(()=>u,[u]),(n?r:void 0)??t??o}function my({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=Z.useRef(e!==void 0),[a,o]=Z.useState(t);return[i&&e!==void 0?e:a,Z.useCallback(e=>{i||o(e)},[])]}function hy(e,t,n,r,i=!0,a){let{registerFieldControl:o}=ay(),s=ka(()=>Symbol());J(()=>{let c=s.current;if(!i){o(c,void 0);return}o(c,{controlRef:e,getValue:r,id:t,name:a,value:n})},[e,i,r,t,a,o,s,n]),J(()=>{let e=s.current;return()=>{o(e,void 0)}},[o,s])}function gy(e,t){let n=Z.useRef(e),r=q(t);J(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}var _y=Z.forwardRef(function(e,t){let{render:n,className:r,id:i,name:a,value:o,disabled:s=!1,onValueChange:c,defaultValue:l,autoFocus:u=!1,style:d,...f}=e,{state:p,name:m,disabled:h,setTouched:g,setDirty:_,validityData:v,setFocused:y,setFilled:b,validationMode:x,validation:S}=ay(),{clearErrors:C,elementRef:w,submitCountRef:T}=sy(),E=h||s,D=m??a,O={...p,disabled:E},{labelId:k}=ly(),A=py({id:i}),[j]=my({controlled:o,default:l,name:`FieldControl`,state:`value`}),M=o!==void 0,N=M?j:void 0,P=N==null?void 0:String(N),F=q(()=>S.inputRef.current?.value);hy(S.inputRef,A,P,F,!E,a),J(()=>{let e=P??S.inputRef.current?.value;e!==void 0&&b(e!==``)},[P,S.inputRef,b]),gy(P,()=>{P!==void 0&&(C(D),_(P!==(v.initialValue??``)),S.change(P))});let I=Z.useRef(null),L=mn();return J(()=>{u&&I.current===zt(Pe(I.current))&&y(!0)},[u,y]),Me(`input`,e,{ref:[t,I],state:O,props:[{id:A,disabled:E,name:D,ref:S.inputRef,"aria-labelledby":k,autoFocus:u,...M?{value:N}:{defaultValue:l},onChange(e){let t=e.currentTarget.value,n=Ca(Zr,e.nativeEvent);c?.(t,n),!M&&(_(t!==(v.initialValue??``)),b(t!==``),!e.nativeEvent.defaultPrevented&&!n.isCanceled&&(C(D),S.change(t)))},onFocus(){y(!0)},onBlur(e){if(g(!0),y(!1),x===`onBlur`){let t=e.currentTarget.value;S.commit(t),M&&queueMicrotask(()=>{let e=S.inputRef.current?.value;e!==void 0&&e!==t&&e!==(v.initialValue??``)&&S.commit(e)})}},onKeyDown(e){if(e.currentTarget.tagName===`INPUT`&&e.key===`Enter`){g(!0);let t=e.currentTarget.value,n=e.currentTarget.form;if(n&&n===w.current&&!e.defaultPrevented){let t=e.currentTarget,n=T.current;L.start(0,()=>{T.current===n&&S.commit(t.value)})}else S.commit(t)}}},f,e=>S.getValidationProps(E,e)],stateAttributesMapping:ny})}),vy=Z.forwardRef(function(e,t){return(0,Q.jsx)(_y,{ref:t,...e})});function yy({className:e,type:t,...n}){return(0,Q.jsx)(vy,{type:t,"data-slot":`input`,className:K(`h-8 w-full min-w-0 rounded-2xl border border-transparent bg-input/50 px-2.5 py-1 text-base transition-[color,box-shadow] duration-200 outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...n})}function by(e){e.catch(()=>void 0)}function xy(e,t){e.preventDefault(),by(t())}function Sy(e){let t=(0,$.c)(25),{connection:n,environment:r}=e,[i,a]=(0,Z.useState)(null),[o,s]=fv(n),c=i??(r.custom?r.name:``),l;t[0]===c?l=t[1]:(l=c.trim(),t[0]=c,t[1]=l);let u=l,d=r.custom?u===r.name:u===``,f;t[2]!==u||t[3]!==s?(f=e=>xy(e,async()=>s(u===``?null:u)),t[2]=u,t[3]=s,t[4]=f):f=t[4];let p;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(wv,{htmlFor:`environment-name`,children:`Name of this computer`}),t[5]=p):p=t[5];let m=r.custom?`Host name`:r.name,h;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(h=e=>a(e.target.value),t[6]=h):h=t[6];let g;t[7]!==m||t[8]!==c?(g=(0,Q.jsx)(yy,{id:`environment-name`,className:`min-w-0 flex-1`,placeholder:m,maxLength:Vn,value:c,onChange:h}),t[7]=m,t[8]=c,t[9]=g):g=t[9];let _=d||o.waiting,v=o.waiting?`Saving…`:`Save`,y;t[10]!==_||t[11]!==v?(y=(0,Q.jsx)(Ro,{type:`submit`,variant:`outline`,disabled:_,children:v}),t[10]=_,t[11]=v,t[12]=y):y=t[12];let b;t[13]!==g||t[14]!==y?(b=(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[g,y]}),t[13]=g,t[14]=y,t[15]=b):b=t[15];let x;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Q.jsx)(jv,{children:`Paired devices show it so you know where they are connected. Leave it empty to use the host name.`}),t[16]=x):x=t[16];let S;t[17]===b?S=t[18]:(S=(0,Q.jsxs)(kv,{children:[p,b,x]}),t[17]=b,t[18]=S);let C;t[19]===o?C=t[20]:(C=kn(o)&&(0,Q.jsx)(X_,{variant:`destructive`,children:(0,Q.jsx)(Q_,{children:oh(Cn(o.cause))})}),t[19]=o,t[20]=C);let w;return t[21]!==S||t[22]!==C||t[23]!==f?(w=(0,Q.jsxs)(`form`,{className:`flex flex-col gap-2`,onSubmit:f,children:[S,C]}),t[21]=S,t[22]=C,t[23]=f,t[24]=w):w=t[24],w}var Cy=To(Mt.layer).fn(e=>H(function*(){yield*(yield*Mt).installUpdate}));function wy(){let e=(0,$.c)(5),[t,n]=Ts(Cy),r;e[0]===n?r=e[1]:(r=()=>n(void 0),e[0]=n,e[1]=r);let i;return e[2]!==t||e[3]!==r?(i={result:t,install:r},e[2]=t,e[3]=r,e[4]=i):i=e[4],i}function Ty(e){switch(e.status){case`checking`:return`Checking for a new version…`;case`downloading`:return`Downloading ${e.version}…`;case`ready`:return`${e.version} is ready; the app restarts to finish.`;case`installing`:return`Installing ${e.version}; the app restarts in a moment.`;default:return}}function Ey(e){return e.status===`unavailable`?`This build updates by reinstalling; there is no update feed yet.`:`This is the newest version of the app.`}function Dy(e){return e.isDesktopShell&&e.hasAppUpdateFeed}function Oy(){let e=(0,$.c)(24),{result:t,check:n}=Jv(),r=wy(),i=Yv(),a=Gi(la(Zv())),o;e[0]===t?o=e[1]:(o=Gi(ki(la(t))),e[0]=t,e[1]=o);let s=o;if(!s){let n;return e[2]===t?n=e[3]:(n=oe(t)?(0,Q.jsx)($_,{}):null,e[2]=t,e[3]=n),n}let c;e[4]===i?c=e[5]:(c=Ty(i),e[4]=i,e[5]=c);let l=c,u;e[6]!==r.result||e[7]!==i||e[8]!==t?(u=Ay(i,t,r.result),e[6]=r.result,e[7]=i,e[8]=t,e[9]=u):u=e[9];let d=u,f;e[10]===s.current?f=e[11]:(f=(0,Q.jsxs)(`p`,{className:`text-sm font-medium`,children:[`Porcelain app `,s.current]}),e[10]=s.current,e[11]=f);let p;e[12]!==r||e[13]!==l||e[14]!==i||e[15]!==t?(p=(0,Q.jsx)(ky,{progress:l,state:i,update:t,install:r}),e[12]=r,e[13]=l,e[14]=i,e[15]=t,e[16]=p):p=e[16];let m=a&&Dy(a)&&(0,Q.jsx)(Ro,{size:`sm`,variant:`outline`,className:`self-start`,disabled:t.waiting||l!==void 0,onClick:n,children:`Check for updates`}),h;e[17]===d?h=e[18]:(h=d!==void 0&&(0,Q.jsx)(X_,{variant:`destructive`,children:(0,Q.jsx)(Q_,{children:d})}),e[17]=d,e[18]=h);let g;return e[19]!==f||e[20]!==p||e[21]!==m||e[22]!==h?(g=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[f,p,m,h]}),e[19]=f,e[20]=p,e[21]=m,e[22]=h,e[23]=g):g=e[23],g}function ky(e){let t=(0,$.c)(18),{progress:n,state:r,update:i,install:a}=e;if(n){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)($_,{}),t[0]=e):e=t[0];let r;return t[1]===n?r=t[2]:(r=(0,Q.jsxs)(`div`,{"aria-live":`polite`,className:`flex items-center gap-2 text-sm`,children:[e,(0,Q.jsx)(`p`,{children:n})]}),t[1]=n,t[2]=r),r}if(r.status===`available`){let e;t[3]===r.version?e=t[4]:(e=(0,Q.jsxs)(`p`,{className:`text-sm`,children:[`Porcelain app `,r.version,` is available.`]}),t[3]=r.version,t[4]=e);let n=i.waiting||a.result.waiting,o;t[5]===a?o=t[6]:(o=()=>a.install(),t[5]=a,t[6]=o);let s;t[7]!==r.version||t[8]!==n||t[9]!==o?(s=(0,Q.jsxs)(Ro,{size:`sm`,disabled:n,onClick:o,children:[`Update to `,r.version]}),t[7]=r.version,t[8]=n,t[9]=o,t[10]=s):s=t[10];let c;return t[11]!==e||t[12]!==s?(c=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[e,s]}),t[11]=e,t[12]=s,t[13]=c):c=t[13],c}if(r.status===`error`||kn(i))return null;let o;t[14]===r?o=t[15]:(o=Ey(r),t[14]=r,t[15]=o);let s;return t[16]===o?s=t[17]:(s=(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o}),t[16]=o,t[17]=s),s}function Ay(e,t,n){if(e.status===`error`)return e.message;if(kn(t)&&!t.waiting)return oh(Cn(t.cause));if(kn(n))return oh(Cn(n.cause))}var jy=Z.createContext(void 0);function My(){let e=Z.useContext(jy);if(e===void 0)throw Error(Ai(63));return e}var Ny=`data-checked`,Py=`data-unchecked`,Fy={...ny,checked(e){return e?{[Ny]:``}:{[Py]:``}}},Iy=Z.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i,"aria-labelledby":a,form:o,id:s,inputRef:c,name:l,nativeButton:u=!1,onCheckedChange:d,readOnly:f=!1,required:p=!1,disabled:m=!1,render:h,uncheckedValue:g,value:_,style:v,...y}=e,{clearErrors:b}=sy(),{state:x,setTouched:S,setDirty:C,validityData:w,setFilled:T,setFocused:E,validationMode:D,disabled:O,name:k,validation:A}=ay(),{labelId:j}=ly(),M=O||m,N=k??l,P=Z.useRef(null),F=Ce(P,c,A.inputRef),I=Z.useRef(null),R=Wf(),ee=py({id:s}),z=u?void 0:ee,[te,ne]=my({controlled:n,default:!!i,name:`Switch`,state:`checked`});hy(I,R,te,void 0,!M,l),J(()=>{T(te)},[te,T]),gy(te,()=>{b(N),C(te!==w.initialValue),A.change(te)});let{getButtonProps:re,buttonRef:ie}=L({disabled:M,native:u}),ae=uy(a,j,P,!u,z),B={id:u?ee:R,role:`switch`,"aria-checked":te,"aria-readonly":f||void 0,"aria-required":p||void 0,"aria-labelledby":ae,onFocus(){M||E(!0)},onBlur(){let e=P.current;e&&!M&&(S(!0),E(!1),D===`onBlur`&&A.commit(e.checked))},onClick(e){if(f||M)return;e.preventDefault();let t=P.current;t&&Rt(t,e)}},V={...A.getValidationProps(M),checked:te,disabled:M,form:o,id:z,name:N,required:p,style:N?Ye:uo,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:F,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(f){e.preventDefault();return}let t=e.currentTarget.checked,n=Ca(Zr,e.nativeEvent);d?.(t,n),!n.isCanceled&&ne(t)},onClick(e){e.stopPropagation()},onFocus(){I.current?.focus()},..._===void 0?jr:{value:_}},oe=Z.useMemo(()=>({...x,checked:te,disabled:M,readOnly:f,required:p}),[x,te,M,f,p]),se=Me(`span`,e,{state:oe,ref:[t,I,ie],props:[B,y,re,e=>A.getValidationProps(M,e)],stateAttributesMapping:Fy});return(0,Q.jsxs)(jy.Provider,{value:oe,children:[se,!te&&N&&g!==void 0&&(0,Q.jsx)(`input`,{type:`hidden`,form:o,name:N,value:g,disabled:M}),(0,Q.jsx)(`input`,{...V,suppressHydrationWarning:!0})]})}),Ly=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=My();return Me(`span`,e,{state:o,ref:t,stateAttributesMapping:Fy,props:a})});function Ry({className:e,size:t=`default`,...n}){return(0,Q.jsx)(Iy,{"data-slot":`switch`,"data-size":t,className:K(`peer group/switch relative inline-flex shrink-0 items-center rounded-2xl border-2 transition-all outline-none group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/30 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-5 data-[size=default]:w-8 data-[size=sm]:h-4 data-[size=sm]:w-6 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary group-has-[:focus-visible]/field-label:data-checked:border-primary data-unchecked:border-transparent data-unchecked:bg-input/90 group-has-[:focus-visible]/field-label:data-unchecked:border-transparent data-disabled:cursor-not-allowed data-disabled:opacity-50`,e),...n,children:(0,Q.jsx)(Ly,{"data-slot":`switch-thumb`,className:`pointer-events-none block rounded-2xl bg-background shadow-sm ring-0 transition-transform not-dark:bg-clip-padding group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-checked:translate-x-[calc(100%-4px)] dark:data-checked:bg-primary-foreground data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground`})})}function zy(e){let t=Z.useRef(!0);t.current&&(t.current=!1,e())}function By(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}var Vy=Z.createContext(void 0),Hy=Z.createContext(void 0),Uy=Z.createContext(void 0);function Wy(){let e=Z.useContext(Vy);if(e===void 0)throw Error(Ai(60));return e}function Gy(){let e=Z.useContext(Hy);if(e===void 0)throw Error(Ai(101));return e}function Ky(){let e=Z.useContext(Uy);if(e===void 0)throw Error(Ai(61));return e}function qy(e,t,n=Object.is){let{length:r}=e;if(r!==t.length)return!1;for(let i=0;i<r;i+=1)if(!n(e[i],t[i]))return!1;return!0}var Jy=(e,t)=>Object.is(e,t);function Yy(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Xy(e,t,n){return Array.isArray(e)&&Array.isArray(t)?!qy(e,t,(e,t)=>Yy(e,t,n)):e!==t}function Zy(e,t,n){return e?e.some(e=>e!==void 0&&Yy(t,e,n)):!1}function Qy(e,t,n){return e?e.findIndex(e=>e!==void 0&&Yy(e,t,n)):-1}function $y(e,t){if(t!==Jy)return n=>Zy(e,n,t);let n=new Set(e);return n.delete(void 0),t=>n.has(t)&&(t!==0||e.some(e=>Object.is(t,e)))}function eb(e,t,n,r){let i=r&&Array.isArray(t)?e.findIndex($y(t,n)):Qy(e,t,n);return i===-1?null:i}function tb(e,t,n,r,i,a){return Zy(r,t,i)?a!=null&&e>a&&Zy(r,n[a],i)?a:e:e===a?eb(n,r,i,!0):a}function nb(e,t,n){return e.filter(e=>!Yy(t,e,n))}function rb(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function ib(e){return typeof e==`object`&&!!e&&Array.isArray(e.items)}function ab(e){return ib(e?.[0])}function ob(e){return ab(e)?e.flatMap(e=>e.items):e}function sb(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(ab(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function cb(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return rb(e)}function lb(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?rb(e.value):rb(e)}function ub(e,t,n){function r(){return cb(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return(Object.hasOwn(t,e)?t[e]:void 0)??r();if(Array.isArray(t)){let n=ob(t);if(typeof e!=`object`||!e){let t=n.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=n.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function db(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,Q.jsx)(Z.Fragment,{children:ub(r,t,n)},i)),e),[])}var fb={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:lb(t,r)!==``},hasNullItemLabel:(e,t)=>t?sb(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{let n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(e=>Yy(t,e,n)):Yy(t,r,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows};function pb(e){let t=Z.useRef(``),n=Z.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:Z.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function mb(e,t){let{onClick:n,onPointerDown:r}=pb(q((n,r)=>{(typeof e==`function`?e():e)||t(r||(he?`touch`:``))}));return Z.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function hb(e){let[t,n]=Z.useState(null),r=mb(e,n);return gy(e,t=>{t&&!e&&n(null)}),Z.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}function gb(e,t){return Math.max(0,e-t)}function _b(e,t){if(t<=0)return 0;let n=Rl(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}function vb(e){let{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:o=!1,onOpenChange:s,name:c,form:l,autoComplete:u,disabled:d=!1,readOnly:f=!1,required:p=!1,modal:m=!0,actionsRef:h,inputRef:g,onOpenChangeComplete:_,items:v,multiple:y=!1,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S=Jy,highlightItemOnHover:C=!0,children:w}=e,{clearErrors:T}=sy(),{setDirty:E,setTouched:D,setFocused:O,validityData:k,setFilled:A,name:j,disabled:M,validation:N,validationMode:P}=ay(),F=py({id:t}),I=M||d,L=j??c,[R,ee]=my({controlled:n,default:y?r??zi:r,name:`Select`,state:`value`}),[z,te]=my({controlled:a,default:o,name:`Select`,state:`open`}),ne=Z.useRef([]),re=Z.useRef([]),ie=Z.useRef(null),ae=Z.useRef(null),B=Z.useRef(0),V=Z.useRef(null),oe=Z.useRef([]),se=Z.useRef(!1),ce=Z.useRef(null),le=Z.useRef(null),ue=Z.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),de=Z.useRef(!1),fe=Z.useRef(R),{mounted:pe,setMounted:me,transitionStatus:he}=kd(z),{openMethod:ge,triggerProps:_e}=hb(z),ve=ka(()=>new ri({id:F,labelId:void 0,modal:m,multiple:y,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S,value:R,open:z,mounted:pe,transitionStatus:he,items:v,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:jr,triggerProps:jr,triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:es,setOpen:es,handleScrollArrowVisibility:es,onOpenChangeComplete:es,listRef:ne,popupRef:ie,scrollHandlerRef:ae,scrollArrowsMountedCountRef:B,valueRef:V,valuesRef:oe,labelsRef:re,typingRef:se,selectionRef:ue,firstItemTextRef:ce,selectedItemTextRef:le,alignItemWithTriggerActiveRef:de,initialValueRef:fe},fb)).current,ye=ve.useState(`activeIndex`),be=ve.useState(`selectedIndex`),xe=ve.useState(`triggerElement`),Se=ve.useState(`positionerElement`),we=Gf(ge),Te=ge??we,Ee=Z.useMemo(()=>y?``:lb(R,x),[y,R,x]),De=Z.useMemo(()=>y&&Array.isArray(R)?R.map(e=>lb(e,x)):lb(R,x),[y,R,x]);hy(zl(xe),F,R,q(()=>De),!I,c);let Oe=y?Array.isArray(R)&&R.length>0:R!=null&&Ee!==``;J(()=>{A(Oe)},[Oe,A]),J(function(){let e=eb(oe.current,R,S,y);e===null&&(le.current=null),!z&&ve.set(`selectedIndex`,e)},[y,z,R,S,ve]),gy(R,()=>{T(L),E(Xy(R,k.initialValue,S)),N.change(R)});let ke=q((e,t)=>{s?.(e,t),!t.isCanceled&&(te(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(D(!0),O(!1),P===`onBlur`&&N.commit(R)))}),Ae=q(()=>{me(!1),ve.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),_?.(!1)});fn({enabled:!h,open:z,ref:ie,onComplete(){z||Ae()}}),Z.useImperativeHandle(h,()=>({unmount:Ae}),[Ae]);let je=q((e,t)=>{i?.(e,t),!t.isCanceled&&ee(e)}),Me=q(e=>{let t=gb(e.scrollHeight,e.clientHeight),n=_b(e.scrollTop,t),r=n>0,i=n<t;ve.set(`scrollUpArrowVisible`,r),ve.set(`scrollDownArrowVisible`,i)}),Ne=Gd({open:z,onOpenChange:ke,elements:{reference:xe,floating:Se}}),Pe=yu(Ne,{enabled:!I,event:`mousedown`}),Fe=Su(Ne),Ie=tf(Ne,{enabled:!I,listRef:ne,activeIndex:ye,selectedIndex:be,disabledIndices:zi,onNavigate(e){(e!==null||z)&&ve.set(`activeIndex`,e)},focusItemOnHover:C}),Le=nf(Ne,{enabled:!I&&(z||!f&&!y),listRef:re,activeIndex:ye,selectedIndex:be,disabledIndices:e=>By(ne.current[e]),onMatch(e){z?ve.set(`activeIndex`,e):je(oe.current[e],Ca(Zr))},onTyping(e){se.current=e}}),Re=Z.useMemo(()=>Ln(Le.reference,Ie.reference,Fe.reference,Pe.reference,_e),[Pe.reference,Le.reference,Ie.reference,Fe.reference,_e]),ze=Z.useMemo(()=>Ln(Ad,Le.floating,Ie.floating,Fe.floating),[Le.floating,Ie.floating,Fe.floating]),Be=Ie.item??jr;ve.useContextCallback(`setValue`,je),ve.useContextCallback(`setOpen`,ke),ve.useContextCallback(`handleScrollArrowVisibility`,Me),ve.useContextCallback(`onOpenChangeComplete`,_),zy(()=>{ve.update({popupProps:ze,triggerProps:Re})}),ve.useSyncedValues({id:F,modal:m,multiple:y,value:R,open:z,mounted:pe,transitionStatus:he,popupProps:ze,triggerProps:Re,items:v,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S,openMethod:Te});let Ve=Z.useMemo(()=>({disabled:I,readOnly:f,required:p,multiple:y,highlightItemOnHover:C,itemProps:Be}),[I,f,p,y,C,Be]),He=Ce(g,N.inputRef),Ue=y?void 0:L,We=Z.useMemo(()=>!y||!Array.isArray(R)||!L?null:R.map(e=>{let t=lb(e,x);return(0,Q.jsx)(`input`,{type:`hidden`,form:l,name:L,value:t,disabled:I},t)}),[y,R,l,L,x,I]);return(0,Q.jsxs)(Vy.Provider,{value:ve,children:[(0,Q.jsx)(Hy.Provider,{value:Ve,children:(0,Q.jsx)(Uy.Provider,{value:Ne,children:w})}),(0,Q.jsx)(`input`,{...N.getValidationProps(I,{onFocus(){ve.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented||I||f)return;let t=e.currentTarget.value,n=Ca(Zr,e.nativeEvent);function r(){if(y)return;let e=t.toLowerCase(),r=oe.current.findIndex(t=>lb(t,x).toLowerCase()===e||cb(t,b).toLowerCase()===e);r===-1&&(r=oe.current.findIndex((t,n)=>{let r=re.current[n];return r!=null&&r.toLowerCase()===e}));let i=oe.current[r];i!=null&&je(i,n)}ve.set(`forceMount`,!0),queueMicrotask(r)}}),id:F&&Ue==null?`${F}-hidden-input`:void 0,form:l,name:Ue,autoComplete:u,value:Ee,disabled:I,required:p&&!(y&&Oe),readOnly:f,ref:He,style:L?Ye:uo,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),We]})}function yb(e,t){return e??t}var bb=5;function xb(e,t){let n=Sb(t);return e.clientX>=n.left-bb&&e.clientX<=n.right+bb&&e.clientY>=n.top-bb&&e.clientY<=n.bottom+bb}function Sb(e){let t=e.getBoundingClientRect(),n=rn(e);if(ua)return t;let r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(r.content===`none`&&i.content===`none`)return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}var Cb=`data-popup-side`,wb=400,Tb={...el,...ny,popupSide:e=>e?{[Cb]:e}:null,value:()=>null},Eb=Z.forwardRef(function(e,t){let{render:n,className:r,id:i,disabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{setTouched:l,setFocused:u,validationMode:d,validation:f,state:p,disabled:m}=ay(),{labelId:h}=ly(),g=Wy(),{readOnly:_,required:v,disabled:y}=Gy(),b=m||y||a,x=g.useState(`open`),S=g.useState(`mounted`),C=g.useState(`value`),w=g.useState(`triggerProps`),T=g.useState(`positionerElement`),E=g.useState(`listElement`),D=g.useState(`popupSide`),O=g.useState(`id`),k=g.useState(`labelId`),A=g.useState(`hasSelectedValue`),j=S&&T?D:null,M=i??O,N=yb(h,k);py({id:i});let P=zl(T),F=Z.useRef(null),{getButtonProps:I,buttonRef:R}=L({disabled:b,native:o}),ee=g.useStateSetter(`triggerElement`),z=mn(),te=mn(),ne=mn();Z.useEffect(()=>{if(x)return ne.start(wb,()=>{g.context.selectionRef.current.allowUnselectedMouseUp=!0,g.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{ne.clear()};g.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},te.clear()},[x,g,te,ne]);let re=Ln(w,{id:M,role:`combobox`,"aria-expanded":x,"aria-haspopup":`listbox`,"aria-controls":x?E?.id??Ta(T)?.id:void 0,"aria-labelledby":N,"aria-readonly":_||void 0,"aria-required":v||void 0,tabIndex:b?-1:0,onFocus(e){u(!0),x&&g.context.alignItemWithTriggerActiveRef.current&&g.context.setOpen(!1,Ca(Zr,e.nativeEvent)),z.start(0,()=>{g.set(`forceMount`,!0)})},onBlur(e){_a(T,e.relatedTarget)||(l(!0),u(!1),d===`onBlur`&&f.commit(C))},onMouseDown(e){if(x)return;let t=Pe(e.currentTarget);function n(e){if(!F.current)return;let t=e.target;_a(F.current,t)||_a(P.current,t)||xb(e,F.current)||g.context.setOpen(!1,Ca(Ko,e))}te.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},c,I),ie=f.getValidationProps(b,re);ie.role=`combobox`;let ae={...p,open:x,disabled:b,value:C,readOnly:_,popupSide:j,placeholder:!A};return Me(`button`,e,{ref:[t,F,R,ee],state:ae,stateAttributesMapping:Tb,props:ie})}),Db={value:()=>null},Ob=Z.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,c=Wy(),l=c.useState(`value`),u=c.useState(`items`),d=c.useState(`itemToStringLabel`),f=c.useState(`hasSelectedValue`),p=!f&&a!=null&&i==null,m=c.useState(`hasNullItemLabel`,p),h={value:l,placeholder:!f},g=null;return g=typeof i==`function`?i(l):i??(p&&!m?a:Array.isArray(l)?db(l,u,d):ub(l,u,d)),Me(`span`,e,{state:h,ref:[t,c.context.valueRef],props:[{children:g},s],stateAttributesMapping:Db})}),kb=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o={open:Wy().useState(`open`)};return Me(`span`,e,{state:o,ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:$c})}),Ab=Z.forwardRef(function(e,t){let n=Wy(),r=n.useState(`mounted`),i=n.useState(`forceMount`);return r||i?(0,Q.jsx)(Vr,{ref:t,...e}):null}),jb=Z.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function Mb(){return Z.useContext(jb)}function Nb(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=q(i),[,o]=Z.useState(!1),s=ka(Fb).current,c=ka(Pb).current,l=Z.useRef(0),u=Z.useRef(!0),d=Z.useRef(null),f=Z.useRef(null),p=q(()=>{u.current||(u.current=!0,o(e=>!e))}),m=q((e,t)=>{c.set(e,t),p()}),h=q(e=>{c.delete(e),p()}),g=q(e=>{let t=new Map;return n.current.length=0,r&&(r.current.length=0),e.forEach(e=>{t.set(e.element,{...e.registration.metadata??{},index:e.index}),n.current[e.index]=e.element,r&&(r.current[e.index]=e.registration.label===void 0?e.registration.textRef?.current?.textContent??e.element.textContent:e.registration.label)}),l.current=n.current.length,t});function _(e){if(f.current?.disconnect(),f.current=null,typeof MutationObserver!=`function`||e.length<2)return;let t=new MutationObserver(n=>{if(!Rb(n))return;let r=null;for(let n of e)if(n.isConnected){if(r&&zb(r,n)>0){t.disconnect(),p();return}r=n}});f.current=t;let n=new Set;for(let t=1;t<e.length;t+=1){let r=Lb(e[t-1],e[t]);r&&n.add(r)}n.forEach(e=>t.observe(e,{childList:!0}))}let v=q(()=>{let[e,t]=Ib(c),n=g(e),r=d.current,i=!r||r.length!==e.length||e.some((e,t)=>{let n=r[t];return e.index!==n.index||e.element!==n.element||e.registration.index!==n.registration.index||e.registration.metadata!==n.registration.metadata});_(t),d.current=e,u.current=!1,i&&(s.forEach(e=>e(n)),a(n))});J(()=>(!u.current&&d.current&&g(d.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,g]),J(()=>{u.current&&v()}),J(()=>()=>{f.current?.disconnect(),u.current=!0},[]);let y=q(e=>(s.add(e),()=>{s.delete(e)})),b=Z.useMemo(()=>({register:m,unregister:h,subscribeMapChange:y,nextIndexRef:l}),[m,h,y,l]);return(0,Q.jsx)(jb.Provider,{value:b,children:t})}function Pb(){return new Map}function Fb(){return new Set}function Ib(e){let t=new Set,n=[],r=[];e.forEach((e,i)=>{if(!i.isConnected)return;let a=e.index,o={index:a??-1,element:i,registration:e};a===null?r.push(o):a>=0&&(t.add(a),n.push(o))});let i=0;return r.sort((e,t)=>zb(e.element,t.element)),r.forEach(e=>{for(;t.has(i);)i+=1;e.index=i,n.push(e),i+=1}),t.size>0&&n.sort((e,t)=>e.index-t.index),[n,r.map(e=>e.element)]}function Lb(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function Rb(e){for(let t of e)for(let e=0;e<t.removedNodes.length;e+=1)if(t.removedNodes[e].isConnected)return!0;return!1}function zb(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}var Bb=Z.createContext(void 0);function Vb(){let e=Z.useContext(Bb);if(!e)throw Error(Ai(59));return e}var Hb=Z.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,Q.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})});function Ub(e,t){e&&Object.assign(e.style,t)}var Wb={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`},Gb={},Kb={},qb=``;function Jb(e,t){return _o(e)?e:t}function Yb(e,t,n){return/hidden|clip/.test(e.getComputedStyle(Jb(t,n)).overflowY)}function Xb(e){if(typeof document>`u`)return!1;let t=Pe(e);return rn(t).innerWidth-t.documentElement.clientWidth>0}function Zb(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=Pe(e),n=t.documentElement,r=t.body,i=Jb(n,r),a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function Qb(e){let t=Pe(e),n=t.documentElement,r=t.body,i=Jb(n,r),a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function $b(e){let t=Pe(e),n=t.documentElement,r=t.body,i=rn(n),a=0,o=0,s=!1,c=Ps.create();if(kt&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,Gb={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},qb=n.style.scrollBehavior,Kb={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=Jb(n,r);if(s=Zb(e),s){n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflowY:`hidden`,overflowX:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function u(){Object.assign(n.style,Gb),Object.assign(r.style,Kb),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=qb)}function d(){u(),c.request(l)}l();let f=Kn(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var ex=new class{lockCount=0;restore=null;timeoutLock=ft.create();timeoutUnlock=ft.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=Pe(e),n=t.documentElement,r=t.body,i=rn(n);if(Yb(i,n,r)){let t=new i.MutationObserver(()=>{Yb(i,n,r)||(t.disconnect(),this.restore=null,this.lock(e))}),a={attributes:!0};t.observe(n,a),t.observe(r,a),this.restore=()=>t.disconnect();return}let a=he||!Xb(e);this.restore=a?Qb(e):$b(e)}};function tx(e=!0,t=null){J(()=>{if(e)return ex.acquire(t)},[e,t])}var nx=20;function rx(e,t,n,r){let[i,a]=Z.useState(!1);J(()=>{if(!e||!t||n==null){a(!1);return}let r=Pe(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-nx)},[e,t,n]),tx(e&&(!t||i),r)}var ix={position:`fixed`},ax=Z.forwardRef(function(e,t){let{anchor:n,className:r,render:i,positionMethod:a,side:o,align:s,sideOffset:c,alignOffset:l,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f,sticky:p,disableAnchorTracking:m,alignItemWithTrigger:h=!0,collisionAvoidance:g=me,style:_,...v}=e,y=Wy(),b=Ky(),x=y.useState(`open`),S=y.useState(`mounted`),C=y.useState(`modal`),w=y.useState(`value`),T=y.useState(`openMethod`),E=y.useState(`positionerElement`),D=y.useState(`triggerElement`),O=y.useState(`isItemEqualToValue`),k=y.useState(`transitionStatus`),A=Z.useRef(null),j=Z.useRef(null),[M,N]=Z.useState(h),P=S&&M&&T!==`touch`;!S&&M!==h&&N(h),Z.useImperativeHandle(y.context.alignItemWithTriggerActiveRef,()=>P),rx((P||C)&&x,T===`touch`,E,D);let F=yf({anchor:n,floatingRootContext:b,positionMethod:a,mounted:S,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??P,collisionAvoidance:g,keepMounted:!0}),I=P?`none`:F.side,L=P?ix:F.positionerStyles,R={open:x,side:I,align:F.align,anchorHidden:F.anchorHidden};J(()=>{y.set(`popupSide`,F.side)},[y,F.side]);let ee=Cf(e,R,{styles:L,transitionStatus:k,props:v,refs:[t,y.useStateSetter(`positionerElement`)],hidden:!S,inert:!x}),z=Z.useRef(0),te=q(e=>{if(y.context.valuesRef.current.length===0)return;let t=z.current;z.current=e.size;let n=Ca(Zr);if(t!==0&&!y.state.multiple&&w!==null&&Qy(y.context.valuesRef.current,w,O)===-1){let e=y.context.initialValueRef.current,t=e!=null&&Qy(y.context.valuesRef.current,e,O)!==-1?e:null;y.context.setValue(t,n),t===null&&(y.set(`selectedIndex`,null),y.context.selectedItemTextRef.current=null)}if(t!==0&&y.state.multiple&&Array.isArray(w)){let e=w.filter(e=>Qy(y.context.valuesRef.current,e,O)!==-1);e.length!==w.length&&(y.context.setValue(e,n),e.length===0&&(y.set(`selectedIndex`,null),y.context.selectedItemTextRef.current=null))}if(x&&P){y.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};Ub(E,e),Ub(y.context.popupRef.current,e)}}),ne=Z.useMemo(()=>({...F,side:I,alignItemWithTriggerActive:P,setControlledAlignItemWithTrigger:N,scrollUpArrowRef:A,scrollDownArrowRef:j}),[F,I,P,N]);return(0,Q.jsx)(Nb,{elementsRef:y.context.listRef,labelsRef:y.context.labelsRef,onMapChange:te,children:(0,Q.jsxs)(Bb.Provider,{value:ne,children:[S&&C&&(0,Q.jsx)(Hb,{inert:Gn(!x),cutout:D}),ee]})})}),ox=`base-ui-disable-scrollbar`,sx={className:ox,getElement(e){return(0,Q.jsx)(`style`,{nonce:e,href:ox,precedence:`base-ui:low`,children:`.${ox}{scrollbar-width:none}.${ox}::-webkit-scrollbar{display:none}`})}},cx=Z.createContext(void 0);function lx(e){let t=Z.useContext(cx);if(t===void 0&&!e)throw Error(Ai(69));return t}var ux=`ArrowUp`,dx=`ArrowDown`,fx=`ArrowLeft`,px=`ArrowRight`,mx=`Home`,hx=new Set([ux,dx,fx,px,mx,`End`]),gx=[`Shift`,`Control`,`Alt`,`Meta`];function _x(e){return Io(e)&&e.tagName===`INPUT`}function vx(e){return!!(_x(e)&&e.selectionStart!=null||Io(e)&&e.tagName===`TEXTAREA`)}function yx(e,t,n,r){if(!e||!t||!t.scrollTo)return;let i=e.scrollLeft,a=e.scrollTop,o=e.clientWidth<e.scrollWidth,s=e.clientHeight<e.scrollHeight;if(o&&r!==`vertical`){let r=bx(e,t,`left`),a=xx(e),o=xx(t);n===`ltr`&&(r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight?i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight:r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft&&(i=r-o.scrollMarginLeft-a.scrollPaddingLeft)),n===`rtl`&&(r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft?i=r-o.scrollMarginLeft-a.scrollPaddingLeft:r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight&&(i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight))}if(s&&r!==`horizontal`){let n=bx(e,t,`top`),r=xx(e),i=xx(t);n-i.scrollMarginTop<e.scrollTop+r.scrollPaddingTop?a=n-i.scrollMarginTop-r.scrollPaddingTop:n+t.offsetHeight+i.scrollMarginBottom>e.scrollTop+e.clientHeight-r.scrollPaddingBottom&&(a=n+t.offsetHeight+i.scrollMarginBottom-e.clientHeight+r.scrollPaddingBottom)}e.scrollTo({left:i,top:a,behavior:`auto`})}function bx(e,t,n){let r=n===`left`?`offsetLeft`:`offsetTop`,i=0;for(;t.offsetParent&&(i+=t[r],t.offsetParent!==e);)t=t.offsetParent;return i}function xx(e){let t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}var Sx=Z.createContext(void 0),Cx={disableStyleElements:!1};function wx(){return Z.useContext(Sx)??Cx}var Tx=`--transform-origin`,Ex={...tl,...$r},Dx=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,s=Wy(),{multiple:c,readOnly:l,highlightItemOnHover:u}=Gy(),d=Ky(),{side:f,align:p,alignItemWithTriggerActive:m,isPositioned:h,setControlledAlignItemWithTrigger:g}=Vb(),_=lx(!0)!=null,v=af(),{nonce:y,disableStyleElements:b}=wx(),x=s.useState(`id`),C=s.useState(`open`),w=s.useState(`openMethod`),T=s.useState(`mounted`),E=s.useState(`popupProps`),D=s.useState(`transitionStatus`),O=s.useState(`triggerElement`),k=s.useState(`positionerElement`),A=s.useState(`listElement`),j=Z.useRef(!1),M=Z.useRef(!1),N=Z.useRef({}),P=S(),F=q(e=>{if(!k||!s.context.popupRef.current||!M.current)return;let t=k.style.top===`0px`,n=k.style.bottom===`0px`;if(j.current||!m||!t&&!n){s.context.handleScrollArrowVisibility(e);return}let r=Ax(k),i=jx(k.getBoundingClientRect().height,`y`,r),a=Pe(k),o=rn(k),c=o.getComputedStyle(k),l=parseFloat(c.marginTop),u=parseFloat(c.marginBottom),d=Ox(o.getComputedStyle(s.context.popupRef.current)),f=Math.min(a.documentElement.clientHeight-l-u,d),p=e.scrollTop,h=kx(e),g=null,_=e=>{k.style.height=`${e}px`},v=t?h-p:p,y=Math.min(i+v,f);if(v<=1){let n=Rl(v,0,f-i);n>0&&_(i+n),e.scrollTop=t?h:0,f-(i+n)<=1&&(j.current=!0),s.context.handleScrollArrowVisibility(e);return}f-y>1?g=t?1/0:0:n&&p<h&&(g=p-(v-(i+v-f)));let b=Math.ceil(y);if(b!==0&&_(b),g!=null){let t=Rl(g,0,kx(e));Math.abs(e.scrollTop-t)>1&&(e.scrollTop=t)}b>=f-1&&(j.current=!0),s.context.handleScrollArrowVisibility(e)});Z.useImperativeHandle(s.context.scrollHandlerRef,()=>F,[F]),fn({open:C,ref:s.context.popupRef,onComplete(){C&&s.context.onOpenChangeComplete(!0)}});let I={open:C,transitionStatus:D,side:f,align:p};J(()=>{k&&s.context.popupRef.current&&!Object.keys(N.current).length&&(N.current={top:k.style.top||`0`,left:k.style.left||`0`,right:k.style.right,height:k.style.height,bottom:k.style.bottom,minHeight:k.style.minHeight,maxHeight:k.style.maxHeight,marginTop:k.style.marginTop,marginBottom:k.style.marginBottom})},[s,k]),J(()=>{C||m||(M.current=!1,j.current=!1,Ub(k,N.current))},[C,m,k]),J(()=>{let e=s.context.popupRef.current;if(!C||!O||!k||!e||m&&!h||s.state.transitionStatus===`ending`)return;if(M.current=!0,e.style.removeProperty(Tx),!m){P.request(()=>s.context.handleScrollArrowVisibility(A||e));return}let t=Px(e);try{let t=s.context.selectedItemTextRef.current;t?.isConnected||(t=!s.select(`hasSelectedValue`)&&s.context.firstItemTextRef.current?.isConnected?s.context.firstItemTextRef.current:null);let n=s.context.valueRef.current,r=rn(k),i=r.getComputedStyle(k),a=r.getComputedStyle(e),o=Pe(O),c=Ax(O),l=Mx(O.getBoundingClientRect(),c),d=Mx(k.getBoundingClientRect(),c),f=l.height,p=A||e,m=p.scrollHeight,h=parseFloat(a.borderBottomWidth),_=parseFloat(i.marginTop)||10,y=parseFloat(i.marginBottom)||10,b=parseFloat(i.minHeight)||100,x=Ox(a),S=o.documentElement.clientHeight-_-y,C=o.documentElement.clientWidth,w=S-l.bottom+f,T,E=v===`rtl`?l.right-d.width:l.left,D=0;if(t&&n){let e=Mx(n.getBoundingClientRect(),c);T=Mx(t.getBoundingClientRect(),c),E=d.left+(v===`rtl`?e.right-T.right:e.left-T.left);let r=e.top-l.top+e.height/2;D=T.top-d.top+T.height/2-r}let M=w+D+y+h,P=Math.min(S,M),F=S-_-y,I=M-P,L=C-5;k.style.left=`${Rl(E,5,L-d.width)}px`,k.style.height=`${P}px`,k.style.maxHeight=`none`,k.style.marginTop=`${_}px`,k.style.marginBottom=`${y}px`,e.style.height=`100%`;let R=kx(p),ee=I>=R-1;ee&&(P=Math.min(S,d.height)-(I-R));let z=l.top<20||l.bottom>S-20||Math.ceil(P)+1<Math.min(m,b),te=(r.visualViewport?.scale??1)!==1&&kt;if(z||te){Ub(k,N.current),g(!1);return}let ne=Math.max(b,P);if(ee){let e=Math.max(0,S-M);k.style.top=d.height>=F?`0`:`${e}px`,k.style.height=`${P}px`,p.scrollTop=kx(p)}else k.style.bottom=`0`,p.scrollTop=I;if(T){let t=d.top,n=d.height,r=T.top+T.height/2,i=Rl(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(Tx,`50% ${i}%`)}(ne===S||P>=x)&&(j.current=!0),s.context.handleScrollArrowVisibility(p),u&&s.state.selectedIndex===null&&s.state.activeIndex===null&&s.context.listRef.current[0]!=null&&s.set(`activeIndex`,0)}finally{t()}},[s,C,k,O,m,g,P,A,u,v,h]),Z.useEffect(()=>{if(!m||!k||!C)return;let e=rn(k);function t(e){s.context.setOpen(!1,Ca(V,e))}return Kn(e,`resize`,t)},[s,m,k,C]);let L={...A?{role:`presentation`}:{role:`listbox`,"aria-multiselectable":c||void 0,"aria-readonly":l||void 0,id:`${x}-list`},onKeyDown(e){_&&hx.has(e.key)&&e.stopPropagation()},onScroll(e){A||F(e.currentTarget)},...m&&{style:A?{height:`100%`}:Wb},className:!A&&m?sx.className:void 0},R=Me(`div`,e,{ref:[t,s.context.popupRef],state:I,stateAttributesMapping:Ex,props:[E,L,Sf(D),o]});return(0,Q.jsxs)(Z.Fragment,{children:[!b&&sx.getElement(y),(0,Q.jsx)(vu,{context:d,modal:!1,disabled:!T,openInteractionType:w,returnFocus:a,restoreFocus:!0,children:R})]})});function Ox(e){let t=e.maxHeight;return t.endsWith(`px`)&&parseFloat(t)||1/0}function kx(e){return gb(e.scrollHeight,e.clientHeight)}function Ax(e){return ad.getScale(e)}function jx(e,t,n){return e/n[t]}function Mx(e,t){return Ll({x:jx(e.x,`x`,t),y:jx(e.y,`y`,t),width:jx(e.width,`x`,t),height:jx(e.height,`y`,t)})}var Nx=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function Px(e){let{style:t}=e,n={};for(let[e,r]of Nx)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of Nx){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var Fx=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=Wy(),{multiple:s,readOnly:c}=Gy(),{alignItemWithTriggerActive:l}=Vb(),u=o.useState(`hasScrollArrows`),d=o.useState(`openMethod`),f={id:`${o.useState(`id`)}-list`,role:`listbox`,"aria-multiselectable":s||void 0,"aria-readonly":c||void 0,onScroll(e){o.context.scrollHandlerRef.current?.(e.currentTarget)},...l&&{style:Wb},className:u&&d!==`touch`?sx.className:void 0},p=o.useStateSetter(`listElement`);return Me(`div`,e,{ref:[t,p],props:[f,a]})});function Ix(e={}){let{guess:t,label:n,metadata:r,textRef:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,nextIndexRef:l}=Mb(),u=Z.useRef(-1),[d,f]=Z.useState(a==null&&t?()=>{if(u.current===-1){let e=l.current;l.current+=1,u.current=e}return u.current}:-1),p=a??d,m=Z.useRef(null),h=Z.useCallback(e=>{let t=m.current;t&&s(t),m.current=e,e&&o(e,{metadata:r??null,index:a??null,label:n,textRef:i})},[a,o,s,r,n,i]);return J(()=>{if(a==null)return c(e=>{let t=m.current?e.get(m.current)?.index:null;t!=null&&f(t)})},[a,c]),{ref:h,index:p}}var Lx=Z.createContext(void 0);function Rx(){let e=Z.useContext(Lx);if(!e)throw Error(Ai(57));return e}var zx=Z.memo(Z.forwardRef(function(e,t){let{render:n,className:r,style:i,value:a=null,label:o,disabled:s=!1,nativeButton:c=!1,...l}=e,u=Z.useRef(null),d=Ix({guess:!0,label:o,textRef:u}),f=Wy(),{itemProps:p,multiple:m,disabled:h,readOnly:g}=Gy(),_=h||s,v=f.useState(`isActive`,d.index),y=f.useState(`open`),b=f.useState(`isSelected`,a),x=f.useState(`isSelectedByFocus`,d.index),S=f.useState(`isItemEqualToValue`),C=d.index,w=Z.useRef(null);J(()=>{let e=f.context.valuesRef.current;return e[C]=a,()=>{delete e[C]}},[C,a,f]),J(()=>{let e=f.state.value,t=f.state.selectedIndex,n=t,r;m&&Array.isArray(e)?(n=tb(C,a,f.context.valuesRef.current,e,S,t),r=n===C,C===t&&!r&&(f.context.selectedItemTextRef.current=null)):(r=e!==void 0&&Yy(a,e,S),r&&(n=C)),f.set(`selectedIndex`,n),r&&u.current&&(f.context.selectedItemTextRef.current=u.current)},[C,m,S,f,a]);let T=Z.useRef(`mouse`),E=Z.useRef(!1),{getButtonProps:D,buttonRef:O}=L({disabled:_,focusableWhenDisabled:!0,native:c,composite:!0}),k={disabled:_,selected:b,highlighted:v};function A(e){if(h||g)return;let t=f.state.value;if(m){let n=Array.isArray(t)?t:[],r=b?nb(n,a,S):[...n,a];f.context.setValue(r,Ca(Nr,e))}else f.context.setValue(a,Ca(Nr,e)),f.context.setOpen(!1,Ca(Nr,e))}function j(){f.context.selectionRef.current.dragY=0}let M={role:`option`,"aria-selected":b,tabIndex:y&&v?0:-1,onKeyDown(e){f.set(`activeIndex`,C),e.key===` `&&f.context.typingRef.current&&e.preventDefault()},onClick(e){let t=T.current!==`touch`,n=e.nativeEvent.pointerType,r=t&&sl(e.nativeEvent)&&(n!==void 0||v),i=t&&!r&&!E.current;E.current=!1,!(_||i)&&A(e.nativeEvent)},onPointerEnter(e){T.current=e.pointerType},onPointerMove(e){if(e.pointerType===`mouse`&&e.buttons===1){let t=f.context.selectionRef.current;t.dragY+=e.movementY,t.dragY**2>=64&&(t.allowUnselectedMouseUp=!0)}},onPointerDown(e){T.current=e.pointerType,E.current=!0,j()},onMouseUp(){if(j(),_||T.current===`touch`||E.current)return;let e=!f.context.selectionRef.current.allowSelectedMouseUp&&b,t=!f.context.selectionRef.current.allowUnselectedMouseUp&&!b;e||t||(E.current=!0,w.current?.click(),E.current=!1)}},N=Me(`div`,e,{ref:[O,t,d.ref,w],state:k,props:[p,M,l,D]}),P=Z.useMemo(()=>({selected:b,index:C,textRef:u,selectedByFocus:x}),[b,C,u,x]);return(0,Q.jsx)(Lx.Provider,{value:P,children:N})})),Bx=Z.forwardRef(function(e,t){let{selected:n}=Rx();return e.keepMounted||n?(0,Q.jsx)(Vx,{...e,ref:t}):null}),Vx=Z.memo(Z.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=Rx(),c=Z.useRef(null),{transitionStatus:l,setMounted:u}=kd(s),d=Me(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:$r});return fn({batch:!0,enabled:!s,open:s,ref:c,onComplete(){s||u(!1)}}),d})),Hx=Z.memo(Z.forwardRef(function(e,t){let{index:n,textRef:r,selectedByFocus:i}=Rx(),a=Wy(),{render:o,className:s,style:c,...l}=e,u=Z.useCallback(e=>{e&&(n===0&&(a.context.firstItemTextRef.current=e),i&&(a.context.selectedItemTextRef.current=e))},[a,n,i]);return Me(`div`,e,{ref:[u,t,r],props:l})})),Ux=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,direction:a,keepMounted:o,...s}=e,c=a===`up`,l=Wy(),{side:u,scrollDownArrowRef:d,scrollUpArrowRef:f}=Vb(),p=c?`scrollUpArrowVisible`:`scrollDownArrowVisible`,m=l.useState(p),h=l.useState(`openMethod`),g=m&&h!==`touch`,_=mn(),v=c?f:d,{mounted:y,transitionStatus:b,setMounted:x}=kd(g);J(()=>(l.context.scrollArrowsMountedCountRef.current+=1,l.set(`hasScrollArrows`,!0),()=>{l.context.scrollArrowsMountedCountRef.current=Math.max(0,l.context.scrollArrowsMountedCountRef.current-1),l.context.scrollArrowsMountedCountRef.current===0&&l.set(`hasScrollArrows`,!1)}),[l]),fn({open:g,ref:v,onComplete(){g||x(!1)}});let S=Me(`div`,e,{ref:[t,v],state:{direction:a,visible:g,side:u,transitionStatus:b},props:[{"aria-hidden":!0,children:c?`▲`:`▼`,style:{position:`absolute`},onMouseMove(e){if(e.movementX===0&&e.movementY===0||_.isStarted())return;l.set(`activeIndex`,null);function t(){let e=l.state.listElement??l.context.popupRef.current;if(!e)return;l.set(`activeIndex`,null),l.context.handleScrollArrowVisibility(e);let n=gb(e.scrollHeight,e.clientHeight),r=_b(e.scrollTop,n),i=r===(c?0:n),a=l.context.listRef.current;if(r!==e.scrollTop&&(e.scrollTop=r),i){_.clear();return}if(a.length>0){let t=v.current?.offsetHeight||0;e.scrollTop=Wx(a,c,r,e.clientHeight,t,n)}_.start(40,t)}_.start(40,t)},onMouseLeave(){_.clear()}},s],stateAttributesMapping:$r});return y||o?S:null});function Wx(e,t,n,r,i,a){if(t){let t=0,r=n+i-1;for(let n=0;n<e.length;n+=1){let i=e[n];if(i&&i.offsetTop>=r){t=n;break}}let o=Math.max(0,t-1),s=e[o];return o<t&&s?_b(s.offsetTop-i,a):0}let o=e.length-1,s=n+r-i+1;for(let t=0;t<e.length;t+=1){let n=e[t];if(n&&n.offsetTop+n.offsetHeight>s){o=Math.max(0,t-1);break}}let c=Math.min(e.length-1,o+1),l=e[c];return c>o&&l?_b(l.offsetTop+l.offsetHeight-r+i,a):a}var Gx=Z.forwardRef(function(e,t){return(0,Q.jsx)(Ux,{...e,ref:t,direction:`down`})}),Kx=Z.forwardRef(function(e,t){return(0,Q.jsx)(Ux,{...e,ref:t,direction:`up`})}),qx=Z.createContext(void 0);function Jx(){let e=Z.useContext(qx);if(e===void 0)throw Error(Ai(56));return e}var Yx=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,[o,s]=Z.useState(),c=Z.useMemo(()=>({labelId:o,setLabelId:s}),[o,s]),l=Me(`div`,e,{ref:t,props:[{role:`group`,"aria-labelledby":o},a]});return(0,Q.jsx)(qx.Provider,{value:c,children:l})}),Xx=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{setLabelId:s}=Jx(),c=Wf(a);return J(()=>(s(c),()=>{s(e=>e===c?void 0:e)}),[c,s]),Me(`div`,e,{ref:t,props:[{id:c,"aria-hidden":!0},o]})}),Zx=vb;function Qx({className:e,...t}){return(0,Q.jsx)(Yx,{"data-slot":`select-group`,className:K(`scroll-my-1.5 p-1`,e),...t})}function $x({className:e,...t}){return(0,Q.jsx)(Ob,{"data-slot":`select-value`,className:K(`flex flex-1 text-left`,e),...t})}function eS({className:e,size:t=`default`,children:n,...r}){return(0,Q.jsxs)(Eb,{"data-slot":`select-trigger`,"data-size":t,className:K(`flex w-fit items-center justify-between gap-1.5 rounded-2xl border border-transparent bg-input/50 px-3 py-2 text-sm whitespace-nowrap transition-[color,box-shadow] duration-200 outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,Q.jsx)(kb,{render:(0,Q.jsx)(Tf,{className:`pointer-events-none size-4 text-muted-foreground`})})]})}function tS({className:e,children:t,side:n=`bottom`,sideOffset:r=4,align:i=`center`,alignOffset:a=0,alignItemWithTrigger:o=!0,...s}){return(0,Q.jsx)(Ab,{children:(0,Q.jsx)(ax,{side:n,sideOffset:r,align:i,alignOffset:a,alignItemWithTrigger:o,className:`isolate z-50`,children:(0,Q.jsxs)(Dx,{"data-slot":`select-content`,"data-align-trigger":o,className:K(`isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-2xl text-popover-foreground shadow-lg ring-1 ring-foreground/5 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 dark:ring-foreground/10 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 animate-none! relative bg-popover/70 before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit] before:backdrop-blur-2xl before:backdrop-saturate-150 **:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10 **:data-[slot$=-separator]:bg-foreground/5 **:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10! **:data-[variant=destructive]:focus:bg-foreground/10! **:data-[variant=destructive]:text-accent-foreground! **:data-[variant=destructive]:**:text-accent-foreground!`,e),...s,children:[(0,Q.jsx)(iS,{}),(0,Q.jsx)(Fx,{children:t}),(0,Q.jsx)(aS,{})]})})})}function nS({className:e,...t}){return(0,Q.jsx)(Xx,{"data-slot":`select-label`,className:K(`px-2 py-1 text-xs text-muted-foreground`,e),...t})}function rS({className:e,children:t,...n}){return(0,Q.jsxs)(zx,{"data-slot":`select-item`,className:K(`relative flex min-h-7 w-full cursor-default items-center gap-2 rounded-xl py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,Q.jsx)(Hx,{className:`flex flex-1 shrink-0 gap-2 whitespace-nowrap`,children:t}),(0,Q.jsx)(Bx,{render:(0,Q.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`}),children:(0,Q.jsx)(o,{className:`pointer-events-none`})})]})}function iS({className:e,...t}){return(0,Q.jsx)(Kx,{"data-slot":`select-scroll-up-button`,className:K(`top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,Q.jsx)(Df,{})})}function aS({className:e,...t}){return(0,Q.jsx)(Gx,{"data-slot":`select-scroll-down-button`,className:K(`bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,Q.jsx)(Tf,{})})}var oS=(e=>(e[e.Border=-1]=`Border`,e[e.Data=0]=`Data`,e[e.Function=1]=`Function`,e[e.Position=2]=`Position`,e[e.Timing=3]=`Timing`,e[e.Alignment=4]=`Alignment`,e))(oS||{}),sS=[0,1],cS=[1,0],lS=[2,3],uS=[3,2],dS={L:sS,M:cS,Q:lS,H:uS},fS=/^\d*$/,pS=/^[A-Z0-9 $%*+./:-]*$/,mS=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`,hS=1,gS=40,_S=3,vS=3,yS=40,bS=10,xS=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],SS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],CS=class{constructor(e,t,n,r){if(this.version=e,this.ecc=t,e<hS||e>gS)throw RangeError(`Version value out of range`);if(r<-1||r>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let i=Array.from({length:this.size}).fill(!1);for(let e=0;e<this.size;e++)this.modules.push(i.slice()),this.types.push(i.map(()=>0));this.drawFunctionPatterns();let a=this.addEccAndInterleave(n);if(this.drawCodewords(a),r===-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(r=t,e=n),this.applyMask(t)}}this.mask=r,this.applyMask(r),this.drawFormatBits(r)}size;mask;modules=[];types=[];getModule(e,t){return e>=0&&e<this.size&&t>=0&&t<this.size&&this.modules[t][e]}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0,oS.Timing),this.setFunctionModule(e,6,e%2==0,oS.Timing);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n===0&&r===0||n===0&&r===t-1||n===t-1&&r===0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.ecc[1]<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let r=(t<<10|n)^21522;for(let e=0;e<=5;e++)this.setFunctionModule(8,e,TS(r,e));this.setFunctionModule(8,7,TS(r,6)),this.setFunctionModule(8,8,TS(r,7)),this.setFunctionModule(7,8,TS(r,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,TS(r,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,TS(r,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,TS(r,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;for(let e=0;e<18;e++){let n=TS(t,e),r=this.size-11+e%3,i=Math.floor(e/3);this.setFunctionModule(r,i,n),this.setFunctionModule(i,r,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;a>=0&&a<this.size&&o>=0&&o<this.size&&this.setFunctionModule(a,o,i!==2&&i!==4,oS.Position)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!==1,oS.Alignment)}setFunctionModule(e,t,n,r=oS.Function){this.modules[t][e]=n,this.types[t][e]=r}addEccAndInterleave(e){let t=this.version,n=this.ecc;if(e.length!==BS(t,n))throw RangeError(`Invalid argument`);let r=SS[n[0]][t],i=xS[n[0]][t],a=Math.floor(zS(t)/8),o=r-a%r,s=Math.floor(a/r),c=[],l=VS(i);for(let t=0,n=0;t<r;t++){let r=e.slice(n,n+s-i+(t<o?0:1));n+=r.length;let a=HS(r,l);t<o&&r.push(0),c.push(r.concat(a))}let u=[];for(let e=0;e<c[0].length;e++)c.forEach((t,n)=>{(e!==s-i||n>=o)&&u.push(t[e])});return u}drawCodewords(e){if(e.length!==Math.floor(zS(this.version)/8))throw RangeError(`Invalid argument`);let t=0;for(let n=this.size-1;n>=1;n-=2){n===6&&(n=5);for(let r=0;r<this.size;r++)for(let i=0;i<2;i++){let a=n-i,o=n+1&2?r:this.size-1-r;!this.types[o][a]&&t<e.length*8&&(this.modules[o][a]=TS(e[t>>>3],7-(t&7)),t++)}}}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.types[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[t][a]===n?(r++,r===5?e+=_S:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*yS),n=this.modules[t][a],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*yS}for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[a][t]===n?(r++,r===5?e+=_S:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*yS),n=this.modules[a][t],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*yS}for(let t=0;t<this.size-1;t++)for(let n=0;n<this.size-1;n++){let r=this.modules[t][n];r===this.modules[t][n+1]&&r===this.modules[t+1][n]&&r===this.modules[t+1][n+1]&&(e+=vS)}let t=0;for(let e of this.modules)t=e.reduce((e,t)=>e+ +!!t,t);let n=this.size*this.size,r=Math.ceil(Math.abs(t*20-n*10)/n)-1;return e+=r*bS,e}getAlignmentPatternPositions(){if(this.version===1)return[];{let e=Math.floor(this.version/7)+2,t=this.version===32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}finderPenaltyCountPatterns(e){let t=e[1],n=t>0&&e[2]===t&&e[3]===t*3&&e[4]===t&&e[5]===t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]===0&&(e+=this.size),t.pop(),t.unshift(e)}};function wS(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function TS(e,t){return!!(e>>>t&1)}var ES=class{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}getData(){return this.bitData.slice()}},DS=[1,10,12,14],OS=[2,9,11,13],kS=[4,8,16,16];function AS(e,t){return e[Math.floor((t+7)/17)+1]}function jS(e){let t=[];for(let n of e)wS(n,8,t);return new ES(kS,e.length,t)}function MS(e){if(!FS(e))throw RangeError(`String contains non-numeric characters`);let t=[];for(let n=0;n<e.length;){let r=Math.min(e.length-n,3);wS(Number.parseInt(e.substring(n,n+r),10),r*3+1,t),n+=r}return new ES(DS,e.length,t)}function NS(e){if(!IS(e))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let t=[],n=0;for(;n+2<=e.length;n+=2){let r=mS.indexOf(e.charAt(n))*45;r+=mS.indexOf(e.charAt(n+1)),wS(r,11,t)}return n<e.length&&wS(mS.indexOf(e.charAt(n)),6,t),new ES(OS,e.length,t)}function PS(e){return e===``?[]:FS(e)?[MS(e)]:IS(e)?[NS(e)]:[jS(RS(e))]}function FS(e){return fS.test(e)}function IS(e){return pS.test(e)}function LS(e,t){let n=0;for(let r of e){let e=AS(r.mode,t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}function RS(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)===`%`?(t.push(Number.parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}function zS(e){if(e<hS||e>gS)throw RangeError(`Version number out of range`);let t=(16*e+128)*e+64;if(e>=2){let n=Math.floor(e/7)+2;t-=(25*n-10)*n-55,e>=7&&(t-=36)}return t}function BS(e,t){return Math.floor(zS(e)/8)-xS[t[0]][e]*SS[t[0]][e]}function VS(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let t=[];for(let n=0;n<e-1;n++)t.push(0);t.push(1);let n=1;for(let r=0;r<e;r++){for(let e=0;e<t.length;e++)t[e]=US(t[e],n),e+1<t.length&&(t[e]^=t[e+1]);n=US(n,2)}return t}function HS(e,t){let n=t.map(e=>0);for(let r of e){let e=r^n.shift();n.push(0),t.forEach((t,r)=>n[r]^=US(t,e))}return n}function US(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return n}function WS(e,t,n=1,r=40,i=-1,a=!0){if(!(hS<=n&&n<=r&&r<=gS)||i<-1||i>7)throw RangeError(`Invalid value`);let o,s;for(o=n;;o++){let n=BS(o,t)*8,i=LS(e,o);if(i<=n){s=i;break}if(o>=r)throw RangeError(`Data too long`)}for(let e of[cS,lS,uS])a&&s<=BS(o,e)*8&&(t=e);let c=[];for(let t of e){wS(t.mode[0],4,c),wS(t.numChars,AS(t.mode,o),c);for(let e of t.getData())c.push(e)}let l=BS(o,t)*8;wS(0,Math.min(4,l-c.length),c),wS(0,(8-c.length%8)%8,c);for(let e=236;c.length<l;e^=253)wS(e,8,c);let u=Array.from({length:Math.ceil(c.length/8)},()=>0);return c.forEach((e,t)=>u[t>>>3]|=e<<7-(t&7)),new CS(o,t,u,i)}function GS(e,t){let{ecc:n=`L`,boostEcc:r=!1,minVersion:i=1,maxVersion:a=40,maskPattern:o=-1,border:s=1}=t||{},c=typeof e==`string`?PS(e):Array.isArray(e)?[jS(e)]:void 0;if(!c)throw Error(`uqr only supports encoding string and binary data, but got: ${typeof e}`);let l=WS(c,dS[n],i,a,o,r),u=KS({version:l.version,maskPattern:l.mask,size:l.size,data:l.modules,types:l.types},s);return t?.invert&&(u.data=u.data.map(e=>e.map(e=>!e))),t?.onEncoded?.(u),u}function KS(e,t=1){if(!t)return e;let{size:n}=e,r=n+t*2;e.size=r,e.data.forEach(e=>{for(let n=0;n<t;n++)e.unshift(!1),e.push(!1)});for(let n=0;n<t;n++)e.data.unshift(Array.from({length:r},e=>!1)),e.data.push(Array.from({length:r},e=>!1));let i=oS.Border;e.types.forEach(e=>{for(let n=0;n<t;n++)e.unshift(i),e.push(i)});for(let n=0;n<t;n++)e.types.unshift(Array.from({length:r},e=>i)),e.types.push(Array.from({length:r},e=>i));return e}function qS(e){let t=(0,$.c)(8),{link:n}=e,r,i;if(t[0]!==n){let{size:e,data:a}=GS(n,{ecc:`M`,border:2});r=e,i=a.flatMap(JS).join(``),t[0]=n,t[1]=r,t[2]=i}else r=t[1],i=t[2];let a=i,o=`0 0 ${r} ${r}`,s;t[3]===a?s=t[4]:(s=(0,Q.jsx)(`path`,{d:a,fill:`currentColor`}),t[3]=a,t[4]=s);let c;return t[5]!==o||t[6]!==s?(c=(0,Q.jsx)(`svg`,{role:`img`,"aria-label":`Pairing QR code`,viewBox:o,shapeRendering:`crispEdges`,className:`size-40 shrink-0 rounded-md bg-white text-black`,children:s}),t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function JS(e,t){return e.flatMap((e,n)=>e?[`M${n} ${t}h1v1h-1z`]:[])}function YS(e){let t=(0,$.c)(38),{connection:n,remote:r}=e,i=Pm(r),[a,o]=(0,Z.useState)(``),[s,c]=(0,Z.useState)(null),[l,u]=(0,Z.useState)(!1),[d,f]=sv(n),p;t[0]===d?p=t[1]:(p=R(d)?d.value:null,t[0]=d,t[1]=p);let m=p,h=i.find(e=>{let{url:t}=e;return t===s})??i[0];if(h===void 0){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Turn on a way in under Ways in to pair a phone or another computer.`}),t[2]=e):e=t[2],e}let g=e=>xy(e,async()=>f({label:a.trim(),addresses:[h.url],trusted:l})),_;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(wv,{htmlFor:`pairing-label`,children:`Device name`}),t[3]=_):_=t[3];let v;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>o(e.target.value),t[4]=v):v=t[4];let y;t[5]===a?y=t[6]:(y=(0,Q.jsxs)(kv,{className:`min-w-0 flex-1`,children:[_,(0,Q.jsx)(yy,{id:`pairing-label`,placeholder:`My phone`,maxLength:ve,value:a,onChange:v})]}),t[5]=a,t[6]=y);let b=i.length>1&&(0,Q.jsxs)(kv,{className:`min-w-0 sm:w-56`,children:[(0,Q.jsx)(wv,{htmlFor:`pairing-address`,children:`Opens through`}),(0,Q.jsxs)(Zx,{items:i.map(ZS),value:h.url,onValueChange:e=>{e&&c(e)},children:[(0,Q.jsx)(eS,{id:`pairing-address`,className:`w-full`,children:(0,Q.jsx)($x,{})}),(0,Q.jsx)(tS,{children:i.map(XS)})]})]}),x;t[7]!==d.waiting||t[8]!==a?(x=d.waiting||a.trim()===``,t[7]=d.waiting,t[8]=a,t[9]=x):x=t[9];let S;t[10]===d.waiting?S=t[11]:(S=d.waiting?(0,Q.jsx)($_,{}):(0,Q.jsx)(Ff,{}),t[10]=d.waiting,t[11]=S);let C;t[12]!==x||t[13]!==S?(C=(0,Q.jsxs)(Ro,{type:`submit`,className:`shrink-0`,disabled:x,children:[S,`Create pairing link`]}),t[12]=x,t[13]=S,t[14]=C):C=t[14];let w;t[15]!==C||t[16]!==g||t[17]!==y||t[18]!==b?(w=(0,Q.jsxs)(`form`,{className:`flex flex-col gap-2 sm:flex-row sm:items-end`,onSubmit:g,children:[y,b,C]}),t[15]=C,t[16]=g,t[17]=y,t[18]=b,t[19]=w):w=t[19];let T;t[20]!==u||t[21]!==l?(T=(0,Q.jsx)(Ry,{id:`pairing-trusted`,checked:l,onCheckedChange:u}),t[20]=u,t[21]=l,t[22]=T):T=t[22];let E;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsx)(wv,{htmlFor:`pairing-trusted`,children:`The paired device can update Porcelain`}),t[23]=E):E=t[23];let D;t[24]===T?D=t[25]:(D=(0,Q.jsxs)(kv,{orientation:`horizontal`,children:[T,E]}),t[24]=T,t[25]=D);let O=km[h.route],k;t[26]===O?k=t[27]:(k=(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`The link opens through `,O,`. The device will work only through the way in it pairs over. To use it through another way in too, pair it again through that one.`]}),t[26]=O,t[27]=k);let A;t[28]===d?A=t[29]:(A=kn(d)&&(0,Q.jsx)(X_,{variant:`destructive`,children:(0,Q.jsx)(Q_,{children:oh(Cn(d.cause))})}),t[28]=d,t[29]=A);let j;t[30]===m?j=t[31]:(j=m&&(0,Q.jsxs)(Iv,{variant:`muted`,children:[(0,Q.jsx)(Rv,{children:(0,Q.jsx)(qS,{link:m.link})}),(0,Q.jsxs)(zv,{children:[(0,Q.jsxs)(Bv,{children:[`Scan on `,m.label]}),(0,Q.jsx)(`p`,{"aria-label":`Pairing link`,className:`font-mono text-xs break-all text-muted-foreground`,children:m.link}),(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Works once, until`,` `,new Date(m.expiresAt).toLocaleTimeString(),`.`]}),(0,Q.jsxs)(Ro,{variant:`outline`,size:`sm`,className:`self-start`,onClick:()=>sr(m?.link??``,`pairing link`),children:[(0,Q.jsx)(jf,{}),`Copy link`]})]})]}),t[30]=m,t[31]=j);let M;return t[32]!==w||t[33]!==D||t[34]!==k||t[35]!==A||t[36]!==j?(M=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[w,D,k,A,j]}),t[32]=w,t[33]=D,t[34]=k,t[35]=A,t[36]=j,t[37]=M):M=t[37],M}function XS(e){let{route:t,url:n}=e;return(0,Q.jsx)(rS,{value:n,children:`${km[t]} · ${n}`},n)}function ZS(e){let{route:t,url:n}=e;return{value:n,label:`${km[t]} · ${n}`}}var QS=new Intl.RelativeTimeFormat(`en`,{numeric:`always`});function $S(e,t=Er()){let n=gr(e),r=Ze(n,t),[i,o]=r?[t,n]:[n,t],s=ot(i,o),c=po(s),l=a(),u=(c+_i(an(o,l))-_i(an(i,l)))/po(mt(1)),d,f;return c<po(De(1))?(d=`second`,f=Math.round(vr(s))):c<po(T(1))?(d=`minute`,f=Math.round($e(s))):c<po(mt(1))?(d=`hour`,f=Math.round(ct(s))):u<30?(d=`day`,f=Math.round(u)):u<365?(f=Math.round(u/30),d=f===12?`year`:`month`,d===`year`&&(f=1)):(d=`year`,f=Math.round(u/365)),QS.format(r?f:-f,d)}var eC=yo(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-2xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function tC({className:e,variant:t=`default`,render:n,...r}){return Nv({defaultTagName:`span`,props:Ln({className:K(eC({variant:t}),e)},r),render:n,state:{slot:`badge`,variant:t}})}function nC(e){let t=(0,$.c)(28),{connection:n}=e,r=pv(n),i,a,o,s,c,l,u;if(t[0]!==r||t[1]!==n){u=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Gi(la(r));if(kn(r)){let e;t[9]===r.cause?e=t[10]:(e=oh(Cn(r.cause)),t[9]=r.cause,t[10]=e);let n;t[11]===e?n=t[12]:(n=(0,Q.jsx)(X_,{variant:`destructive`,children:(0,Q.jsx)(Q_,{children:e})}),t[11]=e,t[12]=n),u=n;break bb0}if(!e){let e;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)($_,{}),t[13]=e):e=t[13],u=e;break bb0}l=`flex flex-col gap-2`,i=Pv,a=`list`,o=`Paired devices and links`;let d;t[14]===n?d=t[15]:(d=e=>(0,Q.jsxs)(Iv,{variant:`outline`,size:`sm`,role:`listitem`,"aria-label":e.label,children:[(0,Q.jsxs)(zv,{className:`min-w-0`,children:[(0,Q.jsxs)(Bv,{children:[e.label,e.current&&(0,Q.jsx)(tC,{variant:`secondary`,children:`This browser`}),(0,Q.jsx)(tC,{variant:`outline`,children:Am[e.route]})]}),(0,Q.jsxs)(Vv,{children:[`Last seen `,$S(e.lastSeenAt),` · `,e.platform]}),e.routeInferred&&(0,Q.jsxs)(Vv,{children:[`Paired before each device was tied to one way in, so it now works only through `,Am[e.route],`, where it was last seen. Pair it again to use another way in.`]})]}),(0,Q.jsxs)(Hv,{children:[(0,Q.jsx)(rC,{connection:n,id:e.id,label:e.label,trusted:e.trusted}),!e.current&&(0,Q.jsx)(iC,{connection:n,id:e.id,label:e.label,cancelLink:!1})]})]},e.id),t[14]=n,t[15]=d),s=e.devices.map(d);let f;t[16]===n?f=t[17]:(f=e=>(0,Q.jsxs)(Iv,{variant:`outline`,size:`sm`,role:`listitem`,"aria-label":e.label,children:[(0,Q.jsxs)(zv,{className:`min-w-0`,children:[(0,Q.jsxs)(Bv,{children:[e.label,(0,Q.jsx)(tC,{variant:`outline`,children:`Pending link`})]}),(0,Q.jsxs)(Vv,{children:[`Works once, until`,` `,new Date(e.expiresAt).toLocaleTimeString()]})]}),(0,Q.jsx)(Hv,{children:(0,Q.jsx)(iC,{connection:n,id:e.id,label:e.label,cancelLink:!0})})]},e.id),t[16]=n,t[17]=f),c=e.grants.map(f)}t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u}else i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8];if(u!==Symbol.for(`react.early_return_sentinel`))return u;let d;t[18]!==i||t[19]!==a||t[20]!==o||t[21]!==s||t[22]!==c?(d=(0,Q.jsxs)(i,{role:a,"aria-label":o,children:[s,c]}),t[18]=i,t[19]=a,t[20]=o,t[21]=s,t[22]=c,t[23]=d):d=t[23];let f;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Each device has its own credential, which works only through the way in it was paired over, so a credential seen on one network cannot be used through another. A phone that uses two ways in is paired once through each. Revoking a device signs it out at once and leaves the others alone.`}),t[24]=f):f=t[24];let p;return t[25]!==l||t[26]!==d?(p=(0,Q.jsxs)(`div`,{className:l,children:[d,f]}),t[25]=l,t[26]=d,t[27]=p):p=t[27],p}function rC(e){let t=(0,$.c)(11),{connection:n,id:r,label:i,trusted:a}=e,[o,s]=lv(n,r),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(wv,{"aria-hidden":!0,children:`Can update`}),t[0]=c):c=t[0];let l=`${i} can update Porcelain`,u;t[1]!==s||t[2]!==l||t[3]!==o.waiting||t[4]!==a?(u=(0,Q.jsx)(Ry,{"aria-label":l,checked:a,disabled:o.waiting,onCheckedChange:s}),t[1]=s,t[2]=l,t[3]=o.waiting,t[4]=a,t[5]=u):u=t[5];let d;t[6]===o?d=t[7]:(d=kn(o)&&(0,Q.jsx)(X_,{variant:`destructive`,children:(0,Q.jsx)(Q_,{children:oh(Cn(o.cause))})}),t[6]=o,t[7]=d);let f;return t[8]!==u||t[9]!==d?(f=(0,Q.jsxs)(Q.Fragment,{children:[c,u,d]}),t[8]=u,t[9]=d,t[10]=f):f=t[10],f}function iC(e){let t=(0,$.c)(12),{connection:n,id:r,label:i,cancelLink:a}=e,[o,s]=cv(n,r),c=a?`Cancel the link for ${i}`:`Revoke ${i}`,l;t[0]===s?l=t[1]:(l=()=>s(),t[0]=s,t[1]=l);let u=a?`Cancel`:`Revoke`,d;t[2]!==o.waiting||t[3]!==c||t[4]!==l||t[5]!==u?(d=(0,Q.jsx)(Ro,{size:`sm`,variant:`outline`,"aria-label":c,disabled:o.waiting,onClick:l,children:u}),t[2]=o.waiting,t[3]=c,t[4]=l,t[5]=u,t[6]=d):d=t[6];let f;t[7]===o?f=t[8]:(f=kn(o)&&(0,Q.jsx)(X_,{variant:`destructive`,children:(0,Q.jsx)(Q_,{children:oh(Cn(o.cause))})}),t[7]=o,t[8]=f);let p;return t[9]!==d||t[10]!==f?(p=(0,Q.jsxs)(Q.Fragment,{children:[d,f]}),t[9]=d,t[10]=f,t[11]=p):p=t[11],p}var aC={lan:`Phones and computers on the same Wi-Fi or wired network as this computer, on that one network only.`,tailnet:`Your devices signed in to Tailscale, from anywhere, encrypted and over HTTPS at this computer’s Tailscale name. You set up tailscale serve once; Porcelain checks that it reaches here.`,cloudflare:`Your own Cloudflare tunnel and hostname, over HTTPS from anywhere.`},oC={lan:`Starting`,tailnet:`Checking the Tailscale name`,cloudflare:`Checking the tunnel`};function sC(e){let t=(0,$.c)(19),{name:n,route:r}=e,{status:i}=r;if(i.kind===`off`){let e;return t[0]===r.enabled?e=t[1]:(e=r.enabled?(0,Q.jsxs)(tC,{variant:`outline`,children:[(0,Q.jsx)($_,{}),`Starting`]}):null,t[0]=r.enabled,t[1]=e),e}if(i.kind===`starting`){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)($_,{}),t[2]=e):e=t[2];let r=oC[n],i;return t[3]===r?i=t[4]:(i=(0,Q.jsxs)(tC,{variant:`outline`,children:[e,r]}),t[3]=r,t[4]=i),i}if(i.kind===`paused`){let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(tC,{variant:`outline`,children:`Paused on this network`}),t[5]=e):e=t[5],e}if(i.kind===`failed`){let e;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(tC,{variant:`destructive`,children:`Failed`}),t[6]=e):e=t[6];let r;t[7]!==n||t[8]!==i.reason?(r=Lm(n,i.reason),t[7]=n,t[8]=i.reason,t[9]=r):r=t[9];let a;return t[10]===r?a=t[11]:(a=(0,Q.jsxs)(`div`,{className:`flex flex-col items-start gap-1`,children:[e,(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r})]}),t[10]=r,t[11]=a),a}let a=r.enabled?`On`:`Stopping`,o;t[12]===a?o=t[13]:(o=(0,Q.jsx)(tC,{variant:`secondary`,children:a}),t[12]=a,t[13]=o);let s;t[14]===i.urls?s=t[15]:(s=i.urls.map(cC),t[14]=i.urls,t[15]=s);let c;return t[16]!==o||t[17]!==s?(c=(0,Q.jsxs)(`div`,{className:`flex flex-col items-start gap-1`,children:[o,s]}),t[16]=o,t[17]=s,t[18]=c):c=t[18],c}function cC(e){return(0,Q.jsxs)(`div`,{className:`flex max-w-full items-center gap-1`,children:[(0,Q.jsx)(`span`,{className:`truncate font-mono text-xs text-muted-foreground`,children:e}),(0,Q.jsx)(Ro,{size:`icon-xs`,variant:`ghost`,"aria-label":`Copy ${e}`,onClick:()=>sr(e,`address`),children:(0,Q.jsx)(jf,{})})]},e)}function lC(e){let t=(0,$.c)(24),{name:n,route:r,disabled:i,onChange:a,children:o}=e,s=km[n],c;t[0]===s?c=t[1]:(c=(0,Q.jsx)(Bv,{children:s}),t[0]=s,t[1]=c);let l=aC[n],u;t[2]===l?u=t[3]:(u=(0,Q.jsx)(Vv,{children:l}),t[2]=l,t[3]=u);let d;t[4]!==c||t[5]!==u?(d=(0,Q.jsxs)(zv,{children:[c,u]}),t[4]=c,t[5]=u,t[6]=d):d=t[6];let f;t[7]===a?f=t[8]:(f=e=>a(e),t[7]=a,t[8]=f);let p;t[9]!==i||t[10]!==r.enabled||t[11]!==f||t[12]!==s?(p=(0,Q.jsx)(Hv,{children:(0,Q.jsx)(Ry,{"aria-label":s,checked:r.enabled,disabled:i,onCheckedChange:f})}),t[9]=i,t[10]=r.enabled,t[11]=f,t[12]=s,t[13]=p):p=t[13];let m;t[14]!==n||t[15]!==r?(m=(0,Q.jsx)(sC,{name:n,route:r}),t[14]=n,t[15]=r,t[16]=m):m=t[16];let h;t[17]!==o||t[18]!==m?(h=(0,Q.jsx)(Uv,{children:(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[m,o]})}),t[17]=o,t[18]=m,t[19]=h):h=t[19];let g;return t[20]!==d||t[21]!==p||t[22]!==h?(g=(0,Q.jsxs)(Iv,{variant:`outline`,children:[d,p,h]}),t[20]=d,t[21]=p,t[22]=h,t[23]=g):g=t[23],g}function uC(e){let t=(0,$.c)(13),{remote:n,disabled:r,onTurnOn:i}=e,{lan:a}=n.routes,o=n.localNetwork,s=a.enabled&&a.status.kind===`paused`,c;t[0]!==r||t[1]!==o||t[2]!==i||t[3]!==s?(c=s&&o&&(0,Q.jsxs)(Ro,{variant:`outline`,size:`sm`,className:`self-start`,disabled:r,onClick:i,children:[`Turn on for `,jm(o)]}),t[0]=r,t[1]=o,t[2]=i,t[3]=s,t[4]=c):c=t[4];let l;t[5]===n?l=t[6]:(l=Mm(n),t[5]=n,t[6]=l);let u;t[7]===l?u=t[8]:(u=(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l}),t[7]=l,t[8]=u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsxs)(X_,{role:`note`,"aria-label":`Local network warning`,children:[(0,Q.jsx)(Vf,{}),(0,Q.jsx)(Z_,{children:`Not encrypted`}),(0,Q.jsx)(Q_,{children:`Anyone on the same network can read what Porcelain shows and the device credentials it sends. For an encrypted connection, use Tailscale.`})]}),t[9]=d):d=t[9];let f;return t[10]!==c||t[11]!==u?(f=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[c,u,d]}),t[10]=c,t[11]=u,t[12]=f):f=t[12],f}function dC(e){let t=(0,$.c)(25),{label:n,saveLabel:r,placeholder:i,saved:a,failed:o,disabled:s,onSave:c,onCheck:l}=e,[u,d]=(0,Z.useState)(null),f=u??a,p;t[0]!==f||t[1]!==c?(p=e=>xy(e,async()=>{c(f.trim()),d(null)}),t[0]=f,t[1]=c,t[2]=p):p=t[2];let m;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(m=e=>d(e.target.value),t[3]=m):m=t[3];let h;t[4]!==s||t[5]!==f||t[6]!==n||t[7]!==i?(h=(0,Q.jsx)(yy,{"aria-label":n,placeholder:i,value:f,disabled:s,onChange:m}),t[4]=s,t[5]=f,t[6]=n,t[7]=i,t[8]=h):h=t[8];let g;t[9]!==s||t[10]!==f||t[11]!==a?(g=s||f.trim()===``||f.trim()===a,t[9]=s,t[10]=f,t[11]=a,t[12]=g):g=t[12];let _;t[13]!==r||t[14]!==g?(_=(0,Q.jsx)(Ro,{type:`submit`,variant:`outline`,className:`shrink-0`,disabled:g,children:r}),t[13]=r,t[14]=g,t[15]=_):_=t[15];let v;t[16]!==s||t[17]!==o||t[18]!==l?(v=o&&(0,Q.jsx)(Ro,{type:`button`,variant:`outline`,className:`shrink-0`,disabled:s,onClick:l,children:`Check again`}),t[16]=s,t[17]=o,t[18]=l,t[19]=v):v=t[19];let y;return t[20]!==p||t[21]!==h||t[22]!==_||t[23]!==v?(y=(0,Q.jsxs)(`form`,{className:`flex flex-col gap-2 sm:flex-row`,onSubmit:p,children:[h,_,v]}),t[20]=p,t[21]=h,t[22]=_,t[23]=v,t[24]=y):y=t[24],y}function fC(e){let t=(0,$.c)(20),{remote:n,disabled:r,onSave:i,onCheck:a}=e,o=n.routes.tailnet,s;t[0]===n.tailnetTarget?s=t[1]:(s=n.tailnetTarget===void 0?void 0:Im(n.tailnetTarget),t[0]=n.tailnetTarget,t[1]=s);let c=s,l=n.tailnetHostname??``,u=o.enabled&&o.status.kind===`failed`,d;t[2]!==r||t[3]!==a||t[4]!==i||t[5]!==l||t[6]!==u?(d=(0,Q.jsx)(dC,{label:`Tailscale name`,saveLabel:`Save name`,placeholder:`laptop.tail1234.ts.net`,saved:l,failed:u,disabled:r,onSave:i,onCheck:a}),t[2]=r,t[3]=a,t[4]=i,t[5]=l,t[6]=u,t[7]=d):d=t[7];let f;t[8]===n.tailnetHostname?f=t[9]:(f=n.tailnetHostname===void 0&&(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Save this computer’s name on your tailnet, as tailscale status or the Tailscale admin console shows it, to turn this on. Porcelain then names the one command to run.`}),t[8]=n.tailnetHostname,t[9]=f);let p;t[10]!==n.tailnetHostname||t[11]!==o.enabled?(p=n.tailnetHostname!==void 0&&!o.enabled&&(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`If you set up tailscale serve for Porcelain, remove it with tailscale serve --https=443 off, or Tailscale keeps forwarding to a port Porcelain no longer holds.`}),t[10]=n.tailnetHostname,t[11]=o.enabled,t[12]=p):p=t[12];let m;t[13]===c?m=t[14]:(m=c!==void 0&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Run this once on this computer. Tailscale keeps it across restarts; remove it with tailscale serve --https=443 off.`}),(0,Q.jsxs)(`div`,{className:`flex max-w-full items-center gap-1`,children:[(0,Q.jsx)(`code`,{className:`truncate rounded bg-muted px-1.5 py-0.5 font-mono text-xs`,children:c}),(0,Q.jsx)(Ro,{size:`icon-xs`,variant:`ghost`,"aria-label":`Copy the tailscale serve command`,onClick:()=>sr(c,`command`),children:(0,Q.jsx)(jf,{})})]})]}),t[13]=c,t[14]=m);let h;return t[15]!==d||t[16]!==f||t[17]!==p||t[18]!==m?(h=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[d,f,p,m]}),t[15]=d,t[16]=f,t[17]=p,t[18]=m,t[19]=h):h=t[19],h}function pC(e){let t=(0,$.c)(11),{remote:n,disabled:r,onSave:i,onCheck:a}=e,o=n.routes.cloudflare,s=n.cloudflareHostname??``,c=o.enabled&&o.status.kind===`failed`,l;t[0]!==r||t[1]!==a||t[2]!==i||t[3]!==s||t[4]!==c?(l=(0,Q.jsx)(dC,{label:`Public hostname`,saveLabel:`Save hostname`,placeholder:`porcelain.example.com`,saved:s,failed:c,disabled:r,onSave:i,onCheck:a}),t[0]=r,t[1]=a,t[2]=i,t[3]=s,t[4]=c,t[5]=l):l=t[5];let u;t[6]===n.serviceUrl?u=t[7]:(u=(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`In Cloudflare, publish this hostname from your tunnel to`,` `,(0,Q.jsx)(`span`,{className:`font-mono`,children:n.serviceUrl}),`, and run cloudflared on this computer as a service. Porcelain answers to the hostname only while this is on.`]}),t[6]=n.serviceUrl,t[7]=u);let d;return t[8]!==l||t[9]!==u?(d=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[l,u]}),t[8]=l,t[9]=u,t[10]=d):d=t[10],d}function mC(e){let t=(0,$.c)(54),{connection:n,remote:r}=e,[i,a]=uv(n),o=i.waiting,s=o||!r.routes.lan.enabled&&r.localNetwork===void 0,c;t[0]===a?c=t[1]:(c=e=>a({lan:e}),t[0]=a,t[1]=c);let l;t[2]===a?l=t[3]:(l=()=>a({lan:!0}),t[2]=a,t[3]=l);let u;t[4]!==o||t[5]!==r||t[6]!==l?(u=(0,Q.jsx)(uC,{remote:r,disabled:o,onTurnOn:l}),t[4]=o,t[5]=r,t[6]=l,t[7]=u):u=t[7];let d;t[8]!==r.routes.lan||t[9]!==s||t[10]!==c||t[11]!==u?(d=(0,Q.jsx)(Pv,{children:(0,Q.jsx)(lC,{name:`lan`,route:r.routes.lan,disabled:s,onChange:c,children:u})}),t[8]=r.routes.lan,t[9]=s,t[10]=c,t[11]=u,t[12]=d):d=t[12];let f=o||r.tailnetHostname===void 0,p;t[13]===a?p=t[14]:(p=e=>a({tailnet:e}),t[13]=a,t[14]=p);let m;t[15]!==r.tailnetHostname||t[16]!==a?(m=e=>a({tailnetHostname:e,...r.tailnetHostname===void 0?{tailnet:!0}:{}}),t[15]=r.tailnetHostname,t[16]=a,t[17]=m):m=t[17];let h;t[18]===a?h=t[19]:(h=()=>a({tailnet:!0}),t[18]=a,t[19]=h);let g;t[20]!==o||t[21]!==r||t[22]!==m||t[23]!==h?(g=(0,Q.jsx)(fC,{remote:r,disabled:o,onSave:m,onCheck:h}),t[20]=o,t[21]=r,t[22]=m,t[23]=h,t[24]=g):g=t[24];let _;t[25]!==r.routes.tailnet||t[26]!==g||t[27]!==f||t[28]!==p?(_=(0,Q.jsx)(Pv,{children:(0,Q.jsx)(lC,{name:`tailnet`,route:r.routes.tailnet,disabled:f,onChange:p,children:g})}),t[25]=r.routes.tailnet,t[26]=g,t[27]=f,t[28]=p,t[29]=_):_=t[29];let v=o||r.cloudflareHostname===void 0,y;t[30]===a?y=t[31]:(y=e=>a({cloudflare:e}),t[30]=a,t[31]=y);let b;t[32]!==r.cloudflareHostname||t[33]!==a?(b=e=>a({cloudflareHostname:e,...r.cloudflareHostname===void 0?{cloudflare:!0}:{}}),t[32]=r.cloudflareHostname,t[33]=a,t[34]=b):b=t[34];let x;t[35]===a?x=t[36]:(x=()=>a({cloudflare:!0}),t[35]=a,t[36]=x);let S;t[37]!==o||t[38]!==r||t[39]!==b||t[40]!==x?(S=(0,Q.jsx)(pC,{remote:r,disabled:o,onSave:b,onCheck:x}),t[37]=o,t[38]=r,t[39]=b,t[40]=x,t[41]=S):S=t[41];let C;t[42]!==r.routes.cloudflare||t[43]!==v||t[44]!==y||t[45]!==S?(C=(0,Q.jsx)(Pv,{children:(0,Q.jsx)(lC,{name:`cloudflare`,route:r.routes.cloudflare,disabled:v,onChange:y,children:S})}),t[42]=r.routes.cloudflare,t[43]=v,t[44]=y,t[45]=S,t[46]=C):C=t[46];let w;t[47]===i?w=t[48]:(w=kn(i)&&(0,Q.jsx)(X_,{variant:`destructive`,children:(0,Q.jsx)(Q_,{children:oh(Cn(i.cause))})}),t[47]=i,t[48]=w);let T;return t[49]!==_||t[50]!==C||t[51]!==w||t[52]!==d?(T=(0,Q.jsxs)(Q.Fragment,{children:[d,_,C,w]}),t[49]=_,t[50]=C,t[51]=w,t[52]=d,t[53]=T):T=t[53],T}function hC(e){let t=(0,$.c)(10),{connection:n,children:r}=e,i=mv(n),a,o;if(t[0]!==r||t[1]!==i){o=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Gi(la(i));if(e===null){let e;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Sharing is managed from a browser on the computer that runs Porcelain.`}),t[4]=e):e=t[4],o=e;break bb0}if(kn(i)){let e;t[5]===i.cause?e=t[6]:(e=oh(Cn(i.cause)),t[5]=i.cause,t[6]=e);let n;t[7]===e?n=t[8]:(n=(0,Q.jsx)(X_,{variant:`destructive`,children:(0,Q.jsx)(Q_,{children:e})}),t[7]=e,t[8]=n),o=n;break bb0}if(!e){let e;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)($_,{}),t[9]=e):e=t[9],o=e;break bb0}a=r(e)}t[0]=r,t[1]=i,t[2]=a,t[3]=o}else a=t[2],o=t[3];return o===Symbol.for(`react.early_return_sentinel`)?a:o}function gC(){return k_(),null}function _C(e){let t=(0,$.c)(3),{desktop:n}=e;if(n===!0){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(Oy,{}),t[0]=e):e=t[0],e}if(n===!1){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(Sv,{}),t[1]=e):e=t[1],e}let r;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)($_,{}),t[2]=r):r=t[2],r}function vC(e){let t=(0,$.c)(4),{environment:n}=e,r=gC(),i=Gi(la(Zv())),a;return t[0]!==r||t[1]!==i?.isDesktopShell||t[2]!==n?(a=r&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Pv,{children:(0,Q.jsx)(Iv,{variant:`outline`,children:(0,Q.jsx)(zv,{children:(0,Q.jsx)(Sy,{connection:r,environment:n})})})}),(0,Q.jsxs)(Tv,{children:[(0,Q.jsx)(Ev,{variant:`label`,children:`Updates`}),(0,Q.jsx)(Pv,{children:(0,Q.jsx)(Iv,{variant:`outline`,children:(0,Q.jsx)(zv,{children:(0,Q.jsx)(_C,{desktop:i?.isDesktopShell})})})})]})]}),t[0]=r,t[1]=i?.isDesktopShell,t[2]=n,t[3]=a):a=t[3],a}function yC(){let e=(0,$.c)(2),t=gC(),n;return e[0]===t?n=e[1]:(n=t&&(0,Q.jsx)(hC,{connection:t,children:e=>(0,Q.jsx)(mC,{connection:t,remote:e})}),e[0]=t,e[1]=n),n}function bC(e){let t=(0,$.c)(3),{environment:n}=e,r=gC(),i;return t[0]!==r||t[1]!==n?(i=r&&(0,Q.jsx)(hC,{connection:r,children:e=>(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(Tv,{children:[(0,Q.jsx)(Ev,{variant:`label`,children:`Pair a device`}),(0,Q.jsx)(Pv,{children:(0,Q.jsx)(Iv,{variant:`outline`,children:(0,Q.jsxs)(zv,{children:[(0,Q.jsxs)(Vv,{children:[`Open the link or scan the code on the other device to connect it to `,n.name,`. Each link works once, for a few minutes.`]}),(0,Q.jsx)(YS,{connection:r,remote:e})]})})})]}),(0,Q.jsxs)(Tv,{children:[(0,Q.jsx)(Ev,{variant:`label`,children:`Paired devices`}),(0,Q.jsx)(nC,{connection:r})]})]})}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function xC({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`empty`,className:K(`flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-3xl border-dashed p-12 text-center text-balance`,e),...t})}function SC({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`empty-header`,className:K(`flex max-w-sm flex-col items-center gap-2`,e),...t})}var CC=yo(`mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{default:`bg-transparent`,icon:`flex size-10 shrink-0 items-center justify-center rounded-xl bg-muted text-foreground [&_svg:not([class*='size-'])]:size-5`}},defaultVariants:{variant:`default`}});function wC({className:e,variant:t=`default`,...n}){return(0,Q.jsx)(`div`,{"data-slot":`empty-icon`,"data-variant":t,className:K(CC({variant:t,className:e})),...n})}function TC({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`empty-title`,className:K(`font-heading text-lg font-medium tracking-tight`,e),...t})}function EC({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`empty-description`,className:K(`text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...t})}function DC({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`empty-content`,className:K(`flex w-full max-w-sm min-w-0 flex-col items-center gap-4 text-sm text-balance`,e),...t})}var OC=[{value:`all`,label:`All computers`},{value:`online`,label:`Online`},{value:`offline`,label:`Offline`},{value:`attention`,label:`Needs attention`}];function kC(e){let t=(0,$.c)(20),{remote:n,search:r,filter:i,onOpen:a}=e,o=J_(n),s=o.kind===`online`?o.name:n.name;if(!`${s} ${n.address} ${n.environmentId}`.toLowerCase().includes(r.trim().toLowerCase())||i===`online`&&o.kind!==`online`||i===`offline`&&o.kind!==`offline`||i===`attention`&&(o.kind===`online`||o.kind===`checking`))return null;let c;t[0]!==a||t[1]!==n.environmentId?(c=()=>a(n.environmentId),t[0]=a,t[1]=n.environmentId,t[2]=c):c=t[2];let l;t[3]===s?l=t[4]:(l=(0,Q.jsx)(`span`,{className:`block truncate font-medium`,children:s}),t[3]=s,t[4]=l);let u=n.address,d;t[5]===n.environmentId?d=t[6]:(d=n.environmentId.slice(0,8),t[5]=n.environmentId,t[6]=d);let f;t[7]!==n.address||t[8]!==d?(f=(0,Q.jsxs)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:[u,` · `,d]}),t[7]=n.address,t[8]=d,t[9]=f):f=t[9];let p;t[10]!==l||t[11]!==f?(p=(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[l,f]}),t[10]=l,t[11]=f,t[12]=p):p=t[12];let m;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(kf,{}),t[13]=m):m=t[13];let h;t[14]!==c||t[15]!==p?(h=(0,Q.jsx)(zv,{children:(0,Q.jsxs)(Ro,{variant:`ghost`,className:`h-auto w-full justify-between text-left`,onClick:c,children:[p,m]})}),t[14]=c,t[15]=p,t[16]=h):h=t[16];let g;return t[17]!==s||t[18]!==h?(g=(0,Q.jsx)(Iv,{variant:`outline`,size:`sm`,role:`listitem`,"aria-label":s,children:h}),t[17]=s,t[18]=h,t[19]=g):g=t[19],g}function AC(){let e=(0,$.c)(27),[t,n]=(0,Z.useState)(``),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>n(``),e[0]=r):r=e[0];let i=H_(r),{status:a}=O_(),o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(Vv,{children:`On the other computer, run porcelain pair and paste the link it prints. This app keeps its own credential for that computer.`}),e[1]=o):o=e[1];let s;e[2]!==i||e[3]!==t?(s=e=>xy(e,()=>i.submit(t)),e[2]=i,e[3]=t,e[4]=s):s=e[4];let c=i.result.waiting||a!==`ready`,l;e[5]===i?l=e[6]:(l=e=>{i.reset(),n(e.target.value)},e[5]=i,e[6]=l);let u;e[7]!==t||e[8]!==c||e[9]!==l?(u=(0,Q.jsx)(yy,{"aria-label":`Pairing link`,placeholder:`http://192.168.1.20:4738/pair#c=…`,value:t,disabled:c,onChange:l}),e[7]=t,e[8]=c,e[9]=l,e[10]=u):u=e[10];let d;e[11]!==i.result.waiting||e[12]!==t||e[13]!==a?(d=i.result.waiting||a!==`ready`||t.trim()===``,e[11]=i.result.waiting,e[12]=t,e[13]=a,e[14]=d):d=e[14];let f=i.result.waiting?`Pairing…`:`Add`,p;e[15]!==d||e[16]!==f?(p=(0,Q.jsx)(Ro,{type:`submit`,className:`shrink-0`,disabled:d,children:f}),e[15]=d,e[16]=f,e[17]=p):p=e[17];let m;e[18]!==s||e[19]!==u||e[20]!==p?(m=(0,Q.jsxs)(`form`,{className:`flex flex-col gap-2 sm:flex-row`,onSubmit:s,children:[u,p]}),e[18]=s,e[19]=u,e[20]=p,e[21]=m):m=e[21];let h;e[22]===i.result?h=e[23]:(h=kn(i.result)&&(0,Q.jsx)(X_,{variant:`destructive`,children:(0,Q.jsx)(Q_,{children:oh(Cn(i.result.cause))})}),e[22]=i.result,e[23]=h);let g;return e[24]!==h||e[25]!==m?(g=(0,Q.jsx)(Iv,{variant:`outline`,children:(0,Q.jsxs)(zv,{children:[o,m,h]})}),e[24]=h,e[25]=m,e[26]=g):g=e[26],g}function jC(e){let t=(0,$.c)(31),{onOpen:n}=e,[r,i]=(0,Z.useState)(``),[a,o]=(0,Z.useState)(`all`),{remotes:s,error:c}=O_(),l=G_(),u;t[0]!==l||t[1]!==c?(u=c!==void 0&&(0,Q.jsxs)(X_,{variant:`destructive`,children:[(0,Q.jsx)(Nf,{}),(0,Q.jsx)(Z_,{children:`Saved remote computers could not be read`}),(0,Q.jsxs)(Q_,{children:[`Porcelain keeps them as they are and saves no change over them. Allow Porcelain to read its saved credentials, then try again.`,` `,c,(0,Q.jsx)(Ro,{variant:`outline`,disabled:l.result.waiting,onClick:()=>l.read(),children:`Read saved environments`})]})]}),t[0]=l,t[1]=c,t[2]=u):u=t[2];let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(Ev,{variant:`label`,children:`Add a remote computer`}),t[3]=d):d=t[3];let f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsxs)(Tv,{children:[d,(0,Q.jsx)(Pv,{children:(0,Q.jsx)(AC,{})})]}),t[4]=f):f=t[4];let p;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(Ev,{variant:`label`,children:`Remote computers`}),t[5]=p):p=t[5];let m;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(m=e=>i(e.target.value),t[6]=m):m=t[6];let h;t[7]===r?h=t[8]:(h=(0,Q.jsx)(yy,{"aria-label":`Search remote computers`,placeholder:`Search name or address`,value:r,onChange:m}),t[7]=r,t[8]=h);let g;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(g=e=>{e&&o(e)},t[9]=g):g=t[9];let _;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(eS,{"aria-label":`Computer status`,children:(0,Q.jsx)($x,{})}),t[10]=_):_=t[10];let v;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(tS,{children:OC.map(NC)}),t[11]=v):v=t[11];let y;t[12]===a?y=t[13]:(y=(0,Q.jsxs)(Zx,{items:OC,value:a,onValueChange:g,children:[_,v]}),t[12]=a,t[13]=y);let b;t[14]!==y||t[15]!==h?(b=(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[h,y]}),t[14]=y,t[15]=h,t[16]=b):b=t[16];let x;t[17]!==a||t[18]!==n||t[19]!==s||t[20]!==r?(x=s.length===0?(0,Q.jsx)(xC,{children:(0,Q.jsxs)(SC,{children:[(0,Q.jsx)(wC,{variant:`icon`,children:(0,Q.jsx)(Lf,{})}),(0,Q.jsx)(TC,{children:`No remote computers yet`}),(0,Q.jsx)(EC,{children:`Add one to review its projects from this app, next to the projects on this computer.`})]})}):(0,Q.jsx)(Pv,{"aria-label":`Remote computers`,className:`peer`,children:[...s].sort(MC).map(e=>(0,Q.jsx)(kC,{remote:e,search:r,filter:a,onOpen:n},e.environmentId))}),t[17]=a,t[18]=n,t[19]=s,t[20]=r,t[21]=x):x=t[21];let S;t[22]===s.length?S=t[23]:(S=s.length>0&&(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground peer-has-[[role=listitem]]:hidden`,role:`status`,children:`No computers match this search and filter.`}),t[22]=s.length,t[23]=S);let C;t[24]!==b||t[25]!==x||t[26]!==S?(C=(0,Q.jsxs)(Tv,{children:[p,b,x,S]}),t[24]=b,t[25]=x,t[26]=S,t[27]=C):C=t[27];let w;return t[28]!==u||t[29]!==C?(w=(0,Q.jsxs)(Q.Fragment,{children:[u,f,C]}),t[28]=u,t[29]=C,t[30]=w):w=t[30],w}function MC(e,t){return e.name.localeCompare(t.name)||e.environmentId.localeCompare(t.environmentId)}function NC(e){return(0,Q.jsx)(rS,{value:e.value,children:e.label},e.value)}function PC(e){let t=(0,$.c)(18),{name:n,status:r,onOpenRemotes:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(wC,{variant:`icon`,children:(0,Q.jsx)(zf,{})}),t[0]=a):a=t[0];let o;t[1]===r?o=t[2]:(o=Jp(r),t[1]=r,t[2]=o);let s;t[3]!==n||t[4]!==o?(s=(0,Q.jsxs)(TC,{children:[n,`: `,o]}),t[3]=n,t[4]=o,t[5]=s):s=t[5];let c;t[6]===r?c=t[7]:(c=Yp(r),t[6]=r,t[7]=c);let l;t[8]===c?l=t[9]:(l=(0,Q.jsx)(EC,{children:c}),t[8]=c,t[9]=l);let u;t[10]!==s||t[11]!==l?(u=(0,Q.jsxs)(SC,{children:[a,s,l]}),t[10]=s,t[11]=l,t[12]=u):u=t[12];let d;t[13]===i?d=t[14]:(d=(0,Q.jsx)(DC,{children:(0,Q.jsx)(Ro,{variant:`outline`,onClick:i,children:`Computer settings`})}),t[13]=i,t[14]=d);let f;return t[15]!==u||t[16]!==d?(f=(0,Q.jsxs)(xC,{children:[u,d]}),t[15]=u,t[16]=d,t[17]=f):f=t[17],f}var FC=To(Mt.layer).atom(H(function*(){return Jr()}));function IC(){let e=(0,$.c)(8),t=En(FC),n;e[0]===t?n=e[1]:(n=Gi(ki(la(t))),e[0]=t,e[1]=n);let r;e[2]===t?r=e[3]:(r=kn(t),e[2]=t,e[3]=r);let i=vn(FC),a;return e[4]!==n||e[5]!==r||e[6]!==i?(a={configuration:n,failed:r,retry:i},e[4]=n,e[5]=r,e[6]=i,e[7]=a):a=e[7],a}function LC(e){let{remote:t}=e,n=J_(t);return n.kind===`online`?n.name:t.name}function RC(e){let t=(0,$.c)(10),{environmentId:n,onForgotten:r}=e,{remotes:i,status:a,error:o}=O_(),s;if(t[0]!==n||t[1]!==i){let e;t[3]===n?e=t[4]:(e=e=>e.environmentId===n,t[3]=n,t[4]=e),s=i.find(e),t[0]=n,t[1]=i,t[2]=s}else s=t[2];let c=s;if(!c){let e=a===`ready`?`This computer is no longer saved on this app. Return to Remote computers to add it again.`:o??`Reading saved remote computers…`,n;return t[5]===e?n=t[6]:(n=(0,Q.jsx)(X_,{children:(0,Q.jsx)(Q_,{children:e})}),t[5]=e,t[6]=n),n}let l;return t[7]!==r||t[8]!==c?(l=(0,Q.jsx)(zC,{remote:c,onForgotten:r}),t[7]=r,t[8]=c,t[9]=l):l=t[9],l}function zC(e){let t=(0,$.c)(65),{remote:n,onForgotten:r}=e,i=J_(n),a=j_(n.environmentId),o=U_(n,r),s=i.kind===`online`,c=s?i.name:n.name,l;t[0]===i?l=t[1]:(l=Yp(i),t[0]=i,t[1]=l);let u=l,d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(Ev,{variant:`label`,children:`Overview`}),t[2]=d):d=t[2];let f;t[3]===i?f=t[4]:(f=Hh(i),t[3]=i,t[4]=f);let p;t[5]===i?p=t[6]:(p=Jp(i),t[5]=i,t[6]=p);let m;t[7]!==f||t[8]!==p?(m=(0,Q.jsx)(tC,{variant:f,children:p}),t[7]=f,t[8]=p,t[9]=m):m=t[9];let h;t[10]!==c||t[11]!==m?(h=(0,Q.jsxs)(Bv,{children:[c,` `,m]}),t[10]=c,t[11]=m,t[12]=h):h=t[12];let g;t[13]===u?g=t[14]:(g=u&&(0,Q.jsx)(Vv,{children:u}),t[13]=u,t[14]=g);let _;t[15]===s?_=t[16]:(_=!s&&(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Saved details · Stale. This computer has not been verified online.`}),t[15]=s,t[16]=_);let v;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Address`}),t[17]=v):v=t[17];let y;t[18]===n.address?y=t[19]:(y=(0,Q.jsxs)(`div`,{children:[v,(0,Q.jsx)(`dd`,{className:`break-all font-mono`,children:n.address})]}),t[18]=n.address,t[19]=y);let b;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Environment ID`}),t[20]=b):b=t[20];let x;t[21]===n.environmentId?x=t[22]:(x=(0,Q.jsxs)(`div`,{children:[b,(0,Q.jsx)(`dd`,{className:`break-all font-mono`,children:n.environmentId})]}),t[21]=n.environmentId,t[22]=x);let S;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Porcelain version`}),t[23]=S):S=t[23];let C=s?i.version??`Not reported`:`Unavailable while this computer is not online`,w;t[24]===C?w=t[25]:(w=(0,Q.jsxs)(`div`,{children:[S,(0,Q.jsx)(`dd`,{children:C})]}),t[24]=C,t[25]=w);let T;t[26]===n.deviceId?T=t[27]:(T=n.deviceId&&(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`This app’s device ID`}),(0,Q.jsx)(`dd`,{className:`break-all font-mono`,children:n.deviceId})]}),t[26]=n.deviceId,t[27]=T);let E;t[28]!==y||t[29]!==x||t[30]!==w||t[31]!==T?(E=(0,Q.jsxs)(`dl`,{className:`grid gap-3 text-sm`,children:[y,x,w,T]}),t[28]=y,t[29]=x,t[30]=w,t[31]=T,t[32]=E):E=t[32];let D;t[33]!==E||t[34]!==h||t[35]!==g||t[36]!==_?(D=(0,Q.jsx)(Iv,{variant:`outline`,children:(0,Q.jsxs)(zv,{children:[h,g,_,E]})}),t[33]=E,t[34]=h,t[35]=g,t[36]=_,t[37]=D):D=t[37];let O;t[38]!==a||t[39]!==c||t[40]!==s||t[41]!==n.deviceId?(O=s&&a&&(0,Q.jsx)(Iv,{variant:`outline`,children:(0,Q.jsx)(zv,{children:(0,Q.jsx)(Cv,{connection:a.connection,name:c,deviceId:n.deviceId})})}),t[38]=a,t[39]=c,t[40]=s,t[41]=n.deviceId,t[42]=O):O=t[42];let k;t[43]!==D||t[44]!==O?(k=(0,Q.jsxs)(Tv,{children:[d,(0,Q.jsxs)(Pv,{children:[D,O]})]}),t[43]=D,t[44]=O,t[45]=k):k=t[45];let A;t[46]===s?A=t[47]:(A=!s&&(0,Q.jsx)(Iv,{variant:`outline`,children:(0,Q.jsxs)(zv,{children:[(0,Q.jsx)(Bv,{children:`Pair again`}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`On this computer, run porcelain pair. Return to Remote computers and add the new link to replace this app’s saved connection.`})]})}),t[46]=s,t[47]=A);let j;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(Ev,{variant:`label`,children:`Forget on this app`}),t[48]=j):j=t[48];let M;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Removes this computer and its saved credential from this app. It does not revoke host credentials or stop sharing on that computer. Save or discard unsaved file drafts before forgetting this computer.`}),t[49]=M):M=t[49];let N;t[50]===o?N=t[51]:(N=()=>void o.submit(),t[50]=o,t[51]=N);let P=o.result.waiting?`Forgetting…`:`Forget on this app`,F;t[52]!==o.result.waiting||t[53]!==N||t[54]!==P?(F=(0,Q.jsx)(Ro,{variant:`destructive`,className:`w-fit`,disabled:o.result.waiting,onClick:N,children:P}),t[52]=o.result.waiting,t[53]=N,t[54]=P,t[55]=F):F=t[55];let I;t[56]===o.result?I=t[57]:(I=kn(o.result)&&(0,Q.jsx)(X_,{variant:`destructive`,children:(0,Q.jsx)(Q_,{children:oh(Cn(o.result.cause))})}),t[56]=o.result,t[57]=I);let L;t[58]!==F||t[59]!==I?(L=(0,Q.jsxs)(Tv,{children:[j,(0,Q.jsx)(Iv,{variant:`outline`,children:(0,Q.jsxs)(zv,{children:[M,F,I]})})]}),t[58]=F,t[59]=I,t[60]=L):L=t[60];let R;return t[61]!==k||t[62]!==A||t[63]!==L?(R=(0,Q.jsxs)(Q.Fragment,{children:[k,A,L]}),t[61]=k,t[62]=A,t[63]=L,t[64]=R):R=t[64],R}export{Vv as $,Fd as $n,Ag as $t,mx as A,jf as An,l_ as At,xb as B,Wd as Bn,Jg as Bt,Ix as C,am as Cn,Uc as Cr,F_ as Ct,px as D,Wf as Dn,A_ as Dt,fx as E,qf as En,Bc as Er,j_ as Et,sx as F,Sf as Fn,a_ as Ft,Ry as G,jd as Gn,Lg as Gt,hb as H,Nd as Hn,Vg as Ht,rx as I,yf as In,Qg as It,yy as J,Vd as Jn,Pg as Jt,by as K,Id as Kn,zg as Kt,tx as L,af as Ln,Ug as Lt,vx as M,Df as Mn,o_ as Mt,yx as N,Tf as Nn,$g as Nt,ux as O,Uf as On,D_ as Ot,lx as P,Cf as Pn,r_ as Pt,zv as Q,zd as Qn,kg as Qt,Hb as R,nf as Rn,Gg as Rt,$x as S,Qm as Sn,Kc as Sr,P_ as St,dx as T,Jp as Tn,Vc as Tr,k_ as Tt,mb as U,Rd as Un,qg as Ut,_b as V,Ad as Vn,Hg as Vt,By as W,Ld as Wn,Rg as Wt,Iv as X,Md as Xn,Fg as Xt,my as Y,Hd as Yn,jg as Yt,Hv as Z,Ud as Zn,Mg as Zt,tS as _,Ah as _n,tl as _r,Q_ as _t,jC as a,yg as an,vu as ar,Dv as at,nS as b,bh as bn,$c as br,W_ as bt,SC as c,ag as cn,su as cr,Tv as ct,vC as d,Uh as dn,nu as dr,ov as dt,Og as en,kd as er,Pv as et,bC as f,Hh as fn,zl as fr,av as ft,Zx as g,Nh as gn,rl as gr,X_ as gt,$S as h,Ph as hn,al as hr,$_ as ht,PC as i,_g as in,yu as ir,Mv as it,gx as j,kf as jn,s_ as jt,hx as k,Lf as kn,c_ as kt,wC as l,Yh as ln,au as lr,wv as lt,tC as m,Ih as mn,ll as mr,nv as mt,RC as n,wg as nn,Dd as nr,Nv as nt,xC as o,gg as on,cu as or,Av as ot,yC as p,Rh as pn,Rl as pr,rv as pt,xy as q,Bd as qn,Bg as qt,IC as r,vg as rn,Su as rr,kv as rt,EC as s,og as sn,lu as sr,Ev as st,LC as t,Tg as tn,Od as tr,Bv as tt,TC as u,Xh as un,ou as ur,Sv as ut,Qx as v,Oh as vn,nl as vr,J_ as vt,wx as w,Yp as wn,Gc as wr,M_ as wt,eS as x,oh as xn,Wc as xr,L_ as xt,rS as y,Dh as yn,el as yr,q_ as yt,Nb as z,tf as zn,Kg as zt};
|