@strapi/ui-primitives 1.7.8 → 1.7.10

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