@open-mercato/cezar 0.9.1 → 0.9.2

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 (300) hide show
  1. package/README.md +19 -11
  2. package/dist/agent-config/catalog.d.ts +1 -1
  3. package/dist/agent-config/files.d.ts +1 -1
  4. package/dist/agent-config/service.d.ts +1 -1
  5. package/dist/agent-config/validate.d.ts +1 -1
  6. package/dist/automations/coordinator.d.ts +26 -0
  7. package/dist/automations/coordinator.js +66 -0
  8. package/dist/automations/coordinator.js.map +1 -0
  9. package/dist/automations/github-poller.d.ts +74 -0
  10. package/dist/automations/github-poller.js +234 -0
  11. package/dist/automations/github-poller.js.map +1 -0
  12. package/dist/automations/scheduler.d.ts +42 -0
  13. package/dist/automations/scheduler.js +192 -0
  14. package/dist/automations/scheduler.js.map +1 -0
  15. package/dist/automations/store.d.ts +65 -0
  16. package/dist/automations/store.js +298 -0
  17. package/dist/automations/store.js.map +1 -0
  18. package/dist/automations/task-template.d.ts +18 -0
  19. package/dist/automations/task-template.js +95 -0
  20. package/dist/automations/task-template.js.map +1 -0
  21. package/dist/automations/types.d.ts +251 -0
  22. package/dist/automations/types.js +158 -0
  23. package/dist/automations/types.js.map +1 -0
  24. package/dist/config.d.ts +9 -111
  25. package/dist/contract/agent-config.d.ts +151 -0
  26. package/dist/contract/automations.d.ts +911 -0
  27. package/dist/contract/events.d.ts +45 -0
  28. package/dist/contract/github.d.ts +467 -0
  29. package/dist/contract/health.d.ts +96 -0
  30. package/dist/contract/index.d.ts +15 -0
  31. package/dist/contract/index.js +1421 -0
  32. package/dist/contract/projects.d.ts +182 -0
  33. package/dist/contract/repo.d.ts +234 -0
  34. package/dist/contract/runs.d.ts +1226 -0
  35. package/dist/contract/skills.d.ts +225 -0
  36. package/dist/contract/workflows.d.ts +212 -0
  37. package/dist/contract/workspace.d.ts +442 -0
  38. package/dist/core/agent-env.d.ts +1 -1
  39. package/dist/core/agent-runner.d.ts +12 -1
  40. package/dist/core/agent-runner.js +13 -0
  41. package/dist/core/agent-runner.js.map +1 -1
  42. package/dist/core/ask.d.ts +45 -124
  43. package/dist/core/ask.js +103 -13
  44. package/dist/core/ask.js.map +1 -1
  45. package/dist/core/claude-cli-runner.d.ts +2 -2
  46. package/dist/core/claude-cli-runner.js +52 -9
  47. package/dist/core/claude-cli-runner.js.map +1 -1
  48. package/dist/core/claude-ui-mapper.d.ts +1 -1
  49. package/dist/core/codex-app-server-runner.d.ts +1 -1
  50. package/dist/core/codex-app-server-runner.js +55 -3
  51. package/dist/core/codex-app-server-runner.js.map +1 -1
  52. package/dist/core/codex-app-server-transport.d.ts +6 -1
  53. package/dist/core/codex-app-server-transport.js +12 -3
  54. package/dist/core/codex-app-server-transport.js.map +1 -1
  55. package/dist/core/codex-model-catalog.d.ts +1 -1
  56. package/dist/core/codex-ui-mapper.d.ts +5 -1
  57. package/dist/core/codex-ui-mapper.js +74 -17
  58. package/dist/core/codex-ui-mapper.js.map +1 -1
  59. package/dist/core/model-identity.d.ts +1 -1
  60. package/dist/core/model-presets.d.ts +2 -2
  61. package/dist/core/model-presets.js +1 -1
  62. package/dist/core/opencode-server-runner.d.ts +2 -2
  63. package/dist/core/opencode-ui-mapper.d.ts +4 -1
  64. package/dist/core/opencode-ui-mapper.js +45 -7
  65. package/dist/core/opencode-ui-mapper.js.map +1 -1
  66. package/dist/core/provider-auth.d.ts +62 -0
  67. package/dist/core/provider-auth.js +290 -0
  68. package/dist/core/provider-auth.js.map +1 -0
  69. package/dist/core/provider-availability.d.ts +3 -0
  70. package/dist/core/provider-availability.js +13 -0
  71. package/dist/core/provider-availability.js.map +1 -0
  72. package/dist/core/runner-factory.d.ts +1 -1
  73. package/dist/core/runner-model-catalog.d.ts +1 -1
  74. package/dist/core/tool-display.d.ts +1 -1
  75. package/dist/core/ui-events.d.ts +1 -1
  76. package/dist/core/ui-events.js +1 -1
  77. package/dist/git-diff-base.d.ts +60 -0
  78. package/dist/git-diff-base.js +54 -0
  79. package/dist/git-diff-base.js.map +1 -0
  80. package/dist/git-worktree.d.ts +37 -6
  81. package/dist/git-worktree.js +39 -9
  82. package/dist/git-worktree.js.map +1 -1
  83. package/dist/handoff.d.ts +2 -2
  84. package/dist/handoff.js +1 -1
  85. package/dist/index.js +65 -8
  86. package/dist/index.js.map +1 -1
  87. package/dist/paths.d.ts +16 -1
  88. package/dist/paths.js +24 -1
  89. package/dist/paths.js.map +1 -1
  90. package/dist/planner.d.ts +2 -2
  91. package/dist/planner.js +1 -1
  92. package/dist/planner.js.map +1 -1
  93. package/dist/release/manifests.d.ts +81 -0
  94. package/dist/release/manifests.js +74 -0
  95. package/dist/release/manifests.js.map +1 -0
  96. package/dist/release/snapshot.d.ts +9 -23
  97. package/dist/release/snapshot.js +9 -22
  98. package/dist/release/snapshot.js.map +1 -1
  99. package/dist/release/stable.d.ts +15 -29
  100. package/dist/release/stable.js +14 -27
  101. package/dist/release/stable.js.map +1 -1
  102. package/dist/runs/auto-name.d.ts +1 -1
  103. package/dist/runs/retention.d.ts +1 -1
  104. package/dist/runs/store.d.ts +142 -336
  105. package/dist/runs/store.js +136 -9
  106. package/dist/runs/store.js.map +1 -1
  107. package/dist/runs/ui-event-sink.d.ts +1 -1
  108. package/dist/server/app-type.d.ts +21 -0
  109. package/dist/server/app-type.js +2 -0
  110. package/dist/server/app-type.js.map +1 -0
  111. package/dist/server/capabilities.d.ts +6 -5
  112. package/dist/server/capabilities.js +11 -0
  113. package/dist/server/capabilities.js.map +1 -1
  114. package/dist/server/forge/github.d.ts +58 -151
  115. package/dist/server/forge/github.js +530 -6
  116. package/dist/server/forge/github.js.map +1 -1
  117. package/dist/server/forge/index.d.ts +10 -3
  118. package/dist/server/forge/index.js +14 -1
  119. package/dist/server/forge/index.js.map +1 -1
  120. package/dist/server/forge/types.d.ts +86 -1
  121. package/dist/server/git-changes.d.ts +8 -8
  122. package/dist/server/git-changes.js +14 -17
  123. package/dist/server/git-changes.js.map +1 -1
  124. package/dist/server/git.d.ts +2 -0
  125. package/dist/server/git.js +9 -0
  126. package/dist/server/git.js.map +1 -1
  127. package/dist/server/github.d.ts +3 -3
  128. package/dist/server/github.js +1 -1
  129. package/dist/server/github.js.map +1 -1
  130. package/dist/server/pr.d.ts +2 -2
  131. package/dist/server/project-context.d.ts +20 -3
  132. package/dist/server/project-context.js +30 -1
  133. package/dist/server/project-context.js.map +1 -1
  134. package/dist/server/provider-action-gate.d.ts +8 -0
  135. package/dist/server/provider-action-gate.js +54 -0
  136. package/dist/server/provider-action-gate.js.map +1 -0
  137. package/dist/server/provider-auth-runtime.d.ts +21 -0
  138. package/dist/server/provider-auth-runtime.js +66 -0
  139. package/dist/server/provider-auth-runtime.js.map +1 -0
  140. package/dist/server/server.d.ts +11142 -47
  141. package/dist/server/server.js +1714 -806
  142. package/dist/server/server.js.map +1 -1
  143. package/dist/server/validators.d.ts +97 -0
  144. package/dist/server/validators.js +86 -0
  145. package/dist/server/validators.js.map +1 -0
  146. package/dist/server/ws.d.ts +2 -2
  147. package/dist/server/ws.js +2 -2
  148. package/dist/server/ws.js.map +1 -1
  149. package/dist/server-install/engine.d.ts +1 -1
  150. package/dist/server-install/platforms/macosx-ngrok.d.ts +1 -1
  151. package/dist/server-install/platforms/ubuntu-vps.d.ts +16 -1
  152. package/dist/server-install/platforms/ubuntu-vps.js +83 -1
  153. package/dist/server-install/platforms/ubuntu-vps.js.map +1 -1
  154. package/dist/server-install/state.d.ts +1 -1
  155. package/dist/server-install/steps.d.ts +2 -2
  156. package/dist/server-install/strategies.d.ts +1 -1
  157. package/dist/server-install/types.d.ts +38 -424
  158. package/dist/server-install/ui.d.ts +1 -1
  159. package/dist/skills-banner.d.ts +7 -6
  160. package/dist/skills-banner.js +7 -6
  161. package/dist/skills-banner.js.map +1 -1
  162. package/dist/skills-remote.d.ts +2 -2
  163. package/dist/skills-update.d.ts +88 -0
  164. package/dist/skills-update.js +392 -0
  165. package/dist/skills-update.js.map +1 -0
  166. package/dist/skills.d.ts +2 -0
  167. package/dist/skills.js +3 -2
  168. package/dist/skills.js.map +1 -1
  169. package/dist/todos.d.ts +2 -28
  170. package/dist/todos.js +1 -1
  171. package/dist/ui-state.d.ts +16 -2
  172. package/dist/ui-state.js +14 -1
  173. package/dist/ui-state.js.map +1 -1
  174. package/dist/workflows/load.d.ts +1 -1
  175. package/dist/workflows/run.d.ts +53 -12
  176. package/dist/workflows/run.js +436 -64
  177. package/dist/workflows/run.js.map +1 -1
  178. package/dist/workflows/types.d.ts +59 -224
  179. package/dist/workflows/types.js +14 -0
  180. package/dist/workflows/types.js.map +1 -1
  181. package/dist/workspace/config.d.ts +68 -206
  182. package/dist/workspace/config.js +145 -14
  183. package/dist/workspace/config.js.map +1 -1
  184. package/dist/workspace/migrations.d.ts +1 -1
  185. package/dist/workspace/migrations.js +19 -4
  186. package/dist/workspace/migrations.js.map +1 -1
  187. package/dist/workspace/projects.d.ts +8 -2
  188. package/dist/workspace/projects.js +9 -3
  189. package/dist/workspace/projects.js.map +1 -1
  190. package/dist/workspace/semaphore.d.ts +6 -0
  191. package/dist/workspace/semaphore.js +14 -1
  192. package/dist/workspace/semaphore.js.map +1 -1
  193. package/dist/workspace/ui-state.d.ts +13 -3
  194. package/dist/workspace/ui-state.js +15 -5
  195. package/dist/workspace/ui-state.js.map +1 -1
  196. package/package.json +17 -39
  197. package/scripts/inline-contract.mjs +112 -0
  198. package/scripts/mock-claude.mjs +39 -1
  199. package/scripts/sync-readme.mjs +20 -0
  200. package/web/dist/assets/alert-dialog-ghffK6g9.js +1 -0
  201. package/web/dist/assets/arrow-down-Cz8qb71e.js +1 -0
  202. package/web/dist/assets/arrow-left-wcYKQXI_.js +1 -0
  203. package/web/dist/assets/bundle-mjs-BT31bpU6.js +1 -0
  204. package/web/dist/assets/centered-state-ZtnFHA-n.js +43 -0
  205. package/web/dist/assets/chevron-right-G4caF2QV.js +1 -0
  206. package/web/dist/assets/{chunk-BO2N2NFS-DtrdTCWa.js → chunk-BO2N2NFS-DE6qKn3r.js} +8 -8
  207. package/web/dist/assets/circle-check--KvBxXWp.js +1 -0
  208. package/web/dist/assets/circle-x-C3EFZ3xf.js +1 -0
  209. package/web/dist/assets/collapsible-B0JVzd0B.js +1 -0
  210. package/web/dist/assets/commit-list-wm6DPHNs.js +1 -0
  211. package/web/dist/assets/compare-variants-DbdP4Y5T.js +1 -0
  212. package/web/dist/assets/{core-DePtBHcl.js → core-BCsw8oQw.js} +1 -1
  213. package/web/dist/assets/diff-Bizc96qe.js +3 -0
  214. package/web/dist/assets/diff-stat-Dyfg3ltF.js +1 -0
  215. package/web/dist/assets/{diff-view-DCeSegKk.js → diff-view-CG8ek6tC.js} +4 -4
  216. package/web/dist/assets/dropdown-menu-C1Dlf35P.js +1 -0
  217. package/web/dist/assets/editable-title-5rC_QRBZ.js +1 -0
  218. package/web/dist/assets/{ellipsis-vertical-CNnSLn5a.js → ellipsis-vertical-DpGTRqC2.js} +1 -1
  219. package/web/dist/assets/{file-D4GBh1ao.js → file-DlUGpUlb.js} +1 -1
  220. package/web/dist/assets/folder-BAY6Vddy.js +1 -0
  221. package/web/dist/assets/{git-pull-request-DnR8Xh4_.js → git-pull-request-agOG0iGM.js} +1 -1
  222. package/web/dist/assets/git-toolbar-DGiNMmtY.js +1 -0
  223. package/web/dist/assets/github-Vp7lxYGQ.js +1 -0
  224. package/web/dist/assets/highlighted-body-OFNGDK62-BL-MfFgl.js +1 -0
  225. package/web/dist/assets/highlighter-CdHqIwFr.js +3 -0
  226. package/web/dist/assets/image-preview-BWGk5fPX.js +1 -0
  227. package/web/dist/assets/index-DSxyJpuK.css +2 -0
  228. package/web/dist/assets/index-DiawI6RX.js +6 -0
  229. package/web/dist/assets/lib-BQXq3kEf.js +1 -0
  230. package/web/dist/assets/lib-BxQXEXDF.js +1 -0
  231. package/web/dist/assets/markdown-BGBOGCA_.js +2 -0
  232. package/web/dist/assets/mermaid-GHXKKRXX-C4jxqUUb.js +1 -0
  233. package/web/dist/assets/new-task-form-BpAw_Dks.js +1 -0
  234. package/web/dist/assets/pill-Dvs-P0xy.js +1 -0
  235. package/web/dist/assets/project-router-Cx8NPoqn.js +1 -0
  236. package/web/dist/assets/prompt-templates-CSBYBR1I.js +15 -0
  237. package/web/dist/assets/react-runtime-CCIEwYL0.js +9 -0
  238. package/web/dist/assets/{refresh-cw-BT8E96Tm.js → refresh-cw-BoGdAykg.js} +1 -1
  239. package/web/dist/assets/repo-git-PmX-BNMo.js +1 -0
  240. package/web/dist/assets/rolldown-runtime-QTnfLwEv.js +1 -0
  241. package/web/dist/assets/run-diff-EcOkf3ti.js +3 -0
  242. package/web/dist/assets/run-header-BGiv6_qX.js +1 -0
  243. package/web/dist/assets/{search-x-BDjaMrzG.js → search-x-X3EpVhgs.js} +1 -1
  244. package/web/dist/assets/skill-empty-hint-CZLALx6l.js +1 -0
  245. package/web/dist/assets/skills-BiWfHmCR.js +1 -0
  246. package/web/dist/assets/skills-CC91ouGH.js +1 -0
  247. package/web/dist/assets/sparkles-Dt4q7pbG.js +1 -0
  248. package/web/dist/assets/{square-terminal-Ckjjn0vb.js → square-terminal-hwBL8XsC.js} +1 -1
  249. package/web/dist/assets/tab-link-DIlR5T07.js +1 -0
  250. package/web/dist/assets/task-changes-XkHDxzQA.js +1 -0
  251. package/web/dist/assets/task-commits-BTTA5k5T.js +1 -0
  252. package/web/dist/assets/task-files-Da8_4C9g.js +2 -0
  253. package/web/dist/assets/task-thread-DoNXUsHr.js +9 -0
  254. package/web/dist/assets/textarea-CUdokhkv.js +1 -0
  255. package/web/dist/assets/thread-loading-B8q8ukXJ.js +1 -0
  256. package/web/dist/assets/{trash-2-DAyZ0VSi.js → trash-2-DhVIdWv8.js} +1 -1
  257. package/web/dist/assets/{triangle-alert-Uy8rokUh.js → triangle-alert-XYT0DGCI.js} +1 -1
  258. package/web/dist/assets/{upload-CDdyPPo_.js → upload-BKjN59-1.js} +1 -1
  259. package/web/dist/assets/use-desktop-Bf5LS_P4.js +1 -0
  260. package/web/dist/assets/use-submit-shortcut-CzVyoAMd.js +1 -0
  261. package/web/dist/assets/utils-DsLuRXwV.js +64 -0
  262. package/web/dist/assets/workflows-o2QU_pvU.js +11 -0
  263. package/web/dist/assets/zoomable-image-7WyUiaVD.js +1 -0
  264. package/web/dist/index.html +32 -13
  265. package/scripts/dev.mjs +0 -74
  266. package/scripts/release-snapshot.mjs +0 -130
  267. package/scripts/release.mjs +0 -119
  268. package/web/dist/assets/arrow-left-CnSdp92h.js +0 -1
  269. package/web/dist/assets/bundle-mjs-BegPhL5c.js +0 -1
  270. package/web/dist/assets/centered-state-DOsTcJZF.js +0 -43
  271. package/web/dist/assets/commit-list-BrxBEzRK.js +0 -1
  272. package/web/dist/assets/compare-variants-Bv2c9ORF.js +0 -1
  273. package/web/dist/assets/dist-B6XQOhgM.js +0 -1
  274. package/web/dist/assets/git-toolbar-pIC1ubPM.js +0 -1
  275. package/web/dist/assets/github-DTTSG0ht.js +0 -1
  276. package/web/dist/assets/highlighted-body-OFNGDK62-BuFJwunK.js +0 -1
  277. package/web/dist/assets/image-preview-DEhW0TFz.js +0 -1
  278. package/web/dist/assets/index-Cijmlz7q.js +0 -30
  279. package/web/dist/assets/index-DzroxqBG.css +0 -2
  280. package/web/dist/assets/lib-DPEZDBUN.js +0 -1
  281. package/web/dist/assets/lib-uHpeUPzK.js +0 -1
  282. package/web/dist/assets/mermaid-GHXKKRXX-CN2zQue0.js +0 -1
  283. package/web/dist/assets/open-mercato-toBr6SOa.svg +0 -11
  284. package/web/dist/assets/project-router-BMx4e8m-.js +0 -1
  285. package/web/dist/assets/repo-git-BusYfa3t.js +0 -1
  286. package/web/dist/assets/run-diff-wOJ3odA-.js +0 -3
  287. package/web/dist/assets/run-header-Cg5incil.js +0 -1
  288. package/web/dist/assets/skill-empty-hint-DTUSp6Vl.js +0 -1
  289. package/web/dist/assets/skills-PpP2owbM.js +0 -1
  290. package/web/dist/assets/tab-link-F3uQrdm2.js +0 -1
  291. package/web/dist/assets/task-changes-iD9kS79I.js +0 -1
  292. package/web/dist/assets/task-commits-COkLaUri.js +0 -1
  293. package/web/dist/assets/task-files-Ckttz7XH.js +0 -2
  294. package/web/dist/assets/task-thread-CQD91VPt.js +0 -9
  295. package/web/dist/assets/textarea-Bj_LCreg.js +0 -1
  296. package/web/dist/assets/use-desktop-DUh0STzq.js +0 -3
  297. package/web/dist/assets/utils-B8s5qIcK.js +0 -1
  298. package/web/dist/assets/workflows-BFk8C0co.js +0 -11
  299. package/web/dist/assets/zoomable-image-PEDOqyLQ.js +0 -1
  300. /package/web/{open-mercato.svg → dist/open-mercato.svg} +0 -0
@@ -0,0 +1,6 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/task-thread-DoNXUsHr.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-runtime-CCIEwYL0.js","assets/centered-state-ZtnFHA-n.js","assets/utils-DsLuRXwV.js","assets/bundle-mjs-BT31bpU6.js","assets/run-header-BGiv6_qX.js","assets/editable-title-5rC_QRBZ.js","assets/new-task-form-BpAw_Dks.js","assets/circle-check--KvBxXWp.js","assets/circle-x-C3EFZ3xf.js","assets/dropdown-menu-C1Dlf35P.js","assets/trash-2-DhVIdWv8.js","assets/ellipsis-vertical-DpGTRqC2.js","assets/tab-link-DIlR5T07.js","assets/project-router-Cx8NPoqn.js","assets/folder-BAY6Vddy.js","assets/sparkles-Dt4q7pbG.js","assets/square-terminal-hwBL8XsC.js","assets/collapsible-B0JVzd0B.js","assets/alert-dialog-ghffK6g9.js","assets/pill-Dvs-P0xy.js","assets/markdown-BGBOGCA_.js","assets/chunk-BO2N2NFS-DE6qKn3r.js","assets/lib-BxQXEXDF.js","assets/highlighter-CdHqIwFr.js","assets/diff-stat-Dyfg3ltF.js","assets/arrow-down-Cz8qb71e.js","assets/thread-loading-B8q8ukXJ.js","assets/prompt-templates-CSBYBR1I.js","assets/use-submit-shortcut-CzVyoAMd.js","assets/textarea-CUdokhkv.js","assets/skills-BiWfHmCR.js","assets/chevron-right-G4caF2QV.js","assets/git-pull-request-agOG0iGM.js","assets/search-x-X3EpVhgs.js","assets/lib-BQXq3kEf.js","assets/zoomable-image-7WyUiaVD.js","assets/run-diff-EcOkf3ti.js","assets/compare-variants-DbdP4Y5T.js","assets/task-changes-XkHDxzQA.js","assets/git-toolbar-DGiNMmtY.js","assets/file-DlUGpUlb.js","assets/use-desktop-Bf5LS_P4.js","assets/upload-BKjN59-1.js","assets/diff-Bizc96qe.js","assets/image-preview-BWGk5fPX.js","assets/task-files-Da8_4C9g.js","assets/triangle-alert-XYT0DGCI.js","assets/task-commits-BTTA5k5T.js","assets/arrow-left-wcYKQXI_.js","assets/commit-list-wm6DPHNs.js","assets/repo-git-PmX-BNMo.js","assets/github-Vp7lxYGQ.js","assets/refresh-cw-BoGdAykg.js","assets/workflows-o2QU_pvU.js","assets/skill-empty-hint-CZLALx6l.js","assets/skills-CC91ouGH.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{$ as i,$n as a,A as o,At as s,Bn as c,Bt as l,C as u,Cn as d,Cr as f,Ct as p,D as m,Dr as h,Dt as g,E as _,Er as v,Et as y,Fn as b,Ft as ee,Gn as te,Gt as ne,Hn as re,Ht as ie,In as x,Jn as ae,Jt as oe,K as se,Kn as ce,Kt as S,L as le,Ln as C,Lt as ue,M as de,Mt as fe,N as w,Nn as pe,Nt as T,O as me,Ot as E,P as he,Pn as ge,Pt as _e,Q as D,Qn as ve,Qt as ye,Rt as be,Sr as O,St as xe,Tr as Se,Tt as Ce,U as k,Un as we,Vt as Te,W as Ee,Wn as De,Wt as Oe,Xn as ke,Xt as A,Yn as j,Yt as Ae,Z as je,Zn as Me,_ as Ne,_r as Pe,_t as Fe,a as M,ar as N,at as Ie,b as Le,br as Re,bt as ze,cn as Be,cr as Ve,ct as He,dr as Ue,er as We,et as Ge,fr as P,gn as Ke,gr as F,gt as qe,hn as Je,hr as Ye,i as I,in as Xe,ir as Ze,j as Qe,jn as $e,jt as et,k as tt,kn as nt,lr as L,mn as rt,mr as it,n as at,nr as R,nt as ot,on as st,or as ct,pr as lt,qn as ut,qt as dt,r as ft,rr as pt,rt as mt,sr as ht,t as z,tn as gt,tr as _t,tt as vt,un as yt,vr as bt,wr as xt,wt as St,x as Ct,xn as wt,xr as Tt,xt as Et,y as Dt,yr as Ot,yt as kt,zn as At,zt as jt}from"./centered-state-ZtnFHA-n.js";import{a as Mt,n as Nt,r as B,s as Pt,t as V,u as Ft}from"./utils-DsLuRXwV.js";import{i as H}from"./bundle-mjs-BT31bpU6.js";import{a as It,i as Lt,n as Rt,o as zt,r as Bt,t as Vt}from"./editable-title-5rC_QRBZ.js";import{t as Ht}from"./arrow-down-Cz8qb71e.js";import{a as Ut,c as Wt,f as Gt,i as Kt,l as qt,m as Jt,n as Yt,o as Xt,p as Zt,r as Qt,s as $t,t as en}from"./thread-loading-B8q8ukXJ.js";import{a as tn,c as nn,d as rn,f as an,i as on,l as sn,m as cn,n as ln,o as un,p as dn,r as fn,s as pn,t as mn,u as hn}from"./new-task-form-BpAw_Dks.js";import{t as gn}from"./chevron-right-G4caF2QV.js";import{c as _n,i as vn,m as yn,n as bn,r as xn,s as Sn,t as Cn}from"./dropdown-menu-C1Dlf35P.js";import{C as wn,E as Tn,S as En,T as Dn,_ as On,a as kn,b as An,f as jn,g as Mn,h as Nn,i as Pn,l as Fn,m as In,n as Ln,o as Rn,p as zn,r as Bn,s as Vn,t as Hn,u as Un,v as Wn,w as Gn,x as U,y as W}from"./prompt-templates-CSBYBR1I.js";import{t as Kn}from"./folder-BAY6Vddy.js";import{t as qn}from"./search-x-X3EpVhgs.js";import{t as Jn}from"./sparkles-Dt4q7pbG.js";import{t as Yn}from"./triangle-alert-XYT0DGCI.js";import{n as Xn,t as Zn}from"./textarea-CUdokhkv.js";import{a as Qn,c as $n,i as er,n as tr,o as nr,r as rr,s as ir,t as ar}from"./alert-dialog-ghffK6g9.js";import{a as or,c as sr,i as cr,l as lr,n as ur,o as dr,r as fr,s as pr}from"./use-submit-shortcut-CzVyoAMd.js";import{a as mr,c as hr,i as gr,l as _r,n as vr,o as yr,r as br,s as xr,t as G}from"./project-router-Cx8NPoqn.js";import{a as Sr,i as Cr,n as wr,o as Tr,r as Er,s as K,t as Dr}from"./pill-Dvs-P0xy.js";import{r as Or,t as kr}from"./markdown-BGBOGCA_.js";import{a as Ar,c as jr,d as Mr,i as Nr,l as Pr,o as Fr,s as Ir,t as Lr,u as Rr}from"./skills-BiWfHmCR.js";import{t as zr}from"./diff-stat-Dyfg3ltF.js";import{i as Br,n as Vr,r as Hr}from"./highlighter-CdHqIwFr.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 Ur=class extends h{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 lt({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=Wr(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=Wr(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=Wr(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=Wr(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){F.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=>Re(t,e))}findAll(e={}){return this.getAll().filter(t=>Re(e,t))}notify(e){F.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return F.batch(()=>Promise.all(e.map(e=>e.continue().catch(O))))}};function Wr(e){return e.options.scope?.id}var Gr=class extends h{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??Ot(r,t),a=this.get(i);return a||(a=new it({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(){F.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=>Tt(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Tt(e,t)):t}notify(e){F.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){F.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){F.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Kr=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Gr,this.#t=e.mutationCache||new Ur,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=v.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Ye.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(xt(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=Pe(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return F.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;F.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return F.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=F.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(O).catch(O)}invalidateQueries(e,t={}){return F.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=F.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(O)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(O)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(xt(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(O).catch(O)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(O).catch(O)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Ye.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(bt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{f(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(bt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{f(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||=Ot(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===Se&&(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()}},q=e(t(),1),qr=n();function Jr(e,t){if(e===`ping`)return{project:null,event:{type:`ping`}};let n;try{n=JSON.parse(t)}catch{return null}if(!Yr(n))return null;let r=n.project;if(typeof r!=`string`||r===``)return null;switch(e){case`run`:{let{project:e,...t}=n;return Xr(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 Yr(n.usage)?{project:r,event:{type:`usage`,usage:n.usage}}:null;default:return null}}function Yr(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Xr(e){return Yr(e)&&typeof e.id==`string`&&e.id!==``}function Zr(e,t){if(!e)return;let n=e.findIndex(e=>e.id===t.id);if(n>=0){let r=[...e];return r[n]=$r(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 Qr(e,t){if(!e)return;let n=e.filter(e=>e.id!==t);return n.length===e.length?e:n}function $r(e,t){return e?.usage?{...t,usage:e.usage}:t}var ei=Object.freeze({});function ti(){let e=ei,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 J=r(),ni=Mt(`/workspace/events`),ri=2,ii=3e3,ai=[`run`,`run-deleted`,`todos`,`usage`,`ping`],oi=[`project-added`,`project-removed`,`checkout-progress`,`automation-change`],si=new Set;function ci(e){return si.add(e),()=>{si.delete(e)}}function li(e){e.invalidateQueries({queryKey:o.runs.all}),e.invalidateQueries({queryKey:o.todos}),e.invalidateQueries({queryKey:o.health}),e.invalidateQueries({queryKey:o.worktrees}),e.invalidateQueries({queryKey:E.providerStatus})}function ui(e){return Pt()??e.getQueryData(o.health)?.bootProject}function di(e,t,n){switch(n.type){case`run`:{e.setQueryData(o.runs.list(),e=>Zr(e,n.run));let t=o.runs.detail(n.run.id);e.getQueryData(t)!==void 0&&e.setQueryData(t,e=>$r(e,n.run));let r=o.runs.changes(n.run.id);e.getQueryData(r)!==void 0&&e.invalidateQueries({queryKey:r}),e.invalidateQueries({queryKey:o.worktrees});return}case`run-deleted`:e.setQueryData(o.runs.list(),e=>Qr(e,n.id)),e.removeQueries({queryKey:o.runs.detail(n.id)}),e.removeQueries({queryKey:o.runs.diff(n.id)}),e.invalidateQueries({queryKey:o.worktrees});return;case`todos`:e.setQueryData(o.todos,n.items);return;case`usage`:t.set(n.usage);return;case`ping`:return}}function fi(e,t=ni){let n=P();(0,q.useEffect)(()=>{let r=globalThis.EventSource;if(typeof r!=`function`)return;let i=null,a,o=!1,s=!1,c=!1,l=!1,u=()=>{c=!0,l=!1;let e=E.providerStatus;n.cancelQueries({queryKey:e,exact:!0}).then(()=>n.invalidateQueries({queryKey:e,exact:!0,refetchType:`active`})).finally(()=>{if(s||!l){c=!1;return}u()})},d=()=>{s||a!==void 0||(a=setTimeout(()=>{a=void 0,s||f()},ii))},f=()=>{i?.close(),i=new r(t,{withCredentials:!0}),i.addEventListener(`open`,()=>{o&&li(n),o=!0});for(let t of ai)i.addEventListener(t,r=>{let i=Jr(t,r.data);i&&(i.project!==null&&i.project!==ui(n)||di(n,e,i.event))});for(let e of oi)i.addEventListener(e,t=>{let r;try{r=JSON.parse(t.data)}catch{return}e!==`checkout-progress`&&e!==`automation-change`&&n.invalidateQueries({queryKey:E.projects});for(let t of[...si])t(e,r)});i.addEventListener(`provider-status`,e=>{let t;try{t=JSON.parse(e.data)}catch{return}let r=ut(t);if(!r)return;let i=E.providerStatus,a=ce(n.getQueryData(i),r);if(a!==void 0){n.setQueryData(i,a);return}if(c){l=!0;return}u()}),i.addEventListener(`error`,()=>{i?.readyState===ri&&d()})},p=()=>{document.visibilityState===`visible`&&(li(n),(!i||i.readyState===ri)&&(clearTimeout(a),a=void 0,f()))},m=()=>{clearTimeout(a),a=void 0,i?.close()},h=e=>{e.persisted&&(li(n),f())};return document.addEventListener(`visibilitychange`,p),window.addEventListener(`pagehide`,m),window.addEventListener(`pageshow`,h),f(),()=>{s=!0,clearTimeout(a),document.removeEventListener(`visibilitychange`,p),window.removeEventListener(`pagehide`,m),window.removeEventListener(`pageshow`,h),i?.close(),i=null}},[n,e,t])}var pi=(0,q.createContext)(null);function mi({children:e}){let[t]=(0,q.useState)(ti);return fi(t),Ee(),(0,J.jsx)(pi.Provider,{value:t,children:e})}function hi(e){let t=(0,q.useContext)(pi),n=t?t.get:_i;return(0,q.useSyncExternalStore)(t?t.subscribe:gi,()=>e?n()[e]:void 0,()=>void 0)}var gi=()=>()=>void 0,_i=()=>ei;function vi(){return new Kr({defaultOptions:{queries:{refetchInterval:!1,staleTime:5*6e4,gcTime:30*6e4,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:(e,t)=>t instanceof A&&t.status>=400&&t.status<500?!1:e<1},mutations:{retry:!1}}})}var yi=B(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),bi=B(`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`}]]),xi=B(`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`}]]),Si=B(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),Ci=B(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),wi=B(`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`}]]),Ti=B(`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`}]]),Ei=B(`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`}]]),Di=B(`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`}]]),Oi=B(`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`}]]),ki=B(`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`}]]),Ai=B(`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`}]]),ji=B(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),Mi=B(`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`}]]),Ni=B(`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`}]]),Pi=B(`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`}]]),Fi=B(`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`}]]),Ii=B(`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`}]]),Li=B(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),Ri=B(`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`}]]),zi=B(`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`}]]),Bi=B(`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`}]]),Vi=B(`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`}]]),Hi=B(`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`}]]),Ui=B(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Wi=B(`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`}]]),Gi=B(`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`}]]),Ki=B(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),qi=B(`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`}]]),Ji=B(`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`}]]);function Yi(e){let t=q.useRef({value:e,previous:e});return q.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Xi=`Label`,Zi=q.forwardRef((e,t)=>(0,J.jsx)(Ct.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));Zi.displayName=Xi;var Qi=Zi,$i=`Switch`,[ea,ta]=Le($i),[na,ra]=ea($i);function ia(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]=Ne({prop:n,defaultProp:i??!1,onChange:c,caller:$i}),[m,h]=q.useState(null),[g,_]=q.useState(null),v={checked:f,setChecked:p,disabled:a,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:q.useRef(!1),required:l,defaultChecked:i,isFormControl:!m||!!o||!!m.closest(`form`),bubbleInput:g,setBubbleInput:_};return(0,J.jsx)(na,{scope:t,...v,children:fa(d)?d(v):r})}var aa=`SwitchTrigger`,oa=q.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:p,bubbleInput:m}=ra(aa,e),h=_(r,u),g=q.useRef(c);return q.useEffect(()=>{let e=a?i?.ownerDocument.getElementById(a):i?.form;if(e instanceof HTMLFormElement){let t=()=>d(g.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[i,a,d]),(0,J.jsx)(Ct.button,{type:`button`,role:`switch`,"aria-checked":c,"aria-required":l,"data-state":pa(c),"data-disabled":s?``:void 0,disabled:s,value:o,...n,ref:h,onClick:Dt(t,e=>{d(e=>!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});oa.displayName=aa;var sa=q.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,J.jsx)(ia,{__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,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(oa,{...d,ref:t,__scopeSwitch:n}),e&&(0,J.jsx)(da,{__scopeSwitch:n})]})})});sa.displayName=$i;var ca=`SwitchThumb`,la=q.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=ra(ca,n);return(0,J.jsx)(Ct.span,{"data-state":pa(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});la.displayName=ca;var ua=`SwitchBubbleInput`,da=q.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:p}=ra(ua,e),m=_(n,p),h=Yi(a),g=yn(r);q.useEffect(()=>{let e=f;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(h!==a&&n){let t=new Event(`click`,{bubbles:r});n.call(e,a),e.dispatchEvent(t)}},[f,h,a,i]);let v=q.useRef(a);return(0,J.jsx)(Ct.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??v.current,required:s,disabled:c,name:l,value:u,form:d,...t,tabIndex:-1,ref:m,style:{...t.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});da.displayName=ua;function fa(e){return typeof e==`function`}function pa(e){return e?`checked`:`unchecked`}var ma=m(`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 ha({className:e,variant:t=`default`,asChild:n=!1,...r}){return(0,J.jsx)(n?u:`span`,{"data-slot":`badge`,"data-variant":t,className:V(ma({variant:t}),e),...r})}function ga({open:e,onOpenChange:t}){let[n,r]=(0,q.useState)(null),[i,a]=(0,q.useState)(null),o=le(n),s=D(),c=ot(),l=ct(),u=new Set((s.data?.projects??[]).map(e=>e.root)),d=e=>{r(e),a(null),c.reset()},f=i?.path??o.data?.path??null,p=o.data?.parent??null;return(0,J.jsx)(fr,{open:e,onOpenChange:t,children:(0,J.jsxs)(or,{"data-slot":`add-project-dialog`,className:`sm:max-w-lg`,children:[(0,J.jsxs)(sr,{children:[(0,J.jsx)(lr,{children:`Open local folder`}),(0,J.jsx)(dr,{children:`Pick the folder cezar should run in. Git repos are marked; any folder works.`})]}),(0,J.jsx)(`p`,{"data-slot":`fs-breadcrumb`,className:`truncate font-mono text-[11.5px] text-soft-foreground`,title:o.data?.path??void 0,children:o.data?.path??(o.isError?``:`Loading…`)}),o.isError?(0,J.jsx)(`p`,{"data-slot":`fs-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:o.error instanceof Error?o.error.message:`could not list that folder`}):(0,J.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:[p===null?null:(0,J.jsx)(`li`,{className:`flex`,children:(0,J.jsxs)(`button`,{type:`button`,"data-slot":`fs-up`,onClick:()=>d(p),className:`flex flex-1 items-center gap-2 px-3 py-2 text-left text-[13px] hover:bg-muted`,children:[(0,J.jsx)(Ti,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),`Up one level`]})}),(o.data?.dirs??[]).map(e=>(0,J.jsxs)(`li`,{className:`flex items-stretch`,children:[(0,J.jsxs)(`button`,{type:`button`,"data-slot":`fs-dir`,"aria-pressed":i?.path===e.path,onClick:()=>a(e),onDoubleClick:()=>d(e.path),className:V(`flex min-w-0 flex-1 items-center gap-2 px-3 py-2 text-left text-[13px] hover:bg-muted`,i?.path===e.path&&`bg-muted`),children:[(0,J.jsx)(Kn,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`truncate`,children:e.name}),e.isRepo?(0,J.jsx)(ha,{variant:`outline`,className:`shrink-0 text-[10px]`,children:`git`}):null,u.has(e.path)?(0,J.jsx)(ha,{variant:`ghost`,className:`shrink-0 text-[10px] text-muted-foreground`,children:`already added`}):null]}),(0,J.jsx)(`button`,{type:`button`,"data-slot":`fs-enter`,"aria-label":`Open ${e.name}`,onClick:()=>d(e.path),className:`flex shrink-0 items-center px-2.5 text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,J.jsx)(gn,{className:`size-3.5`,"aria-hidden":`true`})})]},e.path)),o.data&&o.data.dirs.length===0?(0,J.jsx)(`li`,{className:`px-3 py-2 text-[13px] text-muted-foreground`,children:`No subfolders here — “Add project” registers this folder.`}):null]}),o.data?.truncated?(0,J.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,c.isError?(0,J.jsx)(`p`,{"data-slot":`add-project-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:c.error instanceof Error?c.error.message:`could not add that folder`}):null,(0,J.jsxs)(pr,{className:`min-w-0 sm:items-center sm:justify-between`,children:[(0,J.jsx)(`span`,{"data-slot":`add-project-target`,className:`min-w-0 truncate font-mono text-[11.5px] text-muted-foreground`,title:f??void 0,children:f??``}),(0,J.jsxs)(`span`,{className:`flex shrink-0 gap-2`,children:[(0,J.jsx)(M,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,J.jsx)(M,{"data-slot":`add-project-confirm`,disabled:f===null||c.isPending,onClick:()=>{f===null||c.isPending||c.mutate(f,{onSuccess:({project:e})=>{t(!1),l(`/p/${encodeURIComponent(e.id)}/`)}})},children:c.isPending?`Adding…`:`Add project`})]})]})]})})}function _a({className:e,type:t,...n}){return(0,J.jsx)(`input`,{type:t,"data-slot":`input`,className:V(`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 va({className:e,...t}){return(0,J.jsx)(Qi,{"data-slot":`label`,className:V(`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 ya({open:e,onOpenChange:t}){let[n,r]=(0,q.useState)(``),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(null),c=D(),l=w(),u=ct(),d=(0,q.useMemo)(()=>`co-${Math.random().toString(36).slice(2)}-${Date.now().toString(36)}`,[]),f=(0,q.useRef)(d);f.current=d,(0,q.useEffect)(()=>ci((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,q.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,J.jsx)(fr,{open:e,onOpenChange:e=>l.isPending?void 0:t(e),children:(0,J.jsxs)(or,{"data-slot":`clone-project-dialog`,className:`sm:max-w-lg`,children:[(0,J.jsxs)(sr,{children:[(0,J.jsx)(lr,{children:`Clone from GitHub`}),(0,J.jsxs)(dr,{children:[`cezar clones with `,(0,J.jsx)(`code`,{children:`gh`}),` into your checkout root and adds the result as a project.`]})]}),(0,J.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,J.jsx)(va,{htmlFor:`clone-url`,children:`Repository`}),(0,J.jsx)(_a,{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,J.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,J.jsx)(va,{htmlFor:`clone-name`,children:`Folder name`}),(0,J.jsx)(_a,{id:`clone-name`,"data-slot":`clone-name`,placeholder:p===``?`repo`:p,value:i,disabled:l.isPending,onChange:e=>a(e.target.value)}),(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,J.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,J.jsx)(M,{"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,J.jsx)(Gi,{className:`size-3.5`,"aria-hidden":`true`})}):(0,J.jsx)(M,{asChild:!0,variant:`ghost`,size:`icon-sm`,className:`size-7`,children:(0,J.jsx)(ve,{to:`/settings/global/projects`,"data-slot":`clone-root-settings`,"aria-label":`Edit checkout root`,title:`Edit checkout root`,children:(0,J.jsx)(Gi,{className:`size-3.5`,"aria-hidden":`true`})})})]})]}),l.isPending?(0,J.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,J.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,J.jsxs)(pr,{children:[(0,J.jsx)(M,{variant:`outline`,disabled:l.isPending,onClick:()=>t(!1),children:`Cancel`}),(0,J.jsx)(M,{"data-slot":`clone-confirm`,disabled:n.trim()===``||m===``||l.isPending,onClick:_,children:l.isPending?`Cloning…`:`Clone`})]})]})})}function ba(e){return(0,J.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,...e,children:(0,J.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 xa=[{to:`/`,label:`Tasks`,icon:Ii,match:[`/`,`/tasks`,`/compare`],badge:`tasks-unread`},{to:`/inbox`,label:`Inbox`,icon:Pi,match:[`/inbox`],badge:`inbox-count`,inbox:!0},{to:`/git`,label:`Git`,icon:Mi,match:[`/git`]},{to:`/github`,label:`GitHub`,icon:ba,match:[`/github`],forge:!0},{to:`/automations`,label:`Automations`,icon:an,match:[`/automations`],forge:!0},{to:`/skills`,label:`Skills`,icon:Jn,match:[`/skills`],badge:`skills-update`},{to:`/workflows`,label:`Workflows`,icon:Ji,match:[`/workflows`]},{to:`/settings`,label:`Settings`,icon:Gi,match:[`/settings`]}];function Sa({forge:e=!1,inbox:t=!1}={}){return xa.filter(n=>(!n.forge||e)&&(!n.inbox||t))}function Ca(e,t){return t===`/`?e===`/`:e===t||e.startsWith(t+`/`)}function wa(e){let t=null;for(let n of xa)for(let r of n.match)Ca(e,r)&&(t===null||r.length>t.length)&&(t={to:n.to,length:r.length});return t?.to??null}function Ta(e){let t=wa(e);return xa.find(e=>e.to===t)??null}var Ea=`cez-theme`,Da=`(prefers-color-scheme: light)`,Oa=`dark`;function ka(e){return e===`light`||e===`dark`||e===`system`?e:Oa}function Aa(e,t){return e===`light`||e===`system`&&t?`light`:`dark`}function ja(){try{return ka(localStorage.getItem(Ea))}catch{return Oa}}function Ma(e){try{localStorage.setItem(Ea,e)}catch{}}function Na(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(Da).matches}function Pa(e,t){e.classList.toggle(`light`,t===`light`),e.style.colorScheme=t}var Fa=q.createContext(null);function Ia({children:e}){let[t,n]=q.useState(ja),[r,i]=q.useState(Na);q.useEffect(()=>{let e=window.matchMedia?.(Da);if(!e)return;i(e.matches);let t=e=>i(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let a=Aa(t,r);q.useLayoutEffect(()=>{Pa(document.documentElement,a)},[a]);let o=q.useCallback(e=>{n(e),Ma(e)},[]),s=q.useMemo(()=>({theme:t,resolvedTheme:a,setTheme:o}),[t,a,o]);return(0,J.jsx)(Fa.Provider,{value:s,children:e})}function La(){let e=q.useContext(Fa);if(!e)throw Error(`cezar: useTheme() must be called inside <ThemeProvider>`);return e}var Ra={light:`dark`,dark:`system`,system:`light`},za={light:qi,dark:zi,system:Ri},Ba={light:`light`,dark:`dark`,system:`system`};function Va({className:e}){let{theme:t,setTheme:n}=La(),r=Ra[t],i=za[t];return(0,J.jsx)(M,{type:`button`,variant:`ghost`,size:`icon-sm`,className:e,"data-slot":`theme-toggle`,"data-theme-pref":t,title:`Theme: ${Ba[t]}`,"aria-label":`Theme: ${Ba[t]}. Switch to ${Ba[r]}.`,onClick:()=>n(r),children:(0,J.jsx)(i,{"aria-hidden":`true`})})}function Ha(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable?!0:e.closest(`[contenteditable=""], [contenteditable="true"]`)!==null}function Ua(e){return e instanceof HTMLElement&&e.closest(`[cmdk-input]`)!==null}function Wa(e,t){return!(typeof e.key!=`string`||e.key.toLowerCase()!==t.toLowerCase()||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||e.repeat||Ha(e.target)&&!Ua(e.target))}function Ga(e,t){let n=q.useRef(t);q.useLayoutEffect(()=>{n.current=t}),q.useEffect(()=>{let t=t=>{Wa(t,e)&&(t.preventDefault(),n.current(t))};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}function Ka(e,t){return!(typeof e.key!=`string`||e.key.toLowerCase()!==t.toLowerCase()||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.repeat||Ha(e.target))}function qa(e,t=typeof navigator>`u`?``:navigator.platform){let n=e.toUpperCase();return/mac|iphone|ipad|ipod/i.test(t)?`⌘${n}`:`Ctrl+${n}`}function Ja(e,t){let n=q.useRef(t);q.useLayoutEffect(()=>{n.current=t}),q.useEffect(()=>{let t=t=>{Ka(t,e)&&n.current(t)};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}var Ya=`cezar:open-command-palette`;function Xa(){window.dispatchEvent(new Event(Ya))}function Za(e){return[...e].sort((e,t)=>Date.parse(t.createdAt)-Date.parse(e.createdAt))}function Qa(){let[e,t]=q.useState(!1),n=hr();Ga(`k`,()=>t(e=>!e));let r=q.useCallback(()=>{t(!1),n(`/new`)},[n]);return Ga(`n`,r),Ja(`c`,r),q.useEffect(()=>{let e=()=>t(!0);return window.addEventListener(Ya,e),()=>window.removeEventListener(Ya,e)},[]),(0,J.jsx)(On,{open:e,onOpenChange:t,title:`Command palette`,description:`Search tasks, views, actions, and skills`,showCloseButton:!1,children:(0,J.jsx)($a,{close:()=>t(!1)})})}function $a({close:e}){let t=hr(),{theme:n,setTheme:r}=La(),i=Fe(),a=kt(),o=xe(),s=k(),c=Date.now(),l=q.useMemo(()=>Za(i.data??[]),[i.data]),u=o.data?.skillUsage,d=q.useMemo(()=>Ir(a.data??[],u),[a.data,u]),f=n=>{e(),t(n)},p=Ra[n];return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(An,{placeholder:`Search tasks, views, actions, skills…`}),(0,J.jsxs)(En,{children:[(0,J.jsx)(Wn,{children:`Nothing matches.`}),(0,J.jsxs)(W,{heading:`Views`,children:[Sa({forge:s.data?.forge?.available===!0,inbox:s.data?.capabilities.followups===!0}).map(e=>{let t=e.icon;return(0,J.jsxs)(U,{value:`view ${e.label}`,"data-slot":`palette-view`,"data-nav-to":e.to,onSelect:()=>f(e.to),children:[(0,J.jsx)(t,{"aria-hidden":`true`}),e.label]},e.to)}),(0,J.jsxs)(U,{value:`view new task`,"data-slot":`palette-view`,"data-nav-to":`/new`,onSelect:()=>f(`/new`),children:[(0,J.jsx)(Ui,{"aria-hidden":`true`}),`New task`,(0,J.jsx)(Gn,{children:`C`})]})]}),l.length>0?(0,J.jsx)(W,{heading:`Tasks`,children:l.map(e=>{let t=Sr(e);return(0,J.jsxs)(U,{value:`task ${S(e)} ${e.id}`,"data-slot":`palette-task`,"data-run-id":e.id,onSelect:()=>f(`/tasks/${e.id}`),children:[(0,J.jsx)(K,{tone:t.tone,pulse:t.pulse,"aria-label":t.label,role:`img`}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:S(e)}),(0,J.jsx)(`span`,{className:`shrink-0 text-xs text-soft-foreground tabular-nums`,children:Or(e.finishedAt??e.createdAt,c)})]},e.id)})}):null,(0,J.jsxs)(W,{heading:`Actions`,children:[(0,J.jsxs)(U,{value:`action toggle theme`,"data-slot":`palette-action`,"data-action":`toggle-theme`,onSelect:()=>{r(p),e()},children:[(0,J.jsx)(zi,{"aria-hidden":`true`}),`Toggle theme`,(0,J.jsxs)(Gn,{className:`tracking-normal`,children:[n,` → `,p]})]}),(0,J.jsxs)(U,{value:`action new task`,"data-slot":`palette-action`,"data-action":`new-task`,onSelect:()=>f(`/new`),children:[(0,J.jsx)(Ui,{"aria-hidden":`true`}),`New task`]})]}),d.length>0?(0,J.jsx)(W,{heading:`Skills`,children:d.map(e=>(0,J.jsxs)(U,{value:`skill ${e.name} ${e.path}`,keywords:e.description?[e.description]:void 0,"data-slot":`palette-skill`,"data-skill":e.name,onSelect:()=>f(`/new?skill=${encodeURIComponent(e.name)}`),children:[(0,J.jsx)(`span`,{className:`shrink-0 font-medium`,children:e.name}),e.description?(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null]},e.path))}):null]})]})}var eo=`/open-mercato.svg`,to=`(min-width: 768px)`,no=q.createContext(void 0);function ro(){return q.useContext(no)}function io({children:e,repo:t=null,inboxCount:n=null,unreadCount:r=null,skillsUpdateAvailable:i=!1,version:a=null,latestVersion:o=null,taskQuickList:s,toolsMenu:c,forgeAvailable:l=!0,inboxAvailable:u=!0,singleProject:d=!1,banner:f,projectGroups:p}){let{pathname:m}=N(),h=yr(m),g=wa(h),_=Ta(h),[v,y]=q.useState(!1),b=q.useRef(null);q.useLayoutEffect(()=>{let e=b.current;e&&(e.scrollTop=0)},[m]),q.useEffect(()=>{y(!1)},[m]),q.useEffect(()=>{let e=window.matchMedia?.(to);if(!e)return;e.matches&&y(!1);let t=e=>{e.matches&&y(!1)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let ee={activeTo:g,items:Sa({forge:l,inbox:u}),repo:t,inboxCount:u?n:null,unreadCount:r,skillsUpdateAvailable:i,version:a,latestVersion:o,taskQuickList:s,toolsMenu:c,projectGroups:p,singleProject:d};return(0,J.jsx)($t,{open:v,onOpenChange:y,children:(0,J.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,J.jsx)(ao,{...ee}),(0,J.jsx)(oo,{...ee,onNavigate:()=>y(!1)}),(0,J.jsxs)(`div`,{className:`grid min-w-0 flex-1 grid-rows-[auto_auto_1fr_auto] overflow-hidden`,children:[(0,J.jsx)(mo,{title:_?.label??`cezar`}),f?(0,J.jsx)(`div`,{"data-slot":`banner-slot`,className:`row-start-2`,children:f}):null,(0,J.jsx)(`main`,{ref:b,"data-slot":`main`,className:`row-start-3 min-h-0 overflow-y-auto overscroll-contain`,children:e}),(0,J.jsx)(`div`,{"data-slot":`composer`,className:`row-start-4 pb-[env(safe-area-inset-bottom)]`})]})]})})}function ao(e){return(0,J.jsx)(`aside`,{"data-slot":`sidebar`,className:`hidden w-[264px] shrink-0 flex-col border-r border-border bg-sidebar md:flex`,children:(0,J.jsx)(so,{...e})})}function oo({onNavigate:e,...t}){return(0,J.jsxs)(qt,{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,J.jsx)(Gt,{className:`sr-only`,children:`Navigation`}),(0,J.jsx)(so,{...t,onNavigate:e,headerAction:(0,J.jsx)(Wt,{asChild:!0,children:(0,J.jsx)(M,{variant:`ghost`,size:`icon`,"aria-label":`Close menu`,className:`-mr-2 size-11`,children:(0,J.jsx)(Xn,{className:`size-[17px]`,"aria-hidden":`true`})})})})]})}function so({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,J.jsxs)(`div`,{"data-slot":`sidebar-content`,className:`flex min-h-0 flex-1 flex-col pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-[9px] px-3.5 pt-3.5 pb-2.5`,children:[(0,J.jsx)(po,{}),(0,J.jsx)(`span`,{className:`text-[15px] font-semibold`,children:`cezar`}),n&&!u?(0,J.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,J.jsx)(`div`,{className:V(`shrink-0`,(!n||u)&&`ml-auto`),children:p}):null]}),(0,J.jsxs)(`div`,{className:`flex gap-1.5 px-2.5 pt-1 pb-2`,children:[(0,J.jsx)(M,{asChild:!0,variant:`contrast`,className:`relative min-w-0 flex-1 justify-center`,children:(0,J.jsxs)(G,{to:`/new`,onClick:f,children:[(0,J.jsx)(Ui,{className:`size-[15px]`,"aria-hidden":`true`}),`New task`,(0,J.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,J.jsx)(lo,{})]}),u?(0,J.jsx)(`div`,{"data-slot":`project-groups`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-1.5 pb-2`,children:(0,J.jsx)(no.Provider,{value:f,children:u})}):(0,J.jsxs)(J.Fragment,{children:[(0,J.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,J.jsxs)(G,{to:t.to,onClick:f,"aria-current":n?`page`:void 0,className:V(`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,J.jsx)(o,{className:`size-4 shrink-0`,"aria-hidden":`true`}),t.label,t.badge===`inbox-count`&&r?(0,J.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,J.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,J.jsxs)(`span`,{"data-slot":`nav-update-marker`,className:`ml-auto flex items-center`,children:[(0,J.jsx)(`span`,{className:`size-1.5 rounded-full bg-violet`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`sr-only`,children:`Skills update available`})]}):null]},t.to)})}),(0,J.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,J.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,J.jsx)(uo,{}),(0,J.jsxs)(`div`,{"data-slot":`sidebar-footer-controls`,className:`flex items-center gap-2`,children:[(0,J.jsx)(`div`,{"data-slot":`tools-menu`,className:`shrink-0`,children:l}),o?(0,J.jsx)(fo,{version:o,latestVersion:s}):null,(0,J.jsx)(co,{onNavigate:f,className:`ml-auto`}),(0,J.jsx)(Va,{})]})]})]})}function co({className:e,onNavigate:t}){return(0,J.jsx)(M,{asChild:!0,variant:`ghost`,size:`icon`,className:V(`size-7`,e),children:(0,J.jsx)(ve,{to:`/settings/global`,"data-slot":`global-settings-link`,"aria-label":`Global settings`,title:`Global settings`,onClick:t,children:(0,J.jsx)(Gi,{className:`size-4`,"aria-hidden":`true`})})})}function lo(){let[e,t]=q.useState(!1),[n,r]=q.useState(!1);return(0,J.jsxs)(Cn,{children:[(0,J.jsx)(_n,{asChild:!0,children:(0,J.jsx)(M,{variant:`outline`,size:`icon`,"aria-label":`Add project`,title:`Add project`,className:`size-11 shrink-0 md:size-9`,children:(0,J.jsx)(Oi,{className:`size-4`,"aria-hidden":`true`})})}),(0,J.jsxs)(bn,{align:`start`,className:`w-56`,children:[(0,J.jsx)(vn,{className:`text-xs text-soft-foreground`,children:`Add project`}),(0,J.jsxs)(xn,{"data-slot":`add-project-local`,onSelect:()=>t(!0),children:[(0,J.jsx)(Kn,{"aria-hidden":`true`}),`Open local folder…`]}),(0,J.jsxs)(xn,{"data-slot":`add-project-clone`,onSelect:()=>r(!0),children:[(0,J.jsx)(ba,{"aria-hidden":`true`}),`Clone from GitHub…`]})]}),e?(0,J.jsx)(ga,{open:!0,onOpenChange:t}):null,n?(0,J.jsx)(ya,{open:!0,onOpenChange:r}):null]})}function uo(){return(0,J.jsxs)(`button`,{type:`button`,"data-slot":`command-palette-hint`,title:`Search — command palette (⌘K / Ctrl+K)`,onClick:()=>Xa(),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,J.jsx)(Dn,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`truncate`,children:`Search…`}),(0,J.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:qa(`k`)})]})}function fo({version:e,latestVersion:t}){let n=!!(t&&t!==e);return(0,J.jsxs)(`span`,{"data-slot":`version-chip`,"data-update-available":n?`true`:void 0,title:n?`update available: v${t}`:void 0,className:`flex shrink-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,J.jsx)(K,{tone:`pending`,pulse:!0,className:`size-[5px]`}):null,`v`,e]})}function po(){return(0,J.jsx)(`img`,{src:eo,alt:``,"aria-hidden":`true`,"data-slot":`brand-tile`,className:`size-[26px] shrink-0 rounded-sm`})}function mo({title:e}){return(0,J.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,J.jsxs)(`div`,{className:`flex h-[52px] items-center gap-2.5 px-3`,children:[(0,J.jsx)(Zt,{asChild:!0,children:(0,J.jsx)(M,{variant:`ghost`,size:`icon`,"aria-label":`Open menu`,className:`-ml-1.5 size-11`,children:(0,J.jsx)(Li,{className:`size-[17px]`,"aria-hidden":`true`})})}),(0,J.jsx)(`span`,{className:`truncate text-[14.5px] font-semibold`,children:e}),(0,J.jsx)(`div`,{"data-slot":`mobile-status`,className:`ml-auto flex items-center gap-2`})]})})}var ho=q.createContext(null);function go({children:e}){let[t,n]=q.useState(`active`),r=q.useMemo(()=>[t,n],[t]);return(0,J.jsx)(ho.Provider,{value:r,children:e})}function _o(){let e=q.useContext(ho);if(!e)throw Error(`useListView must be used inside a <ListViewProvider>`);return e}var vo=[`claude`,`codex`,`opencode`],yo={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`};function bo(e){if(typeof e!=`object`||!e||Array.isArray(e))return{};let t=e,n={};for(let e of vo){let r=t[e];typeof r==`string`&&r.length>0&&r.length<=128&&(n[e]=r)}return n}function xo(e,t){if(!e)return[];let n=new Map(e.providers.map(e=>[e.provider,e]));return vo.flatMap(e=>{let r=n.get(e);return r?.status!==`disconnected`||!r.authFailureId||t[e]===r.authFailureId?[]:[{provider:e,label:yo[e],authFailureId:r.authFailureId}]})}function So(e,t){return{...e,...Object.fromEntries(t.map(({provider:e,authFailureId:t})=>[e,t]))}}function Co({status:e,pending:t,error:n,dismissals:r,onDismissAuthFailures:i}){if(t||!e)return null;let a;try{a=ae(e)}catch{return null}let o=xo(a,r);if(o.length>0)return(0,J.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,J.jsx)(K,{tone:`danger`}),(0,J.jsxs)(`span`,{children:[`Provider authentication failed during a task:`,` `,o.map(({label:e})=>e).join(`, `),`.`]}),(0,J.jsx)(G,{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,J.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,J.jsx)(Xn,{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,J.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,J.jsx)(K,{tone:c?`danger`:`pending`}),(0,J.jsx)(`span`,{children:s?`No agent provider is enabled.`:c?`No connected provider could be verified.`:`No agent provider credentials were found.`}),(0,J.jsx)(G,{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 wo(e){if(!(typeof e!=`object`||!e||Array.isArray(e)))return e}function To(){let e=i(),t=y(),n=P(),r=(0,q.useRef)(Promise.resolve()),a=(0,q.useRef)(0),o=(0,q.useRef)(0),s=(0,q.useRef)(wo(t.data));(0,q.useEffect)(()=>{o.current===0&&(s.current=wo(t.data))},[t.data]);let c=(0,q.useCallback)(e=>{let t=E.uiState,i=wo(n.getQueryData(t)),c=So(bo(i?.dismissedProviderAuthFailures),e),l={...i,dismissedProviderAuthFailures:c};o.current+=1,n.setQueryData(t,l);let u=++a.current;r.current=r.current.then(async()=>{try{let e=await x({dismissedProviderAuthFailures:c});s.current=wo(e),u===a.current&&n.setQueryData(t,e)}catch(e){u===a.current&&(s.current===void 0?n.removeQueries({queryKey:t,exact:!0}):n.setQueryData(t,s.current),n.invalidateQueries({queryKey:t}),I(e instanceof Error?e.message:String(e),{tone:`danger`}))}finally{--o.current}})},[n]);return(0,J.jsx)(Co,{status:e.data,pending:e.isPending,error:e.isError,dismissals:bo(wo(t.data)?.dismissedProviderAuthFailures),onDismissAuthFailures:c})}function Eo({runs:e,view:t,onViewChange:n,currentRunId:r=null,now:i=Date.now(),showTokens:a=!0,showCost:o=!0}){let s=Oe(e),c=ie(e,t);return(0,J.jsxs)(`div`,{"data-slot":`quick-list`,children:[(0,J.jsx)(`div`,{className:`sticky top-0 z-10 bg-sidebar pt-2 pb-1`,children:(0,J.jsxs)(`div`,{className:`inline-flex w-full gap-0.5 rounded-md bg-muted p-[3px]`,children:[(0,J.jsxs)(Oo,{view:`active`,current:t,onSelect:n,count:s.active,children:[`Active`,s.waiting>0&&t!==`active`?(0,J.jsx)(K,{tone:`pending`,pulse:!0,"data-slot":`waiting-dot`,"aria-label":`needs you`}):null]}),(0,J.jsx)(Oo,{view:`archived`,current:t,onSelect:n,count:s.archived,children:`Archived`})]})}),c.length===0?(0,J.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,J.jsx)(Do,{buckets:c,currentRunId:r,now:i,showTokens:a,showCost:o})]})}function Do({buckets:e,currentRunId:t=null,now:n=Date.now(),scope:r=null,showTokens:i=!0,showCost:a=!0}){let[o,s]=q.useState(()=>new Set),c=e=>s(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n});return(0,J.jsx)(J.Fragment,{children:e.map(e=>(0,J.jsxs)(`div`,{"data-slot":`quick-list-bucket`,"data-bucket":e.label,children:[(0,J.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,J.jsx)(ko,{row:e,currentRunId:t,now:n,scope:r,showTokens:i,showCost:a,expanded:e.kind===`group`&&o.has(e.groupId),onToggle:c},e.kind===`group`?e.groupId:e.run.id))]},e.label))})}function Oo({view:e,current:t,onSelect:n,count:r,children:i}){let a=e===t;return(0,J.jsxs)(`button`,{type:`button`,"data-slot":`view-tab`,"data-view":e,"aria-pressed":a,onClick:()=>n(e),className:V(`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,J.jsx)(`span`,{className:`font-mono text-[11px] tabular-nums`,children:r}):null]})}function ko({row:e,currentRunId:t,now:n,scope:r,expanded:i,onToggle:a,showTokens:o,showCost:s}){return e.kind===`run`?(0,J.jsx)(Ao,{run:e.run,queuePosition:e.queuePosition,currentRunId:t,now:n,scope:r,showTokens:o,showCost:s}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`flex items-center rounded-sm hover:bg-muted`,children:[(0,J.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,J.jsx)(cn,{className:V(`size-3 shrink-0 text-soft-foreground transition-transform`,!i&&`-rotate-90`),"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-medium`,children:e.title}),(0,J.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,J.jsx)(G,{to:mr(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,J.jsx)(Wi,{className:`size-3.5`,"aria-hidden":`true`})})]}),i?e.members.map(e=>(0,J.jsx)(Ao,{run:e,queuePosition:null,currentRunId:t,now:n,scope:r,variant:!0,showTokens:o,showCost:s},e.id)):null]})}function Ao({run:e,queuePosition:t,currentRunId:n,now:r,scope:i,variant:a=!1,showTokens:o,showCost:s}){let c=Sr(e),l=e.id===n,u=ue(e),d=Ut(e),f=Kt(e),p=a?``:t===null?Or(e.finishedAt??e.createdAt,r):`#${t}`;return(0,J.jsxs)(`div`,{"data-slot":`task-row`,"data-run-id":e.id,"data-active":l?`true`:void 0,className:V(`flex items-center rounded-sm hover:bg-muted`,l&&`bg-muted`,a&&`pl-4`),children:[(0,J.jsxs)(G,{to:mr(i,`/tasks/${e.id}`),title:S(e),"aria-current":l?`page`:void 0,className:`flex min-w-0 flex-1 items-center gap-2 px-2.5 py-[7px]`,children:[a?(0,J.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,J.jsx)(K,{tone:c.tone,pulse:c.pulse,"aria-label":c.label,role:`img`}),(0,J.jsx)(`span`,{className:V(`min-w-0 flex-1 truncate text-[13px]`,d?`font-semibold text-foreground`:f?`font-medium text-muted-foreground`:`font-medium`),children:a?jo(e,o,s):S(e)}),e.diffStat?(0,J.jsx)(zr,{stat:e.diffStat,className:`shrink-0 text-[10.5px]`}):null,u||!p?null:(0,J.jsx)(`span`,{className:`shrink-0 text-[11px] text-soft-foreground tabular-nums`,children:p}),d?(0,J.jsx)(K,{tone:`violet`,role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,className:`ml-0.5 shrink-0`}):null]}),u&&Nt(u)?(0,J.jsx)(Bt,{reference:{kind:`PR`,...ee(u)?{number:Number(ee(u))}:{},url:u},taskTitle:S(e),compact:!0,className:`mr-2.5 h-auto shrink-0 gap-[3px] px-1.5 py-px text-[10.5px]`}):null]})}function jo(e,t,n){let r=[e.runner??`claude`];t&&(e.inputTokens!==void 0||e.outputTokens!==void 0)&&r.push(Cr(e.inputTokens,e.outputTokens));let i=T(e.costUsd);return n&&i&&r.push(i),r.join(` · `)}function Mo(){let e=Fe(),t=wr(k().data),[n,r]=_o(),i=_r(`/tasks/:id/*`),a=_r(`/tasks/:id`),o=Qt(3e4);return e.data?(0,J.jsx)(Eo,{runs:e.data,view:n,onViewChange:r,currentRunId:i?.params.id??a?.params.id??null,now:o,showTokens:t.tokens,showCost:t.cost}):null}var No=10,Po=400;function Fo(e,t,n){let r=e?.[t];return r===void 0?t!==n:r}function Io(e){let t=P(),n=y().data?.sidebar?.collapsed,r=q.useRef(null),i=q.useRef(null),a=q.useCallback(()=>{i.current=null;let e=r.current;e&&(r.current=null,x({sidebar:e}).then(e=>t.setQueryData(E.uiState,e)).catch(e=>{I(e instanceof Error?e.message:String(e),{tone:`danger`}),t.invalidateQueries({queryKey:E.uiState})}))},[t]);return q.useEffect(()=>()=>{i.current!==null&&(clearTimeout(i.current),a())},[a]),{collapsed:n,toggle:q.useCallback(n=>{let o=t.getQueryData(E.uiState),s=o?.sidebar?.collapsed,c={...o?.sidebar,collapsed:{...s,[n]:!Fo(s,n,e)}};t.setQueryData(E.uiState,{...o,sidebar:c}),r.current=c,i.current!==null&&clearTimeout(i.current),i.current=setTimeout(a,Po)},[e,a,t])}}function Lo({projects:e,bootProjectId:t,inboxAvailable:n=!1,inboxCount:r=null,skillsUpdateAvailable:i=!1}){let{pathname:a}=N(),o=gr(a)??t,{collapsed:s,toggle:c}=Io(o),[l]=_o(),u=wa(yr(a)),d=_r(`/tasks/:id/*`),f=_r(`/tasks/:id`),p=d?.params.id??f?.params.id??null,m=Qt(3e4),h=wr(k().data);return(0,J.jsx)(`div`,{"data-slot":`project-group-list`,children:q.useMemo(()=>[...e].sort((e,t)=>t.lastOpenedAt.localeCompare(e.lastOpenedAt)),[e]).map(e=>(0,J.jsx)(Ro,{project:e,boot:e.id===t,active:e.id===o,collapsed:Fo(s,e.id,o),onToggle:c,view:l,activeTo:u,currentRunId:p,now:m,inboxAvailable:n,inboxCount:r,skillsUpdateAvailable:i,showTokens:h.tokens,showCost:h.cost},e.id))})}function Ro({project:e,boot:t,active:n,collapsed:r,onToggle:i,view:a,activeTo:o,currentRunId:s,now:c,inboxAvailable:l,inboxCount:u,skillsUpdateAvailable:d,showTokens:f,showCost:p}){let m=e.status===`missing`,h=je(e.id,!r&&!m,t),g=ro(),_=h.data?Oe(h.data).waiting:0,v=h.data?Te(ie(h.data,a),No):[];if(m)return(0,J.jsx)(`div`,{"data-slot":`project-group`,"data-project":e.id,"data-status":`missing`,className:`mb-1`,children:(0,J.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,J.jsx)(`span`,{className:`w-3 shrink-0`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`truncate`,children:e.name}),(0,J.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 y=`project-group-${e.id}`;return(0,J.jsxs)(`div`,{"data-slot":`project-group`,"data-project":e.id,"data-status":e.status,"data-collapsed":r?``:void 0,className:`mb-1`,children:[(0,J.jsxs)(`button`,{type:`button`,onClick:()=>i(e.id),"aria-expanded":!r,"aria-controls":y,"data-slot":`project-group-header`,className:V(`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,J.jsx)(cn,{className:V(`size-3 shrink-0 text-muted-foreground transition-transform`,r&&`-rotate-90`),"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`truncate`,children:e.name}),_?(0,J.jsx)(`span`,{"data-slot":`project-attention`,title:`${_} task${_===1?``:`s`} need${_===1?`s`:``} you`,className:`shrink-0 rounded-full bg-violet px-1.5 py-px text-[10.5px] font-semibold text-violet-foreground`,children:_}):null,e.branch?(0,J.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,J.jsxs)(`div`,{id:y,"data-slot":`project-group-body`,className:`mt-1 ml-[14px] border-l border-border pl-2`,children:[(0,J.jsx)(`nav`,{"aria-label":`${e.name} navigation`,children:Sa({forge:e.forge===`github`,inbox:l}).map(t=>{let r=n&&t.to===o,i=t.icon;return(0,J.jsxs)(G,{to:mr(e.id,t.to),onClick:g,"aria-current":r?`page`:void 0,className:V(`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,J.jsx)(i,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),t.label,t.badge===`inbox-count`&&n&&u?(0,J.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:u}):null,t.badge===`skills-update`&&n&&d?(0,J.jsxs)(`span`,{"data-slot":`nav-update-marker`,className:`ml-auto flex items-center`,children:[(0,J.jsx)(`span`,{className:`size-1.5 rounded-full bg-violet`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`sr-only`,children:`Skills update available`})]}):null]},t.to)})}),(0,J.jsx)(Do,{buckets:v,currentRunId:n?s:null,now:c,scope:e.id,showTokens:f,showCost:p}),(0,J.jsx)(G,{to:mr(e.id,`/`),onClick:g,"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…`})]})]})}function zo(e){let t=e.checks.filter(e=>!e.available).map(e=>e.name),n=`cezar v${e.version}`;return t.length?`${n} · needs attention: ${t.join(`, `)}`:n}function Bo(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 Vo({health:e}){if(!e)return null;let t=e.checks.every(e=>e.available);return(0,J.jsxs)(Cn,{children:[(0,J.jsx)(_n,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,"data-slot":`tools-menu-trigger`,title:zo(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,J.jsx)(K,{tone:t?`success`:`pending`}),`Tools`,(0,J.jsx)(cn,{className:`size-[11px]`,"aria-hidden":`true`})]})}),(0,J.jsxs)(bn,{side:`top`,align:`start`,"data-slot":`tools-menu-content`,className:`w-[240px]`,children:[(0,J.jsx)(vn,{className:`text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:`Installed tools`}),e.checks.map(e=>e.available?(0,J.jsx)(Ho,{check:e},e.name):(0,J.jsx)(Uo,{check:e},e.name)),Bo(e)?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Sn,{}),(0,J.jsx)(`p`,{"data-slot":`forge-note`,className:`px-2 py-1.5 text-[11px] leading-snug text-muted-foreground`,children:Bo(e)})]}):null,(0,J.jsx)(Sn,{}),(0,J.jsx)(xn,{asChild:!0,children:(0,J.jsxs)(G,{to:`/settings/agents`,"data-slot":`tools-settings`,className:`gap-2 text-[12.5px] text-muted-foreground`,children:[(0,J.jsx)(Gi,{className:`size-3.5`,"aria-hidden":`true`}),`Tool settings`]})})]})]})}function Ho({check:e}){return(0,J.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,J.jsx)(K,{tone:`success`}),(0,J.jsx)(`span`,{className:`font-mono text-[12.5px] font-medium`,children:e.name}),(0,J.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 Uo({check:e}){return(0,J.jsx)(xn,{asChild:!0,children:(0,J.jsxs)(G,{to:`/settings/agents`,"data-slot":`tool-row`,"data-tool":e.name,"data-available":`false`,className:`flex-col items-stretch gap-1`,children:[(0,J.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(K,{tone:`danger`}),(0,J.jsx)(`span`,{className:`font-mono text-[12.5px] font-medium`,children:e.name}),(0,J.jsx)(`span`,{"data-slot":`tool-version`,className:`ml-auto font-mono text-[11.5px] font-medium text-muted-foreground`,children:`not found`})]}),(0,J.jsxs)(`span`,{className:`flex items-end justify-between gap-3 pl-[15px]`,children:[e.hint?(0,J.jsx)(`span`,{"data-slot":`tool-hint`,className:`min-w-0 text-[11px] leading-snug text-muted-foreground`,children:e.hint}):null,(0,J.jsx)(`span`,{"data-slot":`tool-setup`,className:`ml-auto shrink-0 text-[11.5px] font-semibold text-violet`,children:`Set up →`})]})]})})}function Wo(e){return e?.trim()||null}function Go({projectName:e,pageLabel:t}){let n=Wo(e),r=Wo(t);return n&&r?`${n} — ${r} · cezar`:n?`${n} · cezar`:r?`${r} · cezar`:`cezar`}function Ko(e){let t=Go(e);(0,q.useEffect)(()=>{document.title=t},[t])}var qo=new Set([`projectId`,`pathname`,`search`,`hash`]);function Jo(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t=e;if(Object.keys(t).some(e=>!qo.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(gr(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 Yo(e,t){let n=t.projects.find(t=>t.id===e);return n!==void 0&&n.status!==`missing`}function Xo(e,t){if(t===void 0)return null;let n;try{n=gr(e.pathname)}catch{return null}return n===null||!Yo(n,t)?null:Jo({projectId:n,pathname:e.pathname,...e.search===``?{}:{search:e.search},...e.hash===``?{}:{hash:e.hash}})}function Zo(e,t,n){let r=Jo(e);return r===null||!(t===void 0?n!==void 0&&r.projectId===n:Yo(r.projectId,t))?null:`${r.pathname}${r.search??``}${r.hash??``}`}function Qo(e,t){return e!==void 0&&e.projectId===t.projectId&&e.pathname===t.pathname&&(e.search??``)===(t.search??``)&&(e.hash??``)===(t.hash??``)}function $o(){return(0,J.jsx)(`div`,{"data-route":`compare`,className:`flex min-h-full flex-col`,children:(0,J.jsx)(z,{icon:(0,J.jsx)(me,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading variants…`,subtitle:`Fetching every variant's status, spend and diff summary.`})})}function es(){return(0,J.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,J.jsx)(z,{icon:(0,J.jsx)(me,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading GitHub…`,subtitle:`Fetching open issues and pull requests.`})})}function ts(e){let t=i(),n=he(),r=qe(),a=ke(t.data),o=n.data?.defaultRunner,s=nn(e.runner,a,o??a[0]??`claude`);return{runner:s,runnerExplicit:e.runner!==null,model:pn(e.model,s,n.data?.defaultModels,r.data),runners:a,defaultRunner:o,canRun:t.isSuccess&&a.length>0,providerPending:t.isPending,providerError:t.isError}}function ns(e){return{runner:hn(e.runner,e.defaultRunner,e.runnerExplicit),model:e.model||void 0}}function rs({pick:e,onChange:t,disabled:n=!1}){let{runner:r,model:i,runners:a,canRun:o}=ts(e),s=he(),c=qe(),l=tn(r,c.data,[e.model,s.data?.defaultModels?.[r]]),u=n||!o;return(0,J.jsxs)(J.Fragment,{children:[a.length>1?(0,J.jsx)(zn,{runners:a,value:r,disabled:u,onPick:e=>t({runner:e,model:null})}):null,(0,J.jsx)(jn,{slot:`model-pill`,ariaLabel:`Model`,label:l.find(e=>e.id===i).label,value:i,disabled:u,onPick:n=>t({...e,model:n}),options:l.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:on(r,c.data,c.isError)})]})}function is({templates:e,onInsert:t,triggerClassName:n,disabled:r,iconOnly:i=!1}){let[a,o]=(0,q.useState)(!1),s=(0,q.useRef)(null),c=hr();return e.length===0?null:(0,J.jsxs)(Vn,{open:a,onOpenChange:o,children:[(0,J.jsx)(Un,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-trigger`,"aria-label":`Insert a prompt template`,title:`Insert a prompt template`,disabled:r,className:V(`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,J.jsx)(Bi,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),i?null:(0,J.jsxs)(J.Fragment,{children:[`templates`,(0,J.jsx)(cn,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})]})}),(0,J.jsx)(Fn,{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,J.jsxs)(Mn,{filter:Ar,children:[(0,J.jsx)(An,{placeholder:`search templates…`,onInput:()=>s.current?.scrollTo(0,0)}),(0,J.jsxs)(En,{ref:s,"data-slot":`prompt-template-list-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,J.jsx)(Wn,{children:`Nothing matches.`}),(0,J.jsx)(W,{heading:`Insert a template`,children:e.map(e=>(0,J.jsxs)(U,{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,J.jsxs)(`span`,{className:`flex w-full items-center gap-1.5`,children:[(0,J.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,J.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,J.jsx)(Jn,{"aria-hidden":`true`,className:`size-2.5`}),e.skills.length]}):null]}),(0,J.jsx)(`span`,{className:`line-clamp-1 text-[11px] text-soft-foreground`,children:e.text})]},e.id))}),(0,J.jsx)(wn,{}),(0,J.jsx)(W,{children:(0,J.jsx)(U,{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 as=Sr({status:`waiting`});function os(e){return e.filter(e=>!e.startedTaskId)}function ss(e){return e.runnable??!!(e.suggestedSkill||e.suggestedPrompt)}function cs(){let e=k(),t=e.data?.capabilities.followups===!0,n=e.data!==void 0&&!t,r=Et(!n),i=Fe(),a=r.data===void 0?void 0:os(r.data);return(0,J.jsxs)(`div`,{"data-route":`inbox`,className:`flex min-h-full flex-col`,children:[(0,J.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,J.jsx)(`h1`,{className:`text-base font-semibold`,children:`Inbox`}),(0,J.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,J.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,J.jsx)(z,{icon:(0,J.jsx)(Pi,{}),tone:`neutral`,title:`The follow-up inbox is off`,subtitle:`Agents are not asked to leave follow-ups. Set CEZ_FOLLOWUPS=1 and restart cezar to turn the inbox on.`,heading:`h2`}):a===void 0?r.isError?(0,J.jsx)(z,{icon:(0,J.jsx)(Yn,{}),tone:`danger`,title:`Could not load the inbox`,subtitle:r.error.message,heading:`h2`}):null:a.length===0?e.isPending?null:(0,J.jsx)(z,{icon:(0,J.jsx)(Pi,{}),tone:`neutral`,title:`Inbox empty`,subtitle:`Agents drop follow-up suggestions here when they finish a task.`,heading:`h2`}):(0,J.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,J.jsx)(ls,{todo:e,sourceTaskExists:e.taskId===void 0?null:i.data?.some(t=>t.id===e.taskId)??!1},e.id))})})]})}function ls({todo:e,sourceTaskExists:t}){let n=hr(),r=P(),i=xe(),[a,s]=(0,q.useState)({runner:null,model:null}),l=ts(a),[u,d]=(0,q.useState)(!1),[f,p]=(0,q.useState)(``),m=(0,q.useRef)(null),h=kn(i.data?.promptTemplates),g=e=>{let t=m.current?.selectionStart??f.length,n=Bn(f,t,e);p(n.text),requestAnimationFrame(()=>{m.current?.focus(),m.current?.setSelectionRange(n.caret,n.caret)})},_=L({mutationFn:async()=>l.canRun?De(e.id,{...ns(l),prompt:f.trim()||void 0}):null,onSuccess:e=>{if(e===null)return;let{run:t}=e;r.invalidateQueries({queryKey:o.todos}),r.invalidateQueries({queryKey:o.runs.all}),n(`/tasks/${t.id}`)},onError:e=>I(e.message,{tone:`danger`})}),v=L({mutationFn:()=>c(e.id),onSuccess:()=>{r.setQueryData(o.todos,t=>t?.filter(t=>t.id!==e.id)),r.invalidateQueries({queryKey:o.todos})},onError:e=>I(e.message,{tone:`danger`})}),y=_.isPending||v.isPending,b=ss(e);return(0,J.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,J.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,J.jsx)(K,{tone:as.tone,pulse:as.pulse,title:as.label,className:`mt-[5px]`}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`p`,{"data-slot":`todo-summary`,className:`text-sm leading-snug font-medium text-foreground`,children:e.summary}),(0,J.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,J.jsxs)(`span`,{children:[Or(e.ts),` ago`]}):null,e.action?(0,J.jsx)(`span`,{children:e.action}):null,e.taskId===void 0?null:t?(0,J.jsx)(G,{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,J.jsx)(`span`,{"data-slot":`todo-source-gone`,children:`source task deleted`}),Nt(e.prUrl)?(0,J.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,J.jsxs)(`span`,{"data-slot":`todo-skill`,className:`font-mono`,children:[`skill: `,e.suggestedSkill]}):null]})]}),(0,J.jsx)(`div`,{className:`flex shrink-0 items-center gap-1.5 self-center`,children:b?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(M,{type:`button`,variant:`contrast`,size:`sm`,"data-action":`todo-run`,title:`Start a task from this follow-up`,disabled:y||!l.canRun,onClick:()=>_.mutate(),children:[(0,J.jsx)(dn,{"aria-hidden":`true`,className:`size-3`}),`Run`]}),(0,J.jsx)(M,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`todo-dismiss`,title:`Check off (remove)`,disabled:y,onClick:()=>v.mutate(),children:`Dismiss`})]}):(0,J.jsxs)(M,{type:`button`,variant:`contrast`,size:`sm`,"data-action":`todo-acknowledge`,title:`Acknowledge and remove this note`,disabled:y,onClick:()=>v.mutate(),children:[(0,J.jsx)(tt,{"aria-hidden":`true`,className:`size-3`}),`Acknowledge`]})})]}),b?(0,J.jsxs)(`div`,{"data-slot":`todo-engine`,className:`flex flex-wrap items-center gap-2 pl-5`,children:[(0,J.jsx)(rs,{pick:a,onChange:s,disabled:y||!l.canRun}),!l.providerPending&&!l.canRun?(0,J.jsxs)(`span`,{"data-slot":`todo-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[l.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this follow-up.`,(0,J.jsx)(G,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}):null,b?u?(0,J.jsxs)(`div`,{"data-slot":`todo-instructions`,className:`flex flex-col gap-2 pl-5`,children:[(0,J.jsx)(Zn,{ref:m,"data-slot":`todo-instructions-input`,"aria-label":`Extra instructions for this follow-up`,value:f,onChange:e=>p(e.target.value),placeholder:`Add instructions for the agent… (appended to the suggestion above)`,maxLength:2e4,className:`min-h-16 text-[13px]`}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(is,{templates:h,onInsert:g}),(0,J.jsx)(`button`,{type:`button`,"data-slot":`todo-instructions-hide`,onClick:()=>d(!1),className:`text-xs font-medium text-muted-foreground underline decoration-border underline-offset-2 hover:text-foreground`,children:`Hide`})]})]}):(0,J.jsx)(`button`,{type:`button`,"data-slot":`todo-instructions-toggle`,onClick:()=>d(!0),className:`self-start pl-5 text-xs font-medium text-muted-foreground underline decoration-border underline-offset-2 hover:text-foreground`,children:f.trim()?`Edit instructions (added)`:`+ Add instructions`}):null]})}var us=38,ds=280,fs=900,ps=600,ms=5500,hs=1400,Y=e=>({text:e,tone:`key`}),gs=e=>({text:e,tone:`str`}),X=e=>({text:e,tone:`fn`}),_s=e=>({text:e,tone:`com`}),vs=e=>({text:e,tone:`num`}),Z=e=>({text:e}),ys=[[[_s(`// task accepted — isolating a worktree`)],[Y(`const`),Z(` tree = `),Y(`await`),Z(` git.`),X(`worktree`),Z(`(task.branch)`)],[Y(`const`),Z(` agent = `),X(`spawn`),Z(`(runner, { tree, skills })`)],[Y(`for await`),Z(` (`),Y(`const`),Z(` event `),Y(`of`),Z(` agent.`),X(`stream`),Z(`()) {`)],[Z(` cockpit.`),X(`render`),Z(`(event)`)],[Z(`}`)]],[[Z(`$ cezar run `),gs(`--worktree --autonomous`)],[gs(`✓`),Z(` worktree ready · base `),gs(`main`)],[gs(`✓`),Z(` agent started`)],[_s(`… editing src/routes/new-task.tsx`)],[gs(`✓`),Z(` tests green · `),vs(`+42 −7`)],[gs(`✓`),Z(` pull request opened`)]],[[_s(`# flaky: replay before touching code`)],[Y(`def`),Z(` `),X(`stabilize`),Z(`(test):`)],[Z(` `),Y(`for`),Z(` attempt `),Y(`in`),Z(` `),X(`range`),Z(`(`),vs(`3`),Z(`):`)],[Z(` `),Y(`if`),Z(` `),X(`run`),Z(`(test).ok:`)],[Z(` `),Y(`return`),Z(` `),gs(`'green'`)],[Z(` `),Y(`return`),Z(` `),X(`quarantine`),Z(`(test)`)]],[[_s(`// apply the reviewed plan, step by step`)],[Y(`let`),Z(` diff = worktree.`),X(`diff`),Z(`()?;`)],[Y(`match`),Z(` `),X(`review`),Z(`(diff) {`)],[Z(` Ok(pr) => gh::`),X(`open`),Z(`(pr),`)],[Z(` Err(e) => `),X(`retry`),Z(`(e, backoff),`)],[Z(`}`)]],[[_s(`// merge when every check is green`)],[Y(`func`),Z(` `),X(`merge`),Z(`(pr *PullRequest) `),Y(`error`),Z(` {`)],[Z(` `),Y(`if`),Z(` err := ci.`),X(`Wait`),Z(`(pr); err != `),Y(`nil`),Z(` {`)],[Z(` `),Y(`return`),Z(` err`)],[Z(` }`)],[Z(` `),Y(`return`),Z(` gh.`),X(`Merge`),Z(`(pr)`)],[Z(`}`)]],[[_s(`-- which branches ship the most?`)],[Y(`select`),Z(` branch, `),X(`count`),Z(`(*) `),Y(`as`),Z(` runs`)],[Y(`from`),Z(` tasks`)],[Y(`where`),Z(` status = `),gs(`'green'`)],[Y(`group by`),Z(` branch`)],[Y(`order by`),Z(` runs `),Y(`desc`),Z(`;`)]],[[_s(`/* the composer glow, one token deep */`)],[Z(`.composer`),Y(`:focus-within`),Z(` {`)],[Z(` border-color: `),X(`var`),Z(`(--primary);`)],[Z(` box-shadow: `),vs(`0 0 0 3px`),Z(` `),X(`var`),Z(`(--ring);`)],[Z(` transition: box-shadow `),vs(`120ms`),Z(` ease;`)],[Z(`}`)]]],bs=[[`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%]`]],xs={key:`var(--syn-key)`,str:`var(--syn-str)`,fn:`var(--syn-fn)`,com:`var(--syn-com)`,num:`var(--syn-num)`},Ss=e=>e.reduce((e,t)=>e+t.text.length,0),Cs=e=>e.reduce((e,t)=>e+Ss(t)*us+ds,0);function ws(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 Ts(){let e=ws(ys).slice(0,bs.length),t=ws(bs.map(e=>e[Math.floor(Math.random()*e.length)]??``)),n=ps;return{blocks:e.map((e,r)=>{let i=n;return n+=Cs(e)+fs,{lines:e,slot:t[r]??``,startMs:i}}),cycleMs:n-fs+ms+hs}}function Es({block:e,cycleMs:t}){let n=e.startMs;return(0,J.jsx)(`div`,{className:V(`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=Ss(e),i=n;return n+=r*us+ds,(0,J.jsx)(`div`,{className:`ghost-code-line`,style:{"--n":r,"--t":`${r*us}ms`,"--d":`${i}ms`},children:e.map((e,t)=>(0,J.jsx)(`span`,{style:e.tone?{color:xs[e.tone]}:void 0,children:e.text},t))},t)})})}var Ds=`(prefers-reduced-motion: reduce)`;function Os(){let[e,t]=(0,q.useState)(()=>typeof window.matchMedia==`function`&&!window.matchMedia(Ds).matches);return(0,q.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(Ds),n=e=>t(!e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function ks(){let[e,t]=(0,q.useState)(0),n=Os(),r=(0,q.useMemo)(()=>Ts(),[e]);return(0,q.useEffect)(()=>{if(!n)return;let e=window.setTimeout(()=>t(e=>e+1),r.cycleMs);return()=>window.clearTimeout(e)},[e,n,r.cycleMs]),(0,J.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,J.jsx)(`div`,{className:`contents`,children:r.blocks.map((e,t)=>(0,J.jsx)(Es,{block:e,cycleMs:r.cycleMs},t))},e)})}function As({source:e,className:t}){return(0,J.jsx)(`span`,{"data-slot":`skill-source`,"data-source":e,className:V(`shrink-0 rounded-full border border-border px-2 py-px font-mono text-[10.5px]`,Nr({source:e})?`font-semibold text-foreground`:`text-soft-foreground`,t),children:e})}function js({skill:e,usedBy:t,heading:n=`h2`}){return(0,J.jsxs)(`div`,{"data-slot":`skill-detail`,className:`min-w-0`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2.5`,children:[(0,J.jsx)(n,{className:`min-w-0 font-mono text-lg font-semibold break-all`,children:e.name}),(0,J.jsx)(As,{source:e.source})]}),(0,J.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,J.jsx)(`p`,{"data-slot":`skill-description`,className:`mt-2.5 text-[13px] text-muted-foreground`,children:e.description}):null,t===void 0?null:(0,J.jsxs)(`section`,{"data-slot":`skill-used-by`,className:`mt-5`,children:[(0,J.jsx)(`h3`,{className:`text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:`Used by`}),t.length>0?(0,J.jsx)(`ul`,{className:`mt-1.5 flex flex-col gap-1`,children:t.map(e=>(0,J.jsxs)(`li`,{className:`flex items-center gap-1.5 font-mono text-xs text-muted-foreground`,children:[(0,J.jsx)(yi,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),e]},e))}):(0,J.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,J.jsxs)(`section`,{className:`mt-5`,children:[(0,J.jsx)(`h3`,{className:`text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:`Content`}),(0,J.jsx)(`div`,{"data-slot":`skill-body`,className:`mt-2 text-sm`,children:(0,J.jsx)(kr,{children:e.body})})]})]})}function Ms({skill:e,onClose:t}){return(0,J.jsx)(fr,{open:e!==null,onOpenChange:e=>e?void 0:t(),children:(0,J.jsx)(or,{"data-slot":`skill-preview`,className:`block max-h-[80dvh] overflow-y-auto sm:max-w-2xl`,children:e?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(lr,{className:`sr-only`,children:e.name}),(0,J.jsx)(dr,{className:`sr-only`,children:`Read-only skill preview`}),(0,J.jsx)(js,{skill:e,heading:`h3`}),(0,J.jsx)(`p`,{className:`mt-5`,children:(0,J.jsx)(G,{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 Ns(e,t,n){let r=e.skill===``?{source:`workflow`,ref:`quick-task`}:{source:`skill`,ref:e.skill};return fn({task:e.ref,source:r,model:``,runner:t,defaultRunner:n,variants:1,images:[],todoId:e.todo})}function Ps(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 Fs(e,t){return`Use the "${e}" skill on: ${t}`}function Is(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}}var Ls={text:``,source:null,runner:null,model:null,variants:1,planFirst:!1,worktree:null,autonomous:null,generateFollowups:null},Rs=`cez-new-task-draft`;function zs(e){return e===null?Rs:`${Rs}:${e}`}function Bs(e){let t=e&&typeof e==`object`?e:{};return{text:typeof t.text==`string`?t.text:``,source:Vs(t.source)?t.source:null,runner:typeof t.runner==`string`?t.runner: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 Vs(e){return!!e&&typeof e==`object`&&(e.source===`skill`||e.source===`workflow`)&&typeof e.ref==`string`}var Hs=new Map;function Us(e=null){let t=zs(e),n=Hs.get(t);if(n)return{...n};let r;try{let e=localStorage.getItem(t);r=e?Bs(JSON.parse(e)):{...Ls}}catch{r={...Ls}}return Hs.set(t,r),{...r}}function Ws(e,t=null){let n=zs(t);Hs.set(n,{...e});try{localStorage.setItem(n,JSON.stringify(e))}catch{}}function Gs(e=null){Ws({...Us(e),text:``},e)}function Ks(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 qs(e,t,n){return{task:e,steps:[...n.steps],rationale:n.rationale,fallback:n.fallback,images:[...t]}}function Js(e,t){return!Number.isInteger(t)||t<0||t>=e.length?[...e]:e.filter((e,n)=>n!==t)}function Ys(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 Xs(e){return e.command??e.prompt??``}function Zs(e,t=120){let n=e.split(`
3
+ `)[0]??``;return n.length>t?`${n.slice(0,t-1)}…`:n}function Qs(e){let{task:t,steps:n,model:r,runner:i,runnerExplicit:a,defaultRunner:o,variants:s,images:c,generateFollowups:l,todoId:u}=e;return{task:t,steps:[...n],model:r||void 0,runner:hn(i,o,a),variants:s>1?s:void 0,images:c.length>0?[...c]:void 0,generateFollowups:l!==!1&&void 0,todoId:u||void 0}}function $s({plan:e,starting:t,startAvailable:n,startUnavailableReason:r,startUnavailableAction:i,onStepsChange:a,onStart:o,onDiscard:s}){let[c,l]=(0,q.useState)(null),[u,d]=(0,q.useState)(null),f=()=>{l(null),d(null)},p=(t,n)=>{t.preventDefault(),c!==null&&c!==n&&a(Ys(e.steps,c,n)),f()},m=e.steps.length===0;return(0,J.jsx)(fr,{open:!0,onOpenChange:e=>e?void 0:s(),children:(0,J.jsxs)(or,{"data-slot":`plan-review`,showCloseButton:!1,className:V(`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,J.jsxs)(sr,{className:`gap-1 border-b border-border px-5 pt-4 pb-3.5 text-left sm:text-left`,children:[(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,J.jsx)(lr,{className:`text-[11px] font-semibold tracking-[0.08em] text-muted-foreground uppercase`,children:`Proposed chain`}),(0,J.jsx)(cr,{"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,J.jsx)(Xn,{"aria-hidden":`true`,className:`size-4`})})]}),(0,J.jsx)(dr,{"data-slot":`plan-task`,title:e.task,className:`truncate text-[13.5px] font-medium text-foreground`,children:Zs(e.task)}),e.fallback?(0,J.jsx)(`p`,{"data-slot":`plan-fallback`,className:`text-xs text-soft-foreground italic`,children:`planner unavailable — single-step plan`}):e.rationale===``?null:(0,J.jsx)(`p`,{"data-slot":`plan-rationale`,className:`text-xs text-muted-foreground`,children:e.rationale})]}),(0,J.jsx)(`ol`,{"data-slot":`plan-steps`,className:`flex-1 space-y-2 overflow-y-auto px-5 py-4`,children:m?(0,J.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,J.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:V(`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,J.jsx)(Ni,{"aria-hidden":`true`,className:`size-3.5 shrink-0 cursor-grab text-soft-foreground`}),(0,J.jsx)(`span`,{className:`w-5 shrink-0 font-mono text-[11px] text-soft-foreground tabular-nums`,children:String(n+1).padStart(2,`0`)}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsx)(`span`,{className:`truncate text-[13px] font-semibold`,children:t.name??t.id}),t.skill?(0,J.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,J.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,J.jsx)(`p`,{className:`truncate font-mono text-[11.5px] text-muted-foreground`,children:Xs(t)})]}),(0,J.jsxs)(`span`,{className:`flex shrink-0 items-center`,children:[(0,J.jsx)(M,{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(Ys(e.steps,n,n-1)),children:(0,J.jsx)(Jt,{"aria-hidden":`true`,className:`size-3.5`})}),(0,J.jsx)(M,{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(Ys(e.steps,n,n+1)),children:(0,J.jsx)(Ht,{"aria-hidden":`true`,className:`size-3.5`})}),(0,J.jsx)(M,{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(Js(e.steps,n)),children:(0,J.jsx)(Xn,{"aria-hidden":`true`,className:`size-3.5`})})]})]},t.id))}),!n&&r?(0,J.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,J.jsx)(`span`,{children:r}),i]}):null,(0,J.jsxs)(`div`,{className:`flex items-center gap-2 px-5 py-3.5 pb-[max(14px,env(safe-area-inset-bottom))]`,children:[(0,J.jsxs)(M,{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,J.jsx)(dn,{"aria-hidden":`true`,className:`size-3.5`}),t?`Starting…`:`Start`]}),(0,J.jsx)(ec,{steps:e.steps,disabled:m}),(0,J.jsx)(M,{type:`button`,variant:`ghost`,className:`ml-auto`,onClick:s,children:`Discard`})]})]})})}function ec({steps:e,disabled:t}){let n=P(),[r,i]=(0,q.useState)(!1),[a,s]=(0,q.useState)(``),[c,l]=(0,q.useState)(!1),[u,d]=(0,q.useState)(!1),f=async t=>{let r=a.trim();if(!(r===``||u)){d(!0);try{let a=await yt({name:r,steps:e,...t?{overwrite:!0}:{}});I(`Saved — ${a.path.split(`/`).pop()??a.path}`),n.invalidateQueries({queryKey:o.workflows}),l(!1),i(!1),s(``)}catch(e){e instanceof A&&e.exists===!0?l(!0):I(e instanceof Error?e.message:String(e),{tone:`danger`})}finally{d(!1)}}};return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(M,{type:`button`,variant:`outline`,"data-slot":`plan-save`,disabled:t,onClick:()=>i(!0),children:`Save as chain`}),(0,J.jsx)(fr,{open:r,onOpenChange:e=>i(!!e),children:(0,J.jsxs)(or,{"data-slot":`plan-save-dialog`,className:`sm:max-w-sm`,showCloseButton:!1,children:[(0,J.jsxs)(sr,{children:[(0,J.jsx)(lr,{children:`Save as chain`}),(0,J.jsx)(dr,{children:`Saves these steps as a reusable workflow — it joins the picker like any other chain.`})]}),(0,J.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),f(!1)},children:[(0,J.jsx)(_a,{value:a,onChange:e=>s(e.target.value),"aria-label":`Chain name`,placeholder:`e.g. fix-and-verify-v2`,maxLength:80,autoFocus:!0}),(0,J.jsxs)(pr,{className:`mt-4`,children:[(0,J.jsx)(M,{type:`button`,variant:`outline`,onClick:()=>i(!1),children:`Cancel`}),(0,J.jsx)(M,{type:`submit`,disabled:a.trim()===``||u,children:u?`Saving…`:`Save`})]})]})]})}),(0,J.jsx)(ar,{open:c,onOpenChange:e=>e?void 0:l(!1),children:(0,J.jsxs)(er,{"data-slot":`plan-overwrite-dialog`,children:[(0,J.jsxs)(ir,{children:[(0,J.jsxs)($n,{children:[`Overwrite “`,a.trim(),`”?`]}),(0,J.jsx)(Qn,{children:`A chain with this name already exists. Overwriting replaces its steps with this plan.`})]}),(0,J.jsxs)(nr,{children:[(0,J.jsx)(rr,{children:`Keep the existing chain`}),(0,J.jsx)(tr,{onClick:()=>void f(!0),children:`Overwrite`})]})]})})]})}function tc(){let[e]=Ve(),t=hr(),n=P(),{projectId:r}=ht(),a=Ae().projectId,s=D(),[c]=(0,q.useState)(()=>Ks(e)),l=k(),u=St(),d=kt(),f=Ie(),p=xe(),m=he(),h=Ce(),[g,_]=(0,q.useState)(()=>({...Us(a),...c.ref===``?{}:{text:c.ref},...c.skill===``?{}:{source:{source:`skill`,ref:c.skill}}}));(0,q.useEffect)(()=>{Ws(g,a)},[g,a]);let v=e=>_(t=>({...t,...e})),y=p.data?.recentSources,b=d.data,ee=p.data?.skillUsage,te=(0,q.useMemo)(()=>Ir(b??[],ee),[b,ee]),ne=u.data?.workflows??[],re=s.data?.projects??[],ie=d.data!==void 0&&u.data!==void 0&&!p.isPending,x=sn([g.source,p.data?.lastTask],te,ne),ae=x.source===`skill`?te.find(e=>e.name===x.ref):void 0,oe=(0,q.useRef)(null),se=(0,q.useMemo)(()=>kn(p.data?.promptTemplates),[p.data?.promptTemplates]),ce=Ln(se,x.source===`skill`?[x.ref]:[]),S=(0,q.useRef)(g.text);S.current=g.text;let le=(0,q.useRef)(``);(0,q.useEffect)(()=>{if(!ie)return;let e=Rn(S.current,le.current,ce);le.current=e.applied,e.text!==S.current&&v({text:e.text})},[ce,ie]);let C=i(),ue=ke(C.data),de=m.data?.defaultRunner,fe=de??`claude`,w=ue.length>0?nn(g.runner,ue,fe):null,pe=w??fe,T=C.isSuccess&&ue.length>0,me=qe(),E=w===null?[]:tn(w,me.data,[g.model,m.data?.defaultModels?.[w]]),_e=w===null?``:pn(g.model,w,m.data?.defaultModels,me.data),ve=(0,q.useRef)(!1);(0,q.useEffect)(()=>{let e=T&&!ve.current;ve.current=T,e&&document.activeElement===document.body&&document.querySelector(`textarea[aria-label="Describe a task for the agent"]`)?.focus()},[T]);let ye=l.data===void 0||l.data.repo!==null,be=ye?g.variants:1,O=ye,Se=be>1,we=Is({hasGit:ye,variants:be,planFirst:g.planFirst,explicitAutonomous:g.autonomous,explicitWorktree:g.worktree,interactive:ae?.interactive,configuredAutonomous:h.data?.composerDefaults?.autonomous??h.data?.composerDefaults?.inheritedAutonomous??`source-dependent`,configuredWorktree:h.data?.composerDefaults?.worktree??h.data?.composerDefaults?.inheritedWorktree??!0,source:x.source}),Te=we.worktree,Ee=we.autonomous,De=l.data===void 0||l.data.capabilities.followups,Oe=De?g.generateFollowups??p.data?.lastGenerateFollowups??!0:!1,[A,j]=(0,q.useState)(null),[je,Me]=(0,q.useState)(!1),[Ne,Pe]=(0,q.useState)(!1),[Fe,M]=(0,q.useState)(()=>c.auto&&c.ref!==``),[N,Le]=(0,q.useState)(()=>!c.auto&&c.ref!==``?{kind:`prefill`}:null),Re=(0,q.useRef)(!1),ze=(0,q.useRef)(!1);(0,q.useEffect)(()=>{Re.current||(Re.current=!0,e.toString()!==``&&t(`/new`,{replace:!0}))},[]),(0,q.useEffect)(()=>{if(!ze.current&&!(!c.auto||c.ref===``)&&!C.isPending){if(!T||w===null){ze.current=!0,Le({kind:`prefill`}),M(!1);return}if(!m.isPending){if(ze.current=!0,de===void 0){Le({kind:`prefill`}),M(!1);return}(async()=>{let e=``;try{e=(await wt()).key}catch{}if(e!==``&&c.key===e)try{let e=await Be(Ns(c,w,de));Gs(a),n.invalidateQueries({queryKey:o.runs.all}),t(rn(e));return}catch(e){Le({kind:`failed`,message:e instanceof Error?e.message:String(e)})}else Le({kind:`blocked`});M(!1)})()}}},[m.isPending,de,C.isPending,T,w]),(0,q.useEffect)(()=>{if(N===null||!ie)return;Le(null);let e=c.skill!==``&&!te.some(e=>e.name===c.skill)?c.skill:``;e!==``&&v({text:Fs(c.skill,c.ref),...ne.some(e=>e.name===`quick-task`)?{source:{source:`workflow`,ref:`quick-task`}}:{}});let{message:t,tone:n}=Ps(N,e);I(t,{tone:n}),document.querySelector(`[data-slot="composer"] button[aria-label="Start task"], [data-slot="composer"] button[aria-label="Plan task"]`)?.focus()},[N,ie]);let He=async(e,r)=>{if(!T||w===null)throw Error(C.isPending?`Checking agent providers…`:C.isError?`Provider authentication could not be verified.`:`Connect an agent provider before starting a task.`);if(!ie)throw Error(`Still loading workflows and skills — try again in a second.`);if(g.planFirst){Me(!0);try{j(qs(e,r,await $e(e))),v({text:e})}finally{Me(!1)}return}let i=await Be(fn({task:e,source:x,model:_e,runner:w,runnerExplicit:g.runner!==null,defaultRunner:de,variants:be,images:r,worktree:Te,autonomous:Ee,generateFollowups:Oe,todoId:c.todo}));ge({lastTask:x,recentSources:un(y,x),...De?{lastGenerateFollowups:Oe}:{},...x.source===`skill`&&p.data!==void 0?{skillUsage:Lr(p.data.skillUsage,x.ref)}:{}}).then(()=>n.invalidateQueries({queryKey:o.uiState})).catch(()=>{}),Gs(a),n.invalidateQueries({queryKey:o.runs.all}),t(rn(i))},Ue=async()=>{if(!(A===null||A.steps.length===0||Ne||!T||w===null)){Pe(!0);try{let e=await Be(Qs({task:A.task,steps:A.steps,model:_e,runner:w,runnerExplicit:g.runner!==null,defaultRunner:de,variants:be,images:A.images,generateFollowups:Oe,todoId:c.todo}));De&&ge({lastGenerateFollowups:Oe}).then(()=>n.invalidateQueries({queryKey:o.uiState})).catch(()=>{}),Gs(a),j(null),n.invalidateQueries({queryKey:o.runs.all}),t(rn(e))}catch(e){I(e instanceof Error?e.message:String(e),{tone:`danger`})}finally{Pe(!1)}}};return Fe?(0,J.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,J.jsx)(at,{}),(0,J.jsxs)(`div`,{"data-slot":`auto-starting`,role:`status`,className:`text-center`,children:[(0,J.jsx)(`h1`,{className:`animate-pulse text-lg font-semibold tracking-tight`,children:`Starting task…`}),(0,J.jsx)(`p`,{className:`mt-1.5 text-[13.5px] text-muted-foreground`,children:`Launched from a bookmarklet — taking you to the run.`})]})]}):(0,J.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,J.jsx)(at,{}),(0,J.jsx)(ks,{}),(0,J.jsxs)(`div`,{className:`w-full max-w-[720px]`,children:[(0,J.jsxs)(`header`,{className:`mb-6 text-center max-md:mb-4`,children:[(0,J.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight max-md:text-base`,children:`What should the agent work on?`}),(0,J.jsx)(`p`,{className:`mt-1.5 text-[13.5px] text-muted-foreground max-md:text-xs`,children:`Runs in an isolated worktree — review everything before it lands.`})]}),(0,J.jsx)(Yt,{ref:oe,onSubmit:He,value:g.text,onValueChange:e=>v({text:e}),autoFocus:!0,placeholder:`Describe a task for the agent — / for skills…`,ariaLabel:`Describe a task for the agent`,sendAriaLabel:g.planFirst?`Plan task`:`Start task`,disabled:!T||Ne,disabledReason:C.isPending?`Checking agent providers…`:C.isError?`Provider authentication could not be verified.`:`Connect an agent provider before starting a task.`,autocompleteSkills:!0,footerStart:(0,J.jsxs)(J.Fragment,{children:[re.length>1&&r!==void 0?(0,J.jsx)(oc,{projects:re,projectId:r,onPick:e=>t(`/p/${encodeURIComponent(e)}/new`,{replace:!0})}):null,(0,J.jsx)(sc,{source:x,ready:ie,skills:te,skillUsage:ee,workflows:ne,onPick:e=>v({source:e})}),(0,J.jsx)(is,{templates:se,iconOnly:!0,onInsert:e=>oe.current?.insertAtCaret(e)}),ue.length>1?(0,J.jsx)(zn,{runners:ue,value:pe,disabled:!T,onPick:e=>v({runner:e,model:null})}):null,(0,J.jsx)(jn,{slot:`model-pill`,ariaLabel:`Model`,label:E.find(e=>e.id===_e)?.label??`auto`,value:_e,disabled:!T,onPick:e=>v({model:e}),options:E.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:on(pe,me.data,me.isError)}),(0,J.jsx)(jn,{slot:`variants-pill`,ariaLabel:`Parallel variants`,label:be>1?`×${be} variants`:`×1`,value:String(be),onPick:e=>v({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`}]}),O?(0,J.jsx)(nc,{on:Te,disabled:Se,disabledReason:`Parallel variants always use isolated worktrees`,onChange:e=>v({worktree:e})}):null,(0,J.jsx)(rc,{on:Ee,disabled:g.planFirst,onChange:e=>v({autonomous:e})}),ae?.interactive&&(g.autonomous===null||g.worktree===null)?(0,J.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,De?(0,J.jsx)(ic,{on:Oe,onChange:e=>v({generateFollowups:e})}):null,f.data?(0,J.jsx)(cc,{repo:f.data}):null]}),footerEnd:(0,J.jsxs)(J.Fragment,{children:[!T&&!C.isPending?(0,J.jsx)(G,{to:`/settings/agents#providers`,className:`text-xs font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):null,(0,J.jsx)(lc,{planFirst:g.planFirst,planning:je,onModeChange:e=>v({planFirst:e})}),(0,J.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:ur()})]})}),(0,J.jsx)(dc,{onPick:e=>v({text:e})})]}),A===null?null:(0,J.jsx)($s,{plan:A,starting:Ne,startAvailable:T,startUnavailableReason:C.isPending?`Checking agent providers…`:C.isError?`Provider authentication could not be verified.`:`Connect an agent provider before starting a task.`,startUnavailableAction:C.isPending?void 0:(0,J.jsx)(G,{to:`/settings/agents#providers`,children:`Configure providers`}),onStepsChange:e=>j(t=>t&&{...t,steps:e}),onStart:()=>void Ue(),onDiscard:()=>j(null)})]})}function nc({on:e,disabled:t,disabledReason:n,onChange:r}){return(0,J.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:V(Nn,e&&`border-primary/60 text-foreground`),children:[e?(0,J.jsx)(tt,{"aria-hidden":`true`,className:`size-3 shrink-0 text-primary`}):(0,J.jsx)(Ki,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),`Worktree`]})}function rc({on:e,disabled:t,onChange:n}){return(0,J.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:V(Nn,e&&!t&&`border-primary/60 text-foreground`),children:[e?(0,J.jsx)(tt,{"aria-hidden":`true`,className:`size-3 shrink-0 text-primary`}):(0,J.jsx)(Ki,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),`Autonomous`]})}function ic({on:e,onChange:t}){return(0,J.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:V(Nn,e&&`border-primary/60 text-foreground`),children:[e?(0,J.jsx)(tt,{"aria-hidden":`true`,className:`size-3 shrink-0 text-primary`}):(0,J.jsx)(Ki,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),`Follow-ups`]})}function ac(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 oc({projects:e,projectId:t,onPick:n}){let[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(``),s=e.find(e=>e.id===t),c=ac(e,a);return(0,J.jsxs)(Vn,{open:r,onOpenChange:e=>{i(e),e||o(``)},children:[(0,J.jsx)(Un,{asChild:!0,children:(0,J.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:V(Nn,`border-foreground/60 font-semibold text-foreground`),children:[(0,J.jsx)(Oi,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),(0,J.jsx)(`span`,{className:`max-w-40 truncate`,children:s?.name??t}),In]})}),(0,J.jsx)(Fn,{align:`start`,sideOffset:8,className:`w-[300px] max-w-[calc(100vw-2rem)] p-0`,children:(0,J.jsxs)(Mn,{shouldFilter:!1,children:[(0,J.jsx)(An,{placeholder:`search projects…`,value:a,onValueChange:o}),(0,J.jsxs)(En,{"data-slot":`project-menu`,className:`max-h-[min(18rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[c.length===0?(0,J.jsx)(Wn,{children:`Nothing matches.`}):null,c.map(e=>(0,J.jsxs)(U,{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,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-medium`,children:e.name}),e.status===`missing`?(0,J.jsx)(`span`,{className:`shrink-0 text-[11px] text-soft-foreground`,children:`folder not found`}):e.branch===void 0?null:(0,J.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-soft-foreground`,children:e.branch}),e.id===t?(0,J.jsx)(tt,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e.id))]}),(0,J.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 sc({source:e,ready:t,skills:n,skillUsage:r,workflows:i,onPick:a}){let[o,s]=(0,q.useState)(!1),[c,l]=(0,q.useState)(``),[u,d]=(0,q.useState)(null),f=(0,q.useRef)(null),{mostUsed:p,project:m,global:h}=jr(Pr(n,c,r),r),g=Rr(i,c),_=p.length===0&&m.length===0&&h.length===0&&g.length===0,v=e=>{a(e),s(!1)},y=(t,n)=>{let r=e.source===`skill`&&e.ref===t.name;return(0,J.jsxs)(U,{value:`skill ${t.name} ${t.path}`,keywords:Mr(t.name,t.description),"data-slot":`source-option`,"data-source-kind":`skill`,"data-source-ref":t.name,onSelect:()=>v({source:`skill`,ref:t.name}),children:[(0,J.jsx)(`span`,{className:V(`shrink-0 font-mono text-xs`,n&&`font-semibold`),children:t.name}),t.description?(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:t.description}):null,(0,J.jsx)(`button`,{type:`button`,"data-slot":`source-skill-view`,"aria-label":`View skill ${t.name}`,title:`View skill`,onClick:e=>{e.preventDefault(),e.stopPropagation(),d(t)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,J.jsx)(Tn,{"aria-hidden":`true`,className:`size-3.5`})}),r?(0,J.jsx)(tt,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},t.path)};return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Ms,{skill:u,onClose:()=>d(null)}),(0,J.jsxs)(Vn,{open:o,onOpenChange:e=>{s(e),e||l(``)},children:[(0,J.jsx)(Un,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,"data-slot":`source-pill`,"aria-label":`Choose a skill or workflow`,disabled:!t,className:V(Nn,`border-foreground/60 font-mono text-[11.5px] font-semibold text-foreground`),children:[e.source===`skill`?(0,J.jsx)(Jn,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}):(0,J.jsx)(Ji,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),(0,J.jsx)(`span`,{className:`max-w-44 truncate`,children:t?e.ref:`…`}),In]})}),(0,J.jsx)(Fn,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,J.jsxs)(Mn,{shouldFilter:!1,children:[(0,J.jsx)(An,{placeholder:`search skills & workflows…`,value:c,onValueChange:l,onInput:()=>f.current?.scrollTo(0,0)}),(0,J.jsxs)(En,{ref:f,"data-slot":`source-menu`,className:`max-h-[min(18rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[_?(0,J.jsx)(Wn,{children:`Nothing matches.`}):null,p.length>0?(0,J.jsx)(W,{heading:`Most used`,children:p.map(e=>y(e,Nr(e)))}):null,m.length>0?(0,J.jsx)(W,{heading:`Project skills`,children:m.map(e=>y(e,!0))}):null,g.length>0?(0,J.jsx)(W,{heading:`Workflows`,children:g.map(t=>{let n=e.source===`workflow`&&e.ref===t.name;return(0,J.jsxs)(U,{value:`workflow ${t.name}`,keywords:Mr(t.name,t.description),"data-slot":`source-option`,"data-source-kind":`workflow`,"data-source-ref":t.name,onSelect:()=>v({source:`workflow`,ref:t.name}),children:[(0,J.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:t.name}),t.description?(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:t.description}):null,n?(0,J.jsx)(tt,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]},t.name)})}):null,h.length>0?(0,J.jsx)(W,{heading:`Global`,children:h.map(e=>y(e,!1))}):null]})]})})]})]})}function cc({repo:e}){let t=P(),n=L({mutationFn:e=>pe({baseBranch:e}),onSuccess:e=>{t.invalidateQueries({queryKey:o.repo}),I(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=>I(e.message,{tone:`danger`})});return e.info?(0,J.jsx)(jn,{slot:`base-pill`,ariaLabel:`Base branch`,label:(0,J.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 lc({planFirst:e,planning:t,onModeChange:n}){return(0,J.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,J.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":!e,onClick:()=>n(!1),className:V(`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,J.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e,"aria-busy":t||void 0,"data-slot":`mode-plan`,onClick:()=>n(!0),className:V(`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 uc=[`Fix a failing or flaky test`,`Summarize recent commits on this branch`,`Update the README for recent changes`];function dc({onPick:e}){return(0,J.jsx)(`div`,{className:`mt-7 flex flex-wrap justify-center gap-2 max-md:justify-start`,children:uc.map(t=>(0,J.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,J.jsx)(Jn,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),t]},t))})}function fc(){return(0,J.jsx)(`div`,{"data-route":`not-found`,className:`flex min-h-full flex-col`,children:(0,J.jsx)(z,{icon:(0,J.jsx)(wi,{}),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,J.jsx)(M,{asChild:!0,variant:`outline`,children:(0,J.jsx)(G,{to:`/`,children:`Back to tasks`})})})})}function pc(){return(0,J.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,J.jsx)(z,{icon:(0,J.jsx)(me,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading repository…`,subtitle:`Fetching the repo's git state.`})})}function mc(){return(0,J.jsxs)(`div`,{"data-route":`skills`,className:`flex min-h-full flex-col`,children:[(0,J.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,J.jsx)(`h1`,{className:`text-base font-semibold`,children:`Skills`}),(0,J.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Markdown playbooks agents can follow.`})]}),(0,J.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 hc({projectId:e,registry:t}){let n=t.projects.length?t.projects:[{id:t.bootProject,name:t.bootProject}];return(0,J.jsx)(`div`,{"data-route":`unknown-project`,className:`flex min-h-full flex-col`,children:(0,J.jsx)(z,{icon:(0,J.jsx)(ki,{}),tone:`neutral`,title:`“${e}” isn’t registered here`,subtitle:`This cezar 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,J.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,J.jsx)(`li`,{children:(0,J.jsxs)(ve,{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,J.jsxs)(`span`,{className:`font-mono text-[11px] font-normal text-soft-foreground`,children:[`/p/`,e.id]})]})},e.id))})})})}function gc(){return(0,J.jsx)(`div`,{"data-route":`workflows`,className:`flex min-h-full flex-col`,children:(0,J.jsx)(z,{icon:(0,J.jsx)(me,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading workflows…`,subtitle:`Fetching the saved chains and the skills palette.`})})}function _c({tab:e}){return(0,J.jsx)(`div`,{"data-route":`task-${e}`,className:`flex min-h-full flex-col`,children:(0,J.jsx)(z,{icon:(0,J.jsx)(me,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:e===`changes`?`Loading changes…`:`Loading files…`,subtitle:`Fetching the run record.`})})}function vc({tab:e,error:t}){let n=t instanceof A&&t.status===404;return(0,J.jsx)(`div`,{"data-route":`task-${e}`,className:`flex min-h-full flex-col`,children:(0,J.jsx)(z,{icon:n?(0,J.jsx)(qn,{}):(0,J.jsx)(Yn,{}),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,J.jsx)(M,{asChild:!0,variant:`outline`,children:(0,J.jsx)(G,{to:`/`,children:`Back to tasks`})})})})}var yc=1500;function bc(e,t){let n=(0,q.useMemo)(()=>e.split(`
4
+ `).map(e=>[{content:e}]),[e]),r=(0,q.useMemo)(()=>Vr(t),[t]),i=n.length>yc,[a,o]=(0,q.useState)(null);return(0,q.useEffect)(()=>{if(r===null||i)return;let t=!1;return Hr(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:Br(e,r)?.tokens??n}var xc=`m-0 min-h-full w-full whitespace-pre font-mono text-xs leading-[1.7] px-3 py-2 [tab-size:2]`;function Sc({value:e,onChange:t,language:n,readOnly:r,className:i,...a}){let o=bc(e,n),s=(0,q.useRef)(null),c=(0,q.useRef)(null),l=()=>{let e=c.current,t=s.current;!e||!t||(t.scrollTop=e.scrollTop,t.scrollLeft=e.scrollLeft)};return(0,q.useLayoutEffect)(l,[e]),(0,J.jsxs)(`div`,{"data-slot":`code-editor`,className:V(`relative overflow-hidden rounded-md border border-input bg-card`,i),children:[(0,J.jsx)(`pre`,{ref:s,"aria-hidden":`true`,className:V(xc,`pointer-events-none absolute inset-0 overflow-auto text-soft-foreground`),children:o.map((e,t)=>(0,J.jsx)(`span`,{className:`block`,children:e.length===0?`
5
+ `:(0,J.jsxs)(J.Fragment,{children:[e.map((e,t)=>(0,J.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t)),`
6
+ `]})},t))}),(0,J.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:V(xc,`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 Cc=`An editor-plus-commit: a saved change reaches a run after you commit it to the base branch.`;function wc(e){return t=>t.runners.includes(e)}function Tc(e,t,n,r){let i=wc(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 Ec=[{id:`claude`,label:`Claude`,groups:[Tc(`claude`,`settings`,`Settings`),Tc(`claude`,`mcp`,`MCP`,`A dedicated .mcp.json (key: mcpServers), shared via version control.`),Tc(`claude`,`memory`,`Memory & instructions`)]},{id:`codex`,label:`Codex`,note:Cc,groups:[Tc(`codex`,`settings`,`Settings`),Tc(`codex`,`mcp`,`MCP`,`Inside config.toml under [mcp_servers.<id>] — the same file as Codex’s settings.`),Tc(`codex`,`memory`,`Memory & instructions`)]},{id:`opencode`,label:`OpenCode`,note:Cc,groups:[Tc(`opencode`,`settings`,`Settings`),Tc(`opencode`,`mcp`,`MCP`,`Under the "mcp" key in opencode.json — the same file as OpenCode’s settings.`),Tc(`opencode`,`memory`,`Memory & instructions`)]}];function Dc(e){let t=Ec.find(t=>t.id===e);if(!t)throw Error(`no agent descriptor for ${e}`);return t}function Oc(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 kc(){let e=Qe(),t=k(),n=(0,q.useMemo)(()=>t.data?ln(t.data.checks):Ec.map(e=>e.id),[t.data]);return e.isPending?(0,J.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,J.jsx)(z,{icon:(0,J.jsx)(Ei,{}),tone:`danger`,title:`Agent config did not load`,subtitle:e.error.message,heading:`h2`}):(0,J.jsx)(Ac,{listing:e.data,installed:n})}function Ac({listing:e,installed:t}){let[n,r]=(0,q.useState)(`claude`),[i,a]=(0,q.useState)(null),o=Dc(n),s=e.files.find(e=>e.id===i)??null,c=e=>{r(e),a(null)};return(0,J.jsxs)(`div`,{"data-slot":`agent-config`,className:`flex flex-col gap-4 p-4 md:p-6`,children:[!e.editable&&(0,J.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,J.jsx)(`div`,{"data-slot":`agent-config-agents`,role:`tablist`,className:`flex flex-wrap gap-1 rounded-md bg-muted/40 p-1`,children:Ec.map(e=>(0,J.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:V(`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,J.jsx)(ha,{variant:`outline`,className:`text-[10px] text-soft-foreground`,children:`not installed`})]},e.id))}),o.note&&(0,J.jsx)(`p`,{"data-slot":`agent-config-agent-note`,className:`text-[12px] text-soft-foreground`,children:o.note}),(0,J.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[minmax(0,20rem)_minmax(0,1fr)]`,children:[(0,J.jsx)(`nav`,{"data-slot":`agent-config-nav`,className:`flex flex-col gap-5`,children:(0,J.jsx)(jc,{agent:o,listing:e,selectedId:i,onSelect:a})}),(0,J.jsx)(`div`,{"data-slot":`agent-config-editor-pane`,children:s?(0,J.jsx)(Nc,{file:s},s.id):(0,J.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 jc({agent:e,listing:t,selectedId:n,onSelect:r}){return(0,J.jsx)(J.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,J.jsxs)(`section`,{"data-slot":`agent-config-group`,"data-group":i.id,"data-agent":e.id,children:[(0,J.jsx)(`p`,{className:`mb-1 text-[11px] font-medium uppercase tracking-wide text-soft-foreground`,children:i.label}),i.note&&(0,J.jsx)(`p`,{className:`mb-2 text-[12px] text-soft-foreground`,children:i.note}),(0,J.jsx)(`ul`,{className:`flex flex-col gap-1`,children:a.map(e=>(0,J.jsx)(`li`,{children:(0,J.jsxs)(`button`,{type:`button`,"data-slot":`agent-config-file`,"data-selected":e.id===n,onClick:()=>r(e.id),className:V(`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,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[12px]`,children:e.label}),e.seeded&&(0,J.jsx)(ha,{variant:`outline`,className:`shrink-0 text-[10px]`,children:`seeded`}),!e.exists&&(0,J.jsx)(`span`,{className:`shrink-0 text-[11px] text-soft-foreground`,children:`absent`})]})},e.id))}),o&&t.userMcp&&(0,J.jsx)(Mc,{userMcp:t.userMcp})]},i.id)})})}function Mc({userMcp:e}){return(0,J.jsxs)(`div`,{"data-slot":`agent-config-user-mcp`,className:`mt-3`,children:[(0,J.jsx)(`h4`,{className:`mb-1 text-[12px] font-semibold`,children:`User & local scopes`}),(0,J.jsxs)(`p`,{className:`mb-2 text-[12px] text-soft-foreground`,children:[`Managed by `,(0,J.jsx)(`code`,{className:`font-mono`,children:`claude mcp add`}),` in `,e.path,` — cezar does not edit Claude’s state file.`]}),e.readable?e.servers.length>0?(0,J.jsx)(`ul`,{className:`flex flex-wrap gap-1`,children:e.servers.map(e=>(0,J.jsx)(`li`,{children:(0,J.jsx)(ha,{variant:`outline`,className:`font-mono text-[11px]`,children:e})},e))}):(0,J.jsx)(`p`,{className:`text-[12px] text-soft-foreground`,children:`No user-scoped MCP servers.`}):(0,J.jsx)(`p`,{className:`text-[12px] text-soft-foreground`,children:`Could not read the file.`})]})}function Nc({file:e}){let t=de(e.id),n=Ge(e.id),[r,i]=(0,q.useState)(null),[a,o]=(0,q.useState)(!1),[s,c]=(0,q.useState)(null),l=t.data?.version??null;(0,q.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,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.label}),(0,J.jsx)(ha,{variant:`outline`,className:`text-[10px] uppercase`,children:e.format}),(0,J.jsx)(`a`,{href:e.docsUrl,target:`_blank`,rel:`noreferrer`,className:`text-[12px] text-soft-foreground underline hover:text-foreground`,children:`docs`})]}),(0,J.jsx)(`p`,{"data-slot":`agent-config-precedence`,className:`text-[12px] text-soft-foreground`,children:e.precedence}),(0,J.jsxs)(`p`,{"data-slot":`agent-config-effect`,className:`text-[12px] text-foreground/80`,children:[Oc(e),e.hotReload?` ${e.hotReload}`:``]}),t.isPending?(0,J.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Loading file…`}):t.isError?(0,J.jsx)(`p`,{className:`text-[13px] text-destructive`,children:t.error.message}):(0,J.jsx)(Sc,{value:u,language:e.format,readOnly:!f,onChange:i,"aria-label":`${e.label} contents`,className:`h-[26rem]`}),s&&(0,J.jsx)(`p`,{"data-slot":`agent-config-format-error`,className:`text-[12px] text-destructive`,children:s}),a&&(0,J.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,J.jsx)(`span`,{children:`The file changed on disk since you opened it.`}),(0,J.jsx)(M,{size:`sm`,variant:`outline`,onClick:()=>void t.refetch(),children:`Reload from disk`})]}),f&&(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(M,{size:`sm`,onClick:()=>{c(null),o(!1),n.mutate({content:u,version:l},{onSuccess:()=>{i(null),I(`${e.exists?`Saved`:`Created`} ${e.label}`)},onError:e=>{e instanceof A&&e.status===409?o(!0):e instanceof A&&e.status===400?c(e.message):I(e.message,{tone:`danger`})}})},disabled:!d||n.isPending,children:e.exists?`Save`:`Create`}),(0,J.jsx)(M,{size:`sm`,variant:`ghost`,onClick:()=>i(null),disabled:!d||n.isPending,children:`Revert`}),d&&(0,J.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`Unsaved changes`})]})]})}function Pc({className:e,size:t=`default`,...n}){return(0,J.jsx)(sa,{"data-slot":`switch`,"data-size":t,className:V(`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,J.jsx)(la,{"data-slot":`switch-thumb`,className:V(`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 Fc=[{id:`claude`,label:`Claude Code`,login:`claude auth login`},{id:`codex`,label:`Codex`,login:`codex login`},{id:`opencode`,label:`OpenCode`,login:`opencode auth login`}],Ic=e=>({claude:e,codex:e,opencode:e}),Lc={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 Rc(e,t,n){return{providers:e.providers.map(e=>e.provider===t?{...e,enabled:n}:e)}}function zc(){let e=i(),t=vt(),n=He(),r=P(),[a,o]=(0,q.useState)(null),s=(0,q.useRef)(Promise.resolve()),c=(0,q.useRef)(Ic(0)),l=(0,q.useRef)(Ic(0)),u=(0,q.useRef)(e.data);(0,q.useEffect)(()=>{a&&j(e.data,a.provider)?.status===`connected`&&o(null)},[a,e.data]),(0,q.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?j(u.current,e.provider)?.enabled??e.enabled:e.enabled}))}}},[e.data]);let d=(0,q.useCallback)((e,t)=>{let n=E.providerStatus,i=r.getQueryData(n);if(!i)return;u.current||=i;let a=Rc(i,e,t);l.current[e]+=1,r.setQueryData(n,a);let o=++c.current[e];s.current=s.current.then(async()=>{try{let i=await we(e,t),a=j(i,e)?.enabled;if(a===void 0)return;if(u.current=Rc(u.current??i,e,a),o===c.current[e]){let t=r.getQueryData(n);r.setQueryData(n,t?Rc(t,e,a):i)}}catch(t){if(o===c.current[e]){let i=j(u.current,e)?.enabled,a=r.getQueryData(n);a&&i!==void 0?r.setQueryData(n,Rc(a,e,i)):u.current?r.setQueryData(n,u.current):r.removeQueries({queryKey:n,exact:!0}),I(t instanceof Error?t.message:String(t),{tone:`danger`})}}finally{--l.current[e]}})},[r]),f=L({mutationFn:Xe,onSuccess:async e=>{o(null),I(e.opened?`Finish signing in in the terminal, then check again.`:`Provider is already connected.`),await r.invalidateQueries({queryKey:E.providerStatus})},onError:(e,t)=>{if(e instanceof A&&e.command){let n=Fc.find(e=>e.id===t)?.label??t;o({provider:t,label:n,message:e.message,command:e.command});return}I(e.message,{tone:`danger`})}}),p=async e=>{try{await navigator.clipboard.writeText(e),I(`Command copied`)}catch{I(`Could not copy the command`,{tone:`danger`})}};return(0,J.jsxs)(`section`,{id:`providers`,"data-slot":`provider-settings`,className:`scroll-mt-20`,children:[(0,J.jsxs)(`div`,{className:`mb-2`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Providers`}),(0,J.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Connect the coding agents available on this computer.`})]}),e.isError?(0,J.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,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:`Provider status could not be loaded`}),(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.error.message})]}),(0,J.jsx)(M,{type:`button`,variant:`outline`,size:`sm`,disabled:e.isFetching,onClick:()=>void e.refetch(),children:`Retry`})]}):null,(0,J.jsx)(`div`,{className:`flex flex-col gap-2`,children:Fc.map(r=>{let i=j(e.data,r.id),o=i?.status,s=o?Lc[o]:e.isPending?{label:`Checking…`,tone:`neutral`}:Lc.unknown,c=f.isPending&&f.variables===r.id,l=o===`disconnected`||o===`unknown`,u=i?.authFailureId;return(0,J.jsxs)(q.Fragment,{children:[(0,J.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,J.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:r.label}),(0,J.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,J.jsx)(K,{tone:s.tone,pulse:e.isPending}),(0,J.jsx)(`span`,{children:s.label}),i?.enabled===!1?(0,J.jsx)(`span`,{children:`Disabled`}):null]}),o===`not-installed`?(0,J.jsxs)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:[`Install `,r.label,`, then run `,(0,J.jsx)(`code`,{children:r.login}),`.`]}):o===`unknown`||e.isError&&!o?(0,J.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:`Verification failed. Check again when the provider is available.`}):i?.hint?(0,J.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:i.hint}):null]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[o===`not-installed`?null:(0,J.jsx)(Pc,{checked:i?.enabled??!0,"aria-label":`Use ${r.label}`,onCheckedChange:e=>d(r.id,e)}),l?(0,J.jsx)(M,{type:`button`,variant:`ghost`,size:`sm`,disabled:t.isPending,onClick:()=>t.mutate(void 0,{onError:e=>I(e.message,{tone:`danger`})}),children:`Check again`}):null,o===`disconnected`?(0,J.jsx)(M,{type:`button`,variant:`outline`,size:`sm`,disabled:f.isPending,onClick:()=>f.mutate(r.id),children:c?`Opening…`:`Connect`}):null,u===void 0?null:(0,J.jsx)(M,{type:`button`,variant:`outline`,size:`sm`,disabled:n.isPending,onClick:()=>n.mutate({provider:r.id,authFailureId:u},{onSuccess:()=>I(`${r.label} can be tried again.`),onError:e=>I(e.message,{tone:`danger`})}),children:`Try again`})]})]}),u===void 0?null:(0,J.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`Use this after completing the provider sign-in flow. cezar cannot validate the credential without a task/model request; it will verify it on the next task.`})]}),a?.provider===r.id&&o!==`connected`?(0,J.jsxs)(`div`,{role:`region`,"aria-label":`${a.label} manual sign-in`,className:`rounded-md border border-pending/40 bg-pending/5 px-3.5 py-3`,children:[(0,J.jsx)(`p`,{className:`text-[13px] text-foreground`,children:a.message}),(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(`code`,{className:`min-w-0 flex-1 overflow-x-auto rounded-sm bg-muted px-2 py-1.5 text-xs`,children:a.command}),(0,J.jsx)(M,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void p(a.command),children:`Copy command`})]})]}):null]},r.id)})})]})}var Bc=2e4;function Vc(){let e=he(),t=qe(),n=i();return e.isPending?(0,J.jsx)(`p`,{"data-slot":`agents-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent settings…`}):e.isError?(0,J.jsx)(z,{icon:(0,J.jsx)(It,{}),tone:`danger`,title:`Agent settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,J.jsx)(Hc,{config:e.data,catalog:t.data,providerStatus:n})}function Hc({config:e,catalog:t,providerStatus:n}){let r=Ie(),i=P(),a=L({mutationFn:e=>pe(e),onSuccess:e=>{i.setQueryData(o.config,e),i.invalidateQueries({queryKey:o.health}),i.invalidateQueries({queryKey:o.repo})},onError:e=>I(e.message,{tone:`danger`})}),[s,c]=(0,q.useState)(e.systemPrompt??``),l=s.trim(),u=l===(e.systemPrompt??``),d=l.length>Bc;return(0,J.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,J.jsx)(zc,{}),(0,J.jsxs)(Uc,{title:`Default runner`,hint:`Preselected for new tasks and used by the chain planner. Each task can still pick another runner.`,children:[(0,J.jsx)(`div`,{role:`radiogroup`,"aria-label":`Default runner`,"data-slot":`agents-runner`,className:`inline-flex w-fit gap-0.5 rounded-md border border-border bg-card p-0.5`,children:mn.map(t=>{let r=t.id===e.defaultRunner,i=j(n.data,t.id),o=!n.isPending&&!n.isError&&i?.enabled===!0&&i.status===`connected`,s=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.`:o?void 0:`Connect this provider before selecting it.`;return(0,J.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":r,"data-value":t.id,title:s??t.desc,disabled:a.isPending||!o,onClick:()=>a.mutate({defaultRunner:t.id}),className:V(`rounded-sm px-3 py-1.5 font-mono text-[13px] font-medium transition-colors disabled:opacity-50`,r?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:t.label},t.id)})}),!n.isPending&&!n.isError&&j(n.data,e.defaultRunner)?.enabled===!1?(0,J.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`This provider is disabled. Enable it above or choose another provider.`}):null]}),(0,J.jsx)(Uc,{title:`Default models`,hint:`The model preselected in the composer for each runner. Auto lets the runner decide per task.`,children:(0,J.jsx)(`div`,{className:`flex max-w-md flex-col gap-2`,children:mn.map(r=>{let i=j(n.data,r.id),o=!n.isPending&&!n.isError&&i?.enabled===!0&&i.status===`connected`,s=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.`:o?void 0:`Connect this provider before selecting it.`;return(0,J.jsxs)(`label`,{className:`flex items-center gap-3`,children:[(0,J.jsx)(`span`,{className:`w-24 shrink-0 font-mono text-xs text-muted-foreground`,children:r.label}),(0,J.jsxs)(`select`,{"aria-label":`Default model for ${r.label}`,"data-slot":`agents-model`,"data-runner":r.id,value:e.defaultModels[r.id]??``,title:s??r.desc,disabled:a.isPending||!o,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:[tn(r.id,t,[e.defaultModels[r.id]]).map(e=>(0,J.jsx)(`option`,{value:e.id,children:e.id===``?`auto (default)`:e.label},e.id)),on(r.id,t)?(0,J.jsx)(`option`,{disabled:!0,children:on(r.id,t)}):null]})]},r.id)})})}),(0,J.jsxs)(Uc,{title:`System prompt`,hint:`Extra instructions appended to every run, whichever runner executes it. This is the only place it is edited.`,children:[(0,J.jsx)(Zn,{"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,J.jsxs)(`div`,{className:`flex max-w-xl items-center gap-3`,children:[(0,J.jsx)(M,{type:`button`,variant:`outline`,size:`sm`,"data-action":`agents-save-prompt`,disabled:u||d||a.isPending,onClick:()=>a.mutate({systemPrompt:l===``?null:l},{onSuccess:()=>I(l===``?`System prompt cleared`:`System prompt saved`)}),children:`Save`}),d?(0,J.jsxs)(`p`,{"data-slot":`agents-prompt-limit`,className:`text-[11px] text-danger`,children:[l.length.toLocaleString(),` characters — the limit is`,` `,Bc.toLocaleString(),`.`]}):(0,J.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Leave empty and save to clear. Applied to new runs only.`})]})]}),(0,J.jsx)(Uc,{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,J.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,J.jsx)(Pc,{"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:()=>I(e?`Live title updates on`:`Live title updates off`)})}),(0,J.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.liveTitleUpdates??!0?`On`:`Off`,e.liveTitleUpdates===null&&` (default)`]})]})}),(0,J.jsx)(Uc,{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,J.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,J.jsx)(Pc,{"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:()=>I(e?`Review gate on`:`Review gate off`)})}),(0,J.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.reviewGate??!1?`On`:`Off`,e.reviewGate===null&&` (default)`]})]})}),(0,J.jsx)(Uc,{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,J.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,J.jsx)(`option`,{value:``,children:`follow checked-out branch (default)`}),r.data.branches.map(e=>(0,J.jsx)(`option`,{value:e,children:e},e))]}):(0,J.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 Uc({title:e,hint:t,children:n}){return(0,J.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,J.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}var Wc=`cez-accent`,Gc=`cez-density`,Kc=`cez-width`,qc=`lime`,Jc=`comfortable`,Yc=`narrow`;function Xc(e){return e===`lime`||e===`violet`?e:qc}function Zc(e){return e===`comfortable`||e===`compact`||e===`ultra`?e:Jc}function Qc(e){return e===`narrow`||e===`wide`?e:Yc}function $c(e){let t=e&&typeof e==`object`?e:{};return{accent:Xc(t.accent),density:Zc(t.density),width:Qc(t.width)}}function el(){try{return{accent:Xc(localStorage.getItem(Wc)),density:Zc(localStorage.getItem(Gc)),width:Qc(localStorage.getItem(Kc))}}catch{return{accent:qc,density:Jc,width:Yc}}}function tl(e){try{localStorage.setItem(Wc,e.accent),localStorage.setItem(Gc,e.density),localStorage.setItem(Kc,e.width)}catch{}}function nl(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 rl=q.createContext(null);function il({children:e}){let t=P(),n=y(),[r,i]=q.useState(el),a=n.data;q.useEffect(()=>{if(a===void 0)return;let e=$c(a.appearance);i(e),tl(e)},[a]),q.useLayoutEffect(()=>{nl(document.documentElement,r)},[r]);let o=q.useCallback(e=>{i(e),tl(e),x({appearance:e}).then(e=>t.setQueryData(E.uiState,e)).catch(e=>{I(e instanceof Error?e.message:String(e),{tone:`danger`}),t.invalidateQueries({queryKey:E.uiState})})},[t]),s=q.useCallback(e=>o({...r,accent:e}),[o,r]),c=q.useCallback(e=>o({...r,density:e}),[o,r]),l=q.useCallback(e=>o({...r,width:e}),[o,r]),u=q.useMemo(()=>({accent:r.accent,density:r.density,width:r.width,setAccent:s,setDensity:c,setWidth:l}),[r,s,c,l]);return(0,J.jsx)(rl.Provider,{value:u,children:e})}function al(){let e=q.useContext(rl);if(!e)throw Error(`cezar: useAppearance() must be called inside <AppearanceProvider>`);return e}var ol=[{value:`system`,label:`System`,icon:Ri},{value:`light`,label:`Light`,icon:qi},{value:`dark`,label:`Dark`,icon:zi}],sl=[{value:`lime`,label:`Lime`,swatch:`var(--accent-lime)`},{value:`violet`,label:`Violet`,swatch:`var(--violet)`}],cl=[{value:`comfortable`,label:`Comfortable`},{value:`compact`,label:`Compact`},{value:`ultra`,label:`Compact for real`}],ll=[{value:`narrow`,label:`Narrow`},{value:`wide`,label:`Wide`}];function ul({slot:e,label:t,value:n,options:r,onChange:i}){return(0,J.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,J.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t,"data-value":e.value,onClick:()=>i(e.value),className:V(`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,J.jsx)(e.icon,{"aria-hidden":`true`,className:`size-3.5`}):null,e.swatch?(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 rounded-full border border-border`,style:{background:e.swatch}}):null,e.label]},e.value)})})}function dl({title:e,hint:t,children:n}){return(0,J.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,J.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}function fl(){let{theme:e,setTheme:t}=La(),{accent:n,density:r,width:i,setAccent:a,setDensity:o,setWidth:s}=al();return(0,J.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,J.jsx)(dl,{title:`Theme`,hint:`System follows your OS preference. Applies to this browser.`,children:(0,J.jsx)(ul,{slot:`appearance-theme`,label:`Theme`,value:e,options:ol,onChange:t})}),(0,J.jsx)(dl,{title:`Accent`,hint:`The primary action color. Saved with this repo's cockpit state.`,children:(0,J.jsx)(ul,{slot:`appearance-accent`,label:`Accent`,value:n,options:sl,onChange:a})}),(0,J.jsx)(dl,{title:`Density`,hint:`Compact tightens spacing across the cockpit — text stays the same size.`,children:(0,J.jsx)(ul,{slot:`appearance-density`,label:`Density`,value:r,options:cl,onChange:o})}),(0,J.jsx)(dl,{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,J.jsx)(ul,{slot:`appearance-width`,label:`Reading width`,value:i,options:ll,onChange:s})})]})}var pl=`http://localhost:4321`;function ml(e,t,n,r=pl,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 hl(){let e=kt();return e.isPending?(0,J.jsx)(`p`,{"data-slot":`bookmarklets-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading bookmarklets…`}):e.isError?(0,J.jsx)(z,{icon:(0,J.jsx)(Yn,{}),tone:`danger`,heading:`h2`,title:`Could not load bookmarklets`,subtitle:e.error.message}):(0,J.jsx)(`div`,{className:`flex min-h-full flex-1 overflow-y-auto px-4 py-5 md:px-7`,children:(0,J.jsx)(gl,{skills:Fr(e.data??[])})})}function gl({skills:e}){let t=se(),n=k(),r=D(),[i,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(``),c=t.data?.key??``,l=window.location.origin,u=xr()??n.data?.bootProject??null,d=r.data?.projects.find(e=>e.id===u)?.name??Wu(n.data)?.name??null,f=o.trim().toLowerCase(),p=e.filter(e=>e.name.toLowerCase().includes(f));return(0,J.jsxs)(`div`,{"data-slot":`bookmarklet-panel`,className:`mx-auto w-full max-w-2xl`,children:[(0,J.jsx)(`h2`,{className:`text-base font-semibold`,children:`Run from GitHub`}),(0,J.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,J.jsx)(`span`,{className:`font-mono`,children:`npx cezar`}),`.`]}),(0,J.jsxs)(`label`,{className:`mt-4 flex items-center gap-2 text-[13px] font-medium`,children:[(0,J.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,J.jsx)(`span`,{className:`font-normal text-soft-foreground`,children:`— re-drag the buttons after changing this`})]}),(0,J.jsx)(`div`,{"data-slot":`bm-generic`,className:`mt-4`,children:(0,J.jsx)(_l,{label:d?`cezar (${d}): this PR/issue`:`cezar: this PR/issue`,url:ml(``,!1,c,l,u),hint:`prefills the form — nothing starts by itself`})}),(0,J.jsx)(_a,{"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,J.jsx)(`div`,{"data-slot":`bm-list`,className:`mt-3 flex flex-col gap-2`,children:p.length>0?p.map(e=>(0,J.jsx)(_l,{label:d?`/${e.name} (${d})`:`/${e.name}`,url:ml(e.name,i,c,l,u),hint:e.source},e.path)):(0,J.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 _l({label:e,url:t,hint:n}){let r=(0,q.useRef)(null);(0,q.useEffect)(()=>{r.current?.setAttribute(`href`,t)},[t]);let i=async()=>{try{await navigator.clipboard.writeText(t),I(`Bookmarklet URL copied.`)}catch{I(`Copy failed — drag the button instead.`,{tone:`danger`})}};return(0,J.jsxs)(`div`,{"data-slot":`bm-row`,className:`flex min-w-0 items-center gap-2.5`,children:[(0,J.jsxs)(`a`,{ref:r,draggable:!0,"data-slot":`bm-link`,title:`Drag me to your bookmarks bar`,onClick:e=>{e.preventDefault(),I(`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,J.jsx)(an,{"aria-hidden":`true`,className:`size-3 text-primary`}),e]}),(0,J.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,J.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-soft-foreground`,children:n}):null]})}function vl(e){return{enabled:(e&&typeof e==`object`?e:{}).enabled===!0}}function yl(){let e=globalThis.Notification;if(typeof e!=`function`)return`unsupported`;let t=e.permission;return t===`granted`||t===`denied`?t:`default`}function bl(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||Tr(i)&&r.push(i)}return{entering:r,statuses:n}}function xl(e){return e.enabled&&e.hidden&&e.permission===`granted`}function Sl(e){let t=Sr(e).label;return{title:e.titleSummary??e.title,body:`Task ${t}`,tag:`cezar-run-${e.id}`}}function Cl(){let e=P(),t=y(),[n,r]=q.useState(!1),[i,a]=q.useState(yl),o=t.data;q.useEffect(()=>{o!==void 0&&r(vl(o.notifications).enabled)},[o]);let s=q.useCallback(t=>{r(t),x({notifications:{enabled:t}}).then(t=>e.setQueryData(E.uiState,t)).catch(t=>{I(t instanceof Error?t.message:String(t),{tone:`danger`}),e.invalidateQueries({queryKey:E.uiState})})},[e]),c=q.useCallback(e=>{if(!e){s(!1);return}if(yl()!=="default"){s(!0);return}s(!0),Notification.requestPermission().then(e=>a(e)).catch(()=>a(yl()))},[s]),l=i===`unsupported`;return(0,J.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,J.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:(0,J.jsx)(`label`,{htmlFor:`notifications-enabled`,children:`Notify when an agent needs you`})}),(0,J.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,J.jsx)(Pc,{id:`notifications-enabled`,"data-slot":`notifications-toggle`,checked:n,disabled:l,onCheckedChange:c})]}),l?(0,J.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,J.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 wl({title:e,hint:t,children:n}){return(0,J.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,J.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}var Tl=1,El={ok:`ok`,"not-git":`no git repo`,missing:`folder not found`};function Dl(e){let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function Ol(){let e=Ce(),t=D();return e.isPending||t.isPending?(0,J.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,J.jsx)(z,{icon:(0,J.jsx)(Ai,{}),tone:`danger`,title:`Project settings did not load`,subtitle:(e.error??t.error)?.message,heading:`h2`}):(0,J.jsx)(kl,{config:e.data,registry:t.data})}function kl({config:e,registry:t}){return(0,J.jsxs)(`div`,{"data-slot":`projects-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,J.jsx)(Al,{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,J.jsx)(Al,{configKey:`projectsDir`,value:e.projectsDir,title:`Default checkout folder`,hint:`Where “Clone from GitHub” puts new projects: <folder>/<project name>.`,placeholder:`~/cezar/projects`,slot:`checkout`,savedLabel:`Checkout folder`,footer:`Only affects new checkouts; projects already registered keep their location.`,refreshProjects:!0}),(0,J.jsx)(jl,{registry:t,workspaceMax:e.resources.maxParallel})]})}function Al({configKey:e,value:t,title:n,hint:r,placeholder:i,slot:a,savedLabel:o,footer:s,refreshProjects:c=!1}){let l=P(),u=L({mutationFn:t=>b(e===`browseRoot`?{browseRoot:t}:{projectsDir:t}),onSuccess:t=>{l.setQueryData(E.config,t),e===`browseRoot`?l.invalidateQueries({queryKey:E.fsBrowseRoot}):c&&l.invalidateQueries({queryKey:E.projects})}}),[d,f]=(0,q.useState)(t),p=d.trim(),m=p===t,h=u.isError?u.error.message:null;return(0,J.jsxs)(wl,{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,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.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,J.jsx)(M,{type:`button`,variant:`outline`,size:`sm`,"data-action":`projects-save-${a}-root`,disabled:m||p===``||u.isPending,onClick:()=>u.mutate(p,{onSuccess:()=>I(`${o} set to ${p}`)}),children:`Save`})]}),h===null?(0,J.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:s}):(0,J.jsxs)(`p`,{"data-slot":`projects-${a}-root-error`,role:`alert`,className:`text-[11px] text-danger`,children:[h,` — setting unchanged`]})]})}function jl({registry:e,workspaceMax:t}){let[n,r]=(0,q.useState)(null),i=mt();return(0,J.jsxs)(wl,{title:`Registered projects`,hint:`Every folder cezar has run in, plus the ones added from the GUI. “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,J.jsx)(`p`,{"data-slot":`projects-empty`,className:`text-[13px] text-soft-foreground`,children:`No projects registered yet.`}):(0,J.jsx)(`div`,{className:`overflow-x-auto rounded-md border border-border`,children:(0,J.jsxs)(`table`,{className:`w-full border-collapse text-sm`,children:[(0,J.jsx)(`caption`,{className:`sr-only`,children:`Projects registered in this workspace`}),(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{className:`border-b border-border text-left text-[12px] text-soft-foreground`,children:[(0,J.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Project`}),(0,J.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Status`}),(0,J.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Max parallel`}),(0,J.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Added`}),(0,J.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium text-right`,children:`Actions`})]})}),(0,J.jsx)(`tbody`,{children:e.projects.map(n=>(0,J.jsx)(Ml,{project:n,isBoot:n.id===e.bootProject,workspaceMax:t,disabled:i.isPending,onRemove:()=>r(n)},n.id))})]})}),(0,J.jsx)(ar,{open:n!==null,onOpenChange:e=>!e&&r(null),children:(0,J.jsxs)(er,{children:[(0,J.jsxs)(ir,{children:[(0,J.jsxs)($n,{children:[`Remove `,n?.name,` from the workspace?`]}),(0,J.jsxs)(Qn,{children:[`This only unregisters the project — `,(0,J.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,J.jsx)(`span`,{className:`mt-1 block truncate font-mono text-[11px] text-foreground`,title:n?.root,children:n?.root})]})]}),(0,J.jsxs)(nr,{children:[(0,J.jsx)(rr,{children:`Keep it`}),(0,J.jsx)(tr,{"data-action":`projects-confirm-remove`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{if(!n)return;let{id:e,name:t}=n;r(null),i.mutate(e,{onSuccess:()=>I(`${t} removed from the workspace — its files are untouched`),onError:e=>I(e.message,{tone:`danger`})})},children:`Remove from list`})]})]})})]})}function Ml({project:e,isBoot:t,workspaceMax:n,disabled:r,onRemove:i}){return(0,J.jsxs)(`tr`,{"data-slot":`project-row`,"data-project":e.id,className:`border-b border-border last:border-0`,children:[(0,J.jsxs)(`th`,{scope:`row`,className:`max-w-[260px] px-3 py-2 text-left font-normal`,children:[(0,J.jsx)(`span`,{className:`block truncate text-foreground`,children:e.name}),(0,J.jsx)(`span`,{className:`block truncate font-mono text-[11px] text-soft-foreground`,title:e.root,children:e.root})]}),(0,J.jsxs)(`td`,{className:`px-3 py-2`,children:[(0,J.jsx)(`span`,{"data-slot":`project-status`,className:e.status===`missing`?`text-[12px] text-danger`:`text-[12px] text-soft-foreground`,children:El[e.status]}),e.status===`missing`?null:(0,J.jsxs)(`span`,{className:`ml-1 text-[11px] text-soft-foreground`,children:[`· `,e.source]})]}),(0,J.jsx)(`td`,{className:`px-3 py-2`,children:(0,J.jsx)(Nl,{project:e,workspaceMax:n})}),(0,J.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:Dl(e.addedAt)}),(0,J.jsx)(`td`,{className:`px-3 py-2 text-right`,children:(0,J.jsx)(M,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`project-remove`,"aria-label":`Unregister ${e.name} (no files are deleted)`,title:t?`cezar is serving this project — it re-registers itself at every start`:void 0,disabled:r||t,onClick:i,children:`Remove`})})]})}function Nl({project:e,workspaceMax:t}){let n=p(),r=e.maxParallel===void 0?``:String(e.maxParallel);return(0,J.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:()=>I(a===null?`${e.name} inherits the workspace limit (${t})`:`${e.name} runs at most ${a} task${a===1?``:`s`} at a time`),onError:e=>I(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,J.jsxs)(`option`,{value:``,children:[`Inherit workspace (`,t,`)`]}),Array.from({length:16},(e,t)=>t+Tl).map(e=>(0,J.jsx)(`option`,{value:e,children:e},e))]})}function Pl(){let e=xe();return e.isPending?(0,J.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,J.jsx)(z,{icon:(0,J.jsx)(Bi,{}),tone:`danger`,title:`Prompt templates did not load`,subtitle:e.error.message,heading:`h2`}):(0,J.jsx)(Fl,{initial:kn(e.data.promptTemplates)})}function Fl({initial:e}){let t=P(),n=kt(),r=xe(),[i,a]=(0,q.useState)(e),[s,c]=(0,q.useState)(``),[l,u]=(0,q.useState)(``),d=L({mutationFn:e=>ge({promptTemplates:e}),onSuccess:e=>{t.setQueryData(o.uiState,e),I(`Prompt templates saved`)},onError:e=>I(e.message,{tone:`danger`})}),f=JSON.stringify(i)!==JSON.stringify(e),p=i.some(e=>e.label.trim()===``||e.text.trim()===``),m=(e,t)=>a(n=>n.map(n=>n.id===e?{...n,...t}:n)),h=(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})),g=e=>a(t=>t.filter(t=>t.id!==e));return(0,J.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,J.jsxs)(Ll,{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,J.jsx)(`div`,{"data-slot":`prompt-template-list`,className:`flex flex-col gap-3`,children:i.length===0?(0,J.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,J.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,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(_a,{"aria-label":`Label for ${e.label||`this template`}`,"data-slot":`prompt-template-label-input`,value:e.label,maxLength:80,onChange:t=>m(e.id,{label:t.target.value}),className:`flex-1`}),(0,J.jsx)(M,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`prompt-template-remove`,title:`Remove this template`,onClick:()=>g(e.id),children:(0,J.jsx)(Xn,{"aria-hidden":`true`,className:`size-3.5`})})]}),(0,J.jsx)(Zn,{"aria-label":`Text for ${e.label||`this template`}`,"data-slot":`prompt-template-text-input`,value:e.text,maxLength:2e3,onChange:t=>m(e.id,{text:t.target.value}),className:`min-h-14 text-[13px]`}),(0,J.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-1.5`,children:[(0,J.jsx)(Il,{label:e.label,skills:n.data??[],skillUsage:r.data?.skillUsage,selected:e.skills??[],onToggle:t=>h(e.id,t)}),(e.skills??[]).map(t=>(0,J.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-skill-chip`,"data-skill":t,title:`Stop applying “${e.label}” automatically with ${t}`,onClick:()=>h(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,J.jsx)(Xn,{"aria-hidden":`true`,className:`size-3`})]},t))]})]},e.id))}),(0,J.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,J.jsx)(_a,{"aria-label":`New template label`,"data-slot":`prompt-template-new-label`,placeholder:`Label (e.g. "Add tests")`,value:s,maxLength:80,onChange:e=>c(e.target.value)}),(0,J.jsx)(Zn,{"aria-label":`New template text`,"data-slot":`prompt-template-new-text`,placeholder:`The instructions to insert…`,value:l,maxLength:2e3,onChange:e=>u(e.target.value),className:`min-h-14 text-[13px]`}),(0,J.jsxs)(M,{type:`button`,variant:`outline`,size:`sm`,"data-action":`prompt-template-add`,disabled:!s.trim()||!l.trim(),onClick:()=>{let e=s.trim(),t=l.trim();!e||!t||(a(n=>[...n,{id:Pn(),label:e,text:t}]),c(``),u(``))},className:`self-start`,children:[(0,J.jsx)(Ui,{"aria-hidden":`true`,className:`size-3.5`}),`Add template`]})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,J.jsx)(M,{type:`button`,variant:`contrast`,size:`sm`,"data-action":`prompt-templates-save`,disabled:!f||p||d.isPending,onClick:()=>d.mutate(i),children:`Save`}),(0,J.jsx)(M,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`prompt-templates-reset`,disabled:d.isPending,onClick:()=>a(Hn.map(e=>({...e}))),children:`Reset to defaults`}),p?(0,J.jsx)(`p`,{"data-slot":`prompt-templates-invalid`,className:`text-[11px] text-danger`,children:`Every template needs both a label and text.`}):null]})]})})}function Il({label:e,skills:t,skillUsage:n,selected:r,onToggle:i}){let[a,o]=(0,q.useState)(!1),[s,c]=(0,q.useState)(``),l=(0,q.useRef)(null),{mostUsed:u,project:d,global:f}=jr(Pr(t,s,n),n),p=(e,t)=>{let n=r.includes(e.name);return(0,J.jsxs)(U,{value:`skill ${e.name} ${e.path}`,keywords:Mr(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,J.jsx)(`span`,{className:V(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,n?(0,J.jsx)(tt,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]},e.path)};return(0,J.jsxs)(Vn,{open:a,onOpenChange:e=>{o(e),e||c(``)},children:[(0,J.jsx)(Un,{asChild:!0,children:(0,J.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:V(`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,J.jsx)(Jn,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),t.length===0?`no skills found`:`apply with…`,(0,J.jsx)(cn,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,J.jsx)(Fn,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,J.jsxs)(Mn,{shouldFilter:!1,children:[(0,J.jsx)(An,{placeholder:`search skills…`,value:s,onValueChange:c,onInput:()=>l.current?.scrollTo(0,0)}),(0,J.jsxs)(En,{ref:l,"data-slot":`prompt-template-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[u.length===0&&d.length===0&&f.length===0?(0,J.jsx)(Wn,{children:`Nothing matches.`}):null,u.length>0?(0,J.jsx)(W,{heading:`Most used`,children:u.map(e=>p(e,Nr(e)))}):null,d.length>0?(0,J.jsx)(W,{heading:`Project skills`,children:d.map(e=>p(e,!0))}):null,f.length>0?(0,J.jsx)(W,{heading:`Global`,children:f.map(e=>p(e,!1))}):null]})]})})]})}function Ll({title:e,hint:t,children:n}){return(0,J.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,J.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}var Rl=1,zl=1,Bl=60,Vl=256;function Hl(){let e=Ce();return e.isPending?(0,J.jsx)(`p`,{"data-slot":`resources-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading resource settings…`}):e.isError?(0,J.jsx)(z,{icon:(0,J.jsx)(ji,{}),tone:`danger`,title:`Resource settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,J.jsx)(Ul,{config:e.data})}function Ul({config:e}){let t=P(),n=L({mutationFn:e=>b(e),onSuccess:e=>t.setQueryData(E.config,e),onError:e=>I(e.message,{tone:`danger`})}),[r,i]=(0,q.useState)(e.resources.memoryLimitMb?String(e.resources.memoryLimitMb):``),a=e.resources.monitoringWakeIntervalMinutes??null,[o,s]=(0,q.useState)(a===null?`park`:`interval`),[c,l]=(0,q.useState)(String(a??5)),u=Number(c),d=!Number.isInteger(u)||u<zl||u>Bl,f=o===`park`?a===null:!d&&a===u,p=()=>n.mutate({resources:{monitoringWakeIntervalMinutes:o===`park`?null:u}},{onSuccess:()=>I(o===`park`?`Monitoring will stay parked`:`Monitoring will re-check every ${u} minutes`)}),m=r.trim()===``?0:Number(r),h=r.trim()!==``&&(!Number.isInteger(m)||m<Vl),g=(e.resources.memoryLimitMb??0)===(h?-1:m),_=()=>n.mutate({resources:{memoryLimitMb:m===0?null:m}},{onSuccess:()=>I(m===0?`Memory limit cleared`:`Memory limit set to ${m} MiB`)}),v=e.composerDefaults??{autonomous:null,worktree:null,inheritedAutonomous:`source-dependent`,inheritedWorktree:!0},y=(e,t)=>n.mutate({composerDefaults:{[e]:t===`inherit`?null:t===`on`}});return(0,J.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,J.jsxs)(wl,{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,J.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+Rl).map(e=>(0,J.jsx)(`option`,{value:e,children:e},e))}),(0,J.jsxs)(`p`,{className:`text-[11px] text-soft-foreground`,children:[`Need a different limit for one project?`,` `,(0,J.jsx)(ve,{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,J.jsxs)(wl,{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,J.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,J.jsx)(`option`,{value:t,children:t},t))}),(0,J.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,J.jsxs)(wl,{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,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.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,J.jsx)(`option`,{value:`park`,children:`Park until resumed`}),(0,J.jsx)(`option`,{value:`interval`,children:`Re-check on an interval`})]}),o===`interval`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`input`,{type:`number`,min:zl,max:Bl,"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,J.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`minutes`})]}):null,(0,J.jsx)(M,{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,J.jsx)(`p`,{"data-slot":`resources-monitoring-wake-invalid`,className:`text-[11px] text-danger`,children:`Enter a whole number from 1 to 60 minutes.`}):(0,J.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Applied consistently to Claude, Codex and OpenCode.`})]}),(0,J.jsxs)(wl,{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,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:Vl,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,J.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`MiB`}),(0,J.jsx)(M,{type:`button`,variant:`outline`,size:`sm`,"data-action":`resources-save-memory`,disabled:g||h||n.isPending,onClick:_,children:`Save`})]}),h?(0,J.jsxs)(`p`,{"data-slot":`resources-memory-invalid`,className:`text-[11px] text-danger`,children:[`Enter a whole number of at least `,Vl,` MiB, or leave empty for no limit.`]}):(0,J.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Applies to newly started tasks.`})]}),(0,J.jsxs)(wl,{title:`New task defaults`,hint:`Set stable composer defaults across projects. Explicit choices and run-shape constraints still win.`,children:[(0,J.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,"data-slot":`resources-composer-defaults`,children:[(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium`,children:`Autonomous by default`}),(0,J.jsxs)(`select`,{"aria-label":`Autonomous by default`,value:v.autonomous===null?`inherit`:v.autonomous?`on`:`off`,disabled:n.isPending,onChange:e=>y(`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,J.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,J.jsx)(`option`,{value:`on`,children:`On`}),(0,J.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,J.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[`Inherited: `,v.inheritedAutonomous===`source-dependent`?`Source-dependent — skills on, workflows off`:v.inheritedAutonomous?`On`:`Off`]})]}),(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium`,children:`Use a worktree by default`}),(0,J.jsxs)(`select`,{"aria-label":`Use a worktree by default`,value:v.worktree===null?`inherit`:v.worktree?`on`:`off`,disabled:n.isPending,onChange:e=>y(`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,J.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,J.jsx)(`option`,{value:`on`,children:`On`}),(0,J.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,J.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[`Inherited: `,v.inheritedWorktree?`On`:`Off`]})]})]}),(0,J.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Interactive skills may recommend both off. Multi-step and parallel runs remain isolated.`})]})]})}function Wl(){let e=Ce(),t=D().data?.bootProject??``,n=ze(t,!!t);return e.isPending?(0,J.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,J.jsx)(z,{icon:(0,J.jsx)(Vi,{}),tone:`danger`,title:`Skill settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,J.jsx)(Gl,{config:e.data,update:n.data,updateError:n.error})}function Gl({config:e,update:t,updateError:n}){let r=P(),i=L({mutationFn:e=>b(e),onSuccess:e=>r.setQueryData(E.config,e),onError:e=>I(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,J.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,J.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:(0,J.jsx)(`label`,{htmlFor:`skills-auto-update`,children:`Update Open Mercato skills automatically`})}),(0,J.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,J.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-1`,children:[(0,J.jsx)(Pc,{id:`skills-auto-update`,"data-slot":`skills-auto-update`,checked:e.effectiveSkillsAutoUpdate,disabled:i.isPending,onCheckedChange:e=>i.mutate({skillsAutoUpdate:e})}),(0,J.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[e.effectiveSkillsAutoUpdate?`On`:`Off`,a?` (default)`:``]})]})]}),(0,J.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,J.jsx)(`span`,{children:a?`No override is saved. CEZ_SKILLS_AUTO_UPDATE supplies the inherited default when set; otherwise it is on.`:`An explicit workspace override is saved.`}),(0,J.jsx)(M,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`skills-use-default`,disabled:a||i.isPending,onClick:()=>i.mutate({skillsAutoUpdate:null}),children:`Use default`})]}),(0,J.jsx)(`p`,{"data-slot":`skills-installation-status`,role:n||t?.status===`unavailable`?`status`:void 0,className:`text-[13px] text-soft-foreground`,children:o})]})})}function Kl(){let e=g(),t=P(),[n,r]=(0,q.useState)(null),i=()=>t.invalidateQueries({queryKey:o.worktrees}),a=L({mutationFn:()=>C(),onSuccess:e=>{i(),I(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=>I(e.message,{tone:`danger`})}),s=L({mutationFn:e=>At(e),onSuccess:()=>{i(),I(`Worktree removed`)},onError:e=>I(e.message,{tone:`danger`})});if(e.isPending)return(0,J.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading worktrees…`});if(e.isError)return(0,J.jsxs)(`p`,{"data-slot":`worktrees-error`,className:`text-[13px] text-danger`,children:[`Worktrees did not load: `,e.error.message]});let{worktrees:c,totalBytes:l,keep:u}=e.data,d=a.isPending||s.isPending;return(0,J.jsxs)(`div`,{"data-slot":`worktrees-panel`,className:`flex flex-col gap-3`,children:[c.length===0?(0,J.jsx)(`p`,{"data-slot":`worktrees-empty`,className:`text-[13px] text-soft-foreground`,children:`No task worktrees on disk.`}):(0,J.jsx)(`div`,{className:`overflow-x-auto rounded-md border border-border`,children:(0,J.jsxs)(`table`,{className:`w-full border-collapse text-sm`,children:[(0,J.jsx)(`caption`,{className:`sr-only`,children:`Task worktrees currently materialized on disk`}),(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{className:`border-b border-border text-left text-[12px] text-soft-foreground`,children:[(0,J.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Task`}),(0,J.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Status`}),(0,J.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Size`}),(0,J.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Age`}),(0,J.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium text-right`,children:`Actions`})]})}),(0,J.jsx)(`tbody`,{children:c.map(e=>(0,J.jsx)(ql,{worktree:e,disabled:d,onDelete:()=>r({kind:`delete`,runId:e.runId,title:e.title})},e.runId))})]})}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsxs)(`p`,{"data-slot":`worktrees-footer`,className:`text-[12px] text-soft-foreground`,children:[c.length,` worktree`,c.length===1?``:`s`,l===null?` · size unavailable`:` · ${_e(l)||`0 kB`} on disk`,` · `,u===0?`keeping all (unlimited)`:`keeping the last ${u}`]}),(0,J.jsx)(M,{type:`button`,variant:`outline`,size:`sm`,"data-action":`worktrees-reclaim-now`,disabled:d,onClick:()=>r({kind:`reclaim`}),children:`Reclaim now`})]}),(0,J.jsx)(ar,{open:n!==null,onOpenChange:e=>!e&&r(null),children:(0,J.jsxs)(er,{children:[(0,J.jsxs)(ir,{children:[(0,J.jsx)($n,{children:n?.kind===`delete`?`Delete this worktree?`:`Reclaim old worktrees?`}),(0,J.jsx)(Qn,{children:n?.kind===`delete`?(0,J.jsxs)(J.Fragment,{children:[`This removes the worktree directory and its branch — the local-only work is not recoverable afterwards.`,(0,J.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,J.jsxs)(nr,{children:[(0,J.jsx)(rr,{children:`Keep it`}),(0,J.jsx)(tr,{"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`&&s.mutate(n.runId),r(null)},children:n?.kind===`delete`?`Delete`:`Reclaim now`})]})]})})]})}function ql({worktree:e,disabled:t,onDelete:n}){return(0,J.jsxs)(`tr`,{"data-slot":`worktree-row`,"data-run":e.runId,className:`border-b border-border last:border-0`,children:[(0,J.jsxs)(`th`,{scope:`row`,className:`max-w-[220px] px-3 py-2 text-left font-normal`,children:[(0,J.jsx)(`span`,{className:`block truncate text-foreground`,title:e.title,children:e.title}),(0,J.jsx)(`span`,{className:`block truncate font-mono text-[11px] text-soft-foreground`,children:e.branch??e.runId.slice(0,8)})]}),(0,J.jsxs)(`td`,{className:`px-3 py-2`,children:[(0,J.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:e.status}),e.reclaimable?(0,J.jsx)(`span`,{"data-slot":`worktree-reclaimable`,className:`ml-1 text-[11px] text-soft-foreground`,children:`(reclaimable)`}):null]}),(0,J.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:e.sizeBytes===null?`—`:_e(e.sizeBytes)||`0 kB`}),(0,J.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:Or(e.finishedAt??void 0)||`—`}),(0,J.jsx)(`td`,{className:`px-3 py-2 text-right`,children:(0,J.jsx)(M,{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 Jl=0,Yl=1e3;function Xl(){let e=he();return e.isPending?(0,J.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading worktree settings…`}):e.isError?(0,J.jsx)(z,{icon:(0,J.jsx)(Di,{}),tone:`danger`,title:`Worktree settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,J.jsx)(Zl,{config:e.data})}function Zl({config:e}){let t=P(),n=L({mutationFn:e=>pe(e),onSuccess:e=>t.setQueryData(o.config,e),onError:e=>I(e.message,{tone:`danger`})}),[r,i]=(0,q.useState)(String(e.worktreeRetention)),a=Number(r),s=r.trim()===``||!Number.isInteger(a)||a<Jl||a>Yl,c=e.worktreeRetention===(s?-1:a);return(0,J.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,J.jsxs)(wl,{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,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:Jl,max:Yl,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,J.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`worktrees`}),(0,J.jsx)(M,{type:`button`,variant:`outline`,size:`sm`,"data-action":`resources-save-retention`,disabled:c||s||n.isPending,onClick:()=>n.mutate({worktreeRetention:a},{onSuccess:()=>{t.invalidateQueries({queryKey:o.worktrees}),I(a===0?`Keeping all worktrees (unlimited)`:`Keeping the last ${a} finished worktree${a===1?``:`s`}`)}}),children:`Save`})]}),s?(0,J.jsxs)(`p`,{"data-slot":`resources-retention-invalid`,className:`text-[11px] text-danger`,children:[`Enter a whole number from `,Jl,` to `,Yl,` (0 = unlimited).`]}):(0,J.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,J.jsx)(wl,{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,J.jsx)(Kl,{})})]})}function Ql(e,t){return function(){return(0,J.jsx)(z,{icon:(0,J.jsx)(t,{}),tone:`neutral`,title:e,subtitle:`This section arrives in a later phase of the redesign.`,heading:`h2`})}}var $l=[{id:`agents`,title:`Agents`,description:`Default runner, models and system prompt.`,icon:It,component:Vc,scope:`project`},{id:`agent-config`,title:`Agent config`,description:`Edit the coding agents’ own config files, per scope.`,icon:Ei,component:kc,scope:`project`},{id:`worktrees`,title:`Worktrees`,description:`How many finished task worktrees this project keeps on disk.`,icon:Di,component:Xl,scope:`project`},{id:`bookmarklets`,title:`Bookmarklets`,description:`Launch skills from a GitHub PR or issue.`,icon:xi,component:hl,scope:`project`},{id:`prompt-templates`,title:`Prompt templates`,description:`Reusable snippets for follow-up instructions.`,icon:Bi,component:Pl,scope:`project`},{id:`appearance`,title:`Appearance`,description:`Theme, accent and density.`,icon:Hi,component:fl,scope:`global`},{id:`notifications`,title:`Notifications`,description:`Browser notifications when an agent needs you.`,icon:bi,component:Cl,scope:`global`},{id:`resources`,title:`Resources`,description:`Parallel tasks and per-task memory limit, across every project.`,icon:ji,component:Hl,scope:`global`},{id:`skills`,title:`Skills`,description:`Updates for skills installed on this machine.`,icon:Vi,component:Wl,scope:`global`},{id:`projects`,title:`Projects`,description:`The workspace registry and where GitHub checkouts land.`,icon:Ai,component:Ol,scope:`global`},{id:`keyboard`,title:`Keyboard`,description:`Shortcuts.`,icon:Fi,component:Ql(`Keyboard`,Fi),scope:`global`,hidden:!0}];function eu(e,t){return $l.filter(n=>!n.hidden&&n.scope===e&&!(t?.singleProject===!0&&n.id===`projects`))}function tu(e,t){return e===`global`?`/settings/global/${t}`:`/settings/${t}`}function nu(e){return e===`global`?`/settings/global`:`/settings`}function ru(e){return e===`global`?{Link:ve,NavLink:a}:{Link:G,NavLink:vr}}function iu({scope:e,activeId:t,capabilities:n}){let{NavLink:r}=ru(e);return(0,J.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:[eu(e,n).map(n=>(0,J.jsxs)(r,{to:tu(e,n.id),"data-section":n.id,"aria-current":n.id===t?`page`:void 0,className:V(`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,J.jsx)(n.icon,{"aria-hidden":`true`,className:`size-4 shrink-0`}),n.title]},n.id)),e===`global`?(0,J.jsx)(`p`,{className:`mt-auto px-2.5 pt-3 text-[11px] text-soft-foreground`,children:`Stored in ~/.cezar`}):null]})}function au({scope:e,activeId:t,capabilities:n}){let{NavLink:r}=ru(e);return(0,J.jsx)(`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:eu(e,n).map(n=>(0,J.jsx)(r,{to:tu(e,n.id),"data-section":n.id,"aria-current":n.id===t?`page`:void 0,className:V(`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 ou({section:e,scope:t,capabilities:n}){let r=e.component;return(0,J.jsxs)(`div`,{"data-route":t===`global`?`settings-global-${e.id}`:`settings-${e.id}`,className:`flex min-h-full flex-col`,children:[(0,J.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,J.jsx)(`h1`,{className:`text-base font-semibold`,children:e.title}),(0,J.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:e.description}),t===`global`?(0,J.jsx)(`span`,{"data-slot":`settings-scope-chip`,className:`ml-auto text-[11px] text-soft-foreground`,children:`Global settings`}):null]}),(0,J.jsxs)(`div`,{className:`flex flex-1 flex-col md:flex-row`,children:[(0,J.jsx)(iu,{scope:t,activeId:e.id,capabilities:n}),(0,J.jsx)(au,{scope:t,activeId:e.id,capabilities:n}),(0,J.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:(0,J.jsx)(r,{})})]})]})}function su({scope:e,capabilities:t}){let{Link:n}=ru(e),r=e===`global`;return(0,J.jsxs)(`div`,{"data-route":r?`settings-global`:`settings`,className:`flex min-h-full flex-col`,children:[(0,J.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,J.jsx)(`h1`,{className:`text-base font-semibold`,children:r?`Global settings`:`Settings`}),(0,J.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,J.jsxs)(`div`,{className:`flex flex-1 flex-col md:flex-row`,children:[(0,J.jsx)(iu,{scope:e,activeId:null,capabilities:t}),(0,J.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:[(0,J.jsx)(`ul`,{"data-slot":`settings-index`,className:`mx-auto flex w-full max-w-2xl flex-col gap-2.5`,children:eu(e,t).map(t=>(0,J.jsx)(`li`,{children:(0,J.jsxs)(n,{to:tu(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,J.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-md border border-border bg-muted text-muted-foreground`,children:(0,J.jsx)(t.icon,{"aria-hidden":`true`,className:`size-4`})}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:t.title}),(0,J.jsx)(`span`,{className:`block text-xs text-soft-foreground`,children:t.description})]}),(0,J.jsx)(gn,{"aria-hidden":`true`,className:`size-4 shrink-0 text-soft-foreground`})]})},t.id))}),(0,J.jsx)(`p`,{className:`mx-auto mt-4 w-full max-w-2xl text-[12px] text-soft-foreground`,children:r?(0,J.jsx)(J.Fragment,{children:`Agents, worktrees, bookmarklets and prompt templates are per project.`}):(0,J.jsxs)(J.Fragment,{children:[`Appearance, notifications, host resources and the project registry live in`,` `,(0,J.jsx)(ve,{to:nu(`global`),"data-slot":`settings-global-link`,className:`underline underline-offset-2 hover:text-foreground`,children:`Global settings`}),`.`]})})]})]})]})}function cu({runs:e,view:t,onViewChange:n,onArchiveFinished:r,onMarkAllRead:i,onRename:a,now:o=Date.now(),showTokens:c=!0,showCost:l=!0}){let[u,d]=q.useState(``),f=e??[],p=Oe(f),m=dt(et(f,u),t),h=ne(f),g=s(et(f,u),t),_=fe(f),v=Xt(f);return(0,J.jsxs)(`div`,{"data-route":`tasks`,className:`flex min-h-full flex-col`,children:[(0,J.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,J.jsx)(`h1`,{className:`text-base font-semibold`,children:`Tasks`}),(0,J.jsxs)(`div`,{className:`inline-flex gap-0.5 rounded-md bg-muted p-[3px]`,children:[(0,J.jsx)(uu,{view:`active`,current:t,onSelect:n,count:p.active,children:`Active`}),(0,J.jsx)(uu,{view:`archived`,current:t,onSelect:n,count:p.archived,children:`Archived`})]}),(0,J.jsx)(`div`,{className:`flex-1`}),v>0?(0,J.jsxs)(M,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`mark-all-read`,onClick:i,children:[(0,J.jsx)(Si,{className:`size-3.5`,"aria-hidden":`true`}),`Mark all read`]}):null,t===`active`&&_>0?(0,J.jsxs)(M,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`archive-finished`,onClick:r,children:[(0,J.jsx)(zt,{className:`size-3.5`,"aria-hidden":`true`}),`Archive finished`]}):null,(0,J.jsxs)(`div`,{className:`relative w-60`,children:[(0,J.jsx)(Dn,{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,J.jsx)(`input`,{type:`text`,value:u,onChange:e=>d(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,J.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:m.length===0?(0,J.jsx)(lu,{view:t,query:u}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{"data-slot":`tasks-table`,className:`hidden overflow-x-auto rounded-lg border border-border bg-card shadow-xs md:block`,children:(0,J.jsxs)(`table`,{className:`w-full min-w-[1040px] border-collapse`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(Q,{children:`Status`}),(0,J.jsx)(Q,{children:`Task`}),(0,J.jsx)(Q,{children:`Workflow`}),(0,J.jsx)(Q,{children:`Branch`}),(0,J.jsx)(Q,{children:`±`}),(0,J.jsx)(Q,{children:`Ref`}),c?(0,J.jsx)(Q,{right:!0,children:`IN / OUT`}):null,l?(0,J.jsx)(Q,{right:!0,children:`Cost`}):null,(0,J.jsx)(Q,{right:!0,children:`CPU`}),(0,J.jsx)(Q,{right:!0,children:`Mem`}),(0,J.jsx)(Q,{right:!0,children:`Started`})]})}),(0,J.jsx)(`tbody`,{className:`[&>tr:last-child>td]:border-b-0`,children:m.map(e=>(0,J.jsx)(du,{run:e,queuePosition:e.status===`queued`?h.get(e.id)??null:null,onRename:a,now:o,showTokens:c,showCost:l},e.id))})]})}),(0,J.jsx)(`div`,{"data-slot":`task-cards`,className:`flex flex-col gap-2.5 md:hidden`,children:m.map(e=>(0,J.jsx)(hu,{run:e,queuePosition:e.status===`queued`?h.get(e.id)??null:null,now:o,showTokens:c,showCost:l},e.id))})]}),g.map(e=>(0,J.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,J.jsx)(Wi,{className:`size-[15px] shrink-0 text-soft-foreground`,"aria-hidden":`true`}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`strong`,{className:`font-semibold text-foreground`,children:e.title}),` — `,e.count,` variants finished`]}),(0,J.jsx)(M,{asChild:!0,variant:`outline`,size:`sm`,className:`md:ml-auto`,children:(0,J.jsx)(G,{to:`/compare/${e.groupId}`,children:`Compare`})})]},e.groupId))]}),(0,J.jsx)(G,{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,J.jsx)(Ui,{className:`size-[22px]`,"aria-hidden":`true`})})]})}function lu({view:e,query:t}){let n=t.trim(),r=n?`search-miss`:e===`archived`?`archive`:`no-tasks`;return(0,J.jsx)(`div`,{"data-slot":`tasks-empty`,"data-empty-kind":r,className:`flex flex-1 flex-col`,children:r===`search-miss`?(0,J.jsx)(z,{heading:`h2`,icon:(0,J.jsx)(qn,{}),tone:`neutral`,title:`No matching tasks`,subtitle:`No tasks match “${n}”.`}):r===`archive`?(0,J.jsx)(z,{heading:`h2`,icon:(0,J.jsx)(zt,{}),tone:`neutral`,title:`Nothing archived yet`,subtitle:`Finished tasks you archive land here.`}):(0,J.jsx)(z,{heading:`h2`,icon:(0,J.jsx)(Ii,{}),tone:`primary`,backdrop:!0,title:`No tasks yet`,subtitle:`Describe a task to get started.`,actions:(0,J.jsx)(M,{asChild:!0,children:(0,J.jsxs)(G,{to:`/new`,children:[(0,J.jsx)(Ui,{"aria-hidden":`true`}),`New task`]})})})})}function uu({view:e,current:t,onSelect:n,count:r,children:i}){let a=e===t;return(0,J.jsxs)(`button`,{type:`button`,"data-slot":`overview-tab`,"data-view":e,"aria-pressed":a,onClick:()=>n(e),className:V(`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,J.jsx)(`span`,{className:`font-mono text-[11px] tabular-nums`,children:r}):null]})}function Q({children:e,right:t=!1}){return(0,J.jsx)(`th`,{className:V(`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`),children:e})}var $=`h-11 border-b border-border px-2.5 whitespace-nowrap first:pl-4 last:pr-4`;function du({run:e,queuePosition:t,onRename:n,now:r,showTokens:i,showCost:a}){let o=hr(),s=Sr(e),c=`/tasks/${e.id}`,u=T(e.costUsd),d=be(e);return(0,J.jsxs)(`tr`,{"data-slot":`task-table-row`,"data-run-id":e.id,onClick:e=>{e.target.closest(`a, button, input`)||o(c)},className:`group/row cursor-pointer hover:bg-muted`,children:[(0,J.jsx)(`td`,{className:$,children:(0,J.jsx)(Dr,{dot:s.tone,pulse:s.pulse,children:s.label})}),(0,J.jsx)(`td`,{className:V($,`w-[34%] max-w-0`),children:(0,J.jsx)(fu,{run:e,to:c,onRename:n})}),(0,J.jsx)(`td`,{className:V($,`text-[12.5px] text-muted-foreground`),children:l(e)}),(0,J.jsx)(`td`,{className:$,children:e.branch?(0,J.jsx)(vu,{branch:e.branch}):(0,J.jsx)(gu,{})}),(0,J.jsx)(`td`,{className:$,children:e.diffStat?(0,J.jsx)(zr,{stat:e.diffStat}):(0,J.jsx)(gu,{})}),(0,J.jsx)(`td`,{className:$,children:d?(0,J.jsx)(Bt,{reference:d,taskTitle:S(e)}):(0,J.jsx)(gu,{})}),i?(0,J.jsx)(`td`,{className:V($,`text-right text-xs text-muted-foreground`),children:(0,J.jsx)(Er,{inputTokens:e.inputTokens,outputTokens:e.outputTokens,variant:`table`,omitWhenUnknown:!1})}):null,a?(0,J.jsx)(`td`,{className:V($,`text-right font-mono text-xs text-muted-foreground tabular-nums`),children:u||(0,J.jsx)(gu,{})}):null,t===null?(0,J.jsx)(pu,{run:e}):(0,J.jsxs)(`td`,{"data-slot":`queue-note`,colSpan:2,className:V($,`text-right font-mono text-[11.5px] text-soft-foreground`),children:[`#`,t,` in queue`]}),(0,J.jsx)(`td`,{className:V($,`text-right text-xs text-soft-foreground tabular-nums`),children:Or(e.startedAt??e.createdAt,r)})]})}function fu({run:e,to:t,onRename:n}){let r=S(e),i=Rt(r,t=>n(e.id,t)),a=Ut(e),o=Kt(e);return i.editing?(0,J.jsx)(Vt,{editor:i,className:`text-[13px] font-medium`}):(0,J.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,J.jsx)(G,{to:t,title:r,className:V(`min-w-0 truncate text-[13px]`,a?`font-semibold text-foreground`:o?`font-medium text-muted-foreground`:`font-medium`),children:r}),a?(0,J.jsx)(K,{tone:`violet`,role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,className:`shrink-0`}):null,(0,J.jsx)(`button`,{type:`button`,"data-slot":`row-rename`,"aria-label":`Rename task`,onClick:i.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,J.jsx)(Lt,{className:`size-3`,"aria-hidden":`true`})})]})}function pu({run:e}){let t=jt(e,hi(e.id));return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(mu,{column:`cpu`,cell:t.cpu}),(0,J.jsx)(mu,{column:`mem`,cell:t.mem})]})}function mu({column:e,cell:t}){return(0,J.jsx)(`td`,{"data-usage":e,"data-usage-kind":t.kind,title:t.title,className:V($,`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 hu({run:e,queuePosition:t,now:n,showTokens:r,showCost:i}){let a=hr(),o=Sr(e),s=`/tasks/${e.id}`,c=be(e),u=Ut(e),d=Kt(e),f=T(e.costUsd),p=e.inputTokens!==void 0||e.outputTokens!==void 0;return(0,J.jsxs)(`div`,{"data-slot":`task-card`,"data-run-id":e.id,onClick:e=>{e.target.closest(`a`)||a(s)},className:`cursor-pointer rounded-lg border border-border bg-card px-3.5 py-3 shadow-xs`,children:[(0,J.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,J.jsx)(Dr,{dot:o.tone,pulse:o.pulse,className:`mt-px shrink-0`,children:o.label}),(0,J.jsx)(G,{to:s,className:V(`min-w-0 flex-1 text-[13.5px] leading-[1.35]`,u?`font-semibold text-foreground`:d?`font-medium text-muted-foreground`:`font-medium`),children:S(e)}),u?(0,J.jsx)(K,{tone:`violet`,role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,className:`mt-1.5 shrink-0`}):null,(0,J.jsx)(`span`,{className:`mt-0.5 shrink-0 text-[11.5px] text-soft-foreground tabular-nums`,children:Or(e.finishedAt??e.createdAt,n)})]}),(0,J.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,J.jsx)(`span`,{children:l(e)}),t===null?(0,J.jsxs)(J.Fragment,{children:[e.branch?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(_u,{}),(0,J.jsx)(`span`,{children:e.branch})]}):null,e.diffStat?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(_u,{}),(0,J.jsx)(zr,{stat:e.diffStat,className:`text-[11.5px]`})]}):null,r&&p?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(_u,{}),(0,J.jsx)(Er,{inputTokens:e.inputTokens,outputTokens:e.outputTokens})]}):null,i&&f?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(_u,{}),(0,J.jsx)(`span`,{children:f})]}):null]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(_u,{}),(0,J.jsxs)(`span`,{"data-slot":`queue-note`,children:[`#`,t,` in queue`]})]}),c?(0,J.jsx)(Bt,{reference:c,taskTitle:S(e),className:`h-5`}):null]})]})}function gu(){return(0,J.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`—`})}function _u(){return(0,J.jsx)(`span`,{className:`text-soft-foreground`,"aria-hidden":`true`,children:`·`})}function vu({branch:e}){return(0,J.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 yu(){let e=Fe(),t=wr(k().data),[n,r]=_o(),i=P(),a=L({mutationFn:ye,onSuccess:()=>i.invalidateQueries({queryKey:o.runs.all})}),s=L({mutationFn:d,onSuccess:()=>i.invalidateQueries({queryKey:o.runs.all}),onError:e=>I(e.message,{tone:`danger`})}),c=L({mutationFn:({id:e,title:t})=>nt(e,{title:t}),onSuccess:()=>i.invalidateQueries({queryKey:o.runs.all}),onError:e=>I(e.message,{tone:`danger`})}),l=Qt(3e4);return(0,J.jsx)(cu,{runs:e.data,view:n,onViewChange:r,onArchiveFinished:()=>a.mutate(),onMarkAllRead:()=>s.mutate(),onRename:(e,t)=>c.mutate({id:e,title:t}),now:l,showTokens:t.tokens,showCost:t.cost})}function bu({mode:e=`list`}){let{automationId:t}=ht(),n=hr(),r=xr(),[i,a]=(0,q.useState)(),[o,s]=(0,q.useState)(``),[c,l]=(0,q.useState)({}),u=()=>Ke().then(a).catch(e=>s(String(e)));if((0,q.useEffect)(()=>{u()},[]),(0,q.useEffect)(()=>ci((e,t)=>{if(e!==`automation-change`)return;let n=t;typeof n.project==`string`&&(r===null||n.project===r)&&u()}),[r]),e===`new`)return(0,J.jsx)(Su,{onSaved:()=>{n(`/automations`),u()}});if(e===`edit`){let e=i?.automations.find(e=>e.id===t);return e?(0,J.jsx)(Su,{automation:e,onSaved:()=>{n(`/automations`),u()}}):(0,J.jsx)(wu,{text:`Loading automation…`})}if(e===`log`){let e=i?.automations.find(e=>e.id===t);return t?(0,J.jsx)(xu,{automationId:t,automationName:e?.name}):(0,J.jsx)(wu,{text:`Automation not found.`})}let d=async e=>{l(t=>({...t,[e.id]:`Checking…`}));try{let{checkId:t}=await gt(e.id,`preview`);for(let n=0;n<60;n+=1){let n=await rt(t);if(n.status===`complete`){l(t=>({...t,[e.id]:`${n.matches??0} match${n.matches===1?``:`es`} found; no tasks launched.`})),u();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,J.jsx)(Cu,{title:`Automations`,subtitle:`Checks run while cezar is open. No webhook or public URL required.`,action:(0,J.jsx)(M,{asChild:!0,children:(0,J.jsxs)(G,{to:`/automations/new`,children:[(0,J.jsx)(Ui,{}),`New automation`]})}),children:o?(0,J.jsx)(wu,{text:o}):i?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`mb-4 rounded-lg border bg-muted/30 px-4 py-3 text-sm`,children:[(0,J.jsxs)(`span`,{className:`font-medium`,children:[`GitHub `,i.available?`available`:`unavailable`]}),(0,J.jsxs)(`span`,{className:`text-muted-foreground`,children:[` · Scheduler `,i.scheduler.state,i.reason?` · ${i.reason}`:``]})]}),i.automations.length===0?(0,J.jsx)(wu,{text:`No automations yet. Create one paused, test its bounded filter, then enable it from a current-time baseline.`}):(0,J.jsx)(`div`,{className:`grid gap-3`,children:i.automations.map(e=>(0,J.jsxs)(`article`,{className:`rounded-xl border bg-card p-4`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`font-semibold`,children:e.name}),(0,J.jsxs)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:[e.events.join(`, `),` · every `,Math.round(e.intervalSeconds/60),` min`]})]}),(0,J.jsx)(`span`,{className:`rounded-full border px-2 py-1 text-xs`,children:e.enabled?`Enabled`:`Paused`})]}),(0,J.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,J.jsxs)(M,{size:`sm`,variant:`outline`,onClick:()=>void d(e),disabled:c[e.id]===`Checking…`,children:[(0,J.jsx)(dn,{}),`Test filter`]}),(0,J.jsx)(M,{size:`sm`,variant:`outline`,onClick:()=>void re(e.id,!e.enabled).then(u),children:e.enabled?`Pause`:`Enable`}),(0,J.jsx)(M,{size:`sm`,variant:`ghost`,asChild:!0,children:(0,J.jsx)(G,{to:`/automations/${e.id}`,children:`Edit`})}),(0,J.jsx)(M,{size:`sm`,variant:`ghost`,asChild:!0,children:(0,J.jsx)(G,{to:`/automations/${e.id}/log`,children:`View log`})})]}),c[e.id]&&(0,J.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,role:`status`,children:c[e.id]})]},e.id))})]}):(0,J.jsx)(wu,{text:`Loading automations…`})})}function xu({automationId:e,automationName:t}){let[n,r]=(0,q.useState)(),[i,a]=(0,q.useState)(``),o=()=>Je(e).then(({records:e})=>r(e)).catch(e=>a(String(e)));return(0,q.useEffect)(()=>{o()},[e]),(0,q.useEffect)(()=>ci((t,n)=>{t===`automation-change`&&n.automationId===e&&o()}),[e]),(0,J.jsx)(Cu,{title:`Execution log`,subtitle:t??`Automation activity`,action:(0,J.jsx)(M,{variant:`outline`,asChild:!0,children:(0,J.jsx)(G,{to:`/automations`,children:`Back to automations`})}),children:i?(0,J.jsx)(wu,{text:i}):n?n.length===0?(0,J.jsx)(wu,{text:`No checks have run yet.`}):(0,J.jsx)(`ol`,{className:`grid gap-3`,"aria-label":`Automation execution log`,children:n.map(e=>(0,J.jsxs)(`li`,{className:`rounded-xl border bg-card p-4`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`font-medium capitalize`,children:e.result.replace(`-`,` `)}),(0,J.jsx)(`time`,{className:`text-xs text-muted-foreground`,dateTime:e.ts,children:new Date(e.ts).toLocaleString()})]}),e.reason&&(0,J.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:e.reason}),(e.githubUrl||e.runId)&&(0,J.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-3 text-sm`,children:[e.githubUrl&&(0,J.jsx)(`a`,{className:`underline underline-offset-4`,href:e.githubUrl,target:`_blank`,rel:`noreferrer`,children:e.githubTitle??`GitHub #${e.githubNumber??``}`}),e.runId&&(0,J.jsx)(G,{className:`underline underline-offset-4`,to:`/runs/${e.runId}`,children:`Open task`})]})]},e.seq))}):(0,J.jsx)(wu,{text:`Loading execution log…`})})}function Su({automation:e,onSaved:t}){let[n,r]=(0,q.useState)(e?.name??``),[i,a]=(0,q.useState)(e?.task.prompt??`Review {{github.url}}`),[o,s]=(0,q.useState)(!1),[c,l]=(0,q.useState)(``);return(0,J.jsx)(Cu,{title:e?`Edit automation`:`New automation`,subtitle:`Define a bounded GitHub trigger and the ordinary cezar task it launches.`,children:(0,J.jsxs)(`form`,{className:`grid max-w-3xl gap-6`,onSubmit:async r=>{r.preventDefault(),l(``);try{e?await te(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 st({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,J.jsxs)(`fieldset`,{className:`grid gap-4 rounded-xl border p-5`,children:[(0,J.jsx)(`legend`,{className:`px-2 font-semibold`,children:`When GitHub changes`}),(0,J.jsxs)(`div`,{className:`grid gap-2`,children:[(0,J.jsx)(va,{htmlFor:`automation-name`,children:`Name`}),(0,J.jsx)(_a,{id:`automation-name`,value:n,onChange:e=>r(e.target.value),required:!0})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(Ci,{className:`size-4`}),`New issue · every 5 minutes · last 7 days · maximum 25 records`]})]}),(0,J.jsxs)(`fieldset`,{className:`grid gap-4 rounded-xl border p-5`,children:[(0,J.jsx)(`legend`,{className:`px-2 font-semibold`,children:`What task to run`}),(0,J.jsxs)(`div`,{className:`grid gap-2`,children:[(0,J.jsx)(va,{htmlFor:`automation-prompt`,children:`Prompt`}),(0,J.jsx)(Zn,{id:`automation-prompt`,value:i,onChange:e=>a(e.target.value),rows:8,required:!0})]}),(0,J.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,J.jsxs)(`fieldset`,{className:`rounded-xl border p-5`,children:[(0,J.jsx)(`legend`,{className:`px-2 font-semibold`,children:`Review and enable`}),(0,J.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.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,J.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:c}),(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(M,{type:`submit`,children:`Save automation`}),(0,J.jsx)(M,{type:`button`,variant:`outline`,onClick:t,children:`Cancel`})]})]})})}function Cu({title:e,subtitle:t,action:n,children:r}){return(0,J.jsxs)(`main`,{className:`mx-auto w-full max-w-6xl p-4 sm:p-6`,children:[(0,J.jsxs)(`header`,{className:`mb-6 flex flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,J.jsx)(Ji,{className:`size-5`}),(0,J.jsx)(`h1`,{className:`text-2xl font-semibold`,children:e})]}),(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t})]}),n]}),r]})}function wu({text:e}){return(0,J.jsx)(`div`,{className:`rounded-xl border border-dashed p-8 text-center text-sm text-muted-foreground`,children:e})}var Tu=(0,q.lazy)(()=>H(()=>import(`./task-thread-DoNXUsHr.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,37,38]))),Eu=(0,q.lazy)(()=>H(()=>import(`./compare-variants-DbdP4Y5T.js`).then(e=>({default:e.CompareVariantsRoute})),__vite__mapDeps([39,1,2,3,4,5,33,35,19,20,15,21,22,23,24,25,38]))),Du=(0,q.lazy)(()=>H(()=>import(`./task-changes-XkHDxzQA.js`).then(e=>({default:e.TaskChangesRoute})),__vite__mapDeps([40,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,41,33,42,43,34,44,31,30,45,46,37]))),Ou=(0,q.lazy)(()=>H(()=>import(`./task-files-Da8_4C9g.js`).then(e=>({default:e.TaskFilesRoute})),__vite__mapDeps([47,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,33,42,48]))),ku=(0,q.lazy)(()=>H(()=>import(`./task-commits-BTTA5k5T.js`).then(e=>({default:e.TaskCommitsRoute})),__vite__mapDeps([49,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,50,43,35,48,45,46,37,51,36]))),Au=(0,q.lazy)(()=>H(()=>import(`./repo-git-PmX-BNMo.js`).then(e=>({default:e.RepoGitRoute})),__vite__mapDeps([52,1,2,3,4,5,50,14,15,41,33,11,13,42,16,43,34,18,44,26,35,48,45,46,37,51,36]))),ju=(0,q.lazy)(()=>H(()=>import(`./github-Vp7lxYGQ.js`).then(e=>({default:e.GithubRoute})),__vite__mapDeps([53,1,2,3,4,5,50,8,33,9,10,11,14,15,29,20,30,31,34,54,17,48,22,23,24,25,32,45,26,46,37]))),Mu=(0,q.lazy)(()=>H(()=>import(`./github-Vp7lxYGQ.js`).then(e=>({default:e.GithubIndexRoute})),__vite__mapDeps([53,1,2,3,4,5,50,8,33,9,10,11,14,15,29,20,30,31,34,54,17,48,22,23,24,25,32,45,26,46,37]))),Nu=(0,q.lazy)(()=>H(()=>import(`./workflows-o2QU_pvU.js`).then(e=>({default:e.WorkflowsRoute})),__vite__mapDeps([55,1,2,3,4,5,27,12,56,17,18,48,44,31,20,32]))),Pu=(0,q.lazy)(()=>H(()=>import(`./skills-CC91ouGH.js`).then(e=>({default:e.SkillsRoute})),__vite__mapDeps([57,1,2,3,4,5,50,8,9,56,54,17,48,30,31,20,15,32])));function Fu(){let e=N();return(0,J.jsx)(br,{to:{pathname:`/skills`,search:e.search,hash:e.hash},replace:!0})}function Iu({sectionId:e}){let t=N();return(0,J.jsx)(We,{to:{pathname:tu(`global`,e),search:t.search,hash:t.hash},replace:!0})}function Lu(){return(0,J.jsx)(`div`,{"data-route":`scope-resolving`,className:`flex min-h-full flex-col`,children:(0,J.jsx)(`p`,{className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:`Loading…`})})}function Ru(){let{projectId:e=``}=ht(),t=N(),n=D(),r=k();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,J.jsx)(We,{to:`/p/${encodeURIComponent(e)}${n||`/`}${t.search}${t.hash}`,replace:!0})}if(!n.isError)return(0,J.jsx)(Lu,{})}if(n.data){if(!(n.data.bootProject===e||n.data.projects.some(t=>t.id===e)))return(0,J.jsx)(hc,{projectId:e,registry:n.data})}else if(!n.isError)return(0,J.jsx)(Lu,{});return(0,J.jsx)(oe,{projectId:n.data?.bootProject===e?null:e,children:(0,J.jsx)(_t,{},e)})}function zu(){let{projectId:e=``}=ht();return(0,J.jsx)(tc,{},e)}function Bu(){let e=N(),t=k(),n=D(),r=y(),i=t.data?.bootProject??n.data?.bootProject,a=(t.data!==void 0||t.isError)&&(n.data!==void 0||n.isError);if(i===void 0&&!a)return(0,J.jsx)(Lu,{});let o=i??`default`;if(e.pathname===`/`&&e.search===``&&e.hash===``){if(n.data===void 0&&!n.isError||r.data===void 0&&!r.isError)return(0,J.jsx)(Lu,{});let e=Zo(r.data?.lastLocation,n.data,i);if(e!==null)return(0,J.jsx)(We,{to:e,replace:!0})}let s=e.pathname===`/p`||e.pathname===`/p/`?`/`:e.pathname;return(0,J.jsx)(We,{to:`/p/${encodeURIComponent(o)}${s}${e.search}${e.hash}`,replace:!0})}var Vu=[{pattern:`/`,pageLabel:`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 Hu(e){let t=yr(e),n=Ze({path:`/tasks/:id/*`,end:!0},t);return n?{pageLabel:null,taskId:n.params.id??null}:{pageLabel:Vu.find(({pattern:e})=>Ze({path:e,end:!0},t))?.pageLabel??null,taskId:null}}function Uu(){let e=k().data?.capabilities;return(0,J.jsxs)(pt,{children:[(0,J.jsxs)(R,{path:`/p/:projectId`,element:(0,J.jsx)(Ru,{}),children:[(0,J.jsx)(R,{index:!0,element:(0,J.jsx)(yu,{})}),(0,J.jsx)(R,{path:`new`,element:(0,J.jsx)(zu,{})}),(0,J.jsx)(R,{path:`tasks/:id`,element:(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(en,{}),children:(0,J.jsx)(Tu,{})})}),(0,J.jsx)(R,{path:`tasks/:id/changes`,element:(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(_c,{tab:`changes`}),children:(0,J.jsx)(Du,{})})}),(0,J.jsx)(R,{path:`tasks/:id/files`,element:(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(_c,{tab:`files`}),children:(0,J.jsx)(Ou,{})})}),(0,J.jsx)(R,{path:`tasks/:id/commits`,element:(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(_c,{tab:`changes`}),children:(0,J.jsx)(ku,{})})}),(0,J.jsx)(R,{path:`tasks/:id/commits/:sha`,element:(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(_c,{tab:`changes`}),children:(0,J.jsx)(ku,{})})}),(0,J.jsx)(R,{path:`compare/:groupId`,element:(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)($o,{}),children:(0,J.jsx)(Eu,{})})}),(0,J.jsx)(R,{path:`git`,element:(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(pc,{}),children:(0,J.jsx)(Au,{tab:`changes`})})}),(0,J.jsx)(R,{path:`git/commits`,element:(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(pc,{}),children:(0,J.jsx)(Au,{tab:`commits`})})}),(0,J.jsx)(R,{path:`git/commits/:sha`,element:(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(pc,{}),children:(0,J.jsx)(Au,{tab:`commits`})})}),(0,J.jsx)(R,{path:`git/branches`,element:(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(pc,{}),children:(0,J.jsx)(Au,{tab:`branches`})})}),(0,J.jsx)(R,{path:`github`,element:(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(es,{}),children:(0,J.jsx)(Mu,{})})}),(0,J.jsx)(R,{path:`github/prs`,element:(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(es,{}),children:(0,J.jsx)(ju,{view:`prs`})})}),(0,J.jsx)(R,{path:`github/issues/:n`,element:(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(es,{}),children:(0,J.jsx)(ju,{view:`issues`})})}),(0,J.jsx)(R,{path:`github/prs/:n`,element:(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(es,{}),children:(0,J.jsx)(ju,{view:`prs`})})}),(0,J.jsx)(R,{path:`github/prs/:n/changes`,element:(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(es,{}),children:(0,J.jsx)(ju,{view:`prs`,changes:!0})})}),(0,J.jsx)(R,{path:`automations`,element:(0,J.jsx)(bu,{})}),(0,J.jsx)(R,{path:`automations/new`,element:(0,J.jsx)(bu,{mode:`new`})}),(0,J.jsx)(R,{path:`automations/:automationId`,element:(0,J.jsx)(bu,{mode:`edit`})}),(0,J.jsx)(R,{path:`automations/:automationId/log`,element:(0,J.jsx)(bu,{mode:`log`})}),(0,J.jsx)(R,{path:`skills`,element:(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(mc,{}),children:(0,J.jsx)(Pu,{})})}),(0,J.jsx)(R,{path:`inbox`,element:(0,J.jsx)(cs,{})}),(0,J.jsx)(R,{path:`workflows`,element:(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(gc,{}),children:(0,J.jsx)(Nu,{})})}),(0,J.jsx)(R,{path:`workflows/:name`,element:(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(gc,{}),children:(0,J.jsx)(Nu,{})})}),(0,J.jsx)(R,{path:`settings`,element:(0,J.jsx)(su,{scope:`project`,capabilities:e})}),(0,J.jsx)(R,{path:`settings/skills`,element:(0,J.jsx)(Fu,{})}),eu(`project`,e).map(t=>(0,J.jsx)(R,{path:`settings/${t.id}`,element:(0,J.jsx)(ou,{section:t,scope:`project`,capabilities:e})},t.id)),eu(`global`,e).map(e=>(0,J.jsx)(R,{path:`settings/${e.id}`,element:(0,J.jsx)(Iu,{sectionId:e.id})},e.id)),(0,J.jsx)(R,{path:`*`,element:(0,J.jsx)(fc,{})})]}),(0,J.jsx)(R,{path:`/settings/global`,element:(0,J.jsx)(su,{scope:`global`,capabilities:e})}),eu(`global`,e).map(t=>(0,J.jsx)(R,{path:tu(`global`,t.id),element:(0,J.jsx)(ou,{section:t,scope:`global`,capabilities:e})},t.id)),(0,J.jsx)(R,{path:`*`,element:(0,J.jsx)(Bu,{})})]})}function Wu(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 Gu(e){return e?.available===!0&&(e.status===`available`||e.status===`error`)}function Ku({children:e}){let{pathname:t}=N(),n=xr(),r=k(),i=r.data?.capabilities.followups===!0,a=Et(i),o=Gu(ze(n??``,n!==null).data),s=Fe(),c=D().data,l=Hu(t),u=c?.bootProject??r.data?.bootProject??null,d=n!==null&&n===u,f=c?.projects.find(e=>e.id===n),p=je(n??``,f!==void 0&&l.taskId!==null,c?.bootProject===n).data,m=t===`/settings/global`||t.startsWith(`/settings/global/`)?null:f?.name??(d?Wu(r.data)?.name??null:null),h=l.taskId?p?.find(e=>e.id===l.taskId):void 0;Ko({projectName:m,pageLabel:h?S(h):l.pageLabel});let g=c&&c.projects.length>1?c:null;return(0,J.jsxs)(go,{children:[(0,J.jsx)(io,{repo:Wu(r.data),version:r.data?.version??null,latestVersion:r.data?.latestVersion??null,inboxCount:a.data?.length??null,unreadCount:s.data?Xt(s.data):null,skillsUpdateAvailable:o,forgeAvailable:r.data?.forge?.available===!0,inboxAvailable:i,banner:(0,J.jsx)(To,{}),singleProject:r.data?.capabilities.singleProject===!0,taskQuickList:(0,J.jsx)(Mo,{}),projectGroups:g?(0,J.jsx)(Lo,{projects:g.projects,bootProjectId:g.bootProject,inboxAvailable:i,inboxCount:a.data?.length??null,skillsUpdateAvailable:o}):void 0,toolsMenu:(0,J.jsx)(Vo,{health:r.data}),children:e}),(0,J.jsx)(Qa,{})]})}function qu(){let e=P(),t=N(),n=D(),r=y(),i=(0,q.useRef)(null),a=(0,q.useRef)(null),o=(0,q.useRef)(!1),s=(0,q.useCallback)(function t(){if(a.current=null,o.current)return;let n=i.current;n!==null&&(i.current=null,o.current=!0,x({lastLocation:n}).then(t=>{let r=e.getQueryData(E.uiState)?.lastLocation;r===void 0||Qo(r,n)?e.setQueryData(E.uiState,t):e.setQueryData(E.uiState,{...t,lastLocation:r})}).catch(()=>{e.invalidateQueries({queryKey:E.uiState})}).finally(()=>{o.current=!1,i.current!==null&&a.current===null&&t()}))},[e]);return(0,q.useEffect)(()=>()=>{a.current!==null&&(clearTimeout(a.current),s())},[s]),(0,q.useEffect)(()=>{if(r.data===void 0)return;let o=Xo(t,n.data);if(o===null)return;let c=e.getQueryData(E.uiState);Qo(c?.lastLocation,o)||(e.setQueryData(E.uiState,{...c,lastLocation:o}),i.current=o,a.current!==null&&clearTimeout(a.current),a.current=setTimeout(s,400))},[s,t.hash,t.pathname,t.search,n.data,e,r.data]),null}function Ju(){let e=P(),t=vl(y().data?.notifications).enabled,n=(0,q.useRef)(t);n.current=t;let r=(0,q.useRef)(new Map);return(0,q.useEffect)(()=>{let t=bt(o.runs.list()),i=e=>{let{entering:t,statuses:i}=bl(r.current,e);if(r.current=i,t.length!==0&&xl({enabled:n.current,hidden:document.visibilityState===`hidden`,permission:yl()}))for(let e of t)Yu(e)};return i(e.getQueryData(o.runs.list())),e.getQueryCache().subscribe(e=>{e.query.queryHash!==t||e.type!==`updated`||i(e.query.state.data)})},[e]),null}function Yu(e){let t=globalThis.Notification;if(typeof t!=`function`)return;let n=Sl(e);try{new t(n.title,{body:n.body,tag:n.tag})}catch{}}function Xu(){let[e]=(0,q.useState)(vi);return(0,J.jsx)(Ue,{client:e,children:(0,J.jsxs)(mi,{children:[(0,J.jsx)(Ju,{}),(0,J.jsx)(Ia,{children:(0,J.jsx)(il,{children:(0,J.jsxs)(Me,{children:[(0,J.jsx)(qu,{}),(0,J.jsx)(Ku,{children:(0,J.jsx)(Uu,{})}),(0,J.jsx)(ft,{})]})})})]})})}function Zu(){return(document.querySelector(`meta[name="cez-api-base"]`)?.getAttribute(`content`))?.trim()||``}Ft(Zu());var Qu=document.getElementById(`root`);if(!Qu)throw Error(`cezar: #root container is missing from index.html`);(0,qr.createRoot)(Qu).render((0,J.jsx)(q.StrictMode,{children:(0,J.jsx)(Xu,{})}));export{Ji as _,pc as a,Ni as b,As as c,ns as d,ts as f,_a as g,ba as h,gc as i,is as l,$o as m,vc as n,js as o,es as p,_c as r,Ms as s,gl as t,rs as u,Wi as v,Mi as x,Ui as y};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n,t as r}from"./react-runtime-CCIEwYL0.js";var i=r(),a=e(t(),1),o=e(n(),1),s=null,{min:c,max:l,abs:u,floor:d}=Math,f=(e,t,n)=>c(n,l(t,e)),p=e=>[...e].sort((e,t)=>e-t),m=typeof queueMicrotask==`function`?queueMicrotask:e=>{Promise.resolve().then(e)},h=()=>{let e;return[new Promise(t=>{e=t}),e]},g=e=>{let t;return()=>(e&&=(t=e(),void 0),t)},_=(e,t,n)=>{let r=n?`unshift`:`push`;for(let n=0;n<t;n++)e[r](-1);return e},v=(e,t)=>{let n=e.t[t];return n===-1?e.o:n},y=(e,t,n)=>{let r=e.t[t]===-1;return e.t[t]=n,e.i=c(t,e.i),r},b=(e,t)=>{if(!e.l)return 0;if(e.i>=t)return e.u[t];e.i<0&&(e.u[0]=0,e.i=0);let n=e.i,r=e.u[n];for(;n<t;)r+=v(e,n),e.u[++n]=r;return e.i=t,r},x=(e,t,n=0,r=e.l-1)=>{let i=n;for(;n<=r;){let a=d((n+r)/2);b(e,a)<=t?(i=a,n=a+1):r=a-1}return f(i,0,e.l-1)},S=(e,t,n)=>{let r=t-e.l;return e.i=n?-1:c(t-1,e.i),e.l=t,r>0?(_(e.u,r),_(e.t,r,n),e.o*r):(e.u.splice(r),(n?e.t.splice(0,-r):e.t.splice(r)).reduce((t,n)=>t-(n===-1?e.o:n),0))},C=typeof window<`u`,w=e=>e.documentElement,T=e=>e.ownerDocument,E=e=>e.defaultView,D=g(()=>!!/iP(hone|od|ad)/.test(navigator.userAgent)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>0),O=g(()=>`scrollBehavior`in w(document).style),k=e=>l(e.h(),e.p()),A=(e,t=40,n=0,r,i=!1)=>{let a=!!n,o=1,d=0,f=0,m=0,h=0,g=0,C=0,w=0,T=0,E=s,O=[0,a?l(n-1,0):-1],k=0,A=!1,j=((e,t,n)=>({o:t,t:n?_(n.slice(0,c(e,n.length)),l(0,e-n.length)):_([],e),l:e,i:-1,u:_([],e+1)}))(e,r?r[1]:t,r&&r[0]),M=new Set,N=()=>m-f,P=()=>N()+g+h,F=(e,t)=>((e,t,n,r)=>{if(r=c(r,e.l-1),b(e,r)<=t){let i=x(e,n,r);return[x(e,t,r,i),i]}{let i=x(e,t,void 0,r);return[i,x(e,n,i)]}})(j,e,t,O[0]),I=()=>b(j,j.l),L=(e,t)=>{let n=b(j,e)-g;return t?I()-n-R(e):n},R=e=>v(j,e),z=(e,t=-1)=>j.t[e]===t,B=e=>{e&&(D()&&w!==0||E&&T===1?g+=e:h+=e)};return{v:()=>{M.clear()},m:()=>o,_:()=>(e=>[e.t.slice(),e.o])(j),S:(e=200)=>{if(!A||a)return O;let t,n;if(C)[t,n]=O;else{let r=l(0,P()),a=r+d;i||(e=l(0,e),w!==1&&(r-=e),w!==2&&(a+=e)),[t,n]=O=F(l(0,r),l(0,a)),E&&(t=c(t,E[0]),n=l(n,E[1]))}return[l(t,0),c(n,j.l-1)]},$:e=>x(j,e-f),I:z,k:L,R,T:()=>j.l,C:()=>m,M:()=>w!==0,p:()=>d,O:()=>f,h:I,H:()=>(C=h,h=0,[C,T===2]),W:(e,t)=>{let n=[e,t];return M.add(n),()=>{M.delete(n)}},B:(e,t)=>{let n,r,c=0;switch(e){case 1:{if(t===m&&T===0)break;let e=C;C=0;let n=t-m,i=u(n);e&&i<u(e)+1||T!==0||(w=n<0?2:1),a&&=!1,m=t,c=4;let o=N();o>=-d&&o<=I()&&(c+=1,r=i>d);break}case 2:c=8,w!==0&&(n=!0,c+=1),w=0,T=0,E=s;break;case 3:{let e=t.filter(([e,t])=>!z(e,t));if(!e.length)break;B(e.reduce((e,[t,n])=>{let r;if(T===2)r=!0;else if(E&&T===1)r=t<E[0];else{let e=N(),n=L(t),i=R(t);r=w!==1&&T===0?n+i<=e:n<e&&n+i<e+d}return r&&(e+=n-R(t)),e},0));for(let[t,n]of e){let e=R(t),r=y(j,t,n);i&&(k+=r?n:n-e)}i&&d&&k>d&&(B(((e,t)=>{let n=0,r=[];e.t.forEach((e,i)=>{e!==-1&&(r.push(e),i<t&&n++)}),e.i=-1;let i=p(r),a=i.length,o=a/2|0,s=a%2==0?(i[o-1]+i[o])/2:i[o],c=e.o;return((e.o=s)-c)*l(t-n,0)})(j,x(j,P()))),i=!1),c=3,r=!0;break}case 4:d!==t&&(d||(A=r=!0),d=t,c=3);break;case 5:t[1]?(B(S(j,t[0],!0)),T=2,c=1):(S(j,t[0]),c=1);break;case 6:f=t;break;case 7:T=1;break;case 8:E=F(t,t+d),c=1}c&&(o=1+(2147483647&o),n&&g&&(h+=g,g=0),M.forEach(([e,t])=>{c&e&&t(r)}))}}},j=setTimeout,M=(e,t)=>t?-e:e,N=(e,t,n,r,i,a)=>{let o=Date.now,c=0,l=!1,u=!1,d=!1,f=!1,p=(()=>{let t,n=()=>{t!=s&&clearTimeout(t)},r=()=>{n(),t=j(()=>{t=s,(()=>{if(l||u)return l=!1,void p();d=!1,e.B(2)})()},150)};return r.J=n,r})(),m=()=>{c=o(),d&&(f=!0),a&&e.B(6,a()),e.B(1,r()),p()},h=t=>{if(l||!e.M()||t.ctrlKey)return;let r=o()-c;150>r&&50<r&&(n?t.deltaX:t.deltaY)&&(l=!0)},g=()=>{u=!0,d=f=!1},_=()=>{u=!1,D()&&(d=!0)};return t.addEventListener(`scroll`,m),t.addEventListener(`wheel`,h,{passive:!0}),t.addEventListener(`touchstart`,g,{passive:!0}),t.addEventListener(`touchend`,_,{passive:!0}),{A:()=>{t.removeEventListener(`scroll`,m),t.removeEventListener(`wheel`,h),t.removeEventListener(`touchstart`,g),t.removeEventListener(`touchend`,_),p.J()},L:()=>{let[t,n]=e.H();t&&(i(t,n,f),f=!1,n&&e.p()>e.h()&&e.B(1,r()))}}},P=(e,t,n)=>{let r;return[async(i,a)=>{if(!await t())return;r&&r();let o=()=>{let[t,n]=h();return r=()=>{n(!1)},e.p()&&j(r,150),[t,e.W(2,()=>{n(!0)})]};if(a&&O())e.B(8,i()),m(async()=>{for(;;){let t=!0;for(let[n,r]=e.S();n<=r;n++)if(e.I(n)){t=!1;break}if(t)break;let[n,r]=o();try{if(!await n)return}finally{r()}}e.B(7),n(i(),a)});else for(;;){let[t,r]=o();try{if(e.B(7),n(i()),!await t)return}finally{r()}}},()=>{r&&r()}]},F=(e,t)=>{let n,r,i=h(),a=!1,o=t?`scrollLeft`:`scrollTop`,s=t?`overflowX`:`overflowY`,[c,l]=P(e,()=>i[0],(e,r)=>{e=M(e,a),r?n.scrollTo({[t?`left`:`top`]:e,behavior:`smooth`}):n[o]=e});return{N(c,u){n=u,t&&(a=getComputedStyle(u).direction===`rtl`),r=N(e,u,t,()=>M(u[o],a),(t,n,r)=>{if(r){let e=u.style,t=e[s];e[s]=`hidden`,j(()=>{e[s]=t})}u[o]=M(e.C()+t,a),n&&l()}),i[1](!0)},v(){r&&r.A(),i[1](!1),i=h()},P:()=>a,V(e){c(()=>e)},X(t){t+=e.C(),c(()=>t)},Y(t,{align:n,smooth:r,offset:i=0}={}){if(t=f(t,0,e.T()-1),n===`nearest`){let r=e.k(t),i=e.C();if(r<i)n=`start`;else{if(!(r+e.R(t)>i+e.p()))return;n=`end`}}c(()=>i+e.O()+e.k(t)+(n===`end`?e.R(t)-e.p():n===`center`?(e.R(t)-e.p())/2:0),r)},q:()=>{r&&r.L()}}},I=e=>{let t;return{j(n){(t||=new(E(T(n))).ResizeObserver(e)).observe(n)},D(e){t.unobserve(e)},A(){t&&t.disconnect()}}},L=(e,t)=>{let n,r=t?`width`:`height`,i=new WeakMap,a=I(t=>{let a=[];for(let{target:o,contentRect:c}of t)if(o.offsetParent)if(o===n)e.B(4,c[r]);else{let e=i.get(o);e!=s&&a.push([e,c[r]])}a.length&&e.B(3,a)});return{G(e){a.j(n=e)},U:(e,t)=>(i.set(e,t),a.j(e),()=>{i.delete(e),a.D(e)}),v:a.A}},R=C?a.useLayoutEffect:a.useEffect,z=`current`,B=(e,t)=>{if(Array.isArray(e))for(let n of e)B(n,t);else e==null||typeof e==`boolean`||t.push(e)},V=(e,t)=>e.key??`_`+t,H=e=>{let t=(0,a.useRef)(null);return t[z]||(t[z]=e())},U=e=>{let t=(0,a.useRef)(e);return R(()=>{t[z]=e},[e]),t},W=(0,a.memo)(({Z:e,ee:t,te:n,oe:r,ne:o,re:s,se:c,ie:l})=>{let u=(0,a.useRef)(null);R(()=>t(u[z],n),[n]);let d=(0,a.useMemo)(()=>{let e={contain:`layout style`,position:o&&l?void 0:`absolute`,[c?`height`:`width`]:`100%`,[c?`top`:`left`]:0,[c?`left`:`top`]:r,visibility:!o||l?void 0:`hidden`};return c&&(e.display=`inline-flex`),e},[r,o,l,c]);return(0,i.jsx)(s,typeof s==`string`?{ref:u,style:d,children:e}:{ref:u,style:d,index:n,children:e})}),G=(e,t)=>(0,a.useMemo)(()=>{if(typeof e==`function`)return[n=>e(t[n],n),t.length];let n=(e=>{let t=[];return B(e,t),t})(e);return[e=>n[e],n.length]},[e,t]),K=(0,a.forwardRef)(({children:e,data:t,bufferSize:n,itemSize:r,shift:s,horizontal:c,keepMounted:l,cache:u,startMargin:d=0,ssrCount:f,as:h=`div`,item:g=`div`,scrollRef:_,onScroll:v,onScrollEnd:y},b)=>{let[x,S]=G(e,t),C=(0,a.useRef)(null),w=(0,a.useRef)(!!f),T=U(v),E=U(y),[D,O,j,M]=H(()=>{let e=!!c,t=A(S,r,f,u,!r);return[t,L(t,e),F(t,e),e]});S!==D.T()&&D.B(5,[S,s]),d!==D.O()&&D.B(6,d);let[N,P]=(0,a.useReducer)(D.m,void 0,D.m),I=D.M(),B=D.h(),K=j.P(),q=[],J=e=>{let t=x(e);return(0,i.jsx)(W,{ee:O.U,te:e,oe:D.k(e,K),ne:D.I(e),re:g,Z:t,se:M,ie:w[z]},V(t,e))};if(R(()=>{w[z]=!1,D.W(1,e=>{e?(0,o.flushSync)(P):P()}),D.W(4,()=>{T[z]&&T[z](D.C())}),D.W(8,()=>{E[z]&&E[z]()});let e=C[z],t=t=>{O.G(t),j.N(e,t)};return _?m(()=>{_[z]&&t(_[z])}):t(e.parentElement),()=>{D.v(),O.v(),j.v()}},[]),R(()=>{j.q()},[N]),(0,a.useImperativeHandle)(b,()=>({get cache(){return D._()},get scrollOffset(){return D.C()},get scrollSize(){return k(D)},get viewportSize(){return D.p()},findItemIndex:D.$,getItemOffset:D.k,getItemSize:D.R,scrollToIndex:j.Y,scrollTo:j.V,scrollBy:j.X}),[]),l){let e=new Set(l);for(let[t,r]=D.S(n);t<=r;t++)e.add(t);p([...e]).forEach(e=>{q.push(J(e))})}else for(let[e,t]=D.S(n);e<=t;e++)q.push(J(e));return(0,i.jsx)(h,{ref:C,style:{contain:`size style`,overflowAnchor:`none`,flex:`none`,position:`relative`,width:M?B:`100%`,height:M?`100%`:B,pointerEvents:I?`none`:void 0},children:q})});export{K as t};