@mrpatronz/nexusflow 2.11.0 → 2.12.1

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 (209) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +154 -13
  3. package/dist/analyzers/detect-deps.js +1 -1
  4. package/dist/analyzers/detect-deps.js.map +1 -1
  5. package/dist/commands/commit.d.ts.map +1 -1
  6. package/dist/commands/commit.js +15 -0
  7. package/dist/commands/commit.js.map +1 -1
  8. package/dist/commands/create.d.ts +10 -1
  9. package/dist/commands/create.d.ts.map +1 -1
  10. package/dist/commands/create.js +44 -23
  11. package/dist/commands/create.js.map +1 -1
  12. package/dist/commands/finish.d.ts.map +1 -1
  13. package/dist/commands/finish.js +15 -0
  14. package/dist/commands/finish.js.map +1 -1
  15. package/dist/commands/flow.d.ts +13 -0
  16. package/dist/commands/flow.d.ts.map +1 -0
  17. package/dist/commands/flow.js +91 -0
  18. package/dist/commands/flow.js.map +1 -0
  19. package/dist/commands/skill.d.ts +28 -0
  20. package/dist/commands/skill.d.ts.map +1 -0
  21. package/dist/commands/skill.js +250 -0
  22. package/dist/commands/skill.js.map +1 -0
  23. package/dist/commands/status.d.ts.map +1 -1
  24. package/dist/commands/status.js +14 -0
  25. package/dist/commands/status.js.map +1 -1
  26. package/dist/commands/tag.d.ts +13 -0
  27. package/dist/commands/tag.d.ts.map +1 -0
  28. package/dist/commands/tag.js +179 -0
  29. package/dist/commands/tag.js.map +1 -0
  30. package/dist/commands/verify.d.ts +16 -0
  31. package/dist/commands/verify.d.ts.map +1 -0
  32. package/dist/commands/verify.js +91 -0
  33. package/dist/commands/verify.js.map +1 -0
  34. package/dist/core/adapters/local-storage.d.ts.map +1 -1
  35. package/dist/core/adapters/local-storage.js +2 -2
  36. package/dist/core/adapters/local-storage.js.map +1 -1
  37. package/dist/core/commit.d.ts +2 -0
  38. package/dist/core/commit.d.ts.map +1 -1
  39. package/dist/core/commit.js +15 -0
  40. package/dist/core/commit.js.map +1 -1
  41. package/dist/core/domain-catalog.d.ts +9 -0
  42. package/dist/core/domain-catalog.d.ts.map +1 -0
  43. package/dist/core/domain-catalog.js +47 -0
  44. package/dist/core/domain-catalog.js.map +1 -0
  45. package/dist/core/domain-packs.d.ts +81 -0
  46. package/dist/core/domain-packs.d.ts.map +1 -0
  47. package/dist/core/domain-packs.js +443 -0
  48. package/dist/core/domain-packs.js.map +1 -0
  49. package/dist/core/generation-lock.d.ts +1 -1
  50. package/dist/core/generation-lock.d.ts.map +1 -1
  51. package/dist/core/generation-lock.js +18 -11
  52. package/dist/core/generation-lock.js.map +1 -1
  53. package/dist/core/lifecycle.d.ts +28 -0
  54. package/dist/core/lifecycle.d.ts.map +1 -0
  55. package/dist/core/lifecycle.js +423 -0
  56. package/dist/core/lifecycle.js.map +1 -0
  57. package/dist/core/planning-notes.d.ts +11 -0
  58. package/dist/core/planning-notes.d.ts.map +1 -0
  59. package/dist/core/planning-notes.js +108 -0
  60. package/dist/core/planning-notes.js.map +1 -0
  61. package/dist/core/verify.d.ts +39 -0
  62. package/dist/core/verify.d.ts.map +1 -0
  63. package/dist/core/verify.js +397 -0
  64. package/dist/core/verify.js.map +1 -0
  65. package/dist/core/work-guidance.d.ts +202 -0
  66. package/dist/core/work-guidance.d.ts.map +1 -0
  67. package/dist/core/work-guidance.js +231 -0
  68. package/dist/core/work-guidance.js.map +1 -0
  69. package/dist/core/workspace-git.d.ts.map +1 -1
  70. package/dist/core/workspace-git.js +1 -0
  71. package/dist/core/workspace-git.js.map +1 -1
  72. package/dist/core/workspace-state.d.ts +24 -3
  73. package/dist/core/workspace-state.d.ts.map +1 -1
  74. package/dist/core/workspace-state.js +93 -31
  75. package/dist/core/workspace-state.js.map +1 -1
  76. package/dist/core/workspace-tools.d.ts +10 -0
  77. package/dist/core/workspace-tools.d.ts.map +1 -0
  78. package/dist/core/workspace-tools.js +123 -0
  79. package/dist/core/workspace-tools.js.map +1 -0
  80. package/dist/core/workspace.d.ts.map +1 -1
  81. package/dist/core/workspace.js +7 -17
  82. package/dist/core/workspace.js.map +1 -1
  83. package/dist/generators/base.d.ts.map +1 -1
  84. package/dist/generators/base.js +42 -5
  85. package/dist/generators/base.js.map +1 -1
  86. package/dist/generators/index.d.ts.map +1 -1
  87. package/dist/generators/index.js +11 -0
  88. package/dist/generators/index.js.map +1 -1
  89. package/dist/generators/plan-generator.d.ts.map +1 -1
  90. package/dist/generators/plan-generator.js +61 -58
  91. package/dist/generators/plan-generator.js.map +1 -1
  92. package/dist/generators/skills-generator.d.ts.map +1 -1
  93. package/dist/generators/skills-generator.js +36 -3
  94. package/dist/generators/skills-generator.js.map +1 -1
  95. package/dist/gui/assets/AgentsPage-C7Rh_dp7.js +3 -0
  96. package/dist/gui/assets/DashboardPage-YVONGtqS.js +1 -0
  97. package/dist/gui/assets/{GettingStartedPage-1MOTng3B.js → GettingStartedPage-C2Kbvz_N.js} +1 -1
  98. package/dist/gui/assets/ProjectsPage-DOpfV2Oj.js +1 -0
  99. package/dist/gui/assets/{ScaffoldRepoInline-CP0yn5mw.js → ScaffoldRepoInline-D91aitAi.js} +1 -1
  100. package/dist/gui/assets/{SettingsPage-DWmrLV8o.js → SettingsPage-BdaHN6fa.js} +1 -1
  101. package/dist/gui/assets/SkillsPage-DT9lRkCg.js +7 -0
  102. package/dist/gui/assets/StartWorkPage-D932lq9x.js +1 -0
  103. package/dist/gui/assets/{StrategiesPage-CdCbbIu-.js → StrategiesPage-DCfS-wdu.js} +2 -2
  104. package/dist/gui/assets/WorkroomsPage-BQU27nWS.js +4 -0
  105. package/dist/gui/assets/WorkspacesPage-D3TLVmq-.js +13 -0
  106. package/dist/gui/assets/{alert-dialog-u7qgb9Hq.js → alert-dialog-YynbGyj1.js} +1 -1
  107. package/dist/gui/assets/badge-DTBzXOWn.js +1 -0
  108. package/dist/gui/assets/index-er-mkc2S.css +2 -0
  109. package/dist/gui/assets/index-hTa55BQ6.js +57 -0
  110. package/dist/gui/assets/square-check-big-Bj8Rf_dH.js +1 -0
  111. package/dist/gui/assets/tabs-DfW7Akjs.js +1 -0
  112. package/dist/gui/assets/{useAriaLabelledBy-C4zV-1Ra.js → useAriaLabelledBy-BmJErI5a.js} +1 -1
  113. package/dist/gui/assets/vsc-BsVrJLSg.js +1 -0
  114. package/dist/gui/index.html +3 -5
  115. package/dist/http/work-guidance-routes.d.ts +4 -0
  116. package/dist/http/work-guidance-routes.d.ts.map +1 -0
  117. package/dist/http/work-guidance-routes.js +50 -0
  118. package/dist/http/work-guidance-routes.js.map +1 -0
  119. package/dist/index.js +169 -1
  120. package/dist/index.js.map +1 -1
  121. package/dist/mcp/tools.d.ts +0 -7
  122. package/dist/mcp/tools.d.ts.map +1 -1
  123. package/dist/mcp/tools.js +207 -0
  124. package/dist/mcp/tools.js.map +1 -1
  125. package/dist/resources/contracts.d.ts.map +1 -1
  126. package/dist/resources/contracts.js +2 -1
  127. package/dist/resources/contracts.js.map +1 -1
  128. package/dist/resources/fs-safety.d.ts.map +1 -1
  129. package/dist/resources/fs-safety.js +2 -1
  130. package/dist/resources/fs-safety.js.map +1 -1
  131. package/dist/resources/materializer.d.ts +3 -0
  132. package/dist/resources/materializer.d.ts.map +1 -1
  133. package/dist/resources/materializer.js +45 -19
  134. package/dist/resources/materializer.js.map +1 -1
  135. package/dist/resources/service.d.ts +1 -1
  136. package/dist/resources/service.d.ts.map +1 -1
  137. package/dist/resources/service.js +3 -2
  138. package/dist/resources/service.js.map +1 -1
  139. package/dist/server.d.ts.map +1 -1
  140. package/dist/server.js +333 -8
  141. package/dist/server.js.map +1 -1
  142. package/dist/static-resources/skills/contextspace-verify-release/SKILL.md +51 -0
  143. package/dist/static-resources/skills/contextspace-verify-release/references/evidence.md +21 -0
  144. package/dist/static-resources/skills/nexusflow-dev/SKILL.md +49 -0
  145. package/dist/static-resources/skills/nexusflow-dev/references/cli-conventions.md +15 -0
  146. package/dist/static-resources/skills/nexusflow-dev/references/verification-checklist.md +28 -0
  147. package/dist/static-resources/skills/nexusflow-lifecycle/SKILL.md +66 -0
  148. package/dist/static-resources/skills/nexusflow-lifecycle/references/epic-deliverables.md +36 -0
  149. package/dist/static-resources/skills/nexusflow-lifecycle/references/flow-selection-matrix.md +21 -0
  150. package/dist/static-resources/skills/nexusflow-lifecycle/references/stage-outcomes.md +23 -0
  151. package/dist/static-resources/workflows/epic-multi-slice.md +21 -0
  152. package/dist/static-resources/workflows/plan-implement-review.md +17 -6
  153. package/dist/static-resources/workflows/research-verify.md +15 -4
  154. package/dist/static-resources/workflows/solo-developer.md +11 -2
  155. package/dist/test-setup.d.ts +2 -0
  156. package/dist/test-setup.d.ts.map +1 -0
  157. package/dist/test-setup.js +8 -0
  158. package/dist/test-setup.js.map +1 -0
  159. package/dist/types.d.ts +178 -0
  160. package/dist/types.d.ts.map +1 -1
  161. package/dist/utils/resolve-workspace.d.ts.map +1 -1
  162. package/dist/utils/resolve-workspace.js +15 -8
  163. package/dist/utils/resolve-workspace.js.map +1 -1
  164. package/dist/utils/skills-catalog.d.ts +18 -9
  165. package/dist/utils/skills-catalog.d.ts.map +1 -1
  166. package/dist/utils/skills-catalog.js +248 -344
  167. package/dist/utils/skills-catalog.js.map +1 -1
  168. package/dist/utils/workflow-advisor.d.ts +1 -1
  169. package/dist/utils/workflow-advisor.d.ts.map +1 -1
  170. package/dist/utils/workflow-advisor.js +16 -4
  171. package/dist/utils/workflow-advisor.js.map +1 -1
  172. package/dist/utils/workflows.d.ts.map +1 -1
  173. package/dist/utils/workflows.js +5 -2
  174. package/dist/utils/workflows.js.map +1 -1
  175. package/dist/workrooms/contracts.d.ts +3 -3
  176. package/dist/workrooms/local-resources.d.ts +4 -1
  177. package/dist/workrooms/local-resources.d.ts.map +1 -1
  178. package/dist/workrooms/manager.d.ts +5 -2
  179. package/dist/workrooms/manager.d.ts.map +1 -1
  180. package/dist/workrooms/store.d.ts +2 -2
  181. package/package.json +3 -2
  182. package/resources/skills/contextspace-verify-release/SKILL.md +51 -0
  183. package/resources/skills/contextspace-verify-release/references/evidence.md +21 -0
  184. package/resources/skills/nexusflow-dev/SKILL.md +49 -0
  185. package/resources/skills/nexusflow-dev/references/cli-conventions.md +15 -0
  186. package/resources/skills/nexusflow-dev/references/verification-checklist.md +28 -0
  187. package/resources/skills/nexusflow-lifecycle/SKILL.md +66 -0
  188. package/resources/skills/nexusflow-lifecycle/references/epic-deliverables.md +36 -0
  189. package/resources/skills/nexusflow-lifecycle/references/flow-selection-matrix.md +21 -0
  190. package/resources/skills/nexusflow-lifecycle/references/stage-outcomes.md +23 -0
  191. package/resources/workflows/epic-multi-slice.md +21 -0
  192. package/resources/workflows/plan-implement-review.md +17 -6
  193. package/resources/workflows/research-verify.md +15 -4
  194. package/resources/workflows/solo-developer.md +11 -2
  195. package/dist/gui/assets/AgentsPage-DbivhmK0.js +0 -3
  196. package/dist/gui/assets/DashboardPage-D50Qrm3e.js +0 -1
  197. package/dist/gui/assets/NullStore-tdPen1kp.js +0 -1
  198. package/dist/gui/assets/ProjectsPage-srKgf7VN.js +0 -1
  199. package/dist/gui/assets/SkillsPage-CKjTXdrd.js +0 -6
  200. package/dist/gui/assets/StartWorkPage-BCUnJ9k8.js +0 -1
  201. package/dist/gui/assets/WorkroomsPage-BcT-mGtT.js +0 -4
  202. package/dist/gui/assets/WorkspacesPage-CYFCm-7_.js +0 -2
  203. package/dist/gui/assets/badge-DwXvB44H.js +0 -1
  204. package/dist/gui/assets/chunk-BV7QT456-DfUBKG-z.js +0 -3
  205. package/dist/gui/assets/index-3tD_IeyQ.js +0 -55
  206. package/dist/gui/assets/index-CK5YRfPV.css +0 -2
  207. package/dist/gui/assets/square-check-big-BSIiYXPI.js +0 -1
  208. package/dist/gui/assets/tabs-BrHKp5bD.js +0 -1
  209. package/dist/gui/assets/vsc-D80c4gBT.js +0 -1
@@ -0,0 +1,13 @@
1
+ import{_ as e,b as t,c as n,g as r,h as i,i as a,l as o,m as s,p as c,t as l}from"./button-CREn1mup.js";import{A as u,C as d,F as f,Gn as p,Gt as m,H as h,Ht as g,I as _,J as v,Kn as y,L as b,M as x,Mn as S,N as C,O as w,P as T,R as E,Vn as D,Wt as O,X as k,Xt as A,Y as j,Yn as M,Yt as N,Z as P,_ as F,_n as I,at as L,bn as R,cn as z,g as ee,in as B,j as te,k as ne,n as V,nn as re,nt as H,q as U,qn as ie,qt as W,sn as G,t as K,tt as ae,v as oe,yt as se,z as ce}from"./badge-DTBzXOWn.js";import{t as le}from"./chevron-down-B_Mwbim8.js";import{n as ue,r as de,t as fe}from"./shield-check-Dd1Yv3l2.js";import{t as pe}from"./code-xml-DH-38Tt7.js";import{a as me,i as he,n as ge,o as _e,r as ve,s as ye,t as be}from"./square-check-big-Bj8Rf_dH.js";import{t as xe}from"./git-branch-Ce0I2663.js";import{t as Se}from"./layers-j_brOuoa.js";import{n as q,r as Ce,t as we}from"./vsc-BsVrJLSg.js";import{t as Te}from"./trash-2-CMdv3eD3.js";import{a as Ee,i as De,n as Oe,r as ke,t as Ae}from"./tabs-DfW7Akjs.js";import{d as je,o as Me,t as Ne}from"./brand-hHByyyzq.js";import{$ as Pe,A as Fe,An as Ie,At as Le,Bn as Re,Bt as ze,Cn as Be,Ct as Ve,D as He,Dn as Ue,Dt as We,E as Ge,F as Ke,Fn as qe,G as Je,Gt as Ye,H as Xe,Hn as Ze,Ht as Qe,In as $e,It as et,Jt as tt,Kt as nt,Ln as rt,Lt as it,Mn as at,Nn as ot,O as st,On as ct,Pn as lt,Pt as ut,Qt as dt,Sn as ft,T as pt,Tt as mt,Un as ht,Ut as gt,V as _t,Vn as vt,Vt as yt,Wt as bt,X as xt,Yt as St,Z as Ct,Zt as wt,_ as Tt,_n as Et,a as Dt,an as Ot,at as kt,c as At,ct as jt,d as J,dt as Y,et as Mt,f as Nt,fn as Pt,ft as Ft,g as It,h as Lt,i as Rt,jn as zt,jt as X,kn as Bt,l as Vt,m as Ht,mn as Ut,n as Wt,nn as Gt,nt as Kt,o as qt,p as Jt,qt as Yt,r as Xt,rn as Zt,s as Qt,st as $t,t as en,tt as tn,u as nn,v as rn,vn as an,wn as on,wt as sn,xn as cn,y as ln,yn as un,z as dn,zn as Z,zt as fn}from"./index-hTa55BQ6.js";import{t as pn}from"./card-yrg6ov8B.js";import{t as mn}from"./label-DC730X8s.js";var hn=i(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),gn=i(`building-2`,[[`path`,{d:`M10 12h4`,key:`a56b0p`}],[`path`,{d:`M10 8h4`,key:`1sr2af`}],[`path`,{d:`M14 21v-3a2 2 0 0 0-4 0v3`,key:`1rgiei`}],[`path`,{d:`M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2`,key:`secmi2`}],[`path`,{d:`M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16`,key:`16ra0t`}]]),_n=i(`calendar`,[[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M3 9h18`,key:`1pudct`}]]),vn=i(`chevrons-down-up`,[[`path`,{d:`m7 20 5-5 5 5`,key:`13a0gw`}],[`path`,{d:`m7 4 5 5 5-5`,key:`1kwcof`}]]),yn=i(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),bn=i(`circle-arrow-up`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 12-4-4-4 4`,key:`177agl`}],[`path`,{d:`M12 16V8`,key:`1sbj14`}]]),xn=i(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 9-5.5 5.5L8 12`,key:`xofnsj`}]]),Sn=i(`circle-play`,[[`path`,{d:`M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z`,key:`kmsa83`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Cn=i(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),wn=i(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),Tn=i(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),En=i(`git-compare`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`path`,{d:`M11 18H8a2 2 0 0 1-2-2V9`,key:`19pyzm`}]]),Dn=i(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),On=i(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),kn=i(`pen-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),An=i(`puzzle`,[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]),jn=i(`radio`,[[`path`,{d:`M16.247 7.761a6 6 0 0 1 0 8.478`,key:`1fwjs5`}],[`path`,{d:`M19.075 4.933a10 10 0 0 1 0 14.134`,key:`ehdyv1`}],[`path`,{d:`M4.925 19.067a10 10 0 0 1 0-14.134`,key:`1q22gi`}],[`path`,{d:`M7.753 16.239a6 6 0 0 1 0-8.478`,key:`r2q7qm`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]),Mn=i(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Nn=i(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),Pn=i(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),Fn=i(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),In=i(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),Ln=i(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),Q=t(e(),1);function Rn(e){let{popupElement:t,positionerElement:n,content:r,mounted:i,onMeasureLayout:a,onMeasureLayoutComplete:s,side:c,direction:l}=e,u=m(t,!0),d=W(),f=Q.useRef(null),p=Q.useRef(!0),h=Q.useRef(o),g=z(a),_=z(s),v=Q.useMemo(()=>zn(c,l),[c,l]);G(()=>{if(!i){h.current=o,p.current=!0,f.current=null;return}if(!t||!n)return;h.current=Vn(t,v),Hn(t,`auto`);let e=Bn(t,`position`,`static`),r=Bn(t,`transform`,`none`),a=Bn(t,`scale`,`1`),s=Vn(n,{"--available-width":`max-content`,"--available-height":`max-content`});function c(){e(),r(),s()}function l(){c(),a()}if(g?.(),p.current||f.current===null){Un(n,`max-content`);let e=Ee(t);return f.current=e,Un(n,e),l(),_?.(null,e),p.current=!1,()=>{h.current(),h.current=o}}Un(n,`max-content`);let m=f.current,y=Ee(t);f.current=y,Hn(t,m),l(),_?.(m,y),Un(n,y);let b=new AbortController;return d.request(()=>{Hn(t,y),u(()=>{t.style.setProperty(`--popup-width`,`auto`),t.style.setProperty(`--popup-height`,`auto`)},b.signal)}),()=>{b.abort(),d.cancel(),h.current(),h.current=o}},[r,t,n,u,d,i,g,_,v])}function zn(e,t){let r=e===`top`,i=e===`left`||e===(t===`rtl`?`inline-end`:`inline-start`);return!r&&!i?n:{position:`absolute`,[r?`bottom`:`top`]:`0`,[i?`right`:`left`]:`0`}}function Bn(e,t,n){let r=e.style.getPropertyValue(t);return e.style.setProperty(t,n),()=>{e.style.setProperty(t,r)}}function Vn(e,t){let n=[];for(let[r,i]of Object.entries(t))n.push(Bn(e,r,i));return n.length?()=>{n.forEach(e=>e())}:o}function Hn(e,t){let n=t===`auto`?`auto`:`${t.width}px`,r=t===`auto`?`auto`:`${t.height}px`;e.style.setProperty(`--popup-width`,n),e.style.setProperty(`--popup-height`,r)}function Un(e,t){let n=t===`max-content`?`max-content`:`${t.width}px`,r=t===`max-content`?`max-content`:`${t.height}px`;e.style.setProperty(`--positioner-width`,n),e.style.setProperty(`--positioner-height`,r)}var Wn={name:`adaptiveOrigin`,async fn(e){let{x:t,y:n,rects:{floating:r},elements:{floating:i},platform:a,strategy:o,placement:s}=e,c=I(i),l=c.getComputedStyle(i);if(l.transitionDuration===`0s`||l.transitionDuration===``)return{x:t,y:n,data:ze};let u=await a.getOffsetParent?.(i),d={width:0,height:0};if(o===`fixed`&&c?.visualViewport)d={width:c.visualViewport.width,height:c.visualViewport.height};else if(u===c){let e=B(i);d={width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}}else await a.isElement?.(u)&&(d=await a.getDimensions(u));let f=dt(s),p=t,m=n;f===`left`&&(p=d.width-(t+r.width)),f===`top`&&(m=d.height-(n+r.height));let h=f===`left`?`right`:ze.sideX,g=f===`top`?`bottom`:ze.sideY;return{x:p,y:m,data:{sideX:h,sideY:g}}}},Gn=t(M(),1),$=r(),Kn={activationDirection:e=>e?{"data-activation-direction":e}:null};function qn(e){let{store:t,side:n,children:r}=e,i=F(),a=t.useState(`activeTriggerElement`),o=t.useState(`activeTriggerId`),s=t.useState(`open`),c=t.useState(`payload`),l=t.useState(`mounted`),u=t.useState(`popupElement`),d=t.useState(`positionerElement`),f=Le(s?a:null),p=Zn(o,c),h=Q.useRef(null),[g,_]=Q.useState(null),[v,y]=Q.useState(null),b=Q.useRef(null),x=Q.useRef(null),S=m(b,!0),C=W(),w=Q.useRef(null),[T,E]=Q.useState(null),[D,O]=Q.useState(!1);G(()=>(t.set(`adaptiveOrigin`,Wn),()=>{t.set(`adaptiveOrigin`,void 0)}),[t]);let k=z(()=>{b.current?.style.setProperty(`animation`,`none`),b.current?.style.setProperty(`transition`,`none`),x.current?.style.setProperty(`display`,`none`)}),A=z(e=>{b.current?.style.removeProperty(`animation`),b.current?.style.removeProperty(`transition`),x.current?.style.removeProperty(`display`),e&&E(e)}),j=z(()=>{w.current?.abort();let e=new AbortController;w.current=e,S(()=>{_(null),E(null),h.current=null},e.signal)}),M=Q.useRef(null);G(()=>{(!s||!l)&&(M.current=null)},[s,l]),G(()=>{if(a&&f&&a!==f&&M.current!==a&&h.current){_(h.current),O(!0);let e=Xn(f,a);y(e),M.current=a}},[a,f]),G(()=>{g!=null&&(w.current?.abort(),O(!0),C.request(()=>{Gn.flushSync(()=>{O(!1)}),j()}))},[p,g,j,C]),G(()=>{let e=b.current;if(!e)return;let t=B(e).createElement(`div`);for(let n of Array.from(e.childNodes))t.appendChild(n.cloneNode(!0));h.current=t});let N=g!=null,P;P=N?(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(`div`,{"data-previous":!0,inert:oe(!0),ref:x,style:{...T?{"--popup-width":`${T.width}px`,"--popup-height":`${T.height}px`}:null,position:`absolute`},"data-ending-style":D?void 0:``},`previous`),(0,$.jsx)(`div`,{"data-current":!0,ref:b,"data-starting-style":D?``:void 0,children:r},p)]}):(0,$.jsx)(`div`,{"data-current":!0,ref:b,children:r},p),G(()=>{let e=x.current;!e||!g||e.replaceChildren(...Array.from(g.childNodes))},[g]),Rn({popupElement:u,positionerElement:d,mounted:l,content:c,onMeasureLayout:k,onMeasureLayoutComplete:A,side:n,direction:i});let I={activationDirection:Jn(v),transitioning:N};return{children:P,state:I}}function Jn(e){if(e)return`${Yn(e.horizontal,5,`right`,`left`)} ${Yn(e.vertical,5,`down`,`up`)}`}function Yn(e,t,n,r){return e>t?n:e<-t?r:``}function Xn(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i={x:n.left+n.width/2,y:n.top+n.height/2},a={x:r.left+r.width/2,y:r.top+r.height/2};return{horizontal:a.x-i.x,vertical:a.y-i.y}}function Zn(e,t){let[n,r]=Q.useState(0),i=Q.useRef(e),a=Q.useRef(t),o=Q.useRef(!1);return G(()=>{let n=i.current,s=a.current,c=e!==n,l=t!==s;c?(r(e=>e+1),o.current=!l):o.current&&l&&(r(e=>e+1),o.current=!1),i.current=e,a.current=t},[e,t]),`${e??`current`}-${n}`}function Qn({ws:e}){let t=e.branchName,n=$t(t),r=Pe(t),i=Xe(t),a=n.data,o=(0,Q.useMemo)(()=>a?.services??[],[a]),c=(0,Q.useMemo)(()=>a?.runningState??[],[a]),u=a?.orchestrationTools??[],d=(0,Q.useMemo)(()=>a?.runningOrchestrators??[],[a]),f=(0,Q.useMemo)(()=>d.filter(e=>e.mode===`pm2`&&e.logName),[d]),[p,m]=(0,Q.useState)(`classic`),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{let e=[...o.map(e=>e.name),...f.map(e=>e.logName)];e.length===0?_!==null&&v(null):(!_||!e.includes(_))&&v(e[0])},[o,f]);let{logs:y,connected:b,clear:x}=pt(t,_,!0),S=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{S.current?.scrollIntoView({behavior:`smooth`})},[y]);let C=(0,Q.useMemo)(()=>new Set(c.filter(e=>e.pid>0).map(e=>e.name)),[c]),w=(0,Q.useMemo)(()=>new Set(d.map(e=>e.id)),[d]),T=C.size>0,E=p===`matrix`?`term-matrix`:p===`dracula`?`term-dracula`:`term-classic`,D=r.isPending||i.isPending;return(0,$.jsxs)(`div`,{className:`animate-fade-in`,children:[n.isLoading&&(0,$.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-[10px] text-primary`,children:[(0,$.jsx)(J,{className:`size-3`}),(0,$.jsx)(`span`,{className:`font-semibold tracking-wider uppercase`,children:`Scanning service configurations...`})]}),n.isError&&(0,$.jsxs)(`div`,{className:`mb-4 flex items-center justify-between rounded-md border border-destructive/30 bg-destructive/10 p-3 text-xs text-destructive`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(cn,{size:14}),(0,$.jsxs)(`span`,{children:[`Failed to load services: `,n.error?.message||`Unknown error`]})]}),(0,$.jsx)(l,{size:`xs`,variant:`outline`,onClick:()=>n.refetch(),children:`Retry`})]}),(r.isError||i.isError)&&(0,$.jsxs)(`div`,{className:`mb-4 flex items-center justify-between rounded-md border border-destructive/30 bg-destructive/10 p-3 text-xs text-destructive`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(cn,{size:14}),(0,$.jsxs)(`span`,{children:[`Action failed: `,r.error?.message||i.error?.message||`Operation failed`]})]}),(0,$.jsx)(l,{size:`xs`,variant:`ghost`,onClick:()=>{r.reset(),i.reset()},children:`Dismiss`})]}),!n.isLoading&&!n.isError&&o.length===0&&u.length===0&&(0,$.jsxs)(`div`,{className:`rounded-md border border-border/80 bg-card p-6 text-center surface-card`,children:[(0,$.jsx)(ft,{size:24,className:`mx-auto mb-2 text-muted-foreground/60`}),(0,$.jsx)(`h4`,{className:`text-xs font-bold text-foreground`,children:`No Services Detected`}),(0,$.jsxs)(`p`,{className:`mt-1 text-[11px] text-muted-foreground`,children:[`ContextSpace scans for runnable background services in `,(0,$.jsx)(`code`,{className:`font-mono text-[10px]`,children:`package.json`}),` scripts (such as `,(0,$.jsx)(`code`,{className:`font-mono text-[10px]`,children:`start`}),`, `,(0,$.jsx)(`code`,{className:`font-mono text-[10px]`,children:`dev`}),`), `,(0,$.jsx)(`code`,{className:`font-mono text-[10px]`,children:`docker-compose.yml`}),`, or `,(0,$.jsx)(`code`,{className:`font-mono text-[10px]`,children:`Procfile`}),`.`]})]}),u.length>0&&(0,$.jsxs)(`div`,{className:`mb-4 rounded-md border border-border/80 bg-card p-4 surface-card`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-[10px] font-bold uppercase tracking-wider text-muted-foreground`,children:[(0,$.jsx)(cn,{size:12,className:`text-info`}),` Orchestration tools`]}),(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:u.map(e=>{let t=w.has(e.id);return(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-border/60 bg-muted/20 p-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`h-2 w-2 rounded-full ${t?`bg-success`:`bg-muted-foreground/40`}`}),(0,$.jsx)(`span`,{className:`text-xs font-bold text-foreground`,children:e.tool}),(0,$.jsx)(nn,{tone:`idle`,dot:!1,children:e.mode})]}),(0,$.jsx)(`code`,{className:`mt-1 block truncate font-mono text-[9px] text-muted-foreground`,children:e.configPath})]}),(0,$.jsx)(`div`,{className:`shrink-0`,children:t?(0,$.jsxs)(l,{size:`xs`,variant:`destructive`,"aria-label":`Stop ${e.tool}`,disabled:D,onClick:()=>i.mutate({action:`stop`,id:e.id}),children:[(0,$.jsx)(Be,{size:12}),` Stop`]}):(0,$.jsxs)(l,{size:`xs`,"aria-label":`Start ${e.tool}`,disabled:D,onClick:()=>i.mutate({action:`start`,id:e.id}),children:[(0,$.jsx)(Ie,{size:12}),` Start`]})})]},e.id)})})]}),(0,$.jsxs)(`div`,{className:`mb-4 rounded-md border border-border/80 bg-card p-4 surface-card`,children:[(0,$.jsxs)(`div`,{className:`mb-2 flex items-center justify-between text-xs font-semibold text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:`Workspace Status`}),(0,$.jsx)(nn,{tone:T?`running`:`idle`,children:T?`Active`:`Standby`})]}),(0,$.jsx)(`div`,{className:`mb-3 text-xs font-semibold text-foreground`,children:T?`${C.size} process${C.size===1?``:`es`} active`:`All processes offline`}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsxs)(l,{size:`sm`,disabled:T||D,onClick:()=>r.mutate({action:`start`}),children:[(0,$.jsx)(Ie,{size:13}),` Start All Services`]}),(0,$.jsxs)(l,{size:`sm`,variant:`destructive`,disabled:!T||D,onClick:()=>r.mutate({action:`stop`}),children:[(0,$.jsx)(Be,{size:13}),` Stop All`]})]})]}),(o.length>0||f.length>0)&&(0,$.jsxs)(`div`,{className:`grid grid-cols-1 overflow-hidden rounded-md border border-border/80 bg-card shadow-xs lg:grid-cols-12 surface-card`,children:[(0,$.jsxs)(`div`,{className:`border-b border-border/80 bg-muted/20 p-4 lg:col-span-4 lg:border-b-0 lg:border-r`,children:[(0,$.jsxs)(`h4`,{className:`mb-4 flex items-center gap-1.5 border-b border-border pb-2 text-[10px] font-bold uppercase tracking-wider text-muted-foreground`,children:[(0,$.jsx)(ft,{size:12,className:`text-primary`}),` Background Services`]}),(0,$.jsxs)(`div`,{className:`flex max-h-[400px] flex-col gap-2 overflow-y-auto pr-1`,children:[o.map(e=>{let t=_===e.name,n=C.has(e.name);return(0,$.jsxs)(`div`,{className:s(`flex cursor-pointer flex-col rounded-xl border p-3 transition-colors`,t?`border-primary/40 bg-primary/10 text-foreground`:`border-border bg-card text-muted-foreground hover:border-foreground/15 hover:bg-accent/50 hover:text-foreground`),onClick:()=>v(e.name),children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full ${n?`bg-success`:`bg-destructive`}`}),(0,$.jsx)(`span`,{className:`truncate text-xs font-bold`,children:e.name})]}),(0,$.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,onClick:e=>e.stopPropagation(),children:n?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(l,{size:`icon-xs`,variant:`ghost`,"aria-label":`Restart ${e.name}`,disabled:D,onClick:()=>r.mutate({action:`restart`,service:e.name}),children:(0,$.jsx)(Nn,{})}),(0,$.jsx)(l,{size:`icon-xs`,variant:`ghost`,"aria-label":`Stop ${e.name}`,disabled:D,onClick:()=>r.mutate({action:`stop`,service:e.name}),children:(0,$.jsx)(Be,{})})]}):(0,$.jsx)(l,{size:`icon-xs`,variant:`ghost`,"aria-label":`Start ${e.name}`,disabled:D,onClick:()=>r.mutate({action:`start`,service:e.name}),children:(0,$.jsx)(Ie,{})})})]}),e.port?(0,$.jsxs)(`span`,{className:`mt-2 w-fit rounded border border-border bg-background px-2 py-0.5 font-mono text-[9px] text-muted-foreground`,children:[`Port: `,e.port]}):null,(0,$.jsxs)(`code`,{className:`mt-2 block truncate rounded border border-border bg-muted/40 p-1.5 font-mono text-[9px] text-muted-foreground`,children:[e.command,` `,e.args.join(` `)]})]},e.name)}),f.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`mt-2 border-t border-border pt-3 text-[9px] font-bold uppercase tracking-wider text-muted-foreground`,children:`Orchestrators`}),f.map(e=>{let t=e.logName;return(0,$.jsxs)(`div`,{className:s(`flex cursor-pointer items-center gap-2 rounded-xl border p-3 transition-colors`,_===t?`border-primary/40 bg-primary/10 text-foreground`:`border-border bg-card text-muted-foreground hover:border-foreground/15 hover:bg-accent/50 hover:text-foreground`),onClick:()=>v(t),children:[(0,$.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full bg-success`}),(0,$.jsx)(`span`,{className:`truncate text-xs font-bold`,children:e.tool}),(0,$.jsx)(nn,{tone:`idle`,dot:!1,children:e.mode})]},e.id)})]})]})]}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col bg-background lg:col-span-8`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-border bg-muted/40 px-5 py-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`font-mono text-xs font-bold text-primary`,children:_||`no-service`}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`|`}),(0,$.jsx)(nn,{tone:b?`running`:`idle`,children:b?`streaming`:`idle`})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3 self-end sm:self-auto`,children:[(0,$.jsx)(`div`,{className:`flex rounded-lg border border-border bg-card p-0.5 text-[9px] font-semibold text-muted-foreground`,children:[`classic`,`matrix`,`dracula`].map(e=>(0,$.jsx)(`button`,{className:s(`cursor-pointer rounded-md px-2 py-1 capitalize transition-colors`,p===e?`bg-primary/10 font-bold text-primary`:`hover:text-foreground`),onClick:()=>m(e),children:e},e))}),(0,$.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,$.jsx)(`button`,{onClick:x,className:`cursor-pointer rounded-lg border border-border bg-card p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:`Clear Console`,children:(0,$.jsx)(Te,{size:13})}),(0,$.jsx)(`button`,{onClick:()=>g(!h),className:`cursor-pointer rounded-lg border border-border bg-card p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:h?`Minimize Console`:`Expand Console`,children:h?(0,$.jsx)(zt,{size:13}):(0,$.jsx)(ot,{size:13})})]})]})]}),(0,$.jsxs)(`div`,{className:s(`relative overflow-y-auto whitespace-pre-wrap p-5 font-mono text-[10.5px] leading-relaxed selection:bg-primary/20`,E,h?`h-[520px]`:`h-80`),children:[y.trim()?y:(0,$.jsx)(`span`,{className:`font-mono italic text-muted-foreground`,children:`(no log content yet)`}),(0,$.jsx)(`div`,{ref:S})]})]})]})]})}var $n=Q.createContext(void 0);function er(e){let t=Q.useContext($n);if(t===void 0&&!e)throw Error(c(47));return t}var tr={...St,disabled:e=>e.disabled,instantType:e=>e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,modal:e=>e.modal,focusManagerModal:e=>e.focusManagerModal,stickIfOpen:e=>e.stickIfOpen,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},nr=class extends h{constructor(e,t,n){let r=new w;super(rr(e,r,t,n),ir(r),tr)}setOpen=(e,t)=>{let n=t.reason===D,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=te(t),o=this.select(`activeTriggerId`);if(!e&&t.reason===`close-press`&&t.trigger==null&&o!=null&&(t.trigger=this.context.triggerElements.getById(o)??this.select(`activeTriggerElement`)??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let s=()=>{let n={open:e,openChangeReason:t.reason};C(n,e,t.trigger,a()),this.update(n)};n?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),Gn.flushSync(s)):s();let c;r?c=`click`:i?c=`dismiss`:t.reason===`focus-out`&&(c=`focus`),this.set(`instantType`,c)}};function rr(e,t,n,r=!1){let i={...Yt(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return i.open&&e?.mounted===void 0&&(i.mounted=!0),i.floatingRootContext=tt(t,n,r),i}function ir(e){return{popupRef:Q.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:Q.createRef(),beforeContentFocusGuardRef:Q.createRef(),stickIfOpenTimeout:new g,triggerElements:e}}function ar({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,d=sr(s,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});d.useControlledProp(`openProp`,n),d.useControlledProp(`triggerIdProp`,c);let p=d.useState(`open`),m=d.useState(`mounted`),h=d.useState(`payload`);d.useContextCallback(`onOpenChange`,i),d.useContextCallback(`onOpenChangeComplete`,a),E(d,p),T(d);let{forceUnmount:g}=f(p,d,()=>{d.update({stickIfOpen:!0,openChangeReason:null})});d.useSyncedValues({modal:o}),Q.useEffect(()=>{p||d.context.stickIfOpenTimeout.clear()},[d,p]),Q.useImperativeHandle(e.actionsRef,()=>({unmount:g,close:()=>d.setOpen(!1,N(S))}),[g,d]);let _=p||m;return(0,$.jsxs)($n.Provider,{value:d,children:[s&&(0,$.jsx)(u,{handle:s,store:d}),_&&(0,$.jsx)(cr,{store:d,modal:o}),typeof t==`function`?t({payload:h}):t]})}function or(e){return er(!0)?(0,$.jsx)(ar,{props:e}):(0,$.jsx)(k,{children:(0,$.jsx)(ar,{props:e})})}function sr(e,t){let n=b((e,n)=>new nr(t,e,n));return Q.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function cr({store:e,modal:t}){let n=e.useState(`floatingRootContext`),r=U(n,{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),i=r.reference,a=r.floating;return _(e,{activeTriggerProps:i,inactiveTriggerProps:i,popupProps:a}),null}var lr=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:o=!1,nativeButton:s=!0,handle:l,payload:u,openOnHover:d=!1,delay:f=300,closeDelay:p=0,id:m,...h}=e,g=er(!0),_=nt(l)??g;if(!_)throw Error(c(74));let v=A(m),b=_.useState(`isTriggerActive`,v),x=_.useState(`floatingRootContext`),S=_.useState(`isOpenedByTrigger`,v),C=_.useState(`triggerPopupId`,v),w=Q.useRef(null),{registerTrigger:T,isMountedByThisTrigger:E}=ce(v,w,_,{payload:u,disabled:o,openOnHover:d,closeDelay:p}),D=_.useState(`openChangeReason`),O=_.useState(`stickIfOpen`),k=_.useState(`openMethod`),j=_.useState(`focusManagerModal`),M=bt(x,{enabled:!o&&d&&(k!==`touch`||D!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:gt(),restMs:f,delay:{close:p},triggerElementRef:w,isActiveTrigger:b,isClosing:()=>_.select(`transitionStatus`)===`ending`}),N=wt(x,{stickIfOpen:O}),P=ut(()=>_.select(`open`),e=>{_.set(`openMethod`,e)}),F=_.useState(`triggerProps`,E),{getButtonProps:I,buttonRef:L}=re({disabled:o,native:s}),R={open(e){return e&&D===`trigger-press`?y.open(e):ie.open(e)}},{preFocusGuardRef:z,handlePreFocusGuardFocus:ee,handleFocusTargetFocus:B}=X(_,w),te=a(`button`,e,{state:{disabled:o,open:S},ref:[L,t,T,w],props:[N.reference,M,F,P,{[H]:``,id:v,"aria-haspopup":`dialog`,"aria-expanded":S,"aria-controls":C},h,I],stateAttributesMapping:R}),ne=(0,$.jsx)(Q.Fragment,{children:te},v);return E&&!j?(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(se,{ref:z,onFocus:ee}),ne,(0,$.jsx)(se,{ref:_.context.triggerFocusTargetRef,onFocus:B})]}):ne}),ur=Q.createContext(void 0);function dr(){let e=Q.useContext(ur);if(e===void 0)throw Error(c(45));return e}var fr=Q.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return er().useState(`mounted`)||n?(0,$.jsx)(ur.Provider,{value:n,children:(0,$.jsx)(ae,{ref:t,...r})}):null}),pr=Q.createContext(void 0);function mr(){let e=Q.useContext(pr);if(!e)throw Error(c(46));return e}var hr=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,anchor:a,positionMethod:o,side:s,align:c,sideOffset:l,alignOffset:u,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f,arrowPadding:p,sticky:h,disableAnchorTracking:g=!1,collisionAvoidance:_=L,...v}=e,y=er(),b=dr(),x=P(),S=y.useState(`floatingRootContext`),C=y.useState(`mounted`),w=y.useState(`open`),T=y.useState(`openChangeReason`),E=y.useState(`activeTriggerElement`),D=y.useState(`modal`),O=y.useState(`openMethod`),k=y.useState(`positionerElement`),A=y.useState(`instantType`),M=y.useState(`transitionStatus`),N=y.useState(`adaptiveOrigin`),F=Q.useRef(null),I=m(k),R=fn({anchor:a,floatingRootContext:S,positionMethod:o,mounted:C,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:h,disableAnchorTracking:g,keepMounted:b,nodeId:x,collisionAvoidance:_,adaptiveOrigin:N}),z=S.useState(`domReferenceElement`);G(()=>{let e=z,t=F.current;if(e&&(F.current=e),t&&e&&e!==t){y.set(`instantType`,void 0);let e=new AbortController;return I(()=>{y.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[z,I,y]);let B=D===!0&&T!==`trigger-hover`;et(w&&B,O===`touch`,k,E);let te=y.useStateSetter(`positionerElement`),ne={open:w,side:R.side,align:R.align,anchorHidden:R.anchorHidden,instant:A},V=it(e,ne,{styles:R.positionerStyles,transitionStatus:M,props:v,refs:[t,te],hidden:!C,inert:!w});return(0,$.jsxs)(pr.Provider,{value:R,children:[C&&B&&(0,$.jsx)(ee,{inert:oe(!w),cutout:E}),(0,$.jsx)(j,{id:x,children:V})]})}),gr=Q.createContext(void 0);function _r(){let[e,t]=Q.useState(0),n=z(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:Q.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}var vr=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:o,finalFocus:s,...c}=e,l=er(),u=mr(),f=Qe(!0)!=null,{context:m,hasClosePart:h}=_r(),g=l.useState(`open`),_=l.useState(`openMethod`),y=l.useState(`instantType`),b=l.useState(`transitionStatus`),S=l.useState(`popupProps`),C=l.useState(`titleElementId`),w=l.useState(`descriptionElementId`),T=l.useState(`modal`),E=l.useState(`mounted`),D=l.useState(`openChangeReason`),k=l.useState(`activeTriggerElement`),A=l.useState(`floatingRootContext`),j=A.useState(`floatingId`),M=l.useState(`disabled`),N=l.useState(`openOnHover`),P=l.useState(`closeDelay`);O({open:g,ref:l.context.popupRef,onComplete(){g&&l.context.onOpenChangeComplete?.(!0)}}),Ye(A,{enabled:N&&!M,closeDelay:P});let F=o===void 0?x(l.context.popupRef):o,I=T!==!1&&h;l.useSyncedValue(`focusManagerModal`,I);let L=l.useStateSetter(`popupElement`),z={open:g,side:u.side,align:u.align,instant:y,transitionStatus:b},ee=a(`div`,e,{state:z,ref:[t,l.context.popupRef,L],props:[S,{id:j,role:`dialog`,...ne,"aria-labelledby":C,"aria-describedby":w,onKeyDown(e){f&&d.has(e.key)&&e.stopPropagation()}},yt(b),c],stateAttributesMapping:p});return(0,$.jsx)(v,{context:A,openInteractionType:_,modal:I,disabled:!E||D===`trigger-hover`,initialFocus:F,returnFocus:s,restoreFocus:`popup`,previousFocusableElement:R(k)?k:void 0,nextFocusableElement:l.context.triggerFocusTargetRef,beforeContentFocusGuardRef:l.context.beforeContentFocusGuardRef,children:(0,$.jsx)(gr.Provider,{value:m,children:ee})})}),yr=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,children:o,...s}=e,c=er(),{side:l}=mr(),u=c.useState(`instantType`),{children:d,state:f}=qn({store:c,side:l,children:o}),p={activationDirection:f.activationDirection,transitioning:f.transitioning,instant:u};return a(`div`,e,{state:p,ref:t,props:[s,{children:d}],stateAttributesMapping:Kn})}),br=or;function xr({className:e,children:t,...n}){return(0,$.jsx)(lr,{className:e,"data-slot":`popover-trigger`,...n,children:t})}function Sr({children:e,className:t,viewportClassName:n,side:r=`bottom`,align:i=`center`,sideOffset:a=4,alignOffset:o=0,tooltipStyle:c=!1,anchor:l,...u}){return(0,$.jsx)(fr,{children:(0,$.jsx)(hr,{align:i,alignOffset:o,anchor:l,className:`z-50 h-(--positioner-height) w-(--positioner-width) max-w-(--available-width) transition-[top,left,right,bottom,transform] data-instant:transition-none`,"data-slot":`popover-positioner`,side:r,sideOffset:a,children:(0,$.jsx)(vr,{className:s(`relative flex h-(--popup-height,auto) w-(--popup-width,auto) origin-(--transform-origin) rounded-lg border bg-popover not-dark:bg-clip-padding text-popover-foreground shadow-lg/5 outline-none transition-[width,height,scale,opacity] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] has-data-[slot=calendar]:rounded-xl has-data-[slot=calendar]:before:rounded-[calc(var(--radius-xl)-1px)] data-starting-style:scale-98 data-starting-style:opacity-0 dark:before:shadow-[0_-1px_--theme(--color-white/6%)]`,c&&`w-fit text-balance rounded-md text-xs shadow-md/5 before:rounded-[calc(var(--radius-md)-1px)]`,t),"data-slot":`popover-popup`,...u,children:(0,$.jsx)(yr,{className:s(`relative size-full max-h-(--available-height) overflow-clip px-(--viewport-inline-padding) py-4 [--viewport-inline-padding:--spacing(4)] has-data-[slot=calendar]:p-2 data-instant:transition-none **:data-current:data-ending-style:opacity-0 **:data-current:data-starting-style:opacity-0 **:data-previous:data-ending-style:opacity-0 **:data-previous:data-starting-style:opacity-0 **:data-current:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-previous:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-current:opacity-100 **:data-previous:opacity-100 **:data-current:transition-opacity **:data-previous:transition-opacity`,c?`py-1 [--viewport-inline-padding:--spacing(2)]`:`not-data-transitioning:overflow-y-auto`,n),"data-slot":`popover-viewport`,children:e})})})})}function Cr({repos:e,disabled:t,onAdd:n}){let[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(``),s=(0,Q.useMemo)(()=>{let t=a.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||e.path.toLowerCase().includes(t)):e},[e,a]);return(0,$.jsxs)(br,{open:r,onOpenChange:e=>{e&&o(``),i(e)},children:[(0,$.jsx)(xr,{render:(0,$.jsxs)(l,{variant:`outline`,size:`sm`,disabled:t,className:`h-8 text-xs text-muted-foreground`,children:[(0,$.jsx)(Bt,{size:14}),` Add repository`]})}),(0,$.jsxs)(Sr,{align:`end`,className:`w-[320px]`,viewportClassName:`p-0`,children:[(0,$.jsx)(`div`,{className:`border-b border-border p-2`,children:(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(Ue,{className:`absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-muted-foreground`}),(0,$.jsx)(V,{autoFocus:!0,value:a,onChange:e=>o(e.target.value),placeholder:`Search repositories`,className:`pl-8`,"aria-label":`Search repositories`})]})}),(0,$.jsx)(`div`,{role:`listbox`,className:`max-h-64 overflow-y-auto py-1`,children:s.length===0?(0,$.jsx)(`div`,{className:`px-3 py-4 text-center text-sm text-muted-foreground`,children:`No repositories found.`}):s.map(e=>(0,$.jsxs)(`button`,{role:`option`,"aria-selected":!1,onClick:()=>{i(!1),n(e.path)},className:`flex w-full cursor-pointer items-center gap-3 px-3 py-2 text-left transition-colors hover:bg-accent`,children:[(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium`,children:e.name}),(0,$.jsx)(`span`,{className:`block truncate font-mono text-xs text-muted-foreground`,children:e.path})]}),(0,$.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:e.defaultBranch})]},e.path))})]})]})}var wr=(e,t)=>{switch(e){case`antigravity`:return`agy --conversation ${t}`;case`claude`:return`claude --resume ${t}`;case`codex`:return`codex resume ${t}`;case`copilot`:return`copilot --resume ${t}`;case`cursor`:return`cursor-agent --resume ${t}`;default:return`agy --conversation ${t}`}},Tr=e=>{switch(e){case`antigravity`:return(0,$.jsx)(`span`,{className:`grid size-5.5 place-items-center rounded-md bg-card border border-border/80 shadow-2xs p-0.5 shrink-0`,title:`Google Antigravity`,children:(0,$.jsx)(Gt,{className:`size-3.5`})});case`claude`:return(0,$.jsx)(`span`,{className:`grid size-5.5 place-items-center rounded-md bg-[#D97757] text-white font-bold text-[9px] shadow-2xs shrink-0`,title:`Claude Code`,children:(0,$.jsx)(Zt,{className:`size-2.5`})});case`codex`:return(0,$.jsx)(`span`,{className:`grid size-5.5 place-items-center rounded-md bg-foreground text-background font-bold text-[9px] shadow-2xs shrink-0`,title:`OpenAI Codex`,children:(0,$.jsx)(Pt,{className:`size-2.5`})});case`copilot`:return(0,$.jsx)(`span`,{className:`grid size-5.5 place-items-center rounded-md bg-gradient-to-tr from-purple-600 via-indigo-500 to-blue-600 text-white font-bold text-[9px] shadow-2xs shrink-0`,title:`GitHub Copilot`,children:(0,$.jsx)(Ot,{className:`size-2.5`})});default:return null}},Er=e=>{if(!e)return``;let t=new Date(e);return isNaN(t.getTime())?``:new Date().toDateString()===t.toDateString()?`Today ${t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}`:`${t.toLocaleDateString(void 0,{month:`short`,day:`numeric`})} ${t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}`},Dr=({ws:e,sessions:t,sessionsLoading:n,setActiveSession:r,setTranscript:i,fetchSessionTranscript:a,handleOpenDesktopSession:o,showToast:c})=>{let u=kt(),d=_t(),f=He(),p=f.data?.find(e=>e.name===`antigravity`)?.detected??!0,m=!!f.data?.find(e=>e.name===`claude`)?.detected,h=!!f.data?.find(e=>e.name===`codex`)?.detected,g=!!f.data?.find(e=>e.name===`copilot`)?.command,_=!!u.data?.some(e=>e.id===`antigravity`&&e.available),v=!!u.data?.some(e=>e.id===`codex-desktop`&&e.available),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(null),[T,E]=(0,Q.useState)(null),[D,O]=(0,Q.useState)(`created-desc`),[k,A]=(0,Q.useState)(`harness`),[j,M]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(`all`),[F,I]=(0,Q.useState)({antigravity:!1,claude:!1,codex:!1,copilot:!1}),L=e=>{I(t=>({...t,[e]:!t[e]}))},R=(0,Q.useRef)(!1),z=(0,Q.useRef)(null),ee=async t=>{try{await Y(`/api/workspace/${encodeURIComponent(e.branchName)}/launch`,{method:`POST`,body:JSON.stringify({targetId:t})}),c?.(`Launched ${t===`claude-desktop`?`Claude Desktop`:t===`codex-desktop`?`Codex Desktop`:t} for workspace ${e.branchName}`,`success`)}catch(e){let t=e instanceof Error?e.message:`Failed to launch desktop application`;c?.(t,`error`)}},B=async t=>{if(!C){w(t);try{await d.mutateAsync({workspaceId:e.branchName,assistant:t}),E({assistant:t,cmd:t===`antigravity`?`agy`:t===`claude`?`claude`:t===`codex`?`codex`:`copilot`,timestamp:new Date}),c?.(`Started new ${t} session in terminal`,`success`)}catch(e){let t=e instanceof Error?e.message:`Failed to launch terminal`;c?.(t,`error`)}finally{w(null)}}},te=async(t,n,r)=>{if(!R.current){R.current=!0,S(t);try{await d.mutateAsync({workspaceId:e.branchName,sessionId:t,assistant:n,cwd:r});let i=wr(n,t);E({assistant:n,cmd:i,timestamp:new Date}),c?.(`Resumed ${n} session in terminal`,`success`)}catch{let e=wr(n,t);await Qt(e),c?.(`Copied resume command to clipboard: ${e}`,`info`)}finally{S(null),R.current=!1}}},ne=async t=>{if(!(!v||z.current)){z.current=t,b(t);try{await o(e,t,`codex`)}finally{z.current=null,b(null)}}},V=(e,t)=>[...e].sort((e,n)=>{switch(t){case`created-desc`:{let t=new Date(e.createdAt||e.updatedAt||0).getTime();return new Date(n.createdAt||n.updatedAt||0).getTime()-t}case`created-asc`:return new Date(e.createdAt||e.updatedAt||0).getTime()-new Date(n.createdAt||n.updatedAt||0).getTime();case`updated-desc`:{let t=new Date(e.updatedAt||e.createdAt||0).getTime();return new Date(n.updatedAt||n.createdAt||0).getTime()-t}case`messages-desc`:return(n.messageCount||0)-(e.messageCount||0);case`title-asc`:return(e.title||``).localeCompare(n.title||``);default:return 0}}),re=(0,Q.useMemo)(()=>{let e=t;if(N!==`all`&&(e=e.filter(e=>e.assistant===N)),j.trim()){let t=j.toLowerCase();e=e.filter(e=>`${e.title} ${e.id} ${e.assistant}`.toLowerCase().includes(t))}return V(e,D)},[t,N,j,D]),H=(0,Q.useMemo)(()=>V(t.filter(e=>e.assistant===`antigravity`),D),[t,D]),U=(0,Q.useMemo)(()=>V(t.filter(e=>e.assistant===`claude`),D),[t,D]),ie=(0,Q.useMemo)(()=>V(t.filter(e=>e.assistant===`codex`),D),[t,D]),W=(0,Q.useMemo)(()=>V(t.filter(e=>e.assistant===`copilot`),D),[t,D]),G=(0,Q.useCallback)(t=>e.assistants?.includes(t)??!1,[e.assistants]),K=(0,Q.useMemo)(()=>[{id:`antigravity`,name:`Google Antigravity`,cliCommand:`agy`,isDetected:p,isConfigured:G(`antigravity`),hasApp:_,appName:`IDE`,appTargetId:`antigravity`,sessions:H,icon:(0,$.jsx)(`span`,{className:`grid size-6 place-items-center rounded-md bg-card border border-border/80 shadow-2xs p-0.5`,children:(0,$.jsx)(Gt,{className:`size-4`})})},{id:`claude`,name:`Claude Code`,cliCommand:`claude`,isDetected:m,isConfigured:G(`claude`),hasApp:!1,appName:`App`,appTargetId:`claude`,sessions:U,icon:(0,$.jsx)(`span`,{className:`grid size-6 place-items-center rounded-md bg-[#D97757] text-white font-bold text-[10px] shadow-2xs`,children:(0,$.jsx)(Zt,{className:`size-3`})})},{id:`codex`,name:`OpenAI Codex`,cliCommand:`codex`,isDetected:h,isConfigured:G(`codex`),hasApp:v,appName:`Desktop`,appTargetId:`codex-desktop`,sessions:ie,icon:(0,$.jsx)(`span`,{className:`grid size-6 place-items-center rounded-md bg-foreground text-background font-bold text-[10px] shadow-2xs`,children:(0,$.jsx)(Pt,{className:`size-3`})})},{id:`copilot`,name:`GitHub Copilot`,cliCommand:`copilot`,isDetected:g,isConfigured:G(`copilot`),hasApp:!1,appName:`App`,appTargetId:`copilot`,sessions:W,icon:(0,$.jsx)(`span`,{className:`grid size-6 place-items-center rounded-md bg-gradient-to-tr from-purple-600 via-indigo-500 to-blue-600 text-white font-bold text-[10px] shadow-2xs`,children:(0,$.jsx)(Ot,{className:`size-3`})})}],[p,m,h,g,_,v,G,H,U,ie,W]),ae=(0,Q.useMemo)(()=>K.filter(e=>e.isDetected||e.sessions.length>0),[K]);return(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between bg-card/60 p-2 rounded-md border border-border/80`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`relative flex-1 min-w-0 max-w-xs`,children:[(0,$.jsx)(Ue,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 size-3 text-muted-foreground`}),(0,$.jsx)(`input`,{type:`text`,value:j,onChange:e=>M(e.target.value),placeholder:`Search chat sessions...`,className:`w-full pl-7 pr-6 py-1 text-xs rounded border border-border bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus:border-primary`}),j&&(0,$.jsx)(`button`,{type:`button`,onClick:()=>M(``),className:`absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground text-[10px] cursor-pointer`,children:`✕`})]}),(0,$.jsxs)(`div`,{className:`hidden md:flex items-center gap-1`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>P(`all`),className:s(`px-2 py-0.5 text-[11px] rounded font-medium transition-colors cursor-pointer`,N===`all`?`bg-primary text-primary-foreground font-semibold shadow-2xs`:`bg-muted/60 text-muted-foreground hover:text-foreground hover:bg-muted`),children:[`All (`,t.length,`)`]}),ae.map(e=>{let t=e.sessions.length;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>P(N===e.id?`all`:e.id),className:s(`px-2 py-0.5 text-[11px] rounded font-medium capitalize transition-colors cursor-pointer`,N===e.id?`bg-primary text-primary-foreground font-semibold shadow-2xs`:`bg-muted/60 text-muted-foreground hover:text-foreground hover:bg-muted`),children:[e.name.replace(`Google `,``).replace(`OpenAI `,``).replace(`GitHub `,``),` (`,t,`)`]},e.id)})]}),n&&(0,$.jsx)(`span`,{className:`flex items-center gap-1 text-xs text-muted-foreground shrink-0 pl-1`,children:(0,$.jsx)(J,{className:`size-3`})})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,$.jsxs)(Ve,{children:[(0,$.jsxs)(We,{className:`flex items-center gap-1.5 px-2 py-1 text-xs font-medium rounded border border-border bg-card text-foreground hover:bg-accent cursor-pointer shadow-2xs transition-colors`,children:[(0,$.jsx)(ht,{size:11,className:`text-muted-foreground`}),(0,$.jsx)(`span`,{children:{"created-desc":`Newest`,"created-asc":`Oldest`,"updated-desc":`Recently active`,"messages-desc":`Most turns`,"title-asc":`A–Z`}[D]}),(0,$.jsx)(le,{size:10,className:`text-muted-foreground opacity-70`})]}),(0,$.jsxs)(mt,{align:`end`,className:`w-48`,children:[(0,$.jsx)(`div`,{className:`px-2 py-1 text-[10px] font-semibold text-muted-foreground uppercase tracking-wider`,children:`Order Chats By`}),(0,$.jsxs)(sn,{onClick:()=>O(`created-desc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Newest created`}),D===`created-desc`&&(0,$.jsx)(Z,{size:12,className:`text-primary`})]}),(0,$.jsxs)(sn,{onClick:()=>O(`created-asc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Oldest created`}),D===`created-asc`&&(0,$.jsx)(Z,{size:12,className:`text-primary`})]}),(0,$.jsxs)(sn,{onClick:()=>O(`updated-desc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Recently active`}),D===`updated-desc`&&(0,$.jsx)(Z,{size:12,className:`text-primary`})]}),(0,$.jsxs)(sn,{onClick:()=>O(`messages-desc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Most turns`}),D===`messages-desc`&&(0,$.jsx)(Z,{size:12,className:`text-primary`})]}),(0,$.jsxs)(sn,{onClick:()=>O(`title-asc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Title (A–Z)`}),D===`title-asc`&&(0,$.jsx)(Z,{size:12,className:`text-primary`})]})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center rounded border border-border bg-card p-0.5 shadow-2xs`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>A(`harness`),title:`Group chats by AI Harness`,className:s(`px-2 py-0.5 text-xs rounded font-medium transition-colors cursor-pointer`,k===`harness`?`bg-primary text-primary-foreground font-semibold shadow-2xs`:`text-muted-foreground hover:text-foreground`),children:`Grouped`}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>A(`timeline`),title:`Unified Chronological Timeline`,className:s(`px-2 py-0.5 text-xs rounded font-medium transition-colors cursor-pointer`,k===`timeline`?`bg-primary text-primary-foreground font-semibold shadow-2xs`:`text-muted-foreground hover:text-foreground`),children:`Timeline`})]})]})]}),T&&(0,$.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 p-2.5 rounded-md bg-emerald-500/10 border border-emerald-500/30 text-xs animate-fade-in`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-foreground min-w-0`,children:[(0,$.jsx)(`span`,{className:`size-2 rounded-full bg-emerald-500 animate-pulse shrink-0`}),(0,$.jsxs)(`span`,{className:`truncate`,children:[(0,$.jsx)(`strong`,{children:`Active in terminal:`}),` `,(0,$.jsx)(`code`,{className:`font-mono bg-background/80 px-1.5 py-0.5 rounded text-emerald-400`,children:T.cmd})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:async()=>{await Qt(T.cmd),c?.(`Command copied to clipboard!`,`success`)},className:`inline-flex items-center gap-1 px-2.5 py-1 text-xs font-medium rounded border border-emerald-500/40 bg-emerald-500/15 text-emerald-400 hover:bg-emerald-500/25 transition-colors cursor-pointer`,children:[(0,$.jsx)(rt,{size:11}),` Copy`]}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>E(null),className:`text-muted-foreground hover:text-foreground cursor-pointer text-xs px-1`,title:`Dismiss banner`,children:`✕`})]})]}),k===`timeline`?(0,$.jsx)(pn,{className:`divide-y divide-border overflow-hidden surface-card`,children:re.length===0?(0,$.jsx)(`div`,{className:`py-8 text-center text-xs text-muted-foreground`,children:j?`No chat sessions match your search filter.`:`No chat sessions recorded yet.`}):re.map(e=>(0,$.jsxs)(`div`,{className:`group flex flex-col gap-2 p-3 hover:bg-accent/40 transition-colors sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 flex-1`,children:[Tr(e.assistant),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-muted-foreground mb-0.5`,children:[(0,$.jsx)(`span`,{className:`font-semibold capitalize text-foreground`,children:e.assistant===`antigravity`?`Antigravity`:e.assistant===`claude`?`Claude`:e.assistant===`codex`?`Codex`:`Copilot`}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsx)(`span`,{className:`font-mono text-muted-foreground/80`,children:e.id.slice(0,8)}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsx)(`span`,{children:Er(e.createdAt||e.updatedAt)}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsxs)(`span`,{className:`font-mono`,children:[e.messageCount,` `,e.messageCount===1?`turn`:`turns`]})]}),(0,$.jsx)(`p`,{className:`text-xs font-semibold text-foreground truncate`,title:e.title,children:e.title})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0 pl-8 sm:pl-0`,children:[(0,$.jsxs)(l,{size:`xs`,variant:`default`,disabled:x===e.id,onClick:()=>void te(e.id,e.assistant,e.workspacePath),title:`Resume session in terminal (${e.id})`,children:[x===e.id?(0,$.jsx)(J,{className:`size-3`}):(0,$.jsx)(ft,{size:12}),(0,$.jsx)(`span`,{children:`Resume`})]}),(0,$.jsxs)(l,{size:`xs`,variant:`outline`,onClick:()=>{r(e),i([]),a(e.assistant,e.id)},title:`Inspect transcript log`,children:[(0,$.jsx)(at,{size:12}),(0,$.jsx)(`span`,{children:`Logs`})]}),e.assistant===`codex`&&v&&(0,$.jsxs)(l,{size:`xs`,variant:`outline`,disabled:y===e.id,onClick:()=>void ne(e.id),title:`Open in Codex Desktop`,children:[y===e.id?(0,$.jsx)(J,{className:`size-3`}):(0,$.jsx)(qe,{size:12}),(0,$.jsx)(`span`,{children:`Desktop`})]}),(0,$.jsx)(l,{size:`icon-xs`,variant:`ghost`,onClick:async()=>{let t=wr(e.assistant,e.id);await Qt(t),c?.(`Copied: ${t}`,`success`)},title:`Copy CLI resume command`,children:(0,$.jsx)(rt,{size:12})})]})]},e.id))}):(0,$.jsx)(`div`,{className:`space-y-2.5`,children:ae.map(e=>{let t=F[e.id]??!1,n=e.sessions.filter(e=>{if(!j.trim())return!0;let t=j.toLowerCase();return`${e.title} ${e.id}`.toLowerCase().includes(t)});return(0,$.jsxs)(pn,{className:`overflow-hidden surface-card`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 p-3 sm:flex-row sm:items-center sm:justify-between bg-muted/20 hover:bg-muted/35 transition-colors cursor-pointer select-none`,onClick:()=>L(e.id),children:[(0,$.jsxs)(`div`,{className:`flex flex-1 items-center gap-2.5 min-w-0`,children:[(0,$.jsx)(`span`,{className:`text-muted-foreground transition-transform`,children:t?(0,$.jsx)(le,{size:14}):(0,$.jsx)(de,{size:14})}),e.icon,(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 min-w-0`,children:[(0,$.jsx)(`span`,{className:`font-bold text-xs text-foreground`,children:e.name}),(0,$.jsxs)(nn,{tone:e.isDetected?`success`:`neutral`,dot:e.isDetected,children:[`CLI: `,e.cliCommand]}),e.hasApp&&(0,$.jsx)(nn,{tone:`running`,children:e.appName}),(0,$.jsxs)(`span`,{className:`text-[11px] text-muted-foreground font-mono`,children:[`(`,n.length,`)`]})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0 pl-6 sm:pl-0`,onClick:e=>e.stopPropagation(),children:[(0,$.jsxs)(l,{size:`xs`,variant:`default`,disabled:C===e.id,onClick:()=>void B(e.id),title:`Launch new ${e.cliCommand} session in terminal`,children:[C===e.id?(0,$.jsx)(J,{className:`size-3`}):(0,$.jsx)(Bt,{size:12}),(0,$.jsx)(`span`,{children:`New Session`})]}),e.hasApp&&(0,$.jsxs)(l,{size:`xs`,variant:`outline`,onClick:()=>void ee(e.appTargetId),title:`Open in ${e.appName}`,children:[(0,$.jsx)(qe,{size:12}),(0,$.jsx)(`span`,{children:e.appName})]})]})]}),t&&(0,$.jsx)(`div`,{className:`divide-y divide-border/60 border-t border-border`,children:n.length===0?(0,$.jsxs)(`div`,{className:`p-4 text-center text-xs text-muted-foreground flex items-center justify-center gap-2`,children:[(0,$.jsx)(`span`,{children:j?`No sessions match your search query.`:`No previous sessions recorded for ${e.name}.`}),!j&&(0,$.jsxs)(`button`,{type:`button`,onClick:()=>void B(e.id),className:`text-primary font-semibold hover:underline cursor-pointer inline-flex items-center gap-1 text-xs`,children:[(0,$.jsx)(Bt,{size:11}),` Start session`]})]}):n.map(e=>(0,$.jsxs)(`div`,{className:`group flex flex-col gap-1.5 px-3.5 py-2.5 hover:bg-accent/40 transition-colors sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 mb-0.5 text-[11px] text-muted-foreground font-mono`,children:[(0,$.jsx)(`span`,{children:e.id.slice(0,8)}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsx)(`span`,{children:Er(e.createdAt||e.updatedAt)}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsxs)(`span`,{children:[e.messageCount,` `,e.messageCount===1?`turn`:`turns`]})]}),(0,$.jsx)(`p`,{className:`text-xs font-semibold text-foreground truncate`,title:e.title,children:e.title})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,$.jsxs)(l,{size:`xs`,variant:`default`,disabled:x===e.id,onClick:()=>void te(e.id,e.assistant,e.workspacePath),title:`Resume session in terminal (${e.id})`,children:[x===e.id?(0,$.jsx)(J,{className:`size-3`}):(0,$.jsx)(ft,{size:12}),(0,$.jsx)(`span`,{children:`Resume`})]}),(0,$.jsxs)(l,{size:`xs`,variant:`outline`,onClick:()=>{r(e),i([]),a(e.assistant,e.id)},title:`Inspect transcript log`,children:[(0,$.jsx)(at,{size:12}),(0,$.jsx)(`span`,{children:`Logs`})]}),e.assistant===`codex`&&v&&(0,$.jsxs)(l,{size:`xs`,variant:`outline`,disabled:y===e.id,onClick:()=>void ne(e.id),title:`Open in Codex Desktop`,children:[y===e.id?(0,$.jsx)(J,{className:`size-3`}):(0,$.jsx)(qe,{size:12}),(0,$.jsx)(`span`,{children:`Desktop`})]}),(0,$.jsx)(l,{size:`icon-xs`,variant:`ghost`,onClick:async()=>{let t=wr(e.assistant,e.id);await Qt(t),c?.(`Copied: ${t}`,`success`)},title:`Copy CLI resume command`,children:(0,$.jsx)(rt,{size:12})})]})]},e.id))})]},e.id)})})]})},Or=({ws:e,gitChanges:t,gitChangesLoading:n,syncLoading:r,syncResults:i,commitMessage:a,showCommitModal:o,commitLoading:c,commitResults:u,setSyncResults:d,setCommitResults:f,setCommitMessage:p,setShowCommitModal:m,fetchGitChanges:h,handleSyncAll:g,handleCommitAll:_})=>{let[v,y]=(0,Q.useState)({}),[b,x]=(0,Q.useState)({}),[S,C]=(0,Q.useState)({}),[w,T]=(0,Q.useState)({}),[E,D]=(0,Q.useState)({}),[O,k]=(0,Q.useState)(``),A=e=>v[e]??!0,j=e=>{y(t=>({...t,[e]:!A(e)}))},M=()=>{let e={};t.forEach(t=>{e[t.repoName]=!1}),y(e)},N=()=>{let e={};t.forEach(t=>{e[t.repoName]=!0}),y(e),x({})},P=async(t,n)=>{let r=`${t}/${n}`,i=!b[r];if(x(e=>({...e,[r]:i})),i&&!S[r]){T(e=>({...e,[r]:!0})),D(e=>({...e,[r]:``}));try{let i=encodeURIComponent(e.branchName),a=await fetch(`/api/workspace/${i}/changes/diff?repo=${encodeURIComponent(t)}&file=${encodeURIComponent(n)}`);if(!a.ok)throw Error(`Failed to load diff: ${a.statusText}`);let o=await a.json();C(e=>({...e,[r]:o.diff||``}))}catch(e){D(t=>({...t,[r]:e.message||`Unknown error`}))}finally{T(e=>({...e,[r]:!1}))}}},F=e=>{if(!e||!e.trim())return(0,$.jsx)(`div`,{className:`p-3 font-mono text-[11px] italic text-muted-foreground`,children:`No diff details available.`});let t=e.split(`
2
+ `);return(0,$.jsx)(`pre`,{className:`custom-scrollbar max-h-[450px] overflow-x-auto overflow-y-auto rounded-xl border border-border bg-muted/40 p-4 font-mono text-[11px] leading-relaxed text-muted-foreground select-text`,children:t.map((e,t)=>{let n;return n=e.startsWith(`+`)&&!e.startsWith(`+++`)?`block w-full rounded-sm bg-success/10 px-1 text-success-foreground`:e.startsWith(`-`)&&!e.startsWith(`---`)?`block w-full rounded-sm bg-destructive/10 px-1 text-destructive-foreground`:e.startsWith(`@@`)?`block w-full bg-info/10 px-1 font-semibold italic text-info-foreground`:e.startsWith(`diff`)||e.startsWith(`index`)||e.startsWith(`---`)||e.startsWith(`+++`)?`block w-full font-bold text-muted-foreground`:`block w-full px-1 text-foreground`,(0,$.jsx)(`code`,{className:n,children:e},t)})})},I=t.filter(e=>e.files&&e.files.length>0),L=I.reduce((e,t)=>e+t.files.length,0);return(0,$.jsxs)(`div`,{className:`animate-fade-in`,children:[(0,$.jsxs)(`header`,{className:`flex justify-between items-center mb-6 flex-wrap gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,$.jsxs)(`h4`,{className:`flex items-center gap-2 text-sm font-bold text-foreground`,children:[(0,$.jsx)(lt,{size:16,className:`text-primary`}),` Active Workspace Git Diffs`]}),I.length>0&&(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 pl-2 border-l border-border/80`,children:[(0,$.jsxs)(l,{variant:`ghost`,size:`xs`,onClick:N,title:`Collapse all repositories and file diffs`,className:`text-xs text-muted-foreground hover:text-foreground h-7 px-2 gap-1 font-semibold`,children:[(0,$.jsx)(vn,{size:12}),(0,$.jsx)(`span`,{children:`Collapse All`})]}),(0,$.jsxs)(l,{variant:`ghost`,size:`xs`,onClick:M,title:`Expand all repositories`,className:`text-xs text-muted-foreground hover:text-foreground h-7 px-2 gap-1 font-semibold`,children:[(0,$.jsx)(yn,{size:12}),(0,$.jsx)(`span`,{children:`Expand All`})]})]})]}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsxs)(l,{variant:`outline`,size:`sm`,onClick:()=>h(e.branchName),disabled:n,children:[(0,$.jsx)(ct,{size:11,className:n?`animate-spin text-primary`:``}),` Refresh Changes`]}),e.mode!==`in-place`&&(0,$.jsxs)(l,{variant:`outline`,size:`sm`,onClick:()=>g(e.branchName),disabled:r,children:[r?(0,$.jsx)(J,{className:`size-3`}):(0,$.jsx)(ct,{size:11}),` Sync All`]}),(0,$.jsx)(l,{size:`sm`,onClick:()=>m(!0),disabled:L===0||c,children:`Commit & Push All`})]})]}),i&&e.mode!==`in-place`&&(0,$.jsxs)(`div`,{className:`relative mb-5 rounded-xl border border-info/25 bg-info/10 p-5 text-info-foreground shadow-sm`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between border-b border-info/20 pb-2`,children:[(0,$.jsx)(`h5`,{className:`font-mono text-xs font-bold text-foreground`,children:`Rebase / Sync Action Logs`}),(0,$.jsx)(`button`,{className:`cursor-pointer text-[10px] font-bold text-info-foreground hover:text-foreground`,onClick:()=>d(null),children:`Dismiss`})]}),(0,$.jsx)(`div`,{className:`space-y-2`,children:i.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-border bg-card p-2 font-mono text-[10px]`,children:[(0,$.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.repoName}),(0,$.jsx)(`span`,{className:e.success?`font-bold text-success-foreground`:`font-bold text-destructive-foreground`,children:e.success?`✓ Synced (${e.message})`:`✗ Conflict: ${e.message}`})]},e.repoName))})]}),u&&(0,$.jsxs)(`div`,{className:`relative mb-5 rounded-xl border border-success/25 bg-success/10 p-5 text-success-foreground shadow-sm`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between border-b border-success/20 pb-2`,children:[(0,$.jsx)(`h5`,{className:`font-mono text-xs font-bold text-foreground`,children:`Commit & Push Results`}),(0,$.jsx)(`button`,{className:`cursor-pointer text-[10px] font-bold text-success-foreground hover:text-foreground`,onClick:()=>f(null),children:`Dismiss`})]}),(0,$.jsx)(`div`,{className:`space-y-2`,children:u.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-border bg-card p-2 font-mono text-[10px]`,children:[(0,$.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.repoName}),(0,$.jsx)(`span`,{className:e.success?`font-bold text-success-foreground`:`font-bold text-destructive-foreground`,children:e.success?`✓ Committed ${e.filesChanged} file(s) (${e.commitHash?e.commitHash.slice(0,7):`no hash`})`:`✗ Error: ${e.message}`})]},e.repoName))})]}),o&&(0,$.jsxs)(`div`,{className:`relative mb-6 rounded-xl border border-border bg-card p-6 shadow-sm animate-rise`,children:[(0,$.jsxs)(`h5`,{className:`mb-3 flex items-center gap-1.5 text-xs font-bold text-foreground`,children:[(0,$.jsx)(Pn,{size:13,className:`text-primary`}),` Enter Commit Message`]}),(0,$.jsx)(V,{type:`text`,className:`mb-4 font-mono text-xs`,placeholder:`feat: implement multi-repo logic...`,value:a,onChange:e=>p(e.target.value),onKeyDown:t=>{t.key===`Enter`&&a.trim()&&_(e.branchName)}}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2.5`,children:[(0,$.jsx)(l,{variant:`outline`,size:`sm`,onClick:()=>{m(!1),p(``)},disabled:c,children:`Cancel`}),(0,$.jsxs)(l,{size:`sm`,onClick:()=>_(e.branchName),disabled:c||!a.trim(),children:[c?(0,$.jsx)(J,{className:`size-3`}):null,c?`Committing...`:`Commit & Push All`]})]})]}),n?(0,$.jsx)(`div`,{className:`flex justify-center py-20`,children:(0,$.jsx)(J,{className:`size-6 text-primary`})}):(0,$.jsx)(`div`,{className:`space-y-4`,children:I.length===0?(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center rounded-xl border border-border bg-card py-16 text-center shadow-xs`,children:[(0,$.jsx)(`div`,{className:`mb-3 flex h-10 w-10 items-center justify-center rounded-full border border-success/25 bg-success/10 text-success-foreground shadow-sm`,children:(0,$.jsx)(Z,{size:20})}),(0,$.jsx)(`h5`,{className:`text-sm font-bold text-foreground`,children:`No Uncommitted Changes`}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Workspace repositories are completely in sync with Git feature branches.`})]}):I.map(e=>{let t=e.files.length,n=e.files.reduce((e,t)=>e+(t.additions||0),0),r=e.files.reduce((e,t)=>e+(t.deletions||0),0),i=A(e.repoName);return(0,$.jsxs)(`div`,{className:`relative rounded-xl border border-border/80 bg-card/80 backdrop-blur-md transition-all shadow-xs overflow-hidden`,children:[(0,$.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:()=>j(e.repoName),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),j(e.repoName))},className:s(`flex justify-between items-center px-5 py-4 cursor-pointer select-none transition-colors`,i?`hover:bg-accent/40`:`bg-muted/20 border-b border-border/60 hover:bg-muted/30`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap min-w-0`,children:[(0,$.jsx)(`span`,{className:`grid size-6 place-items-center rounded-md bg-primary/10 text-primary border border-primary/20 shrink-0`,children:i?(0,$.jsx)(de,{size:14,className:`shrink-0 text-muted-foreground`}):(0,$.jsx)(le,{size:14,className:`shrink-0 text-primary`})}),(0,$.jsx)(`h5`,{className:`font-mono text-sm font-bold text-foreground truncate`,children:e.repoName}),(0,$.jsxs)(nn,{tone:`warning`,dot:!1,children:[t,` file`,t===1?``:`s`,` changed`]}),(n>0||r>0)&&(0,$.jsxs)(`span`,{className:`rounded-md border border-border bg-muted/60 px-2 py-0.5 font-mono text-[10px] font-bold`,children:[(0,$.jsxs)(`span`,{className:`font-bold text-success-foreground`,children:[`+`,n]}),` `,(0,$.jsxs)(`span`,{className:`font-bold text-destructive-foreground`,children:[`-`,r]})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3 shrink-0`,children:[(0,$.jsx)(`span`,{className:`max-w-[280px] truncate font-mono text-[10px] text-muted-foreground hidden md:inline`,title:e.repoPath,children:e.repoPath}),(0,$.jsx)(`span`,{className:`text-[11px] font-bold text-primary hover:underline`,children:i?`Expand Files`:`Collapse`})]})]}),!i&&(0,$.jsx)(`div`,{className:`p-5 flex flex-col gap-3 bg-card/40`,children:e.files.map(t=>{let n=`${e.repoName}/${t.file}`,r=!!b[n],i=!!w[n],a=S[n]||``,o=E[n]||``;return(0,$.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-border/80 bg-muted/20 transition-colors hover:border-primary/30 shadow-2xs`,children:[(0,$.jsxs)(`div`,{className:`flex cursor-pointer select-none items-center justify-between px-4 py-3 transition-colors hover:bg-accent/50`,onClick:()=>P(e.repoName,t.file),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[r?(0,$.jsx)(le,{size:14,className:`shrink-0 text-primary`}):(0,$.jsx)(de,{size:14,className:`shrink-0 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`max-w-[240px] truncate font-mono text-[11px] text-foreground sm:max-w-[480px] font-semibold`,title:t.file,children:t.file}),(t.additions>0||t.deletions>0)&&(0,$.jsxs)(`span`,{className:`ml-1 shrink-0 font-mono text-[9px] font-bold text-muted-foreground`,children:[(0,$.jsxs)(`span`,{className:`text-success-foreground`,children:[`+`,t.additions]}),` /`,` `,(0,$.jsxs)(`span`,{className:`text-destructive-foreground`,children:[`-`,t.deletions]})]})]}),(0,$.jsx)(`div`,{className:`flex items-center gap-2.5 shrink-0`,children:(0,$.jsx)(`span`,{className:`rounded border px-2 py-0.5 text-[8px] font-bold uppercase tracking-wider ${t.type===`added`?`border-success/25 bg-success/10 text-success-foreground`:t.type===`deleted`?`border-destructive/25 bg-destructive/10 text-destructive-foreground`:`border-warning/25 bg-warning/10 text-warning-foreground`}`,children:t.type})})]}),r&&(0,$.jsx)(`div`,{className:`border-t border-border bg-background p-3`,children:i?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 p-2 font-mono text-[10px] text-primary`,children:[(0,$.jsx)(J,{className:`size-3`}),` Loading diff...`]}):o?(0,$.jsxs)(`div`,{className:`p-2 font-mono text-[10px] text-destructive-foreground`,children:[`Error: `,o]}):(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,$.jsx)(`button`,{onClick:e=>{e.stopPropagation(),navigator.clipboard.writeText(a),k(n),setTimeout(()=>k(``),2e3)},className:`cursor-pointer rounded-lg border border-border bg-card p-1.5 text-muted-foreground shadow-sm transition-colors hover:bg-accent hover:text-foreground`,title:`Copy Diff`,children:O===n?(0,$.jsx)(Z,{size:12,className:`text-success-foreground`}):(0,$.jsx)(rt,{size:12})})}),F(a)]})})]},t.file)})})]},e.repoName)})})]})},kr=({ws:e,knowledgeContent:t,knowledgeLoading:n,knowledgeError:r,isEditingKnowledge:i,editedKnowledge:a,saveKnowledgeLoading:o,saveKnowledgeError:s,setEditedKnowledge:c,setIsEditingKnowledge:u,handleSaveKnowledge:d,handleRetryKnowledge:f})=>{let[p,m]=(0,Q.useState)(`preview`);return(0,$.jsxs)(`div`,{className:`rounded-xl border border-border/80 bg-card/70 backdrop-blur-md p-5 shadow-xs`,children:[(0,$.jsxs)(`header`,{className:`flex justify-between items-center mb-4`,children:[(0,$.jsxs)(`h4`,{className:`flex items-center gap-2 text-sm font-bold text-foreground`,children:[(0,$.jsx)(Ze,{size:16,className:`text-primary`}),` Persistent Knowledge Memory (contextspace-knowledge.md)`]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!i&&t&&(0,$.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted/50 p-0.5 rounded-md border border-border/60`,children:[(0,$.jsxs)(l,{size:`xs`,variant:p===`preview`?`secondary`:`ghost`,onClick:()=>m(`preview`),className:`text-[11px] gap-1 px-2`,children:[(0,$.jsx)(ue,{size:11}),` Preview`]}),(0,$.jsxs)(l,{size:`xs`,variant:p===`raw`?`secondary`:`ghost`,onClick:()=>m(`raw`),className:`text-[11px] gap-1 px-2`,children:[(0,$.jsx)(wn,{size:11}),` Raw`]})]}),i?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(l,{variant:`outline`,size:`xs`,onClick:()=>{c(t),u(!1)},disabled:o,children:`Cancel`}),(0,$.jsxs)(l,{size:`xs`,onClick:()=>d(e.branchName),disabled:o,children:[o?(0,$.jsx)(J,{className:`size-3`}):(0,$.jsx)(Pn,{size:10}),` `,s?`Retry save`:`Save`]})]}):(0,$.jsxs)(l,{variant:`outline`,size:`xs`,onClick:()=>u(!0),disabled:n,children:[(0,$.jsx)(In,{size:10}),` Edit Knowledge`]})]})]}),r&&(0,$.jsxs)(`div`,{role:`alert`,className:`mb-4 flex flex-wrap items-center justify-between gap-3 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive-foreground`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(cn,{size:14,className:`shrink-0`}),(0,$.jsx)(`span`,{children:r})]}),(0,$.jsxs)(l,{variant:`outline`,size:`xs`,onClick:()=>void f(e.branchName),disabled:n,children:[(0,$.jsx)(ct,{size:11,className:n?`animate-spin`:``}),` Retry load`]})]}),s&&(0,$.jsxs)(`div`,{role:`alert`,className:`mb-4 flex items-center gap-2 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive-foreground`,children:[(0,$.jsx)(cn,{size:14,className:`shrink-0`}),(0,$.jsx)(`span`,{children:s})]}),i?(0,$.jsx)(qt,{"aria-label":`Knowledge editor`,className:`[&_[data-slot=textarea]]:h-96 [&_[data-slot=textarea]]:resize-y [&_[data-slot=textarea]]:font-mono [&_[data-slot=textarea]]:text-xs`,value:a,onChange:e=>c(e.target.value)}):n&&!t?(0,$.jsx)(`div`,{className:`flex justify-center py-10`,children:(0,$.jsx)(ct,{className:`animate-spin text-primary`,size:20})}):t?p===`preview`?(0,$.jsx)(`div`,{className:`max-h-[550px] overflow-auto rounded-xl border border-border/70 bg-card/40 backdrop-blur-xs p-4`,children:(0,$.jsx)(ln,{content:t})}):(0,$.jsx)(`div`,{className:`max-h-[550px] overflow-auto whitespace-pre-wrap rounded-xl border border-border/70 bg-card/40 backdrop-blur-xs p-4 font-mono text-xs leading-relaxed text-muted-foreground`,children:t}):(0,$.jsx)(`div`,{className:`rounded-md border border-dashed border-border/80 bg-muted/20 p-6 text-center text-xs text-muted-foreground`,children:`No knowledge file generated yet.`})]})},Ar=({planContent:e,planLoading:t,planError:n,handleRetryPlan:r,workspaceId:i,defaultViewMode:a=`flow`})=>{let[o,s]=(0,Q.useState)(a),[c,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{a&&s(a)},[a]);let T=(0,Q.useCallback)(async()=>{if(i){m(!0);try{let e=await Y(`/api/workspace/${encodeURIComponent(i)}/lifecycle`);f(e.lifecycle),e.plan!==void 0&&u(e.plan),e.report!==void 0&&b(e.report)}catch(e){console.warn(`Could not load workspace lifecycle:`,e)}finally{m(!1)}}},[i]);(0,Q.useEffect)(()=>{u(null),b(null),v(null),T()},[T]);let E=async()=>{if(i){g(!0),v(null);try{let e=(await Y(`/api/workspace/${encodeURIComponent(i)}/verify`,{method:`POST`,body:JSON.stringify({})})).report;b(e);let t={pass:`Tests passed (${(e.durationMs/1e3).toFixed(1)}s, ${e.repos.length} repositories). Use Verify & Complete on the active gate to advance.`,pass_dirty:e.canProgress?`Tests passed with uncommitted changes. Review the changes before continuing.`:`Tests passed with uncommitted changes. Commit them and rerun verification before advancing.`,"no-tests":`No test command was found. Configure a verification command for this workspace and run it again.`,timeout:`Verification timed out. Check the command and output below, then retry.`,fail:`Verification failed. Review the repository details below, fix the problem, and retry.`,skipped:`Verification was skipped. Run verification before relying on a test result.`};v({status:e.overallStatus,text:t[e.overallStatus]}),await T()}catch(e){v({status:`fail`,text:`Verification failed: ${e.message}`})}finally{g(!1)}}},D=async(e,t)=>{if(i){S(e),v(null);try{let n=await Y(`/api/workspace/${encodeURIComponent(i)}/lifecycle/step`,{method:`POST`,body:JSON.stringify({stepId:e,action:t})});f(n.lifecycle),await T()}catch(e){v({status:`fail`,text:e instanceof Error?e.message:`Unable to advance lifecycle.`}),await T()}finally{S(null)}}},O=/<!-- CONTEXTSPACE:MILESTONES:START -->[\s\S]*?<!-- CONTEXTSPACE:MILESTONES:END -->/,k=c?O.test(e)?e.replace(O,()=>c):`${c}\n\n${e}`:e;return(0,$.jsxs)(`div`,{className:`rounded-xl border border-border/80 bg-card/70 backdrop-blur-md p-5 shadow-xs`,children:[(0,$.jsxs)(`header`,{className:`flex flex-wrap justify-between items-center gap-3 mb-5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(un,{size:18,className:`text-primary`}),(0,$.jsx)(`h4`,{className:`text-sm font-bold text-foreground`,children:`Lifecycle Flow & Implementation Plan`}),d&&(0,$.jsxs)(`span`,{className:`px-2 py-0.5 text-[11px] font-semibold rounded-full bg-primary/10 text-primary border border-primary/20 uppercase tracking-wider`,children:[d.flowType,` flow`]})]}),(0,$.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted/50 p-0.5 rounded-md border border-border/60`,children:[(0,$.jsxs)(l,{size:`xs`,variant:o===`flow`?`secondary`:`ghost`,onClick:()=>s(`flow`),className:`text-[11px] gap-1 px-2.5 font-medium`,children:[(0,$.jsx)(un,{size:12}),` Visual Flow`]}),(0,$.jsxs)(l,{size:`xs`,variant:o===`preview`?`secondary`:`ghost`,onClick:()=>s(`preview`),className:`text-[11px] gap-1 px-2.5`,children:[(0,$.jsx)(ue,{size:12}),` Markdown Plan`]}),(0,$.jsxs)(l,{size:`xs`,variant:o===`raw`?`secondary`:`ghost`,onClick:()=>s(`raw`),className:`text-[11px] gap-1 px-2`,children:[(0,$.jsx)(wn,{size:12}),` Raw`]})]})})]}),_&&(0,$.jsxs)(`div`,{role:`status`,className:`mb-4 flex items-center justify-between p-3 rounded-lg text-xs font-medium border ${_.status===`pass`?`bg-emerald-500/10 text-emerald-400 border-emerald-500/30`:[`pass_dirty`,`no-tests`,`skipped`].includes(_.status)?`bg-amber-500/10 text-amber-400 border-amber-500/30`:`bg-rose-500/10 text-rose-400 border-rose-500/30`}`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[_.status===`pass`?(0,$.jsx)(xn,{size:15}):([`pass_dirty`,`no-tests`,`skipped`].includes(_.status),(0,$.jsx)(cn,{size:15})),(0,$.jsx)(`span`,{children:_.text})]}),(0,$.jsx)(l,{size:`xs`,variant:`ghost`,onClick:()=>v(null),className:`text-[10px] h-6 px-1.5`,children:`Dismiss`})]}),y&&(0,$.jsxs)(`details`,{className:`mb-4 rounded-lg border border-border p-3 text-xs`,open:y.overallStatus!==`pass`,children:[(0,$.jsxs)(`summary`,{className:`cursor-pointer font-medium`,children:[`Verification details (`,y.overallStatus.replaceAll(`_`,` `),`)`]}),y.repos.map((e,t)=>(0,$.jsxs)(`div`,{className:`mt-3 space-y-2 border-t border-border pt-3`,children:[(0,$.jsxs)(`p`,{className:`font-semibold`,children:[e.repoName,`: `,e.status.replaceAll(`_`,` `)]}),(0,$.jsxs)(`p`,{className:`font-mono break-all`,children:[e.command,e.exitCode===null?``:` — exit code ${e.exitCode}`]}),e.status===`no-tests`&&(0,$.jsx)(`p`,{children:`No test command found. Configure a workspace verification command.`}),e.status===`timeout`&&(0,$.jsx)(`p`,{children:`The command exceeded its time limit. Check for a stalled test or split the suite, then retry.`}),e.error&&(0,$.jsx)(`p`,{className:`text-destructive`,children:e.error}),(e.stdout||e.stderr)&&(0,$.jsx)(`pre`,{className:`max-h-64 overflow-auto whitespace-pre-wrap break-words rounded bg-muted p-3`,children:[e.stdout,e.stderr].filter(Boolean).join(`
3
+ `)})]},`${e.repoName}-${t}`))]}),n&&(0,$.jsxs)(`div`,{role:`alert`,className:`mb-4 flex flex-wrap items-center justify-between gap-3 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive-foreground`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(cn,{size:14,className:`shrink-0`}),(0,$.jsx)(`span`,{children:n})]}),i&&(0,$.jsxs)(l,{variant:`outline`,size:`xs`,onClick:()=>void r(i),disabled:t,children:[(0,$.jsx)(ct,{size:11,className:t?`animate-spin`:``}),` Retry load`]})]}),o===`flow`?(0,$.jsxs)(`div`,{className:`space-y-6`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 p-3 rounded-lg bg-muted/30 border border-border/50`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(`span`,{className:`font-semibold text-foreground`,children:`Active Step:`}),(0,$.jsx)(`span`,{className:`font-mono text-primary bg-primary/10 px-2 py-0.5 rounded text-[11px]`,children:d?.currentStepId??`none`})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)(l,{size:`xs`,variant:`outline`,onClick:()=>void T(),disabled:p,className:`gap-1 text-xs`,children:[(0,$.jsx)(ct,{size:12,className:p?`animate-spin`:``}),`Refresh Radar`]}),(0,$.jsxs)(l,{size:`xs`,variant:`default`,onClick:()=>void E(),disabled:h||x!==null,className:`gap-1.5 text-xs bg-emerald-600 hover:bg-emerald-700 text-white font-medium`,children:[(0,$.jsx)(fe,{size:14,className:h?`animate-spin`:``}),h?`Running Tests...`:`Run Mechanical Gate`]})]})]}),(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsx)(`div`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider`,children:`Vertical Slices & Milestones`}),(0,$.jsx)(`div`,{className:`grid gap-3`,children:d?.steps.map((e,t)=>{let n=e.id===d.currentStepId,r=e.requiresVerification||e.verificationCommand||e.lastVerificationStatus||[`verify_and_ship`,`step_verification`,`epic_slice_4`].includes(e.id);return(0,$.jsx)(`div`,{className:`relative p-4 rounded-xl border transition-all ${e.status===`completed`?`border-emerald-500/30 bg-emerald-500/5`:e.status===`verified`?`border-cyan-500/40 bg-cyan-500/5`:n||e.status===`in_progress`?`border-primary/50 bg-primary/5 ring-1 ring-primary/20 shadow-xs`:e.status===`blocked`?`border-border/40 bg-muted/10 opacity-75`:`border-border/70 bg-card/40`}`,children:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsx)(`div`,{className:`mt-0.5 shrink-0`,children:e.status===`completed`?(0,$.jsx)(xn,{size:18,className:`text-emerald-400`}):e.status===`verified`?(0,$.jsx)(fe,{size:18,className:`text-cyan-400`}):e.status===`in_progress`?(0,$.jsx)(Sn,{size:18,className:`text-primary animate-pulse`}):e.status===`blocked`?(0,$.jsx)(On,{size:18,className:`text-muted-foreground/60`}):(0,$.jsx)(Cn,{size:18,className:`text-amber-400/80`})}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`span`,{className:`text-xs font-bold text-muted-foreground`,children:[`Slice `,t+1,`:`]}),(0,$.jsx)(`h5`,{className:`text-sm font-semibold text-foreground`,children:e.title}),e.status===`blocked`&&(0,$.jsxs)(`p`,{className:`w-full text-xs text-amber-500`,children:[`Blocked: `,e.unblockCondition||(e.dependsOn?.length?`Complete ${e.dependsOn.map(e=>d.steps.find(t=>t.id===e)?.title??e).join(`, `)}.`:`Set an unblock condition in Edit milestones.`)]}),e.owner&&(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded text-[10px] font-medium bg-muted text-muted-foreground`,children:[(0,$.jsx)(Ln,{size:10}),` `,e.owner]}),e.repo&&(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Repo: `,e.repo]}),e.workItem&&(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground break-all`,children:[`Work item / PR: `,e.workItem]}),e.branch&&(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded text-[10px] font-mono text-cyan-400 bg-cyan-500/10 border border-cyan-500/20`,children:[(0,$.jsx)(xe,{size:10}),` `,e.branch]})]}),e.description&&(0,$.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground leading-relaxed`,children:e.description}),e.dependsOn&&e.dependsOn.length>0&&(0,$.jsxs)(`div`,{className:`mt-2 flex items-center gap-1.5 text-[11px] text-muted-foreground/80`,children:[(0,$.jsx)(`span`,{className:`font-semibold`,children:`Depends on:`}),e.dependsOn.map(e=>(0,$.jsx)(`span`,{className:`px-1.5 py-0.2 bg-muted/60 rounded text-[10px] font-mono`,children:e},e))]}),e.lastVerificationStatus&&(0,$.jsxs)(`div`,{className:`mt-2 inline-flex items-center gap-1.5 text-[11px] font-medium px-2 py-0.5 rounded border ${e.lastVerificationStatus===`pass`?`text-emerald-400 bg-emerald-500/10 border-emerald-500/20`:`text-amber-400 bg-amber-500/10 border-amber-500/20`}`,children:[(0,$.jsx)(fe,{size:12}),(0,$.jsxs)(`span`,{children:[`Gate: `,e.lastVerificationStatus.toUpperCase()]}),e.lastVerificationSha&&(0,$.jsxs)(`span`,{className:`font-mono text-[10px] opacity-80`,children:[`@`,e.lastVerificationSha.slice(0,7)]})]})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(e.status===`in_progress`||e.status===`verified`)&&(0,$.jsxs)(l,{size:`xs`,variant:`outline`,onClick:()=>void D(e.id,`complete`),disabled:h||x!==null,className:`text-[11px] gap-1 border-emerald-500/40 text-emerald-400 hover:bg-emerald-500/10`,children:[(0,$.jsx)(Z,{size:12}),` `,x===e.id?`Working...`:r?`Verify & Complete`:`Mark Complete`]}),e.status===`pending`&&(0,$.jsxs)(l,{size:`xs`,variant:`ghost`,onClick:()=>void D(e.id,`start`),disabled:h||x!==null,className:`text-[11px] gap-1 text-primary hover:bg-primary/10`,children:[(0,$.jsx)(Ie,{size:12}),` Start`]}),(0,$.jsx)(`span`,{className:`text-[10px] uppercase font-bold px-2 py-0.5 rounded ${e.status===`completed`?`bg-emerald-500/20 text-emerald-400`:e.status===`verified`?`bg-cyan-500/20 text-cyan-400`:e.status===`in_progress`?`bg-primary/20 text-primary`:e.status===`blocked`?`bg-muted/40 text-muted-foreground`:`bg-amber-500/20 text-amber-400`}`,children:e.status.replace(`_`,` `)})]})]})},e.id)})})]}),d?.fleet&&d.fleet.length>0&&(0,$.jsxs)(`div`,{className:`space-y-3 pt-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>w(e=>!e),className:`flex items-center gap-1.5 text-xs font-semibold text-muted-foreground hover:text-foreground transition-colors uppercase tracking-wider cursor-pointer`,"aria-expanded":C,"aria-controls":`sister-branch-fleet-list`,children:[(0,$.jsx)(jn,{size:14,className:`text-cyan-400`}),(0,$.jsx)(`span`,{children:`Sister Branch Fleet & Collaborator Radar`})]}),(0,$.jsxs)(K,{variant:`outline`,className:`text-[10px] font-mono px-1.5 py-0 h-4.5`,children:[d.fleet.length,` `,d.fleet.length===1?`branch`:`branches`]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`span`,{className:`hidden sm:inline text-[11px] text-muted-foreground`,children:`Tracking origin remote references`}),(0,$.jsx)(l,{size:`xs`,variant:`ghost`,onClick:()=>w(e=>!e),className:`h-6 px-2 text-[11px] gap-1 text-muted-foreground hover:text-foreground`,title:C?`Collapse fleet`:`Expand fleet`,"aria-expanded":C,"aria-controls":`sister-branch-fleet-list`,children:C?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(le,{size:13}),(0,$.jsx)(`span`,{children:`Collapse`})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(de,{size:13}),(0,$.jsx)(`span`,{children:`Expand`})]})})]})]}),C&&(0,$.jsx)(`div`,{id:`sister-branch-fleet-list`,className:`grid gap-2`,children:d.fleet.map(e=>(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between p-3 rounded-lg border text-xs ${e.isCurrent?`border-primary/40 bg-primary/5`:`border-border/60 bg-card/30`}`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,$.jsx)(`span`,{className:`size-2 rounded-full shrink-0 ${e.isCurrent?`bg-emerald-400 ring-4 ring-emerald-400/20`:`bg-cyan-400`}`}),(0,$.jsx)(`span`,{className:`font-mono font-semibold text-foreground`,children:e.branch}),e.repoName&&new Set(d?.fleet?.map(e=>e.repoName)).size>1&&(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground font-mono bg-muted/60 px-1.5 py-0.2 rounded border border-border/40`,children:e.repoName}),e.isCurrent&&(0,$.jsx)(`span`,{className:`text-[10px] font-medium px-1.5 py-0.2 rounded bg-primary/20 text-primary`,children:`active worktree`})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-4 text-muted-foreground`,children:[(0,$.jsxs)(`span`,{className:`font-mono text-[11px]`,children:[`+`,e.ahead,` / -`,e.behind]}),e.lastCommitAuthor&&(0,$.jsxs)(`span`,{className:`text-[11px] text-foreground/80`,children:[e.lastCommitAuthor,e.lastCommitDate&&(0,$.jsxs)(`span`,{className:`text-muted-foreground ml-1`,children:[`(`,Number.isNaN(Date.parse(e.lastCommitDate))?`Date unavailable — reload flow`:new Date(e.lastCommitDate).toLocaleString(),`)`]})]}),e.lastCommitMessage&&(0,$.jsxs)(`span`,{className:`truncate max-w-[240px] text-muted-foreground italic text-[11px]`,children:[`"`,e.lastCommitMessage,`"`]})]})]},`${e.repoName}:${e.branch}`))})]})]}):(0,$.jsx)(`div`,{children:t&&!k?(0,$.jsx)(`div`,{className:`flex justify-center py-10`,children:(0,$.jsx)(ct,{className:`animate-spin text-primary`,size:20})}):k?o===`preview`?(0,$.jsx)(`div`,{className:`max-h-[550px] overflow-auto rounded-xl border border-border/70 bg-card/40 backdrop-blur-xs p-4`,children:(0,$.jsx)(ln,{content:k})}):(0,$.jsx)(`div`,{className:`max-h-[550px] overflow-auto whitespace-pre-wrap rounded-xl border border-border/70 bg-card/40 backdrop-blur-xs p-4 font-mono text-xs leading-relaxed text-muted-foreground`,children:k}):(0,$.jsx)(`div`,{className:`rounded-md border border-dashed border-border/80 bg-muted/20 p-6 text-center text-xs text-muted-foreground`,children:`No implementation plan generated yet.`})})]})};function jr({workspaceId:e}){let[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(``),[a,o]=(0,Q.useState)(``),[s,c]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(!1),f=`/api/workspace/${encodeURIComponent(e)}/planning-notes`,p=async e=>{d(!0),o(``),c(``);try{let t=await Y(f,{signal:e});if(e?.aborted)return;n(t),i(t.content)}catch(t){e?.aborted||o(t instanceof Error?t.message:`Could not load planning notes.`)}finally{e?.aborted||d(!1)}};(0,Q.useEffect)(()=>{let e=new AbortController;return p(e.signal),()=>e.abort()},[f]);let m=async()=>{if(t){d(!0),o(``),c(``);try{let e=await Y(f,{method:`PUT`,body:JSON.stringify({revision:t.revision,content:r})});n(e),c(`Delivery notes saved. Refresh will preserve them.`)}catch(e){o(`${e instanceof Error?e.message:`Could not save.`} Your draft is kept.`)}finally{d(!1)}}};return(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Authored delivery order, open questions, existing work, and flag-only decisions. Edit the tables as Markdown; this document survives refresh. Use Edit milestones for gates and progress.`}),a&&(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:a}),s&&(0,$.jsx)(`p`,{role:`status`,className:`text-sm`,children:s}),(0,$.jsxs)(`label`,{className:`block text-sm`,children:[`Delivery notes`,(0,$.jsx)(qt,{"aria-label":`Delivery notes`,rows:20,style:{fieldSizing:`fixed`,height:`24rem`,resize:`vertical`},className:`mt-2 font-mono text-xs`,value:r,disabled:u||!t,onChange:e=>i(e.target.value)})]}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(l,{disabled:u||!t||r===t.content,onClick:()=>void m(),children:`Save delivery notes`}),(0,$.jsx)(l,{variant:`outline`,disabled:u,onClick:()=>void p(),children:`Reload delivery notes`})]}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Stored in contextspace-milestones.md. Reload replaces your draft with the saved document.`})]})}var Mr=()=>({title:``,role:`requirements`,status:`draft`,scope:{},summary:``}),Nr=`mt-1 w-full rounded-md border border-border bg-background p-2 text-sm`,Pr=[`investigate`,`design`,`implement`,`verify`,`review`,`release`];function Fr({workspaceId:e,onPlanChanged:t}){let[n,r]=(0,Q.useState)(null),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)([]),[c,u]=(0,Q.useState)(`assignment`),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(Mr),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(`text`),[T,E]=(0,Q.useState)(``),[D,O]=(0,Q.useState)(``),[k,A]=(0,Q.useState)(null),j=`/api/workspace/${encodeURIComponent(e)}`,M=(0,Q.useCallback)(async()=>{v(``);try{let e=await Y(`${j}/work`);r(e),a(e.guidance),s(e.lifecycle?.steps??[])}catch(e){v(e instanceof Error?e.message:`Unable to load work brief.`)}},[j]);(0,Q.useEffect)(()=>{M()},[M]);let N=async e=>{m(!0),v(``),g(``);try{await e()}catch(e){v(e instanceof Error?e.message:`The operation failed.`)}finally{m(!1)}},P=(0,$.jsx)($.Fragment,{children:n?.lifecycle?.steps.map(e=>(0,$.jsx)(`option`,{value:e.id,children:e.title},e.id))}),F=e=>a(t=>t&&{...t,assignment:{...t.assignment,...e}}),I=()=>N(async()=>{if(!n||!i)return;let e=await Y(`${j}/work`,{method:`PUT`,body:JSON.stringify({revision:n.guidance.revision,workType:i.workType,size:i.size,assignment:i.assignment})});r(e),a(e.guidance),g(`AI assignment saved.`)}),L=()=>N(async()=>{if(!n)return;let e=await Y(`${j}/work/documents${x?`/${x}`:``}`,{method:x?`PATCH`:`POST`,body:JSON.stringify({...y,revision:n.guidance.revision,...x?{}:C===`link`?{url:D}:{content:T}})});r(e),b(Mr()),S(null),E(``),O(``),g(`Document saved. Its role, status, and scope now appear in AI context.`)}),R=()=>N(async()=>{if(!n?.lifecycle)return;let e=await Y(`${j}/lifecycle/plan`,{method:`PUT`,body:JSON.stringify({revision:n.lifecycle.revision??0,steps:o})});r({...n,lifecycle:e.lifecycle}),s(e.lifecycle.steps),t(),g(`Milestones saved. Visual Flow and the Markdown plan use these same steps.`)}),z=i&&n&&(i.workType!==n.guidance.workType||i.size!==n.guidance.size||JSON.stringify(i.assignment)!==JSON.stringify(n.guidance.assignment));return(0,$.jsxs)(`section`,{className:`mb-5 rounded-xl border border-border bg-card p-5 space-y-4`,"aria-label":`Work brief and sources`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,$.jsx)(`h3`,{className:`font-semibold`,children:`Work brief & sources`}),(0,$.jsx)(l,{size:`sm`,variant:`outline`,disabled:p,onClick:()=>void M(),children:`Reload brief`})]}),(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Keep source documents here, set the AI’s current assignment, and split larger work into milestones. Knowledge holds the decisions and lessons discovered along the way.`}),_&&(0,$.jsxs)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:[_,` Your draft is kept. Reload to review the latest saved version.`]}),h&&(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:h}),!n||!i?(0,$.jsx)(`p`,{className:`text-sm`,children:_?`Work brief unavailable.`:`Loading work brief…`}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,"aria-label":`Brief sections`,children:[`assignment`,`documents`,`milestones`,`notes`].map(e=>(0,$.jsx)(l,{size:`sm`,variant:c===e?`secondary`:`ghost`,"aria-pressed":c===e,onClick:()=>{u(e),e===`notes`&&f(!0)},children:e===`assignment`?`AI assignment`:e===`documents`?`Source documents`:e===`milestones`?`Edit milestones`:`Delivery notes & questions`},e))}),d&&(0,$.jsx)(`div`,{hidden:c!==`notes`,children:(0,$.jsx)(jr,{workspaceId:e},e)}),c===`assignment`&&(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,$.jsxs)(`label`,{className:`text-sm`,children:[`Work type`,(0,$.jsx)(`select`,{"aria-label":`Work type`,className:Nr,value:i.workType,onChange:e=>a({...i,workType:e.target.value}),children:[`bug`,`feature`,`performance`,`refactor`,`rewrite`].map(e=>(0,$.jsx)(`option`,{value:e,children:e===`bug`?`Bug fix`:e[0].toUpperCase()+e.slice(1)},e))})]}),(0,$.jsxs)(`label`,{className:`text-sm`,children:[`Size`,(0,$.jsxs)(`select`,{"aria-label":`Size`,className:Nr,value:i.size,onChange:e=>a({...i,size:e.target.value}),children:[(0,$.jsx)(`option`,{value:`small`,children:`Small task`}),(0,$.jsx)(`option`,{value:`standard`,children:`Standard change`}),(0,$.jsx)(`option`,{value:`epic`,children:`Epic / multiple deliverables`})]})]}),(0,$.jsxs)(`label`,{className:`text-sm`,children:[`Current stage`,(0,$.jsx)(`select`,{"aria-label":`Current stage`,className:Nr,value:i.assignment.stage,onChange:e=>F({stage:e.target.value}),children:Pr.map(e=>(0,$.jsx)(`option`,{value:e,children:e[0].toUpperCase()+e.slice(1)},e))})]})]}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Work type and size describe the task; they do not reset progress. Edit milestones to adapt the plan.`}),(0,$.jsxs)(`label`,{className:`block text-sm`,children:[`Assignment scope`,(0,$.jsxs)(`select`,{"aria-label":`Assignment scope`,className:Nr,value:i.assignment.milestoneId??``,onChange:e=>F({milestoneId:e.target.value||void 0}),children:[(0,$.jsx)(`option`,{value:``,children:`Whole workspace`}),P]})]}),(0,$.jsxs)(`label`,{className:`block text-sm`,children:[`Current objective`,(0,$.jsx)(qt,{className:`mt-1`,value:i.assignment.objective,onChange:e=>F({objective:e.target.value}),placeholder:`Investigate why invoice totals differ from line items.`})]}),(0,$.jsxs)(`label`,{className:`block text-sm`,children:[`Expected output`,(0,$.jsx)(qt,{className:`mt-1`,value:i.assignment.expectedOutput,onChange:e=>F({expectedOutput:e.target.value}),placeholder:`A reproduction, likely cause, and proposed test plan.`})]}),(0,$.jsxs)(`label`,{className:`block text-sm`,children:[`Stop when`,(0,$.jsx)(qt,{className:`mt-1`,value:i.assignment.stopCondition,onChange:e=>F({stopCondition:e.target.value}),placeholder:`The proposal is ready for review. Stop before implementation.`})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsx)(l,{disabled:p,onClick:()=>void I(),children:`Save AI assignment`}),(0,$.jsx)(l,{variant:`outline`,disabled:p||!!z,onClick:()=>void N(async()=>{await navigator.clipboard.writeText(n.assignment),g(`AI assignment copied.`)}),children:`Copy AI assignment`})]}),z&&(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Save your changes before copying the assignment.`})]}),c===`documents`&&(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Attach Markdown/text or link to a document. Approved requirements define intended behavior; drafts remain proposals. Superseded documents stay available as history.`}),n.projectId&&(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Project sources are stored in the workspace where you add them. Keep that workspace while sources are active; supersede or copy them elsewhere before deleting it.`}),(0,$.jsx)(`ul`,{className:`space-y-2`,children:n.guidance.documents.map(e=>(0,$.jsx)(`li`,{className:`rounded-lg border border-border p-3`,children:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`font-medium text-sm`,children:e.title}),(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.role,` · `,e.status,` · `,e.scope.project?`Entire project`:e.scope.milestoneId?n.lifecycle?.steps.find(t=>t.id===e.scope.milestoneId)?.title??e.scope.milestoneId:`Whole workspace`]})]}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsxs)(l,{variant:`outline`,size:`sm`,disabled:p,onClick:()=>void N(async()=>{let t=await Y(`${j}/work/documents/${e.id}`);A({title:t.document.title,content:t.content,location:t.location})}),children:[`Read `,e.title]}),(0,$.jsxs)(l,{variant:`ghost`,size:`sm`,onClick:()=>{b(e),S(e.id)},children:[`Edit `,e.title]})]})]})},e.id))}),!!n.sharedDocuments?.length&&(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(`h4`,{className:`font-semibold text-sm`,children:`Shared project sources`}),n.sharedDocuments.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg border border-border p-3`,children:[(0,$.jsxs)(`p`,{className:`text-sm`,children:[e.title,(0,$.jsxs)(`span`,{className:`block text-xs text-muted-foreground`,children:[e.role,` · `,e.status,` · managed in `,e.workspaceId]})]}),(0,$.jsxs)(l,{variant:`outline`,size:`sm`,disabled:p,onClick:()=>void N(async()=>{let t=await Y(`${j}/work/documents/${e.id}`);A({title:t.document.title,content:t.content,location:t.location})}),children:[`Read `,e.title]})]},e.id))]}),!n.guidance.documents.length&&(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No documents yet. Add only the sources this work needs.`}),k&&(0,$.jsxs)(`div`,{className:`rounded-lg border border-border p-3 space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex justify-between gap-2`,children:[(0,$.jsx)(`h4`,{className:`text-sm font-semibold`,children:k.title}),(0,$.jsx)(l,{size:`sm`,variant:`ghost`,onClick:()=>A(null),children:`Close document`})]}),k.content===void 0?(0,$.jsx)(`a`,{className:`text-sm text-primary underline`,href:k.location,target:`_blank`,rel:`noopener noreferrer`,children:`Open source document`}):(0,$.jsx)(`pre`,{className:`max-h-64 overflow-auto whitespace-pre-wrap break-words text-xs`,children:k.content})]}),(0,$.jsxs)(`div`,{className:`border-t border-border pt-4 space-y-3`,children:[(0,$.jsx)(`h4`,{className:`font-medium text-sm`,children:x?`Edit document labels`:`Add source document`}),(0,$.jsxs)(`label`,{className:`block text-sm`,children:[`Document title`,(0,$.jsx)(V,{value:y.title,onChange:e=>b({...y,title:e.target.value})})]}),(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`text-sm`,children:[`Document role`,(0,$.jsx)(`select`,{"aria-label":`Document role`,className:Nr,value:y.role,onChange:e=>b({...y,role:e.target.value}),children:[`requirements`,`design`,`evidence`,`reference`].map(e=>(0,$.jsx)(`option`,{value:e,children:e[0].toUpperCase()+e.slice(1)},e))})]}),(0,$.jsxs)(`label`,{className:`text-sm`,children:[`Document status`,(0,$.jsxs)(`select`,{"aria-label":`Document status`,className:Nr,value:y.status,onChange:e=>b({...y,status:e.target.value}),children:[(0,$.jsx)(`option`,{value:`draft`,children:`Draft`}),(0,$.jsx)(`option`,{value:`approved`,children:`Approved`}),(0,$.jsx)(`option`,{value:`superseded`,children:`Superseded`})]})]})]}),(0,$.jsxs)(`label`,{className:`block text-sm`,children:[`Document scope`,(0,$.jsxs)(`select`,{"aria-label":`Document scope`,className:Nr,value:y.scope.project?`project`:y.scope.milestoneId?`milestone:${y.scope.milestoneId}`:``,onChange:e=>b({...y,scope:e.target.value===`project`?{project:!0}:{milestoneId:e.target.value.replace(/^milestone:/,``)||void 0}}),children:[(0,$.jsx)(`option`,{value:``,children:`Whole workspace`}),n.projectId&&(0,$.jsx)(`option`,{value:`project`,children:`Entire project (shared)`}),n.lifecycle?.steps.map(e=>(0,$.jsx)(`option`,{value:`milestone:${e.id}`,children:e.title},e.id))]})]}),!x&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`label`,{className:`block text-sm`,children:[`Document source`,(0,$.jsxs)(`select`,{"aria-label":`Document source`,className:Nr,value:C,onChange:e=>w(e.target.value),children:[(0,$.jsx)(`option`,{value:`text`,children:`Upload or paste Markdown/text`}),(0,$.jsx)(`option`,{value:`link`,children:`Link to a document`})]})]}),C===`link`?(0,$.jsxs)(`label`,{className:`block text-sm`,children:[`Document URL`,(0,$.jsx)(V,{type:`url`,value:D,onChange:e=>O(e.target.value),placeholder:`https://…`})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`label`,{className:`block text-sm`,children:[`Upload text document`,(0,$.jsx)(`input`,{type:`file`,className:`mt-1 block w-full text-sm`,accept:`.md,.markdown,.txt,text/plain,text/markdown`,onChange:e=>{let t=e.target.files?.[0];t&&N(async()=>{if(t.size>5e5||!/\.(md|markdown|txt)$/i.test(t.name))throw Error(`Choose a Markdown or text file up to 500 KB. Link to other document formats.`);E(await t.text()),b(e=>({...e,title:e.title||t.name}))})}})]}),(0,$.jsxs)(`label`,{className:`block text-sm`,children:[`Source text`,(0,$.jsx)(qt,{value:T,onChange:e=>E(e.target.value),rows:5})]})]})]}),(0,$.jsxs)(`label`,{className:`block text-sm`,children:[`Owner summary (optional)`,(0,$.jsx)(qt,{value:y.summary,onChange:e=>b({...y,summary:e.target.value}),placeholder:`Highlight what matters for this task. The original remains available.`})]}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(l,{disabled:p||!y.title.trim()||!x&&!(C===`link`?D.trim():T.trim()),onClick:()=>void L(),children:x?`Save document labels`:`Add document`}),x&&(0,$.jsx)(l,{variant:`ghost`,onClick:()=>{S(null),b(Mr())},children:`Cancel document edit`})]})]})]}),c===`milestones`&&(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Name deliverable milestones, assign branches, and choose dependencies. Saved progress and completed verification remain intact.`}),o.map((e,t)=>(0,$.jsxs)(`fieldset`,{className:`rounded-lg border border-border p-3 space-y-3`,children:[(0,$.jsxs)(`legend`,{className:`px-1 text-xs text-muted-foreground`,children:[`Milestone `,t+1,` · `,e.status.replaceAll(`_`,` `)]}),(0,$.jsxs)(`label`,{className:`block text-sm`,children:[`Milestone `,t+1,` title`,(0,$.jsx)(V,{value:e.title,onChange:t=>s(o.map(n=>n.id===e.id?{...n,title:t.target.value}:n))})]}),(0,$.jsxs)(`label`,{className:`block text-sm`,children:[`Milestone `,t+1,` outcome`,(0,$.jsx)(qt,{value:e.description??``,onChange:t=>s(o.map(n=>n.id===e.id?{...n,description:t.target.value}:n))})]}),(0,$.jsxs)(`label`,{className:`block text-sm`,children:[`Milestone `,t+1,` branch (optional)`,(0,$.jsx)(V,{value:e.branch??``,placeholder:`feature/invoice-calculation`,onChange:t=>s(o.map(n=>n.id===e.id?{...n,branch:t.target.value}:n))})]}),(0,$.jsxs)(`label`,{className:`block text-sm`,children:[`Milestone `,t+1,` repository (optional)`,(0,$.jsx)(V,{value:e.repo??``,placeholder:`billing-api`,onChange:t=>s(o.map(n=>n.id===e.id?{...n,repo:t.target.value}:n))})]}),(0,$.jsxs)(`label`,{className:`block text-sm`,children:[`Milestone `,t+1,` work item / PR (optional)`,(0,$.jsx)(V,{value:e.workItem??``,placeholder:`PBI ID or URL`,onChange:t=>s(o.map(n=>n.id===e.id?{...n,workItem:t.target.value}:n))})]}),(0,$.jsxs)(`label`,{className:`block text-sm`,children:[`Milestone `,t+1,` unblock condition (optional)`,(0,$.jsx)(V,{value:e.unblockCondition??``,placeholder:`Dependency or decision needed before starting`,onChange:t=>s(o.map(n=>n.id===e.id?{...n,unblockCondition:t.target.value}:n))})]}),(0,$.jsxs)(`fieldset`,{className:`space-y-2`,children:[(0,$.jsxs)(`legend`,{className:`mb-2 text-sm`,children:[`Milestone `,t+1,` dependencies`]}),o.filter(t=>t.id!==e.id).map(t=>(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:!!e.dependsOn?.includes(t.id),onChange:n=>s(o.map(r=>r.id===e.id?{...r,dependsOn:n.target.checked?[...r.dependsOn??[],t.id]:(r.dependsOn??[]).filter(e=>e!==t.id)}:r))}),t.title||`Untitled milestone`]},t.id))]}),(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:!!(e.requiresVerification||e.verificationCommand),disabled:e.status===`completed`,onChange:t=>s(o.map(n=>n.id===e.id?{...n,requiresVerification:t.target.checked,...t.target.checked?{}:{verificationCommand:``}}:n))}),`Verify before completing milestone `,t+1]}),(e.requiresVerification||e.verificationCommand)&&(0,$.jsxs)(`label`,{className:`block text-sm`,children:[`Milestone `,t+1,` verification command (optional)`,(0,$.jsx)(V,{value:e.verificationCommand??``,disabled:e.status===`completed`,placeholder:`Uses the workspace test command unless overridden`,onChange:t=>s(o.map(n=>n.id===e.id?{...n,verificationCommand:t.target.value}:n))})]})]},e.id)),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsx)(l,{variant:`outline`,disabled:p||o.length>=100,onClick:()=>s([...o,{id:`milestone-${crypto.randomUUID()}`,title:``,status:`pending`,dependsOn:o.length?[o[o.length-1].id]:[]}]),children:`Add milestone`}),(0,$.jsx)(l,{disabled:p||o.some(e=>!e.title.trim()),onClick:()=>void R(),children:`Save milestones`})]})]})]})]})}var Ir={"git-pull-request":he,"flask-conical":me,package:ve,database:ye,"shield-check":fe,terminal:ft,zap:Et,cpu:$e,layers:Se,boxes:Re};function Lr({ws:e,showToast:t}){let{data:n=[]}=tn(e.branchName),[r,i]=(0,Q.useState)(``),[a,o]=(0,Q.useState)({}),[c,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(`workspace`),[C,w]=(0,Q.useState)(!1),{data:T=[],isLoading:E}=Mt(),{data:D=[],isLoading:O}=Kt(e.branchName),{data:k=[],isLoading:A}=Ge(),{data:j,isLoading:M,isError:N}=jt(e.branchName),P=st(),F=Je(),I=Ct(),L=(0,Q.useMemo)(()=>new Set(c??j?.enabledSkills??[]),[c,j?.enabledSkills]),R=(0,Q.useMemo)(()=>new Set(d??j?.enabledAgents??[]),[d,j?.enabledAgents]);(0,Q.useEffect)(()=>{j&&(u([...j.enabledSkills??[]]),f([...j.enabledAgents??[]]))},[j]);let z=(0,Q.useMemo)(()=>{if(!j||c===null||d===null)return!1;let e=new Set(j.enabledSkills??[]),t=new Set(j.enabledAgents??[]);return!!(c.length!==e.size||c.some(t=>!e.has(t))||d.length!==t.size||d.some(e=>!t.has(e)))},[j,c,d]),ee=e=>{o(t=>({...t,[e]:!t[e]}))},B=e=>{if(c===null)return;let t=new Set(c);t.has(e)?t.delete(e):t.add(e),u(Array.from(t))},te=e=>{if(d===null)return;let t=new Set(d);t.has(e)?t.delete(e):t.add(e),f(Array.from(t))},ne=(e,t,n)=>{if(c===null)return;let r=new Set(c);for(let e of n)t?r.add(e.id):r.delete(e.id);u(Array.from(r))},re=async()=>{if(!(!j||c===null||d===null)){m(!0);try{await P.mutateAsync({workspaceId:e.branchName,expectedRevision:j.revision??0,enabledSkills:c,enabledAgents:d,enabledCategories:T.map(e=>e.id)}),await F.mutateAsync({workspaceId:e.branchName}),t?.(`Skills & agents deployed successfully to workspace context!`,`success`)}catch(e){t?.(e instanceof Error?e.message:`Failed to deploy skills`,`error`)}finally{m(!1)}}},H=(0,Q.useMemo)(()=>{if(!r.trim())return D;let e=r.toLowerCase();return D.filter(t=>t.title?.toLowerCase().includes(e)||t.name.toLowerCase().includes(e)||t.description.toLowerCase().includes(e)||t.tags?.some(t=>t.toLowerCase().includes(e)))},[D,r]),U=(0,Q.useMemo)(()=>{if(!r.trim())return k;let e=r.toLowerCase();return k.filter(t=>t.name.toLowerCase().includes(e)||t.description.toLowerCase().includes(e)||t.category.toLowerCase().includes(e))},[k,r]),{displayCategories:ie,uncategorizedSkills:W}=(0,Q.useMemo)(()=>{let e=new Set(T.map(e=>e.id)),t=T.filter(e=>e.id!==`general`),n=new Map;for(let t of H)if(t.category&&t.category!==`general`&&!e.has(t.category)&&!n.has(t.category)){let e=t.category.split(/[-_]/).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `);n.set(t.category,{id:t.category,name:e,description:`Skills categorized under ${e}`,color:`#3b82f6`,icon:`boxes`})}t.push(...Array.from(n.values()));let r=new Set(t.map(e=>e.id));return{displayCategories:t,uncategorizedSkills:H.filter(e=>!e.category||!r.has(e.category))}},[T,H]),G=(0,Q.useMemo)(()=>{let e={};for(let t of ie)e[t.id]=H.filter(e=>e.category===t.id);return e},[ie,H]),ae=(e,t)=>{t.stopPropagation(),g(e)},oe=(e,t)=>{t.stopPropagation(),b({...e}),S(e.scope===`workspace`?`workspace`:`global`),w(!0),v(!0)},se=()=>{b({name:``,title:``,category:ie[0]?.id||`general`,description:``,tags:[],content:`# Skill Title
4
+
5
+ Procedural playbook instructions for AI assistants...`,allowedTools:[]}),S(`workspace`),w(!1),v(!0)},ce=e=>{let t={...y||{},title:e};!y?.id&&!C&&(t.name=e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)),b(t)},ue=async()=>{if(!y||!y.name?.trim()||!y.description?.trim()||!y.content?.trim()){t?.(`Skill name, trigger description, and playbook markdown are required`,`error`);return}try{await I.mutateAsync({id:y.id,name:y.name.trim(),title:y.title||y.name,category:y.category||`general`,description:y.description||``,tags:y.tags||[],allowedTools:y.allowedTools||[],content:y.content,scope:x,workspaceId:x===`workspace`?e.branchName:void 0}),c!==null&&!c.includes(y.name.trim())&&u([...c,y.name.trim()]),t?.(x===`workspace`?`Workspace skill '${y.name}' saved to .agents/skills/`:`Global skill '${y.name}' saved to catalog`,`success`),v(!1),b(null)}catch(e){t?.(e instanceof Error?e.message:`Failed to save skill`,`error`)}};if(E||O||A||M)return(0,$.jsxs)(`div`,{className:`flex items-center justify-center p-12 gap-3 text-muted-foreground`,children:[(0,$.jsx)(J,{}),(0,$.jsx)(`span`,{className:`text-sm`,children:`Loading workspace skills...`})]});if(N)return(0,$.jsx)(en,{className:`py-12 border border-dashed rounded-xl`,children:(0,$.jsxs)(Xt,{children:[(0,$.jsx)(Dt,{children:`Could not load workspace skills config`}),(0,$.jsx)(Wt,{children:`Unable to read .contextspace/skills.json for this workspace.`})]})});let fe=e=>{let t=L.has(e.id);return(0,$.jsx)(`div`,{role:`button`,tabIndex:0,onClick:()=>B(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),B(e.id))},className:s(`p-3 rounded-lg border text-left cursor-pointer transition-all flex flex-col justify-between select-none shadow-2xs group`,t?`border-primary/60 bg-primary/5 text-foreground`:`border-border bg-card/70 text-muted-foreground hover:border-foreground/20 hover:text-foreground`),children:(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2 mb-1.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,$.jsx)(`span`,{className:s(`grid size-4 shrink-0 place-items-center rounded border transition-colors`,t?`border-primary bg-primary text-primary-foreground`:`border-muted-foreground/40 bg-transparent`),children:t&&(0,$.jsx)(Z,{className:`size-3 stroke-[3]`})}),(0,$.jsx)(`span`,{className:`font-mono text-xs font-semibold truncate`,children:e.title||e.name})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,onClick:e=>e.stopPropagation(),children:[(0,$.jsx)(K,{variant:e.scope===`workspace`?`default`:`outline`,className:`text-[9px] px-1 py-0 font-mono`,title:e.scope===`workspace`?`Local to this workspace (.agents/skills/)`:`From global catalog (~/.contextspace/skills/)`,children:e.scope===`workspace`?`Workspace`:`Global`}),(0,$.jsx)(l,{variant:`ghost`,size:`xs`,onClick:t=>ae(e,t),title:`Inspect Playbook Instructions`,className:`h-6 w-6 p-0 text-muted-foreground hover:text-foreground cursor-pointer`,children:(0,$.jsx)(_e,{className:`size-3.5`})}),(0,$.jsx)(l,{variant:`ghost`,size:`xs`,onClick:t=>oe(e,t),title:`Edit Skill Playbook`,className:`h-6 w-6 p-0 text-muted-foreground hover:text-foreground cursor-pointer`,children:(0,$.jsx)(ge,{className:`size-3`})})]})]}),(0,$.jsx)(`p`,{className:`text-[11px] text-muted-foreground line-clamp-2 leading-relaxed pl-6`,children:e.description||`No description provided.`}),e.tags&&e.tags.length>0&&(0,$.jsx)(`div`,{className:`mt-2 pl-6 flex items-center gap-1 flex-wrap`,children:e.tags.slice(0,4).map(e=>(0,$.jsxs)(`span`,{className:`text-[9px] font-mono text-muted-foreground bg-muted/60 px-1 py-0.2 rounded`,children:[`#`,e]},e))})]})},e.id)};return(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[n.length>0&&(0,$.jsxs)(`div`,{role:`status`,className:`rounded-lg border border-amber-500/40 p-4 text-sm`,children:[(0,$.jsx)(`h4`,{className:`font-semibold`,children:`Skill discovery notices`}),(0,$.jsx)(`ul`,{className:`mt-2 space-y-2`,children:n.map((e,t)=>(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`strong`,{children:e.id}),` (`,e.scope,`): `,e.message]},`${e.id}-${t}`))})]}),(0,$.jsxs)(pn,{className:`p-5 rounded-xl border border-border/80 bg-card/70 backdrop-blur-md shadow-xs flex flex-col sm:flex-row sm:items-center justify-between gap-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`div`,{className:`p-2 rounded-lg bg-primary/10 text-primary`,children:(0,$.jsx)(Re,{className:`h-5 w-5`})}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-bold text-foreground`,children:`Workspace Skills & Agents`}),(0,$.jsxs)(K,{variant:`secondary`,className:`text-[10px] font-mono`,children:[L.size,` Skills Active`]}),R.size>0&&(0,$.jsxs)(K,{variant:`secondary`,className:`text-[10px] font-mono`,children:[R.size,` Agents Active`]})]}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:`Select skills to deploy to this workspace. Authored .agents/skills files remain discoverable by assistants even when deselected.`})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap sm:flex-nowrap`,children:[(0,$.jsxs)(l,{size:`sm`,variant:`outline`,onClick:se,className:`flex items-center gap-1.5 shadow-xs text-xs`,children:[(0,$.jsx)(Bt,{className:`size-3.5`}),(0,$.jsx)(`span`,{children:`New Skill`})]}),(0,$.jsxs)(l,{size:`sm`,onClick:re,disabled:p||!z&&L.size===0&&R.size===0,className:`flex items-center gap-1.5 shadow-sm text-xs`,children:[p?(0,$.jsx)(J,{className:`size-3.5`}):(0,$.jsx)(on,{className:`size-3.5`}),(0,$.jsx)(`span`,{children:p?`Deploying…`:z?`Save & Deploy Changes`:`Re-Deploy to Workspace`})]}),(0,$.jsxs)(l,{render:(0,$.jsx)(Ut,{to:`/skills`}),variant:`ghost`,size:`sm`,className:`flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground`,title:`Open Global Enterprise Catalog`,children:[(0,$.jsx)(qe,{className:`size-3.5`}),(0,$.jsx)(`span`,{children:`Global Library`})]})]})]}),(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(Ue,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground`}),(0,$.jsx)(V,{value:r,onChange:e=>i(e.target.value),placeholder:`Filter skills & agents by keyword or tag...`,className:`pl-9 pr-8 h-8 text-xs bg-card`}),r&&(0,$.jsx)(`button`,{onClick:()=>i(``),className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,children:(0,$.jsx)(an,{className:`h-3.5 w-3.5`})})]}),(0,$.jsxs)(`div`,{className:`space-y-3`,children:[ie.map(e=>{let t=Ir[e.icon||`boxes`]||Re,n=G[e.id]||[];if(n.length===0)return null;let r=!!a[e.id],i=n.length>0&&n.every(e=>L.has(e.id));return(0,$.jsxs)(`div`,{className:`border border-border rounded-xl overflow-hidden bg-card/60 transition-colors`,children:[(0,$.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":!r,onClick:()=>ee(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),ee(e.id))},className:`p-3 flex items-center justify-between cursor-pointer hover:bg-muted/40 transition-colors select-none`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,$.jsx)(`div`,{className:`p-1.5 rounded-md text-white shadow-xs flex items-center justify-center`,style:{backgroundColor:e.color||`#3b82f6`},children:(0,$.jsx)(t,{className:`h-3.5 w-3.5`})}),(0,$.jsx)(`div`,{children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`h4`,{className:`font-semibold text-xs text-foreground`,children:e.name}),(0,$.jsxs)(K,{variant:`outline`,className:`text-[9px] px-1 py-0 font-mono`,children:[n.filter(e=>L.has(e.id)).length,`/`,n.length,` active`]})]})})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,onClick:e=>e.stopPropagation(),children:[n.length>0&&(0,$.jsxs)(l,{variant:`ghost`,size:`xs`,onClick:()=>ne(e.id,!i,n),className:`h-6 text-[11px] px-2 text-muted-foreground hover:text-foreground`,children:[i?(0,$.jsx)(be,{className:`h-3 w-3 mr-1 text-primary`}):(0,$.jsx)(Be,{className:`h-3 w-3 mr-1`}),(0,$.jsx)(`span`,{children:i?`Deselect All`:`Select All`})]}),(0,$.jsx)(`div`,{className:`p-0.5 text-muted-foreground`,children:r?(0,$.jsx)(de,{className:`h-4 w-4`}):(0,$.jsx)(le,{className:`h-4 w-4`})})]})]}),!r&&(0,$.jsx)(`div`,{className:`p-3 border-t border-border/40 bg-background/50`,children:(0,$.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-2.5`,children:n.map(e=>fe(e))})})]},e.id)}),W.length>0&&(0,$.jsxs)(`div`,{className:`border border-border rounded-xl overflow-hidden bg-card/60 transition-colors`,children:[(0,$.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":!a.__uncategorized,onClick:()=>ee(`__uncategorized`),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),ee(`__uncategorized`))},className:`p-3 flex items-center justify-between cursor-pointer hover:bg-muted/40 transition-colors select-none`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,$.jsx)(`div`,{className:`p-1.5 rounded-md bg-muted text-muted-foreground shadow-xs flex items-center justify-center`,children:(0,$.jsx)(Re,{className:`h-3.5 w-3.5`})}),(0,$.jsx)(`div`,{children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`h4`,{className:`font-semibold text-xs text-foreground`,children:`Uncategorized Skills`}),(0,$.jsxs)(K,{variant:`outline`,className:`text-[9px] px-1 py-0 font-mono`,children:[W.filter(e=>L.has(e.id)).length,`/`,W.length,` active`]})]})})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,onClick:e=>e.stopPropagation(),children:[(0,$.jsxs)(l,{variant:`ghost`,size:`xs`,onClick:()=>ne(`__uncategorized`,!W.every(e=>L.has(e.id)),W),className:`h-6 text-[11px] px-2 text-muted-foreground hover:text-foreground`,children:[W.every(e=>L.has(e.id))?(0,$.jsx)(be,{className:`h-3 w-3 mr-1 text-primary`}):(0,$.jsx)(Be,{className:`h-3 w-3 mr-1`}),(0,$.jsx)(`span`,{children:W.every(e=>L.has(e.id))?`Deselect All`:`Select All`})]}),(0,$.jsx)(`div`,{className:`p-0.5 text-muted-foreground`,children:a.__uncategorized?(0,$.jsx)(de,{className:`h-4 w-4`}):(0,$.jsx)(le,{className:`h-4 w-4`})})]})]}),!a.__uncategorized&&(0,$.jsx)(`div`,{className:`p-3 border-t border-border/40 bg-background/50`,children:(0,$.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-2.5`,children:W.map(e=>fe(e))})})]}),U.length>0&&(0,$.jsxs)(`div`,{className:`border border-border rounded-xl overflow-hidden bg-card/60 transition-colors`,children:[(0,$.jsx)(`div`,{className:`p-3 flex items-center justify-between border-b border-border/40 select-none`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,$.jsx)(`div`,{className:`p-1.5 rounded-md bg-purple-600 text-white shadow-xs flex items-center justify-center`,children:(0,$.jsx)(vt,{className:`h-3.5 w-3.5`})}),(0,$.jsx)(`div`,{children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`h4`,{className:`font-semibold text-xs text-foreground`,children:`Codex Native Agents`}),(0,$.jsxs)(K,{variant:`outline`,className:`text-[9px] px-1 py-0`,children:[U.filter(e=>R.has(e.id)).length,`/`,U.length,` active`]})]})})]})}),(0,$.jsx)(`div`,{className:`p-3 bg-background/50`,children:(0,$.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-2.5`,children:U.map(e=>{let t=R.has(e.id);return(0,$.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:()=>te(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),te(e.id))},className:s(`p-3 rounded-lg border text-left cursor-pointer transition-all flex flex-col justify-between select-none shadow-2xs`,t?`border-purple-500/60 bg-purple-500/5 text-foreground`:`border-border bg-card/70 text-muted-foreground hover:border-foreground/20 hover:text-foreground`),children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2 mb-1.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,$.jsx)(`span`,{className:s(`grid size-4 shrink-0 place-items-center rounded border transition-colors`,t?`border-purple-600 bg-purple-600 text-white`:`border-muted-foreground/40 bg-transparent`),children:t&&(0,$.jsx)(Z,{className:`size-3 stroke-[3]`})}),(0,$.jsx)(`span`,{className:`font-mono text-xs font-semibold truncate`,children:e.name})]}),(0,$.jsx)(K,{variant:`secondary`,className:`text-[9px] px-1 py-0 shrink-0`,children:`.codex/agents`})]}),(0,$.jsx)(`p`,{className:`text-[11px] text-muted-foreground line-clamp-2 leading-relaxed pl-6`,children:e.description||`No description provided.`})]},e.id)})})})]}),ie.every(e=>(G[e.id]||[]).length===0)&&W.length===0&&U.length===0&&(0,$.jsx)(en,{className:`py-12 border border-dashed rounded-xl`,children:(0,$.jsxs)(Xt,{children:[(0,$.jsx)(Dt,{children:`No skills found`}),(0,$.jsx)(Wt,{children:r?`No skills match the filter "${r}".`:`No skills configured in this workspace yet. Click "+ New Skill" to create a playbook or attach one from the catalog.`})]})})]}),(0,$.jsxs)(`p`,{className:`text-[11px] text-muted-foreground`,children:[`Saving & deploying will write to `,(0,$.jsxs)(`code`,{className:`font-mono text-xs text-foreground`,children:[Me,`/skills.json`]}),` and materialize files into `,(0,$.jsx)(`code`,{className:`font-mono text-xs text-foreground`,children:`.agents/skills/`}),`, `,(0,$.jsx)(`code`,{className:`font-mono text-xs text-foreground`,children:`.claude/skills/`}),`, and `,(0,$.jsx)(`code`,{className:`font-mono text-xs text-foreground`,children:`.codex/agents/`}),`.`]}),(0,$.jsx)(Nt,{open:!!h,onOpenChange:e=>!e&&g(null),children:(0,$.jsxs)(Tt,{className:`max-w-2xl max-h-[85vh] flex flex-col p-6`,children:[(0,$.jsxs)(Lt,{className:`pb-3 border-b border-border/70 shrink-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between pr-6`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Ze,{className:`h-4 w-4 text-primary`}),(0,$.jsx)(rn,{className:`text-base font-bold`,children:h?.title||h?.name})]}),(0,$.jsx)(K,{variant:`outline`,className:`font-mono text-[10px]`,children:h?.scope===`workspace`?`Workspace (.agents/skills/)`:`Global Catalog`})]}),(0,$.jsx)(Jt,{className:`text-xs text-muted-foreground mt-1`,children:h?.description||`No description provided.`})]}),(0,$.jsxs)(`div`,{className:`flex-1 overflow-y-auto py-4 space-y-4`,children:[h?.tags&&h.tags.length>0&&(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 items-center`,children:[(0,$.jsx)(`span`,{className:`text-[11px] font-semibold text-muted-foreground mr-1`,children:`Tags:`}),h.tags.map(e=>(0,$.jsxs)(K,{variant:`secondary`,className:`text-[10px] font-mono`,children:[`#`,e]},e))]}),h?.allowedTools&&h.allowedTools.length>0&&(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 items-center`,children:[(0,$.jsx)(`span`,{className:`text-[11px] font-semibold text-muted-foreground mr-1`,children:`Allowed Tools:`}),h.allowedTools.map(e=>(0,$.jsx)(`code`,{className:`text-[10px] font-mono bg-muted/60 px-1.5 py-0.5 rounded text-foreground`,children:e},e))]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between text-xs font-semibold text-foreground`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(pe,{className:`h-3.5 w-3.5 text-primary`}),(0,$.jsx)(`span`,{children:`SKILL.md Playbook Instructions`})]}),(0,$.jsxs)(`span`,{className:`text-[10px] font-mono text-muted-foreground`,children:[(h?.content||``).split(`
6
+ `).length,` lines`]})]}),(0,$.jsx)(`div`,{className:`p-4 rounded-lg border border-border bg-card/60 overflow-x-auto`,children:(0,$.jsx)(`pre`,{className:`text-xs whitespace-pre-wrap font-sans leading-relaxed text-foreground/90`,children:h?.content||`*(Empty playbook)*`})})]})]}),(0,$.jsxs)(Ht,{className:`border-t border-border/70 pt-3 flex items-center justify-between sm:justify-between w-full`,children:[(0,$.jsx)(l,{variant:`outline`,size:`sm`,onClick:()=>{h&&B(h.id)},className:`text-xs`,children:h&&L.has(h.id)?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(an,{className:`size-3.5 mr-1 text-destructive`}),`Deactivate for Workspace`]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{className:`size-3.5 mr-1 text-primary`}),`Activate for Workspace`]})}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)(l,{variant:`outline`,size:`sm`,onClick:e=>{if(h){let t=h;g(null),oe(t,e)}},className:`text-xs gap-1.5`,children:[(0,$.jsx)(ge,{className:`size-3`}),(0,$.jsx)(`span`,{children:`Edit Playbook`})]}),(0,$.jsx)(l,{size:`sm`,onClick:()=>g(null),children:`Close`})]})]})]})}),(0,$.jsx)(Nt,{open:_,onOpenChange:v,children:(0,$.jsxs)(Tt,{className:`max-w-3xl max-h-[90vh] flex flex-col p-6`,children:[(0,$.jsxs)(Lt,{className:`pb-3 border-b border-border/70 shrink-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between pr-6`,children:[(0,$.jsxs)(rn,{className:`text-base font-bold flex items-center gap-2`,children:[(0,$.jsx)(on,{className:`h-4 w-4 text-primary`}),(0,$.jsx)(`span`,{children:y?.id?`Edit Skill Playbook`:`Create New Skill`})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Scope:`}),(0,$.jsx)(`span`,{className:`font-mono text-xs px-2 py-0.5 rounded bg-primary/10 text-primary border border-primary/20`,children:x===`workspace`?`Workspace (${e.branchName})`:`Global Catalog`})]})]}),(0,$.jsx)(Jt,{className:`text-xs text-muted-foreground mt-0.5`,children:`Configure SKILL.md metadata triggers and markdown instructions.`})]}),(0,$.jsxs)(`div`,{className:`flex-1 overflow-y-auto py-3 space-y-4`,children:[(0,$.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(mn,{htmlFor:`ws-skill-title`,className:`text-xs font-medium`,children:`Display Title`}),(0,$.jsx)(V,{id:`ws-skill-title`,value:y?.title||``,onChange:e=>ce(e.target.value),placeholder:`e.g. NexusFlow Dev Playbook`,className:`mt-1 text-xs`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(mn,{htmlFor:`ws-skill-name`,className:`text-xs font-medium`,children:`Identifier (Slug)`}),(0,$.jsx)(V,{id:`ws-skill-name`,value:y?.name||``,disabled:!!y?.id,onChange:e=>{w(!0),b(t=>t?{...t,name:e.target.value}:null)},placeholder:`e.g. nexusflow-dev`,className:`mt-1 text-xs font-mono`})]})]}),(0,$.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(mn,{htmlFor:`ws-skill-category`,className:`text-xs font-medium`,children:`Category`}),(0,$.jsx)(V,{id:`ws-skill-category`,value:y?.category||``,onChange:e=>b(t=>t?{...t,category:e.target.value}:null),placeholder:`e.g. dev-standards or workflows`,className:`mt-1 text-xs`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(mn,{htmlFor:`ws-skill-tags`,className:`text-xs font-medium`,children:`Tags (comma separated)`}),(0,$.jsx)(V,{id:`ws-skill-tags`,value:y?.tags?.join(`, `)||``,onChange:e=>b(t=>t?{...t,tags:e.target.value.split(`,`).map(e=>e.trim()).filter(Boolean)}:null),placeholder:`e.g. nexusflow, testing, cli`,className:`mt-1 text-xs font-mono`})]})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(mn,{htmlFor:`ws-skill-desc`,className:`text-xs font-medium`,children:`Trigger Description (When should the assistant use this skill?)`}),(0,$.jsx)(qt,{id:`ws-skill-desc`,rows:2,value:y?.description||``,onChange:e=>b(t=>t?{...t,description:e.target.value}:null),placeholder:`e.g. Use when developing, debugging, refactoring, or maintaining NexusFlow code...`,className:`mt-1 text-xs leading-relaxed resize-none`})]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsxs)(mn,{htmlFor:`ws-skill-content`,className:`text-xs font-semibold flex items-center gap-1.5`,children:[(0,$.jsx)(pe,{className:`h-3.5 w-3.5 text-primary`}),(0,$.jsx)(`span`,{children:`Playbook Instructions (Markdown)`})]}),(0,$.jsxs)(`span`,{className:`text-[10px] text-muted-foreground font-mono`,children:[(y?.content||``).split(`
7
+ `).length,` lines`]})]}),(0,$.jsxs)(`p`,{className:`text-[11px] text-muted-foreground`,children:[`Frontmatter (`,(0,$.jsx)(`code`,{className:`font-mono text-[10px] bg-muted/60 px-1 py-0.2 rounded text-foreground`,children:`name`}),`, `,(0,$.jsx)(`code`,{className:`font-mono text-[10px] bg-muted/60 px-1 py-0.2 rounded text-foreground`,children:`description`}),`, `,(0,$.jsx)(`code`,{className:`font-mono text-[10px] bg-muted/60 px-1 py-0.2 rounded text-foreground`,children:`tags`}),`) is auto-injected into `,(0,$.jsx)(`code`,{className:`font-mono text-[10px] bg-muted/60 px-1 py-0.2 rounded text-foreground`,children:`SKILL.md`}),` on save.`]}),(0,$.jsx)(qt,{id:`ws-skill-content`,rows:12,value:y?.content||``,onChange:e=>b(t=>t?{...t,content:e.target.value}:null),placeholder:`# Playbook Title
8
+
9
+ Detailed instructions for the AI assistant...`,className:`font-mono text-xs leading-relaxed resize-none focus:ring-1 focus:ring-primary`})]})]}),(0,$.jsxs)(Ht,{className:`pt-3 border-t flex items-center justify-between sm:justify-between w-full`,children:[(0,$.jsx)(l,{variant:`outline`,size:`sm`,onClick:()=>v(!1),children:`Cancel`}),(0,$.jsxs)(l,{size:`sm`,onClick:ue,className:`gap-1.5`,children:[(0,$.jsx)(on,{className:`size-3.5`}),(0,$.jsx)(`span`,{children:`Save Skill`})]})]})]})})]})}var Rr=(e,t)=>{let n=`${e} ${t}`.toLowerCase();return n.includes(`insiders`)?(0,$.jsx)(q,{size:15,className:`text-[#24C05A] shrink-0`}):n.includes(`code`)||n.includes(`vscode`)?(0,$.jsx)(we,{size:15,className:`text-[#007ACC] shrink-0`}):n.includes(`antigravity`)?(0,$.jsx)(Gt,{className:`size-3.5 shrink-0`}):n.includes(`cursor`)?(0,$.jsx)(on,{size:14,className:`text-purple-400 shrink-0`}):n.includes(`powershell`)||n.includes(`pwsh`)?(0,$.jsx)(ft,{size:14,className:`text-sky-400 shrink-0`}):n.includes(`cmd`)||n.includes(`command prompt`)?(0,$.jsx)(ft,{size:14,className:`text-amber-400 shrink-0`}):(0,$.jsx)(pe,{size:14,className:`shrink-0`})},zr=[{value:`overview`,label:`Command Center`,ariaLabel:`Overview`,icon:Dn},{value:`plan`,label:`Plan`,ariaLabel:`Plan`,icon:_n},{value:`changes`,label:`Git Diff`,ariaLabel:`Changes`,icon:En},{value:`services`,label:`Services`,ariaLabel:`Services`,icon:Et},{value:`sessions`,label:`AI & Chat`,ariaLabel:`AI & Sessions`,icon:vt},{value:`knowledge`,label:`Knowledge`,ariaLabel:`Knowledge`,icon:hn},{value:`skills`,label:`Skills`,ariaLabel:`Skills`,icon:An}];function Br(e){let{workspaces:t,workspaceStatuses:n,selectedId:r,subTab:i,onSelectTab:a,handleCopyPrompt:o,handleDeleteWorkspace:c,deleteWsLoading:u,repos:d,addRepoLoading:f,handleAddRepo:p,showToast:m,sessionProps:h,changesProps:g,knowledgeProps:_,planProps:v}=e,[y,b]=(0,Q.useState)(0),x=t.find(e=>e.branchName===r)??null,S=x?.mode??`worktree`,{open:C}=Ft(),[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{if(!x?.branchName){T(!1);return}let e=!0;return fetch(`/api/workspace/${encodeURIComponent(x.branchName)}/migration-status`).then(e=>e.ok?e.json():{isLegacy:!1}).then(t=>{e&&T(!!t?.isLegacy)}).catch(()=>{e&&T(!1)}),()=>{e=!1}},[x?.branchName]);let O=async()=>{if(!(!x?.branchName||E)){D(!0);try{if(!(await fetch(`/api/workspace/${encodeURIComponent(x.branchName)}/migrate`,{method:`POST`})).ok)throw Error(`Migration failed`);m?.(`Workspace successfully upgraded to native ${Ne}!`,`success`),T(!1),e.fetchWorkspaces?.()}catch(e){m?.(e.message||`Failed to migrate workspace`,`error`)}finally{D(!1)}}},k=jt(x?.branchName??null).data,{data:A=[]}=Kt(x?.branchName),j=A.filter(e=>k?.enabledSkills?.includes(e.id)),[M,N]=(0,Q.useState)(null),{data:P=[]}=dn(),F=Fe(),I=xt(),L=Ke(),[R,z]=(0,Q.useState)(!1),[ee,B]=(0,Q.useState)(``),[te,ne]=(0,Q.useState)(!1),[re,H]=(0,Q.useState)(!1),[U,ie]=(0,Q.useState)(``),[W,G]=(0,Q.useState)(``),[K,ae]=(0,Q.useState)(``),[oe,se]=(0,Q.useState)(`vertical`),[ce,ue]=(0,Q.useState)(``),[de,pe]=(0,Q.useState)(``),[me,he]=(0,Q.useState)(``),[ge,_e]=(0,Q.useState)(``),[ve,ye]=(0,Q.useState)(`edit`),[be,Se]=(0,Q.useState)(!1),[q,we]=(0,Q.useState)(null),[Ee,Me]=(0,Q.useState)(``),[Pe,Ie]=(0,Q.useState)(``),[Le,Re]=(0,Q.useState)(`vertical`),[ze,Be]=(0,Q.useState)(``),[He,Ue]=(0,Q.useState)(``),[Ge,qe]=(0,Q.useState)(``),[Je,Ye]=(0,Q.useState)([]),[Xe,Ze]=(0,Q.useState)(``),[Qe,$e]=(0,Q.useState)(`edit`),[et,tt]=(0,Q.useState)([]),[nt,it]=(0,Q.useState)(``),[at,ot]=(0,Q.useState)(``),[st,ut]=(0,Q.useState)(!1),[dt,ft]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{if(!x){N(null);return}B(x.description||``),z(!1),pt(x.branchName)},[x?.branchName]);let pt=async e=>{try{let t=await Y(`/api/workspace/${encodeURIComponent(e)}/domain-packs`);t&&N(t)}catch{N(null)}},ht=async t=>{if(!x)return;let n=new Set(M?.assignedDomainPackIds||x.domainPacks||[]);n.has(t)?n.delete(t):n.add(t);let r=Array.from(n);try{await Y(`/api/workspace/${encodeURIComponent(x.branchName)}/domain-packs`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({domainPacks:r})}),await pt(x.branchName),e.fetchWorkspaces&&await e.fetchWorkspaces(),m?.(`Updated domain packs (${r.length} active)`,`success`)}catch{m?.(`Failed to update domain packs`,`error`)}},gt=async()=>{if(!(!x||!ee.trim())){ne(!0);try{let t=await Y(`/api/workspace/${encodeURIComponent(x.branchName)}/update-spec`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({description:ee.trim(),autoMatchDomains:!0})});z(!1),await pt(x.branchName),e.fetchWorkspaces&&await e.fetchWorkspaces(),t?.newlyMatched?.length>0?m?.(`Specification saved! Auto-attached domain packs: ${t.newlyMatched.join(`, `)}`,`success`):m?.(`Specification updated and context refreshed`,`success`)}catch{m?.(`Failed to update specification`,`error`)}finally{ne(!1)}}},_t=async()=>{if(!(!W.trim()||!U.trim())){Se(!0);try{let e=me.split(`
10
+ `).map(e=>e.trim()).filter(Boolean),t=ge.trim()?[{name:ge.trim(),target:ve}]:void 0;await F.mutateAsync({id:W.trim().toLowerCase(),name:U.trim(),description:K.trim(),categoryType:oe,parent:oe===`vertical`&&ce.trim()?ce.trim():void 0,verifyCommand:de.trim()||void 0,rules:e.length>0?e:void 0,microservices:t,tags:[W.trim().toLowerCase(),...U.trim().toLowerCase().split(/\s+/).filter(Boolean)]}),x&&await ht(W.trim().toLowerCase()),H(!1),G(``),ie(``),ae(``),ue(``),pe(``),he(``),_e(``),m?.(`Created category "${U}" and attached to workspace!`,`success`)}catch(e){m?.(e.message||`Failed to create category tag`,`error`)}finally{Se(!1)}}},yt=e=>{we(e),Me(e.name||``),Ie(e.description||``),Re(e.categoryType||`vertical`),Be(e.parent||``),Ue(e.verifyCommand||``),qe(e.rules?e.rules.join(`
11
+ `):``);let t=e.microservices?e.microservices.map(e=>({name:e.name,target:e.target||`edit`})):e.defaultRepos?e.defaultRepos.map(e=>({name:e,target:`edit`})):[];Ye(t),Ze(``),$e(`edit`),tt(e.skills?[...e.skills]:[]),it(``),ot(e.tags?e.tags.join(`, `):``)},bt=async()=>{if(!(!q||!Ee.trim())){ut(!0);try{let t=Ge.split(`
12
+ `).map(e=>e.trim()).filter(Boolean),n=at.split(`,`).map(e=>e.trim().toLowerCase()).filter(Boolean),r={id:q.id,name:Ee.trim(),description:Pe.trim(),categoryType:Le,parent:Le===`vertical`?ze.trim():``,verifyCommand:He.trim(),rules:t,microservices:Je,skills:et,tags:n.length>0?n:[q.id]};await I.mutateAsync(r),x&&(await pt(x.branchName),e.fetchWorkspaces&&await e.fetchWorkspaces()),m?.(`Tag "${Ee.trim()}" updated successfully`,`success`),we(null)}catch(e){m?.(e.message||`Failed to update tag`,`error`)}finally{ut(!1)}}},St=async()=>{if(!q)return;let t=!!(q.builtin&&!q.isTemplate),n=t?`reset to built-in template`:`delete`;if(window.confirm(`Are you sure you want to ${n} the tag "${q.name}"?`)){ft(!0);try{if(await L.mutateAsync(q.id),x){let n=M?.assignedDomainPackIds||x.domainPacks||[];if(!t&&n.includes(q.id)){let e=n.filter(e=>e!==q.id);await Y(`/api/workspace/${encodeURIComponent(x.branchName)}/domain-packs`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({domainPacks:e})})}await pt(x.branchName),e.fetchWorkspaces&&await e.fetchWorkspaces()}m?.(t?`Reset "${q.name}" to built-in defaults`:`Deleted tag "${q.name}"`,`success`),we(null)}catch(e){m?.(e.message||`Failed to delete/reset tag`,`error`)}finally{ft(!1)}}},Ct=x?x.repos.map(e=>{let t=At(e),n=g.gitChanges?.find(e=>e.repoName===t);return{name:t,path:e,changedCount:n?n.files?.length??0:null}}):[],wt=x?d.filter(e=>!x.repos.includes(e.path)):[],Ot=kt(),[Mt,Pt]=(0,Q.useState)(null),zt=Ot.data?.filter(e=>e.kind===`editor`&&e.available)??[],X=zt.find(e=>e.id===`vscode-insiders`)||zt.find(e=>e.id===`vscode`)||zt[0],Ut=async e=>{if(!(Mt||!x)){Pt(e);try{await Y(`/api/workspace/${encodeURIComponent(x.branchName)}/launch`,{method:`POST`,body:JSON.stringify({targetId:e})}),m?.(`Opened workspace in ${e}.`,`success`)}catch(t){m?.(`Failed to open ${e}: ${t instanceof Error?t.message:String(t)}`,`error`)}finally{Pt(null)}}};return(0,$.jsxs)(`div`,{className:`flex flex-col h-full animate-fade-in w-full min-w-0 bg-transparent`,children:[x?(0,$.jsx)(`div`,{className:`flex-1 min-w-0 h-full overflow-y-auto`,children:(0,$.jsx)(`div`,{className:`mx-auto flex w-full max-w-6xl flex-col`,children:(()=>{if(!x)return null;let e=n[x.branchName],t=S===`in-place`?null:e?Vt(e.syncStatus):null,r=e?.changedFiles??0;return(0,$.jsxs)(`div`,{className:`flex flex-col min-w-0 pb-12`,children:[(0,$.jsx)(`div`,{className:`border-b border-border/80 bg-card/75 backdrop-blur-md px-6 py-5 shadow-xs`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 md:flex-row md:items-center md:justify-between`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2.5`,children:[(0,$.jsx)(`div`,{className:`grid size-7 place-items-center rounded-md bg-primary/15 text-primary border border-primary/25 shrink-0`,children:(0,$.jsx)(xe,{size:15})}),(0,$.jsx)(`h1`,{className:`truncate font-mono text-base sm:text-lg font-extrabold text-foreground tracking-tight`,title:x.branchName,children:x.branchName}),(0,$.jsx)(`button`,{type:`button`,onClick:async()=>{await Qt(x.branchName)&&m?.(`Copied branch name to clipboard.`,`success`)},className:`text-muted-foreground hover:text-primary transition-colors p-1 rounded-md hover:bg-accent cursor-pointer`,title:`Copy branch name`,children:(0,$.jsx)(rt,{size:13})}),(0,$.jsx)(`span`,{className:`inline-flex items-center rounded-md border border-primary/20 bg-primary/10 px-2 py-0.5 font-mono text-[10px] font-bold text-primary uppercase tracking-wider`,children:S===`in-place`?`In-Place Mode`:`Worktree Mode`})]}),(0,$.jsxs)(`div`,{className:`mt-2.5 flex flex-wrap items-center gap-3 font-mono text-[11px] text-muted-foreground`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5 text-foreground/80 font-medium`,children:[(0,$.jsx)(lt,{size:13,className:`text-muted-foreground`}),x.repos.length,` `,x.repos.length===1?`repo`:`repos`]}),(0,$.jsx)(`span`,{children:`•`}),r>0?(0,$.jsxs)(`button`,{type:`button`,onClick:()=>a(x.branchName,`changes`),className:`flex items-center gap-1.5 text-amber-400 font-semibold hover:underline cursor-pointer`,children:[(0,$.jsx)(`span`,{className:`size-2 rounded-full bg-amber-400 animate-pulse`}),r,` modified files`]}):(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5 text-emerald-400 font-medium`,children:[(0,$.jsx)(`span`,{className:`size-2 rounded-full bg-emerald-400`}),`Clean worktrees`]}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsxs)(`span`,{className:`text-muted-foreground/80`,children:[`Created `,new Date(x.createdAt).toLocaleDateString()]}),t&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`•`}),(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5 text-primary font-medium`,children:[(0,$.jsx)(ct,{size:11,className:`animate-spin-slow`}),` `,t.label]})]})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[X&&(zt.length>1?(0,$.jsxs)(`div`,{className:`inline-flex h-9 items-center rounded-lg border border-border bg-card shadow-xs hover:border-primary/40 transition-colors`,children:[(0,$.jsxs)(`button`,{type:`button`,disabled:!!Mt,onClick:()=>void Ut(X.id),title:`Open workspace in ${X.name}`,className:`inline-flex h-full items-center gap-2 px-3.5 text-xs font-bold text-foreground hover:bg-accent transition-colors cursor-pointer rounded-l-lg`,children:[Mt===X.id?(0,$.jsx)(J,{className:`size-3.5`}):Rr(X.id,X.name),(0,$.jsx)(`span`,{children:X.name})]}),(0,$.jsxs)(Ve,{children:[(0,$.jsx)(We,{"aria-label":`Choose editor`,className:`inline-flex h-full w-7 items-center justify-center text-muted-foreground hover:text-foreground hover:bg-accent border-l border-border transition-colors cursor-pointer rounded-r-lg`,children:(0,$.jsx)(le,{size:13})}),(0,$.jsxs)(mt,{align:`end`,className:`w-56`,children:[(0,$.jsx)(`div`,{className:`px-2.5 py-1 text-[10px] font-bold text-muted-foreground uppercase tracking-wider`,children:`Open Workspace In`}),zt.map(e=>(0,$.jsxs)(sn,{onClick:()=>void Ut(e.id),className:s(`flex items-center justify-between text-xs py-2`,e.id===X.id&&`font-bold text-primary bg-primary/5`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[Rr(e.id,e.name),(0,$.jsx)(`span`,{className:`truncate`,children:e.name})]}),e.id===X.id&&(0,$.jsx)(`span`,{className:`text-[10px] text-primary font-mono font-bold`,children:`(default)`})]},e.id))]})]})]}):(0,$.jsxs)(l,{variant:`outline`,size:`sm`,disabled:!!Mt,onClick:()=>void Ut(X.id),title:`Open workspace in ${X.name}`,className:`font-bold h-9 gap-2`,children:[Mt===X.id?(0,$.jsx)(J,{className:`size-3.5`}):Rr(X.id,X.name),(0,$.jsx)(`span`,{children:X.name})]})),(0,$.jsxs)(l,{variant:`outline`,size:`sm`,onClick:()=>o(x),"aria-label":`Copy Context`,title:`Copy AI Context prompt for external LLM`,className:`h-9 gap-1.5 text-xs font-semibold`,children:[(0,$.jsx)(rt,{size:13}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:`Copy Context`})]}),(0,$.jsxs)(Ve,{children:[(0,$.jsx)(We,{"aria-label":`Workspace actions`,className:`grid size-9 place-items-center rounded-lg border border-border bg-card text-muted-foreground hover:text-foreground hover:bg-accent transition-colors cursor-pointer shadow-xs`,children:(0,$.jsx)(Tn,{size:15})}),(0,$.jsxs)(mt,{align:`end`,className:`w-52`,children:[(0,$.jsxs)(sn,{onClick:()=>o(x),className:`flex items-center gap-2 text-xs py-2`,children:[(0,$.jsx)(rt,{size:13}),` `,(0,$.jsx)(`span`,{children:`Copy AI Context`})]}),(0,$.jsxs)(sn,{onClick:()=>void c(x.branchName),disabled:u===x.branchName,className:`flex items-center gap-2 text-xs py-2 text-destructive hover:bg-destructive/10`,children:[(0,$.jsx)(Te,{size:13}),(0,$.jsx)(`span`,{children:u===x.branchName?`Deleting…`:`Delete Workspace`})]})]})]})]})]})}),(0,$.jsxs)(`div`,{className:`px-6 pt-5`,children:[w&&(0,$.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-between gap-3 rounded-xl border border-amber-500/30 bg-gradient-to-r from-amber-500/15 via-orange-500/10 to-transparent p-3 backdrop-blur-md shadow-xs`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5 text-xs text-amber-200`,children:[(0,$.jsx)(on,{size:16,className:`text-amber-400 shrink-0 animate-pulse`}),(0,$.jsxs)(`span`,{children:[(0,$.jsxs)(`strong`,{className:`font-semibold text-amber-300`,children:[`Legacy `,je,` Workspace:`]}),` Upgrade to native `,Ne,` manifest and synchronized artifacts.`]})]}),(0,$.jsxs)(`button`,{type:`button`,onClick:O,disabled:E,className:`inline-flex items-center gap-1.5 rounded-lg bg-gradient-to-r from-amber-500 to-orange-500 hover:from-amber-400 hover:to-orange-400 px-3 py-1.5 text-xs font-bold text-white shadow-sm transition-all active:scale-95 disabled:opacity-50 cursor-pointer`,children:[(0,$.jsx)(bn,{size:14,className:E?`animate-spin`:``}),E?`Upgrading...`:`Migrate to ${Ne}`]})]}),(0,$.jsxs)(Ae,{value:i,onValueChange:e=>typeof e==`string`&&a(x.branchName,e),className:`mb-6`,children:[(0,$.jsx)(Oe,{className:`w-full flex-nowrap overflow-x-auto justify-start gap-1.5 p-1.5 rounded-xl border border-border/70 bg-card/60 backdrop-blur-md shadow-xs`,children:zr.map(e=>{let t=e.icon,n=i===e.value,a=null;return e.value===`changes`&&r>0?a=(0,$.jsx)(`span`,{className:`ml-1.5 inline-flex items-center justify-center rounded-full bg-amber-500/20 px-1.5 py-0.2 text-[10px] font-mono font-bold text-amber-400`,children:r}):e.value===`skills`&&j.length>0&&(a=(0,$.jsx)(`span`,{className:`ml-1.5 inline-flex items-center justify-center rounded-full bg-primary/20 px-1.5 py-0.2 text-[10px] font-mono font-bold text-primary`,children:j.length})),(0,$.jsxs)(De,{value:e.value,"aria-label":e.ariaLabel||e.label,className:s(`flex shrink-0 items-center gap-2 px-3.5 py-2 text-xs font-bold rounded-lg transition-all cursor-pointer`,n?`bg-card text-foreground shadow-xs border border-primary/30 text-primary ring-1 ring-primary/20`:`text-muted-foreground hover:text-foreground hover:bg-accent/70`),children:[(0,$.jsx)(t,{size:14,className:s(`shrink-0`,n?`text-primary`:`text-muted-foreground`)}),(0,$.jsx)(`span`,{children:e.label}),a]},e.value)})}),(0,$.jsxs)(ke,{value:i,className:`animate-fade-in pt-4`,children:[i===`overview`&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,$.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-3`,children:[(0,$.jsxs)(`div`,{onClick:()=>a(x.branchName,`changes`),className:`px-4 py-3 rounded-xl border border-border/80 bg-card/70 hover:bg-card hover:border-primary/40 transition-all cursor-pointer shadow-xs flex items-center justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[(0,$.jsx)(`span`,{className:`grid size-8 place-items-center rounded-lg bg-primary/10 text-primary shrink-0 border border-primary/20`,children:(0,$.jsx)(En,{size:14})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`text-[10px] font-bold text-muted-foreground uppercase tracking-wider`,children:`Git Status`}),(0,$.jsx)(`div`,{className:`text-sm font-extrabold font-mono text-foreground truncate`,children:r>0?(0,$.jsxs)(`span`,{className:`text-amber-400`,children:[r,` Modified`]}):(0,$.jsx)(`span`,{className:`text-emerald-400`,children:`Clean Tree`})})]})]}),(0,$.jsxs)(`span`,{className:`text-[10px] font-mono text-muted-foreground`,children:[x.repos.length,` `,x.repos.length===1?`repo`:`repos`]})]}),(0,$.jsxs)(`div`,{className:`px-4 py-3 rounded-xl border border-border/80 bg-card/70 shadow-xs flex items-center justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[(0,$.jsx)(`span`,{className:`grid size-8 place-items-center rounded-lg bg-primary/10 text-primary shrink-0 border border-primary/20`,children:(0,$.jsx)(un,{size:14})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`text-[10px] font-bold text-muted-foreground uppercase tracking-wider`,children:`Flow Mode`}),(0,$.jsxs)(`div`,{className:`text-sm font-extrabold text-foreground capitalize flex items-center gap-1.5 truncate`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-emerald-400 animate-pulse shrink-0`}),x.flowType?x.flowType.replace(`-`,` `):`Feature Flow`]})]})]}),(0,$.jsx)(`span`,{className:`text-[10px] font-mono text-muted-foreground capitalize`,children:S})]}),(0,$.jsxs)(`div`,{onClick:()=>a(x.branchName,`sessions`),className:`px-4 py-3 rounded-xl border border-border/80 bg-card/70 hover:bg-card hover:border-primary/40 transition-all cursor-pointer shadow-xs flex items-center justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[(0,$.jsx)(`span`,{className:`grid size-8 place-items-center rounded-lg bg-primary/10 text-primary shrink-0 border border-primary/20`,children:(0,$.jsx)(vt,{size:14})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`text-[10px] font-bold text-muted-foreground uppercase tracking-wider`,children:`AI Assistant`}),(0,$.jsx)(`div`,{className:`text-sm font-extrabold text-foreground capitalize truncate`,children:x.assistants[0]||`Antigravity`})]})]}),(0,$.jsx)(`span`,{className:`text-[10px] font-mono text-muted-foreground`,children:`Ready`})]}),(0,$.jsxs)(`div`,{onClick:()=>a(x.branchName,`skills`),className:`px-4 py-3 rounded-xl border border-border/80 bg-card/70 hover:bg-card hover:border-primary/40 transition-all cursor-pointer shadow-xs flex items-center justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[(0,$.jsx)(`span`,{className:`grid size-8 place-items-center rounded-lg bg-primary/10 text-primary shrink-0 border border-primary/20`,children:(0,$.jsx)(An,{size:14})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`text-[10px] font-bold text-muted-foreground uppercase tracking-wider`,children:`Skills Active`}),(0,$.jsxs)(`div`,{className:`text-sm font-extrabold font-mono text-foreground truncate`,children:[j.length,` `,(0,$.jsx)(`span`,{className:`text-xs font-semibold text-muted-foreground`,children:`toolkits`})]})]})]}),(0,$.jsx)(`span`,{className:`text-[10px] font-mono text-muted-foreground`,children:`Manage`})]})]}),(0,$.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-12 gap-6 items-start`,children:[(0,$.jsx)(`div`,{className:`lg:col-span-7 space-y-6`,children:(0,$.jsxs)(`div`,{className:`rounded-xl border border-border bg-card p-5 space-y-3`,children:[(0,$.jsx)(`h3`,{className:`font-semibold`,children:`Plan, assignment & source documents`}),(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Set the current AI stage, attach requirements, and manage milestone progress in one place.`}),(0,$.jsx)(l,{onClick:()=>a(x.branchName,`plan`),children:`Open plan & sources`})]})}),(0,$.jsxs)(`div`,{className:`lg:col-span-5 space-y-6`,children:[(0,$.jsxs)(pn,{className:`border-border/80 bg-card/70 backdrop-blur-md rounded-xl overflow-hidden shadow-xs`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-border/60 bg-muted/20`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,$.jsx)(lt,{size:16,className:`text-primary`}),(0,$.jsxs)(`h3`,{className:`text-xs font-extrabold uppercase tracking-wider text-foreground`,children:[`Mapped Repositories (`,x.repos.length,`)`]})]}),wt.length>0&&(0,$.jsx)(Cr,{repos:wt,disabled:f,onAdd:e=>{window.confirm(`Add repository "${At(e)}" to this workspace?\nThis creates a new git worktree and re-runs analysis.`)&&p(x.branchName,e)}})]}),(0,$.jsx)(`div`,{className:`divide-y divide-border/60`,children:Ct.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between p-3.5 hover:bg-accent/40 transition-colors text-xs`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,$.jsx)(`span`,{className:s(`size-2.5 rounded-full shrink-0 shadow-xs`,e.changedCount===null?`bg-muted-foreground`:e.changedCount>0?`bg-amber-400 animate-pulse`:`bg-emerald-400`),title:e.changedCount===null?`Status unknown`:e.changedCount>0?`${e.changedCount} uncommitted changes`:`Clean`}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`font-mono font-bold text-foreground text-xs sm:text-sm truncate`,children:e.name}),(0,$.jsx)(`div`,{className:`font-mono text-[10px] text-muted-foreground/80 truncate max-w-xs`,children:e.path})]})]}),(0,$.jsx)(`div`,{className:`flex items-center gap-2 shrink-0`,children:(0,$.jsx)(`span`,{className:s(`font-mono text-[10px] font-semibold px-2 py-0.5 rounded-md border`,e.changedCount===null?`border-border bg-muted/60 text-muted-foreground`:e.changedCount>0?`border-amber-500/30 bg-amber-500/10 text-amber-400`:`border-emerald-500/30 bg-emerald-500/10 text-emerald-400`),children:e.changedCount===null?`—`:e.changedCount>0?`${e.changedCount} mod`:`Clean`})})]},e.name))})]}),(0,$.jsxs)(pn,{className:`p-4 border-border/80 bg-card/70 backdrop-blur-md rounded-xl shadow-xs space-y-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Et,{size:14,className:`text-primary`}),(0,$.jsx)(`h4`,{className:`text-xs font-extrabold uppercase tracking-wider text-foreground`,children:`Task brief & category rules`})]}),R?(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(l,{size:`xs`,variant:`ghost`,onClick:()=>z(!1),className:`h-6 px-2 text-[11px] text-muted-foreground`,disabled:te,children:`Cancel`}),(0,$.jsxs)(l,{size:`xs`,variant:`default`,onClick:()=>void gt(),className:`h-6 px-2.5 text-[11px] gap-1 bg-primary hover:bg-primary/90 text-primary-foreground font-semibold`,disabled:te,children:[te?(0,$.jsx)(J,{size:`sm`}):(0,$.jsx)(Z,{size:11}),(0,$.jsx)(`span`,{children:`Save & Match`})]})]}):(0,$.jsxs)(l,{size:`xs`,variant:`ghost`,onClick:()=>{B(x.description||``),z(!0)},className:`h-6 px-2 text-[11px] gap-1 text-muted-foreground hover:text-foreground`,children:[(0,$.jsx)(kn,{size:11}),(0,$.jsx)(`span`,{children:`Edit brief`})]})]}),(0,$.jsxs)(`div`,{className:`space-y-2 pt-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[M?.organization&&(0,$.jsxs)(`div`,{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-lg text-xs font-semibold border border-purple-500/30 bg-purple-500/10 text-purple-300 shadow-xs`,title:`Universal Root Conventions: ${M.organization.name}. Commit pattern: ${M.organization.commitMessagePattern}`,children:[(0,$.jsx)(gn,{size:11,className:`text-purple-400 shrink-0`}),(0,$.jsxs)(`span`,{children:[M.organization.name,` Root`]}),(0,$.jsx)(`span`,{className:`text-[9px] px-1 py-0.2 rounded bg-purple-500/20 text-purple-200 font-mono`,children:`Conventions`})]}),P.length===0&&!M?.organization&&(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground italic py-1`,children:`No category or trait tags defined yet.`}),P.filter(e=>e.categoryType!==`trait`&&(!e.parent||!P.some(t=>t.id===e.parent))).map(e=>{let t=(M?.assignedDomainPackIds||x.domainPacks||[]).includes(e.id),n=P.filter(t=>t.parent===e.id);return(0,$.jsxs)(`div`,{className:`inline-flex items-center rounded-lg border border-border/60 bg-muted/20 p-0.5 gap-1`,children:[(0,$.jsxs)(`div`,{className:`inline-flex items-center`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>void ht(e.id),className:s(`inline-flex items-center gap-1 px-2 py-0.5 rounded-l-md text-xs font-medium transition-all cursor-pointer`,t?`bg-emerald-500/20 text-emerald-300 font-semibold shadow-xs`:`text-muted-foreground hover:bg-muted/50 hover:text-foreground`),title:`${e.name}: ${e.description} (Click to toggle)`,children:[(0,$.jsx)(Ce,{size:10,className:t?`text-emerald-400`:`text-muted-foreground`}),(0,$.jsx)(`span`,{children:e.name}),!e.isTemplate&&(0,$.jsx)(`span`,{className:`text-[8px] px-1 py-0.2 rounded bg-amber-500/20 text-amber-300 font-mono`,children:`custom`}),t?(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-emerald-400`}):(0,$.jsx)(Bt,{size:10,className:`opacity-50`})]}),(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),yt(e)},className:s(`px-1 py-1 rounded-r-md text-muted-foreground/70 hover:text-foreground hover:bg-muted/60 transition-colors cursor-pointer`,t?`bg-emerald-500/20 text-emerald-300/80 hover:text-emerald-200`:``),title:`Inspect & edit ${e.name} details`,"aria-label":`Inspect & edit ${e.name} details`,children:(0,$.jsx)(Fn,{size:10})})]}),n.map(t=>{let n=(M?.assignedDomainPackIds||x.domainPacks||[]).includes(t.id);return(0,$.jsxs)(`div`,{className:`inline-flex items-center`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>void ht(t.id),className:s(`inline-flex items-center gap-1 px-1.5 py-0.5 rounded-l-md text-[11px] font-medium transition-all cursor-pointer border-y border-l`,n?`border-emerald-500/40 bg-emerald-500/25 text-emerald-200 font-semibold shadow-xs`:`border-transparent text-muted-foreground/80 hover:bg-muted/50 hover:text-foreground`),title:`${t.name} (Inherits ${e.name}): ${t.description} (Click to toggle)`,children:[(0,$.jsx)(`span`,{className:`text-muted-foreground text-[10px]`,children:`↳`}),(0,$.jsx)(`span`,{children:t.name.replace(/^.*\s*›\s*/,``)}),!t.isTemplate&&(0,$.jsx)(`span`,{className:`text-[8px] px-1 py-0.2 rounded bg-amber-500/20 text-amber-300 font-mono`,children:`custom`}),n?(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-emerald-400`}):(0,$.jsx)(Bt,{size:9,className:`opacity-50`})]}),(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),yt(t)},className:s(`px-1 py-1 rounded-r-md text-muted-foreground/70 hover:text-foreground hover:bg-muted/60 transition-colors cursor-pointer border-y border-r`,n?`border-emerald-500/40 bg-emerald-500/25 text-emerald-200/80 hover:text-emerald-100`:`border-transparent`),title:`Inspect & edit ${t.name} details`,"aria-label":`Inspect & edit ${t.name} details`,children:(0,$.jsx)(Fn,{size:9})})]},t.id)})]},e.id)}),P.filter(e=>e.categoryType===`trait`).map(e=>{let t=(M?.assignedDomainPackIds||x.domainPacks||[]).includes(e.id);return(0,$.jsxs)(`div`,{className:s(`inline-flex items-center rounded-lg border transition-all p-0.5 gap-0.5`,t?`border-indigo-500/40 bg-indigo-500/15 text-indigo-300 shadow-xs`:`border-border/60 bg-muted/30 text-muted-foreground hover:bg-muted/60 hover:text-foreground`),children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>void ht(e.id),className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-l-md text-xs font-medium cursor-pointer`,title:`Cross-cutting Trait: ${e.name} - ${e.description} (Click to toggle)`,children:[(0,$.jsx)(fe,{size:11,className:t?`text-indigo-400`:`text-muted-foreground`}),(0,$.jsx)(`span`,{children:e.name}),(0,$.jsx)(`span`,{className:`text-[9px] px-1 py-0.2 rounded bg-indigo-500/20 text-indigo-200 font-mono`,children:`Trait`}),!e.isTemplate&&(0,$.jsx)(`span`,{className:`text-[8px] px-1 py-0.2 rounded bg-amber-500/20 text-amber-300 font-mono`,children:`custom`}),t?(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-indigo-400`}):(0,$.jsx)(Bt,{size:10,className:`opacity-50`})]}),(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),yt(e)},className:`p-1 rounded-r-md text-muted-foreground/70 hover:text-foreground hover:bg-muted/60 transition-colors cursor-pointer`,title:`Inspect & edit ${e.name} details`,"aria-label":`Inspect & edit ${e.name} details`,children:(0,$.jsx)(Fn,{size:10})})]},e.id)})]}),(0,$.jsxs)(l,{size:`xs`,variant:`ghost`,onClick:()=>H(!0),className:`h-6 px-2 text-[11px] gap-1 text-muted-foreground hover:text-foreground border border-dashed border-border/80`,children:[(0,$.jsx)(Bt,{size:11}),(0,$.jsx)(`span`,{children:`New Category / Trait`})]})]}),(M?.editRepos&&M.editRepos.length>0||M?.referenceRepos&&M.referenceRepos.length>0)&&(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 p-2 rounded-lg bg-muted/40 border border-border/60 text-xs`,children:[(0,$.jsxs)(`span`,{className:`font-semibold text-muted-foreground flex items-center gap-1 text-[11px]`,children:[(0,$.jsx)(lt,{size:12,className:`text-primary`}),(0,$.jsx)(`span`,{children:`Scoped Microservices:`})]}),M.editRepos?.map(e=>(0,$.jsxs)(`span`,{className:`px-2 py-0.5 rounded bg-primary/10 text-primary border border-primary/20 font-mono text-[11px] flex items-center gap-1 shadow-xs`,title:`Active Worktree (Edit Mode)`,children:[(0,$.jsx)(kn,{size:10}),(0,$.jsx)(`span`,{children:e}),(0,$.jsx)(`span`,{className:`text-[9px] opacity-75 font-sans font-semibold`,children:`(edit)`})]},e)),M.referenceRepos?.map(e=>(0,$.jsxs)(`span`,{className:`px-2 py-0.5 rounded bg-muted text-muted-foreground border border-border/80 font-mono text-[11px] flex items-center gap-1`,title:`Reference Mode (Read-only context)`,children:[(0,$.jsx)(`span`,{children:e}),(0,$.jsx)(`span`,{className:`text-[9px] opacity-75 font-sans`,children:`(ref)`})]},e))]})]}),R?(0,$.jsxs)(`div`,{className:`space-y-2 pt-1`,children:[(0,$.jsx)(`textarea`,{value:ee,onChange:e=>B(e.target.value),rows:5,placeholder:`Describe the intended outcome and acceptance criteria. Attach detailed source documents in Plan.`,className:`w-full text-xs font-mono p-3 rounded-lg border border-border/80 bg-background/80 text-foreground focus:outline-none focus:ring-1 focus:ring-primary leading-relaxed resize-y`}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] text-muted-foreground`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(on,{size:11,className:`text-amber-400`}),(0,$.jsx)(`span`,{children:`Auto-detects subsystem domain tags upon saving`})]}),(0,$.jsxs)(`span`,{children:[ee.length,` chars`]})]})]}):(0,$.jsx)(`div`,{className:`text-xs leading-relaxed text-foreground/90 max-h-44 overflow-y-auto pr-1`,children:x.description?(0,$.jsx)(ln,{content:x.description}):(0,$.jsx)(`div`,{className:`text-muted-foreground italic py-2`,children:`No task brief yet. Add a short outcome here and attach detailed sources in Plan.`})}),M?.allRules&&M.allRules.length>0&&(0,$.jsxs)(`div`,{className:`mt-2 pt-2 border-t border-border/50 space-y-1.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] font-bold uppercase tracking-wider text-muted-foreground`,children:[(0,$.jsx)(fe,{size:12,className:`text-emerald-400`}),(0,$.jsxs)(`span`,{children:[`Active Rules & Verification (`,M.allRules.length,`)`]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1 text-[9px] text-muted-foreground`,children:[(0,$.jsx)(`span`,{className:`px-1 py-0.2 rounded bg-purple-500/10 text-purple-300`,children:`Org Root`}),(0,$.jsx)(`span`,{children:`›`}),(0,$.jsx)(`span`,{className:`px-1 py-0.2 rounded bg-emerald-500/10 text-emerald-300`,children:`Verticals`}),(0,$.jsx)(`span`,{children:`›`}),(0,$.jsx)(`span`,{className:`px-1 py-0.2 rounded bg-indigo-500/10 text-indigo-300`,children:`Traits`})]})]}),(0,$.jsxs)(`div`,{className:`space-y-1 max-h-28 overflow-y-auto pr-1`,children:[M.allRules.slice(0,4).map((e,t)=>(0,$.jsxs)(`div`,{className:`text-[11px] text-muted-foreground/90 flex items-start gap-1.5 leading-snug`,children:[(0,$.jsx)(`span`,{className:`text-primary font-bold`,children:`›`}),(0,$.jsx)(`span`,{className:`truncate`,children:e})]},t)),M.allRules.length>4&&(0,$.jsxs)(`div`,{className:`text-[10px] text-muted-foreground italic pl-3`,children:[`+`,M.allRules.length-4,` more domain rules active in AGENTS.md`]})]})]})]}),(0,$.jsxs)(pn,{className:`border-border/80 bg-card/70 backdrop-blur-md rounded-xl p-4 shadow-xs`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(An,{size:15,className:`text-primary`}),(0,$.jsxs)(`h3`,{className:`text-xs font-extrabold uppercase tracking-wider text-foreground`,children:[`Skills & Capabilities (`,j.length,`)`]})]}),(0,$.jsxs)(l,{size:`xs`,variant:`outline`,onClick:()=>a(x.branchName,`skills`),className:`text-[11px] font-semibold gap-1 h-7`,children:[(0,$.jsx)(An,{size:11}),(0,$.jsx)(`span`,{children:`Configure`})]})]}),j.length===0?(0,$.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`No custom skills attached to this workspace.`}):(0,$.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:j.map(e=>(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-lg text-xs font-mono font-medium border border-border/70 bg-card/60`,title:e.description,children:[(0,$.jsx)(An,{size:10,className:`text-primary`}),e.title||e.name]},e.id))})]})]})]})]}),i===`sessions`&&(0,$.jsxs)(`section`,{"aria-labelledby":`session-history-heading`,className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center justify-between gap-3 p-4 rounded-xl border border-border bg-card shadow-xs`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{id:`session-history-heading`,className:`text-sm font-semibold text-foreground`,children:`AI Sessions & History`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:`Inspect recorded session logs, turns, and token usage, or open active conversations in the floating chat.`})]}),(0,$.jsxs)(l,{variant:`default`,size:`sm`,onClick:()=>C(x.branchName),className:`text-xs h-8 gap-1.5 shrink-0 cursor-pointer self-start sm:self-auto`,title:`Open floating multi-workspace chat`,children:[(0,$.jsx)(vt,{className:`size-3.5`}),(0,$.jsx)(`span`,{children:`Open Floating Chat`})]})]}),(0,$.jsx)(Dr,{ws:x,showToast:m,...h})]}),i===`changes`&&(0,$.jsx)(Or,{ws:x,...g}),i===`knowledge`&&(0,$.jsx)(kr,{ws:x,..._}),i===`skills`&&(0,$.jsx)(Lr,{ws:x,showToast:m}),i===`plan`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Fr,{workspaceId:x.branchName,onPlanChanged:()=>{b(e=>e+1),v.handleRetryPlan(x.branchName)}},x.branchName),(0,$.jsx)(Ar,{workspaceId:x.branchName,defaultViewMode:`flow`,...v},`${x.branchName}-${y}`)]}),i===`services`&&(0,$.jsx)(Qn,{ws:x})]})]})]})]})})()})}):(0,$.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-8`,children:(0,$.jsx)(`div`,{className:`max-w-md w-full`,children:(0,$.jsx)(en,{children:(0,$.jsxs)(Xt,{children:[(0,$.jsx)(Rt,{variant:`icon`,children:(0,$.jsx)(lt,{})}),(0,$.jsx)(Dt,{children:`No workspace selected`}),(0,$.jsx)(Wt,{children:`Select a workspace from the sidebar to inspect git changes, context, or launch AI assistants.`})]})})})}),(0,$.jsx)(Nt,{open:re,onOpenChange:H,children:(0,$.jsxs)(Tt,{className:`max-w-lg`,children:[(0,$.jsxs)(Lt,{children:[(0,$.jsxs)(rn,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Ce,{size:16,className:`text-primary`}),(0,$.jsx)(`span`,{children:`Create Enterprise Category or Trait`})]}),(0,$.jsx)(Jt,{children:`Define a vertical business subsystem or horizontal cross-cutting trait with architectural invariants, microservice bindings, and verification commands.`})]}),(0,$.jsxs)(It,{className:`space-y-3.5 py-2`,children:[(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`text-xs font-semibold text-foreground`,children:`Name`}),(0,$.jsx)(V,{value:U,onChange:e=>ie(e.target.value),placeholder:`e.g. Order Processing`,size:`sm`})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`text-xs font-semibold text-foreground`,children:`Tag ID / Slug`}),(0,$.jsx)(V,{value:W,onChange:e=>G(e.target.value),placeholder:`e.g. orders`,size:`sm`})]})]}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`text-xs font-semibold text-foreground`,children:`Type`}),(0,$.jsxs)(`select`,{value:oe,onChange:e=>se(e.target.value),className:`w-full h-7.5 px-2 text-xs rounded-md border border-border bg-background text-foreground`,children:[(0,$.jsx)(`option`,{value:`vertical`,children:`Vertical Subsystem`}),(0,$.jsx)(`option`,{value:`trait`,children:`Horizontal Trait`})]})]}),oe===`vertical`&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`text-xs font-semibold text-foreground`,children:`Parent Category (optional)`}),(0,$.jsxs)(`select`,{value:ce,onChange:e=>ue(e.target.value),className:`w-full h-7.5 px-2 text-xs rounded-md border border-border bg-background text-foreground`,children:[(0,$.jsx)(`option`,{value:``,children:`None (Top-level vertical)`}),P.filter(e=>e.categoryType!==`trait`&&!e.parent).map(e=>(0,$.jsxs)(`option`,{value:e.id,children:[e.name,` (#`,e.id,`)`]},e.id))]})]})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`text-xs font-semibold text-foreground`,children:`Description`}),(0,$.jsx)(V,{value:K,onChange:e=>ae(e.target.value),placeholder:`Brief description of scope & responsibility`,size:`sm`})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`text-xs font-semibold text-foreground`,children:`Verification Command`}),(0,$.jsx)(V,{value:de,onChange:e=>pe(e.target.value),placeholder:`e.g. npm test -- orders`,size:`sm`})]}),(0,$.jsxs)(`div`,{className:`grid grid-cols-3 gap-2`,children:[(0,$.jsxs)(`div`,{className:`col-span-2 space-y-1`,children:[(0,$.jsx)(`label`,{className:`text-xs font-semibold text-foreground`,children:`Microservice Binding (optional)`}),(0,$.jsx)(V,{value:ge,onChange:e=>_e(e.target.value),placeholder:`e.g. orders-service`,size:`sm`})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`text-xs font-semibold text-foreground`,children:`Target Mode`}),(0,$.jsxs)(`select`,{value:ve,onChange:e=>ye(e.target.value),className:`w-full h-7.5 px-2 text-xs rounded-md border border-border bg-background text-foreground`,children:[(0,$.jsx)(`option`,{value:`edit`,children:`Edit (Worktree)`}),(0,$.jsx)(`option`,{value:`reference`,children:`Reference Only`})]})]})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`text-xs font-semibold text-foreground`,children:`Architectural Invariants & Rules (one per line)`}),(0,$.jsx)(`textarea`,{rows:3,value:me,onChange:e=>he(e.target.value),placeholder:`e.g. Order amounts must always include currency code and tax breakdown.`,className:`w-full text-xs font-mono p-2 rounded-md border border-border bg-background text-foreground resize-y`})]})]}),(0,$.jsxs)(Ht,{children:[(0,$.jsx)(l,{variant:`outline`,size:`sm`,onClick:()=>H(!1),children:`Cancel`}),(0,$.jsxs)(l,{variant:`default`,size:`sm`,disabled:!W.trim()||!U.trim()||be,onClick:()=>void _t(),children:[be?(0,$.jsx)(J,{size:`sm`}):(0,$.jsx)(Z,{size:12}),(0,$.jsx)(`span`,{children:`Create Category`})]})]})]})}),(0,$.jsx)(Nt,{open:!!q,onOpenChange:e=>!e&&we(null),children:(0,$.jsxs)(Tt,{className:`max-w-xl max-h-[90vh] flex flex-col`,children:[(0,$.jsxs)(Lt,{children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between pr-6`,children:[(0,$.jsxs)(rn,{className:`flex items-center gap-2`,children:[Le===`trait`?(0,$.jsx)(fe,{size:18,className:`text-indigo-400`}):(0,$.jsx)(Ce,{size:18,className:`text-primary`}),(0,$.jsxs)(`span`,{children:[`Inspect & Edit `,Le===`trait`?`Trait`:`Category`]})]}),q&&(0,$.jsx)(`span`,{className:s(`text-[10px] px-2 py-0.5 rounded-full font-mono font-semibold border`,q.isTemplate?`border-blue-500/30 bg-blue-500/10 text-blue-300`:`border-amber-500/30 bg-amber-500/10 text-amber-300`),children:q.isTemplate?`Built-in Template`:`Custom / Overridden`})]}),(0,$.jsx)(Jt,{children:`View and configure full details: architectural invariants, verification command, scoped microservices, and attached agent skills.`})]}),(0,$.jsxs)(It,{className:`space-y-4 py-2 overflow-y-auto flex-1 pr-1`,children:[(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`text-xs font-semibold text-foreground`,children:`Name`}),(0,$.jsx)(V,{value:Ee,onChange:e=>Me(e.target.value),placeholder:`e.g. Order Processing`,size:`sm`})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`text-xs font-semibold text-foreground`,children:`Tag ID / Slug`}),(0,$.jsx)(V,{value:q?.id||``,disabled:!0,size:`sm`,className:`bg-muted/50 font-mono text-xs cursor-not-allowed`})]})]}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`text-xs font-semibold text-foreground`,children:`Category Type`}),(0,$.jsxs)(`select`,{value:Le,onChange:e=>Re(e.target.value),className:`w-full h-7.5 px-2 text-xs rounded-md border border-border bg-background text-foreground`,children:[(0,$.jsx)(`option`,{value:`vertical`,children:`Vertical Subsystem`}),(0,$.jsx)(`option`,{value:`trait`,children:`Horizontal Trait`})]})]}),Le===`vertical`&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`text-xs font-semibold text-foreground`,children:`Parent Category`}),(0,$.jsxs)(`select`,{value:ze,onChange:e=>Be(e.target.value),className:`w-full h-7.5 px-2 text-xs rounded-md border border-border bg-background text-foreground`,children:[(0,$.jsx)(`option`,{value:``,children:`None (Top-level vertical)`}),P.filter(e=>e.categoryType!==`trait`&&!e.parent&&e.id!==q?.id).map(e=>(0,$.jsxs)(`option`,{value:e.id,children:[e.name,` (#`,e.id,`)`]},e.id))]})]})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`text-xs font-semibold text-foreground`,children:`Description`}),(0,$.jsx)(V,{value:Pe,onChange:e=>Ie(e.target.value),placeholder:`Brief description of scope & responsibility`,size:`sm`})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`label`,{className:`text-xs font-semibold text-foreground`,children:`Architectural Invariants & Rules`}),(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`Injected into workspace AGENTS.md`})]}),(0,$.jsx)(`textarea`,{rows:4,value:Ge,onChange:e=>qe(e.target.value),placeholder:`e.g. Orders must be signed before publishing to event bus.
13
+ Amounts must include ISO-4217 currency code.`,className:`w-full text-xs font-mono p-2 rounded-md border border-border bg-background text-foreground resize-y leading-relaxed`})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`label`,{className:`text-xs font-semibold text-foreground`,children:`Mechanical Verification Command`}),(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`Runs during verification gates`})]}),(0,$.jsx)(V,{value:He,onChange:e=>Ue(e.target.value),placeholder:`e.g. npm test -- orders`,size:`sm`,className:`font-mono text-xs`})]}),(0,$.jsxs)(`div`,{className:`space-y-2 p-3 rounded-lg bg-muted/20 border border-border/60`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsxs)(`label`,{className:`text-xs font-semibold text-foreground flex items-center gap-1.5`,children:[(0,$.jsx)(lt,{size:13,className:`text-primary`}),(0,$.jsxs)(`span`,{children:[`Scoped Microservices (`,Je.length,`)`]})]}),(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`Worktrees created when tag attached`})]}),Je.length>0&&(0,$.jsx)(`div`,{className:`space-y-1.5 max-h-32 overflow-y-auto pr-1`,children:Je.map((e,t)=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-2 py-1 rounded bg-card border border-border/60 text-xs`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`font-mono text-xs font-medium text-foreground`,children:e.name}),(0,$.jsx)(`span`,{className:s(`text-[9px] px-1.5 py-0.2 rounded font-semibold`,e.target===`edit`?`bg-primary/15 text-primary border border-primary/20`:`bg-muted text-muted-foreground`),children:e.target===`edit`?`Edit (Worktree)`:`Reference`})]}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>Ye(e=>e.filter((e,n)=>n!==t)),className:`p-1 text-muted-foreground hover:text-destructive transition-colors cursor-pointer`,title:`Remove microservice binding`,children:(0,$.jsx)(an,{size:12})})]},t))}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,$.jsx)(V,{value:Xe,onChange:e=>Ze(e.target.value),placeholder:`Microservice repo name (e.g. orders-service)`,size:`sm`,className:`flex-1 text-xs font-mono`}),(0,$.jsxs)(`select`,{value:Qe,onChange:e=>$e(e.target.value),className:`h-7.5 px-2 text-xs rounded-md border border-border bg-background text-foreground`,children:[(0,$.jsx)(`option`,{value:`edit`,children:`Edit (Worktree)`}),(0,$.jsx)(`option`,{value:`reference`,children:`Reference Only`})]}),(0,$.jsxs)(l,{type:`button`,variant:`outline`,size:`xs`,disabled:!Xe.trim(),onClick:()=>{Xe.trim()&&(Ye(e=>[...e,{name:Xe.trim(),target:Qe}]),Ze(``))},className:`h-7.5 text-xs shrink-0`,children:[(0,$.jsx)(Bt,{size:11,className:`mr-1`}),`Add`]})]})]}),(0,$.jsxs)(`div`,{className:`space-y-2 p-3 rounded-lg bg-muted/20 border border-border/60`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsxs)(`label`,{className:`text-xs font-semibold text-foreground flex items-center gap-1.5`,children:[(0,$.jsx)(on,{size:13,className:`text-primary`}),(0,$.jsxs)(`span`,{children:[`Attached Skills (`,et.length,`)`]})]}),(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`Auto-activated when tag is selected`})]}),(0,$.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5 min-h-7`,children:et.length===0?(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground italic`,children:`No attached skills.`}):et.map(e=>{let t=A.find(t=>t.id===e);return(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-md text-[11px] bg-primary/10 text-primary border border-primary/20 font-medium`,children:[(0,$.jsx)(`span`,{children:t?.title||t?.name||e}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>tt(t=>t.filter(t=>t!==e)),className:`hover:text-destructive cursor-pointer ml-0.5`,children:(0,$.jsx)(an,{size:11})})]},e)})}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,$.jsxs)(`select`,{value:nt,onChange:e=>it(e.target.value),className:`flex-1 h-7.5 px-2 text-xs rounded-md border border-border bg-background text-foreground`,children:[(0,$.jsx)(`option`,{value:``,children:`Select a skill to attach...`}),A.filter(e=>!et.includes(e.id)).map(e=>(0,$.jsxs)(`option`,{value:e.id,children:[e.title||e.name,` (`,e.id,`)`]},e.id))]}),(0,$.jsxs)(l,{type:`button`,variant:`outline`,size:`xs`,disabled:!nt,onClick:()=>{nt&&(tt(e=>[...e,nt]),it(``))},className:`h-7.5 text-xs shrink-0`,children:[(0,$.jsx)(Bt,{size:11,className:`mr-1`}),`Attach Skill`]})]})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`text-xs font-semibold text-foreground`,children:`Discovery Tags (comma-separated)`}),(0,$.jsx)(V,{value:at,onChange:e=>ot(e.target.value),placeholder:`e.g. economy, finance, invoicing`,size:`sm`,className:`font-mono text-xs`})]})]}),(0,$.jsxs)(Ht,{className:`flex items-center justify-between sm:justify-between w-full pt-3 border-t`,children:[(0,$.jsx)(`div`,{children:!!(q&&(!q.builtin||!q.isTemplate))&&(0,$.jsxs)(l,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void St(),disabled:dt||st,className:`text-destructive hover:bg-destructive/10 border-destructive/30 text-xs gap-1.5`,children:[dt?(0,$.jsx)(J,{size:`sm`}):(0,$.jsx)(Mn,{size:12}),(0,$.jsx)(`span`,{children:q?.builtin?`Reset to Defaults`:`Delete Tag`})]})}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(l,{variant:`outline`,size:`sm`,onClick:()=>we(null),children:`Cancel`}),(0,$.jsxs)(l,{variant:`default`,size:`sm`,disabled:!Ee.trim()||st,onClick:()=>void bt(),className:`gap-1.5`,children:[st?(0,$.jsx)(J,{size:`sm`}):(0,$.jsx)(Z,{size:12}),(0,$.jsx)(`span`,{children:`Save Changes`})]})]})]})]})})]})}export{Br as WorkspacesPage};
@@ -1 +1 @@
1
- import{g as e,h as t,m as n}from"./button-CREn1mup.js";import{_t as r,ft as i,gt as a,ht as o,mt as s,pt as c,vt as l,yt as u}from"./index-3tD_IeyQ.js";var d=t(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]);function f(e){return s(`alert-dialog`,e)}var p=e(),m=f,h=o;function g({className:e,...t}){return(0,p.jsx)(u,{forceRender:!0,className:n(`fixed inset-0 z-50 bg-background/60 backdrop-blur-xs transition-all duration-200 data-ending-style:opacity-0 data-starting-style:opacity-0`,e),"data-slot":`alert-dialog-backdrop`,...t})}function _({className:e,...t}){return(0,p.jsx)(c,{className:n(`fixed inset-0 z-50 grid grid-rows-[1fr_auto_1fr] justify-items-center p-4`,e),"data-slot":`alert-dialog-viewport`,...t})}function v({className:e,bottomStickOnMobile:t=!0,...r}){return(0,p.jsxs)(h,{children:[(0,p.jsx)(g,{}),(0,p.jsx)(_,{className:n(t&&`max-sm:grid-rows-[1fr_auto] max-sm:p-0 max-sm:pt-12`),children:(0,p.jsx)(a,{className:n(`-translate-y-[calc(1.25rem*var(--nested-dialogs))] relative row-start-2 flex max-h-full min-h-0 w-full min-w-0 max-w-lg scale-[calc(1-0.1*var(--nested-dialogs))] flex-col rounded-2xl border bg-popover not-dark:bg-clip-padding text-popover-foreground opacity-[calc(1-0.1*var(--nested-dialogs))] shadow-lg/5 transition-[scale,opacity,translate] duration-200 ease-in-out will-change-transform before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-2xl)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] data-nested:data-ending-style:translate-y-8 data-nested:data-starting-style:translate-y-8 data-nested-dialog-open:origin-top data-ending-style:scale-98 data-starting-style:scale-98 data-ending-style:opacity-0 data-starting-style:opacity-0 dark:before:shadow-[0_-1px_--theme(--color-white/6%)]`,t&&`max-sm:max-w-none max-sm:rounded-none max-sm:border-x-0 max-sm:border-t max-sm:border-b-0 max-sm:opacity-[calc(1-min(var(--nested-dialogs),1))] max-sm:data-ending-style:translate-y-4 max-sm:data-starting-style:translate-y-4 max-sm:before:hidden max-sm:before:rounded-none`,e),"data-slot":`alert-dialog-popup`,...r})})]})}function y({className:e,...t}){return(0,p.jsx)(`div`,{className:n(`flex flex-col gap-2 p-6 text-center max-sm:pb-4 sm:text-left`,e),"data-slot":`alert-dialog-header`,...t})}function b({className:e,variant:t=`default`,...r}){return(0,p.jsx)(`div`,{className:n(`flex flex-col-reverse gap-2 px-6 sm:flex-row sm:justify-end sm:rounded-b-[calc(var(--radius-2xl)-1px)]`,t==="default"&&`border-t bg-muted/72 py-4`,t===`bare`&&`pb-6`,e),"data-slot":`alert-dialog-footer`,...r})}function x({className:e,...t}){return(0,p.jsx)(i,{className:n(`font-heading font-semibold text-xl leading-none`,e),"data-slot":`alert-dialog-title`,...t})}function S({className:e,...t}){return(0,p.jsx)(r,{className:n(`text-muted-foreground text-sm`,e),"data-slot":`alert-dialog-description`,...t})}function C(e){return(0,p.jsx)(l,{"data-slot":`alert-dialog-close`,...e})}export{y as a,d as c,b as i,C as n,v as o,S as r,x as s,m as t};
1
+ import{g as e,h as t,m as n}from"./button-CREn1mup.js";import{St as r,_t as i,bt as a,gt as o,ht as s,vt as c,xt as l,yt as u}from"./index-hTa55BQ6.js";var d=t(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]);function f(e){return i(`alert-dialog`,e)}var p=e(),m=f,h=c;function g({className:e,...t}){return(0,p.jsx)(r,{forceRender:!0,className:n(`fixed inset-0 z-50 bg-background/60 backdrop-blur-xs transition-all duration-200 data-ending-style:opacity-0 data-starting-style:opacity-0`,e),"data-slot":`alert-dialog-backdrop`,...t})}function _({className:e,...t}){return(0,p.jsx)(o,{className:n(`fixed inset-0 z-50 grid grid-rows-[1fr_auto_1fr] justify-items-center p-4`,e),"data-slot":`alert-dialog-viewport`,...t})}function v({className:e,bottomStickOnMobile:t=!0,...r}){return(0,p.jsxs)(h,{children:[(0,p.jsx)(g,{}),(0,p.jsx)(_,{className:n(t&&`max-sm:grid-rows-[1fr_auto] max-sm:p-0 max-sm:pt-12`),children:(0,p.jsx)(u,{className:n(`-translate-y-[calc(1.25rem*var(--nested-dialogs))] relative row-start-2 flex max-h-full min-h-0 w-full min-w-0 max-w-lg scale-[calc(1-0.1*var(--nested-dialogs))] flex-col rounded-2xl border bg-popover not-dark:bg-clip-padding text-popover-foreground opacity-[calc(1-0.1*var(--nested-dialogs))] shadow-lg/5 transition-[scale,opacity,translate] duration-200 ease-in-out will-change-transform before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-2xl)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] data-nested:data-ending-style:translate-y-8 data-nested:data-starting-style:translate-y-8 data-nested-dialog-open:origin-top data-ending-style:scale-98 data-starting-style:scale-98 data-ending-style:opacity-0 data-starting-style:opacity-0 dark:before:shadow-[0_-1px_--theme(--color-white/6%)]`,t&&`max-sm:max-w-none max-sm:rounded-none max-sm:border-x-0 max-sm:border-t max-sm:border-b-0 max-sm:opacity-[calc(1-min(var(--nested-dialogs),1))] max-sm:data-ending-style:translate-y-4 max-sm:data-starting-style:translate-y-4 max-sm:before:hidden max-sm:before:rounded-none`,e),"data-slot":`alert-dialog-popup`,...r})})]})}function y({className:e,...t}){return(0,p.jsx)(`div`,{className:n(`flex flex-col gap-2 p-6 text-center max-sm:pb-4 sm:text-left`,e),"data-slot":`alert-dialog-header`,...t})}function b({className:e,variant:t=`default`,...r}){return(0,p.jsx)(`div`,{className:n(`flex flex-col-reverse gap-2 px-6 sm:flex-row sm:justify-end sm:rounded-b-[calc(var(--radius-2xl)-1px)]`,t==="default"&&`border-t bg-muted/72 py-4`,t===`bare`&&`pb-6`,e),"data-slot":`alert-dialog-footer`,...r})}function x({className:e,...t}){return(0,p.jsx)(s,{className:n(`font-heading font-semibold text-xl leading-none`,e),"data-slot":`alert-dialog-title`,...t})}function S({className:e,...t}){return(0,p.jsx)(a,{className:n(`text-muted-foreground text-sm`,e),"data-slot":`alert-dialog-description`,...t})}function C(e){return(0,p.jsx)(l,{"data-slot":`alert-dialog-close`,...e})}export{y as a,d as c,b as i,C as n,v as o,S as r,x as s,m as t};