@open-mercato/cezar 0.19.0-pr1908.4332 → 0.19.0-pr1908.4707

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 (608) hide show
  1. package/README.md +3 -2
  2. package/dist/agent-config/account-identity.js +3 -0
  3. package/dist/agent-config/account-identity.js.map +1 -1
  4. package/dist/agent-config/catalog.d.ts +7 -1
  5. package/dist/agent-config/catalog.js +174 -4
  6. package/dist/agent-config/catalog.js.map +1 -1
  7. package/dist/agent-config/model-settings/gemini.d.ts +8 -0
  8. package/dist/agent-config/model-settings/gemini.js +16 -0
  9. package/dist/agent-config/model-settings/gemini.js.map +1 -0
  10. package/dist/agent-config/model-settings/kimi.d.ts +7 -0
  11. package/dist/agent-config/model-settings/kimi.js +13 -0
  12. package/dist/agent-config/model-settings/kimi.js.map +1 -0
  13. package/dist/agent-config/model-settings/omp.d.ts +11 -0
  14. package/dist/agent-config/model-settings/omp.js +17 -0
  15. package/dist/agent-config/model-settings/omp.js.map +1 -0
  16. package/dist/agent-config/model-settings/shared.d.ts +6 -0
  17. package/dist/agent-config/model-settings/shared.js +17 -3
  18. package/dist/agent-config/model-settings/shared.js.map +1 -1
  19. package/dist/agent-config/models.js +6 -0
  20. package/dist/agent-config/models.js.map +1 -1
  21. package/dist/agent-config/validate.js +15 -0
  22. package/dist/agent-config/validate.js.map +1 -1
  23. package/dist/automations/automation-cli.d.ts +2 -0
  24. package/dist/automations/automation-cli.js +82 -2
  25. package/dist/automations/automation-cli.js.map +1 -1
  26. package/dist/automations/deferred-start.d.ts +5 -4
  27. package/dist/automations/deferred-start.js +5 -1
  28. package/dist/automations/deferred-start.js.map +1 -1
  29. package/dist/automations/paused-work.d.ts +24 -0
  30. package/dist/automations/paused-work.js +61 -0
  31. package/dist/automations/paused-work.js.map +1 -0
  32. package/dist/automations/pr-head.d.ts +3 -0
  33. package/dist/automations/pr-head.js +8 -4
  34. package/dist/automations/pr-head.js.map +1 -1
  35. package/dist/automations/prompts.js +1 -0
  36. package/dist/automations/prompts.js.map +1 -1
  37. package/dist/automations/store.d.ts +16 -0
  38. package/dist/automations/store.js +44 -0
  39. package/dist/automations/store.js.map +1 -1
  40. package/dist/automations/task-template.js +1 -0
  41. package/dist/automations/task-template.js.map +1 -1
  42. package/dist/automations/templates.js +1 -0
  43. package/dist/automations/templates.js.map +1 -1
  44. package/dist/automations/types.d.ts +24 -0
  45. package/dist/automations/types.js +2 -0
  46. package/dist/automations/types.js.map +1 -1
  47. package/dist/automations/validate-input.d.ts +188 -0
  48. package/dist/automations/validate-input.js +85 -0
  49. package/dist/automations/validate-input.js.map +1 -0
  50. package/dist/config.d.ts +12 -5
  51. package/dist/config.js +4 -12
  52. package/dist/config.js.map +1 -1
  53. package/dist/contract/agent-config.d.ts +9 -0
  54. package/dist/contract/agent-profiles.d.ts +74 -20
  55. package/dist/contract/agent.d.ts +12 -0
  56. package/dist/contract/artifacts.d.ts +138 -0
  57. package/dist/contract/assets.d.ts +83 -0
  58. package/dist/contract/automations.d.ts +158 -0
  59. package/dist/contract/dashboard-costs.d.ts +2 -0
  60. package/dist/contract/dashboard.d.ts +8 -0
  61. package/dist/contract/deferred-start.d.ts +33 -0
  62. package/dist/contract/dispatch.d.ts +9 -0
  63. package/dist/contract/events.d.ts +6 -0
  64. package/dist/contract/github.d.ts +13 -0
  65. package/dist/contract/health.d.ts +12 -0
  66. package/dist/contract/impact.d.ts +134 -0
  67. package/dist/contract/index.d.ts +6 -0
  68. package/dist/contract/index.js +2955 -2547
  69. package/dist/contract/managers.d.ts +79 -0
  70. package/dist/contract/runners.d.ts +15 -0
  71. package/dist/contract/runs.d.ts +292 -0
  72. package/dist/contract/skills.d.ts +67 -0
  73. package/dist/contract/telemetry.d.ts +5 -1
  74. package/dist/contract/transfer.d.ts +1932 -0
  75. package/dist/contract/workflows.d.ts +87 -0
  76. package/dist/contract/workspace-layouts.d.ts +6 -0
  77. package/dist/contract/workspace.d.ts +111 -37
  78. package/dist/core/agent-env.js +43 -1
  79. package/dist/core/agent-env.js.map +1 -1
  80. package/dist/core/agent-errors.d.ts +3 -0
  81. package/dist/core/agent-errors.js +13 -0
  82. package/dist/core/agent-errors.js.map +1 -1
  83. package/dist/core/agent-model-policy.d.ts +1 -1
  84. package/dist/core/agent-model-policy.js +1 -1
  85. package/dist/core/agent-model-policy.js.map +1 -1
  86. package/dist/core/agent-profiles.d.ts +19 -3
  87. package/dist/core/agent-profiles.js +27 -3
  88. package/dist/core/agent-profiles.js.map +1 -1
  89. package/dist/core/agent-runner.d.ts +44 -10
  90. package/dist/core/agent-runner.js +21 -7
  91. package/dist/core/agent-runner.js.map +1 -1
  92. package/dist/core/antigravity-runner.js +2 -1
  93. package/dist/core/antigravity-runner.js.map +1 -1
  94. package/dist/core/backend-detect.d.ts +3 -2
  95. package/dist/core/backend-detect.js +80 -1
  96. package/dist/core/backend-detect.js.map +1 -1
  97. package/dist/core/claude-cli-runner.js +30 -3
  98. package/dist/core/claude-cli-runner.js.map +1 -1
  99. package/dist/core/claude-model-catalog.d.ts +6 -1
  100. package/dist/core/claude-model-catalog.js +20 -0
  101. package/dist/core/claude-model-catalog.js.map +1 -1
  102. package/dist/core/claude-usage-status.d.ts +8 -0
  103. package/dist/core/claude-usage-status.js +48 -0
  104. package/dist/core/claude-usage-status.js.map +1 -0
  105. package/dist/core/codex-app-server-runner.d.ts +8 -0
  106. package/dist/core/codex-app-server-runner.js +84 -13
  107. package/dist/core/codex-app-server-runner.js.map +1 -1
  108. package/dist/core/codex-model-catalog.js +42 -0
  109. package/dist/core/codex-model-catalog.js.map +1 -1
  110. package/dist/core/codex-ui-mapper.d.ts +7 -0
  111. package/dist/core/codex-ui-mapper.js +12 -2
  112. package/dist/core/codex-ui-mapper.js.map +1 -1
  113. package/dist/core/copilot-acp-runner.js +5 -1
  114. package/dist/core/copilot-acp-runner.js.map +1 -1
  115. package/dist/core/cursor-agent-runner.js +5 -1
  116. package/dist/core/cursor-agent-runner.js.map +1 -1
  117. package/dist/core/gemini-acp-runner.d.ts +37 -0
  118. package/dist/core/gemini-acp-runner.js +537 -0
  119. package/dist/core/gemini-acp-runner.js.map +1 -0
  120. package/dist/core/gemini-credentials.d.ts +21 -0
  121. package/dist/core/gemini-credentials.js +80 -0
  122. package/dist/core/gemini-credentials.js.map +1 -0
  123. package/dist/core/gemini-sessions.d.ts +18 -0
  124. package/dist/core/gemini-sessions.js +41 -0
  125. package/dist/core/gemini-sessions.js.map +1 -0
  126. package/dist/core/gemini-ui-mapper.d.ts +30 -0
  127. package/dist/core/gemini-ui-mapper.js +80 -0
  128. package/dist/core/gemini-ui-mapper.js.map +1 -0
  129. package/dist/core/junie-runner.js +2 -1
  130. package/dist/core/junie-runner.js.map +1 -1
  131. package/dist/core/kimi-home.d.ts +7 -0
  132. package/dist/core/kimi-home.js +13 -0
  133. package/dist/core/kimi-home.js.map +1 -0
  134. package/dist/core/kimi-model-catalog.d.ts +17 -0
  135. package/dist/core/kimi-model-catalog.js +45 -0
  136. package/dist/core/kimi-model-catalog.js.map +1 -0
  137. package/dist/core/kimi-runner.d.ts +90 -0
  138. package/dist/core/kimi-runner.js +874 -0
  139. package/dist/core/kimi-runner.js.map +1 -0
  140. package/dist/core/kimi-ui-mapper.d.ts +71 -0
  141. package/dist/core/kimi-ui-mapper.js +399 -0
  142. package/dist/core/kimi-ui-mapper.js.map +1 -0
  143. package/dist/core/model-identity.js +11 -0
  144. package/dist/core/model-identity.js.map +1 -1
  145. package/dist/core/model-presets.js +10 -0
  146. package/dist/core/model-presets.js.map +1 -1
  147. package/dist/core/omp-rpc-runner.d.ts +41 -0
  148. package/dist/core/omp-rpc-runner.js +451 -0
  149. package/dist/core/omp-rpc-runner.js.map +1 -0
  150. package/dist/core/omp-ui-mapper.d.ts +56 -0
  151. package/dist/core/omp-ui-mapper.js +468 -0
  152. package/dist/core/omp-ui-mapper.js.map +1 -0
  153. package/dist/core/opencode-http.d.ts +2 -0
  154. package/dist/core/opencode-http.js +2 -2
  155. package/dist/core/opencode-http.js.map +1 -1
  156. package/dist/core/opencode-server-runner.d.ts +3 -1
  157. package/dist/core/opencode-server-runner.js +197 -25
  158. package/dist/core/opencode-server-runner.js.map +1 -1
  159. package/dist/core/opencode-v2-events.d.ts +11 -0
  160. package/dist/core/opencode-v2-events.js +105 -0
  161. package/dist/core/opencode-v2-events.js.map +1 -0
  162. package/dist/core/pi-runner.js +5 -1
  163. package/dist/core/pi-runner.js.map +1 -1
  164. package/dist/core/private-mcp.d.ts +1 -1
  165. package/dist/core/private-mcp.js +2 -2
  166. package/dist/core/private-mcp.js.map +1 -1
  167. package/dist/core/process-signals.d.ts +29 -0
  168. package/dist/core/process-signals.js +85 -0
  169. package/dist/core/process-signals.js.map +1 -0
  170. package/dist/core/provider-auth.d.ts +25 -2
  171. package/dist/core/provider-auth.js +132 -12
  172. package/dist/core/provider-auth.js.map +1 -1
  173. package/dist/core/runner-factory.d.ts +1 -0
  174. package/dist/core/runner-factory.js +38 -1
  175. package/dist/core/runner-factory.js.map +1 -1
  176. package/dist/core/runner-model-catalog.d.ts +8 -0
  177. package/dist/core/runner-model-catalog.js +3 -0
  178. package/dist/core/runner-model-catalog.js.map +1 -1
  179. package/dist/core/tool-display.js +2 -0
  180. package/dist/core/tool-display.js.map +1 -1
  181. package/dist/core/ui-events.d.ts +1 -1
  182. package/dist/core/usage-limit.d.ts +2 -2
  183. package/dist/core/usage-limit.js +5 -3
  184. package/dist/core/usage-limit.js.map +1 -1
  185. package/dist/data-gitignore.d.ts +1 -1
  186. package/dist/data-gitignore.js +1 -0
  187. package/dist/data-gitignore.js.map +1 -1
  188. package/dist/dispatch/engine.d.ts +4 -0
  189. package/dist/dispatch/engine.js +9 -0
  190. package/dist/dispatch/engine.js.map +1 -1
  191. package/dist/e2e-setup.d.ts +8 -3
  192. package/dist/e2e-setup.js +31 -16
  193. package/dist/e2e-setup.js.map +1 -1
  194. package/dist/handoff.d.ts +2 -2
  195. package/dist/handoff.js +5 -5
  196. package/dist/handoff.js.map +1 -1
  197. package/dist/impact/demo-review.json +781 -0
  198. package/dist/impact/diff.d.ts +21 -0
  199. package/dist/impact/diff.js +81 -0
  200. package/dist/impact/diff.js.map +1 -0
  201. package/dist/impact/evidence.d.ts +67 -0
  202. package/dist/impact/evidence.js +238 -0
  203. package/dist/impact/evidence.js.map +1 -0
  204. package/dist/impact/impact-cli.d.ts +12 -0
  205. package/dist/impact/impact-cli.js +141 -0
  206. package/dist/impact/impact-cli.js.map +1 -0
  207. package/dist/impact/launch.d.ts +46 -0
  208. package/dist/impact/launch.js +145 -0
  209. package/dist/impact/launch.js.map +1 -0
  210. package/dist/impact/model.d.ts +551 -0
  211. package/dist/impact/model.js +188 -0
  212. package/dist/impact/model.js.map +1 -0
  213. package/dist/impact/publish.d.ts +30 -0
  214. package/dist/impact/publish.js +119 -0
  215. package/dist/impact/publish.js.map +1 -0
  216. package/dist/impact/render.d.ts +41 -0
  217. package/dist/impact/render.js +109 -0
  218. package/dist/impact/render.js.map +1 -0
  219. package/dist/impact/template.html +670 -0
  220. package/dist/impact/validate.d.ts +25 -0
  221. package/dist/impact/validate.js +273 -0
  222. package/dist/impact/validate.js.map +1 -0
  223. package/dist/index.js +19 -4
  224. package/dist/index.js.map +1 -1
  225. package/dist/managers/engine.js +5 -2
  226. package/dist/managers/engine.js.map +1 -1
  227. package/dist/pack-check.d.ts +1 -0
  228. package/dist/pack-check.js +14 -0
  229. package/dist/pack-check.js.map +1 -1
  230. package/dist/paths.d.ts +6 -0
  231. package/dist/paths.js +19 -1
  232. package/dist/paths.js.map +1 -1
  233. package/dist/runs/agent-error-telemetry.js +7 -4
  234. package/dist/runs/agent-error-telemetry.js.map +1 -1
  235. package/dist/runs/agent-tmpdir.d.ts +25 -6
  236. package/dist/runs/agent-tmpdir.js +136 -25
  237. package/dist/runs/agent-tmpdir.js.map +1 -1
  238. package/dist/runs/artifacts.d.ts +52 -0
  239. package/dist/runs/artifacts.js +243 -0
  240. package/dist/runs/artifacts.js.map +1 -0
  241. package/dist/runs/event-history.d.ts +12 -0
  242. package/dist/runs/event-history.js +61 -0
  243. package/dist/runs/event-history.js.map +1 -1
  244. package/dist/runs/project-assets.d.ts +9 -0
  245. package/dist/runs/project-assets.js +57 -0
  246. package/dist/runs/project-assets.js.map +1 -0
  247. package/dist/runs/review-gate.d.ts +10 -0
  248. package/dist/runs/review-gate.js +12 -0
  249. package/dist/runs/review-gate.js.map +1 -1
  250. package/dist/runs/store.d.ts +70 -4
  251. package/dist/runs/store.js +139 -26
  252. package/dist/runs/store.js.map +1 -1
  253. package/dist/server/agent-setup.d.ts +1 -1
  254. package/dist/server/agent-setup.js +2 -1
  255. package/dist/server/agent-setup.js.map +1 -1
  256. package/dist/server/artifacts.d.ts +33 -0
  257. package/dist/server/artifacts.js +133 -0
  258. package/dist/server/artifacts.js.map +1 -0
  259. package/dist/server/dashboard.d.ts +5 -0
  260. package/dist/server/forge/github-assets.d.ts +7 -0
  261. package/dist/server/forge/github-assets.js +100 -0
  262. package/dist/server/forge/github-assets.js.map +1 -0
  263. package/dist/server/forge/github.d.ts +11 -0
  264. package/dist/server/forge/github.js +42 -0
  265. package/dist/server/forge/github.js.map +1 -1
  266. package/dist/server/open-in-app.js +3 -0
  267. package/dist/server/open-in-app.js.map +1 -1
  268. package/dist/server/provider-action-gate.js +12 -4
  269. package/dist/server/provider-action-gate.js.map +1 -1
  270. package/dist/server/server.d.ts +10012 -6701
  271. package/dist/server/server.js +353 -193
  272. package/dist/server/server.js.map +1 -1
  273. package/dist/server/star-count.d.ts +5 -5
  274. package/dist/server/star-count.js +5 -5
  275. package/dist/server/star-count.js.map +1 -1
  276. package/dist/server-install/steps.js +1 -0
  277. package/dist/server-install/steps.js.map +1 -1
  278. package/dist/skills-provision.js +7 -1
  279. package/dist/skills-provision.js.map +1 -1
  280. package/dist/skills.d.ts +10 -6
  281. package/dist/skills.js +11 -6
  282. package/dist/skills.js.map +1 -1
  283. package/dist/transfer/automations-file.d.ts +46 -0
  284. package/dist/transfer/automations-file.js +172 -0
  285. package/dist/transfer/automations-file.js.map +1 -0
  286. package/dist/transfer/config-bundle.d.ts +100 -0
  287. package/dist/transfer/config-bundle.js +430 -0
  288. package/dist/transfer/config-bundle.js.map +1 -0
  289. package/dist/webhooks/outbox.js +83 -63
  290. package/dist/webhooks/outbox.js.map +1 -1
  291. package/dist/workflows/graph.d.ts +27 -0
  292. package/dist/workflows/load.js +2 -2
  293. package/dist/workflows/load.js.map +1 -1
  294. package/dist/workflows/resume-fallback.d.ts +13 -6
  295. package/dist/workflows/resume-fallback.js +26 -6
  296. package/dist/workflows/resume-fallback.js.map +1 -1
  297. package/dist/workflows/run.d.ts +121 -10
  298. package/dist/workflows/run.js +363 -61
  299. package/dist/workflows/run.js.map +1 -1
  300. package/dist/workflows/templates.d.ts +27 -16
  301. package/dist/workflows/templates.js +17 -0
  302. package/dist/workflows/templates.js.map +1 -1
  303. package/dist/workflows/types.d.ts +21 -0
  304. package/dist/workflows/types.js +3 -1
  305. package/dist/workflows/types.js.map +1 -1
  306. package/dist/workspace/agent-accounts.d.ts +27 -15
  307. package/dist/workspace/agent-accounts.js +4 -14
  308. package/dist/workspace/agent-accounts.js.map +1 -1
  309. package/dist/workspace/agent-profiles.js +3 -0
  310. package/dist/workspace/agent-profiles.js.map +1 -1
  311. package/dist/workspace/config.d.ts +12 -6
  312. package/dist/workspace/config.js +3 -13
  313. package/dist/workspace/config.js.map +1 -1
  314. package/dist/workspace/dashboard-costs.d.ts +1 -0
  315. package/dist/workspace/dashboard-costs.js +1 -0
  316. package/dist/workspace/dashboard-costs.js.map +1 -1
  317. package/dist/workspace/dashboard-insights.d.ts +1 -0
  318. package/dist/workspace/dashboard-insights.js +5 -2
  319. package/dist/workspace/dashboard-insights.js.map +1 -1
  320. package/dist/workspace/dashboard-overview.js +2 -0
  321. package/dist/workspace/dashboard-overview.js.map +1 -1
  322. package/dist/workspace/dashboard.d.ts +1 -0
  323. package/package.json +5 -4
  324. package/scripts/check-pack.mjs +3 -2
  325. package/scripts/copy-assets.mjs +17 -0
  326. package/scripts/mock-claude.mjs +106 -1
  327. package/scripts/mock-gemini-acp.mjs +195 -0
  328. package/scripts/mock-kimi-acp.mjs +126 -0
  329. package/scripts/mock-omp-rpc.mjs +194 -0
  330. package/skills/change-impact/SKILL.md +117 -0
  331. package/skills/change-impact/references/analysis-contract.md +141 -0
  332. package/skills/change-impact/references/public-api.md +92 -0
  333. package/skills/change-impact/references/visual-contract.md +71 -0
  334. package/web/dist/assets/{active-forge-DEmP_h4r.js → active-forge-DO2AaQ-s.js} +1 -1
  335. package/web/dist/assets/agent-task-pickers-CZpw4vcZ.js +1 -0
  336. package/web/dist/assets/{alert-dialog-BZkKvKiu.js → alert-dialog-BihfE0uZ.js} +1 -1
  337. package/web/dist/assets/arrow-down-DACdHKjc.js +1 -0
  338. package/web/dist/assets/arrow-left-BtT8zuL0.js +1 -0
  339. package/web/dist/assets/arrow-up-BAPSgozC.js +1 -0
  340. package/web/dist/assets/ask-answer-Co3javaA.js +1 -0
  341. package/web/dist/assets/{ask-card-CfNUHYt9.js → ask-card-DLtNyMH_.js} +2 -2
  342. package/web/dist/assets/assets-view-CLCckPll.js +1 -0
  343. package/web/dist/assets/{automation-format-BPrWgGBz.js → automation-format-BXwiLf2G.js} +1 -1
  344. package/web/dist/assets/automations-route-JizzZrRf.js +1 -0
  345. package/web/dist/assets/blink-1oEUjxch.webp +0 -0
  346. package/web/dist/assets/blink-B4Y4PYCR.webp +0 -0
  347. package/web/dist/assets/blink-BpqW08tf.webp +0 -0
  348. package/web/dist/assets/blink-C380t2a5.webp +0 -0
  349. package/web/dist/assets/blink-CLn5VMYQ.webp +0 -0
  350. package/web/dist/assets/blink-Cn_tI5Yd.webp +0 -0
  351. package/web/dist/assets/blink-D4EaTnc2.webp +0 -0
  352. package/web/dist/assets/blink-DY4Sm5aw.webp +0 -0
  353. package/web/dist/assets/blink-mcM10OfP.webp +0 -0
  354. package/web/dist/assets/body-CXEwT_gR.webp +0 -0
  355. package/web/dist/assets/body-D-UrLURv.webp +0 -0
  356. package/web/dist/assets/body-D7Q8eJDv.webp +0 -0
  357. package/web/dist/assets/body-DdNSx4-d.webp +0 -0
  358. package/web/dist/assets/body-DlFNtp32.webp +0 -0
  359. package/web/dist/assets/body-EreQeu3g.webp +0 -0
  360. package/web/dist/assets/body-Goc64z5o.webp +0 -0
  361. package/web/dist/assets/body-_FLmHm_q.webp +0 -0
  362. package/web/dist/assets/body-v5xTmq5E.webp +0 -0
  363. package/web/dist/assets/{bot-qZRkHkDp.js → bot-Cm-PLA1M.js} +1 -1
  364. package/web/dist/assets/{button-BrxohNcK.js → button-BqkA8Ovk.js} +1 -1
  365. package/web/dist/assets/{centered-state-CSW_o4N7.js → centered-state-CquGIOsq.js} +1 -1
  366. package/web/dist/assets/check-B1z-_MCO.js +1 -0
  367. package/web/dist/assets/chevron-left-CDAxCC2p.js +1 -0
  368. package/web/dist/assets/chevron-right-DPaV033p.js +1 -0
  369. package/web/dist/assets/chunk-KS7C4IRE-DtL2Gzw3.js +3 -0
  370. package/web/dist/assets/{circle-alert-COKQc-87.js → circle-alert-B7VNkPC2.js} +1 -1
  371. package/web/dist/assets/circle-check-LWKCYKhA.js +1 -0
  372. package/web/dist/assets/{collapsible-BJ0sxcz9.js → collapsible-BuSDxSYs.js} +1 -1
  373. package/web/dist/assets/command-CfdVVS0V.js +1 -0
  374. package/web/dist/assets/{commit-list-HXZj01RO.js → commit-list-D5Nuv2HC.js} +1 -1
  375. package/web/dist/assets/compare-variants-BBOnUKfp.js +1 -0
  376. package/web/dist/assets/composer-BPIW4tmM.js +18 -0
  377. package/web/dist/assets/composer-attachments-DyC9yyGs.js +3 -0
  378. package/web/dist/assets/concerned-BIuYysOA.webp +0 -0
  379. package/web/dist/assets/concerned-BWTrkjRS.webp +0 -0
  380. package/web/dist/assets/concerned-BW_ywmzK.webp +0 -0
  381. package/web/dist/assets/concerned-CXQVACqJ.webp +0 -0
  382. package/web/dist/assets/concerned-DdsJa1t2.webp +0 -0
  383. package/web/dist/assets/concerned-Dlln-1nu.webp +0 -0
  384. package/web/dist/assets/concerned-DrSCYUQV.webp +0 -0
  385. package/web/dist/assets/concerned-TOjmS1qX.webp +0 -0
  386. package/web/dist/assets/concerned-tIx9dV3J.webp +0 -0
  387. package/web/dist/assets/dashboard-B_ytEQ_y.js +44 -0
  388. package/web/dist/assets/diff-BQScRHXz.js +3 -0
  389. package/web/dist/assets/diff-stat-CxDTnfya.js +1 -0
  390. package/web/dist/assets/diff-view-8m9Rnct7.js +13 -0
  391. package/web/dist/assets/{directional-usage-BtjgT5nc.js → directional-usage-BerE4wJK.js} +1 -1
  392. package/web/dist/assets/dist-Br4Ra_c5.js +1 -0
  393. package/web/dist/assets/{download-DH68Y5Vz.js → download-HBguClwD.js} +1 -1
  394. package/web/dist/assets/dropdown-menu-CDv5Teql.js +1 -0
  395. package/web/dist/assets/excited-8dK2gfAF.webp +0 -0
  396. package/web/dist/assets/excited-B-w6ozXs.webp +0 -0
  397. package/web/dist/assets/excited-B4Sch7Ub.webp +0 -0
  398. package/web/dist/assets/excited-BPQk8ECE.webp +0 -0
  399. package/web/dist/assets/excited-BRFi0cue.webp +0 -0
  400. package/web/dist/assets/excited-BvbUAHvw.webp +0 -0
  401. package/web/dist/assets/excited-CCH-VUDr.webp +0 -0
  402. package/web/dist/assets/excited-TMExhEMj.webp +0 -0
  403. package/web/dist/assets/excited-cSRbau5J.webp +0 -0
  404. package/web/dist/assets/{external-link-BVYdhpSK.js → external-link-Bclznsu3.js} +1 -1
  405. package/web/dist/assets/file-preview-DQ7iQhe0.js +2 -0
  406. package/web/dist/assets/{file-DYpKJvYs.js → file-rCLi_p-R.js} +1 -1
  407. package/web/dist/assets/file-tree-Bm38qEZP.js +1 -0
  408. package/web/dist/assets/focused-XMnI1Trp.webp +0 -0
  409. package/web/dist/assets/{folder-CeFUSrsO.js → folder-leteY9jH.js} +1 -1
  410. package/web/dist/assets/follow-up-engine-Q1EcpRpB.js +1 -0
  411. package/web/dist/assets/git-pull-request-CURFMFaU.js +1 -0
  412. package/web/dist/assets/{git-pull-request-draft-DL1VMp1L.js → git-pull-request-draft-BZgJrUou.js} +1 -1
  413. package/web/dist/assets/git-tab-loading-CF0flOMS.js +1 -0
  414. package/web/dist/assets/github-DcvXvc4J.js +1 -0
  415. package/web/dist/assets/happy-B7LJPne_.webp +0 -0
  416. package/web/dist/assets/happy-CCpAho8w.webp +0 -0
  417. package/web/dist/assets/happy-Ch9wxHii.webp +0 -0
  418. package/web/dist/assets/happy-CnoCjXOf.webp +0 -0
  419. package/web/dist/assets/happy-DVeEwiyo.webp +0 -0
  420. package/web/dist/assets/happy-URIT6hFl.webp +0 -0
  421. package/web/dist/assets/happy-ZufSdCLm.webp +0 -0
  422. package/web/dist/assets/happy-kfLwwDLp.webp +0 -0
  423. package/web/dist/assets/happy-nVffy2Sx.webp +0 -0
  424. package/web/dist/assets/{host-usage-o1rC0TiP.js → host-usage-CX8OXl8q.js} +1 -1
  425. package/web/dist/assets/icon-tooltip-BMkyRHLt.js +1 -0
  426. package/web/dist/assets/impact-control-Deh1F44q.js +1 -0
  427. package/web/dist/assets/impact-model-Dj6tIycu.js +1 -0
  428. package/web/dist/assets/index-DuW72uFI.js +33 -0
  429. package/web/dist/assets/index-jRkTI5kE.css +2 -0
  430. package/web/dist/assets/{input-BxjGaO_P.js → input-BO795Un9.js} +1 -1
  431. package/web/dist/assets/laptop-D2EKUOdE.webp +0 -0
  432. package/web/dist/assets/layers-YoqiEcNh.js +1 -0
  433. package/web/dist/assets/layout-cards-Cvq2XaJL.js +1 -0
  434. package/web/dist/assets/{layout-grid-C4d5rrDE.js → layout-grid-CSvbdC6i.js} +1 -1
  435. package/web/dist/assets/left-BBmAC9hS.webp +0 -0
  436. package/web/dist/assets/left-BUX98ijg.webp +0 -0
  437. package/web/dist/assets/left-CCrTs359.webp +0 -0
  438. package/web/dist/assets/left-CxWtAZHp.webp +0 -0
  439. package/web/dist/assets/left-DDCoVDRG.webp +0 -0
  440. package/web/dist/assets/left-DFGwPnRL.webp +0 -0
  441. package/web/dist/assets/left-D_qxT7z_.webp +0 -0
  442. package/web/dist/assets/left-QXVHT2zO.webp +0 -0
  443. package/web/dist/assets/left-S_rwAL-X.webp +0 -0
  444. package/web/dist/assets/leg-left-0EW5L4pu.webp +0 -0
  445. package/web/dist/assets/leg-left-BGo9dZbQ.webp +0 -0
  446. package/web/dist/assets/leg-left-BZ8ETYLj.webp +0 -0
  447. package/web/dist/assets/leg-left-BahG1x_b.webp +0 -0
  448. package/web/dist/assets/leg-left-C-DJQ3Pt.webp +0 -0
  449. package/web/dist/assets/leg-left-C6ZvH8fW.webp +0 -0
  450. package/web/dist/assets/leg-left-DsfFyCf7.webp +0 -0
  451. package/web/dist/assets/leg-left-Iq6VC-OZ.webp +0 -0
  452. package/web/dist/assets/leg-left-rVU9cV-d.webp +0 -0
  453. package/web/dist/assets/leg-right-2MnCGKHj.webp +0 -0
  454. package/web/dist/assets/leg-right-BCgv_Tjj.webp +0 -0
  455. package/web/dist/assets/leg-right-BOxKTHZ9.webp +0 -0
  456. package/web/dist/assets/leg-right-BeDSbUV7.webp +0 -0
  457. package/web/dist/assets/leg-right-BwrF93s6.webp +0 -0
  458. package/web/dist/assets/leg-right-CU-y_n5h.webp +0 -0
  459. package/web/dist/assets/leg-right-DKSfNi2y.webp +0 -0
  460. package/web/dist/assets/leg-right-Dq0ze2e4.webp +0 -0
  461. package/web/dist/assets/leg-right-t34e1CvD.webp +0 -0
  462. package/web/dist/assets/lib-BQXq3kEf.js +1 -0
  463. package/web/dist/assets/loader-circle-DjzuGw6j.js +1 -0
  464. package/web/dist/assets/manager-chat-C4QqN-w6.js +1 -0
  465. package/web/dist/assets/manager-index-BGNDfiIy.js +1 -0
  466. package/web/dist/assets/manager-new-Dek6H9Bg.js +2 -0
  467. package/web/dist/assets/managers-Dufza9IX.js +1 -0
  468. package/web/dist/assets/{markdown-Di8pirEb.js → markdown-CP2EQDsL.js} +1 -1
  469. package/web/dist/assets/{markdown-rDA5iFAU.js → markdown-YWy3FUHK.js} +2 -2
  470. package/web/dist/assets/mascot-picker-0_LGzV_f.js +1 -0
  471. package/web/dist/assets/{message-square-CstvkIHe.js → message-square-beq8DjLH.js} +1 -1
  472. package/web/dist/assets/new-task-form-BgMiEphZ.js +2 -0
  473. package/web/dist/assets/pencil-RUM53auZ.js +1 -0
  474. package/web/dist/assets/picker-pill-BO6YUs1F.js +1 -0
  475. package/web/dist/assets/play-Cj3p2Q5t.js +1 -0
  476. package/web/dist/assets/plus-Bdmhj8CR.js +1 -0
  477. package/web/dist/assets/portrait-BJ2e30PF.webp +0 -0
  478. package/web/dist/assets/portrait-BeDbYw8Z.webp +0 -0
  479. package/web/dist/assets/portrait-Bq7D7LzX.webp +0 -0
  480. package/web/dist/assets/portrait-C6HtaggP.webp +0 -0
  481. package/web/dist/assets/portrait-CcOzDXGs.webp +0 -0
  482. package/web/dist/assets/portrait-D44z6yep.webp +0 -0
  483. package/web/dist/assets/portrait-DHLQRy13.webp +0 -0
  484. package/web/dist/assets/portrait-DU3qlTxc.webp +0 -0
  485. package/web/dist/assets/portrait-q94U_uD6.webp +0 -0
  486. package/web/dist/assets/project-router-xmadY-N9.js +1 -0
  487. package/web/dist/assets/queries-ba5qZ3kd.js +1 -0
  488. package/web/dist/assets/reasoning-effort-pill-B8Z1RaXL.js +1 -0
  489. package/web/dist/assets/reference-chip-C9pVQk05.js +1 -0
  490. package/web/dist/assets/reference-conflict-action-DxUm18aD.js +1 -0
  491. package/web/dist/assets/repo-git-DFf8ZGZv.js +1 -0
  492. package/web/dist/assets/right-BFOa1Ihi.webp +0 -0
  493. package/web/dist/assets/right-BLsBZrK1.webp +0 -0
  494. package/web/dist/assets/right-BVU3rYuj.webp +0 -0
  495. package/web/dist/assets/right-BbES4jIG.webp +0 -0
  496. package/web/dist/assets/right-C2klSA-G.webp +0 -0
  497. package/web/dist/assets/right-Cte2BTL5.webp +0 -0
  498. package/web/dist/assets/right-Dz7jYN17.webp +0 -0
  499. package/web/dist/assets/right-W2oGaUHb.webp +0 -0
  500. package/web/dist/assets/right-XJjUU0AU.webp +0 -0
  501. package/web/dist/assets/run-actions-CLIUiXwS.js +1 -0
  502. package/web/dist/assets/{run-diff-CFHlmgGA.js → run-diff-CxS_a1EO.js} +2 -2
  503. package/web/dist/assets/{save-C4TDysfG.js → save-zfKVAo2Y.js} +1 -1
  504. package/web/dist/assets/{scroll-within-D3mqUngk.js → scroll-within-DhWf-4MN.js} +1 -1
  505. package/web/dist/assets/search-CCE2KMtX.js +1 -0
  506. package/web/dist/assets/{search-x-BkezzsKh.js → search-x-BxcYdvqm.js} +1 -1
  507. package/web/dist/assets/{settings-2-DIHmg7wZ.js → settings-2-B0yYRU0q.js} +1 -1
  508. package/web/dist/assets/sheet-DxqNqi5S.js +1 -0
  509. package/web/dist/assets/skills-BmQ9hZ2c.js +1 -0
  510. package/web/dist/assets/sortable.esm-Dj7Kk-Wk.js +5 -0
  511. package/web/dist/assets/square--LrBHma0.js +1 -0
  512. package/web/dist/assets/standing-C42GacCE.webp +0 -0
  513. package/web/dist/assets/standing-C5Tul1Nv.webp +0 -0
  514. package/web/dist/assets/standing-CUU2Jka6.webp +0 -0
  515. package/web/dist/assets/standing-Ca5nprIS.webp +0 -0
  516. package/web/dist/assets/standing-CgOaMKRT.webp +0 -0
  517. package/web/dist/assets/standing-ClF4PE2-.webp +0 -0
  518. package/web/dist/assets/standing-CoS9fBjb.webp +0 -0
  519. package/web/dist/assets/standing-DZrhVTuG.webp +0 -0
  520. package/web/dist/assets/standing-MhG0Chks.webp +0 -0
  521. package/web/dist/assets/status-dot-Dxb9pPsK.js +1 -0
  522. package/web/dist/assets/tabs-CmEFauE4.js +1 -0
  523. package/web/dist/assets/{tag-B56iP2zA.js → tag-TWBVKabJ.js} +1 -1
  524. package/web/dist/assets/task-commits-sdhrDSta.js +1 -0
  525. package/web/dist/assets/{task-graph-ZjFyDrAV.js → task-graph-DqXUw-PM.js} +1 -1
  526. package/web/dist/assets/task-notes-ur3eZYQs.js +1 -0
  527. package/web/dist/assets/task-workspace-BvamqKbw.js +28 -0
  528. package/web/dist/assets/terminal-CmRAOyqu.js +1 -0
  529. package/web/dist/assets/terminal-drawer-BiRjtnip.js +1 -0
  530. package/web/dist/assets/{terminal-pane-CeYi-FvS.js → terminal-pane-YnSc_Vhs.js} +2 -2
  531. package/web/dist/assets/{textarea-BXN4nZ0d.js → textarea-C58jseO-.js} +1 -1
  532. package/web/dist/assets/toaster-5ad4wwJ9.js +1 -0
  533. package/web/dist/assets/tooltip-45rfBiq8.js +1 -0
  534. package/web/dist/assets/tracker-CcyqVPEo.js +4 -0
  535. package/web/dist/assets/triangle-alert-C1mTIqxM.js +1 -0
  536. package/web/dist/assets/typing-left-BWPbVi7e.webp +0 -0
  537. package/web/dist/assets/typing-right-HDY0V90O.webp +0 -0
  538. package/web/dist/assets/{upload-D_kW6AjR.js → upload-C2gxSnMR.js} +1 -1
  539. package/web/dist/assets/use-now-DD2atNhs.js +1 -0
  540. package/web/dist/assets/utils-Br_dqwn-.js +60 -0
  541. package/web/dist/assets/{workflow-j8scU63W.js → workflow-WvO4bTRt.js} +1 -1
  542. package/web/dist/assets/workflow-graph-B2oESW5u.js +13 -0
  543. package/web/dist/assets/worktree-lifecycle-BxYvSKsA.js +1 -0
  544. package/web/dist/assets/{worktree-lifecycle-operation-mYB7KCpQ.js → worktree-lifecycle-operation-BRID04bW.js} +1 -1
  545. package/web/dist/assets/x-CZSnHsZ4.js +1 -0
  546. package/web/dist/assets/{zoomable-image-CW-pQ6ZO.js → zoomable-image-DCITEnK-.js} +1 -1
  547. package/web/dist/index.html +70 -60
  548. package/web/dist/assets/agent-task-pickers-8skJH9bS.js +0 -1
  549. package/web/dist/assets/arrow-down-cBTb_EjO.js +0 -1
  550. package/web/dist/assets/arrow-left-BvR1Oqhc.js +0 -1
  551. package/web/dist/assets/arrow-up-Cn0IS81u.js +0 -1
  552. package/web/dist/assets/ask-answer-Cfb0vEFv.js +0 -1
  553. package/web/dist/assets/automations-route-B4axw9eb.js +0 -1
  554. package/web/dist/assets/check-B5omShEO.js +0 -1
  555. package/web/dist/assets/chevron-left-D74_-PJ_.js +0 -1
  556. package/web/dist/assets/chevron-right-C3fLn_fF.js +0 -1
  557. package/web/dist/assets/circle-check-j6r9xbE5.js +0 -1
  558. package/web/dist/assets/compare-variants-CDrFR7P_.js +0 -1
  559. package/web/dist/assets/composer-GntpkeQD.js +0 -18
  560. package/web/dist/assets/composer-attachments-Xa-qW8Eq.js +0 -3
  561. package/web/dist/assets/dashboard-CJW-Xk7f.js +0 -44
  562. package/web/dist/assets/diff-RPASOQVF.js +0 -3
  563. package/web/dist/assets/diff-view-Ckaab4uQ.js +0 -13
  564. package/web/dist/assets/file-preview-DOSEbcqV.js +0 -2
  565. package/web/dist/assets/git-tab-loading-DhclV71X.js +0 -1
  566. package/web/dist/assets/git-toolbar-Bk-3i42V.js +0 -1
  567. package/web/dist/assets/github-TdBnzj-H.js +0 -1
  568. package/web/dist/assets/icon-tooltip-CUJLXOxf.js +0 -1
  569. package/web/dist/assets/index-CDhEdFaZ.js +0 -33
  570. package/web/dist/assets/index-Dk1VTlxY.css +0 -2
  571. package/web/dist/assets/layout-cards-BYOEsNbu.js +0 -1
  572. package/web/dist/assets/lib-D2__YoPr.js +0 -1
  573. package/web/dist/assets/loader-circle-DCpZCAyT.js +0 -1
  574. package/web/dist/assets/manager-chat-B1Taq3Eg.js +0 -1
  575. package/web/dist/assets/manager-index-COwisKDf.js +0 -1
  576. package/web/dist/assets/manager-new-BdJPiBs2.js +0 -2
  577. package/web/dist/assets/manager-pickers-CvYpd5cU.js +0 -1
  578. package/web/dist/assets/managers-CDiETPHi.js +0 -1
  579. package/web/dist/assets/pencil-DWtoOm2f.js +0 -1
  580. package/web/dist/assets/picker-pill-DQICTO2N.js +0 -1
  581. package/web/dist/assets/play-BYwEI1EA.js +0 -1
  582. package/web/dist/assets/plus-BPopgSYQ.js +0 -1
  583. package/web/dist/assets/popover-DzdYqnHw.js +0 -1
  584. package/web/dist/assets/project-router-CmpQcVZp.js +0 -1
  585. package/web/dist/assets/queries-DOHu2y2B.js +0 -1
  586. package/web/dist/assets/reference-chip-ty5g_OLC.js +0 -1
  587. package/web/dist/assets/reference-conflict-action-B2LrO-o3.js +0 -1
  588. package/web/dist/assets/repo-git-CyoBxHfP.js +0 -1
  589. package/web/dist/assets/sheet-7RYAcp_E.js +0 -1
  590. package/web/dist/assets/skills-BBqk5FoM.js +0 -1
  591. package/web/dist/assets/sortable.esm-O2daV3YI.js +0 -5
  592. package/web/dist/assets/square-BPbl10lx.js +0 -1
  593. package/web/dist/assets/status-dot-C_5ryAFi.js +0 -1
  594. package/web/dist/assets/tabs-EEnYYrJF.js +0 -1
  595. package/web/dist/assets/task-commits-DFalvqkF.js +0 -1
  596. package/web/dist/assets/task-notes-DRDKGsIw.js +0 -1
  597. package/web/dist/assets/task-workspace-D2ak5sTE.js +0 -28
  598. package/web/dist/assets/terminal-B-JX8x9P.js +0 -1
  599. package/web/dist/assets/terminal-drawer-S0cBMANF.js +0 -1
  600. package/web/dist/assets/toaster-DrFdGtNN.js +0 -3
  601. package/web/dist/assets/tooltip-p6YPEpXC.js +0 -1
  602. package/web/dist/assets/tracker-CFDEuaFt.js +0 -4
  603. package/web/dist/assets/triangle-alert-Crbc2knA.js +0 -1
  604. package/web/dist/assets/use-now-DQpgbshl.js +0 -1
  605. package/web/dist/assets/utils-Df_1kJEk.js +0 -60
  606. package/web/dist/assets/workflow-graph-Cye5SBdg.js +0 -13
  607. package/web/dist/assets/worktree-lifecycle-Da61xsLH.js +0 -1
  608. package/web/dist/assets/x-sQR-jRBj.js +0 -1
@@ -1,18 +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{$t as r,Fr as i,Hi as a,Ht as o,Ya as s,_a as c,cn as ee,d as l,dt as te,r as ne,s as u,zr as re}from"./queries-DOHu2y2B.js";import{U as d,W as f,t as p}from"./utils-Df_1kJEk.js";import{r as m}from"./toaster-DrFdGtNN.js";import{N as ie,t as h}from"./button-BrxohNcK.js";import{t as ae}from"./arrow-up-Cn0IS81u.js";import{t as g}from"./check-B5omShEO.js";import{t as oe}from"./icon-tooltip-CUJLXOxf.js";import{t as _}from"./plus-BPopgSYQ.js";import{c as se,n as ce,r as le,t as ue}from"./popover-DzdYqnHw.js";import{t as de}from"./square-BPbl10lx.js";import{t as fe}from"./x-sQR-jRBj.js";import{J as pe,Q as me,Z as v,a as he,n as ge,o as _e,q as ve,r as ye,s as y}from"./composer-attachments-Xa-qW8Eq.js";import{c as be,n as xe,s as Se,t as Ce}from"./use-now-DQpgbshl.js";import{t as we}from"./use-submit-shortcut-BJ10ZshV.js";var Te=ie(`mic`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`,key:`1vc78b`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`13`,rx:`3`,key:`s6n7sd`}]]),Ee=ie(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),b=e(t(),1),De=new Set([`ai`,`cezar`,`agents`,`team`]);function x(e){return De.has(e.source)}function Oe(e){return[...e].sort((e,t)=>Number(!x(e))-Number(!x(t)))}var S=5;function C(e,t,{mostUsedLimit:n=S}={}){let r=e.map((e,n)=>({skill:e,index:n,count:T(t,e.name)})).filter(e=>e.count>0).sort((e,t)=>t.count-e.count||Number(!x(e.skill))-Number(!x(t.skill))||e.index-t.index).slice(0,n).map(e=>e.skill),i=new Set(r),a=e.filter(e=>!i.has(e));return{mostUsed:r,project:a.filter(x),global:a.filter(e=>!x(e))}}function w(e,t){let n=C(e,t);return[...n.mostUsed,...n.project,...n.global]}function T(e,t){if(!e||!Object.hasOwn(e,t))return 0;let n=e[t];return typeof n==`number`?n:0}function ke(e,t){return{...e,[t]:T(e,t)+1}}function Ae(e,t){if(t===``)return!0;let n=e.toLowerCase(),r=t.toLowerCase(),i=0;for(let e of r){if(i=n.indexOf(e,i),i===-1)return!1;i+=1}return!0}function E(e,t){let n=[];for(let r of e)for(let e of r.steps??[])e.skill===t&&n.push(`${r.name} › ${e.name??e.id}`);return n}var D=/[\s\-/_.]/;function je(e,t){let n=0;for(let r=e.indexOf(t);r!==-1;r=e.indexOf(t,r+1)){let i=1,a=e[r-1];if(r===0||a!==void 0&&D.test(a)){let n=e[r+t.length];i=n===void 0||D.test(n)?3:2}if(i>n&&(n=i),n===3)break}return n}function Me(e,t,n){let r=t.toLowerCase().split(/\s+/).filter(Boolean);if(r.length===0)return 1;let i=[e,...n??[]].join(` `).toLowerCase(),a=0;for(let e of r){let t=je(i,e);if(t===0)return 0;a+=t}return a/(r.length*3)}function O(e,t){if(t===``)return 1;let n=e.toLowerCase(),r=t.toLowerCase();if(n===r)return 6;if(n.startsWith(r))return 5;let i=n.indexOf(r);if(i>0){let e=n[i-1];return e!==void 0&&D.test(e)?4:3}return+!!Ae(n,r)}function k(e,t){let n=e.split(`-`).filter(Boolean);return t?[...n,t]:n}var Ne=10;function A(e,t,n){let r=n.toLowerCase().split(/\s+/).filter(Boolean);if(r.length===0)return 1;let i=0;for(let n of r){let r=O(e,n),a=t?O(t,n):0;if(r===0&&a===0)return 0;i+=r>0?r+Ne:a}return i}var Pe=.5;function j(e,t,n){return t.trim()===``?[...e]:e.map((e,r)=>{let i=A(e.name,e.description,t),a=T(n,e.name),o=Math.min(a,S)*Pe;return{item:e,index:r,count:a,score:i>0?i+o:0}}).filter(e=>e.score>0).sort((e,t)=>t.score-e.score||t.count-e.count||e.index-t.index).map(e=>e.item)}function M(e,t,n){return j(e,t,n)}function N(e,t){return j(e,t)}function Fe(e,t,n){return j(w(e,n),t,n)}function Ie(e){let t=new Map;for(let n of e){let e=n.team?.repo??``,r=t.get(e)??{key:e,label:e===``?`This project & machine`:e,skills:[]};r.skills.push(n),t.set(e,r)}return[...t.values()].sort((e,t)=>Number(e.key!==``)-Number(t.key!==``))}var P=[`claude`,`codex`,`junie`,`opencode`,`cursor`,`pi`,`copilot`,`antigravity`],F={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`,cursor:`Cursor`,pi:`pi`,junie:`Junie`,copilot:`GitHub Copilot CLI`,antigravity:`Antigravity`};function Le(e){if(typeof e!=`object`||!e||Array.isArray(e))return{};let t=e,n={};for(let e of P){let r=t[e];typeof r==`string`&&r.length>0&&r.length<=128&&(n[e]=r)}return n}function I(e,t){if(!e)return[];let n=new Map(e.providers.map(e=>[e.provider,e]));return P.flatMap(e=>{let r=n.get(e);return r?.status!==`disconnected`||!r.authFailureId||t[e]===r.authFailureId?[]:[{provider:e,label:F[e],authFailureId:r.authFailureId}]})}function L(e,t){return{...e,...Object.fromEntries(t.map(({provider:e,authFailureId:t})=>[e,t]))}}function Re(){let e=l(),t=te(),n=(e.data?.profiles??[]).map(e=>({provider:e.provider,id:e.id,label:e.label,configDir:e.configDir})),r=t.data?.info?.root;return{accounts:n,repoAccount:ze(r?e.data?.selections?.[r]:void 0,e.data?.defaults)}}function ze(e,t){let n={};for(let r of[t,e])for(let[e,t]of Object.entries(r??{}))t&&(n[e]=t);return Object.keys(n).length>0?n:void 0}function Be(e,t){return`${F[e]} account "${t.replace(/"/g,``)}" is not signed in. Sign it in under Settings → Agent accounts, or choose another account for this task.`}function Ve(e,t){let n=s(),r=l().data?.profiles.find(n=>n.provider===e&&n.id===t&&!n.isDefault),i=r?d(r):``,a=r?.status,o=u(i,r!==void 0&&a?.status!==`connected`).data?.status??(a?.status===`connected`?a:void 0),c=t=>r&&t!==void 0&&t!==`connected`?Be(e,r.label||r.id):null;return{blocked:c(o?.status),verify:async()=>{if(!r)return null;try{let e=await re(i,{refresh:!0});return n.setQueryData(ee.agentAccountStatus(i),e),c(e.status.status)}catch{return null}}}}function R(e,t){return e.filter(e=>e.provider===t).length>1}var He=80,z=f,B=50,V=200,H=50,Ue=[{id:`add-tests`,label:`Add tests`,text:`Also add or update tests covering this change.`},{id:`explain-change`,label:`Explain the change`,text:`Explain what changed and why before finishing.`},{id:`keep-minimal`,label:`Keep it minimal`,text:`Keep the change as small and targeted as possible — no unrelated refactors.`},{id:`update-docs`,label:`Update docs`,text:`Also update any relevant documentation or comments.`},{id:`check-edge-cases`,label:`Double-check edge cases`,text:`Double-check edge cases and error handling before finishing.`},{id:`review-open-prs`,label:`Review open PRs`,text:'Check this repository\'s open pull requests that still need a review (use `gh pr list --state open --json number,title,headRefName,isDraft,reviewDecision` and skip drafts and PRs already approved). For each one, dispatch a separate review task with `cez task create --kind review --review-of <headRefName> --title "Review PR #<number>" "Review pull request #<number> (<title>) on branch <headRefName>: read the diff, run the tests, and report a verdict with findings."`, at most 4 at a time. Then end your turn with CEZ:MONITORING and, when their reports arrive, summarise every verdict in one message. If `cez task create` is refused or unavailable, stop and report that dispatch is disabled on this cockpit — do not review the PRs yourself and do not use sub-agents instead.'},{id:`create-automation`,label:`Create an automation`,skills:[`create-cezar-automation`],text:`Create an automation for this repository.
2
- Trigger: <when — e.g. every new pull request; every issue labelled \`needs-agent\`; every day at 04:00; weekdays at 07:30; every 6 hours>.
3
- Task for each run: <what the launched task must do — e.g. review the diff, run the tests and post findings as a review comment>.
4
- Leave it paused and, for a GitHub trigger, preview its matches so I can check the filter before enabling it.`}],U=new Set([`review-open-prs`]),We=new Set([`create-automation`]);function W(e,t){return e.filter(e=>(t?.dispatch===!0||!U.has(e.id))&&(t?.automations===!0||!We.has(e.id)))}function G(e){return!!e&&typeof e==`object`}function K(e){if(e===void 0||!Array.isArray(e))return Ue.map(e=>({...e}));let t=new Set,n=[];for(let r of e){if(!G(r))continue;let e=typeof r.id==`string`?r.id.trim():``,i=typeof r.label==`string`?r.label.trim():``,a=typeof r.text==`string`?r.text.trim():``;if(!e||!i||!a||t.has(e))continue;t.add(e);let o=q(r.skills);if(n.push({id:e,label:i.slice(0,He),text:a.slice(0,z),...o.length>0?{skills:o}:{}}),n.length>=B)break}return n}function q(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e){if(typeof n!=`string`)continue;let e=n.trim();if(!(!e||t.has(e))&&(t.add(e.slice(0,V)),t.size>=H))break}return[...t]}function Ge(e,t){if(t.length===0)return[];let n=new Set(t);return e.filter(e=>e.skills?.some(e=>n.has(e)))}function J(e,t){return Ge(e,t).map(e=>e.text).join(`
5
-
6
- `)}function Ke(e,t,n,r=``){if(e===``||e===r||e===t){let e=r&&n?`${r}\n\n${n}`:r||n;return{text:e,applied:n?e:``}}return{text:e,applied:t}}function qe(){return`tpl-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function Je(e,t,n){let r=Math.max(0,Math.min(t,e.length)),i=e.slice(0,r),a=e.slice(r),o=``;i.length>0&&(o=i.endsWith(`
7
-
8
- `)?``:i.endsWith(`
9
- `)?`
10
- `:`
11
-
12
- `);let s=a.replace(/^[ \t]+/,``),c=``;return s.length>0&&(c=s.startsWith(`
13
-
14
- `)?``:s.startsWith(`
15
- `)?`
16
- `:`
17
-
18
- `),{text:i+o+n+c+s,caret:i.length+o.length+n.length}}var Y=new Map,X=new Map;function Ye(e){return e instanceof Error&&e.status===413}function Xe(e){let t=Y.get(e.data);return t||(t=c(y(e)).then(e=>typeof e?.uploadId==`string`?e.uploadId:null,t=>(Ye(t)&&X.set(e.data,t),ve(t),null)),Y.set(e.data,t),t.then(n=>{n===null&&Y.get(e.data)===t&&Y.delete(e.data)})),t}async function Ze(e){let t=await Xe(e),n=X.get(e.data);if(t===null&&n)throw n;return t===null?y(e):{uploadId:t,...e.originalName?{name:e.originalName}:{}}}function Qe(e){for(let t of e){let e=Y.get(t.data);e&&(Y.delete(t.data),X.delete(t.data),e.then(e=>e===null?void 0:i(e)).catch(()=>{}))}}function Z(e){for(let t of e)Y.delete(t.data),X.delete(t.data)}function $e(e){return e instanceof Error&&e.message.includes(`attachment upload expired — attach the file again`)}async function et(e,t){if(e.length===0)return t([]);try{return await t(await Promise.all(e.map(Ze)))}catch(n){if(!$e(n))throw n;Z(e);try{let n=await t(await Promise.all(e.map(Ze)));return v(`recovered`),n}catch(e){throw v(`failed`),e}}}var tt=new Set([`/`,`@`]);function nt(e,t){for(let n=t-1;n>=0;--n){let r=e[n];if(/\s/.test(r))return null;if(tt.has(r))return n>0&&!/\s/.test(e[n-1])?null:{trigger:r,start:n,query:e.slice(n+1,t)}}return null}function rt(e,t,n,r){let i=`${t.trigger}${r} `;return{text:e.slice(0,t.start)+i+e.slice(n),caret:t.start+i.length}}function it(){let e=window;return e.SpeechRecognition??e.webkitSpeechRecognition}function at(e,t){let n=e,r=``;for(let e=t.resultIndex;e<t.results.length;e+=1){let i=t.results[e],a=i[0]?.transcript??``;i.isFinal?n+=a:r+=a}return{finalText:n,interim:r}}var ot=`Dictation needs https or localhost`,Q=`Dictation is not available in this browser`,st=`Dictation needs a newer Cezar app — update it to use the microphone`;function ct(){let e=window.__CEZ_DESKTOP__;return e?.platform!==`macos`&&document.documentElement.dataset.cezDesktop!==`macos`?null:{microphone:e?.microphone===!0}}function lt(){return window.isSecureContext===!1?ot:dt?Q:ct()?.microphone===!1?st:null}function ut(e){switch(e){case`aborted`:return null;case`no-speech`:return{message:`Dictation heard nothing — try again`,failure:null};case`not-allowed`:return{message:ct()?`Microphone blocked — allow Cezar in System Settings → Privacy & Security → Microphone and Speech Recognition`:`Microphone blocked — allow it for this site in the browser's site settings`,failure:null};case`service-not-allowed`:return{message:Q,failure:null};case`audio-capture`:return{message:`Dictation failed — no microphone was found`,failure:e};case`network`:return{message:`Dictation failed — the speech service could not be reached`,failure:e};default:return{message:`Dictation failed${e?` — ${e}`:``}`,failure:e||`unknown`}}}var dt=!1;function ft(e){let[t,n]=b.useState(null),r=b.useRef(null),i=b.useRef(``),[a]=b.useState(()=>it()!==void 0),[o,s]=b.useState(lt),c=b.useCallback(()=>{let e=r.current;r.current=null,i.current=``,n(null),e&&(e.onresult=null,e.onerror=null,e.onend=null,e.abort())},[]);return b.useEffect(()=>c,[c]),{supported:a,unavailable:o,recording:t,start:b.useCallback(()=>{if(r.current||o)return;let t=it();if(!t)return;let a;try{a=new t,a.lang=navigator.language||`en-US`,a.continuous=!0,a.interimResults=!0;let o=Date.now();a.onresult=e=>{let t=at(i.current,e);i.current=t.finalText,n({transcript:t.finalText+t.interim,startedAt:o})},a.onerror=t=>{c(),t.error===`service-not-allowed`&&(dt=!0,s(Q));let n=ut(t.error);n&&e(n)},a.start(),r.current=a,n({transcript:``,startedAt:o})}catch{e({message:`Dictation failed — the microphone could not be started`,failure:`start-threw`}),c()}},[e,c,o]),cancel:b.useCallback(()=>c(),[c]),finish:b.useCallback(()=>{let e=r.current,a=(i.current+``).trim()===``?``:i.current,o=t?.transcript??a;return e&&(e.onresult=null,e.onerror=null,e.onend=null,e.stop()),r.current=null,i.current=``,n(null),o.trim()},[t])}}function pt(e,t){let n=Math.max(0,Math.floor((t-e)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,`0`)}`}var $=n(),mt={KeyA:`Yes, approved.`,KeyC:`Continue.`};function ht(e){let t=[];for(let n=e.parentElement;n;n=n.parentElement)n.scrollTop>0&&t.push([n,n.scrollTop]);return t}function gt({onSubmit:e,value:t,onValueChange:n,images:i,onImagesChange:c,autoFocus:ee=!1,draftItems:l,footerStart:te,footerEnd:u,sendAriaLabel:re=`Send`,sendLabel:d,sendMenu:f,sendShortcut:ie,stop:g,disabled:_=!1,submitDisabled:v=!1,disabledReason:ve=`Session closed — Continue to reopen.`,allowEmptySubmit:y=!1,placeholder:Ce=`Reply — / for skills, @ for files…`,ariaLabel:De=`Reply to the agent`,autocompleteSkills:Oe=!0,slashCommands:S,attachments:C=!0,compact:w=!1,quickReplies:T=!1,getMentionCandidates:E,ref:D}){let[je,Me]=(0,b.useState)(``),O=t??je,k=(0,b.useRef)(O);k.current=O;let Ne=(0,b.useRef)(n);Ne.current=n;let A=(0,b.useCallback)(e=>{let t=typeof e==`function`?e(k.current):e;Me(t),Ne.current?.(t)},[]),[Pe,j]=(0,b.useState)([]),M=i??Pe,N=(0,b.useRef)(M);N.current=M;let Ie=(0,b.useRef)(c);Ie.current=c;let P=(0,b.useCallback)((e,t=`edit`)=>{let n=typeof e==`function`?e(N.current):e;N.current=n,j(n),Ie.current?.(n,t)},[]),[F,Le]=(0,b.useState)(!1),[I,L]=(0,b.useState)(null),[Re,ze]=(0,b.useState)(``),[Be,Ve]=(0,b.useState)(!1),R=(0,b.useRef)(null),He=(0,b.useRef)(null),z=(0,b.useRef)(null),B=(0,b.useRef)(new Map),V=o(Oe&&S===void 0&&Be),H=r(),Ue=s(),U=ft(({message:e,failure:t})=>{t&&pe(t),m(e,t?{tone:`danger`,reported:!0}:{})});(0,b.useEffect)(()=>{ee&&R.current?.focus()},[]),(0,b.useImperativeHandle)(D,()=>({insertAtCaret:e=>{let t=R.current,n=Je(k.current,t?.selectionStart??k.current.length,e);A(n.text),z.current=n.caret,t?.focus()}}),[A]);let We=(0,b.useCallback)(()=>{let e=R.current;if(!e||_){L(null);return}let t=nt(e.value,e.selectionStart??e.value.length);if(t?.trigger===`/`&&!Oe&&S===void 0||t?.trigger===`@`&&E===void 0)return L(null);t?.trigger===`/`&&Ve(!0),L(t)},[Oe,_,E,S]),W=(0,b.useMemo)(()=>I===null?[]:I.trigger===`/`&&S?S.filter(e=>Ae(e.name,I.query)).map(e=>({value:e.name,insert:e.name,label:`/${e.name}`,description:e.description,emphasized:!1})):I.trigger===`/`?Fe(V.data??[],I.query,H.data?.skillUsage).map(e=>({value:`${e.name} ${e.path}`,insert:e.name,label:e.name,description:e.description,emphasized:x(e)})):(E?.()??[]).filter(e=>Ae(e,I.query)).map(e=>({value:e,insert:e,label:e,emphasized:!1})),[E,V.data,S,I,H.data?.skillUsage]),G=W.some(e=>e.value===Re)?Re:W[0]?.value,K=I!==null,q=(0,b.useCallback)(()=>L(null),[]),Ge=e=>{let t=R.current;if(!t||I===null)return;let n=t.selectionStart??t.value.length,r=rt(t.value,I,n,e.insert);I.trigger===`/`&&S===void 0&&H.data!==void 0&&a({skillUsage:ke(H.data.skillUsage,e.insert)}).then(()=>Ue.invalidateQueries({queryKey:ne.uiState})).catch(()=>{}),A(r.text),z.current=r.caret,L(null),t.focus()};(0,b.useEffect)(()=>{!K||G==null||B.current.get(G)?.scrollIntoView({block:`nearest`})},[G,K]),(0,b.useLayoutEffect)(()=>{let e=z.current,t=R.current;e!==null&&t&&(t.setSelectionRange(e,e),z.current=null)},[O]),(0,b.useLayoutEffect)(()=>{let e=R.current;if(!e)return;let t=ht(e);e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,220)}px`;for(let[e,n]of t)e.scrollTop!==n&&(e.scrollTop=n)},[O]);let J=(0,b.useCallback)((e,t=`file`)=>{if(_||!C)return;let n=_e(e,N.current.length,ye(N.current));for(let e of n.rejected)m(e,{tone:`danger`,expected:!0});for(let e of n.accepted)he(e,t).then(e=>{let t=ge(N.current,e);t&&(Xe(e),P(t))},t=>{let n=t instanceof DOMException&&t.name===`NotFoundError`;m(`“${e.name}” could not be read${n?` — a folder, or a file that no longer exists`:``}`,{tone:`danger`,expected:n})})},[C,_]),Ke=e=>{if(!C)return;let t=[...e.clipboardData?.items??[]].filter(e=>e.kind===`file`).map(e=>e.getAsFile()).filter(e=>e!==null);t.length!==0&&(e.preventDefault(),J(t,`clipboard`))},qe=e=>{let t=[...e.dataTransfer?.files??[]];t.length!==0&&(e.preventDefault(),J(t))},Y=(0,b.useCallback)(async(t,n,r,i)=>{let a=t.trim();if(!(_||v||F)&&!(a===``&&n.length===0&&!y)){Le(!0);try{await et(n,t=>i?e(a,t,i):e(a,t)),Qe(n),me(n.length)}catch(e){if(m(e instanceof Error?e.message:String(e),{tone:`danger`}),r){A(e=>e===``?t:`${t}\n${e}`);let e=[],r=N.current.reduce((t,n)=>{let r=ge(t,n);return r||e.push(n),r??t},n);for(let t of e)m(`“${t.name}” removed — the restored message fills the attachment limit`,{tone:`danger`});P(r)}}finally{Le(!1)}}},[y,F,_,v,e]),X=(0,b.useCallback)(()=>{if(_||v||F||O.trim()===``&&M.length===0&&!y)return;let e=O,t=M;A(``),P([],`submit`),L(null),Y(e,t,!0)},[y,F,_,v,M,Y,O]),Ye=e=>{if(K){if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),W.length===0)return;let t=W.findIndex(e=>e.value===G),n=e.key===`ArrowDown`?1:-1,r=W[(t+n+W.length)%W.length];ze(r.value);return}if(e.key===`Escape`){e.preventDefault(),q();return}if((e.key===`Enter`||e.key===`Tab`)&&!e.shiftKey){let t=W.find(e=>e.value===G);if(t&&S&&e.key===`Enter`&&I?.query===t.insert)q();else if(t){e.preventDefault(),Ge(t);return}q()}}if(e.key===`Escape`&&!e.nativeEvent.isComposing&&!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&!e.altKey){e.currentTarget.blur();return}we({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.preventDefault(),X())};(0,b.useEffect)(()=>{if(!T||_)return;let e=e=>{if(!e.altKey||e.metaKey||e.ctrlKey||e.repeat||se(e.target))return;let t=mt[e.code];t!==void 0&&(e.preventDefault(),Y(t,[],!1,{quickReply:!0}))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[_,T,Y]);let Ze=e=>{let t=U.finish();if(t===``)return;let n=O.trim()===``?t:`${O.replace(/\s*$/,``)} ${t}`;if(e){A(``),P([],`submit`),Y(n,M,!0);return}A(n),z.current=n.length,R.current?.focus()},Z=U.recording,$e=O.trim()!==``||M.length>0||y,tt=_||v||F||!$e,it=(0,$.jsxs)(h,{type:`button`,size:d?`sm`:`icon-sm`,variant:w?`contrast`:void 0,"aria-label":re,disabled:tt,className:p(w?`h-10 w-auto gap-1.5 rounded-full px-4 pointer-coarse:max-md:h-11 md:size-8 md:rounded-md md:px-0`:d?`h-8`:`size-8`,f&&`rounded-r-none`),onClick:X,children:[(0,$.jsx)(ae,{"aria-hidden":`true`}),d,w?(0,$.jsx)(`span`,{className:`md:hidden`,children:`Send`}):null]}),at=ie?(0,$.jsx)(oe,{side:`top`,label:(0,$.jsxs)(`span`,{"data-slot":`composer-send-shortcut`,className:`flex items-center gap-2`,children:[d??re,(0,$.jsx)(`kbd`,{className:`font-sans opacity-70`,children:ie})]}),children:it}):it,ot=w?`size-10 rounded-full bg-muted text-muted-foreground pointer-coarse:max-md:size-11 md:size-8 md:rounded-md md:bg-transparent`:`h-8 gap-1.5 px-2.5 text-xs font-medium text-muted-foreground`,Q=(0,$.jsx)(Te,{"aria-hidden":`true`,className:w?`size-4`:`size-3.5`}),st=w?`icon-sm`:`sm`,ct=U.supported&&U.unavailable?(0,$.jsx)(oe,{label:U.unavailable,side:`top`,children:(0,$.jsxs)(h,{type:`button`,variant:`ghost`,size:st,"aria-disabled":`true`,"aria-label":`Start dictation`,className:p(ot,`cursor-not-allowed opacity-50 hover:bg-transparent`),children:[Q,w?null:`Dictation`]})}):U.supported?(0,$.jsxs)(h,{type:`button`,variant:`ghost`,size:st,disabled:_,"aria-label":`Start dictation`,title:`Dictation`,className:ot,onClick:U.start,children:[Q,w?null:`Dictation`]}):null,lt=g?(0,$.jsx)(oe,{label:g.label,side:`top`,children:(0,$.jsx)(h,{type:`button`,size:`icon-sm`,variant:`contrast`,"data-slot":`composer-stop`,"aria-label":g.label,disabled:g.pending,className:w?`size-10 rounded-full pointer-coarse:max-md:size-11 md:size-8 md:rounded-md`:`size-8`,onClick:g.onStop,children:(0,$.jsx)(de,{"aria-hidden":`true`,className:`size-3 fill-current`})})}):null,ut=f?(0,$.jsxs)(`div`,{"data-slot":`composer-send`,className:`flex transform-gpu items-center`,children:[at,(0,$.jsx)(`div`,{"data-slot":`composer-send-menu`,className:p(`flex`,tt&&`opacity-50 hover:opacity-100 focus-within:opacity-100`),children:f})]}):at,dt=(0,$.jsx)(`textarea`,{ref:R,rows:1,value:O,disabled:_,"aria-label":De,placeholder:_?ve:Ce,className:p(`block max-h-[220px] w-full resize-none bg-transparent text-base leading-normal outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed md:text-sm`,w?`order-first min-h-11 min-w-0 basis-full px-2 py-1.5 max-md:max-h-[calc((100dvh-var(--kb,0px))*0.35)] md:order-none md:min-h-9 md:flex-1 md:basis-auto md:px-1.5`:`min-h-11 px-3 pt-2.5 pb-1 md:min-h-[54px] md:px-4 md:pt-3`),onChange:e=>{A(e.target.value),We()},onKeyDown:Ye,onSelect:We,onPaste:Ke});return(0,$.jsxs)(ue,{open:K,onOpenChange:e=>e?void 0:q(),children:[(0,$.jsx)(ce,{asChild:!0,children:(0,$.jsxs)(`div`,{ref:He,"data-slot":`composer`,"data-disabled":_||void 0,onDrop:qe,onDragOver:e=>e.preventDefault(),className:p(w?`rounded-[1.75rem] md:rounded-xl`:`rounded-xl`,`border border-border bg-card shadow-xs transition-[border-color,box-shadow]`,`focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/15`,_&&`opacity-80`),children:[M.length>0||l?(0,$.jsxs)(`div`,{"data-slot":`composer-thumbs`,className:`flex flex-wrap items-center gap-2 px-4 pt-3`,children:[l,M.map((e,t)=>(0,$.jsxs)(`button`,{type:`button`,"aria-label":`Remove ${e.name}`,title:`Click to remove`,className:p(`group relative overflow-hidden rounded-md border border-border`,e.isImage?`size-12`:`flex h-12 max-w-[200px] items-center gap-1.5 bg-muted/40 px-2.5 text-xs text-muted-foreground`),onClick:()=>{Qe([e]),P(e=>e.filter((e,n)=>n!==t))},children:[e.isImage?(0,$.jsx)(`img`,{src:e.preview,alt:``,className:`size-full object-cover`}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ee,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,$.jsx)(`span`,{className:`truncate`,children:e.name})]}),(0,$.jsx)(`span`,{className:`absolute inset-0 hidden items-center justify-center bg-background/70 group-hover:flex group-focus-visible:flex`,children:(0,$.jsx)(fe,{"aria-hidden":`true`,className:`size-4`})})]},`${e.name}-${t}`))]}):null,w?(0,$.jsxs)(`div`,{"data-slot":`composer-compact-row`,className:`flex flex-wrap items-end gap-1.5 p-2 md:flex-nowrap md:gap-1 md:px-1.5 md:py-1`,children:[C?(0,$.jsx)(_t,{disabled:_,onFiles:J,compact:!0}):null,te,u?(0,$.jsx)(`div`,{className:`min-w-0 md:hidden`,children:u}):null,dt,Z?null:(0,$.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1.5 md:ml-0 md:gap-1 md:pb-0.5`,children:[ct,lt,(0,$.jsx)(`div`,{"data-slot":`composer-compact-send`,className:$e?`contents`:g?`hidden`:`contents md:hidden`,children:ut})]})]}):dt,Z?(0,$.jsx)(vt,{transcript:Z.transcript,startedAt:Z.startedAt,onCancel:U.cancel,onInsert:()=>Ze(!1),onInsertAndSend:()=>Ze(!0)}):w?null:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 gap-y-1 px-1.5 pt-1 pb-1.5 md:gap-y-1.5 md:px-2 md:pt-1.5 md:pb-2`,children:[(0,$.jsxs)(`div`,{"data-slot":`composer-footer-start`,className:`flex min-w-0 flex-wrap items-center gap-1`,children:[C?(0,$.jsx)(_t,{disabled:_,onFiles:J}):null,te]}),(0,$.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[ct,u?(0,$.jsx)(`div`,{"data-slot":`composer-footer-end`,className:`flex items-center gap-1.5`,children:u}):null,lt,!g||$e?ut:null]})]})]})}),(0,$.jsx)(le,{side:`top`,align:`start`,sideOffset:8,className:`w-80 max-w-[calc(100vw-2rem)] p-0`,onOpenAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>{He.current?.contains(e.target)&&e.preventDefault()},children:(0,$.jsx)(xe,{shouldFilter:!1,value:G??``,onValueChange:ze,children:(0,$.jsx)(be,{"data-slot":`composer-menu`,"data-trigger":I?.trigger,className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] p-1`,children:W.length===0?(0,$.jsx)(`p`,{className:`px-3 py-4 text-center text-xs text-muted-foreground`,children:I?.trigger===`@`?`No files seen in this session yet — full file search arrives with the Files tab.`:S?`No matching commands.`:V.isPending?`Loading skills…`:`No matching skills.`}):W.map(e=>(0,$.jsxs)(Se,{ref:t=>{t?B.current.set(e.value,t):B.current.delete(e.value)},value:e.value,"data-slot":`composer-menu-item`,"data-emphasized":e.emphasized||void 0,onSelect:()=>Ge(e),children:[(0,$.jsx)(`span`,{className:p(`shrink-0 truncate`,e.emphasized&&`font-semibold`,I?.trigger===`@`&&`font-mono text-xs`),children:e.label}),e.description?(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null]},e.value))})})})]})}function _t({disabled:e,onFiles:t,compact:n=!1}){let r=(0,b.useRef)(null);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(h,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Attach files`,title:`Attach images or files (or paste a screenshot)`,disabled:e,className:n?`size-10 shrink-0 rounded-full bg-muted text-muted-foreground md:mb-0.5 md:size-8 md:rounded-md md:bg-transparent`:`size-8 text-muted-foreground`,onClick:()=>r.current?.click(),children:n?(0,$.jsx)(_,{"aria-hidden":`true`,className:`size-4`}):(0,$.jsx)(Ee,{"aria-hidden":`true`,className:`size-[15px]`})}),(0,$.jsx)(`input`,{ref:r,type:`file`,multiple:!0,className:`hidden`,"aria-hidden":`true`,tabIndex:-1,onChange:e=>{t([...e.target.files??[]]),e.target.value=``}})]})}function vt({transcript:e,startedAt:t,onCancel:n,onInsert:r,onInsertAndSend:i}){let a=Ce(1e3);return(0,$.jsxs)(`div`,{"data-slot":`dictation-overlay`,role:`status`,"aria-label":`Dictation in progress`,className:`flex items-center gap-2.5 rounded-b-xl border-t border-border bg-muted/60 px-3 py-2`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none animate-pulse rounded-full bg-danger motion-reduce:animate-none`}),(0,$.jsx)(`span`,{"data-slot":`dictation-timer`,className:`text-xs font-medium text-muted-foreground tabular-nums`,children:pt(t,a)}),(0,$.jsx)(`span`,{"data-slot":`dictation-transcript`,"aria-live":`polite`,className:`min-w-0 flex-1 truncate text-sm text-foreground`,children:e===``?(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`Listening…`}):e}),(0,$.jsx)(h,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Cancel dictation`,className:`size-8 text-muted-foreground`,onClick:n,children:(0,$.jsx)(fe,{"aria-hidden":`true`})}),(0,$.jsx)(h,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":`Insert transcription`,className:`size-8`,onClick:r,children:(0,$.jsx)(g,{"aria-hidden":`true`})}),(0,$.jsx)(h,{type:`button`,size:`icon-sm`,"aria-label":`Insert transcription and send`,className:`size-8`,onClick:i,children:(0,$.jsx)(ae,{"aria-hidden":`true`})})]})}export{Ee as A,w as C,N as D,M as E,k as O,Oe as S,A as T,ke as _,W as a,x as b,K as c,Re as d,Ve as f,I as g,Le as h,J as i,E as k,Ke as l,L as m,Ue as n,Je as o,F as p,z as r,qe as s,gt as t,R as u,Fe as v,C as w,Me as x,Ie as y};
@@ -1,3 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t}from"./react-runtime-CCIEwYL0.js";import{F as n,Ma as r,Pa as i,Z as a,ja as o}from"./queries-DOHu2y2B.js";import{_ as s,ft as c,g as l,lt as u,q as d,st as f,ut as p,v as m}from"./utils-Df_1kJEk.js";import{f as h,n as g}from"./toaster-DrFdGtNN.js";var _=e(t(),1),v=`cez:stale-build-reload-at`,y=6e4,b=!1;function x(e=ee(),t=()=>window.location.reload(),n=Date.now()){if(b)return!0;if(!e)return!1;try{let t=Number(e.getItem(v));if(Number.isFinite(t)&&t>0&&n-t<y)return!1;e.setItem(v,String(n))}catch{return!1}return b=!0,t(),!0}function ee(){try{return window.sessionStorage}catch{return null}}function S(e,t){try{fetch(e,{method:`POST`,headers:{"content-type":`application/json`,[r]:i()},body:JSON.stringify(t),keepalive:!0}).catch(()=>{})}catch{}}function te(e){S(`/api/v1/telemetry/event`,{event:`message_sent`,label:e})}function ne(e){S(`/api/v1/telemetry/event`,{event:`design_mode_enabled`,label:e})}function re(){S(`/api/v1/telemetry/event`,{event:`schedule_menu_opened`,label:`new_task`})}function ie(e){S(`/api/v1/telemetry/event`,{event:`start_option_picked`,label:e})}function ae(e){S(`/api/v1/telemetry/event`,{event:`task_scheduled`,label:e})}function oe(e){S(`/api/v1/telemetry/event`,{event:`diff_comment_added`,label:e})}function se(e){e<1||S(`/api/v1/telemetry/event`,{event:`attachments_sent`,label:s(e)})}function ce(e){S(`/api/v1/telemetry/event`,{event:`attachments_restaged`,label:e})}function le(e){S(`/api/v1/telemetry/event`,{event:`add_project_opened`,label:e})}function ue(e){S(`/api/v1/telemetry/event`,{event:`skills_update_apply_dropped`,label:e})}function de(e){S(`/api/v1/telemetry/event`,{event:`palette_opened`,label:e})}function fe(e){S(`/api/v1/telemetry/event`,{event:`task_switched`,label:e})}function pe(e){for(let t of e)S(`/api/v1/telemetry/event`,{event:`palette_mode_used`,label:t})}function me(e){S(`/api/v1/telemetry/event`,{event:`palette_dismissed`,label:e})}function he(e){let t=m(e);t&&S(`/api/v1/telemetry/event`,{event:`shortcut_rebound`,label:t})}function ge(e,t){let n=e.trim().toLowerCase();if(n===``)return[];let r=t?[t]:[];return t===`files`?r:(/^(?:(?:pr|issue)\s*)?#?\d{1,7}$/.test(n)&&r.push(`pr_number`),/\bauto/.test(n)&&r.push(`automation`),r)}function _e(e,t=6e4){let n=new Map,r,i=()=>{clearTimeout(r),r=void 0;for(let[t,r]of n){let[n,i]=t.split(`\0`);for(let t=r;t>0;t-=1e3)e(n,i,Math.min(t,1e3))}n.clear()};return{add:(e,a)=>{let o=`${e}\u0000${a}`;n.set(o,(n.get(o)??0)+1),r??=setTimeout(i,t)},flush:i}}var C=_e((e,t,n)=>S(`/api/v1/telemetry/event`,{event:e,label:t,value:n}));typeof window<`u`&&(window.addEventListener(`pagehide`,C.flush),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`&&C.flush()}));function ve(e,t){let n=m(e);n&&C.add(t===`palette`?`task_command_run`:`task_shortcut_used`,n)}function ye(e){return e.startsWith(`/p/`)||e===`/tasks`||e===`/dashboard`||e.startsWith(`/settings/global/`)}function be(e){S(`/api/v1/telemetry/page`,{route:e})}var w=new Set(l);function T(e){return`/${e.split(`/`).filter(Boolean).map(e=>w.has(e)?e:`:param`).join(`/`)}`}function xe(e){return/Firefox\//.test(e)?`gecko`:/Chrom(e|ium)\/|Edg\//.test(e)?`chromium`:/AppleWebKit\//.test(e)?`webkit`:`other`}function Se(e){return/iPhone|iPad|iPod/.test(e)?`ios`:/Android/.test(e)?`android`:/Mac OS X|Macintosh/.test(e)?`macos`:/Windows/.test(e)?`windows`:/Linux/.test(e)?`linux`:`other`}function Ce(){try{let e=new URL(import.meta.url).pathname.split(`/`).pop()??``;return/^[\w.-]+\.js$/.test(e)?e:null}catch{return null}}var E={route:T(typeof window>`u`?`/`:window.location.pathname),previousRoute:null,routeEnteredAt:0,navigations:0,errors:0,serverVersion:null,latestVersion:null};function D(){return`__CEZ_DESKTOP__`in window||document.documentElement.dataset.cezDesktop||`__TAURI_INTERNALS__`in window?`desktop`:`browser`}function we(e={}){let t=navigator.userAgent,n=performance.now();return{...e,"page.route":E.route,"page.previous_route":E.previousRoute,"page.time_on_route_s":Math.round((n-E.routeEnteredAt)/1e3),"session.age_s":Math.round(n/1e3),"session.navigations":E.navigations,"session.errors":E.errors,"client.surface":D(),"client.engine":xe(t),"client.os":Se(t),"client.online":navigator.onLine,"client.visibility":document.visibilityState,"client.viewport_w":window.innerWidth,"build.entry":Ce(),"build.server_version_at_load":E.serverVersion,"build.update_available":E.latestVersion!==null&&E.latestVersion!==E.serverVersion}}var Te=[/^ResizeObserver loop (limit exceeded|completed with undelivered notifications)/];function Ee(e){return Te.some(t=>t.test(e))}function De(e,t=document.documentElement){let n=e.message??``;if(n===`Script error.`&&!e.filename&&!e.error)return!0;let r=e.error instanceof Error?`${e.error.name}: ${e.error.message}`:n;return/\bwindow\.ethereum\b/.test(r)?!0:/\btranslated-(ltr|rtl)\b/.test(t.className)&&/NotFoundError: (Failed to execute '(removeChild|insertBefore)' on 'Node'|Node\.(removeChild|insertBefore):)/.test(r)}function Oe(e){return e&&(e.split(/[?#]/)[0]?.split(`/`).pop()??``)||null}var O=new WeakSet,k={error:0,toast:0,staging:0};function ke(e){return e.name===`ApiError`&&e.status===0?M(e.cause):{}}function A(e,t,n={}){if(typeof e==`object`&&e){if(O.has(e))return;O.add(e)}E.errors+=1;let r=Date.now(),i=t===`toast`?`toast`:t===`attachment-staging`?`staging`:`error`;if(r-k[i]<1e4)return;k[i]=r;let a=e instanceof Error,o=a?e:Error(String(e));S(`/api/v1/telemetry/error`,{type:(n.type??(o.name||`Error`)).slice(0,128),message:(o.message||`unknown error`).slice(0,2048),stack:a?o.stack?.split(window.location.origin).join(``).slice(0,16384):void 0,handler:t,code:n.code,fingerprint:n.fingerprint,context:we({...ke(o),...n.context})})}var Ae=new Set(`api.v1.agent-profiles.apply.archive.archive-finished.association.auto-resume.automation-checks.automation-log.automation-options.automation-templates.branch.branding-logo.cancel.candidates.channel.check.checkout.checks.comments.commit.config.connect.connection.consent.continue.details.diff.dispatch.drafts.enable.events.feed.finish.groups.handoff.health.host-usage.images.importable.launch-key.merge-state.messages.models.nodes.open.open-in.open-in-cli.open-targets.parse.pause.pick.pin.plan.pr.providers.push.queued-messages.read.read-all.reclaim.refresh.remove-worktree.repo.report.retry.run.runs.runs-index.search.self-update.setup.skills-update.star-count.status.telemetry.todos.tree.ui-state.unread.validate.watch.workspace.ws`.split(`.`));function j(e){let t=e.split(`/`).filter(Boolean);return`/${t.map((e,n)=>t[n-1]===`p`||!(Ae.has(e)||w.has(e))?`:param`:e).join(`/`)}`.slice(0,256)}function je(e,t=Date.now()){return e?{type:`ApiError`,context:{"request.method":e.method,"request.route":j(e.path),"request.status":e.status,"request.age_ms":t-e.at,...e.provider?{"request.provider":e.provider}:{},...M(e.cause)}}:{type:`ErrorToast`,context:{}}}function M(e){if(typeof e!=`object`||!e)return{};let{name:t,message:n}=e;return{"request.cause_name":typeof t==`string`&&/^[A-Za-z]\w{0,63}$/.test(t)?t:`other`,"request.cause_message":typeof n==`string`?P(n).slice(0,256):``}}var N=[],Me=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),Ne=/(?<![\w./-])[\w-][\w.-]*\.(?:png|jpe?g|gif|webp|bmp|heic|avif|tiff?|ico|svg|pdf|txt|md|markdown|log|html?|csv|tsv|json|ya?ml|xml|rtf|docx?|xlsx?|pptx?|od[tsp]|zip|tar|t?gz|bz2|xz|7z|rar|mp[34]|mov|wav|webm|bin)(?![\w.-])/gi;function P(e,t=N){let n=e.replace(/“[^”]*”|‘[^’]*’|"[^"]*"|`[^`]*`|(?<!\w)'[^'\n]+'(?!\w)/g,`<value>`).replace(/[^\s()[\]{}<>,;]+@[^\s()[\]{}<>,;]+\.\w+/g,`<email>`).replace(Ne,`<file>`).replace(/[^\s()[\]{}<>,;]*\/[^\s()[\]{}<>,;]*/g,e=>{if(!/^(https?:\/\/[^/\s]+)?\/api\//.test(e))return`<path>`;try{return j(new URL(e,`http://localhost`).pathname)}catch{return`<path>`}});for(let e of[...new Set(t)].filter(e=>e.length>=3).sort((e,t)=>t.length-e.length))n=n.replace(RegExp(`(?<![\\w-])${Me(e)}(?![\\w-])`,`gi`),`<project>`);return n.replace(/:\s+\S.*$/s,`: <detail>`)}function Pe(e){let{type:t,context:n}=je(o());A(P(e),`toast`,{type:t,context:n})}function Fe(e){let t=e?.status;A(e,`attachment-staging`,{code:`attachment_stage_failed`,context:{"request.route":`/api/v1/workspace/uploads`,...typeof t==`number`?{"request.status":t}:{}}})}function Ie(e){A(Error(`Dictation failed`),`toast`,{type:`DictationError`,code:`dictation_failed`,fingerprint:`cockpit:dictation_failed`,context:{"dictation.error":/^[a-z][a-z-]{0,63}$/.test(e)?e:`other`,"dictation.secure_context":window.isSecureContext!==!1}})}function Le(e,t){return(0,_.lazy)(()=>t().catch(t=>{if(x())return new Promise(()=>{});throw A(t,`lazy-route`,{code:`chunk_load_failed`,fingerprint:`cockpit:chunk_load_failed`,context:{"chunk.route":e}}),t}))}var F=!1;function Re(){let{pathname:e}=h(),t=n(),r=a();return(0,_.useEffect)(()=>{N=(r.data?.projects??[]).flatMap(e=>[e.name,e.id])},[r.data]),(0,_.useEffect)(()=>{t.data&&E.serverVersion===null&&(E.serverVersion=t.data.version),E.latestVersion=t.data?.latestVersion??E.latestVersion},[t.data]),(0,_.useEffect)(()=>{F||(F=!0,window.addEventListener(`error`,e=>{Ee(e.message??``)||De(e)||A(e.error??e.message,`window.error`,{context:{"error.source_file":Oe(e.filename),"error.line":e.lineno||null,"error.col":e.colno||null}})}),window.addEventListener(`unhandledrejection`,e=>A(e.reason,`unhandledrejection`)),window.addEventListener(`vite:preloadError`,e=>{x()||A(e.payload,`vite:preloadError`,{code:`chunk_load_failed`,fingerprint:`cockpit:chunk_load_failed`})}),g(Pe))},[]),(0,_.useEffect)(()=>{if(!ye(e))return;let t=T(e);(t!==E.route||E.navigations===0)&&(E.navigations>0&&(E.previousRoute=E.route),E.route=t,E.routeEnteredAt=performance.now(),E.navigations+=1,be(t))},[e]),null}function ze(e){return e===`/manager`||e.startsWith(`/manager/`)}var I=/\[\[(task|pr|issue):([^\]/\s]+)\/([^\]\s]+)\]\]/g,Be=/^\s*(?:[-*]\s+)?((?:\[\[task:[^\]/\s]+\/[^\]\s]+\]\]\s*)+)$/,Ve=/\[\[?(?:(?:task|pr|issue)(?::[^\]\n]*)?\]?)?$/,L=`#cez-task/`,R=`#cez-pr/`,z=`#cez-issue/`,He=/(?<![\w/#&[])#(\d{1,7})\b/g,Ue=/\b(?:PRs?|pull requests?)\s*$/i,We=/(?<![("<[])(https:\/\/github\.com\/[^\s/]+\/[^\s/]+)\/(pull|issues)\/(\d+)(?![\w/])/g,Ge=/(`[^`]*`)/;function Ke(e){return e.replace(I,(e,t,n,r)=>{let i=`${encodeURIComponent(n)}/${encodeURIComponent(r)}`;return t===`task`?`[task](${L}${i})`:`[#${r}](${t===`pr`?R:z}${i})`})}function qe(e,t){return[...e.matchAll(I)][0]?.[2]??(t.length===1?t[0].id:`_`)}function Je(e,t,n){return e.split(Ge).map((e,r)=>r%2==1?e:e.replace(We,(e,t,r,i)=>{let a=n.find(e=>e.repoUrl===t);return a?`[#${i}](${r===`pull`?R:z}${encodeURIComponent(a.id)}/${i})`:e}).replace(He,(e,n,r,i)=>`[${e}](${Ue.test(i.slice(0,r))?R:z}${encodeURIComponent(t)}/${n})`)).join(``)}function B(e){try{return decodeURIComponent(e)}catch{return null}}function Ye(e){let t=new Map;for(let n of e)if(n.kind===`markdown`)for(let e of n.text.matchAll(/\(#cez-(pr|issue)\/([^/)]+)\/(\d+)\)/g)){let n=B(e[2]);if(n===null||n===`_`)continue;let r=e[1]===`pr`?`PR`:`Issue`;t.set(`${n} ${r} ${e[3]}`,{projectId:n,kind:r,number:Number(e[3])})}return[...t.values()]}var Xe=/^\[\[task:([^\]/\s]+)\/([^\]\s]+)\]\]$/gm;function Ze(e){return e.filter(e=>!e.isError&&/\btask create\b/.test(e.summary)).flatMap(e=>[...(e.output??``).matchAll(Xe)]).map(e=>({projectId:e[1],runId:e[2]}))}function Qe(e,t=[],n=[]){let r=qe(e,n),i=[],a=new Set,o=[],s=[],c=!1,l=(e,t)=>{a.has(`${e}/${t}`)||(a.add(`${e}/${t}`),i.push({kind:`task`,projectId:e,runId:t}))},u=()=>{let e=s.join(`
2
- `).trim();e!==``&&i.push({kind:`markdown`,text:e}),s=[];for(let e of o)l(e.projectId,e.runId);o=[]};for(let t of e.replace(Ve,``).split(`
3
- `)){if(/^\s*(```|~~~)/.test(t)){c=!c,s.push(t);continue}if(c){s.push(t);continue}let e=Be.exec(t);if(!e){o.length>0&&t.trim()===``&&u();for(let e of t.matchAll(I))e[1]===`task`&&o.push({projectId:e[2],runId:e[3]});s.push(Ke(Je(t,r,n)));continue}u();for(let t of e[1].matchAll(I))l(t[2],t[3])}u();for(let e of Ze(t))l(e.projectId,e.runId);return i}function $e(e,t){if(!e?.startsWith(t))return null;let[n,r]=e.slice(t.length).split(`/`),i=n?B(n):null,a=r?B(r):null;return i&&a?{projectId:i,id:a}:null}var V=[{name:`status`,description:`Where things stand`,prompt:`Give me a short status of my connected projects.`},{name:`attention`,description:`What needs me`,prompt:`What needs my attention right now?`},{name:`tasks`,description:`Running and recent tasks`,prompt:`List the running and recently finished tasks.`},{name:`prs`,description:`Open pull requests`,prompt:`List the open pull requests and what each one is waiting for.`},{name:`check`,description:`Run the watch check now`},{name:`stop`,description:`Stop the current turn`}];function et(e){let t=/^\/([a-z]+)\s*$/.exec(e.trim());return t?V.find(e=>e.name===t[1])??null:null}function tt(e){return e===0?`Off`:e<60?`${e} min`:e===60?`1 hour`:e<1440?`${e/60} hours`:e===1440?`1 day`:`${e/1440} days`}function nt(e){let t=e.filter(e=>e===`read`).length;return t===0?``:t===e.length?`Read-only`:`${t} read-only`}function rt(e,t){return e===`all`?`All projects access`:e.length===1?t(e[0])??e[0]:`${e.length} projects`}function it(e){return e?`${e[0].toUpperCase()}${e.slice(1)}`:``}function at(e,t=new Date){let n=new Date(e);if(Number.isNaN(n.getTime()))return``;let r=n.toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`});return n.toDateString()===t.toDateString()?r:`${n.toLocaleDateString([],{month:`short`,day:`numeric`})}, ${r}`}function ot(e,t=new Date){if(!e)return``;let n=new Date(e);if(Number.isNaN(n.getTime()))return``;let r=Math.round((new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()-new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime())/864e5);return r<=0?n.toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`}):r===1?`Yesterday`:r<7?n.toLocaleDateString([],{weekday:`long`}):n.toLocaleDateString([],{month:`short`,day:`numeric`})}function st(e){return e.type===`merge-pr`?`Merge #${e.number}${e.title?` — ${e.title}`:``}`:e.type===`enable-automation`?`Enable automation ${e.name??e.automationId}`:`Add job ${e.name}`}var H=[`merge-pr`,`enable-automation`,`add-job`];function ct(e,t){let n=H.find(e=>e===t);return n===void 0||e?.[n]!==!1}var U=new Map;function lt(e,t){let n=t?.manager;return typeof n?.id==`string`&&typeof n.name==`string`&&U.set(e,{id:n.id,name:n.name}),U.get(e)}function ut(e){return e.pendingQuestions>0?`${e.pendingQuestions} ${e.pendingQuestions===1?`question`:`questions`} for you`:e.pendingActions>0?`${e.pendingActions} ${e.pendingActions===1?`approval`:`approvals`} waiting`:e.preview??(e.status===`working`?`Working…`:`No messages yet`)}var dt=`quick-task`;function ft(e,t,n=24){return[t,...(e??[]).filter(e=>!(e.source===t.source&&e.ref===t.ref))].slice(0,n)}var W=[{id:`claude`,label:`claude`,desc:`Claude Code CLI`},{id:`codex`,label:`codex`,desc:`OpenAI Codex (app-server)`},{id:`junie`,label:`junie`,desc:`JetBrains Junie CLI`},{id:`opencode`,label:`opencode`,desc:`OpenCode (serve)`},{id:`cursor`,label:`cursor`,desc:`Cursor Agent CLI`},{id:`pi`,label:`pi`,desc:`pi CLI (provider/model)`},{id:`copilot`,label:`copilot`,desc:`GitHub Copilot CLI (ACP)`},{id:`antigravity`,label:`antigravity`,desc:`Google Antigravity CLI (agy)`}],G={claude:[{id:``,label:`auto`,desc:`Pick the best model per step`},{id:`fable`,label:`fable`,desc:`Most capable, for the hardest tasks`},{id:`opus`,label:`opus`,desc:`Deep reasoning for hard tasks`},{id:`sonnet`,label:`sonnet`,desc:`Fast and cheap`},{id:`haiku`,label:`haiku`,desc:`Fastest — simple, scoped tasks`}],codex:[{id:``,label:`auto`,desc:`Use your Codex default model`}],opencode:[{id:``,label:`auto`,desc:`Use your OpenCode default model`}],junie:[{id:``,label:`auto`,desc:`Use your Junie default model`}],cursor:[{id:``,label:`auto`,desc:`Use your Cursor default model`}],pi:[{id:``,label:`auto`,desc:`Use your pi default model`},{id:`anthropic/claude-opus-4-8`,label:`claude-opus-4.8`,desc:`via Anthropic`},{id:`anthropic/claude-sonnet-5`,label:`claude-sonnet-5`,desc:`via Anthropic`},{id:`openai/gpt-5.1`,label:`gpt-5.1`,desc:`via OpenAI`}],copilot:[{id:``,label:`auto`,desc:`Let Copilot pick the model`}],antigravity:[{id:``,label:`auto`,desc:`Use your Antigravity default model`}]},K={claude:/^claude[-.]/,codex:/^gpt[-.]/},pt=[`opencode`,`pi`],mt=[`copilot`,`cursor`];function q(e,t){return!e||G[t].some(t=>t.id===e)||K[t]?.test(e)||mt.includes(t)&&Object.values(K).some(t=>t.test(e))?!1:Object.entries(G).some(([n,r])=>n!==t&&!pt.includes(n)&&r.some(t=>t.id!==``&&t.id===e))||Object.entries(K).some(([n,r])=>n!==t&&r.test(e))}function J(e,t,n=[]){let r=G[e]??G.claude,i=d(e)?t?.models??[]:[],a=i.length>0?[ht(r)]:[...r],o=new Set(a.map(e=>e.id));for(let e of i)!e.id||o.has(e.id)||(o.add(e.id),a.push({id:e.id,label:e.label||e.id,desc:e.description}));for(let t of n)!t||o.has(t)||q(t,e)||(o.add(t),a.push({id:t,label:t,desc:`Custom or legacy model`}));return a}function ht(e){return e.find(e=>e.id===``)??{id:``,label:`auto`,desc:``}}var gt={claude:`Claude`,codex:`Codex`,opencode:`OpenCode`,junie:`Junie`,cursor:`Cursor`,antigravity:`Antigravity`};function _t(e,t,n=!1){if(!d(e))return;let r=gt[e];if(t?.stale)return`Using cached ${r} model list`;if(n||t?.source===`unavailable`)return`Latest ${r} models unavailable`}function vt(e){let t=W.map(e=>e.id).filter(t=>e.some(e=>e.name===t&&e.available));return t.length>0?t:[`claude`]}function yt(e,t,n){return e!==null&&t.includes(e)?e:t.includes(n)?n:t[0]??`claude`}function Y(e,t,n=!1){return!n&&e===t?void 0:e}function bt(e,t,n,r){let i=J(t,r,[e,n?.[t]]);if(e!==null&&i.some(t=>t.id===e))return e;let a=n?.[t];return a!==void 0&&i.some(e=>e.id===a)?a:``}function xt(e,t,n){return e.source===`skill`?t.some(t=>t.name===e.ref):n.some(t=>t.name===e.ref)}function St(e,t,n){return e&&xt(e,t,n)?e:null}function Ct(e){let{task:t,source:n,model:r,modelsLocked:i,runner:a,runnerExplicit:o,defaultRunner:s,agentProfile:c,variants:l,images:u,worktree:d,newBranch:f,branch:p,autonomous:m,generateFollowups:h,todoId:g,dispatch:_,readOnly:v,inPlaceByDefault:y}=e,b=v===!0&&l<=1&&!_,x=d===!1&&l<=1&&!_&&!b;return{task:t,...n?.source===`skill`?{steps:[{id:`task`,name:n.ref,skill:n.ref,prompt:`{{task}}`}]}:{workflow:n?.ref??`quick-task`},model:i?void 0:r||void 0,runner:Y(a,s,o),agentProfile:c||void 0,variants:l>1?l:void 0,images:u.length>0?[...u]:void 0,worktree:b?void 0:d===!1&&l<=1?!1:y&&d!==!1&&l<=1?!0:void 0,...b?{readOnly:!0}:{},...x&&f?{newBranch:!0,...p?.trim()?{branch:p.trim()}:{}}:{},autonomous:m===!0||void 0,generateFollowups:h!==!1&&void 0,todoId:g||void 0,dispatch:_??void 0}}function wt(e,t,n){let r=(t?e?.askSkill:e?.defaultSkill)??null;return r&&(n===null||n.some(e=>e.name===r))?{source:`skill`,ref:r}:null}function Tt(e){return/\?\s*$/.test(e.trim())}function Et(e){let t=`runs`in e?e.runs[0]:e;return t?`/tasks/${t.id}`:`/`}var X=20;function Z(e){return e.reduce((e,t)=>c(t.mediaType)?e+Math.floor(t.data.length*3/4):e,0)}function Dt(e,t){return e.length>=X||Z(e)+Z([t])>20971520?null:[...e,t]}var Ot={md:`text/markdown`,markdown:`text/markdown`,txt:`text/plain`,log:`text/plain`,pdf:`application/pdf`},kt=new Set(`html.htm.xml.css.scss.less.csv.tsv.json.jsonl.ndjson.yaml.yml.toml.ini.env.conf.cfg.sql.graphql.gql.diff.patch.js.mjs.cjs.jsx.ts.mts.cts.tsx.vue.svelte.astro.php.py.rb.go.rs.java.kt.swift.c.h.cc.cpp.hpp.cs.sh.bash.zsh.ps1.bat.lua.pl.r.dart.scala.ex.exs.erl.hs.twig.rst.adoc.tex.srt.vtt`.split(`.`)),At=new Set([`application/json`,`application/xml`,`application/javascript`,`application/x-yaml`,`application/yaml`,`application/sql`,`application/x-sh`]);function Q(e){if(p(e.type)&&e.type!==`application/octet-stream`)return e.type;let t=e.name.includes(`.`)?e.name.split(`.`).pop()?.toLowerCase()??``:``;return Ot[t]||(kt.has(t)||e.type.startsWith(`text/`)||At.has(e.type)?`text/plain`:f)}function $(e,t){return t?`pasted image`:`pasted.${u(e)}`}async function jt(e,t=`file`){let n=new Uint8Array(await e.arrayBuffer()),r=``;for(let e=0;e<n.length;e+=32768)r+=String.fromCharCode(...n.subarray(e,e+32768));let i=btoa(r),a=Q(e),o=c(a),s=t===`clipboard`&&o?void 0:e.name;return{mediaType:a,data:i,...o?{preview:`data:${a};base64,${i}`}:{},name:s||$(a,o),...s?{originalName:s}:{},isImage:o}}function Mt({mediaType:e,data:t,originalName:n}){return{mediaType:e,data:t,...n?{name:n}:{}}}function Nt(e,t,n=0){let r=[],i=[],a=t,o=n;for(let t of e){let e=t.name?`“${t.name}”`:`attachment`;if(t.size>5242880){i.push(`${e} is too large (max 5 MB)`);continue}if(a>=X){i.push(`${e} skipped — max ${X} attachments per message`);continue}let n=c(Q(t));if(n&&o+t.size>20971520){i.push(`${e} skipped — max 20 MB of images per message`);continue}r.push(t),a+=1,n&&(o+=t.size)}return{accepted:r,rejected:i}}export{ne as $,st as A,$e as B,z as C,L as D,R as E,Ye as F,ve as G,lt as H,ut as I,Ie as J,Le as K,ot as L,it as M,ze as N,nt as O,at as P,se as Q,et as R,dt as S,H as T,Re as U,rt as V,D as W,le as X,ge as Y,ce as Z,bt as _,jt as a,re as at,Y as b,W as c,ie as ct,Tt as d,oe as et,_t as f,ft as g,wt as h,$ as i,de as it,tt as j,ct as k,vt as l,ae as lt,J as m,Dt as n,me as nt,Nt as o,he as ot,q as p,Fe as q,Z as r,pe as rt,Mt as s,ue as st,X as t,te as tt,Ct as u,fe as ut,yt as v,V as w,Et as x,St as y,Qe as z};
@@ -1,44 +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,Dn as i,F as a,Jn as o,Wi as s,Xn as c,Ya as l,Z as u,_i as d,cn as f,on as p,qa as m,sr as h,vr as g}from"./queries-DOHu2y2B.js";import{C as _,E as v,G as y,O as b,S as x,T as S,w as C,x as w}from"./utils-Df_1kJEk.js";import{a as T,f as ee,g as te}from"./toaster-DrFdGtNN.js";import{D as E,E as ne,O as re,T as ie,a as D,c as ae,d as O,f as k,g as oe,i as se,k as ce,l as le,m as ue,n as de,r as fe,s as pe,t as me,u as he}from"./sortable.esm-O2daV3YI.js";import{a as ge,i as _e,o as ve,r as ye,t as be}from"./sheet-7RYAcp_E.js";import{N as xe,t as A}from"./button-BrxohNcK.js";import{t as Se,u as Ce}from"./reference-chip-ty5g_OLC.js";import{a as we,f as j,m as Te,p as Ee,r as De}from"./automation-format-BPrWgGBz.js";import{f as Oe,i as ke,n as Ae,r as je,t as Me}from"./tooltip-p6YPEpXC.js";import{t as Ne}from"./chevron-right-C3fLn_fF.js";import{t as Pe}from"./circle-alert-COKQc-87.js";import{t as Fe}from"./download-DH68Y5Vz.js";import{i as Ie,r as Le,t as Re}from"./popover-DzdYqnHw.js";import{t as M}from"./status-dot-C_5ryAFi.js";import{t as ze}from"./use-now-DQpgbshl.js";import{n as N,t as Be}from"./format-DHK74MwW.js";import{t as Ve}from"./token-metrics-DXeuToH8.js";import{G as He,ct as Ue,ft as We,mt as Ge,r as Ke,t as qe}from"./index-CDhEdFaZ.js";var Je=xe(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),Ye=xe(`arrow-down-left`,[[`path`,{d:`M17 7 7 17`,key:`15tmo1`}],[`path`,{d:`M17 17H7V7`,key:`1org7z`}]]),Xe=xe(`grip-horizontal`,[[`circle`,{cx:`12`,cy:`9`,r:`1`,key:`124mty`}],[`circle`,{cx:`19`,cy:`9`,r:`1`,key:`1ruzo2`}],[`circle`,{cx:`5`,cy:`9`,r:`1`,key:`1a8b28`}],[`circle`,{cx:`12`,cy:`15`,r:`1`,key:`1e56xg`}],[`circle`,{cx:`19`,cy:`15`,r:`1`,key:`1a92ep`}],[`circle`,{cx:`5`,cy:`15`,r:`1`,key:`5r1jwy`}]]),Ze=xe(`table-2`,[[`path`,{d:`M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18`,key:`gugj83`}]]),P=e(t(),1);function Qe(e){let t=Date.parse(e.nextRunAt??``),n=Date.parse(e.state?.backoffUntil??``);return Number.isFinite(t)?Math.max(t,Number.isFinite(n)?n:t):null}function $e(e){return e.flatMap(e=>(e.data?.automations??[]).filter(e=>e.enabled).map(t=>({project:e,automation:t,at:Qe(t)}))).sort((e,t)=>(e.at??1/0)-(t.at??1/0)||e.project.id.localeCompare(t.project.id)||e.automation.id.localeCompare(t.automation.id))}function et(e){let t=u(),n=l(),i=t.data?.projects??[],a=t.data?.bootProject,o=a&&!i.some(e=>e.id===a)?[...i,{id:a,name:a,status:`ok`}]:i,s=m({queryKey:[...f.dashboard,`automations`,o.map(e=>[e.id,e.name,e.status])],enabled:e&&!!t.data,queryFn:async({signal:e})=>{let t=0,n=[];return await Promise.all([0,1].map(async()=>{for(;t<o.length&&!e.aborted;){let i=o[t++];if(i.status===`missing`){n.push({...i,error:`Project folder unavailable`});continue}try{let t=b.parse(await r(await g.api.v1.workspace.dashboard.automations.$get({query:{projectId:i.id}},{init:{signal:e}}),`/workspace/dashboard/automations`));n.push({id:i.id,name:i.name,data:t})}catch{n.push({id:i.id,name:i.name,error:`Could not load automations`})}}})),n}});return(0,P.useEffect)(()=>{if(e)return oe(e=>{e===`automation-change`&&n.invalidateQueries({queryKey:[...f.dashboard,`automations`]})})},[n,e]),{...s,registry:t,retry:()=>{t.refetch(),s.refetch()}}}var F=n();function I({rows:e}){return(0,F.jsx)(`span`,{hidden:!0,"data-dashboard-export":JSON.stringify(e)})}var L=`section-mark eyebrow text-muted-foreground`,R=`flex min-h-12 flex-wrap items-center justify-between gap-x-3 gap-y-2 border-b px-4 py-2.5`,tt=`flex w-fit cursor-pointer list-none items-center gap-1.5 rounded-sm text-muted-foreground transition-colors select-none hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 [&::-webkit-details-marker]:hidden`;function z(){return(0,F.jsx)(Ne,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-soft-foreground transition-transform duration-150 motion-reduce:transition-none [details[open]>summary>&]:rotate-90`})}var nt=`flex items-center gap-2 text-xs text-muted-foreground`;function rt({className:e=``,...t}){return(0,F.jsxs)(`span`,{className:`relative inline-flex`,children:[(0,F.jsx)(`select`,{...t,className:`h-9 cursor-pointer appearance-none rounded-md border bg-card-2 pr-8 pl-3 font-mono text-xs text-foreground outline-none transition-colors hover:border-foreground/20 hover:bg-muted focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 no-hover:min-h-11 ${e}`}),(0,F.jsx)(Oe,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 right-2.5 size-3.5 -translate-y-1/2 text-soft-foreground`})]})}var it=`relative min-w-0 overflow-hidden rounded-lg border bg-card-2 p-4 transition-colors before:absolute before:inset-x-0 before:top-0 before:h-px before:opacity-80 hover:border-foreground/20 hover:bg-muted/40 sm:p-5`,B={violet:`before:bg-violet`,info:`before:bg-info`,success:`before:bg-success`,danger:`before:bg-danger`,primary:`before:bg-primary`,neutral:`before:bg-border`};function at({label:e,value:t,icon:n,children:r}){return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`span`,{className:`flex w-full items-center justify-between gap-2`,children:[(0,F.jsx)(`span`,{className:`eyebrow text-muted-foreground`,children:e}),(0,F.jsx)(`span`,{className:`text-soft-foreground`,"aria-hidden":`true`,children:n})]}),(0,F.jsx)(`span`,{className:`mt-4 block text-4xl font-semibold leading-none tracking-tight tabular-nums`,children:t}),(0,F.jsx)(`span`,{className:`mt-3 block text-xs text-soft-foreground`,children:r})]})}function ot({at:e}){return(0,F.jsxs)(`time`,{dateTime:e,title:new Date(e).toLocaleString(),children:[`Updated `,N(e),` ago`]})}function st(){let e=He(),t=et(e.known&&!e.off),n=ze(3e4),[r,i]=(0,P.useState)(!1),a=$e(t.data??[]),o=r?a:a.slice(0,3),s=t.data?.filter(e=>e.error)??[],c=!e.known||!t.registry.isError&&(t.registry.isPending||t.isPending),l=t.isError||t.registry.isError||s.length>0;return(0,F.jsxs)(j,{"data-export-context":`Enabled automations · showing ${o.length} of ${a.length} loaded · ${l?`partial coverage`:`available projects`}`,className:`min-w-0 gap-0 py-0`,children:[(0,F.jsxs)(`div`,{className:R,children:[(0,F.jsxs)(`h2`,{className:`flex items-center ${L}`,children:[`Automations`,(0,F.jsx)(Te,{className:`ml-2 size-3.5 text-soft-foreground`,"aria-hidden":`true`})]}),!e.off&&t.data&&(0,F.jsxs)(`span`,{className:`font-mono text-meta text-soft-foreground`,children:[a.length,` enabled`,l?` · partial`:``]})]}),!e.off&&t.data&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(I,{rows:[{section:`automations`,metric:`enabled`,value:a.length,unit:`automations`,note:l?`Partial project coverage`:`Loaded projects`}]}),t.dataUpdatedAt>0&&(0,F.jsx)(`p`,{className:`px-4 pt-3 text-xs text-muted-foreground`,children:(0,F.jsx)(ot,{at:new Date(t.dataUpdatedAt).toISOString()})})]}),e.off?(0,F.jsx)(`p`,{className:`p-4 text-sm text-muted-foreground`,children:`Automations are disabled in this workspace.`}):(0,F.jsxs)(F.Fragment,{children:[c&&(0,F.jsx)(`p`,{className:`p-4 text-sm text-muted-foreground`,children:`Loading automations…`}),l&&(0,F.jsxs)(`div`,{role:`alert`,className:`p-4 text-sm`,children:[(0,F.jsx)(`p`,{children:`Some automation data could not be refreshed. Available results are shown.`}),s.map(e=>(0,F.jsxs)(`p`,{children:[e.name,`: `,e.error]},e.id)),(0,F.jsx)(A,{variant:`ghost`,onClick:t.retry,children:`Retry automations`})]}),!c&&!l&&a.length===0&&(0,F.jsx)(`p`,{className:`p-4 text-sm text-muted-foreground`,children:`No enabled automations. Enable one in a project's Automations page.`}),o.map(({project:e,automation:t,at:r})=>{let i=(t.state?.consecutiveFailures??0)>0?`Recent checks failed`:void 0,a=r===null?`Next time not available`:r<=n?`Due — awaiting scheduler`:we(r,n),o=t.kind===`schedule`?`Next run`:`Next check`;return(0,F.jsxs)(`div`,{"data-export-row":!0,className:`border-b px-4 py-3 transition-colors last:border-0 hover:bg-muted/30`,children:[(0,F.jsx)(T,{className:`block min-h-11 text-sm font-medium hover:underline`,to:`/p/${encodeURIComponent(e.id)}/automations/${encodeURIComponent(t.id)}`,children:t.name}),(0,F.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.name,` · `,o,`: `,a]}),r!==null&&(0,F.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:(0,F.jsxs)(`time`,{dateTime:new Date(r).toISOString(),children:[De(r,e.data.timeZone),` · `,e.data.timeZone]})}),t.kind!==`schedule`&&(0,F.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Checks for matching events; a task may not be started.`}),i&&(0,F.jsx)(`p`,{className:`mt-1 text-xs text-warning`,children:i}),(0,F.jsx)(I,{rows:[{section:`automation`,entity:`${e.id}:${t.id}`,metric:`name`,value:t.name},{section:`automation`,entity:`${e.id}:${t.id}`,metric:t.kind===`schedule`?`nextRunAt`:`nextCheckAt`,value:r===null?null:new Date(r).toISOString(),note:[a,i].filter(Boolean).join(` · `)}]})]},`${e.id}:${t.id}`)}),a.length>3&&(0,F.jsx)(A,{variant:`ghost`,className:`m-2 min-h-11`,onClick:()=>i(!r),children:r?`Show fewer`:`Show all ${a.length} enabled`}),!c&&(0,F.jsxs)(`details`,{className:`border-t px-4 py-2 text-xs text-muted-foreground`,children:[(0,F.jsxs)(`summary`,{className:`flex w-fit cursor-pointer list-none items-center gap-1.5 rounded-sm text-muted-foreground transition-colors select-none hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 [&::-webkit-details-marker]:hidden min-h-11`,"data-export-heading":`Project automations`,children:[(0,F.jsx)(z,{}),`Manage automations by project`]}),t.data?.map(e=>(0,F.jsx)(T,{className:`block min-h-11 py-3 hover:underline`,to:`/p/${encodeURIComponent(e.id)}/automations`,children:e.name},e.id))]})]})]})}function ct(e,t,n){let r=new Set,i=new Map(e.map((e,t)=>[n(e),{r:e,i:t}]));return t.forEach((e,t)=>{let a=i.get(n(e));(!a||a.i!==t||JSON.stringify(a.r)!==JSON.stringify(e))&&r.add(n(e)),i.delete(n(e))}),i.forEach((e,t)=>r.add(t)),r}function lt(e,t,n){let r=new Map(t.map(e=>[n(e),e]));return e.map(e=>({row:r.get(n(e))??e,removed:!r.has(n(e))}))}var ut=(0,P.createContext)(``),dt=(0,P.createContext)(!0),V=new Map;function ft(e,t,n=``,r=0,i){let a=(0,P.useContext)(ut),o=`${a}:${n}`,[s,c]=(0,P.useState)(()=>V.get(o)),[l,u]=(0,P.useState)(o),d=(0,P.useRef)(r),f=(0,P.useRef)(!1);l!==o&&(u(o),c(V.get(o)),d.current=r,f.current=!1),d.current!==r&&(d.current=r,f.current=!0),(0,P.useEffect)(()=>{e&&(!s||f.current)&&(c(e),f.current=!1)},[s,e]);let p=(0,P.useMemo)(()=>({current:s}),[o]);p.current=s,(0,P.useEffect)(()=>()=>{!a||!p.current||(V.delete(o),V.set(o,p.current),V.size>60&&V.delete(V.keys().next().value))},[a,o,p]);let m=s??e??[],h=new Set((e??m).map(t)),g=i?m.filter(e=>h.has(t(e))||i(e)):m;return{rows:lt(g,e??m,t),updates:e?ct(g,e,t).size:0,show:()=>c(e)}}var H=new Map;function pt(e){return H.get(e)}function mt(e,t){H.delete(e),H.set(e,t),H.size>20&&H.delete(H.keys().next().value)}var U=new Map;function ht(e,t){return U.get(e)?.[t]}function gt(e,t,n){let r=U.get(e)??{};r[t]=n,U.delete(e),U.set(e,r),U.size>20&&U.delete(U.keys().next().value)}var W=e=>`${e.projectId}:${e.id}`;function _t({row:e,removed:t=!1,queue:n=!1,checking:r=!1,checkFailed:a=!1,kicker:s}){let l=(0,P.useContext)(dt)&&!r&&!a,u=ce(e);t=t||u===null||n&&u?.archived===!0,u&&(e={...e,status:u.status,awaitingAnswerSince:u.awaitingAnswerSince});let d=o(e),f=n&&!c(e),p=t||f||!l;return(0,F.jsxs)(`div`,{"data-dashboard-row":W(e),className:`min-w-0 border-b px-4 py-3 transition-colors last:border-0 hover:bg-muted/30`,children:[(0,F.jsx)(I,{rows:[{section:`task`,entity:W(e),metric:`title`,value:e.titleSummary||e.title},{section:`task`,entity:W(e),metric:`status`,value:p?`Not currently actionable`:e.status},{section:`task`,entity:W(e),metric:`createdAt`,value:e.createdAt}]}),s&&(0,F.jsx)(`p`,{className:`mb-1 pl-[15px] eyebrow text-soft-foreground`,children:s}),(0,F.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,F.jsx)(M,{tone:d.tone,className:`mt-[7px]`}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(T,{tabIndex:p?-1:void 0,"aria-disabled":p||void 0,onClick:e=>{p&&e.preventDefault()},to:`/p/${encodeURIComponent(e.projectId)}/tasks/${encodeURIComponent(e.id)}`,className:`block break-words text-sm font-medium leading-relaxed hover:underline no-hover:min-h-11`,children:e.titleSummary||e.title}),(0,F.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground`,children:[(0,F.jsx)(`span`,{className:`font-mono text-meta text-soft-foreground`,children:e.projectId}),(0,F.jsx)(`span`,{children:a?`Could not check current state`:l?t?n&&u!==null?`No longer needs you`:`Task removed`:f?`No longer needs you`:d.label:`Checking current state…`}),(0,F.jsx)(`span`,{children:N(e.createdAt)}),e.dispatch&&(0,F.jsx)(`span`,{children:`Subtask`}),!p&&i(e).map(t=>(0,F.jsx)(Se,{reference:t,taskTitle:e.title,projectId:e.projectId,className:`no-hover:min-h-11`},`${t.kind}:${t.number}`))]})]})]})]})}function G({coverage:e,count:t,retry:n}){let r=e.projects.filter(e=>e.state!==`complete`);return r.length?(0,F.jsxs)(`div`,{className:`rounded-lg border border-pending/40 bg-card-2 p-3 text-sm`,role:`status`,children:[(0,F.jsxs)(`p`,{children:[t===void 0?``:`${t} tasks need you in the available data. Complete coverage: ${e.projects.length-r.length} of ${e.projects.length} projects. `,r.length===1?r[0].state===`unavailable`?`One project is unavailable.`:`One project has incomplete coverage.`:`${r.length} projects have incomplete coverage.`]}),(0,F.jsxs)(`details`,{className:`mt-2`,children:[(0,F.jsxs)(`summary`,{className:`${tt} min-h-11`,children:[(0,F.jsx)(z,{}),`View unavailable `,r.length===1?`project`:`projects`]}),r.map(e=>(0,F.jsxs)(`p`,{children:[e.projectId,`: `,e.reason??e.state,e.omittedRuns>0?` · ${e.omittedRuns} omitted tasks`:``]},e.projectId))]}),(0,F.jsx)(A,{variant:`outline`,onClick:n,className:`min-h-11`,children:`Retry`})]}):null}function vt(e,t=!1){return e==null?`Unavailable`:t?`$${e.toFixed(e===0||e>=1?2:Math.min(20,Math.max(4,Math.ceil(-Math.log10(e))+1)))}`:e.toLocaleString(`en-US`)}function K(e){return e===null?`Unavailable`:e<1?`${Math.round(e*60)}m`:e<48?`${e.toFixed(1)}h`:`${(e/24).toFixed(1)}d`}function yt(e,t,n){let r=ee(),i=r.state?.dashboardEntry??r.key,[a,o]=te(),s=a.get(e);return[s!==null&&t.includes(s)?s:n,t=>o(n=>{let r=new URLSearchParams(n);return r.set(e,t),r},{replace:!0,state:{...r.state,dashboardEntry:i}})]}var bt=e=>`Last ${e===`7d`?7:30} calendar days`,xt=`eyebrow text-muted-foreground`,St=`min-w-0 rounded-lg border bg-card-2 p-4`,q=`whitespace-nowrap px-3 py-2 eyebrow text-soft-foreground`;function Ct(){let e=u().data?.projects;return t=>e?.find(e=>e.id===t)?.name??t}var wt=(e,t)=>`/p/${encodeURIComponent(e)}/tasks/${encodeURIComponent(t)}`;function Tt({label:e,value:t,onChange:n}){return(0,F.jsxs)(`label`,{className:nt,children:[e,(0,F.jsxs)(rt,{value:t,onChange:e=>n(e.target.value===`30d`?`30d`:`7d`),children:[(0,F.jsx)(`option`,{value:`7d`,children:`Last 7 days`}),(0,F.jsx)(`option`,{value:`30d`,children:`Last 30 days`})]})]})}function Et({query:e}){return e.isPending?(0,F.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Loading insights…`}):e.isError?(0,F.jsxs)(`p`,{role:`alert`,className:`text-sm`,children:[e.data?`Showing previous results. `:``,`Could not refresh insights.`,` `,(0,F.jsx)(A,{variant:`outline`,onClick:()=>void e.refetch(),children:`Retry insights`})]}):null}function Dt({period:e,active:t}){let n=qe(e,t),r=n.data;return(0,F.jsxs)(`div`,{className:`space-y-3`,children:[(0,F.jsx)(Et,{query:n}),r&&(0,F.jsx)(G,{coverage:r.coverage,retry:()=>void n.refetch()}),r&&(0,F.jsxs)(`div`,{className:`grid gap-3 lg:grid-cols-2`,children:[(0,F.jsx)(kt,{data:r}),(0,F.jsx)(At,{data:r})]})]})}function Ot({value:e,prefix:t=``,className:n}){let r=`${t}${e.toLocaleString(`en-US`)}`;return e<1e4?(0,F.jsx)(`span`,{className:n,children:r}):(0,F.jsxs)(`span`,{className:n,title:r,children:[t,Be(e)]})}function kt({data:e}){let t=e.delivered,n=[{label:`PRs opened`,value:t.prsOpened,note:`${t.prsTouched} touched`},{label:`Lines`,value:(0,F.jsxs)(`span`,{className:`flex flex-wrap gap-x-1.5`,children:[(0,F.jsx)(Ot,{value:t.additions,prefix:`+`,className:`text-success`}),(0,F.jsx)(Ot,{value:t.deletions,prefix:`−`,className:`text-danger`})]})},{label:`Files`,value:(0,F.jsx)(Ot,{value:t.files})},{label:`Issues`,value:(0,F.jsx)(Ot,{value:t.issues})}];return(0,F.jsxs)(`section`,{className:St,"aria-label":`Delivered`,children:[(0,F.jsx)(I,{rows:Object.entries(t).map(([t,n])=>({section:`delivered`,metric:t,value:n,unit:[`additions`,`deletions`].includes(t)?`lines`:t===`files`?`files`:`count`,asOf:e.asOf,note:`Completed since ${e.windowStart}`}))}),(0,F.jsx)(`h3`,{className:xt,children:`Delivered`}),(0,F.jsx)(`dl`,{className:`mt-3 grid grid-cols-2 gap-x-4 gap-y-3 sm:grid-cols-4`,children:n.map(e=>(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`dt`,{className:`text-xs text-soft-foreground`,children:e.label}),(0,F.jsx)(`dd`,{className:`mt-1 truncate text-xl font-semibold tracking-tight tabular-nums`,children:e.value}),e.note&&(0,F.jsx)(`dd`,{className:`text-xs text-soft-foreground`,children:e.note})]},e.label))}),(0,F.jsxs)(`span`,{className:`mt-3 block text-xs text-soft-foreground`,children:[`From `,t.completedTasks,` completed `,t.completedTasks===1?`task`:`tasks`,` ·`,` `,t.measuredTasks,` with a stored diff`]})]})}function At({data:e}){let t=Ct(),{total:n,reasons:r}=e.failures;return(0,F.jsxs)(`section`,{className:St,"aria-label":`Why tasks failed`,children:[(0,F.jsx)(I,{rows:r.map(t=>({section:`failures`,entity:t.label,metric:t.category,value:t.count,unit:`tasks`,asOf:e.asOf,note:t.latest.message}))}),(0,F.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[(0,F.jsx)(`h3`,{className:xt,children:`Why tasks failed`}),n>0&&(0,F.jsxs)(`span`,{className:`font-mono text-meta text-soft-foreground`,children:[n,` failed`]})]}),n===0?(0,F.jsxs)(`span`,{className:`mt-4 flex items-center gap-2.5 text-sm text-muted-foreground`,children:[(0,F.jsx)(M,{tone:`success`}),`No failed outcomes in this period`]}):(0,F.jsx)(`ul`,{className:`mt-3 space-y-3`,children:r.map(e=>(0,F.jsx)(jt,{reason:e,total:n,projectName:t},`${e.category}:${e.label}`))})]})}function jt({reason:e,total:t,projectName:n}){let{latest:r}=e;return(0,F.jsxs)(`li`,{className:`min-w-0`,children:[(0,F.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 text-sm`,children:[(0,F.jsx)(`span`,{className:`min-w-0 truncate font-medium`,title:e.label,children:e.label}),(0,F.jsx)(`span`,{className:`font-mono text-xs tabular-nums text-muted-foreground`,children:e.count})]}),(0,F.jsx)(`div`,{className:`mt-1.5 h-1 overflow-hidden rounded-full bg-muted`,"aria-hidden":`true`,children:(0,F.jsx)(`div`,{className:`h-full rounded-full bg-danger/70`,style:{width:`${e.count/t*100}%`}})}),(0,F.jsxs)(`span`,{className:`mt-1.5 block truncate text-xs text-soft-foreground`,title:r.message,children:[`Latest:`,` `,(0,F.jsx)(T,{className:`text-muted-foreground hover:text-foreground hover:underline`,to:wt(r.projectId,r.id),children:r.title}),` `,`· `,n(r.projectId),r.step?` · ${r.step}`:``,` · `,N(r.at),` ago`]})]})}var Mt={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`,cursor:`Cursor`,pi:`Pi`,unknown:`Unknown backend`,mixed:`Mixed backends`},Nt=e=>Mt[e]??e,Pt=(e,t)=>t?Math.round(e/t*100):0;function Ft(){let[e,t]=yt(`backends`,[`7d`,`30d`],`7d`),n=qe(e),r=n.data,i=r?.visibility.cost;return(0,F.jsx)(`section`,{"data-dashboard-module":`backends`,className:`min-w-0`,children:(0,F.jsxs)(j,{className:`gap-0 py-0`,"data-export-context":`Backends: ${bt(e)}; finished tasks`,children:[(0,F.jsxs)(`div`,{className:R,children:[(0,F.jsx)(`h2`,{className:L,children:`Backends & models`}),(0,F.jsx)(Tt,{label:`Finished`,value:e,onChange:t})]}),(0,F.jsxs)(`div`,{className:`space-y-3 p-4`,children:[(0,F.jsx)(Et,{query:n}),r&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Tasks that finished done or failed in the period, by the backend and model their steps ran on. Includes subtasks. Cost is reported USD only.`}),(0,F.jsx)(G,{coverage:r.coverage,retry:()=>void n.refetch()}),r.backends.length?(0,F.jsx)(`div`,{className:`overflow-x-auto`,role:`region`,"aria-label":`Backend comparison`,tabIndex:0,children:(0,F.jsxs)(`table`,{className:`w-full text-left text-sm`,children:[(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`th`,{className:q,children:`Backend`}),(0,F.jsx)(`th`,{className:`${q} text-right`,children:`Finished`}),(0,F.jsx)(`th`,{className:q,children:`Success`}),(0,F.jsx)(`th`,{className:`${q} text-right`,children:`Median cycle`}),i&&(0,F.jsx)(`th`,{className:`${q} text-right`,children:`Reported USD`}),i&&(0,F.jsx)(`th`,{className:`${q} text-right`,children:`Per completed`})]})}),(0,F.jsx)(`tbody`,{children:r.backends.map(e=>(0,F.jsx)(It,{stat:e,cost:!!i},`${e.backend}:${e.model??``}`))})]})}):(0,F.jsx)(`p`,{className:`py-4 text-sm text-muted-foreground`,children:`No finished tasks in this period.`}),(0,F.jsx)(`span`,{className:`block font-mono text-meta text-soft-foreground`,children:(0,F.jsx)(ot,{at:r.asOf})}),(0,F.jsx)(I,{rows:r.backends.flatMap(e=>[`finished`,`done`,`failed`,`medianCycleHours`].map(t=>({section:`backends`,entity:`${e.backend}${e.model?`:${e.model}`:``}`,metric:t,value:e[t],unit:t===`medianCycleHours`?`hours`:`tasks`,asOf:r.asOf})))})]})]})]})})}function It({stat:e,cost:t}){let n=Pt(e.done,e.finished),r=e.costUsd?.value;return(0,F.jsxs)(`tr`,{className:`border-t transition-colors hover:bg-muted/30`,children:[(0,F.jsxs)(`td`,{className:`px-3 py-2.5`,children:[(0,F.jsx)(`span`,{className:`block font-medium`,children:Nt(e.backend)}),(0,F.jsx)(`span`,{className:`block font-mono text-meta text-soft-foreground`,children:e.backend===`mixed`?`steps ran on different backends`:e.model??`default model`})]}),(0,F.jsx)(`td`,{className:`px-3 py-2.5 text-right tabular-nums`,children:e.finished}),(0,F.jsxs)(`td`,{className:`min-w-40 px-3 py-2.5`,children:[(0,F.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`h-1.5 flex-1 overflow-hidden rounded-full bg-danger/40`,"aria-hidden":`true`,children:(0,F.jsx)(`span`,{className:`block h-full rounded-full bg-success`,style:{width:`${n}%`}})}),(0,F.jsxs)(`span`,{className:`w-10 text-right font-mono text-xs tabular-nums`,children:[n,`%`]})]}),(0,F.jsxs)(`span`,{className:`block text-xs text-soft-foreground`,children:[e.done,` done · `,e.failed,` failed`]})]}),(0,F.jsx)(`td`,{className:`px-3 py-2.5 text-right tabular-nums`,children:e.timedTasks?K(e.medianCycleHours):`—`}),t&&(0,F.jsxs)(`td`,{className:`px-3 py-2.5 text-right tabular-nums`,children:[r==null?`—`:vt(r,!0),(0,F.jsxs)(`span`,{className:`block text-xs text-soft-foreground`,children:[e.costUsd?.reportedTasks??0,`/`,e.finished,` reported`]})]}),t&&(0,F.jsx)(`td`,{className:`px-3 py-2.5 text-right tabular-nums`,children:r==null||!e.done?`—`:vt(r/e.done,!0)})]})}function Lt(){let[e,t]=yt(`automations`,[`7d`,`30d`],`7d`),n=He(),r=qe(e),i=et(n.known&&!n.off),a=Ct(),o=r.data,s=o?.visibility.cost,c=new Map;for(let e of i.data??[])for(let t of e.data?.automations??[])c.set(`${e.id}\u0000${t.id}`,{projectId:e.id,automationId:t.id,name:t.name,enabled:t.enabled,definition:`known`});let l=new Set((i.data??[]).flatMap(e=>e.data&&!e.error?[e.id]:[])),u=i.isError||i.registry.isError||(i.data??[]).some(e=>e.error);for(let e of o?.automations??[]){let t=`${e.projectId}\u0000${e.automationId}`,n=c.get(t);c.set(t,n?{...n,stat:e}:{...e,name:e.automationId,definition:l.has(e.projectId)?`removed`:`unknown`,stat:e})}let d=[...c.values()].sort((e,t)=>(t.stat?.tasks??0)-(e.stat?.tasks??0)||Number(t.enabled??!1)-Number(e.enabled??!1)||e.name.localeCompare(t.name));return(0,F.jsx)(`section`,{"data-dashboard-module":`automation-outcomes`,className:`min-w-0`,children:(0,F.jsxs)(j,{className:`gap-0 py-0`,"data-export-context":`Automation outcomes: tasks created in ${bt(e)}`,children:[(0,F.jsxs)(`div`,{className:R,children:[(0,F.jsx)(`h2`,{className:L,children:`Automation outcomes`}),(0,F.jsx)(Tt,{label:`Launched`,value:e,onChange:t})]}),(0,F.jsx)(`div`,{className:`space-y-3 p-4`,children:n.off?(0,F.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Automations are disabled in this workspace.`}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(Et,{query:r}),o&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Tasks each automation created in the period and how they ended. Active means still running, queued, waiting on you, or waiting to resume after a usage limit.`}),(0,F.jsx)(G,{coverage:o.coverage,retry:()=>void r.refetch()}),u&&(0,F.jsxs)(`p`,{role:`alert`,className:`text-sm`,children:[`Some automation details could not be loaded. Their outcomes are shown by id.`,` `,(0,F.jsx)(A,{variant:`ghost`,onClick:i.retry,children:`Retry automations`})]}),d.length?(0,F.jsx)(`div`,{className:`overflow-x-auto`,role:`region`,"aria-label":`Automation outcomes`,tabIndex:0,children:(0,F.jsxs)(`table`,{className:`w-full text-left text-sm`,children:[(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`th`,{className:q,children:`Automation`}),(0,F.jsx)(`th`,{className:`${q} text-right`,children:`Tasks`}),(0,F.jsx)(`th`,{className:`${q} text-right`,children:`Done`}),(0,F.jsx)(`th`,{className:`${q} text-right`,children:`Failed`}),(0,F.jsx)(`th`,{className:`${q} text-right`,children:`Active`}),(0,F.jsx)(`th`,{className:q,children:`Last run`}),s&&(0,F.jsx)(`th`,{className:`${q} text-right`,children:`Reported USD`})]})}),(0,F.jsx)(`tbody`,{children:d.map(e=>(0,F.jsx)(Rt,{row:e,cost:!!s,projectName:a},`${e.projectId}:${e.automationId}`))})]})}):(0,F.jsx)(`p`,{className:`py-4 text-sm text-muted-foreground`,children:`No automations yet. Create one in a project's Automations page.`}),(0,F.jsx)(`span`,{className:`block font-mono text-meta text-soft-foreground`,children:(0,F.jsx)(ot,{at:o.asOf})}),(0,F.jsx)(I,{rows:d.flatMap(e=>[`tasks`,`done`,`failed`,`active`].map(t=>({section:`automation-outcomes`,entity:`${e.projectId}:${e.automationId}`,metric:t,value:e.stat?.[t]??0,unit:`tasks`,asOf:o.asOf,note:e.name})))})]})]})})]})})}function Rt({row:e,cost:t,projectName:n}){let r=e.stat,i=`px-3 py-2.5 text-right tabular-nums`,a=e=>e||(0,F.jsx)(`span`,{className:`text-soft-foreground`,children:`0`});return(0,F.jsxs)(`tr`,{className:`border-t transition-colors hover:bg-muted/30`,children:[(0,F.jsxs)(`td`,{className:`px-3 py-2.5`,children:[e.definition===`removed`?(0,F.jsx)(`span`,{className:`block font-medium`,children:e.name}):(0,F.jsx)(T,{className:`block font-medium hover:underline`,to:`/p/${encodeURIComponent(e.projectId)}/automations/${encodeURIComponent(e.automationId)}`,children:e.name}),(0,F.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs text-soft-foreground`,children:[(0,F.jsx)(M,{tone:e.enabled?`success`:`neutral`}),n(e.projectId),` ·`,` `,e.definition===`removed`?`Removed`:e.definition===`unknown`?`Details unavailable`:e.enabled?`Enabled`:`Disabled`]})]}),(0,F.jsx)(`td`,{className:i,children:a(r?.tasks)}),(0,F.jsx)(`td`,{className:i,children:a(r?.done)}),(0,F.jsx)(`td`,{className:`${i} ${r?.failed?`text-danger`:``}`,children:a(r?.failed)}),(0,F.jsx)(`td`,{className:i,children:a(r?.active)}),(0,F.jsx)(`td`,{className:`whitespace-nowrap px-3 py-2.5 text-xs text-muted-foreground`,children:r?.lastRunAt?(0,F.jsxs)(`time`,{dateTime:r.lastRunAt,title:new Date(r.lastRunAt).toLocaleString(),children:[N(r.lastRunAt),` ago · `,r.lastStatus]}):`—`}),t&&(0,F.jsx)(`td`,{className:i,children:r?.costUsd?.value==null?`—`:vt(r.costUsd.value,!0)})]})}var zt=0,Bt=()=>++zt,J=new Map;function Y(e,t){let n=(0,P.useContext)(ut),r=()=>{let r=n?J.get(n):void 0;return r?.has(e)?r.get(e):typeof t==`function`?t():t},[i,a]=(0,P.useState)(r),o=`${n}:${e}`,[s,c]=(0,P.useState)(o);o!==s&&(c(o),a(()=>r()));let l=(0,P.useMemo)(()=>({value:i}),[n,e]);return l.value=i,(0,P.useEffect)(()=>()=>{if(!n)return;let t=J.get(n)??new Map;t.set(e,l.value),t.size>80&&t.delete(t.keys().next().value),J.delete(n),J.set(n,t),J.size>20&&J.delete(J.keys().next().value)},[n,e,l]),[i,a]}var Vt=`a[href], button, select, input, [tabindex]`;function Ht(e){let[t]=Y(`${e}:position`,()=>({scroll:0})),n=(0,P.useCallback)(e=>{let n=[...e.querySelectorAll(Vt)],r=t.href?n.find(e=>e.getAttribute(`href`)===t.href):t.index===void 0?void 0:n[t.index];return r&&r.getAttribute(`aria-disabled`)!==`true`&&r.focus({preventScroll:!0}),e.scrollTop=t.scroll,!!r&&r.getAttribute(`aria-disabled`)!==`true`},[t]),r=(0,P.useMemo)(()=>({restore:()=>!1}),[t]);return{ref:(0,P.useCallback)(e=>{if(!e)return;let i=t.href!==void 0||t.index!==void 0,a=()=>{if(!i)return!1;let r=n(e);return r?(i=!1,o.disconnect()):e.querySelector(`[data-sheet-loading="false"]`)&&(i=!1,o.disconnect(),e.querySelector(`button:not([disabled]), select, [tabindex="0"]`)?.focus({preventScroll:!0}),e.scrollTop=t.scroll),r};r.restore=a;let o=new MutationObserver(a);i&&o.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-sheet-loading`]});let s=()=>{i=!1,o.disconnect()},c=()=>{i||(t.scroll=e.scrollTop)},l=n=>{i||!(n.target instanceof HTMLElement)||(t.href=n.target.getAttribute(`href`)??void 0,t.index=[...e.querySelectorAll(Vt)].indexOf(n.target))};return e.addEventListener(`pointerdown`,s),e.addEventListener(`keydown`,s),e.addEventListener(`wheel`,s,{passive:!0}),e.addEventListener(`scroll`,c),e.addEventListener(`focusin`,l),()=>{o.disconnect(),e.removeEventListener(`pointerdown`,s),e.removeEventListener(`keydown`,s),e.removeEventListener(`wheel`,s),e.removeEventListener(`scroll`,c),e.removeEventListener(`focusin`,l)}},[t,n,r]),onOpenAutoFocus:e=>{(t.href!==void 0||t.index!==void 0)&&(e.preventDefault(),r.restore())}}}function Ut(e,t){let n=(0,P.useRef)(null),[r,i]=Y(`${e}:trigger`,null);return{capture:()=>{let e=document.activeElement;n.current=e instanceof HTMLElement&&e!==document.body?e:null,i(n.current?{label:n.current.getAttribute(`aria-label`),text:n.current.textContent}:null)},restore:()=>{((n.current?.isConnected?n.current:r?[...document.querySelectorAll(`button`)].find(e=>!e.closest(`[role="dialog"]`)&&!e.hasAttribute(`disabled`)&&(r.label?e.getAttribute(`aria-label`)===r.label:e.textContent===r.text)):void 0)??document.querySelector(t))?.focus({preventScroll:!0})}}}function Wt(e,t=!0){return m({queryKey:[...f.dashboard,`overview`,e],enabled:t,staleTime:5e3,refetchInterval:t&&!e.snapshotId?15e3:!1,refetchIntervalInBackground:!1,retry:!1,queryFn:async({signal:t})=>w.parse(await r(await g.api.v1.workspace.dashboard.overview.$get({query:{period:e.period??`7d`,group:e.group??`completed`,tzOffsetMinutes:String(e.tzOffsetMinutes??new Date().getTimezoneOffset()),...e.snapshotId?{snapshotId:e.snapshotId}:{},...e.projectId?{projectId:e.projectId}:{},offset:String(e.offset??0),limit:`20`}},{init:{signal:t}}),`/workspace/dashboard/overview`))})}var Gt={running:`Running now`,"needs-you":`Needs you`,completed:`Completed`,failed:`Failed outcomes`},Kt={"needs-you":B.violet,running:B.info,completed:B.success,failed:B.danger},qt={"needs-you":Ee,running:Je,completed:Ge,failed:Pe};function Jt({active:e,children:t,onCurrent:n}){let[r,i]=yt(`period`,[`7d`,`30d`],`7d`),a=Ut(`outcome`,`[data-outcome-trigger]`),o=u().data?.projects,s=e=>o?.find(t=>t.id===e)?.name??e,c=Wt({period:r},e),[l,d]=Y(`outcome:selection`,null),f=Ht(`outcome:${l?.identity??`closed`}`),p=ne();if((0,P.useEffect)(()=>{e||d(null)},[e]),!e)return t({});let m=c.data,h=(e,t)=>{a.capture(),m&&d({identity:Bt(),snapshot:m,group:e,projectId:t})},g=m?.coverage.projects.every(e=>e.state===`complete`);return(0,F.jsxs)(F.Fragment,{children:[t({overview:(0,F.jsxs)(j,{className:`gap-0 py-0`,children:[(0,F.jsxs)(`div`,{className:R,children:[(0,F.jsx)(`h2`,{className:L,children:`Workspace overview`}),(0,F.jsxs)(`label`,{className:nt,children:[`Outcomes period`,(0,F.jsxs)(rt,{value:r,onChange:e=>{i(e.target.value===`30d`?`30d`:`7d`),d(null)},children:[(0,F.jsx)(`option`,{value:`7d`,children:`Last 7 days`}),(0,F.jsx)(`option`,{value:`30d`,children:`Last 30 days`})]})]})]}),(0,F.jsxs)(`div`,{className:`space-y-4 p-4`,children:[c.isPending&&(0,F.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Loading overview…`}),c.isError&&(0,F.jsxs)(`p`,{role:`alert`,children:[m?`Showing previous results. `:``,`Could not refresh overview.`,` `,(0,F.jsx)(A,{variant:`outline`,onClick:()=>void c.refetch(),children:`Retry overview`})]}),m&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[m.metrics.needsYou?`${m.metrics.needsYou} tasks require your input or review.`:g&&p.connected&&!c.isError?`No tasks currently require your input or review.`:`No waiting tasks found in the available data.`,` `,m.metrics.failed,` failed `,m.metrics.failed===1?`outcome`:`outcomes`,` `,`in this period. Includes subtasks; completed does not mean accepted or deployed.`]}),(0,F.jsx)(G,{coverage:m.coverage,retry:()=>void c.refetch()}),(0,F.jsx)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:[`needs-you`,`running`,`completed`,`failed`].map(e=>{let t=m.metrics[e===`needs-you`?`needsYou`:e],i=qt[e];return(0,F.jsxs)(A,{"data-outcome-trigger":!0,"data-export-keep":!0,variant:`outline`,className:`relative min-w-0 overflow-hidden rounded-lg border bg-card-2 p-4 transition-colors before:absolute before:inset-x-0 before:top-0 before:h-px before:opacity-80 hover:border-foreground/20 hover:bg-muted/40 sm:p-5 group/metric h-auto min-h-24 flex-col items-start gap-0 whitespace-normal text-left font-normal ${t===0?B.neutral:Kt[e]}`,onClick:t=>{n&&(e===`running`||e===`needs-you`)?n(e,t.currentTarget):h(e)},"aria-label":`${Gt[e]}: ${t}`,children:[(0,F.jsx)(at,{label:Gt[e],value:t,icon:(0,F.jsx)(i,{className:`size-4`}),children:e===`running`||e===`needs-you`?`Current state`:`Last ${r===`7d`?7:30} calendar days`}),(0,F.jsxs)(`span`,{"data-export-exclude":!0,className:`mt-4 flex items-center gap-1 text-xs font-medium text-muted-foreground transition-colors group-hover/metric:text-foreground`,children:[`View tasks`,` `,(0,F.jsx)(Ne,{className:`size-3 transition-transform group-hover/metric:translate-x-0.5 motion-reduce:transition-none`,"aria-hidden":`true`})]})]},e)})}),(0,F.jsx)(Dt,{period:r,active:e}),(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-4 gap-y-1 border-t pt-3`,children:[(0,F.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Median cycle time`,` `,(0,F.jsx)(`strong`,{className:`font-mono font-semibold text-foreground`,children:K(m.metrics.medianCycleHours)}),` `,`· `,m.metrics.timedTasks,`/`,m.metrics.completed,` completed tasks have valid timings.`,` `,(0,F.jsx)(A,{variant:`ghost`,className:`h-auto px-1.5 py-1 text-sm text-foreground underline-offset-4 hover:underline`,onClick:()=>h(`completed`),children:`Inspect completed tasks`})]}),(0,F.jsx)(`p`,{className:`font-mono text-meta text-soft-foreground`,children:(0,F.jsxs)(`time`,{dateTime:m.asOf,title:new Date(m.asOf).toLocaleString(),children:[`Updated `,N(m.asOf),` ago`]})})]}),(0,F.jsxs)(`details`,{className:`text-xs text-muted-foreground`,children:[(0,F.jsxs)(`summary`,{"data-export-heading":`Metric definitions`,className:`flex w-fit cursor-pointer list-none items-center gap-1.5 rounded-sm text-muted-foreground transition-colors select-none hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 [&::-webkit-details-marker]:hidden py-1`,children:[(0,F.jsx)(z,{}),`How these metrics work`]}),(0,F.jsx)(`p`,{className:`mt-1 max-w-prose pl-5 leading-relaxed`,children:`Outcomes use finish dates, including archived tasks. Scheduled retries are excluded from failed outcomes. Period includes today at your current fixed UTC offset.`})]}),(0,F.jsx)(I,{rows:Object.entries(m.metrics).map(([e,t])=>({section:`overview`,metric:e,value:t,unit:e===`medianCycleHours`?`hours`:`tasks`,asOf:m.asOf,note:e===`running`||e===`needsYou`?`Current non-archived state`:`Finished since ${m.windowStart}`}))})]})]})]}),portfolio:m&&(0,F.jsx)(`div`,{children:(0,F.jsxs)(j,{className:`gap-0 py-0`,"data-export-context":`Outcomes: Last ${r===`7d`?7:30} calendar days; workload: current state`,children:[(0,F.jsx)(`div`,{className:`flex min-h-12 flex-wrap items-center justify-between gap-x-3 gap-y-2 border-b px-4 py-2.5`,children:(0,F.jsx)(`h2`,{className:`section-mark eyebrow text-muted-foreground`,children:`Projects`})}),(0,F.jsx)(`p`,{className:`px-4 pt-3 text-xs text-muted-foreground`,children:`Current workload and outcomes for the selected period. Sorted by tasks needing you, then running tasks. Counts include subtasks.`}),(0,F.jsxs)(`div`,{className:`overflow-x-auto px-1 pb-2`,role:`region`,"aria-label":`Project outcomes`,tabIndex:0,children:[(0,F.jsxs)(`table`,{className:`w-full text-left text-sm`,children:[(0,F.jsx)(`thead`,{children:(0,F.jsx)(`tr`,{children:[`Project`,`Needs you`,`Running`,`Completed`,`Failed`,`Median cycle`].map(e=>(0,F.jsx)(`th`,{className:`whitespace-nowrap px-3 py-2 eyebrow text-soft-foreground ${e===`Project`?``:`text-right`}`,children:e},e))})}),(0,F.jsx)(`tbody`,{children:m.projects.map(e=>{let t=m.coverage.projects.find(t=>t.projectId===e.projectId);return(0,F.jsxs)(`tr`,{className:`border-t transition-colors hover:bg-muted/30`,children:[(0,F.jsxs)(`td`,{className:`px-3 py-2`,children:[(0,F.jsx)(T,{className:`font-medium hover:underline`,to:`/p/${encodeURIComponent(e.projectId)}`,children:s(e.projectId)}),t?.state!==`complete`&&(0,F.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:`Incomplete data`})]}),[`needs-you`,`running`,`completed`,`failed`].map(n=>(0,F.jsx)(`td`,{className:`px-3 py-1 text-right`,children:(0,F.jsx)(A,{"data-export-keep":!0,variant:`ghost`,className:`min-h-11 tabular-nums`,"aria-label":`${s(e.projectId)}: ${Gt[n]}: ${t?.state===`unavailable`?`Unavailable`:e[n===`needs-you`?`needsYou`:n]}`,disabled:t?.state===`unavailable`,onClick:()=>h(n,e.projectId),children:t?.state===`unavailable`?`Unavailable`:e[n===`needs-you`?`needsYou`:n]})},n)),(0,F.jsxs)(`td`,{className:`px-3 py-2 text-right tabular-nums`,children:[K(e.medianCycleHours),(0,F.jsxs)(`span`,{className:`block text-xs text-muted-foreground`,children:[e.timedTasks,`/`,e.completed,` timed`]})]})]},e.projectId)})})]}),!m.projects.length&&(0,F.jsx)(`p`,{className:`py-4`,children:`No projects to compare yet.`})]}),(0,F.jsx)(I,{rows:m.projects.flatMap(({projectId:e,...t})=>Object.entries(t).map(([t,n])=>({section:`portfolio`,entity:e,metric:t,value:m.coverage.projects.find(t=>t.projectId===e)?.state===`unavailable`?null:n,unit:t===`medianCycleHours`?`hours`:`tasks`,asOf:m.asOf,note:`Outcomes since ${m.windowStart}; running and needsYou are current state`})))})]})})}),(0,F.jsx)(be,{open:!!l,onOpenChange:e=>{e||d(null)},children:(0,F.jsxs)(ye,{...f,className:`w-full overflow-y-auto sm:max-w-xl`,onCloseAutoFocus:e=>{e.preventDefault(),a.restore()},children:[(0,F.jsxs)(ge,{children:[(0,F.jsxs)(ve,{children:[l?Gt[l.group]:`Tasks`,l?.projectId?` · ${l.projectId}`:``]}),(0,F.jsx)(_e,{children:`Tasks behind the selected metric. Includes subtasks. Snapshot keeps counts and rows consistent.`})]}),l&&(0,F.jsx)(Yt,{selection:l,projectName:s,refresh:()=>{d(null),c.refetch()}},l.identity)]})})]})}function Yt({selection:e,refresh:t,projectName:n}){let[r,i]=Y(`outcome:${e.identity}:offset`,0),a=Wt({period:e.snapshot.period,snapshotId:e.snapshot.snapshotId,group:e.group,projectId:e.projectId,offset:r}),o=(0,P.useRef)(null),s=(0,P.useRef)(null);(0,P.useEffect)(()=>{a.data&&s.current===r&&(o.current?.focus(),s.current=null)},[a.data,r]);let c=e=>{s.current=e,i(e)};return(0,F.jsxs)(`div`,{className:`space-y-3 p-4`,"data-sheet-loading":a.isFetching,children:[a.isPending&&(0,F.jsx)(`p`,{children:`Loading tasks…`}),a.isError&&(0,F.jsxs)(`p`,{role:`alert`,children:[`This snapshot may have expired or become unavailable.`,` `,(0,F.jsx)(A,{onClick:t,children:`Refresh overview`})]}),a.data&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{ref:o,tabIndex:-1,className:`text-xs text-muted-foreground`,children:[a.data.page.total,` tasks · Snapshot from`,` `,(0,F.jsxs)(`time`,{dateTime:a.data.asOf,title:new Date(a.data.asOf).toLocaleString(),children:[N(a.data.asOf),` ago`]})]}),a.data.page.rows.map(t=>(0,F.jsx)(Xt,{row:t,group:e.group,projectName:n},`${t.projectId}:${t.id}`)),!a.data.page.rows.length&&(0,F.jsx)(`p`,{children:`No tasks in this group.`})]}),(0,F.jsxs)(`div`,{className:`flex gap-2`,children:[(0,F.jsx)(A,{variant:`outline`,disabled:!r||a.isFetching,onClick:()=>c(Math.max(0,r-20)),children:`Previous`}),(0,F.jsx)(A,{variant:`outline`,disabled:!a.data||a.data.page.nextOffset===null||a.isFetching,onClick:()=>c(a.data.page.nextOffset),children:`Next`})]})]})}function Xt({row:e,group:t,projectName:n}){let r=ce(e),i=t===`running`||t===`needs-you`;i&&r&&(e={...e,...r});let a=r===null,s=i&&(e.archived||(t===`running`?e.status!==`running`:!c(e))),l=a||s,u=o(e),d=i&&a?`Task removed`:s?t===`running`?`No longer running`:`No longer needs you`:u.label;return(0,F.jsxs)(`div`,{className:`border-b py-3`,children:[(0,F.jsx)(T,{"aria-disabled":l||void 0,tabIndex:l?-1:void 0,onClick:e=>{l&&e.preventDefault()},className:`block min-h-11 font-medium hover:underline`,to:`/p/${encodeURIComponent(e.projectId)}/tasks/${encodeURIComponent(e.id)}`,children:e.titleSummary||e.title}),(0,F.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[(0,F.jsx)(M,{tone:u.tone}),` `,n(e.projectId),` ·`,` `,d,` · `,e.archived?`Archived · `:``,(0,F.jsxs)(`time`,{dateTime:e.finishedAt??e.createdAt,title:new Date(e.finishedAt??e.createdAt).toLocaleString(),children:[e.finishedAt?`Finished`:`Created`,` `,N(e.finishedAt??e.createdAt),` ago`]})]})]})}var X={snapshot:[...f.dashboard,`snapshot`],feed:e=>[...f.dashboard,`feed`,e],telemetry:[...f.dashboard,`telemetry`]},Zt=new Map;async function Qt(e){let t=E(),n=C.parse(await r(await g.api.v1.workspace.dashboard.$get({},{init:{signal:e}}),`/workspace/dashboard`));return Zt.has(n.snapshotId)||Zt.set(n.snapshotId,t),Zt.size>60&&Zt.delete(Zt.keys().next().value),re(t,[...n.questions.rows,...n.reviews.rows]),n}async function $t(e,t,n=0,i=20,a){let o=S.parse(await r(await g.api.v1.workspace.dashboard.tasks.$get({query:{snapshotId:e,group:t,offset:String(n),limit:String(i)}},{init:{signal:a}}),`/workspace/dashboard/tasks`)),s=Zt.get(e);return s!==void 0&&re(s,o.page.rows),o}function en(e){return m({queryKey:X.snapshot,queryFn:({signal:e})=>Qt(e),enabled:e,staleTime:5e3,refetchOnMount:`always`,refetchInterval:e?15e3:!1,refetchIntervalInBackground:!1,retry:!1})}function tn(e){return m({queryKey:X.telemetry,enabled:e,staleTime:0,queryFn:async({signal:e})=>{let t=v.parse(await r(await g.api.v1.workspace.dashboard.telemetry.$get({},{init:{signal:e}}),`/workspace/dashboard/telemetry`));return ie.seed(t.samples,t.asOf),t}})}function nn(e,t){let n=m({queryKey:X.feed(e),queryFn:async({signal:t})=>{let n=E(),i=_.parse(await r(await g.api.v1.workspace.dashboard.feed.$get({query:{filter:e}},{init:{signal:t}}),`/workspace/dashboard/feed`));return re(n,i.rows.flatMap(e=>e.kind===`task-result`?[e.run]:[])),i},enabled:t,staleTime:15e3,refetchInterval:t&&e!==`github`?15e3:!1,retry:!1}),i=(0,P.useRef)(!1);return(0,P.useEffect)(()=>{i.current=!1},[e,t]),(0,P.useEffect)(()=>{if(!t||i.current||!n.data?.sources.some(e=>e.reason===`Still loading GitHub`))return;let e=setTimeout(()=>{document.visibilityState!==`hidden`&&(i.current=!0,n.refetch())},5e3);return()=>clearTimeout(e)},[t,n.data,n.refetch]),n}function rn(e,t){let n=nn(`tasks`,t&&e!==`github`),r=nn(`github`,t&&e!==`tasks`),i=(0,P.useMemo)(()=>{if(e===`tasks`)return n.data;if(e===`github`)return r.data;let t=n.data,i=r.data;if(!t&&!i)return;let a=t??i,o=new Date(Math.max(Date.parse(t?.asOf??a.asOf),Date.parse(i?.asOf??a.asOf))).toISOString(),s=new Date(Date.parse(o)-10080*60*1e3).toISOString(),c=[...t?.rows??[],...i?.rows??[]].filter(e=>Date.parse(e.at)>=Date.parse(s)&&Date.parse(e.at)<=Date.parse(o)).sort((e,t)=>an(e,t)),l=new Set(c.slice(60).map(e=>e.kind===`task-result`?`tasks:${e.run.projectId}`:e.key.slice(0,e.key.lastIndexOf(`:`)))),u=[...t?.sources??[],...i?.sources??[]].map(e=>l.has(e.key)?{...e,truncated:!0}:e);return{...a,asOf:o,windowStart:s,filter:`all`,rows:c.slice(0,60),sources:u,coverage:t?.coverage??a.coverage,truncated:c.length>60||!!t?.truncated||!!i?.truncated}},[e,n.data,r.data]),a=e===`github`?r:n;return{...a,data:i,githubError:r.isError,githubFetching:r.isFetching,retryTasks:()=>n.refetch(),retryFailed:()=>e===`github`?r.refetch():e===`tasks`?n.refetch():Promise.all([...n.isError?[n.refetch()]:[],...r.isError?[r.refetch()]:[]]),isPending:!i&&a.isPending,isError:a.isError||e===`all`&&r.isError,isFetching:a.isFetching||e===`all`&&r.isFetching,refetch:()=>e===`tasks`?n.refetch():r.refetch()}}function an(e,t){return Date.parse(t.at)-Date.parse(e.at)||e.key.localeCompare(t.key)}var on=[...f.dashboard,`costs`];function sn(){let e=0,t=0,n,r=new Set;return{subscribe:e=>(r.add(e),()=>{r.delete(e)}),getSnapshot:()=>n,async read(i,a){let o=++e,s=await fn(i,a);return!a?.aborted&&o>t&&(t=o,(n?.cost!==s.visibility.cost||n?.tokens!==s.visibility.tokens)&&(n=s.visibility,r.forEach(e=>e()))),s}}}var cn=new WeakMap;function ln(e){let t=cn.get(e);return t||(t=sn(),cn.set(e,t)),t}function un(){let e=ln(l());return(0,P.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot)}var dn=new Map;async function fn(e,t){let n=E(),i=x.parse(await r(await g.api.v1.workspace.dashboard.costs.$get({query:{...e,offset:String(e.offset??0),limit:`20`}},{init:{signal:t}}),`/workspace/dashboard/costs`));!e.snapshotId&&!dn.has(i.snapshotId)&&dn.set(i.snapshotId,n),dn.size>60&&dn.delete(dn.keys().next().value);let a=dn.get(i.snapshotId);return a!==void 0&&re(a,i.tasks.rows),i}function pn(e,t,n){let r=ln(l());return m({queryKey:[...on,e,t,n],queryFn:({signal:n})=>r.read({period:e,sort:t,tzOffsetMinutes:new Date().getTimezoneOffset()},n),staleTime:5e3,refetchOnMount:`always`,refetchInterval:15e3,refetchIntervalInBackground:!1,retry:!1})}function mn(e,t,n,r){let i=ln(l());return m({queryKey:[...on,`tasks`,e.snapshotId,t,n,r,e.visibility],retry:!1,queryFn:async({signal:a})=>{let o=e.tzOffsetMinutes??new Date().getTimezoneOffset(),s=async s=>{let c=await i.read({period:e.period,sort:n,snapshotId:s,projectId:t,tzOffsetMinutes:o},a),l=[...c.tasks.rows];for(;c.tasks.nextOffset!==null&&l.length<r;)c=await i.read({period:e.period,sort:n,snapshotId:c.snapshotId,projectId:t,offset:c.tasks.nextOffset},a),l.push(...c.tasks.rows);return{...c,tasks:{...c.tasks,rows:l}}};try{return await s(e.snapshotId)}catch(e){if(e instanceof h&&e.status===409)return s();throw e}}})}var hn={cost:{text:`text-primary`,fill:`bg-primary`,tint:B.primary,icon:We},input:{text:`text-violet`,fill:`bg-violet`,tint:B.violet,icon:Ye},output:{text:`text-info`,fill:`bg-info`,tint:B.info,icon:Ce}};function gn({metric:e,label:t,value:n,reported:r,total:i}){let a=hn[e],o=a.icon,s=i?Math.min(100,r/i*100):0;return(0,F.jsxs)(`div`,{className:`${it} ${a.tint}`,children:[(0,F.jsxs)(at,{label:t,value:n,icon:(0,F.jsx)(o,{className:`size-4 ${a.text}`}),children:[r,` of `,i,` tasks report this metric`]}),(0,F.jsx)(`div`,{className:`mt-2 h-1.5 overflow-hidden rounded-full bg-muted`,"aria-hidden":`true`,children:(0,F.jsx)(`div`,{className:`h-full rounded-full ${a.fill} transition-[width] duration-300 motion-reduce:transition-none`,style:{width:`${s}%`}})})]})}function _n({projects:e,currentProjects:t,metric:n,field:r,label:i,format:a,onSelect:o}){let s=e.reduce((e,t)=>Math.max(e,t[r]?.value??0),0),c=hn[n];return(0,F.jsxs)(je,{delayDuration:150,children:[(0,F.jsxs)(`div`,{className:`space-y-1 rounded-xl border p-2`,"aria-label":`Projects ranked by ${i}`,children:[e.length===0&&(0,F.jsx)(`p`,{className:`px-3 py-4 text-muted-foreground`,children:`No projects to compare in this cohort.`}),e.slice(0,5).map((e,n)=>{let l=e[r],u=l?.value,d=u==null||s===0?0:u/s*100,f=u!=null;return(0,F.jsxs)(Me,{children:[(0,F.jsx)(ke,{asChild:!0,children:(0,F.jsxs)(`button`,{"data-export-row":!0,"data-export-keep":!0,className:`group w-full rounded-lg px-3 py-3 text-left transition-colors hover:bg-muted/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50 motion-reduce:transition-none`,disabled:!t.some(t=>t.projectId===e.projectId),onClick:()=>o(e.projectId),children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,F.jsx)(`span`,{className:`w-4 shrink-0 text-xs tabular-nums text-muted-foreground`,"aria-hidden":`true`,children:n+1}),(0,F.jsx)(`span`,{className:`min-w-0 flex-1 break-words font-medium`,children:e.projectId}),(0,F.jsx)(`span`,{className:`shrink-0 font-semibold tabular-nums`,children:a(u)}),(0,F.jsx)(Ne,{"data-export-exclude":!0,className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":`true`})]}),(0,F.jsx)(`div`,{className:`mt-2 ml-7 h-2 overflow-hidden rounded-full bg-muted`,"aria-hidden":`true`,children:(0,F.jsx)(`div`,{"data-project-bar":e.projectId,className:`h-full rounded-full ${c.fill} transition-[width] duration-300 motion-reduce:transition-none`,style:{width:`${d}%`}})}),(0,F.jsxs)(`p`,{className:`mt-1.5 ml-7 text-xs text-muted-foreground`,children:[l?.reportedTasks??0,` of `,e.tasks,` tasks report this metric`,f?``:` · No measured value`]})]})}),(0,F.jsxs)(Ae,{className:`max-w-64`,children:[(0,F.jsxs)(`p`,{className:`font-medium`,children:[e.projectId,` · `,i,`: `,a(u)]}),(0,F.jsxs)(`p`,{children:[l?.reportedTasks??0,` of `,e.tasks,` tasks report this metric.`]}),(0,F.jsx)(`p`,{children:`Open project tasks`})]})]},e.projectId)})]}),e.length>0&&(0,F.jsxs)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:[e.length>5?`Top 5 of ${e.length} projects. `:``,`Bar lengths compare reported values; the largest is the reference.`]})]})}var Z={cost:`costUsd`,input:`inputTokens`,output:`outputTokens`},vn={cost:`Reported USD`,input:`Input tokens`,output:`Output tokens`};function yn(e,t){return JSON.stringify([e.totals,e.projects,e.tasks,e.visibility,e.coverage,e.invalidDateTasks])!==JSON.stringify([t.totals,t.projects,t.tasks,t.visibility,t.coverage,t.invalidDateTasks])}var bn=(e,t)=>vt(e,t===`cost`);function Q(e){return[...e.cost?[`cost`]:[],...e.tokens?[`input`,`output`]:[]]}function xn({value:e,onChange:t,visibility:n}){return(0,F.jsxs)(`label`,{className:nt,children:[`Sort by`,(0,F.jsx)(rt,{value:e,onChange:e=>t(e.target.value),children:Q(n).map(e=>(0,F.jsx)(`option`,{value:e,children:vn[e]},e))})]})}function Sn(){return(0,F.jsx)(Cn,{visibility:Ve(a().data)})}function Cn({visibility:e}){return(0,F.jsxs)(j,{className:`gap-0 py-0`,children:[(0,F.jsx)(`div`,{className:R,children:(0,F.jsx)(`h2`,{className:L,children:`Usage & cost`})}),!e.cost&&!e.tokens?(0,F.jsx)(`p`,{className:`p-4 text-sm`,children:`Usage metrics are hidden by workspace settings`}):(0,F.jsx)(wn,{visibility:e},`${e.cost}:${e.tokens}`)]})}function wn({visibility:e}){let[t,n]=yt(`usagePeriod`,[`all`,`7d`,`30d`],`all`),[r,i]=yt(`usageSort`,Q(e),e.cost?`cost`:`input`);return(0,F.jsx)(Tn,{period:t,setPeriod:n,sort:r,setSort:i,visibility:e})}function Tn({period:e,setPeriod:t,sort:n,setSort:r,visibility:i}){let a=pn(e,n,`${i.cost}:${i.tokens}`),[o,s]=Y(`usage:accepted`,void 0),c=o??a.data,l=a.data??c,[u,d]=Y(`usage:panel`,null),[f,p]=(0,P.useState)(e);f!==e&&(p(e),s(void 0),d(null));let m=Ht(`usage:${u?.identity??`closed`}`),h=Ut(`usage`,`[data-usage-trigger]`),g=e=>{h.capture(),c&&d({identity:Bt(),projectId:e,snapshot:c,latestId:l?.snapshotId??c.snapshotId})},_=un()??i,v={cost:i.cost&&_.cost,tokens:i.tokens&&_.tokens},y=Q(v).includes(n)?n:Q(v)[0]??`cost`,b=[...c?.projects??[]].sort((e,t)=>{let n=e[Z[y]]?.value,r=t[Z[y]]?.value;return(n==null?r==null?0:1:r==null?-1:r-n)||e.projectId.localeCompare(t.projectId)});!o&&a.data&&s(a.data);let x=c&&l&&yn(c,l),S=c?.coverage.projects.some(e=>e.state!==`complete`),C=l?.coverage.projects.some(e=>e.state!==`complete`),w=JSON.stringify(c?.coverage)!==JSON.stringify(l?.coverage),T=c?.totals.tasks===0&&!S&&!C;return(0,F.jsxs)(`div`,{className:`space-y-4 p-4 text-sm`,children:[c&&(0,F.jsx)(I,{rows:T?[]:[...Q(v).map(e=>({section:`totals`,metric:Z[e],value:c.totals[Z[e]]?.value??null,unit:e===`cost`?`USD`:`tokens`,reportedTasks:c.totals[Z[e]]?.reportedTasks??0,totalTasks:c.totals.tasks,asOf:c.asOf})),...(v.cost||v.tokens?b.slice(0,5):[]).map(e=>({section:`project`,entity:e.projectId,metric:Z[y],value:e[Z[y]]?.value??null,unit:y===`cost`?`USD`:`tokens`,reportedTasks:e[Z[y]]?.reportedTasks??0,totalTasks:e.tasks,asOf:c.asOf}))]}),c&&(0,F.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,F.jsx)(ot,{at:c.asOf})}),(0,F.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h3`,{className:`font-medium`,children:`Lifetime totals of retained tasks`}),(0,F.jsxs)(`details`,{className:`mt-1 text-xs text-muted-foreground`,children:[(0,F.jsxs)(`summary`,{"data-export-heading":`Metric definitions`,className:`${tt} min-h-11`,children:[(0,F.jsx)(z,{}),`How these metrics work`]}),(0,F.jsxs)(`p`,{children:[`Includes archived tasks and subtasks.`,` `,v.cost&&`Reported USD is not an invoice. `,`Missing reports are excluded, not treated as zero. Calendar days use your current UTC offset, including today.`]})]})]}),(0,F.jsxs)(`label`,{className:nt,children:[`Tasks created`,(0,F.jsxs)(rt,{value:e,onChange:e=>t(e.target.value),children:[(0,F.jsx)(`option`,{value:`all`,children:`All time`}),(0,F.jsx)(`option`,{value:`7d`,children:`Last 7 days`}),(0,F.jsx)(`option`,{value:`30d`,children:`Last 30 days`})]})]})]}),e!==`all`&&(0,F.jsx)(`p`,{className:`text-muted-foreground`,children:`Lifetime usage of tasks created in this period — not spending during the period.`}),a.isPending&&(0,F.jsx)(`p`,{children:`Loading usage…`}),a.isError&&(0,F.jsxs)(`p`,{role:`alert`,children:[c?`Showing stale usage. Could not refresh.`:`Could not load usage.`,` `,(0,F.jsx)(A,{className:`min-h-11`,onClick:()=>void a.refetch(),children:`Retry`})]}),x&&(0,F.jsx)(`p`,{role:`status`,children:`Newer usage data is available; displayed values use the previous snapshot.`}),x&&(0,F.jsx)(A,{className:`min-h-11`,variant:`outline`,onClick:()=>s(l),children:`Updates available — Show`}),c&&S&&(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`p`,{className:`text-muted-foreground`,children:`Coverage of displayed usage:`}),(0,F.jsx)(G,{coverage:c.coverage,retry:()=>void a.refetch()})]}),l&&C&&w&&(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`p`,{className:`text-muted-foreground`,children:`Current source availability:`}),(0,F.jsx)(G,{coverage:l.coverage,retry:()=>void a.refetch()})]}),c&&(0,F.jsxs)(F.Fragment,{children:[!T&&(0,F.jsx)(`div`,{className:`report-cost-metrics grid gap-3 sm:grid-cols-[repeat(auto-fit,minmax(220px,1fr))]`,children:Q(v).map(e=>(0,F.jsx)(gn,{metric:e,label:vn[e],value:bn(c.totals[Z[e]]?.value,e),reported:c.totals[Z[e]]?.reportedTasks??0,total:c.totals.tasks},e))}),!v.cost&&!v.tokens&&(0,F.jsx)(`p`,{children:`Usage metrics are hidden by workspace settings`}),c.totals.tasks===0?(0,F.jsx)(`p`,{children:S||C?`No retained tasks could be read from available sources.`:`No retained tasks in this cohort.`}):Q(v).every(e=>!c.totals[Z[e]]?.reportedTasks)&&(0,F.jsx)(`p`,{children:`No reports for the visible metrics in this cohort.`}),T&&(0,F.jsx)(`p`,{className:`text-muted-foreground`,children:`Usage appears when tasks report cost or tokens.`}),(0,F.jsxs)(`p`,{className:`text-muted-foreground`,children:[`Deleted tasks are excluded from retained history.`,c.invalidDateTasks?` ${c.invalidDateTasks} tasks have missing or invalid creation dates${e===`all`?`; included in All time`:`; excluded from this period`}.`:``]}),!T&&(v.cost||v.tokens)&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h3`,{className:`font-medium`,children:`Top projects`}),(0,F.jsx)(`p`,{className:`text-muted-foreground`,children:`Ranking uses reported metrics only.`})]}),(0,F.jsx)(xn,{value:y,onChange:r,visibility:v})]}),(0,F.jsx)(_n,{projects:b,metric:y,label:vn[y],field:Z[y],format:e=>bn(e,y),currentProjects:l?.projects??[],onSelect:g}),(0,F.jsx)(A,{"data-usage-trigger":!0,className:`min-h-11`,variant:`outline`,onClick:()=>g(``),children:`View tasks`})]})]}),(0,F.jsx)(be,{open:u!==null&&(v.cost||v.tokens),onOpenChange:e=>{e||d(null)},children:(0,F.jsxs)(ye,{...m,className:`w-full overflow-y-auto sm:max-w-xl`,onCloseAutoFocus:e=>{e.preventDefault(),h.restore()},children:[(0,F.jsxs)(ge,{children:[(0,F.jsx)(ve,{children:u?.projectId?`${u.projectId} tasks`:`All tasks`}),(0,F.jsx)(_e,{children:`Lifetime usage of retained tasks. Missing reports are unavailable.`})]}),u!==null&&(0,F.jsx)(En,{identity:`usage:${u.identity}`,snapshot:l&&l.snapshotId!==u.latestId?l:u.snapshot,projectId:u.projectId||void 0,visibility:v},u.identity)]})})]})}function En({identity:e,snapshot:t,projectId:n,visibility:r}){let[i,a]=Y(`${e}:sort`,t.sort);return(0,F.jsx)(Dn,{identity:e,snapshot:t,projectId:n,visibility:r,sort:Q(r).includes(i)?i:Q(r)[0]??`cost`,setSort:a})}function Dn({identity:e,snapshot:t,projectId:n,visibility:r,sort:i,setSort:a}){let[o,s]=Y(`${e}:count`,20),[c,l]=Y(`${e}:paging`,void 0),[u,d]=(0,P.useState)(t.snapshotId);u!==t.snapshotId&&(d(t.snapshotId),l(void 0));let f=mn(c??t,n,i,o),p=un()??r,m={cost:r.cost&&p.cost,tokens:r.tokens&&p.tokens},h=Q(m).includes(i)?i:Q(m)[0]??`cost`,[g,_]=Y(`${e}:accepted`,void 0),[v,y]=Y(`${e}:acceptedCount`,o),[b,x]=Y(`${e}:acceptedSort`,i),[S,C]=(0,P.useState)(i);S!==i&&(C(i),s(20),l(g??c??t)),f.data&&(!g||(v!==o||b!==i)&&g.snapshotId===f.data.snapshotId)&&(_(f.data),y(o),x(i));let w=g??f.data,T=f.data&&w&&yn(f.data,w),ee=w?.coverage.projects.some(e=>e.state!==`complete`),te=f.data?.coverage.projects.some(e=>e.state!==`complete`),E=JSON.stringify(w?.coverage)!==JSON.stringify(f.data?.coverage),ne=!n||t.projects.some(e=>e.projectId===n);return(0,F.jsxs)(`div`,{className:`space-y-3 p-4 text-sm`,"data-sheet-loading":f.isFetching,children:[(0,F.jsx)(xn,{value:h,onChange:a,visibility:m}),f.isPending&&(0,F.jsx)(`p`,{children:`Loading tasks…`}),f.isError&&(0,F.jsxs)(`p`,{role:`alert`,children:[`Could not refresh tasks. `,w?`Showing stale usage.`:``,` `,(0,F.jsx)(A,{className:`min-h-11`,onClick:()=>void f.refetch(),children:`Retry`})]}),T&&(0,F.jsx)(A,{className:`min-h-11`,onClick:()=>{_(f.data),y(o),x(i)},children:`Updates available — Show`}),w&&ee&&(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`p`,{className:`text-muted-foreground`,children:`Coverage of displayed tasks:`}),(0,F.jsx)(G,{coverage:w.coverage,retry:()=>void f.refetch()})]}),f.data&&te&&E&&(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`p`,{className:`text-muted-foreground`,children:`Current source availability:`}),(0,F.jsx)(G,{coverage:f.data.coverage,retry:()=>void f.refetch()})]}),w&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`border-b pb-2 font-mono text-meta text-soft-foreground`,children:[w.tasks.rows.length,` of `,w.tasks.total,` retained tasks`]}),w.tasks.total===0&&(0,F.jsx)(`p`,{children:w.coverage.projects.some(e=>e.state!==`complete`)?`No tasks could be read from available sources.`:`No retained tasks in this cohort.`}),w.tasks.rows.map(e=>(0,F.jsx)(On,{row:e,sort:h,visibility:m,disabled:!ne||!f.data||!!(T&&!f.data?.tasks.rows.some(t=>t.id===e.id&&t.projectId===e.projectId))},`${e.projectId}:${e.id}`)),w.tasks.nextOffset!==null&&(0,F.jsx)(A,{className:`min-h-11`,disabled:f.isFetching,onClick:()=>{l(w),s(e=>e+20)},children:`Show 20 more tasks`})]})]})}function On({row:e,sort:t,visibility:n,disabled:r}){let i=ce(e);r||=i===null;let a=o(i?{status:i.status,awaitingAnswerSince:i.awaitingAnswerSince}:e),s=Q(n).filter(e=>e!==t),c=t=>{let n=e[Z[t]];return n==null?`—`:bn(n,t)},l=t=>`${vn[t]}: ${bn(e[Z[t]],t)}`;return(0,F.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto] items-start gap-x-4 border-b py-3 last:border-0`,children:[(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,F.jsx)(M,{tone:a.tone,pulse:a.pulse,className:`mt-[7px]`}),(0,F.jsx)(T,{className:`line-clamp-2 break-words font-medium leading-snug hover:underline no-hover:min-h-11`,title:e.title,to:`/p/${encodeURIComponent(e.projectId)}/tasks/${encodeURIComponent(e.id)}`,"aria-disabled":r||void 0,tabIndex:r?-1:void 0,onClick:e=>{r&&e.preventDefault()},children:e.title})]}),(0,F.jsxs)(`p`,{className:`mt-1 pl-[15px] font-mono text-meta text-soft-foreground`,children:[e.projectId,` · `,r?`Checking current state…`:i?.status??e.status,e.archived?` · Archived`:``,e.subtask?` · Subtask`:``]})]}),(0,F.jsxs)(`div`,{className:`text-right tabular-nums`,children:[(0,F.jsx)(`span`,{"aria-label":l(t),className:`block font-semibold ${e[Z[t]]==null?`text-soft-foreground`:``}`,children:c(t)}),s.length>0&&(0,F.jsx)(`span`,{className:`mt-1 flex justify-end gap-3 font-mono text-meta text-soft-foreground`,children:s.map(e=>(0,F.jsxs)(`span`,{"aria-label":l(e),children:[c(e),` `,e===`cost`?``:e===`input`?`in`:`out`]},e))})]})]})}var kn={cost:`costUsd`,input:`inputTokens`,output:`outputTokens`},An={cost:`Reported USD`,input:`Input tokens`,output:`Output tokens`};function jn(e){return[...e.cost?[`cost`]:[],...e.tokens?[`input`,`output`]:[]]}var Mn=(e,t)=>vt(e,t===`cost`);function Nn(e){return new Date(`${e}T00:00:00`).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function Pn({series:e,height:t,accent:n,renderTooltip:r,describe:i}){let a=Math.max(1,...e.map(t));return(0,F.jsxs)(je,{delayDuration:150,children:[(0,F.jsx)(`div`,{className:`flex h-20 items-end gap-0.5`,role:`group`,"aria-label":`Daily trend`,children:e.map(e=>{let o=t(e),s=Math.max(o>0?4:0,o/a*100);return(0,F.jsxs)(Me,{children:[(0,F.jsx)(ke,{asChild:!0,children:(0,F.jsx)(`button`,{"data-export-keep":!0,"aria-label":i(e),type:`button`,className:`min-w-0 flex-1 rounded-t-sm transition-opacity hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,style:{height:`100%`,display:`flex`,alignItems:`end`},children:(0,F.jsx)(`span`,{style:{height:`${s}%`},className:`block w-full rounded-t-sm ${n}`})})}),(0,F.jsx)(Ae,{children:r(e)})]},e.date)})}),(0,F.jsxs)(`div`,{className:`mt-1 flex justify-between text-xs text-muted-foreground`,children:[(0,F.jsx)(`span`,{children:Nn(e[0].date)}),(0,F.jsx)(`span`,{children:Nn(e.at(-1).date)})]})]})}function Fn({metrics:e,series:t}){return(0,F.jsxs)(`table`,{className:`w-full text-left text-xs`,children:[(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{className:`border-b`,children:[(0,F.jsx)(`th`,{className:`py-1 pr-2 font-medium`,children:`Date`}),e.map(e=>(0,F.jsx)(`th`,{className:`py-1 pr-2 text-right font-medium`,children:An[e]},e)),(0,F.jsx)(`th`,{className:`py-1 pr-2 text-right font-medium`,children:`Completed`}),(0,F.jsx)(`th`,{className:`py-1 text-right font-medium`,children:`Avg cycle`})]})}),(0,F.jsx)(`tbody`,{children:t.map(t=>(0,F.jsxs)(`tr`,{className:`border-b last:border-0`,children:[(0,F.jsx)(`td`,{className:`py-1 pr-2`,children:Nn(t.date)}),e.map(e=>(0,F.jsx)(`td`,{className:`py-1 pr-2 text-right tabular-nums`,children:Mn(t[kn[e]]?.value,e)},e)),(0,F.jsx)(`td`,{className:`py-1 pr-2 text-right tabular-nums`,children:t.completed}),(0,F.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:t.avgCycleHours===null?`—`:K(t.avgCycleHours)})]},t.date))})]})}function In({metric:e,series:t}){let n=hn[e],r=kn[e],i=t.reduce((e,t)=>e+(t[r]?.reportedTasks??0),0);return(0,F.jsxs)(`div`,{className:`rounded-xl border p-3`,children:[(0,F.jsx)(`p`,{className:`text-xs font-medium ${n.text}`,children:An[e]}),(0,F.jsx)(`div`,{className:`mt-2`,children:(0,F.jsx)(Pn,{series:t,describe:t=>`${t.date}, ${An[e]}: ${Mn(t[r]?.value,e)}, ${t[r]?.reportedTasks??0} of ${t.tasks} tasks reported`,height:e=>e[r]?.value??0,accent:n.fill,renderTooltip:t=>(0,F.jsxs)(`p`,{children:[Nn(t.date),` · `,Mn(t[r]?.value,e),` ·`,` `,t[r]?.reportedTasks??0,`/`,t.tasks,` tasks reported`]})})}),i===0&&(0,F.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`No reports in this period.`})]})}function Ln({series:e}){let t=e.reduce((e,t)=>e+t.completed,0),n=e.reduce((e,t)=>e+(t.avgCycleHours??0)*(t.cycleReportedTasks??t.completed),0),r=e.reduce((e,t)=>e+(t.cycleReportedTasks??t.completed),0),i=r?n/r:null;return(0,F.jsxs)(`div`,{className:`rounded-xl border p-3`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-baseline justify-between gap-2`,children:[(0,F.jsx)(`p`,{className:`text-xs font-medium text-success`,children:`Completed tasks`}),(0,F.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[t,` done · avg cycle`,` `,i===null?`unavailable`:K(i)]})]}),(0,F.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[r,`/`,t,` completed tasks have valid cycle times.`]}),(0,F.jsx)(`div`,{className:`mt-2`,children:(0,F.jsx)(Pn,{series:e,describe:e=>`${e.date}: ${e.completed} completed tasks, average cycle ${e.avgCycleHours==null?`Unavailable`:K(e.avgCycleHours)}`,height:e=>e.completed,accent:`bg-success`,renderTooltip:e=>(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`p`,{children:[Nn(e.date),` · `,e.completed,` completed`]}),(0,F.jsxs)(`p`,{children:[`Avg cycle`,` `,e.avgCycleHours===null?`unavailable`:K(e.avgCycleHours),` · Median`,` `,e.medianCycleHours===null?`unavailable`:K(e.medianCycleHours)]})]})})}),t===0&&(0,F.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`No tasks finished in this period.`})]})}function Rn(){return(0,F.jsx)(zn,{visibility:Ve(a().data)})}function zn({visibility:e}){let[t,n]=yt(`trendPeriod`,[`7d`,`30d`],`7d`),r=pn(t,e.cost?`cost`:`input`,`${e.cost}:${e.tokens}`),i=r.data,a=i&&i.totals.tasks===0&&i.coverage.projects.every(e=>e.state===`complete`)&&i.series.every(e=>e.tasks===0&&e.completed===0),o=jn({cost:e.cost&&i?.visibility.cost!==!1,tokens:e.tokens&&i?.visibility.tokens!==!1});return(0,F.jsxs)(j,{className:`gap-0 py-0`,children:[(0,F.jsxs)(`div`,{className:R,children:[(0,F.jsx)(`h2`,{className:L,children:`Trends`}),(0,F.jsxs)(`label`,{className:nt,children:[`Period`,(0,F.jsxs)(rt,{value:t,onChange:e=>n(e.target.value),children:[(0,F.jsx)(`option`,{value:`7d`,children:`Last 7 days`}),(0,F.jsx)(`option`,{value:`30d`,children:`Last 30 days`})]})]})]}),(0,F.jsxs)(`div`,{className:`space-y-4 p-4 text-sm`,children:[i&&(0,F.jsx)(I,{rows:a?[]:i.series.flatMap(e=>[...o.map(t=>({section:`daily-creation-cohort`,entity:e.date,metric:kn[t],value:e[kn[t]]?.value??null,unit:t===`cost`?`USD`:`tokens`,reportedTasks:e[kn[t]]?.reportedTasks??0,totalTasks:e.tasks,asOf:i.asOf,note:`Lifetime usage grouped by task creation date; not daily spend`})),{section:`daily-completions`,entity:e.date,metric:`completed`,value:e.completed,unit:`tasks`,asOf:i.asOf},{section:`daily-completions`,entity:e.date,metric:`avgCycleHours`,value:e.avgCycleHours,reportedTasks:e.cycleReportedTasks??e.completed,totalTasks:e.completed,unit:`hours`,asOf:i.asOf},{section:`daily-completions`,entity:e.date,metric:`medianCycleHours`,value:e.medianCycleHours,unit:`hours`,asOf:i.asOf}])}),(0,F.jsxs)(`details`,{className:`text-xs text-muted-foreground`,children:[(0,F.jsxs)(`summary`,{"data-export-heading":`Metric definitions`,className:`${tt} py-2`,children:[(0,F.jsx)(z,{}),`How these metrics work`]}),(0,F.jsx)(`p`,{children:`Usage is grouped by creation date, not spending date. Completed tasks are grouped by finish date. Calendar days use your current UTC offset (fixed across the period), including today.`})]}),r.isPending&&(0,F.jsx)(`p`,{children:`Loading trends…`}),r.isError&&(0,F.jsxs)(`p`,{role:`alert`,children:[i?`Showing stale trends. Could not refresh.`:`Could not load trends.`,` `,(0,F.jsx)(A,{className:`min-h-11`,onClick:()=>void r.refetch(),children:`Retry`})]}),i&&(0,F.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,F.jsx)(ot,{at:i.asOf})}),i&&(0,F.jsx)(G,{coverage:i.coverage,retry:()=>void r.refetch()}),i&&a&&(0,F.jsx)(`p`,{className:`text-muted-foreground`,children:`No retained tasks in this period yet.`}),i&&!a&&i.series.length>0&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`space-y-4`,children:[o.length>0&&(0,F.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-[repeat(auto-fit,minmax(200px,1fr))]`,children:o.map(e=>(0,F.jsx)(In,{metric:e,series:i.series},e))}),(0,F.jsx)(Ln,{series:i.series})]}),(0,F.jsxs)(`details`,{className:`group rounded-lg border bg-muted/20 print:block`,children:[(0,F.jsxs)(`summary`,{"data-export-heading":`Daily data`,className:`flex min-h-11 cursor-pointer list-none items-center gap-2 px-3 text-xs font-medium text-muted-foreground hover:text-foreground [&::-webkit-details-marker]:hidden`,children:[(0,F.jsx)(Ze,{className:`size-4`,"aria-hidden":`true`}),` View data table`,(0,F.jsx)(Oe,{className:`ml-auto size-4 transition-transform group-open:rotate-180`,"aria-hidden":`true`})]}),(0,F.jsx)(`div`,{className:`max-h-80 overflow-auto border-t p-3 print:max-h-none print:overflow-visible`,role:`region`,"aria-label":`Daily trend values`,tabIndex:0,children:(0,F.jsx)(Fn,{metrics:o,series:i.series})})]})]})]})]})}function Bn(e,t,n,r=!0){let i=l();return m({queryKey:[...X.snapshot,e?.snapshotId,t,n],enabled:r&&!!e,retry:!1,queryFn:async({signal:r})=>{if(!e)throw Error(`Dashboard not loaded`);let a=[];try{for(let i=0;i<n;){let o=await $t(e.snapshotId,t,i,Math.min(20,n-i),r);if(a.push(...o.page.rows),o.page.nextOffset===null)break;i=o.page.nextOffset}return a}catch(e){if(e instanceof h&&e.status===409){let e=await Qt(r);i.setQueryData(X.snapshot,e)}throw e}}})}function Vn(e,t,n,r){let i=l(),a=t===`questions`||t===`reviews`?`needs-you`:t,o=a===`needs-you`?0:n,s=r.map(e=>`${e.projectId}:${e.id}`).sort();return m({queryKey:[...X.snapshot,e.snapshotId,t,`displaced`,...s],enabled:s.length>0,retry:!1,queryFn:async({signal:t})=>{let n=new Set(s),r=new Map;try{for(let i=o;i!==null&&n.size;){let o=await $t(e.snapshotId,a,i,20,t);for(let e of o.page.rows){let t=`${e.projectId}:${e.id}`;n.delete(t)&&r.set(t,e)}i=o.page.nextOffset}return r}catch(e){throw e instanceof h&&e.status===409&&i.setQueryData(X.snapshot,await Qt(t)),e}}})}function Hn({snapshot:e,questions:t,reviews:n,more:r,healthy:i=!0}){let a=ne();return(0,F.jsxs)(j,{className:`min-w-0 gap-0 overflow-hidden py-0`,children:[(0,F.jsxs)(`div`,{className:R,children:[(0,F.jsxs)(`h2`,{id:`dashboard-needs-you`,tabIndex:-1,className:L,children:[`Needs you · `,e.counts.questions+e.counts.reviews]}),(0,F.jsxs)(`p`,{className:`font-mono text-meta text-soft-foreground`,children:[e.counts.questions,` questions · `,e.counts.reviews,` reviews`]})]}),i&&a.connected&&e.counts.questions+e.counts.reviews===0&&e.coverage.projects.every(e=>e.state===`complete`)?(0,F.jsxs)(`p`,{className:`flex items-center gap-2.5 px-4 py-8 text-sm text-muted-foreground`,children:[(0,F.jsx)(M,{tone:`success`}),`All caught up — no tasks need your input`]}):null,(0,F.jsx)(Un,{snapshot:e,group:`questions`,count:t,more:r}),(0,F.jsx)(Un,{snapshot:e,group:`reviews`,count:n,more:r})]})}function Un({snapshot:e,group:t,count:n,more:r}){let i=e[t],a=Math.max(n,i.rows.length),o=Bn(e,t,a,a>i.rows.length),s=a>i.rows.length?o.data:i.rows,c=ft(s,W,t,n),l=Vn(e,t,a,c.rows.filter(e=>e.removed).map(e=>e.row)),u=(0,P.useRef)(null);return!i.total&&!c.rows.length?null:(0,F.jsxs)(`section`,{children:[(0,F.jsxs)(`h3`,{ref:u,tabIndex:-1,className:`border-b bg-card-2 px-4 py-2 eyebrow text-muted-foreground`,children:[t===`questions`?`Questions`:`Reviews`,` · `,i.total]}),c.updates>0&&(0,F.jsxs)(A,{variant:`ghost`,className:`m-2 min-h-11`,onClick:()=>{c.show(),u.current?.focus()},children:[c.updates,` updates — Show`]}),c.rows.map(({row:e,removed:t})=>(0,F.jsx)(_t,{row:l.data?.get(W(e))??e,removed:t&&!!l.data&&!l.data.has(W(e)),checking:s===void 0||t&&!l.data,checkFailed:s===void 0&&o.isError||t&&!l.data&&l.isError,queue:!0},W(e))),(o.isError||l.isError)&&(0,F.jsxs)(`p`,{role:`alert`,className:`p-4 text-sm`,children:[`Could not check current task state.`,` `,(0,F.jsx)(A,{variant:`ghost`,className:`min-h-11`,onClick:()=>{o.refetch(),l.refetch()},children:`Retry`})]}),a<i.total&&(0,F.jsxs)(A,{variant:`ghost`,className:`m-2 min-h-11`,disabled:o.isFetching,onClick:()=>r(t,a+Math.min(20,i.total-a)),children:[`Show `,Math.min(20,i.total-a),` more `,t]})]})}function Wn(e){if(!e.startsWith(`github:`))return e===`tasks`?`Task results`:e;let t=e.slice(7).split(`:`),n=t.pop()===`pr`?`Pull requests`:`Issues`;return`${t.join(`:`).replace(/^project:/,`Project `).replace(/^github.com\//,``)} · ${n}`}var Gn=e=>e.key;function Kn({filter:e,setFilter:t,count:n,more:r}){let i=rn(e,!0),a=ft(i.data?.rows,Gn,`feed:${e}`,0,e=>e.kind===`task-result`),o=a.rows,s=a.updates,c=(0,P.useContext)(ut),l=(0,P.useRef)(null),u=`feed:${e}`,d=(0,P.useMemo)(()=>({scroll:ht(c,u)?.scroll??0,done:!1}),[c,u]);(0,P.useLayoutEffect)(()=>{!l.current||d.done||(l.current.scrollTop=d.scroll,d.done=Math.abs(l.current.scrollTop-d.scroll)<1||!!i.data&&!i.isPending&&!i.isFetching)},[d,o.length,n,i.data,i.isPending,i.isFetching]);let f=(0,P.useRef)(null),p=i.data?.sources.filter(e=>e.key.startsWith(`github:`))??[],m=p.flatMap(e=>e.fetchedAt?[e.fetchedAt]:[]).sort()[0],h=i.githubError,g=p.filter(e=>e.reason===`No GitHub remote`),_=p.some(e=>e.reason===`Still loading GitHub`),v=p.length>0&&g.length===p.length&&!h,y=p.filter(e=>e.state!==`ready`&&e.reason!==`No GitHub remote`&&e.reason!==`Still loading GitHub`),b=v&&e===`all`;return(0,F.jsxs)(j,{"data-export-context":`Results source: ${e}; Last 7 days; loaded ${Math.min(n,o.length)} rows`,className:`min-w-0 gap-0 overflow-hidden py-0`,children:[(0,F.jsxs)(`div`,{className:`space-y-2 border-b px-4 pt-2.5 pb-2`,children:[(0,F.jsxs)(`div`,{className:`flex min-h-9 flex-wrap items-center justify-between gap-2`,children:[(0,F.jsx)(`h2`,{ref:f,tabIndex:-1,className:L,children:b?`Recent results`:`Recent results & GitHub`}),(0,F.jsx)(`span`,{className:`font-mono text-meta text-soft-foreground`,children:`Last 7 days`})]}),!b&&(0,F.jsx)(Ke,{slot:`dashboard-feed`,label:`Results source`,value:e,options:[{value:`all`,label:`All`},{value:`tasks`,label:`Tasks`},{value:`github`,label:`GitHub`}],onChange:t}),b&&(0,F.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Task results · No GitHub repositories configured`}),e!==`tasks`&&!b&&(0,F.jsxs)(`details`,{className:`text-xs text-muted-foreground`,open:y.length||h?!0:void 0,children:[(0,F.jsxs)(`summary`,{className:`flex w-fit cursor-pointer list-none items-center gap-1.5 rounded-sm text-muted-foreground transition-colors select-none hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 [&::-webkit-details-marker]:hidden py-1.5`,children:[(0,F.jsx)(z,{}),y.length||h?`GitHub needs attention`:_?`Checking GitHub…`:v?`GitHub not configured`:m?`GitHub checked ${N(m)} ago`:`GitHub source`]}),(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-3`,children:[(0,F.jsx)(`p`,{children:y.length||h?m?`Could not refresh GitHub. Showing results from ${new Date(m).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}.`:`Could not load one or more GitHub sources.`:_?`Checking repository sources. Available results remain visible.`:v?`No GitHub repositories configured. Select Tasks to see task results.`:m?`GitHub checked ${N(m)} ago`:`GitHub snapshot`}),!v&&(0,F.jsx)(A,{variant:`ghost`,className:`min-h-11 px-0`,disabled:i.githubFetching,onClick:()=>{i.refetch()},children:i.githubFetching?`Refreshing…`:y.length||h?`Retry GitHub`:`Refresh GitHub`})]})]})]}),(0,F.jsxs)(`div`,{role:`region`,"aria-label":`Recent results list`,ref:l,onWheel:()=>{d.done=!0},onTouchStart:()=>{d.done=!0},onKeyDown:()=>{d.done=!0},onScroll:e=>{c&&d.done&&gt(c,u,{count:n,scroll:e.currentTarget.scrollTop})},tabIndex:0,className:`max-h-80 overflow-y-auto overscroll-contain focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,children:[i.isError&&(0,F.jsxs)(`p`,{role:`alert`,className:`p-4 text-sm`,children:[`Could not load results.`,` `,(0,F.jsx)(A,{className:`min-h-11`,onClick:()=>{i.retryFailed()},children:`Retry`})]}),i.isPending&&(0,F.jsx)(`p`,{className:`p-4 text-sm`,children:`Loading results…`}),s>0&&(0,F.jsxs)(A,{variant:`ghost`,className:`m-2 min-h-11`,onClick:()=>{a.show(),f.current?.focus()},children:[s,` updates — Show`]}),o.slice(0,n).map(({row:e,removed:t})=>e.kind===`task-result`?(0,F.jsx)(_t,{row:e.run,kicker:t?`Outside current results`:`Latest result: ${e.run.status===`failed`?`Failed`:`Completed`}`},e.key):(0,F.jsxs)(`div`,{className:`border-b px-4 py-3 transition-colors hover:bg-muted/30`,children:[(0,F.jsx)(I,{rows:[{section:`github`,entity:`${e.repo}#${e.number}`,metric:e.itemKind,value:e.title,asOf:e.at,note:e.url}]}),(0,F.jsx)(`a`,{className:`block break-words text-sm font-medium hover:underline no-hover:min-h-11`,href:e.url,target:`_blank`,rel:`noreferrer`,children:e.title}),(0,F.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[e.repo,` · `,e.itemKind===`pr`?`PR`:`Issue`,` #`,e.number,` created ·`,` `,N(e.at)]})]},e.key)),i.data&&!i.data.rows.length&&!o.length&&!i.isFetching&&!i.isError&&!y.length&&!_&&i.data.coverage.projects.every(e=>e.state===`complete`)&&(0,F.jsx)(`p`,{className:`px-4 py-8 text-sm text-muted-foreground`,children:`No results in the last 7 days`}),n<o.length&&(0,F.jsxs)(A,{variant:`ghost`,className:`m-2 min-h-11`,onClick:r,children:[`Show `,Math.min(20,o.length-n),` more results`]}),i.data?.truncated&&(0,F.jsx)(`p`,{className:`p-4 text-xs`,children:`Showing the latest 60 results`}),i.data&&(0,F.jsx)(G,{coverage:i.data.coverage,retry:()=>{i.retryTasks()}}),!b&&i.data?.sources.some(e=>e.state!==`ready`||e.truncated)&&(0,F.jsxs)(`details`,{className:`p-4 text-xs`,children:[(0,F.jsxs)(`summary`,{className:`flex w-fit cursor-pointer list-none items-center gap-1.5 rounded-sm text-muted-foreground transition-colors select-none hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 [&::-webkit-details-marker]:hidden min-h-11`,children:[(0,F.jsx)(z,{}),`Source details`]}),i.data.sources.map(e=>(0,F.jsxs)(`p`,{className:`break-words py-1`,children:[Wn(e.key),`:`,` `,e.reason===`No GitHub remote`?`Not configured`:e.reason===`Still loading GitHub`?`Checking…`:e.reason??(e.state===`ready`?`Up to date`:e.state),e.truncated?` · capped`:``,e.fetchedAt?` · checked ${N(e.fetchedAt)}`:``]},e.key))]})]})]})}var $=e=>e.replace(/[&<>"']/g,e=>({"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`})[e]),qn=`Visible modules and loaded rows only. Filters and report availability apply. Retained task usage is not an invoice or a complete history.`,Jn=`Confidential — internal distribution only`,Yn={costUsd:{label:`Reported cost`,usd:!0},inputTokens:{label:`Input tokens`},outputTokens:{label:`Output tokens`},needsYou:{label:`Needs you`},running:{label:`Running now`},completed:{label:`Completed in period`},failed:{label:`Failed outcomes in period`},medianCycleHours:{label:`Median cycle (hours)`}};function Xn(e,t){return e==null?`Unavailable`:typeof e==`string`?e:vt(e,t)}function Zn(e){let t=new Set,n=[];for(let r of e.modules)for(let e of r.rows){if(e.section!==`totals`&&e.section!==`fleet`&&e.section!==`overview`)continue;let i=Yn[e.metric];!i||t.has(e.metric)||(t.add(e.metric),n.push({label:i.label,value:Xn(e.value,i.usd),note:[e.metric===`needsYou`||e.metric===`running`?e.note||`Current non-archived state`:r.filters,e.asOf?`Data as of ${e.asOf}`:``,e.reportedTasks==null?``:`${e.reportedTasks} of ${e.totalTasks} tasks reported`].filter(Boolean).join(` · `)}))}return n}function Qn(e){let t=e.cloneNode(!0);t.querySelectorAll(`script,style,link,img,iframe,object,embed,input,[hidden],[data-dashboard-export],[data-export-exclude]`).forEach(e=>e.remove()),t.querySelectorAll(`select`).forEach((t,n)=>{let r=e.querySelectorAll(`select`)[n];t.replaceWith(document.createTextNode(`: `+(r?.selectedOptions[0]?.textContent??``)))}),t.querySelectorAll(`[data-export-row],[data-dashboard-row]`).forEach(e=>e.classList.add(`report-row`)),t.querySelectorAll(`summary`).forEach(e=>{let t=document.createElement(`h3`);t.textContent=e.getAttribute(`data-export-heading`)||e.textContent,e.replaceWith(t)}),t.querySelectorAll(`button`).forEach(e=>{if(e.hasAttribute(`data-export-keep`)){let t=document.createElement(`div`);for(let n of[...e.attributes])[`class`,`style`,`title`].includes(n.name)&&t.setAttribute(n.name,n.value);t.append(...e.childNodes),e.replaceWith(t)}else e.remove()}),t.querySelectorAll(`details`).forEach(e=>{let t=document.createElement(`div`);t.className=e.className,t.append(...e.childNodes),e.replaceWith(t)});for(let e of[t,...t.querySelectorAll(`*`)])for(let t of[...e.attributes])(t.name.startsWith(`on`)||[`href`,`src`,`srcset`,`action`,`formaction`,`tabindex`].includes(t.name)||t.name.startsWith(`data-`))&&e.removeAttribute(t.name);return t.removeAttribute(`style`),t.innerHTML}function $n(e,t,n,r){return{generatedAt:t,source:n,title:r||void 0,notices:[...e.querySelectorAll(`[role=alert],[role=status]`)].filter(e=>!e.closest(`[data-dashboard-module]`)).map(e=>e.textContent?.trim()??``).filter(Boolean),modules:[...e.querySelectorAll(`[data-dashboard-module]`)].map(e=>{let t=[...e.querySelectorAll(`select`)].map(e=>`${e.closest(`label`)?.childNodes[0]?.textContent?.trim()??`Filter`}: ${e.selectedOptions[0]?.textContent}`).concat([...e.querySelectorAll(`[data-export-context]`)].map(e=>e.dataset.exportContext)).join(`; `),n=[...new Set([...e.querySelectorAll(`p,[role="alert"],[role="status"]`)].filter(e=>!e.closest(`table,[data-export-exclude]`)&&!e.querySelector(`p,[role="alert"],[role="status"]`)).map(e=>{let t=e.cloneNode(!0);return t.querySelectorAll(`table,button,select,summary,[data-export-exclude]`).forEach(e=>e.remove()),t.textContent?.trim()}).filter(Boolean))].join(` | `);return{id:e.dataset.dashboardModule,title:e.querySelector(`h2`)?.textContent??e.dataset.dashboardModule,filters:t,notes:n,html:Qn(e),rows:[...e.querySelectorAll(`[data-dashboard-export]`)].flatMap(e=>JSON.parse(e.dataset.dashboardExport))}})}}function er(e){let t=e==null?``:String(e);return typeof e==`string`&&/^[\s\uFEFF]*[=+@\-]/.test(t)&&(t=`'${t}`),`"${t.replaceAll(`"`,`""`)}"`}function tr(e){let t=[[`generated_at`,`source`,`module`,`filters`,`section`,`entity`,`metric`,`value`,`unit`,`availability`,`reported_tasks`,`total_tasks`,`as_of`,`notes`]];for(let n of e.modules){t.push([e.generatedAt,e.source,n.title,n.filters,`context`,``,`scope`,qn,``,``,``,``,``,[...e.title?[`Report title: ${e.title}`]:[],...e.notices,n.notes].join(` | `)]);for(let r of n.rows)t.push([e.generatedAt,e.source,n.title,n.filters,r.section,r.entity,r.metric,r.value,r.unit,r.value===null?`unavailable`:typeof r.value==`number`?`measured`:`reported`,r.reportedTasks,r.totalTasks,r.asOf,r.note])}return``+t.map(e=>e.map(er).join(`,`)).join(`\r
2
- `)+`\r
3
- `}function nr(e,t){let n=Zn(e);return`<!doctype html><html class="light"><head><meta charset="utf-8"><title>${$(e.title||`Dashboard`)} ${$(e.generatedAt.slice(0,10))}</title>${t.join(``)}<style>
4
- @page {
5
- size:A4; margin:14mm 14mm 18mm;
6
- @bottom-left { content:"${Jn}"; font-family:system-ui,sans-serif; font-size:9px; color:var(--muted-foreground); }
7
- @bottom-right { content:"Page " counter(page) " of " counter(pages); font-family:system-ui,sans-serif; font-size:9px; color:var(--muted-foreground); }
8
- }
9
- html,body { height:auto!important; overflow:visible!important; background:var(--background)!important; color:var(--foreground)!important; }
10
- * { -webkit-print-color-adjust:exact; print-color-adjust:exact; }
11
- body { margin:0; font:12px/1.5 system-ui,sans-serif; }
12
- .report-heading { border-bottom:2px solid var(--violet); padding-bottom:16px; margin-bottom:20px; }
13
- .report-heading h1 { font-size:26px; margin:0 0 8px; }
14
- .report-heading p { margin:4px 0; color:var(--muted-foreground); }
15
- .report-confidential { display:inline-block; margin:6px 0; padding:2px 8px; border:1px solid var(--destructive); border-radius:4px; color:var(--destructive); font-size:11px; font-weight:600; letter-spacing:.03em; text-transform:uppercase; }
16
- .report-summary { margin:0 0 24px; }
17
- .report-summary h2 { font-size:12px; margin:0 0 10px; text-transform:uppercase; letter-spacing:.04em; color:var(--muted-foreground); }
18
- .summary-grid { display:flex; flex-wrap:wrap; gap:12px; }
19
- .summary-tile { flex:1 1 140px; border:1px solid var(--border); border-radius:8px; padding:12px 14px; break-inside:avoid; }
20
- .summary-value { display:block; font-size:22px; font-weight:600; }
21
- .summary-label { display:block; font-size:11px; color:var(--muted-foreground); margin-top:2px; }
22
- .summary-note { display:block; font-size:10px; color:var(--soft-foreground); margin-top:4px; }
23
- .report-module { margin:0 0 20px; break-before:auto; }
24
- .report-module h2,.report-module h3 { break-after:avoid; }
25
- .report-module-usage, .report-module-fleet { break-inside:avoid; }
26
- .report-module-usage label { min-height:0!important; }
27
- .report-module-usage .space-y-4 > :not(:last-child) { margin-block-end:8px!important; }
28
- .report-module-usage .report-row { padding-top:5px!important; padding-bottom:5px!important; }
29
- .report-cost-metrics { grid-template-columns:repeat(3,minmax(0,1fr))!important; }
30
- .report-cost-metrics > div { padding:12px!important; break-inside:avoid; }
31
- .report-cost-metrics .text-3xl { font-size:22px!important; }
32
- .report-module > :first-child, .report-module header, .report-context { break-after:avoid; }
33
- .report-module .report-row, .report-module tr { break-inside:avoid; }
34
- .report-module thead { display:table-header-group; }
35
- .report-module .report-row { padding-top:8px!important; padding-bottom:8px!important; }
36
- .report-module a { min-height:0!important; }
37
- .report-module > div { padding-top:12px!important; padding-bottom:12px!important; }
38
- .report-module * { overflow:visible !important; max-height: none !important; animation:none!important; transition:none!important; box-shadow:none!important; }
39
- .report-module a { color:inherit; text-decoration:none; }
40
- .report-module svg { max-width:24px; }
41
- .report-module [role=region] > div, .report-module [role=region] > p { break-inside:avoid; }
42
- .report-module .sr-only { display:none!important; }
43
- .report-context { font-size:11px; color:var(--muted-foreground); margin:0 0 8px; }
44
- </style></head><body><header class="report-heading"><h1>${$(e.title||`Dashboard report`)}</h1><p>${$(e.generatedAt)} · ${$(e.source)}</p><span class="report-confidential">${Jn}</span><p>${$(qn)}</p>${e.notices.map(e=>`<p>${$(e)}</p>`).join(``)}</header>${n.length?`<section class="report-summary"><h2>Executive summary</h2><div class="summary-grid">${n.map(e=>`<div class="summary-tile"><span class="summary-value">${$(e.value)}</span><span class="summary-label">${$(e.label)}</span>${e.note?`<span class="summary-note">${$(e.note)}</span>`:``}</div>`).join(``)}</div></section>`:``}${e.modules.map(e=>`<section class="report-module${e.id===`usage`?` report-module-usage`:e.id===`fleet`?` report-module-fleet`:``}"><p class="report-context">${$(e.filters)}</p>${e.html}</section>`).join(``)}</body></html>`}function rr({dashboard:e}){let[t,n]=(0,P.useState)(!1),[r,i]=(0,P.useState)(``),[a,o]=(0,P.useState)(!1),[s,c]=(0,P.useState)(``),l=t=>{i(``);try{if(!e.current)return;let r=$n(e.current,new Date().toISOString(),location.origin,s.trim());if(!r.modules.length){i(`Show at least one dashboard module before exporting.`);return}if(t===`csv`){let e=URL.createObjectURL(new Blob([tr(r)],{type:`text/csv;charset=utf-8`})),t=document.createElement(`a`);t.href=e,t.download=`dashboard-${r.generatedAt.replaceAll(`:`,`-`)}.csv`,document.body.append(t),t.click(),t.remove(),setTimeout(()=>URL.revokeObjectURL(e),1e3),n(!1)}else{o(!0);let e=[...document.querySelectorAll(`link[rel="stylesheet"],style`)].flatMap(e=>{if(e.tagName===`STYLE`)return[e.outerHTML];let t=e.href;if(new URL(t).origin!==location.origin)return[];let n=document.createElement(`link`);return n.rel=`stylesheet`,n.href=t,[n.outerHTML]}),t=document.createElement(`iframe`);t.title=`Dashboard PDF report`,t.style.cssText=`position:fixed;width:1000px;height:1px;bottom:0;left:0;border:0;opacity:0;pointer-events:none`;let a,s=()=>{clearTimeout(a),t.remove(),o(!1)};t.onload=async()=>{try{let e=t.contentWindow;await e.document.fonts.ready,e.addEventListener(`afterprint`,s,{once:!0}),e.focus(),e.print(),n(!1),o(!1)}catch{s(),i(`Could not open the print dialog. Please try again.`)}},a=setTimeout(s,12e4),t.srcdoc=nr(r,e),document.body.append(t)}}catch{o(!1),i(`Could not prepare the export. Please try again.`)}};return(0,F.jsxs)(Re,{open:t,onOpenChange:n,children:[(0,F.jsx)(Ie,{asChild:!0,children:(0,F.jsxs)(A,{variant:`outline`,className:`min-h-11`,disabled:a,children:[(0,F.jsx)(Fe,{className:`size-4`}),a?`Preparing report…`:`Export`]})}),(0,F.jsxs)(Le,{align:`end`,className:`max-w-[calc(100vw-2rem)] space-y-3`,children:[(0,F.jsx)(`p`,{className:`text-sm font-medium`,children:`Export current dashboard`}),(0,F.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Visible modules, current filters and loaded rows. Hidden metrics are excluded.`}),(0,F.jsxs)(`label`,{className:`block space-y-1 text-xs text-muted-foreground`,children:[`Report title (optional)`,(0,F.jsx)(`input`,{className:`min-h-11 w-full rounded-md border bg-background px-3 text-sm text-foreground`,placeholder:`e.g. Fleet review for leadership`,value:s,onChange:e=>c(e.target.value)})]}),(0,F.jsx)(A,{className:`min-h-11 w-full`,onClick:()=>l(`pdf`),children:`PDF report…`}),(0,F.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Choose Save as PDF in the print dialog.`}),(0,F.jsx)(A,{variant:`outline`,className:`min-h-11 w-full`,onClick:()=>l(`csv`),children:`Download CSV`}),r&&(0,F.jsx)(`p`,{role:`alert`,className:`text-sm`,children:r})]})]})}var ir={overview:`Workspace overview`,portfolio:`Projects`,automations:`Automations`,fleet:`Queue & scheduling`,needsYou:`Needs you`,recent:`Recent results & GitHub`,usage:`Usage & cost`,trends:`Trends`};function ar({id:e,children:t,wide:n}){let{attributes:r,listeners:i,setNodeRef:a,setActivatorNodeRef:o,transform:s,isDragging:c}=D({id:e});return(0,F.jsxs)(`section`,{ref:a,"data-dashboard-module":e,className:`group/module relative min-w-0 ${n?`lg:col-span-2`:``} ${c?`z-20 opacity-80`:``}`,style:{transform:s?`translate3d(${s.x}px, ${s.y}px, 0)`:void 0},children:[(0,F.jsx)(A,{ref:o,variant:`ghost`,className:`absolute -top-[22px] left-1/2 z-10 min-h-11 min-w-11 -translate-x-1/2 cursor-grab touch-none p-0 opacity-0 transition-opacity hover:bg-transparent focus-visible:opacity-100 active:cursor-grabbing group-hover/module:opacity-100 no-hover:opacity-100`,...r,...i,"aria-label":`Move ${ir[e]}`,children:(0,F.jsx)(`span`,{className:`flex h-4 w-8 items-center justify-center rounded-full border bg-card text-muted-foreground shadow-xs`,children:(0,F.jsx)(Xe,{className:`size-3.5`,"aria-hidden":`true`})})}),t]})}function or({order:e,modules:t,onOrder:n}){let r=k(O(le,{activationConstraint:{distance:8}}),O(ae,{coordinateGetter:se})),i=e.filter(e=>t[e]),a=new Set([`overview`,`portfolio`,`usage`,`trends`]),o;for(let e of i)a.has(e)?(o&&a.add(o),o=void 0):o=o?void 0:e;o&&a.add(o);let s=e=>`${ir[e]}, position ${i.indexOf(e)+1} of ${i.length}`;return(0,F.jsx)(pe,{sensors:r,collisionDetection:he,accessibility:{announcements:{onDragStart:({active:e})=>`Picked up ${s(e.id)}.`,onDragOver:({active:e,over:t})=>t?`${ir[e.id]} moved to position ${i.indexOf(t.id)+1} of ${i.length}.`:void 0,onDragEnd:({active:e,over:t})=>t?`${ir[e.id]} dropped at position ${i.indexOf(t.id)+1} of ${i.length}.`:`Order unchanged. ${s(e.id)}.`,onDragCancel:({active:e})=>`Reordering cancelled. ${s(e.id)}.`},screenReaderInstructions:{draggable:`Press Space to pick up a module, use arrow keys to move, Space to drop, or Escape to cancel.`}},onDragEnd:({active:t,over:r})=>{!r||t.id===r.id||n(de(e,e.indexOf(t.id),e.indexOf(r.id)))},children:(0,F.jsx)(me,{items:i,strategy:fe,children:(0,F.jsx)(`div`,{className:`grid items-start gap-5 lg:grid-cols-2`,children:i.map(e=>(0,F.jsx)(ar,{id:e,wide:a.has(e),children:t[e]},e))})})})}var sr=[`overview`,`needsYou`,`recent`,`fleet`,`automations`,`portfolio`,`usage`,`trends`],cr=e=>sr.includes(e);function lr(e=[]){let t=e.filter(cr);return(e=>t.length===e.length&&t.every((t,n)=>t===e[n]))(sr.filter(e=>e!==`automations`))?[...sr]:[...new Set([...t.includes(`overview`)?[]:[`overview`],...t,...sr])]}function ur(e=[],t){let n=0;return[...e.map(e=>cr(e)?t[n++]:e),...t.slice(n)]}function dr(){let e=p(),t=l(),[n,r]=(0,P.useState)(),[i,a]=(0,P.useState)(!1),o=(0,P.useRef)(void 0),c=(0,P.useRef)(!1),u=y.parse(e.data?.dashboard??{}),m=(0,P.useRef)(u);m.current=u;let h=n?.tiles??{automations:u.tiles?.automations??!0,fleet:u.tiles?.fleet??!0,needsYou:u.tiles?.needsYou??!0,recent:u.tiles?.recent??!0,usage:u.tiles?.usage??!0,trends:u.tiles?.trends??!0},g=lr(n?.order??u.order),_=(0,P.useRef)({tiles:h,order:g});_.current=n??{tiles:h,order:g};let v=e=>{let t={..._.current,...e};_.current=t,r(t),o.current=t},b=async()=>{if(!(c.current||!o.current)){for(c.current=!0;o.current;){let n=o.current;o.current=void 0;try{e.data||(m.current=y.parse((await d()).dashboard??{}));let i=await s({dashboard:{...m.current,order:ur(m.current.order,n.order),tiles:{...m.current?.tiles,...n.tiles}}});t.setQueryData(f.uiState,i),m.current=y.parse(i.dashboard??{}),a(!1),r(e=>e===n?void 0:e)}catch{a(!0),o.current||=n;break}}c.current=!1}},x=(0,P.useRef)(b);return x.current=b,(0,P.useEffect)(()=>()=>{x.current()},[]),(0,P.useEffect)(()=>{if(!n)return;let e=setTimeout(()=>{b()},250);return()=>clearTimeout(e)},[n]),{tiles:h,order:g,setOrder:e=>v({order:lr(e)}),failed:i,ready:e.data!==void 0||e.isError,setTiles(e){v({tiles:e})},retry:()=>{b()}}}function fr(e,t){let n=sr.filter(e=>t.includes(e)),r=0;return e.map(e=>t.includes(e)?n[r++]:e)}var pr=[[`overview`,`Overview`],[`costs`,`Usage & cost`],[`automations`,`Automations`]];function mr(){let e=ee(),t=e.state?.dashboardEntry??e.key;return(0,F.jsx)(hr,{entryKey:t},t)}function hr({entryKey:e}){let t=ee(),[n,r]=te(),i=(0,P.useRef)(pt(e)).current,[a,o]=(0,P.useState)(i?.questions??0),[s,c]=(0,P.useState)(i?.reviews??0),[l,u]=(0,P.useState)(i?.feed??6),d=(0,P.useRef)(null),f=(0,P.useRef)(null),[p,m]=(0,P.useState)(!1),h=dr(),[g,_]=(0,P.useState)(!1),v=n.get(`view`)===`costs`?`costs`:n.get(`view`)===`automations`?`automations`:`overview`,y=pr.find(([e])=>e===v)[1],b=v===`costs`?[`usage`,`trends`]:v===`automations`?[`automations`]:[`fleet`,`needsYou`,`recent`],x=v===`overview`?[`overview`,`portfolio`,...b]:[...b],S=fr(h.order,x),C=()=>h.setTiles({...h.tiles,...Object.fromEntries(b.map(e=>[e,!0]))}),w=h.tiles,E={...w,automations:v===`automations`&&w.automations,fleet:v===`overview`&&w.fleet,needsYou:v===`overview`&&w.needsYou,recent:v===`overview`&&w.recent,usage:v===`costs`&&w.usage,trends:v===`costs`&&w.trends},re=n.get(`feed`)===`tasks`?`tasks`:n.get(`feed`)===`github`?`github`:`all`,ie=n.get(`panel`),D=ie&&[`running`,`queued`,`scheduled`,`needs-you`].includes(ie)?ie:null,ae=E.fleet||E.needsYou||E.recent&&re!==`github`||!!D,O=en(h.ready&&ae),k=ne();tn(h.ready&&E.fleet&&g);let oe=(0,P.useRef)({questions:a,reviews:s,feed:l,scroll:i?.scroll??0,focus:i?.focus});oe.current={...oe.current,questions:a,reviews:s,feed:l},(0,P.useEffect)(()=>{let t=d.current?.closest(`main`)??d.current,n=()=>{oe.current.scroll=t?.scrollTop??0},r=()=>{oe.current.focus=document.activeElement?.closest(`[data-dashboard-row]`)?.getAttribute(`data-dashboard-row`)??void 0};return t?.addEventListener(`scroll`,n),document.addEventListener(`focusin`,r),()=>{mt(e,oe.current),t?.removeEventListener(`scroll`,n),document.removeEventListener(`focusin`,r)}},[e]);let se=(0,P.useRef)(!1),ce=h.ready&&(!ae||!!O.data&&!O.isFetching);(0,P.useEffect)(()=>{if(!i||se.current||!ce)return;let e=!1,t=()=>{if(e)return!0;let t=d.current?.closest(`main`)??d.current;t&&(t.scrollTop=i.scroll);let n=!!t&&Math.abs(t.scrollTop-i.scroll)<1;if(!i.focus)return n;let r=document.querySelector(`[data-dashboard-row="${CSS.escape(i.focus)}"] a`);return r?(r.focus({preventScroll:!0}),n):(document.getElementById(`dashboard-needs-you`)?.focus({preventScroll:!0}),!1)},n=()=>{t()&&o()},r=new MutationObserver(n),a=typeof ResizeObserver>`u`?null:new ResizeObserver(n),o=()=>{e=!0,se.current=!0,r.disconnect(),a?.disconnect()},s=requestAnimationFrame(()=>{n(),e||(r.observe(document.body,{childList:!0,subtree:!0}),d.current&&a?.observe(d.current))}),c=setTimeout(o,5e3),l=[`pointerdown`,`keydown`,`wheel`,`touchstart`];for(let e of l)document.addEventListener(e,o,{once:!0});return()=>{cancelAnimationFrame(s),clearTimeout(c),e=!0,r.disconnect(),a?.disconnect();for(let e of l)document.removeEventListener(e,o)}},[i,ce]);let le=i=>{let a=new URLSearchParams(n);i?a.set(`panel`,i):a.delete(`panel`),r(a,{replace:!0,state:{...t.state,dashboardEntry:e}})},de=(e,t)=>{f.current=t,le(e)},fe=O.data?O.data.counts.questions+O.data.counts.reviews:0;return(0,F.jsx)(ut.Provider,{value:e,children:(0,F.jsx)(dt.Provider,{value:!i||!O.isFetching&&!O.isError,children:(0,F.jsxs)(`div`,{ref:d,"data-route":`dashboard`,className:`mx-auto w-full max-w-[1440px] space-y-6 p-4 md:px-8 md:py-7`,children:[(0,F.jsxs)(`header`,{className:`flex flex-wrap items-end justify-between gap-4`,children:[(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:`Dashboard`}),(0,F.jsxs)(`p`,{className:`mt-1 flex flex-wrap items-center gap-x-2 text-xs text-muted-foreground`,children:[`Across your workspace · Includes subtasks`,(0,F.jsxs)(`span`,{"data-export-exclude":!0,className:`inline-flex items-center gap-1.5 rounded-full border px-2 py-0.5 eyebrow`,children:[(0,F.jsx)(M,{tone:k.connected?`success`:`neutral`,pulse:k.connected}),k.connected?`Live`:`Offline`]})]})]}),(0,F.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,F.jsx)(rr,{dashboard:d}),(0,F.jsxs)(Re,{open:p,onOpenChange:m,children:[(0,F.jsx)(Ie,{asChild:!0,children:(0,F.jsxs)(A,{variant:`outline`,className:`min-h-11`,children:[(0,F.jsx)(Ue,{className:`size-4`}),`Customize`]})}),(0,F.jsxs)(Le,{align:`end`,className:`max-h-[min(32rem,80dvh)] max-w-[calc(100vw-2rem)] overflow-y-auto`,children:[(0,F.jsx)(`p`,{className:`mb-3 text-sm font-medium`,children:`Optional modules in this view`}),b.map(e=>(0,F.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:w[e],disabled:!h.ready,onChange:t=>h.setTiles({...w,[e]:t.target.checked})}),{automations:`Automations`,fleet:`Queue & scheduling`,needsYou:`Needs you`,recent:`Recent results & GitHub`,usage:`Usage & cost`,trends:`Trends`}[e]]},e)),(0,F.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`Drag a module by its handle. With keyboard: Space, arrow keys, Space. Escape cancels.`}),h.order.some((e,t)=>e!==S[t])&&(0,F.jsxs)(A,{variant:`ghost`,className:`min-h-11`,onClick:()=>h.setOrder(S),children:[`Reset `,y,` order`]}),(0,F.jsx)(`p`,{className:`my-3 text-xs text-muted-foreground`,children:`Shared across browsers using this workspace`}),b.some(e=>!w[e])&&(0,F.jsxs)(A,{variant:`outline`,className:`min-h-11`,disabled:!h.ready,onClick:()=>{C(),m(!1)},children:[`Show all in `,y]})]})]})]})]}),(0,F.jsx)(`nav`,{"aria-label":`Dashboard views`,className:`-mt-2 flex flex-wrap gap-5 border-b`,children:pr.map(([r,i])=>{let a=new URLSearchParams(n);return a.set(`view`,r),a.delete(`panel`),(0,F.jsx)(A,{asChild:!0,variant:`ghost`,className:`-mb-px min-h-11 rounded-none border-b-2 px-0.5 hover:bg-transparent ${v===r?`border-primary text-foreground`:`border-transparent`}`,children:(0,F.jsx)(T,{"aria-current":v===r?`page`:void 0,to:`?${a}`,replace:v===r,state:{...t.state,dashboardEntry:v===r?e:void 0},children:i})},r)})}),h.failed&&(0,F.jsxs)(`p`,{role:`alert`,className:`text-sm`,children:[`Layout changed for this session, but could not be saved.`,` `,(0,F.jsx)(A,{variant:`ghost`,className:`min-h-11`,onClick:h.retry,children:`Retry saving`})]}),ae&&!k.connected&&O.data&&(0,F.jsxs)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:[`Tasks disconnected · Last updated `,N(O.data.asOf),` ago`]}),ae&&O.isError&&(0,F.jsxs)(`p`,{role:`alert`,className:`rounded-md border p-4 text-sm`,children:[`Could not refresh dashboard.`,` `,O.data?`Showing the last available task state.`:``,` `,(0,F.jsx)(A,{className:`min-h-11`,onClick:()=>{O.refetch()},children:`Retry`})]}),v===`costs`&&!Object.values(E).some(Boolean)?(0,F.jsxs)(`p`,{role:`status`,className:`flex flex-wrap items-center gap-2 text-sm text-muted-foreground`,children:[(0,F.jsx)(ue,{className:`size-4`,"aria-hidden":`true`}),`Optional modules in this view are hidden.`,(0,F.jsxs)(A,{variant:`outline`,className:`min-h-11`,onClick:()=>C(),children:[`Show all in `,y]})]}):null,O.isPending&&(E.fleet||E.needsYou)&&(0,F.jsx)(`p`,{className:`text-sm`,children:`Loading dashboard…`}),ae&&O.data&&(0,F.jsx)(G,{coverage:O.data.coverage,count:fe,retry:()=>void O.refetch()}),v===`automations`&&(0,F.jsx)(Lt,{}),(0,F.jsx)(Jt,{active:v===`overview`,onCurrent:de,children:i=>h.ready&&(0,F.jsx)(or,{order:h.order,onOrder:h.setOrder,modules:{...i,automations:E.automations?(0,F.jsx)(st,{}):null,fleet:E.fleet&&O.data?(0,F.jsxs)(j,{className:`gap-0 py-0`,children:[(0,F.jsx)(I,{rows:Object.entries({queued:O.data.counts.queued,scheduled:O.data.counts.scheduled,monitoring:O.data.counts.monitoring}).map(([e,t])=>({section:`fleet`,metric:e,value:t,unit:`tasks`,asOf:O.data.asOf}))}),(0,F.jsxs)(`div`,{className:`flex min-h-12 flex-wrap items-center justify-between gap-x-3 gap-y-2 border-b px-4 py-2.5`,children:[(0,F.jsx)(`h2`,{className:`section-mark eyebrow text-muted-foreground`,children:`Queue & scheduling`}),(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,F.jsx)(M,{tone:k.connected?`success`:`neutral`}),k.connected?`Tasks connected`:`Tasks disconnected`]})]}),(0,F.jsx)(`div`,{className:`grid grid-cols-2 divide-x`,children:[[`queued`,`Queued`,O.data.counts.queued],[`scheduled`,`Scheduled`,O.data.counts.scheduled]].map(([e,t,n])=>(0,F.jsxs)(`button`,{"data-export-keep":!0,"aria-label":`${t}: ${n}`,className:`min-h-24 p-4 text-left transition-colors hover:bg-muted/40 focus-visible:outline-ring`,onClick:t=>de(e,t.currentTarget),children:[(0,F.jsx)(`span`,{className:`block eyebrow text-muted-foreground`,children:t}),(0,F.jsx)(`span`,{className:`mt-3 block text-3xl font-semibold leading-none tracking-tight tabular-nums`,children:n})]},e))}),(0,F.jsxs)(`details`,{open:g,onToggle:e=>_(e.currentTarget.open),className:`border-t px-4 py-3 text-xs text-muted-foreground`,children:[(0,F.jsxs)(`summary`,{className:`flex w-fit cursor-pointer list-none items-center gap-1.5 rounded-sm text-muted-foreground transition-colors select-none hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 [&::-webkit-details-marker]:hidden py-2`,children:[(0,F.jsx)(z,{}),`Technical details`]}),(0,F.jsxs)(`div`,{className:`flex flex-wrap gap-x-5 gap-y-2`,children:[(0,F.jsxs)(`span`,{children:[O.data.counts.monitoring,` monitoring (included in Running)`]}),(0,F.jsx)(`span`,{children:`Agent processes`}),g&&(0,F.jsx)(gr,{running:O.data.counts.running})]})]})]}):null,needsYou:E.needsYou&&O.data?(0,F.jsx)(Hn,{healthy:!O.isError,snapshot:O.data,questions:a,reviews:s,more:(e,t)=>e===`questions`?o(t):c(t)}):null,recent:E.recent?(0,F.jsx)(Kn,{filter:re,setFilter:i=>{let a=new URLSearchParams(n);a.set(`feed`,i||`all`),r(a,{replace:!0,state:{...t.state,dashboardEntry:e}}),u(6)},count:l,more:()=>u(e=>Math.min(60,e+20))}):null,usage:E.usage?(0,F.jsx)(Sn,{}):null,trends:E.trends?(0,F.jsx)(Rn,{}):null}})}),v===`costs`&&(0,F.jsx)(Ft,{}),(0,F.jsx)(be,{open:!!D,onOpenChange:e=>{e||le(null)},children:(0,F.jsxs)(ye,{className:`w-full overflow-y-auto sm:max-w-lg`,onCloseAutoFocus:e=>{e.preventDefault(),f.current?.focus()},children:[(0,F.jsxs)(ge,{children:[(0,F.jsxs)(ve,{children:[D===`needs-you`?`Needs you`:D?D[0].toUpperCase()+D.slice(1):`Tasks`,O.data&&D?` · ${D===`needs-you`?fe:O.data.counts[D]}`:``]}),(0,F.jsx)(_e,{children:`Includes subtasks. Open a task to continue in its project.`})]}),!O.data&&O.isPending&&(0,F.jsx)(`p`,{className:`p-4`,role:`status`,children:`Loading tasks…`}),!O.data&&O.isError&&(0,F.jsxs)(`p`,{className:`p-4`,role:`alert`,children:[`Could not load tasks.`,` `,(0,F.jsx)(A,{className:`min-h-11`,onClick:()=>{O.refetch()},children:`Retry`})]}),D&&O.data&&(0,F.jsx)(_r,{snapshot:O.data,group:D},D)]})})]})})})}function gr({running:e}){let{connected:t,samples:n}=ne(),r=t?n:[],i=r.filter(e=>e.cpuPct!==null);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(I,{rows:[{section:`telemetry`,metric:`cpuPct`,value:i.length?i.reduce((e,t)=>e+(t.cpuPct??0),0):null,unit:`%`,reportedTasks:i.length,totalTasks:e,note:`Sum of sampled processes; may exceed 100%`},{section:`telemetry`,metric:`rssBytes`,value:r.length?r.reduce((e,t)=>e+t.rssBytes,0):null,unit:`bytes`,reportedTasks:r.length,totalTasks:e}]}),(0,F.jsxs)(`span`,{children:[`CPU`,` `,i.length?`${Math.round(i.reduce((e,t)=>e+(t.cpuPct??0),0))}%`:`unavailable`,` `,`· `,i.length,`/`,e,` measured`]}),(0,F.jsxs)(`span`,{children:[`RSS`,` `,r.length?`${(r.reduce((e,t)=>e+t.rssBytes,0)/1024**3).toFixed(1)} GiB`:`unavailable`,` `,`· `,r.length,`/`,e,` measured`]}),(0,F.jsx)(`span`,{children:`RSS sums process resident memory; CPU may exceed 100%.`})]})}function _r({snapshot:e,group:t}){let n=(0,P.useContext)(ut),r=(0,P.useRef)(ht(n,t)).current,[i,a]=(0,P.useState)(r?.count??20),o=(0,P.useRef)(null),s=(0,P.useRef)({count:i,scroll:r?.scroll??0});s.current.count=i,(0,P.useEffect)(()=>{let e=o.current?.closest(`[data-slot="sheet-content"]`),r=()=>{s.current.scroll=e?.scrollTop??0};return e?.addEventListener(`scroll`,r),()=>{gt(n,t,s.current),e?.removeEventListener(`scroll`,r)}},[n,t]);let c=Bn(e,t,i),l=ft(c.data,W,`panel:${t}`,i),u=Vn(e,t,i,l.rows.filter(e=>e.removed).map(e=>e.row)),d=(0,P.useRef)(null),f=(0,P.useRef)(!1);(0,P.useEffect)(()=>{if(!c.data||!r||f.current)return;f.current=!0;let e=o.current?.closest(`[data-slot="sheet-content"]`);e&&(e.scrollTop=r.scroll)},[c.data,r]);let p=t===`needs-you`?e.counts.questions+e.counts.reviews:e.counts[t];return(0,F.jsxs)(`div`,{ref:o,children:[(0,F.jsx)(`h3`,{ref:d,tabIndex:-1,className:`sr-only`,children:`Tasks`}),c.isPending&&(0,F.jsx)(`p`,{className:`p-4`,children:`Loading tasks…`}),(c.isError||u.isError)&&(0,F.jsxs)(`p`,{className:`p-4`,role:`alert`,children:[`Could not check current task state.`,` `,(0,F.jsx)(A,{className:`min-h-11`,onClick:()=>{c.refetch(),u.refetch()},children:`Retry`})]}),l.updates>0&&(0,F.jsxs)(A,{className:`m-4 min-h-11`,onClick:()=>{l.show(),d.current?.focus()},children:[l.updates,` updates — Show`]}),l.rows.map(({row:e,removed:n})=>(0,F.jsx)(_t,{row:u.data?.get(W(e))??e,removed:n&&!!u.data&&!u.data.has(W(e)),checking:!c.data||n&&!u.data,checkFailed:!c.data&&c.isError||n&&!u.data&&u.isError,queue:t===`needs-you`},W(e))),i<p&&(0,F.jsxs)(A,{className:`m-4 min-h-11`,disabled:c.isFetching,onClick:()=>a(e=>e+20),children:[`Show `,Math.min(20,p-i),` more tasks`]})]})}export{mr as DashboardRoute};
@@ -1,3 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diff-view-Ckaab4uQ.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-runtime-CCIEwYL0.js","assets/utils-Df_1kJEk.js","assets/bundle-mjs-rHxsej31.js","assets/button-BrxohNcK.js","assets/chevron-right-C3fLn_fF.js","assets/pencil-DWtoOm2f.js","assets/plus-BPopgSYQ.js","assets/use-submit-shortcut-BJ10ZshV.js","assets/lib-D2__YoPr.js","assets/chunk-BO2N2NFS-Bde6epwZ.js","assets/preload-helper-Czpn1I53.js","assets/lib-BxQXEXDF.js","assets/markdown-rDA5iFAU.js","assets/alert-dialog-BZkKvKiu.js","assets/markdown-Di8pirEb.js","assets/message-square-CstvkIHe.js","assets/scroll-within-D3mqUngk.js","assets/zoomable-image-CW-pQ6ZO.js","assets/types-BTlmexWF.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{t as r}from"./utils-Df_1kJEk.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{n as a}from"./lib-D2__YoPr.js";import{i as o,n as s,r as c,t as l}from"./scroll-within-D3mqUngk.js";var u=e(t(),1),d=n(),f=null,p=null;function m(){return p??=i(()=>import(`./diff-view-Ckaab4uQ.js`).then(e=>f={View:e.DiffView},()=>(p=null,`failed`)),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20])),p}function h(e){let[t,n]=(0,u.useState)(f);return(0,u.useEffect)(()=>{if(f)return;let e=!1;return m().then(t=>{e||n(t)}),()=>{e=!0}},[]),e.files.length===0?(0,d.jsx)(`p`,{"data-slot":`diff-empty`,className:r(`px-1 text-xs text-soft-foreground`,e.className),children:`No changes.`}):t===`failed`?(0,d.jsx)(g,{...e}):t===null?(0,d.jsx)(`p`,{"data-slot":`diff-loading`,className:r(`px-1 text-xs text-soft-foreground`,e.className),children:`Loading diff…`}):(0,d.jsx)(t.View,{...e})}function g({files:e,wrap:t=!1,imageSrc:n,oldImageSrc:i,onOpenInApp:o,viewRef:c,className:f}){let p={adds:e.reduce((e,t)=>e+t.adds,0),dels:e.reduce((e,t)=>e+t.dels,0),files:e.length},m=(0,u.useRef)(null);return(0,u.useImperativeHandle)(c,()=>({scrollToPath:e=>{for(let t of m.current?.querySelectorAll(`[data-slot="diff-file"]`)??[])if(t.dataset.path===e){let e=l(t);e&&s(e,t,Number.parseFloat(getComputedStyle(t).scrollMarginTop)||0);return}}})),(0,d.jsxs)(`div`,{ref:m,"data-slot":`diff`,"data-fallback":`true`,className:r(`flex min-w-0 flex-col gap-3`,f),children:[(0,d.jsxs)(`p`,{"data-slot":`diff-totals`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,d.jsxs)(`span`,{children:[p.files,` `,p.files===1?`file`:`files`,` changed`]}),(0,d.jsx)(a,{stat:p})]}),e.map(e=>(0,d.jsx)(_,{file:e,wrap:t,imageSrc:n,onOpenInApp:o,oldImageSrc:i},`${e.oldPath??``}→${e.path}`))]})}function _({file:e,wrap:t,imageSrc:n,onOpenInApp:i,oldImageSrc:s}){return(0,d.jsxs)(`section`,{"data-slot":`diff-file`,"data-path":e.path,className:`min-w-0 scroll-mt-[var(--diff-sticky-top,0px)] overflow-clip rounded-md border border-border bg-card`,children:[(0,d.jsxs)(`header`,{className:`flex items-center gap-2 border-b border-border/50 px-3 py-2`,children:[(0,d.jsx)(`span`,{"data-slot":`diff-file-path`,className:`min-w-0 truncate font-mono text-xs font-medium`,children:e.oldPath?`${e.oldPath} → ${e.path}`:e.path}),(0,d.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,d.jsx)(a,{stat:{adds:e.adds,dels:e.dels,files:1},className:`text-meta`})})]}),o(e)?(0,d.jsx)(c,{file:e,imageSrc:n,oldImageSrc:s,onOpenInApp:i}):e.binary?(0,d.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`Binary file — no text diff.`}):e.patch===``?(0,d.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`No content changes (metadata only).`}):(0,d.jsx)(`pre`,{className:r(`py-2 font-mono text-xs leading-[1.7]`,t?`break-words whitespace-pre-wrap`:`overflow-x-auto whitespace-pre`),children:e.patch.split(`
3
- `).map((e,t)=>(0,d.jsxs)(`span`,{className:r(`block px-4`,e.startsWith(`+`)&&!e.startsWith(`+++`)&&`bg-diff-add`,e.startsWith(`-`)&&!e.startsWith(`---`)&&`bg-diff-del`,e.startsWith(`@@`)&&`text-soft-foreground`),children:[e,e===``?` `:``]},t))})]})}export{h as t};
@@ -1,13 +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{t as r}from"./utils-Df_1kJEk.js";import{N as i,t as a}from"./button-BrxohNcK.js";import{t as o}from"./chevron-right-C3fLn_fF.js";import{t as s}from"./pencil-DWtoOm2f.js";import{t as c}from"./plus-BPopgSYQ.js";import{t as l}from"./use-submit-shortcut-BJ10ZshV.js";import{n as u,t as d}from"./lib-D2__YoPr.js";import{o as f}from"./chunk-BO2N2NFS-Bde6epwZ.js";import{i as p,o as m,s as h,t as g}from"./markdown-rDA5iFAU.js";import{n as _,t as v}from"./markdown-Di8pirEb.js";import{i as ee,n as y,r as te,t as b}from"./scroll-within-D3mqUngk.js";import{n as x,t as S}from"./types-BTlmexWF.js";var C=i(`message-square-off`,[[`path`,{d:`M19 19H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.7.7 0 0 1 2 21.286V5a2 2 0 0 1 1.184-1.826`,key:`1wyg69`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.656 3H20a2 2 0 0 1 2 2v11.344`,key:`mhl4k6`}]]),w=e(t(),1),T=20.4,E=44;function ne(e){if(e.binary===!0||e.patch===``)return 1;let t=e.patch.split(`
2
- `),n=t.findIndex(e=>e.startsWith(`@@`));return n===-1?t.length:t.length-n}function re(e,t=!0){return Math.round((t?ne(e):1)*T)+E}function ie(e){return e.reduce((e,t)=>e+ne(t),0)}var D=/(^|\/)(package-lock\.json|npm-shrinkwrap\.json|yarn\.lock|pnpm-lock\.yaml|bun\.lockb?|Cargo\.lock|poetry\.lock|uv\.lock|composer\.lock|Gemfile\.lock|go\.sum)$|\.min\.(js|css)$|\.map$/;function ae(e){return e.binary===!0||e.image===!0?!1:e.adds+e.dels>400||D.test(e.path)}function oe(e,t){let n=new URLSearchParams(e).get(`diff`);return n===`flat`||n===`virtual`?n:t>1500?`virtual`:`flat`}function O(e){return`${e.oldPath??``}→${e.path}`}function k(e){let t=0;for(let n of e.split(`
3
- `))n.length>t&&(t=n.length);return t}function A(e,t){let n=Array(e.length);for(let r of ce(e)){let i=[e=>e.kind!==`add`,e=>e.kind!==`del`];for(let a of i){let i=r.filter(t=>a(e[t]));if(i.length===0)continue;let o=t(i.map(t=>e[t].text).join(`
4
- `));if(!o)return null;i.forEach((t,r)=>{n[t]=o.tokens[r]??[{content:e[t].text}]})}}return n}var j=2e6,M=new Map,N=0;function P(e,t){let n=e;for(let e of t)n+=`\n${e.kind[0]}${e.oldLine??``},${e.newLine??``}\t${e.text}`;return n}function F(e){let t=M.get(e);return t!==void 0&&(M.delete(e),M.set(e,t)),t}function I(e,t){if(!(e.length>j/4||M.has(e))){M.set(e,t),N+=e.length;for(let e of M.keys()){if(N<=j)break;N-=e.length,M.delete(e)}}}var L=8,R=[],z=!1;function B(){let e=performance.now();for(;R.length>0&&performance.now()-e<L;){let e=R.shift();e.cancelled||e.run()}R.length>0?setTimeout(B,0):z=!1}function se(e){let t={run:e,cancelled:!1};return R.push(t),z||(z=!0,setTimeout(B,0)),()=>{t.cancelled=!0}}function ce(e){let t=[],n=[],r,i;return e.forEach((e,a)=>{!(n.length>0&&(e.oldLine===void 0||r===void 0||e.oldLine===r+1)&&(e.newLine===void 0||i===void 0||e.newLine===i+1))&&n.length>0&&(t.push(n),n=[],r=void 0,i=void 0),n.push(a),e.oldLine!==void 0&&(r=e.oldLine),e.newLine!==void 0&&(i=e.newLine)}),n.length>0&&t.push(n),t}var V=/[A-Za-z0-9_]+|\s+|[^\sA-Za-z0-9_]+/g,H=300,U=.3;function W(e,t){if(e===t)return null;let n=e.match(V)??[],r=t.match(V)??[];if(n.length===0||r.length===0||n.length>H||r.length>H)return null;let i=r.length+1,a=new Uint16Array((n.length+1)*i);for(let e=1;e<=n.length;e++)for(let t=1;t<=r.length;t++)a[e*i+t]=n[e-1]===r[t-1]?(a[(e-1)*i+(t-1)]??0)+1:Math.max(a[(e-1)*i+t]??0,a[e*i+(t-1)]??0);if((a[n.length*i+r.length]??0)/Math.max(n.length,r.length)<U)return null;let o=Array(n.length).fill(!1),s=Array(r.length).fill(!1),c=n.length,l=r.length;for(;c>0&&l>0;)n[c-1]===r[l-1]?(o[c-1]=!0,s[l-1]=!0,c--,l--):(a[(c-1)*i+l]??0)>=(a[c*i+(l-1)]??0)?c--:l--;return{del:le(n,o),add:le(r,s)}}function le(e,t){let n=[];return e.forEach((e,r)=>{let i=!(t[r]??!1),a=n[n.length-1];a&&a.changed===i?a.text+=e:n.push({text:e,changed:i})}),n}function ue(e,t,n){if(!t||t.length===0)return e?e.map(e=>({text:e.content,color:e.color,changed:!1})):n===``?[]:[{text:n,changed:!1}];if(!e||e.length===0)return t.map(e=>({text:e.text,changed:e.changed}));let r=[],i=0,a=0,o=0,s=0;for(;i<e.length&&o<t.length;){let n=e[i],c=t[o],l=n.content.length-a,u=c.text.length-s,d=Math.min(l,u);d>0&&(r.push({text:n.content.slice(a,a+d),color:n.color,changed:c.changed}),a+=d,s+=d),n.content.length-a<=0&&(i++,a=0),c.text.length-s<=0&&(o++,s=0)}for(;i<e.length;){let t=e[i],n=t.content.slice(a);n!==``&&r.push({text:n,color:t.color,changed:!1}),i++,a=0}return r}var de=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/,fe=`… (patch truncated)`;function G(e){let t=[],n=!1,r=null,i=0,a=0,o=e.split(`
5
- `);o.at(-1)===``&&o.pop();for(let e of o){let o=de.exec(e);if(o){r={header:e,oldStart:Number(o[1]),oldCount:o[2]===void 0?1:Number(o[2]),newStart:Number(o[3]),newCount:o[4]===void 0?1:Number(o[4]),lines:[]},i=r.oldStart,a=r.newStart,t.push(r);continue}if(e.includes(fe)){n=!0,r=null;continue}r&&(e.startsWith(`+`)?r.lines.push({kind:`add`,text:e.slice(1),newLine:a++}):e.startsWith(`-`)?r.lines.push({kind:`del`,text:e.slice(1),oldLine:i++}):e.startsWith(`\\`)||r.lines.push({kind:`context`,text:e.slice(1),oldLine:i++,newLine:a++}))}return{hunks:t,truncated:n}}function K(e,t=!1){let n=[],r=e[0];if(!r)return n;r.newStart>1&&n.push({beforeHunk:0,count:r.newStart-1,oldStart:1,newStart:1});for(let t=1;t<e.length;t++){let r=e[t-1],i=e[t],a=r.oldStart+r.oldCount,o=r.newStart+r.newCount,s=i.newStart-o;s>0&&n.push({beforeHunk:t,count:s,oldStart:a,newStart:o})}if(t){let t=e[e.length-1];n.push({beforeHunk:e.length,oldStart:t.oldStart+t.oldCount,newStart:t.newStart+t.newCount})}return n}function pe(e,t){let n=e.count===void 0?t.length:e.newStart+e.count-1,r=e.oldStart-e.newStart,i=[];for(let a=e.newStart;a<=Math.min(n,t.length);a++)i.push({kind:`context`,text:t[a-1]??``,oldLine:a+r,newLine:a});return i}function q(e,t){let n=Array(e.length),r=Array(t.length),i=Math.min(e.length,t.length);for(let a=0;a<i;a++){let i=W(e[a].text,t[a].text);i&&(n[a]=i.del,r[a]=i.add)}return{dels:e,adds:t,delSpans:n,addSpans:r}}function J(e,t,n){let r=0;for(;r<e.lines.length;){let i=e.lines[r];if(i.kind===`del`||i.kind===`add`){let t=[],i=[];for(;r<e.lines.length&&e.lines[r].kind===`del`;)t.push(e.lines[r++]);for(;r<e.lines.length&&e.lines[r].kind===`add`;)i.push(e.lines[r++]);n(q(t,i))}else t(i),r++}}function me(e,t=[],n){let r=new Map(t.map(e=>[e.beforeHunk,e])),i=[],a=e=>{let t=r.get(e);if(!t)return;let a=n?.get(e);if(a)for(let e of a)i.push({type:`line`,cell:{line:e}});else i.push({type:`gap`,gap:t})};return e.forEach((e,t)=>{a(t),i.push({type:`hunk`,hunk:e}),J(e,e=>i.push({type:`line`,cell:{line:e}}),e=>{e.dels.forEach((t,n)=>i.push({type:`line`,cell:{line:t,spans:e.delSpans[n]}})),e.adds.forEach((t,n)=>i.push({type:`line`,cell:{line:t,spans:e.addSpans[n]}}))})}),a(e.length),i}function he(e,t=[],n){let r=new Map(t.map(e=>[e.beforeHunk,e])),i=[],a=e=>{let t=r.get(e);if(!t)return;let a=n?.get(e);if(a)for(let e of a)i.push({type:`pair`,left:{line:e},right:{line:e}});else i.push({type:`gap`,gap:t})};return e.forEach((e,t)=>{a(t),i.push({type:`hunk`,hunk:e}),J(e,e=>i.push({type:`pair`,left:{line:e},right:{line:e}}),e=>{let t=Math.max(e.dels.length,e.adds.length);for(let n=0;n<t;n++){let t=e.dels[n],r=e.adds[n];i.push({type:`pair`,...t?{left:{line:t,spans:e.delSpans[n]}}:{},...r?{right:{line:r,spans:e.addSpans[n]}}:{}})}})}),a(e.length),i}var Y=n();function ge({file:e,loadFileText:t,imageSrc:n}){let r=(0,w.useMemo)(()=>_e(e),[e]),i=(0,w.useRef)(t);i.current=t;let a=t!==void 0,[o,s]=(0,w.useState)(null);(0,w.useEffect)(()=>{let t=i.current;if(!t)return;let n=!1;return t(e.path).then(t=>!n&&s({path:e.path,text:t}),()=>!n&&s({path:e.path,text:null})),()=>{n=!0}},[e.path,e.patch,a]);let c=(0,w.useRef)(n);c.current=n;let l=(0,w.useMemo)(()=>ye(e.path,e=>c.current?.(e)),[e.path]),u=o?.path===e.path?o:null;if(a&&u===null)return(0,Y.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`Loading preview…`});let d=u?.text??null;return(0,Y.jsxs)(`div`,{"data-slot":`diff-markdown-preview`,className:`px-6 py-6`,children:[d===null&&!r.complete?(0,Y.jsx)(`p`,{className:`mx-auto mb-4 max-w-[72ch] text-xs text-soft-foreground`,children:`Showing the changed sections only.`}):null,(0,Y.jsx)(g,{variant:`document`,urlTransform:l,children:d??r.text})]})}function _e(e){let t=G(e.patch);return{text:t.hunks.map(e=>e.lines.filter(e=>e.kind!==`del`).map(e=>e.text).join(`
6
- `)).join(`
7
-
8
- ---
9
-
10
- `),complete:e.status===`added`&&!t.truncated}}var ve=/^(?:[a-z][a-z\d+.-]*:|\/\/)/i;function ye(e,t){return(n,r,i)=>{if(n.startsWith(`#`)||ve.test(n))return f(n,r,i);let a=be(e,n);return a===null||r!==`src`?null:t(a)??null}}function be(e,t){let n=t.split(/[?#]/,1)[0]??``;if(n===``)return null;let r=n.startsWith(`/`)?[]:e.split(`/`).slice(0,-1);for(let e of n.split(`/`))if(!(e===``||e===`.`))if(e===`..`){if(r.pop()===void 0)return null}else r.push(xe(e));return r.length>0?r.join(`/`):null}function xe(e){try{return decodeURIComponent(e)}catch{return e}}function X(e,t){return t.kind===`del`?t.oldLine===void 0?void 0:{path:e,side:`old`,line:t.oldLine}:t.newLine===void 0?void 0:{path:e,side:`new`,line:t.newLine}}function Z(e){return`${e.side}:${e.line}\u0000${e.path}`}function Se(e,t,n,r){let i=Math.max(0,Math.min(n,r)),a=Math.min(t.length-1,Math.max(n,r)),o=t[a],s=o?X(e,o):void 0;if(!s)return;let c=t.slice(i,a+1);if(i===a)return{anchor:s,excerpt:o.text};let l=X(e,t[i]);return{anchor:s,...l?{start:{side:l.side,line:l.line}}:{},excerpt:Ce(c)}}function Ce(e){let t=[],n,r;for(let i of e){if(i.newLine!==void 0&&r!==void 0&&i.newLine>r+1||i.oldLine!==void 0&&n!==void 0&&i.oldLine>n+1){let e=i.newLine!==void 0&&r!==void 0?i.newLine-r-1:i.oldLine-n-1;t.push(`⋯ ${e} unchanged ${e===1?`line`:`lines`} not shown`)}t.push(i.text),i.oldLine!==void 0&&(n=i.oldLine),i.newLine!==void 0&&(r=i.newLine)}return t.join(`
11
- `)}var Q=(0,w.createContext)(null);function we(e){if(e===`selected`)return`relative before:pointer-events-none before:absolute before:inset-0 before:bg-primary/15`;if(e===`commented`)return`shadow-[inset_3px_0_0_0_var(--color-primary)]`}var Te=(0,w.createContext)(null);function $(){return(0,w.useContext)(Te)}function Ee(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(hover: none)`).matches}function De(e,t,n){if(!(!e?.canAdd||t===void 0))return{onClick:r=>{Ee()&&(r.target.closest(`button, a, textarea, input`)||(window.getSelection?.()?.toString()??``)===``&&e.open(t,n))}}}function Oe({anchor:e,excerpt:t,line:n}){let i=$(),a=(0,w.useContext)(Q);if(!i?.canAdd||e===void 0)return null;let o=a?.orderOf.get(n),s=i.editing,l=s!==null&&s.commentId===void 0&&s.anchor.path===e.path&&a!==null;return(0,Y.jsx)(`button`,{type:`button`,"data-slot":`diff-add-comment`,"aria-label":`Comment on ${e.path.split(`/`).at(-1)} ${e.side===`old`?`removed `:``}line ${e.line}`,title:`Add a comment for the agent — drag to cover several lines, or shift-click to extend`,onMouseDown:t=>{t.button===0&&(t.preventDefault(),!(t.shiftKey&&l)&&a&&o!==void 0&&i.beginSelect(e.path,o,a.lines))},onClick:n=>{if(n.shiftKey&&l&&o!==void 0&&s){let t=s.start??s.anchor,n=ke(a,e.path,t)??o,r=Se(e.path,a.lines,n,o);r&&i.open(r.anchor,r.excerpt,r.start,!0);return}n.detail===0&&i.open(e,t)},className:r(`absolute top-1/2 left-0 z-[1] flex size-4 -translate-y-1/2 items-center justify-center rounded-sm`,`bg-primary text-primary-foreground opacity-0 shadow-xs transition-opacity`,`group-hover/line:opacity-100 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`),children:(0,Y.jsx)(c,{"aria-hidden":`true`,className:`size-2.5`,strokeWidth:3})})}function ke(e,t,n){let r=Z({path:t,side:n.side,line:n.line});for(let[n,i]of e.orderOf){let e=X(t,n);if(e&&Z(e)===r)return i}}function Ae({anchors:e}){let t=$(),n=(0,w.useContext)(Q);if(!t)return null;let r=[...new Set(e.filter(e=>e!==void 0).map(Z))],i=r.flatMap(e=>t.byKey.get(e)??[]),a=t.editing!==null&&r.includes(t.editing.threadKey)?t.editing:null;if(i.length===0&&a===null)return null;let o=a?.commentId;return(0,Y.jsx)(`div`,{"data-slot":`diff-line-comments`,className:`border-y border-primary/25 bg-primary/5 py-2.5 font-sans`,children:(0,Y.jsxs)(`div`,{className:`sticky left-0 flex w-full max-w-2xl flex-col gap-2 px-3 md:pl-24`,children:[i.map(e=>e.id===o&&a?(0,Y.jsx)(Ne,{editing:a,api:t},a.key):(0,Y.jsx)(Me,{comment:e,outdated:je(e,n),onEdit:t.edit,onRemove:t.remove},e.id)),a&&o===void 0?(0,Y.jsx)(Ne,{editing:a,api:t},a.key):null]})})}function je(e,t){if(!t||!e.excerpt||e.excerpt.endsWith(`…`))return!1;let n=Z(e),r=t.lines.find(t=>{let r=X(e.path,t);return r!==void 0&&Z(r)===n});return r?(e.excerpt.split(`
12
- `).at(-1)??``).trimEnd()!==r.text.trimEnd():!1}function Me({comment:e,outdated:t=!1,onEdit:n,onRemove:r}){return(0,Y.jsxs)(`div`,{"data-slot":`diff-line-comment`,"data-comment-id":e.id,role:`group`,"aria-label":`Comment on ${x(e,e.start)}`,className:`flex flex-col gap-1.5 rounded-md border border-primary/40 bg-card px-3 py-2.5 text-ui leading-normal shadow-sm transition-shadow duration-500 data-[flash=true]:ring-2 data-[flash=true]:ring-primary`,children:[t?(0,Y.jsxs)(`div`,{"data-slot":`diff-line-comment-outdated`,className:`flex flex-col gap-1`,children:[(0,Y.jsx)(`p`,{className:`text-meta font-medium text-pending-strong`,children:`Outdated — the code here changed since this comment`}),(0,Y.jsx)(`pre`,{className:`max-h-32 overflow-auto rounded-sm border border-border/60 bg-muted/40 px-2 py-1 font-mono text-label whitespace-pre text-muted-foreground`,children:e.excerpt})]}):null,(0,Y.jsx)(`p`,{className:`break-words whitespace-pre-wrap text-foreground`,children:e.body}),n||r?(0,Y.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5`,children:[n?(0,Y.jsxs)(a,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>n(e),children:[(0,Y.jsx)(s,{"aria-hidden":`true`,className:`size-3.5`}),`Edit`]}):null,r?(0,Y.jsxs)(a,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>r(e.id),children:[(0,Y.jsx)(C,{"aria-hidden":`true`,className:`size-3.5`}),`Remove from chat`]}):null]}):null]})}function Ne({editing:e,api:t}){let[n,r]=(0,w.useState)(()=>t.pendingText.get(e.key)??e.initial??``),i=(0,w.useRef)(null);(0,w.useEffect)(()=>{let n=i.current;!n||t.focusRequest.current!==e.key||(t.focusRequest.current=null,n.focus({preventScroll:!0}),n.setSelectionRange(n.value.length,n.value.length),n.closest(`[data-slot="diff-comment-editor"]`)?.scrollIntoView?.({block:`nearest`}))},[]);let o=n.trim(),s=()=>{o!==``&&(e.commentId===void 0?t.submit({...e.anchor,...e.start?{start:e.start}:{},...e.oldPath?{oldPath:e.oldPath}:{},excerpt:e.excerpt,body:o}):t.update(e.commentId,o))&&t.pendingText.delete(e.key)},c=()=>{t.pendingText.delete(e.key),t.cancel()};return(0,Y.jsxs)(`div`,{"data-slot":`diff-comment-editor`,className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`textarea`,{ref:i,rows:3,maxLength:S,value:n,"aria-label":`Comment on ${x(e.anchor,e.start)}`,placeholder:`Add a comment for the AI`,onChange:n=>{r(n.target.value),t.pendingText.set(e.key,n.target.value)},onKeyDown:e=>{if(e.key===`Escape`){e.preventDefault(),c();return}l({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.preventDefault(),s())},className:`block w-full resize-y rounded-md border border-ring/60 bg-background px-3 py-2 text-base leading-normal outline-none placeholder:text-muted-foreground focus:border-ring focus:ring-[3px] focus:ring-ring/15 md:text-sm`}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5`,children:[(0,Y.jsx)(a,{type:`button`,variant:`ghost`,size:`sm`,onClick:c,children:`Cancel`}),(0,Y.jsxs)(a,{type:`button`,size:`sm`,disabled:o===``,onClick:s,children:[e.commentId===void 0?`Comment`:`Save`,` `,(0,Y.jsx)(`span`,{"aria-hidden":`true`,children:`↵`})]})]})]})}var Pe=1500,Fe=new Map;function Ie(e,t){if(e){for(let n of e.querySelectorAll(`[data-slot="diff-file"]`))if(n.dataset.path===t)return n}}function Le(e,t){let n=Ie(e,t.path);if(!n)return;if(t.commentId!==void 0){for(let e of n.querySelectorAll(`[data-slot="diff-line-comment"]`))if(e.dataset.commentId===t.commentId)return e}if(t.line===void 0)return;let r=String(t.line);for(let e of n.querySelectorAll(`[data-slot="diff-line"], [data-slot="diff-cell"]`))if((t.side===`old`?e.dataset.oldLine:e.dataset.newLine)===r)return e}function Re(e){e.dataset.flash=`true`,setTimeout(()=>{delete e.dataset.flash},1600)}function ze({files:e,mode:t=`unified`,wrap:n=!1,preview:i=!1,loadFileText:a,imageSrc:o,onOpenInApp:s,oldImageSrc:c,viewRef:l,comments:d,onAddComment:f,onEditComment:p,onRemoveComment:m,className:h}){let g=(0,w.useMemo)(()=>({adds:e.reduce((e,t)=>e+t.adds,0),dels:e.reduce((e,t)=>e+t.dels,0),files:e.length}),[e]),[_,ee]=(0,w.useState)(()=>new Map),[te,x]=(0,w.useState)(()=>new Map),S=(0,w.useMemo)(()=>new Set((d??[]).map(e=>e.path)),[d]),C=(0,w.useCallback)(e=>!ae(e)||S.has(e.path),[S]),T=(0,w.useCallback)(e=>_.get(O(e))??C(e),[_,C]),E=(0,w.useCallback)((e,t)=>{ee(n=>{let r=O(e);return n.get(r)===t?n:new Map(n).set(r,t)})},[]),ne=(0,w.useCallback)(async(e,t)=>{if(!a)return;let n=await a(e.path);if(n===null)return;let r=pe(t,n.split(`
13
- `));x(n=>{let i=O(e);return new Map(n).set(i,new Map(n.get(i)??Fe).set(t.beforeHunk,r))})},[a]),[D,k]=(0,w.useState)(null),A=(0,w.useRef)(new Map).current,j=(0,w.useRef)(null),[M,N]=(0,w.useState)(null),P=(0,w.useRef)(null),F=(0,w.useRef)([]),I=M!==null,L=(0,w.useRef)(D);L.current=D;let R=(0,w.useRef)({element:null}),z=(0,w.useRef)(null),B=(0,w.useRef)(null),[se,ce]=(0,w.useState)(0),V=e=>{let t=document.activeElement;R.current={element:t instanceof HTMLElement&&z.current?.contains(t)?t:null,...e?{commentId:e}:{}}},H=()=>{let{element:e,commentId:t}=R.current;R.current={element:null},setTimeout(()=>{if(e?.isConnected){e.focus({preventScroll:!0});return}if(t!==void 0){for(let e of z.current?.querySelectorAll(`[data-slot="diff-line-comment"]`)??[])if(e.dataset.commentId===t){e.querySelector(`button`)?.focus({preventScroll:!0});return}}},0)},U=(0,w.useRef)({captureOpener:V,restoreFocus:H});U.current={captureOpener:V,restoreFocus:H};let W=(0,w.useCallback)((t,n,r,i=!1)=>{let a=Z(t),o=r?`${a}\u0000${r.side}:${r.line}`:a,s=L.current;if(i&&s&&s.commentId===void 0&&s.key!==o){let e=A.get(s.key);e!==void 0&&(A.set(o,e),A.delete(s.key))}let c=t.side===`old`||r?.side===`old`?e.find(e=>e.path===t.path)?.oldPath:void 0;j.current=o,i||U.current.captureOpener(),k({key:o,threadKey:a,anchor:t,excerpt:n,...r?{start:r}:{},...c?{oldPath:c}:{}})},[e,A]);(0,w.useEffect)(()=>{if(!I)return;let e=()=>{let e=P.current;if(P.current=null,N(null),!e)return;let t=Se(e.path,F.current,e.from,e.to);t&&W(t.anchor,t.excerpt,t.start)};return window.addEventListener(`mouseup`,e),()=>window.removeEventListener(`mouseup`,e)},[W,I]);let le=(0,w.useMemo)(()=>{if(!f&&(d?.length??0)===0)return null;let e=new Map;for(let t of d??[]){let n=Z(t);e.set(n,[...e.get(n)??[],t])}return{comments:d??[],byKey:e,editing:D,selection:M,canAdd:f!==void 0,open:W,beginSelect:(e,t,n)=>{F.current=n,P.current={path:e,from:t,to:t},N(P.current)},extendSelect:(e,t)=>{let n=P.current;n===null||n.path!==e||n.to===t||(P.current={...n,to:t},N(P.current))},edit:p?e=>{j.current=`edit:${e.id}`,U.current.captureOpener(e.id),k({key:`edit:${e.id}`,threadKey:Z(e),anchor:e,...e.start?{start:e.start}:{},excerpt:``,commentId:e.id,initial:e.body})}:void 0,cancel:()=>{k(null),U.current.restoreFocus()},submit:e=>f?.(e)===!1?!1:(k(null),U.current.restoreFocus(),!0),update:(e,t)=>p?.(e,t)===!1?!1:(k(null),U.current.restoreFocus(),!0),remove:m,pendingText:A,focusRequest:j}},[d,D,f,p,m,W,A,M]),ue=(0,w.useMemo)(()=>ie(e),[e]),[de]=(0,w.useState)(()=>typeof window>`u`?``:window.location.search),fe=oe(de,ue),G=(0,w.useRef)(null),K=(0,w.useRef)(null),q=(0,w.useRef)(null),J=Be(l!==void 0,q,G,se);(0,w.useImperativeHandle)(l,()=>{let t=t=>{let n=e.findIndex(e=>e.path===t);if(n===-1)return;let r=K.current,i=q.current,a=i&&Number.parseFloat(getComputedStyle(i).scrollMarginTop)||0;if(r)r.scrollToIndex(n,{align:`start`,offset:-a});else{let e=Ie(i,t),n=G.current;e&&n&&y(n,e,a)}};return{scrollToPath:e=>t(e),reveal:n=>{let r=e.find(e=>e.path===n.path);if(!r)return;E(r,!0),t(n.path);let i=0,a=()=>{let e=Le(q.current,n);if(e){let t=G.current,n=K.current;if(t&&n){let r=e.getBoundingClientRect(),i=Number.parseFloat(getComputedStyle(e).scrollMarginBottom)||0;n.scrollTo(t.scrollTop+r.top-t.getBoundingClientRect().top-(t.clientHeight-i-r.height)/2)}else t&&y(t,e,(t.clientHeight-e.getBoundingClientRect().height)/2);Re(e);return}++i<30&&requestAnimationFrame(a)};requestAnimationFrame(a)}}},[e,E]);let me=e=>{let r=O(e),l=T(e);return(0,Y.jsx)(Ue,{file:e,open:l,held:!l&&!_.has(r),onToggle:()=>E(e,!l),expanded:te.get(r)??Fe,onExpand:t=>void ne(e,t),mode:t,wrap:n,preview:i&&v(e),loadFileText:a,canExpand:a!==void 0,imageSrc:o,onOpenInApp:s,oldImageSrc:c})};return(0,Y.jsx)(Te.Provider,{value:le,children:(0,Y.jsxs)(`div`,{ref:e=>{if(q.current=e,z.current=e,!e)return;let t=b(e);G.current=t,B.current&&B.current!==t&&ce(e=>e+1),B.current=t},"data-slot":`diff`,"data-mode":t,className:r(`flex min-w-0 flex-col scroll-mt-[var(--diff-sticky-top,0px)]`,h),children:[(0,Y.jsxs)(`p`,{"data-slot":`diff-totals`,className:`flex items-center gap-2 px-1 pb-3 text-xs text-muted-foreground`,children:[(0,Y.jsxs)(`span`,{children:[g.files,` `,g.files===1?`file`:`files`,` changed`]}),(0,Y.jsx)(u,{stat:g})]}),fe===`virtual`?(0,Y.jsx)(Ve,{files:e,handleRef:K,scrollElRef:G,card:me,endRoom:J},se):(0,Y.jsx)(`div`,{"data-slot":`diff-files`,"data-virtualized":`false`,children:e.map((t,n)=>(0,Y.jsx)(`div`,{"data-slot":`diff-file-slot`,style:{containIntrinsicBlockSize:`auto ${re(t,T(t))}px`,...n===e.length-1&&J?{minHeight:J}:{}},className:`pb-3 [content-visibility:auto]`,children:me(t)},O(t)))})]})})}function Be(e,t,n,r){let[i,a]=(0,w.useState)(0);return(0,w.useLayoutEffect)(()=>{let r=t.current,i=n.current;if(!e||!r||!i){a(0);return}let o=()=>{let e=Number.parseFloat(getComputedStyle(r).scrollMarginTop)||0;a(Math.max(0,Math.round(i.clientHeight-e)))};if(o(),typeof ResizeObserver>`u`)return;let s=new ResizeObserver(o);return s.observe(i),()=>s.disconnect()},[e,t,n,r]),i}function Ve({files:e,handleRef:t,scrollElRef:n,card:r,endRoom:i}){let a=(0,w.useRef)(null),[o,s]=(0,w.useState)(0);return(0,w.useLayoutEffect)(()=>{let e=()=>{let e=a.current,t=n.current;!e||!t||s(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[n]),(0,Y.jsx)(`div`,{ref:e=>{a.current=e,e&&(n.current=b(e))},"data-slot":`diff-files`,"data-virtualized":`true`,children:(0,Y.jsx)(d,{ref:t,scrollRef:n,startMargin:o,children:e.map((t,n)=>(0,Y.jsx)(`div`,{"data-slot":`diff-file-slot`,style:n===e.length-1&&i?{minHeight:i}:void 0,className:`pb-3`,children:r(t)},O(t)))})})}var He={added:`added`,deleted:`deleted`,renamed:`renamed`,copied:`copied`};function Ue({file:e,open:t,held:n,onToggle:i,expanded:a,onExpand:s,mode:c,wrap:l,preview:d,loadFileText:f,canExpand:p,imageSrc:m,onOpenInApp:h,oldImageSrc:g}){let v=He[e.status],ee=$()?.comments.filter(t=>t.path===e.path).length??0;return(0,Y.jsxs)(`section`,{"data-slot":`diff-file`,"data-path":e.path,className:`min-w-0 scroll-mt-[var(--diff-sticky-top,0px)] overflow-clip rounded-md border border-border bg-card`,children:[(0,Y.jsx)(`header`,{className:`sticky top-[var(--diff-sticky-top,0px)] z-10 border-b border-[color-mix(in_oklab,var(--border)_50%,var(--card))] bg-card shadow-[0_-1px_0_var(--card)]`,children:(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`diff-file-header`,"aria-expanded":t,onClick:i,className:`flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted/50`,children:[(0,Y.jsx)(o,{className:r(`size-3.5 shrink-0 text-soft-foreground transition-transform`,t&&`rotate-90`),"aria-hidden":`true`}),(0,Y.jsx)(`span`,{"data-slot":`diff-file-path`,className:`min-w-0 truncate font-mono text-xs font-medium`,children:e.oldPath?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`span`,{className:`text-soft-foreground`,children:[e.oldPath,` → `]}),e.path]}):e.path}),v?(0,Y.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-micro font-medium text-muted-foreground`,children:v}):null,e.image?(0,Y.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-micro font-medium text-muted-foreground`,children:`image`}):e.binary?(0,Y.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-micro font-medium text-muted-foreground`,children:`binary`}):null,d?(0,Y.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-micro font-medium text-muted-foreground`,children:`preview`}):null,(0,Y.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[(0,Y.jsx)(_,{count:ee}),(0,Y.jsx)(u,{stat:{adds:e.adds,dels:e.dels,files:1},className:`text-meta`})]})]})}),t&&d?(0,Y.jsx)(ge,{file:e,loadFileText:f,imageSrc:m}):t?(0,Y.jsx)(We,{file:e,expanded:a,onExpand:s,mode:c,wrap:l,canExpand:p,imageSrc:m,onOpenInApp:h,oldImageSrc:g}):n?(0,Y.jsxs)(`div`,{"data-slot":`diff-file-held`,className:`flex items-center gap-3 px-4 py-2.5 text-xs text-soft-foreground`,children:[(0,Y.jsxs)(`span`,{children:[`Large diff — `,(e.adds+e.dels).toLocaleString(),` changed lines not rendered.`]}),(0,Y.jsx)(`button`,{type:`button`,"data-action":`load-diff`,onClick:i,className:`font-medium text-foreground underline-offset-2 hover:underline`,children:`Load diff`})]}):null]})}function We({file:e,expanded:t,onExpand:n,mode:i,wrap:a,canExpand:o,imageSrc:s,onOpenInApp:c,oldImageSrc:l}){let u=(0,w.useMemo)(()=>G(e.patch),[e.patch]),d=o&&e.status!==`added`&&e.status!==`deleted`,f=(0,w.useMemo)(()=>K(u.hunks,d),[u.hunks,d]),p=(0,w.useMemo)(()=>{let e=[];u.hunks.forEach((n,r)=>{let i=t.get(r);i&&e.push(...i),e.push(...n.lines)});let n=t.get(u.hunks.length);return n&&e.push(...n),e},[u.hunks,t]),m=(0,w.useMemo)(()=>new Map(p.map((e,t)=>[e,t])),[p]),h=Ge(e.path,p),g=$(),_=(0,w.useMemo)(()=>{if(!g)return null;let t=new Map;p.forEach((n,r)=>{let i=X(e.path,n);i&&t.set(Z(i),r)});let n=n=>t.get(Z({path:e.path,side:n.side,line:n.line})),r=new Map,i=(e,t,n)=>{for(let i=Math.min(e,t);i<=Math.max(e,t);i++)(n===`selected`||!r.has(i))&&r.set(i,n)},a=(e,t,r)=>{let a=n(e);a!==void 0&&i(t?n(t)??a:a,a,r)};for(let t of g.comments)t.path===e.path&&a(t,t.start,`commented`);let{editing:o,selection:s}=g;return o&&o.anchor.path===e.path&&a(o.anchor,o.start,`selected`),s&&s.path===e.path&&i(s.from,s.to,`selected`),{path:e.path,lines:p,orderOf:m,markAt:e=>r.get(e)}},[g,e.path,p,m]),v=(0,w.useMemo)(()=>i===`unified`?me(u.hunks,f,t):null,[i,u.hunks,f,t]),y=(0,w.useMemo)(()=>i===`split`?he(u.hunks,f,t):null,[i,u.hunks,f,t]),b=(0,w.useMemo)(()=>i===`unified`&&!a?{minInlineSize:`calc(${k(e.patch)}ch + 7rem)`}:void 0,[i,a,e.patch]);if(ee(e))return(0,Y.jsx)(te,{file:e,imageSrc:s,oldImageSrc:l,onOpenInApp:c});if(e.binary)return(0,Y.jsx)(Ye,{children:`Binary file — no text diff.`});if(u.hunks.length===0)return(0,Y.jsx)(Ye,{children:u.truncated?`Patch truncated by the server.`:`No content changes (metadata only).`});let x=e=>{if(!h)return null;let t=m.get(e);return t===void 0?null:h[t]??null};return(0,Y.jsxs)(`div`,{"data-slot":`diff-file-body`,"data-wrap":a||void 0,className:r(`py-1 font-mono text-xs leading-[1.7]`,!a&&`overflow-x-auto`),children:[(0,Y.jsx)(Q.Provider,{value:_,children:(0,Y.jsxs)(`div`,{"data-slot":`diff-rows`,style:b,children:[v?qe(v).map((t,r)=>(0,Y.jsx)(Je,{count:t.length,children:t.map((t,r)=>(0,Y.jsx)(rt,{path:e.path,row:t,wrap:a,tokensFor:x,onExpand:d?n:void 0},r))},r)):null,y?qe(y).map((t,r)=>(0,Y.jsx)(Je,{count:t.length,children:t.map((t,r)=>(0,Y.jsx)(it,{path:e.path,row:t,wrap:a,tokensFor:x,onExpand:d?n:void 0},r))},r)):null]})}),u.truncated?(0,Y.jsx)(Ye,{children:`Patch truncated by the server — counts above remain exact.`}):null]})}function Ge(e,t){let n=t.length>Pe?null:t,r=(0,w.useMemo)(()=>h(e),[e]),i=(0,w.useMemo)(()=>n===null||r===null?null:P(r,n),[n,r]),[a,o]=(0,w.useState)(null);(0,w.useEffect)(()=>{if(i===null||n===null||r===null||F(i)!==void 0)return;let e=!1,t;return p(r).then(()=>{e||(t=se(()=>{let e=A(n,e=>m(e,r));e&&(I(i,e),o({key:i,tokens:e}))}))}),()=>{e=!0,t?.()}},[i,n,r]);let s=(0,w.useRef)(!1),c=null;return i!==null&&n!==null&&r!==null&&(c=F(i)??(a?.key===i?a.tokens:null),c===null&&s.current&&(c=A(n,e=>m(e,r)),c&&I(i,c))),(0,w.useEffect)(()=>{c!==null&&(s.current=!0)}),c}var Ke=64;function qe(e){let t=[];for(let n=0;n<e.length;n+=Ke)t.push(e.slice(n,n+Ke));return t}function Je({count:e,children:t}){return(0,Y.jsx)(`div`,{"data-slot":`diff-row-chunk`,style:{containIntrinsicBlockSize:`auto ${Math.round(e*T)}px`},className:`[content-visibility:auto]`,children:t})}function Ye({children:e}){return(0,Y.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:e})}var Xe={add:`bg-diff-add`,del:`bg-diff-del`,context:void 0},Ze={add:`+`,del:`−`,context:` `},Qe=`transition-shadow duration-500 data-[flash=true]:ring-2 data-[flash=true]:ring-inset data-[flash=true]:ring-primary`;function $e({hunk:e}){return(0,Y.jsx)(`div`,{"data-slot":`diff-hunk`,className:`bg-muted/40 px-4 py-0.5 whitespace-pre text-soft-foreground`,children:e.header})}function et({gap:e,onExpand:t}){let n=e.count===void 0?`⋯ unchanged lines to end of file`:`⋯ ${e.count} unchanged ${e.count===1?`line`:`lines`}`;return t?(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`diff-gap`,onClick:()=>t(e),className:`block w-full border-y border-border/40 bg-muted/20 px-4 py-0.5 text-left text-meta text-soft-foreground hover:bg-muted/50 hover:text-foreground`,children:[n,` — expand`]}):(0,Y.jsx)(`div`,{"data-slot":`diff-gap`,className:`border-y border-border/40 bg-muted/20 px-4 py-0.5 text-meta text-soft-foreground`,children:n})}function tt({cell:e,tokens:t,wrap:n}){let i=ue(t,e.spans,e.line.text),a=e.line.kind===`add`?`bg-diff-add-strong`:`bg-diff-del-strong`;return(0,Y.jsxs)(`span`,{className:r(`min-w-0 flex-1 pr-4`,n?`break-words whitespace-pre-wrap`:`whitespace-pre`),children:[i.map((t,n)=>(0,Y.jsx)(`span`,{"data-word":t.changed?e.line.kind:void 0,style:t.color===void 0?void 0:{color:t.color},className:t.changed?r(`rounded-[2px]`,a):void 0,children:t.text},n)),e.line.text===``?` `:``]})}function nt({value:e}){return(0,Y.jsx)(`span`,{className:`w-10 shrink-0 pr-2 text-right text-soft-foreground/70 tabular-nums select-none`,children:e??``})}function rt({path:e,row:t,wrap:n,tokensFor:i,onExpand:a}){let o=$(),s=(0,w.useContext)(Q);if(t.type===`hunk`)return(0,Y.jsx)($e,{hunk:t.hunk});if(t.type===`gap`)return(0,Y.jsx)(et,{gap:t.gap,onExpand:a});let{line:c}=t.cell,l=X(e,c),u=De(o,l,c.text),d=s?.orderOf.get(c),f=d===void 0?void 0:s?.markAt(d);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{"data-slot":`diff-line`,"data-line":c.kind,"data-old-line":c.oldLine,"data-new-line":c.newLine,"data-mark":f,...u,onMouseEnter:o?.selection&&d!==void 0?()=>o.extendSelect(e,d):void 0,className:r(`group/line flex`,Xe[c.kind],we(f),Qe),children:[(0,Y.jsx)(nt,{value:c.oldLine}),(0,Y.jsx)(nt,{value:c.newLine}),(0,Y.jsxs)(`span`,{className:`relative w-4 shrink-0 text-soft-foreground select-none`,children:[Ze[c.kind],(0,Y.jsx)(Oe,{anchor:l,excerpt:c.text,line:c})]}),(0,Y.jsx)(tt,{cell:t.cell,tokens:i(c),wrap:n})]}),(0,Y.jsx)(Ae,{anchors:[l]})]})}function it({path:e,row:t,wrap:n,tokensFor:r,onExpand:i}){if(t.type===`hunk`)return(0,Y.jsx)($e,{hunk:t.hunk});if(t.type===`gap`)return(0,Y.jsx)(et,{gap:t.gap,onExpand:i});let a=t.left?X(e,t.left.line):void 0,o=t.right?X(e,t.right.line):void 0;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{"data-slot":`diff-pair`,className:`grid grid-cols-2`,children:[(0,Y.jsx)(at,{cell:t.left,anchor:a,side:`old`,tokensFor:r,wrap:n}),(0,Y.jsx)(at,{cell:t.right,anchor:o,side:`new`,tokensFor:r,wrap:n})]}),(0,Y.jsx)(Ae,{anchors:[a,o]})]})}function at({cell:e,anchor:t,side:n,tokensFor:i,wrap:a}){let o=$(),s=(0,w.useContext)(Q);if(!e)return(0,Y.jsx)(`div`,{"data-slot":`diff-cell-empty`,className:r(`bg-muted/20`,n===`new`&&`border-l border-border/40`)});let{line:c}=e,l=s?.orderOf.get(c),u=l===void 0?void 0:s?.markAt(l);return(0,Y.jsxs)(`div`,{"data-slot":`diff-cell`,"data-line":c.kind,"data-old-line":c.oldLine,"data-new-line":c.newLine,"data-mark":u,...De(o,t,c.text),onMouseEnter:o?.selection&&l!==void 0&&t?()=>o.extendSelect(t.path,l):void 0,className:r(`group/line flex min-w-0 overflow-x-auto`,Xe[c.kind],n===`new`&&`border-l border-border/40`,we(u),Qe),children:[(0,Y.jsx)(nt,{value:n===`old`?c.oldLine:c.newLine}),(0,Y.jsxs)(`span`,{className:`relative w-4 shrink-0 text-soft-foreground select-none`,children:[Ze[c.kind],(0,Y.jsx)(Oe,{anchor:t,excerpt:c.text,line:c})]}),(0,Y.jsx)(tt,{cell:e,tokens:i(c),wrap:a})]})}export{ze as DiffView};
@@ -1,2 +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{Et as r,mt as i,na as a,sa as o,sr as s}from"./queries-DOHu2y2B.js";import{t as c}from"./utils-Df_1kJEk.js";import{N as l}from"./button-BrxohNcK.js";import{t as u}from"./chevron-right-C3fLn_fF.js";import{t as d}from"./file-DYpKJvYs.js";import{t as ee}from"./folder-CeFUSrsO.js";import{t as f}from"./triangle-alert-Crbc2knA.js";import{t as p}from"./centered-state-CSW_o4N7.js";import{a as te,o as m,s as h,t as g}from"./markdown-rDA5iFAU.js";import{n as _}from"./markdown-Di8pirEb.js";var v=l(`file-exclamation-point`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),y=l(`file-question-mark`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]]),b=l(`file-x`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m14.5 12.5-5 5`,key:`b62r18`}],[`path`,{d:`m9.5 12.5 5 5`,key:`1rk7el`}]]),x=l(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),ne=l(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),S=l(`mouse-pointer-click`,[[`path`,{d:`M14 4.1 12 6`,key:`ita8i4`}],[`path`,{d:`m5.1 8-2.9-.8`,key:`1go3kf`}],[`path`,{d:`m6 12-1.9 2`,key:`mnht97`}],[`path`,{d:`M7.2 2.2 8 5.1`,key:`1cfko1`}],[`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`,key:`s0h3yz`}]]),C=e(t(),1),w=n();function T({root:e,selected:t,onSelect:n,commentCounts:r=E}){return(0,w.jsx)(D.Provider,{value:r,children:(0,w.jsx)(`nav`,{"data-slot":`changes-tree`,"aria-label":`Changed files`,className:`min-w-0 text-ui`,children:(0,w.jsxs)(`ul`,{className:`flex flex-col gap-px`,children:[e.dirs.map(e=>(0,w.jsx)(A,{dir:e,depth:0,selected:t,onSelect:n},e.path)),e.files.map(e=>(0,w.jsx)(j,{file:e,depth:0,selected:t,onSelect:n},e.path))]})})})}var E=new Map,D=(0,C.createContext)(E);function O(e,t){let n=0;for(let r of e.files)n+=t.get(r.path)??0;for(let r of e.dirs)n+=O(r,t);return n}function k({adds:e,dels:t}){return(0,w.jsxs)(`span`,{className:`shrink-0 font-mono text-meta font-medium tabular-nums`,children:[e>0?(0,w.jsxs)(`span`,{className:`text-success`,children:[`+`,e]}):null,e>0&&t>0?` `:null,t>0?(0,w.jsxs)(`span`,{className:`text-danger`,children:[`−`,t]}):null]})}function A({dir:e,depth:t,selected:n,onSelect:r}){let[i,a]=(0,C.useState)(!0),o=(0,C.useContext)(D),s=i?0:O(e,o);return(0,w.jsxs)(`li`,{children:[(0,w.jsxs)(`button`,{type:`button`,"data-slot":`tree-dir`,"data-path":e.path,"data-state":i?`open`:`closed`,"aria-expanded":i,onClick:()=>a(e=>!e),className:`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:`${6+t*14}px`},children:[(0,w.jsx)(u,{"aria-hidden":`true`,className:c(`size-3.5 shrink-0 transition-transform`,i&&`rotate-90`)}),(0,w.jsx)(ee,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,w.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:e.name}),(0,w.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 pl-2`,children:[(0,w.jsx)(_,{count:s}),(0,w.jsx)(k,{adds:e.adds,dels:e.dels})]})]}),i?(0,w.jsxs)(`ul`,{className:`flex flex-col gap-px`,children:[e.dirs.map(e=>(0,w.jsx)(A,{dir:e,depth:t+1,selected:n,onSelect:r},e.path)),e.files.map(e=>(0,w.jsx)(j,{file:e,depth:t+1,selected:n,onSelect:r},e.path))]}):null]})}var re={added:`text-success`,deleted:`text-danger`};function j({file:e,depth:t,selected:n,onSelect:r}){let i=n===e.path,a=(0,C.useContext)(D).get(e.path)??0;return(0,w.jsx)(`li`,{children:(0,w.jsxs)(`button`,{type:`button`,"data-slot":`tree-file`,"data-path":e.path,"aria-current":i?`true`:void 0,onClick:()=>r(e.path),className:c(`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,i?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${24+t*14}px`},children:[(0,w.jsx)(d,{"aria-hidden":`true`,className:c(`size-3.5 shrink-0`,re[e.status])}),(0,w.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name}),(0,w.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 pl-2`,children:[(0,w.jsx)(_,{count:a}),(0,w.jsx)(k,{adds:e.adds,dels:e.dels})]})]})})}var M=`cez-tree-pane-width`,N=.6;function P(e,t=1/0){if(e==null||e===``)return null;let n=typeof e==`number`?e:Number(e);if(!Number.isFinite(n))return null;let r=Math.max(160,Math.min(720,t*N));return Math.min(r,Math.max(160,Math.round(n)))}function F(){try{return P(localStorage.getItem(M))}catch{return null}}function I(e){try{let t=P(e);t===null?localStorage.removeItem(M):localStorage.setItem(M,String(t))}catch{}}var L=new Set,R;function z(e){L.add(e);let t=t=>{t.key!==null&&t.key!==`cez-tree-pane-width`||(R=void 0,e())};return window.addEventListener(`storage`,t),()=>{L.delete(e),window.removeEventListener(`storage`,t)}}function B(){return R===void 0?F():R}function V(e){I(e),R=F()===e?void 0:e;for(let e of L)e()}function H(){return[C.useSyncExternalStore(z,B,B),V]}function U(e){return e===null?{}:{style:{"--tree-pane-width":`${e}px`},className:`md:w-(--tree-pane-width)!`}}function W({paneRef:e,width:t,onWidthChange:n,className:r}){let i=C.useRef(null),a=()=>t??Math.round(e.current?.getBoundingClientRect().width??0),o=t=>P(t,e.current?.parentElement?.clientWidth||1/0),s=e=>{e.button===0&&(i.current={x:e.clientX,width:a()},e.currentTarget.setPointerCapture(e.pointerId),e.preventDefault(),e.currentTarget.focus())},l=e=>{let t=i.current;t&&n(o(t.width+(e.clientX-t.x)))},u=e=>{i.current&&(i.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))};return(0,w.jsx)(`div`,{"data-slot":`tree-pane-resize`,className:c(`relative -mr-5 w-0 shrink-0`,r),children:(0,w.jsx)(`div`,{"data-slot":`tree-pane-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize the file tree`,"aria-valuenow":t??void 0,"aria-valuemin":160,"aria-valuemax":720,tabIndex:0,onPointerDown:s,onPointerMove:l,onPointerUp:u,onPointerCancel:u,onKeyDown:e=>{let t=e.key===`ArrowLeft`?a()-16:e.key===`ArrowRight`?a()+16:e.key===`Home`?160:e.key===`End`?720:null;t!==null&&(e.preventDefault(),n(o(t)))},onDoubleClick:()=>n(null),title:`Drag to resize the file tree — double-click to reset`,className:`absolute inset-y-0 -left-[14px] z-10 w-2 cursor-col-resize touch-none rounded-full bg-transparent transition-colors hover:bg-violet/40 focus-visible:bg-violet/60 focus-visible:outline-none`})})}var G=(e,t)=>e.name.localeCompare(t.name);function K(e){let t=e;for(;t.files.length===0&&t.dirs.length===1;){let e=t.dirs[0];t={...e,name:`${t.name}/${e.name}`}}return{...t,dirs:t.dirs.map(K)}}function q(e,t){let n=(e,t)=>({kind:`dir`,name:e,path:t,dirs:[],files:[]}),r=n(``,``),i=new Map([[``,r]]),a=e=>{let t=i.get(e);if(t)return t;let r=e.lastIndexOf(`/`),o=a(r===-1?``:e.slice(0,r)),s=n(r===-1?e:e.slice(r+1),e);return o.dirs.push(s),i.set(e,s),s};for(let n of e){let e=n.lastIndexOf(`/`);a(e===-1?``:n.slice(0,e)).files.push(t(n,e===-1?n:n.slice(e+1)))}let o=e=>{e.dirs.forEach(o),e.dirs.sort(G),e.files.sort(G)};return o(r),{...r,dirs:r.dirs.map(K)}}function J(e){let t=new Map(e.map(e=>[e.path,e])),n=q(e.map(e=>e.path),(e,n)=>{let r=t.get(e);return{kind:`file`,name:n,path:e,status:r.status,adds:r.adds,dels:r.dels,binary:r.binary}}),r=e=>{let t=e.dirs.map(r);return{...e,dirs:t,adds:e.files.reduce((e,t)=>e+t.adds,0)+t.reduce((e,t)=>e+t.adds,0),dels:e.files.reduce((e,t)=>e+t.dels,0)+t.reduce((e,t)=>e+t.dels,0),fileCount:e.files.length+t.reduce((e,t)=>e+t.fileCount,0)}};return r(n)}var Y=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`bmp`,`ico`,`avif`]);function X(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?!1:Y.has(t.slice(n+1).toLowerCase())}function ie(e){return e.tooLarge?`too-large`:X(e.path)?`image`:e.binary?`binary`:`text`}function Z(e){return e>=1024**2?`${(e/1024**2).toFixed(1)} MB`:e>=1024?`${(e/1024).toFixed(1)} kB`:`${e} B`}function ae(e,t){let n=r(e.kind===`run`?e.runId:void 0,e.kind===`run`?t:void 0),a=i(e.kind===`repo`?t:void 0);return e.kind===`run`?n:a}function oe(e,t){return e.kind===`run`?o(e.runId,t):a(t)}function se({source:e,path:t,className:n}){let r=ae(e,t??void 0);if(t===null)return(0,w.jsx)($,{className:n,children:(0,w.jsx)(p,{icon:(0,w.jsx)(S,{}),tone:`neutral`,heading:`h2`,title:`Select a file`,subtitle:`Pick a file from the tree to preview it here.`})});if(r.isPending)return(0,w.jsx)($,{className:n,children:(0,w.jsxs)(`p`,{"data-slot":`file-preview-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:[`Loading `,t,`…`]})});if(r.isError){let e=r.error instanceof s&&r.error.status===409;return(0,w.jsx)($,{className:n,children:(0,w.jsx)(p,{icon:e?(0,w.jsx)(b,{}):(0,w.jsx)(f,{}),tone:e?`neutral`:`danger`,heading:`h2`,title:e?`Cannot preview this file`:`Could not load this file`,subtitle:r.error.message})})}return r.data.type===`file`?(0,w.jsx)(le,{source:e,entry:r.data,className:n}):null}function ce(e){return/\.(md|markdown|mdx)$/i.test(e)}var Q=`rendered`;function le({source:e,entry:t,className:n}){let r=ie(t),i=r===`text`&&ce(t.path),[a,o]=(0,C.useState)(Q),s=e=>{Q=e,o(e)};return(0,w.jsxs)($,{className:n,children:[(0,w.jsxs)(`header`,{"data-slot":`file-preview-head`,className:`sticky top-0 z-10 flex items-center gap-2 border-b border-border bg-[color-mix(in_oklab,var(--muted)_40%,var(--card))] px-4 py-2 text-xs shadow-[0_-1px_0_color-mix(in_oklab,var(--muted)_40%,var(--card))]`,children:[(0,w.jsx)(`span`,{className:`min-w-0 truncate font-mono font-medium`,children:t.path}),i?(0,w.jsx)(`div`,{"data-slot":`markdown-view-toggle`,className:`ml-auto flex shrink-0 overflow-hidden rounded-sm border border-border`,children:[`rendered`,`source`].map(e=>(0,w.jsx)(`button`,{type:`button`,"data-mode":e,"aria-pressed":a===e,onClick:()=>s(e),className:c(`px-2 py-0.5 capitalize`,a===e?`bg-muted font-medium text-foreground`:`text-soft-foreground hover:bg-muted`),children:e},e))}):null,(0,w.jsx)(`span`,{className:c(`shrink-0 tabular-nums text-soft-foreground`,i?`pl-2`:`ml-auto`),children:Z(t.size)})]}),r===`image`?(0,w.jsx)(`div`,{className:`flex justify-center p-4`,children:(0,w.jsx)(`img`,{"data-slot":`file-preview-image`,src:oe(e,t.path),alt:t.path,className:`max-h-[70vh] max-w-full rounded-sm`})}):r===`too-large`?(0,w.jsx)(p,{icon:(0,w.jsx)(v,{}),tone:`neutral`,heading:`h2`,title:`Too large to preview`,subtitle:`${Z(t.size)} — past the preview cap. Open it in your editor instead.`}):r===`binary`?(0,w.jsx)(p,{icon:(0,w.jsx)(y,{}),tone:`neutral`,heading:`h2`,title:`Binary file`,subtitle:`${Z(t.size)} of binary data — no text preview.`}):i&&a===`rendered`?(0,w.jsx)(`div`,{"data-slot":`file-preview-markdown`,className:`px-4 py-3`,children:(0,w.jsx)(g,{children:t.content??``})}):(0,w.jsx)(fe,{path:t.path,text:t.content??``})]})}function $({className:e,children:t}){return(0,w.jsx)(`section`,{"data-slot":`file-preview`,className:c(`overflow-clip rounded-lg border border-border bg-card`,e),children:t})}var ue=1500;function de(e,t){let n=(0,C.useMemo)(()=>t.split(`
2
- `).map(e=>[{content:e}]),[t]),r=(0,C.useMemo)(()=>h(e),[e]),i=n.length>ue,[a,o]=(0,C.useState)(null);return(0,C.useEffect)(()=>{if(r===null||i)return;let n=!1;return te(t,r).then(r=>{n||o({key:`${e}\0${t}`,tokens:r.tokens})}),()=>{n=!0}},[e,t,r,i]),r===null||i?n:a?.key===`${e}\0${t}`?a.tokens:m(t,r)?.tokens??n}function fe({path:e,text:t}){let n=de(e,t);return(0,w.jsx)(`div`,{"data-slot":`file-preview-code`,"data-lang":h(e)??`plaintext`,className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7]`,children:n.map((e,t)=>(0,w.jsxs)(`div`,{className:`flex px-4`,children:[(0,w.jsx)(`span`,{className:`w-10 shrink-0 select-none pr-3 text-right tabular-nums text-soft-foreground`,children:t+1}),(0,w.jsx)(`span`,{className:`min-w-0 flex-1 whitespace-pre pr-4`,children:e.map((e,t)=>(0,w.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t))})]},t))})}export{q as a,H as c,ne as d,x as f,J as i,T as l,Z as n,W as o,X as r,U as s,se as t,S as u};