agent-tower 0.4.3 → 0.4.5

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 (46) hide show
  1. package/dist/routes/files.d.ts.map +1 -1
  2. package/dist/routes/files.js +1 -0
  3. package/dist/routes/files.js.map +1 -1
  4. package/dist/routes/filesystem.d.ts.map +1 -1
  5. package/dist/routes/filesystem.js +16 -1
  6. package/dist/routes/filesystem.js.map +1 -1
  7. package/dist/routes/git.d.ts.map +1 -1
  8. package/dist/routes/git.js +1 -0
  9. package/dist/routes/git.js.map +1 -1
  10. package/dist/routes/projects.d.ts.map +1 -1
  11. package/dist/routes/projects.js +6 -1
  12. package/dist/routes/projects.js.map +1 -1
  13. package/dist/routes/tasks.js +1 -1
  14. package/dist/routes/tasks.js.map +1 -1
  15. package/dist/services/project.service.d.ts.map +1 -1
  16. package/dist/services/project.service.js +7 -2
  17. package/dist/services/project.service.js.map +1 -1
  18. package/dist/web/assets/{AgentDemoPage-Bm-3uhK_.js → AgentDemoPage-CB48v8IV.js} +1 -1
  19. package/dist/web/assets/{DemoPage-TFE2qMhV.js → DemoPage-_dT9rdpV.js} +1 -1
  20. package/dist/web/assets/{GeneralSettingsPage-CyQmiUK1.js → GeneralSettingsPage-DtD_oirE.js} +1 -1
  21. package/dist/web/assets/{NotificationSettingsPage-CLAjR_nJ.js → NotificationSettingsPage-DQqz8xJs.js} +1 -1
  22. package/dist/web/assets/{ProfileSettingsPage-ApLKiykg.js → ProfileSettingsPage-BaFNyfse.js} +1 -1
  23. package/dist/web/assets/{ProjectKanbanPage-B1aozA_7.js → ProjectKanbanPage-DNCKy0g4.js} +3 -3
  24. package/dist/web/assets/{ProjectSettingsPage-BZXMxNIw.js → ProjectSettingsPage-Cv6VpL1g.js} +1 -1
  25. package/dist/web/assets/{ProviderSettingsPage-CfLduglc.js → ProviderSettingsPage-BqmSJV2I.js} +1 -1
  26. package/dist/web/assets/{button-2amePQEd.js → button-Cg3N0RX4.js} +1 -1
  27. package/dist/web/assets/{chevron-down-wgZs074C.js → chevron-down-BZ2n6wh3.js} +1 -1
  28. package/dist/web/assets/{chevron-right-BCroanpY.js → chevron-right-BrrhT2ph.js} +1 -1
  29. package/dist/web/assets/{circle-alert-j-2yKJ-Z.js → circle-alert-a6g1jQyL.js} +1 -1
  30. package/dist/web/assets/{circle-check-DS-_9pC8.js → circle-check-CQEg-cq1.js} +1 -1
  31. package/dist/web/assets/{code-block-OCS4YCEC-IB4-8hzU.js → code-block-OCS4YCEC-C72vBOSD.js} +1 -1
  32. package/dist/web/assets/{confirm-dialog-BLWrfawu.js → confirm-dialog-DmuQeQ0J.js} +1 -1
  33. package/dist/web/assets/folder-picker-Dl5GZRtL.js +1 -0
  34. package/dist/web/assets/{index-vg6PeELc.css → index-BGvfX18x.css} +1 -1
  35. package/dist/web/assets/{index-CLOtb2Es.js → index-D3_Vq2xm.js} +2 -2
  36. package/dist/web/assets/{loader-circle-BRpu-4c2.js → loader-circle-DRKF9OZx.js} +1 -1
  37. package/dist/web/assets/{mermaid-NOHMQCX5-COZZkjo8.js → mermaid-NOHMQCX5-DyQsSSRd.js} +3 -3
  38. package/dist/web/assets/{modal-D6rHuqas.js → modal-wSbeXj_V.js} +1 -1
  39. package/dist/web/assets/{pencil-iSjdfCcI.js → pencil-CT2HBX6f.js} +1 -1
  40. package/dist/web/assets/{rotate-ccw-u0yrABr3.js → rotate-ccw-DkZPjdAj.js} +1 -1
  41. package/dist/web/assets/{select-HYu8EZw-.js → select-BRJQTh28.js} +1 -1
  42. package/dist/web/assets/{use-profiles-BhAhQrOF.js → use-profiles-zSSuAJaA.js} +1 -1
  43. package/dist/web/assets/{use-providers-KlDj-ZVv.js → use-providers-BfLpM8PB.js} +1 -1
  44. package/dist/web/index.html +2 -2
  45. package/package.json +1 -1
  46. package/dist/web/assets/folder-picker-C9TegXbq.js +0 -1
@@ -1 +1 @@
1
- import{h as l,r as a,j as e}from"./index-CLOtb2Es.js";import{c}from"./utils-CkSf8FUe.js";const h=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],k=l("plus",h);const b=[["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"}]],w=l("trash-2",b);const f=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],x=l("x",f),p=({isOpen:t,onClose:s,title:i,children:u,action:n,className:m})=>{const[y,d]=a.useState(!1);a.useEffect(()=>{if(t)d(!0),document.body.style.overflow="hidden";else{const o=setTimeout(()=>d(!1),200);return document.body.style.overflow="unset",()=>clearTimeout(o)}},[t]);const r=a.useCallback(o=>{o.key==="Escape"&&s()},[s]);return a.useEffect(()=>{if(t)return document.addEventListener("keydown",r),()=>{document.removeEventListener("keydown",r)}},[t,r]),!y&&!t?null:e.jsxs("div",{className:c("fixed inset-0 z-50 flex items-center justify-center p-4 transition-opacity duration-200",t?"opacity-100":"opacity-0"),children:[e.jsx("div",{className:"absolute inset-0 bg-white/80 backdrop-blur-sm",onClick:s}),e.jsxs("div",{className:c("relative w-full max-w-lg bg-white rounded-xl shadow-2xl shadow-neutral-200/50 border border-neutral-100 transform transition-all duration-200",t?"scale-100 translate-y-0":"scale-95 translate-y-2",m),children:[e.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-neutral-50",children:[e.jsx("h3",{className:"font-semibold text-neutral-900",children:i}),e.jsx("button",{onClick:s,className:"text-neutral-400 hover:text-neutral-900 transition-colors",children:e.jsx(x,{size:18})})]}),e.jsx("div",{className:"p-6",children:u}),n?e.jsx("div",{className:"px-6 py-4 bg-neutral-50 rounded-b-xl border-t border-neutral-100 flex justify-end gap-3",children:n}):null]})]})},M=Object.freeze(Object.defineProperty({__proto__:null,Modal:p},Symbol.toStringTag,{value:"Module"}));export{p as M,k as P,w as T,x as X,M as m};
1
+ import{h as l,r as a,j as e}from"./index-D3_Vq2xm.js";import{c}from"./utils-CkSf8FUe.js";const h=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],k=l("plus",h);const b=[["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"}]],w=l("trash-2",b);const f=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],x=l("x",f),p=({isOpen:t,onClose:s,title:i,children:u,action:n,className:m})=>{const[y,d]=a.useState(!1);a.useEffect(()=>{if(t)d(!0),document.body.style.overflow="hidden";else{const o=setTimeout(()=>d(!1),200);return document.body.style.overflow="unset",()=>clearTimeout(o)}},[t]);const r=a.useCallback(o=>{o.key==="Escape"&&s()},[s]);return a.useEffect(()=>{if(t)return document.addEventListener("keydown",r),()=>{document.removeEventListener("keydown",r)}},[t,r]),!y&&!t?null:e.jsxs("div",{className:c("fixed inset-0 z-50 flex items-center justify-center p-4 transition-opacity duration-200",t?"opacity-100":"opacity-0"),children:[e.jsx("div",{className:"absolute inset-0 bg-white/80 backdrop-blur-sm",onClick:s}),e.jsxs("div",{className:c("relative w-full max-w-lg bg-white rounded-xl shadow-2xl shadow-neutral-200/50 border border-neutral-100 transform transition-all duration-200",t?"scale-100 translate-y-0":"scale-95 translate-y-2",m),children:[e.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-neutral-50",children:[e.jsx("h3",{className:"font-semibold text-neutral-900",children:i}),e.jsx("button",{onClick:s,className:"text-neutral-400 hover:text-neutral-900 transition-colors",children:e.jsx(x,{size:18})})]}),e.jsx("div",{className:"p-6",children:u}),n?e.jsx("div",{className:"px-6 py-4 bg-neutral-50 rounded-b-xl border-t border-neutral-100 flex justify-end gap-3",children:n}):null]})]})},M=Object.freeze(Object.defineProperty({__proto__:null,Modal:p},Symbol.toStringTag,{value:"Module"}));export{p as M,k as P,w as T,x as X,M as m};
@@ -1 +1 @@
1
- import{h as a}from"./index-CLOtb2Es.js";const e=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],c=a("pencil",e);export{c as P};
1
+ import{h as a}from"./index-D3_Vq2xm.js";const e=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],c=a("pencil",e);export{c as P};
@@ -1 +1 @@
1
- import{h as a}from"./index-CLOtb2Es.js";const o=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],d=a("file",o);const e=[["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"}]],h=a("folder",e);const t=[["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"}]],s=a("rotate-ccw",t);export{h as F,s as R,d as a};
1
+ import{h as a}from"./index-D3_Vq2xm.js";const o=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],d=a("file",o);const e=[["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"}]],h=a("folder",e);const t=[["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"}]],s=a("rotate-ccw",t);export{h as F,s as R,d as a};
@@ -1 +1 @@
1
- import{u as p,r as n,j as t}from"./index-CLOtb2Es.js";import{c as r}from"./utils-CkSf8FUe.js";import{C as w,a as v}from"./chevron-down-wgZs074C.js";function g({value:l,onChange:d,options:o,placeholder:m="Select...",disabled:f=!1,className:x}){const{t:i}=p(),[s,a]=n.useState(!1),c=n.useRef(null),u=o.find(e=>e.value===l);n.useEffect(()=>{if(!s)return;const e=h=>{c.current&&!c.current.contains(h.target)&&a(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[s]);const b=n.useCallback(e=>{e.key==="Escape"&&a(!1)},[]);return t.jsxs("div",{ref:c,className:r("relative",x),onKeyDown:b,children:[t.jsxs("button",{type:"button",disabled:f,onClick:()=>a(e=>!e),className:r("flex items-center justify-between w-full h-9 px-3 border rounded-lg text-sm transition-colors","bg-white border-neutral-200 hover:border-neutral-300","focus:outline-none focus:border-neutral-400","disabled:opacity-50 disabled:cursor-not-allowed",s&&"border-neutral-400",!u&&"text-neutral-400"),children:[t.jsx("span",{className:"truncate",children:u?u.label:i(m)}),t.jsx(w,{size:14,className:r("ml-2 shrink-0 text-neutral-400 transition-transform duration-150",s&&"rotate-180")})]}),s&&t.jsx("div",{className:"absolute z-50 mt-1 w-full min-w-[160px] bg-white border border-neutral-200 rounded-lg shadow-lg shadow-neutral-200/50 py-1 max-h-[200px] overflow-y-auto",children:o.length===0?t.jsx("div",{className:"px-3 py-2 text-sm text-neutral-400",children:i("No options")}):o.map(e=>t.jsxs("button",{type:"button",disabled:e.disabled,onClick:()=>{d(e.value),a(!1)},className:r("flex items-center w-full px-3 py-1.5 text-sm text-left transition-colors","hover:bg-neutral-50",e.value===l?"text-neutral-900 font-medium":"text-neutral-600",e.disabled&&"opacity-40 cursor-not-allowed"),children:[t.jsx(v,{size:14,className:r("mr-2 shrink-0",e.value===l?"opacity-100":"opacity-0")}),t.jsx("span",{className:"truncate",children:e.label})]},e.value))})]})}export{g as S};
1
+ import{u as p,r as n,j as t}from"./index-D3_Vq2xm.js";import{c as r}from"./utils-CkSf8FUe.js";import{C as w,a as v}from"./chevron-down-BZ2n6wh3.js";function g({value:l,onChange:d,options:o,placeholder:m="Select...",disabled:f=!1,className:x}){const{t:i}=p(),[s,a]=n.useState(!1),c=n.useRef(null),u=o.find(e=>e.value===l);n.useEffect(()=>{if(!s)return;const e=h=>{c.current&&!c.current.contains(h.target)&&a(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[s]);const b=n.useCallback(e=>{e.key==="Escape"&&a(!1)},[]);return t.jsxs("div",{ref:c,className:r("relative",x),onKeyDown:b,children:[t.jsxs("button",{type:"button",disabled:f,onClick:()=>a(e=>!e),className:r("flex items-center justify-between w-full h-9 px-3 border rounded-lg text-sm transition-colors","bg-white border-neutral-200 hover:border-neutral-300","focus:outline-none focus:border-neutral-400","disabled:opacity-50 disabled:cursor-not-allowed",s&&"border-neutral-400",!u&&"text-neutral-400"),children:[t.jsx("span",{className:"truncate",children:u?u.label:i(m)}),t.jsx(w,{size:14,className:r("ml-2 shrink-0 text-neutral-400 transition-transform duration-150",s&&"rotate-180")})]}),s&&t.jsx("div",{className:"absolute z-50 mt-1 w-full min-w-[160px] bg-white border border-neutral-200 rounded-lg shadow-lg shadow-neutral-200/50 py-1 max-h-[200px] overflow-y-auto",children:o.length===0?t.jsx("div",{className:"px-3 py-2 text-sm text-neutral-400",children:i("No options")}):o.map(e=>t.jsxs("button",{type:"button",disabled:e.disabled,onClick:()=>{d(e.value),a(!1)},className:r("flex items-center w-full px-3 py-1.5 text-sm text-left transition-colors","hover:bg-neutral-50",e.value===l?"text-neutral-900 font-medium":"text-neutral-600",e.disabled&&"opacity-40 cursor-not-allowed"),children:[t.jsx(v,{size:14,className:r("mr-2 shrink-0",e.value===l?"opacity-100":"opacity-0")}),t.jsx("span",{className:"truncate",children:e.label})]},e.value))})]})}export{g as S};
@@ -1 +1 @@
1
- import{d as n,e as i,f as a,q as s,g as r}from"./index-CLOtb2Es.js";function f(){return n({queryKey:s.profiles.all,queryFn:()=>r.get("/profiles")})}function y(){return n({queryKey:s.profiles.defaults,queryFn:()=>r.get("/profiles/defaults")})}function c(e){return n({queryKey:s.profiles.agent(e),queryFn:()=>r.get(`/profiles/${e}`),enabled:!!e})}function p(){const e=i();return a({mutationFn:({agentType:u,variant:t,config:l})=>r.put(`/profiles/${u}/${t}`,l),onSuccess:()=>{e.invalidateQueries({queryKey:s.profiles.all})}})}function q(){const e=i();return a({mutationFn:({agentType:u,variant:t})=>r.delete(`/profiles/${u}/${t}`),onSuccess:()=>{e.invalidateQueries({queryKey:s.profiles.all})}})}export{y as a,p as b,q as c,c as d,f as u};
1
+ import{d as n,e as i,f as a,q as s,g as r}from"./index-D3_Vq2xm.js";function f(){return n({queryKey:s.profiles.all,queryFn:()=>r.get("/profiles")})}function y(){return n({queryKey:s.profiles.defaults,queryFn:()=>r.get("/profiles/defaults")})}function c(e){return n({queryKey:s.profiles.agent(e),queryFn:()=>r.get(`/profiles/${e}`),enabled:!!e})}function p(){const e=i();return a({mutationFn:({agentType:u,variant:t,config:l})=>r.put(`/profiles/${u}/${t}`,l),onSuccess:()=>{e.invalidateQueries({queryKey:s.profiles.all})}})}function q(){const e=i();return a({mutationFn:({agentType:u,variant:t})=>r.delete(`/profiles/${u}/${t}`),onSuccess:()=>{e.invalidateQueries({queryKey:s.profiles.all})}})}export{y as a,p as b,q as c,c as d,f as u};
@@ -1 +1 @@
1
- import{d as n,e as u,f as t,q as i,g as s}from"./index-CLOtb2Es.js";function p(){return n({queryKey:i.providers.all,queryFn:()=>s.get("/providers")})}function c(){const e=u();return t({mutationFn:r=>s.post("/providers",r),onSuccess:()=>{e.invalidateQueries({queryKey:i.providers.all})}})}function d(){const e=u();return t({mutationFn:({id:r,data:o})=>s.put(`/providers/${r}`,o),onSuccess:()=>{e.invalidateQueries({queryKey:i.providers.all})}})}function v(){const e=u();return t({mutationFn:r=>s.delete(`/providers/${r}`),onSuccess:()=>{e.invalidateQueries({queryKey:i.providers.all})}})}function l(){return t({mutationFn:()=>s.get("/providers/backup")})}function y(){return t({mutationFn:e=>s.post("/providers/import/preview",e)})}function m(){const e=u();return t({mutationFn:r=>s.post("/providers/import",r),onSuccess:()=>{e.invalidateQueries({queryKey:i.providers.all})}})}export{c as a,d as b,v as c,l as d,y as e,m as f,p as u};
1
+ import{d as n,e as u,f as t,q as i,g as s}from"./index-D3_Vq2xm.js";function p(){return n({queryKey:i.providers.all,queryFn:()=>s.get("/providers")})}function c(){const e=u();return t({mutationFn:r=>s.post("/providers",r),onSuccess:()=>{e.invalidateQueries({queryKey:i.providers.all})}})}function d(){const e=u();return t({mutationFn:({id:r,data:o})=>s.put(`/providers/${r}`,o),onSuccess:()=>{e.invalidateQueries({queryKey:i.providers.all})}})}function v(){const e=u();return t({mutationFn:r=>s.delete(`/providers/${r}`),onSuccess:()=>{e.invalidateQueries({queryKey:i.providers.all})}})}function l(){return t({mutationFn:()=>s.get("/providers/backup")})}function y(){return t({mutationFn:e=>s.post("/providers/import/preview",e)})}function m(){const e=u();return t({mutationFn:r=>s.post("/providers/import",r),onSuccess:()=>{e.invalidateQueries({queryKey:i.providers.all})}})}export{c as a,d as b,v as c,l as d,y as e,m as f,p as u};
@@ -5,8 +5,8 @@
5
5
  <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover" />
7
7
  <title>web</title>
8
- <script type="module" crossorigin src="/assets/index-CLOtb2Es.js"></script>
9
- <link rel="stylesheet" crossorigin href="/assets/index-vg6PeELc.css">
8
+ <script type="module" crossorigin src="/assets/index-D3_Vq2xm.js"></script>
9
+ <link rel="stylesheet" crossorigin href="/assets/index-BGvfX18x.css">
10
10
  </head>
11
11
  <body>
12
12
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-tower",
3
- "version": "0.4.3",
3
+ "version": "0.4.5",
4
4
  "description": "AI Agent Task Management Dashboard",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1 +0,0 @@
1
- import{u as Z,r as a,g as C,j as e,F as w}from"./index-CLOtb2Es.js";import{c as d}from"./utils-CkSf8FUe.js";import{C as E}from"./chevron-right-BCroanpY.js";import{L as S}from"./loader-circle-BRpu-4c2.js";import{C as z}from"./circle-alert-j-2yKJ-Z.js";import{F as G}from"./rotate-ccw-u0yrABr3.js";function Q({value:n,onChange:p,placeholder:D}){const{t:P}=Z(),[u,R]=a.useState(""),[h,V]=a.useState([]),[f,F]=a.useState(""),[L,I]=a.useState("/"),[B,j]=a.useState(!1),[g,N]=a.useState(null),[m,b]=a.useState(n),[v,i]=a.useState(null),[A,y]=a.useState(!1),k=a.useRef(!1);a.useEffect(()=>{b(n)},[n]);const r=a.useCallback(async t=>{j(!0),N(null);try{const s={};t&&(s.path=t);const l=await C.get("/filesystem/browse",{params:s});R(l.current),F(l.parent),I(l.sep||"/"),V(l.dirs)}catch(s){N(s instanceof Error?s.message:"Failed to browse directory")}finally{j(!1)}},[]);a.useEffect(()=>{k.current||(k.current=!0,r())},[r]);const o=a.useCallback(async t=>{y(!0),i(null);try{const s=await C.get("/filesystem/validate",{params:{path:t}});s.valid?(p(t),i(null)):i(s.error??"Not a Git repository")}catch(s){i(s instanceof Error?s.message:"Validation failed")}finally{y(!1)}},[p]),K=a.useCallback(t=>{t.isGitRepo?(o(t.path),r(t.path)):(r(t.path),i(null))},[o,r]),c=L==="\\",x=u?u.split(/[\\/]/).filter(Boolean):[],U=a.useCallback(t=>{const s=x.slice(0,t+1);let l;c?(l=s.join("\\"),s.length===1&&/^[A-Za-z]:$/.test(s[0])&&(l+="\\")):l="/"+s.join("/"),r(l),i(null)},[x,r,c]),W=a.useCallback(t=>{if(t.key==="Enter"&&!t.nativeEvent.isComposing&&t.nativeEvent.keyCode!==229){t.preventDefault();const s=m.trim();s&&(r(s),o(s))}},[m,r,o]);return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:"text",value:m,onChange:t=>b(t.target.value),onKeyDown:W,placeholder:D??"e.g., /Users/me/projects/my-repo",className:d("w-full px-3 py-2 border rounded-lg text-sm font-mono focus:outline-none transition-colors pr-8",n?"border-emerald-300 bg-emerald-50/50 focus:border-emerald-400":"border-neutral-200 focus:border-neutral-400")}),n&&e.jsx(w,{size:14,className:"absolute right-3 top-1/2 -translate-y-1/2 text-emerald-500"})]}),e.jsx("p",{className:"text-xs text-neutral-400",children:P("Browse and select a Git repository, or type a path and press Enter")}),e.jsxs("div",{className:"flex items-center gap-0.5 text-xs text-neutral-500 overflow-x-auto pb-1 scrollbar-none",children:[!c&&e.jsx("button",{onClick:()=>r("/"),className:"hover:text-neutral-900 transition-colors flex-shrink-0 px-1 py-0.5 rounded hover:bg-neutral-100",children:"/"}),x.map((t,s)=>e.jsxs("span",{className:"flex items-center gap-0.5 flex-shrink-0",children:[(c?s>0:!0)&&e.jsx(E,{size:10,className:"text-neutral-300"}),e.jsx("button",{onClick:()=>U(s),className:d("px-1 py-0.5 rounded transition-colors truncate max-w-[120px]",s===x.length-1?"font-medium text-neutral-900":"hover:text-neutral-900 hover:bg-neutral-100"),children:t})]},s))]}),e.jsx("div",{className:"border border-neutral-200 rounded-lg overflow-hidden",children:e.jsx("div",{className:"max-h-[200px] overflow-y-auto",children:B?e.jsxs("div",{className:"flex items-center justify-center py-8 text-neutral-400",children:[e.jsx(S,{size:16,className:"animate-spin mr-2"}),e.jsx("span",{className:"text-xs",children:"Loading..."})]}):g?e.jsxs("div",{className:"flex items-center justify-center py-8 text-red-500 gap-2",children:[e.jsx(z,{size:14}),e.jsx("span",{className:"text-xs",children:g})]}):h.length===0?e.jsx("div",{className:"flex items-center justify-center py-8 text-neutral-400",children:e.jsx("span",{className:"text-xs",children:"No subdirectories"})}):e.jsxs("ul",{className:"divide-y divide-neutral-100",children:[u!==f&&e.jsx("li",{children:e.jsxs("button",{onClick:()=>r(f),className:"w-full flex items-center gap-2.5 px-3 py-2 text-left hover:bg-neutral-50 transition-colors group",children:[e.jsx(G,{size:14,className:"text-neutral-400 flex-shrink-0"}),e.jsx("span",{className:"text-xs text-neutral-500 group-hover:text-neutral-700",children:".."})]})}),h.map(t=>e.jsx("li",{children:e.jsxs("button",{onClick:()=>K(t),className:d("w-full flex items-center gap-2.5 px-3 py-2 text-left transition-colors group",t.path===n?"bg-emerald-50":"hover:bg-neutral-50"),children:[t.isGitRepo?e.jsx(w,{size:14,className:"text-emerald-500 flex-shrink-0"}):e.jsx(G,{size:14,className:"text-neutral-400 flex-shrink-0"}),e.jsx("span",{className:d("text-xs truncate",t.path===n?"font-medium text-emerald-700":"text-neutral-700 group-hover:text-neutral-900"),children:t.name}),t.isGitRepo&&e.jsx("span",{className:"ml-auto flex-shrink-0 text-[10px] font-medium bg-emerald-100 text-emerald-600 px-1.5 py-0.5 rounded",children:"Git"}),!t.isGitRepo&&e.jsx(E,{size:12,className:"ml-auto text-neutral-300 group-hover:text-neutral-400 flex-shrink-0"})]})},t.path))]})})}),A&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-neutral-400",children:[e.jsx(S,{size:12,className:"animate-spin"}),e.jsx("span",{children:"Validating..."})]}),v&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-red-500",children:[e.jsx(z,{size:12}),e.jsx("span",{children:v})]})]})}export{Q as FolderPicker};