@uniqbit/mate-core 0.20.0 → 0.21.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 (286) hide show
  1. package/claude-capability-plugins/companion-mentions/.claude-plugin/plugin.json +1 -1
  2. package/claude-capability-plugins/companion-mentions/hooks/register.ts +1 -1
  3. package/claude-plugin/hooks/hooks.json +10 -1
  4. package/claude-plugin/hooks/rtk-worktree-git.mjs +58 -0
  5. package/opencode-plugin/src/server.ts +9 -2
  6. package/package.json +2 -1
  7. package/src/cli/commands/artifact/delivery/environment.ts +28 -8
  8. package/src/cli/commands/artifact/delivery/link.ts +28 -9
  9. package/src/cli/commands/artifact/delivery/output.ts +7 -0
  10. package/src/cli/commands/companion/update.ts +2 -19
  11. package/src/cli/commands/factory/factory.ts +11 -1
  12. package/src/cli/commands/install.ts +47 -36
  13. package/src/cli/commands/launch/claude.ts +2 -0
  14. package/src/cli/commands/launch/shared.ts +33 -6
  15. package/src/cli/commands/plugin/install.ts +27 -11
  16. package/src/cli/commands/report/index.ts +180 -184
  17. package/src/cli/commands/report/markdown.ts +67 -72
  18. package/src/cli/commands/shared/companion-selection.ts +3 -1
  19. package/src/cli/commands/studio/access.ts +6 -14
  20. package/src/cli/commands/studio/areas.ts +112 -33
  21. package/src/cli/commands/studio/companion-add.ts +87 -0
  22. package/src/cli/commands/studio/companion-removal.ts +15 -8
  23. package/src/cli/commands/studio/factory-credential.ts +1 -15
  24. package/src/cli/commands/studio/factory-git-tokens.ts +40 -0
  25. package/src/cli/commands/studio/factory-relay.ts +18 -0
  26. package/src/cli/commands/studio/graph-model.ts +61 -0
  27. package/src/cli/commands/studio/graph.ts +336 -0
  28. package/src/cli/commands/studio/index.ts +4 -4
  29. package/src/cli/commands/studio/payload.ts +42 -15
  30. package/src/cli/commands/studio/repository-add.ts +116 -0
  31. package/src/cli/commands/studio/routes.ts +6 -0
  32. package/src/cli/commands/studio/selection.ts +12 -3
  33. package/src/cli/commands/studio/server.ts +127 -5
  34. package/src/cli/commands/studio/services.ts +40 -0
  35. package/src/cli/commands/studio/terminal.ts +45 -3
  36. package/src/cli/commands/studio/views/vault/markdown-tree.ts +84 -3
  37. package/src/cli/commands/studio/workset-session.ts +47 -14
  38. package/src/cli/commands/unwrap.ts +3 -0
  39. package/src/cli/commands/update.ts +2 -0
  40. package/src/cli/commands/vscode/release-vsix.json +4 -0
  41. package/src/cli/commands/vscode/setup.ts +71 -13
  42. package/src/cli/commands/vscode/vsix.ts +48 -7
  43. package/src/cli/commands/working/cleanup.ts +40 -8
  44. package/src/cli/commands/working/worktree.ts +176 -35
  45. package/src/cli/main.ts +17 -2
  46. package/src/cli/usage.ts +1 -1
  47. package/src/hooks/rtk-worktree-git.ts +48 -0
  48. package/src/hooks/validate-artifact-path.ts +38 -7
  49. package/src/lib/delivery/branch-template.ts +122 -0
  50. package/src/lib/delivery/branches.ts +21 -16
  51. package/src/lib/delivery/checkout.ts +102 -0
  52. package/src/lib/delivery/environment.ts +2 -0
  53. package/src/lib/delivery/merge-git.ts +13 -1
  54. package/src/lib/delivery/record-delivery.ts +83 -29
  55. package/src/lib/delivery/record.ts +15 -3
  56. package/src/lib/delivery/resolve-branch.ts +157 -110
  57. package/src/lib/factory/attach-client.ts +11 -1
  58. package/src/lib/factory/broker.ts +37 -40
  59. package/src/lib/factory/client.ts +22 -1
  60. package/src/lib/factory/clone-url.ts +39 -0
  61. package/src/lib/factory/command.ts +21 -5
  62. package/src/lib/factory/git-auth.ts +61 -0
  63. package/src/lib/factory/git-credential-store.ts +181 -0
  64. package/src/lib/factory/ids.ts +12 -2
  65. package/src/lib/factory/outcomes/actions.ts +20 -4
  66. package/src/lib/factory/outcomes/index.ts +77 -11
  67. package/src/lib/factory/outcomes/lifecycle.ts +9 -2
  68. package/src/lib/factory/outcomes/sessions.ts +23 -1
  69. package/src/lib/factory/prepare.ts +9 -3
  70. package/src/lib/factory/runner/scheduler.ts +96 -14
  71. package/src/lib/factory/runner/workflow.ts +5 -1
  72. package/src/lib/factory/runtime.ts +143 -43
  73. package/src/lib/orchestrator/companion-hub.ts +6 -1
  74. package/src/lib/orchestrator/engine-floor.ts +48 -0
  75. package/src/lib/orchestrator/launcher.ts +34 -1
  76. package/src/lib/orchestrator/projection-claude-commands.ts +2 -2
  77. package/src/lib/orchestrator/projection-claude-entry.ts +42 -21
  78. package/src/lib/orchestrator/projection-claude-links.ts +32 -8
  79. package/src/lib/orchestrator/projection-claude-skills.ts +2 -2
  80. package/src/lib/orchestrator/projection-entries.ts +22 -18
  81. package/src/lib/orchestrator/projection-opencode-copies.ts +65 -21
  82. package/src/lib/orchestrator/projection-runtime-documents.ts +66 -43
  83. package/src/lib/orchestrator/projection-types.ts +28 -1
  84. package/src/lib/orchestrator/refresh-working-claude-links.ts +3 -1
  85. package/src/lib/orchestrator/session-prepare.ts +6 -1
  86. package/src/lib/orchestrator/setup-compatibilities.ts +1 -1
  87. package/src/lib/orchestrator/types.ts +4 -0
  88. package/src/lib/orchestrator/umbrella-checkouts.ts +102 -0
  89. package/src/lib/orchestrator/working-repo-projection.ts +24 -4
  90. package/src/lib/orchestrator/wrap-pass.ts +1 -0
  91. package/src/lib/public-npm.ts +95 -50
  92. package/src/lib/session-state.ts +72 -2
  93. package/src/lib/update-checker.ts +7 -1
  94. package/src/lib/usage/aggregate.ts +202 -0
  95. package/src/lib/usage/cache.ts +87 -0
  96. package/src/lib/usage/claude-pricing.ts +71 -0
  97. package/src/lib/usage/claude.ts +189 -0
  98. package/src/lib/usage/collect.ts +56 -0
  99. package/src/lib/usage/opencode.ts +188 -0
  100. package/src/lib/usage/records.ts +80 -0
  101. package/src/lib/usage/rtk-database.ts +72 -0
  102. package/src/lib/usage/savings.ts +209 -0
  103. package/src/lib/usage/scope.ts +182 -0
  104. package/src/lib/usage/source.ts +102 -0
  105. package/src/lib/usage/types.ts +143 -0
  106. package/src/lib/usage/window.ts +37 -0
  107. package/src/lib/workset/factory-local.ts +157 -0
  108. package/src/lib/workset/record.ts +25 -11
  109. package/src/lib/workset/repositories.ts +118 -25
  110. package/src/lib/workset/worktree-include.ts +161 -0
  111. package/src/lib/workset/worktree-index.ts +6 -2
  112. package/src/lib/workset/worktree.ts +591 -101
  113. package/src/opencode/companion-hooks.ts +46 -8
  114. package/src/opencode/companion-policy.ts +18 -5
  115. package/src/opencode/enter-worktree.ts +254 -6
  116. package/src/opencode/session-register.ts +2 -2
  117. package/src/runtime/claude-bg-isolation.ts +138 -0
  118. package/src/runtime/companion-git.ts +10 -2
  119. package/src/runtime/companion-guidance.ts +17 -4
  120. package/src/runtime/current-branch.ts +16 -2
  121. package/src/runtime/entered-worktree.ts +24 -0
  122. package/src/runtime/git-tracked.ts +60 -0
  123. package/src/runtime/repo-destination.ts +72 -0
  124. package/src/runtime/repo-local.ts +25 -3
  125. package/src/runtime/rtk-git-guard.ts +66 -0
  126. package/src/runtime/runtime-document-manifest.ts +229 -19
  127. package/src/runtime/runtime-document-manifest.typecheck.ts +10 -0
  128. package/src/runtime/secret-guard.ts +9 -2
  129. package/src/runtime/secret-policy-weakening.ts +122 -0
  130. package/src/runtime/serving-claude-wrap.ts +15 -2
  131. package/src/runtime/umbrella-folder.ts +56 -0
  132. package/src/runtime/wrap-state.ts +5 -13
  133. package/src/studio.ts +37 -0
  134. package/src/templates/mate-skills/agents/mate-apply-change/SKILL.md +61 -6
  135. package/src/templates/mate-skills/agents/mate-explore-change/SKILL.md +8 -4
  136. package/src/templates/mate-skills/agents/mate-propose-change/SKILL.md +9 -5
  137. package/src/templates/mate-skills/agents/mate-publish-artifact/SKILL.md +5 -4
  138. package/src/templates/mate-skills/agents/mate-show-me/SKILL.md +10 -4
  139. package/src/templates/mate-skills/agents/mate-simplify-code/SKILL.md +5 -1
  140. package/src/templates/mate-skills/claude/mate-apply-change/SKILL.md +61 -6
  141. package/src/templates/mate-skills/claude/mate-explore-change/SKILL.md +8 -4
  142. package/src/templates/mate-skills/claude/mate-propose-change/SKILL.md +9 -5
  143. package/src/templates/mate-skills/claude/mate-publish-artifact/SKILL.md +5 -4
  144. package/src/templates/mate-skills/claude/mate-show-me/SKILL.md +10 -4
  145. package/src/templates/mate-skills/claude/mate-simplify-code/SKILL.md +5 -1
  146. package/src/tools/setup/__snapshots__/runtime-surface-golden.test.ts.snap +305 -42
  147. package/src/tools/setup/capabilities/rtk.ts +93 -1
  148. package/src/tools/setup/dynamic-plugins/audiences.ts +65 -21
  149. package/src/tools/setup/dynamic-plugins/frozen.ts +32 -13
  150. package/src/tools/setup/dynamic-plugins/hydrate.ts +4 -4
  151. package/src/tools/setup/dynamic-plugins/install.ts +24 -22
  152. package/src/tools/setup/dynamic-plugins/loader.ts +11 -7
  153. package/src/tools/setup/dynamic-plugins/paths.ts +30 -10
  154. package/src/tools/setup/dynamic-plugins/verify.ts +10 -7
  155. package/src/tools/setup/dynamic-plugins/workspaces.ts +153 -0
  156. package/src/tools/setup/mate.ts +3 -3
  157. package/src/tools/setup/plugins/gitignore.ts +15 -9
  158. package/src/tools/setup/providers/claude-plugin-hooks.ts +12 -0
  159. package/src/tools/setup/providers/claude.ts +25 -3
  160. package/src/tools/setup/utils.ts +4 -2
  161. package/src/tools/setup/working-repo-cleanup.ts +2 -2
  162. package/src/tools/setup.ts +25 -14
  163. package/studio-dist/client/assets/app-D9cw6szy.css +2 -0
  164. package/studio-dist/client/assets/artifacts-WD2ZXYrx.js +1 -0
  165. package/studio-dist/client/assets/button-Br0O1sXw.js +1 -0
  166. package/studio-dist/client/assets/combobox-DA7RAUUZ.js +1 -0
  167. package/studio-dist/client/assets/companion-view-CrabvxS8.js +1 -0
  168. package/studio-dist/client/assets/factory-DGS0E16C.js +6 -0
  169. package/studio-dist/client/assets/fields-6aXBpFhJ.js +1 -0
  170. package/studio-dist/client/assets/getting-started-Clde4w6P.js +1 -0
  171. package/studio-dist/client/assets/getting-started-D6kgWwWZ.js +1 -0
  172. package/studio-dist/client/assets/getting-started._topic-BiunccbT.js +1 -0
  173. package/studio-dist/client/assets/getting-started.index-DpiNoGw8.js +1 -0
  174. package/studio-dist/client/assets/graph-B_TCBVbu.js +2 -0
  175. package/studio-dist/client/assets/graph-canvas-Ba37Y5AE.js +3242 -0
  176. package/studio-dist/client/assets/guides-Du_RtJxP.js +1 -0
  177. package/studio-dist/client/assets/index-Df8L1LQa.js +40 -0
  178. package/studio-dist/client/assets/jsx-runtime-MZURdZre.js +1 -0
  179. package/studio-dist/client/assets/markdown-view-BOX6x0rL.js +1 -0
  180. package/studio-dist/client/assets/panel-dbmCx7Mx.js +1 -0
  181. package/studio-dist/client/assets/queries-RvHeXY12.js +1 -0
  182. package/studio-dist/client/assets/react-3QStrcDO.js +27 -0
  183. package/studio-dist/client/assets/report-url-XRL0x1SY.js +1 -0
  184. package/studio-dist/client/assets/reports-r3IK7Doz.js +1 -0
  185. package/studio-dist/client/assets/routes-C0A5LTFc.js +1 -0
  186. package/studio-dist/client/assets/select-CnaMd617.js +1 -0
  187. package/studio-dist/client/assets/skills-CzjzHpBT.js +1 -0
  188. package/studio-dist/client/assets/specs-B0ldF_6J.js +1 -0
  189. package/studio-dist/client/assets/specs-view-BnCLA0gW.js +1 -0
  190. package/studio-dist/client/assets/spinner-Dcm3fqK1.js +1 -0
  191. package/studio-dist/client/assets/steps-C0p2N1Pb.js +1 -0
  192. package/studio-dist/client/assets/store-Dw34catY.js +1 -0
  193. package/studio-dist/client/assets/studio-Cpz_HRHp.js +100 -0
  194. package/studio-dist/client/assets/studio-queries-ibmpFo6R.js +2 -0
  195. package/studio-dist/client/assets/usage-C2QJ_0IZ.js +55 -0
  196. package/studio-dist/client/assets/useAnchoredPopupScrollLock-Bj-FWb8z.js +1 -0
  197. package/studio-dist/client/assets/useMutation-aAr2uiay.js +1 -0
  198. package/studio-dist/client/assets/useSelector-AYcH7lB0.js +2 -0
  199. package/studio-dist/client/assets/vault-BGcxkSIY.js +1 -0
  200. package/studio-dist/client/assets/warnings-R1cE1rLf.js +1 -0
  201. package/studio-dist/client/assets/workflow-C2qTrMDH.js +1 -0
  202. package/studio-dist/server/assets/__23tanstack-start-server-fn-resolver-Bn896ZYj.js +122 -0
  203. package/studio-dist/server/assets/_tanstack-start-manifest_v.js +102 -35
  204. package/studio-dist/server/assets/{actions-Bvgj9eb8.js → actions-DYSv-9VV.js} +10 -4
  205. package/studio-dist/server/assets/artifacts-DnF9L3dZ.js +216 -0
  206. package/studio-dist/server/assets/{button-CIJqAhni.js → button-CgOIVdmD.js} +13 -1702
  207. package/studio-dist/server/assets/combobox-DV_s9W0s.js +483 -0
  208. package/studio-dist/server/assets/{companion-view-DISASvdJ.js → companion-view-BKVXD3TO.js} +3 -3
  209. package/studio-dist/server/assets/companions-C7fctnU9.js +31 -0
  210. package/studio-dist/server/assets/{createServerRpc-tK2lE9R2.js → createServerRpc-bFKFpGFG.js} +1 -1
  211. package/studio-dist/server/assets/{factory-DUTa0eDs.js → factory-C7Ybg0xG.js} +1256 -353
  212. package/studio-dist/server/assets/{factory-DGPmNGbo.js → factory-Df5uAHjb.js} +53 -6
  213. package/studio-dist/server/assets/fields-BbieQTD0.js +1190 -0
  214. package/studio-dist/server/assets/getting-started-B136TP57.js +4 -0
  215. package/studio-dist/server/assets/getting-started-CRxMWorQ.js +67 -0
  216. package/studio-dist/server/assets/getting-started._topic-DJKQAzYl.js +13 -0
  217. package/studio-dist/server/assets/getting-started.index-D84gec1t.js +13 -0
  218. package/studio-dist/server/assets/graph-CSje3029.js +801 -0
  219. package/studio-dist/server/assets/graph-DDZzXM1L.js +16 -0
  220. package/studio-dist/server/assets/graph-canvas-22bWB5-2.js +21066 -0
  221. package/studio-dist/server/assets/graph-wire-BdSUx0G5.js +58 -0
  222. package/studio-dist/server/assets/guides-D9dk1Frq.js +13 -0
  223. package/studio-dist/server/assets/guides-IE-19POz.js +5 -0
  224. package/studio-dist/server/assets/guides.server-vcYRY5wx.js +66 -0
  225. package/studio-dist/server/assets/jsx-runtime-Bt0s0YKS.js +451 -0
  226. package/studio-dist/server/assets/{markdown-view-Bn7xPdks.js → markdown-view-BR8dJ7aR.js} +28 -9
  227. package/studio-dist/server/assets/{panel-3Jmn4awF.js → panel-BR_t9iMM.js} +4 -4
  228. package/studio-dist/server/assets/queries-DWoTin-q.js +32 -0
  229. package/studio-dist/server/assets/react-CdqSUhaL.js +89 -0
  230. package/studio-dist/server/assets/redirect-BaZ_QyqF.js +39 -0
  231. package/studio-dist/server/assets/report-url-BUXPcE_8.js +9 -0
  232. package/studio-dist/server/assets/{reports-D6YMqhnO.js → reports-CQ9qQ1-n.js} +9 -10
  233. package/studio-dist/server/assets/{reports-C06RXVE2.js → reports-dYDEoBeq.js} +3 -3
  234. package/studio-dist/server/assets/{router-C8MGqlAY.js → router-DkRHNTpE.js} +787 -2862
  235. package/studio-dist/server/assets/{routes-BcFgvqf7.js → routes-B6GfOew4.js} +22 -171
  236. package/studio-dist/server/assets/{search-JAKurDNh.js → search-BJnWLfkG.js} +21 -2
  237. package/studio-dist/server/assets/select-Af7Wibii.js +1609 -0
  238. package/studio-dist/server/assets/{shell-DS3wUexh.js → shell-Hq-hXgnT.js} +6 -5
  239. package/studio-dist/server/assets/{skills-BEnOxiDl.js → skills-B7nEuVbx.js} +9 -8
  240. package/studio-dist/server/assets/{skills-CtrBAtX3.js → skills-B_YYL7q8.js} +3 -3
  241. package/studio-dist/server/assets/specs-BpLUFntA.js +51 -0
  242. package/studio-dist/server/assets/specs-view-0peMVd22.js +426 -0
  243. package/studio-dist/server/assets/spinner-CdwJW4VB.js +20 -0
  244. package/studio-dist/server/assets/{steps-Dq_CwY_s.js → steps-D56DApvK.js} +1 -1
  245. package/studio-dist/server/assets/store-Cs17okNG.js +280 -0
  246. package/studio-dist/server/assets/studio-CAcKp3bM.js +10340 -0
  247. package/studio-dist/server/assets/studio-queries-BtRGzDdh.js +1451 -0
  248. package/studio-dist/server/assets/usage-COdjd1gD.js +25570 -0
  249. package/studio-dist/server/assets/usage-f6pqE1tm.js +24 -0
  250. package/studio-dist/server/assets/useAnchoredPopupScrollLock-DlBKHRw7.js +756 -0
  251. package/studio-dist/server/assets/useMutation-DzTZGenE.js +690 -0
  252. package/studio-dist/server/assets/{__23tanstack-start-server-fn-resolver-M2GBs8s3.js → useSelector-DUmCUXAs.js} +4 -668
  253. package/studio-dist/server/assets/{vault-Fvxt2Tzl.js → vault-BDuIUq0F.js} +8 -5
  254. package/studio-dist/server/assets/{vault-BmWnryh3.js → vault-BVLp6zu3.js} +3 -3
  255. package/studio-dist/server/assets/{views-BgYa-za2.js → views-flRUr21z.js} +4 -4
  256. package/studio-dist/server/assets/{warnings-DzR6fyZh.js → warnings-CDy9pdgL.js} +3 -2
  257. package/studio-dist/server/assets/{delivery-path-C29fBynY.js → workflow-D9GKI2EV.js} +132 -106
  258. package/studio-dist/server/server.js +582 -8
  259. package/src/cli/commands/report/collector.ts +0 -288
  260. package/studio-dist/client/assets/app-CdPiFv59.css +0 -2
  261. package/studio-dist/client/assets/button-BIIHE0EQ.js +0 -3
  262. package/studio-dist/client/assets/companion-view-DM6YyXaR.js +0 -1
  263. package/studio-dist/client/assets/delivery-path-DELxj0Av.js +0 -1
  264. package/studio-dist/client/assets/factory-BZy0E8ty.js +0 -4
  265. package/studio-dist/client/assets/index-B3wkMzjA.js +0 -40
  266. package/studio-dist/client/assets/markdown-view-pQ2Qp_i5.js +0 -1
  267. package/studio-dist/client/assets/panel-CbajlC3p.js +0 -1
  268. package/studio-dist/client/assets/prepaint-CwSrpdFA.js +0 -27
  269. package/studio-dist/client/assets/react-CN2GSx7x.js +0 -1
  270. package/studio-dist/client/assets/reports-DllhYQ5_.js +0 -1
  271. package/studio-dist/client/assets/rolldown-runtime-WkwZ5CU-.js +0 -1
  272. package/studio-dist/client/assets/routes-COm-G3mK.js +0 -1
  273. package/studio-dist/client/assets/skills-DmWAy-jZ.js +0 -1
  274. package/studio-dist/client/assets/specs-BG3Wi3ln.js +0 -1
  275. package/studio-dist/client/assets/steps-DFsH3Neu.js +0 -1
  276. package/studio-dist/client/assets/vault-B2q1nBY5.js +0 -1
  277. package/studio-dist/client/assets/warnings-BSXIyuSQ.js +0 -1
  278. package/studio-dist/client/assets/workflow-DlsQD6Hc.js +0 -1
  279. package/studio-dist/server/assets/companions-BYbHWKOZ.js +0 -15
  280. package/studio-dist/server/assets/createServerFn-F5sAOF8V.js +0 -459
  281. package/studio-dist/server/assets/prepaint-DJfTQ_VH.js +0 -45
  282. package/studio-dist/server/assets/react-Ce6dj15C.js +0 -46
  283. package/studio-dist/server/assets/rolldown-runtime-DYf_mQCB.js +0 -34
  284. package/studio-dist/server/assets/specs-C8rv34-5.js +0 -211
  285. package/studio-dist/server/assets/studio-BeltxxKt.js +0 -216
  286. package/studio-dist/server/assets/workflow-liRYecHk.js +0 -73
@@ -1,14 +1,21 @@
1
- import { i as __toESM, n as __exportAll } from "./rolldown-runtime-DYf_mQCB.js";
2
- import { $n as useIsoLayoutEffect, $r as createSsrRpc, $t as isInteractiveElement, A as useFloatingParentNodeId, Ai as partialMatchKey, An as closePress, Ar as cn, At as floor, B as visuallyHidden, Bi as Link, Bn as listNavigation, Br as factoryQuery, Bt as getSide, C as useOpenChangeComplete, Ci as functionalUpdate, Cn as getTarget, Cr as NOOP, Ct as getMinListIndex, D as FloatingNode, Di as matchMutation, Dn as ios, Dr as useBaseUiId, Dt as clamp, E as resolveRef, En as android, Er as useRefWithInit, Et as isIndexOutOfListBounds, F as CLICK_TRIGGER_IDENTIFIER, Fi as QueryClientProvider, Fn as inputChange, Ft as getExpandedPlacements, G as mergeCleanups, Gn as triggerHover, Gt as round, H as AnimationFrame, Hr as reportsQuery, Ht as max, I as DISABLED_TRANSITIONS_STYLE, Ii as useQueryClient, In as inputClear, Ir as afterRefresh, It as getOppositeAxis, J as useTimeout, Jn as createGenericEventDetails, Jt as isVirtualPointerEvent, K as addEventListener, Kn as triggerPress, Kt as isMouseLikePointerType, L as POPUP_COLLISION_AVOIDANCE, Li as lazyRouteComponent, Ln as inputPress, Lt as getOppositeAxisPlacements, M as FloatingPortal, Mi as shallowEqualObjects, Mn as escapeKey, Mr as loadView, Mt as getAlignmentAxis, N as useFloatingPortalNode, Ni as shouldThrowError, Nn as focusOut, Nr as registeredCompanion, Nt as getAlignmentSides, O as FloatingTree, Oi as matchQuery, On as mac, Or as useId, Ot as createCoords, P as usePortalContext, Pi as skipToken, Pn as imperativeAction, Pr as afterEvent, Pt as getAxisLength, Qn as formatErrorMessage, Qt as getFloatingFocusElement, R as createAttribute, Ri as createFileRoute, Rn as itemPress, Rt as getOppositePlacement, S as useUnmountAfterClose, Si as Subscribable, Sn as contains, Sr as EMPTY_OBJECT, St as getMaxListIndex, T as useDismiss, Ti as hashQueryKeyByOptions, Tn as webkit, Tr as useMergedRefs, Tt as isElementVisible, U as useAnimationFrame, Un as pointer, Ur as shellQuery, Ut as min, V as visuallyHiddenInput, Vi as useNavigate, Vn as none, Vr as holdShellForMode, Vt as getSideAxis, W as useValueAsRef, Wn as triggerFocus, Wt as rectToClientRect, X as fastComponent, Xn as useButton, Xt as getNodeAncestors, Y as useOnMount, Yn as useCompositeListItem, Yt as stopEvent, Z as fastComponentRef, Zn as ownerDocument, Zr as getShell, Zt as getNodeChildren, _ as useOpenStateTransitions, _i as Removable, _n as ARROW_LEFT, _r as isTopLayer, _t as getTabbableNearElement, a as popupStoreSelectors, ai as STUDIO_EVENTS_ROUTE, an as popupStateMapping, ar as getNodeName, b as usePopupRootSync, bi as notifyManager, bn as activeElement, br as mergeProps, bt as tabbable, c as require_shim, ci as TERMINAL_SOCKET_ROUTE, cn as triggerOpenStateMapping, cr as getParentNode, d as PopupHandleAttachment, dr as isElement, dt as useToolbarRootContext, en as isTargetInsideEnabledTrigger, er as useStableCallback, et as Count, f as applyPopupOpenChange, fi as useQuery, fr as isHTMLElement, ft as useDirection, g as useImplicitActiveTrigger, gi as Query, gn as ARROW_DOWN, gr as isTableElement, gt as getPreviousTabbable, h as createPopupOpenState, hi as QueryObserver, hn as transitionStatusMapping, hr as isShadowRoot, ht as getNextTabbable, i as createInitialPopupStoreState, in as triggerDisabled, ir as getFrameElement, it as PageHeader, j as useFloatingTree, ji as resolveQueryValue, jn as disabled, jr as loadHeld, jt as getAlignment, k as useFloatingNodeId, ki as noop, kn as CompositeList, kr as useControlled, kt as evaluate, l as PopupTriggerMap, li as TERMINAL_WASM, lr as getWindow, lt as ToggleGroup, m as createDefaultInitialFocus, mi as defaultThrowOnError, mr as isOverflowElement, mt as focusable, nn as isTypeableElement, nr as getContainingBlock, o as FloatingRootStore, oi as TERMINAL_SESSIONS_END_ROUTE, on as popupTransitionStateMapping, or as getNodeScroll, p as attachPreventUnmountOnClose, pi as useBaseQuery, pr as isLastTraversableNode, pt as COMPOSITE_KEYS, q as Timeout, qn as createChangeEventDetails, qr as vaultQuery, qt as isVirtualClick, r as Icon, rn as matchesFocusVisible, rr as getDocumentElement, s as ReactStore, si as TERMINAL_SESSIONS_ROUTE, sn as pressableTriggerOpenStateMapping, sr as getOverflowAncestors, t as Button, tn as isTypeableCombobox, tr as getComputedStyle$1, u as FOCUSABLE_POPUP_PROPS, ur as isContainingBlock, ut as ToggleGroupItem, v as usePopupInteractionProps, vi as createRetryer, vn as ARROW_RIGHT, vr as isWebKit, vt as isOutsideEvent, w as useAnimationsFinished, wi as hashKey, wn as gecko, wr as isReactVersionAtLeast, wt as getNextListIndex, x as useTriggerDataForwarding, xi as focusManager, xn as closest, xr as EMPTY_ARRAY, xt as getGridNavigatedIndex, y as usePopupRootStore, yi as onlineManager, yn as ARROW_UP, yr as useRenderElement, yt as isTabbable, z as FocusGuard, zi as createRootRouteWithContext, zn as keyboard, zr as companionViewQuery, zt as getPaddingObject } from "./button-CIJqAhni.js";
3
- import { b as createNonReactiveReadonlyStore, c as useRouter, g as RouterCore, j as require_react, m as _getAssetMatches, n as require_react_dom, u as require_jsx_runtime, y as createNonReactiveMutableStore } from "./__23tanstack-start-server-fn-resolver-M2GBs8s3.js";
4
- import { t as createServerFn, y as redirect } from "./createServerFn-F5sAOF8V.js";
5
- import { a as appendUniqueUserTags, c as resolveManifestCssLink, i as useHydrated, n as useMatches, o as getAssetCrossOrigin, r as Outlet, s as getScriptPreloadAttrs } from "../server.js";
1
+ import { $ as partialMatchKey, C as createSsrRpc, E as call, F as TERMINAL_WASM, G as hashKey, K as hashQueryKeyByOptions, M as TERMINAL_SESSIONS_END_ROUTE, N as TERMINAL_SESSIONS_ROUTE, P as TERMINAL_SOCKET_ROUTE, Q as noop, W as functionalUpdate, X as matchMutation, Z as matchQuery, d as shellQuery, dt as createRootRouteWithContext, ft as Link, h as vaultQuery, it as skipToken, j as STUDIO_EVENTS_ROUTE, k as FACTORY_GIT_TOKENS_ROUTE, l as holdShellForMode, lt as lazyRouteComponent, o as companionViewQuery, pt as useNavigate, r as afterRefresh, s as factoryQuery, t as afterEvent, tt as resolveQueryValue, u as reportsQuery, ut as createFileRoute, y as getShell } from "./studio-queries-BtRGzDdh.js";
2
+ import { $ as ToggleGroup, $n as getFrameElement, $t as triggerOpenStateMapping, A as useFloatingParentNodeId, An as inputClear, Ar as QueryObserver, At as getPaddingObject, B as FocusGuard, Bn as triggerPress, Bt as stopEvent, C as useAnimationsFinished, Ct as getAlignmentAxis, D as FloatingNode, Dn as focusOut, Dr as useQuery, Dt as getOppositeAxis, En as escapeKey, Et as getExpandedPlacements, F as CLICK_TRIGGER_IDENTIFIER, Fn as none, Fr as notifyManager, Ft as rectToClientRect, G as useValueAsRef, Gn as useButton, Gt as isTargetInsideEnabledTrigger, H as visuallyHiddenInput, Hn as createChangeEventDetails, Ht as getNodeChildren, I as DISABLED_TRANSITIONS_STYLE, Ir as focusManager, It as round, J as Timeout, Jn as useIsoLayoutEffect, Jt as matchesFocusVisible, K as mergeCleanups, Kn as ownerDocument, Ln as pointer, Lr as Subscribable, Lt as isMouseLikePointerType, M as FloatingPortal, Mn as itemPress, Mt as getSideAxis, N as useFloatingPortalNode, Nn as keyboard, Nt as max, O as FloatingTree, On as imperativeAction, Or as useBaseQuery, Ot as getOppositeAxisPlacements, Pr as onlineManager, Pt as min, Q as fastComponentRef, Qn as getDocumentElement, Qt as pressableTriggerOpenStateMapping, R as POPUP_COLLISION_AVOIDANCE, Rn as triggerFocus, Rr as QueryClientProvider, S as useOpenChangeComplete, Sn as CompositeList, Sr as useBaseUiId, St as getAlignment, T as useDismiss, Tn as disabled, Tr as cn, Tt as getAxisLength, Un as createGenericEventDetails, V as visuallyHidden, Wn as useCompositeListItem, Wt as isInteractiveElement, X as useOnMount, Xn as getComputedStyle$1, Xt as popupStateMapping, Y as useTimeout, Yn as useStableCallback, Yt as triggerDisabled, Z as fastComponent, Zn as getContainingBlock, Zt as popupTransitionStateMapping, _ as usePopupInteractionProps, _n as webkit, _r as EMPTY_OBJECT, a as ReactStore, ar as isContainingBlock, b as useTriggerDataForwarding, bn as mac, br as useMergedRefs, bt as evaluate, c as PopupTriggerMap, cr as isLastTraversableNode, ct as isOutsideEvent, d as applyPopupOpenChange, dn as activeElement, dr as isTableElement, dt as getGridNavigatedIndex, er as getNodeName, et as ToggleGroupItem, f as attachPreventUnmountOnClose, fn as closest, fr as isTopLayer, g as useOpenStateTransitions, gn as gecko, gr as EMPTY_ARRAY, gt as isIndexOutOfListBounds, h as useImplicitActiveTrigger, hr as mergeProps, ir as getWindow, j as useFloatingTree, jn as inputPress, jr as Query, jt as getSide, k as useFloatingNodeId, kn as inputChange, kr as defaultThrowOnError, kt as getOppositePlacement, l as FOCUSABLE_POPUP_PROPS, lr as isOverflowElement, m as createPopupOpenState, mn as getTarget, mr as useRenderElement, nr as getOverflowAncestors, nt as useDirection, on as transitionStatusMapping, or as isElement, p as createDefaultInitialFocus, pn as contains, pr as isWebKit, q as addEventListener, qn as formatErrorMessage, qt as isTypeableElement, r as Icon, rr as getParentNode, rt as COMPOSITE_KEYS, s as require_shim, sr as isHTMLElement, st as getTabbableNearElement, t as Button, tr as getNodeScroll, tt as useToolbarRootContext, u as PopupHandleAttachment, v as usePopupRootStore, vn as android, vr as NOOP, vt as clamp, wn as closePress, wr as useControlled, wt as getAlignmentSides, x as useUnmountAfterClose, xr as useRefWithInit, xt as floor, y as usePopupRootSync, yn as ios, yt as createCoords, z as createAttribute, zn as triggerHover, zr as useQueryClient } from "./button-CgOIVdmD.js";
3
+ import { n as Mutation, t as useMutation } from "./useMutation-DzTZGenE.js";
4
+ import { a as useRouter, c as _getAssetMatches, m as createNonReactiveReadonlyStore, p as createNonReactiveMutableStore, u as RouterCore } from "./useSelector-DUmCUXAs.js";
5
+ import { i as __exportAll, n as require_react, o as __toESM, t as require_jsx_runtime } from "./jsx-runtime-Bt0s0YKS.js";
6
+ import { r as redirect } from "./redirect-BaZ_QyqF.js";
7
+ import { a as useMatches, c as appendUniqueUserTags, d as resolveManifestCssLink, i as require_react_dom, l as getAssetCrossOrigin, n as createServerFn, o as Outlet, s as useHydrated, u as getScriptPreloadAttrs } from "../server.js";
6
8
  import { s as escapeHtml } from "./utils-C9CX1kcy.js";
9
+ import { g as STUDIO_MODES, h as SHARED_VIEWS, m as MODE_VIEWS, n as LIGHT_PALETTE, r as WORKSET_STAGE_ORDER, t as DARK_PALETTE, u as COMPANION_DIGEST_PATTERN, x as viewsFor } from "./studio-CAcKp3bM.js";
7
10
  import { t as formatCollectedAt } from "./model-PyPALjii.js";
8
- import { b as viewsFor, h as STUDIO_MODES, l as COMPANION_DIGEST_PATTERN, m as SHARED_VIEWS, n as LIGHT_PALETTE, p as MODE_VIEWS, r as WORKSET_STAGE_ORDER, t as DARK_PALETTE } from "./studio-BeltxxKt.js";
9
- import { a as VAULT_TREE_STORAGE_KEY, i as THEME_STORAGE_KEY, n as RAIL_STORAGE_KEY, r as STUDIO_PREPAINT_SCRIPT, t as COMPANION_STORAGE_KEY } from "./prepaint-DJfTQ_VH.js";
10
- import { n as validateStudioSearch, t as canonicalHref } from "./search-JAKurDNh.js";
11
- import { t as create } from "./react-Ce6dj15C.js";
11
+ import { a as THEME_STORAGE_KEY, i as STUDIO_PREPAINT_SCRIPT, n as COMPANION_STORAGE_KEY, o as VAULT_TREE_STORAGE_KEY, r as RAIL_STORAGE_KEY, t as create } from "./react-CdqSUhaL.js";
12
+ import { n as loadView, r as registeredCompanion, t as loadHeld } from "./queries-DWoTin-q.js";
13
+ import { n as validateSpecsSearch, r as validateStudioSearch, t as canonicalHref } from "./search-BJnWLfkG.js";
14
+ import { a as Count, l as PageHeader, n as popupStoreSelectors, t as createInitialPopupStoreState } from "./store-Cs17okNG.js";
15
+ import { _ as inertValue, a as InternalBackdrop, c as useLabelableId, d as useRegisterFieldControl, f as DEFAULT_FIELD_ROOT_CONTEXT, g as fieldValidityMapping, h as DEFAULT_FIELD_STATE_ATTRIBUTES, i as useScrollLock, l as useLabelableContext, m as useFieldRootContext, n as Kbd, o as useSetFieldFocused, p as FieldRootContext, r as Separator, s as useValueChanged, t as Input, u as useFormContext, v as FloatingFocusManager } from "./fields-BbieQTD0.js";
16
+ import "./__23tanstack-start-server-fn-resolver-Bn896ZYj.js";
17
+ import { t as getGuide } from "./guides-IE-19POz.js";
18
+ import { S as useClick, _ as resolveSelectedIndex, a as hasNullItemLabel, b as useListNavigation, d as compareItemEquality, f as defaultItemEquality, g as removeItem, h as isSelectedValueDirty, i as flattenLeafItems, l as stringifyAsLabel, m as findSelectionIndex, n as useOpenInteractionType, o as isGroupedItems, p as findItemIndex, r as useOpenMethodTriggerProps, t as useAnchoredPopupScrollLock, u as stringifyAsValue, v as selectedValueIncludes, x as useFloatingRootContext, y as useOnFirstRender } from "./useAnchoredPopupScrollLock-DlBKHRw7.js";
12
19
  // ../../node_modules/.bun/@tanstack+router-core@1.171.39/node_modules/@tanstack/router-core/dist/esm/ssr/bodyScripts.js
13
20
  function getSsrBodyScriptParts(matches, manifest, nonce, routeScriptAttrs) {
14
21
  const assetMatches = _getAssetMatches(matches);
@@ -600,314 +607,6 @@ function dehydrateQuery(query, serializeData, shouldRedactErrors) {
600
607
  ...query.queryType && { queryType: query.queryType }
601
608
  };
602
609
  }
603
- // ../../node_modules/.bun/@tanstack+query-core@5.105.3/node_modules/@tanstack/query-core/build/modern/mutation.js
604
- /**
605
- * Represents a single mutation attempt. A `Mutation` holds the mutation's
606
- * options, state (data/error/status), and the `MutationObserver`s currently
607
- * subscribed to it.
608
- *
609
- * Instances are created and managed internally by `MutationCache`; application
610
- * code typically interacts with mutations indirectly through `QueryClient` or
611
- * a framework hook like `useMutation`. Direct access to a `Mutation` instance
612
- * is possible via `mutationCache.find()`/`getAll()` for inspecting cache state.
613
- * @example
614
- * ```ts
615
- * const mutationCache = queryClient.getMutationCache()
616
- *
617
- * const mutation = mutationCache.find({ mutationKey: ['addPost'] })
618
- * ```
619
- */
620
- var Mutation = class extends Removable {
621
- #client;
622
- #observers;
623
- #mutationCache;
624
- #retryer;
625
- constructor(config) {
626
- super();
627
- this.#client = config.client;
628
- this.mutationId = config.mutationId;
629
- this.#mutationCache = config.mutationCache;
630
- this.#observers = [];
631
- this.state = config.state || getDefaultState();
632
- this.setOptions(config.options);
633
- this.scheduleGc();
634
- }
635
- /**
636
- * Replaces the mutation's options and applies their `gcTime`.
637
- * @internal
638
- * @param options - The new mutation options.
639
- */
640
- setOptions(options) {
641
- this.options = options;
642
- this.updateGcTime(this.options.gcTime);
643
- }
644
- /**
645
- * The `meta` object passed in the mutation's options, if any.
646
- * @returns The mutation's `meta`, or `undefined` if none was set.
647
- */
648
- get meta() {
649
- return this.options.meta;
650
- }
651
- /**
652
- * Subscribes an observer to the mutation and stops its garbage collection.
653
- * @internal
654
- * @param observer - The observer to add. Adding an observer that is already subscribed does
655
- * nothing.
656
- */
657
- addObserver(observer) {
658
- if (!this.#observers.includes(observer)) {
659
- this.#observers.push(observer);
660
- this.clearGcTimeout();
661
- this.#mutationCache.notify({
662
- type: "observerAdded",
663
- mutation: this,
664
- observer
665
- });
666
- }
667
- }
668
- /**
669
- * Unsubscribes an observer from the mutation.
670
- * @internal
671
- * @param observer - The observer to remove. Garbage collection is scheduled afterwards.
672
- */
673
- removeObserver(observer) {
674
- this.#observers = this.#observers.filter((x) => x !== observer);
675
- this.scheduleGc();
676
- this.#mutationCache.notify({
677
- type: "observerRemoved",
678
- mutation: this,
679
- observer
680
- });
681
- }
682
- optionalRemove() {
683
- if (!this.#observers.length) {
684
- if (this.state.status === "pending") this.scheduleGc();
685
- else this.#mutationCache.remove(this);
686
- }
687
- }
688
- /**
689
- * Resumes a mutation that is currently paused or was restored from a
690
- * dehydrated, still-`pending` state.
691
- *
692
- * - If this mutation has an active retryer (it paused mid-attempt, e.g. due
693
- * to the network mode or scope-based queuing), its retryer is resumed.
694
- * - Otherwise, if the mutation's status is still `pending` (e.g. it was
695
- * dehydrated while an attempt was in flight and never got a retryer in
696
- * this instance), `execute` is called again with the last known variables.
697
- * - Otherwise the mutation has already settled and this resolves immediately
698
- * without running anything again.
699
- * @returns A promise that settles with the resumed mutation: it rejects if the mutation fails.
700
- * It resolves immediately if the mutation has already settled.
701
- * @see {@link Mutation#execute}
702
- * @example
703
- * ```ts
704
- * // typically driven by reconnect handling, e.g. queryClient.resumePausedMutations()
705
- * const mutation = mutationCache.find({ mutationKey: ['addPost'] })
706
- * await mutation?.continue()
707
- * ```
708
- */
709
- continue() {
710
- return this.#retryer?.continue() ?? (this.state.status === "pending" ? this.execute(this.state.variables) : Promise.resolve());
711
- }
712
- /**
713
- * Runs the mutation function for the given variables through a retryer, and
714
- * drives the mutation's state and lifecycle callbacks through to settlement.
715
- *
716
- * If this mutation's state is already `pending` when `execute` is called
717
- * (i.e. it was restored, still in-flight, from a dehydrated state), the
718
- * `onMutate` step is skipped and a `continue` action is dispatched to
719
- * unpause it; otherwise a `pending` action is dispatched first, then the
720
- * mutation cache's `onMutate` and the mutation's own `onMutate` option are
721
- * awaited in that order, and the resulting context is stored.
722
- *
723
- * The mutation function is then run (subject to `retry`/`retryDelay`/
724
- * `networkMode`, and to the mutation cache's scope-based serialization).
725
- * On success, the cache's `onSuccess`/`onSettled` callbacks run before the
726
- * mutation's own `onSuccess`/`onSettled` options, a `success` action is
727
- * dispatched, and the resolved data is returned. On failure, the same
728
- * cache-then-option ordering is used for `onError`/`onSettled`, but each of
729
- * those four callbacks is individually caught so that a throwing callback
730
- * cannot mask the original error; an `error` action is then dispatched and
731
- * the original error is re-thrown.
732
- * @param variables - The variables passed to the `mutationFn`.
733
- * @returns A promise that resolves with the mutation's data, or rejects with its error.
734
- * @see {@link Mutation#continue}
735
- * @example
736
- * ```ts
737
- * // Called internally by `MutationObserver.mutate` and `Mutation.continue` —
738
- * // applications normally trigger mutations through those, not this method.
739
- * const data = await mutation.execute(variables)
740
- * ```
741
- */
742
- async execute(variables) {
743
- const onContinue = () => {
744
- this.#dispatch({ type: "continue" });
745
- };
746
- const mutationFnContext = {
747
- client: this.#client,
748
- meta: this.options.meta,
749
- mutationKey: this.options.mutationKey
750
- };
751
- const retryer = this.#retryer = createRetryer({
752
- fn: () => {
753
- if (!this.options.mutationFn) return Promise.reject(/* @__PURE__ */ new Error("No mutationFn found"));
754
- return this.options.mutationFn(variables, mutationFnContext);
755
- },
756
- onFail: (failureCount, error) => {
757
- this.#dispatch({
758
- type: "failed",
759
- failureCount,
760
- error
761
- });
762
- },
763
- onPause: () => {
764
- this.#dispatch({ type: "pause" });
765
- },
766
- onContinue,
767
- retry: this.options.retry ?? 0,
768
- retryDelay: this.options.retryDelay,
769
- networkMode: this.options.networkMode,
770
- canRun: () => this.#mutationCache.canRun(this)
771
- });
772
- const restored = this.state.status === "pending";
773
- const isPaused = !retryer.canStart();
774
- try {
775
- if (restored) onContinue();
776
- else {
777
- this.#dispatch({
778
- type: "pending",
779
- variables,
780
- isPaused
781
- });
782
- if (this.#mutationCache.config.onMutate) await this.#mutationCache.config.onMutate(variables, this, mutationFnContext);
783
- const context = await this.options.onMutate?.(variables, mutationFnContext);
784
- if (context !== this.state.context) this.#dispatch({
785
- type: "pending",
786
- context,
787
- variables,
788
- isPaused
789
- });
790
- }
791
- if (this.state.isPaused && retryer.canStart()) onContinue();
792
- const data = await retryer.start();
793
- await this.#mutationCache.config.onSuccess?.(data, variables, this.state.context, this, mutationFnContext);
794
- await this.options.onSuccess?.(data, variables, this.state.context, mutationFnContext);
795
- await this.#mutationCache.config.onSettled?.(data, null, this.state.variables, this.state.context, this, mutationFnContext);
796
- await this.options.onSettled?.(data, null, variables, this.state.context, mutationFnContext);
797
- this.#dispatch({
798
- type: "success",
799
- data
800
- });
801
- return data;
802
- } catch (error) {
803
- try {
804
- await this.#mutationCache.config.onError?.(error, variables, this.state.context, this, mutationFnContext);
805
- } catch (e) {
806
- Promise.reject(e);
807
- }
808
- try {
809
- await this.options.onError?.(error, variables, this.state.context, mutationFnContext);
810
- } catch (e) {
811
- Promise.reject(e);
812
- }
813
- try {
814
- await this.#mutationCache.config.onSettled?.(void 0, error, this.state.variables, this.state.context, this, mutationFnContext);
815
- } catch (e) {
816
- Promise.reject(e);
817
- }
818
- try {
819
- await this.options.onSettled?.(void 0, error, variables, this.state.context, mutationFnContext);
820
- } catch (e) {
821
- Promise.reject(e);
822
- }
823
- this.#dispatch({
824
- type: "error",
825
- error
826
- });
827
- throw error;
828
- } finally {
829
- if (this.#retryer === retryer) this.#retryer = void 0;
830
- this.#mutationCache.runNext(this);
831
- }
832
- }
833
- #dispatch(action) {
834
- const reducer = (state) => {
835
- switch (action.type) {
836
- case "failed": return {
837
- ...state,
838
- failureCount: action.failureCount,
839
- failureReason: action.error
840
- };
841
- case "pause": return {
842
- ...state,
843
- isPaused: true
844
- };
845
- case "continue": return {
846
- ...state,
847
- isPaused: false
848
- };
849
- case "pending": return {
850
- ...state,
851
- context: action.context,
852
- data: void 0,
853
- failureCount: 0,
854
- failureReason: null,
855
- error: null,
856
- isPaused: action.isPaused,
857
- status: "pending",
858
- variables: action.variables,
859
- submittedAt: Date.now()
860
- };
861
- case "success": return {
862
- ...state,
863
- data: action.data,
864
- failureCount: 0,
865
- failureReason: null,
866
- error: null,
867
- status: "success",
868
- isPaused: false
869
- };
870
- case "error": return {
871
- ...state,
872
- data: void 0,
873
- error: action.error,
874
- failureCount: state.failureCount + 1,
875
- failureReason: action.error,
876
- isPaused: false,
877
- status: "error"
878
- };
879
- }
880
- };
881
- this.state = reducer(this.state);
882
- notifyManager.batch(() => {
883
- this.#observers.forEach((observer) => {
884
- observer.onMutationUpdate(action);
885
- });
886
- this.#mutationCache.notify({
887
- mutation: this,
888
- type: "updated",
889
- action
890
- });
891
- });
892
- }
893
- };
894
- /**
895
- * Returns the initial state of a mutation: `'idle'`, with no data, error, or variables.
896
- * @returns The initial mutation state.
897
- */
898
- function getDefaultState() {
899
- return {
900
- context: void 0,
901
- data: void 0,
902
- error: null,
903
- failureCount: 0,
904
- failureReason: null,
905
- isPaused: false,
906
- status: "idle",
907
- variables: void 0,
908
- submittedAt: 0
909
- };
910
- }
911
610
  // ../../node_modules/.bun/@tanstack+query-core@5.105.3/node_modules/@tanstack/query-core/build/modern/mutationCache.js
912
611
  /**
913
612
  * The `MutationCache` is the storage for mutations.
@@ -1130,197 +829,6 @@ var MutationCache = class extends Subscribable {
1130
829
  function scopeFor(mutation) {
1131
830
  return mutation.options.scope?.id;
1132
831
  }
1133
- // ../../node_modules/.bun/@tanstack+query-core@5.105.3/node_modules/@tanstack/query-core/build/modern/mutationObserver.js
1134
- /**
1135
- * Observes a single mutation and derives a `MutationObserverResult` from it.
1136
- * A framework hook like `useMutation` creates one `MutationObserver` per hook
1137
- * call, keeps it stable across re-renders, calls `setOptions` when the options
1138
- * passed to the hook change, subscribes to it to re-render on updates, and
1139
- * reads `getCurrentResult()` for the value to return. Calling `mutate()`
1140
- * builds a new underlying `Mutation` in the `MutationCache` and executes it.
1141
- * @example
1142
- * ```ts
1143
- * const observer = new MutationObserver(queryClient, {
1144
- * mutationFn: (variables: { title: string }) => addPost(variables),
1145
- * })
1146
- * ```
1147
- */
1148
- var MutationObserver = class extends Subscribable {
1149
- #client;
1150
- #currentResult = void 0;
1151
- #currentMutation;
1152
- #mutateOptions;
1153
- constructor(client, options) {
1154
- super();
1155
- this.#client = client;
1156
- this.setOptions(options);
1157
- this.bindMethods();
1158
- this.#updateResult();
1159
- }
1160
- /**
1161
- * Binds the methods of the result (`mutate` and `reset`) to the observer, so they keep working when
1162
- * destructured from it.
1163
- */
1164
- bindMethods() {
1165
- this.mutate = this.mutate.bind(this);
1166
- this.reset = this.reset.bind(this);
1167
- }
1168
- /**
1169
- * Updates the observer's options.
1170
- *
1171
- * If the new `mutationKey` differs from the previous one (and both were
1172
- * defined), the observer is reset, detaching it from the mutation it was
1173
- * observing. Otherwise, if the currently observed mutation is still
1174
- * `pending`, its options are updated in place as well.
1175
- * @param options - The new mutation observer options. They are defaulted with {@link
1176
- * QueryClient#defaultMutationOptions} before being applied.
1177
- * @example
1178
- * ```ts
1179
- * observer.setOptions({
1180
- * mutationFn: (variables: { title: string }) => addPost(variables),
1181
- * onSuccess: (data) => console.log(data),
1182
- * })
1183
- * ```
1184
- */
1185
- setOptions(options) {
1186
- const prevOptions = this.options;
1187
- this.options = this.#client.defaultMutationOptions(options);
1188
- if (!shallowEqualObjects(this.options, prevOptions)) this.#client.getMutationCache().notify({
1189
- type: "observerOptionsUpdated",
1190
- mutation: this.#currentMutation,
1191
- observer: this
1192
- });
1193
- if (prevOptions?.mutationKey && this.options.mutationKey && hashKey(prevOptions.mutationKey) !== hashKey(this.options.mutationKey)) this.reset();
1194
- else if (this.#currentMutation?.state.status === "pending") this.#currentMutation.setOptions(this.options);
1195
- }
1196
- onSubscribe() {
1197
- if (this.listeners.size === 1 && this.#currentMutation) {
1198
- this.#currentMutation.addObserver(this);
1199
- this.#updateResult();
1200
- }
1201
- }
1202
- onUnsubscribe() {
1203
- if (!this.hasListeners()) this.#currentMutation?.removeObserver(this);
1204
- }
1205
- /**
1206
- * Updates the observer's result when the observed mutation changes, and notifies its listeners.
1207
- * @internal
1208
- * @param action - The action that updated the observed mutation, passed on to the observer's
1209
- * callbacks.
1210
- */
1211
- onMutationUpdate(action) {
1212
- this.#updateResult();
1213
- this.#notify(action);
1214
- }
1215
- /**
1216
- * Returns the observer's current result, derived from the observed
1217
- * mutation's state (or the default, `idle` state if no mutation has been
1218
- * built yet, e.g. before the first `mutate()` call or after `reset()`).
1219
- * @returns The observer's latest result.
1220
- */
1221
- getCurrentResult() {
1222
- return this.#currentResult;
1223
- }
1224
- /**
1225
- * Detaches the observer from the mutation it is currently observing (if
1226
- * any) and resets the observed result back to its default, `idle` state.
1227
- *
1228
- * This does not cancel an in-flight mutation; the mutation itself keeps
1229
- * running to completion and its own callbacks still fire, but this
1230
- * observer stops reflecting its state and a subsequent `mutate()` call
1231
- * will build a brand new mutation.
1232
- * @see {@link MutationObserver#mutate}
1233
- * @example
1234
- * ```ts
1235
- * observer.reset()
1236
- * ```
1237
- */
1238
- reset() {
1239
- this.#currentMutation?.removeObserver(this);
1240
- this.#currentMutation = void 0;
1241
- this.#updateResult();
1242
- this.#notify();
1243
- }
1244
- /**
1245
- * Builds a new `Mutation` in the `MutationCache` using the observer's
1246
- * current options, detaches this observer from any previously observed
1247
- * mutation, attaches it to the new one, and executes it with the given
1248
- * variables.
1249
- *
1250
- * The optional per-call `options` (`onSuccess`/`onError`/`onSettled`) are
1251
- * invoked once the mutation settles, in addition to any callbacks defined
1252
- * on the observer's own options.
1253
- * @param variables - The variables passed to the `mutationFn`.
1254
- * @param options - Per-call `onSuccess`, `onError`, and `onSettled` callbacks.
1255
- * @returns A promise that resolves with the mutation's data, or rejects with its error.
1256
- * @example
1257
- * ```ts
1258
- * await observer.mutate(
1259
- * { title: 'New post' },
1260
- * { onSuccess: (data) => console.log(data) },
1261
- * )
1262
- * ```
1263
- */
1264
- mutate(variables, options) {
1265
- this.#mutateOptions = options;
1266
- this.#currentMutation?.removeObserver(this);
1267
- this.#currentMutation = this.#client.getMutationCache().build(this.#client, this.options);
1268
- this.#currentMutation.addObserver(this);
1269
- return this.#currentMutation.execute(variables);
1270
- }
1271
- #updateResult() {
1272
- const state = this.#currentMutation?.state ?? getDefaultState();
1273
- this.#currentResult = {
1274
- ...state,
1275
- isPending: state.status === "pending",
1276
- isSuccess: state.status === "success",
1277
- isError: state.status === "error",
1278
- isIdle: state.status === "idle",
1279
- mutate: this.mutate,
1280
- reset: this.reset
1281
- };
1282
- }
1283
- #notify(action) {
1284
- notifyManager.batch(() => {
1285
- const mutateOptions = this.#mutateOptions;
1286
- if (mutateOptions && this.hasListeners()) {
1287
- const variables = this.#currentResult.variables;
1288
- const onMutateResult = this.#currentResult.context;
1289
- const context = {
1290
- client: this.#client,
1291
- meta: this.options.meta,
1292
- mutationKey: this.options.mutationKey
1293
- };
1294
- if (action?.type === "success") {
1295
- try {
1296
- mutateOptions.onSuccess?.(action.data, variables, onMutateResult, context);
1297
- } catch (e) {
1298
- Promise.reject(e);
1299
- }
1300
- try {
1301
- mutateOptions.onSettled?.(action.data, null, variables, onMutateResult, context);
1302
- } catch (e) {
1303
- Promise.reject(e);
1304
- }
1305
- } else if (action?.type === "error") {
1306
- try {
1307
- mutateOptions.onError?.(action.error, variables, onMutateResult, context);
1308
- } catch (e) {
1309
- Promise.reject(e);
1310
- }
1311
- try {
1312
- mutateOptions.onSettled?.(void 0, action.error, variables, onMutateResult, context);
1313
- } catch (e) {
1314
- Promise.reject(e);
1315
- }
1316
- }
1317
- }
1318
- this.listeners.forEach((listener) => {
1319
- listener(this.#currentResult);
1320
- });
1321
- });
1322
- }
1323
- };
1324
832
  // ../../node_modules/.bun/@tanstack+query-core@5.105.3/node_modules/@tanstack/query-core/build/modern/queryCache.js
1325
833
  /**
1326
834
  * The `QueryCache` is the storage mechanism for TanStack Query. It stores all the data, meta
@@ -2348,192 +1856,6 @@ function useSuspenseQuery(options, queryClient) {
2348
1856
  placeholderData: void 0
2349
1857
  }, QueryObserver, queryClient);
2350
1858
  }
2351
- // ../../node_modules/.bun/@tanstack+react-query@5.105.3+cef22a3c7e8b4cef/node_modules/@tanstack/react-query/build/modern/useMutation.js
2352
- /**
2353
- * Unlike queries, mutations are typically used to create/update/delete data or perform server side-effects.
2354
- * `useMutation` is the hook for that.
2355
- * @param options - The {@link UseMutationOptions} to use — everything you can pass to `useMutation`.
2356
- * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will
2357
- * be used.
2358
- * @returns `mutate`/`mutateAsync` also accept per-call `onSuccess`/`onError`/`onSettled` callbacks as a second
2359
- * argument, useful for triggering call-site side effects (e.g. navigation) without coupling them to the shared
2360
- * mutation definition. Hook-level callbacks (passed to `options`) fire for every mutation; per-call callbacks
2361
- * fire only for the latest call you've made, and only while the component is still mounted — unmounting before
2362
- * the mutation settles removes the subscription and prevents them from firing.
2363
- * @throws {Error} The mutation error, when `throwOnError` is `true` or returns `true` for it, so that it is
2364
- * thrown to the nearest error boundary.
2365
- * @see {@link mutationOptions} to share these options across multiple `useMutation` call sites, or to look
2366
- * the mutation up elsewhere via its `mutationKey` (e.g. with `useMutationState`).
2367
- * @example
2368
- * ```tsx
2369
- * import { useMutation, useQueryClient } from '@tanstack/react-query'
2370
- *
2371
- * function AddTodo() {
2372
- * const queryClient = useQueryClient()
2373
- *
2374
- * const addMutation = useMutation({
2375
- * mutationFn: addTodo,
2376
- * onSuccess: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),
2377
- * })
2378
- *
2379
- * return (
2380
- * <button
2381
- * onClick={() =>
2382
- * addMutation.mutate('Item', {
2383
- * onError: (error) => console.error('Failed to add item:', error),
2384
- * })
2385
- * }
2386
- * >
2387
- * Add
2388
- * </button>
2389
- * )
2390
- * }
2391
- * ```
2392
- * @example
2393
- * Rendering the mutation's own state, rather than just firing it off:
2394
- * ```tsx
2395
- * import { useMutation, useQueryClient } from '@tanstack/react-query'
2396
- *
2397
- * function AddTodo() {
2398
- * const queryClient = useQueryClient()
2399
- *
2400
- * const addMutation = useMutation({
2401
- * mutationFn: addTodo,
2402
- * onSuccess: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),
2403
- * })
2404
- *
2405
- * return (
2406
- * <div>
2407
- * {addMutation.isPending ? (
2408
- * 'Adding todo...'
2409
- * ) : (
2410
- * <>
2411
- * {addMutation.isError ? (
2412
- * <div>An error occurred: {addMutation.error.message}</div>
2413
- * ) : null}
2414
- * <button onClick={() => addMutation.mutate('Item')}>Add</button>
2415
- * </>
2416
- * )}
2417
- * </div>
2418
- * )
2419
- * }
2420
- * ```
2421
- * @example
2422
- * Optimistic update via `onMutate`, rolling back on `onError`:
2423
- * ```tsx
2424
- * import { useMutation, useQueryClient } from '@tanstack/react-query'
2425
- *
2426
- * function AddTodo() {
2427
- * const queryClient = useQueryClient()
2428
- *
2429
- * const addMutation = useMutation({
2430
- * mutationFn: addTodo,
2431
- * onMutate: async (newTodo) => {
2432
- * await queryClient.cancelQueries({ queryKey: ['todos'] })
2433
- * const previousTodos = queryClient.getQueryData<Array<string>>(['todos'])
2434
- *
2435
- * queryClient.setQueryData<Array<string>>(['todos'], (old) => [
2436
- * ...(old ?? []),
2437
- * newTodo,
2438
- * ])
2439
- *
2440
- * // Passed to `onError` as `onMutateResult` if the mutation fails.
2441
- * return { previousTodos }
2442
- * },
2443
- * onError: (_err, _newTodo, onMutateResult) => {
2444
- * queryClient.setQueryData(['todos'], onMutateResult?.previousTodos)
2445
- * },
2446
- * onSettled: () => {
2447
- * queryClient.invalidateQueries({ queryKey: ['todos'] })
2448
- * },
2449
- * })
2450
- *
2451
- * return (
2452
- * <button onClick={() => addMutation.mutate('Item')}>Add</button>
2453
- * )
2454
- * }
2455
- * ```
2456
- * @example
2457
- * Callbacks passed per call to `mutate` only fire for the last call — `mutateAsync` gives you a
2458
- * promise per call instead, so you can wait for all of them when they succeed:
2459
- * ```tsx
2460
- * import { useMutation, useQueryClient } from '@tanstack/react-query'
2461
- *
2462
- * function AddTodos() {
2463
- * const queryClient = useQueryClient()
2464
- *
2465
- * const addMutation = useMutation({
2466
- * mutationFn: addTodo,
2467
- * onSuccess: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),
2468
- * })
2469
- *
2470
- * async function handleAddAll(todos: Array<string>) {
2471
- * try {
2472
- * await Promise.all(todos.map((todo) => addMutation.mutateAsync(todo)))
2473
- * } catch (error) {
2474
- * console.error('Failed to add todos:', error)
2475
- * }
2476
- * }
2477
- *
2478
- * return (
2479
- * <button onClick={() => handleAddAll(['Todo 1', 'Todo 2', 'Todo 3'])}>
2480
- * Add all
2481
- * </button>
2482
- * )
2483
- * }
2484
- * ```
2485
- * @example
2486
- * If some of the mutations above can fail independently of the others, and you want to know which ones
2487
- * did — rather than losing that information the moment the first one rejects — swap `Promise.all` for
2488
- * `Promise.allSettled`:
2489
- * ```tsx
2490
- * import { useMutation, useQueryClient } from '@tanstack/react-query'
2491
- *
2492
- * function AddTodos() {
2493
- * const queryClient = useQueryClient()
2494
- *
2495
- * const addMutation = useMutation({
2496
- * mutationFn: addTodo,
2497
- * onSuccess: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),
2498
- * })
2499
- *
2500
- * async function handleAddAll(todos: Array<string>) {
2501
- * const addResults = await Promise.allSettled(
2502
- * todos.map((todo) => addMutation.mutateAsync(todo)),
2503
- * )
2504
- *
2505
- * addResults.forEach((addResult, index) => {
2506
- * if (addResult.status === 'rejected') {
2507
- * console.error(`Failed to add "${todos[index]}":`, addResult.reason)
2508
- * }
2509
- * })
2510
- * }
2511
- *
2512
- * return (
2513
- * <button onClick={() => handleAddAll(['Todo 1', 'Todo 2', 'Todo 3'])}>
2514
- * Add all
2515
- * </button>
2516
- * )
2517
- * }
2518
- * ```
2519
- */
2520
- function useMutation(options, queryClient) {
2521
- const client = useQueryClient(queryClient);
2522
- const [observer] = import_react.useState(() => new MutationObserver(client, options));
2523
- import_react.useEffect(() => {
2524
- observer.setOptions(options);
2525
- }, [observer, options]);
2526
- const result = import_react.useSyncExternalStore(import_react.useCallback((onStoreChange) => observer.subscribe(notifyManager.batchCalls(onStoreChange)), [observer]), () => observer.getCurrentResult(), () => observer.getCurrentResult());
2527
- const mutate = import_react.useCallback((...args) => {
2528
- observer.mutate(args[0], args[1]).catch(noop);
2529
- }, [observer]);
2530
- if (result.error && shouldThrowError(observer.options.throwOnError, [result.error])) throw result.error;
2531
- return {
2532
- ...result,
2533
- mutate,
2534
- mutateAsync: result.mutate
2535
- };
2536
- }
2537
1859
  // ../../node_modules/.bun/@tanstack+router-ssr-query-core@1.169.3+3554ab4a3d907bbf/node_modules/@tanstack/router-ssr-query-core/dist/esm/index.js
2538
1860
  var shouldDehydrateAllQueries = () => true;
2539
1861
  function setupCoreRouterSsrQueryIntegration({ router, queryClient, dehydrateOptions, hydrateOptions, handleRedirects = true }) {
@@ -2754,20 +2076,26 @@ var VIEW_PATHS = {
2754
2076
  dashboard: "/",
2755
2077
  factory: "/factory",
2756
2078
  workflow: "/workflow",
2079
+ "getting-started": "/getting-started",
2757
2080
  skills: "/skills",
2758
2081
  vault: "/vault",
2759
2082
  specs: "/specs",
2760
- reports: "/reports"
2083
+ reports: "/reports",
2084
+ usage: "/usage",
2085
+ graph: "/graph"
2761
2086
  };
2762
2087
  /** A view's page title is its navigation label. */
2763
2088
  var VIEW_TITLES = {
2764
2089
  dashboard: "Overview",
2765
2090
  factory: "Factory",
2766
2091
  workflow: "Workflow",
2092
+ "getting-started": "Getting Started",
2767
2093
  skills: "Skills",
2768
2094
  vault: "Vault",
2769
2095
  specs: "Specs",
2770
- reports: "Reports"
2096
+ reports: "Reports",
2097
+ usage: "Usage",
2098
+ graph: "Graph"
2771
2099
  };
2772
2100
  var MODE_TITLES = {
2773
2101
  engineering: "Engineering",
@@ -2775,6 +2103,7 @@ var MODE_TITLES = {
2775
2103
  };
2776
2104
  /** The view a path serves, for guards that see only the location. */
2777
2105
  function viewAt(pathname) {
2106
+ if (pathname.startsWith("/getting-started/")) return "getting-started";
2778
2107
  return Object.entries(VIEW_PATHS).find(([, path]) => path === pathname)?.[0];
2779
2108
  }
2780
2109
  /** One plain line under each view's title. */
@@ -2783,23 +2112,29 @@ var VIEW_DESCRIPTIONS = {
2783
2112
  dashboard: "Changes in flight, grouped by what they need next.",
2784
2113
  factory: "Outcomes the factory works on, and the decisions they wait for.",
2785
2114
  workflow: "The Delivery Path: every stage, its skill and where your changes are.",
2115
+ "getting-started": "Take your first change from an idea to delivery in your existing checkout.",
2786
2116
  skills: "The skills each agent can run in this companion.",
2787
2117
  vault: "Every file in the Companion Repository.",
2788
2118
  specs: "Capabilities by Area, with their requirements.",
2789
- reports: "Reports agents published for this companion."
2119
+ reports: "Reports agents published for this companion.",
2120
+ usage: "Token usage across this companion and every linked Working Repository.",
2121
+ graph: "Capabilities, Areas and repositories, and how they connect."
2790
2122
  },
2791
2123
  analysis: {
2792
2124
  dashboard: "What shipped lately, and the specs it changed.",
2793
2125
  factory: "Outcomes the factory works on.",
2794
2126
  workflow: "The Delivery Path.",
2127
+ "getting-started": "Developer setup and isolated work.",
2795
2128
  skills: "Skills in this companion.",
2796
2129
  vault: "Every file in the Companion Repository.",
2797
2130
  specs: "Capabilities by Area, with their requirements.",
2798
- reports: "Reports agents published for this companion."
2131
+ reports: "Reports agents published for this companion.",
2132
+ usage: "Token usage across this companion and every linked Working Repository.",
2133
+ graph: "Capabilities, Areas and repositories, and how they connect."
2799
2134
  }
2800
2135
  };
2801
2136
  // src/styles/app.css?url
2802
- var app_default = "/assets/app-CdPiFv59.css";
2137
+ var app_default = "/assets/app-D9cw6szy.css";
2803
2138
  // src/terminal/keys.ts
2804
2139
  /** Browser storage keys and sizes of the agent terminal, shared by the page and its scripts. */
2805
2140
  var TERMINAL_TAB_KEY = "mate-studio-terminal-tab";
@@ -3022,690 +2357,40 @@ function useDelayGroup(store, options = { open: false }) {
3022
2357
  floatingId,
3023
2358
  store,
3024
2359
  currentIdRef,
3025
- delayRef,
3026
- initialDelayRef,
3027
- currentContextRef,
3028
- timeout
3029
- ]);
3030
- useIsoLayoutEffect(() => {
3031
- return () => {
3032
- if (currentIdRef.current === floatingId) {
3033
- currentContextRef.current = null;
3034
- if (!openRef.current) return;
3035
- currentIdRef.current = null;
3036
- resetDelayRef(delayRef, initialDelayRef);
3037
- timeout.clear();
3038
- }
3039
- };
3040
- }, [
3041
- currentContextRef,
3042
- currentIdRef,
3043
- delayRef,
3044
- floatingId,
3045
- initialDelayRef,
3046
- timeout
3047
- ]);
3048
- return import_react.useMemo(() => ({
3049
- activeIdRef: currentIdRef,
3050
- hasProvider,
3051
- delayRef,
3052
- isInstantPhase
3053
- }), [
3054
- currentIdRef,
3055
- hasProvider,
3056
- delayRef,
3057
- isInstantPhase
3058
- ]);
3059
- }
3060
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/floating-ui-react/utils/enqueueFocus.mjs
3061
- var rafId = 0;
3062
- function enqueueFocus(el, options = {}) {
3063
- const { preventScroll = false, sync = false, shouldFocus } = options;
3064
- cancelAnimationFrame(rafId);
3065
- function exec() {
3066
- if (shouldFocus && !shouldFocus()) return;
3067
- el?.focus({ preventScroll });
3068
- }
3069
- if (sync) {
3070
- exec();
3071
- return NOOP;
3072
- }
3073
- const currentRafId = requestAnimationFrame(exec);
3074
- rafId = currentRafId;
3075
- return () => {
3076
- if (rafId === currentRafId) {
3077
- cancelAnimationFrame(currentRafId);
3078
- rafId = 0;
3079
- }
3080
- };
3081
- }
3082
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/floating-ui-react/utils/markOthers.mjs
3083
- var markerName = "data-base-ui-inert";
3084
- var ariaHiddenCounterMap = /* @__PURE__ */ new WeakMap();
3085
- var uncontrolledElementsSet = /* @__PURE__ */ new WeakSet();
3086
- var markerCounterMap = /* @__PURE__ */ new WeakMap();
3087
- var lockCount = 0;
3088
- function unwrapHost(node) {
3089
- if (!node) return null;
3090
- return isShadowRoot(node) ? node.host : unwrapHost(node.parentNode);
3091
- }
3092
- var correctElements = (parent, targets) => targets.map((target) => {
3093
- if (parent.contains(target)) return target;
3094
- const correctedTarget = unwrapHost(target);
3095
- if (parent.contains(correctedTarget)) return correctedTarget;
3096
- return null;
3097
- }).filter((x) => x != null);
3098
- var buildKeepSet = (targets) => {
3099
- const keep = /* @__PURE__ */ new Set();
3100
- targets.forEach((target) => {
3101
- let node = target;
3102
- while (node && !keep.has(node)) {
3103
- keep.add(node);
3104
- node = node.parentNode;
3105
- }
3106
- });
3107
- return keep;
3108
- };
3109
- var collectOutsideElements = (root, keepElements, stopElements) => {
3110
- const outside = [];
3111
- const walk = (parent) => {
3112
- if (!parent || stopElements.has(parent)) return;
3113
- Array.from(parent.children).forEach((node) => {
3114
- if (getNodeName(node) === "script") return;
3115
- if (keepElements.has(node)) walk(node);
3116
- else outside.push(node);
3117
- });
3118
- };
3119
- walk(root);
3120
- return outside;
3121
- };
3122
- function applyAttributeToOthers(uncorrectedAvoidElements, body, ariaHidden, { mark = true }) {
3123
- const avoidElements = correctElements(body, uncorrectedAvoidElements);
3124
- const markerTargets = mark ? collectOutsideElements(body, buildKeepSet(avoidElements), new Set(avoidElements)) : [];
3125
- const hiddenElements = [];
3126
- const markedElements = [];
3127
- if (ariaHidden) {
3128
- const ariaLiveElements = correctElements(body, Array.from(body.querySelectorAll("[aria-live]")));
3129
- const controlElements = avoidElements.concat(ariaLiveElements);
3130
- collectOutsideElements(body, buildKeepSet(controlElements), new Set(controlElements)).forEach((node) => {
3131
- const attr = node.getAttribute("aria-hidden");
3132
- const alreadyHidden = attr !== null && attr !== "false";
3133
- const counterValue = (ariaHiddenCounterMap.get(node) || 0) + 1;
3134
- ariaHiddenCounterMap.set(node, counterValue);
3135
- hiddenElements.push(node);
3136
- if (counterValue === 1 && alreadyHidden) uncontrolledElementsSet.add(node);
3137
- if (!alreadyHidden) node.setAttribute("aria-hidden", "true");
3138
- });
3139
- }
3140
- if (mark) markerTargets.forEach((node) => {
3141
- const markerValue = (markerCounterMap.get(node) || 0) + 1;
3142
- markerCounterMap.set(node, markerValue);
3143
- markedElements.push(node);
3144
- if (markerValue === 1) node.setAttribute(markerName, "");
3145
- });
3146
- lockCount += 1;
3147
- return () => {
3148
- hiddenElements.forEach((element) => {
3149
- const counterValue = (ariaHiddenCounterMap.get(element) || 0) - 1;
3150
- ariaHiddenCounterMap.set(element, counterValue);
3151
- if (!counterValue) {
3152
- if (!uncontrolledElementsSet.has(element)) element.removeAttribute("aria-hidden");
3153
- uncontrolledElementsSet.delete(element);
3154
- }
3155
- });
3156
- if (mark) markedElements.forEach((element) => {
3157
- const markerValue = (markerCounterMap.get(element) || 0) - 1;
3158
- markerCounterMap.set(element, markerValue);
3159
- if (!markerValue) element.removeAttribute(markerName);
3160
- });
3161
- lockCount -= 1;
3162
- if (!lockCount) {
3163
- ariaHiddenCounterMap = /* @__PURE__ */ new WeakMap();
3164
- uncontrolledElementsSet = /* @__PURE__ */ new WeakSet();
3165
- markerCounterMap = /* @__PURE__ */ new WeakMap();
3166
- }
3167
- };
3168
- }
3169
- function markOthers(avoidElements, options = {}) {
3170
- const { ariaHidden = false, mark = true } = options;
3171
- const body = ownerDocument(avoidElements[0]).body;
3172
- return applyAttributeToOthers(avoidElements, body, ariaHidden, { mark });
3173
- }
3174
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/floating-ui-react/components/FloatingFocusManager.mjs
3175
- function getEventType(event, lastInteractionType) {
3176
- const win = getWindow(getTarget(event));
3177
- if (event instanceof win.KeyboardEvent) return "keyboard";
3178
- if (event instanceof win.FocusEvent) return lastInteractionType || "keyboard";
3179
- if ("pointerType" in event) return event.pointerType || (isVirtualClick(event) ? "keyboard" : lastInteractionType || "mouse");
3180
- if ("touches" in event) return "touch";
3181
- if (event instanceof win.MouseEvent) return lastInteractionType || (event.detail === 0 ? "keyboard" : "mouse");
3182
- return "";
3183
- }
3184
- var LIST_LIMIT = 20;
3185
- var previouslyFocusedElements = [];
3186
- function clearDisconnectedPreviouslyFocusedElements() {
3187
- previouslyFocusedElements = previouslyFocusedElements.filter((entry) => {
3188
- return entry.deref()?.isConnected;
3189
- });
3190
- }
3191
- function addPreviouslyFocusedElement(element) {
3192
- clearDisconnectedPreviouslyFocusedElements();
3193
- if (element && getNodeName(element) !== "body") {
3194
- previouslyFocusedElements.push(new WeakRef(element));
3195
- if (previouslyFocusedElements.length > LIST_LIMIT) previouslyFocusedElements = previouslyFocusedElements.slice(-20);
3196
- }
3197
- }
3198
- function getPreviouslyFocusedElement() {
3199
- clearDisconnectedPreviouslyFocusedElements();
3200
- return previouslyFocusedElements[previouslyFocusedElements.length - 1]?.deref();
3201
- }
3202
- function getFirstTabbableElement(container) {
3203
- if (!container) return null;
3204
- if (isTabbable(container)) return container;
3205
- return tabbable(container)[0] || container;
3206
- }
3207
- function handleTabIndex(floatingFocusElement) {
3208
- if (floatingFocusElement.hasAttribute("tabindex") && !floatingFocusElement.hasAttribute("data-tabindex")) return;
3209
- if (!floatingFocusElement.getAttribute("role")?.includes("dialog")) return;
3210
- const tabbableContent = focusable(floatingFocusElement).filter((element) => {
3211
- const dataTabIndex = element.getAttribute("data-tabindex") || "";
3212
- return isTabbable(element) || element.hasAttribute("data-tabindex") && !dataTabIndex.startsWith("-");
3213
- });
3214
- const tabIndex = floatingFocusElement.getAttribute("tabindex");
3215
- if (tabbableContent.length === 0) {
3216
- if (tabIndex !== "0") {
3217
- floatingFocusElement.setAttribute("tabindex", "0");
3218
- floatingFocusElement.setAttribute("data-tabindex", "0");
3219
- }
3220
- } else if (tabIndex !== "-1" || floatingFocusElement.hasAttribute("data-tabindex") && floatingFocusElement.getAttribute("data-tabindex") !== "-1") {
3221
- floatingFocusElement.setAttribute("tabindex", "-1");
3222
- floatingFocusElement.setAttribute("data-tabindex", "-1");
3223
- }
3224
- }
3225
- /**
3226
- * Provides focus management for the floating element.
3227
- * @see https://floating-ui.com/docs/FloatingFocusManager
3228
- * @internal
3229
- */
3230
- function FloatingFocusManager(props) {
3231
- const { context: store, children, disabled = false, initialFocus = true, returnFocus = true, explicitReturnFocus, restoreFocus = false, modal = true, closeOnFocusOut = true, openInteractionType = "", nextFocusableElement, previousFocusableElement, beforeContentFocusGuardRef, externalTree, getInsideElements } = props;
3232
- const open = store.useState("open");
3233
- const domReference = store.useState("domReferenceElement");
3234
- const floating = store.useState("floatingElement");
3235
- const { events, dataRef } = store.context;
3236
- const getNodeId = useStableCallback(() => dataRef.current.floatingContext?.nodeId);
3237
- const ignoreInitialFocus = initialFocus === false;
3238
- const isUntrappedTypeableCombobox = isTypeableCombobox(domReference) && ignoreInitialFocus;
3239
- const initialFocusRef = useValueAsRef(initialFocus);
3240
- const returnFocusRef = useValueAsRef(returnFocus);
3241
- const explicitReturnFocusRef = useValueAsRef(explicitReturnFocus);
3242
- const openInteractionTypeRef = useValueAsRef(openInteractionType);
3243
- const openRef = useValueAsRef(open);
3244
- const tree = useFloatingTree(externalTree);
3245
- const portalContext = usePortalContext();
3246
- const preventReturnFocusRef = import_react.useRef(false);
3247
- const isPointerDownRef = import_react.useRef(false);
3248
- const pointerDownOutsideRef = import_react.useRef(false);
3249
- const lastFocusedTabbableRef = import_react.useRef(null);
3250
- const closeTypeRef = import_react.useRef("");
3251
- const lastInteractionTypeRef = import_react.useRef("");
3252
- const beforeGuardRef = import_react.useRef(null);
3253
- const afterGuardRef = import_react.useRef(null);
3254
- const mergedBeforeGuardRef = useMergedRefs(beforeGuardRef, beforeContentFocusGuardRef, portalContext?.beforeInsideRef);
3255
- const mergedAfterGuardRef = useMergedRefs(afterGuardRef, portalContext?.afterInsideRef);
3256
- const blurTimeout = useTimeout();
3257
- const pointerDownTimeout = useTimeout();
3258
- const restoreFocusFrame = useAnimationFrame();
3259
- const isInsidePortal = portalContext != null;
3260
- const floatingFocusElement = getFloatingFocusElement(floating);
3261
- const getTabbableContent = useStableCallback((container = floatingFocusElement) => {
3262
- return container ? tabbable(container) : [];
3263
- });
3264
- const getResolvedInsideElements = useStableCallback(() => getInsideElements?.().filter((element) => element != null) ?? []);
3265
- import_react.useEffect(() => {
3266
- if (disabled || !modal) return;
3267
- function onKeyDown(event) {
3268
- if (event.key === "Tab") {
3269
- if (contains(floatingFocusElement, activeElement(ownerDocument(floatingFocusElement))) && getTabbableContent().length === 0 && !isUntrappedTypeableCombobox) stopEvent(event);
3270
- }
3271
- }
3272
- const doc = ownerDocument(floatingFocusElement);
3273
- return addEventListener(doc, "keydown", onKeyDown);
3274
- }, [
3275
- disabled,
3276
- floatingFocusElement,
3277
- modal,
3278
- isUntrappedTypeableCombobox,
3279
- getTabbableContent
3280
- ]);
3281
- import_react.useEffect(() => {
3282
- if (disabled || !open) return;
3283
- const doc = ownerDocument(floatingFocusElement);
3284
- function clearPointerDownOutside() {
3285
- pointerDownOutsideRef.current = false;
3286
- }
3287
- function onPointerDown(event) {
3288
- const target = getTarget(event);
3289
- const insideElements = getResolvedInsideElements();
3290
- const pointerTargetInside = contains(floating, target) || contains(domReference, target) || contains(portalContext?.portalNode, target) || insideElements.some((element) => element === target || contains(element, target));
3291
- pointerDownOutsideRef.current = !pointerTargetInside;
3292
- lastInteractionTypeRef.current = event.pointerType || "keyboard";
3293
- if (closest(target, `[data-base-ui-click-trigger]`)) {
3294
- isPointerDownRef.current = true;
3295
- pointerDownTimeout.start(0, () => {
3296
- isPointerDownRef.current = false;
3297
- });
3298
- }
3299
- }
3300
- function onKeyDown() {
3301
- lastInteractionTypeRef.current = "keyboard";
3302
- }
3303
- return mergeCleanups(addEventListener(doc, "pointerdown", onPointerDown, true), addEventListener(doc, "pointerup", clearPointerDownOutside, true), addEventListener(doc, "pointercancel", clearPointerDownOutside, true), addEventListener(doc, "keydown", onKeyDown, true), clearPointerDownOutside);
3304
- }, [
3305
- disabled,
3306
- floating,
3307
- domReference,
3308
- floatingFocusElement,
3309
- open,
3310
- portalContext,
3311
- pointerDownTimeout,
3312
- getResolvedInsideElements
3313
- ]);
3314
- import_react.useEffect(() => {
3315
- if (disabled || !closeOnFocusOut) return;
3316
- const doc = ownerDocument(floatingFocusElement);
3317
- function handlePointerDown() {
3318
- isPointerDownRef.current = true;
3319
- pointerDownTimeout.start(0, () => {
3320
- isPointerDownRef.current = false;
3321
- });
3322
- }
3323
- function handleFocusIn(event) {
3324
- const target = getTarget(event);
3325
- if (isTabbable(target)) lastFocusedTabbableRef.current = target;
3326
- }
3327
- function handleFocusOutside(event) {
3328
- const relatedTarget = event.relatedTarget;
3329
- const currentTarget = event.currentTarget;
3330
- const target = getTarget(event);
3331
- if (modal && relatedTarget == null && target != null && contains(floating, target)) addPreviouslyFocusedElement(target);
3332
- queueMicrotask(() => {
3333
- const nodeId = getNodeId();
3334
- const triggers = store.context.triggerElements;
3335
- const insideElements = getResolvedInsideElements();
3336
- const isRelatedFocusGuard = relatedTarget?.hasAttribute(createAttribute("focus-guard")) && [
3337
- beforeGuardRef.current,
3338
- afterGuardRef.current,
3339
- portalContext?.beforeInsideRef.current,
3340
- portalContext?.afterInsideRef.current,
3341
- portalContext?.beforeOutsideRef.current,
3342
- portalContext?.afterOutsideRef.current,
3343
- resolveRef(previousFocusableElement),
3344
- resolveRef(nextFocusableElement)
3345
- ].includes(relatedTarget);
3346
- const movedToUnrelatedNode = !(contains(domReference, relatedTarget) || contains(floating, relatedTarget) || contains(relatedTarget, floating) || contains(portalContext?.portalNode, relatedTarget) || insideElements.some((element) => element === relatedTarget || contains(element, relatedTarget)) || triggers.hasMatchingElement((trigger) => contains(trigger, relatedTarget)) || isRelatedFocusGuard || tree && (getNodeChildren(tree.nodesRef.current, nodeId).find((node) => contains(node.context?.elements.floating, relatedTarget) || contains(node.context?.elements.domReference, relatedTarget)) || getNodeAncestors(tree.nodesRef.current, nodeId).find((node) => [node.context?.elements.floating, getFloatingFocusElement(node.context?.elements.floating)].includes(relatedTarget) || node.context?.elements.domReference === relatedTarget)));
3347
- if (currentTarget === domReference && floatingFocusElement) handleTabIndex(floatingFocusElement);
3348
- if (restoreFocus && currentTarget !== domReference && !isElementVisible(target) && activeElement(doc) === doc.body) {
3349
- if (isHTMLElement(floatingFocusElement)) {
3350
- floatingFocusElement.focus();
3351
- if (restoreFocus === "popup") {
3352
- restoreFocusFrame.request(() => {
3353
- floatingFocusElement.focus();
3354
- });
3355
- return;
3356
- }
3357
- }
3358
- const tabbableContent = getTabbableContent();
3359
- const prevTabbable = lastFocusedTabbableRef.current;
3360
- const nodeToFocus = (prevTabbable && tabbableContent.includes(prevTabbable) ? prevTabbable : null) || tabbableContent[tabbableContent.length - 1] || floatingFocusElement;
3361
- if (isHTMLElement(nodeToFocus)) nodeToFocus.focus();
3362
- }
3363
- if (dataRef.current.insideReactTree) {
3364
- dataRef.current.insideReactTree = false;
3365
- return;
3366
- }
3367
- if ((isUntrappedTypeableCombobox ? true : !modal) && relatedTarget && movedToUnrelatedNode && !isPointerDownRef.current && (isUntrappedTypeableCombobox || relatedTarget !== getPreviouslyFocusedElement())) {
3368
- preventReturnFocusRef.current = true;
3369
- store.setOpen(false, createChangeEventDetails(focusOut, event));
3370
- }
3371
- });
3372
- }
3373
- function markInsideReactTree() {
3374
- if (pointerDownOutsideRef.current) return;
3375
- dataRef.current.insideReactTree = true;
3376
- blurTimeout.start(0, () => {
3377
- dataRef.current.insideReactTree = false;
3378
- });
3379
- }
3380
- const domReferenceElement = isHTMLElement(domReference) ? domReference : null;
3381
- if (!floating && !domReferenceElement) return;
3382
- return mergeCleanups(domReferenceElement && addEventListener(domReferenceElement, "focusout", handleFocusOutside), domReferenceElement && addEventListener(domReferenceElement, "pointerdown", handlePointerDown), floating && addEventListener(floating, "focusin", handleFocusIn), floating && addEventListener(floating, "focusout", handleFocusOutside), floating && portalContext && addEventListener(floating, "focusout", markInsideReactTree, true));
3383
- }, [
3384
- disabled,
3385
- domReference,
3386
- floating,
3387
- floatingFocusElement,
3388
- modal,
3389
- tree,
3390
- portalContext,
3391
- store,
3392
- closeOnFocusOut,
3393
- restoreFocus,
3394
- getTabbableContent,
3395
- isUntrappedTypeableCombobox,
3396
- getNodeId,
3397
- dataRef,
3398
- blurTimeout,
3399
- pointerDownTimeout,
3400
- restoreFocusFrame,
3401
- nextFocusableElement,
3402
- previousFocusableElement,
3403
- getResolvedInsideElements
3404
- ]);
3405
- import_react.useEffect(() => {
3406
- if (disabled || !floating || !open) return;
3407
- const portalNodes = Array.from(portalContext?.portalNode?.querySelectorAll(`[${createAttribute("portal")}]`) || []);
3408
- const rootAncestorComboboxDomReference = (tree ? getNodeAncestors(tree.nodesRef.current, getNodeId()) : []).find((node) => isTypeableCombobox(node.context?.elements.domReference || null))?.context?.elements.domReference;
3409
- const ariaHiddenCleanup = markOthers([
3410
- ...[
3411
- floating,
3412
- ...portalNodes,
3413
- beforeGuardRef.current,
3414
- afterGuardRef.current,
3415
- portalContext?.beforeOutsideRef.current,
3416
- portalContext?.afterOutsideRef.current,
3417
- ...getResolvedInsideElements()
3418
- ],
3419
- rootAncestorComboboxDomReference,
3420
- resolveRef(previousFocusableElement),
3421
- resolveRef(nextFocusableElement),
3422
- isUntrappedTypeableCombobox ? domReference : null
3423
- ].filter((x) => x != null), {
3424
- ariaHidden: modal || isUntrappedTypeableCombobox,
3425
- mark: false
3426
- });
3427
- const markerCleanup = markOthers([floating, ...portalNodes].filter((x) => x != null));
3428
- return () => {
3429
- markerCleanup();
3430
- ariaHiddenCleanup();
3431
- };
3432
- }, [
3433
- open,
3434
- disabled,
3435
- domReference,
3436
- floating,
3437
- modal,
3438
- portalContext,
3439
- isUntrappedTypeableCombobox,
3440
- tree,
3441
- getNodeId,
3442
- nextFocusableElement,
3443
- previousFocusableElement,
3444
- getResolvedInsideElements
3445
- ]);
3446
- useIsoLayoutEffect(() => {
3447
- if (!open || disabled || !isHTMLElement(floatingFocusElement)) return;
3448
- closeTypeRef.current = "";
3449
- lastInteractionTypeRef.current = "";
3450
- const doc = ownerDocument(floatingFocusElement);
3451
- const previouslyFocusedElement = activeElement(doc);
3452
- queueMicrotask(() => {
3453
- const initialFocusValueOrFn = initialFocusRef.current;
3454
- const resolvedInitialFocus = typeof initialFocusValueOrFn === "function" ? initialFocusValueOrFn(openInteractionTypeRef.current || "") : initialFocusValueOrFn;
3455
- if (resolvedInitialFocus === void 0 || resolvedInitialFocus === false) return;
3456
- if (contains(floatingFocusElement, previouslyFocusedElement)) return;
3457
- let focusableElements = null;
3458
- const getDefaultFocusElement = () => {
3459
- if (focusableElements == null) focusableElements = getTabbableContent(floatingFocusElement);
3460
- return focusableElements[0] || floatingFocusElement;
3461
- };
3462
- let elToFocus;
3463
- if (resolvedInitialFocus === true || resolvedInitialFocus === null) elToFocus = getDefaultFocusElement();
3464
- else elToFocus = resolveRef(resolvedInitialFocus);
3465
- elToFocus = elToFocus || getDefaultFocusElement();
3466
- const hadFocusInside = contains(floatingFocusElement, activeElement(doc));
3467
- const openEvent = dataRef.current.openEvent;
3468
- const openedByVirtualPress = openEvent?.type === "mousedown" && isVirtualClick(openEvent);
3469
- enqueueFocus(elToFocus, {
3470
- sync: openedByVirtualPress,
3471
- preventScroll: elToFocus === floatingFocusElement,
3472
- shouldFocus() {
3473
- if (!openRef.current) return false;
3474
- if (hadFocusInside) return true;
3475
- const currentActiveElement = activeElement(doc);
3476
- return !(currentActiveElement !== elToFocus && contains(floatingFocusElement, currentActiveElement));
3477
- }
3478
- });
3479
- });
3480
- }, [
3481
- disabled,
3482
- open,
3483
- floatingFocusElement,
3484
- getTabbableContent,
3485
- initialFocusRef,
3486
- openInteractionTypeRef,
3487
- openRef,
3488
- dataRef
3489
- ]);
3490
- const pendingReturnFocusRef = import_react.useRef(null);
3491
- useIsoLayoutEffect(() => {
3492
- if (disabled || !floatingFocusElement) {
3493
- pendingReturnFocusRef.current = null;
3494
- return;
3495
- }
3496
- if (pendingReturnFocusRef.current) {
3497
- pendingReturnFocusRef.current.cancelled = true;
3498
- pendingReturnFocusRef.current = null;
3499
- }
3500
- const doc = ownerDocument(floatingFocusElement);
3501
- const elementFocusedBeforeOpen = activeElement(doc);
3502
- const preferPreviousFocus = openInteractionTypeRef.current == null;
3503
- addPreviouslyFocusedElement(elementFocusedBeforeOpen);
3504
- function onOpenChangeLocal(details) {
3505
- if (!details.open) closeTypeRef.current = getEventType(details.nativeEvent, lastInteractionTypeRef.current);
3506
- if (details.reason === "focus-out" && details.triggerElement?.hasAttribute(createAttribute("focus-guard")) || details.reason === "trigger-hover" && details.nativeEvent.type === "mouseleave") preventReturnFocusRef.current = true;
3507
- if (details.reason !== "outside-press") return;
3508
- if (details.nested) preventReturnFocusRef.current = false;
3509
- else if (isVirtualClick(details.nativeEvent) || isVirtualPointerEvent(details.nativeEvent)) preventReturnFocusRef.current = false;
3510
- else {
3511
- let isPreventScrollSupported = false;
3512
- ownerDocument(floatingFocusElement).createElement("div").focus({ get preventScroll() {
3513
- isPreventScrollSupported = true;
3514
- return false;
3515
- } });
3516
- if (isPreventScrollSupported) preventReturnFocusRef.current = false;
3517
- else preventReturnFocusRef.current = true;
3518
- }
3519
- }
3520
- events.on("openchange", onOpenChangeLocal);
3521
- function getReturnElement(closeType) {
3522
- const returnFocusValueOrFn = returnFocusRef.current;
3523
- let resolvedReturnFocusValue = typeof returnFocusValueOrFn === "function" ? returnFocusValueOrFn(closeType) : returnFocusValueOrFn;
3524
- if (resolvedReturnFocusValue === void 0 || resolvedReturnFocusValue === false) return null;
3525
- if (resolvedReturnFocusValue === null) resolvedReturnFocusValue = true;
3526
- const referenceReturnElement = domReference?.isConnected ? domReference : null;
3527
- const previousReturnElement = elementFocusedBeforeOpen?.isConnected && getNodeName(elementFocusedBeforeOpen) !== "body" ? elementFocusedBeforeOpen : null;
3528
- let defaultReturnElement = preferPreviousFocus ? previousReturnElement || referenceReturnElement : referenceReturnElement || previousReturnElement;
3529
- if (!defaultReturnElement) defaultReturnElement = getPreviouslyFocusedElement() || null;
3530
- if (typeof resolvedReturnFocusValue === "boolean") return defaultReturnElement;
3531
- return resolveRef(resolvedReturnFocusValue) || defaultReturnElement || null;
3532
- }
3533
- return () => {
3534
- events.off("openchange", onOpenChangeLocal);
3535
- const activeEl = activeElement(doc);
3536
- const insideElements = getResolvedInsideElements();
3537
- const isFocusInsideFloatingTree = contains(floating, activeEl) || insideElements.some((element) => element === activeEl || contains(element, activeEl)) || tree && getNodeChildren(tree.nodesRef.current, getNodeId(), false).some((node) => contains(node.context?.elements.floating, activeEl));
3538
- const returnFocusValueOrFn = returnFocusRef.current;
3539
- const closeType = closeTypeRef.current;
3540
- const returnElement = getReturnElement(closeType);
3541
- const job = { cancelled: false };
3542
- pendingReturnFocusRef.current = job;
3543
- queueMicrotask(() => {
3544
- if (pendingReturnFocusRef.current === job) pendingReturnFocusRef.current = null;
3545
- const tabbableReturnElement = getFirstTabbableElement(returnElement);
3546
- const hasExplicitReturnFocus = explicitReturnFocusRef.current ?? typeof returnFocusValueOrFn !== "boolean";
3547
- if (!job.cancelled && returnFocusValueOrFn && !preventReturnFocusRef.current && isHTMLElement(tabbableReturnElement) && (!hasExplicitReturnFocus && tabbableReturnElement !== activeEl && activeEl !== doc.body ? isFocusInsideFloatingTree : true)) {
3548
- const focusOptions = { preventScroll: true };
3549
- if (closeType === "keyboard") focusOptions.focusVisible = true;
3550
- tabbableReturnElement.focus(focusOptions);
3551
- }
3552
- preventReturnFocusRef.current = false;
3553
- });
3554
- };
3555
- }, [
3556
- disabled,
3557
- floating,
3558
- floatingFocusElement,
3559
- returnFocusRef,
3560
- explicitReturnFocusRef,
3561
- openInteractionTypeRef,
3562
- events,
3563
- tree,
3564
- domReference,
3565
- getNodeId,
3566
- getResolvedInsideElements
3567
- ]);
3568
- useIsoLayoutEffect(() => {
3569
- if (!webkit || open || !floating) return;
3570
- const activeEl = activeElement(ownerDocument(floating));
3571
- if (!isHTMLElement(activeEl) || !isTypeableElement(activeEl)) return;
3572
- if (contains(floating, activeEl)) activeEl.blur();
3573
- }, [open, floating]);
3574
- useIsoLayoutEffect(() => {
3575
- if (disabled || !portalContext) return;
3576
- portalContext.setFocusManagerState({
3577
- modal,
3578
- closeOnFocusOut,
3579
- open,
3580
- onOpenChange: store.setOpen,
3581
- domReference
3582
- });
3583
- return () => {
3584
- portalContext.setFocusManagerState(null);
3585
- };
3586
- }, [
3587
- disabled,
3588
- portalContext,
3589
- modal,
3590
- open,
3591
- store,
3592
- closeOnFocusOut,
3593
- domReference
2360
+ delayRef,
2361
+ initialDelayRef,
2362
+ currentContextRef,
2363
+ timeout
3594
2364
  ]);
3595
2365
  useIsoLayoutEffect(() => {
3596
- if (disabled || !floatingFocusElement) return;
3597
- handleTabIndex(floatingFocusElement);
3598
2366
  return () => {
3599
- queueMicrotask(clearDisconnectedPreviouslyFocusedElements);
3600
- };
3601
- }, [disabled, floatingFocusElement]);
3602
- const shouldRenderGuards = !disabled && (modal ? !isUntrappedTypeableCombobox : true) && (isInsidePortal || modal);
3603
- return /*#__PURE__*/ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
3604
- shouldRenderGuards && /*#__PURE__*/ (0, import_jsx_runtime.jsx)(FocusGuard, {
3605
- "data-type": "inside",
3606
- ref: mergedBeforeGuardRef,
3607
- onFocus: (event) => {
3608
- if (modal) {
3609
- const els = getTabbableContent();
3610
- enqueueFocus(els[els.length - 1]);
3611
- } else if (portalContext?.portalNode) {
3612
- preventReturnFocusRef.current = false;
3613
- if (isOutsideEvent(event, portalContext.portalNode)) getNextTabbable(domReference)?.focus();
3614
- else resolveRef(previousFocusableElement ?? portalContext.beforeOutsideRef)?.focus();
3615
- }
3616
- }
3617
- }),
3618
- children,
3619
- shouldRenderGuards && /*#__PURE__*/ (0, import_jsx_runtime.jsx)(FocusGuard, {
3620
- "data-type": "inside",
3621
- ref: mergedAfterGuardRef,
3622
- onFocus: (event) => {
3623
- if (modal) enqueueFocus(getTabbableContent()[0]);
3624
- else if (portalContext?.portalNode) {
3625
- if (closeOnFocusOut) preventReturnFocusRef.current = true;
3626
- if (isOutsideEvent(event, portalContext.portalNode)) getPreviousTabbable(domReference)?.focus();
3627
- else resolveRef(nextFocusableElement ?? portalContext.afterOutsideRef)?.focus();
3628
- }
3629
- }
3630
- })
3631
- ] });
3632
- }
3633
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/floating-ui-react/hooks/useClick.mjs
3634
- /**
3635
- * Opens or closes the floating element when clicking the reference element.
3636
- * @see https://floating-ui.com/docs/useClick
3637
- */
3638
- function useClick(store, props = {}) {
3639
- const { enabled = true, event: eventOption = "click", toggle = true, ignoreMouse = false, stickIfOpen = true, touchOpenDelay = 0, reason = triggerPress } = props;
3640
- const dataRef = store.context.dataRef;
3641
- const pointerTypeRef = import_react.useRef(void 0);
3642
- const frame = useAnimationFrame();
3643
- const touchOpenTimeout = useTimeout();
3644
- const reference = import_react.useMemo(() => {
3645
- function setOpenWithTouchDelay(nextOpen, nativeEvent, target, pointerType) {
3646
- const details = createChangeEventDetails(reason, nativeEvent, target);
3647
- if (nextOpen && pointerType === "touch" && touchOpenDelay > 0) touchOpenTimeout.start(touchOpenDelay, () => {
3648
- store.setOpen(true, details);
3649
- });
3650
- else store.setOpen(nextOpen, details);
3651
- }
3652
- function getNextOpen(open, currentTarget, isClickLikeOpenEvent) {
3653
- const openEvent = dataRef.current.openEvent;
3654
- const hasClickedOnInactiveTrigger = store.select("domReferenceElement") !== currentTarget;
3655
- if (open && hasClickedOnInactiveTrigger) return true;
3656
- if (!open) return true;
3657
- if (!toggle) return true;
3658
- if (openEvent && (typeof stickIfOpen === "function" ? stickIfOpen() : stickIfOpen)) return !isClickLikeOpenEvent(openEvent.type);
3659
- return false;
3660
- }
3661
- return {
3662
- onPointerDown(event) {
3663
- pointerTypeRef.current = isMouseLikePointerType(event.pointerType, true) && isVirtualPointerEvent(event.nativeEvent) ? "virtual" : event.pointerType;
3664
- },
3665
- onMouseDown(event) {
3666
- const pointerType = pointerTypeRef.current;
3667
- const nativeEvent = event.nativeEvent;
3668
- const open = store.select("open");
3669
- if (event.button !== 0 || eventOption === "click" || isMouseLikePointerType(pointerType, true) && ignoreMouse) return;
3670
- const nextOpen = getNextOpen(open, event.currentTarget, (openEventType) => openEventType === "click" || openEventType === "mousedown");
3671
- const target = getTarget(nativeEvent);
3672
- const isTypeable = isTypeableElement(target);
3673
- if (isTypeable || pointerType === "virtual") {
3674
- setOpenWithTouchDelay(nextOpen, nativeEvent, isTypeable ? target : event.currentTarget, pointerType);
3675
- return;
3676
- }
3677
- const eventCurrentTarget = event.currentTarget;
3678
- frame.request(() => {
3679
- setOpenWithTouchDelay(nextOpen, nativeEvent, eventCurrentTarget, pointerType);
3680
- });
3681
- },
3682
- onClick(event) {
3683
- if (eventOption === "mousedown-only") return;
3684
- const pointerType = pointerTypeRef.current;
3685
- if (eventOption === "mousedown" && pointerType) {
3686
- pointerTypeRef.current = void 0;
3687
- return;
3688
- }
3689
- if (isMouseLikePointerType(pointerType, true) && ignoreMouse) return;
3690
- setOpenWithTouchDelay(getNextOpen(store.select("open"), event.currentTarget, (openEventType) => openEventType === "click" || openEventType === "mousedown" || openEventType === "keydown" || openEventType === "keyup"), event.nativeEvent, event.currentTarget, pointerType);
3691
- },
3692
- onKeyDown() {
3693
- pointerTypeRef.current = void 0;
2367
+ if (currentIdRef.current === floatingId) {
2368
+ currentContextRef.current = null;
2369
+ if (!openRef.current) return;
2370
+ currentIdRef.current = null;
2371
+ resetDelayRef(delayRef, initialDelayRef);
2372
+ timeout.clear();
3694
2373
  }
3695
2374
  };
3696
2375
  }, [
3697
- dataRef,
3698
- eventOption,
3699
- ignoreMouse,
3700
- reason,
3701
- store,
3702
- stickIfOpen,
3703
- toggle,
3704
- frame,
3705
- touchOpenTimeout,
3706
- touchOpenDelay
2376
+ currentContextRef,
2377
+ currentIdRef,
2378
+ delayRef,
2379
+ floatingId,
2380
+ initialDelayRef,
2381
+ timeout
2382
+ ]);
2383
+ return import_react.useMemo(() => ({
2384
+ activeIdRef: currentIdRef,
2385
+ hasProvider,
2386
+ delayRef,
2387
+ isInstantPhase
2388
+ }), [
2389
+ currentIdRef,
2390
+ hasProvider,
2391
+ delayRef,
2392
+ isInstantPhase
3707
2393
  ]);
3708
- return import_react.useMemo(() => enabled ? { reference } : EMPTY_OBJECT, [enabled, reference]);
3709
2394
  }
3710
2395
  // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/floating-ui-react/hooks/useClientPoint.mjs
3711
2396
  function createVirtualElement(domElement, data) {
@@ -3867,44 +2552,6 @@ function usePopupHandleStore(handle) {
3867
2552
  }, [handle]);
3868
2553
  return (0, import_shim.useSyncExternalStore)(subscribe, getSnapshot, () => handle?.serverStore);
3869
2554
  }
3870
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/floating-ui-react/hooks/useFloatingRootContext.mjs
3871
- function useFloatingRootContext(options) {
3872
- const { open = false, onOpenChange, elements = {} } = options;
3873
- const floatingId = useId();
3874
- const nested = useFloatingParentNodeId() != null;
3875
- const store = useRefWithInit(() => new FloatingRootStore({
3876
- open,
3877
- transitionStatus: void 0,
3878
- onOpenChange,
3879
- referenceElement: elements.reference ?? null,
3880
- floatingElement: elements.floating ?? null,
3881
- triggerElements: new PopupTriggerMap(),
3882
- floatingId,
3883
- syncOnly: false,
3884
- nested
3885
- })).current;
3886
- useIsoLayoutEffect(() => {
3887
- const valuesToSync = {
3888
- open,
3889
- floatingId
3890
- };
3891
- if (elements.reference !== void 0) {
3892
- valuesToSync.referenceElement = elements.reference;
3893
- valuesToSync.domReferenceElement = isElement(elements.reference) ? elements.reference : null;
3894
- }
3895
- if (elements.floating !== void 0) valuesToSync.floatingElement = elements.floating;
3896
- store.update(valuesToSync);
3897
- }, [
3898
- open,
3899
- floatingId,
3900
- elements.reference,
3901
- elements.floating,
3902
- store
3903
- ]);
3904
- store.context.onOpenChange = onOpenChange;
3905
- store.context.nested = nested;
3906
- return store;
3907
- }
3908
2555
  // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/floating-ui-react/hooks/useFocus.mjs
3909
2556
  var isMacSafari = mac && webkit;
3910
2557
  /**
@@ -4459,427 +3106,6 @@ function useHoverReferenceInteraction(store, props = {}) {
4459
3106
  checkShouldOpen
4460
3107
  ]);
4461
3108
  }
4462
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/floating-ui-react/hooks/useListNavigation.mjs
4463
- function isStationaryWebKitPointer(event) {
4464
- return webkit && event.movementX === 0 && event.movementY === 0;
4465
- }
4466
- function doSwitch(orientation, vertical, horizontal) {
4467
- switch (orientation) {
4468
- case "vertical": return vertical;
4469
- case "horizontal": return horizontal;
4470
- default: return vertical || horizontal;
4471
- }
4472
- }
4473
- function isMainOrientationKey(key, orientation) {
4474
- return doSwitch(orientation, key === "ArrowUp" || key === "ArrowDown", key === "ArrowLeft" || key === "ArrowRight");
4475
- }
4476
- function isMainOrientationToEndKey(key, orientation, rtl) {
4477
- return doSwitch(orientation, key === "ArrowDown", rtl ? key === "ArrowLeft" : key === "ArrowRight") || key === "Enter" || key === " " || key === "";
4478
- }
4479
- function isCrossOrientationOpenKey(key, orientation, rtl) {
4480
- return doSwitch(orientation, rtl ? key === ARROW_LEFT : key === ARROW_RIGHT, key === ARROW_DOWN);
4481
- }
4482
- function isCrossOrientationCloseKey(key, orientation, rtl, grid) {
4483
- const vertical = rtl ? key === ARROW_RIGHT : key === ARROW_LEFT;
4484
- const horizontal = key === ARROW_UP;
4485
- if (orientation === "both" || orientation === "horizontal" && grid) return key === "Escape";
4486
- return doSwitch(orientation, vertical, horizontal);
4487
- }
4488
- /**
4489
- * Adds arrow key-based navigation of a list of items, either using real DOM
4490
- * focus or virtual focus.
4491
- * @see https://floating-ui.com/docs/useListNavigation
4492
- */
4493
- function useListNavigation(store, props) {
4494
- const { listRef, activeIndex, onNavigate: onNavigateProp = () => {}, enabled = true, selectedIndex = null, allowEscape = false, loopFocus = false, nested = false, rtl = false, virtual = false, focusItemOnOpen = "auto", focusItemOnHover = true, openOnArrowKeyDown = true, disabledIndices = void 0, orientation = "vertical", triggerOrientation = orientation, parentOrientation, id, resetOnPointerLeave = true, externalTree, nestedReturnFocusRef, grid: navigateGrid } = props;
4495
- const isGrid = navigateGrid != null;
4496
- const open = store.useState("open");
4497
- const floatingElement = store.useState("floatingElement");
4498
- const domReferenceElement = store.useState("domReferenceElement");
4499
- const dataRef = store.context.dataRef;
4500
- const floatingFocusElement = getFloatingFocusElement(floatingElement);
4501
- const typeableComboboxReference = isTypeableCombobox(domReferenceElement);
4502
- const floatingFocusElementRef = useValueAsRef(floatingFocusElement);
4503
- const parentId = useFloatingParentNodeId();
4504
- const tree = useFloatingTree(externalTree);
4505
- const focusItemOnOpenRef = import_react.useRef(focusItemOnOpen);
4506
- const indexRef = import_react.useRef(selectedIndex ?? -1);
4507
- const keyRef = import_react.useRef(null);
4508
- const isPointerModalityRef = import_react.useRef(true);
4509
- const onNavigate = useStableCallback((event) => {
4510
- onNavigateProp(indexRef.current === -1 ? null : indexRef.current, event);
4511
- });
4512
- const previousMountedRef = import_react.useRef(!!floatingElement);
4513
- const previousOpenRef = import_react.useRef(open);
4514
- const forceSyncFocusRef = import_react.useRef(false);
4515
- const forceScrollIntoViewRef = import_react.useRef(false);
4516
- const cancelQueuedFocusRef = import_react.useRef(null);
4517
- const disabledIndicesRef = useValueAsRef(disabledIndices);
4518
- const latestOpenRef = useValueAsRef(open);
4519
- const selectedIndexRef = useValueAsRef(selectedIndex);
4520
- const resetOnPointerLeaveRef = useValueAsRef(resetOnPointerLeave);
4521
- const focusFrame = useAnimationFrame();
4522
- const waitForListPopulatedFrame = useAnimationFrame();
4523
- const focusItem = useStableCallback(() => {
4524
- focusFrame.cancel();
4525
- function runFocus(item) {
4526
- if (!virtual) cancelQueuedFocusRef.current = enqueueFocus(item, {
4527
- sync: forceSyncFocusRef.current,
4528
- preventScroll: true
4529
- });
4530
- }
4531
- const initialItem = listRef.current[indexRef.current];
4532
- const forceScrollIntoView = forceScrollIntoViewRef.current;
4533
- if (initialItem) runFocus(initialItem);
4534
- (forceSyncFocusRef.current ? (callback) => callback() : (callback) => focusFrame.request(callback))(() => {
4535
- const waitedItem = listRef.current[indexRef.current] || initialItem;
4536
- if (!waitedItem) return;
4537
- if (!initialItem) runFocus(waitedItem);
4538
- if (item && (forceScrollIntoView || !isPointerModalityRef.current)) waitedItem.scrollIntoView?.({
4539
- block: "nearest",
4540
- inline: "nearest"
4541
- });
4542
- });
4543
- });
4544
- useIsoLayoutEffect(() => {
4545
- dataRef.current.orientation = orientation;
4546
- }, [dataRef, orientation]);
4547
- useIsoLayoutEffect(() => {
4548
- if (!open) keyRef.current = null;
4549
- if (!open || focusItemOnOpen !== "auto") focusItemOnOpenRef.current = focusItemOnOpen;
4550
- }, [open, focusItemOnOpen]);
4551
- useIsoLayoutEffect(() => {
4552
- if (!enabled) return;
4553
- if (open && floatingElement) {
4554
- indexRef.current = selectedIndex ?? -1;
4555
- if (focusItemOnOpenRef.current && selectedIndex != null) {
4556
- forceScrollIntoViewRef.current = true;
4557
- onNavigate();
4558
- }
4559
- } else if (previousMountedRef.current) {
4560
- indexRef.current = -1;
4561
- onNavigate();
4562
- }
4563
- }, [
4564
- enabled,
4565
- open,
4566
- floatingElement,
4567
- selectedIndex,
4568
- onNavigate
4569
- ]);
4570
- useIsoLayoutEffect(() => {
4571
- if (!enabled) return;
4572
- if (!open) {
4573
- forceSyncFocusRef.current = false;
4574
- return;
4575
- }
4576
- if (!floatingElement) return;
4577
- if (activeIndex == null) {
4578
- forceSyncFocusRef.current = false;
4579
- if (selectedIndexRef.current != null) return;
4580
- if (previousMountedRef.current) {
4581
- indexRef.current = -1;
4582
- focusItem();
4583
- }
4584
- if ((!previousOpenRef.current || !previousMountedRef.current) && focusItemOnOpenRef.current && (keyRef.current != null || focusItemOnOpenRef.current === true && keyRef.current == null)) {
4585
- let runs = 0;
4586
- const waitForListPopulated = () => {
4587
- if (listRef.current[0] == null) {
4588
- if (runs < 2) (runs ? (callback) => waitForListPopulatedFrame.request(callback) : queueMicrotask)(waitForListPopulated);
4589
- runs += 1;
4590
- } else {
4591
- indexRef.current = keyRef.current == null || isMainOrientationToEndKey(keyRef.current, triggerOrientation, rtl) || nested ? getMinListIndex(listRef) : getMaxListIndex(listRef);
4592
- keyRef.current = null;
4593
- onNavigate();
4594
- }
4595
- };
4596
- waitForListPopulated();
4597
- }
4598
- } else if (!isIndexOutOfListBounds(listRef.current, activeIndex)) {
4599
- indexRef.current = activeIndex;
4600
- focusItem();
4601
- forceScrollIntoViewRef.current = false;
4602
- }
4603
- }, [
4604
- enabled,
4605
- open,
4606
- floatingElement,
4607
- activeIndex,
4608
- selectedIndexRef,
4609
- nested,
4610
- listRef,
4611
- triggerOrientation,
4612
- rtl,
4613
- onNavigate,
4614
- focusItem,
4615
- waitForListPopulatedFrame
4616
- ]);
4617
- useIsoLayoutEffect(() => {
4618
- if (!enabled || floatingElement || !tree || virtual || !previousMountedRef.current) return;
4619
- const nodes = tree.nodesRef.current;
4620
- const parent = nodes.find((node) => node.id === parentId)?.context?.elements.floating;
4621
- const activeEl = activeElement(ownerDocument(domReferenceElement ?? parent ?? null));
4622
- const treeContainsActiveEl = nodes.some((node) => node.context && contains(node.context.elements.floating, activeEl));
4623
- if (parent && !treeContainsActiveEl && isPointerModalityRef.current) parent.focus({ preventScroll: true });
4624
- }, [
4625
- enabled,
4626
- floatingElement,
4627
- domReferenceElement,
4628
- tree,
4629
- parentId,
4630
- virtual
4631
- ]);
4632
- useIsoLayoutEffect(() => {
4633
- previousOpenRef.current = open;
4634
- previousMountedRef.current = !!floatingElement;
4635
- });
4636
- const hasActiveIndex = activeIndex != null;
4637
- const syncCurrentTarget = useStableCallback((event) => {
4638
- if (!latestOpenRef.current) return;
4639
- const index = listRef.current.indexOf(event.currentTarget);
4640
- if (index !== -1 && (indexRef.current !== index || activeIndex !== index)) {
4641
- indexRef.current = index;
4642
- onNavigate(event);
4643
- }
4644
- });
4645
- const getParentOrientation = useStableCallback(() => {
4646
- return parentOrientation ?? tree?.nodesRef.current.find((node) => node.id === parentId)?.context?.dataRef?.current.orientation;
4647
- });
4648
- const getMinEnabledIndex = useStableCallback(() => {
4649
- return getMinListIndex(listRef, disabledIndicesRef.current);
4650
- });
4651
- const commonOnKeyDown = useStableCallback((event) => {
4652
- isPointerModalityRef.current = false;
4653
- forceSyncFocusRef.current = true;
4654
- if (event.which === 229) return;
4655
- if (!latestOpenRef.current && event.currentTarget === floatingFocusElementRef.current) return;
4656
- if (nested && isCrossOrientationCloseKey(event.key, orientation, rtl, isGrid)) {
4657
- if (!isMainOrientationKey(event.key, getParentOrientation())) stopEvent(event);
4658
- store.setOpen(false, createChangeEventDetails(listNavigation, event.nativeEvent));
4659
- const returnElement = nestedReturnFocusRef?.current ?? domReferenceElement;
4660
- if (isHTMLElement(returnElement)) returnElement.focus();
4661
- return;
4662
- }
4663
- if (activeIndex != null && activeIndex !== indexRef.current && !isIndexOutOfListBounds(listRef.current, activeIndex)) indexRef.current = activeIndex;
4664
- const currentIndex = indexRef.current;
4665
- const minIndex = getMinListIndex(listRef, disabledIndices);
4666
- const maxIndex = getMaxListIndex(listRef, disabledIndices);
4667
- if (!typeableComboboxReference) {
4668
- if (event.key === "Home") {
4669
- stopEvent(event);
4670
- indexRef.current = minIndex;
4671
- onNavigate(event);
4672
- }
4673
- if (event.key === "End") {
4674
- stopEvent(event);
4675
- indexRef.current = maxIndex;
4676
- onNavigate(event);
4677
- }
4678
- }
4679
- if (navigateGrid != null) {
4680
- const index = navigateGrid(event, indexRef.current, listRef, orientation, loopFocus, rtl, disabledIndices, minIndex, maxIndex);
4681
- if (index != null && index !== indexRef.current) {
4682
- indexRef.current = index;
4683
- onNavigate(event);
4684
- }
4685
- if (orientation === "both") return;
4686
- }
4687
- if (isMainOrientationKey(event.key, orientation)) {
4688
- stopEvent(event);
4689
- const focusedElement = activeElement(event.currentTarget.ownerDocument);
4690
- if (open && !virtual && contains(event.currentTarget, focusedElement) && !listRef.current.some((item) => item != null && contains(item, focusedElement))) {
4691
- indexRef.current = isMainOrientationToEndKey(event.key, orientation, rtl) ? minIndex : maxIndex;
4692
- onNavigate(event);
4693
- if (activeIndex === indexRef.current) focusItem();
4694
- return;
4695
- }
4696
- const { index, wrapped } = getNextListIndex(listRef.current, currentIndex, {
4697
- decrement: !isMainOrientationToEndKey(event.key, orientation, rtl),
4698
- loopFocus,
4699
- allowEscape,
4700
- disabledIndices,
4701
- minIndex,
4702
- maxIndex
4703
- });
4704
- if (wrapped) forceSyncFocusRef.current = false;
4705
- indexRef.current = index;
4706
- onNavigate(event);
4707
- }
4708
- });
4709
- const item = import_react.useMemo(() => {
4710
- return {
4711
- onFocus(event) {
4712
- forceSyncFocusRef.current = true;
4713
- syncCurrentTarget(event);
4714
- },
4715
- onClick({ currentTarget }) {
4716
- if (!virtual) currentTarget.focus({ preventScroll: true });
4717
- },
4718
- onMouseMove(event) {
4719
- if (isStationaryWebKitPointer(event)) return;
4720
- forceSyncFocusRef.current = true;
4721
- forceScrollIntoViewRef.current = false;
4722
- if (focusItemOnHover) syncCurrentTarget(event);
4723
- },
4724
- onPointerLeave(event) {
4725
- if (!latestOpenRef.current || !isPointerModalityRef.current || event.pointerType === "touch") return;
4726
- forceSyncFocusRef.current = true;
4727
- const relatedTarget = event.relatedTarget;
4728
- if (!focusItemOnHover || listRef.current.includes(relatedTarget)) return;
4729
- if (!resetOnPointerLeaveRef.current) return;
4730
- cancelQueuedFocusRef.current?.();
4731
- cancelQueuedFocusRef.current = null;
4732
- indexRef.current = -1;
4733
- onNavigate(event);
4734
- if (!virtual) {
4735
- const floatingFocusEl = floatingFocusElementRef.current;
4736
- const activeEl = activeElement(ownerDocument(floatingFocusEl));
4737
- if (floatingFocusEl && contains(floatingFocusEl, activeEl)) floatingFocusEl.focus({ preventScroll: true });
4738
- }
4739
- }
4740
- };
4741
- }, [
4742
- syncCurrentTarget,
4743
- latestOpenRef,
4744
- floatingFocusElementRef,
4745
- focusItemOnHover,
4746
- listRef,
4747
- onNavigate,
4748
- resetOnPointerLeaveRef,
4749
- virtual
4750
- ]);
4751
- const ariaActiveDescendantProp = import_react.useMemo(() => {
4752
- return virtual && open && hasActiveIndex && { "aria-activedescendant": `${id}-${activeIndex}` };
4753
- }, [
4754
- virtual,
4755
- open,
4756
- hasActiveIndex,
4757
- id,
4758
- activeIndex
4759
- ]);
4760
- const floating = import_react.useMemo(() => {
4761
- return {
4762
- ...!typeableComboboxReference ? ariaActiveDescendantProp : {},
4763
- onKeyDown(event) {
4764
- if (event.key === "Tab" && event.shiftKey && open && !virtual) {
4765
- const target = getTarget(event.nativeEvent);
4766
- if (target && !contains(floatingFocusElementRef.current, target)) return;
4767
- stopEvent(event);
4768
- const details = createChangeEventDetails(focusOut, event.nativeEvent);
4769
- store.setOpen(false, details);
4770
- const returnElement = nestedReturnFocusRef?.current ?? domReferenceElement;
4771
- if (!details.isCanceled && isHTMLElement(returnElement)) returnElement.focus();
4772
- return;
4773
- }
4774
- commonOnKeyDown(event);
4775
- },
4776
- onPointerMove(event) {
4777
- if (isStationaryWebKitPointer(event)) return;
4778
- isPointerModalityRef.current = true;
4779
- }
4780
- };
4781
- }, [
4782
- ariaActiveDescendantProp,
4783
- commonOnKeyDown,
4784
- floatingFocusElementRef,
4785
- typeableComboboxReference,
4786
- store,
4787
- open,
4788
- virtual,
4789
- domReferenceElement,
4790
- nestedReturnFocusRef
4791
- ]);
4792
- const trigger = import_react.useMemo(() => {
4793
- function openOnNavigationKeyDown(event) {
4794
- store.setOpen(true, createChangeEventDetails(listNavigation, event.nativeEvent, event.currentTarget));
4795
- }
4796
- function checkVirtualMouse(event) {
4797
- if (focusItemOnOpen === "auto" && isVirtualClick(event.nativeEvent)) focusItemOnOpenRef.current = !virtual;
4798
- }
4799
- function checkVirtualPointer(event) {
4800
- focusItemOnOpenRef.current = focusItemOnOpen;
4801
- if (focusItemOnOpen === "auto" && isVirtualPointerEvent(event.nativeEvent)) focusItemOnOpenRef.current = true;
4802
- }
4803
- return {
4804
- onKeyDown(event) {
4805
- const currentOpen = store.select("open");
4806
- isPointerModalityRef.current = false;
4807
- const isArrowKey = event.key.startsWith("Arrow");
4808
- const isParentCrossOpenKey = isCrossOrientationOpenKey(event.key, getParentOrientation(), rtl);
4809
- const isMainKey = isMainOrientationKey(event.key, currentOpen ? orientation : triggerOrientation);
4810
- const isNavigationKey = (nested ? isParentCrossOpenKey : isMainKey) || event.key === "Enter" || event.key.trim() === "";
4811
- if (virtual && currentOpen && (!nested || isTypeableElement(event.currentTarget))) return commonOnKeyDown(event);
4812
- if (!currentOpen && !openOnArrowKeyDown && isArrowKey) return;
4813
- if (isNavigationKey) {
4814
- const isParentMainKey = isMainOrientationKey(event.key, getParentOrientation());
4815
- keyRef.current = nested && isParentMainKey ? null : event.key;
4816
- }
4817
- if (nested) {
4818
- if (isParentCrossOpenKey) {
4819
- stopEvent(event);
4820
- if (currentOpen) {
4821
- indexRef.current = getMinEnabledIndex();
4822
- onNavigate(event);
4823
- if (virtual) floatingFocusElementRef.current?.focus();
4824
- } else openOnNavigationKeyDown(event);
4825
- }
4826
- return;
4827
- }
4828
- if (isMainKey) {
4829
- if (selectedIndexRef.current != null) indexRef.current = selectedIndexRef.current;
4830
- stopEvent(event);
4831
- if (!currentOpen && openOnArrowKeyDown) openOnNavigationKeyDown(event);
4832
- else commonOnKeyDown(event);
4833
- if (currentOpen) onNavigate(event);
4834
- }
4835
- },
4836
- onFocus(event) {
4837
- if (event.target !== event.currentTarget) return;
4838
- if (store.select("open") && !virtual) {
4839
- indexRef.current = -1;
4840
- onNavigate(event);
4841
- }
4842
- },
4843
- onPointerDown: checkVirtualPointer,
4844
- onPointerEnter: checkVirtualPointer,
4845
- onMouseDown: checkVirtualMouse,
4846
- onClick: checkVirtualMouse
4847
- };
4848
- }, [
4849
- commonOnKeyDown,
4850
- focusItemOnOpen,
4851
- getMinEnabledIndex,
4852
- nested,
4853
- onNavigate,
4854
- store,
4855
- openOnArrowKeyDown,
4856
- orientation,
4857
- triggerOrientation,
4858
- getParentOrientation,
4859
- rtl,
4860
- selectedIndexRef,
4861
- virtual,
4862
- floatingFocusElementRef
4863
- ]);
4864
- const reference = import_react.useMemo(() => {
4865
- return {
4866
- ...ariaActiveDescendantProp,
4867
- ...trigger
4868
- };
4869
- }, [ariaActiveDescendantProp, trigger]);
4870
- return import_react.useMemo(() => enabled ? {
4871
- reference,
4872
- floating,
4873
- item,
4874
- trigger
4875
- } : {}, [
4876
- enabled,
4877
- reference,
4878
- floating,
4879
- trigger,
4880
- item
4881
- ]);
4882
- }
4883
3109
  // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/floating-ui-react/safePolygon.mjs
4884
3110
  var CURSOR_SPEED_THRESHOLD = .1;
4885
3111
  var CURSOR_SPEED_THRESHOLD_SQUARED = CURSOR_SPEED_THRESHOLD * CURSOR_SPEED_THRESHOLD;
@@ -7321,11 +5547,6 @@ var TooltipProvider$1 = function TooltipProvider(props) {
7321
5547
  })
7322
5548
  });
7323
5549
  };
7324
- // ../../node_modules/.bun/@base-ui+utils@0.5.0+9e489665888c9e4a/node_modules/@base-ui/utils/inertValue.mjs
7325
- function inertValue(value) {
7326
- if (isReactVersionAtLeast(19)) return value;
7327
- return value ? "true" : void 0;
7328
- }
7329
5550
  // src/components/ui/tooltip.tsx
7330
5551
  function TooltipProvider({ delay = 250, ...props }) {
7331
5552
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipProvider$1, {
@@ -7502,6 +5723,7 @@ async function loadViewCode(router, views, cancelled) {
7502
5723
  const routes = router.routesByPath;
7503
5724
  for (const view of views) {
7504
5725
  if (cancelled()) return;
5726
+ if (view === "usage") continue;
7505
5727
  const route = routes[VIEW_PATHS[view]];
7506
5728
  if (!route) continue;
7507
5729
  await Promise.resolve(router.loadRouteChunk(route)).catch(() => {});
@@ -7617,14 +5839,6 @@ var useAppearance = create((set, get) => ({
7617
5839
  set({ rail: next });
7618
5840
  }
7619
5841
  }));
7620
- // ../../node_modules/.bun/@base-ui+utils@0.5.0+9e489665888c9e4a/node_modules/@base-ui/utils/useOnFirstRender.mjs
7621
- function useOnFirstRender(fn) {
7622
- const ref = import_react.useRef(true);
7623
- if (ref.current) {
7624
- ref.current = false;
7625
- fn();
7626
- }
7627
- }
7628
5842
  // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/floating-ui-react/hooks/gridNavigation.mjs
7629
5843
  /**
7630
5844
  * Positional arguments are deliberate: property names of an options object
@@ -7667,129 +5881,29 @@ function getHighlightReason(event) {
7667
5881
  // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/combobox/root/ComboboxRootContext.mjs
7668
5882
  var ComboboxRootContext = /*#__PURE__*/ import_react.createContext(void 0);
7669
5883
  var ComboboxFloatingContext = /*#__PURE__*/ import_react.createContext(void 0);
7670
- var ComboboxDerivedItemsContext = /*#__PURE__*/ import_react.createContext(void 0);
7671
- var ComboboxHasItemsContext = /*#__PURE__*/ import_react.createContext(false);
7672
- var ComboboxInputValueContext = /*#__PURE__*/ import_react.createContext("");
7673
- function useComboboxRootContext() {
7674
- const context = import_react.useContext(ComboboxRootContext);
7675
- if (!context) throw new Error(formatErrorMessage(22));
7676
- return context;
7677
- }
7678
- function useComboboxFloatingContext() {
7679
- const context = import_react.useContext(ComboboxFloatingContext);
7680
- if (!context) throw new Error(formatErrorMessage(23));
7681
- return context;
7682
- }
7683
- function useComboboxDerivedItemsContext() {
7684
- const context = import_react.useContext(ComboboxDerivedItemsContext);
7685
- if (!context) throw new Error(formatErrorMessage(24));
7686
- return context;
7687
- }
7688
- function useComboboxInputValueContext() {
7689
- return import_react.useContext(ComboboxInputValueContext);
7690
- }
7691
- function useComboboxHasItemsContext() {
7692
- return import_react.useContext(ComboboxHasItemsContext);
7693
- }
7694
- // ../../node_modules/.bun/@base-ui+utils@0.5.0+9e489665888c9e4a/node_modules/@base-ui/utils/areArraysEqual.mjs
7695
- /**
7696
- * Compares two arrays element-wise.
7697
- *
7698
- * The default comparison is `Object.is`, so `NaN` equals `NaN` and `0` does not equal `-0`.
7699
- */
7700
- function areArraysEqual(array1, array2, itemComparer = Object.is) {
7701
- const { length } = array1;
7702
- if (length !== array2.length) return false;
7703
- for (let i = 0; i < length; i += 1) if (!itemComparer(array1[i], array2[i])) return false;
7704
- return true;
7705
- }
7706
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/internals/itemEquality.mjs
7707
- var defaultItemEquality = (itemValue, selectedValue) => Object.is(itemValue, selectedValue);
7708
- function compareItemEquality(itemValue, selectedValue, comparer) {
7709
- if (itemValue == null || selectedValue == null) return Object.is(itemValue, selectedValue);
7710
- return comparer(itemValue, selectedValue);
7711
- }
7712
- function isSelectedValueDirty(currentValue, initialValue, comparer) {
7713
- if (Array.isArray(currentValue) && Array.isArray(initialValue)) return !areArraysEqual(currentValue, initialValue, (itemValue, initialItemValue) => compareItemEquality(itemValue, initialItemValue, comparer));
7714
- return currentValue !== initialValue;
7715
- }
7716
- function selectedValueIncludes(selectedValues, itemValue, comparer) {
7717
- if (!selectedValues) return false;
7718
- return selectedValues.some((selectedValue) => {
7719
- if (selectedValue === void 0) return false;
7720
- return compareItemEquality(itemValue, selectedValue, comparer);
7721
- });
7722
- }
7723
- function findItemIndex(itemValues, selectedValue, comparer) {
7724
- if (!itemValues) return -1;
7725
- return itemValues.findIndex((itemValue) => {
7726
- if (itemValue === void 0) return false;
7727
- return compareItemEquality(itemValue, selectedValue, comparer);
7728
- });
7729
- }
7730
- function createSelectionMatcher(selectedValues, comparer) {
7731
- if (comparer !== defaultItemEquality) return (itemValue) => selectedValueIncludes(selectedValues, itemValue, comparer);
7732
- const index = new Set(selectedValues);
7733
- index.delete(void 0);
7734
- return (itemValue) => index.has(itemValue) && (itemValue !== 0 || selectedValues.some((v) => Object.is(itemValue, v)));
7735
- }
7736
- function findSelectionIndex(itemValues, selectedValue, comparer, multiple) {
7737
- const index = multiple && Array.isArray(selectedValue) ? itemValues.findIndex(createSelectionMatcher(selectedValue, comparer)) : findItemIndex(itemValues, selectedValue, comparer);
7738
- return index === -1 ? null : index;
7739
- }
7740
- /** Resolves the first selected index as items register or change. */
7741
- function resolveSelectedIndex(index, itemValue, registry, selectedValues, comparer, currentIndex) {
7742
- if (selectedValueIncludes(selectedValues, itemValue, comparer)) return currentIndex != null && index > currentIndex && selectedValueIncludes(selectedValues, registry[currentIndex], comparer) ? currentIndex : index;
7743
- return index === currentIndex ? findSelectionIndex(registry, selectedValues, comparer, true) : currentIndex;
7744
- }
7745
- function removeItem(selectedValues, itemValue, comparer) {
7746
- return selectedValues.filter((selectedValue) => !compareItemEquality(itemValue, selectedValue, comparer));
7747
- }
7748
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/internals/serializeValue.mjs
7749
- function serializeValue(value) {
7750
- if (value == null) return "";
7751
- if (typeof value === "string") return value;
7752
- try {
7753
- return JSON.stringify(value);
7754
- } catch {
7755
- return String(value);
7756
- }
7757
- }
7758
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/internals/resolveValueLabel.mjs
7759
- function isGroup(item) {
7760
- return typeof item === "object" && item != null && Array.isArray(item.items);
7761
- }
7762
- function isGroupedItems(items) {
7763
- return isGroup(items?.[0]);
5884
+ var ComboboxDerivedItemsContext = /*#__PURE__*/ import_react.createContext(void 0);
5885
+ var ComboboxHasItemsContext = /*#__PURE__*/ import_react.createContext(false);
5886
+ var ComboboxInputValueContext = /*#__PURE__*/ import_react.createContext("");
5887
+ function useComboboxRootContext() {
5888
+ const context = import_react.useContext(ComboboxRootContext);
5889
+ if (!context) throw new Error(formatErrorMessage(22));
5890
+ return context;
7764
5891
  }
7765
- function flattenLeafItems(items) {
7766
- return isGroupedItems(items) ? items.flatMap((group) => group.items) : items;
5892
+ function useComboboxFloatingContext() {
5893
+ const context = import_react.useContext(ComboboxFloatingContext);
5894
+ if (!context) throw new Error(formatErrorMessage(23));
5895
+ return context;
7767
5896
  }
7768
- /**
7769
- * Checks if the items array contains an item with a null value that has a non-null label.
7770
- */
7771
- function hasNullItemLabel(items) {
7772
- if (!Array.isArray(items)) return items != null && "null" in items;
7773
- const arrayItems = items;
7774
- if (isGroupedItems(arrayItems)) {
7775
- for (const group of arrayItems) for (const item of group.items) if (item && item.value == null && item.label != null) return true;
7776
- return false;
7777
- }
7778
- for (const item of arrayItems) if (item && item.value == null && item.label != null) return true;
7779
- return false;
5897
+ function useComboboxDerivedItemsContext() {
5898
+ const context = import_react.useContext(ComboboxDerivedItemsContext);
5899
+ if (!context) throw new Error(formatErrorMessage(24));
5900
+ return context;
7780
5901
  }
7781
- function stringifyAsLabel(item, itemToStringLabel) {
7782
- if (itemToStringLabel && item != null) return itemToStringLabel(item) ?? "";
7783
- if (item && typeof item === "object") {
7784
- if ("label" in item && item.label != null) return String(item.label);
7785
- if ("value" in item) return String(item.value);
7786
- }
7787
- return serializeValue(item);
5902
+ function useComboboxInputValueContext() {
5903
+ return import_react.useContext(ComboboxInputValueContext);
7788
5904
  }
7789
- function stringifyAsValue(item, itemToStringValue) {
7790
- if (itemToStringValue && item != null) return itemToStringValue(item) ?? "";
7791
- if (item && typeof item === "object" && "value" in item && "label" in item) return serializeValue(item.value);
7792
- return serializeValue(item);
5905
+ function useComboboxHasItemsContext() {
5906
+ return import_react.useContext(ComboboxHasItemsContext);
7793
5907
  }
7794
5908
  // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/combobox/store.mjs
7795
5909
  /**
@@ -7856,195 +5970,15 @@ var selectors$2 = {
7856
5970
  modal: (state) => state.modal,
7857
5971
  autoHighlight: (state) => state.autoHighlight
7858
5972
  };
7859
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/field/control/FieldControlDataAttributes.mjs
7860
- /**
7861
- * Present when the field is in a valid state.
7862
- */
7863
- var valid = "data-valid";
7864
- /**
7865
- * Present when the field is in an invalid state.
7866
- */
7867
- var invalid = "data-invalid";
7868
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/internals/field-constants/constants.mjs
7869
- var DEFAULT_VALIDITY_STATE = {
7870
- badInput: false,
7871
- customError: false,
7872
- patternMismatch: false,
7873
- rangeOverflow: false,
7874
- rangeUnderflow: false,
7875
- stepMismatch: false,
7876
- tooLong: false,
7877
- tooShort: false,
7878
- typeMismatch: false,
7879
- valid: null,
7880
- valueMissing: false
7881
- };
7882
- var DEFAULT_FIELD_STATE_ATTRIBUTES = {
7883
- valid: null,
7884
- touched: false,
7885
- dirty: false,
7886
- filled: false,
7887
- focused: false
7888
- };
7889
- var DEFAULT_FIELD_ROOT_STATE = {
7890
- disabled: false,
7891
- ...DEFAULT_FIELD_STATE_ATTRIBUTES
7892
- };
7893
- var fieldValidityMapping = { valid(value) {
7894
- if (value === null) return null;
7895
- if (value) return { [valid]: "" };
7896
- return { [invalid]: "" };
7897
- } };
7898
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/internals/field-root-context/FieldRootContext.mjs
7899
- var DEFAULT_FIELD_ROOT_CONTEXT = {
7900
- invalid: void 0,
7901
- name: void 0,
7902
- validityData: {
7903
- state: DEFAULT_VALIDITY_STATE,
7904
- errors: [],
7905
- error: "",
7906
- value: "",
7907
- initialValue: null
7908
- },
7909
- setValidityData: NOOP,
7910
- disabled: void 0,
7911
- setTouched: NOOP,
7912
- setDirty: NOOP,
7913
- setFilled: NOOP,
7914
- setFocused: NOOP,
7915
- focusOwnerRef: { current: void 0 },
7916
- validationMode: "onSubmit",
7917
- shouldValidateOnChange: () => false,
7918
- state: DEFAULT_FIELD_ROOT_STATE,
7919
- registerFieldControl: NOOP,
7920
- validation: {
7921
- getValidationProps: (_disabled, props = EMPTY_OBJECT) => props,
7922
- inputRef: { current: null },
7923
- registeredInputs: /* @__PURE__ */ new Map(),
7924
- registerInput: NOOP,
7925
- getInputControl: () => null,
7926
- commit: async () => {},
7927
- change: NOOP
7928
- }
7929
- };
7930
- var FieldRootContext = /*#__PURE__*/ import_react.createContext(DEFAULT_FIELD_ROOT_CONTEXT);
7931
- function useFieldRootContext(optional = true) {
7932
- const context = import_react.useContext(FieldRootContext);
7933
- if (context.setValidityData === NOOP && !optional) throw new Error(formatErrorMessage(28));
7934
- return context;
7935
- }
7936
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/internals/field-register-control/useRegisterFieldControl.mjs
7937
- function useRegisterFieldControl(controlRef, id, value, getFormValueOverride, enabled = true, name) {
7938
- const { registerFieldControl } = useFieldRootContext();
7939
- const sourceRef = useRefWithInit(() => Symbol());
7940
- useIsoLayoutEffect(() => {
7941
- const source = sourceRef.current;
7942
- if (!enabled) {
7943
- registerFieldControl(source, void 0);
7944
- return;
7945
- }
7946
- registerFieldControl(source, {
7947
- controlRef,
7948
- getValue: getFormValueOverride,
7949
- id,
7950
- name,
7951
- value
7952
- });
7953
- }, [
7954
- controlRef,
7955
- enabled,
7956
- getFormValueOverride,
7957
- id,
7958
- name,
7959
- registerFieldControl,
7960
- sourceRef,
7961
- value
7962
- ]);
7963
- useIsoLayoutEffect(() => {
7964
- const source = sourceRef.current;
7965
- return () => {
7966
- registerFieldControl(source, void 0);
7967
- };
7968
- }, [registerFieldControl, sourceRef]);
7969
- }
7970
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/internals/form-context/FormContext.mjs
7971
- var FormContext = /*#__PURE__*/ import_react.createContext({
7972
- elementRef: { current: null },
7973
- formRef: { current: { fields: /* @__PURE__ */ new Map() } },
7974
- errors: {},
7975
- clearErrors: NOOP,
7976
- validationMode: "onSubmit",
7977
- submitCountRef: { current: 0 }
7978
- });
7979
- function useFormContext() {
7980
- return import_react.useContext(FormContext);
7981
- }
7982
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/internals/labelable-provider/LabelableContext.mjs
5973
+ // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/combobox/root/utils/index.mjs
7983
5974
  /**
7984
- * A context for providing [labelable elements](https://html.spec.whatwg.org/multipage/forms.html#category-label)\
7985
- * with an accessible name (label) and description.
5975
+ * Derives the default id assigned to `Combobox.Popup` when the input is rendered inside it.
5976
+ * Shared by the popup (which applies it) and the trigger (which references it via `aria-controls`)
5977
+ * so the convention only lives in one place.
7986
5978
  */
7987
- var LabelableContext = /*#__PURE__*/ import_react.createContext({
7988
- controlId: void 0,
7989
- registerControlId: NOOP,
7990
- resetControlId: NOOP,
7991
- labelId: void 0,
7992
- setLabelId: NOOP,
7993
- messageIds: [],
7994
- setMessageIds: NOOP,
7995
- getDescriptionProps: (externalProps) => externalProps
7996
- });
7997
- function useLabelableContext() {
7998
- return import_react.useContext(LabelableContext);
7999
- }
8000
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/internals/labelable-provider/useLabelableId.mjs
8001
- function useLabelableId(params = {}) {
8002
- const { id, enabled = true } = params;
8003
- const { controlId, registerControlId, resetControlId } = useLabelableContext();
8004
- const defaultId = useBaseUiId();
8005
- const controlSourceRef = useRefWithInit(() => Symbol());
8006
- const hasRegisteredRef = import_react.useRef(false);
8007
- const hadExplicitIdRef = import_react.useRef(false);
8008
- const unregisterControlId = useStableCallback(() => {
8009
- if (!hasRegisteredRef.current || registerControlId === NOOP) return;
8010
- hasRegisteredRef.current = false;
8011
- registerControlId(controlSourceRef.current, void 0);
8012
- });
8013
- useIsoLayoutEffect(() => {
8014
- if (!enabled || registerControlId === NOOP) {
8015
- unregisterControlId();
8016
- return;
8017
- }
8018
- let nextId;
8019
- if (id !== void 0) {
8020
- hadExplicitIdRef.current = true;
8021
- nextId = id;
8022
- } else if (hadExplicitIdRef.current) nextId = defaultId;
8023
- else {
8024
- resetControlId();
8025
- return;
8026
- }
8027
- if (nextId === void 0) {
8028
- unregisterControlId();
8029
- return;
8030
- }
8031
- hasRegisteredRef.current = true;
8032
- registerControlId(controlSourceRef.current, nextId);
8033
- }, [
8034
- id,
8035
- enabled,
8036
- registerControlId,
8037
- resetControlId,
8038
- defaultId,
8039
- controlSourceRef,
8040
- unregisterControlId
8041
- ]);
8042
- useIsoLayoutEffect(() => {
8043
- return unregisterControlId;
8044
- }, [unregisterControlId]);
8045
- return (enabled ? controlId : void 0) ?? id ?? defaultId;
5979
+ function getComboboxPopupId(rootId) {
5980
+ return rootId == null ? void 0 : `${rootId}-popup`;
8046
5981
  }
8047
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/combobox/root/utils/index.mjs
8048
5982
  /**
8049
5983
  * Enhanced filter using Intl.Collator for more robust string matching.
8050
5984
  * Uses the provided `itemToStringLabel` function if available, otherwise falls back to:
@@ -8104,69 +6038,6 @@ function getFilter(options = {}) {
8104
6038
  * Matches items against a query using `Intl.Collator` for robust string matching.
8105
6039
  */
8106
6040
  var useCoreFilter = getFilter;
8107
- // ../../node_modules/.bun/@base-ui+utils@0.5.0+9e489665888c9e4a/node_modules/@base-ui/utils/useEnhancedClickHandler.mjs
8108
- /**
8109
- * Provides a cross-browser way to determine the type of the pointer used to click.
8110
- * Safari and Firefox do not provide the PointerEvent to the click handler (they use MouseEvent) yet.
8111
- * Additionally, this implementation detects if the click was triggered by the keyboard.
8112
- *
8113
- * @param handler The function to be called when the button is clicked. The first parameter is the original event and the second parameter is the pointer type.
8114
- */
8115
- function useEnhancedClickHandler(handler) {
8116
- const lastClickInteractionTypeRef = import_react.useRef("");
8117
- const handlePointerDown = import_react.useCallback((event) => {
8118
- if (event.defaultPrevented) return;
8119
- lastClickInteractionTypeRef.current = event.pointerType;
8120
- handler(event, event.pointerType);
8121
- }, [handler]);
8122
- return {
8123
- onClick: import_react.useCallback((event) => {
8124
- if (event.detail === 0) {
8125
- handler(event, "keyboard");
8126
- return;
8127
- }
8128
- if ("pointerType" in event) handler(event, event.pointerType);
8129
- else handler(event, lastClickInteractionTypeRef.current);
8130
- lastClickInteractionTypeRef.current = "";
8131
- }, [handler]),
8132
- onPointerDown: handlePointerDown
8133
- };
8134
- }
8135
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/internals/useValueChanged.mjs
8136
- function useValueChanged(value, onChange) {
8137
- const valueRef = import_react.useRef(value);
8138
- const onChangeCallback = useStableCallback(onChange);
8139
- useIsoLayoutEffect(() => {
8140
- if (valueRef.current !== value) onChangeCallback(valueRef.current);
8141
- valueRef.current = value;
8142
- }, [value, onChangeCallback]);
8143
- }
8144
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/utils/useOpenInteractionType.mjs
8145
- function useOpenMethodTriggerProps(open, setOpenMethod) {
8146
- const { onClick, onPointerDown } = useEnhancedClickHandler(useStableCallback((_, interactionType) => {
8147
- if (!(typeof open === "function" ? open() : open)) setOpenMethod(interactionType || (ios ? "touch" : ""));
8148
- }));
8149
- return import_react.useMemo(() => ({
8150
- onClick,
8151
- onPointerDown
8152
- }), [onClick, onPointerDown]);
8153
- }
8154
- /**
8155
- * Determines the interaction type (keyboard, mouse, touch, etc.) that opened the component.
8156
- *
8157
- * @param open The open state of the component.
8158
- */
8159
- function useOpenInteractionType(open) {
8160
- const [openMethod, setOpenMethod] = import_react.useState(null);
8161
- const triggerProps = useOpenMethodTriggerProps(open, setOpenMethod);
8162
- useValueChanged(open, (previousOpen) => {
8163
- if (previousOpen && !open) setOpenMethod(null);
8164
- });
8165
- return import_react.useMemo(() => ({
8166
- openMethod,
8167
- triggerProps
8168
- }), [openMethod, triggerProps]);
8169
- }
8170
6041
  // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/utils/scrollable.mjs
8171
6042
  function isScrollableY(element, allowOverflowIntent = false) {
8172
6043
  const { overflowY } = getComputedStyle$1(element);
@@ -9159,35 +7030,6 @@ var triggerStateAttributesMapping = {
9159
7030
  popupSide: (side) => side ? { [popupSide]: side } : null,
9160
7031
  listEmpty: (empty) => empty ? { [listEmpty]: "" } : null
9161
7032
  };
9162
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/internals/field-root-context/useSetFieldFocused.mjs
9163
- /**
9164
- * Returns the field's `setFocused`, recording which control the focused state belongs to.
9165
- *
9166
- * Disabling or unmounting a focused control moves focus away without firing `blur`, so the focused
9167
- * state would otherwise stay latched. A field can have several focus targets, so a control only
9168
- * clears the shared state when focus last landed on itself. The stable callback doubles as that
9169
- * identity.
9170
- */
9171
- function useSetFieldFocused(disabled, focusTargetRef, onFocusedChange) {
9172
- const { setFocused, focusOwnerRef } = useFieldRootContext();
9173
- const setFieldFocused = useStableCallback((focused) => {
9174
- if (focused ? !disabled : focusOwnerRef.current === setFieldFocused) {
9175
- focusOwnerRef.current = focused && setFieldFocused;
9176
- onFocusedChange?.(focused);
9177
- setFocused(focused);
9178
- }
9179
- });
9180
- useIsoLayoutEffect(() => {
9181
- const el = focusTargetRef.current;
9182
- if ((el?.getRootNode())?.activeElement === el) setFieldFocused(true);
9183
- return () => setFieldFocused(false);
9184
- }, [
9185
- disabled,
9186
- focusTargetRef,
9187
- setFieldFocused
9188
- ]);
9189
- return setFieldFocused;
9190
- }
9191
7033
  // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/combobox/utils/parts.mjs
9192
7034
  /**
9193
7035
  * The popup side is only meaningful while the positioner is mounted, as the store retains the
@@ -9632,250 +7474,6 @@ function useInitialLiveRegionTextMutation(present = true) {
9632
7474
  ]);
9633
7475
  return rootRef;
9634
7476
  }
9635
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/utils/InternalBackdrop.mjs
9636
- /**
9637
- * @internal
9638
- */
9639
- var InternalBackdrop = /*#__PURE__*/ import_react.forwardRef(function InternalBackdrop(props, ref) {
9640
- const { cutout, ...otherProps } = props;
9641
- let clipPath;
9642
- if (cutout) {
9643
- const rect = cutout.getBoundingClientRect();
9644
- clipPath = `polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${rect.left}px ${rect.top}px,${rect.left}px ${rect.bottom}px,${rect.right}px ${rect.bottom}px,${rect.right}px ${rect.top}px,${rect.left}px ${rect.top}px)`;
9645
- }
9646
- return /*#__PURE__*/ (0, import_jsx_runtime.jsx)("div", {
9647
- ref,
9648
- role: "presentation",
9649
- "data-base-ui-inert": "",
9650
- ...otherProps,
9651
- style: {
9652
- position: "fixed",
9653
- inset: 0,
9654
- userSelect: "none",
9655
- WebkitUserSelect: "none",
9656
- clipPath
9657
- }
9658
- });
9659
- });
9660
- // ../../node_modules/.bun/@base-ui+utils@0.5.0+9e489665888c9e4a/node_modules/@base-ui/utils/useScrollLock.mjs
9661
- var originalHtmlStyles = {};
9662
- var originalBodyStyles = {};
9663
- var originalHtmlScrollBehavior = "";
9664
- function getViewportScroller(html, body) {
9665
- return isOverflowElement(html) ? html : body;
9666
- }
9667
- function isPageScrollLocked(win, html, body) {
9668
- return /hidden|clip/.test(win.getComputedStyle(getViewportScroller(html, body)).overflowY);
9669
- }
9670
- function hasInsetScrollbars(referenceElement) {
9671
- if (typeof document === "undefined") return false;
9672
- const doc = ownerDocument(referenceElement);
9673
- return getWindow(doc).innerWidth - doc.documentElement.clientWidth > 0;
9674
- }
9675
- function supportsStableScrollbarGutter(referenceElement) {
9676
- if (!(typeof CSS !== "undefined" && CSS.supports && CSS.supports("scrollbar-gutter", "stable")) || typeof document === "undefined") return false;
9677
- const doc = ownerDocument(referenceElement);
9678
- const html = doc.documentElement;
9679
- const body = doc.body;
9680
- const scrollContainer = getViewportScroller(html, body);
9681
- const originalScrollContainerOverflowY = scrollContainer.style.overflowY;
9682
- const originalHtmlStyleGutter = html.style.scrollbarGutter;
9683
- html.style.scrollbarGutter = "stable";
9684
- scrollContainer.style.overflowY = "scroll";
9685
- const before = scrollContainer.offsetWidth;
9686
- scrollContainer.style.overflowY = "hidden";
9687
- const after = scrollContainer.offsetWidth;
9688
- scrollContainer.style.overflowY = originalScrollContainerOverflowY;
9689
- html.style.scrollbarGutter = originalHtmlStyleGutter;
9690
- return before === after;
9691
- }
9692
- function preventScrollOverlayScrollbars(referenceElement) {
9693
- const doc = ownerDocument(referenceElement);
9694
- const html = doc.documentElement;
9695
- const body = doc.body;
9696
- const elementToLock = getViewportScroller(html, body);
9697
- const originalElementToLockStyles = {
9698
- overflowY: elementToLock.style.overflowY,
9699
- overflowX: elementToLock.style.overflowX
9700
- };
9701
- Object.assign(elementToLock.style, {
9702
- overflowY: "hidden",
9703
- overflowX: "hidden"
9704
- });
9705
- return () => {
9706
- Object.assign(elementToLock.style, originalElementToLockStyles);
9707
- };
9708
- }
9709
- function preventScrollInsetScrollbars(referenceElement) {
9710
- const doc = ownerDocument(referenceElement);
9711
- const html = doc.documentElement;
9712
- const body = doc.body;
9713
- const win = getWindow(html);
9714
- let scrollTop = 0;
9715
- let scrollLeft = 0;
9716
- let updateGutterOnly = false;
9717
- const resizeFrame = AnimationFrame.create();
9718
- if (webkit && (win.visualViewport?.scale ?? 1) !== 1) return () => {};
9719
- function lockScroll() {
9720
- const htmlStyles = win.getComputedStyle(html);
9721
- const bodyStyles = win.getComputedStyle(body);
9722
- const scrollbarGutterValue = (htmlStyles.scrollbarGutter || "").includes("both-edges") ? "stable both-edges" : "stable";
9723
- scrollTop = html.scrollTop;
9724
- scrollLeft = html.scrollLeft;
9725
- originalHtmlStyles = {
9726
- scrollbarGutter: html.style.scrollbarGutter,
9727
- overflowY: html.style.overflowY,
9728
- overflowX: html.style.overflowX
9729
- };
9730
- originalHtmlScrollBehavior = html.style.scrollBehavior;
9731
- originalBodyStyles = {
9732
- position: body.style.position,
9733
- height: body.style.height,
9734
- width: body.style.width,
9735
- boxSizing: body.style.boxSizing,
9736
- overflowY: body.style.overflowY,
9737
- overflowX: body.style.overflowX,
9738
- scrollBehavior: body.style.scrollBehavior
9739
- };
9740
- const isScrollableY = html.scrollHeight > html.clientHeight;
9741
- const isScrollableX = html.scrollWidth > html.clientWidth;
9742
- const hasConstantOverflowY = htmlStyles.overflowY === "scroll" || bodyStyles.overflowY === "scroll";
9743
- const hasConstantOverflowX = htmlStyles.overflowX === "scroll" || bodyStyles.overflowX === "scroll";
9744
- const scrollbarWidth = Math.max(0, win.innerWidth - body.clientWidth);
9745
- const scrollbarHeight = Math.max(0, win.innerHeight - body.clientHeight);
9746
- const marginY = parseFloat(bodyStyles.marginTop) + parseFloat(bodyStyles.marginBottom);
9747
- const marginX = parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight);
9748
- const elementToLock = getViewportScroller(html, body);
9749
- updateGutterOnly = supportsStableScrollbarGutter(referenceElement);
9750
- if (updateGutterOnly) {
9751
- html.style.scrollbarGutter = scrollbarGutterValue;
9752
- elementToLock.style.overflowY = "hidden";
9753
- elementToLock.style.overflowX = "hidden";
9754
- return;
9755
- }
9756
- Object.assign(html.style, {
9757
- scrollbarGutter: scrollbarGutterValue,
9758
- overflowY: "hidden",
9759
- overflowX: "hidden"
9760
- });
9761
- if (isScrollableY || hasConstantOverflowY) html.style.overflowY = "scroll";
9762
- if (isScrollableX || hasConstantOverflowX) html.style.overflowX = "scroll";
9763
- Object.assign(body.style, {
9764
- position: "relative",
9765
- height: marginY || scrollbarHeight ? `calc(100dvh - ${marginY + scrollbarHeight}px)` : "100dvh",
9766
- width: marginX || scrollbarWidth ? `calc(100vw - ${marginX + scrollbarWidth}px)` : "100vw",
9767
- boxSizing: "border-box",
9768
- overflowY: "hidden",
9769
- overflowX: "hidden",
9770
- scrollBehavior: "unset"
9771
- });
9772
- body.scrollTop = scrollTop;
9773
- body.scrollLeft = scrollLeft;
9774
- html.setAttribute("data-base-ui-scroll-locked", "");
9775
- html.style.scrollBehavior = "unset";
9776
- }
9777
- function cleanup() {
9778
- Object.assign(html.style, originalHtmlStyles);
9779
- Object.assign(body.style, originalBodyStyles);
9780
- if (!updateGutterOnly) {
9781
- html.scrollTop = scrollTop;
9782
- html.scrollLeft = scrollLeft;
9783
- html.removeAttribute("data-base-ui-scroll-locked");
9784
- html.style.scrollBehavior = originalHtmlScrollBehavior;
9785
- }
9786
- }
9787
- function handleResize() {
9788
- cleanup();
9789
- resizeFrame.request(lockScroll);
9790
- }
9791
- lockScroll();
9792
- const unsubscribeResize = addEventListener(win, "resize", handleResize);
9793
- return () => {
9794
- resizeFrame.cancel();
9795
- cleanup();
9796
- if (typeof win.removeEventListener === "function") unsubscribeResize();
9797
- };
9798
- }
9799
- var ScrollLocker = class {
9800
- lockCount = 0;
9801
- restore = null;
9802
- timeoutLock = Timeout.create();
9803
- timeoutUnlock = Timeout.create();
9804
- acquire(referenceElement) {
9805
- this.lockCount += 1;
9806
- if (this.lockCount === 1 && this.restore === null) this.timeoutLock.start(0, () => this.lock(referenceElement));
9807
- return this.release;
9808
- }
9809
- release = () => {
9810
- this.lockCount -= 1;
9811
- if (this.lockCount === 0 && this.restore) this.timeoutUnlock.start(0, this.unlock);
9812
- };
9813
- unlock = () => {
9814
- if (this.lockCount === 0 && this.restore) {
9815
- this.restore?.();
9816
- this.restore = null;
9817
- }
9818
- };
9819
- lock(referenceElement) {
9820
- if (this.lockCount === 0 || this.restore !== null) return;
9821
- const doc = ownerDocument(referenceElement);
9822
- const html = doc.documentElement;
9823
- const body = doc.body;
9824
- const win = getWindow(html);
9825
- if (isPageScrollLocked(win, html, body)) {
9826
- const observer = new win.MutationObserver(() => {
9827
- if (isPageScrollLocked(win, html, body)) return;
9828
- observer.disconnect();
9829
- this.restore = null;
9830
- this.lock(referenceElement);
9831
- });
9832
- const options = { attributes: true };
9833
- observer.observe(html, options);
9834
- observer.observe(body, options);
9835
- this.restore = () => observer.disconnect();
9836
- return;
9837
- }
9838
- const hasOverlayScrollbars = ios || !hasInsetScrollbars(referenceElement);
9839
- this.restore = hasOverlayScrollbars ? preventScrollOverlayScrollbars(referenceElement) : preventScrollInsetScrollbars(referenceElement);
9840
- }
9841
- };
9842
- var SCROLL_LOCKER = new ScrollLocker();
9843
- /**
9844
- * Locks the scroll of the document when enabled.
9845
- *
9846
- * @param enabled - Whether to enable the scroll lock.
9847
- * @param referenceElement - Element to use as a reference for lock calculations.
9848
- */
9849
- function useScrollLock(enabled = true, referenceElement = null) {
9850
- useIsoLayoutEffect(() => {
9851
- if (!enabled) return;
9852
- return SCROLL_LOCKER.acquire(referenceElement);
9853
- }, [enabled, referenceElement]);
9854
- }
9855
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/utils/useAnchoredPopupScrollLock.mjs
9856
- var VIEWPORT_WIDTH_TOLERANCE_PX = 20;
9857
- /**
9858
- * Manages scroll lock for anchored popups. For non-touch opens, scroll lock is applied when
9859
- * enabled. For touch opens, scroll lock is applied only when the positioner width is effectively
9860
- * viewport-sized.
9861
- */
9862
- function useAnchoredPopupScrollLock(enabled, touchOpen, positionerElement, referenceElement) {
9863
- const [touchOpenShouldLockScroll, setTouchOpenShouldLockScroll] = import_react.useState(false);
9864
- useIsoLayoutEffect(() => {
9865
- if (!enabled || !touchOpen || positionerElement == null) {
9866
- setTouchOpenShouldLockScroll(false);
9867
- return;
9868
- }
9869
- const viewportWidth = ownerDocument(positionerElement).documentElement.clientWidth;
9870
- const popupWidth = positionerElement.offsetWidth;
9871
- setTouchOpenShouldLockScroll(viewportWidth > 0 && popupWidth > 0 && popupWidth >= viewportWidth - VIEWPORT_WIDTH_TOLERANCE_PX);
9872
- }, [
9873
- enabled,
9874
- touchOpen,
9875
- positionerElement
9876
- ]);
9877
- useScrollLock(enabled && (!touchOpen || touchOpenShouldLockScroll), referenceElement);
9878
- }
9879
7477
  // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/combobox/group/ComboboxGroupContext.mjs
9880
7478
  var ComboboxGroupContext = /*#__PURE__*/ import_react.createContext(void 0);
9881
7479
  function useComboboxGroupContext() {
@@ -9947,6 +7545,11 @@ var ComboboxGroupLabel = /*#__PURE__*/ import_react.forwardRef(function Combobox
9947
7545
  });
9948
7546
  // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/combobox/item/ComboboxItemContext.mjs
9949
7547
  var ComboboxItemContext = /*#__PURE__*/ import_react.createContext(void 0);
7548
+ function useComboboxItemContext() {
7549
+ const context = import_react.useContext(ComboboxItemContext);
7550
+ if (!context) throw new Error(formatErrorMessage(19));
7551
+ return context;
7552
+ }
9950
7553
  // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/combobox/row/ComboboxRowContext.mjs
9951
7554
  var ComboboxRowContext = /*#__PURE__*/ import_react.createContext(false);
9952
7555
  function useComboboxRowContext() {
@@ -10096,7 +7699,8 @@ function ComboboxItemVirtualizedIndex(props) {
10096
7699
  const { componentProps, forwardedRef } = props;
10097
7700
  const isItemEqualToValue = useComboboxRootContext().useState("isItemEqualToValue");
10098
7701
  const { flatFilteredValues } = useComboboxDerivedItemsContext();
10099
- const indexFromFilter = findItemIndex(flatFilteredValues, componentProps.value ?? null, isItemEqualToValue);
7702
+ const lookupValue = componentProps.value ?? null;
7703
+ const indexFromFilter = findItemIndex(flatFilteredValues, lookupValue, isItemEqualToValue);
10100
7704
  return /*#__PURE__*/ (0, import_jsx_runtime.jsx)(ComboboxItemInner, {
10101
7705
  componentProps,
10102
7706
  forwardedRef,
@@ -10104,14 +7708,13 @@ function ComboboxItemVirtualizedIndex(props) {
10104
7708
  indexFromFilter
10105
7709
  });
10106
7710
  }
10107
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/autocomplete/item/AutocompleteItem.mjs
10108
7711
  /**
10109
7712
  * An individual item in the list.
10110
7713
  * Renders a `<div>` element.
10111
7714
  *
10112
- * Documentation: [Base UI Autocomplete](https://base-ui.com/react/components/autocomplete)
7715
+ * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
10113
7716
  */
10114
- var AutocompleteItem = /* @__PURE__ */ import_react.memo(/*#__PURE__*/ import_react.forwardRef(function ComboboxItem(componentProps, forwardedRef) {
7717
+ var ComboboxItem = /*#__PURE__*/ import_react.memo(/*#__PURE__*/ import_react.forwardRef(function ComboboxItem(componentProps, forwardedRef) {
10115
7718
  const virtualized = useComboboxRootContext().useState("virtualized");
10116
7719
  if (virtualized && componentProps.index == null) return /*#__PURE__*/ (0, import_jsx_runtime.jsx)(ComboboxItemVirtualizedIndex, {
10117
7720
  componentProps,
@@ -10124,6 +7727,14 @@ var AutocompleteItem = /* @__PURE__ */ import_react.memo(/*#__PURE__*/ import_re
10124
7727
  indexFromFilter: void 0
10125
7728
  });
10126
7729
  }));
7730
+ // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/autocomplete/item/AutocompleteItem.mjs
7731
+ /**
7732
+ * An individual item in the list.
7733
+ * Renders a `<div>` element.
7734
+ *
7735
+ * Documentation: [Base UI Autocomplete](https://base-ui.com/react/components/autocomplete)
7736
+ */
7737
+ var AutocompleteItem = ComboboxItem;
10127
7738
  // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/combobox/empty/ComboboxEmpty.mjs
10128
7739
  /**
10129
7740
  * Renders its children only when the list is empty.
@@ -10622,218 +8233,57 @@ fastComponentRef(function DialogTrigger(componentProps, forwardedRef) {
10622
8233
  state,
10623
8234
  ref: [
10624
8235
  buttonRef,
10625
- forwardedRef,
10626
- registerTrigger,
10627
- triggerElementRef
10628
- ],
10629
- props: [
10630
- click.reference,
10631
- rootTriggerProps,
10632
- interactionTypeProps,
10633
- {
10634
- [CLICK_TRIGGER_IDENTIFIER]: "",
10635
- id: thisTriggerId,
10636
- "aria-haspopup": "dialog",
10637
- "aria-expanded": isOpenedByThisTrigger,
10638
- "aria-controls": popupId
10639
- },
10640
- elementProps,
10641
- getButtonProps
10642
- ],
10643
- stateAttributesMapping: triggerOpenStateMapping
10644
- });
10645
- });
10646
- // src/components/ui/dialog.tsx
10647
- function Dialog(props) {
10648
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogRoot, {
10649
- "data-slot": "dialog",
10650
- ...props
10651
- });
10652
- }
10653
- var DialogClose = DialogClose$1;
10654
- /** A centred dialog near the top of the window; it floats, so it casts the floating shadow. */
10655
- function DialogContent({ className, ...props }) {
10656
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogPortal, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogBackdrop, {
10657
- "data-slot": "dialog-overlay",
10658
- className: "fixed inset-0 z-40 bg-[color-mix(in_srgb,var(--bg)_70%,transparent)] transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0"
10659
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPopup, {
10660
- "data-slot": "dialog-content",
10661
- className: cn("fixed top-[14vh] left-1/2 z-40 w-[min(620px,calc(100vw-32px))] -translate-x-1/2 overflow-hidden rounded-card border border-rule bg-surface text-text shadow-float outline-none transition-[opacity,transform] duration-150 data-ending-style:translate-y-1.5 data-ending-style:opacity-0 data-starting-style:translate-y-1.5 data-starting-style:opacity-0", className),
10662
- ...props
10663
- })] });
10664
- }
10665
- function DialogTitle({ className, ...props }) {
10666
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogTitle$1, {
10667
- "data-slot": "dialog-title",
10668
- className: cn("m-0 text-lg font-semibold", className),
10669
- ...props
10670
- });
10671
- }
10672
- function DialogDescription({ className, ...props }) {
10673
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogDescription$1, {
10674
- "data-slot": "dialog-description",
10675
- className: cn("m-0 text-sm text-muted", className),
10676
- ...props
10677
- });
10678
- }
10679
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/field/control/FieldControl.mjs
10680
- /**
10681
- * The form control to label and validate.
10682
- * Renders an `<input>` element.
10683
- *
10684
- * You can omit this part and use any Base UI input component instead. For example,
10685
- * [Input](https://base-ui.com/react/components/input), [Checkbox](https://base-ui.com/react/components/checkbox),
10686
- * or [Select](https://base-ui.com/react/components/select), among others, will work with Field out of the box.
10687
- *
10688
- * Documentation: [Base UI Field](https://base-ui.com/react/components/field)
10689
- */
10690
- var FieldControl = /*#__PURE__*/ import_react.forwardRef(function FieldControl(componentProps, forwardedRef) {
10691
- const { render, className, id: idProp, name: nameProp, value, disabled: disabledProp = false, onValueChange, defaultValue, autoFocus = false, style, ...elementProps } = componentProps;
10692
- const { state: fieldState, name: fieldName, disabled: fieldDisabled, setTouched, setDirty, validityData, setFilled, validationMode, validation } = useFieldRootContext();
10693
- const { clearErrors, elementRef: formElementRef, submitCountRef } = useFormContext();
10694
- const disabled = fieldDisabled || disabledProp;
10695
- const name = fieldName ?? nameProp;
10696
- const state = {
10697
- ...fieldState,
10698
- disabled
10699
- };
10700
- const { labelId } = useLabelableContext();
10701
- const id = useLabelableId({ id: idProp });
10702
- const isControlled = value !== void 0;
10703
- const serializedValue = value == null ? void 0 : String(value);
10704
- const getValueFromInput = useStableCallback(() => validation.inputRef.current?.value);
10705
- useRegisterFieldControl(validation.inputRef, id, serializedValue, getValueFromInput, !disabled, nameProp);
10706
- useIsoLayoutEffect(() => {
10707
- const currentValue = serializedValue ?? validation.inputRef.current?.value;
10708
- if (currentValue !== void 0) setFilled(currentValue !== "");
10709
- }, [
10710
- serializedValue,
10711
- defaultValue,
10712
- validation.inputRef,
10713
- setFilled
10714
- ]);
10715
- useValueChanged(serializedValue, () => {
10716
- if (serializedValue === void 0) return;
10717
- clearErrors(name);
10718
- setDirty(serializedValue !== (validityData.initialValue ?? ""));
10719
- validation.change(serializedValue);
10720
- });
10721
- const inputRef = import_react.useRef(null);
10722
- const setFocused = useSetFieldFocused(disabled, inputRef);
10723
- const enterValidationTimeout = useTimeout();
10724
- return useRenderElement("input", componentProps, {
10725
- ref: [forwardedRef, inputRef],
10726
- state,
10727
- props: [
10728
- {
10729
- id,
10730
- disabled,
10731
- name,
10732
- ref: validation.inputRef,
10733
- "aria-labelledby": labelId,
10734
- autoFocus,
10735
- ...isControlled ? { value } : { defaultValue },
10736
- onChange(event) {
10737
- const inputValue = event.currentTarget.value;
10738
- const details = createChangeEventDetails(none, event.nativeEvent);
10739
- onValueChange?.(inputValue, details);
10740
- if (isControlled) return;
10741
- setDirty(inputValue !== (validityData.initialValue ?? ""));
10742
- setFilled(inputValue !== "");
10743
- if (!event.nativeEvent.defaultPrevented && !details.isCanceled) {
10744
- clearErrors(name);
10745
- validation.change(inputValue);
10746
- }
10747
- },
10748
- onFocus() {
10749
- setFocused(true);
10750
- },
10751
- onBlur(event) {
10752
- setTouched(true);
10753
- setFocused(false);
10754
- if (validationMode === "onBlur") {
10755
- const inputValue = event.currentTarget.value;
10756
- validation.commit(inputValue);
10757
- if (isControlled) queueMicrotask(() => {
10758
- const nextValue = validation.inputRef.current?.value;
10759
- if (nextValue !== void 0 && nextValue !== inputValue && nextValue !== (validityData.initialValue ?? "")) validation.commit(nextValue);
10760
- });
10761
- }
10762
- },
10763
- onKeyDown(event) {
10764
- if (event.currentTarget.tagName === "INPUT" && event.key === "Enter") {
10765
- setTouched(true);
10766
- const value = event.currentTarget.value;
10767
- const form = event.currentTarget.form;
10768
- if (form && form === formElementRef.current && !event.defaultPrevented) {
10769
- const input = event.currentTarget;
10770
- const submitCount = submitCountRef.current;
10771
- enterValidationTimeout.start(0, () => {
10772
- if (submitCountRef.current === submitCount) validation.commit(input.value);
10773
- });
10774
- } else validation.commit(value);
10775
- }
10776
- }
8236
+ forwardedRef,
8237
+ registerTrigger,
8238
+ triggerElementRef
8239
+ ],
8240
+ props: [
8241
+ click.reference,
8242
+ rootTriggerProps,
8243
+ interactionTypeProps,
8244
+ {
8245
+ [CLICK_TRIGGER_IDENTIFIER]: "",
8246
+ id: thisTriggerId,
8247
+ "aria-haspopup": "dialog",
8248
+ "aria-expanded": isOpenedByThisTrigger,
8249
+ "aria-controls": popupId
10777
8250
  },
10778
8251
  elementProps,
10779
- (props) => validation.getValidationProps(disabled, props)
8252
+ getButtonProps
10780
8253
  ],
10781
- stateAttributesMapping: fieldValidityMapping
8254
+ stateAttributesMapping: triggerOpenStateMapping
10782
8255
  });
10783
8256
  });
10784
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/input/Input.mjs
10785
- /**
10786
- * A native input element that automatically works with [Field](https://base-ui.com/react/components/field).
10787
- * Renders an `<input>` element.
10788
- *
10789
- * Documentation: [Base UI Input](https://base-ui.com/react/components/input)
10790
- */
10791
- var Input$1 = /*#__PURE__*/ import_react.forwardRef(function Input(props, forwardedRef) {
10792
- return /*#__PURE__*/ (0, import_jsx_runtime.jsx)(FieldControl, {
10793
- ref: forwardedRef,
8257
+ // src/components/ui/dialog.tsx
8258
+ function Dialog(props) {
8259
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogRoot, {
8260
+ "data-slot": "dialog",
10794
8261
  ...props
10795
8262
  });
10796
- });
10797
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/separator/Separator.mjs
10798
- /**
10799
- * A separator element accessible to screen readers.
10800
- * Renders a `<div>` element.
10801
- *
10802
- * Documentation: [Base UI Separator](https://base-ui.com/react/components/separator)
10803
- */
10804
- var Separator$1 = /*#__PURE__*/ import_react.forwardRef(function SeparatorComponent(componentProps, forwardedRef) {
10805
- const { className, render, orientation = "horizontal", style, ...elementProps } = componentProps;
10806
- return useRenderElement("div", componentProps, {
10807
- state: { orientation },
10808
- ref: forwardedRef,
10809
- props: [{
10810
- role: "separator",
10811
- "aria-orientation": orientation
10812
- }, elementProps]
10813
- });
10814
- });
10815
- // src/components/ui/fields.tsx
10816
- /** A key name, as the viewer presses it. */
10817
- function Kbd({ className, ...props }) {
10818
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("kbd", {
10819
- "data-slot": "kbd",
10820
- className: cn("inline-grid h-[18px] min-w-[18px] place-items-center rounded-[4px] border border-b-2 border-rule bg-page px-1 font-mono text-[0.66rem] leading-none font-semibold text-muted select-none", className),
8263
+ }
8264
+ var DialogClose = DialogClose$1;
8265
+ /** A centred dialog near the top of the window; it floats, so it casts the floating shadow. */
8266
+ function DialogContent({ className, ...props }) {
8267
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogPortal, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogBackdrop, {
8268
+ "data-slot": "dialog-overlay",
8269
+ className: "fixed inset-0 z-40 bg-[color-mix(in_srgb,var(--bg)_70%,transparent)] transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0"
8270
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPopup, {
8271
+ "data-slot": "dialog-content",
8272
+ className: cn("fixed top-[14vh] left-1/2 z-40 w-[min(620px,calc(100vw-32px))] -translate-x-1/2 overflow-hidden rounded-card border border-rule bg-surface text-text shadow-float outline-none transition-[opacity,transform] duration-150 data-ending-style:translate-y-1.5 data-ending-style:opacity-0 data-starting-style:translate-y-1.5 data-starting-style:opacity-0", className),
10821
8273
  ...props
10822
- });
8274
+ })] });
10823
8275
  }
10824
- var FIELD = "w-full min-w-0 rounded-control border border-rule bg-page px-3 text-sm text-text outline-none transition-colors placeholder:text-muted focus:border-accent disabled:cursor-not-allowed disabled:opacity-60";
10825
- function Input({ className, ...props }) {
10826
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Input$1, {
10827
- "data-slot": "input",
10828
- className: cn(FIELD, "h-9", className),
8276
+ function DialogTitle({ className, ...props }) {
8277
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogTitle$1, {
8278
+ "data-slot": "dialog-title",
8279
+ className: cn("m-0 text-lg font-semibold", className),
10829
8280
  ...props
10830
8281
  });
10831
8282
  }
10832
- function Separator({ className, orientation = "horizontal", ...props }) {
10833
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Separator$1, {
10834
- "data-slot": "separator",
10835
- orientation,
10836
- className: cn("shrink-0 bg-rule-soft data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px data-[orientation=vertical]:self-stretch", className),
8283
+ function DialogDescription({ className, ...props }) {
8284
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogDescription$1, {
8285
+ "data-slot": "dialog-description",
8286
+ className: cn("m-0 text-sm text-muted", className),
10837
8287
  ...props
10838
8288
  });
10839
8289
  }
@@ -10856,7 +8306,7 @@ var CHANGE_GROUPS = [
10856
8306
  ];
10857
8307
  var GROUP_TITLES = {
10858
8308
  "needs-you": "Needs you",
10859
- building: "Building",
8309
+ building: "Implementation started",
10860
8310
  ready: "Ready to archive"
10861
8311
  };
10862
8312
  function changeGroup(change) {
@@ -10911,6 +8361,31 @@ function changeStep(change) {
10911
8361
  prompt: `/mate-archive-change ${change.name}`
10912
8362
  };
10913
8363
  }
8364
+ /**
8365
+ * How far the change's stage is: the plan's artifacts while it is still being written, tasks
8366
+ * once the plan is complete and tasks are listed (so the bar never falls back at apply), and
8367
+ * tasks when no artifact is known.
8368
+ */
8369
+ function changeProgress(change) {
8370
+ const tasks = {
8371
+ done: change.completedTasks ?? 0,
8372
+ total: change.totalTasks ?? 0
8373
+ };
8374
+ if (tasks.done > 0 || change.artifacts.length === 0) return {
8375
+ ...tasks,
8376
+ unit: "tasks"
8377
+ };
8378
+ const done = change.artifacts.filter((artifact) => artifact.status === "done").length;
8379
+ if (done === change.artifacts.length && tasks.total > 0) return {
8380
+ ...tasks,
8381
+ unit: "tasks"
8382
+ };
8383
+ return {
8384
+ done,
8385
+ total: change.artifacts.length,
8386
+ unit: "artifacts"
8387
+ };
8388
+ }
10914
8389
  // src/lib/use-media-query.ts
10915
8390
  /** Whether a media query matches; false while the server renders. */
10916
8391
  function useMediaQuery(query) {
@@ -10928,21 +8403,26 @@ var MODE_ORDER = [
10928
8403
  "dashboard",
10929
8404
  "workflow",
10930
8405
  "factory",
10931
- "skills"
8406
+ "skills",
8407
+ "getting-started"
10932
8408
  ];
10933
8409
  var LIBRARY_ORDER = [
10934
8410
  "specs",
10935
8411
  "vault",
10936
- "reports"
8412
+ "graph"
10937
8413
  ];
8414
+ var INSIGHTS_ORDER = ["usage", "reports"];
10938
8415
  var VIEW_ICONS = {
10939
8416
  dashboard: "home",
10940
8417
  workflow: "flow",
8418
+ "getting-started": "doc",
10941
8419
  factory: "factory",
10942
8420
  skills: "spark",
10943
8421
  specs: "doc",
10944
8422
  vault: "folder",
10945
- reports: "chart"
8423
+ reports: "chart",
8424
+ usage: "chart",
8425
+ graph: "graph"
10946
8426
  };
10947
8427
  /** Core's views in Studio's order; a view the order does not name yet goes last, never missing. */
10948
8428
  function inOrder(views, order) {
@@ -10954,7 +8434,10 @@ function modeViews(mode, factoryMode) {
10954
8434
  return inOrder(MODE_VIEWS[mode], MODE_ORDER).filter((view) => factoryMode || view !== "factory");
10955
8435
  }
10956
8436
  function libraryViews() {
10957
- return inOrder(SHARED_VIEWS, LIBRARY_ORDER);
8437
+ return inOrder(SHARED_VIEWS.filter((view) => !INSIGHTS_ORDER.includes(view)), LIBRARY_ORDER);
8438
+ }
8439
+ function insightViews() {
8440
+ return inOrder(SHARED_VIEWS.filter((view) => INSIGHTS_ORDER.includes(view)), INSIGHTS_ORDER);
10958
8441
  }
10959
8442
  function companionName(companionPath) {
10960
8443
  const segments = companionPath.split(/[\\/]+/).filter(Boolean);
@@ -11030,7 +8513,11 @@ function useCommands(shell, search, open) {
11030
8513
  ...extra
11031
8514
  }
11032
8515
  });
11033
- const views = [...modeViews(shell.studioMode, shell.factoryMode), ...libraryViews()].map((view) => ({
8516
+ const views = [
8517
+ ...modeViews(shell.studioMode, shell.factoryMode),
8518
+ ...libraryViews(),
8519
+ ...insightViews()
8520
+ ].map((view) => ({
11034
8521
  id: `view-${view}`,
11035
8522
  label: VIEW_TITLES[view],
11036
8523
  hint: "View",
@@ -11444,7 +8931,8 @@ var PopoverTrigger$1 = fastComponentRef(function PopoverTrigger(componentProps,
11444
8931
  isActiveTrigger: isTriggerActive,
11445
8932
  isClosing: () => store.select("transitionStatus") === "ending"
11446
8933
  });
11447
- const click = useClick(floatingContext, { stickIfOpen: useStableCallback(() => store.context.stickIfOpen) });
8934
+ const getStickIfOpen = useStableCallback(() => store.context.stickIfOpen);
8935
+ const click = useClick(floatingContext, { stickIfOpen: getStickIfOpen });
11448
8936
  const interactionTypeProps = useOpenMethodTriggerProps(() => store.select("open"), (interactionType) => {
11449
8937
  store.set("openMethod", interactionType);
11450
8938
  });
@@ -11828,6 +9316,247 @@ var deleteCompanion = createServerFn({ method: "POST" }).validator((input) => {
11828
9316
  if (typeof input?.companion !== "string" || !COMPANION_DIGEST_PATTERN.test(input.companion)) throw new Error("no registered companion was named");
11829
9317
  return { companion: input.companion };
11830
9318
  }).handler(createSsrRpc("9d1ee2ce056a1b26a05141623f6d836fa1c4c283e555132764a528a212e3c50a"));
9319
+ /** Adds a companion by Git URL or absolute path; a refusal comes back as an answer with its reason. */
9320
+ var addCompanion = createServerFn({ method: "POST" }).validator((input) => {
9321
+ if (input?.kind === "url" && typeof input.url === "string") return {
9322
+ kind: "url",
9323
+ url: input.url
9324
+ };
9325
+ if (input?.kind === "path" && typeof input.path === "string") return {
9326
+ kind: "path",
9327
+ path: input.path
9328
+ };
9329
+ throw new Error("name a Git URL or a path");
9330
+ }).handler(createSsrRpc("ce3152edd0f9f5f9d010eb4e4217f988b6787024b3f6a48677370a325f4698aa"));
9331
+ // src/lib/git-tokens.ts
9332
+ /**
9333
+ * The Git access panel's calls to the Git token route. Only each key's status is cached; an
9334
+ * entered token goes in one request body and is never kept, keyed or put in an address.
9335
+ */
9336
+ var gitTokensKey = ["git-tokens"];
9337
+ var gitTokensQuery = () => ({
9338
+ queryKey: gitTokensKey,
9339
+ queryFn: () => call("GET", FACTORY_GIT_TOKENS_ROUTE)
9340
+ });
9341
+ var setGitToken = (key, token) => call("PUT", FACTORY_GIT_TOKENS_ROUTE, {
9342
+ key,
9343
+ token
9344
+ });
9345
+ var clearGitToken = (key) => call("DELETE", FACTORY_GIT_TOKENS_ROUTE, { key });
9346
+ /** The host of a `host` or `host/org` key. */
9347
+ var hostOf = (key) => key.split("/")[0];
9348
+ /** Whether a stored key covers `key` (`host/org`): its own, or its host's. */
9349
+ var tokenCovers = (key, tokens) => tokens.some((token) => token.key === key || token.key === hostOf(key));
9350
+ // src/views/factory/git-token-form.tsx
9351
+ /** Reads the form's fields and empties the token, so it lives only in this request. */
9352
+ function takeFields(event) {
9353
+ event.preventDefault();
9354
+ const form = event.currentTarget;
9355
+ const data = new FormData(form);
9356
+ const key = data.get("key");
9357
+ const token = data.get("token");
9358
+ form.querySelector("[name=\"token\"]").value = "";
9359
+ return {
9360
+ key: typeof key === "string" ? key : "",
9361
+ token: typeof token === "string" ? token : ""
9362
+ };
9363
+ }
9364
+ /**
9365
+ * Sets a Git token for a `host` or `host/org`. Used by the Git access panel and by the dialogs
9366
+ * that add a repository, which pass the key of the URL that was refused.
9367
+ */
9368
+ function GitTokenForm({ defaultKey = "", onSaved }) {
9369
+ const queryClient = useQueryClient();
9370
+ const save = useMutation({
9371
+ mutationFn: ({ key, token }) => setGitToken(key, token),
9372
+ onSuccess: (next) => {
9373
+ queryClient.setQueryData(gitTokensKey, next);
9374
+ onSaved?.(next);
9375
+ }
9376
+ });
9377
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", {
9378
+ className: "factory-sheet",
9379
+ "data-git-token-form": "",
9380
+ onSubmit: (event) => save.mutate(takeFields(event)),
9381
+ children: [
9382
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", {
9383
+ className: "agents-field",
9384
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "Host or host/organization" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
9385
+ type: "text",
9386
+ name: "key",
9387
+ defaultValue: defaultKey,
9388
+ placeholder: "git.acme.test/acme",
9389
+ autoComplete: "off",
9390
+ spellCheck: false,
9391
+ required: true
9392
+ })]
9393
+ }),
9394
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", {
9395
+ className: "agents-field",
9396
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "Token" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
9397
+ type: "password",
9398
+ name: "token",
9399
+ autoComplete: "off",
9400
+ spellCheck: false,
9401
+ required: true
9402
+ })]
9403
+ }),
9404
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
9405
+ className: "factory-sheet-actions",
9406
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
9407
+ type: "submit",
9408
+ disabled: save.isPending,
9409
+ children: "Save"
9410
+ })
9411
+ }),
9412
+ save.error ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
9413
+ className: "factory-problems",
9414
+ role: "alert",
9415
+ children: save.error.message
9416
+ }) : null
9417
+ ]
9418
+ });
9419
+ }
9420
+ // src/shell/add-companion-dialog.tsx
9421
+ var MODES = [{
9422
+ mode: "url",
9423
+ label: "Git URL",
9424
+ field: "Git URL of the companion",
9425
+ placeholder: "https://git.acme.test/acme/companion.git",
9426
+ hint: "The factory clones it into its companions directory. A private repository asks for a Git token."
9427
+ }, {
9428
+ mode: "path",
9429
+ label: "Local path",
9430
+ field: "Absolute path of the companion's folder",
9431
+ placeholder: "/srv/acme-companion",
9432
+ hint: "Registered where it is, on the machine Studio runs on. Nothing is copied."
9433
+ }];
9434
+ /** Adds a companion by Git URL or local path; opens the token form when a private clone is refused. */
9435
+ function AddCompanionDialog({ open, onClose, onAdded }) {
9436
+ const [mode, setMode] = (0, import_react.useState)("url");
9437
+ const [value, setValue] = (0, import_react.useState)("");
9438
+ const [refusal, setRefusal] = (0, import_react.useState)(null);
9439
+ const queryClient = useQueryClient();
9440
+ const form = MODES.find((entry) => entry.mode === mode);
9441
+ const input = () => mode === "url" ? {
9442
+ kind: "url",
9443
+ url: value
9444
+ } : {
9445
+ kind: "path",
9446
+ path: value
9447
+ };
9448
+ const add = useMutation({
9449
+ mutationFn: () => addCompanion({ data: input() }),
9450
+ onSuccess: async (result) => {
9451
+ if (result.ok) {
9452
+ await queryClient.invalidateQueries();
9453
+ reset();
9454
+ onAdded(result.digest);
9455
+ } else setRefusal(result);
9456
+ }
9457
+ });
9458
+ function reset() {
9459
+ setValue("");
9460
+ setRefusal(null);
9461
+ add.reset();
9462
+ }
9463
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Dialog, {
9464
+ open,
9465
+ onOpenChange: (next) => {
9466
+ if (next) return;
9467
+ reset();
9468
+ onClose();
9469
+ },
9470
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogContent, {
9471
+ className: "grid w-[min(520px,calc(100vw-32px))] gap-4 p-5",
9472
+ children: [
9473
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
9474
+ className: "grid gap-1.5",
9475
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogTitle, {
9476
+ className: "text-md",
9477
+ children: "Add a companion"
9478
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogDescription, { children: form.hint })]
9479
+ }),
9480
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
9481
+ role: "tablist",
9482
+ "aria-label": "How to add",
9483
+ className: "flex gap-1.5",
9484
+ children: MODES.map((entry) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
9485
+ type: "button",
9486
+ role: "tab",
9487
+ "aria-selected": mode === entry.mode,
9488
+ className: cn("h-7 rounded-full border border-rule bg-transparent px-3 text-sm text-muted", mode === entry.mode && "border-accent bg-accent-soft text-text"),
9489
+ onClick: () => {
9490
+ setMode(entry.mode);
9491
+ reset();
9492
+ },
9493
+ children: entry.label
9494
+ }, entry.mode))
9495
+ }),
9496
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", {
9497
+ className: "grid gap-3",
9498
+ onSubmit: (event) => {
9499
+ event.preventDefault();
9500
+ setRefusal(null);
9501
+ add.mutate();
9502
+ },
9503
+ children: [
9504
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", {
9505
+ className: "grid gap-1.5 text-sm",
9506
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: form.field }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Input, {
9507
+ value,
9508
+ placeholder: form.placeholder,
9509
+ autoComplete: "off",
9510
+ spellCheck: false,
9511
+ required: true,
9512
+ onChange: (event) => setValue(event.currentTarget.value),
9513
+ "aria-label": form.field
9514
+ })]
9515
+ }),
9516
+ refusal ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
9517
+ className: "m-0 text-sm text-bad",
9518
+ role: "alert",
9519
+ children: refusal.reason
9520
+ }) : null,
9521
+ add.isError ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
9522
+ className: "m-0 text-sm text-bad",
9523
+ role: "alert",
9524
+ children: add.error instanceof Error ? add.error.message : "The companion was not added."
9525
+ }) : null,
9526
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
9527
+ className: "flex justify-end gap-2",
9528
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogClose, {
9529
+ render: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
9530
+ variant: "ghost",
9531
+ type: "button"
9532
+ }),
9533
+ children: "Cancel"
9534
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
9535
+ type: "submit",
9536
+ disabled: add.isPending || value.trim() === "",
9537
+ children: add.isPending ? "Adding…" : "Add companion"
9538
+ })]
9539
+ })
9540
+ ]
9541
+ }),
9542
+ refusal?.tokenKey ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
9543
+ className: "grid gap-2 border-t border-rule pt-3",
9544
+ "data-add-companion-token": "",
9545
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
9546
+ className: "m-0 text-sm text-muted",
9547
+ children: "Set a Git token for this host, then add the companion again."
9548
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GitTokenForm, {
9549
+ defaultKey: refusal.tokenKey,
9550
+ onSaved: () => {
9551
+ setRefusal(null);
9552
+ add.mutate();
9553
+ }
9554
+ })]
9555
+ }) : null
9556
+ ]
9557
+ })
9558
+ });
9559
+ }
11831
9560
  // src/shell/companion-picker.tsx
11832
9561
  var svgUri = (svg) => `data:image/svg+xml;base64,${btoa(svg)}`;
11833
9562
  var SYMBOL_COLOR_URI = svgUri(BRAND_SVGS.symbolColor);
@@ -11920,7 +9649,7 @@ function CompanionActions({ companion, writable, onDelete }) {
11920
9649
  setOpen(false);
11921
9650
  onDelete();
11922
9651
  },
11923
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { name: "trash" }), companion.missing ? "Remove from list…" : "Delete companion…"]
9652
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { name: "trash" }), companion.missing || companion.keepsFolder ? "Remove from list…" : "Delete companion…"]
11924
9653
  }),
11925
9654
  writable ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
11926
9655
  className: "m-0 px-2.5 pb-1.5 text-2xs text-muted",
@@ -11931,6 +9660,27 @@ function CompanionActions({ companion, writable, onDelete }) {
11931
9660
  })]
11932
9661
  });
11933
9662
  }
9663
+ /** What the confirmation says: a folder is deleted only when it exists and Studio created it. */
9664
+ function deleteCopy(companion, name) {
9665
+ if (companion?.missing) return {
9666
+ title: `Remove ${name} from the list?`,
9667
+ description: "Its folder is already gone; this only removes the entry from the companion list.",
9668
+ action: "Remove",
9669
+ needsName: false
9670
+ };
9671
+ if (companion?.keepsFolder) return {
9672
+ title: `Remove ${name} from the list?`,
9673
+ description: "This only removes it from the companion list. Its folder was not created by Studio and is left where it is.",
9674
+ action: "Remove",
9675
+ needsName: false
9676
+ };
9677
+ return {
9678
+ title: `Delete ${name}?`,
9679
+ description: "This deletes the folder from disk, with every spec, plan and note in it, and removes it from the companion list. It cannot be undone.",
9680
+ action: "Delete companion",
9681
+ needsName: true
9682
+ };
9683
+ }
11934
9684
  /**
11935
9685
  * Confirms deleting a companion. A folder on disk is deleted only after its name is typed;
11936
9686
  * a stale entry whose folder is gone is only removed from the list.
@@ -11945,8 +9695,8 @@ function DeleteCompanionDialog({ companion, onClose, onDeleted }) {
11945
9695
  }
11946
9696
  });
11947
9697
  const name = companion ? companionName(companion.path) : "";
11948
- const stale = companion?.missing === true;
11949
- const confirmed = stale || typed === name;
9698
+ const copy = deleteCopy(companion, name);
9699
+ const confirmed = !copy.needsName || typed === name;
11950
9700
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Dialog, {
11951
9701
  open: companion !== null,
11952
9702
  onOpenChange: (next) => {
@@ -11962,14 +9712,14 @@ function DeleteCompanionDialog({ companion, onClose, onDeleted }) {
11962
9712
  className: "grid gap-1.5",
11963
9713
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogTitle, {
11964
9714
  className: "text-md",
11965
- children: stale ? `Remove ${name} from the list?` : `Delete ${name}?`
11966
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogDescription, { children: stale ? "Its folder is already gone; this only removes the entry from the companion list." : "This deletes the folder from disk, with every spec, plan and note in it, and removes it from the companion list. It cannot be undone." })]
9715
+ children: copy.title
9716
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogDescription, { children: copy.description })]
11967
9717
  }),
11968
9718
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", {
11969
9719
  className: "truncate rounded-control border border-rule bg-page px-2.5 py-1.5 font-mono text-xs",
11970
9720
  children: companion?.path
11971
9721
  }),
11972
- stale ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", {
9722
+ copy.needsName ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", {
11973
9723
  className: "grid gap-1.5 text-sm",
11974
9724
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
11975
9725
  "Type ",
@@ -11985,7 +9735,7 @@ function DeleteCompanionDialog({ companion, onClose, onDeleted }) {
11985
9735
  onChange: (event) => setTyped(event.currentTarget.value),
11986
9736
  "aria-label": `Type ${name} to confirm`
11987
9737
  })]
11988
- }),
9738
+ }) : null,
11989
9739
  remove.isError ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
11990
9740
  className: "m-0 text-sm text-bad",
11991
9741
  role: "alert",
@@ -12000,7 +9750,7 @@ function DeleteCompanionDialog({ companion, onClose, onDeleted }) {
12000
9750
  variant: "danger",
12001
9751
  disabled: !confirmed || remove.isPending || companion === null,
12002
9752
  onClick: () => companion && remove.mutate(companion),
12003
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { name: "trash" }), remove.isPending ? "Deleting…" : stale ? "Remove" : "Delete companion"]
9753
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { name: "trash" }), remove.isPending ? "Deleting…" : copy.action]
12004
9754
  })]
12005
9755
  })
12006
9756
  ]
@@ -12029,6 +9779,22 @@ function useCompanionDeletion(selected) {
12029
9779
  })
12030
9780
  };
12031
9781
  }
9782
+ /** The Add companion dialog and what follows an add: the list reloads and the new one is chosen. */
9783
+ function useCompanionAdd() {
9784
+ const [open, setOpen] = (0, import_react.useState)(false);
9785
+ const select = useSelectCompanion();
9786
+ return {
9787
+ ask: () => setOpen(true),
9788
+ dialog: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AddCompanionDialog, {
9789
+ open,
9790
+ onClose: () => setOpen(false),
9791
+ onAdded: (digest) => {
9792
+ setOpen(false);
9793
+ select(digest);
9794
+ }
9795
+ })
9796
+ };
9797
+ }
12032
9798
  function CompanionRow({ companion, selected, onChoose, writable, onDelete, onIntent, roomy = false }) {
12033
9799
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
12034
9800
  className: cn("picker-row grid grid-cols-[minmax(0,1fr)_auto] items-center rounded-control hover:bg-surface-soft", roomy && "rounded-none border-t border-rule-soft first:border-t-0 hover:bg-surface", selected && "bg-accent-soft"),
@@ -12071,11 +9837,12 @@ function CompanionRow({ companion, selected, onChoose, writable, onDelete, onInt
12071
9837
  });
12072
9838
  }
12073
9839
  /** The top bar's brand mark: names the selected companion and switches to another. */
12074
- function CompanionSwitcher({ companions, selected, writable = false }) {
9840
+ function CompanionSwitcher({ companions, selected, writable = false, factoryMode = false }) {
12075
9841
  const [open, setOpen] = (0, import_react.useState)(false);
12076
9842
  const select = useSelectCompanion();
12077
9843
  const prefetch = usePrefetchCompanion();
12078
9844
  const deletion = useCompanionDeletion(selected);
9845
+ const adding = useCompanionAdd();
12079
9846
  if (!selected) return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
12080
9847
  className: "flex items-center gap-2 px-2 py-1.5",
12081
9848
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(BrandMark, {}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("b", {
@@ -12083,70 +9850,88 @@ function CompanionSwitcher({ companions, selected, writable = false }) {
12083
9850
  children: "Mate Studio"
12084
9851
  })]
12085
9852
  });
12086
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Popover, {
12087
- open,
12088
- onOpenChange: setOpen,
12089
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(PopoverTrigger, {
12090
- id: "studio-companion",
12091
- className: "flex max-w-[420px] min-w-[calc(var(--rail-w)-12px)] flex-[0_1_auto] items-center gap-2 rounded-control border border-transparent bg-transparent px-2 py-1.5 text-left text-text hover:border-rule hover:bg-surface data-popup-open:border-rule data-popup-open:bg-surface max-[900px]:w-auto",
12092
- "aria-label": `Companion Repository: ${selected ? companionName(selected.path) : "none selected"}`,
12093
- children: [
12094
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BrandMark, {}),
12095
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("b", {
12096
- className: "min-w-0 truncate text-sm font-semibold rail-min:hidden",
12097
- title: selected?.path,
12098
- children: selected ? companionName(selected.path) : "Mate Studio"
12099
- }),
12100
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, {
12101
- name: "chevron",
12102
- className: "ml-auto text-muted rail-min:hidden"
12103
- })
12104
- ]
12105
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(PopoverContent, {
12106
- "aria-label": "Companion Repositories",
12107
- className: "w-[min(380px,calc(100vw-24px))]",
12108
- children: [
12109
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopoverTitle, { children: "Companion Repositories" }),
12110
- companions.map((companion) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CompanionRow, {
12111
- companion,
12112
- selected: companion.digest === selected?.digest,
12113
- onChoose: () => {
12114
- setOpen(false);
12115
- if (companion.digest !== selected?.digest) select(companion.digest);
12116
- },
12117
- onIntent: companion.digest === selected?.digest ? void 0 : () => prefetch(companion.digest),
12118
- writable,
12119
- onDelete: () => {
12120
- setOpen(false);
12121
- deletion.ask(companion);
12122
- }
12123
- }, companion.digest)),
12124
- companions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
12125
- className: "m-0 px-2.5 py-2 text-sm text-muted",
12126
- children: "No Companion Repository is registered."
12127
- }) : null,
12128
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Separator, { className: "my-1" }),
12129
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
12130
- type: "button",
12131
- className: "flex items-center gap-2.5 rounded-control border-0 bg-transparent px-2.5 py-2 text-left text-sm text-text hover:bg-surface-soft",
12132
- onClick: () => {
12133
- setOpen(false);
12134
- select("");
12135
- },
12136
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, {
12137
- name: "folder",
12138
- className: "text-muted"
12139
- }), "Show all companions"]
12140
- })
12141
- ]
12142
- })]
12143
- }), deletion.dialog] });
9853
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
9854
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Popover, {
9855
+ open,
9856
+ onOpenChange: setOpen,
9857
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(PopoverTrigger, {
9858
+ id: "studio-companion",
9859
+ className: "flex max-w-[420px] min-w-[calc(var(--rail-w)-12px)] flex-[0_1_auto] items-center gap-2 rounded-control border border-transparent bg-transparent px-2 py-1.5 text-left text-text hover:border-rule hover:bg-surface data-popup-open:border-rule data-popup-open:bg-surface max-[900px]:w-auto",
9860
+ "aria-label": `Companion Repository: ${selected ? companionName(selected.path) : "none selected"}`,
9861
+ children: [
9862
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BrandMark, {}),
9863
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("b", {
9864
+ className: "min-w-0 truncate text-sm font-semibold rail-min:hidden",
9865
+ title: selected?.path,
9866
+ children: selected ? companionName(selected.path) : "Mate Studio"
9867
+ }),
9868
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, {
9869
+ name: "chevron",
9870
+ className: "ml-auto text-muted rail-min:hidden"
9871
+ })
9872
+ ]
9873
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(PopoverContent, {
9874
+ "aria-label": "Companion Repositories",
9875
+ className: "w-[min(380px,calc(100vw-24px))]",
9876
+ children: [
9877
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopoverTitle, { children: "Companion Repositories" }),
9878
+ companions.map((companion) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CompanionRow, {
9879
+ companion,
9880
+ selected: companion.digest === selected?.digest,
9881
+ onChoose: () => {
9882
+ setOpen(false);
9883
+ if (companion.digest !== selected?.digest) select(companion.digest);
9884
+ },
9885
+ onIntent: companion.digest === selected?.digest ? void 0 : () => prefetch(companion.digest),
9886
+ writable,
9887
+ onDelete: () => {
9888
+ setOpen(false);
9889
+ deletion.ask(companion);
9890
+ }
9891
+ }, companion.digest)),
9892
+ companions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
9893
+ className: "m-0 px-2.5 py-2 text-sm text-muted",
9894
+ children: "No Companion Repository is registered."
9895
+ }) : null,
9896
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Separator, { className: "my-1" }),
9897
+ factoryMode && writable ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
9898
+ type: "button",
9899
+ className: "flex items-center gap-2.5 rounded-control border-0 bg-transparent px-2.5 py-2 text-left text-sm text-text hover:bg-surface-soft",
9900
+ "data-add-companion": "",
9901
+ onClick: () => {
9902
+ setOpen(false);
9903
+ adding.ask();
9904
+ },
9905
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, {
9906
+ name: "plus",
9907
+ className: "text-muted"
9908
+ }), "Add companion…"]
9909
+ }) : null,
9910
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
9911
+ type: "button",
9912
+ className: "flex items-center gap-2.5 rounded-control border-0 bg-transparent px-2.5 py-2 text-left text-sm text-text hover:bg-surface-soft",
9913
+ onClick: () => {
9914
+ setOpen(false);
9915
+ select("");
9916
+ },
9917
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, {
9918
+ name: "folder",
9919
+ className: "text-muted"
9920
+ }), "Show all companions"]
9921
+ })
9922
+ ]
9923
+ })]
9924
+ }),
9925
+ deletion.dialog,
9926
+ factoryMode && writable ? adding.dialog : null
9927
+ ] });
12144
9928
  }
12145
9929
  /** The page while no companion is selected: every registered companion, and how to add one. */
12146
- function CompanionPicker({ companions, writable = false }) {
9930
+ function CompanionPicker({ companions, writable = false, factoryMode = false }) {
12147
9931
  const select = useSelectCompanion();
12148
9932
  const prefetch = usePrefetchCompanion();
12149
9933
  const deletion = useCompanionDeletion(null);
9934
+ const adding = useCompanionAdd();
12150
9935
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", {
12151
9936
  className: "mx-auto grid w-full max-w-[760px] gap-5 px-8 py-16 max-sm:px-4",
12152
9937
  "aria-label": "Companion Repositories",
@@ -12173,6 +9958,12 @@ function CompanionPicker({ companions, writable = false }) {
12173
9958
  onDelete: () => deletion.ask(companion)
12174
9959
  }, companion.digest))
12175
9960
  }) : null,
9961
+ factoryMode && writable ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, {
9962
+ type: "button",
9963
+ "data-add-companion": "",
9964
+ onClick: adding.ask,
9965
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { name: "plus" }), "Add companion…"]
9966
+ }) }) : null,
12176
9967
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
12177
9968
  className: "m-0 text-sm text-muted",
12178
9969
  children: [
@@ -12186,7 +9977,8 @@ function CompanionPicker({ companions, writable = false }) {
12186
9977
  "in a Working Repository."
12187
9978
  ]
12188
9979
  }),
12189
- deletion.dialog
9980
+ deletion.dialog,
9981
+ factoryMode && writable ? adding.dialog : null
12190
9982
  ]
12191
9983
  });
12192
9984
  }
@@ -12395,6 +10187,48 @@ function situationOf(workset, run) {
12395
10187
  if (reported && !(run && OVERRIDING.has(run.state))) return reported;
12396
10188
  return { text: derivedSituation(workset, run) };
12397
10189
  }
10190
+ /** The Delivery Path as the panel's strip shows it; clarify and explore are one step. */
10191
+ var PATH_STEPS = [
10192
+ "Understand",
10193
+ "Propose change",
10194
+ "Human review",
10195
+ "Apply change",
10196
+ "Merge",
10197
+ "Publish"
10198
+ ];
10199
+ var STEP_OF_STAGE = {
10200
+ "clarify-intent": 0,
10201
+ explore: 0,
10202
+ propose: 1,
10203
+ "human-review": 2,
10204
+ apply: 3,
10205
+ "merge-wait": 4,
10206
+ publish: 5,
10207
+ done: PATH_STEPS.length
10208
+ };
10209
+ /** Where an Outcome is on the strip, and the colour its current step takes. */
10210
+ function pathPositionOf(workset, run) {
10211
+ const activity = activityOf(workset, run);
10212
+ const current = activity === "later" ? -1 : STEP_OF_STAGE[workset.stage];
10213
+ switch (activity) {
10214
+ case "control": return {
10215
+ current,
10216
+ tone: "why"
10217
+ };
10218
+ case "stopped": return {
10219
+ current,
10220
+ tone: "bad"
10221
+ };
10222
+ case "needs-you": return {
10223
+ current,
10224
+ tone: attentionKind(workset, run) === "review" ? "why" : "warn"
10225
+ };
10226
+ default: return {
10227
+ current,
10228
+ tone: "accent"
10229
+ };
10230
+ }
10231
+ }
12398
10232
  var ACTIVITY_LABELS = {
12399
10233
  running: "Running",
12400
10234
  queued: "Queued",
@@ -12417,18 +10251,6 @@ function activityOf(workset, run) {
12417
10251
  run
12418
10252
  }) ? "idle" : "later";
12419
10253
  }
12420
- /** The Delivery Path map node each stage sits at; `complete` once delivered. */
12421
- var PATH_NODES = {
12422
- "clarify-intent": "clarify-intent",
12423
- explore: "explore",
12424
- propose: "propose",
12425
- "human-review": "reviews",
12426
- apply: "apply",
12427
- "merge-wait": "archive",
12428
- publish: "publish",
12429
- done: "complete"
12430
- };
12431
- var pathNodeOf = (workset) => PATH_NODES[workset.stage];
12432
10254
  // src/shell/sidebar.tsx
12433
10255
  var MODE_ICONS = {
12434
10256
  engineering: "code",
@@ -12460,21 +10282,32 @@ function Sidebar({ shell, search, view }) {
12460
10282
  className: "studio-nav flex min-h-0 flex-col gap-px overflow-x-hidden overflow-y-auto border-r border-rule bg-page px-2 pt-2 pb-2.5 max-[900px]:border-r-0 max-[900px]:flex-row max-[900px]:flex-wrap max-[900px]:items-center max-[900px]:gap-1 max-[900px]:border-b max-[900px]:border-rule",
12461
10283
  id: "studio-rail",
12462
10284
  "aria-label": "Studio views",
12463
- children: [shell.selected ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(NavGroup, {
12464
- label: MODE_TITLES[mode],
12465
- views: modeViews(mode, shell.factoryMode),
12466
- search,
12467
- current: view,
12468
- counts,
12469
- collapsed
12470
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NavGroup, {
12471
- label: mode === "analysis" ? "Published" : "Library",
12472
- views: libraryViews(),
12473
- search,
12474
- current: view,
12475
- counts,
12476
- collapsed
12477
- })] }) : null, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
10285
+ children: [shell.selected ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
10286
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NavGroup, {
10287
+ label: MODE_TITLES[mode],
10288
+ views: modeViews(mode, shell.factoryMode),
10289
+ search,
10290
+ current: view,
10291
+ counts,
10292
+ collapsed
10293
+ }),
10294
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NavGroup, {
10295
+ label: mode === "analysis" ? "Published" : "Library",
10296
+ views: libraryViews(),
10297
+ search,
10298
+ current: view,
10299
+ counts,
10300
+ collapsed
10301
+ }),
10302
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NavGroup, {
10303
+ label: "Insights",
10304
+ views: insightViews(),
10305
+ search,
10306
+ current: view,
10307
+ counts,
10308
+ collapsed
10309
+ })
10310
+ ] }) : null, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
12478
10311
  className: "sidebar-footer mt-auto grid gap-1 border-t border-rule-soft pt-2 max-[900px]:mt-0 max-[900px]:ml-auto max-[900px]:flex max-[900px]:border-0 max-[900px]:pt-0",
12479
10312
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ModeSwitch, {
12480
10313
  shell,
@@ -12510,7 +10343,7 @@ function Sidebar({ shell, search, view }) {
12510
10343
  function NavGroup(props) {
12511
10344
  if (props.views.length === 0) return null;
12512
10345
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
12513
- className: "grid gap-px max-[900px]:flex max-[900px]:items-center",
10346
+ className: "grid gap-px max-[900px]:flex max-[900px]:min-w-0 max-[900px]:max-w-full max-[900px]:flex-wrap max-[900px]:items-center",
12514
10347
  role: "group",
12515
10348
  "aria-label": props.label,
12516
10349
  "data-studio-nav-section": props.label,
@@ -12535,6 +10368,7 @@ function NavLink({ view, search, current, count, collapsed }) {
12535
10368
  disabled: !collapsed,
12536
10369
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Link, {
12537
10370
  to: VIEW_PATHS[view],
10371
+ preload: view === "usage" ? false : void 0,
12538
10372
  search,
12539
10373
  className: cn("sidebar-nav-link relative flex h-8 items-center gap-2.5 rounded-[6px] px-2.5 text-sm whitespace-nowrap text-[color-mix(in_srgb,var(--text)_82%,var(--muted))] no-underline hover:bg-surface hover:text-text rail-min:justify-center rail-min:px-0", current && "bg-surface font-semibold text-text ring-1 ring-rule ring-inset"),
12540
10374
  "aria-current": current ? "page" : void 0,
@@ -12660,7 +10494,8 @@ function TopBar({ shell, search }) {
12660
10494
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CompanionSwitcher, {
12661
10495
  companions: shell.companions,
12662
10496
  selected: shell.selected,
12663
- writable: shell.writable
10497
+ writable: shell.writable,
10498
+ factoryMode: shell.factoryMode
12664
10499
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
12665
10500
  className: "ml-auto flex min-w-0 flex-[0_1_auto] items-center justify-end gap-1.5",
12666
10501
  children: [
@@ -13450,7 +11285,8 @@ function StudioLayout({ search }) {
13450
11285
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Outlet, {})
13451
11286
  })] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CompanionPicker, {
13452
11287
  companions: shell.companions,
13453
- writable: shell.writable
11288
+ writable: shell.writable,
11289
+ factoryMode: shell.factoryMode
13454
11290
  })
13455
11291
  }),
13456
11292
  shell.terminal ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TerminalSidebar, { terminal: shell.terminal }) : null
@@ -13493,17 +11329,20 @@ function Toasts({ search }) {
13493
11329
  }
13494
11330
  // src/routes/__root.tsx
13495
11331
  var FAVICON_URI = `data:image/svg+xml;base64,${btoa(BRAND_SVGS.favicon)}`;
13496
- var Route$7 = createRootRouteWithContext()({
11332
+ var Route$12 = createRootRouteWithContext()({
13497
11333
  validateSearch: validateStudioSearch,
13498
11334
  loaderDeps: ({ search }) => search,
13499
11335
  ssr: true,
13500
11336
  beforeLoad: async ({ context, search, location }) => {
13501
11337
  const shell = await loadHeld(context.queryClient, shellQuery(search));
13502
11338
  const href = canonicalHref(location.pathname, location.searchStr, viewAt(location.pathname), shell.studioMode);
13503
- if (href) throw redirect({
13504
- href,
13505
- replace: true
13506
- });
11339
+ if (href) {
11340
+ const hash = viewAt(location.pathname) === "getting-started" && location.hash ? `#${location.hash.replace(/^#/, "")}` : "";
11341
+ throw redirect({
11342
+ href: `${href}${hash}`,
11343
+ replace: true
11344
+ });
11345
+ }
13507
11346
  },
13508
11347
  loader: ({ context, deps }) => loadHeld(context.queryClient, shellQuery(deps)),
13509
11348
  pendingMs: Infinity,
@@ -13531,7 +11370,11 @@ var Route$7 = createRootRouteWithContext()({
13531
11370
  component: RootLayout
13532
11371
  });
13533
11372
  function RootLayout() {
13534
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StudioLayout, { search: Route$7.useSearch() });
11373
+ const { companion, studioMode } = Route$12.useSearch();
11374
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StudioLayout, { search: {
11375
+ companion,
11376
+ studioMode
11377
+ } });
13535
11378
  }
13536
11379
  function RootDocument({ children }) {
13537
11380
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("html", {
@@ -13540,8 +11383,8 @@ function RootDocument({ children }) {
13540
11383
  });
13541
11384
  }
13542
11385
  // src/routes/index.tsx
13543
- var $$splitComponentImporter$6 = () => import("./routes-BcFgvqf7.js");
13544
- var Route$6 = createFileRoute("/")({
11386
+ var $$splitComponentImporter$11 = () => import("./routes-B6GfOew4.js");
11387
+ var Route$11 = createFileRoute("/")({
13545
11388
  staticData: { view: "dashboard" },
13546
11389
  validateSearch: (raw) => typeof raw.change === "string" && raw.change !== "" ? { change: raw.change } : {},
13547
11390
  loaderDeps: ({ search }) => ({
@@ -13550,12 +11393,12 @@ var Route$6 = createFileRoute("/")({
13550
11393
  }),
13551
11394
  ssr: true,
13552
11395
  loader: async ({ context, deps }) => await registeredCompanion(context.queryClient, deps) ? loadView(context.queryClient, companionViewQuery("dashboard", deps)) : null,
13553
- component: lazyRouteComponent($$splitComponentImporter$6, "component")
11396
+ component: lazyRouteComponent($$splitComponentImporter$11, "component")
13554
11397
  });
13555
11398
  /** Each mode reads its own Overview; the server's effective mode picks it, not the address. */
13556
11399
  // src/routes/factory.tsx
13557
- var $$splitComponentImporter$5 = () => import("./factory-DUTa0eDs.js");
13558
- var Route$5 = createFileRoute("/factory")({
11400
+ var $$splitComponentImporter$10 = () => import("./factory-C7Ybg0xG.js");
11401
+ var Route$10 = createFileRoute("/factory")({
13559
11402
  staticData: { view: "factory" },
13560
11403
  validateSearch: (raw) => typeof raw.outcome === "string" && /^[a-z0-9][a-z0-9-]*$/.test(raw.outcome) ? { outcome: raw.outcome } : {},
13561
11404
  beforeLoad: async ({ context, search }) => {
@@ -13576,11 +11419,27 @@ var Route$5 = createFileRoute("/factory")({
13576
11419
  const companion = await registeredCompanion(context.queryClient, deps);
13577
11420
  return companion ? loadView(context.queryClient, factoryQuery(companion)) : null;
13578
11421
  },
13579
- component: lazyRouteComponent($$splitComponentImporter$5, "component")
11422
+ component: lazyRouteComponent($$splitComponentImporter$10, "component")
11423
+ });
11424
+ // src/routes/getting-started.tsx
11425
+ var $$splitComponentImporter$9 = () => import("./getting-started-B136TP57.js");
11426
+ var Route$9 = createFileRoute("/getting-started")({
11427
+ ssr: true,
11428
+ staticData: { view: "getting-started" },
11429
+ component: lazyRouteComponent($$splitComponentImporter$9, "component")
11430
+ });
11431
+ // src/routes/graph.tsx
11432
+ var $$splitComponentImporter$8 = () => import("./graph-CSje3029.js").then((n) => n.t);
11433
+ var text$1 = (value) => typeof value === "string" && value.length > 0 && value.length <= 1024 ? value : void 0;
11434
+ var Route$8 = createFileRoute("/graph")({
11435
+ validateSearch: (raw) => text$1(raw.node) ? { node: text$1(raw.node) } : {},
11436
+ staticData: { view: "graph" },
11437
+ ssr: false,
11438
+ component: lazyRouteComponent($$splitComponentImporter$8, "component")
13580
11439
  });
13581
11440
  // src/routes/reports.tsx
13582
- var $$splitComponentImporter$4 = () => import("./reports-D6YMqhnO.js");
13583
- var Route$4 = createFileRoute("/reports")({
11441
+ var $$splitComponentImporter$7 = () => import("./reports-CQ9qQ1-n.js");
11442
+ var Route$7 = createFileRoute("/reports")({
13584
11443
  staticData: { view: "reports" },
13585
11444
  loaderDeps: ({ search }) => ({
13586
11445
  companion: search.companion,
@@ -13590,11 +11449,11 @@ var Route$4 = createFileRoute("/reports")({
13590
11449
  const companion = await registeredCompanion(context.queryClient, deps);
13591
11450
  return companion ? loadView(context.queryClient, reportsQuery(companion)) : null;
13592
11451
  },
13593
- component: lazyRouteComponent($$splitComponentImporter$4, "component")
11452
+ component: lazyRouteComponent($$splitComponentImporter$7, "component")
13594
11453
  });
13595
11454
  // src/routes/skills.tsx
13596
- var $$splitComponentImporter$3 = () => import("./skills-BEnOxiDl.js");
13597
- var Route$3 = createFileRoute("/skills")({
11455
+ var $$splitComponentImporter$6 = () => import("./skills-B7nEuVbx.js");
11456
+ var Route$6 = createFileRoute("/skills")({
13598
11457
  staticData: { view: "skills" },
13599
11458
  loaderDeps: ({ search }) => ({
13600
11459
  companion: search.companion,
@@ -13602,24 +11461,36 @@ var Route$3 = createFileRoute("/skills")({
13602
11461
  }),
13603
11462
  ssr: true,
13604
11463
  loader: async ({ context, deps }) => await registeredCompanion(context.queryClient, deps) ? loadView(context.queryClient, companionViewQuery("skills", deps)) : null,
13605
- component: lazyRouteComponent($$splitComponentImporter$3, "component")
11464
+ component: lazyRouteComponent($$splitComponentImporter$6, "component")
13606
11465
  });
13607
11466
  // src/routes/specs.tsx
13608
- var $$splitComponentImporter$2 = () => import("./specs-C8rv34-5.js");
13609
- var Route$2 = createFileRoute("/specs")({
11467
+ var $$splitComponentImporter$5 = () => import("./specs-BpLUFntA.js");
11468
+ var Route$5 = createFileRoute("/specs")({
13610
11469
  staticData: { view: "specs" },
11470
+ validateSearch: validateSpecsSearch,
13611
11471
  loaderDeps: ({ search }) => ({
13612
11472
  companion: search.companion,
13613
11473
  studioMode: search.studioMode
13614
11474
  }),
13615
11475
  ssr: true,
13616
11476
  loader: async ({ context, deps }) => await registeredCompanion(context.queryClient, deps) ? loadView(context.queryClient, companionViewQuery("specs", deps)) : null,
13617
- component: lazyRouteComponent($$splitComponentImporter$2, "component")
11477
+ component: lazyRouteComponent($$splitComponentImporter$5, "component")
11478
+ });
11479
+ // src/routes/usage.tsx
11480
+ var $$splitComponentImporter$4 = () => import("./usage-COdjd1gD.js");
11481
+ var Route$4 = createFileRoute("/usage")({
11482
+ staticData: { view: "usage" },
11483
+ loaderDeps: ({ search }) => ({
11484
+ companion: search.companion,
11485
+ studioMode: search.studioMode
11486
+ }),
11487
+ loader: ({ context, deps }) => registeredCompanion(context.queryClient, deps),
11488
+ component: lazyRouteComponent($$splitComponentImporter$4, "component")
13618
11489
  });
13619
11490
  // src/routes/vault.tsx
13620
- var $$splitComponentImporter$1 = () => import("./vault-Fvxt2Tzl.js");
11491
+ var $$splitComponentImporter$3 = () => import("./vault-BDuIUq0F.js");
13621
11492
  var text = (value) => typeof value === "string" && value ? value : void 0;
13622
- var Route$1 = createFileRoute("/vault")({
11493
+ var Route$3 = createFileRoute("/vault")({
13623
11494
  staticData: { view: "vault" },
13624
11495
  validateSearch: (raw) => ({
13625
11496
  ...text(raw.path) ? { path: text(raw.path) } : {},
@@ -13636,11 +11507,11 @@ var Route$1 = createFileRoute("/vault")({
13636
11507
  const companion = await registeredCompanion(context.queryClient, deps);
13637
11508
  return companion ? loadView(context.queryClient, vaultQuery(companion, deps)) : null;
13638
11509
  },
13639
- component: lazyRouteComponent($$splitComponentImporter$1, "component")
11510
+ component: lazyRouteComponent($$splitComponentImporter$3, "component")
13640
11511
  });
13641
11512
  // src/routes/workflow.tsx
13642
- var $$splitComponentImporter = () => import("./workflow-liRYecHk.js");
13643
- var Route = createFileRoute("/workflow")({
11513
+ var $$splitComponentImporter$2 = () => import("./workflow-D9GKI2EV.js");
11514
+ var Route$2 = createFileRoute("/workflow")({
13644
11515
  staticData: { view: "workflow" },
13645
11516
  loaderDeps: ({ search }) => ({
13646
11517
  companion: search.companion,
@@ -13648,47 +11519,101 @@ var Route = createFileRoute("/workflow")({
13648
11519
  }),
13649
11520
  ssr: true,
13650
11521
  loader: async ({ context, deps }) => await registeredCompanion(context.queryClient, deps) ? loadView(context.queryClient, companionViewQuery("workflow", deps)) : null,
11522
+ component: lazyRouteComponent($$splitComponentImporter$2, "component")
11523
+ });
11524
+ // src/routes/getting-started.index.tsx
11525
+ var $$splitComponentImporter$1 = () => import("./getting-started.index-D84gec1t.js");
11526
+ var Route$1 = createFileRoute("/getting-started/")({
11527
+ loaderDeps: ({ search }) => search,
11528
+ ssr: true,
11529
+ loader: async ({ context, deps }) => await registeredCompanion(context.queryClient, deps) ? getGuide({ data: { topic: "start" } }) : null,
11530
+ component: lazyRouteComponent($$splitComponentImporter$1, "component")
11531
+ });
11532
+ // src/routes/getting-started.$topic.tsx
11533
+ var $$splitComponentImporter = () => import("./getting-started._topic-DJKQAzYl.js");
11534
+ var Route = createFileRoute("/getting-started/$topic")({
11535
+ loaderDeps: ({ search }) => search,
11536
+ ssr: true,
11537
+ loader: async ({ context, deps, params }) => await registeredCompanion(context.queryClient, deps) ? getGuide({ data: { topic: params.topic } }) : null,
13651
11538
  component: lazyRouteComponent($$splitComponentImporter, "component")
13652
11539
  });
13653
11540
  // src/route-tree.gen.ts
13654
- var rootRouteChildren = {
13655
- IndexRoute: Route$6.update({
13656
- id: "/",
13657
- path: "/",
13658
- getParentRoute: () => Route$7
13659
- }),
13660
- FactoryRoute: Route$5.update({
13661
- id: "/factory",
13662
- path: "/factory",
13663
- getParentRoute: () => Route$7
13664
- }),
13665
- ReportsRoute: Route$4.update({
13666
- id: "/reports",
13667
- path: "/reports",
13668
- getParentRoute: () => Route$7
13669
- }),
13670
- SkillsRoute: Route$3.update({
13671
- id: "/skills",
13672
- path: "/skills",
13673
- getParentRoute: () => Route$7
13674
- }),
13675
- SpecsRoute: Route$2.update({
13676
- id: "/specs",
13677
- path: "/specs",
13678
- getParentRoute: () => Route$7
13679
- }),
13680
- VaultRoute: Route$1.update({
13681
- id: "/vault",
13682
- path: "/vault",
13683
- getParentRoute: () => Route$7
11541
+ var IndexRoute = Route$11.update({
11542
+ id: "/",
11543
+ path: "/",
11544
+ getParentRoute: () => Route$12
11545
+ });
11546
+ var FactoryRoute = Route$10.update({
11547
+ id: "/factory",
11548
+ path: "/factory",
11549
+ getParentRoute: () => Route$12
11550
+ });
11551
+ var GettingStartedRoute = Route$9.update({
11552
+ id: "/getting-started",
11553
+ path: "/getting-started",
11554
+ getParentRoute: () => Route$12
11555
+ });
11556
+ var GraphRoute = Route$8.update({
11557
+ id: "/graph",
11558
+ path: "/graph",
11559
+ getParentRoute: () => Route$12
11560
+ });
11561
+ var ReportsRoute = Route$7.update({
11562
+ id: "/reports",
11563
+ path: "/reports",
11564
+ getParentRoute: () => Route$12
11565
+ });
11566
+ var SkillsRoute = Route$6.update({
11567
+ id: "/skills",
11568
+ path: "/skills",
11569
+ getParentRoute: () => Route$12
11570
+ });
11571
+ var SpecsRoute = Route$5.update({
11572
+ id: "/specs",
11573
+ path: "/specs",
11574
+ getParentRoute: () => Route$12
11575
+ });
11576
+ var UsageRoute = Route$4.update({
11577
+ id: "/usage",
11578
+ path: "/usage",
11579
+ getParentRoute: () => Route$12
11580
+ });
11581
+ var VaultRoute = Route$3.update({
11582
+ id: "/vault",
11583
+ path: "/vault",
11584
+ getParentRoute: () => Route$12
11585
+ });
11586
+ var WorkflowRoute = Route$2.update({
11587
+ id: "/workflow",
11588
+ path: "/workflow",
11589
+ getParentRoute: () => Route$12
11590
+ });
11591
+ var GettingStartedIndexRoute = Route$1.update({
11592
+ id: "/",
11593
+ path: "/",
11594
+ getParentRoute: () => GettingStartedRoute
11595
+ });
11596
+ var GettingStartedRouteChildren = {
11597
+ GettingStartedTopicRoute: Route.update({
11598
+ id: "/$topic",
11599
+ path: "/$topic",
11600
+ getParentRoute: () => GettingStartedRoute
13684
11601
  }),
13685
- WorkflowRoute: Route.update({
13686
- id: "/workflow",
13687
- path: "/workflow",
13688
- getParentRoute: () => Route$7
13689
- })
11602
+ GettingStartedIndexRoute
11603
+ };
11604
+ var rootRouteChildren = {
11605
+ IndexRoute,
11606
+ FactoryRoute,
11607
+ GettingStartedRoute: GettingStartedRoute._addFileChildren(GettingStartedRouteChildren),
11608
+ GraphRoute,
11609
+ ReportsRoute,
11610
+ SkillsRoute,
11611
+ SpecsRoute,
11612
+ UsageRoute,
11613
+ VaultRoute,
11614
+ WorkflowRoute
13690
11615
  };
13691
- var routeTree = Route$7._addFileChildren(rootRouteChildren)._addFileTypes();
11616
+ var routeTree = Route$12._addFileChildren(rootRouteChildren)._addFileTypes();
13692
11617
  // src/router.tsx
13693
11618
  var router_exports = /* @__PURE__ */ __exportAll({ getRouter: () => getRouter });
13694
11619
  /** One router and query client per request on the server, one per page in the browser. */
@@ -13710,4 +11635,4 @@ function getRouter() {
13710
11635
  });
13711
11636
  return router;
13712
11637
  }
13713
- export { DialogTitle$1 as A, useMutation as B, CHANGE_GROUPS as C, groupChanges as D, changeStep as E, DialogBackdrop as F, useAppearance as I, useVaultUi as L, DialogPortal as M, DialogPopup as N, inField as O, DialogClose$1 as P, usePageUi as R, useMediaQuery as S, changeGroup as T, useSuspenseQuery as V, nextStepOf as _, Route$3 as a, useBrowser as b, Route$6 as c, parseMessage as d, sendMessage as f, milestonesOf as g, getRouter, factoryHome as h, Route$2 as i, DialogRoot as j, Kbd as k, loadWTerm as l, activityOf as m, Route as n, Route$4 as o, ACTIVITY_LABELS as p, Route$1 as r, Route$5 as s, router_exports as t, openTerminalSocket as u, pathNodeOf as v, GROUP_TITLES as w, ViewPlaceholder as x, situationOf as y, Tooltip as z };
11638
+ export { ComboboxItem as $, gitTokensQuery as A, inField as B, pathPositionOf as C, GitTokenForm as D, ViewPlaceholder as E, GROUP_TITLES as F, DialogTitle as G, DialogClose as H, changeGroup as I, DialogPortal as J, DialogTitle$1 as K, changeProgress as L, tokenCovers as M, useMediaQuery as N, clearGitToken as O, CHANGE_GROUPS as P, ComboboxEmpty as Q, changeStep as R, nextStepOf as S, useSuspenseQuery as St, useBrowser as T, DialogContent as U, Dialog as V, DialogDescription as W, DialogClose$1 as X, DialogPopup as Y, DialogBackdrop as Z, ACTIVITY_LABELS as _, Tooltip as _t, Route$3 as a, useComboboxPositionerContext as at, factoryHome as b, useAnchorPositioning as bt, Route$6 as c, triggerStateAttributesMapping as ct, Route$10 as d, useComboboxFloatingContext as dt, useComboboxItemContext as et, Route$11 as f, useComboboxInputValueContext as ft, sendMessage as g, getRouter, usePageUi as gt, parseMessage as h, useVaultUi as ht, Route$2 as i, ComboboxPositionerContext as it, hostOf as j, gitTokensKey as k, Route$7 as l, AriaCombobox as lt, openTerminalSocket as m, useAppearance as mt, Route as n, ComboboxInput as nt, Route$4 as o, useListEmpty as ot, loadWTerm as p, useComboboxRootContext as pt, DialogRoot as q, Route$1 as r, ComboboxInternalDismissButton as rt, Route$5 as s, usePopupSide as st, router_exports as t, ComboboxList as tt, Route$8 as u, getComboboxPopupId as ut, PATH_STEPS as v, usePositioner as vt, situationOf as w, milestonesOf as x, platform as xt, activityOf as y, getDisabledMountTransitionStyles as yt, groupChanges as z };