@puddle-code/cli 0.0.48 → 0.0.49
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/CHANGELOG.md +4 -2
- package/dist/index.js +3 -2
- package/dist/public/assets/{Dashboard-ClYJ7GP5.js → Dashboard-zsMap8E4.js} +1 -1
- package/dist/public/assets/{EditorTabClose-CCO1bJrk.js → EditorTabClose-BKd4KqeO.js} +1 -1
- package/dist/public/assets/{LazyTerminal-C4ZOFMV2.js → LazyTerminal-BCKBws3s.js} +2 -2
- package/dist/public/assets/{ModelRefcount-BNGeKYRW.js → ModelRefcount-DPfahuWS.js} +1 -1
- package/dist/public/assets/{PaneEditorBody-lW0sWUp-.js → PaneEditorBody-BBt1St2c.js} +1 -1
- package/dist/public/assets/{SettingsDialog-0U_i6fIe.js → SettingsDialog-CfKUNhDh.js} +1 -1
- package/dist/public/assets/Terminal-BvUtshI0.js +60 -0
- package/dist/public/assets/{Workspace-BxaRd4vg.js → Workspace-BSAsXMOL.js} +2 -2
- package/dist/public/assets/{buffer-store-QUrv_c16.js → buffer-store-CQmyMib2.js} +2 -2
- package/dist/public/assets/{context-menu-BqhbQoDl.js → context-menu-D7fxOw4-.js} +1 -1
- package/dist/public/assets/{cssMode-Dc8XIR9E.js → cssMode-Ckycpstb.js} +1 -1
- package/dist/public/assets/{editor-sync-Du7zTmn2.js → editor-sync-BDCiPHdG.js} +1 -1
- package/dist/public/assets/{file-links-CCKIeuis.js → file-links-C3V-zpk_.js} +1 -1
- package/dist/public/assets/{htmlMode-BIVXiQRd.js → htmlMode-HGYiSeRc.js} +1 -1
- package/dist/public/assets/index-DmwsGjw6.js +10 -0
- package/dist/public/assets/{jsonMode-Cqd6vDjw.js → jsonMode-C-fCnP51.js} +1 -1
- package/dist/public/assets/{session-seed-CFzVcK9k.js → session-seed-BEWxqj6q.js} +1 -1
- package/dist/public/assets/{tsMode-CbizgDUm.js → tsMode-DW4qJ6Fk.js} +1 -1
- package/dist/public/assets/{use-find-controls-DuVCN2o_.js → use-find-controls-Dqu5qm6L.js} +1 -1
- package/dist/public/index.html +2 -2
- package/package.json +1 -1
- package/dist/public/assets/Terminal-Dy5IfX3z.js +0 -142
- package/dist/public/assets/index-AaacESr1.js +0 -10
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PaneEditorBody-
|
|
2
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{a as n,n as r,o as i,r as a,t as o}from"./x-BJOrp_m5.js";import{D as s,Dt as c,E as l,G as u,I as d,K as f,Kt as p,L as m,O as h,Ot as g,Rt as _,Vt as v,Y as y,bt as b,ct as x,dt as S,et as C,ft as w,gt as T,ht as E,it as D,lt as O,mt as k,ot as ee,p as A,st as j,tt as M,u as te,ut as ne,v as N,vt as re,w as ie,x as ae,xt as P,z as F}from"./hotkeys-C1l8zghv.js";import{A as oe,C as I,E as L,F as se,I as ce,L as le,N as ue,O as de,R,S as z,T as fe,_ as pe,b as B,c as me,h as he,i as ge,l as _e,o as ve,r as ye,s as be,t as xe,u as Se,v as Ce,w as we,x as Te,y as Ee,z as De}from"./editor-context-B4vRC3Ax.js";import{t as Oe}from"./preload-helper-Czpn1I53.js";import{A as ke,C as Ae,D as je,a as Me,g as Ne,h as V,i as Pe,k as Fe,n as Ie,o as Le,r as Re,t as ze,y as Be}from"./dialog-DjL0qoAv.js";import{a as Ve,c as He,f as Ue,i as We,n as Ge,o as Ke,p as qe,r as Je,s as Ye,t as Xe}from"./LazyTerminal-C4ZOFMV2.js";import{A as Ze,C as Qe,D as $e,E as et,M as tt,O as nt,S as rt,T as it,_ as at,a as ot,b as st,c as ct,d as lt,f as ut,g as dt,h as ft,i as pt,j as mt,k as ht,l as gt,m as _t,n as vt,o as yt,p as bt,r as H,s as xt,t as St,u as Ct,v as wt,w as Tt,x as Et,y as Dt}from"./context-menu-BqhbQoDl.js";import{a as Ot,i as kt,o as At,r as jt,s as Mt,t as Nt}from"./file-links-CCKIeuis.js";import{a as Pt,i as Ft,n as It,o as Lt,r as Rt,t as zt}from"./session-seed-CFzVcK9k.js";import{t as Bt}from"./chevron-down-59O6CgEo.js";import{r as Vt}from"./dist-DDFe8e3m.js";import{A as Ht,At as Ut,B as U,C as Wt,Ct as Gt,D as Kt,Dt as qt,E as Jt,Et as Yt,Ft as W,Gt as Xt,I as Zt,J as Qt,L as $t,M as G,Mt as en,N as tn,Nt as K,O as nn,Pt as q,R as rn,S as an,T as on,Tt as sn,Ut as cn,Wt as ln,X as un,Y as dn,Z as fn,_ as pn,_t as mn,b as hn,c as gn,ct as _n,d as vn,dt as yn,f as bn,ft as xn,g as Sn,h as Cn,ht as wn,i as Tn,it as En,j as Dn,jt as On,k as kn,l as An,lt as jn,m as Mn,n as Nn,nt as Pn,o as Fn,p as In,pt as Ln,s as Rn,st as zn,t as Bn,u as Vn,v as Hn,vt as Un,w as Wn,wt as Gn,x as Kn,y as qn}from"./index-AaacESr1.js";import{i as Jn}from"./buffer-logic-BrpRsL1b.js";var Yn=r(`arrow-right-left`,[[`path`,{d:`m16 3 4 4-4 4`,key:`1x1c3m`}],[`path`,{d:`M20 7H4`,key:`zbl0bi`}],[`path`,{d:`m8 21-4-4 4-4`,key:`h9nckh`}],[`path`,{d:`M4 17h16`,key:`g4d7ey`}]]),Xn=r(`chevrons-down-up`,[[`path`,{d:`m7 20 5-5 5 5`,key:`13a0gw`}],[`path`,{d:`m7 4 5 5 5-5`,key:`1kwcof`}]]),Zn=r(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Qn=r(`eraser`,[[`path`,{d:`M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21`,key:`g5wo59`}],[`path`,{d:`m5.082 11.09 8.828 8.828`,key:`1wx5vj`}]]),$n=r(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),er=r(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),tr=r(`file-archive`,[[`path`,{d:`M13.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v11.5`,key:`4pqfef`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 12v-1`,key:`1ej8lb`}],[`path`,{d:`M8 18v-2`,key:`qcmpov`}],[`path`,{d:`M8 7V6`,key:`1nbb54`}],[`circle`,{cx:`8`,cy:`20`,r:`2`,key:`ckkr5m`}]]),nr=r(`file-braces`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`1oajmo`}],[`path`,{d:`M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`mpwhp6`}]]),J=r(`file-code`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),rr=r(`file-cog`,[[`path`,{d:`M15 8a1 1 0 0 1-1-1V2a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8z`,key:`1ckgky`}],[`path`,{d:`M20 8v12a2 2 0 0 1-2 2h-4.182`,key:`1726p0`}],[`path`,{d:`m3.305 19.53.923-.382`,key:`ao1pio`}],[`path`,{d:`M4 10.592V4a2 2 0 0 1 2-2h8`,key:`1foop0`}],[`path`,{d:`m4.228 16.852-.924-.383`,key:`1fv9zy`}],[`path`,{d:`m5.852 15.228-.383-.923`,key:`1a9hc2`}],[`path`,{d:`m5.852 20.772-.383.924`,key:`1sh9ke`}],[`path`,{d:`m8.148 15.228.383-.923`,key:`4yu6lf`}],[`path`,{d:`m8.53 21.696-.382-.924`,key:`18b0s9`}],[`path`,{d:`m9.773 16.852.922-.383`,key:`ti6xop`}],[`path`,{d:`m9.773 19.148.922.383`,key:`rws47d`}],[`circle`,{cx:`7`,cy:`18`,r:`3`,key:`lvkj7j`}]]),ir=r(`file-headphone`,[[`path`,{d:`M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343`,key:`1vfytu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0`,key:`1etmh7`}]]),ar=r(`file-image`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]),or=r(`file-key`,[[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M4 12v6`,key:`bg1pfk`}],[`path`,{d:`M4 14h2`,key:`1sf9f8`}],[`path`,{d:`M9.65 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v4`,key:`d56i0q`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),sr=r(`file-lock`,[[`path`,{d:`M4 9.8V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3`,key:`1432pc`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M9 17v-2a2 2 0 0 0-4 0v2`,key:`168m41`}],[`rect`,{width:`8`,height:`5`,x:`3`,y:`17`,rx:`1`,key:`o8vfew`}]]),cr=r(`file-play`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z`,key:`1tzo1f`}]]),lr=r(`file-spreadsheet`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]),ur=r(`file-terminal`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m8 16 2-2-2-2`,key:`10vzyd`}],[`path`,{d:`M12 18h4`,key:`1wd2n7`}]]),dr=r(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),fr=r(`file-type`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M11 18h2`,key:`12mj7e`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`M9 13v-.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 .5.5v.5`,key:`qbrxap`}]]),pr=r(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),mr=r(`folder-closed`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}],[`path`,{d:`M2 10h20`,key:`1ir3d8`}]]),hr=r(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),gr=r(`folder-x`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}],[`path`,{d:`m9.5 10.5 5 5`,key:`ra9qjz`}],[`path`,{d:`m14.5 10.5-5 5`,key:`l2rkpq`}]]),_r=r(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),vr=r(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),yr=r(`link`,[[`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`}]]),br=r(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),xr=r(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),Sr=r(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),Cr=r(`panel-left-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]]),wr=r(`panel-left-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]]),Tr=r(`panel-right-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m8 9 3 3-3 3`,key:`12hl5m`}]]),Er=r(`panel-right-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m10 15-3-3 3-3`,key:`1pgupc`}]]),Dr=r(`pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]),Or=r(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),kr=r(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),Ar=r(`shield-off`,[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71`,key:`1jlk70`}],[`path`,{d:`M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264`,key:`18rp1v`}]]),jr=r(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Mr=r(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),Nr=r(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),Pr=r(`user-round-cog`,[[`path`,{d:`m14.305 19.53.923-.382`,key:`3m78fa`}],[`path`,{d:`m15.228 16.852-.923-.383`,key:`npixar`}],[`path`,{d:`m16.852 15.228-.383-.923`,key:`5xggr7`}],[`path`,{d:`m16.852 20.772-.383.924`,key:`dpfhf9`}],[`path`,{d:`m19.148 15.228.383-.923`,key:`1reyyz`}],[`path`,{d:`m19.53 21.696-.382-.924`,key:`1goivc`}],[`path`,{d:`M2 21a8 8 0 0 1 10.434-7.62`,key:`1yezr2`}],[`path`,{d:`m20.772 16.852.924-.383`,key:`htqkph`}],[`path`,{d:`m20.772 19.148.924.383`,key:`9w9pjp`}],[`circle`,{cx:`10`,cy:`8`,r:`5`,key:`o932ke`}],[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}]]),Y=n(),X=e(t(),1);function Fr(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function Ir(e,t){let n=getComputedStyle(e.ownerDocument.documentElement);return t*parseFloat(n.fontSize)}function Lr(e){return e/100*window.innerHeight}function Rr(e){return e/100*window.innerWidth}function zr(e){switch(typeof e){case`number`:return[e,`px`];case`string`:{let t=parseFloat(e);return e.endsWith(`%`)?[t,`%`]:e.endsWith(`px`)?[t,`px`]:e.endsWith(`rem`)?[t,`rem`]:e.endsWith(`em`)?[t,`em`]:e.endsWith(`vh`)?[t,`vh`]:e.endsWith(`vw`)?[t,`vw`]:[t,`%`]}}}function Br({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=zr(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=Ir(t,i);break;case`em`:r=Fr(t,i);break;case`vh`:r=Lr(i);break;case`vw`:r=Rr(i);break}return r}function Vr(e){return parseFloat(e.toFixed(3))}function Hr({group:e}){let{orientation:t,panels:n}=e;return n.reduce((e,n)=>(e+=t===`horizontal`?n.element.offsetWidth:n.element.offsetHeight,e),0)}function Ur(e){let{panels:t}=e,n=Hr({group:e});return n===0?t.map(e=>({groupResizeBehavior:e.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:e.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:e.panelConstraints.disabled,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let{element:t,panelConstraints:r}=e,i=0;r.collapsedSize!==void 0&&(i=Vr(Br({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=Vr(Br({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=Vr(Br({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=Vr(Br({groupSize:n,panelElement:t,styleProp:r.maxSize})/n*100)),{groupResizeBehavior:r.groupResizeBehavior,collapsedSize:i,collapsible:r.collapsible===!0,defaultSize:a,disabled:r.disabled,minSize:o,maxSize:s,panelId:e.id}})}function Z(e,t=`Assertion error`){if(!e)throw Error(t)}function Wr(e,t){return Array.from(t).sort(e===`horizontal`?Gr:Kr)}function Gr(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function Kr(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function qr(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function Jr(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function Yr({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},i,a=Number.MAX_VALUE;for(let n of t){let{x:t,y:o}=Jr(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return Z(i,`No rect found`),i}var Xr;function Zr(){return Xr===void 0&&(Xr=typeof matchMedia==`function`&&!!matchMedia(`(pointer:coarse)`).matches),Xr}function Qr(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=Wr(n,Array.from(t.children).filter(qr).map(e=>({element:e}))).map(({element:e})=>e),o=[],s=!1,c=!1,l=-1,u=-1,d=0,f,p=[];{let e=-1;for(let t of a)t.hasAttribute(`data-panel`)&&(e++,t.hasAttribute(`data-disabled`)||(d++,l===-1&&(l=e),u=e))}if(d>1){let t=-1;for(let d of a)if(d.hasAttribute(`data-panel`)){t++;let i=r.find(e=>e.element===d);if(i){if(f){let r=f.element.getBoundingClientRect(),a=d.getBoundingClientRect(),m;if(c){let e=n===`horizontal`?new DOMRect(r.right,r.top,0,r.height):new DOMRect(r.left,r.bottom,r.width,0),t=n===`horizontal`?new DOMRect(a.left,a.top,0,a.height):new DOMRect(a.left,a.top,a.width,0);switch(p.length){case 0:m=[e,t];break;case 1:{let i=p[0];m=[i,Yr({orientation:n,rects:[r,a],targetRect:i.element.getBoundingClientRect()})===r?t:e];break}default:m=p;break}}else m=p.length?p:[n===`horizontal`?new DOMRect(r.right,a.top,a.left-r.right,a.height):new DOMRect(a.left,r.bottom,a.width,a.top-r.bottom)];for(let n of m){let r=`width`in n?n:n.element.getBoundingClientRect(),a=Zr()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(r.width<a){let e=a-r.width;r=new DOMRect(r.x-e/2,r.y,r.width+e,r.height)}if(r.height<a){let e=a-r.height;r=new DOMRect(r.x,r.y-e/2,r.width,r.height+e)}!s&&!(t<=l||t>u)&&o.push({group:e,groupSize:Hr({group:e}),panels:[f,i],separator:`width`in n?void 0:n,rect:r}),s=!1}}c=!1,f=i,p=[]}}else if(d.hasAttribute(`data-separator`)){d.ariaDisabled!==null&&(s=!0);let e=i.find(e=>e.element===d);e?p.push(e):(f=void 0,p=[])}else c=!0}return o}var $r=class{#e={};addListener(e,t){let n=this.#e[e];return n===void 0?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#e[e];if(n!==void 0)if(n.length===1)n[0].call(null,t);else{let e=!1,r=null,i=Array.from(n);for(let n=0;n<i.length;n++){let a=i[n];try{a.call(null,t)}catch(t){r===null&&(e=!0,r=t)}}if(e)throw r}}removeAllListeners(){this.#e={}}removeListener(e,t){let n=this.#e[e];if(n!==void 0){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}},ei={cursorFlags:0,state:`inactive`},ti=new $r;function ni(){return ei}function ri(e){return ti.addListener(`change`,e)}function ii(e){let t=ei,n={...ei};n.cursorFlags=e,ei=n,ti.emit(`change`,{prev:t,next:n})}function ai(e){let t=ei;ei=e,ti.emit(`change`,{prev:t,next:e})}var oi=e=>e,si=()=>{},ci=1,li=2,ui=4,di=8,fi=3,pi=12,mi;function hi(){return mi===void 0&&(mi=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(mi=!0)),mi}function gi({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case`active`:case`hover`:t.forEach(e=>{if(!e.mutableState.disableCursor)switch(e.orientation){case`horizontal`:r++;break;case`vertical`:i++;break}})}if(!(r===0&&i===0)){switch(n){case`active`:if(e&&hi()){let t=(e&ci)!==0,n=(e&li)!==0,r=(e&ui)!==0,i=(e&di)!==0;if(t)return r?`se-resize`:i?`ne-resize`:`e-resize`;if(n)return r?`sw-resize`:i?`nw-resize`:`w-resize`;if(r)return`s-resize`;if(i)return`n-resize`}break}return hi()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var _i=new WeakMap;function vi(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=_i.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(n):e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]));let r=ni();switch(r.state){case`active`:case`hover`:{let e=gi({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(e=>e.group),state:r.state}),i=`*, *:hover {cursor: ${e} !important; }`;if(t===i)return;t=i,e?n.cssRules.length===0?n.insertRule(i):n.replaceSync(i):n.cssRules.length===1&&n.deleteRule(0);break}case`inactive`:t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}_i.set(e,{prevStyle:t,styleSheet:n})}var yi=new Map,bi=new $r;function xi(e){yi=new Map(yi),yi.delete(e)}function Si(e,t){for(let[t]of yi)if(t.id===e)return t}function Ci(e,t){for(let[t,n]of yi)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function wi(){return yi}function Ti(e,t){return bi.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function Ei(e,t,n){let r=yi.get(e);yi=new Map(yi),yi.set(e,t),bi.emit(`groupChange`,{group:e,isUserInteraction:n?.isUserInteraction===!0,prev:r,next:t})}function Di(e){let t=ni(),n=!1;switch(t.state){case`active`:ai({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(vi(e),n=!0,t.hitRegions.forEach(e=>{let t=Ci(e.group.id,!0);Ei(e.group,t,{isUserInteraction:!0})}))}return n}function Oi(e){e.defaultPrevented||Di(e.currentTarget)}function ki(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=Jr(n,a.rect);switch(e){case`horizontal`:t.x<=i.x&&(r=a,i=t);break;case`vertical`:t.y<=i.y&&(r=a,i=t);break}}return r?{distance:i,hitRegion:r}:void 0}function Ai(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function ji(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:Li(e),b:Li(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();Z(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:Ii(Fi(n.a)),b:Ii(Fi(n.b))};if(i.a===i.b){let e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(i.a-i.b)}var Mi=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Ni(e){let t=getComputedStyle(Ri(e)??e).display;return t===`flex`||t===`inline-flex`}function Pi(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||Ni(e))||+t.opacity<1||`transform`in t&&t.transform!==`none`||`webkitTransform`in t&&t.webkitTransform!==`none`||`mixBlendMode`in t&&t.mixBlendMode!==`normal`||`filter`in t&&t.filter!==`none`||`webkitFilter`in t&&t.webkitFilter!==`none`||`isolation`in t&&t.isolation===`isolate`||Mi.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function Fi(e){let t=e.length;for(;t--;){let n=e[t];if(Z(n,`Missing node`),Pi(n))return n}return null}function Ii(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Li(e){let t=[];for(;e;)t.push(e),e=Ri(e);return t}function Ri(e){let{parentNode:t}=e;return Ai(t)?t.host:t}function zi(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function Bi({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!qr(n)||n.contains(e)||e.contains(n))return!0;if(ji(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(zi(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function Vi(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=Qr(r),a=ki(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&Bi({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function Hi(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function Ui(e,t,n=0){return Math.abs(Vr(e)-Vr(t))<=n}function Wi(e,t){return Ui(e,t)?0:e>t?1:-1}function Gi({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){let{collapsedSize:i=0,collapsible:a,disabled:o,maxSize:s=100,minSize:c=0}=t;if(o&&!e)return n;if(Wi(r,c)<0)if(a){let e=(i+c)/2;r=Wi(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=Vr(r),r}function Ki({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(Ui(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;Z(u!=null,`Invalid first pivot index`),Z(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];Z(r,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(Z(n!=null,`Previous layout not found for panel index ${t}`),Ui(n,i)){let t=o-n;Wi(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];Z(r,`No panel constraints found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(Z(n!=null,`Previous layout not found for panel index ${t}`),Ui(n,o)){let t=n-i;Wi(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];Z(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&Wi(i,c)<0)if(e>0){let t=c-o,n=t/2;Wi(i+e,c)<0&&(e=Wi(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;Wi(i-e,c)<0&&(e=Wi(100+e,n)>0?0:-t)}break}}{let t=e<0?1:-1,r=e<0?d:u,i=0;for(;;){let e=s[r];Z(e!=null,`Previous layout not found for panel index ${r}`);let a=Gi({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:e,size:100})-e;if(i+=a,r+=t,r<0||r>=n.length)break}let a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let t=e<0?u:d;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(f),i=s[t];Z(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=Gi({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!Ui(i,c)&&(f+=i-c,l[t]=c,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(Hi(c,l))return i;{let t=e<0?d:u,r=s[t];Z(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=Gi({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!Ui(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];Z(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=Gi({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(Ui(i,s)||(t-=s-i,l[r]=s),Ui(t,0))break;e>0?r--:r++}}}if(!Ui(Object.values(l).reduce((e,t)=>t+e,0),100,.1))return i;let p=Object.keys(i);return l.reduce((e,t,n)=>(e[p[n]]=t,e),{})}function qi(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||Wi(e[n],t[n])!==0)return!1;return!0}function Ji({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n],i=r.reduce((e,t)=>e+t,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(e=>`${e}%`).join(`, `)}`);if(!Ui(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];Z(t!=null,`No layout data found for index ${e}`),r[e]=100/i*t}let a=0;for(let e=0;e<t.length;e++){let i=n[e];Z(i!=null,`No layout data found for index ${e}`);let o=r[e];Z(o!=null,`No layout data found for index ${e}`);let s=Gi({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!Ui(a,0))for(let e=0;e<t.length;e++){let n=r[e];Z(n!=null,`No layout data found for index ${e}`);let i=n+a,o=Gi({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,Ui(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function Yi({groupId:e,panelId:t}){let n=()=>{let t=wi();for(let[n,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:a,groupSize:o,separatorToPanels:s}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:n,groupSize:o,layout:a,separatorToPanels:s};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(e!==void 0)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},o=({nextSize:e,panels:n,prevLayout:r,derivedPanelConstraints:i})=>{let o=a(),s=n.findIndex(e=>e.id===t),c=s===0,l=s===n.length-1;if(l&&e<o&&(c||n.slice(0,s).every((e,t)=>{let n=i[t];return n?.collapsible&&Ui(n.collapsedSize,r[n.panelId])}))){let e=n.slice(0,s).reduce((e,t)=>e+r[t.id],0);return{...r,[t]:Vr(100-e)}}return Ki({delta:l?o-e:e-o,initialLayout:r,panelConstraints:i,pivotIndices:l?[s-1,s]:[s,s+1],prevLayout:r,trigger:`imperative-api`})},s=e=>{if(e===a())return;let{defaultLayoutDeferred:t,derivedPanelConstraints:r,group:i,groupSize:s,layout:c,separatorToPanels:l}=n(),u=Ji({layout:o({nextSize:e,panels:i.panels,prevLayout:c,derivedPanelConstraints:r}),panelConstraints:r});qi(c,u)||Ei(i,{defaultLayoutDeferred:t,derivedPanelConstraints:r,groupSize:s,layout:u,separatorToPanels:l})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),o=a();e&&o!==t&&(n.expandToSize=o,s(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:o}=i(),c=a();if(e&&c===t){let e=o.expandToSize??n;e===0&&(e=1),s(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:e.orientation===`horizontal`?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&Ui(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=Hr({group:t}),o=Vr(Br({groupSize:a,panelElement:r,styleProp:e})/a*100);s(o)}}}function Xi(e){e.defaultPrevented||Vi(e,wi()).forEach(t=>{if(t.separator&&!t.separator.disableDoubleClick){let n=t.panels.find(e=>e.panelConstraints.defaultSize!==void 0);if(n){let r=n.panelConstraints.defaultSize,i=Yi({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function Zi(e){let t=wi();for(let[n]of t)if(n.separators.some(t=>t.element===e))return n;throw Error(`Could not find parent Group for separator element`)}function Qi({groupId:e}){let t=()=>{let t=wi();for(let[n,r]of t)if(n.id===e)return{group:n,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:i,groupSize:a,layout:o,separatorToPanels:s}=t(),c=Ji({layout:e,panelConstraints:r});return n?o:(qi(o,c)||Ei(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function $i(e,t){let n=Zi(e),r=Ci(n.id,!0),i=n.separators.find(t=>t.element===e);Z(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);Z(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=Qi({groupId:n.id}).getLayout(),c=Ji({layout:Ki({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});qi(s,c)||Ei(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels},{isUserInteraction:!0})}function ea(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=Zi(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&$i(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&$i(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&$i(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&$i(t,-5);break;case`End`:e.preventDefault(),$i(t,100);break;case`Enter`:{e.preventDefault();let n=Zi(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=Ci(n.id,!0),o=n.separators.find(e=>e.element===t);Z(o,`Matching separator not found`);let s=a.get(o);Z(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(Z(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];$i(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=Zi(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);Z(r!==null,`Index not found`),n[e.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0].focus({preventScroll:!0});break}case`Home`:e.preventDefault(),$i(t,-100);break}}function ta(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=wi(),n=Vi(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({focusVisible:!1,preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),ai({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}function na({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:a,prevCursorFlags:o}){let s=0;n.forEach(e=>{let{group:n,groupSize:o}=e,{orientation:c,panels:l}=n,{disableCursor:u}=n.mutableState,d=0;d=a?c===`horizontal`?(t.clientX-a.x)/o*100:(t.clientY-a.y)/o*100:c===`horizontal`?t.clientX<0?-100:100:t.clientY<0?-100:100;let f=r.get(n),p=i.get(n);if(!f||!p)return;let{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:_,separatorToPanels:v}=p;if(h&&_&&v){let t=Ki({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(qi(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?ci:li;break;case`vertical`:s|=d<0?ui:di;break}}else Ei(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&fi:c|=s&fi,t.movementY===0?c|=o&pi:c|=s&pi,ii(c),vi(e)}function ra(e){let t=wi(),n=ni();switch(n.state){case`active`:na({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function ia(e){if(e.defaultPrevented)return;let t=ni(),n=wi();switch(t.state){case`active`:if(e.buttons===0){ai({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=Ci(e.group.id,!0);Ei(e.group,t,{isUserInteraction:!0})});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}na({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=Vi(e,n);r.length===0?t.state!==`inactive`&&ai({cursorFlags:0,state:`inactive`}):ai({cursorFlags:0,hitRegions:r,state:`hover`}),vi(e.currentTarget);break}}}function aa(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(ni().state){case`hover`:ai({cursorFlags:0,state:`inactive`})}}function oa(e){e.defaultPrevented||e.pointerType===`mouse`&&e.button>0||Di(e.currentTarget)&&e.preventDefault()}function sa(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=Vr(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=Vr((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function ca(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=Hr({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:Vr(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function la(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function ua({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let i=0,a=0,o=!1,s=new Map,c=[];for(let l of e.panels){let e=r[l.id]??0;switch(l.panelConstraints.groupResizeBehavior){case`preserve-pixel-size`:{o=!0;let r=Vr(e/100*n/t*100);s.set(l.id,r),i+=r;break}default:c.push(l.id),a+=e;break}}if(!o||c.length===0)return r;let l=100-i,u={...r};if(s.forEach((e,t)=>{u[t]=e}),a>0)for(let e of c)u[e]=Vr((r[e]??0)/a*l);else{let e=Vr(l/c.length);for(let t of c)u[t]=e}return u}function da(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}var fa=new Map;function pa(e){let t=!0;Z(e.element.ownerDocument.defaultView,`Cannot register an unmounted Group`);let n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,a=new n(n=>{for(let r of n){let{borderBoxSize:n,target:i}=r;if(i===e.element){if(t){let t=Hr({group:e});if(t===0)return;let n=Ci(e.id);if(!n)return;let r=Ur(e),i=n.defaultLayoutDeferred?sa(r):n.layout,a=Ji({layout:ua({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&qi(n.layout,a)&&la(n.derivedPanelConstraints,r)&&n.groupSize===t)return;Ei(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else ca(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{Z(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&a.observe(e.element)});let o=Hr({group:e}),s=Ur(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(da(e.panels,l)||(l=void 0));let u=Ji({layout:e.mutableState.layouts[c]??l??sa(s),panelConstraints:s}),d=e.element.ownerDocument;fa.set(d,(fa.get(d)??0)+1);let f=new Map;return Qr(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),Ei(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{Z(!i.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),i.add(e.id),e.element.addEventListener(`keydown`,ea)}),fa.get(d)===1&&(d.addEventListener(`contextmenu`,Oi,!0),d.addEventListener(`dblclick`,Xi,!0),d.addEventListener(`pointerdown`,ta,!0),d.addEventListener(`pointerleave`,ra),d.addEventListener(`pointermove`,ia),d.addEventListener(`pointerout`,aa),d.addEventListener(`pointerup`,oa,!0)),function(){t=!1,fa.set(d,Math.max(0,(fa.get(d)??0)-1)),xi(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,ea)}),fa.get(d)||(d.removeEventListener(`contextmenu`,Oi,!0),d.removeEventListener(`dblclick`,Xi,!0),d.removeEventListener(`pointerdown`,ta,!0),d.removeEventListener(`pointerleave`,ra),d.removeEventListener(`pointermove`,ia),d.removeEventListener(`pointerout`,aa),d.removeEventListener(`pointerup`,oa,!0)),a.disconnect()}}function ma(){let[e,t]=(0,X.useState)({});return[e,(0,X.useCallback)(()=>t({}),[])]}function ha(e){let t=(0,X.useId)();return`${e??t}`}var ga=typeof window<`u`?X.useLayoutEffect:X.useEffect;function _a(e){let t=(0,X.useRef)(e);return ga(()=>{t.current=e},[e]),(0,X.useCallback)((...e)=>t.current?.(...e),[t])}function va(...e){return _a(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function ya(e){let t=(0,X.useRef)({...e});return ga(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var ba=(0,X.createContext)(null);function xa(e,t){let n=(0,X.useRef)({getLayout:()=>({}),setLayout:oi});(0,X.useImperativeHandle)(t,()=>n.current,[]),ga(()=>{Object.assign(n.current,Qi({groupId:e}))})}function Sa({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:a,groupRef:o,id:s,onLayoutChange:c,onLayoutChanged:l,orientation:u=`horizontal`,resizeTargetMinimumSize:d={coarse:20,fine:10},style:f,...p}){let m=(0,X.useRef)({onLayoutChange:{},onLayoutChanged:{}}),h=_a(e=>{qi(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=_a((e,t)=>{qi(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e,{isUserInteraction:t}))}),_=ha(s),v=(0,X.useRef)(null),[y,b]=ma(),x=(0,X.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=va(v,a);xa(_,o);let C=_a((e,t)=>{let r=ni(),i=Si(e),a=Ci(e);if(a){let e=!1;switch(r.state){case`active`:e=r.hitRegions.some(e=>e.group===i);break}return{flexGrow:a.layout[t]??1,pointerEvents:e?`none`:void 0}}if(n?.[t])return{flexGrow:n?.[t]}}),w=ya({defaultLayout:n,disableCursor:r}),T=(0,X.useMemo)(()=>({get disableCursor(){return!!w.disableCursor},getPanelStyles:C,id:_,orientation:u,registerPanel:e=>{let t=x.current;return t.panels=Wr(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=Wr(u,[...t.separators,e]),b(),()=>{t.separators=t.separators.filter(t=>t!==e),b()}},updatePanelProps:(e,{disabled:t})=>{let n=x.current.panels.find(t=>t.id===e);n&&(n.panelConstraints.disabled=t);let r=Si(_),i=Ci(_);r&&i&&Ei(r,{...i,derivedPanelConstraints:Ur(r)})},updateSeparatorProps:(e,{disabled:t,disableDoubleClick:n})=>{let r=x.current.separators.find(t=>t.id===e);r&&(r.disabled=t,r.disableDoubleClick=n)}}),[C,_,b,u,w]),E=(0,X.useRef)(null);return ga(()=>{let e=v.current;if(e===null)return;let t=x.current,n;if(w.defaultLayout!==void 0&&Object.keys(w.defaultLayout).length===t.panels.length){n={};for(let e of t.panels){let t=w.defaultLayout[e.id];t!==void 0&&(n[e.id]=t)}}let r={disabled:!!i,element:e,id:_,mutableState:{defaultLayout:n,disableCursor:!!w.disableCursor,expandedPanelSizes:x.current.lastExpandedPanelSizes,layouts:x.current.layouts},orientation:u,panels:t.panels,resizeTargetMinimumSize:t.resizeTargetMinimumSize,separators:t.separators};E.current=r;let a=pa(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=Ci(r.id,!0);!o&&s.length>0&&(h(c),g(c,!1));let l=Ti(_,e=>{let{defaultLayoutDeferred:t,derivedPanelConstraints:n,layout:i}=e.next;if(t||n.length===0)return;let a=r.panels.map(({id:e})=>e).join(`,`);r.mutableState.layouts[a]=i,n.forEach(t=>{if(t.collapsible){let{layout:n}=e.prev??{};if(n){let e=Ui(t.collapsedSize,i[t.panelId]),a=Ui(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=ni().state!==`active`;h(i),o&&g(i,e.isUserInteraction)});return()=>{E.current=null,a(),l()}},[i,_,g,h,u,y,w]),(0,X.useEffect)(()=>{let e=E.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,Y.jsx)(ba.Provider,{value:T,children:(0,Y.jsx)(`div`,{...p,className:t,"data-group":!0,"data-testid":_,id:_,ref:S,style:{height:`100%`,width:`100%`,overflow:`hidden`,...f,display:`flex`,flexDirection:u===`horizontal`?`row`:`column`,flexWrap:`nowrap`,touchAction:u===`horizontal`?`pan-y`:`pan-x`},children:e})})}Sa.displayName=`Group`;function Ca(){let e=(0,X.useContext)(ba);return Z(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function wa(e,t){let{id:n}=Ca(),r=(0,X.useRef)({collapse:si,expand:si,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:si});(0,X.useImperativeHandle)(t,()=>r.current,[]),ga(()=>{Object.assign(r.current,Yi({groupId:n,panelId:e}))})}function Ta({children:e,className:t,collapsedSize:n=`0%`,collapsible:r=!1,defaultSize:i,disabled:a,elementRef:o,groupResizeBehavior:s=`preserve-relative-size`,id:c,maxSize:l=`100%`,minSize:u=`0%`,onResize:d,panelRef:f,style:p,...m}){let h=!!c,g=ha(c),_=ya({disabled:a}),v=(0,X.useRef)(null),y=va(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=Ca(),T=d!==null,E=_a((e,t,n)=>{d?.(e,c,n)});ga(()=>{let e=v.current;if(e!==null){let t={element:e,id:g,idIsStable:h,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:T?E:void 0,panelConstraints:{groupResizeBehavior:s,collapsedSize:n,collapsible:r,defaultSize:i,disabled:_.disabled,maxSize:l,minSize:u}};return C(t)}},[s,n,r,i,T,g,h,l,u,E,C,_]),(0,X.useEffect)(()=>{w(g,{disabled:a})},[a,g,w]),wa(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,X.useSyncExternalStore)(e=>Ti(x,e),D,D),k;return k=O?JSON.parse(O):i===void 0?{flexGrow:1}:{flexGrow:void 0,flexShrink:void 0,flexBasis:i},(0,Y.jsx)(`div`,{...m,"data-disabled":a||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...Ea,display:`flex`,flexBasis:0,flexShrink:1,overflow:`visible`,...k},children:(0,Y.jsx)(`div`,{className:t,style:{maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`,...p,touchAction:S===`horizontal`?`pan-y`:`pan-x`},children:e})})}Ta.displayName=`Panel`;var Ea={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function Da({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a,o=e[n],s=t.find(e=>e.panelId===n);if(s){let c=s.maxSize,l=s.collapsible?s.collapsedSize:s.minSize,u=[r,r+1];a=Ji({layout:Ki({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=Ji({layout:Ki({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function Oa({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=ha(a),l=ya({disabled:n,disableDoubleClick:r}),[u,d]=(0,X.useState)({}),[f,p]=(0,X.useState)(`inactive`),[m,h]=(0,X.useState)(!1),g=(0,X.useRef)(null),_=va(g,i),{disableCursor:v,id:y,orientation:b,registerSeparator:x,updateSeparatorProps:S}=Ca(),C=b===`horizontal`?`vertical`:`horizontal`;ga(()=>{let e=g.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=x(t),r=ri(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=Ti(y,e=>{let{derivedPanelConstraints:n,layout:r,separatorToPanels:i}=e.next,a=i.get(t);if(a){let e=a[0],t=a.indexOf(e);d(Da({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[y,c,x,l]),(0,X.useEffect)(()=>{S(c,{disabled:n,disableDoubleClick:r})},[n,r,c,S]);let w;n&&!v&&(w=`not-allowed`);let T;if(n)T=`disabled`;else switch(f){case`active`:T=`active`;break;default:T=m?`focus`:f}return(0,Y.jsx)(`div`,{...s,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":C,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":T,"data-testid":c,id:c,onBlur:()=>h(!1),onFocus:()=>h(!0),ref:_,role:`separator`,style:{flexBasis:`auto`,cursor:w,...o,flexGrow:0,flexShrink:0,touchAction:`none`},tabIndex:n?void 0:0})}Oa.displayName=`Separator`;function ka(e){if(e===null)return!1;if(Zt(e)===`untitled`){let t=me(e.path);return t===void 0?!1:(ve({name:e.path,content:t}),!0)}return pe(Ce(e.session,e.path,e.root))}function Aa({request:e,targetSession:t,targetRoot:n,targetLabel:r,profileId:i,onClose:a,onSaved:o}){let[s,c]=(0,X.useState)(``),[l,u]=(0,X.useState)(null),[d,f]=(0,X.useState)(!1);(0,X.useEffect)(()=>{e&&(c(e.name),u(null))},[e]);let p=async()=>{if(!e||!t)return;let a=s.trim().replace(/^\/+/,``).replace(/\/+$/,``);if(a===``){u(`Give the file a path.`);return}f(!0),u(null);try{let s=!0;try{await P(`GET`,`/api/worktrees/${t.id}/file?path=${encodeURIComponent(a)}${we(n)}`)}catch(e){if(e instanceof b&&e.status===404)s=!1;else if(e instanceof b&&e.status===413)s=!0;else throw e}if(s){u(`${a} already exists in ${r}.`);return}await P(`PUT`,`/api/worktrees/${t.id}/file?path=${encodeURIComponent(a)}${we(n)}`,{content:e.content}),i!==void 0&&await Se(i,e.name).catch(()=>void 0),ge(e.name),o(e.name,t.id,a,n)}catch(e){u(e instanceof Error?e.message:`Save failed`)}finally{f(!1)}};return(0,Y.jsx)(ze,{open:e!==null,onOpenChange:e=>!e&&a(),children:(0,Y.jsxs)(Ie,{children:[(0,Y.jsxs)(Me,{children:[(0,Y.jsx)(Le,{children:`Save draft into the worktree`}),(0,Y.jsx)(Re,{children:t?(0,Y.jsxs)(Y.Fragment,{children:[`Saves into `,(0,Y.jsx)(`span`,{className:`text-fg-secondary`,children:r}),` — what the sidebar is bound to.`]}):`No worktree is bound — open or focus a session first.`})]}),(0,Y.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),p()},children:[(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Y.jsx)(Ye,{htmlFor:`untitled-path`,children:`Worktree-relative path`}),(0,Y.jsx)(He,{id:`untitled-path`,placeholder:`docs/notes.md`,value:s,onChange:e=>c(e.target.value),autoFocus:!0})]}),l&&(0,Y.jsx)(`p`,{className:`text-xs text-danger`,children:l}),(0,Y.jsxs)(Pe,{children:[(0,Y.jsx)(V,{type:`button`,variant:`ghost`,onClick:a,children:`Cancel`}),(0,Y.jsx)(V,{type:`submit`,disabled:d||!t,children:`Save`})]})]})]})})}function ja(e,t){return t??e.root??e.session?.worktree_path??null}function Ma(e,t){return{...e,unpin(){t(),e.unpin()}}}function Na(e){return{id:c,project_id:e.projectId,account_id:null,worktree_path:e.path,base_branch:e.defaultBranch,branch:e.defaultBranch,separate_branch:!1,kind:`terminal`,agent_type:null,agent_session_ref:null,title:e.name,status:`exited`,skip_permissions:!1,created_at:`1970-01-01T00:00:00.000Z`,updated_at:`1970-01-01T00:00:00.000Z`,last_activity_at:null}}function Pa(e,t,n,r=null){let i=n.snapshot.explorer_pin,a=i===null?null:e.find(e=>e.id===i&&e.status!==`archived`)??null,o=a??e.find(e=>e.id===t)??null,s=o===null&&r!==null;return{session:s?Na(r):o,root:s?r.path:void 0,isProjectDirectory:s,pinned:a!==null,pin(e){n.update({explorer_pin:e})},unpin(){n.update({explorer_pin:null})}}}var Fa=null,Ia=null;async function La(){let[e,t]=await Promise.all([Oe(()=>import(`./PaneEditorBody-lW0sWUp-.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19])),Oe(()=>import(`./ModelRefcount-BNGeKYRW.js`),__vite__mapDeps([20,1,2,16,6,9,3,4,10,11,12,14,15,17]))]);Fa=e.PaneEditorBody,Ia=t.ModelRefcount}var Ra=(0,X.lazy)(()=>Oe(()=>import(`./PaneEditorBody-lW0sWUp-.js`).then(e=>({default:e.PaneEditorBody})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19])));function za(e){return Fa?(0,Y.jsx)(Fa,{...e}):(0,Y.jsx)(X.Suspense,{fallback:(0,Y.jsx)(`div`,{className:`flex h-full items-center justify-center bg-ground text-xs text-fg-muted`,children:`Loading editor…`}),children:(0,Y.jsx)(Ra,{...e})})}var Ba=(0,X.lazy)(()=>Oe(()=>import(`./ModelRefcount-BNGeKYRW.js`).then(e=>({default:e.ModelRefcount})),__vite__mapDeps([20,1,2,16,6,9,3,4,10,11,12,14,15,17])));function Va({buffers:e}){return Ia?(0,Y.jsx)(Ia,{buffers:e}):(0,Y.jsx)(X.Suspense,{fallback:null,children:(0,Y.jsx)(Ba,{buffers:e})})}var Ha=(0,X.lazy)(()=>Oe(()=>import(`./EditorTabClose-CCO1bJrk.js`).then(e=>({default:e.EditorDirtyDot})),__vite__mapDeps([21,1,2,3,10,16,6,9,4,11,12,14,15,17,18])));function Ua(e){return(0,Y.jsx)(X.Suspense,{fallback:null,children:(0,Y.jsx)(Ha,{...e})})}var Wa=(0,X.lazy)(()=>Oe(()=>import(`./EditorTabClose-CCO1bJrk.js`).then(e=>({default:e.EditorTabClose})),__vite__mapDeps([21,1,2,3,10,16,6,9,4,11,12,14,15,17,18])));function Ga(e){return(0,Y.jsx)(X.Suspense,{fallback:(0,Y.jsx)(`button`,{onClick:t=>{t.stopPropagation(),e.onClose()},className:`hidden size-4 items-center justify-center rounded-sm text-fg-muted transition-colors hover:text-fg group-hover:flex pointer-coarse:flex`,"aria-label":`Close ${e.label}`,children:`×`}),children:(0,Y.jsx)(Wa,{...e})})}var Ka=e(i(),1),qa=(0,X.createContext)(null);function Ja({tree:e,parked:t=[],onOpenFile:n,children:r}){let i=(0,X.useRef)(null),a=(0,X.useRef)(new Map).current,[o,s]=(0,X.useState)(()=>new Set),c=(0,X.useCallback)((e,t)=>{s(n=>{if(n.has(e)===t)return n;let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]),l=[...t].sort().join(`,`),u=(0,X.useMemo)(()=>{let t=new Set;for(let n of Cn(e))for(let e of n.tabs)e.type===`terminal`&&t.add(e.session);for(let e of l===``?[]:l.split(`,`))t.add(e);return[...t].sort()},[e,l]),d=e=>{let t=`term:${e}`,n=a.get(t);return n||(n=document.createElement(`div`),n.className=`size-full`,a.set(t,n)),n};(0,X.useEffect)(()=>{let e=new Set(u.map(e=>`term:${e}`));for(let e of u){let t=a.get(`term:${e}`);t&&!t.parentElement&&i.current?.appendChild(t)}for(let[t,n]of[...a])e.has(t)||(n.remove(),a.delete(t))},[u,a]);let f=(0,X.useMemo)(()=>({parkingRef:i,containers:a,setAdopted:c}),[a,c]);return(0,Y.jsxs)(qa.Provider,{value:f,children:[(0,Y.jsx)(`div`,{ref:i,className:`hidden`,"aria-hidden":!0}),u.map(e=>(0,Ka.createPortal)((0,Y.jsx)(Xe,{stream:e,paused:!o.has(`term:${e}`),onOpenFile:t=>n(e,t)}),d(e),e)),r]})}function Ya(e){let t=(0,X.useContext)(qa),n=(0,X.useRef)(null);return(0,X.useEffect)(()=>{let r=n.current;if(!t||!e||!r)return;let i=t.containers.get(e);return i&&(r.appendChild(i),t.setAdopted(e,!0)),()=>{let n=t.parkingRef.current;i&&n&&i.parentElement===r&&n.appendChild(i),i&&t.setAdopted(e,!1)}},[t,e]),n}var Xa=null,Za=new Set;function Qa(e){Xa=e,Za.forEach(t=>t(e))}function $a(e){return Za.add(e),Xa&&e(Xa),()=>Za.delete(e)}function eo(){Xa=null}var to=20,no=new Map;function ro(e,t){let n=no.get(e)??[];n.push(t),n.length>to&&n.shift(),no.set(e,n)}function io(e,t){let n=no.get(e);for(;n&&n.length>0;){let e=n.pop();if(t(e.ref))return e}}function ao(e){let[t,n]=(0,X.useState)(()=>window.matchMedia(e).matches);return(0,X.useEffect)(()=>{let t=window.matchMedia(e),r=e=>n(e.matches);return n(t.matches),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}var oo=`(max-width: 767px)`;function so(e,t){let n={};for(let r of t){let t=e[r];if(typeof t!=`number`)return;n[r]=t}return n}var co=`puddle.pane-height.`;function lo(e){try{let t=localStorage.getItem(`${co}${e}`);if(t===null)return null;let n=Number(t);return Number.isFinite(n)&&n>0?n:null}catch{return null}}function uo(e,t,{sized:n,min:r=64}){let[i,a]=(0,X.useState)(()=>lo(e)??t),[o,s]=(0,X.useState)(!1),c=(0,X.useRef)(i);return c.current=i,{height:i,handle:{dragging:o,onPointerDown:(0,X.useCallback)(t=>{if(t.button!==0)return;t.preventDefault();let i=t.currentTarget,o=t.clientY,l=c.current,u=i.parentElement?.getBoundingClientRect().height??window.innerHeight,d=Math.max(r,u-96);i.setPointerCapture(t.pointerId),s(!0);let f=e=>{let t=e.clientY-o,i=n===`below`?l-t:l+t;a(Math.round(Math.min(d,Math.max(r,i))))},p=()=>{i.removeEventListener(`pointermove`,f),i.removeEventListener(`pointerup`,p),i.removeEventListener(`pointercancel`,p),s(!1);try{localStorage.setItem(`${co}${e}`,String(c.current))}catch{}};i.addEventListener(`pointermove`,f),i.addEventListener(`pointerup`,p),i.addEventListener(`pointercancel`,p)},[e,r,n])}}}function fo({handle:e,label:t,className:n}){return(0,Y.jsx)(`div`,{role:`separator`,"aria-orientation":`horizontal`,"aria-label":t,onPointerDown:e.onPointerDown,className:a(`relative h-px shrink-0 cursor-row-resize touch-none bg-border transition-colors hover:bg-accent`,e.dragging&&`bg-accent`,n),children:(0,Y.jsx)(`div`,{className:`absolute inset-x-0 -top-1 h-[9px]`})})}var po=80,mo=180;function ho(e){return Math.max(mo,Math.round(e/po*1e3))}function Q({text:e,hoverClass:t,className:n,containerClassName:r,title:i}){let o=(0,X.useRef)(null),[s,c]=(0,X.useState)(0);return(0,X.useEffect)(()=>{let e=o.current;if(!e)return;let t=()=>c(Math.max(0,e.scrollWidth-e.clientWidth));t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[e]),(0,Y.jsx)(`span`,{className:a(`block min-w-0 flex-1 overflow-hidden`,r),children:(0,Y.jsx)(`span`,{ref:o,title:i,className:a(`block whitespace-nowrap transition-transform ease-linear`,n,s>0&&t),style:s>0?{"--tail":`-${s}px`,transitionDuration:`${ho(s)}ms`}:void 0,children:e})})}var go={added:{letter:`A`,label:`added`,colourClass:`text-success`},modified:{letter:`M`,label:`modified`,colourClass:`text-fg-secondary`},deleted:{letter:`D`,label:`deleted`,colourClass:`text-interrupted`},renamed:{letter:`R`,label:`renamed`,colourClass:`text-warning`}};function _o(e){return go[e]}var vo=[`modified`,`added`,`deleted`,`renamed`];function yo(e){let t=new Map;for(let n of e)t.set(n.status,(t.get(n.status)??0)+1);return vo.filter(e=>t.has(e)).map(e=>`${t.get(e)} ${go[e].label}`).join(` · `)}var bo=[`var(--accent)`,`var(--status-running)`,`var(--status-waiting)`,`var(--ansi-magenta)`,`var(--ansi-cyan)`,`var(--status-interrupted)`];function xo(e){return bo[e%bo.length]}function So(e){let t=[],n=0,r=0,i=()=>{let e=t.indexOf(null);return e===-1?t.length:e},a=()=>{let e=[];for(let n=0;n<t.length;n++){let r=t[n];r&&e.push({col:n,sha:r.sha,colour:xo(r.colourIdx)})}return e},o=[],s=[];for(let c of e){let e=c.parents??[],l=[];for(let e=0;e<t.length;e++)t[e]?.sha===c.sha&&l.push(e);let u,d;l.length>0?(u=l[0],d=t[u].colourIdx):(u=i(),d=n++);let f=xo(d);for(let e of l)t[e]=null;for(;t.length<=u;)t.push(null);let p=[];if(e.length>0){t[u]={sha:e[0],colourIdx:d},p.push(u);for(let r=1;r<e.length;r++){let a=e[r],o=t.findIndex(e=>e?.sha===a);if(o===-1){for(o=i();t.length<=o;)t.push(null);t[o]={sha:a,colourIdx:n++}}p.push(o)}}else t[u]=null;let m=a();o.push({sha:c.sha,col:u,colour:f,above:s,below:m,created:p}),s=m,r=Math.max(r,t.length)}return{rows:o,laneCount:r}}var Co=7,wo=14,To=4,Eo=1.5,Do=40,Oo=22,ko=`group-hover:[transform:translateX(var(--tail))]`;function Ao(e){return e*wo+wo/2}function jo(e,t,n,r){if(e===n)return`M ${e} ${t} L ${n} ${r}`;let i=(t+r)/2;return`M ${e} ${t} C ${e} ${i}, ${n} ${i}, ${n} ${r}`}function Mo({row:e,width:t}){let n=Do,r=n/2,i=Ao(e.col),a=new Set(e.created),o=[];for(let t of e.above){let n=Ao(t.col);t.sha===e.sha?o.push({d:jo(n,0,i,r),colour:t.colour}):o.push({d:jo(n,0,n,r),colour:t.colour})}for(let t of e.below){let e=Ao(t.col);a.has(t.col)?o.push({d:jo(i,r,e,n),colour:t.colour}):o.push({d:jo(e,r,e,n),colour:t.colour})}return(0,Y.jsxs)(`svg`,{width:t,height:n,className:`shrink-0`,"aria-hidden":!0,children:[o.map((e,t)=>(0,Y.jsx)(`path`,{d:e.d,fill:`none`,stroke:e.colour,strokeWidth:Eo},t)),(0,Y.jsx)(`circle`,{cx:i,cy:r,r:To,fill:`var(--bg-surface)`,stroke:e.colour,strokeWidth:Eo})]})}function No({lanes:e,width:t}){return(0,Y.jsx)(`svg`,{width:t,height:Oo,className:`shrink-0`,"aria-hidden":!0,children:e.map(e=>{let t=Ao(e.col);return(0,Y.jsx)(`path`,{d:`M ${t} 0 L ${t} ${Oo}`,fill:`none`,stroke:e.colour,strokeWidth:Eo},e.col)})})}function Po({session:e,sha:t,root:n,lanes:r,gutterW:i,onOpen:o}){let s=L(e,t,n),c=e=>(0,Y.jsxs)(`div`,{className:`flex items-center`,style:{height:Oo},children:[(0,Y.jsx)(No,{lanes:r,width:i}),(0,Y.jsx)(`span`,{className:`px-2 text-2xs text-fg-muted`,children:e})]});return s.isPending?c(`…`):s.error?c(s.error instanceof Error?s.error.message:`Failed to load commit`):s.data.files.length===0?c(`No file changes.`):(0,Y.jsx)(Y.Fragment,{children:s.data.files.map(e=>{let s=_o(e.status),c=e.status===`renamed`&&e.old_path?`${e.old_path} → ${e.path}`:e.path;return(0,Y.jsxs)(`button`,{type:`button`,title:c,onClick:()=>{o(e.path,t),Qa({path:e.path,root:n})},onDoubleClick:()=>o(e.path,t,{preview:!1}),className:`group flex w-full items-center text-left transition-colors hover:bg-elevated`,style:{height:Oo},children:[(0,Y.jsx)(No,{lanes:r,width:i}),(0,Y.jsx)(`span`,{className:a(`mr-1.5 w-3 shrink-0 text-center font-mono text-xs`,s.colourClass),children:s.letter}),(0,Y.jsx)(Q,{text:c,className:`pr-3 text-2xs text-fg`,hoverClass:ko})]},`${e.status}:${e.old_path??``}:${e.path}`)})})}function Fo({session:e,root:t,onOpenCommitFile:n}){let r=ce(e,{root:t}),[i,o]=(0,X.useState)(null),s=(0,X.useMemo)(()=>r.data?.pages.flatMap(e=>e.commits)??[],[r.data]),c=(0,X.useMemo)(()=>So(s),[s]),l=Math.max(1,c.laneCount)*wo+wo/2;return r.isPending?(0,Y.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`Loading history…`}):r.error?(0,Y.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:r.error instanceof Error?r.error.message:`Failed to load history`}):s.length===0?(0,Y.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`No commits yet.`}):(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pb-2`,children:[c.rows.map((r,c)=>{let u=s[c],d=i===r.sha;return(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>o(d?null:r.sha),className:a(`group flex w-full items-center text-left transition-colors hover:bg-elevated`,d&&`bg-selection`),style:{height:Do},children:[(0,Y.jsx)(Mo,{row:r,width:l}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5 pr-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,Y.jsx)(`span`,{className:`shrink-0 font-mono text-2xs text-fg-muted`,children:r.sha.slice(0,Co)}),(0,Y.jsx)(Q,{text:u.subject,className:`text-xs text-fg`,hoverClass:ko})]}),(0,Y.jsxs)(`span`,{className:`truncate text-2xs text-fg-muted`,children:[u.author_name,` ·`,` `,(0,Y.jsx)(`span`,{className:`tabular-nums`,children:he(u.authored_at)})]})]})]}),d&&(0,Y.jsx)(Po,{session:e,sha:r.sha,root:t,lanes:r.below,gutterW:l,onOpen:n})]},r.sha)}),r.hasNextPage&&(0,Y.jsx)(`button`,{type:`button`,onClick:()=>void r.fetchNextPage(),disabled:r.isFetchingNextPage,className:`px-3 py-2 text-left text-xs text-fg-muted transition-colors hover:bg-elevated`,children:r.isFetchingNextPage?`Loading…`:`Show more`})]})}function Io(){return{dirs:new Map,files:[]}}function Lo(e){return e.path}function Ro(e,t){let n=[];for(let[r,i]of e.dirs){let e=t?`${t}/${r}`:r,a={type:`dir`,name:r,path:e,children:Ro(i,e)};for(;a.children.length===1&&a.children[0].type===`dir`;){let e=a.children[0];a={type:`dir`,name:`${a.name}/${e.name}`,path:e.path,children:e.children}}n.push(a)}n.sort((e,t)=>e.name.localeCompare(t.name,void 0,{sensitivity:`base`}));let r=[...e.files].sort((e,t)=>e.name.localeCompare(t.name,void 0,{sensitivity:`base`}));return[...n,...r]}function zo(e){let t=Io();for(let n of e){let e=Lo(n),r=e.split(`/`),i=r.pop(),a=t;for(let e of r){let t=a.dirs.get(e);t||(t=Io(),a.dirs.set(e,t)),a=t}a.files.push({type:`file`,name:i,path:e,entry:n})}return Ro(t,``)}function Bo(e){return e.map(e=>({type:`file`,name:Lo(e).split(`/`).pop()??Lo(e),path:Lo(e),entry:e})).sort((e,t)=>e.path.localeCompare(t.path,void 0,{sensitivity:`base`}))}function Vo(e){return e.type===`file`?[e.entry]:e.children.flatMap(Vo)}var Ho=`group-hover:[transform:translateX(var(--tail))]`;function Uo({name:e,fullPath:t,status:n,depth:r,active:i,onOpen:o}){let s=_o(n);return(0,Y.jsxs)(`button`,{type:`button`,title:t,onClick:()=>o(t),onDoubleClick:()=>o(t,{preview:!1}),className:a(`group flex w-full items-center gap-1.5 py-1 pr-3 text-left transition-colors hover:bg-elevated`,i&&`bg-selection`),style:{paddingLeft:8+r*12},children:[(0,Y.jsx)(`span`,{className:a(`w-3 shrink-0 text-center font-mono text-xs`,s.colourClass),children:s.letter}),(0,Y.jsx)(Q,{text:e,className:`text-xs text-fg`,hoverClass:Ho})]})}function Wo({nodes:e,depth:t,activePath:n,onOpen:r}){let[i,a]=(0,X.useState)(new Set);return(0,Y.jsx)(Y.Fragment,{children:e.map(e=>{if(e.type===`file`)return(0,Y.jsx)(Uo,{name:e.name,fullPath:e.path,status:e.entry.status,depth:t,active:n===e.path,onOpen:r},e.path);let o=i.has(e.path);return(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>a(t=>{let n=new Set(t);return n.has(e.path)?n.delete(e.path):n.add(e.path),n}),className:`group flex w-full items-center gap-1 py-1 pr-3 text-left transition-colors hover:bg-elevated`,style:{paddingLeft:8+t*12},title:e.path,children:[o?(0,Y.jsx)(Vt,{className:`size-3.5 shrink-0 text-fg-gold`}):(0,Y.jsx)(Bt,{className:`size-3.5 shrink-0 text-fg-gold`}),(0,Y.jsx)(Q,{text:e.name,className:`text-xs text-fg-secondary`,hoverClass:Ho})]}),!o&&(0,Y.jsx)(Wo,{nodes:e.children,depth:t+1,activePath:n,onOpen:r})]},e.path)})})}function Go({session:e,root:t,activePath:n,onOpen:r}){let[i,a]=(0,X.useState)(!1),o=ue(e,{against:`head`,root:t}),s=o.data?.entries??[],c=(e,n)=>{r(e,n),Qa({path:e,root:t})},l=(0,X.useMemo)(()=>i?null:zo(s),[i,s]),u=(0,X.useMemo)(()=>i?Bo(s):null,[i,s]);return(0,Y.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,Y.jsxs)(`div`,{className:`flex h-7 shrink-0 items-center gap-2 px-3`,children:[(0,Y.jsx)(`span`,{className:`text-2xs font-medium uppercase tracking-wide text-fg-gold`,children:`Uncommitted`}),s.length>0&&(0,Y.jsx)(`span`,{className:`truncate text-2xs text-fg-muted`,children:yo(s)}),(0,Y.jsxs)(K,{children:[(0,Y.jsx)(W,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,"aria-pressed":!i,onClick:()=>a(e=>!e),className:`ml-auto rounded-sm p-1 text-fg-gold transition-colors hover:bg-elevated hover:text-fg`,children:[i?(0,Y.jsx)(br,{className:`size-3.5`}):(0,Y.jsx)(hr,{className:`size-3.5`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:i?`Show as tree`:`Show as flat list`})]})}),(0,Y.jsx)(q,{children:i?`Show as tree`:`Show as flat list`})]})]}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pb-1`,children:o.isPending?(0,Y.jsx)(`div`,{className:`px-3 py-1.5 text-xs text-fg-muted`,children:`Loading changes…`}):o.error?(0,Y.jsx)(`div`,{className:`px-3 py-1.5 text-xs text-fg-muted`,children:o.error instanceof Error?o.error.message:`Failed to load changes`}):s.length===0?(0,Y.jsx)(`div`,{className:`px-3 py-1.5 text-xs text-fg-muted`,children:`No uncommitted changes.`}):i?u.map(e=>(0,Y.jsx)(Uo,{name:e.path,fullPath:e.path,status:e.entry.status,depth:0,active:n===e.path,onOpen:c},e.path)):(0,Y.jsx)(Wo,{nodes:l,depth:0,activePath:n,onOpen:c})})]})}var Ko={untracked:{letter:`U`,colourClass:`text-success`},added:{letter:`A`,colourClass:`text-success`},modified:{letter:`M`,colourClass:`text-warning`},renamed:{letter:`R`,colourClass:`text-warning`},deleted:{letter:`D`,colourClass:`text-interrupted`},conflicted:{letter:`C`,colourClass:`text-interrupted`},ignored:{letter:``,colourClass:`text-fg-muted`}};function qo(e){return Ko[e]}function Jo(e){let t=new Map;for(let n of e)t.set(n.path,n.status);return t}var Yo={conflicted:0,modified:1,renamed:2,deleted:3,added:4,untracked:5,ignored:6};function Xo(e,t){let n=t===``?``:`${t}/`,r=null;for(let[t,i]of e)n!==``&&!t.startsWith(n)||i!==`ignored`&&(r===null||Yo[i]<Yo[r])&&(r=i);return r}function Zo(e){let t=new Set;for(let n of e)t.add(n.path),n.old_path!==null&&t.add(n.old_path);return[...t]}var Qo=`group-hover:[transform:translateX(var(--tail))]`,$o=`group-hover/repository:[transform:translateX(var(--tail))]`,es=`group-hover:[transform:translateX(var(--tail))]`;function ts({label:e,onClick:t,disabled:n,children:r}){return(0,Y.jsxs)(K,{children:[(0,Y.jsx)(W,{asChild:!0,children:(0,Y.jsx)(`button`,{type:`button`,"aria-label":e,disabled:n,onClick:e=>{e.stopPropagation(),t()},className:`rounded-sm p-1 text-fg-muted transition-colors hover:bg-elevated hover:text-fg disabled:cursor-not-allowed disabled:opacity-40`,children:r})}),(0,Y.jsx)(q,{children:e})]})}function ns({title:e,entries:t,area:n,activePath:r,action:i,busy:a,flat:o,onAction:s,onOpen:c}){let[l,u]=(0,X.useState)(!1),d=(0,X.useMemo)(()=>o?null:zo(t),[t,o]);if(t.length===0)return null;let f=i===`stage`;return(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`group flex h-7 items-center gap-1 px-3`,children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>u(e=>!e),className:`flex min-w-0 flex-1 items-center gap-1 text-left text-2xs font-medium uppercase tracking-wide text-fg-secondary transition-colors hover:text-fg`,children:[l?(0,Y.jsx)(Vt,{className:`size-3`}):(0,Y.jsx)(Bt,{className:`size-3`}),(0,Y.jsx)(`span`,{className:`truncate`,children:e}),(0,Y.jsx)(`span`,{className:`ml-1 text-fg-muted`,children:t.length})]}),(0,Y.jsx)(ts,{label:`${f?`Stage`:`Unstage`} all ${e.toLowerCase()}`,disabled:a,onClick:()=>s(Zo(t)),children:f?(0,Y.jsx)(qt,{className:`size-3.5`}):(0,Y.jsx)(Sr,{className:`size-3.5`})})]}),!l&&(o?t.map(e=>(0,Y.jsx)(rs,{entry:e,name:e.path,depth:0,area:n,active:r===e.path,action:i,busy:a,onAction:s,onOpen:c},`${e.path}:${e.old_path??``}`)):(0,Y.jsx)(is,{nodes:d,depth:0,area:n,activePath:r,action:i,busy:a,onAction:s,onOpen:c}))]})}function rs({entry:e,name:t,depth:n,area:r,active:i,action:o,busy:s,onAction:c,onOpen:l}){let u=qo(e.status),d=o===`stage`;return(0,Y.jsxs)(`div`,{className:a(`group flex items-center gap-1 pr-3 transition-colors hover:bg-elevated`,i&&`bg-selection`),style:{paddingLeft:12+n*12},children:[(0,Y.jsxs)(`button`,{type:`button`,title:e.path,onClick:()=>l(e.path,{root:void 0,gitArea:r}),onDoubleClick:()=>l(e.path,{preview:!1,root:void 0,gitArea:r}),className:`flex min-w-0 flex-1 items-center gap-1.5 py-1 text-left`,children:[(0,Y.jsx)(`span`,{className:a(`w-3 shrink-0 text-center font-mono text-xs`,u.colourClass),children:u.letter}),(0,Y.jsx)(Q,{text:t,className:`text-xs text-fg`,hoverClass:es})]}),(0,Y.jsx)(ts,{label:`${d?`Stage`:`Unstage`} ${e.path}`,disabled:s,onClick:()=>c(Zo([e])),children:d?(0,Y.jsx)(qt,{className:`size-3.5`}):(0,Y.jsx)(Sr,{className:`size-3.5`})})]})}function is({nodes:e,depth:t,area:n,activePath:r,action:i,busy:a,onAction:o,onOpen:s}){let[c,l]=(0,X.useState)(new Set),u=i===`stage`;return(0,Y.jsx)(Y.Fragment,{children:e.map(e=>{if(e.type===`file`)return(0,Y.jsx)(rs,{entry:e.entry,name:e.name,depth:t,area:n,active:r===e.path,action:i,busy:a,onAction:o,onOpen:s},`${e.entry.path}:${e.entry.old_path??``}`);let d=c.has(e.path);return(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`group flex items-center gap-1 pr-3 transition-colors hover:bg-elevated`,style:{paddingLeft:12+t*12},children:[(0,Y.jsxs)(`button`,{type:`button`,title:e.path,onClick:()=>l(t=>{let n=new Set(t);return n.has(e.path)?n.delete(e.path):n.add(e.path),n}),className:`flex min-w-0 flex-1 items-center gap-1 py-1 text-left`,children:[d?(0,Y.jsx)(Vt,{className:`size-3.5 shrink-0 text-fg-gold`}):(0,Y.jsx)(Bt,{className:`size-3.5 shrink-0 text-fg-gold`}),(0,Y.jsx)(Q,{text:e.name,className:`text-xs text-fg-secondary`,hoverClass:es})]}),(0,Y.jsx)(ts,{label:`${u?`Stage`:`Unstage`} ${e.path}`,disabled:a,onClick:()=>o(Zo(Vo(e))),children:u?(0,Y.jsx)(qt,{className:`size-3.5`}):(0,Y.jsx)(Sr,{className:`size-3.5`})})]}),!d&&(0,Y.jsx)(is,{nodes:e.children,depth:t+1,area:n,activePath:r,action:i,busy:a,onAction:o,onOpen:s})]},e.path)})})}function as(e){return e.detached?`Detached at ${e.head?.slice(0,8)??`HEAD`}`:e.branch??`Unborn branch`}function os(e){return[as(e),e.upstream,e.ahead>0?`${e.ahead} ahead`:null,e.behind>0?`${e.behind} behind`:null].filter(e=>e!=null).join(` · `)}function ss({session:e,targetRoot:t,repository:n,selected:r,activePath:i,onSelect:o,onOpen:s}){let[c,l]=(0,X.useState)(!1),[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(``),m=de(e,t),h=[...n.conflicts,...n.staged,...n.unstaged],g=m.isPending,_=async(e,t)=>{try{await m.mutateAsync(e),v.success(t)}catch(e){v.error(e instanceof Error?e.message:`Git operation failed`)}},y=(e,t)=>{_({action:e,repository:n.root,paths:t},e===`stage`?`Staged`:`Unstaged`)},b=async()=>{let e=f.trim();if(!e||g)return;let t=!1;if(n.staged.length===0){if(n.conflicts.length>0){v.error(`Resolve and stage merge changes before committing`);return}if(n.unstaged.length===0){v.error(`There are no changes to commit`);return}if(t=window.confirm(`Nothing is staged. Stage every change and commit it?`),!t)return}try{await m.mutateAsync({action:`commit`,repository:n.root,message:e,stage_all:t}),p(``),v.success(`Committed`)}catch(e){v.error(e instanceof Error?e.message:`Commit failed`)}},x=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),b())},S=(e,t)=>s(e,{...t,root:n.root});return(0,Y.jsxs)(`section`,{className:a(`py-0.5`,r&&`bg-surface/40`),onFocus:o,children:[(0,Y.jsxs)(`div`,{className:`flex h-8 items-center gap-1 pl-2 pr-2`,children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>{o(),l(e=>!e)},className:`group/repository flex min-w-0 flex-1 items-center gap-1.5 text-left transition-colors hover:text-fg`,children:[c?(0,Y.jsx)(Vt,{className:`size-3 shrink-0`}):(0,Y.jsx)(Bt,{className:`size-3 shrink-0`}),(0,Y.jsx)(Q,{text:n.name,title:n.name,className:`text-xs font-medium text-fg`,containerClassName:`flex-[0_1_auto]`,hoverClass:$o}),(0,Y.jsx)(Q,{text:n.relative_path,title:n.relative_path,className:`text-2xs text-fg-muted`,containerClassName:`flex-[0_1_auto]`,hoverClass:$o}),h.length>0&&(0,Y.jsx)(`span`,{className:`ml-auto text-2xs text-fg-muted`,children:h.length})]}),!c&&n.initialised&&h.length>0&&(0,Y.jsx)(ts,{label:u?`Show changes as tree`:`Show changes as flat list`,onClick:()=>d(e=>!e),children:u?(0,Y.jsx)(br,{className:`size-3.5`}):(0,Y.jsx)(hr,{className:`size-3.5`})})]}),!c&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`group flex min-h-7 items-center gap-2 px-3 text-2xs text-fg-muted`,children:[(0,Y.jsx)(Q,{text:os(n),title:os(n),hoverClass:Qo}),n.initialised&&n.has_remote&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(ts,{label:`Fetch`,disabled:g,onClick:()=>void _({action:`fetch`,repository:n.root},`Fetched`),children:(0,Y.jsx)(De,{className:`size-3.5`})}),n.upstream&&(0,Y.jsx)(ts,{label:`Pull`,disabled:g,onClick:()=>void _({action:`pull`,repository:n.root},`Pulled`),children:(0,Y.jsx)(Nr,{className:`size-3.5 rotate-180`})}),n.branch&&(0,Y.jsx)(ts,{label:n.upstream?`Push`:`Publish branch`,disabled:g,onClick:()=>void _({action:`push`,repository:n.root,set_upstream:!n.upstream},n.upstream?`Pushed`:`Branch published`),children:n.upstream?(0,Y.jsx)(kr,{className:`size-3.5`}):(0,Y.jsx)(Nr,{className:`size-3.5`})})]})]}),n.initialised?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`px-3 pb-1.5 pt-1`,children:[(0,Y.jsx)(`textarea`,{value:f,onChange:e=>p(e.target.value),onKeyDown:x,rows:2,placeholder:`Commit message`,"aria-label":`Commit message for ${n.name}`,className:`w-full resize-none rounded-sm bg-elevated px-2 py-1.5 text-xs text-fg outline-none placeholder:text-fg-muted focus:ring-1 focus:ring-focus`}),(0,Y.jsx)(`button`,{type:`button`,disabled:g||f.trim().length===0,onClick:()=>void b(),className:`mt-1 w-full rounded-sm bg-action py-1 text-xs text-action-ink transition-colors hover:bg-action-hover disabled:cursor-not-allowed disabled:opacity-40`,children:`Commit`})]}),(0,Y.jsx)(ns,{title:`Merge Changes`,entries:n.conflicts,area:`unstaged`,activePath:i,action:`stage`,busy:g,flat:u,onAction:e=>y(`stage`,e),onOpen:S}),(0,Y.jsx)(ns,{title:`Staged Changes`,entries:n.staged,area:`staged`,activePath:i,action:`unstage`,busy:g,flat:u,onAction:e=>y(`unstage`,e),onOpen:S}),(0,Y.jsx)(ns,{title:`Changes`,entries:n.unstaged,area:`unstaged`,activePath:i,action:`stage`,busy:g,flat:u,onAction:e=>y(`stage`,e),onOpen:S}),h.length===0&&(0,Y.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`No changes.`})]}):(0,Y.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`Submodule not initialised.`})]})]})}function cs({session:e,root:t,activeDiffPath:n,onOpenDiff:r,onOpenCommitFile:i}){let{height:a,handle:o}=uo(`changes-uncommitted`,240,{sized:`above`,min:80}),s=m(),c=s.data!==void 0&&xn(s.data.protocol),l=oe(e,{root:t,enabled:c}),[u,d]=(0,X.useState)(null);(0,X.useEffect)(()=>{if(!c||!l.data)return;let e=l.data.repositories;(!u||!e.some(e=>e.root===u))&&d(e[0]?.root??null)},[c,l.data,u]);let f=c?u??t:t;return(0,Y.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,Y.jsx)(`section`,{className:`flex shrink-0 flex-col`,style:{height:a,maxHeight:`70%`},children:c?(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pb-1`,children:l.isPending?(0,Y.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`Loading repositories…`}):l.error?(0,Y.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:l.error instanceof Error?l.error.message:`Failed to load repositories`}):l.data.repositories.length===0?(0,Y.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`No Git repositories.`}):l.data.repositories.map(i=>(0,Y.jsx)(ss,{session:e,targetRoot:t,repository:i,selected:u===i.root,activePath:n,onSelect:()=>d(i.root),onOpen:r},i.root))}):(0,Y.jsx)(Go,{session:e,root:t,activePath:n,onOpen:r})}),(0,Y.jsx)(fo,{handle:o,label:`Resize the uncommitted changes`}),(0,Y.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,Y.jsx)(`div`,{className:`flex h-7 shrink-0 items-center px-3`,children:(0,Y.jsx)(`span`,{className:`text-2xs font-medium uppercase tracking-wide text-fg-gold`,children:`History`})}),(0,Y.jsx)(Fo,{session:e,root:f,onOpenCommitFile:(e,t,n)=>i(e,t,{...n,root:f})})]})]})}function ls(e,t,n){return e!==null&&e.id===t&&n-e.at<1500}async function us(e){let t=e.createReader(),n=[];for(;;){let e=await new Promise((e,n)=>t.readEntries(e,n));if(e.length===0)return n;n.push(...e)}}function ds(e){return new Promise((t,n)=>e.file(t,n))}async function fs(e,t,n){if(e.isFile){let r=await ds(e);n.push(t?new File([r],`${t}/${e.name}`,{type:r.type,lastModified:r.lastModified}):r)}else if(e.isDirectory){let r=await us(e),i=t?`${t}/${e.name}`:e.name;for(let e of r)await fs(e,i,n)}}function ps(e,t,n){let r=Array.from(e??[]).map(e=>({entry:e.webkitGetAsEntry?.()??null,file:e.kind===`file`?e.getAsFile():null})),i=Array.from(t);return(async()=>{if(r.every(({entry:e,file:t})=>e===null&&t===null))return i;if(!n)return r.some(({entry:e})=>e?.isDirectory)&&v.error(`This daemon can't take folders — update it, or zip them first`),r.filter(({entry:e})=>e?.isDirectory!==!0).map(({file:e})=>e).filter(e=>e!==null);let e=[];for(let{entry:t,file:n}of r)t?.isDirectory?await fs(t,``,e):n&&e.push(n);return e})()}function ms(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}function hs(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function gs(e){let t=e.split(`/`).filter(e=>e!==``);t.pop();let n=[];for(let e of t)n.push(vs(n[n.length-1]??``,e));return n}function _s(e){let t=e.replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n<=0?`/`:t.slice(0,n)}function vs(e,t){return e===``?t:`${e}/${t}`}function ys(e){let t=new Set(e);return e.filter(e=>{if(e===``)return!0;for(let n=hs(e);;n=hs(n)){if(t.has(n))return!1;if(n===``)return!0}})}var bs=`application/x-puddle-paths`;function xs(e){return JSON.stringify(e)}function Ss(e){try{let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function Cs(e,t){let n=[],r=(i,a)=>{let o=e(i);if(o)for(let e of o.entries){let o=vs(i,e.name);n.push({path:o,name:e.name,type:e.type,depth:a,parentDir:i}),e.type===`dir`&&t.has(o)&&r(o,a+1)}};return r(``,0),n}function ws(e,t,n){let r=e.findIndex(e=>e.path===t),i=e.findIndex(e=>e.path===n);if(r===-1||i===-1)return n?[n]:[];let[a,o]=r<=i?[r,i]:[i,r];return e.slice(a,o+1).map(e=>e.path)}var Ts=(e,t)=>e instanceof Error?e.message:t;function Es(e,t){let n=p(),r=(0,X.useCallback)(()=>{n.invalidateQueries({queryKey:[`wt-tree`,e]}),n.invalidateQueries({queryKey:[`wt-git-status`,e]})},[n,e]);return(0,X.useMemo)(()=>({async create(n,i,a){try{let o=await B(e,vs(n,i),a,t);return r(),o.path}catch(e){return v.error(Ts(e,`Couldn't create ${i}`)),null}},async rename(n,i){let a=vs(n.includes(`/`)?n.slice(0,n.lastIndexOf(`/`)):``,i);try{let i=await I(e,n,a,t);return r(),i.path}catch(e){return v.error(Ts(e,`Couldn't rename ${ms(n)}`)),null}},async move(n,i){let a=await Promise.allSettled(n.map(n=>I(e,n,vs(i,ms(n)),t)));r();let o=a.filter(e=>e.status===`rejected`);o.length>0&&v.error(n.length===1?Ts(o[0].reason,`Couldn't move ${ms(n[0])}`):`Couldn't move ${o.length} item${o.length>1?`s`:``}`)},async remove(n){let i=await Promise.allSettled(n.map(n=>Te(e,n,t)));r();let a=i.filter(e=>e.status===`rejected`).length;a>0?v.error(`Couldn't delete ${a} item${a>1?`s`:``}`):v.success(n.length===1?`Deleted ${ms(n[0])}`:`Deleted ${n.length} items`)},async paste(n,i){let a=n.mode===`cut`?I:Ee,o=await Promise.allSettled(n.paths.map(n=>a(e,n,vs(i,ms(n)),t)));r();let s=o.filter(e=>e.status===`rejected`).length;s>0&&v.error(`Couldn't paste ${s} item${s>1?`s`:``}`)}}),[e,t,r])}function Ds(e,t,n){return n&&n.type!==`dir`||(e.includes(`/`)?e.slice(0,e.lastIndexOf(`/`)):``)===t?!1:t===``||!`${t}/`.startsWith(`${e}/`)}var Os=(0,X.createContext)(null);function ks(){let e=(0,X.useContext)(Os);if(!e)throw Error(`explorer components must render inside <ExplorerProvider>`);return e}function As(){return(0,X.useContext)(Os)}function js({session:e,root:t,readOnly:n=!1,onOpenFile:r,onOpenTerminal:i,activePath:a,children:o}){let s=e.id,c=p(),l=Es(s,t),u=t??e.worktree_path,d=(0,X.useCallback)(e=>t===void 0?[`wt-tree`,s,e]:[`wt-tree`,s,e,t],[s,t]),f=(0,X.useCallback)((e,r)=>{r.length===0||n||fe(s,e,r,t).then(()=>{c.invalidateQueries({queryKey:d(e)}),c.invalidateQueries({queryKey:[`wt-git-status`,s]}),v.success(r.length===1?`Uploaded ${r[0].name}`:`Uploaded ${r.length} files`)}).catch(e=>v.error(e instanceof Error?e.message:`Upload failed`))},[s,t,n,c,d]),h=m().data?.protocol,g=!h||h.major>9||h.major===9&&h.minor>=2,_=(0,X.useCallback)((e,t,n)=>{ps(t,n,g).then(t=>f(e,t)).catch(e=>v.error(e instanceof Error?e.message:`Couldn't read the dropped folder`))},[f,g]),[y,b]=(0,X.useState)(new Set),[x,S]=(0,X.useState)(new Set),[C,w]=(0,X.useState)(null),[T,E]=(0,X.useState)(null),[D,O]=(0,X.useState)(null),[k,ee]=(0,X.useState)(null),[A,j]=(0,X.useState)(null),M=(0,X.useRef)(null);(0,X.useEffect)(()=>{let e=()=>ee(null);return window.addEventListener(`dragend`,e),()=>window.removeEventListener(`dragend`,e)},[]);let te=se(s,{root:t,enabled:t===void 0||h!==void 0&&xn(h)}),ne=(0,X.useMemo)(()=>Jo(te.data?.entries??[]),[te.data]),N=te.refetch,[re,ie]=(0,X.useState)(0);(0,X.useEffect)(()=>c.getQueryCache().subscribe(e=>{if(e.type!==`added`&&e.type!==`removed`&&e.type!==`updated`)return;let t=e.query.queryKey;Array.isArray(t)&&t[0]===`wt-tree`&&t[1]===s&&ie(e=>e+1)}),[c,s]);let ae=(0,X.useMemo)(()=>Cs(e=>c.getQueryData(d(e)),y),[c,d,y,re]),P=(0,X.useCallback)(e=>{b(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),F=(0,X.useCallback)(e=>{b(t=>t.has(e)?t:new Set(t).add(e))},[]),oe=(0,X.useCallback)(()=>b(new Set),[]),[I,L]=(0,X.useState)(null);(0,X.useEffect)(()=>$a(e=>{if(e.root===t){eo();for(let t of gs(e.path))F(t);e.expandTarget&&e.path!==``&&F(e.path),S(new Set([e.path])),w(e.path),L(e.path)}}),[t,F]),(0,X.useEffect)(()=>{if(I===null)return;let e=document.querySelector(`[data-explorer-root] [data-path="${CSS.escape(I)}"]`);if(e){e.scrollIntoView({block:`nearest`}),L(null);return}let t=window.setTimeout(()=>L(null),4e3);return()=>window.clearTimeout(t)},[I,ae]);let ce=(0,X.useRef)(null),le=(0,X.useRef)(null),ue=(0,X.useCallback)(()=>{ce.current!==null&&(window.clearTimeout(ce.current),ce.current=null)},[]);(0,X.useEffect)(()=>ue,[ue]);let de=(0,X.useCallback)((e,t)=>{if(ue(),w(e.path),t.metaKey||t.ctrlKey){S(t=>{let n=new Set(t);return n.has(e.path)?n.delete(e.path):n.add(e.path),n}),M.current=e.path;return}if(t.shiftKey&&M.current){S(new Set(ws(ae,M.current,e.path)));return}let i=Date.now(),a=le.current;if(le.current={id:e.path,at:i},e.type!==`dir`&&!n&&!D&&x.size===1&&x.has(e.path)&&ls(a,e.path,i)){ce.current=window.setTimeout(()=>{ce.current=null,O({mode:`rename`,path:e.path})},500);return}S(new Set([e.path])),M.current=e.path,e.type===`dir`?P(e.path):r?.(s,e.path)},[ae,P,r,s,x,D,n,ue]),R=(0,X.useCallback)(e=>{ue(),e.type!==`dir`&&r?.(s,e.path,{preview:!1})},[r,s,ue]),pe=(0,X.useCallback)(e=>{S(new Set([e])),w(e),M.current=e},[]),B=(0,X.useCallback)(e=>E({paths:ys(e),mode:`cut`}),[]),me=(0,X.useCallback)(e=>E({paths:ys(e),mode:`copy`}),[]),he=(0,X.useCallback)(e=>{!T||n||l.paste(T,e).then(()=>{T.mode===`cut`&&E(null)})},[T,l,n]),ge=(0,X.useCallback)(e=>{n||O({mode:`rename`,path:e})},[n]),_e=(0,X.useCallback)((e,t)=>{n||(e!==``&&F(e),O({mode:`create`,parentDir:e,kind:t}))},[F,n]),ve=(0,X.useCallback)(()=>O(null),[]),ye=(0,X.useCallback)(e=>{let t=e.trim(),n=D;if(O(null),!(!n||t===``))if(n.mode===`rename`){if(t===ms(n.path))return;l.rename(n.path,t)}else l.create(n.parentDir,t,n.kind).then(e=>{e&&n.kind===`file`&&r?.(s,e)})},[D,l,r,s]),be=(0,X.useCallback)(e=>{if(n)return;let t=ys(e);t.length>0&&j(t)},[n]),xe=(0,X.useCallback)(()=>{let e=A;j(null),e&&l.remove(e)},[A,l]),Se=(0,X.useCallback)(()=>j(null),[]),Ce=(0,X.useCallback)((e,t)=>{let n=e.map(e=>t?e:vs(u,e)).join(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PaneEditorBody-BBt1St2c.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-CZI7_Jkm.js","assets/x-BJOrp_m5.js","assets/hotkeys-C1l8zghv.js","assets/editor-context-B4vRC3Ax.js","assets/preload-helper-Czpn1I53.js","assets/use-find-controls-Dqu5qm6L.js","assets/file-links-C3V-zpk_.js","assets/index-DmwsGjw6.js","assets/dialog-DjL0qoAv.js","assets/LazyTerminal-BCKBws3s.js","assets/index-Du89SpLI.css","assets/chevron-down-59O6CgEo.js","assets/editor.api2-4X9Vh9Zw.js","assets/editor-Br_kD0ds.css","assets/buffer-store-CQmyMib2.js","assets/buffer-logic-BrpRsL1b.js","assets/editor-sync-BDCiPHdG.js","assets/PaneEditorBody-Dz-67XSV.css","assets/ModelRefcount-DPfahuWS.js","assets/EditorTabClose-BKd4KqeO.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{a as n,n as r,o as i,r as a,t as o}from"./x-BJOrp_m5.js";import{D as s,Dt as c,E as l,G as u,I as d,K as f,Kt as p,L as m,O as h,Ot as g,Rt as _,Vt as v,Y as y,bt as b,ct as x,dt as S,et as C,ft as w,gt as T,ht as E,it as D,lt as O,mt as k,ot as ee,p as A,st as j,tt as M,u as te,ut as ne,v as N,vt as re,w as ie,x as ae,xt as P,z as F}from"./hotkeys-C1l8zghv.js";import{A as oe,C as I,E as L,F as se,I as ce,L as le,N as ue,O as de,R,S as z,T as fe,_ as pe,b as B,c as me,h as he,i as ge,l as _e,o as ve,r as ye,s as be,t as xe,u as Se,v as Ce,w as we,x as Te,y as Ee,z as De}from"./editor-context-B4vRC3Ax.js";import{t as Oe}from"./preload-helper-Czpn1I53.js";import{A as ke,C as Ae,D as je,a as Me,g as Ne,h as V,i as Pe,k as Fe,n as Ie,o as Le,r as Re,t as ze,y as Be}from"./dialog-DjL0qoAv.js";import{a as Ve,c as He,f as Ue,i as We,n as Ge,o as Ke,p as qe,r as Je,s as Ye,t as Xe}from"./LazyTerminal-BCKBws3s.js";import{A as Ze,C as Qe,D as $e,E as et,M as tt,O as nt,S as rt,T as it,_ as at,a as ot,b as st,c as ct,d as lt,f as ut,g as dt,h as ft,i as pt,j as mt,k as ht,l as gt,m as _t,n as vt,o as yt,p as bt,r as H,s as xt,t as St,u as Ct,v as wt,w as Tt,x as Et,y as Dt}from"./context-menu-D7fxOw4-.js";import{a as Ot,i as kt,o as At,r as jt,s as Mt,t as Nt}from"./file-links-C3V-zpk_.js";import{a as Pt,i as Ft,n as It,o as Lt,r as Rt,t as zt}from"./session-seed-BEWxqj6q.js";import{t as Bt}from"./chevron-down-59O6CgEo.js";import{r as Vt}from"./dist-DDFe8e3m.js";import{A as Ht,At as Ut,B as U,C as Wt,Ct as Gt,D as Kt,Dt as qt,E as Jt,Et as Yt,Ft as W,Gt as Xt,I as Zt,J as Qt,L as $t,M as G,Mt as en,N as tn,Nt as K,O as nn,Pt as q,R as rn,S as an,T as on,Tt as sn,Ut as cn,Wt as ln,X as un,Y as dn,Z as fn,_ as pn,_t as mn,b as hn,c as gn,ct as _n,d as vn,dt as yn,f as bn,ft as xn,g as Sn,h as Cn,ht as wn,i as Tn,it as En,j as Dn,jt as On,k as kn,l as An,lt as jn,m as Mn,n as Nn,nt as Pn,o as Fn,p as In,pt as Ln,s as Rn,st as zn,t as Bn,u as Vn,v as Hn,vt as Un,w as Wn,wt as Gn,x as Kn,y as qn}from"./index-DmwsGjw6.js";import{i as Jn}from"./buffer-logic-BrpRsL1b.js";var Yn=r(`arrow-right-left`,[[`path`,{d:`m16 3 4 4-4 4`,key:`1x1c3m`}],[`path`,{d:`M20 7H4`,key:`zbl0bi`}],[`path`,{d:`m8 21-4-4 4-4`,key:`h9nckh`}],[`path`,{d:`M4 17h16`,key:`g4d7ey`}]]),Xn=r(`chevrons-down-up`,[[`path`,{d:`m7 20 5-5 5 5`,key:`13a0gw`}],[`path`,{d:`m7 4 5 5 5-5`,key:`1kwcof`}]]),Zn=r(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Qn=r(`eraser`,[[`path`,{d:`M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21`,key:`g5wo59`}],[`path`,{d:`m5.082 11.09 8.828 8.828`,key:`1wx5vj`}]]),$n=r(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),er=r(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),tr=r(`file-archive`,[[`path`,{d:`M13.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v11.5`,key:`4pqfef`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 12v-1`,key:`1ej8lb`}],[`path`,{d:`M8 18v-2`,key:`qcmpov`}],[`path`,{d:`M8 7V6`,key:`1nbb54`}],[`circle`,{cx:`8`,cy:`20`,r:`2`,key:`ckkr5m`}]]),nr=r(`file-braces`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`1oajmo`}],[`path`,{d:`M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`mpwhp6`}]]),J=r(`file-code`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),rr=r(`file-cog`,[[`path`,{d:`M15 8a1 1 0 0 1-1-1V2a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8z`,key:`1ckgky`}],[`path`,{d:`M20 8v12a2 2 0 0 1-2 2h-4.182`,key:`1726p0`}],[`path`,{d:`m3.305 19.53.923-.382`,key:`ao1pio`}],[`path`,{d:`M4 10.592V4a2 2 0 0 1 2-2h8`,key:`1foop0`}],[`path`,{d:`m4.228 16.852-.924-.383`,key:`1fv9zy`}],[`path`,{d:`m5.852 15.228-.383-.923`,key:`1a9hc2`}],[`path`,{d:`m5.852 20.772-.383.924`,key:`1sh9ke`}],[`path`,{d:`m8.148 15.228.383-.923`,key:`4yu6lf`}],[`path`,{d:`m8.53 21.696-.382-.924`,key:`18b0s9`}],[`path`,{d:`m9.773 16.852.922-.383`,key:`ti6xop`}],[`path`,{d:`m9.773 19.148.922.383`,key:`rws47d`}],[`circle`,{cx:`7`,cy:`18`,r:`3`,key:`lvkj7j`}]]),ir=r(`file-headphone`,[[`path`,{d:`M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343`,key:`1vfytu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0`,key:`1etmh7`}]]),ar=r(`file-image`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]),or=r(`file-key`,[[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M4 12v6`,key:`bg1pfk`}],[`path`,{d:`M4 14h2`,key:`1sf9f8`}],[`path`,{d:`M9.65 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v4`,key:`d56i0q`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),sr=r(`file-lock`,[[`path`,{d:`M4 9.8V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3`,key:`1432pc`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M9 17v-2a2 2 0 0 0-4 0v2`,key:`168m41`}],[`rect`,{width:`8`,height:`5`,x:`3`,y:`17`,rx:`1`,key:`o8vfew`}]]),cr=r(`file-play`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z`,key:`1tzo1f`}]]),lr=r(`file-spreadsheet`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]),ur=r(`file-terminal`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m8 16 2-2-2-2`,key:`10vzyd`}],[`path`,{d:`M12 18h4`,key:`1wd2n7`}]]),dr=r(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),fr=r(`file-type`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M11 18h2`,key:`12mj7e`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`M9 13v-.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 .5.5v.5`,key:`qbrxap`}]]),pr=r(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),mr=r(`folder-closed`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}],[`path`,{d:`M2 10h20`,key:`1ir3d8`}]]),hr=r(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),gr=r(`folder-x`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}],[`path`,{d:`m9.5 10.5 5 5`,key:`ra9qjz`}],[`path`,{d:`m14.5 10.5-5 5`,key:`l2rkpq`}]]),_r=r(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),vr=r(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),yr=r(`link`,[[`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`}]]),br=r(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),xr=r(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),Sr=r(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),Cr=r(`panel-left-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]]),wr=r(`panel-left-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]]),Tr=r(`panel-right-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m8 9 3 3-3 3`,key:`12hl5m`}]]),Er=r(`panel-right-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m10 15-3-3 3-3`,key:`1pgupc`}]]),Dr=r(`pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]),Or=r(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),kr=r(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),Ar=r(`shield-off`,[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71`,key:`1jlk70`}],[`path`,{d:`M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264`,key:`18rp1v`}]]),jr=r(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Mr=r(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),Nr=r(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),Pr=r(`user-round-cog`,[[`path`,{d:`m14.305 19.53.923-.382`,key:`3m78fa`}],[`path`,{d:`m15.228 16.852-.923-.383`,key:`npixar`}],[`path`,{d:`m16.852 15.228-.383-.923`,key:`5xggr7`}],[`path`,{d:`m16.852 20.772-.383.924`,key:`dpfhf9`}],[`path`,{d:`m19.148 15.228.383-.923`,key:`1reyyz`}],[`path`,{d:`m19.53 21.696-.382-.924`,key:`1goivc`}],[`path`,{d:`M2 21a8 8 0 0 1 10.434-7.62`,key:`1yezr2`}],[`path`,{d:`m20.772 16.852.924-.383`,key:`htqkph`}],[`path`,{d:`m20.772 19.148.924.383`,key:`9w9pjp`}],[`circle`,{cx:`10`,cy:`8`,r:`5`,key:`o932ke`}],[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}]]),Y=n(),X=e(t(),1);function Fr(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function Ir(e,t){let n=getComputedStyle(e.ownerDocument.documentElement);return t*parseFloat(n.fontSize)}function Lr(e){return e/100*window.innerHeight}function Rr(e){return e/100*window.innerWidth}function zr(e){switch(typeof e){case`number`:return[e,`px`];case`string`:{let t=parseFloat(e);return e.endsWith(`%`)?[t,`%`]:e.endsWith(`px`)?[t,`px`]:e.endsWith(`rem`)?[t,`rem`]:e.endsWith(`em`)?[t,`em`]:e.endsWith(`vh`)?[t,`vh`]:e.endsWith(`vw`)?[t,`vw`]:[t,`%`]}}}function Br({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=zr(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=Ir(t,i);break;case`em`:r=Fr(t,i);break;case`vh`:r=Lr(i);break;case`vw`:r=Rr(i);break}return r}function Vr(e){return parseFloat(e.toFixed(3))}function Hr({group:e}){let{orientation:t,panels:n}=e;return n.reduce((e,n)=>(e+=t===`horizontal`?n.element.offsetWidth:n.element.offsetHeight,e),0)}function Ur(e){let{panels:t}=e,n=Hr({group:e});return n===0?t.map(e=>({groupResizeBehavior:e.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:e.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:e.panelConstraints.disabled,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let{element:t,panelConstraints:r}=e,i=0;r.collapsedSize!==void 0&&(i=Vr(Br({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=Vr(Br({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=Vr(Br({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=Vr(Br({groupSize:n,panelElement:t,styleProp:r.maxSize})/n*100)),{groupResizeBehavior:r.groupResizeBehavior,collapsedSize:i,collapsible:r.collapsible===!0,defaultSize:a,disabled:r.disabled,minSize:o,maxSize:s,panelId:e.id}})}function Z(e,t=`Assertion error`){if(!e)throw Error(t)}function Wr(e,t){return Array.from(t).sort(e===`horizontal`?Gr:Kr)}function Gr(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function Kr(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function qr(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function Jr(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function Yr({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},i,a=Number.MAX_VALUE;for(let n of t){let{x:t,y:o}=Jr(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return Z(i,`No rect found`),i}var Xr;function Zr(){return Xr===void 0&&(Xr=typeof matchMedia==`function`&&!!matchMedia(`(pointer:coarse)`).matches),Xr}function Qr(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=Wr(n,Array.from(t.children).filter(qr).map(e=>({element:e}))).map(({element:e})=>e),o=[],s=!1,c=!1,l=-1,u=-1,d=0,f,p=[];{let e=-1;for(let t of a)t.hasAttribute(`data-panel`)&&(e++,t.hasAttribute(`data-disabled`)||(d++,l===-1&&(l=e),u=e))}if(d>1){let t=-1;for(let d of a)if(d.hasAttribute(`data-panel`)){t++;let i=r.find(e=>e.element===d);if(i){if(f){let r=f.element.getBoundingClientRect(),a=d.getBoundingClientRect(),m;if(c){let e=n===`horizontal`?new DOMRect(r.right,r.top,0,r.height):new DOMRect(r.left,r.bottom,r.width,0),t=n===`horizontal`?new DOMRect(a.left,a.top,0,a.height):new DOMRect(a.left,a.top,a.width,0);switch(p.length){case 0:m=[e,t];break;case 1:{let i=p[0];m=[i,Yr({orientation:n,rects:[r,a],targetRect:i.element.getBoundingClientRect()})===r?t:e];break}default:m=p;break}}else m=p.length?p:[n===`horizontal`?new DOMRect(r.right,a.top,a.left-r.right,a.height):new DOMRect(a.left,r.bottom,a.width,a.top-r.bottom)];for(let n of m){let r=`width`in n?n:n.element.getBoundingClientRect(),a=Zr()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(r.width<a){let e=a-r.width;r=new DOMRect(r.x-e/2,r.y,r.width+e,r.height)}if(r.height<a){let e=a-r.height;r=new DOMRect(r.x,r.y-e/2,r.width,r.height+e)}!s&&!(t<=l||t>u)&&o.push({group:e,groupSize:Hr({group:e}),panels:[f,i],separator:`width`in n?void 0:n,rect:r}),s=!1}}c=!1,f=i,p=[]}}else if(d.hasAttribute(`data-separator`)){d.ariaDisabled!==null&&(s=!0);let e=i.find(e=>e.element===d);e?p.push(e):(f=void 0,p=[])}else c=!0}return o}var $r=class{#e={};addListener(e,t){let n=this.#e[e];return n===void 0?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#e[e];if(n!==void 0)if(n.length===1)n[0].call(null,t);else{let e=!1,r=null,i=Array.from(n);for(let n=0;n<i.length;n++){let a=i[n];try{a.call(null,t)}catch(t){r===null&&(e=!0,r=t)}}if(e)throw r}}removeAllListeners(){this.#e={}}removeListener(e,t){let n=this.#e[e];if(n!==void 0){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}},ei={cursorFlags:0,state:`inactive`},ti=new $r;function ni(){return ei}function ri(e){return ti.addListener(`change`,e)}function ii(e){let t=ei,n={...ei};n.cursorFlags=e,ei=n,ti.emit(`change`,{prev:t,next:n})}function ai(e){let t=ei;ei=e,ti.emit(`change`,{prev:t,next:e})}var oi=e=>e,si=()=>{},ci=1,li=2,ui=4,di=8,fi=3,pi=12,mi;function hi(){return mi===void 0&&(mi=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(mi=!0)),mi}function gi({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case`active`:case`hover`:t.forEach(e=>{if(!e.mutableState.disableCursor)switch(e.orientation){case`horizontal`:r++;break;case`vertical`:i++;break}})}if(!(r===0&&i===0)){switch(n){case`active`:if(e&&hi()){let t=(e&ci)!==0,n=(e&li)!==0,r=(e&ui)!==0,i=(e&di)!==0;if(t)return r?`se-resize`:i?`ne-resize`:`e-resize`;if(n)return r?`sw-resize`:i?`nw-resize`:`w-resize`;if(r)return`s-resize`;if(i)return`n-resize`}break}return hi()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var _i=new WeakMap;function vi(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=_i.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(n):e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]));let r=ni();switch(r.state){case`active`:case`hover`:{let e=gi({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(e=>e.group),state:r.state}),i=`*, *:hover {cursor: ${e} !important; }`;if(t===i)return;t=i,e?n.cssRules.length===0?n.insertRule(i):n.replaceSync(i):n.cssRules.length===1&&n.deleteRule(0);break}case`inactive`:t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}_i.set(e,{prevStyle:t,styleSheet:n})}var yi=new Map,bi=new $r;function xi(e){yi=new Map(yi),yi.delete(e)}function Si(e,t){for(let[t]of yi)if(t.id===e)return t}function Ci(e,t){for(let[t,n]of yi)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function wi(){return yi}function Ti(e,t){return bi.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function Ei(e,t,n){let r=yi.get(e);yi=new Map(yi),yi.set(e,t),bi.emit(`groupChange`,{group:e,isUserInteraction:n?.isUserInteraction===!0,prev:r,next:t})}function Di(e){let t=ni(),n=!1;switch(t.state){case`active`:ai({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(vi(e),n=!0,t.hitRegions.forEach(e=>{let t=Ci(e.group.id,!0);Ei(e.group,t,{isUserInteraction:!0})}))}return n}function Oi(e){e.defaultPrevented||Di(e.currentTarget)}function ki(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=Jr(n,a.rect);switch(e){case`horizontal`:t.x<=i.x&&(r=a,i=t);break;case`vertical`:t.y<=i.y&&(r=a,i=t);break}}return r?{distance:i,hitRegion:r}:void 0}function Ai(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function ji(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:Li(e),b:Li(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();Z(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:Ii(Fi(n.a)),b:Ii(Fi(n.b))};if(i.a===i.b){let e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(i.a-i.b)}var Mi=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Ni(e){let t=getComputedStyle(Ri(e)??e).display;return t===`flex`||t===`inline-flex`}function Pi(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||Ni(e))||+t.opacity<1||`transform`in t&&t.transform!==`none`||`webkitTransform`in t&&t.webkitTransform!==`none`||`mixBlendMode`in t&&t.mixBlendMode!==`normal`||`filter`in t&&t.filter!==`none`||`webkitFilter`in t&&t.webkitFilter!==`none`||`isolation`in t&&t.isolation===`isolate`||Mi.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function Fi(e){let t=e.length;for(;t--;){let n=e[t];if(Z(n,`Missing node`),Pi(n))return n}return null}function Ii(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Li(e){let t=[];for(;e;)t.push(e),e=Ri(e);return t}function Ri(e){let{parentNode:t}=e;return Ai(t)?t.host:t}function zi(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function Bi({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!qr(n)||n.contains(e)||e.contains(n))return!0;if(ji(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(zi(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function Vi(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=Qr(r),a=ki(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&Bi({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function Hi(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function Ui(e,t,n=0){return Math.abs(Vr(e)-Vr(t))<=n}function Wi(e,t){return Ui(e,t)?0:e>t?1:-1}function Gi({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){let{collapsedSize:i=0,collapsible:a,disabled:o,maxSize:s=100,minSize:c=0}=t;if(o&&!e)return n;if(Wi(r,c)<0)if(a){let e=(i+c)/2;r=Wi(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=Vr(r),r}function Ki({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(Ui(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;Z(u!=null,`Invalid first pivot index`),Z(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];Z(r,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(Z(n!=null,`Previous layout not found for panel index ${t}`),Ui(n,i)){let t=o-n;Wi(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];Z(r,`No panel constraints found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(Z(n!=null,`Previous layout not found for panel index ${t}`),Ui(n,o)){let t=n-i;Wi(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];Z(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&Wi(i,c)<0)if(e>0){let t=c-o,n=t/2;Wi(i+e,c)<0&&(e=Wi(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;Wi(i-e,c)<0&&(e=Wi(100+e,n)>0?0:-t)}break}}{let t=e<0?1:-1,r=e<0?d:u,i=0;for(;;){let e=s[r];Z(e!=null,`Previous layout not found for panel index ${r}`);let a=Gi({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:e,size:100})-e;if(i+=a,r+=t,r<0||r>=n.length)break}let a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let t=e<0?u:d;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(f),i=s[t];Z(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=Gi({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!Ui(i,c)&&(f+=i-c,l[t]=c,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(Hi(c,l))return i;{let t=e<0?d:u,r=s[t];Z(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=Gi({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!Ui(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];Z(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=Gi({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(Ui(i,s)||(t-=s-i,l[r]=s),Ui(t,0))break;e>0?r--:r++}}}if(!Ui(Object.values(l).reduce((e,t)=>t+e,0),100,.1))return i;let p=Object.keys(i);return l.reduce((e,t,n)=>(e[p[n]]=t,e),{})}function qi(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||Wi(e[n],t[n])!==0)return!1;return!0}function Ji({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n],i=r.reduce((e,t)=>e+t,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(e=>`${e}%`).join(`, `)}`);if(!Ui(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];Z(t!=null,`No layout data found for index ${e}`),r[e]=100/i*t}let a=0;for(let e=0;e<t.length;e++){let i=n[e];Z(i!=null,`No layout data found for index ${e}`);let o=r[e];Z(o!=null,`No layout data found for index ${e}`);let s=Gi({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!Ui(a,0))for(let e=0;e<t.length;e++){let n=r[e];Z(n!=null,`No layout data found for index ${e}`);let i=n+a,o=Gi({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,Ui(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function Yi({groupId:e,panelId:t}){let n=()=>{let t=wi();for(let[n,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:a,groupSize:o,separatorToPanels:s}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:n,groupSize:o,layout:a,separatorToPanels:s};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(e!==void 0)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},o=({nextSize:e,panels:n,prevLayout:r,derivedPanelConstraints:i})=>{let o=a(),s=n.findIndex(e=>e.id===t),c=s===0,l=s===n.length-1;if(l&&e<o&&(c||n.slice(0,s).every((e,t)=>{let n=i[t];return n?.collapsible&&Ui(n.collapsedSize,r[n.panelId])}))){let e=n.slice(0,s).reduce((e,t)=>e+r[t.id],0);return{...r,[t]:Vr(100-e)}}return Ki({delta:l?o-e:e-o,initialLayout:r,panelConstraints:i,pivotIndices:l?[s-1,s]:[s,s+1],prevLayout:r,trigger:`imperative-api`})},s=e=>{if(e===a())return;let{defaultLayoutDeferred:t,derivedPanelConstraints:r,group:i,groupSize:s,layout:c,separatorToPanels:l}=n(),u=Ji({layout:o({nextSize:e,panels:i.panels,prevLayout:c,derivedPanelConstraints:r}),panelConstraints:r});qi(c,u)||Ei(i,{defaultLayoutDeferred:t,derivedPanelConstraints:r,groupSize:s,layout:u,separatorToPanels:l})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),o=a();e&&o!==t&&(n.expandToSize=o,s(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:o}=i(),c=a();if(e&&c===t){let e=o.expandToSize??n;e===0&&(e=1),s(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:e.orientation===`horizontal`?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&Ui(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=Hr({group:t}),o=Vr(Br({groupSize:a,panelElement:r,styleProp:e})/a*100);s(o)}}}function Xi(e){e.defaultPrevented||Vi(e,wi()).forEach(t=>{if(t.separator&&!t.separator.disableDoubleClick){let n=t.panels.find(e=>e.panelConstraints.defaultSize!==void 0);if(n){let r=n.panelConstraints.defaultSize,i=Yi({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function Zi(e){let t=wi();for(let[n]of t)if(n.separators.some(t=>t.element===e))return n;throw Error(`Could not find parent Group for separator element`)}function Qi({groupId:e}){let t=()=>{let t=wi();for(let[n,r]of t)if(n.id===e)return{group:n,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:i,groupSize:a,layout:o,separatorToPanels:s}=t(),c=Ji({layout:e,panelConstraints:r});return n?o:(qi(o,c)||Ei(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function $i(e,t){let n=Zi(e),r=Ci(n.id,!0),i=n.separators.find(t=>t.element===e);Z(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);Z(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=Qi({groupId:n.id}).getLayout(),c=Ji({layout:Ki({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});qi(s,c)||Ei(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels},{isUserInteraction:!0})}function ea(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=Zi(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&$i(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&$i(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&$i(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&$i(t,-5);break;case`End`:e.preventDefault(),$i(t,100);break;case`Enter`:{e.preventDefault();let n=Zi(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=Ci(n.id,!0),o=n.separators.find(e=>e.element===t);Z(o,`Matching separator not found`);let s=a.get(o);Z(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(Z(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];$i(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=Zi(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);Z(r!==null,`Index not found`),n[e.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0].focus({preventScroll:!0});break}case`Home`:e.preventDefault(),$i(t,-100);break}}function ta(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=wi(),n=Vi(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({focusVisible:!1,preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),ai({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}function na({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:a,prevCursorFlags:o}){let s=0;n.forEach(e=>{let{group:n,groupSize:o}=e,{orientation:c,panels:l}=n,{disableCursor:u}=n.mutableState,d=0;d=a?c===`horizontal`?(t.clientX-a.x)/o*100:(t.clientY-a.y)/o*100:c===`horizontal`?t.clientX<0?-100:100:t.clientY<0?-100:100;let f=r.get(n),p=i.get(n);if(!f||!p)return;let{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:_,separatorToPanels:v}=p;if(h&&_&&v){let t=Ki({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(qi(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?ci:li;break;case`vertical`:s|=d<0?ui:di;break}}else Ei(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&fi:c|=s&fi,t.movementY===0?c|=o&pi:c|=s&pi,ii(c),vi(e)}function ra(e){let t=wi(),n=ni();switch(n.state){case`active`:na({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function ia(e){if(e.defaultPrevented)return;let t=ni(),n=wi();switch(t.state){case`active`:if(e.buttons===0){ai({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=Ci(e.group.id,!0);Ei(e.group,t,{isUserInteraction:!0})});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}na({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=Vi(e,n);r.length===0?t.state!==`inactive`&&ai({cursorFlags:0,state:`inactive`}):ai({cursorFlags:0,hitRegions:r,state:`hover`}),vi(e.currentTarget);break}}}function aa(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(ni().state){case`hover`:ai({cursorFlags:0,state:`inactive`})}}function oa(e){e.defaultPrevented||e.pointerType===`mouse`&&e.button>0||Di(e.currentTarget)&&e.preventDefault()}function sa(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=Vr(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=Vr((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function ca(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=Hr({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:Vr(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function la(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function ua({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let i=0,a=0,o=!1,s=new Map,c=[];for(let l of e.panels){let e=r[l.id]??0;switch(l.panelConstraints.groupResizeBehavior){case`preserve-pixel-size`:{o=!0;let r=Vr(e/100*n/t*100);s.set(l.id,r),i+=r;break}default:c.push(l.id),a+=e;break}}if(!o||c.length===0)return r;let l=100-i,u={...r};if(s.forEach((e,t)=>{u[t]=e}),a>0)for(let e of c)u[e]=Vr((r[e]??0)/a*l);else{let e=Vr(l/c.length);for(let t of c)u[t]=e}return u}function da(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}var fa=new Map;function pa(e){let t=!0;Z(e.element.ownerDocument.defaultView,`Cannot register an unmounted Group`);let n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,a=new n(n=>{for(let r of n){let{borderBoxSize:n,target:i}=r;if(i===e.element){if(t){let t=Hr({group:e});if(t===0)return;let n=Ci(e.id);if(!n)return;let r=Ur(e),i=n.defaultLayoutDeferred?sa(r):n.layout,a=Ji({layout:ua({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&qi(n.layout,a)&&la(n.derivedPanelConstraints,r)&&n.groupSize===t)return;Ei(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else ca(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{Z(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&a.observe(e.element)});let o=Hr({group:e}),s=Ur(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(da(e.panels,l)||(l=void 0));let u=Ji({layout:e.mutableState.layouts[c]??l??sa(s),panelConstraints:s}),d=e.element.ownerDocument;fa.set(d,(fa.get(d)??0)+1);let f=new Map;return Qr(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),Ei(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{Z(!i.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),i.add(e.id),e.element.addEventListener(`keydown`,ea)}),fa.get(d)===1&&(d.addEventListener(`contextmenu`,Oi,!0),d.addEventListener(`dblclick`,Xi,!0),d.addEventListener(`pointerdown`,ta,!0),d.addEventListener(`pointerleave`,ra),d.addEventListener(`pointermove`,ia),d.addEventListener(`pointerout`,aa),d.addEventListener(`pointerup`,oa,!0)),function(){t=!1,fa.set(d,Math.max(0,(fa.get(d)??0)-1)),xi(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,ea)}),fa.get(d)||(d.removeEventListener(`contextmenu`,Oi,!0),d.removeEventListener(`dblclick`,Xi,!0),d.removeEventListener(`pointerdown`,ta,!0),d.removeEventListener(`pointerleave`,ra),d.removeEventListener(`pointermove`,ia),d.removeEventListener(`pointerout`,aa),d.removeEventListener(`pointerup`,oa,!0)),a.disconnect()}}function ma(){let[e,t]=(0,X.useState)({});return[e,(0,X.useCallback)(()=>t({}),[])]}function ha(e){let t=(0,X.useId)();return`${e??t}`}var ga=typeof window<`u`?X.useLayoutEffect:X.useEffect;function _a(e){let t=(0,X.useRef)(e);return ga(()=>{t.current=e},[e]),(0,X.useCallback)((...e)=>t.current?.(...e),[t])}function va(...e){return _a(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function ya(e){let t=(0,X.useRef)({...e});return ga(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var ba=(0,X.createContext)(null);function xa(e,t){let n=(0,X.useRef)({getLayout:()=>({}),setLayout:oi});(0,X.useImperativeHandle)(t,()=>n.current,[]),ga(()=>{Object.assign(n.current,Qi({groupId:e}))})}function Sa({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:a,groupRef:o,id:s,onLayoutChange:c,onLayoutChanged:l,orientation:u=`horizontal`,resizeTargetMinimumSize:d={coarse:20,fine:10},style:f,...p}){let m=(0,X.useRef)({onLayoutChange:{},onLayoutChanged:{}}),h=_a(e=>{qi(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=_a((e,t)=>{qi(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e,{isUserInteraction:t}))}),_=ha(s),v=(0,X.useRef)(null),[y,b]=ma(),x=(0,X.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=va(v,a);xa(_,o);let C=_a((e,t)=>{let r=ni(),i=Si(e),a=Ci(e);if(a){let e=!1;switch(r.state){case`active`:e=r.hitRegions.some(e=>e.group===i);break}return{flexGrow:a.layout[t]??1,pointerEvents:e?`none`:void 0}}if(n?.[t])return{flexGrow:n?.[t]}}),w=ya({defaultLayout:n,disableCursor:r}),T=(0,X.useMemo)(()=>({get disableCursor(){return!!w.disableCursor},getPanelStyles:C,id:_,orientation:u,registerPanel:e=>{let t=x.current;return t.panels=Wr(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=Wr(u,[...t.separators,e]),b(),()=>{t.separators=t.separators.filter(t=>t!==e),b()}},updatePanelProps:(e,{disabled:t})=>{let n=x.current.panels.find(t=>t.id===e);n&&(n.panelConstraints.disabled=t);let r=Si(_),i=Ci(_);r&&i&&Ei(r,{...i,derivedPanelConstraints:Ur(r)})},updateSeparatorProps:(e,{disabled:t,disableDoubleClick:n})=>{let r=x.current.separators.find(t=>t.id===e);r&&(r.disabled=t,r.disableDoubleClick=n)}}),[C,_,b,u,w]),E=(0,X.useRef)(null);return ga(()=>{let e=v.current;if(e===null)return;let t=x.current,n;if(w.defaultLayout!==void 0&&Object.keys(w.defaultLayout).length===t.panels.length){n={};for(let e of t.panels){let t=w.defaultLayout[e.id];t!==void 0&&(n[e.id]=t)}}let r={disabled:!!i,element:e,id:_,mutableState:{defaultLayout:n,disableCursor:!!w.disableCursor,expandedPanelSizes:x.current.lastExpandedPanelSizes,layouts:x.current.layouts},orientation:u,panels:t.panels,resizeTargetMinimumSize:t.resizeTargetMinimumSize,separators:t.separators};E.current=r;let a=pa(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=Ci(r.id,!0);!o&&s.length>0&&(h(c),g(c,!1));let l=Ti(_,e=>{let{defaultLayoutDeferred:t,derivedPanelConstraints:n,layout:i}=e.next;if(t||n.length===0)return;let a=r.panels.map(({id:e})=>e).join(`,`);r.mutableState.layouts[a]=i,n.forEach(t=>{if(t.collapsible){let{layout:n}=e.prev??{};if(n){let e=Ui(t.collapsedSize,i[t.panelId]),a=Ui(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=ni().state!==`active`;h(i),o&&g(i,e.isUserInteraction)});return()=>{E.current=null,a(),l()}},[i,_,g,h,u,y,w]),(0,X.useEffect)(()=>{let e=E.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,Y.jsx)(ba.Provider,{value:T,children:(0,Y.jsx)(`div`,{...p,className:t,"data-group":!0,"data-testid":_,id:_,ref:S,style:{height:`100%`,width:`100%`,overflow:`hidden`,...f,display:`flex`,flexDirection:u===`horizontal`?`row`:`column`,flexWrap:`nowrap`,touchAction:u===`horizontal`?`pan-y`:`pan-x`},children:e})})}Sa.displayName=`Group`;function Ca(){let e=(0,X.useContext)(ba);return Z(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function wa(e,t){let{id:n}=Ca(),r=(0,X.useRef)({collapse:si,expand:si,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:si});(0,X.useImperativeHandle)(t,()=>r.current,[]),ga(()=>{Object.assign(r.current,Yi({groupId:n,panelId:e}))})}function Ta({children:e,className:t,collapsedSize:n=`0%`,collapsible:r=!1,defaultSize:i,disabled:a,elementRef:o,groupResizeBehavior:s=`preserve-relative-size`,id:c,maxSize:l=`100%`,minSize:u=`0%`,onResize:d,panelRef:f,style:p,...m}){let h=!!c,g=ha(c),_=ya({disabled:a}),v=(0,X.useRef)(null),y=va(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=Ca(),T=d!==null,E=_a((e,t,n)=>{d?.(e,c,n)});ga(()=>{let e=v.current;if(e!==null){let t={element:e,id:g,idIsStable:h,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:T?E:void 0,panelConstraints:{groupResizeBehavior:s,collapsedSize:n,collapsible:r,defaultSize:i,disabled:_.disabled,maxSize:l,minSize:u}};return C(t)}},[s,n,r,i,T,g,h,l,u,E,C,_]),(0,X.useEffect)(()=>{w(g,{disabled:a})},[a,g,w]),wa(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,X.useSyncExternalStore)(e=>Ti(x,e),D,D),k;return k=O?JSON.parse(O):i===void 0?{flexGrow:1}:{flexGrow:void 0,flexShrink:void 0,flexBasis:i},(0,Y.jsx)(`div`,{...m,"data-disabled":a||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...Ea,display:`flex`,flexBasis:0,flexShrink:1,overflow:`visible`,...k},children:(0,Y.jsx)(`div`,{className:t,style:{maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`,...p,touchAction:S===`horizontal`?`pan-y`:`pan-x`},children:e})})}Ta.displayName=`Panel`;var Ea={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function Da({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a,o=e[n],s=t.find(e=>e.panelId===n);if(s){let c=s.maxSize,l=s.collapsible?s.collapsedSize:s.minSize,u=[r,r+1];a=Ji({layout:Ki({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=Ji({layout:Ki({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function Oa({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=ha(a),l=ya({disabled:n,disableDoubleClick:r}),[u,d]=(0,X.useState)({}),[f,p]=(0,X.useState)(`inactive`),[m,h]=(0,X.useState)(!1),g=(0,X.useRef)(null),_=va(g,i),{disableCursor:v,id:y,orientation:b,registerSeparator:x,updateSeparatorProps:S}=Ca(),C=b===`horizontal`?`vertical`:`horizontal`;ga(()=>{let e=g.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=x(t),r=ri(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=Ti(y,e=>{let{derivedPanelConstraints:n,layout:r,separatorToPanels:i}=e.next,a=i.get(t);if(a){let e=a[0],t=a.indexOf(e);d(Da({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[y,c,x,l]),(0,X.useEffect)(()=>{S(c,{disabled:n,disableDoubleClick:r})},[n,r,c,S]);let w;n&&!v&&(w=`not-allowed`);let T;if(n)T=`disabled`;else switch(f){case`active`:T=`active`;break;default:T=m?`focus`:f}return(0,Y.jsx)(`div`,{...s,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":C,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":T,"data-testid":c,id:c,onBlur:()=>h(!1),onFocus:()=>h(!0),ref:_,role:`separator`,style:{flexBasis:`auto`,cursor:w,...o,flexGrow:0,flexShrink:0,touchAction:`none`},tabIndex:n?void 0:0})}Oa.displayName=`Separator`;function ka(e){if(e===null)return!1;if(Zt(e)===`untitled`){let t=me(e.path);return t===void 0?!1:(ve({name:e.path,content:t}),!0)}return pe(Ce(e.session,e.path,e.root))}function Aa({request:e,targetSession:t,targetRoot:n,targetLabel:r,profileId:i,onClose:a,onSaved:o}){let[s,c]=(0,X.useState)(``),[l,u]=(0,X.useState)(null),[d,f]=(0,X.useState)(!1);(0,X.useEffect)(()=>{e&&(c(e.name),u(null))},[e]);let p=async()=>{if(!e||!t)return;let a=s.trim().replace(/^\/+/,``).replace(/\/+$/,``);if(a===``){u(`Give the file a path.`);return}f(!0),u(null);try{let s=!0;try{await P(`GET`,`/api/worktrees/${t.id}/file?path=${encodeURIComponent(a)}${we(n)}`)}catch(e){if(e instanceof b&&e.status===404)s=!1;else if(e instanceof b&&e.status===413)s=!0;else throw e}if(s){u(`${a} already exists in ${r}.`);return}await P(`PUT`,`/api/worktrees/${t.id}/file?path=${encodeURIComponent(a)}${we(n)}`,{content:e.content}),i!==void 0&&await Se(i,e.name).catch(()=>void 0),ge(e.name),o(e.name,t.id,a,n)}catch(e){u(e instanceof Error?e.message:`Save failed`)}finally{f(!1)}};return(0,Y.jsx)(ze,{open:e!==null,onOpenChange:e=>!e&&a(),children:(0,Y.jsxs)(Ie,{children:[(0,Y.jsxs)(Me,{children:[(0,Y.jsx)(Le,{children:`Save draft into the worktree`}),(0,Y.jsx)(Re,{children:t?(0,Y.jsxs)(Y.Fragment,{children:[`Saves into `,(0,Y.jsx)(`span`,{className:`text-fg-secondary`,children:r}),` — what the sidebar is bound to.`]}):`No worktree is bound — open or focus a session first.`})]}),(0,Y.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),p()},children:[(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Y.jsx)(Ye,{htmlFor:`untitled-path`,children:`Worktree-relative path`}),(0,Y.jsx)(He,{id:`untitled-path`,placeholder:`docs/notes.md`,value:s,onChange:e=>c(e.target.value),autoFocus:!0})]}),l&&(0,Y.jsx)(`p`,{className:`text-xs text-danger`,children:l}),(0,Y.jsxs)(Pe,{children:[(0,Y.jsx)(V,{type:`button`,variant:`ghost`,onClick:a,children:`Cancel`}),(0,Y.jsx)(V,{type:`submit`,disabled:d||!t,children:`Save`})]})]})]})})}function ja(e,t){return t??e.root??e.session?.worktree_path??null}function Ma(e,t){return{...e,unpin(){t(),e.unpin()}}}function Na(e){return{id:c,project_id:e.projectId,account_id:null,worktree_path:e.path,base_branch:e.defaultBranch,branch:e.defaultBranch,separate_branch:!1,kind:`terminal`,agent_type:null,agent_session_ref:null,title:e.name,status:`exited`,skip_permissions:!1,created_at:`1970-01-01T00:00:00.000Z`,updated_at:`1970-01-01T00:00:00.000Z`,last_activity_at:null}}function Pa(e,t,n,r=null){let i=n.snapshot.explorer_pin,a=i===null?null:e.find(e=>e.id===i&&e.status!==`archived`)??null,o=a??e.find(e=>e.id===t)??null,s=o===null&&r!==null;return{session:s?Na(r):o,root:s?r.path:void 0,isProjectDirectory:s,pinned:a!==null,pin(e){n.update({explorer_pin:e})},unpin(){n.update({explorer_pin:null})}}}var Fa=null,Ia=null;async function La(){let[e,t]=await Promise.all([Oe(()=>import(`./PaneEditorBody-BBt1St2c.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19])),Oe(()=>import(`./ModelRefcount-DPfahuWS.js`),__vite__mapDeps([20,1,2,16,6,9,3,4,10,11,12,14,15,17]))]);Fa=e.PaneEditorBody,Ia=t.ModelRefcount}var Ra=(0,X.lazy)(()=>Oe(()=>import(`./PaneEditorBody-BBt1St2c.js`).then(e=>({default:e.PaneEditorBody})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19])));function za(e){return Fa?(0,Y.jsx)(Fa,{...e}):(0,Y.jsx)(X.Suspense,{fallback:(0,Y.jsx)(`div`,{className:`flex h-full items-center justify-center bg-ground text-xs text-fg-muted`,children:`Loading editor…`}),children:(0,Y.jsx)(Ra,{...e})})}var Ba=(0,X.lazy)(()=>Oe(()=>import(`./ModelRefcount-DPfahuWS.js`).then(e=>({default:e.ModelRefcount})),__vite__mapDeps([20,1,2,16,6,9,3,4,10,11,12,14,15,17])));function Va({buffers:e}){return Ia?(0,Y.jsx)(Ia,{buffers:e}):(0,Y.jsx)(X.Suspense,{fallback:null,children:(0,Y.jsx)(Ba,{buffers:e})})}var Ha=(0,X.lazy)(()=>Oe(()=>import(`./EditorTabClose-BKd4KqeO.js`).then(e=>({default:e.EditorDirtyDot})),__vite__mapDeps([21,1,2,3,10,16,6,9,4,11,12,14,15,17,18])));function Ua(e){return(0,Y.jsx)(X.Suspense,{fallback:null,children:(0,Y.jsx)(Ha,{...e})})}var Wa=(0,X.lazy)(()=>Oe(()=>import(`./EditorTabClose-BKd4KqeO.js`).then(e=>({default:e.EditorTabClose})),__vite__mapDeps([21,1,2,3,10,16,6,9,4,11,12,14,15,17,18])));function Ga(e){return(0,Y.jsx)(X.Suspense,{fallback:(0,Y.jsx)(`button`,{onClick:t=>{t.stopPropagation(),e.onClose()},className:`hidden size-4 items-center justify-center rounded-sm text-fg-muted transition-colors hover:text-fg group-hover:flex pointer-coarse:flex`,"aria-label":`Close ${e.label}`,children:`×`}),children:(0,Y.jsx)(Wa,{...e})})}var Ka=e(i(),1),qa=(0,X.createContext)(null);function Ja({tree:e,parked:t=[],onOpenFile:n,children:r}){let i=(0,X.useRef)(null),a=(0,X.useRef)(new Map).current,[o,s]=(0,X.useState)(()=>new Set),c=(0,X.useCallback)((e,t)=>{s(n=>{if(n.has(e)===t)return n;let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]),l=[...t].sort().join(`,`),u=(0,X.useMemo)(()=>{let t=new Set;for(let n of Cn(e))for(let e of n.tabs)e.type===`terminal`&&t.add(e.session);for(let e of l===``?[]:l.split(`,`))t.add(e);return[...t].sort()},[e,l]),d=e=>{let t=`term:${e}`,n=a.get(t);return n||(n=document.createElement(`div`),n.className=`size-full`,a.set(t,n)),n};(0,X.useEffect)(()=>{let e=new Set(u.map(e=>`term:${e}`));for(let e of u){let t=a.get(`term:${e}`);t&&!t.parentElement&&i.current?.appendChild(t)}for(let[t,n]of[...a])e.has(t)||(n.remove(),a.delete(t))},[u,a]);let f=(0,X.useMemo)(()=>({parkingRef:i,containers:a,setAdopted:c}),[a,c]);return(0,Y.jsxs)(qa.Provider,{value:f,children:[(0,Y.jsx)(`div`,{ref:i,className:`hidden`,"aria-hidden":!0}),u.map(e=>(0,Ka.createPortal)((0,Y.jsx)(Xe,{stream:e,paused:!o.has(`term:${e}`),onOpenFile:t=>n(e,t)}),d(e),e)),r]})}function Ya(e){let t=(0,X.useContext)(qa),n=(0,X.useRef)(null);return(0,X.useEffect)(()=>{let r=n.current;if(!t||!e||!r)return;let i=t.containers.get(e);return i&&(r.appendChild(i),t.setAdopted(e,!0)),()=>{let n=t.parkingRef.current;i&&n&&i.parentElement===r&&n.appendChild(i),i&&t.setAdopted(e,!1)}},[t,e]),n}var Xa=null,Za=new Set;function Qa(e){Xa=e,Za.forEach(t=>t(e))}function $a(e){return Za.add(e),Xa&&e(Xa),()=>Za.delete(e)}function eo(){Xa=null}var to=20,no=new Map;function ro(e,t){let n=no.get(e)??[];n.push(t),n.length>to&&n.shift(),no.set(e,n)}function io(e,t){let n=no.get(e);for(;n&&n.length>0;){let e=n.pop();if(t(e.ref))return e}}function ao(e){let[t,n]=(0,X.useState)(()=>window.matchMedia(e).matches);return(0,X.useEffect)(()=>{let t=window.matchMedia(e),r=e=>n(e.matches);return n(t.matches),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}var oo=`(max-width: 767px)`;function so(e,t){let n={};for(let r of t){let t=e[r];if(typeof t!=`number`)return;n[r]=t}return n}var co=`puddle.pane-height.`;function lo(e){try{let t=localStorage.getItem(`${co}${e}`);if(t===null)return null;let n=Number(t);return Number.isFinite(n)&&n>0?n:null}catch{return null}}function uo(e,t,{sized:n,min:r=64}){let[i,a]=(0,X.useState)(()=>lo(e)??t),[o,s]=(0,X.useState)(!1),c=(0,X.useRef)(i);return c.current=i,{height:i,handle:{dragging:o,onPointerDown:(0,X.useCallback)(t=>{if(t.button!==0)return;t.preventDefault();let i=t.currentTarget,o=t.clientY,l=c.current,u=i.parentElement?.getBoundingClientRect().height??window.innerHeight,d=Math.max(r,u-96);i.setPointerCapture(t.pointerId),s(!0);let f=e=>{let t=e.clientY-o,i=n===`below`?l-t:l+t;a(Math.round(Math.min(d,Math.max(r,i))))},p=()=>{i.removeEventListener(`pointermove`,f),i.removeEventListener(`pointerup`,p),i.removeEventListener(`pointercancel`,p),s(!1);try{localStorage.setItem(`${co}${e}`,String(c.current))}catch{}};i.addEventListener(`pointermove`,f),i.addEventListener(`pointerup`,p),i.addEventListener(`pointercancel`,p)},[e,r,n])}}}function fo({handle:e,label:t,className:n}){return(0,Y.jsx)(`div`,{role:`separator`,"aria-orientation":`horizontal`,"aria-label":t,onPointerDown:e.onPointerDown,className:a(`relative h-px shrink-0 cursor-row-resize touch-none bg-border transition-colors hover:bg-accent`,e.dragging&&`bg-accent`,n),children:(0,Y.jsx)(`div`,{className:`absolute inset-x-0 -top-1 h-[9px]`})})}var po=80,mo=180;function ho(e){return Math.max(mo,Math.round(e/po*1e3))}function Q({text:e,hoverClass:t,className:n,containerClassName:r,title:i}){let o=(0,X.useRef)(null),[s,c]=(0,X.useState)(0);return(0,X.useEffect)(()=>{let e=o.current;if(!e)return;let t=()=>c(Math.max(0,e.scrollWidth-e.clientWidth));t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[e]),(0,Y.jsx)(`span`,{className:a(`block min-w-0 flex-1 overflow-hidden`,r),children:(0,Y.jsx)(`span`,{ref:o,title:i,className:a(`block whitespace-nowrap transition-transform ease-linear`,n,s>0&&t),style:s>0?{"--tail":`-${s}px`,transitionDuration:`${ho(s)}ms`}:void 0,children:e})})}var go={added:{letter:`A`,label:`added`,colourClass:`text-success`},modified:{letter:`M`,label:`modified`,colourClass:`text-fg-secondary`},deleted:{letter:`D`,label:`deleted`,colourClass:`text-interrupted`},renamed:{letter:`R`,label:`renamed`,colourClass:`text-warning`}};function _o(e){return go[e]}var vo=[`modified`,`added`,`deleted`,`renamed`];function yo(e){let t=new Map;for(let n of e)t.set(n.status,(t.get(n.status)??0)+1);return vo.filter(e=>t.has(e)).map(e=>`${t.get(e)} ${go[e].label}`).join(` · `)}var bo=[`var(--accent)`,`var(--status-running)`,`var(--status-waiting)`,`var(--ansi-magenta)`,`var(--ansi-cyan)`,`var(--status-interrupted)`];function xo(e){return bo[e%bo.length]}function So(e){let t=[],n=0,r=0,i=()=>{let e=t.indexOf(null);return e===-1?t.length:e},a=()=>{let e=[];for(let n=0;n<t.length;n++){let r=t[n];r&&e.push({col:n,sha:r.sha,colour:xo(r.colourIdx)})}return e},o=[],s=[];for(let c of e){let e=c.parents??[],l=[];for(let e=0;e<t.length;e++)t[e]?.sha===c.sha&&l.push(e);let u,d;l.length>0?(u=l[0],d=t[u].colourIdx):(u=i(),d=n++);let f=xo(d);for(let e of l)t[e]=null;for(;t.length<=u;)t.push(null);let p=[];if(e.length>0){t[u]={sha:e[0],colourIdx:d},p.push(u);for(let r=1;r<e.length;r++){let a=e[r],o=t.findIndex(e=>e?.sha===a);if(o===-1){for(o=i();t.length<=o;)t.push(null);t[o]={sha:a,colourIdx:n++}}p.push(o)}}else t[u]=null;let m=a();o.push({sha:c.sha,col:u,colour:f,above:s,below:m,created:p}),s=m,r=Math.max(r,t.length)}return{rows:o,laneCount:r}}var Co=7,wo=14,To=4,Eo=1.5,Do=40,Oo=22,ko=`group-hover:[transform:translateX(var(--tail))]`;function Ao(e){return e*wo+wo/2}function jo(e,t,n,r){if(e===n)return`M ${e} ${t} L ${n} ${r}`;let i=(t+r)/2;return`M ${e} ${t} C ${e} ${i}, ${n} ${i}, ${n} ${r}`}function Mo({row:e,width:t}){let n=Do,r=n/2,i=Ao(e.col),a=new Set(e.created),o=[];for(let t of e.above){let n=Ao(t.col);t.sha===e.sha?o.push({d:jo(n,0,i,r),colour:t.colour}):o.push({d:jo(n,0,n,r),colour:t.colour})}for(let t of e.below){let e=Ao(t.col);a.has(t.col)?o.push({d:jo(i,r,e,n),colour:t.colour}):o.push({d:jo(e,r,e,n),colour:t.colour})}return(0,Y.jsxs)(`svg`,{width:t,height:n,className:`shrink-0`,"aria-hidden":!0,children:[o.map((e,t)=>(0,Y.jsx)(`path`,{d:e.d,fill:`none`,stroke:e.colour,strokeWidth:Eo},t)),(0,Y.jsx)(`circle`,{cx:i,cy:r,r:To,fill:`var(--bg-surface)`,stroke:e.colour,strokeWidth:Eo})]})}function No({lanes:e,width:t}){return(0,Y.jsx)(`svg`,{width:t,height:Oo,className:`shrink-0`,"aria-hidden":!0,children:e.map(e=>{let t=Ao(e.col);return(0,Y.jsx)(`path`,{d:`M ${t} 0 L ${t} ${Oo}`,fill:`none`,stroke:e.colour,strokeWidth:Eo},e.col)})})}function Po({session:e,sha:t,root:n,lanes:r,gutterW:i,onOpen:o}){let s=L(e,t,n),c=e=>(0,Y.jsxs)(`div`,{className:`flex items-center`,style:{height:Oo},children:[(0,Y.jsx)(No,{lanes:r,width:i}),(0,Y.jsx)(`span`,{className:`px-2 text-2xs text-fg-muted`,children:e})]});return s.isPending?c(`…`):s.error?c(s.error instanceof Error?s.error.message:`Failed to load commit`):s.data.files.length===0?c(`No file changes.`):(0,Y.jsx)(Y.Fragment,{children:s.data.files.map(e=>{let s=_o(e.status),c=e.status===`renamed`&&e.old_path?`${e.old_path} → ${e.path}`:e.path;return(0,Y.jsxs)(`button`,{type:`button`,title:c,onClick:()=>{o(e.path,t),Qa({path:e.path,root:n})},onDoubleClick:()=>o(e.path,t,{preview:!1}),className:`group flex w-full items-center text-left transition-colors hover:bg-elevated`,style:{height:Oo},children:[(0,Y.jsx)(No,{lanes:r,width:i}),(0,Y.jsx)(`span`,{className:a(`mr-1.5 w-3 shrink-0 text-center font-mono text-xs`,s.colourClass),children:s.letter}),(0,Y.jsx)(Q,{text:c,className:`pr-3 text-2xs text-fg`,hoverClass:ko})]},`${e.status}:${e.old_path??``}:${e.path}`)})})}function Fo({session:e,root:t,onOpenCommitFile:n}){let r=ce(e,{root:t}),[i,o]=(0,X.useState)(null),s=(0,X.useMemo)(()=>r.data?.pages.flatMap(e=>e.commits)??[],[r.data]),c=(0,X.useMemo)(()=>So(s),[s]),l=Math.max(1,c.laneCount)*wo+wo/2;return r.isPending?(0,Y.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`Loading history…`}):r.error?(0,Y.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:r.error instanceof Error?r.error.message:`Failed to load history`}):s.length===0?(0,Y.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`No commits yet.`}):(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pb-2`,children:[c.rows.map((r,c)=>{let u=s[c],d=i===r.sha;return(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>o(d?null:r.sha),className:a(`group flex w-full items-center text-left transition-colors hover:bg-elevated`,d&&`bg-selection`),style:{height:Do},children:[(0,Y.jsx)(Mo,{row:r,width:l}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5 pr-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,Y.jsx)(`span`,{className:`shrink-0 font-mono text-2xs text-fg-muted`,children:r.sha.slice(0,Co)}),(0,Y.jsx)(Q,{text:u.subject,className:`text-xs text-fg`,hoverClass:ko})]}),(0,Y.jsxs)(`span`,{className:`truncate text-2xs text-fg-muted`,children:[u.author_name,` ·`,` `,(0,Y.jsx)(`span`,{className:`tabular-nums`,children:he(u.authored_at)})]})]})]}),d&&(0,Y.jsx)(Po,{session:e,sha:r.sha,root:t,lanes:r.below,gutterW:l,onOpen:n})]},r.sha)}),r.hasNextPage&&(0,Y.jsx)(`button`,{type:`button`,onClick:()=>void r.fetchNextPage(),disabled:r.isFetchingNextPage,className:`px-3 py-2 text-left text-xs text-fg-muted transition-colors hover:bg-elevated`,children:r.isFetchingNextPage?`Loading…`:`Show more`})]})}function Io(){return{dirs:new Map,files:[]}}function Lo(e){return e.path}function Ro(e,t){let n=[];for(let[r,i]of e.dirs){let e=t?`${t}/${r}`:r,a={type:`dir`,name:r,path:e,children:Ro(i,e)};for(;a.children.length===1&&a.children[0].type===`dir`;){let e=a.children[0];a={type:`dir`,name:`${a.name}/${e.name}`,path:e.path,children:e.children}}n.push(a)}n.sort((e,t)=>e.name.localeCompare(t.name,void 0,{sensitivity:`base`}));let r=[...e.files].sort((e,t)=>e.name.localeCompare(t.name,void 0,{sensitivity:`base`}));return[...n,...r]}function zo(e){let t=Io();for(let n of e){let e=Lo(n),r=e.split(`/`),i=r.pop(),a=t;for(let e of r){let t=a.dirs.get(e);t||(t=Io(),a.dirs.set(e,t)),a=t}a.files.push({type:`file`,name:i,path:e,entry:n})}return Ro(t,``)}function Bo(e){return e.map(e=>({type:`file`,name:Lo(e).split(`/`).pop()??Lo(e),path:Lo(e),entry:e})).sort((e,t)=>e.path.localeCompare(t.path,void 0,{sensitivity:`base`}))}function Vo(e){return e.type===`file`?[e.entry]:e.children.flatMap(Vo)}var Ho=`group-hover:[transform:translateX(var(--tail))]`;function Uo({name:e,fullPath:t,status:n,depth:r,active:i,onOpen:o}){let s=_o(n);return(0,Y.jsxs)(`button`,{type:`button`,title:t,onClick:()=>o(t),onDoubleClick:()=>o(t,{preview:!1}),className:a(`group flex w-full items-center gap-1.5 py-1 pr-3 text-left transition-colors hover:bg-elevated`,i&&`bg-selection`),style:{paddingLeft:8+r*12},children:[(0,Y.jsx)(`span`,{className:a(`w-3 shrink-0 text-center font-mono text-xs`,s.colourClass),children:s.letter}),(0,Y.jsx)(Q,{text:e,className:`text-xs text-fg`,hoverClass:Ho})]})}function Wo({nodes:e,depth:t,activePath:n,onOpen:r}){let[i,a]=(0,X.useState)(new Set);return(0,Y.jsx)(Y.Fragment,{children:e.map(e=>{if(e.type===`file`)return(0,Y.jsx)(Uo,{name:e.name,fullPath:e.path,status:e.entry.status,depth:t,active:n===e.path,onOpen:r},e.path);let o=i.has(e.path);return(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>a(t=>{let n=new Set(t);return n.has(e.path)?n.delete(e.path):n.add(e.path),n}),className:`group flex w-full items-center gap-1 py-1 pr-3 text-left transition-colors hover:bg-elevated`,style:{paddingLeft:8+t*12},title:e.path,children:[o?(0,Y.jsx)(Vt,{className:`size-3.5 shrink-0 text-fg-gold`}):(0,Y.jsx)(Bt,{className:`size-3.5 shrink-0 text-fg-gold`}),(0,Y.jsx)(Q,{text:e.name,className:`text-xs text-fg-secondary`,hoverClass:Ho})]}),!o&&(0,Y.jsx)(Wo,{nodes:e.children,depth:t+1,activePath:n,onOpen:r})]},e.path)})})}function Go({session:e,root:t,activePath:n,onOpen:r}){let[i,a]=(0,X.useState)(!1),o=ue(e,{against:`head`,root:t}),s=o.data?.entries??[],c=(e,n)=>{r(e,n),Qa({path:e,root:t})},l=(0,X.useMemo)(()=>i?null:zo(s),[i,s]),u=(0,X.useMemo)(()=>i?Bo(s):null,[i,s]);return(0,Y.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,Y.jsxs)(`div`,{className:`flex h-7 shrink-0 items-center gap-2 px-3`,children:[(0,Y.jsx)(`span`,{className:`text-2xs font-medium uppercase tracking-wide text-fg-gold`,children:`Uncommitted`}),s.length>0&&(0,Y.jsx)(`span`,{className:`truncate text-2xs text-fg-muted`,children:yo(s)}),(0,Y.jsxs)(K,{children:[(0,Y.jsx)(W,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,"aria-pressed":!i,onClick:()=>a(e=>!e),className:`ml-auto rounded-sm p-1 text-fg-gold transition-colors hover:bg-elevated hover:text-fg`,children:[i?(0,Y.jsx)(br,{className:`size-3.5`}):(0,Y.jsx)(hr,{className:`size-3.5`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:i?`Show as tree`:`Show as flat list`})]})}),(0,Y.jsx)(q,{children:i?`Show as tree`:`Show as flat list`})]})]}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pb-1`,children:o.isPending?(0,Y.jsx)(`div`,{className:`px-3 py-1.5 text-xs text-fg-muted`,children:`Loading changes…`}):o.error?(0,Y.jsx)(`div`,{className:`px-3 py-1.5 text-xs text-fg-muted`,children:o.error instanceof Error?o.error.message:`Failed to load changes`}):s.length===0?(0,Y.jsx)(`div`,{className:`px-3 py-1.5 text-xs text-fg-muted`,children:`No uncommitted changes.`}):i?u.map(e=>(0,Y.jsx)(Uo,{name:e.path,fullPath:e.path,status:e.entry.status,depth:0,active:n===e.path,onOpen:c},e.path)):(0,Y.jsx)(Wo,{nodes:l,depth:0,activePath:n,onOpen:c})})]})}var Ko={untracked:{letter:`U`,colourClass:`text-success`},added:{letter:`A`,colourClass:`text-success`},modified:{letter:`M`,colourClass:`text-warning`},renamed:{letter:`R`,colourClass:`text-warning`},deleted:{letter:`D`,colourClass:`text-interrupted`},conflicted:{letter:`C`,colourClass:`text-interrupted`},ignored:{letter:``,colourClass:`text-fg-muted`}};function qo(e){return Ko[e]}function Jo(e){let t=new Map;for(let n of e)t.set(n.path,n.status);return t}var Yo={conflicted:0,modified:1,renamed:2,deleted:3,added:4,untracked:5,ignored:6};function Xo(e,t){let n=t===``?``:`${t}/`,r=null;for(let[t,i]of e)n!==``&&!t.startsWith(n)||i!==`ignored`&&(r===null||Yo[i]<Yo[r])&&(r=i);return r}function Zo(e){let t=new Set;for(let n of e)t.add(n.path),n.old_path!==null&&t.add(n.old_path);return[...t]}var Qo=`group-hover:[transform:translateX(var(--tail))]`,$o=`group-hover/repository:[transform:translateX(var(--tail))]`,es=`group-hover:[transform:translateX(var(--tail))]`;function ts({label:e,onClick:t,disabled:n,children:r}){return(0,Y.jsxs)(K,{children:[(0,Y.jsx)(W,{asChild:!0,children:(0,Y.jsx)(`button`,{type:`button`,"aria-label":e,disabled:n,onClick:e=>{e.stopPropagation(),t()},className:`rounded-sm p-1 text-fg-muted transition-colors hover:bg-elevated hover:text-fg disabled:cursor-not-allowed disabled:opacity-40`,children:r})}),(0,Y.jsx)(q,{children:e})]})}function ns({title:e,entries:t,area:n,activePath:r,action:i,busy:a,flat:o,onAction:s,onOpen:c}){let[l,u]=(0,X.useState)(!1),d=(0,X.useMemo)(()=>o?null:zo(t),[t,o]);if(t.length===0)return null;let f=i===`stage`;return(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`group flex h-7 items-center gap-1 px-3`,children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>u(e=>!e),className:`flex min-w-0 flex-1 items-center gap-1 text-left text-2xs font-medium uppercase tracking-wide text-fg-secondary transition-colors hover:text-fg`,children:[l?(0,Y.jsx)(Vt,{className:`size-3`}):(0,Y.jsx)(Bt,{className:`size-3`}),(0,Y.jsx)(`span`,{className:`truncate`,children:e}),(0,Y.jsx)(`span`,{className:`ml-1 text-fg-muted`,children:t.length})]}),(0,Y.jsx)(ts,{label:`${f?`Stage`:`Unstage`} all ${e.toLowerCase()}`,disabled:a,onClick:()=>s(Zo(t)),children:f?(0,Y.jsx)(qt,{className:`size-3.5`}):(0,Y.jsx)(Sr,{className:`size-3.5`})})]}),!l&&(o?t.map(e=>(0,Y.jsx)(rs,{entry:e,name:e.path,depth:0,area:n,active:r===e.path,action:i,busy:a,onAction:s,onOpen:c},`${e.path}:${e.old_path??``}`)):(0,Y.jsx)(is,{nodes:d,depth:0,area:n,activePath:r,action:i,busy:a,onAction:s,onOpen:c}))]})}function rs({entry:e,name:t,depth:n,area:r,active:i,action:o,busy:s,onAction:c,onOpen:l}){let u=qo(e.status),d=o===`stage`;return(0,Y.jsxs)(`div`,{className:a(`group flex items-center gap-1 pr-3 transition-colors hover:bg-elevated`,i&&`bg-selection`),style:{paddingLeft:12+n*12},children:[(0,Y.jsxs)(`button`,{type:`button`,title:e.path,onClick:()=>l(e.path,{root:void 0,gitArea:r}),onDoubleClick:()=>l(e.path,{preview:!1,root:void 0,gitArea:r}),className:`flex min-w-0 flex-1 items-center gap-1.5 py-1 text-left`,children:[(0,Y.jsx)(`span`,{className:a(`w-3 shrink-0 text-center font-mono text-xs`,u.colourClass),children:u.letter}),(0,Y.jsx)(Q,{text:t,className:`text-xs text-fg`,hoverClass:es})]}),(0,Y.jsx)(ts,{label:`${d?`Stage`:`Unstage`} ${e.path}`,disabled:s,onClick:()=>c(Zo([e])),children:d?(0,Y.jsx)(qt,{className:`size-3.5`}):(0,Y.jsx)(Sr,{className:`size-3.5`})})]})}function is({nodes:e,depth:t,area:n,activePath:r,action:i,busy:a,onAction:o,onOpen:s}){let[c,l]=(0,X.useState)(new Set),u=i===`stage`;return(0,Y.jsx)(Y.Fragment,{children:e.map(e=>{if(e.type===`file`)return(0,Y.jsx)(rs,{entry:e.entry,name:e.name,depth:t,area:n,active:r===e.path,action:i,busy:a,onAction:o,onOpen:s},`${e.entry.path}:${e.entry.old_path??``}`);let d=c.has(e.path);return(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`group flex items-center gap-1 pr-3 transition-colors hover:bg-elevated`,style:{paddingLeft:12+t*12},children:[(0,Y.jsxs)(`button`,{type:`button`,title:e.path,onClick:()=>l(t=>{let n=new Set(t);return n.has(e.path)?n.delete(e.path):n.add(e.path),n}),className:`flex min-w-0 flex-1 items-center gap-1 py-1 text-left`,children:[d?(0,Y.jsx)(Vt,{className:`size-3.5 shrink-0 text-fg-gold`}):(0,Y.jsx)(Bt,{className:`size-3.5 shrink-0 text-fg-gold`}),(0,Y.jsx)(Q,{text:e.name,className:`text-xs text-fg-secondary`,hoverClass:es})]}),(0,Y.jsx)(ts,{label:`${u?`Stage`:`Unstage`} ${e.path}`,disabled:a,onClick:()=>o(Zo(Vo(e))),children:u?(0,Y.jsx)(qt,{className:`size-3.5`}):(0,Y.jsx)(Sr,{className:`size-3.5`})})]}),!d&&(0,Y.jsx)(is,{nodes:e.children,depth:t+1,area:n,activePath:r,action:i,busy:a,onAction:o,onOpen:s})]},e.path)})})}function as(e){return e.detached?`Detached at ${e.head?.slice(0,8)??`HEAD`}`:e.branch??`Unborn branch`}function os(e){return[as(e),e.upstream,e.ahead>0?`${e.ahead} ahead`:null,e.behind>0?`${e.behind} behind`:null].filter(e=>e!=null).join(` · `)}function ss({session:e,targetRoot:t,repository:n,selected:r,activePath:i,onSelect:o,onOpen:s}){let[c,l]=(0,X.useState)(!1),[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(``),m=de(e,t),h=[...n.conflicts,...n.staged,...n.unstaged],g=m.isPending,_=async(e,t)=>{try{await m.mutateAsync(e),v.success(t)}catch(e){v.error(e instanceof Error?e.message:`Git operation failed`)}},y=(e,t)=>{_({action:e,repository:n.root,paths:t},e===`stage`?`Staged`:`Unstaged`)},b=async()=>{let e=f.trim();if(!e||g)return;let t=!1;if(n.staged.length===0){if(n.conflicts.length>0){v.error(`Resolve and stage merge changes before committing`);return}if(n.unstaged.length===0){v.error(`There are no changes to commit`);return}if(t=window.confirm(`Nothing is staged. Stage every change and commit it?`),!t)return}try{await m.mutateAsync({action:`commit`,repository:n.root,message:e,stage_all:t}),p(``),v.success(`Committed`)}catch(e){v.error(e instanceof Error?e.message:`Commit failed`)}},x=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),b())},S=(e,t)=>s(e,{...t,root:n.root});return(0,Y.jsxs)(`section`,{className:a(`py-0.5`,r&&`bg-surface/40`),onFocus:o,children:[(0,Y.jsxs)(`div`,{className:`flex h-8 items-center gap-1 pl-2 pr-2`,children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>{o(),l(e=>!e)},className:`group/repository flex min-w-0 flex-1 items-center gap-1.5 text-left transition-colors hover:text-fg`,children:[c?(0,Y.jsx)(Vt,{className:`size-3 shrink-0`}):(0,Y.jsx)(Bt,{className:`size-3 shrink-0`}),(0,Y.jsx)(Q,{text:n.name,title:n.name,className:`text-xs font-medium text-fg`,containerClassName:`flex-[0_1_auto]`,hoverClass:$o}),(0,Y.jsx)(Q,{text:n.relative_path,title:n.relative_path,className:`text-2xs text-fg-muted`,containerClassName:`flex-[0_1_auto]`,hoverClass:$o}),h.length>0&&(0,Y.jsx)(`span`,{className:`ml-auto text-2xs text-fg-muted`,children:h.length})]}),!c&&n.initialised&&h.length>0&&(0,Y.jsx)(ts,{label:u?`Show changes as tree`:`Show changes as flat list`,onClick:()=>d(e=>!e),children:u?(0,Y.jsx)(br,{className:`size-3.5`}):(0,Y.jsx)(hr,{className:`size-3.5`})})]}),!c&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`group flex min-h-7 items-center gap-2 px-3 text-2xs text-fg-muted`,children:[(0,Y.jsx)(Q,{text:os(n),title:os(n),hoverClass:Qo}),n.initialised&&n.has_remote&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(ts,{label:`Fetch`,disabled:g,onClick:()=>void _({action:`fetch`,repository:n.root},`Fetched`),children:(0,Y.jsx)(De,{className:`size-3.5`})}),n.upstream&&(0,Y.jsx)(ts,{label:`Pull`,disabled:g,onClick:()=>void _({action:`pull`,repository:n.root},`Pulled`),children:(0,Y.jsx)(Nr,{className:`size-3.5 rotate-180`})}),n.branch&&(0,Y.jsx)(ts,{label:n.upstream?`Push`:`Publish branch`,disabled:g,onClick:()=>void _({action:`push`,repository:n.root,set_upstream:!n.upstream},n.upstream?`Pushed`:`Branch published`),children:n.upstream?(0,Y.jsx)(kr,{className:`size-3.5`}):(0,Y.jsx)(Nr,{className:`size-3.5`})})]})]}),n.initialised?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`px-3 pb-1.5 pt-1`,children:[(0,Y.jsx)(`textarea`,{value:f,onChange:e=>p(e.target.value),onKeyDown:x,rows:2,placeholder:`Commit message`,"aria-label":`Commit message for ${n.name}`,className:`w-full resize-none rounded-sm bg-elevated px-2 py-1.5 text-xs text-fg outline-none placeholder:text-fg-muted focus:ring-1 focus:ring-focus`}),(0,Y.jsx)(`button`,{type:`button`,disabled:g||f.trim().length===0,onClick:()=>void b(),className:`mt-1 w-full rounded-sm bg-action py-1 text-xs text-action-ink transition-colors hover:bg-action-hover disabled:cursor-not-allowed disabled:opacity-40`,children:`Commit`})]}),(0,Y.jsx)(ns,{title:`Merge Changes`,entries:n.conflicts,area:`unstaged`,activePath:i,action:`stage`,busy:g,flat:u,onAction:e=>y(`stage`,e),onOpen:S}),(0,Y.jsx)(ns,{title:`Staged Changes`,entries:n.staged,area:`staged`,activePath:i,action:`unstage`,busy:g,flat:u,onAction:e=>y(`unstage`,e),onOpen:S}),(0,Y.jsx)(ns,{title:`Changes`,entries:n.unstaged,area:`unstaged`,activePath:i,action:`stage`,busy:g,flat:u,onAction:e=>y(`stage`,e),onOpen:S}),h.length===0&&(0,Y.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`No changes.`})]}):(0,Y.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`Submodule not initialised.`})]})]})}function cs({session:e,root:t,activeDiffPath:n,onOpenDiff:r,onOpenCommitFile:i}){let{height:a,handle:o}=uo(`changes-uncommitted`,240,{sized:`above`,min:80}),s=m(),c=s.data!==void 0&&xn(s.data.protocol),l=oe(e,{root:t,enabled:c}),[u,d]=(0,X.useState)(null);(0,X.useEffect)(()=>{if(!c||!l.data)return;let e=l.data.repositories;(!u||!e.some(e=>e.root===u))&&d(e[0]?.root??null)},[c,l.data,u]);let f=c?u??t:t;return(0,Y.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,Y.jsx)(`section`,{className:`flex shrink-0 flex-col`,style:{height:a,maxHeight:`70%`},children:c?(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pb-1`,children:l.isPending?(0,Y.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`Loading repositories…`}):l.error?(0,Y.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:l.error instanceof Error?l.error.message:`Failed to load repositories`}):l.data.repositories.length===0?(0,Y.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`No Git repositories.`}):l.data.repositories.map(i=>(0,Y.jsx)(ss,{session:e,targetRoot:t,repository:i,selected:u===i.root,activePath:n,onSelect:()=>d(i.root),onOpen:r},i.root))}):(0,Y.jsx)(Go,{session:e,root:t,activePath:n,onOpen:r})}),(0,Y.jsx)(fo,{handle:o,label:`Resize the uncommitted changes`}),(0,Y.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,Y.jsx)(`div`,{className:`flex h-7 shrink-0 items-center px-3`,children:(0,Y.jsx)(`span`,{className:`text-2xs font-medium uppercase tracking-wide text-fg-gold`,children:`History`})}),(0,Y.jsx)(Fo,{session:e,root:f,onOpenCommitFile:(e,t,n)=>i(e,t,{...n,root:f})})]})]})}function ls(e,t,n){return e!==null&&e.id===t&&n-e.at<1500}async function us(e){let t=e.createReader(),n=[];for(;;){let e=await new Promise((e,n)=>t.readEntries(e,n));if(e.length===0)return n;n.push(...e)}}function ds(e){return new Promise((t,n)=>e.file(t,n))}async function fs(e,t,n){if(e.isFile){let r=await ds(e);n.push(t?new File([r],`${t}/${e.name}`,{type:r.type,lastModified:r.lastModified}):r)}else if(e.isDirectory){let r=await us(e),i=t?`${t}/${e.name}`:e.name;for(let e of r)await fs(e,i,n)}}function ps(e,t,n){let r=Array.from(e??[]).map(e=>({entry:e.webkitGetAsEntry?.()??null,file:e.kind===`file`?e.getAsFile():null})),i=Array.from(t);return(async()=>{if(r.every(({entry:e,file:t})=>e===null&&t===null))return i;if(!n)return r.some(({entry:e})=>e?.isDirectory)&&v.error(`This daemon can't take folders — update it, or zip them first`),r.filter(({entry:e})=>e?.isDirectory!==!0).map(({file:e})=>e).filter(e=>e!==null);let e=[];for(let{entry:t,file:n}of r)t?.isDirectory?await fs(t,``,e):n&&e.push(n);return e})()}function ms(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}function hs(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function gs(e){let t=e.split(`/`).filter(e=>e!==``);t.pop();let n=[];for(let e of t)n.push(vs(n[n.length-1]??``,e));return n}function _s(e){let t=e.replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n<=0?`/`:t.slice(0,n)}function vs(e,t){return e===``?t:`${e}/${t}`}function ys(e){let t=new Set(e);return e.filter(e=>{if(e===``)return!0;for(let n=hs(e);;n=hs(n)){if(t.has(n))return!1;if(n===``)return!0}})}var bs=`application/x-puddle-paths`;function xs(e){return JSON.stringify(e)}function Ss(e){try{let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function Cs(e,t){let n=[],r=(i,a)=>{let o=e(i);if(o)for(let e of o.entries){let o=vs(i,e.name);n.push({path:o,name:e.name,type:e.type,depth:a,parentDir:i}),e.type===`dir`&&t.has(o)&&r(o,a+1)}};return r(``,0),n}function ws(e,t,n){let r=e.findIndex(e=>e.path===t),i=e.findIndex(e=>e.path===n);if(r===-1||i===-1)return n?[n]:[];let[a,o]=r<=i?[r,i]:[i,r];return e.slice(a,o+1).map(e=>e.path)}var Ts=(e,t)=>e instanceof Error?e.message:t;function Es(e,t){let n=p(),r=(0,X.useCallback)(()=>{n.invalidateQueries({queryKey:[`wt-tree`,e]}),n.invalidateQueries({queryKey:[`wt-git-status`,e]})},[n,e]);return(0,X.useMemo)(()=>({async create(n,i,a){try{let o=await B(e,vs(n,i),a,t);return r(),o.path}catch(e){return v.error(Ts(e,`Couldn't create ${i}`)),null}},async rename(n,i){let a=vs(n.includes(`/`)?n.slice(0,n.lastIndexOf(`/`)):``,i);try{let i=await I(e,n,a,t);return r(),i.path}catch(e){return v.error(Ts(e,`Couldn't rename ${ms(n)}`)),null}},async move(n,i){let a=await Promise.allSettled(n.map(n=>I(e,n,vs(i,ms(n)),t)));r();let o=a.filter(e=>e.status===`rejected`);o.length>0&&v.error(n.length===1?Ts(o[0].reason,`Couldn't move ${ms(n[0])}`):`Couldn't move ${o.length} item${o.length>1?`s`:``}`)},async remove(n){let i=await Promise.allSettled(n.map(n=>Te(e,n,t)));r();let a=i.filter(e=>e.status===`rejected`).length;a>0?v.error(`Couldn't delete ${a} item${a>1?`s`:``}`):v.success(n.length===1?`Deleted ${ms(n[0])}`:`Deleted ${n.length} items`)},async paste(n,i){let a=n.mode===`cut`?I:Ee,o=await Promise.allSettled(n.paths.map(n=>a(e,n,vs(i,ms(n)),t)));r();let s=o.filter(e=>e.status===`rejected`).length;s>0&&v.error(`Couldn't paste ${s} item${s>1?`s`:``}`)}}),[e,t,r])}function Ds(e,t,n){return n&&n.type!==`dir`||(e.includes(`/`)?e.slice(0,e.lastIndexOf(`/`)):``)===t?!1:t===``||!`${t}/`.startsWith(`${e}/`)}var Os=(0,X.createContext)(null);function ks(){let e=(0,X.useContext)(Os);if(!e)throw Error(`explorer components must render inside <ExplorerProvider>`);return e}function As(){return(0,X.useContext)(Os)}function js({session:e,root:t,readOnly:n=!1,onOpenFile:r,onOpenTerminal:i,activePath:a,children:o}){let s=e.id,c=p(),l=Es(s,t),u=t??e.worktree_path,d=(0,X.useCallback)(e=>t===void 0?[`wt-tree`,s,e]:[`wt-tree`,s,e,t],[s,t]),f=(0,X.useCallback)((e,r)=>{r.length===0||n||fe(s,e,r,t).then(()=>{c.invalidateQueries({queryKey:d(e)}),c.invalidateQueries({queryKey:[`wt-git-status`,s]}),v.success(r.length===1?`Uploaded ${r[0].name}`:`Uploaded ${r.length} files`)}).catch(e=>v.error(e instanceof Error?e.message:`Upload failed`))},[s,t,n,c,d]),h=m().data?.protocol,g=!h||h.major>9||h.major===9&&h.minor>=2,_=(0,X.useCallback)((e,t,n)=>{ps(t,n,g).then(t=>f(e,t)).catch(e=>v.error(e instanceof Error?e.message:`Couldn't read the dropped folder`))},[f,g]),[y,b]=(0,X.useState)(new Set),[x,S]=(0,X.useState)(new Set),[C,w]=(0,X.useState)(null),[T,E]=(0,X.useState)(null),[D,O]=(0,X.useState)(null),[k,ee]=(0,X.useState)(null),[A,j]=(0,X.useState)(null),M=(0,X.useRef)(null);(0,X.useEffect)(()=>{let e=()=>ee(null);return window.addEventListener(`dragend`,e),()=>window.removeEventListener(`dragend`,e)},[]);let te=se(s,{root:t,enabled:t===void 0||h!==void 0&&xn(h)}),ne=(0,X.useMemo)(()=>Jo(te.data?.entries??[]),[te.data]),N=te.refetch,[re,ie]=(0,X.useState)(0);(0,X.useEffect)(()=>c.getQueryCache().subscribe(e=>{if(e.type!==`added`&&e.type!==`removed`&&e.type!==`updated`)return;let t=e.query.queryKey;Array.isArray(t)&&t[0]===`wt-tree`&&t[1]===s&&ie(e=>e+1)}),[c,s]);let ae=(0,X.useMemo)(()=>Cs(e=>c.getQueryData(d(e)),y),[c,d,y,re]),P=(0,X.useCallback)(e=>{b(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),F=(0,X.useCallback)(e=>{b(t=>t.has(e)?t:new Set(t).add(e))},[]),oe=(0,X.useCallback)(()=>b(new Set),[]),[I,L]=(0,X.useState)(null);(0,X.useEffect)(()=>$a(e=>{if(e.root===t){eo();for(let t of gs(e.path))F(t);e.expandTarget&&e.path!==``&&F(e.path),S(new Set([e.path])),w(e.path),L(e.path)}}),[t,F]),(0,X.useEffect)(()=>{if(I===null)return;let e=document.querySelector(`[data-explorer-root] [data-path="${CSS.escape(I)}"]`);if(e){e.scrollIntoView({block:`nearest`}),L(null);return}let t=window.setTimeout(()=>L(null),4e3);return()=>window.clearTimeout(t)},[I,ae]);let ce=(0,X.useRef)(null),le=(0,X.useRef)(null),ue=(0,X.useCallback)(()=>{ce.current!==null&&(window.clearTimeout(ce.current),ce.current=null)},[]);(0,X.useEffect)(()=>ue,[ue]);let de=(0,X.useCallback)((e,t)=>{if(ue(),w(e.path),t.metaKey||t.ctrlKey){S(t=>{let n=new Set(t);return n.has(e.path)?n.delete(e.path):n.add(e.path),n}),M.current=e.path;return}if(t.shiftKey&&M.current){S(new Set(ws(ae,M.current,e.path)));return}let i=Date.now(),a=le.current;if(le.current={id:e.path,at:i},e.type!==`dir`&&!n&&!D&&x.size===1&&x.has(e.path)&&ls(a,e.path,i)){ce.current=window.setTimeout(()=>{ce.current=null,O({mode:`rename`,path:e.path})},500);return}S(new Set([e.path])),M.current=e.path,e.type===`dir`?P(e.path):r?.(s,e.path)},[ae,P,r,s,x,D,n,ue]),R=(0,X.useCallback)(e=>{ue(),e.type!==`dir`&&r?.(s,e.path,{preview:!1})},[r,s,ue]),pe=(0,X.useCallback)(e=>{S(new Set([e])),w(e),M.current=e},[]),B=(0,X.useCallback)(e=>E({paths:ys(e),mode:`cut`}),[]),me=(0,X.useCallback)(e=>E({paths:ys(e),mode:`copy`}),[]),he=(0,X.useCallback)(e=>{!T||n||l.paste(T,e).then(()=>{T.mode===`cut`&&E(null)})},[T,l,n]),ge=(0,X.useCallback)(e=>{n||O({mode:`rename`,path:e})},[n]),_e=(0,X.useCallback)((e,t)=>{n||(e!==``&&F(e),O({mode:`create`,parentDir:e,kind:t}))},[F,n]),ve=(0,X.useCallback)(()=>O(null),[]),ye=(0,X.useCallback)(e=>{let t=e.trim(),n=D;if(O(null),!(!n||t===``))if(n.mode===`rename`){if(t===ms(n.path))return;l.rename(n.path,t)}else l.create(n.parentDir,t,n.kind).then(e=>{e&&n.kind===`file`&&r?.(s,e)})},[D,l,r,s]),be=(0,X.useCallback)(e=>{if(n)return;let t=ys(e);t.length>0&&j(t)},[n]),xe=(0,X.useCallback)(()=>{let e=A;j(null),e&&l.remove(e)},[A,l]),Se=(0,X.useCallback)(()=>j(null),[]),Ce=(0,X.useCallback)((e,t)=>{let n=e.map(e=>t?e:vs(u,e)).join(`
|
|
3
3
|
`);navigator.clipboard.writeText(n);let r=t?`Relative path`:`Path`;v.success(e.length>1?`${e.length} ${r.toLowerCase()}s copied`:`${r} copied`)},[u]),we=(0,X.useCallback)(e=>{(async()=>{for(let n of ys(e))await z(s,n,t)})().catch(e=>v.error(e instanceof Error?e.message:`Download failed`))},[s,t]),Te=(0,X.useCallback)(()=>{c.invalidateQueries({queryKey:[`wt-tree`,s]}),N()},[c,s,N]),Ee=(0,X.useCallback)((e,t)=>{if(n)return;let r=ys(t).filter(t=>Ds(t,e));r.length>0&&l.move(r,e)},[l,n]),De=(0,X.useCallback)(()=>C&&x.has(C)?[...x]:C?[C]:[...x],[C,x]),Oe=(0,X.useRef)({buffer:``,at:0}),ke={sid:s,rootPath:u,root:t,readOnly:n,onOpenFile:r,onOpenTerminal:i,activePath:a,expanded:y,toggle:P,collapseAll:oe,statusMap:ne,visibleRows:ae,selection:x,focusedPath:C,onRowClick:de,onRowDoubleClick:R,selectOnly:pe,clipboard:T,cut:B,copy:me,paste:he,editing:D,beginRename:ge,beginCreate:_e,cancelEdit:ve,commitEdit:ye,requestDelete:be,copyPathToClipboard:Ce,download:we,refresh:Te,onUpload:f,onDropUpload:_,dropTarget:k,setDropTarget:ee,onInternalDrop:Ee,handleKeyDown:(0,X.useCallback)(e=>{if(D)return;let t=ae;if(t.length===0)return;let n=C?t.findIndex(e=>e.path===C):-1,i=(e,n)=>{let r=t[Math.max(0,Math.min(t.length-1,e))];r&&(w(r.path),n&&M.current?S(new Set(ws(t,M.current,r.path))):(S(new Set([r.path])),M.current=r.path))},a=n>=0?t[n]:void 0,o=e.metaKey||e.ctrlKey;switch(e.key){case`ArrowDown`:e.preventDefault(),i(n+1,e.shiftKey);return;case`ArrowUp`:e.preventDefault(),i(n<=0?0:n-1,e.shiftKey);return;case`ArrowRight`:e.preventDefault(),a?.type===`dir`&&!y.has(a.path)?F(a.path):a?.type===`dir`&&i(n+1,!1);return;case`ArrowLeft`:if(e.preventDefault(),a?.type===`dir`&&y.has(a.path))P(a.path);else if(a){let e=t.findIndex(e=>e.path===a.parentDir);e>=0&&i(e,!1)}return;case`Enter`:case` `:if(e.preventDefault(),!a)return;a.type===`dir`?P(a.path):r?.(s,a.path);return;case`F2`:e.preventDefault(),a&&ge(a.path);return;case`Delete`:e.preventDefault(),be(De());return;case`Backspace`:o&&(e.preventDefault(),be(De()));return}if(o&&(e.key===`c`||e.key===`C`)){e.preventDefault();let t=De();e.altKey?Ce(t,e.shiftKey):me(t);return}if(o&&(e.key===`x`||e.key===`X`)){e.preventDefault(),B(De());return}if(o&&(e.key===`v`||e.key===`V`)){e.preventDefault();let t=a?a.type===`dir`?a.path:a.parentDir:``;he(t);return}if(!o&&!e.altKey&&e.key.length===1&&/\S/.test(e.key)){let r=Date.now(),a=Oe.current;a.buffer=r-a.at>700?e.key:a.buffer+e.key,a.at=r;let o=a.buffer.toLowerCase(),s=n+1;for(let e=0;e<t.length;e++){let n=t[(s+e)%t.length];if(n.name.toLowerCase().startsWith(o)){i(t.findIndex(e=>e.path===n.path),!1);break}}}},[D,ae,C,y,F,P,r,s,ge,be,De,me,B,he,Ce]),pendingDelete:A,confirmDelete:xe,cancelDelete:Se};return(0,Y.jsx)(Os.Provider,{value:ke,children:o})}function Ms(e,t){if(!t)return e;let n=t.endsWith(`/`)?t.slice(0,-1):t;return n===``||n===`/`?e:e===n?`~`:e.startsWith(`${n}/`)?`~${e.slice(n.length)}`:e}var Ns=`application/x-puddle-tab`;function Ps(e){return JSON.stringify(e)}function Fs(e){try{return g.parse(JSON.parse(e))}catch{return null}}function Is(e){return e.includes(Ns)}var Ls={"package.json":nr,"package-lock.json":sr,"pnpm-lock.yaml":sr,"yarn.lock":sr,"pnpm-workspace.yaml":rr,dockerfile:J,".gitignore":rr,".gitattributes":rr,"readme.md":dr,license:dr,licence:dr},Rs={ts:J,tsx:J,mts:J,cts:J,js:J,jsx:J,mjs:J,cjs:J,py:J,rs:J,go:J,rb:J,php:J,java:J,kt:J,c:J,h:J,cpp:J,hpp:J,cc:J,html:J,htm:J,xml:J,vue:J,sql:J,json:nr,jsonc:nr,yml:rr,yaml:rr,toml:rr,ini:rr,cfg:rr,conf:rr,env:or,lock:sr,csv:lr,tsv:lr,xlsx:lr,xls:lr,md:dr,mdx:dr,markdown:dr,txt:dr,rtf:dr,log:dr,pdf:dr,css:fr,scss:fr,sass:fr,less:fr,sh:ur,bash:ur,zsh:ur,fish:ur,svg:ar,png:ar,jpg:ar,jpeg:ar,gif:ar,webp:ar,bmp:ar,ico:ar,avif:ar,mp4:cr,mov:cr,webm:cr,mkv:cr,avi:cr,mp3:ir,wav:ir,flac:ir,ogg:ir,m4a:ir,zip:tr,tar:tr,gz:tr,tgz:tr,rar:tr,"7z":tr};function zs(e){let t=e.toLowerCase(),n=Ls[t];if(n)return{Icon:n,generic:!1};let r=t.lastIndexOf(`.`);if(r>0){let e=Rs[t.slice(r+1)];if(e)return{Icon:e,generic:!1}}return{Icon:pr,generic:!0}}function Bs({name:e,dimmed:t}){let{Icon:n,generic:r}=zs(e);return(0,Y.jsx)(n,{className:a(`size-3.5 shrink-0`,t||r?`text-fg-muted`:`text-fg`)})}var Vs=14,Hs=`group-hover/treerow:[transform:translateX(var(--tail))]`;function Us(e,t){let n=document.createElement(`div`);n.textContent=`${t} items`,n.className=`fixed -top-12 left-0 rounded-md bg-elevated px-2 py-1 text-xs text-fg`,document.body.appendChild(n),e.dataTransfer.setDragImage(n,12,12),requestAnimationFrame(()=>n.remove())}function Ws({children:e}){return(0,Y.jsx)(`span`,{className:`ml-auto pl-6 text-2xs text-fg-muted tabular-nums`,children:e})}function Gs({depth:e,initial:t,icon:n,onCommit:r,onCancel:i}){let a=(0,X.useRef)(null),o=(0,X.useRef)(!1);(0,X.useEffect)(()=>{let e=a.current;if(!e)return;let n=()=>{e.focus();let n=t.lastIndexOf(`.`);e.setSelectionRange(0,n>0?n:t.length)};n();let r=requestAnimationFrame(()=>{document.activeElement!==e&&n()});return()=>cancelAnimationFrame(r)},[t]);let s=()=>{o.current||(o.current=!0,r(a.current?.value??``))};return(0,Y.jsxs)(`div`,{className:`flex h-6 items-center gap-1 pr-2 compact:h-5`,style:{paddingLeft:e*Vs+8},children:[(0,Y.jsx)(`span`,{className:`size-3.5 shrink-0`}),n,(0,Y.jsx)(`input`,{ref:a,defaultValue:t,spellCheck:!1,onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`?s():e.key===`Escape`&&(o.current=!0,i())},onBlur:s,className:`min-w-0 flex-1 bg-surface text-sm text-fg outline-none`})]})}function Ks({path:e,entry:t,depth:n}){let r=ks(),i=t.type===`dir`,o=i&&r.expanded.has(e),s=i&&r.dropTarget===e,c=!i&&e===r.activePath,l=r.selection.has(e),u=r.clipboard?.mode===`cut`&&r.clipboard.paths.includes(e),d={path:e,name:t.name,type:t.type,depth:n,parentDir:hs(e)},f=r.statusMap.get(e),p=i?Xo(r.statusMap,e):null,m=f?qo(f):p?qo(p):null,h=m?m.colourClass:t.name.startsWith(`.`)?`text-fg-muted`:`text-fg`,g=l&&r.selection.size>1?[...r.selection]:[e],_=i?e:hs(e),v=r.clipboard!==null;return r.editing?.mode===`rename`&&r.editing.path===e?(0,Y.jsx)(Gs,{depth:n,initial:t.name,icon:i?(0,Y.jsx)(mr,{className:`size-3.5 shrink-0 text-fg`}):(0,Y.jsx)(Bs,{name:t.name}),onCommit:r.commitEdit,onCancel:r.cancelEdit}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(St,{children:[(0,Y.jsx)(ct,{asChild:!0,children:(0,Y.jsxs)(`div`,{role:`treeitem`,"data-path":e,"aria-expanded":i?o:void 0,"aria-selected":l,tabIndex:-1,draggable:!r.readOnly,onClick:e=>{e.currentTarget.closest(`[data-explorer-root]`)?.focus(),r.onRowClick(d,e)},onDoubleClick:()=>r.onRowDoubleClick(d),onContextMenu:()=>{l||r.selectOnly(e)},onDragStart:t=>{let n=ys(g);t.dataTransfer.setData(bs,xs(n)),n.length>1&&Us(t,n.length),!i&&n.length===1&&t.dataTransfer.setData(Ns,Ps({type:`editor`,tab:r.root===void 0?{kind:`file`,session:r.sid,path:e}:{kind:`external`,session:r.sid,path:e,root:r.root}})),t.dataTransfer.effectAllowed=`copyMove`},onDragOver:t=>{!i||r.readOnly||(t.preventDefault(),t.stopPropagation(),r.setDropTarget(e))},onDragLeave:e=>{i&&e.currentTarget===e.target&&r.setDropTarget(null)},onDrop:t=>{if(!i||r.readOnly)return;t.preventDefault(),t.stopPropagation(),r.setDropTarget(null);let n=Ss(t.dataTransfer.getData(bs));n.length>0?r.onInternalDrop(e,n):r.onDropUpload(e,t.dataTransfer.items,t.dataTransfer.files)},style:{paddingLeft:n*Vs+8},className:a(`group/treerow flex h-6 cursor-pointer items-center gap-1 pr-2 text-sm transition-colors hover:bg-elevated compact:h-5`,l?`bg-selection`:c&&`bg-elevated`,s&&`bg-selection`,u&&`opacity-50`),children:[i?(0,Y.jsx)(Vt,{className:a(`size-3.5 shrink-0 text-fg-gold transition-transform duration-150`,o&&`rotate-90`)}):(0,Y.jsx)(`span`,{className:`size-3.5 shrink-0`}),t.symlink||t.type===`symlink`?(0,Y.jsx)(vr,{className:`size-3.5 shrink-0 text-fg`}):i?o?(0,Y.jsx)(Ut,{className:a(`size-3.5 shrink-0`,p?m?.colourClass:`text-fg`)}):(0,Y.jsx)(mr,{className:a(`size-3.5 shrink-0`,p?m?.colourClass:`text-fg`)}):(0,Y.jsx)(Bs,{name:t.name,dimmed:f===`ignored`}),(0,Y.jsx)(Q,{text:t.name,className:h,hoverClass:Hs}),f&&m&&m.letter&&(0,Y.jsx)(`span`,{className:a(`shrink-0 font-mono text-2xs`,m.colourClass),children:m.letter})]})}),(0,Y.jsxs)(vt,{onCloseAutoFocus:e=>{r.editing&&e.preventDefault()},children:[i&&!r.readOnly&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(H,{onSelect:()=>r.beginCreate(e,`file`),children:`New File…`}),(0,Y.jsx)(H,{onSelect:()=>r.beginCreate(e,`dir`),children:`New Folder…`}),r.onOpenTerminal&&(0,Y.jsx)(H,{onSelect:()=>r.onOpenTerminal?.(e),children:`Open Terminal in Directory`}),(0,Y.jsx)(pt,{})]}),!r.readOnly&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(H,{onSelect:()=>r.cut(g),children:[`Cut `,(0,Y.jsx)(Ws,{children:`⌘X`})]}),(0,Y.jsxs)(H,{onSelect:()=>r.copy(g),children:[`Copy `,(0,Y.jsx)(Ws,{children:`⌘C`})]}),(0,Y.jsxs)(H,{disabled:!v,onSelect:()=>r.paste(_),children:[`Paste `,(0,Y.jsx)(Ws,{children:`⌘V`})]}),(0,Y.jsx)(pt,{})]}),(0,Y.jsxs)(H,{onSelect:()=>r.copyPathToClipboard(g,!1),children:[`Copy Path `,(0,Y.jsx)(Ws,{children:`⌥⌘C`})]}),(0,Y.jsxs)(H,{onSelect:()=>r.copyPathToClipboard(g,!0),children:[`Copy Relative Path `,(0,Y.jsx)(Ws,{children:`⌥⇧⌘C`})]}),(0,Y.jsx)(pt,{}),!r.readOnly&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(H,{onSelect:()=>r.beginRename(e),children:[`Rename… `,(0,Y.jsx)(Ws,{children:`F2`})]}),(0,Y.jsxs)(H,{onSelect:()=>r.requestDelete(g),children:[`Delete `,(0,Y.jsx)(Ws,{children:`⌘⌫`})]}),(0,Y.jsx)(pt,{})]}),(0,Y.jsx)(H,{onSelect:()=>r.download(g),children:`Download`})]})]}),i&&o&&(0,Y.jsx)(qs,{sid:r.sid,path:e,depth:n+1})]})}function qs({sid:e,path:t,depth:n}){let r=ks(),i=R(e,t,r.root),a={paddingLeft:n*Vs+8},o=r.editing,s=o?.mode===`create`&&o.parentDir===t?(0,Y.jsx)(Js,{depth:n,kind:o.kind}):null;if(i.isLoading)return(0,Y.jsxs)(Y.Fragment,{children:[s,(0,Y.jsx)(`div`,{style:a,className:`py-0.5 text-xs text-fg-muted`,children:`Loading…`})]});if(i.isError)return(0,Y.jsx)(`div`,{style:a,className:`py-0.5 text-xs text-fg-muted`,children:i.error instanceof Error?i.error.message:`Couldn't load this folder.`});let c=i.data?.entries??[];return c.length===0&&!s?(0,Y.jsx)(`div`,{style:a,className:`py-0.5 text-xs text-fg-muted`,children:`Empty`}):(0,Y.jsxs)(Y.Fragment,{children:[s,c.map(e=>(0,Y.jsx)(Ks,{path:vs(t,e.name),entry:e,depth:n},e.name))]})}function Js({depth:e,kind:t}){let n=ks(),[r,i]=(0,X.useState)(``);return(0,Y.jsx)(Gs,{depth:e,initial:r,icon:t===`dir`?(0,Y.jsx)(mr,{className:`size-3.5 shrink-0 text-fg`}):(0,Y.jsx)(Bs,{name:r||`file`}),onCommit:e=>{i(e),n.commitEdit(e)},onCancel:n.cancelEdit})}function Ys(){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Xs,{}),(0,Y.jsx)(Zs,{})]})}function Xs(){let e=ks(),t=(0,X.useRef)(null);(0,X.useEffect)(()=>{!e.focusedPath||!t.current||t.current.querySelector(`[data-path="${CSS.escape(e.focusedPath)}"]`)?.scrollIntoView({block:`nearest`})},[e.focusedPath]);let n=e.clipboard!==null;return(0,Y.jsxs)(St,{children:[(0,Y.jsx)(ct,{asChild:!0,children:(0,Y.jsx)(`div`,{ref:t,"data-explorer-root":!0,role:`tree`,tabIndex:0,onKeyDown:e.handleKeyDown,onPaste:t=>e.onDropUpload(``,t.clipboardData.items,t.clipboardData.files),onDragOver:t=>{e.readOnly||(t.preventDefault(),e.setDropTarget(``))},onDragLeave:t=>{t.currentTarget===t.target&&e.setDropTarget(null)},onDrop:t=>{if(e.readOnly)return;t.preventDefault(),e.setDropTarget(null);let n=Ss(t.dataTransfer.getData(bs));n.length>0?e.onInternalDrop(``,n):e.onDropUpload(``,t.dataTransfer.items,t.dataTransfer.files)},className:a(`h-full overflow-y-auto py-1 outline-none`,e.dropTarget===``&&`bg-selection`),children:(0,Y.jsx)(qs,{sid:e.sid,path:``,depth:0})})}),(0,Y.jsxs)(vt,{onCloseAutoFocus:t=>{e.editing&&t.preventDefault()},children:[!e.readOnly&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(H,{onSelect:()=>e.beginCreate(``,`file`),children:`New File…`}),(0,Y.jsx)(H,{onSelect:()=>e.beginCreate(``,`dir`),children:`New Folder…`}),e.onOpenTerminal&&(0,Y.jsx)(H,{onSelect:()=>e.onOpenTerminal?.(``),children:`Open Terminal in Directory`}),(0,Y.jsx)(pt,{}),(0,Y.jsx)(H,{disabled:!n,onSelect:()=>e.paste(``),children:`Paste`}),(0,Y.jsx)(pt,{})]}),(0,Y.jsx)(H,{onSelect:()=>e.copyPathToClipboard([``],!1),children:`Copy Path`}),(0,Y.jsxs)(H,{onSelect:()=>e.download([``]),children:[`Download `,ms(e.rootPath)||`folder`]})]})]})}function Zs(){let e=ks(),t=f().data?.home,n=e.pendingDelete;return(0,Y.jsx)(ze,{open:n!==null,onOpenChange:t=>!t&&e.cancelDelete(),children:(0,Y.jsxs)(Ie,{children:[(0,Y.jsxs)(Me,{children:[(0,Y.jsxs)(Le,{children:[`Delete `,n&&n.length===1?`“${ms(n[0])}”`:`${n?.length??0} items`,`?`]}),(0,Y.jsxs)(Re,{children:[`This permanently removes `,n&&n.length>1?`them`:`it`,` from`,` `,(0,Y.jsx)(`span`,{className:`text-fg-secondary`,children:Ms(e.rootPath,t)}),`. There is no undo.`]})]}),(0,Y.jsxs)(Pe,{children:[(0,Y.jsx)(V,{variant:`ghost`,onClick:e.cancelDelete,children:`Cancel`}),(0,Y.jsx)(V,{variant:`danger`,onClick:e.confirmDelete,children:`Delete`})]})]})})}function Qs({session:e,root:t,readOnly:n,boundHeader:r,onNavigateUp:i,onReset:a,onOpenFile:o,activePath:s}){return(0,Y.jsxs)(js,{session:e,root:t,readOnly:n,onOpenFile:(e,t,n)=>o(t,n),activePath:s,children:[r,(0,Y.jsx)($s,{root:t,onNavigateUp:i,onReset:a}),(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,Y.jsx)(Ys,{})})]},t)}function $s({root:e,onNavigateUp:t,onReset:n}){return(0,Y.jsxs)(`div`,{className:`flex h-8 shrink-0 items-center px-2`,children:[(0,Y.jsxs)(K,{children:[(0,Y.jsx)(W,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,onClick:t,disabled:e===`/`,className:`flex min-w-0 flex-1 items-center gap-1.5 rounded-sm px-1 py-1 text-left text-fg-gold transition-colors hover:bg-elevated hover:text-fg disabled:pointer-events-none disabled:opacity-40`,children:[(0,Y.jsx)(On,{className:`size-3.5 shrink-0`}),(0,Y.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`..`})]})}),(0,Y.jsx)(q,{children:e===`/`?e:`Browse the parent directory`})]}),(0,Y.jsxs)(K,{children:[(0,Y.jsx)(W,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,onClick:n,className:`ml-1 shrink-0 rounded-sm p-1 text-fg-gold transition-colors hover:bg-elevated hover:text-fg`,children:[(0,Y.jsx)(Mr,{className:`size-3.5`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:`Back to the worktree`})]})}),(0,Y.jsx)(q,{children:`Back to the worktree`})]})]})}var ec=/[.*+?^${}()|[\]\\]/g;function tc(e){if(e.query.length===0)return null;try{let t=e.regex?e.query:e.query.replace(ec,`\\$&`);return e.wholeWord&&(t=`\\b(?:${t})\\b`),new RegExp(t,e.caseSensitive?`g`:`gi`)}catch{return null}}function nc(e,t){if(!t)return[{text:e,hit:!1}];let n=[],r=0;t.lastIndex=0;let i;for(;(i=t.exec(e))!==null;){if(i[0].length===0){t.lastIndex++;continue}i.index>r&&n.push({text:e.slice(r,i.index),hit:!1}),n.push({text:i[0],hit:!0}),r=i.index+i[0].length}return r<e.length&&n.push({text:e.slice(r),hit:!1}),n.length>0?n:[{text:e,hit:!1}]}var rc=240;function ic(e){let t=e.replace(/^\s+/,``);return t.length>rc?`${t.slice(0,rc)}…`:t}var ac=250,oc=`group-hover:[transform:translateX(var(--tail))]`;function sc({active:e,label:t,onClick:n,children:r}){return(0,Y.jsxs)(K,{children:[(0,Y.jsx)(W,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,"aria-pressed":e,onClick:n,className:a(`rounded-sm p-1 transition-colors`,e?`bg-elevated text-accent`:`text-fg-muted hover:bg-elevated hover:text-fg`),children:[r,(0,Y.jsx)(`span`,{className:`sr-only`,children:t})]})}),(0,Y.jsx)(q,{children:t})]})}function cc({session:e,root:t,onOpen:n}){let[r,i]=(0,X.useState)(``),[a,o]=(0,X.useState)(``),[s,c]=(0,X.useState)(!1),[l,u]=(0,X.useState)(!1),[d,f]=(0,X.useState)(!1);(0,X.useEffect)(()=>{let e=setTimeout(()=>o(r),ac);return()=>clearTimeout(e)},[r]);let p={query:a,regex:s,caseSensitive:l,wholeWord:d},m=le(e,p,t),h=(0,X.useMemo)(()=>tc(p),[a,s,l,d]),g=m.data,_=!!g&&(g.files.length>0||g.content.length>0),v=(e,r,i=!0)=>{n(e,r,i?void 0:{preview:!1}),Qa({path:e,root:t})};return(0,Y.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-1 px-2 py-1.5`,children:[(0,Y.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),placeholder:`Search files and contents`,spellCheck:!1,autoComplete:`off`,className:`rounded-md bg-elevated px-2 py-1 text-xs text-fg outline-none placeholder:text-fg-muted`}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(sc,{active:l,label:`Match case`,onClick:()=>u(e=>!e),children:(0,Y.jsx)(Mt,{className:`size-3.5`})}),(0,Y.jsx)(sc,{active:d,label:`Match whole word`,onClick:()=>f(e=>!e),children:(0,Y.jsx)(Ot,{className:`size-3.5`})}),(0,Y.jsx)(sc,{active:s,label:`Use regular expression`,onClick:()=>c(e=>!e),children:(0,Y.jsx)(At,{className:`size-3.5`})})]})]}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pb-2`,children:a.length===0?(0,Y.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`Search file names and contents.`}):m.isPending?(0,Y.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`Searching…`}):m.error?(0,Y.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:m.error instanceof Error?m.error.message:`Search failed`}):_?(0,Y.jsxs)(Y.Fragment,{children:[g.files.length>0&&(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`div`,{className:`px-3 pb-0.5 pt-1.5 text-2xs font-medium uppercase tracking-wide text-fg-gold`,children:`Files`}),g.files.map(e=>(0,Y.jsxs)(`button`,{type:`button`,title:e,onClick:()=>v(e),onDoubleClick:()=>v(e,void 0,!1),className:`group flex w-full items-center gap-1.5 px-3 py-1 text-left transition-colors hover:bg-elevated`,children:[(0,Y.jsx)(pr,{className:`size-3.5 shrink-0 text-fg-gold`}),(0,Y.jsx)(Q,{text:e,className:`text-xs text-fg`,hoverClass:oc})]},e))]}),g.content.length>0&&(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`div`,{className:`px-3 pb-0.5 pt-2 text-2xs font-medium uppercase tracking-wide text-fg-gold`,children:`Contents`}),g.content.map(e=>(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`button`,{type:`button`,title:e.path,onClick:()=>v(e.path),onDoubleClick:()=>v(e.path,void 0,!1),className:`group flex w-full px-3 py-1 text-left transition-colors hover:bg-elevated`,children:(0,Y.jsx)(Q,{text:e.path,className:`text-2xs text-fg-secondary`,hoverClass:oc})}),e.matches.map((t,n)=>(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>v(e.path,t.line),onDoubleClick:()=>v(e.path,t.line,!1),className:`flex w-full items-baseline gap-2 py-0.5 pl-6 pr-3 text-left transition-colors hover:bg-elevated`,children:[(0,Y.jsx)(`span`,{className:`shrink-0 font-mono text-2xs tabular-nums text-fg-muted`,children:t.line}),(0,Y.jsx)(`span`,{className:`truncate font-mono text-2xs text-fg-secondary`,children:nc(ic(t.text),h).map((e,t)=>e.hit?(0,Y.jsx)(`span`,{className:`text-accent`,children:e.text},t):(0,Y.jsx)(`span`,{children:e.text},t))})]},`${t.line}:${n}`))]},e.path))]}),g.truncated&&(0,Y.jsx)(`div`,{className:`px-3 py-2 text-2xs text-fg-muted`,children:`Showing the first results — refine the query for more.`})]}):(0,Y.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`No results.`})})]})}var lc=new Set([`starting`,`running`,`waiting_input`]),uc=`group-hover:[transform:translateX(var(--tail))]`;function dc(e){return e.split(`/`).filter(Boolean).pop()??e}function fc({children:e,className:t,title:n}){return(0,Y.jsx)(`span`,{title:n,className:a(`shrink-0 text-2xs`,t),children:e})}function pc({label:e,blockReason:t,onClick:n}){return(0,Y.jsxs)(K,{children:[(0,Y.jsx)(W,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,disabled:t!==null,onClick:n,className:a(`-my-1 rounded-sm p-1 text-fg-gold transition-colors hover:text-danger`,t===null?`hidden group-hover:inline-flex pointer-coarse:inline-flex`:`hidden`),children:[(0,Y.jsx)(Gt,{className:`size-3.5`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:e})]})}),(0,Y.jsx)(q,{children:t?`Can't ${e.toLowerCase()} — ${t}`:e})]})}function mc({repoId:e,projectId:t,sessions:n}){let r=S(e),i=x(e,t),a=F(e,t),[o,s]=(0,X.useState)(null),[c,l]=(0,X.useState)(null),u=i.isPending||a.isPending,d=(0,X.useMemo)(()=>{let e=new Map;for(let t of n)lc.has(t.status)&&e.set(t.worktree_path,(e.get(t.worktree_path)??0)+1);return e},[n]),f=(0,X.useMemo)(()=>{let e=new Map;for(let t of r.data?.worktrees??[]){let n=t.branch??`(detached)`;(e.get(n)??e.set(n,[]).get(n)).push(t)}return[...e.entries()].sort(([,e],[,t])=>!e.some(e=>e.is_primary)-+!t.some(e=>e.is_primary)||(e[0]?.branch??``).localeCompare(t[0]?.branch??``))},[r.data]),p=(0,X.useMemo)(()=>[...r.data?.orphan_branches??[]].sort((e,t)=>e.name.localeCompare(t.name)),[r.data]);return r.isPending?(0,Y.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`Loading worktrees…`}):r.error?(0,Y.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:r.error instanceof Error?r.error.message:`Failed to load worktrees`}):(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pb-2`,children:[f.length===0&&p.length===0&&(0,Y.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`No worktrees.`}),f.map(([e,t])=>(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`group flex items-center gap-1.5 px-3 pb-0.5 pt-2 text-2xs text-fg-muted`,children:[(0,Y.jsx)(_r,{className:`size-3 shrink-0 text-fg-gold`}),(0,Y.jsx)(Q,{text:e,hoverClass:uc})]}),t.map(e=>{let t=d.get(e.path)??0,n=e.is_primary?`the repository clone`:e.dirty?`uncommitted changes`:t>0?`${t} running session${t>1?`s`:``}`:null;return(0,Y.jsxs)(`div`,{className:`group flex items-center gap-2 px-3 py-1 pl-6 transition-colors hover:bg-elevated`,children:[(0,Y.jsx)(Q,{text:dc(e.path),title:e.path,className:`text-xs text-fg`,hoverClass:uc}),e.is_primary&&(0,Y.jsx)(fc,{className:`text-fg-muted`,children:`clone`}),e.dirty&&(0,Y.jsx)(fc,{className:`text-warning`,title:`Modified — uncommitted changes`,children:`M`}),t>0&&(0,Y.jsx)(fc,{className:`text-running`,title:`${t} running session${t>1?`s`:``}`,children:t}),(0,Y.jsx)(pc,{label:`Prune`,blockReason:n,onClick:()=>{l(null),s({kind:`worktree`,path:e.path,branch:e.branch})}})]},e.path)})]},`wt:${e}`)),p.length>0&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`px-3 pb-0.5 pt-3 text-2xs font-medium uppercase tracking-wide text-fg-gold`,children:`Branches without a worktree`}),p.map(e=>(0,Y.jsxs)(`div`,{className:`group flex items-center gap-2 px-3 py-1 transition-colors hover:bg-elevated`,children:[(0,Y.jsx)(_r,{className:`size-3 shrink-0 text-fg-gold`}),(0,Y.jsx)(Q,{text:e.name,className:`text-xs text-fg`,hoverClass:uc}),e.local_only&&(0,Y.jsx)(fc,{className:`text-warning`,children:`local only`}),(0,Y.jsx)(pc,{label:`Delete branch`,blockReason:null,onClick:()=>{l(null),s({kind:`branch`,name:e.name,localOnly:e.local_only})}})]},`br:${e.name}`))]}),(0,Y.jsx)(ze,{open:o!==null,onOpenChange:e=>{e||s(null)},children:(0,Y.jsxs)(Ie,{children:[o?.kind===`branch`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(Me,{children:[(0,Y.jsx)(Le,{children:`Delete branch`}),(0,Y.jsxs)(Re,{children:[`Delete branch `,(0,Y.jsx)(`span`,{className:`text-fg`,children:o.name}),`? This removes the branch from the repository.`]})]}),o.localOnly&&(0,Y.jsxs)(`p`,{className:`text-xs text-warning`,children:[(0,Y.jsx)(`span`,{children:o.name}),` has commits on no remote — deleting it discards that work permanently.`]})]}):(0,Y.jsxs)(Me,{children:[(0,Y.jsx)(Le,{children:`Prune worktree`}),(0,Y.jsxs)(Re,{children:[`Remove `,(0,Y.jsx)(`span`,{className:`text-fg`,children:o?dc(o.path):``}),`? The working directory is deleted; the branch`,` `,(0,Y.jsx)(`span`,{className:`text-fg`,children:o?.branch??``}),` is kept.`]})]}),c&&(0,Y.jsx)(`p`,{className:`text-xs text-danger`,children:c}),(0,Y.jsxs)(Pe,{children:[(0,Y.jsx)(V,{type:`button`,variant:`ghost`,onClick:()=>s(null),children:`Cancel`}),(0,Y.jsx)(V,{type:`button`,variant:`danger`,disabled:u,onClick:()=>{if(!o)return;l(null);let e=e=>l(e.message),t=()=>s(null);o.kind===`worktree`?i.mutate(o.path,{onSuccess:t,onError:e}):a.mutate({name:o.name,confirm:!0},{onSuccess:t,onError:e})},children:o?.kind===`branch`?`Delete`:`Prune`})]})]})})]})}var hc=`DropdownMenu`,[gc,_c]=je(hc,[et]),vc=et(),[yc,bc]=gc(hc),xc=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=vc(t),l=X.useRef(null),[u,d]=Ne({prop:i,defaultProp:a??!1,onChange:o,caller:hc});return(0,Y.jsx)(yc,{scope:t,triggerId:Be(),triggerRef:l,contentId:Be(),open:u,onOpenChange:d,onOpenToggle:X.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,Y.jsx)(Et,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};xc.displayName=hc;var Sc=`DropdownMenuTrigger`,Cc=X.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=bc(Sc,n),o=vc(n),s=Fe(t,a.triggerRef);return(0,Y.jsx)(Ct,{asChild:!0,...o,children:(0,Y.jsx)(Ae.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:s,onPointerDown:ke(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:ke(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Cc.displayName=Sc;var wc=`DropdownMenuPortal`,Tc=e=>{let{__scopeDropdownMenu:t,...n}=e,r=vc(t);return(0,Y.jsx)(wt,{...r,...n})};Tc.displayName=wc;var Ec=`DropdownMenuContent`,Dc=X.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=bc(Ec,n),a=vc(n),o=X.useRef(!1);return(0,Y.jsx)(bt,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:ke(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:ke(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Dc.displayName=Ec;var Oc=`DropdownMenuGroup`,kc=X.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=vc(n);return(0,Y.jsx)(_t,{...i,...r,ref:t})});kc.displayName=Oc;var Ac=`DropdownMenuLabel`,jc=X.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=vc(n);return(0,Y.jsx)(at,{...i,...r,ref:t})});jc.displayName=Ac;var Mc=`DropdownMenuItem`,Nc=X.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=vc(n);return(0,Y.jsx)(ft,{...i,...r,ref:t})});Nc.displayName=Mc;var Pc=`DropdownMenuCheckboxItem`,Fc=X.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=vc(n);return(0,Y.jsx)(ut,{...i,...r,ref:t})});Fc.displayName=Pc;var Ic=`DropdownMenuRadioGroup`,Lc=X.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=vc(n);return(0,Y.jsx)(Dt,{...i,...r,ref:t})});Lc.displayName=Ic;var Rc=`DropdownMenuRadioItem`,zc=X.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=vc(n);return(0,Y.jsx)(st,{...i,...r,ref:t})});zc.displayName=Rc;var Bc=`DropdownMenuItemIndicator`,Vc=X.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=vc(n);return(0,Y.jsx)(dt,{...i,...r,ref:t})});Vc.displayName=Bc;var Hc=`DropdownMenuSeparator`,Uc=X.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=vc(n);return(0,Y.jsx)(rt,{...i,...r,ref:t})});Uc.displayName=Hc;var Wc=`DropdownMenuArrow`,Gc=X.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=vc(n);return(0,Y.jsx)(lt,{...i,...r,ref:t})});Gc.displayName=Wc;var Kc=e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=vc(t),[s,c]=Ne({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,Y.jsx)(Qe,{...o,open:s,onOpenChange:c,children:n})},qc=`DropdownMenuSubTrigger`,Jc=X.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=vc(n);return(0,Y.jsx)(it,{...i,...r,ref:t})});Jc.displayName=qc;var Yc=`DropdownMenuSubContent`,Xc=X.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=vc(n);return(0,Y.jsx)(Tt,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Xc.displayName=Yc;var Zc=xc,Qc=Cc,$c=Tc,el=Dc,tl=Nc,nl=Uc,rl=Kc,il=Jc,al=Xc,ol=Zc,sl=Qc,cl=rl;function ll({className:e,sideOffset:t=4,...n}){return(0,Y.jsx)($c,{children:(0,Y.jsx)(el,{sideOffset:t,className:a(`z-50 min-w-36 overflow-hidden rounded-md bg-elevated p-1 shadow-xl`,e),...n})})}function ul({className:e,...t}){return(0,Y.jsx)(tl,{className:a(qe,Ue,`[&_svg]:size-3.5`,e),...t})}function dl({className:e,children:t,...n}){return(0,Y.jsxs)(il,{className:a(qe,Ue,`data-[state=open]:bg-action data-[state=open]:text-action-ink [&_svg]:size-3.5`,e),...n,children:[t,(0,Y.jsx)(Vt,{className:`ml-auto`})]})}function fl({className:e,...t}){return(0,Y.jsx)($c,{children:(0,Y.jsx)(al,{className:a(`z-50 min-w-36 overflow-hidden rounded-md bg-elevated p-1 shadow-xl`,e),...t})})}function pl({className:e,...t}){return(0,Y.jsx)(nl,{className:a(`-mx-1 my-1 h-px bg-border`,e),...t})}function ml({name:e,session:t}){let n=N()??void 0,r=un().projectBasedLayout,i=j(r?void 0:n),a=t?.kind===`agent`,o=ie(a?n:void 0),s=i.data?.find(e=>e.id===t?.project_id)?.name,c=t?.account_id==null?void 0:o.data?.find(e=>e.id===t.account_id)?.label,l=[s,t?.branch].filter(Boolean).join(` · `);return(0,Y.jsxs)(`span`,{className:`flex flex-col`,children:[(0,Y.jsx)(`span`,{children:e}),l!==``&&(0,Y.jsx)(`span`,{className:`text-2xs text-fg-muted`,children:l}),a&&(0,Y.jsxs)(`span`,{className:`mt-0.5 flex items-center gap-1 text-2xs text-fg-muted`,children:[(0,Y.jsx)(U,{type:t.agent_type??``,className:`size-3 shrink-0`}),(0,Y.jsx)(`span`,{children:t.agent_type}),c!==void 0&&(0,Y.jsxs)(`span`,{children:[` · `,c]})]}),t?.kind===`terminal`&&(0,Y.jsxs)(`span`,{className:`mt-0.5 flex items-center gap-1 text-2xs text-fg-muted`,children:[(0,Y.jsx)(Gn,{className:`size-3 shrink-0`}),(0,Y.jsx)(`span`,{children:`terminal`})]})]})}function hl({text:e,className:t}){let n=(0,X.useRef)(null);return(0,X.useEffect)(()=>{let e=n.current;if(!e)return;let t=()=>{e.scrollLeft=e.scrollWidth};t();let r=new ResizeObserver(t);return r.observe(e),()=>r.disconnect()},[e]),(0,Y.jsx)(`div`,{ref:n,className:`no-scrollbar min-w-0 flex-1 overflow-x-auto`,children:(0,Y.jsx)(`span`,{className:a(`inline-block whitespace-nowrap`,t),children:e})})}function gl({sessions:e,target:t,showFileActions:n=!1,location:r}){let{session:i,pinned:o,pin:s,unpin:c,isProjectDirectory:l}=t,u=Pn(),d=f().data?.home,p=e.filter(e=>e.status!==`archived`),m=r??t.root??i?.worktree_path??null;return(0,Y.jsxs)(`div`,{className:`group relative flex h-8 shrink-0 items-center px-2`,children:[(0,Y.jsx)(hl,{text:m?Ms(m,d):`No worktree`,className:`text-xs text-fg-secondary`}),(0,Y.jsxs)(`div`,{className:a(`absolute inset-y-0 right-1 flex items-center gap-1 bg-surface pl-2 opacity-0 transition-opacity`,`pointer-events-none focus-within:pointer-events-auto focus-within:opacity-100 group-hover:pointer-events-auto group-hover:opacity-100`,o&&`pointer-events-auto opacity-100`),children:[n&&i&&(0,Y.jsx)(vl,{}),(0,Y.jsxs)(`button`,{type:`button`,"aria-pressed":o,disabled:!i||l,title:l?`The project directory is the fallback binding — nothing to pin`:o?`Unpin — follow the active session`:`Pin the sidebar to this worktree`,onClick:()=>o?c():i&&s(i.id),className:a(`shrink-0 rounded-sm p-1 transition-colors disabled:pointer-events-none disabled:opacity-40`,o?`text-fg`:`text-fg-gold hover:bg-elevated hover:text-fg`),children:[(0,Y.jsx)(Dr,{className:a(`size-3.5`,o&&`fill-current`)}),(0,Y.jsx)(`span`,{className:`sr-only`,children:o?`Unpin sidebar`:`Pin sidebar`})]}),(0,Y.jsxs)(ol,{children:[(0,Y.jsx)(sl,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,title:`Bind a different worktree`,className:`shrink-0 rounded-sm p-1 text-fg-gold transition-colors hover:bg-elevated hover:text-fg`,children:[(0,Y.jsx)(Bt,{className:`size-3.5`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:`Choose a worktree`})]})}),(0,Y.jsx)(ll,{align:`end`,children:p.length===0?(0,Y.jsx)(`div`,{className:`px-2 py-1.5 text-xs text-fg-muted`,children:`No sessions yet`}):p.map(e=>(0,Y.jsx)(ul,{onSelect:()=>s(e.id),className:`min-w-64 items-start`,children:(0,Y.jsx)(ml,{name:u(e),session:e})},e.id))})]})]})]})}var _l=[{key:`refresh`,label:`Refresh`,icon:Yt},{key:`collapse`,label:`Collapse Folders`,icon:Xn}];function vl(){let e=As();if(!e)return null;let t=t=>{t===`refresh`?e.refresh():t===`collapse`&&e.collapseAll()};return(0,Y.jsx)(`div`,{className:`hidden shrink-0 items-center gap-0.5 group-hover:flex group-focus-within:flex`,children:_l.map(({key:e,label:n,icon:r})=>(0,Y.jsxs)(K,{children:[(0,Y.jsx)(W,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>t(e),className:`rounded-sm p-1 text-fg-gold transition-colors hover:bg-elevated hover:text-fg`,children:[(0,Y.jsx)(r,{className:`size-3.5`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:n})]})}),(0,Y.jsx)(q,{children:n})]},e))})}var yl=[{key:`files`,label:`Files`,icon:hr},{key:`search`,label:`Search`,icon:sn},{key:`changes`,label:`Changes`,icon:_r},{key:`worktrees`,label:`Worktrees`,icon:Ke}];function bl(e){return e===`diff`||e===`history`||e===`changes`?`changes`:e===`search`?`search`:e===`worktrees`?`worktrees`:`files`}function xl({mode:e,onExpand:t,onSelect:n}){return(0,Y.jsxs)(`div`,{className:`flex h-full w-9 shrink-0 flex-col items-center gap-1 bg-surface py-1.5`,children:[(0,Y.jsxs)(K,{children:[(0,Y.jsx)(W,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,onClick:t,className:`flex items-center rounded-md p-1.5 text-fg-gold transition-colors hover:bg-elevated hover:text-fg`,children:[(0,Y.jsx)(wr,{className:`size-4`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:`Show sidebar`})]})}),(0,Y.jsx)(q,{side:`right`,children:`Show sidebar`})]}),yl.map(({key:t,label:r,icon:i})=>(0,Y.jsxs)(K,{children:[(0,Y.jsx)(W,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,"aria-current":e===t?`page`:void 0,onClick:()=>n(t),className:a(`flex items-center rounded-md p-1.5 transition-colors`,e===t?`bg-elevated text-fg`:`text-fg-gold hover:bg-elevated hover:text-fg`),children:[(0,Y.jsx)(i,{className:`size-4`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:r})]})}),(0,Y.jsx)(q,{side:`right`,children:r})]},t))]})}function Sl({mode:e,onModeChange:t,onCollapse:n,projectId:r,repoId:i,sessions:o,target:s,browseRequest:c,onOpenFile:l,onOpenExternalFile:u,onOpenTerminalIn:d,activeFilePath:f,activeExternalTab:p,activeDiffPath:h,onOpenDiff:g,onOpenCommitFile:_,onOpenSearchFile:v}){let{session:y}=s,b=s.root,[x,S]=(0,X.useState)(null),C=m().data?.protocol,w=!C||C.major>10||C.major===10&&C.minor>=2,T=!C||C.major>12||C.major===12&&C.minor>=3,E=w&&x!==null&&x.forSession===y?.id?x.root:null,D=E??b,O=ja(s,E),k=e=>{y&&(s.pinned||s.pin(y.id),S({forSession:y.id,root:e}))};(0,X.useEffect)(()=>$a(e=>{x!==null&&e.root===b&&S(null)}),[x,b]);let ee=(0,X.useRef)(0);(0,X.useEffect)(()=>{!c||!w||ee.current!==c.nonce&&(ee.current=c.nonce,s.pin(c.session),S({forSession:c.session,root:c.root}))},[c,w,s]);let A=Ma(s,()=>S(null)),j=`${y?.worktree_path??``}:${D??``}`;return(0,Y.jsxs)(`div`,{className:`flex h-full flex-col bg-surface`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-1.5`,children:[yl.map(({key:n,label:r,icon:i})=>(0,Y.jsxs)(K,{children:[(0,Y.jsx)(W,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,"aria-current":e===n?`page`:void 0,onClick:()=>t(n),className:a(`flex items-center rounded-md p-1.5 transition-colors`,e===n?`bg-elevated text-fg`:`text-fg-gold hover:bg-elevated hover:text-fg`),children:[(0,Y.jsx)(i,{className:`size-4`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:r})]})}),(0,Y.jsx)(q,{side:`bottom`,children:r})]},n)),(0,Y.jsxs)(K,{children:[(0,Y.jsx)(W,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,onClick:n,className:`ml-auto flex items-center rounded-md p-1.5 text-fg-gold transition-colors hover:bg-elevated hover:text-fg`,children:[(0,Y.jsx)(Cr,{className:`size-4`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:`Hide sidebar`})]})}),(0,Y.jsx)(q,{side:`bottom`,children:`Hide sidebar`})]})]}),e!==`worktrees`&&e!==`files`&&(0,Y.jsx)(gl,{sessions:o,target:A,location:O}),e===`worktrees`&&(0,Y.jsx)(mc,{repoId:i,projectId:r,sessions:o}),e===`files`&&(y&&E!==null?(0,Y.jsx)(Y.Fragment,{children:(0,Y.jsx)(Qs,{session:y,root:E,readOnly:!T,boundHeader:(0,Y.jsx)(gl,{sessions:o,target:A,showFileActions:!0,location:O}),onNavigateUp:()=>k(_s(E)),onReset:A.unpin,onOpenFile:(e,t)=>u(y.id,e,E,t),activePath:p?.root===E?p.path:null})}):y?(0,Y.jsxs)(js,{session:y,root:b,onOpenFile:b===void 0?l:(e,t,n)=>u(e,t,b,n),onOpenTerminal:b===void 0?e=>d(y.id,e):void 0,activePath:b===void 0?f:p?.root===b?p.path:null,children:[(0,Y.jsx)(gl,{sessions:o,target:A,showFileActions:!0,location:O}),w&&b===void 0&&(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>k(_s(y.worktree_path)),title:`Browse the parent directory`,className:`flex shrink-0 items-center gap-1.5 px-3 py-1 text-left transition-colors hover:bg-elevated`,children:[(0,Y.jsx)(On,{className:`size-3 shrink-0 text-fg-gold`}),(0,Y.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`..`})]}),(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,Y.jsx)(Ys,{})})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(gl,{sessions:o,target:A,location:O}),(0,Y.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`No worktree to show.`})]})),e===`changes`&&(y?(0,Y.jsx)(cs,{session:y.id,root:D,activeDiffPath:h,onOpenDiff:g,onOpenCommitFile:_},j):(0,Y.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`No worktree to show.`})),e===`search`&&(y?(0,Y.jsx)(cc,{session:y.id,root:D,onOpen:v},j):(0,Y.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,children:`No worktree to search.`}))]})}function Cl({projectId:e,repoId:t,open:n,kind:r=`agent`,seedAccountId:i,onOpenChange:o,onCreated:s}){let c=r===`terminal`,l=N(),u=ie(l??void 0),p=D(l??void 0),m=w(),h=f(),g=d(),[_,v]=(0,X.useState)(``),[y,b]=(0,X.useState)(``),[x,C]=(0,X.useState)(``),[T,E]=(0,X.useState)(!0),[O,k]=(0,X.useState)(!0),[ee,A]=(0,X.useState)(``),[M,te]=(0,X.useState)(``),[re,ae]=(0,X.useState)(!1),[P,F]=(0,X.useState)(null),oe=j(l??void 0),I=(0,X.useMemo)(()=>(oe.data??[]).filter(e=>!e.archived),[oe.data]),L=_||e,se=I.find(e=>e.id===L)?.repo_id??t,ce=m.data?.find(e=>e.id===se),le=ne(n?se:void 0),ue=S(n?se:void 0),de=u.data?.find(e=>String(e.id)===y),R=p.data?.allowSkipPermissions===!0,z=!c&&R&&de?.skip_permissions_default===!0,fe=x.trim()||ce?.default_base_branch||``;(0,X.useEffect)(()=>{n&&v(e)},[n,e]);let pe=(0,X.useMemo)(()=>(ue.data?.worktrees??[]).filter(e=>e.branch===fe).map(e=>({path:e.path,is_primary:e.is_primary,label:e.is_primary?`${e.path.split(`/`).filter(Boolean).pop()??e.path} (clone)`:e.path.split(`/`).filter(Boolean).pop()??e.path})),[ue.data,fe]),B=!T&&!O,me=pe.find(e=>e.is_primary)?.path??pe[0]?.path??``,he=M||me,ge=(0,X.useMemo)(()=>{let e=p.data?.default_account_id;return u.data?.find(e=>e.id===i)??u.data?.find(t=>typeof e==`number`&&t.id===e)??u.data?.[0]},[u.data,p.data,i]),_e=y||(ge?String(ge.id):``);(0,X.useEffect)(()=>{n&&i!==void 0&&b(String(i))},[n,i]);let ve=(0,X.useRef)(p.data);ve.current=p.data,(0,X.useEffect)(()=>{if(n){let e=zt(c?`terminal`:`agent`,ve.current);C(e.baseBranch),E(e.separateBranch),k(e.separateWorktree),te(``)}},[n,c,L]);let ye=ce?.default_base_branch;(0,X.useEffect)(()=>{!n||!ye||C(e=>e===``?ye:e)},[n,L,ye]);let be=()=>{F(null),g.mutate({project_id:L,...c?{kind:`terminal`}:{account_id:Number(_e)},...x.trim()?{base_branch:x.trim()}:{},separate_branch:T,...T&&ee.trim()?{branch:ee.trim()}:{},...T?{}:{separate_worktree:O},...B&&he?{join_worktree:he}:{},...z&&re?{skip_permissions:!0}:{}},{onSuccess:e=>{o(!1),A(``),ae(!1),s(e)},onError:e=>F(e.message)})},xe=c?`a shell`:`an agent`,Se=T?`on a new branch off ${fe||`…`}, in its own directory`:B?`on ${fe||`…`}, sharing an existing directory`:`on ${fe||`…`}, in its own directory`;return(0,Y.jsx)(ze,{open:n,onOpenChange:o,children:(0,Y.jsxs)(Ie,{children:[(0,Y.jsxs)(Me,{children:[(0,Y.jsx)(Le,{children:c?`New terminal`:`New agent`}),(0,Y.jsxs)(Re,{children:[c?`Opens`:`Spawns`,` `,xe,` in`,` `,(0,Y.jsx)(wl,{projects:I,value:L,onChange:v}),` `,Se,`.`]})]}),(0,Y.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),(c||_e)&&be()},children:[!c&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Y.jsx)(Ye,{children:`Account`}),u.data?.length===0?(0,Y.jsxs)(`p`,{className:`text-sm text-fg-secondary`,children:[`No accounts yet —`,` `,(0,Y.jsx)(`button`,{type:`button`,className:`text-accent underline`,onClick:()=>wn(`accounts`),children:`add one in settings`}),`.`]}):(0,Y.jsxs)(It,{value:_e,onValueChange:b,children:[(0,Y.jsx)(Pt,{children:(0,Y.jsx)(Lt,{placeholder:`pick an account`})}),(0,Y.jsx)(Rt,{children:u.data?.map(e=>(0,Y.jsxs)(Ft,{value:String(e.id),children:[(0,Y.jsxs)(`span`,{children:[e.agent_type,`/`,e.label]}),!e.logged_in&&(0,Y.jsx)(`span`,{className:`ml-2 text-2xs text-warning`,children:`not logged in`})]},e.id))})]})]}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[(0,Y.jsx)(Ye,{htmlFor:`base-branch`,children:`Base branch`}),(0,Y.jsx)(Je,{id:`base-branch`,placeholder:ce?.default_base_branch??`main`,value:x,onValueChange:C,hints:(le.data?.branches??[]).filter(e=>e.name.toLowerCase().includes(x.trim().toLowerCase())).slice(0,20).map(e=>({value:e.name,badge:e.name===ce?.default_base_branch?`default`:e.is_session?`session: ${e.session_title??`untitled`}`:void 0})),hintsClassName:`w-max min-w-full max-w-[36rem]`})]}),T&&(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[(0,Y.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,Y.jsx)(Ye,{htmlFor:`session-branch`,children:`New branch`}),(0,Y.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`optional`})]}),(0,Y.jsx)(He,{id:`session-branch`,placeholder:`leave blank for auto`,value:ee,onChange:e=>A(e.target.value)})]})]}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(rn,{id:`separate-branch`,checked:T,onCheckedChange:e=>{E(e),e&&k(!0)}}),(0,Y.jsx)(Ye,{htmlFor:`separate-branch`,children:`Use separate branch`})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(rn,{id:`separate-worktree`,checked:T?!0:O,disabled:T,onCheckedChange:k}),(0,Y.jsx)(Ye,{htmlFor:`separate-worktree`,className:a(T&&`text-fg-muted`),children:`Use separate directory`})]})]}),B&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Y.jsx)(Ye,{htmlFor:`join-dir`,children:`Directory to join`}),pe.length===0?(0,Y.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[`No existing directory on`,` `,(0,Y.jsx)(`span`,{className:`text-fg-secondary`,children:fe||`…`}),` — a shared one will be created for later sessions to join.`]}):(0,Y.jsxs)(It,{value:he,onValueChange:te,children:[(0,Y.jsx)(Pt,{id:`join-dir`,children:(0,Y.jsx)(Lt,{})}),(0,Y.jsx)(Rt,{children:pe.map(e=>(0,Y.jsx)(Ft,{value:e.path,title:e.path,detail:(0,Y.jsx)(`span`,{className:`ml-auto min-w-0 truncate text-2xs text-fg-muted`,children:Ms(e.path,h.data?.home)}),children:e.label},e.path))})]})]}),!T&&!c&&(0,Y.jsxs)(`p`,{className:`text-xs text-warning`,children:[`The `,c?`shell`:`agent`,` commits straight to`,` `,(0,Y.jsx)(`span`,{children:fe||`…`}),B?` and shares its working directory with concurrent sessions — they can trample each other’s edits.`:`.`]}),z&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md bg-surface px-3 py-2`,children:[(0,Y.jsx)(rn,{id:`skip-permissions`,checked:re,onCheckedChange:ae}),(0,Y.jsx)(Ye,{htmlFor:`skip-permissions`,className:`text-warning`,children:`Skip permission prompts for this session`})]}),P&&(0,Y.jsx)(`p`,{className:`text-xs text-danger`,children:P}),(0,Y.jsxs)(Pe,{children:[(0,Y.jsx)(V,{type:`button`,variant:`ghost`,onClick:()=>o(!1),children:`Cancel`}),(0,Y.jsx)(V,{type:`submit`,disabled:!c&&!_e||g.isPending,children:c?`Open terminal`:`Start agent`})]})]})]})})}function wl({projects:e,value:t,onChange:n}){let r=e.find(e=>e.id===t)?.name??`this project`;return e.length<2?(0,Y.jsx)(`span`,{className:`text-fg-secondary`,children:r}):(0,Y.jsxs)(ol,{children:[(0,Y.jsx)(sl,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,title:`Choose the project`,className:`inline-flex items-center gap-0.5 text-fg-secondary transition-colors hover:text-fg`,children:[r,(0,Y.jsx)(Bt,{className:`size-3 shrink-0`})]})}),(0,Y.jsx)(ll,{align:`start`,children:e.map(e=>(0,Y.jsx)(ul,{onSelect:()=>n(e.id),className:a(`truncate`,e.id===t&&`text-fg`),children:e.name},e.id))})]})}var Tl=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function El(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function Dl(e){return`nodeType`in e}function Ol(e){return e?El(e)?e:Dl(e)?e.ownerDocument?.defaultView??window:window:window}function kl(e){let{Document:t}=Ol(e);return e instanceof t}function Al(e){return!El(e)&&e instanceof Ol(e).HTMLElement}function jl(e){return e instanceof Ol(e).SVGElement}function Ml(e){return e?El(e)?e.document:Dl(e)?kl(e)?e:Al(e)||jl(e)?e.ownerDocument:document:document:document}var Nl=Tl?X.useLayoutEffect:X.useEffect;function Pl(e){let t=(0,X.useRef)(e);return Nl(()=>{t.current=e}),(0,X.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function Fl(){let e=(0,X.useRef)(null);return[(0,X.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,X.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function Il(e,t){t===void 0&&(t=[e]);let n=(0,X.useRef)(e);return Nl(()=>{n.current!==e&&(n.current=e)},t),n}function Ll(e,t){let n=(0,X.useRef)();return(0,X.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function Rl(e){let t=Pl(e),n=(0,X.useRef)(null);return[n,(0,X.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function zl(e){let t=(0,X.useRef)();return(0,X.useEffect)(()=>{t.current=e},[e]),t.current}var Bl={};function Vl(e,t){return(0,X.useMemo)(()=>{if(t)return t;let n=Bl[e]==null?0:Bl[e]+1;return Bl[e]=n,e+`-`+n},[e,t])}function Hl(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var Ul=Hl(1),Wl=Hl(-1);function Gl(e){return`clientX`in e&&`clientY`in e}function Kl(e){if(!e)return!1;let{KeyboardEvent:t}=Ol(e.target);return t&&e instanceof t}function ql(e){if(!e)return!1;let{TouchEvent:t}=Ol(e.target);return t&&e instanceof t}function Jl(e){if(ql(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Gl(e)?{x:e.clientX,y:e.clientY}:null}var Yl=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[Yl.Translate.toString(e),Yl.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),Xl=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function Zl(e){return e.matches(Xl)?e:e.querySelector(Xl)}var Ql={display:`none`};function $l(e){let{id:t,value:n}=e;return X.createElement(`div`,{id:t,style:Ql},n)}function eu(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return X.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function tu(){let[e,t]=(0,X.useState)(``);return{announce:(0,X.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var nu=(0,X.createContext)(null);function ru(e){let t=(0,X.useContext)(nu);(0,X.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function iu(){let[e]=(0,X.useState)(()=>new Set),t=(0,X.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,X.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var au={draggable:`
|
|
4
4
|
To pick up a draggable item, press the space bar.
|
|
5
5
|
While dragging, use the arrow keys to move the item.
|