@hoknie/aip 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (527) hide show
  1. package/dist/app/agents.js +2 -0
  2. package/dist/app/agents.js.map +1 -1
  3. package/dist/app/application.js +34 -2
  4. package/dist/app/application.js.map +1 -1
  5. package/dist/app/lifecycle.js +5 -1
  6. package/dist/app/lifecycle.js.map +1 -1
  7. package/dist/app/timings.js +1 -0
  8. package/dist/app/timings.js.map +1 -1
  9. package/dist/app/wiring.js +1 -0
  10. package/dist/app/wiring.js.map +1 -1
  11. package/dist/cli/main.js +0 -0
  12. package/dist/feature/agents/clients/agy/runtime.js +1 -0
  13. package/dist/feature/agents/clients/agy/runtime.js.map +1 -1
  14. package/dist/feature/agents/clients/claude/index.js +1 -0
  15. package/dist/feature/agents/clients/claude/index.js.map +1 -1
  16. package/dist/feature/agents/clients/claude/models.js +8 -0
  17. package/dist/feature/agents/clients/claude/models.js.map +1 -0
  18. package/dist/feature/agents/clients/claude/parser.js +8 -0
  19. package/dist/feature/agents/clients/claude/parser.js.map +1 -1
  20. package/dist/feature/agents/clients/claude/runtime.js +2 -0
  21. package/dist/feature/agents/clients/claude/runtime.js.map +1 -1
  22. package/dist/feature/agents/clients/opencode/index.js +1 -0
  23. package/dist/feature/agents/clients/opencode/index.js.map +1 -1
  24. package/dist/feature/agents/clients/opencode/models.js +38 -0
  25. package/dist/feature/agents/clients/opencode/models.js.map +1 -0
  26. package/dist/feature/agents/clients/opencode/runtime.js +2 -0
  27. package/dist/feature/agents/clients/opencode/runtime.js.map +1 -1
  28. package/dist/feature/agents/ports/command.js +2 -0
  29. package/dist/feature/agents/ports/command.js.map +1 -0
  30. package/dist/feature/agents/services/agents.js +42 -1
  31. package/dist/feature/agents/services/agents.js.map +1 -1
  32. package/dist/feature/agents/services/catalog.js +1 -1
  33. package/dist/feature/agents/services/catalog.js.map +1 -1
  34. package/dist/feature/agents/types/index.js +1 -0
  35. package/dist/feature/agents/types/index.js.map +1 -1
  36. package/dist/feature/agents/types/message.js +1 -0
  37. package/dist/feature/agents/types/message.js.map +1 -1
  38. package/dist/feature/agents/types/models.js +2 -0
  39. package/dist/feature/agents/types/models.js.map +1 -0
  40. package/dist/feature/agents/types/runtime.js.map +1 -1
  41. package/dist/feature/agents/types/worker-tools.js +2 -0
  42. package/dist/feature/agents/types/worker-tools.js.map +1 -1
  43. package/dist/feature/network/ports/changed.js +2 -0
  44. package/dist/feature/network/ports/changed.js.map +1 -0
  45. package/dist/feature/network/ports/index.js +2 -0
  46. package/dist/feature/network/ports/index.js.map +1 -0
  47. package/dist/feature/network/services/create.js +5 -0
  48. package/dist/feature/network/services/create.js.map +1 -0
  49. package/dist/feature/network/services/index.js +3 -0
  50. package/dist/feature/network/services/index.js.map +1 -0
  51. package/dist/feature/network/services/monitor.js +140 -0
  52. package/dist/feature/network/services/monitor.js.map +1 -0
  53. package/dist/feature/network/types/index.js +4 -0
  54. package/dist/feature/network/types/index.js.map +1 -0
  55. package/dist/feature/network/types/network.js +8 -0
  56. package/dist/feature/network/types/network.js.map +1 -0
  57. package/dist/feature/network/types/proxy.js +95 -0
  58. package/dist/feature/network/types/proxy.js.map +1 -0
  59. package/dist/feature/network/types/state.js +36 -0
  60. package/dist/feature/network/types/state.js.map +1 -0
  61. package/dist/feature/observers/repositories/observers.js +7 -1
  62. package/dist/feature/observers/repositories/observers.js.map +1 -1
  63. package/dist/feature/observers/services/observers.js +14 -4
  64. package/dist/feature/observers/services/observers.js.map +1 -1
  65. package/dist/feature/observers/services/settings-check.js +1 -7
  66. package/dist/feature/observers/services/settings-check.js.map +1 -1
  67. package/dist/feature/observers/types/plan-repairs.js +14 -7
  68. package/dist/feature/observers/types/plan-repairs.js.map +1 -1
  69. package/dist/feature/observers/types/settings.js +0 -1
  70. package/dist/feature/observers/types/settings.js.map +1 -1
  71. package/dist/feature/queue/services/control.js +23 -7
  72. package/dist/feature/queue/services/control.js.map +1 -1
  73. package/dist/feature/queue/types/advance.js +26 -11
  74. package/dist/feature/queue/types/advance.js.map +1 -1
  75. package/dist/feature/queue/types/returns.js +18 -3
  76. package/dist/feature/queue/types/returns.js.map +1 -1
  77. package/dist/feature/runs/machine/exits.js +23 -1
  78. package/dist/feature/runs/machine/exits.js.map +1 -1
  79. package/dist/feature/runs/machine/plan.js +38 -16
  80. package/dist/feature/runs/machine/plan.js.map +1 -1
  81. package/dist/feature/runs/machine/repair.js +5 -2
  82. package/dist/feature/runs/machine/repair.js.map +1 -1
  83. package/dist/feature/runs/machine/scheduler.js +10 -3
  84. package/dist/feature/runs/machine/scheduler.js.map +1 -1
  85. package/dist/feature/runs/machine/steps.js +7 -7
  86. package/dist/feature/runs/machine/steps.js.map +1 -1
  87. package/dist/feature/runs/machine/transition.js +5 -1
  88. package/dist/feature/runs/machine/transition.js.map +1 -1
  89. package/dist/feature/runs/repositories/finished-runs.js +14 -10
  90. package/dist/feature/runs/repositories/finished-runs.js.map +1 -1
  91. package/dist/feature/runs/services/create.js +1 -0
  92. package/dist/feature/runs/services/create.js.map +1 -1
  93. package/dist/feature/runs/services/effects/actions.js +3 -2
  94. package/dist/feature/runs/services/effects/actions.js.map +1 -1
  95. package/dist/feature/runs/services/effects/attempts.js +44 -4
  96. package/dist/feature/runs/services/effects/attempts.js.map +1 -1
  97. package/dist/feature/runs/services/effects/context.js.map +1 -1
  98. package/dist/feature/runs/services/effects/naming.js +4 -1
  99. package/dist/feature/runs/services/effects/naming.js.map +1 -1
  100. package/dist/feature/runs/services/effects/proxy.js +5 -0
  101. package/dist/feature/runs/services/effects/proxy.js.map +1 -0
  102. package/dist/feature/runs/services/engine.js +14 -5
  103. package/dist/feature/runs/services/engine.js.map +1 -1
  104. package/dist/feature/runs/services/index.js.map +1 -1
  105. package/dist/feature/runs/services/reads.js +40 -1
  106. package/dist/feature/runs/services/reads.js.map +1 -1
  107. package/dist/feature/runs/services/states.js +2 -2
  108. package/dist/feature/runs/services/states.js.map +1 -1
  109. package/dist/feature/runs/types/attempt.js +4 -0
  110. package/dist/feature/runs/types/attempt.js.map +1 -1
  111. package/dist/feature/runs/types/group.js.map +1 -1
  112. package/dist/feature/runs/types/input.js +33 -0
  113. package/dist/feature/runs/types/input.js.map +1 -1
  114. package/dist/feature/runs/types/limits.js +13 -1
  115. package/dist/feature/runs/types/limits.js.map +1 -1
  116. package/dist/feature/stats/repositories/index.js +4 -0
  117. package/dist/feature/stats/repositories/index.js.map +1 -0
  118. package/dist/feature/stats/repositories/meta.js +19 -0
  119. package/dist/feature/stats/repositories/meta.js.map +1 -0
  120. package/dist/feature/stats/repositories/records.js +46 -0
  121. package/dist/feature/stats/repositories/records.js.map +1 -0
  122. package/dist/feature/stats/repositories/report.js +105 -0
  123. package/dist/feature/stats/repositories/report.js.map +1 -0
  124. package/dist/feature/stats/services/create.js +44 -0
  125. package/dist/feature/stats/services/create.js.map +1 -0
  126. package/dist/feature/stats/services/index.js +4 -0
  127. package/dist/feature/stats/services/index.js.map +1 -0
  128. package/dist/feature/stats/services/ledger.js +137 -0
  129. package/dist/feature/stats/services/ledger.js.map +1 -0
  130. package/dist/feature/stats/services/report.js +56 -0
  131. package/dist/feature/stats/services/report.js.map +1 -0
  132. package/dist/feature/stats/types/aggregate.js +179 -0
  133. package/dist/feature/stats/types/aggregate.js.map +1 -0
  134. package/dist/feature/stats/types/capture.js +79 -0
  135. package/dist/feature/stats/types/capture.js.map +1 -0
  136. package/dist/feature/stats/types/index.js +6 -0
  137. package/dist/feature/stats/types/index.js.map +1 -0
  138. package/dist/feature/stats/types/records.js +5 -0
  139. package/dist/feature/stats/types/records.js.map +1 -0
  140. package/dist/feature/stats/types/report.js +25 -0
  141. package/dist/feature/stats/types/report.js.map +1 -0
  142. package/dist/feature/stats/types/settings.js +2 -0
  143. package/dist/feature/stats/types/settings.js.map +1 -0
  144. package/dist/feature/swarm-config/services/assemble.js +1 -1
  145. package/dist/feature/swarm-config/services/assemble.js.map +1 -1
  146. package/dist/feature/swarm-config/services/index.js +3 -2
  147. package/dist/feature/swarm-config/services/index.js.map +1 -1
  148. package/dist/feature/swarm-config/services/load.js +17 -2
  149. package/dist/feature/swarm-config/services/load.js.map +1 -1
  150. package/dist/feature/swarm-config/services/sections/stats.js +28 -0
  151. package/dist/feature/swarm-config/services/sections/stats.js.map +1 -0
  152. package/dist/feature/swarm-config/services/settings.js +23 -1
  153. package/dist/feature/swarm-config/services/settings.js.map +1 -1
  154. package/dist/feature/swarm-config/services/validate-actions.js +9 -1
  155. package/dist/feature/swarm-config/services/validate-actions.js.map +1 -1
  156. package/dist/feature/swarm-config/services/validate-runtimes.js +3 -1
  157. package/dist/feature/swarm-config/services/validate-runtimes.js.map +1 -1
  158. package/dist/feature/swarm-config/services/validate-settings.js +65 -0
  159. package/dist/feature/swarm-config/services/validate-settings.js.map +1 -1
  160. package/dist/feature/swarm-config/services/validate.js +17 -2
  161. package/dist/feature/swarm-config/services/validate.js.map +1 -1
  162. package/dist/feature/swarm-config/types/action.js +9 -0
  163. package/dist/feature/swarm-config/types/action.js.map +1 -1
  164. package/dist/feature/swarm-config/types/settings.js +35 -5
  165. package/dist/feature/swarm-config/types/settings.js.map +1 -1
  166. package/dist/feature/swarm-edit/services/config-edits.js +14 -1
  167. package/dist/feature/swarm-edit/services/config-edits.js.map +1 -1
  168. package/dist/feature/swarm-edit/services/editor-settings.js +36 -7
  169. package/dist/feature/swarm-edit/services/editor-settings.js.map +1 -1
  170. package/dist/feature/swarm-edit/services/plan-settings.js +3 -1
  171. package/dist/feature/swarm-edit/services/plan-settings.js.map +1 -1
  172. package/dist/feature/swarm-edit/types/editor.js.map +1 -1
  173. package/dist/feature/swarm-edit/types/setting-fields.js +12 -0
  174. package/dist/feature/swarm-edit/types/setting-fields.js.map +1 -1
  175. package/dist/platform/git/delivery.js +1 -1
  176. package/dist/platform/git/delivery.js.map +1 -1
  177. package/dist/platform/network/index.js +4 -0
  178. package/dist/platform/network/index.js.map +1 -0
  179. package/dist/platform/network/interfaces.js +7 -0
  180. package/dist/platform/network/interfaces.js.map +1 -0
  181. package/dist/platform/network/probe.js +128 -0
  182. package/dist/platform/network/probe.js.map +1 -0
  183. package/dist/platform/network/tunnel.js +87 -0
  184. package/dist/platform/network/tunnel.js.map +1 -0
  185. package/dist/platform/process/command.js +23 -0
  186. package/dist/platform/process/command.js.map +1 -0
  187. package/dist/platform/process/index.js +1 -0
  188. package/dist/platform/process/index.js.map +1 -1
  189. package/dist/platform/sqlite/migrations.js +2 -0
  190. package/dist/platform/sqlite/migrations.js.map +1 -1
  191. package/dist/platform/sqlite/stats-migration.js +42 -0
  192. package/dist/platform/sqlite/stats-migration.js.map +1 -0
  193. package/dist/presentation/cli/commands/stats.js +41 -0
  194. package/dist/presentation/cli/commands/stats.js.map +1 -0
  195. package/dist/presentation/cli/help.js +1 -1
  196. package/dist/presentation/cli/help.js.map +1 -1
  197. package/dist/presentation/cli/local/config-check.js +23 -5
  198. package/dist/presentation/cli/local/config-check.js.map +1 -1
  199. package/dist/presentation/cli/program.js +2 -0
  200. package/dist/presentation/cli/program.js.map +1 -1
  201. package/dist/presentation/format/index.js +1 -0
  202. package/dist/presentation/format/index.js.map +1 -1
  203. package/dist/presentation/format/queue.js +1 -1
  204. package/dist/presentation/format/queue.js.map +1 -1
  205. package/dist/presentation/format/runs.js +8 -1
  206. package/dist/presentation/format/runs.js.map +1 -1
  207. package/dist/presentation/format/stats.js +79 -0
  208. package/dist/presentation/format/stats.js.map +1 -0
  209. package/dist/presentation/ipc/contract/agents.js +18 -0
  210. package/dist/presentation/ipc/contract/agents.js.map +1 -1
  211. package/dist/presentation/ipc/contract/config.js +4 -0
  212. package/dist/presentation/ipc/contract/config.js.map +1 -1
  213. package/dist/presentation/ipc/contract/envelope.js +4 -1
  214. package/dist/presentation/ipc/contract/envelope.js.map +1 -1
  215. package/dist/presentation/ipc/contract/groups.js +9 -0
  216. package/dist/presentation/ipc/contract/groups.js.map +1 -1
  217. package/dist/presentation/ipc/contract/index.js +1 -0
  218. package/dist/presentation/ipc/contract/index.js.map +1 -1
  219. package/dist/presentation/ipc/contract/panel.js +11 -0
  220. package/dist/presentation/ipc/contract/panel.js.map +1 -1
  221. package/dist/presentation/ipc/contract/responses/index.js +1 -0
  222. package/dist/presentation/ipc/contract/responses/index.js.map +1 -1
  223. package/dist/presentation/ipc/contract/responses/stats.js +67 -0
  224. package/dist/presentation/ipc/contract/responses/stats.js.map +1 -0
  225. package/dist/presentation/ipc/contract/runs.js +6 -0
  226. package/dist/presentation/ipc/contract/runs.js.map +1 -1
  227. package/dist/presentation/ipc/contract/stats/stats.js +20 -0
  228. package/dist/presentation/ipc/contract/stats/stats.js.map +1 -0
  229. package/dist/presentation/ipc/handlers/config.js +1 -0
  230. package/dist/presentation/ipc/handlers/config.js.map +1 -1
  231. package/dist/presentation/ipc/handlers/groups.js +8 -0
  232. package/dist/presentation/ipc/handlers/groups.js.map +1 -1
  233. package/dist/presentation/ipc/handlers/runs.js +1 -1
  234. package/dist/presentation/ipc/handlers/runs.js.map +1 -1
  235. package/dist/presentation/ipc/handlers/stats.js +17 -0
  236. package/dist/presentation/ipc/handlers/stats.js.map +1 -0
  237. package/dist/presentation/ipc/handlers/system.js +2 -0
  238. package/dist/presentation/ipc/handlers/system.js.map +1 -1
  239. package/dist/presentation/ipc/handlers/table.js +2 -0
  240. package/dist/presentation/ipc/handlers/table.js.map +1 -1
  241. package/dist/presentation/ipc/publisher.js +1 -0
  242. package/dist/presentation/ipc/publisher.js.map +1 -1
  243. package/dist/presentation/ipc/views/catalog.js +3 -3
  244. package/dist/presentation/ipc/views/catalog.js.map +1 -1
  245. package/dist/presentation/ipc/views/index.js +1 -0
  246. package/dist/presentation/ipc/views/index.js.map +1 -1
  247. package/dist/presentation/ipc/views/queue.js +5 -1
  248. package/dist/presentation/ipc/views/queue.js.map +1 -1
  249. package/dist/presentation/ipc/views/runs.js +1 -1
  250. package/dist/presentation/ipc/views/runs.js.map +1 -1
  251. package/dist/presentation/ipc/views/stats.js +5 -0
  252. package/dist/presentation/ipc/views/stats.js.map +1 -0
  253. package/dist/presentation/mcp/worker-extra.js +2 -2
  254. package/dist/presentation/mcp/worker-extra.js.map +1 -1
  255. package/dist/presentation/mcp/worker-read.js +45 -0
  256. package/dist/presentation/mcp/worker-read.js.map +1 -0
  257. package/dist/presentation/mcp/worker.js +2 -0
  258. package/dist/presentation/mcp/worker.js.map +1 -1
  259. package/dist/presentation/web/hub.js +4 -0
  260. package/dist/presentation/web/hub.js.map +1 -1
  261. package/dist/presentation/web/panel/directories.js +1 -1
  262. package/dist/presentation/web/panel/directories.js.map +1 -1
  263. package/dist/presentation/web/panel/system.js +1 -0
  264. package/dist/presentation/web/panel/system.js.map +1 -1
  265. package/dist/presentation/web/request.js +28 -1
  266. package/dist/presentation/web/request.js.map +1 -1
  267. package/dist/presentation/web/routes/config.js +5 -0
  268. package/dist/presentation/web/routes/config.js.map +1 -1
  269. package/dist/presentation/web/routes/runs.js.map +1 -1
  270. package/dist/presentation/web/routes/stats/stats.js +22 -0
  271. package/dist/presentation/web/routes/stats/stats.js.map +1 -0
  272. package/dist/presentation/web/server.js +3 -1
  273. package/dist/presentation/web/server.js.map +1 -1
  274. package/dist/web/assets/FilterColumn-BCMp-JO4.js +1 -0
  275. package/dist/web/assets/SharedPipelinesGroup-DJRGFtzx.js +1 -0
  276. package/dist/web/assets/badge-C_7kALlW.js +1 -0
  277. package/dist/web/assets/{card-DkikoTxR.js → card-C9eXOVuF.js} +1 -1
  278. package/dist/web/assets/empty-ACC2KkXk.js +41 -0
  279. package/dist/web/assets/index-CsVQUXJH.js +21 -0
  280. package/dist/web/assets/index-Ds1nt_qm.css +2 -0
  281. package/dist/web/assets/locales-fB1w2oER.js +1 -0
  282. package/dist/web/assets/pipelines-DQglwIkL.js +10 -0
  283. package/dist/web/assets/queue-CAuAo--6.js +16 -0
  284. package/dist/web/assets/select-BSqaxwh1.js +1 -0
  285. package/dist/web/assets/settingFields-DVg9TQK2.js +1 -0
  286. package/dist/web/assets/settings-6eHKYbS7.js +2 -0
  287. package/dist/web/assets/skeleton-CfLYGtNX.js +1 -0
  288. package/dist/web/assets/specialists-Durm0DgK.js +1 -0
  289. package/dist/web/assets/stats-67akPa3A.js +1 -0
  290. package/dist/web/assets/topology-DQu3su19.js +1 -0
  291. package/dist/web/assets/trash-ChYI9ms1.js +1 -0
  292. package/dist/web/assets/useListDrag-0GPS1X83.js +1 -0
  293. package/dist/web/index.html +7 -6
  294. package/integrations/claude-code/.claude-plugin/plugin.json +1 -1
  295. package/package.json +1 -1
  296. package/dist/cli/clean.js +0 -71
  297. package/dist/cli/clean.js.map +0 -1
  298. package/dist/cli/commands.js +0 -963
  299. package/dist/cli/commands.js.map +0 -1
  300. package/dist/cli/config-check.js +0 -173
  301. package/dist/cli/config-check.js.map +0 -1
  302. package/dist/cli/daemon.js +0 -199
  303. package/dist/cli/daemon.js.map +0 -1
  304. package/dist/cli/help.js +0 -50
  305. package/dist/cli/help.js.map +0 -1
  306. package/dist/cli/init.js +0 -43
  307. package/dist/cli/init.js.map +0 -1
  308. package/dist/cli/io.js +0 -13
  309. package/dist/cli/io.js.map +0 -1
  310. package/dist/cli/probe.js +0 -12
  311. package/dist/cli/probe.js.map +0 -1
  312. package/dist/cli/program.js +0 -48
  313. package/dist/cli/program.js.map +0 -1
  314. package/dist/cli/setup.js +0 -406
  315. package/dist/cli/setup.js.map +0 -1
  316. package/dist/cli/version.js +0 -6
  317. package/dist/cli/version.js.map +0 -1
  318. package/dist/cli/watch.js +0 -24
  319. package/dist/cli/watch.js.map +0 -1
  320. package/dist/cli/web/daemon-panel.js +0 -185
  321. package/dist/cli/web/daemon-panel.js.map +0 -1
  322. package/dist/cli/web/default-repository.js +0 -12
  323. package/dist/cli/web/default-repository.js.map +0 -1
  324. package/dist/cli/web/errors.js +0 -60
  325. package/dist/cli/web/errors.js.map +0 -1
  326. package/dist/cli/web/open.js +0 -12
  327. package/dist/cli/web/open.js.map +0 -1
  328. package/dist/cli/web/page.js +0 -465
  329. package/dist/cli/web/page.js.map +0 -1
  330. package/dist/cli/web/server.js +0 -1191
  331. package/dist/cli/web/server.js.map +0 -1
  332. package/dist/cli/web/standby.js +0 -119
  333. package/dist/cli/web/standby.js.map +0 -1
  334. package/dist/cli/web/state.js +0 -69
  335. package/dist/cli/web/state.js.map +0 -1
  336. package/dist/cli/web/system.js +0 -66
  337. package/dist/cli/web/system.js.map +0 -1
  338. package/dist/cli/web-control.js +0 -173
  339. package/dist/cli/web-control.js.map +0 -1
  340. package/dist/config/discover.js +0 -25
  341. package/dist/config/discover.js.map +0 -1
  342. package/dist/config/duration.js +0 -17
  343. package/dist/config/duration.js.map +0 -1
  344. package/dist/config/edit.js +0 -966
  345. package/dist/config/edit.js.map +0 -1
  346. package/dist/config/errors.js +0 -29
  347. package/dist/config/errors.js.map +0 -1
  348. package/dist/config/index.js +0 -14
  349. package/dist/config/index.js.map +0 -1
  350. package/dist/config/load.js +0 -412
  351. package/dist/config/load.js.map +0 -1
  352. package/dist/config/merge.js +0 -45
  353. package/dist/config/merge.js.map +0 -1
  354. package/dist/config/model.js +0 -171
  355. package/dist/config/model.js.map +0 -1
  356. package/dist/config/paths.js +0 -31
  357. package/dist/config/paths.js.map +0 -1
  358. package/dist/config/prompt.js +0 -33
  359. package/dist/config/prompt.js.map +0 -1
  360. package/dist/config/shared-pipelines.js +0 -71
  361. package/dist/config/shared-pipelines.js.map +0 -1
  362. package/dist/config/shared-specialists.js +0 -68
  363. package/dist/config/shared-specialists.js.map +0 -1
  364. package/dist/config/shared-workflows.js +0 -71
  365. package/dist/config/shared-workflows.js.map +0 -1
  366. package/dist/config/specialist-tags.js +0 -214
  367. package/dist/config/specialist-tags.js.map +0 -1
  368. package/dist/config/tag-names.js +0 -43
  369. package/dist/config/tag-names.js.map +0 -1
  370. package/dist/config/validate.js +0 -872
  371. package/dist/config/validate.js.map +0 -1
  372. package/dist/core/artifacts.js +0 -37
  373. package/dist/core/artifacts.js.map +0 -1
  374. package/dist/core/create.js +0 -75
  375. package/dist/core/create.js.map +0 -1
  376. package/dist/core/delivery.js +0 -366
  377. package/dist/core/delivery.js.map +0 -1
  378. package/dist/core/errors.js +0 -7
  379. package/dist/core/errors.js.map +0 -1
  380. package/dist/core/ids.js +0 -99
  381. package/dist/core/ids.js.map +0 -1
  382. package/dist/core/index.js +0 -21
  383. package/dist/core/index.js.map +0 -1
  384. package/dist/core/input.js +0 -45
  385. package/dist/core/input.js.map +0 -1
  386. package/dist/core/machine.js +0 -1021
  387. package/dist/core/machine.js.map +0 -1
  388. package/dist/core/model.js +0 -460
  389. package/dist/core/model.js.map +0 -1
  390. package/dist/core/observer.js +0 -193
  391. package/dist/core/observer.js.map +0 -1
  392. package/dist/core/occupancy.js +0 -63
  393. package/dist/core/occupancy.js.map +0 -1
  394. package/dist/core/permissions.js +0 -222
  395. package/dist/core/permissions.js.map +0 -1
  396. package/dist/core/plan.js +0 -99
  397. package/dist/core/plan.js.map +0 -1
  398. package/dist/core/progress.js +0 -43
  399. package/dist/core/progress.js.map +0 -1
  400. package/dist/core/questions.js +0 -19
  401. package/dist/core/questions.js.map +0 -1
  402. package/dist/core/queue.js +0 -859
  403. package/dist/core/queue.js.map +0 -1
  404. package/dist/core/retryable.js +0 -8
  405. package/dist/core/retryable.js.map +0 -1
  406. package/dist/core/scheduler.js +0 -160
  407. package/dist/core/scheduler.js.map +0 -1
  408. package/dist/core/skip.js +0 -109
  409. package/dist/core/skip.js.map +0 -1
  410. package/dist/core/stages.js +0 -304
  411. package/dist/core/stages.js.map +0 -1
  412. package/dist/core/summary.js +0 -35
  413. package/dist/core/summary.js.map +0 -1
  414. package/dist/core/tags.js +0 -184
  415. package/dist/core/tags.js.map +0 -1
  416. package/dist/core/topology.js +0 -162
  417. package/dist/core/topology.js.map +0 -1
  418. package/dist/daemon/artifacts.js +0 -84
  419. package/dist/daemon/artifacts.js.map +0 -1
  420. package/dist/daemon/daemon.js +0 -1442
  421. package/dist/daemon/daemon.js.map +0 -1
  422. package/dist/daemon/executor.js +0 -749
  423. package/dist/daemon/executor.js.map +0 -1
  424. package/dist/daemon/helpers.js +0 -38
  425. package/dist/daemon/helpers.js.map +0 -1
  426. package/dist/daemon/index.js +0 -4
  427. package/dist/daemon/index.js.map +0 -1
  428. package/dist/daemon/logs.js +0 -69
  429. package/dist/daemon/logs.js.map +0 -1
  430. package/dist/daemon/observers.js +0 -93
  431. package/dist/daemon/observers.js.map +0 -1
  432. package/dist/daemon/patches.js +0 -76
  433. package/dist/daemon/patches.js.map +0 -1
  434. package/dist/daemon/ports.js +0 -2
  435. package/dist/daemon/ports.js.map +0 -1
  436. package/dist/daemon/processes.js +0 -98
  437. package/dist/daemon/processes.js.map +0 -1
  438. package/dist/daemon/repositories.js +0 -2
  439. package/dist/daemon/repositories.js.map +0 -1
  440. package/dist/daemon/server.js +0 -164
  441. package/dist/daemon/server.js.map +0 -1
  442. package/dist/daemon/supervisor.js +0 -140
  443. package/dist/daemon/supervisor.js.map +0 -1
  444. package/dist/daemon/timings.js +0 -23
  445. package/dist/daemon/timings.js.map +0 -1
  446. package/dist/git/delivery.js +0 -284
  447. package/dist/git/delivery.js.map +0 -1
  448. package/dist/git/index.js +0 -4
  449. package/dist/git/index.js.map +0 -1
  450. package/dist/git/runner.js +0 -60
  451. package/dist/git/runner.js.map +0 -1
  452. package/dist/git/workspace.js +0 -366
  453. package/dist/git/workspace.js.map +0 -1
  454. package/dist/mcp/host.js +0 -401
  455. package/dist/mcp/host.js.map +0 -1
  456. package/dist/mcp/index.js +0 -3
  457. package/dist/mcp/index.js.map +0 -1
  458. package/dist/mcp/tools.js +0 -19
  459. package/dist/mcp/tools.js.map +0 -1
  460. package/dist/mcp/version.js +0 -5
  461. package/dist/mcp/version.js.map +0 -1
  462. package/dist/mcp/worker.js +0 -230
  463. package/dist/mcp/worker.js.map +0 -1
  464. package/dist/presentation/web/routes/directories.js +0 -60
  465. package/dist/presentation/web/routes/directories.js.map +0 -1
  466. package/dist/protocol/autostart.js +0 -171
  467. package/dist/protocol/autostart.js.map +0 -1
  468. package/dist/protocol/build.js +0 -38
  469. package/dist/protocol/build.js.map +0 -1
  470. package/dist/protocol/catalog.js +0 -18
  471. package/dist/protocol/catalog.js.map +0 -1
  472. package/dist/protocol/client.js +0 -83
  473. package/dist/protocol/client.js.map +0 -1
  474. package/dist/protocol/format.js +0 -477
  475. package/dist/protocol/format.js.map +0 -1
  476. package/dist/protocol/index.js +0 -11
  477. package/dist/protocol/index.js.map +0 -1
  478. package/dist/protocol/messages.js +0 -598
  479. package/dist/protocol/messages.js.map +0 -1
  480. package/dist/protocol/style.js +0 -81
  481. package/dist/protocol/style.js.map +0 -1
  482. package/dist/protocol/transcript.js +0 -49
  483. package/dist/protocol/transcript.js.map +0 -1
  484. package/dist/protocol/views.js +0 -696
  485. package/dist/protocol/views.js.map +0 -1
  486. package/dist/runtime/catalog.js +0 -117
  487. package/dist/runtime/catalog.js.map +0 -1
  488. package/dist/runtime/claude.js +0 -399
  489. package/dist/runtime/claude.js.map +0 -1
  490. package/dist/runtime/index.js +0 -34
  491. package/dist/runtime/index.js.map +0 -1
  492. package/dist/runtime/message.js +0 -48
  493. package/dist/runtime/message.js.map +0 -1
  494. package/dist/runtime/naming.js +0 -69
  495. package/dist/runtime/naming.js.map +0 -1
  496. package/dist/runtime/opencode.js +0 -189
  497. package/dist/runtime/opencode.js.map +0 -1
  498. package/dist/runtime/skills.js +0 -17
  499. package/dist/runtime/skills.js.map +0 -1
  500. package/dist/runtime/transcript.js +0 -227
  501. package/dist/runtime/transcript.js.map +0 -1
  502. package/dist/runtime/types.js +0 -12
  503. package/dist/runtime/types.js.map +0 -1
  504. package/dist/runtime/which.js +0 -21
  505. package/dist/runtime/which.js.map +0 -1
  506. package/dist/store/index.js +0 -3
  507. package/dist/store/index.js.map +0 -1
  508. package/dist/store/schema.js +0 -286
  509. package/dist/store/schema.js.map +0 -1
  510. package/dist/store/store.js +0 -491
  511. package/dist/store/store.js.map +0 -1
  512. package/dist/web/assets/EntryList-CnfGgjEY.js +0 -1
  513. package/dist/web/assets/FilePath-C0X8-keS.js +0 -1
  514. package/dist/web/assets/SettingsForm-BcyBWJbn.js +0 -1
  515. package/dist/web/assets/SharedPipelinesGroup-a368-IQ0.js +0 -1
  516. package/dist/web/assets/index-B-oJ93zH.js +0 -22
  517. package/dist/web/assets/index-BZE36gYR.css +0 -2
  518. package/dist/web/assets/locales-DtRrxYzg.js +0 -1
  519. package/dist/web/assets/pipelines-D48ggDNe.js +0 -1
  520. package/dist/web/assets/queue-D8_RY4IY.js +0 -16
  521. package/dist/web/assets/select-J4oIrmYh.js +0 -1
  522. package/dist/web/assets/settings-B0-0Vaia.js +0 -2
  523. package/dist/web/assets/skeleton-CCKCQF5n.js +0 -1
  524. package/dist/web/assets/specialists-DH8tyluO.js +0 -1
  525. package/dist/web/assets/switch-CWFAgxG1.js +0 -41
  526. package/dist/web/assets/topology-CNQ28AB2.js +0 -7
  527. /package/dist/web/assets/{topology-DLioOiRN.css → pipelines-DLioOiRN.css} +0 -0
@@ -0,0 +1,21 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/queue-CAuAo--6.js","assets/rolldown-runtime-XKyaHtl9.js","assets/skeleton-CfLYGtNX.js","assets/vendor-react-C1iE8mnY.js","assets/empty-ACC2KkXk.js","assets/select-BSqaxwh1.js","assets/badge-C_7kALlW.js","assets/deliveryModes-funlvXVC.js","assets/useListDrag-0GPS1X83.js","assets/card-C9eXOVuF.js","assets/specialists-Durm0DgK.js","assets/FilterColumn-BCMp-JO4.js","assets/trash-ChYI9ms1.js","assets/pipelines-DQglwIkL.js","assets/settingFields-DVg9TQK2.js","assets/pipelines-DLioOiRN.css","assets/stats-67akPa3A.js","assets/settings-6eHKYbS7.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,n,t as r}from"./vendor-react-C1iE8mnY.js";import{$ as i,A as a,C as o,D as s,E as c,F as l,G as u,I as d,L as f,M as p,N as m,O as h,P as g,R as _,S as v,U as y,_ as b,a as x,b as S,d as C,f as w,g as T,j as E,k as D,l as O,n as k,o as ee,p as A,r as te,s as ne,t as j,u as re,v as M,w as ie,x as ae,y as oe,z as N}from"./skeleton-CfLYGtNX.js";import{a as P,n as se,o as ce,r as le,t as ue}from"./FilterColumn-BCMp-JO4.js";import{C as de,D as fe,E as pe,O as me,S as he,T as ge,_ as _e,a as F,b as ve,g as ye,h as be,i as xe,k as Se,l as Ce,m as we,n as Te,o as Ee,p as De,r as Oe,s as ke,t as Ae,v as je,w as Me,x as Ne,y as Pe}from"./empty-ACC2KkXk.js";import{a as Fe,i as Ie,l as Le,o as Re,r as ze,s as Be,t as I}from"./badge-C_7kALlW.js";import{i as Ve,n as He,r as Ue,t as We}from"./locales-fB1w2oER.js";import{n as Ge,t as Ke}from"./vendor-markdown-DwXfjc7L.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var L=e(t(),1),qe=n(),Je=class extends Error{status;code;constructor(e,t,n){super(t),this.status=e,this.code=n}};async function R(e,t){let n=await fetch(e,{credentials:`same-origin`,...t}),r=await n.json().catch(()=>({}));if(!n.ok)throw new Je(n.status,r.error??n.statusText,r.code);return r}function z(e,t={}){return R(e,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)})}var B=(e,t)=>({method:e,headers:{"content-type":`application/json`},body:JSON.stringify(t)}),V=encodeURIComponent,Ye=e=>e?`&level=${e}`:``;async function H(e,t){let n=await fetch(e,{credentials:`same-origin`,...t}),r=await n.json().catch(()=>({}));if(n.status===200)return r;if(n.status===422)return{ok:!1,reason:`invalid`,errors:r.errors??[],references:r.references??[]};if(n.status===409)return{ok:!1,reason:`conflict`,message:String(r.error??`conflict`)};throw new Je(n.status,String(r.error??n.statusText))}function Xe(e,t){return t===null?e:`${e}${e.includes(`?`)?`&`:`?`}repository=${V(t)}`}function Ze(e){let t=t=>Xe(t,e);return{pipelines:t=>R(Xe(`/api/pipelines`,t??e)),config:()=>R(t(`/api/config`)),catalog:()=>R(t(`/api/config/catalog`)),models:e=>R(t(`/api/config/models${e?`?refresh=1`:``}`)),writeSpecialist:(e,n,r,i)=>H(t(`/api/config/specialists/${V(e)}`),B(`PUT`,{value:n,revision:r,...i?{level:i}:{}})),deleteSpecialist:(e,n,r)=>H(t(`/api/config/specialists/${V(e)}?revision=${V(n)}${Ye(r)}`),{method:`DELETE`}),sharedSpecialists:()=>R(`/api/shared-specialists`),specialistTags:()=>R(`/api/specialist-tags`),importSpecialists:async(e,n)=>await H(t(`/api/config/specialists/import`),B(`POST`,{source:e,slugs:n})),sharedPipelines:()=>R(`/api/shared-pipelines`),importPipelines:async(e,n)=>await H(t(`/api/config/pipelines/import`),B(`POST`,{source:e,ids:n})),writeSetting:(e,n,r,i)=>H(t(`/api/config/settings/${V(e)}`),B(`PUT`,{value:n,revision:r,...i?{level:i}:{}})),writeSettings:(e,n,r)=>H(t(`/api/config/settings`),B(`PUT`,{values:e,revision:n,...r?{level:r}:{}})),writePipeline:(e,n,r,i)=>H(t(`/api/config/pipelines/${V(e)}`),B(`PUT`,{value:n,revision:r,...i?{level:i}:{}})),deletePipeline:(e,n,r)=>H(t(`/api/config/pipelines/${V(e)}?revision=${V(n)}${Ye(r)}`),{method:`DELETE`}),previewPipeline:(e,n,r)=>z(t(`/api/config/pipelines/${V(e)}/preview`),{value:n,...r?{level:r}:{}}),writeAction:(e,n,r,i)=>H(t(`/api/config/actions/${V(e)}`),B(`PUT`,{value:n,revision:r,...i?{level:i}:{}})),deleteAction:(e,n,r)=>H(t(`/api/config/actions/${V(e)}?revision=${V(n)}${Ye(r)}`),{method:`DELETE`}),writeChain:(e,n,r,i)=>H(t(`/api/config/chains/${V(e)}`),B(`PUT`,{value:n,revision:r,...i?{level:i}:{}})),deleteChain:(e,n,r)=>H(t(`/api/config/chains/${V(e)}?revision=${V(n)}${Ye(r)}`),{method:`DELETE`}),systemStages:()=>R(t(`/api/system-stages`))}}function Qe(e){return{tags:()=>R(e(`/api/tags`)),addTag:(t,n)=>z(e(`/api/tags`),n?{name:t,color:n}:{name:t}),editTag:(t,n)=>z(e(`/api/tags/edit`),{tag:t,...n}),removeTag:t=>z(e(`/api/tags/remove`),{tag:t}),queue:()=>R(e(`/api/queue`)),queueAdd:t=>z(e(`/api/queue/items`),t),queueEdit:(t,n)=>z(e(`/api/queue/items/${V(t)}`),n),queueRemove:t=>z(e(`/api/queue/items/${V(t)}/remove`)),queueRunNow:t=>z(e(`/api/queue/items/${V(t)}/run`)),queueStart:t=>z(e(`/api/queue/start`),t===void 0?{}:{parallel:t}),queuePause:()=>z(e(`/api/queue/pause`)),queueSettings:t=>z(e(`/api/queue/settings`),t),queueReturn:(e,t)=>z(Xe(`/api/queue/return`,t),{run:e}),queueDismiss:(e,t)=>z(Xe(`/api/queue/dismiss`,t),{run:e})}}function $e(){return{answer:(e,t,n)=>z(`/api/runs/${V(e)}/groups/${V(t)}/answer`,{answer:n}),message:(e,t,n,r)=>z(`/api/runs/${V(e)}/groups/${V(t)}/message`,{seq:n,text:r}),retry:(e,t,n)=>z(`/api/runs/${V(e)}/groups/${V(t)}/retry`,n?.refreshConfig?{refreshConfig:!0}:{}),skipStep:(e,t,n)=>z(`/api/runs/${V(e)}/skip`,{step:t,skip:n}),cancel:(e,t)=>z(t?`/api/runs/${V(e)}/groups/${V(t)}/cancel`:`/api/runs/${V(e)}/cancel`),apply:(e,t)=>z(`/api/runs/${V(e)}/apply`,t?{force:!0}:{}),markDelivered:(e,t)=>z(`/api/runs/${V(e)}/delivered`,t?{groups:t}:{}),setRunTitle:(e,t)=>z(`/api/runs/${V(e)}/title`,{title:t}),setRunTags:(e,t)=>z(`/api/runs/${V(e)}/tags`,t),pauseRun:(e,t)=>z(Xe(`/api/runs/${V(e)}/pause`,t))}}var et=50;function tt(){let e={runs:()=>R(`/api/runs`),finishedRuns:(e,t)=>R(`/api/finished-runs?limit=${et}${e?`&before=${V(e)}`:``}${t?`&repository=${V(t)}`:``}`),run:e=>R(`/api/runs/${V(e)}`),group:(e,t)=>R(`/api/runs/${V(e)}/groups/${V(t)}?tail=200`),groupSpec:(e,t)=>R(`/api/runs/${V(e)}/groups/${V(t)}/spec`),transcript:(e,t,n,r)=>R(`/api/runs/${V(e)}/groups/${V(t)}/transcript?seq=${n}&after=${r}`),fileDiff:(e,t,n)=>R(`/api/runs/${V(e)}/groups/${V(t)}/diff?path=${V(n)}`),groupArtifacts:async(e,t)=>(await R(`/api/runs/${V(e)}/groups/${V(t)}/artifacts`)).artifacts,artifactUrl:(e,t,n,r=!1)=>`/api/runs/${V(e)}/groups/${V(t)}/artifacts/${V(n)}${r?`?inline=1`:``}`,artifactText:async(t,n,r)=>{let i=await fetch(e.artifactUrl(t,n,r,!0),{credentials:`same-origin`});if(!i.ok){let e=await i.json().catch(()=>({}));throw new Je(i.status,e.error??i.statusText)}return i.text()},runPatch:async e=>{let t=await fetch(`/api/runs/${V(e)}/patch`,{credentials:`same-origin`});if(!t.ok){let e=await t.json().catch(()=>({}));throw new Je(t.status,e.error??t.statusText)}let n=/filename="([^"]+)"/.exec(t.headers.get(`content-disposition`)??``);return{blob:await t.blob(),fileName:n?.[1]??`${e}.patch`}}};return e}function nt(){return{statsReport:(e={})=>{let t=new URLSearchParams;e.since!==void 0&&t.set(`since`,String(e.since)),e.until!==void 0&&t.set(`until`,String(e.until)),e.repository&&t.set(`repository`,e.repository);let n=t.toString();return R(`/api/stats${n?`?${n}`:``}`)},statsClear:e=>R(`/api/stats?repository=${encodeURIComponent(e)}`,{method:`DELETE`})}}function rt(e){return e.repair??null}var it=e=>rt(e)?.active===!0,at=e=>e.kind,ot=e=>at(e)===`repair`,st=e=>e===`autopilot`||e===`observer`?e:`human`;function ct(e){if(typeof e!=`object`||!e)return null;let{settings:t,workers:n}=e;return typeof t!=`object`||!t||typeof n!=`object`||!n?null:{settings:{enabled:t.enabled===!0,workers:Number(t.workers??1),maxRepairs:Number(t.maxRepairs??1),projects:Array.isArray(t.projects)?t.projects:[],specialist:typeof t.specialist==`object`&&t.specialist!==null?t.specialist:{}},workers:{running:Array.isArray(n.running)?n.running:[],waiting:Number(n.waiting??0)}}}function lt(e){let t=ct(e);if(t===null)throw new Je(502,`Malformed answer of /api/observers`);return t}async function ut(e){let t=await fetch(`/api/observers`,{credentials:`same-origin`,...B(`PUT`,e)}),n=await t.json().catch(()=>({}));if(t.status===200)return{ok:!0,view:lt(n)};if(t.status===422)return{ok:!1,errors:n.errors??[]};throw new Je(t.status,String(n.error??t.statusText))}function dt(){return{repositories:()=>R(`/api/repositories`),addRepository:(e,t={})=>z(`/api/repositories`,{path:e,...t}),updateRepository:(e,t)=>R(`/api/repositories?repository=${V(e)}`,B(`PATCH`,t)),moveRepository:(e,t)=>z(`/api/repositories/move?repository=${V(e)}`,{to:t}),removeRepository:e=>R(`/api/repositories?repository=${V(e)}`,{method:`DELETE`}),directories:e=>R(e===void 0?`/api/directories`:`/api/directories?path=${V(e)}`),processes:()=>R(`/api/processes`),killProcess:e=>z(`/api/processes/${e}/kill`),system:()=>R(`/api/system`),restartWeb:async()=>void await z(`/api/system/web/restart`),restartDaemon:async e=>void await z(`/api/system/daemon/restart`,e?{force:!0}:{}),stopDaemon:async e=>void await z(`/api/system/daemon/stop`,e?{force:!0}:{}),startDaemon:async()=>void await z(`/api/system/daemon/start`),observers:async()=>lt(await R(`/api/observers`)),setObservers:ut,setRunObserver:(e,t,n)=>z(Xe(`/api/runs/${V(e)}/observer`,t),{enabled:n})}}var ft=[`claude`,`opencode`,`agy`,`command`],pt=[`running`,`finished`,`failed`,`cancelled`],mt=[`done`,`rejected`,`needs_human`],ht=e=>Number.isSafeInteger(e)&&e>=0&&Number.isFinite(new Date(e).getTime());function gt(e){if(!e||typeof e!=`object`)return!1;let t=e,n=[`running`,`done`,`rejected`,`needs_human`,`failed`,`cancelled`,`unknown`],r=e=>e===null||typeof e==`string`;return Array.isArray(t.items)&&Array.isArray(t.projects)&&t.projects.every(e=>typeof e==`string`)&&(t.nextCursor===null||typeof t.nextCursor==`string`)&&[20,50,100].includes(t.limit??0)&&ht(t.asOf)&&t.items.every(e=>{if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.id==`string`&&typeof t.runId==`string`&&Number.isSafeInteger(t.runNumber)&&typeof t.runTitle==`string`&&typeof t.repository==`string`&&Number.isSafeInteger(t.attemptSeq)&&ft.includes(t.runtime)&&r(t.model)&&ht(t.startedAt)&&(t.finishedAt===null||ht(t.finishedAt))&&pt.includes(t.status)&&(t.verdict===null||mt.includes(t.verdict))&&n.includes(t.result??``)&&r(t.failureKind)&&(t.usage===null||!!t.usage&&typeof t.usage==`object`&&Number.isSafeInteger(t.usage.inputTokens)&&t.usage.inputTokens>=0&&Number.isSafeInteger(t.usage.outputTokens)&&t.usage.outputTokens>=0&&(t.usage.costUsd===null||typeof t.usage.costUsd==`number`&&Number.isFinite(t.usage.costUsd)&&t.usage.costUsd>=0))})}async function _t(e={}){let t=new URLSearchParams;for(let n of[`repository`,`runtime`,`model`,`result`,`from`,`to`,`limit`,`cursor`]){let r=e[n];r!==void 0&&r!==``&&t.set(n,String(r))}let n=await R(`/api/observers/history${t.size?`?${t}`:``}`);if(!gt(n))throw new Je(502,`Malformed answer of /api/observers/history`);return n}function vt(e){let t={forRepository:n=>n===e?t:vt(n),...tt(),...$e(),...Qe(t=>Xe(t,e)),...dt(),...Ze(e),...nt(),observerHistory:_t};return t}var yt=vt(null),bt={type:`3rdParty`,init(e){u(e.options.react),y(e)}},U=r();function xt(e){return(0,U.jsx)(Se,{closeButton:!0,position:`bottom-right`,...e})}var St=Object.defineProperty,Ct=(e,t)=>St(e,`name`,{value:t,configurable:!0}),wt=`Collapsible`,[Tt,Et]=p(wt),[Dt,Ot]=Tt(wt),kt=L.forwardRef(Ct(function(e,t){let{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:o,...c}=e,[l,u]=D({prop:r,defaultProp:i??!1,onChange:o,caller:wt});return(0,U.jsx)(Dt,{scope:n,disabled:a,contentId:s(),open:l,onOpenToggle:L.useCallback(()=>u(e=>!e),[u]),children:(0,U.jsx)(m.div,{"data-state":Ft(l),"data-disabled":a?``:void 0,...c,ref:t})})},`Collapsible`)),At=`CollapsibleTrigger`,jt=L.forwardRef(Ct(function(e,t){let{__scopeCollapsible:n,...r}=e,i=Ot(At,n);return(0,U.jsx)(m.button,{type:`button`,"aria-controls":i.open?i.contentId:void 0,"aria-expanded":i.open||!1,"data-state":Ft(i.open),"data-disabled":i.disabled?``:void 0,disabled:i.disabled,...r,ref:t,onClick:a(e.onClick,i.onOpenToggle)})},`CollapsibleTrigger`)),Mt=`CollapsibleContent`,Nt=L.forwardRef(Ct(function(e,t){let{forceMount:n,...r}=e,i=Ot(Mt,e.__scopeCollapsible);return(0,U.jsx)(h,{present:n||i.open,children:({present:e})=>(0,U.jsx)(Pt,{...r,ref:t,present:e})})},`CollapsibleContent`)),Pt=L.forwardRef(Ct(function(e,t){let{__scopeCollapsible:n,present:r,children:i,...a}=e,o=Ot(Mt,n),[s,c]=L.useState(r),l=L.useRef(null),u=_(t,l),d=L.useRef(0),f=d.current,p=L.useRef(0),h=p.current,g=o.open||s,v=L.useRef(g),y=L.useRef(void 0);return L.useEffect(()=>{let e=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(e)},[]),E(()=>{let e=l.current;if(e){y.current=y.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();d.current=t.height,p.current=t.width,v.current||(e.style.transitionDuration=y.current.transitionDuration,e.style.animationName=y.current.animationName),c(r)}},[o.open,r]),(0,U.jsx)(m.div,{"data-state":Ft(o.open),"data-disabled":o.disabled?``:void 0,id:o.contentId,hidden:!g,...a,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":h?`${h}px`:void 0,...e.style},children:g&&i})},`CollapsibleContentImpl`));function Ft(e){return e?`open`:`closed`}Ct(Ft,`getState`);var It=Object.defineProperty,Lt=(e,t)=>It(e,`name`,{value:t,configurable:!0}),Rt=`Checkbox`,[zt,Bt]=p(Rt),[Vt,Ht]=zt(Rt);function Ut(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=D({prop:n,defaultProp:i??!1,onChange:c,caller:Rt}),[m,h]=L.useState(null),[g,_]=L.useState(null),[v,y]=L.useState(null),b=!m||!!o||!!m.closest(`form`),x={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,userClick:v,onUserClick:y,required:l,defaultChecked:!W(i)&&i,isFormControl:b,bubbleInput:g,setBubbleInput:_};return(0,U.jsx)(Vt,{scope:t,...x,children:Zt(d)?d(x):r})}Lt(Ut,`CheckboxProvider`);var Wt=`CheckboxTrigger`,Gt=L.forwardRef(Lt(function({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i){let{control:o,value:s,disabled:c,checked:l,required:u,setControl:d,setChecked:f,onUserClick:p,isFormControl:h,bubbleInput:g}=Ht(Wt,e),v=_(i,d),y=L.useRef(l);return L.useEffect(()=>{let e=o?.form;if(e){let t=Lt(()=>f(y.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[o,f]),(0,U.jsx)(m.button,{type:`button`,role:`checkbox`,"aria-checked":W(l)?`mixed`:l,"aria-required":u,"data-state":Qt(l),"data-disabled":c?``:void 0,disabled:c,value:s,...r,ref:v,onKeyDown:a(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:a(n,e=>{let t=e.isPropagationStopped();p({requestedChecked:W(l)?!0:!l,hasConsumerStoppedPropagation:t}),f(e=>W(e)?!0:!e),g&&h&&(t||e.stopPropagation())})})},`CheckboxTrigger`)),Kt=L.forwardRef(Lt(function(e,t){let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,U.jsx)(Ut,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Gt,{...d,ref:t,__scopeCheckbox:n}),e&&(0,U.jsx)(Xt,{__scopeCheckbox:n})]})})},`Checkbox`)),qt=`CheckboxIndicator`,Jt=L.forwardRef(Lt(function(e,t){let{__scopeCheckbox:n,forceMount:r,...i}=e,a=Ht(qt,n);return(0,U.jsx)(h,{present:r||W(a.checked)||a.checked===!0,children:(0,U.jsx)(m.span,{"data-state":Qt(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})},`CheckboxIndicator`)),Yt=`CheckboxBubbleInput`,Xt=L.forwardRef(Lt(function({__scopeCheckbox:e,onClick:t,...n},r){let{control:i,userClick:o,checked:s,defaultChecked:c,required:l,disabled:u,name:d,value:f,form:p,bubbleInput:h,setBubbleInput:g}=Ht(Yt,e),v=_(r,g),y=Be(i),b=L.useRef(!1),x=L.useRef(s),S=L.useRef(o),C=L.useRef(null);L.useEffect(()=>{let e=h;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set;if(!n)return;let r=x.current!==s;x.current=s;let i=o!==null&&o!==S.current;if(S.current=o,i)C.current=r?null:o,r&&(e.indeterminate=W(s),n.call(e,!W(s)&&s)),e.dispatchEvent(new Event(`click`,{bubbles:!o.hasConsumerStoppedPropagation}));else if(r){let t=C.current;C.current=null;let r=t?.requestedChecked===s;b.current=!0,e.indeterminate=W(s),n.call(e,!W(s)&&s),e.dispatchEvent(new Event(`click`,{bubbles:!(r&&t.hasConsumerStoppedPropagation)})),b.current=!1}},[h,s,o]);let w=L.useRef(!W(s)&&s);return(0,U.jsx)(m.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:c??w.current,required:l,disabled:u,name:d,value:f,form:p,...n,tabIndex:-1,ref:v,onClick:a(t,e=>{b.current&&e.stopPropagation()}),style:{...n.style,...y,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`CheckboxBubbleInput`));function Zt(e){return typeof e==`function`}Lt(Zt,`isFunction`);function W(e){return e===`indeterminate`}Lt(W,`isIndeterminate`);function Qt(e){return W(e)?`indeterminate`:e?`checked`:`unchecked`}Lt(Qt,`getState`);var $t=Object.defineProperty,G=(e,t)=>$t(e,`name`,{value:t,configurable:!0}),en=[`Enter`,` `],tn=[`ArrowDown`,`PageUp`,`Home`],nn=[`ArrowUp`,`PageDown`,`End`],rn=[...tn,...nn];[...en],[...en];var an=`Menu`,[on,sn,cn]=me(an),[ln,un]=p(an,[cn,Re,be]),dn=Re(),fn=be(),[pn,mn]=ln(an),[hn,gn]=ln(an),_n=G(e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=dn(t),[l,u]=L.useState(null),d=L.useRef(!1),f=c(a),p=fe(i);return L.useEffect(()=>{let e=G(()=>{d.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},`handleKeyDown`),t=G(()=>d.current=!1,`handlePointer`);return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),L.useEffect(()=>{if(!n)return;let e=G(()=>f(!1),`handleBlur`);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,f]),(0,U.jsx)(ze,{...s,children:(0,U.jsx)(pn,{scope:t,open:n,onOpenChange:f,content:l,onContentChange:u,children:(0,U.jsx)(hn,{scope:t,onClose:L.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:p,modal:o,children:r})})})},`Menu`),vn=L.forwardRef(G(function(e,t){let{__scopeMenu:n,...r}=e,i=dn(n);return(0,U.jsx)(Ie,{...i,...r,ref:t})},`MenuAnchor`)),yn=`MenuPortal`,[bn,xn]=ln(yn,{forceMount:void 0}),Sn=G(e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=mn(yn,t);return(0,U.jsx)(bn,{scope:t,forceMount:n,children:(0,U.jsx)(h,{present:n||a.open,children:(0,U.jsx)(oe,{asChild:!0,container:i,children:r})})})},`MenuPortal`),Cn=`MenuContent`,[wn,Tn]=ln(Cn),En=L.forwardRef(G(function(e,t){let n=xn(Cn,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=mn(Cn,e.__scopeMenu),o=gn(Cn,e.__scopeMenu);return(0,U.jsx)(on.Provider,{scope:e.__scopeMenu,children:(0,U.jsx)(h,{present:r||a.open,children:(0,U.jsx)(on.Slot,{scope:e.__scopeMenu,children:o.modal?(0,U.jsx)(Dn,{...i,ref:t}):(0,U.jsx)(On,{...i,ref:t})})})})},`MenuContent`)),Dn=L.forwardRef(G(function(e,t){let n=mn(Cn,e.__scopeMenu),r=L.useRef(null),i=_(t,r);return L.useEffect(()=>{let e=r.current;if(e)return Me(e)},[]),(0,U.jsx)(An,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:a(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentModal`)),On=L.forwardRef(G(function(e,t){let n=mn(Cn,e.__scopeMenu);return(0,U.jsx)(An,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentNonModal`)),kn=l(`MenuContent.ScrollLock`),An=L.forwardRef(G(function(e,t){let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:c,disableOutsidePointerEvents:l,onEntryFocus:u,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:p,onInteractOutside:m,onDismiss:h,disableOutsideScroll:g,...y}=e,b=mn(Cn,n),x=gn(Cn,n),C=dn(n),w=fn(n),T=sn(n),[E,D]=L.useState(null),O=L.useRef(null),[k,ee]=L.useState(null);v(k);let{nodes:A,registry:te}=o(),ne=!!(i||g),j=_(t,O,b.onContentChange,ee),re=L.useRef(0),M=L.useRef(``),oe=L.useRef(0),N=L.useRef(null),P=L.useRef(`right`),se=L.useRef(0),ce=L.useMemo(()=>g?[O,...A.map(e=>({current:e}))]:[],[O,A,g]),le=g?ge:L.Fragment,ue=g?{as:kn,allowPinchZoom:!0,shards:ce}:void 0,de=G(e=>{let t=M.current+e,n=T().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=$n(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;function s(e){M.current=e,window.clearTimeout(re.current),e!==``&&(re.current=window.setTimeout(()=>s(``),1e3))}G(s,`updateSearch`),s(t),o&&setTimeout(()=>o.focus())},`handleTypeaheadSearch`);L.useEffect(()=>()=>window.clearTimeout(re.current),[]),pe();let fe=L.useCallback(e=>P.current===N.current?.side&&tr(e,N.current?.area),[]);return(0,U.jsx)(wn,{scope:n,searchRef:M,onItemEnter:L.useCallback(e=>{fe(e)&&e.preventDefault()},[fe]),onItemLeave:L.useCallback(e=>{fe(e)||(O.current?.focus(),D(null))},[fe]),onTriggerLeave:L.useCallback(e=>{fe(e)&&e.preventDefault()},[fe]),pointerGraceTimerRef:oe,onPointerGraceIntentChange:L.useCallback(e=>{N.current=e},[]),children:(0,U.jsx)(ae,{registry:ne?te:null,children:(0,U.jsx)(le,{...ue,children:(0,U.jsx)(S,{asChild:!0,trapped:i,branches:A,onMountAutoFocus:a(s,e=>{e.preventDefault(),O.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:c,children:(0,U.jsx)(ie,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:p,onInteractOutside:m,onDismiss:h,children:(0,U.jsx)(De,{asChild:!0,...w,dir:x.dir,orientation:`vertical`,loop:r,currentTabStopId:E,onCurrentTabStopIdChange:D,onEntryFocus:a(u,e=>{x.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,U.jsx)(Fe,{role:`menu`,"aria-orientation":`vertical`,"data-state":Jn(b.open),"data-radix-menu-content":``,dir:x.dir,...C,...y,ref:j,style:{outline:`none`,...y.style},onKeyDown:a(y.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&de(e.key));let i=O.current;if(e.target!==i||!rn.includes(e.key))return;e.preventDefault();let a=T().filter(e=>!e.disabled).map(e=>e.ref.current);nn.includes(e.key)&&a.reverse(),Zn(a)}),onBlur:a(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(re.current),M.current=``)}),onPointerMove:a(e.onPointerMove,nr(e=>{let t=e.target,n=se.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>se.current?`right`:`left`;P.current=t,se.current=e.clientX}}))})})})})})})})},`MenuContentImpl`)),jn=L.forwardRef(G(function(e,t){let{__scopeMenu:n,...r}=e;return(0,U.jsx)(m.div,{role:`group`,...r,ref:t})},`MenuGroup`)),Mn=`MenuItem`,Nn=`menu.itemSelect`,Pn=L.forwardRef(G(function(e,t){let{disabled:n=!1,onSelect:r,...i}=e,o=L.useRef(null),s=gn(Mn,e.__scopeMenu),c=Tn(Mn,e.__scopeMenu),l=_(t,o),u=L.useRef(!1),d=G(()=>{let e=o.current;if(!n&&e){let t=new CustomEvent(Nn,{bubbles:!0,cancelable:!0});e.addEventListener(Nn,e=>r?.(e),{once:!0}),g(e,t),t.defaultPrevented?u.current=!1:s.onClose()}},`handleSelect`);return(0,U.jsx)(Fn,{...i,ref:l,disabled:n,onClick:a(e.onClick,d),onPointerDown:t=>{e.onPointerDown?.(t),u.current=!0},onPointerUp:a(e.onPointerUp,e=>{u.current||e.currentTarget?.click()}),onKeyDown:a(e.onKeyDown,e=>{n||e.target!==e.currentTarget||(c.searchRef.current===``||e.key!==` `)&&en.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},`MenuItem`)),Fn=L.forwardRef(G(function(e,t){let{__scopeMenu:n,disabled:r=!1,textValue:i,...o}=e,s=Tn(Mn,n),c=fn(n),l=L.useRef(null),u=_(t,l),[d,f]=L.useState(!1),[p,h]=L.useState(``);return L.useEffect(()=>{let e=l.current;e&&h((e.textContent??``).trim())},[o.children]),(0,U.jsx)(on.ItemSlot,{scope:n,disabled:r,textValue:i??p,children:(0,U.jsx)(we,{asChild:!0,...c,focusable:!r,children:(0,U.jsx)(m.div,{role:`menuitem`,"data-highlighted":d?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...o,ref:u,onPointerMove:a(e.onPointerMove,nr(e=>{r?s.onItemLeave(e):(s.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:a(e.onPointerLeave,nr(e=>s.onItemLeave(e))),onFocus:a(e.onFocus,()=>f(!0)),onBlur:a(e.onBlur,()=>f(!1))})})})},`MenuItemImpl`)),[In,Ln]=ln(`MenuRadioGroup`,{value:void 0,onValueChange:G(()=>{},`onValueChange`)}),Rn=L.forwardRef(G(function(e,t){let{value:n,onValueChange:r,...i}=e,a=c(r);return(0,U.jsx)(In,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,U.jsx)(jn,{...i,ref:t})})},`MenuRadioGroup`)),zn=`MenuRadioItem`,Bn=L.forwardRef(G(function(e,t){let{value:n,...r}=e,i=Ln(zn,e.__scopeMenu),o=n===i.value;return(0,U.jsx)(Hn,{scope:e.__scopeMenu,checked:o,children:(0,U.jsx)(Pn,{role:`menuitemradio`,"aria-checked":o,...r,ref:t,"data-state":Xn(o),onSelect:a(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})},`MenuRadioItem`)),Vn=`MenuItemIndicator`,[Hn,Un]=ln(Vn,{checked:!1}),Wn=L.forwardRef(G(function(e,t){let{__scopeMenu:n,forceMount:r,...i}=e,a=Un(Vn,n);return(0,U.jsx)(h,{present:r||Yn(a.checked)||a.checked===!0,children:(0,U.jsx)(m.span,{...i,ref:t,"data-state":Xn(a.checked)})})},`MenuItemIndicator`)),Gn=L.forwardRef(G(function(e,t){let{__scopeMenu:n,...r}=e;return(0,U.jsx)(m.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})},`MenuSeparator`)),[Kn,qn]=ln(`MenuSub`);function Jn(e){return e?`open`:`closed`}G(Jn,`getOpenState`);function Yn(e){return e===`indeterminate`}G(Yn,`isIndeterminate`);function Xn(e){return Yn(e)?`indeterminate`:e?`checked`:`unchecked`}G(Xn,`getCheckedState`);function Zn(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}G(Zn,`focusFirst`);function Qn(e,t){return e.map((n,r)=>e[(t+r)%e.length])}G(Qn,`wrapArray`);function $n(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Qn(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}G($n,`getNextMatch`);function er(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}G(er,`isPointInPolygon`);function tr(e,t){return t?er({x:e.clientX,y:e.clientY},t):!1}G(tr,`isPointerInGraceArea`);function nr(e){return t=>t.pointerType===`mouse`?e(t):void 0}G(nr,`whenMouse`);var rr=Object.defineProperty,ir=(e,t)=>rr(e,`name`,{value:t,configurable:!0}),ar=`DropdownMenu`,[or,sr]=p(ar,[un]),cr=un(),[lr,ur]=or(ar),dr=ir(e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:c=!0}=e,l=cr(t),u=L.useRef(null),[d,f]=D({prop:i,defaultProp:a??!1,onChange:o,caller:ar});return(0,U.jsx)(lr,{scope:t,triggerId:s(),triggerRef:u,contentId:s(),open:d,onOpenChange:f,onOpenToggle:L.useCallback(()=>f(e=>!e),[f]),modal:c,children:(0,U.jsx)(_n,{...l,open:d,onOpenChange:f,dir:r,modal:c,children:n})})},`DropdownMenu`),fr=`DropdownMenuTrigger`,pr=L.forwardRef(ir(function(e,t){let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,o=ur(fr,n),s=cr(n),c=_(t,o.triggerRef);return(0,U.jsx)(vn,{asChild:!0,...s,children:(0,U.jsx)(m.button,{type:`button`,id:o.triggerId,"aria-haspopup":`menu`,"aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:c,onPointerDown:a(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(o.onOpenToggle(),o.open||e.preventDefault())}),onKeyDown:a(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&o.onOpenToggle(),e.key===`ArrowDown`&&o.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})},`DropdownMenuTrigger`)),mr=ir(e=>{let{__scopeDropdownMenu:t,...n}=e,r=cr(t);return(0,U.jsx)(Sn,{...r,...n})},`DropdownMenuPortal`),hr=`DropdownMenuContent`,gr=L.forwardRef(ir(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=ur(hr,n),o=cr(n),s=L.useRef(!1);return(0,U.jsx)(En,{id:i.contentId,"aria-labelledby":i.triggerId,...o,...r,ref:t,onCloseAutoFocus:a(e.onCloseAutoFocus,e=>{s.current||i.triggerRef.current?.focus(),s.current=!1,e.preventDefault()}),onInteractOutside:a(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(s.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuContent`)),_r=L.forwardRef(ir(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=cr(n);return(0,U.jsx)(Pn,{...i,...r,ref:t})},`DropdownMenuItem`)),vr=L.forwardRef(ir(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=cr(n);return(0,U.jsx)(Rn,{...i,...r,ref:t})},`DropdownMenuRadioGroup`)),yr=L.forwardRef(ir(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=cr(n);return(0,U.jsx)(Bn,{...i,...r,ref:t})},`DropdownMenuRadioItem`)),br=L.forwardRef(ir(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=cr(n);return(0,U.jsx)(Wn,{...i,...r,ref:t})},`DropdownMenuItemIndicator`)),xr=L.forwardRef(ir(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=cr(n);return(0,U.jsx)(Gn,{...i,...r,ref:t})},`DropdownMenuSeparator`)),Sr=Object.defineProperty,Cr=L.forwardRef(((e,t)=>Sr(e,`name`,{value:t,configurable:!0}))(function(e,t){return(0,U.jsx)(m.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}})},`Label`)),wr=Object.defineProperty,Tr=(e,t)=>wr(e,`name`,{value:t,configurable:!0}),Er=`Popover`,[Dr,Or]=p(Er,[Re]),kr=Re(),[Ar,jr]=Dr(Er),Mr=Tr(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,c=kr(t),l=L.useRef(null),[u,d]=L.useState(!1),[f,p]=L.useState(0),[m,h]=L.useState(0),[g,_]=D({prop:r,defaultProp:i??!1,onChange:a,caller:Er});return(0,U.jsx)(ze,{...c,children:(0,U.jsx)(Ar,{scope:t,contentId:s(),titleId:s(),descriptionId:s(),titlePresent:f>0,descriptionPresent:m>0,setTitleCount:p,setDescriptionCount:h,triggerRef:l,open:g,onOpenChange:_,onOpenToggle:L.useCallback(()=>_(e=>!e),[_]),hasCustomAnchor:u,onCustomAnchorAdd:L.useCallback(()=>d(!0),[]),onCustomAnchorRemove:L.useCallback(()=>d(!1),[]),modal:o,children:n})})},`Popover`),Nr=`PopoverTrigger`,Pr=L.forwardRef(Tr(function(e,t){let{__scopePopover:n,...r}=e,i=jr(Nr,n),o=kr(n),s=_(t,i.triggerRef),c=(0,U.jsx)(m.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":Gr(i.open),...r,ref:s,onClick:a(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?c:(0,U.jsx)(Ie,{asChild:!0,...o,children:c})},`PopoverTrigger`)),Fr=`PopoverPortal`,[Ir,Lr]=Dr(Fr,{forceMount:void 0}),Rr=Tr(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=jr(Fr,t);return(0,U.jsx)(Ir,{scope:t,forceMount:n,children:(0,U.jsx)(h,{present:n||a.open,children:(0,U.jsx)(oe,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),zr=`PopoverContent`,Br=L.forwardRef(Tr(function(e,t){let n=Lr(zr,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=jr(zr,e.__scopePopover);return(0,U.jsx)(h,{present:r||a.open,children:a.modal?(0,U.jsx)(Hr,{...i,ref:t}):(0,U.jsx)(Ur,{...i,ref:t})})},`PopoverContent`)),Vr=l(`PopoverContent.RemoveScroll`),Hr=L.forwardRef(Tr(function(e,t){let n=jr(zr,e.__scopePopover),r=L.useRef(null),i=_(t,r),s=L.useRef(!1),{nodes:c,registry:l}=o();return L.useEffect(()=>{let e=r.current;if(e)return Me(e)},[]),(0,U.jsx)(ge,{as:Vr,allowPinchZoom:!0,shards:L.useMemo(()=>[r,...c.map(e=>({current:e}))],[r,c]),children:(0,U.jsx)(Wr,{...e,ref:i,branchNodes:c,branchRegistry:l,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:a(e.onCloseAutoFocus,e=>{e.preventDefault(),s.current||n.triggerRef.current?.focus()}),onPointerDownOutside:a(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;s.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:a(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),Ur=L.forwardRef(Tr(function(e,t){let n=jr(zr,e.__scopePopover),r=L.useRef(!1),i=L.useRef(!1);return(0,U.jsx)(Wr,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),Wr=L.forwardRef(Tr(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,"aria-describedby":d,branchNodes:f,branchRegistry:p,...m}=e,h=jr(zr,n),g=kr(n),[y,b]=L.useState(null),x=_(t,b);return v(y),pe(),(0,U.jsx)(ae,{registry:p,children:(0,U.jsx)(S,{asChild:!0,loop:!0,trapped:r,branches:f,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,U.jsx)(ie,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>h.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,U.jsx)(Fe,{"data-state":Gr(h.open),role:`dialog`,id:h.contentId,"aria-labelledby":h.titlePresent?h.titleId:void 0,"aria-describedby":h.descriptionPresent?Kr(d,h.descriptionId):d,...g,...m,ref:x,style:{...m.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})})},`PopoverContentImpl`));function Gr(e){return e?`open`:`closed`}Tr(Gr,`getState`);function Kr(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}Tr(Kr,`concatAriaDescribedby`);var qr=Object.defineProperty,Jr=(e,t)=>qr(e,`name`,{value:t,configurable:!0}),Yr=`Switch`,[Xr,Zr]=p(Yr),[Qr,$r]=Xr(Yr);function ei(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=D({prop:n,defaultProp:i??!1,onChange:c,caller:Yr}),[m,h]=L.useState(null),[g,_]=L.useState(null),[v,y]=L.useState(null),b={checked:f,setChecked:p,disabled:a,control:m,setControl:h,name:s,form:o,value:u,userClick:v,onUserClick:y,required:l,defaultChecked:i,isFormControl:!m||!!o||!!m.closest(`form`),bubbleInput:g,setBubbleInput:_};return(0,U.jsx)(Qr,{scope:t,...b,children:ci(d)?d(b):r})}Jr(ei,`SwitchProvider`);var ti=`SwitchTrigger`,ni=L.forwardRef(Jr(function({__scopeSwitch:e,onClick:t,...n},r){let{control:i,form:o,value:s,disabled:c,checked:l,required:u,setControl:d,setChecked:f,onUserClick:p,isFormControl:h,bubbleInput:g}=$r(ti,e),v=_(r,d),y=L.useRef(l);return L.useEffect(()=>{let e=o?i?.ownerDocument.getElementById(o):i?.form;if(e instanceof HTMLFormElement){let t=Jr(()=>f(y.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[i,o,f]),(0,U.jsx)(m.button,{type:`button`,role:`switch`,"aria-checked":l,"aria-required":u,"data-state":li(l),"data-disabled":c?``:void 0,disabled:c,value:s,...n,ref:v,onClick:a(t,e=>{let t=e.isPropagationStopped();p({requestedChecked:!l,hasConsumerStoppedPropagation:t}),f(e=>!e),g&&h&&(t||e.stopPropagation())})})},`SwitchTrigger`)),ri=L.forwardRef(Jr(function(e,t){let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,U.jsx)(ei,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(ni,{...d,ref:t,__scopeSwitch:n}),e&&(0,U.jsx)(si,{__scopeSwitch:n})]})})},`Switch`)),ii=`SwitchThumb`,ai=L.forwardRef(Jr(function(e,t){let{__scopeSwitch:n,...r}=e,i=$r(ii,n);return(0,U.jsx)(m.span,{"data-state":li(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})},`SwitchThumb`)),oi=`SwitchBubbleInput`,si=L.forwardRef(Jr(function({__scopeSwitch:e,onClick:t,...n},r){let{control:i,userClick:o,checked:s,defaultChecked:c,required:l,disabled:u,name:d,value:f,form:p,bubbleInput:h,setBubbleInput:g}=$r(oi,e),v=_(r,g),y=Be(i),b=L.useRef(!1),x=L.useRef(s),S=L.useRef(o),C=L.useRef(null);L.useEffect(()=>{let e=h;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set;if(!n)return;let r=x.current!==s;x.current=s;let i=o!==null&&o!==S.current;if(S.current=o,i)C.current=r?null:o,r&&n.call(e,s),e.dispatchEvent(new Event(`click`,{bubbles:!o.hasConsumerStoppedPropagation}));else if(r){let t=C.current;C.current=null;let r=t?.requestedChecked===s;b.current=!0,n.call(e,s),e.dispatchEvent(new Event(`click`,{bubbles:!(r&&t.hasConsumerStoppedPropagation)})),b.current=!1}},[h,s,o]);let w=L.useRef(s);return(0,U.jsx)(m.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:c??w.current,required:l,disabled:u,name:d,value:f,form:p,...n,tabIndex:-1,ref:v,onClick:a(t,e=>{b.current&&e.stopPropagation()}),style:{...n.style,...y,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`SwitchBubbleInput`));function ci(e){return typeof e==`function`}Jr(ci,`isFunction`);function li(e){return e?`checked`:`unchecked`}Jr(li,`getState`);var ui=Object.defineProperty,di=(e,t)=>ui(e,`name`,{value:t,configurable:!0}),fi={Automatic:`automatic`,Manual:`manual`},pi=`Tabs`,[mi,hi]=p(pi,[be]),gi=be(),[_i,vi]=mi(pi),yi=L.forwardRef(di(function(e,t){let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:c,activationMode:l=fi.Automatic,...u}=e,d=fe(c),[f,p]=D({prop:r,onChange:i,defaultProp:a??``,caller:pi});return(0,U.jsx)(_i,{scope:n,baseId:s(),value:f,onValueChange:p,orientation:o,dir:d,activationMode:l,children:(0,U.jsx)(m.div,{dir:d,"data-orientation":o,...u,ref:t})})},`Tabs`)),bi=`TabsList`,xi=L.forwardRef(di(function(e,t){let{__scopeTabs:n,loop:r=!0,...i}=e,a=vi(bi,n),o=gi(n);return(0,U.jsx)(De,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,U.jsx)(m.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})},`TabsList`)),Si=`TabsTrigger`,Ci=L.forwardRef(di(function(e,t){let{__scopeTabs:n,value:r,disabled:i=!1,...o}=e,s=vi(Si,n),c=gi(n),l=Ei(s.baseId,r),u=Di(s.baseId,r),d=r===s.value;return(0,U.jsx)(we,{asChild:!0,...c,focusable:!i,active:d,children:(0,U.jsx)(m.button,{type:`button`,role:`tab`,"aria-selected":d,"aria-controls":u,"data-state":d?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:l,...o,ref:t,onMouseDown:a(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?(e.currentTarget.focus(),s.onValueChange(r)):e.preventDefault()}),onKeyDown:a(e.onKeyDown,e=>{i||e.target!==e.currentTarget||[` `,`Enter`].includes(e.key)&&s.onValueChange(r)}),onFocus:a(e.onFocus,()=>{let e=s.activationMode!==fi.Manual;!d&&!i&&e&&s.onValueChange(r)})})})},`TabsTrigger`)),wi=`TabsContent`,Ti=L.forwardRef(di(function(e,t){let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=vi(wi,n),c=Ei(s.baseId,r),l=Di(s.baseId,r),u=r===s.value,d=L.useRef(u);return L.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,U.jsx)(h,{present:i||u,children:({present:n})=>(0,U.jsx)(m.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})},`TabsContent`));function Ei(e,t){return`${e}-trigger-${t}`}di(Ei,`makeTriggerId`);function Di(e,t){return`${e}-content-${t}`}di(Di,`makeContentId`);var Oi=Object.defineProperty,K=(e,t)=>Oi(e,`name`,{value:t,configurable:!0}),[ki,Ai]=p(`Tooltip`,[Re]),ji=Re(),Mi=`TooltipProvider`,Ni=700,Pi=`tooltip.open`,[Fi,Ii]=ki(Mi),Li=K(e=>{let{__scopeTooltip:t,delayDuration:n=Ni,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=L.useRef(!0),s=L.useRef(!1),c=L.useRef(0);return L.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,U.jsx)(Fi,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:L.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:L.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:L.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})},`TooltipProvider`),Ri=`Tooltip`,[zi,Bi]=ki(Ri),Vi=K(e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:c}=e,l=Ii(Ri,e.__scopeTooltip),u=ji(t),[d,f]=L.useState(null),[p,m]=L.useState(void 0),h=s(),g=L.useRef(0),_=o??l.disableHoverableContent,v=c??l.delayDuration,y=L.useRef(!1),[b,x]=D({prop:r,defaultProp:i??!1,onChange:K(e=>{e?(l.onOpen(),document.dispatchEvent(new CustomEvent(Pi))):l.onClose(),a?.(e)},`onChange`),caller:Ri}),S=L.useMemo(()=>b?y.current?`delayed-open`:`instant-open`:`closed`,[b]),C=L.useCallback(()=>{window.clearTimeout(g.current),g.current=0,y.current=!1,x(!0)},[x]),w=L.useCallback(()=>{window.clearTimeout(g.current),g.current=0,x(!1)},[x]),T=L.useCallback(()=>{window.clearTimeout(g.current),g.current=window.setTimeout(()=>{y.current=!0,x(!0),g.current=0},v)},[v,x]);L.useEffect(()=>()=>{g.current&&=(window.clearTimeout(g.current),0)},[]);let E=p??h;return(0,U.jsx)(ze,{...u,children:(0,U.jsx)(zi,{scope:t,contentId:E,setContentId:m,open:b,stateAttribute:S,trigger:d,onTriggerChange:f,onTriggerEnter:L.useCallback(()=>{l.isOpenDelayedRef.current?T():C()},[l.isOpenDelayedRef,T,C]),onTriggerLeave:L.useCallback(()=>{_?w():(window.clearTimeout(g.current),g.current=0)},[w,_]),onOpen:C,onClose:w,disableHoverableContent:_,children:n})})},`Tooltip`),Hi=`TooltipTrigger`,Ui=L.forwardRef(K(function(e,t){let{__scopeTooltip:n,"aria-describedby":r,...i}=e,o=Bi(Hi,n),s=Ii(Hi,n),c=ji(n),l=L.useRef(null),u=_(t,l,o.onTriggerChange),d=L.useRef(!1),f=L.useRef(!1),p=L.useCallback(()=>d.current=!1,[]);return L.useEffect(()=>()=>document.removeEventListener(`pointerup`,p),[p]),(0,U.jsx)(Ie,{asChild:!0,...c,children:(0,U.jsx)(m.button,{"aria-describedby":o.open?aa(r,o.contentId):r,"data-state":o.stateAttribute,...i,ref:u,onPointerMove:a(e.onPointerMove,e=>{e.pointerType!==`touch`&&!f.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),f.current=!0)}),onPointerLeave:a(e.onPointerLeave,()=>{o.onTriggerLeave(),f.current=!1}),onPointerDown:a(e.onPointerDown,()=>{o.open&&o.onClose(),d.current=!0,document.addEventListener(`pointerup`,p,{once:!0})}),onFocus:a(e.onFocus,()=>{d.current||o.onOpen()}),onBlur:a(e.onBlur,o.onClose),onClick:a(e.onClick,o.onClose)})})},`TooltipTrigger`)),Wi=`TooltipPortal`,[Gi,Ki]=ki(Wi,{forceMount:void 0}),qi=K(e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=Bi(Wi,t);return(0,U.jsx)(Gi,{scope:t,forceMount:n,children:(0,U.jsx)(h,{present:n||a.open,children:(0,U.jsx)(oe,{asChild:!0,container:i,children:r})})})},`TooltipPortal`),Ji=`TooltipContent`,Yi=L.forwardRef(K(function(e,t){let n=Ki(Ji,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=Bi(Ji,e.__scopeTooltip);return(0,U.jsx)(h,{present:r||o.open,children:o.disableHoverableContent?(0,U.jsx)(Qi,{side:i,...a,ref:t}):(0,U.jsx)(Xi,{side:i,...a,ref:t})})},`TooltipContent`)),Xi=L.forwardRef(K(function(e,t){let n=Bi(Ji,e.__scopeTooltip),r=Ii(Ji,e.__scopeTooltip),i=L.useRef(null),a=_(t,i),[o,s]=L.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=L.useCallback(()=>{s(null),d(!1)},[d]),p=L.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=ea(r,$i(r,n.getBoundingClientRect())),a=ta(t.getBoundingClientRect()),o=ra([...i,...a]);s(o),d(!0)},[d]);return L.useEffect(()=>()=>f(),[f]),L.useEffect(()=>{if(c&&u){let e=K(e=>p(e,u),`handleTriggerLeave`),t=K(e=>p(e,c),`handleContentLeave`);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),L.useEffect(()=>{if(o){let e=K(e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!na(n,o);r?f():i&&(f(),l())},`handleTrackPointerGrace`);return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,U.jsx)(Qi,{...e,ref:a})},`TooltipContentHoverable`)),Zi=d(`TooltipContent`),Qi=L.forwardRef(K(function(e,t){let{__scopeTooltip:n,children:r,"aria-label":i,id:a,onEscapeKeyDown:o,onPointerDownOutside:s,...c}=e,l=Bi(Ji,n),u=ji(n),{onClose:d}=l,[f,p]=L.useState(null),m=_(t,p);v(f),L.useEffect(()=>(document.addEventListener(Pi,d),()=>document.removeEventListener(Pi,d)),[d]),L.useEffect(()=>{if(l.trigger){let e=K(e=>{e.target instanceof Node&&e.target.contains(l.trigger)&&d()},`handleScroll`);return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[l.trigger,d]);let{setContentId:h}=l;return E(()=>(h(a),()=>{h(void 0)}),[a,h]),(0,U.jsx)(ie,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:d,children:(0,U.jsxs)(Fe,{"data-state":l.stateAttribute,role:i?void 0:`tooltip`,id:i?void 0:l.contentId,...u,...c,ref:m,style:{...c.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,U.jsx)(Zi,{children:r}),i?(0,U.jsx)(Le,{id:l.contentId,role:`tooltip`,children:i}):null]})})},`TooltipContentImpl`));function $i(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}K($i,`getExitSideFromRect`);function ea(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n})}return r}K(ea,`getPaddedExitPoints`);function ta(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}K(ta,`getPointsFromRect`);function na(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}K(na,`isPointInPolygon`);function ra(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),ia(t)}K(ra,`getHull`);function ia(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}K(ia,`getHullPresorted`);function aa(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}K(aa,`concatAriaDescribedby`);function oa({delayDuration:e=300,...t}){return(0,U.jsx)(Li,{delayDuration:e,...t})}var q=Vi,J=Ui;function Y({className:e,sideOffset:t=4,children:n,...r}){return(0,U.jsx)(qi,{children:(0,U.jsx)(Yi,{sideOffset:t,className:M(`z-50 max-w-xs rounded-md bg-foreground px-2 py-1 text-xs text-background`,e),...r,children:n})})}var sa={name:`activity`,size:24,node:[[`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`}]]};sa.node;var ca=b(sa),la={name:`arrow-left`,size:24,node:[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]};la.node;var ua=b(la),da={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};da.node;var fa=b(da),pa={name:`ban`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]};pa.node;var ma=b(pa),ha={name:`bell`,size:24,node:[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]};ha.node;var ga=b(ha),_a={name:`chart-column`,size:24,node:[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]],aliases:[`bar-chart-3`]};_a.node;var va=b(_a),ya={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};ya.node;var ba=b(ya),xa={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};xa.node;var Sa=b(xa),Ca={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};Ca.node;var wa=b(Ca),Ta={name:`chevron-up`,size:24,node:[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]};Ta.node;var Ea=b(Ta),Da={name:`circle-check`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 9-5.5 5.5L8 12`,key:`xofnsj`}]],aliases:[`check-circle-2`]};Da.node;var Oa=b(Da),ka={name:`circle-dashed`,size:24,node:[[`path`,{d:`M10.1 2.182a10 10 0 0 1 3.8 0`,key:`5ilxe3`}],[`path`,{d:`M13.9 21.818a10 10 0 0 1-3.8 0`,key:`11zvb9`}],[`path`,{d:`M17.609 3.721a10 10 0 0 1 2.69 2.7`,key:`1iw5b2`}],[`path`,{d:`M2.182 13.9a10 10 0 0 1 0-3.8`,key:`c0bmvh`}],[`path`,{d:`M20.279 17.609a10 10 0 0 1-2.7 2.69`,key:`1ruxm7`}],[`path`,{d:`M21.818 10.1a10 10 0 0 1 0 3.8`,key:`qkgqxc`}],[`path`,{d:`M3.721 6.391a10 10 0 0 1 2.7-2.69`,key:`1mcia2`}],[`path`,{d:`M6.391 20.279a10 10 0 0 1-2.69-2.7`,key:`1fvljs`}]]};ka.node;var Aa=b(ka),ja={name:`circle-pause`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`10`,x2:`10`,y1:`15`,y2:`9`,key:`c1nkhi`}],[`line`,{x1:`14`,x2:`14`,y1:`15`,y2:`9`,key:`h65svq`}]],aliases:[`pause-circle`]};ja.node;var Ma=b(ja),Na={name:`circle-stop`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`,key:`1ssd4o`}]],aliases:[`stop-circle`]};Na.node;var Pa=b(Na),Fa={name:`circle-x`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]],aliases:[`x-circle`]};Fa.node;var Ia=b(Fa),La={name:`circle`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};La.node;var Ra=b(La),za={name:`copy`,size:24,node:[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]};za.node;var Ba=b(za),Va={name:`download`,size:24,node:[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]};Va.node;var Ha=b(Va),Ua={name:`ellipsis`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]],aliases:[`more-horizontal`]};Ua.node;var Wa=b(Ua),Ga={name:`eye`,size:24,node:[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};Ga.node;var Ka=b(Ga),qa={name:`file`,size:24,node:[[`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`}]]};qa.node;var Ja=b(qa),Ya={name:`folder-git-2`,size:24,node:[[`path`,{d:`M18 19a5 5 0 0 1-5-5v8`,key:`sz5oeg`}],[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5`,key:`1w6njk`}],[`circle`,{cx:`13`,cy:`12`,r:`2`,key:`1j92g6`}],[`circle`,{cx:`20`,cy:`19`,r:`2`,key:`1obnsp`}]]};Ya.node;var Xa=b(Ya),Za={name:`folder-open`,size:24,node:[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]};Za.node;var Qa=b(Za),$a={name:`folder`,size:24,node:[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]};$a.node;var eo=b($a),to={name:`git-branch`,size:24,node:[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]};to.node;var no=b(to),ro={name:`git-merge`,size:24,node:[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]};ro.node;var io=b(ro),ao={name:`hourglass`,size:24,node:[[`path`,{d:`M5 22h14`,key:`ehvnwv`}],[`path`,{d:`M5 2h14`,key:`pdyrp9`}],[`path`,{d:`M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22`,key:`1d314k`}],[`path`,{d:`M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2`,key:`1vvvr6`}]]};ao.node;var oo=b(ao),so={name:`house`,size:24,node:[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`r6nss1`}]],aliases:[`home`]};so.node;var co=b(so),lo={name:`inbox`,size:24,node:[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]};lo.node;var uo=b(lo),fo={name:`languages`,size:24,node:[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]};fo.node;var po=b(fo),mo={name:`list-filter`,size:24,node:[[`path`,{d:`M2 5h20`,key:`1fs1ex`}],[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`path`,{d:`M9 19h6`,key:`456am0`}]]};mo.node;var ho=b(mo),go={name:`list-ordered`,size:24,node:[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]};go.node;var _o=b(go),vo={name:`list-plus`,size:24,node:[[`path`,{d:`M16 5H3`,key:`m91uny`}],[`path`,{d:`M11 12H3`,key:`51ecnj`}],[`path`,{d:`M16 19H3`,key:`zzsher`}],[`path`,{d:`M18 9v6`,key:`1twb98`}],[`path`,{d:`M21 12h-6`,key:`bt1uis`}]]};vo.node;var yo=b(vo),bo={name:`menu`,size:24,node:[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]};bo.node;var xo=b(bo),So={name:`message-circle-question-mark`,size:24,node:[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`message-circle-question`]};So.node;var Co=b(So),wo={name:`message-square`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]};wo.node;var To=b(wo),Eo={name:`monitor`,size:24,node:[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]};Eo.node;var Do=b(Eo),Oo={name:`moon`,size:24,node:[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]};Oo.node;var ko=b(Oo),Ao={name:`mouse-pointer-click`,size:24,node:[[`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`}]]};Ao.node;var jo=b(Ao),Mo={name:`package-check`,size:24,node:[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`m16 17 2 2 4-4`,key:`uh5qu3`}],[`path`,{d:`M21 11.127V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.32-.753`,key:`kpkbpo`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]};Mo.node;var No=b(Mo),Po={name:`package-open`,size:24,node:[[`path`,{d:`M12 22v-9`,key:`x3hkom`}],[`path`,{d:`M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z`,key:`2ntwy6`}],[`path`,{d:`M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13`,key:`1pmm1c`}],[`path`,{d:`M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z`,key:`12ttoo`}]]};Po.node;var Fo=b(Po),Io={name:`package-x`,size:24,node:[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`m16.5 14.5 5 5`,key:`ozpm51`}],[`path`,{d:`m16.5 19.5 5-5`,key:`syf6b9`}],[`path`,{d:`M21 10.5V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l.13-.074`,key:`isw6gs`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]};Io.node;var Lo=b(Io),Ro={name:`pencil`,size:24,node:[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};Ro.node;var zo=b(Ro),Bo={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};Bo.node;var Vo=b(Bo),Ho={name:`refresh-cw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]};Ho.node;var Uo=b(Ho),Wo={name:`rotate-ccw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]};Wo.node;var Go=b(Wo),Ko={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};Ko.node;var qo=b(Ko),Jo={name:`search-x`,size:24,node:[[`path`,{d:`m13.5 8.5-5 5`,key:`1cs55j`}],[`path`,{d:`m8.5 8.5 5 5`,key:`a8mexj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]};Jo.node;var Yo=b(Jo),Xo={name:`settings-2`,size:24,node:[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]};Xo.node;var Zo=b(Xo),Qo={name:`settings`,size:24,node:[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};Qo.node;var $o=b(Qo),es={name:`skip-forward`,size:24,node:[[`path`,{d:`M21 4v16`,key:`7j8fe9`}],[`path`,{d:`M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z`,key:`zs4d6`}]]};es.node;var ts=b(es),ns={name:`snowflake`,size:24,node:[[`path`,{d:`m10 20-1.25-2.5L6 18`,key:`18frcb`}],[`path`,{d:`M10 4 8.75 6.5 6 6`,key:`7mghy3`}],[`path`,{d:`m14 20 1.25-2.5L18 18`,key:`1chtki`}],[`path`,{d:`m14 4 1.25 2.5L18 6`,key:`1b4wsy`}],[`path`,{d:`m17 21-3-6h-4`,key:`15hhxa`}],[`path`,{d:`m17 3-3 6 1.5 3`,key:`11697g`}],[`path`,{d:`M2 12h6.5L10 9`,key:`kv9z4n`}],[`path`,{d:`m20 10-1.5 2 1.5 2`,key:`1swlpi`}],[`path`,{d:`M22 12h-6.5L14 15`,key:`1mxi28`}],[`path`,{d:`m4 10 1.5 2L4 14`,key:`k9enpj`}],[`path`,{d:`m7 21 3-6-1.5-3`,key:`j8hb9u`}],[`path`,{d:`m7 3 3 6h4`,key:`1otusx`}]]};ns.node;var rs=b(ns),is={name:`sparkles`,size:24,node:[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]],aliases:[`stars`]};is.node;var as=b(is),os={name:`sun`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]};os.node;var ss=b(os),cs={name:`triangle-alert`,size:24,node:[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`alert-triangle`]};cs.node;var ls=b(cs),us={name:`users`,size:24,node:[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]};us.node;var ds=b(us),fs={name:`wrench`,size:24,node:[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]};fs.node;var ps=b(fs),ms={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};ms.node;var hs=b(ms),gs=[{view:`runs`,labelKey:`runs`,icon:ca},{view:`queue`,labelKey:`queue`,icon:_o},{view:`specialists`,labelKey:`specialists`,icon:ds},{view:`pipelines`,labelKey:`pipelines`,icon:no},{view:`stats`,labelKey:`stats`,icon:va},{view:`settings`,labelKey:`settings`,icon:$o}];function _s(e,t){let n=gs.find(t=>t.view===e);return n?t(`nav.${n.labelKey}`):e}var vs=ye,ys=de;function bs({className:e,side:t=`left`,children:n,...r}){return(0,U.jsxs)(Ne,{children:[(0,U.jsx)(ve,{className:`fixed inset-0 z-50 bg-black/50`}),(0,U.jsx)(je,{className:M(`fixed inset-y-0 z-50 flex w-72 max-w-[85vw] flex-col gap-2 border bg-card p-3 shadow-lg`,t===`left`?`left-0 border-l-0`:`right-0 border-r-0`,e),...r,children:n})]})}function xs({className:e,...t}){return(0,U.jsx)(he,{className:M(`text-sm font-semibold`,e),...t})}function Ss({className:e,...t}){return(0,U.jsx)(Pe,{className:M(`sr-only`,e),...t})}var Cs=`[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]`,ws=`input, textarea, select, [role="combobox"], [contenteditable=""], [contenteditable="true"]`;function Ts(){return typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform)}function Es(){return Ts()?`⌘`:`Ctrl`}function Ds(e,t){return e.startsWith(`mod+`)?(Ts()?t.metaKey:t.ctrlKey)&&!t.altKey&&t.key.toLowerCase()===e.slice(4):!t.metaKey&&!t.ctrlKey&&!t.altKey&&t.key===e}function Os(e,t,n={}){let r=(0,L.useRef)(t);r.current=t;let i=n.allowInInputs??e.startsWith(`mod+`);(0,L.useEffect)(()=>{let t=t=>{if(!Ds(e,t))return;let n=t.target instanceof Element?t.target:null;(i||!n?.closest(ws)&&!document.querySelector(Cs))&&r.current(t)};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,i])}var ks=null,As=new Set;function js(e){ks=e;for(let t of As)t(e)}function Ms(e,t){let n=n=>{n===e&&(ks=null,t())};return ks===e&&(ks=null,t()),As.add(n),()=>As.delete(n)}function Ns({className:e,...t}){return(0,U.jsx)(`kbd`,{className:M(`inline-flex h-5 min-w-5 items-center justify-center rounded border bg-muted px-1 font-mono text-[11px] text-muted-foreground`,e),...t})}var Ps=[`global`,`project`],Fs={global:[`general`,`agents`,`delivery`,`runtimes`,`chains`,`specialists`,`pipelines`,`observers`,`projects`,`system`],project:[`general`,`agents`,`delivery`,`queue`,`tags`]},Is=new Set([`observers`]),Ls=`general`,Rs={general:{scope:`global`,group:`general`},defaults:{scope:`global`,group:`agents`},delivery:{scope:`global`,group:`delivery`},workspace:{scope:`global`,group:`general`},naming:{scope:`global`,group:`general`},claude:{scope:`global`,group:`agents`},runtimes:{scope:`global`,group:`runtimes`},chains:{scope:`global`,group:`chains`},web:{scope:`global`,group:`system`},network:{scope:`global`,group:`system`},queue:{scope:`project`,group:`queue`},tags:{scope:`project`,group:`tags`},system:{scope:`global`,group:`system`}},zs=[`general`,`specialist`,`projects`,`history`];function Bs(e){return zs.find(t=>t===e)??`general`}var Vs=e=>Ps.some(t=>t===e);function Hs(e,t){if(e===`global`&&t===`tags`)return{scope:`project`,group:`tags`};if(Vs(e))return{scope:e,group:Fs[e].find(e=>e===t)??`general`};let n=e===null?void 0:Rs[e];return n===void 0&&e===`agents`?{scope:`global`,group:`agents`}:n??{scope:`global`,group:`general`}}function Us(e){let t=e.replace(/^swarm\./,``).split(`.`)[0]??``;return t===`defaults`||t===`claude`?`agents`:t===`delivery`?`delivery`:t===`runtimes`?`runtimes`:t===`web`||t===`network`?`system`:Ls}function Ws(e){return Us(e)}function Gs(e){let t=new Map;for(let n of e){let e=Ws(n.path);t.set(e,[...t.get(e)??[],n])}return t}var Ks=new Set([`specialists`,`pipelines`,`chains`,`projects`]);function qs(e,t,n){let{scope:r,group:i}=Hs(e,t);return{view:`settings`,run:i,group:r,step:r===`global`&&Ks.has(i)?n:r===`global`&&i===`observers`&&n!==null?Bs(n):null,tab:null}}var Js=[`actions`,`system`,`topology`],Ys=e=>Js.some(t=>t===e),Xs=[`30d`,`7d`,`90d`,`all`],Zs=e=>Xs.find(t=>t===e)??`30d`,X=e=>e?decodeURIComponent(e):null;function Qs(e){let[t=``,n=``]=e.split(`?`,2),r=new URLSearchParams(n),i=r.get(`tab`)||null,[a,...o]=t.replace(/^#\/?/,``).split(`/`);if(a===`queue`)return{view:`queue`,run:null,group:null,step:null,tab:null};if(a===`stats`)return{view:`stats`,run:r.get(`project`)||null,group:Zs(r.get(`period`)),step:null,tab:null};if(a===`topology`)return{view:`pipelines`,run:X(o[0]),group:`topology`,step:null,tab:null};if(a===`pipelines`||a===`workflows`){let e=X(o[0]),t=X(o[1]);return a===`pipelines`&&Ys(e)&&t!==null?{view:`pipelines`,run:t,group:e,step:null,tab:null}:{view:`pipelines`,run:e,group:null,step:null,tab:null}}return a===`specialists`?X(o[0])===`_settings`?qs(null,null,null):X(o[0])===`chains`?{view:`specialists`,run:X(o[1]),group:`chains`,step:null,tab:null}:{view:`specialists`,run:X(o[0]),group:null,step:null,tab:null}:a===`settings`?qs(X(o[0]),X(o[1]),X(o[2])):a===`runs`?{view:`runs`,run:X(o[0]),group:X(o[1]),step:X(o[2]),tab:i}:{view:`runs`,run:X(a),group:X(o[0]),step:null,tab:i}}function $s(e){let t=encodeURIComponent;if(e.view===`queue`)return`#queue`;if(e.view===`stats`){let n=e.run?`&project=${t(e.run)}`:``;return`#stats?period=${Zs(e.group)}${n}`}if(e.view===`specialists`)return e.group===`chains`?e.run?`#specialists/chains/${t(e.run)}`:`#specialists/chains`:e.run?`#specialists/${t(e.run)}`:`#specialists`;if(e.view===`settings`){let n=Hs(e.group,e.run),{scope:r,group:i}=e.group===null?Hs(e.run,null):n,a=r===`global`&&Ks.has(i)?e.step:r===`global`&&i===`observers`?Bs(e.step):null;return`#settings/${r}/${i}${a===null?``:`/${t(a)}`}`}if(e.view===`pipelines`)return e.run?Ys(e.group)?`#pipelines/${e.group}/${t(e.run)}`:`#pipelines/${t(e.run)}`:`#pipelines`;if(!e.run)return`#runs`;let n=[e.run,e.group,e.group?e.step:null].filter(e=>e!==null),r=e.group&&e.tab&&e.tab!==`log`?`?tab=${t(e.tab)}`:``;return`#runs/${n.map(t).join(`/`)}${r}`}var ec=dr,tc=pr,nc=vr;function rc({className:e,sideOffset:t=4,...n}){return(0,U.jsx)(mr,{children:(0,U.jsx)(gr,{sideOffset:t,className:M(`z-50 min-w-40 rounded-md border bg-card p-1 text-card-foreground shadow-md`,e),...n})})}function ic({className:e,...t}){return(0,U.jsx)(_r,{className:M(`flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none data-[disabled]:opacity-50 data-[highlighted]:bg-accent [&_svg]:size-4`,e),...t})}function ac({className:e,children:t,...n}){return(0,U.jsxs)(yr,{className:M(`relative flex cursor-default items-center rounded-sm py-1.5 pr-2 pl-7 text-sm outline-none select-none data-[highlighted]:bg-accent`,e),...n,children:[(0,U.jsx)(`span`,{className:`absolute left-2 flex size-4 items-center justify-center`,children:(0,U.jsx)(br,{children:(0,U.jsx)(ba,{className:`size-4`})})}),t]})}function oc({className:e,...t}){return(0,U.jsx)(xr,{className:M(`-mx-1 my-1 h-px bg-border`,e),...t})}function sc({className:e,type:t=`text`,...n}){return(0,U.jsx)(`input`,{type:t,className:M(`h-9.5 w-full min-w-0 rounded-md border border-input bg-card px-2.5 text-sm placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive`,e),...n})}var cc=1,lc=.9,uc=.8,dc=.17,fc=.1,pc=.999,mc=.9999,hc=.99,gc=/[\\\/_+.#"@\[\(\{&]/,_c=/[\\\/_+.#"@\[\(\{&]/g,vc=/[\s-]/,yc=/[\s-]/g;function bc(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?cc:hc;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=bc(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=cc:gc.test(e.charAt(l-1))?(d*=uc,p=e.slice(i,l-1).match(_c),p&&i>0&&(d*=pc**+p.length)):vc.test(e.charAt(l-1))?(d*=lc,m=e.slice(i,l-1).match(yc),m&&i>0&&(d*=pc**+m.length)):(d*=dc,i>0&&(d*=pc**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=mc)),(d<fc&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=bc(e,t,n,r,l+1,a+2,o),f*fc>d&&(d=f*fc)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function xc(e){return e.toLowerCase().replace(yc,` `)}function Sc(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,bc(e,t,xc(e),xc(t),0,0,{})}var Cc=`[cmdk-group=""]`,wc=`[cmdk-group-items=""]`,Tc=`[cmdk-group-heading=""]`,Ec=`[cmdk-item=""]`,Dc=`${Ec}:not([aria-disabled="true"])`,Oc=`cmdk-item-select`,kc=`data-value`,Ac=(e,t,n)=>Sc(e,t,n),jc=L.createContext(void 0),Mc=()=>L.useContext(jc),Nc=L.createContext(void 0),Pc=()=>L.useContext(Nc),Fc=L.createContext(void 0),Ic=L.forwardRef((e,t)=>{let n=Xc(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=Xc(()=>new Set),i=Xc(()=>new Map),a=Xc(()=>new Map),o=Xc(()=>new Set),c=Jc(e),{label:l,children:u,value:d,onValueChange:f,filter:p,shouldFilter:h,loop:g,disablePointerSelection:_=!1,vimBindings:v=!0,...y}=e,b=s(),x=s(),S=s(),C=L.useRef(null),w=$c();Yc(()=>{if(d!==void 0){let e=d.trim();n.current.value=e,T.emit()}},[d]),Yc(()=>{w(6,A)},[]);let T=L.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)ee(),O(),w(1,k);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(S);e?e.focus():(i=document.getElementById(b))==null||i.focus()}if(w(7,()=>{n.current.selectedItemId=te()?.id,T.emit()}),r||w(5,A),c.current?.value!==void 0){let e=t??``;(o=(a=c.current).onValueChange)==null||o.call(a,e);return}}T.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),E=L.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,D(t,r)),w(2,()=>{O(),T.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),w(3,()=>{ee(),O(),n.current.value||k(),T.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=te();w(4,()=>{ee(),t?.getAttribute(`id`)===e&&k(),T.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>c.current.shouldFilter,label:l||e[`aria-label`],getDisablePointerSelection:()=>c.current.disablePointerSelection,listId:b,inputId:S,labelId:x,listInnerRef:C}),[]);function D(e,t){let r=c.current?.filter??Ac;return e?r(e,n.current.search,t):0}function O(){if(!n.current.search||c.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=C.current;ne().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(wc);t?t.appendChild(e.parentElement===t?e:e.closest(`${wc} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${wc} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=C.current?.querySelector(`${Cc}[${kc}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function k(){let e=ne().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(kc);T.setState(`value`,e||void 0)}function ee(){if(!n.current.search||c.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=D(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function A(){var e;let t=te();t&&(t.parentElement?.firstChild===t&&((e=t.closest(Cc)?.querySelector(Tc))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function te(){return C.current?.querySelector(`${Ec}[aria-selected="true"]`)}function ne(){return Array.from(C.current?.querySelectorAll(Dc)||[])}function j(e){let t=ne()[e];t&&T.setState(`value`,t.getAttribute(kc))}function re(e){var t;let n=te(),r=ne(),i=r.findIndex(e=>e===n),a=r[i+e];(t=c.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&T.setState(`value`,a.getAttribute(kc))}function M(e){let t=te()?.closest(Cc),n;for(;t&&!n;)t=e>0?Kc(t,Cc):qc(t,Cc),n=t?.querySelector(Dc);n?T.setState(`value`,n.getAttribute(kc)):re(e)}let ie=()=>j(ne().length-1),ae=e=>{e.preventDefault(),e.metaKey?ie():e.altKey?M(1):re(1)},oe=e=>{e.preventDefault(),e.metaKey?j(0):e.altKey?M(-1):re(-1)};return L.createElement(m.div,{ref:t,tabIndex:-1,...y,"cmdk-root":``,onKeyDown:e=>{var t;(t=y.onKeyDown)==null||t.call(y,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:v&&e.ctrlKey&&ae(e);break;case`ArrowDown`:ae(e);break;case`p`:case`k`:v&&e.ctrlKey&&oe(e);break;case`ArrowUp`:oe(e);break;case`Home`:e.preventDefault(),j(0);break;case`End`:e.preventDefault(),ie();break;case`Enter`:{e.preventDefault();let t=te();if(t){let e=new Event(Oc);t.dispatchEvent(e)}}}}},L.createElement(`label`,{"cmdk-label":``,htmlFor:E.inputId,id:E.labelId,style:nl},l),tl(e,e=>L.createElement(Nc.Provider,{value:T},L.createElement(jc.Provider,{value:E},e))))}),Lc=L.forwardRef((e,t)=>{let n=s(),r=L.useRef(null),i=L.useContext(Fc),a=Mc(),o=Jc(e),c=o.current?.forceMount??i?.forceMount;Yc(()=>{if(!c)return a.item(n,i?.id)},[c]);let l=Qc(n,r,[e.value,e.children,r],e.keywords),u=Pc(),d=Zc(e=>e.value&&e.value===l.current),p=Zc(e=>c||a.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);L.useEffect(()=>{let t=r.current;if(t&&!e.disabled)return t.addEventListener(Oc,h),()=>t.removeEventListener(Oc,h)},[p,e.onSelect,e.disabled]);function h(){var e,t;g(),(t=(e=o.current).onSelect)==null||t.call(e,l.current)}function g(){u.setState(`value`,l.current,!0)}if(!p)return null;let{disabled:_,value:v,onSelect:y,forceMount:b,keywords:x,...S}=e;return L.createElement(m.div,{ref:f(r,t),...S,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!_,"aria-selected":!!d,"data-disabled":!!_,"data-selected":!!d,onPointerMove:_||a.getDisablePointerSelection()?void 0:g,onClick:_?void 0:h},e.children)}),Rc=L.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=s(),c=L.useRef(null),l=L.useRef(null),u=s(),d=Mc(),p=Zc(e=>i||d.filter()===!1?!0:!e.search||e.filtered.groups.has(o));Yc(()=>d.group(o),[]),Qc(o,c,[e.value,e.heading,l]);let h=L.useMemo(()=>({id:o,forceMount:i}),[i]);return L.createElement(m.div,{ref:f(c,t),...a,"cmdk-group":``,role:`presentation`,hidden:!p||void 0},n&&L.createElement(`div`,{ref:l,"cmdk-group-heading":``,"aria-hidden":!0,id:u},n),tl(e,e=>L.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?u:void 0},L.createElement(Fc.Provider,{value:h},e))))}),zc=L.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=L.useRef(null),a=Zc(e=>!e.search);return!n&&!a?null:L.createElement(m.div,{ref:f(i,t),...r,"cmdk-separator":``,role:`separator`})}),Bc=L.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=Pc(),o=Zc(e=>e.search),s=Zc(e=>e.selectedItemId),c=Mc();return L.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),L.createElement(m.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),Vc=L.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=L.useRef(null),o=L.useRef(null),s=Zc(e=>e.selectedItemId),c=Mc();return L.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),L.createElement(m.div,{ref:f(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},tl(e,e=>L.createElement(`div`,{ref:f(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),Hc=L.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return L.createElement(ye,{open:n,onOpenChange:r},L.createElement(Ne,{container:o},L.createElement(ve,{"cmdk-overlay":``,className:i}),L.createElement(je,{"aria-label":e.label,"cmdk-dialog":``,className:a},L.createElement(Ic,{ref:t,...s}))))}),Uc=L.forwardRef((e,t)=>Zc(e=>e.filtered.count===0)?L.createElement(m.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),Wc=L.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return L.createElement(m.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},tl(e,e=>L.createElement(`div`,{"aria-hidden":!0},e)))}),Gc=Object.assign(Ic,{List:Vc,Item:Lc,Input:Bc,Group:Rc,Separator:zc,Dialog:Hc,Empty:Uc,Loading:Wc});function Kc(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function qc(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function Jc(e){let t=L.useRef(e);return Yc(()=>{t.current=e}),t}var Yc=typeof window>`u`?L.useEffect:L.useLayoutEffect;function Xc(e){let t=L.useRef();return t.current===void 0&&(t.current=e()),t}function Zc(e){let t=Pc(),n=()=>e(t.snapshot());return L.useSyncExternalStore(t.subscribe,n,n)}function Qc(e,t,n,r=[]){let i=L.useRef(),a=Mc();return Yc(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(kc,s),i.current=s}),i}var $c=()=>{let[e,t]=L.useState(),n=Xc(()=>new Map);return Yc(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function el(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function tl({asChild:e,children:t},n){return e&&L.isValidElement(t)?L.cloneElement(el(t),{ref:t.ref},n(t.props.children)):n(t)}var nl={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},rl=ye;function il({className:e,children:t,...n}){let{t:r}=N();return(0,U.jsxs)(Ne,{children:[(0,U.jsx)(ve,{className:`fixed inset-0 z-50 bg-black/50`}),(0,U.jsxs)(je,{className:M(`fixed top-1/2 left-1/2 z-50 grid max-h-[85vh] w-[calc(100%-2rem)] max-w-lg -translate-x-1/2 -translate-y-1/2 gap-3 overflow-y-auto rounded-lg border bg-card p-5 shadow-lg`,e),...n,children:[t,(0,U.jsx)(_e,{"aria-label":r(`common.close`),className:`absolute top-3 right-3 rounded-sm text-muted-foreground hover:text-foreground`,children:(0,U.jsx)(hs,{className:`size-4`})})]})]})}function al({className:e,...t}){return(0,U.jsx)(`div`,{className:M(`flex flex-col gap-1.5`,e),...t})}function ol({className:e,...t}){return(0,U.jsx)(`div`,{className:M(`flex justify-end gap-2`,e),...t})}function sl({className:e,...t}){return(0,U.jsx)(he,{className:M(`text-base font-semibold`,e),...t})}function cl({className:e,...t}){return(0,U.jsx)(Pe,{className:M(`text-sm text-muted-foreground`,e),...t})}function ll({className:e,...t}){return(0,U.jsx)(Gc,{className:M(`flex size-full flex-col overflow-hidden rounded-md bg-card`,e),...t})}function ul({open:e,onOpenChange:t,title:n,children:r}){return(0,U.jsx)(rl,{open:e,onOpenChange:t,children:(0,U.jsxs)(il,{className:`top-[20%] translate-y-0 gap-0 overflow-hidden p-0 max-w-xl`,children:[(0,U.jsx)(sl,{className:`sr-only`,children:n}),(0,U.jsx)(cl,{className:`sr-only`,children:n}),(0,U.jsx)(ll,{children:r})]})})}function dl({className:e,...t}){return(0,U.jsxs)(`div`,{className:`flex items-center gap-2 border-b px-3`,children:[(0,U.jsx)(qo,{className:`size-4 shrink-0 opacity-60`}),(0,U.jsx)(Gc.Input,{className:M(`h-10 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground`,e),...t})]})}function fl({className:e,...t}){return(0,U.jsx)(Gc.List,{className:M(`max-h-80 overflow-y-auto p-1`,e),...t})}function pl(e){return(0,U.jsx)(Gc.Empty,{className:`py-6 text-center text-sm text-muted-foreground`,...e})}function Z({className:e,...t}){return(0,U.jsx)(Gc.Group,{className:M(`[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:text-muted-foreground`,e),...t})}function Q({className:e,...t}){return(0,U.jsx)(Gc.Item,{className:M(`flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none data-[selected=true]:bg-accent [&_svg]:size-4`,e),...t})}var ml=Mr,hl=Pr;function gl({className:e,align:t=`start`,sideOffset:n=4,...r}){return(0,U.jsx)(Rr,{children:(0,U.jsx)(Br,{align:t,sideOffset:n,className:M(`z-50 w-[var(--radix-popover-trigger-width)] min-w-72 max-w-[min(32rem,90vw)] rounded-md border bg-card text-card-foreground shadow-md outline-none`,e),...r})})}function _l(e,t){return e.filter(e=>C(e,e,t))}function vl({id:e,label:t,value:n,open:r,listId:i,count:a}){let{t:o}=N();return(0,U.jsx)(hl,{asChild:!0,children:(0,U.jsxs)(A,{id:e,type:`button`,variant:`outline`,role:`combobox`,"aria-label":t,"aria-expanded":r,"aria-haspopup":`listbox`,"aria-controls":r?i:void 0,title:n,className:`h-9.5 w-full justify-start px-2.5`,children:[(0,U.jsx)(Xa,{"aria-hidden":!0}),(0,U.jsx)(Ce,{path:n}),(0,U.jsx)(`span`,{className:`flex-1 truncate text-left`,children:O(n)}),a>0?(0,U.jsx)(I,{variant:`warn`,"aria-label":o(`nav.repositoryWaiting`,{count:a}),children:a}):null]})})}function yl({path:e,chosen:t,waits:n,onSelect:r}){let{t:i}=N();return(0,U.jsxs)(Q,{value:e,title:e,onSelect:r,children:[(0,U.jsx)(ba,{className:t?`opacity-100`:`opacity-0`}),(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,U.jsxs)(`span`,{className:`flex items-center gap-1.5 truncate`,children:[(0,U.jsx)(Ce,{path:e}),(0,U.jsx)(`span`,{className:`truncate`,children:O(e)})]}),(0,U.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:e})]}),n>0?(0,U.jsx)(I,{variant:`warn`,"aria-label":i(`nav.repositoryWaiting`,{count:n}),children:n}):null]})}function bl({id:e,label:t,repositories:n,value:r,waiting:i,onChange:a}){let{t:o}=N(),s=(0,L.useId)(),[c,l]=(0,L.useState)(!1),[u,d]=(0,L.useState)(``),f=_l(n,u),p=i.get(r)??0;return(0,U.jsxs)(ml,{open:c,onOpenChange:e=>{l(e),e||d(``)},children:[(0,U.jsx)(vl,{id:e,label:t,value:r,open:c,listId:s,count:p}),(0,U.jsx)(gl,{align:`start`,className:`w-(--radix-popover-trigger-width) min-w-64 p-0`,children:(0,U.jsxs)(ll,{shouldFilter:!1,label:o(`picker.search`,{label:t}),children:[(0,U.jsx)(dl,{value:u,onValueChange:d,placeholder:o(`queue.form.repositorySearch`)}),(0,U.jsxs)(fl,{id:s,children:[f.length===0?(0,U.jsx)(pl,{children:o(`picker.nothing`)}):null,(0,U.jsx)(Z,{children:f.map(e=>(0,U.jsx)(yl,{path:e,chosen:e===r,waits:i.get(e)??0,onSelect:()=>{a(e),l(!1),d(``)}},e))})]})]})})]})}function xl(e,t){let n=t.endsWith(`/`)&&t.length>1?t.slice(0,-1):t;return e===n?`~`:e.startsWith(`${n}/`)?`~${e.slice(n.length)}`:e}function Sl(e,t,n){let[r,i]=(0,L.useState)(null),[a,o]=(0,L.useState)(``),[s,c]=(0,L.useState)(null),[l,u]=(0,L.useState)(!1),d=e=>{i(e),o(xl(e.path,e.home)),c(null)},f=(0,L.useCallback)(async e=>{u(!0);try{d(await n(e===``?void 0:e))}catch(e){c(e instanceof Error?e.message:String(e))}finally{u(!1)}},[n]);return(0,L.useEffect)(()=>{if(!e)return;let r=t.trim();n(r===``?void 0:r).then(d,()=>f())},[e,t,n,f]),{listing:r,typed:a,setTyped:o,error:s,busy:l,go:f}}function Cl({browser:e}){let{t}=N(),{listing:n,typed:r,setTyped:i,busy:a,go:o}=e,s=e=>{e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),o(r.trim()))},c=n?.parent??null;return(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(A,{type:`button`,variant:`outline`,size:`icon`,"aria-label":t(`pathPicker.up`),title:t(`pathPicker.up`),disabled:a||c===null,onClick:()=>c!==null&&void o(c),children:(0,U.jsx)(fa,{"aria-hidden":!0})}),(0,U.jsx)(A,{type:`button`,variant:`outline`,size:`icon`,"aria-label":t(`pathPicker.home`),title:t(`pathPicker.home`),disabled:a,onClick:()=>void o(),children:(0,U.jsx)(co,{"aria-hidden":!0})}),(0,U.jsx)(sc,{"aria-label":t(`pathPicker.path`),value:r,className:`min-w-0 flex-1`,onChange:e=>i(e.target.value),onKeyDown:s}),(0,U.jsx)(A,{type:`button`,variant:`outline`,disabled:a||r.trim()===``,onClick:()=>void o(r.trim()),children:t(`pathPicker.go`)})]})}function wl({browser:e}){let{t}=N(),{listing:n,busy:r,go:i}=e,a=e=>(0,U.jsx)(`li`,{className:`px-2 py-3 text-sm text-muted-foreground`,children:e});return(0,U.jsxs)(`ul`,{"aria-label":t(`pathPicker.title`),"aria-busy":r,className:`h-72 overflow-y-auto rounded-md border p-1`,children:[n===null?a(t(`pathPicker.loading`)):n.entries.length===0?a(t(`pathPicker.empty`)):n.entries.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{type:`button`,"data-directory":e.path,disabled:r,className:M(`flex w-full min-w-0 items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm`,`hover:bg-accent focus-visible:bg-accent focus-visible:outline-none`),onClick:()=>void i(e.path),children:[e.git?(0,U.jsx)(Xa,{"aria-hidden":!0,className:`size-4 shrink-0 text-primary`}):(0,U.jsx)(eo,{"aria-hidden":!0,className:`size-4 shrink-0 text-muted-foreground`}),(0,U.jsx)(`span`,{className:`truncate`,children:e.name}),e.git?(0,U.jsx)(I,{variant:`outline`,className:`ml-auto`,children:`git`}):null]})},e.path)),n?.truncated?(0,U.jsx)(`li`,{className:`px-2 py-1 text-xs text-muted-foreground`,children:t(`pathPicker.truncated`,{count:n.entries.length})}):null]})}function Tl({open:e,start:t,browse:n,onOpenChange:r,onChoose:i}){let{t:a}=N(),o=Sl(e,t,n),{listing:s,error:c,busy:l}=o;return(0,U.jsx)(rl,{open:e,onOpenChange:r,children:(0,U.jsxs)(il,{className:`sm:max-w-xl`,"data-directory-dialog":!0,children:[(0,U.jsxs)(al,{children:[(0,U.jsx)(sl,{children:a(`pathPicker.title`)}),(0,U.jsx)(cl,{children:a(`pathPicker.description`)})]}),(0,U.jsx)(Cl,{browser:o}),c?(0,U.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:c}):null,(0,U.jsx)(wl,{browser:o}),(0,U.jsxs)(ol,{children:[(0,U.jsx)(A,{type:`button`,variant:`outline`,onClick:()=>r(!1),children:a(`common.cancel`)}),(0,U.jsxs)(A,{type:`button`,disabled:l||s===null,onClick:()=>{s!==null&&(i(xl(s.path,s.home)),r(!1))},children:[s?.git?(0,U.jsx)(Xa,{"aria-hidden":!0}):(0,U.jsx)(Qa,{"aria-hidden":!0}),a(`pathPicker.choose`)]})]})]})})}function El({id:e,value:t,onChange:n,browse:r,placeholder:i,invalid:a=!1,describedBy:o,autoFocus:s=!1,required:c=!1}){let{t:l}=N(),[u,d]=(0,L.useState)(!1);return(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(sc,{id:e,value:t,required:c,placeholder:i,autoFocus:s,className:`min-w-0 flex-1`,"aria-invalid":a,"aria-describedby":o,onChange:e=>n(e.target.value)}),(0,U.jsxs)(A,{type:`button`,variant:`outline`,onClick:()=>d(!0),"data-path-browse":!0,children:[(0,U.jsx)(Qa,{"aria-hidden":!0}),l(`pathPicker.browse`)]}),(0,U.jsx)(Tl,{open:u,start:t,browse:r,onOpenChange:d,onChoose:n})]})}function Dl({className:e,...t}){return(0,U.jsx)(Cr,{className:M(`text-sm leading-none font-medium select-none`,e),...t})}function Ol(){return M(`flex h-8 w-full shrink-0 items-center gap-2 justify-start rounded-md px-2 text-sm [&_svg]:size-4 [&_svg]:shrink-0`)}function kl({open:e,onOpenChange:t,onAdd:n,browse:r}){let{t:i}=N(),[a,o]=(0,L.useState)(``),[s,c]=(0,L.useState)(null),[l,u]=(0,L.useState)(!1),d=async e=>{if(e.preventDefault(),!(l||a.trim()===``)){u(!0),c(null);try{await n(a.trim()),o(``),t(!1)}catch(e){c(e instanceof Error?e.message:String(e))}finally{u(!1)}}};return(0,U.jsx)(rl,{open:e,onOpenChange:e=>{e||c(null),t(e)},children:(0,U.jsx)(il,{children:(0,U.jsxs)(`form`,{onSubmit:e=>void d(e),className:`grid gap-3`,children:[(0,U.jsxs)(al,{children:[(0,U.jsx)(sl,{children:i(`nav.repositoryAddTitle`)}),(0,U.jsx)(cl,{children:i(`nav.repositoryAddDescription`)})]}),(0,U.jsx)(Dl,{htmlFor:`repository-path`,children:i(`nav.repositoryPath`)}),(0,U.jsx)(El,{id:`repository-path`,value:a,onChange:o,browse:r,placeholder:`~/projects/app`,autoFocus:!0,invalid:s!==null,describedBy:s?`repository-path-error`:void 0}),s?(0,U.jsx)(`p`,{id:`repository-path-error`,role:`alert`,className:`text-sm text-destructive`,children:s}):null,(0,U.jsxs)(ol,{children:[(0,U.jsx)(A,{type:`button`,variant:`outline`,onClick:()=>t(!1),children:i(`common.cancel`)}),(0,U.jsx)(A,{type:`submit`,disabled:l||a.trim()===``,children:i(`nav.repositoryAddSubmit`)})]})]})})})}function Al({name:e,label:t,title:n,others:r,compact:i}){let{t:a}=N();return(0,U.jsx)(tc,{asChild:!0,children:(0,U.jsxs)(A,{variant:`outline`,"data-nav-row":!0,"data-repository-trigger":!0,className:M(Ol(),`relative`,i&&`w-auto max-w-48`),"aria-label":t,title:n,children:[(0,U.jsx)(Xa,{"aria-hidden":!0}),(0,U.jsx)(Ce,{path:n}),(0,U.jsx)(`span`,{className:`flex-1 truncate text-left`,children:e}),r>0?(0,U.jsx)(I,{variant:`warn`,"aria-label":a(`nav.repositoryWaiting`,{count:r}),children:r}):null]})})}function jl({path:e,shown:t,count:n}){let{t:r}=N();return(0,U.jsxs)(ac,{value:e,title:e,className:`min-h-[3.25rem]`,children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,U.jsxs)(`span`,{className:`flex items-center gap-1.5 truncate`,children:[(0,U.jsx)(Ce,{path:e}),(0,U.jsx)(`span`,{className:`truncate`,children:O(e)})]}),(0,U.jsx)(`span`,{className:`text-xs break-all whitespace-normal text-muted-foreground`,children:t})]}),n>0?(0,U.jsx)(I,{variant:`warn`,className:`ml-3`,"aria-label":r(`nav.repositoryWaiting`,{count:n}),children:n}):null]})}function Ml({ref:e,query:t,onQuery:n}){let{t:r}=N();return(0,U.jsx)(sc,{ref:e,type:`search`,value:t,placeholder:r(`nav.repositorySearch`),"aria-label":r(`nav.repositorySearch`),className:`mb-1 h-8`,onChange:e=>n(e.target.value),onKeyDown:e=>{[`ArrowDown`,`ArrowUp`,`Escape`,`Tab`].includes(e.key)||e.stopPropagation()}})}function Nl(e){let{t}=N(),{matching:n,waiting:r}=e;return(0,U.jsxs)(`div`,{"data-repository-list":!0,className:`max-h-[calc(3.25rem*5.5)] overflow-y-auto`,children:[(0,U.jsx)(nc,{value:e.selected,onValueChange:e.onSelect,children:n.map(t=>(0,U.jsx)(jl,{path:t,shown:e.shownPath(t),count:r.get(t)??0},t))}),n.length===0?(0,U.jsx)(`p`,{className:`px-2 py-3 text-center text-sm text-muted-foreground`,children:t(`nav.repositoryNone`)}):null]})}function Pl({compact:e,onAdd:t,browse:n}){let{t:r}=N(),[i,a]=(0,L.useState)(!1);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(A,{variant:`outline`,"data-repository-add-empty":!0,className:M(Ol(),e&&`w-auto max-w-48`),"aria-label":r(`nav.repositoryAdd`),title:r(`nav.repositoryAdd`),onClick:()=>a(!0),children:[(0,U.jsx)(Vo,{"aria-hidden":!0}),(0,U.jsx)(`span`,{className:`flex-1 truncate text-left`,children:r(`nav.repositoryAdd`)})]}),(0,U.jsx)(kl,{open:i,onOpenChange:a,onAdd:t,browse:n})]})}var Fl=$s({view:`settings`,run:`projects`,group:`global`,step:null,tab:null});function Il({choice:e,compact:t=!1}){let{t:n}=N(),{repositories:r,selected:i,waiting:a,onSelect:o}=e,s={onAdd:e.onAdd,browse:e.browse},c=t=>e.paths?.get(t)??t,l=(0,L.useRef)(null),[u,d]=(0,L.useState)(``),[f,p]=(0,L.useState)(!1),[m,h]=(0,L.useState)(!1);if((0,L.useEffect)(()=>{if(!m)return;let e=setTimeout(()=>l.current?.focus(),0);return()=>clearTimeout(e)},[m]),i===null)return(0,U.jsx)(Pl,{compact:t,...s});let g=O(i),_=r.filter(e=>e!==i).reduce((e,t)=>e+(a.get(t)??0),0),v=r.filter(e=>C(e,c(e),u)),y=(0,U.jsx)(Al,{name:g,label:n(`nav.repositoryCurrent`,{name:g}),title:i,others:_,compact:t});return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(ec,{open:m,onOpenChange:e=>{h(e),e||d(``)},children:[y,(0,U.jsxs)(rc,{align:`start`,"aria-label":n(`nav.repository`),className:`w-80 max-w-[calc(100vw-1rem)]`,children:[(0,U.jsx)(Ml,{ref:l,query:u,onQuery:d}),(0,U.jsx)(Nl,{matching:v,selected:i,shownPath:c,waiting:a,onSelect:o}),(0,U.jsx)(oc,{}),(0,U.jsxs)(ic,{onSelect:()=>p(!0),children:[(0,U.jsx)(Vo,{"aria-hidden":!0}),n(`nav.repositoryAdd`)]}),(0,U.jsx)(ic,{asChild:!0,children:(0,U.jsxs)(`a`,{href:Fl,"data-projects-link":!0,children:[(0,U.jsx)(Zo,{"aria-hidden":!0}),n(`nav.repositoryManage`)]})})]})]}),(0,U.jsx)(kl,{open:f,onOpenChange:p,...s})]})}function Ll({target:e,count:t,waiting:n,corner:r=!1,className:i}){let{t:a}=N();return(0,U.jsx)(I,{variant:e===`runs`?n>0?`warn`:`run`:`mute`,"aria-label":e===`runs`?n>0?a(`nav.workingWaiting`,{count:t,waiting:n}):a(`nav.working`,{count:t}):a(`nav.queued`,{count:t}),className:M(r&&`absolute -right-2 -top-2 min-w-4 justify-center px-1 py-0 text-[10px] leading-4`,i),children:r&&t>99?`99+`:t})}function Rl(e){return`#${e}`}function zl(e){let t=Math.max(0,Math.round(e/1e3));if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?`${n}m${String(t%60).padStart(2,`0`)}s`:`${Math.floor(n/60)}h${String(n%60).padStart(2,`0`)}m`}function Bl(e){return!e||e.costUsd===null||e.costUsd===0?``:`$${e.costUsd.toFixed(2)}`}function Vl(e){return e==null?`—`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function Hl(e){return!e||e.inputTokens===0&&e.outputTokens===0?``:`${Vl(e.inputTokens)}/${Vl(e.outputTokens)}`}function Ul(e,t){return t(`format.files`,{count:e})}function Wl(e,t){return e?`${Ul(e.files,t)} +${e.added} −${e.removed}`:``}function Gl(e){return e.title||e.groups.map(e=>e.title).join(`, `)||e.id}function Kl(e,t,n){let r=new Date(e),i=r.toLocaleTimeString(n,{hour:`2-digit`,minute:`2-digit`});return new Date(t).toDateString()===r.toDateString()?i:`${r.toLocaleDateString(n,{day:`2-digit`,month:`2-digit`})} ${i}`}function ql(e){return e.total<=0?0:Math.min(100,Math.max(0,Math.round(e.done/e.total*100)))}function Jl(e,t){return e.finished&&e.finishedAt!==null?e.finishedAt:e.clockStoppedAt??t}function Yl(e,t,n){let r=Jl(e,t);return{created:Kl(e.createdAt,t,n),duration:zl(r-e.createdAt)}}function Xl(e,t){return e.map((e,n)=>`Q${n+1}: ${e.text}\nA${n+1}: ${(t[n]??``).trim()}`).join(`
3
+
4
+ `)}function Zl(e,t,n){let r=2166136261;for(let e of n)r^=e.codePointAt(0),r=Math.imul(r,16777619)>>>0;return`${e}/q${t}/${r.toString(16).padStart(8,`0`)}`}function Ql(e){let t=new Date(e);return`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`}function $l(e,t){if(e===`step skipped`)return t(`runs.group.skippedReason`);let n=/^network: (.*)$/s.exec(e);if(n)return t(`runs.group.networkReason`,{problem:n[1]??``});let r=/^usage limit(?:, resets (\d\d:\d\d))?$/.exec(e);return r?r[1]?t(`runs.group.limitReasonAt`,{time:r[1]}):t(`runs.group.limitReason`):e}function eu(e,t){let n=Math.max(0,Math.floor(e)),r=t(`format.unitSec`),i=t(`format.unitMin`);return n<60?`${n} ${r}`:n<3600?`${Math.floor(n/60)} ${i} ${n%60} ${r}`:`${Math.floor(n/3600)} ${t(`format.unitHour`)} ${Math.floor(n%3600/60)} ${i}`}function tu(e,t){return`${new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(e)} %`}function nu(e,t,n){let r=(e,t)=>new Intl.NumberFormat(n,{maximumFractionDigits:t}).format(e);return e>=1024**3?`${r(e/1024**3,1)} ${t(`format.unitGb`)}`:e>=1024**2?`${r(e/1024**2,0)} ${t(`format.unitMb`)}`:`${r(e/1024,0)} ${t(`format.unitKb`)}`}function ru(e,t,n){let r=e=>new Intl.NumberFormat(n,{maximumFractionDigits:1}).format(e);return e>=1024**2?`${r(e/1024**2)} ${t(`format.unitMb`)}`:e>=1024?`${r(e/1024)} ${t(`format.unitKb`)}`:`${e} ${t(`format.unitB`)}`}function iu(e){let t=new Date(e);return[t.getHours(),t.getMinutes(),t.getSeconds()].map(e=>String(e).padStart(2,`0`)).join(`:`)}function au(e,t){return new Date(e).toLocaleString(t)}var ou={queued:{labelKey:`queued`,tone:`mute`,icon:Aa,spin:!1},not_merged:{labelKey:`not_merged`,tone:`mute`,icon:Aa,spin:!1},waiting:{labelKey:`waiting`,tone:`mute`,icon:oo,spin:!1},running:{labelKey:`running`,tone:`run`,icon:T,spin:!0},merging:{labelKey:`merging`,tone:`run`,icon:io,spin:!1},repair:{labelKey:`repair`,tone:`run`,icon:ps,spin:!1},active:{labelKey:`active`,tone:`run`,icon:T,spin:!0},needs_human:{labelKey:`needs_human`,tone:`warn`,icon:Co,spin:!1},conflict:{labelKey:`conflict`,tone:`warn`,icon:ls,spin:!1},apply_failed:{labelKey:`apply_failed`,tone:`warn`,icon:Lo,spin:!1},undelivered:{labelKey:`undelivered`,tone:`warn`,icon:Fo,spin:!1},rejected:{labelKey:`rejected`,tone:`warn`,icon:ls,spin:!1},failed:{labelKey:`failed`,tone:`err`,icon:Ia,spin:!1},merged:{labelKey:`merged`,tone:`ok`,icon:io,spin:!1},applied:{labelKey:`applied`,tone:`ok`,icon:No,spin:!1},done:{labelKey:`done`,tone:`ok`,icon:Oa,spin:!1},finished:{labelKey:`finished`,tone:`ok`,icon:Oa,spin:!1},cancelled:{labelKey:`cancelled`,tone:`mute`,icon:ma,spin:!1},pending:{labelKey:`pending`,tone:`mute`,icon:Ra,spin:!1},paused:{labelKey:`paused`,tone:`warn`,icon:Ma,spin:!1},frozen:{labelKey:`frozen`,tone:`warn`,icon:rs,spin:!1},stopped:{labelKey:`stopped`,tone:`mute`,icon:Ma,spin:!1},warnings:{labelKey:`warnings`,tone:`warn`,icon:ls,spin:!1}};function su(e,t){let n=ou[e];return n?{label:t(`status.${n.labelKey}`),tone:n.tone,icon:n.icon,spin:n.spin}:{label:e,tone:`mute`,icon:Ra,spin:!1}}function cu(e,t){switch(e.reason){case`specialist`:return t(`wait.specialist`,{specialist:e.name??e.specialist,max:e.max});case`capacity`:return t(`wait.capacity`,{max:e.max});case`limit`:return t(`wait.limit`,{runtime:e.runtime,time:Ql(e.until)});case`network`:return e.until===null?t(`wait.network`,{problem:e.problem}):t(`wait.networkUntil`,{time:Ql(e.until)})}}function lu(e){return ou[e]?.tone??`mute`}function uu(e,t){let{label:n}=su(e.state,t);return e.state===`needs_human`&&e.waiting>=2?`${n} ×${e.waiting}`:n}function du(e,t){return t(`connection.${e}`)}function fu(e,t){return t(`queueState.${e}`)}function pu({compact:e,label:t,unread:n,tone:r}){let{t:i}=N(),a=(0,U.jsxs)(`span`,{className:`relative flex size-4 items-center justify-center`,children:[(0,U.jsx)(ga,{"aria-hidden":!0}),n>0?(0,U.jsx)(I,{variant:r,"aria-hidden":!0,"data-notification-count":!0,className:`absolute -right-2 -top-2 min-w-4 justify-center px-1 py-0 text-[10px] leading-4`,children:n>99?`99+`:n}):null]});return e?(0,U.jsxs)(q,{children:[(0,U.jsx)(J,{asChild:!0,children:(0,U.jsx)(hl,{asChild:!0,children:(0,U.jsx)(A,{variant:`ghost`,size:`icon`,className:`size-8 shrink-0`,"aria-label":t,children:a})})}),(0,U.jsx)(Y,{side:`bottom`,children:t})]}):(0,U.jsx)(hl,{asChild:!0,children:(0,U.jsxs)(A,{variant:`ghost`,"data-nav-row":!0,className:Ol(),"aria-label":t,children:[a,(0,U.jsx)(`span`,{children:i(`nav.notifications`)})]})})}function mu({item:e,state:t,showRepository:n,onSelect:r}){let{t:i}=N(),a=su(e.kind,i);return(0,U.jsxs)(`li`,{className:`flex items-start gap-1 border-b last:border-b-0 hover:bg-accent/50`,children:[(0,U.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 flex-col items-start gap-1 px-3 py-2 text-left text-sm`,onClick:r,children:[(0,U.jsxs)(`span`,{className:`flex max-w-full items-center gap-2`,children:[(0,U.jsx)(I,{variant:a.tone,children:a.label}),e.humanOnly?(0,U.jsx)(I,{variant:`warn`,children:i(`runs.humanOnly.${e.humanOnly}`)}):null,(0,U.jsx)(`span`,{className:M(`truncate`,t.isRead(e)?`font-normal`:`font-semibold`),children:e.groupTitle})]}),(0,U.jsxs)(`span`,{className:`max-w-full truncate text-xs text-muted-foreground`,children:[e.runTitle,n?` · ${O(e.repository)}`:``]}),e.detail?(0,U.jsx)(`span`,{className:`max-w-full truncate text-xs`,children:e.detail}):null]}),(0,U.jsx)(A,{variant:`ghost`,size:`sm`,className:`mt-1 shrink-0`,"aria-label":i(`notifications.hideGroup`,{group:e.groupTitle}),onClick:()=>t.hide(e.key),children:i(`notifications.hide`)})]},e.key)}function hu({state:e,compact:t=!1,showRepository:n}){let{t:r}=N(),[i,a]=(0,L.useState)(!1),{items:o,unread:s,unreadTone:c,permission:l}=e,u=s>0?r(`notifications.unread`,{count:s}):r(`nav.notifications`),d=e.open;return(0,L.useEffect)(()=>{i&&s>0&&d()},[i,s,d]),(0,U.jsxs)(ml,{open:i,onOpenChange:t=>{a(t),t&&e.open()},children:[(0,U.jsx)(pu,{compact:t,label:u,unread:s,tone:c}),(0,U.jsxs)(gl,{align:`end`,className:`w-96 p-0`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b px-3 py-2`,children:[(0,U.jsx)(`h2`,{className:`text-sm font-semibold`,children:r(`notifications.title`)}),o.length>0?(0,U.jsx)(A,{variant:`ghost`,size:`sm`,onClick:e.hideAll,children:r(`notifications.hideAll`)}):null]}),o.length===0?(0,U.jsx)(`p`,{className:`px-3 py-6 text-center text-sm text-muted-foreground`,children:r(`notifications.empty`)}):(0,U.jsx)(`ul`,{className:`max-h-80 overflow-y-auto`,children:o.map(t=>(0,U.jsx)(mu,{item:t,state:e,showRepository:n,onSelect:()=>{a(!1),e.select(t)}},t.key))}),(0,U.jsxs)(`div`,{className:`flex flex-col items-start gap-2 border-t px-3 py-2 text-xs text-muted-foreground`,children:[(0,U.jsx)(`p`,{role:`status`,children:r(`notifications.${l}`)}),l==="default"?(0,U.jsx)(A,{variant:`outline`,size:`sm`,onClick:e.enable,children:r(`notifications.enable`)}):null]})]})]})}var gu=[{code:`en`,name:`English`,locale:`en`},{code:`es`,name:`Español`,locale:`es`},{code:`ru`,name:`Русский`,locale:`ru`},{code:`zh`,name:`中文`,locale:`zh-CN`}],_u=gu.map(e=>e.code),vu=`aip.web.language`;function yu(e){return typeof e==`string`&&_u.includes(e)}function bu(e){return gu.find(t=>t.code===e)?.locale??`en`}function xu(e){for(let t of e){let e=t.toLowerCase().split(`-`)[0];if(yu(e))return e}return`en`}i.use(bt).init({resources:{en:{translation:Ve},es:{translation:Ue},ru:{translation:He},zh:{translation:We}},lng:`en`,fallbackLng:`en`,initAsync:!1,returnNull:!1,interpolation:{escapeValue:!1}});var Su=`system`,Cu=new Set;function wu(){try{let e=window.localStorage.getItem(vu);if(e===null)return`system`;let t=JSON.parse(e);return yu(t)?t:`system`}catch{return Su}}function Tu(){let{languages:e,language:t}=window.navigator;return e&&e.length>0?e:t?[t]:[]}function Eu(e){let t=e===`system`?xu(Tu()):e;return i.language!==t&&i.changeLanguage(t),document.documentElement.lang=bu(t),t}function Du(){Eu(wu())}function Ou(e){Su=e;try{window.localStorage.setItem(vu,JSON.stringify(e))}catch{}Eu(e);for(let e of Cu)e()}function ku(e){return Cu.add(e),()=>Cu.delete(e)}function Au(){let e=(0,L.useSyncExternalStore)(ku,wu,wu);return(0,L.useEffect)(()=>{if(Eu(e),e!==`system`)return;let t=()=>{Eu(`system`);for(let e of Cu)e()};return window.addEventListener(`languagechange`,t),()=>window.removeEventListener(`languagechange`,t)},[e]),{choice:e,language:e===`system`?xu(Tu()):e,setChoice:Ou}}function ju(){let{i18n:e}=N();return bu(yu(e.language)?e.language:`en`)}function Mu({compact:e=!1}){let{t}=N(),{choice:n,setChoice:r}=Au(),i=t(`language.label`,{language:n===`system`?t(`language.system`):gu.find(e=>e.code===n)?.name??n}),a=(0,U.jsx)(tc,{asChild:!0,children:(0,U.jsxs)(A,{variant:`ghost`,"data-nav-row":!0,className:M(Ol(),e&&`w-8 justify-center px-0`),"aria-label":i,children:[(0,U.jsx)(po,{}),e?null:(0,U.jsx)(`span`,{className:`truncate`,children:i})]})});return(0,U.jsxs)(ec,{children:[e?(0,U.jsxs)(q,{children:[(0,U.jsx)(J,{asChild:!0,children:a}),(0,U.jsx)(Y,{side:`bottom`,children:i})]}):a,(0,U.jsx)(rc,{align:e?`end`:`start`,side:e?`bottom`:`top`,children:(0,U.jsxs)(nc,{value:n,onValueChange:e=>r(e),children:[(0,U.jsx)(ac,{value:`system`,children:t(`language.system`)}),gu.map(e=>(0,U.jsx)(ac,{value:e.code,lang:e.locale,children:e.name},e.code))]})})]})}var Nu=`aip.web.theme`;function Pu(){try{let e=JSON.parse(window.localStorage.getItem(Nu)??`null`);return e===`light`||e===`dark`?e:`system`}catch{return`system`}}var Fu=()=>window.matchMedia(`(prefers-color-scheme: dark)`);function Iu(e){return e===`system`?Fu().matches?`dark`:`light`:e}function Lu(e){let t=Iu(e);return document.documentElement.classList.toggle(`dark`,t===`dark`),t}function Ru(){Lu(Pu())}function zu(){let[e,t]=P(`theme`,`system`),[n,r]=(0,L.useState)(()=>Iu(e));return(0,L.useEffect)(()=>{if(r(Lu(e)),e!==`system`)return;let t=Fu(),n=()=>r(Lu(`system`));return t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)},[e]),{theme:e,resolved:n,setTheme:t}}var Bu=[`system`,`light`,`dark`];function Vu({compact:e=!1}){let{t}=N(),{theme:n,resolved:r,setTheme:i}=zu(),a=t(`theme.label`,{theme:t(`theme.${n}`)}),o=n===`system`?Do:r===`dark`?ko:ss,s=(0,U.jsx)(tc,{asChild:!0,children:(0,U.jsxs)(A,{variant:`ghost`,"data-nav-row":!0,className:M(Ol(),e&&`w-8 justify-center px-0`),"aria-label":a,children:[(0,U.jsx)(o,{}),e?null:(0,U.jsx)(`span`,{children:a})]})});return(0,U.jsxs)(ec,{children:[e?(0,U.jsxs)(q,{children:[(0,U.jsx)(J,{asChild:!0,children:s}),(0,U.jsx)(Y,{side:`bottom`,children:a})]}):s,(0,U.jsx)(rc,{align:e?`end`:`start`,side:e?`bottom`:`top`,children:(0,U.jsx)(nc,{value:n,onValueChange:e=>i(e),children:Bu.map(e=>(0,U.jsx)(ac,{value:e,children:t(`theme.${e}`)},e))})})]})}function Hu(e){let{t}=N(),{target:n,active:r,count:i,waiting:a,icon:o}=e;return(0,U.jsxs)(`a`,{href:e.href,"data-nav-row":!0,"aria-current":r?`page`:void 0,className:M(Ol(),`relative font-medium text-muted-foreground hover:bg-accent hover:text-accent-foreground`,r&&`bg-accent text-accent-foreground`),onClick:t=>{t.preventDefault(),e.onNavigate(n)},children:[(0,U.jsx)(`span`,{"data-nav-icon":!0,className:`relative flex size-4 items-center justify-center`,children:(0,U.jsx)(o,{"aria-hidden":!0})}),(0,U.jsx)(`span`,{className:`flex-1`,children:e.label}),i>0?(0,U.jsx)(Ll,{target:n,count:i,waiting:a}):null,n===`runs`&&a>0?(0,U.jsx)(I,{variant:`warn`,"aria-label":t(`nav.waiting`,{count:a}),children:a}):null]})}function Uu({view:e,hrefFor:t,onNavigate:n,working:r,waiting:i,queued:a,onPalette:o,notifications:s,repository:c}){let{t:l}=N(),u=e=>e===`runs`?r:e===`queue`?a:0;return(0,U.jsxs)(`div`,{className:`flex h-full flex-col gap-2 p-2`,children:[(0,U.jsxs)(`a`,{href:`#runs`,"data-nav-row":!0,className:M(Ol(),`font-semibold`),onClick:e=>{e.preventDefault(),n(`runs`)},children:[(0,U.jsx)(`span`,{className:`rounded bg-primary px-1.5 py-0.5 text-xs text-primary-foreground`,children:`aip`}),(0,U.jsx)(`span`,{children:`web`})]}),(0,U.jsx)(Il,{choice:c}),(0,U.jsxs)(A,{variant:`outline`,"data-nav-row":!0,className:M(Ol(),`text-muted-foreground`),onClick:o,"aria-label":l(`nav.palette`),children:[(0,U.jsx)(qo,{}),(0,U.jsx)(`span`,{className:`flex-1 text-left`,children:l(`nav.search`)}),(0,U.jsxs)(Ns,{children:[Es(),`K`]})]}),(0,U.jsx)(`nav`,{"aria-label":l(`nav.sections`),className:`flex flex-col gap-0.5`,children:gs.map(({view:r,labelKey:a,icon:o})=>(0,U.jsx)(Hu,{target:r,label:l(`nav.${a}`),icon:o,count:u(r),active:r===e,waiting:i,href:t(r),onNavigate:n},r))}),(0,U.jsxs)(`div`,{className:`mt-auto flex flex-col gap-1`,children:[(0,U.jsx)(hu,{state:s,showRepository:c.repositories.length>1}),(0,U.jsx)(Vu,{}),(0,U.jsx)(Mu,{})]})]})}function Wu(e){let{t}=N(),[n,r]=(0,L.useState)(!1);return(0,U.jsxs)(`header`,{className:`flex h-11 shrink-0 items-center gap-2 border-b bg-card px-2`,children:[(0,U.jsxs)(vs,{open:n,onOpenChange:r,children:[(0,U.jsx)(ys,{asChild:!0,children:(0,U.jsx)(A,{variant:`ghost`,size:`icon`,"aria-label":t(`nav.menu`),children:(0,U.jsx)(xo,{})})}),(0,U.jsxs)(bs,{children:[(0,U.jsx)(xs,{className:`sr-only`,children:t(`nav.sectionsTitle`)}),(0,U.jsx)(Ss,{children:t(`nav.sectionsDescription`)}),(0,U.jsx)(Uu,{...e,onNavigate:t=>{r(!1),e.onNavigate(t)},onPalette:()=>{r(!1),e.onPalette()}})]})]}),(0,U.jsx)(`span`,{className:`text-sm font-semibold`,children:_s(e.view,t)}),(0,U.jsx)(A,{variant:`outline`,size:`icon`,className:`ml-auto`,onClick:e.onNewTask,disabled:!e.onNewTask,"aria-label":t(`nav.newTask`),children:(0,U.jsx)(Vo,{})})]})}function Gu({label:e,children:t}){return(0,U.jsxs)(q,{children:[(0,U.jsx)(J,{asChild:!0,children:t}),(0,U.jsx)(Y,{side:`bottom`,children:e})]})}function Ku(e){let{t}=N(),{target:n,label:r,count:i,active:a,waiting:o,onNavigate:s,icon:c}=e;return(0,U.jsx)(Gu,{label:r,children:(0,U.jsxs)(`a`,{href:e.href,"aria-current":a?`page`:void 0,className:M(`flex h-8 shrink-0 items-center gap-2 rounded-md px-2.5 text-sm font-medium whitespace-nowrap text-muted-foreground hover:bg-accent hover:text-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0`,a&&`bg-accent text-accent-foreground`),onClick:e=>{e.preventDefault(),s(n)},children:[(0,U.jsxs)(`span`,{"data-nav-icon":!0,className:`relative flex size-4 items-center justify-center`,children:[(0,U.jsx)(c,{"aria-hidden":!0}),i>0?(0,U.jsx)(Ll,{target:n,count:i,waiting:o,corner:!0,className:`lg:hidden`}):null]}),(0,U.jsx)(`span`,{className:`sr-only lg:not-sr-only`,children:r}),i>0?(0,U.jsx)(Ll,{target:n,count:i,waiting:o,className:`hidden lg:inline-flex`}):null,n===`runs`&&o>0?(0,U.jsx)(I,{variant:`warn`,className:`hidden lg:inline-flex`,"aria-label":t(`nav.waiting`,{count:o}),children:o}):null]})},n)}function qu({onNewTask:e,onPalette:t,notifications:n,showRepository:r}){let{t:i}=N();return(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center justify-end gap-1`,children:[(0,U.jsx)(Gu,{label:i(`nav.newTask`),children:(0,U.jsx)(A,{variant:`outline`,size:`icon`,className:`size-7 shrink-0 text-muted-foreground`,onClick:e,disabled:!e,"aria-label":i(`nav.newTask`),children:(0,U.jsx)(Vo,{})})}),(0,U.jsx)(Gu,{label:i(`nav.search`),children:(0,U.jsxs)(A,{variant:`outline`,size:`sm`,className:`shrink-0 text-muted-foreground [&_svg]:size-4`,onClick:t,"aria-label":i(`nav.palette`),children:[(0,U.jsx)(qo,{}),(0,U.jsx)(`span`,{className:`hidden lg:inline`,children:i(`nav.search`)}),(0,U.jsxs)(Ns,{className:`hidden lg:inline-flex`,children:[Es(),`K`]})]})}),(0,U.jsx)(hu,{state:n,compact:!0,showRepository:r}),(0,U.jsx)(Mu,{compact:!0}),(0,U.jsx)(Vu,{compact:!0})]})}function Ju({view:e,hrefFor:t,onNavigate:n,working:r,waiting:i,queued:a,onPalette:o,onNewTask:s,notifications:c,repository:l}){let{t:u}=N(),d=e=>e===`runs`?r:e===`queue`?a:0;return(0,U.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center justify-between gap-3 border-b bg-card px-3`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsxs)(`a`,{href:`#runs`,className:`flex shrink-0 items-center gap-1.5 text-sm font-semibold`,onClick:e=>{e.preventDefault(),n(`runs`)},children:[(0,U.jsx)(`span`,{className:`rounded bg-primary px-1.5 py-0.5 text-xs text-primary-foreground`,children:`aip`}),(0,U.jsx)(`span`,{children:`web`})]}),(0,U.jsx)(Il,{choice:l,compact:!0})]}),(0,U.jsx)(`nav`,{"aria-label":u(`nav.sections`),className:`flex shrink-0 items-center gap-1`,children:gs.map(({view:r,labelKey:a,icon:o})=>(0,U.jsx)(Ku,{target:r,label:u(`nav.${a}`),icon:o,count:d(r),active:r===e,waiting:i,href:t(r),onNavigate:n},r))}),(0,U.jsx)(qu,{onNewTask:s,onPalette:o,notifications:c,showRepository:l.repositories.length>1})]})}function Yu({nav:e,footer:t,children:n}){let r=ce(`(min-width: 768px)`);return(0,U.jsxs)(oa,{children:[(0,U.jsxs)(`div`,{className:`relative flex h-dvh flex-col overflow-hidden`,children:[r?(0,U.jsx)(Ju,{...e}):(0,U.jsx)(Wu,{...e}),(0,U.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,U.jsx)(`div`,{className:`relative flex min-h-0 flex-1 flex-col overflow-y-auto overscroll-contain`,children:n}),t]})]}),(0,U.jsx)(xt,{})]})}function Xu({daemon:e}){let{t}=N();if(!e)return null;let n=e.pid===null?``:` (pid ${e.pid})`,r=e=>e?`${e.version} ${e.fingerprint}`:t(`daemon.unknownBuild`),i=e.outdated===`client`?t(`daemon.newer`):t(e.daemon?`daemon.olderBusy`:`daemon.olderUnknown`,{pid:n});return(0,U.jsxs)(k,{variant:`warn`,className:`m-3 mb-0 flex w-auto flex-col gap-1`,children:[(0,U.jsxs)(`span`,{children:[i,e.outdated===`daemon`&&e.pid!==null?(0,U.jsxs)(U.Fragment,{children:[` `,(0,U.jsxs)(`code`,{children:[`kill `,e.pid]})]}):null]}),(0,U.jsx)(`span`,{className:`text-xs opacity-80`,children:t(`daemon.builds`,{daemon:r(e.daemon),panel:r(e.client)})})]})}var Zu=3e3;function Qu(e,t=null,n=`reconnecting`){let[r,i]=(0,L.useState)(null),[a,o]=(0,L.useState)(null),s=(0,L.useRef)(!0),c=(0,L.useRef)(!1),l=(0,L.useCallback)(async()=>{try{let t=await e.processes();if(!s.current)return;i(t.processes),o(null)}catch(e){if(!s.current)return;o(e instanceof Error?e.message:String(e))}},[e]);(0,L.useEffect)(()=>{t&&(t.processes?(i(t.processes),o(null)):t.error&&o(t.error))},[t]);let u=n!==`live`||t===null;return(0,L.useEffect)(()=>{s.current=!0;let e=null,t=()=>{e!==null&&clearInterval(e),e=null},n=()=>{t(),c.current?u&&l():(c.current=!0,l()),u&&(e=setInterval(()=>void l(),Zu))},r=()=>{document.visibilityState===`visible`?n():t()};return document.visibilityState===`visible`&&n(),document.addEventListener(`visibilitychange`,r),()=>{s.current=!1,t(),document.removeEventListener(`visibilitychange`,r)}},[l,u]),{processes:r,error:a,refresh:l}}function $u(e){let t=new Map;for(let n of e){let e=JSON.stringify([n.owner.runId,n.owner.group]),r=t.get(e);r?r.processes.push(n):t.set(e,{key:e,owner:n.owner,processes:[n]})}return[...t.values()]}var ed=.8;function td(e){return Math.floor(e*ed)}function nd(e,t,n){return t>=td(n)&&e>t?e:t}function rd(e,t){let n=td(t);return Math.max(Math.min(e,n),Math.min(160,n))}function id(){let[e,t]=(0,L.useState)(()=>window.innerHeight);return(0,L.useEffect)(()=>{let e=()=>t(window.innerHeight);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),e}function ad(){let[e,t]=P(`statusBar.height`,256),n=id(),r=Number.isFinite(e)?e:256;return{height:rd(r,n),chosen:r,viewportHeight:n,setChosen:t}}function od(e){return e===`ArrowUp`?16:e===`ArrowDown`?-16:0}function sd(e,t,n,r){return nd(e,rd(t+n,r),r)}function cd(e){let t=new Map;for(let n of e)if(!n.finished)for(let e of n.specialists??[]){let r=t.get(e.specialist);r||(r={specialist:e.specialist,name:e.name??e.specialist,max:null,running:[],waiting:[]},t.set(e.specialist,r)),e.max!==null&&e.max>0&&(r.max===null||e.max<r.max)&&(r.max=e.max);let i={runId:n.id,runTitle:n.title,repository:n.repository,pipeline:n.pipeline,level:e.level};for(let t of e.running)r.running.push({...i,group:t.slug,title:t.title,step:t.step,stepName:t.stepName??t.step,status:`running`});for(let t of e.waiting)r.waiting.push({...i,group:t.slug,title:t.title,step:t.step,stepName:t.stepName??t.step,status:`queued`})}return t}function ld(e,t){return e<t?-1:+(e>t)}function ud(e){return(t,n)=>Number(n===e)-Number(t===e)||ld(t,n)}function dd(e,t){let n=ud(t),r=[],i=new Map,a=0,o=0;for(let t of[...e.values()].sort((e,t)=>ld(e.specialist,t.specialist))){if(t.running.length===0&&t.waiting.length===0)continue;a+=t.running.length,o+=t.waiting.length;let e=new Map,s=new Map,c=t=>{let n=t.level===`global`?e:s,r=n.get(t.repository);r||(r={repository:t.repository,running:[],waiting:[]},n.set(t.repository,r)),(t.status===`running`?r.running:r.waiting).push(t)};if(t.running.forEach(c),t.waiting.forEach(c),e.size>0){let i=[...e.values()].sort((e,t)=>n(e.repository,t.repository));r.push({specialist:t.specialist,name:t.name,max:t.max,running:t.running.length,waiting:t.waiting.length,repositories:i})}for(let[e,n]of s){let r=i.get(e);r||(r={repository:e,running:0,waiting:0,specialists:[]},i.set(e,r)),r.running+=n.running.length,r.waiting+=n.waiting.length,r.specialists.push({specialist:t.specialist,name:t.name,max:t.max,totalRunning:t.running.length,running:n.running,waiting:n.waiting})}}return{global:r,project:[...i.values()].sort((e,t)=>n(e.repository,t.repository)),running:a,waiting:o}}var fd=kt,pd=jt,md=Nt;function hd({className:e,...t}){return(0,U.jsx)(yi,{className:M(`flex flex-col gap-3`,e),...t})}function gd({className:e,...t}){return(0,U.jsx)(xi,{className:M(`inline-flex w-fit items-center gap-1 border-b`,e),...t})}function _d({className:e,...t}){return(0,U.jsx)(Ci,{className:M(`-mb-px inline-flex items-center gap-1.5 border-b-2 border-transparent px-3 py-1.5 text-sm font-medium text-muted-foreground hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:text-muted-foreground data-[state=active]:border-primary data-[state=active]:text-foreground`,e),...t})}function vd({className:e,...t}){return(0,U.jsx)(Ti,{className:M(`min-w-0`,e),...t})}var yd=`border-b group-last/row:border-0`,bd=`${yd} px-2 py-1.5 text-right align-middle whitespace-nowrap tabular-nums`;function xd({task:e,onOpenGroup:t}){let{t:n}=N(),{owner:r}=e,i=e.processes[e.processes.length-1];return(0,U.jsx)(`tr`,{className:`bg-muted/40`,children:(0,U.jsx)(`th`,{scope:`rowgroup`,colSpan:6,className:`border-b px-2 py-1.5 text-left font-medium`,children:r.group===null?(0,U.jsx)(`span`,{className:`block truncate text-xs`,children:r.runTitle}):(0,U.jsx)(A,{variant:`link`,size:`sm`,className:`h-auto max-w-full justify-start p-0 text-xs font-medium`,onClick:()=>t({runId:r.runId,group:r.group,step:i.owner.step}),children:(0,U.jsx)(`span`,{className:`truncate`,children:n(`statusBar.owner`,{group:r.groupTitle??r.group,run:r.runTitle})})})})})}function Sd({command:e,onCopy:t}){let{t:n}=N();return(0,U.jsx)(`td`,{className:`${yd} min-w-0 px-2 py-1.5 align-middle`,children:(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,U.jsxs)(q,{children:[(0,U.jsx)(J,{asChild:!0,children:(0,U.jsx)(`code`,{tabIndex:0,className:`${se} block min-w-0 truncate`,children:e})}),(0,U.jsx)(Y,{className:`max-w-[min(40rem,90vw)] font-mono break-all`,children:e})]}),(0,U.jsxs)(q,{children:[(0,U.jsx)(J,{asChild:!0,children:(0,U.jsx)(A,{variant:`ghost`,size:`icon`,className:`size-6 shrink-0`,"aria-label":n(`statusBar.copyCommand`),onClick:()=>t(e),children:(0,U.jsx)(Ba,{className:`size-3.5`})})}),(0,U.jsx)(Y,{children:n(`statusBar.copyCommand`)})]})]})})}function Cd({process:e,killing:t,onKill:n,onCopy:r}){let{t:i,i18n:a}=N(),o=e.command===``?e.name:e.command;return(0,U.jsxs)(`tr`,{className:`group/row hover:bg-muted/50`,children:[(0,U.jsx)(`td`,{className:bd,children:e.pid}),(0,U.jsx)(Sd,{command:o,onCopy:r}),(0,U.jsx)(`td`,{className:bd,children:eu(e.uptimeSeconds,i)}),(0,U.jsx)(`td`,{className:bd,children:tu(e.cpuPercent,a.language)}),(0,U.jsx)(`td`,{className:bd,children:nu(e.memoryBytes,i,a.language)}),(0,U.jsx)(`td`,{className:`${yd} px-2 py-1.5 text-right align-middle`,children:(0,U.jsxs)(q,{children:[(0,U.jsx)(J,{asChild:!0,children:(0,U.jsx)(A,{variant:`ghost`,size:`icon`,className:`size-7 text-destructive hover:text-destructive`,disabled:t,"aria-label":i(`statusBar.killLabel`,{name:e.name,pid:e.pid}),onClick:n,children:(0,U.jsx)(Pa,{className:`size-4`})})}),(0,U.jsx)(Y,{children:i(`statusBar.kill`)})]})})]})}function wd(e,t){let{t:n}=N(),r=ke(),[i,a]=(0,L.useState)(new Set);return{killing:i,kill:async i=>{if(await r({title:n(`statusBar.killTitle`,{name:i.name,pid:i.pid}),description:n(`statusBar.killDescription`),confirmLabel:n(`statusBar.kill`),destructive:!0})){a(e=>new Set(e).add(i.pid));try{await e.killProcess(i.pid),await t.refresh()}catch(e){xe(e)}finally{a(e=>{let t=new Set(e);return t.delete(i.pid),t})}}},copy:async e=>{try{if(!navigator.clipboard)throw Error(n(`statusBar.copyFailed`));await navigator.clipboard.writeText(e),F(n(`statusBar.copied`))}catch{xe(n(`statusBar.copyFailed`))}}}}function Td({api:e,polled:t,onOpenGroup:n}){let{t:r}=N(),i=t.processes??[],{killing:a,kill:o,copy:s}=wd(e,t);if(t.error!==null&&t.processes===null)return(0,U.jsx)(`p`,{className:`text-destructive`,children:t.error});if(i.length===0)return(0,U.jsx)(`p`,{className:`text-muted-foreground`,children:r(`statusBar.noProcesses`)});let c=$u(i),l=`sticky top-0 z-10 border-b bg-card px-2 py-1.5 font-medium text-muted-foreground`;return(0,U.jsxs)(`table`,{className:`w-full table-fixed border-separate border-spacing-0 text-left`,children:[(0,U.jsxs)(`colgroup`,{children:[(0,U.jsx)(`col`,{className:`w-16`}),(0,U.jsx)(`col`,{}),(0,U.jsx)(`col`,{className:`w-24`}),(0,U.jsx)(`col`,{className:`w-20`}),(0,U.jsx)(`col`,{className:`w-24`}),(0,U.jsx)(`col`,{className:`w-20`})]}),(0,U.jsx)(`thead`,{children:(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`th`,{className:`${l} text-right`,children:r(`statusBar.pid`)}),(0,U.jsx)(`th`,{className:l,children:r(`statusBar.command`)}),(0,U.jsx)(`th`,{className:`${l} text-right`,children:r(`statusBar.uptime`)}),(0,U.jsx)(`th`,{className:`${l} text-right`,children:r(`statusBar.cpu`)}),(0,U.jsx)(`th`,{className:`${l} text-right`,children:r(`statusBar.memory`)}),(0,U.jsx)(`th`,{className:l,children:(0,U.jsx)(`span`,{className:`sr-only`,children:r(`statusBar.kill`)})})]})}),c.map(e=>(0,U.jsxs)(`tbody`,{children:[(0,U.jsx)(xd,{task:e,onOpenGroup:n}),e.processes.map(e=>(0,U.jsx)(Cd,{process:e,killing:a.has(e.pid),onKill:()=>void o(e),onCopy:e=>void s(e)},e.pid))]},e.key))]})}var Ed={live:`bg-status-ok`,reconnecting:`bg-status-warn motion-safe:animate-pulse`,polling:`bg-status-run`};function Dd({connection:e,compact:t=!1}){let{t:n}=N(),r=du(e,n);return(0,U.jsxs)(q,{children:[(0,U.jsx)(J,{asChild:!0,children:(0,U.jsxs)(`div`,{role:`status`,tabIndex:0,"aria-label":n(`connection.label`,{state:r}),"data-nav-row":!0,className:M(Ol(),`text-xs text-muted-foreground`,t&&`w-8 justify-center px-0`),children:[(0,U.jsx)(`span`,{"aria-hidden":!0,className:`flex size-4 items-center justify-center`,children:(0,U.jsx)(`span`,{className:M(`size-2 shrink-0 rounded-full`,Ed[e])})}),t?null:(0,U.jsx)(`span`,{children:r})]})}),(0,U.jsx)(Y,{side:t?`bottom`:`top`,children:t?`${r} (${e})`:e})]})}function Od({open:e,summary:t,connection:n}){let{t:r}=N();return(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(pd,{asChild:!0,children:(0,U.jsxs)(A,{variant:`ghost`,size:`sm`,className:`flex h-8 min-w-0 flex-1 justify-start gap-2 rounded-none px-4`,"aria-label":r(`statusBar.title`),children:[e?(0,U.jsx)(Sa,{className:`size-4`}):(0,U.jsx)(Ea,{className:`size-4`}),(0,U.jsx)(`span`,{className:`truncate text-muted-foreground`,children:t})]})}),(0,U.jsx)(`div`,{className:`shrink-0 pr-2`,children:(0,U.jsx)(Dd,{connection:n})})]})}function $({status:e,label:t,title:n,wait:r,tip:i,onClick:a}){let{t:o}=N(),s=su(e,o),c=s.icon,l=t??s.label;return(0,U.jsxs)(q,{children:[(0,U.jsx)(J,{asChild:!0,children:(0,U.jsxs)(I,{variant:s.tone,"aria-label":`${l} (${e})`,tabIndex:0,...a?{role:`button`,className:`cursor-pointer`,onClick:a,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),a())}}:{},children:[(0,U.jsx)(c,{"aria-hidden":!0,className:M(s.spin&&`motion-safe:animate-spin`)}),(0,U.jsx)(`span`,{className:`min-w-0 truncate`,title:n,children:l})]})}),(0,U.jsx)(Y,{children:r?`${cu(r,o)} (${e})`:i?`${e} · ${i}`:e})]})}function kd({entries:e,onOpen:t}){return(0,U.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:e.map(e=>(0,U.jsxs)(`li`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-2`,children:[(0,U.jsx)(A,{variant:`link`,size:`sm`,className:`h-auto min-w-0 p-0 text-left whitespace-normal`,onClick:()=>t(e),children:e.title}),(0,U.jsx)($,{status:e.status}),(0,U.jsxs)(`span`,{className:`text-muted-foreground`,children:[e.stepName,` · `,e.runTitle]})]},`${e.runId}/${e.group}/${e.status}`))})}function Ad({running:e,waiting:t}){let{t:n}=N();return(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:[...e>0?[n(`specialistLoad.running`,{n:e})]:[],...t>0?[n(`specialistLoad.waiting`,{n:t})]:[]].join(` · `)})}function jd({use:e,onOpen:t}){return(0,U.jsxs)(`div`,{className:`flex flex-col gap-0.5 pl-3`,children:[(0,U.jsxs)(`div`,{className:`flex gap-2`,title:e.repository,children:[(0,U.jsx)(`span`,{className:`font-medium`,children:O(e.repository)}),(0,U.jsx)(Ad,{running:e.running.length,waiting:e.waiting.length})]}),(0,U.jsx)(`div`,{className:`pl-3`,children:(0,U.jsx)(kd,{entries:[...e.running,...e.waiting],onOpen:t})})]})}function Md({runs:e,selected:t,onOpenGroup:n}){let{t:r}=N(),i=(0,L.useMemo)(()=>dd(cd(e),t),[e,t]),a=i.running===0&&i.waiting===0,o=e=>e===null?``:` ${r(`specialistLoad.limit`,{max:e})}`;return(0,U.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[a?(0,U.jsx)(`p`,{className:`text-muted-foreground`,children:r(`specialistLoad.none`)}):null,i.global.length>0?(0,U.jsxs)(`section`,{"aria-label":r(`specialistLoad.global`),className:`flex flex-col gap-2`,children:[(0,U.jsx)(`h3`,{className:`font-semibold`,children:r(`specialistLoad.global`)}),i.global.map(e=>(0,U.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(`span`,{className:`font-medium`,title:e.specialist,children:e.name}),(0,U.jsxs)(`span`,{className:`text-muted-foreground`,children:[e.max===null?r(`topology.busyUnlimited`,{n:e.running}):r(`topology.busy`,{n:e.running,max:e.max}),e.waiting>0?` · ${r(`specialistLoad.waiting`,{n:e.waiting})}`:``]})]}),e.repositories.map(e=>(0,U.jsx)(jd,{use:e,onOpen:n},e.repository))]},e.specialist))]}):null,i.project.length>0?(0,U.jsxs)(`section`,{"aria-label":r(`specialistLoad.project`),className:`flex flex-col gap-2`,children:[(0,U.jsx)(`h3`,{className:`font-semibold`,children:r(`specialistLoad.project`)}),i.project.map(e=>(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsxs)(`div`,{className:`flex gap-2`,title:e.repository,children:[(0,U.jsx)(`span`,{className:`font-medium`,children:O(e.repository)}),(0,U.jsx)(Ad,{running:e.running,waiting:e.waiting})]}),e.specialists.map(e=>(0,U.jsxs)(`div`,{className:`flex flex-col gap-0.5 pl-3`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsxs)(`span`,{className:`font-medium`,title:e.specialist,children:[e.name,o(e.max)]}),(0,U.jsx)(Ad,{running:e.running.length,waiting:e.waiting.length}),e.totalRunning>e.running.length?(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:r(`specialistLoad.machine`,{n:e.totalRunning})}):null]}),(0,U.jsx)(`div`,{className:`pl-3`,children:(0,U.jsx)(kd,{entries:[...e.running,...e.waiting],onOpen:n})})]},e.specialist))]},e.repository))]}):null]})}function Nd(e){document.body.classList.remove(`select-none`),e(null)}function Pd({height:e,chosen:t,viewportHeight:n,onPreview:r,onCommit:i}){let{t:a}=N(),o=(0,L.useRef)(null),[s,c]=(0,L.useState)(!1),l=td(n),u=(0,L.useRef)(r);u.current=r,(0,L.useEffect)(()=>()=>{o.current!==null&&(o.current=null,Nd(u.current))},[]);let d=()=>{let e=o.current;e!==null&&(o.current=null,c(!1),Nd(r),i(nd(t,e.last,n)))};return(0,U.jsx)(`div`,{role:`separator`,"aria-orientation":`horizontal`,"aria-label":a(`statusBar.resize`),"aria-valuenow":e,"aria-valuemin":Math.min(160,l),"aria-valuemax":l,tabIndex:0,"data-dragging":s||void 0,className:`absolute inset-x-0 -top-1 z-20 h-2 cursor-row-resize touch-none transition-colors hover:bg-primary/30 focus-visible:bg-primary/40 focus-visible:outline-none data-[dragging]:bg-primary/40`,onPointerDown:t=>{o.current={startY:t.clientY,startHeight:e,last:e},c(!0),document.body.classList.add(`select-none`),t.currentTarget.setPointerCapture?.(t.pointerId)},onPointerMove:e=>{let t=o.current;t!==null&&(t.last=rd(t.startHeight+(t.startY-e.clientY),n),r(t.last))},onPointerUp:d,onPointerCancel:d,onKeyDown:r=>{let a=od(r.key);a!==0&&(r.preventDefault(),i(sd(t,e,a,n)))}})}function Fd({runs:e,selected:t,connection:n,streamedProcesses:r=null,api:i,onOpenGroup:a}){let{t:o}=N(),[s,c]=P(`specialistLoad.open`,!1),[l,u]=P(`statusBar.tab`,`specialists`),d=ad(),[f,p]=(0,L.useState)(null),m=Qu(i,r,n),h=(0,L.useMemo)(()=>dd(cd(e),t),[e,t]),g=m.processes===null?`—`:String(m.processes.length);return(0,U.jsxs)(fd,{open:s,onOpenChange:c,className:`sticky bottom-0 shrink-0 border-t bg-card text-xs`,"data-testid":`status-bar`,children:[s?(0,U.jsx)(Pd,{height:f??d.height,chosen:d.chosen,viewportHeight:d.viewportHeight,onPreview:p,onCommit:d.setChosen}):null,(0,U.jsx)(Od,{open:s,summary:o(`statusBar.summary`,{running:h.running,waiting:h.waiting,processes:g}),connection:n}),(0,U.jsx)(md,{className:`flex flex-col px-4 pb-3`,style:{height:f??d.height},"data-testid":`status-bar-content`,children:(0,U.jsxs)(hd,{value:l,onValueChange:e=>u(e),className:`flex min-h-0 flex-1 flex-col gap-0`,children:[(0,U.jsxs)(gd,{className:`shrink-0`,children:[(0,U.jsx)(_d,{value:`specialists`,children:o(`statusBar.tabSpecialists`)}),(0,U.jsx)(_d,{value:`processes`,children:o(`statusBar.tabProcesses`)})]}),(0,U.jsx)(vd,{value:`specialists`,className:`min-h-0 flex-1 overflow-y-auto pt-3`,children:(0,U.jsx)(Md,{runs:e,selected:t,onOpenGroup:a})}),(0,U.jsx)(vd,{value:`processes`,className:`min-h-0 flex-1 overflow-y-auto`,children:(0,U.jsx)(Td,{api:i,polled:m,onOpenGroup:a})})]})})]})}var Id=e=>new EventSource(e),Ld=new Set([`snapshot`,`daemon`,`repositories`,`tags`,`run`,`queue`,`processes`,`network`]);function Rd(e){return Ld.has(e.event)}function zd(e){let t;try{t=JSON.parse(e)}catch{return null}return typeof t==`object`&&t?t:null}var Bd=3e3,Vd=4e3;function Hd(e,t,n){let r=null,i=null;return{start:()=>{r||i||(i=setTimeout(()=>{i=null,n()||(t(),e(),r=setInterval(()=>void e(),Bd))},Vd))},stop:()=>{r&&clearInterval(r),i&&clearTimeout(i),r=null,i=null}}}function Ud(e,t,n){e.onopen=()=>{t.stop(),n.live()},e.onmessage=e=>{let r=zd(e.data);r!==null&&(t.stop(),n.live(),n.event(r))},e.onerror=()=>{n.broken(),t.start()}}function Wd(e,t=()=>{}){return{tags:e,byId:new Map(e.map(e=>[e.id,e])),of:t=>t===null?[]:e.filter(e=>e.repository===t),update:t}}var Gd=Wd([]),Kd=(0,L.createContext)(Gd);function qd({tags:e,onTags:t,children:n}){let r=(0,L.useMemo)(()=>Wd(e,t),[e,t]);return(0,U.jsx)(Kd,{value:r,children:n})}function Jd(){return(0,L.useContext)(Kd)}function Yd(e){return e.effective?.name?.trim()||(typeof e.raw.name==`string`?e.raw.name.trim():``)||e.slug}function Xd(e){return new Map(e.map(e=>[e.slug,Yd(e)]))}function Zd(e,t){return e.get(t)||t}function Qd(e,t){let n=Zd(e,t);return n===t?t:`${n} (${t})`}var $d=[`needs_human`,`conflict`,`failed`];function ef(e){return $d.includes(e.status)}function tf(e){return[...e].sort((e,t)=>Number(ef(t))-Number(ef(e)))}function nf(e){return[...tf(e.groups),...tf(e.system??[])]}function rf(e){let t=e.system??[];return e.groups.find(ef)??t.find(ef)??e.groups[0]??t.find(e=>e.kind===`split`)??t[0]??null}function af({id:e,name:t,focusable:n=!0}){let{t:r}=N(),i=t===e?r(`pipelineBadge.labelSame`,{id:e}):r(`pipelineBadge.label`,{name:t,id:e});return(0,U.jsxs)(q,{children:[(0,U.jsx)(J,{asChild:!0,children:(0,U.jsxs)(I,{variant:`outline`,className:`max-w-40 rounded-md`,"aria-label":i,tabIndex:n?0:void 0,children:[(0,U.jsx)(no,{"aria-hidden":!0}),(0,U.jsx)(`span`,{className:`min-w-0 truncate`,children:t})]})}),(0,U.jsx)(Y,{children:i})]})}function of(e){return typeof e.name==`string`&&e.name.trim()!==``?e.name.trim():null}function sf({go:e,to:t}){let{t:n}=N();return(0,U.jsx)(Z,{heading:n(`palette.sections`),children:gs.map(({view:r,labelKey:i,icon:a})=>{let o=n(`nav.${i}`);return(0,U.jsxs)(Q,{value:`${n(`palette.section`)} ${o}`,onSelect:()=>e(t(r)),children:[(0,U.jsx)(a,{}),o]},r)})})}function cf({go:e,runs:t}){let{t:n}=N();return(0,U.jsx)(Z,{heading:n(`palette.runs`),children:t.map(t=>(0,U.jsxs)(Q,{value:`${n(`palette.run`)} ${Rl(t.number)} ${Gl(t)} ${t.id} ${t.pipelineName} ${t.pipeline}`,onSelect:()=>e({view:`runs`,run:t.id,group:null,step:null,tab:null}),children:[(0,U.jsxs)(`span`,{className:`truncate`,children:[(0,U.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:Rl(t.number)}),` `,Gl(t)]}),(0,U.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[(0,U.jsx)(af,{id:t.pipeline,name:t.pipelineName,focusable:!1}),(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:uu(t,n)})]})]},t.id))})}function lf({go:e,run:t}){let{t:n}=N();return(0,U.jsx)(Z,{heading:n(`palette.groups`),children:tf(t.groups).map(r=>(0,U.jsx)(Q,{value:`${n(`palette.group`)} ${r.title} ${r.slug}`,onSelect:()=>e({view:`runs`,run:t.id,group:r.slug,step:null,tab:null}),children:r.title},r.slug))})}function uf({go:e,to:t,entries:n}){let{t:r}=N();return(0,U.jsxs)(U.Fragment,{children:[n.pipelines.length>0?(0,U.jsx)(Z,{heading:r(`palette.pipelines`),children:n.pipelines.map(n=>{let i=of(n.raw)??n.id;return(0,U.jsx)(Q,{value:`${r(`palette.pipelines`)} ${i} ${n.id}`,title:n.id,onSelect:()=>e(t(`pipelines`,n.id)),children:i},n.id)})}):null,n.specialists.length>0?(0,U.jsx)(Z,{heading:r(`palette.specialists`),children:n.specialists.map(n=>{let i=Yd(n);return(0,U.jsx)(Q,{value:`${r(`palette.specialist`)} ${i} ${n.slug}`,onSelect:()=>e(t(`specialists`,n.slug)),children:i},n.slug)})}):null]})}function df({onNewTask:e,onShortcuts:t}){let{t:n}=N();return(0,U.jsxs)(Z,{heading:n(`palette.actions`),children:[(0,U.jsx)(Q,{value:`${n(`palette.action`)} ${n(`palette.newTask`)}`,onSelect:e,children:n(`palette.newTask`)}),(0,U.jsx)(Q,{value:`${n(`palette.action`)} ${n(`palette.shortcuts`)}`,onSelect:t,children:n(`palette.shortcuts`)})]})}function ff({onChosen:e}){let{t}=N(),{setChoice:n}=Au(),r=[`system`,...gu.map(e=>e.code)];return(0,U.jsx)(Z,{heading:t(`palette.language`),children:r.map(r=>{let i=r===`system`?t(`language.system`):gu.find(e=>e.code===r)?.name??r;return(0,U.jsx)(Q,{value:`${t(`palette.language`)} ${i} ${r}`,onSelect:()=>{e(),n(r)},children:i},r)})})}function pf({open:e,onOpenChange:t,api:n,runs:r,route:i,onRoute:a,onShortcuts:o}){let{t:s}=N(),[c,l]=(0,L.useState)(null);(0,L.useEffect)(()=>{e&&!c&&n.config().then(e=>l({pipelines:e.pipelines,specialists:e.specialists}),()=>l({pipelines:[],specialists:[]}))},[e,c,n]);let u=e=>{t(!1),a(e)},d=(e,t=null)=>({view:e,run:t,group:null,step:null,tab:null}),f=r.find(e=>e.id===i.run)??null,p=[...r].sort((e,t)=>Number(t.state===`needs_human`)-Number(e.state===`needs_human`));return(0,U.jsxs)(ul,{open:e,onOpenChange:t,title:s(`palette.title`),children:[(0,U.jsx)(dl,{placeholder:s(`palette.placeholder`)}),(0,U.jsxs)(fl,{children:[(0,U.jsx)(pl,{children:s(`palette.empty`)}),(0,U.jsx)(sf,{go:u,to:d}),(0,U.jsx)(cf,{go:u,runs:p}),f&&f.groups.length>1?(0,U.jsx)(lf,{go:u,run:f}):null,c?(0,U.jsx)(uf,{go:u,to:d,entries:c}):null,(0,U.jsx)(df,{onNewTask:()=>{u(d(`queue`)),js(`queue-task`)},onShortcuts:()=>{t(!1),o()}}),(0,U.jsx)(ff,{onChosen:()=>t(!1)})]})]})}function mf({open:e,onOpenChange:t}){let{t:n}=N(),r=[[`${Es()}+K`,n(`shortcuts.palette`)],[`j`,n(`shortcuts.nextRun`)],[`k`,n(`shortcuts.previousRun`)],[`?`,n(`shortcuts.help`)],[`Esc`,n(`shortcuts.close`)]];return(0,U.jsx)(rl,{open:e,onOpenChange:t,children:(0,U.jsxs)(il,{children:[(0,U.jsxs)(al,{children:[(0,U.jsx)(sl,{children:n(`shortcuts.title`)}),(0,U.jsx)(cl,{children:n(`shortcuts.description`)})]}),(0,U.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] items-center gap-x-4 gap-y-2 text-sm`,children:r.map(([e,t])=>(0,U.jsxs)(`div`,{className:`contents`,children:[(0,U.jsx)(`dt`,{children:(0,U.jsx)(Ns,{children:e})}),(0,U.jsx)(`dd`,{children:t})]},e))})]})})}var hf=`modulepreload`,gf=function(e){return`/`+e},_f={},vf=function(e){return e.pathname.endsWith(`.css`)},yf=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},bf=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=gf(t,n);let r=s(t),i=vf(r);return yf(_f,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:hf,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},xf=(0,L.lazy)(()=>bf(()=>import(`./queue-CAuAo--6.js`).then(e=>({default:e.NewTaskDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),Sf=(0,L.lazy)(()=>bf(()=>import(`./queue-CAuAo--6.js`).then(e=>({default:e.QueuePage})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),Cf=(0,L.lazy)(()=>bf(()=>import(`./specialists-Durm0DgK.js`).then(e=>e.t).then(e=>({default:e.SpecialistsPage})),__vite__mapDeps([10,1,2,3,9,5,4,6,11,12]))),wf=(0,L.lazy)(()=>bf(()=>import(`./pipelines-DQglwIkL.js`).then(e=>e.t).then(e=>({default:e.PipelinesPage})),__vite__mapDeps([13,1,3,2,6,4,14,5,10,9,11,12,8,15]))),Tf=(0,L.lazy)(()=>bf(()=>import(`./stats-67akPa3A.js`).then(e=>({default:e.StatsPage})),__vite__mapDeps([16,1,2,3,4,9,12]))),Ef=(0,L.lazy)(()=>bf(()=>import(`./settings-6eHKYbS7.js`).then(e=>({default:e.SettingsPage})),__vite__mapDeps([17,1,10,2,3,9,5,4,6,11,12,14,7])));function Df({what:e}){let{t}=N();return(0,U.jsxs)(`div`,{role:`status`,"aria-label":t(`app.loading`,{what:e}),className:`flex flex-col gap-2 p-4`,children:[(0,U.jsx)(j,{className:`h-8 w-64`}),(0,U.jsx)(j,{className:`h-40`})]})}var Of=(e,t,n=null)=>({view:e,run:t,group:n,step:null,tab:null});function kf(e){let{t}=N(),{common:n}=e;return(0,U.jsx)(L.Suspense,{fallback:(0,U.jsx)(Df,{what:t(`app.loadingQueue`)}),children:(0,U.jsx)(Sf,{api:n.api,queue:e.queue,now:e.now,drafts:e.drafts,onDraft:e.onDraft,onQueue:e.onQueue,onError:e.onError,onNewTask:e.onNewTask,runs:n.runs},n.pageKey)})}function Af({common:e,registry:t}){let{t:n}=N(),{route:r,onRoute:i}=e;return(0,U.jsx)(L.Suspense,{fallback:(0,U.jsx)(Df,{what:n(`app.loadingStats`)}),children:(0,U.jsx)(Tf,{api:e.api,registry:t,runs:e.runs,period:Zs(r.group),project:r.run,onFilter:(e,t)=>i({view:`stats`,run:t,group:e,step:null,tab:null})})})}function jf(e){let{t}=N(),{common:n,...r}=e,i=Hs(n.route.group,n.route.run),a=e=>t=>n.onRoute({...Of(`settings`,e,`global`),step:t});return(0,U.jsx)(L.Suspense,{fallback:(0,U.jsx)(Df,{what:t(`app.loadingSettings`)}),children:(0,U.jsx)(Ef,{api:n.api,scope:i.scope,group:i.group,specialist:n.route.step,onSelectSpecialist:a(`specialists`),pipeline:n.route.step,onSelectPipeline:a(`pipelines`),chain:n.route.step,onSelectChain:a(`chains`),project:n.route.step,onSelectProject:a(`projects`),observerTab:n.route.step,onSelectObserverTab:a(`observers`),dirty:n.dirty,...r},n.pageKey)})}function Mf({common:e}){let{t}=N(),{route:n,onRoute:r}=e;return n.view===`pipelines`?(0,U.jsx)(L.Suspense,{fallback:(0,U.jsx)(Df,{what:`pipeline`}),children:(0,U.jsx)(wf,{dirty:e.dirty,api:e.api,runs:e.runs,selected:n.run,section:n.group,onSelect:(e,t=null)=>r(Of(`pipelines`,e,t)),onOpenGroup:(e,t)=>r({...Of(`runs`,e.runId,e.slug),step:t})},e.pageKey)}):(0,U.jsx)(L.Suspense,{fallback:(0,U.jsx)(Df,{what:t(`app.loadingSpecialists`)}),children:(0,U.jsx)(Cf,{dirty:e.dirty,api:e.api,selected:n.run,section:n.group,onSelect:(t,n=null)=>e.onRoute({...Of(`specialists`,t),group:n})},e.pageKey)})}function Nf(e){let{pageKey:t,...n}=e;return(0,U.jsx)(L.Suspense,{fallback:null,children:(0,U.jsx)(xf,{...n},t)})}function Pf({panel:e}){let{state:t,chrome:n,route:r,scopedApi:i}=e,{newTask:a}=n,{queue:o,selected:s,runs:c}=t,l={...n,api:e.api,waiting:e.waitingRepositories,onRoute:e.setRoute,queueDrafts:n.drafts.queueDrafts,onQueueDraft:n.drafts.onQueueDraft,palette:n.palette,onPalette:n.setPalette,shortcuts:n.shortcuts,onShortcuts:n.setShortcuts};return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(pf,{open:l.palette,onOpenChange:l.onPalette,api:i,runs:c,route:r,onRoute:l.onRoute,onShortcuts:()=>l.onShortcuts(!0)}),o!==null&&s!==null&&a.opened?(0,U.jsx)(Nf,{api:l.api,pageKey:s,selected:s,repositories:t.repositories,waiting:l.waiting,queues:t.queues,runs:c,preset:a.preset,onPresetApplied:()=>a.setPreset(null),open:a.open,onOpenChange:a.setOpen,draft:l.queueDrafts.new,onDraft:e=>l.onQueueDraft(`new`,e),onQueue:t.setQueue}):null,(0,U.jsx)(mf,{open:l.shortcuts,onOpenChange:l.onShortcuts})]})}var Ff=[`needs_human`,`active`,`repair`,`queued`,`paused`,`frozen`,`finished`,`failed`,`cancelled`],If={states:[],pipelines:[],specialists:[],tagIds:[],repositories:[]},Lf=[`states`,`pipelines`,`specialists`,`tagIds`,`repositories`];function Rf(e){let t=(e.steps??[]).filter(e=>!e.skipped).map(e=>e.specialist),n=e.topology?.split?.specialist;return[...new Set(n?[...t,n]:t)]}function zf(e,t,n=new Map){if(t.length===0)return!0;let r=t.flatMap(e=>n.get(e)?.name.toLowerCase()??[]);return(e.tags??[]).some(e=>t.includes(e.id)||r.includes(e.name.toLowerCase()))}function Bf(e,t){let n=(e.tags??[]).flatMap(e=>t.get(e.id)?.name??[]);return[Gl(e),e.name,e.pipeline,e.pipelineName,e.id,Rl(e.number),...e.groups.map(e=>e.title),...n,...Rf(e)].filter(e=>!!e).join(`
5
+ `).toLowerCase()}function Vf(e,t){return t===null?e:e.filter(e=>e.repository===t)}function Hf(e,t,n){let r=t.trim().toLowerCase();if(r===``)return!0;let i=/^#(\d+)$/.exec(r);return i?e.number===Number(i[1]):Bf(e,n).includes(r)}function Uf(e,t,n,r,i){switch(t){case`states`:return n.states.length===0||n.states.includes(e.state);case`pipelines`:return n.pipelines.length===0||n.pipelines.includes(e.pipeline);case`specialists`:return n.specialists.length===0||Rf(e).some(e=>n.specialists.includes(e));case`tagIds`:return zf(e,n.tagIds,i);case`repositories`:return r!==`all`||n.repositories.length===0||n.repositories.includes(e.repository)}}function Wf(e,t,n,r,i=null,a=new Map){return Vf(e,r===`repository`?i:null).filter(e=>Hf(e,t,a)&&Lf.every(t=>Uf(e,t,n,r,a)))}function Gf(e,t,n,r,i,a,o){return Vf(e,r===`repository`?i:null).filter(e=>Hf(e,t,a)&&Lf.every(t=>t===o||Uf(e,t,n,r,a)))}function Kf(e,t,n,r,i,a,o){let s=new Map,c=e=>s.set(e,(s.get(e)??0)+1);for(let s of Gf(e,t,n,r,i,a,o))switch(o){case`states`:c(s.state);break;case`pipelines`:c(s.pipeline);break;case`specialists`:Rf(s).forEach(c);break;case`repositories`:c(s.repository);break;case`tagIds`:for(let e of a.keys())(s.tags??[]).length>0&&zf(s,[e],a)&&c(e)}return s}function qf(e){let t=e.filter(e=>e.state===`needs_human`).length;return{working:e.filter(e=>e.state===`active`||it(e)).length+t,waiting:t}}function Jf(e,t,n){return(e.trim()===``?0:1)+Lf.reduce((e,r)=>e+(r===`repositories`&&n!==`all`?0:t[r].length),0)}function Yf({onBack:e,children:t}){let{t:n}=N();return(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,U.jsxs)(A,{variant:`ghost`,size:`sm`,className:`m-2 w-fit`,onClick:e,children:[(0,U.jsx)(ua,{}),n(`runs.page.back`)]}),t]})}function Xf({label:e,countLabel:t,wide:n,children:r}){let i=(0,U.jsxs)(A,{variant:`outline`,size:`sm`,className:`w-full justify-start`,children:[(0,U.jsx)(ho,{}),t??e]});return n?(0,U.jsxs)(ml,{children:[(0,U.jsx)(hl,{asChild:!0,children:i}),(0,U.jsx)(gl,{className:`w-80 p-3`,children:r})]}):(0,U.jsxs)(vs,{children:[(0,U.jsx)(ys,{asChild:!0,children:i}),(0,U.jsxs)(bs,{children:[(0,U.jsx)(xs,{children:e}),(0,U.jsx)(Ss,{className:`sr-only`,children:e}),(0,U.jsx)(`div`,{className:`p-3`,children:r})]})]})}var Zf=[`builtin`,`project`,`global`],Qf=`__create`;function $f({text:e,icon:t,hint:n,note:r,disabled:i,onRemove:a}){let{t:o}=N();return(0,U.jsxs)(I,{variant:`outline`,className:`min-w-0 max-w-full gap-1.5 pr-1`,children:[t,(0,U.jsx)(`span`,{className:`min-w-0 truncate`,title:n??e,children:e}),r?(0,U.jsx)(`span`,{className:`font-normal text-status-warn`,children:r}):null,(0,U.jsx)(`button`,{type:`button`,"aria-label":o(`picker.remove`,{value:e}),disabled:i,className:`shrink-0 rounded-full p-0.5 hover:bg-accent disabled:opacity-50`,onClick:a,children:(0,U.jsx)(hs,{})})]})}function ep({source:e,heading:t,options:n,values:r,mark:i,display:a,look:o,onAdd:s}){let{t:c}=N();return n.length===0?null:(0,U.jsx)(Z,{heading:(t??c(`picker.groups.${e}`))||void 0,children:n.map(t=>{let n=i?.(t.name)??null,c=a?.(t.name)??t.name;return(0,U.jsxs)(Q,{value:`${e}:${t.name}`,className:`items-start`,onSelect:()=>s(t.name),children:[(0,U.jsx)(ba,{className:`mt-0.5 shrink-0 ${r.includes(t.name)?`opacity-100`:`opacity-0`}`}),o.icon?(0,U.jsx)(`span`,{className:`flex h-5 shrink-0 items-center`,children:o.icon(t.name)}):null,(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,U.jsxs)(`span`,{className:`line-clamp-3 whitespace-normal break-words`,title:o.hint?.(t.name)??c,children:[c,n?(0,U.jsx)(`span`,{className:`ml-2 text-xs text-status-warn`,children:n}):null]}),t.description&&!a?(0,U.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:t.description}):null]})]},`${e}:${t.name}`)})})}function tp(e,t){let n=t.toLowerCase();return e.filter(e=>n===``||e.name.toLowerCase().includes(n)||(e.description??``).toLowerCase().includes(n))}function np({inherited:e,values:t,display:n,look:r,mark:i,disabled:a,onRemove:o}){let{t:s}=N();return(0,U.jsxs)(U.Fragment,{children:[e.map(e=>(0,U.jsxs)(I,{variant:`mute`,"data-inherited":!0,children:[e,(0,U.jsx)(`span`,{className:`font-normal`,children:s(`picker.fromDefaults`)})]},`inherited:${e}`)),t.map(e=>(0,U.jsx)($f,{text:n?.(e)??e,icon:r?.icon?.(e),hint:r?.hint?.(e),note:i?.(e)??null,disabled:a,onRemove:()=>o(e)},e))]})}function rp({id:e,label:t,open:n,listId:r,disabled:i}){let{t:a}=N();return(0,U.jsx)(hl,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,id:e,role:`combobox`,"aria-label":t,"aria-expanded":n,"aria-haspopup":`listbox`,"aria-controls":n?r:void 0,disabled:i,className:`inline-flex h-6 items-center gap-1 rounded-full px-2 text-xs text-muted-foreground hover:bg-accent disabled:opacity-50`,children:[(0,U.jsx)(Vo,{className:`size-3`}),a(`picker.add`)]})})}function ip({listId:e,options:t,visible:n,typed:r,canCreate:i,values:a,headings:o,mark:s,display:c,look:l,onAdd:u}){let{t:d}=N();return(0,U.jsxs)(fl,{id:e,children:[n.length===0&&!i?(0,U.jsx)(pl,{children:t.length===0?d(`picker.typeValue`):d(`picker.nothing`)}):null,Zf.map(e=>(0,U.jsx)(ep,{source:e,heading:o?.[e],options:n.filter(t=>t.source===e),values:a,mark:s,display:c,look:l,onAdd:e=>u([e])},e)),i?(0,U.jsx)(Z,{children:(0,U.jsxs)(Q,{value:`${Qf}:${r}`,onSelect:()=>u([r]),children:[(0,U.jsx)(Vo,{}),d(`picker.create`,{value:r})]})}):null]})}function ap(e,t){let n=[...e];for(let e of t){let t=e.trim();t!==``&&!n.includes(t)&&n.push(t)}return n}function op(e,t,n){let r=n.trim().toLowerCase();return e.filter(e=>r===``||e.label.toLowerCase().includes(r)||(e.hint??``).toLowerCase().includes(r)).map((e,t)=>({option:e,index:t})).sort((e,n)=>Number(t.includes(n.option.value))-Number(t.includes(e.option.value))||e.index-n.index).map(({option:e})=>e)}function sp({option:e,checked:t,onToggle:n}){return(0,U.jsxs)(Q,{value:`option:${e.value}`,onSelect:n,children:[(0,U.jsx)(ba,{className:M(t?`opacity-100`:`opacity-0`)}),(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[e.render??(0,U.jsx)(`span`,{className:`truncate`,children:e.label}),e.hint?(0,U.jsx)(`span`,{className:`text-xs break-all text-muted-foreground`,children:e.hint}):null]}),e.count===void 0?null:(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,children:e.count})]})}function cp(e){let t=new Map;for(let n of e)t.set(n.group,[...t.get(n.group)??[],n]);return[...t]}function lp({label:e,listId:t,options:n,selected:r,query:i,onQuery:a,onChange:o,clearLabel:s}){let{t:c}=N(),l=op(n,r,i),u=e=>o(r.includes(e)?r.filter(t=>t!==e):[...r,e]);return(0,U.jsxs)(ll,{shouldFilter:!1,label:c(`picker.search`,{label:e}),children:[(0,U.jsx)(dl,{value:i,onValueChange:a,placeholder:c(`picker.searchOnly`)}),(0,U.jsxs)(fl,{id:t,children:[(0,U.jsx)(pl,{children:c(`picker.nothing`)}),cp(l).map(([e,t])=>(0,U.jsx)(Z,{heading:e||void 0,children:t.map(e=>(0,U.jsx)(sp,{option:e,checked:r.includes(e.value),onToggle:()=>u(e.value)},e.value))},e??``)),r.length>0?(0,U.jsx)(Z,{className:`border-t`,children:(0,U.jsx)(Q,{value:`clear`,onSelect:()=>o([]),children:s})}):null]})]})}function up({id:e,label:t,options:n,selected:r,onChange:i,clearLabel:a}){let o=(0,L.useId)(),[s,c]=(0,L.useState)(!1),[l,u]=(0,L.useState)(``);return(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t}),(0,U.jsxs)(ml,{open:s,onOpenChange:e=>{c(e),e||u(``)},children:[(0,U.jsxs)(`div`,{className:`flex min-h-9.5 min-w-0 max-w-full flex-wrap items-center gap-1.5 rounded-md border border-input bg-card p-1.5`,children:[(0,U.jsx)(np,{inherited:[],values:r,display:e=>n.find(t=>t.value===e)?.label??e,mark:void 0,disabled:!1,onRemove:e=>i(r.filter(t=>t!==e))}),(0,U.jsx)(rp,{id:e,label:t,open:s,listId:o,disabled:!1})]}),(0,U.jsx)(gl,{className:`p-0`,children:(0,U.jsx)(lp,{label:t,listId:o,options:n,selected:r,query:l,onQuery:u,onChange:i,clearLabel:a})})]})]})}var dp={indigo:`bg-[#e0e7ff] text-[#312e81] dark:bg-[#312e81] dark:text-[#e0e7ff]`,gray:`bg-[#f3f4f6] text-[#111827] dark:bg-[#111827] dark:text-[#f3f4f6]`,red:`bg-[#fee2e2] text-[#7f1d1d] dark:bg-[#7f1d1d] dark:text-[#fee2e2]`,orange:`bg-[#ffedd5] text-[#7c2d12] dark:bg-[#7c2d12] dark:text-[#ffedd5]`,yellow:`bg-[#fef9c3] text-[#713f12] dark:bg-[#713f12] dark:text-[#fef9c3]`,green:`bg-[#dcfce7] text-[#14532d] dark:bg-[#14532d] dark:text-[#dcfce7]`,teal:`bg-[#ccfbf1] text-[#134e4a] dark:bg-[#134e4a] dark:text-[#ccfbf1]`,blue:`bg-[#dbeafe] text-[#1e3a8a] dark:bg-[#1e3a8a] dark:text-[#dbeafe]`,violet:`bg-[#ede9fe] text-[#4c1d95] dark:bg-[#4c1d95] dark:text-[#ede9fe]`,pink:`bg-[#fce7f3] text-[#831843] dark:bg-[#831843] dark:text-[#fce7f3]`,brown:`bg-[#fef3c7] text-[#78350f] dark:bg-[#78350f] dark:text-[#fef3c7]`},fp=`indigo`,pp=Object.keys(dp).filter(e=>e!==fp);function mp(e){return e.task?`#${e.task.number}: ${e.name}`:e.name}var hp=`inline-flex max-w-40 items-center truncate rounded-full px-2 py-0.5 text-xs font-medium whitespace-nowrap`;function gp({tag:e,className:t,nested:n=!1}){let r=M(hp,dp[e.color]??dp.gray,t),i=mp(e);if(!e.task)return(0,U.jsx)(`span`,{"data-tag":e.id,className:r,title:i,children:(0,U.jsx)(`span`,{className:`truncate`,children:i})});let a=`#runs/${encodeURIComponent(e.task.run)}`;if(n){let t=e=>{e.stopPropagation(),window.location.hash=a};return(0,U.jsx)(`span`,{"data-tag":e.id,role:`link`,tabIndex:0,className:M(r,`cursor-pointer hover:underline`),title:i,onClick:t,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),t(e))},children:(0,U.jsx)(`span`,{className:`truncate`,children:i})})}return(0,U.jsx)(`a`,{"data-tag":e.id,href:a,className:M(r,`hover:underline`),title:i,onClick:e=>e.stopPropagation(),children:(0,U.jsx)(`span`,{className:`truncate`,children:i})})}function _p({id:e,className:t,nested:n=!1}){let r=Jd().byId.get(e);return r?(0,U.jsx)(gp,{tag:r,className:t,nested:n}):null}function vp({tags:e,className:t,nested:n=!1}){let{byId:r}=Jd(),i=e.filter(e=>r.has(e.id));return i.length===0?null:(0,U.jsx)(`span`,{className:M(`inline-flex flex-wrap items-center gap-1`,t),"data-tags":!0,children:i.map(e=>(0,U.jsx)(_p,{id:e.id,nested:n},e.id))})}function yp(e){let{runs:t,query:n,filters:r,scope:i,repository:a,repositoryPaths:o}=e,{t:s}=N(),{byId:c,of:l}=Jd(),u=e=>Kf(t,n,r,i,a,c,e),d=Vf(t,i===`repository`?a:null),f=u(`states`),p=Ff.map(e=>({value:e,label:su(e,s).label,count:f.get(e)??0})),m=u(`pipelines`),h=new Map;for(let e of d)h.set(e.pipeline,e.pipelineName||e.pipeline);for(let e of r.pipelines)h.has(e)||h.set(e,e);let g=[...h].map(([e,t])=>({value:e,label:t,count:m.get(e)??0})).sort((e,t)=>e.label.localeCompare(t.label,`en`)),_=u(`specialists`),v=new Set(r.specialists);for(let e of d)Rf(e).forEach(e=>v.add(e));let y=new Map;for(let e of d)for(let t of e.topology?.stages??[])t.performer.type===`specialist`&&t.performer.name&&y.set(t.performer.slug,t.performer.name);let b=[...v].map(e=>({value:e,label:Zd(y,e),count:_.get(e)??0})).sort((e,t)=>e.label.localeCompare(t.label,`en`)),x=u(`tagIds`),S=l(a).map(e=>({value:e.id,label:e.name,count:x.get(e.id)??0,render:(0,U.jsx)(gp,{tag:e})})),C=u(`repositories`);return{states:p,pipelines:g,specialists:b,tags:S,repositories:[...new Set([...r.repositories,...t.map(e=>e.repository)])].map(e=>({value:e,label:O(e),hint:o?.get(e)??e,render:(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,U.jsx)(Ce,{path:e}),O(e)]}),count:C.get(e)??0})).sort((e,t)=>e.label.localeCompare(t.label,`en`)||e.hint.localeCompare(t.hint,`en`))}}function bp({runs:e,query:t,onQuery:n,filters:r,onFilters:i,scope:a,onScope:o,repository:s,repositoryPaths:c}){let{t:l}=N(),u=yp({runs:e,query:t,filters:r,scope:a,repository:s,repositoryPaths:c}),d=e=>t=>i({...r,[e]:t}),f=l(`runs.list.clear`),p=[[l(`runs.list.state`),`states`,u.states],[l(`runs.list.pipeline`),`pipelines`,u.pipelines],[l(`runs.list.specialists`),`specialists`,u.specialists],[l(`runs.list.tags`),`tagIds`,u.tags]];return a===`all`&&p.push([l(`runs.list.repositories`),`repositories`,u.repositories]),(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,U.jsx)(sc,{type:`search`,"aria-label":l(`runs.list.search`),placeholder:l(`runs.list.search`),value:t,onChange:e=>n(e.target.value)}),(0,U.jsxs)(Te,{type:`single`,"aria-label":l(`runs.list.scope`),value:a,className:`flex-wrap`,onValueChange:e=>e&&o(e),children:[(0,U.jsx)(Oe,{value:`repository`,children:l(`runs.list.scopeRepository`)}),(0,U.jsx)(Oe,{value:`all`,children:l(`runs.list.scopeAll`)})]}),p.map(([e,t,n])=>(0,U.jsx)(up,{label:e,options:n,selected:r[t],onChange:d(t),clearLabel:f},t))]})}function xp({filterProps:e,count:t,wide:n}){let{t:r}=N();return(0,U.jsx)(Xf,{label:r(`runs.list.filters`),countLabel:t>0?r(`runs.list.filtersCount`,{count:t}):null,wide:n,children:(0,U.jsx)(bp,{...e})})}function Sp(e){let{t}=N();return(0,U.jsx)(ue,{label:t(`runs.list.filters`),count:e.count,countLabel:t(`runs.list.filtersCount`,{count:e.count}),collapsed:e.collapsed,onCollapsed:e.onCollapsed,children:(0,U.jsx)(bp,{...e.filterProps})})}function Cp({onRoute:e}){let{t}=N();return(0,U.jsxs)(Ae,{icon:(0,U.jsx)(uo,{}),title:t(`runs.page.noRuns`),className:`m-auto`,children:[(0,U.jsxs)(`p`,{children:[t(`runs.page.startWith`),` `,(0,U.jsx)(`code`,{className:`font-mono`,children:`aip run start feature --task "…"`}),`.`]}),(0,U.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,children:(0,U.jsx)(`a`,{href:`#queue`,onClick:t=>{t.preventDefault(),e({view:`queue`,run:null,group:null,step:null,tab:null})},children:t(`runs.page.openQueue`)})})]})}function wp(e){let[t,n]=(0,L.useState)(!1);return(0,L.useEffect)(()=>{if(!e||typeof IntersectionObserver>`u`){n(!1);return}let t=new IntersectionObserver(e=>{let t=e[e.length-1];t&&n(!t.isIntersecting)},{threshold:0,root:null});return t.observe(e),()=>{t.disconnect(),n(!1)}},[e]),t}function Tp(e){let[t,n]=(0,L.useState)(0);return(0,L.useEffect)(()=>{if(!e||typeof ResizeObserver>`u`){n(0);return}let t=()=>n(Math.floor(e.getBoundingClientRect().height));t();let r=new ResizeObserver(t);return r.observe(e),()=>r.disconnect()},[e]),t}var Ep=6;function Dp({reason:e}){let{t}=N(),[n,r]=(0,L.useState)(!1);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`pre`,{className:`font-mono text-xs break-words whitespace-pre-wrap`,children:n?e:e.split(`
6
+ `).slice(0,Ep).join(`
7
+ `)}),e.split(`
8
+ `).length>Ep?(0,U.jsx)(`button`,{type:`button`,className:`self-start text-xs underline`,onClick:()=>r(!n),children:t(n?`runs.system.showLess`:`runs.system.showAll`)}):null]})}function Op({ctx:e}){let{t}=N(),{row:n,run:r,view:i,busy:a,act:o,delivering:s,deliverable:c}=e;if(`kind`in n||n.status!==`merged`||n.delivery!==`apply_failed`)return null;let l=i?.delivery.reason??null;return(0,U.jsxs)(k,{variant:`destructive`,className:`flex flex-col gap-2`,children:[(0,U.jsx)(`b`,{children:t(`runs.system.deliveryFailed`)}),i?.delivery.finishedAt==null?null:(0,U.jsx)(`span`,{className:`text-xs`,children:t(`runs.system.lastAttempt`,{time:Ql(i.delivery.finishedAt)})}),l?(0,U.jsx)(Dp,{reason:l}):null,(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsxs)(A,{variant:`outline`,size:`sm`,loading:a||s,disabled:!c||s,onClick:()=>void o(()=>e.onDeliver?e.onDeliver():Promise.resolve()),children:[(0,U.jsx)(Go,{}),t(`runs.system.retryDelivery`)]}),(0,U.jsx)(A,{variant:`outline`,size:`sm`,disabled:!c||s||!r,onClick:()=>e.setForcing(!0),children:t(`runs.system.forceDeliver`)}),(0,U.jsx)(A,{variant:`outline`,size:`sm`,disabled:!c||s||!r,onClick:()=>void e.markDelivered(),children:t(`runs.system.markDelivered`)})]})]})}function kp({run:e,api:t,onConfirm:n,onClose:r}){let{t:i}=N(),[a,o]=(0,L.useState)(null);return(0,L.useEffect)(()=>{let n=e.groups.filter(e=>e.status===`merged`&&e.delivery!==`applied`);Promise.all(n.map(n=>t.group(e.id,n.slug))).then(o,()=>o([]))},[t,e]),(0,U.jsx)(rl,{open:!0,onOpenChange:e=>!e&&r(),children:(0,U.jsxs)(il,{children:[(0,U.jsxs)(al,{children:[(0,U.jsx)(sl,{children:i(`runs.apply.title`)}),(0,U.jsx)(cl,{children:i(`runs.apply.description`)})]}),a===null?(0,U.jsx)(j,{className:`h-12`}):null,a?.map(e=>(0,U.jsxs)(`section`,{className:`text-sm`,children:[(0,U.jsx)(`b`,{children:e.title}),e.delivery.reason?(0,U.jsx)(`p`,{className:`text-status-warn`,children:e.delivery.reason}):null,(0,U.jsx)(`ul`,{className:`mt-1 list-disc pl-5`,children:e.delivery.files.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsx)(le,{path:e})},e))})]},e.slug)),(0,U.jsxs)(ol,{children:[(0,U.jsx)(A,{variant:`outline`,onClick:r,children:i(`common.cancel`)}),(0,U.jsx)(A,{variant:`destructive`,onClick:n,children:i(`runs.apply.confirm`)})]})]})})}function Ap({className:e,...t}){return(0,U.jsx)(`textarea`,{className:M(`min-h-16 w-full rounded-md border border-input bg-card px-2.5 py-1.5 text-sm placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive`,e),...t})}function jp({onSend:e,onClose:t}){let{t:n}=N(),[r,i]=(0,L.useState)(``),[a,o]=(0,L.useState)(!1),s=r.trim()===``,c=async()=>{if(!(s||a)){o(!0);try{await e(r),t()}catch{}finally{o(!1)}}};return(0,U.jsx)(rl,{open:!0,onOpenChange:e=>!e&&t(),children:(0,U.jsxs)(il,{children:[(0,U.jsxs)(al,{children:[(0,U.jsx)(sl,{children:n(`runs.message.title`)}),(0,U.jsx)(cl,{children:n(`runs.message.desc`)})]}),(0,U.jsx)(`p`,{className:`text-sm text-status-warn`,children:n(`runs.message.warn`)}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsx)(Dl,{htmlFor:`agent-message`,children:n(`runs.message.label`)}),(0,U.jsx)(Ap,{id:`agent-message`,autoFocus:!0,rows:6,value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),c())}}),(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`runs.message.hint`)})]}),(0,U.jsxs)(ol,{children:[(0,U.jsx)(A,{variant:`outline`,onClick:t,children:n(`common.cancel`)}),(0,U.jsx)(A,{loading:a,disabled:s,onClick:()=>void c(),children:n(`runs.message.send`)})]})]})})}function Mp({ctx:e}){let{t}=N(),{api:n,runId:r,row:i,run:a,messaging:o,onError:s}=e;return(0,U.jsxs)(U.Fragment,{children:[o===null?null:(0,U.jsx)(jp,{onSend:async e=>{try{await n.message(r,i.slug,o,e)}catch(e){throw s(e.message),e}F(t(`runs.message.sent`))},onClose:()=>e.setMessaging(null)}),e.forcing&&a?(0,U.jsx)(kp,{run:a,api:n,onConfirm:()=>{e.setForcing(!1),e.act(()=>e.onForceDeliver?e.onForceDeliver():n.apply(a.id,!0))},onClose:()=>e.setForcing(!1)}):null]})}function Np({className:e,...t}){return(0,U.jsx)(ri,{className:M(`peer inline-flex h-5 w-9 shrink-0 items-center rounded-full p-0.5 bg-input transition-colors data-[state=checked]:bg-primary disabled:cursor-not-allowed disabled:opacity-50`,e),...t,children:(0,U.jsx)(ai,{className:`pointer-events-none block size-4 rounded-full bg-card shadow transition-transform data-[state=unchecked]:translate-x-0 data-[state=checked]:translate-x-full`})})}function Pp(e){return e.delivery.merged>e.delivery.applied&&!e.delivery.inProgress}function Fp(e){let{delivery:t}=e;return t.inProgress?{status:`running`,label:`delivering`,reason:null}:t.failed>0?{status:`apply_failed`,label:`deliveryFailed`,reason:e.deliveryStage?.status===`apply_failed`?e.deliveryStage.reason??null:null}:t.merged>t.applied?{status:`pending`,label:`delivery`,reason:null}:t.merged>0?{status:`applied`,label:e.deliveryStage?.status===`applied`&&e.deliveryStage.manual?`deliveredManually`:null,reason:null}:null}var Ip=new Set([`finished`,`failed`,`cancelled`]);function Lp(e){let{delivery:t}=e;if(t.inProgress)return null;let n={delivered:t.applied,merged:t.merged};return t.failed>0?{status:`apply_failed`,reason:e.deliveryStage?.status===`apply_failed`?e.deliveryStage.reason??null:null,...n}:Ip.has(e.state)&&e.groups.some(e=>e.status===`merged`&&e.delivery===`pending`&&e.diff?.files!==0)?{status:`undelivered`,reason:null,...n}:null}function Rp(e){if(e.pending)return{kind:`pending`};let t=e.groups.find(e=>e.delivery.state===`apply_failed`);return t?{kind:`failed`,reason:t.delivery.reason}:e.groups.some(e=>e.delivery.state===`applied`)?{kind:`applied`}:{kind:`pending`}}function zp(e,t){return e.delivery.inProgress?null:e.delivery.finishedAt===t.since?t.busy?{kind:`cancelled`}:null:e.deliveryStage?.status===`applied`?{kind:`applied`}:e.deliveryStage?.status===`apply_failed`?{kind:`failed`,reason:e.deliveryStage.reason??null}:{kind:`cancelled`}}function Bp(e,t){return e.status===`running`&&e.hold===`paused`?(0,U.jsx)($,{status:`running`,label:t(`status.pausing`),tip:t(`runs.header.pausingTip`)}):e.status===`running`&&e.hold!=null?(0,U.jsx)($,{status:`running`,label:t(`status.finishing`),tip:t(`runs.header.finishingTip`,{hold:t(`status.${e.hold}`)})}):(0,U.jsx)($,{status:e.status,wait:e.wait})}function Vp(e,t){let n=e.groups.length;if(n===0)return null;let r=e.groups.filter(e=>e.status===`merged`).length;return r===0?(0,U.jsx)($,{status:`not_merged`}):r<n?(0,U.jsx)($,{status:`merged`,label:t(`status.mergedOf`,{merged:r,total:n})}):(0,U.jsx)($,{status:`merged`})}function Hp(e,t,n,r,i){let{delivery:a}=e,o=Fp(e);if(!o)return null;let s=e.resolver,c=[];return o&&c.push((0,U.jsx)($,{status:o.status,title:o.reason??void 0,tip:n,onClick:s?()=>i?.(`_resolve`):void 0,label:o.label===`delivering`?r(`runs.header.delivering`):o.label===`deliveryFailed`?r(`runs.header.deliveryFailed`,{n:a.failed}):o.label===`deliveredManually`?r(`runs.header.deliveredManually`):o.label===`delivery`?r(`runs.header.delivery`,{applied:a.applied,merged:a.merged}):void 0},`delivery`)),t&&c.push((0,U.jsx)($,{status:t},`group`)),{key:`delivery`,label:r(`runs.header.parts.delivery`),badges:c}}function Up(e,t,n,r){let{delivery:i}=e,a=Fp(e),o=e.resolver,s=o?[n(`runs.header.resolver`),n(`status.${o.status}`,{defaultValue:o.status}),n(`runs.header.round`,{round:o.round,rounds:o.rounds}),o.conflicts.length>0?n(`runs.header.conflicts`,{list:o.conflicts.join(`, `)}):null,a?.reason].filter(Boolean).join(` · `):void 0,c=t&&!(`kind`in t)&&t.status===`merged`&&i.merged>=2?i.inProgress?null:t.delivery:null,l=[{key:`run`,label:n(`runs.header.parts.run`),badges:[(0,U.jsx)($,{status:e.state,label:uu(e,n)},`run`)]}];if(t){let r=`kind`in t,i=[(0,U.jsx)(`span`,{children:Bp(t,n)},`entry`)],a=r?null:Vp(e,n),o=e.groups.length>0&&e.groups.every(e=>e.status===`merged`);a&&!(t.status===`merged`&&o)&&i.push((0,U.jsx)(`span`,{children:a},`merge`)),l.push({key:`entry`,label:n(r?`runs.header.parts.step`:`runs.header.parts.group`),badges:i})}let u=t&&!(`kind`in t)?null:Vp(e,n);u&&l.push({key:`merge`,label:n(`runs.header.parts.merge`),badges:[(0,U.jsx)(`span`,{children:u},`merge`)]});let d=Hp(e,c,s,n,r);return d&&l.push(d),l}function Wp({run:e,entry:t,onSelect:n,layout:r=`rows`}){let{t:i}=N(),a=Up(e,t,i,n);return r===`inline`?(0,U.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:a.map(e=>(0,U.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-1.5`,children:[(0,U.jsxs)(`span`,{"data-part":e.key,className:`text-xs text-muted-foreground`,children:[e.label,`:`]}),e.badges]},e.key))}):(0,U.jsx)(`div`,{className:`grid grid-cols-[auto_minmax(0,1fr)] items-center gap-x-3 gap-y-1`,children:a.map(e=>(0,U.jsxs)(`div`,{className:`contents`,children:[(0,U.jsx)(`span`,{"data-part":e.key,className:`text-xs text-muted-foreground`,children:e.label}),(0,U.jsx)(`span`,{className:`flex flex-wrap items-center gap-1.5`,children:e.badges})]},e.key))})}function Gp({ctx:e}){let{t}=N();return e.tabs.tab!==`log`||e.watch.following||!e.caps.cancel?null:(0,U.jsxs)(A,{variant:`outline`,size:`sm`,title:t(`runs.group.watchTitle`),onClick:e.watch.follow,children:[(0,U.jsx)(Ka,{}),t(`runs.group.watch`)]})}function Kp({ctx:e}){let{run:t,title:n,showUsage:r}=e;return(0,U.jsx)(`h2`,{className:`min-w-0 flex-1 truncate text-base font-semibold`,title:t?void 0:n,children:t?(0,U.jsxs)(`span`,{"aria-hidden":!r||void 0,title:`${Gl(t)}\n${t.id}`,className:`block truncate transition-[opacity,transform,visibility] duration-200 ease-out motion-reduce:transition-none ${r?`translate-y-0 opacity-100`:`invisible translate-y-1 opacity-0`}`,children:[(0,U.jsx)(`span`,{className:`font-mono font-normal text-muted-foreground`,children:Rl(t.number)}),` `,Gl(t)]}):n})}function qp({ctx:e}){let{t}=N(),{api:n,runId:r,row:i,busy:a,act:o,title:s}=e,c=e=>void o(()=>e?n.retry(r,i.slug,e):n.retry(r,i.slug),()=>F(t(`runs.header.retryStarted`)));return(0,U.jsxs)(ec,{children:[(0,U.jsx)(tc,{asChild:!0,children:(0,U.jsx)(A,{variant:`outline`,size:`sm`,loading:a,"aria-label":t(`runs.group.more`,{title:s}),title:t(`runs.group.more`,{title:s}),children:(0,U.jsx)(Wa,{})})}),(0,U.jsxs)(rc,{align:`end`,children:[(0,U.jsxs)(ic,{disabled:a,onSelect:()=>c(),children:[(0,U.jsx)(Go,{}),t(`runs.group.retry`)]}),i.status===`conflict`?null:(0,U.jsxs)(ic,{disabled:a,onSelect:()=>c({refreshConfig:!0}),children:[(0,U.jsx)(Uo,{}),t(`runs.group.retryRefreshConfig`)]})]})]})}function Jp({ctx:e}){let{t}=N(),{row:n,run:r,busy:i,act:a,caps:o,delivering:s,skip:c}=e;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Gp,{ctx:e}),e.onOnlyReplies?(0,U.jsxs)(`div`,{className:`flex items-center gap-2 whitespace-nowrap`,children:[(0,U.jsx)(Np,{id:`only-replies`,checked:e.onlyReplies,onCheckedChange:e.onOnlyReplies}),(0,U.jsx)(Dl,{htmlFor:`only-replies`,children:t(`runs.group.onlyReplies`)})]}):null,`kind`in n?(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t(`runs.system.badge`)}):null,r?null:Bp(n,t),o.retryDelivery?(0,U.jsxs)(A,{variant:`outline`,size:`sm`,loading:i||s,disabled:s,onClick:()=>void a(()=>e.onDeliver?e.onDeliver():Promise.resolve()),children:[(0,U.jsx)(Go,{}),t(`runs.system.retryDelivery`)]}):null,c.canSkip&&r&&c.skippable?(0,U.jsxs)(A,{variant:`outline`,size:`sm`,loading:c.skipper.pending!==null,onClick:()=>void c.skipper.toggle(c.skippable,!0,{allGroups:r.groups.length>1}),children:[(0,U.jsx)(ts,{}),t(`runs.group.skipStep`)]}):null,o.cancel?(0,U.jsx)(A,{variant:`destructive`,size:`sm`,loading:i,onClick:()=>void e.cancelGroup(),children:t(`runs.group.cancel`)}):null,o.retry?(0,U.jsx)(qp,{ctx:e}):null]})}function Yp({ctx:e}){let{t}=N(),n=e.run?.deliveryStage??null,r=e.run?.delivery.finishedAt??null;return n?(0,U.jsx)(`span`,{role:`status`,"aria-label":t(`runs.system.delivery`),className:`flex flex-wrap items-center gap-x-2`,children:n.status===`delivering`?(0,U.jsx)($,{status:`running`,label:t(`runs.system.delivering`)}):n.status===`applied`||n.status===`apply_failed`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)($,{status:n.status}),r===null?null:(0,U.jsx)(`span`,{children:t(`runs.system.lastAttempt`,{time:Ql(r)})})]}):null}):null}function Xp({ctx:e}){let{t}=N(),{row:n,showUsage:r}=e;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:`font-medium text-foreground`,title:n.step??void 0,children:n.stepName??n.step??`—`}),n.round===null?null:(0,U.jsx)(`span`,{children:t(`runs.group.round`,{round:n.round})}),n.limitUntil===null?null:(0,U.jsx)(`span`,{className:`text-status-warn`,children:t(`runs.group.limitUntil`,{time:Ql(n.limitUntil)})}),`kind`in n&&n.kind!==`split`&&n.kind!==`action`&&!ot(n)?(0,U.jsx)(Yp,{ctx:e}):null,r?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{children:zl(n.durationMs)}),Hl(n.usage)?(0,U.jsx)(`span`,{children:Hl(n.usage)}):null,Bl(n.usage)?(0,U.jsx)(`span`,{children:Bl(n.usage)}):null]}):null]})}function Zp({ctx:e,run:t}){let{row:n,showUsage:r}=e;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{"data-slot":`group-header-collapse`,"aria-hidden":!r||void 0,className:`grid transition-[grid-template-rows,opacity] duration-200 ease-out motion-reduce:transition-none ${r?`grid-rows-[1fr] opacity-100`:`grid-rows-[0fr] opacity-0`}`,children:(0,U.jsx)(`div`,{className:`min-h-0 overflow-hidden`,children:(0,U.jsxs)(`div`,{"data-slot":`group-header-title-row`,className:`flex items-center gap-3 pb-2 [&>h2]:min-w-32`,children:[(0,U.jsx)(Kp,{ctx:e}),(0,U.jsx)(`div`,{"data-slot":`group-header-statuses`,className:`flex min-w-0 justify-end`,children:e.statusesMounted?(0,U.jsx)(Wp,{run:t,entry:n,onSelect:e.onSelectEntry,layout:`inline`}):null})]})})}),(0,U.jsxs)(`div`,{"data-slot":`group-header-row`,className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,U.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-1 text-sm text-muted-foreground`,children:(0,U.jsx)(Xp,{ctx:e})}),(0,U.jsx)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:(0,U.jsx)(Jp,{ctx:e})})]})]})}function Qp({ctx:e,onHeight:t}){let{run:n}=e;return(0,U.jsx)(`header`,{ref:t,className:`sticky top-0 z-10 -mx-4 -mt-4 flex flex-col border-b bg-background/95 px-4 py-3 backdrop-blur ${n?``:`gap-2`}`,children:n?(0,U.jsx)(Zp,{ctx:e,run:n}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{"data-slot":`group-header-row`,className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(Kp,{ctx:e}),(0,U.jsx)(Jp,{ctx:e})]}),(0,U.jsx)(`div`,{"data-slot":`group-header-row`,className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-sm text-muted-foreground`,children:(0,U.jsx)(Xp,{ctx:e})})]})})}var $p=5;function em({attempt:e,onDismiss:t}){let{t:n}=N(),r=e.outsideChanges??[];return r.length===0?null:(0,U.jsxs)(fd,{defaultOpen:r.length<=$p,className:`rounded-lg border border-status-warn/30 bg-status-warn-bg text-sm text-status-warn`,children:[(0,U.jsxs)(`div`,{className:`flex items-center`,children:[(0,U.jsxs)(pd,{className:`group flex min-w-0 flex-1 items-center gap-2 px-3 py-2 text-left`,children:[(0,U.jsx)(wa,{className:`size-4 transition-transform group-data-[state=open]:rotate-90`}),(0,U.jsx)(ls,{className:`size-4`,"aria-hidden":!0}),n(`runs.outside.title`,{step:e.stepName??e.stepId,seq:e.seq,count:r.length})]}),t?(0,U.jsx)(A,{variant:`ghost`,size:`icon`,className:`mr-1 size-7 shrink-0`,"aria-label":n(`runs.group.dismissNotice`),title:n(`runs.group.dismissNotice`),onClick:t,children:(0,U.jsx)(hs,{})}):null]}),(0,U.jsxs)(md,{children:[(0,U.jsx)(`p`,{className:`px-8 pb-1 text-xs`,children:n(`runs.outside.hint`)}),(0,U.jsx)(`ul`,{className:`px-8 pb-2`,children:r.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsx)(le,{path:e})},e))})]})]})}function tm({text:e}){return(0,U.jsx)(`div`,{className:`text-sm leading-relaxed break-words [&_a]:text-primary [&_a]:underline [&_blockquote]:border-l-2 [&_blockquote]:pl-3 [&_blockquote]:text-muted-foreground [&_code]:rounded [&_code]:bg-muted [&_code]:px-1 [&_code]:font-mono [&_code]:text-xs [&_h1]:text-base [&_h1]:font-semibold [&_h2]:font-semibold [&_h3]:font-semibold [&_li]:my-0.5 [&_ol]:list-decimal [&_ol]:pl-5 [&_p]:my-2 [&_pre]:overflow-x-auto [&_pre]:rounded-md [&_pre]:bg-muted [&_pre]:p-2 [&_table]:border-collapse [&_td]:border [&_td]:px-2 [&_th]:border [&_th]:px-2 [&_ul]:list-disc [&_ul]:pl-5`,children:(0,U.jsx)(Ge,{remarkPlugins:[Ke],skipHtml:!1,children:e})})}function nm({title:e,question:t,draft:n,busy:r,onDraft:i,onSubmit:a}){let{t:o}=N();return(0,U.jsxs)(`form`,{className:`flex flex-col gap-2 rounded-lg border border-status-warn/40 bg-status-warn-bg p-3`,onSubmit:e=>{e.preventDefault(),n.trim()&&a(n,()=>{i(``),F(o(`runs.questions.answerSent`))})},children:[(0,U.jsx)(`div`,{className:`text-status-warn [&_*]:font-medium`,children:(0,U.jsx)(tm,{text:t??``})}),(0,U.jsx)(Ap,{"aria-label":o(`runs.questions.answerFor`,{title:e}),value:n,onChange:e=>i(e.target.value),rows:3}),(0,U.jsx)(`div`,{children:(0,U.jsx)(A,{type:`submit`,loading:r,disabled:!n.trim(),children:o(`runs.questions.answer`)})})]})}function rm({question:e,index:t,total:n,value:r,onChange:i}){let{t:a}=N(),o=e.options??[],s=e.recommendation??null;return(0,U.jsxs)(`fieldset`,{className:`flex min-w-0 flex-col gap-2 border-0 p-0`,children:[(0,U.jsx)(`legend`,{className:`mb-1 text-xs font-medium text-muted-foreground`,children:a(`runs.questions.question`,{index:t+1,total:n})}),(0,U.jsx)(tm,{text:e.text}),o.length>0?(0,U.jsx)(`div`,{className:`flex min-w-0 max-w-full flex-wrap gap-2`,children:o.map(e=>(0,U.jsxs)(A,{variant:`outline`,size:`sm`,className:`h-auto min-h-7 min-w-0 max-w-full shrink whitespace-normal flex-wrap justify-start text-left`,"aria-pressed":r===e,onClick:()=>i(e),children:[(0,U.jsx)(`span`,{className:`min-w-0 max-w-full [overflow-wrap:anywhere]`,children:e}),e===s?(0,U.jsxs)(I,{variant:`warn`,children:[(0,U.jsx)(as,{"aria-hidden":`true`}),a(`runs.questions.recommended`)]}):null]},e))}):s?(0,U.jsxs)(`p`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,U.jsx)(as,{"aria-hidden":`true`,className:`size-3`}),a(`runs.questions.recommendation`,{text:s})]}):null,(0,U.jsx)(Ap,{"aria-label":a(`runs.questions.answerTo`,{index:t+1}),value:r,onChange:e=>i(e.target.value),rows:2})]})}function im({questions:e,draftKey:t,drafts:n,busy:r,onDraft:i,onClearDrafts:a,onSubmit:o}){let{t:s}=N(),c=e.map((e,n)=>Zl(t,n,e.text)),l=e.map((e,t)=>n[c[t]]??e.recommendation??``),u=l.filter(e=>e.trim()===``).length;return(0,U.jsxs)(`form`,{"aria-label":s(`runs.questions.label`),className:`flex min-w-0 max-w-full flex-col gap-3 rounded-lg border border-status-warn/40 bg-status-warn-bg p-3`,onSubmit:n=>{n.preventDefault(),u>0||o(Xl(e,l),()=>{a(t),F(s(`runs.questions.answerSent`))})},children:[(0,U.jsx)(`h3`,{className:`text-sm font-semibold text-status-warn`,children:s(`runs.questions.heading`,{n:e.length})}),e.map((t,n)=>(0,U.jsx)(rm,{question:t,index:n,total:e.length,value:l[n],onChange:e=>i(c[n],e)},c[n])),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,U.jsx)(A,{type:`submit`,loading:r,disabled:u>0,children:s(`runs.questions.answer`)}),u>0?(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:s(`runs.questions.unanswered`,{n:u})}):null]})]})}function am(e,t){let n=[];(e?.warnings??[]).forEach((e,t)=>n.push({kind:`warning`,key:`warning:${t}:${e}`,text:e}));let r=[...e?.attempts??[]].sort((e,t)=>e.seq-t.seq);for(let e of r)(e.outsideChanges??[]).length>0&&n.push({kind:`outside`,key:`outside:${e.seq}`,attempt:e});let i=e?.permissionHints??[];return i.length>0&&n.push({kind:`hints`,key:`hints:${i.join(`,`)}`,patterns:i}),t.reason&&t.status!==`needs_human`&&n.push({kind:`reason`,key:`reason:${t.reason}`,text:t.reason}),n}function om(e,t){let n=e.at(-1)??null;return n!==null&&n.key!==t?n:null}function sm(e,t){let[n,r]=P(`dismissedNotices`,{}),i=`${e}/${t}`,a=(0,L.useCallback)(e=>{let{[i]:t,...a}=n,o=Object.entries({...a,[i]:e});r(Object.fromEntries(o.slice(-200)))},[n,i,r]);return[n[i]??null,a]}function cm({ctx:e}){let{t}=N(),{api:n,runId:r,row:i,busy:a,act:o}=e;return i.status!==`needs_human`||!i.humanOnly?null:(0,U.jsxs)(`section`,{"aria-label":t(`runs.humanOnly.${i.humanOnly}`),className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(I,{variant:`warn`,children:t(`runs.humanOnly.${i.humanOnly}`)}),(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t(`runs.humanOnly.hint`)}),i.humanOnly===`review`?(0,U.jsx)(A,{size:`sm`,loading:a,onClick:()=>void o(()=>n.answer(r,i.slug,`Принято`),()=>F(t(`runs.questions.answerSent`))),children:t(`runs.humanOnly.accept`)}):null]})}function lm({ctx:e}){let{api:t,runId:n,row:r,busy:i,act:a,drafts:o,draftKey:s,onDraft:c}=e;if(r.status!==`needs_human`)return null;let l=(e,i)=>void a(()=>t.answer(n,r.slug,e),i);return r.questions&&r.questions.length>0?(0,U.jsx)(im,{questions:r.questions,draftKey:s,drafts:o,busy:i,onDraft:c,onClearDrafts:e.onClearDrafts,onSubmit:l}):(0,U.jsx)(nm,{title:e.title,question:r.question,draft:o[s]??``,busy:i,onDraft:e=>c(s,e),onSubmit:l})}function um({ctx:e}){let{t}=N(),[n,r]=sm(e.runId,e.row.slug),i=om(am(e.view,e.row),n);if(!i)return null;if(i.kind===`outside`)return(0,U.jsx)(em,{attempt:i.attempt,onDismiss:()=>r(i.key)});let a=(0,U.jsx)(A,{variant:`ghost`,size:`icon`,className:`absolute top-1 right-1 size-7`,"aria-label":t(`runs.group.dismissNotice`),title:t(`runs.group.dismissNotice`),onClick:()=>r(i.key),children:(0,U.jsx)(hs,{})});return i.kind===`hints`?(0,U.jsx)(`section`,{"aria-label":t(`runs.group.hintsLabel`),children:(0,U.jsxs)(k,{variant:`warn`,className:`relative pr-10`,children:[a,(0,U.jsx)(`div`,{className:`mb-1 text-xs font-medium uppercase`,children:t(`runs.group.hintsTitle`)}),(0,U.jsxs)(`p`,{children:[t(`runs.group.hintsAdd`),` `,(0,U.jsx)(`code`,{children:`allow_commands`}),`:`,` `,i.patterns.map((e,t)=>(0,U.jsxs)(`span`,{children:[t>0?`, `:``,(0,U.jsx)(`code`,{children:e})]},e)),t(`runs.group.hintsAfter`),` `,(0,U.jsx)(le,{path:`aip/specialists/`}),`.`]})]})}):(0,U.jsxs)(k,{variant:i.kind===`reason`?`destructive`:`warn`,className:`relative pr-10`,children:[a,i.kind===`reason`?$l(i.text,t):i.text]})}function dm({ctx:e}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(cm,{ctx:e}),(0,U.jsx)(lm,{ctx:e}),(0,U.jsx)(um,{ctx:e})]})}var fm=1048576,pm=`px-2 py-1.5 font-medium`;function mm({api:e,runId:t,group:n,artifact:r}){let{t:i,i18n:a}=N(),o=r.size>fm,[s,c]=(0,L.useState)(null);return(0,L.useEffect)(()=>{if(o)return;let i=!1;return e.artifactText(t,n,r.id).then(e=>!i&&c({id:r.id,text:e}),e=>!i&&c({id:r.id,error:e.message})),()=>{i=!0}},[e,t,n,r.id,r.createdAt,r.size,o]),o?(0,U.jsxs)(`div`,{className:`flex flex-col items-start gap-2`,children:[(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i(`runs.group.artifactTooLarge`,{limit:ru(fm,i,a.language)})}),(0,U.jsx)(hm,{api:e,runId:t,group:n,artifact:r})]}):s===null||s.id!==r.id?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i(`runs.group.artifactLoading`)}):`error`in s?(0,U.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:i(`runs.group.artifactFailed`,{message:s.error})}):r.preview===`markdown`?(0,U.jsx)(tm,{text:s.text}):(0,U.jsx)(`pre`,{className:`overflow-x-auto font-mono text-xs whitespace-pre-wrap`,children:s.text})}function hm({api:e,runId:t,group:n,artifact:r}){let{t:i}=N();return(0,U.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,children:(0,U.jsxs)(`a`,{href:e.artifactUrl(t,n,r.id),download:r.fileName,"aria-label":`${i(`runs.group.artifactDownload`)} ${r.fileName}`,children:[(0,U.jsx)(Ha,{}),i(`runs.group.artifactDownload`)]})})}function gm({onClose:e,...t}){let{t:n}=N();return(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`h3`,{className:`truncate text-sm font-medium`,children:t.artifact.title}),(0,U.jsx)(`p`,{className:`font-mono text-xs text-muted-foreground`,children:t.artifact.fileName})]}),(0,U.jsxs)(`div`,{className:`flex gap-1`,children:[(0,U.jsx)(hm,{...t}),(0,U.jsx)(A,{variant:`ghost`,size:`sm`,onClick:e,children:n(`runs.group.artifactClose`)})]})]})}function _m(){let{t:e}=N();return(0,U.jsx)(`thead`,{className:`border-b text-muted-foreground`,children:(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`th`,{className:pm,children:e(`runs.group.artifactStep`)}),(0,U.jsx)(`th`,{className:pm,children:e(`runs.group.artifactTitle`)}),(0,U.jsx)(`th`,{className:pm,children:e(`runs.group.artifactFile`)}),(0,U.jsx)(`th`,{className:pm,children:e(`runs.group.artifactCreated`)}),(0,U.jsx)(`th`,{className:`${pm} text-right`,children:e(`runs.group.artifactSize`)}),(0,U.jsx)(`th`,{className:pm,children:(0,U.jsx)(`span`,{className:`sr-only`,children:e(`runs.group.artifactOpen`)})})]})})}function vm(e){let{api:t,runId:n,group:r,artifact:i,now:a,opened:o,onOpen:s}=e,{t:c,i18n:l}=N();return(0,U.jsxs)(`tr`,{className:`border-b last:border-0 hover:bg-muted/50`,children:[(0,U.jsxs)(`td`,{className:`px-2 py-1.5`,title:`${i.step} · ${i.specialist}`,children:[i.stepName,` · #`,i.seq]}),(0,U.jsx)(`td`,{className:`px-2 py-1.5`,children:i.title}),(0,U.jsx)(`td`,{className:`px-2 py-1.5`,children:(0,U.jsx)(`code`,{className:`rounded bg-muted px-1 font-mono text-xs`,children:i.fileName})}),(0,U.jsx)(`td`,{className:`px-2 py-1.5 whitespace-nowrap`,children:(0,U.jsx)(`time`,{dateTime:new Date(i.createdAt).toISOString(),title:au(i.createdAt,l.language),children:Kl(i.createdAt,a,l.language)})}),(0,U.jsx)(`td`,{className:`px-2 py-1.5 text-right whitespace-nowrap tabular-nums`,children:ru(i.size,c,l.language)}),(0,U.jsx)(`td`,{className:`px-2 py-1.5`,children:(0,U.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[i.preview===null?null:(0,U.jsxs)(A,{variant:`ghost`,size:`sm`,"aria-label":`${c(`runs.group.artifactOpen`)} ${i.fileName}`,onClick:()=>s(i.id===o?null:i.id),children:[(0,U.jsx)(Ka,{}),c(`runs.group.artifactOpen`)]}),(0,U.jsx)(A,{variant:`ghost`,size:`sm`,asChild:!0,children:(0,U.jsxs)(`a`,{href:t.artifactUrl(n,r,i.id),download:i.fileName,"aria-label":`${c(`runs.group.artifactDownload`)} ${i.fileName}`,children:[(0,U.jsx)(Ha,{}),c(`runs.group.artifactDownload`)]})})]})})]})}function ym(e){let{api:t,runId:n,group:r,count:i,revision:a,onError:o}=e,[s,c]=(0,L.useState)(null);return(0,L.useEffect)(()=>{let e=!1;return t.groupArtifacts(n,r).then(t=>!e&&c(t),t=>!e&&o(t.message)),()=>{e=!0}},[t,n,r,i,a,o]),s}function bm({api:e,runId:t,group:n,count:r,revision:i,onError:a}){let{t:o,i18n:s}=N(),c=ce(`(min-width: 768px)`),l=ym({api:e,runId:t,group:n,count:r,revision:i,onError:a}),[u,d]=(0,L.useState)(null);if(l===null)return(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o(`runs.group.artifactLoading`)});if(l.length===0)return(0,U.jsx)(Ae,{title:o(`runs.group.artifacts`),children:o(`runs.group.artifactsEmpty`)});let f=Date.now(),p=l.find(e=>e.id===u)??null,m=p?(0,U.jsxs)(`section`,{"aria-label":o(`runs.group.artifactPreview`,{file:p.fileName}),className:`flex flex-col gap-3 rounded-md border bg-card p-4 text-card-foreground`,children:[(0,U.jsx)(gm,{api:e,runId:t,group:n,artifact:p,onClose:()=>d(null)}),(0,U.jsx)(mm,{api:e,runId:t,group:n,artifact:p})]}):null;return(0,U.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,U.jsxs)(`table`,{"aria-label":o(`runs.group.artifactsList`),className:`w-full text-left text-sm`,children:[(0,U.jsx)(_m,{}),(0,U.jsx)(`tbody`,{children:l.map(r=>(0,U.jsx)(vm,{api:e,runId:t,group:n,artifact:r,now:f,opened:u,onOpen:d},r.id))})]}),c?m:p?(0,U.jsx)(rl,{open:!0,onOpenChange:e=>!e&&d(null),children:(0,U.jsxs)(il,{className:`max-w-2xl`,children:[(0,U.jsxs)(al,{children:[(0,U.jsx)(sl,{children:p.title}),(0,U.jsx)(`p`,{className:`font-mono text-xs text-muted-foreground`,children:p.fileName})]}),(0,U.jsx)(`div`,{className:`flex`,children:(0,U.jsx)(hm,{api:e,runId:t,group:n,artifact:p})}),(0,U.jsx)(mm,{api:e,runId:t,group:n,artifact:p})]})}):null]})}function xm({diff:e}){let{t}=N();return(0,U.jsxs)(`span`,{className:`inline-flex items-baseline gap-1.5`,children:[(0,U.jsx)(`strong`,{className:`font-semibold text-foreground`,children:Ul(e.files,t)}),` `,(0,U.jsxs)(`span`,{className:`text-status-ok`,children:[`+`,e.added]}),` `,(0,U.jsxs)(`span`,{className:`text-status-err`,children:[`−`,e.removed]})]})}var Sm=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/;function Cm(e){let t=[],n=null,r=0,i=0;for(let a of e){let e=Sm.exec(a);if(e){n={header:a,rows:[]},t.push(n),r=Number(e[1]),i=Number(e[2]);continue}if(!n)continue;let o=a.slice(1);a.startsWith(`+`)?n.rows.push({kind:`add`,old:null,new:i++,text:o}):a.startsWith(`-`)?n.rows.push({kind:`del`,old:r++,new:null,text:o}):a.startsWith(`\\`)?n.rows.push({kind:`note`,old:null,new:null,text:a}):n.rows.push({kind:`ctx`,old:r++,new:i++,text:o})}return t}var wm={ctx:``,add:`bg-status-ok/10`,del:`bg-status-err/10`,note:`text-muted-foreground italic`},Tm={ctx:` `,add:`+`,del:`−`,note:``};function Em({result:e,reserve:t}){let{t:n}=N();if(e.state===`loading`)return(0,U.jsx)(`p`,{role:`status`,className:`px-3 py-2 text-xs text-muted-foreground`,style:t?{minHeight:`${t*1}rem`}:void 0,children:n(`runs.files.diffLoading`)});if(e.state===`error`)return(0,U.jsxs)(`p`,{role:`alert`,className:`px-3 py-2 text-xs text-status-err`,children:[n(`runs.files.diffUnavailable`),`: `,e.message]});let{diff:r}=e;if(r.binary)return(0,U.jsx)(`p`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:n(`runs.files.diffBinary`)});let i=Cm(r.lines);return i.length===0?(0,U.jsx)(`p`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:n(`runs.files.diffEmpty`)}):(0,U.jsxs)(`div`,{className:`overflow-x-auto border-t bg-background font-mono text-xs`,children:[i.map((e,t)=>(0,U.jsxs)(`table`,{className:`w-full border-collapse`,children:[(0,U.jsx)(`caption`,{className:`bg-muted px-3 py-0.5 text-left text-muted-foreground`,children:e.header}),(0,U.jsx)(`tbody`,{children:e.rows.map((e,t)=>(0,U.jsxs)(`tr`,{"data-kind":e.kind,className:M(wm[e.kind]),children:[(0,U.jsx)(`td`,{className:`w-10 select-none px-2 text-right text-muted-foreground`,children:e.old??``}),(0,U.jsx)(`td`,{className:`w-10 select-none px-2 text-right text-muted-foreground`,children:e.new??``}),(0,U.jsx)(`td`,{className:`w-4 select-none text-center`,children:Tm[e.kind]}),(0,U.jsx)(`td`,{className:`whitespace-pre pr-3`,children:e.text})]},t))})]},t)),r.truncated?(0,U.jsx)(`p`,{className:`border-t px-3 py-1 text-muted-foreground`,children:n(`runs.files.diffTruncated`,{shown:r.lines.length,total:r.totalLines})}):null]})}function Dm(e,t,n){return{name:e,path:t,kind:n,added:0,removed:0,binary:!1,children:new Map}}function Om(e){let t=e;for(;t.kind===`dir`&&t.children.size===1;){let[e]=t.children.values();if(!e||e.kind!==`dir`)break;t={...e,name:`${t.name}/${e.name}`}}let n=[...t.children.values()].map(Om).sort((e,t)=>e.kind===t.kind?e.name.localeCompare(t.name,`en`):e.kind===`dir`?-1:1);return{name:t.name,path:t.path,kind:t.kind,added:t.added,removed:t.removed,binary:t.binary,children:n}}function km(e){let t=Dm(``,``,`dir`);for(let n of e){let e=n.path.split(`/`).filter(Boolean),r=n.added??0,i=n.removed??0,a=t;e.forEach((t,o)=>{let s=o===e.length-1,c=e.slice(0,o+1).join(`/`),l=a.children.get(t);l||(l=Dm(t,c,s?`file`:`dir`),a.children.set(t,l)),l.added+=r,l.removed+=i,s&&(l.binary=n.added===null),a=l})}return[...t.children.values()].map(Om).sort((e,t)=>e.kind===t.kind?e.name.localeCompare(t.name,`en`):e.kind===`dir`?-1:1)}function Am(e){return e.binary?1:Math.min(40,Math.max(3,e.added+e.removed+11))}function jm({node:e}){let{t}=N();return e.binary?(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:t(`runs.files.binary`)}):(0,U.jsxs)(`span`,{className:`font-mono text-xs`,children:[(0,U.jsxs)(`span`,{className:`text-status-ok`,children:[`+`,e.added]}),` `,(0,U.jsxs)(`span`,{className:`text-status-err`,children:[`−`,e.removed]})]})}function Mm({node:e,expansion:t}){let{t:n}=N(),r=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[t?(0,U.jsx)(wa,{className:M(`size-4 shrink-0 transition-transform`,t.open.has(e.path)&&`rotate-90`),"aria-hidden":!0}):null,(0,U.jsx)(Ja,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,U.jsx)(`code`,{className:`truncate font-mono text-xs`,title:e.path,children:e.name}),t?.previous.has(e.path)?(0,U.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:n(`runs.files.renamedFrom`,{path:t.previous.get(e.path)??``})}):null]}),(0,U.jsx)(jm,{node:e})]});if(!t)return(0,U.jsx)(`li`,{className:`flex items-center justify-between gap-3 px-2 py-1 text-sm`,children:r});let i=t.open.has(e.path),a=t.results[e.path];return(0,U.jsxs)(`li`,{children:[(0,U.jsx)(`button`,{type:`button`,"aria-expanded":i,"aria-label":e.path,onClick:()=>t.toggle(e.path),className:`flex w-full items-center justify-between gap-3 rounded px-2 py-1 text-left text-sm hover:bg-accent`,children:r}),i?(0,U.jsx)(`div`,{className:`my-1 ml-2 overflow-hidden rounded border`,children:(0,U.jsx)(Em,{result:a??{state:`loading`},reserve:Am(e)})}):null]})}function Nm({node:e,expansion:t}){return e.kind===`file`?(0,U.jsx)(Mm,{node:e,expansion:t}):(0,U.jsx)(`li`,{children:(0,U.jsxs)(fd,{defaultOpen:!0,children:[(0,U.jsxs)(pd,{className:`group flex w-full items-center justify-between gap-3 rounded px-2 py-1 text-sm hover:bg-accent`,children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,U.jsx)(wa,{className:M(`size-4 shrink-0 transition-transform group-data-[state=open]:rotate-90`),"aria-hidden":!0}),(0,U.jsx)(eo,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,U.jsx)(`code`,{className:`truncate font-mono text-xs`,children:e.name})]}),(0,U.jsx)(jm,{node:e})]}),(0,U.jsx)(md,{children:(0,U.jsx)(`ul`,{className:`ml-4 border-l pl-1`,children:e.children.map(e=>(0,U.jsx)(Nm,{node:e,expansion:t},e.path))})})]})})}function Pm({files:e,diff:t}){let{t:n}=N(),r=km(e),[i,a]=(0,L.useState)(new Set),[o,s]=(0,L.useState)({}),c=(0,L.useRef)(new Set),l=(0,L.useRef)(!0),u=(0,L.useRef)(void 0);(0,L.useEffect)(()=>(l.current=!0,()=>{l.current=!1}),[]);let d=t?.api,f=t?.runId,p=t?.group,m=t?.revision;u.current=m;let h=e.map(e=>e.path).join(`\0`);if((0,L.useEffect)(()=>{if(!d||f===void 0||p===void 0||m===void 0)return;let e=new Set(h.split(`\0`));for(let t of i){if(!e.has(t))continue;let n=`${m}\u0000${t}`;if(c.current.has(n))continue;c.current.add(n);let r=e=>{l.current&&u.current===m&&s(n=>({...n,[t]:e}))};d.fileDiff(f,p,t).then(e=>r({state:`ready`,diff:e}),e=>{c.current.delete(n),r({state:`error`,message:e.message})})}},[i,d,f,p,m,h]),!t)return(0,U.jsx)(`ul`,{"aria-label":n(`runs.files.label`),className:`rounded-lg border bg-card p-1`,children:r.map(e=>(0,U.jsx)(Nm,{node:e,expansion:null},e.path))});let g={open:i,results:Object.fromEntries([...i].map(e=>[e,o[e]??{state:`loading`}])),previous:new Map(e.flatMap(e=>e.previousPath?[[e.path,e.previousPath]]:[])),toggle:e=>a(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n})};return(0,U.jsx)(`ul`,{"aria-label":n(`runs.files.label`),className:`rounded-lg border bg-card p-1`,children:r.map(e=>(0,U.jsx)(Nm,{node:e,expansion:g},e.path))})}function Fm(e){return typeof e==`object`&&!!e}function Im(e){return Fm(e)&&Object.keys(e).length>0}function Lm(e){let t=e.trim();if(t.startsWith(`{`)||t.startsWith(`[`))try{let e=JSON.parse(t);return Fm(e)?e:void 0}catch{return}}function Rm(e){return typeof e==`string`?e:Array.isArray(e)?`[]`:Fm(e)?`{}`:JSON.stringify(e)??String(e)}function zm(e){return e.map(e=>` ${e}`)}function Bm(e){if(Array.isArray(e))return e.length===0?[`[]`]:e.flatMap(e=>{if(Im(e)){let[t=``,...n]=Bm(e);return[`- ${t}`,...zm(n)]}let t=Rm(e);return t.includes(`
9
+ `)?[`-`,...zm(t.split(`
10
+ `))]:[`- ${t}`]});if(Fm(e)){let t=Object.entries(e);return t.length===0?[`{}`]:t.flatMap(([e,t])=>{if(Im(t))return[`${e}:`,...zm(Bm(t))];let n=Rm(t);return n.includes(`
11
+ `)?[`${e}:`,...zm(n.split(`
12
+ `))]:[`${e}: ${n}`]})}return Rm(e).split(`
13
+ `)}function Vm(e){return Bm(e).join(`
14
+ `)}function Hm(e){return Array.isArray(e)?e.length===0?`[]`:`[${e.length}]`:Fm(e)?Object.keys(e).length===0?`{}`:`{…}`:Rm(e).replace(/\s*\n\s*/g,` `)}function Um(e,t=120){let n=(Array.isArray(e)?e.map(Hm):Fm(e)?Object.entries(e).map(([e,t])=>`${e}: ${Hm(t)}`):[Hm(e)]).join(` · `);return n.length>t?`${n.slice(0,t-1)}…`:n}function Wm(e,t){let n=Lm(t);if(n===void 0)return!1;let r=JSON.stringify(n);return e===r||r.length>120&&e===`${r.slice(0,119)}…`}function Gm(e){let t=[],n=new Map,r,i=[],a=()=>{if(i.length===1)t.push({kind:`entry`,entry:i[0]});else if(i.length>1){let e=i[0];t.push({kind:`entry`,entry:{...e,text:i.map(e=>e.text).join(``)}})}i=[],r=void 0};for(let o of e)if(o.kind===`text`&&o.streamId)r!==o.streamId&&a(),r=o.streamId,i.push(o);else if(a(),o.kind===`tool_call`){let e={kind:`call`,call:o,results:[]};o.id&&n.set(o.id,e),t.push(e)}else o.kind===`tool_result`&&o.id&&n.has(o.id)?n.get(o.id)?.results.push(o):t.push({kind:`entry`,entry:o});return a(),t}function Km({at:e}){let{i18n:t}=N();return e==null?null:(0,U.jsx)(`time`,{dateTime:new Date(e).toISOString(),title:au(e,t.language),className:`shrink-0 text-xs text-muted-foreground tabular-nums`,children:iu(e)})}function qm(e){let t=e.split(`
15
+ `).find(e=>e.trim()!==``)??``;return t.length>140?`${t.slice(0,139)}…`:t}function Jm({failed:e=!1,head:t,at:n,children:r}){return(0,U.jsxs)(fd,{className:M(`rounded-md border text-sm`,e&&`border-status-err/30 bg-status-err-bg`),children:[(0,U.jsxs)(pd,{className:`group flex w-full items-center gap-2 px-2 py-1 text-left`,children:[(0,U.jsx)(wa,{className:`size-3.5 shrink-0 transition-transform group-data-[state=open]:rotate-90`}),t,(0,U.jsx)(`span`,{className:`ml-auto`}),(0,U.jsx)(Km,{at:n})]}),(0,U.jsx)(md,{children:(0,U.jsx)(`pre`,{className:`max-h-96 overflow-auto px-3 pb-2 font-mono text-xs whitespace-pre-wrap`,children:r})})]})}function Ym({result:e,showJson:t}){let{t:n}=N(),r=t?void 0:Lm(e.text),i=r===void 0?e.text:Vm(r);return e.error?(0,U.jsx)(Jm,{failed:!0,head:(0,U.jsxs)(`span`,{className:`min-w-0 truncate`,children:[(0,U.jsx)(`span`,{className:`font-medium text-status-err`,children:n(`runs.transcript.error`)}),` `,qm(i)]}),at:e.at,children:i}):(0,U.jsx)(Jm,{head:(0,U.jsxs)(`span`,{className:`truncate`,children:[n(`runs.transcript.result`),` · `,qm(i)||n(`runs.transcript.emptyResult`)]}),at:e.at,children:i})}function Xm({call:e,results:t,showJson:n}){let r=n?void 0:Lm(e.input),i=r!==void 0&&Wm(e.summary,e.input)?Um(r):e.summary;return(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(Jm,{head:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,U.jsx)(`code`,{className:`min-w-0 truncate font-mono text-xs text-muted-foreground`,children:i})]}),at:e.at,children:r===void 0?e.input:Vm(r)}),t.map((e,t)=>(0,U.jsx)(`div`,{className:`ml-4`,children:(0,U.jsx)(Ym,{result:e,showJson:n})},t))]})}function Zm({entry:e,showJson:t}){let{t:n}=N();switch(e.kind){case`text`:return(0,U.jsxs)(`section`,{"aria-label":n(`runs.transcript.textLabel`),className:`rounded-lg border bg-card p-3`,children:[(0,U.jsxs)(`div`,{className:`mb-1 flex items-center justify-between gap-2 text-xs font-medium text-muted-foreground uppercase`,children:[(0,U.jsx)(`span`,{children:n(`runs.transcript.specialist`)}),(0,U.jsx)(Km,{at:e.at})]}),(0,U.jsx)(tm,{text:e.text})]});case`tool_call`:return(0,U.jsx)(Xm,{call:e,results:[],showJson:t});case`tool_result`:return(0,U.jsx)(Ym,{result:e,showJson:t});case`result`:return(0,U.jsxs)(`div`,{className:M(`flex items-center gap-2 text-xs text-muted-foreground`,e.error&&`text-status-err`),children:[e.verdict?(0,U.jsx)($,{status:e.verdict===`done`?`done`:`needs_human`}):null,(0,U.jsxs)(`span`,{children:[n(`runs.transcript.usage`,{input:Vl(e.inputTokens),output:Vl(e.outputTokens)}),` `,Bl(e)]}),(0,U.jsx)(Km,{at:e.at})]});case`raw`:return!t&&Lm(e.text)!==void 0?null:(0,U.jsx)(`pre`,{className:`font-mono text-xs whitespace-pre-wrap`,children:e.text})}}function Qm({entries:e,onlyText:t=!1,showJson:n=!0}){let{t:r}=N();if(e.length===0)return(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r(`runs.transcript.empty`)});let i=Gm(e),a=t?i.filter(e=>e.kind===`entry`&&e.entry.kind===`text`):i;return a.length===0?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r(`runs.transcript.noReplies`)}):(0,U.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.map((e,t)=>e.kind===`call`?(0,U.jsx)(Xm,{call:e.call,results:e.results,showJson:n},t):(0,U.jsx)(Zm,{entry:e.entry,showJson:n},t))})}function $m(e){let{t}=N();return(0,U.jsxs)(U.Fragment,{children:[e.attempt.interrupting?(0,U.jsx)(`span`,{className:`text-xs text-status-warn`,children:t(`runs.attempt.interrupting`)}):null,e.onMessage?(0,U.jsxs)(A,{variant:`outline`,size:`sm`,onClick:e.onMessage,children:[(0,U.jsx)(To,{}),t(`runs.message.button`)]}):null,e.onRetry?(0,U.jsxs)(A,{variant:`outline`,size:`sm`,onClick:e.onRetry,children:[(0,U.jsx)(Go,{}),t(`runs.attempt.retryStep`)]}):null]})}function eh({attempt:e,verdict:t}){let{t:n}=N(),r=e.denials??[],i=e.outsideChanges??[];return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(wa,{className:`size-4 shrink-0 transition-transform group-data-[state=open]:rotate-90`}),(0,U.jsxs)(`span`,{className:`font-medium`,children:[`#`,e.seq,` `,e.stepName??e.stepId,e.round>1?` · ${n(`runs.attempt.round`,{round:e.round})}`:``]}),(0,U.jsx)(`span`,{className:`truncate text-muted-foreground`,title:`${e.specialist} · ${e.runtime} ${e.model??``}`.trim(),children:e.model??e.runtime}),(0,U.jsx)($,{status:t}),(0,U.jsxs)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,children:[zl(e.durationMs),` · `,Vl(e.usage?.inputTokens),`/`,Vl(e.usage?.outputTokens),` · `,Bl(e.usage)||`—`]}),r.length>0?(0,U.jsx)(`span`,{className:`text-xs text-status-warn`,title:n(`runs.attempt.denialsTitle`),children:n(`runs.attempt.denials`,{n:r.length})}):null,i.length>0?(0,U.jsx)(`span`,{className:`text-xs text-status-warn`,title:n(`runs.attempt.outsideTitle`),children:n(`runs.attempt.outside`,{n:i.length})}):null]})}function th({denials:e}){let{t}=N();return e.length===0?null:(0,U.jsx)(`section`,{"aria-label":t(`runs.attempt.denialsLabel`),children:(0,U.jsxs)(k,{variant:`warn`,children:[(0,U.jsx)(`div`,{className:`mb-1 text-xs font-medium uppercase`,children:t(`runs.attempt.denialsHeading`)}),(0,U.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.map((e,n)=>(0,U.jsxs)(`li`,{children:[(0,U.jsx)(`code`,{className:`font-mono text-xs`,children:e.command===null?e.tool:`${e.tool} ${e.command}`}),e.suggestions.map((e,n)=>(0,U.jsx)(`div`,{className:`text-xs`,children:e.pattern===null?(0,U.jsx)(`span`,{children:t(`runs.attempt.noPattern`)}):(0,U.jsxs)(U.Fragment,{children:[t(`runs.attempt.pattern`),` `,(0,U.jsx)(`code`,{children:e.pattern})]})},n))]},n))})]})})}function nh({attempt:e,rawLog:t,transcript:n,onlyReplies:r,showJson:i,raw:a,onRaw:o}){let{t:s,i18n:c}=N(),l=e.denials??[];return(0,U.jsxs)(`div`,{className:`flex flex-col gap-3 border-t p-3`,children:[e.reason?(0,U.jsx)(k,{variant:`destructive`,children:e.reason}):null,(0,U.jsx)(th,{denials:l}),(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,U.jsx)(`time`,{dateTime:new Date(e.startedAt).toISOString(),title:au(e.startedAt,c.language),className:`tabular-nums`,children:s(`runs.attempt.started`,{time:iu(e.startedAt)})})}),(0,U.jsx)(rh,{attempt:e}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsx)(`h4`,{className:`text-sm font-semibold`,children:s(`runs.attempt.log`)}),t?(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(Np,{id:`raw-${e.seq}`,checked:a,onCheckedChange:o}),(0,U.jsx)(Dl,{htmlFor:`raw-${e.seq}`,className:`text-xs`,children:s(`runs.attempt.raw`)})]}):null]}),a&&t?(0,U.jsx)(`pre`,{className:`max-h-[60vh] overflow-auto rounded-md bg-muted p-2 font-mono text-xs`,children:t.join(`
16
+ `)}):n?(0,U.jsx)(Qm,{entries:n.entries,onlyText:r,showJson:i}):(0,U.jsx)(j,{role:`status`,"aria-label":s(`runs.attempt.loadingLog`),className:`h-16`}),(0,U.jsx)(ih,{attempt:e})]})}function rh({attempt:e}){let{t}=N();return(0,U.jsx)(U.Fragment,{children:e.message?(0,U.jsxs)(`section`,{"aria-label":t(`runs.attempt.humanMessage`),className:`rounded-lg border border-status-warn/30 bg-status-warn-bg p-3`,children:[(0,U.jsxs)(`div`,{className:`mb-1 flex items-center justify-between gap-2 text-xs font-medium text-status-warn uppercase`,children:[(0,U.jsx)(`span`,{children:t(`runs.attempt.humanMessage`)}),(0,U.jsx)(Km,{at:e.message.at})]}),(0,U.jsx)(tm,{text:e.message.text})]}):null})}function ih({attempt:e}){let{t}=N();return(0,U.jsxs)(U.Fragment,{children:[e.summary?(0,U.jsxs)(`section`,{"aria-label":t(`runs.attempt.summaryLabel`),className:`rounded-lg border p-3`,children:[(0,U.jsx)(`div`,{className:`mb-1 text-xs font-medium text-muted-foreground uppercase`,children:t(`runs.attempt.summary`)}),(0,U.jsx)(tm,{text:e.summary})]}):null,e.feedback||e.decision?(0,U.jsxs)(`section`,{"aria-label":t(`runs.attempt.feedbackLabel`),className:`rounded-lg border border-status-warn/30 bg-status-warn-bg p-3`,children:[(0,U.jsx)(`div`,{className:`mb-1 text-xs font-medium text-status-warn uppercase`,children:t(`runs.attempt.feedback`)}),e.feedback?(0,U.jsx)(tm,{text:e.feedback}):null,e.decision?(0,U.jsxs)(`p`,{className:`mt-2 text-sm`,children:[(0,U.jsx)(`span`,{className:`font-medium`,children:t(`runs.attempt.answer`,{by:t(`runs.decisions.${st(e.decision.by)}`)})}),` `,e.decision.answer]}):null]}):null]})}var ah=1500;function oh(e,t,n,r,i){let[a,o]=(0,L.useState)(null),s=(0,L.useRef)(null);return(0,L.useEffect)(()=>{if(!i)return;let a=!1,c=null,l=async()=>{let i=s.current;try{let u=await e.transcript(t,n,r,i?.cursor??0);if(a)return;let d={cursor:u.cursor,running:u.running,entries:[...i?.entries??[],...u.entries]};s.current=d,o(d),u.running&&(c=setTimeout(()=>void l(),ah))}catch{a||(c=setTimeout(()=>void l(),ah*2))}};return(!s.current||s.current.running)&&l(),()=>{a=!0,c&&clearTimeout(c)}},[e,t,n,r,i]),a}var sh={run:`bg-status-run`,warn:`bg-status-warn`,err:`bg-status-err`,ok:`bg-status-ok`,mute:`bg-status-mute`};function ch({api:e,runId:t,group:n,attempt:r,initiallyOpen:i,rawLog:a,onlyReplies:o=!1,showJson:s=!1,onRetry:c,onMessage:l}){let{t:u}=N(),[d,f]=(0,L.useState)(i),[p,m]=(0,L.useState)(!1),h=oh(e,t,n,r.seq,d),g=r.verdict??r.status;return(0,U.jsxs)(`li`,{className:`relative pl-6`,children:[(0,U.jsx)(`span`,{"aria-hidden":!0,className:M(`absolute top-3.5 left-0 size-3 -translate-x-1/2 rounded-full ring-4 ring-background`,sh[lu(g)])}),(0,U.jsxs)(fd,{open:d,onOpenChange:f,className:`rounded-lg border bg-card`,children:[(0,U.jsxs)(`div`,{className:`sticky top-[var(--group-header-height,0px)] z-[5] flex items-center gap-2 rounded-t-lg bg-card pr-2`,children:[(0,U.jsx)(pd,{"aria-label":u(`runs.attempt.label`,{seq:r.seq,step:r.stepName??r.stepId}),className:`group flex min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-1 px-3 py-2 text-left text-sm`,children:(0,U.jsx)(eh,{attempt:r,verdict:g})}),(0,U.jsx)($m,{attempt:r,onMessage:l,onRetry:c})]}),(0,U.jsx)(md,{children:d?(0,U.jsx)(nh,{attempt:r,rawLog:a,transcript:h,onlyReplies:o,showJson:s,raw:p,onRaw:m}):null})]})]})}function lh({api:e,runId:t,group:n,attempts:r,openSeq:i,lastSeq:a,rawLog:o,onlyReplies:s,showJson:c,retryable:l,onRetry:u,onMessage:d}){let{t:f}=N();return r.length===0?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:f(`runs.attempt.none`)}):(0,U.jsx)(`ol`,{"aria-label":f(`runs.attempt.list`),className:`ml-1.5 flex flex-col gap-2 border-l pb-1`,children:r.map(r=>(0,U.jsx)(ch,{api:e,runId:t,group:n,attempt:r,initiallyOpen:r.seq===i,rawLog:r.seq===a?o:null,onlyReplies:s,showJson:c,...r.seq===a&&l?{onRetry:u}:{},...r.seq===a&&d&&r.status===`running`&&r.verdict===null&&!r.interrupting?{onMessage:d}:{}},r.seq))})}function uh({ctx:e}){let{t}=N(),{row:n,view:r,caps:i}=e,{spec:a,progress:o}=e.tabs;return(0,U.jsxs)(gd,{"aria-label":t(`runs.group.tabs`),children:[(0,U.jsx)(_d,{value:`log`,children:t(`runs.group.log`)}),i.changes?(0,U.jsxs)(_d,{value:`changes`,children:[t(`runs.group.changes`),r?.diff?` · ${r.diff.files.length}`:``]}):null,(0,U.jsx)(_d,{value:`task`,children:t(`runs.group.task`)}),a?.design==null?null:(0,U.jsx)(_d,{value:`design`,children:t(`runs.group.design`)}),a?.tasks==null?null:(0,U.jsxs)(_d,{value:`tasks`,children:[t(`runs.group.tasks`),o?` · ${o.done}/${o.total}`:``]}),(0,U.jsxs)(_d,{value:`artifacts`,disabled:n.artifacts===0,title:n.artifacts===0?t(`runs.group.artifactsEmpty`):void 0,children:[t(`runs.group.artifacts`),n.artifacts>0?` · ${n.artifacts}`:``]})]})}function dh({ctx:e}){let{t}=N(),{api:n,runId:r,row:i,view:a,caps:o}=e;if(!a)return null;let s=a.attempts.at(-1)?.seq??null,c=(e.openStep?a.attempts.findLast(t=>t.stepId===e.openStep)?.seq:null)??s;return(0,U.jsx)(vd,{value:`log`,className:`flex flex-col gap-3`,children:(0,U.jsx)(lh,{api:n,runId:r,group:i.slug,attempts:a.attempts,openSeq:c,lastSeq:s,rawLog:a.log?a.log.lines:null,onlyReplies:e.onlyReplies,showJson:!1,onMessage:()=>e.setMessaging(s),retryable:o.retry&&(i.status===`failed`||i.status===`cancelled`),onRetry:()=>void e.act(()=>n.retry(r,i.slug),()=>F(t(`runs.header.retryStarted`)))})})}function fh({ctx:e}){let{t}=N(),{api:n,runId:r,row:i,view:a}=e;return a?(0,U.jsx)(vd,{value:`changes`,children:a.diff&&a.diff.files.length>0?(0,U.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,U.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:(0,U.jsx)(xm,{diff:{files:a.diff.files.length,added:a.diff.added,removed:a.diff.removed}})}),(0,U.jsx)(Pm,{files:a.diff.files,diff:{api:n,runId:r,group:i.slug,revision:a.diff.revision}})]}):(0,U.jsx)(Ae,{title:t(`runs.group.noChanges`),children:t(`runs.group.noChangesText`)})}):null}function ph({value:e,label:t,change:n,text:r}){let{t:i}=N();return(0,U.jsx)(vd,{value:e,children:(0,U.jsxs)(`section`,{"aria-label":t,className:`rounded-md border bg-card p-4 text-card-foreground`,children:[n===void 0?null:(0,U.jsx)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:i(`runs.group.specChange`,{name:n})}),(0,U.jsx)(tm,{text:r})]})})}function mh({ctx:e}){let{t}=N(),{api:n,runId:r,row:i,view:a,caps:o}=e,{spec:s}=e.tabs;return a===null?(0,U.jsxs)(`div`,{role:`status`,"aria-label":t(`runs.group.loading`),className:`flex flex-col gap-2`,children:[(0,U.jsx)(j,{className:`h-8 w-64`}),(0,U.jsx)(j,{className:`h-24`})]}):(0,U.jsxs)(hd,{value:e.tabs.tab,onValueChange:e.tabs.setTab,children:[(0,U.jsx)(uh,{ctx:e}),(0,U.jsx)(dh,{ctx:e}),o.changes?(0,U.jsx)(fh,{ctx:e}):null,(0,U.jsx)(ph,{value:`task`,label:t(`runs.group.task`),text:a.task}),s?.design==null?null:(0,U.jsx)(ph,{value:`design`,label:t(`runs.group.design`),change:s.change,text:s.design}),s?.tasks==null?null:(0,U.jsx)(ph,{value:`tasks`,label:t(`runs.group.tasks`),change:s.change,text:s.tasks}),i.artifacts>0?(0,U.jsx)(vd,{value:`artifacts`,children:(0,U.jsx)(bm,{api:n,runId:r,group:i.slug,count:i.artifacts,revision:i.artifactsRevision,onError:e.onError})}):null]})}function hh(e){for(let t=e.parentElement;t;t=t.parentElement){let e=getComputedStyle(t).overflowY;if(e===`auto`||e===`scroll`)return t}return null}function gh(e,t,n=null){let r=(0,L.useRef)(t);r.current=t,(0,L.useEffect)(()=>{if(!e||typeof IntersectionObserver>`u`)return;let t=new IntersectionObserver(e=>{e[e.length-1]?.isIntersecting&&r.current()},{root:hh(e),rootMargin:`200px`});return t.observe(e),()=>t.disconnect()},[e,n])}function _h(e){return e?hh(e)??document.scrollingElement??document.documentElement:null}function vh(){return typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`}function yh(e){let[t,n]=(0,L.useState)(!1),r=(0,L.useRef)(e);r.current=e;let i=(0,L.useCallback)(()=>{let e=_h(r.current);e?.scrollTo({top:e.scrollHeight,behavior:vh()})},[]),a=(0,L.useCallback)(()=>{n(!0),i()},[i]),o=(0,L.useCallback)(()=>n(!1),[]);return(0,L.useEffect)(()=>{if(!t||!e)return;let r=_h(e);if(!r)return;let a=r===document.scrollingElement||r===document.documentElement?window:r,o=r.scrollTop,s=()=>n(!1),c=e=>{e.deltaY<0&&s()},l=e=>{let t=e;(t.key===`ArrowUp`||t.key===`PageUp`||t.key===`Home`||t.key===` `&&t.shiftKey)&&s()},u=null,d=[[`wheel`,c],[`keydown`,l],[`touchstart`,e=>{u=e.touches[0]?.clientY??null}],[`touchmove`,e=>{let t=e.touches[0]?.clientY;t!==void 0&&u!==null&&t>u&&s(),t!==void 0&&(u=t)}],[`scroll`,()=>{let e=r.scrollTop;e<o-1&&s(),o=e}]];for(let[e,t]of d)a.addEventListener(e,t,{passive:!0});let f=typeof ResizeObserver>`u`?null:new ResizeObserver(()=>i());return f?.observe(e),()=>{for(let[e,t]of d)a.removeEventListener(e,t);f?.disconnect()}},[t,e,i]),{following:t,follow:a,stop:o}}function bh(e,t,n){let r=`kind`in e,i=r&&e.kind!==`split`&&e.kind!==`action`&&!ot(e),a=r&&ot(e),o=e.status===`failed`||e.status===`cancelled`;return{retry:!i&&!a&&[`failed`,`cancelled`,`conflict`].includes(e.status),retryDelivery:i&&o&&(t||n),cancel:![`merged`,`done`,`failed`,`cancelled`].includes(e.status),changes:!r}}function xh(e,t){return e.topology.steps.find(e=>e.groups.some(e=>e.slug===t))?.id??null}function Sh(e,t){return e.topology.steps.find(e=>e.id===t)?.groups.some(e=>e.status===`running`||e.status===`needs_human`)??!1}function Ch(e,t,n){let{t:r}=N(),i=ke(),[a,o]=(0,L.useState)(null);return{pending:a,toggle:async(a,s,c={})=>{if(!e)return;let l=Sh(e,a);if(s&&(l||c.allGroups)){let t=[l?r(`runs.steps.confirmDescription`):null,c.allGroups?r(`runs.steps.confirmAllGroups`):null].filter(Boolean).join(` `);if(!await i({title:r(`runs.steps.confirmTitle`,{step:e.steps.find(e=>e.id===a)?.name??a}),description:t,confirmLabel:r(`runs.steps.confirmLabel`),cancelLabel:r(`runs.steps.keep`),destructive:!0}))return}o(a);try{await t.skipStep(e.id,a,s),F(r(s?`runs.steps.doneSkip`:`runs.steps.doneUnskip`))}catch(e){n(e.message)}finally{o(null)}}}}function wh(e){let t=0,n=0;for(let r of e.split(`
17
+ `)){let e=/^\s*[-*+]\s+\[( |x|X)\]\s/.exec(r);e&&(n+=1,e[1]!==` `&&(t+=1))}return n===0?null:{done:t,total:n}}var Th=5e3,Eh=(e,t)=>e===t||e!==null&&t!==null&&e.change===t.change&&e.path===t.path&&e.design===t.design&&e.tasks===t.tasks;function Dh(e,t,n,r,i,a,o=!0){let[s,c]=(0,L.useState)(void 0);return(0,L.useEffect)(()=>{if(!o)return;let r=!1,s=i=>e.groupSpec(t,n).then(e=>{r||c(t=>t!==void 0&&Eh(t,e)?t:e)},e=>{r||i||(c(e=>e===void 0?null:e),a(e.message))});s(!1);let l=i?setInterval(()=>void s(!0),Th):null;return()=>{r=!0,l!==null&&clearInterval(l)}},[e,t,n,r,i,o,a]),s}function Oh(e,t,n,r,i){let[a,o]=(0,L.useState)(null);return(0,L.useEffect)(()=>{let r=!1;return e.group(t,n).then(e=>!r&&o(e),e=>!r&&i(e.message)),()=>{r=!0}},[e,t,n,r,i]),a}function kh(e){let[t,n]=(0,L.useState)(!1);return{busy:t,act:async(t,r)=>{n(!0);try{await t(),r?.()}catch(t){e(t.message)}finally{n(!1)}}}}function Ah(e){let[t,n]=(0,L.useState)(e);return(0,L.useEffect)(()=>{if(e){n(!0);return}let t=setTimeout(()=>n(!1),250);return()=>clearTimeout(t)},[e]),t}function jh(e){let{api:t,runId:n,row:r,version:i,view:a,caps:o,addressTab:s,onAddressTab:c,onError:l}=e,[u,d]=(0,L.useState)(null),f=c?s:u,p=c??d,m=![`merged`,`done`,`failed`,`cancelled`].includes(r.status),h=`kind`in r,g=Dh(t,n,r.slug,i,m&&(f===`design`||f===`tasks`),l,!h),_=new Set([`log`,`task`]);o.changes&&_.add(`changes`),g?.design!=null&&_.add(`design`),g?.tasks!=null&&_.add(`tasks`),r.artifacts>0&&_.add(`artifacts`);let v=a!==null&&(h||g!==void 0),y=_.has(f??`log`)?f??`log`:`log`;return(0,L.useEffect)(()=>{v&&f!==null&&!_.has(f)&&p(`log`)}),{tab:y,setTab:e=>p(e),spec:g,progress:g?.tasks==null?null:wh(g.tasks)}}function Mh(e,t,n,r){let i=Ch(e,t,r),a=e&&!(`kind`in n)?xh(e,n.slug):null,o=a?e?.steps?.find(e=>e.id===a):void 0;return{skipper:i,skippable:a,canSkip:!!e&&!!o&&o.state!==`done`&&!o.skipped}}function Nh(e){let{api:t,runId:n,row:r,run:i,title:a,act:o}=e,{t:s}=N(),c=ke();return{cancelGroup:async()=>{await c({title:s(`runs.group.cancelTitle`,{title:a}),description:s(`runs.group.cancelDescription`),confirmLabel:s(`runs.group.cancelGroup`),cancelLabel:s(`runs.header.keep`),destructive:!0})&&await o(()=>t.cancel(n,r.slug),()=>F(s(`runs.group.cancelled`)))},markDelivered:async()=>{i&&await c({title:s(`runs.system.markDeliveredTitle`,{title:a}),description:s(`runs.header.markDeliveredConfirm`),confirmLabel:s(`runs.header.markDeliveredAction`),cancelLabel:s(`runs.header.markDeliveredKeep`)})&&await o(()=>t.markDelivered(i.id,[r.slug]),()=>F(s(`runs.header.markedDelivered`)))}}}function Ph(e,t=null){let{api:n,runId:r,row:i,run:a,onError:o}=e,{showUsage:s=!1,deliverable:c=!1}=e,{t:l}=N(),u=`${i.status}/${i.step}/${i.round}/${i.diff?.added??``}/${i.diffRevision??``}/${i.delivery}/${i.usage?.inputTokens??``}/${i.usage?.outputTokens??``}/${a?.delivery.inProgress??``}/${a?.delivery.finishedAt??``}/${i.artifacts}/${i.artifactsRevision}`,d=a?.delivery.inProgress??!1,f=bh(i,c,d),p=Oh(n,r,i.slug,u,o),{busy:m,act:h}=kh(o),g=jh({api:n,runId:r,row:i,version:u,view:p,caps:f,addressTab:e.tab??null,onAddressTab:e.onTab,onError:o}),_=`kind`in i&&i.kind!==`action`?l(`runs.system.${i.kind}`):i.title,v=Nh({api:n,runId:r,row:i,run:a,title:_,act:h}),y=yh(t),b=y.stop;(0,L.useEffect)(()=>{g.tab!==`log`&&b()},[g.tab,b]);let[x,S]=(0,L.useState)(!1),[C,w]=(0,L.useState)(null);return{...e,showUsage:s,deliverable:c,onlyReplies:e.onlyReplies??!1,view:p,busy:m,act:h,caps:f,delivering:d,title:_,tabs:g,watch:y,...v,skip:Mh(a,n,i,o),statusesMounted:Ah(s),forcing:x,setForcing:S,messaging:C,setMessaging:w}}function Fh(e){let{t}=N(),[n,r]=(0,L.useState)(null),i=Ph(e,n),[a,o]=(0,L.useState)(null),s=Tp(a);return(0,U.jsxs)(`section`,{ref:r,"aria-label":t(`runs.group.label`,{title:i.title}),className:`flex flex-col gap-3 p-4`,style:{"--group-header-height":`${s}px`},children:[(0,U.jsx)(Qp,{ctx:i,onHeight:o}),(0,U.jsx)(Op,{ctx:i}),(0,U.jsx)(Mp,{ctx:i}),(0,U.jsx)(dm,{ctx:i}),(0,U.jsx)(mh,{ctx:i})]})}var Ih=`__create`;function Lh({tags:e,hideLinked:t,disabled:n,onRemove:r}){let{t:i}=N();return e.map(e=>(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,U.jsx)(gp,{tag:e}),t&&e.task?null:(0,U.jsx)(`button`,{type:`button`,"aria-label":i(`tags.remove`,{name:e.name}),disabled:n,className:`rounded-full p-0.5 hover:bg-accent disabled:opacity-50`,onClick:()=>r(e.id),children:(0,U.jsx)(hs,{className:`size-3`})})]},e.id))}function Rh({listId:e,visible:t,hasTags:n,selected:r,createName:i,onToggle:a,onCreate:o}){let{t:s}=N();return(0,U.jsxs)(fl,{id:e,children:[t.length===0&&i===null?(0,U.jsx)(pl,{children:s(n?`picker.nothing`:`tags.none`)}):null,t.length>0?(0,U.jsx)(Z,{children:t.map(e=>(0,U.jsxs)(Q,{value:`tag:${e.id}`,onSelect:()=>a(e.id),children:[(0,U.jsx)(ba,{className:r.includes(e.id)?`opacity-100`:`opacity-0`}),(0,U.jsx)(gp,{tag:e})]},e.id))}):null,i===null?null:(0,U.jsx)(Z,{children:(0,U.jsxs)(Q,{value:`${Ih}:${i}`,onSelect:o,children:[(0,U.jsx)(Vo,{}),s(`tags.create`,{name:i})]})})]})}function zh(e,t,n){let r=n.toLowerCase();return t!==null&&n!==``&&!e.some(e=>e.name.toLowerCase()===r)}function Bh({api:e,repository:t,name:n,selected:r,onChange:i,onDone:a}){let o=Jd(),[s,c]=(0,L.useState)(!1),[l,u]=(0,L.useState)(null);return{error:l,setError:u,create:async()=>{if(e&&t!==null&&!s){c(!0),u(null);try{let s=await e.forRepository(t).addTag(n);o.update(t,s);let c=s.find(e=>e.name.toLowerCase()===n.toLowerCase());c&&!r.includes(c.id)&&i([...r,c.id],s),a()}catch(e){u(e.message)}finally{c(!1)}}}}}function Vh({id:e,label:t,open:n,listId:r,disabled:i}){let{t:a}=N();return(0,U.jsx)(hl,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,id:e,role:`combobox`,"aria-label":t,"aria-expanded":n,"aria-haspopup":`listbox`,"aria-controls":n?r:void 0,disabled:i,className:`inline-flex h-6 items-center gap-1 rounded-full px-2 text-xs text-muted-foreground hover:bg-accent disabled:opacity-50`,children:[(0,U.jsx)(Vo,{className:`size-3`}),a(`picker.add`)]})})}function Hh(e){let{id:t,label:n,selected:r,onChange:i,repository:a,api:o}=e,{allowCreate:s=!1,disabled:c=!1,chips:l=!0,hideLinked:u=!1}=e,{t:d}=N(),f=Jd(),p=f.of(a),m=(0,L.useId)(),[h,g]=(0,L.useState)(!1),[_,v]=(0,L.useState)(``),y=_.trim(),b=y.toLowerCase(),x=p.filter(e=>!(u&&e.task)),S=x.filter(e=>b===``||e.name.toLowerCase().includes(b)),C=s&&o!==void 0&&zh(p,a,y),{error:w,setError:T,create:E}=Bh({api:o,repository:a,name:y,selected:r,onChange:i,onDone:()=>v(``)}),D=e=>{T(null),i(r.includes(e)?r.filter(t=>t!==e):[...r,e]),v(``)},O=r.flatMap(e=>f.byId.get(e)??[]);return(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsxs)(ml,{open:h,onOpenChange:e=>{g(e),e||v(``)},children:[(0,U.jsxs)(`div`,{className:`flex min-h-9.5 w-fit max-w-full flex-wrap items-center gap-1.5 rounded-md border border-input bg-card p-1.5`,children:[l?(0,U.jsx)(Lh,{tags:O,hideLinked:u,disabled:c,onRemove:D}):null,(0,U.jsx)(Vh,{id:t,label:n,open:h,listId:m,disabled:c})]}),(0,U.jsx)(gl,{className:`p-0`,children:(0,U.jsxs)(ll,{shouldFilter:!1,label:d(`picker.search`,{label:n}),children:[(0,U.jsx)(dl,{value:_,onValueChange:v,placeholder:d(s?`tags.searchOrCreate`:`picker.searchOnly`)}),(0,U.jsx)(Rh,{listId:m,visible:S,hasTags:x.length>0,selected:r,createName:C?y:null,onToggle:D,onCreate:()=>void E()})]})})]}),w?(0,U.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:w}):null]})}var Uh=60;function Wh(e,t){let[n,r]=(0,L.useState)(null),[i,a]=(0,L.useState)(null),o=(0,L.useRef)(!1),s=(0,L.useRef)(!1),c=(0,L.useRef)(``),l=(0,L.useRef)(null),u=(0,L.useRef)(null),d=(0,L.useRef)(!1),f=Gl(e);(0,L.useEffect)(()=>{n===null&&d.current&&(d.current=!1,u.current?.querySelector(`button`)?.focus())},[n]);let p=()=>{s.current=!0,c.current=f,l.current=null,r(f)},m=e=>{s.current=!1,o.current=!1,l.current=null,d.current=e,r(null),a(null)};return{draft:n,setDraft:r,error:i,text:c,heading:u,current:f,open:p,close:m,save:async(n=!1)=>{if(!s.current||o.current)return;let r=c.current.trim();if(!(n&&r===l.current)){if(r===``||r===f)m(!n);else{o.current=!0,a(null);try{await t.setRunTitle(e.id,r),m(!n)}catch(e){o.current=!1,l.current=r,a(e.message)}}}}}}function Gh({run:e,api:t}){let{t:n}=N(),{draft:r,setDraft:i,error:a,text:o,heading:s,current:c,open:l,close:u,save:d}=Wh(e,t);return r===null?(0,U.jsxs)(`h1`,{ref:s,className:`group flex min-w-0 flex-1 items-start gap-1 text-lg font-semibold break-words [overflow-wrap:anywhere]`,children:[(0,U.jsxs)(`span`,{className:`min-w-0`,children:[(0,U.jsx)(`span`,{className:`font-mono text-base font-normal text-muted-foreground`,children:Rl(e.number)}),` `,(0,U.jsx)(`span`,{title:`${c}\n${e.id}`,children:c})]}),(0,U.jsx)(A,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6 opacity-0 group-hover:opacity-100 focus-visible:opacity-100`,"aria-label":n(`runs.header.editTitle`),title:n(`runs.header.editTitle`),onClick:l,children:(0,U.jsx)(zo,{})})]}):(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`font-mono text-base text-muted-foreground`,children:Rl(e.number)}),(0,U.jsx)(sc,{autoFocus:!0,value:r,maxLength:Uh,"aria-label":n(`runs.header.titleLabel`),"aria-invalid":a!==null,onFocus:e=>e.currentTarget.select(),onChange:e=>{o.current=e.target.value,i(e.target.value)},onBlur:()=>void d(!0),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),d()):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),u(!0))}})]}),a?(0,U.jsx)(k,{variant:`destructive`,children:a}):null]})}function Kh({className:e,...t}){return(0,U.jsx)(Kt,{className:M(`peer size-4 shrink-0 rounded-[4px] border border-input bg-card data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground disabled:opacity-50`,e),...t,children:(0,U.jsx)(Jt,{className:`flex items-center justify-center`,children:(0,U.jsx)(ba,{className:`size-3`})})})}function qh({run:e,api:t,onError:n}){let{t:r}=N(),{pending:i,toggle:a}=Ch(e,t,n),[o,s]=(0,L.useState)(!1),[c,l]=(0,L.useState)(!1),u=async(e,t)=>{l(!0);try{await a(e,t)}finally{l(!1)}};if(!e.steps||e.steps.length===0)return null;let d=e.steps.filter(e=>!e.skipped),f=d.length===1?d[0]:void 0;return(0,U.jsxs)(ml,{open:o,onOpenChange:e=>s(e||c||i!==null),children:[(0,U.jsx)(hl,{asChild:!0,children:(0,U.jsxs)(A,{variant:`outline`,children:[r(`runs.steps.button`,{active:d.length,total:e.steps.length}),(0,U.jsx)(Sa,{})]})}),(0,U.jsx)(gl,{className:`w-auto p-2`,children:(0,U.jsx)(`ul`,{"aria-label":r(`runs.steps.title`),className:`flex flex-col gap-1 text-sm`,children:e.steps.map(e=>(0,U.jsxs)(`li`,{className:`flex list-none items-center gap-2 px-1 py-0.5`,children:[(0,U.jsx)(Kh,{id:`run-step-${e.id}`,checked:!e.skipped,disabled:i!==null||e.state===`done`||f?.id===e.id,"aria-label":r(`runs.steps.checkboxLabel`,{name:e.name.endsWith(` (${e.id})`)?e.name.slice(0,-` (${e.id})`.length):e.name,step:e.id}),onCheckedChange:t=>void u(e.id,t!==!0)}),(0,U.jsx)(`span`,{className:e.skipped?`line-through`:void 0,children:e.name}),e.name.endsWith(` (${e.id})`)?null:(0,U.jsx)(`code`,{className:`text-xs text-muted-foreground`,children:e.id}),(0,U.jsx)(`span`,{className:`ml-auto pl-3 text-xs text-muted-foreground`,children:e.skipped?r(`runs.steps.skipped`):r(`runs.steps.${e.state}`)})]},e.id))})})]})}function Jh(e,t,n){let[r,i]=(0,L.useState)(!1);return{downloading:r,download:async()=>{if(t){i(!0);try{let{blob:n,fileName:r}=await t.runPatch(e.id),i=URL.createObjectURL(n),a=document.createElement(`a`);a.href=i,a.download=r,document.body.append(a),a.click(),a.remove(),URL.revokeObjectURL(i)}catch(e){n?.(e.message)}finally{i(!1)}}}}}function Yh({run:e,now:t,entry:n=null,onSelect:r,api:i,onError:a}){let{t:o}=N(),{downloading:s,download:c}=Jh(e,i,a),l=Hl(e.usage),u=Bl(e.usage),d=[{key:`status`,label:o(`runs.header.summary.status`),value:(0,U.jsx)(Wp,{run:e,entry:n,onSelect:r,layout:`rows`})},{key:`changes`,label:o(`runs.header.summary.changes`),value:(0,U.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-x-3 gap-y-1`,children:[e.diff?(0,U.jsx)(xm,{diff:e.diff}):(0,U.jsx)(`span`,{children:`—`}),(0,U.jsxs)(A,{variant:`outline`,size:`sm`,loading:s,disabled:e.delivery.merged===0||!i,onClick:()=>void c(),children:[(0,U.jsx)(Ha,{"aria-hidden":!0}),o(`runs.header.summary.download`)]})]})},{key:`path`,label:o(`runs.header.summary.path`),value:(0,U.jsx)(le,{path:e.repository,variant:`line`})},{key:`time`,label:o(`runs.header.summary.time`),value:zl(Jl(e,t)-e.createdAt)},...l?[{key:`tokens`,label:o(`runs.header.summary.tokens`),value:l}]:[],...u?[{key:`cost`,label:o(`runs.header.summary.cost`),value:u}]:[]];return(0,U.jsx)(`aside`,{"aria-label":o(`runs.header.summary.label`),className:`shrink-0 border-l pl-4 @3xl:w-[28rem]`,children:(0,U.jsx)(`dl`,{className:`grid grid-cols-[auto_minmax(0,1fr)] items-center gap-x-4 gap-y-1.5 text-sm`,children:d.map(e=>(0,U.jsxs)(`div`,{className:`contents`,children:[(0,U.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:e.label}),(0,U.jsx)(`dd`,{className:`min-w-0 text-foreground tabular-nums`,children:e.value})]},e.key))})})}function Xh({run:e,repair:t}){let{t:n}=N();return(0,U.jsxs)(U.Fragment,{children:[e.dirtyWarning?(0,U.jsx)(k,{variant:`warn`,children:n(`runs.header.dirty`)}):null,t&&!t.allowed?(0,U.jsx)(k,{variant:`warn`,"data-testid":`observer-forbidden`,children:n(`runs.header.observerForbidden`)}):null,t?.cancelReason?(0,U.jsx)(k,{variant:`warn`,"data-testid":`observer-cancel-reason`,children:n(`runs.header.observerCancelReason`,{reason:t.cancelReason})}):null]})}function Zh({run:e,repair:t,observer:n,hold:r,delivery:i}){let{t:a}=N(),{observing:o,setObserver:s,observerError:c}=n,{continueItem:l}=r;return(0,U.jsxs)(U.Fragment,{children:[t?.active?(0,U.jsx)(A,{variant:`outline`,loading:o,onClick:()=>void s(!1),children:a(`runs.header.observerCancel`)}):null,t&&!t.allowed?(0,U.jsx)(A,{variant:`outline`,loading:o,onClick:()=>void s(!0),children:a(`runs.header.observerGiveBack`)}):null,c?(0,U.jsx)(`span`,{role:`alert`,className:`text-sm text-destructive`,children:c}):null,l===null?null:(0,U.jsx)(A,{variant:`outline`,loading:r.continuing,onClick:()=>void r.resume(l),children:a(`runs.header.continue`)}),r.pausable?(0,U.jsx)(A,{variant:`outline`,loading:r.pausing,onClick:()=>void r.pause(),children:a(`runs.header.pause`)}):null,e.returnable?(0,U.jsx)(A,{variant:`outline`,loading:r.returning,onClick:()=>void r.putBack(),children:a(`runs.header.returnRun`)}):null,(0,U.jsx)(A,{loading:i.applying,disabled:!i.deliverable,onClick:()=>void i.apply(!1),children:a(`runs.header.deliver`)})]})}function Qh({retry:e}){let{t}=N(),{failed:n,retrying:r,hasCancelled:i}=e;return n.length===0?null:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(ic,{disabled:r!==null,onSelect:()=>void e.retryFailed(!1),children:[(0,U.jsx)(Go,{className:r===`plain`?`motion-safe:animate-spin`:void 0}),t(i?`runs.header.retryFailedCancelled`:`runs.header.retryFailed`),` (`,n.length,`)`]}),(0,U.jsxs)(ic,{disabled:r!==null,onSelect:()=>void e.retryFailed(!0),children:[(0,U.jsx)(Uo,{className:r===`refresh`?`motion-safe:animate-spin`:void 0}),t(`runs.header.retryRefreshConfig`),` (`,n.length,`)`]}),(0,U.jsx)(oc,{})]})}function $h({run:e,retry:t,delivery:n,onSubtask:r}){let{t:i}=N();return(0,U.jsxs)(ec,{children:[(0,U.jsx)(tc,{asChild:!0,children:(0,U.jsxs)(A,{variant:`outline`,"aria-label":i(`runs.header.more`),children:[(0,U.jsx)(Wa,{}),i(`runs.header.more`)]})}),(0,U.jsxs)(rc,{align:`start`,children:[(0,U.jsx)(Qh,{retry:t}),r?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(ic,{onSelect:()=>r(e),children:[(0,U.jsx)(yo,{}),i(`runs.header.subtask`)]}),(0,U.jsx)(oc,{})]}):null,(0,U.jsx)(ic,{disabled:!n.deliverable,onSelect:()=>n.setForcing(!0),children:i(`runs.header.forceDeliver`)}),(0,U.jsx)(ic,{disabled:!n.deliverable,onSelect:()=>void n.markDelivered(),children:i(`runs.header.markDelivered`)}),(0,U.jsx)(ic,{onSelect:()=>{navigator.clipboard?.writeText(e.id),F(i(`runs.header.copied`))},children:i(`runs.header.copyId`)})]})]})}function eg(e,t,n){let{t:r}=N(),[i,a]=(0,L.useState)(!1),[o,s]=(0,L.useState)(!1),[c,l]=(0,L.useState)(!1),[u,d]=(0,L.useState)(null);(0,L.useEffect)(()=>d(null),[e.hold,e.queueItem]);let f=async(e,t)=>{e(!0);try{await t()}catch(e){n(e.message)}finally{e(!1)}};return{returning:i,pausing:o,continuing:c,putBack:()=>f(a,async()=>{await t.queueReturn(e.id,e.repository),F(r(`runs.header.returned`))}),pause:()=>f(s,async()=>{let n=await t.pauseRun(e.id,e.repository);d(n.item),F(r(`runs.header.paused`))}),resume:n=>f(l,async()=>{await t.forRepository(e.repository).queueRunNow(n),d(null),F(r(`runs.header.continued`))}),continueItem:(e.hold===null?null:e.queueItem)??u,pausable:!e.finished&&e.hold===null&&e.queueItem===null&&u===null}}function tg(e,t){let[n,r]=(0,L.useState)(!1),[i,a]=(0,L.useState)(null);return{observing:n,observerError:i,setObserver:async n=>{r(!0),a(null);try{await t.setRunObserver(e.id,e.repository,n)}catch(e){a(e.message)}finally{r(!1)}}}}function ng(e,t){let[n,r]=(0,L.useState)(!1),[i,a]=(0,L.useState)(null),{byId:o}=Jd(),s=(e.tags??[]).map(e=>e.id);return{tagging:n,tagError:i,runTagIds:s,changeTags:async(n,i)=>{let c=i?new Map(i.map(e=>[e.id,e])):o,l=e=>e.flatMap(e=>{let t=c.get(e);return t&&!t.task?t.name:[]}),u=l(n.filter(e=>!s.includes(e))),d=l(s.filter(e=>!n.includes(e)));if(u.length!==0||d.length!==0){r(!0),a(null);try{await t.setRunTags(e.id,{...u.length>0?{add:u}:{},...d.length>0?{remove:d}:{}})}catch(e){a(e.message)}finally{r(!1)}}}}}var rg=e=>e===`failed`||e===`cancelled`;function ig(e,t,n){let{t:r}=N(),[i,a]=(0,L.useState)(null),o=e.groups.filter(e=>rg(e.status));return e.split&&rg(e.split.status)&&o.unshift({slug:`_split`,title:r(`runs.header.split`),status:e.split.status}),{failed:o,hasCancelled:o.some(e=>e.status===`cancelled`),retrying:i,retryFailed:async i=>{a(i?`refresh`:`plain`);let s=[];for(let n of o)try{i?await t.retry(e.id,n.slug,{refreshConfig:!0}):await t.retry(e.id,n.slug)}catch(e){s.push(`${n.title}: ${e.message}`)}a(null),s.length>0?n(r(`runs.header.retryRefused`,{list:s.join(`; `)})):F(r(`runs.header.retryStarted`))}}}function ag(e,t,n,r){let{t:i}=N(),a=ke(),[o,s]=(0,L.useState)(!1),[c,l]=(0,L.useState)(!1);return{forcing:o,setForcing:s,applying:c,apply:async i=>{s(!1),l(!0);try{await(r?r(i):t.apply(e.id,i))}catch(e){n(e.message)}finally{l(!1)}},markDelivered:async()=>{if(await a({title:i(`runs.header.markDeliveredTitle`),description:i(`runs.header.markDeliveredConfirm`),confirmLabel:i(`runs.header.markDeliveredAction`),cancelLabel:i(`runs.header.markDeliveredKeep`)}))try{await t.markDelivered(e.id),F(i(`runs.header.markedDelivered`))}catch(e){n(e.message)}},deliverable:Pp(e)}}function og({run:e,api:t,tags:n}){let{t:r}=N();return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:(0,U.jsx)(Gh,{run:e,api:t})}),(0,U.jsx)(`div`,{children:(0,U.jsx)(af,{id:e.pipeline,name:e.pipelineName})}),e.name?(0,U.jsx)(`div`,{className:`font-mono text-xs text-muted-foreground`,children:e.name}):null,(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(Hh,{label:r(`runs.header.tags`),selected:n.runTagIds,repository:e.repository,onChange:(e,t)=>void n.changeTags(e,t),api:t,allowCreate:!0,disabled:n.tagging,hideLinked:!0}),n.tagError?(0,U.jsx)(k,{variant:`destructive`,children:n.tagError}):null]})]})}function sg({run:e,api:t,now:n,onError:r,onSelect:i,onDeliver:a,onSubtask:o,headerRef:s,entry:c=null}){let{t:l}=N(),u=rt(e),d=eg(e,t,r),f=tg(e,t),p=ng(e,t),m=ig(e,t,r),h=ag(e,t,r,a);return(0,U.jsxs)(`header`,{ref:s,"aria-label":l(`runs.header.label`),className:`@container border-b p-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-4 @3xl:flex-row @3xl:items-start`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,U.jsx)(og,{run:e,api:t,tags:p}),(0,U.jsx)(Xh,{run:e,repair:u}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(Zh,{run:e,repair:u,observer:f,hold:d,delivery:h}),(0,U.jsx)(qh,{run:e,api:t,onError:r}),(0,U.jsx)($h,{run:e,retry:m,delivery:h,onSubtask:o})]})]}),(0,U.jsx)(Yh,{run:e,now:n,entry:c,onSelect:i,api:t,onError:r})]}),h.forcing?(0,U.jsx)(kp,{run:e,api:t,onConfirm:()=>void h.apply(!0),onClose:()=>h.setForcing(!1)}):null]})}var cg=200;function lg(e){let t=(e??``).split(`
18
+ `)[0]?.trim()??``;return t.length>cg?`${t.slice(0,cg)}…`:t}function ug(e,t,n){t.kind===`applied`?F(e(`runs.system.delivered`)):t.kind===`failed`&&xe(e(n?`runs.system.deliveryFailedAgain`:`runs.system.deliveryFailedWith`,{reason:lg(t.reason)}))}function dg(e,t){let{t:n}=N(),[r,i]=(0,L.useState)({});return(0,L.useEffect)(()=>{let e=[],a=[];for(let[i,o]of Object.entries(r)){let r=t.find(e=>e.id===i);if(!r)continue;let s=zp(r,o);s===null?r.delivery.inProgress&&!o.busy&&a.push(i):(e.push(i),s.kind!==`cancelled`&&s.kind!==`pending`&&ug(n,s,o.failedBefore))}a.length>0&&i(e=>{let t={...e};for(let e of a){let n=t[e];n&&(t[e]={...n,busy:!0})}return t}),e.length>0&&i(t=>{let n={...t};for(let t of e)delete n[t];return n})},[t,r,n]),(0,L.useCallback)(async(t,r)=>{let a={since:t.delivery.finishedAt,failedBefore:t.delivery.failed>0,busy:!1},o=Rp(await e.apply(t.id,r));o.kind===`pending`?(F(n(`runs.system.deliveryStarted`)),i(e=>({...e,[t.id]:a}))):ug(n,o,a.failedBefore)},[e,n])}function fg({props:e}){let{t}=N(),{openedState:n=null,route:r,loaded:i}=e;return n===`loading`?(0,U.jsxs)(`div`,{role:`status`,"aria-label":t(`runs.page.connecting`),className:`flex flex-col gap-2 p-4`,children:[(0,U.jsx)(j,{className:`h-16`}),(0,U.jsx)(j,{className:`h-40`})]}):n===`missing`?(0,U.jsx)(Ae,{icon:(0,U.jsx)(uo,{}),title:t(`runs.page.notFound`),className:`m-auto`,children:(0,U.jsx)(`p`,{className:`font-mono`,children:r.run})}):i?(0,U.jsx)(Ae,{icon:(0,U.jsx)(jo,{}),title:t(`runs.page.choose`),className:`m-auto`,children:(0,U.jsxs)(`p`,{children:[t(`runs.page.chooseHint`),` `,(0,U.jsxs)(Ns,{children:[Es(),`K`]})]})}):null}function pg(e){let{t}=N(),{api:n,runs:r,run:i,route:a,now:o,onSelect:s,onRoute:c}=e,[l,u]=(0,L.useState)(null),d=wp(l),f=dg(n,r);if(!i)return(0,U.jsx)(fg,{props:e});let p=nf(i).find(e=>e.slug===a.group)??rf(i);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(sg,{run:i,api:n,now:o,onError:e.onError,onDeliver:e=>f(i,e),onSubtask:e.onSubtask,onSelect:e=>s(i.id,e),headerRef:u,entry:p}),p?(0,U.jsx)(Fh,{api:n,runId:i.id,row:p,openStep:a.group===p.slug?a.step:null,tab:a.group===null||a.group===p.slug?a.tab:null,onTab:e=>c({...a,group:p.slug,tab:e===`log`?null:e}),draftKey:`${i.id}/${p.slug}`,drafts:e.drafts,onDraft:e.onDraft,onClearDrafts:e.onClearDrafts,onError:e.onError,onlyReplies:e.onlyReplies,onOnlyReplies:e.onOnlyReplies,deliverable:Pp(i),onDeliver:()=>f(i,!1),run:i,onForceDeliver:()=>f(i,!0),showUsage:d,onSelectEntry:e=>s(i.id,e)},`${i.id}/${p.slug}/${a.step??``}`):(0,U.jsx)(`p`,{className:`p-4 text-sm text-muted-foreground`,children:t(`runs.page.noGroups`)})]})}function mg({more:e,onMore:t,setMarker:n}){let{t:r}=N();return e===`done`?null:e===`error`?(0,U.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-2 text-sm text-destructive`,children:[r(`runs.list.moreFailed`),(0,U.jsx)(A,{variant:`outline`,size:`sm`,onClick:t,children:r(`runs.list.retry`)})]}):(0,U.jsx)(`div`,{ref:n,role:e===`loading`?`status`:void 0,"aria-label":e===`loading`?r(`runs.list.loadingMore`):void 0,"data-run-list-end":``,className:`flex flex-col gap-2`,children:e===`loading`?(0,U.jsx)(j,{className:`h-16`}):(0,U.jsx)(`div`,{className:`h-4`})})}var hg=[`human`,`autopilot`,`observer`];function gg({run:e}){let{t}=N(),n=e.decisions??[];if(n.length===0)return null;let r=e=>e.split(`
19
+ `)[0]??``,i=hg.map(e=>({by:e,n:n.filter(t=>t.by===e).length})).filter(({n:e})=>e>0).map(({by:e,n})=>t(`runs.list.answersCount`,{who:t(`runs.decisions.${e}`),n})),a=n.map(e=>`${e.group} · ${e.stepId} (${t(`runs.decisions.${e.by}`)}): ${r(e.question)} → ${r(e.answer)}`).join(`
20
+ `);return(0,U.jsxs)(`span`,{className:`text-xs text-muted-foreground`,title:a,children:[t(`runs.list.answers`),`: `,i.join(` · `)]})}function _g({done:e,total:t}){let{t:n}=N(),r=ql({done:e,total:t});return(0,U.jsxs)(`span`,{role:`progressbar`,"aria-label":n(`runs.list.progress`),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":r,className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`h-1 flex-1 overflow-hidden rounded-full bg-muted`,children:(0,U.jsx)(`span`,{"data-fill":!0,className:`block h-full rounded-full`,style:{width:`${r}%`,backgroundColor:`color-mix(in oklch, var(--color-status-ok) ${r}%, var(--color-status-warn))`}})}),(0,U.jsxs)(`span`,{className:`w-[4ch] shrink-0 text-right text-xs tabular-nums`,children:[r,`%`]})]})}function vg({run:e}){let{t}=N();if(e.state!==`finished`&&e.state!==`failed`)return null;let n=e.groups.reduce((e,t)=>e+t.warnings,0);return n===0?null:(0,U.jsx)($,{status:`warnings`,label:t(`status.warnings`,{n})})}var yg=[`active`,`needs_human`,`repair`,`paused`,`frozen`],bg=[`merging`,`merged`,`conflict`,`failed`,`cancelled`,`done`];function xg(e,t){return e===`needs_human`&&t===`needs_human`?0:e===`running`?1:2}function Sg(e,t){if(!yg.includes(e.state))return[];let n=e.system??[],r=e=>({status:e.status,name:e.kind===`action`?e.title:t(e.kind)}),i=[...n.filter(e=>e.kind===`split`).map(r),...e.groups.map(e=>({status:e.status,name:e.stepName??e.step})),...n.filter(e=>e.kind!==`split`).map(r)].filter(e=>!bg.includes(e.status)&&e.name).map((e,t)=>({entry:e,index:t})).sort((t,n)=>xg(t.entry.status,e.state)-xg(n.entry.status,e.state)||t.index-n.index);return[...new Set(i.map(({entry:e})=>e.name))]}function Cg(e,t){let n=Sg(e,t),[r]=n;return r===void 0?null:{first:r,rest:n.length-1,all:n}}function wg({run:e}){let{t}=N(),n=Lp(e);return n?(0,U.jsx)($,{status:n.status,label:n.status===`apply_failed`?t(`runs.header.deliveryFailed`,{n:e.delivery.failed}):void 0,tip:n.status===`apply_failed`?n.reason??void 0:t(`runs.list.undeliveredTip`,{applied:n.delivered,merged:n.merged})}):null}function Tg({run:e,selectedGroup:t,onSelect:n}){let{t:r}=N(),i=nf(e);return(0,U.jsx)(`ul`,{"aria-label":r(`runs.list.groups`),className:`mt-1 ml-3 flex flex-col gap-0.5 border-l pl-2`,children:i.map(i=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{type:`button`,"aria-current":i.slug===t,className:M(`flex w-full items-center justify-between gap-2 rounded-md px-2 py-1 text-left text-sm hover:bg-accent`,i.slug===t&&`bg-accent font-medium`),onClick:()=>n(e.id,i.slug),children:[(0,U.jsxs)(`span`,{className:`truncate`,title:i.title,children:[`kind`in i&&i.kind!==`action`?r(`runs.system.${i.kind}`):i.title,`kind`in i?(0,U.jsx)(`span`,{className:`ml-1.5 text-xs font-normal text-muted-foreground`,children:r(`runs.system.badge`)}):null]}),Bp(i,r)]})},i.slug))})}function Eg(e){let{run:t,open:n,now:r,scope:i,onSelect:a}=e,{t:o}=N(),s=Yl(t,r,ju()),c=Lp(t),l=Cg(t,e=>o(`runs.system.${e}`)),u=uu(t,o),d=l?o(`runs.list.stageLabel`,{status:u,stage:l.first,more:l.rest>0?o(`runs.list.stageMore`,{n:l.rest}):``}):u;return(0,U.jsxs)(`li`,{"data-run":t.id,children:[(0,U.jsxs)(`button`,{type:`button`,className:M(`flex w-full flex-col gap-1 rounded-lg border bg-card p-2.5 text-left hover:bg-accent`,c&&`border-status-warn/40 bg-status-warn-bg/40`,n&&`border-primary bg-accent`),"data-undelivered":c?``:void 0,"aria-expanded":n,title:`${Gl(t)}\n${t.id}`,onClick:()=>a(t.id,null),children:[(0,U.jsxs)(`span`,{className:`block min-w-0 text-sm font-medium break-words [overflow-wrap:anywhere]`,children:[(0,U.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:Rl(t.number)}),` `,Gl(t)]}),(0,U.jsx)(`span`,{className:`truncate font-mono text-xs text-muted-foreground`,children:t.name??`—`}),(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground`,children:[i===`all`?(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-medium`,title:t.repository,children:[(0,U.jsx)(Ce,{path:t.repository}),O(t.repository)]}):null,(0,U.jsx)(af,{id:t.pipeline,name:t.pipelineName,focusable:!1}),(0,U.jsx)(vp,{tags:t.tags??[],nested:!0})]}),(0,U.jsxs)(`span`,{className:`grid grid-cols-2 items-center gap-2 text-xs text-muted-foreground`,children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,U.jsx)($,{status:t.state,label:d,tip:l?.all.join(`, `)}),(0,U.jsx)(vg,{run:t}),(0,U.jsx)(wg,{run:t})]}),t.state===`finished`?null:(0,U.jsx)(_g,{done:t.progress.done,total:t.progress.total})]}),(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground`,children:[(0,U.jsx)(`span`,{children:s.created}),(0,U.jsx)(`span`,{children:s.duration}),Hl(t.usage)?(0,U.jsx)(`span`,{children:Hl(t.usage)}):null,Bl(t.usage)?(0,U.jsx)(`span`,{children:Bl(t.usage)}):null]}),(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t.liveDiff?Wl(t.liveDiff,o):`—`}),(0,U.jsx)(gg,{run:t})]}),n&&nf(t).length>1?(0,U.jsx)(Tg,{...e}):null]})}function Dg({done:e,filtered:t,onReset:n}){let{t:r}=N();return(0,U.jsxs)(U.Fragment,{children:[e?(0,U.jsx)(Ae,{icon:(0,U.jsx)(Yo,{}),title:r(`runs.list.empty`)}):null,t?(0,U.jsx)(A,{variant:`outline`,size:`sm`,onClick:n,children:r(`runs.list.reset`)}):null]})}function Og({runs:e,selectedRun:t,selectedGroup:n,now:r,query:i,onQuery:a,filters:o,onFilters:s,onSelect:c,scope:l,onScope:u,repository:d,repositoryPaths:f,showFilters:p=!0,more:m=`done`,onMore:h=()=>void 0}){let{t:g}=N(),{byId:_}=Jd(),v=Wf(e,i,o,l,d,_),y=Jf(i,o,l)>0,[b,x]=(0,L.useState)(null),S=`${l}|${d}|${e.length}`;return gh(m===`idle`?b:null,h,S),(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[p?(0,U.jsx)(bp,{runs:e,query:i,onQuery:a,scope:l,onScope:u,repository:d,repositoryPaths:f,filters:o,onFilters:s}):null,v.length===0?(0,U.jsx)(Dg,{done:m===`done`,filtered:y,onReset:()=>{a(``),s(If)}}):(0,U.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:v.map(e=>(0,U.jsx)(Eg,{run:e,open:e.id===t,selectedGroup:n,now:r,scope:l,onSelect:c},e.id))}),(0,U.jsx)(mg,{more:m,onMore:h,setMarker:x})]})}function kg(e){return!e||e.done?`done`:e.error===null?e.loading?`loading`:`idle`:`error`}function Ag(e){let{t}=N(),{runs:n,loaded:r,run:i,group:a,history:o,...s}=e;return r?n.length===0?null:(0,U.jsx)(Og,{showFilters:!1,runs:n,selectedRun:i?.id??null,selectedGroup:a,now:s.now,query:s.query,onQuery:s.onQuery,filters:s.filters,onFilters:s.onFilters,onSelect:s.onSelect,scope:s.scope,onScope:s.onScope,repository:s.repository,repositoryPaths:s.repositoryPaths,more:kg(o),onMore:o?.loadMore}):(0,U.jsxs)(`div`,{role:`status`,"aria-label":t(`runs.page.connecting`),className:`flex flex-col gap-2`,children:[(0,U.jsx)(j,{className:`h-16`}),(0,U.jsx)(j,{className:`h-16`}),(0,U.jsx)(j,{className:`h-16`})]})}function jg(){try{let e=window.localStorage.getItem(`aip.web.runTags`),t=e===null?[]:JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function Mg(e){let{byId:t}=Jd(),[n]=(0,L.useState)(jg),[r,i]=P(`runFilters`,{...If,tagIds:n}),[a,o]=P(`runFiltersCollapsed`,!1);return{filters:{...If,...r,tagIds:(r.tagIds??[]).filter(n=>t.get(n)?.repository===e)},setStored:i,collapsed:a,setCollapsed:o,byId:t}}function Ng(e){let{route:t,onRoute:n,wide:r,shown:i,run:a}=e,[o,s]=(0,L.useState)(t.group?`detail`:`list`),c=(e,t)=>{s(`detail`),n({view:`runs`,run:e,group:t,step:null,tab:null})},l=e=>{if(i.length===0)return;let t=i.findIndex(e=>e.id===a?.id),n=i[Math.min(i.length-1,Math.max(0,t+e))];n&&(c(n.id,null),document.querySelector(`[data-run="${CSS.escape(n.id)}"]`)?.scrollIntoView({block:`nearest`}))};Os(`j`,()=>l(1)),Os(`k`,()=>l(-1));let u=(0,L.useRef)({run:t.run,group:t.group,step:t.step});return(0,L.useEffect)(()=>{let e=u.current;u.current={run:t.run,group:t.group,step:t.step},(e.run!==null&&t.run!==e.run||t.group!==null&&(t.group!==e.group||t.step!==e.step))&&t.run&&s(`detail`)},[t.run,t.group,t.step]),(0,L.useEffect)(()=>{r&&s(`list`)},[r]),{screen:o,setScreen:s,select:c}}var Pg=464;function Fg(e){let{runs:t,loaded:n,openedState:r=null,route:i,repository:a,scope:o}=e,s=ce(`(min-width: 768px)`),c=ce(`(min-width: 1280px)`),[l,u]=(0,L.useState)(``),{filters:d,setStored:f,collapsed:p,setCollapsed:m,byId:h}=Mg(a),g=t.find(e=>e.id===i.run)??null,_=Wf(t,l,d,o,a,h),{screen:v,setScreen:y,select:b}=Ng({route:i,onRoute:e.onRoute,wide:s,shown:_,run:g}),x={runs:t,query:l,onQuery:u,filters:d,onFilters:f,scope:o,onScope:e.onScope,repository:a,repositoryPaths:e.repositoryPaths},S=Jf(l,d,o);if(n&&t.length===0)return(0,U.jsx)(Cp,{onRoute:e.onRoute});let C=g?nf(g).find(e=>e.slug===i.group)??rf(g):null,w=(0,U.jsx)(pg,{...e,run:g,onSelect:b}),T=n?(0,U.jsx)(xp,{filterProps:x,count:S,wide:s}):null,E=(0,U.jsx)(Ag,{...x,loaded:n,run:g,group:C?.slug??null,now:e.now,onSelect:b,history:e.history});return s?(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[c&&n?(0,U.jsx)(Sp,{filterProps:x,count:S,collapsed:p,onCollapsed:m}):null,(0,U.jsxs)(`aside`,{"data-runs-list":!0,style:{width:c&&p?Pg:320},className:`flex shrink-0 flex-col gap-2 overflow-y-auto border-r p-3`,children:[c?null:T,E]}),(0,U.jsx)(`main`,{className:`flex min-w-0 flex-1 flex-col overflow-y-auto`,children:w})]}):v===`detail`&&(g||r===`loading`||r===`missing`)?(0,U.jsx)(Yf,{onBack:()=>y(`list`),children:w}):(0,U.jsxs)(`div`,{className:`flex flex-col gap-2 p-3`,children:[T,E]})}function Ig({panel:e,actions:t}){let{state:n,chrome:r,route:i,scopedApi:a}=e,{runs:o,queue:s,selected:c}=n,l={api:a,runs:o,route:i,onRoute:e.setRoute,pageKey:c??``,dirty:r.dirty},{queueDrafts:u,onQueueDraft:d}=r.drafts;switch(i.view){case`queue`:return(0,U.jsx)(kf,{common:l,queue:s,now:r.now,drafts:u,onDraft:d,onQueue:n.setQueue,onError:xe,onNewTask:r.newTask.openNewTask});case`settings`:return(0,U.jsx)(jf,{common:l,streamedObservers:n.streamedObservers,streamedNetwork:n.streamedNetwork,repository:c,repositories:n.repositories,onSelectRepository:e=>void t.selectRepository(e),registry:n.registry,onRegistry:n.setRegistry,onProjectMoved:t.projectMoved,onRemoveProject:t.removeRepository,onOpenProject:(e,n)=>void t.openProject(e,n),queue:s,onQueue:n.setQueue,onError:xe});case`stats`:return(0,U.jsx)(Af,{common:l,registry:n.registry});case`pipelines`:case`specialists`:return(0,U.jsx)(Mf,{common:l});default:return(0,U.jsx)(Fg,{api:e.api,runs:o,loaded:n.loaded,openedState:n.openedState,route:i,now:r.now,drafts:r.drafts.drafts,onDraft:r.drafts.onDraft,onClearDrafts:r.drafts.onClearDrafts,onError:xe,onlyReplies:e.onlyReplies,onOnlyReplies:e.setOnlyReplies,onRoute:e.setRoute,repository:c,repositoryPaths:e.repositoryPaths,scope:e.scope,onScope:e.setScope,onSubtask:s?r.newTask.openSubtask:void 0,history:n.history})}}function Lg(e,t){return e!==null&&JSON.stringify(e)===JSON.stringify(t)?e:t}function Rg(e){let t=e=>e.state===`queued`?e.finishedAt===null?3:2:!e.finished&&e.hold!==null?1:e.finished?e.finishedAt===null?3:2:0,n=(e,t)=>e.id<t.id?-1:+(e.id>t.id);return[...e].sort((e,r)=>{let i=t(e);if(i!==t(r))return i-t(r);if(i===0){let t=e=>e.state===`needs_human`?0:1;if(t(e)!==t(r))return t(e)-t(r);let i=e=>e.startedAt===null;if(i(e)!==i(r))return i(e)?-1:1;let a=e=>i(e)?e.createdAt:e.startedAt??e.createdAt;return a(r)-a(e)||r.createdAt-e.createdAt||n(e,r)}return i===2?(r.finishedAt??0)-(e.finishedAt??0)||r.createdAt-e.createdAt||n(e,r):r.createdAt-e.createdAt||n(e,r)})}function zg(e,t){let n=new Map,r=t.length!==e.size;for(let i of t){let t=e.get(i.id);t&&JSON.stringify(t)===JSON.stringify(i)?n.set(i.id,t):(n.set(i.id,i),r=!0)}return r?n:e}function Bg(e,t){let n=e.get(t.id);return n&&JSON.stringify(n)===JSON.stringify(t)?e:new Map(e).set(t.id,t)}function Vg(e,t){let n=e.get(t.repository);return n&&JSON.stringify(n)===JSON.stringify(t)?e:new Map(e).set(t.repository,t)}function Hg(e,t){return JSON.stringify(e)===JSON.stringify(t)?e:t}function Ug(e,t,n){if(n===null)return e;let r=[...e.filter(e=>e.repository!==n),...t.filter(e=>e.repository===n)];return r.sort((e,t)=>e.repository.localeCompare(t.repository,`en`)),Hg(e,r)}function Wg(e,t){return JSON.stringify(e)===JSON.stringify(t)?e:t}function Gg(e,t,n){t.setDaemon(e.daemon??null),t.setLoaded(!0);let r=e.runs;t.setRuns(e=>zg(e,r)),n(r);let i=e.tags;i&&t.setTags(e=>Hg(e,i));let a=e.repositories;a&&t.setRegistry(e=>Wg(e,a));let o=e.queues??[];o.length>0&&t.setQueues(e=>o.reduce((e,t)=>Vg(e,t),e))}function Kg(e,t){t.setRuns(t=>Bg(t,e)),t.setExtra(t=>t.has(e.id)?Bg(t,e):t),t.setHistory(t=>t.has(e.id)?Bg(t,e):t)}function qg(e,t,n){switch(e.event){case`daemon`:t.setDaemon(e.daemon);return;case`snapshot`:Gg(e,t,n);return;case`tags`:{let n=e.tags;t.setTags(e=>Hg(e,n));return}case`repositories`:{let n=e.repositories;t.setRegistry(e=>Wg(e,n));return}case`processes`:{let n=e.processes??null;t.setStreamedProcesses({processes:n,error:e.error??null});return}case`network`:t.setStreamedNetwork(e.network);return;case`queue`:{let n=e.queue;t.setQueues(e=>Vg(e,n));return}case`run`:Kg(e.run,t)}}function Jg(e,t,n){if(e.event===`observers`){let n=ct(e.observers??e);n&&t.setStreamedObservers(e=>Lg(e,n))}else Rd(e)&&qg(e,t,n)}function Yg({api:e,set:t,refs:n,closed:r},i){let a=n.opened.current;a!==null&&n.extra.current.has(a)&&!i.some(e=>e.id===a)&&e.run(a).then(e=>{r()||t.setExtra(t=>Bg(t,e))}).catch(()=>{})}async function Xg({api:e,set:t,closed:n}){try{let r=await e.queue();if(n())return;t.setHome(r.repository),t.setQueues(e=>Vg(e,r))}catch{}}async function Zg({api:e,set:t,refs:n,closed:r}){let i=await e.tags();if(r())return;t.setTags(e=>Ug(e,i,n.home.current));let a=n.wanted.current;if(a!==null&&a!==n.home.current){let n=await e.forRepository(a).tags();if(r())return;t.setTags(e=>Ug(e,n,a))}}async function Qg(e){let{api:t,set:n,closed:r}=e;try{let i=await t.runs();if(r())return;n.setRuns(e=>zg(e,i)),n.setLoaded(!0),Yg(e,i);let a=await t.repositories();if(r())return;n.setRegistry(e=>Wg(e,a)),await Zg(e)}catch{}await Xg(e)}function $g(e,t,n,r){let i=!1,a={api:e,set:n,refs:r,closed:()=>i};Xg(a);let o=Hd(()=>Qg(a),()=>n.setConnection(`polling`),a.closed),s=t(`/api/events`);return Ud(s,o,{live:()=>n.setConnection(`live`),event:e=>Jg(e,n,e=>Yg(a,e)),broken:()=>n.setConnection(e=>e===`polling`?e:`reconnecting`)}),()=>{i=!0,o.stop(),s.close()}}var e_={cursor:void 0,loading:!1,error:null};function t_(e,t,n){let[r,i]=(0,L.useState)(new Map),a=(0,L.useRef)(r),o=n??``,s=(0,L.useCallback)((e,t)=>{let n=new Map(a.current);n.set(e,{...n.get(e)??e_,...t}),a.current=n,i(n)},[]),c=(0,L.useCallback)(()=>{if(n===void 0)return;let r=a.current.get(o)??e_;r.loading||r.cursor===null||(s(o,{loading:!0,error:null}),e.finishedRuns(r.cursor,n??void 0).then(e=>{t(t=>e.runs.reduce((e,t)=>Bg(e,t),t)),s(o,{cursor:e.next,loading:!1})}).catch(e=>{s(o,{loading:!1,error:e instanceof Error?e.message:String(e)})}))},[e,t,n,o,s]),l=r.get(o)??e_;return(0,L.useMemo)(()=>({loading:l.loading||n===void 0,error:l.error,done:l.cursor===null,loadMore:c}),[l,c,n])}function n_(e,{runs:t,extra:n,history:r,loaded:i},a,o,s){let[c,l]=(0,L.useState)(new Set),u=(0,L.useRef)(new Set),d=(0,L.useRef)(s);d.current=s;let f=o!==null&&t.has(o),p=o!==null&&(f||n.has(o)||r.has(o)),m=o!==null&&c.has(o);return(0,L.useEffect)(()=>{!i||o===null||p||m||u.current.has(o)||(u.current.add(o),e.run(o).then(e=>a(t=>Bg(t,e))).catch(e=>{e instanceof Je&&e.status===404?l(e=>new Set(e).add(o)):d.current(e instanceof Error?e.message:String(e))}).finally(()=>u.current.delete(o)))},[e,i,o,p,m,a]),o===null?null:p?`listed`:m?`missing`:i?`loading`:null}function r_(e,t){let[n,r]=(0,L.useState)(null),[i,a]=(0,L.useState)(null),[o,s]=(0,L.useState)(null),[c,l]=(0,L.useState)(new Map),[u,d]=(0,L.useState)(new Map),[f,p]=(0,L.useState)([]),[m,h]=(0,L.useState)(null),[g,_]=(0,L.useState)(`reconnecting`),[v,y]=(0,L.useState)(!1),[b,x]=(0,L.useState)(null),[S,C]=(0,L.useState)([]),[w,T]=(0,L.useState)(new Map),[E,D]=(0,L.useState)(new Map),O={opened:(0,L.useRef)(e),extra:(0,L.useRef)(w),home:(0,L.useRef)(m),wanted:(0,L.useRef)(t)};return O.opened.current=e,O.extra.current=w,O.home.current=m,O.wanted.current=t,{state:{runs:c,queues:u,registry:f,home:m,connection:g,loaded:v,daemon:b,tags:S,extra:w,history:E,streamedObservers:n,streamedProcesses:i,streamedNetwork:o},set:{setRuns:l,setQueues:d,setRegistry:p,setHome:h,setLoaded:y,setDaemon:x,setTags:C,setExtra:T,setHistory:D,setStreamedObservers:r,setStreamedProcesses:a,setStreamedNetwork:s,setConnection:_},refs:O}}function i_(e,{home:t,registry:n,queues:r},i,a){let o=(0,L.useMemo)(()=>(ne(n),re(t,n)),[t,n]),s=t===null||o.includes(t)?t:ee(n)??t,c=a!==null&&o.includes(a)?a:s,l=c?r.get(c)??null:null,u=c!==null&&c!==t&&l===null;return(0,L.useEffect)(()=>{if(!u||c===null)return;let t=!1;return e.forRepository(c).queue().then(e=>{t||i(t=>Vg(t,e))}).catch(()=>{}),()=>{t=!0}},[e,u,c,i]),{repositories:o,selected:c,queue:l}}function a_(e,t=Id,n=null,r=null,i=()=>void 0,a=!1){let{state:o,set:s,refs:c}=r_(r,n);(0,L.useEffect)(()=>$g(e,t,s,c),[e,t]);let l=n_(e,o,s.setExtra,r,i),u=i_(e,o,s.setQueues,n),d=t_(e,s.setHistory,a?u.selected??void 0:null),{runs:f,extra:p,history:m}=o,h=(0,L.useMemo)(()=>{let e=new Map(p);for(let[t,n]of m)e.set(t,n);for(let[t,n]of f)e.set(t,n);return Rg(e.values())},[f,p,m]),g=(0,L.useMemo)(()=>new Set(f.keys()),[f]),_=(0,L.useCallback)(e=>{s.setQueues(t=>Vg(t,e))},[]),v=(0,L.useCallback)((e,t)=>{s.setTags(n=>Ug(n,t,e))},[]),y=(0,L.useCallback)(e=>{s.setRegistry(t=>Wg(t,e))},[]);return{...u,...o,runs:h,listedRuns:g,openedState:l,history:d,setRegistry:y,setQueue:_,setTags:v}}var o_=[`needs_human`,`failed`,`conflict`,`apply_failed`];function s_(e){return(e??``).split(`
21
+ `).find(e=>e.trim()!==``)?.trim()??``}function c_(e){let t=[];return(e.status===`needs_human`||e.status===`failed`||e.status===`conflict`)&&t.push(e.status),e.delivery===`apply_failed`&&t.push(`apply_failed`),t}function l_(e){let t=[];for(let n of e)it(n)||n.groups.forEach((e,r)=>{for(let i of c_(e)){let a=i===`needs_human`?e.question:e.reason;t.push({item:{key:`${n.id}/${e.slug}/${i}`,kind:i,runId:n.id,runTitle:n.title||n.name||n.id,repository:n.repository,slug:e.slug,groupTitle:e.title,detail:s_(a),humanOnly:i===`needs_human`?e.humanOnly??null:null,createdAt:n.createdAt},order:o_.indexOf(i),position:r})}});return t.sort((e,t)=>e.order-t.order||t.item.createdAt-e.item.createdAt||e.position-t.position).map(({item:e})=>e)}function u_(e){let t=new Set;for(let n of e)for(let e of n.groups)for(let r of c_(e))t.add(`${n.id}/${e.slug}/${r}`);return t}function d_(e,t){let n=new Set(t.map(e=>e.id)),r=u_(t),i=e.filter(e=>{let t=e.slice(0,Math.max(e.indexOf(`/`),0));return!n.has(t)||r.has(e)});return i.length>1e3?i.slice(-1e3):i}function f_(){if(typeof Notification>`u`||typeof window<`u`&&window.isSecureContext===!1)return`unsupported`;let e=Notification.permission;return e===`granted`||e===`denied`?e:`default`}function p_(e,t,n,r,a){let o=(0,L.useRef)(null),s=(0,L.useRef)(a);s.current=a;let c=(0,L.useRef)(r);c.current=r;let l=(0,L.useRef)(n);l.current=n,(0,L.useEffect)(()=>{if(!t)return;let n=o.current;if(o.current=new Set(e.map(e=>e.key)),n!==null&&f_()===`granted`)for(let t of e){if(n.has(t.key)||l.current.has(t.key)||c.current!==null&&!c.current.has(t.runId))continue;let e=su(t.kind,i.t).label,r=t.humanOnly?`${e} · ${i.t(`runs.humanOnly.${t.humanOnly}`)}`:e,a=new Notification(`aip: ${t.groupTitle}`,{body:t.detail?`${r} · ${t.detail}`:r,tag:t.key});a.onclick=()=>{window.focus(),s.current(t),a.close()}}},[t,e])}function m_(e,t,n=!0,r=null){let[i,a]=P(`notificationsRead`,[],{shared:!0}),[o,s]=P(`notificationsHidden`,[],{shared:!0}),[c,l]=(0,L.useState)(f_),u=(0,L.useMemo)(()=>l_(e),[e]),d=(0,L.useMemo)(()=>new Set(o),[o]),f=(0,L.useMemo)(()=>new Set(i),[i]),p=(0,L.useMemo)(()=>u.filter(e=>!d.has(e.key)),[u,d]),m=p.filter(e=>!f.has(e.key));(0,L.useEffect)(()=>{if(!n)return;let t=d_(i,e);t.length!==i.length&&a(t);let r=d_(o,e);r.length!==o.length&&s(r)},[n,e,i,o,a,s]),p_(u,n,d,r,t);let h=(0,L.useCallback)(()=>{l(f_());let e=[...new Set([...i,...p.map(e=>e.key)])];e.length!==i.length&&a(e)},[i,p,a]),g=(0,L.useCallback)(()=>{typeof Notification<`u`&&Notification.requestPermission().then(()=>l(f_()),()=>l(f_()))},[]),_=(0,L.useCallback)(e=>s([...new Set([...o,e])]),[o,s]),v=(0,L.useCallback)(()=>s([...new Set([...o,...p.map(e=>e.key)])]),[o,p,s]),y=(0,L.useCallback)(e=>f.has(e.key),[f]);return{items:p,unread:m.length,unreadTone:m.some(e=>e.kind===`needs_human`)?`warn`:`err`,isRead:y,permission:c,open:h,enable:g,hide:_,hideAll:v,select:t}}function h_(){let[e,t]=(0,L.useState)({}),[n,r]=(0,L.useState)({});return{drafts:e,queueDrafts:n,onDraft:(0,L.useCallback)((e,n)=>{t(t=>({...t,[e]:n}))},[]),onClearDrafts:(0,L.useCallback)(e=>{t(t=>Object.fromEntries(Object.entries(t).filter(([t])=>t!==e&&!t.startsWith(`${e}/`))))},[]),onQueueDraft:(0,L.useCallback)((e,t)=>{r(n=>{if(t!==null)return{...n,[e]:t};let{[e]:r,...i}=n;return i})},[])}}function g_(){let[e,t]=(0,L.useState)(!1),[n,r]=(0,L.useState)(!1),[i,a]=(0,L.useState)(null),o=(0,L.useCallback)(e=>{a(e),r(!0),t(!0)},[]);return{open:e,setOpen:t,opened:n,preset:i,setPreset:a,openNewTask:(0,L.useCallback)(()=>o(null),[o]),openSubtask:(0,L.useCallback)(e=>o({repository:e.repository,parent:e.id}),[o])}}function __(){return Qs(window.location.hash)}function v_(e){let t=$s(e);window.location.hash!==t&&window.history.replaceState(null,``,`${window.location.pathname}${t}`)}function y_(){let[e,t]=(0,L.useState)(__),n=(0,L.useRef)(null);return(0,L.useEffect)(()=>{let e=()=>t(__());return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[]),(0,L.useEffect)(()=>v_(e),[e]),(0,L.useEffect)(()=>{e.view===`runs`&&e.run&&(n.current=e.run)},[e]),{route:e,setRoute:t,lastRun:n}}function b_(){let[e,t]=(0,L.useState)(()=>Date.now());return(0,L.useEffect)(()=>{let e=setInterval(()=>t(Date.now()),1e3);return()=>clearInterval(e)},[]),e}function x_(e){let t=(0,L.useRef)(!1);(0,L.useEffect)(()=>{t.current=!1},[e]);let[n,r]=(0,L.useState)(!1),[i,a]=(0,L.useState)(!1);return Os(`mod+k`,e=>{e.preventDefault(),r(e=>!e)}),Os(`?`,()=>a(!0)),{dirty:t,palette:n,setPalette:r,shortcuts:i,setShortcuts:a,newTask:g_(),drafts:h_(),now:b_()}}function S_(e,t,n,r,i,a){let o=t.find(e=>e.repository===n);(0,L.useEffect)(()=>{e.view===`runs`&&e.run===null&&o&&r(e=>({...e,run:o.id}))},[e.view,e.run,o,r]);let s=e.view===`runs`&&e.run?t.find(t=>t.id===e.run)?.repository??null:null,c=s!==null&&!a(s)?s:null;(0,L.useEffect)(()=>{c!==null&&c!==n&&i(c)},[c,n,i])}function C_(e,t){let[n,r]=P(`repository`,null),[i,a]=P(`runs.scope`,`repository`),[o,s]=P(`onlyReplies`,!1),{route:c,setRoute:l,lastRun:u}=y_(),d=a_(e,t,n,c.view===`runs`?c.run:null,xe,i===`repository`),{runs:f,selected:p,registry:m}=d,h=x_(c.view);S_(c,f,p,l,r,(0,L.useMemo)(()=>{let e=new Set(m.filter(e=>!e.enabled).map(e=>e.path));return t=>e.has(t)},[m]));let g=m_(f,e=>l({view:`runs`,run:e.runId,group:e.slug,step:null,tab:null}),d.loaded,d.listedRuns);return{api:e,scopedApi:(0,L.useMemo)(()=>e.forRepository(p),[e,p]),chosen:n,setChosen:r,scope:i,setScope:a,onlyReplies:o,setOnlyReplies:s,route:c,setRoute:l,lastRun:u,state:d,chrome:h,notifications:g,waitingRepositories:(0,L.useMemo)(()=>w(m),[m]),repositoryPaths:(0,L.useMemo)(()=>x(m),[m])}}function w_(e,t,n){if(e===t.view)return t;let r=(t,n=null)=>({view:e,run:t,group:n,step:null,tab:null});return e===`settings`?r(`general`,`global`):r(e===`runs`?n:null)}function T_(e,t){let{route:n,setRoute:r,scope:i,chrome:a}=e,{runs:o,selected:s,queue:c}=e.state,{working:l,waiting:u}=qf(Vf(o,i===`repository`?s:null));return{view:n.view,hrefFor:t=>$s(w_(t,n,e.lastRun.current)),onNavigate:t=>{r(w_(t,n,e.lastRun.current))},repository:{repositories:e.state.repositories,paths:e.repositoryPaths,selected:s,waiting:e.waitingRepositories,onSelect:e=>void t.selectRepository(e),onAdd:t.addRepository,browse:e.api.directories},working:l,waiting:u,queued:c?.items.length??0,onPalette:()=>a.setPalette(!0),onNewTask:c?a.newTask.openNewTask:void 0,notifications:e.notifications}}var E_={view:`runs`,run:null,group:null,step:null,tab:null};function D_(e){let{api:t,route:n,setRoute:r,chosen:i,setChosen:a,lastRun:o}=e,{selected:s,registry:c,setRegistry:l}=e.state,{dirty:u}=e.chrome,{t:d}=N(),f=ke(),p=(0,L.useRef)({chosen:i,selected:s});p.current={chosen:i,selected:s};let m=()=>{u.current=!1,o.current=null},h=async e=>e===s?!0:u.current&&!await f({title:d(`settings.editor.leaveTitle`),description:d(`settings.editor.leaveDescription`),confirmLabel:d(`settings.editor.leave`),cancelLabel:d(`settings.editor.stay`),destructive:!0})?!1:(m(),a(e),n.view===`runs`&&r(E_),!0);return{selectRepository:h,addRepository:async e=>{let n=await t.addRepository(e);l(n);let r=te(e,c,n)?.path;r&&await h(r)},removeRepository:async i=>{let o=O(i);if(!await f({title:d(`nav.repositoryRemoveTitle`,{name:o}),description:d(`nav.repositoryRemoveDescription`),confirmLabel:d(`nav.repositoryRemove`),destructive:!0}))return!1;let s;try{s=await t.removeRepository(i)}catch(e){return xe(e),!1}return l(s),(i===p.current.selected||i===p.current.chosen)&&(m(),a(e.state.home===null?ee(s):null),n.view===`runs`&&r(E_)),!0},projectMoved:(e,t)=>{(p.current.chosen===e||p.current.selected===e)&&a(t)},openProject:async(e,t)=>{await h(e)&&r(t===`queue`?{view:`queue`,run:null,group:null,step:null,tab:null}:{view:`settings`,run:`general`,group:`project`,step:null,tab:null})}}}function O_(e){return(0,U.jsx)(Ee,{children:(0,U.jsx)(k_,{...e})})}function k_({api:e,openStream:t=Id}){let{t:n}=N(),r=C_(e,t),{state:i,route:a,setRoute:o}=r,s=D_(r),c=T_(r,s);return(0,U.jsx)(qd,{tags:i.tags,onTags:i.setTags,children:(0,U.jsxs)(Yu,{footer:(0,U.jsx)(Fd,{runs:i.runs,selected:i.selected,connection:i.connection,streamedProcesses:i.streamedProcesses,api:e,onOpenGroup:e=>o({view:`runs`,run:e.runId,group:e.group,step:e.step,tab:null})}),nav:c,children:[(0,U.jsx)(Pf,{panel:r}),(0,U.jsx)(Xu,{daemon:i.daemon}),(0,U.jsx)(`h1`,{className:`sr-only`,children:_s(a.view,n)}),(0,U.jsx)(Ig,{panel:r,actions:s})]})})}var A_=new URL(window.location.href);A_.searchParams.has(`token`)&&(A_.searchParams.delete(`token`),window.history.replaceState(null,``,`${A_.pathname}${A_.search}${A_.hash}`)),Ru(),Du();var j_=document.getElementById(`root`);j_&&(0,qe.createRoot)(j_).render((0,U.jsx)(L.StrictMode,{children:(0,U.jsx)(O_,{api:yt})}));export{rl as $,zu as A,wa as At,Kl as B,Jd as C,_o as Ct,gd as D,Ma as Dt,vd as E,Ha as Et,Bl as F,fa as Ft,gl as G,El as H,zl as I,q as It,pl as J,hl as K,Rl as L,Y as Lt,fu as M,ba as Mt,cu as N,va as Nt,_d as O,Oa as Ot,Ql as P,ma as Pt,fl as Q,Vl as R,J as Rt,Qd as S,Vo as St,hd as T,Ka as Tt,bl as U,Dl as V,ml as W,dl as X,Z as Y,Q as Z,of as _,ls as _t,Ap as a,sc as at,Yd as b,Go as bt,pp as c,Is as ct,np as d,Ps as dt,il as et,ip as f,Gs as ft,bf as g,ds as gt,Xf as h,hs as ht,Np as i,sl as it,ju as j,Sa as jt,cd as k,Ea as kt,up as l,zs as lt,ap as m,Ms as mt,Hh as n,ol as nt,vp as o,Xs as ot,tp as p,Bs as pt,ll as q,tm as r,al as rt,gp as s,$s as st,Kh as t,cl as tt,rp as u,Fs as ut,af as v,Zo as vt,$ as w,no as wt,Xd as x,Uo as xt,Zd as y,qo as yt,Hl as z,Je as zt};