@xopcai/xopc 0.0.243 → 0.0.244

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 (118) 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-DDH4HgP7.js → agent-avatar-dicebear-BhXGsupm.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-BDCfJZhh.js → agent-defaults-settings-panel-Blzn2H6t.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agents-B0ZWgf-U.js → agents-Cmp-z8Y_.js} +1 -1
  6. package/dist/gateway/static/root/assets/{app-management-settings-panel-Blfwszzn.js → app-management-settings-panel-CezjAP1K.js} +1 -1
  7. package/dist/gateway/static/root/assets/{appearance-settings-C3V7Na75.js → appearance-settings-C-CfS05x.js} +1 -1
  8. package/dist/gateway/static/root/assets/{apps-page-BiEks0-F.js → apps-page-7Y13_bqZ.js} +1 -1
  9. package/dist/gateway/static/root/assets/{attachment-load-BS-S4LJ9.js → attachment-load-DI4CoIga.js} +1 -1
  10. package/dist/gateway/static/root/assets/{automations-page-C7Y3L30D.js → automations-page-D04Xceck.js} +1 -1
  11. package/dist/gateway/static/root/assets/{automations-workspace-A3zPkPuo.js → automations-workspace-wEO1OWk0.js} +1 -1
  12. package/dist/gateway/static/root/assets/{binary-plugins-BM9B5kcm.js → binary-plugins-BJQe8TRu.js} +1 -1
  13. package/dist/gateway/static/root/assets/{block-editor-BbnpkYP9.js → block-editor-BSzGjJC6.js} +1 -1
  14. package/dist/gateway/static/root/assets/{browser-settings-page-Dk4FQ7fY.js → browser-settings-page-DjAZ_LF2.js} +1 -1
  15. package/dist/gateway/static/root/assets/{browser-workflows-page-B9qGL-it.js → browser-workflows-page-CwbxA3B7.js} +1 -1
  16. package/dist/gateway/static/root/assets/{capabilities-settings-panel--tR_El9e.js → capabilities-settings-panel-jt9bqUMK.js} +1 -1
  17. package/dist/gateway/static/root/assets/{channels-settings-D347vl_J.js → channels-settings-Cz_TWY3a.js} +1 -1
  18. package/dist/gateway/static/root/assets/{chat-terminal-dock-DABPvwBT.js → chat-terminal-dock-D3gj2D3U.js} +1 -1
  19. package/dist/gateway/static/root/assets/{connectors-page-B-tvJkRJ.js → connectors-page-Shs5vbzx.js} +1 -1
  20. package/dist/gateway/static/root/assets/{cron-expression-D3bsKbNd.js → cron-expression-DgWHw0jX.js} +1 -1
  21. package/dist/gateway/static/root/assets/{date-picker-BsGM6Yty.js → date-picker-CKg-RPbs.js} +1 -1
  22. package/dist/gateway/static/root/assets/{dependency-picker-Dj3g6YXZ.js → dependency-picker-CVYkw-NN.js} +1 -1
  23. package/dist/gateway/static/root/assets/{desktop-pet-C1QT0Sur.js → desktop-pet-Bf46oXTY.js} +1 -1
  24. package/dist/gateway/static/root/assets/{desktop-pet-settings-r6kAOnfY.js → desktop-pet-settings-BJO_klc7.js} +1 -1
  25. package/dist/gateway/static/root/assets/{extension-debug-page-DOkf7nh9.js → extension-debug-page-T2PmFFOW.js} +1 -1
  26. package/dist/gateway/static/root/assets/{extension-page-Cq2IA4Ho.js → extension-page-2wAE2RCe.js} +1 -1
  27. package/dist/gateway/static/root/assets/{extension-settings-page-DQn4qjDZ.js → extension-settings-page-Y9ZiCJ21.js} +1 -1
  28. package/dist/gateway/static/root/assets/{gateway-config-api-DM3poL22.js → gateway-config-api-DaYY1Gkn.js} +1 -1
  29. package/dist/gateway/static/root/assets/{gateway-settings-DPgH1hnh.js → gateway-settings-eO3IzW_J.js} +1 -1
  30. package/dist/gateway/static/root/assets/{heartbeat-settings-Bk80-E3b.js → heartbeat-settings-BAgrkyHc.js} +1 -1
  31. package/dist/gateway/static/root/assets/{home-page-DKo5JiMR.js → home-page-GTjKH7LK.js} +1 -1
  32. package/dist/gateway/static/root/assets/{index-B0WJL9N1.js → index-DUz0O54y.js} +8 -8
  33. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BEwvd8ZU.js → keyboard-shortcuts-settings-CWGqL6o5.js} +1 -1
  34. package/dist/gateway/static/root/assets/{local-app-workbench-page--eJ5rmNj.js → local-app-workbench-page-DKJ-rks0.js} +1 -1
  35. package/dist/gateway/static/root/assets/{local-apps-page-CgkY9E-r.js → local-apps-page-Bfidv29d.js} +1 -1
  36. package/dist/gateway/static/root/assets/{logs-page-Z49Td0J9.js → logs-page-DwAHrPbF.js} +1 -1
  37. package/dist/gateway/static/root/assets/{management-settings-Dv8NSJKt.js → management-settings-BG7j1I9f.js} +1 -1
  38. package/dist/gateway/static/root/assets/{markdown-split-Cm0RBB-t.js → markdown-split-AnmmpLs6.js} +1 -1
  39. package/dist/gateway/static/root/assets/{media-plugins-Bcr5sU1f.js → media-plugins-CGS-05cE.js} +1 -1
  40. package/dist/gateway/static/root/assets/{mobile-pairing-wizard-kKDiXofY.js → mobile-pairing-wizard-DoKK5GfV.js} +1 -1
  41. package/dist/gateway/static/root/assets/{notes-page-CgsaRaGi.js → notes-page-Lr8rsFAR.js} +1 -1
  42. package/dist/gateway/static/root/assets/{notes-workbench-C1DEE09k.js → notes-workbench-ISWnKLxO.js} +2 -2
  43. package/dist/gateway/static/root/assets/{project-detail-page-isRapnp5.js → project-detail-page-BZqr4yam.js} +1 -1
  44. package/dist/gateway/static/root/assets/{projects-page-zvsjg0mi.js → projects-page-Dau8733A.js} +1 -1
  45. package/dist/gateway/static/root/assets/{remote-access-hub-C9TGZ9Hc.js → remote-access-hub-DdChlvGP.js} +1 -1
  46. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-2zm9edMA.js → runtime-tools-settings-panel-CmZTNv1W.js} +1 -1
  47. package/dist/gateway/static/root/assets/{schema-form-54A5gzkN.js → schema-form-XlVPyiVQ.js} +1 -1
  48. package/dist/gateway/static/root/assets/{sessions-page-BP8RyiUn.js → sessions-page-C3kADsd4.js} +1 -1
  49. package/dist/gateway/static/root/assets/settings-advanced-gate-CSYy6SUa.js +1 -0
  50. package/dist/gateway/static/root/assets/{settings-page-DzDhoyxv.js → settings-page-DblUeM3V.js} +1 -1
  51. package/dist/gateway/static/root/assets/{setup-status-panel-uDicHU1w.js → setup-status-panel-bDfRfSnq.js} +1 -1
  52. package/dist/gateway/static/root/assets/{share-preview-page-lOmLCWFS.js → share-preview-page-DBMWFMN-.js} +1 -1
  53. package/dist/gateway/static/root/assets/{shares-settings-T4Yvouvv.js → shares-settings-Bu6lIStj.js} +1 -1
  54. package/dist/gateway/static/root/assets/{skill-reload-api-DVb7nrXz.js → skill-reload-api-BNMc4l04.js} +1 -1
  55. package/dist/gateway/static/root/assets/{skills-page-CnyNH3To.js → skills-page-CSOseeQe.js} +1 -1
  56. package/dist/gateway/static/root/assets/{skills-page.utils-CgDtf2qs.js → skills-page.utils-CniRGhkJ.js} +1 -1
  57. package/dist/gateway/static/root/assets/{system-settings-panel-C8yWfwtR.js → system-settings-panel-D0GqNpKy.js} +1 -1
  58. package/dist/gateway/static/root/assets/{task-detail-page-Tzfjlbf3.js → task-detail-page-BRCq-nR7.js} +1 -1
  59. package/dist/gateway/static/root/assets/{tunnel-api-Bvg679no.js → tunnel-api-BtjS2nrM.js} +1 -1
  60. package/dist/gateway/static/root/assets/{use-autosave-D88VGoyG.js → use-autosave-TwuAycG8.js} +1 -1
  61. package/dist/gateway/static/root/assets/{user-context-page-RijPtyfO.js → user-context-page-CbqPu8xZ.js} +1 -1
  62. package/dist/gateway/static/root/assets/{voice-api-key-field-CBHLsMcc.js → voice-api-key-field-CzwG5plu.js} +1 -1
  63. package/dist/gateway/static/root/assets/{work-discovery-overlay-GGe2TQ98.js → work-discovery-overlay-DS15FzQA.js} +1 -1
  64. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-C0layUE9.js → workflow-run-setup-panel-C_boCemi.js} +1 -1
  65. package/dist/gateway/static/root/assets/{workflows-page-DQXIzBAc.js → workflows-page-CaI2ruyy.js} +1 -1
  66. package/dist/gateway/static/root/index.html +1 -1
  67. package/dist/package.js +1 -1
  68. package/dist/src/agent/agent-manager.js +4 -4
  69. package/dist/src/agent/background-review/run-background-review.js +1 -1
  70. package/dist/src/agent/embedded/model-runtime.js +1 -1
  71. package/dist/src/agent/embedded/run-for-session.js +1 -1
  72. package/dist/src/agent/image/tool-model-config.js +1 -1
  73. package/dist/src/agent/ipc/inbox.js +1 -1
  74. package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +1 -1
  75. package/dist/src/agent/service.js +2 -2
  76. package/dist/src/agent/session/session-inspector.js +1 -1
  77. package/dist/src/agent/skills/hub-lock.js +1 -1
  78. package/dist/src/agent/tasks/task-judge-service.js +3 -3
  79. package/dist/src/ai-assist/text-assist.js +1 -1
  80. package/dist/src/auth/credentials.js +2 -2
  81. package/dist/src/auth/profiles/store.js +1 -1
  82. package/dist/src/auth/sync-provider-auth.js +2 -2
  83. package/dist/src/automations/draft/automation-draft-service.js +1 -1
  84. package/dist/src/browser/providers/browser-ext-install.js +1 -1
  85. package/dist/src/cli/commands/agent.js +2 -2
  86. package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
  87. package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
  88. package/dist/src/cli/commands/models.js +2 -2
  89. package/dist/src/cli/commands/onboard.js +1 -1
  90. package/dist/src/cli/commands/profile.js +1 -1
  91. package/dist/src/cli/commands/tunnel.js +1 -1
  92. package/dist/src/cli/commands/update.js +1 -1
  93. package/dist/src/cli/extension-cli-register.js +1 -1
  94. package/dist/src/config/index.js +5 -5
  95. package/dist/src/config/loader.js +1 -1
  96. package/dist/src/config/models-json.js +1 -1
  97. package/dist/src/extensions/lockfile.js +1 -1
  98. package/dist/src/gateway/agents-admin.js +1 -1
  99. package/dist/src/gateway/file-path-classifier.js +1 -1
  100. package/dist/src/gateway/heartbeat/service.js +1 -1
  101. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  102. package/dist/src/gateway/hono/routes/connectors.js +23 -23
  103. package/dist/src/gateway/hono/routes/models.js +1 -1
  104. package/dist/src/gateway/hono/routes/sessions.js +1 -1
  105. package/dist/src/gateway/run-loop.js +1 -1
  106. package/dist/src/gateway/service/config-coordinator.js +1 -1
  107. package/dist/src/gateway/service.js +6 -6
  108. package/dist/src/heartbeat/index.js +1 -1
  109. package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
  110. package/dist/src/providers/index.js +2 -2
  111. package/dist/src/providers/model-registry.js +1 -1
  112. package/dist/src/providers/register-runtime-providers.js +1 -1
  113. package/dist/src/share/hosted-session-share.js +1 -1
  114. package/dist/src/tui/tui-startup-resources.js +1 -1
  115. package/dist/src/tui/tui.js +1 -1
  116. package/dist/src/workflows/service/workflow-run-service.js +1 -1
  117. package/package.json +3 -3
  118. package/dist/gateway/static/root/assets/settings-advanced-gate-D4EMxWAZ.js +0 -1
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,l as a,p as o,t as s}from"./chunk-KS7C4IRE-BaASWQor.js";import{a as c,c as l,i as u,n as d,o as f,r as p,s as m,t as h}from"./dist-CpzYSoz7.js";import{t as g}from"./check-DUBLcKHA.js";import{c as _,l as v,n as y,o as b,r as x,s as S,t as C,u as w}from"./popover-select-C-Hj-nXR.js";import{t as T}from"./circle-check-C23XjkUj.js";import{t as E}from"./copy-Dv6d4Dvw.js";import{t as D}from"./download-Dk-ZjtO6.js";import{t as O}from"./external-link-DjqjBmc3.js";import{d as k,p as A}from"./markdown-view-PPCLt7fu.js";import{t as j}from"./message-square-plus-XP0tGdlV.js";import{t as M}from"./plus-Q2yW6OE7.js";import{t as N}from"./search-DA7gz22f.js";import{t as P}from"./x-B_N4OPjy.js";import{t as F}from"./copy-to-clipboard-HOJ79TWv.js";import{t as I}from"./messages-CTSgFlE4.js";import{a as L,n as R,r as z}from"./locale-store-CMZljTJx.js";import{t as B}from"./cn-JdwAhgNB.js";import{t as V}from"./button-CtTvuElV.js";import{n as H}from"./interaction-BmQogeqz.js";import{t as U}from"./skeleton-BwbyijEw.js";import{$l as W,$r as G,$s as ee,Ai as te,B as ne,Bl as K,Bs as re,Ci as ie,Dc as ae,Di as q,Ei as oe,Es as se,Fl as ce,Go as le,Gs as ue,Il as de,Jc as fe,Jr as pe,Js as me,Ko as he,Ll as ge,Mi as _e,Ms as ve,N as ye,Nl as be,Nr as xe,Oi as Se,Pc as Ce,Pi as we,Qr as Te,Qs as Ee,Rc as De,Ri as Oe,Si as ke,Ti as Ae,Vi as je,Wi as Me,Wt as Ne,Xr as Pe,Yc as Fe,Yo as Ie,Ys as Le,Yt as Re,Zo as ze,Zr as Be,_l as Ve,as as He,bi as Ue,bl as We,cl as Ge,cs as Ke,dc as qe,ds as Je,ei as Ye,eu as Xe,fs as Ze,gi as Qe,gr as $e,hi as et,il as tt,ji as nt,jl as rt,jr as it,ki as at,lo as ot,mc as st,mi as ct,ni as lt,nu as ut,oa as dt,ol as ft,os as pt,qr as mt,qt as ht,ri as gt,rl as _t,sl as vt,ti as yt,tl as bt,uc as xt,us as St,vi as Ct,wi as wt,wl as Tt,wt as Et,xi as Dt,xs as Ot,yi as kt,ys as At,zc as jt,zi as Mt}from"./index-B0WJL9N1.js";import{t as Nt}from"./notes-workbench-C1DEE09k.js";import{n as Pt,t as Ft}from"./use-autosave-D88VGoyG.js";import{t as It}from"./page-tabs-BaEQMYm_.js";import{t as Lt}from"./date-picker-BsGM6Yty.js";import{c as Rt,l as zt,n as Bt,o as Vt,r as Ht,t as Ut}from"./style-TIDOdKy0.js";import{t as Wt}from"./automations-workspace-A3zPkPuo.js";import{i as Gt,p as Kt,s as qt}from"./skills-page.utils-CgDtf2qs.js";import{t as Jt}from"./dependency-picker-Dj3g6YXZ.js";var J=e(t(),1),Yt=n(),Y=r();function Xt(e){let t=(0,Yt.c)(27),{value:n,onPick:r,disabled:i,placeholder:a,title:o,className:s,maxWidthClass:c,compact:l,"aria-label":u}=e,d=c===void 0?`max-w-[min(12rem,40vw)]`:c,f=l===void 0?!1:l,p,m;t[0]!==a||t[1]!==n?(m=n.trim(),p=m?Mt(m):a??``,t[0]=a,t[1]=n,t[2]=p,t[3]=m):(p=t[2],m=t[3]);let h=p,g=o??(m||void 0),_=u??o??h,v=f?`inline-flex size-9 shrink-0 items-center justify-center rounded-lg p-0`:`inline-flex min-h-8 min-w-0 shrink-0 items-center gap-1 rounded-lg px-2 py-1 text-xs`,y=!f&&d,b=i&&`cursor-not-allowed opacity-60`,x;t[4]!==s||t[5]!==v||t[6]!==y||t[7]!==b?(x=B(v,`border border-edge-subtle/80 bg-surface-hover/40 dark:border-edge-subtle`,H.transition,H.focusRingPanel,`cursor-pointer hover:bg-surface-hover/70 dark:hover:bg-surface-hover/50`,y,b,s),t[4]=s,t[5]=v,t[6]=y,t[7]=b,t[8]=x):x=t[8];let S;t[9]!==i||t[10]!==r?(S=e=>{e.stopPropagation(),i||r()},t[9]=i,t[10]=r,t[11]=S):S=t[11];let C=f?`size-4`:`size-3.5`,w;t[12]===C?w=t[13]:(w=B(`shrink-0 text-fg-muted`,C),t[12]=C,t[13]=w);let T;t[14]===w?T=t[15]:(T=(0,Y.jsx)(ft,{className:w,"aria-hidden":!0}),t[14]=w,t[15]=T);let E;t[16]!==f||t[17]!==h?(E=f?null:(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-left font-medium text-fg`,children:h}),t[16]=f,t[17]=h,t[18]=E):E=t[18];let D;return t[19]!==i||t[20]!==S||t[21]!==T||t[22]!==E||t[23]!==g||t[24]!==_||t[25]!==x?(D=(0,Y.jsxs)(`button`,{type:`button`,disabled:i,title:g,"aria-label":_,className:x,onClick:S,children:[T,E]}),t[19]=i,t[20]=S,t[21]=T,t[22]=E,t[23]=g,t[24]=_,t[25]=x,t[26]=D):D=t[26],D}function Zt(e){let t=(0,Yt.c)(38),{value:n,onChange:r,disabled:i,wd:a,placeholder:o,inputClassName:s,autoFocus:c,trailing:l}=e,u;t[0]!==r||t[1]!==n?(u={initialPath:n,onPicked:r},t[0]=r,t[1]=n,t[2]=u):u=t[2];let d=Oe(u),f;t[3]===n?f=t[4]:(f=n.trim(),t[3]=n,t[4]=f);let p=f,m=p?`${p}\n${a.chooseFolder}`:`${o??a.notSet}\n${a.selectWorkingDirectory}`,h;t[5]===s?h=t[6]:(h=B(`min-w-0 flex-1`,s),t[5]=s,t[6]=h);let g=i||d.picking,_;t[7]===r?_=t[8]:(_=e=>void r(e.target.value),t[7]=r,t[8]=_);let v=o??a.pathInputPlaceholder,y;t[9]!==c||t[10]!==h||t[11]!==g||t[12]!==_||t[13]!==v||t[14]!==n?(y=(0,Y.jsx)(`input`,{type:`text`,className:h,value:n,disabled:g,onChange:_,placeholder:v,autoFocus:c,autoComplete:`off`,spellCheck:!1}),t[9]=c,t[10]=h,t[11]=g,t[12]=_,t[13]=v,t[14]=n,t[15]=y):y=t[15];let b=i||d.picking,x;t[16]!==m||t[17]!==d.pick||t[18]!==b||t[19]!==n||t[20]!==a.selectWorkingDirectory?(x=(0,Y.jsx)(Xt,{compact:!0,value:n,onPick:d.pick,disabled:b,title:m,"aria-label":a.selectWorkingDirectory}),t[16]=m,t[17]=d.pick,t[18]=b,t[19]=n,t[20]=a.selectWorkingDirectory,t[21]=x):x=t[21];let S;t[22]!==x||t[23]!==l?(S=(0,Y.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[x,l]}),t[22]=x,t[23]=l,t[24]=S):S=t[24];let C;t[25]!==S||t[26]!==y?(C=(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[y,S]}),t[25]=S,t[26]=y,t[27]=C):C=t[27];let w;t[28]!==d.confirmPick||t[29]!==d.hasNativePicker||t[30]!==d.modalOpen||t[31]!==d.setModalOpen||t[32]!==p||t[33]!==a?(w=d.hasNativePicker?null:(0,Y.jsx)(we,{open:d.modalOpen,onOpenChange:d.setModalOpen,initialAbsolutePath:p||void 0,onConfirm:d.confirmPick,wd:a}),t[28]=d.confirmPick,t[29]=d.hasNativePicker,t[30]=d.modalOpen,t[31]=d.setModalOpen,t[32]=p,t[33]=a,t[34]=w):w=t[34];let T;return t[35]!==C||t[36]!==w?(T=(0,Y.jsxs)(Y.Fragment,{children:[C,w]}),t[35]=C,t[36]=w,t[37]=T):T=t[37],T}function Qt(e){return L(z(`/api/projects/${encodeURIComponent(e)}/skills`))}function $t(e,t){return L(z(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`))}function en(e,t){return L(z(`/api/projects/${encodeURIComponent(e)}/workspace-trust`),{method:`PATCH`,body:JSON.stringify({trusted:t})})}function tn(e,t){let n=new FormData;return n.set(`file`,t),L(z(`/api/projects/${encodeURIComponent(e)}/skills/upload`),{method:`POST`,body:n})}function nn(e,t,n={}){return L(z(`/api/projects/${encodeURIComponent(e)}/skills/marketplace/install`),{method:`POST`,body:JSON.stringify({name:t,...n})})}function rn(e,t){return L(z(`/api/projects/${encodeURIComponent(e)}/skills/source/install`),{method:`POST`,body:JSON.stringify({source:t})})}function an(e,t){return L(z(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`),{method:`DELETE`})}function on({projectId:e,copy:t}){let[n,r]=(0,J.useState)([]),[i,a]=(0,J.useState)([]),[o,s]=(0,J.useState)([]),[l,u]=(0,J.useState)([]),[g,y]=(0,J.useState)([]),[b,x]=(0,J.useState)(``),[T,E]=(0,J.useState)(null),[O,k]=(0,J.useState)(!1),[A,j]=(0,J.useState)(!0),[F,I]=(0,J.useState)(!1),[L,R]=(0,J.useState)(null),[z,H]=(0,J.useState)(``),[W,G]=(0,J.useState)(null),[ee,te]=(0,J.useState)(null),[ne,K]=(0,J.useState)(``),[re,ie]=(0,J.useState)(1),[q,oe]=(0,J.useState)(null),[se,le]=(0,J.useState)(!1),[fe,pe]=(0,J.useState)(``),[me,he]=(0,J.useState)(``),_e=(0,J.useRef)(null),ye=(0,J.useCallback)(async()=>{j(!0),H(``);try{let t=await Qt(e);r(t.items),a(t.inheritedItems),s(t.sources),u(t.diagnostics)}catch(e){H(e instanceof Error?e.message:String(e))}finally{j(!1)}},[e]);(0,J.useEffect)(()=>{ye()},[ye]),(0,J.useEffect)(()=>{let t=!1;return wt(e).then(e=>{t||y(e)}).catch(()=>{t||y([])}),()=>{t=!0}},[e]),(0,J.useEffect)(()=>{if(!b){E(null);return}let e=g.find(e=>e.key===b),t=!1;return E(null),H(``),k(!0),Re(e?.agentId??e?.routing?.agentId,b,!0).then(e=>{t||E(e)}).catch(e=>{t||H(e instanceof Error?e.message:String(e))}).finally(()=>{t||k(!1)}),()=>{t=!0}},[b,g]),(0,J.useEffect)(()=>{if(W!==`marketplace`)return;let e=new AbortController,t=window.setTimeout(()=>{le(!0),pe(``),Kt({q:ne,page:re,pageSize:8,sort:`downloads`,signal:e.signal}).then(oe).catch(t=>{e.signal.aborted||pe(t instanceof Error?t.message:String(t))}).finally(()=>{e.signal.aborted||le(!1)})},250);return()=>{window.clearTimeout(t),e.abort()}},[W,re,ne]);async function be(e,t){I(!0),R(t??null),H(``);try{await e(),G(null),he(``),await ye()}catch(e){H(e instanceof Error?e.message:String(e))}finally{I(!1),R(null)}}async function xe(t){H(``);try{te((await $t(e,t)).skill)}catch(e){H(e instanceof Error?e.message:String(e))}}async function Se(n){if(n.removable&&window.confirm(t.removeConfirm.replace(`{{name}}`,n.name))){I(!0);try{await an(e,n.directoryId),await ye()}catch(e){H(e instanceof Error?e.message:String(e))}finally{I(!1)}}}async function Ce(){I(!0),H(``);try{await en(e,!0),await ye()}catch(e){H(e instanceof Error?e.message:String(e))}finally{I(!1)}}let we=o.find(e=>e.origin===`agents-workspace`),Te=new Map(T?.skills.map(e=>[e.name,e]));return(0,Y.jsxs)(`section`,{id:`project-panel-skills`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-skills`,className:`grid content-start gap-4`,children:[(0,Y.jsxs)(`div`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.title}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,Y.jsxs)(v,{children:[(0,Y.jsx)(w,{asChild:!0,children:(0,Y.jsxs)(V,{type:`button`,children:[(0,Y.jsx)(M,{className:`size-4`,"aria-hidden":!0}),t.add,(0,Y.jsx)(ge,{className:`size-3.5`,"aria-hidden":!0})]})}),(0,Y.jsx)(_,{children:(0,Y.jsxs)(S,{align:`end`,sideOffset:8,className:`z-50 w-72 rounded-lg border border-edge bg-surface-panel p-1.5 shadow-xl`,children:[(0,Y.jsx)(un,{icon:ve,title:t.marketplace,hint:t.marketplaceHint,onClick:()=>G(`marketplace`)}),(0,Y.jsx)(un,{icon:bt,title:t.source,hint:t.sourceHint,onClick:()=>G(`source`)}),(0,Y.jsx)(un,{icon:Ot,title:t.upload,hint:t.uploadHint,onClick:()=>_e.current?.click()})]})})]}),(0,Y.jsx)(`input`,{ref:_e,type:`file`,accept:`.zip,application/zip`,className:`hidden`,onChange:t=>{let n=t.target.files?.[0];n&&be(()=>tn(e,n)),t.target.value=``}})]}),o.length?(0,Y.jsx)(`div`,{className:`mt-3 grid gap-2 rounded-md border border-edge-subtle bg-surface-base p-3`,children:o.map(e=>(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-xs`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg`,children:e.origin===`xopc-workspace`?t.xopcSource:t.agentsSource}),e.writable?null:(0,Y.jsx)(`span`,{className:`rounded bg-surface-hover px-1.5 py-0.5 text-fg-muted`,children:t.sourceReadOnly}),(0,Y.jsx)(`span`,{className:`text-fg-subtle`,children:dn(t,e.state)}),(0,Y.jsxs)(`span`,{className:`min-w-0 break-all font-mono text-fg-subtle`,children:[t.path,`: `,e.rootDir]})]},e.origin))}):null]}),z?(0,Y.jsx)(`p`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:z}):null,we?.state===`untrusted`?(0,Y.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,Y.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Y.jsx)(ae,{className:`mt-0.5 size-4 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.trustTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.trustHint})]})]}),(0,Y.jsxs)(V,{type:`button`,variant:`secondary`,disabled:F,onClick:()=>void Ce(),children:[(0,Y.jsx)(ue,{className:`size-4`,"aria-hidden":!0}),F?t.trusting:t.trustAction]})]}):null,l.some(e=>e.type!==`skipped`)?(0,Y.jsxs)(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 px-4 py-3`,children:[(0,Y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.diagnosticsTitle}),(0,Y.jsx)(`ul`,{className:`mt-2 grid gap-1 text-xs leading-5 text-fg-muted`,children:l.filter(e=>e.type!==`skipped`).map((e,t)=>(0,Y.jsx)(`li`,{children:e.message},`${e.type}:${e.path??``}:${t}`))})]}):null,g.length?(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3 rounded-lg border border-edge bg-surface-panel p-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.sessionViewLabel}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:O?t.sessionLoading:b?T?.agentId:t.sessionViewAll})]}),(0,Y.jsx)(C,{value:b,options:g.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:x})]}):null,A?(0,Y.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(e=>(0,Y.jsx)(U,{className:`h-36 rounded-lg`},e))}):n.length?(0,Y.jsx)(sn,{title:t.localTitle,items:n,copy:t,busy:F,availabilityByName:Te,onPreview:xe,onRemove:Se}):(0,Y.jsxs)(`div`,{className:`rounded-lg border border-dashed border-edge bg-surface-panel px-6 py-12 text-center`,children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.empty}),(0,Y.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:t.emptyHint})]}),!A&&i.length?(0,Y.jsx)(sn,{title:t.inheritedTitle,hint:t.inheritedHint,items:i,copy:t,busy:F,availabilityByName:Te,onPreview:xe,onRemove:Se}):null,(0,Y.jsx)(h,{open:W!==null,onOpenChange:e=>{e||G(null)},children:(0,Y.jsxs)(f,{children:[(0,Y.jsx)(c,{className:`fixed inset-0 z-50 bg-black/45`}),(0,Y.jsxs)(p,{className:B(`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`,W===`marketplace`?`h-[min(46rem,calc(100vh-2rem))] w-[min(58rem,calc(100vw-2rem))]`:`h-[min(22rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))]`),children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(m,{className:`text-base font-semibold text-fg`,children:W===`marketplace`?t.marketplace:t.source}),(0,Y.jsx)(d,{asChild:!0,children:(0,Y.jsx)(V,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,Y.jsx)(P,{className:`size-4`})})})]}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:W===`marketplace`?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.marketplace}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.marketplaceHint}),(0,Y.jsxs)(`div`,{className:`relative mt-3`,children:[(0,Y.jsx)(N,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`input`,{className:`h-10 w-full rounded-md border border-edge bg-surface-base pl-9 pr-3 text-sm outline-none focus:border-accent`,value:ne,onChange:e=>{K(e.target.value),ie(1)},placeholder:t.marketplacePlaceholder,autoFocus:!0})]}),fe?(0,Y.jsx)(`p`,{className:`mt-3 text-sm text-red-600 dark:text-red-300`,children:fe}):null,se&&!q?(0,Y.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[0,1,2,3].map(e=>(0,Y.jsx)(U,{className:`h-32 rounded-lg`},e))}):q?.items.length?(0,Y.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:q.items.map(r=>{let i=r.providerId??q.provider,a=Gt(r,i),o=n.some(e=>e.origin===`xopc-workspace`&&(e.directoryId===r.id||e.directoryId===a||e.name===r.name)),s=L===a;return(0,Y.jsxs)(`article`,{className:`group flex min-h-32 gap-3 rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Y.jsx)(qt,{name:r.name,className:`size-10`}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Y.jsx)(`h4`,{className:`truncate text-sm font-semibold text-fg`,children:r.name}),(0,Y.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:r.description||`—`}),(0,Y.jsxs)(`div`,{className:`mt-auto flex items-end justify-between gap-2 pt-2`,children:[(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-fg-subtle`,children:[(0,Y.jsx)(D,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceDownloads,` `,r.downloads]}),(0,Y.jsx)(V,{type:`button`,className:`h-8 px-2.5 text-xs`,variant:o?`secondary`:`primary`,disabled:F||o,onClick:()=>void be(()=>nn(e,a,{provider:i}),a),children:o?t.marketplaceInstalled:s?t.installing:t.install})]})]})]},`${i??`default`}:${r.id}`)})}):se?null:(0,Y.jsx)(`p`,{className:`mt-6 text-center text-sm text-fg-muted`,children:t.marketplaceEmpty}),q&&q.meta.totalPages>1?(0,Y.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,Y.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t.marketplacePage.replace(`{{page}}`,String(q.meta.page)).replace(`{{total}}`,String(q.meta.totalPages))}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsxs)(V,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:se||re<=1,onClick:()=>ie(e=>Math.max(1,e-1)),children:[(0,Y.jsx)(de,{className:`size-4`}),t.marketplacePrevious]}),(0,Y.jsxs)(V,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:se||re>=q.meta.totalPages,onClick:()=>ie(e=>e+1),children:[t.marketplaceNext,(0,Y.jsx)(ce,{className:`size-4`})]})]})]}):null]}):(0,Y.jsxs)(`section`,{className:`flex h-full flex-col`,children:[(0,Y.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:t.sourceHint}),(0,Y.jsx)(`input`,{className:`mt-4 h-10 w-full rounded-md border border-edge bg-surface-base px-3 text-sm outline-none focus:border-accent`,value:me,onChange:e=>he(e.target.value),placeholder:t.sourcePlaceholder,autoFocus:!0}),(0,Y.jsxs)(`div`,{className:`mt-auto flex justify-end gap-2 border-t border-edge pt-4`,children:[(0,Y.jsx)(d,{asChild:!0,children:(0,Y.jsx)(V,{type:`button`,variant:`secondary`,children:t.close})}),(0,Y.jsx)(V,{type:`button`,disabled:F||!me.trim(),onClick:()=>void be(()=>rn(e,me.trim())),children:F?t.installing:t.install})]})]})})]})]})}),(0,Y.jsx)(h,{open:!!ee,onOpenChange:e=>{e||te(null)},children:(0,Y.jsxs)(f,{children:[(0,Y.jsx)(c,{className:`fixed inset-0 z-50 bg-black/45`}),(0,Y.jsxs)(p,{className:`fixed left-1/2 top-1/2 z-50 flex h-[min(42rem,calc(100vh-2rem))] w-[min(48rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-xl`,children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(m,{className:`text-base font-semibold text-fg`,children:ee?.name}),(0,Y.jsx)(d,{asChild:!0,children:(0,Y.jsx)(V,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,Y.jsx)(P,{className:`size-4`})})})]}),(0,Y.jsx)(`pre`,{className:`min-h-0 flex-1 overflow-auto whitespace-pre-wrap p-5 text-sm leading-6 text-fg-muted`,children:ee?.bodyMarkdown})]})]})})]})}function sn(e){let t=(0,Yt.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,Y.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,Y.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,Y.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,Y.jsxs)(`article`,{className:B(`flex min-h-36 flex-col rounded-lg border border-edge bg-surface-panel p-4`,!e.effective&&`opacity-70`),children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(ut,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,Y.jsx)(`h4`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:e.name})]}),(0,Y.jsx)(`p`,{className:`mt-2 line-clamp-2 flex-1 text-sm leading-5 text-fg-muted`,children:e.description||e.directoryId}),(0,Y.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5 text-[11px] text-fg-subtle`,children:[(0,Y.jsx)(`span`,{className:`rounded-md bg-surface-hover/70 px-2 py-0.5`,children:cn(a,e.origin)}),e.writable?null:(0,Y.jsx)(`span`,{className:`rounded-md bg-surface-hover/70 px-2 py-0.5`,children:a.sourceReadOnly}),e.effective?null:(0,Y.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,Y.jsx)(`span`,{className:B(`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:ln(a,t)}):null]}),(0,Y.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,Y.jsxs)(V,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>void c(e.key),children:[(0,Y.jsx)(O,{className:`size-3.5`,"aria-hidden":!0}),a.view]}),e.removable?(0,Y.jsxs)(V,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-red-600`,disabled:o,onClick:()=>void l(e),children:[(0,Y.jsx)(se,{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,Y.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,Y.jsxs)(`section`,{className:`grid gap-3`,children:[f,m]}),t[22]=f,t[23]=m,t[24]=h):h=t[24],h}function cn(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 ln(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 un(e){let t=(0,Yt.c)(13),{icon:n,title:r,hint:i,onClick:a}=e,o;t[0]===n?o=t[1]:(o=(0,Y.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`,"aria-hidden":!0}),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=(0,Y.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:r}),t[2]=r,t[3]=s);let c;t[4]===i?c=t[5]:(c=(0,Y.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-fg-muted`,children:i}),t[4]=i,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;return t[9]!==a||t[10]!==o||t[11]!==l?(u=(0,Y.jsx)(b,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-3 rounded-md px-3 py-2.5 text-left hover:bg-surface-hover`,onClick:a,children:[o,l]})}),t[9]=a,t[10]=o,t[11]=l,t[12]=u):u=t[12],u}function dn(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 fn=[`backlog`,`ready`,`active`,`review`,`closed`];function pn(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 mn(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 hn(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 gn(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 _n(e,t){let n=new Set(e.map(e=>e.id)),{outgoing:r,incoming:i}=gn(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 vn(e,t){let{incoming:n}=gn(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 yn(e,t){let{incoming:n,outgoing:r}=gn(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 bn={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 xn(e){let t=(0,Yt.c)(25),{data:n,selected:r}=e,i=n.task,a=i.operationalState===`waiting`||i.operationalState===`blocked`,o=bn[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=B(`group w-56 rounded-xl border bg-surface-panel p-3 shadow-surface transition-opacity`,o,s,c),t[0]=o,t[1]=s,t[2]=c,t[3]=l):l=t[3];let u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Y.jsx)(Ht,{type:`target`,position:zt.Left,className:`!size-3 !border-2 !border-surface-panel !bg-accent opacity-60 transition-opacity group-hover:opacity-100`}),t[4]=u):u=t[4];let d;t[5]===i.title?d=t[6]:(d=(0,Y.jsx)(`strong`,{className:`line-clamp-2 min-w-0 text-sm font-medium leading-5 text-fg`,children:i.title}),t[5]=i.title,t[6]=d);let f;t[7]===a?f=t[8]:(f=a?(0,Y.jsx)(fe,{className:`mt-0.5 size-3.5 shrink-0 text-violet-600 dark:text-violet-300`,"aria-hidden":!0}):null,t[7]=a,t[8]=f);let p;t[9]!==d||t[10]!==f?(p=(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[d,f]}),t[9]=d,t[10]=f,t[11]=p):p=t[11];let m;t[12]===n.phaseLabel?m=t[13]:(m=(0,Y.jsx)(`span`,{children:n.phaseLabel}),t[12]=n.phaseLabel,t[13]=m);let h;t[14]!==a||t[15]!==i.blockedBy?(h=a&&i.blockedBy.length>0?(0,Y.jsx)(`span`,{children:i.blockedBy.length}):null,t[14]=a,t[15]=i.blockedBy,t[16]=h):h=t[16];let g;t[17]!==h||t[18]!==m?(g=(0,Y.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2 text-[11px] text-fg-subtle`,children:[m,h]}),t[17]=h,t[18]=m,t[19]=g):g=t[19];let _;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Y.jsx)(Ht,{type:`source`,position:zt.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,Y.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 Sn={taskNode:xn};function Cn(e){let t=(0,Yt.c)(90),{tasks:n,dependencyEdges:r,returnTo:i,copy:a,onDependenciesChange:o}=e,[c,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(!1),[f,p]=(0,J.useState)(),[m,h]=(0,J.useState)(),g=(0,J.useRef)(null),_;t[0]!==r||t[1]!==n?(_=vn(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(kn),t[3]=v,t[4]=u,t[5]=c,t[6]=n,t[7]=y):y=t[7];let b=y,x;t[8]===b?x=t[9]:(x=new Set(b.map(Z)),t[8]=b,t[9]=x);let S=x,C;if(t[10]!==r||t[11]!==S){let e;t[13]===S?e=t[14]:(e=e=>S.has(e.dependencyTaskId)&&S.has(e.dependentTaskId),t[13]=S,t[14]=e),C=r.filter(e),t[10]=r,t[11]=S,t[12]=C}else C=t[12];let w=C,T;t[15]!==w||t[16]!==b?(T=_n(b,w),t[15]=w,t[16]=b,t[17]=T):T=t[17];let E=T,D;t[18]!==f||t[19]!==w?(D=f?yn(f,w):void 0,t[18]=f,t[19]=w,t[20]=D):D=t[20];let k=D,A;t[21]===f?A=t[22]:(A=e=>e.id===f,t[21]=f,t[22]=A);let j=b.find(A),M;t[23]===b?M=t[24]:(M=new Map(b.map(On)),t[23]=b,t[24]=M);let N=M,P;if(t[25]!==a.phases||t[26]!==E||t[27]!==k||t[28]!==b){let e;t[30]!==a.phases||t[31]!==E||t[32]!==k?(e=e=>({id:e.id,type:`taskNode`,position:E.get(e.id)??{x:0,y:0},data:{task:e,phaseLabel:a.phases[e.phase],dimmed:!!(k&&!k.has(e.id))}}),t[30]=a.phases,t[31]=E,t[32]=k,t[33]=e):e=t[33],P=b.map(e),t[25]=a.phases,t[26]=E,t[27]=k,t[28]=b,t[29]=P}else P=t[29];let F=P,I;if(t[34]!==k||t[35]!==N||t[36]!==w){let e;t[38]!==k||t[39]!==N?(e=e=>{let t=N.get(e.dependencyTaskId),n=t?.phase===`closed`&&t.resolution===`done`,r=!!(k&&(!k.has(e.dependencyTaskId)||!k.has(e.dependentTaskId)));return{id:`${e.dependencyTaskId}:${e.dependentTaskId}`,source:e.dependencyTaskId,target:e.dependentTaskId,markerEnd:{type:Rt.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]=k,t[39]=N,t[40]=e):e=t[40],I=w.map(e),t[34]=k,t[35]=N,t[36]=w,t[37]=I}else I=t[37];let L=I,R,z;t[41]!==f||t[42]!==S?(R=()=>{f&&!S.has(f)&&p(void 0)},z=[f,S],t[41]=f,t[42]=S,t[43]=R,t[44]=z):(R=t[43],z=t[44]),(0,J.useEffect)(R,z);let H,U;t[45]!==L||t[46]!==m?(H=()=>{m&&!L.some(e=>e.id===m)&&h(void 0)},U=[L,m],t[45]=L,t[46]=m,t[47]=H,t[48]=U):(H=t[47],U=t[48]),(0,J.useEffect)(H,U);let W;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(W=()=>{let e=window.requestAnimationFrame(()=>{g.current?.fitView({padding:.2,minZoom:.35,maxZoom:1,duration:250})});return()=>window.cancelAnimationFrame(e)},t[49]=W):W=t[49];let G;t[50]!==u||t[51]!==c||t[52]!==b.length?(G=[u,c,b.length],t[50]=u,t[51]=c,t[52]=b.length,t[53]=G):G=t[53],(0,J.useEffect)(W,G);let ee;t[54]===f?ee=t[55]:(ee=()=>{f&&g.current?.fitView({nodes:[{id:f}],padding:1.5,minZoom:.7,maxZoom:1,duration:250})},t[54]=f,t[55]=ee);let te=ee,ne;t[56]!==r||t[57]!==o?(ne=e=>{if(!e.source||!e.target||e.source===e.target)return;let t=r.filter(t=>t.dependentTaskId===e.target).map(Dn);t.includes(e.source)||o(e.target,[...t,e.source])},t[56]=r,t[57]=o,t[58]=ne):ne=t[58];let K=ne,re;t[59]!==r||t[60]!==o||t[61]!==m?(re=()=>{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(X)))},t[59]=r,t[60]=o,t[61]=m,t[62]=re):re=t[62];let ie=re,ae;t[63]===a.connectHint?ae=t[64]:(ae=(0,Y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.connectHint}),t[63]=a.connectHint,t[64]=ae);let q=u?`secondary`:`ghost`,oe;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(oe=()=>d(En),t[65]=oe):oe=t[65];let se=u?a.allTasks:a.blockedChains,ce;t[66]!==u||t[67]!==q||t[68]!==se?(ce=(0,Y.jsx)(V,{type:`button`,variant:q,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":u,onClick:oe,children:se}),t[66]=u,t[67]=q,t[68]=se,t[69]=ce):ce=t[69];let le;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(le=()=>l(Tn),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,Y.jsx)(V,{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=j?(0,Y.jsxs)(V,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:te,children:[(0,Y.jsx)(vt,{className:`size-3.5`,"aria-hidden":!0}),a.locateTask]}):null,pe;t[75]!==a.removeDependency||t[76]!==ie||t[77]!==m?(pe=m?(0,Y.jsx)(V,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs text-danger`,onClick:ie,children:a.removeDependency}):null,t[75]=a.removeDependency,t[76]=ie,t[77]=m,t[78]=pe):pe=t[78];let me;t[79]!==ce||t[80]!==de||t[81]!==fe||t[82]!==pe?(me=(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[ce,de,fe,pe]}),t[79]=ce,t[80]=de,t[81]=fe,t[82]=pe,t[83]=me):me=t[83];let he;t[84]!==ae||t[85]!==me?(he=(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-b border-edge bg-surface-panel px-3 py-2.5`,children:[ae,me]}),t[84]=ae,t[85]=me,t[86]=he):he=t[86];let ge=b.length>0?(0,Y.jsxs)(`div`,{className:B(`grid h-[min(42rem,calc(100vh-14rem))] min-h-[28rem]`,j&&`lg:grid-cols-[minmax(0,1fr)_18rem]`),children:[(0,Y.jsxs)(Vt,{nodes:F,edges:L,nodeTypes:Sn,nodesDraggable:!1,nodesConnectable:!0,elementsSelectable:!0,onNodeClick:(e,t)=>p(t.id),onEdgeClick:(e,t)=>h(t.id),onConnect:K,onPaneClick:()=>{p(void 0),h(void 0)},onInit:e=>{g.current=e},fitView:!0,minZoom:.25,maxZoom:1.25,panOnScroll:!0,zoomOnDoubleClick:!1,proOptions:{hideAttribution:!0},children:[(0,Y.jsx)(Ut,{color:`var(--color-edge)`,gap:22,size:1}),(0,Y.jsx)(Bt,{showInteractive:!1,className:`!border-edge !bg-surface-panel !shadow-surface`})]}),j?(0,Y.jsxs)(`aside`,{className:`overflow-y-auto border-t border-edge bg-surface-panel p-4 lg:border-l lg:border-t-0`,children:[(0,Y.jsx)(`p`,{className:`text-xs font-medium text-accent-fg`,children:a.phases[j.phase]}),(0,Y.jsx)(`h3`,{className:`mt-2 text-sm font-semibold leading-6 text-fg`,children:j.title}),j.operationalState===`blocked`&&j.blockedBy.length>0?(0,Y.jsxs)(`div`,{className:`mt-4 rounded-lg bg-violet-500/8 p-3`,children:[(0,Y.jsx)(`p`,{className:`text-xs font-medium text-violet-700 dark:text-violet-300`,children:a.blockedBy.replace(`{{count}}`,String(j.blockedBy.length))}),(0,Y.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:j.blockedBy.map(wn)})]}):null,(0,Y.jsxs)(s,{to:Ke(i,j.id),className:`mt-4 inline-flex items-center gap-1.5 text-xs font-medium text-accent-fg hover:underline`,children:[(0,Y.jsx)(O,{className:`size-3.5`,"aria-hidden":!0}),a.openTask]})]}):null]}):(0,Y.jsx)(`div`,{className:`flex min-h-72 items-center justify-center px-6 text-center text-sm text-fg-muted`,children:a.empty}),_e;return t[87]!==he||t[88]!==ge?(_e=(0,Y.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-base/40`,children:[he,ge]}),t[87]=he,t[88]=ge,t[89]=_e):_e=t[89],_e}function wn(e){return(0,Y.jsx)(`li`,{children:e.title},e.id)}function Tn(e){return!e}function En(e){return!e}function X(e){return e.dependencyTaskId}function Dn(e){return e.dependencyTaskId}function On(e){return[e.id,e]}function Z(e){return e.id}function kn(e){return e.phase!==`closed`}function An({policy:e,copy:t,onSave:n}){let[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(e.mode),[s,g]=(0,J.useState)(Math.round(e.confidenceThreshold*100)),[_,v]=(0,J.useState)(!!e.quietHours),[b,S]=(0,J.useState)(e.quietHours?.startHour??22),[C,w]=(0,J.useState)(e.quietHours?.endHour??8),[T,E]=(0,J.useState)(e.quietHours?.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone),[D,O]=(0,J.useState)(e.allowedActions.includes(`create_project_task`)),[k,A]=(0,J.useState)(!1),[j,M]=(0,J.useState)();(0,J.useEffect)(()=>{o(e.mode),g(Math.round(e.confidenceThreshold*100)),v(!!e.quietHours),S(e.quietHours?.startHour??22),w(e.quietHours?.endHour??8),E(e.quietHours?.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone),O(e.allowedActions.includes(`create_project_task`))},[e]);let N=async()=>{A(!0),M(void 0);try{await n({mode:a,confidenceThreshold:s/100,quietHours:_?{startHour:b,endHour:C,timezone:T}:null,allowedActions:D?[`create_project_task`]:[]}),i(!1)}catch(e){M(e instanceof Error?e.message:t.saveFailed)}finally{A(!1)}};return(0,Y.jsxs)(h,{open:r,onOpenChange:e=>{k||i(e)},children:[(0,Y.jsx)(l,{asChild:!0,children:(0,Y.jsxs)(V,{type:`button`,variant:`ghost`,className:`h-9 gap-2 px-2.5 text-xs`,children:[(0,Y.jsx)(Le,{className:`size-3.5`,"aria-hidden":!0}),t.modes[e.mode]]})}),(0,Y.jsxs)(f,{children:[(0,Y.jsx)(c,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(p,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(36rem,calc(100vh-2rem))] w-[min(34rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(m,{className:`text-base font-semibold text-fg`,children:t.title}),(0,Y.jsx)(u,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,Y.jsx)(d,{asChild:!0,children:(0,Y.jsx)(V,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:k,children:(0,Y.jsx)(P,{className:`size-4`,"aria-hidden":!0})})})]}),(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-4`,children:[(0,Y.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:t.mode}),(0,Y.jsx)(y,{value:a,onChange:e=>o(e.target.value),children:Object.entries(t.modes).map(([e,t])=>(0,Y.jsx)(x,{value:e,children:t},e))})]}),(0,Y.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[t.confidence,` · `,s,`%`]}),(0,Y.jsx)(`input`,{type:`range`,min:`50`,max:`100`,step:`5`,value:s,onChange:e=>g(Number(e.target.value)),className:`accent-accent`})]}),(0,Y.jsxs)(`div`,{className:`rounded-lg border border-edge p-3`,children:[(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:_,onChange:e=>v(e.target.checked)}),t.quietHours]}),_?(0,Y.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-3`,children:[(0,Y.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietStart,(0,Y.jsx)(`input`,{type:`number`,min:`0`,max:`23`,value:b,onChange:e=>S(Number(e.target.value)),className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-fg`})]}),(0,Y.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietEnd,(0,Y.jsx)(`input`,{type:`number`,min:`0`,max:`23`,value:C,onChange:e=>w(Number(e.target.value)),className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-fg`})]}),(0,Y.jsxs)(`label`,{className:`col-span-2 grid gap-1 text-xs text-fg-muted`,children:[t.timezone,(0,Y.jsx)(`input`,{value:T,onChange:e=>E(e.target.value),className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-fg`})]})]}):null]}),(0,Y.jsxs)(`label`,{className:`flex items-start gap-3 rounded-lg border border-edge p-3`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,className:`mt-1`,checked:D,onChange:e=>O(e.target.checked)}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:t.allowTaskCreation}),(0,Y.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.allowTaskCreationDescription})]})]})]}),(0,Y.jsxs)(`div`,{className:`shrink-0 border-t border-edge px-5 py-3`,children:[j?(0,Y.jsx)(`p`,{className:`mb-2 text-xs text-danger`,children:j}):null,(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Y.jsx)(d,{asChild:!0,children:(0,Y.jsx)(V,{type:`button`,variant:`ghost`,disabled:k,children:t.cancel})}),(0,Y.jsx)(V,{type:`button`,variant:`primary`,disabled:k||!T.trim()||b<0||b>23||C<0||C>23,onClick:()=>void N(),children:k?t.saving:t.save})]})]})]})]})]})}function jn(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}var Q={backlog:rt,ready:rt,active:Ce,review:At,closed:T},Mn={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 Nn(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 Pn(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 Fn(e){let t=(0,Yt.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,E;t[0]!==c||t[1]!==l||t[2]!==r||t[3]!==n?(m=hn(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?T:Tt,_=n.priority!==`normal`,g=_||n.operationalState!==`idle`||!!n.latestVerification||n.acceptanceCriteriaCount>0||!!n.dueAt||!!n.nextCheckAt,b=!0,t[20]!==c||t[21]!==n.id?(x=e=>{e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,n.id),c(n.id)},t[20]=c,t[21]=n.id,t[22]=x):x=t[22],t[23]===c?S=t[24]:(S=()=>c(``),t[23]=c,t[24]=S),C=Ln,t[25]!==l||t[26]!==n.id?(w=e=>{e.preventDefault(),e.stopPropagation(),l(n.id)},t[25]=l,t[26]=n.id,t[27]=w):w=t[27],E=`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?(v=Ke(r,n.id),t[28]=r,t[29]=n.id,t[30]=v):v=t[30],y=B(`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]=_,t[12]=v,t[13]=y,t[14]=b,t[15]=x,t[16]=S,t[17]=C,t[18]=w,t[19]=E):(u=t[4],d=t[5],f=t[6],p=t[7],m=t[8],h=t[9],g=t[10],_=t[11],v=t[12],y=t[13],b=t[14],x=t[15],S=t[16],C=t[17],w=t[18],E=t[19]);let D=f?`text-emerald-600 dark:text-emerald-400`:`text-fg-subtle`,O;t[31]===D?O=t[32]:(O=B(`mt-0.5 size-4 shrink-0`,D),t[31]=D,t[32]=O);let k;t[33]!==d||t[34]!==O?(k=(0,Y.jsx)(d,{className:O,"aria-hidden":!0}),t[33]=d,t[34]=O,t[35]=k):k=t[35];let A=f?`text-fg-subtle`:`text-fg`,j;t[36]===A?j=t[37]:(j=B(`min-w-0 break-words text-sm font-semibold leading-5`,A),t[36]=A,t[37]=j);let M;t[38]!==j||t[39]!==n.title?(M=(0,Y.jsx)(`h3`,{className:j,children:n.title}),t[38]=j,t[39]=n.title,t[40]=M):M=t[40];let N;t[41]!==k||t[42]!==M?(N=(0,Y.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[k,M]}),t[41]=k,t[42]=M,t[43]=N):N=t[43];let P;t[44]!==i||t[45]!==n.attention||t[46]!==n.blockedBy||t[47]!==n.operationalState?(P=n.operationalState===`blocked`&&n.blockedBy.length>0?(0,Y.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,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-medium`,children:[(0,Y.jsx)(fe,{className:`size-3.5`,"aria-hidden":!0}),i.blockedBy.replace(`{{count}}`,String(n.blockedBy.length))]}),(0,Y.jsx)(`p`,{className:`mt-1 line-clamp-2 leading-5 text-fg-muted`,children:n.blockedBy.map(In).join(`、`)})]}):n.attention[0]?(0,Y.jsxs)(`p`,{className:`ml-6.5 mt-2.5 flex items-start gap-1.5 text-xs leading-5 text-fg-muted`,children:[(0,Y.jsx)(be,{className:`mt-0.5 size-3.5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,Y.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]=P):P=t[48];let F;t[49]!==i||t[50]!==p||t[51]!==g||t[52]!==_||t[53]!==n.acceptanceCriteriaCount||t[54]!==n.dueAt||t[55]!==n.latestVerification||t[56]!==n.nextCheckAt||t[57]!==n.operationalState||t[58]!==n.priority?(F=g?(0,Y.jsxs)(`div`,{className:`ml-6.5 mt-2.5 flex flex-wrap items-center gap-1.5 text-[11px]`,children:[_?(0,Y.jsx)(`span`,{className:B(`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,Y.jsx)(`span`,{className:B(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,Nn(n.operationalState)),children:i.operationalStates[n.operationalState]}),n.latestVerification?(0,Y.jsx)(`span`,{className:B(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,Pn(n.latestVerification)),children:i.verification[n.latestVerification]}):null,n.acceptanceCriteriaCount>0?(0,Y.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,Y.jsx)(Ce,{className:`size-3`,"aria-hidden":!0}),i.acceptanceCriteria.replace(`{{count}}`,String(n.acceptanceCriteriaCount))]}):null,n.dueAt?(0,Y.jsxs)(`span`,{className:B(`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,Y.jsx)(K,{className:`size-3`,"aria-hidden":!0}),$e(new Date(n.dueAt))]}):null,n.nextCheckAt?(0,Y.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,Y.jsx)(K,{className:`size-3`,"aria-hidden":!0}),$e(new Date(n.nextCheckAt))]}):null]}):null,t[49]=i,t[50]=p,t[51]=g,t[52]=_,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]=F):F=t[59];let I;t[60]!==u||t[61]!==v||t[62]!==N||t[63]!==P||t[64]!==F||t[65]!==y?(I=(0,Y.jsxs)(u,{to:v,className:y,children:[N,P,F]}),t[60]=u,t[61]=v,t[62]=N,t[63]=P,t[64]=F,t[65]=y,t[66]=I):I=t[66];let L;t[67]!==a||t[68]!==i||t[69]!==o||t[70]!==m||t[71]!==h||t[72]!==n?(L=m?(0,Y.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,Y.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,Y.jsx)(At,{className:`size-3.5`,"aria-hidden":!0})}):null,(0,Y.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,Y.jsx)(W,{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]=L):L=t[73];let R;return t[74]!==I||t[75]!==L||t[76]!==b||t[77]!==x||t[78]!==S||t[79]!==C||t[80]!==w||t[81]!==E?(R=(0,Y.jsxs)(`article`,{draggable:b,onDragStart:x,onDragEnd:S,onDragOver:C,onDrop:w,className:E,children:[I,L]}),t[74]=I,t[75]=L,t[76]=b,t[77]=x,t[78]=S,t[79]=C,t[80]=w,t[81]=E,t[82]=R):R=t[82],R}function In(e){return e.title}function Ln(e){e.preventDefault(),e.stopPropagation()}function Rn({tasks:e,dependencyEdges:t,monitoring:n,returnTo:r,copy:i,onAction:a,onReorder:o,onUndoMove:s,onDependenciesChange:l,onMonitoringChange:g,onCreate:_,actionBusyId:v,ref:b}){let S=(0,J.useRef)(null),C=(0,J.useRef)(null),[w,T]=(0,J.useState)(null),[E,D]=(0,J.useState)(!1),[O,k]=(0,J.useState)(null),[A,j]=(0,J.useState)(`board`),[M,N]=(0,J.useState)(!1),[P,F]=(0,J.useState)(()=>crypto.randomUUID()),[L,z]=(0,J.useState)(``),[H,U]=(0,J.useState)(`normal`),[W,G]=(0,J.useState)(``),[ee,te]=(0,J.useState)([]),[K,re]=(0,J.useState)(!1),[ie,ae]=(0,J.useState)(null),q=ye({chat:I(R(e=>e.language)).chat}),oe=pn(e),se=e.filter(e=>e.phase!==`closed`),ce=(e,t)=>void a(e,t),le=async(t,n)=>{let r=e.find(e=>e.id===w);if(T(null),!r||r.id===n)return;let i=oe[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=mn(r,t);r.phase!==t&&!l||l&&!await a(r,l)||await o(r.id,n)&&k({taskId:r.id,phase:r.phase,beforeTaskId:c})},ue=async e=>{e.preventDefault();let t=L.trim();if(!(!t||K)){re(!0),ae(null);try{let e=W?new Date(`${W}T23:59:59.999`).getTime():void 0;await _({requestId:P,objective:t,priority:H,dependsOnTaskIds:ee,attachments:q.wireAttachmentsPayload(),...e===void 0?{}:{dueAt:e}}),z(``),U(`normal`),G(``),te([]),q.clearAttachments(),F(crypto.randomUUID()),N(!1)}catch(e){ae(e instanceof Error?e.message:i.createFailed)}finally{re(!1)}}},de=()=>{F(crypto.randomUUID()),z(``),U(`normal`),G(``),te([]),q.clearAttachments(),ae(null),N(!0)};(0,J.useImperativeHandle)(b,()=>({openCreate:de})),(0,J.useEffect)(()=>{if(!O)return;let e=window.setTimeout(()=>k(null),6e3);return()=>window.clearTimeout(e)},[O]);let fe=(0,J.useCallback)(e=>{let t=C.current;!t||t.pointerId!==e.pointerId||(C.current=null,D(!1),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),pe=(0,J.useCallback)(e=>{if(e.button!==0||jn(e.target))return;let t=S.current;t&&(C.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},[]),me=(0,J.useCallback)(e=>{let t=C.current,n=S.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,D(!0)),e.preventDefault(),n.scrollLeft=t.scrollLeft-r)},[]);return(0,Y.jsxs)(`section`,{id:`project-panel-board`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-board`,className:`flex h-full min-h-0 flex-col overflow-hidden`,children:[(0,Y.jsxs)(`div`,{className:`mb-4 flex shrink-0 flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:i.title}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:i.description})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,Y.jsx)(An,{policy:n,copy:i.monitoring,onSave:g}),(0,Y.jsxs)(`div`,{className:`flex rounded-lg border border-edge bg-surface-panel p-0.5`,children:[(0,Y.jsxs)(`button`,{type:`button`,"aria-pressed":A===`board`,onClick:()=>j(`board`),className:B(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,A===`board`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,Y.jsx)(De,{className:`size-3.5`,"aria-hidden":!0}),i.views.board]}),(0,Y.jsxs)(`button`,{type:`button`,"aria-pressed":A===`graph`,onClick:()=>j(`graph`),className:B(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,A===`graph`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,Y.jsx)(bt,{className:`size-3.5`,"aria-hidden":!0}),i.views.graph]})]})]})]}),A===`board`?(0,Y.jsx)(`div`,{ref:S,className:B(`min-h-0 w-full min-w-0 flex-1 overflow-x-auto overflow-y-hidden overscroll-x-contain pb-2 [scrollbar-width:thin]`,E?`cursor-grabbing select-none`:`cursor-grab`),onPointerDown:pe,onPointerMove:me,onPointerUp:fe,onPointerCancel:fe,onLostPointerCapture:e=>{C.current?.pointerId===e.pointerId&&(C.current=null,D(!1))},children:(0,Y.jsx)(`div`,{className:`grid h-full min-h-0 min-w-[103rem] grid-cols-5 gap-3`,children:fn.map(t=>{let n=Q[t],a=oe[t];return(0,Y.jsxs)(`section`,{onDragOver:n=>{let r=e.find(e=>e.id===w);r&&(r.phase===t||mn(r,t))&&n.preventDefault()},onDrop:e=>{e.preventDefault(),le(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,Y.jsxs)(`header`,{className:`mb-2.5 flex shrink-0 items-center gap-2 px-0.5`,children:[(0,Y.jsxs)(`div`,{className:B(`flex items-center gap-1.5 rounded-md px-2 py-1`,Mn[t]),children:[(0,Y.jsx)(n,{className:`size-3.5`,"aria-hidden":!0}),(0,Y.jsx)(`h3`,{className:`text-sm font-semibold`,children:i.phases[t]})]}),(0,Y.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:a.length})]}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-y-contain pr-1 [scrollbar-gutter:stable] [scrollbar-width:thin]`,children:(0,Y.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.map(e=>(0,Y.jsx)(Fn,{task:e,returnTo:r,copy:i,busy:v===e.id,onAction:ce,onDragStart:T,onDropBefore:e=>void le(t,e)},e.id))})})]},t)})})}):(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Y.jsx)(Cn,{tasks:e,dependencyEdges:t,returnTo:r,copy:{...i.graph,phases:i.phases},onDependenciesChange:l})}),(0,Y.jsx)(h,{open:M,onOpenChange:e=>{K||N(e)},children:(0,Y.jsxs)(f,{children:[(0,Y.jsx)(c,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(p,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(40rem,calc(100vh-2rem))] w-[min(38rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(m,{className:`text-base font-semibold text-fg`,children:i.createTitle}),(0,Y.jsx)(u,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:i.createDescription})]}),(0,Y.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>void ue(e),children:[(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsx)(`label`,{htmlFor:`project-task-objective`,className:`font-medium text-fg-muted`,children:i.objective}),(0,Y.jsxs)(`div`,{className:B(`overflow-hidden rounded-lg border border-edge bg-surface-base transition-colors focus-within:border-accent`,q.isDragging&&`border-accent bg-accent-soft/30`),onDragOver:e=>{e.preventDefault(),K||q.setIsDragging(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||q.setIsDragging(!1)},onDrop:e=>{e.preventDefault(),q.setIsDragging(!1),K||q.processFiles(Array.from(e.dataTransfer.files))},children:[(0,Y.jsx)(`textarea`,{id:`project-task-objective`,autoFocus:!0,className:`min-h-28 w-full resize-y bg-transparent px-3 py-3 text-sm leading-6 text-fg outline-none placeholder:text-fg-subtle`,value:L,onChange:e=>{z(e.target.value),ae(null)},placeholder:i.objectivePlaceholder,maxLength:12e3,disabled:K}),(0,Y.jsx)(ne,{attachments:q.attachments,topPadded:!1,onRemove:e=>{K||q.removeAttachment(e)}}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-t border-edge-subtle px-2.5 py-2`,children:[(0,Y.jsxs)(V,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:K,onClick:()=>q.fileInputRef.current?.click(),children:[(0,Y.jsx)(st,{className:`size-3.5`,"aria-hidden":!0}),i.addFiles]}),(0,Y.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:i.attachmentsDescription}),(0,Y.jsx)(`input`,{ref:q.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{q.processFiles(Array.from(e.target.files??[])),e.currentTarget.value=``}})]})]})]}),(0,Y.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Y.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:i.priority}),(0,Y.jsx)(y,{value:H,onChange:e=>U(e.target.value),disabled:K,children:[`low`,`normal`,`high`,`critical`].map(e=>(0,Y.jsx)(x,{value:e,children:i.priorityOptions[e]},e))})]}),(0,Y.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[i.dueDate,` `,(0,Y.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:i.optional})]}),(0,Y.jsx)(Lt,{className:`min-h-10 bg-surface-base`,value:W,onChange:G,disabled:K,ariaLabel:i.dueDate})]})]}),(0,Y.jsxs)(`fieldset`,{className:`grid gap-2`,children:[(0,Y.jsxs)(`legend`,{className:`text-sm font-medium text-fg-muted`,children:[i.dependencies,` `,(0,Y.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:i.optional})]}),(0,Y.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:i.dependenciesDescription}),(0,Y.jsx)(Jt,{candidates:se,selectedIds:ee,disabled:K,onChange:te,labels:{link:i.linkDependencies,linked:i.linkedDependencies,searchPlaceholder:i.dependencySearchPlaceholder,noMatches:i.noDependencyMatches,noCandidates:i.noDependencyCandidates,remove:i.removeDependency}})]}),ie?(0,Y.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:ie}):null]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(d,{asChild:!0,children:(0,Y.jsx)(V,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:K,children:i.cancel})}),(0,Y.jsx)(V,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:K||!L.trim(),children:K?i.creating:i.create})]})]})]})]})}),O?(0,Y.jsxs)(`div`,{role:`status`,className:`fixed bottom-5 left-1/2 z-50 flex -translate-x-1/2 items-center gap-4 rounded-lg border border-edge bg-surface-panel px-4 py-3 text-sm text-fg shadow-float`,children:[(0,Y.jsx)(`span`,{children:i.moved}),(0,Y.jsx)(`button`,{type:`button`,className:`font-medium text-accent-fg hover:underline`,onClick:()=>{let e=O;k(null),s(e.taskId,e.phase,e.beforeTaskId).then(t=>{t||k(e)})},children:i.undo})]}):null]})}var zn=new Set([{id:`overview`,icon:jt},{id:`tasks`,icon:Ve},{id:`automations`,icon:Ze},{id:`files`,icon:_t},{id:`notes`,icon:Ge},{id:`skills`,icon:re},{id:`sessions`,icon:j},{id:`progress`,icon:Fe},{id:`settings`,icon:me}].map(e=>e.id)),$=`xopc.projectFiles.panelWidthPx`,Bn=320,Vn=220,Hn=560;function Un(e,t){return e.name!==t.name||e.description!==(t.description??``)||e.status!==t.status||e.defaultAgentId!==(t.defaultAgentId??``)||e.executionMode!==t.executionMode||e.brief!==(t.brief??``)||e.instructions!==(t.instructions??``)}function Wn(e){return Math.min(Hn,Math.max(Vn,Math.round(e)))}function Gn(){try{let e=window.localStorage.getItem($);if(e==null)return Bn;let t=Number.parseInt(e,10);return Number.isFinite(t)?Wn(t):Bn}catch{return Bn}}function Kn(e){try{window.localStorage.setItem($,String(Wn(e)))}catch{}}function qn(e){return!!(e&&zn.has(e))}function Jn(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function Yn(e,t=``){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?String(e):$e(n)}function Xn(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 Zn(e){let t=(0,Yt.c)(8),{label:n,hint:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=r?(0,Y.jsx)(`span`,{className:`text-xs leading-5 text-fg-subtle`,children:r}):null,t[2]=r,t[3]=o);let s;return t[4]!==i||t[5]!==a||t[6]!==o?(s=(0,Y.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[a,i,o]}),t[4]=i,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function Qn(e=!1){return B(`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 $n(e){let t=(0,Yt.c)(10),{label:n,value:r,mono:i}=e,a=i===void 0?!1:i,o;t[0]===n?o=t[1]:(o=(0,Y.jsx)(`div`,{className:`text-xs font-medium text-fg-subtle`,children:n}),t[0]=n,t[1]=o);let s=a&&`font-mono text-xs`,c;t[2]===s?c=t[3]:(c=B(`mt-1 min-w-0 truncate text-sm text-fg`,s),t[2]=s,t[3]=c);let l;t[4]!==c||t[5]!==r?(l=(0,Y.jsx)(`div`,{className:c,title:r,children:r}),t[4]=c,t[5]=r,t[6]=l):l=t[6];let u;return t[7]!==o||t[8]!==l?(u=(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-md bg-surface-base px-3 py-2`,children:[o,l]}),t[7]=o,t[8]=l,t[9]=u):u=t[9],u}function er(e){return[e.name,e.slug,e.workspaceRoot,e.description,e.brief].filter(Boolean).join(` `).toLowerCase()}function tr(e){let t=e.lastActiveAt??e.updatedAt??e.createdAt,n=t?new Date(t).getTime():0;return Number.isFinite(n)?n:0}function nr(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function rr(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function ir(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 ar(e){return e.primaryObject.title?.trim()||e.primaryObject.id}function or(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 sr(e){let t=e.sourceChannel?.trim();if(t)return cr(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 cr(r||``)}function cr(e){let t=e.trim().toLowerCase();return t?t===`tui`?`TUI`:t===`acp`?`ACP`:t===`webchat`?`Webchat`:t:``}function lr(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 ur(e){return e.map(e=>({fileId:e.fileId,name:e.name,path:e.path,isDirectory:e.type===`directory`,children:e.type===`directory`?[]:void 0}))}function dr(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:dr(e.children,t,n)}:e)}function fr({currentProject:e,pm:t,projectsText:n,wd:r}){let i=a(),[o,s]=(0,J.useState)(!1),[l,y]=(0,J.useState)([e]),[b,x]=(0,J.useState)(``),[C,T]=(0,J.useState)(!1),[E,D]=(0,J.useState)(null),[O,k]=(0,J.useState)(!1),[A,j]=(0,J.useState)(`new`),[P,F]=(0,J.useState)(``),[I,L]=(0,J.useState)(``),[R,z]=(0,J.useState)(!1),[H,U]=(0,J.useState)(null),[W,G]=(0,J.useState)(null),ee=(0,J.useCallback)(async()=>{T(!0),D(null);try{let t=await Ae({limit:100});y(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){D(e instanceof Error?e.message:String(e))}finally{T(!1)}},[e]);(0,J.useEffect)(()=>{y(t=>[e,...t.filter(t=>t.id!==e.id)])},[e]),(0,J.useEffect)(()=>{o&&ee()},[ee,o]);let te=(0,J.useMemo)(()=>{let t=b.trim().toLowerCase().split(/\s+/).filter(Boolean);return l.filter(t=>t.id!==e.id).filter(e=>{if(t.length===0)return!0;let n=er(e);return t.every(e=>n.includes(e))}).sort((e,t)=>tr(t)-tr(e))},[e.id,l,b]),ne=e=>t.statuses[e.status]??e.status,K=e=>e.workspaceRoot||e.effectiveWorkspaceRoot||e.description||e.brief||t.common.defaultWorkspace,re=e=>{j(e),F(``),L(``),U(null),k(!0),s(!1)},ie=(0,J.useCallback)(async(e={})=>{let t=I.trim(),n=P.trim()||(A===`directory`?nr(t):``);if(n){z(!0),U(null),G(null);try{let r=await et({name:n,...t?{workspaceRoot:t}:{},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});k(!1),F(``),L(``),y(e=>[r,...e.filter(e=>e.id!==r.id)]),i(`/projects/${encodeURIComponent(r.id)}`)}catch(e){let t=rr(e);t?(G(t),k(!1)):U(e instanceof Error?e.message:String(e))}finally{z(!1)}}},[A,P,i,I]),ae=(0,J.useCallback)(e=>{e.preventDefault(),ie()},[ie]),q=(0,J.useCallback)(()=>{ie({createWorkspaceRoot:!0})},[ie]),oe=(0,J.useCallback)(()=>{G(null),k(!0)},[]),se=e=>{L(e),A===`directory`&&!P.trim()&&F(nr(e))},ce=(e,t)=>(0,Y.jsxs)(`button`,{type:`button`,className:B(`grid w-full grid-cols-[1rem_minmax(0,1fr)_auto] items-center gap-2 rounded-md p-2 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,t&&`bg-accent-soft/55 hover:bg-accent-soft/70`),onClick:()=>{s(!1),t||i(`/projects/${encodeURIComponent(e.id)}`)},children:[(0,Y.jsx)(g,{className:B(`size-4 text-accent-fg`,!t&&`invisible`),"aria-hidden":!0}),(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.name}),(0,Y.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:K(e)})]}),(0,Y.jsx)(`span`,{className:B(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,Xn(e.status)),children:ne(e)})]},e.id);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(v,{open:o,onOpenChange:s,children:[(0,Y.jsx)(w,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,className:`group flex max-w-full min-w-0 items-center gap-2 rounded-lg px-2 py-1 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":t.projectSwitcher.switchProject,title:t.projectSwitcher.switchProject,children:[(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:e.name}),(0,Y.jsx)(`span`,{className:B(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,Xn(e.status)),children:ne(e)})]}),(0,Y.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:K(e)})]}),(0,Y.jsx)(ge,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":!0})]})}),(0,Y.jsx)(_,{children:(0,Y.jsxs)(S,{side:`bottom`,align:`start`,sideOffset:6,className:`z-[70] w-[min(26rem,calc(100vw-2rem))] overflow-hidden rounded-xl border border-edge bg-surface-panel p-1.5 shadow-popover outline-none`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Y.jsxs)(`label`,{className:`relative block`,children:[(0,Y.jsx)(N,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`input`,{type:`search`,className:`h-9 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:b,onChange:e=>x(e.target.value),placeholder:t.projectSwitcher.searchPlaceholder,"aria-label":t.projectSwitcher.searchPlaceholder})]}),(0,Y.jsxs)(`div`,{className:`mt-1 max-h-[min(54vh,24rem)] overflow-y-auto pr-0.5 [scrollbar-gutter:stable]`,children:[(0,Y.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.current}),ce(e,!0),(0,Y.jsx)(`div`,{className:`px-2 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.recent}),E?(0,Y.jsx)(`div`,{className:`p-2 text-xs text-red-600 dark:text-red-400`,children:E}):null,C&&te.length===0?(0,Y.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.loading}):null,!C&&te.length===0?(0,Y.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.noMatches}):null,te.map(e=>ce(e,!1))]}),(0,Y.jsxs)(`div`,{className:`mt-1 border-t border-edge-subtle pt-1`,children:[(0,Y.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>re(`new`),children:[(0,Y.jsx)(M,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.newProject})]}),(0,Y.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>re(`directory`),children:[(0,Y.jsx)(_t,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.openDirectory})]}),(0,Y.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>{s(!1),i(`/projects`)},children:[(0,Y.jsx)(me,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.manageProjects})]})]})]})})]}),(0,Y.jsx)(h,{open:O,onOpenChange:e=>!R&&k(e),children:(0,Y.jsxs)(f,{children:[(0,Y.jsx)(c,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(p,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(32rem,calc(100vh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(m,{className:`text-base font-semibold text-fg`,children:A===`directory`?t.projectSwitcher.createFromDirectoryTitle:n.createTitle}),(0,Y.jsx)(u,{className:`mt-1 text-sm text-fg-muted`,children:A===`directory`?t.projectSwitcher.createFromDirectoryDescription:n.createDescription})]}),(0,Y.jsxs)(`form`,{onSubmit:ae,className:`flex min-h-0 flex-1 flex-col`,children:[(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[H?(0,Y.jsx)(`div`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:H}):null,(0,Y.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.projectName}),(0,Y.jsx)(`input`,{className:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:P,onChange:e=>F(e.target.value),placeholder:`xopc`})]}),(0,Y.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.workspaceRoot}),(0,Y.jsx)(Zt,{value:I,onChange:se,disabled:R,wd:r,placeholder:n.workspacePlaceholder,inputClassName:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`}),(0,Y.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.workspaceHint})]})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(d,{asChild:!0,children:(0,Y.jsx)(V,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:R,children:n.cancel})}),(0,Y.jsxs)(V,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:R||!(P.trim()||A===`directory`&&nr(I)),children:[(0,Y.jsx)(M,{className:`size-4`,"aria-hidden":!0}),n.create]})]})]})]})]})}),(0,Y.jsx)(h,{open:!!W,onOpenChange:e=>{e||G(null)},children:(0,Y.jsxs)(f,{children:[(0,Y.jsx)(c,{className:`fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(p,{className:`fixed left-1/2 top-1/2 z-[110] flex w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(m,{className:`text-base font-semibold text-fg`,children:n.workspaceMissingTitle}),(0,Y.jsx)(u,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:W?Jn(n.workspaceMissingDescription,{workspace:W}):null})]}),W?(0,Y.jsx)(`div`,{className:`px-5 py-4`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,Y.jsx)(_t,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:W})]})}):null,(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(V,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:oe,disabled:R,children:n.workspaceMissingBack}),(0,Y.jsxs)(V,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:q,disabled:R,children:[(0,Y.jsx)(tt,{className:`size-4`,"aria-hidden":!0}),n.workspaceMissingCreate]})]})]})]})})]})}function pr(){let{projectId:e=``,tabId:t,noteId:n}=i(),r=a(),[l]=o(),g=R(e=>e.language),_=I(g),v=_.chat.workingDirectory,b=_.projectDetailPage,S=_.projectsPage,C=dt(e=>e.setPageHeader),w=dt(e=>e.clearPageHeader),[T,D]=(0,J.useState)(null),[O,L]=(0,J.useState)(null),[z,H]=(0,J.useState)([]),[W,ne]=(0,J.useState)(``),[K,ae]=(0,J.useState)([]),[ce,ue]=(0,J.useState)(0),[de,fe]=(0,J.useState)(!1),[ge,ve]=(0,J.useState)(!1),[ye,Ce]=(0,J.useState)(!1),[we,De]=(0,J.useState)([]),[Oe,Ae]=(0,J.useState)(null),Le=(0,J.useRef)(new Set),[Re,$e]=(0,J.useState)(null),[et,rt]=(0,J.useState)(null),[st,ft]=(0,J.useState)(Gn),[vt,Tt]=(0,J.useState)(!1),[Ot,At]=(0,J.useState)(!1),[Mt,Lt]=(0,J.useState)(``),[Rt,zt]=(0,J.useState)([]),[Bt,Vt]=(0,J.useState)(!1),[Ht,Ut]=(0,J.useState)(null),[Gt,Kt]=(0,J.useState)(!1),[qt,Jt]=(0,J.useState)(null),[Yt,Xt]=(0,J.useState)([]),[Qt,$t]=(0,J.useState)(``),[en,tn]=(0,J.useState)(!0),[nn,rn]=(0,J.useState)(!1),[an,sn]=(0,J.useState)(!1),[cn,ln]=(0,J.useState)(null),[un,dn]=(0,J.useState)(!1),[fn,pn]=(0,J.useState)(`fixed`),[mn,hn]=(0,J.useState)(``),[gn,_n]=(0,J.useState)(null),[vn,yn]=(0,J.useState)(!1),[bn,xn]=(0,J.useState)(!1),[Sn,Cn]=(0,J.useState)(null),wn=(0,J.useRef)(null),Tn=(0,J.useRef)(!1),[En,X]=(0,J.useState)(null),[Dn,On]=(0,J.useState)({title:``,reason:``}),[Z,kn]=(0,J.useState)({name:``,description:``,status:`active`,defaultAgentId:``,executionMode:`local_checkout`,workspaceRoot:``,brief:``,instructions:``}),An=(0,J.useRef)(Z),jn=`overview`,Q=n?`notes`:qn(t)?t:jn,Mn=(0,J.useMemo)(()=>k(l.get(`returnTo`),`/projects`,[`/chat`]),[l]),Nn=(0,J.useCallback)(t=>{if(!e)return`/projects`;let n=`/projects/${encodeURIComponent(e)}/${t}`;return Mn===`/projects`?n:A(n,Mn)},[Mn,e]),Pn=(0,J.useCallback)(t=>{e&&r(Nn(t))},[r,e,Nn]),Fn=(0,J.useCallback)(()=>{if(Q===`tasks`&&wn.current){wn.current.openCreate();return}Tn.current=!0,Pn(`tasks`)},[Pn,Q]);(0,J.useEffect)(()=>{Q!==`tasks`||!Tn.current||(Tn.current=!1,wn.current?.openCreate())},[Q]);let In=(0,J.useCallback)(t=>{e&&r(Nn(t),{replace:!0})},[r,e,Nn]),Ln=(0,J.useCallback)(e=>t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||In(e)},[In]),zn=(0,J.useCallback)(e=>e.startsWith(`/chat/`)?`sessions`:e.startsWith(`/notes`)?`notes`:Q,[Q]);(0,J.useEffect)(()=>{!e||!t||qn(t)||r(Nn(jn),{replace:!0})},[jn,r,e,Nn,t]),(0,J.useEffect)(()=>{if(!e)return;let t=!1;return tn(!0),X(null),Promise.all([kt(e),ke(e),wt(e),ht().catch(()=>null),ie(e).catch(()=>null)]).then(([e,n,r,i,a])=>{if(t)return;D(e),L(n),H(r),Ae(a),Xt(i?.agents??[]),$t(e.defaultAgentId??``);let o={name:e.name,description:e.description??``,status:e.status,defaultAgentId:e.defaultAgentId??``,executionMode:e.executionMode,workspaceRoot:e.workspaceRoot??``,brief:e.brief??``,instructions:e.instructions??``};An.current=o,kn(o)}).catch(e=>{t||(Ae(null),X(e instanceof Error?e.message:String(e)))}).finally(()=>{t||tn(!1)}),()=>{t=!0}},[e]);let $=(0,J.useCallback)(async()=>{e&&L(await ke(e))},[e]);(0,J.useEffect)(()=>{let t,n=n=>{let r=St.safeParse(n.detail);!r.success||r.data.projectId!==e||(window.clearTimeout(t),t=window.setTimeout(()=>void $(),120))},r=n=>{let r=Je.safeParse(n.detail);!r.success||r.data.projectId!==e||(window.clearTimeout(t),t=window.setTimeout(()=>void $(),120))};return window.addEventListener(`task-changed-v2`,n),window.addEventListener(`task-deleted-v1`,r),()=>{window.clearTimeout(t),window.removeEventListener(`task-changed-v2`,n),window.removeEventListener(`task-deleted-v1`,r)}},[e,$]);let Bn=(0,J.useCallback)(async(e,t)=>{Cn(e.id),X(null);try{let n=await ze(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 Ie(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 le(e.id,r,n.task.version),await $(),!0}catch(e){return await $().catch(()=>void 0),X(e instanceof Error?e.message:b.board.actionFailed),!1}finally{Cn(null)}},[O,b.board.actionFailed,$]),Vn=(0,J.useCallback)(async t=>{e&&(X(null),await he({idempotencyKey:t.requestId,title:t.objective,projectId:e,priority:t.priority,dueAt:t.dueAt,locale:g,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 $())},[g,e,$]),Hn=(0,J.useCallback)(async(e,t)=>{Cn(e),X(null);try{return await He(e,t,(await ze(e)).task.version),await $(),!0}catch(e){return await $().catch(()=>void 0),X(e instanceof Error?e.message:b.board.actionFailed),!1}finally{Cn(null)}},[b.board.actionFailed,$]),er=(0,J.useCallback)(async(e,t,n)=>{Cn(e),X(null);try{let r=await ze(e);return r.task.phase!==t&&(r=await le(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 He(e,n,r.task.version),await $(),!0}catch(e){return await $().catch(()=>void 0),X(e instanceof Error?e.message:b.board.actionFailed),!1}finally{Cn(null)}},[b.board.actionFailed,$]),tr=(0,J.useCallback)(async(e,t)=>{Cn(e),X(null);try{await pt(e,t,(await ze(e)).task.version),await $()}catch(e){await $().catch(()=>void 0),X(e instanceof Error?e.message:b.board.actionFailed)}finally{Cn(null)}},[b.board.actionFailed,$]),nr=(0,J.useCallback)(async t=>{if(e){X(null);try{await _e(e,t),await $()}catch(e){throw X(e instanceof Error?e.message:b.board.actionFailed),e}}},[b.board.actionFailed,e,$]),cr=(0,J.useCallback)(async()=>{if(T){fe(!0),X(null);try{let e=await Ue(T.id,{includeRelated:ge,limit:100});ae(e.items),ue(e.total)}catch(e){X(e instanceof Error?e.message:String(e))}finally{fe(!1)}}},[T,ge]);(0,J.useEffect)(()=>{Q===`progress`&&cr()},[cr,Q]);let pr=(0,J.useCallback)(async()=>{if(!T?.effectiveWorkspaceRoot?.trim()){De([]),Le.current.clear(),Jt(null);return}Kt(!0),Jt(null),Le.current.clear();try{De(ur((await Dt(T.id,``)).entries)),Le.current.add(``)}catch(e){De([]),Le.current.clear(),Jt(e instanceof Error?e.message:String(e))}finally{Kt(!1)}},[T]),mr=(0,J.useCallback)(async e=>{if(!(!T?.effectiveWorkspaceRoot?.trim()||Le.current.has(e))){Le.current.add(e),Jt(null);try{let t=await Dt(T.id,e);De(n=>dr(n,e,ur(t.entries)))}catch(t){Le.current.delete(e),Jt(t instanceof Error?t.message:String(t))}}},[T]);(0,J.useEffect)(()=>{Q===`files`&&pr()},[pr,Q]);let hr=Mt.trim();(0,J.useEffect)(()=>{if(Q!==`files`||!T||!Ot||!hr){zt([]),Vt(!1),Ut(null);return}let e=!1;Vt(!0),Ut(null),zt([]);let t=window.setTimeout(()=>{at(T.id,hr,50).then(t=>{e||zt(t)}).catch(t=>{e||Ut(t instanceof Error?t.message:String(t))}).finally(()=>{e||Vt(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[hr,T,Ot,Q]);let gr=(0,J.useCallback)(async()=>{if(!T)return;let[e,t]=await Promise.all([kt(T.id),ke(T.id)]);L(t),D(e)},[T]),_r=(0,J.useCallback)(async e=>{if(e.preventDefault(),!(!T||!Dn.title.trim())){xn(!0),X(null);try{await Qe(T.id,{title:Dn.title.trim(),reason:Dn.reason.trim()||void 0}),On({title:``,reason:``}),await gr()}catch(e){X(e instanceof Error?e.message:String(e))}finally{xn(!1)}}},[Dn.reason,Dn.title,T,gr]),vr=(0,J.useMemo)(()=>(0,Y.jsx)(s,{to:Mn,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":Mn===`/projects`?b.backToProjects:_.sidebar.back,children:(0,Y.jsx)(Xe,{className:`size-4`,"aria-hidden":!0})}),[Mn,_.sidebar.back,b.backToProjects]),yr=(0,J.useMemo)(()=>T?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(V,{asChild:!0,variant:`secondary`,className:`h-9 rounded-lg`,children:(0,Y.jsxs)(s,{to:`/workflows?tab=library&projectId=${encodeURIComponent(T.id)}`,children:[(0,Y.jsx)(bt,{className:`size-4`,"aria-hidden":!0}),b.common.runWorkflow]})}),(0,Y.jsxs)(V,{variant:`secondary`,className:`h-9 rounded-lg`,onClick:Fn,children:[(0,Y.jsx)(M,{className:`size-4`,"aria-hidden":!0}),b.board.create]}),(0,Y.jsx)(V,{asChild:!0,variant:`primary`,className:`h-9 rounded-lg`,children:(0,Y.jsxs)(s,{to:Me(T.id),state:{forceNewChat:!0,agentId:T.defaultAgentId},onClick:Ln(`sessions`),children:[(0,Y.jsx)(j,{className:`size-4`,"aria-hidden":!0}),b.common.newChat]})})]}):null,[Fn,Ln,b.board.create,b.common.newChat,b.common.runWorkflow,T]);(0,J.useLayoutEffect)(()=>(C({startExtra:vr,main:T?(0,Y.jsx)(fr,{currentProject:T,pm:b,projectsText:S,wd:v}):(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:b.fallbackTitle}),(0,Y.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:b.fallbackContext})]}),end:yr}),()=>w()),[w,yr,vr,b,T,S,C,v]);function br(e){D(t=>t?{...t,...e}:null),$t(e.defaultAgentId??``),ie(e.id).then(Ae).catch(()=>Ae(null)),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}async function xr(e=An.current){if(!(!T||!Un(e,T))){X(null),ln(null);try{let t=await nt(T.id,{name:e.name.trim(),status:e.status,description:e.description,defaultAgentId:e.defaultAgentId,executionMode:e.executionMode,brief:e.brief,instructions:e.instructions});br(t);let n=An.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,executionMode:n.executionMode===e.executionMode?t.executionMode:n.executionMode,brief:n.brief===e.brief?t.brief??``:n.brief,instructions:n.instructions===e.instructions?t.instructions??``:n.instructions};An.current=r,kn(r)}catch(e){let t=rr(e);throw t?ln(t):X(e instanceof Error?e.message:String(e)),e}}}function Sr(e){e.preventDefault(),Ir.flush()}function Cr(e,t=!1){let n={...An.current,...e};An.current=n,kn(n),t&&Ir.saveNow(n)}let wr=(0,J.useCallback)(()=>{if(!T)return;let e=T.workspaceRoot?.trim()??``;pn(e?`fixed`:`follow`),hn(e||T.effectiveWorkspaceRoot||``),dn(!0)},[T]);async function Tr(e={}){if(!T)return;let t=fn===`fixed`?mn.trim():``;if(!(fn===`fixed`&&!t)){rn(!0),X(null),ln(null);try{let n=await nt(T.id,{workspaceRoot:t,...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});br(n),Cr({workspaceRoot:n.workspaceRoot??``}),dn(!1),ln(null)}catch(e){let t=rr(e);t?(ln(t),dn(!1)):X(e instanceof Error?e.message:String(e))}finally{rn(!1)}}}async function Er(){if(!(!T||gn)){_n(`pin`),X(null);try{br(T.pinnedAt?await te(T.id):await oe(T.id))}catch(e){X(e instanceof Error?e.message:String(e))}finally{_n(null)}}}async function Dr(){if(!(!T||gn)){_n(`archive`),X(null);try{let e=T.status===`archived`?await q(T.id):await ct(T.id);br(e),Cr({status:e.status})}catch(e){X(e instanceof Error?e.message:String(e))}finally{_n(null)}}}async function Or(){if(T){yn(!0),X(null);try{await Ct(T.id),sn(!1),r(`/projects`)}catch(e){X(e instanceof Error?e.message:String(e))}finally{yn(!1)}}}async function kr(){if(!(!T||ye)){Ce(!0),X(null);try{await Se(T.id)}catch(e){X(e instanceof Error?e.message:String(e))}finally{Ce(!1)}}}let Ar=(0,J.useCallback)(e=>{$e(e)},[]),jr=(0,J.useCallback)((e,t)=>{t||$e(e)},[]),Mr=(0,J.useCallback)(async(e,t,n)=>{let r=T?.id;if(r)switch(e){case`preview`:t.isDirectory||$e(t.path);break;case`download`:if(t.isDirectory)return;try{let e=pe(t.path);if(Pe(mt(e))!==`text`){let n=await G(t.path,{projectId:r}),i=je(e)??`application/octet-stream`;Be(e,await n.arrayBuffer(),i)}else{let{content:n}=await Ye(t.path,{projectId:r});Te(e,n)}}catch(e){ot(`warning`,e instanceof Error?e.message:String(e),void 0,{duration:4e3})}break;case`copyPath`:try{await F(t.path)&&ot(`success`,_.workspace.pathCopied,void 0,{duration:2500})}catch{ot(`warning`,_.clipboard.copyFailed,void 0,{duration:4e3})}break;case`openDefault`:await xe(()=>window.electronAPI?.shell?.openFileResource?.(t.fileId),_.workspace.openFileFailed);break;case`openWith`:await xe(()=>window.electronAPI?.shell?.chooseAppAndOpenFileResource?.(t.fileId),_.workspace.openFileFailed);break;case`openWithApp`:if(!n)return;await xe(()=>window.electronAPI?.shell?.openFileResourceWithApp?.(t.fileId,n),_.workspace.openFileFailed);break;case`revealInFolder`:await xe(()=>window.electronAPI?.shell?.showFileResourceInFolder?.(t.fileId),_.workspace.revealFileFailed);break;case`trash`:rt(t);break;default:break}},[_.clipboard.copyFailed,_.workspace.openFileFailed,_.workspace.pathCopied,_.workspace.revealFileFailed,T?.id]),Nr=(0,J.useCallback)(async()=>{let e=et;if(!e)return;let t=await window.electronAPI?.shell?.trashFileResource?.(e.fileId);if(!t?.ok){ot(`warning`,t?.error??_.workspace.trashFailed,void 0,{duration:4e3});return}Re===e.path&&$e(null),rt(null),await pr(),ot(`success`,_.workspace.trashSuccess,void 0,{duration:2500})},[_.workspace.trashFailed,_.workspace.trashSuccess,et,Re,pr]),Pr=(0,J.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;e.preventDefault();let t=e.currentTarget,n=t.closest(`[data-project-files-grid]`);if(!n)return;t.setPointerCapture(e.pointerId),Tt(!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=Wn(i+(e.clientX-r)),o===0&&(o=window.requestAnimationFrame(l))},d=()=>{o!==0&&(window.cancelAnimationFrame(o),l());try{t.releasePointerCapture(a)}catch{}Tt(!1),ft(c),Kn(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,J.useEffect)(()=>{Q!==`files`&&$e(null)},[e,Q]);let Fr=!!(T&&Un(Z,T)),Ir=Ft({value:T?Z:null,dirty:Fr,onSave:xr,validate:e=>e.name.trim()?null:b.settings.nameRequired});if(en)return(0,Y.jsx)(`main`,{className:`w-full flex-1 p-3 text-sm text-fg-muted sm:px-5 sm:py-4 xl:px-6`,children:b.loading});if(!T)return(0,Y.jsxs)(`main`,{className:`w-full flex-1 p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,Y.jsxs)(s,{to:Mn,className:`inline-flex items-center gap-2 text-sm text-accent-fg hover:underline`,children:[(0,Y.jsx)(Xe,{className:`size-4`,"aria-hidden":!0}),Mn===`/projects`?b.backToProjects:_.sidebar.back]}),(0,Y.jsx)(`p`,{className:`mt-6 rounded-lg bg-surface-panel p-4 shadow-surface text-sm text-fg-muted`,children:En||b.notFound})]});let Lr=z.slice(0,6),Rr=O?.blockers??[],zr=O?.tasks.filter(e=>e.phase!==`closed`)??[],Br=e=>b.statuses[e]??e,Vr=e=>Jn(b.common.messages,{count:e}),Hr=W.trim().toLowerCase(),Ur=Hr?z.filter(e=>{let t=Yn(e.updatedAt),n=e.routing?.agentId||e.agentId||b.common.agent,r=e.name?.trim()||b.sessions.fallbackTitle,i=Vr(e.messageCount??0),a=sr(e);return[r,e.key,n,a,t,i].filter(Boolean).join(` `).toLowerCase().includes(Hr)}):z,Wr=z.length>0&&Ur.length===0,Gr=Yt.find(e=>e.id===T.defaultAgentId)?.name||T.defaultAgentId||b.settings.globalDefaultAgent,Kr=Yt.find(e=>e.id===Z.defaultAgentId),qr=T.workspaceRoot?.trim()||``,Jr=T.status===`archived`,Yr=!!T.pinnedAt,Xr=!qr,Zr=qr||Kr?.workspace||T.effectiveWorkspaceRoot||b.common.defaultWorkspace,Qr=fn===`fixed`?mn.trim()||b.settings.workspacePlaceholder:Kr?.workspace||T.effectiveWorkspaceRoot||b.common.defaultWorkspace,$r=(fn===`fixed`?mn.trim():``)!==qr&&(fn===`follow`||!!mn.trim()),ei=[{id:`overview`,icon:jt,label:b.tabs.overview},{id:`tasks`,icon:Ve,label:b.tabs.tasks},{id:`automations`,icon:Ze,label:b.tabs.automations},{id:`files`,icon:_t,label:b.tabs.files},{id:`notes`,icon:Ge,label:b.tabs.notes},{id:`skills`,icon:re,label:b.tabs.skills},{id:`sessions`,icon:j,label:b.tabs.sessions},{id:`progress`,icon:Fe,label:b.tabs.progress}];async function ti(){if(!Zr)return;let e=await F(Zr);ot(e?`success`:`warning`,e?_.workspace.pathCopied:_.clipboard.copyFailed,void 0,{duration:e?2500:4e3})}function ni(){ln(null),dn(!0)}return(0,Y.jsxs)(`main`,{className:`flex h-full min-h-0 w-full flex-1 flex-col overflow-hidden p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3`,children:[(0,Y.jsx)(It,{items:ei,activeTab:Q,onChange:Pn,ariaLabel:b.navAria,tabIdPrefix:`project-primary-tab`,className:`min-w-0 flex-1`}),(0,Y.jsxs)(V,{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:()=>Pn(`settings`),children:[(0,Y.jsx)(me,{className:`size-4`,"aria-hidden":!0}),b.tabs.settings,Fr?(0,Y.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500`,"aria-label":b.settings.unsavedChanges}):null]})]}),En?(0,Y.jsx)(`p`,{className:`mt-3 shrink-0 rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:En}):null,(0,Y.jsxs)(`div`,{className:B(`mt-3 min-h-0 flex-1`,Q===`overview`?`overflow-y-auto pr-1 [scrollbar-gutter:stable] xl:overflow-hidden xl:pr-0`:Q===`tasks`?`overflow-hidden`:`overflow-y-auto pr-1 [scrollbar-gutter:stable]`),children:[Q===`overview`?(0,Y.jsxs)(`section`,{id:`project-panel-overview`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-overview`,className:`grid min-h-full gap-4 xl:h-full xl:min-h-0 xl:grid-cols-[minmax(0,1fr)_20rem] xl:overflow-hidden`,children:[(0,Y.jsxs)(`div`,{className:`grid min-w-0 content-start gap-4 xl:min-h-0 xl:overflow-y-auto xl:pr-1 xl:[scrollbar-gutter:stable]`,children:[(0,Y.jsx)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:b.overview.directionTitle}),(0,Y.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:T.outcome||O?.digest.summary||T.description||T.brief||b.overview.directionFallback}),O?.digest.recommendedAction?(0,Y.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm font-medium leading-6 text-fg`,children:Jn(b.overview.recommendedNext,{action:O.digest.recommendedAction})}):null]}),(0,Y.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:(0,Y.jsxs)(V,{type:`button`,variant:`secondary`,onClick:()=>void kr(),disabled:ye,children:[(0,Y.jsx)(Ee,{className:`size-4`,"aria-hidden":!0}),ye?b.overview.savingDigest:b.overview.saveDigest]})})]})}),(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,Y.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:b.overview.nextActions})}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:zr.length?zr.map(e=>(0,Y.jsxs)(s,{to:Ke(Nn(`overview`),e.id),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,Y.jsxs)(`span`,{className:`shrink-0 rounded-full bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:[e.phase,` · `,e.operationalState]})]}),e.attention[0]?(0,Y.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.attention[0].summary}):null]},e.id)):(0,Y.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:b.overview.noNextActions})})]}),O?.recentResults.length?(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,Y.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:b.overview.recentResults})}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:O.recentResults.slice(0,5).map(({taskId:e,taskTitle:t,receipt:n})=>(0,Y.jsxs)(s,{to:Ke(Nn(`overview`),e),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),(0,Y.jsxs)(`span`,{className:`shrink-0 rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:[n.status,` · `,n.verification.status]})]}),(0,Y.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:n.summary})]},n.runId))})]}):null,(0,Y.jsxs)(`div`,{className:`grid min-w-0 gap-4 md:grid-cols-2`,children:[(0,Y.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Y.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:b.overview.milestones})}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:T.milestones.length?T.milestones.map(e=>(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-4 py-3`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,Y.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:e.status})]},e.id)):(0,Y.jsx)(`p`,{className:`px-4 py-5 text-sm text-fg-muted`,children:b.overview.noMilestones})})]}),(0,Y.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Y.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:b.overview.projectUpdates})}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:T.recentUpdates.length?T.recentUpdates.slice(0,3).map(e=>(0,Y.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,Y.jsx)(`p`,{className:`text-sm leading-5 text-fg`,children:e.summary}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.health})]},e.id)):(0,Y.jsx)(`p`,{className:`px-4 py-5 text-sm text-fg-muted`,children:b.overview.noProjectUpdates})})]})]})]}),(0,Y.jsxs)(`aside`,{className:`grid min-w-0 content-start gap-4 xl:min-h-0 xl:overflow-y-auto xl:pr-1 xl:[scrollbar-gutter:stable]`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:b.overview.attention}),Rr.length?(0,Y.jsx)(`div`,{className:`mt-3 grid gap-3`,children:Rr.map(e=>{let t=(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(be,{className:`size-4 text-amber-600 dark:text-amber-300`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title})]}),(0,Y.jsxs)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:[b.overview.attentionKinds[e.kind]??e.kind,e.detail?` · ${e.detail}`:e.status?` · ${Br(e.status)}`:``]})]});return e.href?(0,Y.jsx)(s,{to:e.href,onClick:Ln(zn(e.href)),className:`min-w-0 rounded-md bg-surface-base p-3 hover:bg-surface-hover`,children:t},e.id):(0,Y.jsx)(`div`,{className:`min-w-0 rounded-md bg-surface-base p-3`,children:t},e.id)})}):(0,Y.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:b.overview.noBlockedTasks}),(0,Y.jsxs)(`form`,{onSubmit:_r,className:`mt-4 flex gap-2 border-t border-edge pt-4`,children:[(0,Y.jsx)(`input`,{className:`min-h-9 min-w-0 flex-1 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:Dn.title,onChange:e=>On(t=>({...t,title:e.target.value})),placeholder:b.overview.blockerTitlePlaceholder}),(0,Y.jsx)(V,{type:`submit`,variant:`secondary`,className:`shrink-0 rounded-lg px-3`,disabled:bn||!Dn.title.trim(),"aria-label":bn?b.overview.addingBlocker:b.overview.addBlocker,title:bn?b.overview.addingBlocker:b.overview.addBlocker,children:(0,Y.jsx)(M,{className:`size-4`,"aria-hidden":!0})})]})]}),(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(We,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:b.overview.recentSessions})]}),(0,Y.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>Pn(`sessions`),children:b.common.viewAll})]}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:Lr.length?Lr.map(e=>(0,Y.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Ln(`sessions`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.name||e.key}),(0,Y.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:Yn(e.updatedAt)})]}),(0,Y.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:e.agentId||b.common.agent})]},e.key)):(0,Y.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:b.overview.noSessions})})]})]})]}):null,Q===`tasks`?(0,Y.jsx)(Rn,{ref:wn,tasks:O?.tasks??[],dependencyEdges:O?.dependencyEdges??[],monitoring:O?.monitoring??{projectId:e??``,mode:`observe`,allowedActions:[],confidenceThreshold:.75,scenarios:[],configured:!1},returnTo:Nn(`tasks`),copy:b.board,onAction:Bn,onReorder:Hn,onUndoMove:er,onDependenciesChange:tr,onMonitoringChange:nr,onCreate:Vn,actionBusyId:Sn}):null,Q===`automations`?(0,Y.jsx)(`section`,{id:`project-panel-automations`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-automations`,className:`grid min-h-full content-start gap-4`,children:(0,Y.jsx)(Wt,{projectId:T.id,embedded:!0,title:b.automations.title,subtitle:b.automations.hint})}):null,Q===`notes`?(0,Y.jsx)(`section`,{id:`project-panel-notes`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-notes`,className:`flex h-full min-h-[28rem] overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:(0,Y.jsx)(Nt,{selectedNoteId:n,basePath:`/projects/${encodeURIComponent(T.id)}/notes`,showLibrary:!1,allowMediaCapture:!1,projectId:T.id,listTitle:b.notes.title,listDescription:b.notes.hint,emptyText:b.notes.emptyTitle,emptyDescription:b.notes.emptyDescription,listWidthStorageKey:`xopc.projectNotes.listWidth.${T.id}`})}):null,Q===`skills`?(0,Y.jsx)(on,{projectId:T.id,copy:b.skills}):null,Q===`files`?(0,Y.jsx)(`section`,{id:`project-panel-files`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-files`,className:`flex h-full min-h-[28rem] flex-col`,children:(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:T.effectiveWorkspaceRoot?(0,Y.jsxs)(`div`,{"data-project-files-grid":!0,className:B(`grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[var(--project-files-panel-width)_6px_minmax(0,1fr)]`,vt&&`cursor-col-resize select-none`),style:{"--project-files-panel-width":`${st}px`},children:[(0,Y.jsxs)(`aside`,{className:`flex min-h-0 flex-col border-b border-edge lg:border-b-0 lg:border-r`,children:[(0,Y.jsxs)(`div`,{className:`flex h-11 items-center gap-1 border-b border-edge bg-surface-muted/50 px-3 text-sm`,children:[Oe?(0,Y.jsx)(it,{resourceId:Oe.fileId,displayName:Oe.name}):null,(0,Y.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,Y.jsx)(`button`,{type:`button`,className:B(`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,Ot&&`bg-surface-hover text-fg`),onClick:()=>At(!0),"aria-label":b.files.search,title:b.files.search,"aria-pressed":Ot,children:(0,Y.jsx)(N,{className:`size-3.5`,"aria-hidden":!0})}),(0,Y.jsx)(lt,{className:`size-7 shrink-0 rounded-md p-0`,loading:Gt,label:_.cron.refresh,onClick:()=>void pr()})]})]}),Ot?(0,Y.jsx)(`div`,{className:`shrink-0 border-b border-edge bg-surface-muted/40 px-3 py-2`,children:(0,Y.jsxs)(`div`,{className:`flex h-8 items-center gap-2 rounded-md border border-edge bg-surface-panel px-2 focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/20`,children:[(0,Y.jsx)(N,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`input`,{type:`text`,role:`searchbox`,value:Mt,onChange:e=>Lt(e.target.value),placeholder:b.files.searchPlaceholder,"aria-label":b.files.searchPlaceholder,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none placeholder:text-fg-subtle`}),(0,Y.jsx)(`button`,{type:`button`,className:`flex size-6 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":b.files.clearSearch,title:b.files.clearSearch,onClick:()=>{Lt(``),At(!1)},children:(0,Y.jsx)(P,{className:`size-3.5`,"aria-hidden":!0})})]})}):null,qt?(0,Y.jsx)(`div`,{className:`border-b border-edge bg-red-500/10 px-4 py-3 text-sm text-red-700 dark:text-red-300`,children:qt}):null,hr?(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-2`,children:Bt?(0,Y.jsxs)(`div`,{className:`space-y-2 px-3 py-1`,children:[(0,Y.jsx)(U,{className:`h-11 w-full`}),(0,Y.jsx)(U,{className:`h-11 w-full`}),(0,Y.jsx)(U,{className:`h-11 w-full`})]}):Ht?(0,Y.jsxs)(`p`,{className:`px-3 py-2 text-xs text-red-600 dark:text-red-400`,children:[_.workspace.loadError,`: `,Ht]}):Rt.length===0?(0,Y.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:b.files.noSearchResults}):Rt.map(e=>(0,Y.jsxs)(`button`,{type:`button`,className:B(`flex w-full min-w-0 items-center gap-2 px-3 py-2 text-left hover:bg-surface-hover`,Re===e.path&&`bg-accent-soft text-accent-fg`),onClick:()=>$e(e.path),title:e.path,children:[(0,Y.jsx)(Ge,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`span`,{className:`block truncate text-sm text-fg`,children:e.name}),(0,Y.jsx)(`span`,{className:`block truncate text-xs text-fg-subtle`,children:e.path})]})]},e.path))}):Gt&&we.length===0?(0,Y.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:b.files.loading}):(0,Y.jsx)(yt,{tree:we,selectedPath:Re,onSelectFile:Ar,onSelectEntry:jr,onExpandDir:e=>void mr(e),onAction:Mr,actionLabels:{preview:_.workspace.preview,download:_.workspace.download,copyPath:_.workspace.copyPath,openDefault:_.workspace.openSystemApp,openDirectory:_.workspace.openInFileManager,openWith:_.workspace.openWith,revealInFolder:_.workspace.revealInFolder,trash:_.workspace.moveToTrash,recommendedApps:_.workspace.recommendedApps,desktopUpdateRequired:_.workspace.desktopUpdateRequired},emptyHint:b.files.emptyDirectory})]}),(0,Y.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":b.files.resizeHandle,className:B(`hidden cursor-col-resize touch-none items-stretch justify-center bg-surface-panel transition-colors hover:bg-surface-hover lg:flex`,vt&&`bg-surface-hover`),onPointerDown:Pr,children:(0,Y.jsx)(`div`,{className:`my-3 w-px rounded-full bg-edge-strong/70`})}),(0,Y.jsx)(`div`,{className:`min-h-0 min-w-0 overflow-hidden bg-surface-base`,children:Re?(0,Y.jsx)(Et,{filePath:Re,projectId:T.id,agentId:T.defaultAgentId||Qt||void 0,onClose:()=>$e(null)}):(0,Y.jsx)(`div`,{className:`flex h-full min-h-[18rem] items-center justify-center px-6 text-center`,children:(0,Y.jsxs)(`div`,{className:`max-w-sm`,children:[(0,Y.jsx)(_t,{className:`mx-auto size-8 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:b.files.previewEmptyTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:b.files.previewEmptyDescription})]})})})]}):(0,Y.jsxs)(`div`,{className:`grid gap-3 px-4 py-8 text-sm text-fg-muted`,children:[(0,Y.jsx)(`p`,{children:b.files.needWorkspace}),(0,Y.jsx)(`div`,{children:(0,Y.jsx)(V,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>Pn(`settings`),children:b.files.openSettings})})]})})}):null,Q===`sessions`?(0,Y.jsxs)(`section`,{id:`project-panel-sessions`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-sessions`,className:`grid min-h-full content-start gap-3`,children:[z.length?(0,Y.jsxs)(`label`,{className:`relative flex min-h-9 w-full max-w-lg cursor-text items-center rounded-lg bg-surface-panel py-1.5 pl-9 pr-9 shadow-surface`,children:[(0,Y.jsx)(N,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,"aria-hidden":!0}),(0,Y.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:W,onChange:e=>ne(e.currentTarget.value),placeholder:b.sessions.searchPlaceholder,"aria-label":b.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`}),W?(0,Y.jsx)(`button`,{type:`button`,className:`absolute right-2 top-1/2 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":b.sessions.clearSearch,onClick:()=>ne(``),children:(0,Y.jsx)(P,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,Ur.length?(0,Y.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:Ur.map(e=>{let t=Yn(e.updatedAt),n=e.routing?.agentId||e.agentId||b.common.agent,r=sr(e),i=e.name?.trim()||b.sessions.fallbackTitle,a=Vr(e.messageCount??0);return(0,Y.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Ln(`sessions`),className:`group flex min-h-[8.75rem] min-w-0 flex-col rounded-lg bg-surface-panel p-4 shadow-surface transition-colors hover:bg-surface-hover/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Y.jsx)(`span`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-base text-fg-muted`,children:(0,Y.jsx)(j,{className:`size-4`,"aria-hidden":!0})}),(0,Y.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-fg`,children:i}),r?(0,Y.jsx)(`span`,{className:`shrink-0 rounded-md bg-surface-base px-2 py-0.5 text-[11px] font-medium leading-5 text-fg-muted`,children:r}):null]})})]}),(0,Y.jsxs)(`div`,{className:`mt-auto grid gap-2 pt-4 text-xs text-fg-muted`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(`span`,{className:`min-w-0 max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[b.sessions.agent,`: `,n]}),(0,Y.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:a})]}),t?(0,Y.jsxs)(`span`,{className:`truncate rounded-md bg-surface-base px-2 py-1`,children:[b.sessions.updated,`: `,t]}):null]})]},e.key)})}):Wr?(0,Y.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:b.sessions.noMatches})}):(0,Y.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:b.sessions.emptyTitle}),(0,Y.jsx)(`p`,{className:`mx-auto mt-1 max-w-md text-sm leading-6 text-fg-muted`,children:b.sessions.emptyDescription})]})})]}):null,Q===`progress`?(0,Y.jsxs)(`section`,{id:`project-panel-progress`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-progress`,className:`grid min-h-full content-start gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:b.progress.title}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:Jn(b.progress.count,{count:ce})})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(`label`,{className:`inline-flex min-h-9 items-center gap-2 rounded-lg bg-surface-panel px-3 text-sm text-fg-muted shadow-surface`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:ge,onChange:e=>ve(e.currentTarget.checked),className:`size-4 rounded border-edge text-accent focus:ring-accent/30`}),b.progress.includeRelated]}),(0,Y.jsxs)(V,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3`,onClick:()=>void cr(),disabled:de,children:[(0,Y.jsx)(ee,{className:B(`size-4`,de&&`animate-spin`),"aria-hidden":!0}),b.common.refresh]})]})]}),(0,Y.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:de&&K.length===0?(0,Y.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:b.progress.loading}):K.length?(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:K.map(e=>{let t=b.progress.types[e.type]??e.type,n=b.progress.objectKinds[e.primaryObject.kind]??e.primaryObject.kind,r=lr(e),i=e.relatedProjects.length>0&&!e.scopes.some(e=>e.scopeKind===`project`&&e.scopeId===T.id);return(0,Y.jsxs)(`article`,{className:`grid gap-2 px-4 py-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),i?(0,Y.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:b.progress.related}):null]}),(0,Y.jsxs)(`p`,{className:`mt-1 min-w-0 truncate text-sm text-fg-muted`,children:[n,`: `,ar(e)]})]}),(0,Y.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,dateTime:new Date(e.createdAt).toISOString(),children:Yn(e.createdAt)})]}),r?(0,Y.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:r}):null,(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,Y.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:[b.progress.actor,`: `,ir(e)]}),(0,Y.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[b.progress.source,`: `,or(e)]})]})]},e.id)})}):(0,Y.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:b.progress.empty})})]}):null,Q===`settings`?(0,Y.jsxs)(`form`,{id:`project-panel-settings`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-settings`,onSubmit:Sr,onBlurCapture:Ir.onBlurCapture,className:`grid min-h-full content-start gap-4 pb-1`,children:[(0,Y.jsxs)(`section`,{className:`flex min-w-0 items-start justify-between gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:b.settings.summaryTitle}),(0,Y.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:b.settings.summaryHint})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-2`,children:[(0,Y.jsx)(`span`,{className:B(`rounded-full px-2 py-0.5 text-xs font-medium`,Xn(Z.status)),children:b.settings.statuses[Z.status]}),(0,Y.jsx)(Pt,{status:Ir.status,error:Ir.error})]})]}),(0,Y.jsxs)(`div`,{className:`grid items-start gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-4`,children:[(0,Y.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:b.settings.detailsTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:b.settings.detailsHint})]}),(0,Y.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,Y.jsx)(Zn,{label:b.settings.name,children:(0,Y.jsx)(`input`,{className:Qn(),value:Z.name,onChange:e=>Cr({name:e.target.value})})}),(0,Y.jsx)(Zn,{label:b.settings.defaultAgent,children:(0,Y.jsxs)(y,{className:Qn(),value:Z.defaultAgentId,onChange:e=>Cr({defaultAgentId:e.target.value},!0),children:[(0,Y.jsx)(x,{value:``,children:b.settings.globalDefaultAgent}),Yt.map(e=>(0,Y.jsx)(x,{value:e.id,children:Ne(e,_.agentsSettings)},e.id))]})}),(0,Y.jsx)(Zn,{label:b.settings.status,children:Jr?(0,Y.jsx)(`div`,{className:`grid min-h-10 content-center rounded-md border border-edge bg-surface-muted px-3 text-sm text-fg-muted`,children:b.settings.statuses.archived}):(0,Y.jsxs)(y,{className:Qn(),value:Z.status===`archived`?`active`:Z.status,onChange:e=>Cr({status:e.target.value},!0),children:[(0,Y.jsx)(x,{value:`active`,children:b.settings.statuses.active}),(0,Y.jsx)(x,{value:`paused`,children:b.settings.statuses.paused})]})}),(0,Y.jsx)(Zn,{label:b.settings.executionMode,hint:b.settings.executionModeHint,children:(0,Y.jsxs)(y,{className:Qn(),value:Z.executionMode,onChange:e=>Cr({executionMode:e.target.value},!0),children:[(0,Y.jsx)(x,{value:`managed_worktree`,children:b.settings.executionModeWorktree}),(0,Y.jsx)(x,{value:`local_checkout`,children:b.settings.executionModeLocal})]})}),(0,Y.jsx)(Zn,{label:b.settings.description,hint:b.settings.descriptionHint,children:(0,Y.jsx)(`textarea`,{className:Qn(!0),value:Z.description,onChange:e=>Cr({description:e.target.value})})})]})]}),(0,Y.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:b.settings.projectGuidanceTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:b.settings.projectGuidanceHint})]}),(0,Y.jsx)(Zn,{label:b.settings.brief,hint:b.settings.briefHint,children:(0,Y.jsx)(`textarea`,{className:Qn(!0),value:Z.brief,onChange:e=>Cr({brief:e.target.value})})}),(0,Y.jsx)(Zn,{label:b.settings.instructions,hint:b.settings.instructionsHint,children:(0,Y.jsx)(`textarea`,{className:Qn(!0),value:Z.instructions,onChange:e=>Cr({instructions:e.target.value})})})]})]}),(0,Y.jsxs)(`aside`,{className:`grid gap-4 xl:sticky xl:top-0`,children:[(0,Y.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:b.settings.workspaceRoot}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:b.settings.workspaceIndependentHint})]}),(0,Y.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Y.jsx)(`span`,{className:`w-fit rounded-md bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:Xr?b.settings.workspaceModeFollow:b.settings.workspaceModeFixed}),(0,Y.jsx)(`div`,{className:`break-all font-mono text-xs leading-5 text-fg`,title:Zr,children:Zr}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Y.jsxs)(V,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void ti(),children:[(0,Y.jsx)(E,{className:`size-4`,"aria-hidden":!0}),b.settings.copyWorkspacePath]}),Oe?(0,Y.jsx)(it,{resourceId:Oe.fileId,displayName:Oe.name}):null,(0,Y.jsxs)(V,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:wr,children:[(0,Y.jsx)(tt,{className:`size-4`,"aria-hidden":!0}),b.settings.migrateWorkspace]})]})]})]}),(0,Y.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:b.settings.currentProjectTitle}),(0,Y.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Y.jsx)($n,{label:b.settings.defaultAgent,value:Gr}),(0,Y.jsx)($n,{label:b.settings.pinState,value:Yr?b.settings.pinned:b.settings.notPinned}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,Y.jsx)($n,{label:b.settings.createdAt,value:Yn(T.createdAt)||b.common.never}),(0,Y.jsx)($n,{label:b.settings.updatedAt,value:Yn(T.updatedAt)||b.common.never})]})]})]}),(0,Y.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:b.settings.managementTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:b.settings.managementHint})]}),(0,Y.jsxs)(`div`,{className:`grid gap-3`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Yr?b.settings.pinnedTitle:b.settings.pinTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:b.settings.pinHint})]}),(0,Y.jsxs)(V,{type:`button`,variant:`ghost`,className:`w-fit rounded-lg`,disabled:gn===`pin`,onClick:()=>void Er(),children:[Yr?(0,Y.jsx)(xt,{className:`size-4`,"aria-hidden":!0}):(0,Y.jsx)(qe,{className:`size-4`,"aria-hidden":!0}),Yr?b.settings.unpinProject:b.settings.pinProject]})]}),(0,Y.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Jr?b.settings.restoreTitle:b.settings.archiveTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:Jr?b.settings.restoreHint:b.settings.archiveHint})]}),(0,Y.jsxs)(V,{type:`button`,variant:Jr?`primary`:`ghost`,className:`w-fit rounded-lg`,disabled:gn===`archive`,onClick:()=>void Dr(),children:[Jr?(0,Y.jsx)(ee,{className:`size-4`,"aria-hidden":!0}):(0,Y.jsx)(ut,{className:`size-4`,"aria-hidden":!0}),Jr?b.settings.restoreProject:b.settings.archiveProject]})]})]})]}),(0,Y.jsxs)(`section`,{className:`grid gap-3 rounded-lg border border-red-500/20 bg-red-500/5 p-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-red-700 dark:text-red-300`,children:b.settings.dangerTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-red-700/80 dark:text-red-200/80`,children:b.settings.dangerHint})]}),(0,Y.jsxs)(V,{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:()=>sn(!0),children:[(0,Y.jsx)(se,{className:`size-4`,"aria-hidden":!0}),b.settings.deleteConfirmAction]})]})]})]})]}):null]}),(0,Y.jsx)(h,{open:an,onOpenChange:e=>{vn||sn(e)},children:(0,Y.jsxs)(f,{children:[(0,Y.jsx)(c,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(p,{className:`fixed left-1/2 top-1/2 z-[90] w-[min(28rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-5 shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Y.jsx)(`span`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-red-500/10 text-red-600 dark:text-red-400`,children:(0,Y.jsx)(be,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(m,{className:`text-base font-semibold text-fg`,children:b.settings.deleteConfirmTitle}),(0,Y.jsx)(u,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:T?Jn(b.settings.deleteConfirm,{name:T.name}):b.settings.deleteConfirmFallback})]})]}),(0,Y.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,Y.jsx)(d,{asChild:!0,children:(0,Y.jsx)(V,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:vn,children:b.common.cancel})}),(0,Y.jsxs)(V,{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:vn||!T,onClick:()=>void Or(),children:[(0,Y.jsx)(se,{className:`size-4`,"aria-hidden":!0}),b.settings.deleteConfirmAction]})]})]})]})}),(0,Y.jsx)(gt,{open:!!et,title:_.workspace.trashConfirmTitle,description:_.workspace.trashConfirmDescription.replace(`{{name}}`,et?.name??``),confirmLabel:_.workspace.moveToTrash,cancelLabel:_.workspace.cancel,destructive:!0,onConfirm:()=>void Nr(),onCancel:()=>rt(null)}),(0,Y.jsx)(h,{open:un,onOpenChange:e=>{nn||dn(e)},children:(0,Y.jsxs)(f,{children:[(0,Y.jsx)(c,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(p,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(34rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(m,{className:`text-base font-semibold text-fg`,children:b.settings.workspaceMigrationTitle}),(0,Y.jsx)(u,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:b.settings.workspaceMigrationDescription})]}),(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:b.settings.workspaceMode}),(0,Y.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[(0,Y.jsxs)(`label`,{className:B(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,fn===`fixed`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,Y.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:fn===`fixed`,onChange:()=>pn(`fixed`),disabled:nn}),(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`span`,{className:`block font-medium`,children:b.settings.workspaceModeFixed}),(0,Y.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:b.settings.workspaceMigrationFixedHint})]})]}),(0,Y.jsxs)(`label`,{className:B(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,fn===`follow`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,Y.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:fn===`follow`,onChange:()=>pn(`follow`),disabled:nn}),(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`span`,{className:`block font-medium`,children:b.settings.workspaceModeFollow}),(0,Y.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:b.settings.workspaceHint})]})]})]})]}),fn===`fixed`?(0,Y.jsx)(Zt,{value:mn,onChange:hn,disabled:nn,wd:v,placeholder:b.settings.workspacePlaceholder,inputClassName:Qn(),autoFocus:!0}):null,(0,Y.jsx)(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm leading-6 text-amber-800 dark:text-amber-200`,children:b.settings.workspaceMigrationImpact}),(0,Y.jsx)(`div`,{className:`rounded-lg bg-surface-muted px-3 py-2 text-xs leading-5 text-fg-subtle`,children:Jn(b.settings.workspaceCurrent,{workspace:Qr})})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(d,{asChild:!0,children:(0,Y.jsx)(V,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:nn,children:b.common.cancel})}),(0,Y.jsxs)(V,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:nn||!$r,onClick:()=>void Tr(),children:[(0,Y.jsx)(tt,{className:`size-4`,"aria-hidden":!0}),b.settings.workspaceMigrationConfirm]})]})]})]})}),(0,Y.jsx)(h,{open:!!cn,onOpenChange:e=>{e||ln(null)},children:(0,Y.jsxs)(f,{children:[(0,Y.jsx)(c,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(p,{className:`fixed left-1/2 top-1/2 z-[90] flex w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(m,{className:`text-base font-semibold text-fg`,children:b.settings.workspaceMissingTitle}),(0,Y.jsx)(u,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:cn?Jn(b.settings.workspaceMissingDescription,{workspace:cn}):null})]}),cn?(0,Y.jsx)(`div`,{className:`px-5 py-4`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,Y.jsx)(_t,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:cn})]})}):null,(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(V,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:ni,disabled:nn,children:b.settings.workspaceMissingBack}),(0,Y.jsxs)(V,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:()=>void Tr({createWorkspaceRoot:!0}),disabled:nn,children:[(0,Y.jsx)(tt,{className:`size-4`,"aria-hidden":!0}),b.settings.workspaceMissingCreate]})]})]})]})})]})}export{pr 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{a as c,c as l,i as u,n as d,o as f,r as p,s as m,t as h}from"./dist-CpzYSoz7.js";import{t as g}from"./check-DUBLcKHA.js";import{c as _,l as v,n as y,o as b,r as x,s as S,t as C,u as w}from"./popover-select-C-Hj-nXR.js";import{t as T}from"./circle-check-C23XjkUj.js";import{t as E}from"./copy-Dv6d4Dvw.js";import{t as D}from"./download-Dk-ZjtO6.js";import{t as O}from"./external-link-DjqjBmc3.js";import{d as k,p as A}from"./markdown-view-PPCLt7fu.js";import{t as j}from"./message-square-plus-XP0tGdlV.js";import{t as M}from"./plus-Q2yW6OE7.js";import{t as N}from"./search-DA7gz22f.js";import{t as P}from"./x-B_N4OPjy.js";import{t as F}from"./copy-to-clipboard-HOJ79TWv.js";import{t as I}from"./messages-CTSgFlE4.js";import{a as L,n as R,r as z}from"./locale-store-CMZljTJx.js";import{t as B}from"./cn-JdwAhgNB.js";import{t as V}from"./button-CtTvuElV.js";import{n as H}from"./interaction-BmQogeqz.js";import{t as U}from"./skeleton-BwbyijEw.js";import{$l as W,$r as G,$s as ee,Ai as te,B as ne,Bl as K,Bs as re,Ci as ie,Dc as ae,Di as q,Ei as oe,Es as se,Fl as ce,Go as le,Gs as ue,Il as de,Jc as fe,Jr as pe,Js as me,Ko as he,Ll as ge,Mi as _e,Ms as ve,N as ye,Nl as be,Nr as xe,Oi as Se,Pc as Ce,Pi as we,Qr as Te,Qs as Ee,Rc as De,Ri as Oe,Si as ke,Ti as Ae,Vi as je,Wi as Me,Wt as Ne,Xr as Pe,Yc as Fe,Yo as Ie,Ys as Le,Yt as Re,Zo as ze,Zr as Be,_l as Ve,as as He,bi as Ue,bl as We,cl as Ge,cs as Ke,dc as qe,ds as Je,ei as Ye,eu as Xe,fs as Ze,gi as Qe,gr as $e,hi as et,il as tt,ji as nt,jl as rt,jr as it,ki as at,lo as ot,mc as st,mi as ct,ni as lt,nu as ut,oa as dt,ol as ft,os as pt,qr as mt,qt as ht,ri as gt,rl as _t,sl as vt,ti as yt,tl as bt,uc as xt,us as St,vi as Ct,wi as wt,wl as Tt,wt as Et,xi as Dt,xs as Ot,yi as kt,ys as At,zc as jt,zi as Mt}from"./index-DUz0O54y.js";import{t as Nt}from"./notes-workbench-ISWnKLxO.js";import{n as Pt,t as Ft}from"./use-autosave-TwuAycG8.js";import{t as It}from"./page-tabs-BaEQMYm_.js";import{t as Lt}from"./date-picker-CKg-RPbs.js";import{c as Rt,l as zt,n as Bt,o as Vt,r as Ht,t as Ut}from"./style-TIDOdKy0.js";import{t as Wt}from"./automations-workspace-wEO1OWk0.js";import{i as Gt,p as Kt,s as qt}from"./skills-page.utils-CniRGhkJ.js";import{t as Jt}from"./dependency-picker-CVYkw-NN.js";var J=e(t(),1),Yt=n(),Y=r();function Xt(e){let t=(0,Yt.c)(27),{value:n,onPick:r,disabled:i,placeholder:a,title:o,className:s,maxWidthClass:c,compact:l,"aria-label":u}=e,d=c===void 0?`max-w-[min(12rem,40vw)]`:c,f=l===void 0?!1:l,p,m;t[0]!==a||t[1]!==n?(m=n.trim(),p=m?Mt(m):a??``,t[0]=a,t[1]=n,t[2]=p,t[3]=m):(p=t[2],m=t[3]);let h=p,g=o??(m||void 0),_=u??o??h,v=f?`inline-flex size-9 shrink-0 items-center justify-center rounded-lg p-0`:`inline-flex min-h-8 min-w-0 shrink-0 items-center gap-1 rounded-lg px-2 py-1 text-xs`,y=!f&&d,b=i&&`cursor-not-allowed opacity-60`,x;t[4]!==s||t[5]!==v||t[6]!==y||t[7]!==b?(x=B(v,`border border-edge-subtle/80 bg-surface-hover/40 dark:border-edge-subtle`,H.transition,H.focusRingPanel,`cursor-pointer hover:bg-surface-hover/70 dark:hover:bg-surface-hover/50`,y,b,s),t[4]=s,t[5]=v,t[6]=y,t[7]=b,t[8]=x):x=t[8];let S;t[9]!==i||t[10]!==r?(S=e=>{e.stopPropagation(),i||r()},t[9]=i,t[10]=r,t[11]=S):S=t[11];let C=f?`size-4`:`size-3.5`,w;t[12]===C?w=t[13]:(w=B(`shrink-0 text-fg-muted`,C),t[12]=C,t[13]=w);let T;t[14]===w?T=t[15]:(T=(0,Y.jsx)(ft,{className:w,"aria-hidden":!0}),t[14]=w,t[15]=T);let E;t[16]!==f||t[17]!==h?(E=f?null:(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-left font-medium text-fg`,children:h}),t[16]=f,t[17]=h,t[18]=E):E=t[18];let D;return t[19]!==i||t[20]!==S||t[21]!==T||t[22]!==E||t[23]!==g||t[24]!==_||t[25]!==x?(D=(0,Y.jsxs)(`button`,{type:`button`,disabled:i,title:g,"aria-label":_,className:x,onClick:S,children:[T,E]}),t[19]=i,t[20]=S,t[21]=T,t[22]=E,t[23]=g,t[24]=_,t[25]=x,t[26]=D):D=t[26],D}function Zt(e){let t=(0,Yt.c)(38),{value:n,onChange:r,disabled:i,wd:a,placeholder:o,inputClassName:s,autoFocus:c,trailing:l}=e,u;t[0]!==r||t[1]!==n?(u={initialPath:n,onPicked:r},t[0]=r,t[1]=n,t[2]=u):u=t[2];let d=Oe(u),f;t[3]===n?f=t[4]:(f=n.trim(),t[3]=n,t[4]=f);let p=f,m=p?`${p}\n${a.chooseFolder}`:`${o??a.notSet}\n${a.selectWorkingDirectory}`,h;t[5]===s?h=t[6]:(h=B(`min-w-0 flex-1`,s),t[5]=s,t[6]=h);let g=i||d.picking,_;t[7]===r?_=t[8]:(_=e=>void r(e.target.value),t[7]=r,t[8]=_);let v=o??a.pathInputPlaceholder,y;t[9]!==c||t[10]!==h||t[11]!==g||t[12]!==_||t[13]!==v||t[14]!==n?(y=(0,Y.jsx)(`input`,{type:`text`,className:h,value:n,disabled:g,onChange:_,placeholder:v,autoFocus:c,autoComplete:`off`,spellCheck:!1}),t[9]=c,t[10]=h,t[11]=g,t[12]=_,t[13]=v,t[14]=n,t[15]=y):y=t[15];let b=i||d.picking,x;t[16]!==m||t[17]!==d.pick||t[18]!==b||t[19]!==n||t[20]!==a.selectWorkingDirectory?(x=(0,Y.jsx)(Xt,{compact:!0,value:n,onPick:d.pick,disabled:b,title:m,"aria-label":a.selectWorkingDirectory}),t[16]=m,t[17]=d.pick,t[18]=b,t[19]=n,t[20]=a.selectWorkingDirectory,t[21]=x):x=t[21];let S;t[22]!==x||t[23]!==l?(S=(0,Y.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[x,l]}),t[22]=x,t[23]=l,t[24]=S):S=t[24];let C;t[25]!==S||t[26]!==y?(C=(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[y,S]}),t[25]=S,t[26]=y,t[27]=C):C=t[27];let w;t[28]!==d.confirmPick||t[29]!==d.hasNativePicker||t[30]!==d.modalOpen||t[31]!==d.setModalOpen||t[32]!==p||t[33]!==a?(w=d.hasNativePicker?null:(0,Y.jsx)(we,{open:d.modalOpen,onOpenChange:d.setModalOpen,initialAbsolutePath:p||void 0,onConfirm:d.confirmPick,wd:a}),t[28]=d.confirmPick,t[29]=d.hasNativePicker,t[30]=d.modalOpen,t[31]=d.setModalOpen,t[32]=p,t[33]=a,t[34]=w):w=t[34];let T;return t[35]!==C||t[36]!==w?(T=(0,Y.jsxs)(Y.Fragment,{children:[C,w]}),t[35]=C,t[36]=w,t[37]=T):T=t[37],T}function Qt(e){return L(z(`/api/projects/${encodeURIComponent(e)}/skills`))}function $t(e,t){return L(z(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`))}function en(e,t){return L(z(`/api/projects/${encodeURIComponent(e)}/workspace-trust`),{method:`PATCH`,body:JSON.stringify({trusted:t})})}function tn(e,t){let n=new FormData;return n.set(`file`,t),L(z(`/api/projects/${encodeURIComponent(e)}/skills/upload`),{method:`POST`,body:n})}function nn(e,t,n={}){return L(z(`/api/projects/${encodeURIComponent(e)}/skills/marketplace/install`),{method:`POST`,body:JSON.stringify({name:t,...n})})}function rn(e,t){return L(z(`/api/projects/${encodeURIComponent(e)}/skills/source/install`),{method:`POST`,body:JSON.stringify({source:t})})}function an(e,t){return L(z(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`),{method:`DELETE`})}function on({projectId:e,copy:t}){let[n,r]=(0,J.useState)([]),[i,a]=(0,J.useState)([]),[o,s]=(0,J.useState)([]),[l,u]=(0,J.useState)([]),[g,y]=(0,J.useState)([]),[b,x]=(0,J.useState)(``),[T,E]=(0,J.useState)(null),[O,k]=(0,J.useState)(!1),[A,j]=(0,J.useState)(!0),[F,I]=(0,J.useState)(!1),[L,R]=(0,J.useState)(null),[z,H]=(0,J.useState)(``),[W,G]=(0,J.useState)(null),[ee,te]=(0,J.useState)(null),[ne,K]=(0,J.useState)(``),[re,ie]=(0,J.useState)(1),[q,oe]=(0,J.useState)(null),[se,le]=(0,J.useState)(!1),[fe,pe]=(0,J.useState)(``),[me,he]=(0,J.useState)(``),_e=(0,J.useRef)(null),ye=(0,J.useCallback)(async()=>{j(!0),H(``);try{let t=await Qt(e);r(t.items),a(t.inheritedItems),s(t.sources),u(t.diagnostics)}catch(e){H(e instanceof Error?e.message:String(e))}finally{j(!1)}},[e]);(0,J.useEffect)(()=>{ye()},[ye]),(0,J.useEffect)(()=>{let t=!1;return wt(e).then(e=>{t||y(e)}).catch(()=>{t||y([])}),()=>{t=!0}},[e]),(0,J.useEffect)(()=>{if(!b){E(null);return}let e=g.find(e=>e.key===b),t=!1;return E(null),H(``),k(!0),Re(e?.agentId??e?.routing?.agentId,b,!0).then(e=>{t||E(e)}).catch(e=>{t||H(e instanceof Error?e.message:String(e))}).finally(()=>{t||k(!1)}),()=>{t=!0}},[b,g]),(0,J.useEffect)(()=>{if(W!==`marketplace`)return;let e=new AbortController,t=window.setTimeout(()=>{le(!0),pe(``),Kt({q:ne,page:re,pageSize:8,sort:`downloads`,signal:e.signal}).then(oe).catch(t=>{e.signal.aborted||pe(t instanceof Error?t.message:String(t))}).finally(()=>{e.signal.aborted||le(!1)})},250);return()=>{window.clearTimeout(t),e.abort()}},[W,re,ne]);async function be(e,t){I(!0),R(t??null),H(``);try{await e(),G(null),he(``),await ye()}catch(e){H(e instanceof Error?e.message:String(e))}finally{I(!1),R(null)}}async function xe(t){H(``);try{te((await $t(e,t)).skill)}catch(e){H(e instanceof Error?e.message:String(e))}}async function Se(n){if(n.removable&&window.confirm(t.removeConfirm.replace(`{{name}}`,n.name))){I(!0);try{await an(e,n.directoryId),await ye()}catch(e){H(e instanceof Error?e.message:String(e))}finally{I(!1)}}}async function Ce(){I(!0),H(``);try{await en(e,!0),await ye()}catch(e){H(e instanceof Error?e.message:String(e))}finally{I(!1)}}let we=o.find(e=>e.origin===`agents-workspace`),Te=new Map(T?.skills.map(e=>[e.name,e]));return(0,Y.jsxs)(`section`,{id:`project-panel-skills`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-skills`,className:`grid content-start gap-4`,children:[(0,Y.jsxs)(`div`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.title}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,Y.jsxs)(v,{children:[(0,Y.jsx)(w,{asChild:!0,children:(0,Y.jsxs)(V,{type:`button`,children:[(0,Y.jsx)(M,{className:`size-4`,"aria-hidden":!0}),t.add,(0,Y.jsx)(ge,{className:`size-3.5`,"aria-hidden":!0})]})}),(0,Y.jsx)(_,{children:(0,Y.jsxs)(S,{align:`end`,sideOffset:8,className:`z-50 w-72 rounded-lg border border-edge bg-surface-panel p-1.5 shadow-xl`,children:[(0,Y.jsx)(un,{icon:ve,title:t.marketplace,hint:t.marketplaceHint,onClick:()=>G(`marketplace`)}),(0,Y.jsx)(un,{icon:bt,title:t.source,hint:t.sourceHint,onClick:()=>G(`source`)}),(0,Y.jsx)(un,{icon:Ot,title:t.upload,hint:t.uploadHint,onClick:()=>_e.current?.click()})]})})]}),(0,Y.jsx)(`input`,{ref:_e,type:`file`,accept:`.zip,application/zip`,className:`hidden`,onChange:t=>{let n=t.target.files?.[0];n&&be(()=>tn(e,n)),t.target.value=``}})]}),o.length?(0,Y.jsx)(`div`,{className:`mt-3 grid gap-2 rounded-md border border-edge-subtle bg-surface-base p-3`,children:o.map(e=>(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-xs`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg`,children:e.origin===`xopc-workspace`?t.xopcSource:t.agentsSource}),e.writable?null:(0,Y.jsx)(`span`,{className:`rounded bg-surface-hover px-1.5 py-0.5 text-fg-muted`,children:t.sourceReadOnly}),(0,Y.jsx)(`span`,{className:`text-fg-subtle`,children:dn(t,e.state)}),(0,Y.jsxs)(`span`,{className:`min-w-0 break-all font-mono text-fg-subtle`,children:[t.path,`: `,e.rootDir]})]},e.origin))}):null]}),z?(0,Y.jsx)(`p`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:z}):null,we?.state===`untrusted`?(0,Y.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,Y.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Y.jsx)(ae,{className:`mt-0.5 size-4 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.trustTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.trustHint})]})]}),(0,Y.jsxs)(V,{type:`button`,variant:`secondary`,disabled:F,onClick:()=>void Ce(),children:[(0,Y.jsx)(ue,{className:`size-4`,"aria-hidden":!0}),F?t.trusting:t.trustAction]})]}):null,l.some(e=>e.type!==`skipped`)?(0,Y.jsxs)(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 px-4 py-3`,children:[(0,Y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.diagnosticsTitle}),(0,Y.jsx)(`ul`,{className:`mt-2 grid gap-1 text-xs leading-5 text-fg-muted`,children:l.filter(e=>e.type!==`skipped`).map((e,t)=>(0,Y.jsx)(`li`,{children:e.message},`${e.type}:${e.path??``}:${t}`))})]}):null,g.length?(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3 rounded-lg border border-edge bg-surface-panel p-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.sessionViewLabel}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:O?t.sessionLoading:b?T?.agentId:t.sessionViewAll})]}),(0,Y.jsx)(C,{value:b,options:g.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:x})]}):null,A?(0,Y.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(e=>(0,Y.jsx)(U,{className:`h-36 rounded-lg`},e))}):n.length?(0,Y.jsx)(sn,{title:t.localTitle,items:n,copy:t,busy:F,availabilityByName:Te,onPreview:xe,onRemove:Se}):(0,Y.jsxs)(`div`,{className:`rounded-lg border border-dashed border-edge bg-surface-panel px-6 py-12 text-center`,children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.empty}),(0,Y.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:t.emptyHint})]}),!A&&i.length?(0,Y.jsx)(sn,{title:t.inheritedTitle,hint:t.inheritedHint,items:i,copy:t,busy:F,availabilityByName:Te,onPreview:xe,onRemove:Se}):null,(0,Y.jsx)(h,{open:W!==null,onOpenChange:e=>{e||G(null)},children:(0,Y.jsxs)(f,{children:[(0,Y.jsx)(c,{className:`fixed inset-0 z-50 bg-black/45`}),(0,Y.jsxs)(p,{className:B(`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`,W===`marketplace`?`h-[min(46rem,calc(100vh-2rem))] w-[min(58rem,calc(100vw-2rem))]`:`h-[min(22rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))]`),children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(m,{className:`text-base font-semibold text-fg`,children:W===`marketplace`?t.marketplace:t.source}),(0,Y.jsx)(d,{asChild:!0,children:(0,Y.jsx)(V,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,Y.jsx)(P,{className:`size-4`})})})]}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:W===`marketplace`?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.marketplace}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.marketplaceHint}),(0,Y.jsxs)(`div`,{className:`relative mt-3`,children:[(0,Y.jsx)(N,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`input`,{className:`h-10 w-full rounded-md border border-edge bg-surface-base pl-9 pr-3 text-sm outline-none focus:border-accent`,value:ne,onChange:e=>{K(e.target.value),ie(1)},placeholder:t.marketplacePlaceholder,autoFocus:!0})]}),fe?(0,Y.jsx)(`p`,{className:`mt-3 text-sm text-red-600 dark:text-red-300`,children:fe}):null,se&&!q?(0,Y.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[0,1,2,3].map(e=>(0,Y.jsx)(U,{className:`h-32 rounded-lg`},e))}):q?.items.length?(0,Y.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:q.items.map(r=>{let i=r.providerId??q.provider,a=Gt(r,i),o=n.some(e=>e.origin===`xopc-workspace`&&(e.directoryId===r.id||e.directoryId===a||e.name===r.name)),s=L===a;return(0,Y.jsxs)(`article`,{className:`group flex min-h-32 gap-3 rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Y.jsx)(qt,{name:r.name,className:`size-10`}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Y.jsx)(`h4`,{className:`truncate text-sm font-semibold text-fg`,children:r.name}),(0,Y.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:r.description||`—`}),(0,Y.jsxs)(`div`,{className:`mt-auto flex items-end justify-between gap-2 pt-2`,children:[(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-fg-subtle`,children:[(0,Y.jsx)(D,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceDownloads,` `,r.downloads]}),(0,Y.jsx)(V,{type:`button`,className:`h-8 px-2.5 text-xs`,variant:o?`secondary`:`primary`,disabled:F||o,onClick:()=>void be(()=>nn(e,a,{provider:i}),a),children:o?t.marketplaceInstalled:s?t.installing:t.install})]})]})]},`${i??`default`}:${r.id}`)})}):se?null:(0,Y.jsx)(`p`,{className:`mt-6 text-center text-sm text-fg-muted`,children:t.marketplaceEmpty}),q&&q.meta.totalPages>1?(0,Y.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,Y.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t.marketplacePage.replace(`{{page}}`,String(q.meta.page)).replace(`{{total}}`,String(q.meta.totalPages))}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsxs)(V,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:se||re<=1,onClick:()=>ie(e=>Math.max(1,e-1)),children:[(0,Y.jsx)(de,{className:`size-4`}),t.marketplacePrevious]}),(0,Y.jsxs)(V,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:se||re>=q.meta.totalPages,onClick:()=>ie(e=>e+1),children:[t.marketplaceNext,(0,Y.jsx)(ce,{className:`size-4`})]})]})]}):null]}):(0,Y.jsxs)(`section`,{className:`flex h-full flex-col`,children:[(0,Y.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:t.sourceHint}),(0,Y.jsx)(`input`,{className:`mt-4 h-10 w-full rounded-md border border-edge bg-surface-base px-3 text-sm outline-none focus:border-accent`,value:me,onChange:e=>he(e.target.value),placeholder:t.sourcePlaceholder,autoFocus:!0}),(0,Y.jsxs)(`div`,{className:`mt-auto flex justify-end gap-2 border-t border-edge pt-4`,children:[(0,Y.jsx)(d,{asChild:!0,children:(0,Y.jsx)(V,{type:`button`,variant:`secondary`,children:t.close})}),(0,Y.jsx)(V,{type:`button`,disabled:F||!me.trim(),onClick:()=>void be(()=>rn(e,me.trim())),children:F?t.installing:t.install})]})]})})]})]})}),(0,Y.jsx)(h,{open:!!ee,onOpenChange:e=>{e||te(null)},children:(0,Y.jsxs)(f,{children:[(0,Y.jsx)(c,{className:`fixed inset-0 z-50 bg-black/45`}),(0,Y.jsxs)(p,{className:`fixed left-1/2 top-1/2 z-50 flex h-[min(42rem,calc(100vh-2rem))] w-[min(48rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-xl`,children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(m,{className:`text-base font-semibold text-fg`,children:ee?.name}),(0,Y.jsx)(d,{asChild:!0,children:(0,Y.jsx)(V,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,Y.jsx)(P,{className:`size-4`})})})]}),(0,Y.jsx)(`pre`,{className:`min-h-0 flex-1 overflow-auto whitespace-pre-wrap p-5 text-sm leading-6 text-fg-muted`,children:ee?.bodyMarkdown})]})]})})]})}function sn(e){let t=(0,Yt.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,Y.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,Y.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,Y.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,Y.jsxs)(`article`,{className:B(`flex min-h-36 flex-col rounded-lg border border-edge bg-surface-panel p-4`,!e.effective&&`opacity-70`),children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(ut,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,Y.jsx)(`h4`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:e.name})]}),(0,Y.jsx)(`p`,{className:`mt-2 line-clamp-2 flex-1 text-sm leading-5 text-fg-muted`,children:e.description||e.directoryId}),(0,Y.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5 text-[11px] text-fg-subtle`,children:[(0,Y.jsx)(`span`,{className:`rounded-md bg-surface-hover/70 px-2 py-0.5`,children:cn(a,e.origin)}),e.writable?null:(0,Y.jsx)(`span`,{className:`rounded-md bg-surface-hover/70 px-2 py-0.5`,children:a.sourceReadOnly}),e.effective?null:(0,Y.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,Y.jsx)(`span`,{className:B(`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:ln(a,t)}):null]}),(0,Y.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,Y.jsxs)(V,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>void c(e.key),children:[(0,Y.jsx)(O,{className:`size-3.5`,"aria-hidden":!0}),a.view]}),e.removable?(0,Y.jsxs)(V,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-red-600`,disabled:o,onClick:()=>void l(e),children:[(0,Y.jsx)(se,{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,Y.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,Y.jsxs)(`section`,{className:`grid gap-3`,children:[f,m]}),t[22]=f,t[23]=m,t[24]=h):h=t[24],h}function cn(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 ln(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 un(e){let t=(0,Yt.c)(13),{icon:n,title:r,hint:i,onClick:a}=e,o;t[0]===n?o=t[1]:(o=(0,Y.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`,"aria-hidden":!0}),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=(0,Y.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:r}),t[2]=r,t[3]=s);let c;t[4]===i?c=t[5]:(c=(0,Y.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-fg-muted`,children:i}),t[4]=i,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;return t[9]!==a||t[10]!==o||t[11]!==l?(u=(0,Y.jsx)(b,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-3 rounded-md px-3 py-2.5 text-left hover:bg-surface-hover`,onClick:a,children:[o,l]})}),t[9]=a,t[10]=o,t[11]=l,t[12]=u):u=t[12],u}function dn(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 fn=[`backlog`,`ready`,`active`,`review`,`closed`];function pn(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 mn(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 hn(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 gn(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 _n(e,t){let n=new Set(e.map(e=>e.id)),{outgoing:r,incoming:i}=gn(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 vn(e,t){let{incoming:n}=gn(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 yn(e,t){let{incoming:n,outgoing:r}=gn(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 bn={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 xn(e){let t=(0,Yt.c)(25),{data:n,selected:r}=e,i=n.task,a=i.operationalState===`waiting`||i.operationalState===`blocked`,o=bn[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=B(`group w-56 rounded-xl border bg-surface-panel p-3 shadow-surface transition-opacity`,o,s,c),t[0]=o,t[1]=s,t[2]=c,t[3]=l):l=t[3];let u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Y.jsx)(Ht,{type:`target`,position:zt.Left,className:`!size-3 !border-2 !border-surface-panel !bg-accent opacity-60 transition-opacity group-hover:opacity-100`}),t[4]=u):u=t[4];let d;t[5]===i.title?d=t[6]:(d=(0,Y.jsx)(`strong`,{className:`line-clamp-2 min-w-0 text-sm font-medium leading-5 text-fg`,children:i.title}),t[5]=i.title,t[6]=d);let f;t[7]===a?f=t[8]:(f=a?(0,Y.jsx)(fe,{className:`mt-0.5 size-3.5 shrink-0 text-violet-600 dark:text-violet-300`,"aria-hidden":!0}):null,t[7]=a,t[8]=f);let p;t[9]!==d||t[10]!==f?(p=(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[d,f]}),t[9]=d,t[10]=f,t[11]=p):p=t[11];let m;t[12]===n.phaseLabel?m=t[13]:(m=(0,Y.jsx)(`span`,{children:n.phaseLabel}),t[12]=n.phaseLabel,t[13]=m);let h;t[14]!==a||t[15]!==i.blockedBy?(h=a&&i.blockedBy.length>0?(0,Y.jsx)(`span`,{children:i.blockedBy.length}):null,t[14]=a,t[15]=i.blockedBy,t[16]=h):h=t[16];let g;t[17]!==h||t[18]!==m?(g=(0,Y.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2 text-[11px] text-fg-subtle`,children:[m,h]}),t[17]=h,t[18]=m,t[19]=g):g=t[19];let _;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Y.jsx)(Ht,{type:`source`,position:zt.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,Y.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 Sn={taskNode:xn};function Cn(e){let t=(0,Yt.c)(90),{tasks:n,dependencyEdges:r,returnTo:i,copy:a,onDependenciesChange:o}=e,[c,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(!1),[f,p]=(0,J.useState)(),[m,h]=(0,J.useState)(),g=(0,J.useRef)(null),_;t[0]!==r||t[1]!==n?(_=vn(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(kn),t[3]=v,t[4]=u,t[5]=c,t[6]=n,t[7]=y):y=t[7];let b=y,x;t[8]===b?x=t[9]:(x=new Set(b.map(Z)),t[8]=b,t[9]=x);let S=x,C;if(t[10]!==r||t[11]!==S){let e;t[13]===S?e=t[14]:(e=e=>S.has(e.dependencyTaskId)&&S.has(e.dependentTaskId),t[13]=S,t[14]=e),C=r.filter(e),t[10]=r,t[11]=S,t[12]=C}else C=t[12];let w=C,T;t[15]!==w||t[16]!==b?(T=_n(b,w),t[15]=w,t[16]=b,t[17]=T):T=t[17];let E=T,D;t[18]!==f||t[19]!==w?(D=f?yn(f,w):void 0,t[18]=f,t[19]=w,t[20]=D):D=t[20];let k=D,A;t[21]===f?A=t[22]:(A=e=>e.id===f,t[21]=f,t[22]=A);let j=b.find(A),M;t[23]===b?M=t[24]:(M=new Map(b.map(On)),t[23]=b,t[24]=M);let N=M,P;if(t[25]!==a.phases||t[26]!==E||t[27]!==k||t[28]!==b){let e;t[30]!==a.phases||t[31]!==E||t[32]!==k?(e=e=>({id:e.id,type:`taskNode`,position:E.get(e.id)??{x:0,y:0},data:{task:e,phaseLabel:a.phases[e.phase],dimmed:!!(k&&!k.has(e.id))}}),t[30]=a.phases,t[31]=E,t[32]=k,t[33]=e):e=t[33],P=b.map(e),t[25]=a.phases,t[26]=E,t[27]=k,t[28]=b,t[29]=P}else P=t[29];let F=P,I;if(t[34]!==k||t[35]!==N||t[36]!==w){let e;t[38]!==k||t[39]!==N?(e=e=>{let t=N.get(e.dependencyTaskId),n=t?.phase===`closed`&&t.resolution===`done`,r=!!(k&&(!k.has(e.dependencyTaskId)||!k.has(e.dependentTaskId)));return{id:`${e.dependencyTaskId}:${e.dependentTaskId}`,source:e.dependencyTaskId,target:e.dependentTaskId,markerEnd:{type:Rt.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]=k,t[39]=N,t[40]=e):e=t[40],I=w.map(e),t[34]=k,t[35]=N,t[36]=w,t[37]=I}else I=t[37];let L=I,R,z;t[41]!==f||t[42]!==S?(R=()=>{f&&!S.has(f)&&p(void 0)},z=[f,S],t[41]=f,t[42]=S,t[43]=R,t[44]=z):(R=t[43],z=t[44]),(0,J.useEffect)(R,z);let H,U;t[45]!==L||t[46]!==m?(H=()=>{m&&!L.some(e=>e.id===m)&&h(void 0)},U=[L,m],t[45]=L,t[46]=m,t[47]=H,t[48]=U):(H=t[47],U=t[48]),(0,J.useEffect)(H,U);let W;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(W=()=>{let e=window.requestAnimationFrame(()=>{g.current?.fitView({padding:.2,minZoom:.35,maxZoom:1,duration:250})});return()=>window.cancelAnimationFrame(e)},t[49]=W):W=t[49];let G;t[50]!==u||t[51]!==c||t[52]!==b.length?(G=[u,c,b.length],t[50]=u,t[51]=c,t[52]=b.length,t[53]=G):G=t[53],(0,J.useEffect)(W,G);let ee;t[54]===f?ee=t[55]:(ee=()=>{f&&g.current?.fitView({nodes:[{id:f}],padding:1.5,minZoom:.7,maxZoom:1,duration:250})},t[54]=f,t[55]=ee);let te=ee,ne;t[56]!==r||t[57]!==o?(ne=e=>{if(!e.source||!e.target||e.source===e.target)return;let t=r.filter(t=>t.dependentTaskId===e.target).map(Dn);t.includes(e.source)||o(e.target,[...t,e.source])},t[56]=r,t[57]=o,t[58]=ne):ne=t[58];let K=ne,re;t[59]!==r||t[60]!==o||t[61]!==m?(re=()=>{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(X)))},t[59]=r,t[60]=o,t[61]=m,t[62]=re):re=t[62];let ie=re,ae;t[63]===a.connectHint?ae=t[64]:(ae=(0,Y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.connectHint}),t[63]=a.connectHint,t[64]=ae);let q=u?`secondary`:`ghost`,oe;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(oe=()=>d(En),t[65]=oe):oe=t[65];let se=u?a.allTasks:a.blockedChains,ce;t[66]!==u||t[67]!==q||t[68]!==se?(ce=(0,Y.jsx)(V,{type:`button`,variant:q,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":u,onClick:oe,children:se}),t[66]=u,t[67]=q,t[68]=se,t[69]=ce):ce=t[69];let le;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(le=()=>l(Tn),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,Y.jsx)(V,{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=j?(0,Y.jsxs)(V,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:te,children:[(0,Y.jsx)(vt,{className:`size-3.5`,"aria-hidden":!0}),a.locateTask]}):null,pe;t[75]!==a.removeDependency||t[76]!==ie||t[77]!==m?(pe=m?(0,Y.jsx)(V,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs text-danger`,onClick:ie,children:a.removeDependency}):null,t[75]=a.removeDependency,t[76]=ie,t[77]=m,t[78]=pe):pe=t[78];let me;t[79]!==ce||t[80]!==de||t[81]!==fe||t[82]!==pe?(me=(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[ce,de,fe,pe]}),t[79]=ce,t[80]=de,t[81]=fe,t[82]=pe,t[83]=me):me=t[83];let he;t[84]!==ae||t[85]!==me?(he=(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-b border-edge bg-surface-panel px-3 py-2.5`,children:[ae,me]}),t[84]=ae,t[85]=me,t[86]=he):he=t[86];let ge=b.length>0?(0,Y.jsxs)(`div`,{className:B(`grid h-[min(42rem,calc(100vh-14rem))] min-h-[28rem]`,j&&`lg:grid-cols-[minmax(0,1fr)_18rem]`),children:[(0,Y.jsxs)(Vt,{nodes:F,edges:L,nodeTypes:Sn,nodesDraggable:!1,nodesConnectable:!0,elementsSelectable:!0,onNodeClick:(e,t)=>p(t.id),onEdgeClick:(e,t)=>h(t.id),onConnect:K,onPaneClick:()=>{p(void 0),h(void 0)},onInit:e=>{g.current=e},fitView:!0,minZoom:.25,maxZoom:1.25,panOnScroll:!0,zoomOnDoubleClick:!1,proOptions:{hideAttribution:!0},children:[(0,Y.jsx)(Ut,{color:`var(--color-edge)`,gap:22,size:1}),(0,Y.jsx)(Bt,{showInteractive:!1,className:`!border-edge !bg-surface-panel !shadow-surface`})]}),j?(0,Y.jsxs)(`aside`,{className:`overflow-y-auto border-t border-edge bg-surface-panel p-4 lg:border-l lg:border-t-0`,children:[(0,Y.jsx)(`p`,{className:`text-xs font-medium text-accent-fg`,children:a.phases[j.phase]}),(0,Y.jsx)(`h3`,{className:`mt-2 text-sm font-semibold leading-6 text-fg`,children:j.title}),j.operationalState===`blocked`&&j.blockedBy.length>0?(0,Y.jsxs)(`div`,{className:`mt-4 rounded-lg bg-violet-500/8 p-3`,children:[(0,Y.jsx)(`p`,{className:`text-xs font-medium text-violet-700 dark:text-violet-300`,children:a.blockedBy.replace(`{{count}}`,String(j.blockedBy.length))}),(0,Y.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:j.blockedBy.map(wn)})]}):null,(0,Y.jsxs)(s,{to:Ke(i,j.id),className:`mt-4 inline-flex items-center gap-1.5 text-xs font-medium text-accent-fg hover:underline`,children:[(0,Y.jsx)(O,{className:`size-3.5`,"aria-hidden":!0}),a.openTask]})]}):null]}):(0,Y.jsx)(`div`,{className:`flex min-h-72 items-center justify-center px-6 text-center text-sm text-fg-muted`,children:a.empty}),_e;return t[87]!==he||t[88]!==ge?(_e=(0,Y.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-base/40`,children:[he,ge]}),t[87]=he,t[88]=ge,t[89]=_e):_e=t[89],_e}function wn(e){return(0,Y.jsx)(`li`,{children:e.title},e.id)}function Tn(e){return!e}function En(e){return!e}function X(e){return e.dependencyTaskId}function Dn(e){return e.dependencyTaskId}function On(e){return[e.id,e]}function Z(e){return e.id}function kn(e){return e.phase!==`closed`}function An({policy:e,copy:t,onSave:n}){let[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(e.mode),[s,g]=(0,J.useState)(Math.round(e.confidenceThreshold*100)),[_,v]=(0,J.useState)(!!e.quietHours),[b,S]=(0,J.useState)(e.quietHours?.startHour??22),[C,w]=(0,J.useState)(e.quietHours?.endHour??8),[T,E]=(0,J.useState)(e.quietHours?.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone),[D,O]=(0,J.useState)(e.allowedActions.includes(`create_project_task`)),[k,A]=(0,J.useState)(!1),[j,M]=(0,J.useState)();(0,J.useEffect)(()=>{o(e.mode),g(Math.round(e.confidenceThreshold*100)),v(!!e.quietHours),S(e.quietHours?.startHour??22),w(e.quietHours?.endHour??8),E(e.quietHours?.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone),O(e.allowedActions.includes(`create_project_task`))},[e]);let N=async()=>{A(!0),M(void 0);try{await n({mode:a,confidenceThreshold:s/100,quietHours:_?{startHour:b,endHour:C,timezone:T}:null,allowedActions:D?[`create_project_task`]:[]}),i(!1)}catch(e){M(e instanceof Error?e.message:t.saveFailed)}finally{A(!1)}};return(0,Y.jsxs)(h,{open:r,onOpenChange:e=>{k||i(e)},children:[(0,Y.jsx)(l,{asChild:!0,children:(0,Y.jsxs)(V,{type:`button`,variant:`ghost`,className:`h-9 gap-2 px-2.5 text-xs`,children:[(0,Y.jsx)(Le,{className:`size-3.5`,"aria-hidden":!0}),t.modes[e.mode]]})}),(0,Y.jsxs)(f,{children:[(0,Y.jsx)(c,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(p,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(36rem,calc(100vh-2rem))] w-[min(34rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(m,{className:`text-base font-semibold text-fg`,children:t.title}),(0,Y.jsx)(u,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,Y.jsx)(d,{asChild:!0,children:(0,Y.jsx)(V,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:k,children:(0,Y.jsx)(P,{className:`size-4`,"aria-hidden":!0})})})]}),(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-4`,children:[(0,Y.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:t.mode}),(0,Y.jsx)(y,{value:a,onChange:e=>o(e.target.value),children:Object.entries(t.modes).map(([e,t])=>(0,Y.jsx)(x,{value:e,children:t},e))})]}),(0,Y.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[t.confidence,` · `,s,`%`]}),(0,Y.jsx)(`input`,{type:`range`,min:`50`,max:`100`,step:`5`,value:s,onChange:e=>g(Number(e.target.value)),className:`accent-accent`})]}),(0,Y.jsxs)(`div`,{className:`rounded-lg border border-edge p-3`,children:[(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:_,onChange:e=>v(e.target.checked)}),t.quietHours]}),_?(0,Y.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-3`,children:[(0,Y.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietStart,(0,Y.jsx)(`input`,{type:`number`,min:`0`,max:`23`,value:b,onChange:e=>S(Number(e.target.value)),className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-fg`})]}),(0,Y.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietEnd,(0,Y.jsx)(`input`,{type:`number`,min:`0`,max:`23`,value:C,onChange:e=>w(Number(e.target.value)),className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-fg`})]}),(0,Y.jsxs)(`label`,{className:`col-span-2 grid gap-1 text-xs text-fg-muted`,children:[t.timezone,(0,Y.jsx)(`input`,{value:T,onChange:e=>E(e.target.value),className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-fg`})]})]}):null]}),(0,Y.jsxs)(`label`,{className:`flex items-start gap-3 rounded-lg border border-edge p-3`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,className:`mt-1`,checked:D,onChange:e=>O(e.target.checked)}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:t.allowTaskCreation}),(0,Y.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.allowTaskCreationDescription})]})]})]}),(0,Y.jsxs)(`div`,{className:`shrink-0 border-t border-edge px-5 py-3`,children:[j?(0,Y.jsx)(`p`,{className:`mb-2 text-xs text-danger`,children:j}):null,(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Y.jsx)(d,{asChild:!0,children:(0,Y.jsx)(V,{type:`button`,variant:`ghost`,disabled:k,children:t.cancel})}),(0,Y.jsx)(V,{type:`button`,variant:`primary`,disabled:k||!T.trim()||b<0||b>23||C<0||C>23,onClick:()=>void N(),children:k?t.saving:t.save})]})]})]})]})]})}function jn(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}var Q={backlog:rt,ready:rt,active:Ce,review:At,closed:T},Mn={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 Nn(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 Pn(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 Fn(e){let t=(0,Yt.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,E;t[0]!==c||t[1]!==l||t[2]!==r||t[3]!==n?(m=hn(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?T:Tt,_=n.priority!==`normal`,g=_||n.operationalState!==`idle`||!!n.latestVerification||n.acceptanceCriteriaCount>0||!!n.dueAt||!!n.nextCheckAt,b=!0,t[20]!==c||t[21]!==n.id?(x=e=>{e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,n.id),c(n.id)},t[20]=c,t[21]=n.id,t[22]=x):x=t[22],t[23]===c?S=t[24]:(S=()=>c(``),t[23]=c,t[24]=S),C=Ln,t[25]!==l||t[26]!==n.id?(w=e=>{e.preventDefault(),e.stopPropagation(),l(n.id)},t[25]=l,t[26]=n.id,t[27]=w):w=t[27],E=`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?(v=Ke(r,n.id),t[28]=r,t[29]=n.id,t[30]=v):v=t[30],y=B(`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]=_,t[12]=v,t[13]=y,t[14]=b,t[15]=x,t[16]=S,t[17]=C,t[18]=w,t[19]=E):(u=t[4],d=t[5],f=t[6],p=t[7],m=t[8],h=t[9],g=t[10],_=t[11],v=t[12],y=t[13],b=t[14],x=t[15],S=t[16],C=t[17],w=t[18],E=t[19]);let D=f?`text-emerald-600 dark:text-emerald-400`:`text-fg-subtle`,O;t[31]===D?O=t[32]:(O=B(`mt-0.5 size-4 shrink-0`,D),t[31]=D,t[32]=O);let k;t[33]!==d||t[34]!==O?(k=(0,Y.jsx)(d,{className:O,"aria-hidden":!0}),t[33]=d,t[34]=O,t[35]=k):k=t[35];let A=f?`text-fg-subtle`:`text-fg`,j;t[36]===A?j=t[37]:(j=B(`min-w-0 break-words text-sm font-semibold leading-5`,A),t[36]=A,t[37]=j);let M;t[38]!==j||t[39]!==n.title?(M=(0,Y.jsx)(`h3`,{className:j,children:n.title}),t[38]=j,t[39]=n.title,t[40]=M):M=t[40];let N;t[41]!==k||t[42]!==M?(N=(0,Y.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[k,M]}),t[41]=k,t[42]=M,t[43]=N):N=t[43];let P;t[44]!==i||t[45]!==n.attention||t[46]!==n.blockedBy||t[47]!==n.operationalState?(P=n.operationalState===`blocked`&&n.blockedBy.length>0?(0,Y.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,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-medium`,children:[(0,Y.jsx)(fe,{className:`size-3.5`,"aria-hidden":!0}),i.blockedBy.replace(`{{count}}`,String(n.blockedBy.length))]}),(0,Y.jsx)(`p`,{className:`mt-1 line-clamp-2 leading-5 text-fg-muted`,children:n.blockedBy.map(In).join(`、`)})]}):n.attention[0]?(0,Y.jsxs)(`p`,{className:`ml-6.5 mt-2.5 flex items-start gap-1.5 text-xs leading-5 text-fg-muted`,children:[(0,Y.jsx)(be,{className:`mt-0.5 size-3.5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,Y.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]=P):P=t[48];let F;t[49]!==i||t[50]!==p||t[51]!==g||t[52]!==_||t[53]!==n.acceptanceCriteriaCount||t[54]!==n.dueAt||t[55]!==n.latestVerification||t[56]!==n.nextCheckAt||t[57]!==n.operationalState||t[58]!==n.priority?(F=g?(0,Y.jsxs)(`div`,{className:`ml-6.5 mt-2.5 flex flex-wrap items-center gap-1.5 text-[11px]`,children:[_?(0,Y.jsx)(`span`,{className:B(`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,Y.jsx)(`span`,{className:B(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,Nn(n.operationalState)),children:i.operationalStates[n.operationalState]}),n.latestVerification?(0,Y.jsx)(`span`,{className:B(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,Pn(n.latestVerification)),children:i.verification[n.latestVerification]}):null,n.acceptanceCriteriaCount>0?(0,Y.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,Y.jsx)(Ce,{className:`size-3`,"aria-hidden":!0}),i.acceptanceCriteria.replace(`{{count}}`,String(n.acceptanceCriteriaCount))]}):null,n.dueAt?(0,Y.jsxs)(`span`,{className:B(`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,Y.jsx)(K,{className:`size-3`,"aria-hidden":!0}),$e(new Date(n.dueAt))]}):null,n.nextCheckAt?(0,Y.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,Y.jsx)(K,{className:`size-3`,"aria-hidden":!0}),$e(new Date(n.nextCheckAt))]}):null]}):null,t[49]=i,t[50]=p,t[51]=g,t[52]=_,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]=F):F=t[59];let I;t[60]!==u||t[61]!==v||t[62]!==N||t[63]!==P||t[64]!==F||t[65]!==y?(I=(0,Y.jsxs)(u,{to:v,className:y,children:[N,P,F]}),t[60]=u,t[61]=v,t[62]=N,t[63]=P,t[64]=F,t[65]=y,t[66]=I):I=t[66];let L;t[67]!==a||t[68]!==i||t[69]!==o||t[70]!==m||t[71]!==h||t[72]!==n?(L=m?(0,Y.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,Y.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,Y.jsx)(At,{className:`size-3.5`,"aria-hidden":!0})}):null,(0,Y.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,Y.jsx)(W,{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]=L):L=t[73];let R;return t[74]!==I||t[75]!==L||t[76]!==b||t[77]!==x||t[78]!==S||t[79]!==C||t[80]!==w||t[81]!==E?(R=(0,Y.jsxs)(`article`,{draggable:b,onDragStart:x,onDragEnd:S,onDragOver:C,onDrop:w,className:E,children:[I,L]}),t[74]=I,t[75]=L,t[76]=b,t[77]=x,t[78]=S,t[79]=C,t[80]=w,t[81]=E,t[82]=R):R=t[82],R}function In(e){return e.title}function Ln(e){e.preventDefault(),e.stopPropagation()}function Rn({tasks:e,dependencyEdges:t,monitoring:n,returnTo:r,copy:i,onAction:a,onReorder:o,onUndoMove:s,onDependenciesChange:l,onMonitoringChange:g,onCreate:_,actionBusyId:v,ref:b}){let S=(0,J.useRef)(null),C=(0,J.useRef)(null),[w,T]=(0,J.useState)(null),[E,D]=(0,J.useState)(!1),[O,k]=(0,J.useState)(null),[A,j]=(0,J.useState)(`board`),[M,N]=(0,J.useState)(!1),[P,F]=(0,J.useState)(()=>crypto.randomUUID()),[L,z]=(0,J.useState)(``),[H,U]=(0,J.useState)(`normal`),[W,G]=(0,J.useState)(``),[ee,te]=(0,J.useState)([]),[K,re]=(0,J.useState)(!1),[ie,ae]=(0,J.useState)(null),q=ye({chat:I(R(e=>e.language)).chat}),oe=pn(e),se=e.filter(e=>e.phase!==`closed`),ce=(e,t)=>void a(e,t),le=async(t,n)=>{let r=e.find(e=>e.id===w);if(T(null),!r||r.id===n)return;let i=oe[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=mn(r,t);r.phase!==t&&!l||l&&!await a(r,l)||await o(r.id,n)&&k({taskId:r.id,phase:r.phase,beforeTaskId:c})},ue=async e=>{e.preventDefault();let t=L.trim();if(!(!t||K)){re(!0),ae(null);try{let e=W?new Date(`${W}T23:59:59.999`).getTime():void 0;await _({requestId:P,objective:t,priority:H,dependsOnTaskIds:ee,attachments:q.wireAttachmentsPayload(),...e===void 0?{}:{dueAt:e}}),z(``),U(`normal`),G(``),te([]),q.clearAttachments(),F(crypto.randomUUID()),N(!1)}catch(e){ae(e instanceof Error?e.message:i.createFailed)}finally{re(!1)}}},de=()=>{F(crypto.randomUUID()),z(``),U(`normal`),G(``),te([]),q.clearAttachments(),ae(null),N(!0)};(0,J.useImperativeHandle)(b,()=>({openCreate:de})),(0,J.useEffect)(()=>{if(!O)return;let e=window.setTimeout(()=>k(null),6e3);return()=>window.clearTimeout(e)},[O]);let fe=(0,J.useCallback)(e=>{let t=C.current;!t||t.pointerId!==e.pointerId||(C.current=null,D(!1),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),pe=(0,J.useCallback)(e=>{if(e.button!==0||jn(e.target))return;let t=S.current;t&&(C.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},[]),me=(0,J.useCallback)(e=>{let t=C.current,n=S.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,D(!0)),e.preventDefault(),n.scrollLeft=t.scrollLeft-r)},[]);return(0,Y.jsxs)(`section`,{id:`project-panel-board`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-board`,className:`flex h-full min-h-0 flex-col overflow-hidden`,children:[(0,Y.jsxs)(`div`,{className:`mb-4 flex shrink-0 flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:i.title}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:i.description})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,Y.jsx)(An,{policy:n,copy:i.monitoring,onSave:g}),(0,Y.jsxs)(`div`,{className:`flex rounded-lg border border-edge bg-surface-panel p-0.5`,children:[(0,Y.jsxs)(`button`,{type:`button`,"aria-pressed":A===`board`,onClick:()=>j(`board`),className:B(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,A===`board`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,Y.jsx)(De,{className:`size-3.5`,"aria-hidden":!0}),i.views.board]}),(0,Y.jsxs)(`button`,{type:`button`,"aria-pressed":A===`graph`,onClick:()=>j(`graph`),className:B(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,A===`graph`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,Y.jsx)(bt,{className:`size-3.5`,"aria-hidden":!0}),i.views.graph]})]})]})]}),A===`board`?(0,Y.jsx)(`div`,{ref:S,className:B(`min-h-0 w-full min-w-0 flex-1 overflow-x-auto overflow-y-hidden overscroll-x-contain pb-2 [scrollbar-width:thin]`,E?`cursor-grabbing select-none`:`cursor-grab`),onPointerDown:pe,onPointerMove:me,onPointerUp:fe,onPointerCancel:fe,onLostPointerCapture:e=>{C.current?.pointerId===e.pointerId&&(C.current=null,D(!1))},children:(0,Y.jsx)(`div`,{className:`grid h-full min-h-0 min-w-[103rem] grid-cols-5 gap-3`,children:fn.map(t=>{let n=Q[t],a=oe[t];return(0,Y.jsxs)(`section`,{onDragOver:n=>{let r=e.find(e=>e.id===w);r&&(r.phase===t||mn(r,t))&&n.preventDefault()},onDrop:e=>{e.preventDefault(),le(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,Y.jsxs)(`header`,{className:`mb-2.5 flex shrink-0 items-center gap-2 px-0.5`,children:[(0,Y.jsxs)(`div`,{className:B(`flex items-center gap-1.5 rounded-md px-2 py-1`,Mn[t]),children:[(0,Y.jsx)(n,{className:`size-3.5`,"aria-hidden":!0}),(0,Y.jsx)(`h3`,{className:`text-sm font-semibold`,children:i.phases[t]})]}),(0,Y.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:a.length})]}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-y-contain pr-1 [scrollbar-gutter:stable] [scrollbar-width:thin]`,children:(0,Y.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.map(e=>(0,Y.jsx)(Fn,{task:e,returnTo:r,copy:i,busy:v===e.id,onAction:ce,onDragStart:T,onDropBefore:e=>void le(t,e)},e.id))})})]},t)})})}):(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Y.jsx)(Cn,{tasks:e,dependencyEdges:t,returnTo:r,copy:{...i.graph,phases:i.phases},onDependenciesChange:l})}),(0,Y.jsx)(h,{open:M,onOpenChange:e=>{K||N(e)},children:(0,Y.jsxs)(f,{children:[(0,Y.jsx)(c,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(p,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(40rem,calc(100vh-2rem))] w-[min(38rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(m,{className:`text-base font-semibold text-fg`,children:i.createTitle}),(0,Y.jsx)(u,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:i.createDescription})]}),(0,Y.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>void ue(e),children:[(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsx)(`label`,{htmlFor:`project-task-objective`,className:`font-medium text-fg-muted`,children:i.objective}),(0,Y.jsxs)(`div`,{className:B(`overflow-hidden rounded-lg border border-edge bg-surface-base transition-colors focus-within:border-accent`,q.isDragging&&`border-accent bg-accent-soft/30`),onDragOver:e=>{e.preventDefault(),K||q.setIsDragging(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||q.setIsDragging(!1)},onDrop:e=>{e.preventDefault(),q.setIsDragging(!1),K||q.processFiles(Array.from(e.dataTransfer.files))},children:[(0,Y.jsx)(`textarea`,{id:`project-task-objective`,autoFocus:!0,className:`min-h-28 w-full resize-y bg-transparent px-3 py-3 text-sm leading-6 text-fg outline-none placeholder:text-fg-subtle`,value:L,onChange:e=>{z(e.target.value),ae(null)},placeholder:i.objectivePlaceholder,maxLength:12e3,disabled:K}),(0,Y.jsx)(ne,{attachments:q.attachments,topPadded:!1,onRemove:e=>{K||q.removeAttachment(e)}}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-t border-edge-subtle px-2.5 py-2`,children:[(0,Y.jsxs)(V,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:K,onClick:()=>q.fileInputRef.current?.click(),children:[(0,Y.jsx)(st,{className:`size-3.5`,"aria-hidden":!0}),i.addFiles]}),(0,Y.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:i.attachmentsDescription}),(0,Y.jsx)(`input`,{ref:q.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{q.processFiles(Array.from(e.target.files??[])),e.currentTarget.value=``}})]})]})]}),(0,Y.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Y.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:i.priority}),(0,Y.jsx)(y,{value:H,onChange:e=>U(e.target.value),disabled:K,children:[`low`,`normal`,`high`,`critical`].map(e=>(0,Y.jsx)(x,{value:e,children:i.priorityOptions[e]},e))})]}),(0,Y.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[i.dueDate,` `,(0,Y.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:i.optional})]}),(0,Y.jsx)(Lt,{className:`min-h-10 bg-surface-base`,value:W,onChange:G,disabled:K,ariaLabel:i.dueDate})]})]}),(0,Y.jsxs)(`fieldset`,{className:`grid gap-2`,children:[(0,Y.jsxs)(`legend`,{className:`text-sm font-medium text-fg-muted`,children:[i.dependencies,` `,(0,Y.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:i.optional})]}),(0,Y.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:i.dependenciesDescription}),(0,Y.jsx)(Jt,{candidates:se,selectedIds:ee,disabled:K,onChange:te,labels:{link:i.linkDependencies,linked:i.linkedDependencies,searchPlaceholder:i.dependencySearchPlaceholder,noMatches:i.noDependencyMatches,noCandidates:i.noDependencyCandidates,remove:i.removeDependency}})]}),ie?(0,Y.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:ie}):null]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(d,{asChild:!0,children:(0,Y.jsx)(V,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:K,children:i.cancel})}),(0,Y.jsx)(V,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:K||!L.trim(),children:K?i.creating:i.create})]})]})]})]})}),O?(0,Y.jsxs)(`div`,{role:`status`,className:`fixed bottom-5 left-1/2 z-50 flex -translate-x-1/2 items-center gap-4 rounded-lg border border-edge bg-surface-panel px-4 py-3 text-sm text-fg shadow-float`,children:[(0,Y.jsx)(`span`,{children:i.moved}),(0,Y.jsx)(`button`,{type:`button`,className:`font-medium text-accent-fg hover:underline`,onClick:()=>{let e=O;k(null),s(e.taskId,e.phase,e.beforeTaskId).then(t=>{t||k(e)})},children:i.undo})]}):null]})}var zn=new Set([{id:`overview`,icon:jt},{id:`tasks`,icon:Ve},{id:`automations`,icon:Ze},{id:`files`,icon:_t},{id:`notes`,icon:Ge},{id:`skills`,icon:re},{id:`sessions`,icon:j},{id:`progress`,icon:Fe},{id:`settings`,icon:me}].map(e=>e.id)),$=`xopc.projectFiles.panelWidthPx`,Bn=320,Vn=220,Hn=560;function Un(e,t){return e.name!==t.name||e.description!==(t.description??``)||e.status!==t.status||e.defaultAgentId!==(t.defaultAgentId??``)||e.executionMode!==t.executionMode||e.brief!==(t.brief??``)||e.instructions!==(t.instructions??``)}function Wn(e){return Math.min(Hn,Math.max(Vn,Math.round(e)))}function Gn(){try{let e=window.localStorage.getItem($);if(e==null)return Bn;let t=Number.parseInt(e,10);return Number.isFinite(t)?Wn(t):Bn}catch{return Bn}}function Kn(e){try{window.localStorage.setItem($,String(Wn(e)))}catch{}}function qn(e){return!!(e&&zn.has(e))}function Jn(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function Yn(e,t=``){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?String(e):$e(n)}function Xn(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 Zn(e){let t=(0,Yt.c)(8),{label:n,hint:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=r?(0,Y.jsx)(`span`,{className:`text-xs leading-5 text-fg-subtle`,children:r}):null,t[2]=r,t[3]=o);let s;return t[4]!==i||t[5]!==a||t[6]!==o?(s=(0,Y.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[a,i,o]}),t[4]=i,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function Qn(e=!1){return B(`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 $n(e){let t=(0,Yt.c)(10),{label:n,value:r,mono:i}=e,a=i===void 0?!1:i,o;t[0]===n?o=t[1]:(o=(0,Y.jsx)(`div`,{className:`text-xs font-medium text-fg-subtle`,children:n}),t[0]=n,t[1]=o);let s=a&&`font-mono text-xs`,c;t[2]===s?c=t[3]:(c=B(`mt-1 min-w-0 truncate text-sm text-fg`,s),t[2]=s,t[3]=c);let l;t[4]!==c||t[5]!==r?(l=(0,Y.jsx)(`div`,{className:c,title:r,children:r}),t[4]=c,t[5]=r,t[6]=l):l=t[6];let u;return t[7]!==o||t[8]!==l?(u=(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-md bg-surface-base px-3 py-2`,children:[o,l]}),t[7]=o,t[8]=l,t[9]=u):u=t[9],u}function er(e){return[e.name,e.slug,e.workspaceRoot,e.description,e.brief].filter(Boolean).join(` `).toLowerCase()}function tr(e){let t=e.lastActiveAt??e.updatedAt??e.createdAt,n=t?new Date(t).getTime():0;return Number.isFinite(n)?n:0}function nr(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function rr(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function ir(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 ar(e){return e.primaryObject.title?.trim()||e.primaryObject.id}function or(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 sr(e){let t=e.sourceChannel?.trim();if(t)return cr(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 cr(r||``)}function cr(e){let t=e.trim().toLowerCase();return t?t===`tui`?`TUI`:t===`acp`?`ACP`:t===`webchat`?`Webchat`:t:``}function lr(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 ur(e){return e.map(e=>({fileId:e.fileId,name:e.name,path:e.path,isDirectory:e.type===`directory`,children:e.type===`directory`?[]:void 0}))}function dr(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:dr(e.children,t,n)}:e)}function fr({currentProject:e,pm:t,projectsText:n,wd:r}){let i=a(),[o,s]=(0,J.useState)(!1),[l,y]=(0,J.useState)([e]),[b,x]=(0,J.useState)(``),[C,T]=(0,J.useState)(!1),[E,D]=(0,J.useState)(null),[O,k]=(0,J.useState)(!1),[A,j]=(0,J.useState)(`new`),[P,F]=(0,J.useState)(``),[I,L]=(0,J.useState)(``),[R,z]=(0,J.useState)(!1),[H,U]=(0,J.useState)(null),[W,G]=(0,J.useState)(null),ee=(0,J.useCallback)(async()=>{T(!0),D(null);try{let t=await Ae({limit:100});y(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){D(e instanceof Error?e.message:String(e))}finally{T(!1)}},[e]);(0,J.useEffect)(()=>{y(t=>[e,...t.filter(t=>t.id!==e.id)])},[e]),(0,J.useEffect)(()=>{o&&ee()},[ee,o]);let te=(0,J.useMemo)(()=>{let t=b.trim().toLowerCase().split(/\s+/).filter(Boolean);return l.filter(t=>t.id!==e.id).filter(e=>{if(t.length===0)return!0;let n=er(e);return t.every(e=>n.includes(e))}).sort((e,t)=>tr(t)-tr(e))},[e.id,l,b]),ne=e=>t.statuses[e.status]??e.status,K=e=>e.workspaceRoot||e.effectiveWorkspaceRoot||e.description||e.brief||t.common.defaultWorkspace,re=e=>{j(e),F(``),L(``),U(null),k(!0),s(!1)},ie=(0,J.useCallback)(async(e={})=>{let t=I.trim(),n=P.trim()||(A===`directory`?nr(t):``);if(n){z(!0),U(null),G(null);try{let r=await et({name:n,...t?{workspaceRoot:t}:{},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});k(!1),F(``),L(``),y(e=>[r,...e.filter(e=>e.id!==r.id)]),i(`/projects/${encodeURIComponent(r.id)}`)}catch(e){let t=rr(e);t?(G(t),k(!1)):U(e instanceof Error?e.message:String(e))}finally{z(!1)}}},[A,P,i,I]),ae=(0,J.useCallback)(e=>{e.preventDefault(),ie()},[ie]),q=(0,J.useCallback)(()=>{ie({createWorkspaceRoot:!0})},[ie]),oe=(0,J.useCallback)(()=>{G(null),k(!0)},[]),se=e=>{L(e),A===`directory`&&!P.trim()&&F(nr(e))},ce=(e,t)=>(0,Y.jsxs)(`button`,{type:`button`,className:B(`grid w-full grid-cols-[1rem_minmax(0,1fr)_auto] items-center gap-2 rounded-md p-2 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,t&&`bg-accent-soft/55 hover:bg-accent-soft/70`),onClick:()=>{s(!1),t||i(`/projects/${encodeURIComponent(e.id)}`)},children:[(0,Y.jsx)(g,{className:B(`size-4 text-accent-fg`,!t&&`invisible`),"aria-hidden":!0}),(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.name}),(0,Y.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:K(e)})]}),(0,Y.jsx)(`span`,{className:B(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,Xn(e.status)),children:ne(e)})]},e.id);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(v,{open:o,onOpenChange:s,children:[(0,Y.jsx)(w,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,className:`group flex max-w-full min-w-0 items-center gap-2 rounded-lg px-2 py-1 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":t.projectSwitcher.switchProject,title:t.projectSwitcher.switchProject,children:[(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:e.name}),(0,Y.jsx)(`span`,{className:B(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,Xn(e.status)),children:ne(e)})]}),(0,Y.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:K(e)})]}),(0,Y.jsx)(ge,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":!0})]})}),(0,Y.jsx)(_,{children:(0,Y.jsxs)(S,{side:`bottom`,align:`start`,sideOffset:6,className:`z-[70] w-[min(26rem,calc(100vw-2rem))] overflow-hidden rounded-xl border border-edge bg-surface-panel p-1.5 shadow-popover outline-none`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Y.jsxs)(`label`,{className:`relative block`,children:[(0,Y.jsx)(N,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`input`,{type:`search`,className:`h-9 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:b,onChange:e=>x(e.target.value),placeholder:t.projectSwitcher.searchPlaceholder,"aria-label":t.projectSwitcher.searchPlaceholder})]}),(0,Y.jsxs)(`div`,{className:`mt-1 max-h-[min(54vh,24rem)] overflow-y-auto pr-0.5 [scrollbar-gutter:stable]`,children:[(0,Y.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.current}),ce(e,!0),(0,Y.jsx)(`div`,{className:`px-2 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.recent}),E?(0,Y.jsx)(`div`,{className:`p-2 text-xs text-red-600 dark:text-red-400`,children:E}):null,C&&te.length===0?(0,Y.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.loading}):null,!C&&te.length===0?(0,Y.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.noMatches}):null,te.map(e=>ce(e,!1))]}),(0,Y.jsxs)(`div`,{className:`mt-1 border-t border-edge-subtle pt-1`,children:[(0,Y.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>re(`new`),children:[(0,Y.jsx)(M,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.newProject})]}),(0,Y.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>re(`directory`),children:[(0,Y.jsx)(_t,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.openDirectory})]}),(0,Y.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>{s(!1),i(`/projects`)},children:[(0,Y.jsx)(me,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.manageProjects})]})]})]})})]}),(0,Y.jsx)(h,{open:O,onOpenChange:e=>!R&&k(e),children:(0,Y.jsxs)(f,{children:[(0,Y.jsx)(c,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(p,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(32rem,calc(100vh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(m,{className:`text-base font-semibold text-fg`,children:A===`directory`?t.projectSwitcher.createFromDirectoryTitle:n.createTitle}),(0,Y.jsx)(u,{className:`mt-1 text-sm text-fg-muted`,children:A===`directory`?t.projectSwitcher.createFromDirectoryDescription:n.createDescription})]}),(0,Y.jsxs)(`form`,{onSubmit:ae,className:`flex min-h-0 flex-1 flex-col`,children:[(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[H?(0,Y.jsx)(`div`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:H}):null,(0,Y.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.projectName}),(0,Y.jsx)(`input`,{className:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:P,onChange:e=>F(e.target.value),placeholder:`xopc`})]}),(0,Y.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.workspaceRoot}),(0,Y.jsx)(Zt,{value:I,onChange:se,disabled:R,wd:r,placeholder:n.workspacePlaceholder,inputClassName:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`}),(0,Y.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.workspaceHint})]})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(d,{asChild:!0,children:(0,Y.jsx)(V,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:R,children:n.cancel})}),(0,Y.jsxs)(V,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:R||!(P.trim()||A===`directory`&&nr(I)),children:[(0,Y.jsx)(M,{className:`size-4`,"aria-hidden":!0}),n.create]})]})]})]})]})}),(0,Y.jsx)(h,{open:!!W,onOpenChange:e=>{e||G(null)},children:(0,Y.jsxs)(f,{children:[(0,Y.jsx)(c,{className:`fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(p,{className:`fixed left-1/2 top-1/2 z-[110] flex w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(m,{className:`text-base font-semibold text-fg`,children:n.workspaceMissingTitle}),(0,Y.jsx)(u,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:W?Jn(n.workspaceMissingDescription,{workspace:W}):null})]}),W?(0,Y.jsx)(`div`,{className:`px-5 py-4`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,Y.jsx)(_t,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:W})]})}):null,(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(V,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:oe,disabled:R,children:n.workspaceMissingBack}),(0,Y.jsxs)(V,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:q,disabled:R,children:[(0,Y.jsx)(tt,{className:`size-4`,"aria-hidden":!0}),n.workspaceMissingCreate]})]})]})]})})]})}function pr(){let{projectId:e=``,tabId:t,noteId:n}=i(),r=a(),[l]=o(),g=R(e=>e.language),_=I(g),v=_.chat.workingDirectory,b=_.projectDetailPage,S=_.projectsPage,C=dt(e=>e.setPageHeader),w=dt(e=>e.clearPageHeader),[T,D]=(0,J.useState)(null),[O,L]=(0,J.useState)(null),[z,H]=(0,J.useState)([]),[W,ne]=(0,J.useState)(``),[K,ae]=(0,J.useState)([]),[ce,ue]=(0,J.useState)(0),[de,fe]=(0,J.useState)(!1),[ge,ve]=(0,J.useState)(!1),[ye,Ce]=(0,J.useState)(!1),[we,De]=(0,J.useState)([]),[Oe,Ae]=(0,J.useState)(null),Le=(0,J.useRef)(new Set),[Re,$e]=(0,J.useState)(null),[et,rt]=(0,J.useState)(null),[st,ft]=(0,J.useState)(Gn),[vt,Tt]=(0,J.useState)(!1),[Ot,At]=(0,J.useState)(!1),[Mt,Lt]=(0,J.useState)(``),[Rt,zt]=(0,J.useState)([]),[Bt,Vt]=(0,J.useState)(!1),[Ht,Ut]=(0,J.useState)(null),[Gt,Kt]=(0,J.useState)(!1),[qt,Jt]=(0,J.useState)(null),[Yt,Xt]=(0,J.useState)([]),[Qt,$t]=(0,J.useState)(``),[en,tn]=(0,J.useState)(!0),[nn,rn]=(0,J.useState)(!1),[an,sn]=(0,J.useState)(!1),[cn,ln]=(0,J.useState)(null),[un,dn]=(0,J.useState)(!1),[fn,pn]=(0,J.useState)(`fixed`),[mn,hn]=(0,J.useState)(``),[gn,_n]=(0,J.useState)(null),[vn,yn]=(0,J.useState)(!1),[bn,xn]=(0,J.useState)(!1),[Sn,Cn]=(0,J.useState)(null),wn=(0,J.useRef)(null),Tn=(0,J.useRef)(!1),[En,X]=(0,J.useState)(null),[Dn,On]=(0,J.useState)({title:``,reason:``}),[Z,kn]=(0,J.useState)({name:``,description:``,status:`active`,defaultAgentId:``,executionMode:`local_checkout`,workspaceRoot:``,brief:``,instructions:``}),An=(0,J.useRef)(Z),jn=`overview`,Q=n?`notes`:qn(t)?t:jn,Mn=(0,J.useMemo)(()=>k(l.get(`returnTo`),`/projects`,[`/chat`]),[l]),Nn=(0,J.useCallback)(t=>{if(!e)return`/projects`;let n=`/projects/${encodeURIComponent(e)}/${t}`;return Mn===`/projects`?n:A(n,Mn)},[Mn,e]),Pn=(0,J.useCallback)(t=>{e&&r(Nn(t))},[r,e,Nn]),Fn=(0,J.useCallback)(()=>{if(Q===`tasks`&&wn.current){wn.current.openCreate();return}Tn.current=!0,Pn(`tasks`)},[Pn,Q]);(0,J.useEffect)(()=>{Q!==`tasks`||!Tn.current||(Tn.current=!1,wn.current?.openCreate())},[Q]);let In=(0,J.useCallback)(t=>{e&&r(Nn(t),{replace:!0})},[r,e,Nn]),Ln=(0,J.useCallback)(e=>t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||In(e)},[In]),zn=(0,J.useCallback)(e=>e.startsWith(`/chat/`)?`sessions`:e.startsWith(`/notes`)?`notes`:Q,[Q]);(0,J.useEffect)(()=>{!e||!t||qn(t)||r(Nn(jn),{replace:!0})},[jn,r,e,Nn,t]),(0,J.useEffect)(()=>{if(!e)return;let t=!1;return tn(!0),X(null),Promise.all([kt(e),ke(e),wt(e),ht().catch(()=>null),ie(e).catch(()=>null)]).then(([e,n,r,i,a])=>{if(t)return;D(e),L(n),H(r),Ae(a),Xt(i?.agents??[]),$t(e.defaultAgentId??``);let o={name:e.name,description:e.description??``,status:e.status,defaultAgentId:e.defaultAgentId??``,executionMode:e.executionMode,workspaceRoot:e.workspaceRoot??``,brief:e.brief??``,instructions:e.instructions??``};An.current=o,kn(o)}).catch(e=>{t||(Ae(null),X(e instanceof Error?e.message:String(e)))}).finally(()=>{t||tn(!1)}),()=>{t=!0}},[e]);let $=(0,J.useCallback)(async()=>{e&&L(await ke(e))},[e]);(0,J.useEffect)(()=>{let t,n=n=>{let r=St.safeParse(n.detail);!r.success||r.data.projectId!==e||(window.clearTimeout(t),t=window.setTimeout(()=>void $(),120))},r=n=>{let r=Je.safeParse(n.detail);!r.success||r.data.projectId!==e||(window.clearTimeout(t),t=window.setTimeout(()=>void $(),120))};return window.addEventListener(`task-changed-v2`,n),window.addEventListener(`task-deleted-v1`,r),()=>{window.clearTimeout(t),window.removeEventListener(`task-changed-v2`,n),window.removeEventListener(`task-deleted-v1`,r)}},[e,$]);let Bn=(0,J.useCallback)(async(e,t)=>{Cn(e.id),X(null);try{let n=await ze(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 Ie(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 le(e.id,r,n.task.version),await $(),!0}catch(e){return await $().catch(()=>void 0),X(e instanceof Error?e.message:b.board.actionFailed),!1}finally{Cn(null)}},[O,b.board.actionFailed,$]),Vn=(0,J.useCallback)(async t=>{e&&(X(null),await he({idempotencyKey:t.requestId,title:t.objective,projectId:e,priority:t.priority,dueAt:t.dueAt,locale:g,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 $())},[g,e,$]),Hn=(0,J.useCallback)(async(e,t)=>{Cn(e),X(null);try{return await He(e,t,(await ze(e)).task.version),await $(),!0}catch(e){return await $().catch(()=>void 0),X(e instanceof Error?e.message:b.board.actionFailed),!1}finally{Cn(null)}},[b.board.actionFailed,$]),er=(0,J.useCallback)(async(e,t,n)=>{Cn(e),X(null);try{let r=await ze(e);return r.task.phase!==t&&(r=await le(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 He(e,n,r.task.version),await $(),!0}catch(e){return await $().catch(()=>void 0),X(e instanceof Error?e.message:b.board.actionFailed),!1}finally{Cn(null)}},[b.board.actionFailed,$]),tr=(0,J.useCallback)(async(e,t)=>{Cn(e),X(null);try{await pt(e,t,(await ze(e)).task.version),await $()}catch(e){await $().catch(()=>void 0),X(e instanceof Error?e.message:b.board.actionFailed)}finally{Cn(null)}},[b.board.actionFailed,$]),nr=(0,J.useCallback)(async t=>{if(e){X(null);try{await _e(e,t),await $()}catch(e){throw X(e instanceof Error?e.message:b.board.actionFailed),e}}},[b.board.actionFailed,e,$]),cr=(0,J.useCallback)(async()=>{if(T){fe(!0),X(null);try{let e=await Ue(T.id,{includeRelated:ge,limit:100});ae(e.items),ue(e.total)}catch(e){X(e instanceof Error?e.message:String(e))}finally{fe(!1)}}},[T,ge]);(0,J.useEffect)(()=>{Q===`progress`&&cr()},[cr,Q]);let pr=(0,J.useCallback)(async()=>{if(!T?.effectiveWorkspaceRoot?.trim()){De([]),Le.current.clear(),Jt(null);return}Kt(!0),Jt(null),Le.current.clear();try{De(ur((await Dt(T.id,``)).entries)),Le.current.add(``)}catch(e){De([]),Le.current.clear(),Jt(e instanceof Error?e.message:String(e))}finally{Kt(!1)}},[T]),mr=(0,J.useCallback)(async e=>{if(!(!T?.effectiveWorkspaceRoot?.trim()||Le.current.has(e))){Le.current.add(e),Jt(null);try{let t=await Dt(T.id,e);De(n=>dr(n,e,ur(t.entries)))}catch(t){Le.current.delete(e),Jt(t instanceof Error?t.message:String(t))}}},[T]);(0,J.useEffect)(()=>{Q===`files`&&pr()},[pr,Q]);let hr=Mt.trim();(0,J.useEffect)(()=>{if(Q!==`files`||!T||!Ot||!hr){zt([]),Vt(!1),Ut(null);return}let e=!1;Vt(!0),Ut(null),zt([]);let t=window.setTimeout(()=>{at(T.id,hr,50).then(t=>{e||zt(t)}).catch(t=>{e||Ut(t instanceof Error?t.message:String(t))}).finally(()=>{e||Vt(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[hr,T,Ot,Q]);let gr=(0,J.useCallback)(async()=>{if(!T)return;let[e,t]=await Promise.all([kt(T.id),ke(T.id)]);L(t),D(e)},[T]),_r=(0,J.useCallback)(async e=>{if(e.preventDefault(),!(!T||!Dn.title.trim())){xn(!0),X(null);try{await Qe(T.id,{title:Dn.title.trim(),reason:Dn.reason.trim()||void 0}),On({title:``,reason:``}),await gr()}catch(e){X(e instanceof Error?e.message:String(e))}finally{xn(!1)}}},[Dn.reason,Dn.title,T,gr]),vr=(0,J.useMemo)(()=>(0,Y.jsx)(s,{to:Mn,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":Mn===`/projects`?b.backToProjects:_.sidebar.back,children:(0,Y.jsx)(Xe,{className:`size-4`,"aria-hidden":!0})}),[Mn,_.sidebar.back,b.backToProjects]),yr=(0,J.useMemo)(()=>T?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(V,{asChild:!0,variant:`secondary`,className:`h-9 rounded-lg`,children:(0,Y.jsxs)(s,{to:`/workflows?tab=library&projectId=${encodeURIComponent(T.id)}`,children:[(0,Y.jsx)(bt,{className:`size-4`,"aria-hidden":!0}),b.common.runWorkflow]})}),(0,Y.jsxs)(V,{variant:`secondary`,className:`h-9 rounded-lg`,onClick:Fn,children:[(0,Y.jsx)(M,{className:`size-4`,"aria-hidden":!0}),b.board.create]}),(0,Y.jsx)(V,{asChild:!0,variant:`primary`,className:`h-9 rounded-lg`,children:(0,Y.jsxs)(s,{to:Me(T.id),state:{forceNewChat:!0,agentId:T.defaultAgentId},onClick:Ln(`sessions`),children:[(0,Y.jsx)(j,{className:`size-4`,"aria-hidden":!0}),b.common.newChat]})})]}):null,[Fn,Ln,b.board.create,b.common.newChat,b.common.runWorkflow,T]);(0,J.useLayoutEffect)(()=>(C({startExtra:vr,main:T?(0,Y.jsx)(fr,{currentProject:T,pm:b,projectsText:S,wd:v}):(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:b.fallbackTitle}),(0,Y.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:b.fallbackContext})]}),end:yr}),()=>w()),[w,yr,vr,b,T,S,C,v]);function br(e){D(t=>t?{...t,...e}:null),$t(e.defaultAgentId??``),ie(e.id).then(Ae).catch(()=>Ae(null)),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}async function xr(e=An.current){if(!(!T||!Un(e,T))){X(null),ln(null);try{let t=await nt(T.id,{name:e.name.trim(),status:e.status,description:e.description,defaultAgentId:e.defaultAgentId,executionMode:e.executionMode,brief:e.brief,instructions:e.instructions});br(t);let n=An.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,executionMode:n.executionMode===e.executionMode?t.executionMode:n.executionMode,brief:n.brief===e.brief?t.brief??``:n.brief,instructions:n.instructions===e.instructions?t.instructions??``:n.instructions};An.current=r,kn(r)}catch(e){let t=rr(e);throw t?ln(t):X(e instanceof Error?e.message:String(e)),e}}}function Sr(e){e.preventDefault(),Ir.flush()}function Cr(e,t=!1){let n={...An.current,...e};An.current=n,kn(n),t&&Ir.saveNow(n)}let wr=(0,J.useCallback)(()=>{if(!T)return;let e=T.workspaceRoot?.trim()??``;pn(e?`fixed`:`follow`),hn(e||T.effectiveWorkspaceRoot||``),dn(!0)},[T]);async function Tr(e={}){if(!T)return;let t=fn===`fixed`?mn.trim():``;if(!(fn===`fixed`&&!t)){rn(!0),X(null),ln(null);try{let n=await nt(T.id,{workspaceRoot:t,...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});br(n),Cr({workspaceRoot:n.workspaceRoot??``}),dn(!1),ln(null)}catch(e){let t=rr(e);t?(ln(t),dn(!1)):X(e instanceof Error?e.message:String(e))}finally{rn(!1)}}}async function Er(){if(!(!T||gn)){_n(`pin`),X(null);try{br(T.pinnedAt?await te(T.id):await oe(T.id))}catch(e){X(e instanceof Error?e.message:String(e))}finally{_n(null)}}}async function Dr(){if(!(!T||gn)){_n(`archive`),X(null);try{let e=T.status===`archived`?await q(T.id):await ct(T.id);br(e),Cr({status:e.status})}catch(e){X(e instanceof Error?e.message:String(e))}finally{_n(null)}}}async function Or(){if(T){yn(!0),X(null);try{await Ct(T.id),sn(!1),r(`/projects`)}catch(e){X(e instanceof Error?e.message:String(e))}finally{yn(!1)}}}async function kr(){if(!(!T||ye)){Ce(!0),X(null);try{await Se(T.id)}catch(e){X(e instanceof Error?e.message:String(e))}finally{Ce(!1)}}}let Ar=(0,J.useCallback)(e=>{$e(e)},[]),jr=(0,J.useCallback)((e,t)=>{t||$e(e)},[]),Mr=(0,J.useCallback)(async(e,t,n)=>{let r=T?.id;if(r)switch(e){case`preview`:t.isDirectory||$e(t.path);break;case`download`:if(t.isDirectory)return;try{let e=pe(t.path);if(Pe(mt(e))!==`text`){let n=await G(t.path,{projectId:r}),i=je(e)??`application/octet-stream`;Be(e,await n.arrayBuffer(),i)}else{let{content:n}=await Ye(t.path,{projectId:r});Te(e,n)}}catch(e){ot(`warning`,e instanceof Error?e.message:String(e),void 0,{duration:4e3})}break;case`copyPath`:try{await F(t.path)&&ot(`success`,_.workspace.pathCopied,void 0,{duration:2500})}catch{ot(`warning`,_.clipboard.copyFailed,void 0,{duration:4e3})}break;case`openDefault`:await xe(()=>window.electronAPI?.shell?.openFileResource?.(t.fileId),_.workspace.openFileFailed);break;case`openWith`:await xe(()=>window.electronAPI?.shell?.chooseAppAndOpenFileResource?.(t.fileId),_.workspace.openFileFailed);break;case`openWithApp`:if(!n)return;await xe(()=>window.electronAPI?.shell?.openFileResourceWithApp?.(t.fileId,n),_.workspace.openFileFailed);break;case`revealInFolder`:await xe(()=>window.electronAPI?.shell?.showFileResourceInFolder?.(t.fileId),_.workspace.revealFileFailed);break;case`trash`:rt(t);break;default:break}},[_.clipboard.copyFailed,_.workspace.openFileFailed,_.workspace.pathCopied,_.workspace.revealFileFailed,T?.id]),Nr=(0,J.useCallback)(async()=>{let e=et;if(!e)return;let t=await window.electronAPI?.shell?.trashFileResource?.(e.fileId);if(!t?.ok){ot(`warning`,t?.error??_.workspace.trashFailed,void 0,{duration:4e3});return}Re===e.path&&$e(null),rt(null),await pr(),ot(`success`,_.workspace.trashSuccess,void 0,{duration:2500})},[_.workspace.trashFailed,_.workspace.trashSuccess,et,Re,pr]),Pr=(0,J.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;e.preventDefault();let t=e.currentTarget,n=t.closest(`[data-project-files-grid]`);if(!n)return;t.setPointerCapture(e.pointerId),Tt(!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=Wn(i+(e.clientX-r)),o===0&&(o=window.requestAnimationFrame(l))},d=()=>{o!==0&&(window.cancelAnimationFrame(o),l());try{t.releasePointerCapture(a)}catch{}Tt(!1),ft(c),Kn(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,J.useEffect)(()=>{Q!==`files`&&$e(null)},[e,Q]);let Fr=!!(T&&Un(Z,T)),Ir=Ft({value:T?Z:null,dirty:Fr,onSave:xr,validate:e=>e.name.trim()?null:b.settings.nameRequired});if(en)return(0,Y.jsx)(`main`,{className:`w-full flex-1 p-3 text-sm text-fg-muted sm:px-5 sm:py-4 xl:px-6`,children:b.loading});if(!T)return(0,Y.jsxs)(`main`,{className:`w-full flex-1 p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,Y.jsxs)(s,{to:Mn,className:`inline-flex items-center gap-2 text-sm text-accent-fg hover:underline`,children:[(0,Y.jsx)(Xe,{className:`size-4`,"aria-hidden":!0}),Mn===`/projects`?b.backToProjects:_.sidebar.back]}),(0,Y.jsx)(`p`,{className:`mt-6 rounded-lg bg-surface-panel p-4 shadow-surface text-sm text-fg-muted`,children:En||b.notFound})]});let Lr=z.slice(0,6),Rr=O?.blockers??[],zr=O?.tasks.filter(e=>e.phase!==`closed`)??[],Br=e=>b.statuses[e]??e,Vr=e=>Jn(b.common.messages,{count:e}),Hr=W.trim().toLowerCase(),Ur=Hr?z.filter(e=>{let t=Yn(e.updatedAt),n=e.routing?.agentId||e.agentId||b.common.agent,r=e.name?.trim()||b.sessions.fallbackTitle,i=Vr(e.messageCount??0),a=sr(e);return[r,e.key,n,a,t,i].filter(Boolean).join(` `).toLowerCase().includes(Hr)}):z,Wr=z.length>0&&Ur.length===0,Gr=Yt.find(e=>e.id===T.defaultAgentId)?.name||T.defaultAgentId||b.settings.globalDefaultAgent,Kr=Yt.find(e=>e.id===Z.defaultAgentId),qr=T.workspaceRoot?.trim()||``,Jr=T.status===`archived`,Yr=!!T.pinnedAt,Xr=!qr,Zr=qr||Kr?.workspace||T.effectiveWorkspaceRoot||b.common.defaultWorkspace,Qr=fn===`fixed`?mn.trim()||b.settings.workspacePlaceholder:Kr?.workspace||T.effectiveWorkspaceRoot||b.common.defaultWorkspace,$r=(fn===`fixed`?mn.trim():``)!==qr&&(fn===`follow`||!!mn.trim()),ei=[{id:`overview`,icon:jt,label:b.tabs.overview},{id:`tasks`,icon:Ve,label:b.tabs.tasks},{id:`automations`,icon:Ze,label:b.tabs.automations},{id:`files`,icon:_t,label:b.tabs.files},{id:`notes`,icon:Ge,label:b.tabs.notes},{id:`skills`,icon:re,label:b.tabs.skills},{id:`sessions`,icon:j,label:b.tabs.sessions},{id:`progress`,icon:Fe,label:b.tabs.progress}];async function ti(){if(!Zr)return;let e=await F(Zr);ot(e?`success`:`warning`,e?_.workspace.pathCopied:_.clipboard.copyFailed,void 0,{duration:e?2500:4e3})}function ni(){ln(null),dn(!0)}return(0,Y.jsxs)(`main`,{className:`flex h-full min-h-0 w-full flex-1 flex-col overflow-hidden p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3`,children:[(0,Y.jsx)(It,{items:ei,activeTab:Q,onChange:Pn,ariaLabel:b.navAria,tabIdPrefix:`project-primary-tab`,className:`min-w-0 flex-1`}),(0,Y.jsxs)(V,{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:()=>Pn(`settings`),children:[(0,Y.jsx)(me,{className:`size-4`,"aria-hidden":!0}),b.tabs.settings,Fr?(0,Y.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500`,"aria-label":b.settings.unsavedChanges}):null]})]}),En?(0,Y.jsx)(`p`,{className:`mt-3 shrink-0 rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:En}):null,(0,Y.jsxs)(`div`,{className:B(`mt-3 min-h-0 flex-1`,Q===`overview`?`overflow-y-auto pr-1 [scrollbar-gutter:stable] xl:overflow-hidden xl:pr-0`:Q===`tasks`?`overflow-hidden`:`overflow-y-auto pr-1 [scrollbar-gutter:stable]`),children:[Q===`overview`?(0,Y.jsxs)(`section`,{id:`project-panel-overview`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-overview`,className:`grid min-h-full gap-4 xl:h-full xl:min-h-0 xl:grid-cols-[minmax(0,1fr)_20rem] xl:overflow-hidden`,children:[(0,Y.jsxs)(`div`,{className:`grid min-w-0 content-start gap-4 xl:min-h-0 xl:overflow-y-auto xl:pr-1 xl:[scrollbar-gutter:stable]`,children:[(0,Y.jsx)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:b.overview.directionTitle}),(0,Y.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:T.outcome||O?.digest.summary||T.description||T.brief||b.overview.directionFallback}),O?.digest.recommendedAction?(0,Y.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm font-medium leading-6 text-fg`,children:Jn(b.overview.recommendedNext,{action:O.digest.recommendedAction})}):null]}),(0,Y.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:(0,Y.jsxs)(V,{type:`button`,variant:`secondary`,onClick:()=>void kr(),disabled:ye,children:[(0,Y.jsx)(Ee,{className:`size-4`,"aria-hidden":!0}),ye?b.overview.savingDigest:b.overview.saveDigest]})})]})}),(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,Y.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:b.overview.nextActions})}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:zr.length?zr.map(e=>(0,Y.jsxs)(s,{to:Ke(Nn(`overview`),e.id),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,Y.jsxs)(`span`,{className:`shrink-0 rounded-full bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:[e.phase,` · `,e.operationalState]})]}),e.attention[0]?(0,Y.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.attention[0].summary}):null]},e.id)):(0,Y.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:b.overview.noNextActions})})]}),O?.recentResults.length?(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,Y.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:b.overview.recentResults})}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:O.recentResults.slice(0,5).map(({taskId:e,taskTitle:t,receipt:n})=>(0,Y.jsxs)(s,{to:Ke(Nn(`overview`),e),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),(0,Y.jsxs)(`span`,{className:`shrink-0 rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:[n.status,` · `,n.verification.status]})]}),(0,Y.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:n.summary})]},n.runId))})]}):null,(0,Y.jsxs)(`div`,{className:`grid min-w-0 gap-4 md:grid-cols-2`,children:[(0,Y.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Y.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:b.overview.milestones})}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:T.milestones.length?T.milestones.map(e=>(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-4 py-3`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,Y.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:e.status})]},e.id)):(0,Y.jsx)(`p`,{className:`px-4 py-5 text-sm text-fg-muted`,children:b.overview.noMilestones})})]}),(0,Y.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Y.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:b.overview.projectUpdates})}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:T.recentUpdates.length?T.recentUpdates.slice(0,3).map(e=>(0,Y.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,Y.jsx)(`p`,{className:`text-sm leading-5 text-fg`,children:e.summary}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.health})]},e.id)):(0,Y.jsx)(`p`,{className:`px-4 py-5 text-sm text-fg-muted`,children:b.overview.noProjectUpdates})})]})]})]}),(0,Y.jsxs)(`aside`,{className:`grid min-w-0 content-start gap-4 xl:min-h-0 xl:overflow-y-auto xl:pr-1 xl:[scrollbar-gutter:stable]`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:b.overview.attention}),Rr.length?(0,Y.jsx)(`div`,{className:`mt-3 grid gap-3`,children:Rr.map(e=>{let t=(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(be,{className:`size-4 text-amber-600 dark:text-amber-300`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title})]}),(0,Y.jsxs)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:[b.overview.attentionKinds[e.kind]??e.kind,e.detail?` · ${e.detail}`:e.status?` · ${Br(e.status)}`:``]})]});return e.href?(0,Y.jsx)(s,{to:e.href,onClick:Ln(zn(e.href)),className:`min-w-0 rounded-md bg-surface-base p-3 hover:bg-surface-hover`,children:t},e.id):(0,Y.jsx)(`div`,{className:`min-w-0 rounded-md bg-surface-base p-3`,children:t},e.id)})}):(0,Y.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:b.overview.noBlockedTasks}),(0,Y.jsxs)(`form`,{onSubmit:_r,className:`mt-4 flex gap-2 border-t border-edge pt-4`,children:[(0,Y.jsx)(`input`,{className:`min-h-9 min-w-0 flex-1 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:Dn.title,onChange:e=>On(t=>({...t,title:e.target.value})),placeholder:b.overview.blockerTitlePlaceholder}),(0,Y.jsx)(V,{type:`submit`,variant:`secondary`,className:`shrink-0 rounded-lg px-3`,disabled:bn||!Dn.title.trim(),"aria-label":bn?b.overview.addingBlocker:b.overview.addBlocker,title:bn?b.overview.addingBlocker:b.overview.addBlocker,children:(0,Y.jsx)(M,{className:`size-4`,"aria-hidden":!0})})]})]}),(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(We,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:b.overview.recentSessions})]}),(0,Y.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>Pn(`sessions`),children:b.common.viewAll})]}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:Lr.length?Lr.map(e=>(0,Y.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Ln(`sessions`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.name||e.key}),(0,Y.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:Yn(e.updatedAt)})]}),(0,Y.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:e.agentId||b.common.agent})]},e.key)):(0,Y.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:b.overview.noSessions})})]})]})]}):null,Q===`tasks`?(0,Y.jsx)(Rn,{ref:wn,tasks:O?.tasks??[],dependencyEdges:O?.dependencyEdges??[],monitoring:O?.monitoring??{projectId:e??``,mode:`observe`,allowedActions:[],confidenceThreshold:.75,scenarios:[],configured:!1},returnTo:Nn(`tasks`),copy:b.board,onAction:Bn,onReorder:Hn,onUndoMove:er,onDependenciesChange:tr,onMonitoringChange:nr,onCreate:Vn,actionBusyId:Sn}):null,Q===`automations`?(0,Y.jsx)(`section`,{id:`project-panel-automations`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-automations`,className:`grid min-h-full content-start gap-4`,children:(0,Y.jsx)(Wt,{projectId:T.id,embedded:!0,title:b.automations.title,subtitle:b.automations.hint})}):null,Q===`notes`?(0,Y.jsx)(`section`,{id:`project-panel-notes`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-notes`,className:`flex h-full min-h-[28rem] overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:(0,Y.jsx)(Nt,{selectedNoteId:n,basePath:`/projects/${encodeURIComponent(T.id)}/notes`,showLibrary:!1,allowMediaCapture:!1,projectId:T.id,listTitle:b.notes.title,listDescription:b.notes.hint,emptyText:b.notes.emptyTitle,emptyDescription:b.notes.emptyDescription,listWidthStorageKey:`xopc.projectNotes.listWidth.${T.id}`})}):null,Q===`skills`?(0,Y.jsx)(on,{projectId:T.id,copy:b.skills}):null,Q===`files`?(0,Y.jsx)(`section`,{id:`project-panel-files`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-files`,className:`flex h-full min-h-[28rem] flex-col`,children:(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:T.effectiveWorkspaceRoot?(0,Y.jsxs)(`div`,{"data-project-files-grid":!0,className:B(`grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[var(--project-files-panel-width)_6px_minmax(0,1fr)]`,vt&&`cursor-col-resize select-none`),style:{"--project-files-panel-width":`${st}px`},children:[(0,Y.jsxs)(`aside`,{className:`flex min-h-0 flex-col border-b border-edge lg:border-b-0 lg:border-r`,children:[(0,Y.jsxs)(`div`,{className:`flex h-11 items-center gap-1 border-b border-edge bg-surface-muted/50 px-3 text-sm`,children:[Oe?(0,Y.jsx)(it,{resourceId:Oe.fileId,displayName:Oe.name}):null,(0,Y.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,Y.jsx)(`button`,{type:`button`,className:B(`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,Ot&&`bg-surface-hover text-fg`),onClick:()=>At(!0),"aria-label":b.files.search,title:b.files.search,"aria-pressed":Ot,children:(0,Y.jsx)(N,{className:`size-3.5`,"aria-hidden":!0})}),(0,Y.jsx)(lt,{className:`size-7 shrink-0 rounded-md p-0`,loading:Gt,label:_.cron.refresh,onClick:()=>void pr()})]})]}),Ot?(0,Y.jsx)(`div`,{className:`shrink-0 border-b border-edge bg-surface-muted/40 px-3 py-2`,children:(0,Y.jsxs)(`div`,{className:`flex h-8 items-center gap-2 rounded-md border border-edge bg-surface-panel px-2 focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/20`,children:[(0,Y.jsx)(N,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`input`,{type:`text`,role:`searchbox`,value:Mt,onChange:e=>Lt(e.target.value),placeholder:b.files.searchPlaceholder,"aria-label":b.files.searchPlaceholder,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none placeholder:text-fg-subtle`}),(0,Y.jsx)(`button`,{type:`button`,className:`flex size-6 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":b.files.clearSearch,title:b.files.clearSearch,onClick:()=>{Lt(``),At(!1)},children:(0,Y.jsx)(P,{className:`size-3.5`,"aria-hidden":!0})})]})}):null,qt?(0,Y.jsx)(`div`,{className:`border-b border-edge bg-red-500/10 px-4 py-3 text-sm text-red-700 dark:text-red-300`,children:qt}):null,hr?(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-2`,children:Bt?(0,Y.jsxs)(`div`,{className:`space-y-2 px-3 py-1`,children:[(0,Y.jsx)(U,{className:`h-11 w-full`}),(0,Y.jsx)(U,{className:`h-11 w-full`}),(0,Y.jsx)(U,{className:`h-11 w-full`})]}):Ht?(0,Y.jsxs)(`p`,{className:`px-3 py-2 text-xs text-red-600 dark:text-red-400`,children:[_.workspace.loadError,`: `,Ht]}):Rt.length===0?(0,Y.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:b.files.noSearchResults}):Rt.map(e=>(0,Y.jsxs)(`button`,{type:`button`,className:B(`flex w-full min-w-0 items-center gap-2 px-3 py-2 text-left hover:bg-surface-hover`,Re===e.path&&`bg-accent-soft text-accent-fg`),onClick:()=>$e(e.path),title:e.path,children:[(0,Y.jsx)(Ge,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`span`,{className:`block truncate text-sm text-fg`,children:e.name}),(0,Y.jsx)(`span`,{className:`block truncate text-xs text-fg-subtle`,children:e.path})]})]},e.path))}):Gt&&we.length===0?(0,Y.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:b.files.loading}):(0,Y.jsx)(yt,{tree:we,selectedPath:Re,onSelectFile:Ar,onSelectEntry:jr,onExpandDir:e=>void mr(e),onAction:Mr,actionLabels:{preview:_.workspace.preview,download:_.workspace.download,copyPath:_.workspace.copyPath,openDefault:_.workspace.openSystemApp,openDirectory:_.workspace.openInFileManager,openWith:_.workspace.openWith,revealInFolder:_.workspace.revealInFolder,trash:_.workspace.moveToTrash,recommendedApps:_.workspace.recommendedApps,desktopUpdateRequired:_.workspace.desktopUpdateRequired},emptyHint:b.files.emptyDirectory})]}),(0,Y.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":b.files.resizeHandle,className:B(`hidden cursor-col-resize touch-none items-stretch justify-center bg-surface-panel transition-colors hover:bg-surface-hover lg:flex`,vt&&`bg-surface-hover`),onPointerDown:Pr,children:(0,Y.jsx)(`div`,{className:`my-3 w-px rounded-full bg-edge-strong/70`})}),(0,Y.jsx)(`div`,{className:`min-h-0 min-w-0 overflow-hidden bg-surface-base`,children:Re?(0,Y.jsx)(Et,{filePath:Re,projectId:T.id,agentId:T.defaultAgentId||Qt||void 0,onClose:()=>$e(null)}):(0,Y.jsx)(`div`,{className:`flex h-full min-h-[18rem] items-center justify-center px-6 text-center`,children:(0,Y.jsxs)(`div`,{className:`max-w-sm`,children:[(0,Y.jsx)(_t,{className:`mx-auto size-8 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:b.files.previewEmptyTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:b.files.previewEmptyDescription})]})})})]}):(0,Y.jsxs)(`div`,{className:`grid gap-3 px-4 py-8 text-sm text-fg-muted`,children:[(0,Y.jsx)(`p`,{children:b.files.needWorkspace}),(0,Y.jsx)(`div`,{children:(0,Y.jsx)(V,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>Pn(`settings`),children:b.files.openSettings})})]})})}):null,Q===`sessions`?(0,Y.jsxs)(`section`,{id:`project-panel-sessions`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-sessions`,className:`grid min-h-full content-start gap-3`,children:[z.length?(0,Y.jsxs)(`label`,{className:`relative flex min-h-9 w-full max-w-lg cursor-text items-center rounded-lg bg-surface-panel py-1.5 pl-9 pr-9 shadow-surface`,children:[(0,Y.jsx)(N,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,"aria-hidden":!0}),(0,Y.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:W,onChange:e=>ne(e.currentTarget.value),placeholder:b.sessions.searchPlaceholder,"aria-label":b.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`}),W?(0,Y.jsx)(`button`,{type:`button`,className:`absolute right-2 top-1/2 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":b.sessions.clearSearch,onClick:()=>ne(``),children:(0,Y.jsx)(P,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,Ur.length?(0,Y.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:Ur.map(e=>{let t=Yn(e.updatedAt),n=e.routing?.agentId||e.agentId||b.common.agent,r=sr(e),i=e.name?.trim()||b.sessions.fallbackTitle,a=Vr(e.messageCount??0);return(0,Y.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Ln(`sessions`),className:`group flex min-h-[8.75rem] min-w-0 flex-col rounded-lg bg-surface-panel p-4 shadow-surface transition-colors hover:bg-surface-hover/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Y.jsx)(`span`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-base text-fg-muted`,children:(0,Y.jsx)(j,{className:`size-4`,"aria-hidden":!0})}),(0,Y.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-fg`,children:i}),r?(0,Y.jsx)(`span`,{className:`shrink-0 rounded-md bg-surface-base px-2 py-0.5 text-[11px] font-medium leading-5 text-fg-muted`,children:r}):null]})})]}),(0,Y.jsxs)(`div`,{className:`mt-auto grid gap-2 pt-4 text-xs text-fg-muted`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(`span`,{className:`min-w-0 max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[b.sessions.agent,`: `,n]}),(0,Y.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:a})]}),t?(0,Y.jsxs)(`span`,{className:`truncate rounded-md bg-surface-base px-2 py-1`,children:[b.sessions.updated,`: `,t]}):null]})]},e.key)})}):Wr?(0,Y.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:b.sessions.noMatches})}):(0,Y.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:b.sessions.emptyTitle}),(0,Y.jsx)(`p`,{className:`mx-auto mt-1 max-w-md text-sm leading-6 text-fg-muted`,children:b.sessions.emptyDescription})]})})]}):null,Q===`progress`?(0,Y.jsxs)(`section`,{id:`project-panel-progress`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-progress`,className:`grid min-h-full content-start gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:b.progress.title}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:Jn(b.progress.count,{count:ce})})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(`label`,{className:`inline-flex min-h-9 items-center gap-2 rounded-lg bg-surface-panel px-3 text-sm text-fg-muted shadow-surface`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:ge,onChange:e=>ve(e.currentTarget.checked),className:`size-4 rounded border-edge text-accent focus:ring-accent/30`}),b.progress.includeRelated]}),(0,Y.jsxs)(V,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3`,onClick:()=>void cr(),disabled:de,children:[(0,Y.jsx)(ee,{className:B(`size-4`,de&&`animate-spin`),"aria-hidden":!0}),b.common.refresh]})]})]}),(0,Y.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:de&&K.length===0?(0,Y.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:b.progress.loading}):K.length?(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:K.map(e=>{let t=b.progress.types[e.type]??e.type,n=b.progress.objectKinds[e.primaryObject.kind]??e.primaryObject.kind,r=lr(e),i=e.relatedProjects.length>0&&!e.scopes.some(e=>e.scopeKind===`project`&&e.scopeId===T.id);return(0,Y.jsxs)(`article`,{className:`grid gap-2 px-4 py-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),i?(0,Y.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:b.progress.related}):null]}),(0,Y.jsxs)(`p`,{className:`mt-1 min-w-0 truncate text-sm text-fg-muted`,children:[n,`: `,ar(e)]})]}),(0,Y.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,dateTime:new Date(e.createdAt).toISOString(),children:Yn(e.createdAt)})]}),r?(0,Y.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:r}):null,(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,Y.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:[b.progress.actor,`: `,ir(e)]}),(0,Y.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[b.progress.source,`: `,or(e)]})]})]},e.id)})}):(0,Y.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:b.progress.empty})})]}):null,Q===`settings`?(0,Y.jsxs)(`form`,{id:`project-panel-settings`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-settings`,onSubmit:Sr,onBlurCapture:Ir.onBlurCapture,className:`grid min-h-full content-start gap-4 pb-1`,children:[(0,Y.jsxs)(`section`,{className:`flex min-w-0 items-start justify-between gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:b.settings.summaryTitle}),(0,Y.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:b.settings.summaryHint})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-2`,children:[(0,Y.jsx)(`span`,{className:B(`rounded-full px-2 py-0.5 text-xs font-medium`,Xn(Z.status)),children:b.settings.statuses[Z.status]}),(0,Y.jsx)(Pt,{status:Ir.status,error:Ir.error})]})]}),(0,Y.jsxs)(`div`,{className:`grid items-start gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-4`,children:[(0,Y.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:b.settings.detailsTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:b.settings.detailsHint})]}),(0,Y.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,Y.jsx)(Zn,{label:b.settings.name,children:(0,Y.jsx)(`input`,{className:Qn(),value:Z.name,onChange:e=>Cr({name:e.target.value})})}),(0,Y.jsx)(Zn,{label:b.settings.defaultAgent,children:(0,Y.jsxs)(y,{className:Qn(),value:Z.defaultAgentId,onChange:e=>Cr({defaultAgentId:e.target.value},!0),children:[(0,Y.jsx)(x,{value:``,children:b.settings.globalDefaultAgent}),Yt.map(e=>(0,Y.jsx)(x,{value:e.id,children:Ne(e,_.agentsSettings)},e.id))]})}),(0,Y.jsx)(Zn,{label:b.settings.status,children:Jr?(0,Y.jsx)(`div`,{className:`grid min-h-10 content-center rounded-md border border-edge bg-surface-muted px-3 text-sm text-fg-muted`,children:b.settings.statuses.archived}):(0,Y.jsxs)(y,{className:Qn(),value:Z.status===`archived`?`active`:Z.status,onChange:e=>Cr({status:e.target.value},!0),children:[(0,Y.jsx)(x,{value:`active`,children:b.settings.statuses.active}),(0,Y.jsx)(x,{value:`paused`,children:b.settings.statuses.paused})]})}),(0,Y.jsx)(Zn,{label:b.settings.executionMode,hint:b.settings.executionModeHint,children:(0,Y.jsxs)(y,{className:Qn(),value:Z.executionMode,onChange:e=>Cr({executionMode:e.target.value},!0),children:[(0,Y.jsx)(x,{value:`managed_worktree`,children:b.settings.executionModeWorktree}),(0,Y.jsx)(x,{value:`local_checkout`,children:b.settings.executionModeLocal})]})}),(0,Y.jsx)(Zn,{label:b.settings.description,hint:b.settings.descriptionHint,children:(0,Y.jsx)(`textarea`,{className:Qn(!0),value:Z.description,onChange:e=>Cr({description:e.target.value})})})]})]}),(0,Y.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:b.settings.projectGuidanceTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:b.settings.projectGuidanceHint})]}),(0,Y.jsx)(Zn,{label:b.settings.brief,hint:b.settings.briefHint,children:(0,Y.jsx)(`textarea`,{className:Qn(!0),value:Z.brief,onChange:e=>Cr({brief:e.target.value})})}),(0,Y.jsx)(Zn,{label:b.settings.instructions,hint:b.settings.instructionsHint,children:(0,Y.jsx)(`textarea`,{className:Qn(!0),value:Z.instructions,onChange:e=>Cr({instructions:e.target.value})})})]})]}),(0,Y.jsxs)(`aside`,{className:`grid gap-4 xl:sticky xl:top-0`,children:[(0,Y.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:b.settings.workspaceRoot}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:b.settings.workspaceIndependentHint})]}),(0,Y.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Y.jsx)(`span`,{className:`w-fit rounded-md bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:Xr?b.settings.workspaceModeFollow:b.settings.workspaceModeFixed}),(0,Y.jsx)(`div`,{className:`break-all font-mono text-xs leading-5 text-fg`,title:Zr,children:Zr}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Y.jsxs)(V,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void ti(),children:[(0,Y.jsx)(E,{className:`size-4`,"aria-hidden":!0}),b.settings.copyWorkspacePath]}),Oe?(0,Y.jsx)(it,{resourceId:Oe.fileId,displayName:Oe.name}):null,(0,Y.jsxs)(V,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:wr,children:[(0,Y.jsx)(tt,{className:`size-4`,"aria-hidden":!0}),b.settings.migrateWorkspace]})]})]})]}),(0,Y.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:b.settings.currentProjectTitle}),(0,Y.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Y.jsx)($n,{label:b.settings.defaultAgent,value:Gr}),(0,Y.jsx)($n,{label:b.settings.pinState,value:Yr?b.settings.pinned:b.settings.notPinned}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,Y.jsx)($n,{label:b.settings.createdAt,value:Yn(T.createdAt)||b.common.never}),(0,Y.jsx)($n,{label:b.settings.updatedAt,value:Yn(T.updatedAt)||b.common.never})]})]})]}),(0,Y.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:b.settings.managementTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:b.settings.managementHint})]}),(0,Y.jsxs)(`div`,{className:`grid gap-3`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Yr?b.settings.pinnedTitle:b.settings.pinTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:b.settings.pinHint})]}),(0,Y.jsxs)(V,{type:`button`,variant:`ghost`,className:`w-fit rounded-lg`,disabled:gn===`pin`,onClick:()=>void Er(),children:[Yr?(0,Y.jsx)(xt,{className:`size-4`,"aria-hidden":!0}):(0,Y.jsx)(qe,{className:`size-4`,"aria-hidden":!0}),Yr?b.settings.unpinProject:b.settings.pinProject]})]}),(0,Y.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Jr?b.settings.restoreTitle:b.settings.archiveTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:Jr?b.settings.restoreHint:b.settings.archiveHint})]}),(0,Y.jsxs)(V,{type:`button`,variant:Jr?`primary`:`ghost`,className:`w-fit rounded-lg`,disabled:gn===`archive`,onClick:()=>void Dr(),children:[Jr?(0,Y.jsx)(ee,{className:`size-4`,"aria-hidden":!0}):(0,Y.jsx)(ut,{className:`size-4`,"aria-hidden":!0}),Jr?b.settings.restoreProject:b.settings.archiveProject]})]})]})]}),(0,Y.jsxs)(`section`,{className:`grid gap-3 rounded-lg border border-red-500/20 bg-red-500/5 p-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-red-700 dark:text-red-300`,children:b.settings.dangerTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-red-700/80 dark:text-red-200/80`,children:b.settings.dangerHint})]}),(0,Y.jsxs)(V,{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:()=>sn(!0),children:[(0,Y.jsx)(se,{className:`size-4`,"aria-hidden":!0}),b.settings.deleteConfirmAction]})]})]})]})]}):null]}),(0,Y.jsx)(h,{open:an,onOpenChange:e=>{vn||sn(e)},children:(0,Y.jsxs)(f,{children:[(0,Y.jsx)(c,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(p,{className:`fixed left-1/2 top-1/2 z-[90] w-[min(28rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-5 shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Y.jsx)(`span`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-red-500/10 text-red-600 dark:text-red-400`,children:(0,Y.jsx)(be,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(m,{className:`text-base font-semibold text-fg`,children:b.settings.deleteConfirmTitle}),(0,Y.jsx)(u,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:T?Jn(b.settings.deleteConfirm,{name:T.name}):b.settings.deleteConfirmFallback})]})]}),(0,Y.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,Y.jsx)(d,{asChild:!0,children:(0,Y.jsx)(V,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:vn,children:b.common.cancel})}),(0,Y.jsxs)(V,{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:vn||!T,onClick:()=>void Or(),children:[(0,Y.jsx)(se,{className:`size-4`,"aria-hidden":!0}),b.settings.deleteConfirmAction]})]})]})]})}),(0,Y.jsx)(gt,{open:!!et,title:_.workspace.trashConfirmTitle,description:_.workspace.trashConfirmDescription.replace(`{{name}}`,et?.name??``),confirmLabel:_.workspace.moveToTrash,cancelLabel:_.workspace.cancel,destructive:!0,onConfirm:()=>void Nr(),onCancel:()=>rt(null)}),(0,Y.jsx)(h,{open:un,onOpenChange:e=>{nn||dn(e)},children:(0,Y.jsxs)(f,{children:[(0,Y.jsx)(c,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(p,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(34rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(m,{className:`text-base font-semibold text-fg`,children:b.settings.workspaceMigrationTitle}),(0,Y.jsx)(u,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:b.settings.workspaceMigrationDescription})]}),(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:b.settings.workspaceMode}),(0,Y.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[(0,Y.jsxs)(`label`,{className:B(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,fn===`fixed`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,Y.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:fn===`fixed`,onChange:()=>pn(`fixed`),disabled:nn}),(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`span`,{className:`block font-medium`,children:b.settings.workspaceModeFixed}),(0,Y.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:b.settings.workspaceMigrationFixedHint})]})]}),(0,Y.jsxs)(`label`,{className:B(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,fn===`follow`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,Y.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:fn===`follow`,onChange:()=>pn(`follow`),disabled:nn}),(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`span`,{className:`block font-medium`,children:b.settings.workspaceModeFollow}),(0,Y.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:b.settings.workspaceHint})]})]})]})]}),fn===`fixed`?(0,Y.jsx)(Zt,{value:mn,onChange:hn,disabled:nn,wd:v,placeholder:b.settings.workspacePlaceholder,inputClassName:Qn(),autoFocus:!0}):null,(0,Y.jsx)(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm leading-6 text-amber-800 dark:text-amber-200`,children:b.settings.workspaceMigrationImpact}),(0,Y.jsx)(`div`,{className:`rounded-lg bg-surface-muted px-3 py-2 text-xs leading-5 text-fg-subtle`,children:Jn(b.settings.workspaceCurrent,{workspace:Qr})})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(d,{asChild:!0,children:(0,Y.jsx)(V,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:nn,children:b.common.cancel})}),(0,Y.jsxs)(V,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:nn||!$r,onClick:()=>void Tr(),children:[(0,Y.jsx)(tt,{className:`size-4`,"aria-hidden":!0}),b.settings.workspaceMigrationConfirm]})]})]})]})}),(0,Y.jsx)(h,{open:!!cn,onOpenChange:e=>{e||ln(null)},children:(0,Y.jsxs)(f,{children:[(0,Y.jsx)(c,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(p,{className:`fixed left-1/2 top-1/2 z-[90] flex w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(m,{className:`text-base font-semibold text-fg`,children:b.settings.workspaceMissingTitle}),(0,Y.jsx)(u,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:cn?Jn(b.settings.workspaceMissingDescription,{workspace:cn}):null})]}),cn?(0,Y.jsx)(`div`,{className:`px-5 py-4`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,Y.jsx)(_t,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:cn})]})}):null,(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(V,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:ni,disabled:nn,children:b.settings.workspaceMissingBack}),(0,Y.jsxs)(V,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:()=>void Tr({createWorkspaceRoot:!0}),disabled:nn,children:[(0,Y.jsx)(tt,{className:`size-4`,"aria-hidden":!0}),b.settings.workspaceMissingCreate]})]})]})]})})]})}export{pr as ProjectDetailPage};