@open-mercato/cezar 0.17.0-pr976.3708 → 0.17.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 (367) hide show
  1. package/README.md +4 -0
  2. package/dist/agent-config/validate.d.ts +2 -1
  3. package/dist/agent-config/validate.js.map +1 -1
  4. package/dist/api-origin.d.ts +0 -4
  5. package/dist/api-origin.js +0 -22
  6. package/dist/api-origin.js.map +1 -1
  7. package/dist/cockpit-address.d.ts +5 -0
  8. package/dist/cockpit-address.js +7 -0
  9. package/dist/cockpit-address.js.map +1 -1
  10. package/dist/contract/health.d.ts +30 -0
  11. package/dist/contract/index.d.ts +1 -0
  12. package/dist/contract/index.js +2370 -2054
  13. package/dist/contract/projects.d.ts +1 -0
  14. package/dist/contract/runs.d.ts +178 -2
  15. package/dist/contract/skills.d.ts +23 -0
  16. package/dist/contract/webhooks.d.ts +1136 -0
  17. package/dist/contract/workspace.d.ts +2 -0
  18. package/dist/core/agent-errors.d.ts +6 -0
  19. package/dist/core/agent-errors.js +13 -0
  20. package/dist/core/agent-errors.js.map +1 -1
  21. package/dist/core/agent-failure-class.d.ts +24 -0
  22. package/dist/core/agent-failure-class.js +99 -0
  23. package/dist/core/agent-failure-class.js.map +1 -0
  24. package/dist/core/agent-runner.d.ts +1 -1
  25. package/dist/core/claude-cli-runner.d.ts +2 -2
  26. package/dist/core/claude-cli-runner.js +17 -21
  27. package/dist/core/claude-cli-runner.js.map +1 -1
  28. package/dist/core/codex-app-server-runner.d.ts +1 -1
  29. package/dist/core/codex-app-server-runner.js +20 -23
  30. package/dist/core/codex-app-server-runner.js.map +1 -1
  31. package/dist/core/copilot-acp-runner.d.ts +1 -1
  32. package/dist/core/copilot-acp-runner.js +10 -10
  33. package/dist/core/copilot-acp-runner.js.map +1 -1
  34. package/dist/core/cursor-agent-runner.js +18 -22
  35. package/dist/core/cursor-agent-runner.js.map +1 -1
  36. package/dist/core/inactivity-deadline.d.ts +21 -0
  37. package/dist/core/inactivity-deadline.js +49 -0
  38. package/dist/core/inactivity-deadline.js.map +1 -0
  39. package/dist/core/junie-runner.d.ts +1 -1
  40. package/dist/core/junie-runner.js +16 -20
  41. package/dist/core/junie-runner.js.map +1 -1
  42. package/dist/core/opencode-server-runner.d.ts +2 -2
  43. package/dist/core/opencode-server-runner.js +23 -15
  44. package/dist/core/opencode-server-runner.js.map +1 -1
  45. package/dist/core/pi-runner.d.ts +1 -1
  46. package/dist/core/pi-runner.js +8 -10
  47. package/dist/core/pi-runner.js.map +1 -1
  48. package/dist/core/provider-auth.js +18 -6
  49. package/dist/core/provider-auth.js.map +1 -1
  50. package/dist/core/runner-factory.d.ts +2 -0
  51. package/dist/core/runner-factory.js +39 -0
  52. package/dist/core/runner-factory.js.map +1 -1
  53. package/dist/core/secret-redaction.js +38 -6
  54. package/dist/core/secret-redaction.js.map +1 -1
  55. package/dist/data-gitignore.d.ts +1 -1
  56. package/dist/data-gitignore.js +1 -0
  57. package/dist/data-gitignore.js.map +1 -1
  58. package/dist/disk-space.d.ts +38 -0
  59. package/dist/disk-space.js +113 -0
  60. package/dist/disk-space.js.map +1 -0
  61. package/dist/dispatch/prompts.js +1 -1
  62. package/dist/git-worktree.d.ts +2 -0
  63. package/dist/git-worktree.js +16 -0
  64. package/dist/git-worktree.js.map +1 -1
  65. package/dist/handoff.d.ts +2 -2
  66. package/dist/handoff.js +1 -1
  67. package/dist/index.js +24 -3
  68. package/dist/index.js.map +1 -1
  69. package/dist/pack-check.d.ts +10 -0
  70. package/dist/pack-check.js +7 -0
  71. package/dist/pack-check.js.map +1 -1
  72. package/dist/release/backport.d.ts +34 -0
  73. package/dist/release/backport.js +33 -0
  74. package/dist/release/backport.js.map +1 -0
  75. package/dist/runs/agent-error-telemetry.d.ts +5 -1
  76. package/dist/runs/agent-error-telemetry.js +17 -10
  77. package/dist/runs/agent-error-telemetry.js.map +1 -1
  78. package/dist/runs/failure-kind.d.ts +1 -1
  79. package/dist/runs/failure-kind.js +5 -8
  80. package/dist/runs/failure-kind.js.map +1 -1
  81. package/dist/runs/lifecycle.d.ts +55 -0
  82. package/dist/runs/lifecycle.js +24 -0
  83. package/dist/runs/lifecycle.js.map +1 -0
  84. package/dist/runs/retention.js +36 -4
  85. package/dist/runs/retention.js.map +1 -1
  86. package/dist/runs/store.d.ts +31 -0
  87. package/dist/runs/store.js +59 -5
  88. package/dist/runs/store.js.map +1 -1
  89. package/dist/server/capabilities.js +3 -0
  90. package/dist/server/capabilities.js.map +1 -1
  91. package/dist/server/disk-health.d.ts +11 -0
  92. package/dist/server/disk-health.js +26 -0
  93. package/dist/server/disk-health.js.map +1 -0
  94. package/dist/server/forge/github.d.ts +9 -1
  95. package/dist/server/forge/github.js +42 -3
  96. package/dist/server/forge/github.js.map +1 -1
  97. package/dist/server/message-receipts.d.ts +27 -0
  98. package/dist/server/message-receipts.js +54 -0
  99. package/dist/server/message-receipts.js.map +1 -0
  100. package/dist/server/project-context.d.ts +5 -0
  101. package/dist/server/project-context.js +35 -1
  102. package/dist/server/project-context.js.map +1 -1
  103. package/dist/server/server.d.ts +2744 -866
  104. package/dist/server/server.js +191 -148
  105. package/dist/server/server.js.map +1 -1
  106. package/dist/server/webhooks.d.ts +817 -0
  107. package/dist/server/webhooks.js +91 -0
  108. package/dist/server/webhooks.js.map +1 -0
  109. package/dist/server/worktree-lifecycle.d.ts +88 -88
  110. package/dist/startup-port.d.ts +12 -0
  111. package/dist/startup-port.js +33 -0
  112. package/dist/startup-port.js.map +1 -0
  113. package/dist/telemetry-service.json +1 -0
  114. package/dist/webhooks/admission.d.ts +360 -0
  115. package/dist/webhooks/admission.js +294 -0
  116. package/dist/webhooks/admission.js.map +1 -0
  117. package/dist/webhooks/coordinator.d.ts +39 -0
  118. package/dist/webhooks/coordinator.js +215 -0
  119. package/dist/webhooks/coordinator.js.map +1 -0
  120. package/dist/webhooks/destination.d.ts +24 -0
  121. package/dist/webhooks/destination.js +111 -0
  122. package/dist/webhooks/destination.js.map +1 -0
  123. package/dist/webhooks/discord.d.ts +4 -0
  124. package/dist/webhooks/discord.js +102 -0
  125. package/dist/webhooks/discord.js.map +1 -0
  126. package/dist/webhooks/endpoints.d.ts +201 -0
  127. package/dist/webhooks/endpoints.js +345 -0
  128. package/dist/webhooks/endpoints.js.map +1 -0
  129. package/dist/webhooks/history.d.ts +42 -0
  130. package/dist/webhooks/history.js +222 -0
  131. package/dist/webhooks/history.js.map +1 -0
  132. package/dist/webhooks/lifecycle.d.ts +34 -0
  133. package/dist/webhooks/lifecycle.js +60 -0
  134. package/dist/webhooks/lifecycle.js.map +1 -0
  135. package/dist/webhooks/limits.d.ts +19 -0
  136. package/dist/webhooks/limits.js +101 -0
  137. package/dist/webhooks/limits.js.map +1 -0
  138. package/dist/webhooks/links.d.ts +12 -0
  139. package/dist/webhooks/links.js +40 -0
  140. package/dist/webhooks/links.js.map +1 -0
  141. package/dist/webhooks/operations.d.ts +24 -0
  142. package/dist/webhooks/operations.js +128 -0
  143. package/dist/webhooks/operations.js.map +1 -0
  144. package/dist/webhooks/outbox.d.ts +37 -0
  145. package/dist/webhooks/outbox.js +221 -0
  146. package/dist/webhooks/outbox.js.map +1 -0
  147. package/dist/webhooks/ownership.d.ts +17 -0
  148. package/dist/webhooks/ownership.js +254 -0
  149. package/dist/webhooks/ownership.js.map +1 -0
  150. package/dist/webhooks/payload.d.ts +6 -0
  151. package/dist/webhooks/payload.js +112 -0
  152. package/dist/webhooks/payload.js.map +1 -0
  153. package/dist/webhooks/platform.d.ts +9 -0
  154. package/dist/webhooks/platform.js +12 -0
  155. package/dist/webhooks/platform.js.map +1 -0
  156. package/dist/webhooks/privacy.d.ts +4 -0
  157. package/dist/webhooks/privacy.js +43 -0
  158. package/dist/webhooks/privacy.js.map +1 -0
  159. package/dist/webhooks/process-identity.d.ts +36 -0
  160. package/dist/webhooks/process-identity.js +240 -0
  161. package/dist/webhooks/process-identity.js.map +1 -0
  162. package/dist/webhooks/scheduler.d.ts +10 -0
  163. package/dist/webhooks/scheduler.js +43 -0
  164. package/dist/webhooks/scheduler.js.map +1 -0
  165. package/dist/webhooks/service.d.ts +313 -0
  166. package/dist/webhooks/service.js +1005 -0
  167. package/dist/webhooks/service.js.map +1 -0
  168. package/dist/webhooks/signing.d.ts +3 -0
  169. package/dist/webhooks/signing.js +36 -0
  170. package/dist/webhooks/signing.js.map +1 -0
  171. package/dist/webhooks/slack.d.ts +4 -0
  172. package/dist/webhooks/slack.js +56 -0
  173. package/dist/webhooks/slack.js.map +1 -0
  174. package/dist/webhooks/source.d.ts +178 -0
  175. package/dist/webhooks/source.js +23 -0
  176. package/dist/webhooks/source.js.map +1 -0
  177. package/dist/webhooks/storage.d.ts +21 -0
  178. package/dist/webhooks/storage.js +202 -0
  179. package/dist/webhooks/storage.js.map +1 -0
  180. package/dist/webhooks/transport.d.ts +30 -0
  181. package/dist/webhooks/transport.js +235 -0
  182. package/dist/webhooks/transport.js.map +1 -0
  183. package/dist/workflows/completion-reason.d.ts +4 -0
  184. package/dist/workflows/completion-reason.js +39 -0
  185. package/dist/workflows/completion-reason.js.map +1 -0
  186. package/dist/workflows/queued-bounds.d.ts +31 -0
  187. package/dist/workflows/queued-bounds.js +81 -0
  188. package/dist/workflows/queued-bounds.js.map +1 -0
  189. package/dist/workflows/run.d.ts +113 -20
  190. package/dist/workflows/run.js +726 -191
  191. package/dist/workflows/run.js.map +1 -1
  192. package/dist/workspace/config.d.ts +8 -0
  193. package/dist/workspace/config.js +62 -19
  194. package/dist/workspace/config.js.map +1 -1
  195. package/dist/workspace/ui-state.d.ts +4 -2
  196. package/dist/workspace/ui-state.js +13 -9
  197. package/dist/workspace/ui-state.js.map +1 -1
  198. package/package.json +4 -3
  199. package/scripts/check-pack.mjs +2 -4
  200. package/scripts/mock-claude.mjs +30 -5
  201. package/scripts/webhooks-schema.mjs +5 -0
  202. package/web/dist/assets/23I4SOAX-B4MCXPfc.js +2 -0
  203. package/web/dist/assets/26H2HVXD-DnN7AaEY.js +2 -0
  204. package/web/dist/assets/2IZ5MNOH-CgfSuFFL.js +1 -0
  205. package/web/dist/assets/2P3CZEXH-kInGrvHu.js +2 -0
  206. package/web/dist/assets/3E5HRNYT-DLbBxF6y.js +5 -0
  207. package/web/dist/assets/3JIRLDUO-B9tVJ8E_.js +1 -0
  208. package/web/dist/assets/5MJ3UKSG-nDfsJSF7.js +2 -0
  209. package/web/dist/assets/5THPTBWS-Ce_hS451.js +1 -0
  210. package/web/dist/assets/7OAKGN26-t-mlpHkx.js +25 -0
  211. package/web/dist/assets/7WLXJQOR-D6QVYUu9.js +1 -0
  212. package/web/dist/assets/A255FCTW-Bx0Z-P1v.js +1 -0
  213. package/web/dist/assets/AM43MQ64-C_UmP8Ka.js +2 -0
  214. package/web/dist/assets/AOZTNTMC-Di2iVwCo.js +5 -0
  215. package/web/dist/assets/AQNLM6KG-CcWg0kGq.js +4 -0
  216. package/web/dist/assets/BNU2RHQB-M1l5nkNs.js +2 -0
  217. package/web/dist/assets/C5HTQT3I-B50g1XeK.js +4 -0
  218. package/web/dist/assets/CPKRWH5G-DHdVktma.js +12 -0
  219. package/web/dist/assets/CUVCMPQX-75g4RQep.js +1 -0
  220. package/web/dist/assets/D4V2MWCI-Bm34L6wL.js +1 -0
  221. package/web/dist/assets/DHKBVIA3-Db-JqVOb.js +1 -0
  222. package/web/dist/assets/DKTLEL5E-DciMwFJ1.js +1 -0
  223. package/web/dist/assets/DUZNPW7S-4AKJemkg.js +2 -0
  224. package/web/dist/assets/E3FWOBN4-AT8jzYgb.js +4 -0
  225. package/web/dist/assets/E65FQMJL-eiWd8F8c.js +1 -0
  226. package/web/dist/assets/FTXIJQGB-CggtIYAM.js +1 -0
  227. package/web/dist/assets/G3MDBVQH-BZmnMkFw.js +1 -0
  228. package/web/dist/assets/G3OATVW2-D5zJu3ib.js +8 -0
  229. package/web/dist/assets/GUJTEFZK-DPEFMf5Q.js +1 -0
  230. package/web/dist/assets/IHVFDU4A-pP0Mb5Iu.js +10 -0
  231. package/web/dist/assets/IV52FOAS-jWHN2JLM.js +5 -0
  232. package/web/dist/assets/JTJEEBDN-DZeTEWqk.js +2 -0
  233. package/web/dist/assets/K7FUICZ3-C9JebvoP.js +2 -0
  234. package/web/dist/assets/LHH2HHRB-DZSZGD4x.js +2 -0
  235. package/web/dist/assets/MSPQPZZY-DOCBMJ70.js +4 -0
  236. package/web/dist/assets/OB6ZFVKF-D6V5f56z.js +2 -0
  237. package/web/dist/assets/PLTZDMI2-DltbYIQQ.js +1 -0
  238. package/web/dist/assets/R7EPXMMD-Dk_RDmvY.js +5 -0
  239. package/web/dist/assets/RVARI57O-CgA1WoRv.js +1 -0
  240. package/web/dist/assets/SPBWZ4VS-8FnOEPzw.js +1 -0
  241. package/web/dist/assets/SR7OOV3Q-3uZPNU1G.js +4 -0
  242. package/web/dist/assets/STAXBNH4-C4N6ZLTR.js +2 -0
  243. package/web/dist/assets/SXFARSFO-DHdVQB4G.js +1 -0
  244. package/web/dist/assets/TC77ISAL-BgUbI3Of.js +2 -0
  245. package/web/dist/assets/TYIQQHVC-S2gy0AUp.js +13 -0
  246. package/web/dist/assets/TZUXETIT-C6qyTEYa.js +2 -0
  247. package/web/dist/assets/U7N72BGE-8vTdAst9.js +6 -0
  248. package/web/dist/assets/UFPIB6EZ-BVjLTP07.js +3 -0
  249. package/web/dist/assets/UO52YEYL-EHYBNpY5.js +3 -0
  250. package/web/dist/assets/VIK3ONSK-Cton0Rgg.js +2 -0
  251. package/web/dist/assets/VVVO4ZVP-CdFWI9EE.js +2 -0
  252. package/web/dist/assets/WRGXZO53-DYQ4OW92.js +3 -0
  253. package/web/dist/assets/X5SG7MGC-DtC_vaXe.js +2 -0
  254. package/web/dist/assets/XLHPVVFU-MQkW7HpM.js +2 -0
  255. package/web/dist/assets/XXYPNCD5-Ib-xj97c.js +5 -0
  256. package/web/dist/assets/Z6WRYFJC-C6TE3q4J.js +7 -0
  257. package/web/dist/assets/ZI2QNEGF-DwOKsV8B.js +8 -0
  258. package/web/dist/assets/{agent-task-pickers-CJAx53eR.js → agent-task-pickers-C_2o0KYX.js} +1 -1
  259. package/web/dist/assets/{alert-dialog-BugYooRk.js → alert-dialog-fzSWCIyG.js} +1 -1
  260. package/web/dist/assets/arrow-left-CpV00riO.js +1 -0
  261. package/web/dist/assets/{automation-format-Bxe-TVRX.js → automation-format-BgAhuFNq.js} +1 -1
  262. package/web/dist/assets/automations-route-Ca648Wyc.js +1 -0
  263. package/web/dist/assets/bundle-mjs-rHxsej31.js +1 -0
  264. package/web/dist/assets/button-vdGgKu1b.js +100 -0
  265. package/web/dist/assets/{centered-state-Cm8_dS47.js → centered-state-C1nDqaTs.js} +1 -1
  266. package/web/dist/assets/check-DA3yaTey.js +1 -0
  267. package/web/dist/assets/chevron-left-D1eW2pzs.js +1 -0
  268. package/web/dist/assets/chevron-right-DwqBinJp.js +1 -0
  269. package/web/dist/assets/{chunk-BO2N2NFS-CFvlB0rH.js → chunk-BO2N2NFS-Bde6epwZ.js} +4 -4
  270. package/web/dist/assets/circle-check-G0BDdNX3.js +1 -0
  271. package/web/dist/assets/clipboard-B9AGRj3s.js +1 -0
  272. package/web/dist/assets/{collapsible-BoDLSmkP.js → collapsible-Ci-k9Y0m.js} +1 -1
  273. package/web/dist/assets/{commit-list-C_l41PzR.js → commit-list-B8qutNJ9.js} +1 -1
  274. package/web/dist/assets/{compare-variants-Du6vJ7FF.js → compare-variants-CD-H9QV0.js} +1 -1
  275. package/web/dist/assets/dashboard-BuNIEyIc.js +44 -0
  276. package/web/dist/assets/diff-DdDwJ41q.js +3 -0
  277. package/web/dist/assets/{diff-view-D7b6T1ik.js → diff-view-D4eUaNtD.js} +4 -4
  278. package/web/dist/assets/{download-CHsOA7RH.js → download-C9cyRK4D.js} +1 -1
  279. package/web/dist/assets/facet-filter-BpaMiUU2.js +5 -0
  280. package/web/dist/assets/{file-Bu00nVUj.js → file-CcDDcqzK.js} +1 -1
  281. package/web/dist/assets/file-preview-DyqTWb0f.js +2 -0
  282. package/web/dist/assets/{file-text-CISqp5LY.js → file-text-C5N0APxx.js} +1 -1
  283. package/web/dist/assets/{git-pull-request-draft-D2Lm-pPz.js → git-pull-request-draft-Bqwhflhv.js} +1 -1
  284. package/web/dist/assets/git-tab-loading-BXSixY5p.js +1 -0
  285. package/web/dist/assets/git-toolbar-CB3F5Ztu.js +1 -0
  286. package/web/dist/assets/github-CjHl4MMe.js +1 -0
  287. package/web/dist/assets/{highlighted-body-OFNGDK62-CDHv8VkT.js → highlighted-body-OFNGDK62-k8gmH63p.js} +1 -1
  288. package/web/dist/assets/{host-usage-CRNpjHr0.js → host-usage-EIcPz8s9.js} +1 -1
  289. package/web/dist/assets/{icon-tooltip-BrV8FoZY.js → icon-tooltip-CCXhXgac.js} +1 -1
  290. package/web/dist/assets/index-C_k6g6fh.js +29 -0
  291. package/web/dist/assets/index-DvagaaKL.css +2 -0
  292. package/web/dist/assets/{input-6sILF4ZL.js → input-DXFchFdf.js} +1 -1
  293. package/web/dist/assets/layout-cards-DrC84hQa.js +1 -0
  294. package/web/dist/assets/lazy-DaFjwB-q.js +11 -0
  295. package/web/dist/assets/lib-xgA2N1t8.js +1 -0
  296. package/web/dist/assets/loader-circle-B2Lhi0xN.js +1 -0
  297. package/web/dist/assets/{markdown-DDUUmNxl.js → markdown-3VbTQcD0.js} +1 -1
  298. package/web/dist/assets/markdown-DxPHdOwB.js +4 -0
  299. package/web/dist/assets/mermaid-GHXKKRXX-CQo8vsdt.js +1 -0
  300. package/web/dist/assets/{message-square-CUcOsOeK.js → message-square-9JNzSy42.js} +1 -1
  301. package/web/dist/assets/plus-BHSN5Uog.js +1 -0
  302. package/web/dist/assets/preload-helper-Czpn1I53.js +1 -0
  303. package/web/dist/assets/{project-router-Uv5K_t7U.js → project-router-BzcW5R3O.js} +2 -2
  304. package/web/dist/assets/queries-XYjXpa8s.js +1 -0
  305. package/web/dist/assets/reference-chip-JX3G6Wkk.js +1 -0
  306. package/web/dist/assets/repo-git-CZTtXETi.js +1 -0
  307. package/web/dist/assets/{run-diff-CaQSFkcv.js → run-diff-C_s9tHfS.js} +2 -2
  308. package/web/dist/assets/{save-D8UGIAXq.js → save-B4O7rFCS.js} +1 -1
  309. package/web/dist/assets/{scroll-within-CEDDAUiO.js → scroll-within-DTBX-TR6.js} +1 -1
  310. package/web/dist/assets/{search-x-CG0S6SUu.js → search-x-CQPbQgV6.js} +1 -1
  311. package/web/dist/assets/{settings-2-ogt1zu3P.js → settings-2-CrmZbb_8.js} +1 -1
  312. package/web/dist/assets/skills-DXkSdyb8.js +1 -0
  313. package/web/dist/assets/{square-VAdlYQJn.js → square-DCg6avOT.js} +1 -1
  314. package/web/dist/assets/{tabs-BP29AtfS.js → tabs-Cb8MmIEQ.js} +1 -1
  315. package/web/dist/assets/{tag-4juVmU06.js → tag-CEWhwfVf.js} +1 -1
  316. package/web/dist/assets/task-commits-BruCWCkF.js +1 -0
  317. package/web/dist/assets/{task-graph-4GzVwwdu.js → task-graph-D_OLXJSk.js} +1 -1
  318. package/web/dist/assets/{task-notes-CCT7q8Fr.js → task-notes-DzOdZjqZ.js} +1 -1
  319. package/web/dist/assets/task-workspace-C5Conyc1.js +29 -0
  320. package/web/dist/assets/{terminal-DEjD4n5K.js → terminal-BVAfyHZI.js} +1 -1
  321. package/web/dist/assets/terminal-drawer-Dcg67RS8.js +3 -0
  322. package/web/dist/assets/{textarea-DJjpA11v.js → textarea-DywMDkfl.js} +1 -1
  323. package/web/dist/assets/{token-metrics-BJ1naBNS.js → token-metrics-BiFl2ovY.js} +1 -1
  324. package/web/dist/assets/{tooltip-BieGyrAz.js → tooltip-7suUQClM.js} +1 -1
  325. package/web/dist/assets/{tracker-DitRxloO.js → tracker-BFYcbTEV.js} +2 -2
  326. package/web/dist/assets/{triangle-alert-lwmk_SnN.js → triangle-alert-hMpQrXJS.js} +1 -1
  327. package/web/dist/assets/{upload-Dx8IzFX_.js → upload-Ddh5Fb-A.js} +1 -1
  328. package/web/dist/assets/use-now-BlhSvP80.js +1 -0
  329. package/web/dist/assets/{use-submit-shortcut-B-uDwQhP.js → use-submit-shortcut-BC7gmgDS.js} +1 -1
  330. package/web/dist/assets/workflow-graph-BljUjNdF.js +13 -0
  331. package/web/dist/assets/worktree-lifecycle-operation-psNUwGwT.js +18 -0
  332. package/web/dist/index.html +41 -41
  333. package/web/dist/assets/arrow-left-FG-BtI91.js +0 -1
  334. package/web/dist/assets/automations-route-BRN9qRg1.js +0 -1
  335. package/web/dist/assets/bundle-mjs-BT31bpU6.js +0 -1
  336. package/web/dist/assets/button-DFlig-3W.js +0 -100
  337. package/web/dist/assets/check-Bg7-Ecuy.js +0 -1
  338. package/web/dist/assets/chevron-left-Cd_qkrfl.js +0 -1
  339. package/web/dist/assets/chevron-right-7BUoNLSN.js +0 -1
  340. package/web/dist/assets/circle-check-D3dWBsEI.js +0 -1
  341. package/web/dist/assets/dashboard-BDtFQg4f.js +0 -44
  342. package/web/dist/assets/diff-DZjcij_W.js +0 -3
  343. package/web/dist/assets/diff-stat-BIAV32IP.js +0 -1
  344. package/web/dist/assets/facet-filter-BCQvQXmA.js +0 -5
  345. package/web/dist/assets/file-preview-B0UXYkxB.js +0 -2
  346. package/web/dist/assets/git-tab-loading-Dcf8fCoC.js +0 -1
  347. package/web/dist/assets/git-toolbar-aXyXLu2P.js +0 -1
  348. package/web/dist/assets/github-PjL79xgT.js +0 -1
  349. package/web/dist/assets/index-DvwYGTi3.css +0 -2
  350. package/web/dist/assets/index-DxwI2MZD.js +0 -25
  351. package/web/dist/assets/layout-cards-Det2whh-.js +0 -1
  352. package/web/dist/assets/lib-BQXq3kEf.js +0 -1
  353. package/web/dist/assets/loader-circle-DDkRpp8X.js +0 -1
  354. package/web/dist/assets/markdown-lc7gwiQQ.js +0 -4
  355. package/web/dist/assets/mermaid-GHXKKRXX-CbLTa2tM.js +0 -1
  356. package/web/dist/assets/plus-BqHBcC4w.js +0 -1
  357. package/web/dist/assets/queries-C09jaXiS.js +0 -1
  358. package/web/dist/assets/reference-chip-CHF-Sbml.js +0 -1
  359. package/web/dist/assets/repo-git-DT0rQqvz.js +0 -1
  360. package/web/dist/assets/skills-Cf8xEPei.js +0 -1
  361. package/web/dist/assets/task-commits-CyO2Q8jS.js +0 -1
  362. package/web/dist/assets/task-workspace-C6o0DzgB.js +0 -29
  363. package/web/dist/assets/terminal-drawer-TV4K7S4u.js +0 -3
  364. package/web/dist/assets/use-now-Cr9QvR5I.js +0 -1
  365. package/web/dist/assets/workflow-graph-g3f0xPwZ.js +0 -13
  366. package/web/dist/assets/worktree-lifecycle-operation-COUqhS7A.js +0 -18
  367. package/web/dist/assets/x-BrRT8S7Q.js +0 -1
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{r,t as i}from"./button-DFlig-3W.js";import{t as a}from"./project-router-Uv5K_t7U.js";import{_ as o,f as s,g as c,h as l,m as u,p as d}from"./reference-chip-CHF-Sbml.js";import{H as f,K as p,Nn as m,On as h,Ot as g,Z as _,gt as v,pt as y,tt as b}from"./git-tab-loading-Dcf8fCoC.js";import{t as x}from"./check-Bg7-Ecuy.js";import{f as S}from"./tooltip-BieGyrAz.js";import{a as C,c as w,i as T,l as E,n as D,r as O,u as k}from"./icon-tooltip-BrV8FoZY.js";import{t as A}from"./save-D8UGIAXq.js";import{t as j}from"./x-BrRT8S7Q.js";import{t as M}from"./input-6sILF4ZL.js";var N=e(t(),1),P=n(),F=2,ee=new Map,te=[],ne=[],re=30,I=`text/cez-view`,L=`text/cez-column`;function R({layouts:e,active:t,onSelect:n,onClose:o,saved:s=ne,onApplySaved:c,onSaveCurrent:l,onDeleteSaved:u,fixedViews:d=[],fixedActive:_=null,onViews:v=te,onSelectFixed:y,notesHref:b,notesActive:x=!1,showLayouts:S=!0,onViewDragStart:C,onViewDragEnd:w,onOpenBeside:A,onColumnDropClose:j,keyHints:M=ee,showKeyHints:R=!1}){let B=b?p(d):[...d],U=e=>e===`notes`?x:_===e,W=(0,N.useRef)(null),[ie,ae]=(0,N.useState)(0),[G,K]=(0,N.useState)(null),oe=`${B.join(`|`)}#${S&&_===null?t:``}`;(0,N.useEffect)(()=>{let e=W.current;if(!e)return;let t=()=>ae(e.clientWidth),n=typeof ResizeObserver>`u`?null:new ResizeObserver(t);return n?.observe(e),window.addEventListener(`resize`,t),()=>{n?.disconnect(),window.removeEventListener(`resize`,t)}},[]);let[se,ce]=(0,N.useState)(0);(0,N.useEffect)(()=>{let e=typeof document>`u`?void 0:document.fonts;if(!e)return;let t=()=>ce(e=>e+1);return e.ready.then(t),e.addEventListener?.(`loadingdone`,t),()=>e.removeEventListener?.(`loadingdone`,t)},[]),(0,N.useLayoutEffect)(()=>K(null),[oe,ie,se]),(0,N.useLayoutEffect)(()=>{let e=W.current;G===null||G===0||!e||e.scrollWidth>e.clientWidth+1&&K(G-1)}),(0,N.useLayoutEffect)(()=>{let e=W.current;if(G!==null||!e)return;let t=[...e.querySelectorAll(`[data-strip-item]`)].map(e=>e.offsetWidth+F),n=[...e.querySelectorAll(`[data-strip-chrome]`)].reduce((e,t)=>e+t.offsetWidth+F,0),r=e.clientWidth-n;if(t.reduce((e,t)=>e+t,0)<=r){K(B.length);return}let i=B.findIndex(U),a=re,o=0;for(let[e,n]of t.entries()){let s=i>e?t[i]??0:0;if(a+n+s>r)break;a+=n,o+=1}K(o)});let q=G??B.length,J=B.slice(0,q),Y=B.findIndex(U);Y>=q&&(J=[...J,B[Y]]);let X=B.filter(e=>!J.includes(e)),[Z,Q]=(0,N.useState)(!1),$=e=>j!==void 0&&e.dataTransfer.types.includes(L);return(0,P.jsxs)(`div`,{ref:W,"data-slot":`layout-cards`,"data-drop-close":Z?``:void 0,className:r(`relative flex min-w-0 flex-1 items-end gap-0.5 overflow-x-clip rounded-md`,Z&&`bg-muted outline-1 outline-dashed outline-border`),onDragOver:e=>{$(e)&&(e.preventDefault(),e.dataTransfer.dropEffect=`move`,Q(!0))},onDragLeave:e=>{e.relatedTarget instanceof Node&&e.currentTarget.contains(e.relatedTarget)||Q(!1)},onDrop:e=>{if(Q(!1),!$(e))return;let t=e.dataTransfer.getData(L),n=Number(t);t===``||!Number.isInteger(n)||(e.preventDefault(),j?.(n))},children:[J.map(e=>{if(e===`notes`)return(0,P.jsxs)(a,{to:b,"data-strip-item":``,"aria-current":x?`page`:void 0,className:r(`relative -mb-px flex h-9 shrink-0 items-center gap-1.5 border-b-2 px-2.5 text-[13px] font-medium`,x?`border-foreground text-foreground`:`border-transparent text-muted-foreground hover:text-foreground`),children:[(0,P.jsx)(z,{hint:R?M.get(`view:notes`):void 0,children:(0,P.jsx)(h,{"aria-hidden":`true`,className:`size-3.5 shrink-0`})}),`Notes`]},`notes`);let t=B.indexOf(e)+1,n=f[e],o=U(e),s=v.includes(e),c=g(e),l=M.get(`view:${e}`);return(0,P.jsxs)(i,{type:`button`,variant:`ghost`,"data-slot":`layout-card`,"data-strip-item":``,"data-fixed":e,"data-active":o?`true`:void 0,"data-on":s?``:void 0,"aria-pressed":o||s,draggable:C!==void 0,title:C?`${c}${t<=9?` (${t})`:``} — drag onto the workspace to split, ⌥-click to open beside`:c,onClick:t=>{t.altKey&&A?A(e):y?.(e)},onDragStart:t=>{t.dataTransfer.setData(I,e),t.dataTransfer.effectAllowed=`copyMove`,C?.(e)},onDragEnd:()=>w?.(),className:r(`relative -mb-px h-9 shrink-0 gap-1.5 rounded-none border-b-2 border-transparent px-2.5 text-[13px] font-medium text-muted-foreground hover:bg-transparent hover:text-foreground active:translate-y-0`,(o||s)&&`text-foreground`,o&&`border-foreground`),children:[(0,P.jsx)(z,{hint:R?l:void 0,children:(0,P.jsx)(n,{"aria-hidden":`true`,className:`size-3.5 shrink-0`})}),c,s&&!o?(0,P.jsx)(`span`,{"aria-hidden":`true`,className:`absolute top-2 right-1 size-1.5 rounded-full bg-primary`}):null]},e)}),X.length>0?(0,P.jsxs)(D,{children:[(0,P.jsx)(k,{asChild:!0,children:(0,P.jsx)(i,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-action":`more-views`,"aria-label":`${X.length} more views`,title:`More views`,className:`mb-1 size-7 shrink-0 text-muted-foreground`,children:(0,P.jsx)(m,{"aria-hidden":`true`})})}),(0,P.jsx)(O,{align:`start`,className:`max-h-72 w-56 overflow-y-auto`,children:X.map(e=>{if(e===`notes`)return(0,P.jsx)(T,{asChild:!0,children:(0,P.jsxs)(a,{to:b,children:[(0,P.jsx)(h,{"aria-hidden":`true`}),(0,P.jsx)(`span`,{className:`truncate`,children:`Notes`}),M.get(`view:notes`)?(0,P.jsx)(E,{children:M.get(`view:notes`)}):null]})},`notes`);let t=f[e],n=M.get(`view:${e}`);return(0,P.jsxs)(T,{"data-view":e,onSelect:()=>y?.(e),children:[(0,P.jsx)(t,{"aria-hidden":`true`}),(0,P.jsx)(`span`,{className:`truncate`,children:g(e)}),n?(0,P.jsx)(E,{children:n}):null]},e)})})]}):null,Z?(0,P.jsx)(`span`,{className:`pointer-events-none absolute top-1/2 right-3 -translate-y-1/2 rounded bg-background px-2 py-0.5 text-xs font-medium text-foreground shadow-sm`,children:`Drop to close this column`}):null,S?(0,P.jsx)(`div`,{"data-strip-chrome":``,className:`ml-auto flex shrink-0 items-center pb-1 pl-2`,children:(0,P.jsx)(H,{layouts:e,active:_===null?t:null,saved:s,onSelect:n,onClose:o,onApplySaved:c,onSaveCurrent:l,onDeleteSaved:u,suggestedName:V(e,_===null?t:null,_)})}):null]})}function z({hint:e,children:t}){let n=`pointer-events-none flex shrink-0 items-center justify-center rounded-[4px] bg-foreground font-mono text-[10px] leading-none font-semibold text-background`;return e?e.length===1?(0,P.jsx)(`kbd`,{"data-slot":`tab-key-hint`,"aria-hidden":`true`,className:r(n,`size-3.5`),children:e}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`span`,{className:`invisible flex shrink-0`,children:t}),(0,P.jsx)(`kbd`,{"data-slot":`tab-key-hint`,"aria-hidden":`true`,className:r(n,`absolute -top-1 right-0 z-10 h-4 px-1`),children:e})]}):t}function B({count:e,className:t}){let n=Math.max(1,Math.min(e,3)),i=2.5,a=1.5,o=(20-i*2-a*(n-1))/n;return(0,P.jsxs)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 20 14`,className:r(`h-3.5 w-5 shrink-0`,t),fill:`none`,children:[(0,P.jsx)(`rect`,{x:`0.6`,y:`0.6`,width:18.8,height:12.8,rx:`2`,stroke:`currentColor`,strokeWidth:`1.2`}),Array.from({length:n},(e,t)=>(0,P.jsx)(`rect`,{x:i+t*(o+a),y:i,width:o,height:14-i*2,rx:`0.75`,fill:`currentColor`,opacity:.55},t))]})}function V(e,t,n){let r=t===null?void 0:e.find(e=>e.name===t);return r&&r.name!==`Custom`?v(r.name):r?r.columns.map(e=>g(e.view)).join(` + `):n?`${g(n)} layout`:``}function H({layouts:e,active:t,saved:n,onSelect:a,onClose:o,onApplySaved:s,onSaveCurrent:c,onDeleteSaved:l,suggestedName:u}){let d=t===null?void 0:e.find(e=>e.name===t),f=new Set(n.map(e=>e.name)),p=e.filter(e=>!f.has(e.name)),[m,h]=(0,N.useState)(!1),g=(0,N.useRef)(!1),_=(0,N.useRef)(null);return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(D,{children:[(0,P.jsx)(k,{asChild:!0,children:(0,P.jsxs)(i,{type:`button`,variant:`outline`,size:`sm`,ref:_,"data-action":`layouts`,"data-active-layout":d?d.name:void 0,"aria-label":d?`Layout: ${v(d.name)}`:`Layouts`,title:`Layouts — open a saved one, or save what is on screen`,className:r(`h-7 max-w-48 shrink-0 gap-1.5 px-2 text-[12.5px]`,d?`text-foreground`:`text-muted-foreground`),children:[(0,P.jsx)(B,{count:d?.columns.length??2}),(0,P.jsx)(`span`,{className:`truncate max-md:hidden`,children:d?v(d.name):`Layout`}),(0,P.jsx)(S,{"aria-hidden":`true`,className:`size-3.5 opacity-60`})]})}),(0,P.jsxs)(O,{align:`end`,className:`max-h-96 w-64 overflow-y-auto`,onCloseAutoFocus:e=>{g.current&&(g.current=!1,e.preventDefault())},children:[(0,P.jsx)(C,{children:`Saved layouts`}),n.length===0?(0,P.jsx)(`p`,{className:`px-2 pb-1.5 text-xs text-muted-foreground`,children:`None yet — arrange the view (drag a tab onto it), then save it here. Saved layouts are offered in every task.`}):null,n.map(e=>(0,P.jsx)(U,{name:e.name,count:e.columns.length,selected:e.name===t,kind:`saved`,onPick:()=>s?.(e),remove:l?{label:`Delete saved layout ${e.name}`,run:()=>l(e.name)}:void 0},`saved:${e.name}`)),p.length>0?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(w,{}),(0,P.jsx)(C,{children:`This task`}),p.map(e=>(0,P.jsx)(U,{name:v(e.name),count:e.columns.length,selected:e.name===t,kind:`task`,onPick:()=>a(e.name),remove:{label:`Close layout ${v(e.name)}`,run:()=>o(e.name)}},`task:${e.name}`))]}):null,c?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(w,{}),(0,P.jsxs)(T,{"data-action":`save-layout`,onSelect:()=>{g.current=!0,h(!0)},children:[(0,P.jsx)(A,{"aria-hidden":`true`}),`Save current view as layout…`]})]}):null]})]}),(0,P.jsx)(W,{open:m,suggested:u,taken:f,onCommit:e=>{h(!1),c?.(e)},onCancel:()=>h(!1),returnFocus:()=>_.current?.focus()})]})}function U({name:e,count:t,selected:n,kind:r,onPick:i,remove:a}){return(0,P.jsxs)(T,{"data-layout":e,"data-layout-kind":r,"data-active":n?``:void 0,onSelect:i,"aria-keyshortcuts":a?`Delete`:void 0,onKeyDown:e=>{!a||e.key!==`Delete`&&e.key!==`Backspace`||(e.preventDefault(),a.run())},className:`group/layout pr-1`,children:[(0,P.jsx)(B,{count:t}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),n?(0,P.jsx)(x,{"aria-hidden":`true`,className:`size-3.5`}):null,a?(0,P.jsx)(`button`,{type:`button`,"aria-label":a.label,title:`${a.label} (Delete)`,className:`flex size-5 items-center justify-center rounded-sm text-muted-foreground opacity-0 group-hover/layout:opacity-100 group-focus/layout:opacity-100 hover:bg-background hover:text-foreground`,onPointerUp:e=>e.stopPropagation(),onClick:e=>{e.preventDefault(),e.stopPropagation(),a.run()},children:(0,P.jsx)(j,{"aria-hidden":`true`,className:`size-3.5`})}):null]})}function W({open:e,suggested:t,taken:n,onCommit:r,onCancel:a,returnFocus:f}){let[p,m]=(0,N.useState)(``);(0,N.useEffect)(()=>{e&&m(t)},[e,t]);let h=p.trim(),g=h!==``&&y(h);return(0,P.jsx)(s,{open:e,onOpenChange:e=>!e&&a(),children:(0,P.jsx)(d,{className:`sm:max-w-sm`,onCloseAutoFocus:e=>{e.preventDefault(),f()},children:(0,P.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),h!==``&&!g&&r(h)},children:[(0,P.jsxs)(c,{children:[(0,P.jsx)(o,{children:`Save layout`}),(0,P.jsx)(u,{children:`Saved layouts are offered in every task, in every project.`})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(M,{autoFocus:!0,"aria-label":`Layout name`,maxLength:_,value:p,onChange:e=>m(e.target.value),onFocus:e=>e.currentTarget.select()}),g?(0,P.jsx)(`p`,{className:`text-xs text-danger`,children:h===`Custom`?`“${b}” is the task's unsaved arrangement — pick another.`:`That name belongs to a view tab — pick another.`}):n.has(h)?(0,P.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Replaces the saved layout “`,h,`”.`]}):null]}),(0,P.jsxs)(l,{children:[(0,P.jsx)(i,{type:`button`,variant:`outline`,onClick:a,children:`Cancel`}),(0,P.jsx)(i,{type:`submit`,disabled:h===``||g,children:`Save`})]})]})})})}export{I as n,R as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n,t as r}from"./react-runtime-CCIEwYL0.js";var i=r(),a=e(t(),1),o=e(n(),1),s=null,{min:c,max:l,abs:u,floor:d}=Math,f=(e,t,n)=>c(n,l(t,e)),p=e=>[...e].sort((e,t)=>e-t),m=typeof queueMicrotask==`function`?queueMicrotask:e=>{Promise.resolve().then(e)},h=()=>{let e;return[new Promise(t=>{e=t}),e]},g=e=>{let t;return()=>(e&&=(t=e(),void 0),t)},_=(e,t,n)=>{let r=n?`unshift`:`push`;for(let n=0;n<t;n++)e[r](-1);return e},v=(e,t)=>{let n=e.t[t];return n===-1?e.o:n},y=(e,t,n)=>{let r=e.t[t]===-1;return e.t[t]=n,e.i=c(t,e.i),r},b=(e,t)=>{if(!e.l)return 0;if(e.i>=t)return e.u[t];e.i<0&&(e.u[0]=0,e.i=0);let n=e.i,r=e.u[n];for(;n<t;)r+=v(e,n),e.u[++n]=r;return e.i=t,r},x=(e,t,n=0,r=e.l-1)=>{let i=n;for(;n<=r;){let a=d((n+r)/2);b(e,a)<=t?(i=a,n=a+1):r=a-1}return f(i,0,e.l-1)},S=(e,t,n)=>{let r=t-e.l;return e.i=n?-1:c(t-1,e.i),e.l=t,r>0?(_(e.u,r),_(e.t,r,n),e.o*r):(e.u.splice(r),(n?e.t.splice(0,-r):e.t.splice(r)).reduce((t,n)=>t-(n===-1?e.o:n),0))},C=typeof window<`u`,w=e=>e.documentElement,T=e=>e.ownerDocument,E=e=>e.defaultView,D=g(()=>!!/iP(hone|od|ad)/.test(navigator.userAgent)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>0),O=g(()=>`scrollBehavior`in w(document).style),k=e=>l(e.h(),e.p()),A=(e,t=40,n=0,r,i=!1)=>{let a=!!n,o=1,d=0,f=0,m=0,h=0,g=0,C=0,w=0,T=0,E=s,O=[0,a?l(n-1,0):-1],k=0,A=!1,j=((e,t,n)=>({o:t,t:n?_(n.slice(0,c(e,n.length)),l(0,e-n.length)):_([],e),l:e,i:-1,u:_([],e+1)}))(e,r?r[1]:t,r&&r[0]),M=new Set,N=()=>m-f,P=()=>N()+g+h,F=(e,t)=>((e,t,n,r)=>{if(r=c(r,e.l-1),b(e,r)<=t){let i=x(e,n,r);return[x(e,t,r,i),i]}{let i=x(e,t,void 0,r);return[i,x(e,n,i)]}})(j,e,t,O[0]),I=()=>b(j,j.l),L=(e,t)=>{let n=b(j,e)-g;return t?I()-n-R(e):n},R=e=>v(j,e),z=(e,t=-1)=>j.t[e]===t,B=e=>{e&&(D()&&w!==0||E&&T===1?g+=e:h+=e)};return{v:()=>{M.clear()},m:()=>o,_:()=>(e=>[e.t.slice(),e.o])(j),S:(e=200)=>{if(!A||a)return O;let t,n;if(C)[t,n]=O;else{let r=l(0,P()),a=r+d;i||(e=l(0,e),w!==1&&(r-=e),w!==2&&(a+=e)),[t,n]=O=F(l(0,r),l(0,a)),E&&(t=c(t,E[0]),n=l(n,E[1]))}return[l(t,0),c(n,j.l-1)]},$:e=>x(j,e-f),I:z,k:L,R,T:()=>j.l,C:()=>m,M:()=>w!==0,p:()=>d,O:()=>f,h:I,H:()=>(C=h,h=0,[C,T===2]),W:(e,t)=>{let n=[e,t];return M.add(n),()=>{M.delete(n)}},B:(e,t)=>{let n,r,c=0;switch(e){case 1:{if(t===m&&T===0)break;let e=C;C=0;let n=t-m,i=u(n);e&&i<u(e)+1||T!==0||(w=n<0?2:1),a&&=!1,m=t,c=4;let o=N();o>=-d&&o<=I()&&(c+=1,r=i>d);break}case 2:c=8,w!==0&&(n=!0,c+=1),w=0,T=0,E=s;break;case 3:{let e=t.filter(([e,t])=>!z(e,t));if(!e.length)break;B(e.reduce((e,[t,n])=>{let r;if(T===2)r=!0;else if(E&&T===1)r=t<E[0];else{let e=N(),n=L(t),i=R(t);r=w!==1&&T===0?n+i<=e:n<e&&n+i<e+d}return r&&(e+=n-R(t)),e},0));for(let[t,n]of e){let e=R(t),r=y(j,t,n);i&&(k+=r?n:n-e)}i&&d&&k>d&&(B(((e,t)=>{let n=0,r=[];e.t.forEach((e,i)=>{e!==-1&&(r.push(e),i<t&&n++)}),e.i=-1;let i=p(r),a=i.length,o=a/2|0,s=a%2==0?(i[o-1]+i[o])/2:i[o],c=e.o;return((e.o=s)-c)*l(t-n,0)})(j,x(j,P()))),i=!1),c=3,r=!0;break}case 4:d!==t&&(d||(A=r=!0),d=t,c=3);break;case 5:t[1]?(B(S(j,t[0],!0)),T=2,c=1):(S(j,t[0]),c=1);break;case 6:f=t;break;case 7:T=1;break;case 8:E=F(t,t+d),c=1}c&&(o=1+(2147483647&o),n&&g&&(h+=g,g=0),M.forEach(([e,t])=>{c&e&&t(r)}))}}},j=setTimeout,M=(e,t)=>t?-e:e,N=(e,t,n,r,i,a)=>{let o=Date.now,c=0,l=!1,u=!1,d=!1,f=!1,p=(()=>{let t,n=()=>{t!=s&&clearTimeout(t)},r=()=>{n(),t=j(()=>{t=s,(()=>{if(l||u)return l=!1,void p();d=!1,e.B(2)})()},150)};return r.J=n,r})(),m=()=>{c=o(),d&&(f=!0),a&&e.B(6,a()),e.B(1,r()),p()},h=t=>{if(l||!e.M()||t.ctrlKey)return;let r=o()-c;150>r&&50<r&&(n?t.deltaX:t.deltaY)&&(l=!0)},g=()=>{u=!0,d=f=!1},_=()=>{u=!1,D()&&(d=!0)};return t.addEventListener(`scroll`,m),t.addEventListener(`wheel`,h,{passive:!0}),t.addEventListener(`touchstart`,g,{passive:!0}),t.addEventListener(`touchend`,_,{passive:!0}),{A:()=>{t.removeEventListener(`scroll`,m),t.removeEventListener(`wheel`,h),t.removeEventListener(`touchstart`,g),t.removeEventListener(`touchend`,_),p.J()},L:()=>{let[t,n]=e.H();t&&(i(t,n,f),f=!1,n&&e.p()>e.h()&&e.B(1,r()))}}},P=(e,t,n)=>{let r;return[async(i,a)=>{if(!await t())return;r&&r();let o=()=>{let[t,n]=h();return r=()=>{n(!1)},e.p()&&j(r,150),[t,e.W(2,()=>{n(!0)})]};if(a&&O())e.B(8,i()),m(async()=>{for(;;){let t=!0;for(let[n,r]=e.S();n<=r;n++)if(e.I(n)){t=!1;break}if(t)break;let[n,r]=o();try{if(!await n)return}finally{r()}}e.B(7),n(i(),a)});else for(;;){let[t,r]=o();try{if(e.B(7),n(i()),!await t)return}finally{r()}}},()=>{r&&r()}]},F=(e,t)=>{let n,r,i=h(),a=!1,o=t?`scrollLeft`:`scrollTop`,s=t?`overflowX`:`overflowY`,[c,l]=P(e,()=>i[0],(e,r)=>{e=M(e,a),r?n.scrollTo({[t?`left`:`top`]:e,behavior:`smooth`}):n[o]=e});return{N(c,u){n=u,t&&(a=getComputedStyle(u).direction===`rtl`),r=N(e,u,t,()=>M(u[o],a),(t,n,r)=>{if(r){let e=u.style,t=e[s];e[s]=`hidden`,j(()=>{e[s]=t})}u[o]=M(e.C()+t,a),n&&l()}),i[1](!0)},v(){r&&r.A(),i[1](!1),i=h()},P:()=>a,V(e){c(()=>e)},X(t){t+=e.C(),c(()=>t)},Y(t,{align:n,smooth:r,offset:i=0}={}){if(t=f(t,0,e.T()-1),n===`nearest`){let r=e.k(t),i=e.C();if(r<i)n=`start`;else{if(!(r+e.R(t)>i+e.p()))return;n=`end`}}c(()=>i+e.O()+e.k(t)+(n===`end`?e.R(t)-e.p():n===`center`?(e.R(t)-e.p())/2:0),r)},q:()=>{r&&r.L()}}},I=e=>{let t;return{j(n){(t||=new(E(T(n))).ResizeObserver(e)).observe(n)},D(e){t.unobserve(e)},A(){t&&t.disconnect()}}},L=(e,t)=>{let n,r=t?`width`:`height`,i=new WeakMap,a=I(t=>{let a=[];for(let{target:o,contentRect:c}of t)if(o.offsetParent)if(o===n)e.B(4,c[r]);else{let e=i.get(o);e!=s&&a.push([e,c[r]])}a.length&&e.B(3,a)});return{G(e){a.j(n=e)},U:(e,t)=>(i.set(e,t),a.j(e),()=>{i.delete(e),a.D(e)}),v:a.A}},R=C?a.useLayoutEffect:a.useEffect,z=`current`,B=(e,t)=>{if(Array.isArray(e))for(let n of e)B(n,t);else e==null||typeof e==`boolean`||t.push(e)},V=(e,t)=>e.key??`_`+t,H=e=>{let t=(0,a.useRef)(null);return t[z]||(t[z]=e())},U=e=>{let t=(0,a.useRef)(e);return R(()=>{t[z]=e},[e]),t},W=(0,a.memo)(({Z:e,ee:t,te:n,oe:r,ne:o,re:s,se:c,ie:l})=>{let u=(0,a.useRef)(null);R(()=>t(u[z],n),[n]);let d=(0,a.useMemo)(()=>{let e={contain:`layout style`,position:o&&l?void 0:`absolute`,[c?`height`:`width`]:`100%`,[c?`top`:`left`]:0,[c?`left`:`top`]:r,visibility:!o||l?void 0:`hidden`};return c&&(e.display=`inline-flex`),e},[r,o,l,c]);return(0,i.jsx)(s,typeof s==`string`?{ref:u,style:d,children:e}:{ref:u,style:d,index:n,children:e})}),G=(e,t)=>(0,a.useMemo)(()=>{if(typeof e==`function`)return[n=>e(t[n],n),t.length];let n=(e=>{let t=[];return B(e,t),t})(e);return[e=>n[e],n.length]},[e,t]),K=(0,a.forwardRef)(({children:e,data:t,bufferSize:n,itemSize:r,shift:s,horizontal:c,keepMounted:l,cache:u,startMargin:d=0,ssrCount:f,as:h=`div`,item:g=`div`,scrollRef:_,onScroll:v,onScrollEnd:y},b)=>{let[x,S]=G(e,t),C=(0,a.useRef)(null),w=(0,a.useRef)(!!f),T=U(v),E=U(y),[D,O,j,M]=H(()=>{let e=!!c,t=A(S,r,f,u,!r);return[t,L(t,e),F(t,e),e]});S!==D.T()&&D.B(5,[S,s]),d!==D.O()&&D.B(6,d);let[N,P]=(0,a.useReducer)(D.m,void 0,D.m),I=D.M(),B=D.h(),K=j.P(),q=[],J=e=>{let t=x(e);return(0,i.jsx)(W,{ee:O.U,te:e,oe:D.k(e,K),ne:D.I(e),re:g,Z:t,se:M,ie:w[z]},V(t,e))};if(R(()=>{w[z]=!1,D.W(1,e=>{e?(0,o.flushSync)(P):P()}),D.W(4,()=>{T[z]&&T[z](D.C())}),D.W(8,()=>{E[z]&&E[z]()});let e=C[z],t=t=>{O.G(t),j.N(e,t)};return _?m(()=>{_[z]&&t(_[z])}):t(e.parentElement),()=>{D.v(),O.v(),j.v()}},[]),R(()=>{j.q()},[N]),(0,a.useImperativeHandle)(b,()=>({get cache(){return D._()},get scrollOffset(){return D.C()},get scrollSize(){return k(D)},get viewportSize(){return D.p()},findItemIndex:D.$,getItemOffset:D.k,getItemSize:D.R,scrollToIndex:j.Y,scrollTo:j.V,scrollBy:j.X}),[]),l){let e=new Set(l);for(let[t,r]=D.S(n);t<=r;t++)e.add(t);p([...e]).forEach(e=>{q.push(J(e))})}else for(let[e,t]=D.S(n);e<=t;e++)q.push(J(e));return(0,i.jsx)(h,{ref:C,style:{contain:`size style`,overflowAnchor:`none`,flex:`none`,position:`relative`,width:M?B:`100%`,height:M?`100%`:B,pointerEvents:I?`none`:void 0},children:q})});export{K as t};
@@ -1 +0,0 @@
1
- import{F as e}from"./button-DFlig-3W.js";var t=e(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]);export{t};
@@ -1,4 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/html-BY76lXLH.js","assets/css-BsVw1vtW.js","assets/javascript-BgS3c2Ky.js","assets/core-BCsw8oQw.js","assets/lib-BxQXEXDF.js","assets/rolldown-runtime-QTnfLwEv.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{i as r}from"./bundle-mjs-BT31bpU6.js";import{a as i,c as a,i as o,n as s,o as c,r as l,s as u,t as d}from"./alert-dialog-BugYooRk.js";import{c as f,i as p,n as m}from"./chunk-BO2N2NFS-CFvlB0rH.js";var h=e(t(),1),g={name:`cezar-syn`,type:`dark`,fg:`var(--syn-var)`,bg:`transparent`,settings:[{scope:[`keyword`,`storage`,`constant.language`,`variable.language`,`entity.other.attribute-name`,`support.type.property-name`],settings:{foreground:`var(--syn-key)`}},{scope:[`string`,`punctuation.definition.string`],settings:{foreground:`var(--syn-str)`}},{scope:[`entity.name.function`,`support.function`,`entity.name.tag`,`entity.name.type`,`entity.name.class`,`support.class`,`support.type`],settings:{foreground:`var(--syn-fn)`}},{scope:[`comment`,`punctuation.definition.comment`],settings:{foreground:`var(--syn-com)`}},{scope:[`constant.numeric`,`constant.character`,`constant.other`,`support.constant`,`keyword.other.unit`],settings:{foreground:`var(--syn-num)`}},{scope:[`punctuation`,`keyword.operator`,`meta.brace`,`punctuation.separator`,`punctuation.terminator`],settings:{foreground:`var(--syn-punc)`}},{scope:[`variable`,`entity.name.variable`],settings:{foreground:`var(--syn-var)`}}]},_={typescript:()=>r(()=>import(`./typescript-bsJCZSQ-.js`),[]),tsx:()=>r(()=>import(`./tsx-udAQXfEw.js`),[]),javascript:()=>r(()=>import(`./javascript-BgS3c2Ky.js`),[]),jsx:()=>r(()=>import(`./jsx-Bz0zcwM4.js`),[]),json:()=>r(()=>import(`./json-qhed-kSA.js`),[]),jsonc:()=>r(()=>import(`./jsonc-CYpm1nAK.js`),[]),shellscript:()=>r(()=>import(`./shellscript-CLZ0U2zV.js`),[]),python:()=>r(()=>import(`./python-gzcpVVnB.js`),[]),markdown:()=>r(()=>import(`./markdown-BYOwaDjH.js`),[]),css:()=>r(()=>import(`./css-BsVw1vtW.js`),[]),html:()=>r(()=>import(`./html-BY76lXLH.js`),__vite__mapDeps([0,1,2])),diff:()=>r(()=>import(`./diff-woXpYk--.js`),[]),yaml:()=>r(()=>import(`./yaml-rwi0_p6S.js`),[]),toml:()=>r(()=>import(`./toml-CcmNWLt0.js`),[]),go:()=>r(()=>import(`./go-rLFTqkRN.js`),[]),rust:()=>r(()=>import(`./rust-Cfkwpbl8.js`),[]),sql:()=>r(()=>import(`./sql-BsFa4tDR.js`),[])},v={ts:`typescript`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,bash:`shellscript`,sh:`shellscript`,shell:`shellscript`,zsh:`shellscript`,console:`shellscript`,py:`python`,md:`markdown`,yml:`yaml`,golang:`go`,rs:`rust`,vue:`html`,xml:`html`},y=new Set([``,`plaintext`,`text`,`txt`,`plain`]);function b(e){let t=e.trim().toLowerCase();return t in _?t:v[t]??null}function x(e){return y.has(e.trim().toLowerCase())}function S(){return[...Object.keys(_),...Object.keys(v),...y].filter(e=>e!==``)}function C(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);if(n<=0)return null;let r=t.slice(n+1).toLowerCase();return b({mts:`typescript`,cts:`typescript`,htm:`html`}[r]??r)}var w=null,T=null,E=new Set,D=new Map;function O(){return T??=Promise.all([r(()=>import(`./core-BCsw8oQw.js`),__vite__mapDeps([3,4,5])),r(()=>import(`./engine-javascript-FQvzRocB.js`),[])]).then(async([{createHighlighterCore:e},{createJavaScriptRegexEngine:t}])=>(w=await e({themes:[g],langs:[],engine:t({forgiving:!0})}),w)),T}function k(e){let t=b(e);if(t===null||E.has(t))return Promise.resolve();let n=D.get(t);return n||(n=O().then(async e=>{await e.loadLanguage(await _[t]()),E.add(t)}).catch(()=>{D.delete(t)}),D.set(t,n)),n}function A(e){return{tokens:e.split(`
3
- `).map(e=>[{content:e}]),fg:`var(--syn-var)`,bg:`transparent`}}function j(e,t,n={}){if(x(t))return A(e);let r=b(t);if(r===null)return A(e);if(!w||!E.has(r))return null;try{let t=w.codeToTokens(e,{lang:r,theme:g.name,tokenizeTimeLimit:n.tokenizeTimeLimit});return{tokens:t.tokens.map(e=>e.map(({content:e,color:t})=>({content:e,color:t}))),fg:t.fg??`var(--syn-var)`,bg:`transparent`}}catch{return A(e)}}async function M(e,t,n={}){return j(e,t,n)||(await k(t),j(e,t,n)??A(e))}var N=n();function P({isOpen:e,onClose:t,onConfirm:n,url:r}){return(0,N.jsx)(d,{open:e,onOpenChange:e=>{e||t()},children:(0,N.jsxs)(o,{"data-slot":`link-safety-dialog`,children:[(0,N.jsxs)(u,{children:[(0,N.jsx)(a,{children:`Open this link?`}),(0,N.jsxs)(i,{children:[`It leaves cezar in a new tab. The words of a link in a transcript are the agent's — the address below is where it actually goes.`,(0,N.jsx)(`span`,{"data-slot":`link-safety-url`,className:`mt-3 block wrap-anywhere rounded-md border border-border bg-muted px-3 py-2 font-mono text-xs text-foreground`,children:r})]})]}),(0,N.jsxs)(c,{children:[(0,N.jsx)(l,{children:`Cancel`}),(0,N.jsx)(s,{onClick:n,children:`Open link`})]})]})})}var F={name:`shiki`,type:`code-highlighter`,getThemes:()=>[g,g],getSupportedLanguages:()=>S(),supportsLanguage:e=>S().includes(String(e).toLowerCase()),highlight:({code:e,language:t},n)=>j(e,String(t))||(M(e,String(t)).then(e=>n?.(e)),null)};function I(){let e=t=>{if(!t.children)return;let n=[];for(let r of t.children)if(r.type===`text`&&r.value?.includes(`
4
- `)){let e=r.value.split(/\r?\n/);e.forEach((t,r)=>{r>0&&!(t===``&&r===e.length-1)&&n.push({type:`break`}),t&&n.push({type:`text`,value:t})})}else e(r),n.push(r);t.children=n};return e}var L=[...Object.values(m),I],R=[`p`,`strong`,`em`,`del`,`code`,`a`],z={p:`span`,a:`span`},B=`cezar-local-only:`;function V(e){let t=e.trim();return t.startsWith(B)||/^file:/i.test(t)||/^[A-Za-z]:[\\/]/.test(t)||/^\\\\/.test(t)?!0:/^\/(?:tmp|Users|home|var|etc|opt|root|mnt|Volumes|private|bin|boot|dev|lib|proc|run|sbin|sys|usr)(?:\/|$)/i.test(t)}function H(){let e=t=>{let n=t.properties?.href;t.tagName===`a`&&typeof n==`string`&&n.length>0&&!/^(?:[a-z][a-z\d+.-]*:|[/#?])/i.test(n)&&(t.tagName=`span`,t.properties={"data-local-only-link":``,title:`Local file: ${n}. Open it from the task's Files tab.`}),t.children?.forEach(e)};return e}var U=Object.entries(f).flatMap(([e,t])=>e===`harden`?[H,t]:[t]);function W({href:e,children:t,className:n,...r}){let[i,a]=(0,h.useState)(!1);return!e||V(e)?(0,N.jsx)(`span`,{...r,"data-local-only-link":V(e??``)?``:void 0,title:V(e??``)?`This is a local filesystem path and cannot be opened here.`:void 0,className:n,children:t}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`a`,{...r,href:e,className:n,"data-streamdown":`link`,onClick:e=>{e.preventDefault(),a(!0)},children:t}),(0,N.jsx)(P,{isOpen:i,onClose:()=>a(!1),onConfirm:()=>window.open(e,`_blank`,`noreferrer`),url:e})]})}var G={a:W},K=e=>V(e)?`${B}${e}`:e,q={enabled:!0,renderModal:e=>(0,N.jsx)(P,{...e})},J=(0,h.memo)(function({children:e,breaks:t=!1,inline:n=!1,variant:r=`chat`,urlTransform:i}){return(0,N.jsx)(p,{className:n?`thread-markdown thread-markdown-inline`:r===`document`?`thread-markdown markdown-document`:`thread-markdown`,plugins:{code:F},shikiTheme:[g,g],remarkPlugins:t?L:void 0,rehypePlugins:i?void 0:U,allowedElements:n?R:void 0,unwrapDisallowed:n||void 0,components:n?z:G,urlTransform:K,linkSafety:q,...i?{urlTransform:i}:{},controls:{code:{copy:!0,download:!1},table:!1,mermaid:!1},lineNumbers:!1,children:e})});export{j as a,M as i,b as n,C as o,k as r,J as t};
@@ -1 +0,0 @@
1
- import{s as e}from"./chunk-BO2N2NFS-CFvlB0rH.js";export{e as Mermaid};
@@ -1 +0,0 @@
1
- import{F as e}from"./button-DFlig-3W.js";var t=e(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]);export{t};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{B as r,Ct as i,Dt as a,I as o,Jt as s,L as c,R as l,Rt as u,St as d,U as f,V as p,Vt as m,W as ee,jt as h,qt as te,xt as g,z as _,zt as ne}from"./button-DFlig-3W.js";var v=/^[\w!#$%&'*.^`|~+-]+$/,re=(e,t,n={})=>{if(!v.test(e))throw Error(`Invalid cookie name`);let r=`${e}=${t}`;if(e.startsWith(`__Secure-`)&&!n.secure)throw Error(`__Secure- Cookie must have Secure attributes`);if(e.startsWith(`__Host-`)){if(!n.secure)throw Error(`__Host- Cookie must have Secure attributes`);if(n.path!==`/`)throw Error(`__Host- Cookie must have Path attributes with "/"`);if(n.domain)throw Error(`__Host- Cookie must not have Domain attributes`)}for(let e of[`domain`,`path`,`sameSite`,`priority`])if(n[e]&&/[;\r\n]/.test(n[e]))throw Error(`${e} must not contain ";", "\\r", or "\\n"`);if(n&&typeof n.maxAge==`number`&&n.maxAge>=0){if(n.maxAge>3456e4)throw Error(`Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.`);r+=`; Max-Age=${n.maxAge|0}`}if(n.domain&&n.prefix!==`host`&&(r+=`; Domain=${n.domain}`),n.path&&(r+=`; Path=${n.path}`),n.expires){if(n.expires.getTime()-Date.now()>3456e7)throw Error(`Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.`);r+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(r+=`; HttpOnly`),n.secure&&(r+=`; Secure`),n.sameSite&&(r+=`; SameSite=${n.sameSite.charAt(0).toUpperCase()+n.sameSite.slice(1)}`),n.priority&&(r+=`; Priority=${n.priority.charAt(0).toUpperCase()+n.priority.slice(1)}`),n.partitioned){if(!n.secure)throw Error(`Partitioned Cookie must have Secure attributes`);r+=`; Partitioned`}return r},ie=(e,t,n)=>(t=encodeURIComponent(t),re(e,t,n)),ae=(e,t)=>(e=e.replace(/\/+$/,``),e+=`/`,t=t.replace(/^\/+/,``),e+t),oe=(e,t)=>{for(let[n,r]of Object.entries(t)){let t=RegExp(`/:`+n+`(?:{[^/]+})?\\??`);e=e.replace(t,r?`/${r}`:``)}return e},se=e=>{let t=new URLSearchParams;for(let[n,r]of Object.entries(e))if(r!==void 0)if(Array.isArray(r))for(let e of r)t.append(n,e);else t.set(n,r);return t},ce=(e,t)=>{switch(t){case`ws`:return e.replace(/^http/,`ws`);case`http`:return e.replace(/^ws/,`http`)}},le=e=>/^https?:\/\/[^\/]+?\/index(?=\?|$)/.test(e)?e.replace(/\/index(?=\?|$)/,`/`):e.replace(/\/index(?=\?|$)/,``);function ue(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function de(e,t){if(!ue(e)&&!ue(t))return t;let n={...e};for(let e in t){let r=t[e];ue(n[e])&&ue(r)?n[e]=de(n[e],r):n[e]=r}return n}var fe=(e,t)=>new Proxy(()=>{},{get(n,r){if(!(typeof r!=`string`||r===`then`))return fe(e,[...t,r])},apply(n,r,i){return e({path:t,args:i})}}),pe=class{url;method;buildSearchParams;queryParams=void 0;pathParams={};rBody;cType=void 0;constructor(e,t,n){this.url=e,this.method=t,this.buildSearchParams=n.buildSearchParams}fetch=async(e,t)=>{if(e){if(e.query&&(this.queryParams=this.buildSearchParams(e.query)),e.form){let t=new FormData;for(let[n,r]of Object.entries(e.form))if(r!==void 0)if(Array.isArray(r))for(let e of r)t.append(n,e);else t.append(n,r);this.rBody=t}e.json&&(this.rBody=JSON.stringify(e.json),this.cType=`application/json`),e.param&&(this.pathParams=e.param)}let n=this.method.toUpperCase(),r={...e?.header,...typeof t?.headers==`function`?await t.headers():t?.headers};if(e?.cookie){let t=[];for(let[n,r]of Object.entries(e.cookie))t.push(ie(n,r,{path:`/`}));r.Cookie=t.join(`,`)}this.cType&&(r[`Content-Type`]=this.cType);let i=new Headers(r??void 0),a=this.url;a=le(a),a=oe(a,this.pathParams),this.queryParams&&(a=a+`?`+this.queryParams.toString()),n=this.method.toUpperCase();let o=!(n===`GET`||n===`HEAD`);return(t?.fetch||fetch)(a,{body:o?this.rBody:void 0,method:n,headers:i,...t?.init})}},me=(e,t)=>fe(function n(r){let i=t?.buildSearchParams??se,a=[...r.path],o=a.slice(-3).reverse();if(o[0]===`toString`)return o[1]===`name`?o[2]||``:n.toString();if(o[0]===`valueOf`)return o[1]===`name`?o[2]||``:n;let s=``;if(/^\$/.test(o[0])){let e=a.pop();e&&(s=e.replace(/^\$/,``))}let c=ae(e,a.join(`/`));if(s===`url`||s===`path`){let t=c;return r.args[0]&&(r.args[0].param&&(t=oe(c,r.args[0].param)),r.args[0].query&&(t=t+`?`+i(r.args[0].query).toString())),t=le(t),s===`url`?new URL(t):t.slice(e.replace(/\/+$/,``).length).replace(/^\/?/,`/`)}if(s===`ws`){let e=ce(r.args[0]&&r.args[0].param?oe(c,r.args[0].param):c,`ws`),n=new URL(e),i=r.args[0]?.query;return i&&Object.entries(i).forEach(([e,t])=>{Array.isArray(t)?t.forEach(t=>n.searchParams.append(e,t)):n.searchParams.set(e,t)}),((...e)=>t?.webSocket!==void 0&&typeof t.webSocket==`function`?t.webSocket(...e):new WebSocket(...e))(n.toString())}let l=new pe(c,s,{buildSearchParams:i});if(s){t??={};let e={...r.args[1]},n=t.headers,i=e.headers;n&&i&&(e.headers=async()=>({...typeof n==`function`?await n():n,...typeof i==`function`?await i():i}));let a=de(t,e);return l.fetch(r.args[0],a)}return l},[]);function he(e={}){let{baseUrl:t=``,token:n,headers:r,fetch:i}=e;return me(t,{headers:{...n?{Authorization:`Bearer ${n}`}:{},...r},...i?{fetch:i}:{}})}var y=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ge=new class extends y{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},_e={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},b=new class{#e=_e;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function ve(e){setTimeout(e,0)}var ye=typeof window>`u`||`Deno`in globalThis;function x(){}function be(e,t){return typeof e==`function`?e(t):e}function xe(e){return typeof e==`number`&&e>=0&&e!==1/0}function Se(e,t){return Math.max(e+(t||0)-Date.now(),0)}function S(e,t){return typeof e==`function`?e(t):e}function C(e,t){return typeof e==`function`?e(t):e}function Ce(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==Te(o,t.options))return!1}else if(!Ee(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function we(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(w(t.options.mutationKey)!==w(a))return!1}else if(!Ee(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Te(e,t){return(t?.queryKeyHashFn||w)(e)}function w(e){return JSON.stringify(e,(e,t)=>Ae(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Ee(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>Ee(e[n],t[n])):!1}var De=Object.prototype.hasOwnProperty;function Oe(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=ke(e)&&ke(t);if(!r&&!(Ae(e)&&Ae(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:De.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=Oe(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function T(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function ke(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Ae(e){if(!je(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!je(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function je(e){return Object.prototype.toString.call(e)===`[object Object]`}function Me(e){return new Promise(t=>{b.setTimeout(t,e)})}function Ne(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:Oe(e,t)}function Pe(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Fe(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Ie=Symbol();function Le(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Ie?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Re(e,t){return typeof e==`function`?e(...t):!!e}function ze(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var E=(()=>{let e=()=>ye;return{isServer(){return e()},setIsServer(t){e=t}}})();function Be(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var Ve=ve;function He(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Ve,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var D=He(),Ue=new class extends y{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function We(e){return Math.min(1e3*2**e,3e4)}function Ge(e){return(e??`online`)!==`online`||Ue.isOnline()}var Ke=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function qe(e){let t=!1,n=0,r,i=Be(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new Ke(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>ge.isFocused()&&(e.networkMode===`always`||Ue.isOnline())&&e.canRun(),u=()=>Ge(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(E.isServer()?0:3),o=e.retryDelay??We,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),Me(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var Je=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),xe(this.gcTime)&&(this.#e=b.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(E.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(b.clearTimeout(this.#e),this.#e=void 0)}};function Ye(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{ze(e,()=>t.signal,()=>n=!0)},u=Le(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?Fe:Pe;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?Ze:Xe,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Xe(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function Xe(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Ze(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Qe(e,t){return t?Xe(e,t)!=null:!1}function $e(e,t){return!t||!e.getPreviousPageParam?!1:Ze(e,t)!=null}var et=class extends Je{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=rt(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=rt(this.options);e.data!==void 0&&(this.setState(nt(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Ne(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(x).catch(x):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>C(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ie||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>S(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!Se(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=Le(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?Ye(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=qe({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Ke&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Ke){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...tt(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...nt(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),D.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function tt(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ge(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function nt(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function rt(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var O=class extends y{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=Be(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),at(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ot(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ot(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof C(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!T(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&st(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||C(this.options.enabled,this.#t)!==C(t.enabled,this.#t)||S(this.options.staleTime,this.#t)!==S(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||C(this.options.enabled,this.#t)!==C(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return lt(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(x)),t}#g(){this.#b();let e=S(this.options.staleTime,this.#t);if(E.isServer()||this.#r.isStale||!xe(e))return;let t=Se(this.#r.dataUpdatedAt,e)+1;this.#d=b.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(E.isServer()||C(this.options.enabled,this.#t)===!1||!xe(this.#p)||this.#p===0)&&(this.#f=b.setInterval(()=>{(this.options.refetchIntervalInBackground||ge.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(b.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(b.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&at(e,t),o=i&&st(e,n,t,r);(a||o)&&(l={...l,...tt(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let ee=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,ee=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=Ne(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!ee)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=Ne(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let h=l.fetchStatus===`fetching`,te=m===`pending`,g=m===`error`,_=te&&h,ne=d!==void 0,v={status:m,fetchStatus:l.fetchStatus,isPending:te,isSuccess:m===`success`,isError:g,isInitialLoading:_,isLoading:_,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:h,isRefetching:h&&!te,isLoadingError:g&&!ne,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:g&&ne,isStale:ct(e,t),refetch:this.refetch,promise:this.#o,isEnabled:C(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=v.data!==void 0,r=v.status===`error`&&!t,i=e=>{r?e.reject(v.error):t&&e.resolve(v.data)},a=()=>{let e=this.#o=v.promise=Be();i(e)},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||v.data!==o.value)&&a();break;case`rejected`:(!r||v.error!==o.reason)&&a();break}}return v}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!T(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){D.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function it(e,t){return C(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&C(t.retryOnMount,e)===!1)}function at(e,t){return it(e,t)||e.state.data!==void 0&&ot(e,t,t.refetchOnMount)}function ot(e,t,n){if(C(t.enabled,e)!==!1&&S(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&ct(e,t)}return!1}function st(e,t,n,r){return(e!==t||C(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&ct(e,n)}function ct(e,t){return C(t.enabled,e)!==!1&&e.isStaleByTime(S(t.staleTime,e))}function lt(e,t){return!T(e.getCurrentResult(),t)}var ut=class extends O{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Qe(t,n.data),hasPreviousPage:$e(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},dt=class extends Je{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||ft(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=qe({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),D.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function ft(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var pt=class extends y{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),T(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&w(t.mutationKey)!==w(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??ft();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){D.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}};function mt(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function ht(e,t,n){let r=e.slice(0);return r[t]=n,r}var gt=class extends y{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,D.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!T(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(mt(e,n).forEach(e=>{e.destroy()}),mt(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=Oe(this.#a,t(e))),this.#a}return e}#f(){return this.#r?.combine!==void 0&&this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new O(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=ht(this.#t,n,t),this.#h())}#h(){if(this.hasListeners()){let e=this.#u(this.#t,this.#l),t=this.#f(),n=this.#a,r=t?n:this.#d(e,this.#r?.combine);(t||n!==r)&&D.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},k=e(t(),1),_t=n(),vt=k.createContext(void 0),A=e=>{let t=k.useContext(vt);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},yt=({client:e,children:t})=>(k.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,_t.jsx)(vt.Provider,{value:e,children:t})),bt=k.createContext(!1),xt=()=>k.useContext(bt);bt.Provider;function St(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Ct=k.createContext(St()),wt=()=>k.useContext(Ct),Tt=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?Re(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Et=e=>{k.useEffect(()=>{e.clearReset()},[e])},Dt=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Re(n,[e.error,r])),Ot=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},kt=(e,t)=>e.isLoading&&e.isFetching&&!t,At=(e,t)=>e?.suspense&&t.isPending,jt=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Mt({queries:e,...t},n){let r=A(n),i=xt(),a=wt(),o=k.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{Ot(e);let t=r.getQueryCache().get(e.queryHash);Tt(e,a,t)}),Et(a);let[s]=k.useState(()=>new gt(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;k.useSyncExternalStore(k.useCallback(e=>d?s.subscribe(D.batchCalls(e)):x,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),k.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>At(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&At(n,e)?jt(n,new O(r,n),a):[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&&Dt({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(p?.error)throw p.error;return l(u())}function Nt(e,t,n){let r=xt(),i=wt(),a=A(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Ot(o),Tt(o,i,s),Et(i);let l=!a.getQueryCache().get(o.queryHash),[u]=k.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&c;if(k.useSyncExternalStore(k.useCallback(e=>{let t=f?u.subscribe(D.batchCalls(e)):x;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),k.useEffect(()=>{u.setOptions(o)},[o,u]),At(o,d))throw jt(o,u,i);if(Dt({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!E.isServer()&&kt(d,r)&&(l?jt(o,u,i):s?.promise)?.catch(x).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function j(e,t){return Nt(e,O,t)}function M(e,t){let n=A(t),[r]=k.useState(()=>new pt(n,e));k.useEffect(()=>{r.setOptions(e)},[r,e]);let i=k.useSyncExternalStore(k.useCallback(e=>r.subscribe(D.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=k.useCallback((e,t)=>{r.mutate(e,t).catch(x)},[r]);if(i.error&&Re(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function N(e,t){return Nt(e,ut,t)}var Pt={projectId:null,apiBase:o},Ft=(0,k.createContext)(Pt);function It(){return(0,k.useContext)(Ft)}function Lt({projectId:e,children:t}){_()!==e&&f(e),(0,k.useLayoutEffect)(()=>{f(e)},[e]),(0,k.useLayoutEffect)(()=>()=>f(null),[]);let n=(0,k.useMemo)(()=>e===null?Pt:{projectId:e,apiBase:`${o}/p/${encodeURIComponent(e)}`},[e]);return(0,_t.jsx)(Ft.Provider,{value:n,children:t})}var P=[`claude`,`codex`,`junie`,`opencode`,`cursor`,`pi`,`copilot`],Rt=new Set([`connected`,`disconnected`,`not-installed`,`unknown`]);function zt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Bt(e,t){if(!zt(e))return null;let{provider:n,status:r,enabled:i,hint:a,authFailureId:o}=e;return typeof n!=`string`||!P.includes(n)||typeof r!=`string`||!Rt.has(r)||t&&typeof i!=`boolean`||!t&&i!==void 0&&typeof i!=`boolean`||a!==void 0&&typeof a!=`string`||o!==void 0&&(typeof o!=`string`||o.length<1||o.length>128||r!==`disconnected`)?null:{provider:n,status:r,...typeof i==`boolean`?{enabled:i}:{},...a===void 0?{}:{hint:a},...o===void 0?{}:{authFailureId:o}}}function Vt(e){return Bt(e,!1)}function Ht(e,t){if(!zt(e)||!Array.isArray(e.providers))return null;let n=[],r=new Set;for(let i of e.providers){let e=Bt(i,t);if(e===null||r.has(e.provider))return null;r.add(e.provider),n.push(e)}return n}function F(e){let t=Ht(e,!0);if(t===null||t.length===0)return null;let n=new Map(t.map(e=>[e.provider,e]));return P.flatMap(e=>{let t=n.get(e);return t?[t]:[]})}function Ut(e){let t=F(e);if(t===null)throw Error(`Invalid provider status response`);return{providers:t}}function Wt(e,t){let n=F(e);if(n!==null)return{providers:n.map(e=>e.provider===t.provider?{provider:t.provider,status:t.status,enabled:t.enabled??e.enabled,...t.hint===void 0?{}:{hint:t.hint},...t.authFailureId===void 0?{}:{authFailureId:t.authFailureId}}:e)}}function Gt(e,t,n,r){let i=F(e),a=F(t),o=F(n);if(o===null||a===null)return n;if(i===null)return{providers:a};let s=new Map(i.map(e=>[e.provider,e])),c=new Map(a.map(e=>[e.provider,e]));return{providers:o.map(e=>{let t=s.get(e.provider),n=c.get(e.provider);if(t===void 0||n===void 0)return n??e;let i=r!==void 0&&n.authFailureId===r&&e.authFailureId===void 0;return r!==void 0&&n.authFailureId!==void 0&&n.authFailureId!==r&&e.authFailureId===void 0?n:Kt(t,n)?e:i?{...e,enabled:n.enabled}:n})}}function Kt(e,t){return e.provider===t.provider&&e.status===t.status&&e.enabled===t.enabled&&e.hint===t.hint&&e.authFailureId===t.authFailureId}function qt(e){let t=F(e);if(t===null)return[];let n=new Set(t.filter(e=>e.enabled&&(e.status===`connected`||e.provider===`junie`&&e.status===`unknown`)).map(e=>e.provider));return P.filter(e=>n.has(e))}function Jt(e,t){return F(e)?.find(e=>e.provider===t)}var Yt=`cezar:sid`,Xt;function Zt(e=Date.now()){let t=crypto.getRandomValues(new Uint8Array(16));for(let n=0;n<6;n++)t[n]=Math.floor(e/2**(8*(5-n)))&255;t[6]=t[6]&15|112,t[8]=t[8]&63|128;let n=[...t].map(e=>e.toString(16).padStart(2,`0`)).join(``);return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}function Qt(){try{let e=localStorage.getItem(Yt);if(e)return e;let t=Zt();return localStorage.setItem(Yt,t),t}catch{return Xt??=Zt()}}var $t=`x-cezar-sid`;function en(){Xt=void 0;try{localStorage.removeItem(Yt)}catch{}}function tn(e){if(typeof e!=`object`||!e)return;let{name:t,message:n}=e;return{name:typeof t==`string`?t:`unknown`,message:typeof n==`string`?n:``}}var nn=/\/(?:providers|agent-profiles)(?:\/|$)/;function rn(e,t){if(!nn.test(e))return;let n=e.split(`/`),r=n[n.indexOf(`providers`)+1];if(n.includes(`providers`)&&g.safeParse(r).success)return r;if(typeof t==`string`)try{let e=JSON.parse(t).provider;return g.safeParse(e).success?e:void 0}catch{return}}var an=null;function on(e,t,n,r,i){try{let a=new URL(e,window.location.origin).pathname,o=rn(a,r),s=tn(i);an={method:(t??`GET`).toUpperCase(),path:a,status:n,at:Date.now(),...o?{provider:o}:{},...s?{cause:s}:{}}}catch{}}function sn(e=3e3,t=Date.now()){return an&&t-an.at<=e?an:null}var I=class extends Error{status;manual;command;runIds;exists;constructor(e,t,n={}){super(t,n.cause===void 0?void 0:{cause:n.cause}),this.name=`ApiError`,this.status=e,this.manual=n.manual,this.command=n.command,this.exists=n.exists,this.runIds=n.runIds}};function L(e){try{return JSON.parse(e)}catch{return}}function cn(e){return typeof e==`string`?e:void 0}function R(e,t,n){let r=L(n),i=r&&typeof r==`object`?r:{},a=cn(i.error)??`${e} ${t||`request failed`}`.trim(),o=e===409?ee.safeParse(r):void 0;return new I(e,a,{...o?.success?{runIds:o.data.runIds}:{},manual:cn(i.manual),command:cn(i.command),exists:typeof i.exists==`boolean`?i.exists:void 0})}var z=he({fetch:(e,t)=>pn(ln(String(e)),t)});function ln(e){let t=dn(e.endsWith(`?`)?e.slice(0,-1):e);return t.startsWith(`/`)?`${l()}${t}`:t}var un=`${o}/p/default`;function dn(e){if(_()!==null||!e.startsWith(un))return e;let t=e.slice(un.length);return t===``||t.startsWith(`/`)||t.startsWith(`?`)?`${o}${t}`:e}var B=e=>({init:{signal:e?.signal}});async function V(e,t){let n=await e.text();if(!e.ok)throw R(e.status,e.statusText,n);let r=L(n);if(r===void 0)throw new I(e.status,`the cezar server answered ${t} with a non-JSON body`);return r}async function fn(e,t,n){let r=e.status,i=await V(e,t),a=n.safeParse(i);if(!a.success)throw new I(r,`the cezar server answered ${t} with an unexpected body`);return a.data}async function pn(e,t){try{let n=new Headers(t?.headers);n.set($t,Qt());let r=await fetch(e,{...t,headers:n,credentials:`include`});return r.ok||on(e,t?.method,r.status,t?.body),r}catch(n){throw n instanceof DOMException&&n.name===`AbortError`?n:(on(e,t?.method,0,t?.body,n),new I(0,`cannot reach the cezar server (${e})`,{cause:n}))}}async function H(e,t){return pn(c(e),t)}async function mn(e,t={}){let n=new Headers(t.headers);n.set(`accept`,`text/plain`);let r=await H(e,{...t,headers:n}),i=await r.text();if(!r.ok)throw R(r.status,r.statusText,i);return i}var U=(e,t=``)=>`/runs/${encodeURIComponent(e)}${t}`;async function hn(e){return V(await z.api.v1.health.$get({},B(e)),`/health`)}async function gn(e){return V(await z.api.v1[`star-count`].$get({},B(e)),`/star-count`)}async function _n(e){return V(await z.api.v1.preview[`design-proxy`].$post({json:e}),`/preview/design-proxy`)}async function vn(e){return V(await z.api.v1.telemetry.consent.$get({},B(e)),`/telemetry/consent`)}async function yn(e){return V(await z.api.v1.telemetry.consent.$put({json:e}),`/telemetry/consent`)}async function bn(e,t){return V(await z.api.v1.models.$get({query:{runner:e}},B(t)),`/models`)}async function xn(e=!1,t){return Ut(await V(await z.api.v1.providers.status.$get({query:e?{refresh:`1`}:{}},B(t)),`/providers/status`))}async function Sn(e){return V(await z.api.v1.p[`:projectId`][`launch-key`].$get({param:{projectId:r()}},B(e)),`/launch-key`)}async function Cn(e){return V(await z.api.v1.projects.$get({},B(e)),`/projects`)}async function wn(e,t){return V(await z.api.v1.fs.browse.$get({query:{path:e===``?void 0:e,...t?.showHidden?{showHidden:`1`}:{}}},B(t)),`/fs/browse`)}async function Tn(e){return V(await z.api.v1.p[`:projectId`].runs.$get({param:{projectId:r()}},B(e)),`/runs`)}async function En(e,t){return V(await z.api.v1.p[`:projectId`].runs.$get({param:{projectId:e}},B(t)),`/runs`)}async function Dn(e){return V(await z.api.v1.workspace[`runs-index`].$get({},B(e)),`/workspace/runs-index`)}async function On(e,t){return V(await z.api.v1.p[`:projectId`].runs[`:id`].$get({param:{projectId:r(),id:encodeURIComponent(e)}},B(t)),U(e))}async function kn(e,t,n){return V(await z.api.v1.p[`:projectId`].runs[`:id`].$get({param:{projectId:e,id:encodeURIComponent(t)}},B(n)),U(t))}async function An(e,t,n){return fn(await z.api.v1.p[`:projectId`].runs[`:id`].history.$get({param:{projectId:r(),id:encodeURIComponent(e)},query:{...t===void 0?{}:{cursor:t}}},B(n)),`${U(e)}/history`,s)}async function jn(e,t){return fn(await z.api.v1.p[`:projectId`].runs[`:id`][`history-context`].$get({param:{projectId:r(),id:encodeURIComponent(e)}},B(t)),`${U(e)}/history-context`,te)}async function Mn(e){return V(await z.api.v1.p[`:projectId`][`ui-state`].$get({param:{projectId:r()}},B(e)),`/ui-state`)}async function Nn(e){return V(await z.api.v1.p[`:projectId`].workflows.$get({param:{projectId:r()}},B(e)),`/workflows`)}async function Pn(e){return V(await z.api.v1.p[`:projectId`].skills.$get({param:{projectId:r()},query:{}},B(e)),`/skills`)}async function Fn(e){return V(await z.api.v1.p[`:projectId`].skills.$get({param:{projectId:r()},query:{wait:`1`}},B(e)),`/skills`)}async function In(){return V(await z.api.v1.p[`:projectId`].skills.refresh.$post({param:{projectId:r()}}),`/skills/refresh`)}async function Ln(e){return V(await z.api.v1.p[`:projectId`].skills.importable.$get({param:{projectId:r()},query:{}},B(e)),`/skills/importable`)}async function Rn(e){return V(await z.api.v1.p[`:projectId`].skills.importable.$get({param:{projectId:r()},query:{wait:`1`}},B(e)),`/skills/importable`)}async function zn(e){return V(await z.api.v1.p[`:projectId`].todos.$get({param:{projectId:r()}},B(e)),`/todos`)}async function Bn(e){return V(await z.api.v1.p[`:projectId`].repo.$get({param:{projectId:r()}},B(e)),`/repo`)}async function Vn(e){return V(await z.api.v1.p[`:projectId`].config.$get({param:{projectId:r()}},B(e)),`/config`)}async function Hn(e={}){return V(await z.api.v1.p[`:projectId`][`agent-config`].$get({param:{projectId:r()}},B(e)),`/agent-config`)}async function Un(e,t={}){return V(await z.api.v1.p[`:projectId`][`agent-config`][`:id`].$get({param:{projectId:r(),id:encodeURIComponent(e)}},B(t)),`/agent-config/${encodeURIComponent(e)}`)}async function Wn(e,t){return V(await z.api.v1.p[`:projectId`][`agent-config`][`:id`].$put({param:{projectId:r(),id:encodeURIComponent(e)},json:t}),`/agent-config/${encodeURIComponent(e)}`)}async function Gn(e){return V(await z.api.v1.p[`:projectId`].repo.changes.$get({param:{projectId:r()}},B(e)),`/repo/changes`)}async function Kn(e){return V(await z.api.v1.p[`:projectId`].repo.tree.$get({param:{projectId:r()}},B(e)),`/repo/tree`)}async function qn(e,t){return V(await z.api.v1.p[`:projectId`].repo.files.$get({param:{projectId:r()},query:{path:e}},B(t)),`/repo/files`)}function Jn(e){return c(`/repo/files?path=${encodeURIComponent(e)}&raw=1`)}async function Yn(e,t){return V(await z.api.v1.p[`:projectId`].repo.commit[`:sha`].$get({param:{projectId:r(),sha:encodeURIComponent(e)},query:{structured:`1`}},B(t)),`/repo/commit/:sha`)}async function Xn(e,t){return V(await z.api.v1.p[`:projectId`].runs[`:id`].tree.$get({param:{projectId:r(),id:encodeURIComponent(e)}},B(t)),U(e,`/tree`))}async function Zn(e,t){return V(await z.api.v1.p[`:projectId`].runs[`:id`].commits.$get({param:{projectId:r(),id:encodeURIComponent(e)}},B(t)),U(e,`/commits`))}async function Qn(e,t,n){return V(await z.api.v1.p[`:projectId`].runs[`:id`].commit[`:sha`].$get({param:{projectId:r(),id:encodeURIComponent(e),sha:encodeURIComponent(t)}},B(n)),U(e,`/commit/${encodeURIComponent(t)}`))}async function $n(e={},t){return V(await z.api.v1.p[`:projectId`].github.$get({param:{projectId:r()},query:{limit:e.limit===void 0?void 0:String(e.limit),refresh:e.refresh?`1`:void 0,issuesCursor:e.issuesCursor,prsCursor:e.prsCursor}},B(t)),`/github`)}async function er(e={},t){return V(await z.api.v1.p[`:projectId`].tracker[`automation-options`].$get({param:{projectId:r()},query:e},B(t)),`/tracker/automation-options`)}async function tr(e){return V(await z.api.v1.p[`:projectId`].tracker.connection.$get({param:{projectId:r()}},B(e)),`/tracker/connection`)}async function nr(e){return V(await z.api.v1.p[`:projectId`].tracker.connection.$put({param:{projectId:r()},json:e}),`/tracker/connection`)}async function rr(){return V(await z.api.v1.p[`:projectId`].tracker.connection.$delete({param:{projectId:r()}}),`/tracker/connection`)}async function ir(e){return V(await z.api.v1.p[`:projectId`].secrets.$get({param:{projectId:r()}},B(e)),`/secrets`)}async function ar(e){return V(await z.api.v1.workspace.secrets.$get({},B(e)),`/workspace/secrets`)}async function W(e){if(!e.ok)throw R(e.status,e.statusText,await e.text())}async function or(e,t){await W(await z.api.v1.p[`:projectId`].secrets[`:name`].$put({param:{projectId:r(),name:e},json:t}))}async function sr(e){await W(await z.api.v1.p[`:projectId`].secrets[`:name`].$delete({param:{projectId:r(),name:e}}))}async function cr(e,t){await W(await z.api.v1.workspace.secrets[`:name`].$put({param:{name:e},json:t}))}async function lr(e){await W(await z.api.v1.workspace.secrets[`:name`].$delete({param:{name:e}}))}async function ur(e){return V(await z.api.v1.p[`:projectId`].e2e.$get({param:{projectId:r()}},B(e)),`/e2e`)}async function dr(e){return V(await z.api.v1.p[`:projectId`].e2e.setup.$post({param:{projectId:r()},json:e}),`/e2e/setup`)}async function fr(e){return V(await z.api.v1.p[`:projectId`].tracker.association.$get({param:{projectId:r()}},B(e)),`/tracker/association`)}async function pr(e,t={},n){return V(await z.api.v1.p[`:projectId`].tracker.candidates.$get({param:{projectId:r()},query:{kind:e,q:t.q,cursor:t.cursor,limit:t.limit===void 0?void 0:String(t.limit)}},B(n)),`/tracker/candidates`)}async function mr(e){return V(await z.api.v1.p[`:projectId`].tracker.association.$put({param:{projectId:r()},json:e}),`/tracker/association`)}async function hr(){return V(await z.api.v1.p[`:projectId`].tracker.association.$delete({param:{projectId:r()}}),`/tracker/association`)}function gr(e){return{expectedScope:e.association?u(e.association):void 0,cursor:e.cursor,limit:e.limit===void 0?void 0:String(e.limit),refresh:e.refresh?`1`:void 0,state:e.state,labels:e.labels?.length?JSON.stringify(e.labels):void 0}}async function _r(e={},t){return V(await z.api.v1.p[`:projectId`].tracker.$get({param:{projectId:r()},query:gr(e)},B(t)),`/tracker`)}async function vr(e,t={},n){return V(await z.api.v1.p[`:projectId`].tracker.search.$get({param:{projectId:r()},query:{...gr(t),q:e}},B(n)),`/tracker/search`)}async function yr(e,t){return V(await z.api.v1.p[`:projectId`].tracker[`:id`].$get({param:{projectId:r(),id:encodeURIComponent(e)},query:{expectedScope:t?.association?u(t.association):void 0}},B(t)),`/tracker/${encodeURIComponent(e)}`)}async function br(e,t){return V(await z.api.v1.p[`:projectId`].github.checks.$get({param:{projectId:r()},query:{prs:e.join(`,`)}},B(t)),`/github/checks`)}async function xr(e,t,n={},i){return V(await z.api.v1.p[`:projectId`].github.search.$get({param:{projectId:r()},query:{kind:e,q:t,limit:n.limit}},B(i)),`/github/search`)}async function Sr(e,t,n){return V(await z.api.v1.p[`:projectId`].github[`ref-status`].$get({param:{projectId:e},query:{...t.prs?.length?{prs:t.prs.join(`,`)}:{},...t.issues?.length?{issues:t.issues.join(`,`)}:{}}},B(n)),`/github/ref-status`)}async function Cr(e,t,n={},i){return V(await z.api.v1.p[`:projectId`].github.comments[`:kind`][`:number`].$get({param:{projectId:r(),kind:e,number:String(t)},query:{refresh:n.refresh?`1`:void 0}},B(i)),`/github/comments/${e}/${t}`)}async function wr(e,t={},n){return V(await z.api.v1.p[`:projectId`].github.prs[`:number`][`merge-state`].$get({param:{projectId:r(),number:String(e)},query:{refresh:t.refresh?`1`:void 0}},B(n)),`/github/prs/${e}/merge-state`)}async function Tr(e,t){return V(await z.api.v1.p[`:projectId`].github.prs[`:number`].merge.$post({param:{projectId:r(),number:String(e)},json:t}),`/github/prs/:number/merge`)}async function Er(e,t={},n){return V(await z.api.v1.p[`:projectId`].github.prs[`:number`].changes.$get({param:{projectId:r(),number:String(e)},query:{refresh:t.refresh?`1`:void 0}},B(n)),`/github/prs/${e}/changes`)}function Dr(e,t){return mn(U(e,`/diff`),{method:`GET`,signal:t?.signal})}function Or(e,t){return mn(U(e,`/handoff`),{method:`GET`,signal:t?.signal})}async function kr(e,t){return V(await z.api.v1.p[`:projectId`].runs[`:id`].changes.$get({param:{projectId:r(),id:encodeURIComponent(e)}},B(t)),U(e,`/changes`))}async function Ar(e,t,n){return V(await z.api.v1.p[`:projectId`].runs[`:id`].files.$get({param:{projectId:r(),id:encodeURIComponent(e)},query:{path:t}},B(n)),`/runs/:id/files`)}function jr(e,t,n){let r=n?`&rev=${encodeURIComponent(n)}`:``;return c(U(e,`/files?path=${encodeURIComponent(t)}&raw=1${r}`))}async function Mr(e,t){return V(await z.api.v1.p[`:projectId`].groups[`:groupId`].$get({param:{projectId:r(),groupId:encodeURIComponent(e)}},B(t)),`/groups/${encodeURIComponent(e)}`)}async function Nr(e,t){return V(await z.api.v1.providers.connect.$post({json:{provider:e,...t?{profileId:t}:{}}}),`/providers/connect`)}async function Pr(e){return V(await z.api.v1.providers[`:provider`].update.$post({param:{provider:e}}),`/providers/${encodeURIComponent(e)}/update`)}async function Fr(e,t){return Ut(await V(await z.api.v1.providers[`:provider`].enabled.$put({param:{provider:e},json:{enabled:t}}),`/providers/${encodeURIComponent(e)}/enabled`))}async function Ir(e,t){return Ut(await V(await z.api.v1.providers[`:provider`].retry.$post({param:{provider:e},json:{authFailureId:t}}),`/providers/${encodeURIComponent(e)}/retry`))}async function Lr(e){let t=`/projects`,n=await H(t,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({root:e})}),r=await n.text(),i=L(r),a=i?.project;if((n.ok||n.status===409)&&a!=null)return i;throw n.ok?new I(n.status,`the cezar server answered ${t} without a project`):R(n.status,n.statusText,r)}async function Rr(e){return V(await z.api.v1.projects.checkout.$post({json:e}),`/projects/checkout`)}async function zr(e){return V(await z.api.v1.projects.create.$post({json:e}),`/projects/create`)}async function Br(e){return fn(await z.api.v1.projects[`github-owners`].$get({},B(e)),`/projects/github-owners`,a)}async function Vr(e){return V(await z.api.v1.projects[`:projectId`].$delete({param:{projectId:encodeURIComponent(e)}}),`/projects/${encodeURIComponent(e)}`)}async function Hr(e,t){return V(await z.api.v1.projects[`:projectId`].$patch({param:{projectId:encodeURIComponent(e)},json:t}),`/projects/${encodeURIComponent(e)}`)}async function Ur(e){return V(await z.api.v1.p[`:projectId`].runs.$post({param:{projectId:r()},json:e}),`/runs`)}async function Wr(e){return V(await z.api.v1.p[`:projectId`].runs[`:id`].cancel.$post({param:{projectId:r(),id:encodeURIComponent(e)}}),U(e,`/cancel`))}async function Gr(e){return V(await z.api.v1.p[`:projectId`].runs[`:id`][`start-now`].$post({param:{projectId:r(),id:encodeURIComponent(e)}}),U(e,`/start-now`))}async function Kr(e,t=!0,n){return V(await z.api.v1.p[`:projectId`].runs[`:id`].archive.$post({param:{projectId:r(),id:encodeURIComponent(e)},json:{archived:t,...n?{surface:n}:{}}}),U(e,`/archive`))}async function qr(e,t=!0,n){return V(await z.api.v1.p[`:projectId`].runs[`:id`].pin.$post({param:{projectId:r(),id:encodeURIComponent(e)},json:{pinned:t,...n?{surface:n}:{}}}),U(e,`/pin`))}async function Jr(e,t,n=!0,r){return V(await z.api.v1.p[`:projectId`].runs[`:id`].pin.$post({param:{projectId:e,id:encodeURIComponent(t)},json:{pinned:n,...r?{surface:r}:{}}}),U(t,`/pin`))}async function Yr(e,t,n=!0,r){return V(await z.api.v1.p[`:projectId`].runs[`:id`].archive.$post({param:{projectId:e,id:encodeURIComponent(t)},json:{archived:n,...r?{surface:r}:{}}}),U(t,`/archive`))}async function Xr(e,t,n){let r=n?`read`:`unread`;return V(await(n?z.api.v1.p[`:projectId`].runs[`:id`].read.$post({param:{projectId:e,id:encodeURIComponent(t)}}):z.api.v1.p[`:projectId`].runs[`:id`].unread.$post({param:{projectId:e,id:encodeURIComponent(t)}})),U(t,`/${r}`))}async function Zr(e){return V(await z.api.v1.p[`:projectId`].runs[`:id`][`auto-resume`].$delete({param:{projectId:r(),id:encodeURIComponent(e)}}),U(e,`/auto-resume`))}async function Qr(){return V(await z.api.v1.p[`:projectId`].runs[`archive-finished`].$post({param:{projectId:r()}}),`/runs/archive-finished`)}async function $r(e){return V(await z.api.v1.p[`:projectId`].runs[`:id`].read.$post({param:{projectId:r(),id:encodeURIComponent(e)}}),U(e,`/read`))}async function ei(e){return V(await z.api.v1.p[`:projectId`].runs[`:id`].unread.$post({param:{projectId:r(),id:encodeURIComponent(e)}}),U(e,`/unread`))}async function ti(){return V(await z.api.v1.p[`:projectId`].runs[`read-all`].$post({param:{projectId:r()}}),`/runs/read-all`)}async function ni(e){return V(await z.api.v1.p[`:projectId`].runs[`:id`].land.$post({param:{projectId:r(),id:encodeURIComponent(e)}}),U(e,`/land`))}async function ri(e){return V(await z.api.v1.p[`:projectId`].runs[`:id`].finish.$post({param:{projectId:r(),id:encodeURIComponent(e)}}),U(e,`/finish`))}async function ii(e,t={}){let n={...t.text===void 0?{}:{text:t.text},...t.images===void 0?{}:{images:t.images},...t.runner===void 0?{}:{runner:t.runner},...t.model===void 0?{}:{model:t.model},...t.agentProfile===void 0?{}:{agentProfile:t.agentProfile}};return V(await z.api.v1.p[`:projectId`].runs[`:id`].continue.$post({param:{projectId:r(),id:encodeURIComponent(e)},json:n}),U(e,`/continue`))}async function ai(e,t,n={}){return V(await z.api.v1.p[`:projectId`].runs[`:id`].continue.$post({param:{projectId:e,id:encodeURIComponent(t)},json:{...n.text===void 0?{}:{text:n.text},...n.images===void 0?{}:{images:n.images},...n.runner===void 0?{}:{runner:n.runner},...n.model===void 0?{}:{model:n.model},...n.agentProfile===void 0?{}:{agentProfile:n.agentProfile}}}),U(t,`/continue`))}var oi=1e3;async function si(e,t={}){let n=r(),i=async()=>V(await z.api.v1.p[`:projectId`].runs[`:id`].pr.$post({param:{projectId:n,id:encodeURIComponent(e)},json:t}),U(e,`/pr`));try{return await i()}catch(e){if(!(e instanceof I)||e.status!==0)throw e;await new Promise(e=>setTimeout(e,oi));try{return await i()}catch(t){throw t instanceof I&&t.status===0?e:t}}}async function ci(e){return V(await z.api.v1.p[`:projectId`].runs[`:id`].pr.adopt.$post({param:{projectId:r(),id:encodeURIComponent(e)}}),U(e,`/pr/adopt`))}async function li(e,t){return V(await z.api.v1.p[`:projectId`].runs[`:id`].$patch({param:{projectId:r(),id:encodeURIComponent(e)},json:t}),U(e))}async function ui(e){return V(await z.api.v1.p[`:projectId`].runs[`:id`].$delete({param:{projectId:r(),id:encodeURIComponent(e)}}),U(e))}async function di(e){return V(await z.api.v1.p[`:projectId`].todos[`:id`].$delete({param:{projectId:r(),id:encodeURIComponent(e)}}),`/todos/${encodeURIComponent(e)}`)}async function fi(e,t={}){let n={...t.runner===void 0?{}:{runner:t.runner},...t.model===void 0?{}:{model:t.model},...t.prompt===void 0?{}:{prompt:t.prompt}};return V(await z.api.v1.p[`:projectId`].todos[`:id`].start.$post({param:{projectId:r(),id:encodeURIComponent(e)},json:Object.keys(n).length>0?n:void 0}),`/todos/${encodeURIComponent(e)}/start`)}async function pi(e,t){return V(await z.api.v1.p[`:projectId`].groups[`:groupId`].pick.$post({param:{projectId:r(),groupId:encodeURIComponent(e)},json:{runId:t}}),`/groups/${encodeURIComponent(e)}/pick`)}async function mi(e){return V(await z.api.v1.p[`:projectId`].runs[`:id`][`open-in-cli`].$post({param:{projectId:r(),id:encodeURIComponent(e)}}),U(e,`/open-in-cli`))}async function hi(e){return V(await z.api.v1.p[`:projectId`][`open-targets`].$get({param:{projectId:r()}},B(e)),`/open-targets`)}async function gi(e){return V(await z.api.v1.p[`:projectId`][`open-in`].$post({param:{projectId:r()},json:{target:e}}),`/open-in`)}async function _i(e,t){return V(await z.api.v1.p[`:projectId`].runs[`:id`][`open-in`].$post({param:{projectId:r(),id:encodeURIComponent(e)},json:{target:t}}),U(e,`/open-in`))}async function vi(e,t){return V(await z.api.v1.p[`:projectId`].runs[`:id`][`open-in`].$post({param:{projectId:r(),id:encodeURIComponent(e)},json:{target:`default`,path:t}}),U(e,`/open-in`))}async function yi(e,t){return V(await z.api.v1.p[`:projectId`].runs[`:id`].git.commit.$post({param:{projectId:r(),id:encodeURIComponent(e)},json:{message:t}}),U(e,`/git/commit`))}async function bi(e,t){return V(await z.api.v1.p[`:projectId`].runs[`:id`].git.status.$get({param:{projectId:r(),id:encodeURIComponent(e)}},B(t)),U(e,`/git/status`))}async function xi(e){return V(await z.api.v1.p[`:projectId`].runs[`:id`].git.push.$post({param:{projectId:r(),id:encodeURIComponent(e)}}),U(e,`/git/push`))}async function Si(e,t){return V(await z.api.v1.p[`:projectId`].runs[`:id`].messages.$post({param:{projectId:r(),id:encodeURIComponent(e)},json:{text:t.text??``,images:t.images??[]}}),U(e,`/messages`))}async function Ci(e,t,n){return V(await z.api.v1.p[`:projectId`].runs[`:id`].messages.$post({param:{projectId:e,id:encodeURIComponent(t)},json:{text:n.text??``,images:n.images??[]}}),U(t,`/messages`))}async function wi(e,t,n){return V(await z.api.v1.p[`:projectId`].runs[`:id`][`queued-messages`][`:msgId`].$patch({param:{projectId:r(),id:encodeURIComponent(e),msgId:encodeURIComponent(t)},json:n}),U(e,`/queued-messages/${encodeURIComponent(t)}`))}async function Ti(e,t){return V(await z.api.v1.p[`:projectId`].runs[`:id`][`queued-messages`][`:msgId`].$delete({param:{projectId:r(),id:encodeURIComponent(e),msgId:encodeURIComponent(t)}}),U(e,`/queued-messages/${encodeURIComponent(t)}`))}async function Ei(e,t){return V(await z.api.v1.p[`:projectId`].runs[`:id`].drafts.$get({param:{projectId:r(),id:encodeURIComponent(e)}},B(t)),U(e,`/drafts`))}var Di=56*1024;async function Oi(e,t,n,i){let a=i?.keepalive===!0&&new TextEncoder().encode(JSON.stringify(n)).length<=Di;return V(await z.api.v1.p[`:projectId`].runs[`:id`].drafts[`:surface`].$put({param:{projectId:r(),id:encodeURIComponent(e),surface:t},json:n},{init:{keepalive:a}}),U(e,`/drafts/${t}`))}async function ki(e,t,n){return V(await z.api.v1.p[`:projectId`].runs[`:id`].drafts[`:surface`].images.$post({param:{projectId:r(),id:encodeURIComponent(e),surface:t},json:n}),U(e,`/drafts/${t}/images`))}async function Ai(e){return V(await z.api.v1.workspace.uploads.$post({json:e}),`/workspace/uploads`)}async function ji(e){return V(await z.api.v1.workspace.uploads[`:uploadId`].$delete({param:{uploadId:e}}),`/workspace/uploads/${e}`)}async function Mi(e,t,n,i){return V(await z.api.v1.p[`:projectId`].runs[`:id`].drafts[`:surface`].images[`:imageId`].$get({param:{projectId:r(),id:encodeURIComponent(e),surface:t,imageId:n}},B(i)),U(e,`/drafts/${t}/images/${n}`))}async function Ni(e,t,n){return V(await z.api.v1.p[`:projectId`].runs[`:id`].drafts[`:surface`].images[`:imageId`].$delete({param:{projectId:r(),id:encodeURIComponent(e),surface:t,imageId:n}}),U(e,`/drafts/${t}/images/${n}`))}async function Pi(e){return V(await z.api.v1.p[`:projectId`].repo.branch.$post({param:{projectId:r()},json:e}),`/repo/branch`)}async function Fi(e){return V(await z.api.v1.p[`:projectId`].repo.sync.$get({param:{projectId:r()}},B(e)),`/repo/sync`)}async function Ii(e){let t={param:{projectId:r()}},n=z.api.v1.p[`:projectId`].repo;return V(e===`fetch`?await n.fetch.$post(t):e===`pull`?await n.pull.$post(t):e===`push`?await n.push.$post(t):await n.sync.$post(t),`/repo/${e}`)}async function Li(e){return V(await z.api.v1.p[`:projectId`].plan.$post({param:{projectId:r()},json:{task:e}}),`/plan`)}async function Ri(e){return V(await z.api.v1.p[`:projectId`].automations.$get({param:{projectId:r()}},B(e)),`/automations`)}async function zi(e){return V(await z.api.v1.p[`:projectId`].automations.$post({param:{projectId:r()},json:e}),`/automations`)}async function Bi(e,t){return V(await z.api.v1.p[`:projectId`].automations[`:id`].$put({param:{projectId:r(),id:encodeURIComponent(e)},json:t}),`/automations/${encodeURIComponent(e)}`)}async function Vi(e,t){let n={projectId:r(),id:encodeURIComponent(e)},i=`/automations/${encodeURIComponent(e)}/${t?`enable`:`pause`}`;return V(t?await z.api.v1.p[`:projectId`].automations[`:id`].enable.$post({param:n}):await z.api.v1.p[`:projectId`].automations[`:id`].pause.$post({param:n}),i)}async function Hi(e,t){return V(await z.api.v1.p[`:projectId`].automations[`:id`].check.$post({param:{projectId:r(),id:encodeURIComponent(e)},json:{mode:t}}),`/automations/${encodeURIComponent(e)}/check`)}async function Ui(e,t){return V(await z.api.v1.p[`:projectId`][`automation-log`].$get({param:{projectId:r()},query:{automationId:e}},B(t)),`/automation-log?automationId=${encodeURIComponent(e)}`)}async function Wi(e){return V(await z.api.v1.p[`:projectId`][`automation-log`][`:receiptId`].retry.$post({param:{projectId:r(),receiptId:encodeURIComponent(e)}}),`/automation-log/${encodeURIComponent(e)}/retry`)}async function Gi(e,t){return V(await z.api.v1.p[`:projectId`].automations[`:id`].run.$post({param:{projectId:r(),id:encodeURIComponent(e)},query:t?{expectedRevision:String(t)}:{}}),`/automations/${encodeURIComponent(e)}/run`)}async function Ki(e,t){let n=await z.api.v1.p[`:projectId`].automations[`:id`].$delete({param:{projectId:r(),id:encodeURIComponent(e)},query:t?{expectedRevision:String(t)}:{}});if(!n.ok)throw R(n.status,n.statusText,await n.text())}async function qi(e,t){return V(await z.api.v1.workspace[`automation-templates`].$get({query:e?{exclude:e}:{}},B(t)),`/workspace/automation-templates`)}async function Ji(e){return V(await z.api.v1.p[`:projectId`].workflows.$post({param:{projectId:r()},json:e}),`/workflows`)}async function Yi(e){return V(await z.api.v1.p[`:projectId`].workflows.nodes.$get({param:{projectId:r()}},B(e)),`/workflows/nodes`)}async function Xi(e){return V(await z.api.v1.p[`:projectId`].workflows.validate.$post({param:{projectId:r()},json:{graph:e}}),`/workflows/validate`)}async function Zi(e){return V(await z.api.v1.p[`:projectId`].workflows.graph.$post({param:{projectId:r()},json:e}),`/workflows/graph`)}async function Qi(e){return V(await z.api.v1.p[`:projectId`].workflows.parse.$post({param:{projectId:r()},json:{yaml:e}}),`/workflows/parse`)}async function $i(e){return V(await z.api.v1.p[`:projectId`].workflows[`:name`].$delete({param:{projectId:r(),name:encodeURIComponent(e)}}),`/workflows/${encodeURIComponent(e)}`)}async function ea(e,t=r()){return V(await z.api.v1.p[`:projectId`][`ui-state`].$put({param:{projectId:t},json:e}),`/ui-state`)}async function ta(e){return V(await z.api.v1.workspace[`ui-state`].$get({},B(e)),`/workspace/ui-state`)}async function na(e,t={}){return V(await z.api.v1.workspace[`ui-state`].$put({json:e},{init:{keepalive:t.keepalive}}),`/workspace/ui-state`)}async function ra(e){let t=await V(await z.api.v1.workspace.config.$get({},B(e)),`/workspace/config`);return{...t,branding:t.branding?{...t.branding,logoUrl:t.branding.logoUrl?p(t.branding.logoUrl):null}:{name:`cezar`,logoUrl:null},agentDefaults:t.agentDefaults??{},orgSkillsRepos:t.orgSkillsRepos??[],resources:{...t.resources,idleTimeoutMinutes:t.resources.idleTimeoutMinutes===void 0?15:t.resources.idleTimeoutMinutes}}}async function ia(e){let t=new FormData;t.set(`file`,e);let n=await H(`/workspace/branding-logo`,{method:`POST`,body:t}),r=await n.text();if(!n.ok)throw R(n.status,n.statusText,r);let a=L(r),o=i.safeParse(a);if(!o.success)throw new I(n.status,`the cezar server answered /workspace/branding-logo with an unexpected body`);return o.data.logoUrl?p(o.data.logoUrl):null}async function aa(){let e=await H(`/workspace/branding-logo`,{method:`DELETE`}),t=await e.text();if(!e.ok)throw R(e.status,e.statusText,t);let n=i.safeParse(L(t));if(!n.success)throw new I(e.status,`the cezar server answered /workspace/branding-logo with an unexpected body`);return n.data.logoUrl?p(n.data.logoUrl):null}async function oa(e){return V(await z.api.v1.workspace[`host-usage`].$get({},B(e)),`/workspace/host-usage`)}async function sa(e){let t=await V(await z.api.v1.workspace[`agent-profiles`].$get({},B(e)),`/workspace/agent-profiles`);return{...t,profileCapableProviders:t.profileCapableProviders??[],selections:t.selections??{},defaults:t.defaults??{},profiles:(t.profiles??[]).map(e=>({...e,files:e.files??[]}))}}async function ca(e){return V(await z.api.v1.workspace[`agent-profiles`].$post({json:e}),`/workspace/agent-profiles`)}async function la(e,t){return V(await z.api.v1.workspace[`agent-profiles`][`:id`].status.$get({param:{id:encodeURIComponent(e)},query:{...t?.refresh||t?.recheck?{refresh:`1`}:{},...t?.recheck?{recheck:`1`}:{}}},B(t)),`/workspace/agent-profiles/${encodeURIComponent(e)}/status`)}async function ua(e,t){return V(await z.api.v1.workspace[`agent-profiles`][`:id`].details.$get({param:{id:encodeURIComponent(e)}},B(t)),`/workspace/agent-profiles/${encodeURIComponent(e)}/details`)}async function da(e,t){return V(await z.api.v1.workspace[`agent-profiles`][`:id`].open.$post({param:{id:encodeURIComponent(e)},json:t}),`/workspace/agent-profiles/${encodeURIComponent(e)}/open`)}async function fa(e){return V(await z.api.v1.workspace[`agent-profiles`].selection.$put({json:e}),`/workspace/agent-profiles/selection`)}async function pa(e,t){return V(await z.api.v1.workspace[`agent-profiles`][`:id`].$patch({param:{id:encodeURIComponent(e)},json:t}),`/workspace/agent-profiles/${encodeURIComponent(e)}`)}async function ma(e){return V(await z.api.v1.workspace[`agent-profiles`][`:id`].$delete({param:{id:encodeURIComponent(e)}}),`/workspace/agent-profiles/${encodeURIComponent(e)}`)}async function ha(e,t){return V(await z.api.v1.workspace[`skills-update`].$get({query:{projectId:e}},B(t)),`/workspace/skills-update?projectId=${encodeURIComponent(e)}`)}async function ga(e){return V(await z.api.v1.workspace[`skills-update`].check.$post({json:{projectId:e}}),`/workspace/skills-update/check`)}async function _a(e){return V(await z.api.v1.workspace[`skills-update`].apply.$post({json:{projectId:e}}),`/workspace/skills-update/apply`)}async function va(e){return V(await z.api.v1.workspace[`self-update`].$get({},B(e)),`/workspace/self-update`)}async function ya(){return V(await z.api.v1.workspace[`self-update`].refresh.$post({}),`/workspace/self-update/refresh`)}async function ba(e){return V(await z.api.v1.workspace[`self-update`].development.$get({query:e?.refresh?{refresh:`1`}:{}},B(e)),`/workspace/self-update/development`)}async function xa(e){return V(await z.api.v1.workspace[`self-update`].channel.$put({json:{channel:e}}),`/workspace/self-update/channel`)}async function Sa(e){return V(await z.api.v1.workspace[`self-update`].apply.$post({json:{version:e}}),`/workspace/self-update/apply`)}async function Ca(e){return V(await z.api.v1.workspace[`self-update`].apply.$post({json:{version:e,whenIdle:!0}}),`/workspace/self-update/apply`)}async function wa(){return V(await z.api.v1.workspace[`self-update`].scheduled.$delete({}),`/workspace/self-update/scheduled`)}async function Ta(e){let t=await V(await z.api.v1.workspace.config.$put({json:e}),`/workspace/config`);return{...t,orgSkillsRepos:t.orgSkillsRepos??[]}}async function Ea(e){return V(await z.api.v1.p[`:projectId`].config.$put({param:{projectId:r()},json:e}),`/config`)}async function Da(e){return V(await z.api.v1.p[`:projectId`].worktrees.$get({param:{projectId:r()}},B(e)),`/worktrees`)}async function Oa(){return V(await z.api.v1.p[`:projectId`].worktrees.reclaim.$post({param:{projectId:r()},json:{}}),`/worktrees/reclaim`)}async function ka(e){return V(await z.api.v1.p[`:projectId`].runs[`:id`][`remove-worktree`].$post({param:{projectId:r(),id:encodeURIComponent(e)}}),U(e,`/remove-worktree`))}async function Aa(e,t,n){return ne.parse(await V(await z.api.v1.p[`:projectId`].tracker.watch.$post({param:{projectId:e},json:t},{init:{signal:n}}),`/tracker/watch`))}async function ja(e,t,n,r){return m.parse(await V(await z.api.v1.p[`:projectId`].tracker.watch[`:watchId`].$get({param:{projectId:e,watchId:t},query:{after:r===void 0?void 0:String(r)}},{init:{signal:n}}),`/tracker/watch`))}async function Ma(e,t,n){return m.parse(await V(await z.api.v1.p[`:projectId`].tracker.watch[`:watchId`].$post({param:{projectId:e,watchId:t}},{init:{signal:n}}),`/tracker/watch`))}async function Na(e={limit:50},t){return V(await z.api.v1.p[`:projectId`][`worktree-lifecycle`].$get({param:{projectId:r()},query:{cursor:e.cursor,limit:e.limit,attentionOnly:e.attentionOnly===void 0?void 0:e.attentionOnly?`true`:`false`}},B(t)),`/worktree-lifecycle`)}async function Pa(e,t){return V(await z.api.v1.p[`:projectId`][`worktree-lifecycle`][`:worktreeId`].$get({param:{projectId:r(),worktreeId:e}},B(t)),`/worktree-lifecycle`)}async function Fa(e,t){return V(await z.api.v1.p[`:projectId`][`worktree-lifecycle`].operations[`:operationId`].$get({param:{projectId:r(),operationId:e}},B(t)),`/worktree-lifecycle/operations`)}async function Ia(e,t=0,n){return V(await z.api.v1.p[`:projectId`][`worktree-lifecycle`].operations[`:operationId`].output.$get({param:{projectId:r(),operationId:e},query:{afterSeq:t,limit:100}},B(n)),`/worktree-lifecycle/operations/output`)}async function La(e){return V(await z.api.v1.p[`:projectId`][`worktree-lifecycle`].operations.$post({param:{projectId:r()},json:e}),`/worktree-lifecycle/operations`)}async function Ra(e,t){return V(await z.api.v1.p[`:projectId`][`worktree-lifecycle`].operations[`:operationId`].actions.$post({param:{projectId:r(),operationId:e},json:t}),`/worktree-lifecycle/operations/actions`)}async function za(e){return V(await z.api.v1.p[`:projectId`][`worktree-lifecycle`].preview.$post({param:{projectId:r()},json:e}),`/worktree-lifecycle/preview`)}async function Ba(e){return V(await z.api.v1.p[`:projectId`].runs[`:id`].terminal.$get({param:{projectId:r(),id:encodeURIComponent(e)}}),U(e,`/terminal`))}async function Va(e,t){return V(await z.api.v1.p[`:projectId`].runs[`:id`].terminal.$post({param:{projectId:r(),id:encodeURIComponent(e)},json:t}),U(e,`/terminal`))}async function Ha(e,t,n){return V(await z.api.v1.p[`:projectId`].runs[`:id`].terminal[`:sessionId`].output.$get({param:{projectId:r(),id:encodeURIComponent(e),sessionId:t},query:{cursor:String(n)}}),U(e,`/terminal/${t}/output`))}async function Ua(e,t,n){await V(await z.api.v1.p[`:projectId`].runs[`:id`].terminal[`:sessionId`].input.$post({param:{projectId:r(),id:encodeURIComponent(e),sessionId:t},json:{data:n}}),U(e,`/terminal/${t}/input`))}async function Wa(e,t,n,i){await V(await z.api.v1.p[`:projectId`].runs[`:id`].terminal[`:sessionId`].resize.$post({param:{projectId:r(),id:encodeURIComponent(e),sessionId:t},json:{cols:n,rows:i}}),U(e,`/terminal/${t}/resize`))}async function Ga(e,t){await V(await z.api.v1.p[`:projectId`].runs[`:id`].terminal[`:sessionId`].$delete({param:{projectId:r(),id:encodeURIComponent(e),sessionId:t}}),U(e,`/terminal/${t}`))}async function Ka(e){return V(await z.api.v1.p[`:projectId`].runs[`:id`].terminal.urls.$get({param:{projectId:r(),id:encodeURIComponent(e)}}),U(e,`/terminal/urls`))}async function qa(e){return V(await z.api.v1.p[`:projectId`].runs[`:id`].terminal.commands.$get({param:{projectId:r(),id:encodeURIComponent(e)}}),U(e,`/terminal/commands`))}async function Ja(){return V(await z.api.v1.p[`:projectId`][`start-app`].$get({param:{projectId:r()}}),`/start-app`)}async function Ya(e){return V(await z.api.v1.p[`:projectId`][`start-app`].$put({param:{projectId:r()},json:e}),`/start-app`)}async function Xa(e){return V(await z.api.v1.p[`:projectId`].runs[`:id`].layouts.$get({param:{projectId:r(),id:encodeURIComponent(e)}}),U(e,`/layouts`))}async function Za(e,t,n){let i=n?.keepalive===!0&&new TextEncoder().encode(JSON.stringify(t)).length<=Di;return V(await z.api.v1.p[`:projectId`].runs[`:id`].layouts.$put({param:{projectId:r(),id:encodeURIComponent(e)},json:t},{init:{keepalive:i}}),U(e,`/layouts`))}async function Qa(e){return V(await z.api.v1.p[`:projectId`][`deferred-start`].preview.$post({param:{projectId:r()},json:e}),`/deferred-start/preview`)}async function $a(e){return V(await z.api.v1.p[`:projectId`][`deferred-start`].$post({param:{projectId:r()},json:e}),`/deferred-start`)}async function eo(e){return V(await z.api.v1.p[`:projectId`][`deferred-start`].options.$post({param:{projectId:r()},json:e}),`/deferred-start/options`)}function to(e,t){if(e===`ping`)return{project:null,event:{type:`ping`}};let n;try{n=JSON.parse(t)}catch{return null}if(!no(n))return null;let r=n.project;if(typeof r!=`string`||r===``)return null;switch(e){case`run`:{let{project:e,...t}=n;return ro(t)?{project:r,event:{type:`run`,run:t}}:null}case`run-deleted`:{let e=n.id;return typeof e==`string`&&e?{project:r,event:{type:`run-deleted`,id:e}}:null}case`todos`:return Array.isArray(n.items)?{project:r,event:{type:`todos`,items:n.items}}:null;case`usage`:return no(n.usage)?{project:r,event:{type:`usage`,usage:n.usage}}:null;default:return null}}function no(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ro(e){return no(e)&&typeof e.id==`string`&&e.id!==``}function io(e){return typeof e.task==`string`&&Array.isArray(e.steps)}function ao(e,t){if(!e)return;let n=e.findIndex(e=>e.id===t.id),r=n<0?void 0:e[n];if(r!==void 0){let i=[...e];return i[n]=G(r,t),i}if(!io(t))return e;let i=t.createdAt??``,a=e.findIndex(e=>(e.createdAt??``).localeCompare(i)<0),o=[...e];return o.splice(a<0?e.length:a,0,t),o}function oo(e,t){if(!e)return;let n=e.filter(e=>e.id!==t);return n.length===e.length?e:n}function G(e,t){let n={...t};if(!io(t)){let t=n;for(let n of h)n in e&&(t[n]=e[n])}let r=e=>e===`user`?2:+(e===`marker`);return r(e.titleOrigin)>r(t.titleOrigin)&&(n.title=e.title,n.titleSummary=e.titleSummary,n.titleOrigin=e.titleOrigin),e.usage&&(n.usage=e.usage),n}var so=Object.freeze({});function co(){let e=so,t=new Set;return{subscribe(e){return t.add(e),()=>t.delete(e)},get:()=>e,set(n){e=n;for(let e of t)e()}}}var lo={draft:{label:`Draft`,hint:`the author has not marked it ready for review`,tone:`neutral`},"review-required":{label:`Waiting for review`,hint:`checks are fine, no one has reviewed it yet`,tone:`info`},"changes-requested":{label:`Changes requested`,hint:`a reviewer asked for edits before this can merge`,tone:`danger`},"checks-pending":{label:`Checks running`,hint:`CI has not finished on the latest commit`,tone:`pending`},"checks-failing":{label:`Checks failing`,hint:`CI is red on the latest commit`,tone:`danger`},ready:{label:`Ready to merge`,hint:`open, checks pass, nothing is waiting on a reviewer`,tone:`success`},merged:{label:`Merged`,hint:`this landed on its base branch`,tone:`violet`},closed:{label:`Closed`,hint:`closed without merging — the work did not land`,tone:`danger`},open:{label:`Open`,hint:`still open on the tracker`,tone:`success`},completed:{label:`Closed as completed`,hint:`the issue was resolved`,tone:`violet`},"not-planned":{label:`Closed as not planned`,hint:`the issue was declined — nothing shipped for it`,tone:`neutral`}},uo={label:`Merge conflicts`,hint:`this branch no longer merges cleanly into its base — rebase or merge the base in`,tone:`conflict`};function fo(e){return typeof e==`string`&&Object.hasOwn(lo,e)}function po(e){return e!==void 0&&fo(e)?lo[e]:void 0}var mo={permission:0,error:1,waiting:2,running:3,unseen:4,none:5};function ho(e){return!1}function go(e){return!1}function _o(e){let t=e.dispatch?.overBudget?e.dispatch.budgetUsd:void 0;if(!(e.status!==`waiting`||t===void 0))return{spent:e.costUsd??0,ceiling:t}}function K(e){return e.status===`failed`&&e.awaitingAnswerSince!==void 0}function vo(e){return!!e.worktreeLifecycle?.needsAttention||e.status===`waiting`||e.status===`review`||K(e)}function yo(e){let t=e.worktreeLifecycle;return t?.needsAttention?{bucket:`waiting`,tone:`pending`,pulse:!1,label:t.phase===`setup`?`setup needs attention`:`cleanup needs attention`}:t?.activeOperationId?{bucket:`running`,tone:`pending`,pulse:!0,label:t.phase===`setup`?`preparing worktree`:`cleaning up worktree`}:ho(e)?{bucket:`permission`,tone:`violet`,pulse:!0,label:`needs permission`}:e.status===`failed`&&e.autoResumeAt?{bucket:`none`,tone:`pending`,pulse:!1,label:`scheduled`}:K(e)?{bucket:`waiting`,tone:`pending`,pulse:!0,label:`needs you`}:e.status===`failed`?{bucket:`error`,tone:`danger`,pulse:!1,label:`failed`}:e.status===`waiting`?{bucket:`waiting`,tone:`pending`,pulse:!0,label:_o(e)?.ceiling===void 0?`needs you`:`budget reached`}:e.status===`review`?{bucket:`waiting`,tone:`violet`,pulse:!0,label:`needs review`}:e.status===`running`&&e.activity===`monitoring`?{bucket:`running`,tone:`violet`,pulse:!0,label:`monitoring`}:e.status===`running`?{bucket:`running`,tone:`violet`,pulse:!0,label:`running`}:go(e)?{bucket:`unseen`,tone:`violet`,pulse:!1,label:`unseen`}:e.status===`queued`?{bucket:`none`,tone:`neutral`,pulse:!1,label:`queued`}:e.status===`done`?{bucket:`none`,tone:`success`,pulse:!1,label:`done`}:{bucket:`none`,tone:`neutral`,pulse:!1,label:`cancelled`}}function bo(e){return mo[yo(e).bucket]<=mo.waiting}var xo=[`Pinned`,`Needs you`,`Working`,`Recent`,`Archived`],So={waiting:0,review:1,running:2,queued:4,done:5,failed:5,cancelled:5},Co=3,wo=e=>e.status===`failed`&&e.autoResumeAt!==void 0?Co:K(e)?So.waiting??0:So[e.status]??9;function To(e,t){return t===`archived`?`Archived`:e.pinned?`Pinned`:vo(e)?`Needs you`:e.status===`running`||e.status===`queued`||e.status===`failed`&&e.autoResumeAt?`Working`:`Recent`}function Eo(e){let t=e.titleSummary;return t===void 0||!(e.titleOrigin===`user`||e.titleOrigin===`marker`)&&/[.!?][A-Z]/.test(t)?e.title:t}function Do(e){let t=/^(\d{1,9}): (.+)$/.exec(e),n=t?.[1],r=t?.[2];return n===void 0||r===void 0?{ref:null,rest:e}:{ref:Number(n),rest:r}}function Oo(e,t){return t!==void 0&&Do(e).ref===t}function ko(e){return e.title.replace(/ \([A-C]\)$/,``)}function Ao(e){let t=e.filter(e=>!e.archived&&e.status===`queued`).sort((e,t)=>e.createdAt.localeCompare(t.createdAt));return new Map(t.map((e,t)=>[e.id,t+1]))}var jo=[{value:`recent`,label:`Recent`},{value:`created`,label:`Created`}];function Mo(e,t){let n=Date.parse(e),r=Date.parse(t);return Number.isNaN(n)||Number.isNaN(r)?t.localeCompare(e):r-n}function No(e){if(e.lastActivityAt!==void 0)return e.lastActivityAt;let t=e.finishedAt??e.startedAt??e.createdAt;for(let n of e.steps??[]){let e=n.finishedAt??n.startedAt;e!==void 0&&Mo(e,t)<0&&(t=e)}return t}function Po(e,t){return t===`created`?e.createdAt:No(e)}function Fo(e){return e===`created`?`Created`:`Updated`}function Io(e,t){if(t===`archived`)return[{key:`rest`,label:null,runs:[...e]}];let n=new Map(e.map(e=>[e.id,e])),r=e=>{let t=new Set;for(let r=e;r&&!t.has(r.id);r=n.get(r.dispatch?.parentRunId??``)){if(r.pinned)return!0;t.add(r.id)}return!1},i=e.filter(r);if(i.length===0)return[{key:`rest`,label:null,runs:[...e]}];let a=e.filter(e=>!r(e));return[{key:`pinned`,label:`Pinned`,runs:i},...a.length>0?[{key:`rest`,label:`All tasks`,runs:a}]:[]]}function Lo(e,t){return e.filter(e=>t===`archived`?e.archived:!e.archived).sort((e,n)=>{if(t!==`archived`){let t=Number(!!n.pinned)-Number(!!e.pinned);if(t!==0)return t}let r=wo(e)-wo(n);if(r!==0)return r;if(wo(e)===Co&&e.autoResumeAt&&n.autoResumeAt){let t=e.autoResumeAt.localeCompare(n.autoResumeAt);if(t!==0)return t}return e.status===`queued`&&n.status===`queued`?e.createdAt.localeCompare(n.createdAt):Mo(No(e),No(n))})}function Ro(e,t,n){return e.filter(e=>t===`archived`?e.archived:!e.archived).sort((e,r)=>{if(t!==`archived`){let t=Number(!!r.pinned)-Number(!!e.pinned);if(t!==0)return t}return Mo(Po(e,n),Po(r,n))})}function zo(e,t){let n=Ao(e),r=Lo(e,t),i=new Map,a=(e,t)=>{let n=i.get(e);n?n.push(t):i.set(e,[t])},o=new Set;for(let e of r){if(e.groupId){if(o.has(e.groupId))continue;o.add(e.groupId);let n=r.filter(t=>t.groupId===e.groupId).sort((e,t)=>(e.variant??``).localeCompare(t.variant??``));if(n.length>1){a(To(e,t),{kind:`group`,groupId:e.groupId,title:ko(e),members:n});continue}}a(To(e,t),{kind:`run`,run:e,queuePosition:n.get(e.id)??null})}return xo.filter(e=>i.has(e)).map(e=>({label:e,rows:i.get(e)}))}function Bo(e,t){let n=[],r=t;for(let t of e){if(t.label===`Pinned`){n.push({label:t.label,rows:[...t.rows]});continue}if(r<=0)continue;let e=t.rows.slice(0,r);r-=e.length,n.push({label:t.label,rows:e})}return n}function Vo(e){let t=0,n=0,r=0;for(let i of e){if(i.archived){n+=1;continue}t+=1,vo(i)&&(r+=1)}return{active:t,archived:n,waiting:r}}var Ho=new Set([`running`,`waiting`]),Uo=new Set([`done`,`failed`,`review`,`cancelled`]),Wo=new Set([`done`,`failed`,`cancelled`]);function Go(e){return e?e>=1024**3?`${(e/1024**3).toFixed(1)} GB`:e>=1024**2?`${Math.round(e/1024**2)} MB`:`${Math.round(e/1024)} kB`:``}function Ko(e){return e?`$${e>=10?e.toFixed(0):e.toFixed(2)}`:``}function qo(e,t=new Date){if(e.status!==`failed`||!e.autoResumeAt)return;let n=new Date(e.autoResumeAt);if(!Number.isFinite(n.getTime()))return;let r=n.toDateString()===t.toDateString(),i=new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(n);return{label:r?i:`${new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(n)} ${i}`,title:`Resumes automatically at ${new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(n)}`}}function Jo(e){if(e.workflow===`(planned)`||e.workflow===`(inbox)`){let t=e.steps.find(e=>e.kind===`agent`);if(t?.name)return t.name}return e.workflow}function Yo(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>[Eo(e),e.branch??``,e.workflow,Jo(e)].some(e=>e.toLowerCase().includes(n))):[...e]}function Xo(e){return e.filter(e=>!e.archived&&Wo.has(e.status)&&!K(e)).length}function Zo(e,t=!1){if(!e)return;let n=e.trim().replace(/\/+$/,``),r=/^(?:https?|ssh|git|git\+ssh):\/\/(?:[^@/]+@)?([^/:]+)(?::\d+)?\/(.+)$/.exec(n),i=r?null:/^(?:[^@/:]+@)?([^:/]+):(.+)$/.exec(n),a=r??i;if(!a)return;let[,o,s]=a;if(!s||!o||!t&&o.toLowerCase()!==`github.com`)return;let c=s.replace(/\.git$/i,``).split(`/`).filter(Boolean),l=c[c.length-2],u=c[c.length-1];return l&&u?`https://${o.toLowerCase()}/${l}/${u}`:void 0}function Qo(e){if(e.pullRequestUrl){let t=Number(q(e.pullRequestUrl));return{url:e.pullRequestUrl,...t>0?{number:t}:{}}}let t=e.prRefs?.find(e=>e.origin===`created`||e.origin===`marker`);if(t)return{number:t.number,...t.url?{url:t.url}:{}};let n=e.markerRefs?.pr;return n===void 0?void 0:{number:n}}function $o(e){return es(e)[0]?.url??ts(e)[0]}function es(e,t){if(!e.prRefs?.length)return ts(e).map(e=>({number:Number(q(e)),url:e,origin:`legacy`})).filter(e=>Number.isInteger(e.number)&&e.number>0);let n={created:0,marker:1,legacy:2,derived:3};return[...e.prRefs].sort((e,t)=>n[e.origin]-n[t.origin]).map(e=>({number:e.number,url:e.url??cs(`PR`,e.number,t),origin:e.origin}))}function ts(e){let t=[];return e.pullRequestUrl&&t.push(e.pullRequestUrl),!(e.markerRefs?.issue!==void 0&&e.markerRefs?.pr===void 0)&&e.referencedPullRequestUrl&&t.push(e.referencedPullRequestUrl),t}function ns(e,t){if(e.referencedIssueUrl)return e.referencedIssueUrl;let n=e.markerRefs?.issue??e.issueNumber;if(!(!n||!t)&&!rs(e.referencedIssueCandidates,n,t))return`${t}/issues/${n}`}function rs(e,t,n){let r=`${n.toLowerCase()}/`;return(e??[]).some(e=>e.endsWith(`/${t}`)&&!e.toLowerCase().startsWith(r))}function is(e,t){return e.map((e,t)=>({reference:e,index:t})).sort((e,n)=>{let r=e.reference.kind===`PR`&&t(e.reference)===`closed`,i=n.reference.kind===`PR`&&t(n.reference)===`closed`;return Number(r)-Number(i)||e.index-n.index}).map(({reference:e})=>e)}function as(e,t){let n=e.prRefs?.length?es(e,t).map(e=>({number:e.number,url:e.url})):ts(e).map(e=>({url:e,number:Number(q(e))||void 0})),r=e.markerRefs?.pr,i=[...r===void 0||n.some(e=>e.number===r)?[]:[{kind:`PR`,number:r}],...n.map(e=>({kind:`PR`,url:e.url,number:e.number})),{kind:`PR`,number:ss(e,t)},{kind:`Issue`,url:ns(e,t)},{kind:`Issue`,number:os(e,t)}],a=new Set,o=[];for(let e of i){let n=e.url?Number(q(e.url)):e.number;if(!n||!Number.isInteger(n))continue;let r=e.url??cs(e.kind,n,t),i=o.findIndex(t=>t.kind===e.kind&&t.number===n&&(!t.url||!r||t.url===r));if(i>=0){!o[i].url&&r&&(o[i]={...o[i],url:r});continue}let s=`${e.kind}#${n}#${r??``}`;a.has(s)||(a.add(s),o.push({kind:e.kind,number:n,...r?{url:r}:{}}))}return o}function os(e,t){let n=e.issueNumber;return n===void 0||!t?n:rs(e.referencedIssueCandidates,n,t)?void 0:n}function ss(e,t){let n=e.prNumber;return n===void 0||!t?n:rs(e.referencedPrCandidates,n,t)?void 0:n}function cs(e,t,n){if(n)return`${n}/${e===`PR`?`pull`:`issues`}/${t}`}function ls(e,t){return as(e,t)[0]}function q(e){let t=e.split(`/`).pop()??``;return/^\d+$/.test(t)?t:null}function us(e,t){let n=Ho.has(e.status)?t:void 0;if(n)return{cpu:{text:`${n.cpuPct.toFixed(0)}%`,kind:`live`},mem:{text:Go(n.rssBytes),kind:`live`}};let r=Go(e.peakRssBytes);return{cpu:{text:``,kind:`none`},mem:r?{text:`peak ${r}`,kind:`peak`,title:`peak — run finished${e.peakProcCount?` · ${e.peakProcCount} procs`:``}`}:{text:``,kind:`none`}}}function ds(e,t){let n=e.filter(e=>t===`archived`?e.archived:!e.archived),r=new Map;for(let e of n){if(!e.groupId)continue;let t=r.get(e.groupId);t?t.push(e):r.set(e.groupId,[e])}return[...r.entries()].flatMap(([e,t])=>{let n=t[0];return!n||t.length<2||!t.every(e=>Uo.has(e.status))?[]:[{groupId:e,title:ko(n),count:t.length}]})}function fs(e){let t=new Map;for(let n of e)for(let e of n.tags??[]){let n=e.toLowerCase();t.has(n)||t.set(n,e)}return[...t.values()].sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:`base`}))}function ps(e,t,n,r=8){let i=n.trim().toLowerCase(),a=new Set(t.map(e=>e.toLowerCase())),o=e.filter(e=>{let t=e.toLowerCase();return a.has(t)?!1:i===``||t.includes(i)&&t!==i});return i===``?o.slice(0,r):o.sort((e,t)=>Number(t.toLowerCase().startsWith(i))-Number(e.toLowerCase().startsWith(i))||e.localeCompare(t,void 0,{sensitivity:`base`})).slice(0,r)}function ms(e){let t=new Map;for(let n of e){let e=n.trim();if(!e)continue;let r=e.toLowerCase();t.has(r)||t.set(r,e)}return[...t.values()].sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:`base`}))}var hs=`/api/v1/ws`,gs=3e3,_s=1e3,vs=7e4,ys=0,bs=1;function xs(e){let t=new Map,n=new Map,r=null,i,a,o,s=()=>{clearTimeout(o),o=setTimeout(()=>{o=void 0,r?.close()},vs)},c=()=>e??`${location.protocol===`https:`?`wss:`:`ws:`}//${location.host}${hs}`,l=e=>{r?.readyState===bs&&r.send(JSON.stringify(e))},u=()=>{let e=globalThis.WebSocket;if(typeof e!=`function`||r&&(r.readyState===ys||r.readyState===bs))return;let a=new e(c());r=a,a.addEventListener(`open`,()=>{if(a===r){s();for(let e of t.keys())l({type:`subscribe`,topic:e})}}),a.addEventListener(`message`,e=>{if(a!==r)return;s();let i;try{i=JSON.parse(e.data)}catch{return}if(typeof i!=`object`||!i)return;let{type:o,topic:c,data:l}=i;if(typeof c!=`string`)return;if(o===`error`){for(let e of[...n.get(c)??[]])e();return}if(o!==`event`)return;let u=t.get(c);if(u)for(let e of[...u])e(l)}),a.addEventListener(`close`,()=>{a===r&&(r=null,clearTimeout(o),o=void 0,t.size>0&&i===void 0&&(i=setTimeout(()=>{i=void 0,t.size>0&&u()},gs)))}),a.addEventListener(`error`,()=>void 0)};return{subscribe(e,s,c){let d=()=>c?.();c&&(n.has(e)||n.set(e,new Set),n.get(e).add(d));let f=t.get(e);f||(f=new Set,t.set(e,f));let p=f.size===0;f.add(s),clearTimeout(a),a=void 0,r?p&&l({type:`subscribe`,topic:e}):(clearTimeout(i),i=void 0,u());let m=!0;return()=>{m&&(m=!1,n.get(e)?.delete(d),n.get(e)?.size||n.delete(e),f.delete(s),!(f.size>0)&&(t.delete(e),l({type:`unsubscribe`,topic:e}),t.size===0&&a===void 0&&(a=setTimeout(()=>{a=void 0,!(t.size>0)&&(clearTimeout(i),i=void 0,clearTimeout(o),o=void 0,r?.close(),r=null)},_s))))}}}}var Ss=null;function Cs(e,t,n){return Ss??=xs(),Ss.subscribe(e,t,n)}var J={secrets:{allFor:e=>[`secrets`,e],list:()=>[`secrets`,r()]},e2e:{allFor:e=>[`e2e`,e],status:()=>[`e2e`,r()]},tracker:{allFor:e=>[`tracker`,e],all:()=>[`tracker`,r()],associationFor:e=>[`tracker`,e,`association`],association:()=>[`tracker`,r(),`association`],candidates:(e,t=``)=>[`tracker`,r(),`candidates`,e,t],connection:()=>[`tracker`,r(),`connection`],items:(e,t)=>[`tracker`,r(),`items`,e.kind,e.source.id,e.source.webUrl,e.externalId,e.connectionId??null,t.state,[...t.labels],t.query??``],detail:(e,t)=>[`tracker`,r(),`detail`,e.kind,e.source.id,e.source.webUrl,e.externalId,e.connectionId??null,t]},get health(){return[r(),`health`]},runs:{get all(){return[r(),`runs`]},list:()=>[r(),`runs`,`list`],detail:e=>[r(),`runs`,`detail`,e],diff:e=>[r(),`runs`,`diff`,e],changes:e=>[r(),`runs`,`changes`,e],gitStatus:e=>[r(),`runs`,`git-status`,e],file:(e,t)=>[r(),`runs`,`files`,e,t],handoff:e=>[r(),`runs`,`handoff`,e],drafts:e=>[r(),`runs`,`drafts`,e],commits:e=>[r(),`runs`,`commits`,e],tree:e=>[r(),`runs`,`tree`,e],commit:(e,t)=>[r(),`runs`,`commit`,e,t]},groups:{detail:e=>[r(),`groups`,e]},get todos(){return[r(),`todos`]},get workflows(){return[r(),`workflows`]},get workflowNodes(){return[r(),`workflow-nodes`]},get skills(){return[r(),`skills`]},get skillsReady(){return[r(),`skills`,`ready`]},get importableSkills(){return[r(),`skills`,`importable`]},get importableSkillsReady(){return[r(),`skills`,`importable`,`ready`]},get launchKey(){return[r(),`launch-key`]},get repo(){return[r(),`repo`]},get repoChanges(){return[r(),`repo`,`changes`]},repoCommit:e=>[r(),`repo`,`commit`,e],get repoSync(){return[r(),`repo`,`sync`]},get repoTree(){return[r(),`repo`,`tree`]},repoFile:e=>[r(),`repo`,`file`,e],get uiState(){return[r(),`ui-state`]},get config(){return[r(),`config`]},get agentConfig(){return[r(),`agent-config`]},agentConfigFile:e=>[r(),`agent-config`,`file`,e],get worktrees(){return[r(),`worktrees`]},github:(e={})=>[r(),`github`,e.limit??null],githubPages:(e=50)=>[r(),`github`,`pages`,e],githubChecks:e=>[r(),`github`,`checks`,[...e].sort((e,t)=>e-t).join(`,`)],githubSearch:(e,t)=>[r(),`github`,`search`,e,t],githubRefStatus:(e,t,n)=>[e,`github`,`ref-status`,[...t].sort((e,t)=>e-t).join(`,`),[...n].sort((e,t)=>e-t).join(`,`)],githubComments:(e,t)=>[r(),`github`,`comments`,e,t],githubMergeState:e=>[r(),`github`,`merge-state`,e],get openTargets(){return[r(),`open-targets`]}},ws=6e4;function Ts(){return j({queryKey:J.secrets.list(),queryFn:({signal:e})=>ir({signal:e})})}function Es(){return j({queryKey:Y.secrets,queryFn:({signal:e})=>ar({signal:e})})}function Ds(){return j({queryKey:J.e2e.status(),queryFn:({signal:e})=>ur({signal:e})})}function Os(){return j({queryKey:J.tracker.connection(),queryFn:({signal:e})=>tr({signal:e})})}function ks(){return j({queryKey:J.tracker.association(),queryFn:({signal:e})=>fr({signal:e})})}function As(e,t,n){return N({queryKey:J.tracker.candidates(e,t),staleTime:ws,queryFn:({pageParam:n,signal:r})=>pr(e,{q:t.trim()||void 0,cursor:n,limit:50},{signal:r}),initialPageParam:void 0,getNextPageParam:e=>e.available&&e.truncated?e.nextCursor:void 0,enabled:n})}var js=class extends Error{failure;constructor(e){super(e.reason),this.failure=e,this.name=`TrackerRefreshError`}};function Ms(e,t,n=!0){let i=t.query.trim(),a=A(),o=e?J.tracker.items(e,{...t,query:i}):[`tracker`,r(),`items`,`unassociated`];return{...N({queryKey:o,staleTime:1/0,queryFn:({pageParam:n,signal:r})=>i?vr(i,{association:e??void 0,cursor:n,limit:50,state:t.state,labels:t.labels,refresh:!0},{signal:r}):_r({association:e??void 0,cursor:n,limit:50,state:t.state,labels:t.labels,refresh:!1},{signal:r}),initialPageParam:void 0,getNextPageParam:e=>e.available&&e.truncated?e.nextCursor:void 0,enabled:e!=null&&n}),queryKey:o,restart:async()=>{await a.cancelQueries({queryKey:o,exact:!0});try{await a.fetchInfiniteQuery({queryKey:o,initialPageParam:void 0,pages:1,getNextPageParam:e=>e.available&&e.truncated?e.nextCursor:void 0,staleTime:0,retry:!1,queryFn:async({signal:n})=>{let r={association:e??void 0,limit:50,state:t.state,labels:t.labels,refresh:!0},a=i?await vr(i,r,{signal:n}):await _r(r,{signal:n});if(!a.available)throw new js(a);return a}})}catch{}}}}function Ns(e,t){return j({staleTime:ws,queryKey:e&&t?J.tracker.detail(e,t):[`tracker`,r(),`detail`,`disabled`],queryFn:({signal:n})=>yr(t,{signal:n,association:e??void 0}),enabled:e!=null&&t!=null&&t!==``})}var Y={dashboard:[`workspace`,`dashboard`],models:e=>[`workspace`,`models`,e],providerStatus:[`workspace`,`providers`,`status`],projects:[`workspace`,`projects`],githubOwners:[`workspace`,`github-owners`],runsIndex:[`workspace`,`runs-index`],secrets:[`workspace`,`secrets`],uiState:[`workspace`,`ui-state`],config:[`workspace`,`config`],hostUsage:[`workspace`,`host-usage`],agentProfiles:[`workspace`,`agent-profiles`],agentAccountDetails:e=>[`workspace`,`agent-profiles`,`details`,e],agentAccountStatus:e=>[`workspace`,`agent-profiles`,`status`,e],skillsUpdateAll:[`workspace`,`skills-update`],skillsUpdate:e=>[`workspace`,`skills-update`,e],selfUpdate:[`workspace`,`self-update`],selfUpdateDevelopment:[`workspace`,`self-update`,`development`],starCount:[`workspace`,`star-count`],telemetryConsent:[`workspace`,`telemetry-consent`],fsBrowseRoot:[`workspace`,`fs-browse`],fsBrowse:(e,t=!1)=>[...Y.fsBrowseRoot,e,t]};function X(e,t=!0){return j({queryKey:Y.models(e),queryFn:({signal:t})=>d(e)?bn(e,{signal:t}):Promise.reject(Error(`${e} has no host model catalog`)),staleTime:300*1e3,enabled:t&&d(e)})}function Ps(e=!0){let t=X(`claude`,e),n=X(`codex`,e),r=X(`opencode`,e),i=X(`cursor`,e),a=X(`pi`,e);return{claude:t,codex:n,junie:X(`junie`,e),opencode:r,cursor:i,pi:a,copilot:X(`copilot`,e)}}function Fs(){let e=A();return j({queryKey:Y.providerStatus,queryFn:async({signal:t})=>{let n=e.getQueryData(Y.providerStatus),r=await xn(!1,{signal:t});return Gt(n,e.getQueryData(Y.providerStatus),r)},staleTime:5*6e4,refetchInterval:!1,refetchOnWindowFocus:!0})}function Is(){let e=A();return M({mutationFn:()=>xn(!0),onMutate:()=>e.getQueryData(Y.providerStatus),onSuccess:(t,n,r)=>e.setQueryData(Y.providerStatus,e=>Gt(r,e,t))})}function Ls(){let e=A();return M({mutationFn:({provider:e,authFailureId:t})=>Ir(e,t),onMutate:()=>e.getQueryData(Y.providerStatus),onSuccess:(t,n,r)=>{e.setQueryData(Y.providerStatus,e=>Gt(r,e,t,n.authFailureId))}})}function Rs(){return j({queryKey:Y.projects,queryFn:({signal:e})=>Cn({signal:e})})}function zs(e,t=!1){return j({queryKey:Y.fsBrowse(e,t),queryFn:({signal:n})=>wn(e??void 0,{signal:n,showHidden:t}),retry:!1})}function Bs(){let e=A();return M({mutationFn:e=>Lr(e),onSuccess:()=>e.invalidateQueries({queryKey:Y.projects})})}function Vs(){let e=A();return M({mutationFn:e=>Vr(e),retry:!1,onSuccess:()=>{e.invalidateQueries({queryKey:Y.projects})}})}function Hs(){let e=A();return M({mutationFn:e=>{let{id:t,...n}=e;return Hr(t,n)},retry:!1,onMutate:async({id:t,...n})=>{await e.cancelQueries({queryKey:Y.projects});let r=e.getQueryData(Y.projects);return e.setQueryData(Y.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t?Us(e,n):e)}),{previous:r}},onError:(t,n,r)=>{r?.previous&&e.setQueryData(Y.projects,r.previous)},onSuccess:({project:t})=>{e.setQueryData(Y.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t.id?t:e)})},onSettled:()=>e.invalidateQueries({queryKey:Y.projects})})}function Us(e,t){let{maxParallel:n,tags:r,...i}=e,a={...i},o=`maxParallel`in t?t.maxParallel:e.maxParallel;o!=null&&(a.maxParallel=o);let s=`tags`in t&&t.tags!==void 0?t.tags:e.tags,c=s==null?[]:ms(s);return c.length>0&&(a.tags=c),a}function Ws(e){let t=A();return M({mutationFn:e,retry:!1,onSuccess:async()=>{await Promise.all([t.invalidateQueries({queryKey:Y.agentProfiles}),t.invalidateQueries({queryKey:Y.projects})])}})}function Gs(){return Ws(e=>ca(e))}function Ks(){return Ws(e=>{let{id:t,...n}=e;return pa(t,n)})}function qs(){return Ws(e=>ma(e))}function Js(){return Ws(e=>fa(e))}function Ys(e,t){return j({queryKey:Y.agentAccountDetails(e),queryFn:({signal:t})=>ua(e,{signal:t}),enabled:t,staleTime:0,retry:!1})}function Xs(e,t){return j({queryKey:Y.agentAccountStatus(e),queryFn:({signal:t})=>la(e,{signal:t}),enabled:t,staleTime:6e4,retry:!1})}function Zs(){let e=A();return M({mutationFn:({provider:e,profileId:t})=>Nr(e,t),retry:!1,onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:Y.agentProfiles}),e.invalidateQueries({queryKey:Y.providerStatus})])}})}function Qs(){let e=A();return M({mutationFn:e=>la(e,{recheck:!0}),retry:!1,onSuccess:(t,n)=>{e.setQueryData(Y.agentAccountStatus(n),t),e.invalidateQueries({queryKey:Y.agentProfiles})}})}function $s(){return M({mutationFn:e=>{let{routeId:t,...n}=e;return da(t,n)},retry:!1})}function ec(){let e=A();return M({mutationFn:e=>Rr(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:Y.projects})})}function tc(){let e=A();return M({mutationFn:e=>zr(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:Y.projects})})}function nc(){return j({queryKey:Y.githubOwners,queryFn:({signal:e})=>Br({signal:e}),staleTime:5*6e4,retry:!1})}function rc(){let e=A();(0,k.useEffect)(()=>{let t,n=()=>{let n=e.getQueryData(J.health)?.capabilities?.localHandoff===!0;n&&t===void 0?t=Cs(`health`,t=>{e.setQueryData(J.health,t)}):!n&&t!==void 0&&(t(),t=void 0)};n();let r=e.getQueryCache().subscribe(n);return()=>{r(),t?.()}},[e])}function ic(){return j({queryKey:J.health,queryFn:({signal:e})=>hn({signal:e}),refetchInterval:e=>oc(e.state.data)})}var ac=3e4;function oc(e){return e?.capabilities?.localHandoff===!1&&e.forge!=null&&e.forge.available!==!0&&ac}function sc(){let e=ic().data,t=Rs().data?.projects,{projectId:n}=It(),r=n??e?.bootProject,i=r===void 0?void 0:t?.find(e=>e.id===r);return i?.repoUrl?i.repoUrl:n===null||n===e?.bootProject?Zo(e?.repo?.remote,e?.forge?.kind===`github`):void 0}function cc(){return j({queryKey:J.openTargets,queryFn:({signal:e})=>hi({signal:e}),staleTime:5*6e4})}function lc(e){return j({queryKey:J.runs.list(),queryFn:({signal:e})=>Tn({signal:e}),select:e})}function uc(e=!0,t){return j({queryKey:Y.runsIndex,queryFn:({signal:e})=>Dn({signal:e}),enabled:e,staleTime:3e4,...t===void 0?{}:{refetchInterval:typeof t==`function`?e=>t(e.state.data):t}})}function dc(e,t=!0,n=!1,r){return j({queryKey:[n?`default`:e,`runs`,`list`],queryFn:({signal:t})=>En(e,{signal:t}),enabled:t,select:r})}function fc(e,t,n){let r=e==="default"?null:e,i=r===null||t!=null&&r===t;return dc(i?`default`:r??`default`,!0,i,n)}function pc(e){return{queryKey:J.runs.detail(e),queryFn:({signal:t})=>On(e,{signal:t})}}function mc(e){return j({...pc(e??``),enabled:!!e})}function hc(e,t,n=!0){return j({queryKey:[e??`default`,`runs`,`detail`,t??``],queryFn:({signal:n})=>kn(e,t,{signal:n}),enabled:n&&!!e&&!!t})}function gc(e){return j({queryKey:J.runs.diff(e??``),queryFn:({signal:t})=>Dr(e,{signal:t}),enabled:!!e})}function _c(e,t=!1){return j({queryKey:J.runs.changes(e??``),queryFn:({signal:t})=>kr(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:t?4e3:!1,refetchOnWindowFocus:!0,staleTime:0})}function vc(e,t,n=!1){return j({queryKey:J.runs.gitStatus(e),queryFn:({signal:t})=>bi(e,{signal:t}),enabled:t,retry:!1,refetchInterval:n?1e4:!1,refetchOnWindowFocus:!0,staleTime:0})}function yc(e,t=!0){return j({queryKey:J.runs.tree(e??``),queryFn:({signal:t})=>Xn(e,{signal:t}),enabled:t&&!!e,retry:!1,staleTime:0})}function bc(e,t){return j({queryKey:J.runs.file(e??``,t??``),queryFn:({signal:n})=>Ar(e,t,{signal:n}),enabled:!!e&&t!==void 0,retry:!1})}function xc(e){return j({queryKey:J.groups.detail(e??``),queryFn:({signal:t})=>Mr(e,{signal:t}),enabled:!!e})}function Sc(e,t=!1){return j({queryKey:J.runs.commits(e??``),queryFn:({signal:t})=>Zn(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:t?5e3:!1})}function Cc(e,t){return j({queryKey:J.runs.commit(e??``,t??``),queryFn:({signal:n})=>Qn(e,t,{signal:n}),enabled:!!e&&!!t,retry:!1})}function wc(e,t=!0){return j({queryKey:J.runs.handoff(e??``),queryFn:({signal:t})=>Or(e,{signal:t}),enabled:!!e&&t})}function Tc(e){return j({queryKey:J.runs.drafts(e??``),queryFn:({signal:t})=>Ei(e,{signal:t}),enabled:!!e,staleTime:1/0,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:!1})}function Ec(e=!0){return j({queryKey:J.todos,queryFn:({signal:e})=>zn({signal:e}),enabled:e})}function Dc(){return j({queryKey:J.workflowNodes,queryFn:({signal:e})=>Yi({signal:e}),staleTime:1/0})}function Oc(e={}){return j({queryKey:J.workflows,enabled:e.enabled??!0,queryFn:({signal:e})=>Nn({signal:e})})}function kc(e=!0){let t=A(),n=J.skills,r=n[0],i=j({queryKey:n,queryFn:({signal:e})=>Pn({signal:e}),enabled:e}),a=j({queryKey:J.skillsReady,queryFn:({signal:e})=>Fn({signal:e}),enabled:e&&i.isSuccess,staleTime:1/0,retry:!1});return(0,k.useEffect)(()=>{Array.isArray(a.data)&&t.setQueryData([r,`skills`],a.data)},[t,a.data,r]),i}function Ac(e=!0){let t=A(),n=J.importableSkills,r=n[0],i=j({queryKey:n,queryFn:({signal:e})=>Ln({signal:e}),enabled:e}),a=j({queryKey:J.importableSkillsReady,queryFn:({signal:e})=>Rn({signal:e}),enabled:e&&i.isSuccess,staleTime:1/0,retry:!1});return(0,k.useEffect)(()=>{Array.isArray(a.data)&&t.setQueryData([r,`skills`,`importable`],a.data)},[t,a.data,r]),i}function jc(){return j({queryKey:J.launchKey,queryFn:({signal:e})=>Sn({signal:e}),staleTime:1/0})}function Mc(){return j({queryKey:J.repo,queryFn:({signal:e})=>Bn({signal:e})})}function Nc(){return j({queryKey:J.repoSync,queryFn:({signal:e})=>Fi({signal:e}),refetchOnWindowFocus:!0})}function Pc(){let e=A();return M({mutationFn:e=>Ii(e),onSuccess:t=>{e.setQueryData(J.repoSync,t.sync),e.invalidateQueries({queryKey:J.repo,predicate:e=>e.queryKey[2]!==`sync`})}})}function Fc(){return j({queryKey:J.repoChanges,queryFn:({signal:e})=>Gn({signal:e}),retry:!1})}function Ic(){return j({queryKey:J.repoTree,queryFn:({signal:e})=>Kn({signal:e}),retry:!1,refetchOnWindowFocus:!0,staleTime:0})}function Lc(e){return j({queryKey:J.repoFile(e??``),queryFn:({signal:t})=>qn(e,{signal:t}),enabled:e!==void 0&&e!==``,retry:!1,refetchOnWindowFocus:!0,staleTime:0})}function Rc(e){return j({queryKey:J.repoCommit(e??``),queryFn:({signal:t})=>Yn(e,{signal:t}),enabled:!!e,retry:!1})}function zc(){return j({queryKey:J.config,queryFn:({signal:e})=>Vn({signal:e})})}function Bc(){return j({queryKey:J.worktrees,queryFn:({signal:e})=>Da({signal:e})})}function Vc(){return j({queryKey:J.uiState,queryFn:({signal:e})=>Mn({signal:e})})}function Hc(){return j({queryKey:J.agentConfig,queryFn:({signal:e})=>Hn({signal:e})})}function Uc(e){return j({queryKey:J.agentConfigFile(e??``),queryFn:({signal:t})=>Un(e,{signal:t}),enabled:e!==null})}function Wc(e){let t=A(),n=J.agentConfig,r=J.agentConfigFile(e);return M({mutationFn:t=>Wn(e,t),onSuccess:e=>{t.setQueryData(r,e),t.invalidateQueries({queryKey:n})}})}function Gc(){return j({queryKey:Y.uiState,queryFn:({signal:e})=>ta({signal:e})})}function Kc(){return j({queryKey:Y.config,queryFn:({signal:e})=>ra({signal:e})})}function qc(){return j({queryKey:Y.agentProfiles,queryFn:({signal:e})=>sa({signal:e})})}var Jc=1e4;function Yc(e=!0){return j({queryKey:Y.starCount,queryFn:({signal:e})=>gn({signal:e}),enabled:e,staleTime:Jc,refetchInterval:Jc,retry:!1,refetchOnMount:!1})}function Xc(){return j({queryKey:Y.telemetryConsent,queryFn:({signal:e})=>vn({signal:e}),staleTime:1/0,retry:!1})}var Zc=6;function Qc(e,t=!0){return j({queryKey:Y.skillsUpdate(e),queryFn:({signal:t})=>ha(e,{signal:t}),enabled:t,refetchInterval:e=>{let t=e.state.data?.status;return(t===void 0||t===`checking`||t===`updating`||t===`idle`&&e.state.dataUpdateCount<Zc)&&6e4}})}function $c(e=!0){return j({queryKey:Y.selfUpdate,queryFn:({signal:e})=>va({signal:e}),enabled:e,refetchInterval:e=>e.state.data?.job?.status===`running`?1e3:e.state.data?.scheduled?5e3:!1})}function el(e=!0){return j({queryKey:Y.selfUpdateDevelopment,queryFn:({signal:e})=>ba({signal:e}),enabled:e,staleTime:3e4})}function tl(){let e=A();return M({mutationFn:()=>ba({refresh:!0}),onSuccess:t=>e.setQueryData(Y.selfUpdateDevelopment,t)})}function nl(){let e=A();return M({mutationFn:()=>ya(),onSuccess:t=>e.setQueryData(Y.selfUpdate,t)})}function rl(){let e=A();return M({mutationFn:e=>xa(e),onSuccess:t=>e.setQueryData(Y.selfUpdate,t)})}function il(){let e=A();return M({mutationFn:e=>Sa(e),onSuccess:t=>e.setQueryData(Y.selfUpdate,t)})}function al(){let e=A();return M({mutationFn:e=>Ca(e),onSuccess:t=>e.setQueryData(Y.selfUpdate,t)})}function ol(){let e=A();return M({mutationFn:()=>wa(),onSuccess:t=>e.setQueryData(Y.selfUpdate,t)})}function sl(e){let t=A();return M({mutationFn:t=>li(e,t),onSuccess:e=>{cl(t,e),t.invalidateQueries({queryKey:J.runs.all})}})}function cl(e,t){e.setQueryData(J.runs.list(),e=>e?.map(e=>e.id===t.id?G(e,t):e)),e.setQueryData(J.runs.detail(t.id),e=>e?G(e,t):t),ll(e)}function ll(e){e.invalidateQueries({queryKey:Y.runsIndex})}function ul(){let e=A();return M({mutationFn:e=>$r(e),onMutate:async t=>{await e.cancelQueries({queryKey:J.runs.list()}),await e.cancelQueries({queryKey:J.runs.detail(t)});let n=e.getQueryData(J.runs.list()),r=e.getQueryData(J.runs.detail(t)),i=new Date().toISOString();return e.setQueryData(J.runs.list(),e=>e?.map(e=>e.id===t?{...e,seenAt:i}:e)),e.setQueryData(J.runs.detail(t),e=>e&&{...e,seenAt:i}),{prevList:n,prevDetail:r,id:t}},onError:(t,n,r)=>{r?.prevList&&e.setQueryData(J.runs.list(),r.prevList),r?.prevDetail&&e.setQueryData(J.runs.detail(n),r.prevDetail)},onSuccess:t=>{let n=e=>e.id===t.id?{...e,seenAt:t.seenAt}:e;e.setQueryData(J.runs.list(),e=>e?.map(n)),e.setQueryData(J.runs.detail(t.id),e=>e?n(e):t),ll(e)}})}function dl(){let e=A();return M({mutationFn:e=>ei(e),onMutate:async t=>{await e.cancelQueries({queryKey:J.runs.list()}),await e.cancelQueries({queryKey:J.runs.detail(t)});let n=e.getQueryData(J.runs.list()),r=e.getQueryData(J.runs.detail(t));return e.setQueryData(J.runs.list(),e=>e?.map(e=>e.id===t?fl(e):e)),e.setQueryData(J.runs.detail(t),e=>e&&fl(e)),{prevList:n,prevDetail:r,id:t}},onError:(t,n,r)=>{r?.prevList&&e.setQueryData(J.runs.list(),r.prevList),r?.prevDetail&&e.setQueryData(J.runs.detail(n),r.prevDetail)},onSuccess:t=>{let n=e=>e.id===t.id?fl(e):e;e.setQueryData(J.runs.list(),e=>e?.map(n)),e.setQueryData(J.runs.detail(t.id),e=>e?n(e):t),ll(e)}})}function fl(e){let{seenAt:t,...n}=e;return n}function pl(e,t,n){let r=A();return M({mutationFn:({id:n,pinned:r,surface:i})=>t===void 0?qr(n,r,i??e):Jr(t,n,r,i??e),onSuccess:()=>r.invalidateQueries({queryKey:n===void 0?J.runs.all:[n,`runs`]})})}function ml(e,t,n){let r=A();return M({mutationFn:({id:n,archived:r})=>t===void 0?Kr(n,r,e):Yr(t,n,r,e),onSuccess:()=>r.invalidateQueries({queryKey:n===void 0?J.runs.all:[n,`runs`]})})}function hl(e,t){let n=A();return M({mutationFn:n=>t===void 0?Si(e,n):Ci(t,e,n),onSuccess:()=>n.invalidateQueries({queryKey:J.runs.all}),onError:e=>{e instanceof I&&e.status===409&&n.invalidateQueries({queryKey:J.runs.all})}})}function gl(e,t){let n=A();return M({mutationFn:(n={})=>t===void 0?ii(e,n):ai(t,e,n),onSuccess:()=>n.invalidateQueries({queryKey:J.runs.all})})}function _l(e){let t=A();return M({mutationFn:({msgId:t,message:n})=>wi(e,t,n),onSuccess:()=>t.invalidateQueries({queryKey:J.runs.all})})}function vl(e){let t=A();return M({mutationFn:t=>Ti(e,t),onSuccess:()=>t.invalidateQueries({queryKey:J.runs.all})})}function yl(e={},t=!0){return j({queryKey:J.github(e),queryFn:({signal:t})=>$n({limit:e.limit},{signal:t}),enabled:t})}function bl(e=50,t=!0){return N({queryKey:J.githubPages(e),queryFn:({pageParam:t,signal:n})=>$n({limit:e,issuesCursor:t.issuesCursor,prsCursor:t.prsCursor},{signal:n}),initialPageParam:{issuesCursor:void 0,prsCursor:void 0},getNextPageParam:e=>{let t=e.issuesNextCursor??void 0,n=e.prsNextCursor??void 0;return t||n?{issuesCursor:t,prsCursor:n}:void 0},enabled:t,staleTime:6e4})}function xl(e,t=!0){return j({queryKey:J.githubChecks(e),queryFn:({signal:t})=>br(e,{signal:t}),enabled:t&&e.length>0,staleTime:6e4})}function Sl(e,t,n=!0){return j({queryKey:J.githubSearch(e,t),queryFn:({signal:n})=>xr(e,t,{},{signal:n}),enabled:n&&t.trim()!==``,staleTime:6e4})}var Cl=100;function wl(e){return[...e].sort((e,t)=>t-e).slice(0,Cl).sort((e,t)=>e-t)}var Z=new Map(Al()),Tl=1e3;function El(e,t){if(Z.get(e)!==t){for(Z.delete(e),Z.set(e,t);Z.size>Tl;){let e=Z.keys().next().value;if(e===void 0)break;Z.delete(e)}Nl()}}var Q=new Set(jl());function Dl(e,t){if(Q.has(e)!==t){if(t)for(Q.add(e);Q.size>Tl;){let e=Q.values().next().value;if(e===void 0)break;Q.delete(e)}else Q.delete(e);Nl()}}var Ol=`cez.reference-statuses.v1`,kl=`cez.reference-conflicts.v1`;function Al(){try{let e=globalThis.sessionStorage?.getItem(Ol);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>Array.isArray(e)&&e.length===2&&typeof e[0]==`string`&&fo(e[1])):[]}catch{return[]}}function jl(){try{let e=globalThis.sessionStorage?.getItem(kl);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}var Ml;function Nl(){Ml===void 0&&(Ml=setTimeout(()=>{Ml=void 0;try{globalThis.sessionStorage?.setItem(Ol,JSON.stringify([...Z])),globalThis.sessionStorage?.setItem(kl,JSON.stringify([...Q]))}catch{}},250))}function Pl(){let e=It(),t=ic();return e.projectId??t.data?.bootProject}function Fl(e){for(let[t,n]of Object.entries(e)){for(let[e,r]of Object.entries(n.prs))El($({projectId:t,kind:`PR`,number:Number(e)}),r);for(let[e,r]of Object.entries(n.issues))El($({projectId:t,kind:`Issue`,number:Number(e)}),r)}}var Il=5*6e4;function Ll(e){return e?e.recheckAfterMs:Il}var $=e=>`${e.projectId}\u0000${e.kind}#${e.number}`;function Rl(e,t=!0){let n=(0,k.useMemo)(()=>{let t=new Map;for(let n of e){let e=t.get(n.projectId)??{prs:new Set,issues:new Set};e[n.kind===`PR`?`prs`:`issues`].add(n.number),t.set(n.projectId,e)}return[...t.entries()].map(([e,t])=>({projectId:e,prs:wl(t.prs),issues:wl(t.issues)}))},[e.map($).sort().join(`|`)]),r=Mt({queries:n.map(e=>({queryKey:J.githubRefStatus(e.projectId,e.prs,e.issues),queryFn:({signal:t})=>Sr(e.projectId,{prs:e.prs,issues:e.issues},{signal:t}),enabled:t&&e.prs.length+e.issues.length>0,staleTime:e=>Ll(e.state.data)??1/0,refetchInterval:e=>Ll(e.state.data)??!1,refetchOnWindowFocus:!0}))}),{byRef:i,learned:a}=(0,k.useMemo)(()=>{let e=new Map,t=[];return r.forEach((r,i)=>{let a=n[i];if(!a)return;let o=[...a.prs.map(e=>({projectId:a.projectId,kind:`PR`,number:e})),...a.issues.map(e=>({projectId:a.projectId,kind:`Issue`,number:e}))],s=r.data;for(let n of o){let i=$(n),a=Z.get(i),o=Q.has(i)?!0:void 0;if(s?.available){let r=s.prs[n.number]??s.issues[n.number];if(r){let a=s.conflicts?s.conflicts.includes(n.number):void 0;t.push({key:i,status:r,conflicting:a}),e.set(i,{state:`ready`,status:r,...a??o?{conflicting:!0}:{}})}else e.set(i,{state:`unknown`,...a?{status:a}:{}})}else s?e.set(i,{state:`unavailable`,reason:s.reason,...a?{status:a}:{},...o?{conflicting:!0}:{}}):r.isError?e.set(i,{state:`unavailable`,reason:r.error instanceof Error?r.error.message:void 0,...a?{status:a}:{},...o?{conflicting:!0}:{}}):e.set(i,{state:`loading`,...a?{status:a}:{},...o?{conflicting:!0}:{}})}}),{byRef:e,learned:t}},[n,r.map(e=>`${e.dataUpdatedAt}:${e.status}`).join(`,`)]);return(0,k.useEffect)(()=>{for(let{key:e,status:t,conflicting:n}of a)El(e,t),n!==void 0&&Dl(e,n)},[a]),(0,k.useCallback)(e=>{let t=$(e),n=i.get(t);if(n)return n;let r=Z.get(t);return{state:`idle`,...r?{status:r}:{},...Q.has(t)?{conflicting:!0}:{}}},[i])}function zl(e,t,n=!0){return j({queryKey:J.githubComments(e,t),queryFn:({signal:n})=>Cr(e,t,{},{signal:n}),enabled:n,staleTime:6e4})}function Bl(e){return j({queryKey:[`github`,`pr-changes`,e??0],queryFn:({signal:t})=>Er(e,{},{signal:t}),enabled:e!==void 0,staleTime:6e4,retry:!1})}export{tl as $,Ya as $i,_a as $n,er as $r,cl as $t,xc as A,et as Aa,Ha as Ai,Ro as An,Vn as Ar,el as At,pl as B,S as Ba,Jn as Bi,bo as Bn,kn as Br,Os as Bt,yl as C,It as Ca,Ea as Ci,ko as Cn,$i as Cr,X as Ct,nc as D,yt as Da,ea as Di,Oo as Dn,Ui as Dr,al as Dt,bl as E,j as Ea,yn as Ei,Ao as En,la as Er,uc as Et,ul as F,Te as Fa,sr as Fi,mo as Fn,wr as Fr,Yc as Ft,Rs as G,or as Gi,ao as Gn,jn as Gr,Hs as Gt,hc as H,ge as Ha,Wi as Hi,po as Hn,Ei as Hr,Ms as Ht,dl as I,we as Ia,ka as Ii,_o as In,hn as Ir,Xc as It,Qs as J,Zi as Ji,G as Jn,qa as Jr,Kc as Jt,Fs as K,mr as Ki,co as Kn,Xa as Kr,Dc as Kt,$s as L,Ce as La,di as Li,yo as Ln,Sn as Lr,Ec as Lt,rc as M,D as Ma,Oa as Mi,Po as Mn,$n as Mr,rl as Mt,Ac as N,be as Na,In as Ni,Do as Nn,Cr as Nr,kc as Nt,Bl as O,A as Oa,Ta as Oi,Eo as On,qi as Or,Js as Ot,jc as P,w as Pa,Ma as Pi,Io as Pn,Er as Pr,Qc as Pt,nl as Q,Fr as Qi,ci as Qn,Ja as Qr,Y as Qt,cc as R,x as Ra,rr as Ri,K as Rn,Fa as Rr,ks as Rt,zs as S,Lt as Sa,xi as Si,zo as Sn,ji as Sr,Ps as St,zl as T,M as Ta,Za as Ti,Vo as Tn,ri as Tr,fc as Tt,dc as U,y as Ua,Gi as Ui,so as Un,Ar as Ur,Vc as Ut,sc as V,Ie as Va,Wa as Vi,uo as Vn,Mi as Vr,Ns as Vt,Ts as W,jr as Wi,oo as Wn,An as Wr,Ks as Wt,Rl as X,Vi as Xi,I as Xn,va as Xr,Gc as Xt,Pl as Y,cr as Yi,to as Yn,Ka as Yr,Es as Yt,Is as Z,Xr as Zi,Ra as Zn,ha as Zr,Bc as Zt,gl as _,Wt as _a,pi as _i,us as _n,Va as _r,Tc as _t,pc as a,Ga as aa,Pa as ai,Yo as an,z as ar,Fc as at,Ds as b,Jt as ba,Qa as bi,Bo as bn,ui as br,wc as bt,Hc as c,Pr as ca,Tr as ci,Go as cn,hr as cr,Nc as ct,il as d,Ua as da,vi as di,is as dn,ii as dr,Ls as dt,Ai as ea,yr as ei,Cs as en,Qr as er,Bs as et,ml as f,sn as fa,_i as fi,qo as fn,zi as fr,mc as ft,Zs as g,P as ga,li as gi,as as gn,si as gr,gc as gt,zc as h,Qt as ha,Qi as hi,ls as hn,Ur as hr,Sc as ht,Fl as i,fi as ia,Na as ii,ds as in,Wr as ir,Mc as it,ic as j,Ue as ja,ja as ji,Fo as jn,eo as jr,hl as jt,Sl as k,dt as ka,na as ki,Lo as kn,Ri as kr,$c as kt,Uc as l,ia as la,_n as li,Qo as ln,yi as lr,Pc as lt,ec as m,en as ma,Aa as mi,$o as mn,Pi as mr,Cc as mt,js as n,La as na,oa as ni,ps as nn,Kr as nr,Vs as nt,Ys as o,V as oa,ni as oi,Xo as on,Hi as or,Rc as ot,ol as p,$t as pa,mi as pi,ns as pn,$a as pr,_c as pt,Wc as q,nr as qi,io as qn,Ba as qr,Oc as qt,J as r,Gr as ra,ta as ri,Uo as rn,Zr as rr,vl as rt,Xs as s,Bi as sa,ti as si,Ko as sn,ga as sr,Lc as st,ws as t,dr as ta,_r as ti,fs as tn,Yr as tr,qs as tt,qc as u,Xi as ua,gi as ui,q as un,Nr as ur,Ic as ut,Gs as v,Vt as va,Li as vi,Jo as vn,Ji as vr,bc as vt,xl as w,N as wa,Oi as wi,No as wn,aa as wr,lc as wt,_l as x,qt as xa,za as xi,Mo as xn,Ni as xr,yc as xt,tc as y,Ut as ya,ki as yi,jo as yn,Ki as yr,vc as yt,sl as z,Ee as za,lr as zi,vo as zn,Ia as zr,As as zt};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ca as r,Ea as i,Hn as a,Oa as o,Rr as s,Ta as c,Vn as l,X as u,Zn as d,ai as f,ii as p,wa as m,zr as h}from"./queries-C09jaXiS.js";import{A as g,B as _,C as v,D as y,E as b,F as x,N as S,S as C,T as w,_ as ee,a as te,c as ne,d as re,g as ie,h as ae,i as T,l as oe,m as se,o as E,r as D,s as ce,t as le,u as ue,v as de,x as fe,y as pe}from"./button-DFlig-3W.js";import{a as O,c as me,l as k,o as he,s as ge}from"./tooltip-BieGyrAz.js";import{t as A}from"./circle-check-D3dWBsEI.js";import{n as _e,r as ve,t as ye}from"./triangle-alert-lwmk_SnN.js";import{t as be}from"./git-pull-request-draft-D2Lm-pPz.js";import{t as xe}from"./x-BrRT8S7Q.js";import{i as Se}from"./token-metrics-BJ1naBNS.js";var j={all:(e=_())=>[`worktree-lifecycle`,e],list:(e=_())=>[...j.all(e),`list`],detail:(e,t=_())=>[...j.all(t),`worktree`,e],operation:(e,t=_())=>[...j.all(t),`operation`,e],output:(e,t=_())=>[...j.all(t),`output`,e]};function Ce(){return r(),i({queryKey:j.list(),queryFn:async({signal:e})=>{let t=await p({limit:100},{signal:e}),n=new Map(t.worktrees.map(e=>[e.worktreeId,e])),r=new Set,i=t.nextCursor;for(;i&&!r.has(i);){r.add(i);let t=await p({limit:100,cursor:i},{signal:e});for(let e of t.worktrees)n.set(e.worktreeId,e);i=t.nextCursor}return{worktrees:[...n.values()]}}})}function we(e,t=!0){return r(),i({queryKey:j.detail(e),enabled:t,queryFn:({signal:t})=>f(e,{signal:t})})}function Te(e){return r(),i({queryKey:j.operation(e),queryFn:({signal:t})=>s(e,{signal:t})})}function Ee(e,t){return r(),m({queryKey:j.output(e),enabled:t,initialPageParam:0,queryFn:({signal:t,pageParam:n})=>h(e,n,{signal:t}),getNextPageParam:e=>e.items.length>=100?e.nextSeq:void 0,maxPages:5})}function De(e){let t=o();r();let n=_();return c({mutationFn:t=>d(e,t),onSuccess:r=>{t.setQueryData(j.operation(e,n),r),t.invalidateQueries({queryKey:j.all(n)}),t.invalidateQueries({queryKey:[`runs`,n]}),t.invalidateQueries({queryKey:[`worktrees`,n]})},onError:()=>{t.invalidateQueries({queryKey:j.operation(e,n)})}})}var M=x(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),N=x(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),P=x(`circle-slash`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]]),F=x(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),Oe=x(`git-pull-request-closed`,[[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 9v12`,key:`1sc30k`}],[`path`,{d:`m21 3-6 6`,key:`16nqsk`}],[`path`,{d:`m21 9-6-6`,key:`9j17rh`}],[`path`,{d:`M18 11.5V15`,key:`65xf6f`}],[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}]]),ke=x(`message-square-warning`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 15h.01`,key:`q59x07`}],[`path`,{d:`M12 7v4`,key:`xawao1`}]]),Ae=x(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),I=e(t(),1),L=n(),R=`Popover`,[z,je]=b(R,[k]),B=k(),[Me,V]=z(R),H=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=B(t),c=I.useRef(null),[l,u]=I.useState(!1),[d,f]=v({prop:r,defaultProp:i??!1,onChange:a,caller:R});return(0,L.jsx)(me,{...s,children:(0,L.jsx)(Me,{scope:t,contentId:fe(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:I.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:I.useCallback(()=>u(!0),[]),onCustomAnchorRemove:I.useCallback(()=>u(!1),[]),modal:o,children:n})})};H.displayName=R;var U=`PopoverAnchor`,W=I.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=V(U,n),a=B(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return I.useEffect(()=>(o(),()=>s()),[o,s]),(0,L.jsx)(O,{...a,...r,ref:t})});W.displayName=U;var G=`PopoverTrigger`,K=I.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=V(G,n),a=B(n),o=S(t,i.triggerRef),s=(0,L.jsx)(y.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":Ue(i.open),...r,ref:o,onClick:w(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,L.jsx)(O,{asChild:!0,...a,children:s})});K.displayName=G;var q=`PopoverPortal`,[Ne,Pe]=z(q,{forceMount:void 0}),J=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=V(q,t);return(0,L.jsx)(Ne,{scope:t,forceMount:n,children:(0,L.jsx)(C,{present:n||a.open,children:(0,L.jsx)(ee,{asChild:!0,container:i,children:r})})})};J.displayName=q;var Y=`PopoverContent`,X=I.forwardRef((e,t)=>{let n=Pe(Y,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=V(Y,e.__scopePopover);return(0,L.jsx)(C,{present:r||a.open,children:a.modal?(0,L.jsx)(Ie,{...i,ref:t}):(0,L.jsx)(Le,{...i,ref:t})})});X.displayName=Y;var Fe=g(`PopoverContent.RemoveScroll`),Ie=I.forwardRef((e,t)=>{let n=V(Y,e.__scopePopover),r=I.useRef(null),i=S(t,r),a=I.useRef(!1);return I.useEffect(()=>{let e=r.current;if(e)return se(e)},[]),(0,L.jsx)(ae,{as:Fe,allowPinchZoom:!0,children:(0,L.jsx)(Re,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:w(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:w(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:w(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),Le=I.forwardRef((e,t)=>{let n=V(Y,e.__scopePopover),r=I.useRef(!1),i=I.useRef(!1);return(0,L.jsx)(Re,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),Re=I.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=V(Y,n),p=B(n);return ie(),(0,L.jsx)(de,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,L.jsx)(pe,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,L.jsx)(ge,{"data-state":Ue(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),ze=`PopoverClose`,Be=I.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=V(ze,n);return(0,L.jsx)(y.button,{type:`button`,...r,ref:t,onClick:w(e.onClick,()=>i.onOpenChange(!1))})});Be.displayName=ze;var Ve=`PopoverArrow`,He=I.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=B(n);return(0,L.jsx)(he,{...i,...r,ref:t})});He.displayName=Ve;function Ue(e){return e?`open`:`closed`}var We=H,Ge=W,Ke=K,qe=J,Je=X;function Ye({...e}){return(0,L.jsx)(te,{"data-slot":`dialog`,...e})}function Xe({...e}){return(0,L.jsx)(ue,{"data-slot":`dialog-portal`,...e})}function Ze({className:e,...t}){return(0,L.jsx)(oe,{"data-slot":`dialog-overlay`,className:D(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function Qe({className:e,children:t,showCloseButton:n=!0,...r}){return(0,L.jsxs)(Xe,{"data-slot":`dialog-portal`,children:[(0,L.jsx)(Ze,{}),(0,L.jsxs)(ce,{"data-slot":`dialog-content`,className:D(`fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-card p-6 shadow-modal duration-200 outline-none 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 sm:max-w-lg`,e),...r,children:[t,n&&(0,L.jsxs)(E,{"data-slot":`dialog-close`,className:`absolute top-4 right-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,L.jsx)(xe,{}),(0,L.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function $e({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`dialog-header`,className:D(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function et({className:e,showCloseButton:t=!1,children:n,...r}){return(0,L.jsxs)(`div`,{"data-slot":`dialog-footer`,className:D(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,L.jsx)(E,{asChild:!0,children:(0,L.jsx)(le,{variant:`outline`,children:`Close`})})]})}function tt({className:e,...t}){return(0,L.jsx)(re,{"data-slot":`dialog-title`,className:D(`text-lg leading-none font-semibold`,e),...t})}function nt({className:e,...t}){return(0,L.jsx)(ne,{"data-slot":`dialog-description`,className:D(`text-sm text-muted-foreground`,e),...t})}var rt=(0,I.createContext)(null);function it({children:e}){let[t,n]=(0,I.useState)(()=>new Map),r=(0,I.useCallback)((e,t)=>{n(n=>{let r=new Map(n);return r.set(e,t),r})},[]),i=(0,I.useCallback)(e=>{n(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),a=u((0,I.useMemo)(()=>[...t.values()].flat(),[t])),o=(0,I.useMemo)(()=>({publish:r,retract:i,lookup:a}),[r,i,a]);return(0,L.jsx)(rt.Provider,{value:o,children:e})}var Z=(0,I.createContext)(null);function at({projectId:e,requests:t,children:n}){let r=(0,I.useContext)(rt),i=(0,I.useId)(),a=t.map(e=>`${e.projectId} ${e.kind}#${e.number}`).sort().join(`|`),o=r?.publish,s=r?.retract;(0,I.useEffect)(()=>{if(!(!o||!s))return o(i,t),()=>s(i)},[o,s,i,a]);let c=u(r?ot:t),l=r?.lookup??c,d=(0,I.useMemo)(()=>({lookup:l,projectId:e}),[l,e]);return(0,L.jsx)(Z.Provider,{value:d,children:n})}var ot=[];function st(e,t,n){let r=(0,I.useContext)(Z),i=n??r?.projectId;return!r||!i||t===void 0?lt:r.lookup({projectId:i,kind:e,number:t})}function ct(){let e=(0,I.useContext)(Z);return{lookup:e?.lookup??(()=>lt),projectId:e?.projectId}}var lt=Object.freeze({state:`idle`});function Q(e){let t=e.visualViewport;return t?Math.max(0,Math.round(e.innerHeight-t.height-t.offsetTop)):0}function ut(e,t,n,r=250){let i=e.visualViewport;if(!i)return t(0),()=>{};let a,o=()=>{let i=Q(e);t(i),n&&(clearTimeout(a),a=setTimeout(()=>n(i),r))};return t(Q(e)),i.addEventListener(`resize`,o),i.addEventListener(`scroll`,o),()=>{clearTimeout(a),i.removeEventListener(`resize`,o),i.removeEventListener(`scroll`,o),t(0)}}function dt(e){let t=e.visualViewport;return t?{top:Math.max(0,Math.round(t.offsetTop)),bottom:Q(e)}:{top:0,bottom:0}}function ft(e,t=0){let n=typeof t==`number`?{top:t,right:t,bottom:t,left:t}:t;return{top:(n.top??0)+e.top,right:n.right??0,bottom:(n.bottom??0)+e.bottom,left:n.left??0}}function pt(e,t){let n=e.visualViewport;if(!n)return t({top:0,bottom:0}),()=>{};let r=()=>t(dt(e));return r(),n.addEventListener(`resize`,r),n.addEventListener(`scroll`,r),()=>{n.removeEventListener(`resize`,r),n.removeEventListener(`scroll`,r)}}function mt(){let[e,t]=(0,I.useState)({top:0,bottom:0});return(0,I.useEffect)(()=>pt(window,e=>t(t=>t.top===e.top&&t.bottom===e.bottom?t:e)),[]),e}function ht(e){let t=(0,I.useRef)(e);t.current=e,(0,I.useEffect)(()=>{let e=document.documentElement;return ut(window,t=>e.style.setProperty(`--kb`,`${t}px`),e=>t.current?.(e))},[])}function gt({...e}){return(0,L.jsx)(We,{"data-slot":`popover`,...e})}function _t({...e}){return(0,L.jsx)(Ke,{"data-slot":`popover-trigger`,...e})}function vt({className:e,align:t=`center`,sideOffset:n=4,collisionPadding:r,...i}){let a=mt();return(0,L.jsx)(qe,{children:(0,L.jsx)(Je,{"data-slot":`popover-content`,align:t,sideOffset:n,collisionPadding:ft(a,r),className:D(`z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden 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`,e),...i})})}function yt({...e}){return(0,L.jsx)(Ge,{"data-slot":`popover-anchor`,...e})}var bt={success:`border-success/40 text-success`,danger:`border-danger/40 text-danger`,violet:`border-violet/35 text-violet`,info:`border-info/40 text-info`,neutral:`border-border text-muted-foreground`,pending:`border-pending-strong/45 text-pending-strong`,conflict:`border-conflict/45 text-conflict`},xt={success:`hover:bg-success/10`,danger:`hover:bg-danger/10`,violet:`hover:bg-violet/10`,info:`hover:bg-info/10`,neutral:`hover:bg-muted`,pending:`hover:bg-pending-strong/10`,conflict:`hover:bg-conflict/10`},St={draft:be,"review-required":_e,"changes-requested":ke,"checks-pending":null,"checks-failing":F,ready:A,merged:ve,closed:Oe,open:N,completed:A,"not-planned":P};function Ct({reference:e,taskTitle:t,status:n,conflicting:r,conflictAction:i,projectId:o,className:s,compact:c=!1}){let{kind:u,number:d,url:f}=e,p=st(u,d,o),m=n??p.status,h=a(m),g=u===`PR`&&(r??p.conflicting)===!0,_=g?l:h,v=D(`inline-flex h-[22px] items-center gap-1 rounded-full border px-2 font-mono text-[11px] font-semibold`,bt[_?.tone??`violet`],s),y=Ot(p,_,g?h:void 0),b=d?`${!c&&u===`Issue`?`Issue `:``}#${d}`:u,x=u===`PR`?`pull request`:`issue`,S=`Open the ${x} for ${t}${_?` — ${_.label}`:``}`,C=(0,L.jsxs)(L.Fragment,{children:[g?(0,L.jsx)(ye,{className:`size-2.5 shrink-0`,"aria-hidden":`true`}):(0,L.jsx)(At,{status:_?m:void 0}),b]}),w=!f||!T(f)?(0,L.jsx)(`span`,{"data-slot":u===`PR`?`pr-chip`:`issue-chip`,"data-status":m,...g?{"data-conflicting":`true`}:{},"aria-label":_?`${x} ${b} — ${_.label}`:void 0,className:v,children:C}):(0,L.jsxs)(`a`,{"data-slot":u===`PR`?`pr-chip`:`issue-chip`,"data-status":m,...g?{"data-conflicting":`true`}:{},href:f,target:`_blank`,rel:`noopener noreferrer`,title:y?void 0:f,"aria-label":S,className:D(v,xt[_?.tone??`violet`]),children:[C,(0,L.jsx)(M,{className:`size-2.5`,"aria-hidden":`true`})]});if(!y)return w;let ee=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`span`,{className:`block font-medium`,children:[u===`PR`?`Pull request`:`Issue`,d?` #${d}`:``,` · `,y.headline]}),(0,L.jsx)(`span`,{className:`block`,children:y.detail}),y.also?(0,L.jsx)(`span`,{className:`block opacity-70`,children:y.also}):null,f&&T(f)?(0,L.jsx)(`span`,{className:`block opacity-70`,children:f.replace(/^https?:\/\//,``)}):null]});return(0,L.jsx)(Dt,{chip:w,action:g?i:void 0,state:p.state,children:ee})}var wt=(0,I.createContext)(()=>{});function Tt(){return(0,I.useContext)(wt)}var Et=150,$=120;function Dt({chip:e,action:t,state:n,children:r}){let[i,a]=(0,I.useState)(!1),o=(0,I.useRef)(null),s=(0,I.useRef)(null),c=(0,I.useRef)(void 0),l=(0,I.useCallback)((e,t)=>{clearTimeout(c.current),c.current=setTimeout(()=>a(e),t)},[]),u=(0,I.useCallback)(()=>{clearTimeout(c.current),a(!1)},[]);(0,I.useEffect)(()=>()=>clearTimeout(c.current),[]);let d=e=>e instanceof Node&&(s.current?.contains(e)||o.current?.contains(e));return(0,L.jsxs)(gt,{open:i,onOpenChange:e=>e?a(!0):u(),children:[(0,L.jsx)(yt,{asChild:!0,ref:o,onPointerEnter:e=>{e.pointerType!==`touch`&&l(!0,Et)},onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,$)},onFocus:()=>a(!0),onBlur:e=>{d(e.relatedTarget)||u()},onKeyDown:e=>{if(e.key===`Escape`)return u();if(e.key!==`Tab`||e.shiftKey||!t)return;let n=s.current?.querySelector(`button:not([disabled]), [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`);n&&(e.preventDefault(),n.focus())},...t?{"aria-haspopup":`dialog`,"aria-expanded":i}:{},children:e}),(0,L.jsxs)(vt,{ref:s,side:`top`,role:t?`dialog`:`tooltip`,"data-slot":`reference-status-card`,"data-tooltip-state":n,className:`w-64 space-y-2 p-3 text-xs`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>{e.preventDefault(),d(document.activeElement)&&o.current?.focus()},onPointerEnter:()=>clearTimeout(c.current),onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,$)},children:[(0,L.jsx)(`div`,{className:`space-y-0.5`,children:r}),t?(0,L.jsx)(wt.Provider,{value:u,children:t}):null]})]})}function Ot(e,t,n){if(t){let{label:r,hint:i}=t,a=n?`also ${kt(n.label)} — ${n.hint}`:void 0;return e.state===`unavailable`?{headline:r,detail:`last known — GitHub is unreachable${e.reason?` (${e.reason})`:``}`,...a?{also:a}:{}}:{headline:r,detail:i,...a?{also:a}:{}}}switch(e.state){case`loading`:return{headline:`Checking GitHub…`,detail:`the status of this reference is on its way`};case`unavailable`:return{headline:`Status unavailable`,detail:e.reason??`GitHub could not be reached — the chip says nothing rather than guessing`};case`unknown`:return{headline:`Not found on this repository`,detail:`GitHub has no such number here — the reference may point at another repo`};default:return null}}function kt(e){return e.charAt(0).toLowerCase()+e.slice(1)}function At({status:e}){if(!e)return null;if(e===`checks-pending`)return(0,L.jsx)(Se,{tone:`pending`,pulse:!0,className:`size-[6px]`,"aria-hidden":`true`});let t=St[e];return t?(0,L.jsx)(t,{className:`size-2.5 shrink-0`,"aria-hidden":`true`}):null}export{j as C,we as D,Ee as E,Ce as O,M as S,Te as T,tt as _,vt as a,P as b,at as c,ct as d,Ye as f,$e as g,et as h,yt as i,it as l,nt as m,Tt as n,_t as o,Qe as p,gt as r,ht as s,Ct as t,st as u,Ae as v,De as w,N as x,F as y};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{C as r,Ci as i,Oa as a,Ta as o,Xn as s,at as c,ct as l,it as u,j as d,lt as f,mr as p,ot as m,r as h,ut as g}from"./queries-C09jaXiS.js";import{F as _,i as v,r as y,t as b}from"./button-DFlig-3W.js";import{c as x,f as S,t as C,w}from"./project-router-Uv5K_t7U.js";import{t as T}from"./use-desktop-BNN3U2y9.js";import{a as ee,c as te,d as ne,f as E,i as re,l as ie,o as ae,p as oe,r as se,s as ce,t as le}from"./file-preview-B0UXYkxB.js";import{t as D}from"./arrow-left-FG-BtI91.js";import{n as O,t as ue}from"./file-Bu00nVUj.js";import{t as de}from"./check-Bg7-Ecuy.js";import{t as fe}from"./chevron-right-7BUoNLSN.js";import{c as k,d as A,f as pe,o as me,p as j,s as M,t as he,u as N}from"./git-toolbar-aXyXLu2P.js";import{n as P}from"./upload-Dx8IzFX_.js";import{n as F,t as I}from"./triangle-alert-lwmk_SnN.js";import{t as L}from"./plus-BqHBcC4w.js";import{t as R}from"./search-x-CG0S6SUu.js";import{t as z}from"./input-6sILF4ZL.js";import{t as ge}from"./diff-stat-BIAV32IP.js";import{t as B}from"./centered-state-Cm8_dS47.js";import{a as _e}from"./index-DxwI2MZD.js";import{t as ve}from"./markdown-DDUUmNxl.js";import{t as V}from"./diff-DZjcij_W.js";import{t as H}from"./commit-list-C_l41PzR.js";var U=_(`cloud-upload`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]]),W=e(t(),1),G=n();function ye(){let e=l(),t=f();if(!e.data)return null;let n=e.data,r=e=>t.mutate(e,{onSuccess:e=>S(e.message),onError:e=>S(e.message,{tone:`danger`,expected:e instanceof s&&e.status===409})}),i=t.isPending,a=t.variables;return(0,G.jsxs)(`div`,{"data-slot":`repo-sync`,className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-[11px]`,children:[n.upstream?(0,G.jsxs)(`span`,{"data-slot":`repo-upstream`,className:`truncate font-mono text-soft-foreground`,title:`Upstream`,children:[`→ `,n.upstream]}):n.branch?(0,G.jsx)(`span`,{"data-slot":`repo-upstream`,className:`text-soft-foreground`,children:`not published`}):(0,G.jsx)(`span`,{"data-slot":`repo-upstream`,className:`text-soft-foreground`,children:`detached HEAD`}),n.upstream?(0,G.jsx)(q,{ahead:n.ahead,behind:n.behind}):n.outgoing.length>0?(0,G.jsx)(q,{ahead:n.outgoing.length,behind:null}):null,(0,G.jsx)(`span`,{"data-slot":`repo-fetched`,className:`hidden text-soft-foreground sm:inline`,children:n.lastFetchedAt?`fetched ${xe(n.lastFetchedAt)}`:`never fetched`}),(0,G.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,G.jsx)(K,{which:`fetch`,label:`Fetch`,busy:i,pending:a,onClick:r,disabled:!n.pushRemote,children:(0,G.jsx)(N,{"aria-hidden":`true`,className:y(i&&a===`fetch`&&`animate-spin`)})}),n.upstream?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(K,{which:`pull`,label:`Pull`,busy:i,pending:a,onClick:r,disabled:!n.behind,children:(0,G.jsx)(oe,{"aria-hidden":`true`})}),(0,G.jsx)(K,{which:`push`,label:`Push`,busy:i,pending:a,onClick:r,disabled:!n.ahead,children:(0,G.jsx)(O,{"aria-hidden":`true`})}),(0,G.jsx)(K,{which:`sync`,label:`Sync`,busy:i,pending:a,onClick:r,disabled:!n.ahead&&!n.behind,variant:`outline`,children:(0,G.jsx)(N,{"aria-hidden":`true`,className:y(i&&a===`sync`&&`animate-spin`)})})]}):n.branch&&n.pushRemote?(0,G.jsx)(K,{which:`push`,label:`Publish branch`,busy:i,pending:a,onClick:r,variant:`outline`,children:(0,G.jsx)(U,{"aria-hidden":`true`})}):null]})]})}function K({which:e,label:t,busy:n,pending:r,onClick:i,disabled:a,variant:o=`ghost`,children:s}){return(0,G.jsxs)(b,{variant:o,size:`sm`,"data-action":`repo-${e}`,"aria-busy":n&&r===e,disabled:n||a,onClick:()=>i(e),children:[s,t]})}function q({ahead:e,behind:t}){return e===null&&t===null?null:!e&&!t?(0,G.jsx)(`span`,{"data-slot":`sync-counts`,className:`text-soft-foreground`,children:`in sync`}):(0,G.jsxs)(`span`,{"data-slot":`sync-counts`,className:`flex items-center gap-1 font-mono`,children:[e?(0,G.jsxs)(`span`,{"data-sync":`ahead`,title:`${e} to push`,className:`text-primary`,children:[`↑`,e]}):null,t?(0,G.jsxs)(`span`,{"data-sync":`behind`,title:`${t} to pull`,className:`text-warning`,children:[`↓`,t]}):null]})}function be({name:e,sync:t}){if(!t)return null;let n=t.branches.find(t=>t.name===e),r=n?n.gone?`upstream gone`:n.upstream?null:`local only`:`remote only`;return(0,G.jsx)(`span`,{"data-slot":`branch-tracking`,className:`flex shrink-0 items-center gap-1 text-[11px]`,children:r?(0,G.jsx)(`span`,{className:`text-soft-foreground`,children:r}):(0,G.jsx)(q,{ahead:n.ahead,behind:n.behind})})}function xe(e){let t=Math.max(0,Math.round((Date.now()-Date.parse(e))/1e3));if(t<60)return`just now`;let n=Math.round(t/60);if(n<60)return`${n} min ago`;let r=Math.round(n/60);return r<24?`${r} h ago`:`${Math.round(r/24)} d ago`}function Se({repo:e,info:t}){let n=d(),r=l(),s=a(),c=e=>S(e.message,{tone:`danger`}),u=o({mutationFn:e=>p({name:e}),onSuccess:async e=>{S(e.created?`Created and switched to ${e.branch}`:`Switched to ${e.branch}`),await Promise.all([s.invalidateQueries({queryKey:h.repo}),s.invalidateQueries({queryKey:h.health})]),s.setQueryData(h.repo,t=>t?.info?{...t,info:{...t.info,branch:e.branch}}:t),s.setQueryData(h.health,n=>n?.repo?.root===t.root?{...n,repo:{...n.repo,branch:e.branch}}:n)},onError:c}),f=o({mutationFn:e=>i({baseBranch:e}),onSuccess:e=>{S(e.baseBranch?`Agents now branch from ${e.baseBranch}`:`Agents now fork from the checked-out branch`),s.invalidateQueries({queryKey:h.repo})},onError:c}),[m,g]=(0,W.useState)(``),[_,v]=(0,W.useState)(``),x=_.trim().toLowerCase(),C=x?e.branches.filter(e=>e.toLowerCase().includes(x)):e.branches;return(0,G.jsxs)(`section`,{"data-slot":`repo-branches`,className:`flex flex-col gap-6 px-4 py-4 md:px-6`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{className:`text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Branches`}),(0,G.jsx)(z,{"aria-label":`Filter branches`,placeholder:`Filter branches…`,value:_,onChange:e=>v(e.target.value),className:`mt-2 max-w-xl`}),(0,G.jsxs)(`ul`,{"data-slot":`repo-branch-list`,className:`mt-2 flex max-w-xl flex-col divide-y divide-border`,children:[C.map(n=>{let i=n===t.branch,a=e.checkedOutElsewhere?.[n];return(0,G.jsxs)(`li`,{"data-slot":`branch-row`,"data-branch":n,className:`flex min-h-9 items-center gap-2 py-1`,children:[(0,G.jsx)(A,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,G.jsx)(`span`,{className:y(`min-w-0 truncate font-mono text-xs`,i&&`font-semibold`),children:n}),(0,G.jsx)(be,{name:n,sync:r.data}),i?(0,G.jsxs)(`span`,{"data-slot":`branch-current`,className:`flex shrink-0 items-center gap-1 rounded-sm bg-muted px-1.5 py-px text-[10px] font-medium text-muted-foreground`,children:[(0,G.jsx)(de,{"aria-hidden":`true`,className:`size-3`}),`current`]}):a?(0,G.jsx)(`span`,{"data-slot":`branch-elsewhere`,title:`Checked out in ${a}`,className:`ml-auto shrink-0 text-[11px] text-soft-foreground`,children:`in another worktree`}):(0,G.jsx)(b,{variant:`ghost`,size:`sm`,"data-action":`switch-branch`,className:`ml-auto`,disabled:u.isPending,onClick:()=>u.mutate(n),children:`Switch`})]},n)}),C.length===0?(0,G.jsxs)(`li`,{"data-slot":`branch-empty`,className:`py-3 text-xs text-soft-foreground`,children:[`No branches match “`,_.trim(),`”.`]}):null]}),(0,G.jsxs)(`form`,{"data-slot":`branch-create`,className:`mt-3 flex max-w-md items-center gap-2`,onSubmit:e=>{e.preventDefault();let t=m.trim();t&&u.mutate(t,{onSuccess:()=>g(``)})},children:[(0,G.jsx)(z,{"aria-label":`New branch name`,placeholder:`new-branch-name`,value:m,onChange:e=>g(e.target.value)}),(0,G.jsxs)(b,{type:`submit`,variant:`outline`,size:`sm`,"data-action":`create-branch`,disabled:!m.trim()||u.isPending,children:[(0,G.jsx)(L,{"aria-hidden":`true`}),`Create`]})]})]}),(0,G.jsxs)(`div`,{className:`max-w-md`,children:[(0,G.jsx)(`label`,{htmlFor:`base-branch-picker`,className:`text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Agents’ base branch`}),(0,G.jsxs)(`select`,{id:`base-branch-picker`,"data-slot":`base-branch-picker`,value:e.baseBranch??``,disabled:f.isPending,onChange:e=>f.mutate(e.target.value===``?null:e.target.value),className:`mt-1.5 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:[(0,G.jsx)(`option`,{value:``,children:`follow checked-out branch (default)`}),e.branches.map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))]}),(0,G.jsx)(`p`,{className:`mt-1 text-[11px] text-soft-foreground`,children:`New task worktrees branch from this.`})]}),n.data?.forge?.available?(0,G.jsx)(Ce,{}):null]})}function Ce(){let e=r({limit:20});return(0,G.jsxs)(`div`,{"data-slot":`repo-prs`,className:`max-w-xl`,children:[(0,G.jsx)(`h2`,{className:`text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Open pull requests`}),e.isPending?(0,G.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`Loading pull requests…`}):e.isError?(0,G.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:e.error.message}):e.data.available?e.data.prs.length===0?(0,G.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`No open pull requests.`}):(0,G.jsx)(`ul`,{className:`mt-2 flex flex-col divide-y divide-border`,children:e.data.prs.map(e=>(0,G.jsx)(we,{pr:e},e.number))}):(0,G.jsx)(`p`,{"data-slot":`repo-prs-unavailable`,className:`mt-2 text-xs text-soft-foreground`,children:e.data.reason??`The forge is unreachable right now.`})]})}function we({pr:e}){let t=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(F,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,G.jsxs)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:[`#`,e.number]}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px]`,children:e.title}),e.checks?(0,G.jsx)(Te,{checks:e.checks}):null]}),n=`flex min-w-0 items-center gap-2 rounded-sm px-1.5 py-2`;return(0,G.jsx)(`li`,{"data-slot":`pr-row`,"data-number":e.number,children:v(e.url)?(0,G.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:y(n,`hover:bg-muted`),children:t}):(0,G.jsx)(`span`,{className:n,children:t})})}function Te({checks:e}){return(0,G.jsx)(`span`,{"data-slot":`pr-checks`,"data-checks":e,className:y(`shrink-0 text-[10px] font-medium`,e===`passing`&&`text-success`,e===`failing`&&`text-danger`,e===`pending`&&`text-muted-foreground`),children:e})}function Ee(){let e=c(),t=T(),[n,r]=(0,W.useState)(`unified`),[i,a]=(0,W.useState)(!1),[o,l]=(0,W.useState)(!1),[u,d]=(0,W.useState)(null),f=(0,W.useRef)(null),p=(0,W.useRef)(null),[m,h]=te(),g=ce(m),_=e.isError&&e.error instanceof s&&e.error.status===409,v=e.data?.files??[],b=(0,W.useMemo)(()=>re(v),[v]),x=(0,W.useMemo)(()=>v.some(ve),[v]),S=t?n:`unified`,C=!t||i;return(0,G.jsxs)(`section`,{"data-slot":`repo-changes`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,G.jsxs)(`div`,{"data-slot":`repo-changes-toolbar`,className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Uncommitted changes`}),e.data?(0,G.jsx)(he,{stat:e.data.stat}):null,(0,G.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,G.jsx)(M,{mode:n,wrap:i,preview:o,onModeChange:r,onWrapChange:a,onPreviewChange:x?l:void 0})})]}),e.isPending?(0,G.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading changes…`}):e.isError?(0,G.jsx)(B,{icon:_?(0,G.jsx)(j,{}):(0,G.jsx)(I,{}),tone:_?`neutral`:`danger`,heading:`h2`,title:_?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):v.length===0?(0,G.jsx)(B,{icon:(0,G.jsx)(j,{}),tone:`neutral`,heading:`h2`,title:`Working tree clean`,subtitle:`No uncommitted changes in the main working tree. Edits show up here as they happen.`}):(0,G.jsxs)(`div`,{className:`flex min-h-0 flex-1 gap-5 px-4 py-4 max-md:[--diff-sticky-top:7rem] md:px-6 md:py-0`,children:[(0,G.jsx)(`aside`,{ref:p,"data-slot":`changes-tree-pane`,style:g.style,className:y(`hidden w-60 max-w-[60%] shrink-0 overflow-y-auto overscroll-contain py-4 md:block lg:w-72`,g.className),children:(0,G.jsx)(ie,{root:b,selected:u,onSelect:e=>{d(e),f.current?.scrollToPath(e)}})}),(0,G.jsx)(ae,{paneRef:p,width:m,onWidthChange:h,className:`hidden md:block`}),(0,G.jsx)(`div`,{"data-slot":`diff-pane`,"data-diff-scroller":t?``:void 0,className:`min-w-0 flex-1 md:overflow-y-auto md:overscroll-contain`,children:(0,G.jsx)(V,{files:v,viewRef:f,mode:S,wrap:C,preview:t&&x&&o,className:`min-w-0 md:py-4`})})]})]})}function De({log:e}){let{sha:t}=w(),n=l().data;if(t)return(0,G.jsx)(Oe,{sha:t});let r=new Set(n?.outgoing??[]),i=n?.incoming??[],a=(e,t)=>({sha:e.hash,shaLabel:e.hash,subject:e.subject,author:e.author,when:e.when,href:`/git/commits/${e.hash}`,...t?{sync:t}:{}}),o=i.length>0?(0,G.jsxs)(`section`,{"data-slot":`repo-incoming`,className:`border-b border-border`,children:[(0,G.jsxs)(`h2`,{className:`px-4 pt-3 text-[11px] font-medium text-muted-foreground md:px-6`,children:[`Incoming from `,n?.upstream,` · `,i.length]}),(0,G.jsx)(H,{slot:`repo-incoming-commits`,commits:i.map(e=>a(e,`incoming`))})]}):null;return e.length===0?(0,G.jsx)(B,{icon:(0,G.jsx)(P,{}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`The log is empty — this repository has no commits to show.`}):(0,G.jsxs)(G.Fragment,{children:[o,(0,G.jsx)(H,{slot:`repo-commits`,commits:e.map(e=>a(e,r.has(e.hash)?`outgoing`:void 0))})]})}function Oe({sha:e}){let t=m(e),n=T(),[r,i]=(0,W.useState)(`unified`),[a,o]=(0,W.useState)(!1),c=t.isError&&t.error instanceof s&&t.error.status===409,l=n?r:`unified`,u=!n||a;return(0,G.jsxs)(`section`,{"data-slot":`repo-commit`,"data-sha":e,className:`flex min-h-0 flex-1 flex-col`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,G.jsx)(b,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,G.jsxs)(C,{to:`/git/commits`,children:[(0,G.jsx)(D,{"aria-hidden":`true`}),`All commits`]})}),t.data?(0,G.jsx)(ge,{stat:t.data.stat}):null,(0,G.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,G.jsx)(M,{mode:r,wrap:a,onModeChange:i,onWrapChange:o})})]}),t.isPending?(0,G.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commit…`}):t.isError?(0,G.jsx)(B,{icon:c?(0,G.jsx)(R,{}):(0,G.jsx)(I,{}),tone:c?`neutral`:`danger`,heading:`h2`,title:c?`Commit not found`:`Could not load the commit`,subtitle:t.error.message}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{"data-slot":`commit-meta`,className:`border-b border-border px-4 py-3 md:px-6`,children:[(0,G.jsx)(`h2`,{className:`text-sm font-semibold`,children:t.data.subject}),(0,G.jsxs)(`p`,{className:`mt-0.5 text-[11px] text-soft-foreground`,children:[t.data.author,` · `,t.data.when,` ·`,` `,(0,G.jsx)(`span`,{className:`font-mono select-all`,children:t.data.sha})]})]}),t.data.files.length===0?(0,G.jsx)(B,{icon:(0,G.jsx)(P,{}),tone:`neutral`,heading:`h2`,title:`No file changes`,subtitle:`This commit carries no diff of its own — a merge commit's changes live on the commits it merged.`}):(0,G.jsx)(`div`,{className:`px-4 py-4 [--diff-sticky-top:7rem] md:px-6`,children:(0,G.jsx)(V,{files:t.data.files,mode:l,wrap:u,className:`min-w-0`})})]})]})}function J(e,t){let n=0;for(let r of t){if(n=e.indexOf(r,n),n===-1)return!1;n+=r.length}return!0}function ke(e,t,n){let r=t.trim().toLowerCase();if(r===``)return{results:[...e],total:e.length};let i=[];for(let t of e){let e=t.toLowerCase();if(!J(e,r))continue;let n=e.slice(e.lastIndexOf(`/`)+1);i.push({path:t,basenameMatch:J(n,r)})}return i.sort((e,t)=>e.basenameMatch===t.basenameMatch?e.path.length===t.path.length?e.path.localeCompare(t.path):e.path.length-t.path.length:e.basenameMatch?-1:1),{results:i.slice(0,n).map(e=>e.path),total:i.length}}var Ae=200;function je({selected:e,onSelect:t}){let n=g(),r=n.isError&&n.error instanceof s&&n.error.status===409,i=n.data?.paths??[];return n.isPending?(0,G.jsx)(Y,{children:(0,G.jsx)(`p`,{"data-slot":`repo-files-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading files…`})}):n.isError?(0,G.jsx)(Y,{children:(0,G.jsx)(B,{icon:r?(0,G.jsx)(E,{}):(0,G.jsx)(I,{}),tone:r?`neutral`:`danger`,heading:`h2`,title:r?`No files to browse`:`Could not load the files`,subtitle:n.error.message})}):i.length===0?(0,G.jsx)(Y,{children:(0,G.jsx)(B,{icon:(0,G.jsx)(E,{}),tone:`neutral`,heading:`h2`,title:`No files yet`,subtitle:`Nothing is tracked in this repository. Files show up here once git knows about them.`})}):(0,G.jsxs)(Y,{children:[n.data.truncated?(0,G.jsxs)(`p`,{"data-slot":`repo-files-truncated`,role:`status`,className:`border-b border-border bg-muted/40 px-4 py-2 text-xs text-muted-foreground md:px-6`,children:[`Showing the first `,i.length.toLocaleString(),` files; this repository has more. The tree and the filter cover only what is loaded.`]}):null,(0,G.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-5 px-4 py-4 [--diff-sticky-top:7rem] md:flex-row md:items-start md:px-6`,children:[(0,G.jsx)(`aside`,{"data-slot":`repo-files-tree-pane`,className:y(`w-full shrink-0 md:sticky md:top-[var(--diff-sticky-top)] md:block md:max-h-[calc(100dvh_-_var(--diff-sticky-top)_-_1rem)] md:w-60 md:overflow-y-auto md:overscroll-contain lg:w-72`,e!==null&&`hidden`),children:(0,G.jsx)(Me,{paths:i,selected:e,onSelect:t})}),(0,G.jsxs)(`div`,{className:y(`min-w-0 flex-1`,e===null&&`hidden md:block`),children:[e===null?null:(0,G.jsxs)(`button`,{type:`button`,"data-slot":`repo-files-back`,onClick:()=>t(null),className:`mb-2 flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground md:hidden`,children:[(0,G.jsx)(D,{"aria-hidden":`true`,className:`size-3.5`}),`Back to the file tree`]}),(0,G.jsx)(le,{source:{kind:`repo`},path:e})]})]})]})}function Y({children:e}){return(0,G.jsx)(`section`,{"data-slot":`repo-files`,className:`flex min-h-0 flex-1 flex-col`,children:e})}function X(e){if(e===null)return[];let t=e.split(`/`);return t.slice(0,-1).map((e,n)=>t.slice(0,n+1).join(`/`))}function Z(e,t,n){let r=[];for(let i of e.dirs){let e=t.has(i.path);r.push({kind:`dir`,path:i.path,name:i.name,level:n,open:e}),e&&r.push(...Z(i,t,n+1))}for(let t of e.files)r.push({kind:`file`,path:t.path,name:t.name,level:n,label:t.name});return r}function Me({paths:e,selected:t,onSelect:n}){let[r,i]=(0,W.useState)(``),[a,o]=(0,W.useState)(()=>new Set(X(t))),[s,c]=(0,W.useState)(t),l=(0,W.useRef)(null);(0,W.useEffect)(()=>{let e=X(t);e.length!==0&&o(t=>{if(e.every(e=>t.has(e)))return t;let n=new Set(t);for(let t of e)n.add(t);return n})},[t]);let u=r.trim()!==``,d=(0,W.useMemo)(()=>ke(e,r,Ae),[e,r]),f=(0,W.useMemo)(()=>ee(e,(e,t)=>({kind:`file`,name:t,path:e})),[e]),p=(0,W.useMemo)(()=>u?d.results.map(e=>({kind:`file`,path:e,name:e.slice(e.lastIndexOf(`/`)+1),level:0,label:e})):Z(f,a,0),[u,d.results,f,a]),m=p.find(e=>e.path===s)??p[0],h=e=>o(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n});return(0,G.jsxs)(`div`,{"data-slot":`repo-files-browser`,className:`flex min-w-0 flex-col gap-2`,onKeyDown:e=>{e.key!==`/`||e.target===l.current||(e.preventDefault(),l.current?.focus())},children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(`label`,{htmlFor:`repo-files-filter`,className:`sr-only`,children:`Filter repository files`}),(0,G.jsx)(`input`,{id:`repo-files-filter`,ref:l,"data-slot":`repo-files-filter`,type:`search`,value:r,placeholder:`Filter files… (/)`,"aria-controls":`repo-files-tree`,autoComplete:`off`,spellCheck:!1,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),i(``))},className:`w-full rounded-sm border border-border bg-background px-2 py-1 text-xs placeholder:text-soft-foreground focus:border-foreground focus:outline-none`}),(0,G.jsx)(`p`,{"data-slot":`repo-files-count`,role:`status`,"aria-live":`polite`,className:`sr-only`,children:u?`${d.total} files match ${r.trim()}`:`${e.length} files`})]}),u&&d.total===0?(0,G.jsxs)(`p`,{"data-slot":`repo-files-no-match`,className:`px-1.5 py-1 text-xs text-soft-foreground`,children:[`No file matches `,(0,G.jsx)(`span`,{className:`font-mono`,children:r.trim()}),`.`]}):(0,G.jsx)(`div`,{id:`repo-files-tree`,"data-slot":`repo-files-tree`,"data-filtering":u?`true`:void 0,role:`tree`,"aria-label":`Repository files`,"aria-activedescendant":m?Q(m.path):void 0,onKeyDown:e=>{let t=p.findIndex(e=>e.path===m?.path),r=e=>{let t=p[Math.max(0,Math.min(p.length-1,e))];t&&c(t.path)},i=p[t];if(e.key===`ArrowDown`)e.preventDefault(),r(t+1);else if(e.key===`ArrowUp`)e.preventDefault(),r(t-1);else if(e.key===`ArrowRight`&&i?.kind===`dir`)e.preventDefault(),i.open?r(t+1):h(i.path);else if(e.key===`ArrowLeft`&&i!==void 0)if(e.preventDefault(),i.kind===`dir`&&i.open)h(i.path);else for(let e=t-1;e>=0;--e){let t=p[e];if(t.level<i.level){c(t.path);break}}else(e.key===`Enter`||e.key===` `)&&i!==void 0&&(e.preventDefault(),i.kind===`file`?n(i.path):h(i.path))},className:`min-w-0 text-[13px]`,children:p.map(e=>e.kind===`dir`?(0,G.jsx)(Ne,{row:e,focused:e.path===m?.path,onToggle:()=>{c(e.path),h(e.path)}},e.path):(0,G.jsx)(Pe,{row:e,active:e.path===t,focused:e.path===m?.path,onSelect:()=>{c(e.path),n(e.path)}},e.path))}),u&&d.total>d.results.length?(0,G.jsxs)(`p`,{"data-slot":`repo-files-more`,className:`px-1.5 py-1 text-xs text-soft-foreground`,children:[(d.total-d.results.length).toLocaleString(),` more — refine the filter.`]}):null]})}var Q=e=>`repo-file-row-${e}`,$=(e,t)=>({paddingLeft:`${t+e*14}px`});function Ne({row:e,focused:t,onToggle:n}){return(0,G.jsxs)(`div`,{id:Q(e.path),role:`treeitem`,"aria-expanded":e.open,"aria-level":e.level+1,"data-slot":`repo-files-dir`,"data-path":e.path,"data-state":e.open?`open`:`closed`,tabIndex:t?0:-1,onClick:n,className:`flex w-full min-w-0 cursor-pointer items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground focus:bg-muted focus:outline-none`,style:$(e.level,6),children:[(0,G.jsx)(fe,{"aria-hidden":`true`,className:y(`size-3.5 shrink-0 transition-transform`,e.open&&`rotate-90`)}),(0,G.jsx)(pe,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,G.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:e.name})]})}function Pe({row:e,active:t,focused:n,onSelect:r}){let i=se(e.path)?ne:ue;return(0,G.jsxs)(`div`,{id:Q(e.path),role:`treeitem`,"aria-level":e.level+1,"aria-selected":t,"aria-current":t?`true`:void 0,"data-slot":`repo-files-file`,"data-path":e.path,tabIndex:n?0:-1,onClick:r,className:y(`flex w-full min-w-0 cursor-pointer items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted focus:outline-none`,t?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:$(e.level,24),children:[(0,G.jsx)(i,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,G.jsx)(`span`,{className:`min-w-0 truncate`,title:e.label,children:e.label})]})}function Fe({tab:e}){let t=u();if(t.isPending)return(0,G.jsx)(_e,{});if(t.isError)return(0,G.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,G.jsx)(B,{icon:(0,G.jsx)(I,{}),tone:`danger`,title:`Could not load the repository`,subtitle:t.error.message})});let n=t.data.info;return n?(0,G.jsx)(Ie,{repo:t.data,info:n,tab:e}):(0,G.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,G.jsx)(B,{icon:(0,G.jsx)(A,{}),tone:`neutral`,title:`Not a git repository`,subtitle:`The cockpit is running outside a git repository — start it inside one to browse changes, commits and branches.`})})}function Ie({repo:e,info:t,tab:n}){return(0,G.jsxs)(`div`,{"data-route":`repo-git`,className:y(`flex min-h-full flex-col`,n===`changes`&&`md:h-full`),children:[(0,G.jsxs)(`header`,{"data-slot":`repo-header`,className:`sticky top-0 z-20 border-b border-border bg-background/95 px-4 pt-3 backdrop-blur md:px-6`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,G.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Git`}),(0,G.jsx)(me,{branch:t.branch}),t.remote?(0,G.jsx)(`span`,{"data-slot":`repo-remote`,className:`hidden min-w-0 truncate text-[11px] text-soft-foreground md:inline`,children:t.remote}):null]}),(0,G.jsx)(`div`,{className:`mt-1.5`,children:(0,G.jsx)(ye,{})}),(0,G.jsxs)(`div`,{"data-slot":`repo-tabs`,className:`mt-2.5 flex items-end gap-1`,children:[(0,G.jsx)(k,{to:`/git`,active:n===`changes`,children:`Changes`}),(0,G.jsx)(k,{to:`/git/commits`,active:n===`commits`,children:`Commits`}),(0,G.jsx)(k,{to:`/git/branches`,active:n===`branches`,children:`Branches`}),(0,G.jsx)(k,{to:`/git/files`,active:n===`files`,children:`Files`})]})]}),n===`changes`?(0,G.jsx)(Ee,{}):n===`commits`?(0,G.jsx)(De,{log:e.log}):n===`files`?(0,G.jsx)(Le,{}):(0,G.jsx)(Se,{repo:e,info:t})]})}function Le(){let e=w(),t=x();return(0,G.jsx)(je,{selected:e[`*`]!==void 0&&e[`*`]!==``?e[`*`]:null,onSelect:e=>t(e===null?`/git/files`:`/git/files/${Re(e)}`,{replace:!0})})}function Re(e){return e.split(`/`).map(encodeURIComponent).join(`/`)}export{Fe as RepoGitRoute};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$n as r,Di as i,N as a,Ni as o,Nt as s,Oa as c,Pt as l,Qt as u,Ta as d,Ut as f,Xn as p,Zr as m,hr as h,qt as g,r as _,sr as v}from"./queries-C09jaXiS.js";import{r as y,t as b}from"./button-DFlig-3W.js";import{T as x,c as ee,f as S,s as C,t as w}from"./project-router-Uv5K_t7U.js";import{_ as T,f as E,g as D,h as O,m as k,p as A}from"./reference-chip-CHF-Sbml.js";import{En as j,F as M,bn as N,hn as P}from"./git-tab-loading-Dcf8fCoC.js";import{t as F}from"./arrow-left-FG-BtI91.js";import{F as I,L,N as R,P as z,W as te}from"./worktree-lifecycle-operation-COUqhS7A.js";import{t as B}from"./circle-check-D3dWBsEI.js";import{u as V}from"./git-toolbar-aXyXLu2P.js";import{t as ne}from"./triangle-alert-lwmk_SnN.js";import{t as re}from"./input-6sILF4ZL.js";import{t as H}from"./centered-state-Cm8_dS47.js";import{D as U,l as W,s as ie}from"./index-DxwI2MZD.js";var G=e(t(),1),K=n(),q=[`.ai/cezar/skills/`,`.ai/skills/`,`.agents/skills/`];function J({children:e}){return(0,K.jsx)(`span`,{className:`font-mono`,children:e})}function Y(){return(0,K.jsx)(K.Fragment,{children:q.map((e,t)=>(0,K.jsxs)(`span`,{children:[t>0?t===q.length-1?`, or `:`, `:``,(0,K.jsx)(J,{children:e})]},e))})}function ae(){return(0,K.jsxs)(K.Fragment,{children:[`No skills yet. Drop Markdown files into `,(0,K.jsx)(Y,{}),` (agent mirrors like`,` `,(0,K.jsx)(J,{children:`.claude/skills/`}),` work too) — optional frontmatter: `,(0,K.jsx)(J,{children:`name`}),`,`,` `,(0,K.jsx)(J,{children:`description`}),`. Global (`,(0,K.jsx)(J,{children:`~/.agents/skills`}),`) and team-repo skills appear here too — try Refresh.`]})}var X=2e3,Z=5*6e4;async function oe(e,t,n={}){let{apply:i=r,read:a=m,wait:o=e=>new Promise(t=>setTimeout(t,e)),now:s=Date.now,onDropped:c=N}=n;try{return await i(e)}catch(n){if(!(n instanceof p)||n.status!==0&&n.status!==409)throw n;let r=e=>{n.status===0&&c(e)},i=s()+Z;for(;;){let c;try{c=await a(e)}catch{throw r(`unreachable`),n}if(c.status!==`updating`){if(c.updatedAt&&c.updatedAt!==t)return r(`recovered`),c;throw r(`not_applied`),n}if(s()>=i)throw r(`timed_out`),n;await o(X)}}}function Q(e){return e===`project`?`Project installation`:`Global installation`}function se({projectId:e,state:t,loadError:n}){let r=c(),i=ee(),a=(0,G.useRef)(0),[o,s]=(0,G.useState)(!1),l=d({mutationFn:()=>h({task:`Apply the upgrade notes after updating the installed Open Mercato skills.`,steps:[{id:`apply-upgrade-notes`,name:`Apply upgrade notes`,skill:`om-apply-upgrade-notes`,prompt:`{{task}}`}]}),onSuccess:e=>{P(`skills_import`),s(!1),i(M(e))},onError:e=>S(e.message,{tone:`danger`})}),f=(t,n)=>{n.seq===a.current&&(r.setQueryData(u.skillsUpdate(e),t),n.action===`apply`&&t.updatedAt&&t.updatedAt!==n.previousUpdatedAt&&(r.invalidateQueries({queryKey:_.skills}),S(t.status===`error`?`Some skill updates failed.`:`Open Mercato skills updated.`),s(!0)))},p=(e,t)=>{t.seq===a.current&&S(e.message,{tone:`danger`})},m=d({mutationFn:t=>v(e).then(e=>({result:e,request:t})),onSuccess:({result:e,request:t})=>f(e,t),onError:(e,t)=>p(e,t)}),g=d({mutationFn:t=>oe(e,t.previousUpdatedAt).then(e=>({result:e,request:t})),onSuccess:({result:e,request:t})=>f(e,t),onError:(e,t)=>p(e,t)}),x=e=>{let n=++a.current;e===`apply`?g.mutate({action:e,seq:n,previousUpdatedAt:t?.updatedAt??null}):m.mutate({action:e,seq:n})},C=t?.scopes??[],w=C.filter(e=>e.skills.length>0),j=w.length>0,N=t?.status===`error`,F=j&&(t?.available||N),I=g.isPending||t?.status===`updating`,L=C.filter(e=>e.status===`error`||e.status===`unavailable`),R=C.filter(e=>e.updatedAt&&!L.includes(e)),z=`Checking installed Open Mercato skills…`;return n?z=`Update status is unavailable right now.`:t?.status===`available`?z=`An update is available for your installed Open Mercato skills.`:t?.status===`updating`?z=`Updating installed Open Mercato skills…`:t?.status===`current`&&!j?z=t.needsUpgradeNotes?`Skill files were updated.`:`No installed Open Mercato skills are tracked for updates.`:t?.status===`current`?z=`Installed Open Mercato skills are up to date.`:t?.status===`unavailable`?z=t.scopes.find(e=>e.reason)?.reason??`Automatic updates are unavailable.`:t?.status===`error`&&(z=`The update did not finish for every installation.`),(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`section`,{"data-slot":`skills-update-card`,"aria-live":`polite`,className:`rounded-lg border border-border bg-muted/30 p-3`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:z}),t?.checkedAt?(0,K.jsxs)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:[`Last checked `,new Date(t.checkedAt).toLocaleString(),`.`]}):null,w.length>0?(0,K.jsx)(`ul`,{className:`mt-1 text-xs text-soft-foreground`,children:w.map(e=>(0,K.jsxs)(`li`,{children:[Q(e.scope),` · `,e.skills.length,` tracked`]},e.scope))}):null,L.length>0?(0,K.jsxs)(`p`,{className:`mt-1 text-xs text-destructive`,children:[`Failed: `,L.map(e=>Q(e.scope)).join(`, `),R.length?`; updated: `+R.map(e=>Q(e.scope)).join(`, `):``,`.`]}):null]}),F?(0,K.jsxs)(b,{"data-action":`skills-update-apply`,size:`sm`,disabled:I,onClick:()=>x(`apply`),children:[(0,K.jsx)(V,{"aria-hidden":`true`,className:y(`size-3.5`,I&&`motion-safe:animate-spin`)}),I?`Updating…`:N?`Retry`:`Update now`]}):t?.status===`current`?(0,K.jsx)(b,{"data-action":`skills-update-check`,variant:`outline`,size:`sm`,disabled:m.isPending,onClick:()=>x(`check`),children:`Check again`}):t?.status===`unavailable`||n?(0,K.jsx)(b,{"data-action":`skills-update-check`,variant:`outline`,size:`sm`,disabled:m.isPending,onClick:()=>x(`check`),children:`Retry check`}):null]}),t?.status===`unavailable`||n?(0,K.jsxs)(`div`,{className:`mt-2 text-xs text-soft-foreground`,children:[`Manual examples: `,(0,K.jsx)(`code`,{children:`npx skills update -p`}),` · `,(0,K.jsx)(`code`,{children:`npx skills update -g`}),`. These broad commands may update other tracked sources.`]}):null,t?.needsUpgradeNotes?(0,K.jsxs)(`div`,{"data-slot":`skills-upgrade-notes`,className:`mt-3 flex gap-2 rounded-md border border-primary/30 bg-background p-2.5 text-xs text-foreground`,children:[(0,K.jsx)(B,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-primary`}),(0,K.jsxs)(`span`,{children:[`Skill files were updated. Run `,(0,K.jsx)(`code`,{children:`/om-apply-upgrade-notes`}),` in each configured repository to apply descriptor migrations while preserving local edits.`]})]}):null]}),(0,K.jsx)(E,{open:o,onOpenChange:e=>l.isPending?void 0:s(e),children:(0,K.jsxs)(A,{"data-slot":`skills-upgrade-notes-dialog`,showCloseButton:!1,children:[(0,K.jsxs)(D,{children:[(0,K.jsx)(T,{children:`Apply the upgrade notes now?`}),(0,K.jsxs)(k,{children:[`The skill files were updated successfully. Start a new session with`,` `,(0,K.jsx)(`code`,{children:`/om-apply-upgrade-notes`}),` to sync repository descriptors while preserving local edits?`]})]}),(0,K.jsxs)(O,{children:[(0,K.jsx)(b,{type:`button`,variant:`outline`,disabled:l.isPending,onClick:()=>s(!1),children:`No`}),(0,K.jsx)(b,{type:`button`,disabled:l.isPending,onClick:()=>l.mutate(),children:l.isPending?`Starting…`:`Yes, start session`})]})]})})]})}function ce(e,t){let n=e?.importedSkills;return Array.isArray(n)?n.filter(e=>typeof e==`string`&&!!e):[...t]}function le(e,t,n,r,i=!1){let a=e.source===`ai`||e.source===`cezar`||e.source===`agents`||e.source===`global`,o=e.source===`team`&&(t.has(e.name)||i);if(!(!a&&!o))return{ariaLabel:a?`${e.name} is always enabled`:`${e.enabled?`Disable`:`Enable`} ${e.name}`,checked:a||e.enabled,disabled:a||n||i,onCheckedChange:()=>r(e.name)}}function $(){return(0,K.jsxs)(`div`,{"data-route":`skills`,className:`flex min-h-full flex-col`,children:[(0,K.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,K.jsx)(`h1`,{className:`text-base font-semibold`,children:`Skills`}),(0,K.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Markdown playbooks agents can follow.`})]}),(0,K.jsx)(ue,{})]})}function ue(){let e=C()??``,t=l(e,!!e),n=s(),r=g(),u=a(),[p]=x(),[m,h]=(0,G.useState)(``),[v,ee]=(0,G.useState)(null),T=c(),E=f(),D=u.data??[],O=(0,G.useMemo)(()=>D.map(e=>e.name),[D]),k=(0,G.useMemo)(()=>new Set(O),[O]),A=(0,G.useMemo)(()=>new Set(ce(E.data,O)),[E.data,O]),M=(0,G.useRef)(Promise.resolve()),N=(0,G.useRef)(0),P=(0,G.useCallback)(t=>{let n=_.uiState,r=_.skills,a=T.getQueryData(n),o=ce(a,O),s=o.includes(t)?o.filter(e=>e!==t):[...o,t];T.setQueryData(n,{...a,importedSkills:s});let c=++N.current;M.current=M.current.then(async()=>{try{let t=await i({importedSkills:s},e);if(c!==N.current)return;T.setQueryData(n,t),T.invalidateQueries({queryKey:r})}catch(e){if(c!==N.current)return;S(e instanceof Error?e.message:String(e),{tone:`danger`}),T.invalidateQueries({queryKey:n})}})},[O,e,T]),I=d({mutationFn:()=>o(),onSuccess:e=>{T.setQueryData(_.skills,e),S(`Team skills refreshed.`)},onError:e=>S(e.message,{tone:`danger`})});if(n.isError)return(0,K.jsx)(H,{icon:(0,K.jsx)(ne,{}),tone:`danger`,heading:`h2`,title:`Could not load skills`,subtitle:n.error.message});let B=L(n.data??[]),U=new Set(B.map(e=>e.name)),W=L([...B.map(e=>({...e,enabled:e.source===`team`&&k.has(e.name)?A.has(e.name):!0})),...D.filter(e=>!U.has(e.name)).map(e=>({...e,enabled:A.has(e.name)}))].sort((e,t)=>e.name.localeCompare(t.name))),q=p.get(`skill`),J=W.find(e=>e.name===q)??(q===null?W.find(e=>e.enabled):null)??null,Y=J?.name??null,X=J?le(J,k,E.isPending,P,u.isError):void 0,Z=z(W),oe=Z.map(e=>e.key),Q=v!==null&&oe.includes(v)?v:null,$=z(R(Q===null?W:W.filter(e=>(e.team?.repo??``)===Q),m)),ue=$.flatMap(e=>e.skills);return(0,K.jsxs)(`div`,{"data-slot":`skills-section`,className:`flex min-h-full flex-1 items-stretch`,children:[(0,K.jsxs)(`section`,{"data-slot":`skills-list`,className:y(`w-full flex-col border-border md:flex md:w-96 md:shrink-0 md:border-r`,`md:sticky md:top-14 md:max-h-[calc(100dvh-(var(--spacing)*14))]`,q===null||!J?`flex`:`hidden md:flex`),children:[(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 p-3 pb-2`,children:[(0,K.jsx)(re,{"data-slot":`skills-filter`,placeholder:`Filter skills…`,"aria-label":`Filter skills`,value:m,onChange:e=>h(e.target.value),className:`h-8 text-[13px]`}),(0,K.jsxs)(`button`,{type:`button`,"data-slot":`skills-refresh`,title:`git fetch the team skills repos`,disabled:I.isPending,onClick:()=>I.mutate(),className:`flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,children:[(0,K.jsx)(V,{"aria-hidden":`true`,className:y(`size-3`,I.isPending&&`motion-safe:animate-spin`)}),`Refresh`]})]}),Z.length>1?(0,K.jsx)(`div`,{className:`shrink-0 px-3 pb-2`,children:(0,K.jsxs)(`select`,{"data-slot":`skills-repo-filter`,"aria-label":`Filter by repository`,value:Q??`__all__`,onChange:e=>ee(e.target.value===`__all__`?null:e.target.value),className:`h-8 w-full rounded-md border border-border bg-card px-2 text-[13px] text-foreground outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,K.jsx)(`option`,{value:`__all__`,children:`All repositories`}),Z.map(e=>(0,K.jsxs)(`option`,{value:e.key,children:[e.label,` (`,e.skills.length,`)`]},e.key))]})}):null,e?(0,K.jsx)(`div`,{className:`shrink-0 px-3 pb-2`,children:(0,K.jsx)(se,{projectId:e,state:t.data,loadError:t.error})}):null,u.isError?(0,K.jsxs)(`div`,{"data-slot":`skills-importable-error`,role:`alert`,className:`mx-3 mb-2 flex shrink-0 items-center justify-between gap-3 rounded-md border border-danger/20 bg-danger/10 px-3 py-2 text-xs text-danger`,children:[(0,K.jsxs)(`p`,{className:`min-w-0`,children:[`Could not load the Open Mercato skills catalog. Team skills may be missing until it loads.`,` `,u.error.message]}),(0,K.jsx)(b,{type:`button`,"data-action":`skills-importable-retry`,variant:`ghost`,size:`sm`,disabled:u.isFetching,onClick:()=>void u.refetch(),children:`Retry`})]}):null,(0,K.jsx)(`ul`,{"data-slot":`skill-rows`,className:`min-h-0 flex-1 space-y-1 overflow-y-auto px-2 pb-2`,children:n.isPending?(0,K.jsx)(`li`,{className:`px-2.5 py-2 text-[13px] text-soft-foreground`,children:`Loading…`}):ue.length>0?$.map(e=>(0,K.jsxs)(`li`,{"data-slot":`skill-group`,"data-group":e.key||`local`,className:`list-none`,children:[Z.length>1?(0,K.jsx)(`h3`,{className:`px-2.5 pt-2 pb-1 text-[11px] font-semibold uppercase tracking-wide text-soft-foreground`,children:e.label}):null,(0,K.jsx)(`ul`,{className:`space-y-1`,children:e.skills.map(e=>(0,K.jsx)(de,{skill:e,active:Y===e.name,activation:le(e,k,E.isPending,P,u.isError)},e.name))})]},e.key)):(0,K.jsx)(`li`,{className:`px-2.5 py-2 text-xs leading-relaxed text-soft-foreground`,children:W.length>0?`(no skills match)`:(0,K.jsx)(ae,{})})})]}),(0,K.jsx)(`section`,{"data-slot":`skills-detail`,className:y(`min-w-0 flex-1 flex-col`,q===null||!J?`hidden md:flex`:`flex`),children:(0,K.jsx)(`div`,{className:`min-w-0 flex-1 px-4 py-4 md:px-7 md:py-5`,children:J?(0,K.jsxs)(K.Fragment,{children:[q===null?null:(0,K.jsxs)(w,{to:`/skills`,"data-slot":`skills-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,K.jsx)(F,{"aria-hidden":`true`,className:`size-3.5`}),`Back to skills`]}),(0,K.jsx)(ie,{skill:J,enabled:J.enabled,activation:X,usedBy:te(r.data?.workflows??[],J.name)})]}):n.isPending?null:(0,K.jsx)(H,{icon:(0,K.jsx)(j,{}),tone:`neutral`,heading:`h2`,title:`No skill selected`,subtitle:`Pick a skill from the catalog.`})})})]})}function de({skill:e,active:t,activation:n}){let r=I(e),i=(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(`span`,{className:y(`min-w-0 truncate font-mono text-[13px]`,e.enabled?`font-semibold text-foreground`:`font-medium text-muted-foreground`),children:e.name}),(0,K.jsx)(W,{source:e.source,teamRepo:e.team?.repo,className:`ml-auto`})]}),e.description?(0,K.jsx)(`span`,{className:`line-clamp-2 text-xs text-soft-foreground`,children:e.description}):null]});return(0,K.jsxs)(`li`,{className:y(`flex min-w-0 items-start gap-0 rounded-md transition-colors hover:bg-muted`,t&&`bg-muted`),children:[n?(0,K.jsx)(U,{"data-slot":`skill-activation`,"aria-label":n.ariaLabel,checked:n.checked,disabled:n.disabled,onCheckedChange:n.onCheckedChange,size:`sm`,className:`mt-2.5 ml-2 shrink-0`}):null,(0,K.jsx)(w,{to:`/skills?skill=${encodeURIComponent(e.name)}`,"data-slot":`skill-row`,"data-skill":e.name,"data-project":r?`true`:void 0,"data-enabled":e.enabled?`true`:`false`,"aria-current":t?`page`:void 0,className:`flex min-w-0 flex-1 flex-col gap-0.5 px-2.5 py-2`,children:i})]})}export{$ as SkillsRoute};
@@ -1 +0,0 @@
1
- import{n as e,r as t}from"./rolldown-runtime-QTnfLwEv.js";import{i as n,t as r}from"./react-runtime-CCIEwYL0.js";import{Xn as i,ft as a,ht as o,mt as s}from"./queries-C09jaXiS.js";import{r as c,t as l}from"./button-DFlig-3W.js";import{t as u,w as d}from"./project-router-Uv5K_t7U.js";import{t as f}from"./use-desktop-BNN3U2y9.js";import{Xt as p,n as m,r as h,t as g}from"./git-tab-loading-Dcf8fCoC.js";import{t as _}from"./arrow-left-FG-BtI91.js";import{s as v}from"./git-toolbar-aXyXLu2P.js";import{n as y}from"./upload-Dx8IzFX_.js";import{t as b}from"./triangle-alert-lwmk_SnN.js";import{t as x}from"./search-x-CG0S6SUu.js";import{t as S}from"./diff-stat-BIAV32IP.js";import{t as C}from"./centered-state-Cm8_dS47.js";import{t as w}from"./diff-DZjcij_W.js";import{t as T}from"./commit-list-C_l41PzR.js";var E=t(n(),1),D=new Map,O=new Map;function k(e,t){D.set(e,t);for(let n of O.get(e)??[])n(t)}function A(e,t){let n=()=>e!==void 0&&D.has(e)?D.get(e):t,[r,i]=(0,E.useState)(n),a=(0,E.useRef)(e);return a.current!==e&&(a.current=e,i(n())),(0,E.useEffect)(()=>{if(e===void 0)return;let t=e=>i(e),n=O.get(e)??new Set;return n.add(t),O.set(e,n),()=>{n.delete(t),n.size===0&&O.delete(e)}},[e]),[r,(0,E.useCallback)(t=>{e!==void 0&&D.set(e,t),i(t)},[e])]}var j=e({CommitsView:()=>P,TaskCommitsRoute:()=>N}),M=r();function N(){let{id:e}=d(),t=a(e);return t.isPending?(0,M.jsx)(m,{tab:`changes`}):t.isError?(0,M.jsx)(g,{tab:`changes`,error:t.error}):(0,M.jsx)(P,{run:t.data})}function P({run:e,embedded:t=!1,stateKey:n}){let{sha:r}=d(),[a,s]=A(n,null),u=t?a??void 0:r,f=o(e.id,p(e.status));return(0,M.jsxs)(`div`,{"data-route":`task-commits`,className:c(`flex min-h-full flex-col`,u&&`md:h-full`),children:[t?null:(0,M.jsx)(h,{run:e,tab:`commits`}),u?(0,M.jsxs)(M.Fragment,{children:[t?(0,M.jsx)(`div`,{className:`shrink-0 border-b border-border px-4 py-1.5 md:px-6`,children:(0,M.jsxs)(l,{variant:`ghost`,size:`xs`,"data-action":`all-commits`,onClick:()=>s(null),children:[(0,M.jsx)(_,{"aria-hidden":`true`}),`All commits`]})}):null,(0,M.jsx)(F,{runId:e.id,sha:u},u)]}):f.isPending?(0,M.jsx)(`p`,{"data-slot":`commits-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commits…`}):f.isError?(0,M.jsx)(C,{icon:(0,M.jsx)(y,{}),tone:f.error instanceof i&&f.error.status===409?`neutral`:`danger`,heading:`h2`,title:f.error instanceof i&&f.error.status===409?`No commits to show`:`Could not load the commits`,subtitle:f.error.message}):f.data.commits.length===0?(0,M.jsx)(C,{icon:(0,M.jsx)(y,{}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`This task hasn't committed anything on its branch. Autosave commits and any the agent makes appear here.`}):(0,M.jsx)(T,{slot:`task-commits`,className:`mx-auto w-full max-w-[var(--measure)]`,commits:f.data.commits.map(t=>({...t,shaLabel:t.sha.slice(0,8),href:`/tasks/${e.id}/commits/${t.sha}`})),onSelect:t?s:void 0})]})}function F({runId:e,sha:t}){let n=s(e,t),r=f(),[a,o]=(0,E.useState)(`unified`),[c,d]=(0,E.useState)(!1),p=n.isError&&n.error instanceof i&&n.error.status===409,m=r?a:`unified`,h=!r||c;return(0,M.jsxs)(`section`,{"data-slot":`task-commit`,"data-sha":t,className:`mx-auto flex min-h-0 w-full max-w-[var(--measure)] flex-1 flex-col`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,M.jsx)(l,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,M.jsxs)(u,{to:`/tasks/${e}/commits`,children:[(0,M.jsx)(_,{"aria-hidden":`true`}),`All commits`]})}),n.data?(0,M.jsx)(S,{stat:n.data.stat}):null,(0,M.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,M.jsx)(v,{mode:a,wrap:c,onModeChange:o,onWrapChange:d})})]}),n.isPending?(0,M.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commit…`}):n.isError?(0,M.jsx)(C,{icon:p?(0,M.jsx)(x,{}):(0,M.jsx)(b,{}),tone:p?`neutral`:`danger`,heading:`h2`,title:p?`Commit not found`:`Could not load the commit`,subtitle:n.error.message}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`div`,{"data-slot":`commit-meta`,className:`border-b border-border px-4 py-3 md:px-6`,children:[(0,M.jsx)(`h2`,{className:`text-sm font-semibold`,children:n.data.subject}),(0,M.jsxs)(`p`,{className:`mt-0.5 text-[11px] text-soft-foreground`,children:[n.data.author,` · `,n.data.when,` ·`,` `,(0,M.jsx)(`span`,{className:`font-mono select-all`,children:n.data.sha})]})]}),n.data.files.length===0?(0,M.jsx)(C,{icon:(0,M.jsx)(y,{}),tone:`neutral`,heading:`h2`,title:`No file changes`,subtitle:`This commit carries no diff of its own — a merge commit's changes live on the commits it merged.`}):(0,M.jsx)(`div`,{"data-slot":`diff-pane`,"data-diff-scroller":r?``:void 0,className:`px-4 md:min-h-0 md:flex-1 md:overflow-y-auto md:overscroll-contain md:px-6`,children:(0,M.jsx)(w,{files:n.data.files,mode:m,wrap:h,className:`min-w-0 py-4`})})]})]})}export{A as i,j as n,k as r,P as t};