@strapi/ui-primitives 1.7.5 → 1.7.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,18 +1,18 @@
1
1
  import { jsx as d, jsxs as Ne, Fragment as Ae } from "react/jsx-runtime";
2
- import * as r from "react";
2
+ import * as l from "react";
3
3
  import { composeEventHandlers as T } from "@radix-ui/primitive";
4
4
  import { useComposedRefs as _ } from "@radix-ui/react-compose-refs";
5
5
  import { createContextScope as Qe, createContext as et } from "@radix-ui/react-context";
6
6
  import { DismissableLayer as tt } from "@radix-ui/react-dismissable-layer";
7
7
  import { useFocusGuards as ot } from "@radix-ui/react-focus-guards";
8
8
  import { FocusScope as nt } from "@radix-ui/react-focus-scope";
9
- import { useId as ne } from "@radix-ui/react-id";
10
- import * as le from "@radix-ui/react-popper";
9
+ import { useId as oe } from "@radix-ui/react-id";
10
+ import * as re from "@radix-ui/react-popper";
11
11
  import { createPopperScope as rt } from "@radix-ui/react-popper";
12
12
  import { Portal as lt } from "@radix-ui/react-portal";
13
13
  import { Primitive as N } from "@radix-ui/react-primitive";
14
14
  import { useControllableState as ie } from "@radix-ui/react-use-controllable-state";
15
- import { useLayoutEffect as H } from "@radix-ui/react-use-layout-effect";
15
+ import { useLayoutEffect as B } from "@radix-ui/react-use-layout-effect";
16
16
  import { hideOthers as st } from "aria-hidden";
17
17
  import * as _e from "react-dom";
18
18
  import { RemoveScroll as ct } from "react-remove-scroll";
@@ -25,15 +25,15 @@ import { useCallbackRef as Rn } from "@radix-ui/react-use-callback-ref";
25
25
  import { usePrevious as _t } from "@radix-ui/react-use-previous";
26
26
  import { VisuallyHidden as Mt } from "@radix-ui/react-visually-hidden";
27
27
  let ye = /* @__PURE__ */ new Map();
28
- function Ot(n, s) {
29
- let e = n + (s ? Object.entries(s).sort((o, l) => o[0] < l[0] ? -1 : 1).join() : "");
28
+ function Ot(r, s) {
29
+ let e = r + (s ? Object.entries(s).sort((o, n) => o[0] < n[0] ? -1 : 1).join() : "");
30
30
  if (ye.has(e))
31
31
  return ye.get(e);
32
- let t = new Intl.Collator(n, s);
32
+ let t = new Intl.Collator(r, s);
33
33
  return ye.set(e, t), t;
34
34
  }
35
- function Me(n, s) {
36
- let e = Ot(n, {
35
+ function Me(r, s) {
36
+ let e = Ot(r, {
37
37
  usage: "search",
38
38
  ...s
39
39
  });
@@ -48,9 +48,9 @@ function Me(n, s) {
48
48
  if (o.length === 0)
49
49
  return !0;
50
50
  t = t.normalize("NFC"), o = o.normalize("NFC");
51
- let l = 0, i = o.length;
52
- for (; l + i <= t.length; l++) {
53
- let c = t.slice(l, l + i);
51
+ let n = 0, i = o.length;
52
+ for (; n + i <= t.length; n++) {
53
+ let c = t.slice(n, n + i);
54
54
  if (e.compare(o, c) === 0)
55
55
  return !0;
56
56
  }
@@ -58,84 +58,84 @@ function Me(n, s) {
58
58
  }
59
59
  };
60
60
  }
61
- const Dt = (n) => {
62
- const s = r.useRef();
63
- return r.useEffect(() => {
64
- s.current = n;
61
+ const Dt = (r) => {
62
+ const s = l.useRef();
63
+ return l.useEffect(() => {
64
+ s.current = r;
65
65
  }), s.current;
66
66
  };
67
- function kt(n) {
68
- const s = `${n}CollectionProvider`, [e, t] = Qe(s), [o, l] = e(s, {
67
+ function kt(r) {
68
+ const s = `${r}CollectionProvider`, [e, t] = Qe(s), [o, n] = e(s, {
69
69
  collectionRef: { current: null },
70
70
  itemMap: /* @__PURE__ */ new Map(),
71
71
  listeners: /* @__PURE__ */ new Set()
72
72
  }), i = (u) => {
73
- const { scope: m, children: S } = u, x = r.useRef(null), C = r.useRef(/* @__PURE__ */ new Map()).current, h = r.useRef(/* @__PURE__ */ new Set()).current;
74
- return /* @__PURE__ */ d(o, { scope: m, itemMap: C, collectionRef: x, listeners: h, children: S });
73
+ const { scope: m, children: S } = u, C = l.useRef(null), x = l.useRef(/* @__PURE__ */ new Map()).current, h = l.useRef(/* @__PURE__ */ new Set()).current;
74
+ return /* @__PURE__ */ d(o, { scope: m, itemMap: x, collectionRef: C, listeners: h, children: S });
75
75
  };
76
76
  i.displayName = s;
77
- const c = `${n}CollectionSlot`, a = r.forwardRef((u, m) => {
78
- const { scope: S, children: x } = u, C = l(c, S), h = _(m, C.collectionRef);
79
- return /* @__PURE__ */ d(Ie, { ref: h, children: x });
77
+ const c = `${r}CollectionSlot`, a = l.forwardRef((u, m) => {
78
+ const { scope: S, children: C } = u, x = n(c, S), h = _(m, x.collectionRef);
79
+ return /* @__PURE__ */ d(Ie, { ref: h, children: C });
80
80
  });
81
81
  a.displayName = c;
82
- const g = `${n}CollectionItemSlot`, f = "data-radix-collection-item", v = r.forwardRef((u, m) => {
83
- const { scope: S, children: x, ...C } = u, h = r.useRef(null), w = _(m, h), A = l(g, S);
84
- return r.useEffect(() => {
82
+ const g = `${r}CollectionItemSlot`, p = "data-radix-collection-item", v = l.forwardRef((u, m) => {
83
+ const { scope: S, children: C, ...x } = u, h = l.useRef(null), w = _(m, h), A = n(g, S);
84
+ return l.useEffect(() => {
85
85
  const V = Array.from(A.itemMap.values());
86
- return A.itemMap.set(h, { ref: h, ...C }), A.listeners.forEach((M) => M(Array.from(A.itemMap.values()), V)), () => {
86
+ return A.itemMap.set(h, { ref: h, ...x }), A.listeners.forEach((M) => M(Array.from(A.itemMap.values()), V)), () => {
87
87
  const M = Array.from(A.itemMap.values());
88
- A.itemMap.delete(h), A.listeners.forEach((E) => E(Array.from(A.itemMap.values()), M));
88
+ A.itemMap.delete(h), A.listeners.forEach((P) => P(Array.from(A.itemMap.values()), M));
89
89
  };
90
- }), /* @__PURE__ */ d(Ie, { [f]: "", ref: w, children: x });
90
+ }), /* @__PURE__ */ d(Ie, { [p]: "", ref: w, children: C });
91
91
  });
92
92
  v.displayName = g;
93
- function p(u) {
94
- const m = l(`${n}CollectionConsumer`, u), S = r.useCallback(() => {
95
- const C = m.collectionRef.current;
96
- if (!C)
93
+ function f(u) {
94
+ const m = n(`${r}CollectionConsumer`, u), S = l.useCallback(() => {
95
+ const x = m.collectionRef.current;
96
+ if (!x)
97
97
  return [];
98
- const h = Array.from(C.querySelectorAll(`[${f}]`));
98
+ const h = Array.from(x.querySelectorAll(`[${p}]`));
99
99
  return Array.from(m.itemMap.values()).sort(
100
100
  (V, M) => h.indexOf(V.ref.current) - h.indexOf(M.ref.current)
101
101
  );
102
- }, [m.collectionRef, m.itemMap]), x = r.useCallback(
103
- (C) => (m.listeners.add(C), () => m.listeners.delete(C)),
102
+ }, [m.collectionRef, m.itemMap]), C = l.useCallback(
103
+ (x) => (m.listeners.add(x), () => m.listeners.delete(x)),
104
104
  [m.listeners]
105
105
  );
106
- return { getItems: S, subscribe: x };
106
+ return { getItems: S, subscribe: C };
107
107
  }
108
108
  return [
109
109
  { Provider: i, Slot: a, ItemSlot: v },
110
- p,
110
+ f,
111
111
  t
112
112
  ];
113
113
  }
114
- const Ft = [" ", "Enter", "ArrowUp", "ArrowDown"], Lt = ["Enter"], Je = (n) => !!(n.length === 1 && n.match(/\S| /)), it = "Combobox", [pe, xe] = kt(it), [Bt, Y] = et(it), Ht = ({ children: n }) => /* @__PURE__ */ d(le.Root, { children: /* @__PURE__ */ d(pe.Provider, { scope: void 0, children: n }) }), $t = (n) => {
114
+ const Ft = [" ", "Enter", "ArrowUp", "ArrowDown"], Lt = ["Enter"], Je = (r) => !!(r.length === 1 && r.match(/\S| /)), it = "Combobox", [fe, Ce] = kt(it), [Bt, j] = et(it), Ht = ({ children: r }) => /* @__PURE__ */ d(re.Root, { children: /* @__PURE__ */ d(fe.Provider, { scope: void 0, children: r }) }), $t = (r) => {
115
115
  const {
116
116
  allowCustomValue: s = !1,
117
117
  autocomplete: e = "none",
118
118
  children: t,
119
119
  open: o,
120
- defaultOpen: l,
120
+ defaultOpen: n,
121
121
  onOpenChange: i,
122
122
  value: c,
123
123
  defaultValue: a,
124
124
  onValueChange: g,
125
- disabled: f,
125
+ disabled: p,
126
126
  required: v = !1,
127
- locale: p = "en-EN",
127
+ locale: f = "en-EN",
128
128
  onTextValueChange: u,
129
129
  textValue: m,
130
130
  defaultTextValue: S,
131
- filterValue: x,
132
- defaultFilterValue: C,
131
+ filterValue: C,
132
+ defaultFilterValue: x,
133
133
  onFilterValueChange: h
134
- } = n, [w, A] = r.useState(null), [V, M] = r.useState(null), [E, k] = r.useState(null), [$, G] = r.useState(null), [F = !1, O] = ie({
134
+ } = r, [w, A] = l.useState(null), [V, M] = l.useState(null), [P, k] = l.useState(null), [H, z] = l.useState(null), [$ = !1, O] = ie({
135
135
  prop: o,
136
- defaultProp: l,
136
+ defaultProp: n,
137
137
  onChange: i
138
- }), [L, B] = ie({
138
+ }), [F, L] = ie({
139
139
  prop: c,
140
140
  defaultProp: a,
141
141
  onChange: g
@@ -143,17 +143,17 @@ const Ft = [" ", "Enter", "ArrowUp", "ArrowDown"], Lt = ["Enter"], Je = (n) => !
143
143
  prop: m,
144
144
  defaultProp: S,
145
145
  onChange: u
146
- }), [X, Z] = ie({
147
- prop: x,
148
- defaultProp: C,
146
+ }), [q, X] = ie({
147
+ prop: C,
148
+ defaultProp: x,
149
149
  onChange: h
150
- }), W = ne(), ue = r.useCallback(
151
- (z, se) => {
152
- const de = se.map((y) => y.ref.current), [J, ...ce] = de, [ee] = ce.slice(-1), b = $;
153
- for (const y of z) {
150
+ }), W = oe(), ue = l.useCallback(
151
+ (le, se) => {
152
+ const de = se.map((y) => y.ref.current), [Z, ...ce] = de, [Q] = ce.slice(-1), b = H;
153
+ for (const y of le) {
154
154
  if (y === b)
155
155
  return;
156
- if (y?.scrollIntoView({ block: "nearest" }), y === J && V && (V.scrollTop = 0), y === ee && V && (V.scrollTop = V.scrollHeight), G(y), e === "both") {
156
+ if (y?.scrollIntoView({ block: "nearest" }), y === Z && V && (V.scrollTop = 0), y === Q && V && (V.scrollTop = V.scrollHeight), z(y), e === "both") {
157
157
  const D = se.find((I) => I.ref.current === y);
158
158
  D && K(D.textValue);
159
159
  }
@@ -161,14 +161,14 @@ const Ft = [" ", "Enter", "ArrowUp", "ArrowDown"], Lt = ["Enter"], Je = (n) => !
161
161
  return;
162
162
  }
163
163
  },
164
- [e, K, V, $]
164
+ [e, K, V, H]
165
165
  );
166
- return r.useEffect(() => {
167
- e !== "both" && G(null);
168
- }, [U, e]), r.useEffect(() => {
169
- if (E && w)
170
- return st([E, w]);
171
- }, [E, w]), /* @__PURE__ */ d(Ht, { children: /* @__PURE__ */ d(
166
+ return l.useEffect(() => {
167
+ e !== "both" && z(null);
168
+ }, [U, e]), l.useEffect(() => {
169
+ if (P && w)
170
+ return st([P, w]);
171
+ }, [P, w]), /* @__PURE__ */ d(Ht, { children: /* @__PURE__ */ d(
172
172
  Bt,
173
173
  {
174
174
  allowCustomValue: s,
@@ -177,54 +177,71 @@ const Ft = [" ", "Enter", "ArrowUp", "ArrowDown"], Lt = ["Enter"], Je = (n) => !
177
177
  trigger: w,
178
178
  onTriggerChange: A,
179
179
  contentId: W,
180
- value: L,
181
- onValueChange: B,
182
- open: F,
180
+ value: F,
181
+ onValueChange: L,
182
+ open: $,
183
183
  onOpenChange: O,
184
- disabled: f,
185
- locale: p,
184
+ disabled: p,
185
+ locale: f,
186
186
  focusFirst: ue,
187
187
  textValue: U,
188
188
  onTextValueChange: K,
189
189
  onViewportChange: M,
190
190
  onContentChange: k,
191
- visuallyFocussedItem: $,
192
- filterValue: X,
193
- onFilterValueChange: Z,
194
- onVisuallyFocussedItemChange: G,
191
+ visuallyFocussedItem: H,
192
+ filterValue: q,
193
+ onFilterValueChange: X,
194
+ onVisuallyFocussedItemChange: z,
195
+ children: t
196
+ }
197
+ ) });
198
+ }, Ut = "ComboboxTrigger", Kt = l.forwardRef((r, s) => {
199
+ const { ...e } = r, t = j(Ut), o = () => {
200
+ t.disabled || t.onOpenChange(!0);
201
+ };
202
+ return /* @__PURE__ */ d(re.Anchor, { asChild: !0, children: /* @__PURE__ */ d(
203
+ nt,
204
+ {
205
+ asChild: !0,
206
+ trapped: t.open,
207
+ onMountAutoFocus: (n) => {
208
+ n.preventDefault();
209
+ },
210
+ onUnmountAutoFocus: (n) => {
211
+ t.trigger?.focus({ preventScroll: !0 }), document.getSelection()?.empty(), n.preventDefault();
212
+ },
195
213
  children: /* @__PURE__ */ d(
196
- nt,
214
+ "div",
197
215
  {
198
- trapped: F,
199
- onMountAutoFocus: (z) => {
200
- z.preventDefault();
201
- },
202
- onUnmountAutoFocus: (z) => {
203
- w?.focus({ preventScroll: !0 }), document.getSelection()?.empty(), z.preventDefault();
204
- },
205
- children: t
216
+ ref: s,
217
+ "data-disabled": t.disabled ? "" : void 0,
218
+ ...e,
219
+ onClick: T(e.onClick, () => {
220
+ t.trigger?.focus();
221
+ }),
222
+ onPointerDown: T(e.onPointerDown, (n) => {
223
+ const i = n.target;
224
+ i.hasPointerCapture(n.pointerId) && i.releasePointerCapture(n.pointerId), (i.closest("button") ?? i.closest("div")) === n.currentTarget && n.button === 0 && n.ctrlKey === !1 && (o(), t.trigger?.focus());
225
+ })
206
226
  }
207
227
  )
208
228
  }
209
229
  ) });
210
- }, Ut = "ComboboxTrigger", Kt = r.forwardRef((n, s) => {
211
- const { ...e } = n, t = Y(Ut);
212
- return /* @__PURE__ */ d(le.Anchor, { asChild: !0, children: /* @__PURE__ */ d("div", { ref: s, "data-disabled": t.disabled ? "" : void 0, ...e }) });
213
- }), at = "ComboboxInput", Wt = r.forwardRef((n, s) => {
214
- const e = Y(at), t = r.useRef(null), { getItems: o } = xe(void 0), { startsWith: l } = Me(e.locale, { sensitivity: "base" }), i = e.disabled, c = _(t, s, e.onTriggerChange), a = () => {
230
+ }), at = "ComboboxInput", Wt = l.forwardRef((r, s) => {
231
+ const e = j(at), t = l.useRef(null), { getItems: o } = Ce(void 0), { startsWith: n } = Me(e.locale, { sensitivity: "base" }), i = e.disabled, c = _(t, s, e.onTriggerChange), a = () => {
215
232
  i || e.onOpenChange(!0);
216
233
  }, g = Dt(e.filterValue);
217
- return H(() => {
218
- const f = setTimeout(() => {
234
+ return B(() => {
235
+ const p = setTimeout(() => {
219
236
  if (e.textValue === "" || e.textValue === void 0 || e.filterValue === "" || e.filterValue === void 0)
220
237
  return;
221
238
  const v = o().find(
222
- (u) => u.type === "option" && l(u.textValue, e.textValue)
223
- ), p = vo(g ?? "", e.filterValue);
224
- v && !e.visuallyFocussedItem && p === e.filterValue.length && t.current.setSelectionRange(e.filterValue.length, e.textValue.length);
239
+ (u) => u.type === "option" && n(u.textValue, e.textValue)
240
+ ), f = vo(g ?? "", e.filterValue);
241
+ v && !e.visuallyFocussedItem && f === e.filterValue.length && t.current?.setSelectionRange(e.filterValue.length, e.textValue.length);
225
242
  });
226
- return () => clearTimeout(f);
227
- }, [e.textValue, e.filterValue, l, e.visuallyFocussedItem, o, g]), /* @__PURE__ */ d(
243
+ return () => clearTimeout(p);
244
+ }, [e.textValue, e.filterValue, n, e.visuallyFocussedItem, o, g]), /* @__PURE__ */ d(
228
245
  "input",
229
246
  {
230
247
  type: "text",
@@ -240,84 +257,80 @@ const Ft = [" ", "Enter", "ArrowUp", "ArrowDown"], Lt = ["Enter"], Je = (n) => !
240
257
  "data-disabled": i ? "" : void 0,
241
258
  "data-placeholder": e.textValue === void 0 ? "" : void 0,
242
259
  value: e.textValue ?? "",
243
- ...n,
260
+ ...r,
244
261
  ref: c,
245
- onClick: T(n.onClick, (f) => {
246
- f.currentTarget.focus();
247
- }),
248
- onPointerDown: T(n.onPointerDown, (f) => {
249
- f.button === 0 && f.ctrlKey === !1 && (a(), f.currentTarget.focus());
250
- }),
251
- onKeyDown: T(n.onKeyDown, (f) => {
252
- if (["ArrowUp", "ArrowDown", "Home", "End"].includes(f.key))
262
+ onKeyDown: T(r.onKeyDown, (p) => {
263
+ if (["ArrowUp", "ArrowDown", "Home", "End"].includes(p.key))
253
264
  setTimeout(() => {
254
- let p = o().filter((u) => !u.disabled).map((u) => u.ref.current);
255
- if (["ArrowUp", "End"].includes(f.key) && (p = p.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(f.key)) {
256
- const u = e.visuallyFocussedItem ?? f.target;
257
- let m = p.indexOf(u);
258
- m === p.length - 1 && (m = -1), p = p.slice(m + 1);
265
+ let f = o().filter((u) => !u.disabled).map((u) => u.ref.current);
266
+ if (["ArrowUp", "End"].includes(p.key) && (f = f.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(p.key)) {
267
+ const u = e.visuallyFocussedItem ?? p.target;
268
+ let m = f.indexOf(u);
269
+ m === f.length - 1 && (m = -1), f = f.slice(m + 1);
259
270
  }
260
- if (["ArrowDown"].includes(f.key) && e.autocomplete === "both" && p.length > 1) {
261
- const [u, ...m] = p, S = o().find((x) => x.ref.current === u).textValue;
262
- e.textValue === S && (p = m);
271
+ if (["ArrowDown"].includes(p.key) && e.autocomplete === "both" && f.length > 1) {
272
+ const [u, ...m] = f, S = o().find((C) => C.ref.current === u).textValue;
273
+ e.textValue === S && (f = m);
263
274
  }
264
- e.focusFirst(p, o());
265
- }), f.preventDefault();
266
- else if (["Escape"].includes(f.key))
267
- e.open ? e.onOpenChange(!1) : (e.onValueChange(void 0), e.onTextValueChange("")), f.preventDefault();
268
- else if (Lt.includes(f.key)) {
275
+ e.focusFirst(f, o());
276
+ }), p.preventDefault();
277
+ else if (["Tab"].includes(p.key) && e.open)
278
+ p.preventDefault();
279
+ else if (["Escape"].includes(p.key))
280
+ e.open ? e.onOpenChange(!1) : (e.onValueChange(void 0), e.onTextValueChange("")), p.preventDefault();
281
+ else if (Lt.includes(p.key)) {
269
282
  if (e.visuallyFocussedItem) {
270
- const v = o().find((p) => p.ref.current === e.visuallyFocussedItem);
283
+ const v = o().find((f) => f.ref.current === e.visuallyFocussedItem);
271
284
  v && (e.onValueChange(v.value), e.onTextValueChange(v.textValue), e.autocomplete === "both" && e.onFilterValueChange(v.textValue), v.ref.current?.click());
272
285
  } else {
273
286
  const v = o().find(
274
- (p) => p.type === "option" && !p.disabled && p.textValue === e.textValue
287
+ (f) => f.type === "option" && !f.disabled && f.textValue === e.textValue
275
288
  );
276
289
  v && (e.onValueChange(v.value), e.onTextValueChange(v.textValue), e.autocomplete === "both" && e.onFilterValueChange(v.textValue), v.ref.current?.click());
277
290
  }
278
- e.onOpenChange(!1), f.preventDefault();
291
+ e.onOpenChange(!1), p.preventDefault();
279
292
  } else
280
293
  e.onVisuallyFocussedItemChange(null);
281
294
  }),
282
- onChange: T(n.onChange, (f) => {
283
- e.onTextValueChange(f.currentTarget.value), e.autocomplete === "both" && e.onFilterValueChange(f.currentTarget.value);
295
+ onChange: T(r.onChange, (p) => {
296
+ e.onTextValueChange(p.currentTarget.value), e.autocomplete === "both" && e.onFilterValueChange(p.currentTarget.value);
284
297
  }),
285
- onKeyUp: T(n.onKeyUp, (f) => {
286
- !e.open && (Je(f.key) || ["ArrowUp", "ArrowDown", "Home", "End", "Backspace"].includes(f.key)) && a(), setTimeout(() => {
287
- if (e.autocomplete === "both" && Je(f.key) && e.filterValue !== void 0) {
288
- const v = e.filterValue, p = o().find((u) => l(u.textValue, v));
289
- p && e.onTextValueChange(p.textValue);
298
+ onKeyUp: T(r.onKeyUp, (p) => {
299
+ !e.open && (Je(p.key) || ["ArrowUp", "ArrowDown", "Home", "End", "Backspace"].includes(p.key)) && a(), setTimeout(() => {
300
+ if (e.autocomplete === "both" && Je(p.key) && e.filterValue !== void 0) {
301
+ const v = e.filterValue, f = o().find((u) => n(u.textValue, v));
302
+ f && e.onTextValueChange(f.textValue);
290
303
  }
291
304
  });
292
305
  }),
293
- onBlur: T(n.onBlur, () => {
306
+ onBlur: T(r.onBlur, () => {
294
307
  e.onVisuallyFocussedItemChange(null);
295
- const [f] = o().filter(
296
- (p) => p.textValue === e.textValue && p.type === "option"
308
+ const [p] = o().filter(
309
+ (f) => f.textValue === e.textValue && f.type === "option"
297
310
  );
298
311
  if (e.allowCustomValue) {
299
- f && (e.onValueChange(f.value), e.autocomplete === "both" && e.onFilterValueChange(f.textValue));
312
+ p && (e.onValueChange(p.value), e.autocomplete === "both" && e.onFilterValueChange(p.textValue));
300
313
  return;
301
314
  }
302
- const [v] = o().filter((p) => p.value === e.value && p.type === "option");
303
- f ? e.onValueChange(f.value) : v && e.textValue !== "" ? (e.onTextValueChange(v.textValue), e.autocomplete === "both" && e.onFilterValueChange(v.textValue)) : (e.onValueChange(void 0), e.onTextValueChange(""));
315
+ const [v] = o().filter((f) => f.value === e.value && f.type === "option");
316
+ p ? e.onValueChange(p.value) : v && e.textValue !== "" ? (e.onTextValueChange(v.textValue), e.autocomplete === "both" && e.onFilterValueChange(v.textValue)) : (e.onValueChange(void 0), e.onTextValueChange(""));
304
317
  })
305
318
  }
306
319
  );
307
- }), zt = r.forwardRef((n, s) => {
308
- const { children: e, ...t } = n, o = Y(at), l = o.disabled, i = () => {
309
- l || (o.onOpenChange(!0), o.trigger?.focus());
320
+ }), zt = l.forwardRef((r, s) => {
321
+ const { children: e, ...t } = r, o = j(at), n = o.disabled, i = () => {
322
+ n || (o.onOpenChange(!0), o.trigger?.focus());
310
323
  };
311
324
  return /* @__PURE__ */ d(
312
325
  N.button,
313
326
  {
314
327
  "aria-hidden": !0,
315
328
  type: "button",
316
- "aria-disabled": l,
329
+ "aria-disabled": n,
317
330
  "aria-controls": o.contentId,
318
331
  "aria-expanded": o.open,
319
- disabled: l,
320
- "data-disabled": l ? "" : void 0,
332
+ disabled: n,
333
+ "data-disabled": n ? "" : void 0,
321
334
  ...t,
322
335
  tabIndex: -1,
323
336
  ref: s,
@@ -333,24 +346,24 @@ const Ft = [" ", "Enter", "ArrowUp", "ArrowDown"], Lt = ["Enter"], Je = (n) => !
333
346
  children: e || "▼"
334
347
  }
335
348
  );
336
- }), Gt = "ComboboxPortal", ut = (n) => /* @__PURE__ */ d(lt, { asChild: !0, ...n });
349
+ }), Gt = "ComboboxPortal", ut = (r) => /* @__PURE__ */ d(lt, { asChild: !0, ...r });
337
350
  ut.displayName = Gt;
338
- const dt = "ComboboxContent", jt = r.forwardRef((n, s) => {
339
- const e = Y(dt), [t, o] = r.useState();
340
- if (H(() => {
351
+ const dt = "ComboboxContent", jt = l.forwardRef((r, s) => {
352
+ const e = j(dt), [t, o] = l.useState();
353
+ if (B(() => {
341
354
  o(new DocumentFragment());
342
355
  }, []), !e.open) {
343
- const l = t;
344
- return l ? _e.createPortal(
345
- /* @__PURE__ */ d(pe.Slot, { scope: void 0, children: /* @__PURE__ */ d("div", { children: n.children }) }),
346
- l
356
+ const n = t;
357
+ return n ? _e.createPortal(
358
+ /* @__PURE__ */ d(fe.Slot, { scope: void 0, children: /* @__PURE__ */ d("div", { children: r.children }) }),
359
+ n
347
360
  ) : null;
348
361
  }
349
- return /* @__PURE__ */ d(qt, { ...n, ref: s });
350
- }), Yt = 10, qt = r.forwardRef(
351
- (n, s) => {
352
- const { onEscapeKeyDown: e, onPointerDownOutside: t, ...o } = n, l = Y(dt), i = _(s, (a) => l.onContentChange(a)), { onOpenChange: c } = l;
353
- return ot(), r.useEffect(() => {
362
+ return /* @__PURE__ */ d(qt, { ...r, ref: s });
363
+ }), Yt = 10, qt = l.forwardRef(
364
+ (r, s) => {
365
+ const { onEscapeKeyDown: e, onPointerDownOutside: t, ...o } = r, n = j(dt), i = _(s, (a) => n.onContentChange(a)), { onOpenChange: c } = n;
366
+ return ot(), l.useEffect(() => {
354
367
  const a = () => {
355
368
  c(!1);
356
369
  };
@@ -367,14 +380,14 @@ const dt = "ComboboxContent", jt = r.forwardRef((n, s) => {
367
380
  a.preventDefault();
368
381
  },
369
382
  onDismiss: () => {
370
- l.onOpenChange(!1), l.trigger?.focus({ preventScroll: !0 });
383
+ n.onOpenChange(!1), n.trigger?.focus({ preventScroll: !0 });
371
384
  },
372
385
  children: /* @__PURE__ */ d(
373
386
  Xt,
374
387
  {
375
388
  role: "listbox",
376
- id: l.contentId,
377
- "data-state": l.open ? "open" : "closed",
389
+ id: n.contentId,
390
+ "data-state": n.open ? "open" : "closed",
378
391
  onContextMenu: (a) => a.preventDefault(),
379
392
  ...o,
380
393
  ref: i,
@@ -391,11 +404,11 @@ const dt = "ComboboxContent", jt = r.forwardRef((n, s) => {
391
404
  }
392
405
  ) });
393
406
  }
394
- ), Xt = r.forwardRef(
395
- (n, s) => {
396
- const { align: e = "start", collisionPadding: t = Yt, ...o } = n;
407
+ ), Xt = l.forwardRef(
408
+ (r, s) => {
409
+ const { align: e = "start", collisionPadding: t = Yt, ...o } = r;
397
410
  return /* @__PURE__ */ d(
398
- le.Content,
411
+ re.Content,
399
412
  {
400
413
  ...o,
401
414
  ref: s,
@@ -414,8 +427,8 @@ const dt = "ComboboxContent", jt = r.forwardRef((n, s) => {
414
427
  }
415
428
  );
416
429
  }
417
- ), Zt = "ComboboxViewport", Jt = r.forwardRef((n, s) => {
418
- const e = Y(Zt), t = _(s, e.onViewportChange);
430
+ ), Zt = "ComboboxViewport", Jt = l.forwardRef((r, s) => {
431
+ const e = j(Zt), t = _(s, e.onViewportChange);
419
432
  return /* @__PURE__ */ Ne(Ae, { children: [
420
433
  /* @__PURE__ */ d(
421
434
  "style",
@@ -425,12 +438,12 @@ const dt = "ComboboxContent", jt = r.forwardRef((n, s) => {
425
438
  }
426
439
  }
427
440
  ),
428
- /* @__PURE__ */ d(pe.Slot, { scope: void 0, children: /* @__PURE__ */ d(
441
+ /* @__PURE__ */ d(fe.Slot, { scope: void 0, children: /* @__PURE__ */ d(
429
442
  N.div,
430
443
  {
431
444
  "data-radix-combobox-viewport": "",
432
445
  role: "presentation",
433
- ...n,
446
+ ...r,
434
447
  ref: t,
435
448
  style: {
436
449
  // we use position: 'relative' here on the `viewport` so that when we call
@@ -439,76 +452,76 @@ const dt = "ComboboxContent", jt = r.forwardRef((n, s) => {
439
452
  position: "relative",
440
453
  flex: 1,
441
454
  overflow: "auto",
442
- ...n.style
455
+ ...r.style
443
456
  }
444
457
  }
445
458
  ) })
446
459
  ] });
447
- }), ft = "ComboboxItem", [Qt, pt] = et(ft), mt = r.forwardRef((n, s) => {
448
- const { value: e, disabled: t = !1, textValue: o, ...l } = n, i = r.useRef(null), c = _(s, i), { getItems: a } = xe(void 0), {
460
+ }), pt = "ComboboxItem", [Qt, ft] = et(pt), mt = l.forwardRef((r, s) => {
461
+ const { value: e, disabled: t = !1, textValue: o, ...n } = r, i = l.useRef(null), c = _(s, i), { getItems: a } = Ce(void 0), {
449
462
  onTextValueChange: g,
450
- textValue: f,
463
+ textValue: p,
451
464
  visuallyFocussedItem: v,
452
- ...p
453
- } = Y(ft), u = ne(), [m, S] = r.useState(o ?? ""), x = r.useMemo(() => v === a().find((M) => M.ref.current === i.current)?.ref.current, [a, v]), C = p.value === e, h = () => {
454
- t || (p.onValueChange(e), g(m), p.onOpenChange(!1), p.autocomplete === "both" && p.onFilterValueChange(m), p.trigger?.focus({ preventScroll: !0 }));
455
- }, { startsWith: w } = Me(p.locale, { sensitivity: "base" }), A = r.useCallback((M) => {
456
- S((E) => E || (M?.textContent ?? "").trim());
465
+ ...f
466
+ } = j(pt), u = oe(), [m, S] = l.useState(o ?? ""), C = l.useMemo(() => v === a().find((M) => M.ref.current === i.current)?.ref.current, [a, v]), x = f.value === e, h = () => {
467
+ t || (f.onValueChange(e), g(m), f.onOpenChange(!1), f.autocomplete === "both" && f.onFilterValueChange(m), f.trigger?.focus({ preventScroll: !0 }));
468
+ }, { startsWith: w } = Me(f.locale, { sensitivity: "base" }), A = l.useCallback((M) => {
469
+ S((P) => P || (M?.textContent ?? "").trim());
457
470
  }, []);
458
- r.useEffect(() => {
459
- C && f === void 0 && m !== "" && g(m);
460
- }, [m, C, f, g]);
461
- const V = ne();
462
- return p.autocomplete === "list" && m && f && !w(m, f) || p.autocomplete === "both" && m && p.filterValue && !w(m, p.filterValue) ? null : /* @__PURE__ */ d(Qt, { textId: u, onTextValueChange: A, isSelected: C, children: /* @__PURE__ */ d(pe.ItemSlot, { scope: void 0, value: e, textValue: m, disabled: t, type: "option", children: /* @__PURE__ */ d(
471
+ l.useEffect(() => {
472
+ x && p === void 0 && m !== "" && g(m);
473
+ }, [m, x, p, g]);
474
+ const V = oe();
475
+ return f.autocomplete === "list" && m && p && !w(m, p) || f.autocomplete === "both" && m && f.filterValue && !w(m, f.filterValue) ? null : /* @__PURE__ */ d(Qt, { textId: u, onTextValueChange: A, isSelected: x, children: /* @__PURE__ */ d(fe.ItemSlot, { scope: void 0, value: e, textValue: m, disabled: t, type: "option", children: /* @__PURE__ */ d(
463
476
  N.div,
464
477
  {
465
478
  role: "option",
466
479
  "aria-labelledby": u,
467
- "data-highlighted": x ? "" : void 0,
468
- "aria-selected": C && x,
469
- "data-state": C ? "checked" : "unchecked",
480
+ "data-highlighted": C ? "" : void 0,
481
+ "aria-selected": x && C,
482
+ "data-state": x ? "checked" : "unchecked",
470
483
  "aria-disabled": t || void 0,
471
484
  "data-disabled": t ? "" : void 0,
472
485
  tabIndex: t ? void 0 : -1,
473
- ...l,
486
+ ...n,
474
487
  id: V,
475
488
  ref: c,
476
- onPointerUp: T(l.onPointerUp, h)
489
+ onPointerUp: T(n.onPointerUp, h)
477
490
  }
478
491
  ) }) });
479
- }), eo = "ComboboxItemText", to = r.forwardRef((n, s) => {
480
- const { className: e, style: t, ...o } = n, l = pt(eo), i = _(s, l.onTextValueChange);
481
- return /* @__PURE__ */ d(N.span, { id: l.textId, ...o, ref: i });
482
- }), oo = "ComboboxItemIndicator", no = r.forwardRef((n, s) => {
483
- const { isSelected: e } = pt(oo);
484
- return e ? /* @__PURE__ */ d(N.span, { "aria-hidden": !0, ...n, ref: s }) : null;
485
- }), ht = "ComboboxNoValueFound", ro = r.forwardRef((n, s) => {
486
- const { textValue: e = "", locale: t } = Y(ht), [o, l] = r.useState([]), { subscribe: i } = xe(void 0), { startsWith: c } = Me(t, { sensitivity: "base" });
487
- return r.useEffect(() => {
492
+ }), eo = "ComboboxItemText", to = l.forwardRef((r, s) => {
493
+ const { className: e, style: t, ...o } = r, n = ft(eo), i = _(s, n.onTextValueChange);
494
+ return /* @__PURE__ */ d(N.span, { id: n.textId, ...o, ref: i });
495
+ }), oo = "ComboboxItemIndicator", no = l.forwardRef((r, s) => {
496
+ const { isSelected: e } = ft(oo);
497
+ return e ? /* @__PURE__ */ d(N.span, { "aria-hidden": !0, ...r, ref: s }) : null;
498
+ }), ht = "ComboboxNoValueFound", ro = l.forwardRef((r, s) => {
499
+ const { textValue: e = "", locale: t } = j(ht), [o, n] = l.useState([]), { subscribe: i } = Ce(void 0), { startsWith: c } = Me(t, { sensitivity: "base" });
500
+ return l.useEffect(() => {
488
501
  const a = i((g) => {
489
- l(g);
502
+ n(g);
490
503
  });
491
504
  return () => {
492
505
  a();
493
506
  };
494
- }, [i]), o.some((a) => c(a.textValue, e)) ? null : /* @__PURE__ */ d(N.div, { ...n, ref: s });
495
- }), lo = r.forwardRef((n, s) => {
496
- const { disabled: e = !1, ...t } = n, o = Y(ht), { textValue: l, visuallyFocussedItem: i } = o, { getItems: c, subscribe: a } = xe(void 0), g = r.useRef(null), [f, v] = r.useState(!1), p = _(s, g), u = r.useMemo(() => i === c().find((x) => x.ref.current === g.current)?.ref.current, [c, i]), m = ne(), S = () => {
497
- !e && l && (o.onValueChange(l), o.onTextValueChange(l), o.onOpenChange(!1), o.autocomplete === "both" && o.onFilterValueChange(l), o.trigger?.focus({ preventScroll: !0 }));
507
+ }, [i]), o.some((a) => c(a.textValue, e)) ? null : /* @__PURE__ */ d(N.div, { ...r, ref: s });
508
+ }), lo = l.forwardRef((r, s) => {
509
+ const { disabled: e = !1, ...t } = r, o = j(ht), { textValue: n, visuallyFocussedItem: i } = o, { getItems: c, subscribe: a } = Ce(void 0), g = l.useRef(null), [p, v] = l.useState(!1), f = _(s, g), u = l.useMemo(() => i === c().find((C) => C.ref.current === g.current)?.ref.current, [c, i]), m = oe(), S = () => {
510
+ !e && n && (o.onValueChange(n), o.onTextValueChange(n), o.onOpenChange(!1), o.autocomplete === "both" && o.onFilterValueChange(n), o.trigger?.focus({ preventScroll: !0 }));
498
511
  };
499
- return H(() => {
500
- const x = a((C) => {
501
- v(!C.some((h) => h.textValue === l && h.type !== "create"));
512
+ return B(() => {
513
+ const C = a((x) => {
514
+ v(!x.some((h) => h.textValue === n && h.type !== "create"));
502
515
  });
503
516
  return c().length === 0 && v(!0), () => {
504
- x();
517
+ C();
505
518
  };
506
- }, [l, a, c]), !l || !f ? null : /* @__PURE__ */ d(
507
- pe.ItemSlot,
519
+ }, [n, a, c]), !n || !p ? null : /* @__PURE__ */ d(
520
+ fe.ItemSlot,
508
521
  {
509
522
  scope: void 0,
510
- value: l ?? "",
511
- textValue: l ?? "",
523
+ value: n ?? "",
524
+ textValue: n ?? "",
512
525
  disabled: e,
513
526
  type: "create",
514
527
  children: /* @__PURE__ */ d(
@@ -521,96 +534,96 @@ const dt = "ComboboxContent", jt = r.forwardRef((n, s) => {
521
534
  "data-highlighted": u ? "" : void 0,
522
535
  ...t,
523
536
  id: m,
524
- ref: p,
537
+ ref: f,
525
538
  onPointerUp: T(t.onPointerUp, S)
526
539
  }
527
540
  )
528
541
  }
529
542
  );
530
- }), so = $t, co = Kt, io = Wt, ao = zt, uo = ut, fo = jt, po = Jt, mo = mt, ho = to, go = no, xo = ro, Co = lo;
531
- function vo(n, s) {
532
- const e = Math.min(n.length, s.length);
543
+ }), so = $t, co = Kt, io = Wt, ao = zt, uo = ut, po = jt, fo = Jt, mo = mt, ho = to, go = no, Co = ro, xo = lo;
544
+ function vo(r, s) {
545
+ const e = Math.min(r.length, s.length);
533
546
  for (let t = 0; t < e; t++)
534
- if (n[t] !== s[t])
547
+ if (r[t] !== s[t])
535
548
  return t;
536
549
  return e;
537
550
  }
538
551
  const Tn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
539
552
  __proto__: null,
540
553
  ComboboxItem: mt,
541
- Content: fo,
542
- CreateItem: Co,
554
+ Content: po,
555
+ CreateItem: xo,
543
556
  Icon: ao,
544
557
  Item: mo,
545
558
  ItemIndicator: go,
546
559
  ItemText: ho,
547
- NoValueFound: xo,
560
+ NoValueFound: Co,
548
561
  Portal: uo,
549
562
  Root: so,
550
563
  TextInput: io,
551
564
  Trigger: co,
552
- Viewport: po
553
- }, Symbol.toStringTag, { value: "Module" })), So = [" ", "Enter", "ArrowUp", "ArrowDown"], bo = [" ", "Enter"], me = "Select", [Ce, he, wo] = Rt(me), [ae, yo] = Qe(me, [
565
+ Viewport: fo
566
+ }, Symbol.toStringTag, { value: "Module" })), So = [" ", "Enter", "ArrowUp", "ArrowDown"], bo = [" ", "Enter"], me = "Select", [xe, he, wo] = Rt(me), [ae, yo] = Qe(me, [
554
567
  wo,
555
568
  rt
556
- ]), ve = rt(), [Io, q] = ae(me), [To, Vo] = ae(me), Oe = (n) => {
569
+ ]), ve = rt(), [Io, Y] = ae(me), [To, Vo] = ae(me), Oe = (r) => {
557
570
  const {
558
571
  __scopeSelect: s,
559
572
  children: e,
560
573
  open: t,
561
574
  defaultOpen: o,
562
- onOpenChange: l,
575
+ onOpenChange: n,
563
576
  value: i,
564
577
  defaultValue: c,
565
578
  onValueChange: a,
566
579
  dir: g,
567
580
  // name,
568
581
  // autoComplete,
569
- disabled: f,
582
+ disabled: p,
570
583
  required: v,
571
- multi: p = !1
572
- } = n, u = ve(s), [m, S] = r.useState(null), [x, C] = r.useState(null), [h, w] = r.useState(!1), A = Nt(g), [V = !1, M] = ie({
584
+ multi: f = !1
585
+ } = r, u = ve(s), [m, S] = l.useState(null), [C, x] = l.useState(null), [h, w] = l.useState(!1), A = Nt(g), [V = !1, M] = ie({
573
586
  prop: t,
574
587
  defaultProp: o,
575
- onChange: l
576
- }), [E, k] = ie({
588
+ onChange: n
589
+ }), [P, k] = ie({
577
590
  prop: i,
578
591
  defaultProp: c,
579
592
  onChange(O) {
580
593
  a && (Array.isArray(O), a(O));
581
594
  }
582
- }), $ = r.useRef(null), [G, F] = r.useState(/* @__PURE__ */ new Set());
583
- return /* @__PURE__ */ d(le.Root, { ...u, children: /* @__PURE__ */ d(
595
+ }), H = l.useRef(null), [z, $] = l.useState(/* @__PURE__ */ new Set());
596
+ return /* @__PURE__ */ d(re.Root, { ...u, children: /* @__PURE__ */ d(
584
597
  Io,
585
598
  {
586
599
  required: v,
587
600
  scope: s,
588
601
  trigger: m,
589
602
  onTriggerChange: S,
590
- valueNode: x,
591
- onValueNodeChange: C,
603
+ valueNode: C,
604
+ onValueNodeChange: x,
592
605
  valueNodeHasChildren: h,
593
606
  onValueNodeHasChildrenChange: w,
594
- contentId: ne(),
595
- value: E,
607
+ contentId: oe(),
608
+ value: P,
596
609
  onValueChange: k,
597
610
  open: V,
598
611
  onOpenChange: M,
599
612
  dir: A,
600
- triggerPointerDownPosRef: $,
601
- disabled: f,
602
- multi: p,
603
- children: /* @__PURE__ */ d(Ce.Provider, { scope: s, children: /* @__PURE__ */ d(
613
+ triggerPointerDownPosRef: H,
614
+ disabled: p,
615
+ multi: f,
616
+ children: /* @__PURE__ */ d(xe.Provider, { scope: s, children: /* @__PURE__ */ d(
604
617
  To,
605
618
  {
606
- scope: n.__scopeSelect,
607
- onNativeOptionAdd: r.useCallback((O) => {
608
- F((L) => new Set(L).add(O));
619
+ scope: r.__scopeSelect,
620
+ onNativeOptionAdd: l.useCallback((O) => {
621
+ $((F) => new Set(F).add(O));
609
622
  }, []),
610
- onNativeOptionRemove: r.useCallback((O) => {
611
- F((L) => {
612
- const B = new Set(L);
613
- return B.delete(O), B;
623
+ onNativeOptionRemove: l.useCallback((O) => {
624
+ $((F) => {
625
+ const L = new Set(F);
626
+ return L.delete(O), L;
614
627
  });
615
628
  }, []),
616
629
  children: e
@@ -620,29 +633,29 @@ const Tn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
620
633
  ) });
621
634
  };
622
635
  Oe.displayName = me;
623
- const gt = "SelectTrigger", De = r.forwardRef(
624
- (n, s) => {
625
- const { __scopeSelect: e, ...t } = n, o = ve(e), l = q(gt, e), i = l.disabled, c = _(s, l.onTriggerChange), a = he(e), [g, f, v] = Vt((u) => {
626
- const m = a().filter((C) => !C.disabled), S = m.find((C) => C.value === l.value), x = Et(m, u, S);
627
- if (x !== void 0 && !Array.isArray(x.value)) {
628
- const C = l.multi ? [x.value] : x.value;
629
- l.onValueChange(C);
636
+ const gt = "SelectTrigger", De = l.forwardRef(
637
+ (r, s) => {
638
+ const { __scopeSelect: e, ...t } = r, o = ve(e), n = Y(gt, e), i = n.disabled, c = _(s, n.onTriggerChange), a = he(e), [g, p, v] = Vt((u) => {
639
+ const m = a().filter((x) => !x.disabled), S = m.find((x) => x.value === n.value), C = Pt(m, u, S);
640
+ if (C !== void 0 && !Array.isArray(C.value)) {
641
+ const x = n.multi ? [C.value] : C.value;
642
+ n.onValueChange(x);
630
643
  }
631
- }), p = () => {
632
- i || (l.onOpenChange(!0), v());
644
+ }), f = () => {
645
+ i || (n.onOpenChange(!0), v());
633
646
  };
634
- return /* @__PURE__ */ d(le.Anchor, { asChild: !0, ...o, children: /* @__PURE__ */ d(
647
+ return /* @__PURE__ */ d(re.Anchor, { asChild: !0, ...o, children: /* @__PURE__ */ d(
635
648
  N.div,
636
649
  {
637
650
  role: "combobox",
638
- "aria-controls": l.contentId,
639
- "aria-expanded": l.open,
640
- "aria-required": l.required,
651
+ "aria-controls": n.contentId,
652
+ "aria-expanded": n.open,
653
+ "aria-required": n.required,
641
654
  "aria-autocomplete": "none",
642
- dir: l.dir,
643
- "data-state": l.open ? "open" : "closed",
655
+ dir: n.dir,
656
+ "data-state": n.open ? "open" : "closed",
644
657
  "data-disabled": i ? "" : void 0,
645
- "data-placeholder": l.value === void 0 ? "" : void 0,
658
+ "data-placeholder": n.value === void 0 ? "" : void 0,
646
659
  tabIndex: i ? void 0 : 0,
647
660
  ...t,
648
661
  ref: c,
@@ -651,30 +664,30 @@ const gt = "SelectTrigger", De = r.forwardRef(
651
664
  }),
652
665
  onPointerDown: T(t.onPointerDown, (u) => {
653
666
  const m = u.target;
654
- m.hasPointerCapture(u.pointerId) && m.releasePointerCapture(u.pointerId), (m.closest("button") ?? m.closest("div")) === u.currentTarget && u.button === 0 && u.ctrlKey === !1 && (p(), l.triggerPointerDownPosRef.current = {
667
+ m.hasPointerCapture(u.pointerId) && m.releasePointerCapture(u.pointerId), (m.closest("button") ?? m.closest("div")) === u.currentTarget && u.button === 0 && u.ctrlKey === !1 && (f(), n.triggerPointerDownPosRef.current = {
655
668
  x: Math.round(u.pageX),
656
669
  y: Math.round(u.pageY)
657
670
  }, u.preventDefault());
658
671
  }),
659
672
  onKeyDown: T(t.onKeyDown, (u) => {
660
- const m = g.current !== "", S = u.ctrlKey || u.altKey || u.metaKey, x = u.target;
661
- (x.closest("button") ?? x.closest("div")) === u.currentTarget && (!S && u.key.length === 1 && f(u.key), !(m && u.key === " ") && So.includes(u.key) && (p(), u.preventDefault()));
673
+ const m = g.current !== "", S = u.ctrlKey || u.altKey || u.metaKey, C = u.target;
674
+ (C.closest("button") ?? C.closest("div")) === u.currentTarget && (!S && u.key.length === 1 && p(u.key), !(m && u.key === " ") && So.includes(u.key) && (f(), u.preventDefault()));
662
675
  })
663
676
  }
664
677
  ) });
665
678
  }
666
679
  );
667
680
  De.displayName = gt;
668
- const xt = "SelectValue", ke = r.forwardRef(
669
- (n, s) => {
670
- const { __scopeSelect: e, children: t, placeholder: o, ...l } = n, i = q(xt, e), { onValueNodeHasChildrenChange: c } = i, a = t !== void 0, g = _(s, i.onValueNodeChange), [f, v] = r.useState([]), p = he(e);
671
- H(() => {
681
+ const Ct = "SelectValue", ke = l.forwardRef(
682
+ (r, s) => {
683
+ const { __scopeSelect: e, children: t, placeholder: o, ...n } = r, i = Y(Ct, e), { onValueNodeHasChildrenChange: c } = i, a = t !== void 0, g = _(s, i.onValueNodeChange), [p, v] = l.useState([]), f = he(e);
684
+ B(() => {
672
685
  c(a);
673
- }, [c, a]), r.useLayoutEffect(() => {
674
- if (Array.isArray(i.value) && f.length !== i.value.length) {
686
+ }, [c, a]), l.useLayoutEffect(() => {
687
+ if (Array.isArray(i.value) && p.length !== i.value.length) {
675
688
  const m = setTimeout(() => {
676
- const S = p().filter(
677
- (x) => Array.isArray(x.value) ? !1 : i.value?.includes(x.value)
689
+ const S = f().filter(
690
+ (C) => Array.isArray(C.value) ? !1 : i.value?.includes(C.value)
678
691
  );
679
692
  v(S);
680
693
  });
@@ -682,94 +695,94 @@ const xt = "SelectValue", ke = r.forwardRef(
682
695
  clearTimeout(m);
683
696
  };
684
697
  }
685
- }, [i.value, p, f]);
698
+ }, [i.value, f, p]);
686
699
  let u;
687
700
  if ((i.value === void 0 || i.value.length === 0) && o !== void 0)
688
701
  u = /* @__PURE__ */ d("span", { children: o });
689
702
  else if (typeof t == "function")
690
703
  if (Array.isArray(i.value)) {
691
704
  const m = i.value.map((S) => {
692
- const x = f.find((C) => C.value === S);
693
- return x ? t({ value: S, textValue: x?.textValue }) : null;
705
+ const C = p.find((x) => x.value === S);
706
+ return C ? t({ value: S, textValue: C?.textValue }) : null;
694
707
  });
695
708
  u = m.every((S) => S === null) ? o : m;
696
709
  } else
697
710
  u = t(i.value);
698
711
  else
699
712
  u = t;
700
- return /* @__PURE__ */ d(N.span, { ...l, ref: g, children: u || null });
713
+ return /* @__PURE__ */ d(N.span, { ...n, ref: g, children: u || null });
701
714
  }
702
715
  );
703
- ke.displayName = xt;
704
- const Eo = "SelectIcon", Fe = r.forwardRef(
705
- (n, s) => {
706
- const { __scopeSelect: e, children: t, ...o } = n;
716
+ ke.displayName = Ct;
717
+ const Po = "SelectIcon", Fe = l.forwardRef(
718
+ (r, s) => {
719
+ const { __scopeSelect: e, children: t, ...o } = r;
707
720
  return /* @__PURE__ */ d(N.span, { "aria-hidden": !0, ...o, ref: s, children: t || "▼" });
708
721
  }
709
722
  );
710
- Fe.displayName = Eo;
711
- const Po = "SelectPortal", Le = (n) => /* @__PURE__ */ d(lt, { asChild: !0, ...n });
712
- Le.displayName = Po;
713
- const re = "SelectContent", Be = r.forwardRef(
714
- (n, s) => {
715
- const e = q(re, n.__scopeSelect), [t, o] = r.useState();
716
- if (H(() => {
723
+ Fe.displayName = Po;
724
+ const Eo = "SelectPortal", Le = (r) => /* @__PURE__ */ d(lt, { asChild: !0, ...r });
725
+ Le.displayName = Eo;
726
+ const ne = "SelectContent", Be = l.forwardRef(
727
+ (r, s) => {
728
+ const e = Y(ne, r.__scopeSelect), [t, o] = l.useState();
729
+ if (B(() => {
717
730
  o(new DocumentFragment());
718
731
  }, []), !e.open) {
719
- const l = t;
720
- return l ? _e.createPortal(
721
- /* @__PURE__ */ d(Ct, { scope: n.__scopeSelect, children: /* @__PURE__ */ d(Ce.Slot, { scope: n.__scopeSelect, children: /* @__PURE__ */ d("div", { children: n.children }) }) }),
722
- l
732
+ const n = t;
733
+ return n ? _e.createPortal(
734
+ /* @__PURE__ */ d(xt, { scope: r.__scopeSelect, children: /* @__PURE__ */ d(xe.Slot, { scope: r.__scopeSelect, children: /* @__PURE__ */ d("div", { children: r.children }) }) }),
735
+ n
723
736
  ) : null;
724
737
  }
725
- return /* @__PURE__ */ d(vt, { ...n, ref: s });
738
+ return /* @__PURE__ */ d(vt, { ...r, ref: s });
726
739
  }
727
740
  );
728
- Be.displayName = re;
729
- const j = 10, [Ct, Q] = ae(re), Ro = "SelectContentImpl", vt = r.forwardRef(
730
- (n, s) => {
741
+ Be.displayName = ne;
742
+ const G = 10, [xt, J] = ae(ne), Ro = "SelectContentImpl", vt = l.forwardRef(
743
+ (r, s) => {
731
744
  const {
732
745
  __scopeSelect: e,
733
746
  position: t = "item-aligned",
734
747
  onCloseAutoFocus: o,
735
- onEscapeKeyDown: l,
748
+ onEscapeKeyDown: n,
736
749
  onPointerDownOutside: i,
737
750
  //
738
751
  // PopperContent props
739
752
  side: c,
740
753
  sideOffset: a,
741
754
  align: g,
742
- alignOffset: f,
755
+ alignOffset: p,
743
756
  arrowPadding: v,
744
- collisionBoundary: p,
757
+ collisionBoundary: f,
745
758
  collisionPadding: u,
746
759
  sticky: m,
747
760
  hideWhenDetached: S,
748
- avoidCollisions: x,
761
+ avoidCollisions: C,
749
762
  //
750
- ...C
751
- } = n, h = q(re, e), [w, A] = r.useState(null), [V, M] = r.useState(null), E = _(s, (b) => A(b)), [k, $] = r.useState(null), [G, F] = r.useState(null), O = he(e), [L, B] = r.useState(!1), U = r.useRef(!1);
752
- r.useEffect(() => {
763
+ ...x
764
+ } = r, h = Y(ne, e), [w, A] = l.useState(null), [V, M] = l.useState(null), P = _(s, (b) => A(b)), [k, H] = l.useState(null), [z, $] = l.useState(null), O = he(e), [F, L] = l.useState(!1), U = l.useRef(!1);
765
+ l.useEffect(() => {
753
766
  if (w)
754
767
  return st(w);
755
768
  }, [w]), ot();
756
- const K = r.useCallback(
769
+ const K = l.useCallback(
757
770
  (b) => {
758
- const [y, ...D] = O().map((R) => R.ref.current), [I] = D.slice(-1), P = document.activeElement;
771
+ const [y, ...D] = O().map((R) => R.ref.current), [I] = D.slice(-1), E = document.activeElement;
759
772
  for (const R of b)
760
- if (R === P || (R?.scrollIntoView({ block: "nearest" }), R === y && V && (V.scrollTop = 0), R === I && V && (V.scrollTop = V.scrollHeight), R?.focus(), document.activeElement !== P))
773
+ if (R === E || (R?.scrollIntoView({ block: "nearest" }), R === y && V && (V.scrollTop = 0), R === I && V && (V.scrollTop = V.scrollHeight), R?.focus(), document.activeElement !== E))
761
774
  return;
762
775
  },
763
776
  [O, V]
764
- ), X = r.useCallback(
777
+ ), q = l.useCallback(
765
778
  () => K([k, w]),
766
779
  [K, k, w]
767
780
  );
768
- r.useEffect(() => {
769
- L && X();
770
- }, [L, X]);
771
- const { onOpenChange: Z, triggerPointerDownPosRef: W } = h;
772
- r.useEffect(() => {
781
+ l.useEffect(() => {
782
+ F && q();
783
+ }, [F, q]);
784
+ const { onOpenChange: X, triggerPointerDownPosRef: W } = h;
785
+ l.useEffect(() => {
773
786
  if (w) {
774
787
  let b = { x: 0, y: 0 };
775
788
  const y = (I) => {
@@ -778,47 +791,47 @@ const j = 10, [Ct, Q] = ae(re), Ro = "SelectContentImpl", vt = r.forwardRef(
778
791
  y: Math.abs(Math.round(I.pageY) - (W.current?.y ?? 0))
779
792
  };
780
793
  }, D = (I) => {
781
- b.x <= 10 && b.y <= 10 ? I.preventDefault() : w.contains(I.target) || Z(!1), document.removeEventListener("pointermove", y), W.current = null;
794
+ b.x <= 10 && b.y <= 10 ? I.preventDefault() : w.contains(I.target) || X(!1), document.removeEventListener("pointermove", y), W.current = null;
782
795
  };
783
796
  return W.current !== null && (document.addEventListener("pointermove", y), document.addEventListener("pointerup", D, { capture: !0, once: !0 })), () => {
784
797
  document.removeEventListener("pointermove", y), document.removeEventListener("pointerup", D, { capture: !0 });
785
798
  };
786
799
  }
787
- }, [w, Z, W]), r.useEffect(() => {
788
- const b = () => Z(!1);
800
+ }, [w, X, W]), l.useEffect(() => {
801
+ const b = () => X(!1);
789
802
  return window.addEventListener("blur", b), window.addEventListener("resize", b), () => {
790
803
  window.removeEventListener("blur", b), window.removeEventListener("resize", b);
791
804
  };
792
- }, [Z]);
793
- const [ue, z] = Vt((b) => {
794
- const y = O().filter((P) => !P.disabled), D = y.find((P) => P.ref.current === document.activeElement), I = Et(y, b, D);
805
+ }, [X]);
806
+ const [ue, le] = Vt((b) => {
807
+ const y = O().filter((E) => !E.disabled), D = y.find((E) => E.ref.current === document.activeElement), I = Pt(y, b, D);
795
808
  I && setTimeout(() => I.ref.current.focus());
796
- }), se = r.useCallback(
809
+ }), se = l.useCallback(
797
810
  (b, y, D) => {
798
811
  const I = !U.current && !D;
799
- (h.value !== void 0 && h.value === y || I) && ($(b), I && (U.current = !0));
812
+ (h.value !== void 0 && h.value === y || I) && (H(b), I && (U.current = !0));
800
813
  },
801
814
  [h.value]
802
- ), de = r.useCallback(() => w?.focus(), [w]), J = r.useCallback(
815
+ ), de = l.useCallback(() => w?.focus(), [w]), Z = l.useCallback(
803
816
  (b, y, D) => {
804
817
  const I = !U.current && !D;
805
- (h.value !== void 0 && (Array.isArray(y) ? y.every((R) => h.value?.includes(R)) : h.value === y) || I) && F(b);
818
+ (h.value !== void 0 && (Array.isArray(y) ? y.every((R) => h.value?.includes(R)) : h.value === y) || I) && $(b);
806
819
  },
807
820
  [h.value]
808
- ), ce = t === "popper" ? Te : St, ee = ce === Te ? {
821
+ ), ce = t === "popper" ? Te : St, Q = ce === Te ? {
809
822
  side: c,
810
823
  sideOffset: a,
811
824
  align: g,
812
- alignOffset: f,
825
+ alignOffset: p,
813
826
  arrowPadding: v,
814
- collisionBoundary: p,
827
+ collisionBoundary: f,
815
828
  collisionPadding: u,
816
829
  sticky: m,
817
830
  hideWhenDetached: S,
818
- avoidCollisions: x
831
+ avoidCollisions: C
819
832
  } : {};
820
833
  return /* @__PURE__ */ d(
821
- Ct,
834
+ xt,
822
835
  {
823
836
  scope: e,
824
837
  content: w,
@@ -827,11 +840,11 @@ const j = 10, [Ct, Q] = ae(re), Ro = "SelectContentImpl", vt = r.forwardRef(
827
840
  itemRefCallback: se,
828
841
  selectedItem: k,
829
842
  onItemLeave: de,
830
- itemTextRefCallback: J,
831
- focusSelectedItem: X,
832
- selectedItemText: G,
843
+ itemTextRefCallback: Z,
844
+ focusSelectedItem: q,
845
+ selectedItemText: z,
833
846
  position: t,
834
- isPositioned: L,
847
+ isPositioned: F,
835
848
  searchRef: ue,
836
849
  children: /* @__PURE__ */ d(ct, { as: Ie, allowPinchZoom: !0, children: /* @__PURE__ */ d(
837
850
  nt,
@@ -849,7 +862,7 @@ const j = 10, [Ct, Q] = ae(re), Ro = "SelectContentImpl", vt = r.forwardRef(
849
862
  {
850
863
  asChild: !0,
851
864
  disableOutsidePointerEvents: !0,
852
- onEscapeKeyDown: l,
865
+ onEscapeKeyDown: n,
853
866
  onPointerDownOutside: i,
854
867
  onFocusOutside: (b) => b.preventDefault(),
855
868
  onDismiss: () => h.onOpenChange(!1),
@@ -862,24 +875,24 @@ const j = 10, [Ct, Q] = ae(re), Ro = "SelectContentImpl", vt = r.forwardRef(
862
875
  "aria-multiselectable": h.multi ? "true" : void 0,
863
876
  dir: h.dir,
864
877
  onContextMenu: (b) => b.preventDefault(),
865
- ...C,
866
- ...ee,
867
- onPlaced: () => B(!0),
868
- ref: E,
878
+ ...x,
879
+ ...Q,
880
+ onPlaced: () => L(!0),
881
+ ref: P,
869
882
  style: {
870
883
  // flex layout so we can place the scroll buttons properly
871
884
  display: "flex",
872
885
  flexDirection: "column",
873
886
  // reset the outline by default as the content MAY get focused
874
887
  outline: "none",
875
- ...C.style
888
+ ...x.style
876
889
  },
877
- onKeyDown: T(C.onKeyDown, (b) => {
890
+ onKeyDown: T(x.onKeyDown, (b) => {
878
891
  const y = b.ctrlKey || b.altKey || b.metaKey;
879
- if (b.key === "Tab" && b.preventDefault(), !y && b.key.length === 1 && z(b.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(b.key)) {
880
- let I = O().filter((P) => !P.disabled).map((P) => P.ref.current);
892
+ if (b.key === "Tab" && b.preventDefault(), !y && b.key.length === 1 && le(b.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(b.key)) {
893
+ let I = O().filter((E) => !E.disabled).map((E) => E.ref.current);
881
894
  if (["ArrowUp", "End"].includes(b.key) && (I = I.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(b.key)) {
882
- const P = b.target, R = I.indexOf(P);
895
+ const E = b.target, R = I.indexOf(E);
883
896
  I = I.slice(R + 1);
884
897
  }
885
898
  setTimeout(() => K(I)), b.preventDefault();
@@ -896,60 +909,60 @@ const j = 10, [Ct, Q] = ae(re), Ro = "SelectContentImpl", vt = r.forwardRef(
896
909
  }
897
910
  );
898
911
  vt.displayName = Ro;
899
- const No = "SelectItemAlignedPosition", St = r.forwardRef(
900
- (n, s) => {
901
- const { __scopeSelect: e, onPlaced: t, ...o } = n, l = q(re, e), i = Q(re, e), [c, a] = r.useState(null), [g, f] = r.useState(null), v = _(s, (E) => f(E)), p = he(e), u = r.useRef(!1), m = r.useRef(!0), { viewport: S, selectedItem: x, selectedItemText: C, focusSelectedItem: h } = i, w = r.useCallback(() => {
902
- if (l.trigger && l.valueNode && c && g && S && x && C) {
903
- const E = l.trigger.getBoundingClientRect(), k = g.getBoundingClientRect(), $ = l.valueNode.getBoundingClientRect(), G = C.getBoundingClientRect();
904
- if (l.dir !== "rtl") {
905
- const P = G.left - k.left, R = $.left - P, te = E.left - R, oe = E.width + te, Se = Math.max(oe, k.width), be = window.innerWidth - j, we = Ze(R, [j, be - Se]);
906
- c.style.minWidth = `${oe}px`, c.style.left = `${we}px`;
912
+ const No = "SelectItemAlignedPosition", St = l.forwardRef(
913
+ (r, s) => {
914
+ const { __scopeSelect: e, onPlaced: t, ...o } = r, n = Y(ne, e), i = J(ne, e), [c, a] = l.useState(null), [g, p] = l.useState(null), v = _(s, (P) => p(P)), f = he(e), u = l.useRef(!1), m = l.useRef(!0), { viewport: S, selectedItem: C, selectedItemText: x, focusSelectedItem: h } = i, w = l.useCallback(() => {
915
+ if (n.trigger && n.valueNode && c && g && S && C && x) {
916
+ const P = n.trigger.getBoundingClientRect(), k = g.getBoundingClientRect(), H = n.valueNode.getBoundingClientRect(), z = x.getBoundingClientRect();
917
+ if (n.dir !== "rtl") {
918
+ const E = z.left - k.left, R = H.left - E, ee = P.left - R, te = P.width + ee, Se = Math.max(te, k.width), be = window.innerWidth - G, we = Ze(R, [G, be - Se]);
919
+ c.style.minWidth = `${te}px`, c.style.left = `${we}px`;
907
920
  } else {
908
- const P = k.right - G.right, R = window.innerWidth - $.right - P, te = window.innerWidth - E.right - R, oe = E.width + te, Se = Math.max(oe, k.width), be = window.innerWidth - j, we = Ze(R, [j, be - Se]);
909
- c.style.minWidth = `${oe}px`, c.style.right = `${we}px`;
921
+ const E = k.right - z.right, R = window.innerWidth - H.right - E, ee = window.innerWidth - P.right - R, te = P.width + ee, Se = Math.max(te, k.width), be = window.innerWidth - G, we = Ze(R, [G, be - Se]);
922
+ c.style.minWidth = `${te}px`, c.style.right = `${we}px`;
910
923
  }
911
- const F = p(), O = window.innerHeight - j * 2, L = S.scrollHeight, B = window.getComputedStyle(g), U = parseInt(B.borderTopWidth, 10), K = parseInt(B.paddingTop, 10), X = parseInt(B.borderBottomWidth, 10), Z = parseInt(B.paddingBottom, 10), W = U + K + L + Z + X, ue = Math.min(x.offsetHeight * 5, W), z = window.getComputedStyle(S), se = parseInt(z.paddingTop, 10), de = parseInt(z.paddingBottom, 10), J = E.top + E.height / 2 - j, ce = O - J, ee = x.offsetHeight / 2, b = x.offsetTop + ee, y = U + K + b, D = W - y;
912
- if (y <= J) {
913
- const P = x === F[F.length - 1].ref.current;
924
+ const $ = f(), O = window.innerHeight - G * 2, F = S.scrollHeight, L = window.getComputedStyle(g), U = parseInt(L.borderTopWidth, 10), K = parseInt(L.paddingTop, 10), q = parseInt(L.borderBottomWidth, 10), X = parseInt(L.paddingBottom, 10), W = U + K + F + X + q, ue = Math.min(C.offsetHeight * 5, W), le = window.getComputedStyle(S), se = parseInt(le.paddingTop, 10), de = parseInt(le.paddingBottom, 10), Z = P.top + P.height / 2 - G, ce = O - Z, Q = C.offsetHeight / 2, b = C.offsetTop + Q, y = U + K + b, D = W - y;
925
+ if (y <= Z) {
926
+ const E = C === $[$.length - 1].ref.current;
914
927
  c.style.bottom = "0px";
915
- const R = g.clientHeight - S.offsetTop - S.offsetHeight, te = Math.max(
928
+ const R = g.clientHeight - S.offsetTop - S.offsetHeight, ee = Math.max(
916
929
  ce,
917
- ee + // viewport might have padding bottom, include it to avoid a scrollable viewport
918
- (P ? de : 0) + R + X
919
- ), oe = y + te;
920
- c.style.height = `${oe}px`;
930
+ Q + // viewport might have padding bottom, include it to avoid a scrollable viewport
931
+ (E ? de : 0) + R + q
932
+ ), te = y + ee;
933
+ c.style.height = `${te}px`;
921
934
  } else {
922
- const P = x === F[0].ref.current;
935
+ const E = C === $[0].ref.current;
923
936
  c.style.top = "0px";
924
- const te = Math.max(
925
- J,
937
+ const ee = Math.max(
938
+ Z,
926
939
  U + S.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
927
- (P ? se : 0) + ee
940
+ (E ? se : 0) + Q
928
941
  ) + D;
929
- c.style.height = `${te}px`, S.scrollTop = y - J + S.offsetTop;
942
+ c.style.height = `${ee}px`, S.scrollTop = y - Z + S.offsetTop;
930
943
  }
931
- c.style.margin = `${j}px 0`, c.style.minHeight = `${ue}px`, c.style.maxHeight = `${O}px`, t?.(), requestAnimationFrame(() => u.current = !0);
944
+ c.style.margin = `${G}px 0`, c.style.minHeight = `${ue}px`, c.style.maxHeight = `${O}px`, t?.(), requestAnimationFrame(() => u.current = !0);
932
945
  }
933
946
  }, [
934
- p,
935
- l.trigger,
936
- l.valueNode,
947
+ f,
948
+ n.trigger,
949
+ n.valueNode,
937
950
  c,
938
951
  g,
939
952
  S,
940
- x,
941
953
  C,
942
- l.dir,
954
+ x,
955
+ n.dir,
943
956
  t
944
957
  ]);
945
- H(() => w(), [w]);
946
- const [A, V] = r.useState();
947
- H(() => {
958
+ B(() => w(), [w]);
959
+ const [A, V] = l.useState();
960
+ B(() => {
948
961
  g && V(window.getComputedStyle(g).zIndex);
949
962
  }, [g]);
950
- const M = r.useCallback(
951
- (E) => {
952
- E && m.current === !0 && (w(), h?.(), m.current = !1);
963
+ const M = l.useCallback(
964
+ (P) => {
965
+ P && m.current === !0 && (w(), h?.(), m.current = !1);
953
966
  },
954
967
  [w, h]
955
968
  );
@@ -992,21 +1005,21 @@ const No = "SelectItemAlignedPosition", St = r.forwardRef(
992
1005
  }
993
1006
  );
994
1007
  St.displayName = No;
995
- const Ao = "SelectPopperPosition", Te = r.forwardRef(
996
- (n, s) => {
997
- const { __scopeSelect: e, align: t = "start", collisionPadding: o = j, ...l } = n, i = ve(e);
1008
+ const Ao = "SelectPopperPosition", Te = l.forwardRef(
1009
+ (r, s) => {
1010
+ const { __scopeSelect: e, align: t = "start", collisionPadding: o = G, ...n } = r, i = ve(e);
998
1011
  return /* @__PURE__ */ d(
999
- le.Content,
1012
+ re.Content,
1000
1013
  {
1001
1014
  ...i,
1002
- ...l,
1015
+ ...n,
1003
1016
  ref: s,
1004
1017
  align: t,
1005
1018
  collisionPadding: o,
1006
1019
  style: {
1007
1020
  // Ensure border-box for floating-ui calculations
1008
1021
  boxSizing: "border-box",
1009
- ...l.style,
1022
+ ...n.style,
1010
1023
  "--radix-select-content-transform-origin": "var(--radix-popper-transform-origin)",
1011
1024
  "--radix-select-content-available-width": "var(--radix-popper-available-width)",
1012
1025
  "--radix-select-content-available-height": "var(--radix-popper-available-height)",
@@ -1019,11 +1032,11 @@ const Ao = "SelectPopperPosition", Te = r.forwardRef(
1019
1032
  );
1020
1033
  Te.displayName = Ao;
1021
1034
  const [_o, He] = ae(
1022
- re,
1035
+ ne,
1023
1036
  {}
1024
- ), Ve = "SelectViewport", $e = r.forwardRef(
1025
- (n, s) => {
1026
- const { __scopeSelect: e, ...t } = n, o = Q(Ve, e), l = He(Ve, e), i = _(s, o.onViewportChange), c = r.useRef(0);
1037
+ ), Ve = "SelectViewport", $e = l.forwardRef(
1038
+ (r, s) => {
1039
+ const { __scopeSelect: e, ...t } = r, o = J(Ve, e), n = He(Ve, e), i = _(s, o.onViewportChange), c = l.useRef(0);
1027
1040
  return /* @__PURE__ */ Ne(Ae, { children: [
1028
1041
  /* @__PURE__ */ d(
1029
1042
  "style",
@@ -1033,7 +1046,7 @@ const [_o, He] = ae(
1033
1046
  }
1034
1047
  }
1035
1048
  ),
1036
- /* @__PURE__ */ d(Ce.Slot, { scope: e, children: /* @__PURE__ */ d(
1049
+ /* @__PURE__ */ d(xe.Slot, { scope: e, children: /* @__PURE__ */ d(
1037
1050
  N.div,
1038
1051
  {
1039
1052
  "data-radix-select-viewport": "",
@@ -1050,14 +1063,14 @@ const [_o, He] = ae(
1050
1063
  ...t.style
1051
1064
  },
1052
1065
  onScroll: T(t.onScroll, (a) => {
1053
- const g = a.currentTarget, { contentWrapper: f, shouldExpandOnScrollRef: v } = l;
1054
- if (v?.current && f) {
1055
- const p = Math.abs(c.current - g.scrollTop);
1056
- if (p > 0) {
1057
- const u = window.innerHeight - j * 2, m = parseFloat(f.style.minHeight), S = parseFloat(f.style.height), x = Math.max(m, S);
1058
- if (x < u) {
1059
- const C = x + p, h = Math.min(u, C), w = C - h;
1060
- f.style.height = `${h}px`, f.style.bottom === "0px" && (g.scrollTop = w > 0 ? w : 0, f.style.justifyContent = "flex-end");
1066
+ const g = a.currentTarget, { contentWrapper: p, shouldExpandOnScrollRef: v } = n;
1067
+ if (v?.current && p) {
1068
+ const f = Math.abs(c.current - g.scrollTop);
1069
+ if (f > 0) {
1070
+ const u = window.innerHeight - G * 2, m = parseFloat(p.style.minHeight), S = parseFloat(p.style.height), C = Math.max(m, S);
1071
+ if (C < u) {
1072
+ const x = C + f, h = Math.min(u, x), w = x - h;
1073
+ p.style.height = `${h}px`, p.style.bottom === "0px" && (g.scrollTop = w > 0 ? w : 0, p.style.justifyContent = "flex-end");
1061
1074
  }
1062
1075
  }
1063
1076
  }
@@ -1069,29 +1082,29 @@ const [_o, He] = ae(
1069
1082
  }
1070
1083
  );
1071
1084
  $e.displayName = Ve;
1072
- const bt = "SelectGroup", [Mo, Oo] = ae(bt), Ue = r.forwardRef(
1073
- (n, s) => {
1074
- const { __scopeSelect: e, ...t } = n, o = ne();
1085
+ const bt = "SelectGroup", [Mo, Oo] = ae(bt), Ue = l.forwardRef(
1086
+ (r, s) => {
1087
+ const { __scopeSelect: e, ...t } = r, o = oe();
1075
1088
  return /* @__PURE__ */ d(Mo, { scope: e, id: o, children: /* @__PURE__ */ d(N.div, { role: "group", "aria-labelledby": o, ...t, ref: s }) });
1076
1089
  }
1077
1090
  );
1078
1091
  Ue.displayName = bt;
1079
- const wt = "SelectLabel", Ke = r.forwardRef(
1080
- (n, s) => {
1081
- const { __scopeSelect: e, ...t } = n, o = Oo(wt, e);
1092
+ const wt = "SelectLabel", Ke = l.forwardRef(
1093
+ (r, s) => {
1094
+ const { __scopeSelect: e, ...t } = r, o = Oo(wt, e);
1082
1095
  return /* @__PURE__ */ d(N.div, { id: o.id, ...t, ref: s });
1083
1096
  }
1084
1097
  );
1085
1098
  Ke.displayName = wt;
1086
- const ge = "SelectItem", [Do, yt] = ae(ge), We = r.forwardRef(
1087
- (n, s) => {
1088
- const { __scopeSelect: e, value: t, disabled: o = !1, textValue: l, ...i } = n, c = q(ge, e), a = Q(ge, e), g = typeof t == "string" ? Array.isArray(c.value) ? c.value.includes(t) : c.value === t : t.every((h) => c.value?.includes(h)), f = Array.isArray(c.value) && Array.isArray(t) && t.some((h) => c.value?.includes(h)), [v, p] = r.useState(l ?? ""), [u, m] = r.useState(!1), S = _(
1099
+ const ge = "SelectItem", [Do, yt] = ae(ge), We = l.forwardRef(
1100
+ (r, s) => {
1101
+ const { __scopeSelect: e, value: t, disabled: o = !1, textValue: n, ...i } = r, c = Y(ge, e), a = J(ge, e), g = typeof t == "string" ? Array.isArray(c.value) ? c.value.includes(t) : c.value === t : t.every((h) => c.value?.includes(h)), p = Array.isArray(c.value) && Array.isArray(t) && t.some((h) => c.value?.includes(h)), [v, f] = l.useState(n ?? ""), [u, m] = l.useState(!1), S = _(
1089
1102
  s,
1090
1103
  (h) => a.itemRefCallback?.(h, t, o)
1091
- ), x = ne(), C = () => {
1104
+ ), C = oe(), x = () => {
1092
1105
  if (!o) {
1093
1106
  let h = c.multi && typeof t == "string" ? [t] : t;
1094
- f && !g ? c.onValueChange(h) : Array.isArray(c.value) && (h = Pt(t, c.value)), c.onValueChange(h), c.multi || c.onOpenChange(!1);
1107
+ p && !g ? c.onValueChange(h) : Array.isArray(c.value) && (h = Et(t, c.value)), c.onValueChange(h), c.multi || c.onOpenChange(!1);
1095
1108
  }
1096
1109
  };
1097
1110
  if (!c.multi && Array.isArray(t))
@@ -1102,17 +1115,17 @@ const ge = "SelectItem", [Do, yt] = ae(ge), We = r.forwardRef(
1102
1115
  scope: e,
1103
1116
  value: t,
1104
1117
  disabled: o,
1105
- textId: x,
1118
+ textId: C,
1106
1119
  isSelected: g,
1107
- isIntermediate: f,
1108
- onItemTextChange: r.useCallback((h) => {
1109
- p((w) => w || (h?.textContent ?? "").trim());
1120
+ isIntermediate: p,
1121
+ onItemTextChange: l.useCallback((h) => {
1122
+ f((w) => w || (h?.textContent ?? "").trim());
1110
1123
  }, []),
1111
- children: /* @__PURE__ */ d(Ce.ItemSlot, { scope: e, value: t, disabled: o, textValue: v, children: /* @__PURE__ */ d(
1124
+ children: /* @__PURE__ */ d(xe.ItemSlot, { scope: e, value: t, disabled: o, textValue: v, children: /* @__PURE__ */ d(
1112
1125
  N.div,
1113
1126
  {
1114
1127
  role: "option",
1115
- "aria-labelledby": x,
1128
+ "aria-labelledby": C,
1116
1129
  "data-highlighted": u ? "" : void 0,
1117
1130
  "aria-selected": c.multi ? void 0 : g && u,
1118
1131
  "aria-checked": c.multi ? g : void 0,
@@ -1124,7 +1137,7 @@ const ge = "SelectItem", [Do, yt] = ae(ge), We = r.forwardRef(
1124
1137
  ref: S,
1125
1138
  onFocus: T(i.onFocus, () => m(!0)),
1126
1139
  onBlur: T(i.onBlur, () => m(!1)),
1127
- onPointerUp: T(i.onPointerUp, C),
1140
+ onPointerUp: T(i.onPointerUp, x),
1128
1141
  onPointerMove: T(i.onPointerMove, (h) => {
1129
1142
  o ? a.onItemLeave?.() : h.currentTarget.focus({ preventScroll: !0 });
1130
1143
  }),
@@ -1132,7 +1145,7 @@ const ge = "SelectItem", [Do, yt] = ae(ge), We = r.forwardRef(
1132
1145
  h.currentTarget === document.activeElement && a.onItemLeave?.();
1133
1146
  }),
1134
1147
  onKeyDown: T(i.onKeyDown, (h) => {
1135
- a.searchRef?.current !== "" && h.key === " " || (bo.includes(h.key) && C(), h.key === " " && h.preventDefault());
1148
+ a.searchRef?.current !== "" && h.key === " " || (bo.includes(h.key) && x(), h.key === " " && h.preventDefault());
1136
1149
  })
1137
1150
  }
1138
1151
  ) })
@@ -1141,14 +1154,14 @@ const ge = "SelectItem", [Do, yt] = ae(ge), We = r.forwardRef(
1141
1154
  }
1142
1155
  );
1143
1156
  We.displayName = ge;
1144
- const fe = "SelectItemText", ze = r.forwardRef(
1145
- (n, s) => {
1146
- const { __scopeSelect: e, className: t, style: o, ...l } = n, i = q(fe, e), c = Q(fe, e), a = yt(fe, e), g = Vo(fe, e), [f, v] = r.useState(null), p = _(
1157
+ const pe = "SelectItemText", ze = l.forwardRef(
1158
+ (r, s) => {
1159
+ const { __scopeSelect: e, className: t, style: o, ...n } = r, i = Y(pe, e), c = J(pe, e), a = yt(pe, e), g = Vo(pe, e), [p, v] = l.useState(null), f = _(
1147
1160
  s,
1148
- (C) => v(C),
1161
+ (x) => v(x),
1149
1162
  a.onItemTextChange,
1150
- (C) => c.itemTextRefCallback?.(C, a.value, a.disabled)
1151
- ), u = f?.textContent, m = r.useMemo(
1163
+ (x) => c.itemTextRefCallback?.(x, a.value, a.disabled)
1164
+ ), u = p?.textContent, m = l.useMemo(
1152
1165
  () => /* @__PURE__ */ d(
1153
1166
  "option",
1154
1167
  {
@@ -1159,39 +1172,39 @@ const fe = "SelectItemText", ze = r.forwardRef(
1159
1172
  Array.isArray(a.value) ? a.value.join(";") : a.value
1160
1173
  ),
1161
1174
  [a.disabled, a.value, u]
1162
- ), { onNativeOptionAdd: S, onNativeOptionRemove: x } = g;
1163
- return H(() => (S(m), () => x(m)), [S, x, m]), /* @__PURE__ */ Ne(Ae, { children: [
1164
- /* @__PURE__ */ d(N.span, { id: a.textId, ...l, ref: p }),
1165
- a.isSelected && i.valueNode && !i.valueNodeHasChildren ? _e.createPortal(l.children, i.valueNode) : null
1175
+ ), { onNativeOptionAdd: S, onNativeOptionRemove: C } = g;
1176
+ return B(() => (S(m), () => C(m)), [S, C, m]), /* @__PURE__ */ Ne(Ae, { children: [
1177
+ /* @__PURE__ */ d(N.span, { id: a.textId, ...n, ref: f }),
1178
+ a.isSelected && i.valueNode && !i.valueNodeHasChildren ? _e.createPortal(n.children, i.valueNode) : null
1166
1179
  ] });
1167
1180
  }
1168
1181
  );
1169
- ze.displayName = fe;
1170
- const It = "SelectItemIndicator", Ge = r.forwardRef(
1171
- (n, s) => {
1172
- const { __scopeSelect: e, children: t, ...o } = n, l = yt(It, e);
1182
+ ze.displayName = pe;
1183
+ const It = "SelectItemIndicator", Ge = l.forwardRef(
1184
+ (r, s) => {
1185
+ const { __scopeSelect: e, children: t, ...o } = r, n = yt(It, e);
1173
1186
  return typeof t == "function" ? /* @__PURE__ */ d(N.span, { "aria-hidden": !0, ...o, ref: s, children: t({
1174
- isSelected: l.isSelected,
1175
- isIntermediate: l.isIntermediate
1176
- }) }) : l.isSelected ? /* @__PURE__ */ d(N.span, { "aria-hidden": !0, ...o, ref: s, children: t }) : null;
1187
+ isSelected: n.isSelected,
1188
+ isIntermediate: n.isIntermediate
1189
+ }) }) : n.isSelected ? /* @__PURE__ */ d(N.span, { "aria-hidden": !0, ...o, ref: s, children: t }) : null;
1177
1190
  }
1178
1191
  );
1179
1192
  Ge.displayName = It;
1180
- const Ee = "SelectScrollUpButton", je = r.forwardRef(
1181
- (n, s) => {
1182
- const e = Q(Ee, n.__scopeSelect), t = He(Ee, n.__scopeSelect), [o, l] = r.useState(!1), i = _(s, t.onScrollButtonChange);
1183
- return H(() => {
1193
+ const Pe = "SelectScrollUpButton", je = l.forwardRef(
1194
+ (r, s) => {
1195
+ const e = J(Pe, r.__scopeSelect), t = He(Pe, r.__scopeSelect), [o, n] = l.useState(!1), i = _(s, t.onScrollButtonChange);
1196
+ return B(() => {
1184
1197
  if (e.viewport && e.isPositioned) {
1185
1198
  const c = e.viewport, a = () => {
1186
1199
  const g = c.scrollTop > 0;
1187
- l(g);
1200
+ n(g);
1188
1201
  };
1189
1202
  return a(), c.addEventListener("scroll", a), () => c.removeEventListener("scroll", a);
1190
1203
  }
1191
1204
  }, [e.viewport, e.isPositioned]), o ? /* @__PURE__ */ d(
1192
1205
  Tt,
1193
1206
  {
1194
- ...n,
1207
+ ...r,
1195
1208
  ref: i,
1196
1209
  onAutoScroll: () => {
1197
1210
  const { viewport: c, selectedItem: a } = e;
@@ -1201,22 +1214,22 @@ const Ee = "SelectScrollUpButton", je = r.forwardRef(
1201
1214
  ) : null;
1202
1215
  }
1203
1216
  );
1204
- je.displayName = Ee;
1205
- const Pe = "SelectScrollDownButton", Ye = r.forwardRef(
1206
- (n, s) => {
1207
- const e = Q(Pe, n.__scopeSelect), t = He(Pe, n.__scopeSelect), [o, l] = r.useState(!1), i = _(s, t.onScrollButtonChange);
1208
- return H(() => {
1217
+ je.displayName = Pe;
1218
+ const Ee = "SelectScrollDownButton", Ye = l.forwardRef(
1219
+ (r, s) => {
1220
+ const e = J(Ee, r.__scopeSelect), t = He(Ee, r.__scopeSelect), [o, n] = l.useState(!1), i = _(s, t.onScrollButtonChange);
1221
+ return B(() => {
1209
1222
  if (e.viewport && e.isPositioned) {
1210
1223
  const c = e.viewport, a = () => {
1211
- const g = c.scrollHeight - c.clientHeight, f = Math.ceil(c.scrollTop) < g;
1212
- l(f);
1224
+ const g = c.scrollHeight - c.clientHeight, p = Math.ceil(c.scrollTop) < g;
1225
+ n(p);
1213
1226
  };
1214
1227
  return a(), c.addEventListener("scroll", a), () => c.removeEventListener("scroll", a);
1215
1228
  }
1216
1229
  }, [e.viewport, e.isPositioned]), o ? /* @__PURE__ */ d(
1217
1230
  Tt,
1218
1231
  {
1219
- ...n,
1232
+ ...r,
1220
1233
  ref: i,
1221
1234
  onAutoScroll: () => {
1222
1235
  const { viewport: c, selectedItem: a } = e;
@@ -1226,14 +1239,14 @@ const Pe = "SelectScrollDownButton", Ye = r.forwardRef(
1226
1239
  ) : null;
1227
1240
  }
1228
1241
  );
1229
- Ye.displayName = Pe;
1230
- const Tt = r.forwardRef(
1231
- (n, s) => {
1232
- const { __scopeSelect: e, onAutoScroll: t, ...o } = n, l = Q("SelectScrollButton", e), i = r.useRef(null), c = he(e), a = r.useCallback(() => {
1242
+ Ye.displayName = Ee;
1243
+ const Tt = l.forwardRef(
1244
+ (r, s) => {
1245
+ const { __scopeSelect: e, onAutoScroll: t, ...o } = r, n = J("SelectScrollButton", e), i = l.useRef(null), c = he(e), a = l.useCallback(() => {
1233
1246
  i.current !== null && (window.clearInterval(i.current), i.current = null);
1234
1247
  }, []);
1235
- return r.useEffect(() => () => a(), [a]), H(() => {
1236
- c().find((f) => f.ref.current === document.activeElement)?.ref.current?.scrollIntoView({ block: "nearest" });
1248
+ return l.useEffect(() => () => a(), [a]), B(() => {
1249
+ c().find((p) => p.ref.current === document.activeElement)?.ref.current?.scrollIntoView({ block: "nearest" });
1237
1250
  }, [c]), /* @__PURE__ */ d(
1238
1251
  N.div,
1239
1252
  {
@@ -1242,7 +1255,7 @@ const Tt = r.forwardRef(
1242
1255
  ref: s,
1243
1256
  style: { flexShrink: 0, ...o.style },
1244
1257
  onPointerMove: T(o.onPointerMove, () => {
1245
- l.onItemLeave?.(), i.current === null && (i.current = window.setInterval(t, 50));
1258
+ n.onItemLeave?.(), i.current === null && (i.current = window.setInterval(t, 50));
1246
1259
  }),
1247
1260
  onPointerLeave: T(o.onPointerLeave, () => {
1248
1261
  a();
@@ -1250,28 +1263,28 @@ const Tt = r.forwardRef(
1250
1263
  }
1251
1264
  );
1252
1265
  }
1253
- ), ko = "SelectSeparator", qe = r.forwardRef(
1254
- (n, s) => {
1255
- const { __scopeSelect: e, ...t } = n;
1266
+ ), ko = "SelectSeparator", qe = l.forwardRef(
1267
+ (r, s) => {
1268
+ const { __scopeSelect: e, ...t } = r;
1256
1269
  return /* @__PURE__ */ d(N.div, { "aria-hidden": !0, ...t, ref: s });
1257
1270
  }
1258
1271
  );
1259
1272
  qe.displayName = ko;
1260
- const Re = "SelectArrow", Xe = r.forwardRef(
1261
- (n, s) => {
1262
- const { __scopeSelect: e, ...t } = n, o = ve(e), l = q(Re, e), i = Q(Re, e);
1263
- return l.open && i.position === "popper" ? /* @__PURE__ */ d(le.Arrow, { ...o, ...t, ref: s }) : null;
1273
+ const Re = "SelectArrow", Xe = l.forwardRef(
1274
+ (r, s) => {
1275
+ const { __scopeSelect: e, ...t } = r, o = ve(e), n = Y(Re, e), i = J(Re, e);
1276
+ return n.open && i.position === "popper" ? /* @__PURE__ */ d(re.Arrow, { ...o, ...t, ref: s }) : null;
1264
1277
  }
1265
1278
  );
1266
1279
  Xe.displayName = Re;
1267
- const Fo = "BubbleSelect", Lo = r.forwardRef(
1268
- (n, s) => {
1269
- const { value: e, ...t } = n, o = r.useRef(null), l = _(s, o), i = _t(e), c = q(Fo, void 0);
1270
- r.useEffect(() => {
1271
- const g = o.current, f = window.HTMLSelectElement.prototype, p = Object.getOwnPropertyDescriptor(f, "value").set;
1272
- if (i !== e && p) {
1280
+ const Fo = "BubbleSelect", Lo = l.forwardRef(
1281
+ (r, s) => {
1282
+ const { value: e, ...t } = r, o = l.useRef(null), n = _(s, o), i = _t(e), c = Y(Fo, void 0);
1283
+ l.useEffect(() => {
1284
+ const g = o.current, p = window.HTMLSelectElement.prototype, f = Object.getOwnPropertyDescriptor(p, "value").set;
1285
+ if (i !== e && f) {
1273
1286
  const u = new Event("change", { bubbles: !0 });
1274
- p.call(g, e), g.dispatchEvent(u);
1287
+ f.call(g, e), g.dispatchEvent(u);
1275
1288
  }
1276
1289
  }, [i, e]);
1277
1290
  let a = e;
@@ -1280,15 +1293,15 @@ const Fo = "BubbleSelect", Lo = r.forwardRef(
1280
1293
  {
1281
1294
  ...t,
1282
1295
  multiple: c.multi ? !0 : void 0,
1283
- ref: l,
1296
+ ref: n,
1284
1297
  defaultValue: a
1285
1298
  }
1286
1299
  ) });
1287
1300
  }
1288
1301
  );
1289
1302
  Lo.displayName = "BubbleSelect";
1290
- function Vt(n) {
1291
- const s = At(n), e = r.useRef(""), t = r.useRef(0), o = r.useCallback(
1303
+ function Vt(r) {
1304
+ const s = At(r), e = l.useRef(""), t = l.useRef(0), o = l.useCallback(
1292
1305
  (i) => {
1293
1306
  const c = e.current + i;
1294
1307
  s(c), function a(g) {
@@ -1296,26 +1309,26 @@ function Vt(n) {
1296
1309
  }(c);
1297
1310
  },
1298
1311
  [s]
1299
- ), l = r.useCallback(() => {
1312
+ ), n = l.useCallback(() => {
1300
1313
  e.current = "", window.clearTimeout(t.current);
1301
1314
  }, []);
1302
- return r.useEffect(() => () => window.clearTimeout(t.current), []), [e, o, l];
1315
+ return l.useEffect(() => () => window.clearTimeout(t.current), []), [e, o, n];
1303
1316
  }
1304
- function Et(n, s, e) {
1305
- const o = s.length > 1 && Array.from(s).every((g) => g === s[0]) ? s[0] : s, l = e ? n.indexOf(e) : -1;
1306
- let i = Bo(n, Math.max(l, 0));
1317
+ function Pt(r, s, e) {
1318
+ const o = s.length > 1 && Array.from(s).every((g) => g === s[0]) ? s[0] : s, n = e ? r.indexOf(e) : -1;
1319
+ let i = Bo(r, Math.max(n, 0));
1307
1320
  o.length === 1 && (i = i.filter((g) => g !== e));
1308
1321
  const a = i.find((g) => g.textValue.toLowerCase().startsWith(o.toLowerCase()));
1309
1322
  return a !== e ? a : void 0;
1310
1323
  }
1311
- function Bo(n, s) {
1312
- return n.map((e, t) => n[(s + t) % n.length]);
1324
+ function Bo(r, s) {
1325
+ return r.map((e, t) => r[(s + t) % r.length]);
1313
1326
  }
1314
- const Pt = (n, s = []) => {
1315
- if (Array.isArray(n))
1316
- return n.reduce((t, o) => Pt(o, t), s);
1317
- const e = s.indexOf(n);
1318
- return e === -1 ? [...s, n] : [...s.slice(0, e), ...s.slice(e + 1)];
1327
+ const Et = (r, s = []) => {
1328
+ if (Array.isArray(r))
1329
+ return r.reduce((t, o) => Et(o, t), s);
1330
+ const e = s.indexOf(r);
1331
+ return e === -1 ? [...s, r] : [...s.slice(0, e), ...s.slice(e + 1)];
1319
1332
  }, Ho = Oe, $o = De, Uo = ke, Ko = Fe, Wo = Le, zo = Be, Go = $e, jo = Ue, Yo = Ke, qo = We, Xo = ze, Zo = Ge, Jo = je, Qo = Ye, en = qe, tn = Xe, Vn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1320
1333
  __proto__: null,
1321
1334
  Arrow: tn,