@open-mercato/cezar 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (294) hide show
  1. package/README.md +3 -2
  2. package/dist/agent-config/catalog.d.ts +4 -0
  3. package/dist/agent-config/catalog.js +85 -3
  4. package/dist/agent-config/catalog.js.map +1 -1
  5. package/dist/agent-config/model-settings/copilot.d.ts +15 -0
  6. package/dist/agent-config/model-settings/copilot.js +25 -0
  7. package/dist/agent-config/model-settings/copilot.js.map +1 -0
  8. package/dist/agent-config/model-settings/junie.d.ts +12 -0
  9. package/dist/agent-config/model-settings/junie.js +18 -0
  10. package/dist/agent-config/model-settings/junie.js.map +1 -0
  11. package/dist/agent-config/models.js +4 -0
  12. package/dist/agent-config/models.js.map +1 -1
  13. package/dist/automations/prompts.d.ts +2 -2
  14. package/dist/automations/prompts.js +1 -1
  15. package/dist/automations/types.d.ts +12 -0
  16. package/dist/config.d.ts +4 -0
  17. package/dist/config.js +2 -0
  18. package/dist/config.js.map +1 -1
  19. package/dist/contract/agent-config.d.ts +4 -0
  20. package/dist/contract/agent-profiles.d.ts +30 -0
  21. package/dist/contract/automations.d.ts +32 -0
  22. package/dist/contract/dashboard-insights.d.ts +186 -0
  23. package/dist/contract/dashboard.d.ts +88 -0
  24. package/dist/contract/dispatch.d.ts +6 -0
  25. package/dist/contract/health.d.ts +8 -0
  26. package/dist/contract/index.d.ts +2 -0
  27. package/dist/contract/index.js +249 -72
  28. package/dist/contract/runs.d.ts +144 -0
  29. package/dist/contract/self-update.d.ts +111 -2
  30. package/dist/contract/skills.d.ts +19 -0
  31. package/dist/contract/star-count.d.ts +18 -0
  32. package/dist/contract/workflows.d.ts +12 -0
  33. package/dist/contract/workspace.d.ts +42 -2
  34. package/dist/core/acp-client.d.ts +99 -0
  35. package/dist/core/acp-client.js +198 -0
  36. package/dist/core/acp-client.js.map +1 -0
  37. package/dist/core/acp-ui-mapper.d.ts +95 -0
  38. package/dist/core/acp-ui-mapper.js +444 -0
  39. package/dist/core/acp-ui-mapper.js.map +1 -0
  40. package/dist/core/agent-env.js +10 -0
  41. package/dist/core/agent-env.js.map +1 -1
  42. package/dist/core/agent-profiles.d.ts +10 -0
  43. package/dist/core/agent-profiles.js +16 -0
  44. package/dist/core/agent-profiles.js.map +1 -1
  45. package/dist/core/agent-runner.d.ts +5 -3
  46. package/dist/core/agent-runner.js +5 -3
  47. package/dist/core/agent-runner.js.map +1 -1
  48. package/dist/core/backend-detect.d.ts +3 -3
  49. package/dist/core/backend-detect.js +61 -2
  50. package/dist/core/backend-detect.js.map +1 -1
  51. package/dist/core/claude-cli-runner.d.ts +5 -2
  52. package/dist/core/claude-cli-runner.js +11 -6
  53. package/dist/core/claude-cli-runner.js.map +1 -1
  54. package/dist/core/claude-ui-mapper.d.ts +14 -0
  55. package/dist/core/claude-ui-mapper.js +102 -11
  56. package/dist/core/claude-ui-mapper.js.map +1 -1
  57. package/dist/core/codex-app-server-transport.js +8 -4
  58. package/dist/core/codex-app-server-transport.js.map +1 -1
  59. package/dist/core/copilot-acp-runner.d.ts +60 -0
  60. package/dist/core/copilot-acp-runner.js +528 -0
  61. package/dist/core/copilot-acp-runner.js.map +1 -0
  62. package/dist/core/copilot-ui-mapper.d.ts +47 -0
  63. package/dist/core/copilot-ui-mapper.js +111 -0
  64. package/dist/core/copilot-ui-mapper.js.map +1 -0
  65. package/dist/core/cursor-agent-runner.js +4 -4
  66. package/dist/core/cursor-agent-runner.js.map +1 -1
  67. package/dist/core/disclaim-spawn.d.ts +9 -0
  68. package/dist/core/disclaim-spawn.js +53 -0
  69. package/dist/core/disclaim-spawn.js.map +1 -0
  70. package/dist/core/junie-acp-transport.d.ts +58 -0
  71. package/dist/core/junie-acp-transport.js +179 -0
  72. package/dist/core/junie-acp-transport.js.map +1 -0
  73. package/dist/core/junie-auth-probe.d.ts +12 -0
  74. package/dist/core/junie-auth-probe.js +30 -0
  75. package/dist/core/junie-auth-probe.js.map +1 -0
  76. package/dist/core/junie-model-catalog.d.ts +10 -0
  77. package/dist/core/junie-model-catalog.js +104 -0
  78. package/dist/core/junie-model-catalog.js.map +1 -0
  79. package/dist/core/junie-runner.d.ts +45 -0
  80. package/dist/core/junie-runner.js +533 -0
  81. package/dist/core/junie-runner.js.map +1 -0
  82. package/dist/core/junie-ui-mapper.d.ts +132 -0
  83. package/dist/core/junie-ui-mapper.js +459 -0
  84. package/dist/core/junie-ui-mapper.js.map +1 -0
  85. package/dist/core/model-identity.js +17 -0
  86. package/dist/core/model-identity.js.map +1 -1
  87. package/dist/core/model-presets.js +10 -0
  88. package/dist/core/model-presets.js.map +1 -1
  89. package/dist/core/opencode-server-runner.js +4 -4
  90. package/dist/core/opencode-server-runner.js.map +1 -1
  91. package/dist/core/pi-runner.js +4 -4
  92. package/dist/core/pi-runner.js.map +1 -1
  93. package/dist/core/provider-auth.d.ts +16 -2
  94. package/dist/core/provider-auth.js +113 -7
  95. package/dist/core/provider-auth.js.map +1 -1
  96. package/dist/core/runner-factory.js +6 -0
  97. package/dist/core/runner-factory.js.map +1 -1
  98. package/dist/core/runner-model-catalog.js +12 -8
  99. package/dist/core/runner-model-catalog.js.map +1 -1
  100. package/dist/core/tool-display.js +6 -1
  101. package/dist/core/tool-display.js.map +1 -1
  102. package/dist/core/ui-events.d.ts +6 -2
  103. package/dist/git-diff-base.js +23 -2
  104. package/dist/git-diff-base.js.map +1 -1
  105. package/dist/git-worktree.d.ts +21 -2
  106. package/dist/git-worktree.js +68 -5
  107. package/dist/git-worktree.js.map +1 -1
  108. package/dist/index.js +14 -4
  109. package/dist/index.js.map +1 -1
  110. package/dist/paths.js +2 -0
  111. package/dist/paths.js.map +1 -1
  112. package/dist/runs/event-history.js +3 -0
  113. package/dist/runs/event-history.js.map +1 -1
  114. package/dist/runs/store.d.ts +42 -3
  115. package/dist/runs/store.js +112 -6
  116. package/dist/runs/store.js.map +1 -1
  117. package/dist/self-update/checkouts.d.ts +53 -0
  118. package/dist/self-update/checkouts.js +268 -0
  119. package/dist/self-update/checkouts.js.map +1 -0
  120. package/dist/self-update/cli.d.ts +5 -3
  121. package/dist/self-update/cli.js +75 -8
  122. package/dist/self-update/cli.js.map +1 -1
  123. package/dist/self-update/layout.d.ts +33 -1
  124. package/dist/self-update/layout.js +102 -3
  125. package/dist/self-update/layout.js.map +1 -1
  126. package/dist/self-update/pulls.d.ts +40 -0
  127. package/dist/self-update/pulls.js +127 -0
  128. package/dist/self-update/pulls.js.map +1 -0
  129. package/dist/self-update/service.d.ts +26 -3
  130. package/dist/self-update/service.js +85 -9
  131. package/dist/self-update/service.js.map +1 -1
  132. package/dist/server/dashboard.d.ts +107 -0
  133. package/dist/server/dashboard.js +2 -1
  134. package/dist/server/dashboard.js.map +1 -1
  135. package/dist/server/forge/github.js +4 -1
  136. package/dist/server/forge/github.js.map +1 -1
  137. package/dist/server/fs-browse.d.ts +3 -1
  138. package/dist/server/fs-browse.js +27 -5
  139. package/dist/server/fs-browse.js.map +1 -1
  140. package/dist/server/open-in-app.js +2 -0
  141. package/dist/server/open-in-app.js.map +1 -1
  142. package/dist/server/provider-action-gate.js +5 -1
  143. package/dist/server/provider-action-gate.js.map +1 -1
  144. package/dist/server/server.d.ts +880 -511
  145. package/dist/server/server.js +40 -5
  146. package/dist/server/server.js.map +1 -1
  147. package/dist/server/star-count.d.ts +67 -0
  148. package/dist/server/star-count.js +186 -0
  149. package/dist/server/star-count.js.map +1 -0
  150. package/dist/skills-banner.d.ts +19 -0
  151. package/dist/skills-banner.js +24 -0
  152. package/dist/skills-banner.js.map +1 -1
  153. package/dist/workflows/run.d.ts +0 -2
  154. package/dist/workflows/run.js +45 -29
  155. package/dist/workflows/run.js.map +1 -1
  156. package/dist/workflows/types.d.ts +6 -0
  157. package/dist/workspace/agent-accounts.d.ts +9 -1
  158. package/dist/workspace/agent-accounts.js +2 -0
  159. package/dist/workspace/agent-accounts.js.map +1 -1
  160. package/dist/workspace/agent-profiles.d.ts +2 -2
  161. package/dist/workspace/agent-profiles.js +25 -6
  162. package/dist/workspace/agent-profiles.js.map +1 -1
  163. package/dist/workspace/config.d.ts +9 -1
  164. package/dist/workspace/config.js +10 -3
  165. package/dist/workspace/config.js.map +1 -1
  166. package/dist/workspace/dashboard-insights.d.ts +42 -0
  167. package/dist/workspace/dashboard-insights.js +220 -0
  168. package/dist/workspace/dashboard-insights.js.map +1 -0
  169. package/dist/workspace/dashboard.d.ts +71 -1
  170. package/dist/workspace/dashboard.js +14 -1
  171. package/dist/workspace/dashboard.js.map +1 -1
  172. package/dist/workspace/semaphore.d.ts +3 -0
  173. package/dist/workspace/semaphore.js +8 -1
  174. package/dist/workspace/semaphore.js.map +1 -1
  175. package/package.json +3 -3
  176. package/scripts/mock-claude.mjs +34 -1
  177. package/scripts/mock-copilot-acp.mjs +190 -0
  178. package/scripts/mock-junie-acp.mjs +208 -0
  179. package/web/dist/assets/agent-task-pickers-BeQi-UTm.js +1 -0
  180. package/web/dist/assets/alert-dialog-CnRAuqwb.js +1 -0
  181. package/web/dist/assets/arrow-down-Da0kNRNH.js +1 -0
  182. package/web/dist/assets/arrow-left-BIZHhBIP.js +1 -0
  183. package/web/dist/assets/automation-format-CfPmkcsg.js +1 -0
  184. package/web/dist/assets/automations-route-AMJbFP53.js +1 -0
  185. package/web/dist/assets/centered-state-3r2Kaar_.js +1 -0
  186. package/web/dist/assets/chevron-left-DLAUPC66.js +1 -0
  187. package/web/dist/assets/chevron-right-KVZcXiPL.js +1 -0
  188. package/web/dist/assets/{circle-x-C9UoMP1V.js → circle-x-C0Jm5Ppb.js} +1 -1
  189. package/web/dist/assets/collapsible-DG_SIWqU.js +1 -0
  190. package/web/dist/assets/command-Dfln3D4A.js +1 -0
  191. package/web/dist/assets/{commit-list-BSfPsVsu.js → commit-list-_RA72yB_.js} +1 -1
  192. package/web/dist/assets/compare-variants-D6Ji6od4.js +1 -0
  193. package/web/dist/assets/dashboard-B3-tPimG.js +44 -0
  194. package/web/dist/assets/dialog-CiDREdUK.js +1 -0
  195. package/web/dist/assets/{diff-I0xowULh.js → diff-CxdyRumG.js} +2 -2
  196. package/web/dist/assets/diff-controls-DqJMMV4z.js +1 -0
  197. package/web/dist/assets/{diff-stat-yKn7joEr.js → diff-stat-Hupj4hxh.js} +1 -1
  198. package/web/dist/assets/{diff-view-DjvMeW1M.js → diff-view-BBYT5k6c.js} +1 -1
  199. package/web/dist/assets/dist-BqMwqJFX.js +1 -0
  200. package/web/dist/assets/dist-DpiX6WjA.js +1 -0
  201. package/web/dist/assets/{download-BcgZ2yk4.js → download-BR7EN9gW.js} +1 -1
  202. package/web/dist/assets/dropdown-menu-Ci4HFML0.js +1 -0
  203. package/web/dist/assets/editable-title-DDtUgRKZ.js +1 -0
  204. package/web/dist/assets/{ellipsis-vertical-g4O4NlLV.js → ellipsis-vertical-DBklom4U.js} +1 -1
  205. package/web/dist/assets/facet-filter-CfI4QvOd.js +1 -0
  206. package/web/dist/assets/{file-wXNeZwi7.js → file-CZb7cKNH.js} +1 -1
  207. package/web/dist/assets/{file-text-DV1gE2L6.js → file-text-Dm6CrEGW.js} +1 -1
  208. package/web/dist/assets/{folder-wjVId5un.js → folder-zQj-FYOo.js} +1 -1
  209. package/web/dist/assets/{git-pull-request-BBEDdTLK.js → git-pull-request-AhwzJc7s.js} +1 -1
  210. package/web/dist/assets/git-toolbar-j7gKkhGL.js +1 -0
  211. package/web/dist/assets/github-De-DFy8s.js +1 -0
  212. package/web/dist/assets/{image-preview-u1f-wzxC.js → image-preview-Dd3NVB7N.js} +1 -1
  213. package/web/dist/assets/index-HS1hr5Sz.js +12 -0
  214. package/web/dist/assets/index-YwgrLyBj.css +2 -0
  215. package/web/dist/assets/loader-circle-sk4vKJKp.js +1 -0
  216. package/web/dist/assets/{markdown-Bnm47qUl.js → markdown-DjNR-1p8.js} +2 -2
  217. package/web/dist/assets/new-task-form-vLs2G1_z.js +1 -0
  218. package/web/dist/assets/picker-pill-VW-M1ZiV.js +1 -0
  219. package/web/dist/assets/{pill-7dm3vWF7.js → pill-CPl6sysj.js} +1 -1
  220. package/web/dist/assets/popover-CNGONAql.js +1 -0
  221. package/web/dist/assets/project-router-dCZQu1wQ.js +1 -0
  222. package/web/dist/assets/{prompt-templates-BMZ5q5H_.js → prompt-templates-jNjVTAws.js} +1 -1
  223. package/web/dist/assets/{refresh-cw-C69euZ2H.js → refresh-cw-BfkEydKA.js} +1 -1
  224. package/web/dist/assets/repo-git-BZWZ6_pR.js +1 -0
  225. package/web/dist/assets/{run-diff-CoNVGn23.js → run-diff-u_roDsAJ.js} +2 -2
  226. package/web/dist/assets/run-header-Br1yJR0m.js +1 -0
  227. package/web/dist/assets/{search-x-BNLFOxI6.js → search-x-CT0NTqK1.js} +1 -1
  228. package/web/dist/assets/segmented-IDD4ucht.js +1 -0
  229. package/web/dist/assets/skills-Dsi5YdLG.js +1 -0
  230. package/web/dist/assets/{sparkles-ChorK-gZ.js → sparkles-CvOeAoyJ.js} +1 -1
  231. package/web/dist/assets/{square-terminal-C7KCPznz.js → square-terminal-eSs8YYZe.js} +1 -1
  232. package/web/dist/assets/{tab-link-E5O2Cesc.js → tab-link-CPF6ORha.js} +1 -1
  233. package/web/dist/assets/task-changes-DIT9Y1rh.js +1 -0
  234. package/web/dist/assets/task-commits-B4VvdiHH.js +1 -0
  235. package/web/dist/assets/task-files-BMm9C0DW.js +2 -0
  236. package/web/dist/assets/task-thread-RXabJAt0.js +9 -0
  237. package/web/dist/assets/{textarea-DLAfWPb0.js → textarea-DtBqPhIs.js} +1 -1
  238. package/web/dist/assets/thread-loading-Dnxb6Ar-.js +1 -0
  239. package/web/dist/assets/toaster-CfRVb8vH.js +43 -0
  240. package/web/dist/assets/token-metrics-DldVlr6m.js +1 -0
  241. package/web/dist/assets/tooltip-_O50N3pt.js +1 -0
  242. package/web/dist/assets/tracker-J0fdcH1G.js +4 -0
  243. package/web/dist/assets/{trash-2-_vwSMdPG.js → trash-2-CUH7GOVh.js} +1 -1
  244. package/web/dist/assets/{triangle-alert-fBRUkB46.js → triangle-alert-D5K_zyD3.js} +1 -1
  245. package/web/dist/assets/{upload-B4OIpdyq.js → upload-D7_n-9cl.js} +1 -1
  246. package/web/dist/assets/{use-now-sqAvRMna.js → use-now-3lElDuTi.js} +1 -1
  247. package/web/dist/assets/utils-BXvEm7Ve.js +64 -0
  248. package/web/dist/assets/workflows-D-dx9c_0.js +7 -0
  249. package/web/dist/assets/x-kLybIvX4.js +1 -0
  250. package/web/dist/assets/{zoomable-image-X81SApIg.js → zoomable-image-CnyQ9wyw.js} +1 -1
  251. package/web/dist/index.html +38 -36
  252. package/web/dist/assets/agent-task-pickers-DQ1qvgrD.js +0 -1
  253. package/web/dist/assets/alert-dialog-B_2uU4Bg.js +0 -1
  254. package/web/dist/assets/arrow-down-DieVZxSE.js +0 -1
  255. package/web/dist/assets/arrow-left-C8M0efjn.js +0 -1
  256. package/web/dist/assets/automation-format-CzinzpHK.js +0 -1
  257. package/web/dist/assets/automations-route-DYHUjV9R.js +0 -1
  258. package/web/dist/assets/centered-state-DJLgwvA4.js +0 -43
  259. package/web/dist/assets/chevron-left-BhXrOEE3.js +0 -1
  260. package/web/dist/assets/chevron-right-B3Ta8VKK.js +0 -1
  261. package/web/dist/assets/collapsible-BcKvItwg.js +0 -1
  262. package/web/dist/assets/command-BvGGv2_u.js +0 -1
  263. package/web/dist/assets/compare-variants-DBvMYMs3.js +0 -1
  264. package/web/dist/assets/dashboard-CGaFh4RV.js +0 -44
  265. package/web/dist/assets/dialog-B6NgKh0-.js +0 -1
  266. package/web/dist/assets/diff-controls-DskkZqmD.js +0 -1
  267. package/web/dist/assets/dist-BvXEdcbG.js +0 -1
  268. package/web/dist/assets/dist-CTksUkKh.js +0 -1
  269. package/web/dist/assets/dropdown-menu-B7HeKCfN.js +0 -1
  270. package/web/dist/assets/editable-title-BHbHmSIK.js +0 -1
  271. package/web/dist/assets/facet-filter-DZ3wfvN9.js +0 -1
  272. package/web/dist/assets/git-toolbar-EZuX4Cuz.js +0 -1
  273. package/web/dist/assets/github-zcLRxv77.js +0 -1
  274. package/web/dist/assets/index-BrZhA4_u.css +0 -2
  275. package/web/dist/assets/index-CSNFuBvj.js +0 -12
  276. package/web/dist/assets/loader-circle-Cwgo6onL.js +0 -1
  277. package/web/dist/assets/new-task-form-CQODCzBP.js +0 -1
  278. package/web/dist/assets/picker-pill-DNB9ETjS.js +0 -1
  279. package/web/dist/assets/popover-BRq6QnwI.js +0 -1
  280. package/web/dist/assets/project-router-I8Pbsrxy.js +0 -1
  281. package/web/dist/assets/repo-git-G436Abni.js +0 -1
  282. package/web/dist/assets/run-header-CxdaA86t.js +0 -1
  283. package/web/dist/assets/skills-C_kBDesq.js +0 -1
  284. package/web/dist/assets/task-changes-Bhw4Ysvg.js +0 -1
  285. package/web/dist/assets/task-commits-DBuGXuGm.js +0 -1
  286. package/web/dist/assets/task-files-CYDbeffM.js +0 -2
  287. package/web/dist/assets/task-thread-RuxHMJgN.js +0 -9
  288. package/web/dist/assets/thread-loading-BAuVAbcA.js +0 -1
  289. package/web/dist/assets/token-metrics-rVl4kXe_.js +0 -1
  290. package/web/dist/assets/tooltip-Bdl8mQG8.js +0 -1
  291. package/web/dist/assets/tracker-DJ8JW59-.js +0 -4
  292. package/web/dist/assets/utils-DoBmOlX3.js +0 -64
  293. package/web/dist/assets/workflows-C54D7mlm.js +0 -7
  294. package/web/dist/assets/x-HXr9KZBr.js +0 -1
@@ -0,0 +1,43 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n,t as r}from"./react-runtime-CCIEwYL0.js";import{F as i,J as a,R as o,V as s,a as c,c as l,d as u,i as d,o as f,q as p,r as m,s as h,t as g,z as _}from"./utils-BXvEm7Ve.js";import{i as v,r as y}from"./bundle-mjs-BT31bpU6.js";var b=/^[\w!#$%&'*.^`|~+-]+$/,x=(e,t,n={})=>{if(!b.test(e))throw Error(`Invalid cookie name`);let r=`${e}=${t}`;if(e.startsWith(`__Secure-`)&&!n.secure)throw Error(`__Secure- Cookie must have Secure attributes`);if(e.startsWith(`__Host-`)){if(!n.secure)throw Error(`__Host- Cookie must have Secure attributes`);if(n.path!==`/`)throw Error(`__Host- Cookie must have Path attributes with "/"`);if(n.domain)throw Error(`__Host- Cookie must not have Domain attributes`)}for(let e of[`domain`,`path`,`sameSite`,`priority`])if(n[e]&&/[;\r\n]/.test(n[e]))throw Error(`${e} must not contain ";", "\\r", or "\\n"`);if(n&&typeof n.maxAge==`number`&&n.maxAge>=0){if(n.maxAge>3456e4)throw Error(`Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.`);r+=`; Max-Age=${n.maxAge|0}`}if(n.domain&&n.prefix!==`host`&&(r+=`; Domain=${n.domain}`),n.path&&(r+=`; Path=${n.path}`),n.expires){if(n.expires.getTime()-Date.now()>3456e7)throw Error(`Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.`);r+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(r+=`; HttpOnly`),n.secure&&(r+=`; Secure`),n.sameSite&&(r+=`; SameSite=${n.sameSite.charAt(0).toUpperCase()+n.sameSite.slice(1)}`),n.priority&&(r+=`; Priority=${n.priority.charAt(0).toUpperCase()+n.priority.slice(1)}`),n.partitioned){if(!n.secure)throw Error(`Partitioned Cookie must have Secure attributes`);r+=`; Partitioned`}return r},S=(e,t,n)=>(t=encodeURIComponent(t),x(e,t,n)),ee=(e,t)=>(e=e.replace(/\/+$/,``),e+=`/`,t=t.replace(/^\/+/,``),e+t),C=(e,t)=>{for(let[n,r]of Object.entries(t)){let t=RegExp(`/:`+n+`(?:{[^/]+})?\\??`);e=e.replace(t,r?`/${r}`:``)}return e},te=e=>{let t=new URLSearchParams;for(let[n,r]of Object.entries(e))if(r!==void 0)if(Array.isArray(r))for(let e of r)t.append(n,e);else t.set(n,r);return t},ne=(e,t)=>{switch(t){case`ws`:return e.replace(/^http/,`ws`);case`http`:return e.replace(/^ws/,`http`)}},re=e=>/^https?:\/\/[^\/]+?\/index(?=\?|$)/.test(e)?e.replace(/\/index(?=\?|$)/,`/`):e.replace(/\/index(?=\?|$)/,``);function ie(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ae(e,t){if(!ie(e)&&!ie(t))return t;let n={...e};for(let e in t){let r=t[e];ie(n[e])&&ie(r)?n[e]=ae(n[e],r):n[e]=r}return n}var oe=(e,t)=>new Proxy(()=>{},{get(n,r){if(!(typeof r!=`string`||r===`then`))return oe(e,[...t,r])},apply(n,r,i){return e({path:t,args:i})}}),se=class{url;method;buildSearchParams;queryParams=void 0;pathParams={};rBody;cType=void 0;constructor(e,t,n){this.url=e,this.method=t,this.buildSearchParams=n.buildSearchParams}fetch=async(e,t)=>{if(e){if(e.query&&(this.queryParams=this.buildSearchParams(e.query)),e.form){let t=new FormData;for(let[n,r]of Object.entries(e.form))if(r!==void 0)if(Array.isArray(r))for(let e of r)t.append(n,e);else t.append(n,r);this.rBody=t}e.json&&(this.rBody=JSON.stringify(e.json),this.cType=`application/json`),e.param&&(this.pathParams=e.param)}let n=this.method.toUpperCase(),r={...e?.header,...typeof t?.headers==`function`?await t.headers():t?.headers};if(e?.cookie){let t=[];for(let[n,r]of Object.entries(e.cookie))t.push(S(n,r,{path:`/`}));r.Cookie=t.join(`,`)}this.cType&&(r[`Content-Type`]=this.cType);let i=new Headers(r??void 0),a=this.url;a=re(a),a=C(a,this.pathParams),this.queryParams&&(a=a+`?`+this.queryParams.toString()),n=this.method.toUpperCase();let o=!(n===`GET`||n===`HEAD`);return(t?.fetch||fetch)(a,{body:o?this.rBody:void 0,method:n,headers:i,...t?.init})}},ce=(e,t)=>oe(function n(r){let i=t?.buildSearchParams??te,a=[...r.path],o=a.slice(-3).reverse();if(o[0]===`toString`)return o[1]===`name`?o[2]||``:n.toString();if(o[0]===`valueOf`)return o[1]===`name`?o[2]||``:n;let s=``;if(/^\$/.test(o[0])){let e=a.pop();e&&(s=e.replace(/^\$/,``))}let c=ee(e,a.join(`/`));if(s===`url`||s===`path`){let t=c;return r.args[0]&&(r.args[0].param&&(t=C(c,r.args[0].param)),r.args[0].query&&(t=t+`?`+i(r.args[0].query).toString())),t=re(t),s===`url`?new URL(t):t.slice(e.replace(/\/+$/,``).length).replace(/^\/?/,`/`)}if(s===`ws`){let e=ne(r.args[0]&&r.args[0].param?C(c,r.args[0].param):c,`ws`),n=new URL(e),i=r.args[0]?.query;return i&&Object.entries(i).forEach(([e,t])=>{Array.isArray(t)?t.forEach(t=>n.searchParams.append(e,t)):n.searchParams.set(e,t)}),((...e)=>t?.webSocket!==void 0&&typeof t.webSocket==`function`?t.webSocket(...e):new WebSocket(...e))(n.toString())}let l=new se(c,s,{buildSearchParams:i});if(s){t??={};let e={...r.args[1]},n=t.headers,i=e.headers;n&&i&&(e.headers=async()=>({...typeof n==`function`?await n():n,...typeof i==`function`?await i():i}));let a=ae(t,e);return l.fetch(r.args[0],a)}return l},[]);function le(e={}){let{baseUrl:t=``,token:n,headers:r,fetch:i}=e;return ce(t,{headers:{...n?{Authorization:`Bearer ${n}`}:{},...r},...i?{fetch:i}:{}})}var ue=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},de=new class extends ue{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},fe={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},w=new class{#e=fe;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function pe(e){setTimeout(e,0)}var me=typeof window>`u`||`Deno`in globalThis;function T(){}function he(e,t){return typeof e==`function`?e(t):e}function ge(e){return typeof e==`number`&&e>=0&&e!==1/0}function _e(e,t){return Math.max(e+(t||0)-Date.now(),0)}function E(e,t){return typeof e==`function`?e(t):e}function D(e,t){return typeof e==`function`?e(t):e}function ve(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==be(o,t.options))return!1}else if(!Se(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function ye(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(xe(t.options.mutationKey)!==xe(a))return!1}else if(!Se(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function be(e,t){return(t?.queryKeyHashFn||xe)(e)}function xe(e){return JSON.stringify(e,(e,t)=>De(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Se(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>Se(e[n],t[n])):!1}var Ce=Object.prototype.hasOwnProperty;function we(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=Ee(e)&&Ee(t);if(!r&&!(De(e)&&De(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:Ce.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=we(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function Te(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function Ee(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function De(e){if(!Oe(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Oe(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function Oe(e){return Object.prototype.toString.call(e)===`[object Object]`}function ke(e){return new Promise(t=>{w.setTimeout(t,e)})}function Ae(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:we(e,t)}function je(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Me(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Ne=Symbol();function Pe(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Ne?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Fe(e,t){return typeof e==`function`?e(...t):!!e}function Ie(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var Le=(()=>{let e=()=>me;return{isServer(){return e()},setIsServer(t){e=t}}})();function Re(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var ze=pe;function Be(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=ze,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var O=Be(),Ve=new class extends ue{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function He(e){return Math.min(1e3*2**e,3e4)}function Ue(e){return(e??`online`)!==`online`||Ve.isOnline()}var We=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Ge(e){let t=!1,n=0,r,i=Re(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new We(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>de.isFocused()&&(e.networkMode===`always`||Ve.isOnline())&&e.canRun(),u=()=>Ue(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(Le.isServer()?0:3),o=e.retryDelay??He,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),ke(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var Ke=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ge(this.gcTime)&&(this.#e=w.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Le.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(w.clearTimeout(this.#e),this.#e=void 0)}};function qe(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{Ie(e,()=>t.signal,()=>n=!0)},u=Pe(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?Me:je;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?Ye:Je,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Je(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function Je(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Ye(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Xe(e,t){return t?Je(e,t)!=null:!1}function Ze(e,t){return!t||!e.getPreviousPageParam?!1:Ye(e,t)!=null}var Qe=class extends Ke{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=tt(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=tt(this.options);e.data!==void 0&&(this.setState(et(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Ae(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(T).catch(T):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>D(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ne||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>E(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!_e(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=Pe(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?qe(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=Ge({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof We&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof We){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...$e(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...et(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),O.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function $e(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ue(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function et(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function tt(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var nt=class extends ue{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=Re(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),it(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return at(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return at(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof D(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!Te(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&ot(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||D(this.options.enabled,this.#t)!==D(t.enabled,this.#t)||E(this.options.staleTime,this.#t)!==E(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||D(this.options.enabled,this.#t)!==D(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return ct(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(T)),t}#g(){this.#b();let e=E(this.options.staleTime,this.#t);if(Le.isServer()||this.#r.isStale||!ge(e))return;let t=_e(this.#r.dataUpdatedAt,e)+1;this.#d=w.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(Le.isServer()||D(this.options.enabled,this.#t)===!1||!ge(this.#p)||this.#p===0)&&(this.#f=w.setInterval(()=>{(this.options.refetchIntervalInBackground||de.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(w.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(w.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&it(e,t),o=i&&ot(e,n,t,r);(a||o)&&(l={...l,...$e(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=Ae(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=Ae(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:st(e,t),refetch:this.refetch,promise:this.#o,isEnabled:D(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=x.data!==void 0,r=x.status===`error`&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},a=()=>{let e=this.#o=x.promise=Re();i(e)},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||x.data!==o.value)&&a();break;case`rejected`:(!r||x.error!==o.reason)&&a();break}}return x}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!Te(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){O.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function rt(e,t){return D(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&D(t.retryOnMount,e)===!1)}function it(e,t){return rt(e,t)||e.state.data!==void 0&&at(e,t,t.refetchOnMount)}function at(e,t,n){if(D(t.enabled,e)!==!1&&E(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&st(e,t)}return!1}function ot(e,t,n,r){return(e!==t||D(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&st(e,n)}function st(e,t){return D(t.enabled,e)!==!1&&e.isStaleByTime(E(t.staleTime,e))}function ct(e,t){return!Te(e.getCurrentResult(),t)}var lt=class extends nt{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Xe(t,n.data),hasPreviousPage:Ze(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},ut=class extends Ke{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||dt(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=Ge({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),O.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function dt(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var ft=class extends ue{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),Te(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&xe(t.mutationKey)!==xe(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??dt();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){O.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}};function pt(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function mt(e,t,n){let r=e.slice(0);return r[t]=n,r}var ht=class extends ue{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,O.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!Te(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(pt(e,n).forEach(e=>{e.destroy()}),pt(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=we(this.#a,t(e))),this.#a}return e}#f(){return this.#r?.combine!==void 0&&this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new nt(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=mt(this.#t,n,t),this.#h())}#h(){if(this.hasListeners()){let e=this.#u(this.#t,this.#l),t=this.#f(),n=this.#a,r=t?n:this.#d(e,this.#r?.combine);(t||n!==r)&&O.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},k=e(t(),1),A=r(),gt=k.createContext(void 0),j=e=>{let t=k.useContext(gt);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},_t=({client:e,children:t})=>(k.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,A.jsx)(gt.Provider,{value:e,children:t})),vt=k.createContext(!1),yt=()=>k.useContext(vt);vt.Provider;function bt(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var xt=k.createContext(bt()),St=()=>k.useContext(xt),Ct=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?Fe(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},wt=e=>{k.useEffect(()=>{e.clearReset()},[e])},Tt=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Fe(n,[e.error,r])),Et=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Dt=(e,t)=>e.isLoading&&e.isFetching&&!t,Ot=(e,t)=>e?.suspense&&t.isPending,kt=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function At({queries:e,...t},n){let r=j(n),i=yt(),a=St(),o=k.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{Et(e);let t=r.getQueryCache().get(e.queryHash);Ct(e,a,t)}),wt(a);let[s]=k.useState(()=>new ht(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;k.useSyncExternalStore(k.useCallback(e=>d?s.subscribe(O.batchCalls(e)):T,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),k.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>Ot(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&Ot(n,e)?kt(n,new nt(r,n),a):[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&&Tt({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(p?.error)throw p.error;return l(u())}function jt(e,t,n){let r=yt(),i=St(),a=j(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Et(o),Ct(o,i,s),wt(i);let l=!a.getQueryCache().get(o.queryHash),[u]=k.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&c;if(k.useSyncExternalStore(k.useCallback(e=>{let t=f?u.subscribe(O.batchCalls(e)):T;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),k.useEffect(()=>{u.setOptions(o)},[o,u]),Ot(o,d))throw kt(o,u,i);if(Tt({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!Le.isServer()&&Dt(d,r)&&(l?kt(o,u,i):s?.promise)?.catch(T).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function M(e,t){return jt(e,nt,t)}function N(e,t){let n=j(t),[r]=k.useState(()=>new ft(n,e));k.useEffect(()=>{r.setOptions(e)},[r,e]);let i=k.useSyncExternalStore(k.useCallback(e=>r.subscribe(O.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=k.useCallback((e,t)=>{r.mutate(e,t).catch(T)},[r]);if(i.error&&Fe(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function Mt(e,t){return jt(e,lt,t)}var Nt=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Pt=/^[\\/]{2}/;function Ft(e,t){return t+e.replace(/\\/g,`/`)}var It=`popstate`;function Lt(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function Rt(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return Vt(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:Ht(t)}return Wt(t,n,null,e)}function P(e,t){if(e===!1||e==null)throw Error(t)}function F(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function zt(){return Math.random().toString(36).substring(2,10)}function Bt(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Vt(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?Ut(t):t,state:n,key:t&&t.key||r||zt(),mask:i}}function Ht({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function Ut(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function Wt(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=Lt(e)?e:Vt(h.location,e,t);n&&n(r,e),l=u()+1;let d=Bt(r,l),f=h.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=Lt(e)?e:Vt(h.location,e,t);n&&n(r,e),l=u();let i=Bt(r,l),d=h.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return Gt(i,e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(It,d),c=e,()=>{i.removeEventListener(It,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function Gt(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),P(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:Ht(t);return i=i.replace(/ $/,`%20`),!n&&Pt.test(i)&&(i=r+i),new URL(i,r)}function Kt(e,t,n=`/`){return qt(e,t,n,!1)}function qt(e,t,n,r,i){let a=I((typeof t==`string`?Ut(t):t).pathname||`/`,n);if(a==null)return null;let o=i??Yt(e),s=null,c=pn(a);for(let e=0;s==null&&e<o.length;++e)s=ln(o[e],c,r);return s}function Jt(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function Yt(e){let t=Xt(e);return Qt(t),t}function Xt(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;P(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=L([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(P(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),Xt(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:sn(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=fn(e.relativePath,e.caseSensitive,t===u.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of Zt(e.path))a(e,t,!0,n)}),t}function Zt(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=Zt(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function Qt(e){e.sort((e,t)=>e.score===t.score?cn(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var $t=/^:[\w-]+$/,en=3,tn=2,nn=1,rn=10,an=-2,on=e=>e===`*`;function sn(e,t){let n=e.split(`/`),r=n.length;return n.some(on)&&(r+=an),t&&(r+=tn),n.filter(e=>!on(e)).reduce((e,t)=>e+($t.test(t)?en:t===``?nn:rn),r)}function cn(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function ln(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?dn(u,l,s.matcher,s.compiledParams):un(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=un({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:L([a,d.pathname]),pathnameBase:Sn(L([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=L([a,d.pathnameBase]))}return o}function un(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=fn(e.path,e.caseSensitive,e.end);return dn(e,t,n,r)}function dn(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function fn(e,t=!1,n=!0){F(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function pn(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return F(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function I(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function mn(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?Ut(e):e,a;return n?(n=bn(n),a=n.startsWith(`/`)?hn(n.substring(1),`/`):hn(n,t)):a=t,{pathname:a,search:Cn(r),hash:wn(i)}}function hn(e,t){let n=xn(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function gn(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function _n(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function vn(e){let t=_n(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function yn(e,t,n,r=!1){let i;typeof e==`string`?i=Ut(e):(i={...e},P(!i.pathname||!i.pathname.includes(`?`),gn(`?`,`pathname`,`search`,i)),P(!i.pathname||!i.pathname.includes(`#`),gn(`#`,`pathname`,`hash`,i)),P(!i.search||!i.search.includes(`#`),gn(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=mn(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var bn=e=>e.replace(/[\\/]{2,}/g,`/`),L=e=>bn(e.join(`/`)),xn=e=>e.replace(/\/+$/,``),Sn=e=>xn(e).replace(/^\/*/,`/`),Cn=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,wn=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Tn=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function En(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Dn(e){return L(e.map(e=>e.route.path).filter(Boolean))||`/`}var On=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function kn(e,t){let n=e;if(typeof n!=`string`||!Nt.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(On)try{let e=new URL(window.location.href),r=Pt.test(n)?new URL(Ft(n,e.protocol)):new URL(n),a=I(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{F(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var An=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(An);var jn=[`GET`,...An];new Set(jn);var Mn=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function Nn(e){try{return Mn.includes(new URL(e).protocol)}catch{return!1}}var Pn=k.createContext(null);Pn.displayName=`DataRouter`;var Fn=k.createContext(null);Fn.displayName=`DataRouterState`;var In=k.createContext(!1);function Ln(){return k.useContext(In)}var Rn=k.createContext({isTransitioning:!1});Rn.displayName=`ViewTransition`;var zn=k.createContext(new Map);zn.displayName=`Fetchers`;var Bn=k.createContext(null);Bn.displayName=`Await`;var R=k.createContext(null);R.displayName=`Navigation`;var Vn=k.createContext(null);Vn.displayName=`Location`;var z=k.createContext({outlet:null,matches:[],isDataRoute:!1});z.displayName=`Route`;var Hn=k.createContext(null);Hn.displayName=`RouteError`;var Un=`REACT_ROUTER_ERROR`,Wn=`REDIRECT`,Gn=`ROUTE_ERROR_RESPONSE`;function Kn(e){if(e.startsWith(`${Un}:${Wn}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function qn(e){if(e.startsWith(`${Un}:${Gn}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new Tn(t.status,t.statusText,t.data)}catch{}}function Jn(e,{relative:t}={}){P(Yn(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=k.useContext(R),{hash:i,pathname:a,search:o}=rr(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:L([n,a])),r.createHref({pathname:s,search:o,hash:i})}function Yn(){return k.useContext(Vn)!=null}function B(){return P(Yn(),`useLocation() may be used only in the context of a <Router> component.`),k.useContext(Vn).location}var Xn=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Zn(e){k.useContext(R).static||k.useLayoutEffect(e)}function Qn(){let{isDataRoute:e}=k.useContext(z);return e?Sr():$n()}function $n(){P(Yn(),`useNavigate() may be used only in the context of a <Router> component.`);let e=k.useContext(Pn),{basename:t,navigator:n}=k.useContext(R),{matches:r}=k.useContext(z),{pathname:i}=B(),a=JSON.stringify(vn(r)),o=k.useRef(!1);return Zn(()=>{o.current=!0}),k.useCallback((r,s={})=>{if(F(o.current,Xn),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=yn(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:L([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}var er=k.createContext(null);function tr(e){let t=k.useContext(z).outlet;return k.useMemo(()=>t&&k.createElement(er.Provider,{value:e},t),[t,e])}function nr(){let{matches:e}=k.useContext(z);return e[e.length-1]?.params??{}}function rr(e,{relative:t}={}){let{matches:n}=k.useContext(z),{pathname:r}=B(),i=JSON.stringify(vn(n));return k.useMemo(()=>yn(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function ir(e,t){return ar(e,t)}function ar(e,t,n){P(Yn(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=k.useContext(R),{matches:i}=k.useContext(z),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;wr(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
2
+
3
+ Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=B(),d;if(t){let e=typeof t==`string`?Ut(t):t;P(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):Kt(e,{pathname:p});F(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),F(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let h=fr(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:L([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:L([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?k.createElement(Vn.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...d},navigationType:`POP`}},h):h}function or(){let e=xr(),t=En(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=k.createElement(k.Fragment,null,k.createElement(`p`,null,`💿 Hey developer 👋`),k.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,k.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,k.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),k.createElement(k.Fragment,null,k.createElement(`h2`,null,`Unexpected Application Error!`),k.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?k.createElement(`pre`,{style:i},n):null,o)}var sr=k.createElement(or,null),cr=class extends k.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=qn(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:k.createElement(z.Provider,{value:this.props.routeContext},k.createElement(Hn.Provider,{value:e,children:this.props.component}));return this.context?k.createElement(ur,{error:e},t):t}};cr.contextType=In;var lr=new WeakMap;function ur({children:e,error:t}){let{basename:n}=k.useContext(R);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Kn(t.digest);if(e){let r=lr.get(t);if(r)throw r;let i=kn(e.location,n),a=i.absoluteURL||i.to;if(Nn(a))throw Error(`Invalid redirect location`);if(On&&!lr.get(t))if(i.isExternal||e.reloadDocument)window.location.href=a;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw lr.set(t,n),n}return k.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${a}`})}}return e}function dr({routeContext:e,match:t,children:n}){let r=k.useContext(Pn);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),k.createElement(z.Provider,{value:e},n)}function fr(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);P(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:Dn(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||sr,o&&(s<0&&c===0?(wr(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?k.createElement(n.route.Component,null):n.route.element?n.route.element:e,k.createElement(dr,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?k.createElement(cr,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function pr(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function mr(e){let t=k.useContext(Pn);return P(t,pr(e)),t}function hr(e){let t=k.useContext(Fn);return P(t,pr(e)),t}function gr(e){let t=k.useContext(z);return P(t,pr(e)),t}function _r(e){let t=gr(e),n=t.matches[t.matches.length-1];return P(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function vr(){return _r(`useRouteId`)}function yr(){let e=hr(`useNavigation`);return k.useMemo(()=>{let{matches:t,historyAction:n,...r}=e.navigation;return r},[e.navigation])}function br(){let{matches:e,loaderData:t}=hr(`useMatches`);return k.useMemo(()=>e.map(e=>Jt(e,t)),[e,t])}function xr(){let e=k.useContext(Hn),t=hr(`useRouteError`),n=_r(`useRouteError`);return e===void 0?t.errors?.[n]:e}function Sr(){let{router:e}=mr(`useNavigate`),t=_r(`useNavigate`),n=k.useRef(!1);return Zn(()=>{n.current=!0}),k.useCallback(async(r,i={})=>{F(n.current,Xn),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var Cr={};function wr(e,t,n){!t&&!Cr[e]&&(Cr[e]=!0,F(!1,n))}k.memo(Tr);function Tr({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return ar(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function Er({to:e,replace:t,state:n,relative:r}){P(Yn(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i}=k.useContext(R);F(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:a}=k.useContext(z),{pathname:o}=B(),s=Qn(),c=yn(e,vn(a),o,r===`path`),l=JSON.stringify(c);return k.useEffect(()=>{s(JSON.parse(l),{replace:t,state:n,relative:r})},[s,l,r,t,n]),null}function Dr(e){return tr(e.context)}function Or(e){P(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function kr({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){P(!Yn(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=k.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=Ut(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=k.useMemo(()=>{let e=I(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return F(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:k.createElement(R.Provider,{value:c},k.createElement(Vn.Provider,{children:t,value:h}))}function Ar({children:e,location:t}){return ir(jr(e),t)}k.Component;function jr(e,t=[]){let n=[];return k.Children.forEach(e,(e,r)=>{if(!k.isValidElement(e))return;let i=[...t,r];if(e.type===k.Fragment){n.push.apply(n,jr(e.props.children,i));return}P(e.type===Or,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),P(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=jr(e.props.children,i)),n.push(a)}),n}var Mr=`get`,Nr=`application/x-www-form-urlencoded`;function Pr(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Fr(e){return Pr(e)&&e.tagName.toLowerCase()===`button`}function Ir(e){return Pr(e)&&e.tagName.toLowerCase()===`form`}function Lr(e){return Pr(e)&&e.tagName.toLowerCase()===`input`}function Rr(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function zr(e,t){return e.button===0&&(!t||t===`_self`)&&!Rr(e)}function Br(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function Vr(e,t){let n=Br(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var Hr=null;function Ur(){if(Hr===null)try{new FormData(document.createElement(`form`),0),Hr=!1}catch{Hr=!0}return Hr}var Wr=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Gr(e){return e!=null&&!Wr.has(e)?(F(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Nr}"`),null):e}function Kr(e,t){let n,r,i,a,o;if(Ir(e)){let o=e.getAttribute(`action`);r=o?I(o,t):null,n=e.getAttribute(`method`)||Mr,i=Gr(e.getAttribute(`enctype`))||Nr,a=new FormData(e)}else if(Fr(e)||Lr(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?I(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||Mr,i=Gr(e.getAttribute(`formenctype`))||Gr(o.getAttribute(`enctype`))||Nr,a=new FormData(o,e),!Ur()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(Pr(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=Mr,r=null,i=Nr,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var qr={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},Jr=/[&><\u2028\u2029]/g;function Yr(e){return e.replace(Jr,e=>qr[e])}function Xr(e,t){if(e===!1||e==null)throw Error(t)}function Zr(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n?i.pathname.endsWith(`/`)?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname===`/`?i.pathname=`_root.${r}`:t&&I(i.pathname,t)===`/`?i.pathname=`${xn(t)}/_root.${r}`:i.pathname=`${xn(i.pathname)}.${r}`,i}async function Qr(e,t){if(e.id in t)return t[e.id];try{let n=await v(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function $r(e){return e!=null&&typeof e.page==`string`}function ei(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function ti(e,t,n){return oi((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Qr(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(ei).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function ni(e,t,n,r,i,a){let o=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function ri(e,t,{includeHydrateFallback:n}={}){return ii(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function ii(e){return[...new Set(e)]}function ai(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function oi(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!$r(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(ai(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function si(){let e=k.useContext(Pn);return Xr(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function ci(){let e=k.useContext(Fn);return Xr(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var li=k.createContext(void 0);li.displayName=`FrameworkContext`;function ui(){let e=k.useContext(li);return Xr(e,`You must render this element inside a <HydratedRouter> element`),e}function di(e,t){let n=k.useContext(li),[r,i]=k.useState(!1),[a,o]=k.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=k.useRef(null);k.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),k.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:fi(s,p),onBlur:fi(c,m),onMouseEnter:fi(l,p),onMouseLeave:fi(u,m),onTouchStart:fi(d,p)}]:[a,f,{}]:[!1,f,{}]}function fi(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function pi({page:e,...t}){let n=Ln(),{nonce:r}=ui(),{router:i}=si(),a=k.useMemo(()=>Kt(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?k.createElement(hi,{page:e,matches:a,...t}):k.createElement(gi,{page:e,matches:a,...t})):null}function mi(e){let{manifest:t,routeModules:n}=ui(),[r,i]=k.useState([]);return k.useEffect(()=>{let r=!1;return ti(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function hi({page:e,matches:t,...n}){let r=B(),{future:i}=ui(),{basename:a}=si(),o=k.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=Zr(e,a,i.v8_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.v8_trailingSlashAwareDataRequests,e,r,t]);return k.createElement(k.Fragment,null,o.map(e=>k.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function gi({page:e,matches:t,...n}){let r=B(),{future:i,manifest:a,routeModules:o}=ui(),{basename:s}=si(),{loaderData:c,matches:l}=ci(),u=k.useMemo(()=>ni(e,t,l,a,r,`data`),[e,t,l,a,r]),d=k.useMemo(()=>ni(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=k.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=Zr(e,s,i.v8_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.v8_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=k.useMemo(()=>ri(d,a),[d,a]),m=mi(d);return k.createElement(k.Fragment,null,f.map(e=>k.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>k.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>k.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function _i(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}k.Component;var vi=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{vi&&(window.__reactRouterVersion=`7.18.1`)}catch{}function yi({basename:e,children:t,useTransitions:n,window:r}){let i=k.useRef();i.current??=Rt({window:r,v5Compat:!0});let a=i.current,[o,s]=k.useState({action:a.action,location:a.location}),c=k.useCallback(e=>{n===!1?s(e):k.startTransition(()=>s(e))},[n]);return k.useLayoutEffect(()=>a.listen(c),[a,c]),k.createElement(kr,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}function bi({basename:e,children:t,history:n,useTransitions:r}){let[i,a]=k.useState({action:n.action,location:n.location}),o=k.useCallback(e=>{r===!1?a(e):k.startTransition(()=>a(e))},[r]);return k.useLayoutEffect(()=>n.listen(o),[n,o]),k.createElement(kr,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,useTransitions:r})}bi.displayName=`unstable_HistoryRouter`;var xi=k.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,useTransitions:_}=k.useContext(R),v=typeof l==`string`&&Nt.test(l),y=kn(l,h);l=y.to;let b=Jn(l,{relative:r}),x=B(),S=null;if(o){let e=yn(o,[],x.mask?x.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:L([h,e.pathname])),S=g.createHref(e)}let[ee,C,te]=di(n,p),ne=Oi(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:_});function re(t){e&&e(t),t.defaultPrevented||ne(t)}let ie=!(y.isExternal||i),ae=k.createElement(`a`,{...p,...te,href:(ie?S:void 0)||y.absoluteURL||b,onClick:ie?re:e,ref:_i(m,C),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return ee&&!v?k.createElement(k.Fragment,null,ae,k.createElement(pi,{page:b})):ae});xi.displayName=`Link`;var Si=k.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=rr(a,{relative:c.relative}),d=B(),f=k.useContext(Fn),{navigator:p,basename:m}=k.useContext(R),h=f!=null&&zi(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=I(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,x=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(g.length)===`/`),S={isActive:b,isPending:x,isTransitioning:h},ee=b?e:void 0,C;C=typeof n==`function`?n(S):[n,b?`active`:null,x?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let te=typeof i==`function`?i(S):i;return k.createElement(xi,{...c,"aria-current":ee,className:C,ref:l,style:te,to:a,viewTransition:o},typeof s==`function`?s(S):s)});Si.displayName=`NavLink`;var Ci=k.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=Mr,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=k.useContext(R),g=Mi(),_=Ni(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&Nt.test(s);return k.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f});h&&n!==!1?k.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});Ci.displayName=`Form`;function wi({getKey:e,storageKey:t,...n}){let r=k.useContext(li),{basename:i}=k.useContext(R),a=B(),o=br();Li({getKey:e,storageKey:t});let s=k.useMemo(()=>{if(!r||!e)return null;let t=Ii(a,o,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let c=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return n.nonce==null&&r?.nonce&&(n.nonce=r.nonce),k.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${Yr(JSON.stringify(t||Pi))}, ${Yr(JSON.stringify(s))})`}})}wi.displayName=`ScrollRestoration`;function Ti(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Ei(e){let t=k.useContext(Pn);return P(t,Ti(e)),t}function Di(e){let t=k.useContext(Fn);return P(t,Ti(e)),t}function Oi(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=Qn(),d=B(),f=rr(e,{relative:o});return k.useCallback(p=>{if(zr(p,t)){p.preventDefault();let t=n===void 0?Ht(d)===Ht(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?k.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}function ki(e){F(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=k.useRef(Br(e)),n=k.useRef(!1),r=B(),i=k.useMemo(()=>Vr(r.search,n.current?null:t.current),[r.search]),a=Qn();return[i,k.useCallback((e,t)=>{let r=Br(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var Ai=0,ji=()=>`__${String(++Ai)}__`;function Mi(){let{router:e}=Ei(`useSubmit`),{basename:t}=k.useContext(R),n=vr(),r=e.fetch,i=e.navigate;return k.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Kr(e,t);if(a.navigate===!1){let e=a.fetcherKey||ji();await r(e,n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync})}else await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function Ni(e,{relative:t}={}){let{basename:n}=k.useContext(R),r=k.useContext(z);P(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...rr(e||`.`,{relative:t})},o=B();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:L([n,a.pathname])),Ht(a)}var Pi=`react-router-scroll-positions`,Fi={};function Ii(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:I(e.pathname,n)||e.pathname},t)),i??=e.key,i}function Li({getKey:e,storageKey:t}={}){let{router:n}=Ei(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=Di(`useScrollRestoration`),{basename:a}=k.useContext(R),o=B(),s=br(),c=yr();k.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),Ri(k.useCallback(()=>{if(c.state===`idle`){let t=Ii(o,s,a,e);Fi[t]=window.scrollY}try{sessionStorage.setItem(t||Pi,JSON.stringify(Fi))}catch(e){F(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[c.state,e,a,o,s,t])),typeof document<`u`&&(k.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||Pi);e&&(Fi=JSON.parse(e))}catch{}},[t]),k.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(Fi,()=>window.scrollY,e?(t,n)=>Ii(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),k.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(o.hash){let e=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{F(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,r,i]))}function Ri(e,t){let{capture:n}=t||{};k.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function zi(e,{relative:t}={}){let n=k.useContext(Rn);P(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Ei(`useViewTransitionState`),i=rr(e,{relative:t});if(!n.isTransitioning)return!1;let a=I(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=I(n.nextLocation.pathname,r)||n.nextLocation.pathname;return un(i.pathname,o)!=null||un(i.pathname,a)!=null}var Bi=[`claude`,`codex`,`junie`,`opencode`,`cursor`,`pi`,`copilot`],Vi=new Set([`connected`,`disconnected`,`not-installed`,`unknown`]);function Hi(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ui(e,t){if(!Hi(e))return null;let{provider:n,status:r,enabled:i,hint:a,authFailureId:o}=e;return typeof n!=`string`||!Bi.includes(n)||typeof r!=`string`||!Vi.has(r)||t&&typeof i!=`boolean`||!t&&i!==void 0&&typeof i!=`boolean`||a!==void 0&&typeof a!=`string`||o!==void 0&&(typeof o!=`string`||o.length<1||o.length>128||r!==`disconnected`)?null:{provider:n,status:r,...typeof i==`boolean`?{enabled:i}:{},...a===void 0?{}:{hint:a},...o===void 0?{}:{authFailureId:o}}}function Wi(e){return Ui(e,!1)}function Gi(e,t){if(!Hi(e)||!Array.isArray(e.providers))return null;let n=[],r=new Set;for(let i of e.providers){let e=Ui(i,t);if(e===null||r.has(e.provider))return null;r.add(e.provider),n.push(e)}return n}function V(e){let t=Gi(e,!0);if(t===null||t.length===0)return null;let n=new Map(t.map(e=>[e.provider,e]));return Bi.flatMap(e=>{let t=n.get(e);return t?[t]:[]})}function Ki(e){let t=V(e);if(t===null)throw Error(`Invalid provider status response`);return{providers:t}}function qi(e,t){let n=V(e);if(n!==null)return{providers:n.map(e=>e.provider===t.provider?{provider:t.provider,status:t.status,enabled:t.enabled??e.enabled,...t.hint===void 0?{}:{hint:t.hint},...t.authFailureId===void 0?{}:{authFailureId:t.authFailureId}}:e)}}function Ji(e,t,n,r){let i=V(e),a=V(t),o=V(n);if(o===null||a===null)return n;if(i===null)return{providers:a};let s=new Map(i.map(e=>[e.provider,e])),c=new Map(a.map(e=>[e.provider,e]));return{providers:o.map(e=>{let t=s.get(e.provider),n=c.get(e.provider);if(t===void 0||n===void 0)return n??e;let i=r!==void 0&&n.authFailureId===r&&e.authFailureId===void 0;return r!==void 0&&n.authFailureId!==void 0&&n.authFailureId!==r&&e.authFailureId===void 0?n:Yi(t,n)?e:i?{...e,enabled:n.enabled}:n})}}function Yi(e,t){return e.provider===t.provider&&e.status===t.status&&e.enabled===t.enabled&&e.hint===t.hint&&e.authFailureId===t.authFailureId}function Xi(e){let t=V(e);if(t===null)return[];let n=new Set(t.filter(e=>e.enabled&&(e.status===`connected`||e.provider===`junie`&&e.status===`unknown`)).map(e=>e.provider));return Bi.filter(e=>n.has(e))}function Zi(e,t){return V(e)?.find(e=>e.provider===t)}function Qi(e,t){if(e===`ping`)return{project:null,event:{type:`ping`}};let n;try{n=JSON.parse(t)}catch{return null}if(!$i(n))return null;let r=n.project;if(typeof r!=`string`||r===``)return null;switch(e){case`run`:{let{project:e,...t}=n;return ea(t)?{project:r,event:{type:`run`,run:t}}:null}case`run-deleted`:{let e=n.id;return typeof e==`string`&&e?{project:r,event:{type:`run-deleted`,id:e}}:null}case`todos`:return Array.isArray(n.items)?{project:r,event:{type:`todos`,items:n.items}}:null;case`usage`:return $i(n.usage)?{project:r,event:{type:`usage`,usage:n.usage}}:null;default:return null}}function $i(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ea(e){return $i(e)&&typeof e.id==`string`&&e.id!==``}function ta(e,t){if(!e)return;let n=e.findIndex(e=>e.id===t.id);if(n>=0){let r=[...e];return r[n]=ra(e[n],t),r}let r=t.createdAt??``,i=e.findIndex(e=>(e.createdAt??``).localeCompare(r)<0),a=[...e];return a.splice(i<0?e.length:i,0,t),a}function na(e,t){if(!e)return;let n=e.filter(e=>e.id!==t);return n.length===e.length?e:n}function ra(e,t){if(!e)return t;let n=e=>e===`user`?2:+(e===`marker`),r=n(e.titleOrigin)>n(t.titleOrigin)?{title:e.title,titleSummary:e.titleSummary,titleOrigin:e.titleOrigin}:{};return e.usage?{...t,...r,usage:e.usage}:{...t,...r}}var ia=Object.freeze({});function aa(){let e=ia,t=new Set;return{subscribe(e){return t.add(e),()=>t.delete(e)},get:()=>e,set(n){e=n;for(let e of t)e()}}}var H=class extends Error{status;manual;command;exists;constructor(e,t,n={}){super(t,n.cause===void 0?void 0:{cause:n.cause}),this.name=`ApiError`,this.status=e,this.manual=n.manual,this.command=n.command,this.exists=n.exists}};function oa(e){try{return JSON.parse(e)}catch{return}}function sa(e){return typeof e==`string`?e:void 0}function ca(e,t,n){let r=oa(n),i=r&&typeof r==`object`?r:{};return new H(e,sa(i.error)??`${e} ${t||`request failed`}`.trim(),{manual:sa(i.manual),command:sa(i.command),exists:typeof i.exists==`boolean`?i.exists:void 0})}var U=le({fetch:(e,t)=>pa(la(String(e)),t)});function la(e){let t=da(e.endsWith(`?`)?e.slice(0,-1):e);return t.startsWith(`/`)?`${f()}${t}`:t}var ua=`${d}/p/default`;function da(e){if(h()!==null||!e.startsWith(ua))return e;let t=e.slice(ua.length);return t===``||t.startsWith(`/`)||t.startsWith(`?`)?`${d}${t}`:e}var W=e=>({init:{signal:e?.signal}});async function G(e,t){let n=await e.text();if(!e.ok)throw ca(e.status,e.statusText,n);let r=oa(n);if(r===void 0)throw new H(e.status,`the cezar server answered ${t} with a non-JSON body`);return r}async function fa(e,t,n){let r=e.status,i=await G(e,t),a=n.safeParse(i);if(!a.success)throw new H(r,`the cezar server answered ${t} with an unexpected body`);return a.data}async function pa(e,t){try{return await fetch(e,{...t,credentials:`include`})}catch(t){throw t instanceof DOMException&&t.name===`AbortError`?t:new H(0,`cannot reach the cezar server (${e})`,{cause:t})}}async function ma(e,t){return pa(c(e),t)}async function ha(e,t={}){let n=new Headers(t.headers);n.set(`accept`,`text/plain`);let r=await ma(e,{...t,headers:n}),i=await r.text();if(!r.ok)throw ca(r.status,r.statusText,i);return i}var K=(e,t=``)=>`/runs/${encodeURIComponent(e)}${t}`;async function ga(e){return G(await U.api.v1.health.$get({},W(e)),`/health`)}async function _a(e){return G(await U.api.v1[`star-count`].$get({},W(e)),`/star-count`)}async function va(e,t){return G(await U.api.v1.models.$get({query:{runner:e}},W(t)),`/models`)}async function ya(e=!1,t){return Ki(await G(await U.api.v1.providers.status.$get({query:e?{refresh:`1`}:{}},W(t)),`/providers/status`))}async function ba(e){return G(await U.api.v1.p[`:projectId`][`launch-key`].$get({param:{projectId:l()}},W(e)),`/launch-key`)}async function xa(e){return G(await U.api.v1.projects.$get({},W(e)),`/projects`)}async function Sa(e,t){return G(await U.api.v1.fs.browse.$get({query:{path:e===``?void 0:e,...t?.showHidden?{showHidden:`1`}:{}}},W(t)),`/fs/browse`)}async function Ca(e){return G(await U.api.v1.p[`:projectId`].runs.$get({param:{projectId:l()}},W(e)),`/runs`)}async function wa(e,t){return G(await U.api.v1.p[`:projectId`].runs.$get({param:{projectId:e}},W(t)),`/runs`)}async function Ta(e){return G(await U.api.v1.workspace[`runs-index`].$get({},W(e)),`/workspace/runs-index`)}async function Ea(e,t){return G(await U.api.v1.p[`:projectId`].runs[`:id`].$get({param:{projectId:l(),id:encodeURIComponent(e)}},W(t)),K(e))}async function Da(e,t,n){return G(await U.api.v1.p[`:projectId`].runs[`:id`].$get({param:{projectId:e,id:encodeURIComponent(t)}},W(n)),K(t))}async function Oa(e,t,n){return fa(await U.api.v1.p[`:projectId`].runs[`:id`].history.$get({param:{projectId:l(),id:encodeURIComponent(e)},query:{...t===void 0?{}:{cursor:t}}},W(n)),`${K(e)}/history`,a)}async function ka(e,t){return fa(await U.api.v1.p[`:projectId`].runs[`:id`][`history-context`].$get({param:{projectId:l(),id:encodeURIComponent(e)}},W(t)),`${K(e)}/history-context`,p)}async function Aa(e){return G(await U.api.v1.p[`:projectId`][`ui-state`].$get({param:{projectId:l()}},W(e)),`/ui-state`)}async function ja(e){return G(await U.api.v1.p[`:projectId`].workflows.$get({param:{projectId:l()}},W(e)),`/workflows`)}async function Ma(e){return G(await U.api.v1.p[`:projectId`].skills.$get({param:{projectId:l()},query:{}},W(e)),`/skills`)}async function Na(e){return G(await U.api.v1.p[`:projectId`].skills.$get({param:{projectId:l()},query:{wait:`1`}},W(e)),`/skills`)}async function Pa(){return G(await U.api.v1.p[`:projectId`].skills.refresh.$post({param:{projectId:l()}}),`/skills/refresh`)}async function Fa(e){return G(await U.api.v1.p[`:projectId`].skills.importable.$get({param:{projectId:l()},query:{}},W(e)),`/skills/importable`)}async function Ia(e){return G(await U.api.v1.p[`:projectId`].skills.importable.$get({param:{projectId:l()},query:{wait:`1`}},W(e)),`/skills/importable`)}async function La(e){return G(await U.api.v1.p[`:projectId`].todos.$get({param:{projectId:l()}},W(e)),`/todos`)}async function Ra(e){return G(await U.api.v1.p[`:projectId`].repo.$get({param:{projectId:l()}},W(e)),`/repo`)}async function za(e){return G(await U.api.v1.p[`:projectId`].config.$get({param:{projectId:l()}},W(e)),`/config`)}async function Ba(e={}){return G(await U.api.v1.p[`:projectId`][`agent-config`].$get({param:{projectId:l()}},W(e)),`/agent-config`)}async function Va(e,t={}){return G(await U.api.v1.p[`:projectId`][`agent-config`][`:id`].$get({param:{projectId:l(),id:encodeURIComponent(e)}},W(t)),`/agent-config/${encodeURIComponent(e)}`)}async function Ha(e,t){return G(await U.api.v1.p[`:projectId`][`agent-config`][`:id`].$put({param:{projectId:l(),id:encodeURIComponent(e)},json:t}),`/agent-config/${encodeURIComponent(e)}`)}async function Ua(e){return G(await U.api.v1.p[`:projectId`].repo.changes.$get({param:{projectId:l()}},W(e)),`/repo/changes`)}async function Wa(e,t){return G(await U.api.v1.p[`:projectId`].repo.commit[`:sha`].$get({param:{projectId:l(),sha:encodeURIComponent(e)},query:{structured:`1`}},W(t)),`/repo/commit/:sha`)}async function Ga(e,t){return G(await U.api.v1.p[`:projectId`].runs[`:id`].commits.$get({param:{projectId:l(),id:encodeURIComponent(e)}},W(t)),K(e,`/commits`))}async function Ka(e,t,n){return G(await U.api.v1.p[`:projectId`].runs[`:id`].commit[`:sha`].$get({param:{projectId:l(),id:encodeURIComponent(e),sha:encodeURIComponent(t)}},W(n)),K(e,`/commit/${encodeURIComponent(t)}`))}async function qa(e={},t){return G(await U.api.v1.p[`:projectId`].github.$get({param:{projectId:l()},query:{limit:e.limit===void 0?void 0:String(e.limit),refresh:e.refresh?`1`:void 0}},W(t)),`/github`)}async function Ja(e={},t){return G(await U.api.v1.p[`:projectId`].tracker[`automation-options`].$get({param:{projectId:l()},query:e},W(t)),`/tracker/automation-options`)}async function Ya(e){return G(await U.api.v1.p[`:projectId`].tracker.connection.$get({param:{projectId:l()}},W(e)),`/tracker/connection`)}async function Xa(e){return G(await U.api.v1.p[`:projectId`].tracker.connection.$put({param:{projectId:l()},json:e}),`/tracker/connection`)}async function Za(){return G(await U.api.v1.p[`:projectId`].tracker.connection.$delete({param:{projectId:l()}}),`/tracker/connection`)}async function Qa(e){return G(await U.api.v1.p[`:projectId`].tracker.association.$get({param:{projectId:l()}},W(e)),`/tracker/association`)}async function $a(e,t={},n){return G(await U.api.v1.p[`:projectId`].tracker.candidates.$get({param:{projectId:l()},query:{kind:e,q:t.q,cursor:t.cursor,limit:t.limit===void 0?void 0:String(t.limit)}},W(n)),`/tracker/candidates`)}async function eo(e){return G(await U.api.v1.p[`:projectId`].tracker.association.$put({param:{projectId:l()},json:e}),`/tracker/association`)}async function to(){return G(await U.api.v1.p[`:projectId`].tracker.association.$delete({param:{projectId:l()}}),`/tracker/association`)}function no(e){return{expectedScope:e.association?o(e.association):void 0,cursor:e.cursor,limit:e.limit===void 0?void 0:String(e.limit),refresh:e.refresh?`1`:void 0,state:e.state,labels:e.labels?.length?JSON.stringify(e.labels):void 0}}async function ro(e={},t){return G(await U.api.v1.p[`:projectId`].tracker.$get({param:{projectId:l()},query:no(e)},W(t)),`/tracker`)}async function io(e,t={},n){return G(await U.api.v1.p[`:projectId`].tracker.search.$get({param:{projectId:l()},query:{...no(t),q:e}},W(n)),`/tracker/search`)}async function ao(e,t){return G(await U.api.v1.p[`:projectId`].tracker[`:id`].$get({param:{projectId:l(),id:encodeURIComponent(e)},query:{expectedScope:t?.association?o(t.association):void 0}},W(t)),`/tracker/${encodeURIComponent(e)}`)}async function oo(e,t){return G(await U.api.v1.p[`:projectId`].github.checks.$get({param:{projectId:l()},query:{prs:e.join(`,`)}},W(t)),`/github/checks`)}async function so(e,t,n={},r){return G(await U.api.v1.p[`:projectId`].github.search.$get({param:{projectId:l()},query:{kind:e,q:t,limit:n.limit}},W(r)),`/github/search`)}async function co(e,t,n){return G(await U.api.v1.p[`:projectId`].github[`ref-status`].$get({param:{projectId:e},query:{...t.prs?.length?{prs:t.prs.join(`,`)}:{},...t.issues?.length?{issues:t.issues.join(`,`)}:{}}},W(n)),`/github/ref-status`)}async function lo(e,t,n={},r){return G(await U.api.v1.p[`:projectId`].github.comments[`:kind`][`:number`].$get({param:{projectId:l(),kind:e,number:String(t)},query:{refresh:n.refresh?`1`:void 0}},W(r)),`/github/comments/${e}/${t}`)}async function uo(e,t={},n){return G(await U.api.v1.p[`:projectId`].github.prs[`:number`][`merge-state`].$get({param:{projectId:l(),number:String(e)},query:{refresh:t.refresh?`1`:void 0}},W(n)),`/github/prs/${e}/merge-state`)}async function fo(e,t){return G(await U.api.v1.p[`:projectId`].github.prs[`:number`].merge.$post({param:{projectId:l(),number:String(e)},json:t}),`/github/prs/:number/merge`)}async function po(e,t={},n){return G(await U.api.v1.p[`:projectId`].github.prs[`:number`].changes.$get({param:{projectId:l(),number:String(e)},query:{refresh:t.refresh?`1`:void 0}},W(n)),`/github/prs/${e}/changes`)}function mo(e,t){return ha(K(e,`/diff`),{method:`GET`,signal:t?.signal})}function ho(e,t){return ha(K(e,`/handoff`),{method:`GET`,signal:t?.signal})}async function go(e,t){return G(await U.api.v1.p[`:projectId`].runs[`:id`].changes.$get({param:{projectId:l(),id:encodeURIComponent(e)}},W(t)),K(e,`/changes`))}async function _o(e,t,n){return G(await U.api.v1.p[`:projectId`].runs[`:id`].files.$get({param:{projectId:l(),id:encodeURIComponent(e)},query:{path:t}},W(n)),`/runs/:id/files`)}function vo(e,t){return c(K(e,`/files?path=${encodeURIComponent(t)}&raw=1`))}async function yo(e,t){return G(await U.api.v1.p[`:projectId`].groups[`:groupId`].$get({param:{projectId:l(),groupId:encodeURIComponent(e)}},W(t)),`/groups/${encodeURIComponent(e)}`)}async function bo(e,t){return G(await U.api.v1.providers.connect.$post({json:{provider:e,...t?{profileId:t}:{}}}),`/providers/connect`)}async function xo(e,t){return Ki(await G(await U.api.v1.providers[`:provider`].enabled.$put({param:{provider:e},json:{enabled:t}}),`/providers/${encodeURIComponent(e)}/enabled`))}async function So(e,t){return Ki(await G(await U.api.v1.providers[`:provider`].retry.$post({param:{provider:e},json:{authFailureId:t}}),`/providers/${encodeURIComponent(e)}/retry`))}async function Co(e){let t=`/projects`,n=await ma(t,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({root:e})}),r=await n.text(),i=oa(r),a=i?.project;if((n.ok||n.status===409)&&a!=null)return i;throw n.ok?new H(n.status,`the cezar server answered ${t} without a project`):ca(n.status,n.statusText,r)}async function wo(e){return G(await U.api.v1.projects.checkout.$post({json:e}),`/projects/checkout`)}async function To(e){return G(await U.api.v1.projects[`:projectId`].$delete({param:{projectId:encodeURIComponent(e)}}),`/projects/${encodeURIComponent(e)}`)}async function Eo(e,t){return G(await U.api.v1.projects[`:projectId`].$patch({param:{projectId:encodeURIComponent(e)},json:t}),`/projects/${encodeURIComponent(e)}`)}async function Do(e){return G(await U.api.v1.p[`:projectId`].runs.$post({param:{projectId:l()},json:e}),`/runs`)}async function Oo(e){return G(await U.api.v1.p[`:projectId`].runs[`:id`].cancel.$post({param:{projectId:l(),id:encodeURIComponent(e)}}),K(e,`/cancel`))}async function ko(e,t=!0){return G(await U.api.v1.p[`:projectId`].runs[`:id`].archive.$post({param:{projectId:l(),id:encodeURIComponent(e)},json:{archived:t}}),K(e,`/archive`))}async function Ao(e,t=!0){return G(await U.api.v1.p[`:projectId`].runs[`:id`].pin.$post({param:{projectId:l(),id:encodeURIComponent(e)},json:{pinned:t}}),K(e,`/pin`))}async function jo(e,t,n=!0){return G(await U.api.v1.p[`:projectId`].runs[`:id`].pin.$post({param:{projectId:e,id:encodeURIComponent(t)},json:{pinned:n}}),K(t,`/pin`))}async function Mo(e,t,n=!0){return G(await U.api.v1.p[`:projectId`].runs[`:id`].archive.$post({param:{projectId:e,id:encodeURIComponent(t)},json:{archived:n}}),K(t,`/archive`))}async function No(e,t,n){let r=n?`read`:`unread`;return G(await(n?U.api.v1.p[`:projectId`].runs[`:id`].read.$post({param:{projectId:e,id:encodeURIComponent(t)}}):U.api.v1.p[`:projectId`].runs[`:id`].unread.$post({param:{projectId:e,id:encodeURIComponent(t)}})),K(t,`/${r}`))}async function Po(e){return G(await U.api.v1.p[`:projectId`].runs[`:id`][`auto-resume`].$delete({param:{projectId:l(),id:encodeURIComponent(e)}}),K(e,`/auto-resume`))}async function Fo(){return G(await U.api.v1.p[`:projectId`].runs[`archive-finished`].$post({param:{projectId:l()}}),`/runs/archive-finished`)}async function Io(e){return G(await U.api.v1.p[`:projectId`].runs[`:id`].read.$post({param:{projectId:l(),id:encodeURIComponent(e)}}),K(e,`/read`))}async function Lo(e){return G(await U.api.v1.p[`:projectId`].runs[`:id`].unread.$post({param:{projectId:l(),id:encodeURIComponent(e)}}),K(e,`/unread`))}async function Ro(){return G(await U.api.v1.p[`:projectId`].runs[`read-all`].$post({param:{projectId:l()}}),`/runs/read-all`)}async function zo(e){return G(await U.api.v1.p[`:projectId`].runs[`:id`].finish.$post({param:{projectId:l(),id:encodeURIComponent(e)}}),K(e,`/finish`))}async function Bo(e,t={}){let n={...t.text===void 0?{}:{text:t.text},...t.images===void 0?{}:{images:t.images},...t.runner===void 0?{}:{runner:t.runner},...t.model===void 0?{}:{model:t.model},...t.agentProfile===void 0?{}:{agentProfile:t.agentProfile}};return G(await U.api.v1.p[`:projectId`].runs[`:id`].continue.$post({param:{projectId:l(),id:encodeURIComponent(e)},json:n}),K(e,`/continue`))}async function Vo(e,t,n={}){return G(await U.api.v1.p[`:projectId`].runs[`:id`].continue.$post({param:{projectId:e,id:encodeURIComponent(t)},json:{...n.text===void 0?{}:{text:n.text},...n.images===void 0?{}:{images:n.images},...n.runner===void 0?{}:{runner:n.runner},...n.model===void 0?{}:{model:n.model},...n.agentProfile===void 0?{}:{agentProfile:n.agentProfile}}}),K(t,`/continue`))}async function Ho(e){return G(await U.api.v1.p[`:projectId`].runs[`:id`].pr.$post({param:{projectId:l(),id:encodeURIComponent(e)}}),K(e,`/pr`))}async function Uo(e,t){return G(await U.api.v1.p[`:projectId`].runs[`:id`].$patch({param:{projectId:l(),id:encodeURIComponent(e)},json:t}),K(e))}async function Wo(e){return G(await U.api.v1.p[`:projectId`].runs[`:id`].$delete({param:{projectId:l(),id:encodeURIComponent(e)}}),K(e))}async function Go(e){return G(await U.api.v1.p[`:projectId`].todos[`:id`].$delete({param:{projectId:l(),id:encodeURIComponent(e)}}),`/todos/${encodeURIComponent(e)}`)}async function Ko(e,t={}){let n={...t.runner===void 0?{}:{runner:t.runner},...t.model===void 0?{}:{model:t.model},...t.prompt===void 0?{}:{prompt:t.prompt}};return G(await U.api.v1.p[`:projectId`].todos[`:id`].start.$post({param:{projectId:l(),id:encodeURIComponent(e)},json:Object.keys(n).length>0?n:void 0}),`/todos/${encodeURIComponent(e)}/start`)}async function qo(e,t){return G(await U.api.v1.p[`:projectId`].groups[`:groupId`].pick.$post({param:{projectId:l(),groupId:encodeURIComponent(e)},json:{runId:t}}),`/groups/${encodeURIComponent(e)}/pick`)}async function Jo(e){return G(await U.api.v1.p[`:projectId`].runs[`:id`][`open-in-cli`].$post({param:{projectId:l(),id:encodeURIComponent(e)}}),K(e,`/open-in-cli`))}async function Yo(e){return G(await U.api.v1.p[`:projectId`][`open-targets`].$get({param:{projectId:l()}},W(e)),`/open-targets`)}async function Xo(e){return G(await U.api.v1.p[`:projectId`][`open-in`].$post({param:{projectId:l()},json:{target:e}}),`/open-in`)}async function Zo(e,t){return G(await U.api.v1.p[`:projectId`].runs[`:id`][`open-in`].$post({param:{projectId:l(),id:encodeURIComponent(e)},json:{target:t}}),K(e,`/open-in`))}async function Qo(e,t){return G(await U.api.v1.p[`:projectId`].runs[`:id`][`open-in`].$post({param:{projectId:l(),id:encodeURIComponent(e)},json:{target:`default`,path:t}}),K(e,`/open-in`))}async function $o(e,t){return G(await U.api.v1.p[`:projectId`].runs[`:id`].git.commit.$post({param:{projectId:l(),id:encodeURIComponent(e)},json:{message:t}}),K(e,`/git/commit`))}async function es(e){return G(await U.api.v1.p[`:projectId`].runs[`:id`].git.push.$post({param:{projectId:l(),id:encodeURIComponent(e)}}),K(e,`/git/push`))}async function ts(e,t){return G(await U.api.v1.p[`:projectId`].runs[`:id`].messages.$post({param:{projectId:l(),id:encodeURIComponent(e)},json:{text:t.text??``,images:t.images??[]}}),K(e,`/messages`))}async function ns(e,t,n){return G(await U.api.v1.p[`:projectId`].runs[`:id`].messages.$post({param:{projectId:e,id:encodeURIComponent(t)},json:{text:n.text??``,images:n.images??[]}}),K(t,`/messages`))}async function rs(e,t,n){return G(await U.api.v1.p[`:projectId`].runs[`:id`][`queued-messages`][`:msgId`].$patch({param:{projectId:l(),id:encodeURIComponent(e),msgId:encodeURIComponent(t)},json:n}),K(e,`/queued-messages/${encodeURIComponent(t)}`))}async function is(e,t){return G(await U.api.v1.p[`:projectId`].runs[`:id`][`queued-messages`][`:msgId`].$delete({param:{projectId:l(),id:encodeURIComponent(e),msgId:encodeURIComponent(t)}}),K(e,`/queued-messages/${encodeURIComponent(t)}`))}async function as(e,t){return G(await U.api.v1.p[`:projectId`].runs[`:id`].drafts.$get({param:{projectId:l(),id:encodeURIComponent(e)}},W(t)),K(e,`/drafts`))}var os=56*1024;async function ss(e,t,n,r){let i=r?.keepalive===!0&&new TextEncoder().encode(JSON.stringify(n)).length<=os;return G(await U.api.v1.p[`:projectId`].runs[`:id`].drafts[`:surface`].$put({param:{projectId:l(),id:encodeURIComponent(e),surface:t},json:n},{init:{keepalive:i}}),K(e,`/drafts/${t}`))}async function cs(e,t,n){return G(await U.api.v1.p[`:projectId`].runs[`:id`].drafts[`:surface`].images.$post({param:{projectId:l(),id:encodeURIComponent(e),surface:t},json:n}),K(e,`/drafts/${t}/images`))}async function ls(e,t,n,r){return G(await U.api.v1.p[`:projectId`].runs[`:id`].drafts[`:surface`].images[`:imageId`].$get({param:{projectId:l(),id:encodeURIComponent(e),surface:t,imageId:n}},W(r)),K(e,`/drafts/${t}/images/${n}`))}async function us(e,t,n){return G(await U.api.v1.p[`:projectId`].runs[`:id`].drafts[`:surface`].images[`:imageId`].$delete({param:{projectId:l(),id:encodeURIComponent(e),surface:t,imageId:n}}),K(e,`/drafts/${t}/images/${n}`))}async function ds(e){return G(await U.api.v1.p[`:projectId`].repo.branch.$post({param:{projectId:l()},json:e}),`/repo/branch`)}async function fs(e){return G(await U.api.v1.p[`:projectId`].plan.$post({param:{projectId:l()},json:{task:e}}),`/plan`)}async function ps(e){return G(await U.api.v1.p[`:projectId`].automations.$get({param:{projectId:l()}},W(e)),`/automations`)}async function ms(e){return G(await U.api.v1.p[`:projectId`].automations.$post({param:{projectId:l()},json:e}),`/automations`)}async function hs(e,t){return G(await U.api.v1.p[`:projectId`].automations[`:id`].$put({param:{projectId:l(),id:encodeURIComponent(e)},json:t}),`/automations/${encodeURIComponent(e)}`)}async function gs(e,t){let n={projectId:l(),id:encodeURIComponent(e)},r=`/automations/${encodeURIComponent(e)}/${t?`enable`:`pause`}`;return G(t?await U.api.v1.p[`:projectId`].automations[`:id`].enable.$post({param:n}):await U.api.v1.p[`:projectId`].automations[`:id`].pause.$post({param:n}),r)}async function _s(e,t){return G(await U.api.v1.p[`:projectId`].automations[`:id`].check.$post({param:{projectId:l(),id:encodeURIComponent(e)},json:{mode:t}}),`/automations/${encodeURIComponent(e)}/check`)}async function vs(e,t){return G(await U.api.v1.p[`:projectId`][`automation-log`].$get({param:{projectId:l()},query:{automationId:e}},W(t)),`/automation-log?automationId=${encodeURIComponent(e)}`)}async function ys(e){return G(await U.api.v1.p[`:projectId`][`automation-log`][`:receiptId`].retry.$post({param:{projectId:l(),receiptId:encodeURIComponent(e)}}),`/automation-log/${encodeURIComponent(e)}/retry`)}async function bs(e){return G(await U.api.v1.p[`:projectId`].automations[`:id`].run.$post({param:{projectId:l(),id:encodeURIComponent(e)}}),`/automations/${encodeURIComponent(e)}/run`)}async function xs(e){let t=await U.api.v1.p[`:projectId`].automations[`:id`].$delete({param:{projectId:l(),id:encodeURIComponent(e)}});if(!t.ok)throw ca(t.status,t.statusText,await t.text())}async function Ss(e,t){return G(await U.api.v1.workspace[`automation-templates`].$get({query:e?{exclude:e}:{}},W(t)),`/workspace/automation-templates`)}async function Cs(e){return G(await U.api.v1.p[`:projectId`].workflows.$post({param:{projectId:l()},json:e}),`/workflows`)}async function ws(e){return G(await U.api.v1.p[`:projectId`].workflows.parse.$post({param:{projectId:l()},json:{yaml:e}}),`/workflows/parse`)}async function Ts(e){return G(await U.api.v1.p[`:projectId`].workflows[`:name`].$delete({param:{projectId:l(),name:encodeURIComponent(e)}}),`/workflows/${encodeURIComponent(e)}`)}async function Es(e){return G(await U.api.v1.p[`:projectId`][`ui-state`].$put({param:{projectId:l()},json:e}),`/ui-state`)}async function Ds(e){return G(await U.api.v1.workspace[`ui-state`].$get({},W(e)),`/workspace/ui-state`)}async function Os(e,t={}){return G(await U.api.v1.workspace[`ui-state`].$put({json:e},{init:{keepalive:t.keepalive}}),`/workspace/ui-state`)}async function ks(e){let t=await G(await U.api.v1.workspace.config.$get({},W(e)),`/workspace/config`);return{...t,agentDefaults:t.agentDefaults??{},resources:{...t.resources,idleTimeoutMinutes:t.resources.idleTimeoutMinutes===void 0?15:t.resources.idleTimeoutMinutes}}}async function As(e){return G(await U.api.v1.workspace[`host-usage`].$get({},W(e)),`/workspace/host-usage`)}async function js(e){let t=await G(await U.api.v1.workspace[`agent-profiles`].$get({},W(e)),`/workspace/agent-profiles`);return{...t,profileCapableProviders:t.profileCapableProviders??[],selections:t.selections??{},defaults:t.defaults??{},profiles:(t.profiles??[]).map(e=>({...e,files:e.files??[]}))}}async function Ms(e){return G(await U.api.v1.workspace[`agent-profiles`].$post({json:e}),`/workspace/agent-profiles`)}async function Ns(e,t){return G(await U.api.v1.workspace[`agent-profiles`][`:id`].status.$get({param:{id:encodeURIComponent(e)},query:t?.refresh?{refresh:`1`}:{}},W(t)),`/workspace/agent-profiles/${encodeURIComponent(e)}/status`)}async function Ps(e,t){return G(await U.api.v1.workspace[`agent-profiles`][`:id`].details.$get({param:{id:encodeURIComponent(e)}},W(t)),`/workspace/agent-profiles/${encodeURIComponent(e)}/details`)}async function Fs(e,t){return G(await U.api.v1.workspace[`agent-profiles`][`:id`].open.$post({param:{id:encodeURIComponent(e)},json:t}),`/workspace/agent-profiles/${encodeURIComponent(e)}/open`)}async function Is(e){return G(await U.api.v1.workspace[`agent-profiles`].selection.$put({json:e}),`/workspace/agent-profiles/selection`)}async function Ls(e,t){return G(await U.api.v1.workspace[`agent-profiles`][`:id`].$patch({param:{id:encodeURIComponent(e)},json:t}),`/workspace/agent-profiles/${encodeURIComponent(e)}`)}async function Rs(e){return G(await U.api.v1.workspace[`agent-profiles`][`:id`].$delete({param:{id:encodeURIComponent(e)}}),`/workspace/agent-profiles/${encodeURIComponent(e)}`)}async function zs(e,t){return G(await U.api.v1.workspace[`skills-update`].$get({query:{projectId:e}},W(t)),`/workspace/skills-update?projectId=${encodeURIComponent(e)}`)}async function Bs(e){return G(await U.api.v1.workspace[`skills-update`].check.$post({json:{projectId:e}}),`/workspace/skills-update/check`)}async function Vs(e){return G(await U.api.v1.workspace[`skills-update`].apply.$post({json:{projectId:e}}),`/workspace/skills-update/apply`)}async function Hs(e){return G(await U.api.v1.workspace[`self-update`].$get({},W(e)),`/workspace/self-update`)}async function Us(){return G(await U.api.v1.workspace[`self-update`].refresh.$post({}),`/workspace/self-update/refresh`)}async function Ws(e){return G(await U.api.v1.workspace[`self-update`].development.$get({query:e?.refresh?{refresh:`1`}:{}},W(e)),`/workspace/self-update/development`)}async function Gs(e){return G(await U.api.v1.workspace[`self-update`].channel.$put({json:{channel:e}}),`/workspace/self-update/channel`)}async function Ks(e){return G(await U.api.v1.workspace[`self-update`].apply.$post({json:{version:e}}),`/workspace/self-update/apply`)}async function qs(e){return G(await U.api.v1.workspace.config.$put({json:e}),`/workspace/config`)}async function Js(e){return G(await U.api.v1.p[`:projectId`].config.$put({param:{projectId:l()},json:e}),`/config`)}async function Ys(e){return G(await U.api.v1.p[`:projectId`].worktrees.$get({param:{projectId:l()}},W(e)),`/worktrees`)}async function Xs(){return G(await U.api.v1.p[`:projectId`].worktrees.reclaim.$post({param:{projectId:l()},json:{}}),`/worktrees/reclaim`)}async function Zs(e){return G(await U.api.v1.p[`:projectId`].runs[`:id`][`remove-worktree`].$post({param:{projectId:l(),id:encodeURIComponent(e)}}),K(e,`/remove-worktree`))}async function Qs(e,t,n){return _.parse(await G(await U.api.v1.p[`:projectId`].tracker.watch.$post({param:{projectId:e},json:t},{init:{signal:n}}),`/tracker/watch`))}async function $s(e,t,n,r){return s.parse(await G(await U.api.v1.p[`:projectId`].tracker.watch[`:watchId`].$get({param:{projectId:e,watchId:t},query:{after:r===void 0?void 0:String(r)}},{init:{signal:n}}),`/tracker/watch`))}async function ec(e,t,n){return s.parse(await G(await U.api.v1.p[`:projectId`].tracker.watch[`:watchId`].$post({param:{projectId:e,watchId:t}},{init:{signal:n}}),`/tracker/watch`))}var tc={projectId:null,apiBase:d},nc=(0,k.createContext)(tc);function rc(){return(0,k.useContext)(nc)}function ic({projectId:e,children:t}){h()!==e&&u(e),(0,k.useLayoutEffect)(()=>{u(e)},[e]),(0,k.useLayoutEffect)(()=>()=>u(null),[]);let n=(0,k.useMemo)(()=>e===null?tc:{projectId:e,apiBase:`${d}/p/${encodeURIComponent(e)}`},[e]);return(0,A.jsx)(nc.Provider,{value:n,children:t})}var ac={draft:{label:`Draft`,hint:`the author has not marked it ready for review`,tone:`neutral`},"review-required":{label:`Waiting for review`,hint:`checks are fine, no one has reviewed it yet`,tone:`info`},"changes-requested":{label:`Changes requested`,hint:`a reviewer asked for edits before this can merge`,tone:`danger`},"checks-pending":{label:`Checks running`,hint:`CI has not finished on the latest commit`,tone:`pending`},"checks-failing":{label:`Checks failing`,hint:`CI is red on the latest commit`,tone:`danger`},ready:{label:`Ready to merge`,hint:`open, checks pass, nothing is waiting on a reviewer`,tone:`success`},merged:{label:`Merged`,hint:`this landed on its base branch`,tone:`violet`},closed:{label:`Closed`,hint:`closed without merging — the work did not land`,tone:`danger`},open:{label:`Open`,hint:`still open on the tracker`,tone:`success`},completed:{label:`Closed as completed`,hint:`the issue was resolved`,tone:`violet`},"not-planned":{label:`Closed as not planned`,hint:`the issue was declined — nothing shipped for it`,tone:`neutral`}},oc={label:`Merge conflicts`,hint:`this branch no longer merges cleanly into its base — rebase or merge the base in`,tone:`conflict`};function sc(e){return typeof e==`string`&&Object.hasOwn(ac,e)}function cc(e){return e!==void 0&&sc(e)?ac[e]:void 0}var lc=[`Pinned`,`Needs you`,`Working`,`Recent`,`Archived`],uc={waiting:0,review:1,running:2,queued:4,done:5,failed:6,cancelled:7},dc=3,fc=e=>e.status===`failed`&&e.autoResumeAt!==void 0?dc:uc[e.status]??9;function pc(e,t){return t===`archived`?`Archived`:e.pinned?`Pinned`:e.status===`waiting`||e.status===`review`?`Needs you`:e.status===`running`||e.status===`queued`||e.status===`failed`&&e.autoResumeAt?`Working`:`Recent`}function mc(e){let t=e.titleSummary;return t===void 0||!(e.titleOrigin===`user`||e.titleOrigin===`marker`)&&/[.!?][A-Z]/.test(t)?e.title:t}function hc(e){let t=/^(\d{1,9}): (.+)$/.exec(e),n=t?.[1],r=t?.[2];return n===void 0||r===void 0?{ref:null,rest:e}:{ref:Number(n),rest:r}}function gc(e,t){return t!==void 0&&hc(e).ref===t}function _c(e){return e.title.replace(/ \([A-C]\)$/,``)}function vc(e){let t=e.filter(e=>!e.archived&&e.status===`queued`).sort((e,t)=>e.createdAt.localeCompare(t.createdAt));return new Map(t.map((e,t)=>[e.id,t+1]))}function yc(e,t){return e.filter(e=>t===`archived`?e.archived:!e.archived).sort((e,n)=>{if(t!==`archived`){let t=Number(!!n.pinned)-Number(!!e.pinned);if(t!==0)return t}let r=fc(e)-fc(n);if(r!==0)return r;if(fc(e)===dc&&e.autoResumeAt&&n.autoResumeAt){let t=e.autoResumeAt.localeCompare(n.autoResumeAt);if(t!==0)return t}return e.status===`queued`&&n.status===`queued`?e.createdAt.localeCompare(n.createdAt):n.createdAt.localeCompare(e.createdAt)})}function bc(e,t){let n=vc(e),r=yc(e,t),i=new Map,a=(e,t)=>{let n=i.get(e);n?n.push(t):i.set(e,[t])},o=new Set;for(let e of r){if(e.groupId){if(o.has(e.groupId))continue;o.add(e.groupId);let n=r.filter(t=>t.groupId===e.groupId).sort((e,t)=>(e.variant??``).localeCompare(t.variant??``));if(n.length>1){a(pc(e,t),{kind:`group`,groupId:e.groupId,title:_c(e),members:n});continue}}a(pc(e,t),{kind:`run`,run:e,queuePosition:n.get(e.id)??null})}return lc.filter(e=>i.has(e)).map(e=>({label:e,rows:i.get(e)}))}function xc(e,t){let n=[],r=t;for(let t of e){if(t.label===`Pinned`){n.push({label:t.label,rows:[...t.rows]});continue}if(r<=0)continue;let e=t.rows.slice(0,r);r-=e.length,n.push({label:t.label,rows:e})}return n}function Sc(e){let t=0,n=0,r=0;for(let i of e){if(i.archived){n+=1;continue}t+=1,(i.status===`waiting`||i.status===`review`)&&(r+=1)}return{active:t,archived:n,waiting:r}}var Cc=new Set([`running`,`waiting`]),wc=new Set([`done`,`failed`,`review`,`cancelled`]),Tc=new Set([`done`,`failed`,`cancelled`]);function Ec(e){return e?e>=1024**3?`${(e/1024**3).toFixed(1)} GB`:e>=1024**2?`${Math.round(e/1024**2)} MB`:`${Math.round(e/1024)} kB`:``}function Dc(e){return e?`$${e>=10?e.toFixed(0):e.toFixed(2)}`:``}function Oc(e,t=new Date){if(e.status!==`failed`||!e.autoResumeAt)return;let n=new Date(e.autoResumeAt);if(!Number.isFinite(n.getTime()))return;let r=n.toDateString()===t.toDateString(),i=new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(n);return{label:r?i:`${new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(n)} ${i}`,title:`Resumes automatically at ${new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(n)}`}}function kc(e){if(e.workflow===`(planned)`||e.workflow===`(inbox)`){let t=e.steps.find(e=>e.kind===`agent`);if(t?.name)return t.name}return e.workflow}function Ac(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>[mc(e),e.branch??``,e.workflow,kc(e)].some(e=>e.toLowerCase().includes(n))):[...e]}function jc(e){return e.filter(e=>!e.archived&&Tc.has(e.status)).length}function Mc(e){if(!e)return;let t=e.trim().replace(/\/+$/,``),n=/^(?:https?|ssh|git|git\+ssh):\/\/(?:[^@/]+@)?([^/:]+)(?::\d+)?\/(.+)$/.exec(t),r=n?null:/^(?:[^@/:]+@)?([^:/]+):(.+)$/.exec(t),i=n??r;if(!i)return;let[,a,o]=i;if(!o||a?.toLowerCase()!==`github.com`)return;let s=o.replace(/\.git$/i,``).split(`/`).filter(Boolean),c=s[s.length-2],l=s[s.length-1];return c&&l?`https://github.com/${c}/${l}`:void 0}function Nc(e){return Pc(e)[0]?.url??Fc(e)[0]}function Pc(e,t){if(!e.prRefs?.length)return Fc(e).map(e=>({number:Number(Vc(e)),url:e,origin:`legacy`})).filter(e=>Number.isInteger(e.number)&&e.number>0);let n={created:0,marker:1,legacy:2,derived:3};return[...e.prRefs].sort((e,t)=>n[e.origin]-n[t.origin]).map(e=>({number:e.number,url:e.url??zc(`PR`,e.number,t),origin:e.origin}))}function Fc(e){let t=[];return e.pullRequestUrl&&t.push(e.pullRequestUrl),!(e.markerRefs?.issue!==void 0&&e.markerRefs?.pr===void 0)&&e.referencedPullRequestUrl&&t.push(e.referencedPullRequestUrl),t}function Ic(e,t){if(e.referencedIssueUrl)return e.referencedIssueUrl;let n=e.markerRefs?.issue??e.issueNumber;if(!(!n||!t))return`${t}/issues/${n}`}function Lc(e,t){return e.map((e,t)=>({reference:e,index:t})).sort((e,n)=>{let r=e.reference.kind===`PR`&&t(e.reference)===`closed`,i=n.reference.kind===`PR`&&t(n.reference)===`closed`;return Number(r)-Number(i)||e.index-n.index}).map(({reference:e})=>e)}function Rc(e,t){let n=e.prRefs?.length?Pc(e,t).map(e=>({number:e.number,url:e.url})):Fc(e).map(e=>({url:e,number:Number(Vc(e))||void 0})),r=e.markerRefs?.pr,i=[...r===void 0||n.some(e=>e.number===r)?[]:[{kind:`PR`,number:r}],...n.map(e=>({kind:`PR`,url:e.url,number:e.number})),{kind:`PR`,number:e.prNumber},{kind:`Issue`,url:Ic(e,t)},{kind:`Issue`,number:e.issueNumber}],a=new Set,o=[];for(let e of i){let n=e.url?Number(Vc(e.url)):e.number;if(!n||!Number.isInteger(n))continue;let r=e.url??zc(e.kind,n,t),i=o.findIndex(t=>t.kind===e.kind&&t.number===n&&(!t.url||!r||t.url===r));if(i>=0){!o[i].url&&r&&(o[i]={...o[i],url:r});continue}let s=`${e.kind}#${n}#${r??``}`;a.has(s)||(a.add(s),o.push({kind:e.kind,number:n,...r?{url:r}:{}}))}return o}function zc(e,t,n){if(n)return`${n}/${e===`PR`?`pull`:`issues`}/${t}`}function Bc(e){return Rc(e)[0]}function Vc(e){let t=e.split(`/`).pop()??``;return/^\d+$/.test(t)?t:null}function Hc(e,t){let n=Cc.has(e.status)?t:void 0;if(n)return{cpu:{text:`${n.cpuPct.toFixed(0)}%`,kind:`live`},mem:{text:Ec(n.rssBytes),kind:`live`}};let r=Ec(e.peakRssBytes);return{cpu:{text:``,kind:`none`},mem:r?{text:`peak ${r}`,kind:`peak`,title:`peak — run finished${e.peakProcCount?` · ${e.peakProcCount} procs`:``}`}:{text:``,kind:`none`}}}function Uc(e,t){let n=e.filter(e=>t===`archived`?e.archived:!e.archived),r=new Map;for(let e of n){if(!e.groupId)continue;let t=r.get(e.groupId);t?t.push(e):r.set(e.groupId,[e])}return[...r.entries()].flatMap(([e,t])=>{let n=t[0];return!n||t.length<2||!t.every(e=>wc.has(e.status))?[]:[{groupId:e,title:_c(n),count:t.length}]})}function Wc(e){let t=new Map;for(let n of e)for(let e of n.tags??[]){let n=e.toLowerCase();t.has(n)||t.set(n,e)}return[...t.values()].sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:`base`}))}function Gc(e,t,n,r=8){let i=n.trim().toLowerCase(),a=new Set(t.map(e=>e.toLowerCase())),o=e.filter(e=>{let t=e.toLowerCase();return a.has(t)?!1:i===``||t.includes(i)&&t!==i});return i===``?o.slice(0,r):o.sort((e,t)=>Number(t.toLowerCase().startsWith(i))-Number(e.toLowerCase().startsWith(i))||e.localeCompare(t,void 0,{sensitivity:`base`})).slice(0,r)}function Kc(e){let t=new Map;for(let n of e){let e=n.trim();if(!e)continue;let r=e.toLowerCase();t.has(r)||t.set(r,e)}return[...t.values()].sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:`base`}))}var qc=`/api/v1/ws`,Jc=3e3,Yc=1e3,Xc=7e4,Zc=0,Qc=1;function $c(e){let t=new Map,n=new Map,r=null,i,a,o,s=()=>{clearTimeout(o),o=setTimeout(()=>{o=void 0,r?.close()},Xc)},c=()=>e??`${location.protocol===`https:`?`wss:`:`ws:`}//${location.host}${qc}`,l=e=>{r?.readyState===Qc&&r.send(JSON.stringify(e))},u=()=>{let e=globalThis.WebSocket;if(typeof e!=`function`||r&&(r.readyState===Zc||r.readyState===Qc))return;let a=new e(c());r=a,a.addEventListener(`open`,()=>{if(a===r){s();for(let e of t.keys())l({type:`subscribe`,topic:e})}}),a.addEventListener(`message`,e=>{if(a!==r)return;s();let i;try{i=JSON.parse(e.data)}catch{return}if(typeof i!=`object`||!i)return;let{type:o,topic:c,data:l}=i;if(typeof c!=`string`)return;if(o===`error`){for(let e of[...n.get(c)??[]])e();return}if(o!==`event`)return;let u=t.get(c);if(u)for(let e of[...u])e(l)}),a.addEventListener(`close`,()=>{a===r&&(r=null,clearTimeout(o),o=void 0,t.size>0&&i===void 0&&(i=setTimeout(()=>{i=void 0,t.size>0&&u()},Jc)))}),a.addEventListener(`error`,()=>void 0)};return{subscribe(e,s,c){let d=()=>c?.();c&&(n.has(e)||n.set(e,new Set),n.get(e).add(d));let f=t.get(e);f||(f=new Set,t.set(e,f));let p=f.size===0;f.add(s),clearTimeout(a),a=void 0,r?p&&l({type:`subscribe`,topic:e}):(clearTimeout(i),i=void 0,u());let m=!0;return()=>{m&&(m=!1,n.get(e)?.delete(d),n.get(e)?.size||n.delete(e),f.delete(s),!(f.size>0)&&(t.delete(e),l({type:`unsubscribe`,topic:e}),t.size===0&&a===void 0&&(a=setTimeout(()=>{a=void 0,!(t.size>0)&&(clearTimeout(i),i=void 0,clearTimeout(o),o=void 0,r?.close(),r=null)},Yc))))}}}}var el=null;function tl(e,t,n){return el??=$c(),el.subscribe(e,t,n)}var q={tracker:{allFor:e=>[`tracker`,e],all:()=>[`tracker`,l()],associationFor:e=>[`tracker`,e,`association`],association:()=>[`tracker`,l(),`association`],candidates:(e,t=``)=>[`tracker`,l(),`candidates`,e,t],connection:()=>[`tracker`,l(),`connection`],items:(e,t)=>[`tracker`,l(),`items`,e.kind,e.source.id,e.source.webUrl,e.externalId,e.connectionId??null,t.state,[...t.labels],t.query??``],detail:(e,t)=>[`tracker`,l(),`detail`,e.kind,e.source.id,e.source.webUrl,e.externalId,e.connectionId??null,t]},get health(){return[l(),`health`]},runs:{get all(){return[l(),`runs`]},list:()=>[l(),`runs`,`list`],detail:e=>[l(),`runs`,`detail`,e],diff:e=>[l(),`runs`,`diff`,e],changes:e=>[l(),`runs`,`changes`,e],file:(e,t)=>[l(),`runs`,`files`,e,t],handoff:e=>[l(),`runs`,`handoff`,e],drafts:e=>[l(),`runs`,`drafts`,e],commits:e=>[l(),`runs`,`commits`,e],commit:(e,t)=>[l(),`runs`,`commit`,e,t]},groups:{detail:e=>[l(),`groups`,e]},get todos(){return[l(),`todos`]},get workflows(){return[l(),`workflows`]},get skills(){return[l(),`skills`]},get skillsReady(){return[l(),`skills`,`ready`]},get importableSkills(){return[l(),`skills`,`importable`]},get importableSkillsReady(){return[l(),`skills`,`importable`,`ready`]},get launchKey(){return[l(),`launch-key`]},get repo(){return[l(),`repo`]},get repoChanges(){return[l(),`repo`,`changes`]},repoCommit:e=>[l(),`repo`,`commit`,e],get uiState(){return[l(),`ui-state`]},get config(){return[l(),`config`]},get agentConfig(){return[l(),`agent-config`]},agentConfigFile:e=>[l(),`agent-config`,`file`,e],get worktrees(){return[l(),`worktrees`]},github:(e={})=>[l(),`github`,e.limit??null],githubChecks:e=>[l(),`github`,`checks`,[...e].sort((e,t)=>e-t).join(`,`)],githubSearch:(e,t)=>[l(),`github`,`search`,e,t],githubRefStatus:(e,t,n)=>[e,`github`,`ref-status`,[...t].sort((e,t)=>e-t).join(`,`),[...n].sort((e,t)=>e-t).join(`,`)],githubComments:(e,t)=>[l(),`github`,`comments`,e,t],githubMergeState:e=>[l(),`github`,`merge-state`,e],get openTargets(){return[l(),`open-targets`]}},nl=6e4;function rl(){return M({queryKey:q.tracker.connection(),queryFn:({signal:e})=>Ya({signal:e})})}function il(){return M({queryKey:q.tracker.association(),queryFn:({signal:e})=>Qa({signal:e})})}function al(e,t,n){return Mt({queryKey:q.tracker.candidates(e,t),staleTime:nl,queryFn:({pageParam:n,signal:r})=>$a(e,{q:t.trim()||void 0,cursor:n,limit:50},{signal:r}),initialPageParam:void 0,getNextPageParam:e=>e.available&&e.truncated?e.nextCursor:void 0,enabled:n})}var ol=class extends Error{failure;constructor(e){super(e.reason),this.failure=e,this.name=`TrackerRefreshError`}};function sl(e,t,n=!0){let r=t.query.trim(),i=j(),a=e?q.tracker.items(e,{...t,query:r}):[`tracker`,l(),`items`,`unassociated`];return{...Mt({queryKey:a,staleTime:1/0,queryFn:({pageParam:n,signal:i})=>r?io(r,{association:e??void 0,cursor:n,limit:50,state:t.state,labels:t.labels,refresh:!0},{signal:i}):ro({association:e??void 0,cursor:n,limit:50,state:t.state,labels:t.labels,refresh:!1},{signal:i}),initialPageParam:void 0,getNextPageParam:e=>e.available&&e.truncated?e.nextCursor:void 0,enabled:e!=null&&n}),queryKey:a,restart:async()=>{await i.cancelQueries({queryKey:a,exact:!0});try{await i.fetchInfiniteQuery({queryKey:a,initialPageParam:void 0,pages:1,getNextPageParam:e=>e.available&&e.truncated?e.nextCursor:void 0,staleTime:0,retry:!1,queryFn:async({signal:n})=>{let i={association:e??void 0,limit:50,state:t.state,labels:t.labels,refresh:!0},a=r?await io(r,i,{signal:n}):await ro(i,{signal:n});if(!a.available)throw new ol(a);return a}})}catch{}}}}function cl(e,t){return M({staleTime:nl,queryKey:e&&t?q.tracker.detail(e,t):[`tracker`,l(),`detail`,`disabled`],queryFn:({signal:n})=>ao(t,{signal:n,association:e??void 0}),enabled:e!=null&&t!=null&&t!==``})}var J={dashboard:[`workspace`,`dashboard`],models:e=>[`workspace`,`models`,e],providerStatus:[`workspace`,`providers`,`status`],projects:[`workspace`,`projects`],runsIndex:[`workspace`,`runs-index`],uiState:[`workspace`,`ui-state`],config:[`workspace`,`config`],hostUsage:[`workspace`,`host-usage`],agentProfiles:[`workspace`,`agent-profiles`],agentAccountDetails:e=>[`workspace`,`agent-profiles`,`details`,e],agentAccountStatus:e=>[`workspace`,`agent-profiles`,`status`,e],skillsUpdate:e=>[`workspace`,`skills-update`,e],selfUpdate:[`workspace`,`self-update`],selfUpdateDevelopment:[`workspace`,`self-update`,`development`],starCount:[`workspace`,`star-count`],fsBrowseRoot:[`workspace`,`fs-browse`],fsBrowse:(e,t=!1)=>[...J.fsBrowseRoot,e,t]};function Y(e,t=!0){return M({queryKey:J.models(e),queryFn:({signal:t})=>i(e)?va(e,{signal:t}):Promise.reject(Error(`${e} has no host model catalog`)),staleTime:300*1e3,enabled:t&&i(e)})}function ll(e=!0){let t=Y(`claude`,e),n=Y(`codex`,e),r=Y(`opencode`,e),i=Y(`cursor`,e),a=Y(`pi`,e);return{claude:t,codex:n,junie:Y(`junie`,e),opencode:r,cursor:i,pi:a,copilot:Y(`copilot`,e)}}function ul(){let e=j();return M({queryKey:J.providerStatus,queryFn:async({signal:t})=>{let n=e.getQueryData(J.providerStatus),r=await ya(!1,{signal:t});return Ji(n,e.getQueryData(J.providerStatus),r)},staleTime:5*6e4,refetchInterval:!1,refetchOnWindowFocus:!0})}function dl(){let e=j();return N({mutationFn:()=>ya(!0),onMutate:()=>e.getQueryData(J.providerStatus),onSuccess:(t,n,r)=>e.setQueryData(J.providerStatus,e=>Ji(r,e,t))})}function fl(){let e=j();return N({mutationFn:({provider:e,authFailureId:t})=>So(e,t),onMutate:()=>e.getQueryData(J.providerStatus),onSuccess:(t,n,r)=>{e.setQueryData(J.providerStatus,e=>Ji(r,e,t,n.authFailureId))}})}function pl(){return M({queryKey:J.projects,queryFn:({signal:e})=>xa({signal:e})})}function ml(e,t=!1){return M({queryKey:J.fsBrowse(e,t),queryFn:({signal:n})=>Sa(e??void 0,{signal:n,showHidden:t}),retry:!1})}function hl(){let e=j();return N({mutationFn:e=>Co(e),onSuccess:()=>e.invalidateQueries({queryKey:J.projects})})}function gl(){let e=j();return N({mutationFn:e=>To(e),retry:!1,onSuccess:()=>{e.invalidateQueries({queryKey:J.projects})}})}function _l(){let e=j();return N({mutationFn:e=>{let{id:t,...n}=e;return Eo(t,n)},retry:!1,onMutate:async({id:t,...n})=>{await e.cancelQueries({queryKey:J.projects});let r=e.getQueryData(J.projects);return e.setQueryData(J.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t?vl(e,n):e)}),{previous:r}},onError:(t,n,r)=>{r?.previous&&e.setQueryData(J.projects,r.previous)},onSuccess:({project:t})=>{e.setQueryData(J.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t.id?t:e)})},onSettled:()=>e.invalidateQueries({queryKey:J.projects})})}function vl(e,t){let{maxParallel:n,tags:r,...i}=e,a={...i},o=`maxParallel`in t?t.maxParallel:e.maxParallel;o!=null&&(a.maxParallel=o);let s=`tags`in t&&t.tags!==void 0?t.tags:e.tags,c=s==null?[]:Kc(s);return c.length>0&&(a.tags=c),a}function yl(e){let t=j();return N({mutationFn:e,retry:!1,onSuccess:async()=>{await Promise.all([t.invalidateQueries({queryKey:J.agentProfiles}),t.invalidateQueries({queryKey:J.projects})])}})}function bl(){return yl(e=>Ms(e))}function xl(){return yl(e=>{let{id:t,...n}=e;return Ls(t,n)})}function Sl(){return yl(e=>Rs(e))}function Cl(){return yl(e=>Is(e))}function wl(e,t){return M({queryKey:J.agentAccountDetails(e),queryFn:({signal:t})=>Ps(e,{signal:t}),enabled:t,staleTime:0,retry:!1})}function Tl(e,t){return M({queryKey:J.agentAccountStatus(e),queryFn:({signal:t})=>Ns(e,{signal:t}),enabled:t,staleTime:6e4,retry:!1})}function El(){let e=j();return N({mutationFn:({provider:e,profileId:t})=>bo(e,t),retry:!1,onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:J.agentProfiles}),e.invalidateQueries({queryKey:J.providerStatus})])}})}function Dl(){let e=j();return N({mutationFn:e=>Ns(e,{refresh:!0}),retry:!1,onSuccess:(t,n)=>{e.setQueryData(J.agentAccountStatus(n),t),e.invalidateQueries({queryKey:J.agentProfiles})}})}function Ol(){return N({mutationFn:e=>{let{routeId:t,...n}=e;return Fs(t,n)},retry:!1})}function kl(){let e=j();return N({mutationFn:e=>wo(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:J.projects})})}function Al(){let e=j();(0,k.useEffect)(()=>{let t,n=()=>{let n=e.getQueryData(q.health)?.capabilities?.localHandoff===!0;n&&t===void 0?t=tl(`health`,t=>{e.setQueryData(q.health,t)}):!n&&t!==void 0&&(t(),t=void 0)};n();let r=e.getQueryCache().subscribe(n);return()=>{r(),t?.()}},[e])}function jl(){return M({queryKey:q.health,queryFn:({signal:e})=>ga({signal:e})})}function Ml(){let e=jl().data,t=pl().data?.projects,{projectId:n}=rc(),r=n??e?.bootProject,i=r===void 0?void 0:t?.find(e=>e.id===r);return i?.repoUrl?i.repoUrl:n===null||n===e?.bootProject?Mc(e?.repo?.remote):void 0}function Nl(){return M({queryKey:q.openTargets,queryFn:({signal:e})=>Yo({signal:e}),staleTime:5*6e4})}function Pl(e){return M({queryKey:q.runs.list(),queryFn:({signal:e})=>Ca({signal:e}),select:e})}function Fl(e=!0,t){return M({queryKey:J.runsIndex,queryFn:({signal:e})=>Ta({signal:e}),enabled:e,staleTime:3e4,...t===void 0?{}:{refetchInterval:t}})}function Il(e,t=!0,n=!1,r){return M({queryKey:[n?`default`:e,`runs`,`list`],queryFn:({signal:t})=>wa(e,{signal:t}),enabled:t,select:r})}function Ll(e,t,n){let r=e==="default"?null:e,i=r===null||t!=null&&r===t;return Il(i?`default`:r??`default`,!0,i,n)}function Rl(e){return{queryKey:q.runs.detail(e),queryFn:({signal:t})=>Ea(e,{signal:t})}}function zl(e){return M({...Rl(e??``),enabled:!!e})}function Bl(e,t,n=!0){return M({queryKey:[e??`default`,`runs`,`detail`,t??``],queryFn:({signal:n})=>Da(e,t,{signal:n}),enabled:n&&!!e&&!!t})}function Vl(e){return M({queryKey:q.runs.diff(e??``),queryFn:({signal:t})=>mo(e,{signal:t}),enabled:!!e})}function Hl(e,t=!1){return M({queryKey:q.runs.changes(e??``),queryFn:({signal:t})=>go(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:t?4e3:!1,refetchOnWindowFocus:!0,staleTime:0})}function Ul(e,t){return M({queryKey:q.runs.file(e??``,t??``),queryFn:({signal:n})=>_o(e,t,{signal:n}),enabled:!!e&&t!==void 0,retry:!1})}function Wl(e){return M({queryKey:q.groups.detail(e??``),queryFn:({signal:t})=>yo(e,{signal:t}),enabled:!!e})}function Gl(e,t=!1){return M({queryKey:q.runs.commits(e??``),queryFn:({signal:t})=>Ga(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:t?5e3:!1})}function Kl(e,t){return M({queryKey:q.runs.commit(e??``,t??``),queryFn:({signal:n})=>Ka(e,t,{signal:n}),enabled:!!e&&!!t,retry:!1})}function ql(e,t=!0){return M({queryKey:q.runs.handoff(e??``),queryFn:({signal:t})=>ho(e,{signal:t}),enabled:!!e&&t})}function Jl(e){return M({queryKey:q.runs.drafts(e??``),queryFn:({signal:t})=>as(e,{signal:t}),enabled:!!e,staleTime:1/0,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:!1})}function Yl(e=!0){return M({queryKey:q.todos,queryFn:({signal:e})=>La({signal:e}),enabled:e})}function Xl(){return M({queryKey:q.workflows,queryFn:({signal:e})=>ja({signal:e})})}function Zl(e=!0){let t=j(),n=q.skills,r=n[0],i=M({queryKey:n,queryFn:({signal:e})=>Ma({signal:e}),enabled:e}),a=M({queryKey:q.skillsReady,queryFn:({signal:e})=>Na({signal:e}),enabled:e&&i.isSuccess,staleTime:1/0,retry:!1});return(0,k.useEffect)(()=>{Array.isArray(a.data)&&t.setQueryData([r,`skills`],a.data)},[t,a.data,r]),i}function Ql(e=!0){let t=j(),n=q.importableSkills,r=n[0],i=M({queryKey:n,queryFn:({signal:e})=>Fa({signal:e}),enabled:e}),a=M({queryKey:q.importableSkillsReady,queryFn:({signal:e})=>Ia({signal:e}),enabled:e&&i.isSuccess,staleTime:1/0,retry:!1});return(0,k.useEffect)(()=>{Array.isArray(a.data)&&t.setQueryData([r,`skills`,`importable`],a.data)},[t,a.data,r]),i}function $l(){return M({queryKey:q.launchKey,queryFn:({signal:e})=>ba({signal:e}),staleTime:1/0})}function eu(){return M({queryKey:q.repo,queryFn:({signal:e})=>Ra({signal:e})})}function tu(){return M({queryKey:q.repoChanges,queryFn:({signal:e})=>Ua({signal:e}),retry:!1})}function nu(e){return M({queryKey:q.repoCommit(e??``),queryFn:({signal:t})=>Wa(e,{signal:t}),enabled:!!e,retry:!1})}function ru(){return M({queryKey:q.config,queryFn:({signal:e})=>za({signal:e})})}function iu(){return M({queryKey:q.worktrees,queryFn:({signal:e})=>Ys({signal:e})})}function au(){return M({queryKey:q.uiState,queryFn:({signal:e})=>Aa({signal:e})})}function ou(){return M({queryKey:q.agentConfig,queryFn:({signal:e})=>Ba({signal:e})})}function su(e){return M({queryKey:q.agentConfigFile(e??``),queryFn:({signal:t})=>Va(e,{signal:t}),enabled:e!==null})}function cu(e){let t=j(),n=q.agentConfig,r=q.agentConfigFile(e);return N({mutationFn:t=>Ha(e,t),onSuccess:e=>{t.setQueryData(r,e),t.invalidateQueries({queryKey:n})}})}function lu(){return M({queryKey:J.uiState,queryFn:({signal:e})=>Ds({signal:e})})}function uu(){return M({queryKey:J.config,queryFn:({signal:e})=>ks({signal:e})})}function du(){return M({queryKey:J.agentProfiles,queryFn:({signal:e})=>js({signal:e})})}function fu(){return M({queryKey:J.starCount,queryFn:({signal:e})=>_a({signal:e}),staleTime:1/0,retry:!1,refetchOnMount:!1})}function pu(e,t=!0){return M({queryKey:J.skillsUpdate(e),queryFn:({signal:t})=>zs(e,{signal:t}),enabled:t,refetchInterval:e=>{let t=e.state.data?.status;return t===void 0||t===`idle`||t===`checking`||t===`updating`?6e4:!1}})}function mu(e=!0){return M({queryKey:J.selfUpdate,queryFn:({signal:e})=>Hs({signal:e}),enabled:e,refetchInterval:e=>e.state.data?.job?.status===`running`&&1e3})}function hu(e=!0){return M({queryKey:J.selfUpdateDevelopment,queryFn:({signal:e})=>Ws({signal:e}),enabled:e,staleTime:3e4})}function gu(){let e=j();return N({mutationFn:()=>Ws({refresh:!0}),onSuccess:t=>e.setQueryData(J.selfUpdateDevelopment,t)})}function _u(){let e=j();return N({mutationFn:()=>Us(),onSuccess:t=>e.setQueryData(J.selfUpdate,t)})}function vu(){let e=j();return N({mutationFn:e=>Gs(e),onSuccess:t=>e.setQueryData(J.selfUpdate,t)})}function yu(){let e=j();return N({mutationFn:e=>Ks(e),onSuccess:t=>e.setQueryData(J.selfUpdate,t)})}function bu(e){let t=j();return N({mutationFn:t=>Uo(e,t),onSuccess:e=>{xu(t,e),t.invalidateQueries({queryKey:q.runs.all})}})}function xu(e,t){e.setQueryData(q.runs.list(),e=>e?.map(e=>e.id===t.id?ra(e,t):e)),e.setQueryData(q.runs.detail(t.id),e=>e?ra(e,t):t),Su(e)}function Su(e){e.invalidateQueries({queryKey:J.runsIndex})}function Cu(){let e=j();return N({mutationFn:e=>Io(e),onMutate:async t=>{await e.cancelQueries({queryKey:q.runs.list()}),await e.cancelQueries({queryKey:q.runs.detail(t)});let n=e.getQueryData(q.runs.list()),r=e.getQueryData(q.runs.detail(t)),i=new Date().toISOString();return e.setQueryData(q.runs.list(),e=>e?.map(e=>e.id===t?{...e,seenAt:i}:e)),e.setQueryData(q.runs.detail(t),e=>e&&{...e,seenAt:i}),{prevList:n,prevDetail:r,id:t}},onError:(t,n,r)=>{r?.prevList&&e.setQueryData(q.runs.list(),r.prevList),r?.prevDetail&&e.setQueryData(q.runs.detail(n),r.prevDetail)},onSuccess:t=>{let n=e=>e.id===t.id?{...e,seenAt:t.seenAt}:e;e.setQueryData(q.runs.list(),e=>e?.map(n)),e.setQueryData(q.runs.detail(t.id),e=>e?n(e):t),Su(e)}})}function wu(){let e=j();return N({mutationFn:e=>Lo(e),onMutate:async t=>{await e.cancelQueries({queryKey:q.runs.list()}),await e.cancelQueries({queryKey:q.runs.detail(t)});let n=e.getQueryData(q.runs.list()),r=e.getQueryData(q.runs.detail(t));return e.setQueryData(q.runs.list(),e=>e?.map(e=>e.id===t?Tu(e):e)),e.setQueryData(q.runs.detail(t),e=>e&&Tu(e)),{prevList:n,prevDetail:r,id:t}},onError:(t,n,r)=>{r?.prevList&&e.setQueryData(q.runs.list(),r.prevList),r?.prevDetail&&e.setQueryData(q.runs.detail(n),r.prevDetail)},onSuccess:t=>{let n=e=>e.id===t.id?Tu(e):e;e.setQueryData(q.runs.list(),e=>e?.map(n)),e.setQueryData(q.runs.detail(t.id),e=>e?n(e):t),Su(e)}})}function Tu(e){let{seenAt:t,...n}=e;return n}function Eu(e,t){let n=j();return N({mutationFn:({id:t,pinned:n})=>e===void 0?Ao(t,n):jo(e,t,n),onSuccess:()=>n.invalidateQueries({queryKey:t===void 0?q.runs.all:[t,`runs`]})})}function Du(e,t){let n=j();return N({mutationFn:n=>t===void 0?ts(e,n):ns(t,e,n),onSuccess:()=>n.invalidateQueries({queryKey:q.runs.all}),onError:e=>{e instanceof H&&e.status===409&&n.invalidateQueries({queryKey:q.runs.all})}})}function Ou(e,t){let n=j();return N({mutationFn:(n={})=>t===void 0?Bo(e,n):Vo(t,e,n),onSuccess:()=>n.invalidateQueries({queryKey:q.runs.all})})}function ku(e){let t=j();return N({mutationFn:({msgId:t,message:n})=>rs(e,t,n),onSuccess:()=>t.invalidateQueries({queryKey:q.runs.all})})}function Au(e){let t=j();return N({mutationFn:t=>is(e,t),onSuccess:()=>t.invalidateQueries({queryKey:q.runs.all})})}function ju(e={},t=!0){return M({queryKey:q.github(e),queryFn:({signal:t})=>qa({limit:e.limit},{signal:t}),enabled:t})}function Mu(e,t=!0){return M({queryKey:q.githubChecks(e),queryFn:({signal:t})=>oo(e,{signal:t}),enabled:t&&e.length>0,staleTime:6e4})}function Nu(e,t,n=!0){return M({queryKey:q.githubSearch(e,t),queryFn:({signal:n})=>so(e,t,{},{signal:n}),enabled:n&&t.trim()!==``,staleTime:6e4})}var Pu=100;function Fu(e){return[...e].sort((e,t)=>t-e).slice(0,Pu).sort((e,t)=>e-t)}var X=new Map(Vu()),Iu=1e3;function Lu(e,t){if(X.get(e)!==t){for(X.delete(e),X.set(e,t);X.size>Iu;){let e=X.keys().next().value;if(e===void 0)break;X.delete(e)}Wu()}}var Z=new Set(Hu());function Ru(e,t){if(Z.has(e)!==t){if(t)for(Z.add(e);Z.size>Iu;){let e=Z.values().next().value;if(e===void 0)break;Z.delete(e)}else Z.delete(e);Wu()}}var zu=`cez.reference-statuses.v1`,Bu=`cez.reference-conflicts.v1`;function Vu(){try{let e=globalThis.sessionStorage?.getItem(zu);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>Array.isArray(e)&&e.length===2&&typeof e[0]==`string`&&sc(e[1])):[]}catch{return[]}}function Hu(){try{let e=globalThis.sessionStorage?.getItem(Bu);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}var Uu;function Wu(){Uu===void 0&&(Uu=setTimeout(()=>{Uu=void 0;try{globalThis.sessionStorage?.setItem(zu,JSON.stringify([...X])),globalThis.sessionStorage?.setItem(Bu,JSON.stringify([...Z]))}catch{}},250))}function Gu(){let e=rc(),t=jl();return e.projectId??t.data?.bootProject}function Ku(e){for(let[t,n]of Object.entries(e)){for(let[e,r]of Object.entries(n.prs))Lu(Yu({projectId:t,kind:`PR`,number:Number(e)}),r);for(let[e,r]of Object.entries(n.issues))Lu(Yu({projectId:t,kind:`Issue`,number:Number(e)}),r)}}var qu=5*6e4;function Ju(e){return e?e.recheckAfterMs:qu}var Yu=e=>`${e.projectId}\u0000${e.kind}#${e.number}`;function Xu(e,t=!0){let n=(0,k.useMemo)(()=>{let t=new Map;for(let n of e){let e=t.get(n.projectId)??{prs:new Set,issues:new Set};e[n.kind===`PR`?`prs`:`issues`].add(n.number),t.set(n.projectId,e)}return[...t.entries()].map(([e,t])=>({projectId:e,prs:Fu(t.prs),issues:Fu(t.issues)}))},[e.map(Yu).sort().join(`|`)]),r=At({queries:n.map(e=>({queryKey:q.githubRefStatus(e.projectId,e.prs,e.issues),queryFn:({signal:t})=>co(e.projectId,{prs:e.prs,issues:e.issues},{signal:t}),enabled:t&&e.prs.length+e.issues.length>0,staleTime:e=>Ju(e.state.data)??1/0,refetchInterval:e=>Ju(e.state.data)??!1,refetchOnWindowFocus:!0}))}),i=(0,k.useMemo)(()=>{let e=new Map;return r.forEach((t,r)=>{let i=n[r];if(!i)return;let a=[...i.prs.map(e=>({projectId:i.projectId,kind:`PR`,number:e})),...i.issues.map(e=>({projectId:i.projectId,kind:`Issue`,number:e}))],o=t.data;for(let n of a){let r=Yu(n),i=X.get(r),a=Z.has(r)?!0:void 0;if(o?.available){let t=o.prs[n.number]??o.issues[n.number];if(t){let i=o.conflicts?o.conflicts.includes(n.number):void 0;Lu(r,t),i!==void 0&&Ru(r,i),e.set(r,{state:`ready`,status:t,...i??a?{conflicting:!0}:{}})}else e.set(r,{state:`unknown`,...i?{status:i}:{}})}else o?e.set(r,{state:`unavailable`,reason:o.reason,...i?{status:i}:{},...a?{conflicting:!0}:{}}):t.isError?e.set(r,{state:`unavailable`,reason:t.error instanceof Error?t.error.message:void 0,...i?{status:i}:{},...a?{conflicting:!0}:{}}):e.set(r,{state:`loading`,...i?{status:i}:{},...a?{conflicting:!0}:{}})}}),e},[n,r.map(e=>`${e.dataUpdatedAt}:${e.status}`).join(`,`)]);return(0,k.useCallback)(e=>{let t=Yu(e),n=i.get(t);if(n)return n;let r=X.get(t);return{state:`idle`,...r?{status:r}:{},...Z.has(t)?{conflicting:!0}:{}}},[i])}function Zu(e,t,n=!0){return M({queryKey:q.githubComments(e,t),queryFn:({signal:n})=>lo(e,t,{},{signal:n}),enabled:n,staleTime:6e4})}function Qu(e){return M({queryKey:[`github`,`pr-changes`,e??0],queryFn:({signal:t})=>po(e,{},{signal:t}),enabled:e!==void 0,staleTime:6e4,retry:!1})}var $u=m(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),ed=e(n(),1),td=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,nd=y,rd=(e,t)=>n=>{if(t?.variants==null)return nd(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=td(t)||td(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return nd(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)};function id(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function ad(...e){return t=>{let n=!1,r=e.map(e=>{let r=id(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():id(e[t],null)}}}}function od(...e){return k.useCallback(ad(...e),e)}function sd(e){let t=k.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];gd(r)&&typeof bd==`function`&&(r=bd(r._payload)),k.Children.forEach(r,e=>{if(md(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;gd(n)&&typeof bd==`function`&&(n=bd(n._payload)),a=dd(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=k.cloneElement(a,void 0,s):!o&&k.Children.count(r)===1&&k.isValidElement(r)&&(a=r);let c=a?pd(a):void 0,l=od(n,c);if(!a){if(r||r===0)throw Error(o?yd(e):vd(e));return r}let u=fd(i,a.props??{});return a.type!==k.Fragment&&(u.ref=n?l:c),k.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}var cd=sd(`Slot`),ld=Symbol.for(`radix.slottable`);function ud(e){let t=e=>`child`in e?e.children(e.child):e.children;return t.displayName=`${e}.Slottable`,t.__radixId=ld,t}var dd=(e,t)=>{if(`child`in e.props){let t=e.props.child;return k.isValidElement(t)?k.cloneElement(t,void 0,e.props.children(t.props.children)):null}return k.isValidElement(t)?t:null};function fd(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function pd(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function md(e){return k.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===ld}var hd=Symbol.for(`react.lazy`);function gd(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===hd&&`_payload`in e&&_d(e._payload)}function _d(e){return typeof e==`object`&&!!e&&`then`in e}var vd=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,yd=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,bd=k.use,xd=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=sd(`Primitive.${t}`),r=k.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,A.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Sd(e,t){e&&ed.flushSync(()=>e.dispatchEvent(t))}function Cd(e,t=[]){let n=[];function r(t,r){let i=k.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=k.useMemo(()=>o,Object.values(o));return(0,A.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,u=k.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>k.createContext(e));return function(n){let r=n?.[e]||t;return k.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,wd(i,...t)]}function wd(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return k.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}typeof window<`u`&&window.document&&window.document.createElement;function Td(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)}}var Ed=globalThis?.document?k.useLayoutEffect:()=>{},Dd=k.useInsertionEffect||Ed;function Od({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=kd({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=k.useRef(e!==void 0);k.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,k.useCallback(t=>{if(s){let n=Ad(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function kd({defaultProp:e,onChange:t}){let[n,r]=k.useState(e),i=k.useRef(n),a=k.useRef(t);return Dd(()=>{a.current=t},[t]),k.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function Ad(e){return typeof e==`function`}function jd(e,t){return k.useReducer((e,n)=>t[e][n]??e,e)}var Md=e=>{let{present:t,children:n}=e,r=Nd(t),i=typeof n==`function`?n({present:r.isPresent}):k.Children.only(n),a=Fd(r.ref,Ld(i));return typeof n==`function`||r.isPresent?k.cloneElement(i,{ref:a}):null};Md.displayName=`Presence`;function Nd(e){let[t,n]=k.useState(),r=k.useRef(null),i=k.useRef(e),a=k.useRef(`none`),o=k.useRef(void 0),[s,c]=jd(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return k.useEffect(()=>{s===`mounted`?(a.current=o.current??Id(r.current),o.current=void 0):a.current=`none`},[s]),Ed(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=Id(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),Ed(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=Id(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},s=e=>{e.target===t&&(a.current=Id(r.current))};return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:k.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=Id(t)}else r.current=null;n(e)},[])}}function Pd(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Fd(...e){let t=k.useRef(e);return t.current=e,k.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=Pd(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():Pd(n[e],null)}}},[])}function Id(e){return e?.animationName||`none`}function Ld(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Rd=k.useId||(()=>void 0),zd=0;function Bd(e){let[t,n]=k.useState(Rd());return Ed(()=>{e||n(e=>e??String(zd++))},[e]),e||(t?`radix-${t}`:``)}function Vd(e){let t=k.useRef(e);return k.useEffect(()=>{t.current=e}),k.useMemo(()=>((...e)=>t.current?.(...e)),[])}var Hd=`DismissableLayer`,Ud=`dismissableLayer.update`,Wd=`dismissableLayer.pointerDownOutside`,Gd=`dismissableLayer.focusOutside`,Kd,qd=k.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Jd=k.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=k.useContext(qd),[d,f]=k.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=k.useState({}),h=od(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=_?g.indexOf(_):-1,y=d?g.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,S=k.useRef(!1),ee=$d(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:S,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:k.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return x&&!t},[u.branches,x])}),C=ef(e=>{if(r&&S.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),te=d?y===g.length-1:!1,ne=Vd(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return k.useEffect(()=>{if(te)return p.addEventListener(`keydown`,ne,{capture:!0}),()=>p.removeEventListener(`keydown`,ne,{capture:!0})},[p,te,ne]),k.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Kd=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),tf(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=Kd))}},[d,p,n,u]),k.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),tf())},[d,u]),k.useEffect(()=>{let e=()=>m({});return document.addEventListener(Ud,e),()=>document.removeEventListener(Ud,e)},[]),(0,A.jsx)(xd.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:Td(e.onFocusCapture,C.onFocusCapture),onBlurCapture:Td(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:Td(e.onPointerDownCapture,ee.onPointerDownCapture)})});Jd.displayName=Hd;var Yd=`DismissableLayerBranch`,Xd=k.forwardRef((e,t)=>{let n=k.useContext(qd),r=k.useRef(null),i=od(t,r);return k.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,A.jsx)(xd.div,{...e,ref:i})});Xd.displayName=Yd;function Zd(){let e=k.useContext(qd),[t,n]=k.useState(null);return k.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}var Qd=()=>!0;function $d(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=Qd}=t,s=Vd(e),c=k.useRef(!1),l=k.useRef(!1),u=k.useRef(new Map),d=k.useRef(()=>{});return k.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}function t(){return Array.from(u.current.values()).some(Boolean)}function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}function p(e){l.current&&u.current.set(e.type,!1)}let m=a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||nf(Wd,s,p,{discrete:!0})};if(!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:()=>c.current=!0}}function ef(e,t=globalThis?.document){let n=Vd(e),r=k.useRef(!1);return k.useEffect(()=>{let e=e=>{e.target&&!r.current&&nf(Gd,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function tf(){let e=new CustomEvent(Ud);document.dispatchEvent(e)}function nf(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Sd(i,a):i.dispatchEvent(a)}var rf=`focusScope.autoFocusOnMount`,af=`focusScope.autoFocusOnUnmount`,of={bubbles:!1,cancelable:!0},sf=`FocusScope`,cf=k.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=k.useState(null),l=Vd(i),u=Vd(a),d=k.useRef(null),f=od(t,c),p=k.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;k.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:Q(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||Q(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&Q(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),k.useEffect(()=>{if(s){hf.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(rf,of);s.addEventListener(rf,l),s.dispatchEvent(t),t.defaultPrevented||(lf(vf(df(s)),{select:!0}),document.activeElement===e&&Q(s))}return()=>{s.removeEventListener(rf,l),setTimeout(()=>{let t=new CustomEvent(af,of);s.addEventListener(af,u),s.dispatchEvent(t),t.defaultPrevented||Q(e??document.body,{select:!0}),s.removeEventListener(af,u),hf.remove(p)},0)}}},[s,l,u,p]);let m=k.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=uf(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&Q(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&Q(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,A.jsx)(xd.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});cf.displayName=sf;function lf(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(Q(r,{select:t}),document.activeElement!==n)return}function uf(e){let t=df(e);return[ff(t,e),ff(t.reverse(),e)]}function df(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ff(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):pf(r,{upTo:t})))return r}function pf(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function mf(e){return e instanceof HTMLInputElement&&`select`in e}function Q(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&mf(e)&&t&&e.select()}}var hf=gf();function gf(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=_f(e,t),e.unshift(t)},remove(t){e=_f(e,t),e[0]?.resume()}}}function _f(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function vf(e){return e.filter(e=>e.tagName!==`A`)}var yf=`Portal`,bf=k.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=k.useState(!1);Ed(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?ed.createPortal((0,A.jsx)(xd.div,{...r,ref:t}),o):null});bf.displayName=yf;var xf=0,Sf=null;function Cf(){k.useEffect(()=>{Sf||={start:wf(),end:wf()};let{start:e,end:t}=Sf;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),xf++,()=>{xf===1&&(Sf?.start.remove(),Sf?.end.remove(),Sf=null),xf=Math.max(0,xf-1)}},[])}function wf(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var $=function(){return $=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},$.apply(this,arguments)};function Tf(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Ef(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var Df=`right-scroll-bar-position`,Of=`width-before-scroll-bar`,kf=`with-scroll-bars-hidden`,Af=`--removed-body-scroll-bar-size`;function jf(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Mf(e,t){var n=(0,k.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var Nf=typeof window<`u`?k.useLayoutEffect:k.useEffect,Pf=new WeakMap;function Ff(e,t){var n=Mf(t||null,function(t){return e.forEach(function(e){return jf(e,t)})});return Nf(function(){var t=Pf.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||jf(e,null)}),i.forEach(function(e){r.has(e)||jf(e,a)})}Pf.set(n,e)},[e]),n}function If(e){return e}function Lf(e,t){t===void 0&&(t=If);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function Rf(e){e===void 0&&(e={});var t=Lf(null);return t.options=$({async:!0,ssr:!1},e),t}var zf=function(e){var t=e.sideCar,n=Tf(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return k.createElement(r,$({},n))};zf.isSideCarExport=!0;function Bf(e,t){return e.useMedium(t),zf}var Vf=Rf(),Hf=function(){},Uf=k.forwardRef(function(e,t){var n=k.useRef(null),r=k.useState({onScrollCapture:Hf,onWheelCapture:Hf,onTouchMoveCapture:Hf}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=Tf(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=Ff([n,t]),ee=$($({},b),i);return k.createElement(k.Fragment,null,u&&k.createElement(x,{sideCar:Vf,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?k.cloneElement(k.Children.only(s),$($({},ee),{ref:S})):k.createElement(v,$({},ee,{className:c,ref:S}),s))});Uf.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Uf.classNames={fullWidth:Of,zeroRight:Df};var Wf,Gf=function(){if(Wf)return Wf;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Kf(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Gf();return t&&e.setAttribute(`nonce`,t),e}function qf(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Jf(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var Yf=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Kf())&&(qf(t,n),Jf(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Xf=function(){var e=Yf();return function(t,n){k.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Zf=function(){var e=Xf();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Qf={left:0,top:0,right:0,gap:0},$f=function(e){return parseInt(e||``,10)||0},ep=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[$f(n),$f(r),$f(i)]},tp=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Qf;var t=ep(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},np=Zf(),rp=`data-scroll-locked`,ip=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
4
+ .${kf} {
5
+ overflow: hidden ${r};
6
+ padding-right: ${s}px ${r};
7
+ }
8
+ body[${rp}] {
9
+ overflow: hidden ${r};
10
+ overscroll-behavior: contain;
11
+ ${[t&&`position: relative ${r};`,n===`margin`&&`
12
+ padding-left: ${i}px;
13
+ padding-top: ${a}px;
14
+ padding-right: ${o}px;
15
+ margin-left:0;
16
+ margin-top:0;
17
+ margin-right: ${s}px ${r};
18
+ `,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
19
+ }
20
+
21
+ .${Df} {
22
+ right: ${s}px ${r};
23
+ }
24
+
25
+ .${Of} {
26
+ margin-right: ${s}px ${r};
27
+ }
28
+
29
+ .${Df} .${Df} {
30
+ right: 0 ${r};
31
+ }
32
+
33
+ .${Of} .${Of} {
34
+ margin-right: 0 ${r};
35
+ }
36
+
37
+ body[${rp}] {
38
+ ${Af}: ${s}px;
39
+ }
40
+ `},ap=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},op=function(){k.useEffect(function(){return document.body.setAttribute(rp,(ap()+1).toString()),function(){var e=ap()-1;e<=0?document.body.removeAttribute(rp):document.body.setAttribute(rp,e.toString())}},[])},sp=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;op();var a=k.useMemo(function(){return tp(i)},[i]);return k.createElement(np,{styles:ip(a,!t,i,n?``:`!important`)})},cp=!1;if(typeof window<`u`)try{var lp=Object.defineProperty({},"passive",{get:function(){return cp=!0,!0}});window.addEventListener(`test`,lp,lp),window.removeEventListener(`test`,lp,lp)}catch{cp=!1}var up=cp?{passive:!1}:!1,dp=function(e){return e.tagName===`TEXTAREA`},fp=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!dp(e)&&n[t]===`visible`)},pp=function(e){return fp(e,`overflowY`)},mp=function(e){return fp(e,`overflowX`)},hp=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),vp(e,r)){var i=yp(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},gp=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},_p=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},vp=function(e,t){return e===`v`?pp(t):mp(t)},yp=function(e,t){return e===`v`?gp(t):_p(t)},bp=function(e,t){return e===`h`&&t===`rtl`?-1:1},xp=function(e,t,n,r,i){var a=bp(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=yp(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&vp(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},Sp=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Cp=function(e){return[e.deltaX,e.deltaY]},wp=function(e){return e&&`current`in e?e.current:e},Tp=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Ep=function(e){return`
41
+ .block-interactivity-${e} {pointer-events: none;}
42
+ .allow-interactivity-${e} {pointer-events: all;}
43
+ `},Dp=0,Op=[];function kp(e){var t=k.useRef([]),n=k.useRef([0,0]),r=k.useRef(),i=k.useState(Dp++)[0],a=k.useState(Zf)[0],o=k.useRef(e);k.useEffect(function(){o.current=e},[e]),k.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Ef([e.lockRef.current],(e.shards||[]).map(wp),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=k.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Sp(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=hp(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=hp(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return xp(h,t,e,h===`h`?s:c,!0)},[]),c=k.useCallback(function(e){var n=e;if(!(!Op.length||Op[Op.length-1]!==a)){var r=`deltaY`in n?Cp(n):Sp(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Tp(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(wp).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=k.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Ap(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=k.useCallback(function(e){n.current=Sp(e),r.current=void 0},[]),d=k.useCallback(function(t){l(t.type,Cp(t),t.target,s(t,e.lockRef.current))},[]),f=k.useCallback(function(t){l(t.type,Sp(t),t.target,s(t,e.lockRef.current))},[]);k.useEffect(function(){return Op.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,up),document.addEventListener(`touchmove`,c,up),document.addEventListener(`touchstart`,u,up),function(){Op=Op.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,up),document.removeEventListener(`touchmove`,c,up),document.removeEventListener(`touchstart`,u,up)}},[]);var p=e.removeScrollBar,m=e.inert;return k.createElement(k.Fragment,null,m?k.createElement(a,{styles:Ep(i)}):null,p?k.createElement(sp,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Ap(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var jp=Bf(Vf,kp),Mp=k.forwardRef(function(e,t){return k.createElement(Uf,$({},e,{ref:t,sideCar:jp}))});Mp.classNames=Uf.classNames;var Np=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Pp=new WeakMap,Fp=new WeakMap,Ip={},Lp=0,Rp=function(e){return e&&(e.host||Rp(e.parentNode))},zp=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Rp(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Bp=function(e,t,n,r){var i=zp(t,Array.isArray(e)?e:[e]);Ip[n]||(Ip[n]=new WeakMap);var a=Ip[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(Pp.get(e)||0)+1,l=(a.get(e)||0)+1;Pp.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Fp.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),Lp++,function(){o.forEach(function(e){var t=Pp.get(e)-1,i=a.get(e)-1;Pp.set(e,t),a.set(e,i),t||(Fp.has(e)||e.removeAttribute(r),Fp.delete(e)),i||e.removeAttribute(n)}),Lp--,Lp||(Pp=new WeakMap,Pp=new WeakMap,Fp=new WeakMap,Ip={})}},Vp=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Np(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Bp(r,i,n,`aria-hidden`)):function(){return null}},Hp=rd(`inline-flex shrink-0 items-center justify-center gap-[7px] rounded-md font-semibold whitespace-nowrap transition-[background-color,border-color,opacity,filter] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{primary:`bg-primary text-primary-foreground hover:brightness-[0.96]`,contrast:`bg-contrast text-contrast-foreground hover:brightness-[0.96]`,outline:`border border-border bg-card hover:bg-muted`,ghost:`text-muted-foreground hover:bg-muted hover:text-foreground`,"danger-ghost":`text-danger hover:bg-danger/10`},size:{default:`h-9 px-3.5 text-[13.5px]`,sm:`h-[30px] rounded-sm px-2.5 text-[12.5px]`,icon:`size-9`,"icon-sm":`size-[30px] rounded-sm`}},defaultVariants:{variant:`primary`,size:`default`}});function Up({className:e,variant:t=`primary`,size:n=`default`,asChild:r=!1,...i}){return(0,A.jsx)(r?cd:`button`,{"data-slot":`button`,"data-variant":t,"data-size":n,className:g(Hp({variant:t,size:n,className:e})),...i})}var Wp=5e3,Gp=200,Kp=[],qp=1,Jp=new Set,Yp=new Set;function Xp(e){Kp=e;for(let e of Jp)e()}function Zp(e){return Jp.add(e),()=>Jp.delete(e)}function Qp(e,t){let n=setTimeout(()=>{Yp.delete(n),e()},t);Yp.add(n)}function $p(e,t={}){let n={id:qp++,message:e,tone:t.tone??`default`,...t.action?{action:t.action}:{},exiting:!1},r=t.durationMs??Wp;Xp([...Kp,n]),Qp(()=>{Xp(Kp.map(e=>e.id===n.id?{...e,exiting:!0}:e)),Qp(()=>Xp(Kp.filter(e=>e.id!==n.id)),Gp)},r)}function em(){let e=(0,k.useSyncExternalStore)(Zp,()=>Kp);return e.length===0?null:(0,A.jsx)(`div`,{"data-slot":`toaster`,className:`pointer-events-none fixed top-[calc(61px+env(safe-area-inset-top))] right-[calc(16px+env(safe-area-inset-right))] z-[60] flex flex-col items-end gap-2 md:top-[calc(16px+env(safe-area-inset-top))]`,children:e.map(e=>(0,A.jsxs)(`div`,{role:`status`,"data-slot":`toast`,"data-tone":e.tone,"data-state":e.exiting?`closed`:`open`,className:g(`pointer-events-auto max-w-[min(360px,calc(100vw-32px))] rounded-md px-3.5 py-2.5 text-[13px] font-medium shadow-modal`,`motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-right-4 motion-safe:duration-200`,`motion-safe:data-[state=closed]:animate-out motion-safe:data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:slide-out-to-right-4`,e.tone===`danger`?`bg-danger text-danger-foreground`:`bg-contrast text-contrast-foreground`),children:[e.message,e.action?(0,A.jsxs)(A.Fragment,{children:[` `,(0,A.jsx)(`a`,{"data-slot":`toast-action`,href:e.action.href,target:`_blank`,rel:`noopener noreferrer`,className:`font-semibold underline underline-offset-2 outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:e.action.label})]}):null]},e.id))})}export{Al as $,Ne as $i,bo as $n,Go as $r,cl as $t,q as A,Ar as Ai,_c as An,Ro as Ar,Kl as At,ru as B,j as Bi,rc as Bn,fs as Br,Fl as Bt,ud as C,Xi as Ci,Nc as Cn,ka as Cr,Au as Ct,$u as D,Er as Di,kc as Dn,ro as Dr,fl as Dt,rd as E,Si as Ei,Hc as En,ao as Er,nu as Et,ou as F,ki as Fi,yc as Fn,Jo as Fr,ql as Ft,ml as G,he as Gi,ko as Gn,Es as Gr,vu as Gt,Ou as H,Qe as Hi,Vs as Hn,es as Hr,mu as Ht,su as I,Mt as Ii,hc as In,Qs as Ir,ll as It,Zu as J,ye as Ji,U as Jn,$s as Jr,fu as Jt,ju as K,xe as Ki,Po as Kn,qs as Kr,Zl as Kt,du as L,N as Li,oc as Ln,ws as Lr,Y as Lt,Rl as M,B as Mi,vc as Mn,Xo as Mr,Vl as Mt,wl as N,Qn as Ni,gc as Nn,Qo as Nr,Jl as Nt,nl as O,Dr as Oi,xc as On,As as Or,zl as Ot,Tl as P,nr as Pi,mc as Pn,Zo as Pr,Ul as Pt,jl as Q,E as Qi,$o as Qn,Zs as Qr,rl as Qt,yu as R,M as Ri,cc as Rn,Uo as Rr,Pl as Rt,sd as S,Zi as Si,Ic as Sn,Oa as Sr,gl as St,od as T,xi as Ti,Rc as Tn,Ja as Tr,tu as Tt,bl as U,Ve as Ui,Fo as Un,Js as Ur,hu as Ut,El as V,ut as Vi,H as Vn,cs as Vr,Cl as Vt,ku as W,O as Wi,Mo as Wn,ss as Wr,Du as Wt,Nu as X,T as Xi,Bs as Xn,Pa as Xr,il as Xt,Qu as Y,ve as Yi,_s as Yn,Xs as Yr,Yl as Yt,Wl as Z,Se as Zi,to as Zn,ec as Zr,al as Zt,Td as _,Qi as _i,Dc as _n,uo as _r,dl as _t,Vp as a,Xa as ai,uu as an,Cs as ar,Nl as at,Sd as b,Wi as bi,Lc as bn,ls as br,hl as bt,bf as c,xo as ci,J as cn,us as cr,Ml as ct,Zd as d,hs as di,Wc as dn,vs as dr,pl as dt,de as ea,Za as ei,sl as en,Bo as er,Ql as et,Vd as f,ia as fi,Gc as fn,Ss as fr,ul as ft,Ed as g,ra as gi,jc as gn,po as gr,Xu as gt,Od as h,aa as hi,Ac as hn,lo as hr,Gu as ht,Hp as i,eo as ii,Xl as in,Ho as ir,Ol as it,Ku as j,un as ji,Sc as jn,fo as jr,Gl as jt,ol as k,Or as ki,bc as kn,Ds as kr,Hl as kt,cf as l,Ko as li,xu as ln,Ts as lr,Bl as lt,Md as m,ta as mi,Uc as mn,qa as mr,Dl as mt,$p as n,bs as ni,xl as nn,ds as nr,Cu as nt,Mp as o,gs as oi,lu as on,xs as or,bu as ot,Bd as p,na as pi,wc as pn,ps as pr,cu as pt,Mu as q,be as qi,Oo as qn,Os as qr,pu as qt,Up as r,vo as ri,_l as rn,Do as rr,wu as rt,Cf as s,No as si,iu as sn,Wo as sr,Eu as st,em as t,ue as ta,ys as ti,au as tn,ms as tr,$l as tt,Jd as u,G as ui,tl as un,zo as ur,Il as ut,Cd as v,Bi as vi,Ec as vn,ga as vr,_u as vt,ad as w,yi as wi,Bc as wn,Hs as wr,eu as wt,cd as x,Ki as xi,Oc as xn,_o as xr,Sl as xt,xd as y,qi as yi,Vc as yn,ba as yr,gu as yt,kl as z,_t as zi,ic as zn,qo as zr,Ll as zt};
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime-QTnfLwEv.js";import{i as e,t}from"./react-runtime-CCIEwYL0.js";import{E as n}from"./toaster-CfRVb8vH.js";import{t as r}from"./utils-BXvEm7Ve.js";e();var i=t(),a=n(`inline-block size-[7px] shrink-0 rounded-full`,{variants:{tone:{success:`bg-success`,pending:`bg-pending`,danger:`bg-danger`,violet:`bg-violet`,neutral:`bg-soft-foreground`},pulse:{true:`animate-pulse`,false:``}},defaultVariants:{tone:`neutral`,pulse:!1}});function o({className:e,tone:t=`neutral`,pulse:n=!1,...o}){return(0,i.jsx)(`span`,{"data-slot":`status-dot`,"data-tone":t,className:r(a({tone:t,pulse:n,className:e})),...o})}var s={permission:0,error:1,waiting:2,running:3,unseen:4,none:5};function c(e){return!1}function l(e){return!1}function u(e){let t=e.dispatch?.overBudget?e.dispatch.budgetUsd:void 0;if(!(e.status!==`waiting`||t===void 0))return{spent:e.costUsd??0,ceiling:t}}function d(e){return c(e)?{bucket:`permission`,tone:`violet`,pulse:!0,label:`needs permission`}:e.status===`failed`&&e.autoResumeAt?{bucket:`none`,tone:`pending`,pulse:!1,label:`scheduled`}:e.status===`failed`?{bucket:`error`,tone:`danger`,pulse:!1,label:`failed`}:e.status===`waiting`?{bucket:`waiting`,tone:`pending`,pulse:!0,label:u(e)?.ceiling===void 0?`needs you`:`budget reached`}:e.status===`review`?{bucket:`waiting`,tone:`violet`,pulse:!0,label:`needs review`}:e.status===`running`&&e.activity===`monitoring`?{bucket:`running`,tone:`violet`,pulse:!0,label:`monitoring`}:e.status===`running`?{bucket:`running`,tone:`violet`,pulse:!0,label:`running`}:l(e)?{bucket:`unseen`,tone:`violet`,pulse:!1,label:`unseen`}:e.status===`queued`?{bucket:`none`,tone:`neutral`,pulse:!1,label:`queued`}:e.status===`done`?{bucket:`none`,tone:`success`,pulse:!1,label:`done`}:{bucket:`none`,tone:`neutral`,pulse:!1,label:`cancelled`}}function f(e){return s[d(e).bucket]<=s.waiting}function p(e){let t=e?.capabilities,n=t?.tokenMetrics!==!1;return{tokens:t?.tokenUsageMetrics??n,cost:t?.costMetrics??n}}export{o as a,f as i,u as n,d as r,p as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{C as r,Ln as i,Rn as a,T as o,_ as s,c,gt as l,h as u,m as d,p as f,u as p,v as m,y as h}from"./toaster-CfRVb8vH.js";import{n as g,r as _,t as v}from"./utils-BXvEm7Ve.js";import{n as y,o as b,r as x,t as S}from"./popover-CNGONAql.js";import{n as C,t as w}from"./circle-x-C0Jm5Ppb.js";import{t as T}from"./git-pull-request-AhwzJc7s.js";import{t as ee}from"./triangle-alert-D5K_zyD3.js";import{a as E,i as D,n as te,r as ne,t as re}from"./dist-BqMwqJFX.js";import{a as ie}from"./token-metrics-DldVlr6m.js";var O=_(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),k=_(`circle-slash`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]]),ae=_(`git-merge`,[[`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`}]]),oe=_(`git-pull-request-closed`,[[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 9v12`,key:`1sc30k`}],[`path`,{d:`m21 3-6 6`,key:`16nqsk`}],[`path`,{d:`m21 9-6-6`,key:`9j17rh`}],[`path`,{d:`M18 11.5V15`,key:`65xf6f`}],[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}]]),se=_(`git-pull-request-draft`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M18 6V5`,key:`1oao2s`}],[`path`,{d:`M18 11v-1`,key:`11c8tz`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]),ce=_(`message-square-warning`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 15h.01`,key:`q59x07`}],[`path`,{d:`M12 7v4`,key:`xawao1`}]]),A=e(t(),1),j=n(),M=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),le=`VisuallyHidden`,N=A.forwardRef((e,t)=>(0,j.jsx)(h.span,{...e,ref:t,style:{...M,...e.style}}));N.displayName=le;var ue=N,[P,de]=m(`Tooltip`,[E]),F=E(),I=`TooltipProvider`,fe=700,L=`tooltip.open`,[pe,R]=P(I),z=e=>{let{__scopeTooltip:t,delayDuration:n=fe,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=A.useRef(!0),s=A.useRef(!1),c=A.useRef(0);return A.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,j.jsx)(pe,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:A.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:A.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:A.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};z.displayName=I;var B=`Tooltip`,[me,V]=P(B),H=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=R(B,e.__scopeTooltip),l=F(t),[d,p]=A.useState(null),m=f(),h=A.useRef(0),g=o??c.disableHoverableContent,_=s??c.delayDuration,v=A.useRef(!1),[y,b]=u({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(L))):c.onClose(),a?.(e)},caller:B}),x=A.useMemo(()=>y?v.current?`delayed-open`:`instant-open`:`closed`,[y]),S=A.useCallback(()=>{window.clearTimeout(h.current),h.current=0,v.current=!1,b(!0)},[b]),C=A.useCallback(()=>{window.clearTimeout(h.current),h.current=0,b(!1)},[b]),w=A.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{v.current=!0,b(!0),h.current=0},_)},[_,b]);return A.useEffect(()=>()=>{h.current&&=(window.clearTimeout(h.current),0)},[]),(0,j.jsx)(D,{...l,children:(0,j.jsx)(me,{scope:t,contentId:m,open:y,stateAttribute:x,trigger:d,onTriggerChange:p,onTriggerEnter:A.useCallback(()=>{c.isOpenDelayedRef.current?w():S()},[c.isOpenDelayedRef,w,S]),onTriggerLeave:A.useCallback(()=>{g?C():(window.clearTimeout(h.current),h.current=0)},[C,g]),onOpen:S,onClose:C,disableHoverableContent:g,children:n})})};H.displayName=B;var U=`TooltipTrigger`,W=A.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=V(U,n),a=R(U,n),c=F(n),l=o(t,A.useRef(null),i.onTriggerChange),u=A.useRef(!1),d=A.useRef(!1),f=A.useCallback(()=>u.current=!1,[]);return A.useEffect(()=>()=>document.removeEventListener(`pointerup`,f),[f]),(0,j.jsx)(re,{asChild:!0,...c,children:(0,j.jsx)(h.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:l,onPointerMove:s(e.onPointerMove,e=>{e.pointerType!==`touch`&&!d.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),d.current=!0)}),onPointerLeave:s(e.onPointerLeave,()=>{i.onTriggerLeave(),d.current=!1}),onPointerDown:s(e.onPointerDown,()=>{i.open&&i.onClose(),u.current=!0,document.addEventListener(`pointerup`,f,{once:!0})}),onFocus:s(e.onFocus,()=>{u.current||i.onOpen()}),onBlur:s(e.onBlur,i.onClose),onClick:s(e.onClick,i.onClose)})})});W.displayName=U;var G=`TooltipPortal`,[he,ge]=P(G,{forceMount:void 0}),K=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=V(G,t);return(0,j.jsx)(he,{scope:t,forceMount:n,children:(0,j.jsx)(d,{present:n||a.open,children:(0,j.jsx)(c,{asChild:!0,container:i,children:r})})})};K.displayName=G;var q=`TooltipContent`,J=A.forwardRef((e,t)=>{let n=ge(q,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=V(q,e.__scopeTooltip);return(0,j.jsx)(d,{present:r||o.open,children:o.disableHoverableContent?(0,j.jsx)(Y,{side:i,...a,ref:t}):(0,j.jsx)(_e,{side:i,...a,ref:t})})}),_e=A.forwardRef((e,t)=>{let n=V(q,e.__scopeTooltip),r=R(q,e.__scopeTooltip),i=A.useRef(null),a=o(t,i),[s,c]=A.useState(null),{trigger:l,onClose:u}=n,d=i.current,{onPointerInTransitChange:f}=r,p=A.useCallback(()=>{c(null),f(!1)},[f]),m=A.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Se(r,xe(r,n.getBoundingClientRect())),a=Ce(t.getBoundingClientRect()),o=Te([...i,...a]);c(o),f(!0)},[f]);return A.useEffect(()=>()=>p(),[p]),A.useEffect(()=>{if(l&&d){let e=e=>m(e,d),t=e=>m(e,l);return l.addEventListener(`pointerleave`,e),d.addEventListener(`pointerleave`,t),()=>{l.removeEventListener(`pointerleave`,e),d.removeEventListener(`pointerleave`,t)}}},[l,d,m,p]),A.useEffect(()=>{if(s){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=l?.contains(t)||d?.contains(t),i=!we(n,s);r?p():i&&(p(),u())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[l,d,s,u,p]),(0,j.jsx)(Y,{...e,ref:a})}),[ve,ye]=P(B,{isInside:!1}),be=r(`TooltipContent`),Y=A.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=V(q,n),l=F(n),{onClose:u}=c;return A.useEffect(()=>(document.addEventListener(L,u),()=>document.removeEventListener(L,u)),[u]),A.useEffect(()=>{if(c.trigger){let e=e=>{e.target instanceof Node&&e.target.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,j.jsx)(p,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,j.jsxs)(ne,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.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,j.jsx)(be,{children:r}),(0,j.jsx)(ve,{scope:n,isInside:!0,children:(0,j.jsx)(ue,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});J.displayName=q;var X=`TooltipArrow`,Z=A.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=F(n);return ye(X,n).isInside?null:(0,j.jsx)(te,{...i,...r,ref:t})});Z.displayName=X;function xe(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`)}}function Se(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});break}return r}function Ce(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}]}function we(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}function Te(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)),Ee(t)}function Ee(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)}var De=z,Oe=H,ke=W,Ae=K,je=J,Me=Z,Q=(0,A.createContext)(null);function Ne({children:e}){let[t,n]=(0,A.useState)(()=>new Map),r=(0,A.useCallback)((e,t)=>{n(n=>{let r=new Map(n);return r.set(e,t),r})},[]),i=(0,A.useCallback)(e=>{n(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),a=l((0,A.useMemo)(()=>[...t.values()].flat(),[t])),o=(0,A.useMemo)(()=>({publish:r,retract:i,lookup:a}),[r,i,a]);return(0,j.jsx)(Q.Provider,{value:o,children:e})}var $=(0,A.createContext)(null);function Pe({projectId:e,requests:t,children:n}){let r=(0,A.useContext)(Q),i=(0,A.useId)(),a=t.map(e=>`${e.projectId} ${e.kind}#${e.number}`).sort().join(`|`),o=r?.publish,s=r?.retract;(0,A.useEffect)(()=>{if(!(!o||!s))return o(i,t),()=>s(i)},[o,s,i,a]);let c=l(r?Fe:t),u=r?.lookup??c,d=(0,A.useMemo)(()=>({lookup:u,projectId:e}),[u,e]);return(0,j.jsx)($.Provider,{value:d,children:n})}var Fe=[];function Ie(e,t,n){let r=(0,A.useContext)($),i=n??r?.projectId;return!r||!i||t===void 0?Re:r.lookup({projectId:i,kind:e,number:t})}function Le(){let e=(0,A.useContext)($);return{lookup:e?.lookup??(()=>Re),projectId:e?.projectId}}var Re=Object.freeze({state:`idle`}),ze={success:`border-success/40 text-success`,danger:`border-danger/40 text-danger`,violet:`border-violet/35 text-violet`,info:`border-info/40 text-info`,neutral:`border-border text-muted-foreground`,pending:`border-pending-strong/45 text-pending-strong`,conflict:`border-conflict/45 text-conflict`},Be={success:`hover:bg-success/10`,danger:`hover:bg-danger/10`,violet:`hover:bg-violet/10`,info:`hover:bg-info/10`,neutral:`hover:bg-muted`,pending:`hover:bg-pending-strong/10`,conflict:`hover:bg-conflict/10`},Ve={draft:se,"review-required":T,"changes-requested":ce,"checks-pending":null,"checks-failing":w,ready:C,merged:ae,closed:oe,open:b,completed:C,"not-planned":k};function He({reference:e,taskTitle:t,status:n,conflicting:r,conflictAction:o,projectId:s,className:c,compact:l=!1}){let{kind:u,number:d,url:f}=e,p=Ie(u,d,s),m=n??p.status,h=a(m),_=u===`PR`&&(r??p.conflicting)===!0,y=_?i:h,b=v(`inline-flex h-[22px] items-center gap-1 rounded-full border px-2 font-mono text-[11px] font-semibold`,ze[y?.tone??`violet`],c),x=Je(p,y,_?h:void 0),S=d?`${!l&&u===`Issue`?`Issue `:``}#${d}`:u,C=u===`PR`?`pull request`:`issue`,w=`Open the ${C} for ${t}${y?` — ${y.label}`:``}`,T=(0,j.jsxs)(j.Fragment,{children:[_?(0,j.jsx)(ee,{className:`size-2.5 shrink-0`,"aria-hidden":`true`}):(0,j.jsx)(Xe,{status:y?m:void 0}),S]}),E=!f||!g(f)?(0,j.jsx)(`span`,{"data-slot":u===`PR`?`pr-chip`:`issue-chip`,"data-status":m,..._?{"data-conflicting":`true`}:{},"aria-label":y?`${C} ${S} — ${y.label}`:void 0,className:b,children:T}):(0,j.jsxs)(`a`,{"data-slot":u===`PR`?`pr-chip`:`issue-chip`,"data-status":m,..._?{"data-conflicting":`true`}:{},href:f,target:`_blank`,rel:`noopener noreferrer`,title:x?void 0:f,"aria-label":w,className:v(b,Be[y?.tone??`violet`]),children:[T,(0,j.jsx)(O,{className:`size-2.5`,"aria-hidden":`true`})]});if(!x)return E;let D=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`span`,{className:`block font-medium`,children:[u===`PR`?`Pull request`:`Issue`,d?` #${d}`:``,` · `,x.headline]}),(0,j.jsx)(`span`,{className:`block`,children:x.detail}),x.also?(0,j.jsx)(`span`,{className:`block opacity-70`,children:x.also}):null,f&&g(f)?(0,j.jsx)(`span`,{className:`block opacity-70`,children:f.replace(/^https?:\/\//,``)}):null]});return(0,j.jsx)(qe,{chip:E,action:_?o:void 0,state:p.state,children:D})}var Ue=(0,A.createContext)(()=>{});function We(){return(0,A.useContext)(Ue)}var Ge=150,Ke=120;function qe({chip:e,action:t,state:n,children:r}){let[i,a]=(0,A.useState)(!1),o=(0,A.useRef)(null),s=(0,A.useRef)(null),c=(0,A.useRef)(void 0),l=(0,A.useCallback)((e,t)=>{clearTimeout(c.current),c.current=setTimeout(()=>a(e),t)},[]),u=(0,A.useCallback)(()=>{clearTimeout(c.current),a(!1)},[]);(0,A.useEffect)(()=>()=>clearTimeout(c.current),[]);let d=e=>e instanceof Node&&(s.current?.contains(e)||o.current?.contains(e));return(0,j.jsxs)(S,{open:i,onOpenChange:e=>e?a(!0):u(),children:[(0,j.jsx)(y,{asChild:!0,ref:o,onPointerEnter:e=>{e.pointerType!==`touch`&&l(!0,Ge)},onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,Ke)},onFocus:()=>a(!0),onBlur:e=>{d(e.relatedTarget)||u()},onKeyDown:e=>{if(e.key===`Escape`)return u();if(e.key!==`Tab`||e.shiftKey||!t)return;let n=s.current?.querySelector(`button:not([disabled]), [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`);n&&(e.preventDefault(),n.focus())},...t?{"aria-haspopup":`dialog`,"aria-expanded":i}:{},children:e}),(0,j.jsxs)(x,{ref:s,side:`top`,role:t?`dialog`:`tooltip`,"data-slot":`reference-status-card`,"data-tooltip-state":n,className:`w-64 space-y-2 p-3 text-xs`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>{e.preventDefault(),d(document.activeElement)&&o.current?.focus()},onPointerEnter:()=>clearTimeout(c.current),onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,Ke)},children:[(0,j.jsx)(`div`,{className:`space-y-0.5`,children:r}),t?(0,j.jsx)(Ue.Provider,{value:u,children:t}):null]})]})}function Je(e,t,n){if(t){let{label:r,hint:i}=t,a=n?`also ${Ye(n.label)} — ${n.hint}`:void 0;return e.state===`unavailable`?{headline:r,detail:`last known — GitHub is unreachable${e.reason?` (${e.reason})`:``}`,...a?{also:a}:{}}:{headline:r,detail:i,...a?{also:a}:{}}}switch(e.state){case`loading`:return{headline:`Checking GitHub…`,detail:`the status of this reference is on its way`};case`unavailable`:return{headline:`Status unavailable`,detail:e.reason??`GitHub could not be reached — the chip says nothing rather than guessing`};case`unknown`:return{headline:`Not found on this repository`,detail:`GitHub has no such number here — the reference may point at another repo`};default:return null}}function Ye(e){return e.charAt(0).toLowerCase()+e.slice(1)}function Xe({status:e}){if(!e)return null;if(e===`checks-pending`)return(0,j.jsx)(ie,{tone:`pending`,pulse:!0,className:`size-[6px]`,"aria-hidden":`true`});let t=Ve[e];return t?(0,j.jsx)(t,{className:`size-2.5 shrink-0`,"aria-hidden":`true`}):null}function Ze({delayDuration:e=0,...t}){return(0,j.jsx)(De,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function Qe({...e}){return(0,j.jsx)(Oe,{"data-slot":`tooltip`,...e})}function $e({...e}){return(0,j.jsx)(ke,{"data-slot":`tooltip-trigger`,...e})}function et({className:e,sideOffset:t=0,children:n,...r}){return(0,j.jsx)(Ae,{children:(0,j.jsxs)(je,{"data-slot":`tooltip-content`,sideOffset:t,className:v(`z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-contrast px-3 py-1.5 text-xs text-balance text-contrast-foreground fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95`,e),...r,children:[n,(0,j.jsx)(Me,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-contrast fill-contrast`})]})})}export{He as a,Ne as c,k as d,O as f,$e as i,Le as l,et as n,We as o,Ze as r,Pe as s,Qe as t,M as u};
@@ -0,0 +1,4 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$t as r,A as i,Bi as a,Bn as o,D as s,Er as c,Ir as l,Jr as u,Kt as d,Li as f,O as p,Pi as m,Q as h,Qt as g,Xt as _,Zr as v,cn as y,en as b,in as x,k as S,n as C,r as w,rr as T,un as E}from"./toaster-CfRVb8vH.js";import{B as D,c as O,t as k}from"./utils-BXvEm7Ve.js";import{t as A}from"./arrow-left-BIZHhBIP.js";import{i as j,o as M,r as N,t as P}from"./popover-CNGONAql.js";import{m as F}from"./dropdown-menu-Ci4HFML0.js";import{m as I,p as L}from"./new-task-form-vLs2G1_z.js";import{t as R}from"./refresh-cw-BfkEydKA.js";import{a as ee,o as z,s as B,t as V,u as H}from"./command-Dfln3D4A.js";import{c as U,l as W,n as te,r as ne,s as re,t as ie}from"./agent-task-pickers-BeQi-UTm.js";import{t as ae}from"./triangle-alert-D5K_zyD3.js";import{t as oe}from"./x-kLybIvX4.js";import{t as G}from"./project-router-dCZQu1wQ.js";import{n as K}from"./format-DHK74MwW.js";import{t as se}from"./centered-state-3r2Kaar_.js";import{t as ce}from"./textarea-DtBqPhIs.js";import{n as le,t as ue}from"./use-submit-shortcut-BJ10ZshV.js";import{t as de}from"./markdown-DjNR-1p8.js";import{$ as fe,G as pe,K as me,U as he,g as ge,h as _e,m as ve}from"./index-HS1hr5Sz.js";var q=e(t(),1),ye=(e,t)=>e?.available&&JSON.stringify([e.items,e.truncated])===JSON.stringify([t.items,t.truncated]);function be(e,t,n=!0){let r=a(),i=h(),o=O(),s=JSON.stringify([o,e,t]),[c,d]=(0,q.useState)({identity:s,snapshot:null,error:null,pending:null}),f=(0,q.useRef)({refresh:async()=>{},applyChanges:async()=>{}}),p=i.data?i.data.capabilities.localHandoff?`local`:`remote`:null;(0,q.useEffect)(()=>{if(d({identity:s,snapshot:null,error:null,pending:null}),!p||!n)return;let i=t,a=!1,c=()=>{},m=null,h=null,g=null,_=(e=null)=>{a||d({identity:s,snapshot:m,error:e,pending:h})},b=(e,t=!1)=>{let n=r.getQueryData(i),a=r.getQueryState(i)?.fetchStatus===`fetching`;!t&&((n?.pages.length??0)>1||a)?(a&&(g=e),h=ye(n?.pages[0],e)?null:e):(h=null,g=null,r.setQueryData(i,{pages:[e],pageParams:[void 0]}))},x=e=>{if(m&&e.version<m.version)return!1;let t=e.result?.available&&!e.checking&&e.checkedAt!==m?.checkedAt;return m=e,t&&e.result?.available&&b(e.result),e.result&&!e.result.available&&[`source_changed`,`credentials_missing`,`not_configured`].includes(e.result.code)&&(h=null,g=null,Promise.all([r.invalidateQueries({queryKey:[`tracker`,o,`association`]}),r.invalidateQueries({queryKey:[`tracker`,o,`connection`]}),r.invalidateQueries({queryKey:y.projects})])),_(),!0},S=r.getQueryCache().subscribe(e=>{if(a||!g||JSON.stringify(e.query.queryKey)!==JSON.stringify(i)||e.query.state.fetchStatus!==`idle`)return;let t=g;g=null,b(t),_()}),C=()=>{if(c(),f.current={refresh:async()=>{},applyChanges:async()=>{}},a||document.visibilityState===`hidden`)return;let t=new AbortController,n=()=>{},s,d=null,g=!1,y=!1,S=()=>!a&&!t.signal.aborted;c=()=>{t.abort(),n(),clearTimeout(s)};let w=e=>S()&&x(e),T=()=>{S()&&(_(`Automatic checking is temporarily unavailable. Retrying…`),n(),clearTimeout(s),s=setTimeout(()=>{S()&&C()},5e3))},O=async()=>{if(!(!S()||!d)){if(g){y=!0;return}g=!0;try{do y=!1,w(await u(o,d.id,t.signal));while(y&&S())}catch{T()}finally{g=!1}}};f.current={refresh:async()=>{if(!(!d||!S()))try{let e=await v(o,d.id,t.signal);if(!S()||m&&e.version<m.version||(await r.cancelQueries({queryKey:i,exact:!0}),!S())||!w(e))return;e.result?.available&&(b(e.result,!0),_())}catch{T()}},applyChanges:async()=>{!h||!S()||(await r.cancelQueries({queryKey:i,exact:!0}),S()&&h&&(b(h,!0),_()))}},(async()=>{try{if(d=await l(o,e,t.signal),!S())return;if(m=null,p===`local`)n=E(d.topic,e=>{D.safeParse(e).success&&O()},T),await O();else{let e=-1;for(;S();){let n=await u(o,d.id,t.signal,Math.max(0,e));if(w(n),e=n.version,n.result&&!n.result.available&&n.result.code===`source_changed`)break}}}catch{T()}})()};return C(),document.addEventListener(`visibilitychange`,C),()=>{a=!0,c(),S(),document.removeEventListener(`visibilitychange`,C)}},[r,s,p,n]);let m=c.identity===s?c:null,g=m?.snapshot;return{ready:g!=null,checkedAt:g?.checkedAt??null,checking:g?.checking??!1,error:m?.error??(g?.result&&!g.result.available?g.result.reason:null),hasChanges:!!m?.pending,refresh:()=>f.current.refresh(),applyChanges:()=>f.current.applyChanges()}}var xe=1e5;function J(e){let t=[];return e.bodyTruncated&&t.push(`The tracker description was truncated by the provider snapshot.`),e.unsupportedContent&&t.push(`The tracker item contains unsupported content that is absent from this snapshot.`),t}function Y(e,t={}){let n=[`Work on tracker ticket [${e.id}]: ${e.title}`,`Source: ${e.url}`,`Status: ${e.status}\nAuthor: ${e.author}\nLabels: ${e.labels.length?e.labels.join(`, `):`(none)`}`,`Description:\n${e.body.trim()||`(No description was provided.)`}`,`Tracker snapshot scope: description only; comments, attachments, and custom fields are not included.`],r=J(e);r.length&&n.push(`Snapshot limitations:\n${r.map(e=>`- ${e}`).join(`
2
+ `)}`),t.skills?.length&&n.push(`Use these skills where relevant: ${t.skills.join(`, `)}.`),t.supplemental?.trim()&&n.push(`Supplemental context:\n${t.supplemental.trim()}`),t.instruction?.trim()&&n.push(t.instruction.trim());let i=n.join(`
3
+
4
+ `);if(i.length>1e5)throw Error(`The final task exceeds the 100,000 character limit. Shorten the supplemental context or instruction.`);return i}function Se(e,t,n,r,i){if(!t&&n.length>8)throw Error(`A skill chain can contain at most 8 skills. Remove a skill before launching.`);if(J(e).length>0&&!i.acknowledgeLoss)throw Error(`Acknowledge the snapshot limitations before handing this issue to an agent.`);let a=Y(e,{...i,skills:t?n:[]});return t?{...r,workflow:t,task:a}:n.length?{...r,steps:re(n),task:a}:{...r,workflow:`quick-task`,task:a}}var X=n();function Ce({item:e,workflows:t,skills:n,selection:r,onSelectionChange:o,drafts:c,scopePending:l=!1,detailUnavailable:u=!1}){let d=a(),[p,m]=(0,q.useState)({workflow:null,selectedSkills:[],engine:{runner:null,model:null,account:null}}),{workflow:h,selectedSkills:g,engine:_}=r??p,v=o??m,y=e=>v(t=>({...t,workflow:e})),b=e=>v(t=>({...t,engine:e})),x=e=>v(t=>({...t,selectedSkills:e(t.selectedSkills)})),[S,E]=(0,q.useState)(c?.get(e.url)?.instruction??``),[D,O]=(0,q.useState)(c?.get(e.url)?.supplemental??``),[k,A]=(0,q.useState)(c?.get(e.url)?.acknowledgedSnapshot??null);(0,q.useEffect)(()=>{c?.set(e.url,{instruction:S,supplemental:D,acknowledgedSnapshot:k})},[c,e.url,S,D,k]);let j=JSON.stringify([e.id,e.body,e.bodyTruncated,e.unsupportedContent]),M=k===j,[N,P]=(0,q.useState)(null),F=ge(_),R=J(e),ee=e.body.trim()===``,z=g.filter(e=>n.some(t=>t.name===e)),B=h===null&&z.length>8,V=(0,q.useMemo)(()=>{try{return{task:Y(e,{skills:h?z:[],instruction:S,supplemental:D}),error:null}}catch(e){return{task:``,error:e.message}}},[e,h,z.join(`\0`),S,D]),H=f({mutationFn:()=>T(Se(e,h,z,_e(F),{instruction:S,supplemental:D,acknowledgeLoss:M})),onSuccess:t=>{let n=`runs`in t?t.runs[0]:t;P(n?.id??null),d.invalidateQueries({queryKey:i.runs.all}),C(`Added ${e.id} to the queue`)},onError:e=>C(e.message,{tone:`danger`})}),U=e=>x(t=>t.includes(e)?t.filter(t=>t!==e):h===null&&z.length>=8?t:[...t,e]),W=!l&&!u&&!H.isPending&&F.canRun&&V.error===null&&!B&&(R.length===0||M);return(0,X.jsxs)(`section`,{className:`mt-7 rounded-lg border border-border bg-card p-4`,"data-slot":`tracker-handoff`,children:[(0,X.jsxs)(`h2`,{className:`flex items-center gap-1.5 text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:[(0,X.jsx)(L,{className:`size-3.5 text-violet`}),` Hand this to the agent`]}),(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(te,{workflows:t,value:h,onChange:y,slotPrefix:`tracker`}),(0,X.jsx)(ie,{skills:n,skillUsage:void 0,selected:z,onToggle:U,maxSelections:h===null?8:void 0,slotPrefix:`tracker`}),(0,X.jsx)(ve,{pick:_,onChange:b,accounts:!0,disabled:H.isPending||!F.canRun}),(0,X.jsx)(ne,{resolved:F,dataSlot:`tracker-provider-gate`})]}),z.length?(0,X.jsx)(`div`,{className:`mt-2.5 flex flex-wrap gap-1.5`,children:z.map(e=>(0,X.jsxs)(`button`,{type:`button`,"aria-label":`Remove skill ${e}`,onClick:()=>U(e),className:`inline-flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-px font-mono text-[11px] font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[e,(0,X.jsx)(oe,{"aria-hidden":`true`,className:`size-3`})]},e))}):null,h===null&&z.length>=8?(0,X.jsxs)(`p`,{className:`mt-2 text-xs ${B?`text-danger`:`text-muted-foreground`}`,children:[`Skill chains support at most `,8,` skills. Remove one before selecting another.`]}):null,R.length||ee?(0,X.jsxs)(`div`,{className:`mt-3 rounded-md border border-warning/50 bg-warning/10 p-3 text-sm`,children:[(0,X.jsx)(`p`,{className:`font-medium`,children:R.length?`This provider snapshot lost some issue content.`:`This issue has no description.`}),R.length?(0,X.jsx)(`ul`,{className:`mt-1 list-disc pl-5 text-xs`,children:R.map(e=>(0,X.jsx)(`li`,{children:e},e))}):(0,X.jsx)(`p`,{className:`mt-1 text-xs`,children:`Add any context the agent needs before starting.`}),R.length?(0,X.jsx)(`a`,{className:`mt-2 inline-block text-xs text-violet underline underline-offset-4`,href:e.url,target:`_blank`,rel:`noreferrer`,children:`Review the source issue`}):null,(0,X.jsx)(`label`,{className:`mt-3 block text-xs font-medium`,htmlFor:`tracker-supplemental`,children:`Supplemental context`}),(0,X.jsx)(ce,{id:`tracker-supplemental`,value:D,onChange:e=>O(e.target.value),placeholder:`Paste any missing context here…`,className:`mt-1 min-h-20 bg-background`}),R.length?(0,X.jsxs)(`label`,{className:`mt-2 flex items-start gap-2 text-xs`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:M,onChange:e=>A(e.target.checked?j:null)}),`I understand the agent receives this snapshot and the supplemental context above.`]}):null]}):null,(0,X.jsx)(`label`,{className:`mt-3 block text-xs font-medium`,htmlFor:`tracker-instruction`,children:`Custom instruction`}),(0,X.jsx)(ce,{id:`tracker-instruction`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,onKeyDown:e=>{ue(e.nativeEvent)&&(e.preventDefault(),W&&H.mutate())},value:S,onChange:e=>E(e.target.value),placeholder:`Optional instructions; these are placed last in the task.`,className:`mt-1 min-h-20 text-[13px]`}),(0,X.jsxs)(`div`,{className:`mt-1 flex justify-between text-[11px] text-muted-foreground`,children:[(0,X.jsx)(`span`,{children:V.error??`Full tracker detail and source link are included. Comments, attachments, and custom fields are outside the snapshot.`}),(0,X.jsxs)(`span`,{children:[V.task.length.toLocaleString(),` / `,xe.toLocaleString()]})]}),l?(0,X.jsx)(`p`,{role:`status`,className:`mt-3 text-xs text-muted-foreground`,children:`Verifying tracker connection…`}):null,u?(0,X.jsx)(`p`,{role:`status`,className:`mt-3 text-xs text-danger`,children:`Issue detail could not be verified. Retry successfully before starting the agent; your draft is preserved.`}):null,(0,X.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2.5`,children:[(0,X.jsxs)(w,{variant:`contrast`,onClick:()=>H.mutate(),disabled:!W,children:[(0,X.jsx)(I,{className:`size-3.5`}),` Run agent on this issue`]}),(0,X.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[10.5px] font-medium text-muted-foreground`,children:le()}),N?(0,X.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-success`,children:[(0,X.jsx)(s,{className:`size-3`}),` queued · `,(0,X.jsx)(G,{className:`text-violet hover:underline`,to:`/tasks/${N}`,children:`View task →`})]}):null]})]})}function we({options:e,selected:t,onChange:n}){let[r,i]=(0,q.useState)(``),a=[...new Set([...t,...e])].sort(),o=e=>n(t.includes(e)?t.filter(t=>t!==e):[...t,e]),c=r.trim();return(0,X.jsxs)(P,{onOpenChange:e=>{e||i(``)},children:[(0,X.jsx)(j,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"aria-label":`Filter labels`,className:k(`flex shrink-0 items-center gap-1 rounded-md border border-border px-2 py-1.5 text-xs text-soft-foreground hover:bg-muted`,t.length>0&&`border-primary/60 text-foreground`),children:[(0,X.jsx)(W,{"aria-hidden":`true`,className:`size-3.5`}),`Labels`,t.length?` · ${t.length}`:``]})}),(0,X.jsx)(N,{align:`end`,sideOffset:6,className:`w-60 p-0`,children:(0,X.jsxs)(V,{label:`Find or add label`,shouldFilter:!1,children:[(0,X.jsx)(ee,{"aria-label":`Find or add label`,placeholder:`Find or add label…`,value:r,onValueChange:i,maxLength:256}),(0,X.jsxs)(B,{className:`max-h-64`,children:[t.length?(0,X.jsx)(z,{onSelect:()=>n([]),children:`Clear filters`}):null,a.filter(e=>e.toLowerCase().includes(c.toLowerCase())).map(e=>(0,X.jsxs)(z,{value:e,disabled:!t.includes(e)&&t.length>=20,onSelect:()=>o(e),children:[(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),t.includes(e)?(0,X.jsx)(s,{className:`size-3.5 text-primary`}):null]},e)),c&&!a.includes(c)?(0,X.jsxs)(z,{disabled:t.length>=20,onSelect:()=>{o(c),i(``)},children:[`Use label “`,c,`”`]}):null,(0,X.jsx)(`p`,{className:`px-3 py-2 text-[11px] text-soft-foreground`,children:`Suggestions come from loaded issues. Type any exact label to filter.`})]})]})})]})}var Te=()=>({workflow:null,selectedSkills:[],engine:{runner:null,model:null,account:null}});function Ee(){let{id:e}=m(),{projectId:t}=o(),n=_(),r=g(),i=`${t??`default`}:${n.data?.association?Z(n.data.association):`none`}`,a=(0,q.useMemo)(()=>new Map,[i]),[s,c]=(0,q.useState)(null),l=s?.key===i?s.value:Te(),u=e=>c(t=>{let n=t?.key===i?t.value:Te();return{key:i,value:typeof e==`function`?e(n):e}});if(n.isPending)return(0,X.jsx)($,{text:`Loading tracker…`});if(n.isError)return(0,X.jsxs)(`div`,{className:`p-8 text-center text-sm text-danger`,children:[(0,X.jsx)(`p`,{children:n.error.message}),(0,X.jsx)(G,{className:`mt-3 inline-block text-violet underline underline-offset-4`,to:`/settings/tracker`,children:`Open tracker settings`})]});if(!n.data.association)return(0,X.jsx)(De,{});if(n.data.association.connectionId){if(r.isPending)return(0,X.jsx)($,{text:`Loading tracker…`});if(r.isError)return(0,X.jsxs)(`div`,{role:`alert`,className:`p-8 text-center text-sm`,children:[(0,X.jsx)(`p`,{children:`Could not verify the tracker connection.`}),(0,X.jsx)(w,{className:`mt-3`,variant:`outline`,onClick:()=>void r.refetch(),children:`Retry connection`})]});if(!r.data.demo&&(r.data.connection?.id!==n.data.association.connectionId||r.data.connection?.kind!==n.data.association.kind))return(0,X.jsx)(De,{})}return(0,X.jsx)(Oe,{scopePending:n.isFetching||!!n.data.association.connectionId&&r.isFetching,association:n.data.association,selectedId:e,drafts:a,selection:l,setSelection:u},i)}function Z(e){return`${e.kind}:${e.source.id}:${e.source.webUrl}:${e.externalId}:${e.connectionId??`legacy`}`}function De(){return(0,X.jsxs)(`div`,{className:`mx-auto flex min-h-[55vh] max-w-lg flex-col items-center justify-center p-6 text-center`,children:[(0,X.jsx)(pe,{className:`size-8 text-muted-foreground`}),(0,X.jsx)(`h1`,{className:`mt-3 text-lg font-semibold`,children:`Connect an issue tracker`}),(0,X.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Choose a project or team from your issue tracker in project settings.`}),(0,X.jsx)(G,{className:`mt-4 rounded-md bg-primary px-3 py-2 text-sm font-medium text-primary-foreground`,to:`/settings/tracker`,children:`Open tracker settings`})]})}function Oe({scopePending:e,association:t,selectedId:n,drafts:r,selection:o,setSelection:s}){let c=a(),l=fe(),u=l||n===void 0,[d,f]=(0,q.useState)(null),[p,m]=(0,q.useState)(``),[h,g]=(0,q.useState)(``),[_,v]=(0,q.useState)(`active`),[y,x]=(0,q.useState)(!1),[C,T]=(0,q.useState)([]),E=b(t,{state:_,labels:C,query:h},u),D=be({association:t,state:_,labels:C,query:h},E.queryKey,u),O=E.data?.pages??[],A=O.find(e=>!e.available),j=O.flatMap(e=>e.available?e.items:[]),N=JSON.stringify([h,_,C]),P=d?.filter===N?d.id:null;(0,q.useEffect)(()=>{P===null&&j[0]&&f({filter:N,id:j[0].id})},[P,j,N]);let F=n??(l?P:null),I=he[t.kind].label,L=async()=>{await(D.ready?D.refresh():E.restart()),F&&c.invalidateQueries({queryKey:i.tracker.detail(t,F)})};return(0,X.jsx)(U,{name:`tracker`,route:`tracker`,selected:n!==void 0,list:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`header`,{"data-slot":`tracker-header`,className:`sticky top-0 z-10 border-b border-border bg-background/95 px-4 pt-3 backdrop-blur`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,X.jsx)(`h1`,{className:`text-lg font-semibold`,children:I}),(0,X.jsx)(`span`,{className:`min-w-0 truncate font-mono text-[11px] text-soft-foreground`,title:t.externalName,children:t.externalName}),(0,X.jsx)(G,{to:`/settings/tracker`,"aria-label":`Connection settings`,title:`Connection settings`,className:`ml-auto shrink-0 text-soft-foreground hover:text-foreground`,children:(0,X.jsx)(me,{className:`size-3.5`})}),(0,X.jsxs)(`button`,{type:`button`,"aria-label":`Refresh`,title:`Refresh from ${I}`,disabled:D.checking||E.isFetching,onClick:()=>void L(),className:`flex shrink-0 items-center gap-1 rounded-full border border-border px-1.5 py-px text-[10px] font-medium text-soft-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,children:[(0,X.jsx)(R,{"aria-hidden":`true`,className:k(`size-[9px]`,(D.checking||E.isFetching)&&`motion-safe:animate-spin`)}),D.checkedAt?`synced ${K(D.checkedAt)} ago`:`refresh`]})]}),(0,X.jsxs)(`div`,{className:`mt-2.5 flex items-center justify-between border-b border-border pb-2`,children:[(0,X.jsxs)(`h2`,{className:`text-[13px] font-medium`,children:[`Issues · `,j.length,E.hasNextPage?`+`:``]}),(0,X.jsxs)(`select`,{"aria-label":`Issue state`,className:`min-w-0 rounded-md border border-input bg-card px-2 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,value:_,onChange:e=>{v(e.target.value),x(!0)},children:[(0,X.jsx)(`option`,{value:`active`,children:`Active`}),(0,X.jsx)(`option`,{value:`all`,children:`All states`})]})]}),(0,X.jsxs)(`form`,{className:`mt-2.5 flex items-center gap-2 pb-3`,onSubmit:e=>{e.preventDefault();let t=p.trim(),n=y?_:t?`all`:`active`;t===h&&n===_?L():(g(t),v(n))},children:[(0,X.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,X.jsx)(H,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-soft-foreground`}),(0,X.jsx)(`input`,{type:`search`,"aria-label":`Search tracker`,maxLength:256,className:`w-full rounded-md border border-input bg-card py-1 pr-2 pl-7 text-[13px] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,value:p,onChange:e=>m(e.target.value),placeholder:`Search issues…`})]}),(0,X.jsx)(w,{type:`submit`,variant:`outline`,size:`sm`,disabled:E.isFetching,children:`Search`}),(0,X.jsx)(we,{options:j.flatMap(e=>e.labels),selected:C,onChange:T})]})]}),D.error?(0,X.jsxs)(`p`,{role:`status`,className:`px-4 py-2 text-xs text-danger`,children:[D.error,` The displayed list may be outdated.`]}):null,D.hasChanges?(0,X.jsxs)(`div`,{className:`m-2 rounded-md border border-border bg-muted/40 p-3 text-xs`,children:[(0,X.jsx)(`p`,{children:`New changes are available. Your loaded pages have been preserved.`}),(0,X.jsx)(w,{size:`sm`,className:`mt-2`,variant:`outline`,onClick:()=>void D.applyChanges(),children:`Show changes`})]}):null,E.isPending&&u?(0,X.jsx)($,{text:`Loading issues…`}):null,E.isError?(0,X.jsx)(Q,{reason:E.error.message,generation:E.errorUpdatedAt,retryAfterSeconds:E.error instanceof S&&E.error.failure.code===`rate_limited`?E.error.failure.retryAfterSeconds:void 0,retry:()=>void E.restart()}):null,A&&!A.available?(0,X.jsx)(Q,{reason:A.reason,generation:E.dataUpdatedAt,retryAfterSeconds:A.code===`rate_limited`?A.retryAfterSeconds:void 0,retry:()=>void E.restart()}):null,!E.isPending&&!E.isError&&!A&&j.length===0?(0,X.jsx)($,{text:h.trim()?`No issues match this search.`:`No issues in this view.`}):null,(0,X.jsx)(`ul`,{"data-slot":`tracker-rows`,className:`flex flex-col gap-0.5 px-2 py-2`,children:j.map(n=>(0,X.jsx)(ke,{scopePending:e,association:t,item:n,active:F===n.id},n.id))}),E.hasNextPage?(0,X.jsx)(w,{className:`mx-4 mb-4 shrink-0`,variant:`outline`,onClick:()=>void E.fetchNextPage(),disabled:E.isFetchingNextPage,children:`Load more`}):null]}),detail:F?(0,X.jsx)(je,{scopePending:e,association:t,id:F,drafts:r,selection:o,onSelectionChange:s},`${Z(t)}:${F}`):(0,X.jsx)(se,{icon:(0,X.jsx)(M,{}),tone:`neutral`,heading:`h2`,title:`Nothing selected`,subtitle:`Choose an issue from the list.`})})}function ke({scopePending:e,association:t,item:n,active:r}){let o=a(),s=i.tracker.detail(t,n.id),l=()=>void o.prefetchQuery({queryKey:s,queryFn:({signal:e})=>c(n.id,{signal:e,association:t}),staleTime:p});return(0,X.jsx)(`li`,{children:(0,X.jsxs)(G,{to:`/tracker/${encodeURIComponent(n.id)}`,draggable:!0,onMouseEnter:l,onFocus:l,onDragStart:t=>{if(e){t.preventDefault();return}let n=o.getQueryState(s),r=Ae(o,s);if(!r){t.preventDefault(),l(),C(n?.status===`error`?`Full issue detail failed to load. Open the issue to retry.`:`Loading fresh issue detail. Drag again when it is ready.`,n?.status===`error`?{tone:`danger`}:void 0);return}if(J(r.item).length){t.preventDefault(),C(`Open this issue to acknowledge snapshot limitations before handoff.`,{tone:`danger`});return}t.dataTransfer.setData(`text/plain`,Y(r.item)),t.dataTransfer.effectAllowed=`copy`},"data-slot":`tracker-row`,"aria-current":r?`page`:void 0,title:`Drag into the composer to prefill a task`,className:k(`flex flex-col gap-1 rounded-md px-2.5 py-2 transition-colors hover:bg-muted`,r&&`bg-muted`),children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(M,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-violet`}),(0,X.jsx)(`span`,{className:k(`min-w-0 truncate text-[13px] font-medium`,r&&`font-semibold`),children:n.title})]}),(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 pl-[22px] font-mono text-[10.5px] text-muted-foreground`,children:[(0,X.jsx)(`span`,{className:`shrink-0`,children:n.id}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:n.author}),(0,X.jsx)(`span`,{className:`shrink-0`,title:new Date(n.updatedAt).toLocaleString(),children:K(n.updatedAt)})]}),(0,X.jsxs)(`span`,{className:`flex flex-wrap gap-1 pl-[22px]`,children:[(0,X.jsx)(`span`,{className:`rounded border border-border px-1.5 py-px text-[10px] text-muted-foreground`,children:n.status}),n.labels.map(e=>(0,X.jsx)(`span`,{className:`rounded-full border border-border px-1.5 py-px text-[10px] text-muted-foreground`,children:e},e))]})]})})}function Ae(e,t,n=Date.now()){let r=e.getQueryState(t);return r?.status!==`success`||r.fetchStatus!==`idle`||r.isInvalidated||r.dataUpdatedAt<=0||n-r.dataUpdatedAt>=6e4||!r.data?.available?null:r.data}function je({scopePending:e,association:t,id:n,selection:i,onSelectionChange:a,drafts:o}){let s=r(t,n),c=x(),l=d(),[u,f]=(0,q.useState)(null);(0,q.useEffect)(()=>{s.data?.available&&f(s.data.item)},[s.data]);let p=s.isError?(0,X.jsx)(Q,{reason:s.error.message,generation:s.errorUpdatedAt,retry:()=>void s.refetch()}):s.data&&!s.data.available?(0,X.jsx)(Q,{reason:s.data.reason,generation:s.dataUpdatedAt,retryAfterSeconds:s.data.code===`rate_limited`?s.data.retryAfterSeconds:void 0,retry:()=>void s.refetch()}):null,m=s.data?.available?s.data.item:u;return m?(0,X.jsxs)(`article`,{"data-slot":`tracker-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,X.jsx)(Me,{}),(0,X.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-1.5 font-mono text-[10.5px] text-soft-foreground`,children:[(0,X.jsx)(`span`,{children:m.id}),`·`,(0,X.jsx)(`span`,{children:`issue`}),`·`,(0,X.jsxs)(`span`,{children:[`opened by `,m.author]}),`·`,(0,X.jsxs)(`span`,{title:new Date(m.createdAt).toLocaleString(),children:[K(m.createdAt),` ago`]}),`·`,(0,X.jsxs)(`a`,{className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,href:m.url,target:`_blank`,rel:`noopener noreferrer`,children:[`open on `,he[t.kind].label,(0,X.jsx)(F,{"aria-hidden":`true`,className:`size-2.5`})]})]}),(0,X.jsx)(`h2`,{className:`mt-2 text-xl leading-snug font-semibold`,children:m.title}),(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[(0,X.jsx)(`span`,{className:`rounded border border-border px-1.5 py-px text-[10px] text-muted-foreground`,children:m.status}),m.labels.map(e=>(0,X.jsx)(`span`,{className:`rounded-full border border-border px-1.5 py-px text-[10px] text-muted-foreground`,children:e},e))]}),p,J(m).length?(0,X.jsxs)(`div`,{className:`mt-4 rounded-md border border-warning/50 bg-warning/10 p-3 text-sm`,children:[(0,X.jsx)(ae,{className:`mr-2 inline size-4`}),`This snapshot is incomplete. Review the limitations in the handoff panel.`]}):null,(0,X.jsx)(`section`,{"data-slot":`tracker-body`,className:`mt-5 text-sm`,children:(0,X.jsx)(de,{children:m.body.trim()||`*No description was provided.*`})}),(0,X.jsx)(Ce,{scopePending:e,item:m,detailUnavailable:s.isError||!s.data?.available,drafts:o,selection:i,onSelectionChange:a,workflows:c.data?.workflows??[],skills:l.data??[]},`${Z(t)}:${m.id}`)]}):(0,X.jsxs)(`div`,{className:`p-4`,children:[(0,X.jsx)(Me,{}),s.isPending?(0,X.jsx)($,{text:`Loading full issue detail…`}):p]})}function Q({reason:e,retry:t,retryAfterSeconds:n=0,generation:r}){let[i,a]=(0,q.useState)(n);return(0,q.useEffect)(()=>a(n),[e,n,r]),(0,q.useEffect)(()=>{if(i<=0)return;let e=window.setInterval(()=>a(e=>Math.max(0,e-1)),1e3);return()=>window.clearInterval(e)},[i>0]),(0,X.jsxs)(`div`,{className:`mt-5 rounded-md border border-danger/30 bg-danger/5 p-4 text-sm`,children:[(0,X.jsx)(`p`,{className:`text-danger`,children:e}),(0,X.jsxs)(`div`,{className:`mt-3 flex items-center gap-3`,children:[(0,X.jsxs)(w,{variant:`outline`,disabled:i>0,onClick:t,children:[(0,X.jsx)(R,{className:`size-3.5`}),i>0?`Retry in ${i}s`:`Retry`]}),(0,X.jsx)(G,{className:`text-xs text-violet underline underline-offset-4`,to:`/settings/tracker`,children:`Tracker settings`})]})]})}function $({text:e,danger:t=!1}){return(0,X.jsx)(`div`,{className:`p-8 text-center text-sm ${t?`text-danger`:`text-muted-foreground`}`,children:e})}function Me(){return(0,X.jsxs)(G,{className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,to:`/tracker`,children:[(0,X.jsx)(A,{"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]})}export{Ee as TrackerRoute};
@@ -1 +1 @@
1
- import{r as e}from"./utils-DoBmOlX3.js";var t=e(`copy`,[[`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`}]]),n=e(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]);export{t as n,n as t};
1
+ import{r as e}from"./utils-BXvEm7Ve.js";var t=e(`copy`,[[`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`}]]),n=e(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]);export{t as n,n as t};
@@ -1 +1 @@
1
- import{r as e}from"./utils-DoBmOlX3.js";var t=e(`triangle-alert`,[[`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`}]]);export{t};
1
+ import{r as e}from"./utils-BXvEm7Ve.js";var t=e(`triangle-alert`,[[`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`}]]);export{t};