@uniqbit/mate-core 1.0.0-canary.3 → 1.0.0-canary.6

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 (483) 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 +61 -1
  4. package/claude-plugin/hooks/rtk-worktree-git.mjs +58 -0
  5. package/claude-plugin/hooks/session-attention.mjs +10 -0
  6. package/claude-plugin/hooks/session-end.mjs +9 -0
  7. package/claude-plugin/hooks/session-guidance.mjs +1 -1
  8. package/claude-plugin/hooks/workflow-turn.mjs +68 -0
  9. package/opencode-plugin/src/companion.ts +6 -0
  10. package/opencode-plugin/src/server.ts +46 -4
  11. package/package.json +5 -2
  12. package/src/cli/commands/artifact/apply-context.ts +1 -0
  13. package/src/cli/commands/artifact/artifact.ts +16 -0
  14. package/src/cli/commands/artifact/delivery/archive.ts +37 -112
  15. package/src/cli/commands/artifact/delivery/branch-flags.ts +19 -1
  16. package/src/cli/commands/artifact/delivery/environment.ts +32 -72
  17. package/src/cli/commands/artifact/delivery/link.ts +69 -33
  18. package/src/cli/commands/artifact/delivery/output.ts +34 -5
  19. package/src/cli/commands/artifact/delivery/resolve.ts +101 -0
  20. package/src/cli/commands/artifact/delivery/submit.ts +164 -0
  21. package/src/cli/commands/artifact/delivery/take.ts +45 -0
  22. package/src/cli/commands/artifact/extract-repo-name.ts +1 -1
  23. package/src/cli/commands/artifact/finish/command.ts +455 -43
  24. package/src/cli/commands/artifact/finish/engine.ts +79 -61
  25. package/src/cli/commands/artifact/finish/finisher.ts +5 -12
  26. package/src/cli/commands/artifact/finish/git.ts +9 -10
  27. package/src/cli/commands/artifact/finish/openspec.ts +22 -177
  28. package/src/cli/commands/artifact/finish/secret-scan.ts +5 -43
  29. package/src/cli/commands/artifact/finish/worktree-cleanup.ts +57 -7
  30. package/src/cli/commands/artifact/pending/command.ts +119 -6
  31. package/src/cli/commands/artifact/pending/discovery.ts +7 -11
  32. package/src/cli/commands/artifact/project/command.ts +60 -0
  33. package/src/cli/commands/companion/companion.ts +1 -1
  34. package/src/cli/commands/companion/link.ts +36 -4
  35. package/src/cli/commands/companion/list.ts +70 -14
  36. package/src/cli/commands/companion/open.ts +40 -12
  37. package/src/cli/commands/companion/sync.ts +18 -0
  38. package/src/cli/commands/companion/update.ts +4 -19
  39. package/src/cli/commands/doctor.ts +122 -0
  40. package/src/cli/commands/install.ts +48 -36
  41. package/src/cli/commands/launch/claude.ts +2 -0
  42. package/src/cli/commands/launch/shared.ts +33 -6
  43. package/src/cli/commands/plugin/install.ts +27 -11
  44. package/src/cli/commands/report/index.ts +180 -184
  45. package/src/cli/commands/report/markdown.ts +67 -72
  46. package/src/cli/commands/session/prepare.ts +32 -4
  47. package/src/cli/commands/session/registry.ts +90 -0
  48. package/src/cli/commands/shared/companion-selection.ts +3 -1
  49. package/src/cli/commands/studio/access.ts +6 -14
  50. package/src/cli/commands/studio/areas.ts +112 -33
  51. package/src/cli/commands/studio/companion-add.ts +72 -0
  52. package/src/cli/commands/studio/companion-removal.ts +86 -0
  53. package/src/cli/commands/studio/graph-model.ts +61 -0
  54. package/src/cli/commands/studio/graph.ts +336 -0
  55. package/src/cli/commands/studio/index.ts +4 -4
  56. package/src/{lib/factory/outcomes/sessions.ts → cli/commands/studio/live-sessions.ts} +26 -2
  57. package/src/cli/commands/studio/mate-inventory.ts +1 -1
  58. package/src/cli/commands/studio/payload.ts +223 -30
  59. package/src/cli/commands/studio/reports.ts +19 -18
  60. package/src/cli/commands/studio/routes.ts +5 -18
  61. package/src/cli/commands/studio/selection.ts +12 -5
  62. package/src/cli/commands/studio/server.ts +321 -198
  63. package/src/cli/commands/studio/service-host.ts +266 -0
  64. package/src/cli/commands/studio/services.ts +54 -16
  65. package/src/cli/commands/studio/skill-files.ts +133 -0
  66. package/src/cli/commands/studio/studio-app.ts +1 -0
  67. package/src/cli/commands/studio/terminal.ts +45 -3
  68. package/src/cli/commands/studio/vault.ts +259 -84
  69. package/src/cli/commands/studio/views/model.ts +1 -14
  70. package/src/cli/commands/studio/views/vault/markdown-tree.ts +343 -10
  71. package/src/cli/commands/unwrap.ts +11 -0
  72. package/src/cli/commands/update.ts +28 -8
  73. package/src/cli/commands/vscode/release-vsix.json +4 -0
  74. package/src/cli/commands/vscode/setup.ts +213 -0
  75. package/src/cli/commands/vscode/vsix.ts +114 -0
  76. package/src/cli/commands/workflow/workflow.ts +516 -0
  77. package/src/cli/commands/working/cleanup.ts +73 -17
  78. package/src/cli/commands/working/worktree.ts +227 -36
  79. package/src/cli/commands/wrap.ts +33 -7
  80. package/src/cli/main.ts +48 -12
  81. package/src/cli/repo-list-table.tsx +73 -37
  82. package/src/cli/usage.ts +25 -9
  83. package/src/factory-host.ts +69 -0
  84. package/src/hooks/companion-instructions.ts +35 -16
  85. package/src/hooks/hook-io.ts +18 -1
  86. package/src/hooks/rtk-worktree-git.ts +48 -0
  87. package/src/hooks/session-banner.ts +30 -3
  88. package/src/hooks/session-end.ts +10 -0
  89. package/src/hooks/session-guidance.ts +10 -6
  90. package/src/hooks/session-prepare.ts +47 -31
  91. package/src/hooks/session-register.ts +199 -0
  92. package/src/hooks/tokensave-route.ts +7 -3
  93. package/src/hooks/validate-artifact-path.ts +53 -14
  94. package/src/hooks/workflow-turn.ts +219 -0
  95. package/src/lib/apply-context/fingerprint.ts +2 -1
  96. package/src/lib/apply-context/protocol.ts +2 -2
  97. package/src/lib/artifact-trailer.ts +27 -0
  98. package/src/lib/change-layout.ts +83 -38
  99. package/src/lib/delivery/branch-template.ts +114 -0
  100. package/src/lib/delivery/branches.ts +34 -14
  101. package/src/lib/delivery/checkout.ts +103 -0
  102. package/src/lib/delivery/environment.ts +131 -7
  103. package/src/lib/delivery/merge-git.ts +282 -26
  104. package/src/lib/delivery/overlap.ts +68 -16
  105. package/src/lib/delivery/record-delivery.ts +253 -57
  106. package/src/lib/delivery/record.ts +229 -53
  107. package/src/lib/delivery/refresh.ts +222 -141
  108. package/src/lib/delivery/remote.ts +66 -0
  109. package/src/lib/delivery/repository-access.ts +19 -60
  110. package/src/lib/delivery/resolve-branch.ts +318 -50
  111. package/src/lib/delivery/stages.ts +83 -50
  112. package/src/lib/delivery/staging/apply-chain.ts +164 -0
  113. package/src/lib/delivery/staging/artifact-type.ts +101 -0
  114. package/src/lib/delivery/staging/declared-type.ts +277 -0
  115. package/src/lib/delivery/staging/naming.ts +64 -0
  116. package/src/lib/delivery/staging/openspec-type.ts +135 -0
  117. package/src/lib/delivery/staging/pending-edit.ts +291 -0
  118. package/src/lib/delivery/staging/pending.ts +780 -0
  119. package/src/lib/delivery/staging/project.ts +373 -0
  120. package/src/lib/delivery/staging/publish.ts +1024 -0
  121. package/src/lib/delivery/staging/refs.ts +258 -0
  122. package/src/lib/delivery/staging/registry.ts +73 -0
  123. package/src/lib/delivery/staging/replay.ts +308 -0
  124. package/src/lib/delivery/staging/requirement-blocks.ts +10 -0
  125. package/src/lib/delivery/staging/resolve.ts +264 -0
  126. package/src/lib/delivery/staging/settle-linked.ts +290 -0
  127. package/src/lib/delivery/staging/submit.ts +929 -0
  128. package/src/lib/delivery/staging/worktree.ts +130 -0
  129. package/src/lib/delivery/submit-change.ts +443 -0
  130. package/src/lib/git-key.ts +15 -0
  131. package/src/lib/install.ts +2 -0
  132. package/src/lib/opencode-server.ts +238 -0
  133. package/src/lib/openspec-canonical-frontmatter.ts +159 -0
  134. package/src/lib/orchestrator/adapters/base.ts +31 -20
  135. package/src/lib/orchestrator/adapters/claude.ts +162 -4
  136. package/src/lib/orchestrator/adapters/opencode.ts +55 -2
  137. package/src/lib/orchestrator/checkout-adoption.ts +125 -0
  138. package/src/lib/orchestrator/companion-git-sync.ts +152 -16
  139. package/src/lib/orchestrator/companion-hub.ts +6 -1
  140. package/src/lib/orchestrator/companion-registry-store.ts +6 -2
  141. package/src/lib/orchestrator/editor.ts +2 -2
  142. package/src/lib/orchestrator/engine-floor.ts +48 -0
  143. package/src/lib/orchestrator/framework-context.ts +41 -15
  144. package/src/lib/orchestrator/global-config-store.ts +11 -0
  145. package/src/lib/orchestrator/launcher.ts +49 -3
  146. package/src/lib/orchestrator/projection-claude-commands.ts +2 -2
  147. package/src/lib/orchestrator/projection-claude-entry.ts +42 -21
  148. package/src/lib/orchestrator/projection-claude-links.ts +83 -11
  149. package/src/lib/orchestrator/projection-claude-skills.ts +30 -4
  150. package/src/lib/orchestrator/projection-companion-link.ts +12 -1
  151. package/src/lib/orchestrator/projection-entries.ts +22 -18
  152. package/src/lib/orchestrator/projection-opencode-copies.ts +65 -21
  153. package/src/lib/orchestrator/projection-runtime-documents.ts +66 -43
  154. package/src/lib/orchestrator/projection-types.ts +28 -1
  155. package/src/lib/orchestrator/refresh-working-claude-links.ts +4 -1
  156. package/src/lib/orchestrator/registry-checkouts.ts +177 -0
  157. package/src/lib/orchestrator/repository-link.ts +216 -57
  158. package/src/lib/orchestrator/serving-claude-wrap.ts +43 -0
  159. package/src/lib/orchestrator/session-context-link.ts +11 -5
  160. package/src/lib/orchestrator/session-prepare.ts +53 -8
  161. package/src/lib/orchestrator/setup-compatibilities.ts +1 -1
  162. package/src/lib/orchestrator/types.ts +9 -0
  163. package/src/lib/orchestrator/umbrella-checkouts.ts +102 -0
  164. package/src/lib/orchestrator/working-repo-projection.ts +24 -4
  165. package/src/lib/orchestrator/workspace-inventory.ts +5 -1
  166. package/src/lib/orchestrator/wrap-pass.ts +1 -0
  167. package/src/lib/prebuilt-workspace-prepare.ts +2 -1
  168. package/src/lib/prebuilt-workspace.ts +1 -0
  169. package/src/lib/public-npm.ts +105 -43
  170. package/src/lib/session-attribution.ts +52 -0
  171. package/src/lib/session-state.ts +356 -0
  172. package/src/lib/session-stop.ts +64 -0
  173. package/src/lib/update-checker.ts +7 -1
  174. package/src/lib/usage/aggregate.ts +202 -0
  175. package/src/lib/usage/cache.ts +87 -0
  176. package/src/lib/usage/claude-pricing.ts +71 -0
  177. package/src/lib/usage/claude.ts +189 -0
  178. package/src/lib/usage/collect.ts +56 -0
  179. package/src/lib/usage/opencode.ts +188 -0
  180. package/src/lib/usage/records.ts +80 -0
  181. package/src/lib/usage/rtk-database.ts +72 -0
  182. package/src/lib/usage/savings.ts +209 -0
  183. package/src/lib/usage/scope.ts +182 -0
  184. package/src/lib/usage/source.ts +102 -0
  185. package/src/lib/usage/types.ts +143 -0
  186. package/src/lib/usage/window.ts +37 -0
  187. package/src/lib/workflow/declaration.ts +6 -0
  188. package/src/lib/workflow/handoff.ts +90 -0
  189. package/src/lib/workflow/hook-trust.ts +108 -0
  190. package/src/lib/workflow/position.ts +524 -0
  191. package/src/lib/workflow/report.ts +79 -0
  192. package/src/lib/workflow/work.ts +106 -0
  193. package/src/lib/workset/factory-local.ts +157 -0
  194. package/src/lib/workset/record.ts +45 -11
  195. package/src/lib/workset/repositories.ts +118 -25
  196. package/src/lib/workset/stage.ts +4 -2
  197. package/src/lib/workset/stages.ts +64 -4
  198. package/src/lib/workset/worktree-include.ts +161 -0
  199. package/src/lib/workset/worktree-index.ts +6 -2
  200. package/src/lib/workset/worktree.ts +665 -89
  201. package/src/opencode/background-server.ts +145 -0
  202. package/src/opencode/companion-hooks.ts +55 -14
  203. package/src/opencode/companion-policy.ts +20 -7
  204. package/src/opencode/enter-worktree.ts +254 -6
  205. package/src/opencode/projected-guidance.ts +7 -3
  206. package/src/opencode/session-register.ts +176 -0
  207. package/src/opencode/turn-hook.ts +241 -0
  208. package/src/playbooks/companion-guidance.ts +6 -3
  209. package/src/plugin-api.ts +42 -0
  210. package/src/runtime/artifact-trailers.ts +63 -0
  211. package/src/runtime/claude-bg-isolation.ts +138 -0
  212. package/src/runtime/claude-delivery-plan.ts +14 -3
  213. package/src/runtime/claude-hook-group.ts +2 -0
  214. package/src/runtime/companion-git-state.ts +155 -10
  215. package/src/runtime/companion-git.ts +96 -13
  216. package/src/runtime/companion-guidance.ts +107 -8
  217. package/src/runtime/companion-instructions.ts +1 -1
  218. package/src/runtime/companion-sync.ts +109 -21
  219. package/src/runtime/current-branch.ts +24 -0
  220. package/src/runtime/entered-worktree.ts +24 -0
  221. package/src/runtime/env-names.ts +2 -2
  222. package/src/runtime/env.ts +16 -9
  223. package/src/runtime/forge-remote.ts +48 -0
  224. package/src/runtime/git-layout.ts +185 -24
  225. package/src/runtime/git-tracked.ts +60 -0
  226. package/src/runtime/json-fields.ts +8 -0
  227. package/src/runtime/launch-env-guard.ts +65 -0
  228. package/src/runtime/opencode-server-record.ts +136 -0
  229. package/src/runtime/pending-records.ts +533 -0
  230. package/src/runtime/projected-guidance.ts +6 -2
  231. package/src/runtime/projection.ts +40 -6
  232. package/src/runtime/publication-secret-scan.ts +45 -0
  233. package/src/runtime/repo-destination.ts +72 -0
  234. package/src/runtime/repo-local.ts +29 -2
  235. package/src/runtime/rtk-git-guard.ts +66 -0
  236. package/src/runtime/runtime-document-manifest.ts +229 -19
  237. package/src/runtime/runtime-document-manifest.typecheck.ts +10 -0
  238. package/src/runtime/secret-guard.ts +9 -2
  239. package/src/runtime/secret-patterns.ts +3 -2
  240. package/src/runtime/secret-policy-weakening.ts +122 -0
  241. package/src/runtime/serving-claude-wrap.ts +41 -0
  242. package/src/runtime/session-context.ts +4 -3
  243. package/src/runtime/session-registry.ts +434 -0
  244. package/src/runtime/skill-prefix.ts +75 -0
  245. package/src/runtime/submitted-arrivals.ts +547 -0
  246. package/src/runtime/tokensave-route.ts +10 -5
  247. package/src/runtime/turn-state.d.mts +14 -0
  248. package/src/runtime/turn-state.mjs +93 -0
  249. package/src/runtime/umbrella-children.ts +52 -0
  250. package/src/runtime/umbrella-folder.ts +84 -0
  251. package/src/runtime/workflow/change-folders.ts +66 -0
  252. package/src/runtime/workflow/declaration.ts +720 -0
  253. package/src/runtime/workflow/globs.ts +85 -0
  254. package/src/runtime/workflow/next-handoff-process.ts +98 -0
  255. package/src/runtime/workflow/turn.ts +309 -0
  256. package/src/runtime/workflow/workflow.ts +262 -0
  257. package/src/runtime/wrap-state.ts +36 -13
  258. package/src/studio.ts +73 -19
  259. package/src/templates/capabilities/openspec-cap/{mate-v1 → mate-full}/schema.yaml +3 -3
  260. package/src/templates/capabilities/openspec-cap/{mate-v1 → mate-full}/templates/design.md +1 -1
  261. package/src/templates/capabilities/openspec-cap/{mate-v1 → mate-full}/templates/proposal.md +1 -1
  262. package/src/templates/capabilities/openspec-cap/{mate-v1 → mate-full}/templates/tasks.md +1 -1
  263. package/src/templates/capabilities/openspec-cap/mate-minimal/schema.yaml +3 -3
  264. package/src/templates/mate-skills/agents/mate-apply-change/SKILL.md +147 -46
  265. package/src/templates/mate-skills/agents/mate-apply-change/references/openspec-apply-change.md +1 -1
  266. package/src/templates/mate-skills/agents/mate-archive-change/SKILL.md +7 -75
  267. package/src/templates/mate-skills/agents/mate-clarify-intent/SKILL.md +13 -7
  268. package/src/templates/mate-skills/agents/mate-domain-modeling/SKILL.md +10 -0
  269. package/src/templates/mate-skills/agents/mate-explore-change/SKILL.md +46 -14
  270. package/src/templates/mate-skills/agents/mate-propose-change/SKILL.md +51 -38
  271. package/src/templates/mate-skills/agents/mate-propose-change/references/mate-revise.md +14 -10
  272. package/src/templates/mate-skills/agents/mate-propose-change/references/openspec-update-change.md +1 -1
  273. package/src/templates/mate-skills/agents/mate-publish-artifact/SKILL.md +113 -87
  274. package/src/templates/mate-skills/agents/mate-publish-artifact/references/openspec.md +111 -100
  275. package/src/templates/mate-skills/agents/mate-show-me/SKILL.md +11 -5
  276. package/src/templates/mate-skills/agents/mate-simplify-code/SKILL.md +16 -6
  277. package/src/templates/mate-skills/agents/mate-submit-change/SKILL.md +114 -0
  278. package/src/templates/mate-skills/claude/mate-apply-change/SKILL.md +147 -46
  279. package/src/templates/mate-skills/claude/mate-apply-change/references/openspec-apply-change.md +1 -1
  280. package/src/templates/mate-skills/claude/mate-archive-change/SKILL.md +7 -75
  281. package/src/templates/mate-skills/claude/mate-clarify-intent/SKILL.md +13 -7
  282. package/src/templates/mate-skills/claude/mate-domain-modeling/SKILL.md +10 -0
  283. package/src/templates/mate-skills/claude/mate-explore-change/SKILL.md +46 -14
  284. package/src/templates/mate-skills/claude/mate-propose-change/SKILL.md +51 -38
  285. package/src/templates/mate-skills/claude/mate-propose-change/references/mate-revise.md +14 -10
  286. package/src/templates/mate-skills/claude/mate-propose-change/references/openspec-update-change.md +1 -1
  287. package/src/templates/mate-skills/claude/mate-publish-artifact/SKILL.md +113 -87
  288. package/src/templates/mate-skills/claude/mate-publish-artifact/references/openspec.md +111 -100
  289. package/src/templates/mate-skills/claude/mate-show-me/SKILL.md +11 -5
  290. package/src/templates/mate-skills/claude/mate-simplify-code/SKILL.md +16 -6
  291. package/src/templates/mate-skills/claude/mate-submit-change/SKILL.md +114 -0
  292. package/src/templates/mate-skills/openspec-references.ts +3 -2
  293. package/src/tools/setup/__snapshots__/runtime-surface-golden.test.ts.snap +1301 -154
  294. package/src/tools/setup/capabilities/openspec.ts +54 -15
  295. package/src/tools/setup/capabilities/rtk.ts +98 -5
  296. package/src/tools/setup/capabilities/tokensave.ts +3 -2
  297. package/src/tools/setup/dynamic-plugins/api.ts +38 -0
  298. package/src/tools/setup/dynamic-plugins/audiences.ts +65 -21
  299. package/src/tools/setup/dynamic-plugins/frozen.ts +32 -13
  300. package/src/tools/setup/dynamic-plugins/host.ts +2 -32
  301. package/src/tools/setup/dynamic-plugins/hydrate.ts +8 -7
  302. package/src/tools/setup/dynamic-plugins/install.ts +24 -22
  303. package/src/tools/setup/dynamic-plugins/loader.ts +11 -7
  304. package/src/tools/setup/dynamic-plugins/paths.ts +30 -10
  305. package/src/tools/setup/dynamic-plugins/verify.ts +10 -7
  306. package/src/tools/setup/dynamic-plugins/workspaces.ts +153 -0
  307. package/src/tools/setup/engine.ts +20 -1
  308. package/src/tools/setup/mate.ts +5 -3
  309. package/src/tools/setup/package-managers/bun.ts +8 -8
  310. package/src/tools/setup/plugin.ts +9 -1
  311. package/src/tools/setup/plugins/gitignore.ts +15 -9
  312. package/src/tools/setup/plugins/guidance.ts +4 -2
  313. package/src/tools/setup/providers/claude-plugin-hooks.ts +56 -0
  314. package/src/tools/setup/providers/claude.ts +64 -7
  315. package/src/tools/setup/service-registry.ts +69 -0
  316. package/src/tools/setup/service.ts +233 -0
  317. package/src/tools/setup/utils.ts +28 -5
  318. package/src/tools/setup/working-repo-cleanup.ts +2 -2
  319. package/src/tools/setup/working-repo-local-state.ts +2 -0
  320. package/src/tools/setup.ts +25 -14
  321. package/studio-dist/client/assets/app-BFVyWHGo.css +2 -0
  322. package/studio-dist/client/assets/button-D6LrRkOG.js +1 -0
  323. package/studio-dist/client/assets/combobox-Dk2MMZWE.js +1 -0
  324. package/studio-dist/client/assets/companion-view-BVaZNtiI.js +1 -0
  325. package/studio-dist/client/assets/fields-D_FYhxQr.js +1 -0
  326. package/studio-dist/client/assets/getting-started-ByWRg7hC.js +1 -0
  327. package/studio-dist/client/assets/getting-started-DZSjYC-b.js +1 -0
  328. package/studio-dist/client/assets/getting-started._topic-C6OyQ4G6.js +1 -0
  329. package/studio-dist/client/assets/getting-started.index-BkmPHdEm.js +1 -0
  330. package/studio-dist/client/assets/graph-7jm2XzyL.js +2 -0
  331. package/studio-dist/client/assets/graph-canvas-DDuzsNSx.js +3242 -0
  332. package/studio-dist/client/assets/guides-D9VTjWXP.js +1 -0
  333. package/studio-dist/client/assets/index-BBmFpG4y.js +40 -0
  334. package/studio-dist/client/assets/jsx-runtime-MZURdZre.js +1 -0
  335. package/studio-dist/client/assets/markdown-view-RL5YvfZg.js +1 -0
  336. package/studio-dist/client/assets/panel-B8F8sOKQ.js +1 -0
  337. package/studio-dist/client/assets/plugins._service._view-CynxTbMx.js +1 -0
  338. package/studio-dist/client/assets/queries-axYk2u9L.js +1 -0
  339. package/studio-dist/client/assets/react-r45OnJCw.js +27 -0
  340. package/studio-dist/client/assets/reports-BCAyXh6p.js +1 -0
  341. package/studio-dist/client/assets/routes-BFPqq89E.js +1 -0
  342. package/studio-dist/client/assets/skills-DTks_uBx.js +1 -0
  343. package/studio-dist/client/assets/specs-DU1kqcp5.js +1 -0
  344. package/studio-dist/client/assets/specs-view-omrd_5P3.js +1 -0
  345. package/studio-dist/client/assets/steps-DhIFuAZy.js +1 -0
  346. package/studio-dist/client/assets/store-DJ5cncKA.js +1 -0
  347. package/studio-dist/client/assets/studio-BR9j15J0.js +100 -0
  348. package/studio-dist/client/assets/studio-queries-CFP_yTpr.js +2 -0
  349. package/studio-dist/client/assets/usage-CHmwtkoM.js +55 -0
  350. package/studio-dist/client/assets/useBaseQuery-BlC-AZ35.js +1 -0
  351. package/studio-dist/client/assets/useSelector-AYcH7lB0.js +2 -0
  352. package/studio-dist/client/assets/vault-DRg8MScm.js +1 -0
  353. package/studio-dist/client/assets/warnings-UHFy6HAp.js +1 -0
  354. package/studio-dist/client/assets/workflow-Bv9vSfVV.js +1 -0
  355. package/studio-dist/server/assets/__23tanstack-start-server-fn-resolver-DAbZ6fzY.js +106 -0
  356. package/studio-dist/server/assets/_tanstack-start-manifest_v.js +86 -31
  357. package/studio-dist/server/assets/button-BfoNadNR.js +8193 -0
  358. package/studio-dist/server/assets/combobox-oxUI6r4V.js +2089 -0
  359. package/studio-dist/server/assets/{companion-view-aBady57v.js → companion-view-DHUjPpA0.js} +13 -7
  360. package/studio-dist/server/assets/companions-kBrJZAd6.js +31 -0
  361. package/studio-dist/server/assets/{createServerRpc-tK2lE9R2.js → createServerRpc-bFKFpGFG.js} +1 -1
  362. package/studio-dist/server/assets/fields-BD_c65T1.js +1190 -0
  363. package/studio-dist/server/assets/getting-started-7P0oyWaM.js +67 -0
  364. package/studio-dist/server/assets/getting-started-B136TP57.js +4 -0
  365. package/studio-dist/server/assets/getting-started._topic-B1mV0kGz.js +13 -0
  366. package/studio-dist/server/assets/getting-started.index-CeGtvUsm.js +13 -0
  367. package/studio-dist/server/assets/graph-BWtmJOH2.js +16 -0
  368. package/studio-dist/server/assets/graph-DSDVEELZ.js +801 -0
  369. package/studio-dist/server/assets/graph-canvas-CID9Nksc.js +21066 -0
  370. package/studio-dist/server/assets/graph-wire-BdSUx0G5.js +58 -0
  371. package/studio-dist/server/assets/guides-BLJenHwQ.js +5 -0
  372. package/studio-dist/server/assets/guides-Bm3RbUB-.js +13 -0
  373. package/studio-dist/server/assets/guides.server-rHHqRuzV.js +66 -0
  374. package/studio-dist/server/assets/jsx-runtime-Bt0s0YKS.js +451 -0
  375. package/studio-dist/server/assets/markdown-view-D3v9x-cM.js +105 -0
  376. package/studio-dist/server/assets/panel-yqOl5GMU.js +169 -0
  377. package/studio-dist/server/assets/plugins._service._view-DwqJX7s9.js +92 -0
  378. package/studio-dist/server/assets/queries-DYmGrhNO.js +32 -0
  379. package/studio-dist/server/assets/react-BO0uMhpm.js +89 -0
  380. package/studio-dist/server/assets/redirect-BaZ_QyqF.js +39 -0
  381. package/studio-dist/server/assets/reports-7yaPz7aP.js +147 -0
  382. package/studio-dist/server/assets/reports-C4Y_Jd-x.js +18 -0
  383. package/studio-dist/server/assets/router-Dnoq5auE.js +12844 -0
  384. package/studio-dist/server/assets/routes-Cok4p3mK.js +768 -0
  385. package/studio-dist/server/assets/{search-JAKurDNh.js → search-DUK7Jl6f.js} +21 -2
  386. package/studio-dist/server/assets/{shell-CboT2f66.js → shell-DNVXedgE.js} +16 -6
  387. package/studio-dist/server/assets/skills-D8qdXSku.js +267 -0
  388. package/studio-dist/server/assets/skills-pKmuAs0F.js +28 -0
  389. package/studio-dist/server/assets/specs-DeHYUNFp.js +51 -0
  390. package/studio-dist/server/assets/specs-view-BGn-5Ik_.js +425 -0
  391. package/studio-dist/server/assets/{start-BW5ovN0k.js → start-h3ICWwd2.js} +4 -1
  392. package/studio-dist/server/assets/steps-CV7Yk7L7.js +224 -0
  393. package/studio-dist/server/assets/store-CWDGIp6x.js +280 -0
  394. package/studio-dist/server/assets/studio-CB94np48.js +10437 -0
  395. package/studio-dist/server/assets/studio-queries-BqZGBE70.js +1335 -0
  396. package/studio-dist/server/assets/usage-M6Gi6Km7.js +25584 -0
  397. package/studio-dist/server/assets/usage-j5jR9gX9.js +24 -0
  398. package/studio-dist/server/assets/{studio-queries-CLnP9kGu.js → useBaseQuery-Tv_QJt9r.js} +4 -1318
  399. package/studio-dist/server/assets/{__23tanstack-start-server-fn-resolver-BQKuMdJW.js → useSelector-DUmCUXAs.js} +4 -498
  400. package/studio-dist/server/assets/vault-PqVmssmW.js +1035 -0
  401. package/studio-dist/server/assets/{vault-BGulVoNh.js → vault-lBlvSyD4.js} +19 -4
  402. package/studio-dist/server/assets/{views-Bd7cRr27.js → views-CsFp1i1G.js} +10 -9
  403. package/studio-dist/server/assets/warnings-BDs34j_m.js +24 -0
  404. package/studio-dist/server/assets/workflow-T0eEldsa.js +687 -0
  405. package/studio-dist/server/server.js +429 -9
  406. package/src/cli/commands/factory/factory.ts +0 -301
  407. package/src/cli/commands/report/collector.ts +0 -288
  408. package/src/cli/commands/studio/factory-credential.ts +0 -49
  409. package/src/cli/commands/studio/workset-session.ts +0 -131
  410. package/src/lib/delivery/archive-change.ts +0 -166
  411. package/src/lib/delivery/forge.ts +0 -279
  412. package/src/lib/delivery/token.ts +0 -24
  413. package/src/lib/factory/attach-client.ts +0 -113
  414. package/src/lib/factory/attach.ts +0 -178
  415. package/src/lib/factory/broker.ts +0 -190
  416. package/src/lib/factory/bun-commands.ts +0 -39
  417. package/src/lib/factory/client.ts +0 -92
  418. package/src/lib/factory/command.ts +0 -61
  419. package/src/lib/factory/credential-store.ts +0 -153
  420. package/src/lib/factory/frames.ts +0 -77
  421. package/src/lib/factory/ids.ts +0 -58
  422. package/src/lib/factory/outcomes/actions.ts +0 -114
  423. package/src/lib/factory/outcomes/index.ts +0 -381
  424. package/src/lib/factory/outcomes/lifecycle.ts +0 -205
  425. package/src/lib/factory/outcomes/runs.ts +0 -81
  426. package/src/lib/factory/prepare.ts +0 -49
  427. package/src/lib/factory/pty.ts +0 -103
  428. package/src/lib/factory/runner/companion-context.ts +0 -178
  429. package/src/lib/factory/runner/control.ts +0 -92
  430. package/src/lib/factory/runner/harness-agent.ts +0 -250
  431. package/src/lib/factory/runner/live.ts +0 -159
  432. package/src/lib/factory/runner/questions.ts +0 -22
  433. package/src/lib/factory/runner/rank.ts +0 -26
  434. package/src/lib/factory/runner/run-policy.ts +0 -12
  435. package/src/lib/factory/runner/run.ts +0 -199
  436. package/src/lib/factory/runner/scheduler.ts +0 -416
  437. package/src/lib/factory/runner/state.ts +0 -233
  438. package/src/lib/factory/runner/workflow.ts +0 -542
  439. package/src/lib/factory/runtime.ts +0 -972
  440. package/src/lib/factory/sandbox.ts +0 -292
  441. package/src/lib/factory/worktree-branch.ts +0 -17
  442. package/src/templates/capabilities/openspec-cap/mate-v1/templates/explore-brief.md +0 -25
  443. package/studio-dist/client/assets/companion-view-Csva26Ir.js +0 -1
  444. package/studio-dist/client/assets/delivery-path-DJMpRmiY.js +0 -1
  445. package/studio-dist/client/assets/factory-B7l9ZQyx.js +0 -4
  446. package/studio-dist/client/assets/index-n6uo_92S.js +0 -40
  447. package/studio-dist/client/assets/prepaint-CD5OpmTM.js +0 -24
  448. package/studio-dist/client/assets/queries-CN3JwMBX.js +0 -1
  449. package/studio-dist/client/assets/react-CabXf2Ds.js +0 -1
  450. package/studio-dist/client/assets/report-time-Dc-KOqQu.js +0 -1
  451. package/studio-dist/client/assets/reports-C01RsnMA.js +0 -1
  452. package/studio-dist/client/assets/rolldown-runtime-WkwZ5CU-.js +0 -1
  453. package/studio-dist/client/assets/routes-4pbC-2Hj.js +0 -1
  454. package/studio-dist/client/assets/skills-CihQganl.js +0 -1
  455. package/studio-dist/client/assets/spec-areas-C2L48N4C.js +0 -1
  456. package/studio-dist/client/assets/specs-D24_35_K.js +0 -1
  457. package/studio-dist/client/assets/studio-DKxfi691.css +0 -1
  458. package/studio-dist/client/assets/studio-queries-rvbJupCy.js +0 -3
  459. package/studio-dist/client/assets/vault-Bd4CQiTK.js +0 -1
  460. package/studio-dist/client/assets/warnings-V_Ys51wJ.js +0 -1
  461. package/studio-dist/client/assets/workflow-BJejeVwQ.js +0 -1
  462. package/studio-dist/server/assets/actions-Bvgj9eb8.js +0 -54
  463. package/studio-dist/server/assets/createServerFn-F5sAOF8V.js +0 -459
  464. package/studio-dist/server/assets/delivery-path-BkKNjgkf.js +0 -778
  465. package/studio-dist/server/assets/factory-D6xnjedJ.js +0 -2385
  466. package/studio-dist/server/assets/factory-DT3UzHlh.js +0 -68
  467. package/studio-dist/server/assets/prepaint-BMke0fo1.js +0 -41
  468. package/studio-dist/server/assets/queries-Ag2iL8q2.js +0 -107
  469. package/studio-dist/server/assets/react-COs0LHn-.js +0 -51
  470. package/studio-dist/server/assets/report-time-DAfzln-N.js +0 -8
  471. package/studio-dist/server/assets/reports-BnUNJVtx.js +0 -126
  472. package/studio-dist/server/assets/rolldown-runtime-DYf_mQCB.js +0 -34
  473. package/studio-dist/server/assets/router-BH--drIx.js +0 -4298
  474. package/studio-dist/server/assets/routes-khSDK1bV.js +0 -361
  475. package/studio-dist/server/assets/skills-MWYnWoKs.js +0 -106
  476. package/studio-dist/server/assets/spec-areas-DcnO6vW-.js +0 -16
  477. package/studio-dist/server/assets/specs-DE3w8hZP.js +0 -155
  478. package/studio-dist/server/assets/studio-BeltxxKt.js +0 -216
  479. package/studio-dist/server/assets/vault-CuyyhLyB.js +0 -832
  480. package/studio-dist/server/assets/warnings-BH05rOuG.js +0 -15
  481. package/studio-dist/server/assets/workflow-BSuIKWqH.js +0 -42
  482. /package/src/lib/{factory/keyed-serial.ts → keyed-serial.ts} +0 -0
  483. /package/src/templates/capabilities/openspec-cap/{mate-v1 → mate-full}/templates/spec.md +0 -0
@@ -0,0 +1,2089 @@
1
+ import { n as require_react, o as __toESM, t as require_jsx_runtime } from "./jsx-runtime-Bt0s0YKS.js";
2
+ import { $t as triggerOpenStateMapping, Bt as stopEvent, Cn as cancelOpen, Fn as none, Ft as rectToClientRect, G as useValueAsRef, Gn as useButton, H as visuallyHiddenInput, Hn as createChangeEventDetails, Jn as useIsoLayoutEffect, Kn as ownerDocument, L as DROPDOWN_COLLISION_AVOIDANCE, M as FloatingPortal, Mn as itemPress, On as imperativeAction, Pn as listNavigation, Qt as pressableTriggerOpenStateMapping, Rt as isVirtualClick, S as useOpenChangeComplete, Sn as CompositeList, T as useDismiss, Tr as cn, Ut as getFloatingFocusElement, V as visuallyHidden, Vn as windowResize, W as useAnimationFrame, Wn as useCompositeListItem, Wt as isInteractiveElement, Xt as popupStateMapping, Y as useTimeout, Yn as useStableCallback, _n as webkit, _r as EMPTY_OBJECT, _t as isListIndexDisabled, a as ReactStore, br as useMergedRefs, f as attachPreventUnmountOnClose, gr as EMPTY_ARRAY, hn as jsdom, hr as mergeProps, ht as isElementVisible, ir as getWindow, jn as inputPress, l as FOCUSABLE_POPUP_PROPS, mn as getTarget, mr as useRenderElement, nt as useDirection, on as transitionStatusMapping, or as isElement, pn as contains, q as addEventListener, qn as formatErrorMessage, r as Icon, rt as COMPOSITE_KEYS, tt as useToolbarRootContext, vr as NOOP, w as useTransitionStatus, wr as useControlled, x as useUnmountAfterClose, xn as isElementDisabled, xr as useRefWithInit } from "./button-BfoNadNR.js";
3
+ import { _ as inertValue, a as InternalBackdrop, c as useLabelableId, d as useRegisterFieldControl, g as fieldValidityMapping, l as useLabelableContext, m as useFieldRootContext, o as useSetFieldFocused, s as useValueChanged, u as useFormContext, v as FloatingFocusManager } from "./fields-BD_c65T1.js";
4
+ import { $ as findItemIndex, B as useListEmpty, F as ComboboxList$1, G as getComboboxPopupId, H as triggerStateAttributesMapping, I as ComboboxInput$1, J as resolveSelectedLabel, K as hasNullItemLabel, L as ComboboxInternalDismissButton, M as ComboboxItem$1, N as useComboboxItemContext, P as useAnchoredPopupScrollLock, Q as defaultItemEquality, R as ComboboxPositionerContext, U as AriaCombobox, V as usePopupSide, W as useOpenInteractionType, X as stringifyAsValue, Y as stringifyAsLabel, Z as compareItemEquality, _t as useFloatingRootContext, at as useComboboxInputValueContext, et as findSelectionIndex, ft as usePositioner, gt as useListNavigation, ht as platform, it as useComboboxFloatingContext, j as ComboboxEmpty$1, mt as useAnchorPositioning, nt as removeItem, ot as useComboboxRootContext, pt as getDisabledMountTransitionStyles, q as resolveMultipleLabels, rt as resolveSelectedIndex, st as useOnFirstRender, tt as isSelectedValueDirty, vt as useClick, z as useComboboxPositionerContext } from "./router-Dnoq5auE.js";
5
+ // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/floating-ui-react/hooks/useTypeahead.mjs
6
+ var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
7
+ /**
8
+ * Provides a matching callback that can be used to focus an item as the user
9
+ * types, often used in tandem with `useListNavigation()`.
10
+ * @see https://floating-ui.com/docs/useTypeahead
11
+ */
12
+ function useTypeahead(store, props) {
13
+ const { listRef, elementsRef, activeIndex, onMatch: onMatchProp, disabledIndices, onTyping: onTypingProp, enabled = true, resetMs = 750, selectedIndex = null } = props;
14
+ const onTyping = useStableCallback(onTypingProp);
15
+ const open = store.useState("open");
16
+ const timeout = useTimeout();
17
+ const stringRef = import_react.useRef("");
18
+ const prevIndexRef = import_react.useRef(selectedIndex ?? activeIndex ?? -1);
19
+ const matchIndexRef = import_react.useRef(null);
20
+ const onKeyDown = useStableCallback((event) => {
21
+ function getElement(index) {
22
+ return elementsRef?.current[index];
23
+ }
24
+ function isItemAvailable(index) {
25
+ const element = getElement(index);
26
+ if (element && !isElementVisible(element) || element?.matches(":disabled")) return false;
27
+ return disabledIndices == null || !isListIndexDisabled(EMPTY_ARRAY, index, disabledIndices);
28
+ }
29
+ function getMatchingIndex(list, string, startIndex = 0) {
30
+ if (list.length === 0) return -1;
31
+ const normalizedStartIndex = (startIndex % list.length + list.length) % list.length;
32
+ const lowerString = string.toLowerCase();
33
+ for (let offset = 0; offset < list.length; offset += 1) {
34
+ const index = (normalizedStartIndex + offset) % list.length;
35
+ if (!list[index]?.toLowerCase().startsWith(lowerString) || !isItemAvailable(index)) continue;
36
+ return index;
37
+ }
38
+ return -1;
39
+ }
40
+ const listContent = listRef.current;
41
+ if (stringRef.current.length > 0 && event.key === " ") {
42
+ stopEvent(event);
43
+ onTyping?.(true);
44
+ }
45
+ if (stringRef.current.length > 0 && stringRef.current[0] !== " ") {
46
+ if (getMatchingIndex(listContent, stringRef.current) === -1 && event.key !== " ") onTyping?.(false);
47
+ }
48
+ if (listContent == null || event.key.length !== 1 || event.ctrlKey || event.metaKey || event.altKey) return;
49
+ if (open && event.key !== " ") {
50
+ stopEvent(event);
51
+ onTyping?.(true);
52
+ }
53
+ const isNewSession = stringRef.current === "";
54
+ if (isNewSession) prevIndexRef.current = selectedIndex ?? activeIndex ?? -1;
55
+ if (listContent.every((text, index) => text && isItemAvailable(index) ? text[0]?.toLowerCase() !== text[1]?.toLowerCase() : true) && stringRef.current === event.key) {
56
+ stringRef.current = "";
57
+ prevIndexRef.current = matchIndexRef.current;
58
+ }
59
+ stringRef.current += event.key;
60
+ timeout.start(resetMs, () => {
61
+ stringRef.current = "";
62
+ prevIndexRef.current = matchIndexRef.current;
63
+ onTyping?.(false);
64
+ });
65
+ const startIndex = ((isNewSession ? selectedIndex ?? activeIndex ?? -1 : prevIndexRef.current) ?? 0) + 1;
66
+ const index = getMatchingIndex(listContent, stringRef.current, startIndex);
67
+ if (index !== -1) {
68
+ onMatchProp?.(index, event);
69
+ matchIndexRef.current = index;
70
+ } else if (event.key !== " ") {
71
+ stringRef.current = "";
72
+ onTyping?.(false);
73
+ }
74
+ });
75
+ const onBlur = useStableCallback((event) => {
76
+ const next = event.relatedTarget;
77
+ const currentDomReferenceElement = store.select("domReferenceElement");
78
+ const currentFloatingElement = store.select("floatingElement");
79
+ if (contains(currentDomReferenceElement, next) || contains(currentFloatingElement, next)) return;
80
+ timeout.clear();
81
+ stringRef.current = "";
82
+ prevIndexRef.current = matchIndexRef.current;
83
+ onTyping?.(false);
84
+ });
85
+ useIsoLayoutEffect(() => {
86
+ if (!open && selectedIndex !== null) return;
87
+ timeout.clear();
88
+ matchIndexRef.current = null;
89
+ if (stringRef.current !== "") {
90
+ stringRef.current = "";
91
+ onTyping?.(false);
92
+ }
93
+ }, [
94
+ open,
95
+ selectedIndex,
96
+ timeout,
97
+ onTyping
98
+ ]);
99
+ const sharedProps = import_react.useMemo(() => ({
100
+ onKeyDown,
101
+ onBlur
102
+ }), [onKeyDown, onBlur]);
103
+ return import_react.useMemo(() => enabled ? {
104
+ reference: sharedProps,
105
+ floating: sharedProps
106
+ } : {}, [enabled, sharedProps]);
107
+ }
108
+ // ../../node_modules/.bun/@base-ui+utils@0.5.0+9e489665888c9e4a/node_modules/@base-ui/utils/usePreviousValue.mjs
109
+ var import_jsx_runtime = require_jsx_runtime();
110
+ /**
111
+ * Returns a previous value of its argument.
112
+ * @param value Current value.
113
+ * @returns Previous value, or null if there is no previous value.
114
+ */
115
+ function usePreviousValue(value) {
116
+ const [state, setState] = import_react.useState({
117
+ current: value,
118
+ previous: null
119
+ });
120
+ if (!Object.is(value, state.current)) setState({
121
+ current: value,
122
+ previous: state.current
123
+ });
124
+ return state.previous;
125
+ }
126
+ // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/utils/getPseudoElementBounds.mjs
127
+ var BOUNDARY_OFFSET = 5;
128
+ /**
129
+ * Determines if a mouse event occurred within the bounds of an element
130
+ * (including its pseudo-elements), with a small tolerance for pointer drift.
131
+ */
132
+ function isMouseWithinBounds(event, element) {
133
+ const bounds = getPseudoElementBounds(element);
134
+ return event.clientX >= bounds.left - BOUNDARY_OFFSET && event.clientX <= bounds.right + BOUNDARY_OFFSET && event.clientY >= bounds.top - BOUNDARY_OFFSET && event.clientY <= bounds.bottom + BOUNDARY_OFFSET;
135
+ }
136
+ function getPseudoElementBounds(element) {
137
+ const elementRect = element.getBoundingClientRect();
138
+ const win = getWindow(element);
139
+ if (jsdom) return elementRect;
140
+ const beforeStyles = win.getComputedStyle(element, "::before");
141
+ const afterStyles = win.getComputedStyle(element, "::after");
142
+ if (!(beforeStyles.content !== "none" || afterStyles.content !== "none")) return elementRect;
143
+ const beforeWidth = parseFloat(beforeStyles.width) || 0;
144
+ const beforeHeight = parseFloat(beforeStyles.height) || 0;
145
+ const afterWidth = parseFloat(afterStyles.width) || 0;
146
+ const afterHeight = parseFloat(afterStyles.height) || 0;
147
+ const totalWidth = Math.max(elementRect.width, beforeWidth, afterWidth);
148
+ const totalHeight = Math.max(elementRect.height, beforeHeight, afterHeight);
149
+ const widthDiff = totalWidth - elementRect.width;
150
+ const heightDiff = totalHeight - elementRect.height;
151
+ return {
152
+ left: elementRect.left - widthDiff / 2,
153
+ right: elementRect.right + widthDiff / 2,
154
+ top: elementRect.top - heightDiff / 2,
155
+ bottom: elementRect.bottom + heightDiff / 2
156
+ };
157
+ }
158
+ // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/utils/resolveAriaLabelledBy.mjs
159
+ function resolveAriaLabelledBy(fieldLabelId, localLabelId) {
160
+ return fieldLabelId ?? localLabelId;
161
+ }
162
+ // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/combobox/trigger/ComboboxTrigger.mjs
163
+ /**
164
+ * A button that opens the popup.
165
+ * Renders a `<button>` element.
166
+ *
167
+ * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
168
+ */
169
+ var ComboboxTrigger = /*#__PURE__*/ import_react.forwardRef(function ComboboxTrigger(componentProps, forwardedRef) {
170
+ const { render, className, nativeButton = true, disabled: disabledProp = false, id: idProp, style, ...elementProps } = componentProps;
171
+ const { state: fieldState, disabled: fieldDisabled, setTouched, validationMode, validation } = useFieldRootContext();
172
+ const { labelId: fieldLabelId } = useLabelableContext();
173
+ const store = useComboboxRootContext();
174
+ const selectionMode = store.useState("selectionMode");
175
+ const comboboxDisabled = store.useState("disabled");
176
+ const readOnly = store.useState("readOnly");
177
+ const required = store.useState("required");
178
+ const positionerElement = store.useState("positionerElement");
179
+ const listElement = store.useState("listElement");
180
+ const storedPopupId = store.useState("popupId");
181
+ const triggerProps = store.useState("triggerProps");
182
+ const inputInsidePopup = store.useState("inputInsidePopup");
183
+ const rootId = store.useState("id");
184
+ const comboboxLabelId = store.useState("labelId");
185
+ const open = store.useState("open");
186
+ const selectedValue = store.useState("selectedValue");
187
+ const activeIndex = store.useState("activeIndex");
188
+ const selectedIndex = store.useState("selectedIndex");
189
+ const hasSelectedValue = store.useState("hasSelectedValue");
190
+ const floatingRootContext = useComboboxFloatingContext();
191
+ const inputValue = useComboboxInputValueContext();
192
+ const focusTimeout = useTimeout();
193
+ const disabled = fieldDisabled || comboboxDisabled || disabledProp;
194
+ const listEmpty = useListEmpty();
195
+ const popupSide = usePopupSide(store);
196
+ const triggerRef = import_react.useRef(null);
197
+ const setFocused = useSetFieldFocused(disabled, triggerRef);
198
+ useLabelableId({ id: inputInsidePopup ? idProp : void 0 });
199
+ const id = inputInsidePopup ? idProp ?? rootId : idProp;
200
+ const ariaLabelledBy = resolveAriaLabelledBy(fieldLabelId, comboboxLabelId);
201
+ let ariaControls;
202
+ if (open && inputInsidePopup) ariaControls = storedPopupId ?? getComboboxPopupId(rootId);
203
+ else if (open) ariaControls = listElement?.id;
204
+ const currentPointerTypeRef = import_react.useRef("");
205
+ function trackPointerType(event) {
206
+ currentPointerTypeRef.current = event.pointerType;
207
+ }
208
+ const { reference: triggerTypeaheadProps } = useTypeahead(floatingRootContext, {
209
+ enabled: !open && !readOnly && !comboboxDisabled && selectionMode === "single",
210
+ listRef: store.context.labelsRef,
211
+ activeIndex,
212
+ selectedIndex,
213
+ onMatch(index) {
214
+ const nextSelectedValue = store.context.valuesRef.current[index];
215
+ if (nextSelectedValue !== void 0) store.context.setSelectedValue(nextSelectedValue, createChangeEventDetails(none));
216
+ }
217
+ });
218
+ const { reference: triggerClickProps } = useClick(floatingRootContext, {
219
+ enabled: !comboboxDisabled,
220
+ event: "mousedown"
221
+ });
222
+ const { buttonRef, getButtonProps } = useButton({
223
+ native: nativeButton,
224
+ disabled
225
+ });
226
+ const state = {
227
+ ...fieldState,
228
+ readOnly,
229
+ open,
230
+ disabled,
231
+ popupSide,
232
+ listEmpty,
233
+ placeholder: selectionMode === "none" ? false : !hasSelectedValue
234
+ };
235
+ const setTriggerElement = useStableCallback((element) => {
236
+ store.set("triggerElement", element);
237
+ });
238
+ return useRenderElement("button", componentProps, {
239
+ ref: [
240
+ forwardedRef,
241
+ buttonRef,
242
+ triggerRef,
243
+ setTriggerElement
244
+ ],
245
+ state,
246
+ props: [
247
+ triggerProps,
248
+ triggerClickProps,
249
+ triggerTypeaheadProps,
250
+ {
251
+ id,
252
+ tabIndex: inputInsidePopup ? 0 : -1,
253
+ role: inputInsidePopup ? "combobox" : void 0,
254
+ "aria-expanded": open,
255
+ "aria-haspopup": inputInsidePopup ? "dialog" : "listbox",
256
+ "aria-controls": ariaControls,
257
+ "aria-required": inputInsidePopup ? required || void 0 : void 0,
258
+ "aria-readonly": inputInsidePopup ? readOnly || void 0 : void 0,
259
+ "aria-labelledby": ariaLabelledBy,
260
+ onPointerDown: trackPointerType,
261
+ onPointerEnter: trackPointerType,
262
+ onFocus() {
263
+ setFocused(true);
264
+ if (disabled) return;
265
+ focusTimeout.start(0, store.context.forceMount);
266
+ },
267
+ onBlur(event) {
268
+ if (contains(positionerElement, event.relatedTarget)) return;
269
+ setTouched(true);
270
+ setFocused(false);
271
+ if (validationMode === "onBlur") {
272
+ const valueToValidate = selectionMode === "none" ? inputValue : selectedValue;
273
+ validation.commit(valueToValidate);
274
+ }
275
+ },
276
+ onMouseDown(event) {
277
+ if (disabled) return;
278
+ if (!inputInsidePopup) floatingRootContext.set("domReferenceElement", event.currentTarget);
279
+ store.context.forceMount();
280
+ if (currentPointerTypeRef.current !== "touch") {
281
+ store.context.inputRef.current?.focus();
282
+ if (!inputInsidePopup) event.preventDefault();
283
+ }
284
+ if (open) return;
285
+ const doc = ownerDocument(event.currentTarget);
286
+ function handleMouseUp(mouseEvent) {
287
+ const currentTriggerElement = store.state.triggerElement;
288
+ if (!currentTriggerElement) return;
289
+ const mouseUpTarget = getTarget(mouseEvent);
290
+ const positioner = store.state.positionerElement;
291
+ const list = store.state.listElement;
292
+ if (contains(currentTriggerElement, mouseUpTarget) || contains(positioner, mouseUpTarget) || contains(list, mouseUpTarget)) return;
293
+ if (isMouseWithinBounds(mouseEvent, currentTriggerElement)) return;
294
+ store.context.setOpen(false, createChangeEventDetails(cancelOpen, mouseEvent));
295
+ }
296
+ if (inputInsidePopup) doc.addEventListener("mouseup", handleMouseUp, { once: true });
297
+ },
298
+ onKeyDown(event) {
299
+ if (event.key === "ArrowDown" || event.key === "ArrowUp") {
300
+ stopEvent(event);
301
+ store.context.setOpen(true, createChangeEventDetails(listNavigation, event.nativeEvent));
302
+ store.context.inputRef.current?.focus();
303
+ }
304
+ }
305
+ },
306
+ validation.getValidationProps(disabled, elementProps),
307
+ getButtonProps
308
+ ],
309
+ stateAttributesMapping: triggerStateAttributesMapping
310
+ });
311
+ });
312
+ // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/combobox/utils/handleInputPress.mjs
313
+ function handleInputPress(event, store, disabled, shouldIgnoreTarget) {
314
+ if (event.baseUIHandlerPrevented) return;
315
+ const target = getTarget(event.nativeEvent);
316
+ const targetElement = isElement(target) ? target : null;
317
+ if (targetElement !== event.currentTarget && (shouldIgnoreTarget?.(targetElement) || isInteractiveElement(targetElement))) return;
318
+ event.preventDefault();
319
+ if (disabled) return;
320
+ store.context.inputRef.current?.focus();
321
+ if (store.state.openOnInputClick) store.context.setOpen(true, createChangeEventDetails(inputPress, event.nativeEvent));
322
+ }
323
+ // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/combobox/input-group/ComboboxInputGroup.mjs
324
+ /**
325
+ * A wrapper for the input and its associated controls.
326
+ * Renders a `<div>` element.
327
+ *
328
+ * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
329
+ */
330
+ var ComboboxInputGroup = /*#__PURE__*/ import_react.forwardRef(function ComboboxInputGroup(componentProps, forwardedRef) {
331
+ const { render, className, style, ...elementProps } = componentProps;
332
+ const { state: fieldState } = useFieldRootContext();
333
+ const store = useComboboxRootContext();
334
+ const open = store.useState("open");
335
+ const comboboxDisabled = store.useState("disabled");
336
+ const readOnly = store.useState("readOnly");
337
+ const hasSelectedValue = store.useState("hasSelectedValue");
338
+ const selectionMode = store.useState("selectionMode");
339
+ const popupSide = usePopupSide(store);
340
+ const disabled = comboboxDisabled;
341
+ const listEmpty = useListEmpty();
342
+ const placeholder = selectionMode === "none" ? false : !hasSelectedValue;
343
+ const state = {
344
+ ...fieldState,
345
+ open,
346
+ disabled,
347
+ readOnly,
348
+ popupSide,
349
+ listEmpty,
350
+ placeholder
351
+ };
352
+ const setInputGroupElement = useStableCallback((element) => {
353
+ store.set("inputGroupElement", element);
354
+ });
355
+ return useRenderElement("div", componentProps, {
356
+ ref: [forwardedRef, setInputGroupElement],
357
+ props: [{
358
+ role: "group",
359
+ onMouseDown(event) {
360
+ handleInputPress(event, store, disabled, (target) => {
361
+ return contains(store.context.chipsContainerRef.current, target);
362
+ });
363
+ }
364
+ }, elementProps],
365
+ state,
366
+ stateAttributesMapping: triggerStateAttributesMapping
367
+ });
368
+ });
369
+ // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/combobox/portal/ComboboxPortalContext.mjs
370
+ var ComboboxPortalContext = /*#__PURE__*/ import_react.createContext(void 0);
371
+ function useComboboxPortalContext() {
372
+ const context = import_react.useContext(ComboboxPortalContext);
373
+ if (context === void 0) throw new Error(formatErrorMessage(20));
374
+ return context;
375
+ }
376
+ // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/combobox/portal/ComboboxPortal.mjs
377
+ /**
378
+ * A portal element that moves the popup to a different part of the DOM.
379
+ * By default, the portal element is appended to `<body>`.
380
+ * Renders a `<div>` element.
381
+ *
382
+ * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
383
+ */
384
+ var ComboboxPortal = /*#__PURE__*/ import_react.forwardRef(function ComboboxPortal(props, forwardedRef) {
385
+ const { keepMounted = false, ...portalProps } = props;
386
+ const store = useComboboxRootContext();
387
+ const mounted = store.useState("mounted");
388
+ const forceMounted = store.useState("forceMounted");
389
+ if (!(mounted || keepMounted || forceMounted)) return null;
390
+ return /*#__PURE__*/ (0, import_jsx_runtime.jsx)(ComboboxPortalContext.Provider, {
391
+ value: keepMounted,
392
+ children: /*#__PURE__*/ (0, import_jsx_runtime.jsx)(FloatingPortal, {
393
+ ref: forwardedRef,
394
+ ...portalProps
395
+ })
396
+ });
397
+ });
398
+ // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/combobox/positioner/ComboboxPositioner.mjs
399
+ /**
400
+ * Positions the popup against the trigger.
401
+ * Renders a `<div>` element.
402
+ *
403
+ * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
404
+ */
405
+ var ComboboxPositioner = /*#__PURE__*/ import_react.forwardRef(function ComboboxPositioner(componentProps, forwardedRef) {
406
+ const { render, className, anchor, positionMethod, side, align, sideOffset, alignOffset, collisionBoundary = "clipping-ancestors", collisionPadding, arrowPadding, sticky, disableAnchorTracking = false, collisionAvoidance = DROPDOWN_COLLISION_AVOIDANCE, style: styleProp, ...elementProps } = componentProps;
407
+ const store = useComboboxRootContext();
408
+ const floatingRootContext = useComboboxFloatingContext();
409
+ const keepMounted = useComboboxPortalContext();
410
+ const modal = store.useState("modal");
411
+ const open = store.useState("open");
412
+ const mounted = store.useState("mounted");
413
+ const openMethod = store.useState("openMethod");
414
+ const positionerElement = store.useState("positionerElement");
415
+ const triggerElement = store.useState("triggerElement");
416
+ const inputElement = store.useState("inputElement");
417
+ const inputGroupElement = store.useState("inputGroupElement");
418
+ const inputInsidePopup = store.useState("inputInsidePopup");
419
+ const transitionStatus = store.useState("transitionStatus");
420
+ const empty = useListEmpty();
421
+ const positioning = useAnchorPositioning({
422
+ anchor: anchor ?? (inputInsidePopup ? triggerElement : inputGroupElement ?? inputElement),
423
+ floatingRootContext,
424
+ positionMethod,
425
+ mounted,
426
+ side,
427
+ sideOffset,
428
+ align,
429
+ alignOffset,
430
+ arrowPadding,
431
+ collisionBoundary,
432
+ collisionPadding,
433
+ sticky,
434
+ disableAnchorTracking,
435
+ keepMounted,
436
+ collisionAvoidance,
437
+ lazyFlip: true
438
+ });
439
+ useAnchoredPopupScrollLock(open && modal, openMethod === "touch", positionerElement, triggerElement);
440
+ const state = {
441
+ open,
442
+ side: positioning.side,
443
+ align: positioning.align,
444
+ anchorHidden: positioning.anchorHidden,
445
+ empty
446
+ };
447
+ useIsoLayoutEffect(() => {
448
+ store.set("popupSide", positioning.side);
449
+ }, [store, positioning.side]);
450
+ const setPositionerElement = useStableCallback((element) => {
451
+ store.set("positionerElement", element);
452
+ });
453
+ const element = usePositioner(componentProps, state, {
454
+ styles: positioning.positionerStyles,
455
+ transitionStatus,
456
+ props: elementProps,
457
+ refs: [forwardedRef, setPositionerElement],
458
+ hidden: !mounted,
459
+ inert: !open
460
+ });
461
+ return /*#__PURE__*/ (0, import_jsx_runtime.jsxs)(ComboboxPositionerContext.Provider, {
462
+ value: positioning,
463
+ children: [mounted && modal && /*#__PURE__*/ (0, import_jsx_runtime.jsx)(InternalBackdrop, {
464
+ inert: inertValue(!open),
465
+ cutout: inputGroupElement ?? inputElement ?? triggerElement
466
+ }), element]
467
+ });
468
+ });
469
+ // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/combobox/popup/ComboboxPopup.mjs
470
+ var stateAttributesMapping$3 = {
471
+ ...popupStateMapping,
472
+ ...transitionStatusMapping
473
+ };
474
+ /**
475
+ * A container for the list.
476
+ * Renders a `<div>` element.
477
+ *
478
+ * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
479
+ */
480
+ var ComboboxPopup = /*#__PURE__*/ import_react.forwardRef(function ComboboxPopup(componentProps, forwardedRef) {
481
+ const { render, className, style, initialFocus, finalFocus, ...elementProps } = componentProps;
482
+ const store = useComboboxRootContext();
483
+ const positioning = useComboboxPositionerContext();
484
+ const floatingRootContext = useComboboxFloatingContext();
485
+ const mounted = store.useState("mounted");
486
+ const open = store.useState("open");
487
+ const openMethod = store.useState("openMethod");
488
+ const popupProps = store.useState("popupProps");
489
+ const transitionStatus = store.useState("transitionStatus");
490
+ const inputInsidePopup = store.useState("inputInsidePopup");
491
+ const inputElement = store.useState("inputElement");
492
+ const modal = store.useState("modal");
493
+ const rootId = store.useState("id");
494
+ const empty = useListEmpty();
495
+ const popupId = elementProps.id ?? (inputInsidePopup ? getComboboxPopupId(rootId) : void 0);
496
+ useIsoLayoutEffect(() => {
497
+ store.set("popupId", store.context.popupRef.current?.id || popupId);
498
+ return () => {
499
+ store.set("popupId", void 0);
500
+ };
501
+ }, [store, popupId]);
502
+ useOpenChangeComplete({
503
+ open,
504
+ ref: store.context.popupRef,
505
+ onComplete() {
506
+ if (open) store.context.onOpenChangeComplete(true);
507
+ }
508
+ });
509
+ const state = {
510
+ open,
511
+ side: positioning.side,
512
+ align: positioning.align,
513
+ anchorHidden: positioning.anchorHidden,
514
+ transitionStatus,
515
+ empty
516
+ };
517
+ const element = useRenderElement("div", componentProps, {
518
+ state,
519
+ ref: [forwardedRef, store.context.popupRef],
520
+ props: [
521
+ popupProps,
522
+ {
523
+ id: popupId,
524
+ role: inputInsidePopup ? "dialog" : "presentation",
525
+ onFocus(event) {
526
+ const target = getTarget(event.nativeEvent);
527
+ if (openMethod !== "touch" && (contains(store.state.listElement, target) || target === event.currentTarget)) store.context.inputRef.current?.focus();
528
+ }
529
+ },
530
+ getDisabledMountTransitionStyles(transitionStatus),
531
+ elementProps
532
+ ],
533
+ stateAttributesMapping: stateAttributesMapping$3
534
+ });
535
+ const resolvedInitialFocus = initialFocus === void 0 ? inputInsidePopup ? (interactionType) => interactionType === "touch" ? store.context.popupRef.current : inputElement : false : initialFocus;
536
+ let resolvedFinalFocus;
537
+ if (finalFocus != null) resolvedFinalFocus = finalFocus;
538
+ else resolvedFinalFocus = inputInsidePopup ? void 0 : false;
539
+ const focusManagerModal = !inputInsidePopup || modal;
540
+ return /*#__PURE__*/ (0, import_jsx_runtime.jsx)(FloatingFocusManager, {
541
+ context: floatingRootContext,
542
+ disabled: !mounted,
543
+ modal: focusManagerModal,
544
+ openInteractionType: openMethod,
545
+ initialFocus: resolvedInitialFocus,
546
+ returnFocus: resolvedFinalFocus,
547
+ getInsideElements: () => [store.context.startDismissRef.current, store.context.endDismissRef.current],
548
+ children: /*#__PURE__*/ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [element, focusManagerModal && /*#__PURE__*/ (0, import_jsx_runtime.jsx)(ComboboxInternalDismissButton, { ref: store.context.endDismissRef })] })
549
+ });
550
+ });
551
+ // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/combobox/root/ComboboxRoot.mjs
552
+ /**
553
+ * Groups all parts of the combobox.
554
+ * Doesn't render its own HTML element.
555
+ *
556
+ * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
557
+ */
558
+ function ComboboxRoot(props) {
559
+ const { multiple = false, defaultValue, value, onValueChange, autoComplete, ...other } = props;
560
+ return /*#__PURE__*/ (0, import_jsx_runtime.jsx)(AriaCombobox, {
561
+ ...other,
562
+ selectionMode: multiple ? "multiple" : "single",
563
+ selectedValue: value,
564
+ defaultSelectedValue: defaultValue,
565
+ onSelectedValueChange: onValueChange,
566
+ formAutoComplete: autoComplete
567
+ });
568
+ }
569
+ // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/utils/ItemIndicator.mjs
570
+ var ItemIndicator = /*#__PURE__*/ import_react.memo(/*#__PURE__*/ import_react.forwardRef(function ItemIndicator(componentProps, forwardedRef) {
571
+ const { render, className, style, keepMounted, selected, ...elementProps } = componentProps;
572
+ const indicatorRef = import_react.useRef(null);
573
+ const { transitionStatus, setMounted } = useTransitionStatus(selected);
574
+ const element = useRenderElement("span", componentProps, {
575
+ ref: [forwardedRef, indicatorRef],
576
+ state: {
577
+ selected,
578
+ transitionStatus
579
+ },
580
+ props: [{
581
+ "aria-hidden": true,
582
+ children: "✔️"
583
+ }, elementProps],
584
+ stateAttributesMapping: transitionStatusMapping
585
+ });
586
+ useOpenChangeComplete({
587
+ batch: true,
588
+ enabled: !selected,
589
+ open: selected,
590
+ ref: indicatorRef,
591
+ onComplete() {
592
+ if (!selected) setMounted(false);
593
+ }
594
+ });
595
+ return element;
596
+ }));
597
+ // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/combobox/item-indicator/ComboboxItemIndicator.mjs
598
+ /**
599
+ * Indicates whether the item is selected.
600
+ * Renders a `<span>` element.
601
+ *
602
+ * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
603
+ */
604
+ var ComboboxItemIndicator = /*#__PURE__*/ import_react.forwardRef(function ComboboxItemIndicator(componentProps, forwardedRef) {
605
+ const { selected } = useComboboxItemContext();
606
+ if (!(componentProps.keepMounted || selected)) return null;
607
+ return /*#__PURE__*/ (0, import_jsx_runtime.jsx)(ItemIndicator, {
608
+ ...componentProps,
609
+ selected,
610
+ ref: forwardedRef
611
+ });
612
+ });
613
+ // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/select/root/SelectRootContext.mjs
614
+ var SelectRootContext = /*#__PURE__*/ import_react.createContext(void 0);
615
+ var SelectFloatingContext = /*#__PURE__*/ import_react.createContext(void 0);
616
+ function useSelectRootContext() {
617
+ const store = import_react.useContext(SelectRootContext);
618
+ if (store === void 0) throw new Error(formatErrorMessage(60));
619
+ return store;
620
+ }
621
+ function useSelectFloatingContext() {
622
+ const context = import_react.useContext(SelectFloatingContext);
623
+ if (context === void 0) throw new Error(formatErrorMessage(61));
624
+ return context;
625
+ }
626
+ // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/select/store.mjs
627
+ /**
628
+ * Non-reactive values shared with the select parts. Nothing here is observable through
629
+ * `selectors`, so writing to a ref never notifies subscribers.
630
+ */
631
+ var selectors = {
632
+ id: (state) => state.id,
633
+ labelId: (state) => state.labelId,
634
+ modal: (state) => state.modal,
635
+ multiple: (state) => state.multiple,
636
+ disabled: (state) => state.disabled,
637
+ readOnly: (state) => state.readOnly,
638
+ required: (state) => state.required,
639
+ highlightItemOnHover: (state) => state.highlightItemOnHover,
640
+ items: (state) => state.items,
641
+ itemToStringLabel: (state) => state.itemToStringLabel,
642
+ isItemEqualToValue: (state) => state.isItemEqualToValue,
643
+ value: (state) => state.value,
644
+ hasSelectedValue: (state) => {
645
+ const { value, multiple, itemToStringValue } = state;
646
+ if (value == null) return false;
647
+ if (multiple && Array.isArray(value)) return value.length > 0;
648
+ return stringifyAsValue(value, itemToStringValue) !== "";
649
+ },
650
+ hasNullItemLabel: (state, enabled) => {
651
+ return enabled ? hasNullItemLabel(state.items) : false;
652
+ },
653
+ open: (state) => state.open,
654
+ mounted: (state) => state.mounted,
655
+ forceMount: (state) => state.forceMount,
656
+ transitionStatus: (state) => state.transitionStatus,
657
+ openMethod: (state) => state.openMethod,
658
+ activeIndex: (state) => state.activeIndex,
659
+ selectedIndex: (state) => state.selectedIndex,
660
+ isActive: (state, index) => state.activeIndex === index,
661
+ isSelected: (state, itemValue) => {
662
+ const comparer = state.isItemEqualToValue;
663
+ const storeValue = state.value;
664
+ if (state.multiple) return Array.isArray(storeValue) && storeValue.some((selectedItem) => compareItemEquality(itemValue, selectedItem, comparer));
665
+ return compareItemEquality(itemValue, storeValue, comparer);
666
+ },
667
+ isSelectedByFocus: (state, index) => {
668
+ return state.selectedIndex === index;
669
+ },
670
+ popupProps: (state) => state.popupProps,
671
+ triggerProps: (state) => state.triggerProps,
672
+ itemRoot: (state) => state.itemRoot,
673
+ triggerElement: (state) => state.triggerElement,
674
+ positionerElement: (state) => state.positionerElement,
675
+ listElement: (state) => state.listElement,
676
+ popupSide: (state) => state.popupSide,
677
+ scrollUpArrowVisible: (state) => state.scrollUpArrowVisible,
678
+ scrollDownArrowVisible: (state) => state.scrollDownArrowVisible,
679
+ hasScrollArrows: (state) => state.hasScrollArrows
680
+ };
681
+ // ../../node_modules/.bun/@base-ui+utils@0.5.0+9e489665888c9e4a/node_modules/@base-ui/utils/clamp.mjs
682
+ function clamp(val, min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER) {
683
+ return Math.max(min, Math.min(val, max));
684
+ }
685
+ function getMaxScrollOffset(scrollSize, clientSize) {
686
+ return Math.max(0, scrollSize - clientSize);
687
+ }
688
+ function normalizeScrollOffset(value, max) {
689
+ if (max <= 0) return 0;
690
+ const clamped = clamp(value, 0, max);
691
+ const startDistance = clamped;
692
+ const endDistance = max - clamped;
693
+ const withinStartTolerance = startDistance <= 1;
694
+ const withinEndTolerance = endDistance <= 1;
695
+ if (withinStartTolerance && withinEndTolerance) return startDistance <= endDistance ? 0 : max;
696
+ if (withinStartTolerance) return 0;
697
+ if (withinEndTolerance) return max;
698
+ return clamped;
699
+ }
700
+ // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/select/root/SelectRoot.mjs
701
+ /**
702
+ * Groups all parts of the select.
703
+ * Doesn't render its own HTML element.
704
+ *
705
+ * Documentation: [Base UI Select](https://base-ui.com/react/components/select)
706
+ */
707
+ function SelectRoot(props) {
708
+ const { id, value: valueProp, defaultValue = null, onValueChange, open: openProp, defaultOpen = false, onOpenChange, name: nameProp, form, autoComplete, disabled: disabledProp = false, readOnly = false, required = false, modal = true, actionsRef, inputRef, onOpenChangeComplete, items, multiple = false, itemToStringLabel, itemToStringValue, isItemEqualToValue = defaultItemEquality, highlightItemOnHover = true, children } = props;
709
+ const { clearErrors } = useFormContext();
710
+ const { setDirty, setTouched, setFocused, validityData, setFilled, name: fieldName, disabled: fieldDisabled, validation, validationMode } = useFieldRootContext();
711
+ const generatedId = useLabelableId({ id });
712
+ const disabled = fieldDisabled || disabledProp;
713
+ const name = fieldName ?? nameProp;
714
+ const [value, setValueUnwrapped] = useControlled({
715
+ controlled: valueProp,
716
+ default: multiple ? defaultValue ?? EMPTY_ARRAY : defaultValue,
717
+ name: "Select",
718
+ state: "value"
719
+ });
720
+ const [open, setOpenUnwrapped] = useControlled({
721
+ controlled: openProp,
722
+ default: defaultOpen,
723
+ name: "Select",
724
+ state: "open"
725
+ });
726
+ const listRef = import_react.useRef([]);
727
+ const labelsRef = import_react.useRef([]);
728
+ const popupRef = import_react.useRef(null);
729
+ const scrollHandlerRef = import_react.useRef(null);
730
+ const scrollArrowsMountedCountRef = import_react.useRef(0);
731
+ const valueRef = import_react.useRef(null);
732
+ const valuesRef = import_react.useRef([]);
733
+ const typingRef = import_react.useRef(false);
734
+ const firstItemTextRef = import_react.useRef(null);
735
+ const selectedItemTextRef = import_react.useRef(null);
736
+ const selectionRef = import_react.useRef({
737
+ allowSelectedMouseUp: false,
738
+ allowUnselectedMouseUp: false,
739
+ dragY: 0
740
+ });
741
+ const alignItemWithTriggerActiveRef = import_react.useRef(false);
742
+ const initialValueRef = import_react.useRef(value);
743
+ const { openMethod, triggerProps: interactionTypeProps } = useOpenInteractionType(open);
744
+ const store = useRefWithInit(() => new ReactStore({
745
+ id: generatedId,
746
+ labelId: void 0,
747
+ modal,
748
+ multiple,
749
+ disabled,
750
+ readOnly,
751
+ required,
752
+ highlightItemOnHover,
753
+ itemToStringLabel,
754
+ itemToStringValue,
755
+ isItemEqualToValue,
756
+ value,
757
+ open,
758
+ mounted: open,
759
+ transitionStatus: void 0,
760
+ items,
761
+ forceMount: false,
762
+ openMethod: null,
763
+ activeIndex: null,
764
+ selectedIndex: null,
765
+ popupProps: EMPTY_OBJECT,
766
+ triggerProps: EMPTY_OBJECT,
767
+ itemRoot: {
768
+ props: EMPTY_OBJECT,
769
+ multiple,
770
+ disabled,
771
+ readOnly,
772
+ isItemEqualToValue
773
+ },
774
+ triggerElement: null,
775
+ positionerElement: null,
776
+ listElement: null,
777
+ popupSide: null,
778
+ scrollUpArrowVisible: false,
779
+ scrollDownArrowVisible: false,
780
+ hasScrollArrows: false
781
+ }, {
782
+ setValue: NOOP,
783
+ setOpen: NOOP,
784
+ handleScrollArrowVisibility: NOOP,
785
+ onOpenChangeComplete: NOOP,
786
+ listRef,
787
+ popupRef,
788
+ scrollHandlerRef,
789
+ scrollArrowsMountedCountRef,
790
+ valueRef,
791
+ valuesRef,
792
+ labelsRef,
793
+ typingRef,
794
+ selectionRef,
795
+ firstItemTextRef,
796
+ selectedItemTextRef,
797
+ alignItemWithTriggerActiveRef,
798
+ initialValueRef
799
+ }, selectors)).current;
800
+ const [preventUnmountOnClose, setPreventUnmountOnClose] = import_react.useState(false);
801
+ const { mounted, transitionStatus, forceUnmount: handleUnmount } = useUnmountAfterClose({
802
+ open,
803
+ ref: popupRef,
804
+ preventUnmountOnClose,
805
+ setPreventUnmountOnClose,
806
+ onUnmount() {
807
+ store.update({
808
+ activeIndex: null,
809
+ openMethod: null,
810
+ scrollUpArrowVisible: false,
811
+ scrollDownArrowVisible: false
812
+ });
813
+ onOpenChangeComplete?.(false);
814
+ }
815
+ });
816
+ const activeIndex = store.useState("activeIndex");
817
+ const selectedIndex = store.useState("selectedIndex");
818
+ const triggerElement = store.useState("triggerElement");
819
+ const positionerElement = store.useState("positionerElement");
820
+ const previousOpenMethod = usePreviousValue(openMethod);
821
+ const renderedOpenMethod = openMethod ?? previousOpenMethod;
822
+ const serializedValue = import_react.useMemo(() => {
823
+ if (multiple) return "";
824
+ return stringifyAsValue(value, itemToStringValue);
825
+ }, [
826
+ multiple,
827
+ value,
828
+ itemToStringValue
829
+ ]);
830
+ const fieldStringValue = import_react.useMemo(() => {
831
+ if (multiple && Array.isArray(value)) return value.map((currentValue) => stringifyAsValue(currentValue, itemToStringValue));
832
+ return stringifyAsValue(value, itemToStringValue);
833
+ }, [
834
+ multiple,
835
+ value,
836
+ itemToStringValue
837
+ ]);
838
+ const controlRef = useValueAsRef(triggerElement);
839
+ const getStringifiedValueForForm = useStableCallback(() => fieldStringValue);
840
+ useRegisterFieldControl(controlRef, generatedId, value, getStringifiedValueForForm, !disabled, nameProp);
841
+ const hasSelectedValue = multiple ? Array.isArray(value) && value.length > 0 : value != null && serializedValue !== "";
842
+ useIsoLayoutEffect(() => {
843
+ setFilled(hasSelectedValue);
844
+ }, [hasSelectedValue, setFilled]);
845
+ useIsoLayoutEffect(function syncSelectedIndex() {
846
+ const nextIndex = findSelectionIndex(valuesRef.current, value, isItemEqualToValue, multiple);
847
+ if (nextIndex === null) selectedItemTextRef.current = null;
848
+ if (open) return;
849
+ store.set("selectedIndex", nextIndex);
850
+ }, [
851
+ multiple,
852
+ open,
853
+ value,
854
+ isItemEqualToValue,
855
+ store
856
+ ]);
857
+ useValueChanged(value, () => {
858
+ clearErrors(name);
859
+ setDirty(isSelectedValueDirty(value, validityData.initialValue, isItemEqualToValue));
860
+ validation.change(value);
861
+ });
862
+ const setOpen = useStableCallback((nextOpen, eventDetails) => {
863
+ const openEventDetails = eventDetails;
864
+ const shouldPreventUnmountOnClose = attachPreventUnmountOnClose(openEventDetails);
865
+ onOpenChange?.(nextOpen, openEventDetails);
866
+ if (eventDetails.isCanceled) return;
867
+ if (!nextOpen) setPreventUnmountOnClose(shouldPreventUnmountOnClose());
868
+ setOpenUnwrapped(nextOpen);
869
+ if (!nextOpen && (eventDetails.reason === "focus-out" || eventDetails.reason === "outside-press")) {
870
+ setTouched(true);
871
+ setFocused(false);
872
+ if (validationMode === "onBlur") validation.commit(value);
873
+ }
874
+ });
875
+ import_react.useImperativeHandle(actionsRef, () => ({
876
+ unmount: handleUnmount,
877
+ close: () => {
878
+ if (store.state.open) setOpen(false, createChangeEventDetails(imperativeAction));
879
+ }
880
+ }), [
881
+ handleUnmount,
882
+ setOpen,
883
+ store
884
+ ]);
885
+ const setValue = useStableCallback((nextValue, eventDetails) => {
886
+ onValueChange?.(nextValue, eventDetails);
887
+ if (eventDetails.isCanceled) return;
888
+ setValueUnwrapped(nextValue);
889
+ });
890
+ const handleScrollArrowVisibility = useStableCallback((scroller) => {
891
+ const maxScrollTop = getMaxScrollOffset(scroller.scrollHeight, scroller.clientHeight);
892
+ const scrollTop = normalizeScrollOffset(scroller.scrollTop, maxScrollTop);
893
+ const shouldShowUp = scrollTop > 0;
894
+ const shouldShowDown = scrollTop < maxScrollTop;
895
+ store.set("scrollUpArrowVisible", shouldShowUp);
896
+ store.set("scrollDownArrowVisible", shouldShowDown);
897
+ });
898
+ const floatingContext = useFloatingRootContext({
899
+ open,
900
+ onOpenChange: setOpen,
901
+ elements: {
902
+ reference: triggerElement,
903
+ floating: positionerElement
904
+ }
905
+ });
906
+ const click = useClick(floatingContext, {
907
+ enabled: !disabled,
908
+ event: "mousedown"
909
+ });
910
+ const dismiss = useDismiss(floatingContext);
911
+ const listNavigation = useListNavigation(floatingContext, {
912
+ enabled: !disabled,
913
+ listRef,
914
+ activeIndex,
915
+ selectedIndex,
916
+ disabledIndices: EMPTY_ARRAY,
917
+ onNavigate(nextActiveIndex) {
918
+ if (nextActiveIndex === null && !open) return;
919
+ store.set("activeIndex", nextActiveIndex);
920
+ },
921
+ focusItemOnHover: highlightItemOnHover
922
+ });
923
+ const typeahead = useTypeahead(floatingContext, {
924
+ enabled: !disabled && (open || !readOnly && !multiple),
925
+ listRef: labelsRef,
926
+ activeIndex,
927
+ selectedIndex,
928
+ disabledIndices: (index) => isElementDisabled(listRef.current[index]),
929
+ onMatch(index) {
930
+ if (open) store.set("activeIndex", index);
931
+ else setValue(valuesRef.current[index], createChangeEventDetails(none));
932
+ },
933
+ onTyping(typing) {
934
+ typingRef.current = typing;
935
+ }
936
+ });
937
+ const mergedTriggerProps = import_react.useMemo(() => mergeProps(typeahead.reference, listNavigation.reference, dismiss.reference, click.reference, interactionTypeProps), [
938
+ click.reference,
939
+ typeahead.reference,
940
+ listNavigation.reference,
941
+ dismiss.reference,
942
+ interactionTypeProps
943
+ ]);
944
+ const popupProps = import_react.useMemo(() => mergeProps(FOCUSABLE_POPUP_PROPS, typeahead.floating, listNavigation.floating, dismiss.floating), [
945
+ typeahead.floating,
946
+ listNavigation.floating,
947
+ dismiss.floating
948
+ ]);
949
+ const itemProps = listNavigation.item ?? EMPTY_OBJECT;
950
+ const itemRoot = import_react.useMemo(() => ({
951
+ props: itemProps,
952
+ multiple,
953
+ disabled,
954
+ readOnly,
955
+ isItemEqualToValue
956
+ }), [
957
+ itemProps,
958
+ multiple,
959
+ disabled,
960
+ readOnly,
961
+ isItemEqualToValue
962
+ ]);
963
+ store.useContextCallback("setValue", setValue);
964
+ store.useContextCallback("setOpen", setOpen);
965
+ store.useContextCallback("handleScrollArrowVisibility", handleScrollArrowVisibility);
966
+ store.useContextCallback("onOpenChangeComplete", onOpenChangeComplete);
967
+ useOnFirstRender(() => {
968
+ store.update({
969
+ popupProps,
970
+ triggerProps: mergedTriggerProps,
971
+ itemRoot
972
+ });
973
+ });
974
+ store.useSyncedValues({
975
+ id: generatedId,
976
+ modal,
977
+ multiple,
978
+ disabled,
979
+ readOnly,
980
+ required,
981
+ highlightItemOnHover,
982
+ value,
983
+ open,
984
+ mounted,
985
+ transitionStatus,
986
+ popupProps,
987
+ triggerProps: mergedTriggerProps,
988
+ itemRoot,
989
+ items,
990
+ itemToStringLabel,
991
+ itemToStringValue,
992
+ isItemEqualToValue,
993
+ openMethod: renderedOpenMethod
994
+ });
995
+ const ref = useMergedRefs(inputRef, validation.inputRef);
996
+ const hiddenInputName = multiple ? void 0 : name;
997
+ const hiddenInputs = import_react.useMemo(() => {
998
+ if (!multiple || !Array.isArray(value) || !name) return null;
999
+ return value.map((v) => {
1000
+ const currentSerializedValue = stringifyAsValue(v, itemToStringValue);
1001
+ return /*#__PURE__*/ (0, import_jsx_runtime.jsx)("input", {
1002
+ type: "hidden",
1003
+ form,
1004
+ name,
1005
+ value: currentSerializedValue,
1006
+ disabled
1007
+ }, currentSerializedValue);
1008
+ });
1009
+ }, [
1010
+ multiple,
1011
+ value,
1012
+ form,
1013
+ name,
1014
+ itemToStringValue,
1015
+ disabled
1016
+ ]);
1017
+ return /*#__PURE__*/ (0, import_jsx_runtime.jsxs)(SelectRootContext.Provider, {
1018
+ value: store,
1019
+ children: [
1020
+ /*#__PURE__*/ (0, import_jsx_runtime.jsx)(SelectFloatingContext.Provider, {
1021
+ value: floatingContext,
1022
+ children
1023
+ }),
1024
+ /*#__PURE__*/ (0, import_jsx_runtime.jsx)("input", {
1025
+ ...validation.getValidationProps(disabled, {
1026
+ onFocus() {
1027
+ store.state.triggerElement?.focus({ focusVisible: true });
1028
+ },
1029
+ onChange(event) {
1030
+ if (event.nativeEvent.defaultPrevented || disabled || readOnly) return;
1031
+ const nextValue = event.currentTarget.value;
1032
+ const details = createChangeEventDetails(none, event.nativeEvent);
1033
+ function handleChange() {
1034
+ if (multiple) return;
1035
+ const nextValueLower = nextValue.toLowerCase();
1036
+ let matchingIndex = valuesRef.current.findIndex((candidate) => stringifyAsValue(candidate, itemToStringValue).toLowerCase() === nextValueLower || stringifyAsLabel(candidate, itemToStringLabel).toLowerCase() === nextValueLower);
1037
+ if (matchingIndex === -1) matchingIndex = valuesRef.current.findIndex((_, index) => {
1038
+ const renderedLabel = labelsRef.current[index];
1039
+ return renderedLabel != null && renderedLabel.toLowerCase() === nextValueLower;
1040
+ });
1041
+ const matchingValue = valuesRef.current[matchingIndex];
1042
+ if (matchingValue != null) setValue(matchingValue, details);
1043
+ }
1044
+ store.set("forceMount", true);
1045
+ queueMicrotask(handleChange);
1046
+ }
1047
+ }),
1048
+ id: generatedId && hiddenInputName == null ? `${generatedId}-hidden-input` : void 0,
1049
+ form,
1050
+ name: hiddenInputName,
1051
+ autoComplete,
1052
+ value: serializedValue,
1053
+ disabled,
1054
+ required: required && !(multiple && hasSelectedValue),
1055
+ readOnly,
1056
+ ref,
1057
+ style: name ? visuallyHiddenInput : visuallyHidden,
1058
+ tabIndex: -1,
1059
+ "aria-hidden": true,
1060
+ suppressHydrationWarning: true
1061
+ }),
1062
+ hiddenInputs
1063
+ ]
1064
+ });
1065
+ }
1066
+ /**
1067
+ * Indicates which side the corresponding popup is positioned relative to its anchor.
1068
+ * @type {'top' | 'bottom' | 'left' | 'right' | 'inline-end' | 'inline-start' | null}
1069
+ */
1070
+ var popupSide = "data-popup-side";
1071
+ // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/select/trigger/SelectTrigger.mjs
1072
+ var SELECTED_DELAY = 400;
1073
+ var stateAttributesMapping$2 = {
1074
+ ...pressableTriggerOpenStateMapping,
1075
+ ...fieldValidityMapping,
1076
+ popupSide: (side) => side ? { [popupSide]: side } : null,
1077
+ value: () => null
1078
+ };
1079
+ /**
1080
+ * A button that opens the select popup.
1081
+ * Renders a `<button>` element.
1082
+ *
1083
+ * Documentation: [Base UI Select](https://base-ui.com/react/components/select)
1084
+ */
1085
+ var SelectTrigger$1 = /*#__PURE__*/ import_react.forwardRef(function SelectTrigger(componentProps, forwardedRef) {
1086
+ const { render, className, id: idProp, disabled: disabledProp = false, nativeButton = true, style, ...elementProps } = componentProps;
1087
+ const { setTouched, validationMode, validation, state: fieldState, disabled: fieldDisabled } = useFieldRootContext();
1088
+ const { labelId: fieldLabelId } = useLabelableContext();
1089
+ const store = useSelectRootContext();
1090
+ const readOnly = store.useState("readOnly");
1091
+ const required = store.useState("required");
1092
+ const selectDisabled = store.useState("disabled");
1093
+ const disabled = fieldDisabled || selectDisabled || disabledProp;
1094
+ const open = store.useState("open");
1095
+ const mounted = store.useState("mounted");
1096
+ const value = store.useState("value");
1097
+ const triggerProps = store.useState("triggerProps");
1098
+ const positionerElement = store.useState("positionerElement");
1099
+ const listElement = store.useState("listElement");
1100
+ const popupSideValue = store.useState("popupSide");
1101
+ const rootId = store.useState("id");
1102
+ const selectLabelId = store.useState("labelId");
1103
+ const hasSelectedValue = store.useState("hasSelectedValue");
1104
+ const popupSide = mounted && positionerElement ? popupSideValue : null;
1105
+ const id = idProp ?? rootId;
1106
+ const ariaLabelledBy = resolveAriaLabelledBy(fieldLabelId, selectLabelId);
1107
+ useLabelableId({ id: idProp });
1108
+ const positionerRef = useValueAsRef(positionerElement);
1109
+ const triggerRef = import_react.useRef(null);
1110
+ const setFocused = useSetFieldFocused(disabled, triggerRef);
1111
+ const { getButtonProps, buttonRef } = useButton({
1112
+ disabled,
1113
+ native: nativeButton
1114
+ });
1115
+ const setTriggerElement = store.useStateSetter("triggerElement");
1116
+ const timeoutFocus = useTimeout();
1117
+ const timeoutMouseDown = useTimeout();
1118
+ const selectedDelayTimeout = useTimeout();
1119
+ import_react.useEffect(() => {
1120
+ if (open) {
1121
+ selectedDelayTimeout.start(SELECTED_DELAY, () => {
1122
+ store.context.selectionRef.current.allowUnselectedMouseUp = true;
1123
+ store.context.selectionRef.current.allowSelectedMouseUp = true;
1124
+ });
1125
+ return () => {
1126
+ selectedDelayTimeout.clear();
1127
+ };
1128
+ }
1129
+ store.context.selectionRef.current = {
1130
+ allowSelectedMouseUp: false,
1131
+ allowUnselectedMouseUp: false,
1132
+ dragY: 0
1133
+ };
1134
+ timeoutMouseDown.clear();
1135
+ }, [
1136
+ open,
1137
+ store,
1138
+ timeoutMouseDown,
1139
+ selectedDelayTimeout
1140
+ ]);
1141
+ const mergedProps = mergeProps(triggerProps, {
1142
+ id,
1143
+ role: "combobox",
1144
+ "aria-expanded": open,
1145
+ "aria-haspopup": "listbox",
1146
+ "aria-controls": open ? listElement?.id ?? getFloatingFocusElement(positionerElement)?.id : void 0,
1147
+ "aria-labelledby": ariaLabelledBy,
1148
+ "aria-readonly": readOnly || void 0,
1149
+ "aria-required": required || void 0,
1150
+ tabIndex: disabled ? -1 : 0,
1151
+ onFocus(event) {
1152
+ setFocused(true);
1153
+ if (open && store.context.alignItemWithTriggerActiveRef.current) store.context.setOpen(false, createChangeEventDetails(none, event.nativeEvent));
1154
+ timeoutFocus.start(0, () => {
1155
+ store.set("forceMount", true);
1156
+ });
1157
+ },
1158
+ onBlur(event) {
1159
+ if (contains(positionerElement, event.relatedTarget)) return;
1160
+ setTouched(true);
1161
+ setFocused(false);
1162
+ if (validationMode === "onBlur") validation.commit(value);
1163
+ },
1164
+ onMouseDown(event) {
1165
+ if (open) return;
1166
+ const doc = ownerDocument(event.currentTarget);
1167
+ function handleMouseUp(mouseEvent) {
1168
+ if (!triggerRef.current) return;
1169
+ const mouseUpTarget = mouseEvent.target;
1170
+ if (contains(triggerRef.current, mouseUpTarget) || contains(positionerRef.current, mouseUpTarget)) return;
1171
+ if (isMouseWithinBounds(mouseEvent, triggerRef.current)) return;
1172
+ store.context.setOpen(false, createChangeEventDetails(cancelOpen, mouseEvent));
1173
+ }
1174
+ timeoutMouseDown.start(0, () => {
1175
+ doc.addEventListener("mouseup", handleMouseUp, { once: true });
1176
+ });
1177
+ }
1178
+ }, elementProps, getButtonProps);
1179
+ const props = validation.getValidationProps(disabled, mergedProps);
1180
+ props.role = "combobox";
1181
+ const state = {
1182
+ ...fieldState,
1183
+ open,
1184
+ disabled,
1185
+ value,
1186
+ readOnly,
1187
+ popupSide,
1188
+ placeholder: !hasSelectedValue
1189
+ };
1190
+ return useRenderElement("button", componentProps, {
1191
+ ref: [
1192
+ forwardedRef,
1193
+ triggerRef,
1194
+ buttonRef,
1195
+ setTriggerElement
1196
+ ],
1197
+ state,
1198
+ stateAttributesMapping: stateAttributesMapping$2,
1199
+ props
1200
+ });
1201
+ });
1202
+ // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/select/value/SelectValue.mjs
1203
+ var stateAttributesMapping$1 = { value: () => null };
1204
+ /**
1205
+ * A text label of the currently selected item.
1206
+ * Renders a `<span>` element.
1207
+ *
1208
+ * Documentation: [Base UI Select](https://base-ui.com/react/components/select)
1209
+ */
1210
+ var SelectValue$1 = /*#__PURE__*/ import_react.forwardRef(function SelectValue(componentProps, forwardedRef) {
1211
+ const { className, render, children: childrenProp, placeholder, style, ...elementProps } = componentProps;
1212
+ const store = useSelectRootContext();
1213
+ const value = store.useState("value");
1214
+ const items = store.useState("items");
1215
+ const itemToStringLabel = store.useState("itemToStringLabel");
1216
+ const hasSelectedValue = store.useState("hasSelectedValue");
1217
+ const shouldCheckNullItemLabel = !hasSelectedValue && placeholder != null && childrenProp == null;
1218
+ const hasNullLabel = store.useState("hasNullItemLabel", shouldCheckNullItemLabel);
1219
+ const state = {
1220
+ value,
1221
+ placeholder: !hasSelectedValue
1222
+ };
1223
+ let children = null;
1224
+ if (typeof childrenProp === "function") children = childrenProp(value);
1225
+ else if (childrenProp != null) children = childrenProp;
1226
+ else if (shouldCheckNullItemLabel && !hasNullLabel) children = placeholder;
1227
+ else if (Array.isArray(value)) children = resolveMultipleLabels(value, items, itemToStringLabel);
1228
+ else children = resolveSelectedLabel(value, items, itemToStringLabel);
1229
+ return useRenderElement("span", componentProps, {
1230
+ state,
1231
+ ref: [forwardedRef, store.context.valueRef],
1232
+ props: [{ children }, elementProps],
1233
+ stateAttributesMapping: stateAttributesMapping$1
1234
+ });
1235
+ });
1236
+ // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/select/icon/SelectIcon.mjs
1237
+ /**
1238
+ * An icon that indicates that the trigger button opens a select popup.
1239
+ * Renders a `<span>` element.
1240
+ *
1241
+ * Documentation: [Base UI Select](https://base-ui.com/react/components/select)
1242
+ */
1243
+ var SelectIcon = /*#__PURE__*/ import_react.forwardRef(function SelectIcon(componentProps, forwardedRef) {
1244
+ const { render, className, style, ...elementProps } = componentProps;
1245
+ const state = { open: useSelectRootContext().useState("open") };
1246
+ return useRenderElement("span", componentProps, {
1247
+ state,
1248
+ ref: forwardedRef,
1249
+ props: [{
1250
+ "aria-hidden": true,
1251
+ children: "▼"
1252
+ }, elementProps],
1253
+ stateAttributesMapping: triggerOpenStateMapping
1254
+ });
1255
+ });
1256
+ // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/select/portal/SelectPortal.mjs
1257
+ /**
1258
+ * A portal element that moves the popup to a different part of the DOM.
1259
+ * By default, the portal element is appended to `<body>`.
1260
+ * Renders a `<div>` element.
1261
+ *
1262
+ * Documentation: [Base UI Select](https://base-ui.com/react/components/select)
1263
+ */
1264
+ var SelectPortal = /*#__PURE__*/ import_react.forwardRef(function SelectPortal(portalProps, forwardedRef) {
1265
+ const store = useSelectRootContext();
1266
+ const mounted = store.useState("mounted");
1267
+ const forceMount = store.useState("forceMount");
1268
+ if (!(mounted || forceMount)) return null;
1269
+ return /*#__PURE__*/ (0, import_jsx_runtime.jsx)(FloatingPortal, {
1270
+ ref: forwardedRef,
1271
+ ...portalProps
1272
+ });
1273
+ });
1274
+ // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/select/positioner/SelectPositionerContext.mjs
1275
+ var SelectPositionerContext = /*#__PURE__*/ import_react.createContext(void 0);
1276
+ function useSelectPositionerContext() {
1277
+ const context = import_react.useContext(SelectPositionerContext);
1278
+ if (!context) throw new Error(formatErrorMessage(59));
1279
+ return context;
1280
+ }
1281
+ // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/select/popup/utils.mjs
1282
+ function clearStyles(element, originalStyles) {
1283
+ if (element) Object.assign(element.style, originalStyles);
1284
+ }
1285
+ var LIST_FUNCTIONAL_STYLES = {
1286
+ position: "relative",
1287
+ maxHeight: "100%",
1288
+ overflowX: "hidden",
1289
+ overflowY: "auto"
1290
+ };
1291
+ // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/select/positioner/SelectPositioner.mjs
1292
+ var FIXED = { position: "fixed" };
1293
+ /**
1294
+ * Positions the select popup.
1295
+ * Renders a `<div>` element.
1296
+ *
1297
+ * Documentation: [Base UI Select](https://base-ui.com/react/components/select)
1298
+ */
1299
+ var SelectPositioner = /*#__PURE__*/ import_react.forwardRef(function SelectPositioner(componentProps, forwardedRef) {
1300
+ const { anchor, className, render, positionMethod, side, align, sideOffset, alignOffset, collisionBoundary = "clipping-ancestors", collisionPadding, arrowPadding, sticky, disableAnchorTracking, alignItemWithTrigger = true, collisionAvoidance = DROPDOWN_COLLISION_AVOIDANCE, style, ...elementProps } = componentProps;
1301
+ const store = useSelectRootContext();
1302
+ const floatingRootContext = useSelectFloatingContext();
1303
+ const open = store.useState("open");
1304
+ const mounted = store.useState("mounted");
1305
+ const modal = store.useState("modal");
1306
+ const value = store.useState("value");
1307
+ const openMethod = store.useState("openMethod");
1308
+ const positionerElement = store.useState("positionerElement");
1309
+ const triggerElement = store.useState("triggerElement");
1310
+ const isItemEqualToValue = store.useState("isItemEqualToValue");
1311
+ const transitionStatus = store.useState("transitionStatus");
1312
+ const scrollUpArrowRef = import_react.useRef(null);
1313
+ const scrollDownArrowRef = import_react.useRef(null);
1314
+ const [controlledAlignItemWithTrigger, setControlledAlignItemWithTrigger] = import_react.useState(alignItemWithTrigger);
1315
+ const alignItemWithTriggerActive = mounted && controlledAlignItemWithTrigger && openMethod !== "touch";
1316
+ if (!mounted && controlledAlignItemWithTrigger !== alignItemWithTrigger) setControlledAlignItemWithTrigger(alignItemWithTrigger);
1317
+ import_react.useImperativeHandle(store.context.alignItemWithTriggerActiveRef, () => alignItemWithTriggerActive);
1318
+ useAnchoredPopupScrollLock((alignItemWithTriggerActive || modal) && open, openMethod === "touch", positionerElement, triggerElement);
1319
+ const positioning = useAnchorPositioning({
1320
+ anchor,
1321
+ floatingRootContext,
1322
+ positionMethod,
1323
+ mounted,
1324
+ side,
1325
+ sideOffset,
1326
+ align,
1327
+ alignOffset,
1328
+ arrowPadding,
1329
+ collisionBoundary,
1330
+ collisionPadding,
1331
+ sticky,
1332
+ disableAnchorTracking: disableAnchorTracking ?? alignItemWithTriggerActive,
1333
+ collisionAvoidance,
1334
+ keepMounted: true
1335
+ });
1336
+ const renderedSide = alignItemWithTriggerActive ? "none" : positioning.side;
1337
+ const positionerStyles = alignItemWithTriggerActive ? FIXED : positioning.positionerStyles;
1338
+ const state = {
1339
+ open,
1340
+ side: renderedSide,
1341
+ align: positioning.align,
1342
+ anchorHidden: positioning.anchorHidden
1343
+ };
1344
+ useIsoLayoutEffect(() => {
1345
+ store.set("popupSide", positioning.side);
1346
+ }, [store, positioning.side]);
1347
+ const setPositionerElement = store.useStateSetter("positionerElement");
1348
+ const element = usePositioner(componentProps, state, {
1349
+ styles: positionerStyles,
1350
+ transitionStatus,
1351
+ props: elementProps,
1352
+ refs: [forwardedRef, setPositionerElement],
1353
+ hidden: !mounted,
1354
+ inert: !open
1355
+ });
1356
+ const prevMapSizeRef = import_react.useRef(0);
1357
+ const onMapChange = useStableCallback((map) => {
1358
+ if (store.context.valuesRef.current.length === 0) return;
1359
+ const prevSize = prevMapSizeRef.current;
1360
+ prevMapSizeRef.current = map.size;
1361
+ const eventDetails = createChangeEventDetails(none);
1362
+ if (prevSize !== 0 && !store.state.multiple && value !== null) {
1363
+ if (findItemIndex(store.context.valuesRef.current, value, isItemEqualToValue) === -1) {
1364
+ const initialSelectedValue = store.context.initialValueRef.current;
1365
+ const nextValue = initialSelectedValue != null && findItemIndex(store.context.valuesRef.current, initialSelectedValue, isItemEqualToValue) !== -1 ? initialSelectedValue : null;
1366
+ store.context.setValue(nextValue, eventDetails);
1367
+ if (nextValue === null) {
1368
+ store.set("selectedIndex", null);
1369
+ store.context.selectedItemTextRef.current = null;
1370
+ }
1371
+ }
1372
+ }
1373
+ if (prevSize !== 0 && store.state.multiple && Array.isArray(value)) {
1374
+ const nextValue = value.filter((selectedItemValue) => findItemIndex(store.context.valuesRef.current, selectedItemValue, isItemEqualToValue) !== -1);
1375
+ if (nextValue.length !== value.length) {
1376
+ store.context.setValue(nextValue, eventDetails);
1377
+ if (nextValue.length === 0) {
1378
+ store.set("selectedIndex", null);
1379
+ store.context.selectedItemTextRef.current = null;
1380
+ }
1381
+ }
1382
+ }
1383
+ if (open && alignItemWithTriggerActive) {
1384
+ store.update({
1385
+ scrollUpArrowVisible: false,
1386
+ scrollDownArrowVisible: false
1387
+ });
1388
+ const stylesToClear = { height: "" };
1389
+ clearStyles(positionerElement, stylesToClear);
1390
+ clearStyles(store.context.popupRef.current, stylesToClear);
1391
+ }
1392
+ });
1393
+ const contextValue = import_react.useMemo(() => ({
1394
+ ...positioning,
1395
+ side: renderedSide,
1396
+ alignItemWithTriggerActive,
1397
+ setControlledAlignItemWithTrigger,
1398
+ scrollUpArrowRef,
1399
+ scrollDownArrowRef
1400
+ }), [
1401
+ positioning,
1402
+ renderedSide,
1403
+ alignItemWithTriggerActive,
1404
+ setControlledAlignItemWithTrigger
1405
+ ]);
1406
+ return /*#__PURE__*/ (0, import_jsx_runtime.jsx)(CompositeList, {
1407
+ elementsRef: store.context.listRef,
1408
+ labelsRef: store.context.labelsRef,
1409
+ onMapChange,
1410
+ children: /*#__PURE__*/ (0, import_jsx_runtime.jsxs)(SelectPositionerContext.Provider, {
1411
+ value: contextValue,
1412
+ children: [mounted && modal && /*#__PURE__*/ (0, import_jsx_runtime.jsx)(InternalBackdrop, {
1413
+ inert: inertValue(!open),
1414
+ cutout: triggerElement
1415
+ }), element]
1416
+ })
1417
+ });
1418
+ });
1419
+ // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/utils/styles.mjs
1420
+ var DISABLE_SCROLLBAR_CLASS_NAME = "base-ui-disable-scrollbar";
1421
+ var styleDisableScrollbar = {
1422
+ className: DISABLE_SCROLLBAR_CLASS_NAME,
1423
+ getElement(nonce) {
1424
+ return /*#__PURE__*/ (0, import_jsx_runtime.jsx)("style", {
1425
+ nonce,
1426
+ href: DISABLE_SCROLLBAR_CLASS_NAME,
1427
+ precedence: "base-ui:low",
1428
+ children: `.${DISABLE_SCROLLBAR_CLASS_NAME}{scrollbar-width:none}.${DISABLE_SCROLLBAR_CLASS_NAME}::-webkit-scrollbar{display:none}`
1429
+ });
1430
+ }
1431
+ };
1432
+ // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/internals/csp-context/CSPContext.mjs
1433
+ var CSPContext = /*#__PURE__*/ import_react.createContext(void 0);
1434
+ var DEFAULT_CSP_CONTEXT_VALUE = { disableStyleElements: false };
1435
+ function useCSPContext() {
1436
+ return import_react.useContext(CSPContext) ?? DEFAULT_CSP_CONTEXT_VALUE;
1437
+ }
1438
+ // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/select/positioner/SelectPositionerCssVars.mjs
1439
+ /**
1440
+ * The coordinates that this element is anchored to. Used for animations and transitions.
1441
+ * @type {string}
1442
+ */
1443
+ var transformOrigin = "--transform-origin";
1444
+ // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/select/popup/SelectPopup.mjs
1445
+ var stateAttributesMapping = {
1446
+ ...popupStateMapping,
1447
+ ...transitionStatusMapping
1448
+ };
1449
+ /**
1450
+ * A container for the select list.
1451
+ * Renders a `<div>` element.
1452
+ *
1453
+ * Documentation: [Base UI Select](https://base-ui.com/react/components/select)
1454
+ */
1455
+ var SelectPopup = /*#__PURE__*/ import_react.forwardRef(function SelectPopup(componentProps, forwardedRef) {
1456
+ const { render, className, style, finalFocus, ...elementProps } = componentProps;
1457
+ const store = useSelectRootContext();
1458
+ const multiple = store.useState("multiple");
1459
+ const readOnly = store.useState("readOnly");
1460
+ const highlightItemOnHover = store.useState("highlightItemOnHover");
1461
+ const floatingRootContext = useSelectFloatingContext();
1462
+ const { side, align, alignItemWithTriggerActive, isPositioned, setControlledAlignItemWithTrigger } = useSelectPositionerContext();
1463
+ const insideToolbar = useToolbarRootContext(true) != null;
1464
+ const direction = useDirection();
1465
+ const { nonce, disableStyleElements } = useCSPContext();
1466
+ const id = store.useState("id");
1467
+ const open = store.useState("open");
1468
+ const openMethod = store.useState("openMethod");
1469
+ const mounted = store.useState("mounted");
1470
+ const popupProps = store.useState("popupProps");
1471
+ const transitionStatus = store.useState("transitionStatus");
1472
+ const triggerElement = store.useState("triggerElement");
1473
+ const positionerElement = store.useState("positionerElement");
1474
+ const listElement = store.useState("listElement");
1475
+ const reachedMaxHeightRef = import_react.useRef(false);
1476
+ const initialPlacedRef = import_react.useRef(false);
1477
+ const originalPositionerStylesRef = import_react.useRef({});
1478
+ const scrollArrowFrame = useAnimationFrame();
1479
+ const handleScroll = useStableCallback((scroller) => {
1480
+ if (!positionerElement || !store.context.popupRef.current || !initialPlacedRef.current) return;
1481
+ const isTopPositioned = positionerElement.style.top === "0px";
1482
+ const isBottomPositioned = positionerElement.style.bottom === "0px";
1483
+ if (reachedMaxHeightRef.current || !alignItemWithTriggerActive || !isTopPositioned && !isBottomPositioned) {
1484
+ store.context.handleScrollArrowVisibility(scroller);
1485
+ return;
1486
+ }
1487
+ const scale = getScale(positionerElement);
1488
+ const currentHeight = normalizeSize(positionerElement.getBoundingClientRect().height, "y", scale);
1489
+ const doc = ownerDocument(positionerElement);
1490
+ const win = getWindow(positionerElement);
1491
+ const positionerStyles = win.getComputedStyle(positionerElement);
1492
+ const marginTop = parseFloat(positionerStyles.marginTop);
1493
+ const marginBottom = parseFloat(positionerStyles.marginBottom);
1494
+ const maxPopupHeight = getMaxPopupHeight(win.getComputedStyle(store.context.popupRef.current));
1495
+ const maxAvailableHeight = Math.min(doc.documentElement.clientHeight - marginTop - marginBottom, maxPopupHeight);
1496
+ const scrollTop = scroller.scrollTop;
1497
+ const maxScrollTop = getMaxScrollTop(scroller);
1498
+ let nextScrollTop = null;
1499
+ const setHeight = (height) => {
1500
+ positionerElement.style.height = `${height}px`;
1501
+ };
1502
+ const diff = isTopPositioned ? maxScrollTop - scrollTop : scrollTop;
1503
+ const nextHeight = Math.min(currentHeight + diff, maxAvailableHeight);
1504
+ if (diff <= 1) {
1505
+ const heightDelta = clamp(diff, 0, maxAvailableHeight - currentHeight);
1506
+ if (heightDelta > 0) setHeight(currentHeight + heightDelta);
1507
+ scroller.scrollTop = isTopPositioned ? maxScrollTop : 0;
1508
+ if (maxAvailableHeight - (currentHeight + heightDelta) <= 1) reachedMaxHeightRef.current = true;
1509
+ store.context.handleScrollArrowVisibility(scroller);
1510
+ return;
1511
+ }
1512
+ if (maxAvailableHeight - nextHeight > 1) nextScrollTop = isTopPositioned ? Infinity : 0;
1513
+ else if (isBottomPositioned && scrollTop < maxScrollTop) nextScrollTop = scrollTop - (diff - (currentHeight + diff - maxAvailableHeight));
1514
+ const nextPositionerHeight = Math.ceil(nextHeight);
1515
+ if (nextPositionerHeight !== 0) setHeight(nextPositionerHeight);
1516
+ if (nextScrollTop != null) {
1517
+ const target = clamp(nextScrollTop, 0, getMaxScrollTop(scroller));
1518
+ if (Math.abs(scroller.scrollTop - target) > 1) scroller.scrollTop = target;
1519
+ }
1520
+ if (nextPositionerHeight >= maxAvailableHeight - 1) reachedMaxHeightRef.current = true;
1521
+ store.context.handleScrollArrowVisibility(scroller);
1522
+ });
1523
+ import_react.useImperativeHandle(store.context.scrollHandlerRef, () => handleScroll, [handleScroll]);
1524
+ useOpenChangeComplete({
1525
+ open,
1526
+ ref: store.context.popupRef,
1527
+ onComplete() {
1528
+ if (open) store.context.onOpenChangeComplete(true);
1529
+ }
1530
+ });
1531
+ const state = {
1532
+ open,
1533
+ transitionStatus,
1534
+ side,
1535
+ align
1536
+ };
1537
+ useIsoLayoutEffect(() => {
1538
+ if (!positionerElement || !store.context.popupRef.current || Object.keys(originalPositionerStylesRef.current).length) return;
1539
+ originalPositionerStylesRef.current = {
1540
+ top: positionerElement.style.top || "0",
1541
+ left: positionerElement.style.left || "0",
1542
+ right: positionerElement.style.right,
1543
+ height: positionerElement.style.height,
1544
+ bottom: positionerElement.style.bottom,
1545
+ minHeight: positionerElement.style.minHeight,
1546
+ maxHeight: positionerElement.style.maxHeight,
1547
+ marginTop: positionerElement.style.marginTop,
1548
+ marginBottom: positionerElement.style.marginBottom
1549
+ };
1550
+ }, [store, positionerElement]);
1551
+ useIsoLayoutEffect(() => {
1552
+ if (open || alignItemWithTriggerActive) return;
1553
+ initialPlacedRef.current = false;
1554
+ reachedMaxHeightRef.current = false;
1555
+ clearStyles(positionerElement, originalPositionerStylesRef.current);
1556
+ }, [
1557
+ open,
1558
+ alignItemWithTriggerActive,
1559
+ positionerElement
1560
+ ]);
1561
+ useIsoLayoutEffect(() => {
1562
+ const popupElement = store.context.popupRef.current;
1563
+ if (!open || !triggerElement || !positionerElement || !popupElement || alignItemWithTriggerActive && !isPositioned || store.state.transitionStatus === "ending") return;
1564
+ initialPlacedRef.current = true;
1565
+ popupElement.style.removeProperty(transformOrigin);
1566
+ if (!alignItemWithTriggerActive) {
1567
+ scrollArrowFrame.request(() => store.context.handleScrollArrowVisibility(listElement || popupElement));
1568
+ return;
1569
+ }
1570
+ const restoreTransformStyles = unsetTransformStyles(popupElement);
1571
+ try {
1572
+ let textElement = store.context.selectedItemTextRef.current;
1573
+ if (!textElement?.isConnected) textElement = !store.select("hasSelectedValue") && store.context.firstItemTextRef.current?.isConnected ? store.context.firstItemTextRef.current : null;
1574
+ const valueElement = store.context.valueRef.current;
1575
+ const win = getWindow(positionerElement);
1576
+ const positionerStyles = win.getComputedStyle(positionerElement);
1577
+ const popupStyles = win.getComputedStyle(popupElement);
1578
+ const doc = ownerDocument(triggerElement);
1579
+ const scale = getScale(triggerElement);
1580
+ const triggerRect = normalizeRect(triggerElement.getBoundingClientRect(), scale);
1581
+ const positionerRect = normalizeRect(positionerElement.getBoundingClientRect(), scale);
1582
+ const triggerHeight = triggerRect.height;
1583
+ const scroller = listElement || popupElement;
1584
+ const scrollHeight = scroller.scrollHeight;
1585
+ const borderBottom = parseFloat(popupStyles.borderBottomWidth);
1586
+ const marginTop = parseFloat(positionerStyles.marginTop) || 10;
1587
+ const marginBottom = parseFloat(positionerStyles.marginBottom) || 10;
1588
+ const minHeight = parseFloat(positionerStyles.minHeight) || 100;
1589
+ const maxPopupHeight = getMaxPopupHeight(popupStyles);
1590
+ const paddingLeft = 5;
1591
+ const paddingRight = 5;
1592
+ const triggerCollisionThreshold = 20;
1593
+ const viewportHeight = doc.documentElement.clientHeight - marginTop - marginBottom;
1594
+ const viewportWidth = doc.documentElement.clientWidth;
1595
+ const availableSpaceBeneathTrigger = viewportHeight - triggerRect.bottom + triggerHeight;
1596
+ let textRect;
1597
+ let alignedLeft = direction === "rtl" ? triggerRect.right - positionerRect.width : triggerRect.left;
1598
+ let offsetY = 0;
1599
+ if (textElement && valueElement) {
1600
+ const valueRect = normalizeRect(valueElement.getBoundingClientRect(), scale);
1601
+ textRect = normalizeRect(textElement.getBoundingClientRect(), scale);
1602
+ alignedLeft = positionerRect.left + (direction === "rtl" ? valueRect.right - textRect.right : valueRect.left - textRect.left);
1603
+ const valueCenterFromTriggerTop = valueRect.top - triggerRect.top + valueRect.height / 2;
1604
+ offsetY = textRect.top - positionerRect.top + textRect.height / 2 - valueCenterFromTriggerTop;
1605
+ }
1606
+ const idealHeight = availableSpaceBeneathTrigger + offsetY + marginBottom + borderBottom;
1607
+ let height = Math.min(viewportHeight, idealHeight);
1608
+ const maxHeight = viewportHeight - marginTop - marginBottom;
1609
+ const scrollTop = idealHeight - height;
1610
+ const maxRight = viewportWidth - paddingRight;
1611
+ positionerElement.style.left = `${clamp(alignedLeft, paddingLeft, maxRight - positionerRect.width)}px`;
1612
+ positionerElement.style.height = `${height}px`;
1613
+ positionerElement.style.maxHeight = "none";
1614
+ positionerElement.style.marginTop = `${marginTop}px`;
1615
+ positionerElement.style.marginBottom = `${marginBottom}px`;
1616
+ popupElement.style.height = "100%";
1617
+ const maxScrollTop = getMaxScrollTop(scroller);
1618
+ const isTopPositioned = scrollTop >= maxScrollTop - 1;
1619
+ if (isTopPositioned) height = Math.min(viewportHeight, positionerRect.height) - (scrollTop - maxScrollTop);
1620
+ const fallbackToAlignPopupToTrigger = triggerRect.top < triggerCollisionThreshold || triggerRect.bottom > viewportHeight - triggerCollisionThreshold || Math.ceil(height) + 1 < Math.min(scrollHeight, minHeight);
1621
+ const isPinchZoomed = (win.visualViewport?.scale ?? 1) !== 1 && webkit;
1622
+ if (fallbackToAlignPopupToTrigger || isPinchZoomed) {
1623
+ clearStyles(positionerElement, originalPositionerStylesRef.current);
1624
+ setControlledAlignItemWithTrigger(false);
1625
+ return;
1626
+ }
1627
+ const initialHeight = Math.max(minHeight, height);
1628
+ if (isTopPositioned) {
1629
+ const topOffset = Math.max(0, viewportHeight - idealHeight);
1630
+ positionerElement.style.top = positionerRect.height >= maxHeight ? "0" : `${topOffset}px`;
1631
+ positionerElement.style.height = `${height}px`;
1632
+ scroller.scrollTop = getMaxScrollTop(scroller);
1633
+ } else {
1634
+ positionerElement.style.bottom = "0";
1635
+ scroller.scrollTop = scrollTop;
1636
+ }
1637
+ if (textRect) {
1638
+ const popupTop = positionerRect.top;
1639
+ const popupHeight = positionerRect.height;
1640
+ const textCenterY = textRect.top + textRect.height / 2;
1641
+ const clampedY = clamp(popupHeight > 0 ? (textCenterY - popupTop) / popupHeight * 100 : 50, 0, 100);
1642
+ popupElement.style.setProperty(transformOrigin, `50% ${clampedY}%`);
1643
+ }
1644
+ if (initialHeight === viewportHeight || height >= maxPopupHeight) reachedMaxHeightRef.current = true;
1645
+ store.context.handleScrollArrowVisibility(scroller);
1646
+ if (highlightItemOnHover && store.state.selectedIndex === null && store.state.activeIndex === null && store.context.listRef.current[0] != null) store.set("activeIndex", 0);
1647
+ } finally {
1648
+ restoreTransformStyles();
1649
+ }
1650
+ }, [
1651
+ store,
1652
+ open,
1653
+ positionerElement,
1654
+ triggerElement,
1655
+ alignItemWithTriggerActive,
1656
+ setControlledAlignItemWithTrigger,
1657
+ scrollArrowFrame,
1658
+ listElement,
1659
+ highlightItemOnHover,
1660
+ direction,
1661
+ isPositioned
1662
+ ]);
1663
+ import_react.useEffect(() => {
1664
+ if (!alignItemWithTriggerActive || !positionerElement || !open) return;
1665
+ const win = getWindow(positionerElement);
1666
+ function handleResize(event) {
1667
+ store.context.setOpen(false, createChangeEventDetails(windowResize, event));
1668
+ }
1669
+ return addEventListener(win, "resize", handleResize);
1670
+ }, [
1671
+ store,
1672
+ alignItemWithTriggerActive,
1673
+ positionerElement,
1674
+ open
1675
+ ]);
1676
+ const defaultProps = {
1677
+ ...listElement ? { role: "presentation" } : {
1678
+ role: "listbox",
1679
+ "aria-multiselectable": multiple || void 0,
1680
+ "aria-readonly": readOnly || void 0,
1681
+ id: `${id}-list`
1682
+ },
1683
+ onKeyDown(event) {
1684
+ if (insideToolbar && COMPOSITE_KEYS.has(event.key)) event.stopPropagation();
1685
+ },
1686
+ onScroll(event) {
1687
+ if (listElement) return;
1688
+ handleScroll(event.currentTarget);
1689
+ },
1690
+ ...alignItemWithTriggerActive && { style: listElement ? { height: "100%" } : LIST_FUNCTIONAL_STYLES },
1691
+ className: !listElement && alignItemWithTriggerActive ? styleDisableScrollbar.className : void 0
1692
+ };
1693
+ const element = useRenderElement("div", componentProps, {
1694
+ ref: [forwardedRef, store.context.popupRef],
1695
+ state,
1696
+ stateAttributesMapping,
1697
+ props: [
1698
+ popupProps,
1699
+ defaultProps,
1700
+ getDisabledMountTransitionStyles(transitionStatus),
1701
+ elementProps
1702
+ ]
1703
+ });
1704
+ return /*#__PURE__*/ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [!disableStyleElements && styleDisableScrollbar.getElement(nonce), /*#__PURE__*/ (0, import_jsx_runtime.jsx)(FloatingFocusManager, {
1705
+ context: floatingRootContext,
1706
+ modal: false,
1707
+ disabled: !mounted,
1708
+ openInteractionType: openMethod,
1709
+ returnFocus: finalFocus,
1710
+ restoreFocus: true,
1711
+ children: element
1712
+ })] });
1713
+ });
1714
+ function getMaxPopupHeight(popupStyles) {
1715
+ const maxHeightStyle = popupStyles.maxHeight;
1716
+ return maxHeightStyle.endsWith("px") ? parseFloat(maxHeightStyle) || Infinity : Infinity;
1717
+ }
1718
+ function getMaxScrollTop(scroller) {
1719
+ return getMaxScrollOffset(scroller.scrollHeight, scroller.clientHeight);
1720
+ }
1721
+ function getScale(element) {
1722
+ return platform.getScale(element);
1723
+ }
1724
+ function normalizeSize(size, axis, scale) {
1725
+ return size / scale[axis];
1726
+ }
1727
+ function normalizeRect(rect, scale) {
1728
+ return rectToClientRect({
1729
+ x: normalizeSize(rect.x, "x", scale),
1730
+ y: normalizeSize(rect.y, "y", scale),
1731
+ width: normalizeSize(rect.width, "x", scale),
1732
+ height: normalizeSize(rect.height, "y", scale)
1733
+ });
1734
+ }
1735
+ var TRANSFORM_STYLE_RESETS = [
1736
+ ["transform", "none"],
1737
+ ["scale", "1"],
1738
+ ["translate", "0 0"]
1739
+ ];
1740
+ function unsetTransformStyles(popupElement) {
1741
+ const { style } = popupElement;
1742
+ const originalStyles = {};
1743
+ for (const [property, value] of TRANSFORM_STYLE_RESETS) {
1744
+ originalStyles[property] = style.getPropertyValue(property);
1745
+ style.setProperty(property, value, "important");
1746
+ }
1747
+ return () => {
1748
+ for (const [property] of TRANSFORM_STYLE_RESETS) {
1749
+ const originalValue = originalStyles[property];
1750
+ if (originalValue) style.setProperty(property, originalValue);
1751
+ else style.removeProperty(property);
1752
+ }
1753
+ };
1754
+ }
1755
+ // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/select/item/SelectItemContext.mjs
1756
+ var SelectItemContext = /*#__PURE__*/ import_react.createContext(void 0);
1757
+ function useSelectItemContext() {
1758
+ const context = import_react.useContext(SelectItemContext);
1759
+ if (!context) throw new Error(formatErrorMessage(57));
1760
+ return context;
1761
+ }
1762
+ // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/select/item/SelectItem.mjs
1763
+ /**
1764
+ * An individual option in the select popup.
1765
+ * Renders a `<div>` element.
1766
+ *
1767
+ * Documentation: [Base UI Select](https://base-ui.com/react/components/select)
1768
+ */
1769
+ var SelectItem$1 = /*#__PURE__*/ import_react.memo(/*#__PURE__*/ import_react.forwardRef(function SelectItem(componentProps, forwardedRef) {
1770
+ const { render, className, style, value: itemValue = null, label, disabled: disabledProp = false, nativeButton = false, ...elementProps } = componentProps;
1771
+ const textRef = import_react.useRef(null);
1772
+ const listItem = useCompositeListItem({
1773
+ guess: true,
1774
+ label,
1775
+ textRef
1776
+ });
1777
+ const store = useSelectRootContext();
1778
+ const { props: itemProps, multiple, disabled: selectDisabled, readOnly, isItemEqualToValue } = store.useState("itemRoot");
1779
+ const disabled = selectDisabled || disabledProp;
1780
+ const highlighted = store.useState("isActive", listItem.index);
1781
+ const open = store.useState("open");
1782
+ const selected = store.useState("isSelected", itemValue);
1783
+ const selectedByFocus = store.useState("isSelectedByFocus", listItem.index);
1784
+ const index = listItem.index;
1785
+ const itemRef = import_react.useRef(null);
1786
+ useIsoLayoutEffect(() => {
1787
+ const values = store.context.valuesRef.current;
1788
+ values[index] = itemValue;
1789
+ return () => {
1790
+ delete values[index];
1791
+ };
1792
+ }, [
1793
+ index,
1794
+ itemValue,
1795
+ store
1796
+ ]);
1797
+ useIsoLayoutEffect(() => {
1798
+ const selectedValue = store.state.value;
1799
+ const currentIndex = store.state.selectedIndex;
1800
+ let nextIndex = currentIndex;
1801
+ let claims;
1802
+ if (multiple && Array.isArray(selectedValue)) {
1803
+ nextIndex = resolveSelectedIndex(index, itemValue, store.context.valuesRef.current, selectedValue, isItemEqualToValue, currentIndex);
1804
+ claims = nextIndex === index;
1805
+ if (index === currentIndex && !claims) store.context.selectedItemTextRef.current = null;
1806
+ } else {
1807
+ claims = selectedValue !== void 0 && compareItemEquality(itemValue, selectedValue, isItemEqualToValue);
1808
+ if (claims) nextIndex = index;
1809
+ }
1810
+ store.set("selectedIndex", nextIndex);
1811
+ if (claims && textRef.current) store.context.selectedItemTextRef.current = textRef.current;
1812
+ }, [
1813
+ index,
1814
+ multiple,
1815
+ isItemEqualToValue,
1816
+ store,
1817
+ itemValue
1818
+ ]);
1819
+ const pointerTypeRef = import_react.useRef("mouse");
1820
+ const allowMouseSelectionRef = import_react.useRef(false);
1821
+ const { getButtonProps, buttonRef } = useButton({
1822
+ disabled,
1823
+ focusableWhenDisabled: true,
1824
+ native: nativeButton,
1825
+ composite: true
1826
+ });
1827
+ const state = {
1828
+ disabled,
1829
+ selected,
1830
+ highlighted
1831
+ };
1832
+ function commitSelection(event) {
1833
+ if (selectDisabled || readOnly) return;
1834
+ const selectedValue = store.state.value;
1835
+ if (multiple) {
1836
+ const currentValue = Array.isArray(selectedValue) ? selectedValue : [];
1837
+ const nextValue = selected ? removeItem(currentValue, itemValue, isItemEqualToValue) : [...currentValue, itemValue];
1838
+ store.context.setValue(nextValue, createChangeEventDetails(itemPress, event));
1839
+ } else {
1840
+ store.context.setValue(itemValue, createChangeEventDetails(itemPress, event));
1841
+ store.context.setOpen(false, createChangeEventDetails(itemPress, event));
1842
+ }
1843
+ }
1844
+ function resetDragMovement() {
1845
+ store.context.selectionRef.current.dragY = 0;
1846
+ }
1847
+ const defaultProps = {
1848
+ role: "option",
1849
+ "aria-selected": selected,
1850
+ tabIndex: open && highlighted ? 0 : -1,
1851
+ onKeyDown(event) {
1852
+ store.set("activeIndex", index);
1853
+ if (event.key === " " && store.context.typingRef.current) event.preventDefault();
1854
+ },
1855
+ onClick(event) {
1856
+ const isMouseClick = pointerTypeRef.current !== "touch";
1857
+ const clickPointerType = event.nativeEvent.pointerType;
1858
+ const isVirtualMouseClick = isMouseClick && isVirtualClick(event.nativeEvent) && (clickPointerType !== void 0 || highlighted);
1859
+ const isInvalidMouseClick = isMouseClick && !isVirtualMouseClick && !allowMouseSelectionRef.current;
1860
+ allowMouseSelectionRef.current = false;
1861
+ if (disabled || isInvalidMouseClick) return;
1862
+ commitSelection(event.nativeEvent);
1863
+ },
1864
+ onPointerEnter(event) {
1865
+ pointerTypeRef.current = event.pointerType;
1866
+ },
1867
+ onPointerMove(event) {
1868
+ if (event.pointerType === "mouse" && event.buttons === 1) {
1869
+ const selection = store.context.selectionRef.current;
1870
+ selection.dragY += event.movementY;
1871
+ if (selection.dragY ** 2 >= 64) selection.allowUnselectedMouseUp = true;
1872
+ }
1873
+ },
1874
+ onPointerDown(event) {
1875
+ pointerTypeRef.current = event.pointerType;
1876
+ allowMouseSelectionRef.current = true;
1877
+ resetDragMovement();
1878
+ },
1879
+ onMouseUp() {
1880
+ resetDragMovement();
1881
+ if (disabled || pointerTypeRef.current === "touch") return;
1882
+ if (allowMouseSelectionRef.current) return;
1883
+ const disallowSelectedMouseUp = !store.context.selectionRef.current.allowSelectedMouseUp && selected;
1884
+ const disallowUnselectedMouseUp = !store.context.selectionRef.current.allowUnselectedMouseUp && !selected;
1885
+ if (disallowSelectedMouseUp || disallowUnselectedMouseUp) return;
1886
+ allowMouseSelectionRef.current = true;
1887
+ itemRef.current?.click();
1888
+ allowMouseSelectionRef.current = false;
1889
+ }
1890
+ };
1891
+ const element = useRenderElement("div", componentProps, {
1892
+ ref: [
1893
+ buttonRef,
1894
+ forwardedRef,
1895
+ listItem.ref,
1896
+ itemRef
1897
+ ],
1898
+ state,
1899
+ props: [
1900
+ itemProps,
1901
+ defaultProps,
1902
+ elementProps,
1903
+ getButtonProps
1904
+ ]
1905
+ });
1906
+ const contextValue = import_react.useMemo(() => ({
1907
+ selected,
1908
+ index,
1909
+ textRef,
1910
+ selectedByFocus
1911
+ }), [
1912
+ selected,
1913
+ index,
1914
+ textRef,
1915
+ selectedByFocus
1916
+ ]);
1917
+ return /*#__PURE__*/ (0, import_jsx_runtime.jsx)(SelectItemContext.Provider, {
1918
+ value: contextValue,
1919
+ children: element
1920
+ });
1921
+ }));
1922
+ // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/select/item-indicator/SelectItemIndicator.mjs
1923
+ /**
1924
+ * Indicates whether the select item is selected.
1925
+ * Renders a `<span>` element.
1926
+ *
1927
+ * Documentation: [Base UI Select](https://base-ui.com/react/components/select)
1928
+ */
1929
+ var SelectItemIndicator = /*#__PURE__*/ import_react.forwardRef(function SelectItemIndicator(componentProps, forwardedRef) {
1930
+ const { selected } = useSelectItemContext();
1931
+ if (!(componentProps.keepMounted || selected)) return null;
1932
+ return /*#__PURE__*/ (0, import_jsx_runtime.jsx)(ItemIndicator, {
1933
+ ...componentProps,
1934
+ selected,
1935
+ ref: forwardedRef
1936
+ });
1937
+ });
1938
+ // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/select/item-text/SelectItemText.mjs
1939
+ /**
1940
+ * A text label of the select item.
1941
+ * Renders a `<div>` element.
1942
+ *
1943
+ * Documentation: [Base UI Select](https://base-ui.com/react/components/select)
1944
+ */
1945
+ var SelectItemText = /*#__PURE__*/ import_react.memo(/*#__PURE__*/ import_react.forwardRef(function SelectItemText(componentProps, forwardedRef) {
1946
+ const { index, textRef, selectedByFocus } = useSelectItemContext();
1947
+ const store = useSelectRootContext();
1948
+ const { render, className, style, ...elementProps } = componentProps;
1949
+ const localRef = import_react.useCallback((node) => {
1950
+ if (!node) return;
1951
+ if (index === 0) store.context.firstItemTextRef.current = node;
1952
+ if (selectedByFocus) store.context.selectedItemTextRef.current = node;
1953
+ }, [
1954
+ store,
1955
+ index,
1956
+ selectedByFocus
1957
+ ]);
1958
+ return useRenderElement("div", componentProps, {
1959
+ ref: [
1960
+ localRef,
1961
+ forwardedRef,
1962
+ textRef
1963
+ ],
1964
+ props: elementProps
1965
+ });
1966
+ }));
1967
+ // src/components/ui/select.tsx
1968
+ /** A dropdown field, framed like `Input`; its chevron sits inset from the right edge. */
1969
+ var TRIGGER = "relative flex h-9 w-full min-w-0 items-center gap-2 rounded-control border border-rule bg-page pr-9 pl-3 text-left text-sm text-text outline-none transition-colors focus-visible:border-accent data-popup-open:border-accent disabled:cursor-not-allowed disabled:opacity-60";
1970
+ var CHEVRON = "pointer-events-none size-4 text-muted";
1971
+ /** The open list, styled like `PopoverContent`, at least as wide as its field. */
1972
+ var POPUP = "max-h-[min(var(--available-height),20rem)] min-w-(--anchor-width) overflow-y-auto rounded-card border border-rule bg-surface p-1 text-text shadow-float outline-none transition-[opacity,transform] duration-150 data-ending-style:-translate-y-1 data-ending-style:opacity-0 data-starting-style:-translate-y-1 data-starting-style:opacity-0";
1973
+ var ITEM = "relative flex cursor-default items-center rounded-[6px] py-1.5 pr-8 pl-2.5 text-sm outline-none select-none data-disabled:opacity-50 data-highlighted:bg-accent-soft";
1974
+ var ITEM_CHECK = "pointer-events-none absolute right-2.5 size-4 text-accent";
1975
+ function Select(props) {
1976
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectRoot, {
1977
+ "data-slot": "select",
1978
+ ...props
1979
+ });
1980
+ }
1981
+ function SelectTrigger({ className, children, ...props }) {
1982
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SelectTrigger$1, {
1983
+ "data-slot": "select-trigger",
1984
+ className: cn(TRIGGER, className),
1985
+ ...props,
1986
+ children: [children, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectIcon, {
1987
+ className: "absolute right-3 flex",
1988
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, {
1989
+ name: "chevron",
1990
+ className: CHEVRON
1991
+ })
1992
+ })]
1993
+ });
1994
+ }
1995
+ function SelectValue({ className, ...props }) {
1996
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectValue$1, {
1997
+ "data-slot": "select-value",
1998
+ className: cn("truncate", className),
1999
+ ...props
2000
+ });
2001
+ }
2002
+ function SelectContent({ className, ...props }) {
2003
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectPositioner, {
2004
+ alignItemWithTrigger: false,
2005
+ sideOffset: 6,
2006
+ className: "z-40",
2007
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectPopup, {
2008
+ "data-slot": "select-content",
2009
+ className: cn(POPUP, className),
2010
+ ...props
2011
+ })
2012
+ }) });
2013
+ }
2014
+ function SelectItem({ className, children, ...props }) {
2015
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SelectItem$1, {
2016
+ "data-slot": "select-item",
2017
+ className: cn(ITEM, className),
2018
+ ...props,
2019
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItemText, {
2020
+ className: "truncate",
2021
+ children
2022
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItemIndicator, {
2023
+ className: ITEM_CHECK,
2024
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, {
2025
+ name: "check",
2026
+ className: "size-4"
2027
+ })
2028
+ })]
2029
+ });
2030
+ }
2031
+ // src/components/ui/combobox.tsx
2032
+ var Combobox = ComboboxRoot;
2033
+ /** A typing field framed like the Select trigger, with the same inset chevron. */
2034
+ function ComboboxInput({ className, ...props }) {
2035
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ComboboxInputGroup, {
2036
+ "data-slot": "combobox-input-group",
2037
+ className: cn("relative flex items-center", className),
2038
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ComboboxInput$1, {
2039
+ "data-slot": "combobox-input",
2040
+ className: cn(TRIGGER, "placeholder:text-muted focus:border-accent"),
2041
+ ...props
2042
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ComboboxTrigger, {
2043
+ "data-slot": "combobox-trigger",
2044
+ "aria-label": "Show options",
2045
+ className: "absolute inset-y-0 right-0 flex w-9 items-center justify-center outline-none",
2046
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, {
2047
+ name: "chevron",
2048
+ className: CHEVRON
2049
+ })
2050
+ })]
2051
+ });
2052
+ }
2053
+ function ComboboxContent({ className, ...props }) {
2054
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ComboboxPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ComboboxPositioner, {
2055
+ sideOffset: 6,
2056
+ className: "z-40",
2057
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ComboboxPopup, {
2058
+ "data-slot": "combobox-content",
2059
+ className: cn(POPUP, className),
2060
+ ...props
2061
+ })
2062
+ }) });
2063
+ }
2064
+ var ComboboxList = ComboboxList$1;
2065
+ function ComboboxEmpty({ className, ...props }) {
2066
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ComboboxEmpty$1, {
2067
+ "data-slot": "combobox-empty",
2068
+ className: cn("px-2.5 py-1.5 text-sm text-muted empty:hidden", className),
2069
+ ...props
2070
+ });
2071
+ }
2072
+ function ComboboxItem({ className, children, ...props }) {
2073
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ComboboxItem$1, {
2074
+ "data-slot": "combobox-item",
2075
+ className: cn(ITEM, className),
2076
+ ...props,
2077
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
2078
+ className: "truncate",
2079
+ children
2080
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ComboboxItemIndicator, {
2081
+ className: ITEM_CHECK,
2082
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, {
2083
+ name: "check",
2084
+ className: "size-4"
2085
+ })
2086
+ })]
2087
+ });
2088
+ }
2089
+ export { ComboboxItem as a, SelectContent as c, SelectValue as d, ComboboxInput as i, SelectItem as l, ComboboxContent as n, ComboboxList as o, ComboboxEmpty as r, Select as s, Combobox as t, SelectTrigger as u };