@vibelet/cli 1.2.186 → 1.2.191

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.
Files changed (30) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/inventory-scan-worker.cjs +1 -1
  3. package/dist/runtime-version.cjs +1 -1
  4. package/dist/tailcat/vibelet-tailcat-darwin-amd64 +0 -0
  5. package/dist/tailcat/vibelet-tailcat-darwin-arm64 +0 -0
  6. package/dist/tailcat/vibelet-tailcat-linux-amd64 +0 -0
  7. package/dist/tailcat/vibelet-tailcat-linux-arm64 +0 -0
  8. package/dist/tailcat/vibelet-tailcat-win32-amd64.exe +0 -0
  9. package/dist/tailcat/vibelet-tailcat-win32-arm64.exe +0 -0
  10. package/dist/vibelet.mjs +168 -142
  11. package/dist/web/assets/App-DASv9GGS.js +12 -0
  12. package/dist/web/assets/{ArchiveSyncPanel-BmuZbCNC.js → ArchiveSyncPanel-BcKfVT49.js} +1 -1
  13. package/dist/web/assets/{ConnectionSettingsPanel-CBCsJpl3.js → ConnectionSettingsPanel-DQBEBng6.js} +1 -1
  14. package/dist/web/assets/{DaemonSettingsPanel-BvwnLOlI.js → DaemonSettingsPanel-BBVWzRl3.js} +1 -1
  15. package/dist/web/assets/{DiffDrawer-D1KuAQR4.js → DiffDrawer-CdTSA2mo.js} +1 -1
  16. package/dist/web/assets/{FilesControlPanel-zSRq3nW9.js → FilesControlPanel-HIuHTgVJ.js} +2 -2
  17. package/dist/web/assets/LanguageSettingsPanel-jIZ0c8Pt.js +1 -0
  18. package/dist/web/assets/{NotificationSettingsPanel-B1B7EVaN.js → NotificationSettingsPanel-DcZxLYYl.js} +1 -1
  19. package/dist/web/assets/{SavedTargetsPanel-rIXNVgWc.js → SavedTargetsPanel-DWDhYuUH.js} +1 -1
  20. package/dist/web/assets/{ThemeSettingsPanel-qeXJXo6p.js → ThemeSettingsPanel-na6n39Ea.js} +1 -1
  21. package/dist/web/assets/{file-text-BvyZLKIE.js → file-text-D0U66V5d.js} +1 -1
  22. package/dist/web/assets/{highlighted-body-TPN3WLV5-BpBsGeHz.js → highlighted-body-TPN3WLV5-WUXG77Uc.js} +1 -1
  23. package/dist/web/assets/{index-C912jm0R.js → index-9EF9r07v.js} +1 -1
  24. package/dist/web/assets/index-Bh-D235e.css +1 -0
  25. package/dist/web/assets/{mermaid-O7DHMXV3-B2G14y_6.js → mermaid-O7DHMXV3-C6asakbE.js} +3 -3
  26. package/dist/web/index.html +2 -2
  27. package/package.json +1 -1
  28. package/dist/web/assets/App-CnoeNagf.js +0 -11
  29. package/dist/web/assets/LanguageSettingsPanel-BynXGit2.js +0 -1
  30. package/dist/web/assets/index-CscvgG9H.css +0 -1
@@ -9,8 +9,8 @@
9
9
  <link rel="manifest" href="/web/manifest.webmanifest" />
10
10
  <link rel="icon" type="image/svg+xml" href="/web/icon.svg" />
11
11
  <title>Vibelet Web</title>
12
- <script type="module" crossorigin src="/web/assets/index-C912jm0R.js"></script>
13
- <link rel="stylesheet" crossorigin href="/web/assets/index-CscvgG9H.css">
12
+ <script type="module" crossorigin src="/web/assets/index-9EF9r07v.js"></script>
13
+ <link rel="stylesheet" crossorigin href="/web/assets/index-Bh-D235e.css">
14
14
  </head>
15
15
  <body>
16
16
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibelet/cli",
3
- "version": "1.2.186",
3
+ "version": "1.2.191",
4
4
  "description": "Cross-platform CLI for installing and running the Vibelet daemon",
5
5
  "homepage": "https://vibelet.icu",
6
6
  "files": [
@@ -1,11 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid-O7DHMXV3-B2G14y_6.js","assets/index-C912jm0R.js","assets/index-CscvgG9H.css","assets/mermaid-O7DHMXV3-BPtfCfol.css","assets/FilesControlPanel-zSRq3nW9.js","assets/file-text-BvyZLKIE.js","assets/ArchiveSyncPanel-BmuZbCNC.js","assets/ConnectionSettingsPanel-CBCsJpl3.js","assets/DaemonSettingsPanel-BvwnLOlI.js","assets/LanguageSettingsPanel-BynXGit2.js","assets/ThemeSettingsPanel-qeXJXo6p.js","assets/NotificationSettingsPanel-B1B7EVaN.js","assets/SavedTargetsPanel-rIXNVgWc.js","assets/DiffDrawer-D1KuAQR4.js"])))=>i.map(i=>d[i]);
2
- import{c as F,r as o,j as s,E as tr,_ as Ye,D as sa,a as ra,p as ia,s as aa,b as Lt,d as oa,e as ca,l as la,W as Cs,f as Ns,g as da,h as ua,i as fa}from"./index-C912jm0R.js";const ha=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],Vn=F("archive",ha);const ma=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],pa=F("arrow-down",ma);const ga=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],ya=F("arrow-up",ga);const ba=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],xa=F("bot",ba);const Sa=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],nt=F("check",Sa);const va=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],wa=F("chevron-right",va);const ka=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],ja=F("chevron-up",ka);const Ca=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],Na=F("circle-dot",Ca);const Ia=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]],Ra=F("clipboard",Ia);const Aa=[["path",{d:"M12 6v6h4",key:"135r8i"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],nr=F("clock-3",Aa);const Ta=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],Ea=F("code-xml",Ta);const Ma=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Nt=F("copy",Ma);const Da=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],Is=F("corner-down-left",Da);const _a=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],Dn=F("cpu",_a);const Pa=[["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"}]],sr=F("ellipsis",Pa);const Fa=[["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"}]],$a=F("eye",Fa);const La=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Ct=F("folder-open",La);const Oa=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["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"}]],qa=F("folder-plus",Oa);const Ba=[["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"}]],rr=F("folder",Ba);const Ha=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],Wa=F("funnel",Ha);const za=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],Je=F("gauge",za);const Ua=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["path",{d:"M11 18H8a2 2 0 0 1-2-2V9",key:"19pyzm"}]],ir=F("git-compare",Ua);const Ga=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],Va=F("hash",Ga);const Ka=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],ar=F("info",Ka);const Qa=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],Ja=F("key-round",Qa);const Ya=[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]],Za=F("keyboard",Ya);const Xa=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],fn=F("loader-circle",Xa);const eo=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],to=F("message-circle",eo);const no=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],or=F("panel-left",no);const so=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]],cr=F("panel-right",so);const ro=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],Kn=F("paperclip",ro);const io=[["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"}]],bn=F("pin",io);const ao=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Qn=F("plus",ao);const oo=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Vt=F("refresh-cw",oo);const co=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],lo=F("rotate-ccw",co);const uo=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Jn=F("search",uo);const fo=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],ho=F("settings",fo);const mo=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],xn=F("shield-check",mo);const po=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],lr=F("sliders-horizontal",po);const go=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],yo=F("sparkles",go);const bo=[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],Yn=F("square-terminal",bo);const xo=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],So=F("square",xo);const vo=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],dr=F("tag",vo);const wo=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Zn=F("terminal",wo);const ko=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],jo=F("trash-2",ko);const Co=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],No=F("wrench",Co);const Io=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],we=F("x",Io);const Ro=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Ht=F("zap",Ro),Ao=".",To="@vibelet/needs-attention",Eo="@vibelet/running",Mo="@vibelet/pinned";function Do(e,t={}){const n=new Map,r=[],i=[],a=[];for(const c of e){const m=c.archived!==!0;if(!!(t.showNeedsAttentionGroup&&m&&(t.needsAttentionSessionIds?.has(c.sessionId)||c.runtime.needsAttention||c.interruptReason||c.stallWarning))?r.push(c):t.showRunningGroup&&m&&t.respondingSessionIds?.has(c.sessionId)&&i.push(c),t.separatePinnedGroup&&m&&c.pinned){a.push(c);continue}const y=c.cwd||Ao;n.set(y,[...n.get(y)??[],c])}const l=[];return r.length>0&&l.push({folder:To,kind:"attention",sessions:r}),i.length>0&&l.push({folder:Eo,kind:"running",sessions:i}),a.length>0&&l.push({folder:Mo,kind:"pinned",sessions:[...a].sort((c,m)=>Date.parse(m.lastActivityAt)-Date.parse(c.lastActivityAt))}),[...l,...Array.from(n.entries()).map(([c,m])=>({folder:c,kind:"folder",sessions:m}))]}function ur(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e;return typeof t.lastActivityAt=="string"&&typeof t.sessionId=="string"?{lastActivityAt:t.lastActivityAt,sessionId:t.sessionId}:void 0}const Be=".",qn="normal",_o=80,Po=1600,fr="vibelet.web.notificationSettings",Fo="pending_local_",lt={enabled:!1,approvals:!0,questions:!0,replies:!0,hiddenOnly:!0};function Wt(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Xn(e,t=Date.now()){if(!e)return"unknown";const n=Date.parse(e);if(!Number.isFinite(n))return e;const r=t-n,i=60*1e3,a=60*i,l=24*a;return r<i?"now":r<a?`${Math.floor(r/i)}m ago`:r<l?`${Math.floor(r/a)}h ago`:`${Math.floor(r/l)}d ago`}function $o(e){if(!Number.isFinite(e))return"unknown";const t=e??0;return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function We(e){return e.customTitle||e.title||e.sessionId.slice(0,10)}function es(e,t){const n=e[e.length-1];return n?.role==="assistant"&&n.type!=="info"?[...e.slice(0,-1),{...n,content:`${n.content}${t}`}]:[...e,{role:"assistant",content:t,timestamp:new Date().toISOString()}]}function hr(e){const t=e;return{sessions:Array.isArray(t.sessions)?t.sessions:[],nextCursor:ur(t.nextCursor),inventoryVersion:t.inventoryVersion,inventoryBackfillInFlight:t.inventoryBackfillInFlight,folderCounts:t.folderCounts}}function Lo(e){const t=e;return typeof t.sessionId=="string"?t.sessionId:null}function Oo(e){const t=e;return typeof t.path=="string"?t.path:null}function Sn(e){return e.split("/").filter(Boolean).at(-1)??e}function mr(e){return Object.entries(e).length===0?"No structured input.":JSON.stringify(e,null,2)}function Bn(e){return Object.fromEntries(e.questions.map(t=>[t.id,t.options[0]?[t.options[0].label]:[]]))}function ln(e){return e.trim()||void 0}function Rs(e){if(e==="7d")return Date.now()-7*864e5;if(e==="30d")return Date.now()-30*864e5;if(e==="90d")return Date.now()-90*864e5}function gn(e,t){const n=new Map;for(const r of e)n.set(r.sessionId,r);for(const r of t)n.set(r.sessionId,{...n.get(r.sessionId),...r});return Array.from(n.values()).sort((r,i)=>{const a=r.pinned?r.pinnedAt??0:0,l=i.pinned?i.pinnedAt??0:0;return a!==l?l-a:Date.parse(i.lastActivityAt)-Date.parse(r.lastActivityAt)})}let _n=0;function qo(e=Date.now()){return _n=(_n+1)%1e4,`${Fo}${e}_${_n}`}function Bo(e){const t=e.now??new Date().toISOString();return{sessionId:e.sessionId,agent:e.agent,cwd:e.cwd||Be,...e.model?{model:e.model}:{},...e.effort?{effort:e.effort}:{},fastMode:e.fastMode??!1,...e.title?{title:e.title}:{},createdAt:t,lastActivityAt:t,sources:["daemon"],runtime:{state:"daemonActive",confidence:"high",resumeMode:"reuseDriver"},managed:!0,approvalMode:e.approvalMode}}function Ho(e,t,n=new Date().toISOString()){return{...e,sessionId:t,lastActivityAt:n}}function Pn(e,t,n){if(!t||!n||t===n||!Object.hasOwn(e,t))return e;const{[t]:r,...i}=e;return{...i,[n]:r}}function As(e,t,n){if(!t||!n||t===n||!e.has(t))return e;const r=new Set(e);return r.delete(t),r.add(n),r}function Hn(e,t){const n=e.replace(/\\/g,"/").replace(/\/+$/,"");return!n||n==="."?t:`${n}/${t}`}function Ts(e){const t=e.replace(/\\/g,"/").replace(/\/+$/,"");if(!t||t==="/"||t==="~"||t===".")return null;const n=t.lastIndexOf("/");return n<0?".":n===0?"/":t.slice(0,n)}function Wo(e,t){return t.startsWith("text/")||t.includes("json")||t.includes("xml")||t.includes("javascript")?!0:/\.(md|txt|json|ya?ml|toml|csv|log|ts|tsx|js|jsx|css|html|xml|py|rb|go|rs|java|kt|swift|sh|zsh|bash)$/i.test(e)}function zo(e,t){return t.startsWith("image/")||/\.(png|jpe?g|gif|webp|heic|heif|svg)$/i.test(e)}function Fn(e,t,n=window.location.origin){const r=new URL("/file",n);return r.searchParams.set("path",e),t&&r.searchParams.set("cwd",t),r.toString()}function dn(e,t){return e.get(t)||void 0}function Uo(e,t){return`${e.replace(/[<>:"/\\|?*\u0000-\u001F]/g," ").replace(/\s+/g," ").trim().slice(0,80)||t.slice(0,12)||"session"}.txt`}function Go(e,t){const n=[`# ${We(e)}`,"",`- Agent: ${e.agent}`,`- Session: \`${e.sessionId}\``,`- Working directory: \`${e.cwd}\``,`- Created: ${e.createdAt}`,`- Exported: ${new Date().toISOString()}`,""];for(const r of t){if(r.role!=="user"&&r.role!=="assistant")continue;const i=r.content.trim(),a=(r.images??[]).map(l=>`- Attachment: \`${l}\``);!i&&a.length===0||(n.push(`## ${r.role==="user"?"User":"Assistant"}`,""),i&&n.push(i,""),a.length&&n.push(...a,""))}return n.join(`
3
- `).trimEnd()}function pr(e){const t=[`cd ${Vo(e.cwd||Be)} &&`],n=e.approvalMode??e.observedApprovalMode;return e.agent==="claude"?(t.push("claude","--resume",e.sessionId),n==="autoApprove"?t.push("--dangerously-skip-permissions"):n==="acceptEdits"&&t.push("--permission-mode","acceptEdits"),t.join(" ")):(t.push("codex","resume",e.sessionId),n==="autoApprove"&&t.push("--dangerously-bypass-approvals-and-sandbox"),t.join(" "))}function Vo(e){return/^[a-zA-Z0-9._/~-]+$/.test(e)?e:`'${e.replace(/'/g,"'\\''")}'`}function Ko(e,t){const n=URL.createObjectURL(new Blob([t],{type:"text/plain;charset=utf-8"})),r=document.createElement("a");r.href=n,r.download=e,r.click(),URL.revokeObjectURL(n)}function Qo(e=window.localStorage){try{const t=e.getItem(fr);if(!t)return{...lt};const n=JSON.parse(t);return Wt(n)?{enabled:typeof n.enabled=="boolean"?n.enabled:lt.enabled,approvals:typeof n.approvals=="boolean"?n.approvals:lt.approvals,questions:typeof n.questions=="boolean"?n.questions:lt.questions,replies:typeof n.replies=="boolean"?n.replies:lt.replies,hiddenOnly:typeof n.hiddenOnly=="boolean"?n.hiddenOnly:lt.hiddenOnly}:{...lt}}catch{return{...lt}}}function Jo(e,t=window.localStorage){t.setItem(fr,JSON.stringify(e))}function Wn(e=typeof Notification>"u"?void 0:Notification){return e?.permission??"unsupported"}function Yo(e,t,n=typeof document>"u"?"visible":document.visibilityState){return!(!e.enabled||t!=="granted"||e.hiddenOnly&&n==="visible")}function Zo(e,t,n={}){const r=n.notificationFactory??(typeof Notification>"u"?void 0:Notification);if(!r)return!1;const i=n.settings??{enabled:!0,hiddenOnly:!1},a=n.permission??Wn(),l=n.visibilityState??(typeof document>"u"?"visible":document.visibilityState);if(!Yo(i,a,l))return!1;const c=new r(e,{body:t,tag:n.tag});return n.onClick&&(c.onclick=n.onClick),!0}function Xo(e,t={}){const n=new Set,r={},i={},a={};for(const S of e.sessions)(S.runtime.isResponding||S.runtime.state==="daemonActive")&&n.add(S.sessionId);for(const S of e.pendingApprovals??[])r[S.sessionId]={type:"approval.request",...S};for(const S of e.pendingQuestions??[])i[S.sessionId]={type:"question.request",...S};let l=null,c,m,f,y,v,p;if(e.activeSession){const S=e.activeSession,I=e.sessions.find(d=>d.sessionId===S.sessionId);l=S.sessionId,c=S.agent,m=I?.cwd||t.currentCwd||Be,f=S.approvalMode??I?.approvalMode??qn,y=S.approvalMode??null;const b=S.messages??[];if(v=S.partialReplyText?es(b,S.partialReplyText):b,(S.isResponding||S.externallyResponding)&&n.add(S.sessionId),S.pendingApproval&&(r[S.sessionId]={type:"approval.request",sessionId:S.sessionId,...S.pendingApproval}),S.pendingQuestion){const d={type:"question.request",sessionId:S.sessionId,...S.pendingQuestion};i[S.sessionId]=d,p=Bn(d)}S.pendingQueue?.length&&(a[S.sessionId]=S.pendingQueue)}else{const S=t.currentActiveSessionId??null;if(S){const I=e.sessionAliases?.[S];I?l=I:e.sessions.some(b=>b.sessionId===S)&&(l=S)}l=l??e.sessions[0]?.sessionId??null}return{page:{sessions:e.sessions,nextCursor:ur(e.nextCursor),inventoryVersion:e.inventoryVersion,inventoryBackfillInFlight:e.inventoryBackfillInFlight},activeSessionId:l,activeAgent:c,activeCwd:m,activeApprovalMode:f,activeApprovalOverride:y,messages:v,respondingSessionIds:Array.from(n),pendingApprovals:r,pendingQuestions:i,pendingQueues:a,questionAnswers:p}}function zt(e,t=n=>window.confirm(n)){return t(`${e}
4
-
5
- This action cannot be undone from Vibelet Web.`)}function Es(e,t){return e==="subscriptionRequired"?t?"Agent skills require an active Pro subscription.":"Terminal takeover requires an active Pro subscription.":e==="skillNotFound"?"Skill not found on the paired computer.":e==="skillResolveFailed"?"Could not load the skill on the paired computer.":e}function ec({activeSession:e,busy:t,controlsOpen:n,pendingActionsCount:r,t:i,onOpenControls:a,onRefreshSessions:l,onRestoreSnapshot:c,onToggleArchived:m,onTogglePinned:f,onViewChanges:y}){const[v,p]=o.useState(!1),S=o.useRef(null);o.useEffect(()=>{if(!v)return;const b=w=>{w.target instanceof Node&&!S.current?.contains(w.target)&&p(!1)},d=w=>{w.key==="Escape"&&p(!1)};return document.addEventListener("pointerdown",b),document.addEventListener("keydown",d),()=>{document.removeEventListener("pointerdown",b),document.removeEventListener("keydown",d)}},[v]);const I=b=>{p(!1),b()};return s.jsxs("div",{className:"header-actions",children:[e?null:s.jsx("button",{"aria-label":i.refreshSessions,className:"icon-button",onClick:l,title:i.refreshSessions,type:"button",children:s.jsx(Vt,{"aria-hidden":"true"})}),s.jsxs("button",{"aria-expanded":n,"aria-label":r>0?`${i.workspaceTools}, ${r} ${i.pendingActions}`:i.workspaceTools,className:`header-tool-button ${n?"selected":""}`,onClick:a,type:"button",children:[s.jsx(cr,{"aria-hidden":"true"}),s.jsx("span",{children:i.workspaceTools}),r>0?s.jsx("strong",{"aria-hidden":"true",children:r}):null]}),e?s.jsxs("div",{className:"header-more-wrap",ref:S,children:[s.jsx("button",{"aria-expanded":v,"aria-haspopup":"menu","aria-label":i.moreActions,className:"icon-button",onClick:()=>p(b=>!b),title:i.moreActions,type:"button",children:s.jsx(sr,{"aria-hidden":"true"})}),v?s.jsxs("div",{className:"header-action-menu",role:"menu",children:[s.jsxs("button",{onClick:()=>I(()=>y(e.sessionId)),role:"menuitem",type:"button",children:[s.jsx(ir,{"aria-hidden":"true"}),s.jsx("span",{children:i.viewChanges})]}),s.jsxs("button",{disabled:t,onClick:()=>I(f),role:"menuitem",type:"button",children:[s.jsx(bn,{"aria-hidden":"true"}),s.jsx("span",{children:e.pinned?i.unpin:i.pin})]}),s.jsxs("button",{disabled:t,onClick:()=>I(m),role:"menuitem",type:"button",children:[s.jsx(Vn,{"aria-hidden":"true"}),s.jsx("span",{children:e.archived?i.unarchive:i.archive})]}),s.jsxs("button",{onClick:()=>I(c),role:"menuitem",type:"button",children:[s.jsx(lo,{"aria-hidden":"true"}),s.jsx("span",{children:i.restoreSnapshot})]}),s.jsxs("button",{onClick:()=>I(l),role:"menuitem",type:"button",children:[s.jsx(Vt,{"aria-hidden":"true"}),s.jsx("span",{children:i.refreshSessions})]})]}):null]}):null]})}const tc=/^[A-Za-z][A-Za-z0-9_-]*$/,nc=[{name:"clear",commandName:"clear",title:"Clear session",description:"Clear this session in place.",source:"Vibelet",agents:["claude","codex"],argsHint:""},{name:"new",commandName:"new",title:"New session",description:"Start a fresh session with the same assistant and directory.",source:"Vibelet",agents:["claude","codex"],argsHint:""},{name:"exit",commandName:"exit",title:"Archive session",description:"Archive this session and return to the session list.",source:"Vibelet",agents:["claude","codex"],argsHint:""},{name:"quit",commandName:"exit",title:"Archive session",description:"Alias for /exit.",source:"Vibelet",agents:["claude","codex"],argsHint:""},{name:"q",commandName:"exit",title:"Archive session",description:"Alias for /exit.",source:"Vibelet",agents:["claude","codex"],argsHint:""},{name:"compact",commandName:"compact",title:"Compact context",description:"Ask the assistant runtime to compact the current session.",source:"Native",agents:["claude","codex"],argsHint:""},{name:"goal",commandName:"goal",title:"Goal",description:"View, set, pause, resume, or clear the current goal.",source:"Native",agents:["claude","codex"],argsHint:"[objective|status|pause|resume|clear]"}];function gr(e){return nc.filter(t=>!e||t.agents.includes(e))}function ts(e){return e.trim().toLowerCase()}function hn(e){if(!e.startsWith("/")||e.startsWith("//"))return null;const t=/^\/([A-Za-z0-9_-]*)$/.exec(e);if(!t)return null;const n=t[1]??"";return n&&!tc.test(n)?null:{start:0,end:e.length,keyword:ts(n)}}function sc(e,t,n=8){const r=ts(t);return(r?e.filter(a=>a.name.includes(r)||a.title.toLowerCase().includes(r)).sort((a,l)=>Ms(a,r)-Ms(l,r)):[...e]).slice(0,n)}function Ms(e,t){return e.name===t?0:e.name.startsWith(t)?1:e.name.includes(t)?2:3}function rc(e,t,n){return`${e.slice(0,t.start)}${yr(n,"")}${e.slice(t.end)}`}function ic(e,t,n){return t?rc(e,t,n):`${yr(n,e)}${e}`}function yr(e,t){const n=t.length>0,r=n&&!/^\s/.test(t),i=!!(e.argsHint&&!n);return`/${e.name}${i||r?" ":""}`}function ac(e,t){const n=e.trim();if(!n.startsWith("/")||n.startsWith("//"))return null;const r=/^\/([A-Za-z][A-Za-z0-9_-]*)(?:\s+([\s\S]*))?$/.exec(n);if(!r)return null;const i=ts(r[1]??""),a=gr(t).find(c=>c.name===i);if(!a)return null;const l=r[2]?.trim()??"";switch(a.commandName){case"clear":return{raw:n,command:{name:"clear"}};case"new":return{raw:n,command:{name:"new"}};case"exit":return{raw:n,command:{name:"exit"}};case"compact":return{raw:n,command:{name:"compact"}};case"goal":{const c=l.toLowerCase();return!l||c==="status"||c==="show"||c==="usage"||c==="help"?{raw:n,command:{name:"goal",operation:"status"}}:c==="clear"||c==="reset"?{raw:n,command:{name:"goal",operation:"clear"}}:c==="pause"||c==="paused"?{raw:n,command:{name:"goal",operation:"pause"}}:c==="resume"||c==="active"?{raw:n,command:{name:"goal",operation:"resume"}}:{raw:n,command:{name:"goal",operation:"set",objective:l}}}}}function oc(e){return e.startsWith("//")?e.slice(1):e}function cc(e){return e.name==="compact"?"/compact":e.name!=="goal"?null:e.operation==="clear"?"/goal clear":e.operation==="pause"?"/goal pause":e.operation==="resume"?"/goal resume":e.operation==="set"&&e.objective?.trim()?`/goal ${e.objective.trim()}`:"/goal"}function lc(e){const t=typeof e?.objective=="string"?e.objective.trim():"";return t?`Goal${typeof e?.status=="string"&&e.status?` (${e.status})`:""}: ${t}`:"Goal: none."}function Ds(e){return e==="subscriptionRequired"?"Error: Agent commands require an active Pro subscription.":`Error: ${e||"Command failed."}`}function dc(e,t){return!t||!hn(e)?e:t.draftBeforeInsertion}const uc=/^[A-Za-z_][A-Za-z0-9._:-]*$/,fc=/(?:^|\s)\$([A-Za-z_][A-Za-z0-9._:-]*|)$/;function Kt(e){return e.trim().toLowerCase()}function hc(e){const t=e.trim(),n=/^\$([A-Za-z_][A-Za-z0-9._:-]*)(?:\s+([\s\S]*))?$/.exec(t);return n?{name:Kt(n[1]??""),...n[2]?.trim()?{args:n[2].trim()}:{}}:null}function mn(e){const t=fc.exec(e);if(!t||t.index+t[0].length!==e.length)return null;const n=t[1]??"";if(n&&!uc.test(n))return null;const r=t[0].lastIndexOf("$");return{start:t.index+r,end:e.length,keyword:Kt(n)}}function mc(e,t,n){return`${e.slice(0,t.start)}$${Kt(n)} ${e.slice(t.end)}`}function pc(e,t){if(!t)return e;const n=mn(e);if(!n||n.start!==t.triggerStart)return e;const r=n.start>t.draftBeforeInsertion.length?" ":"";return e.slice(0,n.start)!==`${t.draftBeforeInsertion}${r}`?e:t.draftBeforeInsertion}function gc(e,t,n=8){const r=Kt(t);return(r?e.filter(a=>Kt(a.name).includes(r)):e).slice(0,n)}function Ot({icon:e,label:t,menuLabel:n,options:r,value:i,onSelect:a,align:l="left",disabled:c,selected:m,wide:f}){const[y,v]=o.useState(!1);return s.jsxs("div",{className:"composer-menu",onBlur:p=>{const S=p.relatedTarget;(!S||!p.currentTarget.contains(S))&&v(!1)},onKeyDown:p=>{p.key==="Escape"&&v(!1)},children:[s.jsxs("button",{"aria-expanded":y,"aria-haspopup":"menu",className:`composer-option-button ${y||m?"selected":""}`,disabled:c,onClick:()=>v(p=>!p),title:n,type:"button",children:[s.jsx(e,{"aria-hidden":"true"}),s.jsx("span",{children:t}),s.jsx(ja,{"aria-hidden":"true"})]}),y?s.jsx("div",{"aria-label":n,className:`composer-option-popover ${f?"wide":""} ${l==="right"?"align-right":""}`,role:"menu",children:r.map(p=>{const S=p.icon,I=p.value===i;return s.jsxs("button",{"aria-checked":I,className:I?"selected":"",disabled:p.disabled,onClick:()=>{a(p.value),v(!1)},role:"menuitemradio",title:p.description??p.label,type:"button",children:[s.jsx("span",{className:"composer-menu-icon",children:S?s.jsx(S,{"aria-hidden":"true"}):I?s.jsx(nt,{"aria-hidden":"true"}):null}),s.jsxs("span",{children:[s.jsx("strong",{children:p.label}),p.description?s.jsx("small",{children:p.description}):null]}),I?s.jsx(nt,{className:"composer-menu-check","aria-hidden":"true"}):null]},p.value)})}):null]})}function yc({visible:e,skills:t,onClose:n,onSelect:r,t:i}){return e?s.jsxs("div",{className:"skill-suggestion-popover",children:[s.jsxs("header",{children:[s.jsx("strong",{children:i.skills}),s.jsx("button",{type:"button",className:"icon-button",onClick:n,title:i.closeSkills,children:s.jsx(we,{"aria-hidden":"true"})})]}),t.length?s.jsx("div",{className:"skill-suggestion-list",children:t.map(a=>s.jsxs("button",{onClick:()=>r(a),title:a.description??a.name,type:"button",children:[s.jsxs("span",{children:[s.jsxs("strong",{children:["$",a.name]}),a.description?s.jsx("small",{children:a.description}):null]}),s.jsx("em",{children:a.source})]},`${a.source}:${a.name}`))}):s.jsx("p",{children:i.noSkillsFound})]}):null}function bc({visible:e,commands:t,onClose:n,onSelect:r,t:i}){return e?s.jsxs("div",{className:"skill-suggestion-popover command-suggestion-popover",children:[s.jsxs("header",{children:[s.jsx("strong",{children:i.commands}),s.jsx("button",{type:"button",className:"icon-button",onClick:n,title:i.closeCommands,children:s.jsx(we,{"aria-hidden":"true"})})]}),t.length?s.jsx("div",{className:"skill-suggestion-list",children:t.map(a=>s.jsxs("button",{onClick:()=>r(a),title:a.description,type:"button",children:[s.jsxs("span",{children:[s.jsxs("strong",{children:["/",a.name]}),s.jsx("small",{children:a.argsHint?`${a.title} ${a.argsHint}`:a.title})]}),s.jsx("em",{children:a.source})]},a.name))}):s.jsx("p",{children:i.noCommandsFound})]}):null}function xc(e){return[{value:"normal",label:e.approvalNormal,description:e.approvalNormalDescription,icon:xn},{value:"plan",label:e.approvalPlan,description:e.approvalPlanDescription,icon:lr},{value:"acceptEdits",label:e.approvalEdits,description:e.approvalEditsDescription,icon:nt},{value:"autoApprove",label:e.approvalAuto,description:e.approvalAutoDescription,icon:Ht}]}function Sc(e){return[{value:"",label:e.effort,description:e.useDaemonDefault,icon:Je},{value:"minimal",label:e.effortMinimal,icon:Je},{value:"low",label:e.effortLow,icon:Je},{value:"medium",label:e.effortMedium,icon:Je},{value:"high",label:e.effortHigh,icon:Je},{value:"xhigh",label:e.effortXHigh,icon:Je},{value:"max",label:e.effortMax,icon:Je},{value:"ultra",label:e.effortUltra,icon:Je}]}function vc({activeQueue:e,agent:t,attachments:n,approvalMode:r,activeModelOptions:i,busy:a,draft:l,effort:c,fastMode:m,model:f,phase:y,quickReplies:v,sendShortcut:p,skills:S,uploadBusy:I,t:b,onApprovalModeChange:d,onCancelQueuedTurn:w,onDraftChange:u,onEffortChange:x,onFastModeChange:M,onModelChange:g,onRefreshSkills:R,onRemoveAttachment:k,onSendShortcutChange:U,onSubmit:fe,onUploadFiles:J}){const he=o.useRef(null),se=o.useRef(null),[$,re]=o.useState(!1),[ge,je]=o.useState(!1),[D,E]=o.useState(!1),[q,P]=o.useState(!1),[ie,ye]=o.useState(""),[ze,Re]=o.useState(""),Z=o.useRef(null),X=o.useRef(null),ke=y==="connected",Me=o.useMemo(()=>gr(t),[t]),ae=o.useMemo(()=>hn(l),[l]),W=ae?`${ae.start}:${ae.end}:${ae.keyword}`:"",V=!!(q||ae&&ze!==W),K=o.useMemo(()=>sc(Me,ae?.keyword??"",8),[Me,ae?.keyword]),oe=o.useMemo(()=>mn(l),[l]),le=oe?`${oe.start}:${oe.end}:${oe.keyword}`:"",be=!!(!V&&(D||oe&&ie!==le)),xe=o.useMemo(()=>gc(S,oe?.keyword??"",8),[oe?.keyword,S]),Ae=o.useMemo(()=>xc(b),[b]),G=o.useMemo(()=>Sc(b),[b]),De=i.find(N=>N.value===f)?.label??(f||b.defaultOption),T=Ae.find(N=>N.value===r)?.label??r,Q=G.find(N=>N.value===c)?.label??c,Ue=p==="enter"?b.sendShortcutEnter:b.sendShortcutModEnter,_e=o.useMemo(()=>[{value:"enter",label:b.sendShortcutEnter,description:b.sendShortcutEnterDescription,icon:Is},{value:"modEnter",label:b.sendShortcutModEnter,description:b.sendShortcutModEnterDescription,icon:Za}],[b]),Pe=i.map(N=>({value:N.value,label:N.label,description:N.desc,icon:Dn}));Pe.some(N=>N.value==="")||Pe.unshift({value:"",label:b.defaultOption,description:b.useDaemonDefaultModel,icon:Dn}),o.useEffect(()=>{oe||(Z.current=null,ye(""),E(!1))},[oe]),o.useEffect(()=>{ae||(X.current=null,Re(""),P(!1))},[ae]);const Ce=async(N,te)=>{await J(N),te.value=""},Ge=async N=>{N.preventDefault(),re(!1),ke&&await J(N.dataTransfer.files)},Fe=async N=>{!ke||!N.clipboardData.files.length||await J(N.clipboardData.files)},Ze=()=>{const N=pc(l,Z.current);Z.current=null,N!==l&&u(N),le&&ye(le),E(!1),se.current?.focus()},Te=()=>{const N=dc(l,X.current);X.current=null,N!==l&&u(N),W&&Re(W),P(!1),se.current?.focus()},st=()=>{if(V){Te();return}Re(""),!hn(l)&&l.length===0&&(X.current={draftBeforeInsertion:l},u("/")),P(!0),se.current?.focus()},Xe=N=>{const te=hn(l),$e=ic(l,te,N);u($e),X.current=null,P(!1),Re(""),se.current?.focus()},Se=()=>{if(be){Ze();return}if(R(),ye(""),!mn(l)){const N=l.length===0||/\s$/.test(l)?"":" ";Z.current={draftBeforeInsertion:l,triggerStart:l.length+N.length},u(`${l}${N}$`)}E(!0),se.current?.focus()},et=N=>{const te=mn(l),$e=te?mc(l,te,N.name):l.trim().length?`${l}${/\s$/.test(l)?"":" "}$${N.name} `:`$${N.name} `;u($e),Z.current=null,E(!1),ye(""),se.current?.focus()},pe=N=>{N.key!=="Enter"||N.nativeEvent.isComposing||!(p==="enter"?!N.shiftKey:N.metaKey||N.ctrlKey)||(N.preventDefault(),fe())};return s.jsxs("form",{className:`composer ${$?"dragging":""}`,onDragEnter:N=>{N.preventDefault(),re(!0)},onDragLeave:()=>re(!1),onDragOver:N=>N.preventDefault(),onDrop:N=>{Ge(N)},onSubmit:N=>{fe(N)},children:[e.length?s.jsxs("div",{className:"composer-queue-banner",children:[s.jsx(nr,{"aria-hidden":"true"}),s.jsxs("div",{children:[s.jsxs("strong",{children:[e.length," queued"]}),s.jsx("span",{children:e[0]?.content??"A turn is waiting for this session."})]}),s.jsxs("button",{className:"icon-text-button",disabled:a||!e[0],onClick:()=>e[0]&&w(e[0]),type:"button",children:[s.jsx(we,{"aria-hidden":"true"}),"Withdraw"]})]}):null,ge&&v.length?s.jsx("div",{className:"quick-reply-row",children:v.slice(0,6).map(N=>s.jsx("button",{onClick:()=>u(l?`${l}
6
- ${N}`:N),type:"button",children:N},N))}):null,s.jsx(yc,{visible:be,skills:xe,onClose:Ze,onSelect:et,t:b}),s.jsx(bc,{visible:V,commands:K,onClose:Te,onSelect:Xe,t:b}),s.jsx("textarea",{ref:se,value:l,onChange:N=>u(N.target.value),onPaste:N=>{Fe(N)},onKeyDown:pe,placeholder:b.messagePlaceholder,rows:3,disabled:!ke}),s.jsxs("div",{className:"composer-toolbar",children:[s.jsxs("div",{className:"composer-leading-controls",children:[s.jsx("button",{type:"button",className:"icon-button",onClick:()=>he.current?.click(),title:b.uploadFiles,disabled:!ke||I,children:s.jsx(Qn,{"aria-hidden":"true"})}),v.length?s.jsx("button",{className:`icon-button ${ge?"selected":""}`,type:"button",title:ge?b.hideQuickReplies:b.showQuickReplies,onClick:()=>je(N=>!N),children:s.jsx(yo,{"aria-hidden":"true"})}):null,s.jsx("button",{className:`icon-button ${be?"selected":""}`,type:"button",title:b.skills,onClick:Se,disabled:!ke||I,children:s.jsx(Ht,{"aria-hidden":"true"})}),s.jsx("button",{className:`icon-button ${V?"selected":""}`,type:"button",title:b.commands,onClick:st,disabled:!ke||I,children:s.jsx(Yn,{"aria-hidden":"true"})})]}),s.jsx("input",{ref:he,type:"file",multiple:!0,hidden:!0,onChange:N=>{Ce(N.currentTarget.files,N.currentTarget)}}),s.jsxs("div",{className:"composer-control-strip",children:[s.jsx(Ot,{icon:xn,label:T,menuLabel:b.approvalMode,options:Ae,value:r,onSelect:d,wide:!0}),s.jsx(Ot,{icon:Dn,label:De,menuLabel:b.model,options:Pe,value:f,onSelect:g,align:"right",wide:!0}),s.jsx(Ot,{icon:Je,label:Q||b.effort,menuLabel:b.effort,options:G,value:c,onSelect:x,align:"right"}),s.jsx(Ot,{icon:Ht,label:m?b.fast:b.normal,menuLabel:b.fastMode,options:[{value:"off",label:b.normal,description:b.standardExecution,icon:Je},{value:"on",label:b.fast,description:b.preferFasterResponses,icon:Ht}],value:m?"on":"off",onSelect:N=>M(N==="on"),align:"right",selected:m,wide:!0}),s.jsx(Ot,{icon:Is,label:Ue,menuLabel:b.sendShortcut,options:_e,value:p,onSelect:U,align:"right",wide:!0})]}),s.jsx("button",{type:"submit",className:"send-button",disabled:!ke||a||!l.trim(),"aria-label":b.send,title:b.send,children:s.jsx(ya,{"aria-hidden":"true"})})]}),n.length||I?s.jsx("div",{className:"attachment-row",children:n.length?s.jsx("div",{className:"attachment-list",children:n.map(N=>s.jsxs("span",{children:[s.jsx(Kn,{"aria-hidden":"true"}),N.name||Sn(N.path),s.jsx("small",{children:$o(N.size)}),s.jsx("button",{type:"button",onClick:()=>k(N.path),title:b.removeAttachment,children:s.jsx(we,{"aria-hidden":"true"})})]},N.path))}):s.jsxs("span",{className:"attachment-empty",children:[s.jsx("span",{className:"loading-spinner small","aria-hidden":"true"}),b.uploading]})}):null]})}const wc=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",");function _s(e){return Array.from(e.querySelectorAll(wc)).filter(t=>!t.hidden&&t.getAttribute("aria-hidden")!=="true")}function vn(e,t,n=!0){const r=o.useRef(null),i=o.useRef(e);return i.current=e,o.useLayoutEffect(()=>{if(!n)return;const a=r.current;if(!a)return;const l=document.activeElement instanceof HTMLElement?document.activeElement:null;(t?.current??_s(a)[0]??a).focus();const m=f=>{if(f.key==="Escape"){f.preventDefault(),i.current();return}if(f.key!=="Tab")return;const y=_s(a);if(!y.length){f.preventDefault(),a.focus();return}const v=y[0],p=y.at(-1);f.shiftKey&&(document.activeElement===v||!a.contains(document.activeElement))?(f.preventDefault(),p.focus()):!f.shiftKey&&document.activeElement===p&&(f.preventDefault(),v.focus())};return document.addEventListener("keydown",m),()=>{document.removeEventListener("keydown",m),requestAnimationFrame(()=>l?.focus())}},[n,t]),r}function kc({cwd:e,paths:t,t:n,onClose:r,onOpenRemoteFile:i}){const a=o.useRef(null),l=vn(r,a,t.length>0);return t.length?s.jsxs("div",{"aria-labelledby":"attachment-preview-title","aria-modal":"true",className:"side-drawer",ref:l,role:"dialog",tabIndex:-1,children:[s.jsx("button",{className:"side-drawer-backdrop",onClick:r,type:"button","aria-label":n.closeAttachmentPreview}),s.jsxs("aside",{className:"side-drawer-panel",children:[s.jsxs("header",{className:"side-drawer-header",children:[s.jsxs("div",{children:[s.jsx("strong",{id:"attachment-preview-title",children:n.attachments}),s.jsx("span",{children:n.fileCount(t.length)})]}),s.jsx("button",{"aria-label":n.closeAttachmentPreview,className:"icon-button",onClick:r,ref:a,type:"button",children:s.jsx(we,{"aria-hidden":"true"})})]}),s.jsx("div",{className:"stack-list",children:t.map(c=>s.jsxs("button",{className:"data-row attachment-preview-row",onClick:()=>i(c,e),type:"button",children:[s.jsx(Kn,{"aria-hidden":"true"}),s.jsxs("span",{children:[s.jsx("strong",{children:Sn(c)}),s.jsx("small",{children:c})]}),s.jsx(tr,{"aria-hidden":"true"})]},c))})]})]}):null}async function jc(e){if(navigator.clipboard?.writeText){await navigator.clipboard.writeText(e);return}const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.opacity="0",document.body.append(t),t.select();const n=document.execCommand("copy");if(t.remove(),!n)throw new Error("Clipboard copy was rejected")}function Cc(e,t){const[n,r]=o.useState(null),i=o.useRef(null);return o.useEffect(()=>()=>{i.current!==null&&window.clearTimeout(i.current)},[]),{copyText:o.useCallback(async l=>{try{await jc(l),r({message:e,tone:"success"})}catch{r({message:t,tone:"error"})}i.current!==null&&window.clearTimeout(i.current),i.current=window.setTimeout(()=>r(null),2400)},[t,e]),feedback:n}}function Nc({feedback:e}){if(!e)return null;const t=e.tone==="success"?nt:we;return s.jsxs("div",{className:`copy-feedback ${e.tone}`,role:"status",children:[s.jsx(t,{"aria-hidden":"true"}),e.message]})}function Ic({message:e,retryLabel:t,onRetry:n}){return s.jsxs("div",{className:"notice error",children:[s.jsx(we,{"aria-hidden":"true"}),s.jsx("span",{children:e}),s.jsxs("button",{className:"icon-text-button",onClick:n,type:"button",children:[s.jsx(Vt,{"aria-hidden":"true"}),t]})]})}function Rc({label:e}){return s.jsxs("div",{className:"history-loading-state","aria-busy":"true","aria-label":e,role:"status",children:[s.jsx("span",{className:"loading-spinner","aria-hidden":"true"}),s.jsxs("div",{className:"history-loading-copy",children:[s.jsx("strong",{children:e}),s.jsx("span",{"aria-hidden":"true"}),s.jsx("span",{"aria-hidden":"true"}),s.jsx("span",{"aria-hidden":"true"})]})]})}function Ps({failedSend:e,onRetry:t,t:n}){const r={network:n.sendFailedNetwork,timeout:n.sendFailedTimeout,permission:n.sendFailedPermission,subscription:n.sendFailedSubscription,"missing-resource":n.sendFailedMissingResource,unknown:n.sendFailedUnknown}[e.kind];return s.jsxs("div",{className:"failed-send-notice",role:"alert",children:[s.jsx(we,{"aria-hidden":"true"}),s.jsxs("span",{children:[s.jsx("strong",{children:n.sendFailed}),r]}),s.jsxs("button",{disabled:e.retrying,onClick:t,type:"button",children:[s.jsx(Vt,{"aria-hidden":"true",className:e.retrying?"spin":void 0}),e.retrying?n.retrying:n.retrySend]})]})}function Ac({busy:e,label:t,stopLabel:n,onStop:r}){return s.jsxs("div",{className:"typing-line",role:"status",children:[s.jsx("span",{className:"typing-indicator","aria-hidden":"true"}),s.jsx("span",{children:t}),s.jsxs("button",{className:"stop-generating-button",disabled:e,onClick:r,type:"button",children:[s.jsx(So,{"aria-hidden":"true"}),n]})]})}function Tc({label:e,onClick:t}){return s.jsxs("button",{className:"scroll-latest-button",type:"button","aria-label":e,title:e,onClick:t,children:[s.jsx(pa,{"aria-hidden":"true"}),s.jsx("span",{children:e})]})}const Ec=/\u001B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g,Mc=/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F\u00AD\u061C\u180E\u200B-\u200F\u202A-\u202E\u2060-\u206F\uFEFF]/g,Dc=new Set(["","{}","[]","null","undefined",'""']);function un(e){return e.replace(/\s+/g," ").trim()}function ce(e,t){return typeof e[t]=="string"?e[t]:""}function Fs(e,t){return typeof e[t]=="number"?e[t]:void 0}function qt(e,t){return e.length<=t?e:`${e.slice(0,t)}...`}function $n(e){const t=[],n=ce(e,"file_path")||ce(e,"filePath");n&&t.push({label:"Path",value:n,isFilePath:!0});const r=Fs(e,"offset"),i=Fs(e,"limit");if(r!==void 0||i!==void 0){const a=[];r!==void 0&&a.push(`line ${r+1}`),i!==void 0&&a.push(`to ${r!==void 0?r+i:i}`),t.push({label:"Range",value:a.join(" ")})}return t}function _c(e){return typeof e!="string"?"":e.replace(/\r\n?/g,`
7
- `).replace(Ec,"").replace(Mc,"").trim()}function ns(e){const t=_c(e);return Dc.has(t)?"":t}function Pc(e){return ns(e).length>0}function ss(e){const t=ns(e);if(!t)return"";try{const n=JSON.parse(t);if(n&&typeof n=="object"&&!Array.isArray(n)){const r=typeof n.query=="string"?un(n.query):"";if(r)return r;const i=typeof n.command=="string"?un(n.command):"";if(i)return i;const a=typeof n.description=="string"?un(n.description):"";if(a)return a}}catch{}return un(t)}function Fc(e,t){if(!t)return[];switch((e??"").toLowerCase()){case"read":return $n(t);case"write":{const r=$n(t),i=ce(t,"content");return i&&r.push({label:"Content",isDiff:!0,value:"",diffNew:qt(i,500)}),r}case"edit":{const r=$n(t),i=ce(t,"old_string")||ce(t,"oldString"),a=ce(t,"new_string")||ce(t,"newString");return(i||a)&&r.push({label:"Change",isDiff:!0,value:"",diffOld:qt(i,300),diffNew:qt(a,300)}),r}case"bash":{const r=ce(t,"command");return r?[{label:"Command",value:r,isCode:!0}]:[]}case"websearch":{const r=ce(t,"query");return r?[{label:"Query",value:r}]:[]}case"webfetch":{const r=[],i=ce(t,"url");i&&r.push({label:"URL",value:i});const a=ce(t,"prompt");return a&&r.push({label:"Prompt",value:qt(a,200)}),r}case"glob":{const r=ce(t,"pattern");return r?[{label:"Pattern",value:r}]:[]}case"grep":{const r=[],i=ce(t,"pattern");i&&r.push({label:"Pattern",value:i,isCode:!0});const a=ce(t,"path");return a&&r.push({label:"In",value:a,isFilePath:!0}),r}default:{const r=[],i=ce(t,"command");if(i)return[{label:"Command",value:i,isCode:!0}];const a=ce(t,"file_path")||ce(t,"filePath");a&&r.push({label:"Path",value:a,isFilePath:!0});const l=ce(t,"description");l&&r.push({label:"Description",value:qt(l,200)});const c=ce(t,"query");c&&r.push({label:"Query",value:c});const m=ce(t,"url");return m&&r.push({label:"URL",value:m}),r}}}function $s(e){return e.role==="tool"?!0:e.type!=="info"?!1:!/^Error:/i.test(e.content.trim())}function br(e){const t=[];for(const r of e){const i=r.toolName?.trim();i&&!t.includes(i)&&t.push(i)}return t.length?t.join(", "):e.map(r=>ss(r.content)).find(Boolean)??""}function xr(e,t){return`${e.historyKey??e.timestamp??e.toolName??e.content.slice(0,24)??"message"}:${t}`}function $c(e){const t=[];for(let n=0;n<e.length;n+=1){const r=e[n];if(!$s(r)){t.push({type:"message",index:n,message:r});continue}const i=[];let a=n;for(;a<e.length&&$s(e[a]);)i.push({index:a,message:e[a]}),a+=1;t.push({type:"toolGroup",entries:i,id:`tool-group:${i.map(({index:l,message:c})=>xr(c,l)).join("|")}`}),n=a-1}return t}function Lc(e,t){return e.type==="message"?e.index===t:e.entries.some(n=>n.index===t)}function Oc({message:e,onClose:t,onCopy:n,t:r}){if(!e)return null;const i=e.content;return s.jsxs("section",{className:"message-source-inline","aria-label":r.markdownSource,children:[s.jsxs("header",{className:"inline-detail-header",children:[s.jsxs("div",{className:"inline-detail-title",children:[s.jsx("strong",{children:r.markdownSource}),s.jsx("span",{children:e.type==="info"?"info":e.role})]}),s.jsxs("div",{className:"row-actions",children:[s.jsx("button",{className:"icon-button",onClick:()=>n(i),type:"button",title:r.copyMarkdownSource,children:s.jsx(Nt,{"aria-hidden":"true"})}),s.jsx("button",{className:"icon-button",onClick:t,type:"button",title:r.closeSource,children:s.jsx(we,{"aria-hidden":"true"})})]})]}),s.jsx("pre",{className:"json-box markdown-source-box",children:i})]})}function qc({field:e}){return e.isDiff?s.jsxs("div",{className:"tool-field diff",children:[s.jsx("span",{children:e.label}),e.diffOld?s.jsxs("pre",{className:"tool-diff old",children:[s.jsx("b",{children:"-"}),e.diffOld]}):null,e.diffNew?s.jsxs("pre",{className:"tool-diff new",children:[s.jsx("b",{children:"+"}),e.diffNew]}):null]}):s.jsxs("div",{className:`tool-field ${e.isCode?"code":""} ${e.isFilePath?"path":""}`,children:[s.jsx("span",{children:e.label}),s.jsx("pre",{children:e.value})]})}function Bc({message:e,onCopy:t,t:n}){const r=Fc(e.toolName,e.toolInput),i=ss(e.content),a=ns(e.content),l=Pc(e.content)&&!r.length,c=e.toolName??n.tool;return s.jsxs("section",{className:"tool-detail-card",children:[s.jsxs("header",{children:[s.jsx("span",{className:"tool-detail-icon",children:s.jsx(Zn,{"aria-hidden":"true"})}),s.jsxs("div",{children:[s.jsx("strong",{children:c}),i?s.jsx("small",{title:i,children:i}):null]}),s.jsx("button",{className:"icon-button",onClick:()=>t(e.content),type:"button",title:n.copyOutput,children:s.jsx(Nt,{"aria-hidden":"true"})})]}),r.length?s.jsx("div",{className:"tool-fields",children:r.map((m,f)=>s.jsx(qc,{field:m},`${m.label}:${f}`))}):null,l?s.jsx("pre",{className:"json-box compact",children:a}):null]})}function Sr({messages:e,onClose:t,onCopy:n,t:r}){if(!e.length)return null;const a=e.filter(f=>f.role==="tool").length||e.length,l=r.toolCallCount(a),c=br(e),m=e.map(f=>f.content).join(`
8
-
9
- `);return s.jsxs("section",{className:"tool-inline-panel","aria-label":r.toolDetails,children:[s.jsxs("header",{className:"inline-detail-header",children:[s.jsxs("div",{className:"inline-detail-title",children:[s.jsx("strong",{children:l}),s.jsx("span",{title:c,children:c||r.toolDetail})]}),s.jsxs("div",{className:"row-actions",children:[s.jsx("button",{className:"icon-button",onClick:()=>n(m),type:"button",title:r.copyOutput,children:s.jsx(Nt,{"aria-hidden":"true"})}),s.jsx("button",{className:"icon-button",onClick:t,type:"button",title:r.closeToolDetails,children:s.jsx(we,{"aria-hidden":"true"})})]})]}),s.jsx("div",{className:"tool-detail-list",children:e.map((f,y)=>s.jsx(Bc,{message:f,onCopy:n,t:r},`${f.historyKey??f.timestamp??f.toolName??"tool"}:${y}`))})]})}const Hc=o.lazy(async()=>Ye(()=>import("./mermaid-O7DHMXV3-B2G14y_6.js").then(e=>e.a),__vite__mapDeps([0,1,2,3])).then(e=>({default:e.MessageMarkdown})));function Wc({activeMatch:e,baseCwd:t,message:n,onCopy:r,onCloseSource:i,onCloseTool:a,onOpenAttachment:l,onOpenRemoteFile:c,onToggleSource:m,onToggleTool:f,sourceOpen:y,toolOpen:v,t:p}){const S=n.role==="tool"?ss(n.content):"";return s.jsxs("article",{className:`message ${n.role} ${n.type==="info"?"info":""} ${e?"match":""}`,children:[s.jsxs("div",{className:"message-meta",children:[s.jsx("span",{children:n.type==="info"?"info":n.role}),s.jsxs("div",{className:"message-meta-side",children:[s.jsx("time",{children:Xn(n.timestamp)}),s.jsxs("div",{className:"message-actions","aria-label":p.messageActions,role:"group",children:[s.jsx("button",{"aria-label":p.copyMessage,onClick:()=>r(n.content),title:p.copyMessage,type:"button",children:s.jsx(Nt,{"aria-hidden":"true"})}),s.jsx("button",{"aria-label":p.viewMarkdownSource,"aria-expanded":y,onClick:m,title:y?p.hideMarkdownSource:p.viewMarkdownSource,type:"button",children:s.jsx(Ea,{"aria-hidden":"true"})})]})]})]}),n.role==="tool"?s.jsxs("button",{className:"tool-inline-summary","aria-expanded":v,onClick:f,type:"button",children:[s.jsxs("span",{children:[s.jsx(No,{"aria-hidden":"true"}),n.toolName??p.tool]}),S?s.jsx("small",{children:S}):null]}):n.role==="assistant"?s.jsx(o.Suspense,{fallback:s.jsx("pre",{children:n.content}),children:s.jsx(Hc,{baseCwd:t,content:n.content,onOpenRemoteFile:c})}):s.jsx("pre",{children:n.content}),n.images?.length?s.jsxs("div",{className:"message-files",children:[n.images.map(I=>s.jsxs("button",{className:"file-pill",onClick:()=>c(I,t),title:I,type:"button",children:[s.jsx(Kn,{"aria-hidden":"true"}),Sn(I)]},I)),s.jsxs("button",{className:"file-pill",onClick:()=>l(n.images??[]),type:"button",children:[s.jsx($a,{"aria-hidden":"true"}),p.preview]})]}):null,y?s.jsx(Oc,{message:n,onClose:i,onCopy:r,t:p}):null,n.role==="tool"&&v?s.jsx(Sr,{messages:[n],onClose:a,onCopy:r,t:p}):null]})}function zc({matchCount:e,query:t,onChange:n,onNext:r,t:i}){return s.jsxs("div",{className:"message-search-bar",children:[s.jsx(Jn,{"aria-hidden":"true"}),s.jsx("input",{value:t,onChange:a=>n(a.target.value),onKeyDown:a=>{a.key==="Enter"&&r()},placeholder:i.searchThisSession}),s.jsx("span",{children:t.trim()?i.messageSearchMatches(e):i.allMessages}),t?s.jsx("button",{"aria-label":i.clearMessageSearch,className:"icon-button mini-button",onClick:()=>n(""),type:"button",children:s.jsx(we,{"aria-hidden":"true"})}):null]})}function Uc({activeMatch:e,expanded:t,messages:n,onToggle:r}){const i=n.filter(c=>c.role==="tool").length||n.length,a=br(n),l=i===1?"1 tool call":`${i} tool calls`;return s.jsxs("button",{className:`tool-group-bubble ${e?"match":""} ${t?"expanded":""}`,type:"button",onClick:r,"aria-expanded":t,"aria-label":a?`${l}: ${a}`:l,children:[s.jsxs("span",{className:"tool-group-header",children:[s.jsxs("span",{className:"tool-group-title",children:[s.jsx(Zn,{"aria-hidden":"true"}),s.jsx("strong",{children:l})]}),s.jsx(wa,{className:"tool-group-chevron","aria-hidden":"true"})]}),a?s.jsx("span",{className:"tool-group-summary",children:a}):null]})}const pn=160,Gc=120;function dt(e){return Math.max(0,e-pn)}function Vc(e,t){const n=t.length,[r,i]=o.useState(()=>({sessionId:e,start:dt(n),total:n})),a=o.useMemo(()=>r.sessionId!==e?dt(n):r.total===n||n<r.total?Math.min(r.start,dt(n)):r.start+pn>=r.total?dt(n):r.start,[e,r,n]);o.useLayoutEffect(()=>{r.sessionId===e&&r.start===a&&r.total===n||i({sessionId:e,start:a,total:n})},[e,a,r,n]);const l=o.useCallback(()=>{i(y=>({sessionId:e,start:Math.max(0,(y.sessionId===e?y.start:dt(n))-Gc),total:n}))},[e,n]),c=o.useCallback(y=>{const v=t.findIndex(S=>Lc(S,y));if(v<0||v>=a&&v<a+pn)return!1;const p=Math.min(dt(n),Math.max(0,v-40));return i({sessionId:e,start:p,total:n}),!0},[t,e,a,n]),m=o.useCallback(()=>{i({sessionId:e,start:dt(n),total:n})},[e,n]),f=Math.min(n,a+pn);return{ensureMessageVisible:c,hiddenItemCount:a,hiddenLaterItemCount:Math.max(0,n-f),revealEarlier:l,revealLatest:m,visibleItems:t.slice(a,f)}}function Kc({activeSession:e,activeUsage:t,messages:n,renameTitle:r,busy:i,t:a,onBrowseFiles:l,onClose:c,onExport:m,onJumpToMessage:f,onRename:y,onRenameTitleChange:v,onToggleArchived:p,onTogglePinned:S,onViewChanges:I}){const[b,d]=o.useState(""),w=o.useRef(null),u=vn(c,w),x=o.useMemo(()=>pr(e),[e]),M=o.useMemo(()=>{const R=b.trim().toLowerCase();return R?n.map((k,U)=>({message:k,index:U})).filter(({message:k})=>k.role!=="user"&&k.role!=="assistant"?!1:k.content.toLowerCase().includes(R)).slice(0,20):[]},[n,b]),g=R=>{R.preventDefault(),y()};return s.jsxs("div",{"aria-labelledby":"session-detail-title","aria-modal":"true",className:"session-detail-drawer",ref:u,role:"dialog",tabIndex:-1,children:[s.jsx("div",{className:"drawer-backdrop",onClick:c,"aria-hidden":"true"}),s.jsxs("aside",{className:"session-detail-panel",children:[s.jsxs("header",{className:"drawer-header",children:[s.jsxs("div",{children:[s.jsx("span",{className:"eyebrow",children:e.agent}),s.jsx("strong",{id:"session-detail-title",title:We(e),children:We(e)})]}),s.jsx("button",{"aria-label":a.closeSessionDetails,className:"icon-button",onClick:c,ref:w,type:"button",children:s.jsx(we,{"aria-hidden":"true"})})]}),s.jsxs("form",{className:"detail-title-form",onSubmit:g,children:[s.jsx("input",{value:r,onChange:R=>v(R.target.value),placeholder:We(e)}),s.jsx("button",{className:"primary-button",disabled:i,type:"submit",children:a.rename})]}),s.jsxs("div",{className:"detail-info-grid",children:[s.jsxs("div",{children:[s.jsx(Ct,{"aria-hidden":"true"}),s.jsx("span",{children:a.workingDirectory}),s.jsx("strong",{title:e.cwd,children:e.cwd})]}),s.jsxs("div",{children:[s.jsx(to,{"aria-hidden":"true"}),s.jsx("span",{children:a.messages}),s.jsx("strong",{children:n.filter(R=>R.role==="user"||R.role==="assistant").length})]}),s.jsxs("div",{children:[s.jsx(Va,{"aria-hidden":"true"}),s.jsx("span",{children:a.session}),s.jsx("strong",{title:e.sessionId,children:e.sessionId})]}),s.jsxs("div",{children:[s.jsx(Zn,{"aria-hidden":"true"}),s.jsx("span",{children:a.runtime}),s.jsx("strong",{children:e.runtime.state})]})]}),e.branch||e.diffStat?s.jsxs("button",{className:"detail-command-card",type:"button",onClick:I,children:[s.jsx(ir,{"aria-hidden":"true"}),s.jsxs("span",{children:[e.branch??a.changes,e.diffStat?` · +${e.diffStat.additions} -${e.diffStat.deletions}`:""]})]}):null,s.jsxs("label",{className:"detail-search",children:[s.jsx(Jn,{"aria-hidden":"true"}),s.jsx("input",{value:b,onChange:R=>d(R.target.value),placeholder:a.searchMessages}),b.trim()?s.jsx("small",{children:a.searchResultCount(M.length)}):null]}),b.trim()&&M.length?s.jsx("div",{className:"detail-search-results",children:M.map(({message:R,index:k})=>s.jsxs("button",{type:"button",onClick:()=>{f(k,b),c()},children:[s.jsx("span",{children:R.role}),s.jsx("strong",{children:R.content})]},`${R.historyKey??R.timestamp??k}:${k}`))}):null,b.trim()?null:s.jsxs(s.Fragment,{children:[s.jsxs("button",{className:"detail-command-card",type:"button",onClick:l,children:[s.jsx(Ct,{"aria-hidden":"true"}),s.jsx("span",{children:a.browseFiles})]}),s.jsxs("button",{className:"detail-command-card",type:"button",onClick:()=>{navigator.clipboard?.writeText(x)},children:[s.jsx(Ra,{"aria-hidden":"true"}),s.jsx("span",{title:x,children:x})]}),s.jsxs("div",{className:"detail-action-grid",children:[s.jsxs("button",{className:"icon-text-button",disabled:i,type:"button",onClick:S,children:[s.jsx(bn,{"aria-hidden":"true"}),e.pinned?a.unpin:a.pin]}),s.jsxs("button",{className:"icon-text-button",disabled:i,type:"button",onClick:p,children:[s.jsx(Vn,{"aria-hidden":"true"}),e.archived?a.unarchive:a.archive]}),s.jsxs("button",{className:"icon-text-button",type:"button",onClick:m,children:[s.jsx(sa,{"aria-hidden":"true"}),a.exportSession]})]}),t?s.jsxs("p",{className:"detail-usage",children:[a.usage,": ",t.limits?.fiveHour?.usedPercent??"-","% 5h ·"," ",t.limits?.weekly?.usedPercent??"-","% weekly"]}):null,s.jsxs("p",{className:"detail-usage",children:[a.created," ",Xn(e.createdAt)]})]})]})]})}function Qc({activeSession:e,activeSessionId:t,activeModelOptions:n,activeQueue:r,activeUsage:i,agent:a,approvalMode:l,attachments:c,busy:m,cwd:f,draft:y,effort:v,errorText:p,failedSend:S,fastMode:I,historyLoading:b,messages:d,messagesSessionId:w,model:u,phase:x,quickReplies:M,renameTitle:g,respondingSessionIds:R,sendShortcut:k,skills:U,uploadBusy:fe,detailsOpen:J,controlsOpen:he,pendingActionsCount:se,t:$,onApprovalModeChange:re,onBrowseFiles:ge,onCancelQueuedTurn:je,onClearInterrupt:D,onDraftChange:E,onDetailsOpenChange:q,onEffortChange:P,onExportActiveSession:ie,onFastModeChange:ye,onRetryFailedSend:ze,onModelChange:Re,onOpenRemoteFile:Z,onOpenControls:X,onInterrupt:ke,onRetry:Me,onRefreshSessions:ae,onRefreshSkills:W,onRenameSession:V,onRenameTitleChange:K,onRemoveAttachment:oe,onRestoreSnapshot:le,onSendShortcutChange:be,onSubmit:xe,onToggleArchived:Ae,onTogglePinned:G,onUploadFiles:me,onViewChanges:De}){const[T,Q]=o.useState(""),[Ue,_e]=o.useState(0),[Pe,Ce]=o.useState(null),[Ge,Fe]=o.useState(null),[Ze,Te]=o.useState(!1),[st,Xe]=o.useState([]),Se=o.useRef(null),et=o.useRef([]),pe=o.useRef(null),N=o.useRef(null),te=o.useMemo(()=>$c(d),[d]),{ensureMessageVisible:$e,hiddenItemCount:Le,hiddenLaterItemCount:rt,revealEarlier:Ve,revealLatest:ft,visibleItems:Ne}=Vc(t,te),C=o.useMemo(()=>!!(S&&Ne.some(_=>_.type==="message"&&_.message.historyKey===S.historyKey)),[S,Ne]),O=o.useRef(null),{copyText:de,feedback:H}=Cc($.messageCopied,$.copyFailed),z=o.useMemo(()=>{const _=T.trim().toLowerCase();return _?d.map((Y,ee)=>({index:ee,message:Y})).filter(({message:Y})=>Y.content.toLowerCase().includes(_)):[]},[T,d]),He=_=>{const Y=$e(_),ee=()=>et.current[_]?.scrollIntoView({behavior:"smooth",block:"center"});Y?requestAnimationFrame(()=>requestAnimationFrame(ee)):ee()},yt=()=>{if(!z.length)return;const _=Ue%z.length,Y=z[_]?.index;typeof Y=="number"&&He(Y),_e(ee=>(ee+1)%z.length)},ht=o.useCallback(()=>{const _=Se.current;_&&(_.scrollTop=_.scrollHeight,Te(!1))},[]),Rt=o.useCallback((_="smooth")=>{const Y=()=>{const ee=Se.current;ee&&(ee.scrollTo({top:ee.scrollHeight,behavior:_}),Te(!1))};rt>0?(ft(),requestAnimationFrame(()=>requestAnimationFrame(Y))):Y()},[rt,ft]),kn=()=>{const _=Se.current;if(!_)return;const Y=_.scrollHeight-_.scrollTop-_.clientHeight;Te(Y>180)},At=()=>{N.current=null},Ke=o.useMemo(()=>{const _=d.at(-1);return _?`${d.length}:${_.historyKey??""}:${_.timestamp??""}:${_.content.length}`:"0"},[d]);o.useLayoutEffect(()=>{const _=O.current,Y=Se.current;if(_&&Y){Y.scrollTop=_.top+Y.scrollHeight-_.height,O.current=null;return}pe.current!==t&&(pe.current=t,N.current=t,Ce(null),Fe(null));const ee=Se.current;if(!ee)return;const Oe=w===t;if(t!==null&&N.current===t&&Oe&&(!b||d.length>0)){ht();let at=0,Ee=-1,mt=0;const xt=performance.now(),qe=()=>{if(N.current!==t)return;ht();const St=Se.current?.scrollHeight??0;mt=St===Ee?mt+1:0,Ee=St;const Xt=performance.now()-xt>=1400;if(!b&&mt>=4||!b&&Xt){N.current=null;return}Xt||(at=requestAnimationFrame(qe))};return at=requestAnimationFrame(qe),Te(!1),()=>cancelAnimationFrame(at)}ee.scrollHeight-ee.scrollTop-ee.clientHeight<240&&ht()},[t,b,Ke,d.length,w,x,ht]);const Tt=z.length&&T.trim()?z[(Ue+z.length-1)%z.length]?.index:void 0,Jt=e?We(e):$.newSession,Et=e?.cwd??(f.trim().length>0&&f!=="."?f:""),Yt=e?.agent??a,Zt=Yt==="codex"?"Codex":"Claude";return s.jsxs("section",{className:"chat-pane","aria-label":$.chat,children:[s.jsxs("header",{className:"chat-header",children:[s.jsxs("button",{className:"chat-title-block chat-title-button",type:"button",onClick:()=>e&&q(!0),children:[s.jsx("span",{className:`agent-status-pill ${Yt}`,children:Zt}),s.jsx("h1",{title:Jt,children:Jt}),Et?s.jsx("p",{title:Et,children:Et}):null,e?.branch||e?.diffStat?s.jsxs("div",{className:"header-metadata",children:[e.branch?s.jsx("span",{children:e.branch}):null,e.diffStat?s.jsxs("span",{children:["+",e.diffStat.additions," -",e.diffStat.deletions]}):null,e.runtime.state?s.jsx("span",{children:e.runtime.state}):null,e.terminal?.mode?s.jsx("span",{children:e.terminal.mode}):null]}):null]}),s.jsx(ec,{activeSession:e,busy:m,controlsOpen:he,pendingActionsCount:se,t:$,onOpenControls:X,onRefreshSessions:ae,onRestoreSnapshot:le,onToggleArchived:Ae,onTogglePinned:G,onViewChanges:De})]}),s.jsxs("div",{className:"chat-notices","aria-live":"polite",children:[p?s.jsx(Ic,{message:p,retryLabel:$.retry,onRetry:Me}):null,S&&!C?s.jsx(Ps,{failedSend:S,onRetry:()=>{ze()},t:$}):null,e?.interruptReason?s.jsxs("div",{className:"notice warning",children:[s.jsx(Ht,{"aria-hidden":"true"}),s.jsx("span",{children:e.interruptReason.humanText||e.interruptReason.kind}),s.jsx("button",{className:"icon-text-button",disabled:m,onClick:D,type:"button",children:$.clear})]}):null,e?.stallWarning?s.jsxs("div",{className:"notice warning",children:[s.jsx(nr,{"aria-hidden":"true"}),s.jsx("span",{children:e.stallWarning.humanText||$.agentMayBeStalled})]}):null]}),s.jsxs("div",{className:"message-scroll","aria-busy":b,"data-history-loading":b?"true":"false","data-rendered-items":Ne.length,"data-total-messages":d.length,ref:Se,onScroll:kn,onPointerDown:At,onTouchStart:At,onWheel:At,children:[s.jsx(zc,{matchCount:z.length,query:T,onChange:_=>{Q(_),_e(0)},onNext:yt,t:$}),b&&d.length===0?s.jsx(Rc,{label:$.loadingHistory}):null,!b&&d.length===0?s.jsxs("div",{className:"empty-state compact",children:[s.jsx(xn,{"aria-hidden":"true"}),s.jsx("h2",{children:e?$.noVisibleMessages:$.startDaemonSession}),s.jsx("p",{children:$.emptyChatHint})]}):null,Le>0?s.jsx("div",{className:"conversation-window-gate",children:s.jsx("button",{type:"button",onClick:()=>{const _=Se.current;_&&(O.current={height:_.scrollHeight,top:_.scrollTop}),Ve()},children:$.showEarlierMessages(Le)})}):null,Ne.map(_=>{if(_.type==="toolGroup"){const Ee=_.entries.map(qe=>qe.message),mt=_.entries.some(qe=>Tt===qe.index),xt=Ge===_.id;return s.jsx("div",{className:"message-frame tool info",ref:qe=>{for(const St of _.entries)et.current[St.index]=qe},children:s.jsxs("div",{className:"inline-message-stack",children:[s.jsx(Uc,{activeMatch:mt,expanded:xt,messages:Ee,onToggle:()=>Fe(qe=>qe===_.id?null:_.id)}),xt?s.jsx(Sr,{messages:Ee,onClose:()=>Fe(null),onCopy:de,t:$}):null]})},_.id)}const{index:Y,message:ee}=_,Oe=xr(ee,Y),bt=Pe===Oe,it=Ge===Oe,at=S?.historyKey===ee.historyKey?S:null;return s.jsxs("div",{className:`message-frame ${ee.role} ${ee.type==="info"?"info":""}`,ref:Ee=>{et.current[Y]=Ee},children:[s.jsx(Wc,{activeMatch:Tt===Y,baseCwd:e?.cwd,message:ee,onCopy:de,onCloseSource:()=>Ce(null),onCloseTool:()=>Fe(null),onOpenAttachment:Xe,onOpenRemoteFile:Z,onToggleSource:()=>Ce(Ee=>Ee===Oe?null:Oe),onToggleTool:()=>Fe(Ee=>Ee===Oe?null:Oe),sourceOpen:bt,toolOpen:it,t:$}),at?s.jsx(Ps,{failedSend:at,onRetry:()=>{ze()},t:$}):null]},Oe)}),rt>0?s.jsx("div",{className:"conversation-window-gate",children:s.jsx("button",{type:"button",onClick:()=>Rt("auto"),children:$.showLatestMessages(rt)})}):null,t&&R.has(t)?s.jsx(Ac,{busy:m,label:$.agentResponding,stopLabel:$.stopGenerating,onStop:ke}):null,s.jsx("div",{"aria-hidden":"true",className:"message-latest-anchor"}),Ze?s.jsx(Tc,{label:$.newMessages,onClick:()=>Rt()}):null]}),s.jsx(Nc,{feedback:H}),s.jsx(vc,{activeModelOptions:n,activeQueue:r,agent:a,approvalMode:l,attachments:c,busy:m,draft:y,effort:v,fastMode:I,model:u,phase:x,quickReplies:M,sendShortcut:k,skills:U,uploadBusy:fe,onApprovalModeChange:re,onCancelQueuedTurn:je,onDraftChange:E,onEffortChange:P,onFastModeChange:ye,onModelChange:Re,onRemoveAttachment:oe,onRefreshSkills:W,onSendShortcutChange:be,onSubmit:xe,onUploadFiles:me,t:$}),J&&e?s.jsx(Kc,{activeSession:e,activeUsage:i,busy:m,messages:d,renameTitle:g,t:$,onBrowseFiles:()=>{q(!1),ge()},onClose:()=>q(!1),onExport:ie,onJumpToMessage:(_,Y)=>{Q(Y),_e(0),He(_)},onRename:V,onRenameTitleChange:K,onToggleArchived:Ae,onTogglePinned:G,onViewChanges:()=>De(e.sessionId)}):null,s.jsx(kc,{cwd:e?.cwd,paths:st,t:$,onClose:()=>Xe([]),onOpenRemoteFile:Z})]})}const Ln="vibelet --access=quick";function Jc({errorText:e,t}){const[n,r]=o.useState("idle"),i=async()=>{try{if(navigator.clipboard?.writeText)await navigator.clipboard.writeText(Ln);else{const a=document.createElement("textarea");a.value=Ln,a.style.position="fixed",a.style.opacity="0",document.body.append(a),a.select();const l=document.execCommand("copy");if(a.remove(),!l)throw new Error("copy failed")}r("success")}catch{r("error")}window.setTimeout(()=>r("idle"),1800)};return s.jsx("main",{className:"connection-guide",id:"vibelet-main-content",tabIndex:-1,children:s.jsxs("section",{className:"connection-guide-content","aria-labelledby":"connection-guide-title",children:[s.jsx("span",{className:"connection-guide-mark","aria-hidden":"true",children:s.jsx(Yn,{})}),s.jsx("span",{className:"connection-guide-eyebrow",children:"Vibelet Web"}),s.jsx("h1",{id:"connection-guide-title",children:t.openDaemonWebLink}),s.jsx("p",{children:t.openDaemonWebLinkHint}),s.jsxs("div",{className:"connection-command",children:[s.jsx("code",{children:Ln}),s.jsxs("button",{className:"primary-button",onClick:()=>{i()},type:"button",children:[n==="success"?s.jsx(nt,{"aria-hidden":"true"}):s.jsx(Nt,{"aria-hidden":"true"}),s.jsx("span",{children:n==="success"?t.commandCopied:n==="error"?t.copyFailed:t.copyStartCommand})]})]}),s.jsx("p",{className:"connection-guide-footnote",children:t.connectionGuideFootnote}),e?s.jsx("p",{className:"connection-guide-error",children:e}):null]})})}const Yc=o.lazy(async()=>Ye(()=>import("./FilesControlPanel-zSRq3nW9.js"),__vite__mapDeps([4,1,2,5])).then(e=>({default:e.FilesControlPanel}))),Zc=o.lazy(async()=>Ye(()=>import("./ArchiveSyncPanel-BmuZbCNC.js"),__vite__mapDeps([6,1,2])).then(e=>({default:e.ArchiveSyncPanel}))),Xc=o.lazy(async()=>Ye(()=>import("./ConnectionSettingsPanel-CBCsJpl3.js"),__vite__mapDeps([7,1,2])).then(e=>({default:e.ConnectionSettingsPanel}))),el=o.lazy(async()=>Ye(()=>import("./DaemonSettingsPanel-BvwnLOlI.js"),__vite__mapDeps([8,1,2])).then(e=>({default:e.DaemonSettingsPanel}))),tl=o.lazy(async()=>Ye(()=>import("./LanguageSettingsPanel-BynXGit2.js"),__vite__mapDeps([9,1,2])).then(e=>({default:e.LanguageSettingsPanel}))),nl=o.lazy(async()=>Ye(()=>import("./ThemeSettingsPanel-qeXJXo6p.js"),__vite__mapDeps([10,1,2])).then(e=>({default:e.ThemeSettingsPanel}))),sl=o.lazy(async()=>Ye(()=>import("./NotificationSettingsPanel-B1B7EVaN.js"),__vite__mapDeps([11,1,2])).then(e=>({default:e.NotificationSettingsPanel}))),rl=o.lazy(async()=>Ye(()=>import("./SavedTargetsPanel-rIXNVgWc.js"),__vite__mapDeps([12,1,2])).then(e=>({default:e.SavedTargetsPanel}))),il=o.lazy(async()=>Ye(()=>import("./DiffDrawer-D1KuAQR4.js"),__vite__mapDeps([13,1,2,5])).then(e=>({default:e.DiffDrawer})));function Ls({t:e}){return s.jsxs("div",{className:"control-panel-loading","aria-live":"polite","aria-busy":"true",children:[s.jsx("span",{className:"loading-spinner","aria-hidden":"true"}),s.jsx("span",{children:e.loadingControls})]})}function al({client:e,id:t,sessions:n,t:r,close:i}){const a=n.find(l=>l.sessionId===t);return!a||!e?null:s.jsx(o.Suspense,{fallback:null,children:s.jsx(il,{client:e,sessionId:a.sessionId,sessionTitle:We(a),t:r,onClose:i})})}function ol({activeApproval:e,activeQuestion:t,busy:n,questionAnswers:r,t:i,onCancelQuestion:a,onQuestionChoice:l,onRespondApproval:c,onRespondQuestion:m}){const f=!!(e||t);return s.jsxs(s.Fragment,{children:[f?null:s.jsxs("section",{className:"control-section",children:[s.jsx("h2",{children:i.pendingActions}),s.jsx("p",{className:"empty-copy",children:i.noPendingActions})]}),e?s.jsxs("section",{className:"attention-panel",children:[s.jsxs("div",{className:"attention-head",children:[s.jsx(xn,{"aria-hidden":"true"}),s.jsxs("div",{children:[s.jsx("h2",{children:i.approvalRequired}),s.jsx("p",{children:e.toolName})]})]}),s.jsx("p",{children:e.description}),s.jsx("pre",{children:mr(e.input)}),s.jsxs("div",{className:"attention-actions",children:[s.jsxs("button",{type:"button",className:"danger-button",onClick:()=>c(!1),disabled:n,children:[s.jsx(we,{"aria-hidden":"true"}),i.deny]}),s.jsxs("button",{type:"button",className:"approve-button",onClick:()=>c(!0),disabled:n,children:[s.jsx(nt,{"aria-hidden":"true"}),i.approve]})]})]}):null,t?s.jsxs("section",{className:"attention-panel",children:[s.jsxs("div",{className:"attention-head",children:[s.jsx(Ja,{"aria-hidden":"true"}),s.jsxs("div",{children:[s.jsx("h2",{children:i.inputNeeded}),s.jsxs("p",{children:[t.questions.length," question",t.questions.length>1?"s":""]})]})]}),t.questions.map(y=>s.jsxs("div",{className:"question-block",children:[s.jsx("strong",{children:y.question}),s.jsx("div",{className:"choice-list",children:y.options.map(v=>{const p=(r[y.id]??[]).includes(v.label);return s.jsxs("button",{className:p?"selected":"",onClick:()=>l(y.id,v.label,y.multiSelect),type:"button",children:[s.jsx("span",{children:v.label}),v.description?s.jsx("small",{children:v.description}):null]},v.label)})})]},y.id)),s.jsxs("div",{className:"attention-actions",children:[s.jsxs("button",{type:"button",className:"danger-button",onClick:a,disabled:n,children:[s.jsx(we,{"aria-hidden":"true"}),i.cancel]}),s.jsxs("button",{type:"button",className:"approve-button",onClick:m,disabled:n,children:[s.jsx(nt,{"aria-hidden":"true"}),i.submit]})]})]}):null]})}const cl="/web/assets/splash-logo-SQcOtj-8.png";var ll=ra();function dl({folder:e,initialValue:t,t:n,onClose:r,onSave:i}){const[a,l]=o.useState(t),c=o.useRef(null),m=vn(r,c),f=y=>{y.preventDefault(),i(a)};return ll.createPortal(s.jsxs("div",{"aria-labelledby":"folder-tag-dialog-title","aria-modal":"true",className:"folder-tag-dialog-layer",ref:m,role:"dialog",tabIndex:-1,children:[s.jsx("div",{"aria-hidden":"true",className:"folder-tag-dialog-backdrop",onClick:r}),s.jsxs("form",{className:"folder-tag-dialog",onSubmit:f,children:[s.jsxs("header",{children:[s.jsx("span",{className:"folder-tag-dialog-icon","aria-hidden":"true",children:s.jsx(dr,{})}),s.jsxs("div",{children:[s.jsx("strong",{id:"folder-tag-dialog-title",children:n.editDirectoryTags}),s.jsx("span",{title:e,children:e})]}),s.jsx("button",{"aria-label":n.cancel,className:"mini-button",onClick:r,type:"button",children:s.jsx(we,{"aria-hidden":"true"})})]}),s.jsxs("label",{className:"folder-tag-dialog-field",children:[s.jsx("span",{children:n.directoryTags}),s.jsx("textarea",{"aria-describedby":"folder-tag-dialog-help",placeholder:n.directoryTagsPlaceholder,ref:c,rows:3,value:a,onChange:y=>l(y.target.value)})]}),s.jsx("p",{id:"folder-tag-dialog-help",children:n.directoryTagsDescription}),s.jsxs("footer",{children:[s.jsx("button",{className:"icon-text-button",onClick:r,type:"button",children:n.cancel}),s.jsx("button",{className:"primary-button",type:"submit",children:n.saveDirectoryTags})]})]})]}),document.body)}function Os({session:e,active:t,responding:n,tagLabels:r,t:i,onSelect:a,onContextMenu:l,onViewChanges:c}){const m=!!e.diffStat&&(e.diffStat.additions>0||e.diffStat.deletions>0),f=We(e);return s.jsxs("button",{className:`session-row ${t?"active":""} ${e.archived?"archived":""}`,onContextMenu:l,onClick:a,title:f,type:"button",children:[s.jsxs("span",{className:"session-row-head",children:[s.jsx("strong",{children:f}),n?s.jsx(Na,{"aria-label":i.agentResponding}):null]}),s.jsx("span",{children:e.cwd}),s.jsx("span",{"aria-hidden":r?.length?void 0:"true",className:`directory-tag-row ${r?.length?"":"empty"}`,title:r?.length?i.directoryTags:void 0,children:r?.map(y=>s.jsx("em",{children:y},y))}),s.jsxs("span",{className:"session-row-footer",children:[s.jsxs("small",{children:[e.agent," · ",Xn(e.lastActivityAt),e.branch?` · ${e.branch}`:"",e.diffStat&&!c?` · +${e.diffStat.additions}/-${e.diffStat.deletions}`:"",e.pinned?` · ${i.pinned}`:"",e.archived?` · ${i.archived}`:""]}),m&&c&&e.diffStat?s.jsxs("span",{className:"session-diff-badge",role:"button",tabIndex:0,title:i.viewChanges,onClick:y=>{y.stopPropagation(),c()},onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),y.stopPropagation(),c())},children:[s.jsxs("span",{className:"diff-add",children:["+",e.diffStat.additions]}),s.jsxs("span",{className:"diff-del",children:["-",e.diffStat.deletions]})]}):null]})]})}function ul({activeSessionId:e,busy:t,collapsedFolders:n,folderCounts:r,getFolderTags:i,groupFolders:a,groupedSessions:l,phase:c,respondingSessionIds:m,t:f,visibleSessions:y,onBrowseFolder:v,onEditFolderTags:p,onOpenCreateMenu:S,onOpenSessionMenu:I,onSelectSession:b,onToggleFolder:d,onViewChanges:w}){return a?s.jsxs(s.Fragment,{children:[l.map(u=>{const x=n[u.folder],M=u.kind==="attention"?f.needsAttentionSessionsGroup:u.kind==="running"?f.runningSessionsGroup:u.kind==="pinned"?f.pinnedSessionsGroup:u.folder;return s.jsxs("div",{className:`folder-group ${u.kind!=="folder"?"virtual-session-group":""}`,children:[s.jsxs("div",{className:"folder-header",children:[s.jsxs("button",{onClick:()=>d(u.folder),type:"button",children:[u.kind==="attention"?s.jsx(ar,{"aria-hidden":"true"}):u.kind==="running"?s.jsx(fn,{"aria-hidden":"true"}):u.kind==="pinned"?s.jsx(bn,{"aria-hidden":"true"}):s.jsx(rr,{"aria-hidden":"true"}),s.jsx("span",{children:M}),s.jsx("small",{children:u.kind==="folder"?r[u.folder]??u.sessions.length:u.sessions.length})]}),u.kind==="folder"?s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"mini-button",disabled:c!=="connected",onClick:()=>v(u.folder),title:f.browseFolder,type:"button",children:s.jsx(Ct,{"aria-hidden":"true"})}),s.jsx("button",{"aria-label":i(u.folder).length?f.editDirectoryTags:f.addDirectoryTags,className:"mini-button",onClick:()=>p(u.folder),title:i(u.folder).length?f.editDirectoryTags:f.addDirectoryTags,type:"button",children:s.jsx(dr,{"aria-hidden":"true"})}),s.jsx("button",{className:"mini-button",disabled:t||c!=="connected",onClick:g=>S(g,u.folder),title:f.newSession,type:"button",children:s.jsx(Qn,{"aria-hidden":"true"})})]}):null]}),u.kind==="folder"&&i(u.folder).length?s.jsx("div",{className:"folder-tag-row",children:i(u.folder).map(g=>s.jsx("span",{children:g},g))}):null,x?null:u.sessions.map(g=>s.jsx(Os,{active:g.sessionId===e,responding:m.has(g.sessionId),session:g,tagLabels:i(g.cwd),t:f,onContextMenu:R=>I(R,g),onSelect:()=>b(g.sessionId),onViewChanges:w?()=>w(g.sessionId):void 0},g.sessionId))]},u.folder)}),y.length===0?s.jsx("p",{className:"empty-copy",children:f.noSessionsMatch}):null]}):s.jsxs(s.Fragment,{children:[y.map(u=>s.jsx(Os,{active:u.sessionId===e,responding:m.has(u.sessionId),session:u,tagLabels:i(u.cwd),t:f,onContextMenu:x=>I(x,u),onSelect:()=>b(u.sessionId),onViewChanges:w?()=>w(u.sessionId):void 0},u.sessionId)),y.length===0?s.jsx("p",{className:"empty-copy",children:f.noSessionsMatch}):null]})}function fl({ariaLabel:e,options:t,value:n,disabled:r,onChange:i}){return s.jsx("div",{className:"chip-group",role:"radiogroup","aria-label":e,children:t.map(a=>s.jsx("button",{"aria-checked":n===a.value,className:n===a.value?"selected":"",disabled:r,onClick:()=>i(a.value),role:"radio",title:a.title??a.label,type:"button",children:a.label},a.value))})}function hl({agentFilter:e,t,onAgentFilterChange:n}){return s.jsxs("div",{className:"session-filter-panel",children:[s.jsx("span",{className:"filter-section-label",children:t.agentFilterLabel}),s.jsx(fl,{ariaLabel:t.agentFilterLabel,value:e,options:[{value:"all",label:t.agentFilterAll},{value:"claude",label:t.agentFilterClaude},{value:"codex",label:t.agentFilterCodex}],onChange:n})]})}function ml({groupFolders:e,hideArchived:t,separatePinnedGroup:n,showNeedsAttentionGroup:r,showRunningGroup:i,t:a,onToggleGroupFolders:l,onToggleHideArchived:c,onToggleNeedsAttentionGroup:m,onToggleRunningGroup:f,onToggleSeparatePinnedGroup:y}){const v=[[a.showNeedsAttentionGroup,r,m],[a.showRunningGroup,i,f],[a.separatePinnedGroup,n,y]];return s.jsxs("div",{className:"filter-section",children:[s.jsx("span",{className:"filter-section-label",children:a.filterViewOptions}),s.jsxs("div",{className:"filter-switch-card",children:[s.jsxs("button",{"aria-pressed":e,className:e?"selected":"",onClick:l,type:"button",children:[s.jsx("span",{children:a.groupByFolder}),s.jsx("span",{className:"filter-switch-track","aria-hidden":"true",children:s.jsx("span",{})})]}),v.map(([p,S,I])=>s.jsxs("button",{"aria-pressed":e&&S,className:`nested-filter-option ${e&&S?"selected":""}`,disabled:!e,onClick:I,type:"button",children:[s.jsx("span",{children:p}),s.jsx("span",{className:"filter-switch-track","aria-hidden":"true",children:s.jsx("span",{})})]},p)),s.jsxs("button",{"aria-pressed":t,className:t?"selected":"",onClick:c,type:"button",children:[s.jsx("span",{children:a.hideArchived}),s.jsx("span",{className:"filter-switch-track","aria-hidden":"true",children:s.jsx("span",{})})]})]})]})}function pl(e,t){const n=o.useRef(null),r=o.useRef(null),i=o.useRef(t),[a,l]=o.useState(null),c=!!(e?.lastActivityAt&&e.sessionId),m=c?`${e?.lastActivityAt}:${e?.sessionId}`:null;return o.useEffect(()=>{i.current=t},[t]),o.useEffect(()=>{const f=n.current;if(!f||!e||!m){r.current=null,l(null);return}const y=f.closest(".session-list");if(!(y instanceof HTMLElement))return;let v=!0,p;l(null);const S=new IntersectionObserver(I=>{!I.some(b=>b.isIntersecting)||r.current===m||(r.current=m,l(m),i.current(e).catch(()=>{v&&(p=window.setTimeout(()=>{v&&(r.current=null,S.unobserve(f),S.observe(f))},1500))}).finally(()=>{v&&l(b=>b===m?null:b)}))},{root:y,rootMargin:"0px 0px 240px 0px",threshold:.01});return S.observe(f),()=>{v=!1,p!==void 0&&window.clearTimeout(p),S.disconnect()}},[m,e]),{canLoadMore:c,loading:a===m,sentinelRef:n}}function ut(e){return typeof e=="string"&&e.trim().length>0?e:void 0}function gl({activeSessionId:e,busy:t,collapsedFolders:n,currentCwd:r,displayName:i,directoryTags:a,folderCounts:l,groupFolders:c,groupedSessions:m,hideArchived:f,separatePinnedGroup:y,showNeedsAttentionGroup:v,showRunningGroup:p,inventoryVersion:S,nextCursor:I,phase:b,pendingSessionIds:d,respondingSessionIds:w,search:u,sessionAgentFilter:x,sessionsCount:M,sinceFilter:g,statusText:R,t:k,visibleSessions:U,onLoadMore:fe,onCopyResumeCommand:J,onCreateDirectory:he,onCreateSession:se,onDeleteSession:$,onListDirectories:re,onBrowseFolder:ge,onEditFolderTags:je,onOpenSessionDetails:D,onResetFilters:E,onSearchChange:q,onSearchCommit:P,onSelectSession:ie,onToggleSessionArchived:ye,onToggleSessionPinned:ze,onSessionAgentFilterChange:Re,onSinceFilterChange:Z,onToggleFolder:X,onToggleGroupFolders:ke,onToggleHideArchived:Me,onToggleNeedsAttentionGroup:ae,onToggleRunningGroup:W,onToggleSeparatePinnedGroup:V,onToggleCollapse:K,onViewChanges:oe}){const[le,be]=o.useState(!1),[xe,Ae]=o.useState(null),[G,me]=o.useState(null),De=o.useRef(0),[T,Q]=o.useState(null),Ue=o.useRef(null),_e=x!=="all"||g!=="30d"||c||c&&(v||p||y)||f,Pe=pl(I,fe),Ce=G?!!d?.has(G.session.sessionId):!1,Ge=C=>a[ut(C)??"/"]??[],Fe=b==="connected"?`${U.length}/${M} sessions · v${S??"-"}`:k.sameOriginAccess,Ze=`${R} · ${Fe}`;o.useEffect(()=>{if(!le&&!G&&!T)return;const C=de=>{const H=de.target;H instanceof Node&&Ue.current?.contains(H)||(be(!1),me(null),Q(null))},O=de=>{de.key==="Escape"&&(be(!1),me(null),Q(null))};return document.addEventListener("pointerdown",C),document.addEventListener("keydown",O),()=>{document.removeEventListener("pointerdown",C),document.removeEventListener("keydown",O)}},[G,T,le]);const Te=(C,O)=>{const de=C.currentTarget.getBoundingClientRect(),H=320,z=430,He=ut(O),yt=He??ut(r)??".";me(null),Q({...He?{folder:He}:{},cwd:yt,x:Math.max(10,Math.min(de.right-H,window.innerWidth-H-10)),y:Math.max(10,Math.min(de.bottom+8,window.innerHeight-z-10))})},st=(C,O)=>{C.preventDefault();const de=224,H=306;Q(null),me({session:O,x:Math.min(C.clientX,window.innerWidth-de-10),y:Math.min(C.clientY,window.innerHeight-H-10)})},Xe=()=>me(null),Se=C=>{be(!1),me(null),Q(null),Ae({folder:C,value:Ge(C).join(", ")})},et=C=>{xe&&(je(xe.folder,C),Ae(null))},pe=C=>{if(!G)return;const{session:O}=G;Xe(),C(O)},N=C=>{if(!T)return;const O=ut(T.cwd)??ut(T.folder)??ut(r)??".";Q(null),se(O,C)},te=C=>{const O=ut(C)??ut(r)??".",de=++De.current;Q(H=>H&&{...H,browser:{path:O,entries:[],loading:!0,loaded:!1,createMode:!1,newFolderName:"",creating:!1}}),re(O).then(H=>{De.current===de&&Q(z=>z?.browser?{...z,browser:{...z.browser,path:O,entries:H.filter(He=>He.isDirectory),loading:!1,loaded:!0,error:void 0}}:z)}).catch(H=>{De.current===de&&Q(z=>z?.browser?{...z,browser:{...z.browser,path:O,entries:[],loading:!1,loaded:!0,error:H instanceof Error?H.message:String(H)}}:z)})},$e=()=>{T&&te(T.cwd||T.folder||r||".")},Le=()=>{Q(C=>C?.browser?{...C,cwd:C.browser.path,browser:void 0}:C)},rt=C=>{Q(O=>O?.browser?{...O,browser:{...O.browser,newFolderName:C,createError:void 0}}:O)},Ve=()=>{Q(C=>C?.browser?{...C,browser:{...C.browser,createMode:!0,newFolderName:"",createError:void 0}}:C)},ft=()=>{Q(C=>C?.browser?{...C,browser:{...C.browser,createMode:!1,newFolderName:"",createError:void 0,creating:!1}}:C)},Ne=()=>{const C=T?.browser,O=C?.newFolderName??"";if(!C||O.trim().length===0||C.creating)return;if(O.includes("/")||O.includes("\\")||O==="."||O===".."){Q(H=>H?.browser?{...H,browser:{...H.browser,createError:k.folderCreateFailed}}:H);return}const de=Hn(C.path,O);Q(H=>H?.browser?{...H,browser:{...H.browser,creating:!0,createError:void 0}}:H),he(de).then(()=>{te(C.path)}).catch(H=>{Q(z=>z?.browser?{...z,browser:{...z.browser,creating:!1,createError:H instanceof Error?H.message:String(H)}}:z)})};return s.jsxs("aside",{className:"session-rail","aria-label":k.sessions,children:[s.jsxs("div",{className:"brand-block",title:Ze,children:[s.jsx("div",{className:"brand-mark","aria-hidden":"true",children:s.jsx("img",{alt:"",className:"brand-logo",height:"40",src:cl,width:"40"})}),s.jsxs("div",{className:"brand-copy",children:[s.jsx("strong",{children:"Vibelet Web"}),s.jsxs("span",{className:`brand-connection ${b}`,children:[s.jsx("i",{"aria-hidden":"true"}),b==="connected"&&i?k.connectedTo(i):R]})]}),K?s.jsx("button",{"aria-label":k.collapseSessionSidebar,className:"sidebar-panel-collapse-button session-rail-collapse-button",onClick:K,title:k.collapseSessionSidebar,type:"button",children:s.jsx(or,{"aria-hidden":"true"})}):null]}),s.jsxs("div",{className:"rail-list-heading",children:[s.jsx("span",{children:k.sessions}),s.jsx("button",{"aria-label":k.newSession,className:"rail-create-button",disabled:t||b!=="connected",onClick:C=>Te(C),title:k.newSession,type:"button",children:s.jsx(Qn,{"aria-hidden":"true"})})]}),s.jsxs("div",{className:"search-filter-wrap",ref:Ue,children:[s.jsxs("div",{className:"search-box",children:[s.jsx(Jn,{"aria-hidden":"true"}),s.jsx("input",{value:u,onBlur:P,onChange:C=>q(C.target.value),onKeyDown:C=>{C.key==="Enter"&&P()},placeholder:k.searchSessions}),s.jsx("button",{"aria-expanded":le,"aria-label":k.sessionFilters,className:`filter-toggle ${le||_e?"selected":""}`,onClick:()=>be(C=>!C),title:k.sessionFilters,type:"button",children:s.jsx(Wa,{"aria-hidden":"true"})})]}),le?s.jsxs("div",{className:"filter-popover",role:"dialog","aria-label":k.sessionFilters,children:[s.jsx(hl,{agentFilter:x,t:k,onAgentFilterChange:Re}),s.jsxs("div",{className:"filter-section",children:[s.jsx("span",{className:"filter-section-label",children:k.searchTimeRangeLabel}),s.jsx("div",{className:"rail-filters",role:"group","aria-label":k.searchTimeRangeLabel,children:["all","7d","30d","90d"].map(C=>s.jsx("button",{className:g===C?"selected":"",onClick:()=>Z(C),type:"button",children:C==="all"?k.searchTimeRangeAllTime:C==="7d"?k.searchTimeRangeLast7Days:C==="30d"?k.searchTimeRangeLast30Days:k.searchTimeRangeLast90Days},C))})]}),s.jsx(ml,{groupFolders:c,hideArchived:f,separatePinnedGroup:y,showNeedsAttentionGroup:v,showRunningGroup:p,t:k,onToggleGroupFolders:ke,onToggleHideArchived:Me,onToggleNeedsAttentionGroup:ae,onToggleRunningGroup:W,onToggleSeparatePinnedGroup:V}),_e?s.jsx("button",{className:"filter-reset-button",onClick:E,type:"button",children:k.resetFilters}):null]}):null]}),s.jsxs("div",{className:"session-list",children:[s.jsx(ul,{activeSessionId:e,busy:t,collapsedFolders:n,folderCounts:l,getFolderTags:Ge,groupFolders:c,groupedSessions:m,phase:b,respondingSessionIds:w,t:k,visibleSessions:U,onBrowseFolder:ge,onEditFolderTags:Se,onOpenCreateMenu:Te,onOpenSessionMenu:st,onSelectSession:ie,onToggleFolder:X,onViewChanges:oe}),Pe.canLoadMore?s.jsx("div",{"aria-live":"polite",className:`session-load-sentinel ${Pe.loading?"loading":""}`,ref:Pe.sentinelRef,role:"status",children:Pe.loading?s.jsxs(s.Fragment,{children:[s.jsx(fn,{className:"spin","aria-hidden":"true"}),s.jsx("span",{children:k.loadingMore})]}):null}):null]}),xe?s.jsx(dl,{folder:xe.folder,initialValue:xe.value,t:k,onClose:()=>Ae(null),onSave:et}):null,T?s.jsxs("div",{className:"session-create-menu",role:"dialog","aria-label":k.newSession,style:{left:T.x,top:T.y},onPointerDown:C=>C.stopPropagation(),children:[s.jsxs("label",{className:"session-create-field",children:[s.jsx("span",{children:k.workingDirectory}),s.jsxs("div",{className:"session-create-input-row",children:[s.jsx("input",{"aria-label":k.workingDirectory,placeholder:k.workingDirectoryPlaceholder,value:T.cwd,onChange:C=>Q(O=>O&&{...O,cwd:C.target.value}),onKeyDown:C=>{C.key==="Enter"&&(C.preventDefault(),N("claude"))}}),s.jsx("button",{"aria-label":k.browseDirectories,className:"session-create-icon-button",onClick:$e,title:k.browseDirectories,type:"button",children:s.jsx(Ct,{"aria-hidden":"true"})})]})]}),T.browser?s.jsxs("div",{className:"session-create-browser",children:[s.jsxs("div",{className:"session-create-browser-bar",children:[s.jsx("span",{title:T.browser.path,children:T.browser.path}),s.jsx("button",{"aria-label":k.refreshSessions,className:"session-create-icon-button",onClick:()=>te(T.browser?.path??T.cwd),title:k.refreshSessions,type:"button",children:T.browser.loading?s.jsx(fn,{className:"spin","aria-hidden":"true"}):s.jsx(Vt,{"aria-hidden":"true"})})]}),T.browser.createMode?s.jsxs("div",{className:"session-create-new-folder",children:[s.jsx("input",{"aria-label":k.newFolder,disabled:T.browser.creating,placeholder:k.newFolderPlaceholder,value:T.browser.newFolderName,onChange:C=>rt(C.target.value),onKeyDown:C=>{C.key==="Enter"&&(C.preventDefault(),Ne())}}),s.jsx("button",{"aria-label":k.cancel,className:"session-create-icon-button",disabled:T.browser.creating,onClick:ft,title:k.cancel,type:"button",children:s.jsx(we,{"aria-hidden":"true"})}),s.jsx("button",{"aria-label":k.create,className:"session-create-icon-button",disabled:T.browser.creating||!T.browser.newFolderName.trim(),onClick:Ne,title:k.create,type:"button",children:T.browser.creating?s.jsx(fn,{className:"spin","aria-hidden":"true"}):s.jsx(nt,{"aria-hidden":"true"})})]}):s.jsxs("button",{className:"session-create-secondary-button",onClick:Ve,type:"button",children:[s.jsx(qa,{"aria-hidden":"true"}),k.newFolder]}),T.browser.createError?s.jsx("p",{className:"session-create-error",children:T.browser.createError}):null,s.jsxs("div",{className:"session-create-folder-list",children:[Ts(T.browser.path)?s.jsxs("button",{className:"session-create-folder-row",onClick:()=>te(Ts(T.browser?.path??"")??T.cwd),type:"button",children:[s.jsx(Ct,{"aria-hidden":"true"}),".."]}):null,T.browser.loading?s.jsx("p",{className:"empty-copy",children:k.loadingDirectories}):null,!T.browser.loading&&T.browser.error?s.jsx("p",{className:"session-create-error",children:T.browser.error}):null,!T.browser.loading&&!T.browser.error&&T.browser.loaded&&T.browser.entries.length===0?s.jsx("p",{className:"empty-copy",children:k.remoteFolderEmpty}):null,!T.browser.loading&&!T.browser.error?T.browser.entries.map(C=>{const O=Hn(T.browser?.path??T.cwd,C.name);return s.jsxs("button",{className:"session-create-folder-row",onClick:()=>te(O),type:"button",children:[s.jsx(rr,{"aria-hidden":"true"}),s.jsx("span",{children:C.name})]},`${C.name}:${O}`)}):null]}),s.jsxs("button",{className:"session-create-select-button",onClick:Le,type:"button",children:[s.jsx(nt,{"aria-hidden":"true"}),k.chooseThisFolder]})]}):null,s.jsxs("button",{type:"button",onClick:()=>N("claude"),children:[s.jsx(xa,{"aria-hidden":"true"}),s.jsxs("span",{children:[s.jsx("strong",{children:"Claude"}),s.jsx("small",{children:k.claudeSession})]})]}),s.jsxs("button",{type:"button",onClick:()=>N("codex"),children:[s.jsx(Yn,{"aria-hidden":"true"}),s.jsxs("span",{children:[s.jsx("strong",{children:"Codex"}),s.jsx("small",{children:k.codexSession})]})]})]}):null,G?s.jsxs("div",{className:"session-context-menu",role:"menu",style:{left:G.x,top:G.y},onPointerDown:C=>C.stopPropagation(),children:[s.jsxs("button",{type:"button",role:"menuitem",onClick:()=>pe(C=>ie(C.sessionId)),children:[s.jsx(tr,{"aria-hidden":"true"}),k.open]}),s.jsxs("button",{type:"button",role:"menuitem",disabled:Ce,onClick:()=>pe(D),children:[s.jsx(ar,{"aria-hidden":"true"}),k.details]}),s.jsxs("button",{type:"button",role:"menuitem",disabled:Ce,onClick:()=>pe(J),children:[s.jsx(Nt,{"aria-hidden":"true"}),k.copyResumeCommand]}),s.jsxs("button",{type:"button",role:"menuitem",disabled:Ce||!oe||!G.session.branch&&!G.session.diffStat,onClick:()=>pe(C=>oe?.(C.sessionId)),children:[s.jsx(sr,{"aria-hidden":"true"}),k.viewChanges]}),s.jsx("span",{className:"context-menu-separator"}),s.jsxs("button",{type:"button",role:"menuitem",disabled:Ce,onClick:()=>pe(ze),children:[s.jsx(bn,{"aria-hidden":"true"}),G.session.pinned?k.unpin:k.pin]}),s.jsxs("button",{type:"button",role:"menuitem",disabled:Ce,onClick:()=>pe(ye),children:[s.jsx(Vn,{"aria-hidden":"true"}),G.session.archived?k.unarchive:k.archive]}),s.jsxs("button",{className:"danger",type:"button",role:"menuitem",onClick:()=>pe($),children:[s.jsx(jo,{"aria-hidden":"true"}),k.delete]})]}):null]})}function yl({value:e,t,showSession:n=!0,onChange:r}){const i=[...n?[{tab:"session",label:t.session,Icon:lr}]:[],{tab:"files",label:t.files,Icon:Ct},{tab:"admin",label:t.settings,Icon:ho}];return s.jsx("div",{className:"control-tabs",children:i.map(({tab:a,label:l,Icon:c})=>s.jsxs("button",{"aria-label":l,"aria-pressed":e===a,className:e===a?"selected":"",onClick:()=>r(a),title:l,type:"button",children:[s.jsx(c,{"aria-hidden":"true"}),s.jsx("span",{children:l})]},a))})}function bl({children:e,t,value:n,showSession:r,onChange:i,onClose:a}){const l=o.useRef(null),c=vn(a,l);return s.jsxs("div",{"aria-label":t.controls,"aria-modal":"true",className:"workspace-control-drawer",ref:c,role:"dialog",tabIndex:-1,children:[s.jsx("button",{className:"workspace-control-backdrop",onClick:a,tabIndex:-1,type:"button"}),s.jsxs("aside",{className:"control-pane",children:[s.jsxs("div",{className:"control-pane-toolbar",children:[s.jsx(yl,{value:n,t,showSession:r,onChange:i}),s.jsx("button",{"aria-label":t.collapseControlsSidebar,className:"sidebar-panel-collapse-button",onClick:a,ref:l,title:t.collapseControlsSidebar,type:"button",children:s.jsx(cr,{"aria-hidden":"true"})})]}),e]})]})}function jt(e,t){o.useEffect(()=>{e.current=t},[e,t])}const vr="pair",gt="vibelet.web.pairing",qs="vibelet.web.deviceId";class yn extends Error{constructor(t,n){super(n),this.code=t,this.name="PairingCreateError"}}function rs(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function xl(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return decodeURIComponent(Array.from(atob(n),r=>`%${r.charCodeAt(0).toString(16).padStart(2,"0")}`).join(""))}function Sl(e){const[t,n,r,i,a,l]=e;return!n||!Number.isFinite(r)||r<=0?null:{kind:t==="relay"?"relay":"direct",host:n,port:Math.floor(r),source:i,stability:a,...l===!0?{secure:!0}:{}}}function vl(e){if(!rs(e))return null;const{kind:t,host:n,port:r,source:i,stability:a,secure:l}=e;return t!=="direct"&&t!=="relay"||typeof n!="string"||!n.trim()||typeof r!="number"||!Number.isFinite(r)||r<=0||typeof i!="string"||typeof a!="string"?null:{kind:t,host:n.trim(),port:Math.floor(r),source:i,stability:a,...l===!0?{secure:!0}:{}}}function wl(e){const t=e.trim().split(".");if(t.length!==4)return!1;const n=t.map(a=>/^\d+$/.test(a)?Number(a):Number.NaN);if(n.some(a=>!Number.isInteger(a)||a<0||a>255))return!1;const[r,i]=n;return r===10||r===172&&i>=16&&i<=31||r===192&&i===168}function wr(e){const t=e.trim().replace(/^\[(.*)\]$/,"$1").replace(/\.$/,"").toLowerCase();if(t==="localhost"||t.endsWith(".localhost")||t==="::1"||t==="0:0:0:0:0:0:0:1")return!0;const n=t.split(".");if(n.length!==4||n.some(i=>!/^\d+$/.test(i)))return!1;const r=n.map(Number);return r.every(i=>i>=0&&i<=255)&&r[0]===127}function kl(e){const t=e.trim();return t.includes(":")&&!t.startsWith("[")?`[${t}]`:t}function jl(e,t){return t.protocol==="https:"&&e.secure!==!0?null:`${e.secure===!0?"wss":"ws"}://${kl(e.host)}:${e.port}`}function Bs(e){return wl(e.host)?0:e.source==="local_network"?1:e.source==="configured_host"?2:3}function Cl(e,t){const n=t?.port??e.port,r=t?.canonicalHost??e.canonicalHost;if(!r||typeof n!="number"||!Number.isFinite(n))return[];const i=Math.floor(n);return[{kind:"direct",host:r,port:i,source:"fallback",stability:"stable"},...[...t?.fallbackHosts??[],...e.fallbackHosts??[]].map(a=>({kind:"direct",host:a,port:i,source:"fallback",stability:"stable"}))]}function Nl(e,t,n=window.location,r=!0){if(r&&wr(n.hostname))return;const i=[...t?.connections??[],...e.connections??[],...Cl(e,t)].map(vl).filter(a=>!!a).filter(a=>a.kind==="direct").sort((a,l)=>Bs(a)-Bs(l));for(const a of i){const l=jl(a,n);if(l)return l}}function Il(e){if(!e.d||!e.c)return null;const t=Array.isArray(e.o)?e.o.map(Sl).filter(n=>!!n):void 0;return{daemonId:e.d,pairNonce:e.c,...e.n?{displayName:e.n}:{},...e.h?{canonicalHost:e.h}:{},...Number.isFinite(e.p)?{port:e.p}:{},...Array.isArray(e.f)?{fallbackHosts:e.f.filter(n=>typeof n=="string")}:{},...t?.length?{connections:t}:{},...e.e?{expiresAt:e.e}:{}}}function Rl(e){return!e.daemonId||!e.pairNonce?null:{daemonId:e.daemonId,displayName:e.displayName,canonicalHost:e.canonicalHost,fallbackHosts:e.fallbackHosts,port:e.port,connections:e.connections,pairNonce:e.pairNonce,expiresAt:e.expiresAt}}function Al(e=window.location.hash){const t=e.startsWith("#")?e.slice(1):e,n=new URLSearchParams(t).get(vr);if(!n)return null;try{const r=JSON.parse(xl(n));if(!rs(r))return null;if(r.t==="vp")return Il(r);if(r.type==="vibelet-pair")return Rl(r)}catch{return null}return null}function Tl(){if(!window.location.hash.includes(`${vr}=`))return;const e=`${window.location.pathname}${window.location.search}`;window.history.replaceState(null,"",e)}function El(e=window.localStorage){const t=e.getItem(qs);if(t)return t;const n=typeof crypto.randomUUID=="function"?crypto.randomUUID():`web_${Date.now().toString(36)}_${Math.random().toString(36).slice(2)}`;return e.setItem(qs,n),n}function Hs(e){const t=e.getItem(gt);if(!t)return null;try{const n=JSON.parse(t);return!n.daemonId||!n.deviceId||!n.pairToken?null:{daemonId:n.daemonId,displayName:n.displayName,deviceId:n.deviceId,pairToken:n.pairToken,pairedAt:n.pairedAt??new Date().toISOString(),webSocketUrl:typeof n.webSocketUrl=="string"?n.webSocketUrl:void 0}}catch{return null}}function is(e){if(typeof window>"u")return null;try{return e===window.localStorage?window.sessionStorage:null}catch{return null}}function Ml(e=window.localStorage,t=is(e)){const n=Hs(e);if(n)return n;const r=t?Hs(t):null;return r?(e.setItem(gt,JSON.stringify(r)),t?.removeItem(gt),r):null}function Ws(e,t=window.localStorage,n=is(t)){t.setItem(gt,JSON.stringify(e)),n?.removeItem(gt)}function kr(e=window.localStorage,t=is(e)){e.removeItem(gt),t?.removeItem(gt)}function Dl(e,t=Date.now()){if(!e.expiresAt)return!1;const n=new Date(e.expiresAt).getTime();return Number.isFinite(n)&&n<t}async function _l(e){const t=await e.text().catch(()=>"");try{const n=JSON.parse(t);if(rs(n)&&n.error==="pair_window_expired")return new yn("pair_window_expired","Pairing link expired.")}catch{}return new yn("pairing_failed",t||"Pairing failed.")}async function Pl(e,t=El()){if(Dl(e))throw new yn("pair_window_expired","Pairing link expired.");const n=await fetch("/pair/create",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({daemonId:e.daemonId,pairNonce:e.pairNonce,deviceId:t,deviceName:"Vibelet Web"})});if(!n.ok)throw await _l(n);const r=await n.json();return{daemonId:r.daemonId,displayName:r.displayName||e.displayName,deviceId:r.deviceId,pairToken:r.pairToken,pairedAt:new Date().toISOString(),webSocketUrl:Nl(e,r,window.location,!0)}}function Fl(e){return e.filter(t=>t.archived===!0).map(t=>t.sessionId)}function $l(e,t,n){return e.ok?{tone:"success",message:t.replace("{n}",String(e.archivedSessionIds.length))}:e.error==="timeout"?{tone:"error",message:n.timeout}:e.error==="not_connected"?{tone:"error",message:n.disconnected}:{tone:"error",message:n.generic.replace("{error}",e.error)}}async function Ll(e,t,n){if(!e?.isConnected)return{ok:!1,error:"not_connected"};try{const r=await e.request({action:"sessions.archiveSync",id:e.makeId("archive_sync"),mode:t,...t==="pull"?{}:{archivedSessionIds:n??[]}});return{ok:!0,archivedSessionIds:Array.isArray(r.archivedSessionIds)?r.archivedSessionIds.filter(i=>typeof i=="string"&&i.length>0):[]}}catch(r){return{ok:!1,error:r instanceof Error?r.message:String(r)}}}const jr="vibelet.web.savedTargets",Cr=12;function Ol(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function ql(e){if(!Ol(e)||typeof e.daemonId!="string"||typeof e.deviceId!="string"||typeof e.pairToken!="string"||typeof e.pairedAt!="string")return null;const t=typeof e.displayName=="string"?e.displayName:void 0,n=typeof e.label=="string"&&e.label.trim()?e.label.trim():t||e.daemonId.slice(0,10);return{daemonId:e.daemonId,deviceId:e.deviceId,pairToken:e.pairToken,pairedAt:e.pairedAt,displayName:t,webSocketUrl:typeof e.webSocketUrl=="string"?e.webSocketUrl:void 0,label:n,lastConnectedAt:typeof e.lastConnectedAt=="string"?e.lastConnectedAt:void 0}}function Nr(e){if(!Array.isArray(e))return[];const t=new Set,n=[];for(const r of e){const i=ql(r);if(!(!i||t.has(i.daemonId))&&(t.add(i.daemonId),n.push(i),n.length>=Cr))break}return n}function Bl(e=window.localStorage){const t=e.getItem(jr);if(!t)return[];try{return Nr(JSON.parse(t))}catch{return[]}}function Ir(e,t=window.localStorage){t.setItem(jr,JSON.stringify(Nr(e)))}function Hl(e,t,n=new Date().toISOString()){return[{...t,label:t.displayName||t.daemonId.slice(0,10),lastConnectedAt:n},...e.filter(i=>i.daemonId!==t.daemonId)].slice(0,Cr)}function Wl(e,t){return e.filter(n=>n.daemonId!==t)}const zn={version:"",latestVersion:"",loading:!1,error:null};function zs(e){const t=e.match(/^\d+/);return t?Number(t[0]):0}function zl(e,t){const n=e.split(/[+-]/,1)[0].split(".").map(zs),r=t.split(/[+-]/,1)[0].split(".").map(zs),i=Math.max(n.length,r.length);for(let a=0;a<i;a+=1){const l=n[a]??0,c=r[a]??0;if(l<c)return-1;if(l>c)return 1}return 0}function Ul(e,t){return zl(e,t)<0}function Gl(e){const t=e.toLowerCase();if(t.includes("alpha"))return"alpha";if(t.includes("beta"))return"beta";if(e.trim())return"latest"}function Vl(e,t,n){const r=e?.webSocketUrl?e.webSocketUrl:t.origin;try{const i=new URL(r);return i.protocol==="ws:"&&(i.protocol="http:"),i.protocol==="wss:"&&(i.protocol="https:"),i.pathname="/health",i.search="",i.hash="",i.toString()}catch{return new URL("/health",t.origin).toString()}}function Kl(e){if(!e||typeof e!="object")return{version:"",latestVersion:""};const t=e;return{version:typeof t.version=="string"?t.version.trim():"",latestVersion:typeof t.latestVersion=="string"?t.latestVersion.trim():""}}function Ql(e){const t=o.useCallback((d,w)=>{e.updateSessionListPreferences(u=>({...u,archiveSyncedDaemonIds:w==="synced"?{...u.archiveSyncedDaemonIds,[d]:!0}:u.archiveSyncedDaemonIds,archiveSyncCardDismissedDaemonIds:{...u.archiveSyncCardDismissedDaemonIds,[d]:!0}}))},[e]),n=o.useCallback((d,w)=>{const u=d==="pull"?e.t.archiveSyncSuccessPull:d==="pushMerge"?e.t.archiveSyncSuccessMerge:e.t.archiveSyncSuccessPush;if(e.setArchiveSyncStatus($l(w,u,{timeout:e.t.archiveSyncFailedTimeout,disconnected:e.t.archiveSyncFailedDisconnected,generic:e.t.archiveSyncFailedGeneric})),!w.ok)return;const x=new Set(w.archivedSessionIds);e.setSessions(M=>M.map(g=>({...g,archived:x.has(g.sessionId)}))),e.pairingRef.current?.daemonId&&t(e.pairingRef.current.daemonId,"synced"),e.requestSessions({force:!0})},[t,e]),r=o.useCallback(async d=>{if(e.archiveSyncBusy)return;e.setArchiveSyncBusy(d),e.setArchiveSyncStatus(null);const w=await Ll(e.clientRef.current,d,Fl(e.displaySessions));n(d,w),e.setArchiveSyncBusy(null)},[n,e]),i=o.useCallback(()=>{e.pairing?.daemonId&&(t(e.pairing.daemonId,"dismissed"),e.setArchiveSyncStatus({tone:"success",message:e.t.archiveSyncSkipped}))},[t,e]),a=o.useCallback(async d=>{const w=e.clientRef.current;if(w?.isConnected&&!(d==="update"&&!zt("Update desktop connector?"))&&!(d==="restart"&&!zt("Restart desktop connector?"))){e.setAdmin(u=>({...u,loading:!0,action:d,statusText:""})),e.setErrorText(null);try{if(d==="update"){const u=Gl(e.daemonMetadata.version),x=await w.request({action:"daemon.update",id:w.makeId("daemon_update"),...u?{channel:u}:{}});e.setAdmin(M=>({...M,loading:!1,action:null,statusText:x.alreadyRunning?"Connector update already running":"Connector update started"}));return}await w.request({action:"daemon.restart",id:w.makeId("daemon_restart")}),e.setAdmin(u=>({...u,loading:!1,action:null,statusText:"Connector restart requested"})),e.refreshDaemonMetadata()}catch(u){e.setAdmin(x=>({...x,loading:!1,action:null})),e.setErrorText(u instanceof Error?u.message:String(u))}}},[e]),l=o.useCallback(async()=>{if(!e.activeSession)return;const d=Go(e.activeSession,e.messages);Ko(Uo(We(e.activeSession),e.activeSession.sessionId),d),await navigator.clipboard?.writeText(d).catch(()=>{})},[e.activeSession,e.messages]),c=o.useCallback(async()=>{if(!("Notification"in window)){e.setNotificationPermission("unsupported"),e.setErrorText("Browser notifications are not supported.");return}const d=await Notification.requestPermission();e.notificationPermissionRef.current=d,e.setNotificationPermission(d),d==="granted"&&e.updateNotificationSettings({enabled:!0}),e.setStatusText(d==="granted"?"Browser notifications enabled":"Browser notifications not enabled")},[e]),m=o.useCallback(()=>{zt("Forget this browser pairing?")&&(e.intentionalDisconnectRef.current=!0,e.connectionAttemptIdRef.current+=1,kr(),e.clientRef.current?.disconnect(),e.historyCacheRef.current={},e.historyCacheDaemonIdRef.current=null,e.messagesSessionIdRef.current=null,e.lastHistorySessionIdRef.current=null,e.setMessages([]),e.setPairing(null),e.setDaemonMetadata(zn),e.setPhase("missing-pair"),e.setStatusText(e.t.missingPair))},[e]),f=o.useCallback(d=>{if(d&&e.notificationPermission==="default"){c();return}e.updateNotificationSettings({enabled:d})},[e,c]),y=o.useCallback(d=>{e.connectWithPairingRef.current(d,!0)},[e]),v=o.useCallback(d=>e.saveTargets(Wl(e.savedTargets,d)),[e]),p=o.useCallback(d=>{e.setActiveSessionId(d.sessionId),e.setRenameTitle(d.customTitle??d.title??""),e.setDetailsOpen(!0)},[e]),S=o.useCallback((d,w)=>{const u=ia(w);e.updateSessionListPreferences(x=>({...x,directoryTags:aa(x.directoryTags,d,u)}))},[e]),I=o.useCallback(d=>{e.setControlTab("files"),e.listDirectory(d,{updateRoute:!0})},[e]),b=o.useCallback(d=>{navigator.clipboard?.writeText(pr(d)).catch(()=>{})},[]);return{runArchiveSync:r,skipArchiveSync:i,runAdminAction:a,exportActiveSession:l,clearPairing:m,setNotificationsEnabled:f,connectSavedTarget:y,forgetSavedTarget:v,openSessionDetails:p,editFolderTags:S,browseFolder:I,copyResumeCommand:b}}function Us(e){return`${e}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function Jl(e,t=window.location,n=!0){const i=`${t.protocol==="https:"?"wss:":"ws:"}//${t.host}`;return n&&wr(t.hostname)?i:e?.webSocketUrl?e.webSocketUrl:i}class Yl{socket=null;pending=new Map;messageListeners=new Set;closeListeners=new Set;async connect(t){this.disconnect();const n=new WebSocket(Jl(t));this.socket=n;const r=new Promise((i,a)=>{n.onopen=()=>i(),n.onerror=()=>a(new Error("WebSocket connection failed."))});return n.onmessage=i=>this.handleSocketMessage(i.data),n.onclose=()=>{this.socket===n&&(this.socket=null),this.rejectPending(new Error("WebSocket disconnected.")),this.closeListeners.forEach(i=>i())},await r,await this.request({action:"auth.hello",id:Us("auth"),pairToken:t.pairToken,daemonId:t.daemonId,deviceId:t.deviceId,locale:navigator.language})}request(t,n={}){return!this.socket||this.socket.readyState!==WebSocket.OPEN?Promise.reject(new Error("WebSocket is not connected.")):new Promise((r,i)=>{const a={resolve:r,reject:i};n.timeoutMs&&n.timeoutMs>0&&(a.timeoutId=setTimeout(()=>{this.pending.delete(t.id),i(new Error(n.timeoutMessage||"Request timed out."))},n.timeoutMs)),this.pending.set(t.id,a),this.socket?.send(JSON.stringify(t))})}send(t){this.socket?.readyState===WebSocket.OPEN&&this.socket.send(JSON.stringify(t))}onMessage(t){return this.messageListeners.add(t),()=>this.messageListeners.delete(t)}onClose(t){return this.closeListeners.add(t),()=>this.closeListeners.delete(t)}disconnect(){this.rejectPending(new Error("WebSocket disconnected.")),this.socket?.close(1e3,"client disconnect"),this.socket=null}get isConnected(){return this.socket?.readyState===WebSocket.OPEN}makeId(t){return Us(t)}handleSocketMessage(t){if(typeof t!="string")return;let n;try{n=JSON.parse(t)}catch{return}if(n.type!=="pong"){if(n.type==="response"){const r=this.pending.get(n.id);if(r){this.pending.delete(n.id),r.timeoutId&&clearTimeout(r.timeoutId),n.ok?r.resolve(n.data):r.reject(new Error(n.error||"Request failed."));return}}this.messageListeners.forEach(r=>r(n))}}rejectPending(t){for(const n of this.pending.values())n.timeoutId&&clearTimeout(n.timeoutId),n.reject(t);this.pending.clear()}}const Rr="vibelet.web.sessionListCache",Ar=120;function Zl(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Xl(e){if(!Zl(e)||typeof e.daemonId!="string"||!e.daemonId)return null;const t=hr(e.page);return{daemonId:e.daemonId,page:{...t,sessions:t.sessions.slice(0,Ar)},cachedAt:typeof e.cachedAt=="string"?e.cachedAt:new Date(0).toISOString()}}function ed(e,t=window.localStorage){if(!e)return null;try{const n=t.getItem(Rr);if(!n)return null;const r=Xl(JSON.parse(n));return r?.daemonId===e?r.page:null}catch{return null}}function td(e,t,n=window.localStorage,r=new Date().toISOString()){if(!e)return;const i={daemonId:e,page:{...t,sessions:t.sessions.slice(0,Ar)},cachedAt:r};n.setItem(Rr,JSON.stringify(i))}function nd(e){return e instanceof Error&&e.message==="auth_failed"}function sd(e,t){return e instanceof yn&&e.code==="pair_window_expired"?t.pairingLinkExpired:e instanceof Error?e.message:String(e)}function rd(e){const t=o.useRef(null),n=o.useRef(e);n.current=e;const r=o.useCallback(a=>{const l=n.current,c=a??l.pairingRef.current;!c||l.intentionalDisconnectRef.current||(l.reconnectTimerRef.current&&window.clearTimeout(l.reconnectTimerRef.current),l.reconnectTimerRef.current=window.setTimeout(()=>{l.reconnectTimerRef.current=null,l.connectWithPairingRef.current(c,!0)},Po))},[]),i=o.useCallback(async(a,l=!1)=>{const c=n.current;c.reconnectTimerRef.current&&(window.clearTimeout(c.reconnectTimerRef.current),c.reconnectTimerRef.current=null),c.intentionalDisconnectRef.current=!1,c.setPhase("connecting"),c.setStatusText(l?c.t.reconnectingToDaemon:c.t.connectingToDaemon),c.setErrorText(null);const m=new Yl,f=c.connectionAttemptIdRef.current+1;c.connectionAttemptIdRef.current=f;const y=c.clientRef.current;c.clientRef.current=m,y?.disconnect();const v=()=>c.connectionAttemptIdRef.current===f&&c.clientRef.current===m;m.onMessage(c.handleServerMessage),m.onClose(()=>{c.clientRef.current===m&&(c.clientRef.current=null,!c.intentionalDisconnectRef.current&&(c.setPhase("connecting"),c.setStatusText(c.t.reconnectingToDaemon),c.setErrorText(c.t.webSocketClosedRetrying),r(c.pairingRef.current??a)))});try{let p=a,S;try{S=await m.connect(a)}catch(d){if(!a.webSocketUrl)throw d;p={...a,webSocketUrl:void 0},c.setStatusText(c.t.reconnectingToDaemon),S=await m.connect(p)}if(!v())return;const I={...p,displayName:S.displayName??p.displayName};c.historyCacheDaemonIdRef.current&&c.historyCacheDaemonIdRef.current!==I.daemonId&&(c.historyCacheRef.current={},c.messagesSessionIdRef.current=null,c.lastHistorySessionIdRef.current=null,c.setMessages([])),c.historyCacheDaemonIdRef.current=I.daemonId,c.setPairing(I),c.pairingRef.current=I,Ws(I);const b=ed(I.daemonId);b&&c.setSessionsFromPage(b,!1),c.setSavedTargets(d=>{const w=Hl(d,I);return Ir(w),w}),c.setPhase("connected"),c.setStatusText(c.t.connectedTo(S.displayName??a.displayName??"Vibelet Daemon")),c.refreshDaemonMetadata(I),await c.requestReconnectSnapshot(),await c.fetchAgentResources(c.agent,c.cwd),c.reportLog("web.connected",{reconnecting:l})}catch(p){if(!v())return;nd(p)&&kr(),c.setPhase("error"),c.setStatusText(c.t.connectionFailed),c.setErrorText(p instanceof Error?p.message:String(p)),r(a)}},[r]);o.useEffect(()=>{const a=n.current;a.connectWithPairingRef.current=i},[i]),o.useEffect(()=>{const a=n.current;let l=!1;async function c(){const m=Al(),y=Ml()??a.rememberedTarget;if(!m&&!y){a.setPhase("missing-pair"),a.setStatusText(a.t.missingPair);return}try{a.setPhase("pairing"),m&&t.current?.pairNonce!==m.pairNonce&&(t.current={pairNonce:m.pairNonce,promise:Pl(m)});const v=m?await t.current?.promise:y;if(!v||l)return;m&&(Ws(v),t.current=null,Tl()),await a.connectWithPairingRef.current(v)}catch(v){if(l)return;m&&(t.current=null),a.setPhase("error"),a.setStatusText(a.t.pairingFailed),a.setErrorText(sd(v,a.t))}}return c(),()=>{l=!0,a.intentionalDisconnectRef.current=!0,a.connectionAttemptIdRef.current+=1,a.reconnectTimerRef.current&&window.clearTimeout(a.reconnectTimerRef.current),a.clientRef.current?.disconnect()}},[e.t]),o.useEffect(()=>{const a=n.current;if(a.phase!=="connected")return;const l=window.setTimeout(()=>{a.requestSessions({force:!0}).catch(c=>a.setErrorText(c instanceof Error?c.message:String(c)))},260);return()=>window.clearTimeout(l)},[e.phase,e.requestSessions,e.search,e.sinceFilter]),o.useEffect(()=>{const a=n.current;a.phase==="connected"&&a.fetchAgentResources(a.agent,a.cwd)},[e.agent,e.cwd,e.fetchAgentResources,e.phase])}function On(e){return typeof e=="string"&&e.trim().length>0?e:void 0}function id(e=window.location.search){const t=new URLSearchParams(e),n=On(t.get("folder")),r=On(t.get("file")),i=On(t.get("cwd"));return{...n?{folder:n}:{},...r?{file:r}:{},...i?{cwd:i}:{}}}function ad(e,t,n=[]){const r=new URLSearchParams(e);for(const a of n)r.delete(a);for(const[a,l]of Object.entries(t))l?r.set(a,l):r.delete(a);const i=r.toString();return i?`?${i}`:""}function Gs(e,t={}){const n=t.history??window.history,r=t.location??window.location,i=[];e.folder&&i.push("file","cwd"),e.file&&i.push("folder");const a=ad(r.search,e,i),l=`${r.pathname}${a}${r.hash}`;if(t.replace){n.replaceState(null,"",l);return}n.pushState(null,"",l)}function od(e){const{clientRef:t,pairing:n,cwd:r,phase:i,controlTab:a,setControlTab:l,setBusy:c,setErrorText:m,t:f}=e,y=o.useRef(!1),[v,p]=o.useState([]),[S,I]=o.useState(!1),[b,d]=o.useState({path:Be,entries:[],loading:!1,loaded:!1}),[w,u]=o.useState(""),[x,M]=o.useState(null),[g,R]=o.useState(!1),[k,U]=o.useState("edit"),fe=o.useCallback(async D=>{if(!(!D?.length||!n)){I(!0),m(null);try{const E=[];for(const q of Array.from(D)){const P=await fetch(`/upload?name=${encodeURIComponent(q.name)}`,{method:"POST",headers:{authorization:`Bearer ${n.pairToken}`,"content-type":q.type||"application/octet-stream"},body:q});if(!P.ok)throw new Error(await P.text().catch(()=>f.uploadFailed)||f.uploadFailed);const ie=Oo(await P.json());if(!ie)throw new Error(f.uploadPathMissing);E.push({path:ie,name:q.name,type:q.type||"application/octet-stream",size:q.size})}p(q=>[...q,...E])}catch(E){m(E instanceof Error?E.message:String(E))}finally{I(!1)}}},[n,m,f.uploadFailed,f.uploadPathMissing]),J=o.useCallback(async(D,E,q)=>{if(n){m(null);try{x?.objectUrl&&URL.revokeObjectURL(x.objectUrl);const P=await fetch(Fn(D,E),{headers:{authorization:`Bearer ${n.pairToken}`}});if(!P.ok)throw new Error(await P.text().catch(()=>f.fileOpenFailed)||f.fileOpenFailed);const ie=P.headers.get("content-type")??"application/octet-stream";if(Wo(D,ie))M({path:D,cwd:E,kind:"text",contentType:ie,text:await P.text(),etag:dn(P.headers,"etag"),lastModified:dn(P.headers,"last-modified"),size:Number(P.headers.get("content-length"))||void 0,dirty:!1});else{const ye=await P.blob();M({path:D,cwd:E,kind:zo(D,ie)?"image":"binary",contentType:ie,text:"",objectUrl:URL.createObjectURL(ye),etag:dn(P.headers,"etag"),lastModified:dn(P.headers,"last-modified"),size:ye.size,dirty:!1})}R(!1),U("edit"),l("files"),q?.updateRoute&&Gs({file:D,...E?{cwd:E}:{}},{replace:q.replaceRoute})}catch(P){m(P instanceof Error?P.message:String(P))}}},[n,x?.objectUrl,l,m]),he=o.useCallback(async D=>{if(!(!n||!x||x.kind!=="text")){c(!0),m(null);try{const E=await fetch(Fn(x.path,x.cwd),{method:"PUT",headers:{authorization:`Bearer ${n.pairToken}`,"content-type":"text/markdown; charset=utf-8",...x.etag&&!D?.force?{"if-match":x.etag}:{}},body:x.text});if(!E.ok)throw E.status===409?(R(!0),new Error(f.remoteFileConflict(x.path))):new Error(await E.text().catch(()=>f.fileSaveFailed)||f.fileSaveFailed);R(!1);const q=await E.json().catch(()=>({}));M(P=>P&&{...P,dirty:!1,etag:typeof q.etag=="string"?q.etag:P.etag,lastModified:typeof q.lastModified=="string"?q.lastModified:P.lastModified,size:typeof q.size=="number"?q.size:P.size})}catch(E){m(E instanceof Error?E.message:String(E))}finally{c(!1)}}},[n,x,c,m]),se=o.useCallback(async()=>{if(!(!n||!x))try{const D=await fetch(Fn(x.path,x.cwd),{headers:{authorization:`Bearer ${n.pairToken}`}});if(!D.ok)throw new Error(f.downloadFailed);const E=URL.createObjectURL(await D.blob()),q=document.createElement("a");q.href=E,q.download=Sn(x.path),q.click(),URL.revokeObjectURL(E)}catch(D){m(D instanceof Error?D.message:String(D))}},[n,x,m]),$=o.useCallback(async(D=b.path,E)=>{const q=t.current;if(q?.isConnected){d(P=>({...P,path:D,loading:!0,loaded:!1,error:void 0}));try{const P=await q.request({action:"dirs.list",id:q.makeId("dirs"),path:D,cwd:r||void 0});d({path:D,entries:P.entries??[],loading:!1,loaded:!0}),E?.updateRoute&&Gs({folder:D},{replace:E.replaceRoute})}catch(P){d(ie=>({...ie,loading:!1,loaded:!0,error:P instanceof Error?P.message:String(P)}))}}},[t,r,b.path]),re=o.useCallback(async D=>{const E=t.current;if(!E?.isConnected)throw new Error(f.webSocketNotConnected);return((await E.request({action:"dirs.list",id:E.makeId("dirs"),path:D,cwd:r||void 0},{timeoutMs:1e4,timeoutMessage:f.directoryListTimedOut})).entries??[]).filter(P=>P.isDirectory)},[t,r]);o.useEffect(()=>{a!=="files"||i!=="connected"||b.loading||b.loaded||$(b.path||r||Be)},[a,r,b.loaded,b.loading,b.path,$,i]),o.useEffect(()=>{if(i!=="connected"||y.current)return;const D=id();if(!D.folder&&!D.file){y.current=!0;return}if(y.current=!0,l("files"),D.folder){$(D.folder,{updateRoute:!1});return}D.file&&(D.cwd&&d(E=>({...E,path:D.cwd,loaded:!1})),J(D.file,D.cwd,{updateRoute:!1}))},[$,J,i,l]);const ge=o.useCallback(async()=>{const D=t.current;if(!(!D?.isConnected||w.trim().length===0)){c(!0),m(null);try{await D.request({action:"dirs.create",id:D.makeId("mkdir"),path:Hn(b.path,w),cwd:r||void 0}),u(""),await $(b.path)}catch(E){m(E instanceof Error?E.message:String(E))}finally{c(!1)}}},[t,r,b.path,$,w,c,m]),je=o.useCallback(async D=>{const E=t.current;if(!E?.isConnected)throw new Error(f.webSocketNotConnected);await E.request({action:"dirs.create",id:E.makeId("mkdir"),path:D,cwd:r||void 0},{timeoutMs:1e4,timeoutMessage:f.directoryCreationTimedOut})},[t,r]);return{attachments:v,setAttachments:p,uploadBusy:S,directory:b,setDirectory:d,newDirName:w,setNewDirName:u,remoteFile:x,setRemoteFile:M,remoteFileConflict:g,remoteFileMode:k,setRemoteFileMode:U,uploadFiles:fe,openRemoteFile:J,saveRemoteFile:he,downloadRemoteFile:se,listDirectory:$,listSessionDirectories:re,createDirectory:ge,createSessionDirectory:je}}function cd({clientRef:e,setSessions:t}){return o.useCallback(async n=>{const r=e.current;if(!r?.isConnected)return;const i=[...new Set(n.map(a=>a.cwd).filter(Boolean))];if(i.length!==0)try{const a=await r.request({action:"sessions.gitMetadata",id:r.makeId("git"),cwds:i});t(l=>l.map(c=>({...c,branch:a.branches[c.cwd]??c.branch,diffStat:a.diffStats[c.cwd]??c.diffStat})))}catch{}},[])}function wn(e,t){return!!t&&Object.hasOwn(e,t)}function ld(e,t){const n=e.map(r=>({...r}));return t?es(n,t):n}function dd(e,t,n){return t?{...e,[t]:n.map(r=>({...r}))}:e}function Tr(e,t,n){return!t||n.length===0?e:{...e,[t]:[...e[t]??[],...n.map(r=>({...r}))]}}function ud(e,t,n){return n.historyKey&&e[t]?.some(r=>r.historyKey===n.historyKey)?e:Tr(e,t,[n])}function fd(e,t,n){return!t||!n?e:{...e,[t]:es(e[t]??[],n)}}function hd(e,t,n){if(!t||!n||t===n||!wn(e,t))return e;const r={...e};return r[n]=e[t],delete r[t],r}function md(e,t){if(!wn(e,t))return e;const n={...e};return delete n[t],n}const Un=15e3,Vs=500,Ks=1e3;function pd(e){const t=o.useRef({}),n=o.useRef(null),r=o.useRef({}),i=o.useRef(null),[a,l]=o.useState(!1),[c,m]=o.useState([]),f=o.useCallback(g=>g&&n.current&&n.current!==g?!1:(n.current=null,l(!1),!0),[]),y=o.useCallback(g=>wn(t.current,g)?(i.current=g,m(t.current[g]??[]),!0):!1,[]),v=o.useCallback((g,R,k)=>{t.current=dd(t.current,g,R);const U=t.current[g]??[];return k?.renderActive!==!1&&g===e.activeSessionIdRef.current&&(i.current=g,m(U)),U},[e.activeSessionIdRef]),p=o.useCallback((g,R,k)=>{if(!k)return r.current[g]=void 0,v(g,R);const U=r.current[g];return r.current[g]=k.start,U===void 0||k.start>=U?v(g,R):v(g,[...R,...t.current[g]??[]])},[v]),S=o.useCallback((g,R)=>{const k=v(g,R,{renderActive:!1});i.current=g,m(k)},[v]),I=o.useCallback((g,R)=>{t.current=Tr(t.current,g,R),g===e.activeSessionIdRef.current&&(i.current=g,m(t.current[g]??[]))},[e.activeSessionIdRef]),b=o.useCallback((g,R)=>{t.current=ud(t.current,g,R),g===e.activeSessionIdRef.current&&(i.current=g,m(t.current[g]??[]))},[e.activeSessionIdRef]),d=o.useCallback((g,R)=>{t.current=fd(t.current,g,R),g===e.activeSessionIdRef.current&&(i.current=g,m(t.current[g]??[]))},[e.activeSessionIdRef]),w=o.useCallback((g,R)=>{I(g,[{role:"assistant",type:"info",content:R,timestamp:new Date().toISOString()}])},[I]),u=o.useCallback(g=>{t.current=md(t.current,g),delete r.current[g]},[]),x=o.useCallback((g,R)=>{t.current=hd(t.current,g,R),r.current[R]=r.current[g],delete r.current[g]},[]),M=o.useCallback(async g=>{const R=e.clientRef.current;if(R?.isConnected){if(y(g.sessionId)){f(g.sessionId);return}n.current=g.sessionId,delete r.current[g.sessionId],l(!0),e.setErrorText(null);try{await R.request({action:"session.history",id:R.makeId("history"),sessionId:g.sessionId,agent:g.agent,limit:Vs},{timeoutMessage:e.historyTimeoutMessage,timeoutMs:Un});let k=r.current[g.sessionId];for(;typeof k=="number"&&k>0&&(t.current[g.sessionId]?.length??0)<Ks;){const U=t.current[g.sessionId]?.length??0;await R.request({action:"session.history",id:R.makeId("history_older"),sessionId:g.sessionId,agent:g.agent,before:k,limit:Math.min(Vs,Ks-U)},{timeoutMessage:e.historyTimeoutMessage,timeoutMs:Un});const fe=r.current[g.sessionId];if(typeof fe!="number"||fe>=k)break;k=fe}}catch(k){n.current===g.sessionId&&e.setErrorText(k instanceof Error?k.message:String(k))}finally{f(g.sessionId)}}},[f,e.clientRef,e.historyTimeoutMessage,e.setErrorText,y]);return{appendCachedDelta:d,appendCachedHistory:I,appendInfoMessage:w,clearHistoryLoading:f,ensureCachedHistoryEntry:b,historyCacheRef:t,historyLoading:a,hydrateVisibleHistory:S,messages:c,messagesSessionIdRef:i,mergeCachedHistoryPage:p,remapCachedHistory:x,removeCachedHistory:u,renderCachedHistory:y,replaceCachedHistory:v,requestHistory:M,setMessages:m}}function Qs(e,t,n){return Math.min(Math.max(Math.round(e),t),n)}function gd(e){return{workspaceClassName:["workspace",e.leftCollapsed&&"left-sidebar-collapsed"].filter(Boolean).join(" "),wideMainClassName:["wide-main",e.rightCollapsed&&"right-sidebar-collapsed"].filter(Boolean).join(" "),style:{"--left-pane-width":`${e.leftPaneWidth}px`,"--right-pane-width":`${e.rightPaneWidth}px`}}}const It=.9,yd=Math.round(280*It),bd=Math.round(560*It),xd=Math.round(260*It),Sd=Math.round(520*It),vd=Math.round(320*It),wd=Math.round(330*It);function kd(e,t){const[n,r]=o.useState(e),[i,a]=o.useState(""),[l,c]=o.useState(e.sessionList.searchHistory),[m,f]=o.useState(e.sessionList.sinceFilter),[y,v]=o.useState(e.sessionList.hideArchived),[p,S]=o.useState(e.sessionList.groupFolders),[I,b]=o.useState(e.sessionList.showNeedsAttentionGroup),[d,w]=o.useState(e.sessionList.showRunningGroup),[u,x]=o.useState(e.sessionList.separatePinnedGroup),[M,g]=o.useState(e.sessionList.collapsedFolders),[R,k]=o.useState(e.sessionList.agentFilter),[U,fe]=o.useState(t),[J,he]=o.useState(e.layout.leftSidebarCollapsed),[se,$]=o.useState(e.layout.rightSidebarCollapsed),[re,ge]=o.useState(vd),[je,D]=o.useState(wd),E=n.sessionList.directoryTags,q=n.sessionList.archiveSyncedDaemonIds,P=n.sessionList.archiveSyncCardDismissedDaemonIds,ie=n.composer,ye=gd({leftCollapsed:J,rightCollapsed:se,leftPaneWidth:re,rightPaneWidth:je}),ze=o.useCallback(W=>V=>{V.preventDefault();const K=V.clientX,oe=re,le=je,be=Ae=>{const G=Ae.clientX-K;if(W==="left"){ge(Qs(oe+G,yd,bd));return}D(Qs(le-G,xd,Sd))},xe=()=>{document.body.classList.remove("pane-resizing"),window.removeEventListener("pointermove",be),window.removeEventListener("pointerup",xe)};document.body.classList.add("pane-resizing"),window.addEventListener("pointermove",be),window.addEventListener("pointerup",xe,{once:!0})},[re,je]);o.useEffect(()=>{r(W=>{const V={...W,sessionList:{...W.sessionList,searchHistory:l,sinceFilter:m,hideArchived:y,groupFolders:p,showNeedsAttentionGroup:I,showRunningGroup:d,separatePinnedGroup:u,collapsedFolders:M,agentFilter:R},layout:{...W.layout,leftSidebarCollapsed:J,rightSidebarCollapsed:se}};return Lt(V),V})},[M,p,y,J,se,l,u,R,I,d,m]);const Re=o.useCallback(()=>{c(W=>oa(W,i))},[i]),Z=o.useCallback(W=>{fe(W),Ir(W)},[]),X=o.useCallback(W=>{r(V=>{const K={...V,language:W};return Lt(K),K})},[]),ke=o.useCallback(W=>{r(V=>{const K={...V,theme:W};return Lt(K),K})},[]),Me=o.useCallback(W=>{r(V=>{const K={...V,sessionList:W(V.sessionList)};return Lt(K),K})},[]),ae=o.useCallback(W=>{r(V=>{const K={...V,composer:W(V.composer)};return Lt(K),K})},[]);return{webPreferences:n,search:i,setSearch:a,sinceFilter:m,setSinceFilter:f,hideArchived:y,setHideArchived:v,groupFolders:p,setGroupFolders:S,showNeedsAttentionGroup:I,setShowNeedsAttentionGroup:b,showRunningGroup:d,setShowRunningGroup:w,separatePinnedGroup:u,setSeparatePinnedGroup:x,collapsedFolders:M,setCollapsedFolders:g,sessionAgentFilter:R,setSessionAgentFilter:k,directoryTags:E,archiveSyncedDaemonIds:q,archiveSyncCardDismissedDaemonIds:P,composerPreferences:ie,savedTargets:U,setSavedTargets:fe,leftSidebarCollapsed:J,setLeftSidebarCollapsed:he,rightSidebarCollapsed:se,setRightSidebarCollapsed:$,workspaceClassName:ye.workspaceClassName,wideMainClassName:ye.wideMainClassName,workspaceStyle:ye.style,beginPaneResize:ze,commitSearch:Re,saveTargets:Z,setLanguagePreference:X,setThemePreference:ke,updateSessionListPreferences:Me,updateComposerPreferences:ae}}function pt(e,t,n){const r=new Set(e);return n?r.add(t):r.delete(t),r}function jd(e){const t=o.useCallback((n,r,i,a,l)=>{const c=e.notificationSettingsRef.current;if(!c[a]||e.notifiedEventsRef.current.has(n))return;Zo(r,i,{onClick:()=>{window.focus(),l&&e.setActiveSessionId(l)},permission:e.notificationPermissionRef.current,settings:c,tag:n,visibilityState:document.visibilityState})&&e.notifiedEventsRef.current.add(n)},[e]);return o.useCallback(n=>{switch(n.type){case"response":{Wt(n.data)&&typeof n.data.oldSessionId=="string"&&typeof n.data.sessionId=="string"&&e.remapLocalSessionState(n.data.oldSessionId,n.data.sessionId);break}case"sessions.changed":e.requestSessions({force:!0}).catch(r=>e.setErrorText(r instanceof Error?r.message:String(r)));break;case"session.history":e.clearHistoryLoading(n.sessionId),e.mergeCachedHistoryPage(n.sessionId,ld(n.messages,n.partialReplyText),n.historyPage),n.sessionId===e.activeSessionIdRef.current&&(e.setPendingQueues(r=>({...r,[n.sessionId]:n.pendingQueue??[]})),e.setPendingApprovals(r=>{const i={...r};return n.pendingApproval?i[n.sessionId]={type:"approval.request",sessionId:n.sessionId,...n.pendingApproval}:delete i[n.sessionId],i}),e.setPendingQuestions(r=>{const i={...r};if(n.pendingQuestion){const a={type:"question.request",sessionId:n.sessionId,...n.pendingQuestion};i[n.sessionId]=a,e.setQuestionAnswers(Bn(a))}else delete i[n.sessionId];return i})),e.setRespondingSessions(r=>{const i=pt(r,n.sessionId,!!(n.isResponding||n.externallyResponding));return e.respondingSessionsRef.current=i,i});break;case"session.history.append":e.appendCachedHistory(n.sessionId,n.messages);break;case"text.delta":e.appendCachedDelta(n.sessionId,n.content),e.respondingSessionsRef.current=pt(e.respondingSessionsRef.current,n.sessionId,!0),e.setRespondingSessions(r=>pt(r,n.sessionId,!0));break;case"tool.call":e.appendCachedHistory(n.sessionId,[{role:"tool",type:"info",toolName:n.toolName,toolInput:n.input,content:`${e.t.toolCallLabel}: ${n.toolName}
10
-
11
- ${mr(n.input)}`,timestamp:new Date().toISOString()}]);break;case"tool.result":e.appendCachedHistory(n.sessionId,[{role:"tool",type:"info",content:n.output,timestamp:new Date().toISOString()}]);break;case"approval.request":e.setPendingApprovals(r=>({...r,[n.sessionId]:n})),e.setActiveSessionId(n.sessionId),t(`approval:${n.sessionId}:${n.requestId}`,e.t.notificationApprovalTitle,n.description||n.toolName,"approvals",n.sessionId);break;case"question.request":e.setPendingQuestions(r=>({...r,[n.sessionId]:n})),e.setQuestionAnswers(Bn(n)),e.setActiveSessionId(n.sessionId),t(`question:${n.sessionId}:${n.requestId}`,e.t.notificationQuestionTitle,e.t.notificationQuestionCount(n.questions.length),"questions",n.sessionId);break;case"question.cleared":e.setPendingQuestions(r=>{const i={...r};return i[n.sessionId]?.requestId===n.requestId&&delete i[n.sessionId],i});break;case"session.queue":e.setPendingQueues(r=>({...r,[n.sessionId]:n.pending}));break;case"session.stall_warning":e.setSessions(r=>r.map(i=>i.sessionId===n.sessionId?{...i,stallWarning:n.warning}:i));break;case"session.interrupted_notice":e.setSessions(r=>r.map(i=>i.sessionId===n.sessionId?{...i,interruptReason:n.reason,stallWarning:void 0}:i));break;case"session.done":if(e.respondingSessionsRef.current.has(n.sessionId)){const r=(e.turnNotificationCountsRef.current[n.sessionId]??0)+1;e.turnNotificationCountsRef.current[n.sessionId]=r,t(`done:${n.sessionId}:${r}`,e.t.notificationReplyTitle,e.t.notificationReplyBody,"replies",n.sessionId)}e.respondingSessionsRef.current=pt(e.respondingSessionsRef.current,n.sessionId,!1),e.setRespondingSessions(r=>pt(r,n.sessionId,!1)),n.sessionId===e.activeSessionIdRef.current&&(e.setPendingApprovals(r=>{const i={...r};return delete i[n.sessionId],i}),e.setPendingQuestions(r=>{const i={...r};return delete i[n.sessionId],i})),n.usage&&e.setSessions(r=>r.map(i=>i.sessionId===n.sessionId?{...i,lastUsage:n.usage}:i)),e.requestSessions({force:!0}).catch(r=>e.setErrorText(r instanceof Error?r.message:String(r)));break;case"session.interrupted":e.respondingSessionsRef.current=pt(e.respondingSessionsRef.current,n.sessionId,!1),e.setRespondingSessions(r=>pt(r,n.sessionId,!1)),e.requestSessions({force:!0}).catch(r=>e.setErrorText(r instanceof Error?r.message:String(r)));break;case"session.renamed":e.setSessions(r=>r.map(i=>i.sessionId===n.sessionId?{...i,customTitle:n.title}:i));break;case"error":e.setErrorText(n.message);break}},[e,t])}const Er="vibelet.web.composerDrafts",Gn={draftsBySessionId:{},newSessionDraft:""};function Js(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Mr(e){return Js(e)?{draftsBySessionId:Js(e.draftsBySessionId)?Object.fromEntries(Object.entries(e.draftsBySessionId).filter(n=>typeof n[1]=="string")):{},newSessionDraft:typeof e.newSessionDraft=="string"?e.newSessionDraft:""}:Gn}function Cd(e=window.localStorage){const t=e.getItem(Er);if(!t)return Gn;try{return Mr(JSON.parse(t))}catch{return Gn}}function Ut(e,t=window.localStorage){t.setItem(Er,JSON.stringify(Mr(e)))}function Qt(e,t,n){if(!t)return{...e,newSessionDraft:n};const r={...e.draftsBySessionId};return n.trim()?r[t]=n:delete r[t],{...e,draftsBySessionId:r}}function Gt(e,t){return t?e.draftsBySessionId[t]??"":e.newSessionDraft}function Nd(e,t,n){if(!t||!n||t===n)return e;const r=e.draftsBySessionId[t];if(r===void 0)return e;const i={...e.draftsBySessionId};return delete i[t],r.trim()&&(i[n]=r),{...e,draftsBySessionId:i}}function Id(e,t,n,r=!1){if(!r)return{...e,[t]:[n]};const i=e[t]??[],a=i.includes(n)?i.filter(l=>l!==n):[...i,n];return{...e,[t]:a}}function Rd(e){const t=o.useCallback(async d=>{const w=e.clientRef.current;if(!(!w?.isConnected||!e.activeApproval)){e.setBusy(!0),e.setErrorText(null);try{await w.request({action:"session.approve",id:w.makeId("approve"),sessionId:e.activeApproval.sessionId,requestId:e.activeApproval.requestId,approved:d}),e.setPendingApprovals(u=>{const x={...u};return delete x[e.activeApproval.sessionId],x})}catch(u){e.setErrorText(u instanceof Error?u.message:String(u))}finally{e.setBusy(!1)}}},[e]),n=o.useCallback(async()=>{const d=e.clientRef.current;if(!(!d?.isConnected||!e.activeQuestion)){e.setBusy(!0),e.setErrorText(null);try{await d.request({action:"session.respondQuestion",id:d.makeId("question"),sessionId:e.activeQuestion.sessionId,requestId:e.activeQuestion.requestId,answers:e.questionAnswers}),e.setPendingQuestions(w=>{const u={...w};return delete u[e.activeQuestion.sessionId],u})}catch(w){e.setErrorText(w instanceof Error?w.message:String(w))}finally{e.setBusy(!1)}}},[e]),r=o.useCallback(async()=>{const d=e.clientRef.current;if(!(!d?.isConnected||!e.activeQuestion)){e.setBusy(!0),e.setErrorText(null);try{await d.request({action:"session.cancelQuestion",id:d.makeId("cancel_question"),sessionId:e.activeQuestion.sessionId,requestId:e.activeQuestion.requestId}),e.setPendingQuestions(w=>{const u={...w};return delete u[e.activeQuestion.sessionId],u})}catch(w){e.setErrorText(w instanceof Error?w.message:String(w))}finally{e.setBusy(!1)}}},[e]),i=o.useCallback((d,w,u)=>{e.setQuestionAnswers(x=>Id(x,d,w,!!u))},[e]),a=o.useCallback(async d=>{const w=e.clientRef.current;if(!w?.isConnected||!e.activeSession||d==="session.delete"&&!zt(`Delete ${We(e.activeSession)}?`))return!1;e.setBusy(!0),e.setErrorText(null);try{return d==="session.resume"?await w.request({action:d,id:w.makeId("resume"),sessionId:e.activeSession.sessionId,agent:e.activeSession.agent}):await w.request({action:d,id:w.makeId(d.split(".").at(-1)??"session"),sessionId:e.activeSession.sessionId}),d==="session.delete"&&(e.removeCachedHistory(e.activeSession.sessionId),e.setActiveSessionId(null),e.messagesSessionIdRef.current=null,e.lastHistorySessionIdRef.current=null,e.setMessages([])),await e.requestSessions({force:!0}),!0}catch(u){return e.setErrorText(u instanceof Error?u.message:String(u)),!1}finally{e.setBusy(!1)}},[e]),l=o.useCallback(async d=>{e.setApprovalMode(d);const w=e.clientRef.current;if(!(!w?.isConnected||!e.activeSession)){e.setErrorText(null);try{await w.request({action:"session.setApprovalMode",id:w.makeId("approval_mode"),sessionId:e.activeSession.sessionId,approvalMode:d}),e.setSessions(u=>u.map(x=>x.sessionId===e.activeSession.sessionId?{...x,approvalMode:d}:x))}catch(u){e.setErrorText(u instanceof Error?u.message:String(u))}}},[e]),c=o.useCallback(async d=>{const w=e.clientRef.current;if(!(!w?.isConnected||!e.activeSessionId||!d.clientMessageId)){e.setBusy(!0),e.setErrorText(null);try{await w.request({action:"session.queue.cancel",id:w.makeId("queue_cancel"),sessionId:e.activeSessionId,clientMessageId:d.clientMessageId}),e.setPendingQueues(u=>({...u,[e.activeSessionId]:(u[e.activeSessionId]??[]).filter(x=>x.clientMessageId!==d.clientMessageId)}))}catch(u){e.setErrorText(u instanceof Error?u.message:String(u))}finally{e.setBusy(!1)}}},[e]),m=o.useCallback(async(d,w)=>{if(e.pendingSessions[d.sessionId])return;const u=e.clientRef.current;if(u?.isConnected){e.setBusy(!0),e.setErrorText(null);try{const x=w?Date.now():void 0;await u.request({action:"session.setPinned",id:u.makeId("pin"),sessionId:d.sessionId,pinned:w,...x?{pinnedAt:x}:{}}),e.setSessions(M=>M.map(g=>g.sessionId===d.sessionId?{...g,pinned:w,pinnedAt:x}:g)),await e.requestSessions({force:!0})}catch(x){e.setErrorText(x instanceof Error?x.message:String(x))}finally{e.setBusy(!1)}}},[e]),f=o.useCallback(async(d,w)=>{if(e.pendingSessions[d.sessionId])return;const u=e.clientRef.current;if(u?.isConnected){e.setBusy(!0),e.setErrorText(null);try{await u.request({action:"session.setArchived",id:u.makeId("archive"),sessionId:d.sessionId,archived:w}),e.setSessions(x=>x.map(M=>M.sessionId===d.sessionId?{...M,archived:w}:M)),await e.requestSessions({force:!0})}catch(x){e.setErrorText(x instanceof Error?x.message:String(x))}finally{e.setBusy(!1)}}},[e]),y=o.useCallback(async d=>{if(e.pendingSessions[d.sessionId]){e.removeCachedHistory(d.sessionId),e.setPendingSessions(u=>{const x={...u};return delete x[d.sessionId],x}),e.setComposerDrafts(u=>{const x=Qt(u,d.sessionId,"");return e.composerDraftsRef.current=x,Ut(x),x}),e.activeSessionIdRef.current===d.sessionId&&(e.setActiveSessionId(null),e.messagesSessionIdRef.current=null,e.lastHistorySessionIdRef.current=null,e.setMessages([]),e.setDraft(Gt(e.composerDraftsRef.current,null)),e.setDetailsOpen(!1));return}const w=e.clientRef.current;if(!(!w?.isConnected||!zt(`Delete ${We(d)}?`))){e.setBusy(!0),e.setErrorText(null);try{await w.request({action:"session.delete",id:w.makeId("delete"),sessionId:d.sessionId}),e.removeCachedHistory(d.sessionId),e.setOptimisticSessions(u=>{if(!u[d.sessionId])return u;const x={...u};return delete x[d.sessionId],x}),e.activeSessionIdRef.current===d.sessionId&&(e.setActiveSessionId(null),e.messagesSessionIdRef.current=null,e.lastHistorySessionIdRef.current=null,e.setMessages([]),e.setDetailsOpen(!1)),await e.requestSessions({force:!0})}catch(u){e.setErrorText(u instanceof Error?u.message:String(u))}finally{e.setBusy(!1)}}},[e]),v=o.useCallback(async()=>{e.activeSession&&await m(e.activeSession,!e.activeSession.pinned)},[e.activeSession,m]),p=o.useCallback(async()=>{e.activeSession&&await f(e.activeSession,!e.activeSession.archived)},[e.activeSession,f]),S=o.useCallback(()=>{const d=e.activeSessionId;d&&a("session.interrupt").then(w=>{w&&(e.respondingSessionsRef.current=new Set(e.respondingSessionsRef.current),e.respondingSessionsRef.current.delete(d),e.setRespondingSessions(u=>{const x=new Set(u);return x.delete(d),x}))})},[e,a]),I=o.useCallback(()=>{e.setErrorText(null),e.phase==="connected"?e.requestSessions({force:!0}):window.location.reload()},[e]),b=o.useCallback(async()=>{const d=e.renameTitle.trim();if(e.activeSession&&e.pendingSessions[e.activeSession.sessionId]){e.setPendingSessions(u=>{const x=u[e.activeSession.sessionId];return x?{...u,[e.activeSession.sessionId]:{...x,title:d||x.title,customTitle:d||void 0}}:u});return}const w=e.clientRef.current;if(!(!w?.isConnected||!e.activeSession)){e.setBusy(!0),e.setErrorText(null);try{await w.request({action:"session.rename",id:w.makeId("rename"),sessionId:e.activeSession.sessionId,title:d||void 0}),e.setSessions(u=>u.map(x=>x.sessionId===e.activeSession.sessionId?{...x,customTitle:d||void 0}:x))}catch(u){e.setErrorText(u instanceof Error?u.message:String(u))}finally{e.setBusy(!1)}}},[e]);return{respondApproval:t,respondQuestion:n,cancelQuestion:r,setQuestionChoice:i,requestActiveAction:a,interruptActiveSession:S,retrySessions:I,updateApprovalMode:l,cancelQueuedTurn:c,setSessionPinned:m,setSessionArchived:f,deleteSession:y,updatePinned:v,updateArchived:p,renameSession:b}}function Ys(e){const t=e.toLowerCase();return/subscription|required|upgrade|billing/u.test(t)?"subscription":/skillnotfound|not found|missing/u.test(t)?"missing-resource":/permission|forbidden|unauthorized|denied/u.test(t)?"permission":/timeout|timed out/u.test(t)?"timeout":/websocket|network|disconnect|connection|offline|closed/u.test(t)?"network":"unknown"}const Zs=15e3,Xs="Session send timed out.";function Bt(e){return typeof e=="string"&&e.trim().length>0?e:void 0}function Ad(e){const[t,n]=o.useState(null),r=o.useCallback(m=>{e.respondingSessionsRef.current=new Set(e.respondingSessionsRef.current),e.respondingSessionsRef.current.delete(m),e.setRespondingSessions(f=>{const y=new Set(f);return y.delete(m),y})},[e]),i=o.useCallback((m,f)=>{const y=Bt(m)??Bt(e.cwd)??Be,v=f??e.agent,p=qo(),S=Bo({sessionId:p,agent:v,cwd:y,approvalMode:e.approvalMode,model:ln(e.model),effort:e.effort||void 0,fastMode:e.fastMode,title:v==="codex"?e.t.newCodexSession:e.t.newClaudeSession}),I=e.activeSessionIdRef.current?"":Gt(e.composerDraftsRef.current,null);return e.setPendingSessions(b=>({...b,[p]:S})),e.setComposerDrafts(b=>{let d=Qt(b,p,I);return e.activeSessionIdRef.current||(d=Qt(d,null,"")),e.composerDraftsRef.current=d,Ut(d),d}),e.setCwd(y),e.setAgent(v),e.setActiveSessionId(p),e.lastHistorySessionIdRef.current=p,e.messagesSessionIdRef.current=p,e.clearHistoryLoading(),e.setMessages([]),e.setDraft(I),e.setErrorText(null),e.reportLog("web.session.pending_create",{sessionId:p,agent:v,cwd:y}),p},[e]),a=o.useCallback(async(m,f,y)=>{const v=e.clientRef.current;if(!v?.isConnected)return e.setErrorText(e.t.webSocketNotConnected),null;const p=y?e.pendingSessions[y]:void 0,S=Bt(m)??Bt(p?.cwd)??Bt(e.cwd)??Be,I=f??p?.agent??e.agent,b=p?.approvalMode??e.approvalMode,d=p?.model??ln(e.model),w=p?.effort??(e.effort||void 0),u=p?.fastMode??e.fastMode;e.setErrorText(null);try{const x=await v.request({action:"session.create",id:v.makeId("create"),agent:I,cwd:S,approvalMode:b,continueSession:e.continueSession,model:d,effort:w,fastMode:u,...y?{clientSessionId:y}:{}}),M=Lo(x);if(!M)throw new Error(e.t.sessionIdMissing);const g=Wt(x)&&typeof x.oldSessionId=="string"?x.oldSessionId:y;return e.setCwd(S),e.setAgent(I),e.setActiveSessionId(M),e.lastHistorySessionIdRef.current=M,e.messagesSessionIdRef.current=M,e.clearHistoryLoading(),y&&p?(e.setPendingSessions(R=>{const k={...R};return delete k[y],g&&g!==y&&delete k[g],k}),e.setOptimisticSessions(R=>({...R,[M]:Ho(p,M)})),g&&g!==M&&e.remapLocalSessionState(g,M),y!==M&&e.remapLocalSessionState(y,M)):await e.requestSessions({force:!0}),e.reportLog("web.session.create",{sessionId:M,clientSessionId:y,agent:I,cwd:S}),M}catch(x){return e.setErrorText(x instanceof Error?x.message:String(x)),null}},[e]),l=o.useCallback(async m=>{m?.preventDefault();const f=e.draft.trim();if(!f||e.busy)return;const y=e.clientRef.current;if(!y?.isConnected){e.setErrorText(e.t.webSocketNotConnected);return}e.setBusy(!0),e.setErrorText(null),e.updateDraft("");const v=e.attachments;e.setAttachments([]);let p=e.activeSessionId,S=e.activeSession?.agent??e.agent;if(p&&e.pendingSessions[p]){const g=await a(e.pendingSessions[p].cwd,e.pendingSessions[p].agent,p);if(!g){e.setBusy(!1),e.updateDraft(f),e.setAttachments(v);return}p=g,S=e.pendingSessions[e.activeSessionId??""]?.agent??S}else p||(p=await a());if(!p){e.setBusy(!1),e.updateDraft(f),e.setAttachments(v);return}const I=v.length===0?ac(f,S):null;if(I){const g=cc(I.command),R=g?y.makeId("cmd_msg"):void 0;g&&(e.messagesSessionIdRef.current=p,e.appendCachedHistory(p,[{role:"user",content:g,timestamp:new Date().toISOString()}]),e.renderCachedHistory(p));try{const k=await y.request({action:"session.command",id:y.makeId("command"),sessionId:p,agent:S,command:I.command,...R?{clientMessageId:R}:{},featureEntitlements:{agentCommands:"pro"}});await e.handleSessionCommandResponse(p,I.command,k)}catch(k){const U=k instanceof Error?k.message:String(k);e.appendInfoMessage(p,Ds(U)),e.setErrorText(Ds(U))}finally{e.setBusy(!1)}return}const b=oc(f),d=v.map(g=>g.path),w=y.makeId("msg"),u=`client:${w}`;e.messagesSessionIdRef.current=p,e.appendCachedHistory(p,[{role:"user",content:b,timestamp:new Date().toISOString(),historyKey:u,...d.length?{images:d}:{}}]),e.renderCachedHistory(p),e.respondingSessionsRef.current=new Set(e.respondingSessionsRef.current).add(p),e.setRespondingSessions(g=>new Set(g).add(p));const x=hc(b)??void 0,M=x?{agentSkills:"pro"}:void 0;try{const g=await y.request({action:"session.send",id:y.makeId("send"),sessionId:p,agent:S,message:b,clientMessageId:w,images:d.length?d:void 0,model:ln(e.model),effort:e.effort||void 0,fastMode:e.fastMode,skillInvocation:x,featureEntitlements:M},{timeoutMs:Zs,timeoutMessage:Xs});Wt(g)&&typeof g.oldSessionId=="string"&&typeof g.sessionId=="string"&&e.remapLocalSessionState(g.oldSessionId,g.sessionId),e.reportLog("web.telemetry.send_accepted",{attachmentCount:d.length}),n(R=>R?.historyKey===u?null:R)}catch(g){const R=g instanceof Error?g.message:String(g),k=Ys(Es(R,!!x));e.setErrorText(null),n({sessionId:p,agent:S,message:b,clientMessageId:w,historyKey:u,kind:k,retrying:!1,...d.length?{images:d}:{},model:ln(e.model),effort:e.effort||void 0,fastMode:e.fastMode,skillInvocation:x,featureEntitlements:M}),e.reportLog("web.telemetry.send_failed",{attachmentCount:d.length,failureKind:k},"warn"),r(p)}finally{e.setBusy(!1)}},[r,a,e]),c=o.useCallback(async()=>{if(!t||t.retrying||e.busy)return;const m=e.clientRef.current;if(!m?.isConnected){n(f=>f?{...f,kind:"network"}:null);return}n(f=>f?{...f,retrying:!0}:null),e.ensureCachedHistoryEntry(t.sessionId,{role:"user",content:t.message,historyKey:t.historyKey,...t.images?.length?{images:t.images}:{}}),e.setBusy(!0),e.setErrorText(null),e.respondingSessionsRef.current=new Set(e.respondingSessionsRef.current).add(t.sessionId),e.setRespondingSessions(f=>new Set(f).add(t.sessionId));try{const f=await m.request({action:"session.send",id:m.makeId("retry_send"),sessionId:t.sessionId,agent:t.agent,message:t.message,clientMessageId:t.clientMessageId,images:t.images,model:t.model,effort:t.effort,fastMode:t.fastMode,skillInvocation:t.skillInvocation??void 0,featureEntitlements:t.featureEntitlements},{timeoutMs:Zs,timeoutMessage:Xs});Wt(f)&&typeof f.oldSessionId=="string"&&typeof f.sessionId=="string"&&e.remapLocalSessionState(f.oldSessionId,f.sessionId),e.reportLog("web.telemetry.retry_accepted",{attachmentCount:t.images?.length??0}),n(null)}catch(f){const y=f instanceof Error?f.message:String(f),v=Ys(Es(y,!!t.skillInvocation));n(p=>p?{...p,kind:v,retrying:!1}:null),e.reportLog("web.telemetry.retry_failed",{attachmentCount:t.images?.length??0,failureKind:v},"warn"),r(t.sessionId)}finally{e.setBusy(!1)}},[r,t,e]);return{failedSend:t,retryFailedSend:c,stagePendingSession:i,sendDraft:l}}function Td(e,t){const n=t.trim().toLowerCase();return n?[We(e),e.cwd,e.agent,e.branch??"",...e.titleAliases??[]].some(r=>r.toLowerCase().includes(n)):!0}function Ed(e,t){return e.filter(n=>t.hideArchived&&n.archived||t.agentFilter!=="all"&&n.agent!==t.agentFilter?!1:Td(n,t.search))}function Md(e){const t=o.useMemo(()=>gn(gn(e.sessions,Object.values(e.optimisticSessions)),Object.values(e.pendingSessions)),[e.optimisticSessions,e.pendingSessions,e.sessions]),n=o.useMemo(()=>new Set(Object.keys(e.pendingSessions)),[e.pendingSessions]),r=o.useMemo(()=>t.find(f=>f.sessionId===e.activeSessionId)??null,[e.activeSessionId,t]),i=o.useMemo(()=>e.activeSessionId&&e.pendingApprovals[e.activeSessionId]?e.pendingApprovals[e.activeSessionId]:Object.values(e.pendingApprovals)[0]??null,[e.activeSessionId,e.pendingApprovals]),a=o.useMemo(()=>e.activeSessionId&&e.pendingQuestions[e.activeSessionId]?e.pendingQuestions[e.activeSessionId]:Object.values(e.pendingQuestions)[0]??null,[e.activeSessionId,e.pendingQuestions]),l=o.useMemo(()=>Ed(t,{search:e.search,hideArchived:e.hideArchived,agentFilter:e.sessionAgentFilter}),[t,e.hideArchived,e.search,e.sessionAgentFilter]),c=o.useMemo(()=>new Set([...Object.keys(e.pendingApprovals),...Object.keys(e.pendingQuestions)]),[e.pendingApprovals,e.pendingQuestions]),m=o.useMemo(()=>Do(l,{needsAttentionSessionIds:c,respondingSessionIds:e.respondingSessionIds,separatePinnedGroup:e.separatePinnedGroup,showNeedsAttentionGroup:e.showNeedsAttentionGroup,showRunningGroup:e.showRunningGroup}),[c,e.respondingSessionIds,e.separatePinnedGroup,e.showNeedsAttentionGroup,e.showRunningGroup,l]);return{activeApproval:i,activeQuestion:a,activeSession:r,displaySessions:t,groupedSessions:m,pendingSessionIds:n,visibleSessions:l}}function Dd(e,t,n){o.useEffect(()=>{e!==0&&(t("session"),n(!1))},[e,t,n])}const _d=new Set(["attachmentCount","domNodes","durationMs","errorKind","failureKind","longTaskCount","maxLongTaskMs","online","phase","visibilityState"]);function Pd(e){const t={};for(const[n,r]of Object.entries(e))_d.has(n)&&(typeof r=="string"?t[n]=r.slice(0,48):typeof r=="number"&&Number.isFinite(r)?t[n]=Math.round(r):typeof r=="boolean"&&(t[n]=r));return t}function er(e){return e instanceof TypeError?"TypeError":e instanceof RangeError?"RangeError":e instanceof SyntaxError?"SyntaxError":e instanceof Error?"Error":typeof e=="string"?"string":typeof e}function Fd(e){o.useEffect(()=>{const t=performance.now(),n=(f,y,v="info")=>e(f,Pd(y),v),r=f=>{n("web.telemetry.runtime_error",{errorKind:er(f.error)},"error")},i=f=>{n("web.telemetry.unhandled_rejection",{errorKind:er(f.reason)},"error")},a=window.setTimeout(()=>{n("web.telemetry.workspace_ready",{durationMs:performance.now()-t,domNodes:document.getElementsByTagName("*").length,online:navigator.onLine,visibilityState:document.visibilityState})},1500);let l=0,c=0,m=null;return typeof PerformanceObserver<"u"&&PerformanceObserver.supportedEntryTypes.includes("longtask")&&(m=new PerformanceObserver(f=>{for(const y of f.getEntries())l+=1,c=Math.max(c,y.duration)}),m.observe({entryTypes:["longtask"]})),window.addEventListener("error",r),window.addEventListener("unhandledrejection",i),()=>{window.clearTimeout(a),window.removeEventListener("error",r),window.removeEventListener("unhandledrejection",i),m?.disconnect(),l>0&&n("web.telemetry.long_tasks",{longTaskCount:l,maxLongTaskMs:c},"warn")}},[e])}function $d(e){o.useEffect(()=>{const t=window.matchMedia("(prefers-color-scheme: dark)"),n=()=>ca(e,document.documentElement,t.matches);if(n(),e==="system")return t.addEventListener("change",n),()=>t.removeEventListener("change",n)},[e])}const Ld=6;function Od(e,t){return t.has(e.sessionId)||e.runtime?.isResponding===!0||e.runtime?.state==="daemonActive"||e.runtime?.state==="externalRunning"}function qd(e,t,n,r,i=Ld){if(i<=0)return[];const a=[];for(const l of e){if(a.length>=i)break;!l.sessionId||!Od(l,n)||wn(t,l.sessionId)||r.has(l.sessionId)||a.push(l)}return a}function Bd(){const e=o.useRef(null),t=o.useRef(async()=>{}),n=o.useRef(null),r=o.useRef(Wn()),i=o.useRef(Qo()),a=o.useRef(la()),l=o.useRef(Cd()),c=o.useRef(Bl()),m=o.useRef(r.current),f=o.useRef(i.current),y=o.useRef(l.current),v=o.useRef(null),p=o.useRef(null),S=o.useRef(new Set),I=o.useRef(null),b=o.useRef(new Set),d=o.useRef(null),w=o.useRef(0),u=o.useRef(new Set),x=o.useRef({}),M=o.useRef(!1),[g,R]=o.useState("connecting"),[k,U]=o.useState(()=>Cs[Ns(a.current.language)].preparingVibeletWeb),[fe,J]=o.useState(null),[he,se]=o.useState(null),[$,re]=o.useState([]),[ge,je]=o.useState({}),[D,E]=o.useState({}),[q,P]=o.useState(),[ie,ye]=o.useState({}),[ze,Re]=o.useState(),[Z,X]=o.useState(null),[ke,Me]=o.useState(null),[ae,W]=o.useState(()=>new Set),[V,K]=o.useState({}),[oe,le]=o.useState({}),[be,xe]=o.useState({}),[Ae,G]=o.useState({}),[me,De]=o.useState("claude"),[T,Q]=o.useState(Be),[Ue,_e]=o.useState(qn),[Pe]=o.useState(!1),[Ce,Ge]=o.useState(""),[Fe,Ze]=o.useState(""),[Te,st]=o.useState(!1),[Xe,Se]=o.useState(""),[et,pe]=o.useState(l.current),[N,te]=o.useState(()=>Gt(l.current,null)),{webPreferences:$e,search:Le,setSearch:rt,sinceFilter:Ve,setSinceFilter:ft,hideArchived:Ne,setHideArchived:C,groupFolders:O,setGroupFolders:de,showNeedsAttentionGroup:H,setShowNeedsAttentionGroup:z,showRunningGroup:He,setShowRunningGroup:yt,separatePinnedGroup:ht,setSeparatePinnedGroup:Rt,collapsedFolders:kn,setCollapsedFolders:At,sessionAgentFilter:Ke,setSessionAgentFilter:Tt,directoryTags:Jt,archiveSyncedDaemonIds:Et,archiveSyncCardDismissedDaemonIds:Yt,composerPreferences:Zt,savedTargets:_,setSavedTargets:Y,leftSidebarCollapsed:ee,setLeftSidebarCollapsed:Oe,rightSidebarCollapsed:bt,setRightSidebarCollapsed:it,workspaceClassName:at,wideMainClassName:Ee,workspaceStyle:mt,beginPaneResize:xt,commitSearch:qe,saveTargets:St,setLanguagePreference:Xt,setThemePreference:Dr,updateSessionListPreferences:_r,updateComposerPreferences:Pr}=kd(a.current,c.current),Fr=Ns($e.language),B=Cs[Fr],[vt,jn]=o.useState(!1),[Qe,Mt]=o.useState("session"),[$r,Cn]=o.useState(!1);$d($e.theme);const Nn=o.useCallback(h=>{Mt(h),it(!1)},[it]),[Lr,Or]=o.useState({}),[qr,Br]=o.useState({}),[Hr,Wr]=o.useState([]),[Dt,zr]=o.useState({statusText:"",loading:!1,action:null}),[wt,_t]=o.useState(zn),[as,Ur]=o.useState(i.current),[Pt,os]=o.useState(r.current),[cs,Gr]=o.useState(null),[Vr,Kr]=o.useState(null),{attachments:ls,setAttachments:ds,uploadBusy:Qr,directory:Jr,setDirectory:us,newDirName:Yr,setNewDirName:Zr,remoteFile:en,setRemoteFile:Xr,remoteFileConflict:ei,remoteFileMode:ti,setRemoteFileMode:ni,uploadFiles:si,openRemoteFile:fs,saveRemoteFile:ri,downloadRemoteFile:ii,listDirectory:In,listSessionDirectories:ai,createDirectory:oi,createSessionDirectory:ci}=od({clientRef:e,pairing:he,cwd:T,phase:g,controlTab:Qe,setControlTab:Nn,setBusy:jn,setErrorText:J,t:B}),tn=Object.keys(V).length+Object.keys(oe).length;Dd(tn,Mt,it);const li=Z?Ae[Z]??[]:[],di=Lr[me]??[],ui=qr[me],{activeApproval:hs,activeQuestion:ms,activeSession:ot,displaySessions:nn,groupedSessions:fi,pendingSessionIds:hi,visibleSessions:mi}=Md({activeSessionId:Z,hideArchived:Ne,optimisticSessions:D,pendingApprovals:V,pendingQuestions:oe,pendingSessions:ge,respondingSessionIds:ae,search:Le,separatePinnedGroup:ht,sessionAgentFilter:Ke,sessions:$,showNeedsAttentionGroup:H,showRunningGroup:He}),{appendCachedDelta:pi,appendCachedHistory:ps,appendInfoMessage:Rn,clearHistoryLoading:kt,ensureCachedHistoryEntry:gi,historyCacheRef:An,historyLoading:yi,hydrateVisibleHistory:gs,messages:ys,messagesSessionIdRef:Ie,mergeCachedHistoryPage:bi,remapCachedHistory:xi,removeCachedHistory:Si,renderCachedHistory:Ft,replaceCachedHistory:Tn,requestHistory:bs,setMessages:ct}=pd({activeSessionIdRef:n,clientRef:e,historyTimeoutMessage:B.historyRequestTimedOut,setErrorText:J});jt(n,Z),jt(I,he),jt(u,ae),jt(f,as),jt(m,Pt),jt(y,et);const xs=o.useCallback(h=>{te(h),pe(j=>{const A=Qt(j,n.current,h);return y.current=A,Ut(A),A})},[]),Ss=o.useCallback(h=>{pe(j=>{const A=Qt(j,null,h);return y.current=A,Ut(A),A}),n.current||te(h)},[]);o.useEffect(()=>{da();const h=ua();h&&(Ss(h),Mt("session"),fa())},[Ss]),o.useEffect(()=>{Qe==="admin"&&os(Wn())},[Qe]),o.useEffect(()=>()=>{d.current&&window.clearTimeout(d.current),en?.objectUrl&&URL.revokeObjectURL(en.objectUrl)},[en?.objectUrl]);const $t=o.useCallback((h,j=!1)=>{re(A=>gn(j?A:[],h.sessions)),E(A=>{const L=new Set(h.sessions.map(ve=>ve.sessionId)),ne=Object.fromEntries(Object.entries(A).filter(([ve])=>!L.has(ve)));return Object.keys(ne).length===Object.keys(A).length?A:ne}),P(h.nextCursor),Re(h.inventoryVersion),h.folderCounts&&ye(h.folderCounts),j||td(I.current?.daemonId,h),U(h.inventoryBackfillInFlight?B.connectedIndexing:B.connected)},[B.connected,B.connectedIndexing]),sn=cd({clientRef:e,setSessions:re}),rn=o.useCallback((h,j=u.current)=>{const A=e.current;if(!A?.isConnected||h.length===0)return;const L=qd(h,An.current,j,S.current);for(const ne of L)S.current.add(ne.sessionId),A.request({action:"session.history",id:A.makeId("history_prefetch"),sessionId:ne.sessionId,agent:ne.agent},{timeoutMessage:B.historyPrefetchTimedOut,timeoutMs:Un}).catch(()=>{}).finally(()=>{S.current.delete(ne.sessionId)})},[B.historyPrefetchTimedOut]),vs=o.useCallback(h=>{const j=Xo(h,{currentActiveSessionId:n.current,currentCwd:T});$t(j.page,!1),P(j.page.nextCursor),Re(j.page.inventoryVersion),j.messages&&j.activeSessionId&&gs(j.activeSessionId,j.messages),X(j.activeSessionId),j.activeAgent&&De(j.activeAgent),j.activeCwd&&Q(j.activeCwd),j.activeApprovalMode&&_e(j.activeApprovalMode),j.questionAnswers&&xe(j.questionAnswers),u.current=new Set(j.respondingSessionIds),W(u.current),K(j.pendingApprovals),le(j.pendingQuestions),G(j.pendingQueues),sn(h.sessions),rn(h.sessions,new Set(j.respondingSessionIds))},[T,sn,gs,rn,$t]),ws=o.useCallback(async()=>{const h=e.current;if(!h?.isConnected)return;const j=await h.request({action:"reconnect.snapshot",id:h.makeId("snapshot"),activeSessionId:n.current??void 0,activeAgent:ot?.agent??me,agent:Ke==="all"?void 0:Ke,search:Le.trim()||void 0,sinceMs:Rs(Ve),hideArchived:Ne,skipGitMetadata:!0});vs(j.snapshot)},[ot?.agent,me,vs,Ne,Le,Ke,Ve]),tt=o.useCallback(async h=>{const j=e.current;if(!j?.isConnected)return;const A=await j.request({action:"sessions.list",id:j.makeId(h?.append?"sessions_more":"sessions"),limit:_o,cursor:h?.cursor,agent:Ke==="all"?void 0:Ke,search:Le.trim()||void 0,sinceMs:Rs(Ve),hideArchived:Ne,skipGitMetadata:!0,force:h?.force}),L=hr(A);$t(L,h?.append),X(ne=>ne??L.sessions[0]?.sessionId??null),sn(L.sessions),rn(L.sessions)},[Ne,sn,rn,Le,Ke,$t,Ve]),ks=o.useCallback(async(h,j)=>{const A=e.current;if(A?.isConnected)try{const[L,ne,ve]=await Promise.all([A.request({action:"models.list",id:A.makeId("models"),agent:h}),A.request({action:"usage.limits.fetch",id:A.makeId("usage"),agent:h}),A.request({action:"skills.list",id:A.makeId("skills"),cwd:j||void 0})]);Or(ue=>({...ue,[h]:L.options??[]})),Br(ue=>({...ue,[h]:ne})),Wr(Array.isArray(ve.skills)?ve.skills:[])}catch(L){J(L instanceof Error?L.message:String(L))}},[]),En=o.useCallback((h,j,A="info")=>{const L=e.current;L?.isConnected&&L.request({action:"log.report",id:L.makeId("log"),entries:[{level:A,event:h,data:j,ts:new Date().toISOString()}]}).catch(()=>{})},[]);Fd(En);const an=o.useCallback(async(h=I.current)=>{if(!h){_t(zn);return}_t(j=>({...j,loading:!0,error:null}));try{const j=await fetch(Vl(h,window.location,{sameOrigin:!1}),{cache:"no-store"});if(!j.ok)throw new Error(`HTTP ${j.status}`);const A=Kl(await j.json().catch(()=>null));_t({...A,loading:!1,error:null})}catch{_t(j=>({...j,loading:!1,error:B.connectorVersionFailed}))}},[B.connectorVersionFailed]);o.useEffect(()=>{Qe==="admin"&&g==="connected"&&an()},[Qe,g,an]);const vi=o.useCallback(h=>{Ur(j=>{const A={...j,...h};return f.current=A,Jo(A),A})},[]),on=o.useCallback((h,j)=>{!h||!j||h===j||(X(A=>A===h?j:A),v.current===h&&(v.current=j),Ie.current===h&&(Ie.current=j),xi(h,j),u.current=As(u.current,h,j),W(A=>As(A,h,j)),K(A=>Pn(A,h,j)),le(A=>Pn(A,h,j)),G(A=>Pn(A,h,j)),E(A=>{const L=A[h];if(!L)return A;const ne={...A};return delete ne[h],ne[j]={...L,sessionId:j},ne}),pe(A=>{const L=Nd(A,h,j);return L!==A&&(y.current=L,Ut(L)),L}))},[]),wi=o.useCallback(async(h,j,A)=>{const L=typeof A.sessionId=="string"?A.sessionId:h,ne=typeof A.oldSessionId=="string"?A.oldSessionId:h;ne&&L&&ne!==L&&on(ne,L),j.name==="clear"?(Tn(L,[]),G(ve=>{const ue={...ve};return delete ue[L],delete ue[ne],ue}),K(ve=>{const ue={...ve};return delete ue[L],delete ue[ne],ue}),le(ve=>{const ue={...ve};return delete ue[L],delete ue[ne],ue}),X(L)):j.name==="new"?(X(L),Ie.current=L,Ft(L)):j.name==="exit"?(re(ve=>ve.map(ue=>ue.sessionId===L?{...ue,archived:!0}:ue)),X(null),Ie.current=null,v.current=null,ct([])):j.name==="goal"&&"goal"in A&&Rn(L,lc(A.goal)),A.turnStarted&&!A.queued&&(u.current=new Set(u.current).add(L),W(ve=>new Set(ve).add(L))),await tt({force:!0})},[Rn,on,Ft,Tn,tt]),ki=jd({notificationSettingsRef:f,notifiedEventsRef:b,notificationPermissionRef:m,activeSessionIdRef:n,respondingSessionsRef:u,turnNotificationCountsRef:x,t:B,setActiveSessionId:X,setErrorText:J,setPendingQueues:G,setPendingApprovals:K,setPendingQuestions:le,setQuestionAnswers:xe,setRespondingSessions:W,setSessions:re,remapLocalSessionState:on,requestSessions:tt,clearHistoryLoading:kt,replaceCachedHistory:Tn,mergeCachedHistoryPage:bi,appendCachedHistory:ps,appendCachedDelta:pi});rd({clientRef:e,connectWithPairingRef:t,pairingRef:I,reconnectTimerRef:d,connectionAttemptIdRef:w,intentionalDisconnectRef:M,historyCacheRef:An,historyCacheDaemonIdRef:p,messagesSessionIdRef:Ie,lastHistorySessionIdRef:v,rememberedTarget:c.current[0]??null,agent:me,cwd:T,phase:g,search:Le,sinceFilter:Ve,t:B,handleServerMessage:ki,setPhase:R,setStatusText:U,setErrorText:J,setMessages:ct,setPairing:se,setSavedTargets:Y,setSessionsFromPage:$t,refreshDaemonMetadata:an,requestReconnectSnapshot:ws,fetchAgentResources:ks,reportLog:En,requestSessions:tt}),o.useEffect(()=>{const h=nn.find(j=>j.sessionId===Z);if(!h){v.current=null,Ie.current=null,kt(),ct([]),te(Gt(y.current,null));return}if(De(h.agent),Q(h.cwd||Be),Ge(h.model??""),Ze(h.effort??""),st(h.fastMode??!1),_e(h.approvalMode??qn),Se(h.customTitle??h.title??""),te(Gt(y.current,h.sessionId)),us(j=>({...j,path:h.cwd||Be,loaded:j.path===(h.cwd||Be)?j.loaded:!1})),ge[h.sessionId]){v.current=h.sessionId,kt(),Ie.current!==h.sessionId&&(Ie.current=h.sessionId,ct([]));return}if(Ft(h.sessionId)){v.current=h.sessionId,kt(h.sessionId);return}v.current!==h.sessionId&&(v.current=h.sessionId,Ie.current!==h.sessionId&&(Ie.current=h.sessionId,ct([])),bs(h))},[Z,kt,nn,ge,Ft,bs]);const{failedSend:ji,retryFailedSend:Ci,stagePendingSession:Ni,sendDraft:Ii}=Ad({clientRef:e,activeSessionIdRef:n,composerDraftsRef:y,lastHistorySessionIdRef:v,messagesSessionIdRef:Ie,respondingSessionsRef:u,agent:me,cwd:T,approvalMode:Ue,continueSession:Pe,model:Ce,effort:Fe,fastMode:Te,activeSessionId:Z,activeSession:ot,pendingSessions:ge,draft:N,busy:vt,attachments:ls,t:B,setPendingSessions:je,setOptimisticSessions:E,setComposerDrafts:pe,setCwd:Q,setAgent:De,setActiveSessionId:X,setMessages:ct,setDraft:te,setErrorText:J,setBusy:jn,setAttachments:ds,setRespondingSessions:W,clearHistoryLoading:kt,reportLog:En,remapLocalSessionState:on,requestSessions:tt,updateDraft:xs,appendCachedHistory:ps,ensureCachedHistoryEntry:gi,renderCachedHistory:Ft,handleSessionCommandResponse:wi,appendInfoMessage:Rn}),{respondApproval:Ri,respondQuestion:Ai,cancelQuestion:Ti,setQuestionChoice:Ei,requestActiveAction:Mi,interruptActiveSession:Di,retrySessions:_i,updateApprovalMode:Pi,cancelQueuedTurn:Fi,setSessionPinned:$i,setSessionArchived:Li,deleteSession:Oi,updatePinned:qi,updateArchived:Bi,renameSession:Hi}=Rd({clientRef:e,activeSessionIdRef:n,composerDraftsRef:y,lastHistorySessionIdRef:v,messagesSessionIdRef:Ie,respondingSessionsRef:u,activeApproval:hs,activeQuestion:ms,activeSession:ot,activeSessionId:Z,questionAnswers:be,pendingSessions:ge,phase:g,renameTitle:Xe,setBusy:jn,setErrorText:J,setPendingApprovals:K,setPendingQuestions:le,setQuestionAnswers:xe,setPendingQueues:G,setActiveSessionId:X,setMessages:ct,setApprovalMode:_e,setSessions:re,setPendingSessions:je,setComposerDrafts:pe,setDraft:te,setDetailsOpen:Cn,setRespondingSessions:W,setOptimisticSessions:E,removeCachedHistory:Si,requestSessions:tt}),{runArchiveSync:Mn,skipArchiveSync:Wi,runAdminAction:js,exportActiveSession:zi,clearPairing:Ui,setNotificationsEnabled:Gi,connectSavedTarget:Vi,forgetSavedTarget:Ki,openSessionDetails:Qi,editFolderTags:Ji,browseFolder:Yi,copyResumeCommand:Zi}=Ql({clientRef:e,pairingRef:I,connectWithPairingRef:t,notificationPermissionRef:m,intentionalDisconnectRef:M,connectionAttemptIdRef:w,historyCacheRef:An,historyCacheDaemonIdRef:p,messagesSessionIdRef:Ie,lastHistorySessionIdRef:v,displaySessions:nn,pairing:he,t:B,archiveSyncBusy:cs,daemonMetadata:wt,activeSession:ot,messages:ys,notificationPermission:Pt,savedTargets:_,setArchiveSyncBusy:Gr,setArchiveSyncStatus:Kr,setSessions:re,setAdmin:zr,setErrorText:J,setNotificationPermission:os,setStatusText:U,setMessages:ct,setPairing:se,setDaemonMetadata:_t,setPhase:R,setActiveSessionId:X,setRenameTitle:Se,setDetailsOpen:Cn,setControlTab:Nn,updateSessionListPreferences:_r,requestSessions:tt,refreshDaemonMetadata:an,updateNotificationSettings:vi,saveTargets:St,listDirectory:In}),Xi=Pt==="denied"||Pt==="unsupported",ea=!!(wt.version&&wt.latestVersion&&Ul(wt.version,wt.latestVersion)),cn=he?.daemonId,ta=!!(cn&&Et[cn]),na=!!(cn&&Yt[cn]);return g==="missing-pair"?s.jsxs(s.Fragment,{children:[s.jsx("a",{className:"skip-link",href:"#vibelet-main-content",children:B.skipToConversation}),s.jsx(Jc,{errorText:fe,t:B})]}):s.jsxs("main",{className:at,id:"vibelet-workspace",style:mt,children:[s.jsx("a",{className:"skip-link",href:"#vibelet-main-content",children:B.skipToConversation}),ee?s.jsx("button",{"aria-label":B.expandSessionSidebar,className:"sidebar-restore-button sidebar-restore-button-left",onClick:()=>Oe(!1),title:B.expandSessionSidebar,type:"button",children:s.jsx(or,{"aria-hidden":"true"})}):s.jsxs(s.Fragment,{children:[s.jsx(gl,{activeSessionId:Z,busy:vt,collapsedFolders:kn,currentCwd:T,directoryTags:Jt,displayName:he?.displayName,folderCounts:ie,groupFolders:O,groupedSessions:fi,hideArchived:Ne,separatePinnedGroup:ht,showNeedsAttentionGroup:H,showRunningGroup:He,inventoryVersion:ze,nextCursor:q,phase:g,respondingSessionIds:ae,search:Le,sessionAgentFilter:Ke,sessionsCount:nn.length,sinceFilter:Ve,statusText:k,t:B,visibleSessions:mi,onLoadMore:h=>tt({append:!0,cursor:h}),onBrowseFolder:Yi,onCopyResumeCommand:Zi,onCreateDirectory:ci,pendingSessionIds:hi,onCreateSession:(h,j)=>{Ni(h,j)},onDeleteSession:h=>{Oi(h)},onEditFolderTags:Ji,onListDirectories:ai,onOpenSessionDetails:Qi,onResetFilters:()=>{Tt("all"),ft("30d"),C(!1),de(!1),z(!1),yt(!1),Rt(!1)},onSearchChange:rt,onSearchCommit:qe,onSelectSession:X,onToggleSessionArchived:h=>{Li(h,!h.archived)},onToggleSessionPinned:h=>{$i(h,!h.pinned)},onSessionAgentFilterChange:Tt,onSinceFilterChange:ft,onViewChanges:Me,onToggleFolder:h=>At(j=>({...j,[h]:!j[h]})),onToggleGroupFolders:()=>de(h=>!h),onToggleHideArchived:()=>C(h=>!h),onToggleNeedsAttentionGroup:()=>z(h=>!h),onToggleRunningGroup:()=>yt(h=>!h),onToggleSeparatePinnedGroup:()=>Rt(h=>!h),onToggleCollapse:()=>Oe(!0)}),s.jsx("button",{"aria-label":B.resizeSessionSidebar,className:"resize-handle",onPointerDown:xt("left"),title:B.resizeSessionSidebar,type:"button",children:s.jsx("span",{})})]}),s.jsxs("section",{className:Ee,"aria-label":B.vibeletWorkspace,id:"vibelet-main-content",tabIndex:-1,children:[s.jsx(Qc,{activeSession:ot,activeSessionId:Z,activeModelOptions:di,activeQueue:li,activeUsage:ui,agent:me,approvalMode:Ue,attachments:ls,busy:vt,cwd:T,draft:N,effort:Fe,errorText:fe,failedSend:ji,fastMode:Te,historyLoading:yi,messages:ys,messagesSessionId:Ie.current,model:Ce,phase:g,quickReplies:Zt.quickReplies,renameTitle:Xe,respondingSessionIds:ae,sendShortcut:Zt.sendShortcut,skills:Hr,uploadBusy:Qr,detailsOpen:$r,controlsOpen:!bt,pendingActionsCount:tn,t:B,onApprovalModeChange:h=>{Pi(h)},onBrowseFiles:()=>{const h=ot?.cwd||T||Be;Nn("files"),In(h,{updateRoute:!0})},onCancelQueuedTurn:h=>{Fi(h)},onClearInterrupt:()=>{Mi("session.clearInterrupt")},onDraftChange:xs,onDetailsOpenChange:Cn,onEffortChange:Ze,onExportActiveSession:()=>{zi()},onFastModeChange:st,onRetryFailedSend:Ci,onModelChange:Ge,onOpenRemoteFile:(h,j)=>{fs(h,j,{updateRoute:!0})},onOpenControls:()=>{bt&&tn===0&&Qe==="session"&&Mt("files"),it(h=>!h)},onInterrupt:Di,onRetry:_i,onRefreshSessions:()=>{tt({force:!0})},onRenameSession:()=>{Hi()},onRenameTitleChange:Se,onRemoveAttachment:h=>ds(j=>j.filter(A=>A.path!==h)),onRestoreSnapshot:()=>{ws()},onRefreshSkills:()=>{ks(ot?.agent??me,T)},onSendShortcutChange:h=>Pr(j=>({...j,sendShortcut:h})),onSubmit:Ii,onToggleArchived:()=>{Bi()},onTogglePinned:()=>{qi()},onUploadFiles:si,onViewChanges:Me}),bt?null:s.jsxs(bl,{t:B,value:Qe,showSession:tn>0,onChange:Mt,onClose:()=>it(!0),children:[Qe==="session"?s.jsx(ol,{activeApproval:hs,activeQuestion:ms,busy:vt,questionAnswers:be,t:B,onCancelQuestion:()=>{Ti()},onQuestionChoice:Ei,onRespondApproval:h=>{Ri(h)},onRespondQuestion:()=>{Ai()}}):null,Qe==="files"?s.jsx(o.Suspense,{fallback:s.jsx(Ls,{t:B}),children:s.jsx(Yc,{busy:vt,cwd:T,directory:Jr,newDirName:Yr,remoteFile:en,remoteFileConflict:ei,remoteFileMode:ti,t:B,onCreateDirectory:()=>{oi()},onDirectoryPathChange:h=>us(j=>({...j,path:h,loaded:!1})),onDownloadRemoteFile:()=>{ii()},onListDirectory:h=>{In(h,{updateRoute:!0})},onNewDirNameChange:Zr,onOpenRemoteFile:(h,j)=>{fs(h,j,{updateRoute:!0})},onRemoteFileModeChange:ni,onRemoteFileTextChange:h=>Xr(j=>j&&{...j,text:h,dirty:!0}),onSaveRemoteFile:h=>{ri(h)}})}):null,Qe==="admin"?s.jsxs(o.Suspense,{fallback:s.jsx(Ls,{t:B}),children:[s.jsx(Xc,{pairing:he,phase:g,t:B,onForgetPairing:Ui}),s.jsx(tl,{language:$e.language,t:B,onLanguageChange:Xt}),s.jsx(nl,{t:B,theme:$e.theme,onThemeChange:Dr}),s.jsx(rl,{activeDaemonId:he?.daemonId,busy:vt,t:B,targets:_,onConnect:Vi,onForget:Ki}),s.jsx(sl,{notificationsBlocked:Xi,permission:Pt,settings:as,t:B,onToggleEnabled:Gi}),s.jsx(Zc,{busy:cs,connected:g==="connected",dismissed:na,feedback:Vr,synced:ta,t:B,onPull:()=>{Mn("pull")},onPushMerge:()=>{Mn("pushMerge")},onPushReplace:()=>{Mn("pushReplace")},onSkip:Wi}),s.jsx(el,{connected:g==="connected",metadata:wt,restartBusy:Dt.loading&&Dt.action==="restart",showUpdate:ea,t:B,updateBusy:Dt.loading&&Dt.action==="update",updateStatus:Dt.statusText,onRestart:()=>{js("restart")},onUpdate:()=>{js("update")}})]}):null]})]}),s.jsx(al,{client:e.current,close:()=>Me(null),id:ke,sessions:$,t:B})]})}const Wd=Object.freeze(Object.defineProperty({__proto__:null,App:Bd},Symbol.toStringTag,{value:"Module"}));export{Wd as A,fl as C,Ct as F,Ja as K,fn as L,Vt as R,jo as T,we as X,rr as a,Sn as b,$o as c,Nt as d,nr as e,Xn as f,Hn as j,Ts as p,ll as r,vn as u};
@@ -1 +0,0 @@
1
- import{j as a}from"./index-C912jm0R.js";import{C as i}from"./App-CnoeNagf.js";function c({language:l,t:e,onLanguageChange:s}){return a.jsxs("section",{className:"control-section compact-section",children:[a.jsx("h2",{children:e.language}),a.jsxs("label",{className:"field",children:[a.jsx("span",{children:e.displayLanguage}),a.jsx(i,{ariaLabel:e.displayLanguage,options:[{value:"system",label:e.followSystem},{value:"en",label:e.english},{value:"zh",label:e.chinese}],value:l,onChange:n=>s(n)})]})]})}export{c as LanguageSettingsPanel};