@xopcai/xopc 0.0.201 → 0.0.202

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 (82) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-D8Cw0Mve.js → agent-avatar-dicebear-CAjfa48Q.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agents-ANavi648.js → agents-Cke8EF5Z.js} +1 -1
  5. package/dist/gateway/static/root/assets/{app-management-settings-panel-BubrReXg.js → app-management-settings-panel-GNT3iv0V.js} +1 -1
  6. package/dist/gateway/static/root/assets/{appearance-settings-BY5Az2p4.js → appearance-settings-BFond2ll.js} +1 -1
  7. package/dist/gateway/static/root/assets/{apps-page-CFh9MBxc.js → apps-page-B9D-6sJt.js} +1 -1
  8. package/dist/gateway/static/root/assets/{archive-plugin-BY8843mB.js → archive-plugin-C6qpchzp.js} +1 -1
  9. package/dist/gateway/static/root/assets/{attachment-load-DG45KScf.js → attachment-load-B4CcSDdV.js} +1 -1
  10. package/dist/gateway/static/root/assets/{automations-page-751CeNI3.js → automations-page-BFS3dH43.js} +1 -1
  11. package/dist/gateway/static/root/assets/{binary-plugins-DGIF2ZAv.js → binary-plugins-xYL_41XP.js} +1 -1
  12. package/dist/gateway/static/root/assets/{block-editor-C1Qktr1g.js → block-editor-nYiJQItv.js} +1 -1
  13. package/dist/gateway/static/root/assets/{browser-settings-page-CGAWs-TT.js → browser-settings-page-ELV-Y8rz.js} +1 -1
  14. package/dist/gateway/static/root/assets/{browser-workflows-page-DyIRvPaq.js → browser-workflows-page-pT7Hvwwh.js} +1 -1
  15. package/dist/gateway/static/root/assets/{capabilities-settings-panel-CghUK68J.js → capabilities-settings-panel-Dbx_nPAI.js} +1 -1
  16. package/dist/gateway/static/root/assets/{capability-presets-settings-panel-XsTfkvUn.js → capability-presets-settings-panel-DHg_JMUz.js} +1 -1
  17. package/dist/gateway/static/root/assets/{channels-settings-DkoAZZMe.js → channels-settings-DjHOlPq-.js} +1 -1
  18. package/dist/gateway/static/root/assets/{connectors-api-FBOe9SWC.js → connectors-api-X5ukNasZ.js} +1 -1
  19. package/dist/gateway/static/root/assets/{connectors-page-e4vekkAu.js → connectors-page-RY-W6CQt.js} +1 -1
  20. package/dist/gateway/static/root/assets/{cron-expression-Q4QaYjpI.js → cron-expression-DHY0LrLq.js} +1 -1
  21. package/dist/gateway/static/root/assets/{date-picker-Dtn7e6TW.js → date-picker-CGm8EH8G.js} +1 -1
  22. package/dist/gateway/static/root/assets/{dependency-picker-Br6nPaM6.js → dependency-picker-DDECr6Hj.js} +1 -1
  23. package/dist/gateway/static/root/assets/{desktop-pet-DzTM6aH8.js → desktop-pet-BoEIRgm2.js} +1 -1
  24. package/dist/gateway/static/root/assets/{desktop-pet-settings-FDmaty3P.js → desktop-pet-settings-s4kmnf-W.js} +1 -1
  25. package/dist/gateway/static/root/assets/{directory-picker-path-field-X2e8xn8j.js → directory-picker-path-field-DmfFg4Gq.js} +1 -1
  26. package/dist/gateway/static/root/assets/{extension-debug-page-Dx4MBfga.js → extension-debug-page-DrLEK8GU.js} +1 -1
  27. package/dist/gateway/static/root/assets/{extension-page-Bf_FEDhM.js → extension-page-DtyFPtMR.js} +1 -1
  28. package/dist/gateway/static/root/assets/{extension-settings-page-CrOgZxkf.js → extension-settings-page-Xok6T2KD.js} +1 -1
  29. package/dist/gateway/static/root/assets/{gateway-config-api-CZ4r-7qT.js → gateway-config-api-DwSpEYiw.js} +1 -1
  30. package/dist/gateway/static/root/assets/{gateway-settings-DpWmVi0w.js → gateway-settings-B5Zh2rx9.js} +1 -1
  31. package/dist/gateway/static/root/assets/{heartbeat-settings-DSQZhSvT.js → heartbeat-settings-C2RxqeK0.js} +1 -1
  32. package/dist/gateway/static/root/assets/{home-page-L0uHiu0T.js → home-page-DPhkqxEb.js} +1 -1
  33. package/dist/gateway/static/root/assets/{index-DRrjYYzZ.js → index-CKSplmFw.js} +12 -12
  34. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-Bc3Quw42.js → keyboard-shortcuts-settings-BN3p-1wI.js} +1 -1
  35. package/dist/gateway/static/root/assets/{local-app-workbench-page-Copi3sdP.js → local-app-workbench-page-D7FmunJF.js} +1 -1
  36. package/dist/gateway/static/root/assets/{local-apps-page-CP9X_vtz.js → local-apps-page-C7H807zd.js} +1 -1
  37. package/dist/gateway/static/root/assets/{logs-page-DMKq6e29.js → logs-page-vrjf-JTk.js} +1 -1
  38. package/dist/gateway/static/root/assets/{management-settings-CJmcaVje.js → management-settings-CTIaHfgU.js} +1 -1
  39. package/dist/gateway/static/root/assets/{markdown-split-AcuFp0TH.js → markdown-split-C0iKadAm.js} +1 -1
  40. package/dist/gateway/static/root/assets/{media-plugins-BvFgsiJL.js → media-plugins-DcM72GSJ.js} +1 -1
  41. package/dist/gateway/static/root/assets/{notes-page-IW7IQ9nJ.js → notes-page-By_EzRhP.js} +1 -1
  42. package/dist/gateway/static/root/assets/{notes-workbench-Zb8U0anO.js → notes-workbench-Cp1ierS_.js} +2 -2
  43. package/dist/gateway/static/root/assets/{preview-open-alternatives-C-b34dgQ.js → preview-open-alternatives-CpblfmWk.js} +1 -1
  44. package/dist/gateway/static/root/assets/{product-open-page-CWEzLykF.js → product-open-page-dQ2_5PLu.js} +1 -1
  45. package/dist/gateway/static/root/assets/{project-detail-page-BuIbLnan.js → project-detail-page-Cp_jfZJj.js} +1 -1
  46. package/dist/gateway/static/root/assets/{projects-page-BwUfRqNV.js → projects-page-DYbmweGw.js} +1 -1
  47. package/dist/gateway/static/root/assets/{remote-access-hub-BTaXxcEi.js → remote-access-hub-U2qXVyLH.js} +1 -1
  48. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DAohEZrX.js → runtime-tools-settings-panel-DiPj9FLN.js} +1 -1
  49. package/dist/gateway/static/root/assets/{schema-form-C_OBW8A5.js → schema-form-BDLYItBP.js} +1 -1
  50. package/dist/gateway/static/root/assets/{sessions-page-BnHoTCD3.js → sessions-page-CtNKNhCi.js} +1 -1
  51. package/dist/gateway/static/root/assets/settings-advanced-gate-B6IMzhWo.js +1 -0
  52. package/dist/gateway/static/root/assets/{settings-form-section-C7w2WS-A.js → settings-form-section-Dr4Uf_CY.js} +1 -1
  53. package/dist/gateway/static/root/assets/{settings-loading-skeleton-zwibve4m.js → settings-loading-skeleton-Bqi7tsXj.js} +1 -1
  54. package/dist/gateway/static/root/assets/{settings-page-B9W03dSW.js → settings-page-BbookgxJ.js} +1 -1
  55. package/dist/gateway/static/root/assets/{setup-status-panel-C8Hec2Af.js → setup-status-panel-mUu0iDlD.js} +1 -1
  56. package/dist/gateway/static/root/assets/{share-preview-page-6e3ks2be.js → share-preview-page-1M79esSO.js} +1 -1
  57. package/dist/gateway/static/root/assets/{shares-settings-Bwc5HfLI.js → shares-settings-DadcMA8y.js} +1 -1
  58. package/dist/gateway/static/root/assets/{skill-reload-api-D7kunhqy.js → skill-reload-api-C3ZzYCz0.js} +1 -1
  59. package/dist/gateway/static/root/assets/{skills-page-WgkaNzpc.js → skills-page-B3kqZ-ke.js} +1 -1
  60. package/dist/gateway/static/root/assets/{skills-page.utils-D9QT5cxj.js → skills-page.utils-b9byH-KL.js} +1 -1
  61. package/dist/gateway/static/root/assets/{system-settings-panel-c1HVtv1Y.js → system-settings-panel-CL_AXjw1.js} +1 -1
  62. package/dist/gateway/static/root/assets/{task-detail-page-CjP-6WVU.js → task-detail-page-Bnjpkl4v.js} +1 -1
  63. package/dist/gateway/static/root/assets/{use-autosave-D6UkH_Ga.js → use-autosave-CUI3q_I-.js} +1 -1
  64. package/dist/gateway/static/root/assets/{user-context-page-D8ZhPDNF.js → user-context-page-CBgAAZiB.js} +1 -1
  65. package/dist/gateway/static/root/assets/{voice-api-key-field-BOxkKbGh.js → voice-api-key-field-DLXOB1jw.js} +1 -1
  66. package/dist/gateway/static/root/assets/{work-discovery-overlay-Dd19yK9t.js → work-discovery-overlay-BvlvyVJX.js} +1 -1
  67. package/dist/gateway/static/root/assets/{work-discovery-page-DUkdJl1e.js → work-discovery-page-BBpnnnrs.js} +1 -1
  68. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-ZA3bP65I.js → workflow-run-setup-panel-DKpUxB-i.js} +1 -1
  69. package/dist/gateway/static/root/assets/{workflows-page-C2b5W5bw.js → workflows-page-Dd_9p9ji.js} +1 -1
  70. package/dist/gateway/static/root/index.html +1 -1
  71. package/dist/package.js +1 -1
  72. package/dist/src/agent/agent-manager.js +1 -1
  73. package/dist/src/agent/memory/create-memory-manager.js +1 -1
  74. package/dist/src/agent-runtime/index.js +1 -1
  75. package/dist/src/agent-runtime/runtime-profile.js +1 -1
  76. package/dist/src/gateway/heartbeat/service.js +1 -1
  77. package/dist/src/gateway/hono/oauth-async.d.ts +1 -0
  78. package/dist/src/gateway/hono/oauth-async.js +14 -2
  79. package/dist/src/gateway/service.js +5 -5
  80. package/dist/src/heartbeat/index.js +1 -1
  81. package/package.json +3 -3
  82. package/dist/gateway/static/root/assets/settings-advanced-gate-BTB_fxjt.js +0 -1
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,f as a,l as o,t as s}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as c}from"./check-DUBLcKHA.js";import{d as l,f as u,l as d,n as f,p,r as m,u as h}from"./popover-select-BzdnTy3h.js";import{t as g}from"./copy-Dv6d4Dvw.js";import{t as _}from"./external-link-DjqjBmc3.js";import{t as v}from"./cn-JdwAhgNB.js";import{t as y}from"./button-CSEbl4zT.js";import{t as b}from"./copy-to-clipboard-HOJ79TWv.js";import{t as x}from"./messages-D7kOD_o_.js";import{n as S,r as C,s as w}from"./locale-store-CnamlR07.js";import{a as T,c as E,i as D,n as O,o as k,r as A,s as j,t as M}from"./dist-BPoKqzeH.js";import{$s as N,Aa as P,Ai as F,Al as ee,An as te,As as I,Ca as L,Dl as R,Ec as z,Ei as B,F as V,Fc as H,Fi as U,G as W,Gc as ne,Hc as G,Ic as re,Ii as K,Is as q,J as ie,Jo as ae,Js as oe,Jt as se,K as ce,Ks as le,Kt as ue,L as de,Li as fe,Ln as pe,M as me,Mi as he,Ml as ge,N as _e,Na as ve,Ni as ye,Ns as be,Ol as xe,Pi as Se,Ps as Ce,Qs as we,Ri as Te,Sa as Ee,Ss as De,Tc as Oe,Ti as ke,Tl as Ae,Va as je,Wa as Me,Wc as Ne,Ws as Pe,Xc as Fe,Xl as Ie,Yc as Le,Yo as Re,Ys as ze,Z as Be,Zr as Ve,_a as He,al as Ue,as as We,ba as Ge,bc as Ke,ca as qe,da as Je,fa as Ye,ga as Xe,ha as Ze,hs as Qe,ki as $e,kl as et,ks as tt,la as nt,ll as rt,ls as it,ma as at,pa as ot,pl as st,ql as ct,rs as lt,sa as ut,u as dt,ua as ft,uc as pt,ui as mt,va as ht,wa as gt,wl as _t,xa as vt,ya as yt,zi as bt}from"./index-DRrjYYzZ.js";import{t as xt}from"./notes-workbench-Zb8U0anO.js";import{n as St,t as Ct}from"./use-autosave-D6UkH_Ga.js";import{t as wt}from"./page-tabs-BaEQMYm_.js";import{t as Tt}from"./directory-picker-path-field-X2e8xn8j.js";import{t as Et}from"./date-picker-Dtn7e6TW.js";import{i as Dt,p as Ot,s as kt}from"./skills-page.utils-D9QT5cxj.js";import{t as At}from"./dependency-picker-Br6nPaM6.js";import{c as jt,l as Mt,n as Nt,o as Pt,r as Ft,t as It}from"./style-TIDOdKy0.js";var J=e(t(),1),Lt=n();function Rt(e){return w(C(`/api/projects/${encodeURIComponent(e)}/skills`))}function zt(e,t){return w(C(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`))}function Bt(e,t){let n=new FormData;return n.set(`file`,t),w(C(`/api/projects/${encodeURIComponent(e)}/skills/upload`),{method:`POST`,body:n})}function Vt(e,t,n={}){return w(C(`/api/projects/${encodeURIComponent(e)}/skills/marketplace/install`),{method:`POST`,body:JSON.stringify({name:t,...n})})}function Ht(e,t){return w(C(`/api/projects/${encodeURIComponent(e)}/skills/source/install`),{method:`POST`,body:JSON.stringify({source:t})})}function Ut(e,t){return w(C(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`),{method:`DELETE`})}var Y=r();function Wt({projectId:e,copy:t}){let[n,r]=(0,J.useState)([]),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(!0),[c,d]=(0,J.useState)(!1),[f,m]=(0,J.useState)(null),[g,b]=(0,J.useState)(``),[x,S]=(0,J.useState)(null),[C,w]=(0,J.useState)(null),[E,D]=(0,J.useState)(``),[N,P]=(0,J.useState)(1),[F,te]=(0,J.useState)(null),[I,L]=(0,J.useState)(!1),[R,z]=(0,J.useState)(``),[B,V]=(0,J.useState)(``),H=(0,J.useRef)(null),U=(0,J.useCallback)(async()=>{s(!0),b(``);try{let t=await Rt(e);r(t.items),a(t.skillsRoot)}catch(e){b(e instanceof Error?e.message:String(e))}finally{s(!1)}},[e]);(0,J.useEffect)(()=>{U()},[U]),(0,J.useEffect)(()=>{if(x!==`marketplace`)return;let e=new AbortController,t=window.setTimeout(()=>{L(!0),z(``),Ot({q:E,page:N,pageSize:8,sort:`downloads`,signal:e.signal}).then(te).catch(t=>{e.signal.aborted||z(t instanceof Error?t.message:String(t))}).finally(()=>{e.signal.aborted||L(!1)})},250);return()=>{window.clearTimeout(t),e.abort()}},[x,N,E]);async function W(e,t){d(!0),m(t??null),b(``);try{await e(),S(null),V(``),await U()}catch(e){b(e instanceof Error?e.message:String(e))}finally{d(!1),m(null)}}async function ne(t){b(``);try{w((await zt(e,t)).skill)}catch(e){b(e instanceof Error?e.message:String(e))}}async function re(n){if(window.confirm(t.removeConfirm.replace(`{{name}}`,n.name))){d(!0);try{await Ut(e,n.id),await U()}catch(e){b(e instanceof Error?e.message:String(e))}finally{d(!1)}}}return(0,Y.jsxs)(`section`,{id:`project-panel-skills`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-skills`,className:`grid content-start gap-4`,children:[(0,Y.jsxs)(`div`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.title}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,Y.jsxs)(u,{children:[(0,Y.jsx)(p,{asChild:!0,children:(0,Y.jsxs)(y,{type:`button`,children:[(0,Y.jsx)(Pe,{className:`size-4`,"aria-hidden":!0}),t.add,(0,Y.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0})]})}),(0,Y.jsx)(l,{children:(0,Y.jsxs)(h,{align:`end`,sideOffset:8,className:`z-50 w-72 rounded-lg border border-edge bg-surface-panel p-1.5 shadow-xl`,children:[(0,Y.jsx)(Gt,{icon:Qe,title:t.marketplace,hint:t.marketplaceHint,onClick:()=>S(`marketplace`)}),(0,Y.jsx)(Gt,{icon:G,title:t.source,hint:t.sourceHint,onClick:()=>S(`source`)}),(0,Y.jsx)(Gt,{icon:We,title:t.upload,hint:t.uploadHint,onClick:()=>H.current?.click()})]})})]}),(0,Y.jsx)(`input`,{ref:H,type:`file`,accept:`.zip,application/zip`,className:`hidden`,onChange:t=>{let n=t.target.files?.[0];n&&W(()=>Bt(e,n)),t.target.value=``}})]}),i?(0,Y.jsxs)(`p`,{className:`mt-3 break-all font-mono text-xs text-fg-subtle`,children:[t.path,`: `,i]}):null]}),g?(0,Y.jsx)(`p`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:g}):null,o?(0,Y.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(e=>(0,Y.jsx)(ve,{className:`h-36 rounded-lg`},e))}):n.length?(0,Y.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:n.map(e=>(0,Y.jsxs)(`article`,{className:`flex min-h-36 flex-col rounded-lg border border-edge bg-surface-panel p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(Ie,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,Y.jsx)(`h3`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:e.name})]}),(0,Y.jsx)(`p`,{className:`mt-2 line-clamp-2 flex-1 text-sm leading-5 text-fg-muted`,children:e.description||e.id}),(0,Y.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>void ne(e.id),children:[(0,Y.jsx)(_,{className:`size-3.5`,"aria-hidden":!0}),t.view]}),(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-red-600`,disabled:c,onClick:()=>void re(e),children:[(0,Y.jsx)(it,{className:`size-3.5`,"aria-hidden":!0}),t.remove]})]})]},e.id))}):(0,Y.jsxs)(`div`,{className:`rounded-lg border border-dashed border-edge bg-surface-panel px-6 py-12 text-center`,children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.empty}),(0,Y.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:t.emptyHint})]}),(0,Y.jsx)(M,{open:x!==null,onOpenChange:e=>{e||S(null)},children:(0,Y.jsxs)(k,{children:[(0,Y.jsx)(T,{className:`fixed inset-0 z-50 bg-black/45`}),(0,Y.jsxs)(A,{className:v(`fixed left-1/2 top-1/2 z-50 flex -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-xl`,x===`marketplace`?`h-[min(46rem,calc(100vh-2rem))] w-[min(58rem,calc(100vw-2rem))]`:`h-[min(22rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))]`),children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(j,{className:`text-base font-semibold text-fg`,children:x===`marketplace`?t.marketplace:t.source}),(0,Y.jsx)(O,{asChild:!0,children:(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,Y.jsx)(Re,{className:`size-4`})})})]}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:x===`marketplace`?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.marketplace}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.marketplaceHint}),(0,Y.jsxs)(`div`,{className:`relative mt-3`,children:[(0,Y.jsx)(be,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`input`,{className:`h-10 w-full rounded-md border border-edge bg-surface-base pl-9 pr-3 text-sm outline-none focus:border-accent`,value:E,onChange:e=>{D(e.target.value),P(1)},placeholder:t.marketplacePlaceholder,autoFocus:!0})]}),R?(0,Y.jsx)(`p`,{className:`mt-3 text-sm text-red-600 dark:text-red-300`,children:R}):null,I&&!F?(0,Y.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[0,1,2,3].map(e=>(0,Y.jsx)(ve,{className:`h-32 rounded-lg`},e))}):F?.items.length?(0,Y.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:F.items.map(r=>{let i=r.providerId??F.provider,a=Dt(r,i),o=n.some(e=>e.id===r.id||e.id===a||e.name===r.name),s=f===a;return(0,Y.jsxs)(`article`,{className:`group flex min-h-32 gap-3 rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Y.jsx)(kt,{name:r.name,className:`size-10`}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Y.jsx)(`h4`,{className:`truncate text-sm font-semibold text-fg`,children:r.name}),(0,Y.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:r.description||`—`}),(0,Y.jsxs)(`div`,{className:`mt-auto flex items-end justify-between gap-2 pt-2`,children:[(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-fg-subtle`,children:[(0,Y.jsx)(Ue,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceDownloads,` `,r.downloads]}),(0,Y.jsx)(y,{type:`button`,className:`h-8 px-2.5 text-xs`,variant:o?`secondary`:`primary`,disabled:c||o,onClick:()=>void W(()=>Vt(e,a,{provider:i}),a),children:o?t.marketplaceInstalled:s?t.installing:t.install})]})]})]},`${i??`default`}:${r.id}`)})}):I?null:(0,Y.jsx)(`p`,{className:`mt-6 text-center text-sm text-fg-muted`,children:t.marketplaceEmpty}),F&&F.meta.totalPages>1?(0,Y.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,Y.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t.marketplacePage.replace(`{{page}}`,String(F.meta.page)).replace(`{{total}}`,String(F.meta.totalPages))}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:I||N<=1,onClick:()=>P(e=>Math.max(1,e-1)),children:[(0,Y.jsx)(et,{className:`size-4`}),t.marketplacePrevious]}),(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:I||N>=F.meta.totalPages,onClick:()=>P(e=>e+1),children:[t.marketplaceNext,(0,Y.jsx)(xe,{className:`size-4`})]})]})]}):null]}):(0,Y.jsxs)(`section`,{className:`flex h-full flex-col`,children:[(0,Y.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:t.sourceHint}),(0,Y.jsx)(`input`,{className:`mt-4 h-10 w-full rounded-md border border-edge bg-surface-base px-3 text-sm outline-none focus:border-accent`,value:B,onChange:e=>V(e.target.value),placeholder:t.sourcePlaceholder,autoFocus:!0}),(0,Y.jsxs)(`div`,{className:`mt-auto flex justify-end gap-2 border-t border-edge pt-4`,children:[(0,Y.jsx)(O,{asChild:!0,children:(0,Y.jsx)(y,{type:`button`,variant:`secondary`,children:t.close})}),(0,Y.jsx)(y,{type:`button`,disabled:c||!B.trim(),onClick:()=>void W(()=>Ht(e,B.trim())),children:c?t.installing:t.install})]})]})})]})]})}),(0,Y.jsx)(M,{open:!!C,onOpenChange:e=>{e||w(null)},children:(0,Y.jsxs)(k,{children:[(0,Y.jsx)(T,{className:`fixed inset-0 z-50 bg-black/45`}),(0,Y.jsxs)(A,{className:`fixed left-1/2 top-1/2 z-50 flex h-[min(42rem,calc(100vh-2rem))] w-[min(48rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-xl`,children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(j,{className:`text-base font-semibold text-fg`,children:C?.name}),(0,Y.jsx)(O,{asChild:!0,children:(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,Y.jsx)(Re,{className:`size-4`})})})]}),(0,Y.jsx)(`pre`,{className:`min-h-0 flex-1 overflow-auto whitespace-pre-wrap p-5 text-sm leading-6 text-fg-muted`,children:C?.bodyMarkdown})]})]})})]})}function Gt(e){let t=(0,Lt.c)(13),{icon:n,title:r,hint:i,onClick:a}=e,o;t[0]===n?o=t[1]:(o=(0,Y.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`,"aria-hidden":!0}),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=(0,Y.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:r}),t[2]=r,t[3]=s);let c;t[4]===i?c=t[5]:(c=(0,Y.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-fg-muted`,children:i}),t[4]=i,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;return t[9]!==a||t[10]!==o||t[11]!==l?(u=(0,Y.jsx)(d,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-3 rounded-md px-3 py-2.5 text-left hover:bg-surface-hover`,onClick:a,children:[o,l]})}),t[9]=a,t[10]=o,t[11]=l,t[12]=u):u=t[12],u}var Kt=[`backlog`,`ready`,`active`,`review`,`closed`];function qt(e){return{backlog:e.filter(e=>e.phase===`backlog`),ready:e.filter(e=>e.phase===`ready`),active:e.filter(e=>e.phase===`active`),review:e.filter(e=>e.phase===`review`),closed:e.filter(e=>e.phase===`closed`)}}function Jt(e,t){if(e.phase!==t){if(e.phase===`closed`&&t!==`closed`&&e.allowedCommands.includes(`reopen`))return`reopen_${t}`;if(t===`closed`&&e.phase===`review`&&e.allowedCommands.includes(`close`))return`complete`;if(t!==`closed`&&e.allowedCommands.includes(`move`))return`move_${t}`}}function Yt(e){if(e.allowedCommands.includes(`resolve_wait`))return`resume`;if(e.allowedCommands.includes(`mark_ready`))return`ready`;if(e.allowedCommands.includes(`start`))return`run`;if(e.allowedCommands.includes(`request_review`))return`review`;if(e.phase===`review`&&e.allowedCommands.includes(`close`))return`complete`;if(e.allowedCommands.includes(`reopen`))return`reopen`;if(e.allowedCommands.includes(`add_wait`))return`pause`}function Xt(e){let t=new Map,n=new Map;for(let r of e)t.set(r.dependencyTaskId,[...t.get(r.dependencyTaskId)??[],r.dependentTaskId]),n.set(r.dependentTaskId,[...n.get(r.dependentTaskId)??[],r.dependencyTaskId]);return{outgoing:t,incoming:n}}function Zt(e,t){let n=new Set(e.map(e=>e.id)),{outgoing:r,incoming:i}=Xt(t.filter(e=>n.has(e.dependencyTaskId)&&n.has(e.dependentTaskId))),a=new Map(e.map(e=>[e.id,i.get(e.id)?.length??0])),o=new Map(e.map(e=>[e.id,0])),s=e.filter(e=>a.get(e.id)===0).sort((e,t)=>t.updatedAt-e.updatedAt).map(e=>e.id);for(let e=0;e<s.length;e+=1){let t=s[e];for(let e of r.get(t)??[]){o.set(e,Math.max(o.get(e)??0,(o.get(t)??0)+1));let n=(a.get(e)??1)-1;a.set(e,n),n===0&&s.push(e)}}let c=new Map;for(let t of e){let e=o.get(t.id)??0;c.set(e,[...c.get(e)??[],t.id])}let l=new Map;for(let[e,t]of c)t.forEach((t,n)=>l.set(t,{x:e*300,y:n*136}));return l}function Qt(e,t){let{incoming:n}=Xt(t),r=new Set(e.filter(e=>e.operationalState===`blocked`).map(e=>e.id)),i=[...r];for(let e=0;e<i.length;e+=1)for(let t of n.get(i[e])??[])r.has(t)||(r.add(t),i.push(t));return r}function $t(e,t){let{incoming:n,outgoing:r}=Xt(t),i=new Set([e]);for(let t of[n,r]){let n=[e],r=new Set(n);for(let e=0;e<n.length;e+=1)for(let a of t.get(n[e])??[])r.has(a)||(r.add(a),i.add(a),n.push(a))}return i}var en={backlog:`border-edge`,ready:`border-edge`,active:`border-accent ring-2 ring-accent/15`,review:`border-amber-400/80`,closed:`border-emerald-400/60`};function tn(e){let t=(0,Lt.c)(25),{data:n,selected:r}=e,i=n.task,a=i.operationalState===`waiting`||i.operationalState===`blocked`,o=en[i.phase],s=r&&`ring-2 ring-accent/30`,c=n.dimmed&&`opacity-30`,l;t[0]!==o||t[1]!==s||t[2]!==c?(l=v(`group w-56 rounded-xl border bg-surface-panel p-3 shadow-surface transition-opacity`,o,s,c),t[0]=o,t[1]=s,t[2]=c,t[3]=l):l=t[3];let u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Y.jsx)(Ft,{type:`target`,position:Mt.Left,className:`!size-3 !border-2 !border-surface-panel !bg-accent opacity-60 transition-opacity group-hover:opacity-100`}),t[4]=u):u=t[4];let d;t[5]===i.title?d=t[6]:(d=(0,Y.jsx)(`strong`,{className:`line-clamp-2 min-w-0 text-sm font-medium leading-5 text-fg`,children:i.title}),t[5]=i.title,t[6]=d);let f;t[7]===a?f=t[8]:(f=a?(0,Y.jsx)(H,{className:`mt-0.5 size-3.5 shrink-0 text-violet-600 dark:text-violet-300`,"aria-hidden":!0}):null,t[7]=a,t[8]=f);let p;t[9]!==d||t[10]!==f?(p=(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[d,f]}),t[9]=d,t[10]=f,t[11]=p):p=t[11];let m;t[12]===n.phaseLabel?m=t[13]:(m=(0,Y.jsx)(`span`,{children:n.phaseLabel}),t[12]=n.phaseLabel,t[13]=m);let h;t[14]!==a||t[15]!==i.blockedBy?(h=a&&i.blockedBy.length>0?(0,Y.jsx)(`span`,{children:i.blockedBy.length}):null,t[14]=a,t[15]=i.blockedBy,t[16]=h):h=t[16];let g;t[17]!==h||t[18]!==m?(g=(0,Y.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2 text-[11px] text-fg-subtle`,children:[m,h]}),t[17]=h,t[18]=m,t[19]=g):g=t[19];let _;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Y.jsx)(Ft,{type:`source`,position:Mt.Right,className:`!size-3 !border-2 !border-surface-panel !bg-accent opacity-60 transition-opacity group-hover:opacity-100`}),t[20]=_):_=t[20];let y;return t[21]!==g||t[22]!==l||t[23]!==p?(y=(0,Y.jsxs)(`div`,{className:l,children:[u,p,g,_]}),t[21]=g,t[22]=l,t[23]=p,t[24]=y):y=t[24],y}var nn={taskNode:tn};function rn(e){let t=(0,Lt.c)(90),{tasks:n,dependencyEdges:r,returnTo:i,copy:a,onDependenciesChange:o}=e,[c,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(!1),[f,p]=(0,J.useState)(),[m,h]=(0,J.useState)(),g=(0,J.useRef)(null),b;t[0]!==r||t[1]!==n?(b=Qt(n,r),t[0]=r,t[1]=n,t[2]=b):b=t[2];let x=b,S;t[3]!==x||t[4]!==u||t[5]!==c||t[6]!==n?(S=u?n.filter(e=>x.has(e.id)):c?n:n.filter(fn),t[3]=x,t[4]=u,t[5]=c,t[6]=n,t[7]=S):S=t[7];let C=S,w;t[8]===C?w=t[9]:(w=new Set(C.map(dn)),t[8]=C,t[9]=w);let T=w,E;if(t[10]!==r||t[11]!==T){let e;t[13]===T?e=t[14]:(e=e=>T.has(e.dependencyTaskId)&&T.has(e.dependentTaskId),t[13]=T,t[14]=e),E=r.filter(e),t[10]=r,t[11]=T,t[12]=E}else E=t[12];let D=E,O;t[15]!==D||t[16]!==C?(O=Zt(C,D),t[15]=D,t[16]=C,t[17]=O):O=t[17];let k=O,A;t[18]!==f||t[19]!==D?(A=f?$t(f,D):void 0,t[18]=f,t[19]=D,t[20]=A):A=t[20];let j=A,M;t[21]===f?M=t[22]:(M=e=>e.id===f,t[21]=f,t[22]=M);let N=C.find(M),P;t[23]===C?P=t[24]:(P=new Map(C.map(un)),t[23]=C,t[24]=P);let F=P,ee;if(t[25]!==a.phases||t[26]!==k||t[27]!==j||t[28]!==C){let e;t[30]!==a.phases||t[31]!==k||t[32]!==j?(e=e=>({id:e.id,type:`taskNode`,position:k.get(e.id)??{x:0,y:0},data:{task:e,phaseLabel:a.phases[e.phase],dimmed:!!(j&&!j.has(e.id))}}),t[30]=a.phases,t[31]=k,t[32]=j,t[33]=e):e=t[33],ee=C.map(e),t[25]=a.phases,t[26]=k,t[27]=j,t[28]=C,t[29]=ee}else ee=t[29];let te=ee,I;if(t[34]!==j||t[35]!==F||t[36]!==D){let e;t[38]!==j||t[39]!==F?(e=e=>{let t=F.get(e.dependencyTaskId),n=t?.phase===`closed`&&t.resolution===`done`,r=!!(j&&(!j.has(e.dependencyTaskId)||!j.has(e.dependentTaskId)));return{id:`${e.dependencyTaskId}:${e.dependentTaskId}`,source:e.dependencyTaskId,target:e.dependentTaskId,markerEnd:{type:jt.ArrowClosed},style:{stroke:n?`var(--color-edge-strong)`:`var(--color-accent)`,strokeWidth:n?1.25:1.75,opacity:r?.18:1,strokeDasharray:n?`5 5`:void 0}}},t[38]=j,t[39]=F,t[40]=e):e=t[40],I=D.map(e),t[34]=j,t[35]=F,t[36]=D,t[37]=I}else I=t[37];let L=I,R,z;t[41]!==f||t[42]!==T?(R=()=>{f&&!T.has(f)&&p(void 0)},z=[f,T],t[41]=f,t[42]=T,t[43]=R,t[44]=z):(R=t[43],z=t[44]),(0,J.useEffect)(R,z);let B,V;t[45]!==L||t[46]!==m?(B=()=>{m&&!L.some(e=>e.id===m)&&h(void 0)},V=[L,m],t[45]=L,t[46]=m,t[47]=B,t[48]=V):(B=t[47],V=t[48]),(0,J.useEffect)(B,V);let H;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(H=()=>{let e=window.requestAnimationFrame(()=>{g.current?.fitView({padding:.2,minZoom:.35,maxZoom:1,duration:250})});return()=>window.cancelAnimationFrame(e)},t[49]=H):H=t[49];let U;t[50]!==u||t[51]!==c||t[52]!==C.length?(U=[u,c,C.length],t[50]=u,t[51]=c,t[52]=C.length,t[53]=U):U=t[53],(0,J.useEffect)(H,U);let W;t[54]===f?W=t[55]:(W=()=>{f&&g.current?.fitView({nodes:[{id:f}],padding:1.5,minZoom:.7,maxZoom:1,duration:250})},t[54]=f,t[55]=W);let ne=W,G;t[56]!==r||t[57]!==o?(G=e=>{if(!e.source||!e.target||e.source===e.target)return;let t=r.filter(t=>t.dependentTaskId===e.target).map(ln);t.includes(e.source)||o(e.target,[...t,e.source])},t[56]=r,t[57]=o,t[58]=G):G=t[58];let re=G,K;t[59]!==r||t[60]!==o||t[61]!==m?(K=()=>{if(!m)return;let e=r.find(e=>`${e.dependencyTaskId}:${e.dependentTaskId}`===m);e&&(h(void 0),o(e.dependentTaskId,r.filter(t=>t.dependentTaskId===e.dependentTaskId&&t.dependencyTaskId!==e.dependencyTaskId).map(cn)))},t[59]=r,t[60]=o,t[61]=m,t[62]=K):K=t[62];let q=K,ie;t[63]===a.connectHint?ie=t[64]:(ie=(0,Y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.connectHint}),t[63]=a.connectHint,t[64]=ie);let ae=u?`secondary`:`ghost`,oe;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(oe=()=>d(sn),t[65]=oe):oe=t[65];let se=u?a.allTasks:a.blockedChains,ce;t[66]!==u||t[67]!==ae||t[68]!==se?(ce=(0,Y.jsx)(y,{type:`button`,variant:ae,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":u,onClick:oe,children:se}),t[66]=u,t[67]=ae,t[68]=se,t[69]=ce):ce=t[69];let le;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(le=()=>l(on),t[70]=le):le=t[70];let de=c?a.hideCompleted:a.showCompleted,fe;t[71]!==u||t[72]!==c||t[73]!==de?(fe=(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":c,onClick:le,disabled:u,children:de}),t[71]=u,t[72]=c,t[73]=de,t[74]=fe):fe=t[74];let pe=N?(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:ne,children:[(0,Y.jsx)(Le,{className:`size-3.5`,"aria-hidden":!0}),a.locateTask]}):null,me;t[75]!==a.removeDependency||t[76]!==q||t[77]!==m?(me=m?(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs text-danger`,onClick:q,children:a.removeDependency}):null,t[75]=a.removeDependency,t[76]=q,t[77]=m,t[78]=me):me=t[78];let he;t[79]!==ce||t[80]!==fe||t[81]!==pe||t[82]!==me?(he=(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[ce,fe,pe,me]}),t[79]=ce,t[80]=fe,t[81]=pe,t[82]=me,t[83]=he):he=t[83];let ge;t[84]!==ie||t[85]!==he?(ge=(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-b border-edge bg-surface-panel px-3 py-2.5`,children:[ie,he]}),t[84]=ie,t[85]=he,t[86]=ge):ge=t[86];let _e=C.length>0?(0,Y.jsxs)(`div`,{className:v(`grid h-[min(42rem,calc(100vh-14rem))] min-h-[28rem]`,N&&`lg:grid-cols-[minmax(0,1fr)_18rem]`),children:[(0,Y.jsxs)(Pt,{nodes:te,edges:L,nodeTypes:nn,nodesDraggable:!1,nodesConnectable:!0,elementsSelectable:!0,onNodeClick:(e,t)=>p(t.id),onEdgeClick:(e,t)=>h(t.id),onConnect:re,onPaneClick:()=>{p(void 0),h(void 0)},onInit:e=>{g.current=e},fitView:!0,minZoom:.25,maxZoom:1.25,panOnScroll:!0,zoomOnDoubleClick:!1,proOptions:{hideAttribution:!0},children:[(0,Y.jsx)(It,{color:`var(--color-edge)`,gap:22,size:1}),(0,Y.jsx)(Nt,{showInteractive:!1,className:`!border-edge !bg-surface-panel !shadow-surface`})]}),N?(0,Y.jsxs)(`aside`,{className:`overflow-y-auto border-t border-edge bg-surface-panel p-4 lg:border-l lg:border-t-0`,children:[(0,Y.jsx)(`p`,{className:`text-xs font-medium text-accent-fg`,children:a.phases[N.phase]}),(0,Y.jsx)(`h3`,{className:`mt-2 text-sm font-semibold leading-6 text-fg`,children:N.title}),N.operationalState===`blocked`&&N.blockedBy.length>0?(0,Y.jsxs)(`div`,{className:`mt-4 rounded-lg bg-violet-500/8 p-3`,children:[(0,Y.jsx)(`p`,{className:`text-xs font-medium text-violet-700 dark:text-violet-300`,children:a.blockedBy.replace(`{{count}}`,String(N.blockedBy.length))}),(0,Y.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:N.blockedBy.map(an)})]}):null,(0,Y.jsxs)(s,{to:ue(i,N.id),className:`mt-4 inline-flex items-center gap-1.5 text-xs font-medium text-accent-fg hover:underline`,children:[(0,Y.jsx)(_,{className:`size-3.5`,"aria-hidden":!0}),a.openTask]})]}):null]}):(0,Y.jsx)(`div`,{className:`flex min-h-72 items-center justify-center px-6 text-center text-sm text-fg-muted`,children:a.empty}),ve;return t[87]!==ge||t[88]!==_e?(ve=(0,Y.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-base/40`,children:[ge,_e]}),t[87]=ge,t[88]=_e,t[89]=ve):ve=t[89],ve}function an(e){return(0,Y.jsx)(`li`,{children:e.title},e.id)}function on(e){return!e}function sn(e){return!e}function cn(e){return e.dependencyTaskId}function ln(e){return e.dependencyTaskId}function un(e){return[e.id,e]}function dn(e){return e.id}function fn(e){return e.phase!==`closed`}function pn({policy:e,copy:t,onSave:n}){let[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(e.mode),[s,c]=(0,J.useState)(Math.round(e.confidenceThreshold*100)),[l,u]=(0,J.useState)(!!e.quietHours),[d,p]=(0,J.useState)(e.quietHours?.startHour??22),[h,g]=(0,J.useState)(e.quietHours?.endHour??8),[_,v]=(0,J.useState)(e.quietHours?.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone),[b,x]=(0,J.useState)(e.allowedActions.includes(`create_project_task`)),[S,C]=(0,J.useState)(!1),[w,N]=(0,J.useState)();(0,J.useEffect)(()=>{o(e.mode),c(Math.round(e.confidenceThreshold*100)),u(!!e.quietHours),p(e.quietHours?.startHour??22),g(e.quietHours?.endHour??8),v(e.quietHours?.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone),x(e.allowedActions.includes(`create_project_task`))},[e]);let P=async()=>{C(!0),N(void 0);try{await n({mode:a,confidenceThreshold:s/100,quietHours:l?{startHour:d,endHour:h,timezone:_}:null,allowedActions:b?[`create_project_task`]:[]}),i(!1)}catch(e){N(e instanceof Error?e.message:t.saveFailed)}finally{C(!1)}};return(0,Y.jsxs)(M,{open:r,onOpenChange:e=>{S||i(e)},children:[(0,Y.jsx)(E,{asChild:!0,children:(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`h-9 gap-2 px-2.5 text-xs`,children:[(0,Y.jsx)(I,{className:`size-3.5`,"aria-hidden":!0}),t.modes[e.mode]]})}),(0,Y.jsxs)(k,{children:[(0,Y.jsx)(T,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(A,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(36rem,calc(100vh-2rem))] w-[min(34rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(j,{className:`text-base font-semibold text-fg`,children:t.title}),(0,Y.jsx)(D,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,Y.jsx)(O,{asChild:!0,children:(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:S,children:(0,Y.jsx)(Re,{className:`size-4`,"aria-hidden":!0})})})]}),(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-4`,children:[(0,Y.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:t.mode}),(0,Y.jsx)(f,{value:a,onChange:e=>o(e.target.value),children:Object.entries(t.modes).map(([e,t])=>(0,Y.jsx)(m,{value:e,children:t},e))})]}),(0,Y.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[t.confidence,` · `,s,`%`]}),(0,Y.jsx)(`input`,{type:`range`,min:`50`,max:`100`,step:`5`,value:s,onChange:e=>c(Number(e.target.value)),className:`accent-accent`})]}),(0,Y.jsxs)(`div`,{className:`rounded-lg border border-edge p-3`,children:[(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:l,onChange:e=>u(e.target.checked)}),t.quietHours]}),l?(0,Y.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-3`,children:[(0,Y.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietStart,(0,Y.jsx)(`input`,{type:`number`,min:`0`,max:`23`,value:d,onChange:e=>p(Number(e.target.value)),className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-fg`})]}),(0,Y.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietEnd,(0,Y.jsx)(`input`,{type:`number`,min:`0`,max:`23`,value:h,onChange:e=>g(Number(e.target.value)),className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-fg`})]}),(0,Y.jsxs)(`label`,{className:`col-span-2 grid gap-1 text-xs text-fg-muted`,children:[t.timezone,(0,Y.jsx)(`input`,{value:_,onChange:e=>v(e.target.value),className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-fg`})]})]}):null]}),(0,Y.jsxs)(`label`,{className:`flex items-start gap-3 rounded-lg border border-edge p-3`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,className:`mt-1`,checked:b,onChange:e=>x(e.target.checked)}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:t.allowTaskCreation}),(0,Y.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.allowTaskCreationDescription})]})]})]}),(0,Y.jsxs)(`div`,{className:`shrink-0 border-t border-edge px-5 py-3`,children:[w?(0,Y.jsx)(`p`,{className:`mb-2 text-xs text-danger`,children:w}):null,(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Y.jsx)(O,{asChild:!0,children:(0,Y.jsx)(y,{type:`button`,variant:`ghost`,disabled:S,children:t.cancel})}),(0,Y.jsx)(y,{type:`button`,variant:`primary`,disabled:S||!_.trim()||d<0||d>23||h<0||h>23,onClick:()=>void P(),children:S?t.saving:t.save})]})]})]})]})]})}var mn={backlog:_t,ready:_t,active:Ke,review:lt,closed:Ae},hn={backlog:`text-fg-muted`,ready:`text-fg-muted`,active:`text-accent-fg`,review:`text-amber-700 dark:text-amber-300`,closed:`text-emerald-700 dark:text-emerald-300`};function gn(e){let t=(0,Lt.c)(64),{task:n,returnTo:r,copy:i,busy:a,onAction:o,onDragStart:c,onDropBefore:l}=e,u;t[0]===n?u=t[1]:(u=Yt(n),t[0]=n,t[1]=u);let d=u,f;t[2]!==c||t[3]!==n.id?(f=e=>{e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,n.id),c(n.id)},t[2]=c,t[3]=n.id,t[4]=f):f=t[4];let p;t[5]===c?p=t[6]:(p=()=>c(``),t[5]=c,t[6]=p);let m;t[7]!==l||t[8]!==n.id?(m=e=>{e.preventDefault(),e.stopPropagation(),l(n.id)},t[7]=l,t[8]=n.id,t[9]=m):m=t[9];let h;t[10]!==r||t[11]!==n.id?(h=ue(r,n.id),t[10]=r,t[11]=n.id,t[12]=h):h=t[12];let g;t[13]===n.title?g=t[14]:(g=(0,Y.jsx)(`h3`,{className:`min-w-0 break-words text-sm font-medium leading-5 text-fg`,children:n.title}),t[13]=n.title,t[14]=g);let _;t[15]!==i||t[16]!==n.priority?(_=n.priority===`critical`||n.priority===`high`?(0,Y.jsx)(`span`,{className:v(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,n.priority===`critical`?`bg-red-500/10 text-red-700 dark:text-red-300`:`bg-amber-500/10 text-amber-700 dark:text-amber-300`),children:i.priorityOptions[n.priority]}):null,t[15]=i,t[16]=n.priority,t[17]=_):_=t[17];let y;t[18]!==g||t[19]!==_?(y=(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[g,_]}),t[18]=g,t[19]=_,t[20]=y):y=t[20];let b;t[21]===n.attention[0]?b=t[22]:(b=n.attention[0]?(0,Y.jsx)(`p`,{className:`mt-2 line-clamp-3 text-xs leading-5 text-fg-muted`,children:n.attention[0].summary}):null,t[21]=n.attention[0],t[22]=b);let x;t[23]!==i||t[24]!==n.blockedBy||t[25]!==n.operationalState?(x=n.operationalState===`blocked`&&n.blockedBy.length>0?(0,Y.jsxs)(`div`,{className:`mt-2 rounded-md bg-violet-500/8 px-2.5 py-2 text-xs text-violet-700 dark:text-violet-300`,children:[(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-medium`,children:[(0,Y.jsx)(H,{className:`size-3.5`,"aria-hidden":!0}),i.blockedBy.replace(`{{count}}`,String(n.blockedBy.length))]}),(0,Y.jsx)(`p`,{className:`mt-1 line-clamp-2 leading-5 text-fg-muted`,children:n.blockedBy.map(_n).join(`、`)})]}):null,t[23]=i,t[24]=n.blockedBy,t[25]=n.operationalState,t[26]=x):x=t[26];let S;t[27]!==i||t[28]!==n.operationalState?(S=n.operationalState===`idle`?null:(0,Y.jsx)(`span`,{className:`font-medium text-accent-fg`,children:i.operationalStates[n.operationalState]}),t[27]=i,t[28]=n.operationalState,t[29]=S):S=t[29];let C;t[30]!==i||t[31]!==n.latestVerification?(C=n.latestVerification?(0,Y.jsx)(`span`,{className:v(`font-medium`,n.latestVerification===`passed`?`text-emerald-700 dark:text-emerald-300`:n.latestVerification===`failed`?`text-red-700 dark:text-red-300`:`text-fg-subtle`),children:i.verification[n.latestVerification]}):null,t[30]=i,t[31]=n.latestVerification,t[32]=C):C=t[32];let w;t[33]!==i||t[34]!==n.acceptanceCriteriaCount?(w=n.acceptanceCriteriaCount>0?(0,Y.jsx)(`span`,{children:i.acceptanceCriteria.replace(`{{count}}`,String(n.acceptanceCriteriaCount))}):null,t[33]=i,t[34]=n.acceptanceCriteriaCount,t[35]=w):w=t[35];let T;t[36]===n.dueAt?T=t[37]:(T=n.dueAt?(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Y.jsx)(ge,{className:`size-3`,"aria-hidden":!0}),Ve(new Date(n.dueAt))]}):null,t[36]=n.dueAt,t[37]=T);let E;t[38]===n.nextCheckAt?E=t[39]:(E=n.nextCheckAt?(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-accent-fg`,children:[(0,Y.jsx)(ge,{className:`size-3`,"aria-hidden":!0}),Ve(new Date(n.nextCheckAt))]}):null,t[38]=n.nextCheckAt,t[39]=E);let D;t[40]!==S||t[41]!==C||t[42]!==w||t[43]!==T||t[44]!==E?(D=(0,Y.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-fg-subtle`,children:[S,C,w,T,E]}),t[40]=S,t[41]=C,t[42]=w,t[43]=T,t[44]=E,t[45]=D):D=t[45];let O;t[46]!==x||t[47]!==D||t[48]!==h||t[49]!==y||t[50]!==b?(O=(0,Y.jsxs)(s,{to:h,className:`block min-w-0 p-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,children:[y,b,x,D]}),t[46]=x,t[47]=D,t[48]=h,t[49]=y,t[50]=b,t[51]=O):O=t[51];let k;t[52]!==a||t[53]!==i||t[54]!==o||t[55]!==d||t[56]!==n?(k=d?(0,Y.jsxs)(`div`,{className:`flex items-center gap-3 border-t border-edge-subtle px-3 py-2`,children:[(0,Y.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,d),className:`text-xs font-medium text-accent-fg hover:underline disabled:cursor-wait disabled:opacity-50`,children:i.actions[d]}),d!==`review`&&n.allowedCommands.includes(`request_review`)?(0,Y.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,`review`),className:`text-xs font-medium text-fg-muted hover:text-fg hover:underline disabled:cursor-wait disabled:opacity-50`,children:i.actions.review}):null]}):null,t[52]=a,t[53]=i,t[54]=o,t[55]=d,t[56]=n,t[57]=k):k=t[57];let A;return t[58]!==O||t[59]!==k||t[60]!==f||t[61]!==p||t[62]!==m?(A=(0,Y.jsxs)(`article`,{draggable:!0,onDragStart:f,onDragEnd:p,onDragOver:vn,onDrop:m,className:`min-h-max min-w-0 shrink-0 overflow-hidden rounded-lg border border-edge-subtle bg-surface-panel transition-colors hover:border-edge hover:bg-surface-hover`,children:[O,k]}),t[58]=O,t[59]=k,t[60]=f,t[61]=p,t[62]=m,t[63]=A):A=t[63],A}function _n(e){return e.title}function vn(e){e.preventDefault(),e.stopPropagation()}function yn({tasks:e,dependencyEdges:t,monitoring:n,returnTo:r,copy:i,onAction:a,onReorder:o,onUndoMove:s,onDependenciesChange:c,onMonitoringChange:l,onCreate:u,actionBusyId:d,ref:p}){let[h,g]=(0,J.useState)(null),[_,b]=(0,J.useState)(null),[C,w]=(0,J.useState)(`board`),[E,P]=(0,J.useState)(!1),[F,ee]=(0,J.useState)(()=>crypto.randomUUID()),[te,I]=(0,J.useState)(``),[L,R]=(0,J.useState)(`normal`),[z,B]=(0,J.useState)(``),[V,H]=(0,J.useState)([]),[U,W]=(0,J.useState)(!1),[ne,re]=(0,J.useState)(null),K=ie({chat:x(S(e=>e.language)).chat}),q=qt(e),ae=e.filter(e=>e.phase!==`closed`),oe=(e,t)=>void a(e,t),se=async(t,n)=>{let r=e.find(e=>e.id===h);if(g(null),!r||r.id===n)return;let i=q[r.phase],s=i.findIndex(e=>e.id===r.id),c=s>=0?i[s+1]?.id??null:null;if(r.phase===t&&c===n)return;let l=Jt(r,t);r.phase!==t&&!l||l&&!await a(r,l)||await o(r.id,n)&&b({taskId:r.id,phase:r.phase,beforeTaskId:c})},ce=async e=>{e.preventDefault();let t=te.trim();if(!(!t||U)){W(!0),re(null);try{let e=z?new Date(`${z}T23:59:59.999`).getTime():void 0;await u({requestId:F,objective:t,priority:L,dependsOnTaskIds:V,attachments:K.wireAttachmentsPayload(),...e===void 0?{}:{dueAt:e}}),I(``),R(`normal`),B(``),H([]),K.clearAttachments(),ee(crypto.randomUUID()),P(!1)}catch(e){re(e instanceof Error?e.message:i.createFailed)}finally{W(!1)}}},le=()=>{ee(crypto.randomUUID()),I(``),R(`normal`),B(``),H([]),K.clearAttachments(),re(null),P(!0)};return(0,J.useImperativeHandle)(p,()=>({openCreate:le})),(0,J.useEffect)(()=>{if(!_)return;let e=window.setTimeout(()=>b(null),6e3);return()=>window.clearTimeout(e)},[_]),(0,Y.jsxs)(`section`,{id:`project-panel-board`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-board`,className:`flex h-full min-h-0 flex-col overflow-hidden`,children:[(0,Y.jsxs)(`div`,{className:`mb-4 flex shrink-0 flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:i.title}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:i.description})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,Y.jsx)(pn,{policy:n,copy:i.monitoring,onSave:l}),(0,Y.jsxs)(`div`,{className:`flex rounded-lg border border-edge bg-surface-panel p-0.5`,children:[(0,Y.jsxs)(`button`,{type:`button`,"aria-pressed":C===`board`,onClick:()=>w(`board`),className:v(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,C===`board`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,Y.jsx)(Oe,{className:`size-3.5`,"aria-hidden":!0}),i.views.board]}),(0,Y.jsxs)(`button`,{type:`button`,"aria-pressed":C===`graph`,onClick:()=>w(`graph`),className:v(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,C===`graph`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,Y.jsx)(G,{className:`size-3.5`,"aria-hidden":!0}),i.views.graph]})]})]})]}),C===`board`?(0,Y.jsx)(`div`,{className:`min-h-0 w-full min-w-0 flex-1 overflow-x-auto overflow-y-hidden overscroll-x-contain pb-2 [scrollbar-width:thin]`,children:(0,Y.jsx)(`div`,{className:`grid h-full min-h-0 min-w-[103rem] grid-cols-5 gap-3`,children:Kt.map(t=>{let n=mn[t],a=q[t];return(0,Y.jsxs)(`section`,{onDragOver:n=>{let r=e.find(e=>e.id===h);r&&(r.phase===t||Jt(r,t))&&n.preventDefault()},onDrop:e=>{e.preventDefault(),se(t,null)},className:`flex min-h-0 min-w-0 flex-col overflow-hidden rounded-xl bg-surface-muted/60 p-2.5`,children:[(0,Y.jsxs)(`header`,{className:`mb-2.5 flex shrink-0 items-center justify-between gap-2 px-1`,children:[(0,Y.jsxs)(`div`,{className:v(`flex items-center gap-2`,hn[t]),children:[(0,Y.jsx)(n,{className:`size-4`,"aria-hidden":!0}),(0,Y.jsx)(`h3`,{className:`text-sm font-semibold`,children:i.phases[t]})]}),(0,Y.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-subtle`,children:a.length})]}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-y-contain pr-1 [scrollbar-gutter:stable] [scrollbar-width:thin]`,children:(0,Y.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.length?a.map(e=>(0,Y.jsx)(gn,{task:e,returnTo:r,copy:i,busy:d===e.id,onAction:oe,onDragStart:g,onDropBefore:e=>void se(t,e)},e.id)):(0,Y.jsx)(`p`,{className:`rounded-lg border border-dashed border-edge px-3 py-5 text-center text-xs text-fg-subtle`,children:i.empty})})})]},t)})})}):(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Y.jsx)(rn,{tasks:e,dependencyEdges:t,returnTo:r,copy:{...i.graph,phases:i.phases},onDependenciesChange:c})}),(0,Y.jsx)(M,{open:E,onOpenChange:e=>{U||P(e)},children:(0,Y.jsxs)(k,{children:[(0,Y.jsx)(T,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(A,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(40rem,calc(100vh-2rem))] w-[min(38rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(j,{className:`text-base font-semibold text-fg`,children:i.createTitle}),(0,Y.jsx)(D,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:i.createDescription})]}),(0,Y.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>void ce(e),children:[(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsx)(`label`,{htmlFor:`project-task-objective`,className:`font-medium text-fg-muted`,children:i.objective}),(0,Y.jsxs)(`div`,{className:v(`overflow-hidden rounded-lg border border-edge bg-surface-base transition-colors focus-within:border-accent`,K.isDragging&&`border-accent bg-accent-soft/30`),onDragOver:e=>{e.preventDefault(),U||K.setIsDragging(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||K.setIsDragging(!1)},onDrop:e=>{e.preventDefault(),K.setIsDragging(!1),U||K.processFiles(Array.from(e.dataTransfer.files))},children:[(0,Y.jsx)(`textarea`,{id:`project-task-objective`,autoFocus:!0,className:`min-h-28 w-full resize-y bg-transparent px-3 py-3 text-sm leading-6 text-fg outline-none placeholder:text-fg-subtle`,value:te,onChange:e=>{I(e.target.value),re(null)},placeholder:i.objectivePlaceholder,maxLength:12e3,disabled:U}),(0,Y.jsx)(Be,{attachments:K.attachments,topPadded:!1,onRemove:e=>{U||K.removeAttachment(e)}}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-t border-edge-subtle px-2.5 py-2`,children:[(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:U,onClick:()=>K.fileInputRef.current?.click(),children:[(0,Y.jsx)(N,{className:`size-3.5`,"aria-hidden":!0}),i.addFiles]}),(0,Y.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:i.attachmentsDescription}),(0,Y.jsx)(`input`,{ref:K.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{K.processFiles(Array.from(e.target.files??[])),e.currentTarget.value=``}})]})]})]}),(0,Y.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Y.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:i.priority}),(0,Y.jsx)(f,{value:L,onChange:e=>R(e.target.value),disabled:U,children:[`low`,`normal`,`high`,`critical`].map(e=>(0,Y.jsx)(m,{value:e,children:i.priorityOptions[e]},e))})]}),(0,Y.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[i.dueDate,` `,(0,Y.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:i.optional})]}),(0,Y.jsx)(Et,{className:`min-h-10 bg-surface-base`,value:z,onChange:B,disabled:U,ariaLabel:i.dueDate})]})]}),(0,Y.jsxs)(`fieldset`,{className:`grid gap-2`,children:[(0,Y.jsxs)(`legend`,{className:`text-sm font-medium text-fg-muted`,children:[i.dependencies,` `,(0,Y.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:i.optional})]}),(0,Y.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:i.dependenciesDescription}),(0,Y.jsx)(At,{candidates:ae,selectedIds:V,disabled:U,onChange:H,labels:{link:i.linkDependencies,linked:i.linkedDependencies,searchPlaceholder:i.dependencySearchPlaceholder,noMatches:i.noDependencyMatches,noCandidates:i.noDependencyCandidates,remove:i.removeDependency}})]}),ne?(0,Y.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:ne}):null]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(O,{asChild:!0,children:(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:U,children:i.cancel})}),(0,Y.jsx)(y,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:U||!te.trim(),children:U?i.creating:i.create})]})]})]})]})}),_?(0,Y.jsxs)(`div`,{role:`status`,className:`fixed bottom-5 left-1/2 z-50 flex -translate-x-1/2 items-center gap-4 rounded-lg border border-edge bg-surface-panel px-4 py-3 text-sm text-fg shadow-float`,children:[(0,Y.jsx)(`span`,{children:i.moved}),(0,Y.jsx)(`button`,{type:`button`,className:`font-medium text-accent-fg hover:underline`,onClick:()=>{let e=_;b(null),s(e.taskId,e.phase,e.beforeTaskId).then(t=>{t||b(e)})},children:i.undo})]}):null]})}var bn=new Set([{id:`overview`,icon:z},{id:`tasks`,icon:rt},{id:`automations`,icon:ae},{id:`files`,icon:Ne},{id:`notes`,icon:Fe},{id:`skills`,icon:De},{id:`sessions`,icon:pt},{id:`progress`,icon:re},{id:`settings`,icon:tt}].map(e=>e.id)),xn=`xopc.projectFiles.panelWidthPx`,Sn=320,Cn=220,wn=560;function Tn(e,t){return e.name!==t.name||e.description!==(t.description??``)||e.status!==t.status||e.defaultAgentId!==(t.defaultAgentId??``)||e.brief!==(t.brief??``)||e.instructions!==(t.instructions??``)}function En(e){return Math.min(wn,Math.max(Cn,Math.round(e)))}function Dn(){try{let e=window.localStorage.getItem(xn);if(e==null)return Sn;let t=Number.parseInt(e,10);return Number.isFinite(t)?En(t):Sn}catch{return Sn}}function On(e){try{window.localStorage.setItem(xn,String(En(e)))}catch{}}function kn(e){return!!(e&&bn.has(e))}function An(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function jn(e,t=``){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?String(e):Ve(n)}function Mn(e){return e===`active`?`bg-accent-soft text-accent-fg`:e===`done`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`paused`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`archived`?`bg-surface-muted text-fg-subtle`:`bg-surface-hover text-fg-muted`}function Nn(e){let t=(0,Lt.c)(8),{label:n,hint:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=r?(0,Y.jsx)(`span`,{className:`text-xs leading-5 text-fg-subtle`,children:r}):null,t[2]=r,t[3]=o);let s;return t[4]!==i||t[5]!==a||t[6]!==o?(s=(0,Y.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[a,i,o]}),t[4]=i,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function Pn(e=!1){return v(`w-full rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,e?`min-h-24 py-2 leading-5`:`min-h-10`)}function Fn(e){let t=(0,Lt.c)(10),{label:n,value:r,mono:i}=e,a=i===void 0?!1:i,o;t[0]===n?o=t[1]:(o=(0,Y.jsx)(`div`,{className:`text-xs font-medium text-fg-subtle`,children:n}),t[0]=n,t[1]=o);let s=a&&`font-mono text-xs`,c;t[2]===s?c=t[3]:(c=v(`mt-1 min-w-0 truncate text-sm text-fg`,s),t[2]=s,t[3]=c);let l;t[4]!==c||t[5]!==r?(l=(0,Y.jsx)(`div`,{className:c,title:r,children:r}),t[4]=c,t[5]=r,t[6]=l):l=t[6];let u;return t[7]!==o||t[8]!==l?(u=(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-md bg-surface-base px-3 py-2`,children:[o,l]}),t[7]=o,t[8]=l,t[9]=u):u=t[9],u}function In(e){return[e.name,e.slug,e.workspaceRoot,e.description,e.brief].filter(Boolean).join(` `).toLowerCase()}function Ln(e){let t=e.lastActiveAt??e.updatedAt??e.createdAt,n=t?new Date(t).getTime():0;return Number.isFinite(n)?n:0}function Rn(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function zn(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function Bn(e){let t=e.actor;return t.name?t.name:t.agentId?t.agentId:t.id?t.id:t.sessionKey?t.sessionKey:t.kind}function Vn(e){return e.primaryObject.title?.trim()||e.primaryObject.id}function Hn(e){let t=e.source;return t.toolCallId?`${t.kind} · ${t.toolCallId}`:t.runId?`${t.kind} · ${t.runId}`:t.requestId?`${t.kind} · ${t.requestId}`:t.kind}function Un(e){let t=e.sourceChannel?.trim();if(t)return Wn(t);let n=e.key.split(`:`).filter(Boolean),r=(n[0]?.toLowerCase()===`agent`?n.slice(2).join(`:`):e.key).split(`:`)[0]?.split(/[-_]/)[0]?.trim();return Wn(r||``)}function Wn(e){let t=e.trim().toLowerCase();return t?t===`tui`?`TUI`:t===`acp`?`ACP`:t===`webchat`?`Webchat`:t:``}function Gn(e){let t=e.payload.changes;if(Array.isArray(t)&&t.length)return t.filter(e=>typeof e==`string`).join(`, `);let n=e.payload.contentPreview;if(typeof n==`string`&&n.trim())return n.trim();let r=e.payload.title??e.payload.name;return typeof r==`string`&&r.trim()?r.trim():``}function Kn(e){return e.map(e=>({name:e.name,path:e.path,absolutePath:e.absolutePath,isDirectory:e.type===`directory`,children:e.type===`directory`?[]:void 0}))}function qn(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:qn(e.children,t,n)}:e)}function Jn({currentProject:e,pm:t,projectsText:n,wd:r}){let i=o(),[a,s]=(0,J.useState)(!1),[d,f]=(0,J.useState)([e]),[m,g]=(0,J.useState)(``),[_,b]=(0,J.useState)(!1),[x,S]=(0,J.useState)(null),[C,w]=(0,J.useState)(!1),[E,N]=(0,J.useState)(`new`),[P,F]=(0,J.useState)(``),[te,I]=(0,J.useState)(``),[L,R]=(0,J.useState)(!1),[z,B]=(0,J.useState)(null),[V,H]=(0,J.useState)(null),U=(0,J.useCallback)(async()=>{b(!0),S(null);try{let t=await He({limit:100});f(n=>{let r=new Map;r.set(e.id,e);for(let e of n)r.set(e.id,e);for(let e of t.items)r.set(e.id,e);return Array.from(r.values())})}catch(e){S(e instanceof Error?e.message:String(e))}finally{b(!1)}},[e]);(0,J.useEffect)(()=>{f(t=>[e,...t.filter(t=>t.id!==e.id)])},[e]),(0,J.useEffect)(()=>{a&&U()},[U,a]);let W=(0,J.useMemo)(()=>{let t=m.trim().toLowerCase().split(/\s+/).filter(Boolean);return d.filter(t=>t.id!==e.id).filter(e=>{if(t.length===0)return!0;let n=In(e);return t.every(e=>n.includes(e))}).sort((e,t)=>Ln(t)-Ln(e))},[e.id,d,m]),G=e=>t.statuses[e.status]??e.status,re=e=>e.workspaceRoot||e.effectiveWorkspaceRoot||e.description||e.brief||t.common.defaultWorkspace,K=e=>{N(e),F(``),I(``),B(null),w(!0),s(!1)},q=(0,J.useCallback)(async(e={})=>{let t=te.trim(),n=P.trim()||(E===`directory`?Rn(t):``);if(n){R(!0),B(null),H(null);try{let r=await qe({name:n,...t?{workspaceRoot:t}:{},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});w(!1),F(``),I(``),f(e=>[r,...e.filter(e=>e.id!==r.id)]),i(`/projects/${encodeURIComponent(r.id)}`)}catch(e){let t=zn(e);t?(H(t),w(!1)):B(e instanceof Error?e.message:String(e))}finally{R(!1)}}},[E,P,i,te]),ie=(0,J.useCallback)(e=>{e.preventDefault(),q()},[q]),ae=(0,J.useCallback)(()=>{q({createWorkspaceRoot:!0})},[q]),oe=(0,J.useCallback)(()=>{H(null),w(!0)},[]),se=e=>{I(e),E===`directory`&&!P.trim()&&F(Rn(e))},ce=(e,t)=>(0,Y.jsxs)(`button`,{type:`button`,className:v(`grid w-full grid-cols-[1rem_minmax(0,1fr)_auto] items-center gap-2 rounded-md p-2 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,t&&`bg-accent-soft/55 hover:bg-accent-soft/70`),onClick:()=>{s(!1),t||i(`/projects/${encodeURIComponent(e.id)}`)},children:[(0,Y.jsx)(c,{className:v(`size-4 text-accent-fg`,!t&&`invisible`),"aria-hidden":!0}),(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.name}),(0,Y.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:re(e)})]}),(0,Y.jsx)(`span`,{className:v(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,Mn(e.status)),children:G(e)})]},e.id);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(u,{open:a,onOpenChange:s,children:[(0,Y.jsx)(p,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,className:`group flex max-w-full min-w-0 items-center gap-2 rounded-lg px-2 py-1 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":t.projectSwitcher.switchProject,title:t.projectSwitcher.switchProject,children:[(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:e.name}),(0,Y.jsx)(`span`,{className:v(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,Mn(e.status)),children:G(e)})]}),(0,Y.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:re(e)})]}),(0,Y.jsx)(ee,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":!0})]})}),(0,Y.jsx)(l,{children:(0,Y.jsxs)(h,{side:`bottom`,align:`start`,sideOffset:6,className:`z-[70] w-[min(26rem,calc(100vw-2rem))] overflow-hidden rounded-xl border border-edge bg-surface-panel p-1.5 shadow-popover outline-none`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Y.jsxs)(`label`,{className:`relative block`,children:[(0,Y.jsx)(be,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`input`,{type:`search`,className:`h-9 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:m,onChange:e=>g(e.target.value),placeholder:t.projectSwitcher.searchPlaceholder,"aria-label":t.projectSwitcher.searchPlaceholder})]}),(0,Y.jsxs)(`div`,{className:`mt-1 max-h-[min(54vh,24rem)] overflow-y-auto pr-0.5 [scrollbar-gutter:stable]`,children:[(0,Y.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.current}),ce(e,!0),(0,Y.jsx)(`div`,{className:`px-2 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.recent}),x?(0,Y.jsx)(`div`,{className:`p-2 text-xs text-red-600 dark:text-red-400`,children:x}):null,_&&W.length===0?(0,Y.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.loading}):null,!_&&W.length===0?(0,Y.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.noMatches}):null,W.map(e=>ce(e,!1))]}),(0,Y.jsxs)(`div`,{className:`mt-1 border-t border-edge-subtle pt-1`,children:[(0,Y.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>K(`new`),children:[(0,Y.jsx)(Pe,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.newProject})]}),(0,Y.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>K(`directory`),children:[(0,Y.jsx)(Ne,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.openDirectory})]}),(0,Y.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>{s(!1),i(`/projects`)},children:[(0,Y.jsx)(tt,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.manageProjects})]})]})]})})]}),(0,Y.jsx)(M,{open:C,onOpenChange:e=>!L&&w(e),children:(0,Y.jsxs)(k,{children:[(0,Y.jsx)(T,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(A,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(32rem,calc(100vh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(j,{className:`text-base font-semibold text-fg`,children:E===`directory`?t.projectSwitcher.createFromDirectoryTitle:n.createTitle}),(0,Y.jsx)(D,{className:`mt-1 text-sm text-fg-muted`,children:E===`directory`?t.projectSwitcher.createFromDirectoryDescription:n.createDescription})]}),(0,Y.jsxs)(`form`,{onSubmit:ie,className:`flex min-h-0 flex-1 flex-col`,children:[(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[z?(0,Y.jsx)(`div`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:z}):null,(0,Y.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.projectName}),(0,Y.jsx)(`input`,{className:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:P,onChange:e=>F(e.target.value),placeholder:`xopc`})]}),(0,Y.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.workspaceRoot}),(0,Y.jsx)(Tt,{value:te,onChange:se,disabled:L,wd:r,placeholder:n.workspacePlaceholder,inputClassName:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`}),(0,Y.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.workspaceHint})]})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(O,{asChild:!0,children:(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:L,children:n.cancel})}),(0,Y.jsxs)(y,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:L||!(P.trim()||E===`directory`&&Rn(te)),children:[(0,Y.jsx)(Pe,{className:`size-4`,"aria-hidden":!0}),n.create]})]})]})]})]})}),(0,Y.jsx)(M,{open:!!V,onOpenChange:e=>{e||H(null)},children:(0,Y.jsxs)(k,{children:[(0,Y.jsx)(T,{className:`fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(A,{className:`fixed left-1/2 top-1/2 z-[110] flex w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(j,{className:`text-base font-semibold text-fg`,children:n.workspaceMissingTitle}),(0,Y.jsx)(D,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:V?An(n.workspaceMissingDescription,{workspace:V}):null})]}),V?(0,Y.jsx)(`div`,{className:`px-5 py-4`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,Y.jsx)(Ne,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:V})]})}):null,(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:oe,disabled:L,children:n.workspaceMissingBack}),(0,Y.jsxs)(y,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:ae,disabled:L,children:[(0,Y.jsx)(ne,{className:`size-4`,"aria-hidden":!0}),n.workspaceMissingCreate]})]})]})]})})]})}function X(){let{projectId:e=``,tabId:t,noteId:n}=i(),r=o(),[c]=a(),l=S(e=>e.language),u=x(l),d=u.chat.workingDirectory,p=u.projectDetailPage,h=u.projectsPage,_=Me(e=>e.setPageHeader),C=Me(e=>e.clearPageHeader),[w,E]=(0,J.useState)(null),[N,ee]=(0,J.useState)(null),[I,H]=(0,J.useState)([]),[G,ie]=(0,J.useState)(``),[ge,xe]=(0,J.useState)([]),[Oe,Ae]=(0,J.useState)(!1),[Le,Be]=(0,J.useState)(null),[Ve,He]=(0,J.useState)([]),[Ue,We]=(0,J.useState)(0),[Ke,qe]=(0,J.useState)(!1),[Qe,et]=(0,J.useState)(!1),[lt,_t]=(0,J.useState)(!1),[Et,Dt]=(0,J.useState)([]),Ot=(0,J.useRef)(new Set),[kt,At]=(0,J.useState)(null),[jt,Mt]=(0,J.useState)(Dn),[Nt,Pt]=(0,J.useState)(!1),[Ft,It]=(0,J.useState)(!1),[Lt,Rt]=(0,J.useState)(``),[zt,Bt]=(0,J.useState)([]),[Vt,Ht]=(0,J.useState)(!1),[Ut,Gt]=(0,J.useState)(null),[Kt,qt]=(0,J.useState)(!1),[Jt,Yt]=(0,J.useState)(null),[Xt,Zt]=(0,J.useState)([]),[Qt,$t]=(0,J.useState)(``),[en,tn]=(0,J.useState)(!0),[nn,rn]=(0,J.useState)(!1),[an,on]=(0,J.useState)(!1),[sn,cn]=(0,J.useState)(null),[ln,un]=(0,J.useState)(!1),[dn,fn]=(0,J.useState)(`fixed`),[pn,mn]=(0,J.useState)(``),[hn,gn]=(0,J.useState)(null),[_n,vn]=(0,J.useState)(!1),[bn,xn]=(0,J.useState)(!1),[Sn,Cn]=(0,J.useState)(!1),[wn,In]=(0,J.useState)(null),Ln=(0,J.useRef)(null),Rn=(0,J.useRef)(!1),[Wn,X]=(0,J.useState)(null),[Yn,Xn]=(0,J.useState)({title:``,reason:``}),[Z,Zn]=(0,J.useState)({name:``,description:``,status:`active`,defaultAgentId:``,workspaceRoot:``,brief:``,instructions:``}),Qn=(0,J.useRef)(Z),$n=`overview`,Q=n?`notes`:kn(t)?t:$n,er=(0,J.useMemo)(()=>ke(c.get(`returnTo`),`/projects`,[`/chat`]),[c]),tr=(0,J.useCallback)(t=>{if(!e)return`/projects`;let n=`/projects/${encodeURIComponent(e)}/${t}`;return er===`/projects`?n:B(n,er)},[er,e]),nr=(0,J.useCallback)(t=>{e&&r(tr(t))},[r,e,tr]),rr=(0,J.useCallback)(()=>{if(Q===`tasks`&&Ln.current){Ln.current.openCreate();return}Rn.current=!0,nr(`tasks`)},[nr,Q]);(0,J.useEffect)(()=>{Q!==`tasks`||!Rn.current||(Rn.current=!1,Ln.current?.openCreate())},[Q]);let ir=(0,J.useCallback)(t=>{e&&r(tr(t),{replace:!0})},[r,e,tr]),ar=(0,J.useCallback)((e,t)=>{ir(e),r(t)},[r,ir]),or=(0,J.useCallback)(e=>t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||ir(e)},[ir]),sr=(0,J.useCallback)(e=>e.startsWith(`/chat/`)?`sessions`:e.startsWith(`/notes`)?`notes`:Q,[Q]);(0,J.useEffect)(()=>{!e||!t||kn(t)||r(tr($n),{replace:!0})},[$n,r,e,tr,t]),(0,J.useEffect)(()=>{if(!e)return;let t=!1;return tn(!0),X(null),Promise.all([Ye(e),Ze(e),Xe(e),pe().catch(()=>null)]).then(([e,n,r,i])=>{if(t)return;E(e),ee(n),H(r),Zt(i?.agents??[]),$t(e.defaultAgentId??``);let a={name:e.name,description:e.description??``,status:e.status,defaultAgentId:e.defaultAgentId??``,workspaceRoot:e.workspaceRoot??``,brief:e.brief??``,instructions:e.instructions??``};Qn.current=a,Zn(a)}).catch(e=>{t||X(e instanceof Error?e.message:String(e))}).finally(()=>{t||tn(!1)}),()=>{t=!0}},[e]);let $=(0,J.useCallback)(async()=>{e&&ee(await Ze(e))},[e]);(0,J.useEffect)(()=>{let t,n=n=>{let r=je.safeParse(n.detail);!r.success||r.data.projectId!==e||(window.clearTimeout(t),t=window.setTimeout(()=>void $(),120))};return window.addEventListener(`task-changed-v2`,n),()=>{window.clearTimeout(t),window.removeEventListener(`task-changed-v2`,n)}},[e,$]);let cr=(0,J.useCallback)(async(e,t)=>{In(e.id),X(null);try{let n=await de(e.id),r=t.startsWith(`move_`)?{type:`move`,phase:t.slice(5)}:t.startsWith(`reopen_`)?{type:`reopen`,phase:t.slice(7)}:t===`ready`?{type:`mark_ready`}:t===`run`?{type:`start`,executor:{kind:`agent`,agentId:n.task.delegateAgentId??(await V(e.id)).agentId}}:t===`pause`?{type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}:t===`review`?{type:`request_review`}:t===`complete`?{type:`close`,resolution:`done`}:t===`reopen`?{type:`reopen`,phase:`ready`}:{type:`resolve_wait`,waitId:n.waits[0]?.id??``};if(r.type===`resolve_wait`&&!r.waitId)throw Error(`No active wait to resolve`);return await me(e.id,r,n.task.version),await $(),!0}catch(e){return await $().catch(()=>void 0),X(e instanceof Error?e.message:p.board.actionFailed),!1}finally{In(null)}},[N,p.board.actionFailed,$]),lr=(0,J.useCallback)(async t=>{e&&(X(null),await _e({idempotencyKey:t.requestId,title:t.objective,projectId:e,priority:t.priority,dueAt:t.dueAt,locale:l,contract:{objective:t.objective,expectedOutputs:[],acceptanceCriteria:[],constraints:[],approvalRequired:[],assumptions:[],risks:[],acceptancePolicy:`manual`,outputDestinations:[]},dependencies:t.dependsOnTaskIds,context:t.attachments.map((e,t)=>({targetKind:`file`,targetId:e.uri??e.name??`attachment-${t+1}`,role:`input`,title:e.name,pinned:!0,retrievalPolicy:{},metadata:{mimeType:e.mimeType,size:e.size,data:e.data}})),authorityGrants:[],activation:{mode:`capture`,phase:`backlog`}}),await $())},[l,e,$]),ur=(0,J.useCallback)(async(e,t)=>{In(e),X(null);try{return await W(e,t,(await de(e)).task.version),await $(),!0}catch(e){return await $().catch(()=>void 0),X(e instanceof Error?e.message:p.board.actionFailed),!1}finally{In(null)}},[p.board.actionFailed,$]),dr=(0,J.useCallback)(async(e,t,n)=>{In(e),X(null);try{let r=await de(e);return r.task.phase!==t&&(r=await me(e,r.task.phase===`closed`?{type:`reopen`,phase:t===`closed`?`ready`:t}:t===`closed`?{type:`close`,resolution:`done`}:{type:`move`,phase:t},r.task.version)),await W(e,n,r.task.version),await $(),!0}catch(e){return await $().catch(()=>void 0),X(e instanceof Error?e.message:p.board.actionFailed),!1}finally{In(null)}},[p.board.actionFailed,$]),fr=(0,J.useCallback)(async(e,t)=>{In(e),X(null);try{await ce(e,t,(await de(e)).task.version),await $()}catch(e){await $().catch(()=>void 0),X(e instanceof Error?e.message:p.board.actionFailed)}finally{In(null)}},[p.board.actionFailed,$]),pr=(0,J.useCallback)(async t=>{if(e){X(null);try{await gt(e,t),await $()}catch(e){throw X(e instanceof Error?e.message:p.board.actionFailed),e}}},[p.board.actionFailed,e,$]),mr=(0,J.useCallback)(async()=>{if(w){Ae(!0),X(null);try{xe((await dt.list({projectId:w.id})).automations)}catch(e){X(e instanceof Error?e.message:String(e))}finally{Ae(!1)}}},[w]);(0,J.useEffect)(()=>{Q===`automations`&&mr()},[mr,Q]);let hr=(0,J.useCallback)(async()=>{if(w){qe(!0),X(null);try{let e=await ot(w.id,{includeRelated:Qe,limit:100});He(e.items),We(e.total)}catch(e){X(e instanceof Error?e.message:String(e))}finally{qe(!1)}}},[w,Qe]);(0,J.useEffect)(()=>{Q===`progress`&&hr()},[hr,Q]);let gr=(0,J.useCallback)(async e=>{Be(`toggle:${e.id}`),X(null);try{e.enabled?await dt.pause(e.id):await dt.resume(e.id),await mr()}catch(e){X(e instanceof Error?e.message:String(e))}finally{Be(null)}},[mr]),_r=(0,J.useCallback)(async()=>{if(!w?.effectiveWorkspaceRoot?.trim()){Dt([]),Ot.current.clear(),Yt(null);return}qt(!0),Yt(null),Ot.current.clear();try{Dt(Kn((await at(w.id,``)).entries)),Ot.current.add(``)}catch(e){Dt([]),Ot.current.clear(),Yt(e instanceof Error?e.message:String(e))}finally{qt(!1)}},[w]),vr=(0,J.useCallback)(async e=>{if(!(!w?.effectiveWorkspaceRoot?.trim()||Ot.current.has(e))){Ot.current.add(e),Yt(null);try{let t=await at(w.id,e);Dt(n=>qn(n,e,Kn(t.entries)))}catch(t){Ot.current.delete(e),Yt(t instanceof Error?t.message:String(t))}}},[w]);(0,J.useEffect)(()=>{Q===`files`&&_r()},[_r,Q]);let yr=Lt.trim();(0,J.useEffect)(()=>{if(Q!==`files`||!w||!Ft||!yr){Bt([]),Ht(!1),Gt(null);return}let e=!1;Ht(!0),Gt(null),Bt([]);let t=window.setTimeout(()=>{vt(w.id,yr,50).then(t=>{e||Bt(t)}).catch(t=>{e||Gt(t instanceof Error?t.message:String(t))}).finally(()=>{e||Ht(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[yr,w,Ft,Q]);let br=(0,J.useCallback)(async()=>{if(w){xn(!0),X(null);try{let e=await ft(w.id);ar(`sessions`,`/chat/${encodeURIComponent(e.key)}`)}catch(e){X(e instanceof Error?e.message:String(e))}finally{xn(!1)}}},[ar,w]),xr=(0,J.useCallback)(async()=>{if(!w)return;let[e,t]=await Promise.all([Ye(w.id),Ze(w.id)]);ee(t),E(e)},[w]),Sr=(0,J.useCallback)(async e=>{if(e.preventDefault(),!(!w||!Yn.title.trim())){Cn(!0),X(null);try{await nt(w.id,{title:Yn.title.trim(),reason:Yn.reason.trim()||void 0}),Xn({title:``,reason:``}),await xr()}catch(e){X(e instanceof Error?e.message:String(e))}finally{Cn(!1)}}},[Yn.reason,Yn.title,w,xr]),Cr=(0,J.useMemo)(()=>(0,Y.jsx)(s,{to:er,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":er===`/projects`?p.backToProjects:u.sidebar.back,children:(0,Y.jsx)(ct,{className:`size-4`,"aria-hidden":!0})}),[er,u.sidebar.back,p.backToProjects]),wr=(0,J.useMemo)(()=>w?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(y,{variant:`secondary`,className:`h-9 rounded-lg`,onClick:rr,children:[(0,Y.jsx)(Pe,{className:`size-4`,"aria-hidden":!0}),p.board.create]}),(0,Y.jsxs)(y,{variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>void br(),disabled:bn,children:[(0,Y.jsx)(pt,{className:`size-4`,"aria-hidden":!0}),p.common.newChat]})]}):null,[rr,p.board.create,p.common.newChat,w,br,bn]);(0,J.useLayoutEffect)(()=>(_({startExtra:Cr,main:w?(0,Y.jsx)(Jn,{currentProject:w,pm:p,projectsText:h,wd:d}):(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:p.fallbackTitle}),(0,Y.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:p.fallbackContext})]}),end:wr}),()=>C()),[C,wr,Cr,p,w,h,_,d]);function Tr(e){E(t=>t?{...t,...e}:null),$t(e.defaultAgentId??``),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}async function Er(e=Qn.current){if(!(!w||!Tn(e,w))){X(null),cn(null);try{let t=await L(w.id,{name:e.name.trim(),status:e.status,description:e.description,defaultAgentId:e.defaultAgentId,brief:e.brief,instructions:e.instructions});Tr(t);let n=Qn.current,r={...n,name:n.name===e.name?t.name:n.name,description:n.description===e.description?t.description??``:n.description,status:n.status===e.status?t.status:n.status,defaultAgentId:n.defaultAgentId===e.defaultAgentId?t.defaultAgentId??``:n.defaultAgentId,brief:n.brief===e.brief?t.brief??``:n.brief,instructions:n.instructions===e.instructions?t.instructions??``:n.instructions};Qn.current=r,Zn(r)}catch(e){let t=zn(e);throw t?cn(t):X(e instanceof Error?e.message:String(e)),e}}}function Dr(e){e.preventDefault(),Br.flush()}function Or(e,t=!1){let n={...Qn.current,...e};Qn.current=n,Zn(n),t&&Br.saveNow(n)}let kr=(0,J.useCallback)(()=>{if(!w)return;let e=w.workspaceRoot?.trim()??``;fn(e?`fixed`:`follow`),mn(e||w.effectiveWorkspaceRoot||``),un(!0)},[w]);async function Ar(e={}){if(!w)return;let t=dn===`fixed`?pn.trim():``;if(!(dn===`fixed`&&!t)){rn(!0),X(null),cn(null);try{let n=await L(w.id,{workspaceRoot:t,...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});Tr(n),Or({workspaceRoot:n.workspaceRoot??``}),un(!1),cn(null)}catch(e){let t=zn(e);t?(cn(t),un(!1)):X(e instanceof Error?e.message:String(e))}finally{rn(!1)}}}async function jr(){if(!(!w||hn)){gn(`pin`),X(null);try{Tr(w.pinnedAt?await Ee(w.id):await ht(w.id))}catch(e){X(e instanceof Error?e.message:String(e))}finally{gn(null)}}}async function Mr(){if(!(!w||hn)){gn(`archive`),X(null);try{let e=w.status===`archived`?await yt(w.id):await ut(w.id);Tr(e),Or({status:e.status})}catch(e){X(e instanceof Error?e.message:String(e))}finally{gn(null)}}}async function Nr(){if(w){vn(!0),X(null);try{await Je(w.id),on(!1),r(`/projects`)}catch(e){X(e instanceof Error?e.message:String(e))}finally{vn(!1)}}}async function Pr(){if(!(!w||lt)){_t(!0),X(null);try{await Ge(w.id)}catch(e){X(e instanceof Error?e.message:String(e))}finally{_t(!1)}}}let Fr=(0,J.useCallback)(e=>{At(e)},[]),Ir=(0,J.useCallback)((e,t)=>{t||At(e)},[]),Lr=(0,J.useCallback)(async(e,t,n)=>{let r=w?.id;if(r)switch(e){case`preview`:t.isDirectory||At(t.path);break;case`download`:if(t.isDirectory)return;try{let e=F(t.path);if(he($e(e))!==`text`){let n=await U(t.path,{projectId:r}),i=P(e)??`application/octet-stream`;ye(e,await n.arrayBuffer(),i)}else{let{content:n}=await K(t.path,{projectId:r});Se(e,n)}}catch(e){bt(`warning`,e instanceof Error?e.message:String(e),void 0,{duration:4e3})}break;case`copyPath`:try{await b(t.absolutePath??t.path)&&bt(`success`,u.workspace.pathCopied,void 0,{duration:2500})}catch{bt(`warning`,u.clipboard.copyFailed,void 0,{duration:4e3})}break;case`openDefault`:if(!t.absolutePath||!window.electronAPI?.shell?.openPath)return;await window.electronAPI.shell.openPath(t.absolutePath);break;case`openWith`:if(!t.absolutePath||!window.electronAPI?.shell?.chooseAppAndOpenPath)return;await window.electronAPI.shell.chooseAppAndOpenPath(t.absolutePath);break;case`openWithApp`:if(!t.absolutePath||!n||!window.electronAPI?.shell?.openPathWithApp)return;await window.electronAPI.shell.openPathWithApp(t.absolutePath,n);break;case`revealInFolder`:if(!t.absolutePath||!window.electronAPI?.shell?.showItemInFolder)return;await window.electronAPI.shell.showItemInFolder(t.absolutePath);break;default:break}},[u.clipboard.copyFailed,u.workspace.pathCopied,w?.id]),Rr=(0,J.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;e.preventDefault();let t=e.currentTarget,n=t.closest(`[data-project-files-grid]`);if(!n)return;t.setPointerCapture(e.pointerId),Pt(!0);let r=e.clientX,i=jt,a=e.pointerId,o=0,s=i,c=i,l=()=>{o=0,c=s,n.style.setProperty(`--project-files-panel-width`,`${c}px`)},u=e=>{s=En(i+(e.clientX-r)),o===0&&(o=window.requestAnimationFrame(l))},d=()=>{o!==0&&(window.cancelAnimationFrame(o),l());try{t.releasePointerCapture(a)}catch{}Pt(!1),Mt(c),On(c),window.removeEventListener(`pointermove`,u),window.removeEventListener(`pointerup`,d),window.removeEventListener(`pointercancel`,d)};window.addEventListener(`pointermove`,u),window.addEventListener(`pointerup`,d),window.addEventListener(`pointercancel`,d)},[jt]);(0,J.useEffect)(()=>{Q!==`files`&&At(null)},[e,Q]);let zr=!!(w&&Tn(Z,w)),Br=Ct({value:w?Z:null,dirty:zr,onSave:Er,validate:e=>e.name.trim()?null:p.settings.nameRequired});if(en)return(0,Y.jsx)(`main`,{className:`w-full flex-1 p-3 text-sm text-fg-muted sm:px-5 sm:py-4 xl:px-6`,children:p.loading});if(!w)return(0,Y.jsxs)(`main`,{className:`w-full flex-1 p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,Y.jsxs)(s,{to:er,className:`inline-flex items-center gap-2 text-sm text-accent-fg hover:underline`,children:[(0,Y.jsx)(ct,{className:`size-4`,"aria-hidden":!0}),er===`/projects`?p.backToProjects:u.sidebar.back]}),(0,Y.jsx)(`p`,{className:`mt-6 rounded-lg bg-surface-panel p-4 shadow-surface text-sm text-fg-muted`,children:Wn||p.notFound})]});let Vr=I.slice(0,6),Hr=N?.blockers??[],Ur=N?.tasks.filter(e=>e.phase!==`closed`)??[],Wr=e=>p.statuses[e]??e,Gr=e=>An(p.common.messages,{count:e}),Kr=G.trim().toLowerCase(),qr=Kr?I.filter(e=>{let t=jn(e.updatedAt),n=e.routing?.agentId||e.agentId||p.common.agent,r=e.name?.trim()||p.sessions.fallbackTitle,i=Gr(e.messageCount??0),a=Un(e);return[r,e.key,n,a,t,i].filter(Boolean).join(` `).toLowerCase().includes(Kr)}):I,Jr=I.length>0&&qr.length===0,Yr=Xt.find(e=>e.id===w.defaultAgentId)?.name||w.defaultAgentId||p.settings.globalDefaultAgent,Xr=Xt.find(e=>e.id===Z.defaultAgentId),Zr=w.workspaceRoot?.trim()||``,Qr=w.status===`archived`,$r=!!w.pinnedAt,ei=!Zr,ti=Zr||Xr?.workspace||w.effectiveWorkspaceRoot||p.common.defaultWorkspace,ni=dn===`fixed`?pn.trim()||p.settings.workspacePlaceholder:Xr?.workspace||w.effectiveWorkspaceRoot||p.common.defaultWorkspace,ri=(dn===`fixed`?pn.trim():``)!==Zr&&(dn===`follow`||!!pn.trim()),ii=[{id:`overview`,icon:z,label:p.tabs.overview},{id:`tasks`,icon:rt,label:p.tabs.tasks},{id:`automations`,icon:ae,label:p.tabs.automations},{id:`files`,icon:Ne,label:p.tabs.files},{id:`notes`,icon:Fe,label:p.tabs.notes},{id:`skills`,icon:De,label:p.tabs.skills},{id:`sessions`,icon:pt,label:p.tabs.sessions},{id:`progress`,icon:re,label:p.tabs.progress}];async function ai(){if(!ti)return;let e=await b(ti);bt(e?`success`:`warning`,e?u.workspace.pathCopied:u.clipboard.copyFailed,void 0,{duration:e?2500:4e3})}function oi(){cn(null),un(!0)}return(0,Y.jsxs)(`main`,{className:`flex h-full min-h-0 w-full flex-1 flex-col overflow-hidden p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3`,children:[(0,Y.jsx)(wt,{items:ii,activeTab:Q,onChange:nr,ariaLabel:p.navAria,tabIdPrefix:`project-primary-tab`,className:`min-w-0 flex-1`}),(0,Y.jsxs)(y,{id:`project-primary-tab-settings`,type:`button`,variant:Q===`settings`?`secondary`:`ghost`,className:`h-9 shrink-0 rounded-lg px-3`,"aria-current":Q===`settings`?`page`:void 0,onClick:()=>nr(`settings`),children:[(0,Y.jsx)(tt,{className:`size-4`,"aria-hidden":!0}),p.tabs.settings,zr?(0,Y.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500`,"aria-label":p.settings.unsavedChanges}):null]})]}),Wn?(0,Y.jsx)(`p`,{className:`mt-3 shrink-0 rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:Wn}):null,(0,Y.jsxs)(`div`,{className:v(`mt-3 min-h-0 flex-1`,Q===`overview`?`overflow-y-auto pr-1 [scrollbar-gutter:stable] xl:overflow-hidden xl:pr-0`:Q===`tasks`?`overflow-hidden`:`overflow-y-auto pr-1 [scrollbar-gutter:stable]`),children:[Q===`overview`?(0,Y.jsxs)(`section`,{id:`project-panel-overview`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-overview`,className:`grid min-h-full gap-4 xl:h-full xl:min-h-0 xl:grid-cols-[minmax(0,1fr)_20rem] xl:overflow-hidden`,children:[(0,Y.jsxs)(`div`,{className:`grid min-w-0 content-start gap-4 xl:min-h-0 xl:overflow-y-auto xl:pr-1 xl:[scrollbar-gutter:stable]`,children:[(0,Y.jsx)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.directionTitle}),(0,Y.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:w.outcome||N?.digest.summary||w.description||w.brief||p.overview.directionFallback}),N?.digest.recommendedAction?(0,Y.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm font-medium leading-6 text-fg`,children:An(p.overview.recommendedNext,{action:N.digest.recommendedAction})}):null]}),(0,Y.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:(0,Y.jsxs)(y,{type:`button`,variant:`secondary`,onClick:()=>void Pr(),disabled:lt,children:[(0,Y.jsx)(Ce,{className:`size-4`,"aria-hidden":!0}),lt?p.overview.savingDigest:p.overview.saveDigest]})})]})}),(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,Y.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.nextActions})}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:Ur.length?Ur.map(e=>(0,Y.jsxs)(s,{to:ue(tr(`overview`),e.id),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,Y.jsxs)(`span`,{className:`shrink-0 rounded-full bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:[e.phase,` · `,e.operationalState]})]}),e.attention[0]?(0,Y.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.attention[0].summary}):null]},e.id)):(0,Y.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.overview.noNextActions})})]}),N?.recentResults.length?(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,Y.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.recentResults})}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:N.recentResults.slice(0,5).map(({taskId:e,taskTitle:t,receipt:n})=>(0,Y.jsxs)(s,{to:ue(tr(`overview`),e),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),(0,Y.jsxs)(`span`,{className:`shrink-0 rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:[n.status,` · `,n.verification.status]})]}),(0,Y.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:n.summary})]},n.runId))})]}):null,(0,Y.jsxs)(`div`,{className:`grid min-w-0 gap-4 md:grid-cols-2`,children:[(0,Y.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Y.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.milestones})}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:w.milestones.length?w.milestones.map(e=>(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-4 py-3`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,Y.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:e.status})]},e.id)):(0,Y.jsx)(`p`,{className:`px-4 py-5 text-sm text-fg-muted`,children:p.overview.noMilestones})})]}),(0,Y.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Y.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.projectUpdates})}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:w.recentUpdates.length?w.recentUpdates.slice(0,3).map(e=>(0,Y.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,Y.jsx)(`p`,{className:`text-sm leading-5 text-fg`,children:e.summary}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.health})]},e.id)):(0,Y.jsx)(`p`,{className:`px-4 py-5 text-sm text-fg-muted`,children:p.overview.noProjectUpdates})})]})]})]}),(0,Y.jsxs)(`aside`,{className:`grid min-w-0 content-start gap-4 xl:min-h-0 xl:overflow-y-auto xl:pr-1 xl:[scrollbar-gutter:stable]`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.attention}),Hr.length?(0,Y.jsx)(`div`,{className:`mt-3 grid gap-3`,children:Hr.map(e=>{let t=(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(R,{className:`size-4 text-amber-600 dark:text-amber-300`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title})]}),(0,Y.jsxs)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:[p.overview.attentionKinds[e.kind]??e.kind,e.detail?` · ${e.detail}`:e.status?` · ${Wr(e.status)}`:``]})]});return e.href?(0,Y.jsx)(s,{to:e.href,onClick:or(sr(e.href)),className:`min-w-0 rounded-md bg-surface-base p-3 hover:bg-surface-hover`,children:t},e.id):(0,Y.jsx)(`div`,{className:`min-w-0 rounded-md bg-surface-base p-3`,children:t},e.id)})}):(0,Y.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:p.overview.noBlockedTasks}),(0,Y.jsxs)(`form`,{onSubmit:Sr,className:`mt-4 flex gap-2 border-t border-edge pt-4`,children:[(0,Y.jsx)(`input`,{className:`min-h-9 min-w-0 flex-1 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:Yn.title,onChange:e=>Xn(t=>({...t,title:e.target.value})),placeholder:p.overview.blockerTitlePlaceholder}),(0,Y.jsx)(y,{type:`submit`,variant:`secondary`,className:`shrink-0 rounded-lg px-3`,disabled:Sn||!Yn.title.trim(),"aria-label":Sn?p.overview.addingBlocker:p.overview.addBlocker,title:Sn?p.overview.addingBlocker:p.overview.addBlocker,children:(0,Y.jsx)(Pe,{className:`size-4`,"aria-hidden":!0})})]})]}),(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(st,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:p.overview.recentSessions})]}),(0,Y.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>nr(`sessions`),children:p.common.viewAll})]}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:Vr.length?Vr.map(e=>(0,Y.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:or(`sessions`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.name||e.key}),(0,Y.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:jn(e.updatedAt)})]}),(0,Y.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:e.agentId||p.common.agent})]},e.key)):(0,Y.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.overview.noSessions})})]})]})]}):null,Q===`tasks`?(0,Y.jsx)(yn,{ref:Ln,tasks:N?.tasks??[],dependencyEdges:N?.dependencyEdges??[],monitoring:N?.monitoring??{projectId:e??``,mode:`observe`,allowedActions:[],confidenceThreshold:.75,scenarios:[],configured:!1},returnTo:tr(`tasks`),copy:p.board,onAction:cr,onReorder:ur,onUndoMove:dr,onDependenciesChange:fr,onMonitoringChange:pr,onCreate:lr,actionBusyId:wn}):null,Q===`automations`?(0,Y.jsx)(`section`,{id:`project-panel-automations`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-automations`,className:`grid min-h-full content-start gap-4`,children:(0,Y.jsxs)(`div`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(ae,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.automations.title})]}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.automations.hint})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void mr(),disabled:Oe,children:[(0,Y.jsx)(q,{className:v(`size-4`,Oe&&`animate-spin`),"aria-hidden":!0}),p.common.refresh]}),(0,Y.jsxs)(y,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>ar(`automations`,`/automations?projectId=${encodeURIComponent(w.id)}&action=create`),children:[(0,Y.jsx)(Pe,{className:`size-4`,"aria-hidden":!0}),p.automations.create]})]})]}),Oe&&ge.length===0?(0,Y.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,"aria-busy":!0,children:[(0,Y.jsx)(ve,{className:`h-24 rounded-lg`}),(0,Y.jsx)(ve,{className:`h-24 rounded-lg`})]}):ge.length?(0,Y.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:ge.map(e=>(0,Y.jsxs)(`div`,{className:`grid gap-3 rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`min-w-0 truncate text-left text-sm font-medium text-fg hover:text-accent-fg`,onClick:()=>ar(`automations`,`/automations?automation=${encodeURIComponent(e.id)}`),children:e.name}),(0,Y.jsx)(`span`,{className:v(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,e.enabled?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-surface-hover text-fg-muted`),children:e.enabled?p.automations.enabled:p.automations.paused})]}),(0,Y.jsx)(`p`,{className:`line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description||e.action.kind}),(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 text-xs`,onClick:()=>ar(`automations`,`/automations?automation=${encodeURIComponent(e.id)}`),children:p.common.open}),(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 text-xs`,disabled:Le===`toggle:${e.id}`,onClick:()=>void gr(e),children:[e.enabled?(0,Y.jsx)(we,{className:`size-3.5`,"aria-hidden":!0}):(0,Y.jsx)(le,{className:`size-3.5`,"aria-hidden":!0}),e.enabled?p.automations.pause:p.automations.resume]})]})]},e.id))}):(0,Y.jsx)(`p`,{className:`rounded-lg border border-dashed border-edge px-3 py-4 text-sm text-fg-muted`,children:p.automations.empty})]})}):null,Q===`notes`?(0,Y.jsx)(`section`,{id:`project-panel-notes`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-notes`,className:`flex h-full min-h-[28rem] overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:(0,Y.jsx)(xt,{selectedNoteId:n,basePath:`/projects/${encodeURIComponent(w.id)}/notes`,showLibrary:!1,allowMediaCapture:!1,projectId:w.id,listTitle:p.notes.title,listDescription:p.notes.hint,emptyText:p.notes.emptyTitle,emptyDescription:p.notes.emptyDescription,listWidthStorageKey:`xopc.projectNotes.listWidth.${w.id}`})}):null,Q===`skills`?(0,Y.jsx)(Wt,{projectId:w.id,copy:p.skills}):null,Q===`files`?(0,Y.jsx)(`section`,{id:`project-panel-files`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-files`,className:`flex h-full min-h-[28rem] flex-col`,children:(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:w.effectiveWorkspaceRoot?(0,Y.jsxs)(`div`,{"data-project-files-grid":!0,className:v(`grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[var(--project-files-panel-width)_6px_minmax(0,1fr)]`,Nt&&`cursor-col-resize select-none`),style:{"--project-files-panel-width":`${jt}px`},children:[(0,Y.jsxs)(`aside`,{className:`flex min-h-0 flex-col border-b border-edge lg:border-b-0 lg:border-r`,children:[(0,Y.jsxs)(`div`,{className:`flex h-11 items-center gap-1 border-b border-edge bg-surface-muted/50 px-3 text-sm`,children:[(0,Y.jsx)(mt,{workspacePath:ti}),(0,Y.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,Y.jsx)(`button`,{type:`button`,className:v(`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,Ft&&`bg-surface-hover text-fg`),onClick:()=>It(!0),"aria-label":p.files.search,title:p.files.search,"aria-pressed":Ft,children:(0,Y.jsx)(be,{className:`size-3.5`,"aria-hidden":!0})}),(0,Y.jsx)(Te,{className:`size-7 shrink-0 rounded-md p-0`,loading:Kt,label:u.cron.refresh,onClick:()=>void _r()})]})]}),Ft?(0,Y.jsx)(`div`,{className:`shrink-0 border-b border-edge bg-surface-muted/40 px-3 py-2`,children:(0,Y.jsxs)(`div`,{className:`flex h-8 items-center gap-2 rounded-md border border-edge bg-surface-panel px-2 focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/20`,children:[(0,Y.jsx)(be,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`input`,{type:`text`,role:`searchbox`,value:Lt,onChange:e=>Rt(e.target.value),placeholder:p.files.searchPlaceholder,"aria-label":p.files.searchPlaceholder,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none placeholder:text-fg-subtle`}),(0,Y.jsx)(`button`,{type:`button`,className:`flex size-6 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":p.files.clearSearch,title:p.files.clearSearch,onClick:()=>{Rt(``),It(!1)},children:(0,Y.jsx)(Re,{className:`size-3.5`,"aria-hidden":!0})})]})}):null,Jt?(0,Y.jsx)(`div`,{className:`border-b border-edge bg-red-500/10 px-4 py-3 text-sm text-red-700 dark:text-red-300`,children:Jt}):null,yr?(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-2`,children:Vt?(0,Y.jsxs)(`div`,{className:`space-y-2 px-3 py-1`,children:[(0,Y.jsx)(ve,{className:`h-11 w-full`}),(0,Y.jsx)(ve,{className:`h-11 w-full`}),(0,Y.jsx)(ve,{className:`h-11 w-full`})]}):Ut?(0,Y.jsxs)(`p`,{className:`px-3 py-2 text-xs text-red-600 dark:text-red-400`,children:[u.workspace.loadError,`: `,Ut]}):zt.length===0?(0,Y.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:p.files.noSearchResults}):zt.map(e=>(0,Y.jsxs)(`button`,{type:`button`,className:v(`flex w-full min-w-0 items-center gap-2 px-3 py-2 text-left hover:bg-surface-hover`,kt===e.path&&`bg-accent-soft text-accent-fg`),onClick:()=>At(e.path),title:e.path,children:[(0,Y.jsx)(Fe,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`span`,{className:`block truncate text-sm text-fg`,children:e.name}),(0,Y.jsx)(`span`,{className:`block truncate text-xs text-fg-subtle`,children:e.path})]})]},e.path))}):Kt&&Et.length===0?(0,Y.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.files.loading}):(0,Y.jsx)(fe,{tree:Et,selectedPath:kt,onSelectFile:Fr,onSelectEntry:Ir,onExpandDir:e=>void vr(e),onAction:Lr,actionLabels:{preview:u.workspace.preview,download:u.workspace.download,copyPath:u.workspace.copyPath,openDefault:u.workspace.openSystemApp,openWith:u.workspace.openWith,revealInFolder:u.workspace.revealInFolder,recommendedApps:u.workspace.recommendedApps},emptyHint:p.files.emptyDirectory})]}),(0,Y.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":p.files.resizeHandle,className:v(`hidden cursor-col-resize touch-none items-stretch justify-center bg-surface-panel transition-colors hover:bg-surface-hover lg:flex`,Nt&&`bg-surface-hover`),onPointerDown:Rr,children:(0,Y.jsx)(`div`,{className:`my-3 w-px rounded-full bg-edge-strong/70`})}),(0,Y.jsx)(`div`,{className:`min-h-0 min-w-0 overflow-hidden bg-surface-base`,children:kt?(0,Y.jsx)(se,{filePath:kt,projectId:w.id,agentId:w.defaultAgentId||Qt||void 0,onClose:()=>At(null)}):(0,Y.jsx)(`div`,{className:`flex h-full min-h-[18rem] items-center justify-center px-6 text-center`,children:(0,Y.jsxs)(`div`,{className:`max-w-sm`,children:[(0,Y.jsx)(Ne,{className:`mx-auto size-8 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:p.files.previewEmptyTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.files.previewEmptyDescription})]})})})]}):(0,Y.jsxs)(`div`,{className:`grid gap-3 px-4 py-8 text-sm text-fg-muted`,children:[(0,Y.jsx)(`p`,{children:p.files.needWorkspace}),(0,Y.jsx)(`div`,{children:(0,Y.jsx)(y,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>nr(`settings`),children:p.files.openSettings})})]})})}):null,Q===`sessions`?(0,Y.jsxs)(`section`,{id:`project-panel-sessions`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-sessions`,className:`grid min-h-full content-start gap-3`,children:[I.length?(0,Y.jsxs)(`label`,{className:`relative flex min-h-9 w-full max-w-lg cursor-text items-center rounded-lg bg-surface-panel py-1.5 pl-9 pr-9 shadow-surface`,children:[(0,Y.jsx)(be,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,"aria-hidden":!0}),(0,Y.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:G,onChange:e=>ie(e.currentTarget.value),placeholder:p.sessions.searchPlaceholder,"aria-label":p.sessions.searchPlaceholder,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent py-0.5 text-sm leading-normal text-fg caret-current placeholder:text-fg-disabled focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 focus-visible:outline-none`}),G?(0,Y.jsx)(`button`,{type:`button`,className:`absolute right-2 top-1/2 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":p.sessions.clearSearch,onClick:()=>ie(``),children:(0,Y.jsx)(Re,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,qr.length?(0,Y.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:qr.map(e=>{let t=jn(e.updatedAt),n=e.routing?.agentId||e.agentId||p.common.agent,r=Un(e),i=e.name?.trim()||p.sessions.fallbackTitle,a=Gr(e.messageCount??0);return(0,Y.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:or(`sessions`),className:`group flex min-h-[8.75rem] min-w-0 flex-col rounded-lg bg-surface-panel p-4 shadow-surface transition-colors hover:bg-surface-hover/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Y.jsx)(`span`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-base text-fg-muted`,children:(0,Y.jsx)(pt,{className:`size-4`,"aria-hidden":!0})}),(0,Y.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-fg`,children:i}),r?(0,Y.jsx)(`span`,{className:`shrink-0 rounded-md bg-surface-base px-2 py-0.5 text-[11px] font-medium leading-5 text-fg-muted`,children:r}):null]})})]}),(0,Y.jsxs)(`div`,{className:`mt-auto grid gap-2 pt-4 text-xs text-fg-muted`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(`span`,{className:`min-w-0 max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[p.sessions.agent,`: `,n]}),(0,Y.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:a})]}),t?(0,Y.jsxs)(`span`,{className:`truncate rounded-md bg-surface-base px-2 py-1`,children:[p.sessions.updated,`: `,t]}):null]})]},e.key)})}):Jr?(0,Y.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:p.sessions.noMatches})}):(0,Y.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:p.sessions.emptyTitle}),(0,Y.jsx)(`p`,{className:`mx-auto mt-1 max-w-md text-sm leading-6 text-fg-muted`,children:p.sessions.emptyDescription})]})})]}):null,Q===`progress`?(0,Y.jsxs)(`section`,{id:`project-panel-progress`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-progress`,className:`grid min-h-full content-start gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.progress.title}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:An(p.progress.count,{count:Ue})})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(`label`,{className:`inline-flex min-h-9 items-center gap-2 rounded-lg bg-surface-panel px-3 text-sm text-fg-muted shadow-surface`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:Qe,onChange:e=>et(e.currentTarget.checked),className:`size-4 rounded border-edge text-accent focus:ring-accent/30`}),p.progress.includeRelated]}),(0,Y.jsxs)(y,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3`,onClick:()=>void hr(),disabled:Ke,children:[(0,Y.jsx)(q,{className:v(`size-4`,Ke&&`animate-spin`),"aria-hidden":!0}),p.common.refresh]})]})]}),(0,Y.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:Ke&&Ve.length===0?(0,Y.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:p.progress.loading}):Ve.length?(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:Ve.map(e=>{let t=p.progress.types[e.type]??e.type,n=p.progress.objectKinds[e.primaryObject.kind]??e.primaryObject.kind,r=Gn(e),i=e.relatedProjects.length>0&&!e.scopes.some(e=>e.scopeKind===`project`&&e.scopeId===w.id);return(0,Y.jsxs)(`article`,{className:`grid gap-2 px-4 py-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),i?(0,Y.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:p.progress.related}):null]}),(0,Y.jsxs)(`p`,{className:`mt-1 min-w-0 truncate text-sm text-fg-muted`,children:[n,`: `,Vn(e)]})]}),(0,Y.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,dateTime:new Date(e.createdAt).toISOString(),children:jn(e.createdAt)})]}),r?(0,Y.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:r}):null,(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,Y.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:[p.progress.actor,`: `,Bn(e)]}),(0,Y.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[p.progress.source,`: `,Hn(e)]})]})]},e.id)})}):(0,Y.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:p.progress.empty})})]}):null,Q===`settings`?(0,Y.jsxs)(`form`,{id:`project-panel-settings`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-settings`,onSubmit:Dr,onBlurCapture:Br.onBlurCapture,className:`grid min-h-full content-start gap-4 pb-1`,children:[(0,Y.jsxs)(`section`,{className:`flex min-w-0 items-start justify-between gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.summaryTitle}),(0,Y.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:p.settings.summaryHint})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-2`,children:[(0,Y.jsx)(`span`,{className:v(`rounded-full px-2 py-0.5 text-xs font-medium`,Mn(Z.status)),children:p.settings.statuses[Z.status]}),(0,Y.jsx)(St,{status:Br.status,error:Br.error})]})]}),(0,Y.jsxs)(`div`,{className:`grid items-start gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-4`,children:[(0,Y.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.detailsTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.detailsHint})]}),(0,Y.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,Y.jsx)(Nn,{label:p.settings.name,children:(0,Y.jsx)(`input`,{className:Pn(),value:Z.name,onChange:e=>Or({name:e.target.value})})}),(0,Y.jsx)(Nn,{label:p.settings.defaultAgent,children:(0,Y.jsxs)(f,{className:Pn(),value:Z.defaultAgentId,onChange:e=>Or({defaultAgentId:e.target.value},!0),children:[(0,Y.jsx)(m,{value:``,children:p.settings.globalDefaultAgent}),Xt.map(e=>(0,Y.jsx)(m,{value:e.id,children:te(e,u.agentsSettings)},e.id))]})}),(0,Y.jsx)(Nn,{label:p.settings.status,children:Qr?(0,Y.jsx)(`div`,{className:`grid min-h-10 content-center rounded-md border border-edge bg-surface-muted px-3 text-sm text-fg-muted`,children:p.settings.statuses.archived}):(0,Y.jsxs)(f,{className:Pn(),value:Z.status===`archived`?`active`:Z.status,onChange:e=>Or({status:e.target.value},!0),children:[(0,Y.jsx)(m,{value:`active`,children:p.settings.statuses.active}),(0,Y.jsx)(m,{value:`paused`,children:p.settings.statuses.paused})]})}),(0,Y.jsx)(Nn,{label:p.settings.description,hint:p.settings.descriptionHint,children:(0,Y.jsx)(`textarea`,{className:Pn(!0),value:Z.description,onChange:e=>Or({description:e.target.value})})})]})]}),(0,Y.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.projectGuidanceTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.projectGuidanceHint})]}),(0,Y.jsx)(Nn,{label:p.settings.brief,hint:p.settings.briefHint,children:(0,Y.jsx)(`textarea`,{className:Pn(!0),value:Z.brief,onChange:e=>Or({brief:e.target.value})})}),(0,Y.jsx)(Nn,{label:p.settings.instructions,hint:p.settings.instructionsHint,children:(0,Y.jsx)(`textarea`,{className:Pn(!0),value:Z.instructions,onChange:e=>Or({instructions:e.target.value})})})]})]}),(0,Y.jsxs)(`aside`,{className:`grid gap-4 xl:sticky xl:top-0`,children:[(0,Y.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.workspaceRoot}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceIndependentHint})]}),(0,Y.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Y.jsx)(`span`,{className:`w-fit rounded-md bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:ei?p.settings.workspaceModeFollow:p.settings.workspaceModeFixed}),(0,Y.jsx)(`div`,{className:`break-all font-mono text-xs leading-5 text-fg`,title:ti,children:ti}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void ai(),children:[(0,Y.jsx)(g,{className:`size-4`,"aria-hidden":!0}),p.settings.copyWorkspacePath]}),(0,Y.jsx)(mt,{workspacePath:ti}),(0,Y.jsxs)(y,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:kr,children:[(0,Y.jsx)(ne,{className:`size-4`,"aria-hidden":!0}),p.settings.migrateWorkspace]})]})]})]}),(0,Y.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.currentProjectTitle}),(0,Y.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Y.jsx)(Fn,{label:p.settings.defaultAgent,value:Yr}),(0,Y.jsx)(Fn,{label:p.settings.pinState,value:$r?p.settings.pinned:p.settings.notPinned}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,Y.jsx)(Fn,{label:p.settings.createdAt,value:jn(w.createdAt)||p.common.never}),(0,Y.jsx)(Fn,{label:p.settings.updatedAt,value:jn(w.updatedAt)||p.common.never})]})]})]}),(0,Y.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.managementTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:p.settings.managementHint})]}),(0,Y.jsxs)(`div`,{className:`grid gap-3`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:$r?p.settings.pinnedTitle:p.settings.pinTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:p.settings.pinHint})]}),(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`w-fit rounded-lg`,disabled:hn===`pin`,onClick:()=>void jr(),children:[$r?(0,Y.jsx)(oe,{className:`size-4`,"aria-hidden":!0}):(0,Y.jsx)(ze,{className:`size-4`,"aria-hidden":!0}),$r?p.settings.unpinProject:p.settings.pinProject]})]}),(0,Y.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Qr?p.settings.restoreTitle:p.settings.archiveTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:Qr?p.settings.restoreHint:p.settings.archiveHint})]}),(0,Y.jsxs)(y,{type:`button`,variant:Qr?`primary`:`ghost`,className:`w-fit rounded-lg`,disabled:hn===`archive`,onClick:()=>void Mr(),children:[Qr?(0,Y.jsx)(q,{className:`size-4`,"aria-hidden":!0}):(0,Y.jsx)(Ie,{className:`size-4`,"aria-hidden":!0}),Qr?p.settings.restoreProject:p.settings.archiveProject]})]})]})]}),(0,Y.jsxs)(`section`,{className:`grid gap-3 rounded-lg border border-red-500/20 bg-red-500/5 p-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-red-700 dark:text-red-300`,children:p.settings.dangerTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-red-700/80 dark:text-red-200/80`,children:p.settings.dangerHint})]}),(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`w-fit text-red-600 hover:bg-red-500/10 hover:text-red-700 focus-visible:ring-red-500 dark:text-red-400 dark:hover:text-red-300`,onClick:()=>on(!0),children:[(0,Y.jsx)(it,{className:`size-4`,"aria-hidden":!0}),p.settings.deleteConfirmAction]})]})]})]})]}):null]}),(0,Y.jsx)(M,{open:an,onOpenChange:e=>{_n||on(e)},children:(0,Y.jsxs)(k,{children:[(0,Y.jsx)(T,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(A,{className:`fixed left-1/2 top-1/2 z-[90] w-[min(28rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-5 shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Y.jsx)(`span`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-red-500/10 text-red-600 dark:text-red-400`,children:(0,Y.jsx)(R,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(j,{className:`text-base font-semibold text-fg`,children:p.settings.deleteConfirmTitle}),(0,Y.jsx)(D,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:w?An(p.settings.deleteConfirm,{name:w.name}):p.settings.deleteConfirmFallback})]})]}),(0,Y.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,Y.jsx)(O,{asChild:!0,children:(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:_n,children:p.common.cancel})}),(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`rounded-lg text-red-600 hover:bg-red-500/10 hover:text-red-700 focus-visible:ring-red-500 dark:text-red-400 dark:hover:text-red-300`,disabled:_n||!w,onClick:()=>void Nr(),children:[(0,Y.jsx)(it,{className:`size-4`,"aria-hidden":!0}),p.settings.deleteConfirmAction]})]})]})]})}),(0,Y.jsx)(M,{open:ln,onOpenChange:e=>{nn||un(e)},children:(0,Y.jsxs)(k,{children:[(0,Y.jsx)(T,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(A,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(34rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(j,{className:`text-base font-semibold text-fg`,children:p.settings.workspaceMigrationTitle}),(0,Y.jsx)(D,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.workspaceMigrationDescription})]}),(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:p.settings.workspaceMode}),(0,Y.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[(0,Y.jsxs)(`label`,{className:v(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,dn===`fixed`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,Y.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:dn===`fixed`,onChange:()=>fn(`fixed`),disabled:nn}),(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`span`,{className:`block font-medium`,children:p.settings.workspaceModeFixed}),(0,Y.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceMigrationFixedHint})]})]}),(0,Y.jsxs)(`label`,{className:v(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,dn===`follow`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,Y.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:dn===`follow`,onChange:()=>fn(`follow`),disabled:nn}),(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`span`,{className:`block font-medium`,children:p.settings.workspaceModeFollow}),(0,Y.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceHint})]})]})]})]}),dn===`fixed`?(0,Y.jsx)(Tt,{value:pn,onChange:mn,disabled:nn,wd:d,placeholder:p.settings.workspacePlaceholder,inputClassName:Pn(),autoFocus:!0}):null,(0,Y.jsx)(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm leading-6 text-amber-800 dark:text-amber-200`,children:p.settings.workspaceMigrationImpact}),(0,Y.jsx)(`div`,{className:`rounded-lg bg-surface-muted px-3 py-2 text-xs leading-5 text-fg-subtle`,children:An(p.settings.workspaceCurrent,{workspace:ni})})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(O,{asChild:!0,children:(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:nn,children:p.common.cancel})}),(0,Y.jsxs)(y,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:nn||!ri,onClick:()=>void Ar(),children:[(0,Y.jsx)(ne,{className:`size-4`,"aria-hidden":!0}),p.settings.workspaceMigrationConfirm]})]})]})]})}),(0,Y.jsx)(M,{open:!!sn,onOpenChange:e=>{e||cn(null)},children:(0,Y.jsxs)(k,{children:[(0,Y.jsx)(T,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(A,{className:`fixed left-1/2 top-1/2 z-[90] flex w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(j,{className:`text-base font-semibold text-fg`,children:p.settings.workspaceMissingTitle}),(0,Y.jsx)(D,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:sn?An(p.settings.workspaceMissingDescription,{workspace:sn}):null})]}),sn?(0,Y.jsx)(`div`,{className:`px-5 py-4`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,Y.jsx)(Ne,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:sn})]})}):null,(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:oi,disabled:nn,children:p.settings.workspaceMissingBack}),(0,Y.jsxs)(y,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:()=>void Ar({createWorkspaceRoot:!0}),disabled:nn,children:[(0,Y.jsx)(ne,{className:`size-4`,"aria-hidden":!0}),p.settings.workspaceMissingCreate]})]})]})]})})]})}export{X as ProjectDetailPage};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,f as a,l as o,t as s}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as c}from"./check-DUBLcKHA.js";import{d as l,f as u,l as d,n as f,p,r as m,u as h}from"./popover-select-BzdnTy3h.js";import{t as g}from"./copy-Dv6d4Dvw.js";import{t as _}from"./external-link-DjqjBmc3.js";import{t as v}from"./cn-JdwAhgNB.js";import{t as y}from"./button-CSEbl4zT.js";import{t as b}from"./copy-to-clipboard-HOJ79TWv.js";import{t as x}from"./messages-D7kOD_o_.js";import{n as S,r as C,s as w}from"./locale-store-CnamlR07.js";import{a as T,c as E,i as D,n as O,o as k,r as A,s as j,t as M}from"./dist-BPoKqzeH.js";import{$s as N,Aa as P,Ai as F,Al as ee,An as te,As as I,Ca as L,Dl as R,Ec as z,Ei as B,F as V,Fc as H,Fi as U,G as W,Gc as ne,Hc as G,Ic as re,Ii as K,Is as q,J as ie,Jo as ae,Js as oe,Jt as se,K as ce,Ks as le,Kt as ue,L as de,Li as fe,Ln as pe,M as me,Mi as he,Ml as ge,N as _e,Na as ve,Ni as ye,Ns as be,Ol as xe,Pi as Se,Ps as Ce,Qs as we,Ri as Te,Sa as Ee,Ss as De,Tc as Oe,Ti as ke,Tl as Ae,Va as je,Wa as Me,Wc as Ne,Ws as Pe,Xc as Fe,Xl as Ie,Yc as Le,Yo as Re,Ys as ze,Z as Be,Zr as Ve,_a as He,al as Ue,as as We,ba as Ge,bc as Ke,ca as qe,da as Je,fa as Ye,ga as Xe,ha as Ze,hs as Qe,ki as $e,kl as et,ks as tt,la as nt,ll as rt,ls as it,ma as at,pa as ot,pl as st,ql as ct,rs as lt,sa as ut,u as dt,ua as ft,uc as pt,ui as mt,va as ht,wa as gt,wl as _t,xa as vt,ya as yt,zi as bt}from"./index-CKSplmFw.js";import{t as xt}from"./notes-workbench-Cp1ierS_.js";import{n as St,t as Ct}from"./use-autosave-CUI3q_I-.js";import{t as wt}from"./page-tabs-BaEQMYm_.js";import{t as Tt}from"./directory-picker-path-field-DmfFg4Gq.js";import{t as Et}from"./date-picker-CGm8EH8G.js";import{i as Dt,p as Ot,s as kt}from"./skills-page.utils-b9byH-KL.js";import{t as At}from"./dependency-picker-DDECr6Hj.js";import{c as jt,l as Mt,n as Nt,o as Pt,r as Ft,t as It}from"./style-TIDOdKy0.js";var J=e(t(),1),Lt=n();function Rt(e){return w(C(`/api/projects/${encodeURIComponent(e)}/skills`))}function zt(e,t){return w(C(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`))}function Bt(e,t){let n=new FormData;return n.set(`file`,t),w(C(`/api/projects/${encodeURIComponent(e)}/skills/upload`),{method:`POST`,body:n})}function Vt(e,t,n={}){return w(C(`/api/projects/${encodeURIComponent(e)}/skills/marketplace/install`),{method:`POST`,body:JSON.stringify({name:t,...n})})}function Ht(e,t){return w(C(`/api/projects/${encodeURIComponent(e)}/skills/source/install`),{method:`POST`,body:JSON.stringify({source:t})})}function Ut(e,t){return w(C(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`),{method:`DELETE`})}var Y=r();function Wt({projectId:e,copy:t}){let[n,r]=(0,J.useState)([]),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(!0),[c,d]=(0,J.useState)(!1),[f,m]=(0,J.useState)(null),[g,b]=(0,J.useState)(``),[x,S]=(0,J.useState)(null),[C,w]=(0,J.useState)(null),[E,D]=(0,J.useState)(``),[N,P]=(0,J.useState)(1),[F,te]=(0,J.useState)(null),[I,L]=(0,J.useState)(!1),[R,z]=(0,J.useState)(``),[B,V]=(0,J.useState)(``),H=(0,J.useRef)(null),U=(0,J.useCallback)(async()=>{s(!0),b(``);try{let t=await Rt(e);r(t.items),a(t.skillsRoot)}catch(e){b(e instanceof Error?e.message:String(e))}finally{s(!1)}},[e]);(0,J.useEffect)(()=>{U()},[U]),(0,J.useEffect)(()=>{if(x!==`marketplace`)return;let e=new AbortController,t=window.setTimeout(()=>{L(!0),z(``),Ot({q:E,page:N,pageSize:8,sort:`downloads`,signal:e.signal}).then(te).catch(t=>{e.signal.aborted||z(t instanceof Error?t.message:String(t))}).finally(()=>{e.signal.aborted||L(!1)})},250);return()=>{window.clearTimeout(t),e.abort()}},[x,N,E]);async function W(e,t){d(!0),m(t??null),b(``);try{await e(),S(null),V(``),await U()}catch(e){b(e instanceof Error?e.message:String(e))}finally{d(!1),m(null)}}async function ne(t){b(``);try{w((await zt(e,t)).skill)}catch(e){b(e instanceof Error?e.message:String(e))}}async function re(n){if(window.confirm(t.removeConfirm.replace(`{{name}}`,n.name))){d(!0);try{await Ut(e,n.id),await U()}catch(e){b(e instanceof Error?e.message:String(e))}finally{d(!1)}}}return(0,Y.jsxs)(`section`,{id:`project-panel-skills`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-skills`,className:`grid content-start gap-4`,children:[(0,Y.jsxs)(`div`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.title}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,Y.jsxs)(u,{children:[(0,Y.jsx)(p,{asChild:!0,children:(0,Y.jsxs)(y,{type:`button`,children:[(0,Y.jsx)(Pe,{className:`size-4`,"aria-hidden":!0}),t.add,(0,Y.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0})]})}),(0,Y.jsx)(l,{children:(0,Y.jsxs)(h,{align:`end`,sideOffset:8,className:`z-50 w-72 rounded-lg border border-edge bg-surface-panel p-1.5 shadow-xl`,children:[(0,Y.jsx)(Gt,{icon:Qe,title:t.marketplace,hint:t.marketplaceHint,onClick:()=>S(`marketplace`)}),(0,Y.jsx)(Gt,{icon:G,title:t.source,hint:t.sourceHint,onClick:()=>S(`source`)}),(0,Y.jsx)(Gt,{icon:We,title:t.upload,hint:t.uploadHint,onClick:()=>H.current?.click()})]})})]}),(0,Y.jsx)(`input`,{ref:H,type:`file`,accept:`.zip,application/zip`,className:`hidden`,onChange:t=>{let n=t.target.files?.[0];n&&W(()=>Bt(e,n)),t.target.value=``}})]}),i?(0,Y.jsxs)(`p`,{className:`mt-3 break-all font-mono text-xs text-fg-subtle`,children:[t.path,`: `,i]}):null]}),g?(0,Y.jsx)(`p`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:g}):null,o?(0,Y.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(e=>(0,Y.jsx)(ve,{className:`h-36 rounded-lg`},e))}):n.length?(0,Y.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:n.map(e=>(0,Y.jsxs)(`article`,{className:`flex min-h-36 flex-col rounded-lg border border-edge bg-surface-panel p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(Ie,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,Y.jsx)(`h3`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:e.name})]}),(0,Y.jsx)(`p`,{className:`mt-2 line-clamp-2 flex-1 text-sm leading-5 text-fg-muted`,children:e.description||e.id}),(0,Y.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>void ne(e.id),children:[(0,Y.jsx)(_,{className:`size-3.5`,"aria-hidden":!0}),t.view]}),(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-red-600`,disabled:c,onClick:()=>void re(e),children:[(0,Y.jsx)(it,{className:`size-3.5`,"aria-hidden":!0}),t.remove]})]})]},e.id))}):(0,Y.jsxs)(`div`,{className:`rounded-lg border border-dashed border-edge bg-surface-panel px-6 py-12 text-center`,children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.empty}),(0,Y.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:t.emptyHint})]}),(0,Y.jsx)(M,{open:x!==null,onOpenChange:e=>{e||S(null)},children:(0,Y.jsxs)(k,{children:[(0,Y.jsx)(T,{className:`fixed inset-0 z-50 bg-black/45`}),(0,Y.jsxs)(A,{className:v(`fixed left-1/2 top-1/2 z-50 flex -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-xl`,x===`marketplace`?`h-[min(46rem,calc(100vh-2rem))] w-[min(58rem,calc(100vw-2rem))]`:`h-[min(22rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))]`),children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(j,{className:`text-base font-semibold text-fg`,children:x===`marketplace`?t.marketplace:t.source}),(0,Y.jsx)(O,{asChild:!0,children:(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,Y.jsx)(Re,{className:`size-4`})})})]}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:x===`marketplace`?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.marketplace}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.marketplaceHint}),(0,Y.jsxs)(`div`,{className:`relative mt-3`,children:[(0,Y.jsx)(be,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`input`,{className:`h-10 w-full rounded-md border border-edge bg-surface-base pl-9 pr-3 text-sm outline-none focus:border-accent`,value:E,onChange:e=>{D(e.target.value),P(1)},placeholder:t.marketplacePlaceholder,autoFocus:!0})]}),R?(0,Y.jsx)(`p`,{className:`mt-3 text-sm text-red-600 dark:text-red-300`,children:R}):null,I&&!F?(0,Y.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[0,1,2,3].map(e=>(0,Y.jsx)(ve,{className:`h-32 rounded-lg`},e))}):F?.items.length?(0,Y.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:F.items.map(r=>{let i=r.providerId??F.provider,a=Dt(r,i),o=n.some(e=>e.id===r.id||e.id===a||e.name===r.name),s=f===a;return(0,Y.jsxs)(`article`,{className:`group flex min-h-32 gap-3 rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Y.jsx)(kt,{name:r.name,className:`size-10`}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Y.jsx)(`h4`,{className:`truncate text-sm font-semibold text-fg`,children:r.name}),(0,Y.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:r.description||`—`}),(0,Y.jsxs)(`div`,{className:`mt-auto flex items-end justify-between gap-2 pt-2`,children:[(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-fg-subtle`,children:[(0,Y.jsx)(Ue,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceDownloads,` `,r.downloads]}),(0,Y.jsx)(y,{type:`button`,className:`h-8 px-2.5 text-xs`,variant:o?`secondary`:`primary`,disabled:c||o,onClick:()=>void W(()=>Vt(e,a,{provider:i}),a),children:o?t.marketplaceInstalled:s?t.installing:t.install})]})]})]},`${i??`default`}:${r.id}`)})}):I?null:(0,Y.jsx)(`p`,{className:`mt-6 text-center text-sm text-fg-muted`,children:t.marketplaceEmpty}),F&&F.meta.totalPages>1?(0,Y.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,Y.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t.marketplacePage.replace(`{{page}}`,String(F.meta.page)).replace(`{{total}}`,String(F.meta.totalPages))}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:I||N<=1,onClick:()=>P(e=>Math.max(1,e-1)),children:[(0,Y.jsx)(et,{className:`size-4`}),t.marketplacePrevious]}),(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:I||N>=F.meta.totalPages,onClick:()=>P(e=>e+1),children:[t.marketplaceNext,(0,Y.jsx)(xe,{className:`size-4`})]})]})]}):null]}):(0,Y.jsxs)(`section`,{className:`flex h-full flex-col`,children:[(0,Y.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:t.sourceHint}),(0,Y.jsx)(`input`,{className:`mt-4 h-10 w-full rounded-md border border-edge bg-surface-base px-3 text-sm outline-none focus:border-accent`,value:B,onChange:e=>V(e.target.value),placeholder:t.sourcePlaceholder,autoFocus:!0}),(0,Y.jsxs)(`div`,{className:`mt-auto flex justify-end gap-2 border-t border-edge pt-4`,children:[(0,Y.jsx)(O,{asChild:!0,children:(0,Y.jsx)(y,{type:`button`,variant:`secondary`,children:t.close})}),(0,Y.jsx)(y,{type:`button`,disabled:c||!B.trim(),onClick:()=>void W(()=>Ht(e,B.trim())),children:c?t.installing:t.install})]})]})})]})]})}),(0,Y.jsx)(M,{open:!!C,onOpenChange:e=>{e||w(null)},children:(0,Y.jsxs)(k,{children:[(0,Y.jsx)(T,{className:`fixed inset-0 z-50 bg-black/45`}),(0,Y.jsxs)(A,{className:`fixed left-1/2 top-1/2 z-50 flex h-[min(42rem,calc(100vh-2rem))] w-[min(48rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-xl`,children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(j,{className:`text-base font-semibold text-fg`,children:C?.name}),(0,Y.jsx)(O,{asChild:!0,children:(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,Y.jsx)(Re,{className:`size-4`})})})]}),(0,Y.jsx)(`pre`,{className:`min-h-0 flex-1 overflow-auto whitespace-pre-wrap p-5 text-sm leading-6 text-fg-muted`,children:C?.bodyMarkdown})]})]})})]})}function Gt(e){let t=(0,Lt.c)(13),{icon:n,title:r,hint:i,onClick:a}=e,o;t[0]===n?o=t[1]:(o=(0,Y.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`,"aria-hidden":!0}),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=(0,Y.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:r}),t[2]=r,t[3]=s);let c;t[4]===i?c=t[5]:(c=(0,Y.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-fg-muted`,children:i}),t[4]=i,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;return t[9]!==a||t[10]!==o||t[11]!==l?(u=(0,Y.jsx)(d,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-3 rounded-md px-3 py-2.5 text-left hover:bg-surface-hover`,onClick:a,children:[o,l]})}),t[9]=a,t[10]=o,t[11]=l,t[12]=u):u=t[12],u}var Kt=[`backlog`,`ready`,`active`,`review`,`closed`];function qt(e){return{backlog:e.filter(e=>e.phase===`backlog`),ready:e.filter(e=>e.phase===`ready`),active:e.filter(e=>e.phase===`active`),review:e.filter(e=>e.phase===`review`),closed:e.filter(e=>e.phase===`closed`)}}function Jt(e,t){if(e.phase!==t){if(e.phase===`closed`&&t!==`closed`&&e.allowedCommands.includes(`reopen`))return`reopen_${t}`;if(t===`closed`&&e.phase===`review`&&e.allowedCommands.includes(`close`))return`complete`;if(t!==`closed`&&e.allowedCommands.includes(`move`))return`move_${t}`}}function Yt(e){if(e.allowedCommands.includes(`resolve_wait`))return`resume`;if(e.allowedCommands.includes(`mark_ready`))return`ready`;if(e.allowedCommands.includes(`start`))return`run`;if(e.allowedCommands.includes(`request_review`))return`review`;if(e.phase===`review`&&e.allowedCommands.includes(`close`))return`complete`;if(e.allowedCommands.includes(`reopen`))return`reopen`;if(e.allowedCommands.includes(`add_wait`))return`pause`}function Xt(e){let t=new Map,n=new Map;for(let r of e)t.set(r.dependencyTaskId,[...t.get(r.dependencyTaskId)??[],r.dependentTaskId]),n.set(r.dependentTaskId,[...n.get(r.dependentTaskId)??[],r.dependencyTaskId]);return{outgoing:t,incoming:n}}function Zt(e,t){let n=new Set(e.map(e=>e.id)),{outgoing:r,incoming:i}=Xt(t.filter(e=>n.has(e.dependencyTaskId)&&n.has(e.dependentTaskId))),a=new Map(e.map(e=>[e.id,i.get(e.id)?.length??0])),o=new Map(e.map(e=>[e.id,0])),s=e.filter(e=>a.get(e.id)===0).sort((e,t)=>t.updatedAt-e.updatedAt).map(e=>e.id);for(let e=0;e<s.length;e+=1){let t=s[e];for(let e of r.get(t)??[]){o.set(e,Math.max(o.get(e)??0,(o.get(t)??0)+1));let n=(a.get(e)??1)-1;a.set(e,n),n===0&&s.push(e)}}let c=new Map;for(let t of e){let e=o.get(t.id)??0;c.set(e,[...c.get(e)??[],t.id])}let l=new Map;for(let[e,t]of c)t.forEach((t,n)=>l.set(t,{x:e*300,y:n*136}));return l}function Qt(e,t){let{incoming:n}=Xt(t),r=new Set(e.filter(e=>e.operationalState===`blocked`).map(e=>e.id)),i=[...r];for(let e=0;e<i.length;e+=1)for(let t of n.get(i[e])??[])r.has(t)||(r.add(t),i.push(t));return r}function $t(e,t){let{incoming:n,outgoing:r}=Xt(t),i=new Set([e]);for(let t of[n,r]){let n=[e],r=new Set(n);for(let e=0;e<n.length;e+=1)for(let a of t.get(n[e])??[])r.has(a)||(r.add(a),i.add(a),n.push(a))}return i}var en={backlog:`border-edge`,ready:`border-edge`,active:`border-accent ring-2 ring-accent/15`,review:`border-amber-400/80`,closed:`border-emerald-400/60`};function tn(e){let t=(0,Lt.c)(25),{data:n,selected:r}=e,i=n.task,a=i.operationalState===`waiting`||i.operationalState===`blocked`,o=en[i.phase],s=r&&`ring-2 ring-accent/30`,c=n.dimmed&&`opacity-30`,l;t[0]!==o||t[1]!==s||t[2]!==c?(l=v(`group w-56 rounded-xl border bg-surface-panel p-3 shadow-surface transition-opacity`,o,s,c),t[0]=o,t[1]=s,t[2]=c,t[3]=l):l=t[3];let u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Y.jsx)(Ft,{type:`target`,position:Mt.Left,className:`!size-3 !border-2 !border-surface-panel !bg-accent opacity-60 transition-opacity group-hover:opacity-100`}),t[4]=u):u=t[4];let d;t[5]===i.title?d=t[6]:(d=(0,Y.jsx)(`strong`,{className:`line-clamp-2 min-w-0 text-sm font-medium leading-5 text-fg`,children:i.title}),t[5]=i.title,t[6]=d);let f;t[7]===a?f=t[8]:(f=a?(0,Y.jsx)(H,{className:`mt-0.5 size-3.5 shrink-0 text-violet-600 dark:text-violet-300`,"aria-hidden":!0}):null,t[7]=a,t[8]=f);let p;t[9]!==d||t[10]!==f?(p=(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[d,f]}),t[9]=d,t[10]=f,t[11]=p):p=t[11];let m;t[12]===n.phaseLabel?m=t[13]:(m=(0,Y.jsx)(`span`,{children:n.phaseLabel}),t[12]=n.phaseLabel,t[13]=m);let h;t[14]!==a||t[15]!==i.blockedBy?(h=a&&i.blockedBy.length>0?(0,Y.jsx)(`span`,{children:i.blockedBy.length}):null,t[14]=a,t[15]=i.blockedBy,t[16]=h):h=t[16];let g;t[17]!==h||t[18]!==m?(g=(0,Y.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2 text-[11px] text-fg-subtle`,children:[m,h]}),t[17]=h,t[18]=m,t[19]=g):g=t[19];let _;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Y.jsx)(Ft,{type:`source`,position:Mt.Right,className:`!size-3 !border-2 !border-surface-panel !bg-accent opacity-60 transition-opacity group-hover:opacity-100`}),t[20]=_):_=t[20];let y;return t[21]!==g||t[22]!==l||t[23]!==p?(y=(0,Y.jsxs)(`div`,{className:l,children:[u,p,g,_]}),t[21]=g,t[22]=l,t[23]=p,t[24]=y):y=t[24],y}var nn={taskNode:tn};function rn(e){let t=(0,Lt.c)(90),{tasks:n,dependencyEdges:r,returnTo:i,copy:a,onDependenciesChange:o}=e,[c,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(!1),[f,p]=(0,J.useState)(),[m,h]=(0,J.useState)(),g=(0,J.useRef)(null),b;t[0]!==r||t[1]!==n?(b=Qt(n,r),t[0]=r,t[1]=n,t[2]=b):b=t[2];let x=b,S;t[3]!==x||t[4]!==u||t[5]!==c||t[6]!==n?(S=u?n.filter(e=>x.has(e.id)):c?n:n.filter(fn),t[3]=x,t[4]=u,t[5]=c,t[6]=n,t[7]=S):S=t[7];let C=S,w;t[8]===C?w=t[9]:(w=new Set(C.map(dn)),t[8]=C,t[9]=w);let T=w,E;if(t[10]!==r||t[11]!==T){let e;t[13]===T?e=t[14]:(e=e=>T.has(e.dependencyTaskId)&&T.has(e.dependentTaskId),t[13]=T,t[14]=e),E=r.filter(e),t[10]=r,t[11]=T,t[12]=E}else E=t[12];let D=E,O;t[15]!==D||t[16]!==C?(O=Zt(C,D),t[15]=D,t[16]=C,t[17]=O):O=t[17];let k=O,A;t[18]!==f||t[19]!==D?(A=f?$t(f,D):void 0,t[18]=f,t[19]=D,t[20]=A):A=t[20];let j=A,M;t[21]===f?M=t[22]:(M=e=>e.id===f,t[21]=f,t[22]=M);let N=C.find(M),P;t[23]===C?P=t[24]:(P=new Map(C.map(un)),t[23]=C,t[24]=P);let F=P,ee;if(t[25]!==a.phases||t[26]!==k||t[27]!==j||t[28]!==C){let e;t[30]!==a.phases||t[31]!==k||t[32]!==j?(e=e=>({id:e.id,type:`taskNode`,position:k.get(e.id)??{x:0,y:0},data:{task:e,phaseLabel:a.phases[e.phase],dimmed:!!(j&&!j.has(e.id))}}),t[30]=a.phases,t[31]=k,t[32]=j,t[33]=e):e=t[33],ee=C.map(e),t[25]=a.phases,t[26]=k,t[27]=j,t[28]=C,t[29]=ee}else ee=t[29];let te=ee,I;if(t[34]!==j||t[35]!==F||t[36]!==D){let e;t[38]!==j||t[39]!==F?(e=e=>{let t=F.get(e.dependencyTaskId),n=t?.phase===`closed`&&t.resolution===`done`,r=!!(j&&(!j.has(e.dependencyTaskId)||!j.has(e.dependentTaskId)));return{id:`${e.dependencyTaskId}:${e.dependentTaskId}`,source:e.dependencyTaskId,target:e.dependentTaskId,markerEnd:{type:jt.ArrowClosed},style:{stroke:n?`var(--color-edge-strong)`:`var(--color-accent)`,strokeWidth:n?1.25:1.75,opacity:r?.18:1,strokeDasharray:n?`5 5`:void 0}}},t[38]=j,t[39]=F,t[40]=e):e=t[40],I=D.map(e),t[34]=j,t[35]=F,t[36]=D,t[37]=I}else I=t[37];let L=I,R,z;t[41]!==f||t[42]!==T?(R=()=>{f&&!T.has(f)&&p(void 0)},z=[f,T],t[41]=f,t[42]=T,t[43]=R,t[44]=z):(R=t[43],z=t[44]),(0,J.useEffect)(R,z);let B,V;t[45]!==L||t[46]!==m?(B=()=>{m&&!L.some(e=>e.id===m)&&h(void 0)},V=[L,m],t[45]=L,t[46]=m,t[47]=B,t[48]=V):(B=t[47],V=t[48]),(0,J.useEffect)(B,V);let H;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(H=()=>{let e=window.requestAnimationFrame(()=>{g.current?.fitView({padding:.2,minZoom:.35,maxZoom:1,duration:250})});return()=>window.cancelAnimationFrame(e)},t[49]=H):H=t[49];let U;t[50]!==u||t[51]!==c||t[52]!==C.length?(U=[u,c,C.length],t[50]=u,t[51]=c,t[52]=C.length,t[53]=U):U=t[53],(0,J.useEffect)(H,U);let W;t[54]===f?W=t[55]:(W=()=>{f&&g.current?.fitView({nodes:[{id:f}],padding:1.5,minZoom:.7,maxZoom:1,duration:250})},t[54]=f,t[55]=W);let ne=W,G;t[56]!==r||t[57]!==o?(G=e=>{if(!e.source||!e.target||e.source===e.target)return;let t=r.filter(t=>t.dependentTaskId===e.target).map(ln);t.includes(e.source)||o(e.target,[...t,e.source])},t[56]=r,t[57]=o,t[58]=G):G=t[58];let re=G,K;t[59]!==r||t[60]!==o||t[61]!==m?(K=()=>{if(!m)return;let e=r.find(e=>`${e.dependencyTaskId}:${e.dependentTaskId}`===m);e&&(h(void 0),o(e.dependentTaskId,r.filter(t=>t.dependentTaskId===e.dependentTaskId&&t.dependencyTaskId!==e.dependencyTaskId).map(cn)))},t[59]=r,t[60]=o,t[61]=m,t[62]=K):K=t[62];let q=K,ie;t[63]===a.connectHint?ie=t[64]:(ie=(0,Y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.connectHint}),t[63]=a.connectHint,t[64]=ie);let ae=u?`secondary`:`ghost`,oe;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(oe=()=>d(sn),t[65]=oe):oe=t[65];let se=u?a.allTasks:a.blockedChains,ce;t[66]!==u||t[67]!==ae||t[68]!==se?(ce=(0,Y.jsx)(y,{type:`button`,variant:ae,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":u,onClick:oe,children:se}),t[66]=u,t[67]=ae,t[68]=se,t[69]=ce):ce=t[69];let le;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(le=()=>l(on),t[70]=le):le=t[70];let de=c?a.hideCompleted:a.showCompleted,fe;t[71]!==u||t[72]!==c||t[73]!==de?(fe=(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":c,onClick:le,disabled:u,children:de}),t[71]=u,t[72]=c,t[73]=de,t[74]=fe):fe=t[74];let pe=N?(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:ne,children:[(0,Y.jsx)(Le,{className:`size-3.5`,"aria-hidden":!0}),a.locateTask]}):null,me;t[75]!==a.removeDependency||t[76]!==q||t[77]!==m?(me=m?(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs text-danger`,onClick:q,children:a.removeDependency}):null,t[75]=a.removeDependency,t[76]=q,t[77]=m,t[78]=me):me=t[78];let he;t[79]!==ce||t[80]!==fe||t[81]!==pe||t[82]!==me?(he=(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[ce,fe,pe,me]}),t[79]=ce,t[80]=fe,t[81]=pe,t[82]=me,t[83]=he):he=t[83];let ge;t[84]!==ie||t[85]!==he?(ge=(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-b border-edge bg-surface-panel px-3 py-2.5`,children:[ie,he]}),t[84]=ie,t[85]=he,t[86]=ge):ge=t[86];let _e=C.length>0?(0,Y.jsxs)(`div`,{className:v(`grid h-[min(42rem,calc(100vh-14rem))] min-h-[28rem]`,N&&`lg:grid-cols-[minmax(0,1fr)_18rem]`),children:[(0,Y.jsxs)(Pt,{nodes:te,edges:L,nodeTypes:nn,nodesDraggable:!1,nodesConnectable:!0,elementsSelectable:!0,onNodeClick:(e,t)=>p(t.id),onEdgeClick:(e,t)=>h(t.id),onConnect:re,onPaneClick:()=>{p(void 0),h(void 0)},onInit:e=>{g.current=e},fitView:!0,minZoom:.25,maxZoom:1.25,panOnScroll:!0,zoomOnDoubleClick:!1,proOptions:{hideAttribution:!0},children:[(0,Y.jsx)(It,{color:`var(--color-edge)`,gap:22,size:1}),(0,Y.jsx)(Nt,{showInteractive:!1,className:`!border-edge !bg-surface-panel !shadow-surface`})]}),N?(0,Y.jsxs)(`aside`,{className:`overflow-y-auto border-t border-edge bg-surface-panel p-4 lg:border-l lg:border-t-0`,children:[(0,Y.jsx)(`p`,{className:`text-xs font-medium text-accent-fg`,children:a.phases[N.phase]}),(0,Y.jsx)(`h3`,{className:`mt-2 text-sm font-semibold leading-6 text-fg`,children:N.title}),N.operationalState===`blocked`&&N.blockedBy.length>0?(0,Y.jsxs)(`div`,{className:`mt-4 rounded-lg bg-violet-500/8 p-3`,children:[(0,Y.jsx)(`p`,{className:`text-xs font-medium text-violet-700 dark:text-violet-300`,children:a.blockedBy.replace(`{{count}}`,String(N.blockedBy.length))}),(0,Y.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:N.blockedBy.map(an)})]}):null,(0,Y.jsxs)(s,{to:ue(i,N.id),className:`mt-4 inline-flex items-center gap-1.5 text-xs font-medium text-accent-fg hover:underline`,children:[(0,Y.jsx)(_,{className:`size-3.5`,"aria-hidden":!0}),a.openTask]})]}):null]}):(0,Y.jsx)(`div`,{className:`flex min-h-72 items-center justify-center px-6 text-center text-sm text-fg-muted`,children:a.empty}),ve;return t[87]!==ge||t[88]!==_e?(ve=(0,Y.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-base/40`,children:[ge,_e]}),t[87]=ge,t[88]=_e,t[89]=ve):ve=t[89],ve}function an(e){return(0,Y.jsx)(`li`,{children:e.title},e.id)}function on(e){return!e}function sn(e){return!e}function cn(e){return e.dependencyTaskId}function ln(e){return e.dependencyTaskId}function un(e){return[e.id,e]}function dn(e){return e.id}function fn(e){return e.phase!==`closed`}function pn({policy:e,copy:t,onSave:n}){let[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(e.mode),[s,c]=(0,J.useState)(Math.round(e.confidenceThreshold*100)),[l,u]=(0,J.useState)(!!e.quietHours),[d,p]=(0,J.useState)(e.quietHours?.startHour??22),[h,g]=(0,J.useState)(e.quietHours?.endHour??8),[_,v]=(0,J.useState)(e.quietHours?.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone),[b,x]=(0,J.useState)(e.allowedActions.includes(`create_project_task`)),[S,C]=(0,J.useState)(!1),[w,N]=(0,J.useState)();(0,J.useEffect)(()=>{o(e.mode),c(Math.round(e.confidenceThreshold*100)),u(!!e.quietHours),p(e.quietHours?.startHour??22),g(e.quietHours?.endHour??8),v(e.quietHours?.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone),x(e.allowedActions.includes(`create_project_task`))},[e]);let P=async()=>{C(!0),N(void 0);try{await n({mode:a,confidenceThreshold:s/100,quietHours:l?{startHour:d,endHour:h,timezone:_}:null,allowedActions:b?[`create_project_task`]:[]}),i(!1)}catch(e){N(e instanceof Error?e.message:t.saveFailed)}finally{C(!1)}};return(0,Y.jsxs)(M,{open:r,onOpenChange:e=>{S||i(e)},children:[(0,Y.jsx)(E,{asChild:!0,children:(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`h-9 gap-2 px-2.5 text-xs`,children:[(0,Y.jsx)(I,{className:`size-3.5`,"aria-hidden":!0}),t.modes[e.mode]]})}),(0,Y.jsxs)(k,{children:[(0,Y.jsx)(T,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(A,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(36rem,calc(100vh-2rem))] w-[min(34rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(j,{className:`text-base font-semibold text-fg`,children:t.title}),(0,Y.jsx)(D,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,Y.jsx)(O,{asChild:!0,children:(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:S,children:(0,Y.jsx)(Re,{className:`size-4`,"aria-hidden":!0})})})]}),(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-4`,children:[(0,Y.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:t.mode}),(0,Y.jsx)(f,{value:a,onChange:e=>o(e.target.value),children:Object.entries(t.modes).map(([e,t])=>(0,Y.jsx)(m,{value:e,children:t},e))})]}),(0,Y.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[t.confidence,` · `,s,`%`]}),(0,Y.jsx)(`input`,{type:`range`,min:`50`,max:`100`,step:`5`,value:s,onChange:e=>c(Number(e.target.value)),className:`accent-accent`})]}),(0,Y.jsxs)(`div`,{className:`rounded-lg border border-edge p-3`,children:[(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:l,onChange:e=>u(e.target.checked)}),t.quietHours]}),l?(0,Y.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-3`,children:[(0,Y.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietStart,(0,Y.jsx)(`input`,{type:`number`,min:`0`,max:`23`,value:d,onChange:e=>p(Number(e.target.value)),className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-fg`})]}),(0,Y.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietEnd,(0,Y.jsx)(`input`,{type:`number`,min:`0`,max:`23`,value:h,onChange:e=>g(Number(e.target.value)),className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-fg`})]}),(0,Y.jsxs)(`label`,{className:`col-span-2 grid gap-1 text-xs text-fg-muted`,children:[t.timezone,(0,Y.jsx)(`input`,{value:_,onChange:e=>v(e.target.value),className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-fg`})]})]}):null]}),(0,Y.jsxs)(`label`,{className:`flex items-start gap-3 rounded-lg border border-edge p-3`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,className:`mt-1`,checked:b,onChange:e=>x(e.target.checked)}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:t.allowTaskCreation}),(0,Y.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.allowTaskCreationDescription})]})]})]}),(0,Y.jsxs)(`div`,{className:`shrink-0 border-t border-edge px-5 py-3`,children:[w?(0,Y.jsx)(`p`,{className:`mb-2 text-xs text-danger`,children:w}):null,(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Y.jsx)(O,{asChild:!0,children:(0,Y.jsx)(y,{type:`button`,variant:`ghost`,disabled:S,children:t.cancel})}),(0,Y.jsx)(y,{type:`button`,variant:`primary`,disabled:S||!_.trim()||d<0||d>23||h<0||h>23,onClick:()=>void P(),children:S?t.saving:t.save})]})]})]})]})]})}var mn={backlog:_t,ready:_t,active:Ke,review:lt,closed:Ae},hn={backlog:`text-fg-muted`,ready:`text-fg-muted`,active:`text-accent-fg`,review:`text-amber-700 dark:text-amber-300`,closed:`text-emerald-700 dark:text-emerald-300`};function gn(e){let t=(0,Lt.c)(64),{task:n,returnTo:r,copy:i,busy:a,onAction:o,onDragStart:c,onDropBefore:l}=e,u;t[0]===n?u=t[1]:(u=Yt(n),t[0]=n,t[1]=u);let d=u,f;t[2]!==c||t[3]!==n.id?(f=e=>{e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,n.id),c(n.id)},t[2]=c,t[3]=n.id,t[4]=f):f=t[4];let p;t[5]===c?p=t[6]:(p=()=>c(``),t[5]=c,t[6]=p);let m;t[7]!==l||t[8]!==n.id?(m=e=>{e.preventDefault(),e.stopPropagation(),l(n.id)},t[7]=l,t[8]=n.id,t[9]=m):m=t[9];let h;t[10]!==r||t[11]!==n.id?(h=ue(r,n.id),t[10]=r,t[11]=n.id,t[12]=h):h=t[12];let g;t[13]===n.title?g=t[14]:(g=(0,Y.jsx)(`h3`,{className:`min-w-0 break-words text-sm font-medium leading-5 text-fg`,children:n.title}),t[13]=n.title,t[14]=g);let _;t[15]!==i||t[16]!==n.priority?(_=n.priority===`critical`||n.priority===`high`?(0,Y.jsx)(`span`,{className:v(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,n.priority===`critical`?`bg-red-500/10 text-red-700 dark:text-red-300`:`bg-amber-500/10 text-amber-700 dark:text-amber-300`),children:i.priorityOptions[n.priority]}):null,t[15]=i,t[16]=n.priority,t[17]=_):_=t[17];let y;t[18]!==g||t[19]!==_?(y=(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[g,_]}),t[18]=g,t[19]=_,t[20]=y):y=t[20];let b;t[21]===n.attention[0]?b=t[22]:(b=n.attention[0]?(0,Y.jsx)(`p`,{className:`mt-2 line-clamp-3 text-xs leading-5 text-fg-muted`,children:n.attention[0].summary}):null,t[21]=n.attention[0],t[22]=b);let x;t[23]!==i||t[24]!==n.blockedBy||t[25]!==n.operationalState?(x=n.operationalState===`blocked`&&n.blockedBy.length>0?(0,Y.jsxs)(`div`,{className:`mt-2 rounded-md bg-violet-500/8 px-2.5 py-2 text-xs text-violet-700 dark:text-violet-300`,children:[(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-medium`,children:[(0,Y.jsx)(H,{className:`size-3.5`,"aria-hidden":!0}),i.blockedBy.replace(`{{count}}`,String(n.blockedBy.length))]}),(0,Y.jsx)(`p`,{className:`mt-1 line-clamp-2 leading-5 text-fg-muted`,children:n.blockedBy.map(_n).join(`、`)})]}):null,t[23]=i,t[24]=n.blockedBy,t[25]=n.operationalState,t[26]=x):x=t[26];let S;t[27]!==i||t[28]!==n.operationalState?(S=n.operationalState===`idle`?null:(0,Y.jsx)(`span`,{className:`font-medium text-accent-fg`,children:i.operationalStates[n.operationalState]}),t[27]=i,t[28]=n.operationalState,t[29]=S):S=t[29];let C;t[30]!==i||t[31]!==n.latestVerification?(C=n.latestVerification?(0,Y.jsx)(`span`,{className:v(`font-medium`,n.latestVerification===`passed`?`text-emerald-700 dark:text-emerald-300`:n.latestVerification===`failed`?`text-red-700 dark:text-red-300`:`text-fg-subtle`),children:i.verification[n.latestVerification]}):null,t[30]=i,t[31]=n.latestVerification,t[32]=C):C=t[32];let w;t[33]!==i||t[34]!==n.acceptanceCriteriaCount?(w=n.acceptanceCriteriaCount>0?(0,Y.jsx)(`span`,{children:i.acceptanceCriteria.replace(`{{count}}`,String(n.acceptanceCriteriaCount))}):null,t[33]=i,t[34]=n.acceptanceCriteriaCount,t[35]=w):w=t[35];let T;t[36]===n.dueAt?T=t[37]:(T=n.dueAt?(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Y.jsx)(ge,{className:`size-3`,"aria-hidden":!0}),Ve(new Date(n.dueAt))]}):null,t[36]=n.dueAt,t[37]=T);let E;t[38]===n.nextCheckAt?E=t[39]:(E=n.nextCheckAt?(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-accent-fg`,children:[(0,Y.jsx)(ge,{className:`size-3`,"aria-hidden":!0}),Ve(new Date(n.nextCheckAt))]}):null,t[38]=n.nextCheckAt,t[39]=E);let D;t[40]!==S||t[41]!==C||t[42]!==w||t[43]!==T||t[44]!==E?(D=(0,Y.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-fg-subtle`,children:[S,C,w,T,E]}),t[40]=S,t[41]=C,t[42]=w,t[43]=T,t[44]=E,t[45]=D):D=t[45];let O;t[46]!==x||t[47]!==D||t[48]!==h||t[49]!==y||t[50]!==b?(O=(0,Y.jsxs)(s,{to:h,className:`block min-w-0 p-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,children:[y,b,x,D]}),t[46]=x,t[47]=D,t[48]=h,t[49]=y,t[50]=b,t[51]=O):O=t[51];let k;t[52]!==a||t[53]!==i||t[54]!==o||t[55]!==d||t[56]!==n?(k=d?(0,Y.jsxs)(`div`,{className:`flex items-center gap-3 border-t border-edge-subtle px-3 py-2`,children:[(0,Y.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,d),className:`text-xs font-medium text-accent-fg hover:underline disabled:cursor-wait disabled:opacity-50`,children:i.actions[d]}),d!==`review`&&n.allowedCommands.includes(`request_review`)?(0,Y.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,`review`),className:`text-xs font-medium text-fg-muted hover:text-fg hover:underline disabled:cursor-wait disabled:opacity-50`,children:i.actions.review}):null]}):null,t[52]=a,t[53]=i,t[54]=o,t[55]=d,t[56]=n,t[57]=k):k=t[57];let A;return t[58]!==O||t[59]!==k||t[60]!==f||t[61]!==p||t[62]!==m?(A=(0,Y.jsxs)(`article`,{draggable:!0,onDragStart:f,onDragEnd:p,onDragOver:vn,onDrop:m,className:`min-h-max min-w-0 shrink-0 overflow-hidden rounded-lg border border-edge-subtle bg-surface-panel transition-colors hover:border-edge hover:bg-surface-hover`,children:[O,k]}),t[58]=O,t[59]=k,t[60]=f,t[61]=p,t[62]=m,t[63]=A):A=t[63],A}function _n(e){return e.title}function vn(e){e.preventDefault(),e.stopPropagation()}function yn({tasks:e,dependencyEdges:t,monitoring:n,returnTo:r,copy:i,onAction:a,onReorder:o,onUndoMove:s,onDependenciesChange:c,onMonitoringChange:l,onCreate:u,actionBusyId:d,ref:p}){let[h,g]=(0,J.useState)(null),[_,b]=(0,J.useState)(null),[C,w]=(0,J.useState)(`board`),[E,P]=(0,J.useState)(!1),[F,ee]=(0,J.useState)(()=>crypto.randomUUID()),[te,I]=(0,J.useState)(``),[L,R]=(0,J.useState)(`normal`),[z,B]=(0,J.useState)(``),[V,H]=(0,J.useState)([]),[U,W]=(0,J.useState)(!1),[ne,re]=(0,J.useState)(null),K=ie({chat:x(S(e=>e.language)).chat}),q=qt(e),ae=e.filter(e=>e.phase!==`closed`),oe=(e,t)=>void a(e,t),se=async(t,n)=>{let r=e.find(e=>e.id===h);if(g(null),!r||r.id===n)return;let i=q[r.phase],s=i.findIndex(e=>e.id===r.id),c=s>=0?i[s+1]?.id??null:null;if(r.phase===t&&c===n)return;let l=Jt(r,t);r.phase!==t&&!l||l&&!await a(r,l)||await o(r.id,n)&&b({taskId:r.id,phase:r.phase,beforeTaskId:c})},ce=async e=>{e.preventDefault();let t=te.trim();if(!(!t||U)){W(!0),re(null);try{let e=z?new Date(`${z}T23:59:59.999`).getTime():void 0;await u({requestId:F,objective:t,priority:L,dependsOnTaskIds:V,attachments:K.wireAttachmentsPayload(),...e===void 0?{}:{dueAt:e}}),I(``),R(`normal`),B(``),H([]),K.clearAttachments(),ee(crypto.randomUUID()),P(!1)}catch(e){re(e instanceof Error?e.message:i.createFailed)}finally{W(!1)}}},le=()=>{ee(crypto.randomUUID()),I(``),R(`normal`),B(``),H([]),K.clearAttachments(),re(null),P(!0)};return(0,J.useImperativeHandle)(p,()=>({openCreate:le})),(0,J.useEffect)(()=>{if(!_)return;let e=window.setTimeout(()=>b(null),6e3);return()=>window.clearTimeout(e)},[_]),(0,Y.jsxs)(`section`,{id:`project-panel-board`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-board`,className:`flex h-full min-h-0 flex-col overflow-hidden`,children:[(0,Y.jsxs)(`div`,{className:`mb-4 flex shrink-0 flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:i.title}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:i.description})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,Y.jsx)(pn,{policy:n,copy:i.monitoring,onSave:l}),(0,Y.jsxs)(`div`,{className:`flex rounded-lg border border-edge bg-surface-panel p-0.5`,children:[(0,Y.jsxs)(`button`,{type:`button`,"aria-pressed":C===`board`,onClick:()=>w(`board`),className:v(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,C===`board`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,Y.jsx)(Oe,{className:`size-3.5`,"aria-hidden":!0}),i.views.board]}),(0,Y.jsxs)(`button`,{type:`button`,"aria-pressed":C===`graph`,onClick:()=>w(`graph`),className:v(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,C===`graph`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,Y.jsx)(G,{className:`size-3.5`,"aria-hidden":!0}),i.views.graph]})]})]})]}),C===`board`?(0,Y.jsx)(`div`,{className:`min-h-0 w-full min-w-0 flex-1 overflow-x-auto overflow-y-hidden overscroll-x-contain pb-2 [scrollbar-width:thin]`,children:(0,Y.jsx)(`div`,{className:`grid h-full min-h-0 min-w-[103rem] grid-cols-5 gap-3`,children:Kt.map(t=>{let n=mn[t],a=q[t];return(0,Y.jsxs)(`section`,{onDragOver:n=>{let r=e.find(e=>e.id===h);r&&(r.phase===t||Jt(r,t))&&n.preventDefault()},onDrop:e=>{e.preventDefault(),se(t,null)},className:`flex min-h-0 min-w-0 flex-col overflow-hidden rounded-xl bg-surface-muted/60 p-2.5`,children:[(0,Y.jsxs)(`header`,{className:`mb-2.5 flex shrink-0 items-center justify-between gap-2 px-1`,children:[(0,Y.jsxs)(`div`,{className:v(`flex items-center gap-2`,hn[t]),children:[(0,Y.jsx)(n,{className:`size-4`,"aria-hidden":!0}),(0,Y.jsx)(`h3`,{className:`text-sm font-semibold`,children:i.phases[t]})]}),(0,Y.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-subtle`,children:a.length})]}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-y-contain pr-1 [scrollbar-gutter:stable] [scrollbar-width:thin]`,children:(0,Y.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.length?a.map(e=>(0,Y.jsx)(gn,{task:e,returnTo:r,copy:i,busy:d===e.id,onAction:oe,onDragStart:g,onDropBefore:e=>void se(t,e)},e.id)):(0,Y.jsx)(`p`,{className:`rounded-lg border border-dashed border-edge px-3 py-5 text-center text-xs text-fg-subtle`,children:i.empty})})})]},t)})})}):(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Y.jsx)(rn,{tasks:e,dependencyEdges:t,returnTo:r,copy:{...i.graph,phases:i.phases},onDependenciesChange:c})}),(0,Y.jsx)(M,{open:E,onOpenChange:e=>{U||P(e)},children:(0,Y.jsxs)(k,{children:[(0,Y.jsx)(T,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(A,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(40rem,calc(100vh-2rem))] w-[min(38rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(j,{className:`text-base font-semibold text-fg`,children:i.createTitle}),(0,Y.jsx)(D,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:i.createDescription})]}),(0,Y.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>void ce(e),children:[(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsx)(`label`,{htmlFor:`project-task-objective`,className:`font-medium text-fg-muted`,children:i.objective}),(0,Y.jsxs)(`div`,{className:v(`overflow-hidden rounded-lg border border-edge bg-surface-base transition-colors focus-within:border-accent`,K.isDragging&&`border-accent bg-accent-soft/30`),onDragOver:e=>{e.preventDefault(),U||K.setIsDragging(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||K.setIsDragging(!1)},onDrop:e=>{e.preventDefault(),K.setIsDragging(!1),U||K.processFiles(Array.from(e.dataTransfer.files))},children:[(0,Y.jsx)(`textarea`,{id:`project-task-objective`,autoFocus:!0,className:`min-h-28 w-full resize-y bg-transparent px-3 py-3 text-sm leading-6 text-fg outline-none placeholder:text-fg-subtle`,value:te,onChange:e=>{I(e.target.value),re(null)},placeholder:i.objectivePlaceholder,maxLength:12e3,disabled:U}),(0,Y.jsx)(Be,{attachments:K.attachments,topPadded:!1,onRemove:e=>{U||K.removeAttachment(e)}}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-t border-edge-subtle px-2.5 py-2`,children:[(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:U,onClick:()=>K.fileInputRef.current?.click(),children:[(0,Y.jsx)(N,{className:`size-3.5`,"aria-hidden":!0}),i.addFiles]}),(0,Y.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:i.attachmentsDescription}),(0,Y.jsx)(`input`,{ref:K.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{K.processFiles(Array.from(e.target.files??[])),e.currentTarget.value=``}})]})]})]}),(0,Y.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Y.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:i.priority}),(0,Y.jsx)(f,{value:L,onChange:e=>R(e.target.value),disabled:U,children:[`low`,`normal`,`high`,`critical`].map(e=>(0,Y.jsx)(m,{value:e,children:i.priorityOptions[e]},e))})]}),(0,Y.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[i.dueDate,` `,(0,Y.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:i.optional})]}),(0,Y.jsx)(Et,{className:`min-h-10 bg-surface-base`,value:z,onChange:B,disabled:U,ariaLabel:i.dueDate})]})]}),(0,Y.jsxs)(`fieldset`,{className:`grid gap-2`,children:[(0,Y.jsxs)(`legend`,{className:`text-sm font-medium text-fg-muted`,children:[i.dependencies,` `,(0,Y.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:i.optional})]}),(0,Y.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:i.dependenciesDescription}),(0,Y.jsx)(At,{candidates:ae,selectedIds:V,disabled:U,onChange:H,labels:{link:i.linkDependencies,linked:i.linkedDependencies,searchPlaceholder:i.dependencySearchPlaceholder,noMatches:i.noDependencyMatches,noCandidates:i.noDependencyCandidates,remove:i.removeDependency}})]}),ne?(0,Y.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:ne}):null]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(O,{asChild:!0,children:(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:U,children:i.cancel})}),(0,Y.jsx)(y,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:U||!te.trim(),children:U?i.creating:i.create})]})]})]})]})}),_?(0,Y.jsxs)(`div`,{role:`status`,className:`fixed bottom-5 left-1/2 z-50 flex -translate-x-1/2 items-center gap-4 rounded-lg border border-edge bg-surface-panel px-4 py-3 text-sm text-fg shadow-float`,children:[(0,Y.jsx)(`span`,{children:i.moved}),(0,Y.jsx)(`button`,{type:`button`,className:`font-medium text-accent-fg hover:underline`,onClick:()=>{let e=_;b(null),s(e.taskId,e.phase,e.beforeTaskId).then(t=>{t||b(e)})},children:i.undo})]}):null]})}var bn=new Set([{id:`overview`,icon:z},{id:`tasks`,icon:rt},{id:`automations`,icon:ae},{id:`files`,icon:Ne},{id:`notes`,icon:Fe},{id:`skills`,icon:De},{id:`sessions`,icon:pt},{id:`progress`,icon:re},{id:`settings`,icon:tt}].map(e=>e.id)),xn=`xopc.projectFiles.panelWidthPx`,Sn=320,Cn=220,wn=560;function Tn(e,t){return e.name!==t.name||e.description!==(t.description??``)||e.status!==t.status||e.defaultAgentId!==(t.defaultAgentId??``)||e.brief!==(t.brief??``)||e.instructions!==(t.instructions??``)}function En(e){return Math.min(wn,Math.max(Cn,Math.round(e)))}function Dn(){try{let e=window.localStorage.getItem(xn);if(e==null)return Sn;let t=Number.parseInt(e,10);return Number.isFinite(t)?En(t):Sn}catch{return Sn}}function On(e){try{window.localStorage.setItem(xn,String(En(e)))}catch{}}function kn(e){return!!(e&&bn.has(e))}function An(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function jn(e,t=``){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?String(e):Ve(n)}function Mn(e){return e===`active`?`bg-accent-soft text-accent-fg`:e===`done`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`paused`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`archived`?`bg-surface-muted text-fg-subtle`:`bg-surface-hover text-fg-muted`}function Nn(e){let t=(0,Lt.c)(8),{label:n,hint:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=r?(0,Y.jsx)(`span`,{className:`text-xs leading-5 text-fg-subtle`,children:r}):null,t[2]=r,t[3]=o);let s;return t[4]!==i||t[5]!==a||t[6]!==o?(s=(0,Y.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[a,i,o]}),t[4]=i,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function Pn(e=!1){return v(`w-full rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,e?`min-h-24 py-2 leading-5`:`min-h-10`)}function Fn(e){let t=(0,Lt.c)(10),{label:n,value:r,mono:i}=e,a=i===void 0?!1:i,o;t[0]===n?o=t[1]:(o=(0,Y.jsx)(`div`,{className:`text-xs font-medium text-fg-subtle`,children:n}),t[0]=n,t[1]=o);let s=a&&`font-mono text-xs`,c;t[2]===s?c=t[3]:(c=v(`mt-1 min-w-0 truncate text-sm text-fg`,s),t[2]=s,t[3]=c);let l;t[4]!==c||t[5]!==r?(l=(0,Y.jsx)(`div`,{className:c,title:r,children:r}),t[4]=c,t[5]=r,t[6]=l):l=t[6];let u;return t[7]!==o||t[8]!==l?(u=(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-md bg-surface-base px-3 py-2`,children:[o,l]}),t[7]=o,t[8]=l,t[9]=u):u=t[9],u}function In(e){return[e.name,e.slug,e.workspaceRoot,e.description,e.brief].filter(Boolean).join(` `).toLowerCase()}function Ln(e){let t=e.lastActiveAt??e.updatedAt??e.createdAt,n=t?new Date(t).getTime():0;return Number.isFinite(n)?n:0}function Rn(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function zn(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function Bn(e){let t=e.actor;return t.name?t.name:t.agentId?t.agentId:t.id?t.id:t.sessionKey?t.sessionKey:t.kind}function Vn(e){return e.primaryObject.title?.trim()||e.primaryObject.id}function Hn(e){let t=e.source;return t.toolCallId?`${t.kind} · ${t.toolCallId}`:t.runId?`${t.kind} · ${t.runId}`:t.requestId?`${t.kind} · ${t.requestId}`:t.kind}function Un(e){let t=e.sourceChannel?.trim();if(t)return Wn(t);let n=e.key.split(`:`).filter(Boolean),r=(n[0]?.toLowerCase()===`agent`?n.slice(2).join(`:`):e.key).split(`:`)[0]?.split(/[-_]/)[0]?.trim();return Wn(r||``)}function Wn(e){let t=e.trim().toLowerCase();return t?t===`tui`?`TUI`:t===`acp`?`ACP`:t===`webchat`?`Webchat`:t:``}function Gn(e){let t=e.payload.changes;if(Array.isArray(t)&&t.length)return t.filter(e=>typeof e==`string`).join(`, `);let n=e.payload.contentPreview;if(typeof n==`string`&&n.trim())return n.trim();let r=e.payload.title??e.payload.name;return typeof r==`string`&&r.trim()?r.trim():``}function Kn(e){return e.map(e=>({name:e.name,path:e.path,absolutePath:e.absolutePath,isDirectory:e.type===`directory`,children:e.type===`directory`?[]:void 0}))}function qn(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:qn(e.children,t,n)}:e)}function Jn({currentProject:e,pm:t,projectsText:n,wd:r}){let i=o(),[a,s]=(0,J.useState)(!1),[d,f]=(0,J.useState)([e]),[m,g]=(0,J.useState)(``),[_,b]=(0,J.useState)(!1),[x,S]=(0,J.useState)(null),[C,w]=(0,J.useState)(!1),[E,N]=(0,J.useState)(`new`),[P,F]=(0,J.useState)(``),[te,I]=(0,J.useState)(``),[L,R]=(0,J.useState)(!1),[z,B]=(0,J.useState)(null),[V,H]=(0,J.useState)(null),U=(0,J.useCallback)(async()=>{b(!0),S(null);try{let t=await He({limit:100});f(n=>{let r=new Map;r.set(e.id,e);for(let e of n)r.set(e.id,e);for(let e of t.items)r.set(e.id,e);return Array.from(r.values())})}catch(e){S(e instanceof Error?e.message:String(e))}finally{b(!1)}},[e]);(0,J.useEffect)(()=>{f(t=>[e,...t.filter(t=>t.id!==e.id)])},[e]),(0,J.useEffect)(()=>{a&&U()},[U,a]);let W=(0,J.useMemo)(()=>{let t=m.trim().toLowerCase().split(/\s+/).filter(Boolean);return d.filter(t=>t.id!==e.id).filter(e=>{if(t.length===0)return!0;let n=In(e);return t.every(e=>n.includes(e))}).sort((e,t)=>Ln(t)-Ln(e))},[e.id,d,m]),G=e=>t.statuses[e.status]??e.status,re=e=>e.workspaceRoot||e.effectiveWorkspaceRoot||e.description||e.brief||t.common.defaultWorkspace,K=e=>{N(e),F(``),I(``),B(null),w(!0),s(!1)},q=(0,J.useCallback)(async(e={})=>{let t=te.trim(),n=P.trim()||(E===`directory`?Rn(t):``);if(n){R(!0),B(null),H(null);try{let r=await qe({name:n,...t?{workspaceRoot:t}:{},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});w(!1),F(``),I(``),f(e=>[r,...e.filter(e=>e.id!==r.id)]),i(`/projects/${encodeURIComponent(r.id)}`)}catch(e){let t=zn(e);t?(H(t),w(!1)):B(e instanceof Error?e.message:String(e))}finally{R(!1)}}},[E,P,i,te]),ie=(0,J.useCallback)(e=>{e.preventDefault(),q()},[q]),ae=(0,J.useCallback)(()=>{q({createWorkspaceRoot:!0})},[q]),oe=(0,J.useCallback)(()=>{H(null),w(!0)},[]),se=e=>{I(e),E===`directory`&&!P.trim()&&F(Rn(e))},ce=(e,t)=>(0,Y.jsxs)(`button`,{type:`button`,className:v(`grid w-full grid-cols-[1rem_minmax(0,1fr)_auto] items-center gap-2 rounded-md p-2 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,t&&`bg-accent-soft/55 hover:bg-accent-soft/70`),onClick:()=>{s(!1),t||i(`/projects/${encodeURIComponent(e.id)}`)},children:[(0,Y.jsx)(c,{className:v(`size-4 text-accent-fg`,!t&&`invisible`),"aria-hidden":!0}),(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.name}),(0,Y.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:re(e)})]}),(0,Y.jsx)(`span`,{className:v(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,Mn(e.status)),children:G(e)})]},e.id);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(u,{open:a,onOpenChange:s,children:[(0,Y.jsx)(p,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,className:`group flex max-w-full min-w-0 items-center gap-2 rounded-lg px-2 py-1 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":t.projectSwitcher.switchProject,title:t.projectSwitcher.switchProject,children:[(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:e.name}),(0,Y.jsx)(`span`,{className:v(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,Mn(e.status)),children:G(e)})]}),(0,Y.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:re(e)})]}),(0,Y.jsx)(ee,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":!0})]})}),(0,Y.jsx)(l,{children:(0,Y.jsxs)(h,{side:`bottom`,align:`start`,sideOffset:6,className:`z-[70] w-[min(26rem,calc(100vw-2rem))] overflow-hidden rounded-xl border border-edge bg-surface-panel p-1.5 shadow-popover outline-none`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Y.jsxs)(`label`,{className:`relative block`,children:[(0,Y.jsx)(be,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`input`,{type:`search`,className:`h-9 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:m,onChange:e=>g(e.target.value),placeholder:t.projectSwitcher.searchPlaceholder,"aria-label":t.projectSwitcher.searchPlaceholder})]}),(0,Y.jsxs)(`div`,{className:`mt-1 max-h-[min(54vh,24rem)] overflow-y-auto pr-0.5 [scrollbar-gutter:stable]`,children:[(0,Y.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.current}),ce(e,!0),(0,Y.jsx)(`div`,{className:`px-2 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.recent}),x?(0,Y.jsx)(`div`,{className:`p-2 text-xs text-red-600 dark:text-red-400`,children:x}):null,_&&W.length===0?(0,Y.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.loading}):null,!_&&W.length===0?(0,Y.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.noMatches}):null,W.map(e=>ce(e,!1))]}),(0,Y.jsxs)(`div`,{className:`mt-1 border-t border-edge-subtle pt-1`,children:[(0,Y.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>K(`new`),children:[(0,Y.jsx)(Pe,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.newProject})]}),(0,Y.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>K(`directory`),children:[(0,Y.jsx)(Ne,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.openDirectory})]}),(0,Y.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>{s(!1),i(`/projects`)},children:[(0,Y.jsx)(tt,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.manageProjects})]})]})]})})]}),(0,Y.jsx)(M,{open:C,onOpenChange:e=>!L&&w(e),children:(0,Y.jsxs)(k,{children:[(0,Y.jsx)(T,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(A,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(32rem,calc(100vh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(j,{className:`text-base font-semibold text-fg`,children:E===`directory`?t.projectSwitcher.createFromDirectoryTitle:n.createTitle}),(0,Y.jsx)(D,{className:`mt-1 text-sm text-fg-muted`,children:E===`directory`?t.projectSwitcher.createFromDirectoryDescription:n.createDescription})]}),(0,Y.jsxs)(`form`,{onSubmit:ie,className:`flex min-h-0 flex-1 flex-col`,children:[(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[z?(0,Y.jsx)(`div`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:z}):null,(0,Y.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.projectName}),(0,Y.jsx)(`input`,{className:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:P,onChange:e=>F(e.target.value),placeholder:`xopc`})]}),(0,Y.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.workspaceRoot}),(0,Y.jsx)(Tt,{value:te,onChange:se,disabled:L,wd:r,placeholder:n.workspacePlaceholder,inputClassName:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`}),(0,Y.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.workspaceHint})]})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(O,{asChild:!0,children:(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:L,children:n.cancel})}),(0,Y.jsxs)(y,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:L||!(P.trim()||E===`directory`&&Rn(te)),children:[(0,Y.jsx)(Pe,{className:`size-4`,"aria-hidden":!0}),n.create]})]})]})]})]})}),(0,Y.jsx)(M,{open:!!V,onOpenChange:e=>{e||H(null)},children:(0,Y.jsxs)(k,{children:[(0,Y.jsx)(T,{className:`fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(A,{className:`fixed left-1/2 top-1/2 z-[110] flex w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(j,{className:`text-base font-semibold text-fg`,children:n.workspaceMissingTitle}),(0,Y.jsx)(D,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:V?An(n.workspaceMissingDescription,{workspace:V}):null})]}),V?(0,Y.jsx)(`div`,{className:`px-5 py-4`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,Y.jsx)(Ne,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:V})]})}):null,(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:oe,disabled:L,children:n.workspaceMissingBack}),(0,Y.jsxs)(y,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:ae,disabled:L,children:[(0,Y.jsx)(ne,{className:`size-4`,"aria-hidden":!0}),n.workspaceMissingCreate]})]})]})]})})]})}function X(){let{projectId:e=``,tabId:t,noteId:n}=i(),r=o(),[c]=a(),l=S(e=>e.language),u=x(l),d=u.chat.workingDirectory,p=u.projectDetailPage,h=u.projectsPage,_=Me(e=>e.setPageHeader),C=Me(e=>e.clearPageHeader),[w,E]=(0,J.useState)(null),[N,ee]=(0,J.useState)(null),[I,H]=(0,J.useState)([]),[G,ie]=(0,J.useState)(``),[ge,xe]=(0,J.useState)([]),[Oe,Ae]=(0,J.useState)(!1),[Le,Be]=(0,J.useState)(null),[Ve,He]=(0,J.useState)([]),[Ue,We]=(0,J.useState)(0),[Ke,qe]=(0,J.useState)(!1),[Qe,et]=(0,J.useState)(!1),[lt,_t]=(0,J.useState)(!1),[Et,Dt]=(0,J.useState)([]),Ot=(0,J.useRef)(new Set),[kt,At]=(0,J.useState)(null),[jt,Mt]=(0,J.useState)(Dn),[Nt,Pt]=(0,J.useState)(!1),[Ft,It]=(0,J.useState)(!1),[Lt,Rt]=(0,J.useState)(``),[zt,Bt]=(0,J.useState)([]),[Vt,Ht]=(0,J.useState)(!1),[Ut,Gt]=(0,J.useState)(null),[Kt,qt]=(0,J.useState)(!1),[Jt,Yt]=(0,J.useState)(null),[Xt,Zt]=(0,J.useState)([]),[Qt,$t]=(0,J.useState)(``),[en,tn]=(0,J.useState)(!0),[nn,rn]=(0,J.useState)(!1),[an,on]=(0,J.useState)(!1),[sn,cn]=(0,J.useState)(null),[ln,un]=(0,J.useState)(!1),[dn,fn]=(0,J.useState)(`fixed`),[pn,mn]=(0,J.useState)(``),[hn,gn]=(0,J.useState)(null),[_n,vn]=(0,J.useState)(!1),[bn,xn]=(0,J.useState)(!1),[Sn,Cn]=(0,J.useState)(!1),[wn,In]=(0,J.useState)(null),Ln=(0,J.useRef)(null),Rn=(0,J.useRef)(!1),[Wn,X]=(0,J.useState)(null),[Yn,Xn]=(0,J.useState)({title:``,reason:``}),[Z,Zn]=(0,J.useState)({name:``,description:``,status:`active`,defaultAgentId:``,workspaceRoot:``,brief:``,instructions:``}),Qn=(0,J.useRef)(Z),$n=`overview`,Q=n?`notes`:kn(t)?t:$n,er=(0,J.useMemo)(()=>ke(c.get(`returnTo`),`/projects`,[`/chat`]),[c]),tr=(0,J.useCallback)(t=>{if(!e)return`/projects`;let n=`/projects/${encodeURIComponent(e)}/${t}`;return er===`/projects`?n:B(n,er)},[er,e]),nr=(0,J.useCallback)(t=>{e&&r(tr(t))},[r,e,tr]),rr=(0,J.useCallback)(()=>{if(Q===`tasks`&&Ln.current){Ln.current.openCreate();return}Rn.current=!0,nr(`tasks`)},[nr,Q]);(0,J.useEffect)(()=>{Q!==`tasks`||!Rn.current||(Rn.current=!1,Ln.current?.openCreate())},[Q]);let ir=(0,J.useCallback)(t=>{e&&r(tr(t),{replace:!0})},[r,e,tr]),ar=(0,J.useCallback)((e,t)=>{ir(e),r(t)},[r,ir]),or=(0,J.useCallback)(e=>t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||ir(e)},[ir]),sr=(0,J.useCallback)(e=>e.startsWith(`/chat/`)?`sessions`:e.startsWith(`/notes`)?`notes`:Q,[Q]);(0,J.useEffect)(()=>{!e||!t||kn(t)||r(tr($n),{replace:!0})},[$n,r,e,tr,t]),(0,J.useEffect)(()=>{if(!e)return;let t=!1;return tn(!0),X(null),Promise.all([Ye(e),Ze(e),Xe(e),pe().catch(()=>null)]).then(([e,n,r,i])=>{if(t)return;E(e),ee(n),H(r),Zt(i?.agents??[]),$t(e.defaultAgentId??``);let a={name:e.name,description:e.description??``,status:e.status,defaultAgentId:e.defaultAgentId??``,workspaceRoot:e.workspaceRoot??``,brief:e.brief??``,instructions:e.instructions??``};Qn.current=a,Zn(a)}).catch(e=>{t||X(e instanceof Error?e.message:String(e))}).finally(()=>{t||tn(!1)}),()=>{t=!0}},[e]);let $=(0,J.useCallback)(async()=>{e&&ee(await Ze(e))},[e]);(0,J.useEffect)(()=>{let t,n=n=>{let r=je.safeParse(n.detail);!r.success||r.data.projectId!==e||(window.clearTimeout(t),t=window.setTimeout(()=>void $(),120))};return window.addEventListener(`task-changed-v2`,n),()=>{window.clearTimeout(t),window.removeEventListener(`task-changed-v2`,n)}},[e,$]);let cr=(0,J.useCallback)(async(e,t)=>{In(e.id),X(null);try{let n=await de(e.id),r=t.startsWith(`move_`)?{type:`move`,phase:t.slice(5)}:t.startsWith(`reopen_`)?{type:`reopen`,phase:t.slice(7)}:t===`ready`?{type:`mark_ready`}:t===`run`?{type:`start`,executor:{kind:`agent`,agentId:n.task.delegateAgentId??(await V(e.id)).agentId}}:t===`pause`?{type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}:t===`review`?{type:`request_review`}:t===`complete`?{type:`close`,resolution:`done`}:t===`reopen`?{type:`reopen`,phase:`ready`}:{type:`resolve_wait`,waitId:n.waits[0]?.id??``};if(r.type===`resolve_wait`&&!r.waitId)throw Error(`No active wait to resolve`);return await me(e.id,r,n.task.version),await $(),!0}catch(e){return await $().catch(()=>void 0),X(e instanceof Error?e.message:p.board.actionFailed),!1}finally{In(null)}},[N,p.board.actionFailed,$]),lr=(0,J.useCallback)(async t=>{e&&(X(null),await _e({idempotencyKey:t.requestId,title:t.objective,projectId:e,priority:t.priority,dueAt:t.dueAt,locale:l,contract:{objective:t.objective,expectedOutputs:[],acceptanceCriteria:[],constraints:[],approvalRequired:[],assumptions:[],risks:[],acceptancePolicy:`manual`,outputDestinations:[]},dependencies:t.dependsOnTaskIds,context:t.attachments.map((e,t)=>({targetKind:`file`,targetId:e.uri??e.name??`attachment-${t+1}`,role:`input`,title:e.name,pinned:!0,retrievalPolicy:{},metadata:{mimeType:e.mimeType,size:e.size,data:e.data}})),authorityGrants:[],activation:{mode:`capture`,phase:`backlog`}}),await $())},[l,e,$]),ur=(0,J.useCallback)(async(e,t)=>{In(e),X(null);try{return await W(e,t,(await de(e)).task.version),await $(),!0}catch(e){return await $().catch(()=>void 0),X(e instanceof Error?e.message:p.board.actionFailed),!1}finally{In(null)}},[p.board.actionFailed,$]),dr=(0,J.useCallback)(async(e,t,n)=>{In(e),X(null);try{let r=await de(e);return r.task.phase!==t&&(r=await me(e,r.task.phase===`closed`?{type:`reopen`,phase:t===`closed`?`ready`:t}:t===`closed`?{type:`close`,resolution:`done`}:{type:`move`,phase:t},r.task.version)),await W(e,n,r.task.version),await $(),!0}catch(e){return await $().catch(()=>void 0),X(e instanceof Error?e.message:p.board.actionFailed),!1}finally{In(null)}},[p.board.actionFailed,$]),fr=(0,J.useCallback)(async(e,t)=>{In(e),X(null);try{await ce(e,t,(await de(e)).task.version),await $()}catch(e){await $().catch(()=>void 0),X(e instanceof Error?e.message:p.board.actionFailed)}finally{In(null)}},[p.board.actionFailed,$]),pr=(0,J.useCallback)(async t=>{if(e){X(null);try{await gt(e,t),await $()}catch(e){throw X(e instanceof Error?e.message:p.board.actionFailed),e}}},[p.board.actionFailed,e,$]),mr=(0,J.useCallback)(async()=>{if(w){Ae(!0),X(null);try{xe((await dt.list({projectId:w.id})).automations)}catch(e){X(e instanceof Error?e.message:String(e))}finally{Ae(!1)}}},[w]);(0,J.useEffect)(()=>{Q===`automations`&&mr()},[mr,Q]);let hr=(0,J.useCallback)(async()=>{if(w){qe(!0),X(null);try{let e=await ot(w.id,{includeRelated:Qe,limit:100});He(e.items),We(e.total)}catch(e){X(e instanceof Error?e.message:String(e))}finally{qe(!1)}}},[w,Qe]);(0,J.useEffect)(()=>{Q===`progress`&&hr()},[hr,Q]);let gr=(0,J.useCallback)(async e=>{Be(`toggle:${e.id}`),X(null);try{e.enabled?await dt.pause(e.id):await dt.resume(e.id),await mr()}catch(e){X(e instanceof Error?e.message:String(e))}finally{Be(null)}},[mr]),_r=(0,J.useCallback)(async()=>{if(!w?.effectiveWorkspaceRoot?.trim()){Dt([]),Ot.current.clear(),Yt(null);return}qt(!0),Yt(null),Ot.current.clear();try{Dt(Kn((await at(w.id,``)).entries)),Ot.current.add(``)}catch(e){Dt([]),Ot.current.clear(),Yt(e instanceof Error?e.message:String(e))}finally{qt(!1)}},[w]),vr=(0,J.useCallback)(async e=>{if(!(!w?.effectiveWorkspaceRoot?.trim()||Ot.current.has(e))){Ot.current.add(e),Yt(null);try{let t=await at(w.id,e);Dt(n=>qn(n,e,Kn(t.entries)))}catch(t){Ot.current.delete(e),Yt(t instanceof Error?t.message:String(t))}}},[w]);(0,J.useEffect)(()=>{Q===`files`&&_r()},[_r,Q]);let yr=Lt.trim();(0,J.useEffect)(()=>{if(Q!==`files`||!w||!Ft||!yr){Bt([]),Ht(!1),Gt(null);return}let e=!1;Ht(!0),Gt(null),Bt([]);let t=window.setTimeout(()=>{vt(w.id,yr,50).then(t=>{e||Bt(t)}).catch(t=>{e||Gt(t instanceof Error?t.message:String(t))}).finally(()=>{e||Ht(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[yr,w,Ft,Q]);let br=(0,J.useCallback)(async()=>{if(w){xn(!0),X(null);try{let e=await ft(w.id);ar(`sessions`,`/chat/${encodeURIComponent(e.key)}`)}catch(e){X(e instanceof Error?e.message:String(e))}finally{xn(!1)}}},[ar,w]),xr=(0,J.useCallback)(async()=>{if(!w)return;let[e,t]=await Promise.all([Ye(w.id),Ze(w.id)]);ee(t),E(e)},[w]),Sr=(0,J.useCallback)(async e=>{if(e.preventDefault(),!(!w||!Yn.title.trim())){Cn(!0),X(null);try{await nt(w.id,{title:Yn.title.trim(),reason:Yn.reason.trim()||void 0}),Xn({title:``,reason:``}),await xr()}catch(e){X(e instanceof Error?e.message:String(e))}finally{Cn(!1)}}},[Yn.reason,Yn.title,w,xr]),Cr=(0,J.useMemo)(()=>(0,Y.jsx)(s,{to:er,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":er===`/projects`?p.backToProjects:u.sidebar.back,children:(0,Y.jsx)(ct,{className:`size-4`,"aria-hidden":!0})}),[er,u.sidebar.back,p.backToProjects]),wr=(0,J.useMemo)(()=>w?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(y,{variant:`secondary`,className:`h-9 rounded-lg`,onClick:rr,children:[(0,Y.jsx)(Pe,{className:`size-4`,"aria-hidden":!0}),p.board.create]}),(0,Y.jsxs)(y,{variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>void br(),disabled:bn,children:[(0,Y.jsx)(pt,{className:`size-4`,"aria-hidden":!0}),p.common.newChat]})]}):null,[rr,p.board.create,p.common.newChat,w,br,bn]);(0,J.useLayoutEffect)(()=>(_({startExtra:Cr,main:w?(0,Y.jsx)(Jn,{currentProject:w,pm:p,projectsText:h,wd:d}):(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:p.fallbackTitle}),(0,Y.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:p.fallbackContext})]}),end:wr}),()=>C()),[C,wr,Cr,p,w,h,_,d]);function Tr(e){E(t=>t?{...t,...e}:null),$t(e.defaultAgentId??``),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}async function Er(e=Qn.current){if(!(!w||!Tn(e,w))){X(null),cn(null);try{let t=await L(w.id,{name:e.name.trim(),status:e.status,description:e.description,defaultAgentId:e.defaultAgentId,brief:e.brief,instructions:e.instructions});Tr(t);let n=Qn.current,r={...n,name:n.name===e.name?t.name:n.name,description:n.description===e.description?t.description??``:n.description,status:n.status===e.status?t.status:n.status,defaultAgentId:n.defaultAgentId===e.defaultAgentId?t.defaultAgentId??``:n.defaultAgentId,brief:n.brief===e.brief?t.brief??``:n.brief,instructions:n.instructions===e.instructions?t.instructions??``:n.instructions};Qn.current=r,Zn(r)}catch(e){let t=zn(e);throw t?cn(t):X(e instanceof Error?e.message:String(e)),e}}}function Dr(e){e.preventDefault(),Br.flush()}function Or(e,t=!1){let n={...Qn.current,...e};Qn.current=n,Zn(n),t&&Br.saveNow(n)}let kr=(0,J.useCallback)(()=>{if(!w)return;let e=w.workspaceRoot?.trim()??``;fn(e?`fixed`:`follow`),mn(e||w.effectiveWorkspaceRoot||``),un(!0)},[w]);async function Ar(e={}){if(!w)return;let t=dn===`fixed`?pn.trim():``;if(!(dn===`fixed`&&!t)){rn(!0),X(null),cn(null);try{let n=await L(w.id,{workspaceRoot:t,...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});Tr(n),Or({workspaceRoot:n.workspaceRoot??``}),un(!1),cn(null)}catch(e){let t=zn(e);t?(cn(t),un(!1)):X(e instanceof Error?e.message:String(e))}finally{rn(!1)}}}async function jr(){if(!(!w||hn)){gn(`pin`),X(null);try{Tr(w.pinnedAt?await Ee(w.id):await ht(w.id))}catch(e){X(e instanceof Error?e.message:String(e))}finally{gn(null)}}}async function Mr(){if(!(!w||hn)){gn(`archive`),X(null);try{let e=w.status===`archived`?await yt(w.id):await ut(w.id);Tr(e),Or({status:e.status})}catch(e){X(e instanceof Error?e.message:String(e))}finally{gn(null)}}}async function Nr(){if(w){vn(!0),X(null);try{await Je(w.id),on(!1),r(`/projects`)}catch(e){X(e instanceof Error?e.message:String(e))}finally{vn(!1)}}}async function Pr(){if(!(!w||lt)){_t(!0),X(null);try{await Ge(w.id)}catch(e){X(e instanceof Error?e.message:String(e))}finally{_t(!1)}}}let Fr=(0,J.useCallback)(e=>{At(e)},[]),Ir=(0,J.useCallback)((e,t)=>{t||At(e)},[]),Lr=(0,J.useCallback)(async(e,t,n)=>{let r=w?.id;if(r)switch(e){case`preview`:t.isDirectory||At(t.path);break;case`download`:if(t.isDirectory)return;try{let e=F(t.path);if(he($e(e))!==`text`){let n=await U(t.path,{projectId:r}),i=P(e)??`application/octet-stream`;ye(e,await n.arrayBuffer(),i)}else{let{content:n}=await K(t.path,{projectId:r});Se(e,n)}}catch(e){bt(`warning`,e instanceof Error?e.message:String(e),void 0,{duration:4e3})}break;case`copyPath`:try{await b(t.absolutePath??t.path)&&bt(`success`,u.workspace.pathCopied,void 0,{duration:2500})}catch{bt(`warning`,u.clipboard.copyFailed,void 0,{duration:4e3})}break;case`openDefault`:if(!t.absolutePath||!window.electronAPI?.shell?.openPath)return;await window.electronAPI.shell.openPath(t.absolutePath);break;case`openWith`:if(!t.absolutePath||!window.electronAPI?.shell?.chooseAppAndOpenPath)return;await window.electronAPI.shell.chooseAppAndOpenPath(t.absolutePath);break;case`openWithApp`:if(!t.absolutePath||!n||!window.electronAPI?.shell?.openPathWithApp)return;await window.electronAPI.shell.openPathWithApp(t.absolutePath,n);break;case`revealInFolder`:if(!t.absolutePath||!window.electronAPI?.shell?.showItemInFolder)return;await window.electronAPI.shell.showItemInFolder(t.absolutePath);break;default:break}},[u.clipboard.copyFailed,u.workspace.pathCopied,w?.id]),Rr=(0,J.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;e.preventDefault();let t=e.currentTarget,n=t.closest(`[data-project-files-grid]`);if(!n)return;t.setPointerCapture(e.pointerId),Pt(!0);let r=e.clientX,i=jt,a=e.pointerId,o=0,s=i,c=i,l=()=>{o=0,c=s,n.style.setProperty(`--project-files-panel-width`,`${c}px`)},u=e=>{s=En(i+(e.clientX-r)),o===0&&(o=window.requestAnimationFrame(l))},d=()=>{o!==0&&(window.cancelAnimationFrame(o),l());try{t.releasePointerCapture(a)}catch{}Pt(!1),Mt(c),On(c),window.removeEventListener(`pointermove`,u),window.removeEventListener(`pointerup`,d),window.removeEventListener(`pointercancel`,d)};window.addEventListener(`pointermove`,u),window.addEventListener(`pointerup`,d),window.addEventListener(`pointercancel`,d)},[jt]);(0,J.useEffect)(()=>{Q!==`files`&&At(null)},[e,Q]);let zr=!!(w&&Tn(Z,w)),Br=Ct({value:w?Z:null,dirty:zr,onSave:Er,validate:e=>e.name.trim()?null:p.settings.nameRequired});if(en)return(0,Y.jsx)(`main`,{className:`w-full flex-1 p-3 text-sm text-fg-muted sm:px-5 sm:py-4 xl:px-6`,children:p.loading});if(!w)return(0,Y.jsxs)(`main`,{className:`w-full flex-1 p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,Y.jsxs)(s,{to:er,className:`inline-flex items-center gap-2 text-sm text-accent-fg hover:underline`,children:[(0,Y.jsx)(ct,{className:`size-4`,"aria-hidden":!0}),er===`/projects`?p.backToProjects:u.sidebar.back]}),(0,Y.jsx)(`p`,{className:`mt-6 rounded-lg bg-surface-panel p-4 shadow-surface text-sm text-fg-muted`,children:Wn||p.notFound})]});let Vr=I.slice(0,6),Hr=N?.blockers??[],Ur=N?.tasks.filter(e=>e.phase!==`closed`)??[],Wr=e=>p.statuses[e]??e,Gr=e=>An(p.common.messages,{count:e}),Kr=G.trim().toLowerCase(),qr=Kr?I.filter(e=>{let t=jn(e.updatedAt),n=e.routing?.agentId||e.agentId||p.common.agent,r=e.name?.trim()||p.sessions.fallbackTitle,i=Gr(e.messageCount??0),a=Un(e);return[r,e.key,n,a,t,i].filter(Boolean).join(` `).toLowerCase().includes(Kr)}):I,Jr=I.length>0&&qr.length===0,Yr=Xt.find(e=>e.id===w.defaultAgentId)?.name||w.defaultAgentId||p.settings.globalDefaultAgent,Xr=Xt.find(e=>e.id===Z.defaultAgentId),Zr=w.workspaceRoot?.trim()||``,Qr=w.status===`archived`,$r=!!w.pinnedAt,ei=!Zr,ti=Zr||Xr?.workspace||w.effectiveWorkspaceRoot||p.common.defaultWorkspace,ni=dn===`fixed`?pn.trim()||p.settings.workspacePlaceholder:Xr?.workspace||w.effectiveWorkspaceRoot||p.common.defaultWorkspace,ri=(dn===`fixed`?pn.trim():``)!==Zr&&(dn===`follow`||!!pn.trim()),ii=[{id:`overview`,icon:z,label:p.tabs.overview},{id:`tasks`,icon:rt,label:p.tabs.tasks},{id:`automations`,icon:ae,label:p.tabs.automations},{id:`files`,icon:Ne,label:p.tabs.files},{id:`notes`,icon:Fe,label:p.tabs.notes},{id:`skills`,icon:De,label:p.tabs.skills},{id:`sessions`,icon:pt,label:p.tabs.sessions},{id:`progress`,icon:re,label:p.tabs.progress}];async function ai(){if(!ti)return;let e=await b(ti);bt(e?`success`:`warning`,e?u.workspace.pathCopied:u.clipboard.copyFailed,void 0,{duration:e?2500:4e3})}function oi(){cn(null),un(!0)}return(0,Y.jsxs)(`main`,{className:`flex h-full min-h-0 w-full flex-1 flex-col overflow-hidden p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3`,children:[(0,Y.jsx)(wt,{items:ii,activeTab:Q,onChange:nr,ariaLabel:p.navAria,tabIdPrefix:`project-primary-tab`,className:`min-w-0 flex-1`}),(0,Y.jsxs)(y,{id:`project-primary-tab-settings`,type:`button`,variant:Q===`settings`?`secondary`:`ghost`,className:`h-9 shrink-0 rounded-lg px-3`,"aria-current":Q===`settings`?`page`:void 0,onClick:()=>nr(`settings`),children:[(0,Y.jsx)(tt,{className:`size-4`,"aria-hidden":!0}),p.tabs.settings,zr?(0,Y.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500`,"aria-label":p.settings.unsavedChanges}):null]})]}),Wn?(0,Y.jsx)(`p`,{className:`mt-3 shrink-0 rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:Wn}):null,(0,Y.jsxs)(`div`,{className:v(`mt-3 min-h-0 flex-1`,Q===`overview`?`overflow-y-auto pr-1 [scrollbar-gutter:stable] xl:overflow-hidden xl:pr-0`:Q===`tasks`?`overflow-hidden`:`overflow-y-auto pr-1 [scrollbar-gutter:stable]`),children:[Q===`overview`?(0,Y.jsxs)(`section`,{id:`project-panel-overview`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-overview`,className:`grid min-h-full gap-4 xl:h-full xl:min-h-0 xl:grid-cols-[minmax(0,1fr)_20rem] xl:overflow-hidden`,children:[(0,Y.jsxs)(`div`,{className:`grid min-w-0 content-start gap-4 xl:min-h-0 xl:overflow-y-auto xl:pr-1 xl:[scrollbar-gutter:stable]`,children:[(0,Y.jsx)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.directionTitle}),(0,Y.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:w.outcome||N?.digest.summary||w.description||w.brief||p.overview.directionFallback}),N?.digest.recommendedAction?(0,Y.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm font-medium leading-6 text-fg`,children:An(p.overview.recommendedNext,{action:N.digest.recommendedAction})}):null]}),(0,Y.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:(0,Y.jsxs)(y,{type:`button`,variant:`secondary`,onClick:()=>void Pr(),disabled:lt,children:[(0,Y.jsx)(Ce,{className:`size-4`,"aria-hidden":!0}),lt?p.overview.savingDigest:p.overview.saveDigest]})})]})}),(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,Y.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.nextActions})}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:Ur.length?Ur.map(e=>(0,Y.jsxs)(s,{to:ue(tr(`overview`),e.id),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,Y.jsxs)(`span`,{className:`shrink-0 rounded-full bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:[e.phase,` · `,e.operationalState]})]}),e.attention[0]?(0,Y.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.attention[0].summary}):null]},e.id)):(0,Y.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.overview.noNextActions})})]}),N?.recentResults.length?(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,Y.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.recentResults})}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:N.recentResults.slice(0,5).map(({taskId:e,taskTitle:t,receipt:n})=>(0,Y.jsxs)(s,{to:ue(tr(`overview`),e),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),(0,Y.jsxs)(`span`,{className:`shrink-0 rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:[n.status,` · `,n.verification.status]})]}),(0,Y.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:n.summary})]},n.runId))})]}):null,(0,Y.jsxs)(`div`,{className:`grid min-w-0 gap-4 md:grid-cols-2`,children:[(0,Y.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Y.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.milestones})}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:w.milestones.length?w.milestones.map(e=>(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-4 py-3`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,Y.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:e.status})]},e.id)):(0,Y.jsx)(`p`,{className:`px-4 py-5 text-sm text-fg-muted`,children:p.overview.noMilestones})})]}),(0,Y.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Y.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.projectUpdates})}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:w.recentUpdates.length?w.recentUpdates.slice(0,3).map(e=>(0,Y.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,Y.jsx)(`p`,{className:`text-sm leading-5 text-fg`,children:e.summary}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.health})]},e.id)):(0,Y.jsx)(`p`,{className:`px-4 py-5 text-sm text-fg-muted`,children:p.overview.noProjectUpdates})})]})]})]}),(0,Y.jsxs)(`aside`,{className:`grid min-w-0 content-start gap-4 xl:min-h-0 xl:overflow-y-auto xl:pr-1 xl:[scrollbar-gutter:stable]`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.attention}),Hr.length?(0,Y.jsx)(`div`,{className:`mt-3 grid gap-3`,children:Hr.map(e=>{let t=(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(R,{className:`size-4 text-amber-600 dark:text-amber-300`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title})]}),(0,Y.jsxs)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:[p.overview.attentionKinds[e.kind]??e.kind,e.detail?` · ${e.detail}`:e.status?` · ${Wr(e.status)}`:``]})]});return e.href?(0,Y.jsx)(s,{to:e.href,onClick:or(sr(e.href)),className:`min-w-0 rounded-md bg-surface-base p-3 hover:bg-surface-hover`,children:t},e.id):(0,Y.jsx)(`div`,{className:`min-w-0 rounded-md bg-surface-base p-3`,children:t},e.id)})}):(0,Y.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:p.overview.noBlockedTasks}),(0,Y.jsxs)(`form`,{onSubmit:Sr,className:`mt-4 flex gap-2 border-t border-edge pt-4`,children:[(0,Y.jsx)(`input`,{className:`min-h-9 min-w-0 flex-1 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:Yn.title,onChange:e=>Xn(t=>({...t,title:e.target.value})),placeholder:p.overview.blockerTitlePlaceholder}),(0,Y.jsx)(y,{type:`submit`,variant:`secondary`,className:`shrink-0 rounded-lg px-3`,disabled:Sn||!Yn.title.trim(),"aria-label":Sn?p.overview.addingBlocker:p.overview.addBlocker,title:Sn?p.overview.addingBlocker:p.overview.addBlocker,children:(0,Y.jsx)(Pe,{className:`size-4`,"aria-hidden":!0})})]})]}),(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(st,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:p.overview.recentSessions})]}),(0,Y.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>nr(`sessions`),children:p.common.viewAll})]}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:Vr.length?Vr.map(e=>(0,Y.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:or(`sessions`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.name||e.key}),(0,Y.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:jn(e.updatedAt)})]}),(0,Y.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:e.agentId||p.common.agent})]},e.key)):(0,Y.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.overview.noSessions})})]})]})]}):null,Q===`tasks`?(0,Y.jsx)(yn,{ref:Ln,tasks:N?.tasks??[],dependencyEdges:N?.dependencyEdges??[],monitoring:N?.monitoring??{projectId:e??``,mode:`observe`,allowedActions:[],confidenceThreshold:.75,scenarios:[],configured:!1},returnTo:tr(`tasks`),copy:p.board,onAction:cr,onReorder:ur,onUndoMove:dr,onDependenciesChange:fr,onMonitoringChange:pr,onCreate:lr,actionBusyId:wn}):null,Q===`automations`?(0,Y.jsx)(`section`,{id:`project-panel-automations`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-automations`,className:`grid min-h-full content-start gap-4`,children:(0,Y.jsxs)(`div`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(ae,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.automations.title})]}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.automations.hint})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void mr(),disabled:Oe,children:[(0,Y.jsx)(q,{className:v(`size-4`,Oe&&`animate-spin`),"aria-hidden":!0}),p.common.refresh]}),(0,Y.jsxs)(y,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>ar(`automations`,`/automations?projectId=${encodeURIComponent(w.id)}&action=create`),children:[(0,Y.jsx)(Pe,{className:`size-4`,"aria-hidden":!0}),p.automations.create]})]})]}),Oe&&ge.length===0?(0,Y.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,"aria-busy":!0,children:[(0,Y.jsx)(ve,{className:`h-24 rounded-lg`}),(0,Y.jsx)(ve,{className:`h-24 rounded-lg`})]}):ge.length?(0,Y.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:ge.map(e=>(0,Y.jsxs)(`div`,{className:`grid gap-3 rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`min-w-0 truncate text-left text-sm font-medium text-fg hover:text-accent-fg`,onClick:()=>ar(`automations`,`/automations?automation=${encodeURIComponent(e.id)}`),children:e.name}),(0,Y.jsx)(`span`,{className:v(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,e.enabled?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-surface-hover text-fg-muted`),children:e.enabled?p.automations.enabled:p.automations.paused})]}),(0,Y.jsx)(`p`,{className:`line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description||e.action.kind}),(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 text-xs`,onClick:()=>ar(`automations`,`/automations?automation=${encodeURIComponent(e.id)}`),children:p.common.open}),(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 text-xs`,disabled:Le===`toggle:${e.id}`,onClick:()=>void gr(e),children:[e.enabled?(0,Y.jsx)(we,{className:`size-3.5`,"aria-hidden":!0}):(0,Y.jsx)(le,{className:`size-3.5`,"aria-hidden":!0}),e.enabled?p.automations.pause:p.automations.resume]})]})]},e.id))}):(0,Y.jsx)(`p`,{className:`rounded-lg border border-dashed border-edge px-3 py-4 text-sm text-fg-muted`,children:p.automations.empty})]})}):null,Q===`notes`?(0,Y.jsx)(`section`,{id:`project-panel-notes`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-notes`,className:`flex h-full min-h-[28rem] overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:(0,Y.jsx)(xt,{selectedNoteId:n,basePath:`/projects/${encodeURIComponent(w.id)}/notes`,showLibrary:!1,allowMediaCapture:!1,projectId:w.id,listTitle:p.notes.title,listDescription:p.notes.hint,emptyText:p.notes.emptyTitle,emptyDescription:p.notes.emptyDescription,listWidthStorageKey:`xopc.projectNotes.listWidth.${w.id}`})}):null,Q===`skills`?(0,Y.jsx)(Wt,{projectId:w.id,copy:p.skills}):null,Q===`files`?(0,Y.jsx)(`section`,{id:`project-panel-files`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-files`,className:`flex h-full min-h-[28rem] flex-col`,children:(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:w.effectiveWorkspaceRoot?(0,Y.jsxs)(`div`,{"data-project-files-grid":!0,className:v(`grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[var(--project-files-panel-width)_6px_minmax(0,1fr)]`,Nt&&`cursor-col-resize select-none`),style:{"--project-files-panel-width":`${jt}px`},children:[(0,Y.jsxs)(`aside`,{className:`flex min-h-0 flex-col border-b border-edge lg:border-b-0 lg:border-r`,children:[(0,Y.jsxs)(`div`,{className:`flex h-11 items-center gap-1 border-b border-edge bg-surface-muted/50 px-3 text-sm`,children:[(0,Y.jsx)(mt,{workspacePath:ti}),(0,Y.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,Y.jsx)(`button`,{type:`button`,className:v(`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,Ft&&`bg-surface-hover text-fg`),onClick:()=>It(!0),"aria-label":p.files.search,title:p.files.search,"aria-pressed":Ft,children:(0,Y.jsx)(be,{className:`size-3.5`,"aria-hidden":!0})}),(0,Y.jsx)(Te,{className:`size-7 shrink-0 rounded-md p-0`,loading:Kt,label:u.cron.refresh,onClick:()=>void _r()})]})]}),Ft?(0,Y.jsx)(`div`,{className:`shrink-0 border-b border-edge bg-surface-muted/40 px-3 py-2`,children:(0,Y.jsxs)(`div`,{className:`flex h-8 items-center gap-2 rounded-md border border-edge bg-surface-panel px-2 focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/20`,children:[(0,Y.jsx)(be,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`input`,{type:`text`,role:`searchbox`,value:Lt,onChange:e=>Rt(e.target.value),placeholder:p.files.searchPlaceholder,"aria-label":p.files.searchPlaceholder,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none placeholder:text-fg-subtle`}),(0,Y.jsx)(`button`,{type:`button`,className:`flex size-6 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":p.files.clearSearch,title:p.files.clearSearch,onClick:()=>{Rt(``),It(!1)},children:(0,Y.jsx)(Re,{className:`size-3.5`,"aria-hidden":!0})})]})}):null,Jt?(0,Y.jsx)(`div`,{className:`border-b border-edge bg-red-500/10 px-4 py-3 text-sm text-red-700 dark:text-red-300`,children:Jt}):null,yr?(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-2`,children:Vt?(0,Y.jsxs)(`div`,{className:`space-y-2 px-3 py-1`,children:[(0,Y.jsx)(ve,{className:`h-11 w-full`}),(0,Y.jsx)(ve,{className:`h-11 w-full`}),(0,Y.jsx)(ve,{className:`h-11 w-full`})]}):Ut?(0,Y.jsxs)(`p`,{className:`px-3 py-2 text-xs text-red-600 dark:text-red-400`,children:[u.workspace.loadError,`: `,Ut]}):zt.length===0?(0,Y.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:p.files.noSearchResults}):zt.map(e=>(0,Y.jsxs)(`button`,{type:`button`,className:v(`flex w-full min-w-0 items-center gap-2 px-3 py-2 text-left hover:bg-surface-hover`,kt===e.path&&`bg-accent-soft text-accent-fg`),onClick:()=>At(e.path),title:e.path,children:[(0,Y.jsx)(Fe,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`span`,{className:`block truncate text-sm text-fg`,children:e.name}),(0,Y.jsx)(`span`,{className:`block truncate text-xs text-fg-subtle`,children:e.path})]})]},e.path))}):Kt&&Et.length===0?(0,Y.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.files.loading}):(0,Y.jsx)(fe,{tree:Et,selectedPath:kt,onSelectFile:Fr,onSelectEntry:Ir,onExpandDir:e=>void vr(e),onAction:Lr,actionLabels:{preview:u.workspace.preview,download:u.workspace.download,copyPath:u.workspace.copyPath,openDefault:u.workspace.openSystemApp,openWith:u.workspace.openWith,revealInFolder:u.workspace.revealInFolder,recommendedApps:u.workspace.recommendedApps},emptyHint:p.files.emptyDirectory})]}),(0,Y.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":p.files.resizeHandle,className:v(`hidden cursor-col-resize touch-none items-stretch justify-center bg-surface-panel transition-colors hover:bg-surface-hover lg:flex`,Nt&&`bg-surface-hover`),onPointerDown:Rr,children:(0,Y.jsx)(`div`,{className:`my-3 w-px rounded-full bg-edge-strong/70`})}),(0,Y.jsx)(`div`,{className:`min-h-0 min-w-0 overflow-hidden bg-surface-base`,children:kt?(0,Y.jsx)(se,{filePath:kt,projectId:w.id,agentId:w.defaultAgentId||Qt||void 0,onClose:()=>At(null)}):(0,Y.jsx)(`div`,{className:`flex h-full min-h-[18rem] items-center justify-center px-6 text-center`,children:(0,Y.jsxs)(`div`,{className:`max-w-sm`,children:[(0,Y.jsx)(Ne,{className:`mx-auto size-8 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:p.files.previewEmptyTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.files.previewEmptyDescription})]})})})]}):(0,Y.jsxs)(`div`,{className:`grid gap-3 px-4 py-8 text-sm text-fg-muted`,children:[(0,Y.jsx)(`p`,{children:p.files.needWorkspace}),(0,Y.jsx)(`div`,{children:(0,Y.jsx)(y,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>nr(`settings`),children:p.files.openSettings})})]})})}):null,Q===`sessions`?(0,Y.jsxs)(`section`,{id:`project-panel-sessions`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-sessions`,className:`grid min-h-full content-start gap-3`,children:[I.length?(0,Y.jsxs)(`label`,{className:`relative flex min-h-9 w-full max-w-lg cursor-text items-center rounded-lg bg-surface-panel py-1.5 pl-9 pr-9 shadow-surface`,children:[(0,Y.jsx)(be,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,"aria-hidden":!0}),(0,Y.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:G,onChange:e=>ie(e.currentTarget.value),placeholder:p.sessions.searchPlaceholder,"aria-label":p.sessions.searchPlaceholder,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent py-0.5 text-sm leading-normal text-fg caret-current placeholder:text-fg-disabled focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 focus-visible:outline-none`}),G?(0,Y.jsx)(`button`,{type:`button`,className:`absolute right-2 top-1/2 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":p.sessions.clearSearch,onClick:()=>ie(``),children:(0,Y.jsx)(Re,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,qr.length?(0,Y.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:qr.map(e=>{let t=jn(e.updatedAt),n=e.routing?.agentId||e.agentId||p.common.agent,r=Un(e),i=e.name?.trim()||p.sessions.fallbackTitle,a=Gr(e.messageCount??0);return(0,Y.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:or(`sessions`),className:`group flex min-h-[8.75rem] min-w-0 flex-col rounded-lg bg-surface-panel p-4 shadow-surface transition-colors hover:bg-surface-hover/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Y.jsx)(`span`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-base text-fg-muted`,children:(0,Y.jsx)(pt,{className:`size-4`,"aria-hidden":!0})}),(0,Y.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-fg`,children:i}),r?(0,Y.jsx)(`span`,{className:`shrink-0 rounded-md bg-surface-base px-2 py-0.5 text-[11px] font-medium leading-5 text-fg-muted`,children:r}):null]})})]}),(0,Y.jsxs)(`div`,{className:`mt-auto grid gap-2 pt-4 text-xs text-fg-muted`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(`span`,{className:`min-w-0 max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[p.sessions.agent,`: `,n]}),(0,Y.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:a})]}),t?(0,Y.jsxs)(`span`,{className:`truncate rounded-md bg-surface-base px-2 py-1`,children:[p.sessions.updated,`: `,t]}):null]})]},e.key)})}):Jr?(0,Y.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:p.sessions.noMatches})}):(0,Y.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:p.sessions.emptyTitle}),(0,Y.jsx)(`p`,{className:`mx-auto mt-1 max-w-md text-sm leading-6 text-fg-muted`,children:p.sessions.emptyDescription})]})})]}):null,Q===`progress`?(0,Y.jsxs)(`section`,{id:`project-panel-progress`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-progress`,className:`grid min-h-full content-start gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.progress.title}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:An(p.progress.count,{count:Ue})})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(`label`,{className:`inline-flex min-h-9 items-center gap-2 rounded-lg bg-surface-panel px-3 text-sm text-fg-muted shadow-surface`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:Qe,onChange:e=>et(e.currentTarget.checked),className:`size-4 rounded border-edge text-accent focus:ring-accent/30`}),p.progress.includeRelated]}),(0,Y.jsxs)(y,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3`,onClick:()=>void hr(),disabled:Ke,children:[(0,Y.jsx)(q,{className:v(`size-4`,Ke&&`animate-spin`),"aria-hidden":!0}),p.common.refresh]})]})]}),(0,Y.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:Ke&&Ve.length===0?(0,Y.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:p.progress.loading}):Ve.length?(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:Ve.map(e=>{let t=p.progress.types[e.type]??e.type,n=p.progress.objectKinds[e.primaryObject.kind]??e.primaryObject.kind,r=Gn(e),i=e.relatedProjects.length>0&&!e.scopes.some(e=>e.scopeKind===`project`&&e.scopeId===w.id);return(0,Y.jsxs)(`article`,{className:`grid gap-2 px-4 py-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),i?(0,Y.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:p.progress.related}):null]}),(0,Y.jsxs)(`p`,{className:`mt-1 min-w-0 truncate text-sm text-fg-muted`,children:[n,`: `,Vn(e)]})]}),(0,Y.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,dateTime:new Date(e.createdAt).toISOString(),children:jn(e.createdAt)})]}),r?(0,Y.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:r}):null,(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,Y.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:[p.progress.actor,`: `,Bn(e)]}),(0,Y.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[p.progress.source,`: `,Hn(e)]})]})]},e.id)})}):(0,Y.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:p.progress.empty})})]}):null,Q===`settings`?(0,Y.jsxs)(`form`,{id:`project-panel-settings`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-settings`,onSubmit:Dr,onBlurCapture:Br.onBlurCapture,className:`grid min-h-full content-start gap-4 pb-1`,children:[(0,Y.jsxs)(`section`,{className:`flex min-w-0 items-start justify-between gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.summaryTitle}),(0,Y.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:p.settings.summaryHint})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-2`,children:[(0,Y.jsx)(`span`,{className:v(`rounded-full px-2 py-0.5 text-xs font-medium`,Mn(Z.status)),children:p.settings.statuses[Z.status]}),(0,Y.jsx)(St,{status:Br.status,error:Br.error})]})]}),(0,Y.jsxs)(`div`,{className:`grid items-start gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-4`,children:[(0,Y.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.detailsTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.detailsHint})]}),(0,Y.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,Y.jsx)(Nn,{label:p.settings.name,children:(0,Y.jsx)(`input`,{className:Pn(),value:Z.name,onChange:e=>Or({name:e.target.value})})}),(0,Y.jsx)(Nn,{label:p.settings.defaultAgent,children:(0,Y.jsxs)(f,{className:Pn(),value:Z.defaultAgentId,onChange:e=>Or({defaultAgentId:e.target.value},!0),children:[(0,Y.jsx)(m,{value:``,children:p.settings.globalDefaultAgent}),Xt.map(e=>(0,Y.jsx)(m,{value:e.id,children:te(e,u.agentsSettings)},e.id))]})}),(0,Y.jsx)(Nn,{label:p.settings.status,children:Qr?(0,Y.jsx)(`div`,{className:`grid min-h-10 content-center rounded-md border border-edge bg-surface-muted px-3 text-sm text-fg-muted`,children:p.settings.statuses.archived}):(0,Y.jsxs)(f,{className:Pn(),value:Z.status===`archived`?`active`:Z.status,onChange:e=>Or({status:e.target.value},!0),children:[(0,Y.jsx)(m,{value:`active`,children:p.settings.statuses.active}),(0,Y.jsx)(m,{value:`paused`,children:p.settings.statuses.paused})]})}),(0,Y.jsx)(Nn,{label:p.settings.description,hint:p.settings.descriptionHint,children:(0,Y.jsx)(`textarea`,{className:Pn(!0),value:Z.description,onChange:e=>Or({description:e.target.value})})})]})]}),(0,Y.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.projectGuidanceTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.projectGuidanceHint})]}),(0,Y.jsx)(Nn,{label:p.settings.brief,hint:p.settings.briefHint,children:(0,Y.jsx)(`textarea`,{className:Pn(!0),value:Z.brief,onChange:e=>Or({brief:e.target.value})})}),(0,Y.jsx)(Nn,{label:p.settings.instructions,hint:p.settings.instructionsHint,children:(0,Y.jsx)(`textarea`,{className:Pn(!0),value:Z.instructions,onChange:e=>Or({instructions:e.target.value})})})]})]}),(0,Y.jsxs)(`aside`,{className:`grid gap-4 xl:sticky xl:top-0`,children:[(0,Y.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.workspaceRoot}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceIndependentHint})]}),(0,Y.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Y.jsx)(`span`,{className:`w-fit rounded-md bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:ei?p.settings.workspaceModeFollow:p.settings.workspaceModeFixed}),(0,Y.jsx)(`div`,{className:`break-all font-mono text-xs leading-5 text-fg`,title:ti,children:ti}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void ai(),children:[(0,Y.jsx)(g,{className:`size-4`,"aria-hidden":!0}),p.settings.copyWorkspacePath]}),(0,Y.jsx)(mt,{workspacePath:ti}),(0,Y.jsxs)(y,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:kr,children:[(0,Y.jsx)(ne,{className:`size-4`,"aria-hidden":!0}),p.settings.migrateWorkspace]})]})]})]}),(0,Y.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.currentProjectTitle}),(0,Y.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Y.jsx)(Fn,{label:p.settings.defaultAgent,value:Yr}),(0,Y.jsx)(Fn,{label:p.settings.pinState,value:$r?p.settings.pinned:p.settings.notPinned}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,Y.jsx)(Fn,{label:p.settings.createdAt,value:jn(w.createdAt)||p.common.never}),(0,Y.jsx)(Fn,{label:p.settings.updatedAt,value:jn(w.updatedAt)||p.common.never})]})]})]}),(0,Y.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.managementTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:p.settings.managementHint})]}),(0,Y.jsxs)(`div`,{className:`grid gap-3`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:$r?p.settings.pinnedTitle:p.settings.pinTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:p.settings.pinHint})]}),(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`w-fit rounded-lg`,disabled:hn===`pin`,onClick:()=>void jr(),children:[$r?(0,Y.jsx)(oe,{className:`size-4`,"aria-hidden":!0}):(0,Y.jsx)(ze,{className:`size-4`,"aria-hidden":!0}),$r?p.settings.unpinProject:p.settings.pinProject]})]}),(0,Y.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Qr?p.settings.restoreTitle:p.settings.archiveTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:Qr?p.settings.restoreHint:p.settings.archiveHint})]}),(0,Y.jsxs)(y,{type:`button`,variant:Qr?`primary`:`ghost`,className:`w-fit rounded-lg`,disabled:hn===`archive`,onClick:()=>void Mr(),children:[Qr?(0,Y.jsx)(q,{className:`size-4`,"aria-hidden":!0}):(0,Y.jsx)(Ie,{className:`size-4`,"aria-hidden":!0}),Qr?p.settings.restoreProject:p.settings.archiveProject]})]})]})]}),(0,Y.jsxs)(`section`,{className:`grid gap-3 rounded-lg border border-red-500/20 bg-red-500/5 p-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-red-700 dark:text-red-300`,children:p.settings.dangerTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-red-700/80 dark:text-red-200/80`,children:p.settings.dangerHint})]}),(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`w-fit text-red-600 hover:bg-red-500/10 hover:text-red-700 focus-visible:ring-red-500 dark:text-red-400 dark:hover:text-red-300`,onClick:()=>on(!0),children:[(0,Y.jsx)(it,{className:`size-4`,"aria-hidden":!0}),p.settings.deleteConfirmAction]})]})]})]})]}):null]}),(0,Y.jsx)(M,{open:an,onOpenChange:e=>{_n||on(e)},children:(0,Y.jsxs)(k,{children:[(0,Y.jsx)(T,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(A,{className:`fixed left-1/2 top-1/2 z-[90] w-[min(28rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-5 shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Y.jsx)(`span`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-red-500/10 text-red-600 dark:text-red-400`,children:(0,Y.jsx)(R,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(j,{className:`text-base font-semibold text-fg`,children:p.settings.deleteConfirmTitle}),(0,Y.jsx)(D,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:w?An(p.settings.deleteConfirm,{name:w.name}):p.settings.deleteConfirmFallback})]})]}),(0,Y.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,Y.jsx)(O,{asChild:!0,children:(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:_n,children:p.common.cancel})}),(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`rounded-lg text-red-600 hover:bg-red-500/10 hover:text-red-700 focus-visible:ring-red-500 dark:text-red-400 dark:hover:text-red-300`,disabled:_n||!w,onClick:()=>void Nr(),children:[(0,Y.jsx)(it,{className:`size-4`,"aria-hidden":!0}),p.settings.deleteConfirmAction]})]})]})]})}),(0,Y.jsx)(M,{open:ln,onOpenChange:e=>{nn||un(e)},children:(0,Y.jsxs)(k,{children:[(0,Y.jsx)(T,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(A,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(34rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(j,{className:`text-base font-semibold text-fg`,children:p.settings.workspaceMigrationTitle}),(0,Y.jsx)(D,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.workspaceMigrationDescription})]}),(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:p.settings.workspaceMode}),(0,Y.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[(0,Y.jsxs)(`label`,{className:v(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,dn===`fixed`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,Y.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:dn===`fixed`,onChange:()=>fn(`fixed`),disabled:nn}),(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`span`,{className:`block font-medium`,children:p.settings.workspaceModeFixed}),(0,Y.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceMigrationFixedHint})]})]}),(0,Y.jsxs)(`label`,{className:v(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,dn===`follow`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,Y.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:dn===`follow`,onChange:()=>fn(`follow`),disabled:nn}),(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`span`,{className:`block font-medium`,children:p.settings.workspaceModeFollow}),(0,Y.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceHint})]})]})]})]}),dn===`fixed`?(0,Y.jsx)(Tt,{value:pn,onChange:mn,disabled:nn,wd:d,placeholder:p.settings.workspacePlaceholder,inputClassName:Pn(),autoFocus:!0}):null,(0,Y.jsx)(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm leading-6 text-amber-800 dark:text-amber-200`,children:p.settings.workspaceMigrationImpact}),(0,Y.jsx)(`div`,{className:`rounded-lg bg-surface-muted px-3 py-2 text-xs leading-5 text-fg-subtle`,children:An(p.settings.workspaceCurrent,{workspace:ni})})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(O,{asChild:!0,children:(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:nn,children:p.common.cancel})}),(0,Y.jsxs)(y,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:nn||!ri,onClick:()=>void Ar(),children:[(0,Y.jsx)(ne,{className:`size-4`,"aria-hidden":!0}),p.settings.workspaceMigrationConfirm]})]})]})]})}),(0,Y.jsx)(M,{open:!!sn,onOpenChange:e=>{e||cn(null)},children:(0,Y.jsxs)(k,{children:[(0,Y.jsx)(T,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(A,{className:`fixed left-1/2 top-1/2 z-[90] flex w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(j,{className:`text-base font-semibold text-fg`,children:p.settings.workspaceMissingTitle}),(0,Y.jsx)(D,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:sn?An(p.settings.workspaceMissingDescription,{workspace:sn}):null})]}),sn?(0,Y.jsx)(`div`,{className:`px-5 py-4`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,Y.jsx)(Ne,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:sn})]})}):null,(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:oi,disabled:nn,children:p.settings.workspaceMissingBack}),(0,Y.jsxs)(y,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:()=>void Ar({createWorkspaceRoot:!0}),disabled:nn,children:[(0,Y.jsx)(ne,{className:`size-4`,"aria-hidden":!0}),p.settings.workspaceMissingCreate]})]})]})]})})]})}export{X as ProjectDetailPage};