react-animated-select 0.7.0 → 0.7.5

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.es.js CHANGED
@@ -1,1712 +1,1096 @@
1
- import Be, { isValidElement as tt, cloneElement as rt, createContext as Ye, useReducer as Ge, useCallback as C, useRef as ie, useLayoutEffect as xe, useEffect as ne, forwardRef as Ve, useImperativeHandle as Je, memo as $e, Fragment as Ue, useState as Se, useEffectEvent as Pe, useMemo as ce, useId as qe, useContext as Oe } from "react";
2
- import { CSSTransition as Ie, TransitionGroup as Le } from "react-transition-group";
3
- import { createPortal as nt } from "react-dom";
4
- import './index.css';var je = { exports: {} }, be = {};
5
- var De;
6
- function st() {
7
- if (De) return be;
8
- De = 1;
9
- var e = /* @__PURE__ */ Symbol.for("react.transitional.element"), t = /* @__PURE__ */ Symbol.for("react.fragment");
10
- function n(l, s, p) {
11
- var c = null;
12
- if (p !== void 0 && (c = "" + p), s.key !== void 0 && (c = "" + s.key), "key" in s) {
13
- p = {};
14
- for (var j in s)
15
- j !== "key" && (p[j] = s[j]);
16
- } else p = s;
17
- return s = p.ref, {
18
- $$typeof: e,
19
- type: l,
20
- key: c,
21
- ref: s !== void 0 ? s : null,
22
- props: p
23
- };
24
- }
25
- return be.Fragment = t, be.jsx = n, be.jsxs = n, be;
26
- }
27
- var ve = {};
28
- var He;
29
- function it() {
30
- return He || (He = 1, process.env.NODE_ENV !== "production" && (function() {
31
- function e(r) {
32
- if (r == null) return null;
33
- if (typeof r == "function")
34
- return r.$$typeof === K ? null : r.displayName || r.name || null;
35
- if (typeof r == "string") return r;
36
- switch (r) {
37
- case D:
38
- return "Fragment";
39
- case J:
40
- return "Profiler";
41
- case X:
42
- return "StrictMode";
43
- case U:
44
- return "Suspense";
45
- case a:
46
- return "SuspenseList";
47
- case I:
48
- return "Activity";
49
- }
50
- if (typeof r == "object")
51
- switch (typeof r.tag == "number" && console.error(
52
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
53
- ), r.$$typeof) {
54
- case $:
55
- return "Portal";
56
- case Z:
57
- return r.displayName || "Context";
58
- case M:
59
- return (r._context.displayName || "Context") + ".Consumer";
60
- case m:
61
- var b = r.render;
62
- return r = r.displayName, r || (r = b.displayName || b.name || "", r = r !== "" ? "ForwardRef(" + r + ")" : "ForwardRef"), r;
63
- case w:
64
- return b = r.displayName || null, b !== null ? b : e(r.type) || "Memo";
65
- case z:
66
- b = r._payload, r = r._init;
67
- try {
68
- return e(r(b));
69
- } catch {
70
- }
71
- }
72
- return null;
73
- }
74
- function t(r) {
75
- return "" + r;
76
- }
77
- function n(r) {
78
- try {
79
- t(r);
80
- var b = !1;
81
- } catch {
82
- b = !0;
83
- }
84
- if (b) {
85
- b = console;
86
- var A = b.error, G = typeof Symbol == "function" && Symbol.toStringTag && r[Symbol.toStringTag] || r.constructor.name || "Object";
87
- return A.call(
88
- b,
89
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
90
- G
91
- ), t(r);
92
- }
1
+ "use client";
2
+ import { jsx as O, jsxs as q } from "react/jsx-runtime";
3
+ import { createContext as we, useState as U, useRef as F, useInsertionEffect as yt, isValidElement as xe, cloneElement as bt, useMemo as _, useLayoutEffect as ne, useEffect as oe, useCallback as K, useContext as B, useEffectEvent as ot, Children as it, useSyncExternalStore as re, memo as se, Fragment as at, Component as vt, useId as wt, useImperativeHandle as xt, useReducer as Ot } from "react";
4
+ import { flushSync as St, createPortal as Et } from "react-dom";
5
+ import './index.css';const Y = we(null), ce = we(null), de = we(null), kt = (e, t) => {
6
+ const n = typeof t == "function" ? t(e) : t;
7
+ return n === e ? e : Object.keys(n).some((s) => !Object.is(n[s], e[s])) ? { ...e, ...n } : e;
8
+ }, Me = (e) => {
9
+ let t = e;
10
+ const n = /* @__PURE__ */ new Set();
11
+ return {
12
+ get: () => t,
13
+ set: (r) => {
14
+ Object.keys(r).every((s) => Object.is(r[s], t[s])) || (t = { ...t, ...r }, n.forEach((s) => s()));
15
+ },
16
+ subscribe: (r) => (n.add(r), () => n.delete(r))
17
+ };
18
+ }, Re = (e) => {
19
+ const t = F(e);
20
+ yt(() => {
21
+ t.current = e;
22
+ });
23
+ const [n] = U(() => Object.fromEntries(
24
+ Object.keys(e).map((r) => [r, (...s) => t.current[r](...s)])
25
+ ));
26
+ return n;
27
+ }, lt = (e, t) => {
28
+ const [n, r] = U(e);
29
+ return n === e || t(n, e) ? n : (r(e), e);
30
+ }, Ct = (e, t) => e === t || !!e && !!t && Object.keys(e).length === Object.keys(t).length && Object.keys(e).every((n) => Object.is(e[n], t[n])), Ie = (e, t, n = 0) => {
31
+ if (Object.is(e, t)) return !0;
32
+ if (n > 12 || typeof e != "object" || typeof t != "object" || e === null || t === null || Array.isArray(e) !== Array.isArray(t)) return !1;
33
+ if (e.$$typeof || t.$$typeof) return e.$$typeof === t.$$typeof && e.type === t.type && e.key === t.key && Ie(e.props, t.props, n + 1);
34
+ const r = Object.keys(e);
35
+ return r.length === Object.keys(t).length && r.every((s) => Object.hasOwn(t, s) && Ie(e[s], t[s], n + 1));
36
+ }, Tt = /* @__PURE__ */ new Set(["style", "texts", "icons", "attrs"]), Mt = (e, t) => {
37
+ const n = Object.keys(t);
38
+ return n.length === Object.keys(e).length && n.every(
39
+ (r) => Tt.has(r) ? Ct(e[r], t[r]) : Object.is(e[r], t[r])
40
+ );
41
+ }, It = (e) => lt(e, Mt), Ne = (e) => lt(e, Ie), he = {
42
+ XMark: ({ className: e = "", ...t }) => /* @__PURE__ */ O(
43
+ "svg",
44
+ {
45
+ className: e,
46
+ viewBox: "0 0 320 512",
47
+ fill: "currentColor",
48
+ "aria-hidden": "true",
49
+ height: "1em",
50
+ width: "1em",
51
+ ...t,
52
+ children: /* @__PURE__ */ O("path", { d: "M310.6 361.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L160 301.3 54.6 406.6c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L114.7 256 9.4 150.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 210.7 265.4 105.4c12.5-12.5 32.8-12.5 45.3 0s12.5 32.8 0 45.3L205.3 256l105.3 105.4z" })
93
53
  }
94
- function l(r) {
95
- if (r === D) return "<>";
96
- if (typeof r == "object" && r !== null && r.$$typeof === z)
97
- return "<...>";
98
- try {
99
- var b = e(r);
100
- return b ? "<" + b + ">" : "<...>";
101
- } catch {
102
- return "<...>";
103
- }
54
+ ),
55
+ ArrowUp: ({ className: e = "", ...t }) => /* @__PURE__ */ O(
56
+ "svg",
57
+ {
58
+ className: e,
59
+ viewBox: "0 0 448 512",
60
+ fill: "currentColor",
61
+ "aria-hidden": "true",
62
+ height: "1em",
63
+ width: "1em",
64
+ ...t,
65
+ children: /* @__PURE__ */ O("path", { d: "M34.9 289.5l175.9-175.8c9.4-9.4 24.6-9.4 33.9 0L420.1 289.5c15.1 15.1 4.4 41-17 41H51.9c-21.4 0-32.1-25.9-17-41z" })
104
66
  }
105
- function s() {
106
- var r = L.A;
107
- return r === null ? null : r.getOwner();
67
+ ),
68
+ Checkmark: ({ className: e = "", ...t }) => /* @__PURE__ */ O(
69
+ "svg",
70
+ {
71
+ className: e,
72
+ viewBox: "0 0 24 24",
73
+ fill: "currentColor",
74
+ "aria-hidden": "true",
75
+ height: "1em",
76
+ width: "1em",
77
+ ...t,
78
+ children: /* @__PURE__ */ O("path", { d: "M20.285 6.708a1 1 0 0 0-1.414-1.416l-9.192 9.192-4.243-4.244a1 1 0 1 0-1.414 1.416l5 5a1 1 0 0 0 1.414 0l9.849-9.948z" })
108
79
  }
109
- function p() {
110
- return Error("react-stack-top-frame");
80
+ )
81
+ }, ae = (e, t) => {
82
+ if (!e) return null;
83
+ const n = (r = {}) => ({
84
+ ...t,
85
+ ...r,
86
+ style: {
87
+ ...t?.style,
88
+ ...r?.style
111
89
  }
112
- function c(r) {
113
- if (B.call(r, "key")) {
114
- var b = Object.getOwnPropertyDescriptor(r, "key").get;
115
- if (b && b.isReactWarning) return !1;
90
+ });
91
+ return typeof e == "string" ? /* @__PURE__ */ O("img", { src: e, ...n(), className: ue("rac-icon", t?.className), alt: "" }) : xe(e) ? bt(e, n(e.props)) : typeof e == "function" || typeof e == "object" && e.$$typeof ? /* @__PURE__ */ O(e, { ...n() }) : null;
92
+ }, Oe = (e, t) => `${e}-${String(t).replace(/[^A-Za-z0-9-]/gu, (n) => `_${n.codePointAt(0).toString(36)}_`)}`, X = (e) => e ? "" : void 0, ue = (e, t) => t ? `${e} ${t}` : e, Ve = (e, t, n) => e.jsx || (t && "original" in e ? t(e.original, { selected: n, disabled: !!e.disabled }) : null), Be = /* @__PURE__ */ q("span", { className: "rac-dots", "aria-hidden": "true", children: [
93
+ /* @__PURE__ */ O("i", {}),
94
+ /* @__PURE__ */ O("i", {}),
95
+ /* @__PURE__ */ O("i", {})
96
+ ] }), Nt = (() => {
97
+ try {
98
+ return process.env.NODE_ENV !== "production";
99
+ } catch {
100
+ return !1;
101
+ }
102
+ })(), ze = /* @__PURE__ */ new Set(), le = (e, t) => {
103
+ !Nt || ze.has(e) || (ze.add(e), console.warn(`[react-animated-select] ${t}`));
104
+ }, Q = (e) => {
105
+ e?.stopPropagation(), e?.preventDefault();
106
+ }, At = { index: -1, fallback: -1, ready: !1 }, ye = ({ index: e, fallback: t }) => e === -1 ? t : e, $t = 10, Lt = 500, Dt = /* @__PURE__ */ new Set(["ArrowDown", "ArrowUp", "PageDown", "PageUp", "Home", "End"]), jt = (e, t) => _(() => {
107
+ const n = new Set(e.map((s) => s.group).filter(Boolean)), r = (s) => !!s && !s.disabled && !s.loading && (s.groupHeader ? n.has(s.name) : !s.group || t.has(s.group));
108
+ return { reach: r, list: e.flatMap((s, c) => r(s) ? [c] : []) };
109
+ }, [e, t]), Pt = (e, t, n, r) => {
110
+ const s = e.length - 1;
111
+ if (s < 0) return -1;
112
+ if (n === "Home") return e[0];
113
+ if (n === "End") return e[s];
114
+ const c = n === "ArrowUp" || n === "PageUp" ? -1 : 1, i = e.indexOf(t);
115
+ if (i === -1) return e[c > 0 ? 0 : s];
116
+ const a = i + c * (n.startsWith("Page") ? $t : 1);
117
+ return a >= 0 && a <= s ? e[a] : n.startsWith("Page") || r ? e[a < 0 ? 0 : s] : e[(a + e.length) % e.length];
118
+ }, Rt = (e, t, n, r) => {
119
+ const s = [...r].every((o) => o === r[0]), c = s ? r[0] : r, i = t.filter((o) => "original" in e[o]), a = Math.max(i.indexOf(n) + (s ? 1 : 0), 0);
120
+ for (let o = 0; o < i.length; o++) {
121
+ const p = i[(a + o) % i.length];
122
+ if (String(e[p].name).toLowerCase().startsWith(c)) return p;
123
+ }
124
+ return -1;
125
+ };
126
+ function Vt({ props: e, state: t, setState: n, normalizedOptions: r, expandedGroups: s, selected: c, selectedIDs: i, visibility: a, setVisibility: o, modelActions: p, loadMoreOnce: l, highlightStore: g }) {
127
+ const { disabled: y, multiple: h, hasMore: S, loadButton: w, loadOffset: f, loadAhead: m, icons: D, onFocus: L, onBlur: C } = e, { selectOption: j, clear: M, removeOption: u } = p, { deleting: x } = t, { reach: E, list: $ } = jt(r, s), k = F({ lastWindowFocusTime: 0, justFocused: !1, focusTimeout: null, query: "", queryTimeout: null }), V = _(() => {
128
+ const d = new Set(h ? i.map((T) => T.id) : c ? [c.id] : []), v = d.size ? r.findIndex((T) => d.has(T.id) && E(T)) : -1;
129
+ return v !== -1 ? v : $.find((T) => !r[T].groupHeader) ?? $[0] ?? -1;
130
+ }, [r, c, i, h, E, $]), I = (d) => {
131
+ !w && a && S && d >= r.length - m && l();
132
+ };
133
+ ne(() => {
134
+ const { index: d } = g.get();
135
+ g.set({ fallback: V, index: d !== -1 && E(r[d]) ? d : -1 }), I(ye(g.get()));
136
+ }), oe(() => {
137
+ const d = k.current, v = () => d.lastWindowFocusTime = Date.now();
138
+ return window.addEventListener("focus", v), () => {
139
+ window.removeEventListener("focus", v), clearTimeout(d.focusTimeout), clearTimeout(d.queryTimeout);
140
+ };
141
+ }, []);
142
+ const A = (d) => {
143
+ g.set({ index: d }), I(d);
144
+ }, b = (d, v) => {
145
+ const T = k.current;
146
+ clearTimeout(T.queryTimeout), T.queryTimeout = setTimeout(() => T.query = "", Lt), T.query += d.toLowerCase();
147
+ const H = Rt(r, $, v, T.query);
148
+ H !== -1 && A(H), a || o(!0);
149
+ };
150
+ return Re({
151
+ highlight: A,
152
+ handleListScroll: (d) => {
153
+ if (w) return;
154
+ const { scrollTop: v, scrollHeight: T, clientHeight: H } = d.currentTarget;
155
+ T - v <= H + f && l();
156
+ },
157
+ handleBlur: (d) => {
158
+ const v = d.relatedTarget?.closest(".rac-options");
159
+ d.currentTarget.contains(d.relatedTarget) || v || (C?.(d), x && n({ deleting: !1 }), a && o(!1));
160
+ },
161
+ // [DOC: select-behavior]
162
+ handleFocus: (d) => {
163
+ d.currentTarget.contains(d.relatedTarget) || L?.(d), !(y || x || document.hidden || Date.now() - k.current.lastWindowFocusTime < 100) && (a || (clearTimeout(k.current.focusTimeout), k.current.focusTimeout = setTimeout(() => k.current.justFocused = !1, 200), k.current.justFocused = !0, o(!0)));
164
+ },
165
+ toggleVisibility: (d) => {
166
+ if (x) {
167
+ Q(d), n({ deleting: !1 });
168
+ return;
116
169
  }
117
- return r.key !== void 0;
118
- }
119
- function j(r, b) {
120
- function A() {
121
- P || (P = !0, console.error(
122
- "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
123
- b
124
- ));
170
+ y || k.current.justFocused || o(!a);
171
+ },
172
+ handleKeyDown: (d) => {
173
+ if (y || d.nativeEvent?.isComposing) return;
174
+ const { key: v } = d, T = ye(g.get());
175
+ if (v.length === 1 && !d.ctrlKey && !d.metaKey && !d.altKey && (v !== " " || k.current.query)) {
176
+ d.preventDefault(), b(v, T);
177
+ return;
125
178
  }
126
- A.isReactWarning = !0, Object.defineProperty(r, "key", {
127
- get: A,
128
- configurable: !0
129
- });
130
- }
131
- function T() {
132
- var r = e(this.type);
133
- return Y[r] || (Y[r] = !0, console.error(
134
- "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
135
- )), r = this.props.ref, r !== void 0 ? r : null;
136
- }
137
- function v(r, b, A, G, Q, i) {
138
- var g = A.ref;
139
- return r = {
140
- $$typeof: R,
141
- type: r,
142
- key: b,
143
- props: A,
144
- _owner: G
145
- }, (g !== void 0 ? g : null) !== null ? Object.defineProperty(r, "ref", {
146
- enumerable: !1,
147
- get: T
148
- }) : Object.defineProperty(r, "ref", { enumerable: !1, value: null }), r._store = {}, Object.defineProperty(r._store, "validated", {
149
- configurable: !1,
150
- enumerable: !1,
151
- writable: !0,
152
- value: 0
153
- }), Object.defineProperty(r, "_debugInfo", {
154
- configurable: !1,
155
- enumerable: !1,
156
- writable: !0,
157
- value: null
158
- }), Object.defineProperty(r, "_debugStack", {
159
- configurable: !1,
160
- enumerable: !1,
161
- writable: !0,
162
- value: Q
163
- }), Object.defineProperty(r, "_debugTask", {
164
- configurable: !1,
165
- enumerable: !1,
166
- writable: !0,
167
- value: i
168
- }), Object.freeze && (Object.freeze(r.props), Object.freeze(r)), r;
169
- }
170
- function o(r, b, A, G, Q, i) {
171
- var g = b.children;
172
- if (g !== void 0)
173
- if (G)
174
- if (V(g)) {
175
- for (G = 0; G < g.length; G++)
176
- S(g[G]);
177
- Object.freeze && Object.freeze(g);
178
- } else
179
- console.error(
180
- "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
181
- );
182
- else S(g);
183
- if (B.call(b, "key")) {
184
- g = e(r);
185
- var y = Object.keys(b).filter(function(k) {
186
- return k !== "key";
187
- });
188
- G = 0 < y.length ? "{key: someKey, " + y.join(": ..., ") + ": ...}" : "{key: someKey}", _[g + G] || (y = 0 < y.length ? "{" + y.join(": ..., ") + ": ...}" : "{}", console.error(
189
- `A props object containing a "key" prop is being spread into JSX:
190
- let props = %s;
191
- <%s {...props} />
192
- React keys must be passed directly to JSX without using spread:
193
- let props = %s;
194
- <%s key={someKey} {...props} />`,
195
- G,
196
- g,
197
- y,
198
- g
199
- ), _[g + G] = !0);
179
+ if (Dt.has(v)) {
180
+ d.preventDefault(), (a || v === "Home" || v === "End") && A(Pt($, T, v, !w && S)), a || o(!0);
181
+ return;
200
182
  }
201
- if (g = null, A !== void 0 && (n(A), g = "" + A), c(b) && (n(b.key), g = "" + b.key), "key" in b) {
202
- A = {};
203
- for (var E in b)
204
- E !== "key" && (A[E] = b[E]);
205
- } else A = b;
206
- return g && j(
207
- A,
208
- typeof r == "function" ? r.displayName || r.name || "Unknown" : r
209
- ), v(
210
- r,
211
- g,
212
- A,
213
- s(),
214
- Q,
215
- i
216
- );
217
- }
218
- function S(r) {
219
- f(r) ? r._store && (r._store.validated = 1) : typeof r == "object" && r !== null && r.$$typeof === z && (r._payload.status === "fulfilled" ? f(r._payload.value) && r._payload.value._store && (r._payload.value._store.validated = 1) : r._store && (r._store.validated = 1));
220
- }
221
- function f(r) {
222
- return typeof r == "object" && r !== null && r.$$typeof === R;
223
- }
224
- var O = Be, R = /* @__PURE__ */ Symbol.for("react.transitional.element"), $ = /* @__PURE__ */ Symbol.for("react.portal"), D = /* @__PURE__ */ Symbol.for("react.fragment"), X = /* @__PURE__ */ Symbol.for("react.strict_mode"), J = /* @__PURE__ */ Symbol.for("react.profiler"), M = /* @__PURE__ */ Symbol.for("react.consumer"), Z = /* @__PURE__ */ Symbol.for("react.context"), m = /* @__PURE__ */ Symbol.for("react.forward_ref"), U = /* @__PURE__ */ Symbol.for("react.suspense"), a = /* @__PURE__ */ Symbol.for("react.suspense_list"), w = /* @__PURE__ */ Symbol.for("react.memo"), z = /* @__PURE__ */ Symbol.for("react.lazy"), I = /* @__PURE__ */ Symbol.for("react.activity"), K = /* @__PURE__ */ Symbol.for("react.client.reference"), L = O.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, B = Object.prototype.hasOwnProperty, V = Array.isArray, x = console.createTask ? console.createTask : function() {
225
- return null;
226
- };
227
- O = {
228
- react_stack_bottom_frame: function(r) {
229
- return r();
183
+ switch (v) {
184
+ case "Enter":
185
+ case " ":
186
+ d.preventDefault(), a ? T !== -1 && r[T] && (A(T), j(r[T], d)) : o(!0);
187
+ break;
188
+ // [DOC: select-behavior]
189
+ case "Escape":
190
+ if (x) n({ deleting: !1 });
191
+ else if (a) o(!1);
192
+ else break;
193
+ Q(d);
194
+ break;
195
+ case "Tab":
196
+ a && o(!1);
197
+ break;
198
+ // [DOC: select-behavior]
199
+ case "Backspace":
200
+ case "Delete": {
201
+ const H = i.at(-1);
202
+ if (h && v === "Backspace" && D.remove && H) u(H.id);
203
+ else if (D.clear && (c || H)) M();
204
+ else break;
205
+ d.preventDefault();
206
+ break;
207
+ }
230
208
  }
231
- };
232
- var P, Y = {}, W = O.react_stack_bottom_frame.bind(
233
- O,
234
- p
235
- )(), u = x(l(p)), _ = {};
236
- ve.Fragment = D, ve.jsx = function(r, b, A) {
237
- var G = 1e4 > L.recentlyCreatedOwnerStacks++;
238
- return o(
239
- r,
240
- b,
241
- A,
242
- !1,
243
- G ? Error("react-stack-top-frame") : W,
244
- G ? x(l(r)) : u
245
- );
246
- }, ve.jsxs = function(r, b, A) {
247
- var G = 1e4 > L.recentlyCreatedOwnerStacks++;
248
- return o(
249
- r,
250
- b,
251
- A,
252
- !0,
253
- G ? Error("react-stack-top-frame") : W,
254
- G ? x(l(r)) : u
255
- );
256
- };
257
- })()), ve;
258
- }
259
- var Fe;
260
- function ot() {
261
- return Fe || (Fe = 1, process.env.NODE_ENV === "production" ? je.exports = st() : je.exports = it()), je.exports;
209
+ }
210
+ });
262
211
  }
263
- var d = ot();
264
- const We = ({ className: e = "", ...t }) => /* @__PURE__ */ d.jsx(
265
- "svg",
266
- {
267
- xmlns: "http://w3.org/2000/svg",
268
- "aria-label": "Clear selection",
269
- className: e,
270
- viewBox: "0 0 320 512",
271
- fill: "currentColor",
272
- role: "button",
273
- height: "1em",
274
- width: "1em",
275
- ...t,
276
- children: /* @__PURE__ */ d.jsx("path", { d: "M310.6 361.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L160 301.3 54.6 406.6c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L114.7 256 9.4 150.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 210.7 265.4 105.4c12.5-12.5 32.8-12.5 45.3 0s12.5 32.8 0 45.3L205.3 256l105.3 105.4z" })
277
- }
278
- ), lt = ({ className: e = "", ...t }) => /* @__PURE__ */ d.jsx(
279
- "svg",
280
- {
281
- xmlns: "http://w3.org/2000/svg",
282
- className: e,
283
- viewBox: "0 0 448 512",
284
- fill: "currentColor",
285
- height: "1em",
286
- width: "1em",
287
- ...t,
288
- children: /* @__PURE__ */ d.jsx("path", { d: "M34.9 289.5l175.9-175.8c9.4-9.4 24.6-9.4 33.9 0L420.1 289.5c15.1 15.1 4.4 41-17 41H51.9c-21.4 0-32.1-25.9-17-41z" })
289
- }
290
- ), at = ({ className: e = "", ...t }) => /* @__PURE__ */ d.jsx(
291
- "svg",
292
- {
293
- xmlns: "http://w3.org/2000/svg",
294
- className: e,
295
- viewBox: "0 0 24 24",
296
- fill: "currentColor",
297
- height: "1em",
298
- width: "1em",
299
- ...t,
300
- children: /* @__PURE__ */ d.jsx("path", { d: "M20.285 6.708a1 1 0 0 0-1.414-1.416l-9.192 9.192-4.243-4.244a1 1 0 1 0-1.414 1.416l5 5a1 1 0 0 0 1.414 0l9.849-9.948z" })
212
+ const Bt = ["group", "disabled", "options", "items", "children"], He = ["name", "label", "id", "value"], ge = (e) => e != null && e !== "", ct = (e) => e !== null && typeof e == "object" && !Array.isArray(e), Se = (e) => ct(e) && [Object.prototype, null].includes(Object.getPrototypeOf(e)), Ht = (e) => {
213
+ try {
214
+ const t = String(e);
215
+ return t.startsWith("[object ") ? null : t;
216
+ } catch {
217
+ return null;
301
218
  }
302
- ), ct = (e) => ({
303
- loadingTitle: e.loadButton ? e.loadButtonText : e.loadMoreText,
304
- internalVisibility: !1,
305
- animationFinished: !1,
306
- deleting: !1,
307
- jsxOptions: []
308
- }), ut = (e, t) => {
309
- if (t.type === "SET") {
310
- const n = t.payload;
219
+ }, Fe = (e, t = !1) => {
220
+ if (t && typeof e.group == "string") return e.group;
221
+ const n = He.find((c) => ge(e[c]));
222
+ if (n) return String(e[n]);
223
+ const r = !Se(e) && Ht(e);
224
+ if (r) return r;
225
+ const s = Object.entries(e).find(([c, i]) => !Bt.includes(c) && ge(i));
226
+ return s ? String(s[1]) : null;
227
+ }, Ft = (e) => Se(e) && ("options" in e || "group" in e && !He.some((t) => t in e)), Ke = (e, t, n, r, s, { emptyOption: c, invalidOption: i, disabledOption: a }) => {
228
+ const o = `${n}-${t}`;
229
+ if (e == null || e === "")
230
+ return { id: o, userId: null, name: c, raw: e, disabled: !0, type: "normal", group: r, groupDisabled: s };
231
+ if (typeof e == "function")
232
+ return { id: o, userId: null, name: i, raw: e, disabled: !0, invalid: !0, type: "normal", group: r };
233
+ if (ct(e)) {
234
+ const p = s || e.disabled === !0, l = e.value !== void 0 ? e.value : e.id !== void 0 ? e.id : e, g = Fe(e) || (p ? a : c);
311
235
  return {
312
- ...e,
313
- ...typeof n == "function" ? n(e) : n
236
+ id: o,
237
+ userId: e.id ?? e.value ?? e.name ?? e.label,
238
+ name: g,
239
+ raw: l,
240
+ original: e,
241
+ disabled: p || g === c,
242
+ type: typeof l == "boolean" ? "boolean" : "normal",
243
+ group: r || e.group || null,
244
+ groupDisabled: s
314
245
  };
315
246
  }
316
- return e;
317
- }, he = (e, t) => {
318
- if (!e) return null;
319
- const n = (l = {}) => ({
320
- ...t,
321
- ...l,
322
- style: {
323
- ...t?.style,
324
- ...l?.style
247
+ return { id: o, userId: e, name: String(e), raw: e, original: e, disabled: s, type: typeof e == "boolean" ? "boolean" : "normal", group: r };
248
+ }, Gt = ({
249
+ options: e,
250
+ jsxOptions: t,
251
+ childrenFirst: n,
252
+ hasMore: r,
253
+ loadButton: s,
254
+ loadPending: c,
255
+ loadingTitle: i,
256
+ emptyOption: a,
257
+ invalidOption: o,
258
+ disabledOption: p,
259
+ emptyGroup: l
260
+ }) => {
261
+ const g = { emptyOption: a, invalidOption: o, disabledOption: p }, y = /* @__PURE__ */ new Map(), h = [], S = /* @__PURE__ */ new Set(), w = (u) => {
262
+ let x = u;
263
+ for (let E = 1; S.has(x); E++) x = `${u}~${E}`;
264
+ return S.add(x), x;
265
+ }, f = t.map((u, x) => {
266
+ if (u.isGroupMarker) return { ...u, type: "group-marker" };
267
+ const E = !u.label && !ge(u.userId) && !ge(u.value) && !u.hasJsx;
268
+ return {
269
+ ...u,
270
+ id: w(`jsx-${u.id}`),
271
+ index: x,
272
+ userId: u.userId,
273
+ raw: u.value,
274
+ original: u.value,
275
+ name: u.label || (ge(u.value) ? String(u.value) : a),
276
+ disabled: !!u.disabled || E,
277
+ type: typeof u.value == "boolean" ? "boolean" : "normal",
278
+ group: u.group || null
279
+ };
280
+ });
281
+ let m = 0;
282
+ const D = (u, x = null, E = !1, $ = "0") => {
283
+ Array.isArray(u) || (u = [u]), u.forEach((k, V) => {
284
+ const I = `${$}-${V}`;
285
+ if (Ft(k)) {
286
+ const A = Fe(k, !0) || l;
287
+ y.has(A) || y.set(A, { disabled: !!k.disabled, items: [] }), k.options ? D(k.options, A, E || !!k.disabled, I) : h.push({ id: `empty-${A}-${I}`, name: A, group: A, isPlaceholder: !0, type: "group-marker", index: m++ });
288
+ } else Se(k) && !He.some((A) => A in k) && !k.group ? Object.values(k).forEach((A, b) => h.push({ ...Ke(A, `${I}-${b}`, "default", x, E, g), index: m++ })) : h.push({ ...Ke(k, I, "default", x, E, g), index: m++ });
289
+ });
290
+ };
291
+ D(e);
292
+ const L = n ? [...f, ...h] : [...h, ...f], C = [], j = /* @__PURE__ */ new Set();
293
+ L.forEach((u) => {
294
+ if (!u.group) {
295
+ C.push({ type: "item", data: u });
296
+ return;
325
297
  }
298
+ j.has(u.group) || (j.add(u.group), C.push({ type: "group", name: u.group })), y.has(u.group) || y.set(u.group, { items: [] });
299
+ const x = y.get(u.group);
300
+ u.isGroupMarker ? (x.className = u.className, x.style = u.style, u.disabled && (x.disabled = !0)) : u.isPlaceholder || x.items.push(u);
326
301
  });
327
- if (typeof e == "string") return /* @__PURE__ */ d.jsx("img", { src: e, ...n(), alt: "" });
328
- if (tt(e)) return rt(e, n(e.props));
329
- if (typeof e == "function" || typeof e == "object" && e.$$typeof) {
330
- const l = e;
331
- return /* @__PURE__ */ d.jsx(l, { ...n() });
332
- }
333
- return null;
334
- }, dt = (e, t, n, l, s, p, c, j) => {
335
- const T = j?.some((v) => v.id === e.id);
336
- return e.groupHeader ? "rac-select-option rac-group-option" : [
337
- "rac-select-option",
338
- e.className,
339
- (T || l === e.id) && "rac-selected",
340
- t === n && "rac-highlighted",
341
- (e.disabled || e.loading) && "rac-disabled-option",
342
- (e.invalid || e.name === c) && "rac-invalid-option",
343
- e.loadMore && s === p && "rac-loading-option",
344
- typeof e.raw == "boolean" && (e.raw ? "rac-true-option" : "rac-false-option")
345
- ].filter(Boolean).join(" ");
346
- }, Ae = Ye(null), Ne = (e) => {
347
- const t = window.getComputedStyle(e);
348
- return parseFloat(t.marginLeft) + parseFloat(t.marginRight);
349
- }, Me = (e) => e.reduce((t, n) => {
350
- const l = n.getBoundingClientRect(), s = l.top, p = l.width;
351
- return t[s] = (t[s] || 0) + p, t;
352
- }, {}), ft = {
353
- bottomDirection: !1,
354
- selectHeight: null,
355
- spacer: {
356
- state: !1,
357
- id: null,
358
- width: 0
359
- },
360
- activeHoverId: null,
361
- hoverRowTop: null,
362
- spacerWidths: {},
363
- entering: !1,
364
- swipedId: null,
365
- leaving: !1,
366
- rowEndIds: [],
367
- delWidth: 0
368
- };
369
- function gt(e, t) {
370
- switch (t.type) {
371
- case "SET":
372
- return { ...e, ...t.payload };
373
- case "SET_SPACER_WIDTH":
374
- return { ...e, spacerWidths: { ...e.spacerWidths, [t.id]: t.width } };
375
- default:
376
- return e;
377
- }
378
- }
379
- const pt = (e) => {
380
- const { selectedIDs: t, deleting: n, setDeleting: l, toggleVisibility: s, visibility: p, removeOption: c, setselectedIDs: j, selectRef: T, deleteInline: v } = e, [o, S] = Ge(gt, ft), { spacerWidths: f, spacer: O, delWidth: R } = o, $ = C((a) => S({ type: "SET", payload: a }), []), D = ie(t?.length || 0), X = ie(!0), J = ie(null), M = ie(null), Z = C((a) => {
381
- c ? c(a) : j((w) => w.filter((z) => z.id !== a));
382
- }, [c, j]), m = C((a) => {
383
- if (n) {
384
- a.stopPropagation(), a.preventDefault(), l(!1);
302
+ const M = [];
303
+ return C.forEach((u) => {
304
+ if (u.type === "item") {
305
+ M.push(u.data);
385
306
  return;
386
307
  }
387
- s(a);
388
- }, [n, s]), U = C((a, w) => {
389
- f[a] !== w && S({ type: "SET_SPACER_WIDTH", id: a, width: w });
390
- }, [f]);
391
- return xe(() => {
392
- const a = J.current;
393
- if (!a) return;
394
- const w = () => {
395
- $({ selectHeight: a.offsetHeight });
396
- const I = Array.from(a.children).filter((B) => B.classList.contains("rac-multiple-option"));
397
- if (!I.length) {
398
- $({ rowEndIds: [] });
399
- return;
400
- }
401
- const K = new Set(t.map((B) => B.id)), L = {};
402
- I.forEach((B) => {
403
- K.has(B.id) && (L[B.offsetTop] = B.id);
404
- }), $({ rowEndIds: Object.values(L) });
405
- };
406
- w();
407
- const z = new ResizeObserver(() => w());
408
- return z.observe(a), () => z.disconnect();
409
- }, [t]), ne(() => {
410
- X.current = !1, T && (typeof T == "function" ? T(T.current) : T.current = T.current);
411
- }, [T]), ne(() => {
412
- n && p && s() && s?.()(n && t?.length === 0) && l(!1), $({ activeHoverId: null });
413
- }, [t?.length, n]), xe(() => {
414
- const a = J.current, w = t?.length || 0, z = t[w - 1]?.id;
415
- if (!a || !t?.length || n) {
416
- t?.length || $({ spacer: { state: !1, id: null, width: 0 }, entering: null });
308
+ const x = y.get(u.name);
309
+ M.push({
310
+ className: x?.className || "",
311
+ id: `group-header-${u.name}`,
312
+ disabled: !!x?.disabled,
313
+ style: x?.style || {},
314
+ groupHeader: !0,
315
+ name: u.name,
316
+ type: "group"
317
+ }), x?.items.forEach((E) => M.push(E));
318
+ }), r && s && M.push({ id: "special-load-more-id", name: i, loadMore: !0, loading: c, type: "special" }), M;
319
+ }, Rn = (e) => {
320
+ const t = () => null;
321
+ return t.racKind = "define", t.racRender = e, t.displayName = `defineOption(${e.name || "anonymous"})`, t;
322
+ }, qe = { selected: null, selectedIDs: [] }, fe = (e) => {
323
+ try {
324
+ return JSON.stringify(e);
325
+ } catch {
326
+ return;
327
+ }
328
+ }, dt = (e, t) => e === t || e !== e && t !== t, be = (e) => typeof e == "object" && e !== null, Wt = (e, t) => dt(e, t) || be(e) && be(t) && fe(e) !== void 0 && fe(e) === fe(t), zt = (e, t, n, r) => {
329
+ if (e == null || Array.isArray(e) && e.length === 0) return qe;
330
+ const s = r.length ? new Map(t.map((l) => [l.id, l])) : null, c = s ? [...r.map((l) => s.get(l)).filter(Boolean), ...t] : t, i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map(), o = (l) => "original" in l && !i.has(l.id), p = (l) => {
331
+ const g = be(l);
332
+ let y = c.find((m) => o(m) && dt(m.original, l));
333
+ const h = g ? fe(l) : void 0;
334
+ if (!y && h !== void 0 && (y = c.find((m) => o(m) && be(m.original) && fe(m.original) === h)), y)
335
+ return i.add(y.id), y;
336
+ const S = String(g ? l.id || l.value || h || "object" : l), w = (a.get(S) ?? -1) + 1;
337
+ a.set(S, w);
338
+ const f = `virtual-${S}-${w}`;
339
+ return g ? { id: f, name: Fe(l) || String(l.id || "Selected Object"), raw: l.value ?? l.id ?? l, original: l, userId: l.id ?? l.value ?? null, virtual: !0 } : { id: f, name: String(l), raw: l, original: l, userId: l, virtual: !0 };
340
+ };
341
+ return n ? { selected: null, selectedIDs: (Array.isArray(e) ? e : [e]).map(p) } : { selected: p(Array.isArray(e) ? e[0] : e), selectedIDs: qe.selectedIDs };
342
+ }, _e = {
343
+ x: ["width", "marginLeft", "marginRight", "paddingLeft", "paddingRight", "borderLeftWidth", "borderRightWidth"],
344
+ y: ["height", "marginTop", "marginBottom", "paddingTop", "paddingBottom", "borderTopWidth", "borderBottomWidth"]
345
+ }, Kt = { x: { minWidth: "0px", maxWidth: "none" }, y: { minHeight: "0px", maxHeight: "none" } }, ut = we(null);
346
+ let Ae = null;
347
+ const qt = () => Ae ??= (queueMicrotask(() => {
348
+ Ae = null;
349
+ }), {});
350
+ function ie({
351
+ as: e = "div",
352
+ axis: t = "y",
353
+ fade: n = !1,
354
+ in: r,
355
+ unmountOnExit: s = !0,
356
+ easing: c,
357
+ duration: i,
358
+ group: a,
359
+ nodeRef: o,
360
+ onEntered: p,
361
+ onExited: l,
362
+ ...g
363
+ }) {
364
+ const y = B(Y), h = B(ut), S = r === void 0 && !!h, w = S ? h.present : !!r, f = i ?? y?.duration ?? 300, m = c ?? y?.easing ?? "ease", D = F(null), L = o ?? D, C = F(null), j = F(!1), M = F({ restart: () => {
365
+ } }), [u] = U(() => S && h.appear ? !w : w), x = F(u), [E, $] = U(!w);
366
+ w && E && $(!1);
367
+ const k = ot(() => {
368
+ if (a?.delete(M.current), w) {
369
+ C.current = null, p?.();
417
370
  return;
418
371
  }
419
- const I = Array.from(a.children).filter((V) => V.classList.contains("rac-multiple-option")), K = w !== D.current || I.length !== w || z && f[z] && !D.currentWidths?.[z];
420
- if (!a || !w || n || !K) {
421
- !w && K && $({ spacer: { state: !1, id: null, width: 0 }, entering: null }), D.current = w, D.currentWidths = f;
372
+ l?.(), S && h.onExited(), s && (C.current = null, $(!0));
373
+ });
374
+ return ne(() => {
375
+ const I = L.current;
376
+ if (!I) return;
377
+ const A = n ? [..._e[t], "opacity"] : _e[t], b = { overflow: "hidden", textOverflow: "clip", ...Kt[t] }, d = { ...Object.fromEntries(A.map((P) => [P, P === "opacity" ? 0 : "0px"])), ...b }, v = () => {
378
+ const P = getComputedStyle(I);
379
+ return { ...Object.fromEntries(A.map((G) => [G, P[G]])), ...b };
380
+ }, T = (P, G) => {
381
+ const ee = window.matchMedia?.("(prefers-reduced-motion: reduce)").matches, z = C.current = I.animate([P, G], { duration: ee ? 0 : f, easing: m, fill: x.current ? "backwards" : "both" });
382
+ if (z.onfinish = () => {
383
+ C.current === z && j.current && k();
384
+ }, M.current.frames = [P, G], !a) return;
385
+ const R = z.timeline?.currentTime;
386
+ R != null && (z.startTime = R, z.currentTime = 0), M.current.batch = qt(), a.add(M.current);
387
+ }, H = () => {
388
+ const [P, G] = M.current.frames, ee = C.current.effect.getComputedTiming().progress ?? 0, z = (R) => parseFloat(P[R]) + (parseFloat(G[R]) - parseFloat(P[R])) * ee;
389
+ return { ...Object.fromEntries(A.map((R) => [R, R === "opacity" ? z(R) : `${z(R)}px`])), ...b };
390
+ };
391
+ if (M.current.restart = (P) => {
392
+ const G = C.current;
393
+ if (G?.playState !== "running" || !P && M.current.batch === Ae) return;
394
+ const ee = H();
395
+ G.cancel(), T(ee, x.current ? v() : d);
396
+ }, x.current === w) {
397
+ !w && !C.current && I.animate && (C.current = I.animate([d, d], { fill: "forwards" }));
422
398
  return;
423
399
  }
424
- D.current = w, D.currentWidths = f;
425
- const L = a.getBoundingClientRect().width;
426
- if (I.length > t.length) {
427
- const V = new Set(t.map((Q) => Q.id)), x = I.findIndex((Q) => !V.has(Q.id));
428
- if (x === -1) return;
429
- const P = I[x], Y = I[x - 1];
430
- if (!(Y && P.getBoundingClientRect().top !== Y.getBoundingClientRect().top)) {
431
- $({ spacer: { state: !1, id: null, width: 0 }, entering: null });
400
+ x.current = w;
401
+ const J = C.current;
402
+ if (J?.playState === "running") {
403
+ if (!a) {
404
+ J.reverse();
432
405
  return;
433
406
  }
434
- const u = Me(I), _ = Object.keys(u).map(Number).sort((Q, i) => Q - i), r = _.indexOf(P.getBoundingClientRect().top);
435
- if (r <= 0) {
436
- $({ spacer: { state: !1, id: null, width: 0 }, entering: null });
407
+ M.current.restart(!0);
408
+ } else {
409
+ if (J?.cancel(), !I.animate) {
410
+ k();
437
411
  return;
438
412
  }
439
- const b = _[r - 1], A = u[b], G = L - A;
440
- B(Y?.id || null, !0, G);
441
- } else if (I.length === t.length) {
442
- const V = I[I.length - 1], x = t[t.length - 1]?.id, P = f[x];
443
- if (!P) return;
444
- const Y = V?.firstElementChild || V, W = Ne(Y), u = Ne(V), _ = I.slice(0, -1), r = Me(_), b = Object.keys(r).map(Number).sort((i, g) => i - g);
445
- let A = L;
446
- if (b.length > 0) {
447
- const i = Math.max(...b);
448
- A = L - (r[i] || 0);
449
- }
450
- const G = P + W + u > A - R + 0.1, Q = t[t.length - 2]?.id;
451
- B(Q, G, A);
413
+ w ? T(d, v()) : T(v(), d);
452
414
  }
453
- function B(V, x, P) {
454
- O.id === V && O.state === x && O.width === P || $({ spacer: { state: x, id: V, width: P }, entering: x ? V : null });
455
- }
456
- }, [t, f, n]), xe(() => {
457
- if (M.current) {
458
- const a = M.current.getBoundingClientRect(), w = Ne(M.current.firstElementChild || M.current);
459
- $({ delWidth: a.width + w });
460
- }
461
- }, [M]), { state: o, setState: $, optionRef: J, firstMount: X, remove: Z, safeToggle: m, registerItemWidth: U, delIcon: M, delWidth: R };
462
- }, ye = Ve(({ className: e = "", visibility: t = void 0, setLeaving: n, setEntering: l, setSpacer: s, children: p, duration: c = 300, unmount: j, style: T, exit: v = !0, ...o }, S) => {
463
- const f = ie(null), O = t !== void 0 ? t : o.in;
464
- Je(S, () => f.current), ne(() => {
465
- !O && f.current && (f.current.style.width = "0px");
415
+ a?.forEach((P) => P !== M.current && P.restart());
416
+ }, [w, t, n, f, m, L, a]), ne(() => {
417
+ const I = M.current;
418
+ return j.current = !0, C.current?.playState === "running" && a?.add(I), () => {
419
+ j.current = !1, a?.delete(I);
420
+ };
421
+ }, [a]), E && s ? null : /* @__PURE__ */ O(e, { ref: L, ...g });
422
+ }
423
+ const _t = ({ id: e, present: t, appear: n, onExited: r, children: s }) => {
424
+ const c = _(() => ({ present: t, appear: n, onExited: () => r(e) }), [e, t, n, r]);
425
+ return /* @__PURE__ */ O(ut.Provider, { value: c, children: s });
426
+ }, Ue = (e, t, n = !0) => {
427
+ const r = it.toArray(t).filter(xe), s = new Set(r.map((o) => o.key)), c = new Map(e.map((o) => [o.key, o])), i = r.map((o) => ({ key: o.key, el: o, present: !0, appear: c.get(o.key)?.appear ?? n }));
428
+ let a = 0;
429
+ return e.forEach((o) => {
430
+ s.has(o.key) ? o.present && (a = i.findIndex((p) => p.key === o.key) + 1) : i.splice(a++, 0, o.present ? { ...o, present: !1 } : o);
431
+ }), { children: t, list: i };
432
+ };
433
+ function $e({ children: e, hold: t = !1 }) {
434
+ const [n, r] = U(() => ({ ...Ue([], e, !1), hold: t }));
435
+ let s = n;
436
+ s.children !== e && (s = { ...s, ...Ue(s.list, e) }), s.hold !== t && (s = { ...s, hold: t, list: t ? s.list : s.list.filter((i) => i.present) }), s !== n && r(s);
437
+ const c = K((i) => r(
438
+ (a) => !a.hold && a.list.some((o) => o.key === i && !o.present) ? { ...a, list: a.list.filter((o) => o.key !== i) } : a
439
+ ), []);
440
+ return n.list.map(
441
+ ({ key: i, el: a, present: o, appear: p }) => /* @__PURE__ */ O(_t, { id: i, present: o, appear: p, onExited: c, children: a }, i)
442
+ );
443
+ }
444
+ const ft = "rac-chip-slot", Le = "rac-flip", Ge = [], Ut = 0.25, Yt = { hoverId: null, swipedId: null, held: !1, breaks: Ge }, De = () => window.matchMedia?.("(prefers-reduced-motion: reduce)").matches, ve = (e) => Array.from(e.children).filter((t) => t.classList.contains(ft)), Ye = (e) => Array.from(e.children).some((t) => t.getAnimations?.().some((n) => n.constructor === Animation && n.id !== Le && n.playState === "running")), Jt = (e, t) => e.length === t.length && e.every((n, r) => n === t[r]), Xt = (e) => {
445
+ const t = [];
446
+ let n = -1 / 0;
447
+ for (const r of e) {
448
+ const s = r.getBoundingClientRect();
449
+ s.top >= n - 1 && (t.push([]), n = s.bottom), t.at(-1).push(r), n = Math.max(n, s.bottom);
450
+ }
451
+ return t;
452
+ }, gt = (e, t, n, r) => {
453
+ const s = e.cloneNode(!0), { height: c, paddingInlineEnd: i } = getComputedStyle(e);
454
+ s.style.cssText = `visibility: hidden; pointer-events: none; height: ${c}; min-height: 0; padding-inline-end: calc(${i} + ${n}px)`, s.querySelectorAll(`:scope > :not(.${ft})`).forEach((l) => l.remove()), r && ve(s).forEach((l) => r.has(l.dataset.id) || l.remove()), n && s.querySelectorAll(".rac-chip-del").forEach((l) => l.remove());
455
+ const a = ve(s), o = new Map(a.map((l, g) => [l.dataset.id, g]));
456
+ t?.slice(1).forEach((l, g) => {
457
+ const y = Math.min(...l.map((S) => o.get(S) ?? 1 / 0)), h = Math.max(...t[g].map((S) => o.get(S) ?? -1).filter((S) => S < y));
458
+ h >= 0 && a[h].after(Object.assign(document.createElement("div"), { className: "rac-spacer" }));
459
+ }), e.style.position = "absolute", e.after(s), s.getAnimations?.({ subtree: !0 }).forEach((l) => l.effect?.getComputedTiming().endTime < 1 / 0 && l.finish());
460
+ const p = Xt(a).map((l) => l.map((g) => g.dataset.id));
461
+ return s.remove(), e.style.position = "", p;
462
+ }, pt = (e, t) => {
463
+ const n = t ? t.slice(0, -1).map((s) => s.at(-1)) : Ge, { breaks: r } = e.get();
464
+ return Jt(r, n) ? r : n;
465
+ }, Je = (e, t, n, r) => pt(e, r && n.length ? gt(t, null, r, new Set(n.map((s) => s.id))) : null), Xe = (e, t, n) => {
466
+ n.rows = gt(t, n.rows, n.reserve), e.set({ held: !0, breaks: pt(e, n.rows) });
467
+ }, Ze = (e, t, n, r) => {
468
+ if (!e.animate) return;
469
+ e.getAnimations().forEach((a) => a.id === Le && a.cancel());
470
+ const s = e.getBoundingClientRect(), c = t.left - s.left, i = t.top - s.top;
471
+ (Math.abs(c) > 0.5 || Math.abs(i) > 0.5) && e.animate([{ transform: `translate(${c}px, ${i}px)` }, { transform: "none" }], { id: Le, duration: n, easing: r });
472
+ }, Zt = (e, t, n, r, s) => {
473
+ if (!e || n === t.value) return;
474
+ const c = getComputedStyle(e), i = t.anim ? c.height : t.root;
475
+ t.anim?.cancel(), t.root = c.height;
476
+ const a = !t.value || i === t.root || !e.animate || De();
477
+ if (t.value = n, t.anim = null, a) return;
478
+ const o = { overflow: "hidden", alignItems: "flex-start" }, p = t.anim = e.animate([{ ...o, height: i }, { ...o, height: t.root }], { duration: r, easing: s });
479
+ p.onfinish = () => {
480
+ t.anim === p && (t.anim = null);
481
+ };
482
+ };
483
+ function Qt(e) {
484
+ const { selectRef: t, duration: n, easing: r, multiple: s, deleteInline: c, deleteAlways: i, icons: a } = B(Y), { selectedIDs: o, deleting: p, visibility: l, active: g } = B(de), { setDeleting: y, setVisibility: h } = B(ce), [S, w] = U(0), [f] = U(() => Me(Yt)), [m] = U(() => /* @__PURE__ */ new Set()), D = re(f.subscribe, () => f.get().held, () => !1), L = re(f.subscribe, () => f.get().breaks, () => Ge), C = F({ rows: null, reserve: 0, chips: e }), j = F(null), M = F({ value: 0, root: "", anim: null }), u = F(null), x = F(null), E = c && !i && !p && !!a.remove, $ = E ? S + Ut : 0, k = s && E && !S, V = ot((b) => {
485
+ const d = u.current, v = C.current;
486
+ d && (b && f.get().held && Xe(f, d, v), Zt(t.current, M.current, d.offsetHeight, n, r), f.get().held || f.set({ breaks: Je(f, d, v.chips, v.reserve) }));
487
+ });
488
+ ne(() => {
489
+ const b = C.current, d = u.current, v = b.chips !== e;
490
+ Object.assign(b, { chips: e, reserve: $ }), v && d && Ye(d) && Xe(f, d, b), V(!v);
491
+ }, [e, $, f]), ne(() => {
492
+ const b = () => V(!0), d = typeof ResizeObserver > "u" ? null : new ResizeObserver(b);
493
+ return d?.observe(u.current), document.fonts?.addEventListener("loadingdone", b), () => {
494
+ d?.disconnect(), document.fonts?.removeEventListener("loadingdone", b);
495
+ };
466
496
  }, []);
467
- const R = C(() => {
468
- if (!f.current) return { left: "0px", right: "0px" };
469
- const $ = window.getComputedStyle(f.current);
470
- return { left: $.marginLeft, right: $.marginRight };
497
+ const I = K(() => {
498
+ const b = u.current;
499
+ if (!b || !f.get().held || Ye(b)) return;
500
+ const d = ve(b), v = d.map((H) => H.getBoundingClientRect()), T = Je(f, b, C.current.chips, C.current.reserve);
501
+ C.current.rows = null, St(() => f.set({ held: !1, breaks: T })), De() || d.forEach((H, J) => H.isConnected && Ze(H, v[J], n, r));
502
+ }, [f, n, r]), A = K(() => {
503
+ u.current && (j.current = new Map(ve(u.current).map((b) => [b, b.getBoundingClientRect()])));
471
504
  }, []);
472
- return /* @__PURE__ */ d.jsx(
473
- Ie,
505
+ return ne(() => {
506
+ const b = j.current;
507
+ !b || L !== f.get().breaks || (j.current = null, De() || b.forEach((d, v) => v.isConnected && Ze(v, d, n, r)));
508
+ }, [L, e, f, n, r]), oe(() => () => M.current.anim?.cancel(), []), oe(() => {
509
+ p && l && h(!1), p && (!o.length || !g) && y(!1), f.set({ hoverId: null, ...!g && { swipedId: null } });
510
+ }, [o.length, p, l, g, y, h, f]), ne(() => {
511
+ const b = x.current;
512
+ if (!k || !b) return;
513
+ const d = getComputedStyle(b);
514
+ w(b.getBoundingClientRect().width + parseFloat(d.marginLeft) + parseFloat(d.marginRight));
515
+ }, [k]), { chipStore: f, delGroup: m, valueRef: u, delIconRef: x, probe: k, settle: I, held: D, snapshot: A };
516
+ }
517
+ const Qe = 1, et = 2, en = 600, tn = 10, tt = 30, nn = se(function({ element: t, deleting: n, locked: r, chipStore: s, delGroup: c }) {
518
+ const { selectRef: i, deleteInline: a, deleteAlways: o, icons: p, texts: l, valueAsOption: g, renderOption: y } = B(Y), h = !!p.remove, { setVisibility: S, setDeleting: w, removeOption: f } = B(ce), m = F({ longPressTimer: null, longPress: !1, x: 0, y: 0 }), D = re(s.subscribe, () => {
519
+ const { hoverId: b, swipedId: d } = s.get();
520
+ return (b === t.id ? Qe : 0) | (d === t.id ? et : 0);
521
+ }, () => 0), L = !!(D & Qe), C = !!(D & et), j = K((b) => {
522
+ const { clientX: d, clientY: v } = b.touches[0];
523
+ Object.assign(m.current, { x: d, y: v, longPress: !1 }), clearTimeout(m.current.longPressTimer), h && (m.current.longPressTimer = setTimeout(() => {
524
+ w(!0), m.current.longPress = !0, i.current?.focus(), S(!1), window.navigator.vibrate?.(50);
525
+ }, en));
526
+ }, [h, w, S, i]), M = K((b) => {
527
+ const { clientX: d, clientY: v } = b.touches[0], T = m.current.x - d;
528
+ Math.hypot(T, m.current.y - v) > tn && clearTimeout(m.current.longPressTimer), T > tt && !C ? s.set({ hoverId: null, swipedId: t.id }) : T < -tt && C && s.set({ swipedId: null });
529
+ }, [t.id, C, s]), u = K(() => clearTimeout(m.current.longPressTimer), []), x = K(() => s.set({ hoverId: t.id, swipedId: null }), [t.id, s]), E = K(() => {
530
+ s.get().hoverId === t.id && s.set({ hoverId: null });
531
+ }, [t.id, s]);
532
+ oe(() => () => clearTimeout(m.current.longPressTimer), []);
533
+ const $ = g ? Ve(t, y, !0) : null, k = $ ? /* @__PURE__ */ O("div", { className: "rac-option-jsx", children: $ }) : /* @__PURE__ */ O("span", { className: "rac-chip-text", children: t.name || l.emptyOption }), V = K((b) => {
534
+ s.set({ swipedId: null }), f(t.id), Q(b);
535
+ }, [t.id, f, s]), I = K((b) => {
536
+ Q(b), m.current.longPress ? m.current.longPress = !1 : n && V(b);
537
+ }, [n, V]), A = h && (o || !r && (L || C || n));
538
+ return /* @__PURE__ */ q(
539
+ "div",
474
540
  {
475
- onEnter: () => {
476
- f.current.style.transition = "none", f.current.style.marginRight = "0px", f.current.style.marginLeft = "0px", f.current.style.width = "0px", l?.(!0);
477
- },
478
- onEntering: () => {
479
- const { left: $, right: D } = R();
480
- requestAnimationFrame(() => {
481
- requestAnimationFrame(() => {
482
- f.current && (f.current.style.transition = `width ${c}ms, color ${c}ms, background-color ${c}ms, margin ${c}ms ease`, f.current.style.width = f.current.scrollWidth + "px", f.current.style.marginRight = D, f.current.style.marginLeft = $);
483
- });
484
- });
485
- },
486
- onEntered: () => {
487
- f.current.style.width = "auto", s?.(!1), l?.(!1);
488
- },
489
- onExit: () => {
490
- const { left: $, right: D } = R();
491
- f.current.style.width = f.current.scrollWidth + "px", f.current.style.marginRight = D, f.current.style.marginLeft = $, f.current.offsetHeight, n?.(!0);
492
- },
493
- onExiting: () => {
494
- f.current.style.marginRight = "0px", f.current.style.marginLeft = "0px", f.current.style.width = "0px";
495
- },
496
- onExited: () => {
497
- j?.(), n?.(!1), s?.(!1);
498
- },
499
- classNames: "rac-slide-left",
500
- unmountOnExit: v,
501
- timeout: c,
502
- nodeRef: f,
503
- in: O,
504
- ...o,
505
- children: /* @__PURE__ */ d.jsx(
506
- "div",
507
- {
508
- className: e,
509
- ref: f,
510
- style: {
511
- transition: `width ${c}ms, color ${c}ms, background-color ${c}ms, margin ${c}ms ease`,
512
- willChange: "width",
513
- overflow: "hidden",
514
- ...T
515
- },
516
- children: p
517
- }
518
- )
541
+ className: ue("rac-chip", $ && t.className),
542
+ style: $ ? t.style : void 0,
543
+ ...!r && { onTouchStart: j, onTouchMove: M, onTouchEnd: u, onTouchCancel: u, onMouseEnter: x, onMouseLeave: E, onClick: I },
544
+ children: [
545
+ k,
546
+ /* @__PURE__ */ O(
547
+ ie,
548
+ {
549
+ "aria-label": `${l.remove} ${t.name ?? ""}`.trim(),
550
+ group: a && !o && !n ? c : void 0,
551
+ onMouseDown: Q,
552
+ onClick: V,
553
+ className: "rac-chip-del",
554
+ disabled: r,
555
+ tabIndex: -1,
556
+ type: "button",
557
+ in: A,
558
+ as: "button",
559
+ axis: "x",
560
+ children: ae(p.remove)
561
+ }
562
+ )
563
+ ]
519
564
  }
520
565
  );
521
- }), ht = $e(({ element: e, setState: t, spacer: n, delWidth: l, selectRef: s, setVisibility: p, activeHoverId: c, hoverRowTop: j, swipedId: T, deleteInline: v, remove: o, DelIcon: S, normalizedOptions: f, swiped: O, deleting: R, entering: $, setDeleting: D, onRender: X, duration: J, rowEnd: M, showDelete: Z }) => {
522
- const m = ie({
523
- longPressTimer: null,
524
- hoverTimer: null,
525
- longPress: !1,
526
- swiping: !1,
527
- touchStart: 0
528
- }), U = ie(null), a = C((u) => {
529
- m.current.touchStart = u.touches[0].clientX, m.current.longPress = !1, m.current.longPressTimer && clearTimeout(m.current.longPressTimer), m.current.longPressTimer = setTimeout(() => {
530
- D(!0), m.current.longPress = !0, s.current?.focus(), p(!1), window.navigator.vibrate && window.navigator.vibrate(50);
531
- }, 600), u.preventDefault();
532
- }, []), w = C((u) => {
533
- m.current.longPressTimer && clearTimeout(m.current.longPressTimer);
534
- const _ = u.touches[0].clientX, r = m.current.touchStart - _;
535
- Math.abs(r) > 10 && (m.current.swiping = !0, r > 30 && !O ? t({ activeHoverId: null, swipedId: e.id }) : r < -30 && O && t({ swipedId: null }));
536
- }, [e.id, O]), z = C((u) => {
537
- m.current.longPressTimer && clearTimeout(m.current.longPressTimer), m.current.longPress && u.preventDefault();
538
- }, []), I = C(() => {
539
- n?.state || (m.current.hoverTimer && clearTimeout(m.current.hoverTimer), m.current.hoverTimer = setTimeout(() => {
540
- t({
541
- hoverRowTop: U.current?.getBoundingClientRect().top,
542
- activeHoverId: e.id,
543
- swipedId: null
544
- });
545
- }, 100));
546
- }, [e.id, n?.state]), K = C(() => {
547
- m.current.hoverTimer && clearTimeout(m.current.hoverTimer), m.current.hoverTimer = setTimeout(() => t({ activeHoverId: null, hoverRowTop: null }), 100);
548
- }, []);
549
- ne(() => {
550
- !n?.state && U.current && U.current.matches(":hover") && I();
551
- }, [n?.state, I]), ne(() => () => {
552
- m.current.hoverTimer && clearTimeout(m.current.hoverTimer), m.current.longPressTimer && clearTimeout(m.current.longPressTimer);
553
- }, []);
554
- let L = null;
555
- if (e?.jsx)
556
- L = e.jsx;
557
- else if (e?.name)
558
- L = e.name;
559
- else if (e?.raw !== void 0) {
560
- const u = f.find(
561
- (_) => _.raw === e.raw || _.original === e.raw || _.userId === e.raw
562
- );
563
- u && (L = u.jsx ?? u.name);
566
+ }), rn = se(function({ element: t, chipStore: n, settle: r, ...s }) {
567
+ const c = re(n.subscribe, () => n.get().breaks.includes(t.id), () => !1);
568
+ return /* @__PURE__ */ q(at, { children: [
569
+ /* @__PURE__ */ O(ie, { className: "rac-chip-slot", onEntered: r, onExited: r, unmountOnExit: !1, "data-id": t.id, axis: "x", fade: !0, children: /* @__PURE__ */ O(nn, { element: t, chipStore: n, ...s }) }),
570
+ c && /* @__PURE__ */ O("div", { className: "rac-spacer" })
571
+ ] });
572
+ }), sn = { position: "absolute", visibility: "hidden", pointerEvents: "none" }, je = [], on = () => {
573
+ }, an = (e) => e == null ? "" : typeof e == "object" ? fe(e) ?? "" : String(e), ln = se(function() {
574
+ const { selectRef: t, multiple: n, name: r, required: s } = B(Y), { selected: c, selectedIDs: i, disabled: a } = B(de);
575
+ if (!r && !s) return null;
576
+ const o = (n ? i : c ? [c] : je).map((g) => an(g.original)), p = o.length ? o : n && !s ? je : [""], l = () => t.current?.focus();
577
+ return p.map(
578
+ (g, y) => /* @__PURE__ */ O("input", { className: "rac-input", name: r, value: g, required: s && !y, disabled: a, tabIndex: -1, "aria-hidden": "true", onChange: on, onFocus: l }, y)
579
+ );
580
+ });
581
+ class cn extends vt {
582
+ getSnapshotBeforeUpdate(t) {
583
+ return t.chips !== this.props.chips && this.props.take(), null;
564
584
  }
565
- L == null && (L = typeof e == "object" ? e.label ?? e.name ?? e.value ?? "Selected item" : String(e));
566
- const B = C((u) => {
567
- u.stopPropagation(), u.preventDefault();
568
- }, []), V = C((u) => {
569
- t({ swipedId: null }), o(e.id), B(u);
570
- }, [e.id, o]), x = C((u) => {
571
- B(u), m.current.longPress ? m.current.longPress = !1 : R && V(u);
572
- }, [R, V]);
573
- xe(() => {
574
- if (U.current && X) {
575
- const { width: u } = U.current.getBoundingClientRect();
576
- X(u);
577
- }
578
- }, [X, L]);
579
- const P = Z ? !0 : c === e.id || T === e.id || R, Y = j === U.current?.getBoundingClientRect().top, W = (c || T) && Y;
580
- return /* @__PURE__ */ d.jsxs(Ue, { children: [
581
- /* @__PURE__ */ d.jsxs(
582
- "div",
583
- {
584
- className: `rac-multiple-selected-option ${R ? "--deleting-shake" : ""}`,
585
- onTouchStart: a,
586
- onTouchMove: w,
587
- onTouchEnd: z,
588
- onMouseEnter: I,
589
- onMouseLeave: K,
590
- onClick: x,
591
- ref: U,
592
- children: [
593
- L,
594
- /* @__PURE__ */ d.jsx(
595
- ye,
596
- {
597
- style: {
598
- backgroundColor: R || v ? "transparent" : "--rac-multiple-del-bg",
599
- position: R || v ? "relative" : "absolute"
600
- },
601
- setEntering: (u) => t({ entering: u }),
602
- setLeaving: (u) => t({ leaving: u }),
603
- setSpacer: (u) => t({ spacer: u }),
604
- className: "rac-multiple-del",
605
- visibility: P,
606
- duration: J,
607
- children: he(S, { onClick: V, onMouseDown: B })
608
- }
609
- )
610
- ]
611
- }
612
- ),
613
- !Z && !R && v && M && $ !== e.id && /* @__PURE__ */ d.jsx(
614
- "div",
615
- {
616
- style: {
617
- minWidth: W ? "0px" : `${l}px`,
618
- transition: `min-width ${J}ms ease`,
619
- "--del-width": `${l}px`,
620
- // backgroundColor: 'black',
621
- flexBasis: "0px",
622
- height: "1px",
623
- flexShrink: 1
585
+ componentDidUpdate() {
586
+ }
587
+ render() {
588
+ return null;
589
+ }
590
+ }
591
+ const nt = (e, t) => {
592
+ const n = new Set(e.map((i) => i.id)), r = new Map(t.map(([i, a]) => [a.id, i])), s = t.filter(([, i]) => !n.has(i.id)), c = new Set(t.map(([i]) => i));
593
+ return e.map((i) => {
594
+ if (r.has(i.id)) return [r.get(i.id), i];
595
+ const a = s.findIndex(([, p]) => Wt(p.original, i.original));
596
+ if (a >= 0) return [s.splice(a, 1)[0][0], i];
597
+ let o = i.id;
598
+ for (; c.has(o); ) o += "~";
599
+ return c.add(o), [o, i];
600
+ });
601
+ }, dn = (e) => {
602
+ const [t, n] = U(() => ({ chips: e, keyed: nt(e, []) }));
603
+ if (t.chips === e) return t.keyed;
604
+ const r = nt(e, t.keyed);
605
+ return n({ chips: e, keyed: r }), r;
606
+ }, un = se(function() {
607
+ const { selectedText: t, icons: n, valueAsOption: r, renderOption: s } = B(Y), { selectedIDs: c, title: i, valueOption: a, hasActualValue: o, loading: p, error: l, deleting: g, active: y } = B(de), h = c.length > 0 && !t, S = h ? c : je, { chipStore: w, delGroup: f, valueRef: m, delIconRef: D, probe: L, settle: C, held: j, snapshot: M } = Qt(S), u = dn(S), [x] = U(() => /* @__PURE__ */ new Set()), E = r && a ? Ve(a, s, !0) : null, $ = p && !l && !o, k = `${E ? a.id : i}${$ ? "-loading" : ""}`, V = a?.type === "boolean" ? String(a.raw) : void 0;
608
+ return /* @__PURE__ */ q("div", { className: "rac-value", ref: m, children: [
609
+ /* @__PURE__ */ O(cn, { chips: S, take: M }),
610
+ /* @__PURE__ */ O($e, { children: !h && /* @__PURE__ */ q(ie, { axis: "x", fade: !0, group: x, className: ue("rac-title", E && a.className), style: E ? a.style : void 0, "data-bool": V, onEntered: C, onExited: C, children: [
611
+ E ? /* @__PURE__ */ O("div", { className: "rac-option-jsx", children: E }) : i,
612
+ $ && Be
613
+ ] }, k) }),
614
+ /* @__PURE__ */ O($e, { hold: j, children: u.map(
615
+ ([I, A]) => /* @__PURE__ */ O(
616
+ rn,
617
+ {
618
+ element: A,
619
+ deleting: g,
620
+ locked: !y,
621
+ chipStore: w,
622
+ delGroup: f,
623
+ settle: C
624
624
  },
625
- className: "rac-del-spacer"
626
- }
627
- )
625
+ I
626
+ )
627
+ ) }),
628
+ L && /* @__PURE__ */ O("button", { type: "button", className: "rac-chip-del", tabIndex: -1, "aria-hidden": "true", ref: D, style: sn, children: ae(n.remove) })
628
629
  ] });
629
- }), Xe = ({ children: e, setLeaving: t, duration: n, setSpacer: l, setEntering: s, id: p = null, widthMode: c = !1, ...j }) => {
630
- const T = ie(null), v = C(() => {
631
- if (!T.current) return { t: 0, b: 0, l: 0, r: 0 };
632
- const o = window.getComputedStyle(T.current);
633
- return {
634
- t: o.marginTop,
635
- b: o.marginBottom,
636
- l: o.marginLeft,
637
- r: o.marginRight
638
- };
639
- }, []);
640
- return /* @__PURE__ */ d.jsx(
641
- Ie,
630
+ }), fn = se(function() {
631
+ const { selectRef: t, selectId: n, highlightStore: r, positionStore: s, className: c, style: i, duration: a, easing: o, deleteInline: p, icons: l, texts: g, placeholder: y, id: h, required: S, attrs: w } = B(Y), { visibility: f, active: m, hasActualValue: D, deleting: L, loading: C, loadPending: j, error: M, normalizedOptions: u } = B(de), { handleBlur: x, handleFocus: E, handleKeyDown: $, toggleVisibility: k, clear: V } = B(ce), I = re(s.subscribe, () => s.get().upward, () => !1), A = re(r.subscribe, () => {
632
+ const v = f ? u[ye(r.get())] : null;
633
+ return v ? Oe(n, v.id) : void 0;
634
+ }, () => {
635
+ }), b = !!l.clear && D && m && !L, d = !!l.arrow && m && !L;
636
+ return /* @__PURE__ */ q(
637
+ "div",
642
638
  {
643
- classNames: "rac-slide-left",
644
- timeout: n,
645
- nodeRef: T,
646
- unmountOnExit: !0,
647
- ...j,
648
- onEnter: () => {
649
- const o = T.current;
650
- o && (c ? (o.style.width = "0px", o.style.marginLeft = "0px", o.style.marginRight = "0px") : (o.style.height = "0px", o.style.marginTop = "0px", o.style.marginBottom = "0px", o.style.transform = "translateY(-10px)"), o.style.opacity = "0");
651
- },
652
- onEntering: () => {
653
- const o = T.current, S = v();
654
- o.offsetHeight, c ? (o.style.width = o.scrollWidth + "px", o.style.marginRight = S.r, o.style.marginLeft = S.l) : (o.style.height = o.scrollHeight + "px", o.style.transform = "translateY(0)", o.style.marginBottom = S.b, o.style.marginTop = S.t), o.style.opacity = "1";
639
+ ...w,
640
+ id: h,
641
+ ref: t,
642
+ style: { "--rac-duration": `${a}ms`, "--rac-ease": o, ...i },
643
+ className: ue("rac-select", c),
644
+ ...m && {
645
+ onKeyDown: $,
646
+ onFocus: E,
647
+ onClick: k,
648
+ onBlur: x
655
649
  },
656
- onEntered: () => {
657
- const o = T.current;
658
- o.style.width = c ? "auto" : "", o.style.height = c ? "" : "100%", o.style.opacity = "1", o.style.transform = "", s?.(!1), l?.(!1);
659
- },
660
- onExit: () => {
661
- const o = T.current, S = v();
662
- c ? (o.style.width = o.offsetWidth + "px", o.style.marginRight = S.r, o.style.marginLeft = S.l) : (o.style.height = o.offsetHeight + "px", o.style.position = "absolute", o.style.marginBottom = S.b, o.style.marginTop = S.t), o.style.opacity = "1", t?.(!0);
663
- },
664
- onExiting: () => {
665
- const o = T.current;
666
- c ? (o.style.marginRight = "0px", o.style.marginLeft = "0px", o.style.width = "0px") : (o.style.transform = "translateY(10px)", o.style.marginBottom = "0px", o.style.marginTop = "0px", o.style.height = "0px"), o.style.opacity = "0";
667
- },
668
- onExited: () => {
669
- l?.(!1), t?.(!1);
670
- },
671
- children: /* @__PURE__ */ d.jsx(
672
- "div",
673
- {
674
- ref: T,
675
- id: p,
676
- style: {
677
- transition: `all ${n}ms ease`,
678
- alignItems: "center",
679
- whiteSpace: "nowrap",
680
- overflow: "hidden",
681
- display: "flex",
682
- left: 0,
683
- top: 0
684
- },
685
- children: e
686
- }
687
- )
650
+ "aria-disabled": !m,
651
+ "aria-activedescendant": A,
652
+ "aria-controls": `${n}-listbox`,
653
+ tabIndex: m ? 0 : -1,
654
+ "aria-expanded": f,
655
+ "aria-busy": C || j || void 0,
656
+ "aria-label": w["aria-label"] ?? (w["aria-labelledby"] ? void 0 : y),
657
+ "aria-required": S || void 0,
658
+ "aria-haspopup": "listbox",
659
+ role: "combobox",
660
+ "data-placement": I ? "top" : "bottom",
661
+ "data-inline-delete": X(p),
662
+ "data-empty": X(!D),
663
+ "data-deleting": X(L),
664
+ "data-error": X(M),
665
+ children: [
666
+ /* @__PURE__ */ O(un, {}),
667
+ /* @__PURE__ */ q($e, { children: [
668
+ b && /* @__PURE__ */ O(ie, { as: "button", type: "button", axis: "x", className: "rac-clear", tabIndex: -1, "aria-label": g.clear, onMouseDown: Q, onClick: V, children: ae(l.clear) }, "clear"),
669
+ d && /* @__PURE__ */ O(ie, { axis: "x", className: "rac-arrow", "aria-hidden": "true", children: ae(l.arrow) }, "arrow")
670
+ ] }),
671
+ /* @__PURE__ */ O(ln, {})
672
+ ]
688
673
  }
689
674
  );
690
- }, mt = $e(({ element: e, index: t, spacer: n, duration: l, setState: s, ...p }) => /* @__PURE__ */ d.jsxs(Ue, { children: [
691
- /* @__PURE__ */ d.jsx(
692
- Xe,
675
+ }), ke = 0, gn = 1, rt = 2, ht = (e) => {
676
+ const { highlightStore: t } = B(Y), n = F(null), r = re(t.subscribe, () => {
677
+ const s = t.get();
678
+ return ye(s) !== e ? ke : s.ready ? rt : gn;
679
+ }, () => ke);
680
+ return ne(() => {
681
+ r === rt && n.current?.scrollIntoView?.({ block: "nearest" });
682
+ }, [r]), [n, r !== ke];
683
+ }, pn = se(function({ option: t, index: n, open: r, hasChildren: s }) {
684
+ const { selectId: c, icons: i } = B(Y), { selectOption: a, highlight: o } = B(ce), [p, l] = ht(n), g = s && !t.disabled;
685
+ return /* @__PURE__ */ q(
686
+ "div",
693
687
  {
694
- setEntering: (c) => s({ entering: c }),
695
- setLeaving: (c) => s({ leaving: c }),
696
- setSpacer: (c) => s({ spacer: c }),
697
- className: "rac-multiple-option",
698
- onEnter: p.onEnter,
699
- onExit: p.onExit,
700
- duration: l,
701
- id: e.id,
702
- in: p.in,
703
- widthMode: !0,
704
- children: /* @__PURE__ */ d.jsx(
705
- ht,
706
- {
707
- onRender: (c) => p.registerItemWidth(e.id, c),
708
- setState: s,
709
- duration: l,
710
- element: e,
711
- spacer: n,
712
- index: t,
713
- ...p
714
- }
715
- )
688
+ className: ue("rac-group", t.className),
689
+ onMouseEnter: () => g && o(n),
690
+ onClick: (y) => a(t, y),
691
+ "data-highlighted": X(l),
692
+ "data-disabled": X(t.disabled),
693
+ id: Oe(c, t.id),
694
+ "data-open": X(r),
695
+ style: t.style,
696
+ ref: p,
697
+ children: [
698
+ /* @__PURE__ */ O("span", { className: "rac-group-text", children: t.name }),
699
+ /* @__PURE__ */ O(ie, { axis: "x", in: s && !t.disabled, className: "rac-group-arrow", "aria-hidden": "true", children: ae(i.arrow) })
700
+ ]
716
701
  }
717
- ),
718
- n.state && n.id === e.id && /* @__PURE__ */ d.jsx(
702
+ );
703
+ }), hn = se(function({ option: t, index: n, isSelected: r, showCheckbox: s }) {
704
+ const { selectId: c, icons: i, renderOption: a } = B(Y), { selectOption: o, highlight: p } = B(ce), [l, g] = ht(n), y = !t.disabled && !t.loading, h = Ve(t, a, r);
705
+ return /* @__PURE__ */ q(
719
706
  "div",
720
707
  {
721
- style: { width: n.width },
722
- className: "rac-spacer"
708
+ className: ue("rac-option", t.className),
709
+ onMouseEnter: () => y && p(n),
710
+ onClick: (S) => !t.loading && o(t, S),
711
+ "aria-disabled": t.disabled || t.loading,
712
+ "data-invalid": X(t.invalid),
713
+ "data-bool": typeof t.raw == "boolean" ? String(t.raw) : void 0,
714
+ "data-highlighted": X(g),
715
+ "data-loading": X(t.loading),
716
+ id: Oe(c, t.id),
717
+ "aria-selected": r,
718
+ style: t.style,
719
+ role: "option",
720
+ ref: l,
721
+ children: [
722
+ h ? /* @__PURE__ */ O("div", { className: "rac-option-jsx", children: h }) : /* @__PURE__ */ O("span", { className: "rac-option-text", children: t.name }),
723
+ t.loading && Be,
724
+ s && /* @__PURE__ */ q("div", { className: "rac-check", "data-default": X(!i.checkbox), children: [
725
+ ae(i.check, { className: "rac-checkmark" }),
726
+ ae(i.checkbox, { className: "rac-check-icon" })
727
+ ] })
728
+ ]
723
729
  }
724
- )
725
- ] }));
726
- function yt({ visibility: e, selectRef: t, setBottomDirection: n }) {
727
- const l = ie(250);
728
- xe(() => {
729
- if (!t.current) return;
730
- const s = document.createElement("div");
731
- s.className = "rac-select-list", s.style.visibility = "hidden", s.style.position = "absolute", document.body.appendChild(s);
732
- const p = parseInt(window.getComputedStyle(s).maxHeight);
733
- p && (l.current = p), document.body.removeChild(s);
734
- const c = new ResizeObserver((T) => {
735
- for (let v of T) {
736
- const o = v.borderBoxSize?.[0]?.blockSize || v.contentRect.height;
737
- o > 0 && (l.current = o);
730
+ );
731
+ }), mn = se(function() {
732
+ const { selectId: t, multiple: n } = B(Y), { normalizedOptions: r, selected: s, selectedIDs: c, expandedGroups: i } = B(de), a = s?.id;
733
+ return _(() => {
734
+ const o = new Set(c.map((f) => f.id)), p = r.reduce((f, m) => (m.group && (f[m.group] = (f[m.group] || 0) + 1), f), {}), l = [];
735
+ let g = [], y = null, h = null;
736
+ const S = () => {
737
+ y !== null && g.length && l.push(
738
+ /* @__PURE__ */ O(ie, { axis: "y", in: i.has(y), className: "rac-group-items", role: "group", "aria-labelledby": h, children: g }, `slide-${y}`)
739
+ ), g = [];
740
+ }, w = (f, m) => /* @__PURE__ */ O(
741
+ hn,
742
+ {
743
+ isSelected: o.has(f.id) || a === f.id,
744
+ showCheckbox: n && !f.disabled,
745
+ option: f,
746
+ index: m
747
+ },
748
+ f.id
749
+ );
750
+ return r.forEach((f, m) => {
751
+ f.groupHeader ? (S(), y = f.name, h = Oe(t, f.id), l.push(
752
+ /* @__PURE__ */ O(
753
+ pn,
754
+ {
755
+ hasChildren: p[f.name] > 0,
756
+ open: i.has(f.name),
757
+ option: f,
758
+ index: m
759
+ },
760
+ f.id
761
+ )
762
+ )) : f.group ? g.push(w(f, m)) : (S(), y = null, l.push(w(f, m)));
763
+ }), S(), l;
764
+ }, [r, a, c, i, n, t]);
765
+ }), yn = (e = {}) => Object.fromEntries(Object.entries(e).filter(([t]) => t.startsWith("--"))), bn = (e, t, n, r) => {
766
+ const s = e.getBoundingClientRect(), c = getComputedStyle(e), i = s.left - parseFloat(c.marginLeft) - t.left, a = n ? s.bottom + parseFloat(c.marginBottom) - t.top + r : s.top - parseFloat(c.marginTop) - t.bottom - r;
767
+ Math.abs(i) > 0.5 && (e.style.left = `${t.left - i}px`), Math.abs(a) > 0.5 && (e.style[n ? "bottom" : "top"] = `${parseFloat(e.style[n ? "bottom" : "top"]) + (n ? a : -a)}px`);
768
+ }, vn = ({ selectRef: e, panelRef: t, open: n, offset: r, store: s }) => {
769
+ const c = F(0), i = K((o) => {
770
+ const p = e.current;
771
+ if (!p) return;
772
+ const l = n && o ? o.scrollHeight : 0;
773
+ l && (c.current = l), c.current || (c.current = parseFloat(getComputedStyle(p).getPropertyValue("--rac-list-max-height")) || 250);
774
+ const g = p.getBoundingClientRect(), y = window.innerHeight - g.bottom, h = y < c.current && g.top > y;
775
+ s.set({ upward: h }), !(!n || !o) && (o.style.width = `${g.width}px`, o.style.left = `${g.left}px`, o.style.top = h ? "auto" : `${g.bottom + r}px`, o.style.bottom = h ? `${window.innerHeight - g.top + r}px` : "auto", bn(o, g, h, r));
776
+ }, [e, n, r, s]), a = K((o) => {
777
+ o && i(o.parentElement);
778
+ }, [i]);
779
+ return ne(() => {
780
+ const o = () => i(t.current);
781
+ o(), window.addEventListener("resize", o);
782
+ const p = [() => window.removeEventListener("resize", o)];
783
+ if (n) {
784
+ if (window.addEventListener("scroll", o, { capture: !0, passive: !0 }), p.push(() => window.removeEventListener("scroll", o, { capture: !0 })), typeof ResizeObserver < "u") {
785
+ const l = new ResizeObserver(o);
786
+ e.current && l.observe(e.current), t.current && l.observe(t.current), p.push(() => l.disconnect());
738
787
  }
739
- }), j = new IntersectionObserver((T) => {
740
- e || T.forEach((v) => {
741
- const o = v.boundingClientRect, S = window.innerHeight - o.bottom;
742
- n(S < l.current);
743
- });
744
- }, { threshold: [0, 1] });
745
- return j.observe(t.current), () => {
746
- j.disconnect(), c.disconnect();
747
- };
748
- }, [t, e, n]);
749
- }
750
- function xt({ visibility: e, bottomDirection: t, children: n, selectRef: l, onAnimationDone: s, unmount: p = !0, duration: c, easing: j, offset: T, animateOpacity: v, style: o, className: S, setBottomDirection: f = () => {
751
- } }) {
752
- const O = ie(null), R = C(() => {
753
- if (!l?.current || !O.current) return;
754
- const a = l.current.getBoundingClientRect(), w = O.current, z = w.scrollHeight || 250, I = window.innerHeight - a.bottom, K = I < z && a.top > I;
755
- K !== t && f(K), w.style.width = `${a.width}px`, w.style.left = `${a.left}px`, K ? (w.style.top = "auto", w.style.bottom = `${window.innerHeight - a.top + T}px`, w.style.transformOrigin = "bottom") : (w.style.bottom = "auto", w.style.top = `${a.bottom + T}px`, w.style.transformOrigin = "top");
756
- }, [l, t, T, f]);
757
- xe(() => {
758
- if (e) {
759
- R(), window.addEventListener("scroll", R, { capture: !0, passive: !0 }), window.addEventListener("resize", R);
760
- const a = new ResizeObserver(R);
761
- return l.current && a.observe(l.current), () => {
762
- window.removeEventListener("scroll", R, { capture: !0, passive: !0 }), window.removeEventListener("resize", R), a.disconnect();
763
- };
788
+ } else if (typeof IntersectionObserver < "u") {
789
+ const l = new IntersectionObserver(o, { threshold: [0, 0.25, 0.5, 0.75, 1] });
790
+ e.current && l.observe(e.current), p.push(() => l.disconnect());
764
791
  }
765
- }, [e, R, l]);
766
- const $ = `height var(--rac-duration) ${j}${v ? `, opacity var(--rac-duration) ${j}` : ""}`, D = {
767
- opacity: v ? e ? 1 : 0 : 1,
768
- transformOrigin: t ? "bottom" : "top",
769
- pointerEvents: e ? "all" : "none",
770
- height: e ? "auto" : "0px",
771
- "--rac-duration": `${c}ms`,
772
- boxSizing: "border-box",
773
- "--rac-easing": j,
774
- zIndex: "2147483647",
775
- overflow: "hidden",
776
- position: "fixed",
777
- ...Object.fromEntries(
778
- Object.entries(o || {}).map(([a, w]) => [
779
- a.startsWith("--") ? a : `--rac-${a.replace(/([A-Z])/g, "-$1").toLowerCase()}`,
780
- w
781
- ])
782
- )
783
- }, X = C(() => {
784
- const a = O.current;
785
- a && (a.style.height = "0px", v && (a.style.opacity = "0"), a.style.transition = "");
786
- }, [v]), J = C(() => {
787
- const a = O.current;
788
- a && (a.style.transition = $, a.style.height = `${a.scrollHeight}px`, v && (a.style.opacity = "1"));
789
- }, [$, v]), M = C(() => {
790
- const a = O.current;
791
- a && (a.style.height = "auto", a.style.transition = "", s && s());
792
- }, [s]), Z = C(() => {
793
- const a = O.current;
794
- a && (a.style.height = `${a.scrollHeight}px`, v && (a.style.opacity = "1"), a.offsetHeight, a.style.transition = $);
795
- }, [$, v]), m = C(() => {
796
- const a = O.current;
797
- a && (a.style.height = "0px", v && (a.style.opacity = "0"));
798
- }, [v]), U = C(() => {
799
- const a = O.current;
800
- a && (a.style.transition = "");
801
- }, []);
802
- return nt(
803
- /* @__PURE__ */ d.jsx(
804
- Ie,
792
+ return () => p.forEach((l) => l());
793
+ }, [n, i, e, t]), [re(s.subscribe, () => s.get().upward, () => !1), a];
794
+ }, wn = (e) => (typeof e == "function" ? e() : e) || document.body, xn = () => () => {
795
+ }, On = se(function() {
796
+ const { selectRef: t, selectId: n, positionStore: r, multiple: s, offset: c, duration: i, easing: a, animateOpacity: o, keepMounted: p, optionsClassName: l, style: g, container: y, hasMore: h, loadButton: S, texts: w } = B(Y), { visibility: f, normalizedOptions: m, loading: D, error: L } = B(de), { handleListScroll: C, setListReady: j } = B(ce), M = f && m.length > 0, u = re(xn, () => !0, () => !1), x = F(null), [E, $] = vn({ selectRef: t, panelRef: x, open: f && u, offset: c, store: r }), k = K(() => j(!0), [j]);
797
+ return u ? Et(
798
+ /* @__PURE__ */ O(
799
+ ie,
805
800
  {
806
- classNames: "rac-options",
807
- unmountOnExit: p,
808
- onEntering: J,
809
- onExiting: m,
810
- onEntered: M,
811
- onExited: U,
812
- timeout: c,
813
- nodeRef: O,
814
- onEnter: X,
815
- in: e,
816
- onExit: Z,
817
- children: /* @__PURE__ */ d.jsx(
801
+ axis: "y",
802
+ fade: o,
803
+ in: M,
804
+ nodeRef: x,
805
+ unmountOnExit: !p,
806
+ onEntered: k,
807
+ onMouseDown: (V) => V.preventDefault(),
808
+ className: ue("rac-options", l),
809
+ "data-placement": E ? "top" : "bottom",
810
+ style: { ...yn(g), "--rac-duration": `${i}ms`, "--rac-ease": a, pointerEvents: M ? "auto" : "none", position: "fixed" },
811
+ children: /* @__PURE__ */ q(
818
812
  "div",
819
813
  {
820
- style: {
821
- ...D,
822
- "--rac-duration-fast": "calc(var(--rac-duration) * 0.5)",
823
- "--rac-duration-slow": "calc(var(--rac-duration) * 1.3)",
824
- "--rac-duration-base": "var(--rac-duration)",
825
- "--rac-duration": `${c}ms`
826
- },
827
- className: `rac-options ${S || ""}`,
828
- onMouseDown: (a) => a.preventDefault(),
829
- ref: O,
830
- children: n
814
+ onScroll: C,
815
+ className: "rac-list",
816
+ "aria-multiselectable": s,
817
+ id: `${n}-listbox`,
818
+ "aria-label": w.list,
819
+ role: "listbox",
820
+ tabIndex: "-1",
821
+ ref: $,
822
+ children: [
823
+ /* @__PURE__ */ O(mn, {}),
824
+ L ? /* @__PURE__ */ O("div", { className: "rac-option", "data-error": "", children: /* @__PURE__ */ O("span", { className: "rac-option-text", children: w.error }) }) : (D || !S && h) && /* @__PURE__ */ q("div", { className: "rac-option", "data-loading": "", children: [
825
+ /* @__PURE__ */ O("span", { className: "rac-option-text", children: D ? w.loading : w.loadingMore }),
826
+ Be
827
+ ] })
828
+ ]
831
829
  }
832
830
  )
833
831
  }
834
832
  ),
835
- document.body
836
- );
837
- }
838
- const bt = $e(xt, (e, t) => e.visibility === t.visibility && e.duration === t.duration && e.easing === t.easing && e.offset === t.offset && e.animateOpacity === t.animateOpacity && e.selectRef === t.selectRef && e.children === t.children && JSON.stringify(e.style) === JSON.stringify(t.style)), vt = $e((e) => {
839
- const { state: t, setState: n, optionRef: l, firstMount: s, remove: p, safeToggle: c, registerItemWidth: j, delIcon: T } = pt(e), { bottomDirection: v, selectHeight: o, swipedId: S, rowEndIds: f, delWidth: O } = t, { selectRef: R, selectId: $, renderOptions: D, selected: X, selectedIDs: J, normalizedOptions: M, title: Z, visibility: m, active: U, hasOptions: a, hasActualValue: w, optionsClassName: z, selectedText: I, disabled: K, loading: L, error: B, registerOption: V, unregisterOption: x, handleBlur: P, handleFocus: Y, handleKeyDown: W, handleListScroll: u, setAnimationFinished: _, clear: r, children: b, placeholder: A, className: G, style: Q, duration: i, easing: g, offset: y, animateOpacity: E, unmount: k, OpenIcon: H, ClearIcon: ee, DelIcon: re, hasMore: ue, loadButton: oe, deleting: h } = e;
840
- yt({ visibility: m, selectRef: R, setBottomDirection: (F) => n({ bottomDirection: F }) });
841
- const q = ee && w && a && !K && !L && !B && !h, te = H && U && !h, le = J?.map(
842
- (F, ge) => /* @__PURE__ */ d.jsx(
843
- mt,
844
- {
845
- rowEnd: f.includes(F.id),
846
- registerItemWidth: j,
847
- swiped: S === F.id,
848
- setState: n,
849
- element: F,
850
- remove: p,
851
- index: ge,
852
- ...e,
853
- ...t
854
- },
855
- F.id
856
- )
857
- );
858
- return /* @__PURE__ */ d.jsxs(Ae.Provider, { value: { registerOption: V, unregisterOption: x }, children: [
859
- b,
860
- /* @__PURE__ */ d.jsxs(
861
- "div",
862
- {
863
- ref: R,
864
- style: {
865
- "--rac-duration-fast": "calc(var(--rac-duration) * 0.5)",
866
- "--rac-duration-slow": "calc(var(--rac-duration) * 1.3)",
867
- "--rac-duration-base": "var(--rac-duration)",
868
- "--rac-duration": `${i}ms`,
869
- ...Q
870
- },
871
- className: `
872
- ${!a || K ? "rac-disabled-style" : ""}
873
- ${L ? "rac-loading-style" : ""}
874
- ${B ? "rac-error-style" : ""}
875
- ${G}
876
- rac-select
877
- `,
878
- ...U && {
879
- onKeyDown: W,
880
- onFocus: Y,
881
- onClick: c,
882
- onBlur: P
883
- },
884
- "aria-disabled": K || !a,
885
- "aria-controls": `${$}-listbox`,
886
- tabIndex: U ? 0 : -1,
887
- "aria-expanded": m,
888
- "aria-label": A,
889
- "aria-haspopup": "listbox",
890
- role: "combobox",
891
- children: [
892
- /* @__PURE__ */ d.jsx(
893
- "div",
894
- {
895
- className: `rac-select-title-wrapper
896
- ${!B && !L && X?.type === "boolean" ? X.raw ? "rac-true-option" : "rac-false-option" : ""}
897
- `,
898
- style: {
899
- alignItems: J?.length && !I ? "flex-start" : "center",
900
- height: o ? `${o}px` : "auto"
901
- },
902
- children: /* @__PURE__ */ d.jsx(
903
- "div",
904
- {
905
- style: {
906
- alignItems: J?.length && !I ? "flex-start" : "center",
907
- height: L ? "100%" : "auto"
908
- },
909
- className: "rac-select-title",
910
- ref: l,
911
- children: /* @__PURE__ */ d.jsx(
912
- Le,
913
- {
914
- enter: !s.current,
915
- component: null,
916
- appear: !1,
917
- children: J?.length && !I && !L ? le : /* @__PURE__ */ d.jsxs(
918
- Xe,
919
- {
920
- className: "rac-title-container",
921
- duration: i,
922
- widthMode: !0,
923
- children: [
924
- /* @__PURE__ */ d.jsx("span", { className: "rac-title-text", children: Z }),
925
- /* @__PURE__ */ d.jsx(
926
- ye,
927
- {
928
- className: "rac-loading-container",
929
- visibility: L && !B,
930
- duration: i,
931
- children: /* @__PURE__ */ d.jsxs("span", { className: "rac-loading-dots", children: [
932
- /* @__PURE__ */ d.jsx("i", {}),
933
- /* @__PURE__ */ d.jsx("i", {}),
934
- /* @__PURE__ */ d.jsx("i", {})
935
- ] })
936
- }
937
- )
938
- ]
939
- },
940
- Z
941
- )
942
- }
943
- )
944
- }
945
- )
946
- }
947
- ),
948
- /* @__PURE__ */ d.jsx(
949
- ye,
950
- {
951
- visibility: q || te,
952
- className: "rac-select-buttons",
953
- children: /* @__PURE__ */ d.jsxs(Le, { component: null, children: [
954
- q && /* @__PURE__ */ d.jsx(
955
- ye,
956
- {
957
- style: { display: "grid" },
958
- duration: i,
959
- children: he(ee, {
960
- className: "rac-select-cancel",
961
- onMouseDown: (F) => {
962
- F.stopPropagation(), F.preventDefault();
963
- },
964
- onClick: r
965
- })
966
- },
967
- "clear-icon"
968
- ),
969
- " ",
970
- te && /* @__PURE__ */ d.jsx(
971
- ye,
972
- {
973
- style: { display: "grid" },
974
- duration: i,
975
- children: he(H, { className: `rac-select-arrow ${m ? "--open" : ""} ${v ? "" : "--up"}` })
976
- },
977
- "open-button"
978
- )
979
- ] })
980
- }
981
- ),
982
- /* @__PURE__ */ d.jsx(
983
- bt,
984
- {
985
- setBottomDirection: (F) => n({ bottomDirection: F }),
986
- style: { "--rac-duration": `${i}ms`, ...Q },
987
- visibility: m && M.length,
988
- onAnimationDone: () => _(!0),
989
- bottomDirection: t.bottomDirection,
990
- animateOpacity: E,
991
- className: z,
992
- selectRef: R,
993
- duration: i,
994
- unmount: k,
995
- easing: g,
996
- offset: y,
997
- children: /* @__PURE__ */ d.jsxs(
998
- "div",
999
- {
1000
- onScroll: u,
1001
- className: "rac-select-list",
1002
- "aria-label": "Options",
1003
- role: "listbox",
1004
- tabIndex: "-1",
1005
- children: [
1006
- D,
1007
- !oe && ue && /* @__PURE__ */ d.jsxs(
1008
- "div",
1009
- {
1010
- className: "rac-select-option rac-disabled-option rac-loading-option",
1011
- style: { justifyContent: "initial", alignItems: "end", gap: 0 },
1012
- onClick: (F) => F.stopPropagation(),
1013
- children: [
1014
- /* @__PURE__ */ d.jsx("span", { className: "rac-loading-option-title", children: "Loading" }),
1015
- /* @__PURE__ */ d.jsx("div", { className: "rac-loading-container", children: /* @__PURE__ */ d.jsxs("span", { className: "rac-loading-dots", children: [
1016
- /* @__PURE__ */ d.jsx("i", {}),
1017
- /* @__PURE__ */ d.jsx("i", {}),
1018
- /* @__PURE__ */ d.jsx("i", {})
1019
- ] }) })
1020
- ]
1021
- }
1022
- )
1023
- ]
1024
- }
1025
- )
1026
- }
1027
- )
1028
- ]
1029
- }
1030
- ),
1031
- !O && /* @__PURE__ */ d.jsx("div", { style: { position: "absolute", visibility: "hidden", pointerEvents: "none", zIndex: -1 }, children: /* @__PURE__ */ d.jsx("div", { ref: T, children: he(re) }) })
1032
- ] });
1033
- });
1034
- function wt({ disabled: e, open: t, setOpen: n, options: l = [], selectOption: s, setState: p, selected: c, selectedIDs: j, multiple: T, hasMore: v, loadMore: o, loadButton: S, loadButtonText: f, loadOffset: O, loadAhead: R, expandedGroups: $, onOpen: D, onClose: X, deleting: J }) {
1035
- const [M, Z] = Se(-1), m = ie({
1036
- loadingTriggered: !1,
1037
- lastWindowFocusTime: 0,
1038
- justFocused: !1,
1039
- focusTimeout: null
1040
- });
1041
- ne(() => {
1042
- m.current.loadingTriggered = !1, S && p({ loadingTitle: f });
1043
- }, [l.length, v, S, f]);
1044
- const U = C(() => {
1045
- !v || m.current.loadingTriggered || (m.current.loadingTriggered = !0, o());
1046
- }, [v, o]), a = C((x) => {
1047
- if (S || !v || m.current.loadingTriggered) return;
1048
- const { scrollTop: P, scrollHeight: Y, clientHeight: W } = x.currentTarget(Y - P <= W + O) && U();
1049
- }, [S, v, O, U]);
1050
- ne(() => {
1051
- !S && t && v && M >= l.length - R && U();
1052
- }, [M, t, v, l.length, R, S, U]), ne(() => {
1053
- const x = () => m.current.lastWindowFocusTime = Date.now();
1054
- return window.addEventListener("focus", x), () => {
1055
- window.removeEventListener("focus", x), clearTimeout(m.current.focusTimeout);
1056
- };
1057
- }, []), ne(() => {
1058
- if (!t) {
1059
- Z(-1);
1060
- return;
1061
- }
1062
- const x = l[M], P = x && !x.hidden && !x.groupHeader;
1063
- if (M >= 0 && M < l.length && P) return;
1064
- let Y = -1;
1065
- if (c && !T) {
1066
- const W = T ? c[0] : c;
1067
- W && (Y = l.findIndex((u) => u.id === W.id && !u.disabled && !u.hidden && !u.groupHeader));
1068
- }
1069
- if (T && j.length) {
1070
- const W = new Set(j.map((u) => u.id));
1071
- Y = l.findIndex(
1072
- (u) => W.has(u.id) && !u.disabled && !u.hidden && !u.groupHeader
1073
- );
1074
- }
1075
- Y === -1 && (Y = l.findIndex((W) => !W.disabled && !W.hidden && !W.groupHeader)), Z(Y);
1076
- }, [t, l, c]);
1077
- const w = C((x, P) => {
1078
- const Y = (_) => _ && !_?.groupHeader && (!_?.group || $?.has(_?.group)) && !_?.disabled && !_?.loading, W = l.length;
1079
- if (W === 0) return -1;
1080
- let u = x;
1081
- for (let _ = 0; _ < W; _++) {
1082
- if (u = (u + P + W) % W, !S && v && (P > 0 && u === 0 || P < 0 && u === W - 1))
1083
- return x;
1084
- if (Y(l[u])) return u;
1085
- }
1086
- return x;
1087
- }, [l, v, S, $]), z = C((x) => {
1088
- const P = x.relatedTarget?.closest(".rac-options");
1089
- !x.currentTarget.contains(x.relatedTarget) && !P && (J && p({ deleting: !1 }), t && n(!1));
1090
- }, [J, t, p, n]), I = C(() => {
1091
- e || J || document.hidden || Date.now() - m.current.lastWindowFocusTime < 100 || t || (clearTimeout(m.current.focusTimeout), m.current.focusTimeout = setTimeout(() => m.current.justFocused = !1, 200), m.current.justFocused = !0, n(!0));
1092
- }, [e, t, n, J]), K = Pe(() => D?.()), L = Pe(() => X?.());
1093
- ne(() => {
1094
- t ? K() : L();
1095
- }, [t]);
1096
- const B = C((x) => {
1097
- e || J || x?.target?.closest(".rac-select-cancel") || m.current.justFocused || n(!t);
1098
- }, [e, t, n, D, X, J]), V = C((x) => {
1099
- if (!e)
1100
- switch (x.key) {
1101
- case "Enter":
1102
- case " ":
1103
- x.preventDefault(), t ? M !== -1 && l[M] && s(l[M], x) : n(!0);
1104
- break;
1105
- case "Escape":
1106
- x.preventDefault(), n(!1);
1107
- break;
1108
- case "ArrowDown":
1109
- x.preventDefault(), t ? Z((P) => w(P, 1)) : n(!0);
1110
- break;
1111
- case "ArrowUp":
1112
- x.preventDefault(), t ? Z((P) => w(P, -1)) : n(!0);
1113
- break;
1114
- case "Tab":
1115
- t && n(!1);
1116
- break;
1117
- }
1118
- }, [e, t, n, M, l, s, w]);
1119
- return ce(() => ({ handleBlur: z, handleFocus: I, toggleVisibility: B, handleKeyDown: V, highlightedIndex: M, setHighlightedIndex: Z, handleListScroll: a }), [z, I, B, V, M, a]);
1120
- }
1121
- const Et = ["group", "disabled", "options", "items", "children"], Re = ["name", "label", "id", "value"], ze = [], we = (e, t = !1) => {
1122
- if (t && typeof e.group == "string") return e.group;
1123
- const n = Re.find((s) => e[s] != null && e[s] !== "");
1124
- if (n) return String(e[n]);
1125
- const l = Object.entries(e).find(([s, p]) => !Et.includes(s) && p != null && p !== "");
1126
- return l ? String(l[1]) : null;
1127
- };
1128
- function Tt({
1129
- options: e = ze,
1130
- jsxOptions: t = ze,
1131
- value: n,
1132
- onChange: l,
1133
- disabled: s = !1,
1134
- loading: p = !1,
1135
- error: c = !1,
1136
- multiple: j = !1,
1137
- placeholder: T = "Choose option",
1138
- emptyText: v = "No options",
1139
- disabledText: o = "Disabled",
1140
- loadingText: S = "Loading",
1141
- errorText: f = "Failed to load",
1142
- disabledOption: O = "Disabled option",
1143
- emptyOption: R = "Empty option",
1144
- invalidOption: $ = "Invalid option",
1145
- setVisibility: D,
1146
- hasMore: X,
1147
- loadButton: J,
1148
- setState: M,
1149
- loadingTitle: Z,
1150
- loadMoreText: m,
1151
- loadMore: U,
1152
- childrenFirst: a = !1,
1153
- groupsClosed: w = !1
1154
- }) {
1155
- const z = n !== void 0, [I, K] = Se(() => {
1156
- const i = /* @__PURE__ */ new Set();
1157
- if (w) return i;
1158
- const g = (y) => {
1159
- Array.isArray(y) && y.forEach((E) => {
1160
- if (E && typeof E == "object") {
1161
- if (("options" in E || "group" in E && !Re.some((H) => H in E)) && !E.disabled) {
1162
- const H = we(E, !0) || "Empty group";
1163
- i.add(H);
1164
- }
1165
- E.options && g(E.options);
1166
- }
1167
- });
1168
- };
1169
- return g(e), i;
1170
- }), L = ie(null), B = C((i) => {
1171
- K((g) => {
1172
- const y = new Set(g);
1173
- return y.has(i) ? y.delete(i) : y.add(i), y;
1174
- });
1175
- }, []), V = C((i, g, y = "n", E = null, k = !1) => {
1176
- const H = `${y}-${g}`;
1177
- if (i == null || i === "" || i === void 0)
1178
- return {
1179
- name: R,
1180
- disabled: !0,
1181
- type: "normal",
1182
- groupDisabled: k,
1183
- userId: null,
1184
- raw: i,
1185
- group: E,
1186
- id: H
1187
- };
1188
- if (typeof i == "function")
1189
- return { id: H, userId: null, name: $, raw: i, disabled: !0, invalid: !0, type: "normal", group: E };
1190
- if (typeof i == "object" && !Array.isArray(i)) {
1191
- const ee = E || i.group || null, re = k || i.disabled === !0, ue = i.id ?? i.value ?? i.name ?? i.label, oe = i.value !== void 0 ? i.value : i.id !== void 0 ? i.id : i;
1192
- let h = we(i) || (re ? O : R);
1193
- return {
1194
- id: H,
1195
- userId: ue,
1196
- name: h,
1197
- raw: oe,
1198
- original: i,
1199
- disabled: re || h === R && !re,
1200
- type: typeof oe == "boolean" ? "boolean" : "normal",
1201
- group: ee,
1202
- groupDisabled: k
1203
- };
1204
- }
1205
- return {
1206
- id: H,
1207
- userId: i,
1208
- name: String(i),
1209
- raw: i,
1210
- original: i,
1211
- disabled: k,
1212
- type: typeof i == "boolean" ? "boolean" : "normal",
1213
- group: E
1214
- };
1215
- }, [R, $, O]), x = ce(() => {
1216
- const i = /* @__PURE__ */ new Map(), g = [], y = t.map((h, q) => {
1217
- if (h.isGroupMarker) return { ...h, type: "group-marker" };
1218
- const te = !h.label && !h.userId && !h.value && (h.value === void 0 || h.value === null || h.value === "") && !h.hasJsx;
1219
- return {
1220
- ...h,
1221
- id: `jsx-${h.id}`,
1222
- index: q,
1223
- userId: h.userId,
1224
- raw: h.value,
1225
- original: h.value,
1226
- name: te ? R : h.label || h.userId || String(h.value || ""),
1227
- disabled: !!h.disabled || te,
1228
- type: typeof h.value == "boolean" ? "boolean" : "normal",
1229
- group: h.group || null
1230
- };
1231
- });
1232
- let E = 0;
1233
- const k = (h, q = null, te = !1, le = "0") => {
1234
- Array.isArray(h) || (h = [h]), h.forEach((F, ge) => {
1235
- const ae = `${le}-${ge}`, de = F != null && typeof F == "object" && !Array.isArray(F);
1236
- if (de && ("options" in F || "group" in F && !Re.some((se) => se in F))) {
1237
- const se = we(F, !0) || "Empty group";
1238
- i.has(se) || i.set(se, { disabled: !!F.disabled, closedByDefault: !!F.disabled || w, items: [] }), F.options ? k(F.options, se, te || !!F.disabled, ae) : g.push({ id: `empty-${se}-${ae}`, name: se, group: se, isPlaceholder: !0, type: "group-marker", index: E++ });
1239
- } else if (de && !Re.some((se) => se in F) && !F.group)
1240
- Object.entries(F).forEach(([se, Ee], Te) => {
1241
- const N = V(Ee, `${ae}-${Te}`, "default", q, te);
1242
- g.push({ ...N, index: E++ });
1243
- });
1244
- else {
1245
- const se = V(F, ae, "default", q, te);
1246
- g.push({ ...se, index: E++ });
1247
- }
1248
- });
1249
- };
1250
- k(e);
1251
- const H = a ? [...y, ...g] : [...g, ...y];
1252
- if (!L.current)
1253
- L.current = new Map(H.map((h, q) => [h.id, q]));
1254
- else {
1255
- let h = !1;
1256
- if (H.forEach((q) => {
1257
- L.current.has(q.id) || (h = !0);
1258
- }), h) {
1259
- const q = /* @__PURE__ */ new Map();
1260
- H.forEach((te, le) => {
1261
- q.set(te.id, le);
1262
- }), L.current = q;
1263
- }
1264
- }
1265
- const ee = [...H].sort((h, q) => {
1266
- const te = L.current.get(h.id) ?? 999999, le = L.current.get(q.id) ?? 999999;
1267
- return te - le;
1268
- }), re = [], ue = /* @__PURE__ */ new Set();
1269
- ee.forEach((h) => {
1270
- if (!h.group)
1271
- re.push({ type: "item", data: h });
1272
- else {
1273
- ue.has(h.group) || (ue.add(h.group), re.push({ type: "group", name: h.group }));
1274
- const q = i.get(h.group) || { items: [] };
1275
- i.has(h.group) || i.set(h.group, q), h.isGroupMarker ? (q.className = h.className, q.style = h.style, h.disabled && (q.disabled = !0)) : h.isPlaceholder || q.items.push(h);
833
+ wn(y)
834
+ ) : null;
835
+ }), mt = [];
836
+ function Sn({ props: e, jsxOptions: t, state: n, setState: r, setVisibility: s, loadMoreOnce: c }) {
837
+ const { onChange: i, disabled: a, loading: o, error: p, multiple: l, childrenFirst: g, groupsClosed: y, hasMore: h, loadButton: S, placeholder: w, selectedText: f, texts: m } = e, { disabledOption: D, emptyOption: L, invalidOption: C, emptyGroup: j } = m, { loadPending: M, internalValue: u, toggledGroups: x, picked: E } = n, $ = Ne(e.options), k = Ne(e.value), V = k !== void 0, I = V ? k : u, A = M ? m.loadingMore : m.loadMore, b = _(() => Gt({
838
+ options: $,
839
+ jsxOptions: t,
840
+ childrenFirst: g,
841
+ hasMore: h,
842
+ loadButton: S,
843
+ loadPending: M,
844
+ loadingTitle: A,
845
+ emptyOption: L,
846
+ invalidOption: C,
847
+ disabledOption: D,
848
+ emptyGroup: j
849
+ }), [$, t, g, h, S, M, A, L, C, D, j]), d = _(() => new Set(
850
+ b.filter((N) => N.groupHeader && !N.disabled && y === x.has(N.name)).map((N) => N.name)
851
+ ), [b, x, y]), { selected: v, selectedIDs: T } = _(() => zt(I, b, l, E), [I, b, l, E]), H = b.length > 0, J = !a && H, P = I != null && !(Array.isArray(I) && !I.length) && !(Se(I) && !Object.keys(I).length), G = P && f ? null : v, ee = _(() => P && f ? f : v ? v.name : p ? m.error : o ? m.loading : a ? m.disabled : H ? w : m.empty, [p, o, a, P, f, v, H, w, m]), z = (N) => r((W) => {
852
+ const te = new Set(W.toggledGroups);
853
+ return te.has(N) ? te.delete(N) : te.add(N), { toggledGroups: te };
854
+ }), R = (N, W, te) => {
855
+ r(V ? { picked: te } : { internalValue: N, picked: te }), i?.(N, W);
856
+ }, pe = (N) => R(N.map((W) => W.original), N.map((W) => W.userId), N.map((W) => W.id)), We = Re({
857
+ toggleGroup: z,
858
+ selectOption: (N, W) => {
859
+ if (N.groupHeader) {
860
+ Q(W), N.disabled || z(N.name);
861
+ return;
1276
862
  }
1277
- });
1278
- const oe = [];
1279
- return re.forEach((h) => {
1280
- if (h.type === "item")
1281
- oe.push(h.data);
1282
- else {
1283
- const q = h.name, te = i.get(q), le = I.has(q);
1284
- oe.push({
1285
- className: te?.className || "",
1286
- id: `group-header-${q}`,
1287
- disabled: !!te?.disabled,
1288
- style: te?.style || {},
1289
- groupHeader: !0,
1290
- name: q,
1291
- type: "group",
1292
- hidden: !1,
1293
- expanded: le
1294
- }), te?.items.forEach((F) => {
1295
- const ge = I.size > 0 ? !le : !!w;
1296
- oe.push({ ...F, hidden: ge });
1297
- });
863
+ if (N.disabled || N.loadMore) {
864
+ Q(W), N.loadMore && !N.loading && c();
865
+ return;
1298
866
  }
1299
- }), X && J && oe.push({
1300
- id: "special-load-more-id",
1301
- name: Z,
1302
- loadMore: !0,
1303
- loading: Z === m,
1304
- type: "special"
1305
- }), oe;
1306
- }, [e, t, V, a, X, J, Z, m, w, I, R]), P = C(() => {
1307
- if (n == null || Array.isArray(n) && n.length === 0)
1308
- return { initialId: null, initialIDs: [] };
1309
- const i = /* @__PURE__ */ new Set(), g = (y, E) => {
1310
- let k = x.find((ee) => ee.original === y && !i.has(ee.id));
1311
- if (!k && typeof y == "object")
1312
- try {
1313
- const ee = JSON.stringify(y);
1314
- k = x.find(
1315
- (re) => re.original && typeof re.original == "object" && JSON.stringify(re.original) === ee && !i.has(re.id)
1316
- );
1317
- } catch {
1318
- }
1319
- if (k)
1320
- return i.add(k.id), k;
1321
- const H = typeof y == "object" ? y.id || y.value || JSON.stringify(y) : String(y);
1322
- return typeof y == "object" && y !== null ? {
1323
- id: `virtual-${H}-${E}`,
1324
- name: we(y) || String(y.id || "Selected Object"),
1325
- raw: y.value ?? y.id ?? y,
1326
- original: y,
1327
- userId: y.id ?? y.value ?? null,
1328
- virtual: !0
1329
- } : {
1330
- id: `virtual-${H}-${E}`,
1331
- name: String(y),
1332
- raw: y,
1333
- original: y,
1334
- userId: y,
1335
- virtual: !0
1336
- };
1337
- };
1338
- if (j)
1339
- return { initialId: null, initialIDs: (Array.isArray(n) ? n : [n]).map((k, H) => g(k, H)) };
1340
- {
1341
- const y = Array.isArray(n) ? n[0] : n;
1342
- return { initialId: g(y, 0).id, initialIDs: [] };
1343
- }
1344
- }, [z, n, x, j]), [Y, W] = Se(() => P().initialId), [u, _] = Se(() => P().initialIDs), r = ce(() => {
1345
- const i = x.find((g) => g.id === Y);
1346
- if (i) return i;
1347
- if (!j && Y?.startsWith("virtual-")) {
1348
- const g = Array.isArray(n) ? n[0] : n;
1349
- if (g)
1350
- return {
1351
- id: Y,
1352
- name: typeof g == "object" ? we(g) : String(g),
1353
- original: g
1354
- };
1355
- }
1356
- return null;
1357
- }, [Y, x, j, z, n]), b = C((i, g) => {
1358
- if (i.groupHeader) {
1359
- A(g), i.disabled || B(i.name);
1360
- return;
1361
- }
1362
- if (i.disabled || i.loadMore) {
1363
- A(g), i.loadMore && !i.loading && (M({ loadingTitle: m }), U());
1364
- return;
1365
- }
1366
- if (j) {
1367
- if (i.disabled || i.groupHeader || i.loadMore) {
1368
- A(g);
867
+ if (l) {
868
+ Q(W);
869
+ const te = T.some((Ee) => Ee.id === N.id);
870
+ pe(te ? T.filter((Ee) => Ee.id !== N.id) : [...T, N]);
1369
871
  return;
1370
872
  }
1371
- A(g);
1372
- const E = u?.some((k) => k.id === i.id) ? u.filter((k) => k.id !== i.id) : [...u, i];
1373
- _(E), l?.(E.map((k) => k.original), E.map((k) => k.userId));
1374
- return;
1375
- }
1376
- l?.(i.original, i.userId), W(i.id), D(!1);
1377
- }, [l, D, U, m, B, j, u]), A = C((i) => {
1378
- i?.stopPropagation(), i?.preventDefault();
1379
- }, []), G = C(() => {
1380
- l?.(null, null), W(null), _([]);
1381
- }, [l]), Q = C((i) => {
1382
- const g = u.filter((y) => y.id !== i);
1383
- _(g), l?.(g.map((y) => y.original), g.map((y) => y.userId));
1384
- }, [u, l]);
1385
- return {
1386
- normalizedOptions: x,
1387
- selected: r,
1388
- selectOption: b,
1389
- clear: G,
1390
- removeOption: Q,
1391
- hasOptions: x.length > 0,
1392
- active: !c && !p && !s && x.length > 0,
1393
- selectedValue: n,
1394
- placeholder: T,
1395
- emptyText: v,
1396
- disabledText: o,
1397
- loadingText: S,
1398
- errorText: f,
1399
- disabledOption: O,
1400
- emptyOption: R,
1401
- invalidOption: $,
1402
- disabled: s,
1403
- loading: p,
1404
- error: c,
1405
- expandedGroups: I,
1406
- toggleGroup: B,
1407
- selectedIDs: u,
1408
- multiple: j,
1409
- setselectedIDs: _
1410
- };
873
+ v?.id !== N.id && R(N.original, N.userId, [N.id]), s(!1);
874
+ },
875
+ clear: (N) => {
876
+ Q(N), R(l ? [] : null, l ? [] : null, mt);
877
+ },
878
+ removeOption: (N) => pe(T.filter((W) => W.id !== N))
879
+ });
880
+ return { normalizedOptions: b, expandedGroups: d, selected: v, selectedIDs: T, hasOptions: H, active: J, hasActualValue: P, title: ee, valueOption: G, actions: We };
1411
881
  }
1412
- const ke = (e, t = "invalid-option", n = "") => {
1413
- const l = n ? n.replace(/:/g, "") : "";
1414
- if (typeof e != "string" || !e.trim())
1415
- return l ? `${t}-${l}` : `${t}-${Math.random().toString(36).slice(2, 8)}`;
1416
- const s = e.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").replace(/\s+/g, "-").replace(/[^\p{L}\p{N}-]+/gu, "").toLowerCase();
1417
- return s ? s || `${t}-${Math.random().toString(36).slice(2, 8)}` : l ? `${t}-${l}` : `${t}-${Math.random().toString(36).slice(2, 8)}`;
1418
- };
1419
- function jt({ setExternalVisibility: e, externalVisibility: t, loadButtonText: n, loadMoreText: l, ownBehavior: s, loadButton: p, loadOffset: c, loadAhead: j, loadMore: T, hasMore: v, onOpen: o, onClose: S, props: f, ref: O }) {
1420
- const R = qe(), $ = ce(() => R.replace(/:/g, ""), [R]), D = ie(null);
1421
- Je(O, () => D.current);
1422
- const [X, J] = Ge(ut, { loadButton: p, loadButtonText: n, loadMoreText: l }, ct), { internalVisibility: M, animationFinished: Z, jsxOptions: m, deleting: U, loadingTitle: a } = X, w = C((E) => J({ type: "SET", payload: E }), []), z = t !== void 0, I = ce(() => s || z ? !!t : M, [s, z, t, M]), K = C((E) => {
1423
- s || (!z && w({ internalVisibility: E }), e?.(E));
1424
- }, [s, z, e]), L = C((E) => {
1425
- w((k) => {
1426
- const H = k.jsxOptions.findIndex((ee) => ee.id === E.id);
1427
- if (H !== -1) {
1428
- const ee = k[H];
1429
- if (ee.label === E.label && ee.value === E.value && ee.disabled === E.disabled && ee.group === E.group)
1430
- return k;
1431
- const re = [...k];
1432
- return re[H] = E, { jsxOptions: re };
882
+ const En = (e) => ({
883
+ internalVisibility: !1,
884
+ deleting: !1,
885
+ loadPending: !1,
886
+ toggledGroups: /* @__PURE__ */ new Set(),
887
+ internalValue: e.defaultValue,
888
+ picked: mt
889
+ });
890
+ function kn(e, t) {
891
+ const { ref: n, open: r, onOpenChange: s, hasMore: c, loadMore: i, loadButton: a, error: o, disabled: p, loading: l } = e, g = wt(), y = _(() => g.replace(/:/g, ""), [g]), h = F(null);
892
+ xt(n, () => h.current);
893
+ const [S, w] = Ot(kt, e, En), { internalVisibility: f, deleting: m, loadPending: D } = S, [L] = U(() => Me(At)), [C] = U(() => Me({ upward: !1 })), j = r !== void 0, M = j ? !!r : f, u = F(!1), x = F(!1), E = Re({
894
+ // [DOC: select-store]
895
+ setVisibility: (R) => {
896
+ R !== M && (j || w({ internalVisibility: R }), s?.(R));
897
+ },
898
+ // [DOC: select-store]
899
+ loadMoreOnce: () => {
900
+ if (!c || u.current) return;
901
+ if (!i) return le("no loadMore", "`hasMore` is set, but there is no `loadMore` to call.");
902
+ u.current = !0, w({ loadPending: !0 });
903
+ const R = () => w({ loadPending: !1 });
904
+ try {
905
+ i()?.then?.(R, R);
906
+ } catch (pe) {
907
+ u.current = !1, R(), (globalThis.reportError ?? console.error)(pe);
1433
908
  }
1434
- return { jsxOptions: [...k.jsxOptions, E] };
1435
- });
1436
- }, [w]), B = C((E) => w((k) => ({ jsxOptions: k.jsxOptions.filter((H) => H.id !== E) })), []), V = Tt({
1437
- ...f,
1438
- setVisibility: K,
1439
- jsxOptions: m,
1440
- hasMore: v,
1441
- loadButton: p,
1442
- loadingTitle: a,
1443
- loadMore: T,
1444
- loadMoreText: l,
1445
- setState: w
1446
- }), { multiple: x, normalizedOptions: P, selected: Y, selectOption: W, hasOptions: u, selectedValue: _, disabled: r, loading: b, error: A, expandedGroups: G, selectedIDs: Q } = V, i = wt({ setState: w, loadButton: p, loadButtonText: n, hasMore: v, loadMore: T, disabled: r, multiple: x, open: I, setOpen: K, options: P, selectOption: W, selected: Y, loadOffset: c, loadAhead: j, expandedGroups: G, selectedIDs: Q, onOpen: o, onClose: S, deleting: U }), { highlightedIndex: g } = i;
1447
- ne(() => {
1448
- I && D.current && document.activeElement !== D.current && D.current.focus(), !I && w({ animationFinished: !1 });
1449
- }, [I]), ne(() => {
1450
- (A || r || b || !u) && K(!1);
1451
- }, [A, r, b, u, K]), ne(() => {
1452
- z && w({ internalVisibility: !!t });
1453
- }, [t, z]), ne(() => {
1454
- if (I && Z && g !== -1) {
1455
- const E = P[g];
1456
- E && document.getElementById(`${$}-${ke(E.id)}`)?.scrollIntoView({ block: "nearest" });
1457
- }
1458
- }, [g, I, Z, P, $]);
1459
- const y = ce(() => _ != null && !(Array.isArray(_) && _.length === 0) && !(typeof _ == "object" && Object.keys(_).length === 0), [_]);
1460
- return { selectId: $, selectRef: D, visibility: I, setVisibility: K, animationFinished: Z, setAnimationFinished: (E) => w({ animationFinished: E }), deleting: U, loadingTitle: a, jsxOptions: m, registerOption: L, unregisterOption: B, logic: V, behavior: i, hasActualValue: y };
1461
- }
1462
- function St({ visibility: e, children: t, duration: n = 300, className: l }) {
1463
- const s = ie(null), p = C(() => {
1464
- if (!s.current) return { top: "0px", bottom: "0px" };
1465
- const c = window.getComputedStyle(s.current);
1466
- return { top: c.marginTop, bottom: c.marginBottom };
1467
- }, []);
1468
- return /* @__PURE__ */ d.jsx(
1469
- Ie,
1470
- {
1471
- onEnter: () => {
1472
- s.current.style.height = "0px", s.current.style.marginTop = "0px", s.current.style.marginBottom = "0px";
1473
- },
1474
- onEntering: () => {
1475
- const { top: c, bottom: j } = p();
1476
- s.current.style.height = s.current.scrollHeight + "px", s.current.style.marginBottom = j, s.current.style.marginTop = c;
1477
- },
1478
- onEntered: () => s.current.style.height = "auto",
1479
- onExit: () => {
1480
- const { top: c, bottom: j } = p();
1481
- s.current.style.height = s.current.scrollHeight + "px", s.current.style.marginBottom = j, s.current.style.marginTop = c, s.current.offsetHeight;
1482
- },
1483
- onExiting: () => {
1484
- s.current.style.height = "0px", s.current.style.marginTop = "0px", s.current.style.marginBottom = "0px";
1485
- },
1486
- classNames: "rac-slide-down",
1487
- timeout: n,
1488
- nodeRef: s,
1489
- in: e,
1490
- unmountOnExit: !0,
1491
- children: /* @__PURE__ */ d.jsx(
1492
- "div",
1493
- {
1494
- style: {
1495
- transition: `height ${n}ms ease, margin ${n}ms ease`,
1496
- overflow: "hidden"
1497
- },
1498
- className: `${l} rac-slide-down-enter-done`,
1499
- ref: s,
1500
- tabIndex: -1,
1501
- children: t
1502
- }
1503
- )
1504
- }
1505
- );
909
+ },
910
+ setListReady: (R) => L.set({ ready: R }),
911
+ setDeleting: (R) => w({ deleting: R })
912
+ }), $ = Sn({ props: e, jsxOptions: t, state: S, setState: w, setVisibility: E.setVisibility, loadMoreOnce: E.loadMoreOnce }), { normalizedOptions: k, expandedGroups: V, selected: I, selectedIDs: A, hasOptions: b, active: d, hasActualValue: v, title: T, valueOption: H, actions: J } = $, P = d && M, G = Vt({
913
+ props: e,
914
+ state: S,
915
+ setState: w,
916
+ normalizedOptions: k,
917
+ expandedGroups: V,
918
+ selected: I,
919
+ selectedIDs: A,
920
+ visibility: P,
921
+ highlightStore: L,
922
+ setVisibility: E.setVisibility,
923
+ loadMoreOnce: E.loadMoreOnce,
924
+ modelActions: J
925
+ });
926
+ oe(() => {
927
+ w({ loadPending: !1 });
928
+ }, [k.length, c, a]), oe(() => {
929
+ D || (u.current = !1);
930
+ }, [D]), oe(() => {
931
+ P && h.current && document.activeElement !== h.current && h.current.focus(), P || L.set({ index: -1, ready: !1 });
932
+ }, [P, L]), oe(() => {
933
+ x.current && !d && E.setVisibility(!1), x.current = d;
934
+ }, [d, E]);
935
+ const ee = _(() => ({ ...E, ...J, ...G }), [E, J, G]), z = _(() => ({
936
+ visibility: P,
937
+ deleting: m,
938
+ loadPending: D,
939
+ expandedGroups: V,
940
+ selectedIDs: A,
941
+ normalizedOptions: k,
942
+ selected: I,
943
+ hasOptions: b,
944
+ active: d,
945
+ hasActualValue: v,
946
+ title: T,
947
+ valueOption: H,
948
+ disabled: p,
949
+ loading: l,
950
+ error: o
951
+ }), [P, m, D, V, A, k, I, b, d, v, T, H, p, l, o]);
952
+ return { selectId: y, selectRef: h, highlightStore: L, positionStore: C, state: z, actions: ee };
1506
953
  }
1507
- const Nt = Ve(({
1508
- loadMore: e = () => console.warn("loadMore not implemented"),
1509
- setVisibility: t = () => {
1510
- },
1511
- visibility: n,
1512
- loadButtonText: l = "Load more",
1513
- Checkmark: s = at,
1514
- loadMoreText: p = "Loading",
1515
- selectedText: c = void 0,
1516
- OpenIcon: j = lt,
1517
- animateOpacity: T = !0,
1518
- ClearIcon: v = We,
1519
- optionsClassName: o = "",
1520
- Checkbox: S = void 0,
1521
- deleteInline: f = !1,
1522
- ownBehavior: O = !1,
1523
- DelIcon: R = We,
1524
- onClose: $ = () => {
1525
- },
1526
- showDelete: D = !1,
1527
- easing: X = "ease-in",
1528
- loadButton: J = !1,
1529
- onOpen: M = () => {
954
+ const Cn = {}, Z = (e) => e != null && e !== "", Pe = (e) => e ? typeof e == "string" || typeof e == "number" ? String(e) : Array.isArray(e) ? e.map(Pe).join(" ").replace(/\s+/g, " ").trim() : xe(e) ? Pe(e.props.children) : "" : "", Tn = ({ name: e, label: t, id: n, value: r, className: s, style: c, children: i, disabled: a, group: o }, p, l) => {
955
+ const g = Pe(i), y = r !== void 0 ? r : g;
956
+ return i != null && !g && !Z(t) && !Z(e) && !Z(n) && !Z(r) && le("no text", "<Option> has content but no text to show in the title or chips. Add a `label` (or `value`), or enable `valueAsOption`."), {
957
+ id: Z(n) ? String(n) : p,
958
+ userId: Z(n) ? n : y,
959
+ value: y,
960
+ label: Z(t) ? String(t) : Z(e) ? String(e) : g || (Z(n) ? String(n) : ""),
961
+ jsx: i,
962
+ hasJsx: i != null,
963
+ className: s,
964
+ style: c,
965
+ disabled: !!a,
966
+ group: o || l || null
967
+ };
968
+ }, Mn = ({ name: e, label: t, value: n, id: r, disabled: s, className: c = "", style: i = Cn }, a) => {
969
+ const o = e ?? t ?? r ?? n;
970
+ return { disabled: !!s, isGroupMarker: !0, group: Z(o) ? String(o) : a, className: c, style: i };
971
+ }, In = (e) => `<${typeof e == "string" ? e : e?.displayName || e?.name || "Component"}>`, me = (e, t, n = null, r = "o", s = []) => (it.toArray(e).forEach((c) => {
972
+ if (!xe(c)) {
973
+ le("text", `Text inside <Select> or <OptGroup> is ignored ("${String(c).slice(0, 30)}"). Wrap it in <Option>.`);
974
+ return;
975
+ }
976
+ const i = `${r}-${String(c.key).slice(1).replace(/[:$]/g, (o) => o === ":" ? "-" : "k").replace(/[^\p{L}\p{N}-]/gu, "")}`, a = c.type?.racKind;
977
+ if (c.type === at) me(c.props.children, t, n, i, s);
978
+ else if (a === "option") s.push(Tn(c.props, i, n));
979
+ else if (a === "define") me(c.type.racRender(c.props), t, n, i, s);
980
+ else if (a === "group") {
981
+ const o = Mn(c.props, t);
982
+ s.push(o), me(c.props.children, t, o.group, i, s);
983
+ } else {
984
+ const o = In(c.type);
985
+ le(`child ${o}`, `${o} inside <Select> is ignored: only <Option/>, <OptGroup/> and defineOption() components are read. Put custom content inside <Option>, or wrap the component with defineOption().`);
986
+ }
987
+ }), s), Nn = /* @__PURE__ */ new Set(["ref", "options", "value", "defaultValue", "onChange", "children", "loadMore", "open", "onOpenChange", "onFocus", "onBlur", "childrenFirst", "groupsClosed", "disabled", "loading", "error"]), An = /^(aria|data)-/, Ce = {
988
+ options: [],
989
+ value: void 0,
990
+ defaultValue: void 0,
991
+ onChange: void 0,
992
+ multiple: !1,
993
+ childrenFirst: !1,
994
+ groupsClosed: !1,
995
+ disabled: !1,
996
+ loading: !1,
997
+ error: !1,
998
+ open: void 0,
999
+ onOpenChange: void 0,
1000
+ onFocus: void 0,
1001
+ onBlur: void 0,
1002
+ id: void 0,
1003
+ name: void 0,
1004
+ required: !1,
1005
+ hasMore: !1,
1006
+ loadMore: void 0,
1007
+ loadButton: !1,
1008
+ loadOffset: 100,
1009
+ loadAhead: 3,
1010
+ placeholder: "Choose option",
1011
+ selectedText: void 0,
1012
+ texts: {
1013
+ empty: "No options",
1014
+ disabled: "Disabled",
1015
+ loading: "Loading",
1016
+ error: "Failed to load",
1017
+ clear: "Clear selection",
1018
+ remove: "Remove",
1019
+ loadMore: "Load more",
1020
+ loadingMore: "Loading",
1021
+ emptyOption: "Empty option",
1022
+ invalidOption: "Invalid option",
1023
+ disabledOption: "Disabled option",
1024
+ emptyGroup: "Empty group",
1025
+ list: "Options"
1530
1026
  },
1531
- loadOffset: Z = 100,
1532
- hasMore: m = !1,
1533
- className: U = "",
1534
- duration: a = 300,
1535
- loadAhead: w = 3,
1536
- offset: z = 1,
1537
- style: I = {},
1538
- children: K,
1539
- unmount: L,
1540
- ...B
1541
- }, V) => {
1542
- const x = jt({ externalVisibility: n, setExternalVisibility: t, ownBehavior: O, loadButton: J, loadButtonText: l, loadMoreText: p, loadMore: e, loadOffset: Z, loadAhead: w, hasMore: m, onOpen: M, onClose: $, ref: V, props: B }), { logic: P, behavior: Y, selectId: W, hasActualValue: u, loadingTitle: _ } = x, { normalizedOptions: r, selected: b, multiple: A, selectedIDs: G, invalidOption: Q, selectOption: i, hasOptions: g, error: y, loading: E, disabled: k, selectedValue: H, expandedGroups: ee, placeholder: re, emptyText: ue, errorText: oe, loadingText: h, disabledText: q } = P, { highlightedIndex: te, setHighlightedIndex: le } = Y, F = ce(() => {
1543
- if (y) return oe;
1544
- if (E) return h;
1545
- if (k) return q;
1546
- if (u && c) return c;
1547
- if (b) return b.jsx ?? b.name;
1548
- if (u) {
1549
- const ae = r.find((de) => de.raw === H);
1550
- return ae ? ae.name : typeof H == "object" && H !== null ? H.name ?? H.label ?? "Selected Object" : String(H);
1551
- }
1552
- return g ? re : ue;
1553
- }, [k, E, y, g, b, H, re, oe, h, q, ue, u, r]), ge = ce(() => {
1554
- const ae = [];
1555
- let de = [], me = null;
1556
- const se = r.reduce((N, fe) => (fe.group && (N[fe.group] = (N[fe.group] || 0) + 1), N), {}), Ee = (N) => {
1557
- N === null || de.length === 0 || (ae.push(
1558
- /* @__PURE__ */ d.jsx(
1559
- St,
1560
- {
1561
- visibility: ee.has(N),
1562
- className: "rac-group-container",
1563
- duration: a,
1564
- children: de
1565
- },
1566
- `slide-${N}`
1567
- )
1568
- ), de = []);
1569
- }, Te = (N, fe) => /* @__PURE__ */ d.jsxs(
1570
- "div",
1571
- {
1572
- className: dt(N, fe, te, b?.id, _, p, Q, G),
1573
- style: { ...N.style, ...N.loading ? { justifyContent: "initial", alignItems: "end", gap: 0 } : {} },
1574
- onMouseEnter: () => !N.disabled && !N.loading && le(fe),
1575
- onClick: (pe) => !N.loading && i(N, pe),
1576
- "aria-disabled": N.disabled || N.loading,
1577
- "aria-selected": b?.id === N.id,
1578
- id: `${W}-${ke(N.id)}`,
1579
- role: "option",
1580
- children: [
1581
- N.jsx ? /* @__PURE__ */ d.jsx("div", { className: "rac-jsx-option", children: N.jsx }) : /* @__PURE__ */ d.jsx("span", { className: "rac-option-title", children: N.name }),
1582
- N.loading && /* @__PURE__ */ d.jsxs(
1583
- "span",
1584
- {
1585
- style: { paddingBottom: "0.1em" },
1586
- className: "rac-loading-dots",
1587
- children: [
1588
- /* @__PURE__ */ d.jsx("i", {}),
1589
- /* @__PURE__ */ d.jsx("i", {}),
1590
- /* @__PURE__ */ d.jsx("i", {})
1591
- ]
1592
- }
1593
- ),
1594
- A && !N.disabled && /* @__PURE__ */ d.jsxs("div", { className: `rac-checkbox${S ? "" : "-default"}`, children: [
1595
- he(s, {
1596
- style: { position: S ? "" : "relative" },
1597
- className: `
1598
- rac-checkmark
1599
- ${G?.some((pe) => pe.id === N.id) ? "--checked" : ""}`
1600
- }),
1601
- he(S, { className: "rac-check-box" })
1602
- ] })
1603
- ]
1604
- },
1605
- N.id
1606
- );
1607
- return r.forEach((N, fe) => {
1608
- const pe = N.groupHeader, Ce = !!N.group;
1609
- if ((pe || !Ce && me !== null) && (Ee(me), pe || (me = null)), pe) {
1610
- me = N.name;
1611
- const Ze = ee.has(N.name), Qe = se[N.name] > 0;
1612
- ae.push(
1613
- /* @__PURE__ */ d.jsxs(
1614
- "div",
1615
- {
1616
- className: [
1617
- "rac-group-header",
1618
- N.disabled && "rac-disabled-group",
1619
- N.className
1620
- ].filter(Boolean).join(" "),
1621
- onClick: (et) => i(N, et),
1622
- style: N.style,
1623
- id: N.id,
1624
- children: [
1625
- /* @__PURE__ */ d.jsx("span", { className: "rac-group-title-text", children: N.name }),
1626
- /* @__PURE__ */ d.jsx(
1627
- ye,
1628
- {
1629
- visibility: Qe && !N.disabled,
1630
- style: { display: "grid" },
1631
- duration: a,
1632
- children: he(j, { className: `rac-group-arrow ${Ze ? "--open" : ""}` })
1633
- }
1634
- )
1635
- ]
1636
- },
1637
- N.id
1638
- )
1639
- );
1640
- } else Ce ? de.push(Te(N, fe)) : ae.push(Te(N, fe));
1641
- }), Ee(me), ae;
1642
- }, [r, i, W, b, te, _, p, Q, le, ee, j]);
1643
- return /* @__PURE__ */ d.jsx(
1644
- vt,
1645
- {
1646
- optionsClassName: o,
1647
- animateOpacity: T,
1648
- renderOptions: ge,
1649
- deleteInline: f,
1650
- showDelete: D,
1651
- className: U,
1652
- ClearIcon: v,
1653
- Checkmark: s,
1654
- OpenIcon: j,
1655
- Checkbox: S,
1656
- duration: a,
1657
- children: K,
1658
- DelIcon: R,
1659
- unmount: L,
1660
- ...x,
1661
- easing: X,
1662
- offset: z,
1663
- title: F,
1664
- style: I,
1665
- ...Y,
1666
- ...P
1667
- }
1668
- );
1669
- }), Ke = Ye(null);
1670
- function Ot({ children: e, name: t, label: n, value: l, id: s, disabled: p, emptyGroupText: c = "Empty group", className: j = "", style: T = {} }) {
1671
- const v = Oe(Ae), o = ce(() => {
1672
- const f = t ?? n ?? s ?? l;
1673
- return f != null && f !== "" ? String(f) : c;
1674
- }, [t, n, l, s, c]), S = ce(() => `group-marker-${ke(o)}`, [o]);
1675
- return ne(() => {
1676
- if (!v) return;
1677
- const f = {
1678
- disabled: !!p,
1679
- isGroupMarker: !0,
1680
- group: o,
1681
- id: S,
1682
- className: j,
1683
- style: T
1684
- };
1685
- return v.registerOption(f), () => v.unregisterOption(S);
1686
- }, [v.registerOption, v.unregisterOption, S, o]), /* @__PURE__ */ d.jsx(Ke.Provider, { value: o, children: e });
1027
+ renderOption: void 0,
1028
+ valueAsOption: !1,
1029
+ icons: { arrow: he.ArrowUp, clear: he.XMark, remove: he.XMark, check: he.Checkmark, checkbox: void 0 },
1030
+ deleteInline: !1,
1031
+ deleteAlways: !1,
1032
+ className: "",
1033
+ optionsClassName: "",
1034
+ style: {},
1035
+ container: void 0,
1036
+ duration: 300,
1037
+ easing: "ease",
1038
+ offset: 1,
1039
+ animateOpacity: !0,
1040
+ keepMounted: !1
1041
+ }, st = {
1042
+ visibility: "open",
1043
+ setVisibility: "onOpenChange",
1044
+ ownBehavior: "open without onOpenChange",
1045
+ onOpen: "onOpenChange",
1046
+ onClose: "onOpenChange",
1047
+ unmount: "keepMounted (inverted)",
1048
+ showDelete: "deleteAlways",
1049
+ OpenIcon: "icons.arrow",
1050
+ ClearIcon: "icons.clear",
1051
+ DelIcon: "icons.remove",
1052
+ Checkmark: "icons.check",
1053
+ Checkbox: "icons.checkbox",
1054
+ emptyText: "texts.empty",
1055
+ disabledText: "texts.disabled",
1056
+ loadingText: "texts.loading",
1057
+ errorText: "texts.error",
1058
+ clearText: "texts.clear",
1059
+ removeText: "texts.remove",
1060
+ loadButtonText: "texts.loadMore",
1061
+ loadMoreText: "texts.loadingMore",
1062
+ emptyOption: "texts.emptyOption",
1063
+ invalidOption: "texts.invalidOption",
1064
+ disabledOption: "texts.disabledOption"
1065
+ }, Te = (e, t) => {
1066
+ const n = { ...e };
1067
+ for (const r in t) t[r] !== void 0 && (n[r] = t[r]);
1068
+ return n;
1069
+ };
1070
+ function Vn(e) {
1071
+ for (const h in e) h in st && le(`renamed ${h}`, `The \`${h}\` prop was removed. Use \`${st[h]}\`.`);
1072
+ e.value !== void 0 && !e.onChange && le("read-only value", "`value` is set without `onChange`, so the Select is read-only. Pass `onChange`, or `defaultValue` instead of `value`.");
1073
+ const t = Te(Ce, e);
1074
+ t.texts = Te(Ce.texts, e.texts), t.icons = Te(Ce.icons, e.icons);
1075
+ const n = t.texts.emptyGroup, r = Ne(_(() => me(t.children, n), [t.children, n])), { selectId: s, selectRef: c, highlightStore: i, positionStore: a, state: o, actions: p } = kn(t, r), l = {}, g = {};
1076
+ for (const h in t) Nn.has(h) || ((An.test(h) ? g : l)[h] = t[h]);
1077
+ const y = It({ ...l, attrs: g, selectId: s, selectRef: c, highlightStore: i, positionStore: a });
1078
+ return /* @__PURE__ */ O(Y.Provider, { value: y, children: /* @__PURE__ */ O(ce.Provider, { value: p, children: /* @__PURE__ */ q(de.Provider, { value: o, children: [
1079
+ /* @__PURE__ */ O(fn, {}),
1080
+ /* @__PURE__ */ O(On, {})
1081
+ ] }) }) });
1687
1082
  }
1688
- const _e = (e) => e ? typeof e == "string" || typeof e == "number" ? String(e) : Array.isArray(e) ? e.map(_e).join(" ").replace(/\s+/g, " ").trim() : Be.isValidElement(e) ? _e(e.props.children) : "" : "";
1689
- function _t({ name: e, label: t, id: n, value: l, className: s, style: p, children: c, disabled: j, group: T }) {
1690
- const v = Oe(Ae), o = Oe(Ke), S = v?.registerOption, f = v?.unregisterOption, O = qe(), R = ce(() => n ? String(n) : O.replace(/:/g, ""), [n, O]);
1691
- return ne(() => {
1692
- if (!S) return;
1693
- const $ = _e(c), D = c != null;
1694
- let X = "";
1695
- return t != null && t !== "" ? X = String(t) : e != null && e !== "" ? X = String(e) : $ ? X = $ : n != null && n !== "" && (X = String(n)), S({
1696
- id: R,
1697
- value: l !== void 0 ? l : $,
1698
- label: X,
1699
- jsx: c,
1700
- hasJsx: D,
1701
- className: s,
1702
- style: p,
1703
- disabled: !!j,
1704
- group: T || o || null
1705
- }), () => f(R);
1706
- }, [R, e, t, l, c, s, p, j, T, o, S, f]), null;
1083
+ function $n() {
1084
+ return le("option outside", "<Option/> was rendered outside <Select>, or inside a component that <Select> cannot read. Use it as a direct child, or wrap the component with defineOption()."), null;
1085
+ }
1086
+ $n.racKind = "option";
1087
+ function Ln() {
1088
+ return null;
1707
1089
  }
1090
+ Ln.racKind = "group";
1708
1091
  export {
1709
- Ot as OptGroup,
1710
- _t as Option,
1711
- Nt as Select
1092
+ Ln as OptGroup,
1093
+ $n as Option,
1094
+ Vn as Select,
1095
+ Rn as defineOption
1712
1096
  };