@open-mercato/cezar 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (294) hide show
  1. package/README.md +3 -2
  2. package/dist/agent-config/catalog.d.ts +4 -0
  3. package/dist/agent-config/catalog.js +85 -3
  4. package/dist/agent-config/catalog.js.map +1 -1
  5. package/dist/agent-config/model-settings/copilot.d.ts +15 -0
  6. package/dist/agent-config/model-settings/copilot.js +25 -0
  7. package/dist/agent-config/model-settings/copilot.js.map +1 -0
  8. package/dist/agent-config/model-settings/junie.d.ts +12 -0
  9. package/dist/agent-config/model-settings/junie.js +18 -0
  10. package/dist/agent-config/model-settings/junie.js.map +1 -0
  11. package/dist/agent-config/models.js +4 -0
  12. package/dist/agent-config/models.js.map +1 -1
  13. package/dist/automations/prompts.d.ts +2 -2
  14. package/dist/automations/prompts.js +1 -1
  15. package/dist/automations/types.d.ts +12 -0
  16. package/dist/config.d.ts +4 -0
  17. package/dist/config.js +2 -0
  18. package/dist/config.js.map +1 -1
  19. package/dist/contract/agent-config.d.ts +4 -0
  20. package/dist/contract/agent-profiles.d.ts +30 -0
  21. package/dist/contract/automations.d.ts +32 -0
  22. package/dist/contract/dashboard-insights.d.ts +186 -0
  23. package/dist/contract/dashboard.d.ts +88 -0
  24. package/dist/contract/dispatch.d.ts +6 -0
  25. package/dist/contract/health.d.ts +8 -0
  26. package/dist/contract/index.d.ts +2 -0
  27. package/dist/contract/index.js +249 -72
  28. package/dist/contract/runs.d.ts +144 -0
  29. package/dist/contract/self-update.d.ts +111 -2
  30. package/dist/contract/skills.d.ts +19 -0
  31. package/dist/contract/star-count.d.ts +18 -0
  32. package/dist/contract/workflows.d.ts +12 -0
  33. package/dist/contract/workspace.d.ts +42 -2
  34. package/dist/core/acp-client.d.ts +99 -0
  35. package/dist/core/acp-client.js +198 -0
  36. package/dist/core/acp-client.js.map +1 -0
  37. package/dist/core/acp-ui-mapper.d.ts +95 -0
  38. package/dist/core/acp-ui-mapper.js +444 -0
  39. package/dist/core/acp-ui-mapper.js.map +1 -0
  40. package/dist/core/agent-env.js +10 -0
  41. package/dist/core/agent-env.js.map +1 -1
  42. package/dist/core/agent-profiles.d.ts +10 -0
  43. package/dist/core/agent-profiles.js +16 -0
  44. package/dist/core/agent-profiles.js.map +1 -1
  45. package/dist/core/agent-runner.d.ts +5 -3
  46. package/dist/core/agent-runner.js +5 -3
  47. package/dist/core/agent-runner.js.map +1 -1
  48. package/dist/core/backend-detect.d.ts +3 -3
  49. package/dist/core/backend-detect.js +61 -2
  50. package/dist/core/backend-detect.js.map +1 -1
  51. package/dist/core/claude-cli-runner.d.ts +5 -2
  52. package/dist/core/claude-cli-runner.js +11 -6
  53. package/dist/core/claude-cli-runner.js.map +1 -1
  54. package/dist/core/claude-ui-mapper.d.ts +14 -0
  55. package/dist/core/claude-ui-mapper.js +102 -11
  56. package/dist/core/claude-ui-mapper.js.map +1 -1
  57. package/dist/core/codex-app-server-transport.js +8 -4
  58. package/dist/core/codex-app-server-transport.js.map +1 -1
  59. package/dist/core/copilot-acp-runner.d.ts +60 -0
  60. package/dist/core/copilot-acp-runner.js +528 -0
  61. package/dist/core/copilot-acp-runner.js.map +1 -0
  62. package/dist/core/copilot-ui-mapper.d.ts +47 -0
  63. package/dist/core/copilot-ui-mapper.js +111 -0
  64. package/dist/core/copilot-ui-mapper.js.map +1 -0
  65. package/dist/core/cursor-agent-runner.js +4 -4
  66. package/dist/core/cursor-agent-runner.js.map +1 -1
  67. package/dist/core/disclaim-spawn.d.ts +9 -0
  68. package/dist/core/disclaim-spawn.js +53 -0
  69. package/dist/core/disclaim-spawn.js.map +1 -0
  70. package/dist/core/junie-acp-transport.d.ts +58 -0
  71. package/dist/core/junie-acp-transport.js +179 -0
  72. package/dist/core/junie-acp-transport.js.map +1 -0
  73. package/dist/core/junie-auth-probe.d.ts +12 -0
  74. package/dist/core/junie-auth-probe.js +30 -0
  75. package/dist/core/junie-auth-probe.js.map +1 -0
  76. package/dist/core/junie-model-catalog.d.ts +10 -0
  77. package/dist/core/junie-model-catalog.js +104 -0
  78. package/dist/core/junie-model-catalog.js.map +1 -0
  79. package/dist/core/junie-runner.d.ts +45 -0
  80. package/dist/core/junie-runner.js +533 -0
  81. package/dist/core/junie-runner.js.map +1 -0
  82. package/dist/core/junie-ui-mapper.d.ts +132 -0
  83. package/dist/core/junie-ui-mapper.js +459 -0
  84. package/dist/core/junie-ui-mapper.js.map +1 -0
  85. package/dist/core/model-identity.js +17 -0
  86. package/dist/core/model-identity.js.map +1 -1
  87. package/dist/core/model-presets.js +10 -0
  88. package/dist/core/model-presets.js.map +1 -1
  89. package/dist/core/opencode-server-runner.js +4 -4
  90. package/dist/core/opencode-server-runner.js.map +1 -1
  91. package/dist/core/pi-runner.js +4 -4
  92. package/dist/core/pi-runner.js.map +1 -1
  93. package/dist/core/provider-auth.d.ts +16 -2
  94. package/dist/core/provider-auth.js +113 -7
  95. package/dist/core/provider-auth.js.map +1 -1
  96. package/dist/core/runner-factory.js +6 -0
  97. package/dist/core/runner-factory.js.map +1 -1
  98. package/dist/core/runner-model-catalog.js +12 -8
  99. package/dist/core/runner-model-catalog.js.map +1 -1
  100. package/dist/core/tool-display.js +6 -1
  101. package/dist/core/tool-display.js.map +1 -1
  102. package/dist/core/ui-events.d.ts +6 -2
  103. package/dist/git-diff-base.js +23 -2
  104. package/dist/git-diff-base.js.map +1 -1
  105. package/dist/git-worktree.d.ts +21 -2
  106. package/dist/git-worktree.js +68 -5
  107. package/dist/git-worktree.js.map +1 -1
  108. package/dist/index.js +14 -4
  109. package/dist/index.js.map +1 -1
  110. package/dist/paths.js +2 -0
  111. package/dist/paths.js.map +1 -1
  112. package/dist/runs/event-history.js +3 -0
  113. package/dist/runs/event-history.js.map +1 -1
  114. package/dist/runs/store.d.ts +42 -3
  115. package/dist/runs/store.js +112 -6
  116. package/dist/runs/store.js.map +1 -1
  117. package/dist/self-update/checkouts.d.ts +53 -0
  118. package/dist/self-update/checkouts.js +268 -0
  119. package/dist/self-update/checkouts.js.map +1 -0
  120. package/dist/self-update/cli.d.ts +5 -3
  121. package/dist/self-update/cli.js +75 -8
  122. package/dist/self-update/cli.js.map +1 -1
  123. package/dist/self-update/layout.d.ts +33 -1
  124. package/dist/self-update/layout.js +102 -3
  125. package/dist/self-update/layout.js.map +1 -1
  126. package/dist/self-update/pulls.d.ts +40 -0
  127. package/dist/self-update/pulls.js +127 -0
  128. package/dist/self-update/pulls.js.map +1 -0
  129. package/dist/self-update/service.d.ts +26 -3
  130. package/dist/self-update/service.js +85 -9
  131. package/dist/self-update/service.js.map +1 -1
  132. package/dist/server/dashboard.d.ts +107 -0
  133. package/dist/server/dashboard.js +2 -1
  134. package/dist/server/dashboard.js.map +1 -1
  135. package/dist/server/forge/github.js +4 -1
  136. package/dist/server/forge/github.js.map +1 -1
  137. package/dist/server/fs-browse.d.ts +3 -1
  138. package/dist/server/fs-browse.js +27 -5
  139. package/dist/server/fs-browse.js.map +1 -1
  140. package/dist/server/open-in-app.js +2 -0
  141. package/dist/server/open-in-app.js.map +1 -1
  142. package/dist/server/provider-action-gate.js +5 -1
  143. package/dist/server/provider-action-gate.js.map +1 -1
  144. package/dist/server/server.d.ts +880 -511
  145. package/dist/server/server.js +40 -5
  146. package/dist/server/server.js.map +1 -1
  147. package/dist/server/star-count.d.ts +67 -0
  148. package/dist/server/star-count.js +186 -0
  149. package/dist/server/star-count.js.map +1 -0
  150. package/dist/skills-banner.d.ts +19 -0
  151. package/dist/skills-banner.js +24 -0
  152. package/dist/skills-banner.js.map +1 -1
  153. package/dist/workflows/run.d.ts +0 -2
  154. package/dist/workflows/run.js +45 -29
  155. package/dist/workflows/run.js.map +1 -1
  156. package/dist/workflows/types.d.ts +6 -0
  157. package/dist/workspace/agent-accounts.d.ts +9 -1
  158. package/dist/workspace/agent-accounts.js +2 -0
  159. package/dist/workspace/agent-accounts.js.map +1 -1
  160. package/dist/workspace/agent-profiles.d.ts +2 -2
  161. package/dist/workspace/agent-profiles.js +25 -6
  162. package/dist/workspace/agent-profiles.js.map +1 -1
  163. package/dist/workspace/config.d.ts +9 -1
  164. package/dist/workspace/config.js +10 -3
  165. package/dist/workspace/config.js.map +1 -1
  166. package/dist/workspace/dashboard-insights.d.ts +42 -0
  167. package/dist/workspace/dashboard-insights.js +220 -0
  168. package/dist/workspace/dashboard-insights.js.map +1 -0
  169. package/dist/workspace/dashboard.d.ts +71 -1
  170. package/dist/workspace/dashboard.js +14 -1
  171. package/dist/workspace/dashboard.js.map +1 -1
  172. package/dist/workspace/semaphore.d.ts +3 -0
  173. package/dist/workspace/semaphore.js +8 -1
  174. package/dist/workspace/semaphore.js.map +1 -1
  175. package/package.json +3 -3
  176. package/scripts/mock-claude.mjs +34 -1
  177. package/scripts/mock-copilot-acp.mjs +190 -0
  178. package/scripts/mock-junie-acp.mjs +208 -0
  179. package/web/dist/assets/agent-task-pickers-BeQi-UTm.js +1 -0
  180. package/web/dist/assets/alert-dialog-CnRAuqwb.js +1 -0
  181. package/web/dist/assets/arrow-down-Da0kNRNH.js +1 -0
  182. package/web/dist/assets/arrow-left-BIZHhBIP.js +1 -0
  183. package/web/dist/assets/automation-format-CfPmkcsg.js +1 -0
  184. package/web/dist/assets/automations-route-AMJbFP53.js +1 -0
  185. package/web/dist/assets/centered-state-3r2Kaar_.js +1 -0
  186. package/web/dist/assets/chevron-left-DLAUPC66.js +1 -0
  187. package/web/dist/assets/chevron-right-KVZcXiPL.js +1 -0
  188. package/web/dist/assets/{circle-x-C9UoMP1V.js → circle-x-C0Jm5Ppb.js} +1 -1
  189. package/web/dist/assets/collapsible-DG_SIWqU.js +1 -0
  190. package/web/dist/assets/command-Dfln3D4A.js +1 -0
  191. package/web/dist/assets/{commit-list-BSfPsVsu.js → commit-list-_RA72yB_.js} +1 -1
  192. package/web/dist/assets/compare-variants-D6Ji6od4.js +1 -0
  193. package/web/dist/assets/dashboard-B3-tPimG.js +44 -0
  194. package/web/dist/assets/dialog-CiDREdUK.js +1 -0
  195. package/web/dist/assets/{diff-I0xowULh.js → diff-CxdyRumG.js} +2 -2
  196. package/web/dist/assets/diff-controls-DqJMMV4z.js +1 -0
  197. package/web/dist/assets/{diff-stat-yKn7joEr.js → diff-stat-Hupj4hxh.js} +1 -1
  198. package/web/dist/assets/{diff-view-DjvMeW1M.js → diff-view-BBYT5k6c.js} +1 -1
  199. package/web/dist/assets/dist-BqMwqJFX.js +1 -0
  200. package/web/dist/assets/dist-DpiX6WjA.js +1 -0
  201. package/web/dist/assets/{download-BcgZ2yk4.js → download-BR7EN9gW.js} +1 -1
  202. package/web/dist/assets/dropdown-menu-Ci4HFML0.js +1 -0
  203. package/web/dist/assets/editable-title-DDtUgRKZ.js +1 -0
  204. package/web/dist/assets/{ellipsis-vertical-g4O4NlLV.js → ellipsis-vertical-DBklom4U.js} +1 -1
  205. package/web/dist/assets/facet-filter-CfI4QvOd.js +1 -0
  206. package/web/dist/assets/{file-wXNeZwi7.js → file-CZb7cKNH.js} +1 -1
  207. package/web/dist/assets/{file-text-DV1gE2L6.js → file-text-Dm6CrEGW.js} +1 -1
  208. package/web/dist/assets/{folder-wjVId5un.js → folder-zQj-FYOo.js} +1 -1
  209. package/web/dist/assets/{git-pull-request-BBEDdTLK.js → git-pull-request-AhwzJc7s.js} +1 -1
  210. package/web/dist/assets/git-toolbar-j7gKkhGL.js +1 -0
  211. package/web/dist/assets/github-De-DFy8s.js +1 -0
  212. package/web/dist/assets/{image-preview-u1f-wzxC.js → image-preview-Dd3NVB7N.js} +1 -1
  213. package/web/dist/assets/index-HS1hr5Sz.js +12 -0
  214. package/web/dist/assets/index-YwgrLyBj.css +2 -0
  215. package/web/dist/assets/loader-circle-sk4vKJKp.js +1 -0
  216. package/web/dist/assets/{markdown-Bnm47qUl.js → markdown-DjNR-1p8.js} +2 -2
  217. package/web/dist/assets/new-task-form-vLs2G1_z.js +1 -0
  218. package/web/dist/assets/picker-pill-VW-M1ZiV.js +1 -0
  219. package/web/dist/assets/{pill-7dm3vWF7.js → pill-CPl6sysj.js} +1 -1
  220. package/web/dist/assets/popover-CNGONAql.js +1 -0
  221. package/web/dist/assets/project-router-dCZQu1wQ.js +1 -0
  222. package/web/dist/assets/{prompt-templates-BMZ5q5H_.js → prompt-templates-jNjVTAws.js} +1 -1
  223. package/web/dist/assets/{refresh-cw-C69euZ2H.js → refresh-cw-BfkEydKA.js} +1 -1
  224. package/web/dist/assets/repo-git-BZWZ6_pR.js +1 -0
  225. package/web/dist/assets/{run-diff-CoNVGn23.js → run-diff-u_roDsAJ.js} +2 -2
  226. package/web/dist/assets/run-header-Br1yJR0m.js +1 -0
  227. package/web/dist/assets/{search-x-BNLFOxI6.js → search-x-CT0NTqK1.js} +1 -1
  228. package/web/dist/assets/segmented-IDD4ucht.js +1 -0
  229. package/web/dist/assets/skills-Dsi5YdLG.js +1 -0
  230. package/web/dist/assets/{sparkles-ChorK-gZ.js → sparkles-CvOeAoyJ.js} +1 -1
  231. package/web/dist/assets/{square-terminal-C7KCPznz.js → square-terminal-eSs8YYZe.js} +1 -1
  232. package/web/dist/assets/{tab-link-E5O2Cesc.js → tab-link-CPF6ORha.js} +1 -1
  233. package/web/dist/assets/task-changes-DIT9Y1rh.js +1 -0
  234. package/web/dist/assets/task-commits-B4VvdiHH.js +1 -0
  235. package/web/dist/assets/task-files-BMm9C0DW.js +2 -0
  236. package/web/dist/assets/task-thread-RXabJAt0.js +9 -0
  237. package/web/dist/assets/{textarea-DLAfWPb0.js → textarea-DtBqPhIs.js} +1 -1
  238. package/web/dist/assets/thread-loading-Dnxb6Ar-.js +1 -0
  239. package/web/dist/assets/toaster-CfRVb8vH.js +43 -0
  240. package/web/dist/assets/token-metrics-DldVlr6m.js +1 -0
  241. package/web/dist/assets/tooltip-_O50N3pt.js +1 -0
  242. package/web/dist/assets/tracker-J0fdcH1G.js +4 -0
  243. package/web/dist/assets/{trash-2-_vwSMdPG.js → trash-2-CUH7GOVh.js} +1 -1
  244. package/web/dist/assets/{triangle-alert-fBRUkB46.js → triangle-alert-D5K_zyD3.js} +1 -1
  245. package/web/dist/assets/{upload-B4OIpdyq.js → upload-D7_n-9cl.js} +1 -1
  246. package/web/dist/assets/{use-now-sqAvRMna.js → use-now-3lElDuTi.js} +1 -1
  247. package/web/dist/assets/utils-BXvEm7Ve.js +64 -0
  248. package/web/dist/assets/workflows-D-dx9c_0.js +7 -0
  249. package/web/dist/assets/x-kLybIvX4.js +1 -0
  250. package/web/dist/assets/{zoomable-image-X81SApIg.js → zoomable-image-CnyQ9wyw.js} +1 -1
  251. package/web/dist/index.html +38 -36
  252. package/web/dist/assets/agent-task-pickers-DQ1qvgrD.js +0 -1
  253. package/web/dist/assets/alert-dialog-B_2uU4Bg.js +0 -1
  254. package/web/dist/assets/arrow-down-DieVZxSE.js +0 -1
  255. package/web/dist/assets/arrow-left-C8M0efjn.js +0 -1
  256. package/web/dist/assets/automation-format-CzinzpHK.js +0 -1
  257. package/web/dist/assets/automations-route-DYHUjV9R.js +0 -1
  258. package/web/dist/assets/centered-state-DJLgwvA4.js +0 -43
  259. package/web/dist/assets/chevron-left-BhXrOEE3.js +0 -1
  260. package/web/dist/assets/chevron-right-B3Ta8VKK.js +0 -1
  261. package/web/dist/assets/collapsible-BcKvItwg.js +0 -1
  262. package/web/dist/assets/command-BvGGv2_u.js +0 -1
  263. package/web/dist/assets/compare-variants-DBvMYMs3.js +0 -1
  264. package/web/dist/assets/dashboard-CGaFh4RV.js +0 -44
  265. package/web/dist/assets/dialog-B6NgKh0-.js +0 -1
  266. package/web/dist/assets/diff-controls-DskkZqmD.js +0 -1
  267. package/web/dist/assets/dist-BvXEdcbG.js +0 -1
  268. package/web/dist/assets/dist-CTksUkKh.js +0 -1
  269. package/web/dist/assets/dropdown-menu-B7HeKCfN.js +0 -1
  270. package/web/dist/assets/editable-title-BHbHmSIK.js +0 -1
  271. package/web/dist/assets/facet-filter-DZ3wfvN9.js +0 -1
  272. package/web/dist/assets/git-toolbar-EZuX4Cuz.js +0 -1
  273. package/web/dist/assets/github-zcLRxv77.js +0 -1
  274. package/web/dist/assets/index-BrZhA4_u.css +0 -2
  275. package/web/dist/assets/index-CSNFuBvj.js +0 -12
  276. package/web/dist/assets/loader-circle-Cwgo6onL.js +0 -1
  277. package/web/dist/assets/new-task-form-CQODCzBP.js +0 -1
  278. package/web/dist/assets/picker-pill-DNB9ETjS.js +0 -1
  279. package/web/dist/assets/popover-BRq6QnwI.js +0 -1
  280. package/web/dist/assets/project-router-I8Pbsrxy.js +0 -1
  281. package/web/dist/assets/repo-git-G436Abni.js +0 -1
  282. package/web/dist/assets/run-header-CxdaA86t.js +0 -1
  283. package/web/dist/assets/skills-C_kBDesq.js +0 -1
  284. package/web/dist/assets/task-changes-Bhw4Ysvg.js +0 -1
  285. package/web/dist/assets/task-commits-DBuGXuGm.js +0 -1
  286. package/web/dist/assets/task-files-CYDbeffM.js +0 -2
  287. package/web/dist/assets/task-thread-RuxHMJgN.js +0 -9
  288. package/web/dist/assets/thread-loading-BAuVAbcA.js +0 -1
  289. package/web/dist/assets/token-metrics-rVl4kXe_.js +0 -1
  290. package/web/dist/assets/tooltip-Bdl8mQG8.js +0 -1
  291. package/web/dist/assets/tracker-DJ8JW59-.js +0 -4
  292. package/web/dist/assets/utils-DoBmOlX3.js +0 -64
  293. package/web/dist/assets/workflows-C54D7mlm.js +0 -7
  294. package/web/dist/assets/x-HXr9KZBr.js +0 -1
@@ -0,0 +1,12 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dashboard-B3-tPimG.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-runtime-CCIEwYL0.js","assets/toaster-CfRVb8vH.js","assets/utils-BXvEm7Ve.js","assets/bundle-mjs-BT31bpU6.js","assets/facet-filter-CfI4QvOd.js","assets/use-now-3lElDuTi.js","assets/x-kLybIvX4.js","assets/dist-DpiX6WjA.js","assets/popover-CNGONAql.js","assets/dist-BqMwqJFX.js","assets/command-Dfln3D4A.js","assets/dialog-CiDREdUK.js","assets/segmented-IDD4ucht.js","assets/tooltip-_O50N3pt.js","assets/circle-x-C0Jm5Ppb.js","assets/git-pull-request-AhwzJc7s.js","assets/triangle-alert-D5K_zyD3.js","assets/token-metrics-DldVlr6m.js","assets/automation-format-CfPmkcsg.js","assets/project-router-dCZQu1wQ.js","assets/chevron-right-KVZcXiPL.js","assets/download-BR7EN9gW.js","assets/format-DHK74MwW.js","assets/task-thread-RXabJAt0.js","assets/editable-title-DDtUgRKZ.js","assets/dropdown-menu-Ci4HFML0.js","assets/folder-zQj-FYOo.js","assets/new-task-form-vLs2G1_z.js","assets/sparkles-CvOeAoyJ.js","assets/square-terminal-eSs8YYZe.js","assets/arrow-down-Da0kNRNH.js","assets/thread-loading-Dnxb6Ar-.js","assets/loader-circle-sk4vKJKp.js","assets/skills-9oR_oHse.js","assets/centered-state-3r2Kaar_.js","assets/prompt-templates-jNjVTAws.js","assets/use-submit-shortcut-BJ10ZshV.js","assets/run-header-Br1yJR0m.js","assets/trash-2-CUH7GOVh.js","assets/ellipsis-vertical-DBklom4U.js","assets/file-text-Dm6CrEGW.js","assets/collapsible-DG_SIWqU.js","assets/alert-dialog-CnRAuqwb.js","assets/diff-stat-Hupj4hxh.js","assets/pill-CPl6sysj.js","assets/markdown-DjNR-1p8.js","assets/chunk-BO2N2NFS-DE6qKn3r.js","assets/lib-BxQXEXDF.js","assets/highlighter-CdHqIwFr.js","assets/tab-link-CPF6ORha.js","assets/picker-pill-VW-M1ZiV.js","assets/search-x-CT0NTqK1.js","assets/textarea-DtBqPhIs.js","assets/lib-BQXq3kEf.js","assets/zoomable-image-CnyQ9wyw.js","assets/run-diff-u_roDsAJ.js","assets/compare-variants-D6Ji6od4.js","assets/task-changes-DIT9Y1rh.js","assets/diff-controls-DqJMMV4z.js","assets/diff-CxdyRumG.js","assets/image-preview-Dd3NVB7N.js","assets/git-toolbar-j7gKkhGL.js","assets/file-CZb7cKNH.js","assets/upload-D7_n-9cl.js","assets/task-files-BMm9C0DW.js","assets/task-commits-B4VvdiHH.js","assets/arrow-left-BIZHhBIP.js","assets/commit-list-_RA72yB_.js","assets/repo-git-BZWZ6_pR.js","assets/github-De-DFy8s.js","assets/chevron-left-DLAUPC66.js","assets/refresh-cw-BfkEydKA.js","assets/agent-task-pickers-BeQi-UTm.js","assets/tracker-J0fdcH1G.js","assets/workflows-D-dx9c_0.js","assets/skill-empty-hint-oOtzR3v0.js","assets/skills-Dsi5YdLG.js","assets/automations-route-AMJbFP53.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,n,r,t as i}from"./react-runtime-CCIEwYL0.js";import{$i as a,$n as o,$r as s,A as c,Ai as l,Ar as u,B as d,Bi as f,Bn as p,Br as m,Bt as h,Ci as g,D as _,Di as v,Dn as y,Dt as b,E as x,Ei as S,En as C,F as w,Fi as T,Fn as E,G as D,Gi as O,Gr as k,Gt as A,Hi as j,Ht as M,I as N,In as P,It as F,Ji as I,Jn as ee,Jt as te,Ki as ne,Kr as re,Kt as ie,L as ae,Li as L,Lt as R,Mi as oe,Mn as se,Mr as ce,N as le,Ni as ue,Nn as de,Oi as fe,On as pe,Or as me,P as he,Pi as ge,Pn as _e,Q as z,Qi as ve,Qr as ye,Qt as be,R as xe,Ri as Se,Rr as Ce,Rt as we,S as Te,Si as Ee,St as De,T as Oe,Ti as ke,Tn as Ae,U as je,Ui as Me,Un as Ne,Ur as Pe,Ut as Fe,V as Ie,Vi as Le,Vn as Re,Vt as ze,Wi as Be,Wn as Ve,Xi as He,Xt as Ue,Yi as We,Yr as Ge,Yt as Ke,Zi as qe,Zn as Je,Zt as Ye,_ as B,_n as Xe,_t as Ze,a as Qe,ai as $e,an as et,ar as tt,at as nt,bt as rt,c as it,ci as at,cn as V,dn as ot,dt as st,ea as ct,ei as lt,f as ut,fn as dt,ft,g as pt,gn as mt,h as ht,hn as gt,ht as _t,ii as vt,in as yt,it as bt,j as xt,ji as St,jn as Ct,ki as H,kn as wt,l as Tt,li as Et,ln as Dt,m as Ot,mn as kt,mt as At,n as U,nn as jt,o as Mt,on as Nt,p as Pt,pt as Ft,qi as It,qr as Lt,qt as Rt,r as W,rn as zt,rr as Bt,s as Vt,si as Ht,sn as Ut,st as Wt,t as Gt,ta as Kt,tn as qt,tt as Jt,u as Yt,ui as Xt,un as Zt,ut as Qt,v as $t,vi as en,vn as tn,vr as nn,vt as rn,wi as an,wn as on,wr as sn,wt as cn,x as ln,xi as un,xn as dn,xt as fn,y as pn,yr as mn,yt as hn,z as gn,zi as _n,zn as vn,zt as yn}from"./toaster-CfRVb8vH.js";import{L as bn,N as xn,c as Sn,f as Cn,n as wn,p as Tn,r as G,t as K,u as En}from"./utils-BXvEm7Ve.js";import{i as Dn}from"./bundle-mjs-BT31bpU6.js";import{a as On,c as kn,i as An,l as jn,n as Mn,o as Nn,r as Pn,s as Fn,t as In,u as Ln}from"./facet-filter-CfI4QvOd.js";import{a as Rn,c as zn,i as Bn,n as Vn,r as Hn,s as Un,t as Wn}from"./use-now-3lElDuTi.js";import{A as Gn,C as Kn,E as qn,O as Jn,S as Yn,T as Xn,c as Zn,j as Qn,k as $n,l as er,n as tr,t as nr,v as rr,w as ir,x as ar,y as or}from"./editable-title-DDtUgRKZ.js";import{t as sr}from"./arrow-down-Da0kNRNH.js";import{a as cr,c as lr,d as ur,f as dr,i as fr,n as pr,r as mr,s as hr,t as gr,u as _r}from"./tooltip-_O50N3pt.js";import{a as vr,i as yr,n as br,r as xr,s as Sr,t as Cr}from"./thread-loading-Dnxb6Ar-.js";import{i as wr,n as Tr,r as Er,s as Dr,t as Or}from"./popover-CNGONAql.js";import{t as kr}from"./chevron-right-KVZcXiPL.js";import{c as Ar,d as jr,f as Mr,i as Nr,l as Pr,m as Fr,n as Ir,p as Lr,r as Rr,s as zr,t as Br,u as Vr}from"./dropdown-menu-Ci4HFML0.js";import{a as Hr,c as Ur,i as Wr,n as Gr,o as Kr,s as qr,t as Jr}from"./picker-pill-VW-M1ZiV.js";import{t as Yr}from"./folder-zQj-FYOo.js";import{t as Xr}from"./loader-circle-sk4vKJKp.js";import{a as Zr,c as Qr,d as $r,f as ei,i as ti,l as ni,m as ri,n as ii,o as ai,p as oi,r as si,s as ci,t as li,u as ui}from"./new-task-form-vLs2G1_z.js";import{t as di}from"./search-x-CT0NTqK1.js";import{a as fi,c as pi,i as mi,l as hi,n as gi,o as _i,r as vi,s as yi,t as bi,u as xi}from"./command-Dfln3D4A.js";import{t as Si}from"./sparkles-CvOeAoyJ.js";import{t as Ci}from"./triangle-alert-D5K_zyD3.js";import{t as wi}from"./x-kLybIvX4.js";import{a as Ti,c as Ei,i as Di,n as Oi,o as ki,r as Ai,s as ji,t as Mi}from"./alert-dialog-CnRAuqwb.js";import{a as Ni,i as Pi,n as Fi,o as Ii,r as Li,t as Ri}from"./dist-BqMwqJFX.js";import{a as zi,i as Bi,n as Vi,o as Hi,r as Ui,s as Wi,t as Gi}from"./dialog-CiDREdUK.js";import{a as Ki,c as qi,i as Ji,l as Yi,n as Xi,o as Zi,r as Qi,s as $i,t as q}from"./project-router-dCZQu1wQ.js";import{a as ea,i as ta,r as na,t as ra}from"./token-metrics-DldVlr6m.js";import{n as ia}from"./format-DHK74MwW.js";import{a as aa,c as oa,d as sa,f as ca,i as la,l as ua,o as da,s as fa,t as pa,u as ma}from"./skills-9oR_oHse.js";import{t as ha}from"./diff-stat-Hupj4hxh.js";import{n as ga,r as _a,t as va}from"./pill-CPl6sysj.js";import{n as ya,t as J}from"./centered-state-3r2Kaar_.js";import{t as ba}from"./textarea-DtBqPhIs.js";import{a as xa,i as Sa,n as Ca,o as wa,r as Ta,s as Ea,t as Da}from"./prompt-templates-jNjVTAws.js";import{n as Oa}from"./use-submit-shortcut-BJ10ZshV.js";import{t as ka}from"./markdown-DjNR-1p8.js";import{i as Aa,n as ja,r as Ma}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 Na=class extends Kt{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 Le({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=Pa(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=Pa(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=Pa(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=Pa(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Be.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=>I(t,e))}findAll(e={}){return this.getAll().filter(t=>I(e,t))}notify(e){Be.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Be.batch(()=>Promise.all(e.map(e=>e.continue().catch(He))))}};function Pa(e){return e.options.scope?.id}var Fa=class extends Kt{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??It(r,t),a=this.get(i);return a||(a=new j({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(){Be.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=>We(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>We(e,t)):t}notify(e){Be.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Be.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Be.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Ia=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Fa,this.#t=e.mutationCache||new Na,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=ct.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Me.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(ve(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=O(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Be.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;Be.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Be.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=Be.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(He).catch(He)}invalidateQueries(e,t={}){return Be.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=Be.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(He)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(He)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(ve(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(He).catch(He)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(He).catch(He)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Me.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(ne(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{qe(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(ne(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{qe(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=It(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===a&&(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()}},Y=e(t(),1),La=n();function Ra(e){let t=e.container;if(t===void 0)return{hasContainer:!1,cpuLimited:!1,cpuCores:e.cpuCount,...e.cpuPct===void 0?{}:{cpuPct:e.cpuPct},cpuIsEffective:!1,memLimited:!1,memTotalBytes:e.memTotalBytes,...e.memUsedBytes===void 0?{}:{memUsedBytes:e.memUsedBytes},memIsEffective:!1,cgroupUnknown:e.cgroupProbe===`unavailable`};let n=t.cpuQuotaCores!==void 0||t.cpuAffinityCores!==void 0,r=t.cpuQuotaCores===void 0?t.cpuAffinityCores===void 0?void 0:`cpuset`:`quota`,i=n?Math.min(e.cpuCount,e.hostCpuCount??1/0,t.cpuQuotaCores??1/0,t.cpuAffinityCores??1/0):e.cpuCount,a=t.memLimitBytes!==void 0,o=n?t.cpuPct:e.cpuPct,s=a?t.memUsedBytes:e.memUsedBytes;return{hasContainer:!0,source:t.source,cpuLimited:n,...r===void 0?{}:{cpuLimitKind:r},cpuCores:i,...o===void 0?{}:{cpuPct:o},cpuIsEffective:n,memLimited:a,memTotalBytes:a?t.memLimitBytes??e.memTotalBytes:e.memTotalBytes,...s===void 0?{}:{memUsedBytes:s},memIsEffective:a,...e.hostCpuCount===void 0?{}:{hostCpuCount:e.hostCpuCount},cgroupUnknown:e.cgroupProbe===`unavailable`}}function za(e){let t=Math.round(e*10)/10;return`${Number.isInteger(t)?t:t.toFixed(1)} CPU`}function Ba(e,t){let n=tn(t);if(e===void 0)return`— / ${n}`;let r=tn(e),i=n.split(` `)[1];return i!==void 0&&r.endsWith(` ${i}`)?`${r.slice(0,-(i.length+1))}/${n}`:`${r}/${n}`}function Va(){let[e,t]=(0,Y.useState)(()=>typeof window.matchMedia!=`function`||window.matchMedia(`(min-width: 768px)`).matches);return(0,Y.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(min-width: 768px)`),n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}var X=i(),Ha=2500,Ua=(e,t)=>new Promise((n,r)=>{if(t?.aborted){r(new DOMException(`Aborted`,`AbortError`));return}let i=()=>{clearTimeout(a),r(new DOMException(`Aborted`,`AbortError`))},a=setTimeout(()=>{t?.removeEventListener(`abort`,i),n()},e);t?.addEventListener(`abort`,i,{once:!0})});async function Wa(e){let t=await me({signal:e});return t.cpuPct===void 0?(await Ua(Ha,e),me({signal:e})):t}function Ga(){let e=z().data;if(e!==void 0)return e.capabilities?.localHandoff===!0?`local`:`remote`}var Ka=Object.freeze([]),qa=Object.freeze({history:Ka});function Ja(){let e=qa,t,n=new Set;return{subscribe(e){return n.add(e),()=>n.delete(e)},get:()=>e,push(r,i,a){let o=e,s=t!==void 0&&t!==a;t=a;let c=o.latest?.sampledAt===r.sampledAt;if(c&&o.latest===r&&o.lastFrameAt===i&&!s)return;let l=o.history[o.history.length-1],u=!c&&l!==void 0&&Date.parse(r.sampledAt)-Date.parse(l.sampledAt)>8e3,d=a!==`route`,f=s||u||!d?[]:o.history,p=Ra(r).cpuPct,m=f[f.length-1];e={latest:r,lastFrameAt:i,history:d&&p!==void 0&&m?.sampledAt!==r.sampledAt?[...f,{sampledAt:r.sampledAt,receivedAt:i,cpuPct:p}].slice(-30):f,...o.topicUnavailable===!0?{topicUnavailable:!0}:{}};for(let e of n)e()},markTopicUnavailable(){if(e.topicUnavailable!==!0){e={...e,topicUnavailable:!0};for(let e of n)e()}},reset(){t=void 0,e=qa;for(let e of n)e()}}}var Ya=(0,Y.createContext)(null);function Xa({children:e}){let[t]=(0,Y.useState)(Ja);return(0,X.jsxs)(Ya.Provider,{value:t,children:[e,(0,X.jsx)(Za,{})]})}function Za(){return ao(),null}var Qa=()=>()=>void 0;function $a(){let e=(0,Y.useContext)(Ya);return(0,Y.useSyncExternalStore)(e?e.subscribe:Qa,()=>e?.get().latest,()=>void 0)}function eo(){let e=(0,Y.useContext)(Ya);return(0,Y.useSyncExternalStore)(e?e.subscribe:Qa,()=>e?.get().history??qa.history,()=>qa.history)}function to(){let e=(0,Y.useContext)(Ya);return(0,Y.useSyncExternalStore)(e?e.subscribe:Qa,()=>e?.get().lastFrameAt,()=>void 0)}function no(){let e=(0,Y.useContext)(Ya);return(0,Y.useSyncExternalStore)(e?e.subscribe:Qa,()=>e?.get().topicUnavailable===!0,()=>!1)}function ro(){let e=$a(),t=to(),[n,r]=(0,Y.useState)(()=>Date.now());if((0,Y.useEffect)(()=>{let e=setInterval(()=>r(Date.now()),1e3);return()=>clearInterval(e)},[]),e===void 0)return;let i=Date.parse(e.sampledAt);return Number.isNaN(i)?t===void 0?void 0:Math.max(0,Math.round((n-t)/1e3)):Math.max(0,Math.round((n-i)/1e3))}function io(e,t){let n=(0,Y.useContext)(Ya),r=Ga();(0,Y.useEffect)(()=>{if(!(!n||!t||r!==`local`))return Zt(`host`,t=>{let r=Cn.safeParse(t);r.success&&n.push(r.data,Date.now(),e)},()=>n.markTopicUnavailable())},[n,t,r,e])}function ao(){io(`root`,Va())}function oo(e={}){io(`card`,e.enabled??!0)}function so(){let e=(0,Y.useContext)(Ya),t=Ga(),n=no(),r=Se({queryKey:V.hostUsage,queryFn:({signal:e})=>Wa(e),enabled:t===`remote`||n,staleTime:0,retry:!1}),i=r.data;return(0,Y.useEffect)(()=>{!e||i===void 0||e.push(i,Date.now(),`route`)},[e,i]),r}function co(){return new Ia({defaultOptions:{queries:{refetchInterval:!1,staleTime:5*6e4,gcTime:30*6e4,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:(e,t)=>t instanceof Re&&t.status>=400&&t.status<500?!1:e<1},mutations:{retry:!1}}})}var lo=G(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),uo=G(`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`}]]),fo=G(`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`}]]),po=G(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),mo=G(`chevrons-left`,[[`path`,{d:`m11 17-5-5 5-5`,key:`13zhaf`}],[`path`,{d:`m18 17-5-5 5-5`,key:`h8a8et`}]]),ho=G(`chevrons-right`,[[`path`,{d:`m6 17 5-5-5-5`,key:`xnjwq`}],[`path`,{d:`m13 17 5-5-5-5`,key:`17xmmf`}]]),go=G(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),_o=G(`coins`,[[`path`,{d:`M13.744 17.736a6 6 0 1 1-7.48-7.48`,key:`bq4yh3`}],[`path`,{d:`M15 6h1v4`,key:`11y1tn`}],[`path`,{d:`m6.134 14.768.866-.5 2 3.464`,key:`17snzx`}],[`circle`,{cx:`16`,cy:`8`,r:`6`,key:`14bfc9`}]]),vo=G(`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`}]]),yo=G(`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`}]]),bo=G(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),xo=G(`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`}]]),So=G(`file-diff`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M9 10h6`,key:`9gxzsh`}],[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`path`,{d:`M9 17h6`,key:`r8uit2`}]]),Co=G(`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`}]]),wo=G(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),To=G(`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`}]]),Eo=G(`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`}]]),Do=G(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),Oo=G(`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`}]]),ko=G(`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`}]]),Ao=G(`id-card`,[[`path`,{d:`M16 10h2`,key:`8sgtl7`}],[`path`,{d:`M16 14h2`,key:`epxaof`}],[`path`,{d:`M6.17 15a3 3 0 0 1 5.66 0`,key:`n6f512`}],[`circle`,{cx:`9`,cy:`11`,r:`2`,key:`yxgjnd`}],[`rect`,{x:`2`,y:`5`,width:`20`,height:`14`,rx:`2`,key:`qneu4z`}]]),jo=G(`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`}]]),Mo=G(`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`}]]),No=G(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),Po=G(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),Fo=G(`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`}]]),Io=G(`memory-stick`,[[`path`,{d:`M12 12v-2`,key:`fwoke6`}],[`path`,{d:`M12 18v-2`,key:`qj6yno`}],[`path`,{d:`M16 12v-2`,key:`heuere`}],[`path`,{d:`M16 18v-2`,key:`s1ct0w`}],[`path`,{d:`M2 11h1.5`,key:`15p63e`}],[`path`,{d:`M20 18v-2`,key:`12ehxp`}],[`path`,{d:`M20.5 11H22`,key:`khsy7a`}],[`path`,{d:`M4 18v-2`,key:`1c3oqr`}],[`path`,{d:`M8 12v-2`,key:`1mwtfd`}],[`path`,{d:`M8 18v-2`,key:`qcmpov`}],[`rect`,{x:`2`,y:`6`,width:`20`,height:`10`,rx:`2`,key:`1qcswk`}]]),Lo=G(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),Ro=G(`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`}]]),zo=G(`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`}]]),Bo=G(`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`}]]),Vo=G(`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`}]]),Ho=G(`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`}]]),Uo=G(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Wo=G(`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`}]]),Go=G(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Ko=G(`split`,[[`path`,{d:`M16 3h5v5`,key:`1806ms`}],[`path`,{d:`M8 3H3v5`,key:`15dfkv`}],[`path`,{d:`M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3`,key:`1qrqzj`}],[`path`,{d:`m15 9 6-6`,key:`ko1vev`}]]),qo=G(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Jo=G(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),Yo=G(`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`}]]),Xo=G(`ticket`,[[`path`,{d:`M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z`,key:`qn84l0`}],[`path`,{d:`M13 5v2`,key:`dyzc3o`}],[`path`,{d:`M13 17v2`,key:`1ont0d`}],[`path`,{d:`M13 11v2`,key:`1wjjxi`}]]),Zo=G(`unplug`,[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]),Qo=G(`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`}]]),$o={jira:{label:`Jira`,scopeLabel:`Jira projects`},linear:{label:`Linear`,scopeLabel:`Linear teams`}},es=bn.options.map(e=>({kind:e,...$o[e]}));function ts(e){let t=Y.useRef({value:e,previous:e});return Y.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var ns=`Label`,rs=Y.forwardRef((e,t)=>(0,X.jsx)(pn.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));rs.displayName=ns;var is=rs;function as(e,[t,n]){return Math.min(n,Math.max(t,e))}var os=e(r(),1),ss=[` `,`Enter`,`ArrowUp`,`ArrowDown`],cs=[` `,`Enter`],ls=`Select`,[us,ds,fs]=Lr(ls),[ps,ms]=$t(ls,[fs,Ni]),hs=Ni(),[gs,_s]=ps(ls),[vs,ys]=ps(ls),bs=`SelectProvider`;function xs(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m,internal_do_not_use_render:h}=e,g=hs(t),[_,v]=Y.useState(null),[y,b]=Y.useState(null),[x,S]=Y.useState(!1),C=Mr(l),[w,T]=ht({prop:r,defaultProp:i??!1,onChange:a,caller:ls}),[E,D]=ht({prop:o,defaultProp:s,onChange:c,caller:ls}),O=Y.useRef(null),k=Y.useRef(E);Y.useEffect(()=>{let e=m?_?.ownerDocument.getElementById(m):_?.form;if(e instanceof HTMLFormElement){let t=()=>D(k.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[m,_,D]);let A=!_||!!m||!!_.closest(`form`),[j,M]=Y.useState(new Set),N=Pt(),P=Array.from(j).map(e=>e.props.value).join(`;`),F=Y.useCallback(e=>{M(t=>new Set(t).add(e))},[]),I=Y.useCallback(e=>{M(t=>{let n=new Set(t);return n.delete(e),n})},[]),ee={required:p,trigger:_,onTriggerChange:v,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:x,onValueNodeHasChildrenChange:S,contentId:N,value:E,onValueChange:D,open:w,onOpenChange:T,dir:C,triggerPointerDownPosRef:O,disabled:f,name:u,autoComplete:d,form:m,nativeOptions:j,nativeSelectKey:P,isFormControl:A};return(0,X.jsx)(Pi,{...g,children:(0,X.jsx)(gs,{scope:t,...ee,children:(0,X.jsx)(us.Provider,{scope:t,children:(0,X.jsx)(vs,{scope:t,onNativeOptionAdd:F,onNativeOptionRemove:I,children:xc(h)?h(ee):n})})})})}xs.displayName=bs;var Ss=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,X.jsx)(xs,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,X.jsxs)(X.Fragment,{children:[n,e?(0,X.jsx)(bc,{__scopeSelect:t}):null]})})};Ss.displayName=ls;var Cs=`SelectTrigger`,ws=Y.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=hs(n),o=_s(Cs,n),s=o.disabled||r,c=Oe(t,o.onTriggerChange),l=ds(n),u=Y.useRef(`touch`),[d,f,p]=Cc(e=>{let t=l().filter(e=>!e.disabled),n=wc(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,X.jsx)(Ri,{asChild:!0,...a,children:(0,X.jsx)(pn.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":Sc(o.value)?``:void 0,...i,ref:c,onClick:B(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:B(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:B(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&ss.includes(e.key)&&(m(),e.preventDefault())})})})});ws.displayName=Cs;var Ts=`SelectValue`,Es=Y.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=_s(Ts,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=Oe(t,c.onValueNodeChange);pt(()=>{l(u)},[l,u]);let f=Sc(c.value);return(0,X.jsx)(pn.span,{...s,asChild:!f&&s.asChild,ref:d,style:{pointerEvents:`none`},children:(0,X.jsx)(Y.Fragment,{children:f?o:a},f?`placeholder`:`value`)})});Es.displayName=Ts;var Ds=`SelectIcon`,Os=Y.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,X.jsx)(pn.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});Os.displayName=Ds;var ks=`SelectPortal`,[As,js]=ps(ks,{forceMount:void 0}),Ms=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,X.jsx)(As,{scope:e.__scopeSelect,forceMount:n,children:(0,X.jsx)(it,{asChild:!0,...r})})};Ms.displayName=ks;var Ns=`SelectContent`,Ps=Y.forwardRef((e,t)=>{let n=js(Ns,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=_s(Ns,e.__scopeSelect),[o,s]=Y.useState();return pt(()=>{s(new DocumentFragment)},[]),(0,X.jsx)(Ot,{present:r||a.open,children:({present:e})=>e?(0,X.jsx)(Vs,{...i,ref:t}):(0,X.jsx)(Fs,{...i,fragment:o})})});Ps.displayName=Ns;var Fs=Y.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?os.createPortal((0,X.jsx)(Ls,{scope:n,children:(0,X.jsx)(us.Slot,{scope:n,children:(0,X.jsx)(`div`,{ref:t,children:r})})}),i):null});Fs.displayName=`SelectContentFragment`;var Is=10,[Ls,Rs]=ps(Ns),zs=`SelectContentImpl`,Bs=Te(`SelectContent.RemoveScroll`),Vs=Y.forwardRef((e,t)=>{let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,v=_s(Ns,n),[y,b]=Y.useState(null),[x,S]=Y.useState(null),C=Oe(t,b),[w,T]=Y.useState(null),[E,D]=Y.useState(null),O=ds(n),[k,A]=Y.useState(!1),j=Y.useRef(!1);Y.useEffect(()=>{if(y)return Qe(y)},[y]),Vt();let M=Y.useCallback(e=>{let[t,...n]=O().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&x&&(x.scrollTop=0),n===r&&x&&(x.scrollTop=x.scrollHeight),n?.focus(),document.activeElement!==i))return},[O,x]),N=Y.useCallback(()=>M([w,y]),[M,w,y]);Y.useEffect(()=>{k&&N()},[k,N]);let{onOpenChange:P,triggerPointerDownPosRef:F}=v;Y.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(F.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(F.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(y)||P(!1),document.removeEventListener(`pointermove`,t),F.current=null};return F.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[y,P,F]),Y.useEffect(()=>{let e=()=>P(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[P]);let[I,ee]=Cc(e=>{let t=O().filter(e=>!e.disabled),n=wc(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),te=Y.useCallback((e,t,n)=>{let r=!j.current&&!n;(v.value!==void 0&&v.value===t||r)&&(T(e),r&&(j.current=!0))},[v.value]),ne=Y.useCallback(()=>y?.focus(),[y]),re=Y.useCallback((e,t,n)=>{let r=!j.current&&!n;(v.value!==void 0&&v.value===t||r)&&D(e)},[v.value]),ie=r===`popper`?Gs:Us,ae=ie===Gs?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,X.jsx)(Ls,{scope:n,content:y,viewport:x,onViewportChange:S,itemRefCallback:te,selectedItem:w,onItemLeave:ne,itemTextRefCallback:re,focusSelectedItem:N,selectedItemText:E,position:r,isPositioned:k,searchRef:I,children:(0,X.jsx)(Mt,{as:Bs,allowPinchZoom:!0,children:(0,X.jsx)(Tt,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:B(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,X.jsx)(Yt,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,X.jsx)(ie,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...ae,onPlaced:()=>A(!0),ref:C,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:B(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ee(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=O().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>M(t)),e.preventDefault()}})})})})})})});Vs.displayName=zs;var Hs=`SelectItemAlignedPosition`,Us=Y.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=_s(Ns,n),o=Rs(Ns,n),[s,c]=Y.useState(null),[l,u]=Y.useState(null),d=Oe(t,u),f=ds(n),p=Y.useRef(!1),m=Y.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=Y.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Is,d=as(a,[Is,Math.max(Is,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Is,d=as(a,[Is,Math.max(Is,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-Is*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-Is,D=c-E,O=g.offsetHeight/2,k=g.offsetTop+O,A=m+v+k,j=x-A;if(A<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,h.scrollTop=A-E+h.offsetTop}s.style.margin=`${Is}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);pt(()=>y(),[y]);let[b,x]=Y.useState();return pt(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]),(0,X.jsx)(Ks,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:Y.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]),children:(0,X.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:b},children:(0,X.jsx)(pn.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});Us.displayName=Hs;var Ws=`SelectPopperPosition`,Gs=Y.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Is,...a}=e,o=hs(n);return(0,X.jsx)(Li,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});Gs.displayName=Ws;var[Ks,qs]=ps(Ns,{}),Js=`SelectViewport`,Ys=Y.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=Rs(Js,n),o=qs(Js,n),s=Oe(t,a.onViewportChange),c=Y.useRef(0);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,X.jsx)(us.Slot,{scope:n,children:(0,X.jsx)(pn.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:B(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-Is*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});Ys.displayName=Js;var Xs=`SelectGroup`,[Zs,Qs]=ps(Xs),$s=Y.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Pt();return(0,X.jsx)(Zs,{scope:n,id:i,children:(0,X.jsx)(pn.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});$s.displayName=Xs;var ec=`SelectLabel`,tc=Y.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Qs(ec,n);return(0,X.jsx)(pn.div,{id:i.id,...r,ref:t})});tc.displayName=ec;var nc=`SelectItem`,[rc,ic]=ps(nc),ac=Y.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=_s(nc,n),c=Rs(nc,n),l=s.value===r,[u,d]=Y.useState(a??``),[f,p]=Y.useState(!1),m=Oe(t,ut(e=>c.itemRefCallback?.(e,r,i))),h=Pt(),g=Y.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};return(0,X.jsx)(rc,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:Y.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,X.jsx)(us.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,X.jsx)(pn.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:B(o.onFocus,()=>p(!0)),onBlur:B(o.onBlur,()=>p(!1)),onClick:B(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:B(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:B(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:B(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:B(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:B(o.onKeyDown,e=>{i||e.target!==e.currentTarget||c.searchRef?.current!==``&&e.key===` `||(cs.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});ac.displayName=nc;var oc=`SelectItemText`,sc=Y.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=_s(oc,n),s=Rs(oc,n),c=ic(oc,n),l=ys(oc,n),[u,d]=Y.useState(null),f=ut(e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=Oe(t,d,c.onItemTextChange,f),m=u?.textContent,h=Y.useMemo(()=>(0,X.jsx)(`option`,{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=l;return pt(()=>(g(h),()=>_(h)),[g,_,h]),(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(pn.span,{id:c.textId,...a,ref:p}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!Sc(o.value)?os.createPortal(a.children,o.valueNode):null]})});sc.displayName=oc;var cc=`SelectItemIndicator`,lc=Y.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return ic(cc,n).isSelected?(0,X.jsx)(pn.span,{"aria-hidden":!0,...r,ref:t}):null});lc.displayName=cc;var uc=`SelectScrollUpButton`,dc=Y.forwardRef((e,t)=>{let n=Rs(uc,e.__scopeSelect),r=qs(uc,e.__scopeSelect),[i,a]=Y.useState(!1),o=Oe(t,r.onScrollButtonChange);return pt(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;a(e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,X.jsx)(mc,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});dc.displayName=uc;var fc=`SelectScrollDownButton`,pc=Y.forwardRef((e,t)=>{let n=Rs(fc,e.__scopeSelect),r=qs(fc,e.__scopeSelect),[i,a]=Y.useState(!1),o=Oe(t,r.onScrollButtonChange);return pt(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;a(n)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,X.jsx)(mc,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});pc.displayName=fc;var mc=Y.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Rs(`SelectScrollButton`,n),o=Y.useRef(null),s=ds(n),c=Y.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return Y.useEffect(()=>()=>c(),[c]),pt(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,X.jsx)(pn.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:B(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:B(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:B(i.onPointerLeave,()=>{c()})})}),hc=`SelectSeparator`,gc=Y.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,X.jsx)(pn.div,{"aria-hidden":!0,...r,ref:t})});gc.displayName=hc;var _c=`SelectArrow`,vc=Y.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=hs(n);return Rs(_c,n).position===`popper`?(0,X.jsx)(Fi,{...i,...r,ref:t}):null});vc.displayName=_c;var yc=`SelectBubbleInput`,bc=Y.forwardRef(({__scopeSelect:e,...t},n)=>{let r=_s(yc,e),{value:i,onValueChange:a,required:o,disabled:s,name:c,autoComplete:l,form:u}=r,{nativeOptions:d,nativeSelectKey:f}=r,p=Y.useRef(null),m=Oe(n,p),h=i??``,g=ts(h),_=Array.from(d).some(e=>(e.props.value??``)===``);return Y.useEffect(()=>{let e=p.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(g!==h&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,h),e.dispatchEvent(t)}},[g,h]),(0,X.jsxs)(pn.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:s,form:u,onChange:e=>a(e.target.value),...t,style:{..._r,...t.style},ref:m,defaultValue:h,children:[Sc(i)&&!_?(0,X.jsx)(`option`,{value:``}):null,Array.from(d)]},f)});bc.displayName=yc;function xc(e){return typeof e==`function`}function Sc(e){return e===``||e===void 0}function Cc(e){let t=ut(e),n=Y.useRef(``),r=Y.useRef(0),i=Y.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=Y.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return Y.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function wc(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Tc(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function Tc(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Ec=`Switch`,[Dc,Oc]=$t(Ec),[kc,Ac]=Dc(Ec);function jc(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]=ht({prop:n,defaultProp:i??!1,onChange:c,caller:Ec}),[m,h]=Y.useState(null),[g,_]=Y.useState(null),v={checked:f,setChecked:p,disabled:a,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:Y.useRef(!1),required:l,defaultChecked:i,isFormControl:!m||!!o||!!m.closest(`form`),bubbleInput:g,setBubbleInput:_};return(0,X.jsx)(kc,{scope:t,...v,children:zc(d)?d(v):r})}var Mc=`SwitchTrigger`,Nc=Y.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}=Ac(Mc,e),h=Oe(r,u),g=Y.useRef(c);return Y.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,X.jsx)(pn.button,{type:`button`,role:`switch`,"aria-checked":c,"aria-required":l,"data-state":Bc(c),"data-disabled":s?``:void 0,disabled:s,value:o,...n,ref:h,onClick:B(t,e=>{d(e=>!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});Nc.displayName=Mc;var Pc=Y.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,X.jsx)(jc,{__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,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Nc,{...d,ref:t,__scopeSwitch:n}),e&&(0,X.jsx)(Rc,{__scopeSwitch:n})]})})});Pc.displayName=Ec;var Fc=`SwitchThumb`,Ic=Y.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=Ac(Fc,n);return(0,X.jsx)(pn.span,{"data-state":Bc(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});Ic.displayName=Fc;var Lc=`SwitchBubbleInput`,Rc=Y.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}=Ac(Lc,e),m=Oe(n,p),h=ts(a),g=Ii(r);Y.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 _=Y.useRef(a);return(0,X.jsx)(pn.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??_.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%)`}})});Rc.displayName=Lc;function zc(e){return typeof e==`function`}function Bc(e){return e?`checked`:`unchecked`}var Vc=`Tabs`,[Hc,Uc]=$t(Vc,[jr]),Wc=jr(),[Gc,Kc]=Hc(Vc),qc=Y.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=Mr(s),[d,f]=ht({prop:r,onChange:i,defaultProp:a??``,caller:Vc});return(0,X.jsx)(Gc,{scope:n,baseId:Pt(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,X.jsx)(pn.div,{dir:u,"data-orientation":o,...l,ref:t})})});qc.displayName=Vc;var Jc=`TabsList`,Yc=Y.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=Kc(Jc,n),o=Wc(n);return(0,X.jsx)(Vr,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,X.jsx)(pn.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});Yc.displayName=Jc;var Xc=`TabsTrigger`,Zc=Y.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=Kc(Xc,n),s=Wc(n),c=el(o.baseId,r),l=tl(o.baseId,r),u=r===o.value;return(0,X.jsx)(Pr,{asChild:!0,...s,focusable:!i,active:u,children:(0,X.jsx)(pn.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:B(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:B(e.onKeyDown,e=>{i||e.target!==e.currentTarget||[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:B(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});Zc.displayName=Xc;var Qc=`TabsContent`,$c=Y.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=Kc(Qc,n),c=el(s.baseId,r),l=tl(s.baseId,r),u=r===s.value,d=Y.useRef(u);return Y.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,X.jsx)(Ot,{present:i||u,children:({present:n})=>(0,X.jsx)(pn.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});$c.displayName=Qc;function el(e,t){return`${e}-trigger-${t}`}function tl(e,t){return`${e}-content-${t}`}var nl=qc,rl=Yc,il=Zc,al=$c,ol=x(`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 sl({className:e,variant:t=`default`,asChild:n=!1,...r}){return(0,X.jsx)(n?ln:`span`,{"data-slot":`badge`,"data-variant":t,className:K(ol({variant:t}),e),...r})}var cl=`x-apple.systempreferences:com.apple.preference.security?Privacy_FilesAndFolders`,ll=`inline-flex items-center gap-1 rounded-md border border-border px-2 py-1 text-foreground hover:bg-muted`;function ul(e){let t=e.replace(/[\\/]+$/,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return n<0?null:n===0?t.slice(0,1):t.slice(0,n)}function dl({path:e,selected:t,onSelect:n,onEnter:r,decorate:i,emptyHint:a,showHidden:o=!1}){let s=D(e,o),c=s.data?.parent??null;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{"data-slot":`fs-breadcrumb`,className:`truncate font-mono text-[11.5px] text-soft-foreground`,title:s.data?.path??void 0,children:s.data?.path??(s.isError?``:`Loading…`)}),s.isError?(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,X.jsx)(`p`,{"data-slot":`fs-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:s.error instanceof Error?s.error.message:`could not list that folder`}),s.error instanceof Re&&s.error.status===403?(0,X.jsx)(`p`,{"data-slot":`fs-privacy-hint`,className:`text-[12.5px] text-soft-foreground`,children:`Allow it under Privacy & Security ▸ Files & Folders, then try again.`}):null,(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-[12.5px]`,children:[e!==null&&ul(e)!==null?(0,X.jsxs)(`button`,{type:`button`,"data-slot":`fs-error-back`,onClick:()=>r(ul(e)),className:ll,children:[(0,X.jsx)(yo,{className:`size-3.5`,"aria-hidden":!0}),`Back`]}):null,s.error instanceof Re&&s.error.status===403?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`a`,{"data-slot":`fs-privacy-settings`,href:cl,target:`_blank`,rel:`noreferrer`,className:ll,children:`Open Privacy Settings`}),(0,X.jsx)(`button`,{type:`button`,"data-slot":`fs-retry`,onClick:()=>void s.refetch(),className:ll,children:`Try again`})]}):null]})]}):(0,X.jsxs)(`ul`,{"data-slot":`fs-listing`,className:`max-h-64 divide-y divide-border/60 overflow-y-auto overscroll-contain rounded-md border border-border`,children:[c===null?null:(0,X.jsx)(`li`,{className:`flex`,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`fs-up`,onClick:()=>r(c),className:`flex flex-1 items-center gap-2 px-3 py-2 text-left text-[13px] hover:bg-muted`,children:[(0,X.jsx)(yo,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),`Up one level`]})}),(s.data?.dirs??[]).map(e=>(0,X.jsxs)(`li`,{className:`flex items-stretch`,children:[(0,X.jsxs)(`button`,{type:`button`,"data-slot":`fs-dir`,"aria-pressed":t?.path===e.path,onClick:()=>n(e),onDoubleClick:()=>r(e.path),className:K(`flex min-w-0 flex-1 items-center gap-2 px-3 py-2 text-left text-[13px] hover:bg-muted`,t?.path===e.path&&`bg-muted`),children:[(0,X.jsx)(Yr,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`truncate`,children:e.name}),i?.(e)]}),(0,X.jsx)(`button`,{type:`button`,"data-slot":`fs-enter`,"aria-label":`Open ${e.name}`,onClick:()=>r(e.path),className:`flex shrink-0 items-center px-2.5 text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,X.jsx)(kr,{className:`size-3.5`,"aria-hidden":`true`})})]},e.path)),s.data&&s.data.dirs.length===0?(0,X.jsx)(`li`,{className:`px-3 py-2 text-[13px] text-muted-foreground`,children:a}):null]}),s.data?.truncated?(0,X.jsx)(`p`,{"data-slot":`fs-truncated`,className:`text-[11.5px] text-muted-foreground`,children:`Too many folders to list — only the first ones are shown.`}):null]})}function fl(e,t,n=!1){let r=D(e,n);return t?.path??r.data?.path??null}function pl({open:e,onOpenChange:t}){let[n,r]=(0,Y.useState)(null),[i,a]=(0,Y.useState)(null),o=st(),s=rt(),c=ue(),l=new Set((o.data?.projects??[]).filter(e=>!e.unregistered).map(e=>e.root)),u=e=>{r(e),a(null),s.reset()},d=fl(n,i);return(0,X.jsx)(Gi,{open:e,onOpenChange:t,children:(0,X.jsxs)(Ui,{"data-slot":`add-project-dialog`,className:`sm:max-w-lg`,children:[(0,X.jsxs)(Hi,{children:[(0,X.jsx)(Wi,{children:`Open local folder`}),(0,X.jsx)(Bi,{children:`Pick the folder cezar should run in. Git repos are marked; any folder works.`})]}),(0,X.jsx)(dl,{path:n,selected:i,onSelect:a,onEnter:u,emptyHint:`No subfolders here — “Add project” registers this folder.`,decorate:e=>(0,X.jsxs)(X.Fragment,{children:[e.isRepo?(0,X.jsx)(sl,{variant:`outline`,className:`shrink-0 text-[10px]`,children:`git`}):null,l.has(e.path)?(0,X.jsx)(sl,{variant:`ghost`,className:`shrink-0 text-[10px] text-muted-foreground`,children:`already added`}):null]})}),s.isError?(0,X.jsx)(`p`,{"data-slot":`add-project-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:s.error instanceof Error?s.error.message:`could not add that folder`}):null,(0,X.jsxs)(zi,{className:`min-w-0 sm:items-center sm:justify-between`,children:[(0,X.jsx)(`span`,{"data-slot":`add-project-target`,className:`min-w-0 truncate font-mono text-[11.5px] text-muted-foreground`,title:d??void 0,children:d??``}),(0,X.jsxs)(`span`,{className:`flex shrink-0 gap-2`,children:[(0,X.jsx)(W,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsx)(W,{"data-slot":`add-project-confirm`,disabled:d===null||s.isPending,onClick:()=>{d===null||s.isPending||s.mutate(d,{onSuccess:({project:e})=>{t(!1),c(`/p/${encodeURIComponent(e.id)}/`)}})},children:s.isPending?`Adding…`:`Add project`})]})]})]})})}function ml({className:e,type:t,...n}){return(0,X.jsx)(`input`,{type:t,"data-slot":`input`,className:K(`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 hl({className:e,...t}){return(0,X.jsx)(is,{"data-slot":`label`,className:K(`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 gl(e){return e instanceof Error?e.message.match(/https:\/\/github\.com\/orgs\/[A-Za-z0-9._-]+\/sso\?authorization_request=[A-Za-z0-9._~-]+(?![^\s'"<>])/)?.[0]??null:null}function _l({open:e,onOpenChange:t}){let[n,r]=(0,Y.useState)(``),[i,a]=(0,Y.useState)(``),[o,s]=(0,Y.useState)(null),[c,l]=(0,Y.useState)(!1),u=(0,Y.useRef)(!1),d=st(),f=gn(),{mutate:p,isPending:m}=f,h=ue(),g=gl(f.error),_=(0,Y.useMemo)(()=>`co-${Math.random().toString(36).slice(2)}-${Date.now().toString(36)}`,[]),v=(0,Y.useRef)(_);v.current=_,(0,Y.useEffect)(()=>jn((e,t)=>{if(e!==`checkout-progress`)return;let n=t;n?.checkoutId===v.current&&(n.phase===`cloning`&&n.line?s(n.line):n.phase!==`cloning`&&s(null))}),[]);let y=(0,Y.useMemo)(()=>{let e=n.trim().replace(/\/+$/,``).replace(/\.git$/,``).split(`/`).pop()??``;return e.includes(`:`)?e.split(`:`).pop()??``:e},[n]),b=i.trim()===``?y:i.trim(),x=d.data?.projectsDir??``,S=b===``?``:`${x.replace(/\/+$/,``)}/${b}`,C=(0,Y.useCallback)(()=>{n.trim()===``||m||(u.current=!1,l(!1),s(null),p({url:n.trim(),checkoutId:_,...i.trim()===``?{}:{name:i.trim()}},{onSuccess:({project:e})=>{t(!1),h(`/p/${encodeURIComponent(e.id)}/`)}}))},[p,m,_,i,h,t,n]);return(0,Y.useEffect)(()=>{if(!c)return;let e=()=>{u.current&&(u.current=!1,l(!1),C())},t=()=>{document.visibilityState===`visible`&&e()};return window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,t)}},[c,C]),(0,X.jsx)(Gi,{open:e,onOpenChange:e=>f.isPending?void 0:t(e),children:(0,X.jsxs)(Ui,{"data-slot":`clone-project-dialog`,className:`min-w-0 max-h-[calc(100dvh-2rem)] overflow-x-hidden overflow-y-auto sm:max-w-lg`,children:[(0,X.jsxs)(Hi,{children:[(0,X.jsx)(Wi,{children:`Clone from GitHub`}),(0,X.jsxs)(Bi,{children:[`cezar clones with `,(0,X.jsx)(`code`,{children:`gh`}),` into your checkout root and adds the result as a project.`]})]}),(0,X.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,X.jsx)(hl,{htmlFor:`clone-url`,children:`Repository`}),(0,X.jsx)(ml,{id:`clone-url`,"data-slot":`clone-url`,autoFocus:!0,placeholder:`owner/repo or https://github.com/owner/repo`,value:n,disabled:f.isPending,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&C()}})]}),(0,X.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,X.jsx)(hl,{htmlFor:`clone-name`,children:`Folder name`}),(0,X.jsx)(ml,{id:`clone-name`,"data-slot":`clone-name`,placeholder:y===``?`repo`:y,value:i,disabled:f.isPending,onChange:e=>a(e.target.value)}),(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,X.jsx)(`p`,{"data-slot":`clone-target`,className:`min-w-0 flex-1 truncate font-mono text-[11.5px] text-soft-foreground`,title:S,children:S}),f.isPending?(0,X.jsx)(W,{"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,X.jsx)(Go,{className:`size-3.5`,"aria-hidden":`true`})}):(0,X.jsx)(W,{asChild:!0,variant:`ghost`,size:`icon-sm`,className:`size-7`,children:(0,X.jsx)(ke,{to:`/settings/global/projects`,"data-slot":`clone-root-settings`,"aria-label":`Edit checkout root`,title:`Edit checkout root`,children:(0,X.jsx)(Go,{className:`size-3.5`,"aria-hidden":`true`})})})]})]}),f.isPending?(0,X.jsx)(`p`,{"data-slot":`clone-progress`,className:`truncate font-mono text-[11.5px] text-muted-foreground`,children:o??`Starting the clone…`}):null,f.isError?(0,X.jsx)(`div`,{"data-slot":`clone-error`,className:`grid min-w-0 gap-1.5 text-[13px] text-danger`,children:g?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{children:`GitHub requires SAML authorization for this organization.`}),(0,X.jsxs)(`p`,{children:[(0,X.jsx)(`a`,{"data-slot":`clone-sso-link`,className:`font-medium underline underline-offset-2`,href:g,target:`_blank`,rel:`noreferrer`,onClick:()=>{u.current=!0,l(!0)},children:`Authorize this GitHub organization`}),c?` — return here after authorizing, or choose Retry clone.`:` — return to this tab to retry, or choose Retry clone.`]}),(0,X.jsxs)(`details`,{className:`min-w-0`,children:[(0,X.jsx)(`summary`,{children:`Error details`}),(0,X.jsx)(`p`,{className:`whitespace-pre-wrap break-all`,children:f.error instanceof Error?f.error.message:null})]})]}):(0,X.jsx)(`p`,{className:`min-w-0 whitespace-pre-wrap break-all`,children:f.error instanceof Error?f.error.message:`could not clone that repository`})}):null,(0,X.jsxs)(zi,{children:[(0,X.jsx)(W,{variant:`outline`,disabled:f.isPending,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsx)(W,{"data-slot":`clone-confirm`,disabled:n.trim()===``||b===``||f.isPending,onClick:C,children:f.isPending?`Cloning…`:f.isError?`Retry clone`:`Clone`})]})]})})}function vl(e){return(0,X.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,...e,children:(0,X.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 yl=[{to:`/`,label:`Tasks`,icon:Fo,match:[`/`,`/tasks`,`/compare`],badge:`tasks-unread`},{to:`/inbox`,label:`Inbox`,icon:jo,match:[`/inbox`],badge:`inbox-count`,inbox:!0},{to:`/git`,label:`Git`,icon:Oo,match:[`/git`]},{to:`/github`,label:`GitHub`,icon:vl,match:[`/github`],forge:!0},{to:`/tracker`,label:`Tracker`,icon:Xo,match:[`/tracker`],tracker:!0},{to:`/automations`,label:`Automations`,icon:oi,match:[`/automations`],automations:!0},{to:`/skills`,label:`Skills`,icon:Si,match:[`/skills`],badge:`skills-update`},{to:`/workflows`,label:`Workflows`,icon:Qo,match:[`/workflows`]},{to:`/settings`,label:`Settings`,icon:Go,match:[`/settings`]}];function bl({forge:e=!1,inbox:t=!1,automations:n=!1,tracker:r}={}){return yl.filter(i=>(!i.forge||e)&&(!i.inbox||t)&&(!i.automations||n)&&(!i.tracker||r!==void 0)).map(e=>e.tracker?{...e,label:r?$o[r].label:e.label}:e)}function xl(e,t){return t===`/`?e===`/`:e===t||e.startsWith(t+`/`)}function Sl(e){let t=null;for(let n of yl)for(let r of n.match)xl(e,r)&&(t===null||r.length>t.length)&&(t={to:n.to,length:r.length});return t?.to??null}function Cl(e){let t=Sl(e);return yl.find(e=>e.to===t)??null}var wl=`cez-theme`,Tl=`(prefers-color-scheme: light)`,El=`dark`;function Dl(e){return e===`light`||e===`dark`||e===`system`?e:El}function Ol(e,t){return e===`light`||e===`system`&&t?`light`:`dark`}function kl(){try{return Dl(localStorage.getItem(wl))}catch{return El}}function Al(e){try{localStorage.setItem(wl,e)}catch{}}function jl(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(Tl).matches}function Ml(e,t){e.classList.toggle(`light`,t===`light`),e.style.colorScheme=t}var Nl=Y.createContext(null);function Pl({children:e}){let[t,n]=Y.useState(kl),[r,i]=Y.useState(jl);Y.useEffect(()=>{let e=window.matchMedia?.(Tl);if(!e)return;i(e.matches);let t=e=>i(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let a=Ol(t,r);Y.useLayoutEffect(()=>{Ml(document.documentElement,a)},[a]);let o=Y.useCallback(e=>{n(e),Al(e)},[]),s=Y.useMemo(()=>({theme:t,resolvedTheme:a,setTheme:o}),[t,a,o]);return(0,X.jsx)(Nl.Provider,{value:s,children:e})}function Fl(){let e=Y.useContext(Nl);if(!e)throw Error(`cezar: useTheme() must be called inside <ThemeProvider>`);return e}var Il={light:`dark`,dark:`system`,system:`light`},Ll={light:Yo,dark:zo,system:Ro},Rl={light:`light`,dark:`dark`,system:`system`};function zl({className:e}){let{theme:t,setTheme:n}=Fl(),r=Il[t],i=Ll[t];return(0,X.jsx)(W,{type:`button`,variant:`ghost`,size:`icon-sm`,className:e,"data-slot":`theme-toggle`,"data-theme-pref":t,title:`Theme: ${Rl[t]}`,"aria-label":`Theme: ${Rl[t]}. Switch to ${Rl[r]}.`,onClick:()=>n(r),children:(0,X.jsx)(i,{"aria-hidden":`true`})})}function Bl(){var e=[...arguments];return(0,Y.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var Vl=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Hl(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function Ul(e){return`nodeType`in e}function Wl(e){return e?Hl(e)?e:Ul(e)?e.ownerDocument?.defaultView??window:window:window}function Gl(e){let{Document:t}=Wl(e);return e instanceof t}function Kl(e){return!Hl(e)&&e instanceof Wl(e).HTMLElement}function ql(e){return e instanceof Wl(e).SVGElement}function Jl(e){return e?Hl(e)?e.document:Ul(e)?Gl(e)?e:Kl(e)||ql(e)?e.ownerDocument:document:document:document}var Yl=Vl?Y.useLayoutEffect:Y.useEffect;function Xl(e){let t=(0,Y.useRef)(e);return Yl(()=>{t.current=e}),(0,Y.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function Zl(){let e=(0,Y.useRef)(null);return[(0,Y.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,Y.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function Ql(e,t){t===void 0&&(t=[e]);let n=(0,Y.useRef)(e);return Yl(()=>{n.current!==e&&(n.current=e)},t),n}function $l(e,t){let n=(0,Y.useRef)();return(0,Y.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function eu(e){let t=Xl(e),n=(0,Y.useRef)(null);return[n,(0,Y.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function tu(e){let t=(0,Y.useRef)();return(0,Y.useEffect)(()=>{t.current=e},[e]),t.current}var nu={};function ru(e,t){return(0,Y.useMemo)(()=>{if(t)return t;let n=nu[e]==null?0:nu[e]+1;return nu[e]=n,e+`-`+n},[e,t])}function iu(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var au=iu(1),ou=iu(-1);function su(e){return`clientX`in e&&`clientY`in e}function cu(e){if(!e)return!1;let{KeyboardEvent:t}=Wl(e.target);return t&&e instanceof t}function lu(e){if(!e)return!1;let{TouchEvent:t}=Wl(e.target);return t&&e instanceof t}function uu(e){if(lu(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return su(e)?{x:e.clientX,y:e.clientY}:null}var du=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[du.Translate.toString(e),du.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),fu=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function pu(e){return e.matches(fu)?e:e.querySelector(fu)}var mu={display:`none`};function hu(e){let{id:t,value:n}=e;return Y.createElement(`div`,{id:t,style:mu},n)}function gu(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return Y.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function _u(){let[e,t]=(0,Y.useState)(``);return{announce:(0,Y.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var vu=(0,Y.createContext)(null);function yu(e){let t=(0,Y.useContext)(vu);(0,Y.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function bu(){let[e]=(0,Y.useState)(()=>new Set),t=(0,Y.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,Y.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var xu={draggable:`
3
+ To pick up a draggable item, press the space bar.
4
+ While dragging, use the arrow keys to move the item.
5
+ Press space again to drop the item in its new position, or press escape to cancel.
6
+ `},Su={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function Cu(e){let{announcements:t=Su,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=xu}=e,{announce:a,announcement:o}=_u(),s=ru(`DndLiveRegion`),[c,l]=(0,Y.useState)(!1);if((0,Y.useEffect)(()=>{l(!0)},[]),yu((0,Y.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=Y.createElement(Y.Fragment,null,Y.createElement(hu,{id:r,value:i.draggable}),Y.createElement(gu,{id:s,announcement:o}));return n?(0,os.createPortal)(u,n):u}var wu;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(wu||={});function Tu(){}function Eu(e,t){return(0,Y.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function Du(){var e=[...arguments];return(0,Y.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var Ou=Object.freeze({x:0,y:0});function ku(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function Au(e,t){let n=uu(e);if(!n)return`0 0`;let r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+`% `+r.y+`%`}function ju(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Mu(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Nu(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function Pu(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function Fu(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var Iu=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=Fu(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=ku(Fu(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(ju)},Lu=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=Nu(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=Nu(r),o=i.reduce((e,t,r)=>e+ku(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(ju)};function Ru(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var zu=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=Ru(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(Mu)};function Bu(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Vu(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Ou}function Hu(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var Uu=Hu(1);function Wu(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Gu(e,t,n){let r=Wu(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var Ku={ignoreTransform:!1};function qu(e,t){t===void 0&&(t=Ku);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=Wl(e).getComputedStyle(e);t&&(n=Gu(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function Ju(e){return qu(e,{ignoreTransform:!0})}function Yu(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Xu(e,t){return t===void 0&&(t=Wl(e).getComputedStyle(e)),t.position===`fixed`}function Zu(e,t){t===void 0&&(t=Wl(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`&&n.test(r)})}function Qu(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(Gl(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!Kl(i)||ql(i)||n.includes(i))return n;let a=Wl(e).getComputedStyle(i);return i!==e&&Zu(i,a)&&n.push(i),Xu(i,a)?n:r(i.parentNode)}return e?r(e):n}function $u(e){let[t]=Qu(e,1);return t??null}function ed(e){return!Vl||!e?null:Hl(e)?e:Ul(e)?Gl(e)||e===Jl(e).scrollingElement?window:Kl(e)?e:null:null}function td(e){return Hl(e)?e.scrollX:e.scrollLeft}function nd(e){return Hl(e)?e.scrollY:e.scrollTop}function rd(e){return{x:td(e),y:nd(e)}}var id;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(id||={});function ad(e){return!Vl||!e?!1:e===document.scrollingElement}function od(e){let t={x:0,y:0},n=ad(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var sd={x:.2,y:.2};function cd(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=sd);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=od(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=id.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=id.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=id.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=id.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function ld(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function ud(e){return e.reduce((e,t)=>au(e,rd(t)),Ou)}function dd(e){return e.reduce((e,t)=>e+td(t),0)}function fd(e){return e.reduce((e,t)=>e+nd(t),0)}function pd(e,t){if(t===void 0&&(t=qu),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);$u(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var md=[[`x`,[`left`,`right`],dd],[`y`,[`top`,`bottom`],fd]],hd=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=Qu(t),r=ud(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of md)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},gd=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function _d(e){let{EventTarget:t}=Wl(e);return e instanceof t?e:Jl(e)}function vd(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t&&r>t.y}var yd;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(yd||={});function bd(e){e.preventDefault()}function xd(e){e.stopPropagation()}var Z;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(Z||={});var Sd={start:[Z.Space,Z.Enter],cancel:[Z.Esc],end:[Z.Space,Z.Enter,Z.Tab]},Cd=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Z.Right:return{...n,x:n.x+25};case Z.Left:return{...n,x:n.x-25};case Z.Down:return{...n,y:n.y+25};case Z.Up:return{...n,y:n.y-25}}},wd=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new gd(Jl(t)),this.windowListeners=new gd(Wl(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(yd.Resize,this.handleCancel),this.windowListeners.add(yd.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(yd.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&pd(n),t(Ou)}handleKeyDown(e){if(cu(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=Sd,coordinateGetter:a=Cd,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:Ou;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=ou(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=od(n),p=ld(n),m={x:Math.min(i===Z.Right?p.right-p.width/2:p.right,Math.max(i===Z.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===Z.Down?p.bottom-p.height/2:p.bottom,Math.max(i===Z.Down?p.top:p.top+p.height/2,u.y))},h=i===Z.Right&&!s||i===Z.Left&&!c,g=i===Z.Down&&!l||i===Z.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===Z.Right&&e<=d.x||i===Z.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===Z.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===Z.Down&&e<=d.y||i===Z.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===Z.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,au(ou(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};wd.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=Sd,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function Td(e){return!!(e&&`distance`in e)}function Ed(e){return!!(e&&`delay`in e)}var Dd=class{constructor(e,t,n){n===void 0&&(n=_d(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=Jl(i),this.documentListeners=new gd(this.document),this.listeners=new gd(n),this.windowListeners=new gd(Wl(i)),this.initialCoordinates=uu(r)??Ou,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(yd.Resize,this.handleCancel),this.windowListeners.add(yd.DragStart,bd),this.windowListeners.add(yd.VisibilityChange,this.handleCancel),this.windowListeners.add(yd.ContextMenu,bd),this.documentListeners.add(yd.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Ed(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(Td(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(yd.Click,xd,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(yd.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=uu(e)??Ou,s=ou(n,o);if(!t&&a){if(Td(a)){if(a.tolerance!=null&&vd(s,a.tolerance))return this.handleCancel();if(vd(s,a.distance))return this.handleStart()}if(Ed(a)&&vd(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===Z.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},Od={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},kd=class extends Dd{constructor(e){let{event:t}=e,n=Jl(t.target);super(e,Od,n)}};kd.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var Ad={move:{name:`mousemove`},end:{name:`mouseup`}},jd;(function(e){e[e.RightClick=2]=`RightClick`})(jd||={});var Md=class extends Dd{constructor(e){super(e,Ad,Jl(e.event.target))}};Md.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===jd.RightClick?!1:(r?.({event:n}),!0)}}];var Nd={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},Pd=class extends Dd{constructor(e){super(e,Nd)}static setup(){return window.addEventListener(Nd.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Nd.move.name,e)};function e(){}}};Pd.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var Fd;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(Fd||={});var Id;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(Id||={});function Ld(e){let{acceleration:t,activator:n=Fd.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=Id.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=zd({delta:d,disabled:!a}),[m,h]=Zl(),g=(0,Y.useRef)({x:0,y:0}),_=(0,Y.useRef)({x:0,y:0}),v=(0,Y.useMemo)(()=>{switch(n){case Fd.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Fd.DraggableRect:return i}},[n,i,c]),y=(0,Y.useRef)(null),b=(0,Y.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,Y.useMemo)(()=>s===Id.TreeOrder?[...l].reverse():l,[s,l]);(0,Y.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of x){if(r?.(e)===!1)continue;let n=l.indexOf(e),i=u[n];if(!i)continue;let{direction:a,speed:s}=cd(e,i,v,t,f);for(let e of[`x`,`y`])p[e][a[e]]||(s[e]=0,a[e]=0);if(s.x>0||s.y>0){h(),y.current=e,m(b,o),g.current=s,_.current=a;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,x,u,JSON.stringify(f)])}var Rd={x:{[id.Backward]:!1,[id.Forward]:!1},y:{[id.Backward]:!1,[id.Forward]:!1}};function zd(e){let{delta:t,disabled:n}=e,r=tu(t);return $l(e=>{if(n||!r||!e)return Rd;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[id.Backward]:e.x[id.Backward]||i.x===-1,[id.Forward]:e.x[id.Forward]||i.x===1},y:{[id.Backward]:e.y[id.Backward]||i.y===-1,[id.Forward]:e.y[id.Forward]||i.y===1}}},[n,t,r])}function Bd(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return $l(e=>t==null?null:r??e??null,[r,t])}function Vd(e,t){return(0,Y.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var Hd;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(Hd||={});var Ud;(function(e){e.Optimized=`optimized`})(Ud||={});var Wd=new Map;function Gd(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,Y.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,Y.useRef)(e),d=g(),f=Ql(d),p=(0,Y.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,Y.useRef)(null),h=$l(t=>{if(d&&!n)return Wd;if(!t||t===Wd||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new hd(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,Y.useEffect)(()=>{u.current=e},[e]),(0,Y.useEffect)(()=>{d||p()},[n,d]),(0,Y.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,Y.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case Hd.Always:return!1;case Hd.BeforeDragging:return n;default:return!n}}}function Kd(e,t){return $l(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function qd(e,t){return Kd(e,t)}function Jd(e){let{callback:t,disabled:n}=e,r=Xl(t),i=(0,Y.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,Y.useEffect)(()=>()=>i?.disconnect(),[i]),i}function Yd(e){let{callback:t,disabled:n}=e,r=Xl(t),i=(0,Y.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,Y.useEffect)(()=>()=>i?.disconnect(),[i]),i}function Xd(e){return new hd(qu(e),e)}function Zd(e,t,n){t===void 0&&(t=Xd);let[r,i]=(0,Y.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=Jd({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=Yd({callback:a});return Yl(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function Qd(e){return Vu(e,Kd(e))}var $d=[];function ef(e){let t=(0,Y.useRef)(e),n=$l(n=>e?n&&n!==$d&&e&&t.current&&e.parentNode===t.current.parentNode?n:Qu(e):$d,[e]);return(0,Y.useEffect)(()=>{t.current=e},[e]),n}function tf(e){let[t,n]=(0,Y.useState)(null),r=(0,Y.useRef)(e),i=(0,Y.useCallback)(e=>{let t=ed(e.target);t&&n(e=>e?(e.set(t,rd(t)),new Map(e)):null)},[]);return(0,Y.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=ed(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,rd(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{ed(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,Y.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>au(e,t),Ou):ud(e):Ou,[e,t])}function nf(e,t){t===void 0&&(t=[]);let n=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{n.current=null},t),(0,Y.useEffect)(()=>{let t=e!==Ou;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?ou(e,n.current):Ou}function rf(e){(0,Y.useEffect)(()=>{if(!Vl)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function af(e,t){return(0,Y.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function of(e){return(0,Y.useMemo)(()=>e?Yu(e):null,[e])}var sf=[];function cf(e,t){t===void 0&&(t=qu);let[n]=e,r=of(n?Wl(n):null),[i,a]=(0,Y.useState)(sf);function o(){a(()=>e.length?e.map(e=>ad(e)?r:new hd(t(e),e)):sf)}let s=Yd({callback:o});return Yl(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function lf(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return Kl(t)?t:e}function uf(e){let{measure:t}=e,[n,r]=(0,Y.useState)(null),i=Yd({callback:(0,Y.useCallback)(e=>{for(let{target:n}of e)if(Kl(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=eu((0,Y.useCallback)(e=>{let n=lf(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,Y.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var df=[{sensor:kd,options:{}},{sensor:wd,options:{}}],ff={current:{}},pf={draggable:{measure:Ju},droppable:{measure:Ju,strategy:Hd.WhileDragging,frequency:Ud.Optimized},dragOverlay:{measure:qu}},mf=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},hf={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new mf,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Tu},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:pf,measureDroppableContainers:Tu,windowRect:null,measuringScheduled:!1},gf={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:Tu,draggableNodes:new Map,over:null,measureDroppableContainers:Tu},_f=(0,Y.createContext)(gf),vf=(0,Y.createContext)(hf);function yf(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new mf}}}function bf(e,t){switch(t.type){case wu.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case wu.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case wu.DragEnd:case wu.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case wu.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new mf(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case wu.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new mf(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case wu.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new mf(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function xf(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,Y.useContext)(_f),a=tu(r),o=tu(n?.id);return(0,Y.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!cu(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=pu(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function Sf(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function Cf(e){return(0,Y.useMemo)(()=>({draggable:{...pf.draggable,...e?.draggable},droppable:{...pf.droppable,...e?.droppable},dragOverlay:{...pf.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function wf(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,Y.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;Yl(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=Vu(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=$u(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var Tf=(0,Y.createContext)({...Ou,scaleX:1,scaleY:1}),Ef;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(Ef||={});var Df=(0,Y.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=df,collisionDetection:o=zu,measuring:s,modifiers:c,...l}=e,[u,d]=(0,Y.useReducer)(bf,void 0,yf),[f,p]=bu(),[m,h]=(0,Y.useState)(Ef.Uninitialized),g=m===Ef.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,Y.useRef)({initial:null,translated:null}),C=(0,Y.useMemo)(()=>_==null?null:{id:_,data:x?.data??ff,rect:S},[_,x]),w=(0,Y.useRef)(null),[T,E]=(0,Y.useState)(null),[D,O]=(0,Y.useState)(null),k=Ql(l,Object.values(l)),A=ru(`DndDescribedBy`,t),j=(0,Y.useMemo)(()=>b.getEnabled(),[b]),M=Cf(s),{droppableRects:N,measureDroppableContainers:P,measuringScheduled:F}=Gd(j,{dragging:g,dependencies:[y.x,y.y],config:M.droppable}),I=Bd(v,_),ee=(0,Y.useMemo)(()=>D?uu(D):null,[D]),te=ke(),ne=qd(I,M.draggable.measure);wf({activeNode:_==null?null:v.get(_),config:te.layoutShiftCompensation,initialRect:ne,measure:M.draggable.measure});let re=Zd(I,M.draggable.measure,ne),ie=Zd(I?I.parentElement:null),ae=(0,Y.useRef)({activatorEvent:null,active:null,activeNode:I,collisionRect:null,collisions:null,droppableRects:N,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),L=b.getNodeFor(ae.current.over?.id),R=uf({measure:M.dragOverlay.measure}),oe=R.nodeRef.current??I,se=g?R.rect??re:null,ce=!!(R.nodeRef.current&&R.rect),le=Qd(ce?null:re),ue=of(oe?Wl(oe):null),de=ef(g?L??I:null),fe=cf(de),pe=Sf(c,{transform:{x:y.x-le.x,y:y.y-le.y,scaleX:1,scaleY:1},activatorEvent:D,active:C,activeNodeRect:re,containerNodeRect:ie,draggingNodeRect:se,over:ae.current.over,overlayNodeRect:R.rect,scrollableAncestors:de,scrollableAncestorRects:fe,windowRect:ue}),me=ee?au(ee,y):null,he=tf(de),ge=nf(he),_e=nf(he,[re]),z=au(pe,ge),ve=se?Uu(se,pe):null,ye=C&&ve?o({active:C,collisionRect:ve,droppableRects:N,droppableContainers:j,pointerCoordinates:me}):null,be=Pu(ye,`id`),[xe,Se]=(0,Y.useState)(null),Ce=Bu(ce?pe:au(pe,_e),xe?.rect??null,re),we=(0,Y.useRef)(null),Te=(0,Y.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(w.current==null)return;let i=v.get(w.current);if(!i)return;let a=e.nativeEvent,o=new n({active:w.current,activeNode:i,event:a,options:r,context:ae,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=k.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=k.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=w.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=k.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:S}};(0,os.unstable_batchedUpdates)(()=>{r?.(i),h(Ef.Initializing),d({type:wu.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),E(we.current),O(a)})},onMove(e){d({type:wu.DragMove,coordinates:e})},onEnd:s(wu.DragEnd),onCancel:s(wu.DragCancel)});we.current=o;function s(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=ae.current,o=null;if(t&&i){let{cancelDrop:s}=k.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===wu.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=wu.DragCancel)}w.current=null,(0,os.unstable_batchedUpdates)(()=>{d({type:e}),h(Ef.Uninitialized),Se(null),E(null),O(null),we.current=null;let t=e===wu.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=k.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),Ee=Vd(a,(0,Y.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(w.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},w.current=r,Te(n,t))},[v,Te]));rf(a),Yl(()=>{re&&m===Ef.Initializing&&h(Ef.Initialized)},[re,m]),(0,Y.useEffect)(()=>{let{onDragMove:e}=k.current,{active:t,activatorEvent:n,collisions:r,over:i}=ae.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:z.x,y:z.y},over:i};(0,os.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[z.x,z.y]),(0,Y.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=ae.current;if(!e||w.current==null||!t||!i)return;let{onDragOver:a}=k.current,o=r.get(be),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,os.unstable_batchedUpdates)(()=>{Se(s),a?.(c),f({type:`onDragOver`,event:c})})},[be]),Yl(()=>{ae.current={activatorEvent:D,active:C,activeNode:I,collisionRect:ve,collisions:ye,droppableRects:N,draggableNodes:v,draggingNode:oe,draggingNodeRect:se,droppableContainers:b,over:xe,scrollableAncestors:de,scrollAdjustedTranslate:z},S.current={initial:se,translated:ve}},[C,I,ye,ve,v,oe,se,N,b,xe,de,z]),Ld({...te,delta:y,draggingRect:ve,pointerCoordinates:me,scrollableAncestors:de,scrollableAncestorRects:fe});let De=(0,Y.useMemo)(()=>({active:C,activeNode:I,activeNodeRect:re,activatorEvent:D,collisions:ye,containerNodeRect:ie,dragOverlay:R,draggableNodes:v,droppableContainers:b,droppableRects:N,over:xe,measureDroppableContainers:P,scrollableAncestors:de,scrollableAncestorRects:fe,measuringConfiguration:M,measuringScheduled:F,windowRect:ue}),[C,I,re,D,ye,ie,R,v,b,N,xe,P,de,fe,M,F,ue]),Oe=(0,Y.useMemo)(()=>({activatorEvent:D,activators:Ee,active:C,activeNodeRect:re,ariaDescribedById:{draggable:A},dispatch:d,draggableNodes:v,over:xe,measureDroppableContainers:P}),[D,Ee,C,re,d,A,v,xe,P]);return Y.createElement(vu.Provider,{value:p},Y.createElement(_f.Provider,{value:Oe},Y.createElement(vf.Provider,{value:De},Y.createElement(Tf.Provider,{value:Ce},i)),Y.createElement(xf,{disabled:n?.restoreFocus===!1})),Y.createElement(Cu,{...n,hiddenTextDescribedById:A}));function ke(){let e=T?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),Of=(0,Y.createContext)(null),kf=`button`,Af=`Draggable`;function jf(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=ru(Af),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,Y.useContext)(_f),{role:p=kf,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,Y.useContext)(g?Tf:Of),[v,y]=eu(),[b,x]=eu(),S=af(o,t),C=Ql(n);return Yl(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:C}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,Y.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===kf?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:S,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function Mf(){return(0,Y.useContext)(vf)}var Nf=`Droppable`,Pf={timeout:25};function Ff(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=ru(Nf),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,Y.useContext)(_f),u=(0,Y.useRef)({disabled:n}),d=(0,Y.useRef)(!1),f=(0,Y.useRef)(null),p=(0,Y.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...Pf,...i},_=Ql(h??r),v=Yd({callback:(0,Y.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=eu((0,Y.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=Ql(t);return(0,Y.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,Y.useEffect)(()=>(s({type:wu.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:wu.UnregisterDroppable,key:a,id:r})),[r]),(0,Y.useEffect)(()=>{n!==u.current.disabled&&(s({type:wu.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function If(e){let{animation:t,children:n}=e,[r,i]=(0,Y.useState)(null),[a,o]=(0,Y.useState)(null),s=tu(n);return!n&&!r&&s&&i(s),Yl(()=>{if(!a)return;let e=r?.key,n=r?.props.id;if(e==null||n==null){i(null);return}Promise.resolve(t(n,a)).then(()=>{i(null)})},[t,r,a]),Y.createElement(Y.Fragment,null,n,r?(0,Y.cloneElement)(r,{ref:o}):null)}var Lf={x:0,y:0,scaleX:1,scaleY:1};function Rf(e){let{children:t}=e;return Y.createElement(_f.Provider,{value:gf},Y.createElement(Tf.Provider,{value:Lf},t))}var zf={position:`fixed`,touchAction:`none`},Bf=e=>cu(e)?`transform 250ms ease`:void 0,Vf=(0,Y.forwardRef)((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:a,className:o,rect:s,style:c,transform:l,transition:u=Bf}=e;if(!s)return null;let d=i?l:{...l,scaleX:1,scaleY:1},f={...zf,width:s.width,height:s.height,top:s.top,left:s.left,transform:du.Transform.toString(d),transformOrigin:i&&r?Au(r,s):void 0,transition:typeof u==`function`?u(r):u,...c};return Y.createElement(n,{className:o,style:f,ref:t},a)}),Hf={duration:250,easing:`ease`,keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:du.Transform.toString(t)},{transform:du.Transform.toString(n)}]},sideEffects:(e=>t=>{let{active:n,dragOverlay:r}=t,i={},{styles:a,className:o}=e;if(a!=null&&a.active)for(let[e,t]of Object.entries(a.active))t!==void 0&&(i[e]=n.node.style.getPropertyValue(e),n.node.style.setProperty(e,t));if(a!=null&&a.dragOverlay)for(let[e,t]of Object.entries(a.dragOverlay))t!==void 0&&r.node.style.setProperty(e,t);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(let[e,t]of Object.entries(i))n.node.style.setProperty(e,t);o!=null&&o.active&&n.node.classList.remove(o.active)}})({styles:{active:{opacity:`0`}}})};function Uf(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return Xl((e,a)=>{if(t===null)return;let o=n.get(e);if(!o)return;let s=o.node.current;if(!s)return;let c=lf(a);if(!c)return;let{transform:l}=Wl(a).getComputedStyle(a),u=Wu(l);if(!u)return;let d=typeof t==`function`?t:Wf(t);return pd(s,i.draggable.measure),d({active:{id:e,data:o.data,node:s,rect:i.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:u})})}function Wf(e){let{duration:t,easing:n,sideEffects:r,keyframes:i}={...Hf,...e};return e=>{let{active:a,dragOverlay:o,transform:s,...c}=e;if(!t)return;let l={x:o.rect.left-a.rect.left,y:o.rect.top-a.rect.top},u={scaleX:s.scaleX===1?1:a.rect.width*s.scaleX/o.rect.width,scaleY:s.scaleY===1?1:a.rect.height*s.scaleY/o.rect.height},d={x:s.x-l.x,y:s.y-l.y,...u},f=i({...c,active:a,dragOverlay:o,transform:{initial:s,final:d}}),[p]=f,m=f[f.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;let h=r?.({active:a,dragOverlay:o,...c}),g=o.node.animate(f,{duration:t,easing:n,fill:`forwards`});return new Promise(e=>{g.onfinish=()=>{h?.(),e()}})}}var Gf=0;function Kf(e){return(0,Y.useMemo)(()=>{if(e!=null)return Gf++,Gf},[e])}var qf=Y.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:a,modifiers:o,wrapperElement:s=`div`,className:c,zIndex:l=999}=e,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggableNodes:m,droppableContainers:h,dragOverlay:g,over:_,measuringConfiguration:v,scrollableAncestors:y,scrollableAncestorRects:b,windowRect:x}=Mf(),S=(0,Y.useContext)(Tf),C=Kf(d?.id),w=Sf(o,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggingNodeRect:g.rect,over:_,overlayNodeRect:g.rect,scrollableAncestors:y,scrollableAncestorRects:b,transform:S,windowRect:x}),T=Kd(f),E=Uf({config:r,draggableNodes:m,droppableContainers:h,measuringConfiguration:v}),D=T?g.setRef:void 0;return Y.createElement(Rf,null,Y.createElement(If,{animation:E},d&&C?Y.createElement(Vf,{key:C,id:d.id,ref:D,as:s,activatorEvent:u,adjustScale:t,className:c,transition:a,rect:T,style:{zIndex:l,...i},transform:w},n):null))});function Jf(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Yf(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function Xf(e){return e!==null&&e>=0}function Zf(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Qf(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var $f=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=Jf(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},ep={scaleX:1,scaleY:1},tp=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...ep}:null}let s=np(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...ep}:r<t&&r>=a?{x:0,y:o.height+s,...ep}:{x:0,y:0,...ep}};function np(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var rp=`Sortable`,ip=Y.createContext({activeIndex:-1,containerId:rp,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:$f,disabled:{draggable:!1,droppable:!1}});function ap(e){let{children:t,id:n,items:r,strategy:i=$f,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=Mf(),d=ru(rp,n),f=s.rect!==null,p=(0,Y.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,Y.useRef)(p),v=!Zf(p,_.current),y=g!==-1&&h===-1||v,b=Qf(a);Yl(()=>{v&&m&&u(p)},[v,p,m,u]),(0,Y.useEffect)(()=>{_.current=p},[p]);let x=(0,Y.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:Yf(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return Y.createElement(ip.Provider,{value:x},t)}var op=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return Jf(n,r,i).indexOf(t)},sp=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},cp={duration:200,easing:`ease`},lp=`transform`,up=du.Transition.toString({property:lp,duration:0,easing:`linear`}),dp={roleDescription:`sortable`};function fp(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,Y.useState)(null),s=(0,Y.useRef)(n);return Yl(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=qu(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,Y.useEffect)(()=>{a&&o(null)},[a]),a}function pp(e){let{animateLayoutChanges:t=sp,attributes:n,disabled:r,data:i,getNewIndex:a=op,id:o,strategy:s,resizeObserverConfig:c,transition:l=cp}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,Y.useContext)(ip),y=mp(r,p),b=u.indexOf(o),x=(0,Y.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),S=(0,Y.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:C,node:w,isOver:T,setNodeRef:E}=Ff({id:o,data:x,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...c}}),{active:D,activatorEvent:O,activeNodeRect:k,attributes:A,setNodeRef:j,listeners:M,isDragging:N,over:P,setActivatorNodeRef:F,transform:I}=jf({id:o,data:x,attributes:{...dp,...n},disabled:y.draggable}),ee=Bl(E,j),te=!!D,ne=te&&!m&&Xf(f)&&Xf(g),re=!_&&N,ie=ne?(re&&ne?I:null)??(s??v)({rects:h,activeNodeRect:k,activeIndex:f,overIndex:g,index:b}):null,ae=Xf(f)&&Xf(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,L=D?.id,R=(0,Y.useRef)({activeId:L,items:u,newIndex:ae,containerId:d}),oe=u!==R.current.items,se=t({active:D,containerId:d,isDragging:N,isSorting:te,id:o,index:b,items:u,newIndex:R.current.newIndex,previousItems:R.current.items,previousContainerId:R.current.containerId,transition:l,wasDragging:R.current.activeId!=null}),ce=fp({disabled:!se,index:b,node:w,rect:C});return(0,Y.useEffect)(()=>{te&&R.current.newIndex!==ae&&(R.current.newIndex=ae),d!==R.current.containerId&&(R.current.containerId=d),u!==R.current.items&&(R.current.items=u)},[te,ae,d,u]),(0,Y.useEffect)(()=>{if(L===R.current.activeId)return;if(L!=null&&R.current.activeId==null){R.current.activeId=L;return}let e=setTimeout(()=>{R.current.activeId=L},50);return()=>clearTimeout(e)},[L]),{active:D,activeIndex:f,attributes:A,data:x,rect:C,index:b,newIndex:ae,items:u,isOver:T,isSorting:te,isDragging:N,listeners:M,node:w,overIndex:g,over:P,setNodeRef:ee,setActivatorNodeRef:F,setDroppableNodeRef:E,setDraggableNodeRef:j,transform:ce??ie,transition:le()};function le(){if(ce||oe&&R.current.newIndex===b)return up;if(!(re&&!cu(O)||!l)&&(te||se))return du.Transition.toString({...l,property:lp})}}function mp(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function hp(e){if(!e)return!1;let t=e.data.current;return!!(t&&`sortable`in t&&typeof t.sortable==`object`&&`containerId`in t.sortable&&`items`in t.sortable&&`index`in t.sortable)}var gp=[Z.Down,Z.Right,Z.Up,Z.Left],_p=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(gp.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case Z.Down:r.top<a.top&&t.push(n);break;case Z.Up:r.top>a.top&&t.push(n);break;case Z.Left:r.left>a.left&&t.push(n);break;case Z.Right:r.left<a.left&&t.push(n);break}});let c=Lu({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=Pu(c,`id`);if(l===o?.id&&c.length>1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=Qu(c).some((e,t)=>s[t]!==e),i=vp(e,t),a=yp(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:ou(u,l)}}}};function vp(e,t){return!hp(e)||!hp(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function yp(e,t){return!hp(e)||!hp(t)||!vp(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function bp(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e){if(typeof n!=`string`)continue;let e=n.trim();if(!(e===``||t.has(e))&&(t.add(e),t.size>=200))break}return[...t]}function xp(e){return[...e].sort((e,t)=>t.lastOpenedAt.localeCompare(e.lastOpenedAt))}function Sp(e,t){let n=bp(t);if(n.length===0)return xp(e);let r=new Map(n.map((e,t)=>[e,t])),i=[],a=[];for(let t of e)r.has(t.id)?i.push(t):a.push(t);return i.sort((e,t)=>r.get(e.id)-r.get(t.id)),[...xp(a),...i]}function Cp(e,t,n){return t===n||t<0||n<0||t>=e.length||n>=e.length?[...e]:Jf([...e],t,n)}function wp(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function Tp(){let e=f(),t=Nt(),n=Y.useRef(0),r=Y.useRef(Promise.resolve()),i=Y.useMemo(()=>bp(t.data?.sidebar?.projectOrder),[t.data?.sidebar?.projectOrder]),a=Y.useCallback(t=>{let i=e.getQueryData(V.uiState);if(i===void 0)return;let{projectOrder:a,...o}=wp(i.sidebar),s=t===null?o:{...o,projectOrder:t};e.setQueryData(V.uiState,{...i,sidebar:s});let c=++n.current,l=r.current.then(async()=>{let t=await Lt({sidebar:s},{keepalive:!0});c===n.current&&e.setQueryData(V.uiState,t)});r.current=l.catch(t=>{U(t instanceof Error?t.message:String(t),{tone:`danger`}),c===n.current&&e.invalidateQueries({queryKey:V.uiState})})},[e]),o=Y.useCallback(e=>{let t=bp(e);t.length!==0&&a(t.slice(0,200))},[a]),s=Y.useCallback(()=>a(null),[a]);return{order:i,canReorder:t.data!==void 0,setOrder:o,reset:s}}var Ep=`cezar:open-command-palette`;function Dp(){window.dispatchEvent(new Event(Ep))}function Op(e){return[...e].sort((e,t)=>Date.parse(t.createdAt)-Date.parse(e.createdAt))}function kp(e,t,n){let r=t.trim().toLowerCase();if(r===``)return 1;let i=(n?.length?`${e} ${n.join(` `)}`:e).toLowerCase(),a=r.split(/\s+/),o=0;for(let e of a){let t=i.indexOf(e);if(t===-1)return 0;let n=t===0||!/[a-z0-9]/.test(i[t-1]??``);o+=(n?1:.5)/(1+t/48)}return o/a.length}function Ap(e,t,n){let r=Op(e).map(e=>({projectId:t,id:e.id,title:e.title,titleSummary:e.titleSummary,titleOrigin:e.titleOrigin,status:e.status,activity:e.activity,createdAt:e.createdAt,finishedAt:e.finishedAt,seenAt:e.seenAt,archived:e.archived,autoResumeAt:e.autoResumeAt,workflow:e.workflow,branch:e.branch,startedAt:e.startedAt})),i=new Set(r.map(jp)),a=(n??[]).filter(e=>!i.has(jp(e))).sort((e,t)=>t.createdAt.localeCompare(e.createdAt));return[...r,...a]}var jp=e=>`${e.projectId??``}/${e.id}`;function Mp(e){let t=e.filter(e=>Kn(e)).sort((e,t)=>(t.finishedAt??``).localeCompare(e.finishedAt??``)),n=new Set(t.map(jp));return{recentlyFinished:t,otherTasks:e.filter(e=>!n.has(jp(e)))}}function Np(e,t,n=[]){let r=Sp(e,n);return[...r.filter(e=>e.id!==t),...r.filter(e=>e.id===t)]}function Pp(){let[e,t]=Y.useState(!1),n=qi();yr(`k`,()=>t(e=>!e));let r=Y.useCallback(()=>{t(!1),n(`/new`)},[n]);return yr(`n`,r),vr(`c`,r),Y.useEffect(()=>{let e=()=>t(!0);return window.addEventListener(Ep,e),()=>window.removeEventListener(Ep,e)},[]),(0,X.jsx)(gi,{open:e,onOpenChange:t,title:`Command palette`,description:`Search projects, tasks, views, actions, and skills`,showCloseButton:!1,filter:kp,className:`top-[10vh] translate-y-0 sm:max-w-2xl lg:max-w-3xl xl:max-w-4xl`,children:(0,X.jsx)(Ip,{close:()=>t(!1)})})}function Fp({task:e,projectName:t,showProject:n,now:r,onSelect:i}){let a=na(e),o=_e(e);return(0,X.jsxs)(_i,{value:`task ${o} ${e.id}`,keywords:t?[t]:void 0,"data-slot":`palette-task`,"data-run-id":e.id,"data-project-id":e.projectId??void 0,onSelect:()=>i(e),children:[(0,X.jsx)(ea,{tone:a.tone,pulse:a.pulse,"aria-label":a.label,role:`img`}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:o}),n&&t?(0,X.jsx)(`span`,{"data-slot":`palette-task-project`,className:`shrink-0 truncate text-xs text-soft-foreground`,children:t}):null,(0,X.jsx)(`span`,{className:`shrink-0 text-xs text-soft-foreground tabular-nums`,children:ia(e.finishedAt??e.createdAt,r)})]})}function Ip({close:e}){let t=qi(),n=ue(),[r,i]=Y.useState(``),a=r.trim()!==``,o=$i(),{theme:s,setTheme:c}=Fl(),l=st(),u=z(),d=l.data,f=d?.bootProject??u.data?.bootProject??null,p=yn(o,f),m=ie(),g=qt(),v=Date.now(),y=d!==void 0&&d.projects.length>1,b=h(y),{order:x}=Tp(),S=Y.useMemo(()=>y?Np(d.projects,o,x):[],[y,d,o,x]),C=Y.useMemo(()=>new Map((d?.projects??[]).map(e=>[e.id,e.name])),[d]),w=(o==="default"?null:o)??f,T=Y.useMemo(()=>Ap(p.data??[],w,b.data?.runs),[p.data,w,b.data]),E=Y.useMemo(()=>Mp(T),[T]),D=a?[]:E.recentlyFinished,O=a?T:E.otherTasks,k=y,A=e=>e.projectId===null?null:C.get(e.projectId)??null,j=g.data?.skillUsage,M=Y.useMemo(()=>fa(m.data??[],j),[m.data,j]),N=n=>{e(),t(n)},P=t=>{e(),n(t)},F=n=>{e(),t(Ki(n,`/`))},I=n=>{e(),t(n.projectId===null?`/tasks/${n.id}`:Ki(n.projectId,`/tasks/${n.id}`))},ee=Il[s];return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(fi,{placeholder:`Search projects, tasks, views, actions, skills…`,value:r,onValueChange:i}),(0,X.jsxs)(yi,{className:`max-h-[55vh] min-h-[14rem] sm:max-h-[60vh] lg:max-h-[68vh]`,children:[(0,X.jsx)(vi,{children:`Nothing matches.`}),(0,X.jsx)(mi,{children:(0,X.jsxs)(_i,{value:`new task`,"data-slot":`palette-view`,"data-nav-to":`/new`,onSelect:()=>N(`/new`),children:[(0,X.jsx)(Uo,{"aria-hidden":`true`}),`New task`,(0,X.jsx)(hi,{children:`C`})]})}),!a&&D.length>0?(0,X.jsx)(mi,{heading:`Recently finished`,children:D.map(e=>(0,X.jsx)(Fp,{task:e,projectName:A(e),showProject:k,now:v,onSelect:I},jp(e)))}):null,(0,X.jsxs)(mi,{heading:`Views`,children:[y?(0,X.jsxs)(_i,{value:`view All tasks`,"data-slot":`palette-view`,"data-nav-to":`/tasks`,onSelect:()=>P(`/tasks`),children:[(0,X.jsx)(No,{"aria-hidden":`true`}),`All tasks`]}):null,bl({forge:u.data?.forge?.available===!0,inbox:u.data?.capabilities.followups===!0,automations:u.data?.capabilities.automations===!0,tracker:d?.projects.find(e=>e.id===(o??d.bootProject))?.tracker}).map(e=>{let t=e.icon;return(0,X.jsxs)(_i,{value:`view ${e.label}`,"data-slot":`palette-view`,"data-nav-to":e.to,onSelect:()=>N(e.to),children:[(0,X.jsx)(t,{"aria-hidden":`true`}),e.label]},e.to)})]}),S.length>0?(0,X.jsx)(mi,{heading:`Projects`,children:S.map(e=>{let t=e.id===o,n=e.status===`missing`;return(0,X.jsxs)(_i,{value:`project ${e.name} ${e.id}`,keywords:[e.root],"data-slot":`palette-project`,"data-project-id":e.id,disabled:n,onSelect:()=>F(e.id),children:[(0,X.jsx)(wo,{"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),n?(0,X.jsx)(`span`,{className:`shrink-0 text-xs text-soft-foreground`,children:`folder not found`}):e.branch===void 0?null:(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-soft-foreground`,children:e.branch}),t?(0,X.jsx)(_,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e.id)})}):null,O.length>0?(0,X.jsx)(mi,{heading:`Tasks`,children:O.map(e=>(0,X.jsx)(Fp,{task:e,projectName:A(e),showProject:k,now:v,onSelect:I},jp(e)))}):null,(0,X.jsx)(mi,{heading:`Actions`,children:(0,X.jsxs)(_i,{value:`action toggle theme`,"data-slot":`palette-action`,"data-action":`toggle-theme`,onSelect:()=>{c(ee),e()},children:[(0,X.jsx)(zo,{"aria-hidden":`true`}),`Toggle theme`,(0,X.jsxs)(hi,{className:`tracking-normal`,children:[s,` → `,ee]})]})}),M.length>0?(0,X.jsx)(mi,{heading:`Skills`,children:M.map(e=>(0,X.jsxs)(_i,{value:`skill ${e.name} ${e.path}`,keywords:e.description?[e.description]:void 0,"data-slot":`palette-skill`,"data-skill":e.name,onSelect:()=>N(`/new?skill=${encodeURIComponent(e.name)}`),children:[(0,X.jsx)(`span`,{className:`shrink-0 font-medium`,children:e.name}),e.description?(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null]},e.path))}):null]})]})}var Lp=`https://github.com/open-mercato/cezar`,Rp=`cez:star-toast-seen`;function zp(e){if(!Number.isFinite(e)||e<0)return`0`;let t=Math.floor(e);if(t<1e3)return String(t);let n=t/1e3,r=Math.floor(n*10)/10;return r<100?`${r.toFixed(1).replace(/\.0$/,``)}k`:`${Math.floor(n)}k`}var Bp=`cez:star-ask`,Vp=1500;function Hp(e=qp()){if(!e)return null;try{let t=e.getItem(Bp);if(t!==null){let e=JSON.parse(t);return{asks:Number.isInteger(e.asks)&&e.asks>=0?e.asks:3,...typeof e.lastAskedAt==`string`?{lastAskedAt:e.lastAskedAt}:{},...e.outcome===`starred`||e.outcome===`never`?{outcome:e.outcome}:{}}}let n=e.getItem(Rp);return n===null?{asks:0}:{asks:1,lastAskedAt:n}}catch{return null}}function Up(e,t=qp()){try{t?.setItem(Bp,JSON.stringify(e))}catch{}}function Wp(e,t){if(!e||e.outcome||e.asks>=3)return!1;if(!e.lastAskedAt)return!0;let n=Date.parse(e.lastAskedAt);return!Number.isFinite(n)||t-n>=12096e5}function Gp(e){return(e??[]).filter(e=>Jp.has(e.status)).length}function Kp(e){return e.visible&&e.focused&&!e.typing&&!e.dialogOpen&&e.now-e.lastInteractionAt>=0&&e.now-e.lastInteractionAt<=6e4}function qp(){try{return globalThis.localStorage??null}catch{return null}}var Jp=new Set([`done`,`review`]);function Yp(e,t){let n=new Map,r=!1,i=!1;for(let a of t??[]){n.set(a.id,a.status);let t=e.get(a.id);t===void 0||t===a.status||Jp.has(a.status)&&(r=!0,a.pullRequestUrl&&(i=!0))}return{succeeded:r,withPullRequest:i,statuses:n}}var Xp=[`354.6,217.3 511.0,307.6 421.0,359.6 354.6,321.2 267.9,371.2 267.9,471.3 444.6,573.3 354.6,625.3 177.9,523.3 177.9,319.3`,`177.9,284.6 354.6,182.6 354.6,78.7 177.9,180.7`,`354.6,372.3 397.0,396.8 397.0,445.8 354.6,470.3 312.1,445.8 312.1,396.8`,`483.7,372.3 526.1,396.8 526.1,445.8 483.7,470.3 441.2,445.8 441.2,396.8`],Zp={x:177.9,y:78.7,width:348.2,height:546.6},Qp={mark:26,name:19,gap:11.4};function $p({height:e=Qp.mark,className:t}){return(0,X.jsx)(`svg`,{"data-slot":`brand-mark`,"aria-hidden":`true`,focusable:`false`,viewBox:`${Zp.x} ${Zp.y} ${Zp.width} ${Zp.height}`,height:e,width:e*Zp.width/Zp.height,fill:`currentColor`,className:K(`shrink-0`,t),children:Xp.map(e=>(0,X.jsx)(`polygon`,{points:e},e))})}function em({className:e}){return(0,X.jsxs)(`span`,{"data-slot":`brand-lockup`,className:K(`flex min-w-0 items-center text-foreground`,e),style:{gap:Qp.gap},children:[(0,X.jsx)($p,{}),(0,X.jsx)(`span`,{"data-slot":`brand-name`,className:`leading-none font-semibold tracking-normal lowercase`,style:{fontFamily:`var(--brand)`,fontSize:Qp.name},children:`cezar`})]})}function tm({...e}){return(0,X.jsx)(Ss,{"data-slot":`select`,...e})}function nm({...e}){return(0,X.jsx)(Es,{"data-slot":`select-value`,...e})}function rm({className:e,size:t=`default`,children:n,...r}){return(0,X.jsxs)(ws,{"data-slot":`select-trigger`,"data-size":t,className:K(`flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-card px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 hover:bg-muted [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,X.jsx)(Os,{asChild:!0,children:(0,X.jsx)(Dr,{className:`size-4 opacity-50`})})]})}function im({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...i}){return(0,X.jsx)(Ms,{children:(0,X.jsxs)(Ps,{"data-slot":`select-content`,className:K(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...i,children:[(0,X.jsx)(om,{}),(0,X.jsx)(Ys,{className:K(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:t}),(0,X.jsx)(sm,{})]})})}function am({className:e,children:t,...n}){return(0,X.jsxs)(ac,{"data-slot":`select-item`,className:K(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,X.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,X.jsx)(lc,{children:(0,X.jsx)(_,{className:`size-4`})})}),(0,X.jsx)(sc,{children:t})]})}function om({className:e,...t}){return(0,X.jsx)(dc,{"data-slot":`select-scroll-up-button`,className:K(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,X.jsx)(po,{className:`size-4`})})}function sm({className:e,...t}){return(0,X.jsx)(pc,{"data-slot":`select-scroll-down-button`,className:K(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,X.jsx)(Dr,{className:`size-4`})})}function cm(e){let t=/-pr(\d+)\./.exec(e);return t?Number(t[1]):null}function lm({data:e,onApply:t,applying:n}){let r=Fe(),i=hn(),[a,o]=(0,Y.useState)(`worktrees`),[s,c]=(0,Y.useState)(``),[l,u]=(0,Y.useState)(null),[d,f]=(0,Y.useState)(!1),p=e.job?.status===`running`||e.job?.status===`restarting`,m=e.installed.find(e=>e.active),h=r.data?.checkouts??[],g=r.data?.pulls,_=!r.data||h.length>0,v=_?a:`pulls`,y=s.trim().toLowerCase(),b=(0,Y.useMemo)(()=>h.filter(e=>!y||[e.branch,e.task?.title,e.task?.id,e.commit?.subject,e.worktree,e.pr?`#${e.pr}`:``].filter(Boolean).some(e=>e.toLowerCase().includes(y))),[h,y]),x=(0,Y.useMemo)(()=>(g?.items??[]).filter(e=>!e.version&&!d?!1:!y||[`#${e.number}`,String(e.number),e.title,e.branch,e.author??``].some(e=>e.toLowerCase().includes(y))),[g,y,d]),S=(g?.items??[]).filter(e=>!e.version).length,C=v===`worktrees`?h.find(e=>e.id===l):void 0,w=v===`pulls`?g?.items.find(e=>e.version&&e.version===l):void 0,T=C?.id??w?.version??null,E=!!C&&(!C.built||C.stale),D=!!T&&T===m?.id&&!E,O=w&&!w.installed?`Install & restart`:E?`${C.built?`Rebuild`:`Build`} & ${C.id===m?.id?`restart`:`switch`}`:`Switch & restart`;return(0,X.jsxs)(`div`,{"data-slot":`self-update-development`,className:`flex min-w-0 flex-col gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,X.jsx)(`div`,{role:`tablist`,"aria-label":`Development builds`,className:`flex rounded-md border border-border bg-muted/40 p-0.5`,children:[..._?[{value:`worktrees`,label:`Worktrees`,count:h.length}]:[],{value:`pulls`,label:`Pull requests`,count:(g?.items.length??0)-S}].map(e=>(0,X.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":v===e.value,onClick:()=>{o(e.value),u(null)},className:K(`rounded-[5px] px-3 py-1 text-[12.5px] font-semibold transition-colors`,v===e.value?`bg-card text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:[e.label,r.data?(0,X.jsx)(`span`,{className:`ml-1.5 font-normal text-muted-foreground`,children:e.count}):null]},e.value))}),(0,X.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>i.mutate(),disabled:i.isPending||r.isFetching,children:i.isPending?`Refreshing…`:`Refresh`})]}),(0,X.jsx)(ml,{"aria-label":`Filter`,value:s,onChange:e=>c(e.target.value),placeholder:v===`worktrees`?`Filter by task, branch, commit or #PR`:`Filter by #number, title, branch or author`,className:`h-8 text-[13px]`}),(0,X.jsx)(`div`,{className:`max-h-72 min-h-24 overflow-y-auto rounded-md border border-border`,children:r.isPending?(0,X.jsx)(`p`,{className:`px-3 py-3 text-[12.5px] text-muted-foreground`,children:`Looking for worktrees and pull requests…`}):r.error?(0,X.jsx)(`p`,{className:`px-3 py-3 text-[12.5px] text-danger`,children:r.error.message}):v===`worktrees`?(0,X.jsxs)(X.Fragment,{children:[b.length===0?(0,X.jsx)(`p`,{className:`px-3 py-3 text-[12.5px] text-muted-foreground`,children:`Nothing matches.`}):null,(0,X.jsx)(`div`,{role:`listbox`,"aria-label":`Worktrees`,children:b.map(e=>(0,X.jsx)(dm,{checkout:e,active:e.id===m?.id,selected:l===e.id,onSelect:()=>u(e.id)},e.worktree))})]}):(0,X.jsxs)(X.Fragment,{children:[g&&!g.available?(0,X.jsx)(`p`,{className:`px-3 py-2 text-[12px] text-muted-foreground`,children:g.reason}):null,g?.available&&x.length===0?(0,X.jsx)(`p`,{className:`px-3 py-3 text-[12.5px] text-muted-foreground`,children:g.items.length===0?`No open pull requests on ${g.repo}.`:y?`Nothing matches.`:`No open pull request has a preview build.`}):null,(0,X.jsx)(`div`,{role:`listbox`,"aria-label":`Pull requests`,children:x.map(e=>(0,X.jsx)(fm,{pull:e,active:!!e.version&&e.version===m?.id,selected:!!e.version&&l===e.version,onSelect:()=>e.version&&u(e.version)},e.number))}),S>0?(0,X.jsx)(`button`,{type:`button`,onClick:()=>f(e=>!e),className:`w-full border-t border-border px-3 py-2 text-left text-[12px] text-muted-foreground hover:text-foreground`,children:d?`Hide the ${S} without a preview build`:`${S} more without a preview build (forks, CI not green yet) — show`}):null]})}),(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-2`,children:[(0,X.jsx)(`p`,{className:`min-w-0 truncate text-[11.5px] text-muted-foreground`,title:C?.worktree,children:C?E?`${C.built?`Built before its last commit`:`Not built yet`} — runs npm run build in ${C.worktree} first (about a minute).`:C.worktree:w?`Installs ${w.version} from npm.`:v===`worktrees`?`Linked, not copied: a worktree that is not built, or built before its last commit, is built before the switch.`:`Preview builds CI publishes for green same-repo pull requests.`}),(0,X.jsx)(W,{size:`sm`,variant:`contrast`,onClick:()=>T&&t(T),disabled:!T||D||!e.canSelfUpdate||n||p,children:O})]})]})}function um({selected:e,disabled:t,onSelect:n,title:r,children:i}){return(0,X.jsx)(`div`,{role:`option`,"aria-selected":e,"aria-disabled":t,tabIndex:t?-1:0,title:r,onClick:()=>!t&&n(),onKeyDown:e=>{!t&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n())},className:K(`flex min-w-0 flex-col gap-0.5 border-b border-border px-3 py-2 last:border-b-0 outline-none`,t?`cursor-not-allowed opacity-55`:`cursor-pointer hover:bg-muted/50 focus-visible:bg-muted/60`,e&&`bg-primary/10 hover:bg-primary/10`),children:i})}function dm({checkout:e,active:t,selected:n,onSelect:r}){let i=e.task?.title??e.commit?.subject??e.branch;return(0,X.jsxs)(um,{selected:n,disabled:!e.id,onSelect:r,title:e.worktree,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-medium`,children:i}),e.pr?(0,X.jsxs)(sl,{variant:`outline`,children:[`#`,e.pr]}):null,t?(0,X.jsx)(sl,{variant:`secondary`,children:`current`}):null,e.built?e.stale?(0,X.jsx)(sl,{variant:`outline`,children:`needs rebuild`}):null:(0,X.jsx)(sl,{variant:`outline`,children:`not built`})]}),(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-[11.5px] text-muted-foreground`,children:[(0,X.jsx)(`span`,{className:`shrink-0 font-mono`,children:e.branch}),e.task?(0,X.jsxs)(`span`,{className:`shrink-0`,children:[`· `,e.task.status]}):null,e.commit?(0,X.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`· `,e.commit.sha,` `,e.task?e.commit.subject:``,` · `,ia(e.commit.at),` ago`]}):null,e.builtAt?(0,X.jsxs)(`span`,{className:`shrink-0`,children:[`· built `,ia(e.builtAt),` ago`]}):null]})]})}function fm({pull:e,active:t,selected:n,onSelect:r}){return(0,X.jsxs)(um,{selected:n,disabled:!e.version,onSelect:r,title:e.url,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsxs)(`span`,{className:`shrink-0 text-[13px] text-muted-foreground`,children:[`#`,e.number]}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-medium`,children:e.title}),e.draft?(0,X.jsx)(sl,{variant:`outline`,children:`draft`}):null,t?(0,X.jsx)(sl,{variant:`secondary`,children:`current`}):e.version?e.installed?(0,X.jsx)(sl,{variant:`outline`,children:`installed`}):null:(0,X.jsx)(sl,{variant:`outline`,children:`no build`})]}),(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-[11.5px] text-muted-foreground`,children:[e.author?(0,X.jsx)(`span`,{className:`shrink-0`,children:e.author}):null,(0,X.jsxs)(`span`,{className:`min-w-0 truncate font-mono`,children:[`· `,e.branch]}),(0,X.jsxs)(`span`,{className:`shrink-0`,children:[`· updated `,ia(e.updatedAt),` ago`]}),e.version?(0,X.jsxs)(`span`,{className:`shrink-0`,children:[`· build `,e.publishedAt?`${ia(e.publishedAt)} ago`:e.version]}):null]})]})}function pm({open:e,onOpenChange:t,autoApply:n}){let r=M(e),i=rn(),a=A(),o=xe(),[s,c]=(0,Y.useState)(``),l=r.data,u=(0,Y.useRef)(null),d=(0,Y.useRef)(!1);return(0,Y.useEffect)(()=>{!n||d.current||!l||!l.canSelfUpdate||l.job||(d.current=!0,!(l.activeRuns>0)&&o.mutate(n))},[n,l,o]),(0,X.jsx)(Gi,{open:e,onOpenChange:e=>{!e&&l?.job?.status===`running`||t(e)},children:(0,X.jsxs)(Ui,{"data-slot":`self-update-dialog`,className:`sm:max-w-xl`,ref:u,onOpenAutoFocus:e=>{e.preventDefault(),u.current?.focus()},children:[(0,X.jsxs)(Hi,{children:[(0,X.jsxs)(Wi,{className:`flex items-center gap-2`,children:[(0,X.jsxs)(`span`,{children:[`cezar `,l?`v${l.version}`:``]}),(0,X.jsx)(ym,{data:l})]}),(0,X.jsx)(Bi,{className:`sr-only`,children:`Update cezar, pick a release channel or switch versions.`})]}),l?(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-5`,children:[(0,X.jsx)(gm,{data:l,busy:a.isPending,onChange:e=>{c(``),a.mutate(e)}}),(0,X.jsx)(_m,{data:l,checking:i.isPending,onCheck:()=>i.mutate(),onApply:e=>o.mutate(e),applying:o.isPending}),l.channel===`development`?(0,X.jsx)(lm,{data:l,onApply:e=>o.mutate(e),applying:o.isPending}):(0,X.jsx)(vm,{data:l,picked:s,onPick:c,onApply:e=>o.mutate(e),applying:o.isPending}),l.canSelfUpdate?null:(0,X.jsx)(bm,{data:l}),l.activeRuns>0&&l.canSelfUpdate?(0,X.jsxs)(`p`,{className:`rounded-md border border-pending/50 bg-pending/10 px-3 py-2 text-[12.5px] text-foreground`,children:[l.activeRuns,` task`,l.activeRuns===1?` is`:`s are`,` running. A restart interrupts them; cezar re-queues or resumes them on the way back up.`]}):null,a.error?(0,X.jsxs)(`p`,{className:`text-[12.5px] text-danger`,children:[`Could not switch the channel: `,a.error.message,a.variables===`development`?` The running cezar server predates the Development channel — restart cezar to load it.`:null]}):null,o.error?(0,X.jsx)(`p`,{className:`text-[12.5px] text-danger`,children:o.error.message}):null,l.job?(0,X.jsx)(xm,{data:l}):null]}):r.error?(0,X.jsx)(`p`,{className:`text-[13px] text-danger`,children:r.error.message}):null]})})}var mm=[{value:`stable`,label:`Stable`},{value:`nightly`,label:`Nightly`},{value:`development`,label:`Development`}],hm={stable:`Tagged releases.`,nightly:`A fresh build of main every night.`,development:`A cezar worktree or an open pull request. Never updates on its own.`};function gm({data:e,busy:t,onChange:n}){return(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`div`,{className:`text-[13px] font-semibold`,children:`Release channel`}),(0,X.jsx)(`div`,{className:`text-[12px] text-muted-foreground`,children:hm[e.channel]})]}),(0,X.jsx)(`div`,{role:`radiogroup`,"aria-label":`Release channel`,"data-slot":`channel-toggle`,className:`flex shrink-0 rounded-md border border-border bg-muted/40 p-0.5`,children:mm.map(r=>{let i=e.channel===r.value;return(0,X.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":i,disabled:t,onClick:()=>!i&&n(r.value),className:K(`rounded-[5px] px-3 py-1 text-[12.5px] font-semibold transition-colors`,i?`bg-card text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:r.label},r.value)})})]})}function _m({data:e,checking:t,onCheck:n,onApply:r,applying:i}){let a=e.job?.status===`running`||e.job?.status===`restarting`,o=e.installed.find(e=>e.active),s=o?.source===`registry`?cm(o.version):null,c=o&&(o.source===`link`||o.source===`local`||s!==null)?o:null;if(c||e.channel===`development`){let o=e.channel===`development`?null:e.latest[e.channel],l=o!==null&&e.installed.some(e=>e.source===`registry`&&e.id===o);return(0,X.jsxs)(`div`,{"data-slot":`self-update-latest`,className:`flex flex-col gap-2 rounded-md border border-border bg-card px-3 py-2.5`,children:[(0,X.jsx)(`div`,{className:`min-w-0 text-[13px] break-words`,children:c?.source===`link`?(0,X.jsxs)(X.Fragment,{children:[`Running worktree `,(0,X.jsx)(`span`,{className:`font-mono text-[12.5px] font-semibold`,children:c.branch??c.id}),`, not a release.`]}):c?.source===`local`?(0,X.jsx)(X.Fragment,{children:`Running a local build, not a release.`}):s===null?(0,X.jsxs)(X.Fragment,{children:[`Running `,(0,X.jsxs)(`span`,{className:`font-semibold`,children:[`v`,e.version]}),`. Pick a worktree or a pull request below.`]}):(0,X.jsxs)(X.Fragment,{children:[`Running the preview build of `,(0,X.jsxs)(`span`,{className:`font-semibold`,children:[`PR #`,s]}),`, not a release.`]})}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-3 gap-y-2`,children:[(0,X.jsx)(`div`,{className:`min-w-0 text-[11.5px] break-words text-muted-foreground`,children:e.channel===`development`?`Switch the channel back to Stable or Nightly to follow releases again.`:e.checkedAt?(0,X.jsxs)(X.Fragment,{children:[o?(0,X.jsxs)(X.Fragment,{children:[`Newest `,e.channel,`: `,(0,X.jsxs)(`span`,{className:`font-mono text-foreground`,children:[`v`,o]}),` ·`,` `]}):null,`checked `,new Date(e.checkedAt).toLocaleTimeString()]}):`The npm registry has not answered yet.`}),e.channel===`development`?null:(0,X.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[(0,X.jsx)(W,{variant:`ghost`,size:`sm`,onClick:n,disabled:t||a,children:t?`Checking…`:`Check again`}),o?(0,X.jsx)(W,{size:`sm`,"aria-label":l?`Back to v${o}`:`Install v${o} & restart`,onClick:()=>r(o),disabled:!e.canSelfUpdate||i||a,children:l?`Switch back`:`Install & restart`}):null]})]})]})}let l=e.updateAvailable;return(0,X.jsxs)(`div`,{"data-slot":`self-update-latest`,className:K(`flex items-center justify-between gap-3 rounded-md border px-3 py-2.5`,l?`border-primary/40 bg-primary/5`:`border-border bg-card`),children:[(0,X.jsxs)(`div`,{className:`min-w-0 text-[13px]`,children:[e.checkedAt?l?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`span`,{className:`font-semibold`,children:[`v`,l]}),` is available on `,e.channel,`.`]}):(0,X.jsxs)(X.Fragment,{children:[`You are on the newest `,e.channel,` version`,e.channel===`nightly`&&e.latest.nightly?` (v${e.latest.nightly})`:``,`.`]}):(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`The npm registry has not answered yet.`}),e.checkedAt?(0,X.jsxs)(`div`,{className:`text-[11.5px] text-muted-foreground`,children:[`checked `,new Date(e.checkedAt).toLocaleTimeString()]}):null]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,X.jsx)(W,{variant:`ghost`,size:`sm`,onClick:n,disabled:t||a,children:t?`Checking…`:`Check again`}),l?(0,X.jsx)(W,{size:`sm`,onClick:()=>r(l),disabled:!e.canSelfUpdate||i||a,children:`Update & restart`}):null]})]})}function vm({data:e,picked:t,onPick:n,onApply:r,applying:i}){let a=e.job?.status===`running`||e.job?.status===`restarting`,o=(0,Y.useMemo)(()=>{let t=e.channel===`stable`?e.installed.filter(e=>e.source===`local`).map(e=>({value:e.id,label:`v${e.version} · local build`,installed:!0,active:e.active})):[],n=e.available.filter(t=>t.channel===e.channel).map(t=>({value:t.version,label:`v${t.version}${t.publishedAt?` · ${t.publishedAt.slice(0,10)}`:``}`,installed:t.installed,active:e.installed.some(e=>e.active&&e.id===t.version)}));return[...t,...n]},[e]),s=o.find(e=>e.value===t);return(0,X.jsxs)(`div`,{"data-slot":`self-update-picker`,className:`flex min-w-0 flex-col gap-2`,children:[(0,X.jsxs)(`div`,{className:`text-[13px] font-semibold`,children:[`Pick a version `,(0,X.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[`· `,e.channel]})]}),(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsxs)(tm,{value:t,onValueChange:n,disabled:o.length===0||a,children:[(0,X.jsx)(rm,{size:`sm`,"aria-label":`Version`,className:`w-0 min-w-0 flex-1 text-[13px]`,children:(0,X.jsx)(nm,{placeholder:o.length===0?`No versions known`:`Choose a version to install`})}),(0,X.jsx)(im,{className:`max-h-72`,children:o.map(e=>(0,X.jsx)(am,{value:e.value,children:(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e.label,e.active?(0,X.jsx)(sl,{variant:`secondary`,children:`current`}):e.installed?(0,X.jsx)(sl,{variant:`outline`,children:`installed`}):null]})},e.value))})]}),(0,X.jsx)(W,{size:`sm`,variant:`contrast`,onClick:()=>s&&r(s.value),disabled:!s||s.active||!e.canSelfUpdate||i||a,children:s?.installed?`Switch & restart`:`Install & restart`})]}),(0,X.jsx)(`p`,{className:`text-[11.5px] text-muted-foreground`,children:`Any version, older ones included. Installed versions stay on disk, so switching back is instant.`})]})}function ym({data:e}){let t=e?.installed.find(e=>e.active);if(t?.source===`local`)return(0,X.jsx)(sl,{variant:`outline`,children:`local build`});if(t?.source===`link`)return(0,X.jsxs)(sl,{variant:`outline`,children:[`worktree · `,t.branch??t.id]});let n=t?cm(t.version):null;return n===null?null:(0,X.jsxs)(sl,{variant:`outline`,children:[`PR #`,n,` build`]})}function bm({data:e}){let t=e.installKind===`checkout`?`node packages/cezar/dist/index.js install`:e.installKind===`global-npm`?`cezar install`:`npx cezar-cli install`;return(0,X.jsxs)(`div`,{"data-slot":`self-update-install-hint`,className:`rounded-md border border-border bg-muted/40 px-3 py-2.5 text-[12.5px]`,children:[(0,X.jsx)(`p`,{children:e.reason}),(0,X.jsx)(`p`,{className:`mt-1.5 text-muted-foreground`,children:`Run this once, then start cezar with the plain command:`}),(0,X.jsx)(`pre`,{className:`mt-1.5 overflow-x-auto rounded bg-background px-2 py-1.5 font-mono text-[12px]`,children:t})]})}function xm({data:e}){let t=e.job,n=f(),r=(0,Y.useRef)(null),[i,a]=(0,Y.useState)(`waiting`);return(0,Y.useEffect)(()=>{r.current?.scrollTo({top:r.current.scrollHeight})},[t.log.length]),(0,Y.useEffect)(()=>{if(t.status!==`restarting`)return;let r=!1,i=Date.now(),o=()=>{a(`back`),n.removeQueries({queryKey:V.selfUpdate}),window.setTimeout(()=>window.location.reload(),400)},s=async()=>{if(!r){try{if((await nn()).version!==e.version)return o();let t=await sn().catch(()=>null);if(t&&!t.job)return o()}catch{}if(Date.now()-i>9e4){a(`timeout`);return}window.setTimeout(s,1e3)}};return window.setTimeout(s,1500),()=>{r=!0}},[t.status,e.version,n]),(0,X.jsxs)(`div`,{"data-slot":`self-update-job`,className:`flex min-w-0 flex-col gap-1.5`,children:[(0,X.jsx)(`div`,{className:`flex items-center justify-between text-[12.5px]`,children:(0,X.jsx)(`span`,{className:`font-semibold`,children:t.status===`running`?`Installing ${t.target}…`:t.status===`failed`?`Install of ${t.target} failed`:i===`back`?`Back — reloading`:i===`timeout`?`Restart took too long — reload the page by hand`:`Restarting into ${t.target}…`})}),(0,X.jsx)(`pre`,{ref:r,className:`max-h-40 min-w-0 overflow-y-auto rounded-md border border-border bg-background px-2 py-1.5 font-mono text-[11px] leading-[1.5] break-all whitespace-pre-wrap text-muted-foreground`,children:t.log.join(`
7
+ `)}),t.error?(0,X.jsx)(`p`,{className:`text-[12.5px] text-danger`,children:t.error}):null]})}var Sm=`cez-sidebar-width`;function Cm(e){let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?Math.min(420,Math.max(264,Math.round(t))):264}function wm(){try{let e=localStorage.getItem(Sm);return e===null?264:Cm(e)}catch{return 264}}function Tm(e){try{localStorage.setItem(Sm,String(Cm(e)))}catch{}}var Em=`(min-width: 768px)`,Dm=Y.createContext(void 0),Om=Y.memo(function({children:e,mainRef:t}){return(0,X.jsx)(`main`,{ref:t,"data-slot":`main`,className:`row-start-3 min-h-0 overflow-y-auto overscroll-contain`,children:e})});function km(){return Y.useContext(Dm)}function Am(e){return St({path:`/tasks/:id`,end:!0},Zi(e))!==null}var jm=Y.memo(function({children:e,repo:t=null,inboxCount:n=null,unreadCount:r=null,skillsUpdateAvailable:i=!1,version:a=null,latestVersion:o=null,starCount:s=null,taskQuickList:c,hostWidget:l,toolsMenu:u,forgeAvailable:d=!0,inboxAvailable:f=!0,automationsAvailable:p=!0,tracker:m,singleProject:h=!1,banner:g,projectGroups:_}){let{pathname:v}=oe(),y=Zi(v),b=Sl(y),x=Cl(y),S=x?.to===`/tracker`&&m?{...x,label:$o[m].label}:x,[C,w]=Y.useState(!1),T=Y.useCallback(()=>w(!1),[]),E=Y.useRef(null),D=Am(v),[O,k]=Y.useState(wm),A=Y.useCallback(e=>{let t=Cm(e);k(t),Tm(t)},[]);Y.useLayoutEffect(()=>{if(D)return;let e=E.current;e&&(e.scrollTop=0)},[v,D]),Y.useEffect(()=>{w(!1)},[v]),Y.useEffect(()=>{let e=window.matchMedia?.(Em);if(!e)return;e.matches&&w(!1);let t=e=>{e.matches&&w(!1)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let j={activeTo:b,items:Y.useMemo(()=>bl({forge:d,inbox:f,automations:p,tracker:m}),[d,f,p,m]),repo:t,inboxCount:f?n:null,unreadCount:r,skillsUpdateAvailable:i,version:a,latestVersion:o,starCount:s,taskQuickList:c,hostWidget:l,toolsMenu:u,projectGroups:_,singleProject:h},M=Nm();return(0,X.jsxs)(`div`,{"data-slot":`app-shell`,"data-desktop":M??void 0,className:`flex h-dvh overflow-hidden bg-background text-foreground pl-[env(safe-area-inset-left)] pr-[env(safe-area-inset-right)]`,children:[M===`macos`?(0,X.jsx)(`div`,{"data-slot":`desktop-titlebar`,"data-tauri-drag-region":``,className:`fixed inset-x-0 top-0 z-[60] flex h-[28px] select-none items-center pl-[80px]`,children:a&&o&&o!==a?(0,X.jsx)(Mm,{latestVersion:o}):null}):null,(0,X.jsx)(Pm,{...j,width:O,onWidthChange:A,desktop:M}),(0,X.jsxs)(`div`,{className:K(`grid min-w-0 flex-1 grid-rows-[auto_auto_1fr_auto] overflow-hidden`,M===`macos`&&`pt-[28px]`),children:[(0,X.jsxs)(Vn,{open:C,onOpenChange:w,children:[(0,X.jsx)(qm,{title:S?.label??`cezar`}),(0,X.jsx)(Im,{...j,onNavigate:T})]}),g?(0,X.jsx)(`div`,{"data-slot":`banner-slot`,className:`row-start-2`,children:g}):null,(0,X.jsx)(Om,{mainRef:E,children:e}),(0,X.jsx)(`div`,{"data-slot":`composer`,className:`row-start-4 pb-[env(safe-area-inset-bottom)]`})]})]})});function Mm({latestVersion:e}){let[t,n]=Y.useState(!1);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`button`,{type:`button`,"data-slot":`titlebar-update`,onClick:()=>n(!0),title:`Update cezar to v${e} and restart`,className:`inline-flex h-[18px] items-center gap-1 rounded-full border border-primary/40 bg-primary/15 px-2 text-[11px] font-semibold text-foreground transition-colors hover:bg-primary/30`,children:[(0,X.jsx)(ea,{tone:`pending`,pulse:!0,className:`size-[5px] shrink-0`}),`Update cezar`,(0,X.jsxs)(`span`,{className:`font-mono font-medium text-muted-foreground`,children:[`v`,e]})]}),t?(0,X.jsx)(pm,{open:t,onOpenChange:n,autoApply:e}):null]})}function Nm(){let[e]=Y.useState(()=>{if(typeof document>`u`)return null;let e=document.documentElement.dataset.cezDesktop;return e===`macos`||e===`windows`||e===`linux`?e:null});return e}var Pm=Y.memo(function({width:e,onWidthChange:t,desktop:n=null,...r}){return(0,X.jsxs)(`aside`,{"data-slot":`sidebar`,style:{width:e},className:K(`relative hidden shrink-0 flex-col border-r border-border bg-sidebar md:flex`,n===`macos`&&`pt-[28px]`),children:[(0,X.jsx)(Lm,{...r,compactHeader:n===`macos`}),(0,X.jsx)(Fm,{width:e,onWidthChange:t})]})});function Fm({width:e,onWidthChange:t}){let n=Y.useRef(null),r=t=>{t.button===0&&(n.current={x:t.clientX,width:e},t.currentTarget.setPointerCapture(t.pointerId),t.preventDefault(),t.currentTarget.focus())},i=e=>{let r=n.current;r&&t(Cm(r.width+(e.clientX-r.x)))},a=e=>{n.current&&(n.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))};return(0,X.jsx)(`div`,{"data-slot":`sidebar-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize the sidebar`,"aria-valuenow":e,"aria-valuemin":264,"aria-valuemax":420,tabIndex:0,onPointerDown:r,onPointerMove:i,onPointerUp:a,onPointerCancel:a,onKeyDown:n=>{let r=n.key===`ArrowLeft`?e-16:n.key===`ArrowRight`?e+16:n.key===`Home`?264:n.key===`End`?420:null;r!==null&&(n.preventDefault(),t(Cm(r)))},onDoubleClick:()=>t(264),title:`Drag to resize the sidebar — double-click to reset`,className:`absolute inset-y-0 -right-[2px] z-20 w-[5px] cursor-col-resize touch-none bg-transparent transition-colors hover:bg-violet/40 focus-visible:bg-violet/60 focus-visible:outline-none`})}var Im=Y.memo(function({onNavigate:e,...t}){return(0,X.jsxs)(Bn,{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,X.jsx)(Un,{className:`sr-only`,children:`Navigation`}),(0,X.jsx)(Lm,{...t,onNavigate:e,headerAction:(0,X.jsx)(Hn,{asChild:!0,children:(0,X.jsx)(W,{variant:`ghost`,size:`icon`,"aria-label":`Close menu`,className:`-mr-2 size-11`,children:(0,X.jsx)(wi,{className:`size-[17px]`,"aria-hidden":`true`})})})})]})});function Lm({activeTo:e,items:t,repo:n,inboxCount:r,unreadCount:i,skillsUpdateAvailable:a,version:o,latestVersion:s,starCount:c,taskQuickList:l,hostWidget:u,toolsMenu:d,projectGroups:f,singleProject:p,onNavigate:m,headerAction:h,compactHeader:g=!1}){return(0,X.jsxs)(`div`,{"data-slot":`sidebar-content`,className:`@container/sidebar flex min-h-0 flex-1 flex-col pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]`,children:[(0,X.jsxs)(`div`,{className:K(`flex items-center gap-[9px] px-3.5 pb-2.5`,g?`pt-1.5`:`pt-3.5`),children:[(0,X.jsx)(em,{}),n&&!f?(0,X.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,h?(0,X.jsx)(`div`,{className:K(`shrink-0`,(!n||f)&&`ml-auto`),children:h}):null]}),(0,X.jsxs)(`div`,{className:`flex gap-1.5 px-2.5 pt-1 pb-2`,children:[(0,X.jsx)(W,{asChild:!0,variant:`contrast`,className:`relative min-w-0 flex-1 justify-center`,children:(0,X.jsxs)(q,{to:`/new`,onClick:m,children:[(0,X.jsx)(Uo,{className:`size-[15px]`,"aria-hidden":`true`}),`New task`,(0,X.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`})]})}),p?null:(0,X.jsx)(Um,{})]}),(0,X.jsx)(`div`,{className:`shrink-0 px-1.5`,children:(0,X.jsx)(Bm,{onNavigate:m})}),f?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`shrink-0 border-b border-border px-1.5 pt-0.5 pb-2`,children:(0,X.jsx)(Vm,{onNavigate:m})}),(0,X.jsx)(`div`,{"data-slot":`project-groups`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-1.5 pt-1.5 pb-2`,children:(0,X.jsx)(Dm.Provider,{value:m,children:f})})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.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,X.jsxs)(q,{to:t.to,onClick:m,"aria-current":n?`page`:void 0,className:K(`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,X.jsx)(o,{className:`size-4 shrink-0`,"aria-hidden":`true`}),t.label,t.badge===`inbox-count`&&r?(0,X.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,X.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,X.jsxs)(`span`,{"data-slot":`nav-update-marker`,className:`ml-auto flex items-center`,children:[(0,X.jsx)(`span`,{className:`size-1.5 rounded-full bg-violet`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Skills update available`})]}):null]},t.to)})}),(0,X.jsx)(`div`,{"data-slot":`task-quick-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-2.5 pb-2`,children:l})]}),(0,X.jsxs)(`div`,{"data-slot":`sidebar-footer`,className:`flex flex-col gap-1.5 border-t border-border px-3.5 py-2.5`,children:[u,(0,X.jsx)(Wm,{}),(0,X.jsxs)(`div`,{"data-slot":`sidebar-footer-controls`,className:`flex items-center gap-2`,children:[(0,X.jsx)(`div`,{"data-slot":`tools-menu`,className:`shrink-0`,children:d}),o?(0,X.jsx)(Gm,{version:o,latestVersion:s}):null,c===null?null:(0,X.jsx)(Km,{count:c}),(0,X.jsx)(Hm,{onNavigate:m,className:`ml-auto`}),(0,X.jsx)(zl,{})]})]})]})}var Rm=`flex h-11 w-full items-center gap-2.5 rounded-md px-2.5 text-[13.5px] font-semibold text-foreground transition-colors hover:bg-muted md:h-9`;function zm(e){return K(`size-4 shrink-0`,e?`text-violet`:`text-violet/70`)}function Bm({onNavigate:e}){return(0,X.jsx)(S,{to:`/dashboard`,"data-slot":`dashboard-link`,onClick:e,className:({isActive:e})=>K(Rm,e&&`bg-muted`),children:({isActive:e})=>(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(On,{className:zm(e),"aria-hidden":`true`}),`Dashboard`]})})}function Vm({onNavigate:e}){let{pathname:t}=oe(),n=t===`/tasks`;return(0,X.jsxs)(ke,{to:`/tasks`,"data-slot":`all-tasks-link`,onClick:e,"aria-current":n?`page`:void 0,className:K(Rm,n&&`bg-muted`),children:[(0,X.jsx)(No,{className:zm(n),"aria-hidden":`true`}),`All tasks`]})}function Hm({className:e,onNavigate:t}){return(0,X.jsx)(W,{asChild:!0,variant:`ghost`,size:`icon`,className:K(`size-7`,e),children:(0,X.jsx)(ke,{to:`/settings/global`,"data-slot":`global-settings-link`,"aria-label":`Global settings`,title:`Global settings`,onClick:t,children:(0,X.jsx)(Go,{className:`size-4`,"aria-hidden":`true`})})})}function Um(){let[e,t]=Y.useState(!1),[n,r]=Y.useState(!1);return(0,X.jsxs)(Br,{children:[(0,X.jsx)(Ar,{asChild:!0,children:(0,X.jsx)(W,{variant:`outline`,size:`icon`,"aria-label":`Add project`,title:`Add project`,className:`size-11 shrink-0 md:size-9`,children:(0,X.jsx)(wo,{className:`size-4`,"aria-hidden":`true`})})}),(0,X.jsxs)(Ir,{align:`start`,className:`w-56`,children:[(0,X.jsx)(Nr,{className:`text-xs text-soft-foreground`,children:`Add project`}),(0,X.jsxs)(Rr,{"data-slot":`add-project-local`,onSelect:()=>t(!0),children:[(0,X.jsx)(Yr,{"aria-hidden":`true`}),`Open local folder…`]}),(0,X.jsxs)(Rr,{"data-slot":`add-project-clone`,onSelect:()=>r(!0),children:[(0,X.jsx)(vl,{"aria-hidden":`true`}),`Clone from GitHub…`]})]}),e?(0,X.jsx)(pl,{open:!0,onOpenChange:t}):null,n?(0,X.jsx)(_l,{open:!0,onOpenChange:r}):null]})}function Wm(){return(0,X.jsxs)(`button`,{type:`button`,"data-slot":`command-palette-hint`,title:`Search — command palette (⌘K / Ctrl+K)`,onClick:()=>Dp(),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,X.jsx)(xi,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`truncate`,children:`Search…`}),(0,X.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:xr(`k`)})]})}function Gm({version:e,latestVersion:t}){let n=!!(t&&t!==e),[r,i]=Y.useState(!1);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`button`,{type:`button`,"data-slot":`version-chip`,"data-update-available":n?`true`:void 0,title:n?`v${e} — update available: v${t}`:`v${e}`,"aria-label":n?`cezar v${e}, update to v${t} available — open updater`:`cezar v${e} — open updater`,onClick:()=>i(!0),className:`flex min-w-0 cursor-pointer items-center gap-1 rounded-full border border-border px-1.5 py-px font-mono text-[10px] font-medium text-soft-foreground outline-none hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[n?(0,X.jsx)(ea,{tone:`pending`,pulse:!0,className:`size-[5px] shrink-0`}):null,(0,X.jsxs)(`span`,{className:`truncate`,children:[`v`,e]})]}),r?(0,X.jsx)(pm,{open:r,onOpenChange:i}):null]})}function Km({count:e}){let t=zp(e);return(0,X.jsxs)(`a`,{"data-slot":`star-chip`,href:Lp,target:`_blank`,rel:`noopener noreferrer`,title:`Star cezar on GitHub — ${e.toLocaleString()} stars`,"aria-label":`Star cezar on GitHub — ${e.toLocaleString()} stars`,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 outline-none hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,children:`⭐`}),(0,X.jsx)(`span`,{children:t})]})}function qm({title:e}){return(0,X.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,X.jsxs)(`div`,{className:`flex h-11 items-center gap-2.5 px-3`,children:[(0,X.jsx)(zn,{asChild:!0,children:(0,X.jsx)(W,{variant:`ghost`,size:`icon`,"aria-label":`Open menu`,className:`-ml-1.5 size-11`,children:(0,X.jsx)(Lo,{className:`size-[17px]`,"aria-hidden":`true`})})}),(0,X.jsx)(`span`,{className:`truncate text-[14.5px] font-semibold`,children:e}),(0,X.jsx)(`div`,{"data-slot":`mobile-status`,className:`ml-auto flex items-center gap-2`})]})})}var Jm=Y.createContext(null);function Ym({children:e}){let[t,n]=Y.useState(`active`),r=Y.useMemo(()=>[t,n],[t]);return(0,X.jsx)(Jm.Provider,{value:r,children:e})}function Xm(){let e=Y.useContext(Jm);if(!e)throw Error(`useListView must be used inside a <ListViewProvider>`);return e}var Zm=1e4,Qm=e=>Math.min(100,Math.max(0,e)),$m=e=>e===void 0||e<80?`ok`:e<90?`warn`:`critical`;function eh(){let e=Va(),t=Ga();return!e||t!==`local`?null:(0,X.jsx)(th,{})}function th(){let e=$a(),t=eo(),n=to(),[r,i]=(0,Y.useState)(!1);(0,Y.useEffect)(()=>{if(n===void 0){i(!1);return}let e=n+Zm-Date.now();if(e<=0){i(!0);return}i(!1);let t=setTimeout(()=>i(!0),e);return()=>clearTimeout(t)},[n]);let a=e===void 0?void 0:Ra(e),o=a?.cpuPct,s=r?`stale`:a!==void 0&&a.cpuLimited&&o===void 0?`—`:o===void 0?t.length===0?`sampling…`:`—`:`${Math.round(o)}%`,c=a===void 0||a.memUsedBytes===void 0||a.memTotalBytes<=0?void 0:a.memUsedBytes/a.memTotalBytes*100,l=r?`stale`:c===void 0?`—`:`${Math.round(c)}%`,u=a===void 0?`—`:Ba(a.memUsedBytes,a.memTotalBytes),d=a?.cpuLimited===!0?`${a.cpuLimitKind===`cpuset`?`cpuset `:``}${za(a.cpuCores)}`:void 0,f=`CPU ${s}${d===void 0?``:` of ${d}`}, RAM ${l} (${u})`;return(0,X.jsxs)(q,{to:`/settings/resources`,"data-slot":`host-usage-widget`,"data-state":r?`stale`:`live`,"data-frames":t.length,"aria-label":`Machine usage: ${f}. Open Settings, Resources.`,title:f,className:K(`grid grid-cols-[auto_minmax(0,1fr)_auto_auto_minmax(0,1fr)_auto] items-center gap-x-1.5 rounded-md border border-border px-2 py-1 text-[11px] leading-[14px] text-soft-foreground transition-colors hover:bg-muted hover:text-foreground`,r?`opacity-70`:null),children:[(0,X.jsx)(nh,{label:`CPU`,pct:r?void 0:o,valueSlot:`host-usage-widget-cpu`,value:s}),(0,X.jsx)(nh,{label:`RAM`,pct:r?void 0:c,valueSlot:`host-usage-widget-mem-pct`,value:l,gutter:!0})]})}function nh({label:e,pct:t,valueSlot:n,value:r,gutter:i}){let a=$m(t);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:K(`font-medium tracking-wide text-muted-foreground`,i===!0?`ml-1`:null),children:e}),(0,X.jsx)(`span`,{"data-slot":`host-usage-widget-${e.toLowerCase()}-bar`,"data-level":a,role:`meter`,"aria-label":e,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":t===void 0?void 0:Math.round(Qm(t)),className:`h-1.5 overflow-hidden rounded-full bg-muted`,children:(0,X.jsx)(`span`,{className:K(`block h-full rounded-full transition-[width] duration-500`,a===`critical`?`bg-destructive`:a===`warn`?`bg-pending`:`bg-primary`),style:{width:`${t===void 0?0:Qm(t)}%`}})}),(0,X.jsx)(`span`,{"data-slot":n,className:K(`text-right font-medium tabular-nums`,a===`critical`?`text-destructive`:a===`warn`?`text-pending-strong`:`text-foreground`),children:r})]})}var rh=[`claude`,`codex`,`junie`,`opencode`,`cursor`,`pi`,`copilot`],ih={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`,cursor:`Cursor`,pi:`pi`,junie:`Junie`,copilot:`GitHub Copilot CLI`};function ah(e){if(typeof e!=`object`||!e||Array.isArray(e))return{};let t=e,n={};for(let e of rh){let r=t[e];typeof r==`string`&&r.length>0&&r.length<=128&&(n[e]=r)}return n}function oh(e,t){if(!e)return[];let n=new Map(e.providers.map(e=>[e.provider,e]));return rh.flatMap(e=>{let r=n.get(e);return r?.status!==`disconnected`||!r.authFailureId||t[e]===r.authFailureId?[]:[{provider:e,label:ih[e],authFailureId:r.authFailureId}]})}function sh(e,t){return{...e,...Object.fromEntries(t.map(({provider:e,authFailureId:t})=>[e,t]))}}function ch({status:e,pending:t,error:n,dismissals:r,onDismissAuthFailures:i}){if(t||!e)return null;let a;try{a=un(e)}catch{return null}let o=oh(a,r);if(o.length>0)return(0,X.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,X.jsx)(ea,{tone:`danger`}),(0,X.jsxs)(`span`,{children:[`Provider authentication failed during a task:`,` `,o.map(({label:e})=>e).join(`, `),`.`]}),(0,X.jsx)(q,{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,X.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,X.jsx)(wi,{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,X.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,X.jsx)(ea,{tone:c?`danger`:`pending`}),(0,X.jsx)(`span`,{children:s?`No agent provider is enabled.`:c?`No connected provider could be verified.`:`No agent provider credentials were found.`}),(0,X.jsx)(q,{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 lh(e){if(!(typeof e!=`object`||!e||Array.isArray(e)))return e}function uh(){let e=ft(),t=Nt(),n=f(),r=(0,Y.useRef)(Promise.resolve()),i=(0,Y.useRef)(0),a=(0,Y.useRef)(0),o=(0,Y.useRef)(lh(t.data));(0,Y.useEffect)(()=>{a.current===0&&(o.current=lh(t.data))},[t.data]);let s=(0,Y.useCallback)(e=>{let t=V.uiState,s=lh(n.getQueryData(t)),c=sh(ah(s?.dismissedProviderAuthFailures),e),l={...s,dismissedProviderAuthFailures:c};a.current+=1,n.setQueryData(t,l);let u=++i.current;r.current=r.current.then(async()=>{try{let e=await Lt({dismissedProviderAuthFailures:c});o.current=lh(e),u===i.current&&n.setQueryData(t,e)}catch(e){u===i.current&&(o.current===void 0?n.removeQueries({queryKey:t,exact:!0}):n.setQueryData(t,o.current),n.invalidateQueries({queryKey:t}),U(e instanceof Error?e.message:String(e),{tone:`danger`}))}finally{--a.current}})},[n]);return(0,X.jsx)(ch,{status:e.data,pending:e.isPending,error:e.isError,dismissals:ah(lh(t.data)?.dismissedProviderAuthFailures),onDismissAuthFailures:s})}function dh({pinned:e,onToggle:t,className:n}){return(0,X.jsx)(`button`,{type:`button`,"data-slot":`pin-toggle`,"data-pinned":e?`true`:void 0,"aria-pressed":e,"aria-label":e?`Unpin task`:`Pin task`,title:e?`Unpin from the top of the list`:`Pin to the top of the list`,onClick:n=>{n.stopPropagation(),t(!e)},className:K(`inline-flex size-5 shrink-0 items-center justify-center rounded-sm text-soft-foreground transition-colors hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,e&&`text-violet hover:text-violet`,n),children:(0,X.jsx)(Xn,{className:K(`size-3`,e&&`fill-current`),"aria-hidden":`true`})})}function fh(e){let t=new Map;for(let n of e)t.has(n.id)||t.set(n.id,{run:n,depth:0,children:[],childCount:0,descendantCount:0});let n=e=>{let n=e.dispatch?.parentRunId;if(n===void 0||n===e.id)return null;let r=t.get(n);if(r===void 0)return null;let i=new Set([e.id]),a=r;for(;a!==void 0;){if(i.has(a.run.id))return null;i.add(a.run.id);let e=a.run.dispatch?.parentRunId;a=e===void 0?void 0:t.get(e)}return r},r=[];for(let i of e){let e=t.get(i.id);if(e===void 0||e.run!==i)continue;let a=n(i);a===null?r.push(e):a.children.push(e)}let i=(e,t)=>{e.depth=t,e.childCount=e.children.length;let n=0;for(let r of e.children)n+=1+i(r,t+1);return e.descendantCount=n,n};for(let e of r)i(e,0);return r}function ph(e,t){let n=[],r=e=>{for(let i of e)n.push(i),(i.children.length===0||t===void 0||t(i.run.id))&&r(i.children)};return r(e),n}function mh(e,t){return ph(fh(e),t)}function hh(e){return e<=0?null:`${e} subtask${e===1?``:`s`}`}function gh(e){return e.dispatch?.parentRunId===void 0?null:e.dispatch.kind??`implement`}function _h({runs:e,view:t,onViewChange:n,currentRunId:r=null,now:i=Date.now(),showTokens:a=!0,showCost:o=!0,onTogglePin:s}){let c=Ct(e),l=wt(e,t),u=t===`archived`?void 0:s;return(0,X.jsxs)(`div`,{"data-slot":`quick-list`,children:[(0,X.jsx)(`div`,{className:`sticky top-0 z-10 bg-sidebar pt-2 pb-1`,children:(0,X.jsxs)(`div`,{className:`inline-flex w-full gap-0.5 rounded-md bg-muted p-[3px]`,children:[(0,X.jsxs)(bh,{view:`active`,current:t,onSelect:n,count:c.active,children:[`Active`,c.waiting>0&&t!==`active`?(0,X.jsx)(ea,{tone:`pending`,pulse:!0,"data-slot":`waiting-dot`,"aria-label":`needs you`}):null]}),(0,X.jsx)(bh,{view:`archived`,current:t,onSelect:n,count:c.archived,children:`Archived`})]})}),l.length===0?(0,X.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,X.jsx)(vh,{buckets:l,currentRunId:r,now:i,showTokens:a,showCost:o,onTogglePin:u})]})}function vh({buckets:e,currentRunId:t=null,now:n=Date.now(),scope:r=null,showTokens:i=!0,showCost:a=!0,onTogglePin:o}){let[s,c]=Y.useState(()=>new Set),l=e=>c(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n});return(0,X.jsx)(X.Fragment,{children:e.map(e=>(0,X.jsxs)(`div`,{"data-slot":`quick-list-bucket`,"data-bucket":e.label,children:[(0,X.jsx)(`h2`,{className:`px-3 pt-2.5 pb-1 text-[11px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:e.label}),yh(e.rows).map(e=>(0,X.jsx)(xh,{row:e.run.row,depth:e.depth,childCount:e.childCount,currentRunId:t,now:n,scope:r,showTokens:i,showCost:a,expanded:e.run.row.kind===`group`&&s.has(e.run.row.groupId),onToggle:l,onTogglePin:o},e.run.id))]},e.label))})}function yh(e){return mh(e.map(e=>e.kind===`group`?{id:`group:${e.groupId}`,row:e}:{id:e.run.id,dispatch:e.run.dispatch,row:e}))}function bh({view:e,current:t,onSelect:n,count:r,children:i}){let a=e===t;return(0,X.jsxs)(`button`,{type:`button`,"data-slot":`view-tab`,"data-view":e,"aria-pressed":a,onClick:()=>n(e),className:K(`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,X.jsx)(`span`,{className:`font-mono text-[11px] tabular-nums`,children:r}):null]})}function xh({row:e,depth:t,childCount:n,currentRunId:r,now:i,scope:a,expanded:o,onToggle:s,showTokens:c,showCost:l,onTogglePin:u}){return e.kind===`run`?(0,X.jsx)(Ch,{run:e.run,depth:t,childCount:n,queuePosition:e.queuePosition,currentRunId:r,now:i,scope:a,showTokens:c,showCost:l,onTogglePin:u}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`flex items-center rounded-sm hover:bg-muted`,children:[(0,X.jsxs)(`button`,{type:`button`,"data-slot":`group-tile`,"data-group-id":e.groupId,"aria-expanded":o,onClick:()=>s(e.groupId),className:`flex min-w-0 flex-1 items-center gap-2 px-2.5 py-[7px] text-left`,children:[(0,X.jsx)(Dr,{className:K(`size-3 shrink-0 text-soft-foreground transition-transform`,!o&&`-rotate-90`),"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`min-w-[7rem] flex-1 truncate text-[13px] font-medium`,children:e.title}),(0,X.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,X.jsx)(q,{to:Ki(a,`/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,X.jsx)(Wo,{className:`size-3.5`,"aria-hidden":`true`})})]}),o?e.members.map(e=>(0,X.jsx)(Ch,{run:e,queuePosition:null,currentRunId:r,now:i,scope:a,variant:!0,showTokens:c,showCost:l,onTogglePin:u},e.id)):null]})}var Sh=`w-0 overflow-hidden opacity-0 group-hover/task-row:mr-1 group-hover/task-row:w-5 group-hover/task-row:opacity-100 group-focus-within/task-row:mr-1 group-focus-within/task-row:w-5 group-focus-within/task-row:opacity-100 no-hover:mr-1 no-hover:size-7 no-hover:opacity-100 data-[pinned=true]:mr-1 data-[pinned=true]:w-5 data-[pinned=true]:opacity-100`,Ch=Y.memo(function({run:e,depth:t=0,childCount:n=0,queuePosition:r,currentRunId:i,now:a,scope:o,variant:s=!1,showTokens:c,showCost:l,onTogglePin:u}){let d=na(e),f=e.id===i,p=on(e),m=_e(e),h=de(m,p?.number)?P(m).rest:m,g=Kn(e),_=Yn(e),v=s?``:r===null?ia(e.finishedAt??e.createdAt,a):`#${r}`,y=hh(n),b=gh(e);return(0,X.jsxs)(`div`,{"data-slot":`task-row`,"data-run-id":e.id,"data-active":f?`true`:void 0,"data-depth":t,style:t>0?{paddingLeft:`${10+t*14}px`}:void 0,className:K(`group/task-row flex items-center gap-2 rounded-sm pl-2.5 hover:bg-muted`,f&&`bg-muted`,s&&`pl-[26px]`),children:[(0,X.jsx)(ea,{tone:d.tone,pulse:d.pulse,"aria-label":d.label,role:`img`}),p?(0,X.jsx)(er,{run:e,reference:p,compact:!0,className:`h-auto shrink-0 gap-[2px] px-1.5 py-px text-[10.5px]`}):null,(0,X.jsxs)(q,{to:Ki(o,`/tasks/${e.id}`),title:m,"aria-current":f?`page`:void 0,className:`flex min-w-0 flex-1 items-center gap-2 py-[7px] pr-2.5`,children:[s?(0,X.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,X.jsx)(`span`,{"data-slot":`task-row-title`,className:K(`min-w-[7rem] flex-1 truncate text-[13px]`,g?`font-semibold text-foreground`:_?`font-medium text-muted-foreground`:`font-medium`),children:s?wh(e,c,l):h}),b?(0,X.jsx)(`span`,{"data-slot":`dispatch-kind`,className:`shrink-0 rounded-full bg-muted px-1.5 py-px text-[10px] font-medium text-muted-foreground`,children:b}):null,e.diffStat?(0,X.jsx)(ha,{stat:e.diffStat,className:`hidden shrink-0 text-[10.5px] @min-[23rem]/sidebar:inline`}):null,y?(0,X.jsx)(`span`,{"data-slot":`subtask-count`,title:y,className:`hidden shrink-0 rounded-full bg-muted px-1.5 py-px text-[10px] font-medium text-muted-foreground @min-[19rem]/sidebar:inline`,children:n}):null,v&&(r!==null||!p)?(0,X.jsx)(`span`,{className:`shrink-0 text-[11px] text-soft-foreground tabular-nums`,children:v}):null,g?(0,X.jsx)(ea,{tone:`violet`,role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,className:`ml-0.5 shrink-0`}):null]}),u?(0,X.jsx)(dh,{pinned:!!e.pinned,onToggle:t=>u(e,t),className:Sh}):null]})});function wh(e,t,n){let r=[e.runner??`claude`];t&&(e.inputTokens!==void 0||e.outputTokens!==void 0)&&r.push(_a(e.inputTokens,e.outputTokens));let i=Xe(e.costUsd);return n&&i&&r.push(i),r.join(` · `)}function Th(){let e=z(),t=yn($i(),e.data?.bootProject??null),n=Wt(),r=ra(e.data),[i,a]=Xm(),o=Yi(`/tasks/:id/*`),s=Yi(`/tasks/:id`),c=Wn(3e4),l=Y.useCallback((e,t)=>n.mutate({id:e.id,pinned:t},{onError:e=>U(e.message,{tone:`danger`})}),[n.mutate]),u=_t(),d=Y.useMemo(()=>u===void 0?[]:(t.data??[]).flatMap(e=>Ae(e).map(e=>({projectId:u,kind:e.kind,number:e.number}))),[t.data,u]);return t.data?(0,X.jsx)(hr,{projectId:u,requests:d,children:(0,X.jsx)(_h,{runs:t.data,view:i,onViewChange:a,currentRunId:o?.params.id??s?.params.id??null,now:c,showTokens:r.tokens,showCost:r.cost,onTogglePin:l})}):null}var Eh=`cez-sidebar-collapsed`;function Dh(e){if(typeof e!=`object`||!e||Array.isArray(e))return{};let t={};for(let[n,r]of Object.entries(e))typeof r==`boolean`&&(t[n]=r);return t}function Oh(){try{let e=localStorage.getItem(Eh);return e===null?{}:Dh(JSON.parse(e))}catch{return{}}}function kh(e){try{localStorage.setItem(Eh,JSON.stringify(e))}catch{}}function Ah(e,t,n){let r=e?.[t];return r===void 0?t!==n:r}var jh=10;function Mh(e){let[t,n]=Y.useState(Oh),r=Y.useRef(t),i=Y.useCallback(e=>{r.current=e,kh(e),n(e)},[]);return{collapsed:t,toggle:Y.useCallback(t=>{i({...r.current,[t]:!Ah(r.current,t,e)})},[e,i]),expand:Y.useCallback(e=>{if(!(e in r.current))return;let t={...r.current};delete t[e],i(t)},[i])}}function Nh({projects:e,bootProjectId:t,inboxAvailable:n=!1,automationsAvailable:r=!1,inboxCount:i=null,skillsUpdateAvailable:a=!1}){let{pathname:o}=oe(),s=Ji(o),c=s??t,{collapsed:l,toggle:u,expand:d}=Mh(c),[f]=Xm(),p=Sl(Zi(o)),m=Yi(`/tasks/:id/*`),h=Yi(`/tasks/:id`),g=m?.params.id??h?.params.id??null,_=Wn(3e4),v=ra(z().data),{order:y,canReorder:b,setOrder:x}=Tp(),S=Y.useMemo(()=>{let t=Sp(e,y),n=t.filter(e=>e.unregistered);return n.length===0?t:[...n,...t.filter(e=>!e.unregistered)]},[e,y]),C=Y.useMemo(()=>S.map(e=>e.id),[S]),w=Du(Eu(kd,{activationConstraint:{distance:4}}),Eu(wd,{coordinateGetter:_p})),T=b&&S.length>1,E=Y.useCallback(e=>{let{active:t,over:n}=e;if(n===null||n.id===t.id)return;let r=C.indexOf(String(t.id)),i=C.indexOf(String(n.id));r===-1||i===-1||x(Cp(C,r,i))},[C,x]),D=Y.useMemo(()=>{let e=e=>{let t=C.indexOf(String(e));return{name:S[t]?.name??String(e),position:`position ${t+1} of ${C.length}`}};return{onDragStart:({active:t})=>{let{name:n,position:r}=e(t.id);return`Picked up ${n}, ${r}.`},onDragOver:({active:t,over:n})=>n?`${e(t.id).name} moved to ${e(n.id).position}.`:`${e(t.id).name} is not over a drop position.`,onDragEnd:({active:t,over:n})=>n?`${e(t.id).name} dropped at ${e(n.id).position}.`:`${e(t.id).name} dropped. The order is unchanged.`,onDragCancel:({active:t})=>`Reordering cancelled. ${e(t.id).name} returned to ${e(t.id).position}.`}},[S,C]),O=S.map(e=>(0,X.jsx)(Fh,{project:e,boot:e.id===t,active:e.id===s,collapsed:Ah(l,e.id,c),onToggle:u,onSelect:d,view:f,activeTo:p,currentRunId:g,now:_,inboxAvailable:n,automationsAvailable:r,inboxCount:i,skillsUpdateAvailable:a,showTokens:v.tokens,showCost:v.cost,sortable:T,position:C.indexOf(e.id)+1,total:C.length},e.id));return(0,X.jsx)(`div`,{"data-slot":`project-group-list`,children:(0,X.jsx)(Df,{sensors:w,collisionDetection:Iu,accessibility:{announcements:D},onDragEnd:E,children:(0,X.jsx)(ap,{items:C,strategy:$f,children:O})})})}function Ph({name:e,position:t,total:n,disabled:r,handleProps:i}){return(0,X.jsx)(`button`,{type:`button`,"data-slot":`project-group-grip`,disabled:r,"aria-label":`Reorder ${e}, position ${t} of ${n}`,className:K(`flex h-11 w-6 shrink-0 cursor-grab items-center justify-center rounded text-muted-foreground opacity-0 outline-none transition-opacity md:h-[34px] md:w-4`,`touch-none focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50`,`group-hover/row:opacity-100 group-focus-within/row:opacity-100`,`[@media(hover:none)]:opacity-100`,r&&`cursor-default group-hover/row:opacity-0 group-focus-within/row:opacity-0 [@media(hover:none)]:opacity-0`),...i,children:(0,X.jsx)(ko,{"aria-hidden":`true`,className:`size-3.5`})})}function Fh({project:e,boot:t,active:n,collapsed:r,onToggle:i,onSelect:a,view:o,activeTo:s,currentRunId:c,now:l,inboxAvailable:u,automationsAvailable:d,inboxCount:f,skillsUpdateAvailable:p,showTokens:m,showCost:h,sortable:g,position:_,total:v}){let y=e.status===`missing`,b=g&&!y&&!e.unregistered,{attributes:x,listeners:S,setNodeRef:C,transform:w,transition:T,isDragging:E}=pp({id:e.id,disabled:!b}),D={transform:du.Translate.toString(w),transition:T},O=(0,X.jsx)(Ph,{name:e.name,position:_,total:v,disabled:!b,handleProps:{...x,...S}}),k=Qt(e.id,!r&&!y,t),A=km(),j=Wt(e.id,t?`default`:e.id),M=Y.useCallback((e,t)=>j.mutate({id:e.id,pinned:t},{onError:e=>U(e.message,{tone:`danger`})}),[j.mutate]),N=k.data?Ct(k.data).waiting:0,P=k.data?pe(wt(k.data,o),jh):[],F=P.flatMap(t=>t.rows.flatMap(t=>Ae(t.kind===`run`?t.run:t.members[0]).map(t=>({projectId:e.id,kind:t.kind,number:t.number}))));if(y)return(0,X.jsx)(`div`,{ref:C,style:D,"data-slot":`project-group`,"data-project":e.id,"data-status":`missing`,className:K(`mb-1`,E&&`relative z-10 opacity-40`),children:(0,X.jsxs)(`div`,{className:`flex items-center`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`w-6 shrink-0 md:w-4`}),(0,X.jsxs)(`div`,{"data-slot":`project-group-header`,title:`${e.root} is gone — remove it in Global settings → Projects`,className:`flex h-11 min-w-0 flex-1 items-center gap-[7px] rounded-lg px-2 text-[13px] font-semibold opacity-55 md:h-[34px]`,children:[(0,X.jsx)(`span`,{className:`w-3 shrink-0`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`truncate`,children:e.name}),(0,X.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 I=`project-group-${e.id}`;return(0,X.jsxs)(`div`,{ref:C,style:D,"data-slot":`project-group`,"data-project":e.id,"data-status":e.status,"data-collapsed":r?``:void 0,"data-dragging":E?``:void 0,"data-active":n?``:void 0,className:K(`mb-1`,E&&`relative z-10 opacity-40`),children:[(0,X.jsxs)(`div`,{className:`group/row flex items-center`,children:[O,(0,X.jsxs)(`div`,{"data-slot":`project-group-row`,className:K(`flex min-w-0 flex-1 items-center rounded-lg transition-colors hover:bg-muted`,n&&`bg-muted`),children:[(0,X.jsx)(`button`,{type:`button`,onClick:()=>i(e.id),"aria-expanded":!r,"aria-controls":I,"aria-label":`${r?`Expand`:`Collapse`} ${e.name}`,"data-slot":`project-group-disclosure`,className:K(`flex h-11 w-[27px] shrink-0 items-center justify-center rounded-lg md:h-[34px]`),children:(0,X.jsx)(Dr,{className:K(`size-3 shrink-0 text-muted-foreground transition-transform`,r&&`-rotate-90`),"aria-hidden":`true`})}),(0,X.jsxs)(q,{to:Ki(e.id,`/`),onClick:()=>{a(e.id),A?.()},"aria-current":n?`true`:void 0,"data-slot":`project-group-header`,className:K(`flex h-11 min-w-0 flex-1 items-center gap-[7px] rounded-lg pr-2 text-left text-[13px] font-semibold md:h-[34px]`,n&&`text-foreground`),children:[(0,X.jsx)(`span`,{className:`truncate`,children:e.name}),e.unregistered?(0,X.jsx)(`span`,{"data-slot":`project-unregistered`,title:`cezar is serving this folder — it is not in your saved projects. Add it in Global settings → Projects.`,className:`shrink-0 rounded-full bg-muted px-[7px] py-px text-[10px] font-medium text-soft-foreground`,children:`not saved`}):null,N?(0,X.jsx)(`span`,{"data-slot":`project-attention`,title:`${N} task${N===1?``:`s`} need${N===1?`s`:``} you`,className:`shrink-0 rounded-full bg-violet px-1.5 py-px text-[10.5px] font-semibold text-violet-foreground`,children:N}):null,e.branch?(0,X.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,X.jsxs)(`div`,{id:I,"data-slot":`project-group-body`,className:`mt-1 ml-[14px] border-l border-border pl-2`,children:[(0,X.jsx)(`nav`,{"aria-label":`${e.name} navigation`,children:bl({forge:e.forge===`github`,inbox:u,automations:d,tracker:e.tracker}).map(t=>{let r=n&&t.to===s,i=t.icon;return(0,X.jsxs)(q,{to:Ki(e.id,t.to),onClick:A,"aria-current":r?`page`:void 0,className:K(`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,X.jsx)(i,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),t.label,t.badge===`inbox-count`&&n&&f?(0,X.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:f}):null,t.badge===`skills-update`&&n&&p?(0,X.jsxs)(`span`,{"data-slot":`nav-update-marker`,className:`ml-auto flex items-center`,children:[(0,X.jsx)(`span`,{className:`size-1.5 rounded-full bg-violet`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Skills update available`})]}):null]},t.to)})}),(0,X.jsx)(hr,{projectId:e.id,requests:F,children:(0,X.jsx)(vh,{buckets:P,currentRunId:n?c:null,now:l,scope:e.id,showTokens:m,showCost:h,onTogglePin:o===`archived`?void 0:M})}),(0,X.jsx)(q,{to:Ki(e.id,`/`),onClick:A,"data-slot":`project-group-more`,className:`flex h-9 items-center rounded-md px-3 text-[12px] text-muted-foreground transition-colors hover:text-foreground md:h-7`,children:`More…`})]})]})}var Ih={claude:!0,codex:!0,junie:!0,opencode:!0,cursor:!0,pi:!0,copilot:!0},Lh=e=>Object.hasOwn(Ih,e.name);function Rh(e){let t=e.checks.filter(Lh);if(t.length&&!t.some(e=>e.available))return`no agent CLI found — install one to run tasks`;let n=t.find(t=>t.name===e.defaultRunner);return n&&!n.available?`default runner (${e.defaultRunner}) not found`:null}function zh(e){let t=`cezar v${e.version}`,n=Rh(e);if(n)return`${t} · ${n}`;let r=e.checks.filter(e=>!e.available).map(e=>e.name);return r.length?`${t} · optional: ${r.join(`, `)} not installed`:t}function Bh(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 Vh({health:e}){if(!e)return null;let t=Rh(e);return(0,X.jsxs)(Br,{children:[(0,X.jsx)(Ar,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`tools-menu-trigger`,title:zh(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,X.jsx)(ea,{tone:t?`pending`:`success`}),`Tools`,(0,X.jsx)(Dr,{className:`size-[11px]`,"aria-hidden":`true`})]})}),(0,X.jsxs)(Ir,{side:`top`,align:`start`,"data-slot":`tools-menu-content`,className:`w-[240px]`,children:[(0,X.jsx)(Nr,{className:`text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:`Installed tools`}),e.checks.map(e=>e.available?(0,X.jsx)(Hh,{check:e},e.name):(0,X.jsx)(Uh,{check:e},e.name)),Bh(e)?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(zr,{}),(0,X.jsx)(`p`,{"data-slot":`forge-note`,className:`px-2 py-1.5 text-[11px] leading-snug text-muted-foreground`,children:Bh(e)})]}):null,(0,X.jsx)(zr,{}),(0,X.jsx)(Rr,{asChild:!0,children:(0,X.jsxs)(q,{to:`/settings/agents`,"data-slot":`tools-settings`,className:`gap-2 text-[12.5px] text-muted-foreground`,children:[(0,X.jsx)(Go,{className:`size-3.5`,"aria-hidden":`true`}),`Tool settings`]})})]})]})}function Hh({check:e}){return(0,X.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,X.jsx)(ea,{tone:`success`}),(0,X.jsx)(`span`,{className:`font-mono text-[12.5px] font-medium`,children:e.name}),(0,X.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 Uh({check:e}){return(0,X.jsx)(Rr,{asChild:!0,children:(0,X.jsxs)(q,{to:`/settings/agents`,"data-slot":`tool-row`,"data-tool":e.name,"data-available":`false`,className:`flex-col items-stretch gap-1`,children:[(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(ea,{tone:`danger`}),(0,X.jsx)(`span`,{className:`font-mono text-[12.5px] font-medium`,children:e.name}),(0,X.jsx)(`span`,{"data-slot":`tool-version`,className:`ml-auto font-mono text-[11.5px] font-medium text-muted-foreground`,children:`not found`})]}),(0,X.jsxs)(`span`,{className:`flex items-end justify-between gap-3 pl-[15px]`,children:[e.hint?(0,X.jsx)(`span`,{"data-slot":`tool-hint`,className:`min-w-0 text-[11px] leading-snug text-muted-foreground`,children:e.hint}):null,(0,X.jsx)(`span`,{"data-slot":`tool-setup`,className:`ml-auto shrink-0 text-[11.5px] font-semibold text-violet`,children:`Set up →`})]})]})})}function Wh(e){return e?.trim()||null}function Gh({projectName:e,pageLabel:t}){let n=Wh(e),r=Wh(t);return n&&r?`${n} — ${r} · cezar`:n?`${n} · cezar`:r?`${r} · cezar`:`cezar`}function Kh(e){let t=Gh(e);(0,Y.useEffect)(()=>{document.title=t},[t])}var qh=`cez-last-location`;function Jh(){try{let e=localStorage.getItem(qh);return e===null?null:JSON.parse(e)}catch{return null}}function Yh(e){try{localStorage.setItem(qh,JSON.stringify(e))}catch{}}var Xh=new Set([`projectId`,`pathname`,`search`,`hash`]);function Zh(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t=e;if(Object.keys(t).some(e=>!Xh.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(Ji(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 Qh(e,t){let n=t.projects.find(t=>t.id===e);return n!==void 0&&n.status!==`missing`}function $h(e,t){if(t===void 0)return null;let n;try{n=Ji(e.pathname)}catch{return null}return n===null||!Qh(n,t)?null:Zh({projectId:n,pathname:e.pathname,...e.search===``?{}:{search:e.search},...e.hash===``?{}:{hash:e.hash}})}function eg(e,t,n){let r=Zh(e);return r===null||!(t===void 0?n!==void 0&&r.projectId===n:Qh(r.projectId,t))?null:`${r.pathname}${r.search??``}${r.hash??``}`}function tg(e,t){if(e===void 0)return t;let{projects:n}=e;return n.length===0||n.some(e=>e.id===t)?t:Sp(n.filter(e=>e.status!==`missing`),[])[0]?.id??t}function ng(e,t){let n=Zh(e);return n!==null&&n.projectId===t.projectId&&n.pathname===t.pathname&&(n.search??``)===(t.search??``)&&(n.hash??``)===(t.hash??``)}function rg(){return(0,X.jsxs)(`div`,{"data-route":`automations`,className:`flex min-h-full flex-col`,children:[(0,X.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,X.jsx)(`h1`,{className:`text-base font-semibold`,children:`Automations`}),(0,X.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Scheduled and GitHub-triggered runs.`})]}),(0,X.jsx)(`p`,{"data-slot":`automations-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading automations…`})]})}function ig(){return(0,X.jsx)(`div`,{"data-route":`compare`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(J,{icon:(0,X.jsx)(Xr,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading variants…`,subtitle:`Fetching every variant's status, spend and diff summary.`})})}function ag(){return(0,X.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(J,{icon:(0,X.jsx)(Xr,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading GitHub…`,subtitle:`Fetching open issues and pull requests.`})})}function og(e){let t=ft(),n=d(),r=g(t.data),i=n.data?.defaultRunner,a=Qr(e.runner,r,i??r[0]??`claude`),o=R(a),s=n.data?.modelsLocked===!0,{accounts:c,repoAccount:l}=qr(),u=c.some(t=>t.provider===a&&t.id===e.account)?e.account:null;return{runner:a,runnerExplicit:e.runner!==null,model:ci(s?null:e.model,a,n.data?.defaultModels,o.data),runners:r,defaultRunner:i,canRun:t.isSuccess&&r.length>0,modelsLocked:s,providerPending:t.isPending,providerError:t.isError,accounts:c,account:u,repoAccount:l}}function sg(e){return{runner:ui(e.runner,e.defaultRunner,e.runnerExplicit),model:e.modelsLocked?void 0:e.model||void 0}}function cg(e){return{...sg(e),...e.account?{agentProfile:e.account}:{}}}function lg({pick:e,onChange:t,disabled:n=!1,accounts:r=!1}){let i=og(e),{runner:a,model:o,runners:s,canRun:c,modelsLocked:l}=i,u=d(),f=R(a),p=Zr(a,f.data,[e.model,u.data?.defaultModels?.[a]]),m=n||!c,h=r?i.accounts:[];return(0,X.jsxs)(X.Fragment,{children:[s.length>1||s.some(e=>Kr(h,e))?(0,X.jsx)(Gr,{runners:s,value:a,accounts:h,account:r?i.account:null,repoAccount:r?i.repoAccount:void 0,disabled:m,onPick:(n,i)=>t(r?{runner:n,account:i,model:n===a?e.model:null}:{runner:n,account:null,model:null})}):null,(0,X.jsx)(Jr,{slot:`model-pill`,ariaLabel:`Model`,label:p.find(e=>e.id===o).label,value:o,disabled:m,readOnly:l===!0,disabledHint:l?`Model selection is locked to native coding-agent settings.`:void 0,onPick:n=>t({...e,model:n}),options:p.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:ti(a,f.data,f.isError)})]})}function ug({templates:e,onInsert:t,triggerClassName:n,disabled:r,iconOnly:i=!1}){let[a,o]=(0,Y.useState)(!1),s=(0,Y.useRef)(null),c=qi();return e.length===0?null:(0,X.jsxs)(Or,{open:a,onOpenChange:o,children:[(0,X.jsx)(wr,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-trigger`,"aria-label":`Insert a prompt template`,title:`Insert a prompt template`,disabled:r,className:K(`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,X.jsx)(Bo,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),i?null:(0,X.jsxs)(X.Fragment,{children:[`templates`,(0,X.jsx)(Dr,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})]})}),(0,X.jsx)(Er,{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,X.jsxs)(bi,{filter:aa,children:[(0,X.jsx)(fi,{placeholder:`search templates…`,onInput:()=>s.current?.scrollTo(0,0)}),(0,X.jsxs)(yi,{ref:s,"data-slot":`prompt-template-list-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,X.jsx)(vi,{children:`Nothing matches.`}),(0,X.jsx)(mi,{heading:`Insert a template`,children:e.map(e=>(0,X.jsxs)(_i,{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,X.jsxs)(`span`,{className:`flex w-full items-center gap-1.5`,children:[(0,X.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,X.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,X.jsx)(Si,{"aria-hidden":`true`,className:`size-2.5`}),e.skills.length]}):null]}),(0,X.jsx)(`span`,{className:`line-clamp-1 text-[11px] text-soft-foreground`,children:e.text})]},e.id))}),(0,X.jsx)(pi,{}),(0,X.jsx)(mi,{children:(0,X.jsx)(_i,{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 dg=na({status:`waiting`});function fg(e){return e.filter(e=>!e.startedTaskId)}function pg(e){return e.runnable??!!(e.suggestedSkill||e.suggestedPrompt)}function mg(){let e=z(),t=e.data?.capabilities.followups===!0,n=e.data!==void 0&&!t,r=Ke(!n),i=we(),a=r.data===void 0?void 0:fg(r.data);return(0,X.jsxs)(`div`,{"data-route":`inbox`,className:`flex min-h-full flex-col`,children:[(0,X.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,X.jsx)(`h1`,{className:`text-base font-semibold`,children:`Inbox`}),(0,X.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,X.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,X.jsx)(J,{icon:(0,X.jsx)(jo,{}),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,X.jsx)(J,{icon:(0,X.jsx)(Ci,{}),tone:`danger`,title:`Could not load the inbox`,subtitle:r.error.message,heading:`h2`}):null:a.length===0?e.isPending?null:(0,X.jsx)(J,{icon:(0,X.jsx)(jo,{}),tone:`neutral`,title:`Inbox empty`,subtitle:`Agents drop follow-up suggestions here when they finish a task.`,heading:`h2`}):(0,X.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,X.jsx)(hg,{todo:e,sourceTaskExists:e.taskId===void 0?null:i.data?.some(t=>t.id===e.taskId)??!1},e.id))})})]})}function hg({todo:e,sourceTaskExists:t}){let n=qi(),r=f(),i=qt(),[a,o]=(0,Y.useState)({runner:null,model:null,account:null}),l=og(a),[u,d]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(``),h=(0,Y.useRef)(null),g=z(),v=Ta(wa(i.data?.promptTemplates),g.data?.capabilities),y=e=>{let t=h.current?.selectionStart??p.length,n=Sa(p,t,e);m(n.text),requestAnimationFrame(()=>{h.current?.focus(),h.current?.setSelectionRange(n.caret,n.caret)})},b=L({mutationFn:async()=>l.canRun?Et(e.id,{...sg(l),prompt:p.trim()||void 0}):null,onSuccess:e=>{if(e===null)return;let{run:t}=e;r.invalidateQueries({queryKey:c.todos}),r.invalidateQueries({queryKey:c.runs.all}),n(`/tasks/${t.id}`)},onError:e=>U(e.message,{tone:`danger`})}),x=L({mutationFn:()=>s(e.id),onSuccess:()=>{r.setQueryData(c.todos,t=>t?.filter(t=>t.id!==e.id)),r.invalidateQueries({queryKey:c.todos})},onError:e=>U(e.message,{tone:`danger`})}),S=b.isPending||x.isPending,C=pg(e);return(0,X.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,X.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,X.jsx)(ea,{tone:dg.tone,pulse:dg.pulse,title:dg.label,className:`mt-[5px]`}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`p`,{"data-slot":`todo-summary`,className:`text-sm leading-snug font-medium text-foreground`,children:e.summary}),(0,X.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,X.jsxs)(`span`,{children:[ia(e.ts),` ago`]}):null,e.action?(0,X.jsx)(`span`,{children:e.action}):null,e.taskId===void 0?null:t?(0,X.jsx)(q,{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,X.jsx)(`span`,{"data-slot":`todo-source-gone`,children:`source task deleted`}),wn(e.prUrl)?(0,X.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,X.jsxs)(`span`,{"data-slot":`todo-skill`,className:`font-mono`,children:[`skill: `,e.suggestedSkill]}):null]})]}),(0,X.jsx)(`div`,{className:`flex shrink-0 items-center gap-1.5 self-center`,children:C?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(W,{type:`button`,variant:`contrast`,size:`sm`,"data-action":`todo-run`,title:`Start a task from this follow-up`,disabled:S||!l.canRun,onClick:()=>b.mutate(),children:[(0,X.jsx)(ri,{"aria-hidden":`true`,className:`size-3`}),`Run`]}),(0,X.jsx)(W,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`todo-dismiss`,title:`Check off (remove)`,disabled:S,onClick:()=>x.mutate(),children:`Dismiss`})]}):(0,X.jsxs)(W,{type:`button`,variant:`contrast`,size:`sm`,"data-action":`todo-acknowledge`,title:`Acknowledge and remove this note`,disabled:S,onClick:()=>x.mutate(),children:[(0,X.jsx)(_,{"aria-hidden":`true`,className:`size-3`}),`Acknowledge`]})})]}),C?(0,X.jsxs)(`div`,{"data-slot":`todo-engine`,className:`flex flex-wrap items-center gap-2 pl-5`,children:[(0,X.jsx)(lg,{pick:a,onChange:o,disabled:S||!l.canRun}),!l.providerPending&&!l.canRun?(0,X.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,X.jsx)(q,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}):null,C?u?(0,X.jsxs)(`div`,{"data-slot":`todo-instructions`,className:`flex flex-col gap-2 pl-5`,children:[(0,X.jsx)(ba,{ref:h,"data-slot":`todo-instructions-input`,"aria-label":`Extra instructions for this follow-up`,value:p,onChange:e=>m(e.target.value),placeholder:`Add instructions for the agent… (appended to the suggestion above)`,maxLength:2e4,className:`min-h-16 text-[13px]`}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(ug,{templates:v,onInsert:y}),(0,X.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,X.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:p.trim()?`Edit instructions (added)`:`+ Add instructions`}):null]})}function gg({className:e,size:t=`default`,...n}){return(0,X.jsx)(Pc,{"data-slot":`switch`,"data-size":t,className:K(`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,X.jsx)(Ic,{"data-slot":`switch-thumb`,className:K(`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`)})})}function _g({onLongPress:e,onClick:t,delayMs:n=450,moveTolerance:r=8}){let i=(0,Y.useRef)({onLongPress:e,onClick:t});i.current={onLongPress:e,onClick:t};let a=(0,Y.useRef)(null),o=(0,Y.useRef)({x:0,y:0}),s=(0,Y.useRef)(!1),c=(0,Y.useCallback)(()=>{a.current!==null&&(clearTimeout(a.current),a.current=null)},[]);return(0,Y.useEffect)(()=>c,[c]),{onPointerDown:(0,Y.useCallback)(e=>{s.current=!1,c(),e.button===0&&(o.current={x:e.clientX??0,y:e.clientY??0},a.current=setTimeout(()=>{a.current=null,s.current=!0,i.current.onLongPress()},n))},[c,n]),onPointerMove:(0,Y.useCallback)(e=>{if(a.current===null)return;let t=(e.clientX??0)-o.current.x,n=(e.clientY??0)-o.current.y;Math.hypot(t,n)>r&&c()},[c,r]),onPointerUp:c,onPointerCancel:c,onContextMenu:(0,Y.useCallback)(e=>{e.preventDefault(),c(),!s.current&&(s.current=!0,i.current.onLongPress())},[c]),onClick:(0,Y.useCallback)(e=>{if(s.current){s.current=!1,e.preventDefault();return}i.current.onClick?.()},[]),onKeyDown:(0,Y.useCallback)(e=>{(e.key===`ArrowDown`||e.key===`Enter`&&e.shiftKey)&&(e.preventDefault(),i.current.onLongPress())},[])}}function vg({available:e,value:t,onChange:n,onSettingsOpenChange:r,runners:i,parentRunner:a,modelsFor:o}){let[s,c]=(0,Y.useState)(!1),l=Va(),u=(0,Y.useRef)({});t!==null&&(u.current=t);let d=e=>{c(e),r?.(e)},f=t!==null,p=_g({onLongPress:()=>d(!0),onClick:()=>n(f?null:u.current)});if(!e)return null;let m=(0,X.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":f,"aria-label":`Dispatch`,"data-slot":`dispatch-toggle`,"data-state":f?`on`:`off`,...p,className:K(l?`inline-flex h-full w-[26px] items-center justify-center transition-colors hover:bg-muted`:K(Hr,`w-[26px] justify-center px-0`),f&&(l?`hover:bg-primary/15`:`border-primary/60 bg-primary/10 text-primary hover:bg-primary/15 hover:text-primary`)),children:(0,X.jsx)(Ko,{"aria-hidden":`true`,className:K(`size-3 shrink-0`,f?`text-primary`:`text-soft-foreground`)})}),h=(0,X.jsx)(Tg,{value:t,remembered:u.current,onChange:n,runners:i,parentRunner:a,modelsFor:o}),g=(0,X.jsxs)(pr,{side:`top`,sideOffset:6,className:`max-w-[260px]`,children:[(0,X.jsx)(`div`,{className:`font-medium`,children:f?`Dispatch — on`:`Dispatch — off`}),(0,X.jsx)(`div`,{className:`text-contrast-foreground/80`,children:f?`Splits this task into subtasks it runs as separate tasks`:`Let this task split into subtasks`}),l?(0,X.jsx)(`div`,{className:`mt-0.5 text-contrast-foreground/60`,children:`▾ limits and subtask defaults`}):null]}),_=l?(0,X.jsxs)(`span`,{"data-slot":`dispatch-control`,"data-state":f?`on`:`off`,className:K(`inline-flex h-[26px] items-stretch overflow-hidden rounded-full border border-border bg-card text-muted-foreground transition-colors`,f&&`border-primary/60 bg-primary/10 text-primary`),children:[(0,X.jsx)(mr,{delayDuration:300,children:(0,X.jsxs)(gr,{children:[(0,X.jsx)(fr,{asChild:!0,children:m}),g]})}),(0,X.jsx)(`button`,{type:`button`,"aria-label":`Dispatch settings`,"aria-haspopup":`dialog`,"aria-expanded":s,"data-slot":`dispatch-settings-trigger`,onClick:()=>d(!s),className:K(`inline-flex w-[18px] items-center justify-center border-l border-border transition-colors hover:bg-muted`,f&&`border-primary/40 hover:bg-primary/15`),children:(0,X.jsx)(Dr,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})})]}):(0,X.jsx)(mr,{delayDuration:300,children:(0,X.jsxs)(gr,{children:[(0,X.jsx)(fr,{asChild:!0,children:m}),g]})});return l?(0,X.jsxs)(Or,{open:s,onOpenChange:d,children:[(0,X.jsx)(Tr,{asChild:!0,children:_}),(0,X.jsx)(Er,{align:`start`,sideOffset:8,"data-slot":`dispatch-settings`,className:`w-[340px] max-w-[calc(100vw-2rem)] p-3.5`,children:h})]}):(0,X.jsxs)(X.Fragment,{children:[_,(0,X.jsx)(Vn,{open:s,onOpenChange:d,children:(0,X.jsxs)(Bn,{side:`bottom`,"data-slot":`dispatch-settings`,className:`rounded-t-xl p-4 pt-16 pb-[max(1rem,env(safe-area-inset-bottom))]`,children:[(0,X.jsx)(Un,{className:`sr-only`,children:`Dispatch`}),(0,X.jsx)(Rn,{className:`sr-only`,children:`Split this task into subtasks run as separate tasks`}),h]})})]})}function yg({label:e,htmlFor:t,children:n}){return(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsx)(`label`,{htmlFor:t,className:`shrink-0 text-xs text-foreground`,children:e}),n]})}var bg=`h-7 max-w-[180px] rounded-md border border-input bg-card px-2 text-xs shadow-xs outline-none transition-[color,box-shadow] hover:bg-muted focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,xg=[2,3,4,5,8,10,15,20,30,50],Sg=.5,Cg=1e4;function wg(e){let t={};return e.maxSubtasks!==void 0&&(t.maxSubtasks=e.maxSubtasks),e.inFlight!==void 0&&(t.inFlight=e.inFlight),e.runner!==void 0&&(t.runner=e.runner),e.model!==void 0&&(t.model=e.model),e.budgetUsd!==void 0&&(t.budgetUsd=e.budgetUsd),t}function Tg({value:e,remembered:t,onChange:n,runners:r,parentRunner:i,modelsFor:a}){let o=(0,Y.useId)(),s=e!==null,c=e??t,l=e=>n(wg({...c,...e})),u=a(c.runner??i).filter(e=>e.id!==``),d=li.filter(e=>r.includes(e.id)),f=c.maxSubtasks!==void 0&&!xg.some(e=>e===c.maxSubtasks)?[...xg,c.maxSubtasks].sort((e,t)=>e-t):[...xg];return(0,X.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,X.jsxs)(`header`,{className:`flex items-start gap-2.5`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-7 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary`,children:(0,X.jsx)(Ko,{className:`size-3.5`})}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`div`,{className:`text-[13px] font-semibold leading-tight text-foreground`,children:`Dispatch`}),(0,X.jsx)(`p`,{className:`mt-0.5 text-xs leading-snug text-muted-foreground`,children:`Split this task into subtasks run as separate tasks`})]}),(0,X.jsx)(gg,{"aria-label":`Dispatch`,"data-slot":`dispatch-settings-switch`,checked:s,onCheckedChange:e=>n(e?t:null)})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-border pt-3`,children:[(0,X.jsx)(yg,{label:`Max subtasks`,htmlFor:`${o}-max`,children:(0,X.jsxs)(`select`,{id:`${o}-max`,"data-slot":`dispatch-max-subtasks`,className:bg,value:c.maxSubtasks??``,onChange:e=>l({maxSubtasks:e.target.value===``?void 0:Number(e.target.value)}),children:[(0,X.jsx)(`option`,{value:``,children:`unlimited`}),f.map(e=>(0,X.jsx)(`option`,{value:e,children:e},e))]})}),(0,X.jsx)(yg,{label:`In flight at once`,htmlFor:`${o}-flight`,children:(0,X.jsx)(`select`,{id:`${o}-flight`,"data-slot":`dispatch-in-flight`,className:bg,value:c.inFlight??4,onChange:e=>{let t=Number(e.target.value);l({inFlight:t===4?void 0:t})},children:Array.from({length:4},(e,t)=>t+1).map(e=>(0,X.jsx)(`option`,{value:e,children:e},e))})}),(0,X.jsx)(yg,{label:`Subtask runner`,htmlFor:`${o}-runner`,children:(0,X.jsxs)(`select`,{id:`${o}-runner`,"data-slot":`dispatch-runner`,className:bg,value:c.runner??``,onChange:e=>l({runner:e.target.value===``?void 0:e.target.value,model:void 0}),children:[(0,X.jsx)(`option`,{value:``,children:`same as parent`}),d.map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.label},e.id))]})}),(0,X.jsx)(yg,{label:`Subtask model`,htmlFor:`${o}-model`,children:(0,X.jsxs)(`select`,{id:`${o}-model`,"data-slot":`dispatch-model`,className:bg,value:c.model??``,onChange:e=>l({model:e.target.value===``?void 0:e.target.value}),children:[(0,X.jsx)(`option`,{value:``,children:`same as parent`}),u.map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.label},e.id)),c.model!==void 0&&!u.some(e=>e.id===c.model)?(0,X.jsx)(`option`,{value:c.model,children:c.model}):null]})}),(0,X.jsx)(yg,{label:`Budget per subtask`,htmlFor:`${o}-budget`,children:(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(ml,{id:`${o}-budget`,"data-slot":`dispatch-budget`,type:`number`,inputMode:`decimal`,placeholder:`none`,step:.5,min:Sg,max:Cg,className:`h-7 w-24 px-2 text-xs md:text-xs`,value:c.budgetUsd??``,onChange:e=>{let t=e.target.value,n=Number(t);l({budgetUsd:t===``||!Number.isFinite(n)||n<=0?void 0:Math.min(Cg,Math.max(Sg,n))})}}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`USD`})]})})]}),(0,X.jsxs)(`p`,{className:`text-xs leading-snug text-muted-foreground`,children:[`The engine keeps its own brakes: `,4,` in flight and budgets carved out of this task's. These only tell the agent what you want.`]})]})}var Eg=38,Dg=280,Og=900,kg=600,Ag=5500,jg=1400,Q=e=>({text:e,tone:`key`}),Mg=e=>({text:e,tone:`str`}),Ng=e=>({text:e,tone:`fn`}),Pg=e=>({text:e,tone:`com`}),Fg=e=>({text:e,tone:`num`}),$=e=>({text:e}),Ig=[[[Pg(`// task accepted — isolating a worktree`)],[Q(`const`),$(` tree = `),Q(`await`),$(` git.`),Ng(`worktree`),$(`(task.branch)`)],[Q(`const`),$(` agent = `),Ng(`spawn`),$(`(runner, { tree, skills })`)],[Q(`for await`),$(` (`),Q(`const`),$(` event `),Q(`of`),$(` agent.`),Ng(`stream`),$(`()) {`)],[$(` cockpit.`),Ng(`render`),$(`(event)`)],[$(`}`)]],[[$(`$ cezar run `),Mg(`--worktree --autonomous`)],[Mg(`✓`),$(` worktree ready · base `),Mg(`main`)],[Mg(`✓`),$(` agent started`)],[Pg(`… editing src/routes/new-task.tsx`)],[Mg(`✓`),$(` tests green · `),Fg(`+42 −7`)],[Mg(`✓`),$(` pull request opened`)]],[[Pg(`# flaky: replay before touching code`)],[Q(`def`),$(` `),Ng(`stabilize`),$(`(test):`)],[$(` `),Q(`for`),$(` attempt `),Q(`in`),$(` `),Ng(`range`),$(`(`),Fg(`3`),$(`):`)],[$(` `),Q(`if`),$(` `),Ng(`run`),$(`(test).ok:`)],[$(` `),Q(`return`),$(` `),Mg(`'green'`)],[$(` `),Q(`return`),$(` `),Ng(`quarantine`),$(`(test)`)]],[[Pg(`// apply the reviewed plan, step by step`)],[Q(`let`),$(` diff = worktree.`),Ng(`diff`),$(`()?;`)],[Q(`match`),$(` `),Ng(`review`),$(`(diff) {`)],[$(` Ok(pr) => gh::`),Ng(`open`),$(`(pr),`)],[$(` Err(e) => `),Ng(`retry`),$(`(e, backoff),`)],[$(`}`)]],[[Pg(`// merge when every check is green`)],[Q(`func`),$(` `),Ng(`merge`),$(`(pr *PullRequest) `),Q(`error`),$(` {`)],[$(` `),Q(`if`),$(` err := ci.`),Ng(`Wait`),$(`(pr); err != `),Q(`nil`),$(` {`)],[$(` `),Q(`return`),$(` err`)],[$(` }`)],[$(` `),Q(`return`),$(` gh.`),Ng(`Merge`),$(`(pr)`)],[$(`}`)]],[[Pg(`-- which branches ship the most?`)],[Q(`select`),$(` branch, `),Ng(`count`),$(`(*) `),Q(`as`),$(` runs`)],[Q(`from`),$(` tasks`)],[Q(`where`),$(` status = `),Mg(`'green'`)],[Q(`group by`),$(` branch`)],[Q(`order by`),$(` runs `),Q(`desc`),$(`;`)]],[[Pg(`/* the composer glow, one token deep */`)],[$(`.composer`),Q(`:focus-within`),$(` {`)],[$(` border-color: `),Ng(`var`),$(`(--primary);`)],[$(` box-shadow: `),Fg(`0 0 0 3px`),$(` `),Ng(`var`),$(`(--ring);`)],[$(` transition: box-shadow `),Fg(`120ms`),$(` ease;`)],[$(`}`)]]],Lg=[[`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%]`]],Rg={key:`var(--syn-key)`,str:`var(--syn-str)`,fn:`var(--syn-fn)`,com:`var(--syn-com)`,num:`var(--syn-num)`},zg=e=>e.reduce((e,t)=>e+t.text.length,0),Bg=e=>e.reduce((e,t)=>e+zg(t)*Eg+Dg,0);function Vg(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 Hg(){let e=Vg(Ig).slice(0,Lg.length),t=Vg(Lg.map(e=>e[Math.floor(Math.random()*e.length)]??``)),n=kg;return{blocks:e.map((e,r)=>{let i=n;return n+=Bg(e)+Og,{lines:e,slot:t[r]??``,startMs:i}}),cycleMs:n-Og+Ag+jg}}function Ug({block:e,cycleMs:t}){let n=e.startMs;return(0,X.jsx)(`div`,{className:K(`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=zg(e),i=n;return n+=r*Eg+Dg,(0,X.jsx)(`div`,{className:`ghost-code-line`,style:{"--n":r,"--t":`${r*Eg}ms`,"--d":`${i}ms`},children:e.map((e,t)=>(0,X.jsx)(`span`,{style:e.tone?{color:Rg[e.tone]}:void 0,children:e.text},t))},t)})})}var Wg=`(prefers-reduced-motion: reduce)`;function Gg(){let[e,t]=(0,Y.useState)(()=>typeof window.matchMedia==`function`&&!window.matchMedia(Wg).matches);return(0,Y.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(Wg),n=e=>t(!e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function Kg(){let[e,t]=(0,Y.useState)(0),n=Gg(),r=(0,Y.useMemo)(()=>Hg(),[e]);return(0,Y.useEffect)(()=>{if(!n)return;let e=window.setTimeout(()=>t(e=>e+1),r.cycleMs);return()=>window.clearTimeout(e)},[e,n,r.cycleMs]),(0,X.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,X.jsx)(`div`,{className:`contents`,children:r.blocks.map((e,t)=>(0,X.jsx)(Ug,{block:e,cycleMs:r.cycleMs},t))},e)})}function qg({source:e,className:t}){return(0,X.jsx)(`span`,{"data-slot":`skill-source`,"data-source":e,className:K(`shrink-0 rounded-full border border-border px-2 py-px font-mono text-[10.5px]`,la({source:e})?`font-semibold text-foreground`:`text-soft-foreground`,t),children:e})}function Jg({skill:e,usedBy:t,heading:n=`h2`}){return(0,X.jsxs)(`div`,{"data-slot":`skill-detail`,className:`min-w-0`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2.5`,children:[(0,X.jsx)(n,{className:`min-w-0 font-mono text-lg font-semibold break-all`,children:e.name}),(0,X.jsx)(qg,{source:e.source})]}),(0,X.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,X.jsx)(`p`,{"data-slot":`skill-description`,className:`mt-2.5 text-[13px] text-muted-foreground`,children:e.description}):null,t===void 0?null:(0,X.jsxs)(`section`,{"data-slot":`skill-used-by`,className:`mt-5`,children:[(0,X.jsx)(`h3`,{className:`text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:`Used by`}),t.length>0?(0,X.jsx)(`ul`,{className:`mt-1.5 flex flex-col gap-1`,children:t.map(e=>(0,X.jsxs)(`li`,{className:`flex items-center gap-1.5 font-mono text-xs text-muted-foreground`,children:[(0,X.jsx)(lo,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),e]},e))}):(0,X.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,X.jsxs)(`section`,{className:`mt-5`,children:[(0,X.jsx)(`h3`,{className:`text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:`Content`}),(0,X.jsx)(`div`,{"data-slot":`skill-body`,className:`mt-2 text-sm`,children:(0,X.jsx)(ka,{children:e.body})})]})]})}function Yg({skill:e,onClose:t}){return(0,X.jsx)(Gi,{open:e!==null,onOpenChange:e=>e?void 0:t(),children:(0,X.jsx)(Ui,{"data-slot":`skill-preview`,className:`block max-h-[80dvh] overflow-y-auto sm:max-w-2xl`,children:e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Wi,{className:`sr-only`,children:e.name}),(0,X.jsx)(Bi,{className:`sr-only`,children:`Read-only skill preview`}),(0,X.jsx)(Jg,{skill:e,heading:`h3`}),(0,X.jsx)(`p`,{className:`mt-5`,children:(0,X.jsx)(q,{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 Xg({source:e,ready:t,skills:n,skillUsage:r,workflows:i,onPick:a}){let[o,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(``),[u,d]=(0,Y.useState)(null),f=(0,Y.useRef)(null),{mostUsed:p,project:m,global:h}=oa(ma(n,c,r),r),g=i.find(e=>e.name===ei),v=sa(i,c).filter(e=>e.name!==ei),y=ua(`no skill`,`none plain ${ei} ${g?.description??``}`,c)>0,b=!y&&p.length===0&&m.length===0&&h.length===0&&v.length===0,x=e=>{a(e),s(!1)},S=t=>x(e?.source===t.source&&e.ref===t.ref?null:t),C=(t,n)=>{let r=e?.source===`skill`&&e.ref===t.name;return(0,X.jsxs)(_i,{value:`skill ${t.name} ${t.path}`,keywords:ca(t.name,t.description),"data-slot":`source-option`,"data-source-kind":`skill`,"data-source-ref":t.name,onSelect:()=>S({source:`skill`,ref:t.name}),children:[(0,X.jsx)(`span`,{className:K(`shrink-0 font-mono text-xs`,n&&`font-semibold`),children:t.name}),t.description?(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:t.description}):null,(0,X.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,X.jsx)(Ur,{"aria-hidden":`true`,className:`size-3.5`})}),r?(0,X.jsx)(_,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},t.path)},w=e===null?Uo:e.source===`skill`?Si:Qo,T=(0,X.jsxs)(`button`,{type:`button`,"data-slot":`source-pill`,"data-source-kind":e?.source??`none`,"aria-label":`Choose a skill or workflow`,title:e===null?`No skill — the task runs as one plain agent step. Pick a skill or workflow to change that.`:`Runs the ${e.source} "${e.ref}" — pick it again, or press ✕, to run without it`,disabled:!t,onKeyDown:t=>{e===null||t.metaKey||t.ctrlKey||t.altKey||t.key!==`Backspace`&&t.key!==`Delete`||(t.preventDefault(),a(null))},className:K(Hr,`font-mono text-[11.5px]`,e===null?`border-dashed text-soft-foreground`:`rounded-r-none border-r-0 border-foreground/60 pr-1.5 font-semibold text-foreground`),children:[(0,X.jsx)(w,{"aria-hidden":`true`,className:K(`size-3 shrink-0`,e===null?`text-soft-foreground`:`text-violet`)}),(0,X.jsx)(`span`,{className:`max-w-44 truncate`,children:t?e?.ref??`Skill`:`…`}),Wr]});return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Yg,{skill:u,onClose:()=>d(null)}),(0,X.jsxs)(Or,{open:o,onOpenChange:e=>{s(e),e||l(``)},children:[(0,X.jsxs)(`span`,{className:`inline-flex items-center`,children:[(0,X.jsx)(wr,{asChild:!0,children:T}),e!==null&&t?(0,X.jsx)(`button`,{type:`button`,"data-slot":`source-pill-clear`,"aria-label":`Clear the ${e.source} ${e.ref}`,title:`Run without it`,onClick:()=>a(null),className:K(Hr,`rounded-l-none border-foreground/60 pl-1.5 pr-2 text-soft-foreground hover:text-foreground`),children:(0,X.jsx)(wi,{"aria-hidden":`true`,className:`size-3`})}):null]}),(0,X.jsx)(Er,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,X.jsxs)(bi,{shouldFilter:!1,children:[(0,X.jsx)(fi,{placeholder:`search skills & workflows…`,value:c,onValueChange:l,onInput:()=>f.current?.scrollTo(0,0)}),(0,X.jsxs)(yi,{ref:f,"data-slot":`source-menu`,className:`max-h-[min(18rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[b?(0,X.jsx)(vi,{children:`Nothing matches.`}):null,y?(0,X.jsx)(mi,{children:(0,X.jsxs)(_i,{value:`none no-skill`,keywords:[`none`,`plain`,...ca(ei)],"data-slot":`source-option`,"data-source-kind":`none`,onSelect:()=>x(null),children:[(0,X.jsx)(ur,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-soft-foreground`}),(0,X.jsx)(`span`,{className:`shrink-0 text-xs font-medium`,children:`No skill`}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:g?.description??`One agent run on your task — no ceremony.`}),e===null?(0,X.jsx)(_,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]})}):null,p.length>0?(0,X.jsx)(mi,{heading:`Most used`,children:p.map(e=>C(e,la(e)))}):null,m.length>0?(0,X.jsx)(mi,{heading:`Project skills`,children:m.map(e=>C(e,!0))}):null,v.length>0?(0,X.jsx)(mi,{heading:`Workflows`,children:v.map(t=>{let n=e?.source===`workflow`&&e.ref===t.name;return(0,X.jsxs)(_i,{value:`workflow ${t.name}`,keywords:ca(t.name,t.description),"data-slot":`source-option`,"data-source-kind":`workflow`,"data-source-ref":t.name,onSelect:()=>S({source:`workflow`,ref:t.name}),children:[(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:t.name}),t.description?(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:t.description}):null,n?(0,X.jsx)(_,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]},t.name)})}):null,h.length>0?(0,X.jsx)(mi,{heading:`Global`,children:h.map(e=>C(e,!1))}):null]})]})})]})]})}function Zg(e,t,n){let r=e.skill===``?{source:`workflow`,ref:`quick-task`}:{source:`skill`,ref:e.skill};return si({task:e.ref,source:r,model:``,runner:t,defaultRunner:n,variants:1,images:[],todoId:e.todo})}function Qg(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 $g(e,t){return`Use the "${e}" skill on: ${t}`}function e_(e){let t=e.dispatch===!0,n=e.configuredAutonomous===`source-dependent`?e.source===`skill`:e.configuredAutonomous,r=e.interactive!==!0&&void 0;return{autonomous:e.planFirst?!1:e.explicitAutonomous??(t?!0:void 0)??r??n,worktree:e.hasGit?e.variants>1||t?!0:e.explicitWorktree??r??e.configuredWorktree:!1}}function t_(e){return e.dispatch===!0?e.autonomous===!0?`Runs on its own and fans work out to subtasks — it will not pause for you.`:`Fans work out to subtasks in isolated worktrees.`:e.worktree?`Runs in an isolated worktree — review everything before it lands.`:e.hasGit?`Runs in the repo working tree — your checkout is modified directly.`:`Runs in place — no git repository detected, so there is no worktree to isolate in.`}var n_={text:``,source:null,runner:null,agentProfile:null,model:null,variants:1,planFirst:!1,worktree:null,autonomous:null,generateFollowups:null,dispatch:null},r_=`cez-new-task-draft`;function i_(e){return e===null?r_:`${r_}:${e}`}function a_(e){let t=e&&typeof e==`object`?e:{};return{text:typeof t.text==`string`?t.text:``,source:s_(t.source)?t.source:null,runner:typeof t.runner==`string`?t.runner:null,agentProfile:typeof t.agentProfile==`string`?t.agentProfile:null,model:typeof t.model==`string`?t.model:null,variants:t.variants===2||t.variants===3?t.variants:1,planFirst:t.planFirst===!0,worktree:typeof t.worktree==`boolean`?t.worktree:null,autonomous:typeof t.autonomous==`boolean`?t.autonomous:null,generateFollowups:typeof t.generateFollowups==`boolean`?t.generateFollowups:null,dispatch:o_(t.dispatch)}}function o_(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e,n={},r=(e,t)=>typeof e==`number`&&Number.isInteger(e)&&e>=1&&e<=t?e:void 0,i=r(t.maxSubtasks,50);i!==void 0&&(n.maxSubtasks=i);let a=r(t.inFlight,4);return a!==void 0&&(n.inFlight=a),typeof t.runner==`string`&&li.some(e=>e.id===t.runner)&&(n.runner=t.runner),typeof t.model==`string`&&t.model!==``&&t.model.length<=120&&(n.model=t.model),typeof t.budgetUsd==`number`&&Number.isFinite(t.budgetUsd)&&t.budgetUsd>0&&t.budgetUsd<=1e4&&(n.budgetUsd=t.budgetUsd),n}function s_(e){return!!e&&typeof e==`object`&&(e.source===`skill`||e.source===`workflow`)&&typeof e.ref==`string`}var c_=new Map;function l_(e=null){let t=i_(e),n=c_.get(t);if(n)return{...n};let r;try{let e=localStorage.getItem(t);r=e?a_(JSON.parse(e)):{...n_}}catch{r={...n_}}return c_.set(t,r),{...r}}function u_(e,t=null){let n=i_(t);c_.set(n,{...e});try{localStorage.setItem(n,JSON.stringify(e))}catch{}}function d_(e=null){u_({...l_(e),text:``,source:null},e)}var f_=new Map;function p_(e=null){return[...f_.get(i_(e))??[]]}function m_(e,t=null){let n=i_(t);e.length===0?f_.delete(n):f_.set(n,[...e])}function h_(e,t){if(e===t)return{moved:!1,reason:`same-project`};let n=l_(e),r=p_(e);if(n.text===``&&r.length===0)return{moved:!1,reason:`nothing-to-move`};let i=l_(t);return i.text===``?(u_({...i,text:n.text},t),u_({...n,text:``},e),m_(r,t),m_([],e),{moved:!0}):{moved:!1,reason:`destination-busy`}}function g_(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 __(e,t,n){return{task:e,steps:[...n.steps],rationale:n.rationale,fallback:n.fallback,images:[...t]}}function v_(e,t){return!Number.isInteger(t)||t<0||t>=e.length?[...e]:e.filter((e,n)=>n!==t)}function y_(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 b_(e){return e.command??e.prompt??``}function x_(e,t=120){let n=e.split(`
8
+ `)[0]??``;return n.length>t?`${n.slice(0,t-1)}…`:n}function S_(e){let{task:t,steps:n,model:r,modelsLocked:i,runner:a,runnerExplicit:o,defaultRunner:s,variants:c,images:l,generateFollowups:u,todoId:d,dispatch:f}=e;return{task:t,steps:[...n],model:i?void 0:r||void 0,runner:ui(a,s,o),variants:c>1?c:void 0,images:l.length>0?[...l]:void 0,generateFollowups:u!==!1&&void 0,todoId:d||void 0,dispatch:f??void 0}}function C_({plan:e,starting:t,startAvailable:n,startUnavailableReason:r,startUnavailableAction:i,onStepsChange:a,onStart:o,onDiscard:s}){let[c,l]=(0,Y.useState)(null),[u,d]=(0,Y.useState)(null),f=()=>{l(null),d(null)},p=(t,n)=>{t.preventDefault(),c!==null&&c!==n&&a(y_(e.steps,c,n)),f()},m=e.steps.length===0;return(0,X.jsx)(Gi,{open:!0,onOpenChange:e=>e?void 0:s(),children:(0,X.jsxs)(Ui,{"data-slot":`plan-review`,showCloseButton:!1,className:K(`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,X.jsxs)(Hi,{className:`gap-1 border-b border-border px-5 pt-4 pb-3.5 text-left sm:text-left`,children:[(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,X.jsx)(Wi,{className:`text-[11px] font-semibold tracking-[0.08em] text-muted-foreground uppercase`,children:`Proposed chain`}),(0,X.jsx)(Vi,{"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,X.jsx)(wi,{"aria-hidden":`true`,className:`size-4`})})]}),(0,X.jsx)(Bi,{"data-slot":`plan-task`,title:e.task,className:`truncate text-[13.5px] font-medium text-foreground`,children:x_(e.task)}),e.fallback?(0,X.jsx)(`p`,{"data-slot":`plan-fallback`,className:`text-xs text-soft-foreground italic`,children:`planner unavailable — single-step plan`}):e.rationale===``?null:(0,X.jsx)(`p`,{"data-slot":`plan-rationale`,className:`text-xs text-muted-foreground`,children:e.rationale})]}),(0,X.jsx)(`ol`,{"data-slot":`plan-steps`,className:`flex-1 space-y-2 overflow-y-auto px-5 py-4`,children:m?(0,X.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,X.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:K(`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,X.jsx)(ko,{"aria-hidden":`true`,className:`size-3.5 shrink-0 cursor-grab text-soft-foreground`}),(0,X.jsx)(`span`,{className:`w-5 shrink-0 font-mono text-[11px] text-soft-foreground tabular-nums`,children:String(n+1).padStart(2,`0`)}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(`span`,{className:`truncate text-[13px] font-semibold`,children:t.name??t.id}),t.skill?(0,X.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,X.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,X.jsx)(`p`,{className:`truncate font-mono text-[11.5px] text-muted-foreground`,children:b_(t)})]}),(0,X.jsxs)(`span`,{className:`flex shrink-0 items-center`,children:[(0,X.jsx)(W,{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(y_(e.steps,n,n-1)),children:(0,X.jsx)(Sr,{"aria-hidden":`true`,className:`size-3.5`})}),(0,X.jsx)(W,{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(y_(e.steps,n,n+1)),children:(0,X.jsx)(sr,{"aria-hidden":`true`,className:`size-3.5`})}),(0,X.jsx)(W,{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(v_(e.steps,n)),children:(0,X.jsx)(wi,{"aria-hidden":`true`,className:`size-3.5`})})]})]},t.id))}),!n&&r?(0,X.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,X.jsx)(`span`,{children:r}),i]}):null,(0,X.jsxs)(`div`,{className:`flex items-center gap-2 px-5 py-3.5 pb-[max(14px,env(safe-area-inset-bottom))]`,children:[(0,X.jsxs)(W,{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,X.jsx)(ri,{"aria-hidden":`true`,className:`size-3.5`}),t?`Starting…`:`Start`]}),(0,X.jsx)(w_,{steps:e.steps,disabled:m}),(0,X.jsx)(W,{type:`button`,variant:`ghost`,className:`ml-auto`,onClick:s,children:`Discard`})]})]})})}function w_({steps:e,disabled:t}){let n=f(),[r,i]=(0,Y.useState)(!1),[a,o]=(0,Y.useState)(``),[s,l]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(!1),p=async t=>{let r=a.trim();if(!(r===``||u)){d(!0);try{let a=await tt({name:r,steps:e,...t?{overwrite:!0}:{}});U(`Saved — ${a.path.split(`/`).pop()??a.path}`),n.invalidateQueries({queryKey:c.workflows}),l(!1),i(!1),o(``)}catch(e){e instanceof Re&&e.exists===!0?l(!0):U(e instanceof Error?e.message:String(e),{tone:`danger`})}finally{d(!1)}}};return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(W,{type:`button`,variant:`outline`,"data-slot":`plan-save`,disabled:t,onClick:()=>i(!0),children:`Save as chain`}),(0,X.jsx)(Gi,{open:r,onOpenChange:e=>i(!!e),children:(0,X.jsxs)(Ui,{"data-slot":`plan-save-dialog`,className:`sm:max-w-sm`,showCloseButton:!1,children:[(0,X.jsxs)(Hi,{children:[(0,X.jsx)(Wi,{children:`Save as chain`}),(0,X.jsx)(Bi,{children:`Saves these steps as a reusable workflow — it joins the picker like any other chain.`})]}),(0,X.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),p(!1)},children:[(0,X.jsx)(ml,{value:a,onChange:e=>o(e.target.value),"aria-label":`Chain name`,placeholder:`e.g. fix-and-verify-v2`,maxLength:80,autoFocus:!0}),(0,X.jsxs)(zi,{className:`mt-4`,children:[(0,X.jsx)(W,{type:`button`,variant:`outline`,onClick:()=>i(!1),children:`Cancel`}),(0,X.jsx)(W,{type:`submit`,disabled:a.trim()===``||u,children:u?`Saving…`:`Save`})]})]})]})}),(0,X.jsx)(Mi,{open:s,onOpenChange:e=>e?void 0:l(!1),children:(0,X.jsxs)(Di,{"data-slot":`plan-overwrite-dialog`,children:[(0,X.jsxs)(ji,{children:[(0,X.jsxs)(Ei,{children:[`Overwrite “`,a.trim(),`”?`]}),(0,X.jsx)(Ti,{children:`A chain with this name already exists. Overwriting replaces its steps with this plan.`})]}),(0,X.jsxs)(ki,{children:[(0,X.jsx)(Ai,{children:`Keep the existing chain`}),(0,X.jsx)(Oi,{onClick:()=>void p(!0),children:`Overwrite`})]})]})})]})}function T_(){let[e]=T(),t=qi(),n=f(),{projectId:r}=ge(),i=p().projectId,a=st(),[o]=(0,Y.useState)(()=>g_(e)),s=z(),l=yt(),u=ie(),h=cn(),_=qt(),v=d(),y=et(),[b,x]=(0,Y.useState)(()=>({...l_(i),...o.ref===``?{}:{text:o.ref},...o.skill===``?{}:{source:{source:`skill`,ref:o.skill}}}));(0,Y.useEffect)(()=>{u_(b,i)},[b,i]);let S=e=>x(t=>({...t,...e})),[C,w]=(0,Y.useState)(()=>p_(i));(0,Y.useEffect)(()=>{m_(C,i)},[C,i]);let E=_.data?.recentSources,D=u.data,O=_.data?.skillUsage,A=(0,Y.useMemo)(()=>fa(D??[],O),[D,O]),j=l.data?.workflows??[],M=a.data?.projects??[],N=e=>a.data?.bootProject===e?null:e,P=u.data!==void 0&&l.data!==void 0&&!_.isPending,F=ni(b.source,A,j),I=F?.source===`skill`?A.find(e=>e.name===F.ref):void 0,ee=(0,Y.useRef)(null),te=(0,Y.useMemo)(()=>Ta(wa(_.data?.promptTemplates),s.data?.capabilities),[_.data?.promptTemplates,s.data?.capabilities]),ne=Ca(te,F?.source===`skill`?[F.ref]:[]),re=(0,Y.useRef)(b.text);re.current=b.text;let ae=(0,Y.useRef)(``);(0,Y.useEffect)(()=>{if(!P)return;let e=Ea(re.current,ae.current,ne);ae.current=e.applied,e.text!==re.current&&S({text:e.text})},[ne,P]);let L=ft(),oe=g(L.data),se=v.data?.defaultRunner,ce=se??`claude`,le=oe.length>0?Qr(b.runner,oe,ce):null,ue=le??ce,de=L.isSuccess&&oe.length>0,fe=R(ue),pe=v.data?.modelsLocked===!0,me=le===null?[]:Zr(le,fe.data,[b.model,v.data?.defaultModels?.[le]]),he=le===null?``:ci(pe?null:b.model,le,v.data?.defaultModels,fe.data),{accounts:_e,repoAccount:ve}=qr(),ye=_e.some(e=>e.provider===ue&&e.id===b.agentProfile)?b.agentProfile:null,be=(0,Y.useRef)(!1);(0,Y.useEffect)(()=>{let e=de&&!be.current;be.current=de,e&&document.activeElement===document.body&&document.querySelector(`textarea[aria-label="Describe a task for the agent"]`)?.focus()},[de]);let xe=h.data===void 0||h.data.info!==null,Se=xe?b.variants:1,Ce=xe,we=s.data?.capabilities.dispatch===!0&&xe,Te=we?b.dispatch:null,Ee=Te!==null,[De,Oe]=(0,Y.useState)(!1),[ke,Ae]=(0,Y.useState)(!1),je=(0,Y.useRef)(null),Me=e=>{S({dispatch:e}),je.current!==null&&clearTimeout(je.current),je.current=null,Oe(e!==null),e!==null&&(je.current=setTimeout(()=>Oe(!1),6e3))};(0,Y.useEffect)(()=>()=>{je.current!==null&&clearTimeout(je.current)},[]);let Ne=Se>1||Ee,Pe=e_({hasGit:xe,variants:Se,planFirst:b.planFirst,explicitAutonomous:b.autonomous,explicitWorktree:b.worktree,interactive:I?.interactive,configuredAutonomous:y.data?.composerDefaults?.autonomous??y.data?.composerDefaults?.inheritedAutonomous??`source-dependent`,configuredWorktree:y.data?.composerDefaults?.worktree??y.data?.composerDefaults?.inheritedWorktree??!0,source:F?.source??`workflow`,dispatch:Ee}),Fe=Pe.worktree,Ie=Pe.autonomous,Le=s.data===void 0||s.data.capabilities.followups,Re=Le?b.generateFollowups??_.data?.lastGenerateFollowups??!0:!1,[ze,Be]=(0,Y.useState)(null),[Ve,He]=(0,Y.useState)(!1),[Ue,We]=(0,Y.useState)(!1),[Ge,Ke]=(0,Y.useState)(()=>o.auto&&o.ref!==``),[qe,Je]=(0,Y.useState)(()=>!o.auto&&o.ref!==``?{kind:`prefill`}:null),Ye=(0,Y.useRef)(!1),B=(0,Y.useRef)(!1);(0,Y.useEffect)(()=>{Ye.current||(Ye.current=!0,e.toString()!==``&&t(`/new`,{replace:!0}))},[]),(0,Y.useEffect)(()=>{if(!B.current&&!(!o.auto||o.ref===``)&&!L.isPending){if(!de||le===null){B.current=!0,Je({kind:`prefill`}),Ke(!1);return}if(!v.isPending){if(B.current=!0,se===void 0){Je({kind:`prefill`}),Ke(!1);return}(async()=>{let e=``;try{e=(await mn()).key}catch{}if(e!==``&&o.key===e)try{let e=await Bt(Zg(o,le,se));d_(i),n.invalidateQueries({queryKey:c.runs.all}),t($r(e));return}catch(e){Je({kind:`failed`,message:e instanceof Error?e.message:String(e)})}else Je({kind:`blocked`});Ke(!1)})()}}},[v.isPending,se,L.isPending,de,le]),(0,Y.useEffect)(()=>{if(qe===null||!P)return;Je(null);let e=o.skill!==``&&!A.some(e=>e.name===o.skill)?o.skill:``;e!==``&&S({text:$g(o.skill,o.ref),source:null});let{message:t,tone:n}=Qg(qe,e);U(t,{tone:n}),document.querySelector(`[data-slot="composer"] button[aria-label="Start task"], [data-slot="composer"] button[aria-label="Plan task"]`)?.focus()},[qe,P]);let Xe=async(e,r)=>{if(!de||le===null)throw Error(L.isPending?`Checking agent providers…`:L.isError?`Provider authentication could not be verified.`:`Connect an agent provider before starting a task.`);if(!P)throw Error(`Still loading workflows and skills — try again in a second.`);if(b.planFirst){He(!0);try{Be(__(e,r,await m(e))),S({text:e})}finally{He(!1)}return}let a=await Bt(si({task:e,source:F,model:he,modelsLocked:pe,runner:le,runnerExplicit:b.runner!==null,agentProfile:ye,defaultRunner:se,variants:Se,images:r,worktree:Fe,autonomous:Ie,generateFollowups:Re,todoId:o.todo,dispatch:Te}));k({lastTask:F,...F?{recentSources:ai(E,F)}:{},...Le?{lastGenerateFollowups:Re}:{},...F?.source===`skill`&&_.data!==void 0?{skillUsage:pa(_.data.skillUsage,F.ref)}:{}}).then(()=>n.invalidateQueries({queryKey:c.uiState})).catch(()=>{}),d_(i),n.invalidateQueries({queryKey:c.runs.all}),t($r(a))},Ze=async()=>{if(!(ze===null||ze.steps.length===0||Ue||!de||le===null)){We(!0);try{let e=await Bt(S_({task:ze.task,steps:ze.steps,model:he,modelsLocked:pe,runner:le,runnerExplicit:b.runner!==null,defaultRunner:se,variants:Se,images:ze.images,generateFollowups:Re,todoId:o.todo,dispatch:Te}));Le&&k({lastGenerateFollowups:Re}).then(()=>n.invalidateQueries({queryKey:c.uiState})).catch(()=>{}),d_(i),Be(null),n.invalidateQueries({queryKey:c.runs.all}),t($r(e))}catch(e){U(e instanceof Error?e.message:String(e),{tone:`danger`})}finally{We(!1)}}};return Ge?(0,X.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,X.jsx)(ya,{}),(0,X.jsxs)(`div`,{"data-slot":`auto-starting`,role:`status`,className:`text-center`,children:[(0,X.jsx)(`h1`,{className:`animate-pulse text-lg font-semibold tracking-tight`,children:`Starting task…`}),(0,X.jsx)(`p`,{className:`mt-1.5 text-[13.5px] text-muted-foreground`,children:`Launched from a bookmarklet — taking you to the run.`})]})]}):(0,X.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,X.jsx)(ya,{}),(0,X.jsx)(Kg,{}),(0,X.jsxs)(`div`,{className:`w-full max-w-[720px]`,children:[(0,X.jsxs)(`header`,{className:`mb-6 text-center max-md:mb-4`,children:[(0,X.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight max-md:text-base`,children:`What should the agent work on?`}),(0,X.jsx)(`p`,{"data-slot":`run-mode-note`,className:`mt-1.5 text-[13.5px] text-muted-foreground max-md:text-xs`,children:t_({worktree:Fe,hasGit:xe,dispatch:Ee,autonomous:Ie})})]}),(0,X.jsx)(br,{ref:ee,onSubmit:Xe,value:b.text,onValueChange:e=>S({text:e}),images:C,onImagesChange:w,autoFocus:!0,placeholder:`Describe a task for the agent — / for skills…`,ariaLabel:`Describe a task for the agent`,sendAriaLabel:b.planFirst?`Plan task`:`Start task`,disabled:!de||Ue,disabledReason:L.isPending?`Checking agent providers…`:L.isError?`Provider authentication could not be verified.`:`Connect an agent provider before starting a task.`,autocompleteSkills:!0,footerStart:(0,X.jsxs)(X.Fragment,{children:[M.length>1&&r!==void 0?(0,X.jsx)(j_,{projects:M,projectId:r,onPick:e=>{h_(i,N(e)),t(`/p/${encodeURIComponent(e)}/new`,{replace:!0})}}):null,(0,X.jsx)(Xg,{source:F,ready:P,skills:A,skillUsage:O,workflows:j,onPick:e=>S({source:e})}),oe.length>1||oe.some(e=>Kr(_e,e))?(0,X.jsx)(Gr,{runners:oe,value:ue,accounts:_e,account:ye,repoAccount:ve,onPick:(e,t)=>S({runner:e,agentProfile:t,...e===ue?{}:{model:null}}),disabled:!de}):null,(0,X.jsx)(Jr,{slot:`model-pill`,ariaLabel:`Model`,label:me.find(e=>e.id===he)?.label??`auto`,value:he,disabled:!de,readOnly:pe,disabledHint:pe?`Model selection is locked to native coding-agent settings.`:void 0,onPick:e=>S({model:e}),options:me.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:ti(ue,fe.data,fe.isError)}),(0,X.jsx)(Jr,{slot:`variants-pill`,ariaLabel:`Parallel variants`,label:Se>1?`×${Se} variants`:`×1`,value:String(Se),onPick:e=>S({variants:Number(e)}),disabled:!xe,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`}]}),(0,X.jsx)(E_,{}),Ce?(0,X.jsx)(D_,{on:Fe,disabled:Ne,disabledReason:Ee?`Dispatch forks this task's commits — subtasks need a worktree`:`Parallel variants always use isolated worktrees`,onChange:e=>S({worktree:e})}):null,(0,X.jsx)(O_,{on:Ie,disabled:b.planFirst,onChange:e=>S({autonomous:e})}),Le?(0,X.jsx)(k_,{on:Re,onChange:e=>S({generateFollowups:e})}):null,te.length>0||we?(0,X.jsx)(E_,{}):null,(0,X.jsx)(ug,{templates:te,iconOnly:!0,onInsert:e=>ee.current?.insertAtCaret(e)}),(0,X.jsx)(vg,{available:we,value:Te,onChange:Me,onSettingsOpenChange:Ae,runners:oe,parentRunner:ue,modelsFor:e=>e===ue?me:Zr(e)}),h.data?.info?(0,X.jsx)(E_,{}):null,h.data?(0,X.jsx)(M_,{repo:h.data}):null,I?.interactive&&(b.autonomous===null||b.worktree===null)?(0,X.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]}),footerEnd:(0,X.jsxs)(X.Fragment,{children:[!de&&!L.isPending?(0,X.jsx)(q,{to:`/settings/agents#providers`,className:`text-xs font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):null,(0,X.jsx)(N_,{planFirst:b.planFirst,planning:Ve,onModeChange:e=>S({planFirst:e})}),(0,X.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:Oa()})]})}),Ee&&(ke||De)?(0,X.jsxs)(`p`,{"data-slot":`dispatch-hint`,className:`mt-2 rounded-md border border-primary/25 bg-primary/[0.07] px-3 py-1.5 text-xs text-muted-foreground`,children:[(0,X.jsx)(`strong`,{className:`font-semibold text-foreground`,children:`Dispatch is on.`}),` Splits this task into subtasks it runs as separate tasks. Worktree stays on. Long-press the icon for limits.`]}):null,(0,X.jsx)(F_,{onPick:e=>S({text:e})})]}),ze===null?null:(0,X.jsx)(C_,{plan:ze,starting:Ue,startAvailable:de,startUnavailableReason:L.isPending?`Checking agent providers…`:L.isError?`Provider authentication could not be verified.`:`Connect an agent provider before starting a task.`,startUnavailableAction:L.isPending?void 0:(0,X.jsx)(q,{to:`/settings/agents#providers`,children:`Configure providers`}),onStepsChange:e=>Be(t=>t&&{...t,steps:e}),onStart:()=>void Ze(),onDiscard:()=>Be(null)})]})}function E_(){return(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`mx-0.5 h-3.5 w-px shrink-0 bg-border max-md:hidden`})}function D_({on:e,disabled:t,disabledReason:n,onChange:r}){return(0,X.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:K(Hr,e&&`border-primary/60 text-foreground`),children:[e?(0,X.jsx)(_,{"aria-hidden":`true`,className:`size-3 shrink-0 text-primary`}):(0,X.jsx)(qo,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),`Worktree`]})}function O_({on:e,disabled:t,onChange:n}){return(0,X.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:K(Hr,e&&!t&&`border-primary/60 text-foreground`),children:[e?(0,X.jsx)(_,{"aria-hidden":`true`,className:`size-3 shrink-0 text-primary`}):(0,X.jsx)(qo,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),`Autonomous`]})}function k_({on:e,onChange:t}){return(0,X.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:K(Hr,e&&`border-primary/60 text-foreground`),children:[e?(0,X.jsx)(_,{"aria-hidden":`true`,className:`size-3 shrink-0 text-primary`}):(0,X.jsx)(qo,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),`Follow-ups`]})}function A_(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 j_({projects:e,projectId:t,onPick:n}){let[r,i]=(0,Y.useState)(!1),[a,o]=(0,Y.useState)(``),s=e.find(e=>e.id===t),c=A_(e,a);return(0,X.jsxs)(Or,{open:r,onOpenChange:e=>{i(e),e||o(``)},children:[(0,X.jsx)(wr,{asChild:!0,children:(0,X.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:K(Hr,`border-foreground/60 font-semibold text-foreground`),children:[(0,X.jsx)(wo,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),(0,X.jsx)(`span`,{className:`max-w-40 truncate`,children:s?.name??t}),Wr]})}),(0,X.jsx)(Er,{align:`start`,sideOffset:8,className:`w-[300px] max-w-[calc(100vw-2rem)] p-0`,children:(0,X.jsxs)(bi,{shouldFilter:!1,children:[(0,X.jsx)(fi,{placeholder:`search projects…`,value:a,onValueChange:o}),(0,X.jsxs)(yi,{"data-slot":`project-menu`,className:`max-h-[min(18rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[c.length===0?(0,X.jsx)(vi,{children:`Nothing matches.`}):null,c.map(e=>(0,X.jsxs)(_i,{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,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-medium`,children:e.name}),e.status===`missing`?(0,X.jsx)(`span`,{className:`shrink-0 text-[11px] text-soft-foreground`,children:`folder not found`}):e.branch===void 0?null:(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-soft-foreground`,children:e.branch}),e.id===t?(0,X.jsx)(_,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e.id))]}),(0,X.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 M_({repo:e}){let t=f(),n=L({mutationFn:e=>Pe({baseBranch:e}),onSuccess:e=>{t.invalidateQueries({queryKey:c.repo}),U(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=>U(e.message,{tone:`danger`})});return e.info?(0,X.jsx)(Jr,{slot:`base-pill`,ariaLabel:`Base branch`,label:(0,X.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),searchPlaceholder:`Search branches…`,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 N_({planFirst:e,planning:t,onModeChange:n}){return(0,X.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,X.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":!e,onClick:()=>n(!1),className:K(`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,X.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e,"aria-busy":t||void 0,"data-slot":`mode-plan`,onClick:()=>n(!0),className:K(`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 P_=[`Fix a failing or flaky test`,`Summarize recent commits on this branch`,`Update the README for recent changes`];function F_({onPick:e}){return(0,X.jsx)(`div`,{className:`mt-7 flex flex-wrap justify-center gap-2 max-md:justify-start`,children:P_.map(t=>(0,X.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,X.jsx)(Si,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),t]},t))})}function I_(){return(0,X.jsx)(`div`,{"data-route":`not-found`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(J,{icon:(0,X.jsx)(vo,{}),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,X.jsx)(W,{asChild:!0,variant:`outline`,children:(0,X.jsx)(q,{to:`/`,children:`Back to tasks`})})})})}function L_(){return(0,X.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(J,{icon:(0,X.jsx)(Xr,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading repository…`,subtitle:`Fetching the repo's git state.`})})}function R_(){return(0,X.jsxs)(`div`,{"data-route":`skills`,className:`flex min-h-full flex-col`,children:[(0,X.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,X.jsx)(`h1`,{className:`text-base font-semibold`,children:`Skills`}),(0,X.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Markdown playbooks agents can follow.`})]}),(0,X.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 z_({projectId:e,registry:t}){let n=t.projects.length?t.projects:[{id:t.bootProject,name:t.bootProject}];return(0,X.jsx)(`div`,{"data-route":`unknown-project`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(J,{icon:(0,X.jsx)(To,{}),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 this one can open:`,children:(0,X.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,X.jsx)(`li`,{children:(0,X.jsxs)(ke,{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,X.jsxs)(`span`,{className:`font-mono text-[11px] font-normal text-soft-foreground`,children:[`/p/`,e.id]})]})},e.id))})})})}function B_(){return(0,X.jsx)(`div`,{"data-route":`workflows`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(J,{icon:(0,X.jsx)(Xr,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading workflows…`,subtitle:`Fetching the saved chains and the skills palette.`})})}function V_({tab:e}){return(0,X.jsx)(`div`,{"data-route":`task-${e}`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(J,{icon:(0,X.jsx)(Xr,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:e===`changes`?`Loading changes…`:`Loading files…`,subtitle:`Fetching the run record.`})})}function H_({tab:e,error:t}){let n=t instanceof Re&&t.status===404;return(0,X.jsx)(`div`,{"data-route":`task-${e}`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(J,{icon:n?(0,X.jsx)(di,{}):(0,X.jsx)(Ci,{}),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,X.jsx)(W,{asChild:!0,variant:`outline`,children:(0,X.jsx)(q,{to:`/`,children:`Back to tasks`})})})})}function U_({className:e,orientation:t=`horizontal`,...n}){return(0,X.jsx)(nl,{"data-slot":`tabs`,"data-orientation":t,orientation:t,className:K(`group/tabs flex gap-2 data-[orientation=horizontal]:flex-col`,e),...n})}var W_=x(`group/tabs-list inline-flex w-fit items-center justify-center rounded-md p-[3px] text-muted-foreground group-data-[orientation=horizontal]/tabs:h-9 group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function G_({className:e,variant:t=`default`,...n}){return(0,X.jsx)(rl,{"data-slot":`tabs-list`,"data-variant":t,className:K(W_({variant:t}),e),...n})}function K_({className:e,...t}){return(0,X.jsx)(il,{"data-slot":`tabs-trigger`,className:K(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-sm border border-transparent px-3 py-1 text-[12.5px] font-medium whitespace-nowrap text-muted-foreground transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-xs group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent`,`data-[state=active]:bg-card data-[state=active]:font-semibold data-[state=active]:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100`,e),...t})}function q_({className:e,...t}){return(0,X.jsx)(al,{"data-slot":`tabs-content`,className:K(`flex-1 outline-none`,e),...t})}function J_(e){return li.flatMap(t=>{let n=e.filter(e=>e.provider===t.id);return n.length<2?[{runner:t,account:null,label:t.label,desc:t.desc,missing:!1}]:n.map(e=>({runner:t,account:e.isDefault?null:e.id,label:`${t.label} · ${e.label}`,desc:e.exists?e.configDir:`${e.configDir} — folder not created yet`,missing:!e.exists}))})}var Y_=e=>e.length>li.length;function X_({rows:e,runner:t,accountFor:n,providerStatus:r,disabled:i=!1,accountDisabled:a=!1,onPick:o}){let s=Y_(e);return(0,X.jsx)(`div`,{role:`radiogroup`,"aria-label":`Default runner`,"data-slot":`agents-runner`,className:K(`gap-0.5 rounded-md border border-border bg-card p-0.5`,s?`flex max-w-md flex-col`:`inline-flex w-fit`),children:e.map(c=>{let l=Ee(r.data,c.runner.id),u=!r.isPending&&!r.isError&&l?.enabled===!0&&l.status===`connected`,d=r.isPending?`Checking provider authentication…`:r.isError?`Provider authentication could not be verified.`:l?.enabled===!1?`This provider is disabled. Enable it above or choose another provider.`:u?void 0:`Connect this provider before selecting it.`,f=e.filter(e=>e.runner.id===c.runner.id).length>1,p=c.runner.id===t&&c.account===n(c.runner.id);return(0,X.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":p,"data-value":c.runner.id,"data-account":c.account??``,title:d??c.desc,disabled:i||!u||f&&a,onClick:()=>o(c.runner.id,c.account,f),className:K(`rounded-sm px-3 py-1.5 text-left font-mono text-[13px] font-medium transition-colors disabled:opacity-50`,p?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:[c.label,s?(0,X.jsx)(`span`,{"data-slot":c.missing?`agents-account-missing`:`agents-account-dir`,"data-runner":c.runner.id,className:`ml-2 font-sans text-[11.5px] text-soft-foreground`,children:c.desc}):null]},`${c.runner.id}:${c.account??``}`)})})}function Z_({open:e,onOpenChange:t,providers:n,initialProvider:r}){let[i,a]=(0,Y.useState)(null),[o,s]=(0,Y.useState)(null),[c,l]=(0,Y.useState)(r??n[0]??`claude`),[u,d]=(0,Y.useState)(``),[f,p]=(0,Y.useState)(``),[m,h]=(0,Y.useState)(!1),g=je(),_=f.trim();return(0,X.jsx)(Gi,{open:e,onOpenChange:t,children:(0,X.jsxs)(Ui,{"data-slot":`add-account-dialog`,className:`sm:max-w-lg`,children:[(0,X.jsxs)(Hi,{children:[(0,X.jsx)(Wi,{children:`Add agent account`}),(0,X.jsx)(Bi,{children:`The config folder this account uses. It does not have to exist yet — Connect signs in and the CLI creates it.`})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(`label`,{className:`flex items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`Agent`}),(0,X.jsx)(`select`,{"aria-label":`Agent`,"data-slot":`add-account-provider`,value:c,onChange:e=>l(e.target.value),className:`rounded-md border border-input bg-card px-2 py-1 text-[13px] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:n.map(e=>(0,X.jsx)(`option`,{value:e,children:e},e))})]}),(0,X.jsxs)(`label`,{className:`flex min-w-0 flex-1 items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Name`}),(0,X.jsx)(`input`,{type:`text`,"aria-label":`Account name`,"data-slot":`add-account-label`,value:u,placeholder:`Work`,onChange:e=>d(e.target.value),className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 text-[13px] outline-none focus-visible:border-ring`})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Folder`}),(0,X.jsx)(`input`,{type:`text`,spellCheck:!1,autoComplete:`off`,"aria-label":`Config folder`,"data-slot":`add-account-dir`,value:f,placeholder:c===`codex`?`~/.codex-second`:`~/.claude-second`,onChange:e=>{p(e.target.value),s(null),g.reset()},className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 font-mono text-[12.5px] outline-none focus-visible:border-ring`}),(0,X.jsx)(W,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`add-account-browse`,"aria-expanded":m,onClick:()=>h(e=>!e),children:m?`Hide folders`:`Browse…`})]}),(0,X.jsxs)(`p`,{className:`text-[11.5px] text-soft-foreground`,children:[`A `,(0,X.jsx)(`code`,{children:`~`}),` is kept as written and expanded when the agent runs.`]})]}),m?(0,X.jsx)(dl,{path:i,selected:o,onSelect:e=>{s(e),p(e.path),g.reset()},onEnter:e=>{a(e),s(null),g.reset()},showHidden:!0,emptyHint:`No subfolders here — pick this folder by typing its path above.`}):null,g.isError?(0,X.jsx)(`p`,{"data-slot":`add-account-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:g.error instanceof Error?g.error.message:`could not add that folder`}):null,(0,X.jsxs)(zi,{className:`min-w-0 sm:items-center sm:justify-end`,children:[(0,X.jsx)(W,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsx)(W,{"data-slot":`add-account-confirm`,disabled:_===``||g.isPending,onClick:()=>{_===``||g.isPending||g.mutate({provider:c,configDir:_,...u.trim()?{label:u.trim()}:{}},{onSuccess:()=>{t(!1),d(``),p(``),s(null),h(!1),U(`Account added — use Connect to sign in`)}})},children:g.isPending?`Adding…`:`Add account`})]})]})})}var Q_={claude:`Claude Code`,codex:`Codex`,junie:`Junie`,opencode:`OpenCode`,cursor:`Cursor`,pi:`pi`,copilot:`GitHub Copilot CLI`},$_={claude:`curl -fsSL https://claude.ai/install.sh | bash`,codex:`npm i -g @openai/codex`,junie:`https://www.jetbrains.com/junie/`,opencode:`https://opencode.ai`,cursor:`curl https://cursor.com/install -fsS | bash`,pi:`https://github.com/badlogic/pi-mono`,copilot:`npm i -g @github/copilot`},ev={connected:{label:`Connected`,tone:`success`},disconnected:{label:`Not connected`,tone:`pending`},"not-installed":{label:`Not installed`,tone:`neutral`},unknown:{label:`Could not verify`,tone:`danger`}};function tv(){let e=ae();return e.isPending?(0,X.jsx)(`p`,{"data-slot":`accounts-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent accounts…`}):e.isError?(0,X.jsx)(J,{icon:(0,X.jsx)(Ao,{}),tone:`danger`,title:`Agent accounts did not load`,subtitle:e.error.message,heading:`h2`}):(0,X.jsx)(nv,{data:e.data})}function nv({data:e}){let t=z(),[n,r]=(0,Y.useState)(null),[i,a]=(0,Y.useState)(null),o=fn(),s=en;return e.editable?(0,X.jsxs)(`div`,{"data-slot":`accounts-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-5 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Agent accounts`}),(0,X.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`One agent per tab: whether it is installed, and which logins you have. Add a second config folder to keep a work account beside a personal one; each project picks which it uses in its own Agents settings.`})]}),(0,X.jsx)(iv,{profiles:e}),(0,X.jsxs)(U_,{defaultValue:`claude`,children:[(0,X.jsx)(G_,{variant:`line`,"data-slot":`accounts-tabs`,children:s.map(e=>(0,X.jsx)(K_,{value:e,"data-provider":e,children:Q_[e]},e))}),s.map(n=>(0,X.jsx)(q_,{value:n,className:`pt-4`,children:(0,X.jsx)(rv,{provider:n,check:t.data?.checks?.find(e=>e.name===n),accounts:e.profiles.filter(e=>e.provider===n),canCarryAccounts:e.profileCapableProviders.includes(n),onAdd:()=>r(n),onRemove:a})},n))]}),n===null?null:(0,X.jsx)(Z_,{open:!0,onOpenChange:e=>!e&&r(null),providers:e.profileCapableProviders,initialProvider:n},n),(0,X.jsx)(Mi,{open:i!==null,onOpenChange:e=>!e&&a(null),children:(0,X.jsxs)(Di,{"data-slot":`accounts-remove-confirm`,children:[(0,X.jsxs)(ji,{children:[(0,X.jsxs)(Ei,{children:[`Remove “`,i?.label,`”?`]}),(0,X.jsxs)(Ti,{children:[`This only forgets the account. Nothing in `,i?.configDir,` is deleted — not your login, not your sessions. Projects using it fall back to the default account, and tasks that ran under it can no longer be resumed from here.`]})]}),(0,X.jsxs)(ki,{children:[(0,X.jsx)(Ai,{children:`Cancel`}),(0,X.jsx)(Oi,{"data-action":`accounts-remove-confirm`,disabled:o.isPending,onClick:()=>{let e=i;e&&o.mutate(e.id,{onSuccess:()=>{a(null),U(`Removed ${e.label}`)},onError:e=>U(e.message,{tone:`danger`})})},children:`Remove`})]})]})})]}):(0,X.jsxs)(`div`,{"data-slot":`accounts-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-4 p-4 md:p-6`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Agent accounts`}),(0,X.jsx)(`p`,{"data-slot":`accounts-hosted`,className:`text-[13px] text-soft-foreground`,children:`Agent accounts are managed from the machine that owns the checkout — this cockpit runs in hosted mode.`})]})}function rv({provider:e,check:t,accounts:n,canCarryAccounts:r,onAdd:i,onRemove:a}){let o=t?.available===!0;return(0,X.jsxs)(`div`,{"data-slot":`accounts-provider`,"data-provider":e,className:`flex flex-col gap-4`,children:[(0,X.jsxs)(`dl`,{className:`divide-y divide-border/60 overflow-hidden rounded-md border border-border bg-card text-[13px]`,children:[(0,X.jsx)(av,{label:`Installed`,children:t===void 0?(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`Checking…`}):o?(0,X.jsx)(`span`,{"data-slot":`agent-installed`,children:`Yes`}):(0,X.jsxs)(`span`,{"data-slot":`agent-installed`,className:`text-muted-foreground`,children:[`No — `,(0,X.jsx)(`code`,{className:`text-[12px]`,children:$_[e]})]})}),o&&t?.version?(0,X.jsx)(av,{label:`Version`,children:(0,X.jsx)(`span`,{"data-slot":`agent-version`,className:`font-mono text-[12.5px]`,children:t.version})}):null,(0,X.jsx)(av,{label:`Accounts`,children:(0,X.jsx)(`span`,{children:n.length===1?`the discovered one`:`${n.length} (1 discovered, ${n.length-1} added)`})})]}),(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:`Logins`}),r?(0,X.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,"data-action":`accounts-add`,"data-provider":e,onClick:i,children:`Add account`}):null]}),(0,X.jsx)(`ul`,{className:`divide-y divide-border/60 rounded-md border border-border bg-card`,children:n.map(e=>(0,X.jsx)(ov,{account:e,onRemove:()=>a(e)},e.id))}),r?null:(0,X.jsxs)(`p`,{"data-slot":`accounts-single-only`,className:`text-[11.5px] text-soft-foreground`,children:[Q_[e],` can only hold one account here: it keeps its credentials outside its config folder, so a second folder would change settings without changing the login — which would say “work account” while billing the other one.`]})]})}function iv({profiles:e}){let t=f(),n=et(),r=ft(),i=F(),a=ze(),o=L({mutationFn:e=>re(e),onSuccess:e=>t.setQueryData(V.config,e),onError:e=>U(e.message,{tone:`danger`})});if(n.data===void 0)return null;let s=J_(e.profiles),c=n.data.agentDefaults.runner??`claude`,l=n.data.agentDefaults.models??{};return(0,X.jsxs)(`section`,{"data-slot":`accounts-defaults`,className:`flex flex-col gap-3 rounded-lg border border-border bg-card/40 p-3.5`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:`Defaults for new projects`}),(0,X.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`What a project runs when it has not chosen for itself — set once instead of per repository. A project that has chosen keeps its own.`})]}),(0,X.jsx)(X_,{rows:s,runner:c,accountFor:t=>e.defaults[t]??null,providerStatus:r,disabled:o.isPending,accountDisabled:a.isPending,onPick:(e,t,n)=>{e!==c&&o.mutate({agentDefaults:{runner:e}}),n&&a.mutate({projectId:null,provider:e,profileId:t},{onError:e=>U(e.message,{tone:`danger`})})}}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Default model per agent`}),li.map(e=>(0,X.jsxs)(`label`,{className:`flex items-center gap-3`,children:[(0,X.jsx)(`span`,{className:`w-24 shrink-0 font-mono text-xs text-muted-foreground`,children:e.label}),(0,X.jsxs)(`select`,{"aria-label":`Default model for ${e.label}`,"data-slot":`accounts-default-model`,"data-runner":e.id,value:l[e.id]??``,disabled:o.isPending,onChange:t=>o.mutate({agentDefaults:{models:{[e.id]:t.target.value||null}}}),className:`block w-full max-w-xs rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[Zr(e.id,i[e.id].data,[l[e.id]]).map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.id===``?`auto (default)`:e.label},e.id)),ti(e.id,i[e.id].data,i[e.id].isError)?(0,X.jsx)(`option`,{disabled:!0,children:ti(e.id,i[e.id].data,i[e.id].isError)}):null]})]},e.id))]})]})}function av({label:e,children:t}){return(0,X.jsxs)(`div`,{className:`flex items-baseline gap-3 px-3.5 py-2.5`,children:[(0,X.jsx)(`dt`,{className:`w-28 shrink-0 text-muted-foreground`,children:e}),(0,X.jsx)(`dd`,{className:`min-w-0 flex-1`,children:t})]})}function ov({account:e,onRemove:t}){let[n,r]=(0,Y.useState)(!1),i=xn(e),a=Ie(),o=At(),s=he(i,e.status===void 0),c=e.status??s.data?.status,l=c?ev[c.status]:void 0;return(0,X.jsxs)(`li`,{"data-slot":`account-row`,"data-account":e.id,className:`flex flex-col gap-2 px-3.5 py-3`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`text-[13px] font-medium text-foreground`,children:e.label}),e.isDefault?(0,X.jsx)(sl,{variant:`ghost`,className:`shrink-0 text-[10px] text-muted-foreground`,children:`discovered`}):null]}),(0,X.jsx)(`p`,{"data-slot":`account-path`,className:`mt-0.5 truncate font-mono text-[11.5px] text-soft-foreground`,title:e.path,children:e.configDir}),(0,X.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,X.jsx)(ea,{tone:l?.tone??`neutral`,pulse:l===void 0}),(0,X.jsx)(`span`,{"data-slot":`account-status`,children:l?.label??`Checking…`}),e.exists?e.looksValid?null:(0,X.jsxs)(`span`,{"data-slot":`account-unrecognised`,children:[`— this folder does not look like `,Q_[e.provider],` config yet`]}):(0,X.jsx)(`span`,{"data-slot":`account-missing`,children:`— folder not created yet; Connect will make it`})]})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[c?.status===`connected`?null:(0,X.jsx)(W,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:a.isPending,onClick:()=>a.mutate({provider:e.provider,...e.isDefault?{}:{profileId:e.id}},{onSuccess:e=>U(e.opened?`Finish signing in in the terminal, then Check again.`:`This account is already connected.`),onError:e=>U(e instanceof Re&&e.command?`${e.message} — run: ${e.command}`:e.message,{tone:`danger`})}),children:`Connect`}),(0,X.jsx)(W,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`account-recheck`,disabled:o.isPending,title:`Re-probe this account's login now, instead of waiting for the cached answer`,onClick:()=>o.mutate(i,{onError:e=>U(e.message,{tone:`danger`})}),children:`Check again`}),(0,X.jsx)(W,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`account-details-toggle`,"aria-expanded":n,onClick:()=>r(e=>!e),children:n?`Hide details`:`Show details`})]})]}),n?(0,X.jsx)(sv,{account:e,routeId:i,onRemove:t}):null]})}function sv({account:e,routeId:t,onRemove:n}){let r=le(t,!0),i=bt(),a=nt(),[o,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(e.label),u=jt(),d=a.data?.targets??[],f=d.filter(e=>or(e.id)===void 0&&e.id!==`terminal`&&e.id!==`finder`).map(e=>({target:e})),p=d.filter(e=>or(e.id)===void 0).map(e=>({target:e})),m=(e,n,r)=>i.mutate({routeId:t,file:e,...r?{target:r}:{}},{onError:e=>U(e.message,{tone:`danger`}),onSuccess:()=>U(`Opened ${n}`)});return(0,X.jsxs)(`div`,{"data-slot":`account-details`,className:`rounded-md border border-border/60 bg-muted/30 p-3`,children:[r.isPending?(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Reading account details…`}):r.isError?(0,X.jsx)(`p`,{"data-slot":`account-details-error`,className:`text-xs text-danger`,children:r.error.message}):r.data.available?(0,X.jsx)(`dl`,{"data-slot":`account-identity`,className:`grid grid-cols-[7rem_minmax(0,1fr)] gap-x-3 gap-y-1 text-xs`,children:r.data.fields.map(e=>(0,X.jsxs)(Y.Fragment,{children:[(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,X.jsx)(`dd`,{className:`min-w-0 truncate text-foreground`,title:e.value,children:e.value})]},e.label))}):(0,X.jsx)(`p`,{"data-slot":`account-identity-unavailable`,className:`text-xs text-muted-foreground`,children:r.data.reason??`No account details to show.`}),(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5 border-t border-border/60 pt-2.5`,children:[(0,X.jsx)(`span`,{className:`mr-1 text-xs text-muted-foreground`,children:`Config files`}),e.files.map(e=>(0,X.jsx)(rr,{slot:`account-open-file`,label:e.label,triggerVariant:`outline`,disabled:i.isPending,title:e.exists?e.path:`${e.path} — not created yet`,choices:f,onPick:t=>m(e.id,e.label,t),leading:(0,X.jsxs)(Rr,{"data-target":`system`,onSelect:()=>m(e.id,e.label),children:[(0,X.jsx)(Fr,{"aria-hidden":`true`}),`System default`]})},e.id)),(0,X.jsx)(rr,{slot:`account-open-folder`,label:`Folder`,disabled:i.isPending,title:e.path,choices:p,onPick:e=>m(`folder`,`folder`,e),leading:(0,X.jsxs)(Rr,{"data-target":`system`,onSelect:()=>m(`folder`,`folder`),children:[(0,X.jsx)(Fr,{"aria-hidden":`true`}),`System default`]})})]}),e.isDefault?null:(0,X.jsxs)(`div`,{"data-slot":`account-manage`,className:`mt-3 flex flex-wrap items-center gap-2 border-t border-border/60 pt-2.5`,children:[(0,X.jsx)(`span`,{className:`mr-1 text-xs text-muted-foreground`,children:`Account`}),o?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`input`,{type:`text`,autoFocus:!0,"aria-label":`Name for ${e.label}`,"data-slot":`account-rename-input`,value:c,onChange:e=>l(e.target.value),className:`w-48 rounded-md border border-input bg-card px-2 py-1 text-xs outline-none focus-visible:border-ring`}),(0,X.jsx)(W,{type:`button`,size:`sm`,"data-action":`account-rename-save`,disabled:u.isPending||c.trim()===``||c.trim()===e.label,onClick:()=>u.mutate({id:e.id,label:c.trim()},{onSuccess:()=>s(!1),onError:e=>U(e.message,{tone:`danger`})}),children:`Save`}),(0,X.jsx)(W,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{l(e.label),s(!1)},children:`Cancel`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename`,onClick:()=>s(!0),children:`Rename`}),(0,X.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-remove`,onClick:n,children:`Remove`}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Renaming changes what cezar calls this account, not its folder.`})]})]})]})}var cv=1500;function lv(e,t){let n=(0,Y.useMemo)(()=>e.split(`
9
+ `).map(e=>[{content:e}]),[e]),r=(0,Y.useMemo)(()=>ja(t),[t]),i=n.length>cv,[a,o]=(0,Y.useState)(null);return(0,Y.useEffect)(()=>{if(r===null||i)return;let t=!1;return Ma(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:Aa(e,r)?.tokens??n}var uv=`m-0 min-h-full w-full whitespace-pre font-mono text-xs leading-[1.7] px-3 py-2 [tab-size:2]`;function dv({value:e,onChange:t,language:n,readOnly:r,className:i,...a}){let o=lv(e,n),s=(0,Y.useRef)(null),c=(0,Y.useRef)(null),l=()=>{let e=c.current,t=s.current;!e||!t||(t.scrollTop=e.scrollTop,t.scrollLeft=e.scrollLeft)};return(0,Y.useLayoutEffect)(l,[e]),(0,X.jsxs)(`div`,{"data-slot":`code-editor`,className:K(`relative overflow-hidden rounded-md border border-input bg-card`,i),children:[(0,X.jsx)(`pre`,{ref:s,"aria-hidden":`true`,className:K(uv,`pointer-events-none absolute inset-0 overflow-auto text-soft-foreground`),children:o.map((e,t)=>(0,X.jsx)(`span`,{className:`block`,children:e.length===0?`
10
+ `:(0,X.jsxs)(X.Fragment,{children:[e.map((e,t)=>(0,X.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t)),`
11
+ `]})},t))}),(0,X.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:K(uv,`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 fv=`An editor-plus-commit: a saved change reaches a run after you commit it to the base branch.`;function pv(e){return t=>t.runners.includes(e)}function mv(e,t,n,r){let i=pv(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 hv=[{id:`claude`,label:`Claude`,groups:[mv(`claude`,`settings`,`Settings`),mv(`claude`,`mcp`,`MCP`,`A dedicated .mcp.json (key: mcpServers), shared via version control.`),mv(`claude`,`memory`,`Memory & instructions`)]},{id:`codex`,label:`Codex`,note:fv,groups:[mv(`codex`,`settings`,`Settings`),mv(`codex`,`mcp`,`MCP`,`Inside config.toml under [mcp_servers.<id>] — the same file as Codex’s settings.`),mv(`codex`,`memory`,`Memory & instructions`)]},{id:`copilot`,label:`GitHub Copilot`,note:fv,groups:[mv(`copilot`,`settings`,`Settings`),mv(`copilot`,`mcp`,`MCP`,`A dedicated ~/.copilot/mcp-config.json. Per-run --additional-mcp-config augments it rather than replacing it.`),mv(`copilot`,`memory`,`Memory & instructions`)]},{id:`opencode`,label:`OpenCode`,note:fv,groups:[mv(`opencode`,`settings`,`Settings`),mv(`opencode`,`mcp`,`MCP`,`Under the "mcp" key in opencode.json — the same file as OpenCode’s settings.`),mv(`opencode`,`memory`,`Memory & instructions`)]},{id:`cursor`,label:`Cursor`,note:"Cursor Agent CLI (`agent`). Auth via `agent login` or CURSOR_API_KEY. No separate memory file — instructions live in rules/MCP elsewhere.",groups:[mv(`cursor`,`settings`,`Settings`),mv(`cursor`,`mcp`,`MCP`,`User ~/.cursor/mcp.json and project .cursor/mcp.json.`)]}];function gv(e){let t=hv.find(t=>t.id===e);if(!t)throw Error(`no agent descriptor for ${e}`);return t}function _v(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 vv(){let e=w(),t=z(),n=(0,Y.useMemo)(()=>t.data?ii(t.data.checks):hv.map(e=>e.id),[t.data]);return e.isPending?(0,X.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,X.jsx)(J,{icon:(0,X.jsx)(xo,{}),tone:`danger`,title:`Agent config did not load`,subtitle:e.error.message,heading:`h2`}):(0,X.jsx)(yv,{listing:e.data,installed:n})}function yv({listing:e,installed:t}){let[n,r]=(0,Y.useState)(`claude`),[i,a]=(0,Y.useState)(null),o=gv(n),s=e.files.find(e=>e.id===i)??null,c=e=>{r(e),a(null)};return(0,X.jsxs)(`div`,{"data-slot":`agent-config`,className:`flex flex-col gap-4 p-4 md:p-6`,children:[!e.editable&&(0,X.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,X.jsx)(`div`,{"data-slot":`agent-config-agents`,role:`tablist`,className:`flex flex-wrap gap-1 rounded-md bg-muted/40 p-1`,children:hv.map(e=>(0,X.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:K(`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,X.jsx)(sl,{variant:`outline`,className:`text-[10px] text-soft-foreground`,children:`not installed`})]},e.id))}),o.note&&(0,X.jsx)(`p`,{"data-slot":`agent-config-agent-note`,className:`text-[12px] text-soft-foreground`,children:o.note}),(0,X.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[minmax(0,20rem)_minmax(0,1fr)]`,children:[(0,X.jsx)(`nav`,{"data-slot":`agent-config-nav`,className:`flex flex-col gap-5`,children:(0,X.jsx)(bv,{agent:o,listing:e,selectedId:i,onSelect:a})}),(0,X.jsx)(`div`,{"data-slot":`agent-config-editor-pane`,children:s?(0,X.jsx)(Sv,{file:s},s.id):(0,X.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 bv({agent:e,listing:t,selectedId:n,onSelect:r}){return(0,X.jsx)(X.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,X.jsxs)(`section`,{"data-slot":`agent-config-group`,"data-group":i.id,"data-agent":e.id,children:[(0,X.jsx)(`p`,{className:`mb-1 text-[11px] font-medium uppercase tracking-wide text-soft-foreground`,children:i.label}),i.note&&(0,X.jsx)(`p`,{className:`mb-2 text-[12px] text-soft-foreground`,children:i.note}),(0,X.jsx)(`ul`,{className:`flex flex-col gap-1`,children:a.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`agent-config-file`,"data-selected":e.id===n,onClick:()=>r(e.id),className:K(`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,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[12px]`,children:e.label}),e.seeded&&(0,X.jsx)(sl,{variant:`outline`,className:`shrink-0 text-[10px]`,children:`seeded`}),!e.exists&&(0,X.jsx)(`span`,{className:`shrink-0 text-[11px] text-soft-foreground`,children:`absent`})]})},e.id))}),o&&t.userMcp&&(0,X.jsx)(xv,{userMcp:t.userMcp})]},i.id)})})}function xv({userMcp:e}){return(0,X.jsxs)(`div`,{"data-slot":`agent-config-user-mcp`,className:`mt-3`,children:[(0,X.jsx)(`h4`,{className:`mb-1 text-[12px] font-semibold`,children:`User & local scopes`}),(0,X.jsxs)(`p`,{className:`mb-2 text-[12px] text-soft-foreground`,children:[`Managed by `,(0,X.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,X.jsx)(`ul`,{className:`flex flex-wrap gap-1`,children:e.servers.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsx)(sl,{variant:`outline`,className:`font-mono text-[11px]`,children:e})},e))}):(0,X.jsx)(`p`,{className:`text-[12px] text-soft-foreground`,children:`No user-scoped MCP servers.`}):(0,X.jsx)(`p`,{className:`text-[12px] text-soft-foreground`,children:`Could not read the file.`})]})}function Sv({file:e}){let t=N(e.id),n=Ft(e.id),[r,i]=(0,Y.useState)(null),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(null),l=t.data?.version??null;(0,Y.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,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.label}),(0,X.jsx)(sl,{variant:`outline`,className:`text-[10px] uppercase`,children:e.format}),(0,X.jsx)(`a`,{href:e.docsUrl,target:`_blank`,rel:`noreferrer`,className:`text-[12px] text-soft-foreground underline hover:text-foreground`,children:`docs`})]}),(0,X.jsx)(`p`,{"data-slot":`agent-config-precedence`,className:`text-[12px] text-soft-foreground`,children:e.precedence}),(0,X.jsxs)(`p`,{"data-slot":`agent-config-effect`,className:`text-[12px] text-foreground/80`,children:[_v(e),e.hotReload?` ${e.hotReload}`:``]}),t.isPending?(0,X.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Loading file…`}):t.isError?(0,X.jsx)(`p`,{className:`text-[13px] text-destructive`,children:t.error.message}):(0,X.jsx)(dv,{value:u,language:e.format,readOnly:!f,onChange:i,"aria-label":`${e.label} contents`,className:`h-[26rem]`}),s&&(0,X.jsx)(`p`,{"data-slot":`agent-config-format-error`,className:`text-[12px] text-destructive`,children:s}),a&&(0,X.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,X.jsx)(`span`,{children:`The file changed on disk since you opened it.`}),(0,X.jsx)(W,{size:`sm`,variant:`outline`,onClick:()=>void t.refetch(),children:`Reload from disk`})]}),f&&(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(W,{size:`sm`,onClick:()=>{c(null),o(!1),n.mutate({content:u,version:l},{onSuccess:()=>{i(null),U(`${e.exists?`Saved`:`Created`} ${e.label}`)},onError:e=>{e instanceof Re&&e.status===409?o(!0):e instanceof Re&&e.status===400?c(e.message):U(e.message,{tone:`danger`})}})},disabled:!d||n.isPending,children:e.exists?`Save`:`Create`}),(0,X.jsx)(W,{size:`sm`,variant:`ghost`,onClick:()=>i(null),disabled:!d||n.isPending,children:`Revert`}),d&&(0,X.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`Unsaved changes`})]})]})}var Cv=[{id:`claude`,label:`Claude Code`,login:`claude auth login`},{id:`codex`,label:`Codex`,login:`codex login`},{id:`junie`,label:`Junie`,login:`junie login`},{id:`opencode`,label:`OpenCode`,login:`opencode auth login`},{id:`cursor`,label:`Cursor`,login:`agent login`},{id:`pi`,label:`pi`,login:`pi /login`},{id:`copilot`,label:`GitHub Copilot CLI`,login:`copilot login`}],wv=e=>({claude:e,codex:e,junie:e,opencode:e,cursor:e,pi:e,copilot:e}),Tv={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 Ev(e,t,n){return{providers:e.providers.map(e=>e.provider===t?{...e,enabled:n}:e)}}function Dv(){let e=ft(),t=Ze(),n=b(),r=f(),[i,a]=(0,Y.useState)(null),s=(0,Y.useRef)(Promise.resolve()),c=(0,Y.useRef)(wv(0)),l=(0,Y.useRef)(wv(0)),u=(0,Y.useRef)(e.data);(0,Y.useEffect)(()=>{i&&Ee(e.data,i.provider)?.status===`connected`&&a(null)},[i,e.data]),(0,Y.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?Ee(u.current,e.provider)?.enabled??e.enabled:e.enabled}))}}},[e.data]);let d=(0,Y.useCallback)((e,t)=>{let n=V.providerStatus,i=r.getQueryData(n);if(!i)return;u.current||=i;let a=Ev(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 at(e,t),a=Ee(i,e)?.enabled;if(a===void 0)return;if(u.current=Ev(u.current??i,e,a),o===c.current[e]){let t=r.getQueryData(n);r.setQueryData(n,t?Ev(t,e,a):i)}}catch(t){if(o===c.current[e]){let i=Ee(u.current,e)?.enabled,a=r.getQueryData(n);a&&i!==void 0?r.setQueryData(n,Ev(a,e,i)):u.current?r.setQueryData(n,u.current):r.removeQueries({queryKey:n,exact:!0}),U(t instanceof Error?t.message:String(t),{tone:`danger`})}}finally{--l.current[e]}})},[r]),p=L({mutationFn:e=>o(e),onSuccess:async e=>{a(null),U(e.opened?`Finish signing in in the terminal, then check again.`:`Provider is already connected.`),await r.invalidateQueries({queryKey:V.providerStatus})},onError:(e,t)=>{if(e instanceof Re&&e.command){let n=Cv.find(e=>e.id===t)?.label??t;a({provider:t,label:n,message:e.message,command:e.command});return}U(e.message,{tone:`danger`})}}),m=async e=>{try{await navigator.clipboard.writeText(e),U(`Command copied`)}catch{U(`Could not copy the command`,{tone:`danger`})}};return(0,X.jsxs)(`section`,{id:`providers`,"data-slot":`provider-settings`,className:`scroll-mt-20`,children:[(0,X.jsxs)(`div`,{className:`mb-2`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Providers`}),(0,X.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Connect the coding agents available on this computer.`})]}),e.isError?(0,X.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,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:`Provider status could not be loaded`}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.error.message})]}),(0,X.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,disabled:e.isFetching,onClick:()=>void e.refetch(),children:`Retry`})]}):null,(0,X.jsx)(`div`,{className:`flex flex-col gap-2`,children:Cv.map(r=>{let a=Ee(e.data,r.id),o=a?.status,s=o?Tv[o]:e.isPending?{label:`Checking…`,tone:`neutral`}:Tv.unknown,c=p.isPending&&p.variables===r.id,l=o===`disconnected`||o===`unknown`,u=a?.authFailureId;return(0,X.jsxs)(Y.Fragment,{children:[(0,X.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,X.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:r.label}),(0,X.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,X.jsx)(ea,{tone:s.tone,pulse:e.isPending}),(0,X.jsx)(`span`,{children:s.label}),a?.enabled===!1?(0,X.jsx)(`span`,{children:`Disabled`}):null]}),o===`not-installed`?(0,X.jsxs)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:[`Install `,r.label,`, then run `,(0,X.jsx)(`code`,{children:r.login}),`.`]}):o===`unknown`||e.isError&&!o?(0,X.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:a?.hint??`Verification failed. Check again when the provider is available.`}):a?.hint?(0,X.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:a.hint}):null]}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[o===`not-installed`?null:(0,X.jsx)(gg,{checked:a?.enabled??!0,"aria-label":`Use ${r.label}`,onCheckedChange:e=>d(r.id,e)}),l?(0,X.jsx)(W,{type:`button`,variant:`ghost`,size:`sm`,disabled:t.isPending,onClick:()=>t.mutate(void 0,{onError:e=>U(e.message,{tone:`danger`})}),children:`Check again`}):null,o===`disconnected`?(0,X.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,disabled:p.isPending,onClick:()=>p.mutate(r.id),children:c?`Opening…`:`Connect`}):null,u===void 0?null:(0,X.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,disabled:n.isPending,onClick:()=>n.mutate({provider:r.id,authFailureId:u},{onSuccess:()=>U(`${r.label} can be tried again.`),onError:e=>U(e.message,{tone:`danger`})}),children:`Try again`})]})]}),u===void 0?null:(0,X.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.`})]}),i?.provider===r.id&&o!==`connected`?(0,X.jsxs)(`div`,{role:`region`,"aria-label":`${i.label} manual sign-in`,className:`rounded-md border border-pending/40 bg-pending/5 px-3.5 py-3`,children:[(0,X.jsx)(`p`,{className:`text-[13px] text-foreground`,children:i.message}),(0,X.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`code`,{className:`min-w-0 flex-1 overflow-x-auto rounded-sm bg-muted px-2 py-1.5 text-xs`,children:i.command}),(0,X.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void m(i.command),children:`Copy command`})]})]}):null]},r.id)})})]})}var Ov=2e4;function kv(){let e=d(),t=F(),n=ft();return e.isPending?(0,X.jsx)(`p`,{"data-slot":`agents-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent settings…`}):e.isError?(0,X.jsx)(J,{icon:(0,X.jsx)($n,{}),tone:`danger`,title:`Agent settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,X.jsx)(Av,{config:e.data,catalogs:t,providerStatus:n})}function Av({config:e,catalogs:t,providerStatus:n}){let r=cn(),i=f(),a=L({mutationFn:e=>Pe(e),onSuccess:e=>{i.setQueryData(c.config,e),i.invalidateQueries({queryKey:c.health}),i.invalidateQueries({queryKey:c.repo})},onError:e=>U(e.message,{tone:`danger`})}),[o,s]=(0,Y.useState)(e.systemPrompt??``),l=o.trim(),u=l===(e.systemPrompt??``),d=l.length>Ov;return(0,X.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,X.jsx)(Dv,{}),(0,X.jsx)(jv,{defaultRunner:e.defaultRunner,providerStatus:n,saving:a.isPending,onPick:e=>a.mutate({defaultRunner:e})}),(0,X.jsx)(Mv,{title:`Default models`,hint:e.modelsLocked?`Models are locked to the defaults configured in the native coding-agent settings.`:`The model preselected in the composer for each runner. Auto lets the runner decide per task.`,children:(0,X.jsx)(`div`,{className:`flex max-w-md flex-col gap-2`,children:li.map(r=>{let i=Ee(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.`,c=t[r.id],l=ti(r.id,c.data,c.isError),u=Zr(r.id,c.data,[e.defaultModels[r.id]]),d=e.defaultModels[r.id]??``,f=u.find(e=>e.id===d)?.label??d??`auto (default)`;return(0,X.jsxs)(`label`,{className:`flex items-center gap-3`,children:[(0,X.jsx)(`span`,{className:`w-24 shrink-0 font-mono text-xs text-muted-foreground`,children:r.label}),e.modelsLocked?(0,X.jsx)(`output`,{"aria-label":`Default model for ${r.label}`,"data-slot":`agents-model`,"data-runner":r.id,title:`Model selection is locked to native coding-agent settings.`,className:`block w-full rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs`,children:f}):(0,X.jsxs)(`select`,{"aria-label":`Default model for ${r.label}`,"data-slot":`agents-model`,"data-runner":r.id,value:d,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:[u.map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.id===``?`auto (default)`:e.label},e.id)),l?(0,X.jsx)(`option`,{disabled:!0,children:l}):null]})]},r.id)})})}),(0,X.jsxs)(Mv,{title:`System prompt`,hint:`Extra instructions appended to every run, whichever runner executes it. This is the only place it is edited.`,children:[(0,X.jsx)(ba,{"aria-label":`System prompt`,"data-slot":`agents-system-prompt`,value:o,onChange:e=>s(e.target.value),placeholder:`Extra rules for every agent run — conventions, tone, review requirements…`,className:`min-h-32 max-w-xl`}),(0,X.jsxs)(`div`,{className:`flex max-w-xl items-center gap-3`,children:[(0,X.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,"data-action":`agents-save-prompt`,disabled:u||d||a.isPending,onClick:()=>a.mutate({systemPrompt:l===``?null:l},{onSuccess:()=>U(l===``?`System prompt cleared`:`System prompt saved`)}),children:`Save`}),d?(0,X.jsxs)(`p`,{"data-slot":`agents-prompt-limit`,className:`text-[11px] text-danger`,children:[l.length.toLocaleString(),` characters — the limit is`,` `,Ov.toLocaleString(),`.`]}):(0,X.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Leave empty and save to clear. Applied to new runs only.`})]})]}),(0,X.jsx)(Mv,{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,X.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,X.jsx)(gg,{"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:()=>U(e?`Live title updates on`:`Live title updates off`)})}),(0,X.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.liveTitleUpdates??!0?`On`:`Off`,e.liveTitleUpdates===null&&` (default)`]})]})}),(0,X.jsx)(Mv,{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,X.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,X.jsx)(gg,{"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:()=>U(e?`Review gate on`:`Review gate off`)})}),(0,X.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.reviewGate??!1?`On`:`Off`,e.reviewGate===null&&` (default)`]})]})}),(0,X.jsx)(Mv,{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,X.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,X.jsx)(`option`,{value:``,children:`follow checked-out branch (default)`}),r.data.branches.map(e=>(0,X.jsx)(`option`,{value:e,children:e},e))]}):(0,X.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 jv({defaultRunner:e,providerStatus:t,saving:n,onPick:r}){let i=ae(),a=st(),o=p(),s=cn(),c=ze(),l=o.projectId??`default`,u=s.data?.info?.root,d=u?i.data?.selections[u]:void 0,f=i.data?.defaults,m=J_(i.data?.profiles??[]),h=Y_(m);return(0,X.jsxs)(Mv,{title:h?`Default agent`:`Default runner`,hint:h?`Preselected for new tasks in THIS repo, and used by the chain planner. Each task can still pick another agent or account. The account is stored on this machine only — it is never committed, so a teammate keeps their own.`:`Preselected for new tasks in THIS repo, and used by the chain planner. Each task can still pick another runner.`,children:[(0,X.jsx)(X_,{rows:m,runner:e,accountFor:e=>d?.[e]??f?.[e]??null,providerStatus:t,disabled:n,accountDisabled:c.isPending||a.data===void 0,onPick:(t,n,i)=>{t!==e&&r(t),i&&c.mutate({projectId:l,provider:t,profileId:n},{onError:e=>U(e.message,{tone:`danger`})})}}),!t.isPending&&!t.isError&&Ee(t.data,e)?.enabled===!1?(0,X.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`This provider is disabled. Enable it above or choose another provider.`}):null,h?(0,X.jsx)(`p`,{className:`max-w-md text-[13px] text-muted-foreground`,children:`Tasks already started under another account can’t be resumed here — their sessions live in that account’s folder.`}):null]})}function Mv({title:e,hint:t,children:n}){return(0,X.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,X.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}var Nv=`cez-accent`,Pv=`cez-density`,Fv=`cez-width`,Iv=`lime`,Lv=`comfortable`,Rv=`narrow`;function zv(e){return e===`lime`||e===`violet`?e:Iv}function Bv(e){return e===`comfortable`||e===`compact`||e===`ultra`?e:Lv}function Vv(e){return e===`narrow`||e===`wide`?e:Rv}function Hv(e){let t=e&&typeof e==`object`?e:{};return{accent:zv(t.accent),density:Bv(t.density),width:Vv(t.width)}}function Uv(){try{return{accent:zv(localStorage.getItem(Nv)),density:Bv(localStorage.getItem(Pv)),width:Vv(localStorage.getItem(Fv))}}catch{return{accent:Iv,density:Lv,width:Rv}}}function Wv(e){try{localStorage.setItem(Nv,e.accent),localStorage.setItem(Pv,e.density),localStorage.setItem(Fv,e.width)}catch{}}function Gv(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 Kv=Y.createContext(null);function qv({children:e}){let t=f(),n=Nt(),[r,i]=Y.useState(Uv),a=n.data;Y.useEffect(()=>{if(a===void 0)return;let e=Hv(a.appearance);i(e),Wv(e)},[a]),Y.useLayoutEffect(()=>{Gv(document.documentElement,r)},[r]);let o=Y.useCallback(e=>{i(e),Wv(e),Lt({appearance:e}).then(e=>t.setQueryData(V.uiState,e)).catch(e=>{U(e instanceof Error?e.message:String(e),{tone:`danger`}),t.invalidateQueries({queryKey:V.uiState})})},[t]),s=Y.useCallback(e=>o({...r,accent:e}),[o,r]),c=Y.useCallback(e=>o({...r,density:e}),[o,r]),l=Y.useCallback(e=>o({...r,width:e}),[o,r]),u=Y.useMemo(()=>({accent:r.accent,density:r.density,width:r.width,setAccent:s,setDensity:c,setWidth:l}),[r,s,c,l]);return(0,X.jsx)(Kv.Provider,{value:u,children:e})}function Jv(){let e=Y.useContext(Kv);if(!e)throw Error(`cezar: useAppearance() must be called inside <AppearanceProvider>`);return e}var Yv=[{value:`system`,label:`System`,icon:Ro},{value:`light`,label:`Light`,icon:Yo},{value:`dark`,label:`Dark`,icon:zo}],Xv=[{value:`lime`,label:`Lime`,swatch:`var(--accent-lime)`},{value:`violet`,label:`Violet`,swatch:`var(--violet)`}],Zv=[{value:`comfortable`,label:`Comfortable`},{value:`compact`,label:`Compact`},{value:`ultra`,label:`Compact for real`}],Qv=[{value:`narrow`,label:`Narrow`},{value:`wide`,label:`Wide`}];function $v({slot:e,label:t,value:n,options:r,onChange:i}){return(0,X.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,X.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t,"data-value":e.value,onClick:()=>i(e.value),className:K(`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,X.jsx)(e.icon,{"aria-hidden":`true`,className:`size-3.5`}):null,e.swatch?(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 rounded-full border border-border`,style:{background:e.swatch}}):null,e.label]},e.value)})})}function ey({title:e,hint:t,children:n}){return(0,X.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,X.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}function ty(){let e=st(),{order:t,canReorder:n,reset:r}=Tp();return!((e.data?.projects.length??0)>1)||t.length===0?null:(0,X.jsx)(ey,{title:`Project order`,hint:`The sidebar is in the order you dragged it into. Reset puts it back to most-recently-opened first. Shared with every browser signed in to this cezar.`,children:(0,X.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`appearance-project-order-reset`,disabled:!n,onClick:r,className:`w-fit`,children:`Reset order`})})}function ny(){let{theme:e,setTheme:t}=Fl(),{accent:n,density:r,width:i,setAccent:a,setDensity:o,setWidth:s}=Jv();return(0,X.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,X.jsx)(ey,{title:`Theme`,hint:`System follows your OS preference. Applies to this browser.`,children:(0,X.jsx)($v,{slot:`appearance-theme`,label:`Theme`,value:e,options:Yv,onChange:t})}),(0,X.jsx)(ey,{title:`Accent`,hint:`The primary action color. Saved with this repo's cockpit state.`,children:(0,X.jsx)($v,{slot:`appearance-accent`,label:`Accent`,value:n,options:Xv,onChange:a})}),(0,X.jsx)(ey,{title:`Density`,hint:`Compact tightens spacing across the cockpit — text stays the same size.`,children:(0,X.jsx)($v,{slot:`appearance-density`,label:`Density`,value:r,options:Zv,onChange:o})}),(0,X.jsx)(ey,{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,X.jsx)($v,{slot:`appearance-width`,label:`Reading width`,value:i,options:Qv,onChange:s})}),(0,X.jsx)(ty,{})]})}var ry=`http://localhost:4321`;function iy(e,t,n,r=ry,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 ay(){let e=ie();return e.isPending?(0,X.jsx)(`p`,{"data-slot":`bookmarklets-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading bookmarklets…`}):e.isError?(0,X.jsx)(J,{icon:(0,X.jsx)(Ci,{}),tone:`danger`,heading:`h2`,title:`Could not load bookmarklets`,subtitle:e.error.message}):(0,X.jsx)(`div`,{className:`flex min-h-full flex-1 overflow-y-auto px-4 py-5 md:px-7`,children:(0,X.jsx)(oy,{skills:da(e.data??[])})})}function oy({skills:e}){let t=Jt(),n=z(),r=st(),[i,a]=(0,Y.useState)(!1),[o,s]=(0,Y.useState)(``),c=t.data?.key??``,l=window.location.origin,u=$i()??n.data?.bootProject??null,d=r.data?.projects.find(e=>e.id===u)?.name??vS(n.data)?.name??null,f=o.trim().toLowerCase(),p=e.filter(e=>e.name.toLowerCase().includes(f));return(0,X.jsxs)(`div`,{"data-slot":`bookmarklet-panel`,className:`mx-auto w-full max-w-2xl`,children:[(0,X.jsx)(`h2`,{className:`text-base font-semibold`,children:`Run from GitHub`}),(0,X.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,X.jsx)(`span`,{className:`font-mono`,children:`npx cezar`}),`.`]}),(0,X.jsxs)(`label`,{className:`mt-4 flex items-center gap-2 text-[13px] font-medium`,children:[(0,X.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,X.jsx)(`span`,{className:`font-normal text-soft-foreground`,children:`— re-drag the buttons after changing this`})]}),(0,X.jsx)(`div`,{"data-slot":`bm-generic`,className:`mt-4`,children:(0,X.jsx)(sy,{label:d?`cezar (${d}): this PR/issue`:`cezar: this PR/issue`,url:iy(``,!1,c,l,u),hint:`prefills the form — nothing starts by itself`})}),(0,X.jsx)(ml,{"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,X.jsx)(`div`,{"data-slot":`bm-list`,className:`mt-3 flex flex-col gap-2`,children:p.length>0?p.map(e=>(0,X.jsx)(sy,{label:d?`/${e.name} (${d})`:`/${e.name}`,url:iy(e.name,i,c,l,u),hint:e.source},e.path)):(0,X.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 sy({label:e,url:t,hint:n}){let r=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{r.current?.setAttribute(`href`,t)},[t]);let i=async()=>{try{await navigator.clipboard.writeText(t),U(`Bookmarklet URL copied.`)}catch{U(`Copy failed — drag the button instead.`,{tone:`danger`})}};return(0,X.jsxs)(`div`,{"data-slot":`bm-row`,className:`flex min-w-0 items-center gap-2.5`,children:[(0,X.jsxs)(`a`,{ref:r,draggable:!0,"data-slot":`bm-link`,title:`Drag me to your bookmarks bar`,onClick:e=>{e.preventDefault(),U(`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,X.jsx)(oi,{"aria-hidden":`true`,className:`size-3 text-primary`}),e]}),(0,X.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,X.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-soft-foreground`,children:n}):null]})}function cy(e){return{enabled:(e&&typeof e==`object`?e:{}).enabled===!0}}function ly(){let e=globalThis.Notification;if(typeof e!=`function`)return`unsupported`;let t=e.permission;return t===`granted`||t===`denied`?t:`default`}function uy(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||ta(i)&&r.push(i)}return{entering:r,statuses:n}}function dy(e){return e.enabled&&e.hidden&&e.permission===`granted`}function fy(e){let t=na(e).label;return{title:e.titleSummary??e.title,body:`Task ${t}`,tag:`cezar-run-${e.id}`}}function py(){let e=f(),t=Nt(),[n,r]=Y.useState(!1),[i,a]=Y.useState(ly),o=t.data;Y.useEffect(()=>{o!==void 0&&r(cy(o.notifications).enabled)},[o]);let s=Y.useCallback(t=>{r(t),Lt({notifications:{enabled:t}}).then(t=>e.setQueryData(V.uiState,t)).catch(t=>{U(t instanceof Error?t.message:String(t),{tone:`danger`}),e.invalidateQueries({queryKey:V.uiState})})},[e]),c=Y.useCallback(e=>{if(!e){s(!1);return}if(ly()!=="default"){s(!0);return}s(!0),Notification.requestPermission().then(e=>a(e)).catch(()=>a(ly()))},[s]),l=i===`unsupported`;return(0,X.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,X.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:(0,X.jsx)(`label`,{htmlFor:`notifications-enabled`,children:`Notify when an agent needs you`})}),(0,X.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,X.jsx)(gg,{id:`notifications-enabled`,"data-slot":`notifications-toggle`,checked:n,disabled:l,onCheckedChange:c})]}),l?(0,X.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,X.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]})})}var my=400,hy=Symbol(`none`),gy=e=>e===null?``:String(e);function _y({value:e,min:t,max:n,onCommit:r,allowEmpty:i=!1,emptyStepFrom:a,placeholder:o,disabled:s,"aria-label":c,"data-slot":l,className:u}){let d=(0,Y.useId)(),[f,p]=(0,Y.useState)(()=>gy(e)),m=(0,Y.useRef)(f),h=(0,Y.useRef)(null),g=(0,Y.useRef)(hy),_=(0,Y.useRef)({value:e,onCommit:r});_.current={value:e,onCommit:r};let v=e=>{m.current=e,p(e)};(0,Y.useEffect)(()=>{g.current=hy,h.current===null&&v(gy(e))},[e]);let y=(0,Y.useRef)(()=>{});(0,Y.useEffect)(()=>()=>{h.current!==null&&y.current()},[]);let b=e=>{let r=e.trim();if(r===``)return i?null:`invalid`;if(!/^-?\d+$/.test(r))return`invalid`;let a=Number(r);return a<t||a>n?`invalid`:a},x=b(f),S=x===`invalid`,C=()=>{h.current!==null&&(clearTimeout(h.current),h.current=null);let{value:e,onCommit:t}=_.current,n=b(m.current);if(n===`invalid`||n===e||g.current!==hy&&n===g.current)return;let r=t(n);r instanceof Promise&&(g.current=n,r.catch(()=>{g.current===n&&(g.current=hy),v(gy(_.current.value))}))};y.current=C;let w=e=>{let r=b(m.current),i=r===null?a??t:r===`invalid`?(_.current.value??a??t)+e:r+e;v(String(Math.min(n,Math.max(t,i)))),h.current!==null&&clearTimeout(h.current),h.current=setTimeout(C,my)},T=t=>{t.key===`ArrowUp`||t.key===`ArrowDown`?(t.preventDefault(),w(t.key===`ArrowUp`?1:-1)):t.key===`Enter`?(t.preventDefault(),C()):t.key===`Escape`&&(h.current!==null&&clearTimeout(h.current),h.current=null,v(gy(e)))},E=typeof x==`number`?x:null,D=`flex h-1/2 w-6 items-center justify-center text-soft-foreground hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-40`;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,X.jsxs)(`div`,{className:K(`flex w-28 items-stretch overflow-hidden rounded-md border border-input bg-card shadow-xs focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/50`,S&&`border-danger`,s&&`opacity-50`,u),children:[(0,X.jsx)(`input`,{type:`text`,inputMode:`numeric`,role:`spinbutton`,"aria-label":c,"aria-valuemin":t,"aria-valuemax":n,"aria-valuenow":E??void 0,"aria-invalid":S||void 0,"aria-describedby":S?d:void 0,"data-slot":l,value:f,placeholder:o,disabled:s,onChange:e=>v(e.target.value),onBlur:C,onKeyDown:T,className:`min-w-0 flex-1 bg-transparent px-3 py-1.5 text-sm outline-none placeholder:text-soft-foreground`}),(0,X.jsxs)(`div`,{className:`flex flex-col border-l border-input`,children:[(0,X.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-label":`Increase ${c}`,"data-action":`stepper-increment`,disabled:s||E!==null&&E>=n,onMouseDown:e=>e.preventDefault(),onClick:()=>w(1),className:D,children:(0,X.jsx)(po,{className:`size-3.5`})}),(0,X.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-label":`Decrease ${c}`,"data-action":`stepper-decrement`,disabled:s||E!==null&&E<=t,onMouseDown:e=>e.preventDefault(),onClick:()=>w(-1),className:K(D,`border-t border-input`),children:(0,X.jsx)(Dr,{className:`size-3.5`})})]})]}),S?(0,X.jsxs)(`p`,{id:d,"data-slot":`stepper-invalid`,className:`text-[11px] text-danger`,children:[`Enter a whole number from `,t,` to `,n,i?`, or leave it empty`:``,`.`]}):null]})}function vy(){let e=De();return{isPending:e.isPending,confirm:(t,n)=>e.mutate(t.id,{onSuccess:()=>{U(`${t.name} removed from the workspace — its files are untouched`),n?.()},onError:e=>U(e.message,{tone:`danger`})})}}function yy({project:e,onOpenChange:t,onConfirm:n}){return(0,X.jsx)(Mi,{open:e!==null,onOpenChange:t,children:(0,X.jsxs)(Di,{children:[(0,X.jsxs)(ji,{children:[(0,X.jsxs)(Ei,{children:[`Remove `,e?.name,` from the workspace?`]}),(0,X.jsxs)(Ti,{children:[`This only unregisters the project — `,(0,X.jsx)(`strong`,{children:`nothing on disk is deleted`}),`. The folder, its git history and its task history all stay exactly where they are, and adding it back later finds everything intact.`,(0,X.jsx)(`span`,{className:`mt-1 block truncate font-mono text-[11px] text-foreground`,title:e?.root,children:e?.root})]})]}),(0,X.jsxs)(ki,{children:[(0,X.jsx)(Ai,{children:`Keep it`}),(0,X.jsx)(Oi,{"data-action":`projects-confirm-remove`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:n,children:`Remove from list`})]})]})})}function by({title:e,hint:t,children:n}){return(0,X.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,X.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}var xy=1,Sy=16,Cy={ok:`ok`,"not-git":`no git repo`,missing:`folder not found`};function wy(e){let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function Ty(){let e=et(),t=st();return e.isPending||t.isPending?(0,X.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,X.jsx)(J,{icon:(0,X.jsx)(Eo,{}),tone:`danger`,title:`Project settings did not load`,subtitle:(e.error??t.error)?.message,heading:`h2`}):(0,X.jsx)(Ey,{config:e.data,registry:t.data})}function Ey({config:e,registry:t}){return(0,X.jsxs)(`div`,{"data-slot":`projects-section`,className:`mx-auto flex w-full max-w-4xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,X.jsx)(Dy,{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,X.jsx)(Dy,{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,X.jsx)(Oy,{registry:t,workspaceMax:e.resources.maxParallel})]})}function Dy({configKey:e,value:t,title:n,hint:r,placeholder:i,slot:a,savedLabel:o,footer:s,refreshProjects:c=!1}){let l=f(),u=L({mutationFn:t=>re(e===`browseRoot`?{browseRoot:t}:{projectsDir:t}),onSuccess:t=>{l.setQueryData(V.config,t),e===`browseRoot`?l.invalidateQueries({queryKey:V.fsBrowseRoot}):c&&l.invalidateQueries({queryKey:V.projects})}}),[d,p]=(0,Y.useState)(t),m=d.trim(),h=m===t,g=u.isError?u.error.message:null;return(0,X.jsxs)(by,{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,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`input`,{type:`text`,spellCheck:!1,"aria-label":n,"aria-invalid":g!==null,"data-slot":`projects-${a}-root`,value:d,disabled:u.isPending,placeholder:i,onChange:e=>{p(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,X.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,"data-action":`projects-save-${a}-root`,disabled:h||m===``||u.isPending,onClick:()=>u.mutate(m,{onSuccess:()=>U(`${o} set to ${m}`)}),children:`Save`})]}),g===null?(0,X.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:s}):(0,X.jsxs)(`p`,{"data-slot":`projects-${a}-root-error`,role:`alert`,className:`text-[11px] text-danger`,children:[g,` — setting unchanged`]})]})}function Oy({registry:e,workspaceMax:t}){let[n,r]=(0,Y.useState)(null),i=vy(),a=(0,Y.useMemo)(()=>ot(e.projects),[e.projects]);return(0,X.jsxs)(by,{title:`Registered projects`,hint:`The folders you have added. While this list is empty the folder cezar is serving is listed as “not registered” with an Add button; once you have projects, starting cezar somewhere new neither registers nor lists that folder — use “Add project” when you want to keep it. “Tags” group connected repositories — give the API, the web app and the design system a shared “storefront” tag and the global Tasks page can show all three as one piece of work. “Max parallel” caps how many of that project's tasks run at once (leave it empty to inherit the workspace limit); 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,X.jsx)(`p`,{"data-slot":`projects-empty`,className:`text-[13px] text-soft-foreground`,children:`No projects registered yet.`}):(0,X.jsx)(`div`,{className:`overflow-x-auto rounded-md border border-border`,children:(0,X.jsxs)(`table`,{className:`w-full border-collapse text-sm`,children:[(0,X.jsx)(`caption`,{className:`sr-only`,children:`Projects in this workspace`}),(0,X.jsxs)(`colgroup`,{children:[(0,X.jsx)(`col`,{}),(0,X.jsx)(`col`,{style:{width:`104px`}}),(0,X.jsx)(`col`,{style:{width:`260px`}}),(0,X.jsx)(`col`,{style:{width:`150px`}}),(0,X.jsx)(`col`,{style:{width:`72px`}}),(0,X.jsx)(`col`,{style:{width:`92px`}})]}),(0,X.jsx)(`thead`,{children:(0,X.jsxs)(`tr`,{className:`border-b border-border text-left text-[12px] text-soft-foreground`,children:[(0,X.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Project`}),(0,X.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Status`}),(0,X.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Tags`}),(0,X.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Max parallel`}),(0,X.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Added`}),(0,X.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium text-right`,children:`Actions`})]})}),(0,X.jsx)(`tbody`,{children:e.projects.map(n=>(0,X.jsx)(ky,{project:n,isBoot:n.id===e.bootProject,workspaceMax:t,vocabulary:a,disabled:i.isPending,onRemove:()=>r(n)},n.id))})]})}),(0,X.jsx)(yy,{project:n,onOpenChange:e=>!e&&r(null),onConfirm:()=>{if(!n)return;let e=n;r(null),i.confirm(e)}})]})}function ky({project:e,isBoot:t,workspaceMax:n,vocabulary:r,disabled:i,onRemove:a}){return(0,X.jsxs)(`tr`,{"data-slot":`project-row`,"data-project":e.id,className:`border-b border-border last:border-0`,children:[(0,X.jsxs)(`th`,{scope:`row`,className:`max-w-0 px-3 py-2 text-left font-normal`,children:[(0,X.jsx)(`span`,{className:`block truncate text-foreground`,children:e.name}),(0,X.jsx)(`span`,{className:`block truncate font-mono text-[11px] text-soft-foreground`,title:e.root,children:e.root})]}),(0,X.jsxs)(`td`,{className:`px-3 py-2`,children:[(0,X.jsx)(`span`,{"data-slot":`project-status`,className:e.status===`missing`?`text-[12px] text-danger`:`text-[12px] text-soft-foreground`,children:Cy[e.status]}),e.unregistered?(0,X.jsx)(`span`,{"data-slot":`project-unregistered`,className:`ml-1 text-[11px] text-soft-foreground`,children:`· not registered`}):e.status===`missing`?null:(0,X.jsxs)(`span`,{className:`ml-1 text-[11px] text-soft-foreground`,children:[`· `,e.source]})]}),(0,X.jsx)(`td`,{className:`px-3 py-2`,children:e.unregistered?(0,X.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`—`}):(0,X.jsx)(jy,{project:e,vocabulary:r})}),(0,X.jsx)(`td`,{className:`px-3 py-2`,children:e.unregistered?(0,X.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`—`}):(0,X.jsx)(My,{project:e,workspaceMax:n})}),(0,X.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:e.unregistered?`—`:wy(e.addedAt)}),(0,X.jsx)(`td`,{className:`px-3 py-2 text-right`,children:e.unregistered?(0,X.jsx)(Ay,{root:e.root,name:e.name,disabled:i}):(0,X.jsx)(W,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`project-remove`,"aria-label":`Remove ${e.name} from the workspace — unregisters it, no files are deleted`,title:t?"cezar is serving this project — stop it and use `cezar projects remove`":void 0,disabled:i||t,onClick:a,children:`Remove`})})]})}function Ay({root:e,name:t,disabled:n=!1}){let r=rt();return(0,X.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,"data-action":`project-add-boot`,"aria-label":`Add ${t} to your projects`,title:`cezar is serving this folder — save it to your projects`,disabled:n||r.isPending,onClick:()=>r.mutate(e,{onSuccess:()=>U(`${t} added to your projects`),onError:e=>U(e.message,{tone:`danger`})}),children:`Add project`})}function jy({project:e,vocabulary:t}){let n=zt(),[r,i]=(0,Y.useState)(``),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(-1),l=(0,Y.useRef)(null),u=e.tags??[],d=dt(t,u,r),f=a&&d.length>0,p=(t,r)=>{n.mutate({id:e.id,tags:t},{onSuccess:()=>U(r),onError:e=>U(e.message,{tone:`danger`})})},m=t=>{let n=t.trim().slice(0,32);if(c(-1),n){if(u.some(e=>e.toLowerCase()===n.toLowerCase())){i(``);return}if(u.length>=20){U(`${e.name} already has the maximum of 20 tags`,{tone:`danger`});return}i(``),p([...u,n],`${e.name} tagged \u201c${n}\u201d`)}},h=t=>{p(u.filter(e=>e!==t),`\u201c${t}\u201d removed from ${e.name}`)},g=`project-tag-suggestions-${e.id}`;return(0,X.jsxs)(`div`,{"data-slot":`project-tags`,className:`flex flex-wrap items-center gap-1`,children:[u.map(t=>(0,X.jsxs)(`span`,{"data-slot":`project-tag`,className:`inline-flex max-w-full items-center gap-1 rounded-full bg-violet/15 py-px pr-1 pl-2 text-[11px] font-medium whitespace-nowrap text-violet`,children:[t,(0,X.jsx)(`button`,{type:`button`,"data-action":`project-tag-remove`,"aria-label":`Remove tag ${t} from ${e.name}`,disabled:n.isPending,onClick:()=>h(t),className:`rounded-full p-0.5 hover:bg-violet/25 disabled:opacity-50`,children:(0,X.jsx)(wi,{className:`size-3`,"aria-hidden":`true`})})]},t)),(0,X.jsxs)(Or,{open:f,onOpenChange:o,children:[(0,X.jsx)(Tr,{asChild:!0,children:(0,X.jsx)(`input`,{ref:l,type:`text`,"data-slot":`project-tag-input`,"aria-label":`Add a tag to ${e.name}`,role:`combobox`,"aria-expanded":f,"aria-controls":f?g:void 0,"aria-autocomplete":`list`,"aria-activedescendant":f&&s>=0?`${g}-${s}`:void 0,placeholder:u.length===0?`Add tag…`:`+`,value:r,maxLength:32,disabled:n.isPending,onFocus:()=>o(!0),onBlur:()=>o(!1),onChange:e=>{if(o(!0),c(-1),e.target.value.includes(`,`)){i(e.target.value.replace(/,/g,``));return}i(e.target.value)},onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(d.length===0)return;e.preventDefault(),o(!0);let t=e.key===`ArrowDown`?1:-1,n=s+t;c(n>=d.length?-1:n<-1?d.length-1:n);return}if(e.key===`Escape`&&f){e.preventDefault(),o(!1),c(-1);return}if(e.key===`Enter`||e.key===`,`){e.preventDefault(),m(s>=0?d[s]??r:r);return}if(e.key===`Tab`){o(!1);return}if(e.key===`Backspace`&&r===``&&u.length>0){e.preventDefault();let t=u[u.length-1];t!==void 0&&h(t)}},className:`h-6 w-16 min-w-0 flex-1 rounded-md border border-input bg-card px-1.5 text-[12px] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`})}),(0,X.jsxs)(Er,{align:`start`,sideOffset:4,id:g,role:`listbox`,"data-slot":`project-tag-suggestions`,className:`w-56 p-1`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,X.jsx)(`p`,{className:`px-2 pt-1 pb-1.5 text-[10.5px] text-soft-foreground`,children:`Tags used in this workspace`}),d.map((e,t)=>(0,X.jsx)(`button`,{type:`button`,id:`${g}-${t}`,role:`option`,"aria-selected":t===s,"data-slot":`project-tag-suggestion`,onMouseDown:e=>e.preventDefault(),onClick:()=>{m(e),l.current?.focus()},onMouseEnter:()=>c(t),className:K(`flex w-full items-center rounded-sm px-2 py-1 text-left text-[12px] font-medium text-violet`,t===s&&`bg-muted`),children:e},e))]})]})]})}function My({project:e,workspaceMax:t}){let n=zt();return(0,X.jsx)(_y,{"aria-label":`Max parallel tasks for ${e.name}`,"data-slot":`project-max-parallel`,value:e.maxParallel??null,min:xy,max:Sy,allowEmpty:!0,emptyStepFrom:Math.min(Sy,Math.max(xy,t)),placeholder:`Inherit (${t})`,className:`w-40`,onCommit:r=>n.mutateAsync({id:e.id,maxParallel:r},{onSuccess:()=>U(r===null?`${e.name} inherits the workspace limit (${t})`:`${e.name} runs at most ${r} task${r===1?``:`s`} at a time`),onError:e=>U(e.message,{tone:`danger`})})})}function Ny(){let e=qt();return e.isPending?(0,X.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,X.jsx)(J,{icon:(0,X.jsx)(Bo,{}),tone:`danger`,title:`Prompt templates did not load`,subtitle:e.error.message,heading:`h2`}):(0,X.jsx)(Py,{initial:wa(e.data.promptTemplates)})}function Py({initial:e}){let t=f(),n=ie(),r=qt(),[i,a]=(0,Y.useState)(e),[o,s]=(0,Y.useState)(``),[l,u]=(0,Y.useState)(``),d=L({mutationFn:e=>k({promptTemplates:e}),onSuccess:e=>{t.setQueryData(c.uiState,e),U(`Prompt templates saved`)},onError:e=>U(e.message,{tone:`danger`})}),p=JSON.stringify(i)!==JSON.stringify(e),m=i.some(e=>e.label.trim()===``||e.text.trim()===``),h=(e,t)=>a(n=>n.map(n=>n.id===e?{...n,...t}:n)),g=(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})),_=e=>a(t=>t.filter(t=>t.id!==e));return(0,X.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,X.jsxs)(Iy,{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,X.jsx)(`div`,{"data-slot":`prompt-template-list`,className:`flex flex-col gap-3`,children:i.length===0?(0,X.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,X.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,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(ml,{"aria-label":`Label for ${e.label||`this template`}`,"data-slot":`prompt-template-label-input`,value:e.label,maxLength:80,onChange:t=>h(e.id,{label:t.target.value}),className:`flex-1`}),(0,X.jsx)(W,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`prompt-template-remove`,title:`Remove this template`,onClick:()=>_(e.id),children:(0,X.jsx)(wi,{"aria-hidden":`true`,className:`size-3.5`})})]}),(0,X.jsx)(ba,{"aria-label":`Text for ${e.label||`this template`}`,"data-slot":`prompt-template-text-input`,value:e.text,maxLength:2e3,onChange:t=>h(e.id,{text:t.target.value}),className:`min-h-14 text-[13px]`}),(0,X.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-1.5`,children:[(0,X.jsx)(Fy,{label:e.label,skills:n.data??[],skillUsage:r.data?.skillUsage,selected:e.skills??[],onToggle:t=>g(e.id,t)}),(e.skills??[]).map(t=>(0,X.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-skill-chip`,"data-skill":t,title:`Stop applying “${e.label}” automatically with ${t}`,onClick:()=>g(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,X.jsx)(wi,{"aria-hidden":`true`,className:`size-3`})]},t))]})]},e.id))}),(0,X.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,X.jsx)(ml,{"aria-label":`New template label`,"data-slot":`prompt-template-new-label`,placeholder:`Label (e.g. "Add tests")`,value:o,maxLength:80,onChange:e=>s(e.target.value)}),(0,X.jsx)(ba,{"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,X.jsxs)(W,{type:`button`,variant:`outline`,size:`sm`,"data-action":`prompt-template-add`,disabled:!o.trim()||!l.trim(),onClick:()=>{let e=o.trim(),t=l.trim();!e||!t||(a(n=>[...n,{id:xa(),label:e,text:t}]),s(``),u(``))},className:`self-start`,children:[(0,X.jsx)(Uo,{"aria-hidden":`true`,className:`size-3.5`}),`Add template`]})]}),(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsx)(W,{type:`button`,variant:`contrast`,size:`sm`,"data-action":`prompt-templates-save`,disabled:!p||m||d.isPending,onClick:()=>d.mutate(i),children:`Save`}),(0,X.jsx)(W,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`prompt-templates-reset`,disabled:d.isPending,onClick:()=>a(Da.map(e=>({...e}))),children:`Reset to defaults`}),m?(0,X.jsx)(`p`,{"data-slot":`prompt-templates-invalid`,className:`text-[11px] text-danger`,children:`Every template needs both a label and text.`}):null]})]})})}function Fy({label:e,skills:t,skillUsage:n,selected:r,onToggle:i}){let[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(``),l=(0,Y.useRef)(null),{mostUsed:u,project:d,global:f}=oa(ma(t,s,n),n),p=(e,t)=>{let n=r.includes(e.name);return(0,X.jsxs)(_i,{value:`skill ${e.name} ${e.path}`,keywords:ca(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,X.jsx)(`span`,{className:K(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,n?(0,X.jsx)(_,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]},e.path)};return(0,X.jsxs)(Or,{open:a,onOpenChange:e=>{o(e),e||c(``)},children:[(0,X.jsx)(wr,{asChild:!0,children:(0,X.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:K(`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,X.jsx)(Si,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),t.length===0?`no skills found`:`apply with…`,(0,X.jsx)(Dr,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,X.jsx)(Er,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,X.jsxs)(bi,{shouldFilter:!1,children:[(0,X.jsx)(fi,{placeholder:`search skills…`,value:s,onValueChange:c,onInput:()=>l.current?.scrollTo(0,0)}),(0,X.jsxs)(yi,{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,X.jsx)(vi,{children:`Nothing matches.`}):null,u.length>0?(0,X.jsx)(mi,{heading:`Most used`,children:u.map(e=>p(e,la(e)))}):null,d.length>0?(0,X.jsx)(mi,{heading:`Project skills`,children:d.map(e=>p(e,!0))}):null,f.length>0?(0,X.jsx)(mi,{heading:`Global`,children:f.map(e=>p(e,!1))}):null]})]})})]})}function Iy({title:e,hint:t,children:n}){return(0,X.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,X.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}var Ly=30,Ry=100,zy=32,By=60,Vy=85,Hy=e=>Math.min(100,Math.max(0,e));function Uy(){oo({enabled:!Va()});let e=Ga(),t=no(),{isError:n}=so(),r=$a(),i=eo(),a=ro(),o=r===void 0?void 0:Ra(r),s=o?.cpuPct,c=e===`local`&&!t,l=o?.memTotalBytes??0,u=o?.memUsedBytes!==void 0&&l>0?Hy(o.memUsedBytes/l*100):0,d=s===void 0?void 0:s>Vy?`bg-danger`:s>=By?`bg-pending`:`bg-primary`,f=s===void 0?void 0:Hy(s),p=i.length>=2?i.map((e,t)=>{let n=t/(Ly-1)*Ry,r=zy-Hy(e.cpuPct)/100*zy;return`${n.toFixed(1)},${r.toFixed(1)}`}).join(` `):void 0,m=o===void 0||!o.cpuLimited?s===void 0?`sampling…`:`${Math.round(s)}%`:s===void 0?`—`:`${Math.round(s)}%`,h=o===void 0||!o.cpuLimited?void 0:`${o.cpuLimitKind===`cpuset`?`cpuset `:``}${za(o.cpuCores)}`,g=o===void 0?void 0:`${o.memUsedBytes===void 0?`—`:tn(o.memUsedBytes)} / ${tn(o.memTotalBytes)}`;return(0,X.jsxs)(`section`,{"data-slot":`machine-card`,"aria-labelledby":`machine-card-title`,className:`rounded-xl border border-border bg-card/60 p-4`,children:[(0,X.jsxs)(`header`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(ea,{tone:c?`success`:`neutral`,pulse:c}),(0,X.jsx)(`h2`,{id:`machine-card-title`,className:`text-sm font-semibold`,children:`Machine`}),(0,X.jsx)(`span`,{"data-slot":`machine-card-mode`,className:`text-[11px] text-soft-foreground`,children:c?`live`:`last known`}),(0,X.jsx)(`span`,{"data-slot":`machine-card-freshness`,className:`ml-auto shrink-0 text-[11px] tabular-nums text-soft-foreground`,children:a===void 0?`waiting…`:`updated ${a} s ago`})]}),o?.hasContainer===!0?(0,X.jsxs)(`p`,{"data-slot":`machine-card-limits`,className:`mt-2 text-[11.5px] text-soft-foreground`,children:[`cgroup limits detected · `,o.source]}):null,t?(0,X.jsx)(`p`,{"data-slot":`machine-card-transport`,className:`mt-2 text-[11.5px] text-soft-foreground`,children:`Live updates unavailable - the server refused this origin's host topic, so the card reads the authenticated route instead.`}):null,n&&r===void 0?(0,X.jsx)(`p`,{"data-slot":`machine-card-error`,className:`mt-3 text-[12.5px] text-soft-foreground`,children:`Host totals are unavailable right now.`}):null,(0,X.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,X.jsxs)(`div`,{"data-slot":`machine-card-cpu`,className:`grid grid-cols-[86px_1fr] items-start gap-3`,children:[(0,X.jsxs)(`span`,{className:`pt-0.5 text-[12.5px] text-soft-foreground`,children:[`CPU`,o?.cpuIsEffective===!0?` (effective)`:``]}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsx)(`span`,{"data-slot":`machine-card-cpu-value`,className:`w-32 shrink-0 text-[13px] tabular-nums`,children:h===void 0?m:`${h} · ${m}`}),(0,X.jsx)(`div`,{className:`h-2 min-w-0 flex-1 overflow-hidden rounded-full bg-muted`,children:d===void 0||f===void 0?null:(0,X.jsx)(`div`,{"data-slot":`machine-card-cpu-bar`,className:K(`h-full rounded-full`,d),style:{width:`${f}%`}})})]}),p===void 0?null:(0,X.jsx)(`svg`,{"data-slot":`machine-card-cpu-sparkline`,className:`mt-1.5 h-8 w-full text-primary`,viewBox:`0 0 ${Ry} ${zy}`,preserveAspectRatio:`none`,role:`img`,"aria-label":`CPU over the last up to ${i.length*2} seconds`,children:(0,X.jsx)(`polyline`,{points:p,fill:`none`,stroke:`currentColor`,strokeWidth:1.5,vectorEffect:`non-scaling-stroke`})})]})]}),o===void 0?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{"data-slot":`machine-card-memory`,className:`grid grid-cols-[86px_1fr] items-center gap-3`,children:[(0,X.jsxs)(`span`,{className:`text-[12.5px] text-soft-foreground`,children:[`Memory`,o.memIsEffective?` (effective)`:``]}),(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,X.jsx)(`span`,{"data-slot":`machine-card-memory-value`,className:`w-32 shrink-0 text-[13px] tabular-nums`,children:g}),(0,X.jsx)(`div`,{className:`h-2 min-w-0 flex-1 overflow-hidden rounded-full bg-muted`,children:(0,X.jsx)(`div`,{className:`h-full rounded-full bg-primary`,style:{width:`${u}%`}})})]})]}),typeof r?.swapTotalBytes==`number`&&typeof r?.swapUsedBytes==`number`?(0,X.jsxs)(`div`,{"data-slot":`machine-card-swap`,className:`grid grid-cols-[86px_1fr] items-center gap-3`,children:[(0,X.jsx)(`span`,{className:`text-[12.5px] text-soft-foreground`,children:`Swap`}),(0,X.jsxs)(`span`,{className:`text-[13px] tabular-nums`,children:[tn(r.swapUsedBytes),` / `,tn(r.swapTotalBytes)]})]}):null,r?.loadAvg===void 0?null:(0,X.jsxs)(`div`,{"data-slot":`machine-card-load`,className:`grid grid-cols-[86px_1fr] items-center gap-3`,children:[(0,X.jsx)(`span`,{className:`text-[12.5px] text-soft-foreground`,children:`Load average`}),(0,X.jsxs)(`span`,{className:`flex items-center gap-2 text-[13px] tabular-nums`,children:[r.loadAvg.one.toFixed(2),` · `,r.loadAvg.five.toFixed(2),` ·`,` `,r.loadAvg.fifteen.toFixed(2),(0,X.jsx)(`span`,{"data-slot":`machine-card-load-cores`,className:`rounded-md border border-border px-1.5 py-0.5 text-[11px] text-soft-foreground`,children:o.hasContainer&&o.hostCpuCount!==void 0?`host ${o.hostCpuCount} cores`:`${r.cpuCount} cores`})]})]}),o.hasContainer&&o.hostCpuCount!==void 0?(0,X.jsxs)(`p`,{"data-slot":`machine-card-host-context`,className:`text-[11.5px] tabular-nums text-soft-foreground`,children:[`host `,za(o.hostCpuCount),` · `,tn(r?.memTotalBytes??0),` RAM`]}):null]})]}),(0,X.jsx)(`p`,{"data-slot":`machine-card-caveat`,className:`mt-3 border-t border-border pt-2 text-[11px] text-soft-foreground`,children:o?.hasContainer===!0?`Effective values come from this process’s own cgroup; host totals are labelled.`:o?.cgroupUnknown===!0?`No cgroup information available for this process - host totals only.`:`Host totals - no cgroup limit tighter than the host detected for this process.`})]})}var Wy=1,Gy=16,Ky=16,qy=1440,Jy=1,Yy=60,Xy=256;function Zy(){let e=et();return e.isPending?(0,X.jsx)(`p`,{"data-slot":`resources-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading resource settings…`}):e.isError?(0,X.jsx)(J,{icon:(0,X.jsx)(Do,{}),tone:`danger`,title:`Resource settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,X.jsx)(Qy,{config:e.data})}function Qy({config:e}){let t=f(),n=L({mutationFn:e=>re(e),onSuccess:e=>t.setQueryData(V.config,e),onError:e=>U(e.message,{tone:`danger`})}),[r,i]=(0,Y.useState)(e.resources.memoryLimitMb?String(e.resources.memoryLimitMb):``),a=e.resources.monitoringWakeIntervalMinutes??null,[o,s]=(0,Y.useState)(a===null?`park`:`interval`),[c,l]=(0,Y.useState)(String(a??5)),u=Number(c),d=!Number.isInteger(u)||u<Jy||u>Yy,p=o===`park`?a===null:!d&&a===u,m=()=>n.mutate({resources:{monitoringWakeIntervalMinutes:o===`park`?null:u}},{onSuccess:()=>U(o===`park`?`Monitoring will stay parked`:`Monitoring will re-check every ${u} minutes`)}),h=e.resources.autoResumeOnUsageLimit??!0,g=e=>n.mutate({resources:{autoResumeOnUsageLimit:e}},{onSuccess:()=>U(e?`Tasks stopped by a usage limit will resume themselves`:`Tasks stopped by a usage limit will stay failed`)}),_=r.trim()===``?0:Number(r),v=r.trim()!==``&&(!Number.isInteger(_)||_<Xy),y=(e.resources.memoryLimitMb??0)===(v?-1:_),b=()=>n.mutate({resources:{memoryLimitMb:_===0?null:_}},{onSuccess:()=>U(_===0?`Memory limit cleared`:`Memory limit set to ${_} MiB`)}),x=e.composerDefaults??{autonomous:null,worktree:null,inheritedAutonomous:`source-dependent`,inheritedWorktree:!0},S=(e,t)=>n.mutate({composerDefaults:{[e]:t===`inherit`?null:t===`on`}});return(0,X.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,X.jsx)(Uy,{}),(0,X.jsxs)(by,{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,X.jsx)(_y,{"aria-label":`Max parallel tasks`,"data-slot":`resources-max-parallel`,value:e.resources.maxParallel,min:Wy,max:Gy,onCommit:e=>n.mutateAsync({resources:{maxParallel:e??Wy}})}),(0,X.jsxs)(`p`,{className:`text-[11px] text-soft-foreground`,children:[`Need a different limit for one project?`,` `,(0,X.jsx)(ke,{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,X.jsxs)(by,{title:`Waiting-session idle timeout`,hint:`How long a plain waiting session may stay open without activity before its live backend session ends. Continue resumes it; set 0 to keep it open indefinitely.`,children:[(0,X.jsx)(_y,{"aria-label":`Waiting-session idle timeout`,"data-slot":`resources-idle-timeout`,value:e.resources.idleTimeoutMinutes??0,min:0,max:qy,onCommit:e=>n.mutateAsync({resources:{idleTimeoutMinutes:e??0}})}),(0,X.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Minutes; 0 keeps plain waiting sessions alive. Monitoring sessions are already exempt.`})]}),(0,X.jsxs)(by,{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,X.jsx)(_y,{"aria-label":`Extra monitoring sessions`,"data-slot":`resources-max-monitoring`,value:e.resources.maxMonitoringSessions??2,min:0,max:Ky,onCommit:e=>n.mutateAsync({resources:{maxMonitoringSessions:e??0}})}),(0,X.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,X.jsxs)(by,{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,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.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,X.jsx)(`option`,{value:`park`,children:`Park until resumed`}),(0,X.jsx)(`option`,{value:`interval`,children:`Re-check on an interval`})]}),o===`interval`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`input`,{type:`number`,min:Jy,max:Yy,"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,X.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`minutes`})]}):null,(0,X.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,"data-action":`resources-save-monitoring-wake`,disabled:p||o===`interval`&&d||n.isPending,onClick:m,children:`Save`})]}),o===`interval`&&d?(0,X.jsx)(`p`,{"data-slot":`resources-monitoring-wake-invalid`,className:`text-[11px] text-danger`,children:`Enter a whole number from 1 to 60 minutes.`}):(0,X.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Applied consistently to Claude, Codex and OpenCode.`})]}),(0,X.jsxs)(by,{title:`Auto-resume after a usage limit`,hint:`When an agent stops because its provider usage limit is reached, cezar waits for the reset the provider named and continues the task 30 seconds later — up to 12 times in a row without you. Off leaves the task failed with its Continue button.`,children:[(0,X.jsxs)(`select`,{"aria-label":`Auto-resume after a usage limit`,"data-slot":`resources-auto-resume`,value:h?`on`:`off`,disabled:n.isPending,onChange:e=>g(e.target.value===`on`),className:`block w-28 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,X.jsx)(`option`,{value:`on`,children:`On`}),(0,X.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,X.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Applies to Claude, Codex and OpenCode — whenever the provider says when the limit lifts.`})]}),(0,X.jsxs)(by,{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,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:Xy,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,X.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`MiB`}),(0,X.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,"data-action":`resources-save-memory`,disabled:y||v||n.isPending,onClick:b,children:`Save`})]}),v?(0,X.jsxs)(`p`,{"data-slot":`resources-memory-invalid`,className:`text-[11px] text-danger`,children:[`Enter a whole number of at least `,Xy,` MiB, or leave empty for no limit.`]}):(0,X.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Applies to newly started tasks.`})]}),(0,X.jsxs)(by,{title:`New task defaults`,hint:`Set stable composer defaults across projects. Explicit choices and run-shape constraints still win.`,children:[(0,X.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,"data-slot":`resources-composer-defaults`,children:[(0,X.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:`Autonomous by default`}),(0,X.jsxs)(`select`,{"aria-label":`Autonomous by default`,value:x.autonomous===null?`inherit`:x.autonomous?`on`:`off`,disabled:n.isPending,onChange:e=>S(`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,X.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,X.jsx)(`option`,{value:`on`,children:`On`}),(0,X.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,X.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[`Inherited: `,x.inheritedAutonomous===`source-dependent`?`Source-dependent — skills on, workflows off`:x.inheritedAutonomous?`On`:`Off`]})]}),(0,X.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:`Use a worktree by default`}),(0,X.jsxs)(`select`,{"aria-label":`Use a worktree by default`,value:x.worktree===null?`inherit`:x.worktree?`on`:`off`,disabled:n.isPending,onChange:e=>S(`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,X.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,X.jsx)(`option`,{value:`on`,children:`On`}),(0,X.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,X.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[`Inherited: `,x.inheritedWorktree?`On`:`Off`]})]})]}),(0,X.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Interactive skills may recommend both off. Multi-step and parallel runs remain isolated.`})]})]})}function $y(){let e=et(),t=st().data?.bootProject??``,n=Rt(t,!!t);return e.isPending?(0,X.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,X.jsx)(J,{icon:(0,X.jsx)(Vo,{}),tone:`danger`,title:`Skill settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,X.jsx)(eb,{config:e.data,update:n.data,updateError:n.error})}function eb({config:e,update:t,updateError:n}){let r=f(),i=L({mutationFn:e=>re(e),onSuccess:e=>r.setQueryData(V.config,e),onError:e=>U(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,X.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,X.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:(0,X.jsx)(`label`,{htmlFor:`skills-auto-update`,children:`Update Open Mercato skills automatically`})}),(0,X.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,X.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-1`,children:[(0,X.jsx)(gg,{id:`skills-auto-update`,"data-slot":`skills-auto-update`,checked:e.effectiveSkillsAutoUpdate,disabled:i.isPending,onCheckedChange:e=>i.mutate({skillsAutoUpdate:e})}),(0,X.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[e.effectiveSkillsAutoUpdate?`On`:`Off`,a?` (default)`:``]})]})]}),(0,X.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,X.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,X.jsx)(W,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`skills-use-default`,disabled:a||i.isPending,onClick:()=>i.mutate({skillsAutoUpdate:null}),children:`Use default`})]}),(0,X.jsx)(`p`,{"data-slot":`skills-installation-status`,role:n||t?.status===`unavailable`?`status`:void 0,className:`text-[13px] text-soft-foreground`,children:o})]})})}function tb(){let e=Ut(),t=f(),[n,r]=(0,Y.useState)(null),i=()=>t.invalidateQueries({queryKey:c.worktrees}),a=L({mutationFn:()=>Ge(),onSuccess:e=>{i(),U(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=>U(e.message,{tone:`danger`})}),o=L({mutationFn:e=>ye(e),onSuccess:()=>{i(),U(`Worktree removed`)},onError:e=>U(e.message,{tone:`danger`})});if(e.isPending)return(0,X.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading worktrees…`});if(e.isError)return(0,X.jsxs)(`p`,{"data-slot":`worktrees-error`,className:`text-[13px] text-danger`,children:[`Worktrees did not load: `,e.error.message]});let{worktrees:s,totalBytes:l,keep:u}=e.data,d=a.isPending||o.isPending;return(0,X.jsxs)(`div`,{"data-slot":`worktrees-panel`,className:`flex flex-col gap-3`,children:[s.length===0?(0,X.jsx)(`p`,{"data-slot":`worktrees-empty`,className:`text-[13px] text-soft-foreground`,children:`No task worktrees on disk.`}):(0,X.jsx)(`div`,{className:`overflow-x-auto rounded-md border border-border`,children:(0,X.jsxs)(`table`,{className:`w-full border-collapse text-sm`,children:[(0,X.jsx)(`caption`,{className:`sr-only`,children:`Task worktrees currently materialized on disk`}),(0,X.jsx)(`thead`,{children:(0,X.jsxs)(`tr`,{className:`border-b border-border text-left text-[12px] text-soft-foreground`,children:[(0,X.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Task`}),(0,X.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Status`}),(0,X.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Size`}),(0,X.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Age`}),(0,X.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium text-right`,children:`Actions`})]})}),(0,X.jsx)(`tbody`,{children:s.map(e=>(0,X.jsx)(nb,{worktree:e,disabled:d,onDelete:()=>r({kind:`delete`,runId:e.runId,title:e.title})},e.runId))})]})}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,X.jsxs)(`p`,{"data-slot":`worktrees-footer`,className:`text-[12px] text-soft-foreground`,children:[s.length,` worktree`,s.length===1?``:`s`,l===null?` · size unavailable`:` · ${tn(l)||`0 kB`} on disk`,` · `,u===0?`keeping all (unlimited)`:`keeping the last ${u}`]}),(0,X.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,"data-action":`worktrees-reclaim-now`,disabled:d,onClick:()=>r({kind:`reclaim`}),children:`Reclaim now`})]}),(0,X.jsx)(Mi,{open:n!==null,onOpenChange:e=>!e&&r(null),children:(0,X.jsxs)(Di,{children:[(0,X.jsxs)(ji,{children:[(0,X.jsx)(Ei,{children:n?.kind===`delete`?`Delete this worktree?`:`Reclaim old worktrees?`}),(0,X.jsx)(Ti,{children:n?.kind===`delete`?(0,X.jsxs)(X.Fragment,{children:[`This removes the worktree directory and its branch — the local-only work is not recoverable afterwards.`,(0,X.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,X.jsxs)(ki,{children:[(0,X.jsx)(Ai,{children:`Keep it`}),(0,X.jsx)(Oi,{"data-action":`worktrees-confirm`,className:n?.kind===`delete`?`bg-danger text-danger-foreground hover:brightness-[0.96]`:void 0,onClick:()=>{n?.kind===`reclaim`?a.mutate():n?.kind===`delete`&&o.mutate(n.runId),r(null)},children:n?.kind===`delete`?`Delete`:`Reclaim now`})]})]})})]})}function nb({worktree:e,disabled:t,onDelete:n}){return(0,X.jsxs)(`tr`,{"data-slot":`worktree-row`,"data-run":e.runId,className:`border-b border-border last:border-0`,children:[(0,X.jsxs)(`th`,{scope:`row`,className:`max-w-[220px] px-3 py-2 text-left font-normal`,children:[(0,X.jsx)(`span`,{className:`block truncate text-foreground`,title:e.title,children:e.title}),(0,X.jsx)(`span`,{className:`block truncate font-mono text-[11px] text-soft-foreground`,children:e.branch??e.runId.slice(0,8)})]}),(0,X.jsxs)(`td`,{className:`px-3 py-2`,children:[(0,X.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:e.status}),e.reclaimable?(0,X.jsx)(`span`,{"data-slot":`worktree-reclaimable`,className:`ml-1 text-[11px] text-soft-foreground`,children:`(reclaimable)`}):null]}),(0,X.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:e.sizeBytes===null?`—`:tn(e.sizeBytes)||`0 kB`}),(0,X.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:ia(e.finishedAt??void 0)||`—`}),(0,X.jsx)(`td`,{className:`px-3 py-2 text-right`,children:(0,X.jsx)(W,{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 rb=0,ib=1e3;function ab(){let e=d();return e.isPending?(0,X.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading worktree settings…`}):e.isError?(0,X.jsx)(J,{icon:(0,X.jsx)(Co,{}),tone:`danger`,title:`Worktree settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,X.jsx)(ob,{config:e.data})}function ob({config:e}){let t=f(),n=L({mutationFn:e=>Pe(e),onSuccess:e=>t.setQueryData(c.config,e),onError:e=>U(e.message,{tone:`danger`})}),[r,i]=(0,Y.useState)(String(e.worktreeRetention)),a=Number(r),o=r.trim()===``||!Number.isInteger(a)||a<rb||a>ib,s=e.worktreeRetention===(o?-1:a);return(0,X.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,X.jsxs)(by,{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,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:rb,max:ib,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,X.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`worktrees`}),(0,X.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,"data-action":`resources-save-retention`,disabled:s||o||n.isPending,onClick:()=>n.mutate({worktreeRetention:a},{onSuccess:()=>{t.invalidateQueries({queryKey:c.worktrees}),U(a===0?`Keeping all worktrees (unlimited)`:`Keeping the last ${a} finished worktree${a===1?``:`s`}`)}}),children:`Save`})]}),o?(0,X.jsxs)(`p`,{"data-slot":`resources-retention-invalid`,className:`text-[11px] text-danger`,children:[`Enter a whole number from `,rb,` to `,ib,` (0 = unlimited).`]}):(0,X.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,X.jsx)(by,{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,X.jsx)(tb,{})})]})}function sb(){let e=be(),t=Ue(),n=f(),[r,i]=(0,Y.useState)(`jira`),[a,o]=(0,Y.useState)(null),[s,l]=(0,Y.useState)(``),[u,d]=(0,Y.useState)(``),[p,m]=(0,Y.useState)(``),h=()=>{m(``),d(``),l(``),o(null)};(0,Y.useEffect)(()=>{h(),_(!1),x(null)},[Sn()]);let[g,_]=(0,Y.useState)(!1),[v,y]=(0,Y.useState)(``),[b,x]=(0,Y.useState)(null),S=Ye(r,v,g),C=S.data?.pages??[],w=C.find(e=>e.available)?.available?C.find(e=>e.available).source:void 0,T=(0,Y.useMemo)(()=>C.flatMap(e=>e.available?e.candidates:[]),[C]);(0,Y.useEffect)(()=>{_(!1),x(null),h()},[e.data?.connection?.id]);let E=C.find(e=>!e.available),D=async e=>{await n.invalidateQueries({queryKey:c.tracker.allFor(e)}),await n.invalidateQueries({queryKey:V.projects})},O=L({mutationFn:async()=>{if(!b||!w)throw Error(`Choose a tracker project first.`);let t=Sn(),n=c.tracker.associationFor(t);return{...await vt({kind:r,sourceId:w.id,externalId:b.id,...e.data?.connection?{connectionId:e.data.connection.id}:{}}),projectId:t,associationKey:n}},onSuccess:async e=>{await Promise.all([n.cancelQueries({queryKey:c.tracker.allFor(e.projectId)}),n.cancelQueries({queryKey:V.projects})]),n.setQueryData(e.associationKey,{association:e.association}),_(!1),x(null),await D(e.projectId),U(`${e.association.externalName} connected`)},onError:e=>U(e.message,{tone:`danger`})}),k=L({mutationFn:async()=>{let e=Sn(),t=c.tracker.associationFor(e);return{...await Je(),projectId:e,associationKey:t}},onSuccess:async e=>{await Promise.all([n.cancelQueries({queryKey:c.tracker.allFor(e.projectId)}),n.cancelQueries({queryKey:V.projects})]),n.setQueryData(e.associationKey,{association:null}),await D(e.projectId),U(`Tracker disconnected`)},onError:e=>U(e.message,{tone:`danger`})}),A=L({onMutate:()=>Sn(),mutationFn:async()=>{let e=Sn();if(!a)throw Error(`Choose a provider.`);return{...await $e(a===`jira`?{kind:`jira`,origin:s.trim(),email:u.trim(),token:p}:{kind:`linear`,key:p}),projectId:e}},onSuccess:async e=>{Sn()===e.projectId&&(h(),_(!1),x(null)),await n.cancelQueries({queryKey:c.tracker.allFor(e.projectId)}),n.setQueryData([`tracker`,e.projectId,`connection`],{connection:e.connection,demo:e.demo}),await D(e.projectId),U(`Credentials saved for this project. Browse and connect a scope.`)},onError:(e,t,n)=>{Sn()===n&&m(``),U(e.message,{tone:`danger`})}}),j=L({mutationFn:async()=>{let e=Sn();return await lt(),e},onSuccess:async e=>{Sn()===e&&(h(),_(!1),x(null)),await n.cancelQueries({queryKey:c.tracker.allFor(e)}),n.setQueryData([`tracker`,e,`connection`],{connection:null,demo:!1}),await D(e),U(`Project credentials removed`)},onError:e=>U(e.message,{tone:`danger`})}),M=A.isPending||j.isPending,N=t.data?.association,P=e.data?.connection,F=!!N&&(e.data?.demo===!0||!!P&&P.kind===N.kind&&P.id===N.connectionId);return t.isPending?(0,X.jsx)(`p`,{className:`p-6 text-sm text-muted-foreground`,children:`Loading tracker settings…`}):t.isError?(0,X.jsx)(`p`,{className:`p-6 text-sm text-danger`,children:t.error.message}):(0,X.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col gap-6 p-4 md:p-6`,"data-slot":`tracker-settings`,children:[(0,X.jsxs)(`section`,{className:`rounded-lg border border-border bg-card p-4`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Issue tracker`}),(0,X.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Connect a project or team from your issue tracker. Credentials belong only to this project and are stored locally outside the repository. Server-wide environment keys are not used.`}),F&&t.data.association?(0,X.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3 rounded-md border border-border p-3`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`font-medium`,children:t.data.association.externalName}),(0,X.jsxs)(`a`,{className:`inline-flex items-center gap-1 text-xs text-violet hover:underline`,href:t.data.association.source.webUrl,target:`_blank`,rel:`noreferrer`,children:[$o[t.data.association.kind].label,` `,(0,X.jsx)(Fr,{className:`size-3`})]})]}),(0,X.jsxs)(W,{variant:`outline`,onClick:()=>k.mutate(),disabled:k.isPending,children:[(0,X.jsx)(Zo,{className:`size-3.5`}),` Disconnect`]})]}):(0,X.jsx)(`p`,{className:`mt-4 text-sm font-medium`,children:e.isPending?`Loading connection…`:e.isError?`Connection status unavailable.`:`No tracker connected.`})]}),N&&P&&!e.isError&&!e.data?.demo&&!F?(0,X.jsx)(`p`,{className:`text-sm text-warning`,children:`This scope needs reconnection with this project's credentials. Configure a connection, then browse and select its scope again.`}):null,e.data?.error?(0,X.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:e.data.error}):null,(0,X.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`For local credential cleanup, run `,(0,X.jsx)(`code`,{children:`cez tracker-connections list`}),`, then `,(0,X.jsx)(`code`,{children:`cez tracker-connections remove <id>`}),`. Local deletion does not revoke the vendor token.`]}),e.isError?(0,X.jsxs)(`p`,{className:`text-sm text-danger`,children:[`Could not load project connection. `,(0,X.jsx)(`button`,{onClick:()=>void e.refetch(),children:`Retry`})]}):null,(0,X.jsxs)(`section`,{className:`rounded-lg border border-border bg-card p-4`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Connect a provider`}),(0,X.jsx)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:es.map(t=>{let n=!e.isError&&(e.data?.demo===!0||e.data?.connection?.kind===t.kind);return(0,X.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,X.jsx)(`p`,{className:`font-medium`,children:t.label}),e.data?.demo?null:(0,X.jsxs)(W,{variant:`outline`,disabled:M||e.isPending||e.isError,onClick:()=>{h(),o(t.kind),_(!1),x(null)},children:[e.data?.connection?.kind===t.kind?`Replace`:`Configure`,` `,t.label,` credentials`]}),(0,X.jsxs)(W,{className:`mt-3`,variant:`outline`,disabled:!n||M,onClick:()=>{i(t.kind),_(!0),y(``),x(null)},children:[(0,X.jsx)(Po,{className:`size-3.5`}),` Browse `,t.label]}),n?null:(0,X.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`Configure credentials for this project to browse.`})]},t.kind)})})]}),e.data?.connection?(0,X.jsx)(W,{variant:`outline`,disabled:M,onClick:()=>j.mutate(),children:`Remove project credentials`}):null,a?(0,X.jsxs)(`form`,{className:`rounded-lg border border-border bg-card p-4`,onSubmit:e=>{e.preventDefault(),A.mutate()},autoComplete:`off`,children:[(0,X.jsxs)(`h2`,{className:`font-medium`,children:[$o[a].label,` credentials for this project`]}),(0,X.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`Saved in a private .env file for this project, without encryption. Use read-only access limited to this project's data. Saving replaces this project's connection and requires selecting its scope again.`}),a===`jira`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`label`,{className:`mt-3 block text-sm`,children:[`Jira site URL`,(0,X.jsx)(`input`,{"aria-label":`Jira site URL`,type:`url`,required:!0,value:s,onChange:e=>l(e.target.value),placeholder:`https://your-site.atlassian.net`,className:`mt-1 block w-full rounded border bg-background p-2`})]}),(0,X.jsxs)(`label`,{className:`mt-3 block text-sm`,children:[`Account email`,(0,X.jsx)(`input`,{"aria-label":`Account email`,type:`email`,required:!0,value:u,onChange:e=>d(e.target.value),className:`mt-1 block w-full rounded border bg-background p-2`})]})]}):null,(0,X.jsxs)(`label`,{className:`mt-3 block text-sm`,children:[`API token`,(0,X.jsx)(`input`,{"aria-label":`API token`,type:`password`,autoComplete:`new-password`,required:!0,maxLength:8192,value:p,onChange:e=>m(e.target.value),className:`mt-1 block w-full rounded border bg-background p-2`})]}),(0,X.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,X.jsx)(W,{type:`submit`,disabled:M,children:`Save project credentials`}),(0,X.jsx)(W,{type:`button`,variant:`outline`,disabled:M,onClick:h,children:`Cancel`})]})]}):null,g?(0,X.jsxs)(`section`,{className:`rounded-lg border border-violet/40 bg-card p-4`,"aria-label":`${$o[r].label} picker`,children:[(0,X.jsxs)(`label`,{className:`text-xs font-medium`,htmlFor:`tracker-candidate-search`,children:[`Search `,$o[r].scopeLabel]}),(0,X.jsx)(`input`,{id:`tracker-candidate-search`,className:`mt-2 h-9 w-full rounded-md border border-border bg-background px-3 text-sm`,value:v,onChange:e=>{y(e.target.value),x(null)},placeholder:`Search by name…`}),(0,X.jsxs)(`div`,{className:`mt-3 max-h-64 space-y-1 overflow-auto`,children:[S.isPending?(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading…`}):null,S.isError?(0,X.jsx)(cb,{reason:S.error.message,generation:S.errorUpdatedAt,retry:()=>void S.refetch()}):null,E&&!E.available?(0,X.jsx)(cb,{reason:E.reason,generation:S.dataUpdatedAt,retryAfterSeconds:E.code===`rate_limited`?E.retryAfterSeconds:void 0,retry:()=>void S.refetch()}):null,T.map(e=>(0,X.jsx)(`button`,{type:`button`,className:`block w-full rounded-md border px-3 py-2 text-left text-sm ${b?.id===e.id?`border-violet bg-violet/10`:`border-border`}`,onClick:()=>x(e),children:e.name},e.id)),!S.isPending&&!S.isError&&!E&&T.length===0?(0,X.jsx)(`p`,{className:`py-3 text-sm text-muted-foreground`,children:`No projects or teams match.`}):null,S.hasNextPage?(0,X.jsx)(W,{variant:`ghost`,onClick:()=>void S.fetchNextPage(),disabled:S.isFetchingNextPage,children:`Load more`}):null]}),(0,X.jsxs)(`div`,{className:`mt-4 flex gap-2`,children:[(0,X.jsx)(W,{variant:`contrast`,disabled:!b||O.isPending||M,onClick:()=>O.mutate(),children:`Connect`}),(0,X.jsx)(W,{variant:`ghost`,onClick:()=>_(!1),children:`Cancel`})]})]}):null]})}function cb({reason:e,retry:t,retryAfterSeconds:n=0,generation:r}){let[i,a]=(0,Y.useState)(n);return(0,Y.useEffect)(()=>a(n),[e,n,r]),(0,Y.useEffect)(()=>{if(i<=0)return;let e=window.setInterval(()=>a(e=>Math.max(0,e-1)),1e3);return()=>window.clearInterval(e)},[i>0]),(0,X.jsxs)(`div`,{className:`rounded-md border border-danger/30 bg-danger/5 p-3 text-sm`,children:[(0,X.jsx)(`p`,{className:`text-danger`,children:e}),(0,X.jsx)(W,{className:`mt-2`,variant:`outline`,disabled:i>0,onClick:t,children:i>0?`Retry in ${i}s`:`Retry`})]})}function lb(e,t){return function(){return(0,X.jsx)(J,{icon:(0,X.jsx)(t,{}),tone:`neutral`,title:e,subtitle:`This section arrives in a later phase of the redesign.`,heading:`h2`})}}var ub=[{id:`tracker`,title:`Issue tracker`,description:`Connect this project to Jira or Linear.`,icon:Xo,component:sb,scope:`project`},{id:`agents`,title:`Agents`,description:`Default runner, models and system prompt.`,icon:$n,component:kv,scope:`project`},{id:`agent-config`,title:`Agent config`,description:`Edit the coding agents’ own config files, per scope.`,icon:xo,component:vv,scope:`project`},{id:`worktrees`,title:`Worktrees`,description:`How many finished task worktrees this project keeps on disk.`,icon:Co,component:ab,scope:`project`},{id:`bookmarklets`,title:`Bookmarklets`,description:`Launch skills from a GitHub PR or issue.`,icon:fo,component:ay,scope:`project`},{id:`prompt-templates`,title:`Prompt templates`,description:`Reusable snippets for follow-up instructions.`,icon:Bo,component:Ny,scope:`project`},{id:`appearance`,title:`Appearance`,description:`Theme, accent and density.`,icon:Ho,component:ny,scope:`global`},{id:`notifications`,title:`Notifications`,description:`Browser notifications when an agent needs you.`,icon:uo,component:py,scope:`global`},{id:`resources`,title:`Resources`,description:`Parallel tasks and per-task memory limit, across every project.`,icon:Do,component:Zy,scope:`global`},{id:`skills`,title:`Skills`,description:`Updates for skills installed on this machine.`,icon:Vo,component:$y,scope:`global`},{id:`accounts`,title:`Agent accounts`,description:`Second logins, and the agent and models a project uses when it has chosen none.`,icon:Ao,component:tv,scope:`global`},{id:`projects`,title:`Projects`,description:`The workspace registry and where GitHub checkouts land.`,icon:Eo,component:Ty,scope:`global`},{id:`keyboard`,title:`Keyboard`,description:`Shortcuts.`,icon:Mo,component:lb(`Keyboard`,Mo),scope:`global`,hidden:!0}];function db(e,t){return ub.filter(n=>!n.hidden&&n.scope===e&&!(t?.singleProject===!0&&n.id===`projects`))}function fb(){let e=$i(),t=st().data;return e===null?null:t?.projects.find(t=>t.id===e)?.root??null}function pb(e){navigator.clipboard.writeText(e).then(()=>U(`Project folder copied`)).catch(()=>U(e))}function mb(){let e=fb();return e===null?null:(0,X.jsx)(by,{title:`Project folder`,hint:`Where this project lives on disk. Every task worktree, git command and agent run resolves against it.`,children:(0,X.jsxs)(`div`,{"data-slot":`project-location`,"data-variant":`field`,className:`flex items-start gap-3 rounded-md border border-border bg-card p-3`,children:[(0,X.jsx)(`span`,{"data-slot":`project-location-path`,className:`min-w-0 flex-1 font-mono text-xs break-all text-foreground`,children:e}),(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,X.jsx)(`button`,{type:`button`,"data-action":`project-location-copy`,title:`Copy the project folder path`,onClick:()=>pb(e),className:`text-xs font-medium text-muted-foreground transition-colors hover:text-foreground`,children:`Copy`}),(0,X.jsx)(gb,{root:e})]})]})})}function hb(){let e=fb();return e===null?null:(0,X.jsxs)(`div`,{"data-slot":`project-location`,"data-variant":`nav`,className:`mt-auto px-2.5 pt-3`,children:[(0,X.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Project folder`}),(0,X.jsx)(`button`,{type:`button`,"data-action":`project-location-copy`,title:`${e} — click to copy`,onClick:()=>pb(e),className:`block w-full truncate text-left font-mono text-[11px] text-muted-foreground transition-colors hover:text-foreground`,children:e})]})}function gb({root:e}){let t=nt(),n=L({mutationFn:e=>ce(e),onError:e=>U(e.message,{tone:`danger`})}),r=(t.data?.targets??[]).filter(e=>or(e.id)===void 0).map(e=>({target:e}));return r.length===0?null:(0,X.jsx)(rr,{slot:`project-location-open`,label:`Open with`,triggerVariant:`outline`,title:e,disabled:n.isPending,choices:r,onPick:e=>n.mutate(e,{onSuccess:()=>U(`Opening the project folder in ${r.find(t=>t.target.id===e)?.target.label??e}`)})})}function _b(e){let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`})}function vb({capabilities:e}){let t=$i(),n=st(),r=et();if(n.isPending)return(0,X.jsx)(`p`,{"data-slot":`project-general-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading project…`});if(n.isError)return(0,X.jsxs)(`p`,{"data-slot":`project-general-error`,className:`text-[13px] text-danger`,children:[`Could not read the project registry — `,n.error.message]});let i=n.data,a=i?.projects.find(e=>e.id===t);if(!i||!a)return null;let o=e?.singleProject!==!0&&a.unregistered!==!0;return(0,X.jsxs)(`div`,{"data-slot":`project-general`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7`,children:[(0,X.jsx)(mb,{}),(0,X.jsx)(yb,{project:a,canRemove:o}),a.unregistered?(0,X.jsx)(by,{title:`Add to your projects`,hint:`cezar is serving this folder because you started it here — starting cezar somewhere new never adds it to your project list for you. Adding it keeps it in the sidebar between runs and gives it a registry entry to hold settings like the task cap. Nothing on disk changes either way.`,children:(0,X.jsx)(Ay,{root:a.root,name:a.name})}):null,o?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(by,{title:`Max parallel tasks`,hint:r.data?`How many of this project's tasks may run at once — leave it empty to inherit the workspace limit. The workspace limit (${r.data.resources.maxParallel}) still applies as an overall ceiling, so a higher value here has no extra effect until that one is raised.`:`How many of this project's tasks may run at once — leave it empty to inherit the workspace limit. The workspace limit still applies as an overall ceiling.`,children:r.data?(0,X.jsx)(My,{project:a,workspaceMax:r.data.resources.maxParallel}):(0,X.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Loading the workspace limit…`})}),(0,X.jsx)(bb,{project:a,bootProject:i.bootProject})]}):null]})}function yb({project:e,canRemove:t}){return(0,X.jsx)(by,{title:`Project`,hint:`The registry entry for this checkout — re-probed every time the project list is read.`,children:(0,X.jsxs)(`dl`,{"data-slot":`project-facts`,className:`grid grid-cols-[8rem_minmax(0,1fr)] gap-x-3 gap-y-1.5 rounded-md border border-border bg-card p-3 text-[13px]`,children:[(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Name`}),(0,X.jsx)(`dd`,{className:`min-w-0 truncate text-foreground`,children:e.name}),(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Status`}),(0,X.jsxs)(`dd`,{"data-slot":`project-general-status`,className:e.status===`missing`?`text-danger`:`text-foreground`,children:[Cy[e.status],e.status===`missing`?t?` — remove it below, or restore the folder`:` — restore the folder at the path above`:null]}),e.branch===void 0?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Branch`}),(0,X.jsx)(`dd`,{className:`min-w-0 truncate font-mono text-xs text-foreground`,children:e.branch})]}),e.unregistered?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`In your projects`}),(0,X.jsx)(`dd`,{"data-slot":`project-general-unregistered`,className:`text-foreground`,children:`No — served because cezar was started here`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Added`}),(0,X.jsxs)(`dd`,{className:`text-foreground`,children:[_b(e.addedAt),(0,X.jsx)(`span`,{className:`text-soft-foreground`,children:e.source===`checkout`?` · cloned from GitHub`:` · opened locally`})]}),(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Last opened`}),(0,X.jsx)(`dd`,{className:`text-foreground`,children:_b(e.lastOpenedAt)})]})]})})}function bb({project:e,bootProject:t}){let[n,r]=(0,Y.useState)(null),i=vy(),a=ue(),o=e.id===t;return(0,X.jsxs)(by,{title:`Remove from workspace`,hint:`Unregisters this project so it leaves the sidebar and the project list. Nothing on disk is deleted — the folder, its git history and its task history all stay, and adding it back later finds everything intact.`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsxs)(W,{type:`button`,variant:`outline`,size:`sm`,"data-action":`project-general-remove`,"aria-label":`Remove ${e.name} from the workspace — unregisters it, no files are deleted`,title:o?"cezar is serving this project — stop it and use `cezar projects remove`":void 0,disabled:o||i.isPending,onClick:()=>r(e),className:`text-danger`,children:[`Remove `,e.name]}),o?(0,X.jsx)(`span`,{"data-slot":`project-general-remove-boot`,className:`text-[11px] text-soft-foreground`,children:"cezar is serving this project — stop cezar and run `cezar projects remove` to drop it."}):null]}),(0,X.jsx)(yy,{project:n,onOpenChange:e=>!e&&r(null),onConfirm:()=>{r(null),i.confirm(e,()=>void a(`/p/${encodeURIComponent(t)}`))}})]})}function xb(e,t){return e===`global`?`/settings/global/${t}`:`/settings/${t}`}function Sb(e){return e===`global`?`/settings/global`:`/settings`}function Cb(e){return e===`global`?{Link:ke,NavLink:S}:{Link:q,NavLink:Xi}}function wb({scope:e,activeId:t,capabilities:n}){let{NavLink:r}=Cb(e);return(0,X.jsxs)(`nav`,{"aria-label":`Settings sections`,"data-slot":`settings-nav`,"data-scope":e,className:`hidden w-52 shrink-0 flex-col gap-1 border-r border-border p-3 md:flex`,children:[(0,X.jsxs)(r,{to:Sb(e),end:!0,"data-slot":`settings-nav-index`,"aria-current":t===null?`page`:void 0,className:K(`flex items-center gap-2.5 rounded-md px-2.5 py-2 text-[13px] font-medium transition-colors`,t===null?`bg-muted text-foreground`:`text-muted-foreground hover:bg-muted/60 hover:text-foreground`),children:[(0,X.jsx)(An,{"aria-hidden":`true`,className:`size-4 shrink-0`}),`General`]}),db(e,n).map(n=>(0,X.jsxs)(r,{to:xb(e,n.id),"data-section":n.id,"aria-current":n.id===t?`page`:void 0,className:K(`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,X.jsx)(n.icon,{"aria-hidden":`true`,className:`size-4 shrink-0`}),n.title]},n.id)),e===`global`?(0,X.jsx)(`p`,{className:`mt-auto px-2.5 pt-3 text-[11px] text-soft-foreground`,children:`Stored in ~/.cezar`}):(0,X.jsx)(hb,{})]})}function Tb({scope:e,activeId:t,capabilities:n}){let{NavLink:r}=Cb(e);return(0,X.jsxs)(`nav`,{"aria-label":`Settings sections`,"data-slot":`settings-nav-mobile`,className:`flex shrink-0 gap-1.5 overflow-x-auto border-b border-border px-3 py-2.5 md:hidden`,children:[(0,X.jsx)(r,{to:Sb(e),end:!0,"data-slot":`settings-nav-index`,className:`rounded-full border border-border bg-card px-3 py-1.5 text-[13px] font-medium whitespace-nowrap text-muted-foreground transition-colors`,children:`General`}),db(e,n).map(n=>(0,X.jsx)(r,{to:xb(e,n.id),"data-section":n.id,"aria-current":n.id===t?`page`:void 0,className:K(`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 Eb({section:e,scope:t,capabilities:n}){let r=e.component;return(0,X.jsxs)(`div`,{"data-route":t===`global`?`settings-global-${e.id}`:`settings-${e.id}`,className:`flex min-h-full flex-col`,children:[(0,X.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,X.jsx)(`h1`,{className:`text-base font-semibold`,children:e.title}),(0,X.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:e.description}),t===`global`?(0,X.jsx)(`span`,{"data-slot":`settings-scope-chip`,className:`ml-auto text-[11px] text-soft-foreground`,children:`Global settings`}):null]}),(0,X.jsxs)(`div`,{className:`flex flex-1 flex-col md:flex-row`,children:[(0,X.jsx)(wb,{scope:t,activeId:e.id,capabilities:n}),(0,X.jsx)(Tb,{scope:t,activeId:e.id,capabilities:n}),(0,X.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:(0,X.jsx)(r,{})})]})]})}function Db({scope:e,capabilities:t}){let{Link:n}=Cb(e),r=e===`global`;return(0,X.jsxs)(`div`,{"data-route":r?`settings-global`:`settings`,className:`flex min-h-full flex-col`,children:[(0,X.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,X.jsx)(`h1`,{className:`text-base font-semibold`,children:r?`Global settings`:`Settings`}),(0,X.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,X.jsxs)(`div`,{className:`flex flex-1 flex-col md:flex-row`,children:[(0,X.jsx)(wb,{scope:e,activeId:null,capabilities:t}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col p-3 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-5 md:pb-5`,children:[r?null:(0,X.jsx)(vb,{capabilities:t}),(0,X.jsx)(`ul`,{"data-slot":`settings-index`,className:K(`mx-auto flex w-full max-w-2xl flex-col gap-2.5`,r?null:`mt-7 md:hidden`),children:db(e,t).map(t=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(n,{to:xb(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,X.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-md border border-border bg-muted text-muted-foreground`,children:(0,X.jsx)(t.icon,{"aria-hidden":`true`,className:`size-4`})}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:t.title}),(0,X.jsx)(`span`,{className:`block text-xs text-soft-foreground`,children:t.description})]}),(0,X.jsx)(kr,{"aria-hidden":`true`,className:`size-4 shrink-0 text-soft-foreground`})]})},t.id))}),(0,X.jsx)(`p`,{className:`mx-auto mt-4 w-full max-w-2xl text-[12px] text-soft-foreground`,children:r?(0,X.jsx)(X.Fragment,{children:`Agents, worktrees, bookmarklets and prompt templates are per project.`}):(0,X.jsxs)(X.Fragment,{children:[`Appearance, notifications, host resources and the project registry live in`,` `,(0,X.jsx)(ke,{to:Sb(`global`),"data-slot":`settings-global-link`,className:`underline underline-offset-2 hover:text-foreground`,children:`Global settings`}),`.`]})})]})]})]})}function Ob({label:e,expanded:t,onToggle:n,className:r}){return(0,X.jsxs)(`button`,{type:`button`,"data-slot":`subtask-toggle`,"aria-expanded":t,"aria-label":`${t?`Collapse`:`Expand`} ${e}`,onClick:n,className:K(`inline-flex shrink-0 items-center gap-0.5 rounded-full bg-muted py-px pr-1.5 pl-1 text-[10.5px] font-medium text-muted-foreground hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,r),children:[(0,X.jsx)(kr,{className:K(`size-3 transition-transform`,t&&`rotate-90`),"aria-hidden":`true`}),e]})}var kb=[{id:`status`,label:`Status`,canFold:!1,defaultExpanded:!0,align:`left`,width:`116px`},{id:`task`,label:`Task`,canFold:!1,defaultExpanded:!0,align:`left`},{id:`workflow`,label:`Workflow`,canFold:!0,defaultExpanded:!0,align:`left`,width:`124px`,icon:`workflow`},{id:`branch`,label:`Branch`,canFold:!0,defaultExpanded:!1,align:`left`,width:`128px`,icon:`branch`},{id:`diff`,label:`±`,canFold:!0,defaultExpanded:!0,align:`left`,width:`78px`,icon:`diff`},{id:`reference`,label:`Ref`,canFold:!0,defaultExpanded:!0,align:`left`,width:`76px`,icon:`reference`},{id:`tokens`,label:`IN / OUT`,canFold:!0,defaultExpanded:!0,align:`right`,width:`112px`,icon:`tokens`,capability:`tokens`},{id:`cost`,label:`Cost`,canFold:!0,defaultExpanded:!0,align:`right`,width:`76px`,icon:`cost`,capability:`cost`},{id:`cpu`,label:`CPU`,canFold:!0,defaultExpanded:!0,align:`right`,width:`68px`,icon:`cpu`},{id:`memory`,label:`Mem`,canFold:!0,defaultExpanded:!0,align:`right`,width:`88px`,icon:`memory`},{id:`started`,label:`Started`,canFold:!0,defaultExpanded:!0,align:`right`,width:`82px`,icon:`started`}],Ab=new Map(kb.map(e=>[e.id,e]));function jb(e){return typeof e!=`object`||!e||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`boolean`))}function Mb(e){let t={};for(let[n,r]of Object.entries(jb(e))){let e=Ab.get(n);e?.canFold&&(t[e.id]=r)}return t}function Nb(e,t){let n=Ab.get(e);return!n||!n.canFold?!0:t[e]??n.defaultExpanded}function Pb(e,t){let n=jb(e);return Ab.get(t)?.canFold?{...n,[t]:!Nb(t,Mb(e))}:n}function Fb(e){return kb.filter(t=>t.capability===void 0||e[t.capability])}function Ib(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function Lb(){let e=f(),t=Nt(),n=Y.useRef(0),r=Y.useRef(0),i=Y.useRef(Promise.resolve()),a=Y.useMemo(()=>Mb(t.data?.taskTable?.expandedColumns),[t.data?.taskTable?.expandedColumns]),o=Y.useCallback(t=>{if(!kb.find(e=>e.id===t)?.canFold)return;let a=e.getQueryData(V.uiState);if(a===void 0)return;let o=Ib(a?.taskTable),s={...o,expandedColumns:Pb(o.expandedColumns,t)};e.setQueryData(V.uiState,{...a,taskTable:s});let c=++n.current;r.current=c;let l=i.current.then(async()=>{let t=await Lt({taskTable:s},{keepalive:!0});c===r.current&&e.setQueryData(V.uiState,t)});i.current=l.catch(t=>{U(t instanceof Error?t.message:String(t),{tone:`danger`}),c===r.current&&e.invalidateQueries({queryKey:V.uiState})})},[e]);return{expandedColumns:a,isExpanded:Y.useCallback(e=>Nb(e,a),[a]),toggleColumn:o,isPending:t.isPending}}function Rb({runs:e,view:t,onViewChange:n,onArchiveFinished:r,onMarkAllRead:i,onRename:a,onTogglePin:o,now:s=Date.now(),showTokens:c=!0,showCost:l=!0,expandedColumns:u=Mb(void 0),onToggleColumn:d=()=>void 0,columnsPending:f=!1}){let[p,m]=Y.useState(``),[h,g]=Y.useState(new Set),_=e=>g(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n}),v=e??[],y=Ct(v),b=E(gt(v,p),t),x=p.trim()!==``,S=mh(b,e=>x||h.has(e)),C=se(v),w=kt(gt(v,p),t),T=mt(v),D=Fb({tokens:c,cost:l}),O=ir(v),k=t===`archived`?void 0:o;return(0,X.jsxs)(`div`,{"data-route":`tasks`,className:`flex min-h-full flex-col`,children:[(0,X.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,X.jsx)(`h1`,{className:`text-base font-semibold`,children:`Tasks`}),(0,X.jsxs)(`div`,{className:`inline-flex gap-0.5 rounded-md bg-muted p-[3px]`,children:[(0,X.jsx)(Bb,{view:`active`,current:t,onSelect:n,count:y.active,children:`Active`}),(0,X.jsx)(Bb,{view:`archived`,current:t,onSelect:n,count:y.archived,children:`Archived`})]}),(0,X.jsx)(`div`,{className:`flex-1`}),O>0?(0,X.jsxs)(W,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`mark-all-read`,onClick:i,children:[(0,X.jsx)(Fn,{className:`size-3.5`,"aria-hidden":`true`}),`Mark all read`]}):null,t===`active`&&T>0?(0,X.jsxs)(W,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`archive-finished`,onClick:r,children:[(0,X.jsx)(Gn,{className:`size-3.5`,"aria-hidden":`true`}),`Archive finished`]}):null,(0,X.jsxs)(`div`,{className:`relative w-60`,children:[(0,X.jsx)(xi,{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,X.jsx)(`input`,{type:`text`,value:p,onChange:e=>m(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,X.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:b.length===0?(0,X.jsx)(zb,{view:t,query:p}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{"data-slot":`tasks-table`,className:`hidden overflow-x-auto rounded-lg border border-border bg-card shadow-xs md:block`,children:(0,X.jsx)(mr,{children:(0,X.jsxs)(`table`,{className:`w-full border-collapse`,children:[(0,X.jsx)(`colgroup`,{children:D.map(e=>{let t=Nb(e.id,u);return(0,X.jsx)(`col`,{"data-column-id":e.id,"data-expanded":t,style:{width:t?e.width:`42px`}},e.id)})}),(0,X.jsx)(`thead`,{children:(0,X.jsx)(`tr`,{children:D.map(e=>(0,X.jsx)(Hb,{column:e,expanded:Nb(e.id,u),onToggle:d,disabled:f},e.id))})}),(0,X.jsx)(`tbody`,{className:`[&>tr:last-child>td]:border-b-0`,children:S.map(e=>(0,X.jsx)(Gb,{run:e.run,depth:e.depth,childCount:e.childCount,subtasksExpanded:x||h.has(e.run.id),onToggleSubtasks:_,queuePosition:e.run.status===`queued`?C.get(e.run.id)??null:null,onRename:a,onTogglePin:k,now:s,columns:D,expandedColumns:u},e.run.id))})]})})}),(0,X.jsx)(`div`,{"data-slot":`task-cards`,className:`flex flex-col gap-2.5 md:hidden`,children:S.map(e=>(0,X.jsx)(Zb,{run:e.run,depth:e.depth,childCount:e.childCount,subtasksExpanded:x||h.has(e.run.id),onToggleSubtasks:_,queuePosition:e.run.status===`queued`?C.get(e.run.id)??null:null,now:s,showTokens:c,showCost:l,onTogglePin:k},e.run.id))})]}),w.map(e=>(0,X.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,X.jsx)(Wo,{className:`size-[15px] shrink-0 text-soft-foreground`,"aria-hidden":`true`}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`strong`,{className:`font-semibold text-foreground`,children:e.title}),` — `,e.count,` variants finished`]}),(0,X.jsx)(W,{asChild:!0,variant:`outline`,size:`sm`,className:`md:ml-auto`,children:(0,X.jsx)(q,{to:`/compare/${e.groupId}`,children:`Compare`})})]},e.groupId))]}),(0,X.jsx)(q,{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,X.jsx)(Uo,{className:`size-[22px]`,"aria-hidden":`true`})})]})}function zb({view:e,query:t}){let n=t.trim(),r=n?`search-miss`:e===`archived`?`archive`:`no-tasks`;return(0,X.jsx)(`div`,{"data-slot":`tasks-empty`,"data-empty-kind":r,className:`flex flex-1 flex-col`,children:r===`search-miss`?(0,X.jsx)(J,{heading:`h2`,icon:(0,X.jsx)(di,{}),tone:`neutral`,title:`No matching tasks`,subtitle:`No tasks match “${n}”.`}):r===`archive`?(0,X.jsx)(J,{heading:`h2`,icon:(0,X.jsx)(Gn,{}),tone:`neutral`,title:`Nothing archived yet`,subtitle:`Finished tasks you archive land here.`}):(0,X.jsx)(J,{heading:`h2`,icon:(0,X.jsx)(Fo,{}),tone:`primary`,backdrop:!0,title:`No tasks yet`,subtitle:`Describe a task to get started.`,actions:(0,X.jsx)(W,{asChild:!0,children:(0,X.jsxs)(q,{to:`/new`,children:[(0,X.jsx)(Uo,{"aria-hidden":`true`}),`New task`]})})})})}function Bb({view:e,current:t,onSelect:n,count:r,children:i}){let a=e===t;return(0,X.jsxs)(`button`,{type:`button`,"data-slot":`overview-tab`,"data-view":e,"aria-pressed":a,onClick:()=>n(e),className:K(`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,X.jsx)(`span`,{className:`font-mono text-[11px] tabular-nums`,children:r}):null]})}function Vb({children:e,right:t=!1,columnId:n,folded:r=!1}){return(0,X.jsx)(`th`,{scope:`col`,"data-column-id":n,"data-folded":r||void 0,className:K(`h-[38px] border-b border-border px-2.5 text-left text-[11px] font-semibold tracking-[0.05em] whitespace-nowrap text-soft-foreground uppercase first:pl-4 last:pr-4`,t&&`text-right`,r&&`px-0 first:pl-0 last:pr-0`),children:e})}function Hb({column:e,expanded:t,onToggle:n,disabled:r}){if(!e.canFold)return(0,X.jsx)(Vb,{columnId:e.id,right:e.align===`right`,children:e.label});let i=t?`Fold`:`Expand`;return(0,X.jsx)(Vb,{columnId:e.id,right:e.align===`right`,folded:!t,children:(0,X.jsxs)(gr,{children:[(0,X.jsx)(fr,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,"aria-label":`${i} ${e.label} column`,"aria-pressed":t,disabled:r,onClick:()=>n(e.id),className:K(`inline-flex h-8 w-full items-center gap-1 rounded-sm px-0.5 text-inherit outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-wait disabled:opacity-60`,e.align===`right`?`justify-end`:`justify-start`,!t&&`justify-center px-0`),children:t?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{children:e.label}),(0,X.jsx)(mo,{className:`size-3 opacity-55`,"aria-hidden":`true`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Ub,{icon:e.icon}),(0,X.jsx)(ho,{className:`size-3 opacity-70`,"aria-hidden":`true`})]})})}),(0,X.jsxs)(pr,{side:`top`,children:[e.label,` · `,i,` column`]})]})})}function Ub({icon:e}){let t=`size-3.5`;switch(e){case`workflow`:return(0,X.jsx)(Qo,{className:t,"aria-hidden":`true`});case`branch`:return(0,X.jsx)(Oo,{className:t,"aria-hidden":`true`});case`diff`:return(0,X.jsx)(So,{className:t,"aria-hidden":`true`});case`reference`:return(0,X.jsx)(Po,{className:t,"aria-hidden":`true`});case`tokens`:return(0,X.jsx)(_o,{className:t,"aria-hidden":`true`});case`cost`:return(0,X.jsx)(Nn,{className:t,"aria-hidden":`true`});case`cpu`:return(0,X.jsx)(Jn,{className:t,"aria-hidden":`true`});case`memory`:return(0,X.jsx)(Io,{className:t,"aria-hidden":`true`});case`started`:return(0,X.jsx)(go,{className:t,"aria-hidden":`true`});default:return null}}var Wb=`h-11 border-b border-border px-2.5 whitespace-nowrap first:pl-4 last:pr-4`;function Gb({run:e,depth:t,childCount:n,subtasksExpanded:r,onToggleSubtasks:i,queuePosition:a,onRename:o,onTogglePin:s,now:c,columns:l,expandedColumns:u}){let d=qi(),f=na(e),p=dn(e),m=`/tasks/${e.id}`,h=Xe(e.costUsd),g=on(e);return(0,X.jsx)(`tr`,{"data-slot":`task-table-row`,"data-run-id":e.id,"data-depth":t,onClick:e=>{e.target.closest(`a, button, input`)||d(m)},className:`group/row cursor-pointer hover:bg-muted`,children:l.map(l=>{if(l.id===`memory`)return null;if(l.id===`cpu`){let t=Nb(`cpu`,u),n=Nb(`memory`,u);return a!==null&&(t||n)?(0,X.jsxs)(`td`,{"data-slot":`queue-note`,"data-column-id":`cpu-memory`,colSpan:2,className:K(Wb,`text-right font-mono text-[11.5px] text-soft-foreground`),children:[`#`,a,` in queue`]},l.id):(0,X.jsx)(Yb,{run:e,cpuExpanded:t,memoryExpanded:n},l.id)}return(0,X.jsx)(Kb,{column:l,expanded:Nb(l.id,u),run:e,depth:t,childCount:n,subtasksExpanded:r,onToggleSubtasks:i,attention:f,scheduled:p,reference:g,cost:h,to:m,onRename:o,onTogglePin:s,now:c},l.id)})})}function Kb({column:e,expanded:t,run:n,depth:r,childCount:i,subtasksExpanded:a,onToggleSubtasks:o,attention:s,scheduled:c,reference:l,cost:u,to:d,onRename:f,onTogglePin:p,now:m}){if(!t)return(0,X.jsx)(qb,{column:e.id});switch(e.id){case`status`:return(0,X.jsx)(`td`,{"data-column-id":e.id,className:Wb,children:(0,X.jsxs)(va,{dot:s.tone,pulse:s.pulse,title:c?.title,children:[s.label,c?(0,X.jsx)(`span`,{className:`tabular-nums`,children:c.label}):null]})});case`task`:return(0,X.jsx)(`td`,{"data-column-id":e.id,className:K(Wb,`min-w-[220px] max-w-0`),children:(0,X.jsx)(Jb,{run:n,depth:r,childCount:i,subtasksExpanded:a,onToggleSubtasks:o,to:d,onRename:f,onTogglePin:p})});case`workflow`:return(0,X.jsx)(`td`,{"data-column-id":e.id,className:K(Wb,`text-[12.5px] text-muted-foreground`),children:y(n)});case`branch`:return(0,X.jsx)(`td`,{"data-column-id":e.id,className:Wb,children:n.branch?(0,X.jsx)(ex,{branch:n.branch}):(0,X.jsx)(Qb,{})});case`diff`:return(0,X.jsx)(`td`,{"data-column-id":e.id,className:Wb,children:n.diffStat?(0,X.jsx)(ha,{stat:n.diffStat}):(0,X.jsx)(Qb,{})});case`reference`:return(0,X.jsx)(`td`,{"data-column-id":e.id,className:Wb,children:l?(0,X.jsx)(er,{run:n,reference:l}):(0,X.jsx)(Qb,{})});case`tokens`:return(0,X.jsx)(`td`,{"data-column-id":e.id,className:K(Wb,`text-right text-xs text-muted-foreground`),children:(0,X.jsx)(ga,{inputTokens:n.inputTokens,outputTokens:n.outputTokens,variant:`table`,omitWhenUnknown:!1})});case`cost`:return(0,X.jsx)(`td`,{"data-column-id":e.id,className:K(Wb,`text-right font-mono text-xs text-muted-foreground tabular-nums`),children:u||(0,X.jsx)(Qb,{})});case`started`:return(0,X.jsx)(`td`,{"data-column-id":e.id,className:K(Wb,`text-right text-xs text-soft-foreground tabular-nums`),children:ia(n.startedAt??n.createdAt,m)});case`cpu`:case`memory`:return null}}function qb({column:e}){return(0,X.jsx)(`td`,{role:`presentation`,"aria-hidden":`true`,"data-column-id":e,"data-folded":`true`,className:K(Wb,`px-0 first:pl-0 last:pr-0`)})}function Jb({run:e,depth:t,childCount:n,subtasksExpanded:r,onToggleSubtasks:i,to:a,onRename:o,onTogglePin:s}){let c=_e(e),l=tr(c,t=>o(e.id,t)),u=Kn(e),d=Yn(e),f=hh(n),p=t>0?{paddingLeft:`${t*14}px`}:void 0;return l.editing?(0,X.jsx)(`span`,{className:`flex min-w-0 items-center`,style:p,children:(0,X.jsx)(nr,{editor:l,className:`text-[13px] font-medium`})}):(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,style:p,children:[t>0?(0,X.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`subtask-tick`,className:`shrink-0 font-mono text-[11px] leading-none text-soft-foreground`,children:`└`}):null,(0,X.jsx)(q,{to:a,title:c,className:K(`min-w-0 truncate text-[13px]`,u?`font-semibold text-foreground`:d?`font-medium text-muted-foreground`:`font-medium`),children:c}),gh(e)?(0,X.jsx)(`span`,{"data-slot":`dispatch-kind`,className:`shrink-0 rounded-full bg-muted px-1.5 py-px text-[10.5px] font-medium text-muted-foreground`,children:gh(e)}):null,f?(0,X.jsx)(Ob,{label:f,expanded:r,onToggle:()=>i(e.id)}):null,u?(0,X.jsx)(ea,{tone:`violet`,role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,className:`shrink-0`}):null,(0,X.jsx)(`button`,{type:`button`,"data-slot":`row-rename`,"aria-label":`Rename task`,onClick:l.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,X.jsx)(qn,{className:`size-3`,"aria-hidden":`true`})}),s?(0,X.jsx)(dh,{pinned:!!e.pinned,onToggle:t=>s(e,t),className:`size-[19px] opacity-0 group-hover/row:opacity-100 focus-visible:opacity-100 no-hover:opacity-100 data-[pinned=true]:opacity-100`}):null]})}function Yb({run:e,cpuExpanded:t,memoryExpanded:n}){let r=C(e,Ln(e.id));return(0,X.jsxs)(X.Fragment,{children:[t?(0,X.jsx)(Xb,{column:`cpu`,cell:r.cpu}):(0,X.jsx)(qb,{column:`cpu`}),n?(0,X.jsx)(Xb,{column:`memory`,cell:r.mem}):(0,X.jsx)(qb,{column:`memory`})]})}function Xb({column:e,cell:t}){return(0,X.jsx)(`td`,{"data-usage":e===`memory`?`mem`:e,"data-column-id":e,"data-usage-kind":t.kind,title:t.title,className:K(Wb,`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 Zb({run:e,depth:t,childCount:n,subtasksExpanded:r,onToggleSubtasks:i,queuePosition:a,now:o,showTokens:s,showCost:c,onTogglePin:l}){let u=qi(),d=na(e),f=dn(e),p=`/tasks/${e.id}`,m=on(e),h=Kn(e),g=Yn(e),_=Xe(e.costUsd),v=hh(n),b=e.inputTokens!==void 0||e.outputTokens!==void 0;return(0,X.jsxs)(`div`,{"data-slot":`task-card`,"data-run-id":e.id,"data-depth":t,style:t>0?{marginLeft:`${t*14}px`}:void 0,onClick:e=>{e.target.closest(`a, button`)||u(p)},className:`cursor-pointer rounded-lg border border-border bg-card px-3.5 py-3 shadow-xs`,children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,X.jsxs)(va,{dot:d.tone,pulse:d.pulse,className:`mt-px shrink-0`,title:f?.title,children:[d.label,f?(0,X.jsx)(`span`,{className:`tabular-nums`,children:f.label}):null]}),(0,X.jsx)(q,{to:p,className:K(`min-w-0 flex-1 text-[13.5px] leading-[1.35]`,h?`font-semibold text-foreground`:g?`font-medium text-muted-foreground`:`font-medium`),children:_e(e)}),gh(e)?(0,X.jsx)(`span`,{"data-slot":`dispatch-kind`,className:`mt-px shrink-0 rounded-full bg-muted px-1.5 py-px text-[10.5px] font-medium text-muted-foreground`,children:gh(e)}):null,v?(0,X.jsx)(Ob,{label:v,expanded:r,onToggle:()=>i(e.id),className:`mt-px`}):null,h?(0,X.jsx)(ea,{tone:`violet`,role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,className:`mt-1.5 shrink-0`}):null,(0,X.jsx)(`span`,{className:`mt-0.5 shrink-0 text-[11.5px] text-soft-foreground tabular-nums`,children:ia(e.finishedAt??e.createdAt,o)}),l?(0,X.jsx)(dh,{pinned:!!e.pinned,onToggle:t=>l(e,t),className:`-mr-1 mt-px`}):null]}),(0,X.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,X.jsx)(`span`,{children:y(e)}),a===null?(0,X.jsxs)(X.Fragment,{children:[e.branch?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($b,{}),(0,X.jsx)(`span`,{children:e.branch})]}):null,e.diffStat?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($b,{}),(0,X.jsx)(ha,{stat:e.diffStat,className:`text-[11.5px]`})]}):null,s&&b?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($b,{}),(0,X.jsx)(ga,{inputTokens:e.inputTokens,outputTokens:e.outputTokens})]}):null,c&&_?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($b,{}),(0,X.jsx)(`span`,{children:_})]}):null]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($b,{}),(0,X.jsxs)(`span`,{"data-slot":`queue-note`,children:[`#`,a,` in queue`]})]}),m?(0,X.jsx)(er,{run:e,reference:m,className:`h-5`}):null]})]})}function Qb(){return(0,X.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`—`})}function $b(){return(0,X.jsx)(`span`,{className:`text-soft-foreground`,"aria-hidden":`true`,children:`·`})}function ex({branch:e}){return(0,X.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 tx(){let e=we(),t=ra(z().data),[n,r]=Xm(),i=f(),a=L({mutationFn:Ne,onSuccess:()=>i.invalidateQueries({queryKey:c.runs.all})}),o=L({mutationFn:u,onSuccess:()=>i.invalidateQueries({queryKey:c.runs.all}),onError:e=>U(e.message,{tone:`danger`})}),s=L({mutationFn:({id:e,title:t})=>Ce(e,{title:t}),onSuccess:e=>{Dt(i,e),i.invalidateQueries({queryKey:c.runs.all})},onError:e=>U(e.message,{tone:`danger`})}),l=Wt(),d=Wn(3e4),p=Lb(),m=_t();return(0,X.jsx)(hr,{projectId:m,requests:Y.useMemo(()=>m===void 0?[]:(e.data??[]).flatMap(e=>Ae(e).map(e=>({projectId:m,kind:e.kind,number:e.number}))),[e.data,m]),children:(0,X.jsx)(Rb,{runs:e.data,view:n,onViewChange:r,onArchiveFinished:()=>a.mutate(),onMarkAllRead:()=>o.mutate(),onRename:(e,t)=>s.mutate({id:e,title:t}),onTogglePin:(e,t)=>l.mutate({id:e.id,pinned:t},{onError:e=>U(e.message,{tone:`danger`})}),now:d,showTokens:t.tokens,showCost:t.cost,expandedColumns:p.expandedColumns,onToggleColumn:p.toggleColumn,columnsPending:p.isPending})})}var nx=` untagged`,rx=[{value:`project`,label:`Project`},{value:`tag`,label:`Tag`},{value:`status`,label:`Status`},{value:`workflow`,label:`Workflow`}];function ix(e,t){return e===t?`none`:t}var ax={query:``,tags:[],statuses:[],workflows:[]};function ox(e,t){return e.includes(t)?e.filter(e=>e!==t):[...e,t]}function sx(e){return e.tags.length+e.statuses.length+e.workflows.length}function cx(e){return e.query.trim()!==``||sx(e)>0}function lx(e){return sx(e.filters)+(e.filters.query.trim()===``?0:1)+(e.groupBy===`none`?0:1)}function ux(e){return lx(e)>0}function dx(e,t){let n=new Map(t.map(e=>[e.id,e]));return e.map(e=>{let t=n.get(e.projectId);return{run:e,project:t,projectName:t?.name||e.projectId,tags:t?.tags??[]}})}function fx(e){let t=new Set;for(let n of e)t.add(n.run.workflow);return[...t].sort((e,t)=>e.localeCompare(t))}function px(e){let t=new Set;for(let n of e)t.add(n.run.status);return[...t].sort((e,t)=>e.localeCompare(t))}function mx(e,t){let n=new Map;for(let r of e)for(let e of t(r))n.set(e,(n.get(e)??0)+1);return n}var hx=e=>e.tags.length===0?[nx]:e.tags,gx=(e,t)=>e.length===0||t.some(t=>e.includes(t)),_x=(e,t)=>{if(t.length===0)return!0;let n=hx(e).map(e=>e.toLowerCase());return t.some(e=>n.includes(e.toLowerCase()))};function vx(e){return[_e(e.run),e.projectName,e.run.workflow,e.run.branch??``,...e.tags].join(`
12
+ `).toLowerCase()}function yx(e,t,n){let r=t.query.trim().toLowerCase().split(/\s+/).filter(Boolean);return e.filter(e=>{if((n===`archived`?!e.run.archived:e.run.archived)||!gx(t.statuses,[e.run.status])||!gx(t.workflows,[e.run.workflow])||!_x(e,t.tags))return!1;if(r.length===0)return!0;let i=vx(e);return r.every(e=>i.includes(e))})}function bx(e,t,n,r){return yx(e,{...t,[r]:[]},n)}function xx(e,t){if(t===`none`)return[{key:`all`,label:``,tasks:[...e]}];let n=new Map,r=(e,t,r)=>{let i=n.get(e);i?i.tasks.push(r):n.set(e,{key:e,label:t,tasks:[r]})};for(let n of e)if(t===`project`)r(n.run.projectId,n.projectName,n);else if(t===`status`)r(n.run.status,n.run.status,n);else if(t===`workflow`)r(n.run.workflow,n.run.workflow,n);else if(n.tags.length===0)r(nx,`Untagged`,n);else for(let e of n.tags)r(e.toLowerCase(),e,n);return[...n.values()].sort((e,t)=>e.key===` untagged`?1:t.key===` untagged`?-1:t.tasks.length-e.tasks.length||e.label.localeCompare(t.label))}function Sx(e,t){let n=new Map(t.map(e=>[e.id,e.name]));return e.map(e=>n.get(e)||e)}var Cx={query:`q`,tag:`tag`,untagged:`untagged`,status:`status`,workflow:`workflow`,groupBy:`group`,archived:`archived`},wx=new Set(rx.map(e=>e.value));function Tx(e){let t=new URLSearchParams,n=e.filters.query.trim();n!==``&&t.set(Cx.query,n);for(let n of e.filters.tags)n===` untagged`?t.set(Cx.untagged,`1`):t.append(Cx.tag,n);for(let n of e.filters.statuses)t.append(Cx.status,n);for(let n of e.filters.workflows)t.append(Cx.workflow,n);return e.groupBy!==`none`&&t.set(Cx.groupBy,e.groupBy),e.view===`archived`&&t.set(Cx.archived,`1`),t}function Ex(e){let t=e.getAll(Cx.tag).filter(e=>e!==``);e.get(Cx.untagged)===`1`&&t.push(nx);let n=e.get(Cx.groupBy)??``;return{filters:{query:e.get(Cx.query)??``,tags:t,statuses:e.getAll(Cx.status).filter(e=>e!==``),workflows:e.getAll(Cx.workflow).filter(e=>e!==``)},groupBy:wx.has(n)?n:`none`,view:e.get(Cx.archived)===`1`?`archived`:`active`}}var Dx=15e3,Ox=250,kx=1,Ax=220,jx=new Set([`done`,`failed`,`cancelled`]);function Mx(){return Px({request:({task:e,archived:t})=>Ve(e.run.projectId,e.run.id,t),patch:({archived:e})=>t=>({...t,archived:e})})}function Nx(){return Px({request:({task:e,read:t})=>Ht(e.run.projectId,e.run.id,t),patch:({read:e})=>t=>{if(e)return{...t,seenAt:new Date().toISOString()};let{seenAt:n,...r}=t;return r}})}function Px({request:e,patch:t}){let n=f();return L({mutationFn:e,onMutate:async e=>{await n.cancelQueries({queryKey:V.runsIndex});let r=n.getQueryData(V.runsIndex),i=t(e),{task:a}=e;return n.setQueryData(V.runsIndex,e=>e===void 0?e:{...e,runs:e.runs.map(e=>e.projectId===a.run.projectId&&e.id===a.run.id?i(e):e)}),{previous:r}},onError:(e,t,r)=>{r?.previous&&n.setQueryData(V.runsIndex,r.previous),U(e.message,{tone:`danger`})},onSettled:(e,t,{task:r})=>{n.invalidateQueries({queryKey:V.runsIndex}),n.invalidateQueries({queryKey:c.runs.all}),n.invalidateQueries({queryKey:[r.run.projectId,`runs`,`list`]})}})}function Fx(){let e=st(),t=ra(z().data),n=h(!0,Dx),[r,i]=T(),{filters:a,groupBy:o,view:s}=Y.useMemo(()=>Ex(r),[r]),[c,l]=Xm();Y.useEffect(()=>{c!==s&&l(s)},[s,c,l]);let u=Wn(3e4),d=e=>i(t=>Tx(e(Ex(t))),{replace:!0}),f=e=>d(t=>({...t,filters:e(t.filters)})),p=e=>d(t=>({...t,groupBy:e})),m=e=>d(t=>({...t,view:e})),[g,_]=Y.useState(a.query),[v,y]=Y.useState(new Set),b=e=>y(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n}),x=a.query.trim()!==``,S=e=>x||v.has(e),C=Y.useRef(a.query);Y.useEffect(()=>{a.query!==C.current&&_(a.query),C.current=a.query},[a.query]),Y.useEffect(()=>{if(g===C.current)return;let e=setTimeout(()=>{C.current=g,f(e=>({...e,query:g}))},Ox);return()=>clearTimeout(e)},[g]);let w=n.data?.referenceStatuses;Y.useEffect(()=>{w&&xt(w)},[w]);let E=Y.useMemo(()=>e.data?.projects??[],[e.data]),D=Y.useMemo(()=>dx(n.data?.runs??[],E),[n.data,E]),O=Y.useMemo(()=>yx(D,a,s),[D,a,s]),k=Y.useMemo(()=>xx(O,o),[O,o]),A=Y.useMemo(()=>O.flatMap(e=>Ae(e.run,e.project?.repoUrl).map(t=>({projectId:e.run.projectId,kind:t.kind,number:t.number}))),[O]),j=Sx(n.data?.truncated??[],E),M=(e,t)=>f(n=>({...n,[e]:ox(n[e],t)})),N=e=>f(t=>({...t,[e]:[]})),P=Mx(),F=Nx();if(n.isError||e.isError)return(0,X.jsx)(`div`,{"data-route":`global-tasks`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(J,{icon:(0,X.jsx)(No,{}),tone:`danger`,title:`Tasks across projects did not load`,subtitle:(n.error??e.error)?.message})});let I=(0,X.jsxs)(`div`,{className:`relative w-full md:w-60`,children:[(0,X.jsx)(xi,{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,X.jsx)(`input`,{type:`text`,value:g,onChange:e=>_(e.target.value),placeholder:`Search every project…`,"aria-label":`Search tasks across projects`,className:`h-9 w-full rounded-md border border-input bg-card pr-3 pl-8 text-[13px] text-foreground outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]});return(0,X.jsxs)(`div`,{"data-route":`global-tasks`,className:`flex min-h-full flex-col`,children:[(0,X.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,X.jsx)(`h1`,{className:`text-base font-semibold`,children:`All tasks`}),(0,X.jsxs)(`div`,{className:`inline-flex gap-0.5 rounded-md bg-muted p-[3px]`,children:[(0,X.jsx)(Ix,{view:`active`,current:s,onSelect:m,children:`Active`}),(0,X.jsx)(Ix,{view:`archived`,current:s,onSelect:m,children:`Archived`})]}),(0,X.jsx)(`div`,{className:`flex-1`}),(0,X.jsxs)(`span`,{"data-slot":`global-tasks-count`,className:`text-[12.5px] text-soft-foreground tabular-nums`,children:[O.length,` of `,D.length]}),I]}),(0,X.jsxs)(`div`,{className:`flex flex-1 flex-col gap-3 p-3 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-5 md:pb-5`,children:[(0,X.jsx)(`div`,{className:`md:hidden`,children:I}),(0,X.jsx)(Lx,{filters:a,onToggle:M,onClearFacet:N,onClearAll:()=>{_(``),d(e=>({...e,filters:ax,groupBy:`none`}))},groupBy:o,onGroupByChange:p,projects:E,tasks:D,view:s}),j.length>0?(0,X.jsxs)(`p`,{"data-slot":`global-tasks-truncated`,className:`text-[11.5px] text-soft-foreground`,children:[`Showing the newest `,n.data?.perProjectLimit,` tasks per project — older ones in`,` `,j.join(`, `),` are only in that project’s own Tasks page.`]}):null,n.data===void 0?null:O.length===0?(0,X.jsx)(Xx,{view:s,filtered:cx(a)}):(0,X.jsx)(hr,{requests:A,children:k.map(e=>(0,X.jsxs)(`section`,{"data-slot":`task-group`,"data-group-key":e.key,children:[o===`none`?null:(0,X.jsxs)(`h2`,{className:`mb-1.5 flex items-center gap-2 text-[12px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:[o===`project`?(0,X.jsx)(ke,{to:Ki(e.key,`/`),"data-slot":`group-project-link`,className:`hover:text-foreground hover:underline`,children:e.label}):e.label,(0,X.jsx)(`span`,{className:`font-mono text-[11px] font-medium tabular-nums`,children:e.tasks.length})]}),(0,X.jsx)(zx,{tasks:e.tasks,now:u,isSubtasksExpanded:S,onToggleSubtasks:b,showProject:o!==`project`,onArchive:(e,t)=>P.mutate({task:e,archived:t}),onSetRead:(e,t)=>F.mutate({task:e,read:t}),busy:P.isPending||F.isPending,showCost:t.cost})]},e.key))})]})]})}function Ix({view:e,current:t,onSelect:n,children:r}){let i=e===t;return(0,X.jsx)(`button`,{type:`button`,"data-slot":`overview-tab`,"data-view":e,"aria-pressed":i,onClick:()=>n(e),className:K(`flex h-7 items-center justify-center rounded-[7px] px-3 text-[12.5px] font-medium text-muted-foreground`,i&&`bg-card font-semibold text-foreground shadow-xs`),children:r})}function Lx({filters:e,onToggle:t,onClearFacet:n,onClearAll:r,groupBy:i,onGroupByChange:a,projects:o,tasks:s,view:c}){let l=Y.useMemo(()=>ot(o),[o]),u=Y.useMemo(()=>{let t=(t,n)=>mx(bx(s,e,c,t),n);return{tags:t(`tags`,hx),statuses:t(`statuses`,e=>[e.run.status]),workflows:t(`workflows`,e=>[e.run.workflow])}},[s,e,c]),d=e=>t=>({...t,count:e.get(t.value)??0});return(0,X.jsxs)(`div`,{"data-slot":`global-tasks-filters`,className:`flex flex-col gap-2 rounded-lg border border-border bg-card p-2.5 shadow-xs`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,X.jsx)(In,{slot:`status`,label:`Status`,selected:e.statuses,onToggle:e=>t(`statuses`,e),onClear:()=>n(`statuses`),options:px(s).map(e=>({value:e,label:e})).map(d(u.statuses)),emptyLabel:`No tasks to filter`}),(0,X.jsx)(In,{slot:`workflow`,label:`Workflow`,selected:e.workflows,onToggle:e=>t(`workflows`,e),onClear:()=>n(`workflows`),options:fx(s).map(e=>({value:e,label:e})).map(d(u.workflows)),emptyLabel:`No tasks to filter`}),(0,X.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`text-[11px] font-medium text-soft-foreground`,children:`Group by`}),(0,X.jsx)(Mn,{slot:`group-by`,label:`Group tasks by`,value:i,options:rx,onChange:e=>a(ix(i,e))}),ux({filters:e,groupBy:i})?(0,X.jsxs)(`button`,{type:`button`,"data-action":`clear-filters`,onClick:r,className:`ml-auto inline-flex h-7 items-center gap-1 rounded-full px-2 text-xs font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[(0,X.jsx)(wi,{className:`size-3`,"aria-hidden":`true`}),`Clear`,` (${lx({filters:e,groupBy:i})})`]}):null]}),l.length>0?(0,X.jsxs)(`div`,{"data-slot":`tag-filters`,className:`flex flex-wrap items-center gap-1.5`,children:[(0,X.jsx)(`span`,{className:`text-[11px] font-medium text-soft-foreground`,children:`Tags`}),l.map(n=>(0,X.jsx)(Pn,{slot:`tag-filter`,tone:`tag`,label:n,count:u.tags.get(n)??0,selected:e.tags.some(e=>e.toLowerCase()===n.toLowerCase()),onToggle:()=>t(`tags`,n)},n)),(0,X.jsx)(Pn,{slot:`tag-filter`,label:`Untagged`,count:u.tags.get(` untagged`)??0,selected:e.tags.includes(nx),onToggle:()=>t(`tags`,nx)})]}):(0,X.jsxs)(`p`,{"data-slot":`no-tags-hint`,className:`text-[11px] text-soft-foreground`,children:[`Tag connected repositories in`,` `,(0,X.jsx)(ke,{to:`/settings/global/projects`,className:`font-medium text-violet hover:underline`,children:`Settings → Projects`}),` `,`to group their tasks together here.`]})]})}var Rx=e=>e.dispatch;function zx({tasks:e,now:t,isSubtasksExpanded:n,onToggleSubtasks:r,showProject:i,onArchive:a,onSetRead:o,busy:s,showCost:c}){return(0,X.jsx)(`div`,{"data-slot":`global-tasks-table`,className:`overflow-x-auto rounded-lg border border-border bg-card shadow-xs`,children:(0,X.jsx)(mr,{children:(0,X.jsxs)(`table`,{className:`w-full border-collapse`,children:[(0,X.jsx)(`thead`,{children:(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(Bx,{className:`w-[104px]`,children:`Status`}),(0,X.jsx)(Bx,{children:`Task`}),i?(0,X.jsx)(Bx,{className:`w-[124px]`,children:`Project`}):null,(0,X.jsx)(Bx,{className:`hidden w-[120px] xl:table-cell`,children:`Tags`}),(0,X.jsx)(Bx,{className:`w-[84px]`,children:`Ref`}),(0,X.jsx)(Bx,{className:`hidden w-[108px] xl:table-cell`,children:`Workflow`}),c?(0,X.jsx)(Bx,{className:`hidden w-[64px] text-right lg:table-cell`,children:`Cost`}):null,(0,X.jsx)(Bx,{className:`hidden w-[56px] text-right xl:table-cell`,children:`CPU`}),(0,X.jsx)(Bx,{className:`hidden w-[84px] text-right xl:table-cell`,children:`Mem`}),(0,X.jsx)(Bx,{className:`w-[56px] text-right`,children:`Age`}),(0,X.jsx)(Bx,{className:`w-[64px] text-right`,children:(0,X.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]})}),(0,X.jsx)(`tbody`,{className:`[&>tr:last-child>td]:border-b-0`,children:mh(e.map(e=>({id:e.run.id,dispatch:Rx(e.run),task:e})),n).map(e=>(0,X.jsx)(Hx,{task:e.run.task,depth:e.depth,childCount:e.childCount,subtasksExpanded:n(e.run.id),onToggleSubtasks:r,now:t,showProject:i,onArchive:a,onSetRead:o,busy:s,showCost:c},`${e.run.task.run.projectId}/${e.run.task.run.id}`))})]})})})}function Bx({children:e,className:t}){return(0,X.jsx)(`th`,{scope:`col`,className:K(`h-[38px] border-b border-border px-2.5 text-left text-[11px] font-semibold tracking-[0.05em] whitespace-nowrap text-soft-foreground uppercase first:pl-4 last:pr-4`,t),children:e})}var Vx=`h-11 border-b border-border px-2.5 whitespace-nowrap first:pl-4 last:pr-4`;function Hx({task:e,depth:t,childCount:n,subtasksExpanded:r,onToggleSubtasks:i,now:a,showProject:o,onArchive:s,onSetRead:c,busy:l,showCost:u}){let{run:d}=e,f=na(d),p=Ki(d.projectId,`/tasks/${d.id}`),m=Kn(d),h=Yn(d),g=Ae(d,e.project?.repoUrl),_=hh(n),v=C(d,d.usage);return(0,X.jsxs)(`tr`,{"data-slot":`global-task-row`,"data-run-id":d.id,"data-project":d.projectId,"data-depth":t,className:`hover:bg-muted`,children:[(0,X.jsx)(`td`,{className:Vx,children:(0,X.jsx)(va,{dot:f.tone,pulse:f.pulse,children:f.label})}),(0,X.jsx)(`td`,{className:K(Vx,`min-w-[320px] max-w-0`),children:(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,style:t>0?{paddingLeft:`${t*14}px`}:void 0,children:[t>0?(0,X.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`subtask-tick`,className:`shrink-0 font-mono text-[11px] leading-none text-soft-foreground`,children:`└`}):null,(0,X.jsx)(ke,{to:p,title:_e(d),className:K(`min-w-0 truncate text-[13px]`,m?`font-semibold text-foreground`:h?`font-medium text-muted-foreground`:`font-medium`),children:_e(d)}),gh(d)?(0,X.jsx)(`span`,{"data-slot":`dispatch-kind`,className:`shrink-0 rounded-full bg-muted px-1.5 py-px text-[10.5px] font-medium text-muted-foreground`,children:gh(d)}):null,_?(0,X.jsx)(Ob,{label:_,expanded:r,onToggle:()=>i(d.id)}):null,m?(0,X.jsx)(ea,{tone:`violet`,role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,className:`shrink-0`}):null]})}),o?(0,X.jsx)(`td`,{className:K(Vx,`text-[12.5px] text-muted-foreground`),children:(0,X.jsx)(ke,{to:Ki(d.projectId,`/`),className:`truncate hover:text-foreground`,children:e.projectName})}):null,(0,X.jsx)(`td`,{className:K(Vx,`hidden xl:table-cell`),children:e.tags.length>0?(0,X.jsx)(`span`,{className:`flex flex-wrap items-center gap-1`,children:e.tags.map(e=>(0,X.jsx)(qx,{tag:e},e))}):(0,X.jsx)(Yx,{})}),(0,X.jsx)(`td`,{className:Vx,children:g.length>0?(0,X.jsx)(Gx,{references:g,run:d}):(0,X.jsx)(Yx,{})}),(0,X.jsx)(`td`,{className:K(Vx,`hidden text-[12.5px] text-muted-foreground xl:table-cell`),children:d.workflow}),u?(0,X.jsx)(`td`,{className:K(Vx,`hidden text-right font-mono text-xs text-muted-foreground tabular-nums lg:table-cell`),children:Xe(d.costUsd)||(0,X.jsx)(Yx,{})}):null,(0,X.jsx)(Jx,{column:`cpu`,cell:v.cpu}),(0,X.jsx)(Jx,{column:`memory`,cell:v.mem}),(0,X.jsx)(`td`,{className:K(Vx,`text-right text-xs text-soft-foreground tabular-nums`),children:ia(d.startedAt??d.createdAt,a)}),(0,X.jsx)(`td`,{className:K(Vx,`text-right`),children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,X.jsx)(Ux,{task:e,busy:l,onSetRead:c}),(0,X.jsx)(Wx,{task:e,busy:l,onArchive:s})]})})]})}function Ux({task:e,busy:t,onSetRead:n}){if(!ar(e.run))return null;let r=Kn(e.run),i=_e(e.run),a=r?`Mark ${i} read`:`Mark ${i} unread`,o=r?Ur:bo;return(0,X.jsxs)(gr,{children:[(0,X.jsx)(fr,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,"data-action":r?`mark-read`:`mark-unread`,"aria-label":a,disabled:t,onClick:()=>n(e,r),className:K(`inline-flex size-7 items-center justify-center rounded-md transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none disabled:cursor-wait disabled:opacity-50`,r?`text-violet`:`text-soft-foreground`),children:(0,X.jsx)(o,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,X.jsx)(pr,{side:`left`,children:r?`Mark read`:`Mark unread`})]})}function Wx({task:e,busy:t,onArchive:n}){let r=e.run.archived;if(!r&&!jx.has(e.run.status))return null;let i=r?`Restore ${_e(e.run)} to the active list`:`Archive ${_e(e.run)}`;return(0,X.jsxs)(gr,{children:[(0,X.jsx)(fr,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,"data-action":r?`unarchive-run`:`archive-run`,"aria-label":i,disabled:t,onClick:()=>n(e,!r),className:`inline-flex size-7 items-center justify-center rounded-md text-soft-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none disabled:cursor-wait disabled:opacity-50`,children:(0,X.jsx)(r?Qn:Gn,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,X.jsx)(pr,{side:`left`,children:r?`Restore`:`Archive`})]})}function Gx({references:e,run:t}){let n=e.slice(0,kx),r=e.length-n.length,i=_e(t);return(0,X.jsxs)(`span`,{className:`flex flex-nowrap items-center gap-1`,children:[n.map(e=>(0,X.jsx)(cr,{reference:e,taskTitle:i,projectId:t.projectId,conflictAction:(0,X.jsx)(Zn,{projectId:t.projectId,runId:t.id,prNumber:e.number}),className:`shrink-0`},`${e.kind}#${e.number}`)),r>0?(0,X.jsx)(Kx,{references:e,taskTitle:i,hidden:r,projectId:t.projectId}):null]})}function Kx({references:e,taskTitle:t,hidden:n,projectId:r}){let[i,a]=Y.useState(!1),o=Y.useRef(!1),s=Y.useRef(void 0);Y.useEffect(()=>()=>clearTimeout(s.current),[]);let c=e=>e.pointerType!==`touch`,l=()=>clearTimeout(s.current),u=e=>{c(e)&&(l(),o.current=!0,a(!0))},d=e=>{c(e)&&(l(),s.current=setTimeout(()=>a(!1),Ax))};return(0,X.jsxs)(Or,{open:i,onOpenChange:a,children:[(0,X.jsx)(wr,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`reference-overflow`,"aria-label":`Show all ${e.length} references for ${t}`,onPointerEnter:u,onPointerLeave:d,onPointerDown:()=>{o.current=!1},onClick:()=>{o.current=!1},className:`shrink-0 rounded-full px-1 text-[11px] font-medium text-soft-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:[`+`,n]})}),(0,X.jsxs)(Er,{align:`start`,className:`w-auto min-w-40 p-1.5`,"data-slot":`reference-overflow-list`,onPointerEnter:u,onPointerLeave:d,onOpenAutoFocus:e=>{o.current&&e.preventDefault()},onCloseAutoFocus:e=>{o.current&&e.preventDefault()},children:[(0,X.jsx)(`p`,{className:`px-1 pb-1.5 text-[10.5px] text-soft-foreground`,children:`References`}),(0,X.jsx)(`span`,{className:`flex flex-col items-start gap-1`,children:e.map(e=>(0,X.jsx)(cr,{reference:e,taskTitle:t,projectId:r},`${e.kind}#${e.number}`))})]})]})}function qx({tag:e,className:t}){return(0,X.jsx)(`span`,{"data-slot":`project-tag`,className:K(`inline-flex max-w-full items-center truncate rounded-full bg-muted px-1.5 py-px text-[10.5px] font-medium text-muted-foreground`,t),children:e})}function Jx({column:e,cell:t}){return(0,X.jsx)(`td`,{"data-usage":e===`memory`?`mem`:e,"data-usage-kind":t.kind,title:t.title,className:K(Vx,`hidden text-right font-mono tabular-nums xl:table-cell`,t.kind===`live`&&`bg-violet/5 text-xs font-medium text-foreground`,t.kind===`peak`&&`text-[11.5px] text-soft-foreground`,t.kind===`none`&&`text-xs text-soft-foreground`),children:t.text||`—`})}function Yx(){return(0,X.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`—`})}function Xx({view:e,filtered:t}){return t?(0,X.jsx)(J,{heading:`h2`,icon:(0,X.jsx)(di,{}),tone:`neutral`,title:`No matching tasks`,subtitle:`No task in any project matches these filters.`}):e===`archived`?(0,X.jsx)(J,{heading:`h2`,icon:(0,X.jsx)(Gn,{}),tone:`neutral`,title:`Nothing archived yet`,subtitle:`Finished tasks you archive land here, from every project.`}):(0,X.jsx)(J,{heading:`h2`,icon:(0,X.jsx)(Fo,{}),tone:`neutral`,title:`No tasks yet`,subtitle:`Start a task in any project and it shows up here.`})}var Zx=(0,Y.lazy)(()=>Dn(()=>import(`./dashboard-B3-tPimG.js`).then(e=>({default:e.DashboardRoute})),__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]))),Qx=(0,Y.lazy)(()=>Dn(()=>import(`./task-thread-RXabJAt0.js`).then(e=>({default:e.TaskThreadRoute})),__vite__mapDeps([25,1,2,3,4,5,7,8,9,26,15,10,11,16,17,18,19,27,28,29,30,31,32,33,34,12,13,35,36,37,38,22,39,40,41,42,43,44,21,45,46,24,47,48,49,50,51,52,53,54,55,56,57]))),$x=(0,Y.lazy)(()=>Dn(()=>import(`./compare-variants-D6Ji6od4.js`).then(e=>({default:e.CompareVariantsRoute})),__vite__mapDeps([58,1,2,3,4,5,22,53,43,44,9,21,19,46,24,36,47,48,49,50,57]))),eS=(0,Y.lazy)(()=>Dn(()=>import(`./task-changes-DIT9Y1rh.js`).then(e=>({default:e.TaskChangesRoute})),__vite__mapDeps([59,1,2,3,4,5,26,15,10,11,16,17,18,19,27,28,29,30,31,39,40,41,42,34,43,44,9,21,45,46,24,47,48,49,50,51,60,13,8,36,54,38,61,62,56,63,22,64,65]))),tS=(0,Y.lazy)(()=>Dn(()=>import(`./task-files-BMm9C0DW.js`).then(e=>({default:e.TaskFilesRoute})),__vite__mapDeps([66,1,2,3,4,5,22,39,26,15,10,11,16,17,18,19,27,28,29,30,31,40,41,42,34,43,44,9,21,45,46,24,47,48,49,50,51,64,36]))),nS=(0,Y.lazy)(()=>Dn(()=>import(`./task-commits-B4VvdiHH.js`).then(e=>({default:e.TaskCommitsRoute})),__vite__mapDeps([67,1,2,3,4,5,26,15,10,11,16,17,18,19,27,28,29,30,31,68,39,40,41,42,34,43,44,9,21,45,46,24,47,48,49,50,51,60,53,36,61,62,56,69,55]))),rS=(0,Y.lazy)(()=>Dn(()=>import(`./repo-git-BZWZ6_pR.js`).then(e=>({default:e.RepoGitRoute})),__vite__mapDeps([70,1,2,3,4,5,68,60,17,53,18,21,45,36,61,62,56,51,63,22,27,11,41,64,28,31,65,69,55]))),iS=(0,Y.lazy)(()=>Dn(()=>import(`./github-De-DFy8s.js`).then(e=>({default:e.GithubRoute})),__vite__mapDeps([71,1,2,3,4,5,68,72,10,11,22,16,27,17,34,29,73,12,9,13,8,74,52,30,21,35,18,24,36,54,37,38,47,44,48,49,50,14,61,45,62,56,51]))),aS=(0,Y.lazy)(()=>Dn(()=>import(`./tracker-J0fdcH1G.js`).then(e=>({default:e.TrackerRoute})),__vite__mapDeps([75,1,2,3,4,5,68,10,11,27,29,73,12,9,13,8,74,52,30,21,35,18,24,36,54,38,47,44,48,49,50]))),oS=(0,Y.lazy)(()=>Dn(()=>import(`./workflows-D-dx9c_0.js`).then(e=>({default:e.WorkflowsRoute})),__vite__mapDeps([76,1,2,3,4,5,32,40,23,30,31,18,65,8,44,9,35,36,54,77]))),sS=(0,Y.lazy)(()=>Dn(()=>import(`./skills-Dsi5YdLG.js`).then(e=>({default:e.SkillsRoute})),__vite__mapDeps([78,1,2,3,4,5,68,16,23,29,73,30,18,13,8,9,21,35,36,77]))),cS=(0,Y.lazy)(()=>Dn(()=>import(`./automations-route-AMJbFP53.js`).then(e=>({default:e.AutomationsRoute})),__vite__mapDeps([79,1,2,3,4,5,6,7,8,9,10,11,12,13,14,26,15,16,17,18,19,27,28,29,30,31,68,20,21,72,22,40,52,42,43,44,24,35,46,36,54,37])));function lS(){let e=oe();return(0,X.jsx)(Qi,{to:{pathname:`/skills`,search:e.search,hash:e.hash},replace:!0})}function uS({sectionId:e}){let t=oe();return(0,X.jsx)(v,{to:{pathname:xb(`global`,e),search:t.search,hash:t.hash},replace:!0})}function dS(){return(0,X.jsx)(`div`,{"data-route":`scope-resolving`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(`p`,{className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:`Loading…`})})}function fS(){let{projectId:e=``}=ge(),t=oe(),n=st(),r=z();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,X.jsx)(v,{to:`/p/${encodeURIComponent(e)}${n||`/`}${t.search}${t.hash}`,replace:!0})}if(!n.isError)return(0,X.jsx)(dS,{})}if(n.data){if(!(n.data.bootProject===e||n.data.projects.some(t=>t.id===e)))return(0,X.jsx)(z_,{projectId:e,registry:n.data})}else if(!n.isError)return(0,X.jsx)(dS,{});return(0,X.jsx)(vn,{projectId:n.data?.bootProject===e?null:e,children:(0,X.jsx)(fe,{},e)})}function pS(){let{projectId:e=``}=ge();return(0,X.jsx)(T_,{},e)}function mS(){let e=oe(),t=z(),n=st(),r=t.data?.bootProject??n.data?.bootProject,i=(t.data!==void 0||t.isError)&&(n.data!==void 0||n.isError);if(r===void 0&&!i)return(0,X.jsx)(dS,{});let a=r??`default`;if(e.pathname===`/`&&e.search===``&&e.hash===``){if(n.data===void 0&&!n.isError)return(0,X.jsx)(dS,{});let e=eg(Jh(),n.data,r);if(e!==null)return(0,X.jsx)(v,{to:e,replace:!0});let t=tg(n.data,a);if(t!==a)return(0,X.jsx)(v,{to:`/p/${encodeURIComponent(t)}/`,replace:!0})}let o=e.pathname===`/p`||e.pathname===`/p/`?`/`:e.pathname;return(0,X.jsx)(v,{to:`/p/${encodeURIComponent(a)}${o}${e.search}${e.hash}`,replace:!0})}var hS=[{pattern:`/`,pageLabel:`Tasks`},{pattern:`/tasks`,pageLabel:`All tasks`},{pattern:`/dashboard`,pageLabel:`Dashboard`},{pattern:`/new`,pageLabel:`New task`},{pattern:`/compare/:groupId`,pageLabel:`Compare`},{pattern:`/git/*`,pageLabel:`Git`},{pattern:`/github/*`,pageLabel:`GitHub`},{pattern:`/tracker/*`,pageLabel:`Tracker`},{pattern:`/automations/*`,pageLabel:`Automations`},{pattern:`/skills`,pageLabel:`Skills`},{pattern:`/inbox`,pageLabel:`Inbox`},{pattern:`/workflows/*`,pageLabel:`Workflows`},{pattern:`/settings/*`,pageLabel:`Settings`}];function gS(e){let t=Zi(e),n=St({path:`/tasks/:id/*`,end:!0},t);return n?{pageLabel:null,taskId:n.params.id??null}:{pageLabel:hS.find(({pattern:e})=>St({path:e,end:!0},t))?.pageLabel??null,taskId:null}}var _S=(0,Y.memo)(function(){let e=z().data?.capabilities;return(0,X.jsxs)(l,{children:[(0,X.jsxs)(H,{path:`/p/:projectId`,element:(0,X.jsx)(fS,{}),children:[(0,X.jsx)(H,{index:!0,element:(0,X.jsx)(tx,{})}),(0,X.jsx)(H,{path:`new`,element:(0,X.jsx)(pS,{})}),(0,X.jsx)(H,{path:`tasks/:id`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Cr,{}),children:(0,X.jsx)(Qx,{})})}),(0,X.jsx)(H,{path:`tasks/:id/changes`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(V_,{tab:`changes`}),children:(0,X.jsx)(eS,{})})}),(0,X.jsx)(H,{path:`tasks/:id/files`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(V_,{tab:`files`}),children:(0,X.jsx)(tS,{})})}),(0,X.jsx)(H,{path:`tasks/:id/commits`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(V_,{tab:`changes`}),children:(0,X.jsx)(nS,{})})}),(0,X.jsx)(H,{path:`tasks/:id/commits/:sha`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(V_,{tab:`changes`}),children:(0,X.jsx)(nS,{})})}),(0,X.jsx)(H,{path:`compare/:groupId`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(ig,{}),children:(0,X.jsx)($x,{})})}),(0,X.jsx)(H,{path:`git`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(L_,{}),children:(0,X.jsx)(rS,{tab:`changes`})})}),(0,X.jsx)(H,{path:`git/commits`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(L_,{}),children:(0,X.jsx)(rS,{tab:`commits`})})}),(0,X.jsx)(H,{path:`git/commits/:sha`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(L_,{}),children:(0,X.jsx)(rS,{tab:`commits`})})}),(0,X.jsx)(H,{path:`git/branches`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(L_,{}),children:(0,X.jsx)(rS,{tab:`branches`})})}),(0,X.jsx)(H,{path:`github`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(ag,{}),children:(0,X.jsx)(iS,{view:`issues`,index:!0})})}),(0,X.jsx)(H,{path:`tracker`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(dS,{}),children:(0,X.jsx)(aS,{})})}),(0,X.jsx)(H,{path:`tracker/:id`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(dS,{}),children:(0,X.jsx)(aS,{})})}),(0,X.jsx)(H,{path:`github/prs`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(ag,{}),children:(0,X.jsx)(iS,{view:`prs`})})}),(0,X.jsx)(H,{path:`github/issues/:n`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(ag,{}),children:(0,X.jsx)(iS,{view:`issues`})})}),(0,X.jsx)(H,{path:`github/prs/:n`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(ag,{}),children:(0,X.jsx)(iS,{view:`prs`})})}),(0,X.jsx)(H,{path:`github/prs/:n/changes`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(ag,{}),children:(0,X.jsx)(iS,{view:`prs`,changes:!0})})}),(0,X.jsx)(H,{path:`automations`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(rg,{}),children:(0,X.jsx)(cS,{})})}),(0,X.jsx)(H,{path:`automations/new`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(rg,{}),children:(0,X.jsx)(cS,{mode:`new`})})}),(0,X.jsx)(H,{path:`automations/:automationId`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(rg,{}),children:(0,X.jsx)(cS,{mode:`edit`})})}),(0,X.jsx)(H,{path:`automations/:automationId/log`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(rg,{}),children:(0,X.jsx)(cS,{mode:`log`})})}),(0,X.jsx)(H,{path:`skills`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(R_,{}),children:(0,X.jsx)(sS,{})})}),(0,X.jsx)(H,{path:`inbox`,element:(0,X.jsx)(mg,{})}),(0,X.jsx)(H,{path:`workflows`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(B_,{}),children:(0,X.jsx)(oS,{})})}),(0,X.jsx)(H,{path:`workflows/:name`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(B_,{}),children:(0,X.jsx)(oS,{})})}),(0,X.jsx)(H,{path:`settings`,element:(0,X.jsx)(Db,{scope:`project`,capabilities:e})}),(0,X.jsx)(H,{path:`settings/skills`,element:(0,X.jsx)(lS,{})}),db(`project`,e).map(t=>(0,X.jsx)(H,{path:`settings/${t.id}`,element:(0,X.jsx)(Eb,{section:t,scope:`project`,capabilities:e})},t.id)),db(`global`,e).map(e=>(0,X.jsx)(H,{path:`settings/${e.id}`,element:(0,X.jsx)(uS,{sectionId:e.id})},e.id)),(0,X.jsx)(H,{path:`*`,element:(0,X.jsx)(I_,{})})]}),(0,X.jsx)(H,{path:`/tasks`,element:(0,X.jsx)(Fx,{})}),(0,X.jsx)(H,{path:`/dashboard`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`div`,{role:`status`,className:`p-6 text-sm text-muted-foreground`,children:`Loading dashboard…`}),children:(0,X.jsx)(Zx,{})})}),(0,X.jsx)(H,{path:`/settings/global`,element:(0,X.jsx)(Db,{scope:`global`,capabilities:e})}),db(`global`,e).map(t=>(0,X.jsx)(H,{path:xb(`global`,t.id),element:(0,X.jsx)(Eb,{section:t,scope:`global`,capabilities:e})},t.id)),(0,X.jsx)(H,{path:`*`,element:(0,X.jsx)(mS,{})})]})});function vS(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 yS(e){return e?.available===!0&&(e.status===`available`||e.status===`error`)}var bS=(0,Y.memo)(function({children:e}){let{pathname:t}=oe(),n=$i(),r=z(),i=te(),a=r.data?.capabilities.followups===!0,o=r.data?.capabilities.automations===!0,s=Ke(a),c=yS(Rt(n??``,n!==null).data),l=st().data,u=gS(t),d=l?.bootProject??r.data?.bootProject??null,f=yn(n,d,(0,Y.useMemo)(()=>ir,[])),p=n!==null&&n===d,m=l?.projects.find(e=>e.id===n),h=l?.projects.find(e=>e.id===d),g=n===null?h?.tracker:m?.tracker,_=u.taskId,v=Qt(n??``,m!==void 0&&_!==null,l?.bootProject===n,(0,Y.useMemo)(()=>e=>{let t=_?e.find(e=>e.id===_):void 0;return t?_e(t):void 0},[_])).data;Kh({projectName:t===`/settings/global`||t.startsWith(`/settings/global/`)?null:m?.name??(p?vS(r.data)?.name??null:null),pageLabel:v??u.pageLabel});let y=l&&l.projects.length>1?l:null,b=(0,Y.useMemo)(()=>vS(r.data),[r.data?.repo?.root,r.data?.repo?.branch]),x=(0,Y.useMemo)(()=>(0,X.jsx)(uh,{}),[]),S=(0,Y.useMemo)(()=>(0,X.jsx)(Th,{}),[]),C=(0,Y.useMemo)(()=>(0,X.jsx)(eh,{}),[]),w=(0,Y.useMemo)(()=>y?(0,X.jsx)(Nh,{projects:y.projects,bootProjectId:y.bootProject,inboxAvailable:a,automationsAvailable:o,inboxCount:s.data?.length??null,skillsUpdateAvailable:c}):void 0,[y,a,o,s.data?.length,c]),T=(0,Y.useMemo)(()=>(0,X.jsx)(Vh,{health:r.data}),[r.data]);return(0,X.jsxs)(Ym,{children:[(0,X.jsx)(jm,{repo:b,version:r.data?.version??null,latestVersion:r.data?.latestVersion??null,starCount:i.data?.available?i.data.count??null:null,inboxCount:s.data?.length??null,unreadCount:f.data??null,skillsUpdateAvailable:c,forgeAvailable:r.data?.forge?.available===!0,inboxAvailable:a,automationsAvailable:o,tracker:g,banner:x,singleProject:r.data?.capabilities.singleProject===!0,taskQuickList:S,hostWidget:C,projectGroups:w,toolsMenu:T,children:e}),(0,X.jsx)(Pp,{})]})});function xS(){let e=oe(),t=st();return(0,Y.useEffect)(()=>{let n=$h(e,t.data);n!==null&&(ng(Jh(),n)||Yh(n))},[e.hash,e.pathname,e.search,t.data]),null}function SS(){let e=f(),t=cy(Nt().data?.notifications).enabled,n=(0,Y.useRef)(t);n.current=t;let r=(0,Y.useRef)(new Map);return(0,Y.useEffect)(()=>{let t=ne(c.runs.list()),i=e=>{let{entering:t,statuses:i}=uy(r.current,e);if(r.current=i,t.length!==0&&dy({enabled:n.current,hidden:document.visibilityState===`hidden`,permission:ly()}))for(let e of t)CS(e)};return i(e.getQueryData(c.runs.list())),e.getQueryCache().subscribe(e=>{e.query.queryHash!==t||e.type!==`updated`||i(e.query.state.data)})},[e]),null}function CS(e){let t=globalThis.Notification;if(typeof t!=`function`)return;let n=fy(e);try{new t(n.title,{body:n.body,tag:n.tag})}catch{}}function wS(e,t=!0){return Se({queryKey:[...V.dashboard,`insights`,e],enabled:t,staleTime:5e3,refetchInterval:t?15e3:!1,refetchIntervalInBackground:!1,retry:!1,queryFn:async({signal:t})=>Tn.parse(await Xt(await ee.api.v1.workspace.dashboard.insights.$get({query:{period:e,tzOffsetMinutes:String(new Date().getTimezoneOffset())}},{init:{signal:t}}),`/workspace/dashboard/insights`))})}var TS=[`pointerdown`,`pointermove`,`keydown`,`wheel`,`touchstart`];function ES(){let e=document.activeElement;return e?e.isContentEditable||e.tagName===`TEXTAREA`||e.tagName===`INPUT`&&e.type!==`checkbox`:!1}var DS=()=>document.querySelector(`[role="dialog"],[role="alertdialog"]`)!==null;function OS(){let e=f(),t=te(),n=t.data?.available===!0,r=t.data?.available?t.data.count??null:null,[i,a]=(0,Y.useState)(!1),o=(0,Y.useRef)(n);o.current=n;let s=(0,Y.useRef)(new Map),l=(0,Y.useRef)(null),u=(0,Y.useRef)(0);return(0,Y.useEffect)(()=>{let t=ne(c.runs.list()),n,r=()=>Kp({now:Date.now(),visible:document.visibilityState===`visible`,focused:document.hasFocus(),lastInteractionAt:u.current,typing:ES(),dialogOpen:DS()}),i=()=>{let e=l.current;if(!(e===null||n)){if(Date.now()-e>18e5){l.current=null;return}r()&&(n=setTimeout(()=>{n=void 0;let e=Hp();if(!(l.current===null||!r()||!o.current)){if(!Wp(e,Date.now())){l.current=null;return}l.current=null,Up({...e,asks:e.asks+1,lastAskedAt:new Date().toISOString()}),a(!0)}},Vp))}},d=e=>{let{succeeded:t,statuses:n}=Yp(s.current,e);s.current=n,!(!t||!o.current)&&(Gp(e)<3||Wp(Hp(),Date.now())&&(l.current=Date.now(),i()))},f=()=>{u.current=Date.now(),i()};for(let e of TS)window.addEventListener(e,f,{passive:!0});document.addEventListener(`visibilitychange`,i),window.addEventListener(`focus`,i),d(e.getQueryData(c.runs.list()));let p=e.getQueryCache().subscribe(e=>{e.query.queryHash!==t||e.type!==`updated`||d(e.query.state.data)});return()=>{p(),clearTimeout(n);for(let e of TS)window.removeEventListener(e,f);document.removeEventListener(`visibilitychange`,i),window.removeEventListener(`focus`,i)}},[e]),(0,X.jsx)(AS,{open:i,onOpenChange:a,count:r})}function kS(e){let t=Hp();t&&Up({...t,outcome:e})}function AS({open:e,onOpenChange:t,count:n}){let r=wS(`30d`,e).data?.delivered,i=r&&r.completedTasks>0?[{label:`Tasks done`,n:r.completedTasks,value:r.completedTasks.toLocaleString(`en-US`)},{label:`PRs opened`,n:r.prsOpened,value:r.prsOpened.toLocaleString(`en-US`)},{label:`Lines written`,n:r.additions,value:`+${r.additions.toLocaleString(`en-US`)}`}].filter(e=>e.n>0):null;return(0,X.jsx)(Gi,{open:e,onOpenChange:t,children:(0,X.jsxs)(Ui,{"data-slot":`star-ask`,className:`gap-0 overflow-hidden p-0 sm:max-w-[440px]`,children:[(0,X.jsxs)(`div`,{className:`relative flex h-36 items-center justify-center overflow-hidden border-b bg-card-2`,children:[(0,X.jsx)(`div`,{"aria-hidden":`true`,className:`absolute inset-0 bg-[radial-gradient(circle_at_22%_35%,color-mix(in_oklab,var(--accent-lime)_32%,transparent),transparent_55%),radial-gradient(circle_at_80%_70%,color-mix(in_oklab,var(--violet)_38%,transparent),transparent_55%)]`}),(0,X.jsxs)(`div`,{"aria-hidden":`true`,className:`relative flex items-center gap-4`,children:[(0,X.jsx)($p,{height:52,className:`text-foreground`}),(0,X.jsx)(`span`,{className:`flex size-12 items-center justify-center rounded-full border bg-card shadow-md`,children:(0,X.jsx)(Jo,{className:`size-6 fill-current text-pending-strong`})})]}),n!==null&&(0,X.jsxs)(`span`,{className:`absolute bottom-3 left-1/2 -translate-x-1/2 rounded-full border bg-card/80 px-2.5 py-0.5 font-mono text-[11px] text-muted-foreground backdrop-blur`,children:[`⭐ `,zp(n),` stars on GitHub`]})]}),(0,X.jsxs)(`div`,{className:`space-y-4 p-6`,children:[(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`span`,{className:`section-mark block font-mono text-[11px] font-semibold uppercase tracking-[0.14em] text-muted-foreground`,children:`Open source · MIT`}),(0,X.jsx)(Wi,{className:`text-xl font-semibold tracking-tight`,children:`Is cezar pulling its weight?`}),(0,X.jsx)(Bi,{className:`text-sm leading-relaxed text-muted-foreground`,children:`cezar is free, open source and runs on your machine, with no account to create. A GitHub star is how other developers find it, and how we know what to keep building.`})]}),i&&(0,X.jsxs)(`div`,{className:`rounded-lg border bg-card-2 p-3`,children:[(0,X.jsx)(`span`,{className:`block font-mono text-[10.5px] uppercase tracking-[0.12em] text-soft-foreground`,children:`Your last 30 days with cezar`}),(0,X.jsx)(`dl`,{className:`mt-2 grid gap-2`,style:{gridTemplateColumns:`repeat(${i.length}, minmax(0, 1fr))`},children:i.map(e=>(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col-reverse`,children:[(0,X.jsx)(`dt`,{className:`text-xs text-soft-foreground`,children:e.label}),(0,X.jsx)(`dd`,{className:`truncate text-lg font-semibold tabular-nums`,children:e.value})]},e.label))})]}),(0,X.jsx)(W,{asChild:!0,className:`h-11 w-full text-sm font-semibold`,children:(0,X.jsxs)(`a`,{href:Lp,target:`_blank`,rel:`noopener noreferrer`,onClick:()=>{kS(`starred`),t(!1)},children:[(0,X.jsx)(Jo,{className:`size-4 fill-current`,"aria-hidden":`true`}),`Star cezar on GitHub`,(0,X.jsx)(dr,{className:`size-4`,"aria-hidden":`true`})]})}),(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,X.jsx)(W,{variant:`ghost`,className:`min-h-11`,onClick:()=>t(!1),children:`Maybe later`}),(0,X.jsx)(W,{variant:`ghost`,className:`min-h-11 text-soft-foreground`,onClick:()=>{kS(`never`),t(!1)},children:`Don’t ask again`})]})]})]})})}function jS(){let[e]=(0,Y.useState)(co);return(0,X.jsx)(_n,{client:e,children:(0,X.jsx)(kn,{children:(0,X.jsxs)(Xa,{children:[(0,X.jsx)(SS,{}),(0,X.jsx)(OS,{}),(0,X.jsx)(Pl,{children:(0,X.jsx)(qv,{children:(0,X.jsxs)(an,{children:[(0,X.jsx)(xS,{}),(0,X.jsx)(lr,{children:(0,X.jsx)(bS,{children:(0,X.jsx)(_S,{})})}),(0,X.jsx)(Gt,{})]})})})]})})})}function MS(){return(document.querySelector(`meta[name="cez-api-base"]`)?.getAttribute(`content`))?.trim()||``}En(MS());var NS=document.getElementById(`root`);if(!NS)throw Error(`cezar: #root container is missing from index.html`);(0,La.createRoot)(NS).render((0,X.jsx)(Y.StrictMode,{children:(0,X.jsx)(jS,{})}));export{Va as $,Df as A,vl as B,nm as C,_p as D,$f as E,jf as F,Xo as G,ml as H,Ff as I,Uo as J,Go as K,Eu as L,wd as M,kd as N,pp as O,Iu as P,go as Q,Du as R,rm as S,Jf as T,$o as U,hl as V,Qo as W,Oo as X,ko as Y,So as Z,ag as _,V_ as a,im as b,Xg as c,qg as d,gg as f,og as g,cg as h,H_ as i,qf as j,tp as k,Jg as l,lg as m,xb as n,B_ as o,ug as p,Wo as q,oy as r,L_ as s,wS as t,Yg as u,ig as v,ap as w,am as x,tm as y,du as z};