@mrpatronz/nexusflow 2.6.0 → 2.8.0

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 (198) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -3
  3. package/dist/agent/ClaudeSdkAdapter.d.ts +18 -0
  4. package/dist/agent/ClaudeSdkAdapter.d.ts.map +1 -0
  5. package/dist/agent/ClaudeSdkAdapter.js +185 -0
  6. package/dist/agent/ClaudeSdkAdapter.js.map +1 -0
  7. package/dist/agent/ClaudeSdkAdapter.test.d.ts +2 -0
  8. package/dist/agent/ClaudeSdkAdapter.test.d.ts.map +1 -0
  9. package/dist/agent/ClaudeSdkAdapter.test.js +155 -0
  10. package/dist/agent/ClaudeSdkAdapter.test.js.map +1 -0
  11. package/dist/agent/CliAdapterBase.d.ts.map +1 -1
  12. package/dist/agent/CliAdapterBase.js +3 -0
  13. package/dist/agent/CliAdapterBase.js.map +1 -1
  14. package/dist/agent/CliAdapterBase.test.js +49 -1
  15. package/dist/agent/CliAdapterBase.test.js.map +1 -1
  16. package/dist/agent/CodexCliAdapter.d.ts +1 -1
  17. package/dist/agent/CodexCliAdapter.d.ts.map +1 -1
  18. package/dist/agent/CodexCliAdapter.js +5 -4
  19. package/dist/agent/CodexCliAdapter.js.map +1 -1
  20. package/dist/agent/CodexCliAdapter.test.js +16 -1
  21. package/dist/agent/CodexCliAdapter.test.js.map +1 -1
  22. package/dist/agent/CodexSdkAdapter.d.ts +17 -0
  23. package/dist/agent/CodexSdkAdapter.d.ts.map +1 -0
  24. package/dist/agent/CodexSdkAdapter.js +132 -0
  25. package/dist/agent/CodexSdkAdapter.js.map +1 -0
  26. package/dist/agent/CodexSdkAdapter.test.d.ts +2 -0
  27. package/dist/agent/CodexSdkAdapter.test.d.ts.map +1 -0
  28. package/dist/agent/CodexSdkAdapter.test.js +76 -0
  29. package/dist/agent/CodexSdkAdapter.test.js.map +1 -0
  30. package/dist/agent/ProviderRegistry.d.ts +7 -2
  31. package/dist/agent/ProviderRegistry.d.ts.map +1 -1
  32. package/dist/agent/ProviderRegistry.js +15 -0
  33. package/dist/agent/ProviderRegistry.js.map +1 -1
  34. package/dist/agent/ProviderRegistry.test.js +19 -0
  35. package/dist/agent/ProviderRegistry.test.js.map +1 -1
  36. package/dist/agent/adapters.d.ts.map +1 -1
  37. package/dist/agent/adapters.js +81 -0
  38. package/dist/agent/adapters.js.map +1 -1
  39. package/dist/agent/mcp-config.d.ts +16 -0
  40. package/dist/agent/mcp-config.d.ts.map +1 -0
  41. package/dist/agent/mcp-config.js +28 -0
  42. package/dist/agent/mcp-config.js.map +1 -0
  43. package/dist/agent/mcp-config.test.d.ts +2 -0
  44. package/dist/agent/mcp-config.test.d.ts.map +1 -0
  45. package/dist/agent/mcp-config.test.js +22 -0
  46. package/dist/agent/mcp-config.test.js.map +1 -0
  47. package/dist/agent/models.d.ts +10 -0
  48. package/dist/agent/models.d.ts.map +1 -0
  49. package/dist/agent/models.js +35 -0
  50. package/dist/agent/models.js.map +1 -0
  51. package/dist/agent/models.test.d.ts +2 -0
  52. package/dist/agent/models.test.d.ts.map +1 -0
  53. package/dist/agent/models.test.js +40 -0
  54. package/dist/agent/models.test.js.map +1 -0
  55. package/dist/agent/orchestrator.d.ts +65 -0
  56. package/dist/agent/orchestrator.d.ts.map +1 -0
  57. package/dist/agent/orchestrator.js +252 -0
  58. package/dist/agent/orchestrator.js.map +1 -0
  59. package/dist/agent/orchestrator.test.d.ts +2 -0
  60. package/dist/agent/orchestrator.test.d.ts.map +1 -0
  61. package/dist/agent/orchestrator.test.js +284 -0
  62. package/dist/agent/orchestrator.test.js.map +1 -0
  63. package/dist/agent/session.d.ts +1 -0
  64. package/dist/agent/session.d.ts.map +1 -1
  65. package/dist/agent/session.js +3 -2
  66. package/dist/agent/session.js.map +1 -1
  67. package/dist/agent/session.test.js +9 -0
  68. package/dist/agent/session.test.js.map +1 -1
  69. package/dist/agent/smoke-chat.test.d.ts +2 -0
  70. package/dist/agent/smoke-chat.test.d.ts.map +1 -0
  71. package/dist/agent/smoke-chat.test.js +166 -0
  72. package/dist/agent/smoke-chat.test.js.map +1 -0
  73. package/dist/commands/mcp.d.ts +7 -1
  74. package/dist/commands/mcp.d.ts.map +1 -1
  75. package/dist/commands/mcp.js +7 -2
  76. package/dist/commands/mcp.js.map +1 -1
  77. package/dist/core/locks.d.ts +4 -2
  78. package/dist/core/locks.d.ts.map +1 -1
  79. package/dist/core/locks.js +55 -7
  80. package/dist/core/locks.js.map +1 -1
  81. package/dist/core/locks.test.js +48 -0
  82. package/dist/core/locks.test.js.map +1 -1
  83. package/dist/core/scheduler.d.ts +1 -0
  84. package/dist/core/scheduler.d.ts.map +1 -1
  85. package/dist/core/scheduler.js +10 -0
  86. package/dist/core/scheduler.js.map +1 -1
  87. package/dist/core/scheduler.test.js +6 -0
  88. package/dist/core/scheduler.test.js.map +1 -1
  89. package/dist/core/workspace.create.test.js +51 -11
  90. package/dist/core/workspace.create.test.js.map +1 -1
  91. package/dist/core/workspace.d.ts.map +1 -1
  92. package/dist/core/workspace.js +123 -84
  93. package/dist/core/workspace.js.map +1 -1
  94. package/dist/gui/assets/AgentsPage-Bfyu13gc.js +3 -0
  95. package/dist/gui/assets/{CSPContext-BG7no5S_.js → CSPContext-DBUu9tE0.js} +1 -1
  96. package/dist/gui/assets/{DashboardPage-ByGTwAQa.js → DashboardPage-O5wj99kn.js} +1 -1
  97. package/dist/gui/assets/{GettingStartedPage-Xjx3M3RH.js → GettingStartedPage-DDWBueC7.js} +1 -1
  98. package/dist/gui/assets/ProjectsPage-NHkXrDM2.js +1 -0
  99. package/dist/gui/assets/ScaffoldRepoInline-Cmqg_s94.js +1 -0
  100. package/dist/gui/assets/{SettingsPage-B9iN6hsv.js → SettingsPage-Cc77HBp7.js} +1 -1
  101. package/dist/gui/assets/SkillsPage-D4CVxwrI.js +6 -0
  102. package/dist/gui/assets/StartWorkPage-RPZTN3Ui.js +1 -0
  103. package/dist/gui/assets/{StrategiesPage-DDu3jwJx.js → StrategiesPage-Dn66xfZN.js} +1 -1
  104. package/dist/gui/assets/WorkspacesPage-BgdoM5Hs.js +6 -0
  105. package/dist/gui/assets/{alert-dialog-CdqVrvZl.js → alert-dialog-BYZ7cgWA.js} +1 -1
  106. package/dist/gui/assets/index-BmH7a-Qy.css +2 -0
  107. package/dist/gui/assets/index-CoNaATPd.js +52 -0
  108. package/dist/gui/assets/isElementDisabled-uy_EOitH.js +1 -0
  109. package/dist/gui/assets/textarea-ByfoCb54.js +1 -0
  110. package/dist/gui/assets/{useAriaLabelledBy-DfRdwH8a.js → useAriaLabelledBy-ClesgjMe.js} +1 -1
  111. package/dist/gui/assets/useValueChanged-DeYvGnKs.js +1 -0
  112. package/dist/gui/assets/{vsc-D6UPv2ii.js → vsc-BTST_4ex.js} +1 -1
  113. package/dist/gui/index.html +5 -7
  114. package/dist/harness/claude.d.ts +18 -0
  115. package/dist/harness/claude.d.ts.map +1 -0
  116. package/dist/harness/claude.js +334 -0
  117. package/dist/harness/claude.js.map +1 -0
  118. package/dist/harness/codex.d.ts +20 -0
  119. package/dist/harness/codex.d.ts.map +1 -0
  120. package/dist/harness/codex.js +315 -0
  121. package/dist/harness/codex.js.map +1 -0
  122. package/dist/harness/contract.test.d.ts +2 -0
  123. package/dist/harness/contract.test.d.ts.map +1 -0
  124. package/dist/harness/contract.test.js +426 -0
  125. package/dist/harness/contract.test.js.map +1 -0
  126. package/dist/harness/harness.test.d.ts +2 -0
  127. package/dist/harness/harness.test.d.ts.map +1 -0
  128. package/dist/harness/harness.test.js +215 -0
  129. package/dist/harness/harness.test.js.map +1 -0
  130. package/dist/harness/index.d.ts +10 -0
  131. package/dist/harness/index.d.ts.map +1 -0
  132. package/dist/harness/index.js +13 -0
  133. package/dist/harness/index.js.map +1 -0
  134. package/dist/harness/interface.d.ts +42 -0
  135. package/dist/harness/interface.d.ts.map +1 -0
  136. package/dist/harness/interface.js +17 -0
  137. package/dist/harness/interface.js.map +1 -0
  138. package/dist/harness/pushable.d.ts +11 -0
  139. package/dist/harness/pushable.d.ts.map +1 -0
  140. package/dist/harness/pushable.js +32 -0
  141. package/dist/harness/pushable.js.map +1 -0
  142. package/dist/harness/types.d.ts +132 -0
  143. package/dist/harness/types.d.ts.map +1 -0
  144. package/dist/harness/types.js +12 -0
  145. package/dist/harness/types.js.map +1 -0
  146. package/dist/index.js +4 -1
  147. package/dist/index.js.map +1 -1
  148. package/dist/mcp/server.d.ts +8 -1
  149. package/dist/mcp/server.d.ts.map +1 -1
  150. package/dist/mcp/server.js +11 -6
  151. package/dist/mcp/server.js.map +1 -1
  152. package/dist/mcp/tools.d.ts +6 -2
  153. package/dist/mcp/tools.d.ts.map +1 -1
  154. package/dist/mcp/tools.js +213 -6
  155. package/dist/mcp/tools.js.map +1 -1
  156. package/dist/mcp/tools.test.js +115 -6
  157. package/dist/mcp/tools.test.js.map +1 -1
  158. package/dist/orchestration/runner.d.ts +1 -1
  159. package/dist/orchestration/runner.d.ts.map +1 -1
  160. package/dist/orchestration/runner.js +29 -14
  161. package/dist/orchestration/runner.js.map +1 -1
  162. package/dist/orchestration/runner.test.js +33 -1
  163. package/dist/orchestration/runner.test.js.map +1 -1
  164. package/dist/server.d.ts.map +1 -1
  165. package/dist/server.js +28 -7
  166. package/dist/server.js.map +1 -1
  167. package/dist/server.test.js +34 -1
  168. package/dist/server.test.js.map +1 -1
  169. package/dist/utils/git.d.ts +0 -15
  170. package/dist/utils/git.d.ts.map +1 -1
  171. package/dist/utils/git.js +4 -0
  172. package/dist/utils/git.js.map +1 -1
  173. package/dist/utils/git.test.js +33 -1
  174. package/dist/utils/git.test.js.map +1 -1
  175. package/dist/utils/multi-git.d.ts +30 -6
  176. package/dist/utils/multi-git.d.ts.map +1 -1
  177. package/dist/utils/multi-git.js +132 -12
  178. package/dist/utils/multi-git.js.map +1 -1
  179. package/dist/utils/multi-git.test.js +153 -1
  180. package/dist/utils/multi-git.test.js.map +1 -1
  181. package/dist/utils/session-finder.d.ts +3 -0
  182. package/dist/utils/session-finder.d.ts.map +1 -1
  183. package/dist/utils/session-finder.js +10 -9
  184. package/dist/utils/session-finder.js.map +1 -1
  185. package/package.json +4 -1
  186. package/dist/gui/assets/AgentsPage-YyYRodOR.js +0 -3
  187. package/dist/gui/assets/ProjectsPage-BMdhqAGs.js +0 -1
  188. package/dist/gui/assets/ScaffoldRepoInline-gXyYSIz5.js +0 -1
  189. package/dist/gui/assets/SkillsPage-CxcsbIsQ.js +0 -6
  190. package/dist/gui/assets/StartWorkPage-DPVHcdy4.js +0 -1
  191. package/dist/gui/assets/WorkspacesPage-BWRmP0mY.js +0 -2
  192. package/dist/gui/assets/index-CZoZQkeC.css +0 -2
  193. package/dist/gui/assets/index-wy68EqfB.js +0 -50
  194. package/dist/gui/assets/isElementDisabled-D_fu2zfc.js +0 -1
  195. package/dist/gui/assets/store-D5DUHbxn.js +0 -3
  196. package/dist/gui/assets/styles-CVwNuFCx.js +0 -1
  197. package/dist/gui/assets/textarea-BNRuIXNs.js +0 -1
  198. package/dist/gui/assets/useValueChanged-CStSGSsD.js +0 -1
@@ -0,0 +1,6 @@
1
+ import{_ as e,b as t,g as n,h as r,m as i,t as a}from"./button-BDDZnIHx.js";import{o}from"./CSPContext-DBUu9tE0.js";import{t as ee}from"./chevron-down-qTL8HPug.js";import{a as s,c as te,i as ne,l as c,n as re,o as ie,r as l,s as u,t as ae,u as oe}from"./square-DlIYnlSq.js";import{t as d}from"./code-xml-jFAa3-TT.js";import{t as se}from"./cpu-Cdwd84Jz.js";import{t as f}from"./trash-2-CtR35_eF.js";import{t as p}from"./zap-CWG_Lvki.js";import{$ as ce,B as le,Bt as ue,Ht as de,Kt as fe,Lt as pe,N as me,Nt as he,V as ge,Wt as m,X as _e,Xt as ve,Z as ye,Zt as h,a as be,c as g,d as _,et as xe,f as v,l as y,o as b,ot as Se,p as x,s as S,st as Ce,zt as C}from"./index-CoNaATPd.js";import{t as w}from"./badge-CAohJGj6.js";import{t as we}from"./card-BKXzd_5L.js";import{a as Te,i as Ee,n as De,r as Oe,t as ke}from"./empty-BdlgbifD.js";import{t as T}from"./label-CG5exjag.js";import{t as Ae}from"./textarea-ByfoCb54.js";var je=r(`arrow-right-left`,[[`path`,{d:`m16 3 4 4-4 4`,key:`1x1c3m`}],[`path`,{d:`M20 7H4`,key:`zbl0bi`}],[`path`,{d:`m8 21-4-4 4-4`,key:`h9nckh`}],[`path`,{d:`M4 17h16`,key:`g4d7ey`}]]),Me=r(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Ne=r(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),Pe=r(`pen`,[[`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`}]]),Fe=r(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),E=t(e(),1),D=n(),O={"git-pull-request":ie,"flask-conical":u,package:ne,database:c,"shield-check":l,terminal:C,zap:p,cpu:se,layers:s,boxes:h,code:d},Ie=[{label:`Blue`,value:`#3b82f6`},{label:`Green`,value:`#10b981`},{label:`Purple`,value:`#8b5cf6`},{label:`Amber`,value:`#f59e0b`},{label:`Red`,value:`#ef4444`},{label:`Cyan`,value:`#06b6d4`},{label:`Pink`,value:`#ec4899`},{label:`Emerald`,value:`#059669`}];function k({showToast:e}){let[t,n]=(0,E.useState)(`global`),[r,s]=(0,E.useState)(``),[ne,c]=(0,E.useState)({}),[ie,l]=(0,E.useState)(!1),[u,d]=(0,E.useState)(null),[se,p]=(0,E.useState)(!1),[C,k]=(0,E.useState)(null),[Le,A]=(0,E.useState)(!1),[j,M]=(0,E.useState)(`edit`),[Re,N]=(0,E.useState)(!1),[P,F]=(0,E.useState)(null),[ze,I]=(0,E.useState)(!1),[L,R]=(0,E.useState)(null),[z,Be]=(0,E.useState)(null),[Ve,B]=(0,E.useState)(null),{data:V=[],isLoading:He}=ce(),{data:H=[],isLoading:Ue}=xe(t===`global`?void 0:t),{data:We=[]}=Ce(),{data:U,isLoading:Ge,isError:Ke}=Se(t===`global`?``:t),[W,G]=(0,E.useState)(null),qe=ye(),Je=ge(),K=_e(),Ye=le(),q=me(),J=t!==`global`,Y=new Set(W??U?.enabledSkills??[]),X=!J||!Ge&&!Ke&&!!U;(0,E.useEffect)(()=>{if(!J){G(null);return}U&&G([...U.enabledSkills])},[J,t,U]);let Xe=e=>{c(t=>({...t,[e]:!t[e]}))},Z=H.filter(e=>{if(!r.trim())return!0;let t=r.toLowerCase();return e.title?.toLowerCase().includes(t)||e.name.toLowerCase().includes(t)||e.description.toLowerCase().includes(t)||e.tags?.some(e=>e.toLowerCase().includes(t))}),Ze=V.reduce((e,t)=>(e[t.id]=Z.filter(e=>e.category===t.id),e),{}),Q=Z.filter(e=>!e.category||!V.some(t=>t.id===e.category)),Qe=e=>{d(e||{name:``,description:``,icon:`boxes`,color:`#3b82f6`,custom:!0}),l(!0)},$e=async()=>{if(!(!u||!u.name?.trim()))try{await qe.mutateAsync({id:u.id,name:u.name.trim(),description:u.description,icon:u.icon,color:u.color}),e?.(`Category saved successfully`,`success`),l(!1),d(null)}catch(t){e?.(`Failed to save category`,`error`),console.error(t)}},et=(e,t)=>{t.stopPropagation(),R({type:`category`,id:e.id,title:e.name}),I(!0)},$=(e,t)=>{k(e||{name:``,title:``,category:t||(V[0]?.id??`pull-requests`),description:``,tags:[],allowedTools:[],content:`# Skill Title
2
+
3
+ Instructions and playbook for the AI assistant.
4
+ `,custom:!0}),A(!!e),M(`edit`),p(!0)},tt=e=>{if(!C)return;let t={...C,title:e};!Le&&!C.id&&(t.name=e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)),k(t)},nt=async()=>{if(!C||!C.name?.trim()||!C.description?.trim()||!C.content?.trim()){e?.(`Skill name, trigger description, and content are required`,`error`);return}try{await K.mutateAsync({id:C.id,name:C.name.trim(),title:C.title||C.name,category:C.category||`general`,description:C.description||``,tags:C.tags||[],allowedTools:C.allowedTools||[],content:C.content}),e?.(`Skill package saved successfully`,`success`),p(!1),k(null)}catch(t){e?.(`Failed to save skill`,`error`),console.error(t)}},rt=(e,t)=>{t.stopPropagation(),R({type:`skill`,id:e.id,title:e.title||e.name}),I(!0)},it=async()=>{if(L)try{L.type===`category`?(await Je.mutateAsync(L.id),e?.(`Category deleted`,`info`)):(await Ye.mutateAsync(L.id),e?.(`Skill package deleted`,`info`)),I(!1),R(null)}catch(t){e?.(`Failed to delete item`,`error`),console.error(t)}},at=e=>{if(!J||!X||W===null)return;let t=new Set(W);t.has(e)?t.delete(e):t.add(e),G(Array.from(t))},ot=()=>{if(!C||C.custom!==!1)return;let e=`${C.name}-copy`;k({...C,id:void 0,name:e,title:`${C.title||C.name} Copy`,allowedTools:[],custom:!0,sourcePath:void 0,references:void 0,scripts:void 0}),A(!0)},st=(e,t)=>{if(!J||!X||W===null)return;let n=Ze[e]||[],r=new Set(W);for(let e of n)t?r.add(e.id):r.delete(e.id);G(Array.from(r))},ct=async()=>{if(!(!U||W===null||!J))try{await q.mutateAsync({workspaceId:t,expectedRevision:U.revision??0,enabledSkills:W,enabledAgents:U.enabledAgents??[],enabledCategories:V.map(e=>e.id)}),e?.(`Skill selection saved. Refresh the workspace to apply it.`,`success`)}catch(t){e?.(t instanceof Error?t.message:`Failed to save skill selection`,`error`)}},lt=(e,t)=>{e.dataTransfer.setData(`text/plain`,t),e.dataTransfer.effectAllowed=`move`,Be(t)},ut=(e,t)=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`,Ve!==t&&B(t)},dt=()=>{B(null)},ft=async(t,n)=>{t.preventDefault(),B(null);let r=t.dataTransfer.getData(`text/plain`)||z;if(Be(null),!r)return;let i=H.find(e=>e.id===r);!i||!i.custom||J||i.category===n||(await K.mutateAsync({id:i.id,name:i.name,title:i.title,description:i.description,tags:i.tags,allowedTools:i.allowedTools,content:i.content,category:n}),e?.(`Skill re-categorized`,`success`))},pt=(e,t)=>{t.stopPropagation(),F(e),N(!0)},mt=async t=>{if(!P||P.category===t){N(!1),F(null);return}await K.mutateAsync({id:P.id,name:P.name,title:P.title,description:P.description,tags:P.tags,allowedTools:P.allowedTools,content:P.content,category:t}),e?.(`Skill moved to category`,`success`),N(!1),F(null)};return(0,D.jsxs)(`div`,{className:`flex-1 flex flex-col h-full overflow-hidden bg-background text-foreground`,children:[(0,D.jsxs)(`div`,{className:`p-6 border-b border-border flex flex-col sm:flex-row sm:items-center justify-between gap-4 bg-card/40 backdrop-blur-sm`,children:[(0,D.jsx)(`div`,{children:(0,D.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,D.jsx)(`div`,{className:`p-2 rounded-xl bg-primary/10 text-primary`,children:(0,D.jsx)(h,{className:`h-6 w-6`})}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`h1`,{className:`text-xl font-bold tracking-tight`,children:`Skill Library`}),(0,D.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Create, organize, and assign reusable Agent Skill packages.`})]})]})}),(0,D.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,D.jsx)(a,{render:(0,D.jsx)(he,{to:`/agents`}),variant:`outline`,size:`sm`,children:`Codex Agents`}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2 bg-muted/50 rounded-lg px-3 py-1.5 border border-border`,children:[(0,D.jsx)(fe,{className:`h-4 w-4 text-muted-foreground`}),(0,D.jsx)(T,{htmlFor:`skill-scope`,className:`text-xs font-medium text-muted-foreground`,children:`Scope:`}),(0,D.jsxs)(`select`,{id:`skill-scope`,value:t,onChange:e=>n(e.target.value),className:`bg-transparent text-xs font-semibold focus:outline-none cursor-pointer text-foreground`,children:[(0,D.jsx)(`option`,{value:`global`,className:`bg-popover text-popover-foreground`,children:`🌐 Global Skills Catalog`}),We.map(e=>(0,D.jsxs)(`option`,{value:e.id,className:`bg-popover text-popover-foreground`,children:[`📁 `,e.id,` (`,e.branchName,`)`]},e.id))]})]}),J&&(0,D.jsx)(a,{size:`sm`,onClick:ct,disabled:!X||q.isPending||W===null,children:q.isPending?`Saving…`:`Save selection`}),!J&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(a,{variant:`outline`,size:`sm`,onClick:()=>Qe(),className:`flex items-center gap-1.5`,children:[(0,D.jsx)(m,{className:`h-3.5 w-3.5`}),(0,D.jsx)(`span`,{children:`New Category`})]}),(0,D.jsxs)(a,{variant:`default`,size:`sm`,onClick:()=>$(),className:`flex items-center gap-1.5`,children:[(0,D.jsx)(ue,{className:`h-3.5 w-3.5`}),(0,D.jsx)(`span`,{children:`New Skill`})]})]})]})]}),(0,D.jsxs)(`div`,{className:`px-6 py-3 border-b border-border/60 bg-muted/20 flex items-center justify-between gap-4`,children:[(0,D.jsxs)(`div`,{className:`relative flex-1 max-w-md`,children:[(0,D.jsx)(de,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,D.jsx)(o,{value:r,onChange:e=>s(e.target.value),placeholder:`Search skills by keyword, tag, or tool...`,className:`pl-9 pr-8 h-9 text-xs`}),r&&(0,D.jsx)(`button`,{onClick:()=>s(``),className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,children:(0,D.jsx)(pe,{className:`h-3.5 w-3.5`})})]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,D.jsxs)(`span`,{children:[`Showing `,(0,D.jsx)(`strong`,{className:`text-foreground`,children:Z.length}),` of`,` `,(0,D.jsx)(`strong`,{className:`text-foreground`,children:H.length}),` skills`]}),J&&(0,D.jsxs)(w,{variant:`secondary`,className:`text-[10px] uppercase font-mono`,children:[`Workspace Mode (`,Y.size,` active)`]})]})]}),(0,D.jsx)(x,{className:`flex-1 p-6`,children:He||Ue||J&&Ge?(0,D.jsxs)(`div`,{className:`flex items-center justify-center p-12 gap-3 text-muted-foreground`,children:[(0,D.jsx)(be,{}),(0,D.jsx)(`span`,{className:`text-sm`,children:`Loading skills catalog...`})]}):J&&Ke?(0,D.jsx)(ke,{className:`py-12 border border-dashed rounded-xl`,children:(0,D.jsxs)(Oe,{children:[(0,D.jsx)(Te,{children:`Workspace resources could not be loaded`}),(0,D.jsx)(De,{children:`Assignment controls are disabled so an existing selection cannot be overwritten.`})]})}):Z.length===0&&r?(0,D.jsxs)(ke,{className:`py-12 border border-dashed rounded-xl`,children:[(0,D.jsx)(Ee,{children:(0,D.jsx)(de,{className:`h-8 w-8 text-muted-foreground/60`})}),(0,D.jsxs)(Oe,{children:[(0,D.jsx)(Te,{children:`No matching skills found`}),(0,D.jsxs)(De,{children:[`No skills matched your search query "`,r,`".`]})]}),(0,D.jsx)(a,{variant:`outline`,size:`sm`,onClick:()=>s(``),children:`Clear Search`})]}):(0,D.jsxs)(`div`,{className:`space-y-6 max-w-7xl mx-auto pb-12`,children:[V.map(e=>{let t=O[e.icon||`boxes`]||h,n=Ze[e.id]||[],r=!!ne[e.id],o=Ve===e.id,s=n.length>0&&n.every(e=>Y.has(e.id));return(0,D.jsxs)(`div`,{onDragOver:t=>ut(t,e.id),onDragLeave:dt,onDrop:t=>ft(t,e.id),className:i(`border rounded-xl transition-all duration-150 overflow-hidden bg-card/60`,o?`border-primary ring-2 ring-primary/20 bg-primary/5`:`border-border`),children:[(0,D.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":!r,onClick:()=>Xe(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),Xe(e.id))},className:`p-4 flex items-center justify-between cursor-pointer hover:bg-muted/40 transition-colors border-b border-border/40 select-none`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,D.jsx)(`div`,{className:`p-2 rounded-lg text-white shadow-sm flex items-center justify-center`,style:{backgroundColor:e.color||`#3b82f6`},children:(0,D.jsx)(t,{className:`h-4 w-4`})}),(0,D.jsxs)(`div`,{children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`h2`,{className:`font-semibold text-sm tracking-tight`,children:e.name}),(0,D.jsxs)(w,{variant:`outline`,className:`text-[10px] px-1.5 py-0`,children:[n.length,` `,n.length===1?`skill`:`skills`]}),e.isTemplate&&!e.custom&&(0,D.jsx)(w,{variant:`secondary`,className:`text-[9px] px-1 py-0 uppercase`,children:`Template`})]}),e.description&&(0,D.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:e.description})]})]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-1`,onClick:e=>e.stopPropagation(),children:[J&&n.length>0&&(0,D.jsxs)(a,{variant:`ghost`,size:`xs`,onClick:()=>st(e.id,!s),className:`h-7 text-xs mr-2 text-muted-foreground hover:text-foreground`,title:s?`Deselect all in category`:`Select all in category`,children:[s?(0,D.jsx)(re,{className:`h-3.5 w-3.5 mr-1 text-primary`}):(0,D.jsx)(ae,{className:`h-3.5 w-3.5 mr-1`}),(0,D.jsx)(`span`,{children:s?`Deselect All`:`Select All`})]}),!J&&(0,D.jsx)(a,{variant:`ghost`,size:`icon-xs`,onClick:()=>$(void 0,e.id),title:`Add skill to this category`,children:(0,D.jsx)(m,{className:`h-3.5 w-3.5`})}),!J&&(0,D.jsx)(a,{variant:`ghost`,size:`icon-xs`,onClick:()=>Qe(e),title:`Edit category`,children:(0,D.jsx)(Pe,{className:`h-3 w-3`})}),!J&&e.custom&&(0,D.jsx)(a,{variant:`ghost`,size:`icon-xs`,onClick:t=>et(e,t),title:`Delete category`,className:`text-destructive hover:text-destructive`,children:(0,D.jsx)(f,{className:`h-3 w-3`})}),(0,D.jsx)(`div`,{className:`p-1 text-muted-foreground`,children:r?(0,D.jsx)(oe,{className:`h-4 w-4`}):(0,D.jsx)(ee,{className:`h-4 w-4`})})]})]}),!r&&(0,D.jsx)(`div`,{className:`p-4 bg-background/50`,children:n.length===0?(0,D.jsxs)(`div`,{className:`border border-dashed border-border/80 rounded-lg p-6 text-center text-xs text-muted-foreground`,children:[`No skills in this category.`,!J&&(0,D.jsxs)(D.Fragment,{children:[` `,`Drag a custom skill here, or click`,` `,(0,D.jsx)(`button`,{onClick:()=>$(void 0,e.id),className:`text-primary underline font-medium`,children:`+ Add Skill`})]})]}):(0,D.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3.5`,children:n.map(e=>{let t=Y.has(e.id);return(0,D.jsxs)(we,{draggable:!J&&!!e.custom,onDragStart:t=>{!J&&e.custom&&lt(t,e.id)},onClick:()=>$(e),role:`button`,tabIndex:0,onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),$(e))},className:i(`group relative cursor-pointer hover:border-primary/60 transition-all p-3.5 flex flex-col justify-between select-none shadow-sm`,J&&!t&&`opacity-60 bg-muted/20`,z===e.id&&`opacity-40 border-dashed`),children:[(0,D.jsxs)(`div`,{children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mb-2`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground group-hover:text-foreground cursor-grab active:cursor-grabbing`,title:`Drag to reorder or re-categorize`,"aria-label":`Drag handle`,children:[(0,D.jsx)(Ne,{className:`h-3.5 w-3.5`}),(0,D.jsx)(`span`,{className:`font-mono text-xs font-bold text-foreground`,children:e.title||e.name})]}),J?(0,D.jsxs)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),at(e.id)},disabled:!X||q.isPending,className:i(`h-5 px-2 rounded-md flex items-center gap-1 text-[10px] font-semibold transition-colors`,t?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground hover:bg-muted/80`),children:[(0,D.jsx)(ve,{className:i(`h-3 w-3`,!t&&`opacity-0`)}),(0,D.jsx)(`span`,{children:t?`Enabled`:`Disabled`})]}):(0,D.jsx)(w,{variant:`outline`,className:`text-[10px] font-mono`,children:e.custom?`Custom`:`Template`})]}),(0,D.jsx)(`p`,{className:`text-xs text-muted-foreground line-clamp-2 mb-3 leading-relaxed`,children:e.description||`No description provided.`})]}),(0,D.jsxs)(`div`,{className:`pt-2 border-t border-border/40 flex items-center justify-between gap-2`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap overflow-hidden`,children:[e.tags?.slice(0,2).map(e=>(0,D.jsxs)(`span`,{className:`text-[10px] font-mono bg-muted px-1.5 py-0.5 rounded text-muted-foreground`,children:[`#`,e]},e)),e.allowedTools&&e.allowedTools.length>0&&(0,D.jsxs)(`span`,{className:`text-[10px] text-muted-foreground flex items-center gap-0.5 font-mono`,children:[(0,D.jsx)(Fe,{className:`h-2.5 w-2.5`}),e.allowedTools.length]})]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-1`,onClick:e=>e.stopPropagation(),children:[!J&&e.custom&&(0,D.jsx)(a,{variant:`ghost`,size:`icon-xs`,onClick:t=>pt(e,t),title:`Move to another category`,className:`h-6 w-6 text-muted-foreground hover:text-foreground`,children:(0,D.jsx)(je,{className:`h-3 w-3`})}),!J&&e.custom&&(0,D.jsx)(a,{variant:`ghost`,size:`icon-xs`,onClick:t=>rt(e,t),title:`Delete skill`,className:`h-6 w-6 text-destructive hover:text-destructive`,children:(0,D.jsx)(f,{className:`h-3 w-3`})})]})]})]},e.id)})})})]},e.id)}),Q.length>0&&(0,D.jsxs)(`div`,{className:`border border-border/80 rounded-xl overflow-hidden bg-card/60`,children:[(0,D.jsx)(`div`,{className:`p-4 bg-muted/30 border-b border-border/40 flex items-center justify-between`,children:(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(h,{className:`h-4 w-4 text-muted-foreground`}),(0,D.jsx)(`h2`,{className:`font-semibold text-sm`,children:`Uncategorized Skills`}),(0,D.jsx)(w,{variant:`outline`,className:`text-[10px]`,children:Q.length})]})}),(0,D.jsx)(`div`,{className:`p-4 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3.5`,children:Q.map(e=>(0,D.jsxs)(we,{onClick:()=>$(e),role:`button`,tabIndex:0,onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),$(e))},className:`p-3.5 cursor-pointer hover:border-primary/60`,children:[(0,D.jsxs)(`div`,{className:`mb-1 flex items-center justify-between gap-2`,children:[(0,D.jsx)(`div`,{className:`font-mono text-xs font-bold`,children:e.title||e.name}),J&&(0,D.jsx)(a,{size:`xs`,variant:Y.has(e.id)?`default`:`outline`,disabled:!X||q.isPending,onClick:t=>{t.stopPropagation(),at(e.id)},children:Y.has(e.id)?`Enabled`:`Disabled`})]}),(0,D.jsx)(`p`,{className:`text-xs text-muted-foreground line-clamp-2`,children:e.description})]},e.id))})]})]})}),(0,D.jsx)(b,{open:ie,onOpenChange:l,children:(0,D.jsxs)(_,{className:`sm:max-w-lg`,children:[(0,D.jsxs)(y,{children:[(0,D.jsx)(v,{children:u?.id?`Edit Skill Category`:`Create Skill Category`}),(0,D.jsx)(S,{children:`Categories group related procedural skills and agent tools into clean visual boxes.`})]}),(0,D.jsxs)(`div`,{className:`space-y-4 py-2`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(T,{htmlFor:`cat-name`,className:`text-xs font-medium`,children:`Category Name`}),(0,D.jsx)(o,{id:`cat-name`,value:u?.name||``,onChange:e=>d(t=>t?{...t,name:e.target.value}:null),placeholder:`e.g. Pull Requests & Review`,className:`mt-1 text-xs`})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(T,{htmlFor:`cat-desc`,className:`text-xs font-medium`,children:`Description`}),(0,D.jsx)(o,{id:`cat-desc`,value:u?.description||``,onChange:e=>d(t=>t?{...t,description:e.target.value}:null),placeholder:`Brief summary of what skills belong in this box...`,className:`mt-1 text-xs`})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(T,{className:`text-xs font-medium`,children:`Icon`}),(0,D.jsx)(`div`,{className:`grid grid-cols-6 gap-2 mt-1.5`,children:Object.keys(O).map(e=>{let t=O[e];return(0,D.jsx)(`button`,{type:`button`,onClick:()=>d(t=>t?{...t,icon:e}:null),className:i(`p-2.5 rounded-lg border flex items-center justify-center transition-colors`,(u?.icon||`boxes`)===e?`border-primary bg-primary/10 text-primary`:`border-border hover:bg-muted text-muted-foreground`),children:(0,D.jsx)(t,{className:`h-4 w-4`})},e)})})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(T,{className:`text-xs font-medium`,children:`Color Accent`}),(0,D.jsx)(`div`,{className:`flex items-center gap-2 mt-1.5 flex-wrap`,children:Ie.map(e=>{let t=u?.color===e.value;return(0,D.jsx)(`button`,{type:`button`,"aria-label":`Select color ${e.label}`,onClick:()=>d(t=>t?{...t,color:e.value}:null),className:i(`w-7 h-7 rounded-full transition-transform flex items-center justify-center shadow-sm`,t?`scale-110 ring-2 ring-primary ring-offset-2`:`hover:scale-105`),style:{backgroundColor:e.value},children:t&&(0,D.jsx)(ve,{className:`h-3.5 w-3.5 text-white`})},e.value)})})]})]}),(0,D.jsxs)(g,{children:[(0,D.jsx)(a,{variant:`outline`,size:`sm`,onClick:()=>l(!1),children:`Cancel`}),(0,D.jsx)(a,{variant:`default`,size:`sm`,onClick:$e,disabled:!u?.name?.trim(),children:`Save Category`})]})]})}),(0,D.jsx)(b,{open:se,onOpenChange:p,children:(0,D.jsxs)(_,{className:`sm:max-w-3xl max-h-[90vh] flex flex-col`,children:[(0,D.jsx)(y,{children:(0,D.jsxs)(`div`,{className:`flex items-center justify-between pr-6`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(v,{children:C?.id?`Edit Skill Package`:`Create New Skill`}),(0,D.jsx)(S,{children:`Configure SKILL.md metadata triggers and markdown playbook instructions.`})]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted/60 p-1 rounded-lg border border-border text-xs`,children:[(0,D.jsxs)(`button`,{type:`button`,onClick:()=>M(`edit`),className:i(`px-2.5 py-1 rounded-md flex items-center gap-1 font-medium transition-colors`,j===`edit`?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:[(0,D.jsx)(te,{className:`h-3.5 w-3.5`}),(0,D.jsx)(`span`,{children:`Edit`})]}),(0,D.jsxs)(`button`,{type:`button`,onClick:()=>M(`preview`),className:i(`px-2.5 py-1 rounded-md flex items-center gap-1 font-medium transition-colors`,j===`preview`?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:[(0,D.jsx)(Me,{className:`h-3.5 w-3.5`}),(0,D.jsx)(`span`,{children:`Preview`})]})]})]})}),(0,D.jsx)(x,{className:`flex-1 pr-4 py-2`,children:j===`edit`?(0,D.jsxs)(`div`,{className:`space-y-4`,children:[(0,D.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-4`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(T,{htmlFor:`skill-title`,className:`text-xs font-medium`,children:`Display Title`}),(0,D.jsx)(o,{id:`skill-title`,value:C?.title||``,onChange:e=>tt(e.target.value),placeholder:`e.g. Pull Request Reviewer`,className:`mt-1 text-xs`})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(T,{htmlFor:`skill-name`,className:`text-xs font-medium`,children:`Identifier (Slug)`}),(0,D.jsx)(o,{id:`skill-name`,value:C?.name||``,disabled:!!C?.id,onChange:e=>{A(!0),k(t=>t?{...t,name:e.target.value}:null)},placeholder:`e.g. pr-review-toolkit`,className:`mt-1 text-xs font-mono`})]})]}),(0,D.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-4`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(T,{htmlFor:`skill-cat`,className:`text-xs font-medium`,children:`Category Box`}),(0,D.jsx)(`select`,{id:`skill-cat`,value:C?.category||``,onChange:e=>k(t=>t?{...t,category:e.target.value}:null),className:`mt-1 w-full bg-background border border-border rounded-md px-3 py-2 text-xs focus:outline-none focus:ring-1 focus:ring-primary`,children:V.map(e=>(0,D.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(T,{htmlFor:`skill-tags`,className:`text-xs font-medium`,children:`Tags (comma separated)`}),(0,D.jsx)(o,{id:`skill-tags`,value:C?.tags?.join(`, `)||``,onChange:e=>k(t=>t?{...t,tags:e.target.value.split(`,`).map(e=>e.trim()).filter(Boolean)}:null),placeholder:`e.g. git, pr, quality`,className:`mt-1 text-xs font-mono`})]})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(T,{htmlFor:`skill-desc`,className:`text-xs font-medium`,children:`Trigger Description (for AI Autonomous Discovery)`}),(0,D.jsx)(o,{id:`skill-desc`,value:C?.description||``,onChange:e=>k(t=>t?{...t,description:e.target.value}:null),placeholder:`e.g. Use when reviewing PR diffs or when user asks for a PR audit...`,className:`mt-1 text-xs`})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(T,{htmlFor:`skill-content`,className:`text-xs font-medium`,children:`Playbook Instructions (Markdown)`}),(0,D.jsx)(Ae,{id:`skill-content`,value:C?.content||``,onChange:e=>k(t=>t?{...t,content:e.target.value}:null),rows:12,placeholder:`# Playbook Title
5
+
6
+ Detailed instructions for the AI assistant...`,className:`mt-1 font-mono text-xs leading-relaxed`})]})]}):(0,D.jsxs)(`div`,{className:`p-4 border rounded-xl bg-card/40 prose prose-sm dark:prose-invert max-w-none`,children:[(0,D.jsxs)(`div`,{className:`mb-4 pb-3 border-b`,children:[(0,D.jsx)(`h2`,{className:`text-lg font-bold m-0`,children:C?.title||C?.name}),(0,D.jsx)(`p`,{className:`text-xs text-muted-foreground m-0 mt-1`,children:C?.description})]}),(0,D.jsx)(`pre`,{className:`text-xs whitespace-pre-wrap font-sans bg-transparent p-0 border-0`,children:C?.content||`*(No playbook markdown provided)*`})]})}),(0,D.jsxs)(g,{className:`mt-4 pt-3 border-t`,children:[(0,D.jsx)(a,{variant:`outline`,size:`sm`,onClick:()=>p(!1),children:`Cancel`}),(0,D.jsx)(a,{variant:`default`,size:`sm`,onClick:C?.custom===!1?ot:nt,disabled:!C?.name?.trim()||!C?.description?.trim()||!C?.content?.trim(),children:C?.custom===!1?`Create editable copy`:`Save Skill`})]})]})}),(0,D.jsx)(b,{open:Re,onOpenChange:N,children:(0,D.jsxs)(_,{className:`sm:max-w-md`,children:[(0,D.jsxs)(y,{children:[(0,D.jsx)(v,{children:`Move Skill to Category`}),(0,D.jsxs)(S,{children:[`Select the destination category box for "`,P?.title||P?.name,`".`]})]}),(0,D.jsx)(`div`,{className:`space-y-2 py-2`,children:V.map(e=>{let t=O[e.icon||`boxes`]||h,n=P?.category===e.id;return(0,D.jsxs)(`button`,{type:`button`,onClick:()=>mt(e.id),className:i(`w-full p-3 rounded-lg border text-left flex items-center justify-between transition-colors`,n?`border-primary bg-primary/10`:`border-border hover:bg-muted/50 text-foreground`),children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,D.jsx)(`div`,{className:`p-1.5 rounded text-white flex items-center justify-center`,style:{backgroundColor:e.color||`#3b82f6`},children:(0,D.jsx)(t,{className:`h-4 w-4`})}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`font-semibold text-xs`,children:e.name}),e.description&&(0,D.jsx)(`div`,{className:`text-[11px] text-muted-foreground line-clamp-1`,children:e.description})]})]}),n&&(0,D.jsx)(w,{variant:`secondary`,className:`text-[10px]`,children:`Current`})]},e.id)})}),(0,D.jsx)(g,{children:(0,D.jsx)(a,{variant:`outline`,size:`sm`,onClick:()=>N(!1),children:`Cancel`})})]})}),(0,D.jsx)(b,{open:ze,onOpenChange:I,children:(0,D.jsxs)(_,{className:`sm:max-w-md`,children:[(0,D.jsxs)(y,{children:[(0,D.jsxs)(v,{className:`text-destructive`,children:[`Delete `,L?.type===`category`?`Category`:`Skill`]}),(0,D.jsxs)(S,{children:[`Are you sure you want to delete "`,L?.title,`"? This action cannot be undone.`]})]}),(0,D.jsxs)(g,{className:`mt-4`,children:[(0,D.jsx)(a,{variant:`outline`,size:`sm`,onClick:()=>I(!1),children:`Cancel`}),(0,D.jsx)(a,{variant:`destructive`,size:`sm`,onClick:it,children:`Delete Permanently`})]})]})})]})}export{k as SkillsPage};
@@ -0,0 +1 @@
1
+ import{_ as e,b as t,g as n,h as r,m as i,t as a}from"./button-BDDZnIHx.js";import{o}from"./CSPContext-DBUu9tE0.js";import{t as s}from"./bot-C2HWrAft.js";import{t as c}from"./chevron-down-qTL8HPug.js";import{t as l}from"./code-xml-jFAa3-TT.js";import{n as u,r as d,t as f}from"./ScaffoldRepoInline-Cmqg_s94.js";import{t as p}from"./git-branch-Cfj9D8yW.js";import{t as m}from"./zap-CWG_Lvki.js";import{At as h,Bt as g,Ct as _,D as v,Dt as y,E as b,Et as x,Ft as S,G as ee,It as C,J as te,Jt as w,Kt as ne,L as T,M as re,Nt as ie,O as ae,Ot as E,P as oe,St as D,T as se,Tt as O,Ut as k,Xt as ce,Yt as A,Zt as le,a as j,ct as M,d as ue,et as de,f as N,it as fe,j as pe,jt as P,k as me,kt as F,l as I,n as he,nt as ge,o as _e,q as L,qt as R,rt as z,s as B,t as V,tn as ve,u as H,zt as U}from"./index-CoNaATPd.js";import{t as ye}from"./badge-CAohJGj6.js";import{a as W,i as G,n as be,r as xe,t as Se}from"./empty-BdlgbifD.js";import{t as Ce}from"./textarea-ByfoCb54.js";import{n as we,t as K}from"./vsc-BTST_4ex.js";var Te=r(`app-window`,[[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}],[`path`,{d:`M10 4v4`,key:`pp8u80`}],[`path`,{d:`M2 8h20`,key:`d11cs7`}],[`path`,{d:`M6 4v4`,key:`1svtjw`}]]),Ee=r(`orbit`,[[`path`,{d:`M20.341 6.484A10 10 0 0 1 10.266 21.85`,key:`1enhxb`}],[`path`,{d:`M3.659 17.516A10 10 0 0 1 13.74 2.152`,key:`1crzgf`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`circle`,{cx:`19`,cy:`5`,r:`2`,key:`mhkx31`}],[`circle`,{cx:`5`,cy:`19`,r:`2`,key:`v8kfzx`}]]),De=r(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]),q=t(e(),1),J={status:`idle`,steps:[]};function Oe(){let[e,t]=(0,q.useState)(J),n=(0,q.useRef)(null),r=ve(),i=(0,q.useCallback)(()=>{n.current?.close(),n.current=null},[]);return(0,q.useEffect)(()=>i,[i]),{progress:e,start:(0,q.useCallback)(e=>{i(),t({status:`running`,steps:[]});let a=new EventSource(`/api/workspace/create-stream/${encodeURIComponent(e)}`);n.current=a;let o=0;a.addEventListener(`progress`,n=>{o=0;try{let a=JSON.parse(n.data);t({status:a.status===`completed`||a.status===`failed`?a.status:`running`,steps:a.steps??[],error:a.error,workspacePath:a.workspacePath,workspaceId:a.feature?.id??e}),(a.status===`completed`||a.status===`failed`)&&(i(),r.invalidateQueries({queryKey:[`workspaces`]}),r.invalidateQueries({queryKey:[`workspaces-status`]}))}catch{}}),a.onerror=()=>{o+=1,!(a.readyState!==EventSource.CLOSED&&o<5)&&(t(e=>e.status===`running`?{...e,status:`failed`,error:e.error??`Lost connection to the creation stream.`}:e),i())}},[i,r]),reset:(0,q.useCallback)(()=>{i(),t(J)},[i])}}var Y=n(),X=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,ke={codex:P,claude:D,vscode:K,"vscode-insiders":we,cursor:_,antigravity:Ee,powershell:U,cmd:U,terminal:U,intellij:O,webstorm:E,pycharm:x,sublime:y,zed:h,windsurf:F},Z={codex:`bg-foreground text-background`,claude:`bg-[#D97757] text-white`,vscode:`bg-[#007ACC] text-white`,"vscode-insiders":`bg-[#24A148] text-white`,cursor:`bg-zinc-950 text-white dark:bg-white dark:text-zinc-950`,antigravity:`bg-violet-600 text-white`,powershell:`bg-sky-700 text-white`,cmd:`bg-zinc-800 text-amber-400`,terminal:`bg-zinc-800 text-emerald-400`,intellij:`bg-fuchsia-600 text-white`,webstorm:`bg-cyan-600 text-white`,pycharm:`bg-lime-600 text-zinc-950`,sublime:`bg-orange-500 text-white`,zed:`bg-red-600 text-white`,windsurf:`bg-teal-600 text-white`};function Q({icon:e}){let t=ke[e]??l;return(0,Y.jsx)(`span`,{className:i(`grid size-10 shrink-0 place-items-center rounded-xl shadow-sm`,Z[e]),"aria-hidden":`true`,children:(0,Y.jsx)(t,{className:`size-5`})})}function $({target:e,busy:t,launching:n,preferred:r,onLaunch:a}){return(0,Y.jsxs)(`button`,{type:`button`,disabled:!e.available||t,onClick:()=>a(e),"aria-label":`Open workspace in ${e.name}`,className:i(`flex min-h-20 w-full items-center gap-3 rounded-xl border p-3 text-left outline-none transition-colors`,`focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background`,`cursor-pointer border-border bg-card hover:border-primary/40 hover:bg-accent/60`),children:[(0,Y.jsx)(Q,{icon:e.icon}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,children:e.name}),n?(0,Y.jsx)(j,{className:`size-4`}):r?(0,Y.jsx)(ye,{size:`sm`,variant:`secondary`,children:`Preferred`}):null]}),(0,Y.jsx)(`span`,{className:`mt-0.5 block text-xs leading-relaxed text-muted-foreground`,children:e.description})]})]})}function Ae({session:e,busy:t,launching:n,onResume:r}){let a=e.desktopHandoff.method===`direct`,o=a?`Codex Desktop`:`Claude Desktop`;return(0,Y.jsxs)(`button`,{type:`button`,disabled:t,onClick:()=>r(e),"aria-label":a?`Resume ${e.title} in Codex Desktop`:`Move ${e.title} to Claude Desktop`,className:i(`flex min-h-20 w-full cursor-pointer items-center gap-3 rounded-xl border border-primary/25 bg-primary/5 p-3 text-left outline-none transition-colors`,`hover:border-primary/45 hover:bg-primary/10 focus-visible:ring-2 focus-visible:ring-ring`,`disabled:cursor-not-allowed disabled:opacity-65`),children:[(0,Y.jsx)(Q,{icon:a?`codex`:`claude`}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,Y.jsx)(`span`,{className:`truncate font-medium text-foreground`,title:e.title,children:e.title}),n?(0,Y.jsx)(j,{className:`size-4 shrink-0`}):a?(0,Y.jsx)(R,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Y.jsx)(w,{className:`size-4 shrink-0 text-muted-foreground`})]}),(0,Y.jsxs)(`span`,{className:`mt-0.5 block text-xs leading-relaxed text-muted-foreground`,children:[a?`Open this existing task in ${o}`:`Resume in Claude Code, then type /desktop`,` · `,new Date(e.updatedAt).toLocaleString()]})]})]})}function je({workspaceId:e,workspacePath:t,isVsCode:n=!1,className:r}){let[i,o]=(0,q.useState)(!1),[s,c]=(0,q.useState)(null),[l,u]=(0,q.useState)(null),[d,f]=(0,q.useState)(null),p=(0,q.useRef)(!1),m=z(),h=fe(e,i),g=oe().data?.config,_=m.data?.filter(e=>e.available)??[],v=_.filter(e=>e.kind===`ai-app`),y=g?.defaultEditor?{code:`vscode`,"code-insiders":`vscode-insiders`,cursor:`cursor`,antigravity:`antigravity`,idea:`intellij`,webstorm:`webstorm`,charm:`pycharm`,subl:`sublime`,zed:`zed`,windsurf:`windsurf`}[g.defaultEditor]:void 0,b=_.filter(e=>e.kind===`editor`).toSorted((e,t)=>Number(t.id===y)-Number(e.id===y)),x=new Set(_.map(e=>e.id)),S=(h.data??[]).filter(e=>e.desktopHandoff&&x.has(e.desktopHandoff.targetId)),ee=n||_.length>0,C=async t=>{if(!p.current){p.current=!0,u(null),f(null),c(t.id);try{await M(`/api/workspace/${encodeURIComponent(e)}/launch`,{method:`POST`,body:JSON.stringify({targetId:t.id})}),o(!1)}catch(e){u(e instanceof Error?e.message:String(e)),await m.refetch()}finally{c(null),p.current=!1}}},te=async t=>{if(!(p.current||!t.desktopHandoff||!X.test(t.id))){p.current=!0,u(null),f(null),c(`session:${t.id}`);try{if(t.desktopHandoff.method===`guided`){await V(`claude --resume ${t.id}`),f(`Claude resume command copied. With a Claude subscription login, run it in this workspace, then type /desktop in Claude to move the session into Claude Desktop.`);return}await M(`/api/workspace/${encodeURIComponent(e)}/launch`,{method:`POST`,body:JSON.stringify({targetId:t.desktopHandoff.targetId,action:`resume`,sessionId:t.id})}),o(!1)}catch(e){u(e instanceof Error?e.message:String(e)),await Promise.all([m.refetch(),h.refetch()])}finally{c(null),p.current=!1}}},w=()=>{window.parent.postMessage({type:`openWorkspaceFolder`,workspacePath:t},`*`),o(!1)},ne=()=>Promise.all([m.refetch(),h.refetch()]),T=m.isFetching||h.isFetching;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(a,{variant:`outline`,className:r,onClick:()=>o(!0),children:[(0,Y.jsx)(De,{}),`Open with…`]}),(0,Y.jsx)(_e,{open:i,onOpenChange:e=>{o(e),e||(u(null),f(null))},children:(0,Y.jsxs)(ue,{className:`max-w-2xl`,"aria-busy":s!==null,children:[(0,Y.jsxs)(I,{children:[(0,Y.jsx)(N,{children:`Open workspace with…`}),(0,Y.jsx)(B,{children:`Continue recent AI work or start in an installed coding app or editor. AI apps may use their own online services.`})]}),(0,Y.jsxs)(H,{className:`space-y-5`,children:[l&&(0,Y.jsx)(`div`,{role:`alert`,className:`rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive-foreground`,children:l}),d&&(0,Y.jsx)(`div`,{role:`status`,className:`rounded-lg border border-primary/25 bg-primary/5 px-3 py-2 text-sm text-foreground`,children:d}),h.isLoading?(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"aria-live":`polite`,children:[(0,Y.jsx)(j,{className:`size-4`}),` Checking recent sessions…`]}):S.length>0?(0,Y.jsxs)(`section`,{"aria-labelledby":`recent-sessions-heading`,children:[(0,Y.jsx)(`h3`,{id:`recent-sessions-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Continue recent work`}),(0,Y.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:S.map(e=>(0,Y.jsx)(Ae,{session:e,busy:s!==null,launching:s===`session:${e.id}`,onResume:te},`${e.assistant}:${e.id}`))})]}):h.isError?(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Recent sessions could not be checked. Starting new work is still available.`}):null,n&&(0,Y.jsxs)(`section`,{"aria-labelledby":`current-editor-heading`,children:[(0,Y.jsx)(`h3`,{id:`current-editor-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Current window`}),(0,Y.jsxs)(`button`,{type:`button`,disabled:s!==null,onClick:w,className:`flex min-h-20 w-full cursor-pointer items-center gap-3 rounded-xl border border-primary/30 bg-primary/5 p-3 text-left outline-none transition-colors hover:bg-primary/10 focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-65`,children:[(0,Y.jsx)(Q,{icon:`vscode`}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`span`,{className:`block font-medium`,children:`Current VS Code window`}),(0,Y.jsx)(`span`,{className:`mt-0.5 block text-xs text-muted-foreground`,children:`Open through the installed NexusFlow extension.`})]})]})]}),m.isLoading?(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 py-8 text-sm text-muted-foreground`,"aria-live":`polite`,children:[(0,Y.jsx)(j,{}),` Checking apps on this computer…`]}):m.isError?(0,Y.jsx)(`div`,{role:`alert`,className:`rounded-lg border border-destructive/30 bg-destructive/10 p-3 text-sm text-destructive-foreground`,children:m.error instanceof Error?m.error.message:`Could not check available apps.`}):(0,Y.jsxs)(Y.Fragment,{children:[v.length>0&&(0,Y.jsxs)(`section`,{"aria-labelledby":`ai-apps-heading`,children:[(0,Y.jsx)(`h3`,{id:`ai-apps-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`AI coding apps`}),(0,Y.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:v.map(e=>(0,Y.jsx)($,{target:e,busy:s!==null,launching:s===e.id,onLaunch:C},e.id))})]}),b.length>0&&(0,Y.jsxs)(`section`,{"aria-labelledby":`editors-heading`,children:[(0,Y.jsx)(`h3`,{id:`editors-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Code editors`}),(0,Y.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:b.map(e=>(0,Y.jsx)($,{target:e,busy:s!==null,launching:s===e.id,preferred:e.id===y,onLaunch:C},e.id))})]}),!ee&&(0,Y.jsx)(Se,{className:`rounded-xl border border-dashed py-8 md:p-8`,children:(0,Y.jsxs)(xe,{children:[(0,Y.jsx)(G,{variant:`icon`,children:(0,Y.jsx)(Te,{})}),(0,Y.jsx)(W,{className:`text-base`,children:`No compatible apps detected`}),(0,Y.jsx)(be,{children:`Install a supported coding app or add its command to PATH, then recheck.`})]})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-t border-border pt-3`,children:[(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,"aria-live":`polite`,children:T?`Checking recent sessions and apps…`:`Can’t find your app or session? Recheck detection.`}),(0,Y.jsxs)(a,{size:`sm`,variant:`ghost`,onClick:()=>void ne(),disabled:T||s!==null,children:[(0,Y.jsx)(k,{className:T?`animate-spin`:``}),`Recheck`]})]})]})]})})]})}var Me=`__ad-hoc__`,Ne=new URLSearchParams(window.location.search).get(`env`)===`vscode`,Pe=[{value:`in-place`,icon:m,title:`In-place`,body:`Work directly in the source repos. No branches or worktrees — fastest start.`},{value:`worktree`,icon:p,title:`Isolated worktrees`,body:`A feature branch and worktree per repo. Your source checkouts stay untouched.`}];function Fe({repo:e,value:t,onChange:n,enabled:r}){let i=L(e.path,r),a=(0,q.useMemo)(()=>[...new Set([...i.data?.local??[],...i.data?.remote??[]])],[i.data]),s=`branches-${e.path.replace(/[^a-zA-Z0-9]/g,`-`)}`;return(0,Y.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`w-40 shrink-0 truncate text-xs`,children:e.name}),(0,Y.jsx)(o,{list:s,value:t,onChange:e=>n(e.target.value),placeholder:`existing branch (must exist)`,className:`h-7 font-mono text-xs`}),(0,Y.jsx)(`datalist`,{id:s,children:a.map(e=>(0,Y.jsx)(`option`,{value:e},e))})]})}function Ie({step:e}){return(0,Y.jsxs)(`li`,{className:`flex items-center gap-3 py-2`,children:[(0,Y.jsx)(`span`,{className:i(`grid size-5 shrink-0 place-items-center rounded-full border`,e.status===`completed`&&`border-success bg-success/15 text-success-foreground`,e.status===`running`&&`border-primary text-primary`,e.status===`failed`&&`border-destructive bg-destructive/15 text-destructive-foreground`,e.status===`pending`&&`border-border text-muted-foreground`),children:e.status===`completed`?(0,Y.jsx)(ce,{className:`size-3`}):e.status===`running`?(0,Y.jsx)(j,{className:`size-3`}):e.status===`failed`?(0,Y.jsx)(A,{className:`size-3`}):null}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`p`,{className:`text-sm font-medium`,children:e.name}),(0,Y.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e.message})]})]})}function Le(){let e=S(),[t]=C(),n=ee(),r=te(),l=re(),p=ge(),m=de(),h=pe(),_=T(),{progress:y,start:x,reset:w}=Oe(),[E,oe]=(0,q.useState)(t.get(`project`)??Me),[D,O]=(0,q.useState)(`in-place`),[k,ce]=(0,q.useState)(``),[A,ue]=(0,q.useState)(``),[N,fe]=(0,q.useState)(``),[P,F]=(0,q.useState)([]),[I,_e]=(0,q.useState)(!1),[L,R]=(0,q.useState)([]),[z,B]=(0,q.useState)([]),[V,ve]=(0,q.useState)([]),[H,U]=(0,q.useState)(``),[W,G]=(0,q.useState)(``),[be,xe]=(0,q.useState)(!1),[Se,we]=(0,q.useState)(null),[K,Te]=(0,q.useState)({}),[Ee,De]=(0,q.useState)(!1),[J,X]=(0,q.useState)(null),ke=(0,q.useRef)(!1);(0,q.useEffect)(()=>{!ke.current&&l.data&&(ke.current=!0,R(l.data.filter(e=>e.detected).map(e=>e.name)))},[l.data]);let Z=(0,q.useMemo)(()=>(n.data??[]).find(e=>e.id===E)??null,[n.data,E]),Q=(0,q.useMemo)(()=>Z?Z.repos.map(e=>({name:he(e.path),path:e.path,defaultBranch:e.defaultBranch})):(r.data??[]).filter(e=>P.includes(e.path)),[Z,r.data,P]),$=D===`in-place`,Ae=($?A.trim().length>0:k.trim().length>0)&&Q.length>0&&N.trim().length>0,Le=e=>{U(e),we(null);let t=(p.data??[]).find(t=>t.id===e);G(t?.content??``)},Re=async()=>{if(!N.trim()){X(`Describe what you are building first — the suggestion is based on it.`);return}X(null),xe(!0);try{let e=await M(`/api/workspace/suggest-workflow`,{method:`POST`,body:JSON.stringify({description:N,repos:Q})});U(e.suggestedWorkflowId),G(e.customInstructions),we(e.difficulty)}catch(e){X(e instanceof Error?e.message:String(e))}finally{xe(!1)}},ze=(0,q.useRef)(!1),Be=async()=>{if(ze.current||_.isPending||!Ae)return;ze.current=!0,X(null);let e={mode:D,projectId:Z?.id,...$?{name:A.trim()}:{branchName:k.trim()},description:N.trim(),repos:Q.map(e=>({...e,existingBranch:!$&&K[e.path]?.trim()?K[e.path].trim():void 0})),assistants:L,enabledSkills:z.length>0?z:void 0,enabledAgents:V.length>0?V:void 0,teamworkInstructions:W.trim()||void 0};try{let{jobId:t}=await _.mutateAsync(e);x(t)}catch(e){X(e instanceof Error?e.message:String(e))}finally{ze.current=!1}};if(y.status!==`idle`){let t=y.steps.find(e=>e.status===`failed`);return(0,Y.jsxs)(`div`,{className:`mx-auto max-w-xl animate-fade-in`,children:[(0,Y.jsx)(`h1`,{className:`text-xl font-semibold`,children:y.status===`running`?`Setting up your workspace…`:y.status===`completed`?`Workspace ready`:`Workspace creation failed`}),(0,Y.jsx)(`ul`,{"aria-live":`polite`,"aria-relevant":`additions text`,className:`mt-6 divide-y divide-border rounded-xl border border-border bg-card px-4`,children:y.steps.map(e=>(0,Y.jsx)(Ie,{step:e},e.id))}),y.status===`failed`&&(0,Y.jsx)(`p`,{className:`mt-4 text-sm text-destructive-foreground`,children:t?.message??y.error??`Something went wrong.`}),y.status===`completed`&&y.workspacePath&&(0,Y.jsx)(`p`,{className:`mt-4 truncate font-mono text-xs text-muted-foreground`,children:y.workspacePath}),J&&(0,Y.jsx)(`p`,{className:`mt-2 text-sm text-destructive-foreground`,children:J}),(0,Y.jsxs)(`div`,{"data-testid":`workspace-ready-actions`,className:`mt-6 flex min-w-0 flex-col gap-2 sm:flex-row sm:flex-wrap`,children:[y.status===`completed`&&y.workspaceId&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(a,{className:`w-full min-w-0 whitespace-normal sm:w-auto`,onClick:()=>e(`/workspaces/${encodeURIComponent(y.workspaceId)}`),children:`Open workspace`}),y.workspacePath&&(0,Y.jsx)(je,{workspaceId:y.workspaceId,workspacePath:y.workspacePath,isVsCode:Ne,className:`w-full min-w-0 whitespace-normal sm:w-auto`})]}),y.status===`failed`&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Y.jsx)(a,{variant:`default`,onClick:w,children:`Back to form (edit & retry)`}),(0,Y.jsx)(a,{variant:`outline`,onClick:()=>window.location.reload(),children:`Start over (clear form)`})]}),y.status===`running`&&(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This can take a moment for large repositories.`}),(0,Y.jsx)(a,{variant:`outline`,size:`sm`,onClick:w,children:`Cancel creation`})]})]})]})}return(0,Y.jsxs)(`div`,{className:`mx-auto max-w-xl animate-fade-in`,children:[(0,Y.jsxs)(`header`,{className:`mb-6`,children:[(0,Y.jsx)(`h1`,{className:`text-xl font-semibold`,children:`Start work`}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Pick where the work happens and how isolated it should be.`})]}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`span`,{className:`mb-1.5 block text-sm font-medium`,children:`Project`}),(0,Y.jsxs)(se,{value:E,onValueChange:e=>typeof e==`string`&&oe(e),children:[(0,Y.jsx)(ae,{className:`w-full`,"aria-label":`Project`,children:(0,Y.jsx)(me,{children:Z?Z.name:`Ad-hoc — pick repositories manually`})}),(0,Y.jsxs)(v,{alignItemWithTrigger:!1,children:[(n.data??[]).map(e=>(0,Y.jsx)(b,{value:e.id,children:e.name},e.id)),(0,Y.jsx)(b,{value:Me,children:`Ad-hoc — pick repositories manually`})]})]}),Z?(0,Y.jsx)(`ul`,{className:`mt-2 flex flex-col gap-0.5`,children:Z.repos.map(e=>(0,Y.jsx)(`li`,{className:`truncate font-mono text-xs text-muted-foreground`,children:e.path},e.path))}):(0,Y.jsxs)(`div`,{className:`mt-2`,children:[(0,Y.jsx)(u,{repos:r.data??[],selectedPaths:P,onToggle:e=>F(t=>t.includes(e.path)?t.filter(t=>t!==e.path):[...t,e.path]),loading:r.isLoading}),(0,Y.jsx)(f,{onCreated:e=>F(t=>[...t,e.path])})]}),(n.data??[]).length===0&&!n.isLoading&&(0,Y.jsxs)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:[`Tip: `,(0,Y.jsx)(ie,{to:`/projects`,className:`text-primary hover:underline`,children:`register a project`}),` to skip repo picking next time.`]})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`span`,{className:`mb-1.5 block text-sm font-medium`,children:`How do you want to work?`}),(0,Y.jsx)(`div`,{role:`radiogroup`,"aria-label":`Work mode`,className:`grid gap-3 sm:grid-cols-2`,onKeyDown:e=>{if([`ArrowRight`,`ArrowDown`,`ArrowLeft`,`ArrowUp`].includes(e.key)){e.preventDefault();let t=D===`in-place`?`worktree`:`in-place`;O(t),document.getElementById(`mode-${t}`)?.focus()}},children:Pe.map(e=>(0,Y.jsxs)(`button`,{id:`mode-${e.value}`,type:`button`,role:`radio`,"aria-checked":D===e.value,tabIndex:D===e.value?0:-1,onClick:()=>O(e.value),className:i(`cursor-pointer rounded-xl border p-4 text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring`,D===e.value?`border-primary bg-primary/5 ring-1 ring-primary`:`border-border bg-card hover:border-foreground/20`),children:[(0,Y.jsx)(e.icon,{className:i(`size-4`,D===e.value?`text-primary`:`text-muted-foreground`)}),(0,Y.jsx)(`p`,{className:`mt-2 text-sm font-semibold`,children:e.title}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e.body})]},e.value))})]}),(0,Y.jsx)(`section`,{children:$?(0,Y.jsxs)(`label`,{className:`block`,children:[(0,Y.jsx)(`span`,{className:`mb-1 block text-sm font-medium`,children:`Workspace name`}),(0,Y.jsx)(o,{value:A,onChange:e=>ue(e.target.value),placeholder:`e.g. Fix invoice rounding`})]}):(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Y.jsxs)(`label`,{className:`block`,children:[(0,Y.jsx)(`span`,{className:`mb-1 block text-sm font-medium`,children:`Feature branch`}),(0,Y.jsx)(o,{value:k,onChange:e=>ce(e.target.value),placeholder:`e.g. feature/invoice-rounding`,className:`font-mono`})]}),Q.length>0&&(0,Y.jsxs)(`details`,{className:`rounded-lg border border-border px-3 py-2`,onToggle:e=>De(e.target.open),children:[(0,Y.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-muted-foreground`,children:`Use an existing branch for specific repos (optional)`}),(0,Y.jsx)(`div`,{className:`mt-2 flex flex-col gap-2`,children:Q.map(e=>(0,Y.jsx)(Fe,{repo:e,enabled:Ee,value:K[e.path]??``,onChange:t=>Te(n=>({...n,[e.path]:t}))},e.path))})]})]})}),(0,Y.jsx)(`section`,{children:(0,Y.jsxs)(`label`,{className:`block`,children:[(0,Y.jsx)(`span`,{className:`mb-1 block text-sm font-medium`,children:`What are you building?`}),(0,Y.jsx)(Ce,{value:N,onChange:e=>fe(e.target.value),placeholder:`A short description — your AI assistant reads this to plan the work.`,rows:3})]})}),(0,Y.jsxs)(`section`,{className:`rounded-xl border border-border`,children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>_e(e=>!e),className:`flex w-full items-center justify-between px-4 py-3 text-sm font-medium hover:bg-accent`,"aria-expanded":I,children:[`Advanced`,(0,Y.jsx)(c,{className:i(`size-4 text-muted-foreground transition-transform`,I&&`rotate-180`)})]}),I&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4 border-t border-border p-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{className:`mb-1.5 block text-sm font-medium`,children:`AI assistants`}),(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-3`,children:(l.data??[]).map(e=>(0,Y.jsxs)(`label`,{className:i(`flex cursor-pointer items-center gap-2 rounded-lg border border-border px-3 py-1.5 text-sm`,!e.detected&&`opacity-50`),children:[(0,Y.jsx)(d,{checked:L.includes(e.name),onCheckedChange:()=>R(t=>t.includes(e.name)?t.filter(t=>t!==e.name):[...t,e.name])}),e.displayName]},e.name))})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between`,children:[(0,Y.jsx)(`span`,{className:`text-sm font-medium`,children:`Teamwork strategy`}),(0,Y.jsxs)(a,{size:`xs`,variant:`outline`,onClick:Re,disabled:be,children:[be?(0,Y.jsx)(j,{}):(0,Y.jsx)(g,{}),`Suggest with AI`]})]}),(0,Y.jsxs)(se,{value:H,onValueChange:e=>typeof e==`string`&&Le(e),children:[(0,Y.jsx)(ae,{className:`w-full`,"aria-label":`Teamwork strategy`,children:(0,Y.jsx)(me,{children:(p.data??[]).find(e=>e.id===H)?.name??`None`})}),(0,Y.jsxs)(v,{alignItemWithTrigger:!1,children:[(0,Y.jsx)(b,{value:``,children:`None`}),(p.data??[]).map(e=>(0,Y.jsx)(b,{value:e.id,children:e.name},e.id))]})]}),Se&&(0,Y.jsxs)(`p`,{className:`mt-1.5 text-xs text-muted-foreground`,children:[`AI classified this task as `,(0,Y.jsx)(`span`,{className:`font-medium`,children:Se}),` difficulty.`]}),(0,Y.jsx)(Ce,{value:W,onChange:e=>G(e.target.value),placeholder:`Cooperation instructions for the agent team (editable — prefilled by the strategy pick or AI suggestion).`,rows:4,className:`mt-2 font-mono text-xs`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between`,children:[(0,Y.jsxs)(`span`,{className:`text-sm font-medium flex items-center gap-1.5`,children:[(0,Y.jsx)(le,{className:`size-4 text-primary`}),`Agent Skills (`,z.length,` selected)`]}),(m.data??[]).length>0&&(0,Y.jsx)(a,{type:`button`,size:`xs`,variant:`ghost`,onClick:()=>{let e=(m.data??[]).map(e=>e.id);B(z.length===e.length?[]:e)},className:`text-xs text-muted-foreground hover:text-foreground h-6 px-2`,children:z.length===(m.data??[]).length&&(m.data??[]).length>0?`Deselect All`:`Select All`})]}),(0,Y.jsx)(`div`,{className:`max-h-48 overflow-y-auto rounded-lg border border-border bg-card/50 p-2 space-y-1.5`,children:m.isLoading?(0,Y.jsxs)(`div`,{className:`flex items-center justify-center p-4 gap-2 text-xs text-muted-foreground`,children:[(0,Y.jsx)(j,{className:`size-3`}),`Loading skills...`]}):(m.data??[]).length===0?(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground p-2 text-center`,children:`No skills available in catalog.`}):(m.data??[]).map(e=>{let t=z.includes(e.id);return(0,Y.jsxs)(`label`,{className:i(`flex items-center justify-between gap-2 rounded-md p-2 text-xs cursor-pointer border transition-colors`,t?`border-primary/50 bg-primary/5 text-foreground`:`border-transparent hover:bg-muted/50 text-muted-foreground`),children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,Y.jsx)(d,{checked:t,onCheckedChange:()=>B(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])}),(0,Y.jsx)(`span`,{className:`font-mono font-medium truncate`,children:e.title||e.name})]}),(0,Y.jsx)(ye,{variant:`outline`,className:`text-[9px] px-1 py-0 shrink-0`,children:e.category})]},e.id)})})]}),(h.data??[]).length>0&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`div`,{className:`mb-1.5 flex items-center justify-between`,children:(0,Y.jsxs)(`span`,{className:`text-sm font-medium flex items-center gap-1.5`,children:[(0,Y.jsx)(s,{className:`size-4 text-purple-400`}),`Codex Native Agents (`,V.length,` selected)`]})}),(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(h.data??[]).map(e=>{let t=V.includes(e.id);return(0,Y.jsxs)(`label`,{className:i(`flex cursor-pointer items-center gap-2 rounded-lg border border-border px-3 py-1.5 text-xs`,t?`border-purple-500/60 bg-purple-500/5 text-foreground`:`text-muted-foreground hover:bg-muted/50`),children:[(0,Y.jsx)(d,{checked:t,onCheckedChange:()=>ve(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])}),(0,Y.jsx)(`span`,{className:`font-mono`,children:e.name})]},e.id)})})]})]})]}),J&&(0,Y.jsx)(`p`,{className:`text-sm text-destructive-foreground`,children:J}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-4 border-t border-border pt-4`,children:[(0,Y.jsxs)(`p`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Y.jsx)(ne,{className:`size-3.5`}),Q.length,` repositor`,Q.length===1?`y`:`ies`,` selected`]}),(0,Y.jsxs)(a,{onClick:Be,disabled:!Ae||_.isPending,children:[_.isPending?(0,Y.jsx)(j,{}):null,$?`Start working`:`Create workspace`]})]})]})]})}export{Le as StartWorkPage};
@@ -1,3 +1,3 @@
1
- import{_ as e,g as t,h as n,m as r,t as i}from"./button-BDDZnIHx.js";import{n as a}from"./CSPContext-BG7no5S_.js";import{t as o}from"./circle-plus-lmU1yNJd.js";import{t as s}from"./cpu-Cdwd84Jz.js";import{t as c}from"./trash-2-CtR35_eF.js";import{D as l,E as u,O as d,T as f,a as p,k as m,p as h}from"./index-wy68EqfB.js";import{t as g}from"./badge-CAohJGj6.js";import{t as _}from"./card-BKXzd_5L.js";import{a as v,i as y,n as b,r as x,t as S}from"./empty-BdlgbifD.js";import{t as C}from"./label-CG5exjag.js";import{t as w}from"./textarea-BNRuIXNs.js";var T=n(`circle-check-big`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),E=n(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]);e();var D=t();function O(e){let{workflowTemplates:t,isEditingTemplate:n,setIsEditingTemplate:O,mgtTemplateName:k,setMgtTemplateName:A,mgtTemplateContent:j,setMgtTemplateContent:M,selectedMgtTemplateId:N,setSelectedMgtTemplateId:P,analysisResult:F,setAnalysisResult:I,showToast:L,handleAnalyzeTemplate:R,handleSaveTemplate:z,handleDeleteTemplate:B,aiAssistants:V,analyzingTemplate:H,mgtAnalysisComment:U,setMgtAnalysisComment:W,suggestedImprovement:G,setSuggestedImprovement:K,savingTemplate:q,deletingTemplate:J,selectedInspectAssistant:Y,setSelectedInspectAssistant:X}=e,Z=t.find(e=>e.id===N),Q=V.filter(e=>e.detected&&e.command),$=Q.find(e=>e.name===Y)?.displayName??`No Harness Found`;return(0,D.jsxs)(`div`,{className:`mx-auto max-w-6xl animate-fade-in`,children:[(0,D.jsxs)(`header`,{className:`mb-6`,children:[(0,D.jsx)(`h1`,{className:`text-xl font-semibold text-foreground`,children:`Team Collaboration Strategies`}),(0,D.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Predefine and review custom teamwork guidelines injected into workspaces' AGENTS.md files.`})]}),(0,D.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 text-left lg:grid-cols-12`,children:[(0,D.jsx)(`div`,{className:`flex flex-col gap-4 lg:col-span-4`,children:(0,D.jsxs)(_,{className:`rounded-xl p-5 shadow-sm`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,D.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Strategies`}),(0,D.jsxs)(i,{size:`sm`,onClick:()=>{O(!0),A(`New Strategy`),M(`# New Strategy
1
+ import{_ as e,g as t,h as n,m as r,t as i}from"./button-BDDZnIHx.js";import{o as a}from"./CSPContext-DBUu9tE0.js";import{t as o}from"./circle-plus-lmU1yNJd.js";import{t as s}from"./cpu-Cdwd84Jz.js";import{t as c}from"./trash-2-CtR35_eF.js";import{D as l,E as u,O as d,T as f,a as p,k as m,p as h}from"./index-CoNaATPd.js";import{t as g}from"./badge-CAohJGj6.js";import{t as _}from"./card-BKXzd_5L.js";import{a as v,i as y,n as b,r as x,t as S}from"./empty-BdlgbifD.js";import{t as C}from"./label-CG5exjag.js";import{t as w}from"./textarea-ByfoCb54.js";var T=n(`circle-check-big`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),E=n(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]);e();var D=t();function O(e){let{workflowTemplates:t,isEditingTemplate:n,setIsEditingTemplate:O,mgtTemplateName:k,setMgtTemplateName:A,mgtTemplateContent:j,setMgtTemplateContent:M,selectedMgtTemplateId:N,setSelectedMgtTemplateId:P,analysisResult:F,setAnalysisResult:I,showToast:L,handleAnalyzeTemplate:R,handleSaveTemplate:z,handleDeleteTemplate:B,aiAssistants:V,analyzingTemplate:H,mgtAnalysisComment:U,setMgtAnalysisComment:W,suggestedImprovement:G,setSuggestedImprovement:K,savingTemplate:q,deletingTemplate:J,selectedInspectAssistant:Y,setSelectedInspectAssistant:X}=e,Z=t.find(e=>e.id===N),Q=V.filter(e=>e.detected&&e.command),$=Q.find(e=>e.name===Y)?.displayName??`No Harness Found`;return(0,D.jsxs)(`div`,{className:`mx-auto max-w-6xl animate-fade-in`,children:[(0,D.jsxs)(`header`,{className:`mb-6`,children:[(0,D.jsx)(`h1`,{className:`text-xl font-semibold text-foreground`,children:`Team Collaboration Strategies`}),(0,D.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Predefine and review custom teamwork guidelines injected into workspaces' AGENTS.md files.`})]}),(0,D.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 text-left lg:grid-cols-12`,children:[(0,D.jsx)(`div`,{className:`flex flex-col gap-4 lg:col-span-4`,children:(0,D.jsxs)(_,{className:`rounded-xl p-5 shadow-sm`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,D.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Strategies`}),(0,D.jsxs)(i,{size:`sm`,onClick:()=>{O(!0),A(`New Strategy`),M(`# New Strategy
2
2
 
3
3
  Write custom teamwork rules here for subagent orchestration...`),P(null),I(null)},children:[(0,D.jsx)(o,{size:12}),` Add New`]})]}),(0,D.jsx)(h,{className:`mt-4 max-h-[480px]`,children:(0,D.jsx)(`div`,{className:`flex flex-col gap-2 pr-1`,children:t.map(e=>{let t=N===e.id;return(0,D.jsxs)(`div`,{className:r(`flex cursor-pointer flex-col gap-1.5 rounded-lg border p-3 text-left transition-colors`,t?`border-primary bg-primary/5 ring-1 ring-primary/40`:`border-border bg-card hover:border-foreground/15 hover:bg-muted/40`),onClick:()=>{P(e.id),O(!1),A(e.name),M(e.content),I(null)},children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,D.jsx)(`span`,{className:r(`text-xs font-semibold`,t?`text-primary`:`text-foreground`),children:e.name}),(0,D.jsx)(g,{variant:e.custom?`info`:`secondary`,size:`sm`,className:`font-mono uppercase`,children:e.custom?`Custom`:`Built-in`})]}),(0,D.jsx)(`p`,{className:`line-clamp-2 text-xs leading-relaxed text-muted-foreground`,children:e.description})]},e.id)})})})]})}),(0,D.jsx)(`div`,{className:`flex flex-col gap-6 lg:col-span-8`,children:N||n?(0,D.jsxs)(_,{className:`flex flex-col gap-5 rounded-xl p-6 shadow-sm`,children:[(0,D.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,D.jsx)(`div`,{className:`flex-1`,children:n?(0,D.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,D.jsx)(C,{className:`text-sm`,children:`Strategy Name`}),(0,D.jsx)(a,{type:`text`,value:k,onChange:e=>A(e.target.value),placeholder:`e.g. Test-Driven Development`})]}):(0,D.jsxs)(`div`,{children:[(0,D.jsxs)(`h2`,{className:`flex items-center gap-2 text-lg font-semibold text-foreground`,children:[k,Z?.custom&&(0,D.jsx)(g,{variant:`info`,className:`font-mono uppercase`,children:`Custom Template`})]}),(0,D.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:Z?.description||`Custom strategy template.`})]})}),(0,D.jsx)(`div`,{className:`flex gap-2`,children:n?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(i,{variant:`outline`,size:`sm`,onClick:()=>{if(N){let e=t.find(e=>e.id===N);e&&(A(e.name),M(e.content)),O(!1)}else if(O(!1),t.length>0){let e=t[0];P(e.id),A(e.name),M(e.content)}},children:`Cancel`}),(0,D.jsx)(i,{size:`sm`,onClick:z,disabled:q,children:q?`Saving...`:`Save Strategy`})]}):(0,D.jsxs)(D.Fragment,{children:[Z?.custom&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(i,{variant:`outline`,size:`sm`,onClick:()=>O(!0),children:`Edit`}),(0,D.jsxs)(i,{variant:`destructive`,size:`sm`,onClick:()=>B(N),disabled:J,children:[(0,D.jsx)(c,{size:12}),` Delete`]})]}),!Z?.custom&&(0,D.jsx)(i,{variant:`outline`,size:`sm`,onClick:()=>{O(!0),A(`${k} Copy`),M(j),P(null),I(null)},children:`Duplicate & Customize`})]})})]}),(0,D.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,D.jsx)(C,{className:`text-sm`,children:`Guidelines Markdown`}),(0,D.jsx)(w,{className:`min-h-[250px] font-mono text-xs leading-relaxed`,value:j,onChange:e=>M(e.target.value),disabled:!n,placeholder:`Write cooperation guidelines in Markdown...`})]}),!n&&N&&(0,D.jsxs)(`div`,{className:`flex flex-col gap-4 border-t border-border pt-5`,children:[(0,D.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,D.jsxs)(`div`,{className:`flex flex-col items-start justify-between gap-4 sm:flex-row sm:items-center`,children:[(0,D.jsxs)(`div`,{className:`flex flex-col`,children:[(0,D.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold text-foreground`,children:[(0,D.jsx)(s,{size:14,className:`text-muted-foreground`}),` AI Strategy Analysis`]}),(0,D.jsx)(`span`,{className:`mt-0.5 text-xs text-muted-foreground`,children:`Select an AI assistant harness installed on your system to inspect these guidelines.`})]}),(0,D.jsxs)(`div`,{className:`flex w-full items-center justify-end gap-3 sm:w-auto`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Harness:`}),(0,D.jsxs)(f,{value:Y,disabled:Q.length===0,onValueChange:e=>typeof e==`string`&&X(e),children:[(0,D.jsx)(d,{size:`sm`,className:`w-44`,"aria-label":`Harness`,children:(0,D.jsx)(m,{children:$})}),(0,D.jsx)(l,{alignItemWithTrigger:!1,children:Q.length>0?Q.map(e=>(0,D.jsx)(u,{value:e.name,children:e.displayName},e.name)):(0,D.jsx)(u,{value:``,children:`No Harness Found`})})]})]}),(0,D.jsx)(i,{size:`sm`,onClick:()=>R(N,j,Y),disabled:H||Q.length===0,children:H?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(p,{className:`size-3`}),` Inspecting...`]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(s,{size:12}),` Inspect Strategy`]})})]})]}),(0,D.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,D.jsx)(C,{className:`text-left text-xs uppercase tracking-wider text-muted-foreground`,children:`Evaluation Focus / Instructions (Optional)`}),(0,D.jsx)(w,{className:`min-h-[60px] text-xs leading-relaxed`,value:U,onChange:e=>W(e.target.value),placeholder:`e.g. Focus on checking if timeouts are handled well, check subagent roles coordination...`,disabled:H})]})]}),F&&(0,D.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,D.jsx)(h,{className:`max-h-[300px] rounded-xl border border-border bg-muted/40 p-5`,children:(0,D.jsx)(`div`,{className:`select-text whitespace-pre-wrap text-left text-xs leading-relaxed text-foreground`,children:F})}),G&&(0,D.jsx)(`div`,{className:`flex justify-end`,children:(0,D.jsxs)(i,{size:`sm`,onClick:()=>{M(G),O(!0),K(null),I(null),L(`Suggested improvements applied! Click Save to persist changes.`,`success`)},children:[(0,D.jsx)(T,{size:14}),` Apply Suggested Improvements`]})})]})]})]}):(0,D.jsx)(`div`,{className:`flex min-h-[400px] flex-col items-center justify-center`,children:(0,D.jsx)(S,{className:`w-full max-w-md border border-dashed border-border`,children:(0,D.jsxs)(x,{children:[(0,D.jsx)(y,{variant:`icon`,children:(0,D.jsx)(E,{})}),(0,D.jsx)(v,{children:`No strategy template selected`}),(0,D.jsx)(b,{children:`Select a template from the list to view, edit, or analyze it, or add a new custom teamwork workflow template.`})]})})})})]})]})}export{O as StrategiesPage};
@@ -0,0 +1,6 @@
1
+ import{_ as e,b as t,c as n,d as r,g as i,h as a,i as o,l as s,m as c,o as l,p as u,s as d,t as f,v as p}from"./button-BDDZnIHx.js";import{$n as m,$t as h,A as g,B as _,Bt as v,C as y,D as b,E as x,En as S,Et as C,F as w,Fn as T,H as E,Hn as D,I as O,K as k,L as A,M as j,Mn as M,N,O as P,P as F,Q as I,Qn as ee,Qt as L,R as te,Rn as ne,S as R,St as re,T as z,Tt as ie,U as ae,Un as B,V as oe,Vt as se,Xt as ce,Z as V,Zn as H,_ as le,at as ue,b as de,bt as fe,ct as pe,dn as me,en as U,er as he,et as ge,ft as _e,g as ve,h as W,hn as ye,in as be,it as G,j as xe,k as Se,kt as Ce,lt as K,mn as q,nr as we,nt as Te,o as Ee,pn as J,qn as De,rn as Oe,rt as ke,t as Ae,tn as je,tr as Me,tt as Ne,un as Pe,v as Fe,wt as Ie,x as Le,xt as Re,y as ze,z as Be,zn as Ve,zt as He}from"./CSPContext-DBUu9tE0.js";import{t as Ue}from"./bot-C2HWrAft.js";import{t as We}from"./chevron-down-qTL8HPug.js";import{a as Ge,c as Ke,i as qe,l as Je,n as Ye,o as Xe,r as Ze,s as Qe,t as $e,u as et}from"./square-DlIYnlSq.js";import{t as tt}from"./code-xml-jFAa3-TT.js";import{t as nt}from"./cpu-Cdwd84Jz.js";import{t as rt}from"./trash-2-CtR35_eF.js";import{t as it}from"./zap-CWG_Lvki.js";import{_ as at,a as ot,c as st,d as ct,f as lt,l as ut,n as dt,o as ft,s as pt,t as mt,u as ht,x as gt,y as _t}from"./isElementDisabled-uy_EOitH.js";import{$ as vt,$t as yt,A as bt,Bt as xt,Ft as St,Gt as Ct,Ht as wt,Jt as Tt,K as Et,Kt as Dt,Lt as Ot,M as kt,N as At,Nt as jt,Pt as Mt,Q as Nt,Qt as Pt,Rt as Ft,St as It,U as Lt,Ut as Rt,W as zt,Wt as Bt,Xt as Y,Zt as Vt,_t as Ht,a as X,at as Ut,bt as Wt,ct as Gt,d as Kt,dt as qt,et as Jt,f as Yt,ft as Xt,gt as Zt,ht as Qt,i as $t,j as en,jt as tn,l as nn,lt as rn,mt as an,n as on,o as sn,ot as cn,pt as ln,qt as un,r as dn,rt as fn,t as pn,u as mn,ut as Z,vt as hn,w as gn,wt as _n,xt as vn,yt as yn,zt as bn}from"./index-CoNaATPd.js";import{t as xn}from"./badge-CAohJGj6.js";import{t as Sn}from"./card-BKXzd_5L.js";import{a as Cn,i as wn,n as Tn,r as En,t as Dn}from"./empty-BdlgbifD.js";import{t as On}from"./textarea-ByfoCb54.js";import{n as kn,t as An}from"./vsc-BTST_4ex.js";var jn=a(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),Mn=a(`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`}]]),Nn=a(`history`,[[`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`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),Pn=a(`list-ordered`,[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]),Fn=a(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),In=a(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),Ln=a(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]),Rn=a(`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`}]]),zn=a(`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`}]]),Bn=a(`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`}]]),Vn=a(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),Hn=a(`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`}]]),Un=a(`square-play`,[[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`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`}]]),Q=t(e(),1);function Wn(){let[,e]=Q.useState({});return Q.useCallback(()=>{e({})},[])}function Gn(e){let t=ye(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=S(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r;return(_t(n)!==a||_t(r)!==o)&&(n=a,r=o),{width:n,height:r}}function Kn(e){let{popupElement:t,positionerElement:r,content:i,mounted:a,onMeasureLayout:o,onMeasureLayoutComplete:c,side:l,direction:u}=e,d=h(t,!0,!1),f=je(),p=Q.useRef(null),m=Q.useRef(!0),g=Q.useRef(s),_=q(o),v=q(c),y=Q.useMemo(()=>{let e=l===`top`,t=l===`left`;return u===`rtl`?(e||=l===`inline-end`,t||=l===`inline-end`):(e||=l===`inline-start`,t||=l===`inline-start`),e?{position:`absolute`,[l===`top`?`bottom`:`top`]:`0`,[t?`right`:`left`]:`0`}:n},[l,u]);J(()=>{if(!a){g.current=s,m.current=!0,p.current=null;return}if(!t||!r)return;g.current=Jn(t,y),Yn(t,`auto`);let e=qn(t,`position`,`static`),n=qn(t,`transform`,`none`),i=qn(t,`scale`,`1`),o=Jn(r,{"--available-width":`max-content`,"--available-height":`max-content`});function c(){e(),n(),o()}function l(){c(),i()}if(_?.(),m.current||p.current===null){Xn(r,`max-content`);let e=Gn(t);return p.current=e,Xn(r,e),l(),v?.(null,e),m.current=!1,()=>{g.current(),g.current=s}}Xn(r,`max-content`);let u=p.current,h=Gn(t);p.current=h,Yn(t,u),l(),v?.(u,h),Xn(r,h);let b=new AbortController;return f.request(()=>{Yn(t,h),d(()=>{t.style.setProperty(`--popup-width`,`auto`),t.style.setProperty(`--popup-height`,`auto`)},b.signal)}),()=>{b.abort(),f.cancel(),g.current(),g.current=s}},[i,t,r,d,f,a,_,v,y])}function qn(e,t,n){let r=e.style.getPropertyValue(t);return e.style.setProperty(t,n),()=>{e.style.setProperty(t,r)}}function Jn(e,t){let n=[];for(let[r,i]of Object.entries(t))n.push(qn(e,r,i));return n.length?()=>{n.forEach(e=>e())}:s}function Yn(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 Xn(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 Zn=t(we(),1),$=i();function Qn(e){let{store:t,side:n,cssVars:r,children:i}=e,a=ve(),o=t.useState(`activeTriggerElement`),s=t.useState(`activeTriggerId`),c=t.useState(`open`),l=t.useState(`payload`),u=t.useState(`mounted`),d=t.useState(`popupElement`),f=t.useState(`positionerElement`),p=dt(c?o:null),m=nr(s,l),g=Q.useRef(null),[_,v]=Q.useState(null),[y,b]=Q.useState(null),x=Q.useRef(null),S=Q.useRef(null),C=h(x,!0,!1),w=je(),[T,E]=Q.useState(null),[D,O]=Q.useState(!1);J(()=>(t.set(`hasViewport`,!0),()=>{t.set(`hasViewport`,!1)}),[t]);let k=q(()=>{x.current?.style.setProperty(`animation`,`none`),x.current?.style.setProperty(`transition`,`none`),S.current?.style.setProperty(`display`,`none`)}),A=q(e=>{x.current?.style.removeProperty(`animation`),x.current?.style.removeProperty(`transition`),S.current?.style.removeProperty(`display`),e&&E(e)}),j=Q.useRef(null);J(()=>{(!c||!u)&&(j.current=null)},[c,u]),J(()=>{if(o&&p&&o!==p&&j.current!==o&&g.current){v(g.current),O(!0);let e=tr(p,o);b(e),w.request(()=>{Zn.flushSync(()=>{O(!1)}),C(()=>{v(null),E(null),g.current=null})}),j.current=o}},[o,p,_,C,w]),J(()=>{let e=x.current;if(!e)return;let t=Ce(e).createElement(`div`);for(let n of Array.from(e.childNodes))t.appendChild(n.cloneNode(!0));g.current=t});let M=_!=null,N;N=M?(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(`div`,{"data-previous":!0,inert:le(!0),ref:S,style:{...T?{[r.popupWidth]:`${T.width}px`,[r.popupHeight]:`${T.height}px`}:null,position:`absolute`},"data-ending-style":D?void 0:``},`previous`),(0,$.jsx)(`div`,{"data-current":!0,ref:x,"data-starting-style":D?``:void 0,children:i},m)]}):(0,$.jsx)(`div`,{"data-current":!0,ref:x,children:i},m),J(()=>{let e=S.current;!e||!_||e.replaceChildren(...Array.from(_.childNodes))},[_]),Kn({popupElement:d,positionerElement:f,mounted:u,content:l,onMeasureLayout:k,onMeasureLayoutComplete:A,side:n,direction:a});let P={activationDirection:$n(y),transitioning:M};return{children:N,state:P}}function $n(e){if(e)return`${er(e.horizontal,5,`right`,`left`)} ${er(e.vertical,5,`down`,`up`)}`}function er(e,t,n,r){return e>t?n:e<-t?r:``}function tr(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 nr(e,t){let[n,r]=Q.useState(0),i=Q.useRef(e),a=Q.useRef(t),o=Q.useRef(!1);return J(()=>{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}`}var rr=Q.createContext(void 0);function ir(){let e=Q.useContext(rr);if(e===void 0)throw Error(u(64));return e}var ar=function(e){return e.activationDirection=`data-activation-direction`,e.orientation=`data-orientation`,e}({}),or={tabActivationDirection:e=>({[ar.activationDirection]:e})},sr=Q.forwardRef(function(e,t){let{className:n,defaultValue:r=0,onValueChange:i,orientation:a=`horizontal`,render:s,value:c,style:l,...u}=e,d=e.defaultValue!==void 0,f=Q.useRef([]),[p,m]=Q.useState(()=>new Map),[h,g]=M({controlled:c,default:r,name:`Tabs`,state:`value`}),_=c!==void 0,[v,y]=Q.useState(()=>new Map),b=Q.useRef(void 0),x=Q.useCallback(e=>{if(e===void 0)return null;for(let[t,n]of v.entries())if(n!=null&&e===(n.value??n.index))return t;return null},[v]),[S,C]=Q.useState(()=>({previousValue:h,tabActivationDirection:`none`})),{previousValue:w,tabActivationDirection:E}=S,O=E,k=!1;w!==h&&(O=cr(w,h,a,v),k=w!=null&&h!=null&&x(h)==null);let A=k?w:h,j=w!==A||E!==O;J(()=>{j&&C({previousValue:A,tabActivationDirection:O})},[A,j,O]);let N=q((e,t)=>{t.activationDirection=cr(h,e,a,v),i?.(e,t),!t.isCanceled&&g(e)}),P=q((e,t)=>{i?.(e,Oe(t,void 0,void 0,{activationDirection:`none`}))}),F=q((e,t)=>{m(n=>{if(n.get(e)===t)return n;let r=new Map(n);return r.set(e,t),r})}),I=q((e,t)=>{m(n=>{if(!n.has(e)||n.get(e)!==t)return n;let r=new Map(n);return r.delete(e),r})}),ee=Q.useCallback(e=>p.get(e),[p]),L=Q.useCallback(e=>{for(let t of v.values())if(e===t?.value)return t?.id},[v]),te=Q.useMemo(()=>({getTabElementBySelectedValue:x,getTabIdByPanelValue:L,getTabPanelIdByValue:ee,onValueChange:N,orientation:a,registerMountedTabPanel:F,setTabMap:y,unregisterMountedTabPanel:I,tabActivationDirection:O,value:h}),[x,L,ee,N,a,F,y,I,O,h]),ne=Q.useMemo(()=>{for(let e of v.values())if(e!=null&&e.value===h)return e},[v,h]),R=Q.useMemo(()=>{for(let e of v.values())if(e!=null&&!e.disabled)return e.value},[v]),re=Q.useRef(!d),z=Q.useRef(r),ie=Q.useRef(d),ae=Q.useRef(!1);J(()=>{if(_)return;function e(e,t){g(e),C(t=>t.previousValue===e&&t.tabActivationDirection===`none`?t:{previousValue:e,tabActivationDirection:`none`}),P(e,t),re.current=!1}if(v.size===0){ae.current&&h!==null&&!b.current?.isConnected&&e(null,D);return}ae.current=!0,b.current=v.keys().next().value;let t=ne?.disabled,n=ne==null&&h!==null;if(!t&&h===z.current&&(ie.current=!1),ie.current&&t&&h===z.current)return;let r=re.current;if(t||n){let n=R??null;if(h===n){re.current=!1;return}let i=D;r?i=Ve:t&&(i=T),e(n,i);return}r&&ne!=null&&(P(h,Ve),re.current=!1)},[R,_,P,ne,g,v,h]);let B=o(`div`,e,{state:{orientation:a,tabActivationDirection:O},ref:t,props:u,stateAttributesMapping:or});return(0,$.jsx)(rr.Provider,{value:te,children:(0,$.jsx)(st,{elementsRef:f,children:B})})});function cr(e,t,n,r){if(e==null||t==null)return`none`;let i=null,a=null;for(let[n,o]of r.entries()){if(o==null)continue;let r=o.value??o.index;if(e===r&&(i=n),t===r&&(a=n),i!=null&&a!=null)break}if(i==null||a==null)return i!==a&&(typeof e==`number`||typeof e==`string`)&&typeof e==typeof t?n===`horizontal`?t>e?`right`:`left`:t>e?`down`:`up`:`none`;let o=i.getBoundingClientRect(),s=a.getBoundingClientRect();if(n===`horizontal`){if(s.left<o.left)return`left`;if(s.left>o.left)return`right`}else{if(s.top<o.top)return`up`;if(s.top>o.top)return`down`}return`none`}var lr=`data-composite-item-active`,ur=Q.createContext(void 0);function dr(){let e=Q.useContext(ur);if(e===void 0)throw Error(u(65));return e}var fr=Q.forwardRef(function(e,t){let{className:n,disabled:r=!1,render:i,value:a,id:s,nativeButton:c=!0,style:l,...u}=e,{value:d,getTabPanelIdByValue:f,orientation:p,tabActivationDirection:m}=ir(),{activateOnFocus:h,highlightedTabIndex:g,onTabActivation:_,registerTabResizeObserverElement:y,setHighlightedTabIndex:b,tabsListElement:x}=dr(),S=be(s),{compositeProps:C,compositeRef:w,index:T}=an({metadata:Q.useMemo(()=>({disabled:r,id:S,value:a}),[r,S,a])}),E=a===d,D=Q.useRef(!1),O=Q.useRef(null);J(()=>{let e=O.current;if(e)return y(e)},[y]),J(()=>{if(D.current){D.current=!1;return}if(!(E&&T>-1&&g!==T))return;let e=x;if(e!=null){let t=He(Ce(e));if(t&&v(e,t))return}r||b(T)},[E,T,g,b,r,x]);let{getButtonProps:k,buttonRef:A}=Pe({disabled:r,native:c,focusableWhenDisabled:!0}),j=f(a),M=Q.useRef(!1),N=Q.useRef(!1);function P(e){E||r||_(a,Oe(B,e.nativeEvent,void 0,{activationDirection:`none`}))}function F(e){E||(T>-1&&!r&&b(T),!r&&h&&(!M.current||M.current&&N.current)&&_(a,Oe(B,e.nativeEvent,void 0,{activationDirection:`none`})))}function I(e){if(E||r)return;M.current=!0;function t(){M.current=!1,N.current=!1}(!e.button||e.button===0)&&(N.current=!0,Ce(e.currentTarget).addEventListener(`pointerup`,t,{once:!0}))}return o(`button`,e,{state:{disabled:r,active:E,orientation:p,tabActivationDirection:m},ref:[t,A,w,O],props:[C,{role:`tab`,"aria-controls":j,"aria-selected":E,id:S,onClick:P,onFocus:F,onPointerDown:I,[lr]:E?``:void 0,onKeyDownCapture(){D.current=!0}},u,k],stateAttributesMapping:or})}),pr=V();function mr(){return s}function hr(){return!1}function gr(){return!0}function _r(){return(0,pr.useSyncExternalStore)(mr,hr,gr)}var vr=function(e){return e.activeTabLeft=`--active-tab-left`,e.activeTabRight=`--active-tab-right`,e.activeTabTop=`--active-tab-top`,e.activeTabBottom=`--active-tab-bottom`,e.activeTabWidth=`--active-tab-width`,e.activeTabHeight=`--active-tab-height`,e}({}),yr={...or,activeTabPosition:()=>null,activeTabSize:()=>null},br=Q.forwardRef(function(e,t){let{className:n,render:r,renderBeforeHydration:i=!1,style:a,...s}=e,{nonce:c}=Ae(),{getTabElementBySelectedValue:l,orientation:u,tabActivationDirection:d,value:f}=ir(),{tabsListElement:p,registerIndicatorUpdateListener:m}=dr(),h=_r(),g=Wn();Q.useEffect(()=>m(g),[m,g]);let _=0,v=0,y=0,b=0,x=0,S=0,C=!1;if(f!=null&&p!=null){let e=l(f);if(e!=null){C=!0;let{width:t,height:n}=Gn(e),{width:r,height:i}=Gn(p),a=e.getBoundingClientRect(),o=p.getBoundingClientRect(),s=r>0?o.width/r:1,c=i>0?o.height/i:1;if(Math.abs(s)>2**-52&&Math.abs(c)>2**-52){let e=a.left-o.left,t=a.top-o.top;_=e/s+p.scrollLeft-p.clientLeft,y=t/c+p.scrollTop-p.clientTop}else _=e.offsetLeft,y=e.offsetTop;x=t,S=n,v=p.scrollWidth-_-x,b=p.scrollHeight-y-S}}let w=C?{left:_,right:v,top:y,bottom:b}:null,T=C?{width:x,height:S}:null,E=C?{[vr.activeTabLeft]:`${_}px`,[vr.activeTabRight]:`${v}px`,[vr.activeTabTop]:`${y}px`,[vr.activeTabBottom]:`${b}px`,[vr.activeTabWidth]:`${x}px`,[vr.activeTabHeight]:`${S}px`}:void 0,D=o(`span`,e,{state:{orientation:u,activeTabPosition:w,activeTabSize:T,tabActivationDirection:d},ref:t,props:[{role:`presentation`,style:E,hidden:!(C&&x>0&&S>0)},s,{suppressHydrationWarning:!0}],stateAttributesMapping:yr});return f==null?null:(0,$.jsxs)(Q.Fragment,{children:[D,h&&i&&(0,$.jsx)(`script`,{nonce:c,dangerouslySetInnerHTML:{__html:'!function(){const t=document.currentScript.previousElementSibling;if(!t)return;const e=t.closest(\'[role="tablist"]\');if(!e)return;const i=e.querySelector("[data-active]");if(!i)return;if(0===i.offsetWidth||0===e.offsetWidth)return;let o=0,n=0,h=0,l=0,r=0,f=0;function s(t){const e=getComputedStyle(t);let i=parseFloat(e.width)||0,o=parseFloat(e.height)||0;return(Math.round(i)!==t.offsetWidth||Math.round(o)!==t.offsetHeight)&&(i=t.offsetWidth,o=t.offsetHeight),{width:i,height:o}}if(null!=i&&null!=e){const{width:t,height:c}=s(i),{width:u,height:d}=s(e),a=i.getBoundingClientRect(),g=e.getBoundingClientRect(),p=u>0?g.width/u:1,b=d>0?g.height/d:1;if(Math.abs(p)>Number.EPSILON&&Math.abs(b)>Number.EPSILON){const t=a.left-g.left,i=a.top-g.top;o=t/p+e.scrollLeft-e.clientLeft,h=i/b+e.scrollTop-e.clientTop}else o=i.offsetLeft,h=i.offsetTop;r=t,f=c,n=e.scrollWidth-o-r,l=e.scrollHeight-h-f}function c(e,i){t.style.setProperty(`--active-tab-${e}`,`${i}px`)}c("left",o),c("right",n),c("top",h),c("bottom",l),c("width",r),c("height",f),r>0&&f>0&&t.removeAttribute("hidden")}();'},suppressHydrationWarning:!0})]})}),xr=function(e){return e.index=`data-index`,e.activationDirection=`data-activation-direction`,e.orientation=`data-orientation`,e.hidden=`data-hidden`,e[e.startingStyle=he.startingStyle]=`startingStyle`,e[e.endingStyle=he.endingStyle]=`endingStyle`,e}({}),Sr={...or,...Me},Cr=Q.forwardRef(function(e,t){let{className:n,value:r,render:i,keepMounted:a=!1,style:s,...c}=e,{value:l,getTabIdByPanelValue:u,orientation:d,tabActivationDirection:f,registerMountedTabPanel:p,unregisterMountedTabPanel:m}=ir(),h=be(),{ref:g,index:_}=gt({metadata:Q.useMemo(()=>({id:h,value:r}),[h,r])}),v=r===l,{mounted:y,transitionStatus:b,setMounted:x}=U(v),S=!y,C=u(r),w={hidden:S,orientation:d,tabActivationDirection:f,transitionStatus:b},T=Q.useRef(null),E=o(`div`,e,{state:w,ref:[t,g,T],props:[{"aria-labelledby":C,hidden:S,id:h,role:`tabpanel`,tabIndex:v?0:-1,inert:le(!v),[xr.index]:_},c],stateAttributesMapping:Sr});return L({open:v,ref:T,onComplete(){v||x(!1)}}),J(()=>{if(!(S&&!a)&&h!=null)return p(r,h),()=>{m(r,h)}},[S,a,r,h,p,m]),a||y?E:null}),wr=[];function Tr(e){let{loopFocus:t=!0,orientation:n=`both`,grid:i,onLoop:a,direction:o,highlightedIndex:s,onHighlightedIndexChange:c,rootRef:l,enableHomeAndEndKeys:u=!1,stopEventPropagation:d=!1,disabledIndices:f,modifierKeys:p=wr}=e,[m,h]=Q.useState(0),_=i!=null,v=Q.useRef(null),b=r(v,l),S=Q.useRef([]),C=Q.useRef(!1),w=s??m,T=q((e,t=!1)=>{if((c??h)(e),t){let t=S.current[e];xe(v.current,t,o,n)}}),E=q(e=>{if(e.size===0||C.current)return;C.current=!0;let t=Array.from(e.keys()),r=t.find(e=>e?.hasAttribute(`data-composite-item-active`))??null,i=r?t.indexOf(r):-1;if(i!==-1)T(i);else if(ie(t,w,f)){let e=fe(t,{disabledIndices:f});Ie(t,e)||T(e)}xe(v.current,r,o,n)});J(()=>{if(f==null||s!=null||!C.current)return;let e=S.current;if(ie(e,w,f)){let t=fe(e,{disabledIndices:f});Ie(e,t)||T(t)}},[f,s,w,S,T]);let D=q((e,t,n)=>a?a(e,t,n,S):n),O=q(e=>{let r=u?y:ze;if(!r.has(e.key)||Er(e,p)||!v.current)return;let s=o===`rtl`,c=s?de:Le,l={horizontal:c,vertical:Fe,both:c}[n],m=s?Le:de,h={horizontal:m,vertical:R,both:m}[n],b=se(e.nativeEvent);if(b!=null&&g(b)&&!mt(b)){let t=b.selectionStart,n=b.selectionEnd,r=b.value??``;if(t==null||e.shiftKey||t!==n||e.key!==h&&t<r.length||e.key!==l&&t>0)return}let C=w,E=re(S,f),O=Re(S,f);i!=null&&(C=i({disabledIndices:f,elementsRef:S,event:e,highlightedIndex:w,loopFocus:t,maxIndex:O,minIndex:E,onLoop:D,orientation:n,rtl:s}));let k={horizontal:[c],vertical:[Fe],both:[c,Fe]}[n],A={horizontal:[m],vertical:[R],both:[m,R]}[n],j=_?r:{horizontal:u?x:z,vertical:u?Se:P,both:r}[n];u&&(e.key===`Home`?C=E:e.key===`End`&&(C=O)),C===w&&(k.includes(e.key)||A.includes(e.key))&&(t&&C===O&&k.includes(e.key)?(C=E,a&&(C=a(e,w,C,S))):t&&C===E&&A.includes(e.key)?(C=O,a&&(C=a(e,w,C,S))):C=fe(S.current,{startingIndex:C,decrement:A.includes(e.key),disabledIndices:f})),C!==w&&!Ie(S.current,C)&&(d&&e.stopPropagation(),j.has(e.key)&&e.preventDefault(),T(C,!0),queueMicrotask(()=>{S.current[C]?.focus()}))});return{props:{ref:b,onFocus(e){let t=v.current,n=se(e.nativeEvent);!t||n==null||!g(n)||n.setSelectionRange(0,n.value.length??0)},onKeyDown:O},highlightedIndex:w,onHighlightedIndexChange:T,elementsRef:S,disabledIndices:f,onMapChange:E,relayKeyboardEvent:O}}function Er(e,t){for(let n of b.values())if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function Dr(e){let{render:t,className:r,style:i,refs:a=d,props:s=d,state:c=n,stateAttributesMapping:l,highlightedIndex:u,onHighlightedIndexChange:f,orientation:p,grid:m,loopFocus:h,onLoop:g,enableHomeAndEndKeys:_,onMapChange:v,stopEventPropagation:y=!0,rootRef:b,disabledIndices:x,modifierKeys:S,highlightItemOnHover:C=!1,tag:w=`div`,...T}=e,{props:E,highlightedIndex:D,onHighlightedIndexChange:O,elementsRef:k,onMapChange:A,relayKeyboardEvent:j}=Tr({grid:m,loopFocus:h,onLoop:g,orientation:p,highlightedIndex:u,onHighlightedIndexChange:f,rootRef:b,stopEventPropagation:y,enableHomeAndEndKeys:_,direction:ve(),disabledIndices:x,modifierKeys:S}),M=o(w,e,{state:c,ref:a,props:[E,...s,T],stateAttributesMapping:l}),N=Q.useMemo(()=>({highlightedIndex:D,onHighlightedIndexChange:O,highlightItemOnHover:C,relayKeyboardEvent:j}),[D,O,C,j]);return(0,$.jsx)(me.Provider,{value:N,children:(0,$.jsx)(st,{elementsRef:k,onMapChange:e=>{v?.(e),A(e)},children:M})})}var Or=Q.forwardRef(function(e,t){let{activateOnFocus:n=!1,className:r,loopFocus:i=!0,render:a,style:o,...s}=e,{onValueChange:c,orientation:l,value:u,setTabMap:f,tabActivationDirection:p}=ir(),[m,h]=Q.useState(0),[g,_]=Q.useState(null),v=Q.useRef(new Set),y=Q.useRef(new Set),b=Q.useRef(null);J(()=>{if(typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>{v.current.forEach(e=>{e()})});return b.current=e,g&&e.observe(g),y.current.forEach(t=>{e.observe(t)}),()=>{e.disconnect(),b.current=null}},[g]);let x=q(e=>(v.current.add(e),()=>{v.current.delete(e)})),S=q(e=>(y.current.add(e),b.current?.observe(e),()=>{y.current.delete(e),b.current?.unobserve(e)})),C=q((e,t)=>{e!==u&&c(e,t)}),w={orientation:l,tabActivationDirection:p},T={"aria-orientation":l===`vertical`?`vertical`:void 0,role:`tablist`},E=Q.useMemo(()=>({activateOnFocus:n,highlightedTabIndex:m,registerIndicatorUpdateListener:x,registerTabResizeObserverElement:S,onTabActivation:C,setHighlightedTabIndex:h,tabsListElement:g}),[n,m,x,S,C,h,g]);return(0,$.jsx)(ur.Provider,{value:E,children:(0,$.jsx)(Dr,{render:a,className:r,style:o,state:w,refs:[t,_],props:[T,s],stateAttributesMapping:or,highlightedIndex:m,enableHomeAndEndKeys:!0,loopFocus:i,orientation:l,onHighlightedIndexChange:h,onMapChange:f,disabledIndices:d})})});function kr({className:e,...t}){return(0,$.jsx)(sr,{className:c(`flex flex-col gap-4`,e),"data-slot":`tabs`,...t})}function Ar({className:e,...t}){return(0,$.jsxs)(Or,{className:c(`relative z-0 flex w-fit items-center gap-1 rounded-lg bg-muted p-1`,e),"data-slot":`tabs-list`,...t,children:[t.children,(0,$.jsx)(br,{className:`absolute top-1/2 left-0 z-[-1] h-[calc(100%-0.5rem)] w-(--active-tab-width) -translate-y-1/2 translate-x-(--active-tab-left) rounded-md bg-background shadow-xs transition-all duration-150`,"data-slot":`tabs-indicator`})]})}function jr({className:e,...t}){return(0,$.jsx)(fr,{className:c(`flex h-7 cursor-pointer items-center justify-center whitespace-nowrap rounded-md border border-transparent px-2.5 font-medium text-muted-foreground text-sm outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring data-selected:text-foreground`,e),"data-slot":`tabs-tab`,...t})}function Mr({className:e,...t}){return(0,$.jsx)(Cr,{className:c(`flex-1 outline-none`,e),"data-slot":`tabs-panel`,...t})}var Nr=Q.createContext(void 0);function Pr(e){let t=Q.useContext(Nr);if(t===void 0&&!e)throw Error(u(47));return t}function Fr(){return{...hn(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}var Ir={...Wt,disabled:I(e=>e.disabled),instantType:I(e=>e.instantType),openMethod:I(e=>e.openMethod),openChangeReason:I(e=>e.openChangeReason),modal:I(e=>e.modal),focusManagerModal:I(e=>e.focusManagerModal),stickIfOpen:I(e=>e.stickIfOpen),titleElementId:I(e=>e.titleElementId),descriptionElementId:I(e=>e.descriptionElementId),openOnHover:I(e=>e.openOnHover),closeDelay:I(e=>e.closeDelay),hasViewport:I(e=>e.hasViewport)},Lr=class e extends k{constructor(e,t,n=!1){let r={...Fr(),...e},i=new j;r.open&&e?.mounted===void 0&&(r.mounted=!0),r.floatingRootContext=yn(i,t,n),super(r,{popupRef:Q.createRef(),backdropRef:Q.createRef(),internalBackdropRef:Q.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:Q.createRef(),beforeContentFocusGuardRef:Q.createRef(),stickIfOpenTimeout:new ce,triggerElements:i},Ir)}setOpen=(e,t)=>{let n=t.reason===De,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=F(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};O(n,e,t.trigger,a()),this.update(n)};n?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),Zn.flushSync(s)):s(),r||i?this.set(`instantType`,r?`click`:`dismiss`):t.reason===`focus-out`?this.set(`instantType`,`focus`):this.set(`instantType`,void 0)};static useStore(t,n){let{store:r,internalStore:i}=E(t,(t,r)=>new e(n,t,r));return Q.useEffect(()=>i?.disposeEffect(),[i]),r}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()};function Rr({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,u=Lr.useStore(s?.store,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});te(u,n,r,l),u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`mounted`),p=u.useState(`payload`),m=ue()!=null;u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a),oe(u,d),A(u);let{forceUnmount:h}=Be(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null})});u.useSyncedValues({modal:o,nested:m}),Q.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]);let g=Q.useCallback(()=>{u.setOpen(!1,Oe(ne))},[u]);Q.useImperativeHandle(e.actionsRef,()=>({unmount:h,close:g}),[h,g]);let _=d||f,v=Q.useMemo(()=>({store:u}),[u]);return(0,$.jsxs)(Nr.Provider,{value:v,children:[_&&(0,$.jsx)(Br,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})}function zr(e){return Pr(!0)?(0,$.jsx)(Rr,{props:e}):(0,$.jsx)(ke,{children:(0,$.jsx)(Rr,{props:e})})}function Br({store:e,modal:t}){let r=ge(e.useState(`floatingRootContext`),{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}});return _(e,{activeTriggerProps:r.reference??n,inactiveTriggerProps:r.trigger??n,popupProps:Q.useMemo(()=>l(N,r.floating),[r.floating])}),null}var Vr=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:s=!0,handle:c,payload:l,openOnHover:d=!1,delay:f=300,closeDelay:p=0,id:h,...g}=e,_=Pr(!0),v=c?.store??_?.store;if(!v)throw Error(u(74));let y=be(h),b=v.useState(`isTriggerActive`,y),x=v.useState(`floatingRootContext`),S=v.useState(`isOpenedByTrigger`,y),w=v.useState(`triggerPopupId`,y),T=Q.useRef(null),{registerTrigger:E,isMountedByThisTrigger:D}=ae(y,T,v,{payload:l,disabled:a,openOnHover:d,closeDelay:p}),O=v.useState(`openChangeReason`),k=v.useState(`stickIfOpen`),A=v.useState(`openMethod`),j=v.useState(`focusManagerModal`),M=Zt(x,{enabled:!a&&x!=null&&d&&(A!==`touch`||O!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:Qt(),restMs:f,delay:{close:p},triggerElementRef:T,isActiveTrigger:b,isClosing:()=>v.select(`transitionStatus`)===`ending`}),N=at(x,{enabled:x!=null,stickIfOpen:k}),P=ot(()=>v.select(`open`),e=>{v.set(`openMethod`,e)}),F=v.useState(`triggerProps`,D),{getButtonProps:I,buttonRef:L}=Pe({disabled:a,native:s}),te={open(e){return e&&O===`trigger-press`?ee.open(e):m.open(e)}},{preFocusGuardRef:ne,handlePreFocusGuardFocus:R,handleFocusTargetFocus:re}=ln(v,T),z=o(`button`,e,{state:{disabled:a,open:S},ref:[L,t,E,T],props:[N.reference,M,F,P,{[K]:``,id:y,"aria-haspopup":`dialog`,"aria-expanded":S,"aria-controls":w},g,I],stateAttributesMapping:te});return D&&!j?(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(C,{ref:ne,onFocus:R}),(0,$.jsx)(Q.Fragment,{children:z},y),(0,$.jsx)(C,{ref:v.context.triggerFocusTargetRef,onFocus:re})]}):(0,$.jsx)(Q.Fragment,{children:z},y)}),Hr=Q.createContext(void 0);function Ur(){let e=Q.useContext(Hr);if(e===void 0)throw Error(u(45));return e}var Wr=Q.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=Pr();return i.useState(`mounted`)||n?(0,$.jsx)(Hr.Provider,{value:n,children:(0,$.jsx)(pe,{ref:t,...r})}):null}),Gr=Q.createContext(void 0);function Kr(){let e=Q.useContext(Gr);if(!e)throw Error(u(46));return e}var qr=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,anchor:a,positionMethod:o=`absolute`,side:s=`bottom`,align:c=`center`,sideOffset:l=0,alignOffset:u=0,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f=5,arrowPadding:p=5,sticky:m=!1,disableAnchorTracking:g=!1,collisionAvoidance:_=_e,...v}=e,{store:y}=Pr(),b=Ur(),x=G(),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`),j=y.useState(`transitionStatus`),M=y.useState(`hasViewport`),N=Q.useRef(null),P=h(k,!1,!1),F=ut({anchor:a,floatingRootContext:S,positionMethod:o,mounted:C,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:m,disableAnchorTracking:g,keepMounted:b,nodeId:x,collisionAvoidance:_,adaptiveOrigin:M?ht:void 0}),I=S.useState(`domReferenceElement`);J(()=>{let e=I,t=N.current;if(e&&(N.current=e),t&&e&&e!==t){y.set(`instantType`,void 0);let e=new AbortController;return P(()=>{y.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[I,P,y]),ft(w&&D===!0&&T!==`trigger-hover`,O===`touch`,k,E);let ee=Q.useCallback(e=>{y.set(`positionerElement`,e)},[y]),L=pt(e,{open:w,side:F.side,align:F.align,anchorHidden:F.anchorHidden,instant:A},{styles:F.positionerStyles,transitionStatus:j,props:v,refs:[t,ee],hidden:!C,inert:!w});return(0,$.jsxs)(Gr.Provider,{value:F,children:[C&&D===!0&&T!==`trigger-hover`&&(0,$.jsx)(W,{ref:y.context.internalBackdropRef,inert:le(!w),cutout:E}),(0,$.jsx)(Te,{id:x,children:L})]})}),Jr=Q.createContext(void 0);function Yr(){let[e,t]=Q.useState(0),n=q(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:Q.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}function Xr(e){let{value:t,children:n}=e;return(0,$.jsx)(Jr.Provider,{value:t,children:n})}var Zr={...H,...Me},Qr=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:s,...c}=e,{store:l}=Pr(),u=Kr(),d=lt(!0)!=null,{context:f,hasClosePart:p}=Yr(),m=l.useState(`open`),h=l.useState(`openMethod`),g=l.useState(`instantType`),_=l.useState(`transitionStatus`),v=l.useState(`popupProps`),b=l.useState(`titleElementId`),x=l.useState(`descriptionElementId`),C=l.useState(`modal`),T=l.useState(`mounted`),E=l.useState(`openChangeReason`),D=l.useState(`activeTriggerElement`),O=l.useState(`floatingRootContext`),k=O.useState(`floatingId`),A=l.useState(`disabled`),j=l.useState(`openOnHover`),M=l.useState(`closeDelay`),P=c.id??k;L({open:m,ref:l.context.popupRef,onComplete(){m&&l.context.onOpenChangeComplete?.(!0)}}),Ht(O,{enabled:j&&!A,closeDelay:M});let F=a===void 0?w(l.context.popupRef):a,I=C!==!1&&p;l.useSyncedValue(`focusManagerModal`,I);let ee=Q.useCallback(e=>{l.set(`popupElement`,e)},[l]),te=o(`div`,e,{state:{open:m,side:u.side,align:u.align,instant:g,transitionStatus:_},ref:[t,l.context.popupRef,ee],props:[v,{id:P,role:`dialog`,...N,"aria-labelledby":b,"aria-describedby":x,onKeyDown(e){d&&y.has(e.key)&&e.stopPropagation()}},ct(_),c],stateAttributesMapping:Zr});return(0,$.jsx)(Ne,{context:O,openInteractionType:h,modal:I,disabled:!T||E===`trigger-hover`,initialFocus:F,returnFocus:s,restoreFocus:`popup`,previousFocusableElement:S(D)?D:void 0,nextFocusableElement:l.context.triggerFocusTargetRef,beforeContentFocusGuardRef:l.context.beforeContentFocusGuardRef,children:(0,$.jsx)(Xr,{value:f,children:te})})}),$r=function(e){return e.popupWidth=`--popup-width`,e.popupHeight=`--popup-height`,e}({}),ei={activationDirection:e=>e?{"data-activation-direction":e}:null},ti=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...s}=e,{store:c}=Pr(),{side:l}=Kr(),u=c.useState(`instantType`),{children:d,state:f}=Qn({store:c,side:l,cssVars:$r,children:a});return o(`div`,e,{state:{activationDirection:f.activationDirection,transitioning:f.transitioning,instant:u},ref:t,props:[s,{children:d}],stateAttributesMapping:ei})}),ni=zr;function ri({className:e,children:t,...n}){return(0,$.jsx)(Vr,{className:e,"data-slot":`popover-trigger`,...n,children:t})}function ii({children:e,className:t,viewportClassName:n,side:r=`bottom`,align:i=`center`,sideOffset:a=4,alignOffset:o=0,tooltipStyle:s=!1,anchor:l,...u}){return(0,$.jsx)(Wr,{children:(0,$.jsx)(qr,{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)(Qr,{className:c(`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%)]`,s&&`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)(ti,{className:c(`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`,s?`py-1 [--viewport-inline-padding:--spacing(2)]`:`not-data-transitioning:overflow-y-auto`,n),"data-slot":`popover-viewport`,children:e})})})})}function ai({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)(ni,{open:r,onOpenChange:e=>{e&&o(``),i(e)},children:[(0,$.jsx)(ri,{render:(0,$.jsxs)(f,{variant:`outline`,size:`sm`,disabled:t,className:`h-8 text-xs text-muted-foreground`,children:[(0,$.jsx)(Bt,{size:14}),` Add repository`]})}),(0,$.jsxs)(ii,{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)(wt,{className:`absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-muted-foreground`}),(0,$.jsx)(Ee,{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 oi=(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}`;default:return`agy --conversation ${t}`}},si=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)(vn,{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)(It,{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)(tn,{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)(_n,{className:`size-2.5`})});default:return null}},ci=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`})}`},li=({ws:e,sessions:t,sessionsLoading:n,setActiveSession:r,setTranscript:i,fetchSessionTranscript:a,handleOpenDesktopSession:o,showToast:s})=>{let l=fn(),u=Lt(),d=kt(),p=d.data?.find(e=>e.name===`antigravity`)?.detected??!0,m=d.data?.find(e=>e.name===`claude`)?.detected??!1,h=d.data?.find(e=>e.name===`codex`)?.detected??!1,g=d.data?.find(e=>e.name===`copilot`)?.detected??!1,_=!!l.data?.some(e=>e.id===`antigravity`&&e.available),v=!!l.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}),ee=e=>{I(t=>({...t,[e]:!t[e]}))},L=(0,Q.useRef)(!1),te=(0,Q.useRef)(null),ne=async t=>{try{await Gt(`/api/workspace/${encodeURIComponent(e.branchName)}/launch`,{method:`POST`,body:JSON.stringify({targetId:t})}),s?.(`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`;s?.(t,`error`)}},R=async t=>{if(!C){w(t);try{await u.mutateAsync({workspaceId:e.branchName,assistant:t}),E({assistant:t,cmd:t===`antigravity`?`agy`:t===`claude`?`claude`:t===`codex`?`codex`:`copilot`,timestamp:new Date}),s?.(`Started new ${t} session in terminal`,`success`)}catch(e){let t=e instanceof Error?e.message:`Failed to launch terminal`;s?.(t,`error`)}finally{w(null)}}},re=async(t,n)=>{if(!L.current){L.current=!0,S(t);try{await u.mutateAsync({workspaceId:e.branchName,sessionId:t,assistant:n});let r=oi(n,t);E({assistant:n,cmd:r,timestamp:new Date}),s?.(`Resumed ${n} session in terminal`,`success`)}catch{let e=oi(n,t);await pn(e),s?.(`Copied resume command to clipboard: ${e}`,`info`)}finally{S(null),L.current=!1}}},z=async t=>{if(!(!v||te.current)){te.current=t,b(t);try{await o(e,t,`codex`)}finally{te.current=null,b(null)}}},ie=(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}}),ae=(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 ie(e,D)},[t,N,j,D]),B=(0,Q.useMemo)(()=>ie(t.filter(e=>e.assistant===`antigravity`),D),[t,D]),oe=(0,Q.useMemo)(()=>ie(t.filter(e=>e.assistant===`claude`),D),[t,D]),se=(0,Q.useMemo)(()=>ie(t.filter(e=>e.assistant===`codex`),D),[t,D]),ce=(0,Q.useMemo)(()=>ie(t.filter(e=>e.assistant===`copilot`),D),[t,D]),V=t=>e.assistants?.includes(t)??!1,H=[{id:`antigravity`,name:`Google Antigravity`,cliCommand:`agy`,isDetected:p,isConfigured:V(`antigravity`),hasApp:_,appName:`IDE`,appTargetId:`antigravity`,sessions:B,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)(vn,{className:`size-4`})})},{id:`claude`,name:`Claude Code`,cliCommand:`claude`,isDetected:m,isConfigured:V(`claude`),hasApp:!1,appName:`App`,appTargetId:`claude`,sessions:oe,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)(It,{className:`size-3`})})},{id:`codex`,name:`OpenAI Codex`,cliCommand:`codex`,isDetected:h,isConfigured:V(`codex`),hasApp:v,appName:`Desktop`,appTargetId:`codex-desktop`,sessions:se,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)(tn,{className:`size-3`})})},{id:`copilot`,name:`GitHub Copilot`,cliCommand:`copilot`,isDetected:g,isConfigured:V(`copilot`),hasApp:!1,appName:`App`,appTargetId:`copilot`,sessions:ce,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)(_n,{className:`size-3`})})}];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)(wt,{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:c(`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,`)`]}),[`antigravity`,`claude`,`codex`,`copilot`].map(e=>{let n=t.filter(t=>t.assistant===e).length;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>P(N===e?`all`:e),className:c(`px-2 py-0.5 text-[11px] rounded font-medium capitalize transition-colors cursor-pointer`,N===e?`bg-primary text-primary-foreground font-semibold shadow-2xs`:`bg-muted/60 text-muted-foreground hover:text-foreground hover:bg-muted`),children:[e,` (`,n,`)`]},e)})]}),n&&(0,$.jsx)(`span`,{className:`flex items-center gap-1 text-xs text-muted-foreground shrink-0 pl-1`,children:(0,$.jsx)(X,{className:`size-3`})})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,$.jsxs)(rn,{children:[(0,$.jsxs)(Xt,{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)(yt,{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)(We,{size:10,className:`text-muted-foreground opacity-70`})]}),(0,$.jsxs)(qt,{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)(Z,{onClick:()=>O(`created-desc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Newest created`}),D===`created-desc`&&(0,$.jsx)(Y,{size:12,className:`text-primary`})]}),(0,$.jsxs)(Z,{onClick:()=>O(`created-asc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Oldest created`}),D===`created-asc`&&(0,$.jsx)(Y,{size:12,className:`text-primary`})]}),(0,$.jsxs)(Z,{onClick:()=>O(`updated-desc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Recently active`}),D===`updated-desc`&&(0,$.jsx)(Y,{size:12,className:`text-primary`})]}),(0,$.jsxs)(Z,{onClick:()=>O(`messages-desc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Most turns`}),D===`messages-desc`&&(0,$.jsx)(Y,{size:12,className:`text-primary`})]}),(0,$.jsxs)(Z,{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)(Y,{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:c(`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:c(`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 pn(T.cmd),s?.(`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)(Tt,{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)(Sn,{className:`divide-y divide-border overflow-hidden surface-card`,children:ae.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.`}):ae.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:[si(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:ci(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)(f,{size:`xs`,variant:`default`,disabled:x===e.id,onClick:()=>void re(e.id,e.assistant),title:`Resume session in terminal (${e.id})`,children:[x===e.id?(0,$.jsx)(X,{className:`size-3`}):(0,$.jsx)(bn,{size:12}),(0,$.jsx)(`span`,{children:`Resume`})]}),(0,$.jsxs)(f,{size:`xs`,variant:`outline`,onClick:()=>{r(e),i([]),a(e.assistant,e.id)},title:`Inspect transcript log`,children:[(0,$.jsx)(In,{size:12}),(0,$.jsx)(`span`,{children:`Logs`})]}),e.assistant===`codex`&&v&&(0,$.jsxs)(f,{size:`xs`,variant:`outline`,disabled:y===e.id,onClick:()=>void z(e.id),title:`Open in Codex Desktop`,children:[y===e.id?(0,$.jsx)(X,{className:`size-3`}):(0,$.jsx)(un,{size:12}),(0,$.jsx)(`span`,{children:`Desktop`})]}),(0,$.jsx)(f,{size:`icon-xs`,variant:`ghost`,onClick:async()=>{let t=oi(e.assistant,e.id);await pn(t),s?.(`Copied: ${t}`,`success`)},title:`Copy CLI resume command`,children:(0,$.jsx)(Tt,{size:12})})]})]},e.id))}):(0,$.jsx)(`div`,{className:`space-y-2.5`,children:H.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)(Sn,{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:()=>ee(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)(We,{size:14}):(0,$.jsx)(et,{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)($t,{tone:e.isDetected?`success`:`neutral`,dot:e.isDetected,children:[`CLI: `,e.cliCommand]}),e.hasApp&&(0,$.jsx)($t,{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)(f,{size:`xs`,variant:`default`,disabled:C===e.id,onClick:()=>void R(e.id),title:`Launch new ${e.cliCommand} session in terminal`,children:[C===e.id?(0,$.jsx)(X,{className:`size-3`}):(0,$.jsx)(Bt,{size:12}),(0,$.jsx)(`span`,{children:`New Session`})]}),e.hasApp&&(0,$.jsxs)(f,{size:`xs`,variant:`outline`,onClick:()=>void ne(e.appTargetId),title:`Open in ${e.appName}`,children:[(0,$.jsx)(un,{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 R(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:ci(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)(f,{size:`xs`,variant:`default`,disabled:x===e.id,onClick:()=>void re(e.id,e.assistant),title:`Resume session in terminal (${e.id})`,children:[x===e.id?(0,$.jsx)(X,{className:`size-3`}):(0,$.jsx)(bn,{size:12}),(0,$.jsx)(`span`,{children:`Resume`})]}),(0,$.jsxs)(f,{size:`xs`,variant:`outline`,onClick:()=>{r(e),i([]),a(e.assistant,e.id)},title:`Inspect transcript log`,children:[(0,$.jsx)(In,{size:12}),(0,$.jsx)(`span`,{children:`Logs`})]}),e.assistant===`codex`&&v&&(0,$.jsxs)(f,{size:`xs`,variant:`outline`,disabled:y===e.id,onClick:()=>void z(e.id),title:`Open in Codex Desktop`,children:[y===e.id?(0,$.jsx)(X,{className:`size-3`}):(0,$.jsx)(un,{size:12}),(0,$.jsx)(`span`,{children:`Desktop`})]}),(0,$.jsx)(f,{size:`icon-xs`,variant:`ghost`,onClick:async()=>{let t=oi(e.assistant,e.id);await pn(t),s?.(`Copied: ${t}`,`success`)},title:`Copy CLI resume command`,children:(0,$.jsx)(Tt,{size:12})})]})]},e.id))})]},e.id)})})]})};function ui(e){return e===`review`||e===`workspace-write`}var di=e=>`nexusflow_chat_${e}`,fi=()=>({v:4,sessions:{},providerId:null,profilesByProvider:{"claude-cli":`review`,"codex-cli":`review`},modelsByProvider:{},messages:[]});function pi(e){try{let t=localStorage.getItem(di(e));if(!t)return fi();let n=JSON.parse(t);if(Array.isArray(n))return{...fi(),messages:n.filter(e=>e&&typeof e.content==`string`&&(e.role===`user`||e.role===`assistant`)).map(e=>({role:e.role,content:e.content}))};if(n&&n.v===4&&n.sessions&&Array.isArray(n.messages)){let e=Object.fromEntries(Object.entries(n.profilesByProvider??{}).filter(e=>ui(e[1]))),t=typeof n.modelsByProvider==`object`&&n.modelsByProvider!==null?Object.fromEntries(Object.entries(n.modelsByProvider).filter(e=>typeof e[0]==`string`&&typeof e[1]==`string`)):{};return{...fi(),sessions:n.sessions,providerId:typeof n.providerId==`string`?n.providerId:null,profilesByProvider:{...fi().profilesByProvider,...e},modelsByProvider:t,messages:n.messages}}if(n&&n.v===3&&n.sessions&&Array.isArray(n.messages))return{...fi(),sessions:n.sessions,providerId:typeof n.providerId==`string`?n.providerId:null,messages:n.messages};if(n&&n.v===2&&Array.isArray(n.messages)){let e={};return typeof n.sessionId==`string`&&n.sessionId&&(e[`claude-cli`]={id:n.sessionId,started:!!n.sessionStarted}),{v:4,sessions:e,providerId:typeof n.providerId==`string`?n.providerId:null,profilesByProvider:fi().profilesByProvider,messages:n.messages}}return fi()}catch{return fi()}}var mi=500;function hi(e,t){try{let n=t.messages.length>mi?{...t,messages:t.messages.slice(-500)}:t;localStorage.setItem(di(e),JSON.stringify(n))}catch(e){console.error(`Failed to save chat to localStorage`,e)}}function gi(e){try{localStorage.removeItem(di(e))}catch{}}var _i=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,vi=new Set([`claude-cli`,`codex-cli`,`antigravity-cli`,`copilot-cli`]);function yi(e){return e===`claude`?`claude-cli`:e===`codex`?`codex-cli`:e===`antigravity`?`antigravity-cli`:e===`copilot`?`copilot-cli`:null}function bi(e){if(!e||typeof e!=`object`)return null;let t=e.chatLaunch;if(!t||typeof t!=`object`)return null;let n=t;return!_i.test(n.nonce??``)||!n.providerId||!vi.has(n.providerId)||!ui(n.executionProfile)||n.kickoff!==void 0&&(typeof n.kickoff!=`string`||n.kickoff.length>2e3)||n.model!==void 0&&(typeof n.model!=`string`||n.model.length>100)||n.assistant!==void 0&&yi(n.assistant)!==n.providerId||n.sessionId!==void 0&&(!_i.test(n.sessionId)||!n.assistant)?null:n}function xi({className:e,...t}){return(0,$.jsx)(`div`,{className:c(`animate-skeleton rounded-sm [--skeleton-highlight:--alpha(var(--color-white)/64%)] [background:linear-gradient(120deg,transparent_40%,var(--skeleton-highlight),transparent_60%)_var(--color-muted)_0_0/200%_100%_fixed] dark:[--skeleton-highlight:--alpha(var(--color-white)/4%)]`,e),"data-slot":`skeleton`,...t})}function Si({open:e,onClose:t,ws:n,onPick:r,error:i,pending:a=!1}){let[o,s]=(0,Q.useState)([]),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{e&&(l(!0),d(null),fetch(`/api/workspace/${encodeURIComponent(n.branchName)}/sessions`).then(e=>e.json()).then(e=>{let t=(e.sessions||[]).filter(e=>e.assistant===`claude`||e.assistant===`codex`||e.assistant===`antigravity`||e.assistant===`copilot`);s(t)}).catch(()=>d(`Failed to load sessions.`)).finally(()=>l(!1)))},[e,n.branchName]);let f=e=>{switch(e){case`codex`:return`Codex`;case`antigravity`:return`Antigravity`;case`copilot`:return`Copilot`;default:return`Claude`}};return(0,$.jsx)(sn,{open:e,onOpenChange:e=>!e&&t(),children:(0,$.jsxs)(Kt,{className:`max-w-lg`,children:[(0,$.jsx)(nn,{children:(0,$.jsx)(Yt,{children:`Resume a past session`})}),(0,$.jsxs)(mn,{className:`flex max-h-[60vh] flex-col gap-2`,children:[(i||u)&&(0,$.jsx)(`div`,{className:`rounded-lg border border-destructive/25 bg-destructive/10 px-3 py-2 text-xs text-destructive-foreground`,children:i||u}),c?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(xi,{className:`h-14`}),(0,$.jsx)(xi,{className:`h-14`}),(0,$.jsx)(xi,{className:`h-14`})]}):o.length===0?(0,$.jsx)(Dn,{children:(0,$.jsxs)(En,{children:[(0,$.jsx)(wn,{variant:`icon`,children:(0,$.jsx)(Nn,{})}),(0,$.jsx)(Cn,{children:`No resumable sessions found`}),(0,$.jsx)(Tn,{children:`Past conversations for this workspace will show up here.`})]})}):o.map(e=>(0,$.jsxs)(`button`,{onClick:()=>r(e),disabled:a,className:`cursor-pointer rounded-lg border border-border bg-card p-3 text-left transition-colors hover:border-foreground/15 hover:bg-accent/50 disabled:cursor-wait disabled:opacity-60`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase text-muted-foreground`,children:f(e.assistant)}),(0,$.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,title:e.title,children:e.title})]}),(0,$.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-[11px] text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:a?`Loading transcript…`:new Date(e.updatedAt).toLocaleString()}),(0,$.jsx)(`span`,{children:`·`}),(0,$.jsx)(In,{size:11}),(0,$.jsxs)(`span`,{children:[e.messageCount,` messages`]})]})]},e.id))]})]})})}var Ci=p(((e,t)=>{var n=[[{color:`0, 0, 0`,class:`ansi-black`},{color:`187, 0, 0`,class:`ansi-red`},{color:`0, 187, 0`,class:`ansi-green`},{color:`187, 187, 0`,class:`ansi-yellow`},{color:`0, 0, 187`,class:`ansi-blue`},{color:`187, 0, 187`,class:`ansi-magenta`},{color:`0, 187, 187`,class:`ansi-cyan`},{color:`255,255,255`,class:`ansi-white`}],[{color:`85, 85, 85`,class:`ansi-bright-black`},{color:`255, 85, 85`,class:`ansi-bright-red`},{color:`0, 255, 0`,class:`ansi-bright-green`},{color:`255, 255, 85`,class:`ansi-bright-yellow`},{color:`85, 85, 255`,class:`ansi-bright-blue`},{color:`255, 85, 255`,class:`ansi-bright-magenta`},{color:`85, 255, 255`,class:`ansi-bright-cyan`},{color:`255, 255, 255`,class:`ansi-bright-white`}]],r=/(https?:\/\/(?:[A-Za-z0-9#;/?:@=+$',_.!~*()[\]-]|&amp;|%[A-Fa-f0-9]{2})+)/gm;t.exports=class e{static escapeForHtml(t){return new e().escapeForHtml(t)}static linkify(t){return new e().linkify(t)}static ansiToHtml(t,n){return new e().ansiToHtml(t,n)}static ansiToJson(t,n){return new e().ansiToJson(t,n)}static ansiToText(t){return new e().ansiToText(t)}constructor(){this.fg=this.bg=this.fg_truecolor=this.bg_truecolor=null,this.bright=0,this.decorations=[]}setupPalette(){this.PALETTE_COLORS=[];for(let e=0;e<2;++e)for(let t=0;t<8;++t)this.PALETTE_COLORS.push(n[e][t].color);let e=[0,95,135,175,215,255],t=(t,n,r)=>e[t]+`, `+e[n]+`, `+e[r];for(let e=0;e<6;++e)for(let n=0;n<6;++n)for(let r=0;r<6;++r)this.PALETTE_COLORS.push(t(e,n,r));let r=8;for(let e=0;e<24;++e,r+=10)this.PALETTE_COLORS.push(r+`, `+r+`, `+r)}escapeForHtml(e){return e.replace(/[&<>\"]/gm,e=>e==`&`?`&amp;`:e==`"`?`&quot;`:e==`<`?`&lt;`:e==`>`?`&gt;`:``)}linkify(e){return e.replace(r,e=>`<a href="${e}">${e}</a>`)}ansiToHtml(e,t){return this.process(e,t,!0)}ansiToJson(e,t){return t||={},t.json=!0,t.clearLine=!1,this.process(e,t,!0)}ansiToText(e){return this.process(e,{},!1)}process(e,t,n){let r=this,i=e.split(/\033\[/),a=i.shift();t??={},t.clearLine=/\r/.test(e);let o=i.map(e=>this.processChunk(e,t,n));if(t&&t.json){let e=r.processChunkJson(``);return e.content=a,e.clearLine=t.clearLine,o.unshift(e),t.remove_empty&&(o=o.filter(e=>!e.isEmpty())),o}else o.unshift(a);return o.join(``)}processChunkJson(e,t,r){t=t===void 0?{}:t;let i=t.use_classes=t.use_classes!==void 0&&t.use_classes,a=t.key=i?`class`:`color`,o={content:e,fg:null,bg:null,fg_truecolor:null,bg_truecolor:null,isInverted:!1,clearLine:t.clearLine,decoration:null,decorations:[],was_processed:!1,isEmpty:()=>!o.content},s=e.match(/^([!\x3c-\x3f]*)([\d;]*)([\x20-\x2c]*[\x40-\x7e])([\s\S]*)/m);if(!s)return o;o.content=s[4];let c=s[2].split(`;`);if(s[1]!==``||s[3]!==`m`||!r)return o;let l=this;for(;c.length>0;){let e=c.shift(),t=parseInt(e);if(isNaN(t)||t===0)l.fg=l.bg=null,l.decorations=[];else if(t===1)l.decorations.push(`bold`);else if(t===2)l.decorations.push(`dim`);else if(t===3)l.decorations.push(`italic`);else if(t===4)l.decorations.push(`underline`);else if(t===5)l.decorations.push(`blink`);else if(t===7)l.decorations.push(`reverse`);else if(t===8)l.decorations.push(`hidden`);else if(t===9)l.decorations.push(`strikethrough`);else if(t===21)l.removeDecoration(`bold`);else if(t===22)l.removeDecoration(`bold`),l.removeDecoration(`dim`);else if(t===23)l.removeDecoration(`italic`);else if(t===24)l.removeDecoration(`underline`);else if(t===25)l.removeDecoration(`blink`);else if(t===27)l.removeDecoration(`reverse`);else if(t===28)l.removeDecoration(`hidden`);else if(t===29)l.removeDecoration(`strikethrough`);else if(t===39)l.fg=null;else if(t===49)l.bg=null;else if(t>=30&&t<38)l.fg=n[0][t%10][a];else if(t>=90&&t<98)l.fg=n[1][t%10][a];else if(t>=40&&t<48)l.bg=n[0][t%10][a];else if(t>=100&&t<108)l.bg=n[1][t%10][a];else if(t===38||t===48){let e=t===38;if(c.length>=1){let t=c.shift();if(t===`5`&&c.length>=1){let t=parseInt(c.shift());if(t>=0&&t<=255)if(!i)this.PALETTE_COLORS||l.setupPalette(),e?l.fg=this.PALETTE_COLORS[t]:l.bg=this.PALETTE_COLORS[t];else{let r=t>=16?`ansi-palette-`+t:n[+(t>7)][t%8].class;e?l.fg=r:l.bg=r}}else if(t===`2`&&c.length>=3){let t=parseInt(c.shift()),n=parseInt(c.shift()),r=parseInt(c.shift());if(t>=0&&t<=255&&n>=0&&n<=255&&r>=0&&r<=255){let a=t+`, `+n+`, `+r;i?e?(l.fg=`ansi-truecolor`,l.fg_truecolor=a):(l.bg=`ansi-truecolor`,l.bg_truecolor=a):e?l.fg=a:l.bg=a}}}}}return l.fg===null&&l.bg===null&&l.decorations.length===0?o:(o.fg=l.fg,o.bg=l.bg,o.fg_truecolor=l.fg_truecolor,o.bg_truecolor=l.bg_truecolor,o.decorations=l.decorations,o.decoration=l.decorations.slice(-1).pop()||null,o.was_processed=!0,o)}processChunk(e,t,r){t||={};let i=this.processChunkJson(e,t,r),a=t.use_classes;if(i.decorations=i.decorations.filter(e=>{if(e===`reverse`){i.fg||=n[0][7][a?`class`:`color`],i.bg||=n[0][0][a?`class`:`color`];let e=i.fg;i.fg=i.bg,i.bg=e;let t=i.fg_truecolor;return i.fg_truecolor=i.bg_truecolor,i.bg_truecolor=t,i.isInverted=!0,!1}return!0}),t.json)return i;if(i.isEmpty())return``;if(!i.was_processed)return i.content;let o=[],s=[],c=[],l={},u=e=>{let t=[],n;for(n in e)e.hasOwnProperty(n)&&t.push(`data-`+n+`="`+this.escapeForHtml(e[n])+`"`);return t.length>0?` `+t.join(` `):``};return i.isInverted&&(l[`ansi-is-inverted`]=`true`),i.fg&&(a?(o.push(i.fg+`-fg`),i.fg_truecolor!==null&&(l[`ansi-truecolor-fg`]=i.fg_truecolor,i.fg_truecolor=null)):o.push(`color:rgb(`+i.fg+`)`)),i.bg&&(a?(o.push(i.bg+`-bg`),i.bg_truecolor!==null&&(l[`ansi-truecolor-bg`]=i.bg_truecolor,i.bg_truecolor=null)):o.push(`background-color:rgb(`+i.bg+`)`)),i.decorations.forEach(e=>{if(a){s.push(`ansi-`+e);return}e===`bold`?s.push(`font-weight:bold`):e===`dim`?s.push(`opacity:0.5`):e===`italic`?s.push(`font-style:italic`):e===`hidden`?s.push(`visibility:hidden`):e===`strikethrough`?c.push(`line-through`):c.push(e)}),c.length&&s.push(`text-decoration:`+c.join(` `)),a?`<span class="`+o.concat(s).join(` `)+`"`+u(l)+`>`+i.content+`</span>`:`<span style="`+o.concat(s).join(`;`)+`"`+u(l)+`>`+i.content+`</span>`}removeDecoration(e){let t=this.decorations.indexOf(e);t>=0&&this.decorations.splice(t,1)}}})),wi=p(((e,t)=>{function n(e){if(!e)return``;if(!/\r/.test(e))return e;for(e=e.replace(/\r+\n/gm,`
2
+ `);/\r./.test(e);)e=e.replace(/^([^\r\n]*)\r+([^\r\n]+)/gm,function(e,t,n){return n+t.slice(n.length)});return e}function r(e){for(var t=0,n=0;n<e.length;n++)e[t].length<=e[n].length&&(t=n);return t}function i(e){if(!/\r/.test(e))return e;for(var t=e.split(`\r`),n=[];t.length>0;){var i=r(t);n.push(t[i]),t=t.slice(i+1)}return n.join(`\r`)}function a(e){if(!e)return``;if(!/\r/.test(e))return e;if(!/\n/.test(e))return i(e);e=e.replace(/\r+\n/gm,`
3
+ `);var t=e.lastIndexOf(`
4
+ `);return n(e.slice(0,t))+`
5
+ `+i(e.slice(t+1))}t.exports=n,t.exports.escapeCarriageReturn=n,t.exports.escapeCarriageReturnSafe=a})),Ti=p(((e,t)=>{t.exports=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/})),Ei=p(((e,t)=>{t.exports=/[\0-\x1F\x7F-\x9F]/})),Di=p(((e,t)=>{t.exports=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/})),Oi=p(((e,t)=>{t.exports=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4E\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDF55-\uDF59]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDF3C-\uDF3E]|\uD806[\uDC3B\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/})),ki=p(((e,t)=>{t.exports=function(e){var t={};t.src_Any=Ti().source,t.src_Cc=Ei().source,t.src_Z=Di().source,t.src_P=Oi().source,t.src_ZPCc=[t.src_Z,t.src_P,t.src_Cc].join(`|`),t.src_ZCc=[t.src_Z,t.src_Cc].join(`|`);var n=`[><|]`;return t.src_pseudo_letter=`(?:(?!`+n+`|`+t.src_ZPCc+`)`+t.src_Any+`)`,t.src_ip4=`(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)`,t.src_auth=`(?:(?:(?!`+t.src_ZCc+`|[@/\\[\\]()]).)+@)?`,t.src_port=`(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?`,t.src_host_terminator=`(?=$|`+n+`|`+t.src_ZPCc+`)(?!-|_|:\\d|\\.-|\\.(?!$|`+t.src_ZPCc+`))`,t.src_path=`(?:[/?#](?:(?!`+t.src_ZCc+`|`+n+`|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!`+t.src_ZCc+`|\\]).)*\\]|\\((?:(?!`+t.src_ZCc+`|[)]).)*\\)|\\{(?:(?!`+t.src_ZCc+`|[}]).)*\\}|\\"(?:(?!`+t.src_ZCc+`|["]).)+\\"|\\'(?:(?!`+t.src_ZCc+`|[']).)+\\'|\\'(?=`+t.src_pseudo_letter+`|[-]).|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!`+t.src_ZCc+`|[.]).|`+(e&&e[`---`]?`\\-(?!--(?:[^-]|$))(?:-*)|`:`\\-+|`)+`,(?!`+t.src_ZCc+`).|;(?!`+t.src_ZCc+`).|\\!+(?!`+t.src_ZCc+`|[!]).|\\?(?!`+t.src_ZCc+`|[?]).)+|\\/)?`,t.src_email_name=`[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*`,t.src_xn=`xn--[a-z0-9\\-]{1,59}`,t.src_domain_root=`(?:`+t.src_xn+`|`+t.src_pseudo_letter+`{1,63})`,t.src_domain=`(?:`+t.src_xn+`|(?:`+t.src_pseudo_letter+`)|(?:`+t.src_pseudo_letter+`(?:-|`+t.src_pseudo_letter+`){0,61}`+t.src_pseudo_letter+`))`,t.src_host=`(?:(?:(?:(?:`+t.src_domain+`)\\.)*`+t.src_domain+`))`,t.tpl_host_fuzzy=`(?:`+t.src_ip4+`|(?:(?:(?:`+t.src_domain+`)\\.)+(?:%TLDS%)))`,t.tpl_host_no_ip_fuzzy=`(?:(?:(?:`+t.src_domain+`)\\.)+(?:%TLDS%))`,t.src_host_strict=t.src_host+t.src_host_terminator,t.tpl_host_fuzzy_strict=t.tpl_host_fuzzy+t.src_host_terminator,t.src_host_port_strict=t.src_host+t.src_port+t.src_host_terminator,t.tpl_host_port_fuzzy_strict=t.tpl_host_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_port_no_ip_fuzzy_strict=t.tpl_host_no_ip_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_fuzzy_test=`localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:`+t.src_ZPCc+`|>|$))`,t.tpl_email_fuzzy=`(^|`+n+`|"|\\(|`+t.src_ZCc+`)(`+t.src_email_name+`@`+t.tpl_host_fuzzy_strict+`)`,t.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_fuzzy_strict+t.src_path+`)`,t.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_no_ip_fuzzy_strict+t.src_path+`)`,t}})),Ai=p(((e,t)=>{function n(e){return Array.prototype.slice.call(arguments,1).forEach(function(t){t&&Object.keys(t).forEach(function(n){e[n]=t[n]})}),e}function r(e){return Object.prototype.toString.call(e)}function i(e){return r(e)===`[object String]`}function a(e){return r(e)===`[object Object]`}function o(e){return r(e)===`[object RegExp]`}function s(e){return r(e)===`[object Function]`}function c(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,`\\$&`)}var l={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function u(e){return Object.keys(e||{}).reduce(function(e,t){return e||l.hasOwnProperty(t)},!1)}var d={"http:":{validate:function(e,t,n){var r=e.slice(t);return n.re.http||(n.re.http=RegExp(`^\\/\\/`+n.re.src_auth+n.re.src_host_port_strict+n.re.src_path,`i`)),n.re.http.test(r)?r.match(n.re.http)[0].length:0}},"https:":`http:`,"ftp:":`http:`,"//":{validate:function(e,t,n){var r=e.slice(t);return n.re.no_http||(n.re.no_http=RegExp(`^`+n.re.src_auth+`(?:localhost|(?:(?:`+n.re.src_domain+`)\\.)+`+n.re.src_domain_root+`)`+n.re.src_port+n.re.src_host_terminator+n.re.src_path,`i`)),n.re.no_http.test(r)?t>=3&&e[t-3]===`:`||t>=3&&e[t-3]===`/`?0:r.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(e,t,n){var r=e.slice(t);return n.re.mailto||(n.re.mailto=RegExp(`^`+n.re.src_email_name+`@`+n.re.src_host_strict,`i`)),n.re.mailto.test(r)?r.match(n.re.mailto)[0].length:0}}},f=`a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]`,p=`biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф`.split(`|`);function m(e){e.__index__=-1,e.__text_cache__=``}function h(e){return function(t,n){var r=t.slice(n);return e.test(r)?r.match(e)[0].length:0}}function g(){return function(e,t){t.normalize(e)}}function _(e){var t=e.re=ki()(e.__opts__),n=e.__tlds__.slice();e.onCompile(),e.__tlds_replaced__||n.push(f),n.push(t.src_xn),t.src_tlds=n.join(`|`);function r(e){return e.replace(`%TLDS%`,t.src_tlds)}t.email_fuzzy=RegExp(r(t.tpl_email_fuzzy),`i`),t.link_fuzzy=RegExp(r(t.tpl_link_fuzzy),`i`),t.link_no_ip_fuzzy=RegExp(r(t.tpl_link_no_ip_fuzzy),`i`),t.host_fuzzy_test=RegExp(r(t.tpl_host_fuzzy_test),`i`);var l=[];e.__compiled__={};function u(e,t){throw Error(`(LinkifyIt) Invalid schema "`+e+`": `+t)}Object.keys(e.__schemas__).forEach(function(t){var n=e.__schemas__[t];if(n!==null){var r={validate:null,link:null};if(e.__compiled__[t]=r,a(n)){o(n.validate)?r.validate=h(n.validate):s(n.validate)?r.validate=n.validate:u(t,n),s(n.normalize)?r.normalize=n.normalize:n.normalize?u(t,n):r.normalize=g();return}if(i(n)){l.push(t);return}u(t,n)}}),l.forEach(function(t){e.__compiled__[e.__schemas__[t]]&&(e.__compiled__[t].validate=e.__compiled__[e.__schemas__[t]].validate,e.__compiled__[t].normalize=e.__compiled__[e.__schemas__[t]].normalize)}),e.__compiled__[``]={validate:null,normalize:g()};var d=Object.keys(e.__compiled__).filter(function(t){return t.length>0&&e.__compiled__[t]}).map(c).join(`|`);e.re.schema_test=RegExp(`(^|(?!_)(?:[><|]|`+t.src_ZPCc+`))(`+d+`)`,`i`),e.re.schema_search=RegExp(`(^|(?!_)(?:[><|]|`+t.src_ZPCc+`))(`+d+`)`,`ig`),e.re.pretest=RegExp(`(`+e.re.schema_test.source+`)|(`+e.re.host_fuzzy_test.source+`)|@`,`i`),m(e)}function v(e,t){var n=e.__index__,r=e.__last_index__,i=e.__text_cache__.slice(n,r);this.schema=e.__schema__.toLowerCase(),this.index=n+t,this.lastIndex=r+t,this.raw=i,this.text=i,this.url=i}function y(e,t){var n=new v(e,t);return e.__compiled__[n.schema].normalize(n,e),n}function b(e,t){if(!(this instanceof b))return new b(e,t);t||u(e)&&(t=e,e={}),this.__opts__=n({},l,t),this.__index__=-1,this.__last_index__=-1,this.__schema__=``,this.__text_cache__=``,this.__schemas__=n({},d,e),this.__compiled__={},this.__tlds__=p,this.__tlds_replaced__=!1,this.re={},_(this)}b.prototype.add=function(e,t){return this.__schemas__[e]=t,_(this),this},b.prototype.set=function(e){return this.__opts__=n(this.__opts__,e),this},b.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;var t,n,r,i,a,o,s,c,l;if(this.re.schema_test.test(e)){for(s=this.re.schema_search,s.lastIndex=0;(t=s.exec(e))!==null;)if(i=this.testSchemaAt(e,t[2],s.lastIndex),i){this.__schema__=t[2],this.__index__=t.index+t[1].length,this.__last_index__=t.index+t[0].length+i;break}}return this.__opts__.fuzzyLink&&this.__compiled__[`http:`]&&(c=e.search(this.re.host_fuzzy_test),c>=0&&(this.__index__<0||c<this.__index__)&&(n=e.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))!==null&&(a=n.index+n[1].length,(this.__index__<0||a<this.__index__)&&(this.__schema__=``,this.__index__=a,this.__last_index__=n.index+n[0].length))),this.__opts__.fuzzyEmail&&this.__compiled__[`mailto:`]&&(l=e.indexOf(`@`),l>=0&&(r=e.match(this.re.email_fuzzy))!==null&&(a=r.index+r[1].length,o=r.index+r[0].length,(this.__index__<0||a<this.__index__||a===this.__index__&&o>this.__last_index__)&&(this.__schema__=`mailto:`,this.__index__=a,this.__last_index__=o))),this.__index__>=0},b.prototype.pretest=function(e){return this.re.pretest.test(e)},b.prototype.testSchemaAt=function(e,t,n){return this.__compiled__[t.toLowerCase()]?this.__compiled__[t.toLowerCase()].validate(e,n,this):0},b.prototype.match=function(e){var t=0,n=[];this.__index__>=0&&this.__text_cache__===e&&(n.push(y(this,t)),t=this.__last_index__);for(var r=t?e.slice(t):e;this.test(r);)n.push(y(this,t)),r=r.slice(this.__last_index__),t+=this.__last_index__;return n.length?n:null},b.prototype.tlds=function(e,t){return e=Array.isArray(e)?e:[e],t?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(e,t,n){return e!==n[t-1]}).reverse(),_(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,_(this),this)},b.prototype.normalize=function(e){e.schema||(e.url=`http://`+e.url),e.schema===`mailto:`&&!/^mailto:/i.test(e.url)&&(e.url=`mailto:`+e.url)},b.prototype.onCompile=function(){},t.exports=b})),ji=t(p((t=>{var n=t&&t.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),r=t&&t.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),i=t&&t.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},e(t)};return function(t){if(t&&t.__esModule)return t;var i={};if(t!=null)for(var a=e(t),o=0;o<a.length;o++)a[o]!=="default"&&n(i,t,a[o]);return r(i,t),i}})(),a=t&&t.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.default=g;var o=a(Ci()),s=wi(),c=a(Ai()),l=i(e());function u(e,t=!1){return e=(0,s.escapeCarriageReturn)(_(e)),o.default.ansiToJson(e,{json:!0,remove_empty:!0,use_classes:t})}function d(e){let t=``;return e.bg&&(t+=`${e.bg}-bg `),e.fg&&(t+=`${e.fg}-fg `),e.decoration&&(t+=`ansi-${e.decoration} `),t===``?null:(t=t.substring(0,t.length-1),t)}function f(e){let t={};switch(e.bg&&(t.backgroundColor=`rgb(${e.bg})`),e.fg&&(t.color=`rgb(${e.fg})`),e.decoration){case`bold`:t.fontWeight=`bold`;break;case`dim`:t.opacity=`0.5`;break;case`italic`:t.fontStyle=`italic`;break;case`hidden`:t.visibility=`hidden`;break;case`strikethrough`:t.textDecoration=`line-through`;break;case`underline`:t.textDecoration=`underline`;break;case`blink`:t.textDecoration=`blink`;break;default:break}return t}function p(e,t,n,r){let i=t?null:f(n),a=t?d(n):null;return e?e===`fuzzy`?h(n,r,i,a):m(n,r,i,a):l.createElement(`span`,{style:i,key:r,className:a},n.content)}function m(e,t,n,r){let i=[],a=/(\s|^)(https?:\/\/(?:www\.|(?!www))[^\s.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/g,o=0,s;for(;(s=a.exec(e.content))!==null;){let[,t,n]=s,r=s.index+t.length;r>o&&i.push(e.content.substring(o,r));let c=n.startsWith(`www.`)?`http://${n}`:n;i.push(l.createElement(`a`,{key:o,href:c,target:`_blank`},`${n}`)),o=a.lastIndex}return o<e.content.length&&i.push(e.content.substring(o)),l.createElement(`span`,{style:n,key:t,className:r},i)}function h(e,t,n,r){let i=(0,c.default)({fuzzyEmail:!1}).tlds([`io`],!0);if(!i.pretest(e.content))return l.createElement(`span`,{style:n,key:t,className:r},e.content);let a=i.match(e.content);if(!a)return l.createElement(`span`,{style:n,key:t,className:r},e.content);let o=[e.content.substring(0,a[0]?.index)];return a.forEach((t,n)=>{o.push(l.createElement(`a`,{href:t.url,target:`_blank`,key:n},e.content.substring(t.index,t.lastIndex))),a[n+1]&&o.push(e.content.substring(a[n].lastIndex,a[n+1]?.index))}),a[a.length-1].lastIndex!==e.content.length&&o.push(e.content.substring(a[a.length-1].lastIndex,e.content.length)),l.createElement(`span`,{style:n,key:t,className:r},o)}function g(e){let{className:t,useClasses:n,children:r,linkify:i}=e;return l.createElement(`code`,{className:t},u(r??``,n??!1).map(p.bind(null,i??!1,n??!1)))}function _(e){let t=e;do e=t,t=e.replace(/[^\n]\x08/gm,``);while(t.length<e.length);return e}}))(),1),Mi=ji.default.default||ji.default,Ni={"claude-cli":new Set([`npm install -g @anthropic-ai/claude-code`,`claude auth login`,`claude auth status --json`]),"claude-sdk":new Set([`npm install -g @anthropic-ai/claude-code`,`claude auth login`,`claude auth status --json`]),"codex-cli":new Set([`npm install -g @openai/codex`,`codex login`,`codex login status`]),"codex-sdk":new Set([`npm install -g @openai/codex`,`codex login`,`codex login status`])},Pi=new Set([`native-api`,`cli-print`,`acp`,`sdk`]),Fi=new Set([`none`,`client-assigned`,`provider-assigned`]),Ii=new Set([`read-only`,`workspace-write`,`harness-managed`]),Li=new Set([`uuid`,`opaque`]),Ri=new Set([`missing-cli`,`signed-out`,`probe-failed`]);function zi(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function Bi(e){return e===void 0||typeof e==`string`}function Vi(e){return!zi(e)||typeof e.transport!=`string`||!Pi.has(e.transport)||typeof e.sessionIdentity!=`string`||!Fi.has(e.sessionIdentity)||typeof e.workspaceAccess!=`string`||!Ii.has(e.workspaceAccess)||e.sessionIdFormat!==void 0&&(typeof e.sessionIdFormat!=`string`||!Li.has(e.sessionIdFormat))?null:{transport:e.transport,sessionIdentity:e.sessionIdentity,workspaceAccess:e.workspaceAccess,...e.sessionIdFormat===void 0?{}:{sessionIdFormat:e.sessionIdFormat}}}function Hi(e){if(!zi(e)||typeof e.id!=`string`||typeof e.name!=`string`||typeof e.isConfigured!=`boolean`||!Bi(e.icon)||!Bi(e.accessLabel)||!Bi(e.message)||!Bi(e.recoveryCommand)||!Bi(e.recoveryLabel)||e.setupIssue!==void 0&&(typeof e.setupIssue!=`string`||!Ri.has(e.setupIssue)))return null;let t=Vi(e.capabilities);if(!t)return null;let n;if(e.executionProfiles!==void 0){if(!Array.isArray(e.executionProfiles)||e.executionProfiles.length===0)return null;n=[];let t=new Set;for(let r of e.executionProfiles){if(!zi(r)||!ui(r.id)||typeof r.label!=`string`||typeof r.description!=`string`||t.has(r.id))return null;t.add(r.id),n.push({id:r.id,label:r.label,description:r.description})}}if(e.defaultExecutionProfile!==void 0&&(!ui(e.defaultExecutionProfile)||!n?.some(t=>t.id===e.defaultExecutionProfile))||n&&e.defaultExecutionProfile===void 0||!n&&e.defaultExecutionProfile!==void 0)return null;let r;if(e.models!==void 0){if(!Array.isArray(e.models)||e.models.length===0)return null;r=[];let t=new Set;for(let n of e.models){if(!zi(n)||typeof n.id!=`string`||n.id.length>100||typeof n.label!=`string`||n.label.length===0||n.label.length>100||typeof n.description!=`string`||n.description.length>300||t.has(n.id))return null;t.add(n.id),r.push({id:n.id,label:n.label,description:n.description})}}let i=e.setupIssue!==void 0||e.recoveryCommand!==void 0||e.recoveryLabel!==void 0,a=e.setupIssue!==void 0&&e.recoveryCommand!==void 0&&e.recoveryLabel!==void 0;return i&&!a||e.isConfigured&&i?null:{id:e.id,name:e.name,isConfigured:e.isConfigured,capabilities:t,...e.icon===void 0?{}:{icon:e.icon},...e.accessLabel===void 0?{}:{accessLabel:e.accessLabel},...e.message===void 0?{}:{message:e.message},...e.setupIssue===void 0?{}:{setupIssue:e.setupIssue},...e.recoveryCommand===void 0?{}:{recoveryCommand:e.recoveryCommand},...e.recoveryLabel===void 0?{}:{recoveryLabel:e.recoveryLabel},...n===void 0?{}:{executionProfiles:n},...e.defaultExecutionProfile===void 0?{}:{defaultExecutionProfile:e.defaultExecutionProfile},...r===void 0?{}:{models:r}}}function Ui(e){if(!Array.isArray(e))return null;let t=[];for(let n of e){let e=Hi(n);if(!e)return null;t.push(e)}return t}function Wi(e){return!e.recoveryCommand||!Ni[e.id]?.has(e.recoveryCommand)?null:{command:e.recoveryCommand,label:e.recoveryLabel??`Copy recovery command`}}function Gi(e,t){let n=e.models?.find(e=>e.id===t);return n?n.label:t||`Automatic`}function Ki(e,t){let n=!1,r={...e};for(let i of t){let t=e[i.id];t&&i.models&&!i.models.some(e=>e.id===t)&&(delete r[i.id],n=!0)}return n?r:e}var qi=e=>e?new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):null,Ji=(0,Q.memo)(function({msg:e,idx:t,copied:n,onCopy:r}){if(e.role===`system`)return(0,$.jsx)(`div`,{className:`flex justify-center`,children:(0,$.jsx)(`span`,{className:c(`rounded-full border px-3 py-1 text-center text-[11px]`,e.kind===`error`?`border-destructive/25 bg-destructive/10 text-destructive-foreground`:`border-border bg-muted text-muted-foreground`),children:e.content})});let i=e.role===`user`,a=!i&&e.content.includes(`\x1B`);return(0,$.jsxs)(`div`,{className:`flex flex-col ${i?`items-end`:`items-start`}`,children:[(0,$.jsx)(`div`,{className:`group relative max-w-[85%] rounded-lg p-3 ${i?`bg-primary text-primary-foreground`:`border border-border bg-card text-foreground`}`,children:i?(0,$.jsx)(`div`,{className:`whitespace-pre-wrap text-sm`,children:e.content}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a?(0,$.jsx)(`div`,{className:`overflow-x-auto whitespace-pre-wrap rounded-md bg-muted/50 p-2 font-mono text-xs text-foreground`,children:(0,$.jsx)(Mi,{children:e.content})}):(0,$.jsx)(gn,{content:e.content}),(0,$.jsx)(`button`,{onClick:()=>r(t,e.content),className:`absolute -right-2.5 -top-2.5 hidden h-6 w-6 cursor-pointer place-items-center rounded-md border border-border bg-card text-muted-foreground shadow-sm hover:text-foreground group-hover:grid`,title:`Copy message`,children:n?(0,$.jsx)(Y,{size:12,className:`text-success-foreground`}):(0,$.jsx)(Tt,{size:12})})]})}),i&&e.executionProfile&&(0,$.jsx)(`span`,{className:`mt-1 rounded border border-border px-1.5 py-0.5 text-[9px] font-medium uppercase tracking-wide text-muted-foreground`,children:e.executionProfile===`workspace-write`?`Edit`:`Review`}),e.ts&&(0,$.jsx)(`span`,{className:`mt-1 text-[10px] text-muted-foreground`,children:qi(e.ts)})]})});function Yi({ws:e}){let t=Mt(),n=St(),[r,i]=(0,Q.useState)([]),[a,o]=(0,Q.useState)(!1),[s]=(0,Q.useState)(()=>pi(e.branchName)),[l,u]=(0,Q.useState)(s.messages),[d,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(``),[S,C]=(0,Q.useState)(s.profilesByProvider),[w,T]=(0,Q.useState)(s.modelsByProvider??{}),[E,D]=(0,Q.useState)(null),[O,k]=(0,Q.useState)(!1),[A,j]=(0,Q.useState)(0),[M,N]=(0,Q.useState)(!1),[P,F]=(0,Q.useState)(null),[I,ee]=(0,Q.useState)(!1),[L,te]=(0,Q.useState)(null),[ne,R]=(0,Q.useState)(!1),[re,z]=(0,Q.useState)(null),[ie,ae]=(0,Q.useState)(null),B=(0,Q.useRef)(null),oe=(0,Q.useRef)(null),se=(0,Q.useRef)(null),ce=(0,Q.useRef)(!0),V=(0,Q.useRef)(s.sessions),H=(0,Q.useRef)([]),le=(0,Q.useRef)(!1),ue=(0,Q.useRef)(!1),de=(0,Q.useRef)({messages:l,agentName:b,profilesByProvider:S,modelsByProvider:w}),fe=(0,Q.useRef)(S),pe=(0,Q.useRef)(null),me=(0,Q.useRef)(null),U=(0,Q.useRef)(!0),he=(0,Q.useRef)(0),ge=(0,Q.useRef)(null),_e=(0,Q.useRef)(!1),ve=(0,Q.useRef)({id:0,controller:null}),W=(0,Q.useMemo)(()=>bi(t.state),[t.state]);(0,Q.useEffect)(()=>{de.current={messages:l,agentName:b,profilesByProvider:S,modelsByProvider:w},fe.current=S},[l,b,S,w]);let ye=(0,Q.useCallback)(()=>{pe.current=null,hi(e.branchName,{v:4,sessions:V.current,providerId:de.current.agentName||s.providerId,profilesByProvider:de.current.profilesByProvider,modelsByProvider:de.current.modelsByProvider,messages:de.current.messages})},[e.branchName,s.providerId]);(0,Q.useEffect)(()=>{let e=l[l.length-1];(ce.current||e?.role===`user`)&&se.current?.scrollIntoView({behavior:e?.role===`user`?`smooth`:`auto`}),pe.current&&clearTimeout(pe.current),pe.current=setTimeout(ye,400)},[l,b,S,w,A,ye]),(0,Q.useEffect)(()=>{let e=()=>ye();return window.addEventListener(`pagehide`,e),()=>{window.removeEventListener(`pagehide`,e),pe.current&&clearTimeout(pe.current),ye()}},[ye]),(0,Q.useEffect)(()=>{let e=++he.current,t=new AbortController,n=!0;return fetch(`/api/adapters/status`,{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`,signal:t.signal}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(t=>{if(!n||e!==he.current)return;let r=Ui(t);if(!r)throw Error(`Invalid provider status response`);i(r),T(e=>Ki(e,r)),C(e=>{let t=!1,n={...e};for(let i of r)!i.executionProfiles?.length||!i.defaultExecutionProfile||i.executionProfiles.some(t=>t.id===e[i.id])||(n[i.id]=i.defaultExecutionProfile,t=!0);return t?n:e});let a=(s.providerId?r.find(e=>e.id===s.providerId):void 0)||r.find(e=>e.isConfigured)||r[0];a&&x(e=>e||a.id)}).catch(e=>{n&&e?.name!==`AbortError`&&console.error(`Failed to fetch agent data`,e)}).finally(()=>{n&&e===he.current&&o(!0)}),()=>{n=!1,t.abort()}},[s.providerId]),(0,Q.useEffect)(()=>(U.current=!0,()=>{U.current=!1,ve.current.id+=1,ve.current.controller?.abort(),B.current&&B.current.close()}),[e.branchName,e.workspacePath]);let be=E??b,G=r.find(e=>e.id===be),xe=G?.executionProfiles?.find(e=>e.id===S[G.id])??G?.executionProfiles?.find(e=>e.id===G.defaultExecutionProfile),Se=!!b&&!!G?.isConfigured&&(!G?.executionProfiles||!!xe)&&!O&&!M,Ce=(0,Q.useCallback)((e,t)=>{let n=t??r.find(t=>t.id===e);if(!n?.executionProfiles?.length)return;let i=fe.current[e];return n.executionProfiles.some(e=>e.id===i)?i:n.defaultExecutionProfile},[r]),K=(0,Q.useCallback)(()=>{le.current=!1,y(!1)},[]),q=(0,Q.useCallback)((e,t)=>{u(n=>[...n,{role:`system`,content:e,kind:t,ts:Date.now()}])},[]),we=(0,Q.useCallback)((e,t,n)=>{let r=crypto.randomUUID(),i={role:`user`,content:t,ts:Date.now(),...n?{executionProfile:n}:{}};H.current.push({turnId:r,text:t,message:i});try{e.send(JSON.stringify({type:`input`,input:t,turnId:r,...n?{executionProfile:n}:{}}))}catch(e){throw H.current=H.current.filter(e=>e.turnId!==r),e}u(e=>[...e,i]),p(``),_(!0),K()},[K]),Te=(0,Q.useCallback)(()=>{ue.current||(ue.current=!0,q(`Session ended`,`note`))},[q]),Ee=(0,Q.useCallback)(()=>{let e=B.current;if(e){if(e.readyState===WebSocket.OPEN)try{e.send(JSON.stringify({type:`stop`}))}catch{}B.current=null,ge.current=null,D(null),k(!1),e.close(),h(!1),_(!1),K(),Te()}},[K,Te]),J=(0,Q.useCallback)((t=b,n={})=>{if(B.current)return n.onFailure?.(),!1;let i=n.provider??r.find(e=>e.id===t);if(x(t),!i?.isConfigured)return q(i?.message??`The ${t} provider is unavailable. Check its local CLI installation and login.`,`error`),n.onFailure?.(),!1;let a=n.executionProfile??Ce(t,i),o=a!==void 0&&i.executionProfiles?.some(e=>e.id===a)===!0;if((n.executionProfile!==void 0||i.executionProfiles?.length)&&!o)return q(`Select a supported execution profile before starting this local CLI.`,`error`),n.onFailure?.(),!1;let s=n.model??w[t];if(s&&i.models&&!i.models.some(e=>e.id===s))return q(`Select a model advertised by this provider before starting the harness.`,`error`),n.onFailure?.(),!1;let c=``;c=c.startsWith(`http`)?c.replace(`http`,`ws`):window.location.origin.replace(`http`,`ws`),c+=`/ws`,ue.current=!1;let l=!1,f=!1,m,g=()=>{f||l||!U.current||(f=!0,q(`Could not open the local agent connection. Your current chat was preserved; retry explicitly when ready.`,`error`),n.onFailure?.())};try{m=new WebSocket(c)}catch{return g(),!1}return m.onopen=()=>{if(!U.current||B.current!==m){m.close();return}let r={type:`start`,command:t,cwd:e.workspacePath};s&&(r.model=s);let o={...V.current};if(n.resetSession&&delete o[t],n.session&&(o[t]=n.session),i.capabilities.sessionIdentity===`client-assigned`){let e=o[t]??{id:crypto.randomUUID(),started:!1};o[t]=e,r.sessionId=e.id,r.resume=e.started}else if(i.capabilities.sessionIdentity===`provider-assigned`){let e=o[t];e?.started&&(r.sessionId=e.id,r.resume=!0)}let c=n.firstMessage===null?``:(n.firstMessage??d).trim(),f;try{if(m.send(JSON.stringify(r)),c){let e=crypto.randomUUID();f={turnId:e,text:c,message:{role:`user`,content:c,ts:Date.now(),...a?{executionProfile:a}:{}}},H.current.push(f),m.send(JSON.stringify({type:`input`,input:c,turnId:e,...a?{executionProfile:a}:{}}))}}catch{f&&(H.current=H.current.filter(e=>e.turnId!==f?.turnId)),g(),B.current=null,ge.current=null,D(null),k(!1),m.close();return}V.current=o,l=!0,k(!1),h(!0),n.resetMessagesOnDispatch&&u([]),c&&(u(e=>[...n.resetMessagesOnDispatch?[]:e,f?.message??{role:`user`,content:c,ts:Date.now(),...a?{executionProfile:a}:{}}]),p(``),_(!0),K()),n.onDispatched?.()},m.onmessage=e=>{if(B.current===m)try{let n=JSON.parse(e.data);if(n.type===`stream`){let e=le.current;le.current=!0,y(!0),u(t=>{let r=t[t.length-1];if(e&&r?.role===`assistant`){let e=[...t];return e[e.length-1]={...r,content:r.content+n.text},e}return[...t,{role:`assistant`,content:n.text,ts:Date.now()}]})}else if(n.type===`session`&&typeof n.id==`string`){let e=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(n.id),r=V.current[t],a=i.capabilities.sessionIdentity!==`client-assigned`||r?.id.toLowerCase()===n.id.toLowerCase();if(e&&a){let e=i.capabilities.sessionIdentity===`client-assigned`?r.id:n.id;V.current={...V.current,[t]:{id:e,started:!0}},j(e=>e+1)}else q(`The local CLI returned an unexpected session identity. This turn will not be resumed automatically.`,`error`)}else if(n.type===`accepted`&&typeof n.turnId==`string`)H.current=H.current.filter(e=>e.turnId!==n.turnId);else if(n.type===`status`)_(n.state===`busy`),n.state!==`busy`&&K();else if(n.type===`system`)q(n.message,`note`),K();else if(n.type===`rejected`&&n.reason===`busy`){let e=H.current.findIndex(e=>e.turnId===n.turnId),t=e===-1?void 0:H.current.splice(e,1)[0];t&&(u(e=>e.filter(e=>e!==t.message)),p(e=>e?`${t.text}\n\n${e}`:t.text)),q(typeof n.message==`string`?n.message:`The agent is still processing the current turn.`,`error`)}else n.type===`error`?(H.current=[],q(n.message,`error`),_(!1),K()):n.type===`close`&&(H.current=[],h(!1),_(!1),K(),Te(),m.close(),B.current=null)}catch(e){console.error(`Failed to parse WS message`,e)}},m.onclose=()=>{B.current===m&&(l||g(),h(!1),k(!1),_(!1),K(),l&&Te(),B.current=null,ge.current=null,D(null))},m.onerror=()=>{B.current===m&&(g(),l||(B.current=null,ge.current=null,D(null),k(!1),h(!1),m.close()))},B.current=m,ge.current=t,D(t),k(!0),!0},[b,q,K,d,w,Te,Ce,r,e.workspacePath]),De=(0,Q.useCallback)(()=>{let e=d.trim(),t=ge.current;if(!e||!B.current||!t||g||_e.current)return;let n=r.find(e=>e.id===t),i=Ce(t,n);n?.executionProfiles?.length&&!i||we(B.current,e,i)},[g,d,Ce,r,we]),Oe=(0,Q.useCallback)((e,t)=>{navigator.clipboard.writeText(t).then(()=>{ae(e),setTimeout(()=>ae(t=>t===e?null:t),1500)}).catch(()=>{})},[]),ke=(0,Q.useCallback)(e=>{ve.current.id===e&&(ve.current.controller=null,_e.current=!1,U.current&&N(!1))},[]),Ae=(0,Q.useCallback)(async(e,t=!1)=>{let n=ve.current.id+1;ve.current.controller?.abort();let i=new AbortController;ve.current={id:n,controller:i},_e.current=!0,N(!0),z(null);let a=yi(e.assistant);if(!a)return q(`This session cannot resume in embedded chat.`,`error`),ke(n),!1;let o=r.find(e=>e.id===a);if(!o?.isConfigured)return q(o?.message??`The ${a} provider is unavailable. Check its local CLI installation and login.`,`error`),ke(n),!1;let s=()=>U.current&&ve.current.id===n&&!i.signal.aborted;try{let r=await fetch(`/api/session/${encodeURIComponent(e.assistant)}/${encodeURIComponent(e.id)}/transcript`,{signal:i.signal});if(!r.ok)throw Error(`HTTP ${r.status}`);let o=await r.json();if(!s())return!1;let c=(Array.isArray(o.messages)?o.messages:[]).filter(e=>(e.role===`user`||e.role===`assistant`)&&typeof e.content==`string`&&e.content.trim()).map(e=>({role:e.role,content:e.content,ts:e.timestamp&&Date.parse(e.timestamp)||void 0}));if(B.current&&!window.confirm(`Stop the current chat and resume this session?`))return ke(n),!1;B.current&&Ee(),x(a);let l=()=>{s()&&(C(e=>({...e,[a]:`review`})),u([...c,{role:`system`,kind:`note`,content:`Loaded session — your next message resumes it.`,ts:Date.now()}]),p(``),R(!1),ke(n))};return t?J(a,{firstMessage:null,session:{id:e.id,started:!0},onDispatched:l,onFailure:()=>{s()&&(z(`Failed to connect to the selected session.`),ke(n))}}):(V.current={...V.current,[a]:{id:e.id,started:!0}},l(),!0)}catch(e){return!s()||e instanceof DOMException&&e.name===`AbortError`?!1:(z(`Failed to load the session transcript.`),q(`Failed to load the session transcript. Your current chat was preserved.`,`error`),ke(n),!1)}},[q,ke,r,J,Ee]),je=(0,Q.useCallback)(e=>{Ae(e)},[Ae]),Me=(0,Q.useCallback)(async(e,t=!1,n=!1)=>{F(e);let r;if(t){ee(!0);try{let t=await fetch(`/api/adapters/status/refresh`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({providerId:e.providerId})});if(!t.ok)throw Error(`HTTP ${t.status}`);let a=Ui(await t.json());if(!a)throw Error(`Invalid provider status response`);if(!U.current)return!1;i(a),T(e=>Ki(e,a)),r=a.find(t=>t.id===e.providerId);let o=n&&(r?.setupIssue===`signed-out`||r?.setupIssue===`probe-failed`);if(!r||!r.isConfigured&&!o)return q(r?.message??`The selected local CLI is still unavailable. Install it and sign in, then retry.`,`error`),!1}catch{return U.current&&q(`Could not refresh the local CLI status. The task handoff was not dispatched.`,`error`),!1}finally{U.current&&ee(!1)}}return J(e.providerId,{firstMessage:e.kickoff,executionProfile:e.executionProfile,provider:r&&n&&(r.setupIssue===`signed-out`||r.setupIssue===`probe-failed`)?{...r,isConfigured:!0}:r,resetSession:!0,resetMessagesOnDispatch:!0,onDispatched:()=>{U.current&&F(null)},onFailure:()=>{U.current&&F(e)}})},[q,J]);(0,Q.useEffect)(()=>{if(!a||!W)return;let e=me.current===W.nonce;try{e||=sessionStorage.getItem(`nexusflow.chatLaunch.consumed`)===W.nonce,sessionStorage.setItem(`nexusflow.chatLaunch.consumed`,W.nonce)}catch{}me.current=W.nonce;let i=t.state&&typeof t.state==`object`?{...t.state}:{};if(delete i.chatLaunch,n(`${t.pathname}${t.search}`,{replace:!0,state:Object.keys(i).length>0?i:null}),e)return;let o=r.find(e=>e.id===W.providerId);if(x(W.providerId),C(e=>({...e,[W.providerId]:W.executionProfile})),W.model&&T(e=>({...e,[W.providerId]:W.model})),!o?.isConfigured){q(o?.message??`The selected local CLI is unavailable. Install it and sign in, then try again.`,`error`),W.kickoff&&F({providerId:W.providerId,kickoff:W.kickoff,executionProfile:W.executionProfile});return}if(W.sessionId&&W.assistant){Ae({id:W.sessionId,assistant:W.assistant,title:``,createdAt:``,updatedAt:``,messageCount:0},!0);return}B.current&&!window.confirm(`Stop the current chat and continue with the selected local CLI?`)||(B.current&&Ee(),W.kickoff?Me({providerId:W.providerId,kickoff:W.kickoff,executionProfile:W.executionProfile}):J(W.providerId,{firstMessage:null}))},[q,Me,W,Ae,t.pathname,t.search,t.state,n,r,a,J,Ee]);let Ne=()=>{if(window.confirm(`Are you sure you want to clear this chat history? This also starts a new agent session.`)){B.current&&Ee();let t={...V.current};delete t[b],V.current=t,ue.current=!1,u([]),gi(e.branchName)}},Pe=g&&!v,Fe=G?Wi(G):null;return(0,$.jsxs)(`div`,{className:`flex h-full flex-col bg-card`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-border bg-card px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,$.jsx)(`h3`,{className:`font-semibold text-foreground`,children:`Chat`}),(0,$.jsx)($t,{tone:m?`running`:`idle`,dot:!0,children:m?`${G?.name||`Connected`}${G&&w[G.id]?` (${Gi(G,w[G.id])})`:``}`:`Disconnected`})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[l.length>0&&(0,$.jsx)(`button`,{onClick:Ne,className:`cursor-pointer text-xs text-muted-foreground transition-colors hover:text-destructive-foreground`,children:`Clear`}),(0,$.jsx)(`button`,{onClick:()=>{z(null),R(!0)},className:`grid h-7 w-7 cursor-pointer place-items-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:`Resume a past session`,children:(0,$.jsx)(Nn,{size:14})}),m&&(0,$.jsxs)(f,{size:`sm`,variant:`outline`,onClick:Ee,children:[(0,$.jsx)($e,{size:14,className:`text-destructive-foreground`}),`Stop`]})]})]}),(0,$.jsx)(Si,{open:ne,onClose:()=>R(!1),ws:e,onPick:je,error:re,pending:M}),(0,$.jsxs)(`div`,{ref:oe,onScroll:()=>{let e=oe.current;e&&(ce.current=e.scrollHeight-e.scrollTop-e.clientHeight<80)},className:`flex-1 space-y-4 overflow-y-auto p-4`,children:[l.length===0&&!Pe&&(0,$.jsx)(`div`,{className:`flex h-full items-center justify-center text-muted-foreground`,children:`No messages yet. Start the agent and say hello.`}),l.map((e,t)=>(0,$.jsx)(Ji,{msg:e,idx:t,copied:ie===t,onCopy:Oe},t)),Pe&&(0,$.jsx)(`div`,{className:`flex justify-start`,children:(0,$.jsx)(`div`,{className:`rounded-lg border border-border bg-card px-4 py-3 text-muted-foreground`,children:(0,$.jsx)(Rt,{size:14,className:`animate-spin`})})}),(0,$.jsx)(`div`,{ref:se})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-t border-border bg-card p-3`,children:[G&&!G.isConfigured&&(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-destructive/25 bg-destructive/10 px-3 py-2 text-xs text-destructive-foreground`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)(`span`,{className:`shrink-0 font-semibold`,children:[G.name,` provider status:`]}),(0,$.jsx)(`span`,{children:G.message})]}),Fe&&(0,$.jsx)(`code`,{className:`w-fit rounded bg-background/70 px-2 py-1 font-mono text-[11px] text-foreground`,children:Fe.command})]}),Fe&&(0,$.jsxs)(f,{size:`sm`,variant:`outline`,onClick:()=>{if(!G||!Fe)return;let e=()=>q(`Could not copy the recovery command. Copy the command shown above manually.`,`error`);try{let t=navigator.clipboard?.writeText;if(!t){e();return}t.call(navigator.clipboard,Fe.command).then(()=>{te(G.id),setTimeout(()=>{U.current&&te(e=>e===G.id?null:e)},1500)}).catch(e)}catch{e()}},className:`shrink-0`,children:[L===G.id?(0,$.jsx)(Y,{size:12}):(0,$.jsx)(Tt,{size:12}),L===G.id?`Copied`:Fe.label]})]}),P&&!O&&!m&&(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-warning/25 bg-warning/10 px-3 py-2 text-xs text-foreground`,children:[(0,$.jsxs)(`span`,{children:[`The workspace kickoff was not dispatched (`,P.executionProfile===`workspace-write`?`Edit workspace`:`Review only`,`).`]}),(0,$.jsx)(f,{size:`sm`,variant:`outline`,onClick:()=>void Me(P,!0),disabled:M||I,children:I?`Checking CLI…`:`Recheck & retry`}),G?.setupIssue&&G.setupIssue!==`missing-cli`&&(0,$.jsx)(f,{size:`sm`,variant:`outline`,onClick:()=>void Me(P,!0,!0),disabled:M||I,children:`Try with existing CLI auth`})]}),(0,$.jsxs)(`div`,{className:`flex w-full flex-col rounded-xl border border-border bg-card shadow-sm`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/50 p-2`,children:[(0,$.jsxs)(rn,{children:[(0,$.jsxs)(Xt,{"aria-label":`Select Provider`,className:c(`flex cursor-pointer items-center gap-2 rounded-md px-3 py-1.5 text-xs font-medium transition-colors hover:bg-accent`,m?`pointer-events-none opacity-50`:`text-foreground`),children:[G?.icon===`Bot`?(0,$.jsx)(Ue,{size:14,className:`text-primary`}):(0,$.jsx)(nt,{size:14,className:`text-primary`}),G?.name||`Select Agent`]}),(0,$.jsx)(qt,{align:`start`,side:`top`,children:r.map(e=>(0,$.jsxs)(Z,{onClick:()=>{m||x(e.id)},children:[e.icon===`Bot`?(0,$.jsx)(Ue,{size:14}):(0,$.jsx)(nt,{size:14}),e.name]},e.id))})]}),(0,$.jsx)(`div`,{className:`h-4 w-px bg-border`}),G?.executionProfiles?.length&&xe?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(rn,{children:[(0,$.jsx)(Xt,{"aria-label":`Select execution profile`,disabled:O||g||M||!!P,className:`flex cursor-pointer items-center rounded-md px-2 py-1 text-xs font-medium text-foreground transition-colors hover:bg-accent disabled:pointer-events-none disabled:opacity-50`,children:xe.label}),(0,$.jsx)(qt,{align:`start`,side:`top`,className:`max-w-80`,children:G.executionProfiles.map(e=>(0,$.jsx)(Z,{onClick:()=>C(t=>({...t,[G.id]:e.id})),children:(0,$.jsxs)(`span`,{className:`flex flex-col`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.description})]})},e.id))})]}),(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs text-muted-foreground`,title:xe.description,children:xe.description})]}):(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:G?.accessLabel??`Harness-managed access`}),G?.models?.length&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`h-4 w-px bg-border`}),(0,$.jsxs)(rn,{children:[(0,$.jsx)(Xt,{"aria-label":`Select model`,disabled:m||O||g||M||!!P,className:`flex cursor-pointer items-center rounded-md px-2 py-1 text-xs font-medium text-foreground transition-colors hover:bg-accent disabled:pointer-events-none disabled:opacity-50`,children:Gi(G,w[G.id]??``)}),(0,$.jsx)(qt,{align:`start`,side:`top`,className:`max-w-80`,children:G.models.map(e=>(0,$.jsx)(Z,{onClick:()=>T(t=>({...t,[G.id]:e.id})),children:(0,$.jsxs)(`span`,{className:`flex flex-col`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.description})]})},e.id))})]})]})]}),(0,$.jsxs)(`div`,{className:`flex items-end gap-2 p-2`,children:[(0,$.jsx)(On,{value:d,disabled:M,onChange:e=>{p(e.target.value);let t=e.target;t.style.height=`auto`,t.style.height=`${Math.min(t.scrollHeight,200)}px`},onKeyDown:e=>{if(e.key===`Enter`&&!e.shiftKey){if(e.preventDefault(),g||O||_e.current)return;m?De():J();let t=e.currentTarget;t.style.height=`auto`}},placeholder:m?`Message the agent... (Shift+Enter for new line)`:`Start the agent or press Enter...`,unstyled:!0,className:`flex-1 [&_[data-slot=textarea]]:max-h-[200px] [&_[data-slot=textarea]]:min-h-11 [&_[data-slot=textarea]]:resize-none [&_[data-slot=textarea]]:text-sm`,rows:1}),m?(0,$.jsxs)(f,{className:`h-11 shrink-0 rounded-lg`,onClick:De,disabled:!d.trim()||g||M,children:[g?(0,$.jsx)(Rt,{size:14,className:`animate-spin`}):(0,$.jsx)(Vn,{size:14}),`Send`]}):(0,$.jsxs)(f,{className:`h-11 shrink-0 rounded-lg`,onClick:()=>J(),disabled:!Se,children:[(0,$.jsx)(Un,{size:14}),`Start`]})]})]})]})]})}function Xi({ws:e}){let t=e.branchName,n=Ut(t),r=Nt(t),i=zt(t),a=n.data,o=(0,Q.useMemo)(()=>a?.services??[],[a]),s=(0,Q.useMemo)(()=>a?.runningState??[],[a]),l=a?.orchestrationTools??[],u=(0,Q.useMemo)(()=>a?.runningOrchestrators??[],[a]),d=(0,Q.useMemo)(()=>u.filter(e=>e.mode===`pm2`&&e.logName),[u]),[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),...d.map(e=>e.logName)];e.length===0?_!==null&&v(null):(!_||!e.includes(_))&&v(e[0])},[o,d]);let{logs:y,connected:b,clear:x}=bt(t,_,!0),S=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{S.current?.scrollIntoView({behavior:`smooth`})},[y]);let C=(0,Q.useMemo)(()=>new Set(s.filter(e=>e.pid>0).map(e=>e.name)),[s]),w=(0,Q.useMemo)(()=>new Set(u.map(e=>e.id)),[u]),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)(X,{className:`size-3`}),(0,$.jsx)(`span`,{className:`font-semibold tracking-wider uppercase`,children:`Scanning service configurations...`})]}),l.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)(Ft,{size:12,className:`text-info`}),` Orchestration tools`]}),(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:l.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)($t,{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)(f,{size:`xs`,variant:`destructive`,"aria-label":`Stop ${e.tool}`,disabled:D,onClick:()=>i.mutate({action:`stop`,id:e.id}),children:[(0,$.jsx)($e,{size:12}),` Stop`]}):(0,$.jsxs)(f,{size:`xs`,"aria-label":`Start ${e.tool}`,disabled:D,onClick:()=>i.mutate({action:`start`,id:e.id}),children:[(0,$.jsx)(Ct,{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)($t,{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)(f,{size:`sm`,disabled:T||D,onClick:()=>r.mutate({action:`start`}),children:[(0,$.jsx)(Ct,{size:13}),` Start All Services`]}),(0,$.jsxs)(f,{size:`sm`,variant:`destructive`,disabled:!T||D,onClick:()=>r.mutate({action:`stop`}),children:[(0,$.jsx)($e,{size:13}),` Stop All`]})]})]}),(o.length>0||d.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)(bn,{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:c(`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)(f,{size:`icon-xs`,variant:`ghost`,"aria-label":`Restart ${e.name}`,disabled:D,onClick:()=>r.mutate({action:`restart`,service:e.name}),children:(0,$.jsx)(zn,{})}),(0,$.jsx)(f,{size:`icon-xs`,variant:`ghost`,"aria-label":`Stop ${e.name}`,disabled:D,onClick:()=>r.mutate({action:`stop`,service:e.name}),children:(0,$.jsx)($e,{})})]}):(0,$.jsx)(f,{size:`icon-xs`,variant:`ghost`,"aria-label":`Start ${e.name}`,disabled:D,onClick:()=>r.mutate({action:`start`,service:e.name}),children:(0,$.jsx)(Ct,{})})})]}),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)}),d.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`}),d.map(e=>{let t=e.logName;return(0,$.jsxs)(`div`,{className:c(`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)($t,{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)($t,{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:c(`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)(rt,{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)(Ln,{size:13}):(0,$.jsx)(Fn,{size:13})})]})]})]}),(0,$.jsxs)(`div`,{className:c(`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 Zi=({ws:e,gitChanges:t,gitChangesLoading:n,syncLoading:r,syncResults:i,commitMessage:a,showCommitModal:o,commitLoading:s,commitResults:c,setSyncResults:l,setCommitResults:u,setCommitMessage:d,setShowCommitModal:p,fetchGitChanges:m,handleSyncAll:h,handleCommitAll:g})=>{let[_,v]=(0,Q.useState)({}),[y,b]=(0,Q.useState)({}),[x,S]=(0,Q.useState)({}),[C,w]=(0,Q.useState)({}),[T,E]=(0,Q.useState)(``),D=async(t,n)=>{let r=`${t}/${n}`,i=!_[r];if(v(e=>({...e,[r]:i})),i&&!y[r]){S(e=>({...e,[r]:!0})),w(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();b(e=>({...e,[r]:o.diff||``}))}catch(e){w(t=>({...t,[r]:e.message||`Unknown error`}))}finally{S(e=>({...e,[r]:!1}))}}},O=e=>!e||!e.trim()?(0,$.jsx)(`div`,{className:`p-3 font-mono text-[11px] italic text-muted-foreground`,children:`No diff details available.`}):(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:e.split(`
6
+ `).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)})});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)(`h4`,{className:`flex items-center gap-2 text-sm font-bold text-foreground`,children:[(0,$.jsx)(Dt,{size:16,className:`text-primary`}),` Active Workspace Git Diffs`]}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsxs)(f,{variant:`outline`,size:`sm`,onClick:()=>m(e.branchName),disabled:n,children:[(0,$.jsx)(Rt,{size:11,className:n?`animate-spin text-primary`:``}),` Refresh Changes`]}),e.mode!==`in-place`&&(0,$.jsxs)(f,{variant:`outline`,size:`sm`,onClick:()=>h(e.branchName),disabled:r,children:[r?(0,$.jsx)(X,{className:`size-3`}):(0,$.jsx)(Rt,{size:11}),` Sync All`]}),(0,$.jsx)(f,{size:`sm`,onClick:()=>p(!0),disabled:t.every(e=>e.files.length===0)||s,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:()=>l(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))})]}),c&&(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:()=>u(null),children:`Dismiss`})]}),(0,$.jsx)(`div`,{className:`space-y-2`,children:c.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)(Bn,{size:13,className:`text-primary`}),` Enter Commit Message`]}),(0,$.jsx)(Ee,{type:`text`,className:`mb-4 font-mono text-xs`,placeholder:`feat: implement multi-repo logic...`,value:a,onChange:e=>d(e.target.value),onKeyDown:t=>{t.key===`Enter`&&a.trim()&&g(e.branchName)}}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2.5`,children:[(0,$.jsx)(f,{variant:`outline`,size:`sm`,onClick:()=>{p(!1),d(``)},disabled:s,children:`Cancel`}),(0,$.jsxs)(f,{size:`sm`,onClick:()=>g(e.branchName),disabled:s||!a.trim(),children:[s?(0,$.jsx)(X,{className:`size-3`}):null,s?`Committing...`:`Commit & Push All`]})]})]}),n?(0,$.jsx)(`div`,{className:`flex justify-center py-20`,children:(0,$.jsx)(X,{className:`size-6 text-primary`})}):(0,$.jsx)(`div`,{className:`space-y-6`,children:t.every(e=>e.files.length===0)?(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center rounded-xl border border-border bg-card py-16 text-center`,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)(Y,{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.`})]}):t.map(e=>{if(e.files.length===0)return null;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);return(0,$.jsxs)(`div`,{className:`relative rounded-xl border border-border bg-card p-6 transition-colors`,children:[(0,$.jsxs)(`div`,{className:`flex justify-between items-center mb-4 flex-wrap gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,$.jsx)(`h5`,{className:`font-mono text-sm font-bold text-foreground`,children:e.repoName}),(0,$.jsxs)($t,{tone:`warning`,dot:!1,children:[t,` file`,t===1?``:`s`,` changed`]}),(n>0||r>0)&&(0,$.jsxs)(`span`,{className:`rounded border border-border bg-muted/40 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,$.jsx)(`span`,{className:`max-w-[280px] truncate font-mono text-[10px] text-muted-foreground`,title:e.repoPath,children:e.repoPath})]}),(0,$.jsx)(`div`,{className:`flex flex-col gap-3`,children:e.files.map(t=>{let n=`${e.repoName}/${t.file}`,r=!!_[n],i=!!x[n],a=y[n]||``,o=C[n]||``;return(0,$.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-border bg-muted/20 transition-colors hover:border-foreground/15`,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:()=>D(e.repoName,t.file),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[r?(0,$.jsx)(We,{size:14,className:`shrink-0 text-primary`}):(0,$.jsx)(et,{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]`,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)(X,{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),E(n),setTimeout(()=>E(``),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:T===n?(0,$.jsx)(Y,{size:12,className:`text-success-foreground`}):(0,$.jsx)(Tt,{size:12})})}),O(a)]})})]},t.file)})})]},e.repoName)})})]})},Qi=({ws:e,knowledgeContent:t,knowledgeLoading:n,isEditingKnowledge:r,editedKnowledge:i,saveKnowledgeLoading:a,setEditedKnowledge:o,setIsEditingKnowledge:s,handleSaveKnowledge:c})=>{let[l,u]=(0,Q.useState)(`preview`);return(0,$.jsxs)(`div`,{className:`rounded-lg border border-border bg-card p-4 surface-card`,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)(Pt,{size:16,className:`text-primary`}),` Persistent Knowledge Memory (nexusflow-knowledge.md)`]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!r&&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)(f,{size:`xs`,variant:l===`preview`?`secondary`:`ghost`,onClick:()=>u(`preview`),className:`text-[11px] gap-1 px-2`,children:[(0,$.jsx)(Ke,{size:11}),` Preview`]}),(0,$.jsxs)(f,{size:`xs`,variant:l===`raw`?`secondary`:`ghost`,onClick:()=>u(`raw`),className:`text-[11px] gap-1 px-2`,children:[(0,$.jsx)(jn,{size:11}),` Raw`]})]}),r?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(f,{variant:`outline`,size:`xs`,onClick:()=>{o(t),s(!1)},disabled:a,children:`Cancel`}),(0,$.jsxs)(f,{size:`xs`,onClick:()=>c(e.branchName),disabled:a,children:[a?(0,$.jsx)(X,{className:`size-3`}):(0,$.jsx)(Bn,{size:10}),` Save`]})]}):(0,$.jsxs)(f,{variant:`outline`,size:`xs`,onClick:()=>s(!0),disabled:n,children:[(0,$.jsx)(Hn,{size:10}),` Edit Knowledge`]})]})]}),n?(0,$.jsx)(`div`,{className:`flex justify-center py-10`,children:(0,$.jsx)(Rt,{className:`animate-spin text-primary`,size:20})}):r?(0,$.jsx)(On,{className:`[&_[data-slot=textarea]]:h-96 [&_[data-slot=textarea]]:resize-y [&_[data-slot=textarea]]:font-mono [&_[data-slot=textarea]]:text-xs`,value:i,onChange:e=>o(e.target.value)}):t?l===`preview`?(0,$.jsx)(`div`,{className:`max-h-[500px] overflow-auto rounded-md border border-border/70 bg-muted/20 p-4`,children:(0,$.jsx)(gn,{content:t})}):(0,$.jsx)(`div`,{className:`max-h-[500px] overflow-auto whitespace-pre-wrap rounded-md border border-border/70 bg-muted/30 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.`})]})},$i=({planContent:e,planLoading:t})=>{let[n,r]=(0,Q.useState)(`preview`);return(0,$.jsxs)(`div`,{className:`rounded-lg border border-border bg-card p-4 surface-card`,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)(Pn,{size:16,className:`text-primary`}),` Inter-Repo Implementation Plan (nexusflow-plan.md)`]}),e&&(0,$.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted/50 p-0.5 rounded-md border border-border/60`,children:[(0,$.jsxs)(f,{size:`xs`,variant:n===`preview`?`secondary`:`ghost`,onClick:()=>r(`preview`),className:`text-[11px] gap-1 px-2`,children:[(0,$.jsx)(Ke,{size:11}),` Preview`]}),(0,$.jsxs)(f,{size:`xs`,variant:n===`raw`?`secondary`:`ghost`,onClick:()=>r(`raw`),className:`text-[11px] gap-1 px-2`,children:[(0,$.jsx)(jn,{size:11}),` Raw`]})]})]}),t?(0,$.jsx)(`div`,{className:`flex justify-center py-10`,children:(0,$.jsx)(Rt,{className:`animate-spin text-primary`,size:20})}):e?n===`preview`?(0,$.jsx)(`div`,{className:`max-h-[500px] overflow-auto rounded-md border border-border/70 bg-muted/20 p-4`,children:(0,$.jsx)(gn,{content:e})}):(0,$.jsx)(`div`,{className:`max-h-[500px] overflow-auto whitespace-pre-wrap rounded-md border border-border/70 bg-muted/30 p-4 font-mono text-xs leading-relaxed text-muted-foreground`,children:e}):(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.`})]})},ea={"git-pull-request":Xe,"flask-conical":Qe,package:qe,database:Je,"shield-check":Ze,terminal:bn,zap:it,cpu:nt,layers:Ge,boxes:Vt};function ta({ws:e,showToast:t}){let[n,r]=(0,Q.useState)(``),[i,a]=(0,Q.useState)({}),[o,s]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(null),[d,p]=(0,Q.useState)(!1),{data:m=[],isLoading:h}=vt(),{data:g=[],isLoading:_}=Jt(e.branchName),{data:v=[],isLoading:y}=en(),{data:b,isLoading:x,isError:S}=cn(e.branchName),C=At(),w=Et(),T=(0,Q.useMemo)(()=>new Set(o??b?.enabledSkills??[]),[o,b?.enabledSkills]),E=(0,Q.useMemo)(()=>new Set(l??b?.enabledAgents??[]),[l,b?.enabledAgents]);(0,Q.useEffect)(()=>{b&&(s([...b.enabledSkills??[]]),u([...b.enabledAgents??[]]))},[b]);let D=(0,Q.useMemo)(()=>{if(!b||o===null||l===null)return!1;let e=new Set(b.enabledSkills??[]),t=new Set(b.enabledAgents??[]);return!!(o.length!==e.size||o.some(t=>!e.has(t))||l.length!==t.size||l.some(e=>!t.has(e)))},[b,o,l]),O=e=>{a(t=>({...t,[e]:!t[e]}))},k=e=>{if(o===null)return;let t=new Set(o);t.has(e)?t.delete(e):t.add(e),s(Array.from(t))},A=e=>{if(l===null)return;let t=new Set(l);t.has(e)?t.delete(e):t.add(e),u(Array.from(t))},j=(e,t,n)=>{if(o===null)return;let r=new Set(o);for(let e of n)t?r.add(e.id):r.delete(e.id);s(Array.from(r))},M=async()=>{if(!(!b||o===null||l===null)){p(!0);try{await C.mutateAsync({workspaceId:e.branchName,expectedRevision:b.revision??0,enabledSkills:o,enabledAgents:l,enabledCategories:m.map(e=>e.id)}),await w.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{p(!1)}}},N=(0,Q.useMemo)(()=>{if(!n.trim())return g;let e=n.toLowerCase();return g.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)))},[g,n]),P=(0,Q.useMemo)(()=>{if(!n.trim())return v;let e=n.toLowerCase();return v.filter(t=>t.name.toLowerCase().includes(e)||t.description.toLowerCase().includes(e)||t.category.toLowerCase().includes(e))},[v,n]),F=(0,Q.useMemo)(()=>{let e={};for(let t of m)e[t.id]=N.filter(e=>e.category===t.id);return e},[m,N]);return h||_||y||x?(0,$.jsxs)(`div`,{className:`flex items-center justify-center p-12 gap-3 text-muted-foreground`,children:[(0,$.jsx)(X,{}),(0,$.jsx)(`span`,{className:`text-sm`,children:`Loading workspace skills...`})]}):S?(0,$.jsx)(Dn,{className:`py-12 border border-dashed rounded-xl`,children:(0,$.jsxs)(En,{children:[(0,$.jsx)(Cn,{children:`Could not load workspace skills config`}),(0,$.jsx)(Tn,{children:`Unable to read .nexusflow/skills.json for this workspace.`})]})}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,$.jsxs)(Sn,{className:`p-4 bg-card/70 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)(Vt,{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)(xn,{variant:`secondary`,className:`text-[10px] font-mono`,children:[T.size,` Skills Active`]}),E.size>0&&(0,$.jsxs)(xn,{variant:`secondary`,className:`text-[10px] font-mono`,children:[E.size,` Agents Active`]})]}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:`Choose which reusable Agent Skills and Codex Agents to deploy into this workspace.`})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)(f,{size:`sm`,onClick:M,disabled:d||!D&&T.size===0&&E.size===0,className:`flex items-center gap-1.5 shadow-sm`,children:[d?(0,$.jsx)(X,{className:`size-3.5`}):(0,$.jsx)(xt,{className:`size-3.5`}),(0,$.jsx)(`span`,{children:d?`Deploying…`:D?`Save & Deploy Changes`:`Re-Deploy to Workspace`})]}),(0,$.jsxs)(f,{render:(0,$.jsx)(jt,{to:`/skills`}),variant:`outline`,size:`sm`,className:`flex items-center gap-1.5`,children:[(0,$.jsx)(un,{className:`size-3.5`}),(0,$.jsx)(`span`,{children:`Resource Library`})]})]})]}),(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(wt,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground`}),(0,$.jsx)(Ee,{value:n,onChange:e=>r(e.target.value),placeholder:`Filter skills & agents by keyword...`,className:`pl-9 pr-8 h-8 text-xs bg-card`}),n&&(0,$.jsx)(`button`,{onClick:()=>r(``),className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,children:(0,$.jsx)(Ot,{className:`h-3.5 w-3.5`})})]}),(0,$.jsxs)(`div`,{className:`space-y-3`,children:[m.map(e=>{let t=ea[e.icon||`boxes`]||Vt,r=F[e.id]||[];if(n&&r.length===0)return null;let a=!!i[e.id],o=r.length>0&&r.every(e=>T.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":!a,onClick:()=>O(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),O(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)(xn,{variant:`outline`,className:`text-[9px] px-1 py-0`,children:[r.filter(e=>T.has(e.id)).length,`/`,r.length,` active`]})]})})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,onClick:e=>e.stopPropagation(),children:[r.length>0&&(0,$.jsxs)(f,{variant:`ghost`,size:`xs`,onClick:()=>j(e.id,!o,r),className:`h-6 text-[11px] px-2 text-muted-foreground hover:text-foreground`,children:[o?(0,$.jsx)(Ye,{className:`h-3 w-3 mr-1 text-primary`}):(0,$.jsx)($e,{className:`h-3 w-3 mr-1`}),(0,$.jsx)(`span`,{children:o?`Deselect All`:`Select All`})]}),(0,$.jsx)(`div`,{className:`p-0.5 text-muted-foreground`,children:a?(0,$.jsx)(et,{className:`h-4 w-4`}):(0,$.jsx)(We,{className:`h-4 w-4`})})]})]}),!a&&(0,$.jsx)(`div`,{className:`p-3 border-t border-border/40 bg-background/50`,children:r.length===0?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground py-2 text-center`,children:`No skills in this category.`}):(0,$.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-2.5`,children:r.map(e=>{let t=T.has(e.id);return(0,$.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:()=>k(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),k(e.id))},className:c(`p-3 rounded-lg border text-left cursor-pointer transition-all flex flex-col justify-between select-none shadow-2xs`,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`,{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:c(`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)(Y,{className:`size-3 stroke-[3]`})}),(0,$.jsx)(`span`,{className:`font-mono text-xs font-semibold truncate`,children:e.title||e.name})]}),(0,$.jsx)(xn,{variant:`outline`,className:`text-[9px] px-1 py-0 shrink-0`,children:e.custom?`Custom`:`Template`})]}),(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,3).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)})})})]},e.id)}),P.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)(Ue,{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)(xn,{variant:`outline`,className:`text-[9px] px-1 py-0`,children:[P.filter(e=>E.has(e.id)).length,`/`,P.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:P.map(e=>{let t=E.has(e.id);return(0,$.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:()=>A(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),A(e.id))},className:c(`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:c(`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)(Y,{className:`size-3 stroke-[3]`})}),(0,$.jsx)(`span`,{className:`font-mono text-xs font-semibold truncate`,children:e.name})]}),(0,$.jsx)(xn,{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)})})})]})]}),(0,$.jsxs)(`p`,{className:`text-[11px] text-muted-foreground`,children:[`Saving & deploying will write to `,(0,$.jsx)(`code`,{className:`font-mono text-xs text-foreground`,children:`.nexusflow/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/`}),`.`]})]})}var na=(e,t)=>{let n=`${e} ${t}`.toLowerCase();return n.includes(`insiders`)?(0,$.jsx)(kn,{size:15,className:`text-[#24C05A] shrink-0`}):n.includes(`code`)||n.includes(`vscode`)?(0,$.jsx)(An,{size:15,className:`text-[#007ACC] shrink-0`}):n.includes(`antigravity`)?(0,$.jsx)(vn,{className:`size-3.5 shrink-0`}):n.includes(`cursor`)?(0,$.jsx)(xt,{size:14,className:`text-purple-400 shrink-0`}):n.includes(`powershell`)||n.includes(`pwsh`)?(0,$.jsx)(bn,{size:14,className:`text-sky-400 shrink-0`}):n.includes(`cmd`)||n.includes(`command prompt`)?(0,$.jsx)(bn,{size:14,className:`text-amber-400 shrink-0`}):(0,$.jsx)(tt,{size:14,className:`shrink-0`})},ra=[{value:`overview`,label:`Overview`},{value:`changes`,label:`Changes`},{value:`services`,label:`Services`},{value:`sessions`,label:`Sessions`},{value:`knowledge`,label:`Knowledge`},{value:`plan`,label:`Plan`},{value:`skills`,label:`Skills`}];function ia(e){let{workspaces:t,workspaceStatuses:n,selectedId:r,subTab:i,onSelectTab:a,handleCopyPrompt:o,handleDeleteWorkspace:s,deleteWsLoading:l,repos:u,addRepoLoading:d,handleAddRepo:p,showToast:m,sessionProps:h,changesProps:g,knowledgeProps:_,planProps:v}=e,y=t.find(e=>e.branchName===r)??null,b=y?.mode??`worktree`,x=Ut(y?.branchName??null).data?.services??[],S=cn(y?.branchName??null).data,{data:C=[],isLoading:w}=Jt(y?.branchName),T=C.filter(e=>S?.enabledSkills?.includes(e.id)),E=y?y.repos.map(e=>{let t=on(e),n=g.gitChanges?.find(e=>e.repoName===t),r=n?n.files?.length??0:null,i=x.filter(e=>(e.cwd??``).split(/[\\/]/).includes(t));return{name:t,changedCount:r,ports:Array.from(new Set(i.map(e=>e.port).filter(e=>typeof e==`number`))),serviceCount:i.length}}):[],D=y?u.filter(e=>!y.repos.includes(e.path)):[],O=fn(),[k,A]=(0,Q.useState)(null),j=O.data?.filter(e=>e.kind===`editor`&&e.available)??[],M=j.find(e=>e.id===`vscode-insiders`)||j.find(e=>e.id===`vscode`)||j[0],N=async e=>{if(!(k||!y)){A(e);try{await Gt(`/api/workspace/${encodeURIComponent(y.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{A(null)}}};return(0,$.jsx)(`div`,{className:`flex flex-col h-full animate-fade-in w-full min-w-0 bg-background`,children:y?(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(!y)return null;let e=n[y.branchName],t=b===`in-place`?null:e?dn(e.syncStatus):null;return(0,$.jsxs)(`div`,{className:`flex flex-col min-w-0 pb-8`,children:[(0,$.jsx)(`div`,{className:`border-b border-border/80 bg-card/40 px-5 py-4`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 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`,children:[(0,$.jsx)(`h1`,{className:`truncate font-mono text-base sm:text-lg font-bold text-foreground tracking-tight`,title:y.branchName,children:y.branchName}),(0,$.jsx)(`button`,{type:`button`,onClick:async()=>{await pn(y.branchName)&&m?.(`Copied branch name to clipboard.`,`success`)},className:`text-muted-foreground hover:text-foreground transition-colors p-0.5 cursor-pointer`,title:`Copy branch name`,children:(0,$.jsx)(Tt,{size:13})}),(0,$.jsx)(`span`,{className:`inline-flex items-center rounded border border-border/80 bg-muted/60 px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground uppercase tracking-wider`,children:b===`in-place`?`In-place`:`Worktree`})]}),(0,$.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-2.5 font-mono text-[11px] text-muted-foreground`,children:[(0,$.jsxs)(`span`,{children:[y.repos.length,` `,y.repos.length===1?`repo`:`repos`]}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsxs)(`span`,{children:[`Created `,new Date(y.createdAt).toLocaleDateString()]}),e&&e.changedFiles>0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`•`}),(0,$.jsxs)(`span`,{className:`flex items-center gap-1 text-amber-400 font-semibold`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-400`}),e.changedFiles,` modified`]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`•`}),(0,$.jsxs)(`span`,{className:`flex items-center gap-1 text-emerald-400`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-emerald-400`}),`Clean`]})]}),e&&e.runningServices>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`•`}),(0,$.jsxs)(`span`,{className:`flex items-center gap-1 text-emerald-400`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-emerald-400 animate-pulse`}),e.runningServices,` active`]})]}),t&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`•`}),(0,$.jsxs)(`span`,{className:`flex items-center gap-1 text-primary`,children:[(0,$.jsx)(Rt,{size:10}),` `,t.label]})]})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[M&&(j.length>1?(0,$.jsxs)(`div`,{className:`inline-flex h-8 items-center rounded-md border border-border bg-card shadow-xs`,children:[(0,$.jsxs)(`button`,{type:`button`,disabled:!!k,onClick:()=>void N(M.id),title:`Open workspace in ${M.name}`,className:`inline-flex h-full items-center gap-1.5 px-3 text-xs font-semibold text-foreground hover:bg-accent transition-colors cursor-pointer rounded-l-md`,children:[k===M.id?(0,$.jsx)(X,{className:`size-3.5`}):na(M.id,M.name),(0,$.jsx)(`span`,{children:M.name})]}),(0,$.jsxs)(rn,{children:[(0,$.jsx)(Xt,{className:`inline-flex h-full w-6 items-center justify-center text-muted-foreground hover:text-foreground hover:bg-accent border-l border-border transition-colors cursor-pointer rounded-r-md`,children:(0,$.jsx)(We,{size:12})}),(0,$.jsxs)(qt,{align:`end`,className:`w-52`,children:[(0,$.jsx)(`div`,{className:`px-2 py-1 text-[10px] font-semibold text-muted-foreground uppercase tracking-wider`,children:`Open Workspace In`}),j.map(e=>(0,$.jsxs)(Z,{onClick:()=>void N(e.id),className:c(`flex items-center justify-between text-xs`,e.id===M.id&&`font-semibold text-primary`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[na(e.id,e.name),(0,$.jsx)(`span`,{className:`truncate`,children:e.name})]}),e.id===M.id&&(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground font-mono`,children:`(default)`})]},e.id))]})]})]}):(0,$.jsxs)(f,{variant:`outline`,size:`sm`,disabled:!!k,onClick:()=>void N(M.id),title:`Open workspace in ${M.name}`,className:`font-medium`,children:[k===M.id?(0,$.jsx)(X,{className:`size-3.5`}):na(M.id,M.name),(0,$.jsx)(`span`,{children:M.name})]})),(0,$.jsxs)(rn,{children:[(0,$.jsx)(Xt,{className:`grid size-8 place-items-center rounded-md border border-border bg-card text-muted-foreground hover:text-foreground hover:bg-accent transition-colors cursor-pointer`,children:(0,$.jsx)(Mn,{size:14})}),(0,$.jsxs)(qt,{align:`end`,className:`w-48`,children:[(0,$.jsxs)(Z,{onClick:()=>o(y),className:`flex items-center gap-2 text-xs`,children:[(0,$.jsx)(Tt,{size:13}),` `,(0,$.jsx)(`span`,{children:`Copy AI Context`})]}),(0,$.jsxs)(Z,{onClick:()=>void s(y.branchName),disabled:l===y.branchName,className:`flex items-center gap-2 text-xs text-destructive hover:bg-destructive/10`,children:[(0,$.jsx)(rt,{size:13}),(0,$.jsx)(`span`,{children:l===y.branchName?`Deleting…`:`Delete Workspace`})]})]})]})]})]})}),(0,$.jsx)(`div`,{className:`px-5 pt-3`,children:(0,$.jsxs)(kr,{value:i,onValueChange:e=>typeof e==`string`&&a(y.branchName,e),className:`mb-4`,children:[(0,$.jsx)(Ar,{className:`max-w-full overflow-x-auto`,children:ra.map(e=>(0,$.jsx)(jr,{value:e.value,children:e.value===`sessions`?`AI & Sessions`:e.label},e.value))}),(0,$.jsxs)(`section`,{"aria-labelledby":`embedded-harness-heading`,"aria-hidden":i!==`sessions`,className:c(`space-y-2 pt-3`,i!==`sessions`&&`hidden`),children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{id:`embedded-harness-heading`,className:`text-sm font-semibold text-foreground`,children:`Embedded harness`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Start a first-party SDK or local CLI session in this workspace and choose its execution profile and model.`})]}),(0,$.jsx)(`div`,{className:`h-[36rem] min-h-[28rem] overflow-hidden rounded-xl border border-border bg-card shadow-sm`,children:(0,$.jsx)(Yi,{ws:y},y.branchName)})]}),(0,$.jsxs)(Mr,{value:i,className:`animate-fade-in pt-3`,children:[i===`overview`&&(0,$.jsx)(`div`,{className:`flex flex-col gap-3`,children:(0,$.jsxs)(Sn,{className:`divide-y divide-border overflow-hidden surface-card`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 p-4 sm:flex-row sm:items-center sm:justify-between bg-muted/20`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`span`,{className:`grid size-9 place-items-center rounded-lg border border-border bg-card text-foreground shadow-xs`,children:y.assistants[0]===`claude`?(0,$.jsx)(It,{className:`size-4 text-[#D97757]`}):y.assistants[0]===`codex`?(0,$.jsx)(tn,{className:`size-4 text-foreground`}):y.assistants[0]===`copilot`?(0,$.jsx)(_n,{className:`size-4 text-blue-400`}):(0,$.jsx)(vn,{className:`size-5`})}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`h3`,{className:`text-xs sm:text-sm font-semibold text-foreground capitalize`,children:y.assistants[0]||`Antigravity`}),(0,$.jsx)($t,{tone:`running`,children:`Configured AI`})]}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:`Workspace rules, prompt templates, and skills ready.`})]})]}),(0,$.jsx)(f,{size:`sm`,variant:`default`,onClick:()=>a(y.branchName,`sessions`),children:`AI Sessions & Harnesses →`})]}),y.description&&(0,$.jsxs)(`div`,{className:`p-4`,children:[(0,$.jsx)(`h4`,{className:`text-[11px] font-semibold uppercase tracking-wider text-muted-foreground mb-1.5`,children:`Description`}),(0,$.jsx)(`div`,{className:`text-xs sm:text-sm leading-relaxed text-foreground/90`,children:(0,$.jsx)(gn,{content:y.description})})]}),(0,$.jsxs)(`div`,{className:`p-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,$.jsxs)(`h4`,{className:`text-[11px] font-semibold uppercase tracking-wider text-muted-foreground`,children:[`Mapped Repositories (`,y.repos.length,`)`]}),D.length>0&&(0,$.jsx)(ai,{repos:D,disabled:d,onAdd:e=>{window.confirm(`Add repository "${on(e)}" to this workspace?\nThis creates a new git worktree and re-runs analysis.`)&&p(y.branchName,e)}})]}),(0,$.jsx)(`div`,{className:`divide-y divide-border/60`,children:E.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between py-2.5 first:pt-0 last:pb-0 text-xs`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 font-mono min-w-0`,children:[(0,$.jsx)(`span`,{className:c(`size-2 rounded-full shrink-0`,e.changedCount===null?`bg-muted-foreground`:e.changedCount>0?`bg-warning`:`bg-success`),title:e.changedCount===null?`Status unknown`:e.changedCount>0?`${e.changedCount} uncommitted changes`:`Clean`}),(0,$.jsx)(`span`,{className:`truncate font-semibold text-foreground`,children:e.name})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground font-mono shrink-0`,children:[e.ports.map(e=>(0,$.jsxs)(`span`,{className:`rounded border border-border bg-muted/80 px-1.5 py-0.5 text-[11px] text-running-foreground`,children:[`:`,e]},e)),(0,$.jsx)(`span`,{children:e.changedCount===null?`—`:e.changedCount>0?`${e.changedCount} changed`:`clean`})]})]},e.name))})]}),(0,$.jsxs)(`div`,{className:`p-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`h4`,{className:`text-[11px] font-semibold uppercase tracking-wider text-muted-foreground`,children:`Active Skills & Capabilities`}),(0,$.jsxs)(`span`,{className:c(`inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium font-mono border`,T.length>0?`border-primary/20 bg-primary/10 text-primary`:`border-border/70 bg-muted/60 text-muted-foreground`),children:[T.length,` active`]})]}),(0,$.jsxs)(f,{size:`xs`,variant:`outline`,onClick:()=>a(y.branchName,`skills`),className:`text-xs gap-1.5`,children:[(0,$.jsx)(Rn,{size:12}),(0,$.jsx)(`span`,{children:`Manage Skills`})]})]}),w?(0,$.jsx)(`div`,{className:`h-10 rounded bg-muted/40 animate-pulse`}):T.length===0?(0,$.jsxs)(`div`,{className:`rounded-md border border-dashed border-border/80 bg-muted/20 px-3 py-3 sm:flex sm:items-center sm:justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-foreground`,children:`No active skills configured`}),(0,$.jsx)(`p`,{className:`text-[11px] text-muted-foreground mt-0.5`,children:`Attach PR review toolkits, linters, or test runners to enhance AI assistant context in this workspace.`})]}),(0,$.jsx)(f,{size:`xs`,variant:`ghost`,onClick:()=>a(y.branchName,`skills`),className:`shrink-0 text-primary hover:text-primary mt-2 sm:mt-0 font-medium`,children:`Configure Skills →`})]}):(0,$.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-2`,children:T.map(e=>(0,$.jsxs)(`div`,{className:`flex flex-col justify-between p-2.5 rounded-md border border-border/80 bg-card/60 hover:bg-card transition-colors shadow-2xs gap-1.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 min-w-0`,children:[(0,$.jsx)(`span`,{className:`grid size-5 place-items-center rounded bg-primary/10 text-primary shrink-0`,children:(0,$.jsx)(Rn,{size:11})}),(0,$.jsx)(`span`,{className:`text-xs font-semibold text-foreground truncate`,title:e.title||e.name,children:e.title||e.name})]}),(0,$.jsx)(`span`,{className:c(`text-[10px] font-mono uppercase px-1 py-0.5 rounded border shrink-0`,e.custom?`border-purple-500/20 bg-purple-500/10 text-purple-400`:`border-border/70 bg-muted text-muted-foreground`),children:e.custom?`Custom`:`Template`})]}),e.description&&(0,$.jsx)(`p`,{className:`text-[11px] text-muted-foreground line-clamp-2 leading-relaxed`,children:e.description})]},e.id))})]})]})}),i===`sessions`&&(0,$.jsxs)(`section`,{"aria-labelledby":`session-history-heading`,className:`space-y-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{id:`session-history-heading`,className:`text-sm font-semibold text-foreground`,children:`Session history`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Inspect or resume sessions recorded by the installed harnesses.`})]}),(0,$.jsx)(li,{ws:y,showToast:m,...h})]}),i===`services`&&(0,$.jsx)(Xi,{ws:y}),i===`changes`&&(0,$.jsx)(Zi,{ws:y,...g}),i===`knowledge`&&(0,$.jsx)(Qi,{ws:y,..._}),i===`plan`&&(0,$.jsx)($i,{...v}),i===`skills`&&(0,$.jsx)(ta,{ws:y,showToast:m})]})]})})]})})()})}):(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)(Dn,{children:(0,$.jsxs)(En,{children:[(0,$.jsx)(wn,{variant:`icon`,children:(0,$.jsx)(Dt,{})}),(0,$.jsx)(Cn,{children:`No workspace selected`}),(0,$.jsx)(Tn,{children:`Select a workspace from the sidebar to inspect git changes, services, context, or launch AI assistants.`})]})})})})})}export{ia as WorkspacesPage};
@@ -1 +1 @@
1
- import{g as e,h as t,m as n}from"./button-BDDZnIHx.js";import{C as r,S as i,_ as a,b as o,g as s,h as c,x as l,y as u}from"./index-wy68EqfB.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 a(e,`alert-dialog`)}var p=e(),m=f,h=u;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)(s,{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)(o,{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)(c,{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)(l,{className:n(`text-muted-foreground text-sm`,e),"data-slot":`alert-dialog-description`,...t})}function C(e){return(0,p.jsx)(i,{"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-BDDZnIHx.js";import{C as r,S as i,_ as a,b as o,g as s,h as c,x as l,y as u}from"./index-CoNaATPd.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 a(e,`alert-dialog`)}var p=e(),m=f,h=u;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)(s,{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)(o,{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)(c,{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)(l,{className:n(`text-muted-foreground text-sm`,e),"data-slot":`alert-dialog-description`,...t})}function C(e){return(0,p.jsx)(i,{"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};