@xopcai/xopc 0.0.228 → 0.0.229

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 (129) 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-CjGZBs4C.js → agent-avatar-dicebear-CsFAJTIN.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agents-B0NI4_NI.js → agents-DA4b6_0C.js} +1 -1
  5. package/dist/gateway/static/root/assets/{app-management-settings-panel--SjycrXk.js → app-management-settings-panel-7KcMWuah.js} +1 -1
  6. package/dist/gateway/static/root/assets/{appearance-settings-8G-TVUtg.js → appearance-settings-Cqlw7Fif.js} +1 -1
  7. package/dist/gateway/static/root/assets/{apps-page-2NiqD-YP.js → apps-page-CsnhdGZ2.js} +1 -1
  8. package/dist/gateway/static/root/assets/{attachment-load-Bx44zSpz.js → attachment-load-q4pDpqkF.js} +1 -1
  9. package/dist/gateway/static/root/assets/{automations-page-CrKAHqc0.js → automations-page-BuTqjKGX.js} +1 -1
  10. package/dist/gateway/static/root/assets/{automations-workspace-Q3g9cf0h.js → automations-workspace-CD0E2ThS.js} +1 -1
  11. package/dist/gateway/static/root/assets/{binary-plugins-DjDwnHAQ.js → binary-plugins-DUce1Bsc.js} +1 -1
  12. package/dist/gateway/static/root/assets/{block-editor-7aMOKoZM.js → block-editor-D8Ejp-QR.js} +1 -1
  13. package/dist/gateway/static/root/assets/{browser-settings-page-DTwPkmAC.js → browser-settings-page-CY1k3MMd.js} +1 -1
  14. package/dist/gateway/static/root/assets/{browser-workflows-page-DVLrWKz_.js → browser-workflows-page-BDvZbR9v.js} +1 -1
  15. package/dist/gateway/static/root/assets/{capabilities-settings-panel-YcP4FbN7.js → capabilities-settings-panel-D1VfotHQ.js} +1 -1
  16. package/dist/gateway/static/root/assets/{capability-presets-settings-panel-AcPjHHia.js → capability-presets-settings-panel-DXHqRLpU.js} +1 -1
  17. package/dist/gateway/static/root/assets/{channels-settings-Ca94Q1D-.js → channels-settings-DrFL57M_.js} +1 -1
  18. package/dist/gateway/static/root/assets/{chat-terminal-dock-BR-_7KC0.js → chat-terminal-dock-h1CKexNz.js} +1 -1
  19. package/dist/gateway/static/root/assets/{connectors-page-SGxfLTd6.js → connectors-page-DUAyfFCF.js} +1 -1
  20. package/dist/gateway/static/root/assets/{cron-expression-D8-c-Tkw.js → cron-expression-DlaQQOId.js} +1 -1
  21. package/dist/gateway/static/root/assets/{date-picker-kV-Jyl9J.js → date-picker-8R1sXJKb.js} +1 -1
  22. package/dist/gateway/static/root/assets/{dependency-picker-CwKcrfGj.js → dependency-picker-CWur0821.js} +1 -1
  23. package/dist/gateway/static/root/assets/{desktop-pet-D9rnchu3.js → desktop-pet-Knl-zNDU.js} +1 -1
  24. package/dist/gateway/static/root/assets/{desktop-pet-settings-CTs5WGzk.js → desktop-pet-settings-CAQMLVtd.js} +1 -1
  25. package/dist/gateway/static/root/assets/{directory-picker-path-field-CCl0aaDm.js → directory-picker-path-field-Caaz4Rw5.js} +1 -1
  26. package/dist/gateway/static/root/assets/{extension-debug-page-Cau40SvC.js → extension-debug-page-B965Mc15.js} +1 -1
  27. package/dist/gateway/static/root/assets/{extension-page-BsJXdvIL.js → extension-page-C0UnkBi5.js} +1 -1
  28. package/dist/gateway/static/root/assets/{extension-settings-page-qWqJyF7-.js → extension-settings-page-BUSIAZCR.js} +1 -1
  29. package/dist/gateway/static/root/assets/{gateway-config-api-BI0SELXm.js → gateway-config-api-DkH0eEgy.js} +1 -1
  30. package/dist/gateway/static/root/assets/{gateway-settings-6ZdOIC7F.js → gateway-settings-BBgLDm6I.js} +1 -1
  31. package/dist/gateway/static/root/assets/{heartbeat-settings-KBwhXeFD.js → heartbeat-settings-BtEHVXWD.js} +1 -1
  32. package/dist/gateway/static/root/assets/{home-page-BA2M4CLi.js → home-page-5SU2TNJj.js} +1 -1
  33. package/dist/gateway/static/root/assets/{index-BX0dz1JK.js → index-BNWhgmjs.js} +8 -8
  34. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-kHtpnyEm.js → keyboard-shortcuts-settings-CsRz8NrS.js} +1 -1
  35. package/dist/gateway/static/root/assets/{local-app-workbench-page-D2nkn09R.js → local-app-workbench-page-DYPEUgpP.js} +1 -1
  36. package/dist/gateway/static/root/assets/{local-apps-page-BCXa0oUa.js → local-apps-page-CTBNUG4a.js} +1 -1
  37. package/dist/gateway/static/root/assets/{logs-page-D3sNst0K.js → logs-page-B0P7rG2B.js} +1 -1
  38. package/dist/gateway/static/root/assets/{management-settings-tHnlfOAQ.js → management-settings-YqUAEwQo.js} +1 -1
  39. package/dist/gateway/static/root/assets/{markdown-split-BMLqHHr5.js → markdown-split-dxpSCXb8.js} +1 -1
  40. package/dist/gateway/static/root/assets/{media-plugins-DybwqTgv.js → media-plugins-CJ00i1Lg.js} +1 -1
  41. package/dist/gateway/static/root/assets/{notes-page-C24SfF6r.js → notes-page-DEnbnkIt.js} +1 -1
  42. package/dist/gateway/static/root/assets/{notes-workbench-CTdZc3ov.js → notes-workbench-DmVYu_Oc.js} +2 -2
  43. package/dist/gateway/static/root/assets/{product-open-page-DBfCVlJq.js → product-open-page-BHxo9U95.js} +1 -1
  44. package/dist/gateway/static/root/assets/{project-detail-page-COHaEpbA.js → project-detail-page-DV2nGmsq.js} +1 -1
  45. package/dist/gateway/static/root/assets/{projects-page-lMnST7D_.js → projects-page-BNIFwFfc.js} +1 -1
  46. package/dist/gateway/static/root/assets/{remote-access-hub-BIRKBvO_.js → remote-access-hub-DLXqKiA_.js} +1 -1
  47. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-BPEGTip5.js → runtime-tools-settings-panel-BpQ2GI-0.js} +1 -1
  48. package/dist/gateway/static/root/assets/{schema-form-Dxlu60Td.js → schema-form-HE1G26Lx.js} +1 -1
  49. package/dist/gateway/static/root/assets/{sessions-page-CATO9G3y.js → sessions-page-DWaXf_25.js} +1 -1
  50. package/dist/gateway/static/root/assets/settings-advanced-gate-JFCbnCL2.js +1 -0
  51. package/dist/gateway/static/root/assets/{settings-form-section-ChXh3Bwk.js → settings-form-section-CXAn0Xhy.js} +1 -1
  52. package/dist/gateway/static/root/assets/{settings-loading-skeleton-BCAUqIe2.js → settings-loading-skeleton-DsFu7Bcv.js} +1 -1
  53. package/dist/gateway/static/root/assets/{settings-page-D25W9Okr.js → settings-page-C4iib9nO.js} +1 -1
  54. package/dist/gateway/static/root/assets/{setup-status-panel-DsN7Z4Fl.js → setup-status-panel-BA83Wr1d.js} +1 -1
  55. package/dist/gateway/static/root/assets/{share-preview-page-CRFnUaNb.js → share-preview-page-BOGl3s6M.js} +1 -1
  56. package/dist/gateway/static/root/assets/{shares-settings-CAX0eNaP.js → shares-settings-Q2MdGaBi.js} +1 -1
  57. package/dist/gateway/static/root/assets/{skill-reload-api-Doy1gghe.js → skill-reload-api-cFtfVeFU.js} +1 -1
  58. package/dist/gateway/static/root/assets/{skills-page-Cl7jjTK7.js → skills-page-CdaFtNw9.js} +1 -1
  59. package/dist/gateway/static/root/assets/{skills-page.utils-BiCl4nb5.js → skills-page.utils-DYaAddUL.js} +1 -1
  60. package/dist/gateway/static/root/assets/{system-settings-panel-BuESR7ZT.js → system-settings-panel-Co7gilRd.js} +1 -1
  61. package/dist/gateway/static/root/assets/{task-detail-page-BRiy8NL3.js → task-detail-page-5B1pswu8.js} +1 -1
  62. package/dist/gateway/static/root/assets/{use-autosave-Dg1mgJ_l.js → use-autosave-DnnZtMpA.js} +1 -1
  63. package/dist/gateway/static/root/assets/{user-context-page-CqoADNKu.js → user-context-page-Dr1FKjXv.js} +1 -1
  64. package/dist/gateway/static/root/assets/{voice-api-key-field-BDNexlVR.js → voice-api-key-field-wetUpi3i.js} +1 -1
  65. package/dist/gateway/static/root/assets/{work-discovery-overlay-BHTfeaWL.js → work-discovery-overlay-tbTWASJJ.js} +1 -1
  66. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Cf_w-NZy.js → workflow-run-setup-panel-Dy0fDs8w.js} +1 -1
  67. package/dist/gateway/static/root/assets/{workflows-page-j0P-uECz.js → workflows-page-IVP3GSkI.js} +1 -1
  68. package/dist/gateway/static/root/index.html +1 -1
  69. package/dist/package.js +1 -1
  70. package/dist/src/agent/agent-instance-gateway.d.ts +1 -1
  71. package/dist/src/agent/agent-manager.d.ts +1 -1
  72. package/dist/src/agent/agent-manager.js +18 -3
  73. package/dist/src/agent/background-review/prompts.d.ts +8 -2
  74. package/dist/src/agent/background-review/prompts.js +25 -12
  75. package/dist/src/agent/background-review/run-background-review.d.ts +7 -2
  76. package/dist/src/agent/background-review/run-background-review.js +175 -160
  77. package/dist/src/agent/memory/index.d.ts +1 -1
  78. package/dist/src/agent/memory/index.js +2 -2
  79. package/dist/src/agent/memory/manager.d.ts +1 -11
  80. package/dist/src/agent/memory/manager.js +0 -16
  81. package/dist/src/agent/memory/understanding/service.d.ts +0 -11
  82. package/dist/src/agent/memory/understanding/service.js +7 -173
  83. package/dist/src/agent/memory/user-context-coordinator.d.ts +1 -3
  84. package/dist/src/agent/memory/user-context-coordinator.js +3 -66
  85. package/dist/src/agent/orchestration/agent-orchestrator.js +1 -1
  86. package/dist/src/agent/service/direct-turn-helpers.js +1 -1
  87. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  88. package/dist/src/config/schema.d.ts +4 -0
  89. package/dist/src/config/schema.js +1 -0
  90. package/dist/src/connectors/connected-source-understanding.js +35 -21
  91. package/dist/src/connectors/learning-coordinator.js +1 -42
  92. package/dist/src/gateway/chat-stream/mapper.d.ts +2 -0
  93. package/dist/src/gateway/chat-stream/mapper.js +5 -0
  94. package/dist/src/gateway/hono/routes/understanding-sources.js +4 -1
  95. package/dist/src/gateway/hono/routes/you.js +29 -11
  96. package/dist/src/gateway/service/run-gateway-agent.js +5 -1
  97. package/dist/src/knowledge/index.d.ts +0 -1
  98. package/dist/src/knowledge/index.js +1 -2
  99. package/dist/src/notifications/planner.js +5 -1
  100. package/dist/src/storage/sqlite/index.d.ts +1 -1
  101. package/dist/src/storage/sqlite/index.js +2 -2
  102. package/dist/src/storage/sqlite/migrations/137_understanding_status_audit.sql +71 -0
  103. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  104. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  105. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  106. package/dist/src/storage/sqlite/schema.js +1 -1
  107. package/dist/src/storage/sqlite/user-context-repository.d.ts +16 -4
  108. package/dist/src/storage/sqlite/user-context-repository.js +56 -12
  109. package/dist/src/user-context/config.d.ts +8 -0
  110. package/dist/src/user-context/config.js +3 -0
  111. package/dist/src/user-context/consolidation.js +16 -4
  112. package/dist/src/user-context/extraction/executor.d.ts +22 -0
  113. package/dist/src/user-context/extraction/executor.js +142 -0
  114. package/dist/src/user-context/extraction/registry.d.ts +1 -1
  115. package/dist/src/user-context/extraction/registry.js +5 -34
  116. package/dist/src/user-context/extraction/repair.js +4 -1
  117. package/dist/src/user-context/extraction/semantic.d.ts +18 -0
  118. package/dist/src/user-context/extraction/semantic.js +148 -0
  119. package/dist/src/user-context/understandingQuality.js +4 -0
  120. package/dist/src/work-discovery/analyzer.js +9 -4
  121. package/dist/src/work-discovery/service.d.ts +1 -0
  122. package/dist/src/work-discovery/service.js +5 -4
  123. package/dist/src/work-discovery/types.d.ts +1 -0
  124. package/package.json +14 -8
  125. package/dist/gateway/static/root/assets/settings-advanced-gate-Cco_W41x.js +0 -1
  126. package/dist/src/agent/memory/understanding/correction.d.ts +0 -3
  127. package/dist/src/agent/memory/understanding/correction.js +0 -39
  128. package/dist/src/knowledge/connected-understanding-pipeline.d.ts +0 -17
  129. package/dist/src/knowledge/connected-understanding-pipeline.js +0 -278
@@ -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,l as a,p as o,t as s}from"./chunk-KS7C4IRE-BaASWQor.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,t as h,u as g}from"./popover-select-CccGri5Y.js";import{t as _}from"./circle-check-C23XjkUj.js";import{t as v}from"./copy-Dv6d4Dvw.js";import{t as y}from"./download-Dk-ZjtO6.js";import{t as b}from"./external-link-DjqjBmc3.js";import{d as x,p as S}from"./markdown-view-DvM5PWEH.js";import{t as C}from"./plus-Q2yW6OE7.js";import{t as w}from"./search-DA7gz22f.js";import{t as T}from"./x-B_N4OPjy.js";import{t as E}from"./cn-JdwAhgNB.js";import{t as D}from"./button-CSEbl4zT.js";import{t as O}from"./copy-to-clipboard-HOJ79TWv.js";import{t as k}from"./messages-BMdD0LWk.js";import{n as A,r as j,s as M}from"./locale-store-CXhjfe4q.js";import{a as N,c as P,i as F,n as I,o as L,r as R,s as z,t as ee}from"./dist-BPoKqzeH.js";import{$a as te,$c as B,Aa as V,Ai as H,Ba as U,Cs as ne,Da as re,Dc as W,Fa as ie,Gc as ae,Gl as oe,Ha as G,Hs as K,Ia as se,L as ce,La as q,Ma as le,Mc as ue,Ml as de,Na as fe,Oa as J,Ol as pe,Os as me,Pa as he,Ps as ge,Q as _e,R as ve,Ra as ye,U as be,Ua as xe,Ul as Se,Un as Ce,V as we,Va as Te,Vl as Ee,Vn as De,Wa as Oe,Wc as ke,Wi as Ae,Wl as je,Xs as Me,Z as Ne,Zs as Pe,_c as Fe,_o as Ie,bs as Le,cl as Re,cu as ze,da as Be,do as Ve,ec as He,el as Ue,fa as We,fc as Ge,fs as Ke,fu as qe,ga as Je,gr as Ye,gt as Xe,ha as Ze,hl as Qe,it as $e,ja as et,ka as tt,la as nt,ll as rt,lr as it,lu as at,ma as ot,ml as st,no as ct,oa as lt,ol as ut,pa as dt,pc as ft,ql as pt,qs as mt,sa as ht,tc as gt,ua as _t,uo as vt,wl as yt,wr as bt,za as xt,zc as St,zl as Ct}from"./index-BX0dz1JK.js";import{t as wt}from"./notes-workbench-CTdZc3ov.js";import{n as Tt,t as Et}from"./use-autosave-Dg1mgJ_l.js";import{t as Dt}from"./page-tabs-BaEQMYm_.js";import{t as Ot}from"./directory-picker-path-field-CCl0aaDm.js";import{t as kt}from"./date-picker-kV-Jyl9J.js";import{t as At}from"./automations-workspace-Q3g9cf0h.js";import{i as jt,p as Mt,s as Nt}from"./skills-page.utils-BiCl4nb5.js";import{t as Pt}from"./dependency-picker-CwKcrfGj.js";import{c as Ft,l as It,n as Lt,o as Rt,r as zt,t as Bt}from"./style-TIDOdKy0.js";var Y=e(t(),1),Vt=n();function Ht(e){return M(j(`/api/projects/${encodeURIComponent(e)}/skills`))}function Ut(e,t){return M(j(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`))}function Wt(e,t){return M(j(`/api/projects/${encodeURIComponent(e)}/workspace-trust`),{method:`PATCH`,body:JSON.stringify({trusted:t})})}function Gt(e,t){let n=new FormData;return n.set(`file`,t),M(j(`/api/projects/${encodeURIComponent(e)}/skills/upload`),{method:`POST`,body:n})}function Kt(e,t,n={}){return M(j(`/api/projects/${encodeURIComponent(e)}/skills/marketplace/install`),{method:`POST`,body:JSON.stringify({name:t,...n})})}function qt(e,t){return M(j(`/api/projects/${encodeURIComponent(e)}/skills/source/install`),{method:`POST`,body:JSON.stringify({source:t})})}function Jt(e,t){return M(j(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`),{method:`DELETE`})}var X=r();function Yt({projectId:e,copy:t}){let[n,r]=(0,Y.useState)([]),[i,a]=(0,Y.useState)([]),[o,s]=(0,Y.useState)([]),[c,d]=(0,Y.useState)([]),[f,m]=(0,Y.useState)([]),[_,v]=(0,Y.useState)(``),[b,x]=(0,Y.useState)(null),[S,O]=(0,Y.useState)(!1),[k,A]=(0,Y.useState)(!0),[j,M]=(0,Y.useState)(!1),[P,F]=(0,Y.useState)(null),[te,B]=(0,Y.useState)(``),[V,H]=(0,Y.useState)(null),[U,re]=(0,Y.useState)(null),[W,ie]=(0,Y.useState)(``),[ae,G]=(0,Y.useState)(1),[K,ce]=(0,Y.useState)(null),[q,le]=(0,Y.useState)(!1),[de,fe]=(0,Y.useState)(``),[J,pe]=(0,Y.useState)(``),me=(0,Y.useRef)(null),he=(0,Y.useCallback)(async()=>{A(!0),B(``);try{let t=await Ht(e);r(t.items),a(t.inheritedItems),s(t.sources),d(t.diagnostics)}catch(e){B(e instanceof Error?e.message:String(e))}finally{A(!1)}},[e]);(0,Y.useEffect)(()=>{he()},[he]),(0,Y.useEffect)(()=>{let t=!1;return se(e).then(e=>{t||m(e)}).catch(()=>{t||m([])}),()=>{t=!0}},[e]),(0,Y.useEffect)(()=>{if(!_){x(null);return}let e=f.find(e=>e.key===_),t=!1;return x(null),B(``),O(!0),bt(e?.agentId??e?.routing?.agentId,_,!0).then(e=>{t||x(e)}).catch(e=>{t||B(e instanceof Error?e.message:String(e))}).finally(()=>{t||O(!1)}),()=>{t=!0}},[_,f]),(0,Y.useEffect)(()=>{if(V!==`marketplace`)return;let e=new AbortController,t=window.setTimeout(()=>{le(!0),fe(``),Mt({q:W,page:ae,pageSize:8,sort:`downloads`,signal:e.signal}).then(ce).catch(t=>{e.signal.aborted||fe(t instanceof Error?t.message:String(t))}).finally(()=>{e.signal.aborted||le(!1)})},250);return()=>{window.clearTimeout(t),e.abort()}},[V,ae,W]);async function _e(e,t){M(!0),F(t??null),B(``);try{await e(),H(null),pe(``),await he()}catch(e){B(e instanceof Error?e.message:String(e))}finally{M(!1),F(null)}}async function ve(t){B(``);try{re((await Ut(e,t)).skill)}catch(e){B(e instanceof Error?e.message:String(e))}}async function ye(n){if(n.removable&&window.confirm(t.removeConfirm.replace(`{{name}}`,n.name))){M(!0);try{await Jt(e,n.directoryId),await he()}catch(e){B(e instanceof Error?e.message:String(e))}finally{M(!1)}}}async function be(){M(!0),B(``);try{await Wt(e,!0),await he()}catch(e){B(e instanceof Error?e.message:String(e))}finally{M(!1)}}let xe=o.find(e=>e.origin===`agents-workspace`),Ce=new Map(b?.skills.map(e=>[e.name,e]));return(0,X.jsxs)(`section`,{id:`project-panel-skills`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-skills`,className:`grid content-start gap-4`,children:[(0,X.jsxs)(`div`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.title}),(0,X.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,X.jsxs)(u,{children:[(0,X.jsx)(p,{asChild:!0,children:(0,X.jsxs)(D,{type:`button`,children:[(0,X.jsx)(C,{className:`size-4`,"aria-hidden":!0}),t.add,(0,X.jsx)(oe,{className:`size-3.5`,"aria-hidden":!0})]})}),(0,X.jsx)(l,{children:(0,X.jsxs)(g,{align:`end`,sideOffset:8,className:`z-50 w-72 rounded-lg border border-edge bg-surface-panel p-1.5 shadow-xl`,children:[(0,X.jsx)($t,{icon:ge,title:t.marketplace,hint:t.marketplaceHint,onClick:()=>H(`marketplace`)}),(0,X.jsx)($t,{icon:ut,title:t.source,hint:t.sourceHint,onClick:()=>H(`source`)}),(0,X.jsx)($t,{icon:ne,title:t.upload,hint:t.uploadHint,onClick:()=>me.current?.click()})]})})]}),(0,X.jsx)(`input`,{ref:me,type:`file`,accept:`.zip,application/zip`,className:`hidden`,onChange:t=>{let n=t.target.files?.[0];n&&_e(()=>Gt(e,n)),t.target.value=``}})]}),o.length?(0,X.jsx)(`div`,{className:`mt-3 grid gap-2 rounded-md border border-edge-subtle bg-surface-base p-3`,children:o.map(e=>(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-xs`,children:[(0,X.jsx)(`span`,{className:`font-medium text-fg`,children:e.origin===`xopc-workspace`?t.xopcSource:t.agentsSource}),e.writable?null:(0,X.jsx)(`span`,{className:`rounded bg-surface-hover px-1.5 py-0.5 text-fg-muted`,children:t.sourceReadOnly}),(0,X.jsx)(`span`,{className:`text-fg-subtle`,children:en(t,e.state)}),(0,X.jsxs)(`span`,{className:`min-w-0 break-all font-mono text-fg-subtle`,children:[t.path,`: `,e.rootDir]})]},e.origin))}):null]}),te?(0,X.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:te}):null,xe?.state===`untrusted`?(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-lg border border-amber-500/30 bg-amber-500/10 px-4 py-3`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,X.jsx)(ue,{className:`mt-0.5 size-4 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.trustTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.trustHint})]})]}),(0,X.jsxs)(D,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>void be(),children:[(0,X.jsx)(mt,{className:`size-4`,"aria-hidden":!0}),j?t.trusting:t.trustAction]})]}):null,c.some(e=>e.type!==`skipped`)?(0,X.jsxs)(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 px-4 py-3`,children:[(0,X.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.diagnosticsTitle}),(0,X.jsx)(`ul`,{className:`mt-2 grid gap-1 text-xs leading-5 text-fg-muted`,children:c.filter(e=>e.type!==`skipped`).map((e,t)=>(0,X.jsx)(`li`,{children:e.message},`${e.type}:${e.path??``}:${t}`))})]}):null,f.length?(0,X.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3 rounded-lg border border-edge bg-surface-panel p-4`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.sessionViewLabel}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:S?t.sessionLoading:_?b?.agentId:t.sessionViewAll})]}),(0,X.jsx)(h,{value:_,options:f.map(e=>({value:e.key,label:e.name?.trim()||`${t.sessionFallback} · ${e.key.slice(-12)}`})),placeholder:t.sessionViewAll,emptyLabel:t.sessionViewAll,triggerClassName:`w-[min(24rem,calc(100vw-3rem))]`,onChange:v})]}):null,k?(0,X.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(e=>(0,X.jsx)(ct,{className:`h-36 rounded-lg`},e))}):n.length?(0,X.jsx)(Xt,{title:t.localTitle,items:n,copy:t,busy:j,availabilityByName:Ce,onPreview:ve,onRemove:ye}):(0,X.jsxs)(`div`,{className:`rounded-lg border border-dashed border-edge bg-surface-panel px-6 py-12 text-center`,children:[(0,X.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.empty}),(0,X.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:t.emptyHint})]}),!k&&i.length?(0,X.jsx)(Xt,{title:t.inheritedTitle,hint:t.inheritedHint,items:i,copy:t,busy:j,availabilityByName:Ce,onPreview:ve,onRemove:ye}):null,(0,X.jsx)(ee,{open:V!==null,onOpenChange:e=>{e||H(null)},children:(0,X.jsxs)(L,{children:[(0,X.jsx)(N,{className:`fixed inset-0 z-50 bg-black/45`}),(0,X.jsxs)(R,{className:E(`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`,V===`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,X.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,X.jsx)(z,{className:`text-base font-semibold text-fg`,children:V===`marketplace`?t.marketplace:t.source}),(0,X.jsx)(I,{asChild:!0,children:(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,X.jsx)(T,{className:`size-4`})})})]}),(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:V===`marketplace`?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.marketplace}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.marketplaceHint}),(0,X.jsxs)(`div`,{className:`relative mt-3`,children:[(0,X.jsx)(w,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,X.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:W,onChange:e=>{ie(e.target.value),G(1)},placeholder:t.marketplacePlaceholder,autoFocus:!0})]}),de?(0,X.jsx)(`p`,{className:`mt-3 text-sm text-red-600 dark:text-red-300`,children:de}):null,q&&!K?(0,X.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[0,1,2,3].map(e=>(0,X.jsx)(ct,{className:`h-32 rounded-lg`},e))}):K?.items.length?(0,X.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:K.items.map(r=>{let i=r.providerId??K.provider,a=jt(r,i),o=n.some(e=>e.origin===`xopc-workspace`&&(e.directoryId===r.id||e.directoryId===a||e.name===r.name)),s=P===a;return(0,X.jsxs)(`article`,{className:`group flex min-h-32 gap-3 rounded-lg border border-edge bg-surface-base p-3`,children:[(0,X.jsx)(Nt,{name:r.name,className:`size-10`}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,X.jsx)(`h4`,{className:`truncate text-sm font-semibold text-fg`,children:r.name}),(0,X.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:r.description||`—`}),(0,X.jsxs)(`div`,{className:`mt-auto flex items-end justify-between gap-2 pt-2`,children:[(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-fg-subtle`,children:[(0,X.jsx)(y,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceDownloads,` `,r.downloads]}),(0,X.jsx)(D,{type:`button`,className:`h-8 px-2.5 text-xs`,variant:o?`secondary`:`primary`,disabled:j||o,onClick:()=>void _e(()=>Kt(e,a,{provider:i}),a),children:o?t.marketplaceInstalled:s?t.installing:t.install})]})]})]},`${i??`default`}:${r.id}`)})}):q?null:(0,X.jsx)(`p`,{className:`mt-6 text-center text-sm text-fg-muted`,children:t.marketplaceEmpty}),K&&K.meta.totalPages>1?(0,X.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,X.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t.marketplacePage.replace(`{{page}}`,String(K.meta.page)).replace(`{{total}}`,String(K.meta.totalPages))}),(0,X.jsxs)(`div`,{className:`flex gap-2`,children:[(0,X.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:q||ae<=1,onClick:()=>G(e=>Math.max(1,e-1)),children:[(0,X.jsx)(je,{className:`size-4`}),t.marketplacePrevious]}),(0,X.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:q||ae>=K.meta.totalPages,onClick:()=>G(e=>e+1),children:[t.marketplaceNext,(0,X.jsx)(Se,{className:`size-4`})]})]})]}):null]}):(0,X.jsxs)(`section`,{className:`flex h-full flex-col`,children:[(0,X.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:t.sourceHint}),(0,X.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:J,onChange:e=>pe(e.target.value),placeholder:t.sourcePlaceholder,autoFocus:!0}),(0,X.jsxs)(`div`,{className:`mt-auto flex justify-end gap-2 border-t border-edge pt-4`,children:[(0,X.jsx)(I,{asChild:!0,children:(0,X.jsx)(D,{type:`button`,variant:`secondary`,children:t.close})}),(0,X.jsx)(D,{type:`button`,disabled:j||!J.trim(),onClick:()=>void _e(()=>qt(e,J.trim())),children:j?t.installing:t.install})]})]})})]})]})}),(0,X.jsx)(ee,{open:!!U,onOpenChange:e=>{e||re(null)},children:(0,X.jsxs)(L,{children:[(0,X.jsx)(N,{className:`fixed inset-0 z-50 bg-black/45`}),(0,X.jsxs)(R,{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,X.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,X.jsx)(z,{className:`text-base font-semibold text-fg`,children:U?.name}),(0,X.jsx)(I,{asChild:!0,children:(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,X.jsx)(T,{className:`size-4`})})})]}),(0,X.jsx)(`pre`,{className:`min-h-0 flex-1 overflow-auto whitespace-pre-wrap p-5 text-sm leading-6 text-fg-muted`,children:U?.bodyMarkdown})]})]})})]})}function Xt(e){let t=(0,Vt.c)(25),{title:n,hint:r,items:i,copy:a,busy:o,availabilityByName:s,onPreview:c,onRemove:l}=e,u;t[0]===n?u=t[1]:(u=(0,X.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n}),t[0]=n,t[1]=u);let d;t[2]===r?d=t[3]:(d=r?(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:r}):null,t[2]=r,t[3]=d);let f;t[4]!==u||t[5]!==d?(f=(0,X.jsxs)(`div`,{children:[u,d]}),t[4]=u,t[5]=d,t[6]=f):f=t[6];let p;if(t[7]!==s||t[8]!==o||t[9]!==a||t[10]!==i||t[11]!==c||t[12]!==l){let e;t[14]!==s||t[15]!==o||t[16]!==a||t[17]!==c||t[18]!==l?(e=e=>{let t=e.effective?s.get(e.name):void 0;return(0,X.jsxs)(`article`,{className:E(`flex min-h-36 flex-col rounded-lg border border-edge bg-surface-panel p-4`,!e.effective&&`opacity-70`),children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(qe,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,X.jsx)(`h4`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:e.name})]}),(0,X.jsx)(`p`,{className:`mt-2 line-clamp-2 flex-1 text-sm leading-5 text-fg-muted`,children:e.description||e.directoryId}),(0,X.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5 text-[11px] text-fg-subtle`,children:[(0,X.jsx)(`span`,{className:`rounded-md bg-surface-hover/70 px-2 py-0.5`,children:Zt(a,e.origin)}),e.writable?null:(0,X.jsx)(`span`,{className:`rounded-md bg-surface-hover/70 px-2 py-0.5`,children:a.sourceReadOnly}),e.effective?null:(0,X.jsx)(`span`,{className:`rounded-md bg-amber-500/10 px-2 py-0.5 text-amber-800 dark:text-amber-200`,children:a.shadowed}),t?(0,X.jsx)(`span`,{className:E(`rounded-md px-2 py-0.5`,t.availableForCurrentAgent?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-amber-500/10 text-amber-800 dark:text-amber-200`),children:Qt(a,t)}):null]}),(0,X.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,X.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>void c(e.key),children:[(0,X.jsx)(b,{className:`size-3.5`,"aria-hidden":!0}),a.view]}),e.removable?(0,X.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-red-600`,disabled:o,onClick:()=>void l(e),children:[(0,X.jsx)(me,{className:`size-3.5`,"aria-hidden":!0}),a.remove]}):null]})]},e.key)},t[14]=s,t[15]=o,t[16]=a,t[17]=c,t[18]=l,t[19]=e):e=t[19],p=i.map(e),t[7]=s,t[8]=o,t[9]=a,t[10]=i,t[11]=c,t[12]=l,t[13]=p}else p=t[13];let m;t[20]===p?m=t[21]:(m=(0,X.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:p}),t[20]=p,t[21]=m);let h;return t[22]!==f||t[23]!==m?(h=(0,X.jsxs)(`section`,{className:`grid gap-3`,children:[f,m]}),t[22]=f,t[23]=m,t[24]=h):h=t[24],h}function Zt(e,t){switch(t){case`xopc-workspace`:return e.xopcSource;case`agents-workspace`:return e.agentsSource;case`xopc-global`:case`custom-global`:return e.globalXopcSource;case`agents-global`:return e.globalAgentsSource;case`bundled`:return e.bundledSource;case`extra`:return e.extraSource}}function Qt(e,t){if(t.availableForCurrentAgent)return e.sessionAvailable;switch(t.unavailableReason){case`agent-denied`:return e.sessionUnavailableAgent;case`disabled`:return e.sessionUnavailableDisabled;case`requirements-unmet`:return e.sessionUnavailableRequirements;case`model-invocation-disabled`:return e.sessionUnavailableModel;case`tool-gated`:return e.sessionUnavailableTools;default:return e.sessionUnavailableAgent}}function $t(e){let t=(0,Vt.c)(13),{icon:n,title:r,hint:i,onClick:a}=e,o;t[0]===n?o=t[1]:(o=(0,X.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,X.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,X.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,X.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,X.jsx)(d,{asChild:!0,children:(0,X.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}function en(e,t){switch(t){case`active`:return e.sourceStateActive;case`missing`:return e.sourceStateMissing;case`disabled`:return e.sourceStateDisabled;case`untrusted`:return e.sourceStateUntrusted;case`invalid`:return e.sourceStateInvalid}}var tn=[`backlog`,`ready`,`active`,`review`,`closed`];function nn(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 rn(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 an(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 on(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 sn(e,t){let n=new Set(e.map(e=>e.id)),{outgoing:r,incoming:i}=on(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 cn(e,t){let{incoming:n}=on(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 ln(e,t){let{incoming:n,outgoing:r}=on(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 un={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 dn(e){let t=(0,Vt.c)(25),{data:n,selected:r}=e,i=n.task,a=i.operationalState===`waiting`||i.operationalState===`blocked`,o=un[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=E(`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,X.jsx)(zt,{type:`target`,position:It.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,X.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,X.jsx)(B,{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,X.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,X.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,X.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,X.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,X.jsx)(zt,{type:`source`,position:It.Right,className:`!size-3 !border-2 !border-surface-panel !bg-accent opacity-60 transition-opacity group-hover:opacity-100`}),t[20]=_):_=t[20];let v;return t[21]!==g||t[22]!==l||t[23]!==p?(v=(0,X.jsxs)(`div`,{className:l,children:[u,p,g,_]}),t[21]=g,t[22]=l,t[23]=p,t[24]=v):v=t[24],v}var fn={taskNode:dn};function pn(e){let t=(0,Vt.c)(90),{tasks:n,dependencyEdges:r,returnTo:i,copy:a,onDependenciesChange:o}=e,[c,l]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(),[m,h]=(0,Y.useState)(),g=(0,Y.useRef)(null),_;t[0]!==r||t[1]!==n?(_=cn(n,r),t[0]=r,t[1]=n,t[2]=_):_=t[2];let v=_,y;t[3]!==v||t[4]!==u||t[5]!==c||t[6]!==n?(y=u?n.filter(e=>v.has(e.id)):c?n:n.filter(Z),t[3]=v,t[4]=u,t[5]=c,t[6]=n,t[7]=y):y=t[7];let x=y,S;t[8]===x?S=t[9]:(S=new Set(x.map(bn)),t[8]=x,t[9]=S);let C=S,w;if(t[10]!==r||t[11]!==C){let e;t[13]===C?e=t[14]:(e=e=>C.has(e.dependencyTaskId)&&C.has(e.dependentTaskId),t[13]=C,t[14]=e),w=r.filter(e),t[10]=r,t[11]=C,t[12]=w}else w=t[12];let T=w,O;t[15]!==T||t[16]!==x?(O=sn(x,T),t[15]=T,t[16]=x,t[17]=O):O=t[17];let k=O,A;t[18]!==f||t[19]!==T?(A=f?ln(f,T):void 0,t[18]=f,t[19]=T,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=x.find(M),P;t[23]===x?P=t[24]:(P=new Map(x.map(yn)),t[23]=x,t[24]=P);let F=P,I;if(t[25]!==a.phases||t[26]!==k||t[27]!==j||t[28]!==x){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],I=x.map(e),t[25]=a.phases,t[26]=k,t[27]=j,t[28]=x,t[29]=I}else I=t[29];let L=I,R;if(t[34]!==j||t[35]!==F||t[36]!==T){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:Ft.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],R=T.map(e),t[34]=j,t[35]=F,t[36]=T,t[37]=R}else R=t[37];let z=R,ee,te;t[41]!==f||t[42]!==C?(ee=()=>{f&&!C.has(f)&&p(void 0)},te=[f,C],t[41]=f,t[42]=C,t[43]=ee,t[44]=te):(ee=t[43],te=t[44]),(0,Y.useEffect)(ee,te);let B,V;t[45]!==z||t[46]!==m?(B=()=>{m&&!z.some(e=>e.id===m)&&h(void 0)},V=[z,m],t[45]=z,t[46]=m,t[47]=B,t[48]=V):(B=t[47],V=t[48]),(0,Y.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]!==x.length?(U=[u,c,x.length],t[50]=u,t[51]=c,t[52]=x.length,t[53]=U):U=t[53],(0,Y.useEffect)(H,U);let ne;t[54]===f?ne=t[55]:(ne=()=>{f&&g.current?.fitView({nodes:[{id:f}],padding:1.5,minZoom:.7,maxZoom:1,duration:250})},t[54]=f,t[55]=ne);let re=ne,W;t[56]!==r||t[57]!==o?(W=e=>{if(!e.source||!e.target||e.source===e.target)return;let t=r.filter(t=>t.dependentTaskId===e.target).map(vn);t.includes(e.source)||o(e.target,[...t,e.source])},t[56]=r,t[57]=o,t[58]=W):W=t[58];let ie=W,ae;t[59]!==r||t[60]!==o||t[61]!==m?(ae=()=>{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(_n)))},t[59]=r,t[60]=o,t[61]=m,t[62]=ae):ae=t[62];let oe=ae,G;t[63]===a.connectHint?G=t[64]:(G=(0,X.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.connectHint}),t[63]=a.connectHint,t[64]=G);let K=u?`secondary`:`ghost`,se;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(se=()=>d(gn),t[65]=se):se=t[65];let ce=u?a.allTasks:a.blockedChains,q;t[66]!==u||t[67]!==K||t[68]!==ce?(q=(0,X.jsx)(D,{type:`button`,variant:K,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":u,onClick:se,children:ce}),t[66]=u,t[67]=K,t[68]=ce,t[69]=q):q=t[69];let le;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(le=()=>l(hn),t[70]=le):le=t[70];let ue=c?a.hideCompleted:a.showCompleted,de;t[71]!==u||t[72]!==c||t[73]!==ue?(de=(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":c,onClick:le,disabled:u,children:ue}),t[71]=u,t[72]=c,t[73]=ue,t[74]=de):de=t[74];let fe=N?(0,X.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:re,children:[(0,X.jsx)(st,{className:`size-3.5`,"aria-hidden":!0}),a.locateTask]}):null,J;t[75]!==a.removeDependency||t[76]!==oe||t[77]!==m?(J=m?(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs text-danger`,onClick:oe,children:a.removeDependency}):null,t[75]=a.removeDependency,t[76]=oe,t[77]=m,t[78]=J):J=t[78];let pe;t[79]!==q||t[80]!==de||t[81]!==fe||t[82]!==J?(pe=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[q,de,fe,J]}),t[79]=q,t[80]=de,t[81]=fe,t[82]=J,t[83]=pe):pe=t[83];let me;t[84]!==G||t[85]!==pe?(me=(0,X.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:[G,pe]}),t[84]=G,t[85]=pe,t[86]=me):me=t[86];let he=x.length>0?(0,X.jsxs)(`div`,{className:E(`grid h-[min(42rem,calc(100vh-14rem))] min-h-[28rem]`,N&&`lg:grid-cols-[minmax(0,1fr)_18rem]`),children:[(0,X.jsxs)(Rt,{nodes:L,edges:z,nodeTypes:fn,nodesDraggable:!1,nodesConnectable:!0,elementsSelectable:!0,onNodeClick:(e,t)=>p(t.id),onEdgeClick:(e,t)=>h(t.id),onConnect:ie,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,X.jsx)(Bt,{color:`var(--color-edge)`,gap:22,size:1}),(0,X.jsx)(Lt,{showInteractive:!1,className:`!border-edge !bg-surface-panel !shadow-surface`})]}),N?(0,X.jsxs)(`aside`,{className:`overflow-y-auto border-t border-edge bg-surface-panel p-4 lg:border-l lg:border-t-0`,children:[(0,X.jsx)(`p`,{className:`text-xs font-medium text-accent-fg`,children:a.phases[N.phase]}),(0,X.jsx)(`h3`,{className:`mt-2 text-sm font-semibold leading-6 text-fg`,children:N.title}),N.operationalState===`blocked`&&N.blockedBy.length>0?(0,X.jsxs)(`div`,{className:`mt-4 rounded-lg bg-violet-500/8 p-3`,children:[(0,X.jsx)(`p`,{className:`text-xs font-medium text-violet-700 dark:text-violet-300`,children:a.blockedBy.replace(`{{count}}`,String(N.blockedBy.length))}),(0,X.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:N.blockedBy.map(mn)})]}):null,(0,X.jsxs)(s,{to:De(i,N.id),className:`mt-4 inline-flex items-center gap-1.5 text-xs font-medium text-accent-fg hover:underline`,children:[(0,X.jsx)(b,{className:`size-3.5`,"aria-hidden":!0}),a.openTask]})]}):null]}):(0,X.jsx)(`div`,{className:`flex min-h-72 items-center justify-center px-6 text-center text-sm text-fg-muted`,children:a.empty}),ge;return t[87]!==me||t[88]!==he?(ge=(0,X.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-base/40`,children:[me,he]}),t[87]=me,t[88]=he,t[89]=ge):ge=t[89],ge}function mn(e){return(0,X.jsx)(`li`,{children:e.title},e.id)}function hn(e){return!e}function gn(e){return!e}function _n(e){return e.dependencyTaskId}function vn(e){return e.dependencyTaskId}function yn(e){return[e.id,e]}function bn(e){return e.id}function Z(e){return e.phase!==`closed`}function xn({policy:e,copy:t,onSave:n}){let[r,i]=(0,Y.useState)(!1),[a,o]=(0,Y.useState)(e.mode),[s,c]=(0,Y.useState)(Math.round(e.confidenceThreshold*100)),[l,u]=(0,Y.useState)(!!e.quietHours),[d,p]=(0,Y.useState)(e.quietHours?.startHour??22),[h,g]=(0,Y.useState)(e.quietHours?.endHour??8),[_,v]=(0,Y.useState)(e.quietHours?.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone),[y,b]=(0,Y.useState)(e.allowedActions.includes(`create_project_task`)),[x,S]=(0,Y.useState)(!1),[C,w]=(0,Y.useState)();(0,Y.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),b(e.allowedActions.includes(`create_project_task`))},[e]);let E=async()=>{S(!0),w(void 0);try{await n({mode:a,confidenceThreshold:s/100,quietHours:l?{startHour:d,endHour:h,timezone:_}:null,allowedActions:y?[`create_project_task`]:[]}),i(!1)}catch(e){w(e instanceof Error?e.message:t.saveFailed)}finally{S(!1)}};return(0,X.jsxs)(ee,{open:r,onOpenChange:e=>{x||i(e)},children:[(0,X.jsx)(P,{asChild:!0,children:(0,X.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-9 gap-2 px-2.5 text-xs`,children:[(0,X.jsx)(Pe,{className:`size-3.5`,"aria-hidden":!0}),t.modes[e.mode]]})}),(0,X.jsxs)(L,{children:[(0,X.jsx)(N,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,X.jsxs)(R,{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,X.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(z,{className:`text-base font-semibold text-fg`,children:t.title}),(0,X.jsx)(F,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,X.jsx)(I,{asChild:!0,children:(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:x,children:(0,X.jsx)(T,{className:`size-4`,"aria-hidden":!0})})})]}),(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-4`,children:[(0,X.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,X.jsx)(`span`,{className:`font-medium text-fg-muted`,children:t.mode}),(0,X.jsx)(f,{value:a,onChange:e=>o(e.target.value),children:Object.entries(t.modes).map(([e,t])=>(0,X.jsx)(m,{value:e,children:t},e))})]}),(0,X.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,X.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[t.confidence,` · `,s,`%`]}),(0,X.jsx)(`input`,{type:`range`,min:`50`,max:`100`,step:`5`,value:s,onChange:e=>c(Number(e.target.value)),className:`accent-accent`})]}),(0,X.jsxs)(`div`,{className:`rounded-lg border border-edge p-3`,children:[(0,X.jsxs)(`label`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:l,onChange:e=>u(e.target.checked)}),t.quietHours]}),l?(0,X.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-3`,children:[(0,X.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietStart,(0,X.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,X.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietEnd,(0,X.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,X.jsxs)(`label`,{className:`col-span-2 grid gap-1 text-xs text-fg-muted`,children:[t.timezone,(0,X.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,X.jsxs)(`label`,{className:`flex items-start gap-3 rounded-lg border border-edge p-3`,children:[(0,X.jsx)(`input`,{type:`checkbox`,className:`mt-1`,checked:y,onChange:e=>b(e.target.checked)}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:t.allowTaskCreation}),(0,X.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.allowTaskCreationDescription})]})]})]}),(0,X.jsxs)(`div`,{className:`shrink-0 border-t border-edge px-5 py-3`,children:[C?(0,X.jsx)(`p`,{className:`mb-2 text-xs text-danger`,children:C}):null,(0,X.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,X.jsx)(I,{asChild:!0,children:(0,X.jsx)(D,{type:`button`,variant:`ghost`,disabled:x,children:t.cancel})}),(0,X.jsx)(D,{type:`button`,variant:`primary`,disabled:x||!_.trim()||d<0||d>23||h<0||h>23,onClick:()=>void E(),children:x?t.saving:t.save})]})]})]})]})]})}function Sn(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}var Cn={backlog:Ct,ready:Ct,active:St,review:Le,closed:_},wn={backlog:`bg-surface-hover text-fg-muted`,ready:`bg-surface-panel text-fg-muted`,active:`bg-accent-soft text-accent-fg`,review:`bg-amber-500/10 text-amber-700 dark:text-amber-300`,closed:`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`};function Tn(e){return e===`running`||e===`queued`?`border-accent/20 bg-accent-soft text-accent-fg`:e===`verifying`?`border-emerald-500/20 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`waiting`?`border-amber-500/20 bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`blocked`?`border-violet-500/20 bg-violet-500/10 text-violet-700 dark:text-violet-300`:`border-edge-subtle bg-surface-hover text-fg-muted`}function En(e){return e===`passed`?`border-emerald-500/20 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`failed`?`border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-300`:`border-edge-subtle bg-surface-hover text-fg-muted`}function Q(e){let t=(0,Vt.c)(83),{task:n,returnTo:r,copy:i,busy:a,onAction:o,onDragStart:c,onDropBefore:l}=e,u,d,f,p,m,h,g,v,y,b,x,S,C,w,T,D;t[0]!==c||t[1]!==l||t[2]!==r||t[3]!==n?(m=an(n),h=m!==`review`&&n.allowedCommands.includes(`request_review`)?`review`:void 0,f=n.phase===`closed`,p=!!(n.dueAt&&n.dueAt<Date.now()&&!f),d=f?_:de,v=n.priority!==`normal`,g=v||n.operationalState!==`idle`||!!n.latestVerification||n.acceptanceCriteriaCount>0||!!n.dueAt||!!n.nextCheckAt,x=!0,t[20]!==c||t[21]!==n.id?(S=e=>{e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,n.id),c(n.id)},t[20]=c,t[21]=n.id,t[22]=S):S=t[22],t[23]===c?C=t[24]:(C=()=>c(``),t[23]=c,t[24]=C),w=On,t[25]!==l||t[26]!==n.id?(T=e=>{e.preventDefault(),e.stopPropagation(),l(n.id)},t[25]=l,t[26]=n.id,t[27]=T):T=t[27],D=`group relative min-h-max min-w-0 shrink-0 overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface transition-[border-color,box-shadow] hover:border-edge focus-within:border-accent/40`,u=s,t[28]!==r||t[29]!==n.id?(y=De(r,n.id),t[28]=r,t[29]=n.id,t[30]=y):y=t[30],b=E(`block min-w-0 p-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,h?`pr-19`:m&&`pr-11`),t[0]=c,t[1]=l,t[2]=r,t[3]=n,t[4]=u,t[5]=d,t[6]=f,t[7]=p,t[8]=m,t[9]=h,t[10]=g,t[11]=v,t[12]=y,t[13]=b,t[14]=x,t[15]=S,t[16]=C,t[17]=w,t[18]=T,t[19]=D):(u=t[4],d=t[5],f=t[6],p=t[7],m=t[8],h=t[9],g=t[10],v=t[11],y=t[12],b=t[13],x=t[14],S=t[15],C=t[16],w=t[17],T=t[18],D=t[19]);let O=f?`text-emerald-600 dark:text-emerald-400`:`text-fg-subtle`,k;t[31]===O?k=t[32]:(k=E(`mt-0.5 size-4 shrink-0`,O),t[31]=O,t[32]=k);let A;t[33]!==d||t[34]!==k?(A=(0,X.jsx)(d,{className:k,"aria-hidden":!0}),t[33]=d,t[34]=k,t[35]=A):A=t[35];let j=f?`text-fg-subtle`:`text-fg`,M;t[36]===j?M=t[37]:(M=E(`min-w-0 break-words text-sm font-semibold leading-5`,j),t[36]=j,t[37]=M);let N;t[38]!==M||t[39]!==n.title?(N=(0,X.jsx)(`h3`,{className:M,children:n.title}),t[38]=M,t[39]=n.title,t[40]=N):N=t[40];let P;t[41]!==A||t[42]!==N?(P=(0,X.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[A,N]}),t[41]=A,t[42]=N,t[43]=P):P=t[43];let F;t[44]!==i||t[45]!==n.attention||t[46]!==n.blockedBy||t[47]!==n.operationalState?(F=n.operationalState===`blocked`&&n.blockedBy.length>0?(0,X.jsxs)(`div`,{className:`ml-6.5 mt-2.5 rounded-lg bg-violet-500/8 px-2.5 py-2 text-xs text-violet-700 dark:text-violet-300`,children:[(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-medium`,children:[(0,X.jsx)(B,{className:`size-3.5`,"aria-hidden":!0}),i.blockedBy.replace(`{{count}}`,String(n.blockedBy.length))]}),(0,X.jsx)(`p`,{className:`mt-1 line-clamp-2 leading-5 text-fg-muted`,children:n.blockedBy.map(Dn).join(`、`)})]}):n.attention[0]?(0,X.jsxs)(`p`,{className:`ml-6.5 mt-2.5 flex items-start gap-1.5 text-xs leading-5 text-fg-muted`,children:[(0,X.jsx)(Ee,{className:`mt-0.5 size-3.5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`line-clamp-2`,children:n.attention[0].summary})]}):null,t[44]=i,t[45]=n.attention,t[46]=n.blockedBy,t[47]=n.operationalState,t[48]=F):F=t[48];let I;t[49]!==i||t[50]!==p||t[51]!==g||t[52]!==v||t[53]!==n.acceptanceCriteriaCount||t[54]!==n.dueAt||t[55]!==n.latestVerification||t[56]!==n.nextCheckAt||t[57]!==n.operationalState||t[58]!==n.priority?(I=g?(0,X.jsxs)(`div`,{className:`ml-6.5 mt-2.5 flex flex-wrap items-center gap-1.5 text-[11px]`,children:[v?(0,X.jsx)(`span`,{className:E(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,n.priority===`critical`?`border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-300`:n.priority===`high`?`border-amber-500/20 bg-amber-500/10 text-amber-700 dark:text-amber-300`:`border-edge-subtle bg-surface-hover text-fg-muted`),children:i.priorityOptions[n.priority]}):null,n.operationalState===`idle`?null:(0,X.jsx)(`span`,{className:E(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,Tn(n.operationalState)),children:i.operationalStates[n.operationalState]}),n.latestVerification?(0,X.jsx)(`span`,{className:E(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,En(n.latestVerification)),children:i.verification[n.latestVerification]}):null,n.acceptanceCriteriaCount>0?(0,X.jsxs)(`span`,{className:`inline-flex min-h-6 items-center gap-1 rounded-md border border-edge-subtle bg-surface-hover px-2 text-fg-muted`,children:[(0,X.jsx)(St,{className:`size-3`,"aria-hidden":!0}),i.acceptanceCriteria.replace(`{{count}}`,String(n.acceptanceCriteriaCount))]}):null,n.dueAt?(0,X.jsxs)(`span`,{className:E(`inline-flex min-h-6 items-center gap-1 rounded-md border px-2`,p?`border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-300`:`border-edge-subtle bg-surface-hover text-fg-muted`),children:[(0,X.jsx)(pt,{className:`size-3`,"aria-hidden":!0}),H(new Date(n.dueAt))]}):null,n.nextCheckAt?(0,X.jsxs)(`span`,{className:`inline-flex min-h-6 items-center gap-1 rounded-md border border-accent/20 bg-accent-soft px-2 text-accent-fg`,children:[(0,X.jsx)(pt,{className:`size-3`,"aria-hidden":!0}),H(new Date(n.nextCheckAt))]}):null]}):null,t[49]=i,t[50]=p,t[51]=g,t[52]=v,t[53]=n.acceptanceCriteriaCount,t[54]=n.dueAt,t[55]=n.latestVerification,t[56]=n.nextCheckAt,t[57]=n.operationalState,t[58]=n.priority,t[59]=I):I=t[59];let L;t[60]!==u||t[61]!==y||t[62]!==P||t[63]!==F||t[64]!==I||t[65]!==b?(L=(0,X.jsxs)(u,{to:y,className:b,children:[P,F,I]}),t[60]=u,t[61]=y,t[62]=P,t[63]=F,t[64]=I,t[65]=b,t[66]=L):L=t[66];let R;t[67]!==a||t[68]!==i||t[69]!==o||t[70]!==m||t[71]!==h||t[72]!==n?(R=m?(0,X.jsxs)(`div`,{className:`absolute right-2.5 top-2.5 z-10 flex items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100 [@media(hover:none)]:opacity-100`,children:[h?(0,X.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,h),className:`inline-flex size-7 items-center justify-center rounded-md bg-surface-hover text-fg-muted hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-wait disabled:opacity-50`,"aria-label":i.actions[h],title:i.actions[h],children:(0,X.jsx)(Le,{className:`size-3.5`,"aria-hidden":!0})}):null,(0,X.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,m),className:`inline-flex size-7 items-center justify-center rounded-md bg-accent-soft text-accent-fg hover:bg-accent-soft/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-wait disabled:opacity-50`,"aria-label":i.actions[m],title:i.actions[m],children:(0,X.jsx)(ze,{className:`size-3.5`,"aria-hidden":!0})})]}):null,t[67]=a,t[68]=i,t[69]=o,t[70]=m,t[71]=h,t[72]=n,t[73]=R):R=t[73];let z;return t[74]!==L||t[75]!==R||t[76]!==x||t[77]!==S||t[78]!==C||t[79]!==w||t[80]!==T||t[81]!==D?(z=(0,X.jsxs)(`article`,{draggable:x,onDragStart:S,onDragEnd:C,onDragOver:w,onDrop:T,className:D,children:[L,R]}),t[74]=L,t[75]=R,t[76]=x,t[77]=S,t[78]=C,t[79]=w,t[80]=T,t[81]=D,t[82]=z):z=t[82],z}function Dn(e){return e.title}function On(e){e.preventDefault(),e.stopPropagation()}function kn({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=(0,Y.useRef)(null),g=(0,Y.useRef)(null),[_,v]=(0,Y.useState)(null),[y,b]=(0,Y.useState)(!1),[x,S]=(0,Y.useState)(null),[C,w]=(0,Y.useState)(`board`),[T,O]=(0,Y.useState)(!1),[j,M]=(0,Y.useState)(()=>crypto.randomUUID()),[P,te]=(0,Y.useState)(``),[B,V]=(0,Y.useState)(`normal`),[H,U]=(0,Y.useState)(``),[ne,re]=(0,Y.useState)([]),[W,ie]=(0,Y.useState)(!1),[ae,oe]=(0,Y.useState)(null),G=$e({chat:k(A(e=>e.language)).chat}),K=nn(e),se=e.filter(e=>e.phase!==`closed`),ce=(e,t)=>void a(e,t),q=async(t,n)=>{let r=e.find(e=>e.id===_);if(v(null),!r||r.id===n)return;let i=K[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=rn(r,t);r.phase!==t&&!l||l&&!await a(r,l)||await o(r.id,n)&&S({taskId:r.id,phase:r.phase,beforeTaskId:c})},le=async e=>{e.preventDefault();let t=P.trim();if(!(!t||W)){ie(!0),oe(null);try{let e=H?new Date(`${H}T23:59:59.999`).getTime():void 0;await u({requestId:j,objective:t,priority:B,dependsOnTaskIds:ne,attachments:G.wireAttachmentsPayload(),...e===void 0?{}:{dueAt:e}}),te(``),V(`normal`),U(``),re([]),G.clearAttachments(),M(crypto.randomUUID()),O(!1)}catch(e){oe(e instanceof Error?e.message:i.createFailed)}finally{ie(!1)}}},ue=()=>{M(crypto.randomUUID()),te(``),V(`normal`),U(``),re([]),G.clearAttachments(),oe(null),O(!0)};(0,Y.useImperativeHandle)(p,()=>({openCreate:ue})),(0,Y.useEffect)(()=>{if(!x)return;let e=window.setTimeout(()=>S(null),6e3);return()=>window.clearTimeout(e)},[x]);let de=(0,Y.useCallback)(e=>{let t=g.current;!t||t.pointerId!==e.pointerId||(g.current=null,b(!1),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),fe=(0,Y.useCallback)(e=>{if(e.button!==0||Sn(e.target))return;let t=h.current;t&&(g.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},[]),J=(0,Y.useCallback)(e=>{let t=g.current,n=h.current;if(!t||!n||t.pointerId!==e.pointerId)return;let r=e.clientX-t.startX;!t.active&&Math.abs(r)<5||(t.active||(t.active=!0,b(!0)),e.preventDefault(),n.scrollLeft=t.scrollLeft-r)},[]);return(0,X.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,X.jsxs)(`div`,{className:`mb-4 flex shrink-0 flex-wrap items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:i.title}),(0,X.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:i.description})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,X.jsx)(xn,{policy:n,copy:i.monitoring,onSave:l}),(0,X.jsxs)(`div`,{className:`flex rounded-lg border border-edge bg-surface-panel p-0.5`,children:[(0,X.jsxs)(`button`,{type:`button`,"aria-pressed":C===`board`,onClick:()=>w(`board`),className:E(`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,X.jsx)(ke,{className:`size-3.5`,"aria-hidden":!0}),i.views.board]}),(0,X.jsxs)(`button`,{type:`button`,"aria-pressed":C===`graph`,onClick:()=>w(`graph`),className:E(`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,X.jsx)(ut,{className:`size-3.5`,"aria-hidden":!0}),i.views.graph]})]})]})]}),C===`board`?(0,X.jsx)(`div`,{ref:h,className:E(`min-h-0 w-full min-w-0 flex-1 overflow-x-auto overflow-y-hidden overscroll-x-contain pb-2 [scrollbar-width:thin]`,y?`cursor-grabbing select-none`:`cursor-grab`),onPointerDown:fe,onPointerMove:J,onPointerUp:de,onPointerCancel:de,onLostPointerCapture:e=>{g.current?.pointerId===e.pointerId&&(g.current=null,b(!1))},children:(0,X.jsx)(`div`,{className:`grid h-full min-h-0 min-w-[103rem] grid-cols-5 gap-3`,children:tn.map(t=>{let n=Cn[t],a=K[t];return(0,X.jsxs)(`section`,{onDragOver:n=>{let r=e.find(e=>e.id===_);r&&(r.phase===t||rn(r,t))&&n.preventDefault()},onDrop:e=>{e.preventDefault(),q(t,null)},className:`flex min-h-0 min-w-0 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-muted/70 p-2.5`,children:[(0,X.jsxs)(`header`,{className:`mb-2.5 flex shrink-0 items-center gap-2 px-0.5`,children:[(0,X.jsxs)(`div`,{className:E(`flex items-center gap-1.5 rounded-md px-2 py-1`,wn[t]),children:[(0,X.jsx)(n,{className:`size-3.5`,"aria-hidden":!0}),(0,X.jsx)(`h3`,{className:`text-sm font-semibold`,children:i.phases[t]})]}),(0,X.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:a.length})]}),(0,X.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,X.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.map(e=>(0,X.jsx)(Q,{task:e,returnTo:r,copy:i,busy:d===e.id,onAction:ce,onDragStart:v,onDropBefore:e=>void q(t,e)},e.id))})})]},t)})})}):(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,X.jsx)(pn,{tasks:e,dependencyEdges:t,returnTo:r,copy:{...i.graph,phases:i.phases},onDependenciesChange:c})}),(0,X.jsx)(ee,{open:T,onOpenChange:e=>{W||O(e)},children:(0,X.jsxs)(L,{children:[(0,X.jsx)(N,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,X.jsxs)(R,{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,X.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,X.jsx)(z,{className:`text-base font-semibold text-fg`,children:i.createTitle}),(0,X.jsx)(F,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:i.createDescription})]}),(0,X.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>void le(e),children:[(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,X.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,X.jsx)(`label`,{htmlFor:`project-task-objective`,className:`font-medium text-fg-muted`,children:i.objective}),(0,X.jsxs)(`div`,{className:E(`overflow-hidden rounded-lg border border-edge bg-surface-base transition-colors focus-within:border-accent`,G.isDragging&&`border-accent bg-accent-soft/30`),onDragOver:e=>{e.preventDefault(),W||G.setIsDragging(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||G.setIsDragging(!1)},onDrop:e=>{e.preventDefault(),G.setIsDragging(!1),W||G.processFiles(Array.from(e.dataTransfer.files))},children:[(0,X.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:P,onChange:e=>{te(e.target.value),oe(null)},placeholder:i.objectivePlaceholder,maxLength:12e3,disabled:W}),(0,X.jsx)(Xe,{attachments:G.attachments,topPadded:!1,onRemove:e=>{W||G.removeAttachment(e)}}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-t border-edge-subtle px-2.5 py-2`,children:[(0,X.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:W,onClick:()=>G.fileInputRef.current?.click(),children:[(0,X.jsx)(Fe,{className:`size-3.5`,"aria-hidden":!0}),i.addFiles]}),(0,X.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:i.attachmentsDescription}),(0,X.jsx)(`input`,{ref:G.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{G.processFiles(Array.from(e.target.files??[])),e.currentTarget.value=``}})]})]})]}),(0,X.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,X.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,X.jsx)(`span`,{className:`font-medium text-fg-muted`,children:i.priority}),(0,X.jsx)(f,{value:B,onChange:e=>V(e.target.value),disabled:W,children:[`low`,`normal`,`high`,`critical`].map(e=>(0,X.jsx)(m,{value:e,children:i.priorityOptions[e]},e))})]}),(0,X.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,X.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[i.dueDate,` `,(0,X.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:i.optional})]}),(0,X.jsx)(kt,{className:`min-h-10 bg-surface-base`,value:H,onChange:U,disabled:W,ariaLabel:i.dueDate})]})]}),(0,X.jsxs)(`fieldset`,{className:`grid gap-2`,children:[(0,X.jsxs)(`legend`,{className:`text-sm font-medium text-fg-muted`,children:[i.dependencies,` `,(0,X.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:i.optional})]}),(0,X.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:i.dependenciesDescription}),(0,X.jsx)(Pt,{candidates:se,selectedIds:ne,disabled:W,onChange:re,labels:{link:i.linkDependencies,linked:i.linkedDependencies,searchPlaceholder:i.dependencySearchPlaceholder,noMatches:i.noDependencyMatches,noCandidates:i.noDependencyCandidates,remove:i.removeDependency}})]}),ae?(0,X.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:ae}):null]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,X.jsx)(I,{asChild:!0,children:(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:W,children:i.cancel})}),(0,X.jsx)(D,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:W||!P.trim(),children:W?i.creating:i.create})]})]})]})]})}),x?(0,X.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,X.jsx)(`span`,{children:i.moved}),(0,X.jsx)(`button`,{type:`button`,className:`font-medium text-accent-fg hover:underline`,onClick:()=>{let e=x;S(null),s(e.taskId,e.phase,e.beforeTaskId).then(t=>{t||S(e)})},children:i.undo})]}):null]})}var An=new Set([{id:`overview`,icon:ae},{id:`tasks`,icon:yt},{id:`automations`,icon:Ke},{id:`files`,icon:Re},{id:`notes`,icon:Qe},{id:`skills`,icon:K},{id:`sessions`,icon:W},{id:`progress`,icon:Ue},{id:`settings`,icon:Me}].map(e=>e.id)),jn=`xopc.projectFiles.panelWidthPx`,Mn=320,Nn=220,Pn=560;function Fn(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 In(e){return Math.min(Pn,Math.max(Nn,Math.round(e)))}function Ln(){try{let e=window.localStorage.getItem(jn);if(e==null)return Mn;let t=Number.parseInt(e,10);return Number.isFinite(t)?In(t):Mn}catch{return Mn}}function Rn(e){try{window.localStorage.setItem(jn,String(In(e)))}catch{}}function zn(e){return!!(e&&An.has(e))}function Bn(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function Vn(e,t=``){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?String(e):H(n)}function Hn(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 Un(e){let t=(0,Vt.c)(8),{label:n,hint:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,X.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,X.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,X.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 Wn(e=!1){return E(`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 Gn(e){let t=(0,Vt.c)(10),{label:n,value:r,mono:i}=e,a=i===void 0?!1:i,o;t[0]===n?o=t[1]:(o=(0,X.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=E(`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,X.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,X.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 Kn(e){return[e.name,e.slug,e.workspaceRoot,e.description,e.brief].filter(Boolean).join(` `).toLowerCase()}function $(e){let t=e.lastActiveAt??e.updatedAt??e.createdAt,n=t?new Date(t).getTime():0;return Number.isFinite(n)?n:0}function qn(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function Jn(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function Yn(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 Xn(e){return e.primaryObject.title?.trim()||e.primaryObject.id}function Zn(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 Qn(e){let t=e.sourceChannel?.trim();if(t)return $n(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 $n(r||``)}function $n(e){let t=e.trim().toLowerCase();return t?t===`tui`?`TUI`:t===`acp`?`ACP`:t===`webchat`?`Webchat`:t:``}function er(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 tr(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 nr(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:nr(e.children,t,n)}:e)}function rr({currentProject:e,pm:t,projectsText:n,wd:r}){let i=a(),[o,s]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)([e]),[m,h]=(0,Y.useState)(``),[_,v]=(0,Y.useState)(!1),[y,b]=(0,Y.useState)(null),[x,S]=(0,Y.useState)(!1),[T,O]=(0,Y.useState)(`new`),[k,A]=(0,Y.useState)(``),[j,M]=(0,Y.useState)(``),[P,te]=(0,Y.useState)(!1),[B,V]=(0,Y.useState)(null),[H,U]=(0,Y.useState)(null),ne=(0,Y.useCallback)(async()=>{v(!0),b(null);try{let t=await q({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){b(e instanceof Error?e.message:String(e))}finally{v(!1)}},[e]);(0,Y.useEffect)(()=>{f(t=>[e,...t.filter(t=>t.id!==e.id)])},[e]),(0,Y.useEffect)(()=>{o&&ne()},[ne,o]);let re=(0,Y.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=Kn(e);return t.every(e=>n.includes(e))}).sort((e,t)=>$(t)-$(e))},[e.id,d,m]),W=e=>t.statuses[e.status]??e.status,ie=e=>e.workspaceRoot||e.effectiveWorkspaceRoot||e.description||e.brief||t.common.defaultWorkspace,ae=e=>{O(e),A(``),M(``),V(null),S(!0),s(!1)},G=(0,Y.useCallback)(async(e={})=>{let t=j.trim(),n=k.trim()||(T===`directory`?qn(t):``);if(n){te(!0),V(null),U(null);try{let r=await J({name:n,...t?{workspaceRoot:t}:{},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});S(!1),A(``),M(``),f(e=>[r,...e.filter(e=>e.id!==r.id)]),i(`/projects/${encodeURIComponent(r.id)}`)}catch(e){let t=Jn(e);t?(U(t),S(!1)):V(e instanceof Error?e.message:String(e))}finally{te(!1)}}},[T,k,i,j]),K=(0,Y.useCallback)(e=>{e.preventDefault(),G()},[G]),se=(0,Y.useCallback)(()=>{G({createWorkspaceRoot:!0})},[G]),ce=(0,Y.useCallback)(()=>{U(null),S(!0)},[]),le=e=>{M(e),T===`directory`&&!k.trim()&&A(qn(e))},ue=(e,t)=>(0,X.jsxs)(`button`,{type:`button`,className:E(`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,X.jsx)(c,{className:E(`size-4 text-accent-fg`,!t&&`invisible`),"aria-hidden":!0}),(0,X.jsxs)(`span`,{className:`min-w-0`,children:[(0,X.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.name}),(0,X.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:ie(e)})]}),(0,X.jsx)(`span`,{className:E(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,Hn(e.status)),children:W(e)})]},e.id);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(u,{open:o,onOpenChange:s,children:[(0,X.jsx)(p,{asChild:!0,children:(0,X.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,X.jsxs)(`span`,{className:`min-w-0`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:e.name}),(0,X.jsx)(`span`,{className:E(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,Hn(e.status)),children:W(e)})]}),(0,X.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:ie(e)})]}),(0,X.jsx)(oe,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":!0})]})}),(0,X.jsx)(l,{children:(0,X.jsxs)(g,{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,X.jsxs)(`label`,{className:`relative block`,children:[(0,X.jsx)(w,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,X.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=>h(e.target.value),placeholder:t.projectSwitcher.searchPlaceholder,"aria-label":t.projectSwitcher.searchPlaceholder})]}),(0,X.jsxs)(`div`,{className:`mt-1 max-h-[min(54vh,24rem)] overflow-y-auto pr-0.5 [scrollbar-gutter:stable]`,children:[(0,X.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.current}),ue(e,!0),(0,X.jsx)(`div`,{className:`px-2 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.recent}),y?(0,X.jsx)(`div`,{className:`p-2 text-xs text-red-600 dark:text-red-400`,children:y}):null,_&&re.length===0?(0,X.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.loading}):null,!_&&re.length===0?(0,X.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.noMatches}):null,re.map(e=>ue(e,!1))]}),(0,X.jsxs)(`div`,{className:`mt-1 border-t border-edge-subtle pt-1`,children:[(0,X.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:()=>ae(`new`),children:[(0,X.jsx)(C,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.newProject})]}),(0,X.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:()=>ae(`directory`),children:[(0,X.jsx)(Re,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.openDirectory})]}),(0,X.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,X.jsx)(Me,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.manageProjects})]})]})]})})]}),(0,X.jsx)(ee,{open:x,onOpenChange:e=>!P&&S(e),children:(0,X.jsxs)(L,{children:[(0,X.jsx)(N,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,X.jsxs)(R,{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,X.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,X.jsx)(z,{className:`text-base font-semibold text-fg`,children:T===`directory`?t.projectSwitcher.createFromDirectoryTitle:n.createTitle}),(0,X.jsx)(F,{className:`mt-1 text-sm text-fg-muted`,children:T===`directory`?t.projectSwitcher.createFromDirectoryDescription:n.createDescription})]}),(0,X.jsxs)(`form`,{onSubmit:K,className:`flex min-h-0 flex-1 flex-col`,children:[(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[B?(0,X.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:B}):null,(0,X.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,X.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.projectName}),(0,X.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:k,onChange:e=>A(e.target.value),placeholder:`xopc`})]}),(0,X.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,X.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.workspaceRoot}),(0,X.jsx)(Ot,{value:j,onChange:le,disabled:P,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,X.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.workspaceHint})]})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,X.jsx)(I,{asChild:!0,children:(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:P,children:n.cancel})}),(0,X.jsxs)(D,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:P||!(k.trim()||T===`directory`&&qn(j)),children:[(0,X.jsx)(C,{className:`size-4`,"aria-hidden":!0}),n.create]})]})]})]})]})}),(0,X.jsx)(ee,{open:!!H,onOpenChange:e=>{e||U(null)},children:(0,X.jsxs)(L,{children:[(0,X.jsx)(N,{className:`fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,X.jsxs)(R,{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,X.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,X.jsx)(z,{className:`text-base font-semibold text-fg`,children:n.workspaceMissingTitle}),(0,X.jsx)(F,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:H?Bn(n.workspaceMissingDescription,{workspace:H}):null})]}),H?(0,X.jsx)(`div`,{className:`px-5 py-4`,children:(0,X.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,X.jsx)(Re,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:H})]})}):null,(0,X.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:ce,disabled:P,children:n.workspaceMissingBack}),(0,X.jsxs)(D,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:se,disabled:P,children:[(0,X.jsx)(rt,{className:`size-4`,"aria-hidden":!0}),n.workspaceMissingCreate]})]})]})]})})]})}function ir(){let{projectId:e=``,tabId:t,noteId:n}=i(),r=a(),[c]=o(),l=A(e=>e.language),u=k(l),d=u.chat.workingDirectory,p=u.projectDetailPage,h=u.projectsPage,g=Ie(e=>e.setPageHeader),_=Ie(e=>e.clearPageHeader),[y,b]=(0,Y.useState)(null),[j,M]=(0,Y.useState)(null),[P,B]=(0,Y.useState)([]),[H,ne]=(0,Y.useState)(``),[oe,q]=(0,Y.useState)([]),[ue,de]=(0,Y.useState)(0),[J,ge]=(0,Y.useState)(!1),[Se,ke]=(0,Y.useState)(!1),[je,Pe]=(0,Y.useState)(!1),[Fe,Le]=(0,Y.useState)([]),ze=(0,Y.useRef)(new Set),[Xe,$e]=(0,Y.useState)(null),[st,pt]=(0,Y.useState)(Ln),[mt,bt]=(0,Y.useState)(!1),[St,Ct]=(0,Y.useState)(!1),[kt,jt]=(0,Y.useState)(``),[Mt,Nt]=(0,Y.useState)([]),[Pt,Ft]=(0,Y.useState)(!1),[It,Lt]=(0,Y.useState)(null),[Rt,zt]=(0,Y.useState)(!1),[Bt,Vt]=(0,Y.useState)(null),[Ht,Ut]=(0,Y.useState)([]),[Wt,Gt]=(0,Y.useState)(``),[Kt,qt]=(0,Y.useState)(!0),[Jt,Xt]=(0,Y.useState)(!1),[Zt,Qt]=(0,Y.useState)(!1),[$t,en]=(0,Y.useState)(null),[tn,nn]=(0,Y.useState)(!1),[rn,an]=(0,Y.useState)(`fixed`),[on,sn]=(0,Y.useState)(``),[cn,ln]=(0,Y.useState)(null),[un,dn]=(0,Y.useState)(!1),[fn,pn]=(0,Y.useState)(!1),[mn,hn]=(0,Y.useState)(!1),[gn,_n]=(0,Y.useState)(null),vn=(0,Y.useRef)(null),yn=(0,Y.useRef)(!1),[bn,Z]=(0,Y.useState)(null),[xn,Sn]=(0,Y.useState)({title:``,reason:``}),[Cn,wn]=(0,Y.useState)({name:``,description:``,status:`active`,defaultAgentId:``,workspaceRoot:``,brief:``,instructions:``}),Tn=(0,Y.useRef)(Cn),En=`overview`,Q=n?`notes`:zn(t)?t:En,Dn=(0,Y.useMemo)(()=>x(c.get(`returnTo`),`/projects`,[`/chat`]),[c]),On=(0,Y.useCallback)(t=>{if(!e)return`/projects`;let n=`/projects/${encodeURIComponent(e)}/${t}`;return Dn===`/projects`?n:S(n,Dn)},[Dn,e]),An=(0,Y.useCallback)(t=>{e&&r(On(t))},[r,e,On]),jn=(0,Y.useCallback)(()=>{if(Q===`tasks`&&vn.current){vn.current.openCreate();return}yn.current=!0,An(`tasks`)},[An,Q]);(0,Y.useEffect)(()=>{Q!==`tasks`||!yn.current||(yn.current=!1,vn.current?.openCreate())},[Q]);let Mn=(0,Y.useCallback)(t=>{e&&r(On(t),{replace:!0})},[r,e,On]),Nn=(0,Y.useCallback)((e,t)=>{Mn(e),r(t)},[r,Mn]),Pn=(0,Y.useCallback)(e=>t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||Mn(e)},[Mn]),Kn=(0,Y.useCallback)(e=>e.startsWith(`/chat/`)?`sessions`:e.startsWith(`/notes`)?`notes`:Q,[Q]);(0,Y.useEffect)(()=>{!e||!t||zn(t)||r(On(En),{replace:!0})},[En,r,e,On,t]),(0,Y.useEffect)(()=>{if(!e)return;let t=!1;return qt(!0),Z(null),Promise.all([le(e),ie(e),se(e),Ye().catch(()=>null)]).then(([e,n,r,i])=>{if(t)return;b(e),M(n),B(r),Ut(i?.agents??[]),Gt(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??``};Tn.current=a,wn(a)}).catch(e=>{t||Z(e instanceof Error?e.message:String(e))}).finally(()=>{t||qt(!1)}),()=>{t=!0}},[e]);let $=(0,Y.useCallback)(async()=>{e&&M(await ie(e))},[e]);(0,Y.useEffect)(()=>{let t,n=n=>{let r=vt.safeParse(n.detail);!r.success||r.data.projectId!==e||(window.clearTimeout(t),t=window.setTimeout(()=>void $(),120))},r=n=>{let r=Ve.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.addEventListener(`task-deleted-v1`,r),()=>{window.clearTimeout(t),window.removeEventListener(`task-changed-v2`,n),window.removeEventListener(`task-deleted-v1`,r)}},[e,$]);let qn=(0,Y.useCallback)(async(e,t)=>{_n(e.id),Z(null);try{let n=await be(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 we(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 ce(e.id,r,n.task.version),await $(),!0}catch(e){return await $().catch(()=>void 0),Z(e instanceof Error?e.message:p.board.actionFailed),!1}finally{_n(null)}},[j,p.board.actionFailed,$]),$n=(0,Y.useCallback)(async t=>{e&&(Z(null),await ve({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,$]),ir=(0,Y.useCallback)(async(e,t)=>{_n(e),Z(null);try{return await Ne(e,t,(await be(e)).task.version),await $(),!0}catch(e){return await $().catch(()=>void 0),Z(e instanceof Error?e.message:p.board.actionFailed),!1}finally{_n(null)}},[p.board.actionFailed,$]),ar=(0,Y.useCallback)(async(e,t,n)=>{_n(e),Z(null);try{let r=await be(e);return r.task.phase!==t&&(r=await ce(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 Ne(e,n,r.task.version),await $(),!0}catch(e){return await $().catch(()=>void 0),Z(e instanceof Error?e.message:p.board.actionFailed),!1}finally{_n(null)}},[p.board.actionFailed,$]),or=(0,Y.useCallback)(async(e,t)=>{_n(e),Z(null);try{await _e(e,t,(await be(e)).task.version),await $()}catch(e){await $().catch(()=>void 0),Z(e instanceof Error?e.message:p.board.actionFailed)}finally{_n(null)}},[p.board.actionFailed,$]),sr=(0,Y.useCallback)(async t=>{if(e){Z(null);try{await Oe(e,t),await $()}catch(e){throw Z(e instanceof Error?e.message:p.board.actionFailed),e}}},[p.board.actionFailed,e,$]),cr=(0,Y.useCallback)(async()=>{if(y){ge(!0),Z(null);try{let e=await fe(y.id,{includeRelated:Se,limit:100});q(e.items),de(e.total)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{ge(!1)}}},[y,Se]);(0,Y.useEffect)(()=>{Q===`progress`&&cr()},[cr,Q]);let lr=(0,Y.useCallback)(async()=>{if(!y?.effectiveWorkspaceRoot?.trim()){Le([]),ze.current.clear(),Vt(null);return}zt(!0),Vt(null),ze.current.clear();try{Le(tr((await he(y.id,``)).entries)),ze.current.add(``)}catch(e){Le([]),ze.current.clear(),Vt(e instanceof Error?e.message:String(e))}finally{zt(!1)}},[y]),ur=(0,Y.useCallback)(async e=>{if(!(!y?.effectiveWorkspaceRoot?.trim()||ze.current.has(e))){ze.current.add(e),Vt(null);try{let t=await he(y.id,e);Le(n=>nr(n,e,tr(t.entries)))}catch(t){ze.current.delete(e),Vt(t instanceof Error?t.message:String(t))}}},[y]);(0,Y.useEffect)(()=>{Q===`files`&&lr()},[lr,Q]);let dr=kt.trim();(0,Y.useEffect)(()=>{if(Q!==`files`||!y||!St||!dr){Nt([]),Ft(!1),Lt(null);return}let e=!1;Ft(!0),Lt(null),Nt([]);let t=window.setTimeout(()=>{Te(y.id,dr,50).then(t=>{e||Nt(t)}).catch(t=>{e||Lt(t instanceof Error?t.message:String(t))}).finally(()=>{e||Ft(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[dr,y,St,Q]);let fr=(0,Y.useCallback)(async()=>{if(y){pn(!0),Z(null);try{let e=await V(y.id);Nn(`sessions`,`/chat/${encodeURIComponent(e.key)}`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{pn(!1)}}},[Nn,y]),pr=(0,Y.useCallback)(async()=>{if(!y)return;let[e,t]=await Promise.all([le(y.id),ie(y.id)]);M(t),b(e)},[y]),mr=(0,Y.useCallback)(async e=>{if(e.preventDefault(),!(!y||!xn.title.trim())){hn(!0),Z(null);try{await tt(y.id,{title:xn.title.trim(),reason:xn.reason.trim()||void 0}),Sn({title:``,reason:``}),await pr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{hn(!1)}}},[xn.reason,xn.title,y,pr]),hr=(0,Y.useMemo)(()=>(0,X.jsx)(s,{to:Dn,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":Dn===`/projects`?p.backToProjects:u.sidebar.back,children:(0,X.jsx)(at,{className:`size-4`,"aria-hidden":!0})}),[Dn,u.sidebar.back,p.backToProjects]),gr=(0,Y.useMemo)(()=>y?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(D,{asChild:!0,variant:`secondary`,className:`h-9 rounded-lg`,children:(0,X.jsxs)(s,{to:`/workflows?tab=library&projectId=${encodeURIComponent(y.id)}`,children:[(0,X.jsx)(ut,{className:`size-4`,"aria-hidden":!0}),p.common.runWorkflow]})}),(0,X.jsxs)(D,{variant:`secondary`,className:`h-9 rounded-lg`,onClick:jn,children:[(0,X.jsx)(C,{className:`size-4`,"aria-hidden":!0}),p.board.create]}),(0,X.jsxs)(D,{variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>void fr(),disabled:fn,children:[(0,X.jsx)(W,{className:`size-4`,"aria-hidden":!0}),p.common.newChat]})]}):null,[jn,p.board.create,p.common.newChat,p.common.runWorkflow,y,fr,fn]);(0,Y.useLayoutEffect)(()=>(g({startExtra:hr,main:y?(0,X.jsx)(rr,{currentProject:y,pm:p,projectsText:h,wd:d}):(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:p.fallbackTitle}),(0,X.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:p.fallbackContext})]}),end:gr}),()=>_()),[_,gr,hr,p,y,h,g,d]);function _r(e){b(t=>t?{...t,...e}:null),Gt(e.defaultAgentId??``),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}async function vr(e=Tn.current){if(!(!y||!Fn(e,y))){Z(null),en(null);try{let t=await xe(y.id,{name:e.name.trim(),status:e.status,description:e.description,defaultAgentId:e.defaultAgentId,brief:e.brief,instructions:e.instructions});_r(t);let n=Tn.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};Tn.current=r,wn(r)}catch(e){let t=Jn(e);throw t?en(t):Z(e instanceof Error?e.message:String(e)),e}}}function yr(e){e.preventDefault(),Mr.flush()}function br(e,t=!1){let n={...Tn.current,...e};Tn.current=n,wn(n),t&&Mr.saveNow(n)}let xr=(0,Y.useCallback)(()=>{if(!y)return;let e=y.workspaceRoot?.trim()??``;an(e?`fixed`:`follow`),sn(e||y.effectiveWorkspaceRoot||``),nn(!0)},[y]);async function Sr(e={}){if(!y)return;let t=rn===`fixed`?on.trim():``;if(!(rn===`fixed`&&!t)){Xt(!0),Z(null),en(null);try{let n=await xe(y.id,{workspaceRoot:t,...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});_r(n),br({workspaceRoot:n.workspaceRoot??``}),nn(!1),en(null)}catch(e){let t=Jn(e);t?(en(t),nn(!1)):Z(e instanceof Error?e.message:String(e))}finally{Xt(!1)}}}async function Cr(){if(!(!y||cn)){ln(`pin`),Z(null);try{_r(y.pinnedAt?await G(y.id):await ye(y.id))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{ln(null)}}}async function wr(){if(!(!y||cn)){ln(`archive`),Z(null);try{let e=y.status===`archived`?await xt(y.id):await re(y.id);_r(e),br({status:e.status})}catch(e){Z(e instanceof Error?e.message:String(e))}finally{ln(null)}}}async function Tr(){if(y){dn(!0),Z(null);try{await et(y.id),Qt(!1),r(`/projects`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{dn(!1)}}}async function Er(){if(!(!y||je)){Pe(!0),Z(null);try{await U(y.id)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Pe(!1)}}}let Dr=(0,Y.useCallback)(e=>{$e(e)},[]),Or=(0,Y.useCallback)((e,t)=>{t||$e(e)},[]),kr=(0,Y.useCallback)(async(e,t,n)=>{let r=y?.id;if(r)switch(e){case`preview`:t.isDirectory||$e(t.path);break;case`download`:if(t.isDirectory)return;try{let e=ht(t.path);if(nt(lt(e))!==`text`){let n=await We(t.path,{projectId:r}),i=te(e)??`application/octet-stream`;_t(e,await n.arrayBuffer(),i)}else{let{content:n}=await dt(t.path,{projectId:r});Be(e,n)}}catch(e){Je(`warning`,e instanceof Error?e.message:String(e),void 0,{duration:4e3})}break;case`copyPath`:try{await O(t.absolutePath??t.path)&&Je(`success`,u.workspace.pathCopied,void 0,{duration:2500})}catch{Je(`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,y?.id]),Ar=(0,Y.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),bt(!0);let r=e.clientX,i=st,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=In(i+(e.clientX-r)),o===0&&(o=window.requestAnimationFrame(l))},d=()=>{o!==0&&(window.cancelAnimationFrame(o),l());try{t.releasePointerCapture(a)}catch{}bt(!1),pt(c),Rn(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)},[st]);(0,Y.useEffect)(()=>{Q!==`files`&&$e(null)},[e,Q]);let jr=!!(y&&Fn(Cn,y)),Mr=Et({value:y?Cn:null,dirty:jr,onSave:vr,validate:e=>e.name.trim()?null:p.settings.nameRequired});if(Kt)return(0,X.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(!y)return(0,X.jsxs)(`main`,{className:`w-full flex-1 p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,X.jsxs)(s,{to:Dn,className:`inline-flex items-center gap-2 text-sm text-accent-fg hover:underline`,children:[(0,X.jsx)(at,{className:`size-4`,"aria-hidden":!0}),Dn===`/projects`?p.backToProjects:u.sidebar.back]}),(0,X.jsx)(`p`,{className:`mt-6 rounded-lg bg-surface-panel p-4 shadow-surface text-sm text-fg-muted`,children:bn||p.notFound})]});let Nr=P.slice(0,6),Pr=j?.blockers??[],Fr=j?.tasks.filter(e=>e.phase!==`closed`)??[],Ir=e=>p.statuses[e]??e,Lr=e=>Bn(p.common.messages,{count:e}),Rr=H.trim().toLowerCase(),zr=Rr?P.filter(e=>{let t=Vn(e.updatedAt),n=e.routing?.agentId||e.agentId||p.common.agent,r=e.name?.trim()||p.sessions.fallbackTitle,i=Lr(e.messageCount??0),a=Qn(e);return[r,e.key,n,a,t,i].filter(Boolean).join(` `).toLowerCase().includes(Rr)}):P,Br=P.length>0&&zr.length===0,Vr=Ht.find(e=>e.id===y.defaultAgentId)?.name||y.defaultAgentId||p.settings.globalDefaultAgent,Hr=Ht.find(e=>e.id===Cn.defaultAgentId),Ur=y.workspaceRoot?.trim()||``,Wr=y.status===`archived`,Gr=!!y.pinnedAt,Kr=!Ur,qr=Ur||Hr?.workspace||y.effectiveWorkspaceRoot||p.common.defaultWorkspace,Jr=rn===`fixed`?on.trim()||p.settings.workspacePlaceholder:Hr?.workspace||y.effectiveWorkspaceRoot||p.common.defaultWorkspace,Yr=(rn===`fixed`?on.trim():``)!==Ur&&(rn===`follow`||!!on.trim()),Xr=[{id:`overview`,icon:ae,label:p.tabs.overview},{id:`tasks`,icon:yt,label:p.tabs.tasks},{id:`automations`,icon:Ke,label:p.tabs.automations},{id:`files`,icon:Re,label:p.tabs.files},{id:`notes`,icon:Qe,label:p.tabs.notes},{id:`skills`,icon:K,label:p.tabs.skills},{id:`sessions`,icon:W,label:p.tabs.sessions},{id:`progress`,icon:Ue,label:p.tabs.progress}];async function Zr(){if(!qr)return;let e=await O(qr);Je(e?`success`:`warning`,e?u.workspace.pathCopied:u.clipboard.copyFailed,void 0,{duration:e?2500:4e3})}function Qr(){en(null),nn(!0)}return(0,X.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,X.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3`,children:[(0,X.jsx)(Dt,{items:Xr,activeTab:Q,onChange:An,ariaLabel:p.navAria,tabIdPrefix:`project-primary-tab`,className:`min-w-0 flex-1`}),(0,X.jsxs)(D,{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:()=>An(`settings`),children:[(0,X.jsx)(Me,{className:`size-4`,"aria-hidden":!0}),p.tabs.settings,jr?(0,X.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500`,"aria-label":p.settings.unsavedChanges}):null]})]}),bn?(0,X.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:bn}):null,(0,X.jsxs)(`div`,{className:E(`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,X.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,X.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,X.jsx)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.directionTitle}),(0,X.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:y.outcome||j?.digest.summary||y.description||y.brief||p.overview.directionFallback}),j?.digest.recommendedAction?(0,X.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm font-medium leading-6 text-fg`,children:Bn(p.overview.recommendedNext,{action:j.digest.recommendedAction})}):null]}),(0,X.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:(0,X.jsxs)(D,{type:`button`,variant:`secondary`,onClick:()=>void Er(),disabled:je,children:[(0,X.jsx)(He,{className:`size-4`,"aria-hidden":!0}),je?p.overview.savingDigest:p.overview.saveDigest]})})]})}),(0,X.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,X.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.nextActions})}),(0,X.jsx)(`div`,{className:`divide-y divide-edge`,children:Fr.length?Fr.map(e=>(0,X.jsxs)(s,{to:De(On(`overview`),e.id),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,X.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,X.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.attention[0].summary}):null]},e.id)):(0,X.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.overview.noNextActions})})]}),j?.recentResults.length?(0,X.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,X.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.recentResults})}),(0,X.jsx)(`div`,{className:`divide-y divide-edge`,children:j.recentResults.slice(0,5).map(({taskId:e,taskTitle:t,receipt:n})=>(0,X.jsxs)(s,{to:De(On(`overview`),e),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),(0,X.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,X.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:n.summary})]},n.runId))})]}):null,(0,X.jsxs)(`div`,{className:`grid min-w-0 gap-4 md:grid-cols-2`,children:[(0,X.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,X.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.milestones})}),(0,X.jsx)(`div`,{className:`divide-y divide-edge`,children:y.milestones.length?y.milestones.map(e=>(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-4 py-3`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,X.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:e.status})]},e.id)):(0,X.jsx)(`p`,{className:`px-4 py-5 text-sm text-fg-muted`,children:p.overview.noMilestones})})]}),(0,X.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,X.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.projectUpdates})}),(0,X.jsx)(`div`,{className:`divide-y divide-edge`,children:y.recentUpdates.length?y.recentUpdates.slice(0,3).map(e=>(0,X.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,X.jsx)(`p`,{className:`text-sm leading-5 text-fg`,children:e.summary}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.health})]},e.id)):(0,X.jsx)(`p`,{className:`px-4 py-5 text-sm text-fg-muted`,children:p.overview.noProjectUpdates})})]})]})]}),(0,X.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,X.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.attention}),Pr.length?(0,X.jsx)(`div`,{className:`mt-3 grid gap-3`,children:Pr.map(e=>{let t=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(Ee,{className:`size-4 text-amber-600 dark:text-amber-300`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title})]}),(0,X.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?` · ${Ir(e.status)}`:``]})]});return e.href?(0,X.jsx)(s,{to:e.href,onClick:Pn(Kn(e.href)),className:`min-w-0 rounded-md bg-surface-base p-3 hover:bg-surface-hover`,children:t},e.id):(0,X.jsx)(`div`,{className:`min-w-0 rounded-md bg-surface-base p-3`,children:t},e.id)})}):(0,X.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:p.overview.noBlockedTasks}),(0,X.jsxs)(`form`,{onSubmit:mr,className:`mt-4 flex gap-2 border-t border-edge pt-4`,children:[(0,X.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:xn.title,onChange:e=>Sn(t=>({...t,title:e.target.value})),placeholder:p.overview.blockerTitlePlaceholder}),(0,X.jsx)(D,{type:`submit`,variant:`secondary`,className:`shrink-0 rounded-lg px-3`,disabled:mn||!xn.title.trim(),"aria-label":mn?p.overview.addingBlocker:p.overview.addBlocker,title:mn?p.overview.addingBlocker:p.overview.addBlocker,children:(0,X.jsx)(C,{className:`size-4`,"aria-hidden":!0})})]})]}),(0,X.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(pe,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,X.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:p.overview.recentSessions})]}),(0,X.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>An(`sessions`),children:p.common.viewAll})]}),(0,X.jsx)(`div`,{className:`divide-y divide-edge`,children:Nr.length?Nr.map(e=>(0,X.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Pn(`sessions`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.name||e.key}),(0,X.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:Vn(e.updatedAt)})]}),(0,X.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:e.agentId||p.common.agent})]},e.key)):(0,X.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.overview.noSessions})})]})]})]}):null,Q===`tasks`?(0,X.jsx)(kn,{ref:vn,tasks:j?.tasks??[],dependencyEdges:j?.dependencyEdges??[],monitoring:j?.monitoring??{projectId:e??``,mode:`observe`,allowedActions:[],confidenceThreshold:.75,scenarios:[],configured:!1},returnTo:On(`tasks`),copy:p.board,onAction:qn,onReorder:ir,onUndoMove:ar,onDependenciesChange:or,onMonitoringChange:sr,onCreate:$n,actionBusyId:gn}):null,Q===`automations`?(0,X.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,X.jsx)(At,{projectId:y.id,embedded:!0,title:p.automations.title,subtitle:p.automations.hint})}):null,Q===`notes`?(0,X.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,X.jsx)(wt,{selectedNoteId:n,basePath:`/projects/${encodeURIComponent(y.id)}/notes`,showLibrary:!1,allowMediaCapture:!1,projectId:y.id,listTitle:p.notes.title,listDescription:p.notes.hint,emptyText:p.notes.emptyTitle,emptyDescription:p.notes.emptyDescription,listWidthStorageKey:`xopc.projectNotes.listWidth.${y.id}`})}):null,Q===`skills`?(0,X.jsx)(Yt,{projectId:y.id,copy:p.skills}):null,Q===`files`?(0,X.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,X.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:y.effectiveWorkspaceRoot?(0,X.jsxs)(`div`,{"data-project-files-grid":!0,className:E(`grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[var(--project-files-panel-width)_6px_minmax(0,1fr)]`,mt&&`cursor-col-resize select-none`),style:{"--project-files-panel-width":`${st}px`},children:[(0,X.jsxs)(`aside`,{className:`flex min-h-0 flex-col border-b border-edge lg:border-b-0 lg:border-r`,children:[(0,X.jsxs)(`div`,{className:`flex h-11 items-center gap-1 border-b border-edge bg-surface-muted/50 px-3 text-sm`,children:[(0,X.jsx)(Ae,{workspacePath:qr}),(0,X.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,X.jsx)(`button`,{type:`button`,className:E(`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,St&&`bg-surface-hover text-fg`),onClick:()=>Ct(!0),"aria-label":p.files.search,title:p.files.search,"aria-pressed":St,children:(0,X.jsx)(w,{className:`size-3.5`,"aria-hidden":!0})}),(0,X.jsx)(Ze,{className:`size-7 shrink-0 rounded-md p-0`,loading:Rt,label:u.cron.refresh,onClick:()=>void lr()})]})]}),St?(0,X.jsx)(`div`,{className:`shrink-0 border-b border-edge bg-surface-muted/40 px-3 py-2`,children:(0,X.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,X.jsx)(w,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,X.jsx)(`input`,{type:`text`,role:`searchbox`,value:kt,onChange:e=>jt(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,X.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:()=>{jt(``),Ct(!1)},children:(0,X.jsx)(T,{className:`size-3.5`,"aria-hidden":!0})})]})}):null,Bt?(0,X.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:Bt}):null,dr?(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-2`,children:Pt?(0,X.jsxs)(`div`,{className:`space-y-2 px-3 py-1`,children:[(0,X.jsx)(ct,{className:`h-11 w-full`}),(0,X.jsx)(ct,{className:`h-11 w-full`}),(0,X.jsx)(ct,{className:`h-11 w-full`})]}):It?(0,X.jsxs)(`p`,{className:`px-3 py-2 text-xs text-red-600 dark:text-red-400`,children:[u.workspace.loadError,`: `,It]}):Mt.length===0?(0,X.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:p.files.noSearchResults}):Mt.map(e=>(0,X.jsxs)(`button`,{type:`button`,className:E(`flex w-full min-w-0 items-center gap-2 px-3 py-2 text-left hover:bg-surface-hover`,Xe===e.path&&`bg-accent-soft text-accent-fg`),onClick:()=>$e(e.path),title:e.path,children:[(0,X.jsx)(Qe,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`span`,{className:`block truncate text-sm text-fg`,children:e.name}),(0,X.jsx)(`span`,{className:`block truncate text-xs text-fg-subtle`,children:e.path})]})]},e.path))}):Rt&&Fe.length===0?(0,X.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.files.loading}):(0,X.jsx)(ot,{tree:Fe,selectedPath:Xe,onSelectFile:Dr,onSelectEntry:Or,onExpandDir:e=>void ur(e),onAction:kr,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,X.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":p.files.resizeHandle,className:E(`hidden cursor-col-resize touch-none items-stretch justify-center bg-surface-panel transition-colors hover:bg-surface-hover lg:flex`,mt&&`bg-surface-hover`),onPointerDown:Ar,children:(0,X.jsx)(`div`,{className:`my-3 w-px rounded-full bg-edge-strong/70`})}),(0,X.jsx)(`div`,{className:`min-h-0 min-w-0 overflow-hidden bg-surface-base`,children:Xe?(0,X.jsx)(Ce,{filePath:Xe,projectId:y.id,agentId:y.defaultAgentId||Wt||void 0,onClose:()=>$e(null)}):(0,X.jsx)(`div`,{className:`flex h-full min-h-[18rem] items-center justify-center px-6 text-center`,children:(0,X.jsxs)(`div`,{className:`max-w-sm`,children:[(0,X.jsx)(Re,{className:`mx-auto size-8 text-fg-subtle`,"aria-hidden":!0}),(0,X.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:p.files.previewEmptyTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.files.previewEmptyDescription})]})})})]}):(0,X.jsxs)(`div`,{className:`grid gap-3 px-4 py-8 text-sm text-fg-muted`,children:[(0,X.jsx)(`p`,{children:p.files.needWorkspace}),(0,X.jsx)(`div`,{children:(0,X.jsx)(D,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>An(`settings`),children:p.files.openSettings})})]})})}):null,Q===`sessions`?(0,X.jsxs)(`section`,{id:`project-panel-sessions`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-sessions`,className:`grid min-h-full content-start gap-3`,children:[P.length?(0,X.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,X.jsx)(w,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,"aria-hidden":!0}),(0,X.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:H,onChange:e=>ne(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`}),H?(0,X.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:()=>ne(``),children:(0,X.jsx)(T,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,zr.length?(0,X.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:zr.map(e=>{let t=Vn(e.updatedAt),n=e.routing?.agentId||e.agentId||p.common.agent,r=Qn(e),i=e.name?.trim()||p.sessions.fallbackTitle,a=Lr(e.messageCount??0);return(0,X.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Pn(`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,X.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,X.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,X.jsx)(W,{className:`size-4`,"aria-hidden":!0})}),(0,X.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-fg`,children:i}),r?(0,X.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,X.jsxs)(`div`,{className:`mt-auto grid gap-2 pt-4 text-xs text-fg-muted`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,X.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,X.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:a})]}),t?(0,X.jsxs)(`span`,{className:`truncate rounded-md bg-surface-base px-2 py-1`,children:[p.sessions.updated,`: `,t]}):null]})]},e.key)})}):Br?(0,X.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,X.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:p.sessions.noMatches})}):(0,X.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:p.sessions.emptyTitle}),(0,X.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,X.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,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.progress.title}),(0,X.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:Bn(p.progress.count,{count:ue})})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.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,X.jsx)(`input`,{type:`checkbox`,checked:Se,onChange:e=>ke(e.currentTarget.checked),className:`size-4 rounded border-edge text-accent focus:ring-accent/30`}),p.progress.includeRelated]}),(0,X.jsxs)(D,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3`,onClick:()=>void cr(),disabled:J,children:[(0,X.jsx)(gt,{className:E(`size-4`,J&&`animate-spin`),"aria-hidden":!0}),p.common.refresh]})]})]}),(0,X.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:J&&oe.length===0?(0,X.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:p.progress.loading}):oe.length?(0,X.jsx)(`div`,{className:`divide-y divide-edge`,children:oe.map(e=>{let t=p.progress.types[e.type]??e.type,n=p.progress.objectKinds[e.primaryObject.kind]??e.primaryObject.kind,r=er(e),i=e.relatedProjects.length>0&&!e.scopes.some(e=>e.scopeKind===`project`&&e.scopeId===y.id);return(0,X.jsxs)(`article`,{className:`grid gap-2 px-4 py-3`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),i?(0,X.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,X.jsxs)(`p`,{className:`mt-1 min-w-0 truncate text-sm text-fg-muted`,children:[n,`: `,Xn(e)]})]}),(0,X.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,dateTime:new Date(e.createdAt).toISOString(),children:Vn(e.createdAt)})]}),r?(0,X.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:r}):null,(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,X.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:[p.progress.actor,`: `,Yn(e)]}),(0,X.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[p.progress.source,`: `,Zn(e)]})]})]},e.id)})}):(0,X.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:p.progress.empty})})]}):null,Q===`settings`?(0,X.jsxs)(`form`,{id:`project-panel-settings`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-settings`,onSubmit:yr,onBlurCapture:Mr.onBlurCapture,className:`grid min-h-full content-start gap-4 pb-1`,children:[(0,X.jsxs)(`section`,{className:`flex min-w-0 items-start justify-between gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.summaryTitle}),(0,X.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:p.settings.summaryHint})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-2`,children:[(0,X.jsx)(`span`,{className:E(`rounded-full px-2 py-0.5 text-xs font-medium`,Hn(Cn.status)),children:p.settings.statuses[Cn.status]}),(0,X.jsx)(Tt,{status:Mr.status,error:Mr.error})]})]}),(0,X.jsxs)(`div`,{className:`grid items-start gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,X.jsxs)(`div`,{className:`grid gap-4`,children:[(0,X.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.detailsTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.detailsHint})]}),(0,X.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,X.jsx)(Un,{label:p.settings.name,children:(0,X.jsx)(`input`,{className:Wn(),value:Cn.name,onChange:e=>br({name:e.target.value})})}),(0,X.jsx)(Un,{label:p.settings.defaultAgent,children:(0,X.jsxs)(f,{className:Wn(),value:Cn.defaultAgentId,onChange:e=>br({defaultAgentId:e.target.value},!0),children:[(0,X.jsx)(m,{value:``,children:p.settings.globalDefaultAgent}),Ht.map(e=>(0,X.jsx)(m,{value:e.id,children:it(e,u.agentsSettings)},e.id))]})}),(0,X.jsx)(Un,{label:p.settings.status,children:Wr?(0,X.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,X.jsxs)(f,{className:Wn(),value:Cn.status===`archived`?`active`:Cn.status,onChange:e=>br({status:e.target.value},!0),children:[(0,X.jsx)(m,{value:`active`,children:p.settings.statuses.active}),(0,X.jsx)(m,{value:`paused`,children:p.settings.statuses.paused})]})}),(0,X.jsx)(Un,{label:p.settings.description,hint:p.settings.descriptionHint,children:(0,X.jsx)(`textarea`,{className:Wn(!0),value:Cn.description,onChange:e=>br({description:e.target.value})})})]})]}),(0,X.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.projectGuidanceTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.projectGuidanceHint})]}),(0,X.jsx)(Un,{label:p.settings.brief,hint:p.settings.briefHint,children:(0,X.jsx)(`textarea`,{className:Wn(!0),value:Cn.brief,onChange:e=>br({brief:e.target.value})})}),(0,X.jsx)(Un,{label:p.settings.instructions,hint:p.settings.instructionsHint,children:(0,X.jsx)(`textarea`,{className:Wn(!0),value:Cn.instructions,onChange:e=>br({instructions:e.target.value})})})]})]}),(0,X.jsxs)(`aside`,{className:`grid gap-4 xl:sticky xl:top-0`,children:[(0,X.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.workspaceRoot}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceIndependentHint})]}),(0,X.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,X.jsx)(`span`,{className:`w-fit rounded-md bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:Kr?p.settings.workspaceModeFollow:p.settings.workspaceModeFixed}),(0,X.jsx)(`div`,{className:`break-all font-mono text-xs leading-5 text-fg`,title:qr,children:qr}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsxs)(D,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void Zr(),children:[(0,X.jsx)(v,{className:`size-4`,"aria-hidden":!0}),p.settings.copyWorkspacePath]}),(0,X.jsx)(Ae,{workspacePath:qr}),(0,X.jsxs)(D,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:xr,children:[(0,X.jsx)(rt,{className:`size-4`,"aria-hidden":!0}),p.settings.migrateWorkspace]})]})]})]}),(0,X.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.currentProjectTitle}),(0,X.jsxs)(`div`,{className:`grid gap-2`,children:[(0,X.jsx)(Gn,{label:p.settings.defaultAgent,value:Vr}),(0,X.jsx)(Gn,{label:p.settings.pinState,value:Gr?p.settings.pinned:p.settings.notPinned}),(0,X.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,X.jsx)(Gn,{label:p.settings.createdAt,value:Vn(y.createdAt)||p.common.never}),(0,X.jsx)(Gn,{label:p.settings.updatedAt,value:Vn(y.updatedAt)||p.common.never})]})]})]}),(0,X.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.managementTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:p.settings.managementHint})]}),(0,X.jsxs)(`div`,{className:`grid gap-3`,children:[(0,X.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Gr?p.settings.pinnedTitle:p.settings.pinTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:p.settings.pinHint})]}),(0,X.jsxs)(D,{type:`button`,variant:`ghost`,className:`w-fit rounded-lg`,disabled:cn===`pin`,onClick:()=>void Cr(),children:[Gr?(0,X.jsx)(Ge,{className:`size-4`,"aria-hidden":!0}):(0,X.jsx)(ft,{className:`size-4`,"aria-hidden":!0}),Gr?p.settings.unpinProject:p.settings.pinProject]})]}),(0,X.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Wr?p.settings.restoreTitle:p.settings.archiveTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:Wr?p.settings.restoreHint:p.settings.archiveHint})]}),(0,X.jsxs)(D,{type:`button`,variant:Wr?`primary`:`ghost`,className:`w-fit rounded-lg`,disabled:cn===`archive`,onClick:()=>void wr(),children:[Wr?(0,X.jsx)(gt,{className:`size-4`,"aria-hidden":!0}):(0,X.jsx)(qe,{className:`size-4`,"aria-hidden":!0}),Wr?p.settings.restoreProject:p.settings.archiveProject]})]})]})]}),(0,X.jsxs)(`section`,{className:`grid gap-3 rounded-lg border border-red-500/20 bg-red-500/5 p-4`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-red-700 dark:text-red-300`,children:p.settings.dangerTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-red-700/80 dark:text-red-200/80`,children:p.settings.dangerHint})]}),(0,X.jsxs)(D,{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:()=>Qt(!0),children:[(0,X.jsx)(me,{className:`size-4`,"aria-hidden":!0}),p.settings.deleteConfirmAction]})]})]})]})]}):null]}),(0,X.jsx)(ee,{open:Zt,onOpenChange:e=>{un||Qt(e)},children:(0,X.jsxs)(L,{children:[(0,X.jsx)(N,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,X.jsxs)(R,{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,X.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,X.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,X.jsx)(Ee,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(z,{className:`text-base font-semibold text-fg`,children:p.settings.deleteConfirmTitle}),(0,X.jsx)(F,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:y?Bn(p.settings.deleteConfirm,{name:y.name}):p.settings.deleteConfirmFallback})]})]}),(0,X.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,X.jsx)(I,{asChild:!0,children:(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:un,children:p.common.cancel})}),(0,X.jsxs)(D,{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:un||!y,onClick:()=>void Tr(),children:[(0,X.jsx)(me,{className:`size-4`,"aria-hidden":!0}),p.settings.deleteConfirmAction]})]})]})]})}),(0,X.jsx)(ee,{open:tn,onOpenChange:e=>{Jt||nn(e)},children:(0,X.jsxs)(L,{children:[(0,X.jsx)(N,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,X.jsxs)(R,{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,X.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,X.jsx)(z,{className:`text-base font-semibold text-fg`,children:p.settings.workspaceMigrationTitle}),(0,X.jsx)(F,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.workspaceMigrationDescription})]}),(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,X.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,X.jsx)(`span`,{className:`font-medium text-fg-muted`,children:p.settings.workspaceMode}),(0,X.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[(0,X.jsxs)(`label`,{className:E(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,rn===`fixed`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,X.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:rn===`fixed`,onChange:()=>an(`fixed`),disabled:Jt}),(0,X.jsxs)(`span`,{className:`min-w-0`,children:[(0,X.jsx)(`span`,{className:`block font-medium`,children:p.settings.workspaceModeFixed}),(0,X.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceMigrationFixedHint})]})]}),(0,X.jsxs)(`label`,{className:E(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,rn===`follow`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,X.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:rn===`follow`,onChange:()=>an(`follow`),disabled:Jt}),(0,X.jsxs)(`span`,{className:`min-w-0`,children:[(0,X.jsx)(`span`,{className:`block font-medium`,children:p.settings.workspaceModeFollow}),(0,X.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceHint})]})]})]})]}),rn===`fixed`?(0,X.jsx)(Ot,{value:on,onChange:sn,disabled:Jt,wd:d,placeholder:p.settings.workspacePlaceholder,inputClassName:Wn(),autoFocus:!0}):null,(0,X.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,X.jsx)(`div`,{className:`rounded-lg bg-surface-muted px-3 py-2 text-xs leading-5 text-fg-subtle`,children:Bn(p.settings.workspaceCurrent,{workspace:Jr})})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,X.jsx)(I,{asChild:!0,children:(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:Jt,children:p.common.cancel})}),(0,X.jsxs)(D,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:Jt||!Yr,onClick:()=>void Sr(),children:[(0,X.jsx)(rt,{className:`size-4`,"aria-hidden":!0}),p.settings.workspaceMigrationConfirm]})]})]})]})}),(0,X.jsx)(ee,{open:!!$t,onOpenChange:e=>{e||en(null)},children:(0,X.jsxs)(L,{children:[(0,X.jsx)(N,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,X.jsxs)(R,{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,X.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,X.jsx)(z,{className:`text-base font-semibold text-fg`,children:p.settings.workspaceMissingTitle}),(0,X.jsx)(F,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:$t?Bn(p.settings.workspaceMissingDescription,{workspace:$t}):null})]}),$t?(0,X.jsx)(`div`,{className:`px-5 py-4`,children:(0,X.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,X.jsx)(Re,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:$t})]})}):null,(0,X.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:Qr,disabled:Jt,children:p.settings.workspaceMissingBack}),(0,X.jsxs)(D,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:()=>void Sr({createWorkspaceRoot:!0}),disabled:Jt,children:[(0,X.jsx)(rt,{className:`size-4`,"aria-hidden":!0}),p.settings.workspaceMissingCreate]})]})]})]})})]})}export{ir 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,l as a,p as o,t as s}from"./chunk-KS7C4IRE-BaASWQor.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,t as h,u as g}from"./popover-select-CccGri5Y.js";import{t as _}from"./circle-check-C23XjkUj.js";import{t as v}from"./copy-Dv6d4Dvw.js";import{t as y}from"./download-Dk-ZjtO6.js";import{t as b}from"./external-link-DjqjBmc3.js";import{d as x,p as S}from"./markdown-view-DvM5PWEH.js";import{t as C}from"./plus-Q2yW6OE7.js";import{t as w}from"./search-DA7gz22f.js";import{t as T}from"./x-B_N4OPjy.js";import{t as E}from"./cn-JdwAhgNB.js";import{t as D}from"./button-CSEbl4zT.js";import{t as O}from"./copy-to-clipboard-HOJ79TWv.js";import{t as k}from"./messages-BMdD0LWk.js";import{n as A,r as j,s as M}from"./locale-store-CXhjfe4q.js";import{a as N,c as P,i as F,n as I,o as L,r as R,s as z,t as ee}from"./dist-BPoKqzeH.js";import{$a as te,$c as B,Aa as V,Ai as H,Ba as U,Cs as ne,Da as re,Dc as W,Fa as ie,Gc as ae,Gl as oe,Ha as G,Hs as K,Ia as se,L as ce,La as q,Ma as le,Mc as ue,Ml as de,Na as fe,Oa as J,Ol as pe,Os as me,Pa as he,Ps as ge,Q as _e,R as ve,Ra as ye,U as be,Ua as xe,Ul as Se,Un as Ce,V as we,Va as Te,Vl as Ee,Vn as De,Wa as Oe,Wc as ke,Wi as Ae,Wl as je,Xs as Me,Z as Ne,Zs as Pe,_c as Fe,_o as Ie,bs as Le,cl as Re,cu as ze,da as Be,do as Ve,ec as He,el as Ue,fa as We,fc as Ge,fs as Ke,fu as qe,ga as Je,gr as Ye,gt as Xe,ha as Ze,hl as Qe,it as $e,ja as et,ka as tt,la as nt,ll as rt,lr as it,lu as at,ma as ot,ml as st,no as ct,oa as lt,ol as ut,pa as dt,pc as ft,ql as pt,qs as mt,sa as ht,tc as gt,ua as _t,uo as vt,wl as yt,wr as bt,za as xt,zc as St,zl as Ct}from"./index-BNWhgmjs.js";import{t as wt}from"./notes-workbench-DmVYu_Oc.js";import{n as Tt,t as Et}from"./use-autosave-DnnZtMpA.js";import{t as Dt}from"./page-tabs-BaEQMYm_.js";import{t as Ot}from"./directory-picker-path-field-Caaz4Rw5.js";import{t as kt}from"./date-picker-8R1sXJKb.js";import{t as At}from"./automations-workspace-CD0E2ThS.js";import{i as jt,p as Mt,s as Nt}from"./skills-page.utils-DYaAddUL.js";import{t as Pt}from"./dependency-picker-CWur0821.js";import{c as Ft,l as It,n as Lt,o as Rt,r as zt,t as Bt}from"./style-TIDOdKy0.js";var Y=e(t(),1),Vt=n();function Ht(e){return M(j(`/api/projects/${encodeURIComponent(e)}/skills`))}function Ut(e,t){return M(j(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`))}function Wt(e,t){return M(j(`/api/projects/${encodeURIComponent(e)}/workspace-trust`),{method:`PATCH`,body:JSON.stringify({trusted:t})})}function Gt(e,t){let n=new FormData;return n.set(`file`,t),M(j(`/api/projects/${encodeURIComponent(e)}/skills/upload`),{method:`POST`,body:n})}function Kt(e,t,n={}){return M(j(`/api/projects/${encodeURIComponent(e)}/skills/marketplace/install`),{method:`POST`,body:JSON.stringify({name:t,...n})})}function qt(e,t){return M(j(`/api/projects/${encodeURIComponent(e)}/skills/source/install`),{method:`POST`,body:JSON.stringify({source:t})})}function Jt(e,t){return M(j(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`),{method:`DELETE`})}var X=r();function Yt({projectId:e,copy:t}){let[n,r]=(0,Y.useState)([]),[i,a]=(0,Y.useState)([]),[o,s]=(0,Y.useState)([]),[c,d]=(0,Y.useState)([]),[f,m]=(0,Y.useState)([]),[_,v]=(0,Y.useState)(``),[b,x]=(0,Y.useState)(null),[S,O]=(0,Y.useState)(!1),[k,A]=(0,Y.useState)(!0),[j,M]=(0,Y.useState)(!1),[P,F]=(0,Y.useState)(null),[te,B]=(0,Y.useState)(``),[V,H]=(0,Y.useState)(null),[U,re]=(0,Y.useState)(null),[W,ie]=(0,Y.useState)(``),[ae,G]=(0,Y.useState)(1),[K,ce]=(0,Y.useState)(null),[q,le]=(0,Y.useState)(!1),[de,fe]=(0,Y.useState)(``),[J,pe]=(0,Y.useState)(``),me=(0,Y.useRef)(null),he=(0,Y.useCallback)(async()=>{A(!0),B(``);try{let t=await Ht(e);r(t.items),a(t.inheritedItems),s(t.sources),d(t.diagnostics)}catch(e){B(e instanceof Error?e.message:String(e))}finally{A(!1)}},[e]);(0,Y.useEffect)(()=>{he()},[he]),(0,Y.useEffect)(()=>{let t=!1;return se(e).then(e=>{t||m(e)}).catch(()=>{t||m([])}),()=>{t=!0}},[e]),(0,Y.useEffect)(()=>{if(!_){x(null);return}let e=f.find(e=>e.key===_),t=!1;return x(null),B(``),O(!0),bt(e?.agentId??e?.routing?.agentId,_,!0).then(e=>{t||x(e)}).catch(e=>{t||B(e instanceof Error?e.message:String(e))}).finally(()=>{t||O(!1)}),()=>{t=!0}},[_,f]),(0,Y.useEffect)(()=>{if(V!==`marketplace`)return;let e=new AbortController,t=window.setTimeout(()=>{le(!0),fe(``),Mt({q:W,page:ae,pageSize:8,sort:`downloads`,signal:e.signal}).then(ce).catch(t=>{e.signal.aborted||fe(t instanceof Error?t.message:String(t))}).finally(()=>{e.signal.aborted||le(!1)})},250);return()=>{window.clearTimeout(t),e.abort()}},[V,ae,W]);async function _e(e,t){M(!0),F(t??null),B(``);try{await e(),H(null),pe(``),await he()}catch(e){B(e instanceof Error?e.message:String(e))}finally{M(!1),F(null)}}async function ve(t){B(``);try{re((await Ut(e,t)).skill)}catch(e){B(e instanceof Error?e.message:String(e))}}async function ye(n){if(n.removable&&window.confirm(t.removeConfirm.replace(`{{name}}`,n.name))){M(!0);try{await Jt(e,n.directoryId),await he()}catch(e){B(e instanceof Error?e.message:String(e))}finally{M(!1)}}}async function be(){M(!0),B(``);try{await Wt(e,!0),await he()}catch(e){B(e instanceof Error?e.message:String(e))}finally{M(!1)}}let xe=o.find(e=>e.origin===`agents-workspace`),Ce=new Map(b?.skills.map(e=>[e.name,e]));return(0,X.jsxs)(`section`,{id:`project-panel-skills`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-skills`,className:`grid content-start gap-4`,children:[(0,X.jsxs)(`div`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.title}),(0,X.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,X.jsxs)(u,{children:[(0,X.jsx)(p,{asChild:!0,children:(0,X.jsxs)(D,{type:`button`,children:[(0,X.jsx)(C,{className:`size-4`,"aria-hidden":!0}),t.add,(0,X.jsx)(oe,{className:`size-3.5`,"aria-hidden":!0})]})}),(0,X.jsx)(l,{children:(0,X.jsxs)(g,{align:`end`,sideOffset:8,className:`z-50 w-72 rounded-lg border border-edge bg-surface-panel p-1.5 shadow-xl`,children:[(0,X.jsx)($t,{icon:ge,title:t.marketplace,hint:t.marketplaceHint,onClick:()=>H(`marketplace`)}),(0,X.jsx)($t,{icon:ut,title:t.source,hint:t.sourceHint,onClick:()=>H(`source`)}),(0,X.jsx)($t,{icon:ne,title:t.upload,hint:t.uploadHint,onClick:()=>me.current?.click()})]})})]}),(0,X.jsx)(`input`,{ref:me,type:`file`,accept:`.zip,application/zip`,className:`hidden`,onChange:t=>{let n=t.target.files?.[0];n&&_e(()=>Gt(e,n)),t.target.value=``}})]}),o.length?(0,X.jsx)(`div`,{className:`mt-3 grid gap-2 rounded-md border border-edge-subtle bg-surface-base p-3`,children:o.map(e=>(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-xs`,children:[(0,X.jsx)(`span`,{className:`font-medium text-fg`,children:e.origin===`xopc-workspace`?t.xopcSource:t.agentsSource}),e.writable?null:(0,X.jsx)(`span`,{className:`rounded bg-surface-hover px-1.5 py-0.5 text-fg-muted`,children:t.sourceReadOnly}),(0,X.jsx)(`span`,{className:`text-fg-subtle`,children:en(t,e.state)}),(0,X.jsxs)(`span`,{className:`min-w-0 break-all font-mono text-fg-subtle`,children:[t.path,`: `,e.rootDir]})]},e.origin))}):null]}),te?(0,X.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:te}):null,xe?.state===`untrusted`?(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-lg border border-amber-500/30 bg-amber-500/10 px-4 py-3`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,X.jsx)(ue,{className:`mt-0.5 size-4 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.trustTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.trustHint})]})]}),(0,X.jsxs)(D,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>void be(),children:[(0,X.jsx)(mt,{className:`size-4`,"aria-hidden":!0}),j?t.trusting:t.trustAction]})]}):null,c.some(e=>e.type!==`skipped`)?(0,X.jsxs)(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 px-4 py-3`,children:[(0,X.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.diagnosticsTitle}),(0,X.jsx)(`ul`,{className:`mt-2 grid gap-1 text-xs leading-5 text-fg-muted`,children:c.filter(e=>e.type!==`skipped`).map((e,t)=>(0,X.jsx)(`li`,{children:e.message},`${e.type}:${e.path??``}:${t}`))})]}):null,f.length?(0,X.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3 rounded-lg border border-edge bg-surface-panel p-4`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.sessionViewLabel}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:S?t.sessionLoading:_?b?.agentId:t.sessionViewAll})]}),(0,X.jsx)(h,{value:_,options:f.map(e=>({value:e.key,label:e.name?.trim()||`${t.sessionFallback} · ${e.key.slice(-12)}`})),placeholder:t.sessionViewAll,emptyLabel:t.sessionViewAll,triggerClassName:`w-[min(24rem,calc(100vw-3rem))]`,onChange:v})]}):null,k?(0,X.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(e=>(0,X.jsx)(ct,{className:`h-36 rounded-lg`},e))}):n.length?(0,X.jsx)(Xt,{title:t.localTitle,items:n,copy:t,busy:j,availabilityByName:Ce,onPreview:ve,onRemove:ye}):(0,X.jsxs)(`div`,{className:`rounded-lg border border-dashed border-edge bg-surface-panel px-6 py-12 text-center`,children:[(0,X.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.empty}),(0,X.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:t.emptyHint})]}),!k&&i.length?(0,X.jsx)(Xt,{title:t.inheritedTitle,hint:t.inheritedHint,items:i,copy:t,busy:j,availabilityByName:Ce,onPreview:ve,onRemove:ye}):null,(0,X.jsx)(ee,{open:V!==null,onOpenChange:e=>{e||H(null)},children:(0,X.jsxs)(L,{children:[(0,X.jsx)(N,{className:`fixed inset-0 z-50 bg-black/45`}),(0,X.jsxs)(R,{className:E(`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`,V===`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,X.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,X.jsx)(z,{className:`text-base font-semibold text-fg`,children:V===`marketplace`?t.marketplace:t.source}),(0,X.jsx)(I,{asChild:!0,children:(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,X.jsx)(T,{className:`size-4`})})})]}),(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:V===`marketplace`?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.marketplace}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.marketplaceHint}),(0,X.jsxs)(`div`,{className:`relative mt-3`,children:[(0,X.jsx)(w,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,X.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:W,onChange:e=>{ie(e.target.value),G(1)},placeholder:t.marketplacePlaceholder,autoFocus:!0})]}),de?(0,X.jsx)(`p`,{className:`mt-3 text-sm text-red-600 dark:text-red-300`,children:de}):null,q&&!K?(0,X.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[0,1,2,3].map(e=>(0,X.jsx)(ct,{className:`h-32 rounded-lg`},e))}):K?.items.length?(0,X.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:K.items.map(r=>{let i=r.providerId??K.provider,a=jt(r,i),o=n.some(e=>e.origin===`xopc-workspace`&&(e.directoryId===r.id||e.directoryId===a||e.name===r.name)),s=P===a;return(0,X.jsxs)(`article`,{className:`group flex min-h-32 gap-3 rounded-lg border border-edge bg-surface-base p-3`,children:[(0,X.jsx)(Nt,{name:r.name,className:`size-10`}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,X.jsx)(`h4`,{className:`truncate text-sm font-semibold text-fg`,children:r.name}),(0,X.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:r.description||`—`}),(0,X.jsxs)(`div`,{className:`mt-auto flex items-end justify-between gap-2 pt-2`,children:[(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-fg-subtle`,children:[(0,X.jsx)(y,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceDownloads,` `,r.downloads]}),(0,X.jsx)(D,{type:`button`,className:`h-8 px-2.5 text-xs`,variant:o?`secondary`:`primary`,disabled:j||o,onClick:()=>void _e(()=>Kt(e,a,{provider:i}),a),children:o?t.marketplaceInstalled:s?t.installing:t.install})]})]})]},`${i??`default`}:${r.id}`)})}):q?null:(0,X.jsx)(`p`,{className:`mt-6 text-center text-sm text-fg-muted`,children:t.marketplaceEmpty}),K&&K.meta.totalPages>1?(0,X.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,X.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t.marketplacePage.replace(`{{page}}`,String(K.meta.page)).replace(`{{total}}`,String(K.meta.totalPages))}),(0,X.jsxs)(`div`,{className:`flex gap-2`,children:[(0,X.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:q||ae<=1,onClick:()=>G(e=>Math.max(1,e-1)),children:[(0,X.jsx)(je,{className:`size-4`}),t.marketplacePrevious]}),(0,X.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:q||ae>=K.meta.totalPages,onClick:()=>G(e=>e+1),children:[t.marketplaceNext,(0,X.jsx)(Se,{className:`size-4`})]})]})]}):null]}):(0,X.jsxs)(`section`,{className:`flex h-full flex-col`,children:[(0,X.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:t.sourceHint}),(0,X.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:J,onChange:e=>pe(e.target.value),placeholder:t.sourcePlaceholder,autoFocus:!0}),(0,X.jsxs)(`div`,{className:`mt-auto flex justify-end gap-2 border-t border-edge pt-4`,children:[(0,X.jsx)(I,{asChild:!0,children:(0,X.jsx)(D,{type:`button`,variant:`secondary`,children:t.close})}),(0,X.jsx)(D,{type:`button`,disabled:j||!J.trim(),onClick:()=>void _e(()=>qt(e,J.trim())),children:j?t.installing:t.install})]})]})})]})]})}),(0,X.jsx)(ee,{open:!!U,onOpenChange:e=>{e||re(null)},children:(0,X.jsxs)(L,{children:[(0,X.jsx)(N,{className:`fixed inset-0 z-50 bg-black/45`}),(0,X.jsxs)(R,{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,X.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,X.jsx)(z,{className:`text-base font-semibold text-fg`,children:U?.name}),(0,X.jsx)(I,{asChild:!0,children:(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,X.jsx)(T,{className:`size-4`})})})]}),(0,X.jsx)(`pre`,{className:`min-h-0 flex-1 overflow-auto whitespace-pre-wrap p-5 text-sm leading-6 text-fg-muted`,children:U?.bodyMarkdown})]})]})})]})}function Xt(e){let t=(0,Vt.c)(25),{title:n,hint:r,items:i,copy:a,busy:o,availabilityByName:s,onPreview:c,onRemove:l}=e,u;t[0]===n?u=t[1]:(u=(0,X.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n}),t[0]=n,t[1]=u);let d;t[2]===r?d=t[3]:(d=r?(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:r}):null,t[2]=r,t[3]=d);let f;t[4]!==u||t[5]!==d?(f=(0,X.jsxs)(`div`,{children:[u,d]}),t[4]=u,t[5]=d,t[6]=f):f=t[6];let p;if(t[7]!==s||t[8]!==o||t[9]!==a||t[10]!==i||t[11]!==c||t[12]!==l){let e;t[14]!==s||t[15]!==o||t[16]!==a||t[17]!==c||t[18]!==l?(e=e=>{let t=e.effective?s.get(e.name):void 0;return(0,X.jsxs)(`article`,{className:E(`flex min-h-36 flex-col rounded-lg border border-edge bg-surface-panel p-4`,!e.effective&&`opacity-70`),children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(qe,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,X.jsx)(`h4`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:e.name})]}),(0,X.jsx)(`p`,{className:`mt-2 line-clamp-2 flex-1 text-sm leading-5 text-fg-muted`,children:e.description||e.directoryId}),(0,X.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5 text-[11px] text-fg-subtle`,children:[(0,X.jsx)(`span`,{className:`rounded-md bg-surface-hover/70 px-2 py-0.5`,children:Zt(a,e.origin)}),e.writable?null:(0,X.jsx)(`span`,{className:`rounded-md bg-surface-hover/70 px-2 py-0.5`,children:a.sourceReadOnly}),e.effective?null:(0,X.jsx)(`span`,{className:`rounded-md bg-amber-500/10 px-2 py-0.5 text-amber-800 dark:text-amber-200`,children:a.shadowed}),t?(0,X.jsx)(`span`,{className:E(`rounded-md px-2 py-0.5`,t.availableForCurrentAgent?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-amber-500/10 text-amber-800 dark:text-amber-200`),children:Qt(a,t)}):null]}),(0,X.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,X.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>void c(e.key),children:[(0,X.jsx)(b,{className:`size-3.5`,"aria-hidden":!0}),a.view]}),e.removable?(0,X.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-red-600`,disabled:o,onClick:()=>void l(e),children:[(0,X.jsx)(me,{className:`size-3.5`,"aria-hidden":!0}),a.remove]}):null]})]},e.key)},t[14]=s,t[15]=o,t[16]=a,t[17]=c,t[18]=l,t[19]=e):e=t[19],p=i.map(e),t[7]=s,t[8]=o,t[9]=a,t[10]=i,t[11]=c,t[12]=l,t[13]=p}else p=t[13];let m;t[20]===p?m=t[21]:(m=(0,X.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:p}),t[20]=p,t[21]=m);let h;return t[22]!==f||t[23]!==m?(h=(0,X.jsxs)(`section`,{className:`grid gap-3`,children:[f,m]}),t[22]=f,t[23]=m,t[24]=h):h=t[24],h}function Zt(e,t){switch(t){case`xopc-workspace`:return e.xopcSource;case`agents-workspace`:return e.agentsSource;case`xopc-global`:case`custom-global`:return e.globalXopcSource;case`agents-global`:return e.globalAgentsSource;case`bundled`:return e.bundledSource;case`extra`:return e.extraSource}}function Qt(e,t){if(t.availableForCurrentAgent)return e.sessionAvailable;switch(t.unavailableReason){case`agent-denied`:return e.sessionUnavailableAgent;case`disabled`:return e.sessionUnavailableDisabled;case`requirements-unmet`:return e.sessionUnavailableRequirements;case`model-invocation-disabled`:return e.sessionUnavailableModel;case`tool-gated`:return e.sessionUnavailableTools;default:return e.sessionUnavailableAgent}}function $t(e){let t=(0,Vt.c)(13),{icon:n,title:r,hint:i,onClick:a}=e,o;t[0]===n?o=t[1]:(o=(0,X.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,X.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,X.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,X.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,X.jsx)(d,{asChild:!0,children:(0,X.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}function en(e,t){switch(t){case`active`:return e.sourceStateActive;case`missing`:return e.sourceStateMissing;case`disabled`:return e.sourceStateDisabled;case`untrusted`:return e.sourceStateUntrusted;case`invalid`:return e.sourceStateInvalid}}var tn=[`backlog`,`ready`,`active`,`review`,`closed`];function nn(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 rn(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 an(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 on(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 sn(e,t){let n=new Set(e.map(e=>e.id)),{outgoing:r,incoming:i}=on(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 cn(e,t){let{incoming:n}=on(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 ln(e,t){let{incoming:n,outgoing:r}=on(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 un={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 dn(e){let t=(0,Vt.c)(25),{data:n,selected:r}=e,i=n.task,a=i.operationalState===`waiting`||i.operationalState===`blocked`,o=un[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=E(`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,X.jsx)(zt,{type:`target`,position:It.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,X.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,X.jsx)(B,{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,X.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,X.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,X.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,X.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,X.jsx)(zt,{type:`source`,position:It.Right,className:`!size-3 !border-2 !border-surface-panel !bg-accent opacity-60 transition-opacity group-hover:opacity-100`}),t[20]=_):_=t[20];let v;return t[21]!==g||t[22]!==l||t[23]!==p?(v=(0,X.jsxs)(`div`,{className:l,children:[u,p,g,_]}),t[21]=g,t[22]=l,t[23]=p,t[24]=v):v=t[24],v}var fn={taskNode:dn};function pn(e){let t=(0,Vt.c)(90),{tasks:n,dependencyEdges:r,returnTo:i,copy:a,onDependenciesChange:o}=e,[c,l]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(),[m,h]=(0,Y.useState)(),g=(0,Y.useRef)(null),_;t[0]!==r||t[1]!==n?(_=cn(n,r),t[0]=r,t[1]=n,t[2]=_):_=t[2];let v=_,y;t[3]!==v||t[4]!==u||t[5]!==c||t[6]!==n?(y=u?n.filter(e=>v.has(e.id)):c?n:n.filter(Z),t[3]=v,t[4]=u,t[5]=c,t[6]=n,t[7]=y):y=t[7];let x=y,S;t[8]===x?S=t[9]:(S=new Set(x.map(bn)),t[8]=x,t[9]=S);let C=S,w;if(t[10]!==r||t[11]!==C){let e;t[13]===C?e=t[14]:(e=e=>C.has(e.dependencyTaskId)&&C.has(e.dependentTaskId),t[13]=C,t[14]=e),w=r.filter(e),t[10]=r,t[11]=C,t[12]=w}else w=t[12];let T=w,O;t[15]!==T||t[16]!==x?(O=sn(x,T),t[15]=T,t[16]=x,t[17]=O):O=t[17];let k=O,A;t[18]!==f||t[19]!==T?(A=f?ln(f,T):void 0,t[18]=f,t[19]=T,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=x.find(M),P;t[23]===x?P=t[24]:(P=new Map(x.map(yn)),t[23]=x,t[24]=P);let F=P,I;if(t[25]!==a.phases||t[26]!==k||t[27]!==j||t[28]!==x){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],I=x.map(e),t[25]=a.phases,t[26]=k,t[27]=j,t[28]=x,t[29]=I}else I=t[29];let L=I,R;if(t[34]!==j||t[35]!==F||t[36]!==T){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:Ft.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],R=T.map(e),t[34]=j,t[35]=F,t[36]=T,t[37]=R}else R=t[37];let z=R,ee,te;t[41]!==f||t[42]!==C?(ee=()=>{f&&!C.has(f)&&p(void 0)},te=[f,C],t[41]=f,t[42]=C,t[43]=ee,t[44]=te):(ee=t[43],te=t[44]),(0,Y.useEffect)(ee,te);let B,V;t[45]!==z||t[46]!==m?(B=()=>{m&&!z.some(e=>e.id===m)&&h(void 0)},V=[z,m],t[45]=z,t[46]=m,t[47]=B,t[48]=V):(B=t[47],V=t[48]),(0,Y.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]!==x.length?(U=[u,c,x.length],t[50]=u,t[51]=c,t[52]=x.length,t[53]=U):U=t[53],(0,Y.useEffect)(H,U);let ne;t[54]===f?ne=t[55]:(ne=()=>{f&&g.current?.fitView({nodes:[{id:f}],padding:1.5,minZoom:.7,maxZoom:1,duration:250})},t[54]=f,t[55]=ne);let re=ne,W;t[56]!==r||t[57]!==o?(W=e=>{if(!e.source||!e.target||e.source===e.target)return;let t=r.filter(t=>t.dependentTaskId===e.target).map(vn);t.includes(e.source)||o(e.target,[...t,e.source])},t[56]=r,t[57]=o,t[58]=W):W=t[58];let ie=W,ae;t[59]!==r||t[60]!==o||t[61]!==m?(ae=()=>{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(_n)))},t[59]=r,t[60]=o,t[61]=m,t[62]=ae):ae=t[62];let oe=ae,G;t[63]===a.connectHint?G=t[64]:(G=(0,X.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.connectHint}),t[63]=a.connectHint,t[64]=G);let K=u?`secondary`:`ghost`,se;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(se=()=>d(gn),t[65]=se):se=t[65];let ce=u?a.allTasks:a.blockedChains,q;t[66]!==u||t[67]!==K||t[68]!==ce?(q=(0,X.jsx)(D,{type:`button`,variant:K,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":u,onClick:se,children:ce}),t[66]=u,t[67]=K,t[68]=ce,t[69]=q):q=t[69];let le;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(le=()=>l(hn),t[70]=le):le=t[70];let ue=c?a.hideCompleted:a.showCompleted,de;t[71]!==u||t[72]!==c||t[73]!==ue?(de=(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":c,onClick:le,disabled:u,children:ue}),t[71]=u,t[72]=c,t[73]=ue,t[74]=de):de=t[74];let fe=N?(0,X.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:re,children:[(0,X.jsx)(st,{className:`size-3.5`,"aria-hidden":!0}),a.locateTask]}):null,J;t[75]!==a.removeDependency||t[76]!==oe||t[77]!==m?(J=m?(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs text-danger`,onClick:oe,children:a.removeDependency}):null,t[75]=a.removeDependency,t[76]=oe,t[77]=m,t[78]=J):J=t[78];let pe;t[79]!==q||t[80]!==de||t[81]!==fe||t[82]!==J?(pe=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[q,de,fe,J]}),t[79]=q,t[80]=de,t[81]=fe,t[82]=J,t[83]=pe):pe=t[83];let me;t[84]!==G||t[85]!==pe?(me=(0,X.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:[G,pe]}),t[84]=G,t[85]=pe,t[86]=me):me=t[86];let he=x.length>0?(0,X.jsxs)(`div`,{className:E(`grid h-[min(42rem,calc(100vh-14rem))] min-h-[28rem]`,N&&`lg:grid-cols-[minmax(0,1fr)_18rem]`),children:[(0,X.jsxs)(Rt,{nodes:L,edges:z,nodeTypes:fn,nodesDraggable:!1,nodesConnectable:!0,elementsSelectable:!0,onNodeClick:(e,t)=>p(t.id),onEdgeClick:(e,t)=>h(t.id),onConnect:ie,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,X.jsx)(Bt,{color:`var(--color-edge)`,gap:22,size:1}),(0,X.jsx)(Lt,{showInteractive:!1,className:`!border-edge !bg-surface-panel !shadow-surface`})]}),N?(0,X.jsxs)(`aside`,{className:`overflow-y-auto border-t border-edge bg-surface-panel p-4 lg:border-l lg:border-t-0`,children:[(0,X.jsx)(`p`,{className:`text-xs font-medium text-accent-fg`,children:a.phases[N.phase]}),(0,X.jsx)(`h3`,{className:`mt-2 text-sm font-semibold leading-6 text-fg`,children:N.title}),N.operationalState===`blocked`&&N.blockedBy.length>0?(0,X.jsxs)(`div`,{className:`mt-4 rounded-lg bg-violet-500/8 p-3`,children:[(0,X.jsx)(`p`,{className:`text-xs font-medium text-violet-700 dark:text-violet-300`,children:a.blockedBy.replace(`{{count}}`,String(N.blockedBy.length))}),(0,X.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:N.blockedBy.map(mn)})]}):null,(0,X.jsxs)(s,{to:De(i,N.id),className:`mt-4 inline-flex items-center gap-1.5 text-xs font-medium text-accent-fg hover:underline`,children:[(0,X.jsx)(b,{className:`size-3.5`,"aria-hidden":!0}),a.openTask]})]}):null]}):(0,X.jsx)(`div`,{className:`flex min-h-72 items-center justify-center px-6 text-center text-sm text-fg-muted`,children:a.empty}),ge;return t[87]!==me||t[88]!==he?(ge=(0,X.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-base/40`,children:[me,he]}),t[87]=me,t[88]=he,t[89]=ge):ge=t[89],ge}function mn(e){return(0,X.jsx)(`li`,{children:e.title},e.id)}function hn(e){return!e}function gn(e){return!e}function _n(e){return e.dependencyTaskId}function vn(e){return e.dependencyTaskId}function yn(e){return[e.id,e]}function bn(e){return e.id}function Z(e){return e.phase!==`closed`}function xn({policy:e,copy:t,onSave:n}){let[r,i]=(0,Y.useState)(!1),[a,o]=(0,Y.useState)(e.mode),[s,c]=(0,Y.useState)(Math.round(e.confidenceThreshold*100)),[l,u]=(0,Y.useState)(!!e.quietHours),[d,p]=(0,Y.useState)(e.quietHours?.startHour??22),[h,g]=(0,Y.useState)(e.quietHours?.endHour??8),[_,v]=(0,Y.useState)(e.quietHours?.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone),[y,b]=(0,Y.useState)(e.allowedActions.includes(`create_project_task`)),[x,S]=(0,Y.useState)(!1),[C,w]=(0,Y.useState)();(0,Y.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),b(e.allowedActions.includes(`create_project_task`))},[e]);let E=async()=>{S(!0),w(void 0);try{await n({mode:a,confidenceThreshold:s/100,quietHours:l?{startHour:d,endHour:h,timezone:_}:null,allowedActions:y?[`create_project_task`]:[]}),i(!1)}catch(e){w(e instanceof Error?e.message:t.saveFailed)}finally{S(!1)}};return(0,X.jsxs)(ee,{open:r,onOpenChange:e=>{x||i(e)},children:[(0,X.jsx)(P,{asChild:!0,children:(0,X.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-9 gap-2 px-2.5 text-xs`,children:[(0,X.jsx)(Pe,{className:`size-3.5`,"aria-hidden":!0}),t.modes[e.mode]]})}),(0,X.jsxs)(L,{children:[(0,X.jsx)(N,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,X.jsxs)(R,{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,X.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(z,{className:`text-base font-semibold text-fg`,children:t.title}),(0,X.jsx)(F,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,X.jsx)(I,{asChild:!0,children:(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:x,children:(0,X.jsx)(T,{className:`size-4`,"aria-hidden":!0})})})]}),(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-4`,children:[(0,X.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,X.jsx)(`span`,{className:`font-medium text-fg-muted`,children:t.mode}),(0,X.jsx)(f,{value:a,onChange:e=>o(e.target.value),children:Object.entries(t.modes).map(([e,t])=>(0,X.jsx)(m,{value:e,children:t},e))})]}),(0,X.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,X.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[t.confidence,` · `,s,`%`]}),(0,X.jsx)(`input`,{type:`range`,min:`50`,max:`100`,step:`5`,value:s,onChange:e=>c(Number(e.target.value)),className:`accent-accent`})]}),(0,X.jsxs)(`div`,{className:`rounded-lg border border-edge p-3`,children:[(0,X.jsxs)(`label`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:l,onChange:e=>u(e.target.checked)}),t.quietHours]}),l?(0,X.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-3`,children:[(0,X.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietStart,(0,X.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,X.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietEnd,(0,X.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,X.jsxs)(`label`,{className:`col-span-2 grid gap-1 text-xs text-fg-muted`,children:[t.timezone,(0,X.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,X.jsxs)(`label`,{className:`flex items-start gap-3 rounded-lg border border-edge p-3`,children:[(0,X.jsx)(`input`,{type:`checkbox`,className:`mt-1`,checked:y,onChange:e=>b(e.target.checked)}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:t.allowTaskCreation}),(0,X.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.allowTaskCreationDescription})]})]})]}),(0,X.jsxs)(`div`,{className:`shrink-0 border-t border-edge px-5 py-3`,children:[C?(0,X.jsx)(`p`,{className:`mb-2 text-xs text-danger`,children:C}):null,(0,X.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,X.jsx)(I,{asChild:!0,children:(0,X.jsx)(D,{type:`button`,variant:`ghost`,disabled:x,children:t.cancel})}),(0,X.jsx)(D,{type:`button`,variant:`primary`,disabled:x||!_.trim()||d<0||d>23||h<0||h>23,onClick:()=>void E(),children:x?t.saving:t.save})]})]})]})]})]})}function Sn(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}var Cn={backlog:Ct,ready:Ct,active:St,review:Le,closed:_},wn={backlog:`bg-surface-hover text-fg-muted`,ready:`bg-surface-panel text-fg-muted`,active:`bg-accent-soft text-accent-fg`,review:`bg-amber-500/10 text-amber-700 dark:text-amber-300`,closed:`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`};function Tn(e){return e===`running`||e===`queued`?`border-accent/20 bg-accent-soft text-accent-fg`:e===`verifying`?`border-emerald-500/20 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`waiting`?`border-amber-500/20 bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`blocked`?`border-violet-500/20 bg-violet-500/10 text-violet-700 dark:text-violet-300`:`border-edge-subtle bg-surface-hover text-fg-muted`}function En(e){return e===`passed`?`border-emerald-500/20 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`failed`?`border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-300`:`border-edge-subtle bg-surface-hover text-fg-muted`}function Q(e){let t=(0,Vt.c)(83),{task:n,returnTo:r,copy:i,busy:a,onAction:o,onDragStart:c,onDropBefore:l}=e,u,d,f,p,m,h,g,v,y,b,x,S,C,w,T,D;t[0]!==c||t[1]!==l||t[2]!==r||t[3]!==n?(m=an(n),h=m!==`review`&&n.allowedCommands.includes(`request_review`)?`review`:void 0,f=n.phase===`closed`,p=!!(n.dueAt&&n.dueAt<Date.now()&&!f),d=f?_:de,v=n.priority!==`normal`,g=v||n.operationalState!==`idle`||!!n.latestVerification||n.acceptanceCriteriaCount>0||!!n.dueAt||!!n.nextCheckAt,x=!0,t[20]!==c||t[21]!==n.id?(S=e=>{e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,n.id),c(n.id)},t[20]=c,t[21]=n.id,t[22]=S):S=t[22],t[23]===c?C=t[24]:(C=()=>c(``),t[23]=c,t[24]=C),w=On,t[25]!==l||t[26]!==n.id?(T=e=>{e.preventDefault(),e.stopPropagation(),l(n.id)},t[25]=l,t[26]=n.id,t[27]=T):T=t[27],D=`group relative min-h-max min-w-0 shrink-0 overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface transition-[border-color,box-shadow] hover:border-edge focus-within:border-accent/40`,u=s,t[28]!==r||t[29]!==n.id?(y=De(r,n.id),t[28]=r,t[29]=n.id,t[30]=y):y=t[30],b=E(`block min-w-0 p-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,h?`pr-19`:m&&`pr-11`),t[0]=c,t[1]=l,t[2]=r,t[3]=n,t[4]=u,t[5]=d,t[6]=f,t[7]=p,t[8]=m,t[9]=h,t[10]=g,t[11]=v,t[12]=y,t[13]=b,t[14]=x,t[15]=S,t[16]=C,t[17]=w,t[18]=T,t[19]=D):(u=t[4],d=t[5],f=t[6],p=t[7],m=t[8],h=t[9],g=t[10],v=t[11],y=t[12],b=t[13],x=t[14],S=t[15],C=t[16],w=t[17],T=t[18],D=t[19]);let O=f?`text-emerald-600 dark:text-emerald-400`:`text-fg-subtle`,k;t[31]===O?k=t[32]:(k=E(`mt-0.5 size-4 shrink-0`,O),t[31]=O,t[32]=k);let A;t[33]!==d||t[34]!==k?(A=(0,X.jsx)(d,{className:k,"aria-hidden":!0}),t[33]=d,t[34]=k,t[35]=A):A=t[35];let j=f?`text-fg-subtle`:`text-fg`,M;t[36]===j?M=t[37]:(M=E(`min-w-0 break-words text-sm font-semibold leading-5`,j),t[36]=j,t[37]=M);let N;t[38]!==M||t[39]!==n.title?(N=(0,X.jsx)(`h3`,{className:M,children:n.title}),t[38]=M,t[39]=n.title,t[40]=N):N=t[40];let P;t[41]!==A||t[42]!==N?(P=(0,X.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[A,N]}),t[41]=A,t[42]=N,t[43]=P):P=t[43];let F;t[44]!==i||t[45]!==n.attention||t[46]!==n.blockedBy||t[47]!==n.operationalState?(F=n.operationalState===`blocked`&&n.blockedBy.length>0?(0,X.jsxs)(`div`,{className:`ml-6.5 mt-2.5 rounded-lg bg-violet-500/8 px-2.5 py-2 text-xs text-violet-700 dark:text-violet-300`,children:[(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-medium`,children:[(0,X.jsx)(B,{className:`size-3.5`,"aria-hidden":!0}),i.blockedBy.replace(`{{count}}`,String(n.blockedBy.length))]}),(0,X.jsx)(`p`,{className:`mt-1 line-clamp-2 leading-5 text-fg-muted`,children:n.blockedBy.map(Dn).join(`、`)})]}):n.attention[0]?(0,X.jsxs)(`p`,{className:`ml-6.5 mt-2.5 flex items-start gap-1.5 text-xs leading-5 text-fg-muted`,children:[(0,X.jsx)(Ee,{className:`mt-0.5 size-3.5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`line-clamp-2`,children:n.attention[0].summary})]}):null,t[44]=i,t[45]=n.attention,t[46]=n.blockedBy,t[47]=n.operationalState,t[48]=F):F=t[48];let I;t[49]!==i||t[50]!==p||t[51]!==g||t[52]!==v||t[53]!==n.acceptanceCriteriaCount||t[54]!==n.dueAt||t[55]!==n.latestVerification||t[56]!==n.nextCheckAt||t[57]!==n.operationalState||t[58]!==n.priority?(I=g?(0,X.jsxs)(`div`,{className:`ml-6.5 mt-2.5 flex flex-wrap items-center gap-1.5 text-[11px]`,children:[v?(0,X.jsx)(`span`,{className:E(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,n.priority===`critical`?`border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-300`:n.priority===`high`?`border-amber-500/20 bg-amber-500/10 text-amber-700 dark:text-amber-300`:`border-edge-subtle bg-surface-hover text-fg-muted`),children:i.priorityOptions[n.priority]}):null,n.operationalState===`idle`?null:(0,X.jsx)(`span`,{className:E(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,Tn(n.operationalState)),children:i.operationalStates[n.operationalState]}),n.latestVerification?(0,X.jsx)(`span`,{className:E(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,En(n.latestVerification)),children:i.verification[n.latestVerification]}):null,n.acceptanceCriteriaCount>0?(0,X.jsxs)(`span`,{className:`inline-flex min-h-6 items-center gap-1 rounded-md border border-edge-subtle bg-surface-hover px-2 text-fg-muted`,children:[(0,X.jsx)(St,{className:`size-3`,"aria-hidden":!0}),i.acceptanceCriteria.replace(`{{count}}`,String(n.acceptanceCriteriaCount))]}):null,n.dueAt?(0,X.jsxs)(`span`,{className:E(`inline-flex min-h-6 items-center gap-1 rounded-md border px-2`,p?`border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-300`:`border-edge-subtle bg-surface-hover text-fg-muted`),children:[(0,X.jsx)(pt,{className:`size-3`,"aria-hidden":!0}),H(new Date(n.dueAt))]}):null,n.nextCheckAt?(0,X.jsxs)(`span`,{className:`inline-flex min-h-6 items-center gap-1 rounded-md border border-accent/20 bg-accent-soft px-2 text-accent-fg`,children:[(0,X.jsx)(pt,{className:`size-3`,"aria-hidden":!0}),H(new Date(n.nextCheckAt))]}):null]}):null,t[49]=i,t[50]=p,t[51]=g,t[52]=v,t[53]=n.acceptanceCriteriaCount,t[54]=n.dueAt,t[55]=n.latestVerification,t[56]=n.nextCheckAt,t[57]=n.operationalState,t[58]=n.priority,t[59]=I):I=t[59];let L;t[60]!==u||t[61]!==y||t[62]!==P||t[63]!==F||t[64]!==I||t[65]!==b?(L=(0,X.jsxs)(u,{to:y,className:b,children:[P,F,I]}),t[60]=u,t[61]=y,t[62]=P,t[63]=F,t[64]=I,t[65]=b,t[66]=L):L=t[66];let R;t[67]!==a||t[68]!==i||t[69]!==o||t[70]!==m||t[71]!==h||t[72]!==n?(R=m?(0,X.jsxs)(`div`,{className:`absolute right-2.5 top-2.5 z-10 flex items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100 [@media(hover:none)]:opacity-100`,children:[h?(0,X.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,h),className:`inline-flex size-7 items-center justify-center rounded-md bg-surface-hover text-fg-muted hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-wait disabled:opacity-50`,"aria-label":i.actions[h],title:i.actions[h],children:(0,X.jsx)(Le,{className:`size-3.5`,"aria-hidden":!0})}):null,(0,X.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,m),className:`inline-flex size-7 items-center justify-center rounded-md bg-accent-soft text-accent-fg hover:bg-accent-soft/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-wait disabled:opacity-50`,"aria-label":i.actions[m],title:i.actions[m],children:(0,X.jsx)(ze,{className:`size-3.5`,"aria-hidden":!0})})]}):null,t[67]=a,t[68]=i,t[69]=o,t[70]=m,t[71]=h,t[72]=n,t[73]=R):R=t[73];let z;return t[74]!==L||t[75]!==R||t[76]!==x||t[77]!==S||t[78]!==C||t[79]!==w||t[80]!==T||t[81]!==D?(z=(0,X.jsxs)(`article`,{draggable:x,onDragStart:S,onDragEnd:C,onDragOver:w,onDrop:T,className:D,children:[L,R]}),t[74]=L,t[75]=R,t[76]=x,t[77]=S,t[78]=C,t[79]=w,t[80]=T,t[81]=D,t[82]=z):z=t[82],z}function Dn(e){return e.title}function On(e){e.preventDefault(),e.stopPropagation()}function kn({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=(0,Y.useRef)(null),g=(0,Y.useRef)(null),[_,v]=(0,Y.useState)(null),[y,b]=(0,Y.useState)(!1),[x,S]=(0,Y.useState)(null),[C,w]=(0,Y.useState)(`board`),[T,O]=(0,Y.useState)(!1),[j,M]=(0,Y.useState)(()=>crypto.randomUUID()),[P,te]=(0,Y.useState)(``),[B,V]=(0,Y.useState)(`normal`),[H,U]=(0,Y.useState)(``),[ne,re]=(0,Y.useState)([]),[W,ie]=(0,Y.useState)(!1),[ae,oe]=(0,Y.useState)(null),G=$e({chat:k(A(e=>e.language)).chat}),K=nn(e),se=e.filter(e=>e.phase!==`closed`),ce=(e,t)=>void a(e,t),q=async(t,n)=>{let r=e.find(e=>e.id===_);if(v(null),!r||r.id===n)return;let i=K[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=rn(r,t);r.phase!==t&&!l||l&&!await a(r,l)||await o(r.id,n)&&S({taskId:r.id,phase:r.phase,beforeTaskId:c})},le=async e=>{e.preventDefault();let t=P.trim();if(!(!t||W)){ie(!0),oe(null);try{let e=H?new Date(`${H}T23:59:59.999`).getTime():void 0;await u({requestId:j,objective:t,priority:B,dependsOnTaskIds:ne,attachments:G.wireAttachmentsPayload(),...e===void 0?{}:{dueAt:e}}),te(``),V(`normal`),U(``),re([]),G.clearAttachments(),M(crypto.randomUUID()),O(!1)}catch(e){oe(e instanceof Error?e.message:i.createFailed)}finally{ie(!1)}}},ue=()=>{M(crypto.randomUUID()),te(``),V(`normal`),U(``),re([]),G.clearAttachments(),oe(null),O(!0)};(0,Y.useImperativeHandle)(p,()=>({openCreate:ue})),(0,Y.useEffect)(()=>{if(!x)return;let e=window.setTimeout(()=>S(null),6e3);return()=>window.clearTimeout(e)},[x]);let de=(0,Y.useCallback)(e=>{let t=g.current;!t||t.pointerId!==e.pointerId||(g.current=null,b(!1),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),fe=(0,Y.useCallback)(e=>{if(e.button!==0||Sn(e.target))return;let t=h.current;t&&(g.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},[]),J=(0,Y.useCallback)(e=>{let t=g.current,n=h.current;if(!t||!n||t.pointerId!==e.pointerId)return;let r=e.clientX-t.startX;!t.active&&Math.abs(r)<5||(t.active||(t.active=!0,b(!0)),e.preventDefault(),n.scrollLeft=t.scrollLeft-r)},[]);return(0,X.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,X.jsxs)(`div`,{className:`mb-4 flex shrink-0 flex-wrap items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:i.title}),(0,X.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:i.description})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,X.jsx)(xn,{policy:n,copy:i.monitoring,onSave:l}),(0,X.jsxs)(`div`,{className:`flex rounded-lg border border-edge bg-surface-panel p-0.5`,children:[(0,X.jsxs)(`button`,{type:`button`,"aria-pressed":C===`board`,onClick:()=>w(`board`),className:E(`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,X.jsx)(ke,{className:`size-3.5`,"aria-hidden":!0}),i.views.board]}),(0,X.jsxs)(`button`,{type:`button`,"aria-pressed":C===`graph`,onClick:()=>w(`graph`),className:E(`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,X.jsx)(ut,{className:`size-3.5`,"aria-hidden":!0}),i.views.graph]})]})]})]}),C===`board`?(0,X.jsx)(`div`,{ref:h,className:E(`min-h-0 w-full min-w-0 flex-1 overflow-x-auto overflow-y-hidden overscroll-x-contain pb-2 [scrollbar-width:thin]`,y?`cursor-grabbing select-none`:`cursor-grab`),onPointerDown:fe,onPointerMove:J,onPointerUp:de,onPointerCancel:de,onLostPointerCapture:e=>{g.current?.pointerId===e.pointerId&&(g.current=null,b(!1))},children:(0,X.jsx)(`div`,{className:`grid h-full min-h-0 min-w-[103rem] grid-cols-5 gap-3`,children:tn.map(t=>{let n=Cn[t],a=K[t];return(0,X.jsxs)(`section`,{onDragOver:n=>{let r=e.find(e=>e.id===_);r&&(r.phase===t||rn(r,t))&&n.preventDefault()},onDrop:e=>{e.preventDefault(),q(t,null)},className:`flex min-h-0 min-w-0 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-muted/70 p-2.5`,children:[(0,X.jsxs)(`header`,{className:`mb-2.5 flex shrink-0 items-center gap-2 px-0.5`,children:[(0,X.jsxs)(`div`,{className:E(`flex items-center gap-1.5 rounded-md px-2 py-1`,wn[t]),children:[(0,X.jsx)(n,{className:`size-3.5`,"aria-hidden":!0}),(0,X.jsx)(`h3`,{className:`text-sm font-semibold`,children:i.phases[t]})]}),(0,X.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:a.length})]}),(0,X.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,X.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.map(e=>(0,X.jsx)(Q,{task:e,returnTo:r,copy:i,busy:d===e.id,onAction:ce,onDragStart:v,onDropBefore:e=>void q(t,e)},e.id))})})]},t)})})}):(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,X.jsx)(pn,{tasks:e,dependencyEdges:t,returnTo:r,copy:{...i.graph,phases:i.phases},onDependenciesChange:c})}),(0,X.jsx)(ee,{open:T,onOpenChange:e=>{W||O(e)},children:(0,X.jsxs)(L,{children:[(0,X.jsx)(N,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,X.jsxs)(R,{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,X.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,X.jsx)(z,{className:`text-base font-semibold text-fg`,children:i.createTitle}),(0,X.jsx)(F,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:i.createDescription})]}),(0,X.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>void le(e),children:[(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,X.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,X.jsx)(`label`,{htmlFor:`project-task-objective`,className:`font-medium text-fg-muted`,children:i.objective}),(0,X.jsxs)(`div`,{className:E(`overflow-hidden rounded-lg border border-edge bg-surface-base transition-colors focus-within:border-accent`,G.isDragging&&`border-accent bg-accent-soft/30`),onDragOver:e=>{e.preventDefault(),W||G.setIsDragging(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||G.setIsDragging(!1)},onDrop:e=>{e.preventDefault(),G.setIsDragging(!1),W||G.processFiles(Array.from(e.dataTransfer.files))},children:[(0,X.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:P,onChange:e=>{te(e.target.value),oe(null)},placeholder:i.objectivePlaceholder,maxLength:12e3,disabled:W}),(0,X.jsx)(Xe,{attachments:G.attachments,topPadded:!1,onRemove:e=>{W||G.removeAttachment(e)}}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-t border-edge-subtle px-2.5 py-2`,children:[(0,X.jsxs)(D,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:W,onClick:()=>G.fileInputRef.current?.click(),children:[(0,X.jsx)(Fe,{className:`size-3.5`,"aria-hidden":!0}),i.addFiles]}),(0,X.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:i.attachmentsDescription}),(0,X.jsx)(`input`,{ref:G.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{G.processFiles(Array.from(e.target.files??[])),e.currentTarget.value=``}})]})]})]}),(0,X.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,X.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,X.jsx)(`span`,{className:`font-medium text-fg-muted`,children:i.priority}),(0,X.jsx)(f,{value:B,onChange:e=>V(e.target.value),disabled:W,children:[`low`,`normal`,`high`,`critical`].map(e=>(0,X.jsx)(m,{value:e,children:i.priorityOptions[e]},e))})]}),(0,X.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,X.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[i.dueDate,` `,(0,X.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:i.optional})]}),(0,X.jsx)(kt,{className:`min-h-10 bg-surface-base`,value:H,onChange:U,disabled:W,ariaLabel:i.dueDate})]})]}),(0,X.jsxs)(`fieldset`,{className:`grid gap-2`,children:[(0,X.jsxs)(`legend`,{className:`text-sm font-medium text-fg-muted`,children:[i.dependencies,` `,(0,X.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:i.optional})]}),(0,X.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:i.dependenciesDescription}),(0,X.jsx)(Pt,{candidates:se,selectedIds:ne,disabled:W,onChange:re,labels:{link:i.linkDependencies,linked:i.linkedDependencies,searchPlaceholder:i.dependencySearchPlaceholder,noMatches:i.noDependencyMatches,noCandidates:i.noDependencyCandidates,remove:i.removeDependency}})]}),ae?(0,X.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:ae}):null]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,X.jsx)(I,{asChild:!0,children:(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:W,children:i.cancel})}),(0,X.jsx)(D,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:W||!P.trim(),children:W?i.creating:i.create})]})]})]})]})}),x?(0,X.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,X.jsx)(`span`,{children:i.moved}),(0,X.jsx)(`button`,{type:`button`,className:`font-medium text-accent-fg hover:underline`,onClick:()=>{let e=x;S(null),s(e.taskId,e.phase,e.beforeTaskId).then(t=>{t||S(e)})},children:i.undo})]}):null]})}var An=new Set([{id:`overview`,icon:ae},{id:`tasks`,icon:yt},{id:`automations`,icon:Ke},{id:`files`,icon:Re},{id:`notes`,icon:Qe},{id:`skills`,icon:K},{id:`sessions`,icon:W},{id:`progress`,icon:Ue},{id:`settings`,icon:Me}].map(e=>e.id)),jn=`xopc.projectFiles.panelWidthPx`,Mn=320,Nn=220,Pn=560;function Fn(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 In(e){return Math.min(Pn,Math.max(Nn,Math.round(e)))}function Ln(){try{let e=window.localStorage.getItem(jn);if(e==null)return Mn;let t=Number.parseInt(e,10);return Number.isFinite(t)?In(t):Mn}catch{return Mn}}function Rn(e){try{window.localStorage.setItem(jn,String(In(e)))}catch{}}function zn(e){return!!(e&&An.has(e))}function Bn(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function Vn(e,t=``){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?String(e):H(n)}function Hn(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 Un(e){let t=(0,Vt.c)(8),{label:n,hint:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,X.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,X.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,X.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 Wn(e=!1){return E(`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 Gn(e){let t=(0,Vt.c)(10),{label:n,value:r,mono:i}=e,a=i===void 0?!1:i,o;t[0]===n?o=t[1]:(o=(0,X.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=E(`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,X.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,X.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 Kn(e){return[e.name,e.slug,e.workspaceRoot,e.description,e.brief].filter(Boolean).join(` `).toLowerCase()}function $(e){let t=e.lastActiveAt??e.updatedAt??e.createdAt,n=t?new Date(t).getTime():0;return Number.isFinite(n)?n:0}function qn(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function Jn(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function Yn(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 Xn(e){return e.primaryObject.title?.trim()||e.primaryObject.id}function Zn(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 Qn(e){let t=e.sourceChannel?.trim();if(t)return $n(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 $n(r||``)}function $n(e){let t=e.trim().toLowerCase();return t?t===`tui`?`TUI`:t===`acp`?`ACP`:t===`webchat`?`Webchat`:t:``}function er(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 tr(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 nr(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:nr(e.children,t,n)}:e)}function rr({currentProject:e,pm:t,projectsText:n,wd:r}){let i=a(),[o,s]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)([e]),[m,h]=(0,Y.useState)(``),[_,v]=(0,Y.useState)(!1),[y,b]=(0,Y.useState)(null),[x,S]=(0,Y.useState)(!1),[T,O]=(0,Y.useState)(`new`),[k,A]=(0,Y.useState)(``),[j,M]=(0,Y.useState)(``),[P,te]=(0,Y.useState)(!1),[B,V]=(0,Y.useState)(null),[H,U]=(0,Y.useState)(null),ne=(0,Y.useCallback)(async()=>{v(!0),b(null);try{let t=await q({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){b(e instanceof Error?e.message:String(e))}finally{v(!1)}},[e]);(0,Y.useEffect)(()=>{f(t=>[e,...t.filter(t=>t.id!==e.id)])},[e]),(0,Y.useEffect)(()=>{o&&ne()},[ne,o]);let re=(0,Y.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=Kn(e);return t.every(e=>n.includes(e))}).sort((e,t)=>$(t)-$(e))},[e.id,d,m]),W=e=>t.statuses[e.status]??e.status,ie=e=>e.workspaceRoot||e.effectiveWorkspaceRoot||e.description||e.brief||t.common.defaultWorkspace,ae=e=>{O(e),A(``),M(``),V(null),S(!0),s(!1)},G=(0,Y.useCallback)(async(e={})=>{let t=j.trim(),n=k.trim()||(T===`directory`?qn(t):``);if(n){te(!0),V(null),U(null);try{let r=await J({name:n,...t?{workspaceRoot:t}:{},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});S(!1),A(``),M(``),f(e=>[r,...e.filter(e=>e.id!==r.id)]),i(`/projects/${encodeURIComponent(r.id)}`)}catch(e){let t=Jn(e);t?(U(t),S(!1)):V(e instanceof Error?e.message:String(e))}finally{te(!1)}}},[T,k,i,j]),K=(0,Y.useCallback)(e=>{e.preventDefault(),G()},[G]),se=(0,Y.useCallback)(()=>{G({createWorkspaceRoot:!0})},[G]),ce=(0,Y.useCallback)(()=>{U(null),S(!0)},[]),le=e=>{M(e),T===`directory`&&!k.trim()&&A(qn(e))},ue=(e,t)=>(0,X.jsxs)(`button`,{type:`button`,className:E(`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,X.jsx)(c,{className:E(`size-4 text-accent-fg`,!t&&`invisible`),"aria-hidden":!0}),(0,X.jsxs)(`span`,{className:`min-w-0`,children:[(0,X.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.name}),(0,X.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:ie(e)})]}),(0,X.jsx)(`span`,{className:E(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,Hn(e.status)),children:W(e)})]},e.id);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(u,{open:o,onOpenChange:s,children:[(0,X.jsx)(p,{asChild:!0,children:(0,X.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,X.jsxs)(`span`,{className:`min-w-0`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:e.name}),(0,X.jsx)(`span`,{className:E(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,Hn(e.status)),children:W(e)})]}),(0,X.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:ie(e)})]}),(0,X.jsx)(oe,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":!0})]})}),(0,X.jsx)(l,{children:(0,X.jsxs)(g,{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,X.jsxs)(`label`,{className:`relative block`,children:[(0,X.jsx)(w,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,X.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=>h(e.target.value),placeholder:t.projectSwitcher.searchPlaceholder,"aria-label":t.projectSwitcher.searchPlaceholder})]}),(0,X.jsxs)(`div`,{className:`mt-1 max-h-[min(54vh,24rem)] overflow-y-auto pr-0.5 [scrollbar-gutter:stable]`,children:[(0,X.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.current}),ue(e,!0),(0,X.jsx)(`div`,{className:`px-2 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.recent}),y?(0,X.jsx)(`div`,{className:`p-2 text-xs text-red-600 dark:text-red-400`,children:y}):null,_&&re.length===0?(0,X.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.loading}):null,!_&&re.length===0?(0,X.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.noMatches}):null,re.map(e=>ue(e,!1))]}),(0,X.jsxs)(`div`,{className:`mt-1 border-t border-edge-subtle pt-1`,children:[(0,X.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:()=>ae(`new`),children:[(0,X.jsx)(C,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.newProject})]}),(0,X.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:()=>ae(`directory`),children:[(0,X.jsx)(Re,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.openDirectory})]}),(0,X.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,X.jsx)(Me,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.manageProjects})]})]})]})})]}),(0,X.jsx)(ee,{open:x,onOpenChange:e=>!P&&S(e),children:(0,X.jsxs)(L,{children:[(0,X.jsx)(N,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,X.jsxs)(R,{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,X.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,X.jsx)(z,{className:`text-base font-semibold text-fg`,children:T===`directory`?t.projectSwitcher.createFromDirectoryTitle:n.createTitle}),(0,X.jsx)(F,{className:`mt-1 text-sm text-fg-muted`,children:T===`directory`?t.projectSwitcher.createFromDirectoryDescription:n.createDescription})]}),(0,X.jsxs)(`form`,{onSubmit:K,className:`flex min-h-0 flex-1 flex-col`,children:[(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[B?(0,X.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:B}):null,(0,X.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,X.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.projectName}),(0,X.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:k,onChange:e=>A(e.target.value),placeholder:`xopc`})]}),(0,X.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,X.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.workspaceRoot}),(0,X.jsx)(Ot,{value:j,onChange:le,disabled:P,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,X.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.workspaceHint})]})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,X.jsx)(I,{asChild:!0,children:(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:P,children:n.cancel})}),(0,X.jsxs)(D,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:P||!(k.trim()||T===`directory`&&qn(j)),children:[(0,X.jsx)(C,{className:`size-4`,"aria-hidden":!0}),n.create]})]})]})]})]})}),(0,X.jsx)(ee,{open:!!H,onOpenChange:e=>{e||U(null)},children:(0,X.jsxs)(L,{children:[(0,X.jsx)(N,{className:`fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,X.jsxs)(R,{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,X.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,X.jsx)(z,{className:`text-base font-semibold text-fg`,children:n.workspaceMissingTitle}),(0,X.jsx)(F,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:H?Bn(n.workspaceMissingDescription,{workspace:H}):null})]}),H?(0,X.jsx)(`div`,{className:`px-5 py-4`,children:(0,X.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,X.jsx)(Re,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:H})]})}):null,(0,X.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:ce,disabled:P,children:n.workspaceMissingBack}),(0,X.jsxs)(D,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:se,disabled:P,children:[(0,X.jsx)(rt,{className:`size-4`,"aria-hidden":!0}),n.workspaceMissingCreate]})]})]})]})})]})}function ir(){let{projectId:e=``,tabId:t,noteId:n}=i(),r=a(),[c]=o(),l=A(e=>e.language),u=k(l),d=u.chat.workingDirectory,p=u.projectDetailPage,h=u.projectsPage,g=Ie(e=>e.setPageHeader),_=Ie(e=>e.clearPageHeader),[y,b]=(0,Y.useState)(null),[j,M]=(0,Y.useState)(null),[P,B]=(0,Y.useState)([]),[H,ne]=(0,Y.useState)(``),[oe,q]=(0,Y.useState)([]),[ue,de]=(0,Y.useState)(0),[J,ge]=(0,Y.useState)(!1),[Se,ke]=(0,Y.useState)(!1),[je,Pe]=(0,Y.useState)(!1),[Fe,Le]=(0,Y.useState)([]),ze=(0,Y.useRef)(new Set),[Xe,$e]=(0,Y.useState)(null),[st,pt]=(0,Y.useState)(Ln),[mt,bt]=(0,Y.useState)(!1),[St,Ct]=(0,Y.useState)(!1),[kt,jt]=(0,Y.useState)(``),[Mt,Nt]=(0,Y.useState)([]),[Pt,Ft]=(0,Y.useState)(!1),[It,Lt]=(0,Y.useState)(null),[Rt,zt]=(0,Y.useState)(!1),[Bt,Vt]=(0,Y.useState)(null),[Ht,Ut]=(0,Y.useState)([]),[Wt,Gt]=(0,Y.useState)(``),[Kt,qt]=(0,Y.useState)(!0),[Jt,Xt]=(0,Y.useState)(!1),[Zt,Qt]=(0,Y.useState)(!1),[$t,en]=(0,Y.useState)(null),[tn,nn]=(0,Y.useState)(!1),[rn,an]=(0,Y.useState)(`fixed`),[on,sn]=(0,Y.useState)(``),[cn,ln]=(0,Y.useState)(null),[un,dn]=(0,Y.useState)(!1),[fn,pn]=(0,Y.useState)(!1),[mn,hn]=(0,Y.useState)(!1),[gn,_n]=(0,Y.useState)(null),vn=(0,Y.useRef)(null),yn=(0,Y.useRef)(!1),[bn,Z]=(0,Y.useState)(null),[xn,Sn]=(0,Y.useState)({title:``,reason:``}),[Cn,wn]=(0,Y.useState)({name:``,description:``,status:`active`,defaultAgentId:``,workspaceRoot:``,brief:``,instructions:``}),Tn=(0,Y.useRef)(Cn),En=`overview`,Q=n?`notes`:zn(t)?t:En,Dn=(0,Y.useMemo)(()=>x(c.get(`returnTo`),`/projects`,[`/chat`]),[c]),On=(0,Y.useCallback)(t=>{if(!e)return`/projects`;let n=`/projects/${encodeURIComponent(e)}/${t}`;return Dn===`/projects`?n:S(n,Dn)},[Dn,e]),An=(0,Y.useCallback)(t=>{e&&r(On(t))},[r,e,On]),jn=(0,Y.useCallback)(()=>{if(Q===`tasks`&&vn.current){vn.current.openCreate();return}yn.current=!0,An(`tasks`)},[An,Q]);(0,Y.useEffect)(()=>{Q!==`tasks`||!yn.current||(yn.current=!1,vn.current?.openCreate())},[Q]);let Mn=(0,Y.useCallback)(t=>{e&&r(On(t),{replace:!0})},[r,e,On]),Nn=(0,Y.useCallback)((e,t)=>{Mn(e),r(t)},[r,Mn]),Pn=(0,Y.useCallback)(e=>t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||Mn(e)},[Mn]),Kn=(0,Y.useCallback)(e=>e.startsWith(`/chat/`)?`sessions`:e.startsWith(`/notes`)?`notes`:Q,[Q]);(0,Y.useEffect)(()=>{!e||!t||zn(t)||r(On(En),{replace:!0})},[En,r,e,On,t]),(0,Y.useEffect)(()=>{if(!e)return;let t=!1;return qt(!0),Z(null),Promise.all([le(e),ie(e),se(e),Ye().catch(()=>null)]).then(([e,n,r,i])=>{if(t)return;b(e),M(n),B(r),Ut(i?.agents??[]),Gt(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??``};Tn.current=a,wn(a)}).catch(e=>{t||Z(e instanceof Error?e.message:String(e))}).finally(()=>{t||qt(!1)}),()=>{t=!0}},[e]);let $=(0,Y.useCallback)(async()=>{e&&M(await ie(e))},[e]);(0,Y.useEffect)(()=>{let t,n=n=>{let r=vt.safeParse(n.detail);!r.success||r.data.projectId!==e||(window.clearTimeout(t),t=window.setTimeout(()=>void $(),120))},r=n=>{let r=Ve.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.addEventListener(`task-deleted-v1`,r),()=>{window.clearTimeout(t),window.removeEventListener(`task-changed-v2`,n),window.removeEventListener(`task-deleted-v1`,r)}},[e,$]);let qn=(0,Y.useCallback)(async(e,t)=>{_n(e.id),Z(null);try{let n=await be(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 we(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 ce(e.id,r,n.task.version),await $(),!0}catch(e){return await $().catch(()=>void 0),Z(e instanceof Error?e.message:p.board.actionFailed),!1}finally{_n(null)}},[j,p.board.actionFailed,$]),$n=(0,Y.useCallback)(async t=>{e&&(Z(null),await ve({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,$]),ir=(0,Y.useCallback)(async(e,t)=>{_n(e),Z(null);try{return await Ne(e,t,(await be(e)).task.version),await $(),!0}catch(e){return await $().catch(()=>void 0),Z(e instanceof Error?e.message:p.board.actionFailed),!1}finally{_n(null)}},[p.board.actionFailed,$]),ar=(0,Y.useCallback)(async(e,t,n)=>{_n(e),Z(null);try{let r=await be(e);return r.task.phase!==t&&(r=await ce(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 Ne(e,n,r.task.version),await $(),!0}catch(e){return await $().catch(()=>void 0),Z(e instanceof Error?e.message:p.board.actionFailed),!1}finally{_n(null)}},[p.board.actionFailed,$]),or=(0,Y.useCallback)(async(e,t)=>{_n(e),Z(null);try{await _e(e,t,(await be(e)).task.version),await $()}catch(e){await $().catch(()=>void 0),Z(e instanceof Error?e.message:p.board.actionFailed)}finally{_n(null)}},[p.board.actionFailed,$]),sr=(0,Y.useCallback)(async t=>{if(e){Z(null);try{await Oe(e,t),await $()}catch(e){throw Z(e instanceof Error?e.message:p.board.actionFailed),e}}},[p.board.actionFailed,e,$]),cr=(0,Y.useCallback)(async()=>{if(y){ge(!0),Z(null);try{let e=await fe(y.id,{includeRelated:Se,limit:100});q(e.items),de(e.total)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{ge(!1)}}},[y,Se]);(0,Y.useEffect)(()=>{Q===`progress`&&cr()},[cr,Q]);let lr=(0,Y.useCallback)(async()=>{if(!y?.effectiveWorkspaceRoot?.trim()){Le([]),ze.current.clear(),Vt(null);return}zt(!0),Vt(null),ze.current.clear();try{Le(tr((await he(y.id,``)).entries)),ze.current.add(``)}catch(e){Le([]),ze.current.clear(),Vt(e instanceof Error?e.message:String(e))}finally{zt(!1)}},[y]),ur=(0,Y.useCallback)(async e=>{if(!(!y?.effectiveWorkspaceRoot?.trim()||ze.current.has(e))){ze.current.add(e),Vt(null);try{let t=await he(y.id,e);Le(n=>nr(n,e,tr(t.entries)))}catch(t){ze.current.delete(e),Vt(t instanceof Error?t.message:String(t))}}},[y]);(0,Y.useEffect)(()=>{Q===`files`&&lr()},[lr,Q]);let dr=kt.trim();(0,Y.useEffect)(()=>{if(Q!==`files`||!y||!St||!dr){Nt([]),Ft(!1),Lt(null);return}let e=!1;Ft(!0),Lt(null),Nt([]);let t=window.setTimeout(()=>{Te(y.id,dr,50).then(t=>{e||Nt(t)}).catch(t=>{e||Lt(t instanceof Error?t.message:String(t))}).finally(()=>{e||Ft(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[dr,y,St,Q]);let fr=(0,Y.useCallback)(async()=>{if(y){pn(!0),Z(null);try{let e=await V(y.id);Nn(`sessions`,`/chat/${encodeURIComponent(e.key)}`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{pn(!1)}}},[Nn,y]),pr=(0,Y.useCallback)(async()=>{if(!y)return;let[e,t]=await Promise.all([le(y.id),ie(y.id)]);M(t),b(e)},[y]),mr=(0,Y.useCallback)(async e=>{if(e.preventDefault(),!(!y||!xn.title.trim())){hn(!0),Z(null);try{await tt(y.id,{title:xn.title.trim(),reason:xn.reason.trim()||void 0}),Sn({title:``,reason:``}),await pr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{hn(!1)}}},[xn.reason,xn.title,y,pr]),hr=(0,Y.useMemo)(()=>(0,X.jsx)(s,{to:Dn,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":Dn===`/projects`?p.backToProjects:u.sidebar.back,children:(0,X.jsx)(at,{className:`size-4`,"aria-hidden":!0})}),[Dn,u.sidebar.back,p.backToProjects]),gr=(0,Y.useMemo)(()=>y?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(D,{asChild:!0,variant:`secondary`,className:`h-9 rounded-lg`,children:(0,X.jsxs)(s,{to:`/workflows?tab=library&projectId=${encodeURIComponent(y.id)}`,children:[(0,X.jsx)(ut,{className:`size-4`,"aria-hidden":!0}),p.common.runWorkflow]})}),(0,X.jsxs)(D,{variant:`secondary`,className:`h-9 rounded-lg`,onClick:jn,children:[(0,X.jsx)(C,{className:`size-4`,"aria-hidden":!0}),p.board.create]}),(0,X.jsxs)(D,{variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>void fr(),disabled:fn,children:[(0,X.jsx)(W,{className:`size-4`,"aria-hidden":!0}),p.common.newChat]})]}):null,[jn,p.board.create,p.common.newChat,p.common.runWorkflow,y,fr,fn]);(0,Y.useLayoutEffect)(()=>(g({startExtra:hr,main:y?(0,X.jsx)(rr,{currentProject:y,pm:p,projectsText:h,wd:d}):(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:p.fallbackTitle}),(0,X.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:p.fallbackContext})]}),end:gr}),()=>_()),[_,gr,hr,p,y,h,g,d]);function _r(e){b(t=>t?{...t,...e}:null),Gt(e.defaultAgentId??``),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}async function vr(e=Tn.current){if(!(!y||!Fn(e,y))){Z(null),en(null);try{let t=await xe(y.id,{name:e.name.trim(),status:e.status,description:e.description,defaultAgentId:e.defaultAgentId,brief:e.brief,instructions:e.instructions});_r(t);let n=Tn.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};Tn.current=r,wn(r)}catch(e){let t=Jn(e);throw t?en(t):Z(e instanceof Error?e.message:String(e)),e}}}function yr(e){e.preventDefault(),Mr.flush()}function br(e,t=!1){let n={...Tn.current,...e};Tn.current=n,wn(n),t&&Mr.saveNow(n)}let xr=(0,Y.useCallback)(()=>{if(!y)return;let e=y.workspaceRoot?.trim()??``;an(e?`fixed`:`follow`),sn(e||y.effectiveWorkspaceRoot||``),nn(!0)},[y]);async function Sr(e={}){if(!y)return;let t=rn===`fixed`?on.trim():``;if(!(rn===`fixed`&&!t)){Xt(!0),Z(null),en(null);try{let n=await xe(y.id,{workspaceRoot:t,...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});_r(n),br({workspaceRoot:n.workspaceRoot??``}),nn(!1),en(null)}catch(e){let t=Jn(e);t?(en(t),nn(!1)):Z(e instanceof Error?e.message:String(e))}finally{Xt(!1)}}}async function Cr(){if(!(!y||cn)){ln(`pin`),Z(null);try{_r(y.pinnedAt?await G(y.id):await ye(y.id))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{ln(null)}}}async function wr(){if(!(!y||cn)){ln(`archive`),Z(null);try{let e=y.status===`archived`?await xt(y.id):await re(y.id);_r(e),br({status:e.status})}catch(e){Z(e instanceof Error?e.message:String(e))}finally{ln(null)}}}async function Tr(){if(y){dn(!0),Z(null);try{await et(y.id),Qt(!1),r(`/projects`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{dn(!1)}}}async function Er(){if(!(!y||je)){Pe(!0),Z(null);try{await U(y.id)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Pe(!1)}}}let Dr=(0,Y.useCallback)(e=>{$e(e)},[]),Or=(0,Y.useCallback)((e,t)=>{t||$e(e)},[]),kr=(0,Y.useCallback)(async(e,t,n)=>{let r=y?.id;if(r)switch(e){case`preview`:t.isDirectory||$e(t.path);break;case`download`:if(t.isDirectory)return;try{let e=ht(t.path);if(nt(lt(e))!==`text`){let n=await We(t.path,{projectId:r}),i=te(e)??`application/octet-stream`;_t(e,await n.arrayBuffer(),i)}else{let{content:n}=await dt(t.path,{projectId:r});Be(e,n)}}catch(e){Je(`warning`,e instanceof Error?e.message:String(e),void 0,{duration:4e3})}break;case`copyPath`:try{await O(t.absolutePath??t.path)&&Je(`success`,u.workspace.pathCopied,void 0,{duration:2500})}catch{Je(`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,y?.id]),Ar=(0,Y.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),bt(!0);let r=e.clientX,i=st,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=In(i+(e.clientX-r)),o===0&&(o=window.requestAnimationFrame(l))},d=()=>{o!==0&&(window.cancelAnimationFrame(o),l());try{t.releasePointerCapture(a)}catch{}bt(!1),pt(c),Rn(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)},[st]);(0,Y.useEffect)(()=>{Q!==`files`&&$e(null)},[e,Q]);let jr=!!(y&&Fn(Cn,y)),Mr=Et({value:y?Cn:null,dirty:jr,onSave:vr,validate:e=>e.name.trim()?null:p.settings.nameRequired});if(Kt)return(0,X.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(!y)return(0,X.jsxs)(`main`,{className:`w-full flex-1 p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,X.jsxs)(s,{to:Dn,className:`inline-flex items-center gap-2 text-sm text-accent-fg hover:underline`,children:[(0,X.jsx)(at,{className:`size-4`,"aria-hidden":!0}),Dn===`/projects`?p.backToProjects:u.sidebar.back]}),(0,X.jsx)(`p`,{className:`mt-6 rounded-lg bg-surface-panel p-4 shadow-surface text-sm text-fg-muted`,children:bn||p.notFound})]});let Nr=P.slice(0,6),Pr=j?.blockers??[],Fr=j?.tasks.filter(e=>e.phase!==`closed`)??[],Ir=e=>p.statuses[e]??e,Lr=e=>Bn(p.common.messages,{count:e}),Rr=H.trim().toLowerCase(),zr=Rr?P.filter(e=>{let t=Vn(e.updatedAt),n=e.routing?.agentId||e.agentId||p.common.agent,r=e.name?.trim()||p.sessions.fallbackTitle,i=Lr(e.messageCount??0),a=Qn(e);return[r,e.key,n,a,t,i].filter(Boolean).join(` `).toLowerCase().includes(Rr)}):P,Br=P.length>0&&zr.length===0,Vr=Ht.find(e=>e.id===y.defaultAgentId)?.name||y.defaultAgentId||p.settings.globalDefaultAgent,Hr=Ht.find(e=>e.id===Cn.defaultAgentId),Ur=y.workspaceRoot?.trim()||``,Wr=y.status===`archived`,Gr=!!y.pinnedAt,Kr=!Ur,qr=Ur||Hr?.workspace||y.effectiveWorkspaceRoot||p.common.defaultWorkspace,Jr=rn===`fixed`?on.trim()||p.settings.workspacePlaceholder:Hr?.workspace||y.effectiveWorkspaceRoot||p.common.defaultWorkspace,Yr=(rn===`fixed`?on.trim():``)!==Ur&&(rn===`follow`||!!on.trim()),Xr=[{id:`overview`,icon:ae,label:p.tabs.overview},{id:`tasks`,icon:yt,label:p.tabs.tasks},{id:`automations`,icon:Ke,label:p.tabs.automations},{id:`files`,icon:Re,label:p.tabs.files},{id:`notes`,icon:Qe,label:p.tabs.notes},{id:`skills`,icon:K,label:p.tabs.skills},{id:`sessions`,icon:W,label:p.tabs.sessions},{id:`progress`,icon:Ue,label:p.tabs.progress}];async function Zr(){if(!qr)return;let e=await O(qr);Je(e?`success`:`warning`,e?u.workspace.pathCopied:u.clipboard.copyFailed,void 0,{duration:e?2500:4e3})}function Qr(){en(null),nn(!0)}return(0,X.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,X.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3`,children:[(0,X.jsx)(Dt,{items:Xr,activeTab:Q,onChange:An,ariaLabel:p.navAria,tabIdPrefix:`project-primary-tab`,className:`min-w-0 flex-1`}),(0,X.jsxs)(D,{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:()=>An(`settings`),children:[(0,X.jsx)(Me,{className:`size-4`,"aria-hidden":!0}),p.tabs.settings,jr?(0,X.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500`,"aria-label":p.settings.unsavedChanges}):null]})]}),bn?(0,X.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:bn}):null,(0,X.jsxs)(`div`,{className:E(`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,X.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,X.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,X.jsx)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.directionTitle}),(0,X.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:y.outcome||j?.digest.summary||y.description||y.brief||p.overview.directionFallback}),j?.digest.recommendedAction?(0,X.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm font-medium leading-6 text-fg`,children:Bn(p.overview.recommendedNext,{action:j.digest.recommendedAction})}):null]}),(0,X.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:(0,X.jsxs)(D,{type:`button`,variant:`secondary`,onClick:()=>void Er(),disabled:je,children:[(0,X.jsx)(He,{className:`size-4`,"aria-hidden":!0}),je?p.overview.savingDigest:p.overview.saveDigest]})})]})}),(0,X.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,X.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.nextActions})}),(0,X.jsx)(`div`,{className:`divide-y divide-edge`,children:Fr.length?Fr.map(e=>(0,X.jsxs)(s,{to:De(On(`overview`),e.id),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,X.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,X.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.attention[0].summary}):null]},e.id)):(0,X.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.overview.noNextActions})})]}),j?.recentResults.length?(0,X.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,X.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.recentResults})}),(0,X.jsx)(`div`,{className:`divide-y divide-edge`,children:j.recentResults.slice(0,5).map(({taskId:e,taskTitle:t,receipt:n})=>(0,X.jsxs)(s,{to:De(On(`overview`),e),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),(0,X.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,X.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:n.summary})]},n.runId))})]}):null,(0,X.jsxs)(`div`,{className:`grid min-w-0 gap-4 md:grid-cols-2`,children:[(0,X.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,X.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.milestones})}),(0,X.jsx)(`div`,{className:`divide-y divide-edge`,children:y.milestones.length?y.milestones.map(e=>(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-4 py-3`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,X.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:e.status})]},e.id)):(0,X.jsx)(`p`,{className:`px-4 py-5 text-sm text-fg-muted`,children:p.overview.noMilestones})})]}),(0,X.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,X.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.projectUpdates})}),(0,X.jsx)(`div`,{className:`divide-y divide-edge`,children:y.recentUpdates.length?y.recentUpdates.slice(0,3).map(e=>(0,X.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,X.jsx)(`p`,{className:`text-sm leading-5 text-fg`,children:e.summary}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.health})]},e.id)):(0,X.jsx)(`p`,{className:`px-4 py-5 text-sm text-fg-muted`,children:p.overview.noProjectUpdates})})]})]})]}),(0,X.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,X.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.attention}),Pr.length?(0,X.jsx)(`div`,{className:`mt-3 grid gap-3`,children:Pr.map(e=>{let t=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(Ee,{className:`size-4 text-amber-600 dark:text-amber-300`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title})]}),(0,X.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?` · ${Ir(e.status)}`:``]})]});return e.href?(0,X.jsx)(s,{to:e.href,onClick:Pn(Kn(e.href)),className:`min-w-0 rounded-md bg-surface-base p-3 hover:bg-surface-hover`,children:t},e.id):(0,X.jsx)(`div`,{className:`min-w-0 rounded-md bg-surface-base p-3`,children:t},e.id)})}):(0,X.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:p.overview.noBlockedTasks}),(0,X.jsxs)(`form`,{onSubmit:mr,className:`mt-4 flex gap-2 border-t border-edge pt-4`,children:[(0,X.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:xn.title,onChange:e=>Sn(t=>({...t,title:e.target.value})),placeholder:p.overview.blockerTitlePlaceholder}),(0,X.jsx)(D,{type:`submit`,variant:`secondary`,className:`shrink-0 rounded-lg px-3`,disabled:mn||!xn.title.trim(),"aria-label":mn?p.overview.addingBlocker:p.overview.addBlocker,title:mn?p.overview.addingBlocker:p.overview.addBlocker,children:(0,X.jsx)(C,{className:`size-4`,"aria-hidden":!0})})]})]}),(0,X.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(pe,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,X.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:p.overview.recentSessions})]}),(0,X.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>An(`sessions`),children:p.common.viewAll})]}),(0,X.jsx)(`div`,{className:`divide-y divide-edge`,children:Nr.length?Nr.map(e=>(0,X.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Pn(`sessions`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.name||e.key}),(0,X.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:Vn(e.updatedAt)})]}),(0,X.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:e.agentId||p.common.agent})]},e.key)):(0,X.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.overview.noSessions})})]})]})]}):null,Q===`tasks`?(0,X.jsx)(kn,{ref:vn,tasks:j?.tasks??[],dependencyEdges:j?.dependencyEdges??[],monitoring:j?.monitoring??{projectId:e??``,mode:`observe`,allowedActions:[],confidenceThreshold:.75,scenarios:[],configured:!1},returnTo:On(`tasks`),copy:p.board,onAction:qn,onReorder:ir,onUndoMove:ar,onDependenciesChange:or,onMonitoringChange:sr,onCreate:$n,actionBusyId:gn}):null,Q===`automations`?(0,X.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,X.jsx)(At,{projectId:y.id,embedded:!0,title:p.automations.title,subtitle:p.automations.hint})}):null,Q===`notes`?(0,X.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,X.jsx)(wt,{selectedNoteId:n,basePath:`/projects/${encodeURIComponent(y.id)}/notes`,showLibrary:!1,allowMediaCapture:!1,projectId:y.id,listTitle:p.notes.title,listDescription:p.notes.hint,emptyText:p.notes.emptyTitle,emptyDescription:p.notes.emptyDescription,listWidthStorageKey:`xopc.projectNotes.listWidth.${y.id}`})}):null,Q===`skills`?(0,X.jsx)(Yt,{projectId:y.id,copy:p.skills}):null,Q===`files`?(0,X.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,X.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:y.effectiveWorkspaceRoot?(0,X.jsxs)(`div`,{"data-project-files-grid":!0,className:E(`grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[var(--project-files-panel-width)_6px_minmax(0,1fr)]`,mt&&`cursor-col-resize select-none`),style:{"--project-files-panel-width":`${st}px`},children:[(0,X.jsxs)(`aside`,{className:`flex min-h-0 flex-col border-b border-edge lg:border-b-0 lg:border-r`,children:[(0,X.jsxs)(`div`,{className:`flex h-11 items-center gap-1 border-b border-edge bg-surface-muted/50 px-3 text-sm`,children:[(0,X.jsx)(Ae,{workspacePath:qr}),(0,X.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,X.jsx)(`button`,{type:`button`,className:E(`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,St&&`bg-surface-hover text-fg`),onClick:()=>Ct(!0),"aria-label":p.files.search,title:p.files.search,"aria-pressed":St,children:(0,X.jsx)(w,{className:`size-3.5`,"aria-hidden":!0})}),(0,X.jsx)(Ze,{className:`size-7 shrink-0 rounded-md p-0`,loading:Rt,label:u.cron.refresh,onClick:()=>void lr()})]})]}),St?(0,X.jsx)(`div`,{className:`shrink-0 border-b border-edge bg-surface-muted/40 px-3 py-2`,children:(0,X.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,X.jsx)(w,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,X.jsx)(`input`,{type:`text`,role:`searchbox`,value:kt,onChange:e=>jt(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,X.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:()=>{jt(``),Ct(!1)},children:(0,X.jsx)(T,{className:`size-3.5`,"aria-hidden":!0})})]})}):null,Bt?(0,X.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:Bt}):null,dr?(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-2`,children:Pt?(0,X.jsxs)(`div`,{className:`space-y-2 px-3 py-1`,children:[(0,X.jsx)(ct,{className:`h-11 w-full`}),(0,X.jsx)(ct,{className:`h-11 w-full`}),(0,X.jsx)(ct,{className:`h-11 w-full`})]}):It?(0,X.jsxs)(`p`,{className:`px-3 py-2 text-xs text-red-600 dark:text-red-400`,children:[u.workspace.loadError,`: `,It]}):Mt.length===0?(0,X.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:p.files.noSearchResults}):Mt.map(e=>(0,X.jsxs)(`button`,{type:`button`,className:E(`flex w-full min-w-0 items-center gap-2 px-3 py-2 text-left hover:bg-surface-hover`,Xe===e.path&&`bg-accent-soft text-accent-fg`),onClick:()=>$e(e.path),title:e.path,children:[(0,X.jsx)(Qe,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`span`,{className:`block truncate text-sm text-fg`,children:e.name}),(0,X.jsx)(`span`,{className:`block truncate text-xs text-fg-subtle`,children:e.path})]})]},e.path))}):Rt&&Fe.length===0?(0,X.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.files.loading}):(0,X.jsx)(ot,{tree:Fe,selectedPath:Xe,onSelectFile:Dr,onSelectEntry:Or,onExpandDir:e=>void ur(e),onAction:kr,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,X.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":p.files.resizeHandle,className:E(`hidden cursor-col-resize touch-none items-stretch justify-center bg-surface-panel transition-colors hover:bg-surface-hover lg:flex`,mt&&`bg-surface-hover`),onPointerDown:Ar,children:(0,X.jsx)(`div`,{className:`my-3 w-px rounded-full bg-edge-strong/70`})}),(0,X.jsx)(`div`,{className:`min-h-0 min-w-0 overflow-hidden bg-surface-base`,children:Xe?(0,X.jsx)(Ce,{filePath:Xe,projectId:y.id,agentId:y.defaultAgentId||Wt||void 0,onClose:()=>$e(null)}):(0,X.jsx)(`div`,{className:`flex h-full min-h-[18rem] items-center justify-center px-6 text-center`,children:(0,X.jsxs)(`div`,{className:`max-w-sm`,children:[(0,X.jsx)(Re,{className:`mx-auto size-8 text-fg-subtle`,"aria-hidden":!0}),(0,X.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:p.files.previewEmptyTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.files.previewEmptyDescription})]})})})]}):(0,X.jsxs)(`div`,{className:`grid gap-3 px-4 py-8 text-sm text-fg-muted`,children:[(0,X.jsx)(`p`,{children:p.files.needWorkspace}),(0,X.jsx)(`div`,{children:(0,X.jsx)(D,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>An(`settings`),children:p.files.openSettings})})]})})}):null,Q===`sessions`?(0,X.jsxs)(`section`,{id:`project-panel-sessions`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-sessions`,className:`grid min-h-full content-start gap-3`,children:[P.length?(0,X.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,X.jsx)(w,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,"aria-hidden":!0}),(0,X.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:H,onChange:e=>ne(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`}),H?(0,X.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:()=>ne(``),children:(0,X.jsx)(T,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,zr.length?(0,X.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:zr.map(e=>{let t=Vn(e.updatedAt),n=e.routing?.agentId||e.agentId||p.common.agent,r=Qn(e),i=e.name?.trim()||p.sessions.fallbackTitle,a=Lr(e.messageCount??0);return(0,X.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Pn(`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,X.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,X.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,X.jsx)(W,{className:`size-4`,"aria-hidden":!0})}),(0,X.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-fg`,children:i}),r?(0,X.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,X.jsxs)(`div`,{className:`mt-auto grid gap-2 pt-4 text-xs text-fg-muted`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,X.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,X.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:a})]}),t?(0,X.jsxs)(`span`,{className:`truncate rounded-md bg-surface-base px-2 py-1`,children:[p.sessions.updated,`: `,t]}):null]})]},e.key)})}):Br?(0,X.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,X.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:p.sessions.noMatches})}):(0,X.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:p.sessions.emptyTitle}),(0,X.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,X.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,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.progress.title}),(0,X.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:Bn(p.progress.count,{count:ue})})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.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,X.jsx)(`input`,{type:`checkbox`,checked:Se,onChange:e=>ke(e.currentTarget.checked),className:`size-4 rounded border-edge text-accent focus:ring-accent/30`}),p.progress.includeRelated]}),(0,X.jsxs)(D,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3`,onClick:()=>void cr(),disabled:J,children:[(0,X.jsx)(gt,{className:E(`size-4`,J&&`animate-spin`),"aria-hidden":!0}),p.common.refresh]})]})]}),(0,X.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:J&&oe.length===0?(0,X.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:p.progress.loading}):oe.length?(0,X.jsx)(`div`,{className:`divide-y divide-edge`,children:oe.map(e=>{let t=p.progress.types[e.type]??e.type,n=p.progress.objectKinds[e.primaryObject.kind]??e.primaryObject.kind,r=er(e),i=e.relatedProjects.length>0&&!e.scopes.some(e=>e.scopeKind===`project`&&e.scopeId===y.id);return(0,X.jsxs)(`article`,{className:`grid gap-2 px-4 py-3`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),i?(0,X.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,X.jsxs)(`p`,{className:`mt-1 min-w-0 truncate text-sm text-fg-muted`,children:[n,`: `,Xn(e)]})]}),(0,X.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,dateTime:new Date(e.createdAt).toISOString(),children:Vn(e.createdAt)})]}),r?(0,X.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:r}):null,(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,X.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:[p.progress.actor,`: `,Yn(e)]}),(0,X.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[p.progress.source,`: `,Zn(e)]})]})]},e.id)})}):(0,X.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:p.progress.empty})})]}):null,Q===`settings`?(0,X.jsxs)(`form`,{id:`project-panel-settings`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-settings`,onSubmit:yr,onBlurCapture:Mr.onBlurCapture,className:`grid min-h-full content-start gap-4 pb-1`,children:[(0,X.jsxs)(`section`,{className:`flex min-w-0 items-start justify-between gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.summaryTitle}),(0,X.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:p.settings.summaryHint})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-2`,children:[(0,X.jsx)(`span`,{className:E(`rounded-full px-2 py-0.5 text-xs font-medium`,Hn(Cn.status)),children:p.settings.statuses[Cn.status]}),(0,X.jsx)(Tt,{status:Mr.status,error:Mr.error})]})]}),(0,X.jsxs)(`div`,{className:`grid items-start gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,X.jsxs)(`div`,{className:`grid gap-4`,children:[(0,X.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.detailsTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.detailsHint})]}),(0,X.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,X.jsx)(Un,{label:p.settings.name,children:(0,X.jsx)(`input`,{className:Wn(),value:Cn.name,onChange:e=>br({name:e.target.value})})}),(0,X.jsx)(Un,{label:p.settings.defaultAgent,children:(0,X.jsxs)(f,{className:Wn(),value:Cn.defaultAgentId,onChange:e=>br({defaultAgentId:e.target.value},!0),children:[(0,X.jsx)(m,{value:``,children:p.settings.globalDefaultAgent}),Ht.map(e=>(0,X.jsx)(m,{value:e.id,children:it(e,u.agentsSettings)},e.id))]})}),(0,X.jsx)(Un,{label:p.settings.status,children:Wr?(0,X.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,X.jsxs)(f,{className:Wn(),value:Cn.status===`archived`?`active`:Cn.status,onChange:e=>br({status:e.target.value},!0),children:[(0,X.jsx)(m,{value:`active`,children:p.settings.statuses.active}),(0,X.jsx)(m,{value:`paused`,children:p.settings.statuses.paused})]})}),(0,X.jsx)(Un,{label:p.settings.description,hint:p.settings.descriptionHint,children:(0,X.jsx)(`textarea`,{className:Wn(!0),value:Cn.description,onChange:e=>br({description:e.target.value})})})]})]}),(0,X.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.projectGuidanceTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.projectGuidanceHint})]}),(0,X.jsx)(Un,{label:p.settings.brief,hint:p.settings.briefHint,children:(0,X.jsx)(`textarea`,{className:Wn(!0),value:Cn.brief,onChange:e=>br({brief:e.target.value})})}),(0,X.jsx)(Un,{label:p.settings.instructions,hint:p.settings.instructionsHint,children:(0,X.jsx)(`textarea`,{className:Wn(!0),value:Cn.instructions,onChange:e=>br({instructions:e.target.value})})})]})]}),(0,X.jsxs)(`aside`,{className:`grid gap-4 xl:sticky xl:top-0`,children:[(0,X.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.workspaceRoot}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceIndependentHint})]}),(0,X.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,X.jsx)(`span`,{className:`w-fit rounded-md bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:Kr?p.settings.workspaceModeFollow:p.settings.workspaceModeFixed}),(0,X.jsx)(`div`,{className:`break-all font-mono text-xs leading-5 text-fg`,title:qr,children:qr}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsxs)(D,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void Zr(),children:[(0,X.jsx)(v,{className:`size-4`,"aria-hidden":!0}),p.settings.copyWorkspacePath]}),(0,X.jsx)(Ae,{workspacePath:qr}),(0,X.jsxs)(D,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:xr,children:[(0,X.jsx)(rt,{className:`size-4`,"aria-hidden":!0}),p.settings.migrateWorkspace]})]})]})]}),(0,X.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.currentProjectTitle}),(0,X.jsxs)(`div`,{className:`grid gap-2`,children:[(0,X.jsx)(Gn,{label:p.settings.defaultAgent,value:Vr}),(0,X.jsx)(Gn,{label:p.settings.pinState,value:Gr?p.settings.pinned:p.settings.notPinned}),(0,X.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,X.jsx)(Gn,{label:p.settings.createdAt,value:Vn(y.createdAt)||p.common.never}),(0,X.jsx)(Gn,{label:p.settings.updatedAt,value:Vn(y.updatedAt)||p.common.never})]})]})]}),(0,X.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.managementTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:p.settings.managementHint})]}),(0,X.jsxs)(`div`,{className:`grid gap-3`,children:[(0,X.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Gr?p.settings.pinnedTitle:p.settings.pinTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:p.settings.pinHint})]}),(0,X.jsxs)(D,{type:`button`,variant:`ghost`,className:`w-fit rounded-lg`,disabled:cn===`pin`,onClick:()=>void Cr(),children:[Gr?(0,X.jsx)(Ge,{className:`size-4`,"aria-hidden":!0}):(0,X.jsx)(ft,{className:`size-4`,"aria-hidden":!0}),Gr?p.settings.unpinProject:p.settings.pinProject]})]}),(0,X.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Wr?p.settings.restoreTitle:p.settings.archiveTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:Wr?p.settings.restoreHint:p.settings.archiveHint})]}),(0,X.jsxs)(D,{type:`button`,variant:Wr?`primary`:`ghost`,className:`w-fit rounded-lg`,disabled:cn===`archive`,onClick:()=>void wr(),children:[Wr?(0,X.jsx)(gt,{className:`size-4`,"aria-hidden":!0}):(0,X.jsx)(qe,{className:`size-4`,"aria-hidden":!0}),Wr?p.settings.restoreProject:p.settings.archiveProject]})]})]})]}),(0,X.jsxs)(`section`,{className:`grid gap-3 rounded-lg border border-red-500/20 bg-red-500/5 p-4`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-red-700 dark:text-red-300`,children:p.settings.dangerTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-red-700/80 dark:text-red-200/80`,children:p.settings.dangerHint})]}),(0,X.jsxs)(D,{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:()=>Qt(!0),children:[(0,X.jsx)(me,{className:`size-4`,"aria-hidden":!0}),p.settings.deleteConfirmAction]})]})]})]})]}):null]}),(0,X.jsx)(ee,{open:Zt,onOpenChange:e=>{un||Qt(e)},children:(0,X.jsxs)(L,{children:[(0,X.jsx)(N,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,X.jsxs)(R,{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,X.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,X.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,X.jsx)(Ee,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(z,{className:`text-base font-semibold text-fg`,children:p.settings.deleteConfirmTitle}),(0,X.jsx)(F,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:y?Bn(p.settings.deleteConfirm,{name:y.name}):p.settings.deleteConfirmFallback})]})]}),(0,X.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,X.jsx)(I,{asChild:!0,children:(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:un,children:p.common.cancel})}),(0,X.jsxs)(D,{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:un||!y,onClick:()=>void Tr(),children:[(0,X.jsx)(me,{className:`size-4`,"aria-hidden":!0}),p.settings.deleteConfirmAction]})]})]})]})}),(0,X.jsx)(ee,{open:tn,onOpenChange:e=>{Jt||nn(e)},children:(0,X.jsxs)(L,{children:[(0,X.jsx)(N,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,X.jsxs)(R,{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,X.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,X.jsx)(z,{className:`text-base font-semibold text-fg`,children:p.settings.workspaceMigrationTitle}),(0,X.jsx)(F,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.workspaceMigrationDescription})]}),(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,X.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,X.jsx)(`span`,{className:`font-medium text-fg-muted`,children:p.settings.workspaceMode}),(0,X.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[(0,X.jsxs)(`label`,{className:E(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,rn===`fixed`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,X.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:rn===`fixed`,onChange:()=>an(`fixed`),disabled:Jt}),(0,X.jsxs)(`span`,{className:`min-w-0`,children:[(0,X.jsx)(`span`,{className:`block font-medium`,children:p.settings.workspaceModeFixed}),(0,X.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceMigrationFixedHint})]})]}),(0,X.jsxs)(`label`,{className:E(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,rn===`follow`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,X.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:rn===`follow`,onChange:()=>an(`follow`),disabled:Jt}),(0,X.jsxs)(`span`,{className:`min-w-0`,children:[(0,X.jsx)(`span`,{className:`block font-medium`,children:p.settings.workspaceModeFollow}),(0,X.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceHint})]})]})]})]}),rn===`fixed`?(0,X.jsx)(Ot,{value:on,onChange:sn,disabled:Jt,wd:d,placeholder:p.settings.workspacePlaceholder,inputClassName:Wn(),autoFocus:!0}):null,(0,X.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,X.jsx)(`div`,{className:`rounded-lg bg-surface-muted px-3 py-2 text-xs leading-5 text-fg-subtle`,children:Bn(p.settings.workspaceCurrent,{workspace:Jr})})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,X.jsx)(I,{asChild:!0,children:(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:Jt,children:p.common.cancel})}),(0,X.jsxs)(D,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:Jt||!Yr,onClick:()=>void Sr(),children:[(0,X.jsx)(rt,{className:`size-4`,"aria-hidden":!0}),p.settings.workspaceMigrationConfirm]})]})]})]})}),(0,X.jsx)(ee,{open:!!$t,onOpenChange:e=>{e||en(null)},children:(0,X.jsxs)(L,{children:[(0,X.jsx)(N,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,X.jsxs)(R,{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,X.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,X.jsx)(z,{className:`text-base font-semibold text-fg`,children:p.settings.workspaceMissingTitle}),(0,X.jsx)(F,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:$t?Bn(p.settings.workspaceMissingDescription,{workspace:$t}):null})]}),$t?(0,X.jsx)(`div`,{className:`px-5 py-4`,children:(0,X.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,X.jsx)(Re,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:$t})]})}):null,(0,X.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,X.jsx)(D,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:Qr,disabled:Jt,children:p.settings.workspaceMissingBack}),(0,X.jsxs)(D,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:()=>void Sr({createWorkspaceRoot:!0}),disabled:Jt,children:[(0,X.jsx)(rt,{className:`size-4`,"aria-hidden":!0}),p.settings.workspaceMissingCreate]})]})]})]})})]})}export{ir as ProjectDetailPage};