@qodeca/xezar 0.13.0 → 0.14.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 (250) hide show
  1. package/README.md +72 -39
  2. package/dist/agent-config/account-identity.d.ts +2 -8
  3. package/dist/agent-config/account-identity.js +54 -10
  4. package/dist/agent-config/account-identity.js.map +1 -1
  5. package/dist/agent-config/catalog.d.ts +49 -7
  6. package/dist/agent-config/catalog.js +107 -0
  7. package/dist/agent-config/catalog.js.map +1 -1
  8. package/dist/agent-config/model-settings/pi.d.ts +12 -6
  9. package/dist/agent-config/model-settings/pi.js +12 -6
  10. package/dist/agent-config/model-settings/pi.js.map +1 -1
  11. package/dist/agent-config/seed.js +10 -0
  12. package/dist/agent-config/seed.js.map +1 -1
  13. package/dist/contract/github.d.ts +15 -0
  14. package/dist/contract/index.d.ts +9 -0
  15. package/dist/contract/index.js +1527 -895
  16. package/dist/contract/mcp-api-reference.d.ts +174 -0
  17. package/dist/contract/mcp-audit.d.ts +103 -0
  18. package/dist/contract/mcp-discovery.d.ts +257 -0
  19. package/dist/contract/mcp-event-catalog.d.ts +121 -0
  20. package/dist/contract/mcp-event-catalog.test.d.ts +1 -0
  21. package/dist/contract/mcp-idempotency.d.ts +200 -0
  22. package/dist/contract/mcp-journal.d.ts +268 -0
  23. package/dist/contract/mcp-leader.d.ts +88 -0
  24. package/dist/contract/mcp-ownership.d.ts +78 -0
  25. package/dist/contract/mcp-versioning.d.ts +139 -0
  26. package/dist/contract/runs.d.ts +81 -0
  27. package/dist/core/agent-profiles.d.ts +15 -4
  28. package/dist/core/agent-profiles.js +22 -8
  29. package/dist/core/agent-profiles.js.map +1 -1
  30. package/dist/core/opencode-server-runner.js +71 -11
  31. package/dist/core/opencode-server-runner.js.map +1 -1
  32. package/dist/core/secret-redaction.d.ts +7 -1
  33. package/dist/core/secret-redaction.js +44 -10
  34. package/dist/core/secret-redaction.js.map +1 -1
  35. package/dist/index.js +138 -27
  36. package/dist/index.js.map +1 -1
  37. package/dist/machine-identity.d.ts +66 -0
  38. package/dist/machine-identity.js +96 -0
  39. package/dist/machine-identity.js.map +1 -0
  40. package/dist/mcp/adapters/claude-code.d.ts +41 -0
  41. package/dist/mcp/adapters/claude-code.js +40 -0
  42. package/dist/mcp/adapters/claude-code.js.map +1 -0
  43. package/dist/mcp/adapters/codex.d.ts +140 -0
  44. package/dist/mcp/adapters/codex.js +323 -0
  45. package/dist/mcp/adapters/codex.js.map +1 -0
  46. package/dist/mcp/adapters/opencode.d.ts +148 -0
  47. package/dist/mcp/adapters/opencode.js +528 -0
  48. package/dist/mcp/adapters/opencode.js.map +1 -0
  49. package/dist/mcp/adapters/pi-link.d.ts +102 -0
  50. package/dist/mcp/adapters/pi-link.js +235 -0
  51. package/dist/mcp/adapters/pi-link.js.map +1 -0
  52. package/dist/mcp/adapters/pi.d.ts +188 -0
  53. package/dist/mcp/adapters/pi.js +418 -0
  54. package/dist/mcp/adapters/pi.js.map +1 -0
  55. package/dist/mcp/api-reference.d.ts +26 -0
  56. package/dist/mcp/api-reference.js +133 -0
  57. package/dist/mcp/api-reference.js.map +1 -0
  58. package/dist/mcp/audit-trail.d.ts +162 -0
  59. package/dist/mcp/audit-trail.js +306 -0
  60. package/dist/mcp/audit-trail.js.map +1 -0
  61. package/dist/mcp/bridge.d.ts +81 -0
  62. package/dist/mcp/bridge.js +407 -0
  63. package/dist/mcp/bridge.js.map +1 -0
  64. package/dist/mcp/connection-file.d.ts +49 -0
  65. package/dist/mcp/connection-file.js +63 -0
  66. package/dist/mcp/connection-file.js.map +1 -0
  67. package/dist/mcp/echo-guard.d.ts +94 -0
  68. package/dist/mcp/echo-guard.js +160 -0
  69. package/dist/mcp/echo-guard.js.map +1 -0
  70. package/dist/mcp/event-catalog.d.ts +120 -0
  71. package/dist/mcp/event-catalog.js +306 -0
  72. package/dist/mcp/event-catalog.js.map +1 -0
  73. package/dist/mcp/event-controller.d.ts +230 -0
  74. package/dist/mcp/event-controller.js +596 -0
  75. package/dist/mcp/event-controller.js.map +1 -0
  76. package/dist/mcp/event-journal.d.ts +57 -0
  77. package/dist/mcp/event-journal.js +423 -0
  78. package/dist/mcp/event-journal.js.map +1 -0
  79. package/dist/mcp/index.d.ts +63 -0
  80. package/dist/mcp/index.js +386 -0
  81. package/dist/mcp/index.js.map +1 -0
  82. package/dist/mcp/ipc.d.ts +202 -0
  83. package/dist/mcp/ipc.js +206 -0
  84. package/dist/mcp/ipc.js.map +1 -0
  85. package/dist/mcp/leader-delivery.d.ts +119 -0
  86. package/dist/mcp/leader-delivery.js +450 -0
  87. package/dist/mcp/leader-delivery.js.map +1 -0
  88. package/dist/mcp/operation-receipts.d.ts +210 -0
  89. package/dist/mcp/operation-receipts.js +723 -0
  90. package/dist/mcp/operation-receipts.js.map +1 -0
  91. package/dist/mcp/project-catalogs.d.ts +23 -0
  92. package/dist/mcp/project-catalogs.js +25 -0
  93. package/dist/mcp/project-catalogs.js.map +1 -0
  94. package/dist/mcp/project-leaders.d.ts +26 -0
  95. package/dist/mcp/project-leaders.js +17 -0
  96. package/dist/mcp/project-leaders.js.map +1 -0
  97. package/dist/mcp/protocol.d.ts +50 -0
  98. package/dist/mcp/protocol.js +47 -0
  99. package/dist/mcp/protocol.js.map +1 -0
  100. package/dist/mcp/reconnect.d.ts +297 -0
  101. package/dist/mcp/reconnect.js +465 -0
  102. package/dist/mcp/reconnect.js.map +1 -0
  103. package/dist/mcp/resource-ownership.d.ts +228 -0
  104. package/dist/mcp/resource-ownership.js +390 -0
  105. package/dist/mcp/resource-ownership.js.map +1 -0
  106. package/dist/mcp/service-adapter.d.ts +16488 -0
  107. package/dist/mcp/service-adapter.js +148 -0
  108. package/dist/mcp/service-adapter.js.map +1 -0
  109. package/dist/mcp/service.d.ts +83 -0
  110. package/dist/mcp/service.js +233 -0
  111. package/dist/mcp/service.js.map +1 -0
  112. package/dist/mcp/session-binding.d.ts +105 -0
  113. package/dist/mcp/session-binding.js +163 -0
  114. package/dist/mcp/session-binding.js.map +1 -0
  115. package/dist/mcp/stale-write.d.ts +145 -0
  116. package/dist/mcp/stale-write.js +219 -0
  117. package/dist/mcp/stale-write.js.map +1 -0
  118. package/dist/mcp/tool.d.ts +48 -0
  119. package/dist/mcp/tool.js +24 -0
  120. package/dist/mcp/tool.js.map +1 -0
  121. package/dist/mcp/tools/discovery.d.ts +40 -0
  122. package/dist/mcp/tools/discovery.js +232 -0
  123. package/dist/mcp/tools/discovery.js.map +1 -0
  124. package/dist/mcp/tools/execution-control.d.ts +171 -0
  125. package/dist/mcp/tools/execution-control.js +513 -0
  126. package/dist/mcp/tools/execution-control.js.map +1 -0
  127. package/dist/mcp/tools/handoff-git.d.ts +26 -0
  128. package/dist/mcp/tools/handoff-git.js +544 -0
  129. package/dist/mcp/tools/handoff-git.js.map +1 -0
  130. package/dist/mcp/tools/index.d.ts +2 -0
  131. package/dist/mcp/tools/index.js +23 -0
  132. package/dist/mcp/tools/index.js.map +1 -0
  133. package/dist/mcp/tools/leader-events.d.ts +46 -0
  134. package/dist/mcp/tools/leader-events.js +126 -0
  135. package/dist/mcp/tools/leader-events.js.map +1 -0
  136. package/dist/mcp/tools/local-handoff.d.ts +102 -0
  137. package/dist/mcp/tools/local-handoff.js +306 -0
  138. package/dist/mcp/tools/local-handoff.js.map +1 -0
  139. package/dist/mcp/tools/project-config.d.ts +340 -0
  140. package/dist/mcp/tools/project-config.js +1075 -0
  141. package/dist/mcp/tools/project-config.js.map +1 -0
  142. package/dist/mcp/tools/results-evidence.d.ts +112 -0
  143. package/dist/mcp/tools/results-evidence.js +1045 -0
  144. package/dist/mcp/tools/results-evidence.js.map +1 -0
  145. package/dist/mcp/tools/task-create.d.ts +70 -0
  146. package/dist/mcp/tools/task-create.js +473 -0
  147. package/dist/mcp/tools/task-create.js.map +1 -0
  148. package/dist/mcp/tools/task-reads.d.ts +102 -0
  149. package/dist/mcp/tools/task-reads.js +689 -0
  150. package/dist/mcp/tools/task-reads.js.map +1 -0
  151. package/dist/mcp/tools/work-organisation.d.ts +2 -0
  152. package/dist/mcp/tools/work-organisation.js +502 -0
  153. package/dist/mcp/tools/work-organisation.js.map +1 -0
  154. package/dist/paths.d.ts +17 -7
  155. package/dist/paths.js +18 -8
  156. package/dist/paths.js.map +1 -1
  157. package/dist/runs/project-writer.js +76 -11
  158. package/dist/runs/project-writer.js.map +1 -1
  159. package/dist/runs/retention.d.ts +25 -2
  160. package/dist/runs/retention.js +63 -2
  161. package/dist/runs/retention.js.map +1 -1
  162. package/dist/server/forge/github.js +44 -0
  163. package/dist/server/forge/github.js.map +1 -1
  164. package/dist/server/forge/types.d.ts +16 -0
  165. package/dist/server/project-context.d.ts +81 -8
  166. package/dist/server/project-context.js +143 -35
  167. package/dist/server/project-context.js.map +1 -1
  168. package/dist/server/server.d.ts +1050 -53
  169. package/dist/server/server.js +326 -120
  170. package/dist/server/server.js.map +1 -1
  171. package/dist/server/validators.d.ts +26 -6
  172. package/dist/server/validators.js +17 -0
  173. package/dist/server/validators.js.map +1 -1
  174. package/dist/skills-remote.js +64 -6
  175. package/dist/skills-remote.js.map +1 -1
  176. package/dist/workflows/run.d.ts +277 -12
  177. package/dist/workflows/run.js +599 -79
  178. package/dist/workflows/run.js.map +1 -1
  179. package/dist/workspace/agent-profiles.d.ts +30 -3
  180. package/dist/workspace/agent-profiles.js +39 -4
  181. package/dist/workspace/agent-profiles.js.map +1 -1
  182. package/dist/workspace/config.js +25 -4
  183. package/dist/workspace/config.js.map +1 -1
  184. package/dist/workspace/project-owner.d.ts +210 -0
  185. package/dist/workspace/project-owner.js +518 -0
  186. package/dist/workspace/project-owner.js.map +1 -0
  187. package/package.json +5 -3
  188. package/scripts/pi-leader-extension.ts +420 -0
  189. package/scripts/sync-readme.mjs +83 -2
  190. package/web/dist/assets/{alert-dialog-BVsVcbFy.js → alert-dialog-D6rP6d39.js} +1 -1
  191. package/web/dist/assets/arrow-down-DMOfFIzW.js +1 -0
  192. package/web/dist/assets/arrow-left-C4Ec2BUg.js +1 -0
  193. package/web/dist/assets/{centered-state-Djgly6Ni.js → centered-state-B0ZqrPaa.js} +12 -12
  194. package/web/dist/assets/chevron-right-mHJ-crvn.js +1 -0
  195. package/web/dist/assets/{collapsible-DZ4D-DHG.js → collapsible-DchEHgUM.js} +1 -1
  196. package/web/dist/assets/{commit-list-B-z1JL9G.js → commit-list-BpMim1Rv.js} +1 -1
  197. package/web/dist/assets/{compare-variants-CdS8r8E2.js → compare-variants-D5ItQbAq.js} +1 -1
  198. package/web/dist/assets/{diff-BKew9rQX.js → diff-HqqZ_WDR.js} +2 -2
  199. package/web/dist/assets/{diff-stat-D0mc5V6Z.js → diff-stat-NsU-3ecr.js} +1 -1
  200. package/web/dist/assets/{diff-view-xpIcuLIC.js → diff-view-B7c11Xux.js} +1 -1
  201. package/web/dist/assets/{dropdown-menu-CEQziH7X.js → dropdown-menu-CtTpnyod.js} +1 -1
  202. package/web/dist/assets/{editable-title-BCX3T2BY.js → editable-title-BXtuGQry.js} +1 -1
  203. package/web/dist/assets/{ellipsis-vertical-ByVdDc4z.js → ellipsis-vertical-MHtGZSH6.js} +1 -1
  204. package/web/dist/assets/{file-xBSB5hXO.js → file-DKLw5SOb.js} +1 -1
  205. package/web/dist/assets/{folder-CldgbZ5A.js → folder-Drw6-ufH.js} +1 -1
  206. package/web/dist/assets/{git-toolbar-BYlnf4qf.js → git-toolbar-BQH8bORV.js} +1 -1
  207. package/web/dist/assets/github-ynnpKFCJ.js +1 -0
  208. package/web/dist/assets/{image-preview-Cv5mZr0n.js → image-preview-DLhMN_R9.js} +1 -1
  209. package/web/dist/assets/index-BEsrNdXt.js +29 -0
  210. package/web/dist/assets/index-Da8DOBau.css +2 -0
  211. package/web/dist/assets/{markdown-CgEEE2ND.js → markdown-q365eN6Y.js} +1 -1
  212. package/web/dist/assets/{new-task-form-1r2bgsdD.js → new-task-form-CW-hNIWQ.js} +1 -1
  213. package/web/dist/assets/{pill-q-x22_ej.js → pill-B_TFulXa.js} +1 -1
  214. package/web/dist/assets/{project-router-VDN4jQM8.js → project-router-CLPc-ImZ.js} +1 -1
  215. package/web/dist/assets/{prompt-templates-BmZtCe-L.js → prompt-templates-CLc4RxyO.js} +1 -1
  216. package/web/dist/assets/{repo-git-C2On8SlI.js → repo-git-Is7R6-Tj.js} +1 -1
  217. package/web/dist/assets/{run-diff-vguEMJzh.js → run-diff-DHMvDlVo.js} +2 -2
  218. package/web/dist/assets/run-header-DvZJbQ8I.js +1 -0
  219. package/web/dist/assets/{search-x-QmhaAbg5.js → search-x-Ce2MMetu.js} +1 -1
  220. package/web/dist/assets/{skill-empty-hint-BrzUwByZ.js → skill-empty-hint-C_xCSvzB.js} +1 -1
  221. package/web/dist/assets/skills-CivqD4si.js +1 -0
  222. package/web/dist/assets/{sparkles-CP8QDOgX.js → sparkles-BCqPoj5g.js} +1 -1
  223. package/web/dist/assets/{square-terminal-CGypshSD.js → square-terminal-ikj5g-oK.js} +1 -1
  224. package/web/dist/assets/{tab-link-D4lFzzI1.js → tab-link-VsEjFV1Y.js} +1 -1
  225. package/web/dist/assets/{task-changes-6aopqAmV.js → task-changes-CH-E81-_.js} +1 -1
  226. package/web/dist/assets/{task-commits-u-dwaCyw.js → task-commits-DqfkMFxp.js} +1 -1
  227. package/web/dist/assets/{task-files-IMOZnIUK.js → task-files-D_nkHZ_a.js} +2 -2
  228. package/web/dist/assets/task-thread-bxQompxJ.js +9 -0
  229. package/web/dist/assets/{textarea-CyBCyKIk.js → textarea-xajuW1L_.js} +1 -1
  230. package/web/dist/assets/{thread-loading-Cuq2jchC.js → thread-loading-C3JQZbIE.js} +1 -1
  231. package/web/dist/assets/{trash-2-B6Dp3ZNs.js → trash-2-hJrBhpUD.js} +1 -1
  232. package/web/dist/assets/{triangle-alert-xBya8FUp.js → triangle-alert-D1u82y1a.js} +1 -1
  233. package/web/dist/assets/{upload-D6MXEB9p.js → upload-Bn6FBZ59.js} +1 -1
  234. package/web/dist/assets/{use-desktop-fLDKEJoB.js → use-desktop-DOIMfHfY.js} +1 -1
  235. package/web/dist/assets/{use-submit-shortcut-JTpNzU-u.js → use-submit-shortcut-Dj4DHTdE.js} +1 -1
  236. package/web/dist/assets/utils-YwBpOoRN.js +64 -0
  237. package/web/dist/assets/{workflows-BY3KTkFw.js → workflows-CTaAKz2m.js} +3 -3
  238. package/web/dist/assets/{zoomable-image-GTYwLtkS.js → zoomable-image-C1-6P3tg.js} +1 -1
  239. package/web/dist/index.html +23 -23
  240. package/web/dist/assets/arrow-down-CYgAlZtW.js +0 -1
  241. package/web/dist/assets/arrow-left-BOqE0a3k.js +0 -1
  242. package/web/dist/assets/chevron-right-Cc9BWnbN.js +0 -1
  243. package/web/dist/assets/github-CqGK62Lw.js +0 -1
  244. package/web/dist/assets/index-3nxVmdn5.css +0 -2
  245. package/web/dist/assets/index-qX7n11FX.js +0 -9
  246. package/web/dist/assets/refresh-cw-DcNCj2nu.js +0 -1
  247. package/web/dist/assets/run-header-DM7MiKj9.js +0 -1
  248. package/web/dist/assets/skills-Bj-uG_Hz.js +0 -1
  249. package/web/dist/assets/task-thread-CbMPmrWq.js +0 -9
  250. package/web/dist/assets/utils--z9hRtl3.js +0 -64
@@ -0,0 +1,29 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/task-thread-bxQompxJ.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-runtime-CCIEwYL0.js","assets/centered-state-B0ZqrPaa.js","assets/utils-YwBpOoRN.js","assets/bundle-mjs-BT31bpU6.js","assets/editable-title-BXtuGQry.js","assets/new-task-form-CW-hNIWQ.js","assets/dropdown-menu-CtTpnyod.js","assets/folder-Drw6-ufH.js","assets/sparkles-BCqPoj5g.js","assets/square-terminal-ikj5g-oK.js","assets/triangle-alert-D1u82y1a.js","assets/pill-B_TFulXa.js","assets/markdown-q365eN6Y.js","assets/alert-dialog-D6rP6d39.js","assets/chunk-BO2N2NFS-DE6qKn3r.js","assets/lib-BxQXEXDF.js","assets/highlighter-C8DK1_sG.js","assets/arrow-down-DMOfFIzW.js","assets/thread-loading-C3JQZbIE.js","assets/prompt-templates-CLc4RxyO.js","assets/use-submit-shortcut-Dj4DHTdE.js","assets/textarea-xajuW1L_.js","assets/skills-D4P-Hgey.js","assets/chevron-right-mHJ-crvn.js","assets/run-header-DvZJbQ8I.js","assets/trash-2-hJrBhpUD.js","assets/ellipsis-vertical-MHtGZSH6.js","assets/collapsible-DchEHgUM.js","assets/project-router-CLPc-ImZ.js","assets/diff-stat-NsU-3ecr.js","assets/tab-link-VsEjFV1Y.js","assets/search-x-Ce2MMetu.js","assets/lib-BQXq3kEf.js","assets/zoomable-image-C1-6P3tg.js","assets/run-diff-DHMvDlVo.js","assets/compare-variants-D5ItQbAq.js","assets/task-changes-CH-E81-_.js","assets/use-desktop-DOIMfHfY.js","assets/diff-HqqZ_WDR.js","assets/image-preview-DLhMN_R9.js","assets/git-toolbar-BQH8bORV.js","assets/file-DKLw5SOb.js","assets/upload-Bn6FBZ59.js","assets/task-files-D_nkHZ_a.js","assets/task-commits-DqfkMFxp.js","assets/arrow-left-C4Ec2BUg.js","assets/commit-list-BpMim1Rv.js","assets/repo-git-Is7R6-Tj.js","assets/github-ynnpKFCJ.js","assets/workflows-CTaAKz2m.js","assets/skill-empty-hint-C_xCSvzB.js","assets/skills-CivqD4si.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,n,t as r}from"./react-runtime-CCIEwYL0.js";import{$t as i,A as a,Ar as o,B as s,Br as c,Bt as l,C as u,Cn as d,Cr as f,D as p,Dn as m,Dr as h,Er as g,F as _,Fn as v,Fr as y,Ft as b,Gn as x,Gt as S,H as C,Hr as w,Ht as T,I as E,Ir as D,It as ee,Jr as O,Jt as te,Kn as ne,Kt as re,L as ie,Ln as ae,Lr as k,Lt as A,M as oe,Mn as se,Mr as ce,N as j,Nr as M,Nt as N,O as le,On as ue,Or as de,P as fe,Pr as pe,Pt as me,Q as he,Qn as ge,R as _e,Rr as ve,Sr as ye,St as be,T as xe,Tn as Se,Tr as Ce,Tt as we,Ur as Te,Ut as Ee,Vn as De,Vr as Oe,Vt as ke,W as Ae,Wr as P,Wt as je,Xt as Me,Yr as Ne,Yt as F,Z as I,Zr as Pe,Zt as Fe,_ as Ie,_n as Le,_r as Re,_t as ze,a as L,ai as Be,an as Ve,at as He,b as Ue,bn as We,br as Ge,bt as Ke,ci as qe,cn as Je,di as Ye,dn as Xe,dr as Ze,dt as R,ei as Qe,en as $e,et,f as tt,fi as nt,fn as rt,ft as it,g as at,gn as ot,gr as st,h as ct,hn as lt,hr as ut,ht as dt,i as z,ii as ft,ir as pt,it as mt,j as B,jr as ht,k as gt,kr as _t,li as vt,ln as yt,lr as bt,mr as xt,mt as St,n as Ct,ni as wt,nn as Tt,nr as Et,oi as Dt,pn as Ot,pr as kt,pt as At,qn as jt,qr as Mt,qt as Nt,r as Pt,ri as Ft,rn as It,rt as Lt,si as Rt,st as zt,t as V,ti as Bt,tn as Vt,u as Ht,ui as Ut,un as Wt,ut as Gt,vn as Kt,vt as qt,wn as Jt,wr as Yt,x as Xt,y as Zt,yn as Qt,yr as $t,yt as en,z as tn,zn as nn,zr as rn,zt as an}from"./centered-state-B0ZqrPaa.js";import{a as on,n as sn,p as cn,r as H,s as ln,t as U,u as un}from"./utils-YwBpOoRN.js";import{i as dn}from"./bundle-mjs-BT31bpU6.js";import{A as fn,C as pn,D as mn,E as hn,F as gn,I as _n,M as vn,N as yn,O as bn,P as xn,S as Sn,T as Cn,_ as wn,a as Tn,b as En,h as Dn,i as On,k as kn,m as An,n as jn,t as Mn,v as Nn,w as Pn,x as Fn,y as In}from"./editable-title-BXtuGQry.js";import{t as Ln}from"./arrow-down-DMOfFIzW.js";import{a as Rn,d as zn,f as Bn,h as Vn,i as Hn,l as Un,n as Wn,o as Gn,p as Kn,r as qn,t as Jn,u as Yn}from"./thread-loading-C3JQZbIE.js";import{C as Xn,S as Zn,a as Qn,b as $n,c as er,d as tr,f as nr,g as rr,h as ir,i as ar,l as or,m as sr,n as cr,o as lr,p as ur,r as dr,s as fr,t as pr,u as mr,v as hr,x as gr,y as _r}from"./new-task-form-CW-hNIWQ.js";import{t as vr}from"./chevron-right-mHJ-crvn.js";import{_ as yr,b as br,c as xr,d as Sr,f as Cr,g as wr,h as Tr,i as Er,l as Dr,m as Or,n as kr,p as Ar,r as jr,s as Mr,t as Nr,u as Pr,v as Fr,x as Ir}from"./dropdown-menu-CtTpnyod.js";import{C as Lr,S as Rr,_ as zr,a as Br,b as Vr,c as Hr,d as Ur,f as Wr,g as W,h as Gr,i as Kr,l as qr,m as Jr,n as Yr,o as Xr,p as Zr,r as Qr,s as $r,t as ei,u as ti,v as G,x as ni,y as ri}from"./prompt-templates-CLc4RxyO.js";import{t as ii}from"./folder-Drw6-ufH.js";import{t as ai}from"./search-x-Ce2MMetu.js";import{t as oi}from"./sparkles-BCqPoj5g.js";import{t as si}from"./triangle-alert-D1u82y1a.js";import{n as ci,t as li}from"./textarea-xajuW1L_.js";import{a as ui,c as di,i as fi,n as pi,o as mi,r as hi,s as gi,t as _i}from"./alert-dialog-D6rP6d39.js";import{a as vi,c as yi,i as bi,l as xi,n as Si,o as Ci,r as wi,s as Ti}from"./use-submit-shortcut-Dj4DHTdE.js";import{a as Ei,c as Di,i as Oi,l as ki,n as Ai,o as ji,r as Mi,s as Ni,t as K}from"./project-router-CLPc-ImZ.js";import{a as Pi,c as q,i as Fi,n as Ii,o as Li,r as Ri,s as zi,t as Bi}from"./pill-B_TFulXa.js";import{r as Vi,t as Hi}from"./markdown-q365eN6Y.js";import{a as Ui,c as Wi,d as Gi,f as Ki,i as qi,l as Ji,o as Yi,s as Xi,t as Zi,u as Qi}from"./skills-D4P-Hgey.js";import{t as $i}from"./diff-stat-NsU-3ecr.js";import{i as ea,n as ta,r as na}from"./highlighter-C8DK1_sG.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var ra=class extends nt{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new Ne({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=ia(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=ia(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=ia(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=ia(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Bt.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Be(t,e))}findAll(e={}){return this.getAll().filter(t=>Be(e,t))}notify(e){Bt.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Bt.batch(()=>Promise.all(e.map(e=>e.continue().catch(Rt))))}};function ia(e){return e.options.scope?.id}var aa=class extends nt{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??ft(r,t),a=this.get(i);return a||(a=new Pe({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){Bt.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Dt(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Dt(e,t)):t}notify(e){Bt.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Bt.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Bt.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},oa=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new aa,this.#t=e.mutationCache||new ra,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Ye.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Qe.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(vt(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=wt(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Bt.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;Bt.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Bt.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=Bt.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Rt).catch(Rt)}invalidateQueries(e,t={}){return Bt.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=Bt.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(Rt)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(Rt)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(vt(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Rt).catch(Rt)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Rt).catch(Rt)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Qe.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(Ft(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{qe(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Ft(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{qe(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=ft(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===Ut&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},J=e(t(),1),sa=n();function ca(e,t){if(e===`ping`)return{project:null,event:{type:`ping`}};let n;try{n=JSON.parse(t)}catch{return null}if(!la(n))return null;let r=n.project;if(typeof r!=`string`||r===``)return null;switch(e){case`run`:{let{project:e,...t}=n;return ua(t)?{project:r,event:{type:`run`,run:t}}:null}case`run-deleted`:{let e=n.id;return typeof e==`string`&&e?{project:r,event:{type:`run-deleted`,id:e}}:null}case`todos`:return Array.isArray(n.items)?{project:r,event:{type:`todos`,items:n.items}}:null;case`usage`:return la(n.usage)?{project:r,event:{type:`usage`,usage:n.usage}}:null;default:return null}}function la(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ua(e){return la(e)&&typeof e.id==`string`&&e.id!==``}function da(e,t){if(!e)return;let n=e.findIndex(e=>e.id===t.id);if(n>=0){let r=[...e];return r[n]=pa(e[n],t),r}let r=t.createdAt??``,i=e.findIndex(e=>(e.createdAt??``).localeCompare(r)<0),a=[...e];return a.splice(i<0?e.length:i,0,t),a}function fa(e,t){if(!e)return;let n=e.filter(e=>e.id!==t);return n.length===e.length?e:n}function pa(e,t){return e?.usage?{...t,usage:e.usage}:t}var ma=Object.freeze({});function ha(){let e=ma,t=new Set;return{subscribe(e){return t.add(e),()=>t.delete(e)},get:()=>e,set(n){e=n;for(let e of t)e()}}}var Y=r(),ga=on(`/workspace/events`),_a=2,va=3e3,ya=[`run`,`run-deleted`,`todos`,`usage`,`ping`],ba=[`project-added`,`project-removed`,`checkout-progress`,`automation-change`],xa=new Set;function Sa(e){return xa.add(e),()=>{xa.delete(e)}}var Ca=400;function wa(e){let t;return{onEvent(n){n.type!==`run`&&n.type!==`run-deleted`||t===void 0&&(t=setTimeout(()=>{t=void 0,e.invalidateQueries({queryKey:F.runsIndex})},Ca))},cancel(){clearTimeout(t),t=void 0}}}function Ta(e){e.invalidateQueries({queryKey:B.runs.all}),e.invalidateQueries({queryKey:F.runsIndex}),e.invalidateQueries({queryKey:B.todos}),e.invalidateQueries({queryKey:B.health}),e.invalidateQueries({queryKey:B.worktrees}),e.invalidateQueries({queryKey:F.providerStatus})}function Ea(e){return ln()??e.getQueryData(B.health)?.bootProject}function Da(e,t,n){switch(n.type){case`run`:{e.setQueryData(B.runs.list(),e=>da(e,n.run));let t=B.runs.detail(n.run.id);e.getQueryData(t)!==void 0&&e.setQueryData(t,e=>pa(e,n.run));let r=B.runs.changes(n.run.id);e.getQueryData(r)!==void 0&&e.invalidateQueries({queryKey:r}),e.invalidateQueries({queryKey:B.worktrees});return}case`run-deleted`:e.setQueryData(B.runs.list(),e=>fa(e,n.id)),e.removeQueries({queryKey:B.runs.detail(n.id)}),e.removeQueries({queryKey:B.runs.diff(n.id)}),e.invalidateQueries({queryKey:B.worktrees});return;case`todos`:e.setQueryData(B.todos,n.items);return;case`usage`:t.set(n.usage);return;case`ping`:return}}function Oa(e,t=ga){let n=O();(0,J.useEffect)(()=>{let r=globalThis.EventSource;if(typeof r!=`function`)return;let i=null,a=wa(n),o,s=!1,c=!1,l=!1,u=!1,d=()=>{l=!0,u=!1;let e=F.providerStatus;n.cancelQueries({queryKey:e,exact:!0}).then(()=>n.invalidateQueries({queryKey:e,exact:!0,refetchType:`active`})).finally(()=>{if(c||!u){l=!1;return}d()})},f=()=>{c||o!==void 0||(o=setTimeout(()=>{o=void 0,c||p()},va))},p=()=>{i?.close(),i=new r(t,{withCredentials:!0}),i.addEventListener(`open`,()=>{s&&Ta(n),s=!0});for(let t of ya)i.addEventListener(t,r=>{let i=ca(t,r.data);i&&(a.onEvent(i.event),!(i.project!==null&&i.project!==Ea(n))&&Da(n,e,i.event))});for(let e of ba)i.addEventListener(e,t=>{let r;try{r=JSON.parse(t.data)}catch{return}e!==`checkout-progress`&&e!==`automation-change`&&n.invalidateQueries({queryKey:F.projects});for(let t of[...xa])t(e,r)});i.addEventListener(`provider-status`,e=>{let t;try{t=JSON.parse(e.data)}catch{return}let r=de(t);if(!r)return;let i=F.providerStatus,a=h(n.getQueryData(i),r);if(a!==void 0){n.setQueryData(i,a);return}if(l){u=!0;return}d()}),i.addEventListener(`error`,()=>{i?.readyState===_a&&f()})},m=()=>{document.visibilityState===`visible`&&(Ta(n),(!i||i.readyState===_a)&&(clearTimeout(o),o=void 0,p()))},g=()=>{clearTimeout(o),o=void 0,i?.close()},_=e=>{e.persisted&&(Ta(n),p())};return document.addEventListener(`visibilitychange`,m),window.addEventListener(`pagehide`,g),window.addEventListener(`pageshow`,_),p(),()=>{c=!0,clearTimeout(o),a.cancel(),document.removeEventListener(`visibilitychange`,m),window.removeEventListener(`pagehide`,g),window.removeEventListener(`pageshow`,_),i?.close(),i=null}},[n,e,t])}var ka=(0,J.createContext)(null);function Aa({children:e}){let[t]=(0,J.useState)(ha);return Oa(t),he(),(0,Y.jsx)(ka.Provider,{value:t,children:e})}function ja(e){let t=(0,J.useContext)(ka),n=t?t.get:Na;return(0,J.useSyncExternalStore)(t?t.subscribe:Ma,()=>e?n()[e]:void 0,()=>void 0)}var Ma=()=>()=>void 0,Na=()=>ma;function Pa(){return new oa({defaultOptions:{queries:{refetchInterval:!1,staleTime:5*6e4,gcTime:30*6e4,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:(e,t)=>t instanceof Se&&t.status>=400&&t.status<500?!1:e<1},mutations:{retry:!1}}})}var Fa=H(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),Ia=H(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),La=H(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),Ra=H(`bookmark`,[[`path`,{d:`M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z`,key:`oz39mx`}]]),za=H(`cable`,[[`path`,{d:`M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z`,key:`trhst0`}],[`path`,{d:`M17 21v-2`,key:`ds4u3f`}],[`path`,{d:`M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10`,key:`1mo9zo`}],[`path`,{d:`M21 21v-2`,key:`eo0ou`}],[`path`,{d:`M3 5V3`,key:`1k5hjh`}],[`path`,{d:`M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z`,key:`1dd30t`}],[`path`,{d:`M7 5V3`,key:`1t1388`}]]),Ba=H(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),Va=H(`chevrons-left`,[[`path`,{d:`m11 17-5-5 5-5`,key:`13zhaf`}],[`path`,{d:`m18 17-5-5 5-5`,key:`h8a8et`}]]),Ha=H(`chevrons-right`,[[`path`,{d:`m6 17 5-5-5-5`,key:`xnjwq`}],[`path`,{d:`m13 17 5-5-5-5`,key:`17xmmf`}]]),Ua=H(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Wa=H(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),Ga=H(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Ka=H(`coins`,[[`path`,{d:`M13.744 17.736a6 6 0 1 1-7.48-7.48`,key:`bq4yh3`}],[`path`,{d:`M15 6h1v4`,key:`11y1tn`}],[`path`,{d:`m6.134 14.768.866-.5 2 3.464`,key:`17snzx`}],[`circle`,{cx:`16`,cy:`8`,r:`6`,key:`14bfc9`}]]),qa=H(`compass`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}]]),Ja=H(`corner-left-up`,[[`path`,{d:`M14 9 9 4 4 9`,key:`1af5af`}],[`path`,{d:`M20 20h-7a4 4 0 0 1-4-4V4`,key:`1blwi3`}]]),Ya=H(`dollar-sign`,[[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`22`,key:`7eqyqh`}],[`path`,{d:`M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6`,key:`1b0p4s`}]]),Xa=H(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Za=H(`file-cog`,[[`path`,{d:`M15 8a1 1 0 0 1-1-1V2a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8z`,key:`1ckgky`}],[`path`,{d:`M20 8v12a2 2 0 0 1-2 2h-4.182`,key:`1726p0`}],[`path`,{d:`m3.305 19.53.923-.382`,key:`ao1pio`}],[`path`,{d:`M4 10.592V4a2 2 0 0 1 2-2h8`,key:`1foop0`}],[`path`,{d:`m4.228 16.852-.924-.383`,key:`1fv9zy`}],[`path`,{d:`m5.852 15.228-.383-.923`,key:`1a9hc2`}],[`path`,{d:`m5.852 20.772-.383.924`,key:`1sh9ke`}],[`path`,{d:`m8.148 15.228.383-.923`,key:`4yu6lf`}],[`path`,{d:`m8.53 21.696-.382-.924`,key:`18b0s9`}],[`path`,{d:`m9.773 16.852.922-.383`,key:`ti6xop`}],[`path`,{d:`m9.773 19.148.922.383`,key:`rws47d`}],[`circle`,{cx:`7`,cy:`18`,r:`3`,key:`lvkj7j`}]]),Qa=H(`file-diff`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M9 10h6`,key:`9gxzsh`}],[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`path`,{d:`M9 17h6`,key:`r8uit2`}]]),$a=H(`folder-git-2`,[[`path`,{d:`M18 19a5 5 0 0 1-5-5v8`,key:`sz5oeg`}],[`path`,{d:`M9 20H4a2 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.9H20a2 2 0 0 1 2 2v5`,key:`1w6njk`}],[`circle`,{cx:`13`,cy:`12`,r:`2`,key:`1j92g6`}],[`circle`,{cx:`20`,cy:`19`,r:`2`,key:`1obnsp`}]]),eo=H(`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`}]]),to=H(`folder-search`,[[`path`,{d:`M10.7 20H4a2 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.9H20a2 2 0 0 1 2 2v4.1`,key:`1bw5m7`}],[`path`,{d:`m21 21-1.9-1.9`,key:`1g2n9r`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}]]),no=H(`folders`,[[`path`,{d:`M20 5a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h2.5a1.5 1.5 0 0 1 1.2.6l.6.8a1.5 1.5 0 0 0 1.2.6z`,key:`a4852j`}],[`path`,{d:`M3 8.268a2 2 0 0 0-1 1.738V19a2 2 0 0 0 2 2h11a2 2 0 0 0 1.732-1`,key:`yxbcw3`}]]),ro=H(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),io=H(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),ao=H(`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`}]]),oo=H(`hourglass`,[[`path`,{d:`M5 22h14`,key:`ehvnwv`}],[`path`,{d:`M5 2h14`,key:`pdyrp9`}],[`path`,{d:`M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22`,key:`1d314k`}],[`path`,{d:`M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2`,key:`1vvvr6`}]]),so=H(`id-card`,[[`path`,{d:`M16 10h2`,key:`8sgtl7`}],[`path`,{d:`M16 14h2`,key:`epxaof`}],[`path`,{d:`M6.17 15a3 3 0 0 1 5.66 0`,key:`n6f512`}],[`circle`,{cx:`9`,cy:`11`,r:`2`,key:`yxgjnd`}],[`rect`,{x:`2`,y:`5`,width:`20`,height:`14`,rx:`2`,key:`qneu4z`}]]),co=H(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),lo=H(`keyboard`,[[`path`,{d:`M10 8h.01`,key:`1r9ogq`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M14 8h.01`,key:`1primd`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`M18 8h.01`,key:`emo2bl`}],[`path`,{d:`M6 8h.01`,key:`x9i8wu`}],[`path`,{d:`M7 16h10`,key:`wp8him`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}]]),uo=H(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),fo=H(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),po=H(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),mo=H(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),ho=H(`memory-stick`,[[`path`,{d:`M12 12v-2`,key:`fwoke6`}],[`path`,{d:`M12 18v-2`,key:`qj6yno`}],[`path`,{d:`M16 12v-2`,key:`heuere`}],[`path`,{d:`M16 18v-2`,key:`s1ct0w`}],[`path`,{d:`M2 11h1.5`,key:`15p63e`}],[`path`,{d:`M20 18v-2`,key:`12ehxp`}],[`path`,{d:`M20.5 11H22`,key:`khsy7a`}],[`path`,{d:`M4 18v-2`,key:`1c3oqr`}],[`path`,{d:`M8 12v-2`,key:`1mwtfd`}],[`path`,{d:`M8 18v-2`,key:`qcmpov`}],[`rect`,{x:`2`,y:`6`,width:`20`,height:`10`,rx:`2`,key:`1qcswk`}]]),go=H(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),_o=H(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),vo=H(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),yo=H(`notebook-pen`,[[`path`,{d:`M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4`,key:`re6nr2`}],[`path`,{d:`M2 6h4`,key:`aawbzj`}],[`path`,{d:`M2 10h4`,key:`l0bgd4`}],[`path`,{d:`M2 14h4`,key:`1gsvsf`}],[`path`,{d:`M2 18h4`,key:`1bu2t1`}],[`path`,{d:`M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z`,key:`pqwjuv`}]]),bo=H(`package-check`,[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`m16 17 2 2 4-4`,key:`uh5qu3`}],[`path`,{d:`M21 11.127V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.32-.753`,key:`kpkbpo`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]),xo=H(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),So=H(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),Co=H(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]),wo=H(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),To=H(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Eo=H(`scale`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`m19 8 3 8a5 5 0 0 1-6 0zV7`,key:`zcdpyk`}],[`path`,{d:`M3 7h1a17 17 0 0 0 8-2 17 17 0 0 0 8 2h1`,key:`1yorad`}],[`path`,{d:`m5 8 3 8a5 5 0 0 1-6 0zV7`,key:`eua70x`}],[`path`,{d:`M7 21h10`,key:`1b0cd5`}]]),Do=H(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),Oo=H(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),ko=H(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Ao=H(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),jo=H(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Mo=H(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),No=H(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),Po=H(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Fo=H(`workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]),Io=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),Lo=`VisuallyHidden`,Ro=J.forwardRef((e,t)=>(0,Y.jsx)(Xt.span,{...e,ref:t,style:{...Io,...e.style}}));Ro.displayName=Lo;var zo=Ro;function Bo(e){let t=J.useRef({value:e,previous:e});return J.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Vo=`Label`,Ho=J.forwardRef((e,t)=>(0,Y.jsx)(Xt.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));Ho.displayName=Vo;var Uo=Ho,Wo=`Switch`,[Go,Ko]=Ue(Wo),[qo,Jo]=Go(Wo);function Yo(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=Ie({prop:n,defaultProp:i??!1,onChange:c,caller:Wo}),[m,h]=J.useState(null),[g,_]=J.useState(null),v={checked:f,setChecked:p,disabled:a,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:J.useRef(!1),required:l,defaultChecked:i,isFormControl:!m||!!o||!!m.closest(`form`),bubbleInput:g,setBubbleInput:_};return(0,Y.jsx)(qo,{scope:t,...v,children:rs(d)?d(v):r})}var Xo=`SwitchTrigger`,Zo=J.forwardRef(({__scopeSwitch:e,onClick:t,...n},r)=>{let{control:i,form:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,isFormControl:m,bubbleInput:h}=Jo(Xo,e),g=p(r,u),_=J.useRef(c);return J.useEffect(()=>{let e=a?i?.ownerDocument.getElementById(a):i?.form;if(e instanceof HTMLFormElement){let t=()=>d(_.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[i,a,d]),(0,Y.jsx)(Xt.button,{type:`button`,role:`switch`,"aria-checked":c,"aria-required":l,"data-state":is(c),"data-disabled":s?``:void 0,disabled:s,value:o,...n,ref:g,onClick:Zt(t,e=>{d(e=>!e),h&&m&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});Zo.displayName=Xo;var Qo=J.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,Y.jsx)(Yo,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Zo,{...d,ref:t,__scopeSwitch:n}),e&&(0,Y.jsx)(ns,{__scopeSwitch:n})]})})});Qo.displayName=Wo;var $o=`SwitchThumb`,es=J.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=Jo($o,n);return(0,Y.jsx)(Xt.span,{"data-state":is(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});es.displayName=$o;var ts=`SwitchBubbleInput`,ns=J.forwardRef(({__scopeSwitch:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:s,disabled:c,name:l,value:u,form:d,bubbleInput:f,setBubbleInput:m}=Jo(ts,e),h=p(n,m),g=Bo(a),_=yr(r);J.useEffect(()=>{let e=f;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(g!==a&&n){let t=new Event(`click`,{bubbles:r});n.call(e,a),e.dispatchEvent(t)}},[f,g,a,i]);let v=J.useRef(a);return(0,Y.jsx)(Xt.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??v.current,required:s,disabled:c,name:l,value:u,form:d,...t,tabIndex:-1,ref:h,style:{...t.style,..._,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});ns.displayName=ts;function rs(e){return typeof e==`function`}function is(e){return e?`checked`:`unchecked`}var as=`Tabs`,[os,ss]=Ue(as,[Sr]),cs=Sr(),[ls,us]=os(as),ds=J.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=Fr(s),[d,f]=Ie({prop:r,onChange:i,defaultProp:a??``,caller:as});return(0,Y.jsx)(ls,{scope:n,baseId:ct(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,Y.jsx)(Xt.div,{dir:u,"data-orientation":o,...l,ref:t})})});ds.displayName=as;var fs=`TabsList`,ps=J.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=us(fs,n),o=cs(n);return(0,Y.jsx)(Pr,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,Y.jsx)(Xt.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});ps.displayName=fs;var ms=`TabsTrigger`,hs=J.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=us(ms,n),s=cs(n),c=vs(o.baseId,r),l=ys(o.baseId,r),u=r===o.value;return(0,Y.jsx)(Dr,{asChild:!0,...s,focusable:!i,active:u,children:(0,Y.jsx)(Xt.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:Zt(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:Zt(e.onKeyDown,e=>{i||e.target!==e.currentTarget||[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:Zt(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});hs.displayName=ms;var gs=`TabsContent`,_s=J.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=us(gs,n),c=vs(s.baseId,r),l=ys(s.baseId,r),u=r===s.value,d=J.useRef(u);return J.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,Y.jsx)(at,{present:i||u,children:({present:n})=>(0,Y.jsx)(Xt.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});_s.displayName=gs;function vs(e,t){return`${e}-trigger-${t}`}function ys(e,t){return`${e}-content-${t}`}var bs=ds,xs=ps,Ss=hs,Cs=_s,[ws,Ts]=Ue(`Tooltip`,[wr]),Es=wr(),Ds=`TooltipProvider`,Os=700,ks=`tooltip.open`,[As,js]=ws(Ds),Ms=e=>{let{__scopeTooltip:t,delayDuration:n=Os,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=J.useRef(!0),s=J.useRef(!1),c=J.useRef(0);return J.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,Y.jsx)(As,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:J.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:J.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:J.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};Ms.displayName=Ds;var Ns=`Tooltip`,[Ps,Fs]=ws(Ns),Is=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=js(Ns,e.__scopeTooltip),l=Es(t),[u,d]=J.useState(null),f=ct(),p=J.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=J.useRef(!1),[_,v]=Ie({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(ks))):c.onClose(),a?.(e)},caller:Ns}),y=J.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),b=J.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),x=J.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),S=J.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},h)},[h,v]);return J.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,Y.jsx)(Tr,{...l,children:(0,Y.jsx)(Ps,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:J.useCallback(()=>{c.isOpenDelayedRef.current?S():b()},[c.isOpenDelayedRef,S,b]),onTriggerLeave:J.useCallback(()=>{m?x():(window.clearTimeout(p.current),p.current=0)},[x,m]),onOpen:b,onClose:x,disableHoverableContent:m,children:n})})};Is.displayName=Ns;var Ls=`TooltipTrigger`,Rs=J.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Fs(Ls,n),a=js(Ls,n),o=Es(n),s=p(t,J.useRef(null),i.onTriggerChange),c=J.useRef(!1),l=J.useRef(!1),u=J.useCallback(()=>c.current=!1,[]);return J.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,Y.jsx)(Cr,{asChild:!0,...o,children:(0,Y.jsx)(Xt.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:Zt(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:Zt(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:Zt(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:Zt(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:Zt(e.onBlur,i.onClose),onClick:Zt(e.onClick,i.onClose)})})});Rs.displayName=Ls;var zs=`TooltipPortal`,[Bs,Vs]=ws(zs,{forceMount:void 0}),Hs=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=Fs(zs,t);return(0,Y.jsx)(Bs,{scope:t,forceMount:n,children:(0,Y.jsx)(at,{present:n||a.open,children:(0,Y.jsx)(Ht,{asChild:!0,container:i,children:r})})})};Hs.displayName=zs;var Us=`TooltipContent`,Ws=J.forwardRef((e,t)=>{let n=Vs(Us,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=Fs(Us,e.__scopeTooltip);return(0,Y.jsx)(at,{present:r||o.open,children:o.disableHoverableContent?(0,Y.jsx)(Ys,{side:i,...a,ref:t}):(0,Y.jsx)(Gs,{side:i,...a,ref:t})})}),Gs=J.forwardRef((e,t)=>{let n=Fs(Us,e.__scopeTooltip),r=js(Us,e.__scopeTooltip),i=J.useRef(null),a=p(t,i),[o,s]=J.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=J.useCallback(()=>{s(null),d(!1)},[d]),m=J.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=$s(r,Qs(r,n.getBoundingClientRect())),a=ec(t.getBoundingClientRect()),o=nc([...i,...a]);s(o),d(!0)},[d]);return J.useEffect(()=>()=>f(),[f]),J.useEffect(()=>{if(c&&u){let e=e=>m(e,u),t=e=>m(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,m,f]),J.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!tc(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,Y.jsx)(Ys,{...e,ref:a})}),[Ks,qs]=ws(Ns,{isInside:!1}),Js=xe(`TooltipContent`),Ys=J.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=Fs(Us,n),l=Es(n),{onClose:u}=c;return J.useEffect(()=>(document.addEventListener(ks,u),()=>document.removeEventListener(ks,u)),[u]),J.useEffect(()=>{if(c.trigger){let e=e=>{e.target instanceof Node&&e.target.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,Y.jsx)(tt,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,Y.jsxs)(Or,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,Y.jsx)(Js,{children:r}),(0,Y.jsx)(Ks,{scope:n,isInside:!0,children:(0,Y.jsx)(zo,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});Ws.displayName=Us;var Xs=`TooltipArrow`,Zs=J.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Es(n);return qs(Xs,n).isInside?null:(0,Y.jsx)(Ar,{...i,...r,ref:t})});Zs.displayName=Xs;function Qs(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function $s(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function ec(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function tc(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function nc(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),rc(t)}function rc(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var ic=Ms,ac=Is,oc=Rs,sc=Hs,cc=Ws,lc=Zs,uc=le(`inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 [&>svg]:pointer-events-none [&>svg]:size-3`,{variants:{variant:{default:`bg-primary text-primary-foreground [a&]:hover:bg-primary/90`,secondary:`bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90`,destructive:`bg-destructive text-destructive-foreground focus-visible:ring-destructive/20 [a&]:hover:bg-destructive/90`,outline:`border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,ghost:`[a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,link:`text-primary underline-offset-4 [a&]:hover:underline`}},defaultVariants:{variant:`default`}});function dc({className:e,variant:t=`default`,asChild:n=!1,...r}){return(0,Y.jsx)(n?u:`span`,{"data-slot":`badge`,"data-variant":t,className:U(uc({variant:t}),e),...r})}function fc({path:e,selected:t,onSelect:n,onEnter:r,decorate:i,emptyHint:a,showHidden:o=!1}){let s=Ae(e,o),c=s.data?.parent??null;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{"data-slot":`fs-breadcrumb`,className:`truncate font-mono text-[11.5px] text-soft-foreground`,title:s.data?.path??void 0,children:s.data?.path??(s.isError?``:`Loading…`)}),s.isError?(0,Y.jsx)(`p`,{"data-slot":`fs-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:s.error instanceof Error?s.error.message:`could not list that folder`}):(0,Y.jsxs)(`ul`,{"data-slot":`fs-listing`,className:`max-h-64 divide-y divide-border/60 overflow-y-auto overscroll-contain rounded-md border border-border`,children:[c===null?null:(0,Y.jsx)(`li`,{className:`flex`,children:(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`fs-up`,onClick:()=>r(c),className:`flex flex-1 items-center gap-2 px-3 py-2 text-left text-[13px] hover:bg-muted`,children:[(0,Y.jsx)(Ja,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),`Up one level`]})}),(s.data?.dirs??[]).map(e=>(0,Y.jsxs)(`li`,{className:`flex items-stretch`,children:[(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`fs-dir`,"aria-pressed":t?.path===e.path,onClick:()=>n(e),onDoubleClick:()=>r(e.path),className:U(`flex min-w-0 flex-1 items-center gap-2 px-3 py-2 text-left text-[13px] hover:bg-muted`,t?.path===e.path&&`bg-muted`),children:[(0,Y.jsx)(ii,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`truncate`,children:e.name}),i?.(e)]}),(0,Y.jsx)(`button`,{type:`button`,"data-slot":`fs-enter`,"aria-label":`Open ${e.name}`,onClick:()=>r(e.path),className:`flex shrink-0 items-center px-2.5 text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,Y.jsx)(vr,{className:`size-3.5`,"aria-hidden":`true`})})]},e.path)),s.data&&s.data.dirs.length===0?(0,Y.jsx)(`li`,{className:`px-3 py-2 text-[13px] text-muted-foreground`,children:a}):null]}),s.data?.truncated?(0,Y.jsx)(`p`,{"data-slot":`fs-truncated`,className:`text-[11.5px] text-muted-foreground`,children:`Too many folders to list — only the first ones are shown.`}):null]})}function pc(e,t,n=!1){let r=Ae(e,n);return t?.path??r.data?.path??null}function mc({open:e,onOpenChange:t}){let[n,r]=(0,J.useState)(null),[i,a]=(0,J.useState)(null),o=R(),s=qt(),c=Oe(),l=new Set((o.data?.projects??[]).map(e=>e.root)),u=e=>{r(e),a(null),s.reset()},d=pc(n,i);return(0,Y.jsx)(wi,{open:e,onOpenChange:t,children:(0,Y.jsxs)(vi,{"data-slot":`add-project-dialog`,className:`sm:max-w-lg`,children:[(0,Y.jsxs)(yi,{children:[(0,Y.jsx)(xi,{children:`Open local folder`}),(0,Y.jsx)(Ci,{children:`Pick the folder xezar should run in. Git repos are marked; any folder works.`})]}),(0,Y.jsx)(fc,{path:n,selected:i,onSelect:a,onEnter:u,emptyHint:`No subfolders here — “Add project” registers this folder.`,decorate:e=>(0,Y.jsxs)(Y.Fragment,{children:[e.isRepo?(0,Y.jsx)(dc,{variant:`outline`,className:`shrink-0 text-[10px]`,children:`git`}):null,l.has(e.path)?(0,Y.jsx)(dc,{variant:`ghost`,className:`shrink-0 text-[10px] text-muted-foreground`,children:`already added`}):null]})}),s.isError?(0,Y.jsx)(`p`,{"data-slot":`add-project-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:s.error instanceof Error?s.error.message:`could not add that folder`}):null,(0,Y.jsxs)(Ti,{className:`min-w-0 sm:items-center sm:justify-between`,children:[(0,Y.jsx)(`span`,{"data-slot":`add-project-target`,className:`min-w-0 truncate font-mono text-[11.5px] text-muted-foreground`,title:d??void 0,children:d??``}),(0,Y.jsxs)(`span`,{className:`flex shrink-0 gap-2`,children:[(0,Y.jsx)(L,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,Y.jsx)(L,{"data-slot":`add-project-confirm`,disabled:d===null||s.isPending,onClick:()=>{d===null||s.isPending||s.mutate(d,{onSuccess:({project:e})=>{t(!1),c(`/p/${encodeURIComponent(e.id)}/`)}})},children:s.isPending?`Adding…`:`Add project`})]})]})]})})}function hc({className:e,type:t,...n}){return(0,Y.jsx)(`input`,{type:t,"data-slot":`input`,className:U(`h-9 w-full min-w-0 rounded-md border border-input bg-card px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-soft-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm`,`focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,`aria-invalid:border-destructive aria-invalid:ring-destructive/20`,e),...n})}function gc({className:e,...t}){return(0,Y.jsx)(Uo,{"data-slot":`label`,className:U(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function _c({open:e,onOpenChange:t}){let[n,r]=(0,J.useState)(``),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(null),c=R(),l=_e(),u=Oe(),d=(0,J.useMemo)(()=>`co-${Math.random().toString(36).slice(2)}-${Date.now().toString(36)}`,[]),f=(0,J.useRef)(d);f.current=d,(0,J.useEffect)(()=>Sa((e,t)=>{if(e!==`checkout-progress`)return;let n=t;n?.checkoutId===f.current&&(n.phase===`cloning`&&n.line?s(n.line):n.phase!==`cloning`&&s(null))}),[]);let p=(0,J.useMemo)(()=>{let e=n.trim().replace(/\/+$/,``).replace(/\.git$/,``).split(`/`).pop()??``;return e.includes(`:`)?e.split(`:`).pop()??``:e},[n]),m=i.trim()===``?p:i.trim(),h=c.data?.projectsDir??``,g=m===``?``:`${h.replace(/\/+$/,``)}/${m}`,_=()=>{n.trim()===``||l.isPending||(s(null),l.mutate({url:n.trim(),checkoutId:d,...i.trim()===``?{}:{name:i.trim()}},{onSuccess:({project:e})=>{t(!1),u(`/p/${encodeURIComponent(e.id)}/`)}}))};return(0,Y.jsx)(wi,{open:e,onOpenChange:e=>l.isPending?void 0:t(e),children:(0,Y.jsxs)(vi,{"data-slot":`clone-project-dialog`,className:`sm:max-w-lg`,children:[(0,Y.jsxs)(yi,{children:[(0,Y.jsx)(xi,{children:`Clone from GitHub`}),(0,Y.jsxs)(Ci,{children:[`xezar clones with `,(0,Y.jsx)(`code`,{children:`gh`}),` into your checkout root and adds the result as a project.`]})]}),(0,Y.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Y.jsx)(gc,{htmlFor:`clone-url`,children:`Repository`}),(0,Y.jsx)(hc,{id:`clone-url`,"data-slot":`clone-url`,autoFocus:!0,placeholder:`owner/repo or https://github.com/owner/repo`,value:n,disabled:l.isPending,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&_()}})]}),(0,Y.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Y.jsx)(gc,{htmlFor:`clone-name`,children:`Folder name`}),(0,Y.jsx)(hc,{id:`clone-name`,"data-slot":`clone-name`,placeholder:p===``?`repo`:p,value:i,disabled:l.isPending,onChange:e=>a(e.target.value)}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,Y.jsx)(`p`,{"data-slot":`clone-target`,className:`min-w-0 flex-1 truncate font-mono text-[11.5px] text-soft-foreground`,title:g,children:g}),l.isPending?(0,Y.jsx)(L,{"data-slot":`clone-root-settings`,variant:`ghost`,size:`icon-sm`,className:`size-7`,"aria-label":`Edit checkout root`,title:`Edit checkout root`,disabled:!0,children:(0,Y.jsx)(Oo,{className:`size-3.5`,"aria-hidden":`true`})}):(0,Y.jsx)(L,{asChild:!0,variant:`ghost`,size:`icon-sm`,className:`size-7`,children:(0,Y.jsx)(M,{to:`/settings/global/projects`,"data-slot":`clone-root-settings`,"aria-label":`Edit checkout root`,title:`Edit checkout root`,children:(0,Y.jsx)(Oo,{className:`size-3.5`,"aria-hidden":`true`})})})]})]}),l.isPending?(0,Y.jsx)(`p`,{"data-slot":`clone-progress`,className:`truncate font-mono text-[11.5px] text-muted-foreground`,children:o??`Starting the clone…`}):null,l.isError?(0,Y.jsx)(`p`,{"data-slot":`clone-error`,className:`text-[13px] text-danger`,children:l.error instanceof Error?l.error.message:`could not clone that repository`}):null,(0,Y.jsxs)(Ti,{children:[(0,Y.jsx)(L,{variant:`outline`,disabled:l.isPending,onClick:()=>t(!1),children:`Cancel`}),(0,Y.jsx)(L,{"data-slot":`clone-confirm`,disabled:n.trim()===``||m===``||l.isPending,onClick:_,children:l.isPending?`Cloning…`:`Clone`})]})]})})}function vc(e){return(0,Y.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,...e,children:(0,Y.jsx)(`path`,{d:`M12 1.9a10.1 10.1 0 0 0-3.2 19.7c.5.1.7-.2.7-.5v-1.8c-2.8.6-3.4-1.2-3.4-1.2-.5-1.2-1.1-1.5-1.1-1.5-.9-.6.1-.6.1-.6 1 .1 1.5 1 1.5 1 .9 1.6 2.4 1.1 3 .9.1-.7.4-1.1.6-1.4-2.2-.3-4.6-1.1-4.6-5 0-1.1.4-2 1-2.7-.1-.3-.4-1.3.1-2.7 0 0 .9-.3 2.8 1a9.6 9.6 0 0 1 5 0c1.9-1.3 2.8-1 2.8-1 .5 1.4.2 2.4.1 2.7.6.7 1 1.6 1 2.7 0 3.9-2.4 4.7-4.6 5 .4.3.7.9.7 1.9v2.8c0 .3.2.6.7.5A10.1 10.1 0 0 0 12 1.9z`})})}var yc=[{to:`/`,label:`Tasks`,icon:po,match:[`/`,`/tasks`,`/compare`],badge:`tasks-unread`},{to:`/inbox`,label:`Inbox`,icon:co,match:[`/inbox`],badge:`inbox-count`,inbox:!0},{to:`/git`,label:`Git`,icon:io,match:[`/git`]},{to:`/github`,label:`GitHub`,icon:vc,match:[`/github`],forge:!0},{to:`/automations`,label:`Automations`,icon:hr,match:[`/automations`],forge:!0,automations:!0},{to:`/skills`,label:`Skills`,icon:oi,match:[`/skills`],badge:`skills-update`},{to:`/workflows`,label:`Workflows`,icon:Fo,match:[`/workflows`]},{to:`/settings`,label:`Settings`,icon:Oo,match:[`/settings`]}];function bc({forge:e=!1,inbox:t=!1,automations:n=!1}={}){return yc.filter(r=>(!r.forge||e)&&(!r.inbox||t)&&(!r.automations||n))}function xc(e,t){return t===`/`?e===`/`:e===t||e.startsWith(t+`/`)}function Sc(e){let t=null;for(let n of yc)for(let r of n.match)xc(e,r)&&(t===null||r.length>t.length)&&(t={to:n.to,length:r.length});return t?.to??null}function Cc(e){let t=Sc(e);return yc.find(e=>e.to===t)??null}var wc=`xez-theme`,Tc=`(prefers-color-scheme: light)`,Ec=`dark`;function Dc(e){return e===`light`||e===`dark`||e===`system`?e:Ec}function Oc(e,t){return e===`light`||e===`system`&&t?`light`:`dark`}function kc(){try{return Dc(localStorage.getItem(wc))}catch{return Ec}}function Ac(e){try{localStorage.setItem(wc,e)}catch{}}function jc(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(Tc).matches}function Mc(e,t){e.classList.toggle(`light`,t===`light`),e.style.colorScheme=t}var Nc=J.createContext(null);function Pc({children:e}){let[t,n]=J.useState(kc),[r,i]=J.useState(jc);J.useEffect(()=>{let e=window.matchMedia?.(Tc);if(!e)return;i(e.matches);let t=e=>i(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let a=Oc(t,r);J.useLayoutEffect(()=>{Mc(document.documentElement,a)},[a]);let o=J.useCallback(e=>{n(e),Ac(e)},[]),s=J.useMemo(()=>({theme:t,resolvedTheme:a,setTheme:o}),[t,a,o]);return(0,Y.jsx)(Nc.Provider,{value:s,children:e})}function Fc(){let e=J.useContext(Nc);if(!e)throw Error(`xezar: useTheme() must be called inside <ThemeProvider>`);return e}var Ic={light:`dark`,dark:`system`,system:`light`},Lc={light:Mo,dark:vo,system:_o},Rc={light:`light`,dark:`dark`,system:`system`};function zc({className:e}){let{theme:t,setTheme:n}=Fc(),r=Ic[t],i=Lc[t];return(0,Y.jsx)(L,{type:`button`,variant:`ghost`,size:`icon-sm`,className:e,"data-slot":`theme-toggle`,"data-theme-pref":t,title:`Theme: ${Rc[t]}`,"aria-label":`Theme: ${Rc[t]}. Switch to ${Rc[r]}.`,onClick:()=>n(r),children:(0,Y.jsx)(i,{"aria-hidden":`true`})})}var Bc=`xezar:open-command-palette`;function Vc(){window.dispatchEvent(new Event(Bc))}function Hc(e){return[...e].sort((e,t)=>Date.parse(t.createdAt)-Date.parse(e.createdAt))}function Uc(e,t,n){let r=t.trim().toLowerCase();if(r===``)return 1;let i=(n?.length?`${e} ${n.join(` `)}`:e).toLowerCase(),a=r.split(/\s+/),o=0;for(let e of a){let t=i.indexOf(e);if(t===-1)return 0;let n=t===0||!/[a-z0-9]/.test(i[t-1]??``);o+=(n?1:.5)/(1+t/48)}return o/a.length}function Wc(e,t,n){let r=Hc(e).map(e=>({projectId:t,id:e.id,title:e.title,titleSummary:e.titleSummary,titleOrigin:e.titleOrigin,status:e.status,activity:e.activity,createdAt:e.createdAt,finishedAt:e.finishedAt,seenAt:e.seenAt,archived:e.archived,autoResumeAt:e.autoResumeAt,workflow:e.workflow,branch:e.branch,startedAt:e.startedAt})),i=new Set(r.map(Gc)),a=(n??[]).filter(e=>!i.has(Gc(e))).sort((e,t)=>t.createdAt.localeCompare(e.createdAt));return[...r,...a]}var Gc=e=>`${e.projectId??``}/${e.id}`;function Kc(e){let t=e.filter(e=>mn(e)).sort((e,t)=>(t.finishedAt??``).localeCompare(e.finishedAt??``)),n=new Set(t.map(Gc));return{recentlyFinished:t,otherTasks:e.filter(e=>!n.has(Gc(e)))}}function qc(e,t){return[...e].sort((e,n)=>Number(e.id===t)-Number(n.id===t)||n.lastOpenedAt.localeCompare(e.lastOpenedAt))}function Jc(){let[e,t]=J.useState(!1),n=Di();Bn(`k`,()=>t(e=>!e));let r=J.useCallback(()=>{t(!1),n(`/new`)},[n]);return Bn(`n`,r),Kn(`c`,r),J.useEffect(()=>{let e=()=>t(!0);return window.addEventListener(Bc,e),()=>window.removeEventListener(Bc,e)},[]),(0,Y.jsx)(Jr,{open:e,onOpenChange:t,title:`Command palette`,description:`Search projects, tasks, views, actions, and skills`,showCloseButton:!1,filter:Uc,className:`top-[10vh] translate-y-0 sm:max-w-2xl lg:max-w-3xl xl:max-w-4xl`,children:(0,Y.jsx)(Xc,{close:()=>t(!1)})})}function Yc({task:e,projectName:t,showProject:n,now:r,onSelect:i}){let a=Li(e),o=Kt(e);return(0,Y.jsxs)(G,{value:`task ${o} ${e.id}`,keywords:t?[t]:void 0,"data-slot":`palette-task`,"data-run-id":e.id,"data-project-id":e.projectId??void 0,onSelect:()=>i(e),children:[(0,Y.jsx)(q,{tone:a.tone,pulse:a.pulse,"aria-label":a.label,role:`img`}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:o}),n&&t?(0,Y.jsx)(`span`,{"data-slot":`palette-task-project`,className:`shrink-0 truncate text-xs text-soft-foreground`,children:t}):null,(0,Y.jsx)(`span`,{className:`shrink-0 text-xs text-soft-foreground tabular-nums`,children:Vi(e.finishedAt??e.createdAt,r)})]})}function Xc({close:e}){let t=Di(),n=Oe(),[r,i]=J.useState(``),o=r.trim()!==``,s=Ni(),{theme:c,setTheme:l}=Fc(),u=b(),d=an(),f=R(),p=T(),m=I(),h=Date.now(),g=f.data,_=g!==void 0&&g.projects.length>1,v=ee(_),y=J.useMemo(()=>_?qc(g.projects,s):[],[_,g,s]),x=J.useMemo(()=>new Map((g?.projects??[]).map(e=>[e.id,e.name])),[g]),S=s??g?.bootProject??null,C=J.useMemo(()=>Wc(u.data??[],S,v.data?.runs),[u.data,S,v.data]),w=J.useMemo(()=>Kc(C),[C]),E=o?[]:w.recentlyFinished,D=o?C:w.otherTasks,O=_,te=e=>e.projectId===null?null:x.get(e.projectId)??null,ne=p.data?.skillUsage,re=J.useMemo(()=>Xi(d.data??[],ne),[d.data,ne]),ie=n=>{e(),t(n)},ae=t=>{e(),n(t)},k=n=>{e(),t(Ei(n,`/`))},A=n=>{e(),t(n.projectId===null?`/tasks/${n.id}`:Ei(n.projectId,`/tasks/${n.id}`))},oe=Ic[c];return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(zr,{placeholder:`Search projects, tasks, views, actions, skills…`,value:r,onValueChange:i}),(0,Y.jsxs)(ri,{className:`max-h-[55vh] min-h-[14rem] sm:max-h-[60vh] lg:max-h-[68vh]`,children:[(0,Y.jsx)(Gr,{children:`Nothing matches.`}),(0,Y.jsx)(W,{children:(0,Y.jsxs)(G,{value:`new task`,"data-slot":`palette-view`,"data-nav-to":`/new`,onSelect:()=>ie(`/new`),children:[(0,Y.jsx)(wo,{"aria-hidden":`true`}),`New task`,(0,Y.jsx)(ni,{children:`C`})]})}),!o&&E.length>0?(0,Y.jsx)(W,{heading:`Recently finished`,children:E.map(e=>(0,Y.jsx)(Yc,{task:e,projectName:te(e),showProject:O,now:h,onSelect:A},Gc(e)))}):null,(0,Y.jsxs)(W,{heading:`Views`,children:[_?(0,Y.jsxs)(G,{value:`view All tasks`,"data-slot":`palette-view`,"data-nav-to":`/tasks`,onSelect:()=>ae(`/tasks`),children:[(0,Y.jsx)(uo,{"aria-hidden":`true`}),`All tasks`]}):null,bc({forge:m.data?.forge?.available===!0,inbox:m.data?.capabilities.followups===!0,automations:m.data?.capabilities.automations===!0}).map(e=>{let t=e.icon;return(0,Y.jsxs)(G,{value:`view ${e.label}`,"data-slot":`palette-view`,"data-nav-to":e.to,onSelect:()=>ie(e.to),children:[(0,Y.jsx)(t,{"aria-hidden":`true`}),e.label]},e.to)})]}),y.length>0?(0,Y.jsx)(W,{heading:`Projects`,children:y.map(e=>{let t=e.id===s,n=e.status===`missing`;return(0,Y.jsxs)(G,{value:`project ${e.name} ${e.id}`,keywords:[e.root],"data-slot":`palette-project`,"data-project-id":e.id,disabled:n,onSelect:()=>k(e.id),children:[(0,Y.jsx)(eo,{"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),n?(0,Y.jsx)(`span`,{className:`shrink-0 text-xs text-soft-foreground`,children:`folder not found`}):e.branch===void 0?null:(0,Y.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-soft-foreground`,children:e.branch}),t?(0,Y.jsx)(a,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e.id)})}):null,D.length>0?(0,Y.jsx)(W,{heading:`Tasks`,children:D.map(e=>(0,Y.jsx)(Yc,{task:e,projectName:te(e),showProject:O,now:h,onSelect:A},Gc(e)))}):null,(0,Y.jsx)(W,{heading:`Actions`,children:(0,Y.jsxs)(G,{value:`action toggle theme`,"data-slot":`palette-action`,"data-action":`toggle-theme`,onSelect:()=>{l(oe),e()},children:[(0,Y.jsx)(vo,{"aria-hidden":`true`}),`Toggle theme`,(0,Y.jsxs)(ni,{className:`tracking-normal`,children:[c,` → `,oe]})]})}),re.length>0?(0,Y.jsx)(W,{heading:`Skills`,children:re.map(e=>(0,Y.jsxs)(G,{value:`skill ${e.name} ${e.path}`,keywords:e.description?[e.description]:void 0,"data-slot":`palette-skill`,"data-skill":e.name,onSelect:()=>ie(`/new?skill=${encodeURIComponent(e.name)}`),children:[(0,Y.jsx)(`span`,{className:`shrink-0 font-medium`,children:e.name}),e.description?(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null]},e.path))}):null]})]})}var Zc=`xez-sidebar-width`;function Qc(e){let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?Math.min(420,Math.max(264,Math.round(t))):264}function $c(){try{let e=localStorage.getItem(Zc);return e===null?264:Qc(e)}catch{return 264}}function el(e){try{localStorage.setItem(Zc,String(Qc(e)))}catch{}}var tl=`/xezar.svg`,nl=`(min-width: 768px)`,rl=J.createContext(void 0);function il(){return J.useContext(rl)}function al(e){return rn({path:`/tasks/:id`,end:!0},ji(e))!==null}function ol({children:e,repo:t=null,inboxCount:n=null,unreadCount:r=null,skillsUpdateAvailable:i=!1,version:a=null,latestVersion:o=null,taskQuickList:s,toolsMenu:l,forgeAvailable:u=!0,inboxAvailable:d=!0,automationsAvailable:f=!0,singleProject:p=!1,banner:m,projectGroups:h}){let{pathname:g}=c(),_=ji(g),v=Sc(_),y=Cc(_),[b,x]=J.useState(!1),S=J.useRef(null),C=al(g),[w,T]=J.useState($c),E=J.useCallback(e=>{let t=Qc(e);T(t),el(t)},[]);J.useLayoutEffect(()=>{if(C)return;let e=S.current;e&&(e.scrollTop=0)},[g,C]),J.useEffect(()=>{x(!1)},[g]),J.useEffect(()=>{let e=window.matchMedia?.(nl);if(!e)return;e.matches&&x(!1);let t=e=>{e.matches&&x(!1)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let D={activeTo:v,items:bc({forge:u,inbox:d,automations:f}),repo:t,inboxCount:d?n:null,unreadCount:r,skillsUpdateAvailable:i,version:a,latestVersion:o,taskQuickList:s,toolsMenu:l,projectGroups:h,singleProject:p};return(0,Y.jsx)(Hn,{open:b,onOpenChange:x,children:(0,Y.jsxs)(`div`,{"data-slot":`app-shell`,className:`flex h-dvh overflow-hidden bg-background text-foreground pl-[env(safe-area-inset-left)] pr-[env(safe-area-inset-right)]`,children:[(0,Y.jsx)(sl,{...D,width:w,onWidthChange:E}),(0,Y.jsx)(ll,{...D,onNavigate:()=>x(!1)}),(0,Y.jsxs)(`div`,{className:`grid min-w-0 flex-1 grid-rows-[auto_auto_1fr_auto] overflow-hidden`,children:[(0,Y.jsx)(_l,{title:y?.label??`xezar`}),m?(0,Y.jsx)(`div`,{"data-slot":`banner-slot`,className:`row-start-2`,children:m}):null,(0,Y.jsx)(`main`,{ref:S,"data-slot":`main`,className:`row-start-3 min-h-0 overflow-y-auto overscroll-contain`,children:e}),(0,Y.jsx)(`div`,{"data-slot":`composer`,className:`row-start-4 pb-[env(safe-area-inset-bottom)]`})]})]})})}function sl({width:e,onWidthChange:t,...n}){return(0,Y.jsxs)(`aside`,{"data-slot":`sidebar`,style:{width:e},className:`relative hidden shrink-0 flex-col border-r border-border bg-sidebar md:flex`,children:[(0,Y.jsx)(ul,{...n}),(0,Y.jsx)(cl,{width:e,onWidthChange:t})]})}function cl({width:e,onWidthChange:t}){let n=J.useRef(null),r=t=>{t.button===0&&(n.current={x:t.clientX,width:e},t.currentTarget.setPointerCapture(t.pointerId),t.preventDefault(),t.currentTarget.focus())},i=e=>{let r=n.current;r&&t(Qc(r.width+(e.clientX-r.x)))},a=e=>{n.current&&(n.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))};return(0,Y.jsx)(`div`,{"data-slot":`sidebar-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize the sidebar`,"aria-valuenow":e,"aria-valuemin":264,"aria-valuemax":420,tabIndex:0,onPointerDown:r,onPointerMove:i,onPointerUp:a,onPointerCancel:a,onKeyDown:n=>{let r=n.key===`ArrowLeft`?e-16:n.key===`ArrowRight`?e+16:n.key===`Home`?264:n.key===`End`?420:null;r!==null&&(n.preventDefault(),t(Qc(r)))},onDoubleClick:()=>t(264),title:`Drag to resize the sidebar — double-click to reset`,className:`absolute inset-y-0 -right-[2px] z-20 w-[5px] cursor-col-resize touch-none bg-transparent transition-colors hover:bg-violet/40 focus-visible:bg-violet/60 focus-visible:outline-none`})}function ll({onNavigate:e,...t}){return(0,Y.jsxs)(Gn,{side:`left`,"data-slot":`mobile-nav-drawer`,showCloseButton:!1,className:`w-[264px] gap-0 border-border bg-sidebar p-0 sm:max-w-none md:hidden`,"aria-describedby":void 0,children:[(0,Y.jsx)(Un,{className:`sr-only`,children:`Navigation`}),(0,Y.jsx)(ul,{...t,onNavigate:e,headerAction:(0,Y.jsx)(Rn,{asChild:!0,children:(0,Y.jsx)(L,{variant:`ghost`,size:`icon`,"aria-label":`Close menu`,className:`-mr-2 size-11`,children:(0,Y.jsx)(ci,{className:`size-[17px]`,"aria-hidden":`true`})})})})]})}function ul({activeTo:e,items:t,repo:n,inboxCount:r,unreadCount:i,skillsUpdateAvailable:a,version:o,latestVersion:s,taskQuickList:c,toolsMenu:l,projectGroups:u,singleProject:d,onNavigate:f,headerAction:p}){return(0,Y.jsxs)(`div`,{"data-slot":`sidebar-content`,className:`@container/sidebar flex min-h-0 flex-1 flex-col pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-[9px] px-3.5 pt-3.5 pb-2.5`,children:[(0,Y.jsx)(gl,{}),(0,Y.jsx)(`span`,{className:`text-[15px] font-semibold`,children:`xezar`}),n&&!u?(0,Y.jsxs)(`span`,{"data-slot":`repo-chip`,className:`ml-auto truncate font-mono text-[11px] font-medium text-soft-foreground`,children:[n.name,` / `,n.branch]}):null,p?(0,Y.jsx)(`div`,{className:U(`shrink-0`,(!n||u)&&`ml-auto`),children:p}):null]}),(0,Y.jsxs)(`div`,{className:`flex gap-1.5 px-2.5 pt-1 pb-2`,children:[(0,Y.jsx)(L,{asChild:!0,variant:`contrast`,className:`relative min-w-0 flex-1 justify-center`,children:(0,Y.jsxs)(K,{to:`/new`,onClick:f,children:[(0,Y.jsx)(wo,{className:`size-[15px]`,"aria-hidden":`true`}),`New task`,(0,Y.jsx)(`kbd`,{"aria-hidden":`true`,className:`absolute right-2.5 rounded-[5px] border border-b-2 border-contrast-foreground/25 bg-transparent px-[5px] py-px font-mono text-[10.5px] font-medium text-contrast-foreground/60`,children:`C`})]})}),d?null:(0,Y.jsx)(pl,{})]}),u?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`shrink-0 border-b border-border px-1.5 pt-0.5 pb-2`,children:(0,Y.jsx)(dl,{onNavigate:f})}),(0,Y.jsx)(`div`,{"data-slot":`project-groups`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-1.5 pt-1.5 pb-2`,children:(0,Y.jsx)(rl.Provider,{value:f,children:u})})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`nav`,{"aria-label":`Main`,className:`px-2.5 py-1.5`,children:t.map(t=>{let n=t.to===e,o=t.icon;return(0,Y.jsxs)(K,{to:t.to,onClick:f,"aria-current":n?`page`:void 0,className:U(`flex h-11 w-full items-center gap-2.5 rounded-md px-2.5 text-[13.5px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground md:h-[34px]`,n&&`bg-muted font-semibold text-foreground`),children:[(0,Y.jsx)(o,{className:`size-4 shrink-0`,"aria-hidden":`true`}),t.label,t.badge===`inbox-count`&&r?(0,Y.jsx)(`span`,{"data-slot":`nav-badge`,className:`ml-auto rounded-full bg-violet px-1.5 py-px text-[10.5px] font-semibold text-violet-foreground`,children:r}):null,t.badge===`tasks-unread`&&i?(0,Y.jsx)(`span`,{"data-slot":`nav-unread-badge`,title:`${i} unread finished ${i===1?`task`:`tasks`}`,className:`ml-auto rounded-full bg-violet px-1.5 py-px text-[10.5px] font-semibold text-violet-foreground`,children:i}):null,t.badge===`skills-update`&&a?(0,Y.jsxs)(`span`,{"data-slot":`nav-update-marker`,className:`ml-auto flex items-center`,children:[(0,Y.jsx)(`span`,{className:`size-1.5 rounded-full bg-violet`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:`Skills update available`})]}):null]},t.to)})}),(0,Y.jsx)(`div`,{"data-slot":`task-quick-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-2.5 pb-2`,children:c})]}),(0,Y.jsxs)(`div`,{"data-slot":`sidebar-footer`,className:`flex flex-col gap-1.5 border-t border-border px-3.5 py-2.5`,children:[(0,Y.jsx)(ml,{}),(0,Y.jsxs)(`div`,{"data-slot":`sidebar-footer-controls`,className:`flex items-center gap-2`,children:[(0,Y.jsx)(`div`,{"data-slot":`tools-menu`,className:`shrink-0`,children:l}),o?(0,Y.jsx)(hl,{version:o,latestVersion:s}):null,(0,Y.jsx)(fl,{onNavigate:f,className:`ml-auto`}),(0,Y.jsx)(zc,{})]})]})]})}function dl({onNavigate:e}){let{pathname:t}=c(),n=t===`/tasks`;return(0,Y.jsxs)(M,{to:`/tasks`,"data-slot":`all-tasks-link`,onClick:e,"aria-current":n?`page`:void 0,className:U(`flex h-11 w-full items-center gap-2.5 rounded-md px-2.5 text-[13.5px] font-semibold text-foreground transition-colors hover:bg-muted md:h-9`,n&&`bg-muted`),children:[(0,Y.jsx)(uo,{className:U(`size-4 shrink-0`,n?`text-violet`:`text-violet/70`),"aria-hidden":`true`}),`All tasks`]})}function fl({className:e,onNavigate:t}){return(0,Y.jsx)(L,{asChild:!0,variant:`ghost`,size:`icon`,className:U(`size-7`,e),children:(0,Y.jsx)(M,{to:`/settings/global`,"data-slot":`global-settings-link`,"aria-label":`Global settings`,title:`Global settings`,onClick:t,children:(0,Y.jsx)(Oo,{className:`size-4`,"aria-hidden":`true`})})})}function pl(){let[e,t]=J.useState(!1),[n,r]=J.useState(!1);return(0,Y.jsxs)(Nr,{children:[(0,Y.jsx)(xr,{asChild:!0,children:(0,Y.jsx)(L,{variant:`outline`,size:`icon`,"aria-label":`Add project`,title:`Add project`,className:`size-11 shrink-0 md:size-9`,children:(0,Y.jsx)(eo,{className:`size-4`,"aria-hidden":`true`})})}),(0,Y.jsxs)(kr,{align:`start`,className:`w-56`,children:[(0,Y.jsx)(Er,{className:`text-xs text-soft-foreground`,children:`Add project`}),(0,Y.jsxs)(jr,{"data-slot":`add-project-local`,onSelect:()=>t(!0),children:[(0,Y.jsx)(ii,{"aria-hidden":`true`}),`Open local folder…`]}),(0,Y.jsxs)(jr,{"data-slot":`add-project-clone`,onSelect:()=>r(!0),children:[(0,Y.jsx)(vc,{"aria-hidden":`true`}),`Clone from GitHub…`]})]}),e?(0,Y.jsx)(mc,{open:!0,onOpenChange:t}):null,n?(0,Y.jsx)(_c,{open:!0,onOpenChange:r}):null]})}function ml(){return(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`command-palette-hint`,title:`Search — command palette (⌘K / Ctrl+K)`,onClick:()=>Vc(),className:`flex w-full items-center gap-1.5 rounded-md border border-border bg-muted/30 px-2 py-1 text-left text-xs font-medium text-soft-foreground transition-colors hover:bg-muted hover:text-foreground`,children:[(0,Y.jsx)(Rr,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`truncate`,children:`Search…`}),(0,Y.jsx)(`kbd`,{"aria-hidden":`true`,className:`ml-auto shrink-0 rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[10.5px] font-medium text-muted-foreground`,children:zn(`k`)})]})}function hl({version:e,latestVersion:t}){let n=!!(t&&t!==e);return(0,Y.jsxs)(`span`,{"data-slot":`version-chip`,"data-update-available":n?`true`:void 0,title:n?`v${e} — update available: v${t}`:`v${e}`,className:`flex min-w-0 items-center gap-1 rounded-full border border-border px-1.5 py-px font-mono text-[10px] font-medium text-soft-foreground`,children:[n?(0,Y.jsx)(q,{tone:`pending`,pulse:!0,className:`size-[5px] shrink-0`}):null,(0,Y.jsxs)(`span`,{className:`truncate`,children:[`v`,e]})]})}function gl(){return(0,Y.jsx)(`img`,{src:tl,alt:``,"aria-hidden":`true`,"data-slot":`brand-tile`,className:`size-[26px] shrink-0 rounded-sm`})}function _l({title:e}){return(0,Y.jsx)(`header`,{"data-slot":`mobile-top-bar`,className:`row-start-1 border-b border-border bg-card pt-[env(safe-area-inset-top)] md:hidden`,children:(0,Y.jsxs)(`div`,{className:`flex h-11 items-center gap-2.5 px-3`,children:[(0,Y.jsx)(Yn,{asChild:!0,children:(0,Y.jsx)(L,{variant:`ghost`,size:`icon`,"aria-label":`Open menu`,className:`-ml-1.5 size-11`,children:(0,Y.jsx)(go,{className:`size-[17px]`,"aria-hidden":`true`})})}),(0,Y.jsx)(`span`,{className:`truncate text-[14.5px] font-semibold`,children:e}),(0,Y.jsx)(`div`,{"data-slot":`mobile-status`,className:`ml-auto flex items-center gap-2`})]})})}var vl=J.createContext(null);function yl({children:e}){let[t,n]=J.useState(`active`),r=J.useMemo(()=>[t,n],[t]);return(0,Y.jsx)(vl.Provider,{value:r,children:e})}function bl(){let e=J.useContext(vl);if(!e)throw Error(`useListView must be used inside a <ListViewProvider>`);return e}var xl=[`claude`,`codex`,`opencode`,`pi`];function Sl(e){if(typeof e!=`object`||!e||Array.isArray(e))return{};let t=e,n={};for(let e of xl){let r=t[e];typeof r==`string`&&r.length>0&&r.length<=128&&(n[e]=r)}return n}function Cl(e,t){if(!e)return[];let n=new Map(e.providers.map(e=>[e.provider,e]));return xl.flatMap(e=>{let r=n.get(e);return r?.status!==`disconnected`||!r.authFailureId||t[e]===r.authFailureId?[]:[{provider:e,label:En[e],authFailureId:r.authFailureId}]})}function wl(e,t){return{...e,...Object.fromEntries(t.map(({provider:e,authFailureId:t})=>[e,t]))}}function Tl({status:e,pending:t,error:n,dismissals:r,onDismissAuthFailures:i}){if(t||!e)return null;let a;try{a=_t(e)}catch{return null}let o=Cl(a,r);if(o.length>0)return(0,Y.jsxs)(`div`,{"data-slot":`provider-banner`,role:`alert`,className:`flex min-h-9 items-center gap-2 border-b border-border bg-destructive/10 px-4 text-sm text-foreground`,children:[(0,Y.jsx)(q,{tone:`danger`}),(0,Y.jsxs)(`span`,{children:[`Provider authentication failed during a task:`,` `,o.map(({label:e})=>e).join(`, `),`.`]}),(0,Y.jsx)(K,{to:`/settings/agents#providers`,className:`ml-auto shrink-0 font-medium underline underline-offset-4 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:`Open agent settings`}),(0,Y.jsx)(`button`,{type:`button`,"aria-label":`Dismiss provider authentication alert`,onClick:()=>i(o),className:`shrink-0 rounded-sm p-1 text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:(0,Y.jsx)(ci,{className:`size-4`,"aria-hidden":`true`})})]});if(n||a.providers.some(e=>e.enabled&&e.status===`connected`))return null;let s=a.providers.some(e=>e.status===`connected`),c=a.providers.some(e=>e.status===`unknown`);return(0,Y.jsxs)(`div`,{"data-slot":`provider-banner`,role:`status`,className:`flex min-h-9 items-center gap-2 border-b border-border bg-muted/50 px-4 text-sm text-muted-foreground`,children:[(0,Y.jsx)(q,{tone:c?`danger`:`pending`}),(0,Y.jsx)(`span`,{children:s?`No agent provider is enabled.`:c?`No connected provider could be verified.`:`No agent provider credentials were found.`}),(0,Y.jsx)(K,{to:`/settings/agents#providers`,className:`ml-auto shrink-0 font-medium text-foreground underline underline-offset-4 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:`Configure providers`})]})}function El(e){if(!(typeof e!=`object`||!e||Array.isArray(e)))return e}function Dl(){let e=it(),t=Nt(),n=O(),r=(0,J.useRef)(Promise.resolve()),i=(0,J.useRef)(0),a=(0,J.useRef)(0),o=(0,J.useRef)(El(t.data));(0,J.useEffect)(()=>{a.current===0&&(o.current=El(t.data))},[t.data]);let s=(0,J.useCallback)(e=>{let t=F.uiState,s=El(n.getQueryData(t)),c=wl(Sl(s?.dismissedProviderAuthFailures),e),l={...s,dismissedProviderAuthFailures:c};a.current+=1,n.setQueryData(t,l);let u=++i.current;r.current=r.current.then(async()=>{try{let e=await st({dismissedProviderAuthFailures:c});o.current=El(e),u===i.current&&n.setQueryData(t,e)}catch(e){u===i.current&&(o.current===void 0?n.removeQueries({queryKey:t,exact:!0}):n.setQueryData(t,o.current),n.invalidateQueries({queryKey:t}),z(e instanceof Error?e.message:String(e),{tone:`danger`}))}finally{--a.current}})},[n]);return(0,Y.jsx)(Tl,{status:e.data,pending:e.isPending,error:e.isError,dismissals:Sl(El(t.data)?.dismissedProviderAuthFailures),onDismissAuthFailures:s})}function Ol({pinned:e,onToggle:t,className:n}){return(0,Y.jsx)(`button`,{type:`button`,"data-slot":`pin-toggle`,"data-pinned":e?`true`:void 0,"aria-pressed":e,"aria-label":e?`Unpin task`:`Pin task`,title:e?`Unpin from the top of the list`:`Pin to the top of the list`,onClick:n=>{n.stopPropagation(),t(!e)},className:U(`inline-flex size-5 shrink-0 items-center justify-center rounded-sm text-soft-foreground transition-colors hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,e&&`text-violet hover:text-violet`,n),children:(0,Y.jsx)(kn,{className:U(`size-3`,e&&`fill-current`),"aria-hidden":`true`})})}function kl({runs:e,view:t,onViewChange:n,currentRunId:r=null,now:i=Date.now(),showTokens:a=!0,showCost:o=!0,onTogglePin:s}){let c=lt(e),l=Ot(e,t),u=t===`archived`?void 0:s;return(0,Y.jsxs)(`div`,{"data-slot":`quick-list`,children:[(0,Y.jsx)(`div`,{className:`sticky top-0 z-10 bg-sidebar pt-2 pb-1`,children:(0,Y.jsxs)(`div`,{className:`inline-flex w-full gap-0.5 rounded-md bg-muted p-[3px]`,children:[(0,Y.jsxs)(jl,{view:`active`,current:t,onSelect:n,count:c.active,children:[`Active`,c.waiting>0&&t!==`active`?(0,Y.jsx)(q,{tone:`pending`,pulse:!0,"data-slot":`waiting-dot`,"aria-label":`needs you`}):null]}),(0,Y.jsx)(jl,{view:`archived`,current:t,onSelect:n,count:c.archived,children:`Archived`})]})}),l.length===0?(0,Y.jsx)(`p`,{className:`px-3 py-3.5 text-xs text-soft-foreground`,children:t===`archived`?`Nothing archived yet.`:`No tasks yet — describe one.`}):(0,Y.jsx)(Al,{buckets:l,currentRunId:r,now:i,showTokens:a,showCost:o,onTogglePin:u})]})}function Al({buckets:e,currentRunId:t=null,now:n=Date.now(),scope:r=null,showTokens:i=!0,showCost:a=!0,onTogglePin:o}){let[s,c]=J.useState(()=>new Set),l=e=>c(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n});return(0,Y.jsx)(Y.Fragment,{children:e.map(e=>(0,Y.jsxs)(`div`,{"data-slot":`quick-list-bucket`,"data-bucket":e.label,children:[(0,Y.jsx)(`h2`,{className:`px-3 pt-2.5 pb-1 text-[11px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:e.label}),e.rows.map(e=>(0,Y.jsx)(Ml,{row:e,currentRunId:t,now:n,scope:r,showTokens:i,showCost:a,expanded:e.kind===`group`&&s.has(e.groupId),onToggle:l,onTogglePin:o},e.kind===`group`?e.groupId:e.run.id))]},e.label))})}function jl({view:e,current:t,onSelect:n,count:r,children:i}){let a=e===t;return(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`view-tab`,"data-view":e,"aria-pressed":a,onClick:()=>n(e),className:U(`flex h-7 flex-1 items-center justify-center gap-1.5 rounded-[7px] text-[12.5px] font-medium text-muted-foreground`,a&&`bg-card font-semibold text-foreground shadow-xs`),children:[i,r>0?(0,Y.jsx)(`span`,{className:`font-mono text-[11px] tabular-nums`,children:r}):null]})}function Ml({row:e,currentRunId:t,now:n,scope:r,expanded:i,onToggle:a,showTokens:o,showCost:s,onTogglePin:c}){return e.kind===`run`?(0,Y.jsx)(Pl,{run:e.run,queuePosition:e.queuePosition,currentRunId:t,now:n,scope:r,showTokens:o,showCost:s,onTogglePin:c}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`flex items-center rounded-sm hover:bg-muted`,children:[(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`group-tile`,"data-group-id":e.groupId,"aria-expanded":i,onClick:()=>a(e.groupId),className:`flex min-w-0 flex-1 items-center gap-2 px-2.5 py-[7px] text-left`,children:[(0,Y.jsx)(Xn,{className:U(`size-3 shrink-0 text-soft-foreground transition-transform`,!i&&`-rotate-90`),"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`min-w-[7rem] flex-1 truncate text-[13px] font-medium`,children:e.title}),(0,Y.jsxs)(`span`,{className:`shrink-0 rounded-full bg-muted px-1.5 py-px font-mono text-[10.5px] font-semibold text-muted-foreground`,children:[`×`,e.members.length]})]}),(0,Y.jsx)(K,{to:Ei(r,`/compare/${e.groupId}`),"data-slot":`group-compare`,title:`Compare the variants`,"aria-label":`Compare the variants of ${e.title}`,className:`mr-1.5 inline-flex size-6 shrink-0 items-center justify-center rounded-sm text-soft-foreground hover:bg-violet/10 hover:text-violet`,children:(0,Y.jsx)(Eo,{className:`size-3.5`,"aria-hidden":`true`})})]}),i?e.members.map(e=>(0,Y.jsx)(Pl,{run:e,queuePosition:null,currentRunId:t,now:n,scope:r,variant:!0,showTokens:o,showCost:s,onTogglePin:c},e.id)):null]})}var Nl=`w-0 overflow-hidden opacity-0 group-hover/task-row:mr-1 group-hover/task-row:w-5 group-hover/task-row:opacity-100 group-focus-within/task-row:mr-1 group-focus-within/task-row:w-5 group-focus-within/task-row:opacity-100 no-hover:mr-1 no-hover:size-7 no-hover:opacity-100 data-[pinned=true]:mr-1 data-[pinned=true]:w-5 data-[pinned=true]:opacity-100`;function Pl({run:e,queuePosition:t,currentRunId:n,now:r,scope:i,variant:a=!1,showTokens:o,showCost:s,onTogglePin:c}){let l=Li(e),u=e.id===n,d=Je(e),f=Kt(e),p=Le(f,d?.number)?We(f).rest:f,m=mn(e),h=hn(e),g=a?``:t===null?Vi(e.finishedAt??e.createdAt,r):`#${t}`;return(0,Y.jsxs)(`div`,{"data-slot":`task-row`,"data-run-id":e.id,"data-active":u?`true`:void 0,className:U(`group/task-row flex items-center gap-2 rounded-sm pl-2.5 hover:bg-muted`,u&&`bg-muted`,a&&`pl-[26px]`),children:[(0,Y.jsx)(q,{tone:l.tone,pulse:l.pulse,"aria-label":l.label,role:`img`}),d?(0,Y.jsx)(Tn,{run:e,reference:d,compact:!0,className:`h-auto shrink-0 gap-[2px] px-1.5 py-px text-[10.5px]`}):null,(0,Y.jsxs)(K,{to:Ei(i,`/tasks/${e.id}`),title:f,"aria-current":u?`page`:void 0,className:`flex min-w-0 flex-1 items-center gap-2 py-[7px] pr-2.5`,children:[a?(0,Y.jsx)(`span`,{className:`inline-flex size-[15px] shrink-0 items-center justify-center rounded-full bg-violet/15 font-mono text-[9.5px] font-semibold text-violet`,children:e.variant??`?`}):null,(0,Y.jsx)(`span`,{"data-slot":`task-row-title`,className:U(`min-w-[7rem] flex-1 truncate text-[13px]`,m?`font-semibold text-foreground`:h?`font-medium text-muted-foreground`:`font-medium`),children:a?Fl(e,o,s):p}),e.diffStat?(0,Y.jsx)($i,{stat:e.diffStat,className:`hidden shrink-0 text-[10.5px] @min-[23rem]/sidebar:inline`}):null,g&&(t!==null||!d)?(0,Y.jsx)(`span`,{className:`shrink-0 text-[11px] text-soft-foreground tabular-nums`,children:g}):null,m?(0,Y.jsx)(q,{tone:`violet`,role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,className:`ml-0.5 shrink-0`}):null]}),c?(0,Y.jsx)(Ol,{pinned:!!e.pinned,onToggle:t=>c(e,t),className:Nl}):null]})}function Fl(e,t,n){let r=[e.runner??`claude`];t&&(e.inputTokens!==void 0||e.outputTokens!==void 0)?r.push(Fi(e.inputTokens,e.outputTokens)):t&&e.tokensUsed&&r.push(Pi(e.tokensUsed,!1));let i=Tt(e.costUsd);return n&&i&&r.push(i),r.join(` · `)}function Il(){let e=b(),t=zt(),n=Ii(I().data),[r,i]=bl(),a=ki(`/tasks/:id/*`),o=ki(`/tasks/:id`),s=qn(3e4),c=dt(),l=J.useMemo(()=>c===void 0?[]:(e.data??[]).flatMap(e=>{let t=Je(e);return t?[{projectId:c,kind:t.kind,number:t.number}]:[]}),[e.data,c]);return e.data?(0,Y.jsx)(Nn,{projectId:c,requests:l,children:(0,Y.jsx)(kl,{runs:e.data,view:r,onViewChange:i,currentRunId:a?.params.id??o?.params.id??null,now:s,showTokens:n.tokens,showCost:n.cost,onTogglePin:(e,n)=>t.mutate({id:e.id,pinned:n},{onError:e=>z(e.message,{tone:`danger`})})})}):null}var Ll=`xez-sidebar-collapsed`;function Rl(e){if(typeof e!=`object`||!e||Array.isArray(e))return{};let t={};for(let[n,r]of Object.entries(e))typeof r==`boolean`&&(t[n]=r);return t}function zl(){try{let e=localStorage.getItem(Ll);return e===null?{}:Rl(JSON.parse(e))}catch{return{}}}function Bl(e){try{localStorage.setItem(Ll,JSON.stringify(e))}catch{}}function Vl(e,t,n){let r=e?.[t];return r===void 0?t!==n:r}var Hl=10;function Ul(e){let[t,n]=J.useState(zl),r=J.useRef(t);return{collapsed:t,toggle:J.useCallback(t=>{let i={...r.current,[t]:!Vl(r.current,t,e)};r.current=i,Bl(i),n(i)},[e])}}function Wl({projects:e,bootProjectId:t,inboxAvailable:n=!1,automationsAvailable:r=!1,inboxCount:i=null,skillsUpdateAvailable:a=!1}){let{pathname:o}=c(),s=Oi(o),l=s??t,{collapsed:u,toggle:d}=Ul(l),[f]=bl(),p=Sc(ji(o)),m=ki(`/tasks/:id/*`),h=ki(`/tasks/:id`),g=m?.params.id??h?.params.id??null,_=qn(3e4),v=Ii(I().data);return(0,Y.jsx)(`div`,{"data-slot":`project-group-list`,children:J.useMemo(()=>[...e].sort((e,t)=>t.lastOpenedAt.localeCompare(e.lastOpenedAt)),[e]).map(e=>(0,Y.jsx)(Gl,{project:e,boot:e.id===t,active:e.id===s,collapsed:Vl(u,e.id,l),onToggle:d,view:f,activeTo:p,currentRunId:g,now:_,inboxAvailable:n,automationsAvailable:r,inboxCount:i,skillsUpdateAvailable:a,showTokens:v.tokens,showCost:v.cost},e.id))})}function Gl({project:e,boot:t,active:n,collapsed:r,onToggle:i,view:a,activeTo:o,currentRunId:s,now:c,inboxAvailable:l,automationsAvailable:u,inboxCount:d,skillsUpdateAvailable:f,showTokens:p,showCost:m}){let h=e.status===`missing`,g=Gt(e.id,!r&&!h,t),_=il(),v=zt(e.id,t?`default`:e.id),y=g.data?lt(g.data).waiting:0,b=g.data?rt(Ot(g.data,a),Hl):[],x=b.flatMap(t=>t.rows.flatMap(t=>{let n=Je(t.kind===`run`?t.run:t.members[0]);return n?[{projectId:e.id,kind:n.kind,number:n.number}]:[]}));if(h)return(0,Y.jsx)(`div`,{"data-slot":`project-group`,"data-project":e.id,"data-status":`missing`,className:`mb-1`,children:(0,Y.jsxs)(`div`,{"data-slot":`project-group-header`,title:`${e.root} is gone — remove it in Global settings → Projects`,className:`flex h-11 w-full items-center gap-[7px] rounded-lg px-2 text-[13px] font-semibold opacity-55 md:h-[34px]`,children:[(0,Y.jsx)(`span`,{className:`w-3 shrink-0`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`truncate`,children:e.name}),(0,Y.jsx)(`span`,{"data-slot":`project-missing`,className:`ml-auto shrink-0 rounded-full bg-danger/15 px-[7px] py-px text-[10px] font-medium text-danger`,children:`folder not found`})]})});let S=`project-group-${e.id}`;return(0,Y.jsxs)(`div`,{"data-slot":`project-group`,"data-project":e.id,"data-status":e.status,"data-collapsed":r?``:void 0,"data-active":n?``:void 0,className:`mb-1`,children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>i(e.id),"aria-expanded":!r,"aria-controls":S,"data-slot":`project-group-header`,className:U(`flex h-11 w-full items-center gap-[7px] rounded-lg px-2 text-left text-[13px] font-semibold transition-colors hover:bg-muted md:h-[34px]`,n&&`bg-muted`),children:[(0,Y.jsx)(Xn,{className:U(`size-3 shrink-0 text-muted-foreground transition-transform`,r&&`-rotate-90`),"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`truncate`,children:e.name}),y?(0,Y.jsx)(`span`,{"data-slot":`project-attention`,title:`${y} task${y===1?``:`s`} need${y===1?`s`:``} you`,className:`shrink-0 rounded-full bg-violet px-1.5 py-px text-[10.5px] font-semibold text-violet-foreground`,children:y}):null,e.branch?(0,Y.jsx)(`span`,{"data-slot":`project-branch`,className:`ml-auto max-w-[92px] truncate font-mono text-[10.5px] font-medium text-soft-foreground`,children:e.branch}):null]}),r?null:(0,Y.jsxs)(`div`,{id:S,"data-slot":`project-group-body`,className:`mt-1 ml-[14px] border-l border-border pl-2`,children:[(0,Y.jsx)(`nav`,{"aria-label":`${e.name} navigation`,children:bc({forge:e.forge===`github`,inbox:l,automations:u}).map(t=>{let r=n&&t.to===o,i=t.icon;return(0,Y.jsxs)(K,{to:Ei(e.id,t.to),onClick:_,"aria-current":r?`page`:void 0,className:U(`flex h-11 w-full items-center gap-2.5 rounded-md px-2.5 text-[13px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground md:h-[30px]`,r&&`bg-muted font-semibold text-foreground`),children:[(0,Y.jsx)(i,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),t.label,t.badge===`inbox-count`&&n&&d?(0,Y.jsx)(`span`,{"data-slot":`nav-badge`,className:`ml-auto rounded-full bg-violet px-1.5 py-px text-[10.5px] font-semibold text-violet-foreground`,children:d}):null,t.badge===`skills-update`&&n&&f?(0,Y.jsxs)(`span`,{"data-slot":`nav-update-marker`,className:`ml-auto flex items-center`,children:[(0,Y.jsx)(`span`,{className:`size-1.5 rounded-full bg-violet`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:`Skills update available`})]}):null]},t.to)})}),(0,Y.jsx)(Nn,{projectId:e.id,requests:x,children:(0,Y.jsx)(Al,{buckets:b,currentRunId:n?s:null,now:c,scope:e.id,showTokens:p,showCost:m,onTogglePin:a===`archived`?void 0:(e,t)=>v.mutate({id:e.id,pinned:t},{onError:e=>z(e.message,{tone:`danger`})})})}),(0,Y.jsx)(K,{to:Ei(e.id,`/`),onClick:_,"data-slot":`project-group-more`,className:`flex h-9 items-center rounded-md px-3 text-[12px] text-muted-foreground transition-colors hover:text-foreground md:h-7`,children:`More…`})]})]})}var Kl={claude:!0,codex:!0,opencode:!0,pi:!0},ql=e=>Object.hasOwn(Kl,e.name);function Jl(e){let t=e.checks.filter(ql);if(t.length&&!t.some(e=>e.available))return`no agent CLI found — install one to run tasks`;let n=t.find(t=>t.name===e.defaultRunner);return n&&!n.available?`default runner (${e.defaultRunner}) not found`:null}function Yl(e){let t=`xezar v${e.version}`,n=Jl(e);if(n)return`${t} · ${n}`;let r=e.checks.filter(e=>!e.available).map(e=>e.name);return r.length?`${t} · optional: ${r.join(`, `)} not installed`:t}function Xl(e){return e.forge?.available?null:e.forge?`GitHub is unreachable — ${e.forge.reason??`unknown reason`}. The GitHub tab is hidden until it comes back.`:`No GitHub remote detected — the GitHub tab is hidden. Every plain-git feature still works.`}function Zl({health:e}){if(!e)return null;let t=Jl(e);return(0,Y.jsxs)(Nr,{children:[(0,Y.jsx)(xr,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`tools-menu-trigger`,title:Yl(e),className:`flex items-center gap-1.5 rounded-full border border-border px-2 py-0.5 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:[(0,Y.jsx)(q,{tone:t?`pending`:`success`}),`Tools`,(0,Y.jsx)(Xn,{className:`size-[11px]`,"aria-hidden":`true`})]})}),(0,Y.jsxs)(kr,{side:`top`,align:`start`,"data-slot":`tools-menu-content`,className:`w-[240px]`,children:[(0,Y.jsx)(Er,{className:`text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:`Installed tools`}),e.checks.map(e=>e.available?(0,Y.jsx)(Ql,{check:e},e.name):(0,Y.jsx)($l,{check:e},e.name)),Xl(e)?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Mr,{}),(0,Y.jsx)(`p`,{"data-slot":`forge-note`,className:`px-2 py-1.5 text-[11px] leading-snug text-muted-foreground`,children:Xl(e)})]}):null,(0,Y.jsx)(Mr,{}),(0,Y.jsx)(jr,{asChild:!0,children:(0,Y.jsxs)(K,{to:`/settings/agents`,"data-slot":`tools-settings`,className:`gap-2 text-[12.5px] text-muted-foreground`,children:[(0,Y.jsx)(Oo,{className:`size-3.5`,"aria-hidden":`true`}),`Tool settings`]})})]})]})}function Ql({check:e}){return(0,Y.jsxs)(`div`,{"data-slot":`tool-row`,"data-tool":e.name,"data-available":`true`,className:`flex items-center gap-2 rounded-sm px-2 py-1.5`,children:[(0,Y.jsx)(q,{tone:`success`}),(0,Y.jsx)(`span`,{className:`font-mono text-[12.5px] font-medium`,children:e.name}),(0,Y.jsx)(`span`,{"data-slot":`tool-version`,className:`ml-auto font-mono text-[11.5px] font-medium text-muted-foreground tabular-nums`,children:e.version??`not found`})]})}function $l({check:e}){return(0,Y.jsx)(jr,{asChild:!0,children:(0,Y.jsxs)(K,{to:`/settings/agents`,"data-slot":`tool-row`,"data-tool":e.name,"data-available":`false`,className:`flex-col items-stretch gap-1`,children:[(0,Y.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(q,{tone:`danger`}),(0,Y.jsx)(`span`,{className:`font-mono text-[12.5px] font-medium`,children:e.name}),(0,Y.jsx)(`span`,{"data-slot":`tool-version`,className:`ml-auto font-mono text-[11.5px] font-medium text-muted-foreground`,children:`not found`})]}),(0,Y.jsxs)(`span`,{className:`flex items-end justify-between gap-3 pl-[15px]`,children:[e.hint?(0,Y.jsx)(`span`,{"data-slot":`tool-hint`,className:`min-w-0 text-[11px] leading-snug text-muted-foreground`,children:e.hint}):null,(0,Y.jsx)(`span`,{"data-slot":`tool-setup`,className:`ml-auto shrink-0 text-[11.5px] font-semibold text-violet`,children:`Set up →`})]})]})})}function eu(e){return e?.trim()||null}function tu({projectName:e,pageLabel:t}){let n=eu(e),r=eu(t);return n&&r?`${n} — ${r} · xezar`:n?`${n} · xezar`:r?`${r} · xezar`:`xezar`}function nu(e){let t=tu(e);(0,J.useEffect)(()=>{document.title=t},[t])}var ru=`xez-last-location`;function iu(){try{let e=localStorage.getItem(ru);return e===null?null:JSON.parse(e)}catch{return null}}function au(e){try{localStorage.setItem(ru,JSON.stringify(e))}catch{}}var ou=new Set([`projectId`,`pathname`,`search`,`hash`]);function su(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t=e;if(Object.keys(t).some(e=>!ou.has(e))||typeof t.projectId!=`string`||t.projectId.length<1||t.projectId.length>64||typeof t.pathname!=`string`||t.pathname.length<1||t.pathname.length>2048||!t.pathname.startsWith(`/p/`)||t.search!==void 0&&(typeof t.search!=`string`||t.search.length>4096||!t.search.startsWith(`?`))||t.hash!==void 0&&(typeof t.hash!=`string`||t.hash.length>2048||!t.hash.startsWith(`#`)))return null;try{if(Oi(t.pathname)!==t.projectId)return null}catch{return null}return{projectId:t.projectId,pathname:t.pathname,...t.search===void 0?{}:{search:t.search},...t.hash===void 0?{}:{hash:t.hash}}}function cu(e,t){let n=t.projects.find(t=>t.id===e);return n!==void 0&&n.status!==`missing`}function lu(e,t){if(t===void 0)return null;let n;try{n=Oi(e.pathname)}catch{return null}return n===null||!cu(n,t)?null:su({projectId:n,pathname:e.pathname,...e.search===``?{}:{search:e.search},...e.hash===``?{}:{hash:e.hash}})}function uu(e,t,n){let r=su(e);return r===null||!(t===void 0?n!==void 0&&r.projectId===n:cu(r.projectId,t))?null:`${r.pathname}${r.search??``}${r.hash??``}`}function du(e,t){let n=su(e);return n!==null&&n.projectId===t.projectId&&n.pathname===t.pathname&&(n.search??``)===(t.search??``)&&(n.hash??``)===(t.hash??``)}function fu(){return(0,Y.jsx)(`div`,{"data-route":`compare`,className:`flex min-h-full flex-col`,children:(0,Y.jsx)(V,{icon:(0,Y.jsx)(gt,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading variants…`,subtitle:`Fetching every variant's status, spend and diff summary.`})})}function pu(){return(0,Y.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Y.jsx)(V,{icon:(0,Y.jsx)(gt,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading GitHub…`,subtitle:`Fetching open issues and pull requests.`})})}function mu(e){let t=it(),n=tn(),r=ht(t.data),i=n.data?.defaultRunner,a=or(e.runner,r,i??r[0]??`claude`),o=me(a),s=n.data?.modelsLocked===!0,{accounts:c,repoAccount:l}=Wr(),u=c.some(t=>t.provider===a&&t.id===e.account)?e.account:null;return{runner:a,runnerExplicit:e.runner!==null,model:er(s?null:e.model,a,n.data?.defaultModels,o.data),runners:r,defaultRunner:i,canRun:t.isSuccess&&r.length>0,modelsLocked:s,providerPending:t.isPending,providerError:t.isError,accounts:c,account:u,repoAccount:l}}function hu(e){return{runner:tr(e.runner,e.defaultRunner,e.runnerExplicit),model:e.modelsLocked?void 0:e.model||void 0}}function gu(e){return{...hu(e),...e.account?{agentProfile:e.account}:{}}}function _u({pick:e,onChange:t,disabled:n=!1,accounts:r=!1}){let i=mu(e),{runner:a,model:o,runners:s,canRun:c,modelsLocked:l}=i,u=tn(),d=me(a),f=lr(a,d.data,[e.model,u.data?.defaultModels?.[a]]),p=n||!c,m=r?i.accounts:[];return(0,Y.jsxs)(Y.Fragment,{children:[s.length>1||s.some(e=>Ur(m,e))?(0,Y.jsx)(Hr,{runners:s,value:a,accounts:m,account:r?i.account:null,repoAccount:r?i.repoAccount:void 0,disabled:p,onPick:(n,i)=>t(r?{runner:n,account:i,model:n===a?e.model:null}:{runner:n,account:null,model:null})}):null,(0,Y.jsx)($r,{slot:`model-pill`,ariaLabel:`Model`,label:f.find(e=>e.id===o).label,value:o,disabled:p,readOnly:l===!0,disabledHint:l?`Model selection is locked to native coding-agent settings.`:void 0,onPick:n=>t({...e,model:n}),options:f.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:Qn(a,d.data,d.isError)})]})}function vu({templates:e,onInsert:t,triggerClassName:n,disabled:r,iconOnly:i=!1}){let[a,o]=(0,J.useState)(!1),s=(0,J.useRef)(null),c=Di();return e.length===0?null:(0,Y.jsxs)(ur,{open:a,onOpenChange:o,children:[(0,Y.jsx)(rr,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-trigger`,"aria-label":`Insert a prompt template`,title:`Insert a prompt template`,disabled:r,className:U(`inline-flex h-[26px] items-center gap-1.5 rounded-full border border-border bg-card text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-50`,i?`w-[26px] justify-center px-0`:`px-2.5`,n),children:[(0,Y.jsx)(yo,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),i?null:(0,Y.jsxs)(Y.Fragment,{children:[`templates`,(0,Y.jsx)(Xn,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})]})}),(0,Y.jsx)(ir,{align:`start`,sideOffset:8,"data-slot":`prompt-template-menu`,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,onCloseAutoFocus:e=>e.preventDefault(),children:(0,Y.jsxs)(Zr,{filter:Ui,children:[(0,Y.jsx)(zr,{placeholder:`search templates…`,onInput:()=>s.current?.scrollTo(0,0)}),(0,Y.jsxs)(ri,{ref:s,"data-slot":`prompt-template-list-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,Y.jsx)(Gr,{children:`Nothing matches.`}),(0,Y.jsx)(W,{heading:`Insert a template`,children:e.map(e=>(0,Y.jsxs)(G,{value:`template ${e.label} ${e.id}`,keywords:[e.text,...e.skills??[]],"data-slot":`prompt-template-option`,"data-template":e.id,title:e.text,className:`flex-col items-start gap-0.5`,onSelect:()=>{t(e.text),o(!1)},children:[(0,Y.jsxs)(`span`,{className:`flex w-full items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[12.5px] font-medium text-foreground`,children:e.label}),e.skills&&e.skills.length>0?(0,Y.jsxs)(`span`,{"data-slot":`prompt-template-assigned`,title:`Applied automatically with: ${e.skills.join(`, `)}`,className:`inline-flex shrink-0 items-center gap-0.5 text-[10px] font-medium text-violet`,children:[(0,Y.jsx)(oi,{"aria-hidden":`true`,className:`size-2.5`}),e.skills.length]}):null]}),(0,Y.jsx)(`span`,{className:`line-clamp-1 text-[11px] text-soft-foreground`,children:e.text})]},e.id))}),(0,Y.jsx)(Vr,{}),(0,Y.jsx)(W,{children:(0,Y.jsx)(G,{value:`edit prompt templates settings`,"data-slot":`prompt-template-settings`,className:`text-[12px] text-muted-foreground`,onSelect:()=>{o(!1),c(`/settings/prompt-templates`)},children:`Edit templates…`})})]})]})})]})}var yu=Li({status:`waiting`});function bu(e){return e.filter(e=>!e.startedTaskId)}function xu(e){return e.runnable??!!(e.suggestedSkill||e.suggestedPrompt)}function Su(){let e=I(),t=e.data?.capabilities.followups===!0,n=e.data!==void 0&&!t,r=ke(!n),i=b(),a=r.data===void 0?void 0:bu(r.data);return(0,Y.jsxs)(`div`,{"data-route":`inbox`,className:`flex min-h-full flex-col`,children:[(0,Y.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,Y.jsx)(`h1`,{className:`text-base font-semibold`,children:`Inbox`}),(0,Y.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:n?`Disabled for this server; per-task Notes still run.`:`Follow-ups agents suggested when they finished a task.`})]}),(0,Y.jsx)(`div`,{className:`flex flex-1 flex-col p-3 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-5 md:pb-5`,children:n?(0,Y.jsx)(V,{icon:(0,Y.jsx)(co,{}),tone:`neutral`,title:`The follow-up inbox is off`,subtitle:`Agents are not asked to leave follow-ups. Set XEZ_FOLLOWUPS=1 and restart xezar to turn the inbox on.`,heading:`h2`}):a===void 0?r.isError?(0,Y.jsx)(V,{icon:(0,Y.jsx)(si,{}),tone:`danger`,title:`Could not load the inbox`,subtitle:r.error.message,heading:`h2`}):null:a.length===0?e.isPending?null:(0,Y.jsx)(V,{icon:(0,Y.jsx)(co,{}),tone:`neutral`,title:`Inbox empty`,subtitle:`Agents drop follow-up suggestions here when they finish a task.`,heading:`h2`}):(0,Y.jsx)(`ul`,{"data-slot":`todo-list`,className:`mx-auto flex w-full max-w-3xl flex-col gap-2.5`,children:a.map(e=>(0,Y.jsx)(Cu,{todo:e,sourceTaskExists:e.taskId===void 0?null:i.data?.some(t=>t.id===e.taskId)??!1},e.id))})})]})}function Cu({todo:e,sourceTaskExists:t}){let n=Di(),r=O(),i=T(),[o,s]=(0,J.useState)({runner:null,model:null,account:null}),c=mu(o),[l,u]=(0,J.useState)(!1),[d,f]=(0,J.useState)(``),p=(0,J.useRef)(null),m=Br(i.data?.promptTemplates),h=e=>{let t=p.current?.selectionStart??d.length,n=Qr(d,t,e);f(n.text),requestAnimationFrame(()=>{p.current?.focus(),p.current?.setSelectionRange(n.caret,n.caret)})},g=P({mutationFn:async()=>c.canRun?Ce(e.id,{...hu(c),prompt:d.trim()||void 0}):null,onSuccess:e=>{if(e===null)return;let{run:t}=e;r.invalidateQueries({queryKey:B.todos}),r.invalidateQueries({queryKey:B.runs.all}),n(`/tasks/${t.id}`)},onError:e=>z(e.message,{tone:`danger`})}),_=P({mutationFn:()=>Ge(e.id),onSuccess:()=>{r.setQueryData(B.todos,t=>t?.filter(t=>t.id!==e.id)),r.invalidateQueries({queryKey:B.todos})},onError:e=>z(e.message,{tone:`danger`})}),v=g.isPending||_.isPending,y=xu(e);return(0,Y.jsxs)(`li`,{"data-slot":`todo-card`,"data-id":e.id,className:`flex flex-col gap-2.5 rounded-lg border border-border bg-card p-4 shadow-xs`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Y.jsx)(q,{tone:yu.tone,pulse:yu.pulse,title:yu.label,className:`mt-[5px]`}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`p`,{"data-slot":`todo-summary`,className:`text-sm leading-snug font-medium text-foreground`,children:e.summary}),(0,Y.jsxs)(`div`,{"data-slot":`todo-meta`,className:`mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-soft-foreground`,children:[e.ts?(0,Y.jsxs)(`span`,{children:[Vi(e.ts),` ago`]}):null,e.action?(0,Y.jsx)(`span`,{children:e.action}):null,e.taskId===void 0?null:t?(0,Y.jsx)(K,{to:`/tasks/${e.taskId}`,"data-slot":`todo-source`,className:`text-muted-foreground underline decoration-border underline-offset-2 hover:text-foreground`,children:`source task`}):(0,Y.jsx)(`span`,{"data-slot":`todo-source-gone`,children:`source task deleted`}),sn(e.prUrl)?(0,Y.jsx)(`a`,{href:e.prUrl,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`todo-pr`,className:`text-muted-foreground underline decoration-border underline-offset-2 hover:text-foreground`,children:`PR`}):null,e.suggestedSkill?(0,Y.jsxs)(`span`,{"data-slot":`todo-skill`,className:`font-mono`,children:[`skill: `,e.suggestedSkill]}):null]})]}),(0,Y.jsx)(`div`,{className:`flex shrink-0 items-center gap-1.5 self-center`,children:y?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(L,{type:`button`,variant:`contrast`,size:`sm`,"data-action":`todo-run`,title:`Start a task from this follow-up`,disabled:v||!c.canRun,onClick:()=>g.mutate(),children:[(0,Y.jsx)(_r,{"aria-hidden":`true`,className:`size-3`}),`Run`]}),(0,Y.jsx)(L,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`todo-dismiss`,title:`Check off (remove)`,disabled:v,onClick:()=>_.mutate(),children:`Dismiss`})]}):(0,Y.jsxs)(L,{type:`button`,variant:`contrast`,size:`sm`,"data-action":`todo-acknowledge`,title:`Acknowledge and remove this note`,disabled:v,onClick:()=>_.mutate(),children:[(0,Y.jsx)(a,{"aria-hidden":`true`,className:`size-3`}),`Acknowledge`]})})]}),y?(0,Y.jsxs)(`div`,{"data-slot":`todo-engine`,className:`flex flex-wrap items-center gap-2 pl-5`,children:[(0,Y.jsx)(_u,{pick:o,onChange:s,disabled:v||!c.canRun}),!c.providerPending&&!c.canRun?(0,Y.jsxs)(`span`,{"data-slot":`todo-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[c.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this follow-up.`,(0,Y.jsx)(K,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}):null,y?l?(0,Y.jsxs)(`div`,{"data-slot":`todo-instructions`,className:`flex flex-col gap-2 pl-5`,children:[(0,Y.jsx)(li,{ref:p,"data-slot":`todo-instructions-input`,"aria-label":`Extra instructions for this follow-up`,value:d,onChange:e=>f(e.target.value),placeholder:`Add instructions for the agent… (appended to the suggestion above)`,maxLength:2e4,className:`min-h-16 text-[13px]`}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(vu,{templates:m,onInsert:h}),(0,Y.jsx)(`button`,{type:`button`,"data-slot":`todo-instructions-hide`,onClick:()=>u(!1),className:`text-xs font-medium text-muted-foreground underline decoration-border underline-offset-2 hover:text-foreground`,children:`Hide`})]})]}):(0,Y.jsx)(`button`,{type:`button`,"data-slot":`todo-instructions-toggle`,onClick:()=>u(!0),className:`self-start pl-5 text-xs font-medium text-muted-foreground underline decoration-border underline-offset-2 hover:text-foreground`,children:d.trim()?`Edit instructions (added)`:`+ Add instructions`}):null]})}var wu=38,Tu=280,Eu=900,Du=600,Ou=5500,ku=1400,X=e=>({text:e,tone:`key`}),Au=e=>({text:e,tone:`str`}),Z=e=>({text:e,tone:`fn`}),ju=e=>({text:e,tone:`com`}),Mu=e=>({text:e,tone:`num`}),Q=e=>({text:e}),Nu=[[[ju(`// task accepted — isolating a worktree`)],[X(`const`),Q(` tree = `),X(`await`),Q(` git.`),Z(`worktree`),Q(`(task.branch)`)],[X(`const`),Q(` agent = `),Z(`spawn`),Q(`(runner, { tree, skills })`)],[X(`for await`),Q(` (`),X(`const`),Q(` event `),X(`of`),Q(` agent.`),Z(`stream`),Q(`()) {`)],[Q(` cockpit.`),Z(`render`),Q(`(event)`)],[Q(`}`)]],[[Q(`$ xezar run `),Au(`--worktree --autonomous`)],[Au(`✓`),Q(` worktree ready · base `),Au(`main`)],[Au(`✓`),Q(` agent started`)],[ju(`… editing src/routes/new-task.tsx`)],[Au(`✓`),Q(` tests green · `),Mu(`+42 −7`)],[Au(`✓`),Q(` pull request opened`)]],[[ju(`# flaky: replay before touching code`)],[X(`def`),Q(` `),Z(`stabilize`),Q(`(test):`)],[Q(` `),X(`for`),Q(` attempt `),X(`in`),Q(` `),Z(`range`),Q(`(`),Mu(`3`),Q(`):`)],[Q(` `),X(`if`),Q(` `),Z(`run`),Q(`(test).ok:`)],[Q(` `),X(`return`),Q(` `),Au(`'green'`)],[Q(` `),X(`return`),Q(` `),Z(`quarantine`),Q(`(test)`)]],[[ju(`// apply the reviewed plan, step by step`)],[X(`let`),Q(` diff = worktree.`),Z(`diff`),Q(`()?;`)],[X(`match`),Q(` `),Z(`review`),Q(`(diff) {`)],[Q(` Ok(pr) => gh::`),Z(`open`),Q(`(pr),`)],[Q(` Err(e) => `),Z(`retry`),Q(`(e, backoff),`)],[Q(`}`)]],[[ju(`// merge when every check is green`)],[X(`func`),Q(` `),Z(`merge`),Q(`(pr *PullRequest) `),X(`error`),Q(` {`)],[Q(` `),X(`if`),Q(` err := ci.`),Z(`Wait`),Q(`(pr); err != `),X(`nil`),Q(` {`)],[Q(` `),X(`return`),Q(` err`)],[Q(` }`)],[Q(` `),X(`return`),Q(` gh.`),Z(`Merge`),Q(`(pr)`)],[Q(`}`)]],[[ju(`-- which branches ship the most?`)],[X(`select`),Q(` branch, `),Z(`count`),Q(`(*) `),X(`as`),Q(` runs`)],[X(`from`),Q(` tasks`)],[X(`where`),Q(` status = `),Au(`'green'`)],[X(`group by`),Q(` branch`)],[X(`order by`),Q(` runs `),X(`desc`),Q(`;`)]],[[ju(`/* the composer glow, one token deep */`)],[Q(`.composer`),X(`:focus-within`),Q(` {`)],[Q(` border-color: `),Z(`var`),Q(`(--primary);`)],[Q(` box-shadow: `),Mu(`0 0 0 3px`),Q(` `),Z(`var`),Q(`(--ring);`)],[Q(` transition: box-shadow `),Mu(`120ms`),Q(` ease;`)],[Q(`}`)]]],Pu=[[`left-[3%] top-[12%]`,`left-[5%] top-[36%]`,`left-[8%] top-[58%]`],[`right-[3%] top-[14%]`,`right-[6%] top-[40%]`,`right-[4%] top-[62%]`],[`left-[28%] top-[66%]`,`left-[45%] top-[72%]`,`right-[26%] top-[70%]`]],Fu={key:`var(--syn-key)`,str:`var(--syn-str)`,fn:`var(--syn-fn)`,com:`var(--syn-com)`,num:`var(--syn-num)`},Iu=e=>e.reduce((e,t)=>e+t.text.length,0),Lu=e=>e.reduce((e,t)=>e+Iu(t)*wu+Tu,0);function Ru(e){let t=[...e];for(let e=t.length-1;e>0;e--){let n=Math.floor(Math.random()*(e+1)),r=t[e];t[e]=t[n],t[n]=r}return t}function zu(){let e=Ru(Nu).slice(0,Pu.length),t=Ru(Pu.map(e=>e[Math.floor(Math.random()*e.length)]??``)),n=Du;return{blocks:e.map((e,r)=>{let i=n;return n+=Lu(e)+Eu,{lines:e,slot:t[r]??``,startMs:i}}),cycleMs:n-Eu+Ou+ku}}function Bu({block:e,cycleMs:t}){let n=e.startMs;return(0,Y.jsx)(`div`,{className:U(`ghost-code-block absolute font-mono text-[11.5px] leading-[1.9] text-soft-foreground`,e.slot),style:{"--cycle":`${t}ms`},children:e.lines.map((e,t)=>{let r=Iu(e),i=n;return n+=r*wu+Tu,(0,Y.jsx)(`div`,{className:`ghost-code-line`,style:{"--n":r,"--t":`${r*wu}ms`,"--d":`${i}ms`},children:e.map((e,t)=>(0,Y.jsx)(`span`,{style:e.tone?{color:Fu[e.tone]}:void 0,children:e.text},t))},t)})})}var Vu=`(prefers-reduced-motion: reduce)`;function Hu(){let[e,t]=(0,J.useState)(()=>typeof window.matchMedia==`function`&&!window.matchMedia(Vu).matches);return(0,J.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(Vu),n=e=>t(!e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function Uu(){let[e,t]=(0,J.useState)(0),n=Hu(),r=(0,J.useMemo)(()=>zu(),[e]);return(0,J.useEffect)(()=>{if(!n)return;let e=window.setTimeout(()=>t(e=>e+1),r.cycleMs);return()=>window.clearTimeout(e)},[e,n,r.cycleMs]),(0,Y.jsx)(`div`,{"data-slot":`ghost-code-backdrop`,"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 -z-10 overflow-hidden max-xl:hidden [mask-image:linear-gradient(to_bottom,black_30%,transparent_96%)]`,children:(0,Y.jsx)(`div`,{className:`contents`,children:r.blocks.map((e,t)=>(0,Y.jsx)(Bu,{block:e,cycleMs:r.cycleMs},t))},e)})}function Wu({source:e,className:t}){return(0,Y.jsx)(`span`,{"data-slot":`skill-source`,"data-source":e,className:U(`shrink-0 rounded-full border border-border px-2 py-px font-mono text-[10.5px]`,qi({source:e})?`font-semibold text-foreground`:`text-soft-foreground`,t),children:e})}function Gu({skill:e,usedBy:t,heading:n=`h2`}){return(0,Y.jsxs)(`div`,{"data-slot":`skill-detail`,className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2.5`,children:[(0,Y.jsx)(n,{className:`min-w-0 font-mono text-lg font-semibold break-all`,children:e.name}),(0,Y.jsx)(Wu,{source:e.source})]}),(0,Y.jsxs)(`p`,{"data-slot":`skill-path`,className:`mt-1 font-mono text-[10.5px] break-all text-soft-foreground`,children:[e.path,e.team?` · from ${e.team.repo}`:``]}),e.description?(0,Y.jsx)(`p`,{"data-slot":`skill-description`,className:`mt-2.5 text-[13px] text-muted-foreground`,children:e.description}):null,t===void 0?null:(0,Y.jsxs)(`section`,{"data-slot":`skill-used-by`,className:`mt-5`,children:[(0,Y.jsx)(`h3`,{className:`text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:`Used by`}),t.length>0?(0,Y.jsx)(`ul`,{className:`mt-1.5 flex flex-col gap-1`,children:t.map(e=>(0,Y.jsxs)(`li`,{className:`flex items-center gap-1.5 font-mono text-xs text-muted-foreground`,children:[(0,Y.jsx)(Fa,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),e]},e))}):(0,Y.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:`Not referenced by any workflow yet — quick-task picks it up when the task mentions it.`})]}),(0,Y.jsxs)(`section`,{className:`mt-5`,children:[(0,Y.jsx)(`h3`,{className:`text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:`Content`}),(0,Y.jsx)(`div`,{"data-slot":`skill-body`,className:`mt-2 text-sm`,children:(0,Y.jsx)(Hi,{children:e.body})})]})]})}function Ku({skill:e,onClose:t}){return(0,Y.jsx)(wi,{open:e!==null,onOpenChange:e=>e?void 0:t(),children:(0,Y.jsx)(vi,{"data-slot":`skill-preview`,className:`block max-h-[80dvh] overflow-y-auto sm:max-w-2xl`,children:e?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(xi,{className:`sr-only`,children:e.name}),(0,Y.jsx)(Ci,{className:`sr-only`,children:`Read-only skill preview`}),(0,Y.jsx)(Gu,{skill:e,heading:`h3`}),(0,Y.jsx)(`p`,{className:`mt-5`,children:(0,Y.jsx)(K,{to:`/skills?skill=${encodeURIComponent(e.name)}`,"data-slot":`skill-preview-manage`,onClick:t,className:`text-xs font-semibold text-violet hover:underline`,children:`Open in the Skills catalog`})})]}):null})})}function qu(e,t,n){let r=e.skill===``?{source:`workflow`,ref:`quick-task`}:{source:`skill`,ref:e.skill};return ar({task:e.ref,source:r,model:``,runner:t,defaultRunner:n,variants:1,images:[],todoId:e.todo})}function Ju(e,t){return e.kind===`failed`?{message:`Auto-start failed: ${e.message} — review and press Start`,tone:`danger`}:e.kind===`blocked`?{message:`Auto-start blocked (bad key) — review and press Start`,tone:`danger`}:t===``?{message:`Prefilled from link — review and press Start`,tone:`default`}:{message:`Unknown skill "${t}" — prefilled for quick-task; review and press Start`,tone:`danger`}}function Yu(e,t){return`Use the "${e}" skill on: ${t}`}function Xu(e){let t=e.configuredAutonomous===`source-dependent`?e.source===`skill`:e.configuredAutonomous,n=e.interactive!==!0&&void 0;return{autonomous:e.planFirst?!1:e.explicitAutonomous??n??t,worktree:e.hasGit?e.variants>1?!0:e.explicitWorktree??n??e.configuredWorktree:!1}}function Zu(e){return e.worktree?`Runs in an isolated worktree — review everything before it lands.`:e.hasGit?`Runs in the repo working tree — your checkout is modified directly.`:`Runs in place — no git repository detected, so there is no worktree to isolate in.`}var Qu={text:``,source:null,runner:null,agentProfile:null,model:null,variants:1,planFirst:!1,worktree:null,autonomous:null,generateFollowups:null},$u=`xez-new-task-draft`;function ed(e){return e===null?$u:`${$u}:${e}`}function td(e){let t=e&&typeof e==`object`?e:{};return{text:typeof t.text==`string`?t.text:``,source:nd(t.source)?t.source:null,runner:typeof t.runner==`string`?t.runner:null,agentProfile:typeof t.agentProfile==`string`?t.agentProfile:null,model:typeof t.model==`string`?t.model:null,variants:t.variants===2||t.variants===3?t.variants:1,planFirst:t.planFirst===!0,worktree:typeof t.worktree==`boolean`?t.worktree:null,autonomous:typeof t.autonomous==`boolean`?t.autonomous:null,generateFollowups:typeof t.generateFollowups==`boolean`?t.generateFollowups:null}}function nd(e){return!!e&&typeof e==`object`&&(e.source===`skill`||e.source===`workflow`)&&typeof e.ref==`string`}var rd=new Map;function id(e=null){let t=ed(e),n=rd.get(t);if(n)return{...n};let r;try{let e=localStorage.getItem(t);r=e?td(JSON.parse(e)):{...Qu}}catch{r={...Qu}}return rd.set(t,r),{...r}}function ad(e,t=null){let n=ed(t);rd.set(n,{...e});try{localStorage.setItem(n,JSON.stringify(e))}catch{}}function od(e=null){ad({...id(e),text:``,source:null},e)}function sd(e){let t=typeof e==`string`?new URLSearchParams(e):e;return{skill:(t.get(`skill`)??``).trim(),ref:(t.get(`ref`)??t.get(`task`)??``).trim(),auto:t.get(`auto`)===`1`,key:t.get(`key`)??``,todo:(t.get(`todo`)??``).trim()}}function cd(e,t,n){return{task:e,steps:[...n.steps],rationale:n.rationale,fallback:n.fallback,images:[...t]}}function ld(e,t){return!Number.isInteger(t)||t<0||t>=e.length?[...e]:e.filter((e,n)=>n!==t)}function ud(e,t,n){let r=[...e];if(!Number.isInteger(t)||t<0||t>=r.length)return r;let i=Math.max(0,Math.min(r.length-1,n));if(i===t)return r;let[a]=r.splice(t,1);return r.splice(i,0,a),r}function dd(e){return e.command??e.prompt??``}function fd(e,t=120){let n=e.split(`
3
+ `)[0]??``;return n.length>t?`${n.slice(0,t-1)}…`:n}function pd(e){let{task:t,steps:n,model:r,modelsLocked:i,runner:a,runnerExplicit:o,defaultRunner:s,variants:c,images:l,generateFollowups:u,todoId:d}=e;return{task:t,steps:[...n],model:i?void 0:r||void 0,runner:tr(a,s,o),variants:c>1?c:void 0,images:l.length>0?[...l]:void 0,generateFollowups:u!==!1&&void 0,todoId:d||void 0}}function md({plan:e,starting:t,startAvailable:n,startUnavailableReason:r,startUnavailableAction:i,onStepsChange:a,onStart:o,onDiscard:s}){let[c,l]=(0,J.useState)(null),[u,d]=(0,J.useState)(null),f=()=>{l(null),d(null)},p=(t,n)=>{t.preventDefault(),c!==null&&c!==n&&a(ud(e.steps,c,n)),f()},m=e.steps.length===0;return(0,Y.jsx)(wi,{open:!0,onOpenChange:e=>e?void 0:s(),children:(0,Y.jsxs)(vi,{"data-slot":`plan-review`,showCloseButton:!1,className:U(`top-0 left-0 flex h-dvh w-full max-w-full translate-x-0 translate-y-0 flex-col gap-0 rounded-none p-0`,`sm:top-1/2 sm:left-1/2 sm:h-auto sm:max-h-[85dvh] sm:max-w-[680px] sm:-translate-x-1/2 sm:-translate-y-1/2 sm:rounded-xl`),children:[(0,Y.jsxs)(yi,{className:`gap-1 border-b border-border px-5 pt-4 pb-3.5 text-left sm:text-left`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Y.jsx)(xi,{className:`text-[11px] font-semibold tracking-[0.08em] text-muted-foreground uppercase`,children:`Proposed chain`}),(0,Y.jsx)(bi,{"aria-label":`Discard the plan`,className:`-mt-1 -mr-1 rounded-md p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:(0,Y.jsx)(ci,{"aria-hidden":`true`,className:`size-4`})})]}),(0,Y.jsx)(Ci,{"data-slot":`plan-task`,title:e.task,className:`truncate text-[13.5px] font-medium text-foreground`,children:fd(e.task)}),e.fallback?(0,Y.jsx)(`p`,{"data-slot":`plan-fallback`,className:`text-xs text-soft-foreground italic`,children:`planner unavailable — single-step plan`}):e.rationale===``?null:(0,Y.jsx)(`p`,{"data-slot":`plan-rationale`,className:`text-xs text-muted-foreground`,children:e.rationale})]}),(0,Y.jsx)(`ol`,{"data-slot":`plan-steps`,className:`flex-1 space-y-2 overflow-y-auto px-5 py-4`,children:m?(0,Y.jsx)(`li`,{className:`py-6 text-center text-sm text-muted-foreground`,children:`(no steps left — discard and plan again)`}):e.steps.map((t,n)=>(0,Y.jsxs)(`li`,{"data-slot":`plan-step`,"data-step-id":t.id,draggable:!0,onDragStart:()=>l(n),onDragOver:e=>{e.preventDefault(),d(n)},onDragLeave:()=>d(e=>e===n?null:e),onDrop:e=>p(e,n),onDragEnd:f,className:U(`flex items-center gap-2.5 rounded-lg border border-border bg-card-2 px-3 py-2.5`,c===n&&`opacity-50`,u===n&&c!==null&&c!==n&&`border-ring`),children:[(0,Y.jsx)(ao,{"aria-hidden":`true`,className:`size-3.5 shrink-0 cursor-grab text-soft-foreground`}),(0,Y.jsx)(`span`,{className:`w-5 shrink-0 font-mono text-[11px] text-soft-foreground tabular-nums`,children:String(n+1).padStart(2,`0`)}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`truncate text-[13px] font-semibold`,children:t.name??t.id}),t.skill?(0,Y.jsx)(`span`,{"data-slot":`plan-badge-skill`,title:`skill`,className:`shrink-0 rounded-full bg-violet/15 px-1.5 py-px font-mono text-[10.5px] font-medium text-violet`,children:t.skill}):null,t.command?(0,Y.jsx)(`span`,{"data-slot":`plan-badge-check`,className:`shrink-0 rounded-full bg-muted px-1.5 py-px text-[10.5px] font-medium text-muted-foreground`,children:`check`}):null]}),(0,Y.jsx)(`p`,{className:`truncate font-mono text-[11.5px] text-muted-foreground`,children:dd(t)})]}),(0,Y.jsxs)(`span`,{className:`flex shrink-0 items-center`,children:[(0,Y.jsx)(L,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-slot":`plan-step-up`,"aria-label":`Move step ${n+1} up`,disabled:n===0,className:`size-7 text-muted-foreground`,onClick:()=>a(ud(e.steps,n,n-1)),children:(0,Y.jsx)(Vn,{"aria-hidden":`true`,className:`size-3.5`})}),(0,Y.jsx)(L,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-slot":`plan-step-down`,"aria-label":`Move step ${n+1} down`,disabled:n===e.steps.length-1,className:`size-7 text-muted-foreground`,onClick:()=>a(ud(e.steps,n,n+1)),children:(0,Y.jsx)(Ln,{"aria-hidden":`true`,className:`size-3.5`})}),(0,Y.jsx)(L,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-slot":`plan-step-remove`,"aria-label":`Remove step ${n+1}`,className:`size-7 text-muted-foreground hover:text-danger`,onClick:()=>a(ld(e.steps,n)),children:(0,Y.jsx)(ci,{"aria-hidden":`true`,className:`size-3.5`})})]})]},t.id))}),!n&&r?(0,Y.jsxs)(`p`,{id:`plan-start-guidance`,className:`flex flex-wrap items-center gap-1.5 border-t border-border px-5 pt-3 text-xs text-muted-foreground`,children:[(0,Y.jsx)(`span`,{children:r}),i]}):null,(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 px-5 py-3.5 pb-[max(14px,env(safe-area-inset-bottom))]`,children:[(0,Y.jsxs)(L,{type:`button`,"data-slot":`plan-start`,disabled:m||t||!n,title:n?void 0:r,"aria-describedby":!n&&r?`plan-start-guidance`:void 0,onClick:o,children:[(0,Y.jsx)(_r,{"aria-hidden":`true`,className:`size-3.5`}),t?`Starting…`:`Start`]}),(0,Y.jsx)(hd,{steps:e.steps,disabled:m}),(0,Y.jsx)(L,{type:`button`,variant:`ghost`,className:`ml-auto`,onClick:s,children:`Discard`})]})]})})}function hd({steps:e,disabled:t}){let n=O(),[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(!1),[l,u]=(0,J.useState)(!1),d=async t=>{let r=a.trim();if(!(r===``||l)){u(!0);try{let a=await De({name:r,steps:e,...t?{overwrite:!0}:{}});z(`Saved — ${a.path.split(`/`).pop()??a.path}`),n.invalidateQueries({queryKey:B.workflows}),c(!1),i(!1),o(``)}catch(e){e instanceof Se&&e.exists===!0?c(!0):z(e instanceof Error?e.message:String(e),{tone:`danger`})}finally{u(!1)}}};return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(L,{type:`button`,variant:`outline`,"data-slot":`plan-save`,disabled:t,onClick:()=>i(!0),children:`Save as chain`}),(0,Y.jsx)(wi,{open:r,onOpenChange:e=>i(!!e),children:(0,Y.jsxs)(vi,{"data-slot":`plan-save-dialog`,className:`sm:max-w-sm`,showCloseButton:!1,children:[(0,Y.jsxs)(yi,{children:[(0,Y.jsx)(xi,{children:`Save as chain`}),(0,Y.jsx)(Ci,{children:`Saves these steps as a reusable workflow — it joins the picker like any other chain.`})]}),(0,Y.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),d(!1)},children:[(0,Y.jsx)(hc,{value:a,onChange:e=>o(e.target.value),"aria-label":`Chain name`,placeholder:`e.g. fix-and-verify-v2`,maxLength:80,autoFocus:!0}),(0,Y.jsxs)(Ti,{className:`mt-4`,children:[(0,Y.jsx)(L,{type:`button`,variant:`outline`,onClick:()=>i(!1),children:`Cancel`}),(0,Y.jsx)(L,{type:`submit`,disabled:a.trim()===``||l,children:l?`Saving…`:`Save`})]})]})]})}),(0,Y.jsx)(_i,{open:s,onOpenChange:e=>e?void 0:c(!1),children:(0,Y.jsxs)(fi,{"data-slot":`plan-overwrite-dialog`,children:[(0,Y.jsxs)(gi,{children:[(0,Y.jsxs)(di,{children:[`Overwrite “`,a.trim(),`”?`]}),(0,Y.jsx)(ui,{children:`A chain with this name already exists. Overwriting replaces its steps with this plan.`})]}),(0,Y.jsxs)(mi,{children:[(0,Y.jsx)(hi,{children:`Keep the existing chain`}),(0,Y.jsx)(pi,{onClick:()=>void d(!0),children:`Overwrite`})]})]})})]})}function gd(){let[e]=Te(),t=Di(),n=O(),{projectId:r}=w(),i=Jt().projectId,a=R(),[o]=(0,J.useState)(()=>sd(e)),s=I(),c=S(),l=an(),u=be(),d=T(),f=tn(),p=re(),[m,h]=(0,J.useState)(()=>({...id(i),...o.ref===``?{}:{text:o.ref},...o.skill===``?{}:{source:{source:`skill`,ref:o.skill}}}));(0,J.useEffect)(()=>{ad(m,i)},[m,i]);let g=e=>h(t=>({...t,...e})),_=d.data?.recentSources,v=l.data,y=d.data?.skillUsage,b=(0,J.useMemo)(()=>Xi(v??[],y),[v,y]),x=c.data?.workflows??[],C=a.data?.projects??[],E=l.data!==void 0&&c.data!==void 0&&!d.isPending,D=mr(m.source,b,x),ee=D?.source===`skill`?b.find(e=>e.name===D.ref):void 0,te=(0,J.useRef)(null),ne=(0,J.useMemo)(()=>Br(d.data?.promptTemplates),[d.data?.promptTemplates]),ie=Yr(ne,D?.source===`skill`?[D.ref]:[]),ae=(0,J.useRef)(m.text);ae.current=m.text;let k=(0,J.useRef)(``);(0,J.useEffect)(()=>{if(!E)return;let e=Xr(ae.current,k.current,ie);k.current=e.applied,e.text!==ae.current&&g({text:e.text})},[ie,E]);let A=it(),oe=ht(A.data),se=f.data?.defaultRunner,ce=se??`claude`,j=oe.length>0?or(m.runner,oe,ce):null,M=j??ce,N=A.isSuccess&&oe.length>0,le=me(M),ue=f.data?.modelsLocked===!0,de=j===null?[]:lr(j,le.data,[m.model,f.data?.defaultModels?.[j]]),fe=j===null?``:er(ue?null:m.model,j,f.data?.defaultModels,le.data),{accounts:pe,repoAccount:he}=Wr(),_e=pe.some(e=>e.provider===M&&e.id===m.agentProfile)?m.agentProfile:null,ve=(0,J.useRef)(!1);(0,J.useEffect)(()=>{let e=N&&!ve.current;ve.current=N,e&&document.activeElement===document.body&&document.querySelector(`textarea[aria-label="Describe a task for the agent"]`)?.focus()},[N]);let ye=u.data===void 0||u.data.info!==null,xe=ye?m.variants:1,Se=ye,Ce=xe>1,we=Xu({hasGit:ye,variants:xe,planFirst:m.planFirst,explicitAutonomous:m.autonomous,explicitWorktree:m.worktree,interactive:ee?.interactive,configuredAutonomous:p.data?.composerDefaults?.autonomous??p.data?.composerDefaults?.inheritedAutonomous??`source-dependent`,configuredWorktree:p.data?.composerDefaults?.worktree??p.data?.composerDefaults?.inheritedWorktree??!0,source:D?.source??`workflow`}),Ee=we.worktree,De=we.autonomous,Oe=s.data===void 0||s.data.capabilities.followups,ke=Oe?m.generateFollowups??d.data?.lastGenerateFollowups??!0:!1,[Ae,P]=(0,J.useState)(null),[je,Me]=(0,J.useState)(!1),[Ne,F]=(0,J.useState)(!1),[Pe,Fe]=(0,J.useState)(()=>o.auto&&o.ref!==``),[Ie,Le]=(0,J.useState)(()=>!o.auto&&o.ref!==``?{kind:`prefill`}:null),Re=(0,J.useRef)(!1),ze=(0,J.useRef)(!1);(0,J.useEffect)(()=>{Re.current||(Re.current=!0,e.toString()!==``&&t(`/new`,{replace:!0}))},[]),(0,J.useEffect)(()=>{if(!ze.current&&!(!o.auto||o.ref===``)&&!A.isPending){if(!N||j===null){ze.current=!0,Le({kind:`prefill`}),Fe(!1);return}if(!f.isPending){if(ze.current=!0,se===void 0){Le({kind:`prefill`}),Fe(!1);return}(async()=>{let e=``;try{e=(await ge()).key}catch{}if(e!==``&&o.key===e)try{let e=await nn(qu(o,j,se));od(i),n.invalidateQueries({queryKey:B.runs.all}),t(nr(e));return}catch(e){Le({kind:`failed`,message:e instanceof Error?e.message:String(e)})}else Le({kind:`blocked`});Fe(!1)})()}}},[f.isPending,se,A.isPending,N,j]),(0,J.useEffect)(()=>{if(Ie===null||!E)return;Le(null);let e=o.skill!==``&&!b.some(e=>e.name===o.skill)?o.skill:``;e!==``&&g({text:Yu(o.skill,o.ref),source:null});let{message:t,tone:n}=Ju(Ie,e);z(t,{tone:n}),document.querySelector(`[data-slot="composer"] button[aria-label="Start task"], [data-slot="composer"] button[aria-label="Plan task"]`)?.focus()},[Ie,E]);let L=async(e,r)=>{if(!N||j===null)throw Error(A.isPending?`Checking agent providers…`:A.isError?`Provider authentication could not be verified.`:`Connect an agent provider before starting a task.`);if(!E)throw Error(`Still loading workflows and skills — try again in a second.`);if(m.planFirst){Me(!0);try{P(cd(e,r,await Ze(e))),g({text:e})}finally{Me(!1)}return}let a=await nn(ar({task:e,source:D,model:fe,modelsLocked:ue,runner:j,runnerExplicit:m.runner!==null,agentProfile:_e,defaultRunner:se,variants:xe,images:r,worktree:Ee,autonomous:De,generateFollowups:ke,todoId:o.todo}));xt({lastTask:D,...D?{recentSources:fr(_,D)}:{},...Oe?{lastGenerateFollowups:ke}:{},...D?.source===`skill`&&d.data!==void 0?{skillUsage:Zi(d.data.skillUsage,D.ref)}:{}}).then(()=>n.invalidateQueries({queryKey:B.uiState})).catch(()=>{}),od(i),n.invalidateQueries({queryKey:B.runs.all}),t(nr(a))},Be=async()=>{if(!(Ae===null||Ae.steps.length===0||Ne||!N||j===null)){F(!0);try{let e=await nn(pd({task:Ae.task,steps:Ae.steps,model:fe,modelsLocked:ue,runner:j,runnerExplicit:m.runner!==null,defaultRunner:se,variants:xe,images:Ae.images,generateFollowups:ke,todoId:o.todo}));Oe&&xt({lastGenerateFollowups:ke}).then(()=>n.invalidateQueries({queryKey:B.uiState})).catch(()=>{}),od(i),P(null),n.invalidateQueries({queryKey:B.runs.all}),t(nr(e))}catch(e){z(e instanceof Error?e.message:String(e),{tone:`danger`})}finally{F(!1)}}};return Pe?(0,Y.jsxs)(`div`,{"data-route":`new`,className:`relative isolate flex min-h-full flex-col items-center justify-center overflow-x-clip px-6`,children:[(0,Y.jsx)(Ct,{}),(0,Y.jsxs)(`div`,{"data-slot":`auto-starting`,role:`status`,className:`text-center`,children:[(0,Y.jsx)(`h1`,{className:`animate-pulse text-lg font-semibold tracking-tight`,children:`Starting task…`}),(0,Y.jsx)(`p`,{className:`mt-1.5 text-[13.5px] text-muted-foreground`,children:`Launched from a bookmarklet — taking you to the run.`})]})]}):(0,Y.jsxs)(`div`,{"data-route":`new`,className:`relative isolate flex min-h-full flex-col items-center overflow-x-clip px-6 pt-[clamp(32px,7vh,84px)] pb-16 max-md:px-3.5 max-md:pt-7`,children:[(0,Y.jsx)(Ct,{}),(0,Y.jsx)(Uu,{}),(0,Y.jsxs)(`div`,{className:`w-full max-w-[720px]`,children:[(0,Y.jsxs)(`header`,{className:`mb-6 text-center max-md:mb-4`,children:[(0,Y.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight max-md:text-base`,children:`What should the agent work on?`}),(0,Y.jsx)(`p`,{"data-slot":`run-mode-note`,className:`mt-1.5 text-[13.5px] text-muted-foreground max-md:text-xs`,children:Zu({worktree:Ee,hasGit:ye})})]}),(0,Y.jsx)(Wn,{ref:te,onSubmit:L,value:m.text,onValueChange:e=>g({text:e}),autoFocus:!0,placeholder:`Describe a task for the agent — / for skills…`,ariaLabel:`Describe a task for the agent`,sendAriaLabel:m.planFirst?`Plan task`:`Start task`,disabled:!N||Ne,disabledReason:A.isPending?`Checking agent providers…`:A.isError?`Provider authentication could not be verified.`:`Connect an agent provider before starting a task.`,autocompleteSkills:!0,footerStart:(0,Y.jsxs)(Y.Fragment,{children:[C.length>1&&r!==void 0?(0,Y.jsx)(xd,{projects:C,projectId:r,onPick:e=>t(`/p/${encodeURIComponent(e)}/new`,{replace:!0})}):null,(0,Y.jsx)(Sd,{source:D,ready:E,skills:b,skillUsage:y,workflows:x,onPick:e=>g({source:e})}),(0,Y.jsx)(vu,{templates:ne,iconOnly:!0,onInsert:e=>te.current?.insertAtCaret(e)}),oe.length>1||oe.some(e=>Ur(pe,e))?(0,Y.jsx)(Hr,{runners:oe,value:M,accounts:pe,account:_e,repoAccount:he,onPick:(e,t)=>g({runner:e,agentProfile:t,...e===M?{}:{model:null}}),disabled:!N}):null,(0,Y.jsx)($r,{slot:`model-pill`,ariaLabel:`Model`,label:de.find(e=>e.id===fe)?.label??`auto`,value:fe,disabled:!N,readOnly:ue,disabledHint:ue?`Model selection is locked to native coding-agent settings.`:void 0,onPick:e=>g({model:e}),options:de.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:Qn(M,le.data,le.isError)}),(0,Y.jsx)($r,{slot:`variants-pill`,ariaLabel:`Parallel variants`,label:xe>1?`×${xe} variants`:`×1`,value:String(xe),onPick:e=>g({variants:Number(e)}),disabled:!ye,hint:`How many times to run this task in parallel — each variant gets its own worktree, and you pick the diff you keep. ×1 runs it once.`,disabledHint:`Parallel variants need a git repository — each variant runs in its own worktree.`,options:[{value:`1`,label:`×1`,desc:`One run`},{value:`2`,label:`×2 variants`,desc:`Two competing runs — pick the diff you keep`},{value:`3`,label:`×3 variants`,desc:`Three competing runs — pick the diff you keep`}]}),Se?(0,Y.jsx)(_d,{on:Ee,disabled:Ce,disabledReason:`Parallel variants always use isolated worktrees`,onChange:e=>g({worktree:e})}):null,(0,Y.jsx)(vd,{on:De,disabled:m.planFirst,onChange:e=>g({autonomous:e})}),ee?.interactive&&(m.autonomous===null||m.worktree===null)?(0,Y.jsx)(`p`,{className:`basis-full text-xs text-muted-foreground`,"data-slot":`interactive-skill-hint`,children:`This skill recommends an interactive run in the current checkout. You can change either setting.`}):null,Oe?(0,Y.jsx)(yd,{on:ke,onChange:e=>g({generateFollowups:e})}):null,u.data?(0,Y.jsx)(Cd,{repo:u.data}):null]}),footerEnd:(0,Y.jsxs)(Y.Fragment,{children:[!N&&!A.isPending?(0,Y.jsx)(K,{to:`/settings/agents#providers`,className:`text-xs font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):null,(0,Y.jsx)(wd,{planFirst:m.planFirst,planning:je,onModeChange:e=>g({planFirst:e})}),(0,Y.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[10.5px] font-medium text-muted-foreground`,children:Si()})]})}),(0,Y.jsx)(Ed,{onPick:e=>g({text:e})})]}),Ae===null?null:(0,Y.jsx)(md,{plan:Ae,starting:Ne,startAvailable:N,startUnavailableReason:A.isPending?`Checking agent providers…`:A.isError?`Provider authentication could not be verified.`:`Connect an agent provider before starting a task.`,startUnavailableAction:A.isPending?void 0:(0,Y.jsx)(K,{to:`/settings/agents#providers`,children:`Configure providers`}),onStepsChange:e=>P(t=>t&&{...t,steps:e}),onStart:()=>void Be(),onDiscard:()=>P(null)})]})}function _d({on:e,disabled:t,disabledReason:n,onChange:r}){return(0,Y.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,disabled:t,"data-slot":`worktree-toggle`,onClick:()=>r(!e),title:t?n:e?`Runs in an isolated worktree — uncheck to run in the repo working tree`:`Runs in the repo working tree — check to isolate in a worktree`,className:U(ti,e&&`border-primary/60 text-foreground`),children:[e?(0,Y.jsx)(a,{"aria-hidden":`true`,className:`size-3 shrink-0 text-primary`}):(0,Y.jsx)(jo,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),`Worktree`]})}function vd({on:e,disabled:t,onChange:n}){return(0,Y.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,disabled:t,"data-slot":`autonomous-toggle`,onClick:()=>n(!e),title:t?`Plan-first runs are interactive — autonomous is unavailable`:e?`Autonomous — the agent runs to completion without pausing for you`:`Runs interactively — check to let the agent finish without pausing for you`,className:U(ti,e&&!t&&`border-primary/60 text-foreground`),children:[e?(0,Y.jsx)(a,{"aria-hidden":`true`,className:`size-3 shrink-0 text-primary`}):(0,Y.jsx)(jo,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),`Autonomous`]})}function yd({on:e,onChange:t}){return(0,Y.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,"data-slot":`generate-followups-toggle`,onClick:()=>t(!e),title:e?`Agents can add newly discovered follow-up work to the task inbox`:`Follow-up generation is off; agents still maintain the handoff journal`,className:U(ti,e&&`border-primary/60 text-foreground`),children:[e?(0,Y.jsx)(a,{"aria-hidden":`true`,className:`size-3 shrink-0 text-primary`}):(0,Y.jsx)(jo,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),`Follow-ups`]})}function bd(e,t){let n=t.trim().toLowerCase();if(n===``)return[...e];let r=e=>{let t=e.name.toLowerCase(),r=e.id.toLowerCase();return t.startsWith(n)||r.startsWith(n)?0:t.includes(n)||r.includes(n)?1:2};return e.map((e,t)=>({project:e,rank:r(e),index:t})).filter(e=>e.rank<2).sort((e,t)=>e.rank-t.rank||e.index-t.index).map(e=>e.project)}function xd({projects:e,projectId:t,onPick:n}){let[r,i]=(0,J.useState)(!1),[o,s]=(0,J.useState)(``),c=e.find(e=>e.id===t),l=bd(e,o);return(0,Y.jsxs)(ur,{open:r,onOpenChange:e=>{i(e),e||s(``)},children:[(0,Y.jsx)(rr,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`project-pill`,"aria-label":`Project`,title:`Which project this task runs in — its skills, workflows, settings and draft`,className:U(ti,`border-foreground/60 font-semibold text-foreground`),children:[(0,Y.jsx)(eo,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),(0,Y.jsx)(`span`,{className:`max-w-40 truncate`,children:c?.name??t}),qr]})}),(0,Y.jsx)(ir,{align:`start`,sideOffset:8,className:`w-[300px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Y.jsxs)(Zr,{shouldFilter:!1,children:[(0,Y.jsx)(zr,{placeholder:`search projects…`,value:o,onValueChange:s}),(0,Y.jsxs)(ri,{"data-slot":`project-menu`,className:`max-h-[min(18rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[l.length===0?(0,Y.jsx)(Gr,{children:`Nothing matches.`}):null,l.map(e=>(0,Y.jsxs)(G,{value:e.id,keywords:[e.name],"data-slot":`project-option`,"data-project-id":e.id,disabled:e.status===`missing`,onSelect:()=>{n(e.id),i(!1)},children:[(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-medium`,children:e.name}),e.status===`missing`?(0,Y.jsx)(`span`,{className:`shrink-0 text-[11px] text-soft-foreground`,children:`folder not found`}):e.branch===void 0?null:(0,Y.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-soft-foreground`,children:e.branch}),e.id===t?(0,Y.jsx)(a,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e.id))]}),(0,Y.jsx)(`p`,{className:`border-t border-border px-3 py-2 text-[11px] leading-snug text-soft-foreground`,children:`Skills, workflows, settings and the draft re-resolve against the selected project.`})]})})]})}function Sd({source:e,ready:t,skills:n,skillUsage:r,workflows:i,onPick:o}){let[s,c]=(0,J.useState)(!1),[l,u]=(0,J.useState)(``),[d,f]=(0,J.useState)(null),p=(0,J.useRef)(null),{mostUsed:m,project:h,global:g}=Wi(Qi(n,l,r),r),_=i.find(e=>e.name===pr),v=Gi(i,l).filter(e=>e.name!==pr),y=Ji(`no skill`,`none plain ${pr} ${_?.description??``}`,l)>0,b=!y&&m.length===0&&h.length===0&&g.length===0&&v.length===0,x=e=>{o(e),c(!1)},S=t=>x(e?.source===t.source&&e.ref===t.ref?null:t),C=e=>`skill ${e.name} ${e.path}`,w=e=>`workflow ${e.name}`,T=`none no-skill`,E=[...y?[{value:T,select:()=>x(null)}]:[],...[...m,...h].map(e=>({value:C(e),select:()=>S({source:`skill`,ref:e.name})})),...v.map(e=>({value:w(e),select:()=>S({source:`workflow`,ref:e.name})})),...g.map(e=>({value:C(e),select:()=>S({source:`skill`,ref:e.name})}))],[D,ee]=(0,J.useState)(``),O=E.some(e=>e.value===D)?D:E[0]?.value??``,te=e=>{e.key!==`Enter`||e.nativeEvent.isComposing||(e.preventDefault(),s&&E.find(e=>e.value===O)?.select())},ne=(t,n)=>{let r=e?.source===`skill`&&e.ref===t.name;return(0,Y.jsxs)(G,{value:C(t),keywords:Ki(t.name,t.description),"data-slot":`source-option`,"data-source-kind":`skill`,"data-source-ref":t.name,onSelect:()=>S({source:`skill`,ref:t.name}),children:[(0,Y.jsx)(`span`,{className:U(`shrink-0 font-mono text-xs`,n&&`font-semibold`),children:t.name}),t.description?(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:t.description}):null,(0,Y.jsx)(`button`,{type:`button`,"data-slot":`source-skill-view`,"aria-label":`View skill ${t.name}`,title:`View skill`,onClick:e=>{e.preventDefault(),e.stopPropagation(),f(t)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,Y.jsx)(Lr,{"aria-hidden":`true`,className:`size-3.5`})}),r?(0,Y.jsx)(a,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},t.path)},re=e===null?wo:e.source===`skill`?oi:Fo,ie=(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`source-pill`,"data-source-kind":e?.source??`none`,"aria-label":`Choose a skill or workflow`,title:e===null?`No skill — the task runs as one plain agent step. Pick a skill or workflow to change that.`:`Runs the ${e.source} "${e.ref}" — pick it again, or press ✕, to run without it`,disabled:!t,onKeyDown:t=>{e===null||t.metaKey||t.ctrlKey||t.altKey||t.key!==`Backspace`&&t.key!==`Delete`||(t.preventDefault(),o(null))},className:U(ti,`font-mono text-[11.5px]`,e===null?`border-dashed text-soft-foreground`:`rounded-r-none border-r-0 border-foreground/60 pr-1.5 font-semibold text-foreground`),children:[(0,Y.jsx)(re,{"aria-hidden":`true`,className:U(`size-3 shrink-0`,e===null?`text-soft-foreground`:`text-violet`)}),(0,Y.jsx)(`span`,{className:`max-w-44 truncate`,children:t?e?.ref??`Skill`:`…`}),qr]});return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Ku,{skill:d,onClose:()=>f(null)}),(0,Y.jsxs)(ur,{open:s,onOpenChange:e=>{c(e),e||(u(``),ee(``))},children:[(0,Y.jsxs)(`span`,{className:`inline-flex items-center`,children:[(0,Y.jsx)(rr,{asChild:!0,children:ie}),e!==null&&t?(0,Y.jsx)(`button`,{type:`button`,"data-slot":`source-pill-clear`,"aria-label":`Clear the ${e.source} ${e.ref}`,title:`Run without it`,onClick:()=>o(null),className:U(ti,`rounded-l-none border-foreground/60 pl-1.5 pr-2 text-soft-foreground hover:text-foreground`),children:(0,Y.jsx)(ci,{"aria-hidden":`true`,className:`size-3`})}):null]}),(0,Y.jsx)(ir,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Y.jsxs)(Zr,{shouldFilter:!1,value:O,onValueChange:ee,onKeyDown:te,children:[(0,Y.jsx)(zr,{placeholder:`search skills & workflows…`,value:l,onValueChange:u,onInput:()=>p.current?.scrollTo(0,0)}),(0,Y.jsxs)(ri,{ref:p,"data-slot":`source-menu`,className:`max-h-[min(18rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[b?(0,Y.jsx)(Gr,{children:`Nothing matches.`}):null,y?(0,Y.jsx)(W,{children:(0,Y.jsxs)(G,{value:T,keywords:[`none`,`plain`,...Ki(pr)],"data-slot":`source-option`,"data-source-kind":`none`,onSelect:()=>x(null),children:[(0,Y.jsx)(yn,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-soft-foreground`}),(0,Y.jsx)(`span`,{className:`shrink-0 text-xs font-medium`,children:`No skill`}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:_?.description??`One agent run on your task — no ceremony.`}),e===null?(0,Y.jsx)(a,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]})}):null,m.length>0?(0,Y.jsx)(W,{heading:`Most used`,children:m.map(e=>ne(e,qi(e)))}):null,h.length>0?(0,Y.jsx)(W,{heading:`Project skills`,children:h.map(e=>ne(e,!0))}):null,v.length>0?(0,Y.jsx)(W,{heading:`Workflows`,children:v.map(t=>{let n=e?.source===`workflow`&&e.ref===t.name;return(0,Y.jsxs)(G,{value:w(t),keywords:Ki(t.name,t.description),"data-slot":`source-option`,"data-source-kind":`workflow`,"data-source-ref":t.name,onSelect:()=>S({source:`workflow`,ref:t.name}),children:[(0,Y.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:t.name}),t.description?(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:t.description}):null,n?(0,Y.jsx)(a,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]},t.name)})}):null,g.length>0?(0,Y.jsx)(W,{heading:`Global`,children:g.map(e=>ne(e,!1))}):null]})]})})]})]})}function Cd({repo:e}){let t=O(),n=P({mutationFn:e=>kt({baseBranch:e}),onSuccess:e=>{t.invalidateQueries({queryKey:B.repo}),z(e.baseBranch?`New tasks will branch off "${e.baseBranch}" (PRs target it too).`:`Base branch cleared — new tasks fork from the checked-out branch.`)},onError:e=>z(e.message,{tone:`danger`})});return e.info?(0,Y.jsx)($r,{slot:`base-pill`,ariaLabel:`Base branch`,label:(0,Y.jsxs)(`span`,{className:`font-mono text-[11.5px]`,children:[`base: `,e.baseBranch??e.info.branch]}),value:e.baseBranch??``,onPick:e=>n.mutate(e===``?null:e),options:[{value:``,label:`follow checked-out branch (${e.info.branch})`,desc:`New task worktrees fork from whatever branch is checked out`},...e.branches.map(e=>({value:e,label:e}))]}):null}function wd({planFirst:e,planning:t,onModeChange:n}){return(0,Y.jsxs)(`div`,{"data-slot":`mode-seg`,role:`radiogroup`,"aria-label":`Run mode`,className:`inline-flex items-center gap-0.5 rounded-lg bg-muted p-[3px]`,children:[(0,Y.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":!e,onClick:()=>n(!1),className:U(`h-6 rounded-md px-2 text-xs transition-colors`,e?`font-medium text-muted-foreground hover:text-foreground`:`bg-card font-semibold text-foreground shadow-xs`),children:`Start`}),(0,Y.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e,"aria-busy":t||void 0,"data-slot":`mode-plan`,onClick:()=>n(!0),className:U(`h-6 rounded-md px-2 text-xs transition-colors`,e?`bg-contrast font-semibold text-contrast-foreground ring-2 ring-ring/55`:`font-medium text-muted-foreground hover:text-foreground`,t&&`animate-pulse`),children:t?`Planning…`:`Plan first`})]})}var Td=[`Fix a failing or flaky test`,`Summarize recent commits on this branch`,`Update the README for recent changes`];function Ed({onPick:e}){return(0,Y.jsx)(`div`,{className:`mt-7 flex flex-wrap justify-center gap-2 max-md:justify-start`,children:Td.map(t=>(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`suggested-chip`,onClick:()=>e(t),className:`inline-flex h-[30px] items-center gap-1.5 rounded-full border border-border px-3 text-[12.5px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:[(0,Y.jsx)(oi,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),t]},t))})}function Dd(){return(0,Y.jsx)(`div`,{"data-route":`not-found`,className:`flex min-h-full flex-col`,children:(0,Y.jsx)(V,{icon:(0,Y.jsx)(qa,{}),tone:`neutral`,title:`Page not found`,subtitle:`Nothing lives at this address. The link may be mistyped, or it points at something that is gone.`,actions:(0,Y.jsx)(L,{asChild:!0,variant:`outline`,children:(0,Y.jsx)(K,{to:`/`,children:`Back to tasks`})})})})}function Od(){return(0,Y.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,Y.jsx)(V,{icon:(0,Y.jsx)(gt,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading repository…`,subtitle:`Fetching the repo's git state.`})})}function kd(){return(0,Y.jsxs)(`div`,{"data-route":`skills`,className:`flex min-h-full flex-col`,children:[(0,Y.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,Y.jsx)(`h1`,{className:`text-base font-semibold`,children:`Skills`}),(0,Y.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Markdown playbooks agents can follow.`})]}),(0,Y.jsx)(`p`,{"data-slot":`skills-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading skills…`})]})}function Ad({projectId:e,registry:t}){let n=t.projects.length?t.projects:[{id:t.bootProject,name:t.bootProject}];return(0,Y.jsx)(`div`,{"data-route":`unknown-project`,className:`flex min-h-full flex-col`,children:(0,Y.jsx)(V,{icon:(0,Y.jsx)(to,{}),tone:`neutral`,title:`“${e}” isn’t registered here`,subtitle:`This xezar doesn’t serve a project by that id. The link may come from another machine’s workspace — these are the projects registered on this one:`,children:(0,Y.jsx)(`ul`,{"data-slot":`registered-projects`,className:`mx-auto flex w-full max-w-xs flex-col gap-1.5 text-left`,children:n.map(e=>(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(M,{to:`/p/${encodeURIComponent(e.id)}/`,className:`flex items-baseline gap-2 rounded-md border border-border bg-card px-3 py-2 text-sm font-medium text-foreground shadow-xs transition-colors hover:bg-card-2`,children:[e.name||e.id,(0,Y.jsxs)(`span`,{className:`font-mono text-[11px] font-normal text-soft-foreground`,children:[`/p/`,e.id]})]})},e.id))})})})}function jd(){return(0,Y.jsx)(`div`,{"data-route":`workflows`,className:`flex min-h-full flex-col`,children:(0,Y.jsx)(V,{icon:(0,Y.jsx)(gt,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading workflows…`,subtitle:`Fetching the saved chains and the skills palette.`})})}function Md({tab:e}){return(0,Y.jsx)(`div`,{"data-route":`task-${e}`,className:`flex min-h-full flex-col`,children:(0,Y.jsx)(V,{icon:(0,Y.jsx)(gt,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:e===`changes`?`Loading changes…`:`Loading files…`,subtitle:`Fetching the run record.`})})}function Nd({tab:e,error:t}){let n=t instanceof Se&&t.status===404;return(0,Y.jsx)(`div`,{"data-route":`task-${e}`,className:`flex min-h-full flex-col`,children:(0,Y.jsx)(V,{icon:n?(0,Y.jsx)(ai,{}):(0,Y.jsx)(si,{}),tone:n?`neutral`:`danger`,title:n?`Task not found`:`Could not load this task`,subtitle:n?`No run has this id. It may have been deleted, or the link is from another machine.`:t.message,actions:(0,Y.jsx)(L,{asChild:!0,variant:`outline`,children:(0,Y.jsx)(K,{to:`/`,children:`Back to tasks`})})})})}function Pd({className:e,orientation:t=`horizontal`,...n}){return(0,Y.jsx)(bs,{"data-slot":`tabs`,"data-orientation":t,orientation:t,className:U(`group/tabs flex gap-2 data-[orientation=horizontal]:flex-col`,e),...n})}var Fd=le(`group/tabs-list inline-flex w-fit items-center justify-center rounded-md p-[3px] text-muted-foreground group-data-[orientation=horizontal]/tabs:h-9 group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function Id({className:e,variant:t=`default`,...n}){return(0,Y.jsx)(xs,{"data-slot":`tabs-list`,"data-variant":t,className:U(Fd({variant:t}),e),...n})}function Ld({className:e,...t}){return(0,Y.jsx)(Ss,{"data-slot":`tabs-trigger`,className:U(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-sm border border-transparent px-3 py-1 text-[12.5px] font-medium whitespace-nowrap text-muted-foreground transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-xs group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent`,`data-[state=active]:bg-card data-[state=active]:font-semibold data-[state=active]:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100`,e),...t})}function Rd({className:e,...t}){return(0,Y.jsx)(Cs,{"data-slot":`tabs-content`,className:U(`flex-1 outline-none`,e),...t})}function zd(e){return cr.flatMap(t=>{let n=e.filter(e=>e.provider===t.id);return n.length<2?[{runner:t,account:null,label:t.label,desc:t.desc,missing:!1}]:n.map(e=>({runner:t,account:e.isDefault?null:e.id,label:`${t.label} · ${e.label}`,desc:e.exists?e.configDir:`${e.configDir} — folder not created yet`,missing:!e.exists}))})}var Bd=e=>e.length>cr.length;function Vd({rows:e,runner:t,accountFor:n,providerStatus:r,disabled:i=!1,accountDisabled:a=!1,onPick:s}){let c=Bd(e);return(0,Y.jsx)(`div`,{role:`radiogroup`,"aria-label":`Default runner`,"data-slot":`agents-runner`,className:U(`gap-0.5 rounded-md border border-border bg-card p-0.5`,c?`flex max-w-md flex-col`:`inline-flex w-fit`),children:e.map(l=>{let u=o(r.data,l.runner.id),d=!r.isPending&&!r.isError&&u?.enabled===!0&&u.status===`connected`,f=r.isPending?`Checking provider authentication…`:r.isError?`Provider authentication could not be verified.`:u?.enabled===!1?`This provider is disabled. Enable it above or choose another provider.`:d?void 0:`Connect this provider before selecting it.`,p=e.filter(e=>e.runner.id===l.runner.id).length>1,m=l.runner.id===t&&l.account===n(l.runner.id);return(0,Y.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":m,"data-value":l.runner.id,"data-account":l.account??``,title:f??l.desc,disabled:i||!d||p&&a,onClick:()=>s(l.runner.id,l.account,p),className:U(`rounded-sm px-3 py-1.5 text-left font-mono text-[13px] font-medium transition-colors disabled:opacity-50`,m?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:[l.label,c?(0,Y.jsx)(`span`,{"data-slot":l.missing?`agents-account-missing`:`agents-account-dir`,"data-runner":l.runner.id,className:`ml-2 font-sans text-[11.5px] text-soft-foreground`,children:l.desc}):null]},`${l.runner.id}:${l.account??``}`)})})}var Hd={claude:`~/.claude-second`,codex:`~/.codex-second`,opencode:`~/.config/opencode-second`,pi:`~/.pi/agent-second`};function Ud({open:e,onOpenChange:t,providers:n,initialProvider:r}){let[i,a]=(0,J.useState)(null),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(r??n[0]??`claude`),[u,d]=(0,J.useState)(``),[f,p]=(0,J.useState)(``),[m,h]=(0,J.useState)(!1),g=C(),_=f.trim();return(0,Y.jsx)(wi,{open:e,onOpenChange:t,children:(0,Y.jsxs)(vi,{"data-slot":`add-account-dialog`,className:`sm:max-w-lg`,children:[(0,Y.jsxs)(yi,{children:[(0,Y.jsx)(xi,{children:`Add agent account`}),(0,Y.jsx)(Ci,{children:`The config folder this account uses. It does not have to exist yet — Connect signs in and the CLI creates it.`})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 text-[13px]`,children:[(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`Agent`}),(0,Y.jsx)(`select`,{"aria-label":`Agent`,"data-slot":`add-account-provider`,value:c,onChange:e=>l(e.target.value),className:`rounded-md border border-input bg-card px-2 py-1 text-[13px] outline-none focus-visible:border-ring`,children:n.map(e=>(0,Y.jsx)(`option`,{value:e,children:e},e))})]}),(0,Y.jsxs)(`label`,{className:`flex min-w-0 flex-1 items-center gap-2 text-[13px]`,children:[(0,Y.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Name`}),(0,Y.jsx)(`input`,{type:`text`,"aria-label":`Account name`,"data-slot":`add-account-label`,value:u,placeholder:`Work`,onChange:e=>d(e.target.value),className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 text-[13px] outline-none focus-visible:border-ring`})]})]}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Y.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 text-[13px]`,children:[(0,Y.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Folder`}),(0,Y.jsx)(`input`,{type:`text`,spellCheck:!1,autoComplete:`off`,"aria-label":`Config folder`,"data-slot":`add-account-dir`,value:f,placeholder:Hd[c],onChange:e=>{p(e.target.value),s(null),g.reset()},className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 font-mono text-[12.5px] outline-none focus-visible:border-ring`}),(0,Y.jsx)(L,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`add-account-browse`,"aria-expanded":m,onClick:()=>h(e=>!e),children:m?`Hide folders`:`Browse…`})]}),(0,Y.jsxs)(`p`,{className:`text-[11.5px] text-soft-foreground`,children:[`A `,(0,Y.jsx)(`code`,{children:`~`}),` is kept as written and expanded when the agent runs.`]})]}),m?(0,Y.jsx)(fc,{path:i,selected:o,onSelect:e=>{s(e),p(e.path),g.reset()},onEnter:e=>{a(e),s(null),g.reset()},showHidden:!0,emptyHint:`No subfolders here — pick this folder by typing its path above.`}):null,g.isError?(0,Y.jsx)(`p`,{"data-slot":`add-account-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:g.error instanceof Error?g.error.message:`could not add that folder`}):null,(0,Y.jsxs)(Ti,{className:`min-w-0 sm:items-center sm:justify-end`,children:[(0,Y.jsx)(L,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,Y.jsx)(L,{"data-slot":`add-account-confirm`,disabled:_===``||g.isPending,onClick:()=>{_===``||g.isPending||g.mutate({provider:c,configDir:_,...u.trim()?{label:u.trim()}:{}},{onSuccess:()=>{t(!1),d(``),p(``),s(null),h(!1),z(`Account added — use Connect to sign in`)}})},children:g.isPending?`Adding…`:`Add account`})]})]})})}var Wd={claude:`npm i -g @anthropic-ai/claude-code`,codex:`npm i -g @openai/codex`,opencode:`https://opencode.ai`,pi:`https://github.com/badlogic/pi-mono`},Gd={connected:{label:`Connected`,tone:`success`},disconnected:{label:`Not connected`,tone:`pending`},"not-installed":{label:`Not installed`,tone:`neutral`},unknown:{label:`Could not verify`,tone:`danger`}};function Kd(){let e=ie();return e.isPending?(0,Y.jsx)(`p`,{"data-slot":`accounts-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent accounts…`}):e.isError?(0,Y.jsx)(V,{icon:(0,Y.jsx)(so,{}),tone:`danger`,title:`Agent accounts did not load`,subtitle:e.error.message,heading:`h2`}):(0,Y.jsx)(qd,{data:e.data})}function qd({data:e}){let t=I(),[n,r]=(0,J.useState)(null),[i,a]=(0,J.useState)(null),o=en(),s=[`claude`,`codex`,`opencode`,`pi`];return e.editable?(0,Y.jsxs)(`div`,{"data-slot":`accounts-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-5 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Agent accounts`}),(0,Y.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`One agent per tab: whether it is installed, and which logins you have. Add a second config folder to keep a work account beside a personal one; each project picks which it uses in its own Agents settings.`})]}),(0,Y.jsx)(Yd,{profiles:e}),(0,Y.jsxs)(Pd,{defaultValue:`claude`,children:[(0,Y.jsx)(Id,{variant:`line`,"data-slot":`accounts-tabs`,children:s.map(e=>(0,Y.jsx)(Ld,{value:e,"data-provider":e,children:En[e]},e))}),s.map(n=>(0,Y.jsx)(Rd,{value:n,className:`pt-4`,children:(0,Y.jsx)(Jd,{provider:n,check:t.data?.checks?.find(e=>e.name===n),accounts:e.profiles.filter(e=>e.provider===n),canCarryAccounts:e.profileCapableProviders.includes(n),onAdd:()=>r(n),onRemove:a})},n))]}),n===null?null:(0,Y.jsx)(Ud,{open:!0,onOpenChange:e=>!e&&r(null),providers:e.profileCapableProviders,initialProvider:n},n),(0,Y.jsx)(_i,{open:i!==null,onOpenChange:e=>!e&&a(null),children:(0,Y.jsxs)(fi,{"data-slot":`accounts-remove-confirm`,children:[(0,Y.jsxs)(gi,{children:[(0,Y.jsxs)(di,{children:[`Remove “`,i?.label,`”?`]}),(0,Y.jsxs)(ui,{children:[`This only forgets the account. Nothing in `,i?.configDir,` is deleted — not your login, not your sessions. Projects using it fall back to the default account, and tasks that ran under it can no longer be resumed from here.`]})]}),(0,Y.jsxs)(mi,{children:[(0,Y.jsx)(hi,{children:`Cancel`}),(0,Y.jsx)(pi,{"data-action":`accounts-remove-confirm`,disabled:o.isPending,onClick:()=>{let e=i;e&&o.mutate(e.id,{onSuccess:()=>{a(null),z(`Removed ${e.label}`)},onError:e=>z(e.message,{tone:`danger`})})},children:`Remove`})]})]})})]}):(0,Y.jsxs)(`div`,{"data-slot":`accounts-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-4 p-4 md:p-6`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Agent accounts`}),(0,Y.jsx)(`p`,{"data-slot":`accounts-hosted`,className:`text-[13px] text-soft-foreground`,children:`Agent accounts are managed from the machine that owns the checkout — this cockpit runs in hosted mode.`})]})}function Jd({provider:e,check:t,accounts:n,canCarryAccounts:r,onAdd:i,onRemove:a}){let o=t?.available===!0;return(0,Y.jsxs)(`div`,{"data-slot":`accounts-provider`,"data-provider":e,className:`flex flex-col gap-4`,children:[(0,Y.jsxs)(`dl`,{className:`divide-y divide-border/60 overflow-hidden rounded-md border border-border bg-card text-[13px]`,children:[(0,Y.jsx)(Xd,{label:`Installed`,children:t===void 0?(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`Checking…`}):o?(0,Y.jsx)(`span`,{"data-slot":`agent-installed`,children:`Yes`}):(0,Y.jsxs)(`span`,{"data-slot":`agent-installed`,className:`text-muted-foreground`,children:[`No — `,(0,Y.jsx)(`code`,{className:`text-[12px]`,children:Wd[e]})]})}),o&&t?.version?(0,Y.jsx)(Xd,{label:`Version`,children:(0,Y.jsx)(`span`,{"data-slot":`agent-version`,className:`font-mono text-[12.5px]`,children:t.version})}):null,(0,Y.jsx)(Xd,{label:`Accounts`,children:(0,Y.jsx)(`span`,{children:n.length===1?`the discovered one`:`${n.length} (1 discovered, ${n.length-1} added)`})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:`Logins`}),r?(0,Y.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,"data-action":`accounts-add`,"data-provider":e,onClick:i,children:`Add account`}):null]}),(0,Y.jsx)(`ul`,{className:`divide-y divide-border/60 rounded-md border border-border bg-card`,children:n.map(e=>(0,Y.jsx)(Zd,{account:e,onRemove:()=>a(e)},e.id))}),r?null:(0,Y.jsxs)(`p`,{"data-slot":`accounts-single-only`,className:`text-[11.5px] text-soft-foreground`,children:[En[e],` can only hold one account here: it keeps its credentials outside its config folder, so a second folder would change settings without changing the login — which would say “work account” while billing the other one.`]})]})}function Yd({profiles:e}){let t=O(),n=re(),r=it(),i=N(),a=A(),o=P({mutationFn:e=>ut(e),onSuccess:e=>t.setQueryData(F.config,e),onError:e=>z(e.message,{tone:`danger`})});if(n.data===void 0)return null;let s=zd(e.profiles),c=n.data.agentDefaults.runner??`claude`,l=n.data.agentDefaults.models??{};return(0,Y.jsxs)(`section`,{"data-slot":`accounts-defaults`,className:`flex flex-col gap-3 rounded-lg border border-border bg-card/40 p-3.5`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:`Defaults for new projects`}),(0,Y.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`What a project runs when it has not chosen for itself — set once instead of per repository. A project that has chosen keeps its own.`})]}),(0,Y.jsx)(Vd,{rows:s,runner:c,accountFor:t=>e.defaults[t]??null,providerStatus:r,disabled:o.isPending,accountDisabled:a.isPending,onPick:(e,t,n)=>{e!==c&&o.mutate({agentDefaults:{runner:e}}),n&&a.mutate({projectId:null,provider:e,profileId:t},{onError:e=>z(e.message,{tone:`danger`})})}}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Default model per agent`}),cr.map(e=>(0,Y.jsxs)(`label`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(`span`,{className:`w-24 shrink-0 font-mono text-xs text-muted-foreground`,children:e.label}),(0,Y.jsxs)(`select`,{"aria-label":`Default model for ${e.label}`,"data-slot":`accounts-default-model`,"data-runner":e.id,value:l[e.id]??``,disabled:o.isPending,onChange:t=>o.mutate({agentDefaults:{models:{[e.id]:t.target.value||null}}}),className:`block w-full max-w-xs rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[lr(e.id,i[e.id].data,[l[e.id]]).map(e=>(0,Y.jsx)(`option`,{value:e.id,children:e.id===``?`auto (default)`:e.label},e.id)),Qn(e.id,i[e.id].data,i[e.id].isError)?(0,Y.jsx)(`option`,{disabled:!0,children:Qn(e.id,i[e.id].data,i[e.id].isError)}):null]})]},e.id))]})]})}function Xd({label:e,children:t}){return(0,Y.jsxs)(`div`,{className:`flex items-baseline gap-3 px-3.5 py-2.5`,children:[(0,Y.jsx)(`dt`,{className:`w-28 shrink-0 text-muted-foreground`,children:e}),(0,Y.jsx)(`dd`,{className:`min-w-0 flex-1`,children:t})]})}function Zd({account:e,onRemove:t}){let[n,r]=(0,J.useState)(!1),i=cn(e),a=s(),o=St(),c=fe(i,e.status===void 0),l=e.status??c.data?.status,u=l?Gd[l.status]:void 0;return(0,Y.jsxs)(`li`,{"data-slot":`account-row`,"data-account":e.id,className:`flex flex-col gap-2 px-3.5 py-3`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-[13px] font-medium text-foreground`,children:e.label}),e.isDefault?(0,Y.jsx)(dc,{variant:`ghost`,className:`shrink-0 text-[10px] text-muted-foreground`,children:`discovered`}):null]}),(0,Y.jsx)(`p`,{"data-slot":`account-path`,className:`mt-0.5 truncate font-mono text-[11.5px] text-soft-foreground`,title:e.path,children:e.configDir}),(0,Y.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,Y.jsx)(q,{tone:u?.tone??`neutral`,pulse:u===void 0}),(0,Y.jsx)(`span`,{"data-slot":`account-status`,children:u?.label??`Checking…`}),e.exists?e.looksValid?null:(0,Y.jsxs)(`span`,{"data-slot":`account-unrecognised`,children:[`— this folder does not look like `,En[e.provider],` config yet`]}):(0,Y.jsx)(`span`,{"data-slot":`account-missing`,children:`— folder not created yet; Connect will make it`})]})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[l?.status===`connected`?null:(0,Y.jsx)(L,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:a.isPending,onClick:()=>a.mutate({provider:e.provider,...e.isDefault?{}:{profileId:e.id}},{onSuccess:e=>z(e.opened?`Finish signing in in the terminal, then Check again.`:`This account is already connected.`),onError:e=>z(e instanceof Se&&e.command?`${e.message} — run: ${e.command}`:e.message,{tone:`danger`})}),children:`Connect`}),(0,Y.jsx)(L,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`account-recheck`,disabled:o.isPending,title:`Re-probe this account's login now, instead of waiting for the cached answer`,onClick:()=>o.mutate(i,{onError:e=>z(e.message,{tone:`danger`})}),children:`Check again`}),(0,Y.jsx)(L,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`account-details-toggle`,"aria-expanded":n,onClick:()=>r(e=>!e),children:n?`Hide details`:`Show details`})]})]}),n?(0,Y.jsx)(Qd,{account:e,routeId:i,onRemove:t}):null]})}function Qd({account:e,routeId:t,onRemove:n}){let r=j(t,!0),i=mt(),a=He(),[o,s]=(0,J.useState)(!1),[c,l]=(0,J.useState)(e.label),u=Ee(),d=a.data?.targets??[],f=d.filter(e=>Dn(e.id)===void 0&&e.id!==`terminal`&&e.id!==`finder`).map(e=>({target:e})),p=d.filter(e=>Dn(e.id)===void 0).map(e=>({target:e})),m=(e,n,r)=>i.mutate({routeId:t,file:e,...r?{target:r}:{}},{onError:e=>z(e.message,{tone:`danger`}),onSuccess:()=>z(`Opened ${n}`)});return(0,Y.jsxs)(`div`,{"data-slot":`account-details`,className:`rounded-md border border-border/60 bg-muted/30 p-3`,children:[r.isPending?(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Reading account details…`}):r.isError?(0,Y.jsx)(`p`,{"data-slot":`account-details-error`,className:`text-xs text-danger`,children:r.error.message}):r.data.available?(0,Y.jsx)(`dl`,{"data-slot":`account-identity`,className:`grid grid-cols-[7rem_minmax(0,1fr)] gap-x-3 gap-y-1 text-xs`,children:r.data.fields.map(e=>(0,Y.jsxs)(J.Fragment,{children:[(0,Y.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,Y.jsx)(`dd`,{className:`min-w-0 truncate text-foreground`,title:e.value,children:e.value})]},e.label))}):(0,Y.jsx)(`p`,{"data-slot":`account-identity-unavailable`,className:`text-xs text-muted-foreground`,children:r.data.reason??`No account details to show.`}),(0,Y.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5 border-t border-border/60 pt-2.5`,children:[(0,Y.jsx)(`span`,{className:`mr-1 text-xs text-muted-foreground`,children:`Config files`}),e.files.map(e=>(0,Y.jsx)(An,{slot:`account-open-file`,label:e.label,triggerVariant:`outline`,disabled:i.isPending,title:e.exists?e.path:`${e.path} — not created yet`,choices:f,onPick:t=>m(e.id,e.label,t),leading:(0,Y.jsxs)(jr,{"data-target":`system`,onSelect:()=>m(e.id,e.label),children:[(0,Y.jsx)(br,{"aria-hidden":`true`}),`System default`]})},e.id)),(0,Y.jsx)(An,{slot:`account-open-folder`,label:`Folder`,disabled:i.isPending,title:e.path,choices:p,onPick:e=>m(`folder`,`folder`,e),leading:(0,Y.jsxs)(jr,{"data-target":`system`,onSelect:()=>m(`folder`,`folder`),children:[(0,Y.jsx)(br,{"aria-hidden":`true`}),`System default`]})})]}),e.isDefault?null:(0,Y.jsxs)(`div`,{"data-slot":`account-manage`,className:`mt-3 flex flex-wrap items-center gap-2 border-t border-border/60 pt-2.5`,children:[(0,Y.jsx)(`span`,{className:`mr-1 text-xs text-muted-foreground`,children:`Account`}),o?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`input`,{type:`text`,autoFocus:!0,"aria-label":`Name for ${e.label}`,"data-slot":`account-rename-input`,value:c,onChange:e=>l(e.target.value),className:`w-48 rounded-md border border-input bg-card px-2 py-1 text-xs outline-none focus-visible:border-ring`}),(0,Y.jsx)(L,{type:`button`,size:`sm`,"data-action":`account-rename-save`,disabled:u.isPending||c.trim()===``||c.trim()===e.label,onClick:()=>u.mutate({id:e.id,label:c.trim()},{onSuccess:()=>s(!1),onError:e=>z(e.message,{tone:`danger`})}),children:`Save`}),(0,Y.jsx)(L,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{l(e.label),s(!1)},children:`Cancel`})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename`,onClick:()=>s(!0),children:`Rename`}),(0,Y.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-remove`,onClick:n,children:`Remove`}),(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Renaming changes what xezar calls this account, not its folder.`})]})]})]})}var $d=1500;function ef(e,t){let n=(0,J.useMemo)(()=>e.split(`
4
+ `).map(e=>[{content:e}]),[e]),r=(0,J.useMemo)(()=>ta(t),[t]),i=n.length>$d,[a,o]=(0,J.useState)(null);return(0,J.useEffect)(()=>{if(r===null||i)return;let t=!1;return na(e,r).then(n=>{t||o({key:e,tokens:n.tokens})}),()=>{t=!0}},[e,r,i]),r===null||i?n:a?.key===e?a.tokens:ea(e,r)?.tokens??n}var tf=`m-0 min-h-full w-full whitespace-pre font-mono text-xs leading-[1.7] px-3 py-2 [tab-size:2]`;function nf({value:e,onChange:t,language:n,readOnly:r,className:i,...a}){let o=ef(e,n),s=(0,J.useRef)(null),c=(0,J.useRef)(null),l=()=>{let e=c.current,t=s.current;!e||!t||(t.scrollTop=e.scrollTop,t.scrollLeft=e.scrollLeft)};return(0,J.useLayoutEffect)(l,[e]),(0,Y.jsxs)(`div`,{"data-slot":`code-editor`,className:U(`relative overflow-hidden rounded-md border border-input bg-card`,i),children:[(0,Y.jsx)(`pre`,{ref:s,"aria-hidden":`true`,className:U(tf,`pointer-events-none absolute inset-0 overflow-auto text-soft-foreground`),children:o.map((e,t)=>(0,Y.jsx)(`span`,{className:`block`,children:e.length===0?`
5
+ `:(0,Y.jsxs)(Y.Fragment,{children:[e.map((e,t)=>(0,Y.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t)),`
6
+ `]})},t))}),(0,Y.jsx)(`textarea`,{ref:c,"data-slot":`code-editor-input`,value:e,readOnly:r,onChange:e=>t?.(e.target.value),onScroll:l,spellCheck:!1,autoCorrect:`off`,autoCapitalize:`off`,autoComplete:`off`,wrap:`off`,className:U(tf,`relative block resize-none overflow-auto bg-transparent text-transparent caret-foreground outline-none`,`selection:bg-primary/30 focus-visible:ring-0`,r&&`cursor-default`),...a})]})}var rf=`An editor-plus-commit: a saved change reaches a run after you commit it to the base branch.`;function af(e){return t=>t.runners.includes(e)}function of(e,t,n,r){let i=af(e);return{id:t,label:n,note:r,files:t===`mcp`?e=>i(e)&&(e.holdsMcp===!0||e.kind===`mcp`):e=>i(e)&&e.kind===t}}var sf=[{id:`claude`,label:`Claude`,groups:[of(`claude`,`settings`,`Settings`),of(`claude`,`mcp`,`MCP`,`A dedicated .mcp.json (key: mcpServers), shared via version control.`),of(`claude`,`memory`,`Memory & instructions`)]},{id:`codex`,label:`Codex`,note:rf,groups:[of(`codex`,`settings`,`Settings`),of(`codex`,`mcp`,`MCP`,`Inside config.toml under [mcp_servers.<id>] — the same file as Codex’s settings.`),of(`codex`,`memory`,`Memory & instructions`)]},{id:`opencode`,label:`OpenCode`,note:rf,groups:[of(`opencode`,`settings`,`Settings`),of(`opencode`,`mcp`,`MCP`,`Under the "mcp" key in opencode.json — the same file as OpenCode’s settings.`),of(`opencode`,`memory`,`Memory & instructions`)]},{id:`pi`,label:`pi`,note:rf,groups:[of(`pi`,`settings`,`Settings`),of(`pi`,`mcp`,`MCP`,`A dedicated mcp.json, read by the pi-mcp-adapter extension — pi itself reads no MCP config.`),of(`pi`,`memory`,`Memory & instructions`)]}];function cf(e){let t=sf.find(t=>t.id===e);if(!t)throw Error(`no agent descriptor for ${e}`);return t}function lf(e){return e.seeded?`Copied into each run’s worktree — takes effect on your next run.`:e.tracked===`tracked`?`Runs read the committed copy — this edit applies after you commit it.`:e.tracked===`outside-repo`?`Applies to every session on this machine.`:`Personal, git-ignored.`}function uf(){let e=_(),t=I(),n=(0,J.useMemo)(()=>t.data?dr(t.data.checks):sf.map(e=>e.id),[t.data]);return e.isPending?(0,Y.jsx)(`p`,{"data-slot":`agent-config-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent config…`}):e.isError?(0,Y.jsx)(V,{icon:(0,Y.jsx)(Za,{}),tone:`danger`,title:`Agent config did not load`,subtitle:e.error.message,heading:`h2`}):(0,Y.jsx)(df,{listing:e.data,installed:n})}function df({listing:e,installed:t}){let[n,r]=(0,J.useState)(`claude`),[i,a]=(0,J.useState)(null),o=cf(n),s=e.files.find(e=>e.id===i)??null,c=e=>{r(e),a(null)};return(0,Y.jsxs)(`div`,{"data-slot":`agent-config`,className:`flex flex-col gap-4 p-4 md:p-6`,children:[!e.editable&&(0,Y.jsx)(`div`,{"data-slot":`agent-config-readonly`,className:`rounded-md border border-border bg-muted/40 px-3 py-2 text-[13px] text-soft-foreground`,children:`Read-only: agent config is edited from the machine that owns the checkout (this cockpit runs in hosted mode). You can still see every file and which one wins.`}),(0,Y.jsx)(`div`,{"data-slot":`agent-config-agents`,role:`tablist`,className:`flex flex-wrap gap-1 rounded-md bg-muted/40 p-1`,children:sf.map(e=>(0,Y.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":e.id===o.id,"data-slot":`agent-config-agent`,"data-agent":e.id,"data-selected":e.id===o.id,onClick:()=>c(e.id),className:U(`flex items-center gap-2 rounded-md px-3 py-1.5 text-[13px] transition-colors`,e.id===o.id?`bg-background font-semibold shadow-sm`:`hover:bg-muted/60`),children:[e.label,!t.includes(e.id)&&(0,Y.jsx)(dc,{variant:`outline`,className:`text-[10px] text-soft-foreground`,children:`not installed`})]},e.id))}),o.note&&(0,Y.jsx)(`p`,{"data-slot":`agent-config-agent-note`,className:`text-[12px] text-soft-foreground`,children:o.note}),(0,Y.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[minmax(0,20rem)_minmax(0,1fr)]`,children:[(0,Y.jsx)(`nav`,{"data-slot":`agent-config-nav`,className:`flex flex-col gap-5`,children:(0,Y.jsx)(ff,{agent:o,listing:e,selectedId:i,onSelect:a})}),(0,Y.jsx)(`div`,{"data-slot":`agent-config-editor-pane`,children:s?(0,Y.jsx)(mf,{file:s},s.id):(0,Y.jsx)(`div`,{className:`flex h-full min-h-40 items-center justify-center rounded-md border border-dashed border-border text-[13px] text-soft-foreground`,children:`Select a config file to view or edit it.`})})]})]})}function ff({agent:e,listing:t,selectedId:n,onSelect:r}){return(0,Y.jsx)(Y.Fragment,{children:e.groups.map(i=>{let a=t.files.filter(i.files),o=e.id===`claude`&&i.id===`mcp`;return a.length===0&&!(o&&t.userMcp)?null:(0,Y.jsxs)(`section`,{"data-slot":`agent-config-group`,"data-group":i.id,"data-agent":e.id,children:[(0,Y.jsx)(`p`,{className:`mb-1 text-[11px] font-medium uppercase tracking-wide text-soft-foreground`,children:i.label}),i.note&&(0,Y.jsx)(`p`,{className:`mb-2 text-[12px] text-soft-foreground`,children:i.note}),(0,Y.jsx)(`ul`,{className:`flex flex-col gap-1`,children:a.map(e=>(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`agent-config-file`,"data-selected":e.id===n,onClick:()=>r(e.id),className:U(`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-[13px] transition-colors`,e.id===n?`bg-primary/15 text-foreground`:`hover:bg-muted/60`),children:[(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[12px]`,children:e.label}),e.seeded&&(0,Y.jsx)(dc,{variant:`outline`,className:`shrink-0 text-[10px]`,children:`seeded`}),!e.exists&&(0,Y.jsx)(`span`,{className:`shrink-0 text-[11px] text-soft-foreground`,children:`absent`})]})},e.id))}),o&&t.userMcp&&(0,Y.jsx)(pf,{userMcp:t.userMcp})]},i.id)})})}function pf({userMcp:e}){return(0,Y.jsxs)(`div`,{"data-slot":`agent-config-user-mcp`,className:`mt-3`,children:[(0,Y.jsx)(`h4`,{className:`mb-1 text-[12px] font-semibold`,children:`User & local scopes`}),(0,Y.jsxs)(`p`,{className:`mb-2 text-[12px] text-soft-foreground`,children:[`Managed by `,(0,Y.jsx)(`code`,{className:`font-mono`,children:`claude mcp add`}),` in `,e.path,` — xezar does not edit Claude’s state file.`]}),e.readable?e.servers.length>0?(0,Y.jsx)(`ul`,{className:`flex flex-wrap gap-1`,children:e.servers.map(e=>(0,Y.jsx)(`li`,{children:(0,Y.jsx)(dc,{variant:`outline`,className:`font-mono text-[11px]`,children:e})},e))}):(0,Y.jsx)(`p`,{className:`text-[12px] text-soft-foreground`,children:`No user-scoped MCP servers.`}):(0,Y.jsx)(`p`,{className:`text-[12px] text-soft-foreground`,children:`Could not read the file.`})]})}function mf({file:e}){let t=E(e.id),n=At(e.id),[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(null),l=t.data?.version??null;(0,J.useEffect)(()=>{t.data&&(i(t.data.content),o(!1),c(null))},[t.data?.version,t.data]);let u=r??t.data?.content??``,d=t.data?u!==t.data.content:!1,f=e.writable;return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.label}),(0,Y.jsx)(dc,{variant:`outline`,className:`text-[10px] uppercase`,children:e.format}),(0,Y.jsx)(`a`,{href:e.docsUrl,target:`_blank`,rel:`noreferrer`,className:`text-[12px] text-soft-foreground underline hover:text-foreground`,children:`docs`})]}),(0,Y.jsx)(`p`,{"data-slot":`agent-config-precedence`,className:`text-[12px] text-soft-foreground`,children:e.precedence}),(0,Y.jsxs)(`p`,{"data-slot":`agent-config-effect`,className:`text-[12px] text-foreground/80`,children:[lf(e),e.hotReload?` ${e.hotReload}`:``]}),t.isPending?(0,Y.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Loading file…`}):t.isError?(0,Y.jsx)(`p`,{className:`text-[13px] text-destructive`,children:t.error.message}):(0,Y.jsx)(nf,{value:u,language:e.format,readOnly:!f,onChange:i,"aria-label":`${e.label} contents`,className:`h-[26rem]`}),s&&(0,Y.jsx)(`p`,{"data-slot":`agent-config-format-error`,className:`text-[12px] text-destructive`,children:s}),a&&(0,Y.jsxs)(`div`,{"data-slot":`agent-config-conflict`,className:`flex items-center justify-between gap-2 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-[12px]`,children:[(0,Y.jsx)(`span`,{children:`The file changed on disk since you opened it.`}),(0,Y.jsx)(L,{size:`sm`,variant:`outline`,onClick:()=>void t.refetch(),children:`Reload from disk`})]}),f&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(L,{size:`sm`,onClick:()=>{c(null),o(!1),n.mutate({content:u,version:l},{onSuccess:()=>{i(null),z(`${e.exists?`Saved`:`Created`} ${e.label}`)},onError:e=>{e instanceof Se&&e.status===409?o(!0):e instanceof Se&&e.status===400?c(e.message):z(e.message,{tone:`danger`})}})},disabled:!d||n.isPending,children:e.exists?`Save`:`Create`}),(0,Y.jsx)(L,{size:`sm`,variant:`ghost`,onClick:()=>i(null),disabled:!d||n.isPending,children:`Revert`}),d&&(0,Y.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`Unsaved changes`})]})]})}function hf({className:e,size:t=`default`,...n}){return(0,Y.jsx)(Qo,{"data-slot":`switch`,"data-size":t,className:U(`peer group/switch inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input`,e),...n,children:(0,Y.jsx)(es,{"data-slot":`switch-thumb`,className:U(`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0`)})})}var gf=[{id:`claude`,label:En.claude,login:`claude auth login`},{id:`codex`,label:En.codex,login:`codex login`},{id:`opencode`,label:En.opencode,login:`opencode auth login`},{id:`pi`,label:En.pi,login:`pi /login`}],_f=e=>({claude:e,codex:e,opencode:e,pi:e}),vf={connected:{label:`Credentials found`,tone:`success`},disconnected:{label:`Not connected`,tone:`pending`},"not-installed":{label:`Not installed`,tone:`neutral`},unknown:{label:`Could not verify`,tone:`danger`}};function yf(e,t,n){return{providers:e.providers.map(e=>e.provider===t?{...e,enabled:n}:e)}}function bf(){let e=it(),t=ze(),n=we(),r=O(),[i,a]=(0,J.useState)(null),s=(0,J.useRef)(Promise.resolve()),c=(0,J.useRef)(_f(0)),l=(0,J.useRef)(_f(0)),u=(0,J.useRef)(e.data);(0,J.useEffect)(()=>{i&&o(e.data,i.provider)?.status===`connected`&&a(null)},[i,e.data]),(0,J.useEffect)(()=>{if(e.data){if(Object.values(l.current).every(e=>e===0)||!u.current){u.current=e.data;return}u.current={providers:e.data.providers.map(e=>({...e,enabled:l.current[e.provider]>0?o(u.current,e.provider)?.enabled??e.enabled:e.enabled}))}}},[e.data]);let d=(0,J.useCallback)((e,t)=>{let n=F.providerStatus,i=r.getQueryData(n);if(!i)return;u.current||=i;let a=yf(i,e,t);l.current[e]+=1,r.setQueryData(n,a);let d=++c.current[e];s.current=s.current.then(async()=>{try{let i=await Yt(e,t),a=o(i,e)?.enabled;if(a===void 0)return;if(u.current=yf(u.current??i,e,a),d===c.current[e]){let t=r.getQueryData(n);r.setQueryData(n,t?yf(t,e,a):i)}}catch(t){if(d===c.current[e]){let i=o(u.current,e)?.enabled,a=r.getQueryData(n);a&&i!==void 0?r.setQueryData(n,yf(a,e,i)):u.current?r.setQueryData(n,u.current):r.removeQueries({queryKey:n,exact:!0}),z(t instanceof Error?t.message:String(t),{tone:`danger`})}}finally{--l.current[e]}})},[r]),f=P({mutationFn:e=>v(e),onSuccess:async e=>{a(null),z(e.opened?`Finish signing in in the terminal, then check again.`:`Provider is already connected.`),await r.invalidateQueries({queryKey:F.providerStatus})},onError:(e,t)=>{if(e instanceof Se&&e.command){let n=gf.find(e=>e.id===t)?.label??t;a({provider:t,label:n,message:e.message,command:e.command});return}z(e.message,{tone:`danger`})}}),p=async e=>{try{await navigator.clipboard.writeText(e),z(`Command copied`)}catch{z(`Could not copy the command`,{tone:`danger`})}};return(0,Y.jsxs)(`section`,{id:`providers`,"data-slot":`provider-settings`,className:`scroll-mt-20`,children:[(0,Y.jsxs)(`div`,{className:`mb-2`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Providers`}),(0,Y.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Connect the coding agents available on this computer.`})]}),e.isError?(0,Y.jsxs)(`div`,{role:`alert`,className:`mb-3 flex flex-wrap items-center justify-between gap-2 rounded-md border border-danger/30 bg-danger/5 px-3 py-2.5`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:`Provider status could not be loaded`}),(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.error.message})]}),(0,Y.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,disabled:e.isFetching,onClick:()=>void e.refetch(),children:`Retry`})]}):null,(0,Y.jsx)(`div`,{className:`flex flex-col gap-2`,children:gf.map(r=>{let a=o(e.data,r.id),s=a?.status,c=s?vf[s]:e.isPending?{label:`Checking…`,tone:`neutral`}:vf.unknown,l=f.isPending&&f.variables===r.id,u=s===`disconnected`||s===`unknown`,m=a?.authFailureId;return(0,Y.jsxs)(J.Fragment,{children:[(0,Y.jsxs)(`div`,{"data-slot":`provider-card`,"data-provider":r.id,className:`rounded-md border border-border bg-card px-3.5 py-3`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:r.label}),(0,Y.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,Y.jsx)(q,{tone:c.tone,pulse:e.isPending}),(0,Y.jsx)(`span`,{children:r.id===`opencode`&&s===`connected`?`Configured`:c.label}),a?.enabled===!1?(0,Y.jsx)(`span`,{children:`Disabled`}):null]}),s===`not-installed`?(0,Y.jsxs)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:[`Install `,r.label,`, then run `,(0,Y.jsx)(`code`,{children:r.login}),`.`]}):s===`unknown`||e.isError&&!s?(0,Y.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:`Verification failed. Check again when the provider is available.`}):a?.hint?(0,Y.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:a.hint}):null]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s===`not-installed`?null:(0,Y.jsx)(hf,{checked:a?.enabled??!0,"aria-label":`Use ${r.label}`,onCheckedChange:e=>d(r.id,e)}),u?(0,Y.jsx)(L,{type:`button`,variant:`ghost`,size:`sm`,disabled:t.isPending,onClick:()=>t.mutate(void 0,{onError:e=>z(e.message,{tone:`danger`})}),children:`Check again`}):null,s===`disconnected`?(0,Y.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,disabled:f.isPending,onClick:()=>f.mutate(r.id),children:l?`Opening…`:`Connect`}):null,m===void 0?null:(0,Y.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,disabled:n.isPending,onClick:()=>n.mutate({provider:r.id,authFailureId:m},{onSuccess:()=>z(`${r.label} can be tried again.`),onError:e=>z(e.message,{tone:`danger`})}),children:`Try again`})]})]}),m===void 0?null:(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`Use this after completing the provider sign-in flow. xezar cannot validate the credential without a task/model request; it will verify it on the next task.`})]}),i?.provider===r.id&&s!==`connected`?(0,Y.jsxs)(`div`,{role:`region`,"aria-label":`${i.label} manual sign-in`,className:`rounded-md border border-pending/40 bg-pending/5 px-3.5 py-3`,children:[(0,Y.jsx)(`p`,{className:`text-[13px] text-foreground`,children:i.message}),(0,Y.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`code`,{className:`min-w-0 flex-1 overflow-x-auto rounded-sm bg-muted px-2 py-1.5 text-xs`,children:i.command}),(0,Y.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void p(i.command),children:`Copy command`})]})]}):null]},r.id)})})]})}var xf=2e4,Sf=32;function Cf(e){return e.map(e=>e.ref===`main`?e.repo:`${e.repo}@${e.ref}`).join(`
7
+ `)}function wf(){let e=tn(),t=N(),n=it();return e.isPending?(0,Y.jsx)(`p`,{"data-slot":`agents-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent settings…`}):e.isError?(0,Y.jsx)(V,{icon:(0,Y.jsx)(xn,{}),tone:`danger`,title:`Agent settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,Y.jsx)(Tf,{config:e.data,catalogs:t,providerStatus:n})}function Tf({config:e,catalogs:t,providerStatus:n}){let r=be(),i=O(),a=P({mutationFn:e=>kt(e),onSuccess:e=>{i.setQueryData(B.config,e),i.invalidateQueries({queryKey:B.health}),i.invalidateQueries({queryKey:B.repo})},onError:e=>z(e.message,{tone:`danger`})}),[s,c]=(0,J.useState)(e.systemPrompt??``),l=s.trim(),u=l===(e.systemPrompt??``),d=l.length>xf,f=e.plannerModel??`sonnet`,p=e.namerModel??`haiku`,m=e.skillsRepos??[],[h,g]=(0,J.useState)(f),[_,v]=(0,J.useState)(p),y=h.trim()===f,b=_.trim()===p,[x,S]=(0,J.useState)(Cf(m)),C=x.split(`
8
+ `).map(e=>e.trim()).filter(Boolean).map(e=>{let t=e.lastIndexOf(`@`);return t>0&&!e.slice(t+1).includes(`/`)&&!e.slice(t+1).includes(`:`)?{repo:e.slice(0,t),ref:e.slice(t+1)}:{repo:e,ref:`main`}}),w=C.length>Sf||C.some(e=>e.repo===``),T=!w&&JSON.stringify(C)===JSON.stringify(m);return(0,Y.jsxs)(`div`,{"data-slot":`agents-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,Y.jsx)(bf,{}),(0,Y.jsx)(Ef,{defaultRunner:e.defaultRunner,providerStatus:n,saving:a.isPending,onPick:e=>a.mutate({defaultRunner:e})}),(0,Y.jsx)(Df,{title:`Default models`,hint:e.modelsLocked?`Models are locked to the defaults configured in the native coding-agent settings.`:`The model preselected in the composer for each runner. Auto lets the runner decide per task.`,children:(0,Y.jsx)(`div`,{className:`flex max-w-md flex-col gap-2`,children:cr.map(r=>{let i=o(n.data,r.id),s=!n.isPending&&!n.isError&&i?.enabled===!0&&i.status===`connected`,c=n.isPending?`Checking provider authentication…`:n.isError?`Provider authentication could not be verified.`:i?.enabled===!1?`This provider is disabled. Enable it above or choose another provider.`:s?void 0:`Connect this provider before selecting it.`,l=t[r.id],u=Qn(r.id,l.data,l.isError),d=lr(r.id,l.data,[e.defaultModels[r.id]]),f=e.defaultModels[r.id]??``,p=d.find(e=>e.id===f)?.label??f??`auto (default)`;return(0,Y.jsxs)(`label`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(`span`,{className:`w-24 shrink-0 font-mono text-xs text-muted-foreground`,children:r.label}),e.modelsLocked?(0,Y.jsx)(`output`,{"aria-label":`Default model for ${r.label}`,"data-slot":`agents-model`,"data-runner":r.id,title:`Model selection is locked to native coding-agent settings.`,className:`block w-full rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs`,children:p}):(0,Y.jsxs)(`select`,{"aria-label":`Default model for ${r.label}`,"data-slot":`agents-model`,"data-runner":r.id,value:f,title:c??r.desc,disabled:a.isPending||!s,onChange:e=>a.mutate({defaultModels:{[r.id]:e.target.value||null}}),className:`block w-full rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[d.map(e=>(0,Y.jsx)(`option`,{value:e.id,children:e.id===``?`auto (default)`:e.label},e.id)),u?(0,Y.jsx)(`option`,{disabled:!0,children:u}):null]})]},r.id)})})}),(0,Y.jsxs)(Df,{title:`System prompt`,hint:`Extra instructions appended to every run, whichever runner executes it. This is the only place it is edited.`,children:[(0,Y.jsx)(li,{"aria-label":`System prompt`,"data-slot":`agents-system-prompt`,value:s,onChange:e=>c(e.target.value),placeholder:`Extra rules for every agent run — conventions, tone, review requirements…`,className:`min-h-32 max-w-xl`}),(0,Y.jsxs)(`div`,{className:`flex max-w-xl items-center gap-3`,children:[(0,Y.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,"data-action":`agents-save-prompt`,disabled:u||d||a.isPending,onClick:()=>a.mutate({systemPrompt:l===``?null:l},{onSuccess:()=>z(l===``?`System prompt cleared`:`System prompt saved`)}),children:`Save`}),d?(0,Y.jsxs)(`p`,{"data-slot":`agents-prompt-limit`,className:`text-[11px] text-danger`,children:[l.length.toLocaleString(),` characters — the limit is`,` `,xf.toLocaleString(),`.`]}):(0,Y.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Leave empty and save to clear. Applied to new runs only.`})]})]}),(0,Y.jsx)(Df,{title:`Live title updates`,hint:`Refresh a task's short title through the namer model as the run progresses. A manual rename always wins and stops updates for that task.`,children:(0,Y.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,Y.jsx)(hf,{"aria-label":`Live title updates`,"data-slot":`agents-live-title-updates`,checked:e.liveTitleUpdates??!0,disabled:a.isPending,onCheckedChange:e=>a.mutate({liveTitleUpdates:e},{onSuccess:()=>z(e?`Live title updates on`:`Live title updates off`)})}),(0,Y.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.liveTitleUpdates??!0?`On`:`Off`,e.liveTitleUpdates===null&&` (default)`]})]})}),(0,Y.jsx)(Df,{title:`Review changes before finishing`,hint:`When on, a task with changes pauses so you can Accept, Send back, or open a Draft PR. Autonomous tasks always skip this and finish on their own. Default: off — tasks finish without asking.`,children:(0,Y.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,Y.jsx)(hf,{"aria-label":`Review changes before finishing`,"data-slot":`agents-review-gate`,checked:e.reviewGate??!1,disabled:a.isPending,onCheckedChange:e=>a.mutate({reviewGate:e},{onSuccess:()=>z(e?`Review gate on`:`Review gate off`)})}),(0,Y.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.reviewGate??!1?`On`:`Off`,e.reviewGate===null&&` (default)`]})]})}),(0,Y.jsxs)(Df,{title:`Planner and namer models`,hint:`Two small background jobs: the planner turns a task into a chain of steps, the namer gives it its display title. Both are Claude aliases and are ignored when this project's default agent is not Claude.`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Y.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`Planner model`}),(0,Y.jsx)(`input`,{type:`text`,"aria-label":`Planner model`,"data-slot":`agents-planner-model`,value:h,disabled:a.isPending,placeholder:`sonnet`,onChange:e=>g(e.target.value),className:`block w-full max-w-md rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`})]}),(0,Y.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`Namer model`}),(0,Y.jsx)(`input`,{type:`text`,"aria-label":`Namer model`,"data-slot":`agents-namer-model`,value:_,disabled:a.isPending,placeholder:`haiku`,onChange:e=>v(e.target.value),className:`block w-full max-w-md rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`})]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,"data-action":`agents-save-planner-namer`,disabled:y&&b||h.trim()===``||_.trim()===``||a.isPending,onClick:()=>a.mutate({plannerModel:h.trim(),namerModel:_.trim()},{onSuccess:()=>z(`Planner and namer models saved`)}),children:`Save`}),(0,Y.jsx)(L,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`agents-reset-planner-namer`,disabled:a.isPending,onClick:()=>a.mutate({plannerModel:null,namerModel:null},{onSuccess:e=>{g(e.plannerModel),v(e.namerModel),z(`Back to the defaults (sonnet and haiku)`)}}),children:`Use defaults`})]})]}),(0,Y.jsxs)(Df,{title:`Team skill repositories`,hint:`Extra skill playbooks pulled from git, one per line: owner/name, a git URL, or a local path — add @branch for a ref other than main. This project's own .xezar/skills always wins. Leave empty to use no team skills.`,children:[(0,Y.jsx)(`textarea`,{"aria-label":`Team skill repositories`,"data-slot":`agents-skills-repos`,rows:3,value:x,disabled:a.isPending,placeholder:`open-mercato/skills`,onChange:e=>S(e.target.value),className:`block w-full max-w-md rounded-md border border-input bg-card px-3 py-1.5 font-mono text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,"data-action":`agents-save-skills-repos`,disabled:T||w||a.isPending,onClick:()=>a.mutate({skillsRepos:C},{onSuccess:()=>z(C.length===0?`Team skills off for this project`:`Using ${C.length} team skill source${C.length===1?``:`s`}`)}),children:`Save`}),(0,Y.jsx)(L,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`agents-reset-skills-repos`,disabled:a.isPending,onClick:()=>a.mutate({skillsRepos:null},{onSuccess:e=>{S(Cf(e.skillsRepos??[])),z(`Back to the shared catalog`)}}),children:`Use the shared catalog`})]}),w?(0,Y.jsxs)(`p`,{"data-slot":`agents-skills-repos-invalid`,className:`text-[11px] text-danger`,children:[`One source per line, at most `,Sf,`.`]}):null]}),(0,Y.jsx)(Df,{title:`Base branch`,hint:`New task worktrees branch from this and draft PRs target it. Also settable from the Git view.`,children:r.data?.info?(0,Y.jsxs)(`select`,{"aria-label":`Base branch`,"data-slot":`agents-base-branch`,value:e.baseBranch??``,disabled:a.isPending,onChange:e=>a.mutate({baseBranch:e.target.value||null}),className:`block w-full max-w-md rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,Y.jsx)(`option`,{value:``,children:`follow checked-out branch (default)`}),r.data.branches.map(e=>(0,Y.jsx)(`option`,{value:e,children:e},e))]}):(0,Y.jsx)(`p`,{"data-slot":`agents-base-branch-unavailable`,className:`text-[13px] text-soft-foreground`,children:r.isPending?`Loading branches…`:`Not a git repository — tasks run in place, no branching.`})})]})}function Ef({defaultRunner:e,providerStatus:t,saving:n,onPick:r}){let i=ie(),a=R(),s=Jt(),c=be(),l=A(),u=s.projectId??`default`,d=c.data?.info?.root,f=d?i.data?.selections[d]:void 0,p=i.data?.defaults,m=zd(i.data?.profiles??[]),h=Bd(m);return(0,Y.jsxs)(Df,{title:h?`Default agent`:`Default runner`,hint:h?`Preselected for new tasks in THIS repo, and used by the chain planner. Each task can still pick another agent or account. The account is stored on this machine only — it is never committed, so a teammate keeps their own.`:`Preselected for new tasks in THIS repo, and used by the chain planner. Each task can still pick another runner.`,children:[(0,Y.jsx)(Vd,{rows:m,runner:e,accountFor:e=>f?.[e]??p?.[e]??null,providerStatus:t,disabled:n,accountDisabled:l.isPending||a.data===void 0,onPick:(t,n,i)=>{t!==e&&r(t),i&&l.mutate({projectId:u,provider:t,profileId:n},{onError:e=>z(e.message,{tone:`danger`})})}}),!t.isPending&&!t.isError&&o(t.data,e)?.enabled===!1?(0,Y.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`This provider is disabled. Enable it above or choose another provider.`}):null,h?(0,Y.jsx)(`p`,{className:`max-w-md text-[13px] text-muted-foreground`,children:`Tasks already started under another account can’t be resumed here — their sessions live in that account’s folder.`}):null]})}function Df({title:e,hint:t,children:n}){return(0,Y.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,Y.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}var Of=`xez-accent`,kf=`xez-density`,Af=`xez-width`,jf=`lime`,Mf=`comfortable`,Nf=`narrow`;function Pf(e){return e===`lime`||e===`violet`?e:jf}function Ff(e){return e===`comfortable`||e===`compact`||e===`ultra`?e:Mf}function If(e){return e===`narrow`||e===`wide`?e:Nf}function Lf(e){let t=e&&typeof e==`object`?e:{};return{accent:Pf(t.accent),density:Ff(t.density),width:If(t.width)}}function Rf(){try{return{accent:Pf(localStorage.getItem(Of)),density:Ff(localStorage.getItem(kf)),width:If(localStorage.getItem(Af))}}catch{return{accent:jf,density:Mf,width:Nf}}}function zf(e){try{localStorage.setItem(Of,e.accent),localStorage.setItem(kf,e.density),localStorage.setItem(Af,e.width)}catch{}}function Bf(e,t){t.accent===`lime`?delete e.dataset.accent:e.dataset.accent=t.accent,t.density===`comfortable`?delete e.dataset.density:e.dataset.density=t.density,t.width===`narrow`?delete e.dataset.width:e.dataset.width=t.width}var Vf=J.createContext(null);function Hf({children:e}){let t=O(),n=Nt(),[r,i]=J.useState(Rf),a=n.data;J.useEffect(()=>{if(a===void 0)return;let e=Lf(a.appearance);i(e),zf(e)},[a]),J.useLayoutEffect(()=>{Bf(document.documentElement,r)},[r]);let o=J.useCallback(e=>{i(e),zf(e),st({appearance:e}).then(e=>t.setQueryData(F.uiState,e)).catch(e=>{z(e instanceof Error?e.message:String(e),{tone:`danger`}),t.invalidateQueries({queryKey:F.uiState})})},[t]),s=J.useCallback(e=>o({...r,accent:e}),[o,r]),c=J.useCallback(e=>o({...r,density:e}),[o,r]),l=J.useCallback(e=>o({...r,width:e}),[o,r]),u=J.useMemo(()=>({accent:r.accent,density:r.density,width:r.width,setAccent:s,setDensity:c,setWidth:l}),[r,s,c,l]);return(0,Y.jsx)(Vf.Provider,{value:u,children:e})}function Uf(){let e=J.useContext(Vf);if(!e)throw Error(`xezar: useAppearance() must be called inside <AppearanceProvider>`);return e}var Wf=[{value:`system`,label:`System`,icon:_o},{value:`light`,label:`Light`,icon:Mo},{value:`dark`,label:`Dark`,icon:vo}],Gf=[{value:`lime`,label:`Lime`,swatch:`var(--accent-lime)`},{value:`violet`,label:`Violet`,swatch:`var(--violet)`}],Kf=[{value:`comfortable`,label:`Comfortable`},{value:`compact`,label:`Compact`},{value:`ultra`,label:`Compact for real`}],qf=[{value:`narrow`,label:`Narrow`},{value:`wide`,label:`Wide`}];function Jf({slot:e,label:t,value:n,options:r,onChange:i}){return(0,Y.jsx)(`div`,{role:`radiogroup`,"aria-label":t,"data-slot":e,className:`inline-flex w-fit gap-0.5 rounded-md border border-border bg-card p-0.5`,children:r.map(e=>{let t=e.value===n;return(0,Y.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t,"data-value":e.value,onClick:()=>i(e.value),className:U(`flex items-center gap-2 rounded-sm px-3 py-1.5 text-[13px] font-medium transition-colors`,t?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:[e.icon?(0,Y.jsx)(e.icon,{"aria-hidden":`true`,className:`size-3.5`}):null,e.swatch?(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 rounded-full border border-border`,style:{background:e.swatch}}):null,e.label]},e.value)})})}function Yf({title:e,hint:t,children:n}){return(0,Y.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,Y.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}function Xf(){let{theme:e,setTheme:t}=Fc(),{accent:n,density:r,width:i,setAccent:a,setDensity:o,setWidth:s}=Uf();return(0,Y.jsxs)(`div`,{"data-slot":`appearance-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,Y.jsx)(Yf,{title:`Theme`,hint:`System follows your OS preference. Applies to this browser.`,children:(0,Y.jsx)(Jf,{slot:`appearance-theme`,label:`Theme`,value:e,options:Wf,onChange:t})}),(0,Y.jsx)(Yf,{title:`Accent`,hint:`The primary action color. Saved with this repo's cockpit state.`,children:(0,Y.jsx)(Jf,{slot:`appearance-accent`,label:`Accent`,value:n,options:Gf,onChange:a})}),(0,Y.jsx)(Yf,{title:`Density`,hint:`Compact tightens spacing across the cockpit — text stays the same size.`,children:(0,Y.jsx)(Jf,{slot:`appearance-density`,label:`Density`,value:r,options:Kf,onChange:o})}),(0,Y.jsx)(Yf,{title:`Reading width`,hint:`Wide lets a task's session and commits use more of the screen. Narrow keeps a comfortable reading column. The Changes tab is always full-width.`,children:(0,Y.jsx)(Jf,{slot:`appearance-width`,label:`Reading width`,value:i,options:qf,onChange:s})})]})}var Zf=`http://localhost:4321`;function Qf(e,t,n,r=Zf,i=null){let a=e=>encodeURIComponent(e).replaceAll(`'`,`%27`),o=`(()=>{const m=location.href.match(/^https:\\/\\/github\\.com\\/([^\\/]+)\\/([^\\/]+)\\/(pull|issues)\\/\\d+/);if(!m){alert('Open a GitHub PR or issue first');return;}const q='${`${e?`skill=${a(e)}&`:``}auto=${t?`1`:`0`}&key=${a(n)}&ref=`}'+encodeURIComponent(location.href);open('${r.replaceAll(`'`,`%27`)}${i===null||i===``?`/new`:`/p/${a(i)}/new`}?'+q,'_blank');})();`;return`javascript:${encodeURIComponent(o)}`}function $f(){let e=an();return e.isPending?(0,Y.jsx)(`p`,{"data-slot":`bookmarklets-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading bookmarklets…`}):e.isError?(0,Y.jsx)(V,{icon:(0,Y.jsx)(si,{}),tone:`danger`,heading:`h2`,title:`Could not load bookmarklets`,subtitle:e.error.message}):(0,Y.jsx)(`div`,{className:`flex min-h-full flex-1 overflow-y-auto px-4 py-5 md:px-7`,children:(0,Y.jsx)(ep,{skills:Yi(e.data??[])})})}function ep({skills:e}){let t=et(),n=I(),r=R(),[i,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(``),c=t.data?.key??``,l=window.location.origin,u=Ni()??n.data?.bootProject??null,d=r.data?.projects.find(e=>e.id===u)?.name??w_(n.data)?.name??null,f=o.trim().toLowerCase(),p=e.filter(e=>e.name.toLowerCase().includes(f));return(0,Y.jsxs)(`div`,{"data-slot":`bookmarklet-panel`,className:`mx-auto w-full max-w-2xl`,children:[(0,Y.jsx)(`h2`,{className:`text-base font-semibold`,children:`Run from GitHub`}),(0,Y.jsxs)(`p`,{className:`mt-2 text-[13px] leading-relaxed text-muted-foreground`,children:[`Drag a button below to your browser's bookmarks bar. On any GitHub PR or issue, click it to open this cockpit directly. The cockpit must be running: `,(0,Y.jsx)(`span`,{className:`font-mono`,children:`npx xezar`}),`.`]}),(0,Y.jsxs)(`label`,{className:`mt-4 flex items-center gap-2 text-[13px] font-medium`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,"data-slot":`bm-auto`,checked:i,onChange:e=>a(e.target.checked),className:`size-3.5`}),`One-click launch (auto-submit)`,` `,(0,Y.jsx)(`span`,{className:`font-normal text-soft-foreground`,children:`— re-drag the buttons after changing this`})]}),(0,Y.jsx)(`div`,{"data-slot":`bm-generic`,className:`mt-4`,children:(0,Y.jsx)(tp,{label:d?`xezar (${d}): this PR/issue`:`xezar: this PR/issue`,url:Qf(``,!1,c,l,u),hint:`prefills the form — nothing starts by itself`})}),(0,Y.jsx)(hc,{"data-slot":`bm-filter`,placeholder:`Filter skills…`,"aria-label":`Filter bookmarklet skills`,value:o,onChange:e=>s(e.target.value),className:`mt-5 h-8 text-[13px]`}),(0,Y.jsx)(`div`,{"data-slot":`bm-list`,className:`mt-3 flex flex-col gap-2`,children:p.length>0?p.map(e=>(0,Y.jsx)(tp,{label:d?`/${e.name} (${d})`:`/${e.name}`,url:Qf(e.name,i,c,l,u),hint:e.source},e.path)):(0,Y.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:e.length>0?`(no skills match)`:`(no skills yet — the generic launcher above still works)`})})]})}function tp({label:e,url:t,hint:n}){let r=(0,J.useRef)(null);(0,J.useEffect)(()=>{r.current?.setAttribute(`href`,t)},[t]);let i=async()=>{try{await navigator.clipboard.writeText(t),z(`Bookmarklet URL copied.`)}catch{z(`Copy failed — drag the button instead.`,{tone:`danger`})}};return(0,Y.jsxs)(`div`,{"data-slot":`bm-row`,className:`flex min-w-0 items-center gap-2.5`,children:[(0,Y.jsxs)(`a`,{ref:r,draggable:!0,"data-slot":`bm-link`,title:`Drag me to your bookmarks bar`,onClick:e=>{e.preventDefault(),z(`Drag me to your bookmarks bar`)},className:`inline-flex shrink-0 items-center gap-1.5 rounded-md border border-border bg-card px-2.5 py-1 font-mono text-xs font-medium text-foreground shadow-xs transition-colors hover:bg-muted`,children:[(0,Y.jsx)(hr,{"aria-hidden":`true`,className:`size-3 text-primary`}),e]}),(0,Y.jsx)(`button`,{type:`button`,"data-slot":`bm-copy`,title:`Copy the bookmarklet URL`,onClick:()=>void i(),className:`shrink-0 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground`,children:`Copy`}),n?(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-soft-foreground`,children:n}):null]})}var np=`/settings/mcp-connection`,rp=`docs/features/mcp-server/mcp-api.md`,ip=10,ap=[`action`,`view`,`read`],op=`outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,sp=`rounded-sm underline underline-offset-2 ${op}`;function cp(){let e=Lt();return e.isPending?(0,Y.jsx)(`p`,{"data-slot":`mcp-api-loading`,role:`status`,"aria-live":`polite`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading the tool list…`}):e.isError?(0,Y.jsx)(V,{icon:(0,Y.jsx)(si,{}),tone:`danger`,heading:`h2`,title:`Could not load the MCP API reference`,subtitle:e.error.message}):e.data.available?(0,Y.jsx)(Fp,{reference:e.data}):(0,Y.jsx)(`div`,{className:`mx-auto w-full max-w-2xl p-4 md:p-6`,children:(0,Y.jsxs)(`p`,{"data-slot":`mcp-api-unavailable`,role:`status`,className:`rounded-md border border-border bg-card p-3 text-[13px] leading-relaxed text-foreground`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`The MCP API reference is not available.`}),` `,e.data.reason,` `,`The rest of the cockpit keeps working; `,(0,Y.jsx)(lp,{children:`MCP connection`}),` still shows the connection and client setup.`]})})}function lp({children:e}){return(0,Y.jsx)(K,{to:np,className:`font-medium ${sp}`,children:e})}var up=e=>typeof e==`object`&&!!e&&!Array.isArray(e),dp=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,fp=e=>e.charAt(0).toUpperCase()+e.slice(1);function pp(e){let t=up(e.inputSchema.properties)?e.inputSchema.properties:{};for(let e of ap){let n=t[e];if(up(n)&&Array.isArray(n.enum))return{name:e,values:n.enum.filter(e=>typeof e==`string`)}}return null}var mp=e=>e?.readOnlyHint===!0?`read-only`:`changes`;function hp(e,t){let n=new Map;for(let r of e)n.set(t(r),[...n.get(t(r))??[],r]);return[...n]}function gp({annotations:e}){let t=e??{};return t.readOnlyHint===!0?(0,Y.jsx)(`span`,{"data-slot":`mcp-api-effect`,className:`font-medium text-foreground`,children:`Read-only`}):(0,Y.jsxs)(`span`,{"data-slot":`mcp-api-effect`,className:`flex flex-wrap gap-x-3`,children:[t.readOnlyHint===!1?(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,children:`Changes project state`}):(0,Y.jsxs)(`span`,{className:`font-medium text-foreground`,children:[`Read-only: not stated `,(0,Y.jsx)(`span`,{className:`font-normal text-muted-foreground`,children:`– clients assume it may change state`})]}),t.destructiveHint===!1?null:(0,Y.jsxs)(`span`,{className:`font-medium text-warning`,children:[t.destructiveHint===!0?`Destructive`:`Destructive: not stated`,` `,(0,Y.jsx)(`span`,{className:`font-normal text-muted-foreground`,children:t.destructiveHint===!0?`– may delete or overwrite`:`– clients assume it may delete or overwrite`})]})]})}function _p(e,t){let n=e?.[t],r=e?.readOnlyHint===!0;return(t===`destructiveHint`||t===`idempotentHint`)&&r?`not applicable (read-only)`:n===!0?`yes`:n===!1?`no`:`not stated – clients assume ${t===`destructiveHint`||t===`openWorldHint`?`yes`:`no`}`}function vp({tool:e,name:t,guard:n,performing:r}){return t in(up(e.inputSchema.properties)?e.inputSchema.properties:{})?n?n.everyCall?(0,Y.jsx)(Y.Fragment,{children:`required on every call`}):n.requiredBy.length===0?(0,Y.jsx)(Y.Fragment,{children:pp(e)?`optional for every action`:`optional`}):(0,Y.jsxs)(Y.Fragment,{children:[`required by `,n.requiredBy.length,` of `,dp(r,`action`),`:`,` `,n.requiredBy.map((e,t)=>(0,Y.jsxs)(`span`,{children:[t?`, `:``,(0,Y.jsx)(`code`,{className:`font-mono break-words text-foreground`,children:e})]},e))]}):(0,Y.jsx)(Y.Fragment,{children:`optional in the schema – which actions need it is not stated`}):(0,Y.jsx)(Y.Fragment,{children:`not taken`})}var yp=class extends Error{},bp=[`$ref`,`oneOf`,`allOf`,`not`,`if`,`patternProperties`];function xp(e){if(!up(e))throw new yp(`a schema that is not an object`);for(let t of bp)if(t in e)throw new yp(t);if(Array.isArray(e.anyOf))return e.anyOf.map(xp).join(` or `);if(`const`in e)return`exactly ${JSON.stringify(e.const)}`;if(Array.isArray(e.enum))return`one of the values below`;let t=e.type;if(Array.isArray(t))return t.map(t=>xp({...e,type:t})).join(` or `);switch(t){case`string`:return`text`;case`integer`:return`whole number`;case`number`:return`number`;case`boolean`:return`yes/no`;case`null`:return`nothing (null)`;case`array`:return e.items===void 0?`list`:`list of ${xp(e.items)}`;case`object`:return up(e.properties)?`object – ${dp(Object.keys(e.properties).length,`field`)}`:up(e.additionalProperties)?`map of text to ${xp(e.additionalProperties)}`:`object`;case void 0:return Object.keys(e).every(e=>e===`description`||e==="default")?`any value`:Sp(e);default:return Sp(e)}}function Sp(e){throw new yp(`type ${JSON.stringify(e.type)}`)}function Cp(e,t){return up(e.properties)?[{schema:e,prefix:`${t}.`}]:e.type===`array`&&up(e.items)?Cp(e.items,`${t}[]`):Array.isArray(e.anyOf)?e.anyOf.filter(up).flatMap(e=>Cp(e,t)):[]}function wp(e,t,n){let r=up(t)&&Array.isArray(t.enum)?t.enum.map(e=>String(e)):null,i=up(t)&&typeof t.description==`string`?t.description:null;return{path:e,required:n,type:xp(t),values:r,description:i}}function Tp(e,t){return up(e)?Cp(e,t).flatMap(({schema:e,prefix:t})=>{let n=e.properties,r=Array.isArray(e.required)?e.required:[];return Object.entries(n).flatMap(([e,n])=>[wp(`${t}${e}`,n,r.includes(e)),...Tp(n,`${t}${e}`)])}):[]}function Ep({tool:e,discriminator:t,refusedArguments:n}){let r=e.inputSchema;if(r.type!==`object`)throw new yp(`a top level that is not an object`);for(let e of bp)if(e in r)throw new yp(e);let i=up(r.properties)?r.properties:{},a=Array.isArray(r.required)?r.required:[],o=new Set(n.map(e=>e.argument)),s=Object.keys(i).filter(e=>!o.has(e));if(s.length===0&&o.size===0)return(0,Y.jsx)(`p`,{"data-slot":`mcp-api-no-arguments`,className:`text-[13px] text-muted-foreground`,children:`Takes no arguments.`});let c=[...s.filter(e=>a.includes(e)),...s.filter(e=>!a.includes(e))].map(e=>({row:wp(e,i[e],a.includes(e)),nested:Tp(i[e],e)}));return(0,Y.jsxs)(`ul`,{"aria-label":`Arguments of ${e.name}`,className:`flex flex-col gap-2`,children:[c.map(({row:e,nested:n})=>(0,Y.jsxs)(`li`,{"data-slot":`mcp-api-argument`,className:`rounded-md border border-border bg-card p-2.5`,children:[(0,Y.jsx)(Dp,{row:e,discriminator:t?.name===e.path?t:null}),n.length?(0,Y.jsxs)(`details`,{className:`mt-2`,children:[(0,Y.jsxs)(`summary`,{className:`cursor-pointer rounded-sm text-[12px] font-medium text-foreground ${op}`,children:[`Its `,dp(n.length,`nested field`)]}),(0,Y.jsx)(`ul`,{className:`mt-2 flex flex-col gap-2 border-l border-border pl-3`,children:n.map(e=>(0,Y.jsx)(`li`,{"data-slot":`mcp-api-nested-argument`,children:(0,Y.jsx)(Dp,{row:e,discriminator:null})},e.path))})]}):null]},e.path)),n.map(e=>(0,Y.jsxs)(`li`,{"data-slot":`mcp-api-refused-argument`,className:`rounded-md border border-border bg-muted p-2.5 text-[13px]`,children:[(0,Y.jsx)(`span`,{className:`font-mono break-all text-foreground`,children:e.argument}),` `,(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,children:`Refused – never accepted.`}),` `,(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e.reason})]},e.argument))]})}function Dp({row:e,discriminator:t}){return(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1 text-[13px]`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2 gap-y-0.5`,children:[(0,Y.jsx)(`span`,{className:`font-mono font-medium break-all text-foreground`,children:e.path}),(0,Y.jsx)(`span`,{className:`text-[12px] font-medium text-foreground`,children:e.required?`Required`:`Optional`}),(0,Y.jsx)(`span`,{className:`text-[12px] text-muted-foreground`,children:t?`text`:e.type})]}),e.description===null?null:(0,Y.jsx)(`p`,{"data-slot":`mcp-api-description`,className:`leading-relaxed whitespace-pre-line text-muted-foreground`,children:e.description}),t?(0,Y.jsxs)(`p`,{className:`text-muted-foreground`,children:[`One of the `,dp(t.values.length,`action`),` above.`]}):e.values?(0,Y.jsx)(Op,{values:e.values}):null]})}function Op({values:e}){let[t,n]=(0,J.useState)(!1);return(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[(t?e:e.slice(0,ip)).map(e=>(0,Y.jsx)(`code`,{className:`rounded bg-muted px-1 font-mono text-[12px] break-all text-foreground`,children:e},e)),e.length>ip?(0,Y.jsx)(`button`,{type:`button`,"aria-expanded":t,onClick:()=>n(!t),className:`text-[12px] font-medium text-foreground ${sp}`,children:t?`Show the first ${ip}`:`Show all ${e.length} values`}):null]})}var kp=class extends J.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?this.props.fallback:this.props.children}};function Ap({tool:e,open:t=!1}){return(0,Y.jsxs)(`details`,{open:t,"data-slot":`mcp-api-raw-schema`,children:[(0,Y.jsx)(`summary`,{className:`cursor-pointer rounded-sm text-[12px] font-medium text-foreground ${op}`,children:`JSON Schema`}),(0,Y.jsx)(`div`,{className:`mt-2 max-w-full overflow-x-auto rounded-md border border-border bg-muted`,children:(0,Y.jsx)(`pre`,{className:`p-3 font-mono text-[11px] leading-relaxed break-all whitespace-pre-wrap text-foreground`,children:JSON.stringify(e.inputSchema,null,2)})})]})}function jp({names:e,label:t,slot:n}){return(0,Y.jsx)(`ul`,{"aria-label":t,className:`flex flex-wrap gap-x-3 gap-y-1 text-[13px]`,children:e.map(e=>(0,Y.jsx)(`li`,{"data-slot":n,children:(0,Y.jsx)(`code`,{className:`font-mono break-words text-foreground`,children:e})},e))})}function Mp({tool:e,refusedActions:t,refusedArguments:n,guards:r}){let i=(0,J.useRef)(null),a=pp(e),o=new Set(t.map(e=>e.action)),s=a?a.values.filter(e=>!o.has(e)):[],c=a?s.length:1,l=e.annotations,u=e=>r.find(t=>t.argument===e),d=(0,Y.jsxs)(`div`,{"data-slot":`mcp-api-unsupported`,className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`p`,{className:`text-[13px] text-foreground`,children:`This schema uses a form the page does not lay out as a table. The exact schema is below.`}),(0,Y.jsx)(Ap,{tool:e,open:!0})]});return(0,Y.jsxs)(`details`,{ref:i,id:`tool-${e.name}`,"data-slot":`mcp-api-tool`,className:`group scroll-mt-4 rounded-md border border-border bg-card`,children:[(0,Y.jsxs)(`summary`,{className:`cursor-pointer list-none rounded-md p-3 ${op}`,children:[(0,Y.jsxs)(`h3`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-2 text-sm`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`text-soft-foreground group-open:rotate-90`,children:`›`}),(0,Y.jsx)(`span`,{className:`font-mono font-semibold break-all text-foreground`,children:e.name}),e.title?(0,Y.jsx)(`span`,{className:`font-normal text-muted-foreground`,children:e.title}):null]}),(0,Y.jsxs)(`span`,{className:`mt-1 flex flex-col gap-0.5 text-[12px] sm:flex-row sm:flex-wrap sm:gap-x-3`,children:[(0,Y.jsx)(gp,{annotations:l}),(0,Y.jsxs)(`span`,{"data-slot":`mcp-api-counts`,className:`text-muted-foreground`,children:[dp(c,`action`),o.size?`, ${o.size} refused`:``]})]})]}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4 border-t border-border p-3`,children:[(0,Y.jsx)(`p`,{"data-slot":`mcp-api-purpose`,className:`text-[13px] leading-relaxed whitespace-pre-line text-foreground`,children:e.description}),(0,Y.jsxs)(`dl`,{className:`grid grid-cols-1 gap-x-4 gap-y-1 text-[12px] sm:grid-cols-2`,children:[[[`Read-only`,`readOnlyHint`],[`Destructive`,`destructiveHint`],[`Idempotent`,`idempotentHint`],[`Open world`,`openWorldHint`]].map(([e,t])=>(0,Y.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,Y.jsxs)(`dt`,{className:`font-medium text-foreground`,children:[e,`:`]}),(0,Y.jsx)(`dd`,{className:`text-muted-foreground`,children:_p(l,t)})]},t)),[[`expectedVersion`,`mcp-api-expected-version`],[`operationId`,`mcp-api-operation-id`]].map(([t,n])=>(0,Y.jsxs)(`div`,{className:`flex gap-1.5 sm:col-span-2`,children:[(0,Y.jsxs)(`dt`,{className:`shrink-0 font-mono font-medium text-foreground`,children:[t,`:`]}),(0,Y.jsx)(`dd`,{"data-slot":n,className:`min-w-0 text-muted-foreground`,children:(0,Y.jsx)(vp,{tool:e,name:t,guard:u(t),performing:c})})]},t))]}),a?(0,Y.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`h4`,{className:`text-[13px] font-semibold text-foreground`,children:[`Actions `,(0,Y.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[`(the `,(0,Y.jsx)(`code`,{className:`font-mono`,children:a.name}),` argument)`]})]}),(0,Y.jsx)(`p`,{"data-slot":`mcp-api-action-effects`,className:`text-[12px] leading-relaxed text-muted-foreground`,children:mp(l)===`read-only`?`The tool states it is read-only, so every action reads.`:`Which of these actions change state is not declared yet. The description above is the source.`}),s.length?(0,Y.jsx)(jp,{names:s,label:`Actions of ${e.name}`,slot:`mcp-api-action`}):null,t.length?(0,Y.jsxs)(`div`,{"data-slot":`mcp-api-refused-actions`,className:`flex flex-col gap-1 text-[13px]`,children:[(0,Y.jsx)(`h5`,{className:`font-medium text-foreground`,children:`Refused, whatever else is sent`}),hp(t,e=>e.boundary).map(([e,t])=>(0,Y.jsxs)(`p`,{className:`text-muted-foreground`,children:[(0,Y.jsxs)(`span`,{className:`text-foreground`,children:[fp(e),`:`]}),` `,t.map((e,t)=>(0,Y.jsxs)(`span`,{children:[t?`, `:``,(0,Y.jsx)(`code`,{className:`font-mono break-words text-foreground`,children:e.action})]},e.action))]},e)),(0,Y.jsxs)(`p`,{className:`text-[12px] text-muted-foreground`,children:[`Why each is refused:`,` `,(0,Y.jsx)(`a`,{href:`#mcp-refusals`,className:sp,children:`What this server will not do`}),`.`]})]}):null]}):null,(0,Y.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`h4`,{className:`text-[13px] font-semibold text-foreground`,children:`Arguments`}),(0,Y.jsx)(kp,{fallback:d,children:(0,Y.jsx)(Ep,{tool:e,discriminator:a,refusedArguments:n})})]}),(0,Y.jsx)(Ap,{tool:e}),(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>{let e=i.current;e&&(e.open=!1,e.querySelector(`summary`)?.focus())},className:`self-start text-[12px] font-medium text-foreground ${sp}`,children:[`Close `,e.name]})]})]})}var Np=[{value:`all`,label:`All`},{value:`changes`,label:`Changes project state`},{value:`read-only`,label:`Read-only`}];function Pp({names:e}){return(0,Y.jsx)(Y.Fragment,{children:e.map((e,t)=>(0,Y.jsxs)(`span`,{children:[t?`, `:``,(0,Y.jsx)(`a`,{href:`#tool-${e}`,className:`font-mono break-words ${sp}`,children:e})]},e))})}function Fp({reference:e}){let[t,n]=(0,J.useState)(`all`),r=(0,J.useRef)(null),{hash:i}=c(),a=e.tools,o=t===`all`?a:a.filter(e=>mp(e.annotations)===t);(0,J.useEffect)(()=>{if(!i.startsWith(`#tool-`))return;n(`all`);let e=decodeURIComponent(i.slice(1)),t=requestAnimationFrame(()=>{let t=document.getElementById(e);t instanceof HTMLDetailsElement&&(t.open=!0,t.querySelector(`summary`)?.focus())});return()=>cancelAnimationFrame(t)},[i]);let s=e=>{r.current?.querySelectorAll(`details[data-slot="mcp-api-tool"]`).forEach(t=>{t.open=e})},l=a.reduce((e,t)=>e+(pp(t)?.values.length??1),0),u=e.refusedActions.length,d=a.filter(e=>mp(e.annotations)===`changes`),f=d.filter(e=>e.annotations?.destructiveHint===!0).map(e=>e.name),p=d.filter(e=>e.annotations?.destructiveHint===void 0).map(e=>e.name),m=d.filter(e=>e.annotations?.readOnlyHint===void 0).map(e=>e.name),h=a.filter(e=>mp(e.annotations)===`read-only`).map(e=>e.name),g=a.every(e=>e.name===`health`),_=hp(e.refusedActions,e=>e.boundary);return(0,Y.jsxs)(`div`,{"data-slot":`mcp-api-section`,className:`mx-auto flex w-full max-w-3xl min-w-0 flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,Y.jsxs)(`header`,{"data-slot":`mcp-api-header`,className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`xezar MCP server`}),(0,Y.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[`Version `,(0,Y.jsx)(`span`,{className:`font-mono`,children:e.xezarVersion}),` · MCP protocol revisions`,` `,e.protocolVersions.map((e,t)=>(0,Y.jsxs)(`span`,{children:[t?`, `:``,(0,Y.jsx)(`span`,{className:`font-mono`,children:e})]},e))]}),(0,Y.jsxs)(`div`,{"data-slot":`mcp-api-read-only`,className:`text-[13px] leading-relaxed text-foreground`,children:[(0,Y.jsxs)(`p`,{children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`Read-only by design:`}),` running a tool from here would make the cockpit a second leader on this project, and a project has exactly one. No tool call is ever sent from this page.`]}),(0,Y.jsxs)(`details`,{className:`mt-1`,children:[(0,Y.jsx)(`summary`,{className:`cursor-pointer rounded-sm text-[12px] font-medium ${op}`,children:`Why?`}),(0,Y.jsxs)(`ul`,{className:`mt-2 flex list-disc flex-col gap-1 pl-5 text-muted-foreground`,children:[(0,Y.jsx)(`li`,{children:`One owner: exactly one MCP client may own a project; a call from here would take over the leader or act beside it as a second owner.`}),(0,Y.jsx)(`li`,{children:`Session binding: a session is bound to one project and fenced by its owner; the cockpit is not that session.`}),(0,Y.jsx)(`li`,{children:`Honest records: the audit trail records which door a call came through, so a call from here would be recorded as the leader’s act when a person did it.`})]})]})]}),(0,Y.jsxs)(`p`,{className:`text-[12px] text-muted-foreground`,children:[`Connection and client setup live in `,(0,Y.jsx)(lp,{children:`MCP connection`}),`.`]})]}),(0,Y.jsxs)(`section`,{"aria-labelledby":`mcp-api-summary-title`,className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`h2`,{id:`mcp-api-summary-title`,className:`text-sm font-semibold text-foreground`,children:`Summary`}),(0,Y.jsxs)(`ul`,{"data-slot":`mcp-api-summary`,className:`flex list-disc flex-col gap-1 pl-5 text-[13px] leading-relaxed text-foreground`,children:[g?(0,Y.jsx)(`li`,{children:`This server lists no tools besides health.`}):(0,Y.jsxs)(`li`,{children:[dp(a.length,`tool`),`, `,dp(l-u,`action`),`, and`,` `,dp(u,`action`),` that `,u===1?`is`:`are`,` always refused.`]}),d.length?(0,Y.jsxs)(`li`,{"data-slot":`mcp-api-summary-changing`,children:[`Can change project state: `,(0,Y.jsx)(Pp,{names:d.map(e=>e.name)}),`.`,f.length?(0,Y.jsxs)(Y.Fragment,{children:[` `,`Of these, `,f.length===1?`the tool that states it`:`the tools that state they`,` may delete or overwrite: `,(0,Y.jsx)(Pp,{names:f}),`.`]}):null,p.length?(0,Y.jsxs)(Y.Fragment,{children:[` `,`Not stated whether destructive, so clients assume `,p.length===1?`it may`:`they may`,` delete or overwrite: `,(0,Y.jsx)(Pp,{names:p}),`.`]}):null]}):null,m.length?(0,Y.jsxs)(`li`,{"data-slot":`mcp-api-summary-unstated`,children:[`Not stated whether read-only, so clients assume `,m.length===1?`it`:`they`,` may change state:`,` `,(0,Y.jsx)(Pp,{names:m}),`.`]}):null,h.length?(0,Y.jsxs)(`li`,{"data-slot":`mcp-api-summary-read-only`,children:[`Read-only: `,(0,Y.jsx)(Pp,{names:h}),`.`]}):null,(0,Y.jsxs)(`li`,{children:[`What it will not do: `,dp(e.notExposed.length,`thing`),` never exposed,`,` `,dp(u,`action`),` and `,dp(e.refusedArguments.length,`argument`),` always refused –`,` `,(0,Y.jsx)(`a`,{href:`#mcp-refusals`,className:sp,children:`see the refusals`}),`.`]}),(0,Y.jsxs)(`li`,{"data-slot":`mcp-api-summary-coverage`,children:[`Cockpit coverage is not shown on this page –`,` `,(0,Y.jsx)(`a`,{href:`#mcp-coverage`,className:sp,children:`where it is recorded`}),`.`]})]})]}),(0,Y.jsxs)(`section`,{"aria-labelledby":`mcp-api-tools-title`,className:`flex min-w-0 flex-col gap-3`,children:[(0,Y.jsx)(`h2`,{id:`mcp-api-tools-title`,className:`text-sm font-semibold text-foreground`,children:`Tools`}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center sm:justify-between`,children:[(0,Y.jsxs)(`fieldset`,{className:`flex flex-wrap gap-x-3 gap-y-1 text-[13px]`,children:[(0,Y.jsx)(`legend`,{className:`sr-only`,children:`Show tools by effect`}),Np.map(e=>(0,Y.jsxs)(`label`,{className:`flex items-center gap-1.5 text-foreground`,children:[(0,Y.jsx)(`input`,{type:`radio`,name:`mcp-api-effect-filter`,value:e.value,checked:t===e.value,onChange:()=>n(e.value),className:op}),e.label]},e.value))]}),(0,Y.jsxs)(`div`,{className:`flex gap-3 text-[12px]`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:()=>s(!0),className:`font-medium ${sp}`,children:`Expand all`}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>s(!1),className:`font-medium ${sp}`,children:`Collapse all`})]})]}),(0,Y.jsxs)(`p`,{"data-slot":`mcp-api-filter-status`,role:`status`,"aria-live":`polite`,className:`text-[12px] text-muted-foreground`,children:[`Showing `,o.length,` of `,dp(a.length,`tool`),`.`]}),o.length?(0,Y.jsx)(`ul`,{ref:r,"aria-label":`MCP tools`,className:`flex min-w-0 flex-col gap-2`,children:o.map(t=>(0,Y.jsx)(`li`,{className:`min-w-0`,children:(0,Y.jsx)(Mp,{tool:t,refusedActions:e.refusedActions.filter(e=>e.tool===t.name),refusedArguments:e.refusedArguments.filter(e=>e.tool===t.name),guards:e.guards.filter(e=>e.tool===t.name)})},t.name))}):(0,Y.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`No tools match this filter.`})]}),(0,Y.jsxs)(`section`,{id:`mcp-refusals`,"aria-labelledby":`mcp-api-refusals-title`,className:`flex scroll-mt-4 flex-col gap-3`,children:[(0,Y.jsx)(`h2`,{id:`mcp-api-refusals-title`,className:`text-sm font-semibold text-foreground`,children:`What this server will not do`}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:`Never exposed`}),(0,Y.jsx)(`ul`,{"data-slot":`mcp-api-not-exposed`,className:`flex list-disc flex-col gap-1 pl-5 text-[13px] leading-relaxed`,children:e.notExposed.map(e=>(0,Y.jsxs)(`li`,{className:`text-foreground`,children:[(0,Y.jsxs)(`span`,{className:`font-medium`,children:[e.what,`.`]}),` `,(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e.detail}),` `,(0,Y.jsxs)(`span`,{className:`text-soft-foreground`,children:[`(`,e.forbiddenBy.join(`, `),`)`]})]},e.what))})]}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:`Always refused`}),_.length||e.refusedArguments.length?(0,Y.jsxs)(`div`,{"data-slot":`mcp-api-always-refused`,className:`flex flex-col gap-3`,children:[_.map(([e,t])=>(0,Y.jsxs)(`div`,{"data-slot":`mcp-api-boundary`,className:`flex flex-col gap-1`,children:[(0,Y.jsx)(`h4`,{className:`text-[13px] font-medium text-foreground`,children:fp(e)}),(0,Y.jsx)(`ul`,{className:`flex list-disc flex-col gap-1 pl-5 text-[13px] leading-relaxed`,children:t.map(e=>(0,Y.jsxs)(`li`,{className:`text-foreground`,children:[(0,Y.jsx)(`code`,{className:`font-mono break-words`,children:e.tool}),` action `,(0,Y.jsx)(`code`,{className:`font-mono break-words`,children:e.action}),`:`,` `,(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e.reason})]},`${e.tool}:${e.action}`))})]},e)),e.refusedArguments.length?(0,Y.jsxs)(`div`,{"data-slot":`mcp-api-boundary`,className:`flex flex-col gap-1`,children:[(0,Y.jsx)(`h4`,{className:`text-[13px] font-medium text-foreground`,children:`Arguments`}),(0,Y.jsx)(`ul`,{className:`flex list-disc flex-col gap-1 pl-5 text-[13px] leading-relaxed`,children:e.refusedArguments.map(e=>(0,Y.jsxs)(`li`,{className:`text-foreground`,children:[(0,Y.jsx)(`code`,{className:`font-mono break-words`,children:e.tool}),` argument `,(0,Y.jsx)(`code`,{className:`font-mono break-words`,children:e.argument}),`:`,` `,(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e.reason})]},`${e.tool}:${e.argument}`))})]}):null]}):(0,Y.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`No action or argument is refused on principle.`})]}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:`Refused at call time`}),(0,Y.jsxs)(`p`,{className:`text-[13px] leading-relaxed text-muted-foreground`,children:[`Some refusals depend on the state at the moment of the call – a stale `,(0,Y.jsx)(`code`,{className:`font-mono`,children:`expectedVersion`}),` `,`answered as a conflict, or a second client refused because the project already has an owner. They arrive as tool results; each tool’s description above says how.`]})]})]}),(0,Y.jsxs)(`section`,{id:`mcp-coverage`,"aria-labelledby":`mcp-api-coverage-title`,className:`flex scroll-mt-4 flex-col gap-2`,children:[(0,Y.jsx)(`h2`,{id:`mcp-api-coverage-title`,className:`text-sm font-semibold text-foreground`,children:`Cockpit coverage`}),(0,Y.jsxs)(`p`,{"data-slot":`mcp-api-coverage`,className:`text-[13px] leading-relaxed text-muted-foreground`,children:[`This page does not show which cockpit actions each tool covers yet. The record-by-record mapping is in`,` `,(0,Y.jsx)(`code`,{className:`font-mono break-words text-foreground`,children:rp}),`, under “Traceability”, and`,` `,(0,Y.jsx)(`code`,{className:`font-mono`,children:`npm test`}),` holds it to the registry.`]})]})]})}var Ip={accepted:`Accepted`,running:`Running`,completed:`Completed`,failed:`Failed`,conflict:`Conflict — not applied`,unverified:`Outcome being verified`},Lp=new Set([`conflict`,`unverified`,`failed`]);function Rp({status:e}){switch(e){case`completed`:return(0,Y.jsx)(Zn,{"aria-hidden":`true`,className:`size-4 shrink-0 text-primary`});case`failed`:case`conflict`:return(0,Y.jsx)($n,{"aria-hidden":`true`,className:`size-4 shrink-0 text-danger`});case`unverified`:return(0,Y.jsx)(si,{"aria-hidden":`true`,className:`size-4 shrink-0 text-warning`});default:return(0,Y.jsx)(Ir,{"aria-hidden":`true`,className:`size-4 shrink-0 text-soft-foreground`})}}function zp(e){switch(e.status){case`accepted`:return`The operation was accepted and is being processed. This is an acknowledgement, not a completion — the result is not known yet.`;case`running`:return`The operation is running.`;case`completed`:return`The operation completed.`;case`failed`:return`The operation was accepted and ran, but failed after execution. Re-read the current state before deciding again — the operation was applied, so treat it as applied, not as never attempted.`;case`conflict`:return`The operation was NOT applied — the resource changed after it was read. Nothing was overwritten. Re-read the current state before deciding again.`;case`unverified`:return`The outcome is uncertain and is being verified. Read the current state to determine what happened; a new operation id is a new action.`}}function Bp(e){return e.status===`conflict`}function Vp({operation:e,onRetry:t}){let n=Ip[e.status],r=zp(e),i=Bp(e),a=t!==void 0&&Lp.has(e.status);return(0,Y.jsxs)(`div`,{"data-testid":`mcp-operation-feedback`,className:`rounded-md border border-border bg-card p-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(Rp,{status:e.status}),(0,Y.jsx)(`span`,{"data-testid":`mcp-operation-label`,className:`text-sm font-medium text-foreground`,children:n})]}),e.lastKnown?(0,Y.jsx)(`span`,{"data-testid":`mcp-operation-last-known`,className:`rounded-sm bg-muted px-2 py-0.5 text-[11px] font-medium text-soft-foreground`,children:`Last known state — connection reconnecting`}):null]}),(0,Y.jsxs)(`p`,{className:`mt-2 font-mono text-[11px] break-all text-soft-foreground`,children:[e.action,` · `,e.operationId]}),(0,Y.jsx)(`p`,{"data-testid":`mcp-operation-copy`,className:`mt-2 text-[13px] leading-relaxed text-foreground`,children:r}),e.retried?(0,Y.jsx)(`p`,{"data-testid":`mcp-operation-retried`,className:`mt-2 text-[12px] text-muted-foreground`,children:`Retried with the same operation identity — this is the original or current outcome, not a new action.`}):null,i?(0,Y.jsx)(`p`,{"data-testid":`mcp-operation-reread`,className:`mt-2 text-[12px] text-muted-foreground`,children:`The leader must re-read the current state before deciding again.`}):null,e.status===`unverified`?(0,Y.jsx)(`p`,{"data-testid":`mcp-operation-new-key`,className:`mt-2 text-[12px] text-muted-foreground`,children:`Do not blindly repeat this with a new key — read the current state first.`}):null,a?(0,Y.jsxs)(`button`,{type:`button`,"data-testid":`mcp-operation-retry`,className:`mt-3 inline-flex items-center gap-1.5 rounded-md border border-border px-2.5 py-1.5 text-[12px] font-medium text-foreground hover:bg-muted`,"aria-label":`Retry operation ${e.operationId} — reuses the same operation identity`,onClick:()=>t?.(e.operationId),children:[(0,Y.jsx)(To,{"aria-hidden":`true`,className:`size-3.5`}),`Retry`]}):null]})}function $({title:e,hint:t,children:n}){return(0,Y.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,Y.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}var Hp={available:`Available`,unavailable:`Unavailable`,"read-only":`Read-only`},Up=new Set([`claude`,`codex`,`opencode`,`pi`]);function Wp(e){return e.repo?e.forge?e.forge.available===!0?null:e.forge.available===void 0?{reason:`GitHub availability has not been checked yet.`,next:`Wait a few seconds; this page updates when the check finishes.`}:{reason:`The GitHub CLI (gh) cannot reach this repository on GitHub.`,next:"A person can install gh and run `gh auth login` on this machine."}:{reason:`This repository has no GitHub remote.`,next:`A person can add a github.com remote to the repository.`}:{reason:`This project is not a git repository, so it has no GitHub remote.`,next:`A person can run the project from a git clone of a GitHub repository.`}}function Gp(e,t,n){return n?{id:e,label:t,status:`available`,detail:n}:{id:e,label:t,status:`available`}}function Kp(e,t,n,r){return n?{id:e,label:t,status:`unavailable`,...n}:Gp(e,t,r)}var qp={reason:`This xezar is not running in local mode, so actions on the host machine are refused.`,next:`A person can run the cockpit locally on this machine.`},Jp={reason:`This project is not a git repository, so tasks run in place, one at a time.`,next:`A person can run the project from a git repository.`};function Yp({health:e,modelsLocked:t}){let n=e.capabilities,r=e.repo!==null,i=e.checks.filter(e=>Up.has(e.name)),a=i.length>0&&!i.some(e=>e.available),o=Wp(e);return[Kp(`create_task`,`Start, continue and cancel tasks`,a?{reason:`No coding agent CLI is installed on this machine.`,next:`A person can install Claude Code, Codex, OpenCode or pi. The Tools menu shows what xezar found.`}:null),Gp(`delete_task`,`Delete a task, its worktree and its branch`,`Destructive and irreversible. Part of full project authority, with no extra confirmation step.`),Kp(`parallel_variants`,`Run a task as parallel variants`,r?null:Jp),Kp(`worktree_choice`,`Choose a worktree or in-place for a task`,r?null:Jp),Kp(`git_handoff`,`Commit and push a task’s branch`,r?null:Jp),Kp(`github`,`GitHub issues, pull requests, draft PRs and merging`,o,`Merging is part of full project authority. Every branch, review and check rule still applies.`),Kp(`automations`,`GitHub automations`,n.automations?o:{reason:`GitHub automations are off on this xezar.`,next:`A person can start xezar with XEZ_AUTOMATIONS=1 to turn them on.`}),Kp(`inbox`,`Follow-up inbox`,n.followups?null:{reason:`The follow-up inbox is off for this workspace.`,next:`A person can turn it on in Global settings, or start xezar with XEZ_FOLLOWUPS=1.`}),t?{id:`model_selection`,label:`Choose a task model`,status:`read-only`,reason:`Models are locked: each coding agent uses the model from its own settings.`,next:`Only a person can change that, with XEZ_AGENT_MODELS_LOCKED or modelsLocked in xezar’s config.`}:Gp(`model_selection`,`Choose a task model`),Kp(`open_in_app`,`Open the project or a task in a desktop app`,n.localHandoff?null:qp),Kp(`agent_config_write`,`Edit the coding agents’ config files`,n.localHandoff?null:{...qp,reason:`${qp.reason} Agent config files can define hooks and commands.`}),Gp(`project_settings`,`Change this project’s settings`)]}function Xp(e){return e===1?`1 minute`:`${e} minutes`}function Zp(e){return e?`On`:`Off`}function Qp(e,t={}){let n=e.resources,r=typeof t.memoryLimitMb==`number`&&t.memoryLimitMb>0?`${t.memoryLimitMb} MiB (this project)`:n.memoryLimitMb&&n.memoryLimitMb>0?`${n.memoryLimitMb} MiB`:`No limit`,i=e.composerDefaults.autonomous??e.composerDefaults.inheritedAutonomous,a=e.composerDefaults.worktree??e.composerDefaults.inheritedWorktree;return[{id:`max_parallel`,label:`Tasks running at once`,value:t.maxParallel===void 0?`${n.maxParallel} across all projects`:`${t.maxParallel} (this project; ${n.maxParallel} across all projects)`},{id:`memory_limit`,label:`Memory per task`,value:r},{id:`monitoring_sessions`,label:`Background monitoring sessions`,value:String(n.maxMonitoringSessions)},{id:`monitoring_wake`,label:`Wake a parked session`,value:n.monitoringWakeIntervalMinutes===null?`Never — a parked session stays parked`:`Every ${Xp(n.monitoringWakeIntervalMinutes)}`},{id:`auto_resume`,label:`Resume after a usage limit`,value:Zp(n.autoResumeOnUsageLimit)},{id:`idle_timeout`,label:`Close an idle session`,value:n.idleTimeoutMinutes===null?`Never`:`After ${Xp(n.idleTimeoutMinutes)}`},{id:`default_autonomous`,label:`Autonomous, when the leader does not say`,value:i===`source-dependent`?`Depends on how the task is started`:Zp(i)},{id:`default_worktree`,label:`Worktree, when the leader does not say`,value:Zp(a)}]}function $p(e){let t=[];for(let n of e)if(!n.archived)for(let e of n.steps)e.kind===`check`&&e.status===`failed`&&t.push({runId:n.id,title:n.title,step:e.name});return t}function em({status:e}){return e===`available`?(0,Y.jsx)(Zn,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-success`}):e===`read-only`?(0,Y.jsx)(mo,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-soft-foreground`}):(0,Y.jsx)($n,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-warning`})}function tm({children:e}){return(0,Y.jsx)(`span`,{"data-slot":`mcp-capability-status`,className:`shrink-0 rounded-sm border border-border px-1.5 py-0.5 text-[11px] font-medium text-foreground`,children:e})}function nm({capability:e}){return(0,Y.jsxs)(`li`,{"data-slot":`mcp-capability`,"data-capability":e.id,"data-status":e.status,className:`flex min-w-0 items-start gap-2.5 px-3 py-2.5`,children:[(0,Y.jsx)(em,{status:e.status}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,Y.jsx)(`span`,{className:`text-[13px] font-medium break-words text-foreground`,children:e.label}),(0,Y.jsx)(tm,{children:Hp[e.status]})]}),e.status===`available`?e.detail?(0,Y.jsx)(`p`,{className:`mt-1 text-[12px] leading-relaxed break-words text-muted-foreground`,children:e.detail}):null:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{"data-slot":`mcp-capability-reason`,className:`mt-1 text-[12px] leading-relaxed break-words text-foreground`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`Why: `}),e.reason]}),(0,Y.jsxs)(`p`,{"data-slot":`mcp-capability-next`,className:`mt-0.5 text-[12px] leading-relaxed break-words text-muted-foreground`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,children:`Next: `}),e.next]})]})]})]})}function rm({capabilities:e,constraints:t,failingChecks:n,errors:r={}}){return(0,Y.jsxs)(`div`,{"data-slot":`mcp-capabilities`,className:`flex min-w-0 flex-col gap-7`,children:[(0,Y.jsx)($,{title:`What the leader can do`,hint:`Full authority over this project, including deleting tasks and merging. There are no roles or per-action permissions to set.`,children:r.capabilities?(0,Y.jsx)(am,{children:r.capabilities}):e===null?(0,Y.jsx)(im,{children:`Checking what this project supports…`}):(0,Y.jsx)(`ul`,{"data-slot":`mcp-capability-list`,"aria-label":`Project capabilities`,className:`divide-y divide-border rounded-md border border-border bg-card`,children:e.map(e=>(0,Y.jsx)(nm,{capability:e},e.id))})}),(0,Y.jsx)($,{title:`Shared limits`,hint:`Read-only. These are shared with every project on this machine. The leader works inside them and cannot change them; a person changes them in Global settings.`,children:r.constraints?(0,Y.jsx)(am,{children:r.constraints}):t===null?(0,Y.jsx)(im,{children:`Loading the shared limits…`}):(0,Y.jsx)(`dl`,{"data-slot":`mcp-constraint-list`,className:`divide-y divide-border rounded-md border border-border bg-card`,children:t.map(e=>(0,Y.jsxs)(`div`,{"data-slot":`mcp-constraint`,"data-constraint":e.id,className:`flex min-w-0 flex-wrap items-start justify-between gap-x-3 gap-y-1 px-3 py-2.5`,children:[(0,Y.jsxs)(`dt`,{className:`flex min-w-0 items-center gap-2 text-[13px] text-foreground`,children:[(0,Y.jsx)(mo,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-soft-foreground`}),(0,Y.jsx)(`span`,{className:`break-words`,children:e.label}),(0,Y.jsx)(tm,{children:`Read-only`})]}),(0,Y.jsx)(`dd`,{className:`min-w-0 text-[13px] font-medium break-words text-foreground`,children:e.value})]},e.id))})}),(0,Y.jsx)($,{title:`Quality checks`,hint:`Mandatory checks always run. A failing check stays visible until the task passes it. It cannot be dismissed, waived or accepted as an exception — not by the leader, and not by approval.`,children:(0,Y.jsx)(`div`,{"data-slot":`mcp-quality`,"aria-live":`polite`,className:`min-w-0`,children:r.checks?(0,Y.jsx)(am,{children:r.checks}):n===null?(0,Y.jsx)(im,{children:`Checking this project’s tasks…`}):n.length===0?(0,Y.jsxs)(`p`,{"data-slot":`mcp-quality-clear`,className:`rounded-md border border-border bg-card p-3 text-[13px] text-foreground`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`No failing checks.`}),` No open task in this project has a failing quality check right now.`]}):(0,Y.jsx)(`ul`,{"data-slot":`mcp-quality-failing`,"aria-label":`Failing quality checks`,className:`flex flex-col gap-2`,children:n.map(e=>(0,Y.jsxs)(`li`,{"data-slot":`mcp-quality-failure`,className:`rounded-md border border-danger/40 bg-card p-3`,children:[(0,Y.jsxs)(`p`,{className:`flex min-w-0 flex-wrap items-center gap-2 text-[13px] text-foreground`,children:[(0,Y.jsx)(si,{"aria-hidden":`true`,className:`size-4 shrink-0 text-danger`}),(0,Y.jsx)(`span`,{className:`font-semibold`,children:`Check failed:`}),(0,Y.jsx)(`span`,{className:`min-w-0 font-mono text-[12px] break-all`,children:e.step})]}),(0,Y.jsxs)(`p`,{className:`mt-1 text-[13px] break-words text-foreground`,children:[`Task: `,e.title]}),(0,Y.jsxs)(`p`,{className:`mt-1 text-[12px] leading-relaxed text-muted-foreground`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,children:`Next: `}),`fix the cause in the task and let the check run again. The task is not complete until it passes.`]}),(0,Y.jsxs)(K,{to:`/tasks/${e.runId}`,"data-slot":`mcp-quality-open`,className:`mt-2 inline-flex rounded-sm text-[12px] font-medium text-foreground underline underline-offset-2 outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[`Open task: `,e.title]})]},`${e.runId}:${e.step}`))})})})]})}function im({children:e}){return(0,Y.jsx)(`p`,{role:`status`,className:`rounded-md border border-border bg-card p-3 text-[13px] text-soft-foreground`,children:e})}function am({children:e}){return(0,Y.jsxs)(`p`,{"data-slot":`mcp-capabilities-error`,role:`alert`,className:`rounded-md border border-danger/40 bg-card p-3 text-[13px] break-words text-foreground`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`Could not load this part.`}),` `,e]})}function om(){let e=I(),t=tn(),n=re(),r=R(),i=b(),a=Ni()??e.data?.bootProject??null,o=r.data?.projects.find(e=>e.id===a);return(0,Y.jsx)(rm,{capabilities:e.data&&t.data?Yp({health:e.data,modelsLocked:t.data.modelsLocked}):null,constraints:n.data?Qp(n.data,{...o?.maxParallel===void 0?{}:{maxParallel:o.maxParallel},memoryLimitMb:t.data?.memoryLimitMb??null}):null,failingChecks:i.data?$p(i.data):null,errors:{...t.isError?{capabilities:t.error.message}:e.isError?{capabilities:e.error.message}:{},...n.isError?{constraints:n.error.message}:{},...i.isError?{checks:i.error.message}:{}}})}var sm={neutral:`border-border bg-card text-foreground`,primary:`border-primary/25 bg-primary/15 text-primary`,danger:`border-danger/20 bg-danger/15 text-danger`};function cm({icon:e,tone:t,title:n,copy:r,recovery:i,action:a,state:o}){return(0,Y.jsx)(`div`,{"data-slot":`mcp-connection-state`,"data-state":o,className:`rounded-md border border-border bg-card p-3`,children:(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Y.jsx)(`div`,{"data-slot":`mcp-connection-state-icon`,className:lm(t,e),"aria-hidden":`true`,children:e}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:n}),(0,Y.jsx)(`p`,{"data-slot":`mcp-connection-state-copy`,className:`mt-1 text-[13px] leading-relaxed text-foreground`,children:r}),i?(0,Y.jsx)(`p`,{"data-slot":`mcp-connection-state-recovery`,className:`mt-2 text-[13px] leading-relaxed text-muted-foreground`,children:i}):null,a?(0,Y.jsx)(`div`,{className:`mt-2`,children:a}):null]})]})})}function lm(e,t){return`flex size-10 shrink-0 items-center justify-center rounded-[10px] border [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-5 ${sm[e]}`}function um({state:e}){switch(e.kind){case`empty`:return(0,Y.jsx)(cm,{state:e.kind,icon:(0,Y.jsx)(Co,{}),tone:`neutral`,title:`Configuration not generated yet`,copy:`This project exists, but its MCP connection configuration has not been generated. xezar writes it automatically the first time the connection is used — you never have to invent connection data by hand.`,recovery:`Nothing to do here by hand. xezar generates the connection configuration automatically, and the one-time client setup below is the only step you take.`});case`loading`:return(0,Y.jsx)(cm,{state:e.kind,icon:(0,Y.jsx)(gt,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Discovering connection state`,copy:`Checking the connection state for this project. Confirmed capability values appear only once the server reports them — nothing is shown as confirmed before that.`,recovery:`This is bounded progress. If it stays here, reconnect the leader client to re-read current state.`});case`ready`:return(0,Y.jsx)(cm,{state:e.kind,icon:(0,Y.jsx)(Zn,{}),tone:`primary`,title:`Ready to connect`,copy:`No active MCP client owns this project right now. No model is running and no session is active yet.`,recovery:`Follow the one-time setup below to connect a leader client to this project.`});case`connecting`:return(0,Y.jsx)(cm,{state:e.kind,icon:(0,Y.jsx)(za,{}),tone:`neutral`,title:`Connecting`,copy:`The leader connection is being established. Establishing a connection is separate from starting a model: connecting does not mean a model is generating yet.`,recovery:`Repeated transport requests from the same client are not additional clients — one connection attempt may make several requests before it settles.`});case`active`:return(0,Y.jsx)(cm,{state:e.kind,icon:(0,Y.jsx)(gr,{}),tone:`primary`,title:`Connected`,copy:`An MCP client owns this project and its session is live. “Connected” means the owner and its session are live — not necessarily that the model is generating right now.`,recovery:`The cockpit can still mutate project state alongside it. If a task is idle, that does not mean the connection dropped.`});case`occupied`:return(0,Y.jsx)(cm,{state:e.kind,icon:(0,Y.jsx)(No,{}),tone:`danger`,title:`This project is occupied`,copy:`Another logical client already owns this project, so this second client was refused. This is not a server failure: the cockpit still works and any running tasks are unaffected.`,recovery:`The project becomes available automatically when the current owner disconnects or its session ends. There is no way to disconnect the other client or take over from here — connect again after it is released.`});case`waiting`:return(0,Y.jsx)(cm,{state:e.kind,icon:(0,Y.jsx)(oo,{}),tone:`neutral`,title:`Waiting on a decision`,copy:`A task may be waiting on a human decision without the MCP connection being disconnected. Occupancy does not change just because the model has been silent.`,recovery:e.task?`Answer the question on the task to continue.`:`Check the task for a question waiting on you.`,action:e.task?(0,Y.jsx)(M,{to:e.task.href,className:`inline-flex items-center gap-1 text-[13px] font-medium text-foreground underline underline-offset-4`,children:`Open the task`}):void 0});case`leader-paused`:return(0,Y.jsx)(cm,{state:e.kind,icon:(0,Y.jsx)(So,{}),tone:`neutral`,title:`Leader paused`,copy:`The leader client is paused. This is a leader state, not an MCP disconnect: pausing the leader does not release the connection.`,recovery:`Resume the leader to continue; the connection is still held while it is paused.`});case`server-restarting`:return(0,Y.jsx)(cm,{state:e.kind,icon:(0,Y.jsx)(To,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Server restarting`,copy:`The xezar server is restarting or unavailable. The connection data shown here is last-known, not newly confirmed.`,recovery:`Running tasks are not cancelled by the restart. After recovery the actual owner and configuration state are shown.`});case`disconnected`:return(0,Y.jsx)(cm,{state:e.kind,icon:(0,Y.jsx)(Po,{}),tone:`danger`,title:`Disconnected — reconnecting`,copy:`The connection to the leader is interrupted. Started tasks continue to run; their state and results are reconciled after reconnect.`,recovery:`This is a connection problem, not a task failure. Reconnect the leader client to resume.`});case`expired`:return(0,Y.jsx)(cm,{state:e.kind,icon:(0,Y.jsx)(Ga,{}),tone:`danger`,title:`Owner session expired`,copy:`The previous owner's session expired, so its connection is no longer valid. The old client must reinitialize to connect again — and a new client may already own the project.`,recovery:`Reconnect from the leader client to start a fresh session. If another client took the project meanwhile, it is occupied instead.`});case`error`:return(0,Y.jsx)(dm,{outcome:e.outcome});case`unsupported`:return(0,Y.jsx)(cm,{state:e.kind,icon:(0,Y.jsx)(Ua,{}),tone:`neutral`,title:`Capability unavailable`,copy:`The connection is limited by a missing ${e.missing}.`,recovery:`This is the missing client, adapter, dependency or read-only boundary — not a secret and not another project's data. The setup guidance on this page says what to do about it.`})}}function dm({outcome:e}){let{title:t,copy:n}={"not-applied":{title:`Operation not applied`,copy:`No mutation occurred: the operation was rejected before it changed anything.`},accepted:{title:`Operation accepted`,copy:`The operation was accepted and is in progress. Its outcome may still be running.`},unverified:{title:`Outcome needs verification`,copy:`The operation’s outcome needs verification — it may or may not have taken effect.`}}[e];return(0,Y.jsx)(cm,{state:`error`,icon:(0,Y.jsx)(si,{}),tone:`danger`,title:t,copy:n,recovery:`Re-read current state before deciding again. Do not repeat a blind retry with a new key — preserve the operation identity instead.`})}function fm(e){return e.split(/\x60([^\x60]+)\x60/).map((e,t)=>t%2?(0,Y.jsx)(`code`,{className:`font-mono break-words`,children:e},t):e)}var pm=[{name:`Claude Code`,automatic:"Writing the connection configuration inside this project’s `.local/xezar/`; regenerating it if deleted; keeping it out of Git.",userAction:(0,Y.jsxs)(Y.Fragment,{children:[`Run this once, from the project root:`,(0,Y.jsx)(`pre`,{className:`mt-2 rounded-md border border-border bg-muted p-3 font-mono text-[11px] leading-relaxed break-all whitespace-pre-wrap`,children:`claude mcp add --scope local xezar -- npx -y @qodeca/xezar mcp`})]}),notAutomatic:"Claude Code does not discover `.local/xezar/mcp-connection.json`. Nothing in it is read by Claude Code at any point — the command above is what tells Claude Code that a xezar MCP server exists.",caveat:"Local scope writes outside the repository. The project-scope alternative (`--scope project`) writes a tracked `.mcp.json`, which pi reads too, and needs a per-user approval step before it connects."},{name:`Codex`,automatic:"Writing the connection configuration inside this project’s `.local/xezar/`; regenerating it if deleted; keeping it out of Git.",userAction:(0,Y.jsxs)(Y.Fragment,{children:[`Create the project `,(0,Y.jsx)(`span`,{className:`font-mono break-all`,children:`.codex/config.toml`}),` block, and trust the project once. Two steps, both required:`,(0,Y.jsx)(`pre`,{className:`mt-2 rounded-md border border-border bg-muted p-3 font-mono text-[11px] leading-relaxed break-all whitespace-pre-wrap`,children:`[mcp_servers.xezar]
9
+ command = "npx"
10
+ args = ["-y", "@qodeca/xezar", "mcp"]`}),(0,Y.jsxs)(`span`,{className:`mt-2 block`,children:[`Then either accept Codex’s trust prompt the first time you run it in this folder, or add a`,` `,(0,Y.jsx)(`span`,{className:`font-mono break-all`,children:`[projects."<absolute path>"] trust_level = "trusted"`}),` entry to your user config.`]})]}),notAutomatic:"Codex does not discover `.local/xezar/mcp-connection.json`. It also does not read a project `.codex/config.toml` at all until that project is trusted — so a user who writes the file but skips the trust step sees a silent nothing, with no error naming the cause.",caveat:"Do not use `codex mcp add` — it has no scope flag and writes a machine-scope entry that would apply in every project."},{name:`OpenCode`,automatic:"Writing the connection configuration inside this project’s `.local/xezar/`; regenerating it if deleted; keeping it out of Git.",userAction:(0,Y.jsxs)(Y.Fragment,{children:[`Add the `,(0,Y.jsx)(`span`,{className:`font-mono break-all`,children:`mcp.xezar`}),` block to the project `,(0,Y.jsx)(`span`,{className:`font-mono break-all`,children:`opencode.json`}),`:`,(0,Y.jsx)(`pre`,{className:`mt-2 rounded-md border border-border bg-muted p-3 font-mono text-[11px] leading-relaxed break-all whitespace-pre-wrap`,children:`{
11
+ "$schema": "https://opencode.ai/config.json",
12
+ "mcp": {
13
+ "xezar": {
14
+ "type": "local",
15
+ "command": ["npx", "-y", "@qodeca/xezar", "mcp"],
16
+ "enabled": true
17
+ }
18
+ }
19
+ }`})]}),notAutomatic:"OpenCode does not discover `.local/xezar/mcp-connection.json`. The `opencode.json` block above is what makes the server appear, and it is normally committed — safe only because it holds no secret.",caveat:"`opencode mcp add` is interactive, so the written-file form above is the one to use."},{name:`pi`,automatic:"Writing the connection configuration inside this project’s `.local/xezar/`; regenerating it if deleted; keeping it out of Git.",userAction:(0,Y.jsxs)(Y.Fragment,{children:[`pi adds MCP through an extension, by design, so its setup has two steps, both required:`,(0,Y.jsxs)(`ol`,{className:`mt-2 flex list-decimal flex-col gap-3 pl-5`,children:[(0,Y.jsxs)(`li`,{children:[`Install the `,(0,Y.jsx)(`code`,{className:`font-mono break-words`,children:`pi-mcp-adapter`}),` extension once. It is a third-party extension (`,(0,Y.jsx)(`a`,{href:`https://github.com/nicobailon/pi-mcp-adapter`,target:`_blank`,rel:`noreferrer`,"data-slot":`mcp-client-pi-adapter-link`,className:`rounded-sm underline underline-offset-2 outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:`source on GitHub`}),`, MIT licence). Version 2.32.1 is the one tested with xezar:`,(0,Y.jsx)(`pre`,{className:`mt-2 rounded-md border border-border bg-muted p-3 font-mono text-[11px] leading-relaxed break-all whitespace-pre-wrap`,children:`pi install npm:pi-mcp-adapter@2.32.1`})]}),(0,Y.jsxs)(`li`,{children:[`Add the `,(0,Y.jsx)(`span`,{className:`font-mono break-all`,children:`xezar`}),` entry to `,(0,Y.jsx)(`span`,{className:`font-mono break-all`,children:`.pi/mcp.json`}),` in the project root:`,(0,Y.jsx)(`pre`,{className:`mt-2 rounded-md border border-border bg-muted p-3 font-mono text-[11px] leading-relaxed break-all whitespace-pre-wrap`,children:`{
20
+ "settings": { "directTools": true },
21
+ "mcpServers": {
22
+ "xezar": {
23
+ "command": "npx",
24
+ "args": ["-y", "@qodeca/xezar", "mcp"],
25
+ "lifecycle": "keep-alive"
26
+ }
27
+ }
28
+ }`}),(0,Y.jsxs)(`span`,{className:`mt-2 block`,children:[(0,Y.jsx)(`span`,{className:`font-mono break-all`,children:`directTools`}),` shows the model the xezar tools directly.`,` `,(0,Y.jsx)(`span`,{className:`font-mono break-all`,children:`keep-alive`}),` connects pi as soon as it starts here and keeps the connection while pi is idle; without it, pi gives the project up after 10 idle minutes.`]}),(0,Y.jsx)(`span`,{"data-slot":`mcp-client-pi-leader`,className:`mt-2 block`,children:`So any pi started in this folder, including a pi task xezar runs here with Worktree off, becomes this project’s leader client, and every other client, Claude Code included, is refused until that pi exits. Start pi in another folder for other work.`}),(0,Y.jsxs)(`span`,{"data-slot":`mcp-client-pi-approve-tools`,className:`mt-2 block`,children:[`Leave xezar’s tools out of the extension’s `,(0,Y.jsx)(`span`,{className:`font-mono break-all`,children:`approveTools`}),` setting, in this file or on the `,(0,Y.jsx)(`span`,{className:`font-mono break-all`,children:`xezar`}),` entry. A gated tool asks for approval in pi’s own window and nothing in xezar answers, so a pi xezar runs waits there until it is killed — measured at two minutes, on a step that named`,` `,(0,Y.jsx)(`span`,{className:`font-mono break-all`,children:`xezar_health`}),` — and a leader turn nobody is watching waits for ever, because nothing ends that one at all. A pi that is never offered a xezar tool is unaffected. Making xezar answer that question is`,` `,(0,Y.jsx)(`a`,{href:`https://github.com/qodeca/xezar/issues/369`,target:`_blank`,rel:`noreferrer`,"data-slot":`mcp-client-pi-approve-tools-issue`,className:`rounded-sm underline underline-offset-2 outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:`issue 369`}),`, which is not in this release.`]}),(0,Y.jsx)(`span`,{className:`mt-2 block`,children:`The file holds no secret, so it is safe to commit. A committed entry does the same for everyone who starts pi in this project.`})]})]})]}),notAutomatic:"pi does not discover `.local/xezar/mcp-connection.json`. Without the extension, pi does not read the entry above at all: it shows no xezar tool, and no error says why. To check: `pi list` shows `npm:pi-mcp-adapter`, and pi says `MCP: 1 servers connected` when it starts here (a higher number if you have other MCP servers).",caveat:"If another file also has a `xezar` entry, yours in `.pi/mcp.json` wins: it is the last of the six files pi reads MCP config from. One of the others is the project `.mcp.json`, which Claude Code reads too, so an entry there reaches both clients. The other four apply in every folder pi starts in: `~/.config/mcp/mcp.json`, `~/.agents/mcp.json`, `~/.agents/mcp/mcp.json`, `~/.pi/agent/mcp.json`."}];function mm(){let e=I(),t=R();return e.isPending||t.isPending?(0,Y.jsx)(`p`,{"data-slot":`mcp-connection-loading`,role:`status`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading MCP connection…`}):e.isError&&!e.data?(0,Y.jsx)(V,{icon:(0,Y.jsx)(si,{}),tone:`danger`,heading:`h2`,title:`Could not load the MCP connection`,subtitle:e.error.message}):(0,Y.jsx)(gm,{health:e.data,projects:t.data?.projects??[],connection:hm(e.data,e.isError)})}function hm(e,t){return t?{kind:`server-restarting`}:e.capabilities.localHandoff?null:{kind:`unsupported`,missing:`local connection: the MCP client and xezar must run on the same machine`}}function gm({health:e,projects:t,connection:n,operations:r}){let i=Ni()??e.bootProject??null,a=i===null?void 0:t.find(e=>e.id===i),o=e.capabilities.localHandoff;return(0,Y.jsxs)(`div`,{"data-slot":`mcp-connection-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,Y.jsx)($,{title:`Bound project`,hint:`The MCP leader connection is bound to exactly one project, and one client may own it at a time. The cockpit stays usable alongside it.`,children:(0,Y.jsx)(`div`,{"data-slot":`mcp-project`,className:`rounded-md border border-border bg-card p-3`,children:a?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:a.name}),(0,Y.jsx)(`span`,{className:`mt-1 block font-mono text-xs break-all text-soft-foreground`,children:a.root})]}):(0,Y.jsx)(`span`,{className:`text-[13px] text-soft-foreground`,children:`The bound project is not in the registry.`})})}),(0,Y.jsx)($,{title:`Local-only scope`,hint:`The MCP client and xezar must be on the same machine. Remote access is out of scope.`,children:(0,Y.jsx)(`div`,{"data-slot":`mcp-local-only`,className:`rounded-md border border-border bg-card p-3`,children:o?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`flex items-center gap-2 text-[13px] text-foreground`,children:[(0,Y.jsx)(ko,{"aria-hidden":`true`,className:`size-4 shrink-0 text-primary`}),`This xezar is running locally, so the MCP connection is available for this project.`]}),(0,Y.jsx)(`p`,{className:`mt-2 text-[13px] leading-relaxed text-muted-foreground`,children:`A client on another machine cannot connect, and no part of the MCP surface is exposed to a remote host.`})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`flex items-center gap-2 text-[13px] text-foreground`,children:[(0,Y.jsx)(Do,{"aria-hidden":`true`,className:`size-4 shrink-0 text-warning`}),`This xezar is not running in local mode, so the MCP connection is not available.`]}),(0,Y.jsx)(`p`,{className:`mt-2 text-[13px] leading-relaxed text-muted-foreground`,children:`Run the cockpit locally to make the connection available for this project.`})]})})}),(0,Y.jsx)($,{title:`One-time setup`,hint:`Configure the leader application once, per client.`,children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Y.jsxs)(`p`,{"data-slot":`mcp-readiness`,className:`text-[13px] leading-relaxed text-foreground`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`Configuration readiness:`}),` `,o?fm("xezar writes this project’s connection configuration automatically into its `.local/xezar/`, regenerates it if deleted, and keeps it out of Git. No client reads that file, so the step below is the only one left."):`Configuration is written automatically, but the connection is not available in this mode.`]}),pm.map(e=>(0,Y.jsx)(_m,{client:e},e.name))]})}),(0,Y.jsx)(`div`,{"data-slot":`mcp-connection-status`,"aria-live":`polite`,className:`min-w-0`,children:n?(0,Y.jsx)($,{title:`Connection status`,hint:`What the server reports about the MCP leader connection for this project.`,children:(0,Y.jsx)(um,{state:n})}):(0,Y.jsx)(`p`,{"data-slot":`mcp-connection-status-unreported`,className:`text-[13px] leading-relaxed text-muted-foreground`,children:`This page cannot tell whether a client is connected. Your leader client shows it.`})}),r?(0,Y.jsx)($,{title:`Operation outcomes`,hint:`What happened to the leader's recent operations: accepted, running, completed, failed, not applied or being verified.`,children:(0,Y.jsx)(`div`,{"data-slot":`mcp-operations`,"aria-live":`polite`,className:`min-w-0`,children:r.length?(0,Y.jsx)(`ul`,{"aria-label":`MCP operation outcomes`,className:`flex flex-col gap-2`,children:r.map(e=>(0,Y.jsx)(`li`,{children:(0,Y.jsx)(Vp,{operation:e})},e.operationId))}):(0,Y.jsxs)(`p`,{"data-slot":`mcp-operations-empty`,className:`rounded-md border border-border bg-card p-3 text-[13px] leading-relaxed text-foreground`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`No operations yet.`}),` The leader has not run an operation in this project.`]})})}):null,(0,Y.jsx)(om,{}),(0,Y.jsxs)(`p`,{className:`text-[13px] text-foreground`,children:[(0,Y.jsx)(K,{to:`/settings/mcp-api`,"data-slot":`mcp-api-link`,className:`rounded-sm font-medium underline underline-offset-2 outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:`See every tool this server exposes`}),` `,(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`– a read-only reference, in MCP API.`})]})]})}function _m({client:e}){return(0,Y.jsxs)(`div`,{"data-slot":`mcp-client-${e.name.toLowerCase().replace(/\s+/g,`-`)}`,className:`rounded-md border border-border bg-card p-3`,children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:e.name}),(0,Y.jsxs)(`div`,{className:`mt-2 flex flex-col gap-2 text-[13px] leading-relaxed`,children:[(0,Y.jsxs)(`p`,{"data-slot":`mcp-client-automatic`,className:`text-muted-foreground`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,children:`Automatic — xezar does this:`}),` `,fm(e.automatic)]}),(0,Y.jsxs)(`div`,{"data-slot":`mcp-client-user`,className:`text-foreground`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`One-time — you do this by hand:`}),(0,Y.jsx)(`div`,{className:`mt-1`,children:e.userAction})]}),(0,Y.jsxs)(`p`,{"data-slot":`mcp-client-not-automatic`,className:`rounded-md bg-muted p-2 text-muted-foreground`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,children:`Not automatic:`}),` `,fm(e.notAutomatic)]}),e.caveat?(0,Y.jsx)(`p`,{"data-slot":`mcp-client-caveat`,className:`text-[12px] text-soft-foreground`,children:fm(e.caveat)}):null]})]})}function vm(e){return{enabled:(e&&typeof e==`object`?e:{}).enabled===!0}}function ym(){let e=globalThis.Notification;if(typeof e!=`function`)return`unsupported`;let t=e.permission;return t===`granted`||t===`denied`?t:`default`}function bm(e,t){let n=new Map,r=[];for(let i of t??[]){n.set(i.id,i.status);let t=e.get(i.id);t===void 0||t===i.status||zi(i)&&r.push(i)}return{entering:r,statuses:n}}function xm(e){return e.enabled&&e.hidden&&e.permission===`granted`}function Sm(e){let t=Li(e).label;return{title:e.titleSummary??e.title,body:`Task ${t}`,tag:`xezar-run-${e.id}`}}function Cm(){let e=O(),t=Nt(),[n,r]=J.useState(!1),[i,a]=J.useState(ym),o=t.data;J.useEffect(()=>{o!==void 0&&r(vm(o.notifications).enabled)},[o]);let s=J.useCallback(t=>{r(t),st({notifications:{enabled:t}}).then(t=>e.setQueryData(F.uiState,t)).catch(t=>{z(t instanceof Error?t.message:String(t),{tone:`danger`}),e.invalidateQueries({queryKey:F.uiState})})},[e]),c=J.useCallback(e=>{if(!e){s(!1);return}if(ym()!=="default"){s(!0);return}s(!0),Notification.requestPermission().then(e=>a(e)).catch(()=>a(ym()))},[s]),l=i===`unsupported`;return(0,Y.jsx)(`div`,{"data-slot":`notifications-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:(0,Y.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:(0,Y.jsx)(`label`,{htmlFor:`notifications-enabled`,children:`Notify when an agent needs you`})}),(0,Y.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`A browser notification when a task starts waiting, asks for review, or fails — only while this tab is in the background. Off by default.`})]}),(0,Y.jsx)(hf,{id:`notifications-enabled`,"data-slot":`notifications-toggle`,checked:n,disabled:l,onCheckedChange:c})]}),l?(0,Y.jsx)(`p`,{"data-slot":`notifications-unsupported`,className:`text-[13px] text-muted-foreground`,children:`This browser does not support notifications, so the toggle is unavailable here.`}):null,!l&&n&&i===`denied`?(0,Y.jsx)(`p`,{"data-slot":`notifications-denied`,className:`text-[13px] text-danger`,children:`This browser is blocking notifications for the cockpit. The preference is saved, but nothing will be delivered here until you allow notifications in the browser's site settings.`}):null]})})}function wm(){let e=Ke();return{isPending:e.isPending,confirm:(t,n)=>e.mutate(t.id,{onSuccess:()=>{z(`${t.name} removed from the workspace — its files are untouched`),n?.()},onError:e=>z(e.message,{tone:`danger`})})}}function Tm({project:e,onOpenChange:t,onConfirm:n}){return(0,Y.jsx)(_i,{open:e!==null,onOpenChange:t,children:(0,Y.jsxs)(fi,{children:[(0,Y.jsxs)(gi,{children:[(0,Y.jsxs)(di,{children:[`Remove `,e?.name,` from the workspace?`]}),(0,Y.jsxs)(ui,{children:[`This only unregisters the project — `,(0,Y.jsx)(`strong`,{children:`nothing on disk is deleted`}),`. The folder, its git history and its task history all stay exactly where they are, and opening it again re-registers it with everything intact.`,(0,Y.jsx)(`span`,{className:`mt-1 block truncate font-mono text-[11px] text-foreground`,title:e?.root,children:e?.root})]})]}),(0,Y.jsxs)(mi,{children:[(0,Y.jsx)(hi,{children:`Keep it`}),(0,Y.jsx)(pi,{"data-action":`projects-confirm-remove`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:n,children:`Remove from list`})]})]})})}var Em=1,Dm={ok:`ok`,"not-git":`no git repo`,missing:`folder not found`};function Om(e){let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function km(){let e=re(),t=R();return e.isPending||t.isPending?(0,Y.jsx)(`p`,{"data-slot":`projects-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading projects…`}):e.isError||t.isError?(0,Y.jsx)(V,{icon:(0,Y.jsx)(no,{}),tone:`danger`,title:`Project settings did not load`,subtitle:(e.error??t.error)?.message,heading:`h2`}):(0,Y.jsx)(Am,{config:e.data,registry:t.data})}function Am({config:e,registry:t}){return(0,Y.jsxs)(`div`,{"data-slot":`projects-section`,className:`mx-auto flex w-full max-w-4xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,Y.jsx)(jm,{configKey:`browseRoot`,value:e.browseRoot,title:`Default browse folder`,hint:`Where “Open local folder…” starts. The picker cannot navigate above this folder.`,placeholder:`~/`,slot:`browse`,savedLabel:`Browse folder`,footer:`Only affects folder browsing; GitHub checkouts use the separate checkout folder.`}),(0,Y.jsx)(jm,{configKey:`projectsDir`,value:e.projectsDir,title:`Default checkout folder`,hint:`Where “Clone from GitHub” puts new projects: <folder>/<project name>.`,placeholder:`~/xezar/projects`,slot:`checkout`,savedLabel:`Checkout folder`,footer:`Only affects new checkouts; projects already registered keep their location.`,refreshProjects:!0}),(0,Y.jsx)(Mm,{registry:t,workspaceMax:e.resources.maxParallel})]})}function jm({configKey:e,value:t,title:n,hint:r,placeholder:i,slot:a,savedLabel:o,footer:s,refreshProjects:c=!1}){let l=O(),u=P({mutationFn:t=>ut(e===`browseRoot`?{browseRoot:t}:{projectsDir:t}),onSuccess:t=>{l.setQueryData(F.config,t),e===`browseRoot`?l.invalidateQueries({queryKey:F.fsBrowseRoot}):c&&l.invalidateQueries({queryKey:F.projects})}}),[d,f]=(0,J.useState)(t),p=d.trim(),m=p===t,h=u.isError?u.error.message:null;return(0,Y.jsxs)($,{title:n,hint:`${r} ${e===`browseRoot`?`Choose an existing folder; it is verified writable before saving.`:`The folder is created recursively if needed, then verified writable before saving.`}`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`input`,{type:`text`,spellCheck:!1,"aria-label":n,"aria-invalid":h!==null,"data-slot":`projects-${a}-root`,value:d,disabled:u.isPending,placeholder:i,onChange:e=>{f(e.target.value),u.isError&&u.reset()},className:`block w-full max-w-sm rounded-md border border-input bg-card px-3 py-1.5 font-mono text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-danger disabled:opacity-50`}),(0,Y.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,"data-action":`projects-save-${a}-root`,disabled:m||p===``||u.isPending,onClick:()=>u.mutate(p,{onSuccess:()=>z(`${o} set to ${p}`)}),children:`Save`})]}),h===null?(0,Y.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:s}):(0,Y.jsxs)(`p`,{"data-slot":`projects-${a}-root-error`,role:`alert`,className:`text-[11px] text-danger`,children:[h,` — setting unchanged`]})]})}function Mm({registry:e,workspaceMax:t}){let[n,r]=(0,J.useState)(null),i=wm(),a=(0,J.useMemo)(()=>Me(e.projects),[e.projects]);return(0,Y.jsxs)($,{title:`Registered projects`,hint:`Every folder xezar has run in, plus the ones added from the GUI. “Tags” group connected repositories — give the API, the web app and the design system a shared “storefront” tag and the global Tasks page can show all three as one piece of work. “Max parallel” caps how many of that project's tasks run at once; the workspace limit (${t}) still applies as an overall ceiling, so a per-project value above it has no extra effect until the workspace limit is raised. Removing a project only unregisters it — no files on disk are deleted.`,children:[e.projects.length===0?(0,Y.jsx)(`p`,{"data-slot":`projects-empty`,className:`text-[13px] text-soft-foreground`,children:`No projects registered yet.`}):(0,Y.jsx)(`div`,{className:`overflow-x-auto rounded-md border border-border`,children:(0,Y.jsxs)(`table`,{className:`w-full border-collapse text-sm`,children:[(0,Y.jsx)(`caption`,{className:`sr-only`,children:`Projects registered in this workspace`}),(0,Y.jsxs)(`colgroup`,{children:[(0,Y.jsx)(`col`,{}),(0,Y.jsx)(`col`,{style:{width:`104px`}}),(0,Y.jsx)(`col`,{style:{width:`260px`}}),(0,Y.jsx)(`col`,{style:{width:`150px`}}),(0,Y.jsx)(`col`,{style:{width:`72px`}}),(0,Y.jsx)(`col`,{style:{width:`92px`}})]}),(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{className:`border-b border-border text-left text-[12px] text-soft-foreground`,children:[(0,Y.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Project`}),(0,Y.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Status`}),(0,Y.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Tags`}),(0,Y.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Max parallel`}),(0,Y.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Added`}),(0,Y.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium text-right`,children:`Actions`})]})}),(0,Y.jsx)(`tbody`,{children:e.projects.map(n=>(0,Y.jsx)(Nm,{project:n,isBoot:n.id===e.bootProject,workspaceMax:t,vocabulary:a,disabled:i.isPending,onRemove:()=>r(n)},n.id))})]})}),(0,Y.jsx)(Tm,{project:n,onOpenChange:e=>!e&&r(null),onConfirm:()=>{if(!n)return;let e=n;r(null),i.confirm(e)}})]})}function Nm({project:e,isBoot:t,workspaceMax:n,vocabulary:r,disabled:i,onRemove:a}){return(0,Y.jsxs)(`tr`,{"data-slot":`project-row`,"data-project":e.id,className:`border-b border-border last:border-0`,children:[(0,Y.jsxs)(`th`,{scope:`row`,className:`max-w-0 px-3 py-2 text-left font-normal`,children:[(0,Y.jsx)(`span`,{className:`block truncate text-foreground`,children:e.name}),(0,Y.jsx)(`span`,{className:`block truncate font-mono text-[11px] text-soft-foreground`,title:e.root,children:e.root})]}),(0,Y.jsxs)(`td`,{className:`px-3 py-2`,children:[(0,Y.jsx)(`span`,{"data-slot":`project-status`,className:e.status===`missing`?`text-[12px] text-danger`:`text-[12px] text-soft-foreground`,children:Dm[e.status]}),e.status===`missing`?null:(0,Y.jsxs)(`span`,{className:`ml-1 text-[11px] text-soft-foreground`,children:[`· `,e.source]})]}),(0,Y.jsx)(`td`,{className:`px-3 py-2`,children:(0,Y.jsx)(Pm,{project:e,vocabulary:r})}),(0,Y.jsx)(`td`,{className:`px-3 py-2`,children:(0,Y.jsx)(Fm,{project:e,workspaceMax:n})}),(0,Y.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:Om(e.addedAt)}),(0,Y.jsx)(`td`,{className:`px-3 py-2 text-right`,children:(0,Y.jsx)(L,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`project-remove`,"aria-label":`Remove ${e.name} from the workspace — unregisters it, no files are deleted`,title:t?`xezar is serving this project — it re-registers itself at every start`:void 0,disabled:i||t,onClick:a,children:`Remove`})})]})}function Pm({project:e,vocabulary:t}){let n=je(),[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(-1),l=(0,J.useRef)(null),u=e.tags??[],d=Fe(t,u,r),f=a&&d.length>0,p=(t,r)=>{n.mutate({id:e.id,tags:t},{onSuccess:()=>z(r),onError:e=>z(e.message,{tone:`danger`})})},m=t=>{let n=t.trim().slice(0,32);if(c(-1),n){if(u.some(e=>e.toLowerCase()===n.toLowerCase())){i(``);return}if(u.length>=20){z(`${e.name} already has the maximum of 20 tags`,{tone:`danger`});return}i(``),p([...u,n],`${e.name} tagged \u201c${n}\u201d`)}},h=t=>{p(u.filter(e=>e!==t),`\u201c${t}\u201d removed from ${e.name}`)},g=`project-tag-suggestions-${e.id}`;return(0,Y.jsxs)(`div`,{"data-slot":`project-tags`,className:`flex flex-wrap items-center gap-1`,children:[u.map(t=>(0,Y.jsxs)(`span`,{"data-slot":`project-tag`,className:`inline-flex max-w-full items-center gap-1 rounded-full bg-violet/15 py-px pr-1 pl-2 text-[11px] font-medium whitespace-nowrap text-violet`,children:[t,(0,Y.jsx)(`button`,{type:`button`,"data-action":`project-tag-remove`,"aria-label":`Remove tag ${t} from ${e.name}`,disabled:n.isPending,onClick:()=>h(t),className:`rounded-full p-0.5 hover:bg-violet/25 disabled:opacity-50`,children:(0,Y.jsx)(ci,{className:`size-3`,"aria-hidden":`true`})})]},t)),(0,Y.jsxs)(ur,{open:f,onOpenChange:o,children:[(0,Y.jsx)(sr,{asChild:!0,children:(0,Y.jsx)(`input`,{ref:l,type:`text`,"data-slot":`project-tag-input`,"aria-label":`Add a tag to ${e.name}`,role:`combobox`,"aria-expanded":f,"aria-controls":f?g:void 0,"aria-autocomplete":`list`,"aria-activedescendant":f&&s>=0?`${g}-${s}`:void 0,placeholder:u.length===0?`Add tag…`:`+`,value:r,maxLength:32,disabled:n.isPending,onFocus:()=>o(!0),onBlur:()=>o(!1),onChange:e=>{if(o(!0),c(-1),e.target.value.includes(`,`)){i(e.target.value.replace(/,/g,``));return}i(e.target.value)},onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(d.length===0)return;e.preventDefault(),o(!0);let t=e.key===`ArrowDown`?1:-1,n=s+t;c(n>=d.length?-1:n<-1?d.length-1:n);return}if(e.key===`Escape`&&f){e.preventDefault(),o(!1),c(-1);return}if(e.key===`Enter`||e.key===`,`){e.preventDefault(),m(s>=0?d[s]??r:r);return}if(e.key===`Tab`){o(!1);return}if(e.key===`Backspace`&&r===``&&u.length>0){e.preventDefault();let t=u[u.length-1];t!==void 0&&h(t)}},className:`h-6 w-16 min-w-0 flex-1 rounded-md border border-input bg-card px-1.5 text-[12px] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`})}),(0,Y.jsxs)(ir,{align:`start`,sideOffset:4,id:g,role:`listbox`,"data-slot":`project-tag-suggestions`,className:`w-56 p-1`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,Y.jsx)(`p`,{className:`px-2 pt-1 pb-1.5 text-[10.5px] text-soft-foreground`,children:`Tags used in this workspace`}),d.map((e,t)=>(0,Y.jsx)(`button`,{type:`button`,id:`${g}-${t}`,role:`option`,"aria-selected":t===s,"data-slot":`project-tag-suggestion`,onMouseDown:e=>e.preventDefault(),onClick:()=>{m(e),l.current?.focus()},onMouseEnter:()=>c(t),className:U(`flex w-full items-center rounded-sm px-2 py-1 text-left text-[12px] font-medium text-violet`,t===s&&`bg-muted`),children:e},e))]})]})]})}function Fm({project:e,workspaceMax:t}){let n=je(),r=e.maxParallel===void 0?``:String(e.maxParallel);return(0,Y.jsxs)(`select`,{"aria-label":`Max parallel tasks for ${e.name}`,"data-slot":`project-max-parallel`,value:r,disabled:n.isPending,onChange:r=>{let i=r.target.value,a=i===``?null:Number(i);n.mutate({id:e.id,maxParallel:a},{onSuccess:()=>z(a===null?`${e.name} inherits the workspace limit (${t})`:`${e.name} runs at most ${a} task${a===1?``:`s`} at a time`),onError:e=>z(e.message,{tone:`danger`})})},className:`block w-44 rounded-md border border-input bg-card px-2 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,Y.jsxs)(`option`,{value:``,children:[`Inherit workspace (`,t,`)`]}),Array.from({length:16},(e,t)=>t+Em).map(e=>(0,Y.jsx)(`option`,{value:e,children:e},e))]})}function Im(){let e=T();return e.isPending?(0,Y.jsx)(`p`,{"data-slot":`prompt-templates-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading prompt templates…`}):e.isError?(0,Y.jsx)(V,{icon:(0,Y.jsx)(yo,{}),tone:`danger`,title:`Prompt templates did not load`,subtitle:e.error.message,heading:`h2`}):(0,Y.jsx)(Lm,{initial:Br(e.data.promptTemplates)})}function Lm({initial:e}){let t=O(),n=an(),r=T(),[i,a]=(0,J.useState)(e),[o,s]=(0,J.useState)(``),[c,l]=(0,J.useState)(``),u=P({mutationFn:e=>xt({promptTemplates:e}),onSuccess:e=>{t.setQueryData(B.uiState,e),z(`Prompt templates saved`)},onError:e=>z(e.message,{tone:`danger`})}),d=JSON.stringify(i)!==JSON.stringify(e),f=i.some(e=>e.label.trim()===``||e.text.trim()===``),p=(e,t)=>a(n=>n.map(n=>n.id===e?{...n,...t}:n)),m=(e,t)=>a(n=>n.map(n=>{if(n.id!==e)return n;let r=n.skills??[],i=r.includes(t)?r.filter(e=>e!==t):[...r,t],{skills:a,...o}=n;return i.length>0?{...o,skills:i}:o})),h=e=>a(t=>t.filter(t=>t.id!==e));return(0,Y.jsx)(`div`,{"data-slot":`prompt-templates-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:(0,Y.jsxs)(zm,{title:`Prompt templates`,hint:`Reusable snippets you can insert into a prompt — the new-task composer, the GitHub hand-over, and the Inbox's “Add instructions” box all offer this list. Assign a template to a skill and it fills the prompt in for you when you pick that skill, as long as you have not typed anything yet.`,children:[(0,Y.jsx)(`div`,{"data-slot":`prompt-template-list`,className:`flex flex-col gap-3`,children:i.length===0?(0,Y.jsx)(`p`,{"data-slot":`prompt-templates-empty`,className:`text-[13px] text-soft-foreground`,children:`No templates. Add one below, or reset to the built-ins.`}):i.map(e=>(0,Y.jsxs)(`div`,{"data-slot":`prompt-template-row`,"data-template":e.id,className:`flex flex-col gap-1.5 rounded-md border border-border bg-card p-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(hc,{"aria-label":`Label for ${e.label||`this template`}`,"data-slot":`prompt-template-label-input`,value:e.label,maxLength:80,onChange:t=>p(e.id,{label:t.target.value}),className:`flex-1`}),(0,Y.jsx)(L,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`prompt-template-remove`,title:`Remove this template`,onClick:()=>h(e.id),children:(0,Y.jsx)(ci,{"aria-hidden":`true`,className:`size-3.5`})})]}),(0,Y.jsx)(li,{"aria-label":`Text for ${e.label||`this template`}`,"data-slot":`prompt-template-text-input`,value:e.text,maxLength:2e3,onChange:t=>p(e.id,{text:t.target.value}),className:`min-h-14 text-[13px]`}),(0,Y.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-1.5`,children:[(0,Y.jsx)(Rm,{label:e.label,skills:n.data??[],skillUsage:r.data?.skillUsage,selected:e.skills??[],onToggle:t=>m(e.id,t)}),(e.skills??[]).map(t=>(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-skill-chip`,"data-skill":t,title:`Stop applying “${e.label}” automatically with ${t}`,onClick:()=>m(e.id,t),className:`inline-flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-px font-mono text-[11px] font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[t,(0,Y.jsx)(ci,{"aria-hidden":`true`,className:`size-3`})]},t))]})]},e.id))}),(0,Y.jsxs)(`div`,{"data-slot":`prompt-template-new`,className:`flex flex-col gap-1.5 rounded-md border border-dashed border-border p-3`,children:[(0,Y.jsx)(hc,{"aria-label":`New template label`,"data-slot":`prompt-template-new-label`,placeholder:`Label (e.g. "Add tests")`,value:o,maxLength:80,onChange:e=>s(e.target.value)}),(0,Y.jsx)(li,{"aria-label":`New template text`,"data-slot":`prompt-template-new-text`,placeholder:`The instructions to insert…`,value:c,maxLength:2e3,onChange:e=>l(e.target.value),className:`min-h-14 text-[13px]`}),(0,Y.jsxs)(L,{type:`button`,variant:`outline`,size:`sm`,"data-action":`prompt-template-add`,disabled:!o.trim()||!c.trim(),onClick:()=>{let e=o.trim(),t=c.trim();!e||!t||(a(n=>[...n,{id:Kr(),label:e,text:t}]),s(``),l(``))},className:`self-start`,children:[(0,Y.jsx)(wo,{"aria-hidden":`true`,className:`size-3.5`}),`Add template`]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(L,{type:`button`,variant:`contrast`,size:`sm`,"data-action":`prompt-templates-save`,disabled:!d||f||u.isPending,onClick:()=>u.mutate(i),children:`Save`}),(0,Y.jsx)(L,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`prompt-templates-reset`,disabled:u.isPending,onClick:()=>a(ei.map(e=>({...e}))),children:`Reset to defaults`}),f?(0,Y.jsx)(`p`,{"data-slot":`prompt-templates-invalid`,className:`text-[11px] text-danger`,children:`Every template needs both a label and text.`}):null]})]})})}function Rm({label:e,skills:t,skillUsage:n,selected:r,onToggle:i}){let[o,s]=(0,J.useState)(!1),[c,l]=(0,J.useState)(``),u=(0,J.useRef)(null),{mostUsed:d,project:f,global:p}=Wi(Qi(t,c,n),n),m=(e,t)=>{let n=r.includes(e.name);return(0,Y.jsxs)(G,{value:`skill ${e.name} ${e.path}`,keywords:Ki(e.name,e.description),"data-slot":`prompt-template-skill-option`,"data-skill":e.name,"data-selected":n?`true`:void 0,onSelect:()=>i(e.name),children:[(0,Y.jsx)(`span`,{className:U(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,n?(0,Y.jsx)(a,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]},e.path)};return(0,Y.jsxs)(ur,{open:o,onOpenChange:e=>{s(e),e||l(``)},children:[(0,Y.jsx)(rr,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-skills-trigger`,"aria-label":`Apply ${e||`this template`} automatically with a skill`,title:`Pick the skills this template applies itself to`,disabled:t.length===0,className:U(`inline-flex h-[26px] items-center gap-1.5 rounded-full border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-50`,r.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,Y.jsx)(oi,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),t.length===0?`no skills found`:`apply with…`,(0,Y.jsx)(Xn,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Y.jsx)(ir,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Y.jsxs)(Zr,{shouldFilter:!1,children:[(0,Y.jsx)(zr,{placeholder:`search skills…`,value:c,onValueChange:l,onInput:()=>u.current?.scrollTo(0,0)}),(0,Y.jsxs)(ri,{ref:u,"data-slot":`prompt-template-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[d.length===0&&f.length===0&&p.length===0?(0,Y.jsx)(Gr,{children:`Nothing matches.`}):null,d.length>0?(0,Y.jsx)(W,{heading:`Most used`,children:d.map(e=>m(e,qi(e)))}):null,f.length>0?(0,Y.jsx)(W,{heading:`Project skills`,children:f.map(e=>m(e,!0))}):null,p.length>0?(0,Y.jsx)(W,{heading:`Global`,children:p.map(e=>m(e,!1))}):null]})]})})]})}function zm({title:e,hint:t,children:n}){return(0,Y.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,Y.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}var Bm=1,Vm=1,Hm=60,Um=256,Wm=1,Gm=1440,Km=0,qm=1e3,Jm=/^[A-Za-z_][A-Za-z0-9_]*$/,Ym=64;function Xm(){let e=re();return e.isPending?(0,Y.jsx)(`p`,{"data-slot":`resources-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading resource settings…`}):e.isError?(0,Y.jsx)(V,{icon:(0,Y.jsx)(ro,{}),tone:`danger`,title:`Resource settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,Y.jsx)(Zm,{config:e.data})}function Zm({config:e}){let t=O(),n=P({mutationFn:e=>ut(e),onSuccess:e=>t.setQueryData(F.config,e),onError:e=>z(e.message,{tone:`danger`})}),[r,i]=(0,J.useState)(e.resources.memoryLimitMb?String(e.resources.memoryLimitMb):``),a=e.resources.monitoringWakeIntervalMinutes??null,[o,s]=(0,J.useState)(a===null?`park`:`interval`),[c,l]=(0,J.useState)(String(a??5)),u=Number(c),d=!Number.isInteger(u)||u<Vm||u>Hm,f=o===`park`?a===null:!d&&a===u,p=()=>n.mutate({resources:{monitoringWakeIntervalMinutes:o===`park`?null:u}},{onSuccess:()=>z(o===`park`?`Monitoring will stay parked`:`Monitoring will re-check every ${u} minutes`)}),m=e.resources.autoResumeOnUsageLimit??!0,h=e=>n.mutate({resources:{autoResumeOnUsageLimit:e}},{onSuccess:()=>z(e?`Tasks stopped by a usage limit will resume themselves`:`Tasks stopped by a usage limit will stay failed`)}),g=e.resources.idleTimeoutMinutes??null,[_,v]=(0,J.useState)(g===null?`never`:`timeout`),[y,b]=(0,J.useState)(String(g??15)),x=Number(y),S=!Number.isInteger(x)||x<Wm||x>Gm,C=_===`never`?g===null:!S&&g===x,w=()=>n.mutate({resources:{idleTimeoutMinutes:_===`never`?null:x}},{onSuccess:()=>z(_===`never`?`Waiting tasks will stay open until you close them`:`Waiting tasks close after ${x} minutes`)}),[T,E]=(0,J.useState)(String(e.resources.worktreeRetentionDefault)),D=Number(T),ee=T.trim()===``||!Number.isInteger(D)||D<Km||D>qm,te=e.resources.worktreeRetentionDefault===(ee?-1:D),ne=()=>n.mutate({resources:{worktreeRetentionDefault:D}},{onSuccess:()=>z(D===0?`New projects keep every finished worktree`:`New projects keep the last ${D} finished worktrees`)}),re=e=>n.mutate({followups:e},{onSuccess:()=>z(e===null?`Inbox follows the XEZ_FOLLOWUPS environment variable again`:e?`Inbox on`:`Inbox off`)}),ie=e.agentEnvPassthrough,[ae,k]=(0,J.useState)((ie??[]).join(`, `)),A=ae.split(`,`).map(e=>e.trim()).filter(Boolean),oe=A.length>Ym||A.some(e=>!Jm.test(e)),se=!oe&&ie!==null&&ie.join(`,`)===A.join(`,`),ce=()=>n.mutate({agentEnvPassthrough:A},{onSuccess:()=>z(A.length===0?`Agents get no extra variables`:`Agents also get ${A.join(`, `)}`)}),j=()=>n.mutate({agentEnvPassthrough:null},{onSuccess:()=>{k(``),z(`Passthrough follows the XEZ_ENV_PASSTHROUGH environment variable again`)}}),N=r.trim()===``?0:Number(r),le=r.trim()!==``&&(!Number.isInteger(N)||N<Um),ue=(e.resources.memoryLimitMb??0)===(le?-1:N),de=()=>n.mutate({resources:{memoryLimitMb:N===0?null:N}},{onSuccess:()=>z(N===0?`Memory limit cleared`:`Memory limit set to ${N} MiB`)}),fe=e.composerDefaults??{autonomous:null,worktree:null,inheritedAutonomous:`source-dependent`,inheritedWorktree:!0},pe=(e,t)=>n.mutate({composerDefaults:{[e]:t===`inherit`?null:t===`on`}});return(0,Y.jsxs)(`div`,{"data-slot":`resources-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,Y.jsxs)($,{title:`Max parallel tasks`,hint:`How many tasks run at once across every project. The rest wait in the queue. A non-git directory always runs one at a time.`,children:[(0,Y.jsx)(`select`,{"aria-label":`Max parallel tasks`,"data-slot":`resources-max-parallel`,value:e.resources.maxParallel,disabled:n.isPending,onChange:e=>n.mutate({resources:{maxParallel:Number(e.target.value)}}),className:`block w-28 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:Array.from({length:16},(e,t)=>t+Bm).map(e=>(0,Y.jsx)(`option`,{value:e,children:e},e))}),(0,Y.jsxs)(`p`,{className:`text-[11px] text-soft-foreground`,children:[`Need a different limit for one project?`,` `,(0,Y.jsx)(M,{to:`/settings/global/projects`,"data-slot":`resources-project-limits-link`,className:`font-medium text-foreground underline decoration-border underline-offset-2 hover:decoration-foreground`,children:`Configure per-project limits`}),`.`]})]}),(0,Y.jsxs)($,{title:`Extra monitoring sessions`,hint:`How many agent sessions may wait on CI, sub-agents, or monitored commands without using an active task slot. Extra sessions stay alive but pause the queue.`,children:[(0,Y.jsx)(`select`,{"aria-label":`Extra monitoring sessions`,"data-slot":`resources-max-monitoring`,value:e.resources.maxMonitoringSessions??2,disabled:n.isPending,onChange:e=>n.mutate({resources:{maxMonitoringSessions:Number(e.target.value)}}),className:`block w-28 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:Array.from({length:17},(e,t)=>(0,Y.jsx)(`option`,{value:t,children:t},t))}),(0,Y.jsxs)(`p`,{className:`text-[11px] text-soft-foreground`,children:[`Capacity: `,e.resources.maxParallel,` active + `,e.resources.maxMonitoringSessions??2,` monitoring. Set 0 to make monitoring share active slots.`]})]}),(0,Y.jsxs)($,{title:`Monitoring wake-up`,hint:`Park uses no model turns. Re-check sends the same agent a follow-up on this cadence until work completes or the 40-wakeup safety cap is reached.`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(`select`,{"aria-label":`Monitoring wake-up`,"data-slot":`resources-monitoring-wake-mode`,value:o,disabled:n.isPending,onChange:e=>s(e.target.value),className:`rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,Y.jsx)(`option`,{value:`park`,children:`Park until resumed`}),(0,Y.jsx)(`option`,{value:`interval`,children:`Re-check on an interval`})]}),o===`interval`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`input`,{type:`number`,min:Vm,max:Hm,"aria-label":`Wake interval in minutes`,"data-slot":`resources-monitoring-wake-interval`,value:c,disabled:n.isPending,onChange:e=>l(e.target.value),className:`block w-24 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,Y.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`minutes`})]}):null,(0,Y.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,"data-action":`resources-save-monitoring-wake`,disabled:f||o===`interval`&&d||n.isPending,onClick:p,children:`Save`})]}),o===`interval`&&d?(0,Y.jsx)(`p`,{"data-slot":`resources-monitoring-wake-invalid`,className:`text-[11px] text-danger`,children:`Enter a whole number from 1 to 60 minutes.`}):(0,Y.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Applied consistently to Claude, Codex and OpenCode.`})]}),(0,Y.jsxs)($,{title:`Auto-resume after a usage limit`,hint:`When an agent stops because its provider usage limit is reached, xezar waits for the reset the provider named and continues the task 30 seconds later — up to 12 times in a row without you. Off leaves the task failed with its Continue button.`,children:[(0,Y.jsxs)(`select`,{"aria-label":`Auto-resume after a usage limit`,"data-slot":`resources-auto-resume`,value:m?`on`:`off`,disabled:n.isPending,onChange:e=>h(e.target.value===`on`),className:`block w-28 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,Y.jsx)(`option`,{value:`on`,children:`On`}),(0,Y.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,Y.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Applies to Claude, Codex and OpenCode — whenever the provider says when the limit lifts.`})]}),(0,Y.jsxs)($,{title:`Waiting tasks close after`,hint:`A task that finishes a turn and waits for you keeps its agent session open. When nothing arrives for this long, xezar closes the session; the task stays where it is and Continue picks it back up.`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(`select`,{"aria-label":`Idle session behaviour`,"data-slot":`resources-idle-mode`,value:_,disabled:n.isPending,onChange:e=>v(e.target.value),className:`block w-40 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,Y.jsx)(`option`,{value:`timeout`,children:`Close after`}),(0,Y.jsx)(`option`,{value:`never`,children:`Never close`})]}),_===`timeout`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:Wm,max:Gm,step:5,"aria-label":`Idle timeout in minutes`,"data-slot":`resources-idle-timeout`,value:y,disabled:n.isPending,onChange:e=>b(e.target.value),className:`block w-32 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,Y.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`minutes`})]}):null,(0,Y.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,"data-action":`resources-save-idle-timeout`,disabled:C||_===`timeout`&&S||n.isPending,onClick:w,children:`Save`})]}),_===`timeout`&&S?(0,Y.jsxs)(`p`,{"data-slot":`resources-idle-invalid`,className:`text-[11px] text-danger`,children:[`Enter a whole number of minutes from `,Wm,` to `,Gm,`.`]}):_===`never`?(0,Y.jsx)(`p`,{"data-slot":`resources-idle-never-warning`,className:`text-[11px] text-warning`,children:`Nothing will reclaim these sessions. A waiting task holds no parallel-task slot, so your queue keeps moving, but its agent process stays alive and keeps using memory until you send it a message or cancel it. Default: 15 minutes.`}):(0,Y.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Default: 15 minutes. Raise it if your tasks do long stretches of work between turns.`})]}),(0,Y.jsxs)($,{title:`Per-task memory limit`,hint:`When a task's whole process tree crosses this, the engine pauses it with a warning and starts the next queued task. Leave empty for no limit.`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:Um,step:256,"aria-label":`Per-task memory limit in MiB`,"data-slot":`resources-memory-limit`,value:r,disabled:n.isPending,placeholder:`no limit`,onChange:e=>i(e.target.value),className:`block w-32 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,Y.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`MiB`}),(0,Y.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,"data-action":`resources-save-memory`,disabled:ue||le||n.isPending,onClick:de,children:`Save`})]}),le?(0,Y.jsxs)(`p`,{"data-slot":`resources-memory-invalid`,className:`text-[11px] text-danger`,children:[`Enter a whole number of at least `,Um,` MiB, or leave empty for no limit.`]}):(0,Y.jsxs)(`p`,{className:`text-[11px] text-soft-foreground`,children:[`Applies to newly started tasks. This machine's default is`,` `,(0,Y.jsx)(`span`,{"data-slot":`resources-memory-default`,children:e.resources.memoryLimitDefaultMb}),` MiB, sized from its total memory — a project can set a lower one of its own in its Settings.`]})]}),(0,Y.jsxs)($,{title:`Keep last N worktrees, by default`,hint:`What a NEW project keeps on disk when it has not chosen for itself. Each project can override this in its own Worktrees settings; 0 = unlimited.`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:Km,max:qm,step:1,"aria-label":`Default worktrees kept per project`,"data-slot":`resources-worktree-retention-default`,value:T,disabled:n.isPending,onChange:e=>E(e.target.value),className:`block w-32 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,Y.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`worktrees`}),(0,Y.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,"data-action":`resources-save-retention-default`,disabled:te||ee||n.isPending,onClick:ne,children:`Save`})]}),ee?(0,Y.jsxs)(`p`,{"data-slot":`resources-retention-default-invalid`,className:`text-[11px] text-danger`,children:[`Enter a whole number from `,Km,` to `,qm,` (0 = unlimited).`]}):(0,Y.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`A project that already set its own keep-limit is not affected.`})]}),(0,Y.jsxs)($,{title:`Follow-up Inbox`,hint:`When on, agents are asked to leave follow-ups when they finish and the Inbox view appears. Each task's own Notes journal runs either way.`,children:[(0,Y.jsxs)(`select`,{"aria-label":`Follow-up Inbox`,"data-slot":`resources-followups`,value:e.followups===null?`inherit`:e.followups?`on`:`off`,disabled:n.isPending,onChange:e=>re(e.target.value===`inherit`?null:e.target.value===`on`),className:`block w-40 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,Y.jsx)(`option`,{value:`on`,children:`On`}),(0,Y.jsx)(`option`,{value:`off`,children:`Off`}),(0,Y.jsx)(`option`,{value:`inherit`,children:`Follow XEZ_FOLLOWUPS`})]}),(0,Y.jsxs)(`p`,{className:`text-[11px] text-soft-foreground`,children:[`Currently `,e.effectiveFollowups?`on`:`off`,e.followups===null?` (from the environment)`:``,`. Takes effect for the next task with no restart; already-open cockpit tabs pick up live Inbox updates after a refresh.`]})]}),(0,Y.jsxs)($,{title:`Extra variables agents receive`,hint:`Agents get a least-privilege environment by default — safe shell and toolchain variables, the backend's own auth, GITHUB_TOKEN and xezar's own. Name any others here, comma-separated.`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`input`,{type:`text`,"aria-label":`Extra environment variable names for agents`,"data-slot":`resources-env-passthrough`,value:ae,disabled:n.isPending,placeholder:`VITEST_MAX_WORKERS, MY_TOOL_DIR`,onChange:e=>k(e.target.value),className:`block w-full rounded-md border border-input bg-card px-3 py-1.5 font-mono text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,"data-action":`resources-save-env-passthrough`,disabled:se||oe||n.isPending,onClick:ce,children:`Save`}),(0,Y.jsx)(L,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`resources-clear-env-passthrough`,disabled:e.agentEnvPassthrough===null||n.isPending,onClick:j,children:`Follow XEZ_ENV_PASSTHROUGH`})]})]}),oe?(0,Y.jsxs)(`p`,{"data-slot":`resources-env-passthrough-invalid`,className:`text-[11px] text-danger`,children:[`Use variable NAMES only (letters, digits and underscores), at most `,Ym,` `,`of them — never their values.`]}):(0,Y.jsxs)(`p`,{className:`text-[11px] text-soft-foreground`,children:[`Names only — the values come from this machine's environment and are never stored here. Currently forwarding:`,` `,(0,Y.jsx)(`span`,{"data-slot":`resources-env-passthrough-effective`,children:e.effectiveAgentEnvPassthrough.length>0?e.effectiveAgentEnvPassthrough.join(`, `):`nothing extra`}),e.agentEnvPassthrough===null?` (from the environment)`:``,`. Applies to the next task, with no restart.`]})]}),(0,Y.jsxs)($,{title:`New task defaults`,hint:`Set stable composer defaults across projects. Explicit choices and run-shape constraints still win.`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,"data-slot":`resources-composer-defaults`,children:[(0,Y.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`Autonomous by default`}),(0,Y.jsxs)(`select`,{"aria-label":`Autonomous by default`,value:fe.autonomous===null?`inherit`:fe.autonomous?`on`:`off`,disabled:n.isPending,onChange:e=>pe(`autonomous`,e.target.value),className:`rounded-md border border-input bg-card px-3 py-1.5 shadow-xs outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,Y.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,Y.jsx)(`option`,{value:`on`,children:`On`}),(0,Y.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,Y.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[`Inherited: `,fe.inheritedAutonomous===`source-dependent`?`Source-dependent — skills on, workflows off`:fe.inheritedAutonomous?`On`:`Off`]})]}),(0,Y.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`Use a worktree by default`}),(0,Y.jsxs)(`select`,{"aria-label":`Use a worktree by default`,value:fe.worktree===null?`inherit`:fe.worktree?`on`:`off`,disabled:n.isPending,onChange:e=>pe(`worktree`,e.target.value),className:`rounded-md border border-input bg-card px-3 py-1.5 shadow-xs outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,Y.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,Y.jsx)(`option`,{value:`on`,children:`On`}),(0,Y.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,Y.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[`Inherited: `,fe.inheritedWorktree?`On`:`Off`]})]})]}),(0,Y.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Interactive skills may recommend both off. Multi-step and parallel runs remain isolated.`})]})]})}function Qm(){let e=re(),t=R().data?.bootProject??``,n=l(t,!!t);return e.isPending?(0,Y.jsx)(`p`,{"data-slot":`skills-settings-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading skill settings…`}):e.isError?(0,Y.jsx)(V,{icon:(0,Y.jsx)(bo,{}),tone:`danger`,title:`Skill settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,Y.jsx)($m,{config:e.data,update:n.data,updateError:n.error})}function $m({config:e,update:t,updateError:n}){let r=O(),i=P({mutationFn:e=>ut(e),onSuccess:e=>r.setQueryData(F.config,e),onError:e=>z(e.message,{tone:`danger`})}),a=e.skillsAutoUpdate===null,o=(()=>{if(n)return`Installation status is unavailable right now.`;if(!t)return`Checking tracked Open Mercato installations…`;if(t.status===`unavailable`)return t.scopes.find(e=>e.reason)?.reason??`Automatic skill updates are unavailable.`;if(t.scopes.every(e=>e.skills.length===0))return`No tracked Open Mercato installation found.`;let e=new Set(t.scopes.flatMap(e=>e.skills)).size;return`${e} tracked Open Mercato skill${e===1?``:`s`} found.`})();return(0,Y.jsx)(`div`,{"data-slot":`skills-settings-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-4 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:(0,Y.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:(0,Y.jsx)(`label`,{htmlFor:`skills-auto-update`,children:`Update Open Mercato skills automatically`})}),(0,Y.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Checks installed Open Mercato skills in the background and applies available updates. Other skills and untracked folders are never changed.`})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-1`,children:[(0,Y.jsx)(hf,{id:`skills-auto-update`,"data-slot":`skills-auto-update`,checked:e.effectiveSkillsAutoUpdate,disabled:i.isPending,onCheckedChange:e=>i.mutate({skillsAutoUpdate:e})}),(0,Y.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[e.effectiveSkillsAutoUpdate?`On`:`Off`,a?` (default)`:``]})]})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-md border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground`,children:[(0,Y.jsx)(`span`,{children:a?`No override is saved. XEZ_SKILLS_AUTO_UPDATE supplies the inherited default when set; otherwise it is on.`:`An explicit workspace override is saved.`}),(0,Y.jsx)(L,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`skills-use-default`,disabled:a||i.isPending,onClick:()=>i.mutate({skillsAutoUpdate:null}),children:`Use default`})]}),(0,Y.jsx)(`p`,{"data-slot":`skills-installation-status`,role:n||t?.status===`unavailable`?`status`:void 0,className:`text-[13px] text-soft-foreground`,children:o})]})})}function eh(){let e=te(),t=O(),[n,r]=(0,J.useState)(null),i=()=>t.invalidateQueries({queryKey:B.worktrees}),a=P({mutationFn:()=>Re(),onSuccess:e=>{i(),z(e.reclaimed.length===0?`Nothing to reclaim — all worktrees are within the limit`:`Reclaimed ${e.reclaimed.length} worktree${e.reclaimed.length===1?``:`s`} (branch kept)`)},onError:e=>z(e.message,{tone:`danger`})}),o=P({mutationFn:e=>$t(e),onSuccess:()=>{i(),z(`Worktree removed`)},onError:e=>z(e.message,{tone:`danger`})});if(e.isPending)return(0,Y.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading worktrees…`});if(e.isError)return(0,Y.jsxs)(`p`,{"data-slot":`worktrees-error`,className:`text-[13px] text-danger`,children:[`Worktrees did not load: `,e.error.message]});let{worktrees:s,totalBytes:c,keep:l}=e.data,u=a.isPending||o.isPending;return(0,Y.jsxs)(`div`,{"data-slot":`worktrees-panel`,className:`flex flex-col gap-3`,children:[s.length===0?(0,Y.jsx)(`p`,{"data-slot":`worktrees-empty`,className:`text-[13px] text-soft-foreground`,children:`No task worktrees on disk.`}):(0,Y.jsx)(`div`,{className:`overflow-x-auto rounded-md border border-border`,children:(0,Y.jsxs)(`table`,{className:`w-full border-collapse text-sm`,children:[(0,Y.jsx)(`caption`,{className:`sr-only`,children:`Task worktrees currently materialized on disk`}),(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{className:`border-b border-border text-left text-[12px] text-soft-foreground`,children:[(0,Y.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Task`}),(0,Y.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Status`}),(0,Y.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Size`}),(0,Y.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Age`}),(0,Y.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium text-right`,children:`Actions`})]})}),(0,Y.jsx)(`tbody`,{children:s.map(e=>(0,Y.jsx)(th,{worktree:e,disabled:u,onDelete:()=>r({kind:`delete`,runId:e.runId,title:e.title})},e.runId))})]})}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Y.jsxs)(`p`,{"data-slot":`worktrees-footer`,className:`text-[12px] text-soft-foreground`,children:[s.length,` worktree`,s.length===1?``:`s`,c===null?` · size unavailable`:` · ${It(c)||`0 kB`} on disk`,` · `,l===0?`keeping all (unlimited)`:`keeping the last ${l}`]}),(0,Y.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,"data-action":`worktrees-reclaim-now`,disabled:u,onClick:()=>r({kind:`reclaim`}),children:`Reclaim now`})]}),(0,Y.jsx)(_i,{open:n!==null,onOpenChange:e=>!e&&r(null),children:(0,Y.jsxs)(fi,{children:[(0,Y.jsxs)(gi,{children:[(0,Y.jsx)(di,{children:n?.kind===`delete`?`Delete this worktree?`:`Reclaim old worktrees?`}),(0,Y.jsx)(ui,{children:n?.kind===`delete`?(0,Y.jsxs)(Y.Fragment,{children:[`This removes the worktree directory and its branch — the local-only work is not recoverable afterwards.`,(0,Y.jsx)(`span`,{className:`mt-1 block truncate font-medium text-foreground`,title:n.title,children:n.title})]}):`Finished worktrees beyond the keep-limit are reclaimed now (directory only). Their branches are kept, so the work stays recoverable.`})]}),(0,Y.jsxs)(mi,{children:[(0,Y.jsx)(hi,{children:`Keep it`}),(0,Y.jsx)(pi,{"data-action":`worktrees-confirm`,className:n?.kind===`delete`?`bg-danger text-danger-foreground hover:brightness-[0.96]`:void 0,onClick:()=>{n?.kind===`reclaim`?a.mutate():n?.kind===`delete`&&o.mutate(n.runId),r(null)},children:n?.kind===`delete`?`Delete`:`Reclaim now`})]})]})})]})}function th({worktree:e,disabled:t,onDelete:n}){return(0,Y.jsxs)(`tr`,{"data-slot":`worktree-row`,"data-run":e.runId,className:`border-b border-border last:border-0`,children:[(0,Y.jsxs)(`th`,{scope:`row`,className:`max-w-[220px] px-3 py-2 text-left font-normal`,children:[(0,Y.jsx)(`span`,{className:`block truncate text-foreground`,title:e.title,children:e.title}),(0,Y.jsx)(`span`,{className:`block truncate font-mono text-[11px] text-soft-foreground`,children:e.branch??e.runId.slice(0,8)})]}),(0,Y.jsxs)(`td`,{className:`px-3 py-2`,children:[(0,Y.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:e.status}),e.reclaimable?(0,Y.jsx)(`span`,{"data-slot":`worktree-reclaimable`,className:`ml-1 text-[11px] text-soft-foreground`,children:`(reclaimable)`}):null]}),(0,Y.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:e.sizeBytes===null?`—`:It(e.sizeBytes)||`0 kB`}),(0,Y.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:Vi(e.finishedAt??void 0)||`—`}),(0,Y.jsx)(`td`,{className:`px-3 py-2 text-right`,children:(0,Y.jsx)(L,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`worktree-delete`,"aria-label":`Delete the worktree for ${e.title}`,disabled:t,onClick:n,children:`Delete`})})]})}var nh=0,rh=1e3;function ih(){let e=tn();return e.isPending?(0,Y.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading worktree settings…`}):e.isError?(0,Y.jsx)(V,{icon:(0,Y.jsx)($a,{}),tone:`danger`,title:`Worktree settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,Y.jsx)(ah,{config:e.data})}function ah({config:e}){let t=O(),n=P({mutationFn:e=>kt(e),onSuccess:e=>t.setQueryData(B.config,e),onError:e=>z(e.message,{tone:`danger`})}),[r,i]=(0,J.useState)(String(e.worktreeRetention)),a=Number(r),o=r.trim()===``||!Number.isInteger(a)||a<nh||a>rh,s=e.worktreeRetention===(o?-1:a);return(0,Y.jsxs)(`div`,{"data-slot":`worktrees-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,Y.jsxs)($,{title:`Keep last N worktrees`,hint:`Older finished worktrees are reclaimed to free disk; their branch is kept so the work stays recoverable. 0 = unlimited. In-review and running tasks are never reclaimed, so the count on disk can exceed this.`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:nh,max:rh,step:1,"aria-label":`Keep last N finished worktrees`,"data-slot":`resources-worktree-retention`,value:r,disabled:n.isPending,onChange:e=>i(e.target.value),className:`block w-32 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,Y.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`worktrees`}),(0,Y.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,"data-action":`resources-save-retention`,disabled:s||o||n.isPending,onClick:()=>n.mutate({worktreeRetention:a},{onSuccess:()=>{t.invalidateQueries({queryKey:B.worktrees}),z(a===0?`Keeping all worktrees (unlimited)`:`Keeping the last ${a} finished worktree${a===1?``:`s`}`)}}),children:`Save`})]}),o?(0,Y.jsxs)(`p`,{"data-slot":`resources-retention-invalid`,className:`text-[11px] text-danger`,children:[`Enter a whole number from `,nh,` to `,rh,` (0 = unlimited).`]}):(0,Y.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:a===0?`Keeping every finished worktree.`:`Keeping the last ${a} finished worktree${a===1?``:`s`} on disk.`})]}),(0,Y.jsx)($,{title:`Worktrees`,hint:`Task worktrees currently on disk. Delete one to reclaim its space now, or reclaim everything past the keep-limit at once. Branches are always kept, so the work stays recoverable.`,children:(0,Y.jsx)(eh,{})})]})}function oh(e,t){return function(){return(0,Y.jsx)(V,{icon:(0,Y.jsx)(t,{}),tone:`neutral`,title:e,subtitle:`This section arrives in a later phase of the redesign.`,heading:`h2`})}}var sh=[{id:`agents`,title:`Agents`,description:`Default runner, models and system prompt.`,icon:xn,component:wf,scope:`project`},{id:`agent-config`,title:`Agent config`,description:`Edit the coding agents’ own config files, per scope.`,icon:Za,component:uf,scope:`project`},{id:`worktrees`,title:`Worktrees`,description:`How many finished task worktrees this project keeps on disk.`,icon:$a,component:ih,scope:`project`},{id:`bookmarklets`,title:`Bookmarklets`,description:`Launch skills from a GitHub PR or issue.`,icon:Ra,component:$f,scope:`project`},{id:`prompt-templates`,title:`Prompt templates`,description:`Reusable snippets for follow-up instructions.`,icon:yo,component:Im,scope:`project`},{id:`mcp-connection`,title:`MCP connection`,description:`Which project the MCP leader is bound to, and one-time client setup.`,icon:Co,component:mm,scope:`project`},{id:`mcp-api`,title:`MCP API`,description:`Every tool the MCP server exposes, read-only. Nothing here runs a tool.`,icon:La,component:cp,scope:`project`},{id:`appearance`,title:`Appearance`,description:`Theme, accent and density.`,icon:xo,component:Xf,scope:`global`},{id:`notifications`,title:`Notifications`,description:`Browser notifications when an agent needs you.`,icon:Ia,component:Cm,scope:`global`},{id:`resources`,title:`Resources`,description:`Parallel tasks and per-task memory limit, across every project.`,icon:ro,component:Xm,scope:`global`},{id:`skills`,title:`Skills`,description:`Updates for skills installed on this machine.`,icon:bo,component:Qm,scope:`global`},{id:`accounts`,title:`Agent accounts`,description:`Second logins, and the agent and models a project uses when it has chosen none.`,icon:so,component:Kd,scope:`global`},{id:`projects`,title:`Projects`,description:`The workspace registry and where GitHub checkouts land.`,icon:no,component:km,scope:`global`},{id:`keyboard`,title:`Keyboard`,description:`Shortcuts.`,icon:lo,component:oh(`Keyboard`,lo),scope:`global`,hidden:!0}];function ch(e,t){return sh.filter(n=>!n.hidden&&n.scope===e&&!(t?.singleProject===!0&&n.id===`projects`))}function lh(){let e=Ni(),t=R().data;return e===null?null:t?.projects.find(t=>t.id===e)?.root??null}function uh(e){navigator.clipboard.writeText(e).then(()=>z(`Project folder copied`)).catch(()=>z(e))}function dh(){let e=lh();return e===null?null:(0,Y.jsx)($,{title:`Project folder`,hint:`Where this project lives on disk. Every task worktree, git command and agent run resolves against it.`,children:(0,Y.jsxs)(`div`,{"data-slot":`project-location`,"data-variant":`field`,className:`flex items-start gap-3 rounded-md border border-border bg-card p-3`,children:[(0,Y.jsx)(`span`,{"data-slot":`project-location-path`,className:`min-w-0 flex-1 font-mono text-xs break-all text-foreground`,children:e}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,Y.jsx)(`button`,{type:`button`,"data-action":`project-location-copy`,title:`Copy the project folder path`,onClick:()=>uh(e),className:`text-xs font-medium text-muted-foreground transition-colors hover:text-foreground`,children:`Copy`}),(0,Y.jsx)(ph,{root:e})]})]})})}function fh(){let e=lh();return e===null?null:(0,Y.jsxs)(`div`,{"data-slot":`project-location`,"data-variant":`nav`,className:`mt-auto px-2.5 pt-3`,children:[(0,Y.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Project folder`}),(0,Y.jsx)(`button`,{type:`button`,"data-action":`project-location-copy`,title:`${e} — click to copy`,onClick:()=>uh(e),className:`block w-full truncate text-left font-mono text-[11px] text-muted-foreground transition-colors hover:text-foreground`,children:e})]})}function ph({root:e}){let t=He(),n=P({mutationFn:e=>pt(e),onError:e=>z(e.message,{tone:`danger`})}),r=(t.data?.targets??[]).filter(e=>Dn(e.id)===void 0).map(e=>({target:e}));return r.length===0?null:(0,Y.jsx)(An,{slot:`project-location-open`,label:`Open with`,triggerVariant:`outline`,title:e,disabled:n.isPending,choices:r,onPick:e=>n.mutate(e,{onSuccess:()=>z(`Opening the project folder in ${r.find(t=>t.target.id===e)?.target.label??e}`)})})}function mh(e){let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`})}function hh({capabilities:e}){let t=Ni(),n=R(),r=re();if(n.isPending)return(0,Y.jsx)(`p`,{"data-slot":`project-general-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading project…`});if(n.isError)return(0,Y.jsxs)(`p`,{"data-slot":`project-general-error`,className:`text-[13px] text-danger`,children:[`Could not read the project registry — `,n.error.message]});let i=n.data,a=i?.projects.find(e=>e.id===t);if(!i||!a)return null;let o=e?.singleProject!==!0;return(0,Y.jsxs)(`div`,{"data-slot":`project-general`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7`,children:[(0,Y.jsx)(dh,{}),(0,Y.jsx)(gh,{project:a,canRemove:o}),o?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)($,{title:`Max parallel tasks`,hint:r.data?`How many of this project's tasks may run at once. The workspace limit (${r.data.resources.maxParallel}) still applies as an overall ceiling, so a higher value here has no extra effect until that one is raised.`:`How many of this project's tasks may run at once. The workspace limit still applies as an overall ceiling.`,children:r.data?(0,Y.jsx)(Fm,{project:a,workspaceMax:r.data.resources.maxParallel}):(0,Y.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Loading the workspace limit…`})}),(0,Y.jsx)(_h,{project:a,bootProject:i.bootProject})]}):null]})}function gh({project:e,canRemove:t}){return(0,Y.jsx)($,{title:`Project`,hint:`The registry entry for this checkout — re-probed every time the project list is read.`,children:(0,Y.jsxs)(`dl`,{"data-slot":`project-facts`,className:`grid grid-cols-[8rem_minmax(0,1fr)] gap-x-3 gap-y-1.5 rounded-md border border-border bg-card p-3 text-[13px]`,children:[(0,Y.jsx)(`dt`,{className:`text-muted-foreground`,children:`Name`}),(0,Y.jsx)(`dd`,{className:`min-w-0 truncate text-foreground`,children:e.name}),(0,Y.jsx)(`dt`,{className:`text-muted-foreground`,children:`Status`}),(0,Y.jsxs)(`dd`,{"data-slot":`project-general-status`,className:e.status===`missing`?`text-danger`:`text-foreground`,children:[Dm[e.status],e.status===`missing`?t?` — remove it below, or restore the folder`:` — restore the folder at the path above`:null]}),e.branch===void 0?null:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`dt`,{className:`text-muted-foreground`,children:`Branch`}),(0,Y.jsx)(`dd`,{className:`min-w-0 truncate font-mono text-xs text-foreground`,children:e.branch})]}),(0,Y.jsx)(`dt`,{className:`text-muted-foreground`,children:`Added`}),(0,Y.jsxs)(`dd`,{className:`text-foreground`,children:[mh(e.addedAt),(0,Y.jsx)(`span`,{className:`text-soft-foreground`,children:e.source===`checkout`?` · cloned from GitHub`:` · opened locally`})]}),(0,Y.jsx)(`dt`,{className:`text-muted-foreground`,children:`Last opened`}),(0,Y.jsx)(`dd`,{className:`text-foreground`,children:mh(e.lastOpenedAt)})]})})}function _h({project:e,bootProject:t}){let[n,r]=(0,J.useState)(null),i=wm(),a=Oe(),o=e.id===t;return(0,Y.jsxs)($,{title:`Remove from workspace`,hint:`Unregisters this project so it leaves the sidebar and the project list. Nothing on disk is deleted — the folder, its git history and its task history all stay, and opening it again re-registers it.`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsxs)(L,{type:`button`,variant:`outline`,size:`sm`,"data-action":`project-general-remove`,"aria-label":`Remove ${e.name} from the workspace — unregisters it, no files are deleted`,title:o?`xezar is serving this project — it re-registers itself at every start`:void 0,disabled:o||i.isPending,onClick:()=>r(e),className:`text-danger`,children:[`Remove `,e.name]}),o?(0,Y.jsx)(`span`,{"data-slot":`project-general-remove-boot`,className:`text-[11px] text-soft-foreground`,children:`xezar is serving this project — it re-registers itself at every start.`}):null]}),(0,Y.jsx)(Tm,{project:n,onOpenChange:e=>!e&&r(null),onConfirm:()=>{r(null),i.confirm(e,()=>void a(`/p/${encodeURIComponent(t)}`))}})]})}function vh(e,t){return e===`global`?`/settings/global/${t}`:`/settings/${t}`}function yh(e){return e===`global`?`/settings/global`:`/settings`}function bh(e){return e===`global`?{Link:M,NavLink:pe}:{Link:K,NavLink:Ai}}function xh({scope:e,activeId:t,capabilities:n}){let{NavLink:r}=bh(e);return(0,Y.jsxs)(`nav`,{"aria-label":`Settings sections`,"data-slot":`settings-nav`,"data-scope":e,className:`hidden w-52 shrink-0 flex-col gap-1 border-r border-border p-3 md:flex`,children:[(0,Y.jsxs)(r,{to:yh(e),end:!0,"data-slot":`settings-nav-index`,"aria-current":t===null?`page`:void 0,className:U(`flex items-center gap-2.5 rounded-md px-2.5 py-2 text-[13px] font-medium transition-colors`,t===null?`bg-muted text-foreground`:`text-muted-foreground hover:bg-muted/60 hover:text-foreground`),children:[(0,Y.jsx)(Ao,{"aria-hidden":`true`,className:`size-4 shrink-0`}),`General`]}),ch(e,n).map(n=>(0,Y.jsxs)(r,{to:vh(e,n.id),"data-section":n.id,"aria-current":n.id===t?`page`:void 0,className:U(`flex items-center gap-2.5 rounded-md px-2.5 py-2 text-[13px] font-medium transition-colors`,n.id===t?`bg-muted text-foreground`:`text-muted-foreground hover:bg-muted/60 hover:text-foreground`),children:[(0,Y.jsx)(n.icon,{"aria-hidden":`true`,className:`size-4 shrink-0`}),n.title]},n.id)),e===`global`?(0,Y.jsx)(`p`,{className:`mt-auto px-2.5 pt-3 text-[11px] text-soft-foreground`,children:`Stored in ~/.xezar`}):(0,Y.jsx)(fh,{})]})}function Sh({scope:e,activeId:t,capabilities:n}){let{NavLink:r}=bh(e);return(0,Y.jsxs)(`nav`,{"aria-label":`Settings sections`,"data-slot":`settings-nav-mobile`,className:`flex shrink-0 gap-1.5 overflow-x-auto border-b border-border px-3 py-2.5 md:hidden`,children:[(0,Y.jsx)(r,{to:yh(e),end:!0,"data-slot":`settings-nav-index`,className:`rounded-full border border-border bg-card px-3 py-1.5 text-[13px] font-medium whitespace-nowrap text-muted-foreground transition-colors`,children:`General`}),ch(e,n).map(n=>(0,Y.jsx)(r,{to:vh(e,n.id),"data-section":n.id,"aria-current":n.id===t?`page`:void 0,className:U(`rounded-full border px-3 py-1.5 text-[13px] font-medium whitespace-nowrap transition-colors`,n.id===t?`border-transparent bg-contrast text-contrast-foreground`:`border-border bg-card text-muted-foreground`),children:n.title},n.id))]})}function Ch({section:e,scope:t,capabilities:n}){let r=e.component;return(0,Y.jsxs)(`div`,{"data-route":t===`global`?`settings-global-${e.id}`:`settings-${e.id}`,className:`flex min-h-full flex-col`,children:[(0,Y.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,Y.jsx)(`h1`,{className:`text-base font-semibold`,children:e.title}),(0,Y.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:e.description}),t===`global`?(0,Y.jsx)(`span`,{"data-slot":`settings-scope-chip`,className:`ml-auto text-[11px] text-soft-foreground`,children:`Global settings`}):null]}),(0,Y.jsxs)(`div`,{className:`flex flex-1 flex-col md:flex-row`,children:[(0,Y.jsx)(xh,{scope:t,activeId:e.id,capabilities:n}),(0,Y.jsx)(Sh,{scope:t,activeId:e.id,capabilities:n}),(0,Y.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:(0,Y.jsx)(r,{})})]})]})}function wh({scope:e,capabilities:t}){let{Link:n}=bh(e),r=e===`global`;return(0,Y.jsxs)(`div`,{"data-route":r?`settings-global`:`settings`,className:`flex min-h-full flex-col`,children:[(0,Y.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,Y.jsx)(`h1`,{className:`text-base font-semibold`,children:r?`Global settings`:`Settings`}),(0,Y.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:r?`Preferences for you and this machine, shared by every project.`:`Configure this project and its agents.`})]}),(0,Y.jsxs)(`div`,{className:`flex flex-1 flex-col md:flex-row`,children:[(0,Y.jsx)(xh,{scope:e,activeId:null,capabilities:t}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col p-3 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-5 md:pb-5`,children:[r?null:(0,Y.jsx)(hh,{capabilities:t}),(0,Y.jsx)(`ul`,{"data-slot":`settings-index`,className:U(`mx-auto flex w-full max-w-2xl flex-col gap-2.5`,r?null:`mt-7 md:hidden`),children:ch(e,t).map(t=>(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(n,{to:vh(e,t.id),"data-section":t.id,className:`flex items-center gap-3.5 rounded-lg border border-border bg-card p-4 shadow-xs transition-colors hover:bg-card-2`,children:[(0,Y.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-md border border-border bg-muted text-muted-foreground`,children:(0,Y.jsx)(t.icon,{"aria-hidden":`true`,className:`size-4`})}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:t.title}),(0,Y.jsx)(`span`,{className:`block text-xs text-soft-foreground`,children:t.description})]}),(0,Y.jsx)(vr,{"aria-hidden":`true`,className:`size-4 shrink-0 text-soft-foreground`})]})},t.id))}),(0,Y.jsx)(`p`,{className:`mx-auto mt-4 w-full max-w-2xl text-[12px] text-soft-foreground`,children:r?(0,Y.jsx)(Y.Fragment,{children:`Agents, worktrees, bookmarklets and prompt templates are per project.`}):(0,Y.jsxs)(Y.Fragment,{children:[`Appearance, notifications, host resources and the project registry live in`,` `,(0,Y.jsx)(M,{to:yh(`global`),"data-slot":`settings-global-link`,className:`underline underline-offset-2 hover:text-foreground`,children:`Global settings`}),`.`]})})]})]})]})}function Th({delayDuration:e=0,...t}){return(0,Y.jsx)(ic,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function Eh({...e}){return(0,Y.jsx)(ac,{"data-slot":`tooltip`,...e})}function Dh({...e}){return(0,Y.jsx)(oc,{"data-slot":`tooltip-trigger`,...e})}function Oh({className:e,sideOffset:t=0,children:n,...r}){return(0,Y.jsx)(sc,{children:(0,Y.jsxs)(cc,{"data-slot":`tooltip-content`,sideOffset:t,className:U(`z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-contrast px-3 py-1.5 text-xs text-balance text-contrast-foreground fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95`,e),...r,children:[n,(0,Y.jsx)(lc,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-contrast fill-contrast`})]})})}function kh({runner:e,inherited:t,backends:n=0}){let r=Sn(e,n),i=n>1;return(0,Y.jsx)(`span`,{"data-slot":`task-tool`,"data-runner":e,"data-inherited":t||void 0,"data-mixed":i||void 0,title:i?`${r} — this run's steps used ${n} different backends`:t?`${r} — inherited; this task did not choose a runner`:void 0,className:U(`block truncate text-[12.5px]`,t?`text-soft-foreground`:`text-muted-foreground`),children:r})}function Ah({model:e}){let{text:t,auto:n}=Fn(e);return(0,Y.jsx)(`span`,{"data-slot":`task-model`,"data-inherited":n||void 0,title:n?`auto — no model was recorded; the backend picked one`:t,className:U(`block truncate font-mono text-[11.5px]`,n?`text-soft-foreground`:`text-muted-foreground`),children:t})}var jh=[{id:`status`,label:`Status`,canFold:!1,defaultExpanded:!0,align:`left`,width:`116px`},{id:`task`,label:`Task`,canFold:!1,defaultExpanded:!0,align:`left`},{id:`workflow`,label:`Workflow`,canFold:!0,defaultExpanded:!0,align:`left`,width:`124px`,icon:`workflow`},{id:`tool`,label:`Tool Name`,canFold:!0,defaultExpanded:!0,align:`left`,width:`124px`,icon:`tool`},{id:`model`,label:`Model`,canFold:!0,defaultExpanded:!0,align:`left`,width:`112px`,icon:`model`},{id:`branch`,label:`Branch`,canFold:!0,defaultExpanded:!1,align:`left`,width:`128px`,icon:`branch`},{id:`diff`,label:`±`,canFold:!0,defaultExpanded:!0,align:`left`,width:`78px`,icon:`diff`},{id:`reference`,label:`Ref`,canFold:!0,defaultExpanded:!0,align:`left`,width:`76px`,icon:`reference`},{id:`tokens`,label:`IN / OUT`,canFold:!0,defaultExpanded:!0,align:`right`,width:`112px`,icon:`tokens`,capability:`tokens`},{id:`cost`,label:`Cost`,canFold:!0,defaultExpanded:!0,align:`right`,width:`76px`,icon:`cost`,capability:`cost`},{id:`cpu`,label:`CPU`,canFold:!0,defaultExpanded:!0,align:`right`,width:`68px`,icon:`cpu`},{id:`memory`,label:`Mem`,canFold:!0,defaultExpanded:!0,align:`right`,width:`88px`,icon:`memory`},{id:`started`,label:`Started`,canFold:!0,defaultExpanded:!0,align:`right`,width:`82px`,icon:`started`}],Mh=new Map(jh.map(e=>[e.id,e]));function Nh(e){return typeof e!=`object`||!e||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`boolean`))}function Ph(e){let t={};for(let[n,r]of Object.entries(Nh(e))){let e=Mh.get(n);e?.canFold&&(t[e.id]=r)}return t}function Fh(e,t){let n=Mh.get(e);return!n||!n.canFold?!0:t[e]??n.defaultExpanded}function Ih(e,t){let n=Nh(e);return Mh.get(t)?.canFold?{...n,[t]:!Fh(t,Ph(e))}:n}function Lh(e){return jh.filter(t=>t.capability===void 0||e[t.capability])}function Rh(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function zh(){let e=O(),t=Nt(),n=J.useRef(0),r=J.useRef(0),i=J.useRef(Promise.resolve()),a=J.useMemo(()=>Ph(t.data?.taskTable?.expandedColumns),[t.data?.taskTable?.expandedColumns]),o=J.useCallback(t=>{if(!jh.find(e=>e.id===t)?.canFold)return;let a=e.getQueryData(F.uiState);if(a===void 0)return;let o=Rh(a?.taskTable),s={...o,expandedColumns:Ih(o.expandedColumns,t)};e.setQueryData(F.uiState,{...a,taskTable:s});let c=++n.current;r.current=c;let l=i.current.then(async()=>{let t=await st({taskTable:s},{keepalive:!0});c===r.current&&e.setQueryData(F.uiState,t)});i.current=l.catch(t=>{z(t instanceof Error?t.message:String(t),{tone:`danger`}),c===r.current&&e.invalidateQueries({queryKey:F.uiState})})},[e]);return{expandedColumns:a,isExpanded:J.useCallback(e=>Fh(e,a),[a]),toggleColumn:o,isPending:t.isPending}}function Bh({runs:e,view:t,onViewChange:n,onArchiveFinished:r,onMarkAllRead:a,onRename:o,onTogglePin:s,now:c=Date.now(),showTokens:l=!0,showCost:u=!0,defaultRunner:d,expandedColumns:f=Ph(void 0),onToggleColumn:p=()=>void 0,columnsPending:m=!1}){let[h,g]=J.useState(``),_=e??[],v=lt(_),y=Qt($e(_,h),t),b=ot(_),x=i($e(_,h),t),S=Vt(_),C=Lh({tokens:l,cost:u}),w=bn(_),T=t===`archived`?void 0:s;return(0,Y.jsxs)(`div`,{"data-route":`tasks`,className:`flex min-h-full flex-col`,children:[(0,Y.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,Y.jsx)(`h1`,{className:`text-base font-semibold`,children:`Tasks`}),(0,Y.jsxs)(`div`,{className:`inline-flex gap-0.5 rounded-md bg-muted p-[3px]`,children:[(0,Y.jsx)(Hh,{view:`active`,current:t,onSelect:n,count:v.active,children:`Active`}),(0,Y.jsx)(Hh,{view:`archived`,current:t,onSelect:n,count:v.archived,children:`Archived`})]}),(0,Y.jsx)(`div`,{className:`flex-1`}),w>0?(0,Y.jsxs)(L,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`mark-all-read`,onClick:a,children:[(0,Y.jsx)(Ba,{className:`size-3.5`,"aria-hidden":`true`}),`Mark all read`]}):null,t===`active`&&S>0?(0,Y.jsxs)(L,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`archive-finished`,onClick:r,children:[(0,Y.jsx)(gn,{className:`size-3.5`,"aria-hidden":`true`}),`Archive finished`]}):null,(0,Y.jsxs)(`div`,{className:`relative w-60`,children:[(0,Y.jsx)(Rr,{className:`pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-soft-foreground`,"aria-hidden":`true`}),(0,Y.jsx)(`input`,{type:`text`,value:h,onChange:e=>g(e.target.value),placeholder:`Search tasks…`,"aria-label":`Search tasks`,className:`h-9 w-full rounded-md border border-input bg-card pr-3 pl-8 text-[13px] text-foreground outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]})]}),(0,Y.jsxs)(`div`,{className:`flex flex-1 flex-col p-3 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-5 md:pb-5`,children:[e===void 0?null:y.length===0?(0,Y.jsx)(Vh,{view:t,query:h}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{"data-slot":`tasks-table`,className:`hidden overflow-x-auto rounded-lg border border-border bg-card shadow-xs md:block`,children:(0,Y.jsx)(Th,{children:(0,Y.jsxs)(`table`,{className:`w-full border-collapse`,children:[(0,Y.jsx)(`colgroup`,{children:C.map(e=>{let t=Fh(e.id,f);return(0,Y.jsx)(`col`,{"data-column-id":e.id,"data-expanded":t,style:{width:t?e.width:`42px`}},e.id)})}),(0,Y.jsx)(`thead`,{children:(0,Y.jsx)(`tr`,{children:C.map(e=>(0,Y.jsx)(Wh,{column:e,expanded:Fh(e.id,f),onToggle:p,disabled:m},e.id))})}),(0,Y.jsx)(`tbody`,{className:`[&>tr:last-child>td]:border-b-0`,children:y.map(e=>(0,Y.jsx)(qh,{run:e,queuePosition:e.status===`queued`?b.get(e.id)??null:null,onRename:o,onTogglePin:T,now:c,columns:C,expandedColumns:f,defaultRunner:d},e.id))})]})})}),(0,Y.jsx)(`div`,{"data-slot":`task-cards`,className:`flex flex-col gap-2.5 md:hidden`,children:y.map(e=>(0,Y.jsx)($h,{run:e,queuePosition:e.status===`queued`?b.get(e.id)??null:null,now:c,showTokens:l,showCost:u,defaultRunner:d,onTogglePin:T},e.id))})]}),x.map(e=>(0,Y.jsxs)(`div`,{"data-slot":`compare-strip`,"data-group-id":e.groupId,className:`mt-3.5 flex flex-wrap items-center gap-2.5 rounded-lg border border-border bg-card px-3.5 py-2.5 text-[12.5px] text-muted-foreground shadow-xs`,children:[(0,Y.jsx)(Eo,{className:`size-[15px] shrink-0 text-soft-foreground`,"aria-hidden":`true`}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`strong`,{className:`font-semibold text-foreground`,children:e.title}),` — `,e.count,` variants finished`]}),(0,Y.jsx)(L,{asChild:!0,variant:`outline`,size:`sm`,className:`md:ml-auto`,children:(0,Y.jsx)(K,{to:`/compare/${e.groupId}`,children:`Compare`})})]},e.groupId))]}),(0,Y.jsx)(K,{to:`/new`,"data-slot":`new-task-fab`,"aria-label":`New task`,className:`fixed right-4 bottom-[calc(16px+env(safe-area-inset-bottom))] z-20 inline-flex size-14 items-center justify-center rounded-full bg-primary text-primary-foreground shadow-modal md:hidden`,children:(0,Y.jsx)(wo,{className:`size-[22px]`,"aria-hidden":`true`})})]})}function Vh({view:e,query:t}){let n=t.trim(),r=n?`search-miss`:e===`archived`?`archive`:`no-tasks`;return(0,Y.jsx)(`div`,{"data-slot":`tasks-empty`,"data-empty-kind":r,className:`flex flex-1 flex-col`,children:r===`search-miss`?(0,Y.jsx)(V,{heading:`h2`,icon:(0,Y.jsx)(ai,{}),tone:`neutral`,title:`No matching tasks`,subtitle:`No tasks match “${n}”.`}):r===`archive`?(0,Y.jsx)(V,{heading:`h2`,icon:(0,Y.jsx)(gn,{}),tone:`neutral`,title:`Nothing archived yet`,subtitle:`Finished tasks you archive land here.`}):(0,Y.jsx)(V,{heading:`h2`,icon:(0,Y.jsx)(po,{}),tone:`primary`,backdrop:!0,title:`No tasks yet`,subtitle:`Describe a task to get started.`,actions:(0,Y.jsx)(L,{asChild:!0,children:(0,Y.jsxs)(K,{to:`/new`,children:[(0,Y.jsx)(wo,{"aria-hidden":`true`}),`New task`]})})})})}function Hh({view:e,current:t,onSelect:n,count:r,children:i}){let a=e===t;return(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`overview-tab`,"data-view":e,"aria-pressed":a,onClick:()=>n(e),className:U(`flex h-7 items-center justify-center gap-1.5 rounded-[7px] px-3 text-[12.5px] font-medium text-muted-foreground`,a&&`bg-card font-semibold text-foreground shadow-xs`),children:[i,r>0?(0,Y.jsx)(`span`,{className:`font-mono text-[11px] tabular-nums`,children:r}):null]})}function Uh({children:e,right:t=!1,columnId:n,folded:r=!1}){return(0,Y.jsx)(`th`,{scope:`col`,"data-column-id":n,"data-folded":r||void 0,className:U(`h-[38px] border-b border-border px-2.5 text-left text-[11px] font-semibold tracking-[0.05em] whitespace-nowrap text-soft-foreground uppercase first:pl-4 last:pr-4`,t&&`text-right`,r&&`px-0 first:pl-0 last:pr-0`),children:e})}function Wh({column:e,expanded:t,onToggle:n,disabled:r}){if(!e.canFold)return(0,Y.jsx)(Uh,{columnId:e.id,right:e.align===`right`,children:e.label});let i=t?`Fold`:`Expand`;return(0,Y.jsx)(Uh,{columnId:e.id,right:e.align===`right`,folded:!t,children:(0,Y.jsxs)(Eh,{children:[(0,Y.jsx)(Dh,{asChild:!0,children:(0,Y.jsx)(`button`,{type:`button`,"aria-label":`${i} ${e.label} column`,"aria-pressed":t,disabled:r,onClick:()=>n(e.id),className:U(`inline-flex h-8 w-full items-center gap-1 rounded-sm px-0.5 text-inherit outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-wait disabled:opacity-60`,e.align===`right`?`justify-end`:`justify-start`,!t&&`justify-center px-0`),children:t?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{children:e.label}),(0,Y.jsx)(Va,{className:`size-3 opacity-55`,"aria-hidden":`true`})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Gh,{icon:e.icon}),(0,Y.jsx)(Ha,{className:`size-3 opacity-70`,"aria-hidden":`true`})]})})}),(0,Y.jsxs)(Oh,{side:`top`,children:[e.label,` · `,i,` column`]})]})})}function Gh({icon:e}){let t=`size-3.5`;switch(e){case`workflow`:return(0,Y.jsx)(Fo,{className:t,"aria-hidden":`true`});case`tool`:return(0,Y.jsx)(xn,{className:t,"aria-hidden":`true`});case`model`:return(0,Y.jsx)(oi,{className:t,"aria-hidden":`true`});case`branch`:return(0,Y.jsx)(io,{className:t,"aria-hidden":`true`});case`diff`:return(0,Y.jsx)(Qa,{className:t,"aria-hidden":`true`});case`reference`:return(0,Y.jsx)(fo,{className:t,"aria-hidden":`true`});case`tokens`:return(0,Y.jsx)(Ka,{className:t,"aria-hidden":`true`});case`cost`:return(0,Y.jsx)(Ya,{className:t,"aria-hidden":`true`});case`cpu`:return(0,Y.jsx)(vn,{className:t,"aria-hidden":`true`});case`memory`:return(0,Y.jsx)(ho,{className:t,"aria-hidden":`true`});case`started`:return(0,Y.jsx)(Wa,{className:t,"aria-hidden":`true`});default:return null}}var Kh=`h-11 border-b border-border px-2.5 whitespace-nowrap first:pl-4 last:pr-4`;function qh({run:e,queuePosition:t,onRename:n,onTogglePin:r,now:i,columns:a,expandedColumns:o,defaultRunner:s}){let c=Di(),l=Li(e),u=Ve(e),d=`/tasks/${e.id}`,f=Tt(e.costUsd),p=Je(e),m=Pn(e.runner,e.steps,s),h=pn(e.steps);return(0,Y.jsx)(`tr`,{"data-slot":`task-table-row`,"data-run-id":e.id,onClick:e=>{e.target.closest(`a, button, input`)||c(d)},className:`group/row cursor-pointer hover:bg-muted`,children:a.map(a=>a.id===`memory`?null:a.id===`cpu`?t===null?(0,Y.jsx)(Zh,{run:e,cpuExpanded:Fh(`cpu`,o),memoryExpanded:Fh(`memory`,o)},a.id):(0,Y.jsxs)(`td`,{"data-slot":`queue-note`,"data-column-id":`cpu-memory`,colSpan:2,className:U(Kh,`text-right font-mono text-[11.5px] text-soft-foreground`),children:[`#`,t,` in queue`]},a.id):(0,Y.jsx)(Jh,{column:a,expanded:Fh(a.id,o),run:e,attention:l,scheduled:u,reference:p,cost:f,runner:m,backends:h,to:d,onRename:n,onTogglePin:r,now:i},a.id))})}function Jh({column:e,expanded:t,run:n,attention:r,scheduled:i,reference:a,cost:o,runner:s,backends:c,to:l,onRename:u,onTogglePin:d,now:f}){if(!t)return(0,Y.jsx)(Yh,{column:e.id});switch(e.id){case`status`:return(0,Y.jsx)(`td`,{"data-column-id":e.id,className:Kh,children:(0,Y.jsxs)(Bi,{dot:r.tone,pulse:r.pulse,title:i?.title,children:[r.label,i?(0,Y.jsx)(`span`,{className:`tabular-nums`,children:i.label}):null]})});case`task`:return(0,Y.jsx)(`td`,{"data-column-id":e.id,className:U(Kh,`min-w-[220px] max-w-0`),children:(0,Y.jsx)(Xh,{run:n,to:l,onRename:u,onTogglePin:d})});case`workflow`:return(0,Y.jsx)(`td`,{"data-column-id":e.id,className:U(Kh,`text-[12.5px] text-muted-foreground`),children:Xe(n)});case`tool`:return(0,Y.jsx)(`td`,{"data-column-id":e.id,className:U(Kh,`max-w-0`),children:(0,Y.jsx)(kh,{runner:s.runner,inherited:s.inherited,backends:c})});case`model`:return(0,Y.jsx)(`td`,{"data-column-id":e.id,className:U(Kh,`max-w-0`),children:(0,Y.jsx)(Ah,{model:n.model})});case`branch`:return(0,Y.jsx)(`td`,{"data-column-id":e.id,className:Kh,children:n.branch?(0,Y.jsx)(ng,{branch:n.branch}):(0,Y.jsx)(eg,{})});case`diff`:return(0,Y.jsx)(`td`,{"data-column-id":e.id,className:Kh,children:n.diffStat?(0,Y.jsx)($i,{stat:n.diffStat}):(0,Y.jsx)(eg,{})});case`reference`:return(0,Y.jsx)(`td`,{"data-column-id":e.id,className:Kh,children:a?(0,Y.jsx)(Tn,{run:n,reference:a}):(0,Y.jsx)(eg,{})});case`tokens`:return(0,Y.jsx)(`td`,{"data-column-id":e.id,className:U(Kh,`text-right text-xs text-muted-foreground`),children:(0,Y.jsx)(Ri,{inputTokens:n.inputTokens,outputTokens:n.outputTokens,totalTokens:n.tokensUsed||void 0,variant:`table`,omitWhenUnknown:!1})});case`cost`:return(0,Y.jsx)(`td`,{"data-column-id":e.id,className:U(Kh,`text-right font-mono text-xs text-muted-foreground tabular-nums`),children:o||(0,Y.jsx)(eg,{})});case`started`:return(0,Y.jsx)(`td`,{"data-column-id":e.id,className:U(Kh,`text-right text-xs text-soft-foreground tabular-nums`),children:Vi(n.startedAt??n.createdAt,f)});case`cpu`:case`memory`:return null}}function Yh({column:e}){return(0,Y.jsx)(`td`,{role:`presentation`,"aria-hidden":`true`,"data-column-id":e,"data-folded":`true`,className:U(Kh,`px-0 first:pl-0 last:pr-0`)})}function Xh({run:e,to:t,onRename:n,onTogglePin:r}){let i=Kt(e),a=jn(i,t=>n(e.id,t)),o=mn(e),s=hn(e);return a.editing?(0,Y.jsx)(Mn,{editor:a,className:`text-[13px] font-medium`}):(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Y.jsx)(K,{to:t,title:i,className:U(`min-w-0 truncate text-[13px]`,o?`font-semibold text-foreground`:s?`font-medium text-muted-foreground`:`font-medium`),children:i}),o?(0,Y.jsx)(q,{tone:`violet`,role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,className:`shrink-0`}):null,(0,Y.jsx)(`button`,{type:`button`,"data-slot":`row-rename`,"aria-label":`Rename task`,onClick:a.begin,className:`shrink-0 rounded-sm p-0.5 text-soft-foreground opacity-0 transition-opacity group-hover/row:opacity-100 hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Y.jsx)(fn,{className:`size-3`,"aria-hidden":`true`})}),r?(0,Y.jsx)(Ol,{pinned:!!e.pinned,onToggle:t=>r(e,t),className:`size-[19px] opacity-0 group-hover/row:opacity-100 focus-visible:opacity-100 no-hover:opacity-100 data-[pinned=true]:opacity-100`}):null]})}function Zh({run:e,cpuExpanded:t,memoryExpanded:n}){let r=Wt(e,ja(e.id));return(0,Y.jsxs)(Y.Fragment,{children:[t?(0,Y.jsx)(Qh,{column:`cpu`,cell:r.cpu}):(0,Y.jsx)(Yh,{column:`cpu`}),n?(0,Y.jsx)(Qh,{column:`memory`,cell:r.mem}):(0,Y.jsx)(Yh,{column:`memory`})]})}function Qh({column:e,cell:t}){return(0,Y.jsx)(`td`,{"data-usage":e===`memory`?`mem`:e,"data-column-id":e,"data-usage-kind":t.kind,title:t.title,className:U(Kh,`text-right font-mono tabular-nums`,t.kind===`live`&&`bg-violet/5 text-xs font-medium text-foreground`,t.kind===`peak`&&`text-[11.5px] text-soft-foreground`,t.kind===`none`&&`text-xs text-soft-foreground`),children:t.text||`—`})}function $h({run:e,queuePosition:t,now:n,showTokens:r,showCost:i,defaultRunner:a,onTogglePin:o}){let s=Di(),c=Li(e),l=Ve(e),u=`/tasks/${e.id}`,d=Je(e),f=mn(e),p=hn(e),m=Tt(e.costUsd),h=e.inputTokens!==void 0||e.outputTokens!==void 0,g=Pn(e.runner,e.steps,a),_=Sn(g.runner,pn(e.steps)),v=Fn(e.model);return(0,Y.jsxs)(`div`,{"data-slot":`task-card`,"data-run-id":e.id,onClick:e=>{e.target.closest(`a, button`)||s(u)},className:`cursor-pointer rounded-lg border border-border bg-card px-3.5 py-3 shadow-xs`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,Y.jsxs)(Bi,{dot:c.tone,pulse:c.pulse,className:`mt-px shrink-0`,title:l?.title,children:[c.label,l?(0,Y.jsx)(`span`,{className:`tabular-nums`,children:l.label}):null]}),(0,Y.jsx)(K,{to:u,className:U(`min-w-0 flex-1 text-[13.5px] leading-[1.35]`,f?`font-semibold text-foreground`:p?`font-medium text-muted-foreground`:`font-medium`),children:Kt(e)}),f?(0,Y.jsx)(q,{tone:`violet`,role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,className:`mt-1.5 shrink-0`}):null,(0,Y.jsx)(`span`,{className:`mt-0.5 shrink-0 text-[11.5px] text-soft-foreground tabular-nums`,children:Vi(e.finishedAt??e.createdAt,n)}),o?(0,Y.jsx)(Ol,{pinned:!!e.pinned,onToggle:t=>o(e,t),className:`-mr-1 mt-px`}):null]}),(0,Y.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 font-mono text-[11.5px] font-medium text-muted-foreground tabular-nums`,children:[(0,Y.jsx)(`span`,{children:Xe(e)}),(0,Y.jsx)(tg,{}),(0,Y.jsx)(`span`,{"data-slot":`task-card-tool`,"data-inherited":g.inherited||void 0,className:U(g.inherited&&`text-soft-foreground`),children:_}),(0,Y.jsx)(tg,{}),(0,Y.jsx)(`span`,{"data-slot":`task-card-model`,"data-inherited":v.auto||void 0,className:U(v.auto&&`text-soft-foreground`),children:v.text}),t===null?(0,Y.jsxs)(Y.Fragment,{children:[e.branch?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(tg,{}),(0,Y.jsx)(`span`,{children:e.branch})]}):null,e.diffStat?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(tg,{}),(0,Y.jsx)($i,{stat:e.diffStat,className:`text-[11.5px]`})]}):null,r&&h?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(tg,{}),(0,Y.jsx)(Ri,{inputTokens:e.inputTokens,outputTokens:e.outputTokens})]}):null,i&&m?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(tg,{}),(0,Y.jsx)(`span`,{children:m})]}):null]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(tg,{}),(0,Y.jsxs)(`span`,{"data-slot":`queue-note`,children:[`#`,t,` in queue`]})]}),d?(0,Y.jsx)(Tn,{run:e,reference:d,className:`h-5`}):null]})]})}function eg(){return(0,Y.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`—`})}function tg(){return(0,Y.jsx)(`span`,{className:`text-soft-foreground`,"aria-hidden":`true`,children:`·`})}function ng({branch:e}){return(0,Y.jsx)(`span`,{className:`rounded-[6px] bg-muted px-1.5 py-0.5 font-mono text-[11.5px] font-medium text-muted-foreground`,children:e})}function rg(){let e=b(),t=I(),n=tn(),r=Ii(t.data),[i,a]=bl(),o=O(),s=P({mutationFn:m,onSuccess:()=>o.invalidateQueries({queryKey:B.runs.all})}),c=P({mutationFn:Et,onSuccess:()=>o.invalidateQueries({queryKey:B.runs.all}),onError:e=>z(e.message,{tone:`danger`})}),l=P({mutationFn:({id:e,title:t})=>bt(e,{title:t}),onSuccess:()=>o.invalidateQueries({queryKey:B.runs.all}),onError:e=>z(e.message,{tone:`danger`})}),u=zt(),d=qn(3e4),f=zh(),p=dt();return(0,Y.jsx)(Nn,{projectId:p,requests:J.useMemo(()=>p===void 0?[]:(e.data??[]).flatMap(e=>{let t=Je(e);return t?[{projectId:p,kind:t.kind,number:t.number}]:[]}),[e.data,p]),children:(0,Y.jsx)(Bh,{runs:e.data,view:i,onViewChange:a,onArchiveFinished:()=>s.mutate(),onMarkAllRead:()=>c.mutate(),onRename:(e,t)=>l.mutate({id:e,title:t}),onTogglePin:(e,t)=>u.mutate({id:e.id,pinned:t},{onError:e=>z(e.message,{tone:`danger`})}),now:d,showTokens:r.tokens,showCost:r.cost,defaultRunner:n.data?.defaultRunner,expandedColumns:f.expandedColumns,onToggleColumn:f.toggleColumn,columnsPending:f.isPending})})}function ig({slot:e,label:t,options:n,selected:r,onToggle:i,onClear:o,searchPlaceholder:s,emptyLabel:c=`Nothing to filter by`}){let[l,u]=J.useState(!1),d=r.length>0,f=r.length===1?n.find(e=>e.value===r[0])?.label??r[0]:`${r.length} selected`;return(0,Y.jsxs)(ur,{open:l,onOpenChange:u,children:[(0,Y.jsx)(rr,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`facet-${e}`,"data-active":d?`true`:void 0,"aria-label":`Filter by ${t.toLowerCase()}`,className:U(`inline-flex h-7 items-center gap-1.5 rounded-full border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,d&&`border-violet/40 bg-violet/10 text-foreground`),children:[(0,Y.jsx)(`span`,{className:U(d&&`text-soft-foreground`),children:t}),d?(0,Y.jsx)(`span`,{className:`max-w-[140px] truncate font-semibold`,children:f}):null,(0,Y.jsx)(Xn,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Y.jsxs)(ir,{align:`start`,className:`w-64 p-0`,"data-testid":`facet-${e}-menu`,children:[(0,Y.jsxs)(Zr,{children:[(0,Y.jsx)(zr,{placeholder:s??`Search ${t.toLowerCase()}…`}),(0,Y.jsxs)(ri,{children:[(0,Y.jsx)(Gr,{children:c}),(0,Y.jsx)(W,{children:n.map(e=>{let t=r.includes(e.value);return(0,Y.jsxs)(G,{value:e.label,onSelect:()=>i(e.value),"data-slot":`facet-option`,"data-value":e.value,"aria-checked":t,role:`option`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:U(`flex size-4 shrink-0 items-center justify-center rounded-[4px] border`,t?`border-violet bg-violet text-violet-foreground`:`border-input`),children:t?(0,Y.jsx)(a,{className:`size-3`}):null}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.count===void 0?null:(0,Y.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-soft-foreground tabular-nums`,children:e.count})]},e.value)})})]})]}),d?(0,Y.jsx)(`div`,{className:`border-t border-border p-1`,children:(0,Y.jsxs)(`button`,{type:`button`,"data-action":`facet-${e}-clear`,onClick:()=>o(),className:`w-full rounded-sm px-2 py-1.5 text-left text-xs font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[`Clear `,t.toLowerCase()]})}):null]})]})}function ag({label:e,count:t,selected:n,onToggle:r,slot:i,tone:a=`neutral`}){return(0,Y.jsxs)(`button`,{type:`button`,"data-slot":i,"data-selected":n?`true`:void 0,"aria-pressed":n,onClick:r,className:U(`inline-flex h-7 items-center gap-1.5 rounded-full border px-2.5 text-xs font-medium transition-colors`,a===`tag`?`border-violet/25 bg-violet/10 text-violet hover:bg-violet/20`:`border-border bg-card text-muted-foreground hover:bg-muted hover:text-foreground`,n&&`border-violet bg-violet text-violet-foreground hover:bg-violet`),children:[e,t===void 0?null:(0,Y.jsx)(`span`,{className:U(`font-mono text-[11px] tabular-nums`,!n&&`text-soft-foreground`),children:t})]})}function og({slot:e,label:t,value:n,options:r,onChange:i}){return(0,Y.jsx)(`div`,{"data-slot":e,role:`group`,"aria-label":t,className:`inline-flex gap-0.5 rounded-md bg-muted p-[3px]`,children:r.map(e=>{let t=e.value===n;return(0,Y.jsx)(`button`,{type:`button`,"data-value":e.value,"aria-pressed":t,onClick:()=>i(e.value),className:U(`flex h-6 items-center justify-center rounded-[6px] px-2.5 text-[12px] font-medium text-muted-foreground transition-colors hover:text-foreground`,t&&`bg-card font-semibold text-foreground shadow-xs`),children:e.label},e.value)})})}var sg=` untagged`,cg=[{value:`project`,label:`Project`},{value:`tag`,label:`Tag`},{value:`status`,label:`Status`},{value:`workflow`,label:`Workflow`}];function lg(e,t){return e===t?`none`:t}var ug={query:``,tags:[],statuses:[],workflows:[]};function dg(e,t){return e.includes(t)?e.filter(e=>e!==t):[...e,t]}function fg(e){return e.tags.length+e.statuses.length+e.workflows.length}function pg(e){return e.query.trim()!==``||fg(e)>0}function mg(e){return fg(e.filters)+(e.filters.query.trim()===``?0:1)+(e.groupBy===`none`?0:1)}function hg(e){return mg(e)>0}function gg(e,t){let n=new Map(t.map(e=>[e.id,e]));return e.map(e=>{let t=n.get(e.projectId);return{run:e,project:t,projectName:t?.name||e.projectId,tags:t?.tags??[]}})}function _g(e){let t=new Set;for(let n of e)t.add(n.run.workflow);return[...t].sort((e,t)=>e.localeCompare(t))}function vg(e){let t=new Set;for(let n of e)t.add(n.run.status);return[...t].sort((e,t)=>e.localeCompare(t))}function yg(e,t){let n=new Map;for(let r of e)for(let e of t(r))n.set(e,(n.get(e)??0)+1);return n}var bg=e=>e.tags.length===0?[sg]:e.tags,xg=(e,t)=>e.length===0||t.some(t=>e.includes(t)),Sg=(e,t)=>{if(t.length===0)return!0;let n=bg(e).map(e=>e.toLowerCase());return t.some(e=>n.includes(e.toLowerCase()))};function Cg(e){return[Kt(e.run),e.projectName,e.run.workflow,e.run.branch??``,...e.tags].join(`
29
+ `).toLowerCase()}function wg(e,t,n){let r=t.query.trim().toLowerCase().split(/\s+/).filter(Boolean);return e.filter(e=>{if((n===`archived`?!e.run.archived:e.run.archived)||!xg(t.statuses,[e.run.status])||!xg(t.workflows,[e.run.workflow])||!Sg(e,t.tags))return!1;if(r.length===0)return!0;let i=Cg(e);return r.every(e=>i.includes(e))})}function Tg(e,t,n,r){return wg(e,{...t,[r]:[]},n)}function Eg(e,t){if(t===`none`)return[{key:`all`,label:``,tasks:[...e]}];let n=new Map,r=(e,t,r)=>{let i=n.get(e);i?i.tasks.push(r):n.set(e,{key:e,label:t,tasks:[r]})};for(let n of e)if(t===`project`)r(n.run.projectId,n.projectName,n);else if(t===`status`)r(n.run.status,n.run.status,n);else if(t===`workflow`)r(n.run.workflow,n.run.workflow,n);else if(n.tags.length===0)r(sg,`Untagged`,n);else for(let e of n.tags)r(e.toLowerCase(),e,n);return[...n.values()].sort((e,t)=>e.key===` untagged`?1:t.key===` untagged`?-1:t.tasks.length-e.tasks.length||e.label.localeCompare(t.label))}function Dg(e,t){let n=new Map(t.map(e=>[e.id,e.name]));return e.map(e=>n.get(e)||e)}var Og={query:`q`,tag:`tag`,untagged:`untagged`,status:`status`,workflow:`workflow`,groupBy:`group`,archived:`archived`},kg=new Set(cg.map(e=>e.value));function Ag(e){let t=new URLSearchParams,n=e.filters.query.trim();n!==``&&t.set(Og.query,n);for(let n of e.filters.tags)n===` untagged`?t.set(Og.untagged,`1`):t.append(Og.tag,n);for(let n of e.filters.statuses)t.append(Og.status,n);for(let n of e.filters.workflows)t.append(Og.workflow,n);return e.groupBy!==`none`&&t.set(Og.groupBy,e.groupBy),e.view===`archived`&&t.set(Og.archived,`1`),t}function jg(e){let t=e.getAll(Og.tag).filter(e=>e!==``);e.get(Og.untagged)===`1`&&t.push(sg);let n=e.get(Og.groupBy)??``;return{filters:{query:e.get(Og.query)??``,tags:t,statuses:e.getAll(Og.status).filter(e=>e!==``),workflows:e.getAll(Og.workflow).filter(e=>e!==``)},groupBy:kg.has(n)?n:`none`,view:e.get(Og.archived)===`1`?`archived`:`active`}}var Mg=15e3,Ng=250,Pg=1,Fg=220,Ig=new Set([`done`,`failed`,`cancelled`]);function Lg(){return zg({request:({task:e,archived:t})=>ue(e.run.projectId,e.run.id,t),patch:({archived:e})=>t=>({...t,archived:e})})}function Rg(){return zg({request:({task:e,read:t})=>f(e.run.projectId,e.run.id,t),patch:({read:e})=>t=>{if(e)return{...t,seenAt:new Date().toISOString()};let{seenAt:n,...r}=t;return r}})}function zg({request:e,patch:t}){let n=O();return P({mutationFn:e,onMutate:async e=>{await n.cancelQueries({queryKey:F.runsIndex});let r=n.getQueryData(F.runsIndex),i=t(e),{task:a}=e;return n.setQueryData(F.runsIndex,e=>e===void 0?e:{...e,runs:e.runs.map(e=>e.projectId===a.run.projectId&&e.id===a.run.id?i(e):e)}),{previous:r}},onError:(e,t,r)=>{r?.previous&&n.setQueryData(F.runsIndex,r.previous),z(e.message,{tone:`danger`})},onSettled:(e,t,{task:r})=>{n.invalidateQueries({queryKey:F.runsIndex}),n.invalidateQueries({queryKey:B.runs.all}),n.invalidateQueries({queryKey:[r.run.projectId,`runs`,`list`]})}})}function Bg(){let e=R(),t=Ii(I().data),n=ee(!0,Mg),[r,i]=Te(),{filters:a,groupBy:o,view:s}=J.useMemo(()=>jg(r),[r]),[c,l]=bl();J.useEffect(()=>{c!==s&&l(s)},[s,c,l]);let u=qn(3e4),d=e=>i(t=>Ag(e(jg(t))),{replace:!0}),f=e=>d(t=>({...t,filters:e(t.filters)})),p=e=>d(t=>({...t,groupBy:e})),m=e=>d(t=>({...t,view:e})),[h,g]=J.useState(a.query),_=J.useRef(a.query);J.useEffect(()=>{a.query!==_.current&&g(a.query),_.current=a.query},[a.query]),J.useEffect(()=>{if(h===_.current)return;let e=setTimeout(()=>{_.current=h,f(e=>({...e,query:h}))},Ng);return()=>clearTimeout(e)},[h]);let v=n.data?.referenceStatuses;J.useEffect(()=>{v&&oe(v)},[v]);let y=J.useMemo(()=>e.data?.projects??[],[e.data]),b=J.useMemo(()=>gg(n.data?.runs??[],y),[n.data,y]),x=J.useMemo(()=>wg(b,a,s),[b,a,s]),S=J.useMemo(()=>Eg(x,o),[x,o]),C=J.useMemo(()=>x.flatMap(e=>yt(e.run,e.project?.repoUrl).map(t=>({projectId:e.run.projectId,kind:t.kind,number:t.number}))),[x]),w=Dg(n.data?.truncated??[],y),T=(e,t)=>f(n=>({...n,[e]:dg(n[e],t)})),E=e=>f(t=>({...t,[e]:[]})),D=Lg(),O=Rg();if(n.isError||e.isError)return(0,Y.jsx)(`div`,{"data-route":`global-tasks`,className:`flex min-h-full flex-col`,children:(0,Y.jsx)(V,{icon:(0,Y.jsx)(uo,{}),tone:`danger`,title:`Tasks across projects did not load`,subtitle:(n.error??e.error)?.message})});let te=(0,Y.jsxs)(`div`,{className:`relative w-full md:w-60`,children:[(0,Y.jsx)(Rr,{className:`pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-soft-foreground`,"aria-hidden":`true`}),(0,Y.jsx)(`input`,{type:`text`,value:h,onChange:e=>g(e.target.value),placeholder:`Search every project…`,"aria-label":`Search tasks across projects`,className:`h-9 w-full rounded-md border border-input bg-card pr-3 pl-8 text-[13px] text-foreground outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]});return(0,Y.jsxs)(`div`,{"data-route":`global-tasks`,className:`flex min-h-full flex-col`,children:[(0,Y.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,Y.jsx)(`h1`,{className:`text-base font-semibold`,children:`All tasks`}),(0,Y.jsxs)(`div`,{className:`inline-flex gap-0.5 rounded-md bg-muted p-[3px]`,children:[(0,Y.jsx)(Vg,{view:`active`,current:s,onSelect:m,children:`Active`}),(0,Y.jsx)(Vg,{view:`archived`,current:s,onSelect:m,children:`Archived`})]}),(0,Y.jsx)(`div`,{className:`flex-1`}),(0,Y.jsxs)(`span`,{"data-slot":`global-tasks-count`,className:`text-[12.5px] text-soft-foreground tabular-nums`,children:[x.length,` of `,b.length]}),te]}),(0,Y.jsxs)(`div`,{className:`flex flex-1 flex-col gap-3 p-3 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-5 md:pb-5`,children:[(0,Y.jsx)(`div`,{className:`md:hidden`,children:te}),(0,Y.jsx)(Hg,{filters:a,onToggle:T,onClearFacet:E,onClearAll:()=>{g(``),d(e=>({...e,filters:ug,groupBy:`none`}))},groupBy:o,onGroupByChange:p,projects:y,tasks:b,view:s}),w.length>0?(0,Y.jsxs)(`p`,{"data-slot":`global-tasks-truncated`,className:`text-[11.5px] text-soft-foreground`,children:[`Showing the newest `,n.data?.perProjectLimit,` tasks per project — older ones in`,` `,w.join(`, `),` are only in that project’s own Tasks page.`]}):null,n.data===void 0?null:x.length===0?(0,Y.jsx)(e_,{view:s,filtered:pg(a)}):(0,Y.jsx)(Nn,{requests:C,children:S.map(e=>(0,Y.jsxs)(`section`,{"data-slot":`task-group`,"data-group-key":e.key,children:[o===`none`?null:(0,Y.jsxs)(`h2`,{className:`mb-1.5 flex items-center gap-2 text-[12px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:[o===`project`?(0,Y.jsx)(M,{to:Ei(e.key,`/`),"data-slot":`group-project-link`,className:`hover:text-foreground hover:underline`,children:e.label}):e.label,(0,Y.jsx)(`span`,{className:`font-mono text-[11px] font-medium tabular-nums`,children:e.tasks.length})]}),(0,Y.jsx)(Ug,{tasks:e.tasks,now:u,showProject:o!==`project`,onArchive:(e,t)=>D.mutate({task:e,archived:t}),onSetRead:(e,t)=>O.mutate({task:e,read:t}),busy:D.isPending||O.isPending,showCost:t.cost})]},e.key))})]})]})}function Vg({view:e,current:t,onSelect:n,children:r}){let i=e===t;return(0,Y.jsx)(`button`,{type:`button`,"data-slot":`overview-tab`,"data-view":e,"aria-pressed":i,onClick:()=>n(e),className:U(`flex h-7 items-center justify-center rounded-[7px] px-3 text-[12.5px] font-medium text-muted-foreground`,i&&`bg-card font-semibold text-foreground shadow-xs`),children:r})}function Hg({filters:e,onToggle:t,onClearFacet:n,onClearAll:r,groupBy:i,onGroupByChange:a,projects:o,tasks:s,view:c}){let l=J.useMemo(()=>Me(o),[o]),u=J.useMemo(()=>{let t=(t,n)=>yg(Tg(s,e,c,t),n);return{tags:t(`tags`,bg),statuses:t(`statuses`,e=>[e.run.status]),workflows:t(`workflows`,e=>[e.run.workflow])}},[s,e,c]),d=e=>t=>({...t,count:e.get(t.value)??0});return(0,Y.jsxs)(`div`,{"data-slot":`global-tasks-filters`,className:`flex flex-col gap-2 rounded-lg border border-border bg-card p-2.5 shadow-xs`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,Y.jsx)(ig,{slot:`status`,label:`Status`,selected:e.statuses,onToggle:e=>t(`statuses`,e),onClear:()=>n(`statuses`),options:vg(s).map(e=>({value:e,label:e})).map(d(u.statuses)),emptyLabel:`No tasks to filter`}),(0,Y.jsx)(ig,{slot:`workflow`,label:`Workflow`,selected:e.workflows,onToggle:e=>t(`workflows`,e),onClear:()=>n(`workflows`),options:_g(s).map(e=>({value:e,label:e})).map(d(u.workflows)),emptyLabel:`No tasks to filter`}),(0,Y.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`text-[11px] font-medium text-soft-foreground`,children:`Group by`}),(0,Y.jsx)(og,{slot:`group-by`,label:`Group tasks by`,value:i,options:cg,onChange:e=>a(lg(i,e))}),hg({filters:e,groupBy:i})?(0,Y.jsxs)(`button`,{type:`button`,"data-action":`clear-filters`,onClick:r,className:`ml-auto inline-flex h-7 items-center gap-1 rounded-full px-2 text-xs font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[(0,Y.jsx)(ci,{className:`size-3`,"aria-hidden":`true`}),`Clear`,` (${mg({filters:e,groupBy:i})})`]}):null]}),l.length>0?(0,Y.jsxs)(`div`,{"data-slot":`tag-filters`,className:`flex flex-wrap items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`text-[11px] font-medium text-soft-foreground`,children:`Tags`}),l.map(n=>(0,Y.jsx)(ag,{slot:`tag-filter`,tone:`tag`,label:n,count:u.tags.get(n)??0,selected:e.tags.some(e=>e.toLowerCase()===n.toLowerCase()),onToggle:()=>t(`tags`,n)},n)),(0,Y.jsx)(ag,{slot:`tag-filter`,label:`Untagged`,count:u.tags.get(` untagged`)??0,selected:e.tags.includes(sg),onToggle:()=>t(`tags`,sg)})]}):(0,Y.jsxs)(`p`,{"data-slot":`no-tags-hint`,className:`text-[11px] text-soft-foreground`,children:[`Tag connected repositories in`,` `,(0,Y.jsx)(M,{to:`/settings/global/projects`,className:`font-medium text-violet hover:underline`,children:`Settings → Projects`}),` `,`to group their tasks together here.`]})]})}function Ug({tasks:e,now:t,showProject:n,onArchive:r,onSetRead:i,busy:a,showCost:o}){return(0,Y.jsx)(`div`,{"data-slot":`global-tasks-table`,className:`overflow-x-auto rounded-lg border border-border bg-card shadow-xs`,children:(0,Y.jsx)(Th,{children:(0,Y.jsxs)(`table`,{className:`w-full border-collapse`,children:[(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(Wg,{className:`w-[104px]`,children:`Status`}),(0,Y.jsx)(Wg,{children:`Task`}),n?(0,Y.jsx)(Wg,{className:`w-[124px]`,children:`Project`}):null,(0,Y.jsx)(Wg,{className:`hidden w-[120px] xl:table-cell`,children:`Tags`}),(0,Y.jsx)(Wg,{className:`w-[84px]`,children:`Ref`}),(0,Y.jsx)(Wg,{className:`hidden w-[108px] xl:table-cell`,children:`Workflow`}),(0,Y.jsx)(Wg,{className:`hidden w-[124px] xl:table-cell`,children:`Tool Name`}),(0,Y.jsx)(Wg,{className:`hidden w-[112px] xl:table-cell`,children:`Model`}),o?(0,Y.jsx)(Wg,{className:`hidden w-[64px] text-right lg:table-cell`,children:`Cost`}):null,(0,Y.jsx)(Wg,{className:`hidden w-[56px] text-right xl:table-cell`,children:`CPU`}),(0,Y.jsx)(Wg,{className:`hidden w-[84px] text-right xl:table-cell`,children:`Mem`}),(0,Y.jsx)(Wg,{className:`w-[56px] text-right`,children:`Age`}),(0,Y.jsx)(Wg,{className:`w-[64px] text-right`,children:(0,Y.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]})}),(0,Y.jsx)(`tbody`,{className:`[&>tr:last-child>td]:border-b-0`,children:e.map(e=>(0,Y.jsx)(Kg,{task:e,now:t,showProject:n,onArchive:r,onSetRead:i,busy:a,showCost:o},`${e.run.projectId}/${e.run.id}`))})]})})})}function Wg({children:e,className:t}){return(0,Y.jsx)(`th`,{scope:`col`,className:U(`h-[38px] border-b border-border px-2.5 text-left text-[11px] font-semibold tracking-[0.05em] whitespace-nowrap text-soft-foreground uppercase first:pl-4 last:pr-4`,t),children:e})}var Gg=`h-11 border-b border-border px-2.5 whitespace-nowrap first:pl-4 last:pr-4`;function Kg({task:e,now:t,showProject:n,onArchive:r,onSetRead:i,busy:a,showCost:o}){let{run:s}=e,c=Li(s),l=Ei(s.projectId,`/tasks/${s.id}`),u=mn(s),d=hn(s),f=yt(s,e.project?.repoUrl),p=Wt(s,s.usage);return(0,Y.jsxs)(`tr`,{"data-slot":`global-task-row`,"data-run-id":s.id,"data-project":s.projectId,className:`hover:bg-muted`,children:[(0,Y.jsx)(`td`,{className:Gg,children:(0,Y.jsx)(Bi,{dot:c.tone,pulse:c.pulse,children:c.label})}),(0,Y.jsx)(`td`,{className:U(Gg,`min-w-[320px] max-w-0`),children:(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Y.jsx)(M,{to:l,title:Kt(s),className:U(`min-w-0 truncate text-[13px]`,u?`font-semibold text-foreground`:d?`font-medium text-muted-foreground`:`font-medium`),children:Kt(s)}),u?(0,Y.jsx)(q,{tone:`violet`,role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,className:`shrink-0`}):null]})}),n?(0,Y.jsx)(`td`,{className:U(Gg,`text-[12.5px] text-muted-foreground`),children:(0,Y.jsx)(M,{to:Ei(s.projectId,`/`),className:`truncate hover:text-foreground`,children:e.projectName})}):null,(0,Y.jsx)(`td`,{className:U(Gg,`hidden xl:table-cell`),children:e.tags.length>0?(0,Y.jsx)(`span`,{className:`flex flex-wrap items-center gap-1`,children:e.tags.map(e=>(0,Y.jsx)(Zg,{tag:e},e))}):(0,Y.jsx)($g,{})}),(0,Y.jsx)(`td`,{className:Gg,children:f.length>0?(0,Y.jsx)(Yg,{references:f,run:s}):(0,Y.jsx)($g,{})}),(0,Y.jsx)(`td`,{className:U(Gg,`hidden text-[12.5px] text-muted-foreground xl:table-cell`),children:s.workflow}),(0,Y.jsx)(`td`,{className:U(Gg,`hidden max-w-0 xl:table-cell`),children:(0,Y.jsx)(kh,{runner:s.runner,inherited:s.runnerInherited===!0,backends:s.stepBackends??0})}),(0,Y.jsx)(`td`,{className:U(Gg,`hidden max-w-0 xl:table-cell`),children:(0,Y.jsx)(Ah,{model:s.model})}),o?(0,Y.jsx)(`td`,{className:U(Gg,`hidden text-right font-mono text-xs text-muted-foreground tabular-nums lg:table-cell`),children:Tt(s.costUsd)||(0,Y.jsx)($g,{})}):null,(0,Y.jsx)(Qg,{column:`cpu`,cell:p.cpu}),(0,Y.jsx)(Qg,{column:`memory`,cell:p.mem}),(0,Y.jsx)(`td`,{className:U(Gg,`text-right text-xs text-soft-foreground tabular-nums`),children:Vi(s.startedAt??s.createdAt,t)}),(0,Y.jsx)(`td`,{className:U(Gg,`text-right`),children:(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,Y.jsx)(qg,{task:e,busy:a,onSetRead:i}),(0,Y.jsx)(Jg,{task:e,busy:a,onArchive:r})]})})]})}function qg({task:e,busy:t,onSetRead:n}){if(!Cn(e.run))return null;let r=mn(e.run),i=Kt(e.run),a=r?`Mark ${i} read`:`Mark ${i} unread`,o=r?Lr:Xa;return(0,Y.jsxs)(Eh,{children:[(0,Y.jsx)(Dh,{asChild:!0,children:(0,Y.jsx)(`button`,{type:`button`,"data-action":r?`mark-read`:`mark-unread`,"aria-label":a,disabled:t,onClick:()=>n(e,r),className:U(`inline-flex size-7 items-center justify-center rounded-md transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none disabled:cursor-wait disabled:opacity-50`,r?`text-violet`:`text-soft-foreground`),children:(0,Y.jsx)(o,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,Y.jsx)(Oh,{side:`left`,children:r?`Mark read`:`Mark unread`})]})}function Jg({task:e,busy:t,onArchive:n}){let r=e.run.archived;if(!r&&!Ig.has(e.run.status))return null;let i=r?`Restore ${Kt(e.run)} to the active list`:`Archive ${Kt(e.run)}`;return(0,Y.jsxs)(Eh,{children:[(0,Y.jsx)(Dh,{asChild:!0,children:(0,Y.jsx)(`button`,{type:`button`,"data-action":r?`unarchive-run`:`archive-run`,"aria-label":i,disabled:t,onClick:()=>n(e,!r),className:`inline-flex size-7 items-center justify-center rounded-md text-soft-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none disabled:cursor-wait disabled:opacity-50`,children:(0,Y.jsx)(r?_n:gn,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,Y.jsx)(Oh,{side:`left`,children:r?`Restore`:`Archive`})]})}function Yg({references:e,run:t}){let n=e.slice(0,Pg),r=e.length-n.length,i=Kt(t);return(0,Y.jsxs)(`span`,{className:`flex flex-nowrap items-center gap-1`,children:[n.map(e=>(0,Y.jsx)(wn,{reference:e,taskTitle:i,projectId:t.projectId,conflictAction:(0,Y.jsx)(On,{projectId:t.projectId,runId:t.id,prNumber:e.number}),className:`shrink-0`},`${e.kind}#${e.number}`)),r>0?(0,Y.jsx)(Xg,{references:e,taskTitle:i,hidden:r,projectId:t.projectId}):null]})}function Xg({references:e,taskTitle:t,hidden:n,projectId:r}){let[i,a]=J.useState(!1),o=J.useRef(!1),s=J.useRef(void 0);J.useEffect(()=>()=>clearTimeout(s.current),[]);let c=e=>e.pointerType!==`touch`,l=()=>clearTimeout(s.current),u=e=>{c(e)&&(l(),o.current=!0,a(!0))},d=e=>{c(e)&&(l(),s.current=setTimeout(()=>a(!1),Fg))};return(0,Y.jsxs)(ur,{open:i,onOpenChange:a,children:[(0,Y.jsx)(rr,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`reference-overflow`,"aria-label":`Show all ${e.length} references for ${t}`,onPointerEnter:u,onPointerLeave:d,onPointerDown:()=>{o.current=!1},onClick:()=>{o.current=!1},className:`shrink-0 rounded-full px-1 text-[11px] font-medium text-soft-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:[`+`,n]})}),(0,Y.jsxs)(ir,{align:`start`,className:`w-auto min-w-40 p-1.5`,"data-slot":`reference-overflow-list`,onPointerEnter:u,onPointerLeave:d,onOpenAutoFocus:e=>{o.current&&e.preventDefault()},onCloseAutoFocus:e=>{o.current&&e.preventDefault()},children:[(0,Y.jsx)(`p`,{className:`px-1 pb-1.5 text-[10.5px] text-soft-foreground`,children:`References`}),(0,Y.jsx)(`span`,{className:`flex flex-col items-start gap-1`,children:e.map(e=>(0,Y.jsx)(wn,{reference:e,taskTitle:t,projectId:r},`${e.kind}#${e.number}`))})]})]})}function Zg({tag:e,className:t}){return(0,Y.jsx)(`span`,{"data-slot":`project-tag`,className:U(`inline-flex max-w-full items-center truncate rounded-full bg-muted px-1.5 py-px text-[10.5px] font-medium text-muted-foreground`,t),children:e})}function Qg({column:e,cell:t}){return(0,Y.jsx)(`td`,{"data-usage":e===`memory`?`mem`:e,"data-usage-kind":t.kind,title:t.title,className:U(Gg,`hidden text-right font-mono tabular-nums xl:table-cell`,t.kind===`live`&&`bg-violet/5 text-xs font-medium text-foreground`,t.kind===`peak`&&`text-[11.5px] text-soft-foreground`,t.kind===`none`&&`text-xs text-soft-foreground`),children:t.text||`—`})}function $g(){return(0,Y.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`—`})}function e_({view:e,filtered:t}){return t?(0,Y.jsx)(V,{heading:`h2`,icon:(0,Y.jsx)(ai,{}),tone:`neutral`,title:`No matching tasks`,subtitle:`No task in any project matches these filters.`}):e===`archived`?(0,Y.jsx)(V,{heading:`h2`,icon:(0,Y.jsx)(gn,{}),tone:`neutral`,title:`Nothing archived yet`,subtitle:`Finished tasks you archive land here, from every project.`}):(0,Y.jsx)(V,{heading:`h2`,icon:(0,Y.jsx)(po,{}),tone:`neutral`,title:`No tasks yet`,subtitle:`Start a task in any project and it shows up here.`})}function t_({mode:e=`list`}){let{automationId:t}=w(),n=Di(),r=Ni(),[i,a]=(0,J.useState)(),[o,s]=(0,J.useState)(``),[c,l]=(0,J.useState)({}),u=I(),d=u.data!==void 0,f=d&&u.data.capabilities?.automations!==!0,p=()=>jt().then(a).catch(e=>s(String(e)));if((0,J.useEffect)(()=>{d&&!f&&p()},[d,f]),(0,J.useEffect)(()=>Sa((e,t)=>{if(e!==`automation-change`)return;let n=t;typeof n.project==`string`&&(r===null||n.project===r)&&p()}),[r]),!d)return(0,Y.jsx)(`div`,{"data-route":`automations`,className:`flex min-h-full flex-col p-3 md:p-5`,children:(0,Y.jsx)(a_,{text:`Loading automations…`})});if(f)return(0,Y.jsx)(`div`,{"data-route":`automations`,className:`flex min-h-full flex-col p-3 md:p-5`,children:(0,Y.jsx)(V,{icon:(0,Y.jsx)(hr,{}),tone:`neutral`,title:`GitHub automations are off`,subtitle:`This server does not poll GitHub or launch tasks from it. Set XEZ_AUTOMATIONS=1 and restart xezar to turn automations on.`,heading:`h2`})});if(e===`new`)return(0,Y.jsx)(r_,{onSaved:()=>{n(`/automations`),p()}});if(e===`edit`){let e=i?.automations.find(e=>e.id===t);return e?(0,Y.jsx)(r_,{automation:e,onSaved:()=>{n(`/automations`),p()}}):(0,Y.jsx)(a_,{text:`Loading automation…`})}if(e===`log`){let e=i?.automations.find(e=>e.id===t);return t?(0,Y.jsx)(n_,{automationId:t,automationName:e?.name}):(0,Y.jsx)(a_,{text:`Automation not found.`})}let m=async e=>{l(t=>({...t,[e.id]:`Checking…`}));try{let{checkId:t}=await se(e.id,`preview`);for(let n=0;n<60;n+=1){let n=await x(t);if(n.status===`complete`){l(t=>({...t,[e.id]:`${n.matches??0} match${n.matches===1?``:`es`} found; no tasks launched.`})),p();return}if(n.status===`error`)throw Error(n.error??`Preview failed`);await new Promise(e=>setTimeout(e,500))}throw Error(`Preview is still running`)}catch(t){l(n=>({...n,[e.id]:t instanceof Error?t.message:String(t)}))}};return(0,Y.jsx)(i_,{title:`Automations`,subtitle:`Checks run while xezar is open. No webhook or public URL required.`,action:(0,Y.jsx)(L,{asChild:!0,children:(0,Y.jsxs)(K,{to:`/automations/new`,children:[(0,Y.jsx)(wo,{}),`New automation`]})}),children:o?(0,Y.jsx)(a_,{text:o}):i?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`mb-4 rounded-lg border bg-muted/30 px-4 py-3 text-sm`,children:[(0,Y.jsxs)(`span`,{className:`font-medium`,children:[`GitHub `,i.available?`available`:`unavailable`]}),(0,Y.jsxs)(`span`,{className:`text-muted-foreground`,children:[` · Scheduler `,i.scheduler.state,i.reason?` · ${i.reason}`:``]})]}),i.automations.length===0?(0,Y.jsx)(a_,{text:`No automations yet. Create one paused, test its bounded filter, then enable it from a current-time baseline.`}):(0,Y.jsx)(`div`,{className:`grid gap-3`,children:i.automations.map(e=>(0,Y.jsxs)(`article`,{className:`rounded-xl border bg-card p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`font-semibold`,children:e.name}),(0,Y.jsxs)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:[e.events.join(`, `),` · every `,Math.round(e.intervalSeconds/60),` min`]})]}),(0,Y.jsx)(`span`,{className:`rounded-full border px-2 py-1 text-xs`,children:e.enabled?`Enabled`:`Paused`})]}),(0,Y.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,Y.jsxs)(L,{size:`sm`,variant:`outline`,onClick:()=>void m(e),disabled:c[e.id]===`Checking…`,children:[(0,Y.jsx)(_r,{}),`Test filter`]}),(0,Y.jsx)(L,{size:`sm`,variant:`outline`,onClick:()=>void ye(e.id,!e.enabled).then(p),children:e.enabled?`Pause`:`Enable`}),(0,Y.jsx)(L,{size:`sm`,variant:`ghost`,asChild:!0,children:(0,Y.jsx)(K,{to:`/automations/${e.id}`,children:`Edit`})}),(0,Y.jsx)(L,{size:`sm`,variant:`ghost`,asChild:!0,children:(0,Y.jsx)(K,{to:`/automations/${e.id}/log`,children:`View log`})})]}),c[e.id]&&(0,Y.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,role:`status`,children:c[e.id]})]},e.id))})]}):(0,Y.jsx)(a_,{text:`Loading automations…`})})}function n_({automationId:e,automationName:t}){let[n,r]=(0,J.useState)(),[i,a]=(0,J.useState)(``),o=()=>ne(e).then(({records:e})=>r(e)).catch(e=>a(String(e)));return(0,J.useEffect)(()=>{o()},[e]),(0,J.useEffect)(()=>Sa((t,n)=>{t===`automation-change`&&n.automationId===e&&o()}),[e]),(0,Y.jsx)(i_,{title:`Execution log`,subtitle:t??`Automation activity`,action:(0,Y.jsx)(L,{variant:`outline`,asChild:!0,children:(0,Y.jsx)(K,{to:`/automations`,children:`Back to automations`})}),children:i?(0,Y.jsx)(a_,{text:i}):n?n.length===0?(0,Y.jsx)(a_,{text:`No checks have run yet.`}):(0,Y.jsx)(`ol`,{className:`grid gap-3`,"aria-label":`Automation execution log`,children:n.map(e=>(0,Y.jsxs)(`li`,{className:`rounded-xl border bg-card p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Y.jsx)(`span`,{className:`font-medium capitalize`,children:e.result.replace(`-`,` `)}),(0,Y.jsx)(`time`,{className:`text-xs text-muted-foreground`,dateTime:e.ts,children:new Date(e.ts).toLocaleString()})]}),e.reason&&(0,Y.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:e.reason}),(e.githubUrl||e.runId)&&(0,Y.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-3 text-sm`,children:[e.githubUrl&&(0,Y.jsx)(`a`,{className:`underline underline-offset-4`,href:e.githubUrl,target:`_blank`,rel:`noreferrer`,children:e.githubTitle??`GitHub #${e.githubNumber??``}`}),e.runId&&(0,Y.jsx)(K,{className:`underline underline-offset-4`,to:`/runs/${e.runId}`,children:`Open task`})]})]},e.seq))}):(0,Y.jsx)(a_,{text:`Loading execution log…`})})}function r_({automation:e,onSaved:t}){let[n,r]=(0,J.useState)(e?.name??``),[i,a]=(0,J.useState)(e?.task.prompt??`Review {{github.url}}`),[o,s]=(0,J.useState)(!1),[c,l]=(0,J.useState)(``);return(0,Y.jsx)(i_,{title:e?`Edit automation`:`New automation`,subtitle:`Define a bounded GitHub trigger and the ordinary xezar task it launches.`,children:(0,Y.jsxs)(`form`,{className:`grid max-w-3xl gap-6`,onSubmit:async r=>{r.preventDefault(),l(``);try{e?await g(e.id,{name:n,description:e.description,events:e.events,intervalSeconds:e.intervalSeconds,filters:e.filters,task:{...e.task,prompt:i},enabled:e.enabled,expectedRevision:e.revision}):await ae({name:n,events:[`issue.opened`],intervalSeconds:300,filters:{lookbackDays:7,maxRecords:25},task:{prompt:i,workflow:`quick-task`},enable:o}),t()}catch(e){l(String(e))}},children:[(0,Y.jsxs)(`fieldset`,{className:`grid gap-4 rounded-xl border p-5`,children:[(0,Y.jsx)(`legend`,{className:`px-2 font-semibold`,children:`When GitHub changes`}),(0,Y.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Y.jsx)(gc,{htmlFor:`automation-name`,children:`Name`}),(0,Y.jsx)(hc,{id:`automation-name`,value:n,onChange:e=>r(e.target.value),required:!0})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,Y.jsx)(Ga,{className:`size-4`}),`New issue · every 5 minutes · last 7 days · maximum 25 records`]})]}),(0,Y.jsxs)(`fieldset`,{className:`grid gap-4 rounded-xl border p-5`,children:[(0,Y.jsx)(`legend`,{className:`px-2 font-semibold`,children:`What task to run`}),(0,Y.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Y.jsx)(gc,{htmlFor:`automation-prompt`,children:`Prompt`}),(0,Y.jsx)(li,{id:`automation-prompt`,value:i,onChange:e=>a(e.target.value),rows:8,required:!0})]}),(0,Y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Placeholders include `,`{{github.number}}`,`, `,`{{github.title}}`,`, `,`{{github.url}}`,`, and `,`{{github.labels}}`,`. GitHub content is appended as untrusted context.`]})]}),(0,Y.jsxs)(`fieldset`,{className:`rounded-xl border p-5`,children:[(0,Y.jsx)(`legend`,{className:`px-2 font-semibold`,children:`Review and enable`}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>s(e.target.checked)}),`Save and enable from a current-time baseline (existing matches will not launch)`]})]}),c&&(0,Y.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:c}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(L,{type:`submit`,children:`Save automation`}),(0,Y.jsx)(L,{type:`button`,variant:`outline`,onClick:t,children:`Cancel`})]})]})})}function i_({title:e,subtitle:t,action:n,children:r}){return(0,Y.jsxs)(`main`,{className:`mx-auto w-full max-w-6xl p-4 sm:p-6`,children:[(0,Y.jsxs)(`header`,{className:`mb-6 flex flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,Y.jsx)(Fo,{className:`size-5`}),(0,Y.jsx)(`h1`,{className:`text-2xl font-semibold`,children:e})]}),(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t})]}),n]}),r]})}function a_({text:e}){return(0,Y.jsx)(`div`,{className:`rounded-xl border border-dashed p-8 text-center text-sm text-muted-foreground`,children:e})}var o_=(0,J.lazy)(()=>dn(()=>import(`./task-thread-bxQompxJ.js`).then(e=>({default:e.TaskThreadRoute})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36]))),s_=(0,J.lazy)(()=>dn(()=>import(`./compare-variants-D5ItQbAq.js`).then(e=>({default:e.CompareVariantsRoute})),__vite__mapDeps([37,1,2,3,4,5,25,33,29,15,30,13,14,16,17,18,36]))),c_=(0,J.lazy)(()=>dn(()=>import(`./task-changes-CH-E81-_.js`).then(e=>({default:e.TaskChangesRoute})),__vite__mapDeps([38,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,26,27,28,29,30,31,32,39,23,22,40,41,35,42,25,43,44]))),l_=(0,J.lazy)(()=>dn(()=>import(`./task-files-D_nkHZ_a.js`).then(e=>({default:e.TaskFilesRoute})),__vite__mapDeps([45,1,2,3,4,5,25,26,6,7,8,9,10,11,12,13,14,15,16,17,18,27,28,29,30,31,32,43]))),u_=(0,J.lazy)(()=>dn(()=>import(`./task-commits-DqfkMFxp.js`).then(e=>({default:e.TaskCommitsRoute})),__vite__mapDeps([46,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,47,26,27,28,29,30,31,32,39,33,40,41,35,48,34]))),d_=(0,J.lazy)(()=>dn(()=>import(`./repo-git-Is7R6-Tj.js`).then(e=>({default:e.RepoGitRoute})),__vite__mapDeps([49,1,2,3,4,5,47,8,39,33,12,30,31,40,41,35,32,42,25,28,43,9,11,44,48,34]))),f_=(0,J.lazy)(()=>dn(()=>import(`./github-ynnpKFCJ.js`).then(e=>({default:e.GithubRoute})),__vite__mapDeps([50,1,2,3,4,5,47,7,8,25,21,15,22,23,10,12,30,14,16,17,18,24,40,31,41,35,32]))),p_=(0,J.lazy)(()=>dn(()=>import(`./workflows-CTaAKz2m.js`).then(e=>({default:e.WorkflowsRoute})),__vite__mapDeps([51,1,2,3,4,5,19,27,52,10,11,12,44,23,15,24]))),m_=(0,J.lazy)(()=>dn(()=>import(`./skills-CivqD4si.js`).then(e=>({default:e.SkillsRoute})),__vite__mapDeps([53,1,2,3,4,5,47,7,8,52,10,12,22,23,15,30,24])));function h_(){let e=c();return(0,Y.jsx)(Mi,{to:{pathname:`/skills`,search:e.search,hash:e.hash},replace:!0})}function g_({sectionId:e}){let t=c();return(0,Y.jsx)(y,{to:{pathname:vh(`global`,e),search:t.search,hash:t.hash},replace:!0})}function __(){return(0,Y.jsx)(`div`,{"data-route":`scope-resolving`,className:`flex min-h-full flex-col`,children:(0,Y.jsx)(`p`,{className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:`Loading…`})})}function v_(){let{projectId:e=``}=w(),t=c(),n=R(),r=I();if(e==="default"){let e=n.data?.bootProject??(n.isError?r.data?.bootProject:void 0);if(e!==void 0){let n=t.pathname.replace(/^\/p\/default(?=\/|$)/,``);return(0,Y.jsx)(y,{to:`/p/${encodeURIComponent(e)}${n||`/`}${t.search}${t.hash}`,replace:!0})}if(!n.isError)return(0,Y.jsx)(__,{})}if(n.data){if(!(n.data.bootProject===e||n.data.projects.some(t=>t.id===e)))return(0,Y.jsx)(Ad,{projectId:e,registry:n.data})}else if(!n.isError)return(0,Y.jsx)(__,{});return(0,Y.jsx)(d,{projectId:n.data?.bootProject===e?null:e,children:(0,Y.jsx)(D,{},e)})}function y_(){let{projectId:e=``}=w();return(0,Y.jsx)(gd,{},e)}function b_(){let e=c(),t=I(),n=R(),r=t.data?.bootProject??n.data?.bootProject,i=(t.data!==void 0||t.isError)&&(n.data!==void 0||n.isError);if(r===void 0&&!i)return(0,Y.jsx)(__,{});let a=r??`default`;if(e.pathname===`/`&&e.search===``&&e.hash===``){if(n.data===void 0&&!n.isError)return(0,Y.jsx)(__,{});let e=uu(iu(),n.data,r);if(e!==null)return(0,Y.jsx)(y,{to:e,replace:!0})}let o=e.pathname===`/p`||e.pathname===`/p/`?`/`:e.pathname;return(0,Y.jsx)(y,{to:`/p/${encodeURIComponent(a)}${o}${e.search}${e.hash}`,replace:!0})}var x_=[{pattern:`/`,pageLabel:`Tasks`},{pattern:`/tasks`,pageLabel:`All tasks`},{pattern:`/new`,pageLabel:`New task`},{pattern:`/compare/:groupId`,pageLabel:`Compare`},{pattern:`/git/*`,pageLabel:`Git`},{pattern:`/github/*`,pageLabel:`GitHub`},{pattern:`/automations/*`,pageLabel:`Automations`},{pattern:`/skills`,pageLabel:`Skills`},{pattern:`/inbox`,pageLabel:`Inbox`},{pattern:`/workflows/*`,pageLabel:`Workflows`},{pattern:`/settings/*`,pageLabel:`Settings`}];function S_(e){let t=ji(e),n=rn({path:`/tasks/:id/*`,end:!0},t);return n?{pageLabel:null,taskId:n.params.id??null}:{pageLabel:x_.find(({pattern:e})=>rn({path:e,end:!0},t))?.pageLabel??null,taskId:null}}function C_(){let e=I().data?.capabilities;return(0,Y.jsxs)(ve,{children:[(0,Y.jsxs)(k,{path:`/p/:projectId`,element:(0,Y.jsx)(v_,{}),children:[(0,Y.jsx)(k,{index:!0,element:(0,Y.jsx)(rg,{})}),(0,Y.jsx)(k,{path:`new`,element:(0,Y.jsx)(y_,{})}),(0,Y.jsx)(k,{path:`tasks/:id`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(Jn,{}),children:(0,Y.jsx)(o_,{})})}),(0,Y.jsx)(k,{path:`tasks/:id/changes`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(Md,{tab:`changes`}),children:(0,Y.jsx)(c_,{})})}),(0,Y.jsx)(k,{path:`tasks/:id/files`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(Md,{tab:`files`}),children:(0,Y.jsx)(l_,{})})}),(0,Y.jsx)(k,{path:`tasks/:id/commits`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(Md,{tab:`changes`}),children:(0,Y.jsx)(u_,{})})}),(0,Y.jsx)(k,{path:`tasks/:id/commits/:sha`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(Md,{tab:`changes`}),children:(0,Y.jsx)(u_,{})})}),(0,Y.jsx)(k,{path:`compare/:groupId`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(fu,{}),children:(0,Y.jsx)(s_,{})})}),(0,Y.jsx)(k,{path:`git`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(Od,{}),children:(0,Y.jsx)(d_,{tab:`changes`})})}),(0,Y.jsx)(k,{path:`git/commits`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(Od,{}),children:(0,Y.jsx)(d_,{tab:`commits`})})}),(0,Y.jsx)(k,{path:`git/commits/:sha`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(Od,{}),children:(0,Y.jsx)(d_,{tab:`commits`})})}),(0,Y.jsx)(k,{path:`git/branches`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(Od,{}),children:(0,Y.jsx)(d_,{tab:`branches`})})}),(0,Y.jsx)(k,{path:`github`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(pu,{}),children:(0,Y.jsx)(f_,{view:`issues`,index:!0})})}),(0,Y.jsx)(k,{path:`github/prs`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(pu,{}),children:(0,Y.jsx)(f_,{view:`prs`})})}),(0,Y.jsx)(k,{path:`github/issues/:n`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(pu,{}),children:(0,Y.jsx)(f_,{view:`issues`})})}),(0,Y.jsx)(k,{path:`github/prs/:n`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(pu,{}),children:(0,Y.jsx)(f_,{view:`prs`})})}),(0,Y.jsx)(k,{path:`github/prs/:n/changes`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(pu,{}),children:(0,Y.jsx)(f_,{view:`prs`,changes:!0})})}),(0,Y.jsx)(k,{path:`automations`,element:(0,Y.jsx)(t_,{})}),(0,Y.jsx)(k,{path:`automations/new`,element:(0,Y.jsx)(t_,{mode:`new`})}),(0,Y.jsx)(k,{path:`automations/:automationId`,element:(0,Y.jsx)(t_,{mode:`edit`})}),(0,Y.jsx)(k,{path:`automations/:automationId/log`,element:(0,Y.jsx)(t_,{mode:`log`})}),(0,Y.jsx)(k,{path:`skills`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(kd,{}),children:(0,Y.jsx)(m_,{})})}),(0,Y.jsx)(k,{path:`inbox`,element:(0,Y.jsx)(Su,{})}),(0,Y.jsx)(k,{path:`workflows`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(jd,{}),children:(0,Y.jsx)(p_,{})})}),(0,Y.jsx)(k,{path:`workflows/:name`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(jd,{}),children:(0,Y.jsx)(p_,{})})}),(0,Y.jsx)(k,{path:`settings`,element:(0,Y.jsx)(wh,{scope:`project`,capabilities:e})}),(0,Y.jsx)(k,{path:`settings/skills`,element:(0,Y.jsx)(h_,{})}),ch(`project`,e).map(t=>(0,Y.jsx)(k,{path:`settings/${t.id}`,element:(0,Y.jsx)(Ch,{section:t,scope:`project`,capabilities:e})},t.id)),ch(`global`,e).map(e=>(0,Y.jsx)(k,{path:`settings/${e.id}`,element:(0,Y.jsx)(g_,{sectionId:e.id})},e.id)),(0,Y.jsx)(k,{path:`*`,element:(0,Y.jsx)(Dd,{})})]}),(0,Y.jsx)(k,{path:`/tasks`,element:(0,Y.jsx)(Bg,{})}),(0,Y.jsx)(k,{path:`/settings/global`,element:(0,Y.jsx)(wh,{scope:`global`,capabilities:e})}),ch(`global`,e).map(t=>(0,Y.jsx)(k,{path:vh(`global`,t.id),element:(0,Y.jsx)(Ch,{section:t,scope:`global`,capabilities:e})},t.id)),(0,Y.jsx)(k,{path:`*`,element:(0,Y.jsx)(b_,{})})]})}function w_(e){let t=e?.repo;if(!t)return null;let n=t.root.replace(/[\\/]+$/,``).split(/[\\/]/).pop();return n?{name:n,branch:t.branch}:null}function T_(e){return e?.available===!0&&(e.status===`available`||e.status===`error`)}function E_({children:e}){let{pathname:t}=c(),n=Ni(),r=I(),i=r.data?.capabilities.followups===!0,a=r.data?.capabilities.automations===!0,o=ke(i),s=T_(l(n??``,n!==null).data),u=b(),d=R().data,f=S_(t),p=d?.bootProject??r.data?.bootProject??null,m=n!==null&&n===p,h=d?.projects.find(e=>e.id===n),g=Gt(n??``,h!==void 0&&f.taskId!==null,d?.bootProject===n).data,_=t===`/settings/global`||t.startsWith(`/settings/global/`)?null:h?.name??(m?w_(r.data)?.name??null:null),v=f.taskId?g?.find(e=>e.id===f.taskId):void 0;nu({projectName:_,pageLabel:v?Kt(v):f.pageLabel});let y=d&&d.projects.length>1?d:null;return(0,Y.jsxs)(yl,{children:[(0,Y.jsx)(ol,{repo:w_(r.data),version:r.data?.version??null,latestVersion:r.data?.latestVersion??null,inboxCount:o.data?.length??null,unreadCount:u.data?bn(u.data):null,skillsUpdateAvailable:s,forgeAvailable:r.data?.forge?.available===!0,inboxAvailable:i,automationsAvailable:a,banner:(0,Y.jsx)(Dl,{}),singleProject:r.data?.capabilities.singleProject===!0,taskQuickList:(0,Y.jsx)(Il,{}),projectGroups:y?(0,Y.jsx)(Wl,{projects:y.projects,bootProjectId:y.bootProject,inboxAvailable:i,automationsAvailable:a,inboxCount:o.data?.length??null,skillsUpdateAvailable:s}):void 0,toolsMenu:(0,Y.jsx)(Zl,{health:r.data}),children:e}),(0,Y.jsx)(Jc,{})]})}function D_(){let e=c(),t=R();return(0,J.useEffect)(()=>{let n=lu(e,t.data);n!==null&&(du(iu(),n)||au(n))},[e.hash,e.pathname,e.search,t.data]),null}function O_(){let e=O(),t=vm(Nt().data?.notifications).enabled,n=(0,J.useRef)(t);n.current=t;let r=(0,J.useRef)(new Map);return(0,J.useEffect)(()=>{let t=Ft(B.runs.list()),i=e=>{let{entering:t,statuses:i}=bm(r.current,e);if(r.current=i,t.length!==0&&xm({enabled:n.current,hidden:document.visibilityState===`hidden`,permission:ym()}))for(let e of t)k_(e)};return i(e.getQueryData(B.runs.list())),e.getQueryCache().subscribe(e=>{e.query.queryHash!==t||e.type!==`updated`||i(e.query.state.data)})},[e]),null}function k_(e){let t=globalThis.Notification;if(typeof t!=`function`)return;let n=Sm(e);try{new t(n.title,{body:n.body,tag:n.tag})}catch{}}var A_=class extends J.Component{state={failed:!1,locationKey:this.props.locationKey};static getDerivedStateFromError(){return{failed:!0}}static getDerivedStateFromProps(e,t){return e.locationKey===t.locationKey?null:{failed:!1,locationKey:e.locationKey}}render(){return this.state.failed?(0,Y.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-3 p-6`,children:[(0,Y.jsx)(`h1`,{className:`text-lg font-semibold`,children:`This page could not be displayed.`}),(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Try again, or open another page from the sidebar.`}),(0,Y.jsx)(L,{onClick:()=>this.setState({failed:!1}),children:`Try again`})]}):this.props.children}};function j_({children:e}){let t=c();return(0,Y.jsx)(A_,{locationKey:t.key,children:e})}function M_(){let[e]=(0,J.useState)(Pa);return(0,Y.jsx)(Mt,{client:e,children:(0,Y.jsxs)(Aa,{children:[(0,Y.jsx)(O_,{}),(0,Y.jsx)(Pc,{children:(0,Y.jsx)(Hf,{children:(0,Y.jsxs)(ce,{children:[(0,Y.jsx)(D_,{}),(0,Y.jsx)(In,{children:(0,Y.jsx)(E_,{children:(0,Y.jsx)(j_,{children:(0,Y.jsx)(C_,{})})})}),(0,Y.jsx)(Pt,{})]})})})]})})}function N_(){return(document.querySelector(`meta[name="xez-api-base"]`)?.getAttribute(`content`))?.trim()||``}un(N_());var P_=document.getElementById(`root`);if(!P_)throw Error(`xezar: #root container is missing from index.html`);(0,sa.createRoot)(P_).render((0,Y.jsx)(J.StrictMode,{children:(0,Y.jsx)(M_,{})}));export{Qa as C,io as S,Fo as _,Od as a,wo as b,Wu as c,gu as d,mu as f,hc as g,vc as h,jd as i,vu as l,fu as m,Nd as n,Gu as o,pu as p,Md as r,Ku as s,ep as t,_u as u,Eo as v,ao as x,To as y};