react-animated-select 0.6.6 → 0.7.0

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