@stevederico/skateboard-ui 3.0.2 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. package/App.jsx +13 -13
  2. package/CHANGELOG.md +64 -0
  3. package/README.md +59 -65
  4. package/components/AuthOverlay.jsx +4 -4
  5. package/components/ProtectedRoute.jsx +1 -1
  6. package/components/ThemeToggle.jsx +1 -1
  7. package/components/UpgradeSheet.jsx +2 -2
  8. package/{core → components/core}/DynamicIcon.jsx +1 -1
  9. package/{layout → components/layout}/Header.jsx +4 -4
  10. package/{layout → components/layout}/Layout.jsx +1 -1
  11. package/{layout → components/layout}/Sidebar.jsx +2 -2
  12. package/{layout → components/layout}/TabBar.jsx +1 -1
  13. package/{views → components/views}/LandingView.jsx +5 -5
  14. package/{views → components/views}/NotFound.jsx +2 -2
  15. package/{views → components/views}/PaymentView.jsx +1 -1
  16. package/{views → components/views}/SettingsView.jsx +6 -6
  17. package/{views → components/views}/SignInView.jsx +6 -6
  18. package/{views → components/views}/SignOutView.jsx +1 -1
  19. package/{views → components/views}/SignUpView.jsx +6 -6
  20. package/{views → components/views}/TextView.jsx +3 -3
  21. package/hooks/useAuthGate.js +1 -1
  22. package/index.js +1 -1
  23. package/package.json +32 -50
  24. package/shadcn/lib/base-ui/LICENSE +21 -0
  25. package/shadcn/lib/base-ui/_chunk-01rqe37g.js +70 -0
  26. package/shadcn/lib/base-ui/_chunk-0h5sskyw.js +347 -0
  27. package/shadcn/lib/base-ui/_chunk-0xhx4g7r.js +57 -0
  28. package/shadcn/lib/base-ui/_chunk-1e6khrvm.js +218 -0
  29. package/shadcn/lib/base-ui/_chunk-1s41sngz.js +302 -0
  30. package/shadcn/lib/base-ui/_chunk-20rtfsz9.js +23 -0
  31. package/shadcn/lib/base-ui/_chunk-2tyt8f8r.js +6034 -0
  32. package/shadcn/lib/base-ui/_chunk-3f31ka8n.js +11 -0
  33. package/shadcn/lib/base-ui/_chunk-3h6zpchb.js +89 -0
  34. package/shadcn/lib/base-ui/_chunk-4s0k3h7t.js +114 -0
  35. package/shadcn/lib/base-ui/_chunk-502wngfc.js +598 -0
  36. package/shadcn/lib/base-ui/_chunk-536jvgeq.js +68 -0
  37. package/shadcn/lib/base-ui/_chunk-611pz5sm.js +10 -0
  38. package/shadcn/lib/base-ui/_chunk-65zw5gs2.js +15 -0
  39. package/shadcn/lib/base-ui/_chunk-6b17g8t7.js +34 -0
  40. package/shadcn/lib/base-ui/_chunk-6xevjepc.js +15 -0
  41. package/shadcn/lib/base-ui/_chunk-71zm6zgv.js +16 -0
  42. package/shadcn/lib/base-ui/_chunk-7fmjymvh.js +32 -0
  43. package/shadcn/lib/base-ui/_chunk-7jjzay8b.js +176 -0
  44. package/shadcn/lib/base-ui/_chunk-7v1t86x1.js +43 -0
  45. package/shadcn/lib/base-ui/_chunk-85vrgzwr.js +227 -0
  46. package/shadcn/lib/base-ui/_chunk-8jz3hb7q.js +9 -0
  47. package/shadcn/lib/base-ui/_chunk-8kh3xk78.js +35 -0
  48. package/shadcn/lib/base-ui/_chunk-97tas84n.js +67 -0
  49. package/shadcn/lib/base-ui/_chunk-9nyxkvte.js +13 -0
  50. package/shadcn/lib/base-ui/_chunk-a8fwg9d0.js +52 -0
  51. package/shadcn/lib/base-ui/_chunk-agc6ew3g.js +29 -0
  52. package/shadcn/lib/base-ui/_chunk-aqwsk46c.js +64 -0
  53. package/shadcn/lib/base-ui/_chunk-atd5kq5q.js +803 -0
  54. package/shadcn/lib/base-ui/_chunk-atnkefgd.js +104 -0
  55. package/shadcn/lib/base-ui/_chunk-b40erthe.js +7 -0
  56. package/shadcn/lib/base-ui/_chunk-b5jsqt97.js +50 -0
  57. package/shadcn/lib/base-ui/_chunk-bk7n9s9e.js +15 -0
  58. package/shadcn/lib/base-ui/_chunk-c3572b5x.js +19 -0
  59. package/shadcn/lib/base-ui/_chunk-cwr896nf.js +25 -0
  60. package/shadcn/lib/base-ui/_chunk-drfb9kp2.js +27 -0
  61. package/shadcn/lib/base-ui/_chunk-ds8fnpjj.js +0 -0
  62. package/shadcn/lib/base-ui/_chunk-ek863ta9.js +82 -0
  63. package/shadcn/lib/base-ui/_chunk-f09cp81f.js +12 -0
  64. package/shadcn/lib/base-ui/_chunk-f5d01bp9.js +0 -0
  65. package/shadcn/lib/base-ui/_chunk-f9tgee1q.js +21 -0
  66. package/shadcn/lib/base-ui/_chunk-fch5cba8.js +84 -0
  67. package/shadcn/lib/base-ui/_chunk-gfce3j3z.js +18 -0
  68. package/shadcn/lib/base-ui/_chunk-ha06w2pp.js +2391 -0
  69. package/shadcn/lib/base-ui/_chunk-hzgetm70.js +23 -0
  70. package/shadcn/lib/base-ui/_chunk-j0eqdjta.js +39 -0
  71. package/shadcn/lib/base-ui/_chunk-k1e5fvcj.js +48 -0
  72. package/shadcn/lib/base-ui/_chunk-k4mc2kan.js +81 -0
  73. package/shadcn/lib/base-ui/_chunk-kfz96xv1.js +128 -0
  74. package/shadcn/lib/base-ui/_chunk-m45547cc.js +15 -0
  75. package/shadcn/lib/base-ui/_chunk-mbn76q14.js +184 -0
  76. package/shadcn/lib/base-ui/_chunk-mvv30fkv.js +9 -0
  77. package/shadcn/lib/base-ui/_chunk-mznt6ktj.js +33 -0
  78. package/shadcn/lib/base-ui/_chunk-n7dnqnbw.js +7 -0
  79. package/shadcn/lib/base-ui/_chunk-nya71ccw.js +546 -0
  80. package/shadcn/lib/base-ui/_chunk-p6qynd6r.js +146 -0
  81. package/shadcn/lib/base-ui/_chunk-q3nee19r.js +323 -0
  82. package/shadcn/lib/base-ui/_chunk-q7yw9mz4.js +385 -0
  83. package/shadcn/lib/base-ui/_chunk-qce0xt57.js +107 -0
  84. package/shadcn/lib/base-ui/_chunk-qgzhcjsj.js +14 -0
  85. package/shadcn/lib/base-ui/_chunk-qt6r015s.js +38 -0
  86. package/shadcn/lib/base-ui/_chunk-r0vsdknk.js +4 -0
  87. package/shadcn/lib/base-ui/_chunk-sx6vkz01.js +150 -0
  88. package/shadcn/lib/base-ui/_chunk-szcr6mhk.js +6 -0
  89. package/shadcn/lib/base-ui/_chunk-t7j3rbpv.js +67 -0
  90. package/shadcn/lib/base-ui/_chunk-tmfmrzwe.js +39 -0
  91. package/shadcn/lib/base-ui/_chunk-v92ycsfj.js +9 -0
  92. package/shadcn/lib/base-ui/_chunk-vdc01ss3.js +6 -0
  93. package/shadcn/lib/base-ui/_chunk-vjbnhhg1.js +26 -0
  94. package/shadcn/lib/base-ui/_chunk-w68yxg9d.js +21 -0
  95. package/shadcn/lib/base-ui/_chunk-wana68v3.js +477 -0
  96. package/shadcn/lib/base-ui/_chunk-wtw745qd.js +12 -0
  97. package/shadcn/lib/base-ui/_chunk-xb7ph1ka.js +6 -0
  98. package/shadcn/lib/base-ui/_chunk-xfagb0fq.js +28 -0
  99. package/shadcn/lib/base-ui/_chunk-xxhqanfd.js +16 -0
  100. package/shadcn/lib/base-ui/_chunk-y887e46p.js +15 -0
  101. package/shadcn/lib/base-ui/_chunk-ymj1dpqg.js +14 -0
  102. package/shadcn/lib/base-ui/accordion.js +650 -0
  103. package/shadcn/lib/base-ui/alert-dialog.js +138 -0
  104. package/shadcn/lib/base-ui/avatar.js +235 -0
  105. package/shadcn/lib/base-ui/button.js +52 -0
  106. package/shadcn/lib/base-ui/checkbox.js +454 -0
  107. package/shadcn/lib/base-ui/collapsible.js +283 -0
  108. package/shadcn/lib/base-ui/context-menu.js +324 -0
  109. package/shadcn/lib/base-ui/dialog.js +71 -0
  110. package/shadcn/lib/base-ui/input.js +1028 -0
  111. package/shadcn/lib/base-ui/menu.js +61 -0
  112. package/shadcn/lib/base-ui/menubar.js +157 -0
  113. package/shadcn/lib/base-ui/merge-props.js +15 -0
  114. package/shadcn/lib/base-ui/navigation-menu.js +1854 -0
  115. package/shadcn/lib/base-ui/popover.js +1090 -0
  116. package/shadcn/lib/base-ui/preview-card.js +709 -0
  117. package/shadcn/lib/base-ui/progress.js +278 -0
  118. package/shadcn/lib/base-ui/radio-group.js +247 -0
  119. package/shadcn/lib/base-ui/radio.js +382 -0
  120. package/shadcn/lib/base-ui/scroll-area.js +1061 -0
  121. package/shadcn/lib/base-ui/select.js +2438 -0
  122. package/shadcn/lib/base-ui/separator.js +11 -0
  123. package/shadcn/lib/base-ui/slider.js +1595 -0
  124. package/shadcn/lib/base-ui/switch.js +333 -0
  125. package/shadcn/lib/base-ui/tabs.js +892 -0
  126. package/shadcn/lib/base-ui/toggle-group.js +152 -0
  127. package/shadcn/lib/base-ui/toggle.js +133 -0
  128. package/shadcn/lib/base-ui/tooltip.js +791 -0
  129. package/shadcn/lib/base-ui/use-render.js +15 -0
  130. package/shadcn/lib/tailwind-merge.js +3312 -0
  131. package/shadcn/lib/utils.js +1 -1
  132. package/shadcn/ui/accordion.jsx +1 -1
  133. package/shadcn/ui/alert-dialog.jsx +1 -1
  134. package/shadcn/ui/avatar.jsx +1 -1
  135. package/shadcn/ui/badge.jsx +2 -2
  136. package/shadcn/ui/breadcrumb.jsx +2 -2
  137. package/shadcn/ui/button-group.jsx +2 -2
  138. package/shadcn/ui/button.jsx +1 -1
  139. package/shadcn/ui/calendar.jsx +1 -1
  140. package/shadcn/ui/checkbox.jsx +1 -1
  141. package/shadcn/ui/collapsible.jsx +1 -1
  142. package/shadcn/ui/command.jsx +1 -1
  143. package/shadcn/ui/context-menu.jsx +1 -1
  144. package/shadcn/ui/dialog.jsx +1 -1
  145. package/shadcn/ui/drawer.jsx +176 -74
  146. package/shadcn/ui/dropdown-menu.jsx +1 -1
  147. package/shadcn/ui/hover-card.jsx +1 -1
  148. package/shadcn/ui/input.jsx +1 -1
  149. package/shadcn/ui/item.jsx +2 -2
  150. package/shadcn/ui/menubar.jsx +2 -2
  151. package/shadcn/ui/navigation-menu.jsx +1 -1
  152. package/shadcn/ui/popover.jsx +1 -1
  153. package/shadcn/ui/progress.jsx +1 -1
  154. package/shadcn/ui/radio-group.jsx +2 -2
  155. package/shadcn/ui/scroll-area.jsx +1 -1
  156. package/shadcn/ui/select.jsx +1 -1
  157. package/shadcn/ui/separator.jsx +1 -1
  158. package/shadcn/ui/sheet.jsx +1 -1
  159. package/shadcn/ui/sidebar.jsx +3 -3
  160. package/shadcn/ui/slider.jsx +1 -1
  161. package/shadcn/ui/switch.jsx +1 -1
  162. package/shadcn/ui/tabs.jsx +1 -1
  163. package/shadcn/ui/toggle-group.jsx +2 -2
  164. package/shadcn/ui/toggle.jsx +1 -1
  165. package/shadcn/ui/tooltip.jsx +1 -1
  166. package/styles.css +31 -0
  167. package/MIGRATION.md +0 -230
  168. package/shadcn/ui/carousel.jsx +0 -195
  169. package/shadcn/ui/chart.jsx +0 -312
  170. package/shadcn/ui/resizable.jsx +0 -47
  171. /package/{core → components/core}/Calendar.jsx +0 -0
  172. /package/{core → components/core}/Command.jsx +0 -0
  173. /package/{core → components/core}/Context.jsx +0 -0
  174. /package/{core → components/core}/ThemeProvider.jsx +0 -0
  175. /package/{core → components/core}/Utilities.js +0 -0
@@ -0,0 +1,2438 @@
1
+ /* @base-ui/react 1.4.1 — vendored (MIT — MUI Inc).
2
+ * Refresh: scripts/vendor-base-ui.js (see header for instructions).
3
+ * Do not edit by hand. */
4
+ import {
5
+ serializeValue
6
+ } from "./_chunk-xxhqanfd.js";
7
+ import {
8
+ SCROLL_EDGE_TOLERANCE_PX,
9
+ getMaxScrollOffset,
10
+ normalizeScrollOffset,
11
+ styleDisableScrollbar
12
+ } from "./_chunk-k1e5fvcj.js";
13
+ import {
14
+ getDefaultLabelId,
15
+ resolveAriaLabelledBy
16
+ } from "./_chunk-611pz5sm.js";
17
+ import {
18
+ clamp
19
+ } from "./_chunk-szcr6mhk.js";
20
+ import {
21
+ useCSPContext
22
+ } from "./_chunk-ymj1dpqg.js";
23
+ import {
24
+ useLabel
25
+ } from "./_chunk-fch5cba8.js";
26
+ import {
27
+ useLabelableId
28
+ } from "./_chunk-k4mc2kan.js";
29
+ import"./_chunk-w68yxg9d.js";
30
+ import {
31
+ useFormContext,
32
+ useRegisterFieldControl
33
+ } from "./_chunk-97tas84n.js";
34
+ import {
35
+ fieldValidityMapping,
36
+ useFieldRootContext,
37
+ useLabelableContext
38
+ } from "./_chunk-kfz96xv1.js";
39
+ import"./_chunk-ds8fnpjj.js";
40
+ import {
41
+ getPseudoElementBounds
42
+ } from "./_chunk-6b17g8t7.js";
43
+ import {
44
+ Separator
45
+ } from "./_chunk-7fmjymvh.js";
46
+ import {
47
+ useAnchoredPopupScrollLock
48
+ } from "./_chunk-agc6ew3g.js";
49
+ import {
50
+ useToolbarRootContext
51
+ } from "./_chunk-y887e46p.js";
52
+ import {
53
+ usePreviousValue
54
+ } from "./_chunk-gfce3j3z.js";
55
+ import {
56
+ getDisabledMountTransitionStyles,
57
+ useAnchorPositioning,
58
+ usePositioner
59
+ } from "./_chunk-502wngfc.js";
60
+ import {
61
+ IndexGuessBehavior,
62
+ useCompositeListItem
63
+ } from "./_chunk-ek863ta9.js";
64
+ import {
65
+ CompositeList
66
+ } from "./_chunk-p6qynd6r.js";
67
+ import"./_chunk-20rtfsz9.js";
68
+ import {
69
+ useDirection
70
+ } from "./_chunk-wtw745qd.js";
71
+ import {
72
+ useControlled
73
+ } from "./_chunk-01rqe37g.js";
74
+ import {
75
+ InternalBackdrop,
76
+ useOpenInteractionType
77
+ } from "./_chunk-q3nee19r.js";
78
+ import {
79
+ useOnFirstRender
80
+ } from "./_chunk-f09cp81f.js";
81
+ import {
82
+ popupStateMapping,
83
+ pressableTriggerOpenStateMapping,
84
+ triggerOpenStateMapping
85
+ } from "./_chunk-536jvgeq.js";
86
+ import {
87
+ inertValue
88
+ } from "./_chunk-9nyxkvte.js";
89
+ import {
90
+ DROPDOWN_COLLISION_AVOIDANCE,
91
+ FloatingFocusManager,
92
+ FloatingPortal,
93
+ Store,
94
+ createSelector,
95
+ platform,
96
+ useClick,
97
+ useDismiss,
98
+ useFloatingRootContext,
99
+ useInteractions,
100
+ useListNavigation,
101
+ useStore,
102
+ useTypeahead
103
+ } from "./_chunk-2tyt8f8r.js";
104
+ import"./_chunk-aqwsk46c.js";
105
+ import {
106
+ ownerDocument
107
+ } from "./_chunk-xb7ph1ka.js";
108
+ import {
109
+ contains,
110
+ getFloatingFocusElement
111
+ } from "./_chunk-atnkefgd.js";
112
+ import {
113
+ useValueAsRef
114
+ } from "./_chunk-drfb9kp2.js";
115
+ import {
116
+ COMPOSITE_KEYS
117
+ } from "./_chunk-qce0xt57.js";
118
+ import {
119
+ rectToClientRect
120
+ } from "./_chunk-nya71ccw.js";
121
+ import {
122
+ isWebKit
123
+ } from "./_chunk-t7j3rbpv.js";
124
+ import {
125
+ useTimeout
126
+ } from "./_chunk-7v1t86x1.js";
127
+ import {
128
+ useValueChanged
129
+ } from "./_chunk-cwr896nf.js";
130
+ import {
131
+ visuallyHidden,
132
+ visuallyHiddenInput
133
+ } from "./_chunk-hzgetm70.js";
134
+ import"./_chunk-f5d01bp9.js";
135
+ import {
136
+ addEventListener
137
+ } from "./_chunk-mvv30fkv.js";
138
+ import {
139
+ createChangeEventDetails,
140
+ exports_reason_parts
141
+ } from "./_chunk-4s0k3h7t.js";
142
+ import {
143
+ useBaseUiId
144
+ } from "./_chunk-8kh3xk78.js";
145
+ import {
146
+ transitionStatusMapping,
147
+ useOpenChangeComplete,
148
+ useTransitionStatus
149
+ } from "./_chunk-mbn76q14.js";
150
+ import"./_chunk-v92ycsfj.js";
151
+ import {
152
+ useAnimationFrame
153
+ } from "./_chunk-3h6zpchb.js";
154
+ import"./_chunk-8jz3hb7q.js";
155
+ import {
156
+ useButton
157
+ } from "./_chunk-85vrgzwr.js";
158
+ import"./_chunk-71zm6zgv.js";
159
+ import"./_chunk-6xevjepc.js";
160
+ import {
161
+ getWindow
162
+ } from "./_chunk-sx6vkz01.js";
163
+ import"./_chunk-n7dnqnbw.js";
164
+ import {
165
+ useStableCallback
166
+ } from "./_chunk-mznt6ktj.js";
167
+ import {
168
+ useIsoLayoutEffect
169
+ } from "./_chunk-b40erthe.js";
170
+ import {
171
+ EMPTY_ARRAY,
172
+ EMPTY_OBJECT,
173
+ useMergedRefs,
174
+ useRefWithInit,
175
+ useRenderElement
176
+ } from "./_chunk-1s41sngz.js";
177
+ import {
178
+ __export,
179
+ mergeProps
180
+ } from "./_chunk-1e6khrvm.js";
181
+
182
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/select/index.parts.js
183
+ var exports_index_parts = {};
184
+ __export(exports_index_parts, {
185
+ Value: () => SelectValue,
186
+ Trigger: () => SelectTrigger,
187
+ Separator: () => Separator,
188
+ ScrollUpArrow: () => SelectScrollUpArrow,
189
+ ScrollDownArrow: () => SelectScrollDownArrow,
190
+ Root: () => SelectRoot,
191
+ Positioner: () => SelectPositioner,
192
+ Portal: () => SelectPortal,
193
+ Popup: () => SelectPopup,
194
+ List: () => SelectList,
195
+ Label: () => SelectLabel,
196
+ ItemText: () => SelectItemText,
197
+ ItemIndicator: () => SelectItemIndicator,
198
+ Item: () => SelectItem,
199
+ Icon: () => SelectIcon,
200
+ GroupLabel: () => SelectGroupLabel,
201
+ Group: () => SelectGroup,
202
+ Backdrop: () => SelectBackdrop,
203
+ Arrow: () => SelectArrow
204
+ });
205
+
206
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/select/root/SelectRoot.js
207
+ import * as React3 from "react";
208
+
209
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/select/root/SelectRootContext.js
210
+ import * as React from "react";
211
+ "use client";
212
+ var SelectRootContext = /* @__PURE__ */ React.createContext(null);
213
+ if (true)
214
+ SelectRootContext.displayName = "SelectRootContext";
215
+ var SelectFloatingContext = /* @__PURE__ */ React.createContext(null);
216
+ if (true)
217
+ SelectFloatingContext.displayName = "SelectFloatingContext";
218
+ function useSelectRootContext() {
219
+ const context = React.useContext(SelectRootContext);
220
+ if (context === null) {
221
+ throw new Error("Base UI: SelectRootContext is missing. Select parts must be placed within <Select.Root>.");
222
+ }
223
+ return context;
224
+ }
225
+ function useSelectFloatingContext() {
226
+ const context = React.useContext(SelectFloatingContext);
227
+ if (context === null) {
228
+ throw new Error("Base UI: SelectFloatingContext is missing. Select parts must be placed within <Select.Root>.");
229
+ }
230
+ return context;
231
+ }
232
+
233
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/internals/itemEquality.js
234
+ var defaultItemEquality = (itemValue, selectedValue) => Object.is(itemValue, selectedValue);
235
+ function compareItemEquality(itemValue, selectedValue, comparer) {
236
+ if (itemValue == null || selectedValue == null) {
237
+ return Object.is(itemValue, selectedValue);
238
+ }
239
+ return comparer(itemValue, selectedValue);
240
+ }
241
+ function selectedValueIncludes(selectedValues, itemValue, comparer) {
242
+ if (!selectedValues || selectedValues.length === 0) {
243
+ return false;
244
+ }
245
+ return selectedValues.some((selectedValue) => {
246
+ if (selectedValue === undefined) {
247
+ return false;
248
+ }
249
+ return compareItemEquality(itemValue, selectedValue, comparer);
250
+ });
251
+ }
252
+ function findItemIndex(itemValues, selectedValue, comparer) {
253
+ if (!itemValues || itemValues.length === 0) {
254
+ return -1;
255
+ }
256
+ return itemValues.findIndex((itemValue) => {
257
+ if (itemValue === undefined) {
258
+ return false;
259
+ }
260
+ return compareItemEquality(itemValue, selectedValue, comparer);
261
+ });
262
+ }
263
+ function removeItem(selectedValues, itemValue, comparer) {
264
+ return selectedValues.filter((selectedValue) => !compareItemEquality(itemValue, selectedValue, comparer));
265
+ }
266
+
267
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/internals/resolveValueLabel.js
268
+ import * as React2 from "react";
269
+ import { jsx as _jsx } from "react/jsx-runtime";
270
+ "use client";
271
+ function isGroupedItems(items) {
272
+ return items != null && items.length > 0 && typeof items[0] === "object" && items[0] != null && "items" in items[0];
273
+ }
274
+ function hasNullItemLabel(items) {
275
+ if (!Array.isArray(items)) {
276
+ return items != null && "null" in items;
277
+ }
278
+ const arrayItems = items;
279
+ if (isGroupedItems(arrayItems)) {
280
+ for (const group of arrayItems) {
281
+ for (const item of group.items) {
282
+ if (item && item.value == null && item.label != null) {
283
+ return true;
284
+ }
285
+ }
286
+ }
287
+ return false;
288
+ }
289
+ for (const item of arrayItems) {
290
+ if (item && item.value == null && item.label != null) {
291
+ return true;
292
+ }
293
+ }
294
+ return false;
295
+ }
296
+ function stringifyAsLabel(item, itemToStringLabel) {
297
+ if (itemToStringLabel && item != null) {
298
+ return itemToStringLabel(item) ?? "";
299
+ }
300
+ if (item && typeof item === "object") {
301
+ if ("label" in item && item.label != null) {
302
+ return String(item.label);
303
+ }
304
+ if ("value" in item) {
305
+ return String(item.value);
306
+ }
307
+ }
308
+ return serializeValue(item);
309
+ }
310
+ function stringifyAsValue(item, itemToStringValue) {
311
+ if (itemToStringValue && item != null) {
312
+ return itemToStringValue(item) ?? "";
313
+ }
314
+ if (item && typeof item === "object" && "value" in item && "label" in item) {
315
+ return serializeValue(item.value);
316
+ }
317
+ return serializeValue(item);
318
+ }
319
+ function resolveSelectedLabel(value, items, itemToStringLabel) {
320
+ function fallback() {
321
+ return stringifyAsLabel(value, itemToStringLabel);
322
+ }
323
+ if (itemToStringLabel && value != null) {
324
+ return itemToStringLabel(value);
325
+ }
326
+ if (value && typeof value === "object" && "label" in value && value.label != null) {
327
+ return value.label;
328
+ }
329
+ if (items && !Array.isArray(items)) {
330
+ return items[value] ?? fallback();
331
+ }
332
+ if (Array.isArray(items)) {
333
+ const arrayItems = items;
334
+ const flatItems = isGroupedItems(arrayItems) ? arrayItems.flatMap((group) => group.items) : arrayItems;
335
+ if (value == null || typeof value !== "object") {
336
+ const match = flatItems.find((item) => item.value === value);
337
+ if (match && match.label != null) {
338
+ return match.label;
339
+ }
340
+ return fallback();
341
+ }
342
+ if ("value" in value) {
343
+ const match = flatItems.find((item) => item && item.value === value.value);
344
+ if (match && match.label != null) {
345
+ return match.label;
346
+ }
347
+ }
348
+ }
349
+ return fallback();
350
+ }
351
+ function resolveMultipleLabels(values, items, itemToStringLabel) {
352
+ return values.reduce((acc, value, index) => {
353
+ if (index > 0) {
354
+ acc.push(", ");
355
+ }
356
+ acc.push(/* @__PURE__ */ _jsx(React2.Fragment, {
357
+ children: resolveSelectedLabel(value, items, itemToStringLabel)
358
+ }, index));
359
+ return acc;
360
+ }, []);
361
+ }
362
+
363
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/select/store.js
364
+ var selectors = {
365
+ id: createSelector((state) => state.id),
366
+ labelId: createSelector((state) => state.labelId),
367
+ modal: createSelector((state) => state.modal),
368
+ multiple: createSelector((state) => state.multiple),
369
+ items: createSelector((state) => state.items),
370
+ itemToStringLabel: createSelector((state) => state.itemToStringLabel),
371
+ itemToStringValue: createSelector((state) => state.itemToStringValue),
372
+ isItemEqualToValue: createSelector((state) => state.isItemEqualToValue),
373
+ value: createSelector((state) => state.value),
374
+ hasSelectedValue: createSelector((state) => {
375
+ const {
376
+ value,
377
+ multiple,
378
+ itemToStringValue
379
+ } = state;
380
+ if (value == null) {
381
+ return false;
382
+ }
383
+ if (multiple && Array.isArray(value)) {
384
+ return value.length > 0;
385
+ }
386
+ return stringifyAsValue(value, itemToStringValue) !== "";
387
+ }),
388
+ hasNullItemLabel: createSelector((state, enabled) => {
389
+ return enabled ? hasNullItemLabel(state.items) : false;
390
+ }),
391
+ open: createSelector((state) => state.open),
392
+ mounted: createSelector((state) => state.mounted),
393
+ forceMount: createSelector((state) => state.forceMount),
394
+ transitionStatus: createSelector((state) => state.transitionStatus),
395
+ openMethod: createSelector((state) => state.openMethod),
396
+ activeIndex: createSelector((state) => state.activeIndex),
397
+ selectedIndex: createSelector((state) => state.selectedIndex),
398
+ isActive: createSelector((state, index) => state.activeIndex === index),
399
+ isSelected: createSelector((state, index, itemValue) => {
400
+ const comparer = state.isItemEqualToValue;
401
+ const storeValue = state.value;
402
+ if (state.multiple) {
403
+ return Array.isArray(storeValue) && storeValue.some((selectedItem) => compareItemEquality(itemValue, selectedItem, comparer));
404
+ }
405
+ if (state.selectedIndex === index && state.selectedIndex !== null) {
406
+ return true;
407
+ }
408
+ return compareItemEquality(itemValue, storeValue, comparer);
409
+ }),
410
+ isSelectedByFocus: createSelector((state, index) => {
411
+ return state.selectedIndex === index;
412
+ }),
413
+ popupProps: createSelector((state) => state.popupProps),
414
+ triggerProps: createSelector((state) => state.triggerProps),
415
+ triggerElement: createSelector((state) => state.triggerElement),
416
+ positionerElement: createSelector((state) => state.positionerElement),
417
+ listElement: createSelector((state) => state.listElement),
418
+ scrollUpArrowVisible: createSelector((state) => state.scrollUpArrowVisible),
419
+ scrollDownArrowVisible: createSelector((state) => state.scrollDownArrowVisible),
420
+ hasScrollArrows: createSelector((state) => state.hasScrollArrows)
421
+ };
422
+
423
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/select/root/SelectRoot.js
424
+ import { jsx as _jsx2, jsxs as _jsxs } from "react/jsx-runtime";
425
+ "use client";
426
+ function SelectRoot(props) {
427
+ const {
428
+ id,
429
+ value: valueProp,
430
+ defaultValue = null,
431
+ onValueChange,
432
+ open: openProp,
433
+ defaultOpen = false,
434
+ onOpenChange,
435
+ name: nameProp,
436
+ form,
437
+ autoComplete,
438
+ disabled: disabledProp = false,
439
+ readOnly = false,
440
+ required = false,
441
+ modal = true,
442
+ actionsRef,
443
+ inputRef,
444
+ onOpenChangeComplete,
445
+ items,
446
+ multiple = false,
447
+ itemToStringLabel,
448
+ itemToStringValue,
449
+ isItemEqualToValue = defaultItemEquality,
450
+ highlightItemOnHover = true,
451
+ children
452
+ } = props;
453
+ const {
454
+ clearErrors
455
+ } = useFormContext();
456
+ const {
457
+ setDirty,
458
+ setTouched,
459
+ setFocused,
460
+ shouldValidateOnChange,
461
+ validityData,
462
+ setFilled,
463
+ name: fieldName,
464
+ disabled: fieldDisabled,
465
+ validation,
466
+ validationMode
467
+ } = useFieldRootContext();
468
+ const generatedId = useLabelableId({
469
+ id
470
+ });
471
+ const disabled = fieldDisabled || disabledProp;
472
+ const name = fieldName ?? nameProp;
473
+ const [value, setValueUnwrapped] = useControlled({
474
+ controlled: valueProp,
475
+ default: multiple ? defaultValue ?? EMPTY_ARRAY : defaultValue,
476
+ name: "Select",
477
+ state: "value"
478
+ });
479
+ const [open, setOpenUnwrapped] = useControlled({
480
+ controlled: openProp,
481
+ default: defaultOpen,
482
+ name: "Select",
483
+ state: "open"
484
+ });
485
+ const listRef = React3.useRef([]);
486
+ const labelsRef = React3.useRef([]);
487
+ const popupRef = React3.useRef(null);
488
+ const scrollHandlerRef = React3.useRef(null);
489
+ const scrollArrowsMountedCountRef = React3.useRef(0);
490
+ const valueRef = React3.useRef(null);
491
+ const valuesRef = React3.useRef([]);
492
+ const typingRef = React3.useRef(false);
493
+ const keyboardActiveRef = React3.useRef(false);
494
+ const selectedItemTextRef = React3.useRef(null);
495
+ const selectionRef = React3.useRef({
496
+ allowSelectedMouseUp: false,
497
+ allowUnselectedMouseUp: false
498
+ });
499
+ const alignItemWithTriggerActiveRef = React3.useRef(false);
500
+ const {
501
+ mounted,
502
+ setMounted,
503
+ transitionStatus
504
+ } = useTransitionStatus(open);
505
+ const {
506
+ openMethod,
507
+ triggerProps: interactionTypeProps
508
+ } = useOpenInteractionType(open);
509
+ const store = useRefWithInit(() => new Store({
510
+ id: generatedId,
511
+ labelId: undefined,
512
+ modal,
513
+ multiple,
514
+ itemToStringLabel,
515
+ itemToStringValue,
516
+ isItemEqualToValue,
517
+ value,
518
+ open,
519
+ mounted,
520
+ transitionStatus,
521
+ items,
522
+ forceMount: false,
523
+ openMethod: null,
524
+ activeIndex: null,
525
+ selectedIndex: null,
526
+ popupProps: {},
527
+ triggerProps: {},
528
+ triggerElement: null,
529
+ positionerElement: null,
530
+ listElement: null,
531
+ scrollUpArrowVisible: false,
532
+ scrollDownArrowVisible: false,
533
+ hasScrollArrows: false
534
+ })).current;
535
+ const activeIndex = useStore(store, selectors.activeIndex);
536
+ const selectedIndex = useStore(store, selectors.selectedIndex);
537
+ const triggerElement = useStore(store, selectors.triggerElement);
538
+ const positionerElement = useStore(store, selectors.positionerElement);
539
+ const previousOpenMethod = usePreviousValue(openMethod);
540
+ const renderedOpenMethod = openMethod ?? previousOpenMethod;
541
+ const serializedValue = React3.useMemo(() => {
542
+ if (multiple && Array.isArray(value) && value.length === 0) {
543
+ return "";
544
+ }
545
+ return stringifyAsValue(value, itemToStringValue);
546
+ }, [multiple, value, itemToStringValue]);
547
+ const fieldStringValue = React3.useMemo(() => {
548
+ if (multiple && Array.isArray(value)) {
549
+ return value.map((currentValue) => stringifyAsValue(currentValue, itemToStringValue));
550
+ }
551
+ return stringifyAsValue(value, itemToStringValue);
552
+ }, [multiple, value, itemToStringValue]);
553
+ const controlRef = useValueAsRef(store.state.triggerElement);
554
+ const getFieldValue = useStableCallback(() => fieldStringValue);
555
+ useRegisterFieldControl(controlRef, {
556
+ id: generatedId,
557
+ value,
558
+ getValue: getFieldValue
559
+ });
560
+ const initialValueRef = React3.useRef(value);
561
+ useIsoLayoutEffect(() => {
562
+ if (value !== initialValueRef.current) {
563
+ store.set("forceMount", true);
564
+ }
565
+ }, [store, value]);
566
+ useIsoLayoutEffect(() => {
567
+ setFilled(multiple ? Array.isArray(value) && value.length > 0 : value != null);
568
+ }, [multiple, value, setFilled]);
569
+ useIsoLayoutEffect(function syncSelectedIndex() {
570
+ if (open) {
571
+ return;
572
+ }
573
+ const registry = valuesRef.current;
574
+ if (multiple) {
575
+ const currentValue = Array.isArray(value) ? value : [];
576
+ if (currentValue.length === 0) {
577
+ store.set("selectedIndex", null);
578
+ return;
579
+ }
580
+ const lastValue = currentValue[currentValue.length - 1];
581
+ const lastIndex = findItemIndex(registry, lastValue, isItemEqualToValue);
582
+ store.set("selectedIndex", lastIndex === -1 ? null : lastIndex);
583
+ return;
584
+ }
585
+ const index = findItemIndex(registry, value, isItemEqualToValue);
586
+ store.set("selectedIndex", index === -1 ? null : index);
587
+ }, [multiple, open, value, valuesRef, isItemEqualToValue, store]);
588
+ useValueChanged(value, () => {
589
+ clearErrors(name);
590
+ setDirty(value !== validityData.initialValue);
591
+ if (shouldValidateOnChange()) {
592
+ validation.commit(value);
593
+ } else {
594
+ validation.commit(value, true);
595
+ }
596
+ });
597
+ const setOpen = useStableCallback((nextOpen, eventDetails) => {
598
+ onOpenChange?.(nextOpen, eventDetails);
599
+ if (eventDetails.isCanceled) {
600
+ return;
601
+ }
602
+ setOpenUnwrapped(nextOpen);
603
+ if (!nextOpen && (eventDetails.reason === exports_reason_parts.focusOut || eventDetails.reason === exports_reason_parts.outsidePress)) {
604
+ setTouched(true);
605
+ setFocused(false);
606
+ if (validationMode === "onBlur") {
607
+ validation.commit(value);
608
+ }
609
+ }
610
+ if (!nextOpen && store.state.activeIndex !== null) {
611
+ const activeOption = listRef.current[store.state.activeIndex];
612
+ queueMicrotask(() => {
613
+ activeOption?.setAttribute("tabindex", "-1");
614
+ });
615
+ }
616
+ });
617
+ const handleUnmount = useStableCallback(() => {
618
+ setMounted(false);
619
+ store.update({
620
+ activeIndex: null,
621
+ openMethod: null
622
+ });
623
+ onOpenChangeComplete?.(false);
624
+ });
625
+ useOpenChangeComplete({
626
+ enabled: !actionsRef,
627
+ open,
628
+ ref: popupRef,
629
+ onComplete() {
630
+ if (!open) {
631
+ handleUnmount();
632
+ }
633
+ }
634
+ });
635
+ React3.useImperativeHandle(actionsRef, () => ({
636
+ unmount: handleUnmount
637
+ }), [handleUnmount]);
638
+ const setValue = useStableCallback((nextValue, eventDetails) => {
639
+ onValueChange?.(nextValue, eventDetails);
640
+ if (eventDetails.isCanceled) {
641
+ return;
642
+ }
643
+ setValueUnwrapped(nextValue);
644
+ });
645
+ const handleScrollArrowVisibility = useStableCallback(() => {
646
+ const scroller = store.state.listElement || popupRef.current;
647
+ if (!scroller) {
648
+ return;
649
+ }
650
+ const maxScrollTop = getMaxScrollOffset(scroller.scrollHeight, scroller.clientHeight);
651
+ const scrollTop = normalizeScrollOffset(scroller.scrollTop, maxScrollTop);
652
+ const shouldShowUp = scrollTop > 0;
653
+ const shouldShowDown = scrollTop < maxScrollTop;
654
+ if (store.state.scrollUpArrowVisible !== shouldShowUp) {
655
+ store.set("scrollUpArrowVisible", shouldShowUp);
656
+ }
657
+ if (store.state.scrollDownArrowVisible !== shouldShowDown) {
658
+ store.set("scrollDownArrowVisible", shouldShowDown);
659
+ }
660
+ });
661
+ const floatingContext = useFloatingRootContext({
662
+ open,
663
+ onOpenChange: setOpen,
664
+ elements: {
665
+ reference: triggerElement,
666
+ floating: positionerElement
667
+ }
668
+ });
669
+ const click = useClick(floatingContext, {
670
+ enabled: !readOnly && !disabled,
671
+ event: "mousedown"
672
+ });
673
+ const dismiss = useDismiss(floatingContext, {
674
+ bubbles: false
675
+ });
676
+ const listNavigation = useListNavigation(floatingContext, {
677
+ enabled: !readOnly && !disabled,
678
+ listRef,
679
+ activeIndex,
680
+ selectedIndex,
681
+ disabledIndices: EMPTY_ARRAY,
682
+ onNavigate(nextActiveIndex) {
683
+ if (nextActiveIndex === null && !open) {
684
+ return;
685
+ }
686
+ store.set("activeIndex", nextActiveIndex);
687
+ },
688
+ focusItemOnHover: highlightItemOnHover
689
+ });
690
+ const typeahead = useTypeahead(floatingContext, {
691
+ enabled: !readOnly && !disabled && (open || !multiple),
692
+ listRef: labelsRef,
693
+ activeIndex,
694
+ selectedIndex,
695
+ onMatch(index) {
696
+ if (open) {
697
+ store.set("activeIndex", index);
698
+ } else {
699
+ setValue(valuesRef.current[index], createChangeEventDetails("none"));
700
+ }
701
+ },
702
+ onTypingChange(typing) {
703
+ typingRef.current = typing;
704
+ }
705
+ });
706
+ const {
707
+ getReferenceProps,
708
+ getFloatingProps,
709
+ getItemProps
710
+ } = useInteractions([click, dismiss, listNavigation, typeahead]);
711
+ const mergedTriggerProps = React3.useMemo(() => {
712
+ return mergeProps(getReferenceProps(), interactionTypeProps, generatedId ? {
713
+ id: generatedId
714
+ } : EMPTY_OBJECT);
715
+ }, [getReferenceProps, interactionTypeProps, generatedId]);
716
+ useOnFirstRender(() => {
717
+ store.update({
718
+ popupProps: getFloatingProps(),
719
+ triggerProps: mergedTriggerProps
720
+ });
721
+ });
722
+ useIsoLayoutEffect(() => {
723
+ store.update({
724
+ id: generatedId,
725
+ modal,
726
+ multiple,
727
+ value,
728
+ open,
729
+ mounted,
730
+ transitionStatus,
731
+ popupProps: getFloatingProps(),
732
+ triggerProps: mergedTriggerProps,
733
+ items,
734
+ itemToStringLabel,
735
+ itemToStringValue,
736
+ isItemEqualToValue,
737
+ openMethod: renderedOpenMethod
738
+ });
739
+ }, [store, generatedId, modal, multiple, value, open, mounted, transitionStatus, getFloatingProps, mergedTriggerProps, items, itemToStringLabel, itemToStringValue, isItemEqualToValue, renderedOpenMethod]);
740
+ const contextValue = React3.useMemo(() => ({
741
+ store,
742
+ name,
743
+ required,
744
+ disabled,
745
+ readOnly,
746
+ multiple,
747
+ highlightItemOnHover,
748
+ setValue,
749
+ setOpen,
750
+ listRef,
751
+ popupRef,
752
+ scrollHandlerRef,
753
+ handleScrollArrowVisibility,
754
+ scrollArrowsMountedCountRef,
755
+ getItemProps,
756
+ events: floatingContext.context.events,
757
+ valueRef,
758
+ valuesRef,
759
+ labelsRef,
760
+ typingRef,
761
+ selectionRef,
762
+ selectedItemTextRef,
763
+ validation,
764
+ onOpenChangeComplete,
765
+ keyboardActiveRef,
766
+ alignItemWithTriggerActiveRef,
767
+ initialValueRef
768
+ }), [store, name, required, disabled, readOnly, multiple, highlightItemOnHover, setValue, setOpen, getItemProps, floatingContext.context.events, validation, onOpenChangeComplete, handleScrollArrowVisibility]);
769
+ const ref = useMergedRefs(inputRef, validation.inputRef);
770
+ const hasMultipleSelection = multiple && Array.isArray(value) && value.length > 0;
771
+ const hiddenInputName = multiple ? undefined : name;
772
+ const hiddenInputs = React3.useMemo(() => {
773
+ if (!multiple || !Array.isArray(value) || !name) {
774
+ return null;
775
+ }
776
+ return value.map((v) => {
777
+ const currentSerializedValue = stringifyAsValue(v, itemToStringValue);
778
+ return /* @__PURE__ */ _jsx2("input", {
779
+ type: "hidden",
780
+ form,
781
+ name,
782
+ value: currentSerializedValue
783
+ }, currentSerializedValue);
784
+ });
785
+ }, [multiple, value, form, name, itemToStringValue]);
786
+ return /* @__PURE__ */ _jsx2(SelectRootContext.Provider, {
787
+ value: contextValue,
788
+ children: /* @__PURE__ */ _jsxs(SelectFloatingContext.Provider, {
789
+ value: floatingContext,
790
+ children: [children, /* @__PURE__ */ _jsx2("input", {
791
+ ...validation.getInputValidationProps({
792
+ onFocus() {
793
+ store.state.triggerElement?.focus({
794
+ focusVisible: true
795
+ });
796
+ },
797
+ onChange(event) {
798
+ if (event.nativeEvent.defaultPrevented) {
799
+ return;
800
+ }
801
+ const nextValue = event.currentTarget.value;
802
+ const details = createChangeEventDetails(exports_reason_parts.none, event.nativeEvent);
803
+ function handleChange() {
804
+ if (multiple) {
805
+ return;
806
+ }
807
+ const matchingValue = valuesRef.current.find((v) => {
808
+ const candidateValue = stringifyAsValue(v, itemToStringValue);
809
+ if (candidateValue.toLowerCase() === nextValue.toLowerCase()) {
810
+ return true;
811
+ }
812
+ const candidateLabel = stringifyAsLabel(v, itemToStringLabel);
813
+ if (candidateLabel.toLowerCase() === nextValue.toLowerCase()) {
814
+ return true;
815
+ }
816
+ return false;
817
+ });
818
+ if (matchingValue != null) {
819
+ setDirty(matchingValue !== validityData.initialValue);
820
+ setValue(matchingValue, details);
821
+ if (shouldValidateOnChange()) {
822
+ validation.commit(matchingValue);
823
+ }
824
+ }
825
+ }
826
+ store.set("forceMount", true);
827
+ queueMicrotask(handleChange);
828
+ }
829
+ }),
830
+ id: generatedId && hiddenInputName == null ? `${generatedId}-hidden-input` : undefined,
831
+ form,
832
+ name: hiddenInputName,
833
+ autoComplete,
834
+ value: serializedValue,
835
+ disabled,
836
+ required: required && !hasMultipleSelection,
837
+ readOnly,
838
+ ref,
839
+ style: name ? visuallyHiddenInput : visuallyHidden,
840
+ tabIndex: -1,
841
+ "aria-hidden": true,
842
+ suppressHydrationWarning: true
843
+ }), hiddenInputs]
844
+ })
845
+ });
846
+ }
847
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/select/label/SelectLabel.js
848
+ import * as React4 from "react";
849
+ "use client";
850
+ var SelectLabel = /* @__PURE__ */ React4.forwardRef(function SelectLabel2(componentProps, forwardedRef) {
851
+ const {
852
+ render,
853
+ className,
854
+ style,
855
+ ...elementProps
856
+ } = componentProps;
857
+ const elementPropsWithoutId = elementProps;
858
+ delete elementPropsWithoutId.id;
859
+ const fieldRootContext = useFieldRootContext();
860
+ const {
861
+ store
862
+ } = useSelectRootContext();
863
+ const triggerElement = useStore(store, selectors.triggerElement);
864
+ const rootId = useStore(store, selectors.id);
865
+ const defaultLabelId = getDefaultLabelId(rootId);
866
+ const labelProps = useLabel({
867
+ id: defaultLabelId,
868
+ fallbackControlId: triggerElement?.id ?? rootId,
869
+ setLabelId(nextLabelId) {
870
+ store.set("labelId", nextLabelId);
871
+ }
872
+ });
873
+ return useRenderElement("div", componentProps, {
874
+ ref: forwardedRef,
875
+ state: fieldRootContext.state,
876
+ props: [labelProps, elementProps],
877
+ stateAttributesMapping: fieldValidityMapping
878
+ });
879
+ });
880
+ if (true)
881
+ SelectLabel.displayName = "SelectLabel";
882
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/select/trigger/SelectTrigger.js
883
+ import * as React5 from "react";
884
+ "use client";
885
+ var BOUNDARY_OFFSET = 2;
886
+ var SELECTED_DELAY = 400;
887
+ var UNSELECTED_DELAY = 200;
888
+ var stateAttributesMapping = {
889
+ ...pressableTriggerOpenStateMapping,
890
+ ...fieldValidityMapping,
891
+ value: () => null
892
+ };
893
+ var SelectTrigger = /* @__PURE__ */ React5.forwardRef(function SelectTrigger2(componentProps, forwardedRef) {
894
+ const {
895
+ render,
896
+ className,
897
+ id: idProp,
898
+ disabled: disabledProp = false,
899
+ nativeButton = true,
900
+ style,
901
+ ...elementProps
902
+ } = componentProps;
903
+ const {
904
+ setTouched,
905
+ setFocused,
906
+ validationMode,
907
+ state: fieldState,
908
+ disabled: fieldDisabled
909
+ } = useFieldRootContext();
910
+ const {
911
+ labelId: fieldLabelId
912
+ } = useLabelableContext();
913
+ const {
914
+ store,
915
+ setOpen,
916
+ selectionRef,
917
+ validation,
918
+ readOnly,
919
+ required,
920
+ alignItemWithTriggerActiveRef,
921
+ disabled: selectDisabled,
922
+ keyboardActiveRef
923
+ } = useSelectRootContext();
924
+ const disabled = fieldDisabled || selectDisabled || disabledProp;
925
+ const open = useStore(store, selectors.open);
926
+ const value = useStore(store, selectors.value);
927
+ const triggerProps = useStore(store, selectors.triggerProps);
928
+ const positionerElement = useStore(store, selectors.positionerElement);
929
+ const listElement = useStore(store, selectors.listElement);
930
+ const rootId = useStore(store, selectors.id);
931
+ const selectLabelId = useStore(store, selectors.labelId);
932
+ const hasSelectedValue = useStore(store, selectors.hasSelectedValue);
933
+ const shouldCheckNullItemLabel = !hasSelectedValue && open;
934
+ const hasNullItemLabel2 = useStore(store, selectors.hasNullItemLabel, shouldCheckNullItemLabel);
935
+ const id = idProp ?? rootId;
936
+ const ariaLabelledBy = resolveAriaLabelledBy(fieldLabelId, selectLabelId);
937
+ useLabelableId({
938
+ id
939
+ });
940
+ const positionerRef = useValueAsRef(positionerElement);
941
+ const triggerRef = React5.useRef(null);
942
+ const {
943
+ getButtonProps,
944
+ buttonRef
945
+ } = useButton({
946
+ disabled,
947
+ native: nativeButton
948
+ });
949
+ const setTriggerElement = useStableCallback((element) => {
950
+ store.set("triggerElement", element);
951
+ });
952
+ const mergedRef = useMergedRefs(forwardedRef, triggerRef, buttonRef, setTriggerElement);
953
+ const timeoutFocus = useTimeout();
954
+ const timeoutMouseDown = useTimeout();
955
+ const selectedDelayTimeout = useTimeout();
956
+ const unselectedDelayTimeout = useTimeout();
957
+ React5.useEffect(() => {
958
+ if (open) {
959
+ const hasSelectedItemInList = hasSelectedValue || hasNullItemLabel2;
960
+ const shouldDelayUnselectedMouseUpLonger = !hasSelectedItemInList;
961
+ if (shouldDelayUnselectedMouseUpLonger) {
962
+ selectedDelayTimeout.start(SELECTED_DELAY, () => {
963
+ selectionRef.current.allowUnselectedMouseUp = true;
964
+ selectionRef.current.allowSelectedMouseUp = true;
965
+ });
966
+ } else {
967
+ unselectedDelayTimeout.start(UNSELECTED_DELAY, () => {
968
+ selectionRef.current.allowUnselectedMouseUp = true;
969
+ selectedDelayTimeout.start(UNSELECTED_DELAY, () => {
970
+ selectionRef.current.allowSelectedMouseUp = true;
971
+ });
972
+ });
973
+ }
974
+ return () => {
975
+ selectedDelayTimeout.clear();
976
+ unselectedDelayTimeout.clear();
977
+ };
978
+ }
979
+ selectionRef.current = {
980
+ allowSelectedMouseUp: false,
981
+ allowUnselectedMouseUp: false
982
+ };
983
+ timeoutMouseDown.clear();
984
+ return;
985
+ }, [open, hasSelectedValue, hasNullItemLabel2, selectionRef, timeoutMouseDown, selectedDelayTimeout, unselectedDelayTimeout]);
986
+ const ariaControlsId = React5.useMemo(() => {
987
+ return listElement?.id ?? getFloatingFocusElement(positionerElement)?.id;
988
+ }, [listElement, positionerElement]);
989
+ const props = mergeProps(triggerProps, {
990
+ id,
991
+ role: "combobox",
992
+ "aria-expanded": open ? "true" : "false",
993
+ "aria-haspopup": "listbox",
994
+ "aria-controls": open ? ariaControlsId : undefined,
995
+ "aria-labelledby": ariaLabelledBy,
996
+ "aria-readonly": readOnly || undefined,
997
+ "aria-required": required || undefined,
998
+ tabIndex: disabled ? -1 : 0,
999
+ ref: mergedRef,
1000
+ onFocus(event) {
1001
+ setFocused(true);
1002
+ if (open && alignItemWithTriggerActiveRef.current) {
1003
+ setOpen(false, createChangeEventDetails(exports_reason_parts.none, event.nativeEvent));
1004
+ }
1005
+ timeoutFocus.start(0, () => {
1006
+ store.set("forceMount", true);
1007
+ });
1008
+ },
1009
+ onBlur(event) {
1010
+ if (contains(positionerElement, event.relatedTarget)) {
1011
+ return;
1012
+ }
1013
+ setTouched(true);
1014
+ setFocused(false);
1015
+ if (validationMode === "onBlur") {
1016
+ validation.commit(value);
1017
+ }
1018
+ },
1019
+ onPointerMove() {
1020
+ keyboardActiveRef.current = false;
1021
+ },
1022
+ onKeyDown() {
1023
+ keyboardActiveRef.current = true;
1024
+ },
1025
+ onMouseDown(event) {
1026
+ if (open) {
1027
+ return;
1028
+ }
1029
+ const doc = ownerDocument(event.currentTarget);
1030
+ function handleMouseUp(mouseEvent) {
1031
+ if (!triggerRef.current) {
1032
+ return;
1033
+ }
1034
+ const mouseUpTarget = mouseEvent.target;
1035
+ if (contains(triggerRef.current, mouseUpTarget) || contains(positionerRef.current, mouseUpTarget) || mouseUpTarget === triggerRef.current) {
1036
+ return;
1037
+ }
1038
+ const bounds = getPseudoElementBounds(triggerRef.current);
1039
+ if (mouseEvent.clientX >= bounds.left - BOUNDARY_OFFSET && mouseEvent.clientX <= bounds.right + BOUNDARY_OFFSET && mouseEvent.clientY >= bounds.top - BOUNDARY_OFFSET && mouseEvent.clientY <= bounds.bottom + BOUNDARY_OFFSET) {
1040
+ return;
1041
+ }
1042
+ setOpen(false, createChangeEventDetails(exports_reason_parts.cancelOpen, mouseEvent));
1043
+ }
1044
+ timeoutMouseDown.start(0, () => {
1045
+ doc.addEventListener("mouseup", handleMouseUp, {
1046
+ once: true
1047
+ });
1048
+ });
1049
+ }
1050
+ }, validation.getValidationProps, elementProps, getButtonProps);
1051
+ props.role = "combobox";
1052
+ const state = {
1053
+ ...fieldState,
1054
+ open,
1055
+ disabled,
1056
+ value,
1057
+ readOnly,
1058
+ placeholder: !hasSelectedValue
1059
+ };
1060
+ return useRenderElement("button", componentProps, {
1061
+ ref: [forwardedRef, triggerRef],
1062
+ state,
1063
+ stateAttributesMapping,
1064
+ props
1065
+ });
1066
+ });
1067
+ if (true)
1068
+ SelectTrigger.displayName = "SelectTrigger";
1069
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/select/value/SelectValue.js
1070
+ import * as React6 from "react";
1071
+ "use client";
1072
+ var stateAttributesMapping2 = {
1073
+ value: () => null
1074
+ };
1075
+ var SelectValue = /* @__PURE__ */ React6.forwardRef(function SelectValue2(componentProps, forwardedRef) {
1076
+ const {
1077
+ className,
1078
+ render,
1079
+ children: childrenProp,
1080
+ placeholder,
1081
+ style,
1082
+ ...elementProps
1083
+ } = componentProps;
1084
+ const {
1085
+ store,
1086
+ valueRef
1087
+ } = useSelectRootContext();
1088
+ const value = useStore(store, selectors.value);
1089
+ const items = useStore(store, selectors.items);
1090
+ const itemToStringLabel = useStore(store, selectors.itemToStringLabel);
1091
+ const hasSelectedValue = useStore(store, selectors.hasSelectedValue);
1092
+ const shouldCheckNullItemLabel = !hasSelectedValue && placeholder != null && childrenProp == null;
1093
+ const hasNullLabel = useStore(store, selectors.hasNullItemLabel, shouldCheckNullItemLabel);
1094
+ const state = {
1095
+ value,
1096
+ placeholder: !hasSelectedValue
1097
+ };
1098
+ let children = null;
1099
+ if (typeof childrenProp === "function") {
1100
+ children = childrenProp(value);
1101
+ } else if (childrenProp != null) {
1102
+ children = childrenProp;
1103
+ } else if (!hasSelectedValue && placeholder != null && !hasNullLabel) {
1104
+ children = placeholder;
1105
+ } else if (Array.isArray(value)) {
1106
+ children = resolveMultipleLabels(value, items, itemToStringLabel);
1107
+ } else {
1108
+ children = resolveSelectedLabel(value, items, itemToStringLabel);
1109
+ }
1110
+ const element = useRenderElement("span", componentProps, {
1111
+ state,
1112
+ ref: [forwardedRef, valueRef],
1113
+ props: [{
1114
+ children
1115
+ }, elementProps],
1116
+ stateAttributesMapping: stateAttributesMapping2
1117
+ });
1118
+ return element;
1119
+ });
1120
+ if (true)
1121
+ SelectValue.displayName = "SelectValue";
1122
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/select/icon/SelectIcon.js
1123
+ import * as React7 from "react";
1124
+ "use client";
1125
+ var SelectIcon = /* @__PURE__ */ React7.forwardRef(function SelectIcon2(componentProps, forwardedRef) {
1126
+ const {
1127
+ className,
1128
+ render,
1129
+ style,
1130
+ ...elementProps
1131
+ } = componentProps;
1132
+ const {
1133
+ store
1134
+ } = useSelectRootContext();
1135
+ const open = useStore(store, selectors.open);
1136
+ const state = {
1137
+ open
1138
+ };
1139
+ const element = useRenderElement("span", componentProps, {
1140
+ state,
1141
+ ref: forwardedRef,
1142
+ props: [{
1143
+ "aria-hidden": true,
1144
+ children: "▼"
1145
+ }, elementProps],
1146
+ stateAttributesMapping: triggerOpenStateMapping
1147
+ });
1148
+ return element;
1149
+ });
1150
+ if (true)
1151
+ SelectIcon.displayName = "SelectIcon";
1152
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/select/portal/SelectPortal.js
1153
+ import * as React9 from "react";
1154
+
1155
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/select/portal/SelectPortalContext.js
1156
+ import * as React8 from "react";
1157
+ "use client";
1158
+ var SelectPortalContext = /* @__PURE__ */ React8.createContext(undefined);
1159
+ if (true)
1160
+ SelectPortalContext.displayName = "SelectPortalContext";
1161
+
1162
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/select/portal/SelectPortal.js
1163
+ import { jsx as _jsx3 } from "react/jsx-runtime";
1164
+ "use client";
1165
+ var SelectPortal = /* @__PURE__ */ React9.forwardRef(function SelectPortal2(portalProps, forwardedRef) {
1166
+ const {
1167
+ store
1168
+ } = useSelectRootContext();
1169
+ const mounted = useStore(store, selectors.mounted);
1170
+ const forceMount = useStore(store, selectors.forceMount);
1171
+ const shouldRender = mounted || forceMount;
1172
+ if (!shouldRender) {
1173
+ return null;
1174
+ }
1175
+ return /* @__PURE__ */ _jsx3(SelectPortalContext.Provider, {
1176
+ value: true,
1177
+ children: /* @__PURE__ */ _jsx3(FloatingPortal, {
1178
+ ref: forwardedRef,
1179
+ ...portalProps
1180
+ })
1181
+ });
1182
+ });
1183
+ if (true)
1184
+ SelectPortal.displayName = "SelectPortal";
1185
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/select/backdrop/SelectBackdrop.js
1186
+ import * as React10 from "react";
1187
+ "use client";
1188
+ var stateAttributesMapping3 = {
1189
+ ...popupStateMapping,
1190
+ ...transitionStatusMapping
1191
+ };
1192
+ var SelectBackdrop = /* @__PURE__ */ React10.forwardRef(function SelectBackdrop2(componentProps, forwardedRef) {
1193
+ const {
1194
+ className,
1195
+ render,
1196
+ style,
1197
+ ...elementProps
1198
+ } = componentProps;
1199
+ const {
1200
+ store
1201
+ } = useSelectRootContext();
1202
+ const open = useStore(store, selectors.open);
1203
+ const mounted = useStore(store, selectors.mounted);
1204
+ const transitionStatus = useStore(store, selectors.transitionStatus);
1205
+ const state = {
1206
+ open,
1207
+ transitionStatus
1208
+ };
1209
+ const element = useRenderElement("div", componentProps, {
1210
+ state,
1211
+ ref: forwardedRef,
1212
+ props: [{
1213
+ role: "presentation",
1214
+ hidden: !mounted,
1215
+ style: {
1216
+ userSelect: "none",
1217
+ WebkitUserSelect: "none"
1218
+ }
1219
+ }, elementProps],
1220
+ stateAttributesMapping: stateAttributesMapping3
1221
+ });
1222
+ return element;
1223
+ });
1224
+ if (true)
1225
+ SelectBackdrop.displayName = "SelectBackdrop";
1226
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/select/positioner/SelectPositioner.js
1227
+ import * as React12 from "react";
1228
+
1229
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/select/positioner/SelectPositionerContext.js
1230
+ import * as React11 from "react";
1231
+ "use client";
1232
+ var SelectPositionerContext = /* @__PURE__ */ React11.createContext(undefined);
1233
+ if (true)
1234
+ SelectPositionerContext.displayName = "SelectPositionerContext";
1235
+ function useSelectPositionerContext() {
1236
+ const context = React11.useContext(SelectPositionerContext);
1237
+ if (!context) {
1238
+ throw new Error("Base UI: SelectPositionerContext is missing. SelectPositioner parts must be placed within <Select.Positioner>.");
1239
+ }
1240
+ return context;
1241
+ }
1242
+
1243
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/select/popup/utils.js
1244
+ function clearStyles(element, originalStyles) {
1245
+ if (element) {
1246
+ Object.assign(element.style, originalStyles);
1247
+ }
1248
+ }
1249
+ var LIST_FUNCTIONAL_STYLES = {
1250
+ position: "relative",
1251
+ maxHeight: "100%",
1252
+ overflowX: "hidden",
1253
+ overflowY: "auto"
1254
+ };
1255
+
1256
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/select/positioner/SelectPositioner.js
1257
+ import { jsx as _jsx4, jsxs as _jsxs2 } from "react/jsx-runtime";
1258
+ "use client";
1259
+ var FIXED = {
1260
+ position: "fixed"
1261
+ };
1262
+ var SelectPositioner = /* @__PURE__ */ React12.forwardRef(function SelectPositioner2(componentProps, forwardedRef) {
1263
+ const {
1264
+ anchor,
1265
+ positionMethod = "absolute",
1266
+ className,
1267
+ render,
1268
+ side = "bottom",
1269
+ align = "center",
1270
+ sideOffset = 0,
1271
+ alignOffset = 0,
1272
+ collisionBoundary = "clipping-ancestors",
1273
+ collisionPadding,
1274
+ arrowPadding = 5,
1275
+ sticky = false,
1276
+ disableAnchorTracking,
1277
+ alignItemWithTrigger = true,
1278
+ collisionAvoidance = DROPDOWN_COLLISION_AVOIDANCE,
1279
+ style,
1280
+ ...elementProps
1281
+ } = componentProps;
1282
+ const {
1283
+ store,
1284
+ listRef,
1285
+ labelsRef,
1286
+ alignItemWithTriggerActiveRef,
1287
+ selectedItemTextRef,
1288
+ valuesRef,
1289
+ initialValueRef,
1290
+ popupRef,
1291
+ setValue
1292
+ } = useSelectRootContext();
1293
+ const floatingRootContext = useSelectFloatingContext();
1294
+ const open = useStore(store, selectors.open);
1295
+ const mounted = useStore(store, selectors.mounted);
1296
+ const modal = useStore(store, selectors.modal);
1297
+ const value = useStore(store, selectors.value);
1298
+ const openMethod = useStore(store, selectors.openMethod);
1299
+ const positionerElement = useStore(store, selectors.positionerElement);
1300
+ const triggerElement = useStore(store, selectors.triggerElement);
1301
+ const isItemEqualToValue = useStore(store, selectors.isItemEqualToValue);
1302
+ const transitionStatus = useStore(store, selectors.transitionStatus);
1303
+ const scrollUpArrowRef = React12.useRef(null);
1304
+ const scrollDownArrowRef = React12.useRef(null);
1305
+ const [controlledAlignItemWithTrigger, setControlledAlignItemWithTrigger] = React12.useState(alignItemWithTrigger);
1306
+ const alignItemWithTriggerActive = mounted && controlledAlignItemWithTrigger && openMethod !== "touch";
1307
+ if (!mounted && controlledAlignItemWithTrigger !== alignItemWithTrigger) {
1308
+ setControlledAlignItemWithTrigger(alignItemWithTrigger);
1309
+ }
1310
+ useIsoLayoutEffect(() => {
1311
+ if (!mounted) {
1312
+ if (selectors.scrollUpArrowVisible(store.state)) {
1313
+ store.set("scrollUpArrowVisible", false);
1314
+ }
1315
+ if (selectors.scrollDownArrowVisible(store.state)) {
1316
+ store.set("scrollDownArrowVisible", false);
1317
+ }
1318
+ }
1319
+ }, [store, mounted]);
1320
+ React12.useImperativeHandle(alignItemWithTriggerActiveRef, () => alignItemWithTriggerActive);
1321
+ useAnchoredPopupScrollLock((alignItemWithTriggerActive || modal) && open, openMethod === "touch", positionerElement, triggerElement);
1322
+ const positioning = useAnchorPositioning({
1323
+ anchor,
1324
+ floatingRootContext,
1325
+ positionMethod,
1326
+ mounted,
1327
+ side,
1328
+ sideOffset,
1329
+ align,
1330
+ alignOffset,
1331
+ arrowPadding,
1332
+ collisionBoundary,
1333
+ collisionPadding,
1334
+ sticky,
1335
+ disableAnchorTracking: disableAnchorTracking ?? alignItemWithTriggerActive,
1336
+ collisionAvoidance,
1337
+ keepMounted: true
1338
+ });
1339
+ const renderedSide = alignItemWithTriggerActive ? "none" : positioning.side;
1340
+ const positionerStyles = alignItemWithTriggerActive ? FIXED : positioning.positionerStyles;
1341
+ const state = {
1342
+ open,
1343
+ side: renderedSide,
1344
+ align: positioning.align,
1345
+ anchorHidden: positioning.anchorHidden
1346
+ };
1347
+ const setPositionerElement = useStableCallback((element2) => {
1348
+ store.set("positionerElement", element2);
1349
+ });
1350
+ const element = usePositioner(componentProps, state, {
1351
+ styles: positionerStyles,
1352
+ transitionStatus,
1353
+ props: elementProps,
1354
+ refs: [forwardedRef, setPositionerElement],
1355
+ hidden: !mounted,
1356
+ inert: !open
1357
+ });
1358
+ const prevMapSizeRef = React12.useRef(0);
1359
+ const onMapChange = useStableCallback((map) => {
1360
+ if (map.size === 0 && prevMapSizeRef.current === 0) {
1361
+ return;
1362
+ }
1363
+ if (valuesRef.current.length === 0) {
1364
+ return;
1365
+ }
1366
+ const prevSize = prevMapSizeRef.current;
1367
+ prevMapSizeRef.current = map.size;
1368
+ if (map.size === prevSize) {
1369
+ return;
1370
+ }
1371
+ const eventDetails = createChangeEventDetails(exports_reason_parts.none);
1372
+ if (prevSize !== 0 && !store.state.multiple && value !== null) {
1373
+ const selectedValueIndex = findItemIndex(valuesRef.current, value, isItemEqualToValue);
1374
+ if (selectedValueIndex === -1) {
1375
+ const initialSelectedValue = initialValueRef.current;
1376
+ const hasInitial = initialSelectedValue != null && findItemIndex(valuesRef.current, initialSelectedValue, isItemEqualToValue) !== -1;
1377
+ const nextValue = hasInitial ? initialSelectedValue : null;
1378
+ setValue(nextValue, eventDetails);
1379
+ if (nextValue === null) {
1380
+ store.set("selectedIndex", null);
1381
+ selectedItemTextRef.current = null;
1382
+ }
1383
+ }
1384
+ }
1385
+ if (prevSize !== 0 && store.state.multiple && Array.isArray(value)) {
1386
+ const hasVisibleItem = (selectedItemValue) => findItemIndex(valuesRef.current, selectedItemValue, isItemEqualToValue) !== -1;
1387
+ const nextValue = value.filter((selectedItemValue) => hasVisibleItem(selectedItemValue));
1388
+ if (nextValue.length !== value.length || nextValue.some((selectedItemValue) => !selectedValueIncludes(value, selectedItemValue, isItemEqualToValue))) {
1389
+ setValue(nextValue, eventDetails);
1390
+ if (nextValue.length === 0) {
1391
+ store.set("selectedIndex", null);
1392
+ selectedItemTextRef.current = null;
1393
+ }
1394
+ }
1395
+ }
1396
+ if (open && alignItemWithTriggerActive) {
1397
+ store.update({
1398
+ scrollUpArrowVisible: false,
1399
+ scrollDownArrowVisible: false
1400
+ });
1401
+ const stylesToClear = {
1402
+ height: ""
1403
+ };
1404
+ clearStyles(positionerElement, stylesToClear);
1405
+ clearStyles(popupRef.current, stylesToClear);
1406
+ }
1407
+ });
1408
+ const contextValue = React12.useMemo(() => ({
1409
+ ...positioning,
1410
+ side: renderedSide,
1411
+ alignItemWithTriggerActive,
1412
+ setControlledAlignItemWithTrigger,
1413
+ scrollUpArrowRef,
1414
+ scrollDownArrowRef
1415
+ }), [positioning, renderedSide, alignItemWithTriggerActive, setControlledAlignItemWithTrigger]);
1416
+ return /* @__PURE__ */ _jsx4(CompositeList, {
1417
+ elementsRef: listRef,
1418
+ labelsRef,
1419
+ onMapChange,
1420
+ children: /* @__PURE__ */ _jsxs2(SelectPositionerContext.Provider, {
1421
+ value: contextValue,
1422
+ children: [mounted && modal && /* @__PURE__ */ _jsx4(InternalBackdrop, {
1423
+ inert: inertValue(!open),
1424
+ cutout: triggerElement
1425
+ }), element]
1426
+ })
1427
+ });
1428
+ });
1429
+ if (true)
1430
+ SelectPositioner.displayName = "SelectPositioner";
1431
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/select/popup/SelectPopup.js
1432
+ import * as React13 from "react";
1433
+ import { jsx as _jsx5, jsxs as _jsxs3 } from "react/jsx-runtime";
1434
+ "use client";
1435
+ var stateAttributesMapping4 = {
1436
+ ...popupStateMapping,
1437
+ ...transitionStatusMapping
1438
+ };
1439
+ var SelectPopup = /* @__PURE__ */ React13.forwardRef(function SelectPopup2(componentProps, forwardedRef) {
1440
+ const {
1441
+ render,
1442
+ className,
1443
+ style,
1444
+ finalFocus,
1445
+ ...elementProps
1446
+ } = componentProps;
1447
+ const {
1448
+ store,
1449
+ popupRef,
1450
+ onOpenChangeComplete,
1451
+ setOpen,
1452
+ valueRef,
1453
+ selectedItemTextRef,
1454
+ keyboardActiveRef,
1455
+ multiple,
1456
+ handleScrollArrowVisibility,
1457
+ scrollHandlerRef,
1458
+ listRef,
1459
+ highlightItemOnHover
1460
+ } = useSelectRootContext();
1461
+ const {
1462
+ side,
1463
+ align,
1464
+ alignItemWithTriggerActive,
1465
+ isPositioned,
1466
+ setControlledAlignItemWithTrigger,
1467
+ scrollDownArrowRef,
1468
+ scrollUpArrowRef
1469
+ } = useSelectPositionerContext();
1470
+ const insideToolbar = useToolbarRootContext(true) != null;
1471
+ const floatingRootContext = useSelectFloatingContext();
1472
+ const direction = useDirection();
1473
+ const {
1474
+ nonce,
1475
+ disableStyleElements
1476
+ } = useCSPContext();
1477
+ const id = useStore(store, selectors.id);
1478
+ const open = useStore(store, selectors.open);
1479
+ const mounted = useStore(store, selectors.mounted);
1480
+ const popupProps = useStore(store, selectors.popupProps);
1481
+ const transitionStatus = useStore(store, selectors.transitionStatus);
1482
+ const triggerElement = useStore(store, selectors.triggerElement);
1483
+ const positionerElement = useStore(store, selectors.positionerElement);
1484
+ const listElement = useStore(store, selectors.listElement);
1485
+ const reachedMaxHeightRef = React13.useRef(false);
1486
+ const initialPlacedRef = React13.useRef(false);
1487
+ const originalPositionerStylesRef = React13.useRef({});
1488
+ const scrollArrowFrame = useAnimationFrame();
1489
+ const handleScroll = useStableCallback((scroller) => {
1490
+ if (!positionerElement || !popupRef.current || !initialPlacedRef.current) {
1491
+ return;
1492
+ }
1493
+ if (reachedMaxHeightRef.current || !alignItemWithTriggerActive) {
1494
+ handleScrollArrowVisibility();
1495
+ return;
1496
+ }
1497
+ const isTopPositioned = positionerElement.style.top === "0px";
1498
+ const isBottomPositioned = positionerElement.style.bottom === "0px";
1499
+ if (!isTopPositioned && !isBottomPositioned) {
1500
+ handleScrollArrowVisibility();
1501
+ return;
1502
+ }
1503
+ const scale = getScale(positionerElement);
1504
+ const currentHeight = normalizeSize(positionerElement.getBoundingClientRect().height, "y", scale);
1505
+ const doc = ownerDocument(positionerElement);
1506
+ const positionerStyles = getComputedStyle(positionerElement);
1507
+ const marginTop = parseFloat(positionerStyles.marginTop);
1508
+ const marginBottom = parseFloat(positionerStyles.marginBottom);
1509
+ const maxPopupHeight = getMaxPopupHeight(getComputedStyle(popupRef.current));
1510
+ const maxAvailableHeight = Math.min(doc.documentElement.clientHeight - marginTop - marginBottom, maxPopupHeight);
1511
+ const scrollTop = scroller.scrollTop;
1512
+ const maxScrollTop = getMaxScrollTop(scroller);
1513
+ let nextPositionerHeight = 0;
1514
+ let nextScrollTop = null;
1515
+ let setReachedMax = false;
1516
+ let scrollToMax = false;
1517
+ const setHeight = (height) => {
1518
+ positionerElement.style.height = `${height}px`;
1519
+ };
1520
+ const handleSmallDiff = (diff2, targetScrollTop) => {
1521
+ const heightDelta = clamp(diff2, 0, maxAvailableHeight - currentHeight);
1522
+ if (heightDelta > 0) {
1523
+ setHeight(currentHeight + heightDelta);
1524
+ }
1525
+ scroller.scrollTop = targetScrollTop;
1526
+ if (maxAvailableHeight - (currentHeight + heightDelta) <= SCROLL_EDGE_TOLERANCE_PX) {
1527
+ reachedMaxHeightRef.current = true;
1528
+ }
1529
+ handleScrollArrowVisibility();
1530
+ };
1531
+ const diff = isTopPositioned ? maxScrollTop - scrollTop : scrollTop;
1532
+ const nextHeight = Math.min(currentHeight + diff, maxAvailableHeight);
1533
+ nextPositionerHeight = nextHeight;
1534
+ if (diff <= SCROLL_EDGE_TOLERANCE_PX) {
1535
+ handleSmallDiff(diff, isTopPositioned ? maxScrollTop : 0);
1536
+ return;
1537
+ }
1538
+ if (maxAvailableHeight - nextHeight > SCROLL_EDGE_TOLERANCE_PX) {
1539
+ if (isTopPositioned) {
1540
+ scrollToMax = true;
1541
+ } else {
1542
+ nextScrollTop = 0;
1543
+ }
1544
+ } else {
1545
+ setReachedMax = true;
1546
+ if (isBottomPositioned && scrollTop < maxScrollTop) {
1547
+ const overshoot = currentHeight + diff - maxAvailableHeight;
1548
+ nextScrollTop = scrollTop - (diff - overshoot);
1549
+ }
1550
+ }
1551
+ nextPositionerHeight = Math.ceil(nextPositionerHeight);
1552
+ if (nextPositionerHeight !== 0) {
1553
+ setHeight(nextPositionerHeight);
1554
+ }
1555
+ if (scrollToMax || nextScrollTop != null) {
1556
+ const nextMaxScrollTop = getMaxScrollTop(scroller);
1557
+ const target = scrollToMax ? nextMaxScrollTop : clamp(nextScrollTop, 0, nextMaxScrollTop);
1558
+ if (Math.abs(scroller.scrollTop - target) > SCROLL_EDGE_TOLERANCE_PX) {
1559
+ scroller.scrollTop = target;
1560
+ }
1561
+ }
1562
+ if (setReachedMax || nextPositionerHeight >= maxAvailableHeight - SCROLL_EDGE_TOLERANCE_PX) {
1563
+ reachedMaxHeightRef.current = true;
1564
+ }
1565
+ handleScrollArrowVisibility();
1566
+ });
1567
+ React13.useImperativeHandle(scrollHandlerRef, () => handleScroll, [handleScroll]);
1568
+ useOpenChangeComplete({
1569
+ open,
1570
+ ref: popupRef,
1571
+ onComplete() {
1572
+ if (open) {
1573
+ onOpenChangeComplete?.(true);
1574
+ }
1575
+ }
1576
+ });
1577
+ const state = {
1578
+ open,
1579
+ transitionStatus,
1580
+ side,
1581
+ align
1582
+ };
1583
+ useIsoLayoutEffect(() => {
1584
+ if (!positionerElement || !popupRef.current || Object.keys(originalPositionerStylesRef.current).length) {
1585
+ return;
1586
+ }
1587
+ originalPositionerStylesRef.current = {
1588
+ top: positionerElement.style.top || "0",
1589
+ left: positionerElement.style.left || "0",
1590
+ right: positionerElement.style.right,
1591
+ height: positionerElement.style.height,
1592
+ bottom: positionerElement.style.bottom,
1593
+ minHeight: positionerElement.style.minHeight,
1594
+ maxHeight: positionerElement.style.maxHeight,
1595
+ marginTop: positionerElement.style.marginTop,
1596
+ marginBottom: positionerElement.style.marginBottom
1597
+ };
1598
+ }, [popupRef, positionerElement]);
1599
+ useIsoLayoutEffect(() => {
1600
+ if (open || alignItemWithTriggerActive) {
1601
+ return;
1602
+ }
1603
+ initialPlacedRef.current = false;
1604
+ reachedMaxHeightRef.current = false;
1605
+ clearStyles(positionerElement, originalPositionerStylesRef.current);
1606
+ }, [open, alignItemWithTriggerActive, positionerElement, popupRef]);
1607
+ useIsoLayoutEffect(() => {
1608
+ const popupElement = popupRef.current;
1609
+ if (!open || !triggerElement || !positionerElement || !popupElement || alignItemWithTriggerActive && !isPositioned || store.state.transitionStatus === "ending") {
1610
+ return;
1611
+ }
1612
+ if (!alignItemWithTriggerActive) {
1613
+ initialPlacedRef.current = true;
1614
+ scrollArrowFrame.request(handleScrollArrowVisibility);
1615
+ popupElement.style.removeProperty("--transform-origin");
1616
+ return;
1617
+ }
1618
+ const restoreTransformStyles = unsetTransformStyles(popupElement);
1619
+ popupElement.style.removeProperty("--transform-origin");
1620
+ try {
1621
+ const textElement = selectedItemTextRef.current;
1622
+ const valueElement = valueRef.current;
1623
+ const positionerStyles = getComputedStyle(positionerElement);
1624
+ const popupStyles = getComputedStyle(popupElement);
1625
+ const doc = ownerDocument(triggerElement);
1626
+ const win = getWindow(positionerElement);
1627
+ const scale = getScale(triggerElement);
1628
+ const triggerRect = normalizeRect(triggerElement.getBoundingClientRect(), scale);
1629
+ const positionerRect = normalizeRect(positionerElement.getBoundingClientRect(), scale);
1630
+ const triggerHeight = triggerRect.height;
1631
+ const scroller = listElement || popupElement;
1632
+ const scrollHeight = scroller.scrollHeight;
1633
+ const borderBottom = parseFloat(popupStyles.borderBottomWidth);
1634
+ const marginTop = parseFloat(positionerStyles.marginTop) || 10;
1635
+ const marginBottom = parseFloat(positionerStyles.marginBottom) || 10;
1636
+ const minHeight = parseFloat(positionerStyles.minHeight) || 100;
1637
+ const maxPopupHeight = getMaxPopupHeight(popupStyles);
1638
+ const paddingLeft = 5;
1639
+ const paddingRight = 5;
1640
+ const triggerCollisionThreshold = 20;
1641
+ const viewportHeight = doc.documentElement.clientHeight - marginTop - marginBottom;
1642
+ const viewportWidth = doc.documentElement.clientWidth;
1643
+ const availableSpaceBeneathTrigger = viewportHeight - triggerRect.bottom + triggerHeight;
1644
+ let textRect;
1645
+ let alignedLeft = direction === "rtl" ? triggerRect.right - positionerRect.width : triggerRect.left;
1646
+ let offsetY = 0;
1647
+ if (textElement && valueElement) {
1648
+ const valueRect = normalizeRect(valueElement.getBoundingClientRect(), scale);
1649
+ textRect = normalizeRect(textElement.getBoundingClientRect(), scale);
1650
+ alignedLeft = positionerRect.left + (direction === "rtl" ? valueRect.right - textRect.right : valueRect.left - textRect.left);
1651
+ const valueCenterFromTriggerTop = valueRect.top - triggerRect.top + valueRect.height / 2;
1652
+ const textCenterFromPositionerTop = textRect.top - positionerRect.top + textRect.height / 2;
1653
+ offsetY = textCenterFromPositionerTop - valueCenterFromTriggerTop;
1654
+ }
1655
+ const idealHeight = availableSpaceBeneathTrigger + offsetY + marginBottom + borderBottom;
1656
+ let height = Math.min(viewportHeight, idealHeight);
1657
+ const maxHeight = viewportHeight - marginTop - marginBottom;
1658
+ const scrollTop = idealHeight - height;
1659
+ const maxRight = viewportWidth - paddingRight;
1660
+ positionerElement.style.left = `${clamp(alignedLeft, paddingLeft, maxRight - positionerRect.width)}px`;
1661
+ positionerElement.style.height = `${height}px`;
1662
+ positionerElement.style.maxHeight = "auto";
1663
+ positionerElement.style.marginTop = `${marginTop}px`;
1664
+ positionerElement.style.marginBottom = `${marginBottom}px`;
1665
+ popupElement.style.height = "100%";
1666
+ const maxScrollTop = getMaxScrollTop(scroller);
1667
+ const isTopPositioned = scrollTop >= maxScrollTop - SCROLL_EDGE_TOLERANCE_PX;
1668
+ if (isTopPositioned) {
1669
+ height = Math.min(viewportHeight, positionerRect.height) - (scrollTop - maxScrollTop);
1670
+ }
1671
+ const fallbackToAlignPopupToTrigger = triggerRect.top < triggerCollisionThreshold || triggerRect.bottom > viewportHeight - triggerCollisionThreshold || Math.ceil(height) + SCROLL_EDGE_TOLERANCE_PX < Math.min(scrollHeight, minHeight);
1672
+ const isPinchZoomed = (win.visualViewport?.scale ?? 1) !== 1 && isWebKit;
1673
+ if (fallbackToAlignPopupToTrigger || isPinchZoomed) {
1674
+ initialPlacedRef.current = true;
1675
+ clearStyles(positionerElement, originalPositionerStylesRef.current);
1676
+ setControlledAlignItemWithTrigger(false);
1677
+ return;
1678
+ }
1679
+ const initialHeight = Math.max(minHeight, height);
1680
+ if (isTopPositioned) {
1681
+ const topOffset = Math.max(0, viewportHeight - idealHeight);
1682
+ positionerElement.style.top = positionerRect.height >= maxHeight ? "0" : `${topOffset}px`;
1683
+ positionerElement.style.height = `${height}px`;
1684
+ scroller.scrollTop = getMaxScrollTop(scroller);
1685
+ } else {
1686
+ positionerElement.style.bottom = "0";
1687
+ scroller.scrollTop = scrollTop;
1688
+ }
1689
+ if (textRect) {
1690
+ const popupTop = positionerRect.top;
1691
+ const popupHeight = positionerRect.height;
1692
+ const textCenterY = textRect.top + textRect.height / 2;
1693
+ const transformOriginY = popupHeight > 0 ? (textCenterY - popupTop) / popupHeight * 100 : 50;
1694
+ const clampedY = clamp(transformOriginY, 0, 100);
1695
+ popupElement.style.setProperty("--transform-origin", `50% ${clampedY}%`);
1696
+ }
1697
+ if (initialHeight === viewportHeight || height >= maxPopupHeight) {
1698
+ reachedMaxHeightRef.current = true;
1699
+ }
1700
+ handleScrollArrowVisibility();
1701
+ if (highlightItemOnHover && store.state.selectedIndex === null && store.state.activeIndex === null && listRef.current[0] != null) {
1702
+ store.set("activeIndex", 0);
1703
+ }
1704
+ initialPlacedRef.current = true;
1705
+ } finally {
1706
+ restoreTransformStyles();
1707
+ }
1708
+ }, [store, open, positionerElement, triggerElement, valueRef, selectedItemTextRef, popupRef, handleScrollArrowVisibility, alignItemWithTriggerActive, setControlledAlignItemWithTrigger, scrollArrowFrame, scrollDownArrowRef, scrollUpArrowRef, listElement, listRef, highlightItemOnHover, direction, isPositioned]);
1709
+ React13.useEffect(() => {
1710
+ if (!alignItemWithTriggerActive || !positionerElement || !open) {
1711
+ return;
1712
+ }
1713
+ const win = getWindow(positionerElement);
1714
+ function handleResize(event) {
1715
+ setOpen(false, createChangeEventDetails(exports_reason_parts.windowResize, event));
1716
+ }
1717
+ return addEventListener(win, "resize", handleResize);
1718
+ }, [setOpen, alignItemWithTriggerActive, positionerElement, open]);
1719
+ const defaultProps = {
1720
+ ...listElement ? {
1721
+ role: "presentation",
1722
+ "aria-orientation": undefined
1723
+ } : {
1724
+ role: "listbox",
1725
+ "aria-multiselectable": multiple || undefined,
1726
+ id: `${id}-list`
1727
+ },
1728
+ onKeyDown(event) {
1729
+ keyboardActiveRef.current = true;
1730
+ if (insideToolbar && COMPOSITE_KEYS.has(event.key)) {
1731
+ event.stopPropagation();
1732
+ }
1733
+ },
1734
+ onMouseMove() {
1735
+ keyboardActiveRef.current = false;
1736
+ },
1737
+ onScroll(event) {
1738
+ if (listElement) {
1739
+ return;
1740
+ }
1741
+ handleScroll(event.currentTarget);
1742
+ },
1743
+ ...alignItemWithTriggerActive && {
1744
+ style: listElement ? {
1745
+ height: "100%"
1746
+ } : LIST_FUNCTIONAL_STYLES
1747
+ }
1748
+ };
1749
+ const element = useRenderElement("div", componentProps, {
1750
+ ref: [forwardedRef, popupRef],
1751
+ state,
1752
+ stateAttributesMapping: stateAttributesMapping4,
1753
+ props: [popupProps, defaultProps, getDisabledMountTransitionStyles(transitionStatus), {
1754
+ className: !listElement && alignItemWithTriggerActive ? styleDisableScrollbar.className : undefined
1755
+ }, elementProps]
1756
+ });
1757
+ return /* @__PURE__ */ _jsxs3(React13.Fragment, {
1758
+ children: [!disableStyleElements && styleDisableScrollbar.getElement(nonce), /* @__PURE__ */ _jsx5(FloatingFocusManager, {
1759
+ context: floatingRootContext,
1760
+ modal: false,
1761
+ disabled: !mounted,
1762
+ returnFocus: finalFocus,
1763
+ restoreFocus: true,
1764
+ children: element
1765
+ })]
1766
+ });
1767
+ });
1768
+ if (true)
1769
+ SelectPopup.displayName = "SelectPopup";
1770
+ function getMaxPopupHeight(popupStyles) {
1771
+ const maxHeightStyle = popupStyles.maxHeight || "";
1772
+ return maxHeightStyle.endsWith("px") ? parseFloat(maxHeightStyle) || Infinity : Infinity;
1773
+ }
1774
+ function getMaxScrollTop(scroller) {
1775
+ return getMaxScrollOffset(scroller.scrollHeight, scroller.clientHeight);
1776
+ }
1777
+ function getScale(element) {
1778
+ return platform.getScale(element);
1779
+ }
1780
+ function normalizeSize(size, axis, scale) {
1781
+ return size / scale[axis];
1782
+ }
1783
+ function normalizeRect(rect, scale) {
1784
+ return rectToClientRect({
1785
+ x: normalizeSize(rect.x, "x", scale),
1786
+ y: normalizeSize(rect.y, "y", scale),
1787
+ width: normalizeSize(rect.width, "x", scale),
1788
+ height: normalizeSize(rect.height, "y", scale)
1789
+ });
1790
+ }
1791
+ var TRANSFORM_STYLE_RESETS = [["transform", "none"], ["scale", "1"], ["translate", "0 0"]];
1792
+ function unsetTransformStyles(popupElement) {
1793
+ const {
1794
+ style
1795
+ } = popupElement;
1796
+ const originalStyles = {};
1797
+ for (const [property, value] of TRANSFORM_STYLE_RESETS) {
1798
+ originalStyles[property] = style.getPropertyValue(property);
1799
+ style.setProperty(property, value, "important");
1800
+ }
1801
+ return () => {
1802
+ for (const [property] of TRANSFORM_STYLE_RESETS) {
1803
+ const originalValue = originalStyles[property];
1804
+ if (originalValue) {
1805
+ style.setProperty(property, originalValue);
1806
+ } else {
1807
+ style.removeProperty(property);
1808
+ }
1809
+ }
1810
+ };
1811
+ }
1812
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/select/list/SelectList.js
1813
+ import * as React14 from "react";
1814
+ "use client";
1815
+ var SelectList = /* @__PURE__ */ React14.forwardRef(function SelectList2(componentProps, forwardedRef) {
1816
+ const {
1817
+ className,
1818
+ render,
1819
+ style,
1820
+ ...elementProps
1821
+ } = componentProps;
1822
+ const {
1823
+ store,
1824
+ scrollHandlerRef
1825
+ } = useSelectRootContext();
1826
+ const {
1827
+ alignItemWithTriggerActive
1828
+ } = useSelectPositionerContext();
1829
+ const hasScrollArrows = useStore(store, selectors.hasScrollArrows);
1830
+ const openMethod = useStore(store, selectors.openMethod);
1831
+ const multiple = useStore(store, selectors.multiple);
1832
+ const id = useStore(store, selectors.id);
1833
+ const defaultProps = {
1834
+ id: `${id}-list`,
1835
+ role: "listbox",
1836
+ "aria-multiselectable": multiple || undefined,
1837
+ onScroll(event) {
1838
+ scrollHandlerRef.current?.(event.currentTarget);
1839
+ },
1840
+ ...alignItemWithTriggerActive && {
1841
+ style: LIST_FUNCTIONAL_STYLES
1842
+ },
1843
+ className: hasScrollArrows && openMethod !== "touch" ? styleDisableScrollbar.className : undefined
1844
+ };
1845
+ const setListElement = useStableCallback((element) => {
1846
+ store.set("listElement", element);
1847
+ });
1848
+ return useRenderElement("div", componentProps, {
1849
+ ref: [forwardedRef, setListElement],
1850
+ props: [defaultProps, elementProps]
1851
+ });
1852
+ });
1853
+ if (true)
1854
+ SelectList.displayName = "SelectList";
1855
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/select/item/SelectItem.js
1856
+ import * as React16 from "react";
1857
+
1858
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/select/item/SelectItemContext.js
1859
+ import * as React15 from "react";
1860
+ "use client";
1861
+ var SelectItemContext = /* @__PURE__ */ React15.createContext(undefined);
1862
+ if (true)
1863
+ SelectItemContext.displayName = "SelectItemContext";
1864
+ function useSelectItemContext() {
1865
+ const context = React15.useContext(SelectItemContext);
1866
+ if (!context) {
1867
+ throw new Error("Base UI: SelectItemContext is missing. SelectItem parts must be placed within <Select.Item>.");
1868
+ }
1869
+ return context;
1870
+ }
1871
+
1872
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/select/item/SelectItem.js
1873
+ import { jsx as _jsx6 } from "react/jsx-runtime";
1874
+ "use client";
1875
+ var SelectItem = /* @__PURE__ */ React16.memo(/* @__PURE__ */ React16.forwardRef(function SelectItem2(componentProps, forwardedRef) {
1876
+ const {
1877
+ render,
1878
+ className,
1879
+ value: itemValue = null,
1880
+ label,
1881
+ disabled = false,
1882
+ nativeButton = false,
1883
+ style,
1884
+ ...elementProps
1885
+ } = componentProps;
1886
+ const textRef = React16.useRef(null);
1887
+ const listItem = useCompositeListItem({
1888
+ label,
1889
+ textRef,
1890
+ indexGuessBehavior: IndexGuessBehavior.GuessFromOrder
1891
+ });
1892
+ const {
1893
+ store,
1894
+ getItemProps,
1895
+ setOpen,
1896
+ setValue,
1897
+ selectionRef,
1898
+ typingRef,
1899
+ valuesRef,
1900
+ multiple,
1901
+ selectedItemTextRef
1902
+ } = useSelectRootContext();
1903
+ const highlighted = useStore(store, selectors.isActive, listItem.index);
1904
+ const selected = useStore(store, selectors.isSelected, listItem.index, itemValue);
1905
+ const selectedByFocus = useStore(store, selectors.isSelectedByFocus, listItem.index);
1906
+ const isItemEqualToValue = useStore(store, selectors.isItemEqualToValue);
1907
+ const index = listItem.index;
1908
+ const hasRegistered = index !== -1;
1909
+ const itemRef = React16.useRef(null);
1910
+ const indexRef = useValueAsRef(index);
1911
+ useIsoLayoutEffect(() => {
1912
+ if (!hasRegistered) {
1913
+ return;
1914
+ }
1915
+ const values = valuesRef.current;
1916
+ values[index] = itemValue;
1917
+ return () => {
1918
+ delete values[index];
1919
+ };
1920
+ }, [hasRegistered, index, itemValue, valuesRef]);
1921
+ useIsoLayoutEffect(() => {
1922
+ if (!hasRegistered) {
1923
+ return;
1924
+ }
1925
+ const selectedValue = store.state.value;
1926
+ let selectedCandidate = selectedValue;
1927
+ if (multiple && Array.isArray(selectedValue) && selectedValue.length > 0) {
1928
+ selectedCandidate = selectedValue[selectedValue.length - 1];
1929
+ }
1930
+ if (selectedCandidate !== undefined && compareItemEquality(itemValue, selectedCandidate, isItemEqualToValue)) {
1931
+ store.set("selectedIndex", index);
1932
+ if (textRef.current) {
1933
+ selectedItemTextRef.current = textRef.current;
1934
+ }
1935
+ }
1936
+ }, [hasRegistered, index, multiple, isItemEqualToValue, store, itemValue, selectedItemTextRef]);
1937
+ const state = {
1938
+ disabled,
1939
+ selected,
1940
+ highlighted
1941
+ };
1942
+ const rootProps = getItemProps({
1943
+ active: highlighted,
1944
+ selected
1945
+ });
1946
+ rootProps.id = undefined;
1947
+ const lastKeyRef = React16.useRef(null);
1948
+ const pointerTypeRef = React16.useRef("mouse");
1949
+ const didPointerDownRef = React16.useRef(false);
1950
+ const {
1951
+ getButtonProps,
1952
+ buttonRef
1953
+ } = useButton({
1954
+ disabled,
1955
+ focusableWhenDisabled: true,
1956
+ native: nativeButton,
1957
+ composite: true
1958
+ });
1959
+ function commitSelection(event) {
1960
+ const selectedValue = store.state.value;
1961
+ if (multiple) {
1962
+ const currentValue = Array.isArray(selectedValue) ? selectedValue : [];
1963
+ const nextValue = selected ? removeItem(currentValue, itemValue, isItemEqualToValue) : [...currentValue, itemValue];
1964
+ setValue(nextValue, createChangeEventDetails(exports_reason_parts.itemPress, event));
1965
+ } else {
1966
+ setValue(itemValue, createChangeEventDetails(exports_reason_parts.itemPress, event));
1967
+ setOpen(false, createChangeEventDetails(exports_reason_parts.itemPress, event));
1968
+ }
1969
+ }
1970
+ const defaultProps = {
1971
+ role: "option",
1972
+ "aria-selected": selected,
1973
+ tabIndex: highlighted ? 0 : -1,
1974
+ onTouchStart() {
1975
+ selectionRef.current = {
1976
+ allowSelectedMouseUp: false,
1977
+ allowUnselectedMouseUp: false
1978
+ };
1979
+ },
1980
+ onKeyDown(event) {
1981
+ lastKeyRef.current = event.key;
1982
+ store.set("activeIndex", index);
1983
+ if (event.key === " " && typingRef.current) {
1984
+ event.preventDefault();
1985
+ }
1986
+ },
1987
+ onClick(event) {
1988
+ didPointerDownRef.current = false;
1989
+ if (event.type === "keydown" && lastKeyRef.current === null) {
1990
+ return;
1991
+ }
1992
+ if (disabled || event.type === "keydown" && lastKeyRef.current === " " && typingRef.current || pointerTypeRef.current !== "touch" && !highlighted) {
1993
+ return;
1994
+ }
1995
+ lastKeyRef.current = null;
1996
+ commitSelection(event.nativeEvent);
1997
+ },
1998
+ onPointerEnter(event) {
1999
+ pointerTypeRef.current = event.pointerType;
2000
+ },
2001
+ onPointerDown(event) {
2002
+ pointerTypeRef.current = event.pointerType;
2003
+ didPointerDownRef.current = true;
2004
+ },
2005
+ onMouseUp() {
2006
+ if (disabled) {
2007
+ return;
2008
+ }
2009
+ if (didPointerDownRef.current) {
2010
+ didPointerDownRef.current = false;
2011
+ return;
2012
+ }
2013
+ const disallowSelectedMouseUp = !selectionRef.current.allowSelectedMouseUp && selected;
2014
+ const disallowUnselectedMouseUp = !selectionRef.current.allowUnselectedMouseUp && !selected;
2015
+ if (disallowSelectedMouseUp || disallowUnselectedMouseUp || pointerTypeRef.current !== "touch" && !highlighted) {
2016
+ return;
2017
+ }
2018
+ itemRef.current?.click();
2019
+ }
2020
+ };
2021
+ const element = useRenderElement("div", componentProps, {
2022
+ ref: [buttonRef, forwardedRef, listItem.ref, itemRef],
2023
+ state,
2024
+ props: [rootProps, defaultProps, elementProps, getButtonProps]
2025
+ });
2026
+ const contextValue = React16.useMemo(() => ({
2027
+ selected,
2028
+ indexRef,
2029
+ textRef,
2030
+ selectedByFocus,
2031
+ hasRegistered
2032
+ }), [selected, indexRef, textRef, selectedByFocus, hasRegistered]);
2033
+ return /* @__PURE__ */ _jsx6(SelectItemContext.Provider, {
2034
+ value: contextValue,
2035
+ children: element
2036
+ });
2037
+ }));
2038
+ if (true)
2039
+ SelectItem.displayName = "SelectItem";
2040
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/select/item-indicator/SelectItemIndicator.js
2041
+ import * as React17 from "react";
2042
+ import { jsx as _jsx7 } from "react/jsx-runtime";
2043
+ "use client";
2044
+ var SelectItemIndicator = /* @__PURE__ */ React17.forwardRef(function SelectItemIndicator2(componentProps, forwardedRef) {
2045
+ const keepMounted = componentProps.keepMounted ?? false;
2046
+ const {
2047
+ selected
2048
+ } = useSelectItemContext();
2049
+ const shouldRender = keepMounted || selected;
2050
+ if (!shouldRender) {
2051
+ return null;
2052
+ }
2053
+ return /* @__PURE__ */ _jsx7(Inner, {
2054
+ ...componentProps,
2055
+ ref: forwardedRef
2056
+ });
2057
+ });
2058
+ if (true)
2059
+ SelectItemIndicator.displayName = "SelectItemIndicator";
2060
+ var Inner = /* @__PURE__ */ React17.memo(/* @__PURE__ */ React17.forwardRef((componentProps, forwardedRef) => {
2061
+ const {
2062
+ render,
2063
+ className,
2064
+ style,
2065
+ keepMounted,
2066
+ ...elementProps
2067
+ } = componentProps;
2068
+ const {
2069
+ selected
2070
+ } = useSelectItemContext();
2071
+ const indicatorRef = React17.useRef(null);
2072
+ const {
2073
+ transitionStatus,
2074
+ setMounted
2075
+ } = useTransitionStatus(selected);
2076
+ const state = {
2077
+ selected,
2078
+ transitionStatus
2079
+ };
2080
+ const element = useRenderElement("span", componentProps, {
2081
+ ref: [forwardedRef, indicatorRef],
2082
+ state,
2083
+ props: [{
2084
+ "aria-hidden": true,
2085
+ children: "✔️"
2086
+ }, elementProps],
2087
+ stateAttributesMapping: transitionStatusMapping
2088
+ });
2089
+ useOpenChangeComplete({
2090
+ open: selected,
2091
+ ref: indicatorRef,
2092
+ onComplete() {
2093
+ if (!selected) {
2094
+ setMounted(false);
2095
+ }
2096
+ }
2097
+ });
2098
+ return element;
2099
+ }));
2100
+ if (true)
2101
+ Inner.displayName = "Inner";
2102
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/select/item-text/SelectItemText.js
2103
+ import * as React18 from "react";
2104
+ "use client";
2105
+ var SelectItemText = /* @__PURE__ */ React18.memo(/* @__PURE__ */ React18.forwardRef(function SelectItemText2(componentProps, forwardedRef) {
2106
+ const {
2107
+ indexRef,
2108
+ textRef,
2109
+ selectedByFocus,
2110
+ hasRegistered
2111
+ } = useSelectItemContext();
2112
+ const {
2113
+ selectedItemTextRef
2114
+ } = useSelectRootContext();
2115
+ const {
2116
+ className,
2117
+ render,
2118
+ style,
2119
+ ...elementProps
2120
+ } = componentProps;
2121
+ const localRef = React18.useCallback((node) => {
2122
+ if (!node || !hasRegistered) {
2123
+ return;
2124
+ }
2125
+ const hasNoSelectedItemText = selectedItemTextRef.current === null || !selectedItemTextRef.current.isConnected;
2126
+ if (selectedByFocus || hasNoSelectedItemText && indexRef.current === 0) {
2127
+ selectedItemTextRef.current = node;
2128
+ }
2129
+ }, [selectedItemTextRef, indexRef, selectedByFocus, hasRegistered]);
2130
+ const element = useRenderElement("div", componentProps, {
2131
+ ref: [localRef, forwardedRef, textRef],
2132
+ props: elementProps
2133
+ });
2134
+ return element;
2135
+ }));
2136
+ if (true)
2137
+ SelectItemText.displayName = "SelectItemText";
2138
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/select/arrow/SelectArrow.js
2139
+ import * as React19 from "react";
2140
+ "use client";
2141
+ var stateAttributesMapping5 = {
2142
+ ...popupStateMapping,
2143
+ ...transitionStatusMapping
2144
+ };
2145
+ var SelectArrow = /* @__PURE__ */ React19.forwardRef(function SelectArrow2(componentProps, forwardedRef) {
2146
+ const {
2147
+ className,
2148
+ render,
2149
+ style,
2150
+ ...elementProps
2151
+ } = componentProps;
2152
+ const {
2153
+ store
2154
+ } = useSelectRootContext();
2155
+ const {
2156
+ side,
2157
+ align,
2158
+ arrowRef,
2159
+ arrowStyles,
2160
+ arrowUncentered,
2161
+ alignItemWithTriggerActive
2162
+ } = useSelectPositionerContext();
2163
+ const open = useStore(store, selectors.open, true);
2164
+ const state = {
2165
+ open,
2166
+ side,
2167
+ align,
2168
+ uncentered: arrowUncentered
2169
+ };
2170
+ const element = useRenderElement("div", componentProps, {
2171
+ state,
2172
+ ref: [arrowRef, forwardedRef],
2173
+ props: [{
2174
+ style: arrowStyles,
2175
+ "aria-hidden": true
2176
+ }, elementProps],
2177
+ stateAttributesMapping: stateAttributesMapping5
2178
+ });
2179
+ if (alignItemWithTriggerActive) {
2180
+ return null;
2181
+ }
2182
+ return element;
2183
+ });
2184
+ if (true)
2185
+ SelectArrow.displayName = "SelectArrow";
2186
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/select/scroll-down-arrow/SelectScrollDownArrow.js
2187
+ import * as React21 from "react";
2188
+
2189
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/select/scroll-arrow/SelectScrollArrow.js
2190
+ import * as React20 from "react";
2191
+ "use client";
2192
+ var SelectScrollArrow = /* @__PURE__ */ React20.forwardRef(function SelectScrollArrow2(componentProps, forwardedRef) {
2193
+ const {
2194
+ render,
2195
+ className,
2196
+ style,
2197
+ direction,
2198
+ keepMounted = false,
2199
+ ...elementProps
2200
+ } = componentProps;
2201
+ const isUp = direction === "up";
2202
+ const {
2203
+ store,
2204
+ popupRef,
2205
+ listRef,
2206
+ handleScrollArrowVisibility,
2207
+ scrollArrowsMountedCountRef
2208
+ } = useSelectRootContext();
2209
+ const {
2210
+ side,
2211
+ scrollDownArrowRef,
2212
+ scrollUpArrowRef
2213
+ } = useSelectPositionerContext();
2214
+ const visibleSelector = isUp ? selectors.scrollUpArrowVisible : selectors.scrollDownArrowVisible;
2215
+ const stateVisible = useStore(store, visibleSelector);
2216
+ const openMethod = useStore(store, selectors.openMethod);
2217
+ const visible = stateVisible && openMethod !== "touch";
2218
+ const timeout = useTimeout();
2219
+ const scrollArrowRef = isUp ? scrollUpArrowRef : scrollDownArrowRef;
2220
+ const {
2221
+ transitionStatus,
2222
+ setMounted
2223
+ } = useTransitionStatus(visible);
2224
+ useIsoLayoutEffect(() => {
2225
+ scrollArrowsMountedCountRef.current += 1;
2226
+ if (!store.state.hasScrollArrows) {
2227
+ store.set("hasScrollArrows", true);
2228
+ }
2229
+ return () => {
2230
+ scrollArrowsMountedCountRef.current = Math.max(0, scrollArrowsMountedCountRef.current - 1);
2231
+ if (scrollArrowsMountedCountRef.current === 0 && store.state.hasScrollArrows) {
2232
+ store.set("hasScrollArrows", false);
2233
+ }
2234
+ };
2235
+ }, [store, scrollArrowsMountedCountRef]);
2236
+ useOpenChangeComplete({
2237
+ open: visible,
2238
+ ref: scrollArrowRef,
2239
+ onComplete() {
2240
+ if (!visible) {
2241
+ setMounted(false);
2242
+ }
2243
+ }
2244
+ });
2245
+ const state = {
2246
+ direction,
2247
+ visible,
2248
+ side,
2249
+ transitionStatus
2250
+ };
2251
+ const defaultProps = {
2252
+ "aria-hidden": true,
2253
+ children: isUp ? "▲" : "▼",
2254
+ style: {
2255
+ position: "absolute"
2256
+ },
2257
+ onMouseMove(event) {
2258
+ if (event.movementX === 0 && event.movementY === 0 || timeout.isStarted()) {
2259
+ return;
2260
+ }
2261
+ store.set("activeIndex", null);
2262
+ function scrollNextItem() {
2263
+ const scroller = store.state.listElement ?? popupRef.current;
2264
+ if (!scroller) {
2265
+ return;
2266
+ }
2267
+ store.set("activeIndex", null);
2268
+ handleScrollArrowVisibility();
2269
+ const maxScrollTop = getMaxScrollOffset(scroller.scrollHeight, scroller.clientHeight);
2270
+ const scrollTop = normalizeScrollOffset(scroller.scrollTop, maxScrollTop);
2271
+ const isScrolledToEdge = scrollTop === (isUp ? 0 : maxScrollTop);
2272
+ const items = listRef.current;
2273
+ if (scrollTop !== scroller.scrollTop) {
2274
+ scroller.scrollTop = scrollTop;
2275
+ }
2276
+ if (items.length === 0) {
2277
+ store.set(isUp ? "scrollUpArrowVisible" : "scrollDownArrowVisible", !isScrolledToEdge);
2278
+ }
2279
+ if (isScrolledToEdge) {
2280
+ timeout.clear();
2281
+ return;
2282
+ }
2283
+ if (items.length > 0) {
2284
+ const scrollArrowHeight = scrollArrowRef.current?.offsetHeight || 0;
2285
+ scroller.scrollTop = getTargetScrollTop(items, isUp, scrollTop, scroller.clientHeight, scrollArrowHeight, maxScrollTop);
2286
+ }
2287
+ timeout.start(40, scrollNextItem);
2288
+ }
2289
+ timeout.start(40, scrollNextItem);
2290
+ },
2291
+ onMouseLeave() {
2292
+ timeout.clear();
2293
+ }
2294
+ };
2295
+ const element = useRenderElement("div", componentProps, {
2296
+ ref: [forwardedRef, scrollArrowRef],
2297
+ state,
2298
+ props: [defaultProps, elementProps]
2299
+ });
2300
+ const shouldRender = visible || keepMounted;
2301
+ if (!shouldRender) {
2302
+ return null;
2303
+ }
2304
+ return element;
2305
+ });
2306
+ if (true)
2307
+ SelectScrollArrow.displayName = "SelectScrollArrow";
2308
+ function getTargetScrollTop(items, isUp, scrollTop, clientHeight, scrollArrowHeight, maxScrollTop) {
2309
+ if (isUp) {
2310
+ let firstVisibleIndex = 0;
2311
+ const visibleTop = scrollTop + scrollArrowHeight - SCROLL_EDGE_TOLERANCE_PX;
2312
+ for (let i = 0;i < items.length; i += 1) {
2313
+ const item = items[i];
2314
+ if (item && item.offsetTop >= visibleTop) {
2315
+ firstVisibleIndex = i;
2316
+ break;
2317
+ }
2318
+ }
2319
+ const targetIndex2 = Math.max(0, firstVisibleIndex - 1);
2320
+ const targetItem2 = items[targetIndex2];
2321
+ return targetIndex2 < firstVisibleIndex && targetItem2 ? normalizeScrollOffset(targetItem2.offsetTop - scrollArrowHeight, maxScrollTop) : 0;
2322
+ }
2323
+ let lastVisibleIndex = items.length - 1;
2324
+ const visibleBottom = scrollTop + clientHeight - scrollArrowHeight + SCROLL_EDGE_TOLERANCE_PX;
2325
+ for (let i = 0;i < items.length; i += 1) {
2326
+ const item = items[i];
2327
+ if (item && item.offsetTop + item.offsetHeight > visibleBottom) {
2328
+ lastVisibleIndex = Math.max(0, i - 1);
2329
+ break;
2330
+ }
2331
+ }
2332
+ const targetIndex = Math.min(items.length - 1, lastVisibleIndex + 1);
2333
+ const targetItem = items[targetIndex];
2334
+ return targetIndex > lastVisibleIndex && targetItem ? normalizeScrollOffset(targetItem.offsetTop + targetItem.offsetHeight - clientHeight + scrollArrowHeight, maxScrollTop) : maxScrollTop;
2335
+ }
2336
+
2337
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/select/scroll-down-arrow/SelectScrollDownArrow.js
2338
+ import { jsx as _jsx8 } from "react/jsx-runtime";
2339
+ "use client";
2340
+ var SelectScrollDownArrow = /* @__PURE__ */ React21.forwardRef(function SelectScrollDownArrow2(props, forwardedRef) {
2341
+ return /* @__PURE__ */ _jsx8(SelectScrollArrow, {
2342
+ ...props,
2343
+ ref: forwardedRef,
2344
+ direction: "down"
2345
+ });
2346
+ });
2347
+ if (true)
2348
+ SelectScrollDownArrow.displayName = "SelectScrollDownArrow";
2349
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/select/scroll-up-arrow/SelectScrollUpArrow.js
2350
+ import * as React22 from "react";
2351
+ import { jsx as _jsx9 } from "react/jsx-runtime";
2352
+ "use client";
2353
+ var SelectScrollUpArrow = /* @__PURE__ */ React22.forwardRef(function SelectScrollUpArrow2(props, forwardedRef) {
2354
+ return /* @__PURE__ */ _jsx9(SelectScrollArrow, {
2355
+ ...props,
2356
+ ref: forwardedRef,
2357
+ direction: "up"
2358
+ });
2359
+ });
2360
+ if (true)
2361
+ SelectScrollUpArrow.displayName = "SelectScrollUpArrow";
2362
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/select/group/SelectGroup.js
2363
+ import * as React24 from "react";
2364
+
2365
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/select/group/SelectGroupContext.js
2366
+ import * as React23 from "react";
2367
+ "use client";
2368
+ var SelectGroupContext = /* @__PURE__ */ React23.createContext(undefined);
2369
+ if (true)
2370
+ SelectGroupContext.displayName = "SelectGroupContext";
2371
+ function useSelectGroupContext() {
2372
+ const context = React23.useContext(SelectGroupContext);
2373
+ if (context === undefined) {
2374
+ throw new Error("Base UI: SelectGroupContext is missing. SelectGroup parts must be placed within <Select.Group>.");
2375
+ }
2376
+ return context;
2377
+ }
2378
+
2379
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/select/group/SelectGroup.js
2380
+ import { jsx as _jsx10 } from "react/jsx-runtime";
2381
+ "use client";
2382
+ var SelectGroup = /* @__PURE__ */ React24.forwardRef(function SelectGroup2(componentProps, forwardedRef) {
2383
+ const {
2384
+ className,
2385
+ render,
2386
+ style,
2387
+ ...elementProps
2388
+ } = componentProps;
2389
+ const [labelId, setLabelId] = React24.useState();
2390
+ const contextValue = React24.useMemo(() => ({
2391
+ labelId,
2392
+ setLabelId
2393
+ }), [labelId, setLabelId]);
2394
+ const element = useRenderElement("div", componentProps, {
2395
+ ref: forwardedRef,
2396
+ props: [{
2397
+ role: "group",
2398
+ "aria-labelledby": labelId
2399
+ }, elementProps]
2400
+ });
2401
+ return /* @__PURE__ */ _jsx10(SelectGroupContext.Provider, {
2402
+ value: contextValue,
2403
+ children: element
2404
+ });
2405
+ });
2406
+ if (true)
2407
+ SelectGroup.displayName = "SelectGroup";
2408
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/select/group-label/SelectGroupLabel.js
2409
+ import * as React25 from "react";
2410
+ "use client";
2411
+ var SelectGroupLabel = /* @__PURE__ */ React25.forwardRef(function SelectGroupLabel2(componentProps, forwardedRef) {
2412
+ const {
2413
+ className,
2414
+ render,
2415
+ id: idProp,
2416
+ style,
2417
+ ...elementProps
2418
+ } = componentProps;
2419
+ const {
2420
+ setLabelId
2421
+ } = useSelectGroupContext();
2422
+ const id = useBaseUiId(idProp);
2423
+ useIsoLayoutEffect(() => {
2424
+ setLabelId(id);
2425
+ }, [id, setLabelId]);
2426
+ const element = useRenderElement("div", componentProps, {
2427
+ ref: forwardedRef,
2428
+ props: [{
2429
+ id
2430
+ }, elementProps]
2431
+ });
2432
+ return element;
2433
+ });
2434
+ if (true)
2435
+ SelectGroupLabel.displayName = "SelectGroupLabel";
2436
+ export {
2437
+ exports_index_parts as Select
2438
+ };