mimir-ui-kit 1.35.3 → 1.36.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. package/dist/{Input-B-gKQ9FT.js → Input-DlGNMuUD.js} +67 -64
  2. package/dist/assets/Accordion.css +1 -1
  3. package/dist/assets/Input.css +1 -1
  4. package/dist/assets/ListPhotos.css +1 -1
  5. package/dist/assets/MultiSelectSearch.css +1 -0
  6. package/dist/assets/SelectSearch.css +1 -1
  7. package/dist/combobox-CDU06zJj.js +2855 -0
  8. package/dist/components/Accordion/Accordion.js +180 -174
  9. package/dist/components/Button/Button.d.ts +36 -0
  10. package/dist/components/Button/Button.js +44 -43
  11. package/dist/components/CheckboxMimir/CheckboxMimir.d.ts +2 -0
  12. package/dist/components/CheckboxMimir/CheckboxMimir.js +37 -30
  13. package/dist/components/Chip/Chip.d.ts +5 -1
  14. package/dist/components/Chip/Chip.js +23 -22
  15. package/dist/components/DatePicker/DatePicker.js +1 -1
  16. package/dist/components/Input/Input.js +1 -1
  17. package/dist/components/Input/index.js +1 -1
  18. package/dist/components/InputPassword/InputPassword.js +1 -1
  19. package/dist/components/InputPhoneNumber/InputPhoneNumber.js +1 -1
  20. package/dist/components/ListPhotos/ListPhotos.js +4 -4
  21. package/dist/components/MultiSelectSearch/MultiSelectSearch.d.ts +22 -0
  22. package/dist/components/MultiSelectSearch/MultiSelectSearch.js +318 -0
  23. package/dist/components/MultiSelectSearch/constants.d.ts +4 -0
  24. package/dist/components/MultiSelectSearch/constants.js +4 -0
  25. package/dist/components/MultiSelectSearch/index.d.ts +3 -0
  26. package/dist/components/MultiSelectSearch/index.js +6 -0
  27. package/dist/components/MultiSelectSearch/types.d.ts +60 -0
  28. package/dist/components/MultiSelectSearch/utils.d.ts +8 -0
  29. package/dist/components/MultiSelectSearch/utils.js +19 -0
  30. package/dist/components/OtpInput/OtpInput.js +1 -1
  31. package/dist/components/SelectSearch/SelectSearch.js +172 -3017
  32. package/dist/components/SelectSearch/utils.d.ts +5 -0
  33. package/dist/components/SelectSearch/utils.js +17 -0
  34. package/dist/components/Switcher/Switcher.js +48 -48
  35. package/dist/components/TabTrail/TabTrail.js +171 -171
  36. package/dist/components/TextArea/TextArea.js +1 -1
  37. package/dist/components/index.js +1 -1
  38. package/dist/index.js +1 -1
  39. package/dist/open-closed-CdldUPoq.js +86 -0
  40. package/dist/use-resolve-button-type-DhFdPxnv.js +12 -0
  41. package/package.json +3 -2
  42. package/dist/open-closed-Cy6VDfYc.js +0 -93
  43. package/dist/use-resolve-button-type-BAxjHhds.js +0 -19
@@ -1,3091 +1,246 @@
1
- import { jsx as Q, jsxs as Fe, Fragment as $t } from "react/jsx-runtime";
2
- import { c as fe } from "../../index-DIxK0V-G.js";
3
- import * as E from "react";
4
- import j, { useReducer as ln, useMemo as K, useSyncExternalStore as Wn, useId as Ye, useEffect as oe, useCallback as Ve, useRef as Y, useLayoutEffect as an, createContext as ve, useContext as ce, useState as ae, Fragment as rt, createRef as Bn, forwardRef as jn } from "react";
5
- import { ESelectSearchSize as we } from "./constants.js";
6
- import { Icon as Lt } from "../../icons/Icon.js";
7
- import { Button as Un } from "../Button/Button.js";
8
- import { I as Ft } from "../../Input-B-gKQ9FT.js";
9
- import { EInputVariant as Yn, EInputSize as ut } from "../Input/constants.js";
10
- import { n as U, u as Rt, d as _e, s as Pe, o as _, p as cn, t as qn, e as ze, W as be, y as Ce, T as Kn, H as xe, M as Nt, a as Ie, $ as un, b as dn, D as St, c as X } from "../../keyboard-B0lm_zyn.js";
11
- import * as We from "react-dom";
12
- import { flushSync as Ee, createPortal as Gn } from "react-dom";
13
- import { w as Jn } from "../../use-active-press-86hajhdd.js";
14
- import { u as Xn } from "../../use-by-comparator-CVuf9KBq.js";
15
- import { K as Qn, a as Zn, b as eo, T as to, z as no, j as oo, u as io, I as Ot, G as ro } from "../../label-y3ANLTNC.js";
16
- import { A as so, h as lo, f as ao, _ as co } from "../../focus-management-XwV-9qkO.js";
17
- import { T as uo } from "../../use-resolve-button-type-BAxjHhds.js";
18
- import { c as fo, i as et, u as po, V as mo, A as ho } from "../../open-closed-Cy6VDfYc.js";
19
- import { r as go } from "../../bugs-diTMAGNw.js";
20
- import '../../assets/SelectSearch.css';function Ne(e, n, t) {
21
- let o = t.initialDeps ?? [], i;
22
- return () => {
23
- var r, l, s, a;
24
- let d;
25
- t.key && ((r = t.debug) != null && r.call(t)) && (d = Date.now());
26
- const u = e();
27
- if (!(u.length !== o.length || u.some((c, m) => o[m] !== c)))
28
- return i;
29
- o = u;
30
- let g;
31
- if (t.key && ((l = t.debug) != null && l.call(t)) && (g = Date.now()), i = n(...u), t.key && ((s = t.debug) != null && s.call(t))) {
32
- const c = Math.round((Date.now() - d) * 100) / 100, m = Math.round((Date.now() - g) * 100) / 100, p = m / 16, h = (v, w) => {
33
- for (v = String(v); v.length < w; )
34
- v = " " + v;
35
- return v;
36
- };
37
- console.info(
38
- `%c⏱ ${h(m, 5)} /${h(c, 5)} ms`,
39
- `
40
- font-size: .6rem;
41
- font-weight: bold;
42
- color: hsl(${Math.max(
43
- 0,
44
- Math.min(120 - 120 * p, 120)
45
- )}deg 100% 31%);`,
46
- t == null ? void 0 : t.key
47
- );
48
- }
49
- return (a = t == null ? void 0 : t.onChange) == null || a.call(t, i), i;
50
- };
51
- }
52
- function dt(e, n) {
53
- if (e === void 0)
54
- throw new Error("Unexpected undefined");
55
- return e;
56
- }
57
- const vo = (e, n) => Math.abs(e - n) < 1, bo = (e, n, t) => {
58
- let o;
59
- return function(...i) {
60
- e.clearTimeout(o), o = e.setTimeout(() => n.apply(this, i), t);
61
- };
62
- }, xo = (e) => e, wo = (e) => {
63
- const n = Math.max(e.startIndex - e.overscan, 0), t = Math.min(e.endIndex + e.overscan, e.count - 1), o = [];
64
- for (let i = n; i <= t; i++)
65
- o.push(i);
66
- return o;
67
- }, yo = (e, n) => {
68
- const t = e.scrollElement;
69
- if (!t)
70
- return;
71
- const o = e.targetWindow;
72
- if (!o)
73
- return;
74
- const i = (l) => {
75
- const { width: s, height: a } = l;
76
- n({ width: Math.round(s), height: Math.round(a) });
77
- };
78
- if (i(t.getBoundingClientRect()), !o.ResizeObserver)
79
- return () => {
80
- };
81
- const r = new o.ResizeObserver((l) => {
82
- const s = l[0];
83
- if (s != null && s.borderBoxSize) {
84
- const a = s.borderBoxSize[0];
85
- if (a) {
86
- i({ width: a.inlineSize, height: a.blockSize });
87
- return;
88
- }
89
- }
90
- i(t.getBoundingClientRect());
91
- });
92
- return r.observe(t, { box: "border-box" }), () => {
93
- r.unobserve(t);
94
- };
95
- }, kt = {
96
- passive: !0
97
- }, Eo = typeof window > "u" ? !0 : "onscrollend" in window, Ro = (e, n) => {
98
- const t = e.scrollElement;
99
- if (!t)
100
- return;
101
- const o = e.targetWindow;
102
- if (!o)
103
- return;
104
- let i = 0;
105
- const r = Eo ? () => {
106
- } : bo(
107
- o,
108
- () => {
109
- n(i, !1);
110
- },
111
- e.options.isScrollingResetDelay
112
- ), l = (d) => () => {
113
- i = t[e.options.horizontal ? "scrollLeft" : "scrollTop"], r(), n(i, d);
114
- }, s = l(!0), a = l(!1);
115
- return a(), t.addEventListener("scroll", s, kt), t.addEventListener("scrollend", a, kt), () => {
116
- t.removeEventListener("scroll", s), t.removeEventListener("scrollend", a);
117
- };
118
- }, So = (e, n, t) => {
119
- if (n != null && n.borderBoxSize) {
120
- const o = n.borderBoxSize[0];
121
- if (o)
122
- return Math.round(
123
- o[t.options.horizontal ? "inlineSize" : "blockSize"]
124
- );
125
- }
126
- return Math.round(
127
- e.getBoundingClientRect()[t.options.horizontal ? "width" : "height"]
128
- );
129
- }, Oo = (e, {
130
- adjustments: n = 0,
131
- behavior: t
132
- }, o) => {
133
- var i, r;
134
- const l = e + n;
135
- (r = (i = o.scrollElement) == null ? void 0 : i.scrollTo) == null || r.call(i, {
136
- [o.options.horizontal ? "left" : "top"]: l,
137
- behavior: t
138
- });
139
- };
140
- class Co {
141
- constructor(n) {
142
- this.unsubs = [], this.scrollElement = null, this.targetWindow = null, this.isScrolling = !1, this.scrollToIndexTimeoutId = null, this.measurementsCache = [], this.itemSizeCache = /* @__PURE__ */ new Map(), this.pendingMeasuredCacheIndexes = [], this.scrollRect = null, this.scrollOffset = null, this.scrollDirection = null, this.scrollAdjustments = 0, this.elementsCache = /* @__PURE__ */ new Map(), this.observer = /* @__PURE__ */ (() => {
143
- let t = null;
144
- const o = () => t || (!this.targetWindow || !this.targetWindow.ResizeObserver ? null : t = new this.targetWindow.ResizeObserver((i) => {
145
- i.forEach((r) => {
146
- this._measureElement(r.target, r);
147
- });
148
- }));
149
- return {
150
- disconnect: () => {
151
- var i;
152
- return (i = o()) == null ? void 0 : i.disconnect();
153
- },
154
- observe: (i) => {
155
- var r;
156
- return (r = o()) == null ? void 0 : r.observe(i, { box: "border-box" });
157
- },
158
- unobserve: (i) => {
159
- var r;
160
- return (r = o()) == null ? void 0 : r.unobserve(i);
161
- }
162
- };
163
- })(), this.range = null, this.setOptions = (t) => {
164
- Object.entries(t).forEach(([o, i]) => {
165
- typeof i > "u" && delete t[o];
166
- }), this.options = {
167
- debug: !1,
168
- initialOffset: 0,
169
- overscan: 1,
170
- paddingStart: 0,
171
- paddingEnd: 0,
172
- scrollPaddingStart: 0,
173
- scrollPaddingEnd: 0,
174
- horizontal: !1,
175
- getItemKey: xo,
176
- rangeExtractor: wo,
177
- onChange: () => {
178
- },
179
- measureElement: So,
180
- initialRect: { width: 0, height: 0 },
181
- scrollMargin: 0,
182
- gap: 0,
183
- indexAttribute: "data-index",
184
- initialMeasurementsCache: [],
185
- lanes: 1,
186
- isScrollingResetDelay: 150,
187
- enabled: !0,
188
- ...t
189
- };
190
- }, this.notify = (t, o) => {
191
- var i, r;
192
- const { startIndex: l, endIndex: s } = this.range ?? {
193
- startIndex: void 0,
194
- endIndex: void 0
195
- }, a = this.calculateRange();
196
- (t || l !== (a == null ? void 0 : a.startIndex) || s !== (a == null ? void 0 : a.endIndex)) && ((r = (i = this.options).onChange) == null || r.call(i, this, o));
197
- }, this.cleanup = () => {
198
- this.unsubs.filter(Boolean).forEach((t) => t()), this.unsubs = [], this.scrollElement = null, this.targetWindow = null, this.observer.disconnect(), this.elementsCache.clear();
199
- }, this._didMount = () => () => {
200
- this.cleanup();
201
- }, this._willUpdate = () => {
202
- var t;
203
- const o = this.options.enabled ? this.options.getScrollElement() : null;
204
- if (this.scrollElement !== o) {
205
- if (this.cleanup(), !o) {
206
- this.notify(!1, !1);
207
- return;
208
- }
209
- this.scrollElement = o, this.scrollElement && "ownerDocument" in this.scrollElement ? this.targetWindow = this.scrollElement.ownerDocument.defaultView : this.targetWindow = ((t = this.scrollElement) == null ? void 0 : t.window) ?? null, this._scrollToOffset(this.getScrollOffset(), {
210
- adjustments: void 0,
211
- behavior: void 0
212
- }), this.unsubs.push(
213
- this.options.observeElementRect(this, (i) => {
214
- this.scrollRect = i, this.notify(!1, !1);
215
- })
216
- ), this.unsubs.push(
217
- this.options.observeElementOffset(this, (i, r) => {
218
- this.scrollAdjustments = 0, this.scrollDirection = r ? this.getScrollOffset() < i ? "forward" : "backward" : null, this.scrollOffset = i;
219
- const l = this.isScrolling;
220
- this.isScrolling = r, this.notify(l !== r, r);
221
- })
222
- );
223
- }
224
- }, this.getSize = () => this.options.enabled ? (this.scrollRect = this.scrollRect ?? this.options.initialRect, this.scrollRect[this.options.horizontal ? "width" : "height"]) : (this.scrollRect = null, 0), this.getScrollOffset = () => this.options.enabled ? (this.scrollOffset = this.scrollOffset ?? (typeof this.options.initialOffset == "function" ? this.options.initialOffset() : this.options.initialOffset), this.scrollOffset) : (this.scrollOffset = null, 0), this.getFurthestMeasurement = (t, o) => {
225
- const i = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
226
- for (let l = o - 1; l >= 0; l--) {
227
- const s = t[l];
228
- if (i.has(s.lane))
229
- continue;
230
- const a = r.get(
231
- s.lane
232
- );
233
- if (a == null || s.end > a.end ? r.set(s.lane, s) : s.end < a.end && i.set(s.lane, !0), i.size === this.options.lanes)
234
- break;
235
- }
236
- return r.size === this.options.lanes ? Array.from(r.values()).sort((l, s) => l.end === s.end ? l.index - s.index : l.end - s.end)[0] : void 0;
237
- }, this.getMeasurementOptions = Ne(
238
- () => [
239
- this.options.count,
240
- this.options.paddingStart,
241
- this.options.scrollMargin,
242
- this.options.getItemKey,
243
- this.options.enabled
244
- ],
245
- (t, o, i, r, l) => (this.pendingMeasuredCacheIndexes = [], {
246
- count: t,
247
- paddingStart: o,
248
- scrollMargin: i,
249
- getItemKey: r,
250
- enabled: l
251
- }),
252
- {
253
- key: !1
254
- }
255
- ), this.getMeasurements = Ne(
256
- () => [this.getMeasurementOptions(), this.itemSizeCache],
257
- ({ count: t, paddingStart: o, scrollMargin: i, getItemKey: r, enabled: l }, s) => {
258
- var a;
259
- if (!l)
260
- return this.measurementsCache = [], this.itemSizeCache.clear(), [];
261
- this.measurementsCache.length === 0 && (this.measurementsCache = this.options.initialMeasurementsCache, this.measurementsCache.forEach((f) => {
262
- this.itemSizeCache.set(f.key, f.size);
263
- }));
264
- const d = this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
265
- this.pendingMeasuredCacheIndexes = [];
266
- const u = this.measurementsCache.slice(0, d);
267
- for (let f = d; f < t; f++) {
268
- let g = (a = this.measurementsCache[f]) == null ? void 0 : a.measureElement;
269
- g || (g = (x) => {
270
- const y = r(f), O = this.elementsCache.get(y);
271
- if (!x) {
272
- O && (this.observer.unobserve(O), this.elementsCache.delete(y));
273
- return;
274
- }
275
- O !== x && (O && this.observer.unobserve(O), this.observer.observe(x), this.elementsCache.set(y, x)), x.isConnected && this.resizeItem(
276
- f,
277
- this.options.measureElement(x, void 0, this)
278
- );
279
- });
280
- const c = r(f), m = this.options.lanes === 1 ? u[f - 1] : this.getFurthestMeasurement(u, f), p = m ? m.end + this.options.gap : o + i, h = s.get(c), v = typeof h == "number" ? h : this.options.estimateSize(f), w = p + v, b = m ? m.lane : f % this.options.lanes;
281
- u[f] = {
282
- index: f,
283
- start: p,
284
- size: v,
285
- end: w,
286
- key: c,
287
- lane: b,
288
- measureElement: g
289
- };
290
- }
291
- return this.measurementsCache = u, u;
292
- },
293
- {
294
- key: process.env.NODE_ENV !== "production" && "getMeasurements",
295
- debug: () => this.options.debug
296
- }
297
- ), this.calculateRange = Ne(
298
- () => [this.getMeasurements(), this.getSize(), this.getScrollOffset()],
299
- (t, o, i) => this.range = t.length > 0 && o > 0 ? To({
300
- measurements: t,
301
- outerSize: o,
302
- scrollOffset: i
303
- }) : null,
304
- {
305
- key: process.env.NODE_ENV !== "production" && "calculateRange",
306
- debug: () => this.options.debug
307
- }
308
- ), this.getIndexes = Ne(
309
- () => [
310
- this.options.rangeExtractor,
311
- this.calculateRange(),
312
- this.options.overscan,
313
- this.options.count
314
- ],
315
- (t, o, i, r) => o === null ? [] : t({
316
- startIndex: o.startIndex,
317
- endIndex: o.endIndex,
318
- overscan: i,
319
- count: r
320
- }),
321
- {
322
- key: process.env.NODE_ENV !== "production" && "getIndexes",
323
- debug: () => this.options.debug
324
- }
325
- ), this.indexFromElement = (t) => {
326
- const o = this.options.indexAttribute, i = t.getAttribute(o);
327
- return i ? parseInt(i, 10) : (console.warn(
328
- `Missing attribute name '${o}={index}' on measured element.`
329
- ), -1);
330
- }, this._measureElement = (t, o) => {
331
- const i = this.indexFromElement(t), r = this.getMeasurements()[i];
332
- if (!r || !t.isConnected) {
333
- this.elementsCache.forEach((s, a) => {
334
- s === t && (this.observer.unobserve(t), this.elementsCache.delete(a));
335
- });
336
- return;
337
- }
338
- const l = this.elementsCache.get(r.key);
339
- l !== t && (l && this.observer.unobserve(l), this.observer.observe(t), this.elementsCache.set(r.key, t)), this.resizeItem(i, this.options.measureElement(t, o, this));
340
- }, this.resizeItem = (t, o) => {
341
- const i = this.getMeasurements()[t];
342
- if (!i)
343
- return;
344
- const r = this.itemSizeCache.get(i.key) ?? i.size, l = o - r;
345
- l !== 0 && ((this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(i, l, this) : i.start < this.getScrollOffset() + this.scrollAdjustments) && (process.env.NODE_ENV !== "production" && this.options.debug && console.info("correction", l), this._scrollToOffset(this.getScrollOffset(), {
346
- adjustments: this.scrollAdjustments += l,
347
- behavior: void 0
348
- })), this.pendingMeasuredCacheIndexes.push(i.index), this.itemSizeCache = new Map(this.itemSizeCache.set(i.key, o)), this.notify(!0, !1));
349
- }, this.measureElement = (t) => {
350
- t && this._measureElement(t, void 0);
351
- }, this.getVirtualItems = Ne(
352
- () => [this.getIndexes(), this.getMeasurements()],
353
- (t, o) => {
354
- const i = [];
355
- for (let r = 0, l = t.length; r < l; r++) {
356
- const s = t[r], a = o[s];
357
- i.push(a);
358
- }
359
- return i;
360
- },
361
- {
362
- key: process.env.NODE_ENV !== "production" && "getIndexes",
363
- debug: () => this.options.debug
364
- }
365
- ), this.getVirtualItemForOffset = (t) => {
366
- const o = this.getMeasurements();
367
- if (o.length !== 0)
368
- return dt(
369
- o[fn(
370
- 0,
371
- o.length - 1,
372
- (i) => dt(o[i]).start,
373
- t
374
- )]
375
- );
376
- }, this.getOffsetForAlignment = (t, o) => {
377
- const i = this.getSize(), r = this.getScrollOffset();
378
- o === "auto" && (t <= r ? o = "start" : t >= r + i ? o = "end" : o = "start"), o === "start" ? t = t : o === "end" ? t = t - i : o === "center" && (t = t - i / 2);
379
- const l = this.options.horizontal ? "scrollWidth" : "scrollHeight", a = (this.scrollElement ? "document" in this.scrollElement ? this.scrollElement.document.documentElement[l] : this.scrollElement[l] : 0) - i;
380
- return Math.max(Math.min(a, t), 0);
381
- }, this.getOffsetForIndex = (t, o = "auto") => {
382
- t = Math.max(0, Math.min(t, this.options.count - 1));
383
- const i = this.getMeasurements()[t];
384
- if (!i)
385
- return;
386
- const r = this.getSize(), l = this.getScrollOffset();
387
- if (o === "auto")
388
- if (i.end >= l + r - this.options.scrollPaddingEnd)
389
- o = "end";
390
- else if (i.start <= l + this.options.scrollPaddingStart)
391
- o = "start";
392
- else
393
- return [l, o];
394
- const s = o === "end" ? i.end + this.options.scrollPaddingEnd : i.start - this.options.scrollPaddingStart;
395
- return [this.getOffsetForAlignment(s, o), o];
396
- }, this.isDynamicMode = () => this.elementsCache.size > 0, this.cancelScrollToIndex = () => {
397
- this.scrollToIndexTimeoutId !== null && this.targetWindow && (this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId), this.scrollToIndexTimeoutId = null);
398
- }, this.scrollToOffset = (t, { align: o = "start", behavior: i } = {}) => {
399
- this.cancelScrollToIndex(), i === "smooth" && this.isDynamicMode() && console.warn(
400
- "The `smooth` scroll behavior is not fully supported with dynamic size."
401
- ), this._scrollToOffset(this.getOffsetForAlignment(t, o), {
402
- adjustments: void 0,
403
- behavior: i
404
- });
405
- }, this.scrollToIndex = (t, { align: o = "auto", behavior: i } = {}) => {
406
- t = Math.max(0, Math.min(t, this.options.count - 1)), this.cancelScrollToIndex(), i === "smooth" && this.isDynamicMode() && console.warn(
407
- "The `smooth` scroll behavior is not fully supported with dynamic size."
408
- );
409
- const r = this.getOffsetForIndex(t, o);
410
- if (!r) return;
411
- const [l, s] = r;
412
- this._scrollToOffset(l, { adjustments: void 0, behavior: i }), i !== "smooth" && this.isDynamicMode() && this.targetWindow && (this.scrollToIndexTimeoutId = this.targetWindow.setTimeout(() => {
413
- if (this.scrollToIndexTimeoutId = null, this.elementsCache.has(
414
- this.options.getItemKey(t)
415
- )) {
416
- const [d] = dt(
417
- this.getOffsetForIndex(t, s)
418
- );
419
- vo(d, this.getScrollOffset()) || this.scrollToIndex(t, { align: s, behavior: i });
420
- } else
421
- this.scrollToIndex(t, { align: s, behavior: i });
422
- }));
423
- }, this.scrollBy = (t, { behavior: o } = {}) => {
424
- this.cancelScrollToIndex(), o === "smooth" && this.isDynamicMode() && console.warn(
425
- "The `smooth` scroll behavior is not fully supported with dynamic size."
426
- ), this._scrollToOffset(this.getScrollOffset() + t, {
427
- adjustments: void 0,
428
- behavior: o
429
- });
430
- }, this.getTotalSize = () => {
431
- var t;
432
- const o = this.getMeasurements();
433
- let i;
434
- return o.length === 0 ? i = this.options.paddingStart : i = this.options.lanes === 1 ? ((t = o[o.length - 1]) == null ? void 0 : t.end) ?? 0 : Math.max(
435
- ...o.slice(-this.options.lanes).map((r) => r.end)
436
- ), i - this.options.scrollMargin + this.options.paddingEnd;
437
- }, this._scrollToOffset = (t, {
438
- adjustments: o,
439
- behavior: i
440
- }) => {
441
- this.options.scrollToFn(t, { behavior: i, adjustments: o }, this);
442
- }, this.measure = () => {
443
- var t, o;
444
- this.itemSizeCache = /* @__PURE__ */ new Map(), (o = (t = this.options).onChange) == null || o.call(t, this, !1);
445
- }, this.setOptions(n);
446
- }
447
- }
448
- const fn = (e, n, t, o) => {
449
- for (; e <= n; ) {
450
- const i = (e + n) / 2 | 0, r = t(i);
451
- if (r < o)
452
- e = i + 1;
453
- else if (r > o)
454
- n = i - 1;
455
- else
456
- return i;
457
- }
458
- return e > 0 ? e - 1 : 0;
459
- };
460
- function To({
461
- measurements: e,
462
- outerSize: n,
463
- scrollOffset: t
464
- }) {
465
- const o = e.length - 1, r = fn(0, o, (s) => e[s].start, t);
466
- let l = r;
467
- for (; l < o && e[l].end < t + n; )
468
- l++;
469
- return { startIndex: r, endIndex: l };
470
- }
471
- const Io = typeof document < "u" ? E.useLayoutEffect : E.useEffect;
472
- function Mo(e) {
473
- const n = E.useReducer(() => ({}), {})[1], t = {
474
- ...e,
475
- onChange: (i, r) => {
476
- var l;
477
- r ? Ee(n) : n(), (l = e.onChange) == null || l.call(e, i, r);
478
- }
479
- }, [o] = E.useState(
480
- () => new Co(t)
481
- );
482
- return o.setOptions(t), E.useEffect(() => o._didMount(), []), Io(() => o._willUpdate()), o;
483
- }
484
- function _o(e) {
485
- return Mo({
486
- observeElementRect: yo,
487
- observeElementOffset: Ro,
488
- scrollToFn: Oo,
489
- ...e
490
- });
491
- }
492
- function Ao(e) {
493
- if (e === null) return { width: 0, height: 0 };
494
- let { width: n, height: t } = e.getBoundingClientRect();
495
- return { width: n, height: t };
496
- }
497
- function zt(e, n = !1) {
498
- let t = e === null ? null : "current" in e ? e.current : e, [o, i] = ln(() => ({}), {}), r = K(() => Ao(t), [t, o]);
499
- return U(() => {
500
- if (!t) return;
501
- let l = new ResizeObserver(i);
502
- return l.observe(t), () => {
503
- l.disconnect();
504
- };
505
- }, [t]), n ? { width: `${r.width}px`, height: `${r.height}px` } : r;
506
- }
507
- let Po = class extends Map {
508
- constructor(n) {
509
- super(), this.factory = n;
510
- }
511
- get(n) {
512
- let t = super.get(n);
513
- return t === void 0 && (t = this.factory(n), this.set(n, t)), t;
514
- }
515
- };
516
- function pn(e, n) {
517
- let t = e(), o = /* @__PURE__ */ new Set();
518
- return { getSnapshot() {
519
- return t;
520
- }, subscribe(i) {
521
- return o.add(i), () => o.delete(i);
522
- }, dispatch(i, ...r) {
523
- let l = n[i].call(t, ...r);
524
- l && (t = l, o.forEach((s) => s()));
525
- } };
526
- }
527
- function mn(e) {
528
- return Wn(e.subscribe, e.getSnapshot, e.getSnapshot);
529
- }
530
- let Do = new Po(() => pn(() => [], { ADD(e) {
531
- return this.includes(e) ? this : [...this, e];
532
- }, REMOVE(e) {
533
- let n = this.indexOf(e);
534
- if (n === -1) return this;
535
- let t = this.slice();
536
- return t.splice(n, 1), t;
537
- } }));
538
- function Ct(e, n) {
539
- let t = Do.get(n), o = Ye(), i = mn(t);
540
- if (U(() => {
541
- if (e) return t.dispatch("ADD", o), () => t.dispatch("REMOVE", o);
542
- }, [t, e]), !e) return !1;
543
- let r = i.indexOf(o), l = i.length;
544
- return r === -1 && (r = l, l += 1), r === l - 1;
545
- }
546
- let vt = /* @__PURE__ */ new Map(), He = /* @__PURE__ */ new Map();
547
- function Ht(e) {
548
- var n;
549
- let t = (n = He.get(e)) != null ? n : 0;
550
- return He.set(e, t + 1), t !== 0 ? () => Vt(e) : (vt.set(e, { "aria-hidden": e.getAttribute("aria-hidden"), inert: e.inert }), e.setAttribute("aria-hidden", "true"), e.inert = !0, () => Vt(e));
551
- }
552
- function Vt(e) {
553
- var n;
554
- let t = (n = He.get(e)) != null ? n : 1;
555
- if (t === 1 ? He.delete(e) : He.set(e, t - 1), t !== 1) return;
556
- let o = vt.get(e);
557
- o && (o["aria-hidden"] === null ? e.removeAttribute("aria-hidden") : e.setAttribute("aria-hidden", o["aria-hidden"]), e.inert = o.inert, vt.delete(e));
558
- }
559
- function $o(e, { allowed: n, disallowed: t } = {}) {
560
- let o = Ct(e, "inert-others");
561
- U(() => {
562
- var i, r;
563
- if (!o) return;
564
- let l = _e();
565
- for (let a of (i = t == null ? void 0 : t()) != null ? i : []) a && l.add(Ht(a));
566
- let s = (r = n == null ? void 0 : n()) != null ? r : [];
567
- for (let a of s) {
568
- if (!a) continue;
569
- let d = Rt(a);
570
- if (!d) continue;
571
- let u = a.parentElement;
572
- for (; u && u !== d.body; ) {
573
- for (let f of u.children) s.some((g) => f.contains(g)) || l.add(Ht(f));
574
- u = u.parentElement;
575
- }
576
- }
577
- return l.dispose;
578
- }, [o, n, t]);
579
- }
580
- function Lo(e, n, t) {
581
- let o = Pe((i) => {
582
- let r = i.getBoundingClientRect();
583
- r.x === 0 && r.y === 0 && r.width === 0 && r.height === 0 && t();
584
- });
585
- oe(() => {
586
- if (!e) return;
587
- let i = n === null ? null : n instanceof HTMLElement ? n : n.current;
588
- if (!i) return;
589
- let r = _e();
590
- if (typeof ResizeObserver < "u") {
591
- let l = new ResizeObserver(() => o.current(i));
592
- l.observe(i), r.add(() => l.disconnect());
593
- }
594
- if (typeof IntersectionObserver < "u") {
595
- let l = new IntersectionObserver(() => o.current(i));
596
- l.observe(i), r.add(() => l.disconnect());
597
- }
598
- return () => r.dispose();
599
- }, [n, o, e]);
600
- }
601
- function hn() {
602
- return /iPhone/gi.test(window.navigator.platform) || /Mac/gi.test(window.navigator.platform) && window.navigator.maxTouchPoints > 0;
603
- }
604
- function Fo() {
605
- return /Android/gi.test(window.navigator.userAgent);
606
- }
607
- function gn() {
608
- return hn() || Fo();
609
- }
610
- function ke(e, n, t, o) {
611
- let i = Pe(t);
612
- oe(() => {
613
- if (!e) return;
614
- function r(l) {
615
- i.current(l);
616
- }
617
- return document.addEventListener(n, r, o), () => document.removeEventListener(n, r, o);
618
- }, [e, n, o]);
619
- }
620
- function No(e, n, t, o) {
621
- let i = Pe(t);
622
- oe(() => {
623
- if (!e) return;
624
- function r(l) {
625
- i.current(l);
626
- }
627
- return window.addEventListener(n, r, o), () => window.removeEventListener(n, r, o);
628
- }, [e, n, o]);
629
- }
630
- const Wt = 30;
631
- function ko(e, n, t) {
632
- let o = Ct(e, "outside-click"), i = Pe(t), r = Ve(function(a, d) {
633
- if (a.defaultPrevented) return;
634
- let u = d(a);
635
- if (u === null || !u.getRootNode().contains(u) || !u.isConnected) return;
636
- let f = function g(c) {
637
- return typeof c == "function" ? g(c()) : Array.isArray(c) || c instanceof Set ? c : [c];
638
- }(n);
639
- for (let g of f) {
640
- if (g === null) continue;
641
- let c = g instanceof HTMLElement ? g : g.current;
642
- if (c != null && c.contains(u) || a.composed && a.composedPath().includes(c)) return;
643
- }
644
- return !so(u, lo.Loose) && u.tabIndex !== -1 && a.preventDefault(), i.current(a, u);
645
- }, [i]), l = Y(null);
646
- ke(o, "pointerdown", (a) => {
647
- var d, u;
648
- l.current = ((u = (d = a.composedPath) == null ? void 0 : d.call(a)) == null ? void 0 : u[0]) || a.target;
649
- }, !0), ke(o, "mousedown", (a) => {
650
- var d, u;
651
- l.current = ((u = (d = a.composedPath) == null ? void 0 : d.call(a)) == null ? void 0 : u[0]) || a.target;
652
- }, !0), ke(o, "click", (a) => {
653
- gn() || l.current && (r(a, () => l.current), l.current = null);
654
- }, !0);
655
- let s = Y({ x: 0, y: 0 });
656
- ke(o, "touchstart", (a) => {
657
- s.current.x = a.touches[0].clientX, s.current.y = a.touches[0].clientY;
658
- }, !0), ke(o, "touchend", (a) => {
659
- let d = { x: a.changedTouches[0].clientX, y: a.changedTouches[0].clientY };
660
- if (!(Math.abs(d.x - s.current.x) >= Wt || Math.abs(d.y - s.current.y) >= Wt)) return r(a, () => a.target instanceof HTMLElement ? a.target : null);
661
- }, !0), No(o, "blur", (a) => r(a, () => window.document.activeElement instanceof HTMLIFrameElement ? window.document.activeElement : null), !0);
662
- }
663
- function st(...e) {
664
- return K(() => Rt(...e), [...e]);
665
- }
666
- function zo(e, n, t, o) {
667
- let i = Pe(t);
668
- oe(() => {
669
- e = e ?? window;
670
- function r(l) {
671
- i.current(l);
672
- }
673
- return e.addEventListener(n, r, o), () => e.removeEventListener(n, r, o);
674
- }, [e, n, o]);
675
- }
676
- function vn(e) {
677
- let n = Y({ value: "", selectionStart: null, selectionEnd: null });
678
- return zo(e.current, "blur", (t) => {
679
- let o = t.target;
680
- o instanceof HTMLInputElement && (n.current = { value: o.value, selectionStart: o.selectionStart, selectionEnd: o.selectionEnd });
681
- }), _(() => {
682
- let t = e.current;
683
- if (document.activeElement !== t && t instanceof HTMLInputElement && t.isConnected) {
684
- if (t.focus({ preventScroll: !0 }), t.value !== n.current.value) t.setSelectionRange(t.value.length, t.value.length);
685
- else {
686
- let { selectionStart: o, selectionEnd: i } = n.current;
687
- o !== null && i !== null && t.setSelectionRange(o, i);
688
- }
689
- n.current = { value: "", selectionStart: null, selectionEnd: null };
690
- }
691
- });
692
- }
693
- function Ho() {
694
- let e;
695
- return { before({ doc: n }) {
696
- var t;
697
- let o = n.documentElement, i = (t = n.defaultView) != null ? t : window;
698
- e = Math.max(0, i.innerWidth - o.clientWidth);
699
- }, after({ doc: n, d: t }) {
700
- let o = n.documentElement, i = Math.max(0, o.clientWidth - o.offsetWidth), r = Math.max(0, e - i);
701
- t.style(o, "paddingRight", `${r}px`);
702
- } };
703
- }
704
- function Vo() {
705
- return hn() ? { before({ doc: e, d: n, meta: t }) {
706
- function o(i) {
707
- return t.containers.flatMap((r) => r()).some((r) => r.contains(i));
708
- }
709
- n.microTask(() => {
710
- var i;
711
- if (window.getComputedStyle(e.documentElement).scrollBehavior !== "auto") {
712
- let s = _e();
713
- s.style(e.documentElement, "scrollBehavior", "auto"), n.add(() => n.microTask(() => s.dispose()));
714
- }
715
- let r = (i = window.scrollY) != null ? i : window.pageYOffset, l = null;
716
- n.addEventListener(e, "click", (s) => {
717
- if (s.target instanceof HTMLElement) try {
718
- let a = s.target.closest("a");
719
- if (!a) return;
720
- let { hash: d } = new URL(a.href), u = e.querySelector(d);
721
- u && !o(u) && (l = u);
722
- } catch {
723
- }
724
- }, !0), n.addEventListener(e, "touchstart", (s) => {
725
- if (s.target instanceof HTMLElement) if (o(s.target)) {
726
- let a = s.target;
727
- for (; a.parentElement && o(a.parentElement); ) a = a.parentElement;
728
- n.style(a, "overscrollBehavior", "contain");
729
- } else n.style(s.target, "touchAction", "none");
730
- }), n.addEventListener(e, "touchmove", (s) => {
731
- if (s.target instanceof HTMLElement) {
732
- if (s.target.tagName === "INPUT") return;
733
- if (o(s.target)) {
734
- let a = s.target;
735
- for (; a.parentElement && a.dataset.headlessuiPortal !== "" && !(a.scrollHeight > a.clientHeight || a.scrollWidth > a.clientWidth); ) a = a.parentElement;
736
- a.dataset.headlessuiPortal === "" && s.preventDefault();
737
- } else s.preventDefault();
738
- }
739
- }, { passive: !1 }), n.add(() => {
740
- var s;
741
- let a = (s = window.scrollY) != null ? s : window.pageYOffset;
742
- r !== a && window.scrollTo(0, r), l && l.isConnected && (l.scrollIntoView({ block: "nearest" }), l = null);
743
- });
744
- });
745
- } } : {};
746
- }
747
- function Wo() {
748
- return { before({ doc: e, d: n }) {
749
- n.style(e.documentElement, "overflow", "hidden");
750
- } };
751
- }
752
- function Bo(e) {
753
- let n = {};
754
- for (let t of e) Object.assign(n, t(n));
755
- return n;
756
- }
757
- let Re = pn(() => /* @__PURE__ */ new Map(), { PUSH(e, n) {
758
- var t;
759
- let o = (t = this.get(e)) != null ? t : { doc: e, count: 0, d: _e(), meta: /* @__PURE__ */ new Set() };
760
- return o.count++, o.meta.add(n), this.set(e, o), this;
761
- }, POP(e, n) {
762
- let t = this.get(e);
763
- return t && (t.count--, t.meta.delete(n)), this;
764
- }, SCROLL_PREVENT({ doc: e, d: n, meta: t }) {
765
- let o = { doc: e, d: n, meta: Bo(t) }, i = [Vo(), Ho(), Wo()];
766
- i.forEach(({ before: r }) => r == null ? void 0 : r(o)), i.forEach(({ after: r }) => r == null ? void 0 : r(o));
767
- }, SCROLL_ALLOW({ d: e }) {
768
- e.dispose();
769
- }, TEARDOWN({ doc: e }) {
770
- this.delete(e);
771
- } });
772
- Re.subscribe(() => {
773
- let e = Re.getSnapshot(), n = /* @__PURE__ */ new Map();
774
- for (let [t] of e) n.set(t, t.documentElement.style.overflow);
775
- for (let t of e.values()) {
776
- let o = n.get(t.doc) === "hidden", i = t.count !== 0;
777
- (i && !o || !i && o) && Re.dispatch(t.count > 0 ? "SCROLL_PREVENT" : "SCROLL_ALLOW", t), t.count === 0 && Re.dispatch("TEARDOWN", t);
778
- }
779
- });
780
- function jo(e, n, t = () => ({ containers: [] })) {
781
- let o = mn(Re), i = n ? o.get(n) : void 0, r = i ? i.count > 0 : !1;
782
- return U(() => {
783
- if (!(!n || !e)) return Re.dispatch("PUSH", n, t), () => Re.dispatch("POP", n, t);
784
- }, [e, n]), r;
785
- }
786
- function Uo(e, n, t = () => [document.body]) {
787
- let o = Ct(e, "scroll-lock");
788
- jo(o, n, (i) => {
789
- var r;
790
- return { containers: [...(r = i.containers) != null ? r : [], t] };
791
- });
792
- }
793
- function Bt(e) {
794
- return [e.screenX, e.screenY];
795
- }
796
- function Yo() {
797
- let e = Y([-1, -1]);
798
- return { wasMoved(n) {
799
- let t = Bt(n);
800
- return e.current[0] === t[0] && e.current[1] === t[1] ? !1 : (e.current = t, !0);
801
- }, update(n) {
802
- e.current = Bt(n);
803
- } };
804
- }
805
- function qo(e, { container: n, accept: t, walk: o }) {
806
- let i = Y(t), r = Y(o);
807
- oe(() => {
808
- i.current = t, r.current = o;
809
- }, [t, o]), U(() => {
810
- if (!n || !e) return;
811
- let l = Rt(n);
812
- if (!l) return;
813
- let s = i.current, a = r.current, d = Object.assign((f) => s(f), { acceptNode: s }), u = l.createTreeWalker(n, NodeFilter.SHOW_ELEMENT, d, !1);
814
- for (; u.nextNode(); ) a(u.currentNode);
815
- }, [n, e, i, r]);
816
- }
817
- function jt(e, n) {
818
- let t = Y([]), o = _(e);
819
- oe(() => {
820
- let i = [...t.current];
821
- for (let [r, l] of n.entries()) if (t.current[r] !== l) {
822
- let s = o(n, i);
823
- return t.current = n, s;
824
- }
825
- }, [o, ...n]);
826
- }
827
- function De(e) {
828
- return bn(e) ? (e.nodeName || "").toLowerCase() : "#document";
829
- }
830
- function ee(e) {
831
- var n;
832
- return (e == null || (n = e.ownerDocument) == null ? void 0 : n.defaultView) || window;
833
- }
834
- function de(e) {
835
- var n;
836
- return (n = (bn(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : n.documentElement;
837
- }
838
- function bn(e) {
839
- return e instanceof Node || e instanceof ee(e).Node;
840
- }
841
- function G(e) {
842
- return e instanceof Element || e instanceof ee(e).Element;
843
- }
844
- function ue(e) {
845
- return e instanceof HTMLElement || e instanceof ee(e).HTMLElement;
846
- }
847
- function Ut(e) {
848
- return typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof ee(e).ShadowRoot;
849
- }
850
- function qe(e) {
851
- const {
852
- overflow: n,
853
- overflowX: t,
854
- overflowY: o,
855
- display: i
856
- } = re(e);
857
- return /auto|scroll|overlay|hidden|clip/.test(n + o + t) && !["inline", "contents"].includes(i);
858
- }
859
- function Ko(e) {
860
- return ["table", "td", "th"].includes(De(e));
861
- }
862
- function lt(e) {
863
- return [":popover-open", ":modal"].some((n) => {
864
- try {
865
- return e.matches(n);
866
- } catch {
867
- return !1;
868
- }
869
- });
870
- }
871
- function Tt(e) {
872
- const n = It(), t = re(e);
873
- return t.transform !== "none" || t.perspective !== "none" || (t.containerType ? t.containerType !== "normal" : !1) || !n && (t.backdropFilter ? t.backdropFilter !== "none" : !1) || !n && (t.filter ? t.filter !== "none" : !1) || ["transform", "perspective", "filter"].some((o) => (t.willChange || "").includes(o)) || ["paint", "layout", "strict", "content"].some((o) => (t.contain || "").includes(o));
874
- }
875
- function Go(e) {
876
- let n = me(e);
877
- for (; ue(n) && !Ae(n); ) {
878
- if (lt(n))
879
- return null;
880
- if (Tt(n))
881
- return n;
882
- n = me(n);
883
- }
884
- return null;
885
- }
886
- function It() {
887
- return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
888
- }
889
- function Ae(e) {
890
- return ["html", "body", "#document"].includes(De(e));
891
- }
892
- function re(e) {
893
- return ee(e).getComputedStyle(e);
894
- }
895
- function at(e) {
896
- return G(e) ? {
897
- scrollLeft: e.scrollLeft,
898
- scrollTop: e.scrollTop
899
- } : {
900
- scrollLeft: e.scrollX,
901
- scrollTop: e.scrollY
902
- };
903
- }
904
- function me(e) {
905
- if (De(e) === "html")
906
- return e;
907
- const n = (
908
- // Step into the shadow DOM of the parent of a slotted node.
909
- e.assignedSlot || // DOM Element detected.
910
- e.parentNode || // ShadowRoot detected.
911
- Ut(e) && e.host || // Fallback.
912
- de(e)
913
- );
914
- return Ut(n) ? n.host : n;
915
- }
916
- function xn(e) {
917
- const n = me(e);
918
- return Ae(n) ? e.ownerDocument ? e.ownerDocument.body : e.body : ue(n) && qe(n) ? n : xn(n);
919
- }
920
- function Be(e, n, t) {
921
- var o;
922
- n === void 0 && (n = []), t === void 0 && (t = !0);
923
- const i = xn(e), r = i === ((o = e.ownerDocument) == null ? void 0 : o.body), l = ee(i);
924
- return r ? n.concat(l, l.visualViewport || [], qe(i) ? i : [], l.frameElement && t ? Be(l.frameElement) : []) : n.concat(i, Be(i, [], t));
925
- }
926
- function Jo() {
927
- const e = navigator.userAgentData;
928
- return e && Array.isArray(e.brands) ? e.brands.map((n) => {
929
- let {
930
- brand: t,
931
- version: o
932
- } = n;
933
- return t + "/" + o;
934
- }).join(" ") : navigator.userAgent;
935
- }
936
- const pe = Math.min, Z = Math.max, tt = Math.round, Qe = Math.floor, he = (e) => ({
937
- x: e,
938
- y: e
939
- }), Xo = {
940
- left: "right",
941
- right: "left",
942
- bottom: "top",
943
- top: "bottom"
944
- }, Qo = {
945
- start: "end",
946
- end: "start"
947
- };
948
- function Yt(e, n, t) {
949
- return Z(e, pe(n, t));
950
- }
951
- function $e(e, n) {
952
- return typeof e == "function" ? e(n) : e;
953
- }
954
- function ge(e) {
955
- return e.split("-")[0];
956
- }
957
- function Ke(e) {
958
- return e.split("-")[1];
959
- }
960
- function wn(e) {
961
- return e === "x" ? "y" : "x";
962
- }
963
- function yn(e) {
964
- return e === "y" ? "height" : "width";
965
- }
966
- function Se(e) {
967
- return ["top", "bottom"].includes(ge(e)) ? "y" : "x";
968
- }
969
- function En(e) {
970
- return wn(Se(e));
971
- }
972
- function Zo(e, n, t) {
973
- t === void 0 && (t = !1);
974
- const o = Ke(e), i = En(e), r = yn(i);
975
- let l = i === "x" ? o === (t ? "end" : "start") ? "right" : "left" : o === "start" ? "bottom" : "top";
976
- return n.reference[r] > n.floating[r] && (l = nt(l)), [l, nt(l)];
977
- }
978
- function ei(e) {
979
- const n = nt(e);
980
- return [bt(e), n, bt(n)];
981
- }
982
- function bt(e) {
983
- return e.replace(/start|end/g, (n) => Qo[n]);
984
- }
985
- function ti(e, n, t) {
986
- const o = ["left", "right"], i = ["right", "left"], r = ["top", "bottom"], l = ["bottom", "top"];
987
- switch (e) {
988
- case "top":
989
- case "bottom":
990
- return t ? n ? i : o : n ? o : i;
991
- case "left":
992
- case "right":
993
- return n ? r : l;
994
- default:
995
- return [];
996
- }
997
- }
998
- function ni(e, n, t, o) {
999
- const i = Ke(e);
1000
- let r = ti(ge(e), t === "start", o);
1001
- return i && (r = r.map((l) => l + "-" + i), n && (r = r.concat(r.map(bt)))), r;
1002
- }
1003
- function nt(e) {
1004
- return e.replace(/left|right|bottom|top/g, (n) => Xo[n]);
1005
- }
1006
- function oi(e) {
1007
- return {
1008
- top: 0,
1009
- right: 0,
1010
- bottom: 0,
1011
- left: 0,
1012
- ...e
1013
- };
1014
- }
1015
- function ii(e) {
1016
- return typeof e != "number" ? oi(e) : {
1017
- top: e,
1018
- right: e,
1019
- bottom: e,
1020
- left: e
1021
- };
1022
- }
1023
- function ot(e) {
1024
- const {
1025
- x: n,
1026
- y: t,
1027
- width: o,
1028
- height: i
1029
- } = e;
1030
- return {
1031
- width: o,
1032
- height: i,
1033
- top: t,
1034
- left: n,
1035
- right: n + o,
1036
- bottom: t + i,
1037
- x: n,
1038
- y: t
1039
- };
1040
- }
1041
- function qt(e, n, t) {
1042
- let {
1043
- reference: o,
1044
- floating: i
1045
- } = e;
1046
- const r = Se(n), l = En(n), s = yn(l), a = ge(n), d = r === "y", u = o.x + o.width / 2 - i.width / 2, f = o.y + o.height / 2 - i.height / 2, g = o[s] / 2 - i[s] / 2;
1047
- let c;
1048
- switch (a) {
1049
- case "top":
1050
- c = {
1051
- x: u,
1052
- y: o.y - i.height
1053
- };
1054
- break;
1055
- case "bottom":
1056
- c = {
1057
- x: u,
1058
- y: o.y + o.height
1059
- };
1060
- break;
1061
- case "right":
1062
- c = {
1063
- x: o.x + o.width,
1064
- y: f
1065
- };
1066
- break;
1067
- case "left":
1068
- c = {
1069
- x: o.x - i.width,
1070
- y: f
1071
- };
1072
- break;
1073
- default:
1074
- c = {
1075
- x: o.x,
1076
- y: o.y
1077
- };
1078
- }
1079
- switch (Ke(n)) {
1080
- case "start":
1081
- c[l] -= g * (t && d ? -1 : 1);
1082
- break;
1083
- case "end":
1084
- c[l] += g * (t && d ? -1 : 1);
1085
- break;
1086
- }
1087
- return c;
1088
- }
1089
- const ri = async (e, n, t) => {
1090
- const {
1091
- placement: o = "bottom",
1092
- strategy: i = "absolute",
1093
- middleware: r = [],
1094
- platform: l
1095
- } = t, s = r.filter(Boolean), a = await (l.isRTL == null ? void 0 : l.isRTL(n));
1096
- let d = await l.getElementRects({
1097
- reference: e,
1098
- floating: n,
1099
- strategy: i
1100
- }), {
1101
- x: u,
1102
- y: f
1103
- } = qt(d, o, a), g = o, c = {}, m = 0;
1104
- for (let p = 0; p < s.length; p++) {
1105
- const {
1106
- name: h,
1107
- fn: v
1108
- } = s[p], {
1109
- x: w,
1110
- y: b,
1111
- data: x,
1112
- reset: y
1113
- } = await v({
1114
- x: u,
1115
- y: f,
1116
- initialPlacement: o,
1117
- placement: g,
1118
- strategy: i,
1119
- middlewareData: c,
1120
- rects: d,
1121
- platform: l,
1122
- elements: {
1123
- reference: e,
1124
- floating: n
1125
- }
1126
- });
1127
- u = w ?? u, f = b ?? f, c = {
1128
- ...c,
1129
- [h]: {
1130
- ...c[h],
1131
- ...x
1132
- }
1133
- }, y && m <= 50 && (m++, typeof y == "object" && (y.placement && (g = y.placement), y.rects && (d = y.rects === !0 ? await l.getElementRects({
1134
- reference: e,
1135
- floating: n,
1136
- strategy: i
1137
- }) : y.rects), {
1138
- x: u,
1139
- y: f
1140
- } = qt(d, g, a)), p = -1);
1141
- }
1142
- return {
1143
- x: u,
1144
- y: f,
1145
- placement: g,
1146
- strategy: i,
1147
- middlewareData: c
1148
- };
1149
- };
1150
- async function ct(e, n) {
1151
- var t;
1152
- n === void 0 && (n = {});
1153
- const {
1154
- x: o,
1155
- y: i,
1156
- platform: r,
1157
- rects: l,
1158
- elements: s,
1159
- strategy: a
1160
- } = e, {
1161
- boundary: d = "clippingAncestors",
1162
- rootBoundary: u = "viewport",
1163
- elementContext: f = "floating",
1164
- altBoundary: g = !1,
1165
- padding: c = 0
1166
- } = $e(n, e), m = ii(c), h = s[g ? f === "floating" ? "reference" : "floating" : f], v = ot(await r.getClippingRect({
1167
- element: (t = await (r.isElement == null ? void 0 : r.isElement(h))) == null || t ? h : h.contextElement || await (r.getDocumentElement == null ? void 0 : r.getDocumentElement(s.floating)),
1168
- boundary: d,
1169
- rootBoundary: u,
1170
- strategy: a
1171
- })), w = f === "floating" ? {
1172
- x: o,
1173
- y: i,
1174
- width: l.floating.width,
1175
- height: l.floating.height
1176
- } : l.reference, b = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(s.floating)), x = await (r.isElement == null ? void 0 : r.isElement(b)) ? await (r.getScale == null ? void 0 : r.getScale(b)) || {
1177
- x: 1,
1178
- y: 1
1179
- } : {
1180
- x: 1,
1181
- y: 1
1182
- }, y = ot(r.convertOffsetParentRelativeRectToViewportRelativeRect ? await r.convertOffsetParentRelativeRectToViewportRelativeRect({
1183
- elements: s,
1184
- rect: w,
1185
- offsetParent: b,
1186
- strategy: a
1187
- }) : w);
1188
- return {
1189
- top: (v.top - y.top + m.top) / x.y,
1190
- bottom: (y.bottom - v.bottom + m.bottom) / x.y,
1191
- left: (v.left - y.left + m.left) / x.x,
1192
- right: (y.right - v.right + m.right) / x.x
1193
- };
1194
- }
1195
- const si = function(e) {
1196
- return e === void 0 && (e = {}), {
1197
- name: "flip",
1198
- options: e,
1199
- async fn(n) {
1200
- var t, o;
1201
- const {
1202
- placement: i,
1203
- middlewareData: r,
1204
- rects: l,
1205
- initialPlacement: s,
1206
- platform: a,
1207
- elements: d
1208
- } = n, {
1209
- mainAxis: u = !0,
1210
- crossAxis: f = !0,
1211
- fallbackPlacements: g,
1212
- fallbackStrategy: c = "bestFit",
1213
- fallbackAxisSideDirection: m = "none",
1214
- flipAlignment: p = !0,
1215
- ...h
1216
- } = $e(e, n);
1217
- if ((t = r.arrow) != null && t.alignmentOffset)
1218
- return {};
1219
- const v = ge(i), w = Se(s), b = ge(s) === s, x = await (a.isRTL == null ? void 0 : a.isRTL(d.floating)), y = g || (b || !p ? [nt(s)] : ei(s)), O = m !== "none";
1220
- !g && O && y.push(...ni(s, p, m, x));
1221
- const C = [s, ...y], $ = await ct(n, h), N = [];
1222
- let F = ((o = r.flip) == null ? void 0 : o.overflows) || [];
1223
- if (u && N.push($[v]), f) {
1224
- const S = Zo(i, l, x);
1225
- N.push($[S[0]], $[S[1]]);
1226
- }
1227
- if (F = [...F, {
1228
- placement: i,
1229
- overflows: N
1230
- }], !N.every((S) => S <= 0)) {
1231
- var D, k;
1232
- const S = (((D = r.flip) == null ? void 0 : D.index) || 0) + 1, L = C[S];
1233
- if (L)
1234
- return {
1235
- data: {
1236
- index: S,
1237
- overflows: F
1238
- },
1239
- reset: {
1240
- placement: L
1241
- }
1242
- };
1243
- let V = (k = F.filter((R) => R.overflows[0] <= 0).sort((R, z) => R.overflows[1] - z.overflows[1])[0]) == null ? void 0 : k.placement;
1244
- if (!V)
1245
- switch (c) {
1246
- case "bestFit": {
1247
- var I;
1248
- const R = (I = F.filter((z) => {
1249
- if (O) {
1250
- const M = Se(z.placement);
1251
- return M === w || // Create a bias to the `y` side axis due to horizontal
1252
- // reading directions favoring greater width.
1253
- M === "y";
1254
- }
1255
- return !0;
1256
- }).map((z) => [z.placement, z.overflows.filter((M) => M > 0).reduce((M, te) => M + te, 0)]).sort((z, M) => z[1] - M[1])[0]) == null ? void 0 : I[0];
1257
- R && (V = R);
1258
- break;
1259
- }
1260
- case "initialPlacement":
1261
- V = s;
1262
- break;
1263
- }
1264
- if (i !== V)
1265
- return {
1266
- reset: {
1267
- placement: V
1268
- }
1269
- };
1270
- }
1271
- return {};
1272
- }
1273
- };
1274
- };
1275
- async function li(e, n) {
1276
- const {
1277
- placement: t,
1278
- platform: o,
1279
- elements: i
1280
- } = e, r = await (o.isRTL == null ? void 0 : o.isRTL(i.floating)), l = ge(t), s = Ke(t), a = Se(t) === "y", d = ["left", "top"].includes(l) ? -1 : 1, u = r && a ? -1 : 1, f = $e(n, e);
1281
- let {
1282
- mainAxis: g,
1283
- crossAxis: c,
1284
- alignmentAxis: m
1285
- } = typeof f == "number" ? {
1286
- mainAxis: f,
1287
- crossAxis: 0,
1288
- alignmentAxis: null
1289
- } : {
1290
- mainAxis: 0,
1291
- crossAxis: 0,
1292
- alignmentAxis: null,
1293
- ...f
1294
- };
1295
- return s && typeof m == "number" && (c = s === "end" ? m * -1 : m), a ? {
1296
- x: c * u,
1297
- y: g * d
1298
- } : {
1299
- x: g * d,
1300
- y: c * u
1301
- };
1302
- }
1303
- const ai = function(e) {
1304
- return e === void 0 && (e = 0), {
1305
- name: "offset",
1306
- options: e,
1307
- async fn(n) {
1308
- var t, o;
1309
- const {
1310
- x: i,
1311
- y: r,
1312
- placement: l,
1313
- middlewareData: s
1314
- } = n, a = await li(n, e);
1315
- return l === ((t = s.offset) == null ? void 0 : t.placement) && (o = s.arrow) != null && o.alignmentOffset ? {} : {
1316
- x: i + a.x,
1317
- y: r + a.y,
1318
- data: {
1319
- ...a,
1320
- placement: l
1321
- }
1322
- };
1323
- }
1324
- };
1325
- }, ci = function(e) {
1326
- return e === void 0 && (e = {}), {
1327
- name: "shift",
1328
- options: e,
1329
- async fn(n) {
1330
- const {
1331
- x: t,
1332
- y: o,
1333
- placement: i
1334
- } = n, {
1335
- mainAxis: r = !0,
1336
- crossAxis: l = !1,
1337
- limiter: s = {
1338
- fn: (h) => {
1339
- let {
1340
- x: v,
1341
- y: w
1342
- } = h;
1343
- return {
1344
- x: v,
1345
- y: w
1346
- };
1347
- }
1348
- },
1349
- ...a
1350
- } = $e(e, n), d = {
1351
- x: t,
1352
- y: o
1353
- }, u = await ct(n, a), f = Se(ge(i)), g = wn(f);
1354
- let c = d[g], m = d[f];
1355
- if (r) {
1356
- const h = g === "y" ? "top" : "left", v = g === "y" ? "bottom" : "right", w = c + u[h], b = c - u[v];
1357
- c = Yt(w, c, b);
1358
- }
1359
- if (l) {
1360
- const h = f === "y" ? "top" : "left", v = f === "y" ? "bottom" : "right", w = m + u[h], b = m - u[v];
1361
- m = Yt(w, m, b);
1362
- }
1363
- const p = s.fn({
1364
- ...n,
1365
- [g]: c,
1366
- [f]: m
1367
- });
1368
- return {
1369
- ...p,
1370
- data: {
1371
- x: p.x - t,
1372
- y: p.y - o
1373
- }
1374
- };
1375
- }
1376
- };
1377
- }, ui = function(e) {
1378
- return e === void 0 && (e = {}), {
1379
- name: "size",
1380
- options: e,
1381
- async fn(n) {
1382
- const {
1383
- placement: t,
1384
- rects: o,
1385
- platform: i,
1386
- elements: r
1387
- } = n, {
1388
- apply: l = () => {
1389
- },
1390
- ...s
1391
- } = $e(e, n), a = await ct(n, s), d = ge(t), u = Ke(t), f = Se(t) === "y", {
1392
- width: g,
1393
- height: c
1394
- } = o.floating;
1395
- let m, p;
1396
- d === "top" || d === "bottom" ? (m = d, p = u === (await (i.isRTL == null ? void 0 : i.isRTL(r.floating)) ? "start" : "end") ? "left" : "right") : (p = d, m = u === "end" ? "top" : "bottom");
1397
- const h = c - a.top - a.bottom, v = g - a.left - a.right, w = pe(c - a[m], h), b = pe(g - a[p], v), x = !n.middlewareData.shift;
1398
- let y = w, O = b;
1399
- if (f ? O = u || x ? pe(b, v) : v : y = u || x ? pe(w, h) : h, x && !u) {
1400
- const $ = Z(a.left, 0), N = Z(a.right, 0), F = Z(a.top, 0), D = Z(a.bottom, 0);
1401
- f ? O = g - 2 * ($ !== 0 || N !== 0 ? $ + N : Z(a.left, a.right)) : y = c - 2 * (F !== 0 || D !== 0 ? F + D : Z(a.top, a.bottom));
1402
- }
1403
- await l({
1404
- ...n,
1405
- availableWidth: O,
1406
- availableHeight: y
1407
- });
1408
- const C = await i.getDimensions(r.floating);
1409
- return g !== C.width || c !== C.height ? {
1410
- reset: {
1411
- rects: !0
1412
- }
1413
- } : {};
1414
- }
1415
- };
1416
- };
1417
- function Rn(e) {
1418
- const n = re(e);
1419
- let t = parseFloat(n.width) || 0, o = parseFloat(n.height) || 0;
1420
- const i = ue(e), r = i ? e.offsetWidth : t, l = i ? e.offsetHeight : o, s = tt(t) !== r || tt(o) !== l;
1421
- return s && (t = r, o = l), {
1422
- width: t,
1423
- height: o,
1424
- $: s
1425
- };
1426
- }
1427
- function Mt(e) {
1428
- return G(e) ? e : e.contextElement;
1429
- }
1430
- function Me(e) {
1431
- const n = Mt(e);
1432
- if (!ue(n))
1433
- return he(1);
1434
- const t = n.getBoundingClientRect(), {
1435
- width: o,
1436
- height: i,
1437
- $: r
1438
- } = Rn(n);
1439
- let l = (r ? tt(t.width) : t.width) / o, s = (r ? tt(t.height) : t.height) / i;
1440
- return (!l || !Number.isFinite(l)) && (l = 1), (!s || !Number.isFinite(s)) && (s = 1), {
1441
- x: l,
1442
- y: s
1443
- };
1444
- }
1445
- const di = /* @__PURE__ */ he(0);
1446
- function Sn(e) {
1447
- const n = ee(e);
1448
- return !It() || !n.visualViewport ? di : {
1449
- x: n.visualViewport.offsetLeft,
1450
- y: n.visualViewport.offsetTop
1451
- };
1452
- }
1453
- function fi(e, n, t) {
1454
- return n === void 0 && (n = !1), !t || n && t !== ee(e) ? !1 : n;
1455
- }
1456
- function Oe(e, n, t, o) {
1457
- n === void 0 && (n = !1), t === void 0 && (t = !1);
1458
- const i = e.getBoundingClientRect(), r = Mt(e);
1459
- let l = he(1);
1460
- n && (o ? G(o) && (l = Me(o)) : l = Me(e));
1461
- const s = fi(r, t, o) ? Sn(r) : he(0);
1462
- let a = (i.left + s.x) / l.x, d = (i.top + s.y) / l.y, u = i.width / l.x, f = i.height / l.y;
1463
- if (r) {
1464
- const g = ee(r), c = o && G(o) ? ee(o) : o;
1465
- let m = g, p = m.frameElement;
1466
- for (; p && o && c !== m; ) {
1467
- const h = Me(p), v = p.getBoundingClientRect(), w = re(p), b = v.left + (p.clientLeft + parseFloat(w.paddingLeft)) * h.x, x = v.top + (p.clientTop + parseFloat(w.paddingTop)) * h.y;
1468
- a *= h.x, d *= h.y, u *= h.x, f *= h.y, a += b, d += x, m = ee(p), p = m.frameElement;
1469
- }
1470
- }
1471
- return ot({
1472
- width: u,
1473
- height: f,
1474
- x: a,
1475
- y: d
1476
- });
1477
- }
1478
- function pi(e) {
1479
- let {
1480
- elements: n,
1481
- rect: t,
1482
- offsetParent: o,
1483
- strategy: i
1484
- } = e;
1485
- const r = i === "fixed", l = de(o), s = n ? lt(n.floating) : !1;
1486
- if (o === l || s && r)
1487
- return t;
1488
- let a = {
1489
- scrollLeft: 0,
1490
- scrollTop: 0
1491
- }, d = he(1);
1492
- const u = he(0), f = ue(o);
1493
- if ((f || !f && !r) && ((De(o) !== "body" || qe(l)) && (a = at(o)), ue(o))) {
1494
- const g = Oe(o);
1495
- d = Me(o), u.x = g.x + o.clientLeft, u.y = g.y + o.clientTop;
1496
- }
1497
- return {
1498
- width: t.width * d.x,
1499
- height: t.height * d.y,
1500
- x: t.x * d.x - a.scrollLeft * d.x + u.x,
1501
- y: t.y * d.y - a.scrollTop * d.y + u.y
1502
- };
1503
- }
1504
- function mi(e) {
1505
- return Array.from(e.getClientRects());
1506
- }
1507
- function On(e) {
1508
- return Oe(de(e)).left + at(e).scrollLeft;
1509
- }
1510
- function hi(e) {
1511
- const n = de(e), t = at(e), o = e.ownerDocument.body, i = Z(n.scrollWidth, n.clientWidth, o.scrollWidth, o.clientWidth), r = Z(n.scrollHeight, n.clientHeight, o.scrollHeight, o.clientHeight);
1512
- let l = -t.scrollLeft + On(e);
1513
- const s = -t.scrollTop;
1514
- return re(o).direction === "rtl" && (l += Z(n.clientWidth, o.clientWidth) - i), {
1515
- width: i,
1516
- height: r,
1517
- x: l,
1518
- y: s
1519
- };
1520
- }
1521
- function gi(e, n) {
1522
- const t = ee(e), o = de(e), i = t.visualViewport;
1523
- let r = o.clientWidth, l = o.clientHeight, s = 0, a = 0;
1524
- if (i) {
1525
- r = i.width, l = i.height;
1526
- const d = It();
1527
- (!d || d && n === "fixed") && (s = i.offsetLeft, a = i.offsetTop);
1528
- }
1529
- return {
1530
- width: r,
1531
- height: l,
1532
- x: s,
1533
- y: a
1534
- };
1535
- }
1536
- function vi(e, n) {
1537
- const t = Oe(e, !0, n === "fixed"), o = t.top + e.clientTop, i = t.left + e.clientLeft, r = ue(e) ? Me(e) : he(1), l = e.clientWidth * r.x, s = e.clientHeight * r.y, a = i * r.x, d = o * r.y;
1538
- return {
1539
- width: l,
1540
- height: s,
1541
- x: a,
1542
- y: d
1543
- };
1544
- }
1545
- function Kt(e, n, t) {
1546
- let o;
1547
- if (n === "viewport")
1548
- o = gi(e, t);
1549
- else if (n === "document")
1550
- o = hi(de(e));
1551
- else if (G(n))
1552
- o = vi(n, t);
1553
- else {
1554
- const i = Sn(e);
1555
- o = {
1556
- ...n,
1557
- x: n.x - i.x,
1558
- y: n.y - i.y
1559
- };
1560
- }
1561
- return ot(o);
1562
- }
1563
- function Cn(e, n) {
1564
- const t = me(e);
1565
- return t === n || !G(t) || Ae(t) ? !1 : re(t).position === "fixed" || Cn(t, n);
1566
- }
1567
- function bi(e, n) {
1568
- const t = n.get(e);
1569
- if (t)
1570
- return t;
1571
- let o = Be(e, [], !1).filter((s) => G(s) && De(s) !== "body"), i = null;
1572
- const r = re(e).position === "fixed";
1573
- let l = r ? me(e) : e;
1574
- for (; G(l) && !Ae(l); ) {
1575
- const s = re(l), a = Tt(l);
1576
- !a && s.position === "fixed" && (i = null), (r ? !a && !i : !a && s.position === "static" && !!i && ["absolute", "fixed"].includes(i.position) || qe(l) && !a && Cn(e, l)) ? o = o.filter((u) => u !== l) : i = s, l = me(l);
1577
- }
1578
- return n.set(e, o), o;
1579
- }
1580
- function xi(e) {
1581
- let {
1582
- element: n,
1583
- boundary: t,
1584
- rootBoundary: o,
1585
- strategy: i
1586
- } = e;
1587
- const l = [...t === "clippingAncestors" ? lt(n) ? [] : bi(n, this._c) : [].concat(t), o], s = l[0], a = l.reduce((d, u) => {
1588
- const f = Kt(n, u, i);
1589
- return d.top = Z(f.top, d.top), d.right = pe(f.right, d.right), d.bottom = pe(f.bottom, d.bottom), d.left = Z(f.left, d.left), d;
1590
- }, Kt(n, s, i));
1591
- return {
1592
- width: a.right - a.left,
1593
- height: a.bottom - a.top,
1594
- x: a.left,
1595
- y: a.top
1596
- };
1597
- }
1598
- function wi(e) {
1599
- const {
1600
- width: n,
1601
- height: t
1602
- } = Rn(e);
1603
- return {
1604
- width: n,
1605
- height: t
1606
- };
1607
- }
1608
- function yi(e, n, t) {
1609
- const o = ue(n), i = de(n), r = t === "fixed", l = Oe(e, !0, r, n);
1610
- let s = {
1611
- scrollLeft: 0,
1612
- scrollTop: 0
1613
- };
1614
- const a = he(0);
1615
- if (o || !o && !r)
1616
- if ((De(n) !== "body" || qe(i)) && (s = at(n)), o) {
1617
- const f = Oe(n, !0, r, n);
1618
- a.x = f.x + n.clientLeft, a.y = f.y + n.clientTop;
1619
- } else i && (a.x = On(i));
1620
- const d = l.left + s.scrollLeft - a.x, u = l.top + s.scrollTop - a.y;
1621
- return {
1622
- x: d,
1623
- y: u,
1624
- width: l.width,
1625
- height: l.height
1626
- };
1627
- }
1628
- function ft(e) {
1629
- return re(e).position === "static";
1630
- }
1631
- function Gt(e, n) {
1632
- return !ue(e) || re(e).position === "fixed" ? null : n ? n(e) : e.offsetParent;
1633
- }
1634
- function Tn(e, n) {
1635
- const t = ee(e);
1636
- if (lt(e))
1637
- return t;
1638
- if (!ue(e)) {
1639
- let i = me(e);
1640
- for (; i && !Ae(i); ) {
1641
- if (G(i) && !ft(i))
1642
- return i;
1643
- i = me(i);
1644
- }
1645
- return t;
1646
- }
1647
- let o = Gt(e, n);
1648
- for (; o && Ko(o) && ft(o); )
1649
- o = Gt(o, n);
1650
- return o && Ae(o) && ft(o) && !Tt(o) ? t : o || Go(e) || t;
1651
- }
1652
- const Ei = async function(e) {
1653
- const n = this.getOffsetParent || Tn, t = this.getDimensions, o = await t(e.floating);
1654
- return {
1655
- reference: yi(e.reference, await n(e.floating), e.strategy),
1656
- floating: {
1657
- x: 0,
1658
- y: 0,
1659
- width: o.width,
1660
- height: o.height
1661
- }
1662
- };
1663
- };
1664
- function Ri(e) {
1665
- return re(e).direction === "rtl";
1666
- }
1667
- const Si = {
1668
- convertOffsetParentRelativeRectToViewportRelativeRect: pi,
1669
- getDocumentElement: de,
1670
- getClippingRect: xi,
1671
- getOffsetParent: Tn,
1672
- getElementRects: Ei,
1673
- getClientRects: mi,
1674
- getDimensions: wi,
1675
- getScale: Me,
1676
- isElement: G,
1677
- isRTL: Ri
1678
- };
1679
- function Oi(e, n) {
1680
- let t = null, o;
1681
- const i = de(e);
1682
- function r() {
1683
- var s;
1684
- clearTimeout(o), (s = t) == null || s.disconnect(), t = null;
1685
- }
1686
- function l(s, a) {
1687
- s === void 0 && (s = !1), a === void 0 && (a = 1), r();
1688
- const {
1689
- left: d,
1690
- top: u,
1691
- width: f,
1692
- height: g
1693
- } = e.getBoundingClientRect();
1694
- if (s || n(), !f || !g)
1695
- return;
1696
- const c = Qe(u), m = Qe(i.clientWidth - (d + f)), p = Qe(i.clientHeight - (u + g)), h = Qe(d), w = {
1697
- rootMargin: -c + "px " + -m + "px " + -p + "px " + -h + "px",
1698
- threshold: Z(0, pe(1, a)) || 1
1699
- };
1700
- let b = !0;
1701
- function x(y) {
1702
- const O = y[0].intersectionRatio;
1703
- if (O !== a) {
1704
- if (!b)
1705
- return l();
1706
- O ? l(!1, O) : o = setTimeout(() => {
1707
- l(!1, 1e-7);
1708
- }, 1e3);
1709
- }
1710
- b = !1;
1711
- }
1712
- try {
1713
- t = new IntersectionObserver(x, {
1714
- ...w,
1715
- // Handle <iframe>s
1716
- root: i.ownerDocument
1717
- });
1718
- } catch {
1719
- t = new IntersectionObserver(x, w);
1720
- }
1721
- t.observe(e);
1722
- }
1723
- return l(!0), r;
1724
- }
1725
- function Ci(e, n, t, o) {
1726
- o === void 0 && (o = {});
1727
- const {
1728
- ancestorScroll: i = !0,
1729
- ancestorResize: r = !0,
1730
- elementResize: l = typeof ResizeObserver == "function",
1731
- layoutShift: s = typeof IntersectionObserver == "function",
1732
- animationFrame: a = !1
1733
- } = o, d = Mt(e), u = i || r ? [...d ? Be(d) : [], ...Be(n)] : [];
1734
- u.forEach((v) => {
1735
- i && v.addEventListener("scroll", t, {
1736
- passive: !0
1737
- }), r && v.addEventListener("resize", t);
1738
- });
1739
- const f = d && s ? Oi(d, t) : null;
1740
- let g = -1, c = null;
1741
- l && (c = new ResizeObserver((v) => {
1742
- let [w] = v;
1743
- w && w.target === d && c && (c.unobserve(n), cancelAnimationFrame(g), g = requestAnimationFrame(() => {
1744
- var b;
1745
- (b = c) == null || b.observe(n);
1746
- })), t();
1747
- }), d && !a && c.observe(d), c.observe(n));
1748
- let m, p = a ? Oe(e) : null;
1749
- a && h();
1750
- function h() {
1751
- const v = Oe(e);
1752
- p && (v.x !== p.x || v.y !== p.y || v.width !== p.width || v.height !== p.height) && t(), p = v, m = requestAnimationFrame(h);
1753
- }
1754
- return t(), () => {
1755
- var v;
1756
- u.forEach((w) => {
1757
- i && w.removeEventListener("scroll", t), r && w.removeEventListener("resize", t);
1758
- }), f == null || f(), (v = c) == null || v.disconnect(), c = null, a && cancelAnimationFrame(m);
1759
- };
1760
- }
1761
- const pt = ct, Ti = ai, Ii = ci, Mi = si, _i = ui, Ai = (e, n, t) => {
1762
- const o = /* @__PURE__ */ new Map(), i = {
1763
- platform: Si,
1764
- ...t
1765
- }, r = {
1766
- ...i.platform,
1767
- _c: o
1768
- };
1769
- return ri(e, n, {
1770
- ...i,
1771
- platform: r
1772
- });
1773
- };
1774
- var Ze = typeof document < "u" ? an : oe;
1775
- function it(e, n) {
1776
- if (e === n)
1777
- return !0;
1778
- if (typeof e != typeof n)
1779
- return !1;
1780
- if (typeof e == "function" && e.toString() === n.toString())
1781
- return !0;
1782
- let t, o, i;
1783
- if (e && n && typeof e == "object") {
1784
- if (Array.isArray(e)) {
1785
- if (t = e.length, t !== n.length) return !1;
1786
- for (o = t; o-- !== 0; )
1787
- if (!it(e[o], n[o]))
1788
- return !1;
1789
- return !0;
1790
- }
1791
- if (i = Object.keys(e), t = i.length, t !== Object.keys(n).length)
1792
- return !1;
1793
- for (o = t; o-- !== 0; )
1794
- if (!{}.hasOwnProperty.call(n, i[o]))
1795
- return !1;
1796
- for (o = t; o-- !== 0; ) {
1797
- const r = i[o];
1798
- if (!(r === "_owner" && e.$$typeof) && !it(e[r], n[r]))
1799
- return !1;
1800
- }
1801
- return !0;
1802
- }
1803
- return e !== e && n !== n;
1804
- }
1805
- function In(e) {
1806
- return typeof window > "u" ? 1 : (e.ownerDocument.defaultView || window).devicePixelRatio || 1;
1807
- }
1808
- function Jt(e, n) {
1809
- const t = In(e);
1810
- return Math.round(n * t) / t;
1811
- }
1812
- function Xt(e) {
1813
- const n = E.useRef(e);
1814
- return Ze(() => {
1815
- n.current = e;
1816
- }), n;
1817
- }
1818
- function Pi(e) {
1819
- e === void 0 && (e = {});
1820
- const {
1821
- placement: n = "bottom",
1822
- strategy: t = "absolute",
1823
- middleware: o = [],
1824
- platform: i,
1825
- elements: {
1826
- reference: r,
1827
- floating: l
1828
- } = {},
1829
- transform: s = !0,
1830
- whileElementsMounted: a,
1831
- open: d
1832
- } = e, [u, f] = E.useState({
1833
- x: 0,
1834
- y: 0,
1835
- strategy: t,
1836
- placement: n,
1837
- middlewareData: {},
1838
- isPositioned: !1
1839
- }), [g, c] = E.useState(o);
1840
- it(g, o) || c(o);
1841
- const [m, p] = E.useState(null), [h, v] = E.useState(null), w = E.useCallback((R) => {
1842
- R !== O.current && (O.current = R, p(R));
1843
- }, []), b = E.useCallback((R) => {
1844
- R !== C.current && (C.current = R, v(R));
1845
- }, []), x = r || m, y = l || h, O = E.useRef(null), C = E.useRef(null), $ = E.useRef(u), N = a != null, F = Xt(a), D = Xt(i), k = E.useCallback(() => {
1846
- if (!O.current || !C.current)
1847
- return;
1848
- const R = {
1849
- placement: n,
1850
- strategy: t,
1851
- middleware: g
1852
- };
1853
- D.current && (R.platform = D.current), Ai(O.current, C.current, R).then((z) => {
1854
- const M = {
1855
- ...z,
1856
- isPositioned: !0
1857
- };
1858
- I.current && !it($.current, M) && ($.current = M, We.flushSync(() => {
1859
- f(M);
1860
- }));
1861
- });
1862
- }, [g, n, t, D]);
1863
- Ze(() => {
1864
- d === !1 && $.current.isPositioned && ($.current.isPositioned = !1, f((R) => ({
1865
- ...R,
1866
- isPositioned: !1
1867
- })));
1868
- }, [d]);
1869
- const I = E.useRef(!1);
1870
- Ze(() => (I.current = !0, () => {
1871
- I.current = !1;
1872
- }), []), Ze(() => {
1873
- if (x && (O.current = x), y && (C.current = y), x && y) {
1874
- if (F.current)
1875
- return F.current(x, y, k);
1876
- k();
1877
- }
1878
- }, [x, y, k, F, N]);
1879
- const S = E.useMemo(() => ({
1880
- reference: O,
1881
- floating: C,
1882
- setReference: w,
1883
- setFloating: b
1884
- }), [w, b]), L = E.useMemo(() => ({
1885
- reference: x,
1886
- floating: y
1887
- }), [x, y]), V = E.useMemo(() => {
1888
- const R = {
1889
- position: t,
1890
- left: 0,
1891
- top: 0
1892
- };
1893
- if (!L.floating)
1894
- return R;
1895
- const z = Jt(L.floating, u.x), M = Jt(L.floating, u.y);
1896
- return s ? {
1897
- ...R,
1898
- transform: "translate(" + z + "px, " + M + "px)",
1899
- ...In(L.floating) >= 1.5 && {
1900
- willChange: "transform"
1901
- }
1902
- } : {
1903
- position: t,
1904
- left: z,
1905
- top: M
1906
- };
1907
- }, [t, s, L.floating, u.x, u.y]);
1908
- return E.useMemo(() => ({
1909
- ...u,
1910
- update: k,
1911
- refs: S,
1912
- elements: L,
1913
- floatingStyles: V
1914
- }), [u, k, S, L, V]);
1915
- }
1916
- const Mn = (e, n) => ({
1917
- ...Ti(e),
1918
- options: [e, n]
1919
- }), Di = (e, n) => ({
1920
- ...Ii(e),
1921
- options: [e, n]
1922
- }), $i = (e, n) => ({
1923
- ...Mi(e),
1924
- options: [e, n]
1925
- }), Li = (e, n) => ({
1926
- ..._i(e),
1927
- options: [e, n]
1928
- }), _n = {
1929
- ...E
1930
- }, Fi = _n.useInsertionEffect, Ni = Fi || ((e) => e());
1931
- function An(e) {
1932
- const n = E.useRef(() => {
1933
- if (process.env.NODE_ENV !== "production")
1934
- throw new Error("Cannot call an event handler while rendering.");
1935
- });
1936
- return Ni(() => {
1937
- n.current = e;
1938
- }), E.useCallback(function() {
1939
- for (var t = arguments.length, o = new Array(t), i = 0; i < t; i++)
1940
- o[i] = arguments[i];
1941
- return n.current == null ? void 0 : n.current(...o);
1942
- }, []);
1943
- }
1944
- var xt = typeof document < "u" ? an : oe;
1945
- let Qt = !1, ki = 0;
1946
- const Zt = () => (
1947
- // Ensure the id is unique with multiple independent versions of Floating UI
1948
- // on <React 18
1949
- "floating-ui-" + Math.random().toString(36).slice(2, 6) + ki++
1950
- );
1951
- function zi() {
1952
- const [e, n] = E.useState(() => Qt ? Zt() : void 0);
1953
- return xt(() => {
1954
- e == null && n(Zt());
1955
- }, []), E.useEffect(() => {
1956
- Qt = !0;
1957
- }, []), e;
1958
- }
1959
- const Hi = _n.useId, Vi = Hi || zi;
1960
- let je;
1961
- process.env.NODE_ENV !== "production" && (je = /* @__PURE__ */ new Set());
1962
- function Wi() {
1963
- for (var e, n = arguments.length, t = new Array(n), o = 0; o < n; o++)
1964
- t[o] = arguments[o];
1965
- const i = "Floating UI: " + t.join(" ");
1966
- if (!((e = je) != null && e.has(i))) {
1967
- var r;
1968
- (r = je) == null || r.add(i), console.warn(i);
1969
- }
1970
- }
1971
- function Bi() {
1972
- for (var e, n = arguments.length, t = new Array(n), o = 0; o < n; o++)
1973
- t[o] = arguments[o];
1974
- const i = "Floating UI: " + t.join(" ");
1975
- if (!((e = je) != null && e.has(i))) {
1976
- var r;
1977
- (r = je) == null || r.add(i), console.error(i);
1978
- }
1979
- }
1980
- function ji() {
1981
- const e = /* @__PURE__ */ new Map();
1982
- return {
1983
- emit(n, t) {
1984
- var o;
1985
- (o = e.get(n)) == null || o.forEach((i) => i(t));
1986
- },
1987
- on(n, t) {
1988
- e.set(n, [...e.get(n) || [], t]);
1989
- },
1990
- off(n, t) {
1991
- var o;
1992
- e.set(n, ((o = e.get(n)) == null ? void 0 : o.filter((i) => i !== t)) || []);
1993
- }
1994
- };
1995
- }
1996
- const Ui = /* @__PURE__ */ E.createContext(null), Yi = /* @__PURE__ */ E.createContext(null), qi = () => {
1997
- var e;
1998
- return ((e = E.useContext(Ui)) == null ? void 0 : e.id) || null;
1999
- }, Ki = () => E.useContext(Yi);
2000
- function Gi(e) {
2001
- const {
2002
- open: n = !1,
2003
- onOpenChange: t,
2004
- elements: o
2005
- } = e, i = Vi(), r = E.useRef({}), [l] = E.useState(() => ji()), s = qi() != null;
2006
- if (process.env.NODE_ENV !== "production") {
2007
- const c = o.reference;
2008
- c && !G(c) && Bi("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `refs.setPositionReference()`", "instead.");
2009
- }
2010
- const [a, d] = E.useState(o.reference), u = An((c, m, p) => {
2011
- r.current.openEvent = c ? m : void 0, l.emit("openchange", {
2012
- open: c,
2013
- event: m,
2014
- reason: p,
2015
- nested: s
2016
- }), t == null || t(c, m, p);
2017
- }), f = E.useMemo(() => ({
2018
- setPositionReference: d
2019
- }), []), g = E.useMemo(() => ({
2020
- reference: a || o.reference || null,
2021
- floating: o.floating || null,
2022
- domReference: o.reference
2023
- }), [a, o.reference, o.floating]);
2024
- return E.useMemo(() => ({
2025
- dataRef: r,
2026
- open: n,
2027
- onOpenChange: u,
2028
- elements: g,
2029
- events: l,
2030
- floatingId: i,
2031
- refs: f
2032
- }), [n, u, g, l, i, f]);
2033
- }
2034
- function Ji(e) {
2035
- e === void 0 && (e = {});
2036
- const {
2037
- nodeId: n
2038
- } = e, t = Gi({
2039
- ...e,
2040
- elements: {
2041
- reference: null,
2042
- floating: null,
2043
- ...e.elements
2044
- }
2045
- }), o = e.rootContext || t, i = o.elements, [r, l] = E.useState(null), [s, a] = E.useState(null), u = (i == null ? void 0 : i.reference) || r, f = E.useRef(null), g = Ki();
2046
- xt(() => {
2047
- u && (f.current = u);
2048
- }, [u]);
2049
- const c = Pi({
2050
- ...e,
2051
- elements: {
2052
- ...i,
2053
- ...s && {
2054
- reference: s
2055
- }
2056
- }
2057
- }), m = E.useCallback((b) => {
2058
- const x = G(b) ? {
2059
- getBoundingClientRect: () => b.getBoundingClientRect(),
2060
- contextElement: b
2061
- } : b;
2062
- a(x), c.refs.setReference(x);
2063
- }, [c.refs]), p = E.useCallback((b) => {
2064
- (G(b) || b === null) && (f.current = b, l(b)), (G(c.refs.reference.current) || c.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
2065
- // `null` to support `positionReference` + an unstable `reference`
2066
- // callback ref.
2067
- b !== null && !G(b)) && c.refs.setReference(b);
2068
- }, [c.refs]), h = E.useMemo(() => ({
2069
- ...c.refs,
2070
- setReference: p,
2071
- setPositionReference: m,
2072
- domReference: f
2073
- }), [c.refs, p, m]), v = E.useMemo(() => ({
2074
- ...c.elements,
2075
- domReference: u
2076
- }), [c.elements, u]), w = E.useMemo(() => ({
2077
- ...c,
2078
- ...o,
2079
- refs: h,
2080
- elements: v,
2081
- nodeId: n
2082
- }), [c, h, v, n, o]);
2083
- return xt(() => {
2084
- o.dataRef.current.floatingContext = w;
2085
- const b = g == null ? void 0 : g.nodesRef.current.find((x) => x.id === n);
2086
- b && (b.context = w);
2087
- }), E.useMemo(() => ({
2088
- ...c,
2089
- context: w,
2090
- refs: h,
2091
- elements: v
2092
- }), [c, h, v, w]);
2093
- }
2094
- const en = "active", tn = "selected";
2095
- function mt(e, n, t) {
2096
- const o = /* @__PURE__ */ new Map(), i = t === "item";
2097
- let r = e;
2098
- if (i && e) {
1
+ import { jsx as n, jsxs as u, Fragment as y } from "react/jsx-runtime";
2
+ import { c as i } from "../../index-DIxK0V-G.js";
3
+ import { forwardRef as H, useState as z, useMemo as K, useCallback as U, useEffect as W } from "react";
4
+ import { ESelectSearchSize as v } from "./constants.js";
5
+ import { mapSizeToInputSize as D, getDropdownArrowIcon as R } from "./utils.js";
6
+ import { Icon as q } from "../../icons/Icon.js";
7
+ import { Button as $ } from "../Button/Button.js";
8
+ import { I as A } from "../../Input-DlGNMuUD.js";
9
+ import { EInputVariant as J } from "../Input/constants.js";
10
+ import { H as Q, U as B, G as M, K as X, W as Y } from "../../combobox-CDU06zJj.js";
11
+ import '../../assets/SelectSearch.css';const Z = "_disabled_rphak_5", ee = "_container_rphak_9", te = "_full_rphak_22", oe = "_button_rphak_34", ae = "_options_rphak_48", ne = "_top_rphak_59", se = "_bottom_rphak_64", re = "_m_rphak_91", ie = "_l_rphak_106", le = "_option_rphak_48", ce = "_clear_rphak_160", e = {
12
+ "select-search": "_select-search_rphak_2",
13
+ disabled: Z,
14
+ container: ee,
15
+ "container-open": "_container-open_rphak_18",
16
+ full: te,
17
+ "selected-icon": "_selected-icon_rphak_26",
18
+ "selector-icon-open": "_selector-icon-open_rphak_30",
19
+ button: oe,
20
+ "selector-icon": "_selector-icon_rphak_30",
21
+ options: ae,
22
+ top: ne,
23
+ bottom: se,
24
+ "no-options": "_no-options_rphak_85",
25
+ m: re,
26
+ l: ie,
27
+ "select-input": "_select-input_rphak_121",
28
+ "select-input-disabled": "_select-input-disabled_rphak_124",
29
+ option: le,
30
+ "option-active": "_option-active_rphak_140",
31
+ "option-inner": "_option-inner_rphak_143",
32
+ "right-slot": "_right-slot_rphak_150",
33
+ "required-mark": "_required-mark_rphak_155",
34
+ clear: ce,
35
+ "icon-button": "_icon-button_rphak_169"
36
+ }, ve = H(
37
+ (O, L) => {
2099
38
  const {
2100
- [en]: l,
2101
- [tn]: s,
2102
- ...a
2103
- } = e;
2104
- r = a;
2105
- }
2106
- return {
2107
- ...t === "floating" && {
2108
- tabIndex: -1
2109
- },
2110
- ...r,
2111
- ...n.map((l) => {
2112
- const s = l ? l[t] : null;
2113
- return typeof s == "function" ? e ? s(e) : null : s;
2114
- }).concat(e).reduce((l, s) => (s && Object.entries(s).forEach((a) => {
2115
- let [d, u] = a;
2116
- if (!(i && [en, tn].includes(d)))
2117
- if (d.indexOf("on") === 0) {
2118
- if (o.has(d) || o.set(d, []), typeof u == "function") {
2119
- var f;
2120
- (f = o.get(d)) == null || f.push(u), l[d] = function() {
2121
- for (var g, c = arguments.length, m = new Array(c), p = 0; p < c; p++)
2122
- m[p] = arguments[p];
2123
- return (g = o.get(d)) == null ? void 0 : g.map((h) => h(...m)).find((h) => h !== void 0);
2124
- };
2125
- }
2126
- } else
2127
- l[d] = u;
2128
- }), l), {})
2129
- };
2130
- }
2131
- function Xi(e) {
2132
- e === void 0 && (e = []);
2133
- const n = e.map((s) => s == null ? void 0 : s.reference), t = e.map((s) => s == null ? void 0 : s.floating), o = e.map((s) => s == null ? void 0 : s.item), i = E.useCallback(
2134
- (s) => mt(s, e, "reference"),
2135
- // eslint-disable-next-line react-hooks/exhaustive-deps
2136
- n
2137
- ), r = E.useCallback(
2138
- (s) => mt(s, e, "floating"),
2139
- // eslint-disable-next-line react-hooks/exhaustive-deps
2140
- t
2141
- ), l = E.useCallback(
2142
- (s) => mt(s, e, "item"),
2143
- // eslint-disable-next-line react-hooks/exhaustive-deps
2144
- o
2145
- );
2146
- return E.useMemo(() => ({
2147
- getReferenceProps: i,
2148
- getFloatingProps: r,
2149
- getItemProps: l
2150
- }), [i, r, l]);
2151
- }
2152
- function nn(e, n) {
2153
- return {
2154
- ...e,
2155
- rects: {
2156
- ...e.rects,
2157
- floating: {
2158
- ...e.rects.floating,
2159
- height: n
2160
- }
2161
- }
2162
- };
2163
- }
2164
- const Qi = (e) => ({
2165
- name: "inner",
2166
- options: e,
2167
- async fn(n) {
2168
- const {
2169
- listRef: t,
2170
- overflowRef: o,
2171
- onFallbackChange: i,
2172
- offset: r = 0,
2173
- index: l = 0,
2174
- minItemsVisible: s = 4,
2175
- referenceOverflowThreshold: a = 0,
2176
- scrollRef: d,
2177
- ...u
2178
- } = $e(e, n), {
2179
- rects: f,
2180
- elements: {
2181
- floating: g
2182
- }
2183
- } = n, c = t.current[l];
2184
- if (process.env.NODE_ENV !== "production" && (n.placement.startsWith("bottom") || Wi('`placement` side must be "bottom" when using the `inner`', "middleware.")), !c)
2185
- return {};
2186
- const m = {
2187
- ...n,
2188
- ...await Mn(-c.offsetTop - g.clientTop - f.reference.height / 2 - c.offsetHeight / 2 - r).fn(n)
2189
- }, p = (d == null ? void 0 : d.current) || g, h = await pt(nn(m, p.scrollHeight), u), v = await pt(m, {
2190
- ...u,
2191
- elementContext: "reference"
2192
- }), w = Math.max(0, h.top), b = m.y + w, x = Math.max(0, p.scrollHeight - w - Math.max(0, h.bottom));
2193
- return p.style.maxHeight = x + "px", p.scrollTop = w, i && (p.offsetHeight < c.offsetHeight * Math.min(s, t.current.length - 1) - 1 || v.top >= -a || v.bottom >= -a ? We.flushSync(() => i(!0)) : We.flushSync(() => i(!1))), o && (o.current = await pt(nn({
2194
- ...m,
2195
- y: b
2196
- }, p.offsetHeight), u)), {
2197
- y: b
2198
- };
2199
- }
2200
- });
2201
- function Zi(e, n) {
2202
- const {
2203
- open: t,
2204
- elements: o
2205
- } = e, {
2206
- enabled: i = !0,
2207
- overflowRef: r,
2208
- scrollRef: l,
2209
- onChange: s
2210
- } = n, a = An(s), d = E.useRef(!1), u = E.useRef(null), f = E.useRef(null);
2211
- E.useEffect(() => {
2212
- if (!i) return;
2213
- function c(p) {
2214
- if (p.ctrlKey || !m || r.current == null)
2215
- return;
2216
- const h = p.deltaY, v = r.current.top >= -0.5, w = r.current.bottom >= -0.5, b = m.scrollHeight - m.clientHeight, x = h < 0 ? -1 : 1, y = h < 0 ? "max" : "min";
2217
- m.scrollHeight <= m.clientHeight || (!v && h > 0 || !w && h < 0 ? (p.preventDefault(), We.flushSync(() => {
2218
- a((O) => O + Math[y](h, b * x));
2219
- })) : /firefox/i.test(Jo()) && (m.scrollTop += h));
2220
- }
2221
- const m = (l == null ? void 0 : l.current) || o.floating;
2222
- if (t && m)
2223
- return m.addEventListener("wheel", c), requestAnimationFrame(() => {
2224
- u.current = m.scrollTop, r.current != null && (f.current = {
2225
- ...r.current
2226
- });
2227
- }), () => {
2228
- u.current = null, f.current = null, m.removeEventListener("wheel", c);
2229
- };
2230
- }, [i, t, o.floating, r, l, a]);
2231
- const g = E.useMemo(() => ({
2232
- onKeyDown() {
2233
- d.current = !0;
2234
- },
2235
- onWheel() {
2236
- d.current = !1;
2237
- },
2238
- onPointerMove() {
2239
- d.current = !1;
2240
- },
2241
- onScroll() {
2242
- const c = (l == null ? void 0 : l.current) || o.floating;
2243
- if (!(!r.current || !c || !d.current)) {
2244
- if (u.current !== null) {
2245
- const m = c.scrollTop - u.current;
2246
- (r.current.bottom < -0.5 && m < -1 || r.current.top < -0.5 && m > 1) && We.flushSync(() => a((p) => p + m));
2247
- }
2248
- requestAnimationFrame(() => {
2249
- u.current = c.scrollTop;
2250
- });
2251
- }
2252
- }
2253
- }), [o.floating, a, r, l]);
2254
- return E.useMemo(() => i ? {
2255
- floating: g
2256
- } : {}, [i, g]);
2257
- }
2258
- let Ge = ve({ styles: void 0, setReference: () => {
2259
- }, setFloating: () => {
2260
- }, getReferenceProps: () => ({}), getFloatingProps: () => ({}), slot: {} });
2261
- Ge.displayName = "FloatingContext";
2262
- let _t = ve(null);
2263
- _t.displayName = "PlacementContext";
2264
- function er(e) {
2265
- return K(() => e ? typeof e == "string" ? { to: e } : e : null, [e]);
2266
- }
2267
- function tr() {
2268
- return ce(Ge).setReference;
2269
- }
2270
- function nr() {
2271
- let { getFloatingProps: e, slot: n } = ce(Ge);
2272
- return Ve((...t) => Object.assign({}, e(...t), { "data-anchor": n.anchor }), [e, n]);
2273
- }
2274
- function or(e = null) {
2275
- e === !1 && (e = null), typeof e == "string" && (e = { to: e });
2276
- let n = ce(_t), t = K(() => e, [JSON.stringify(e, typeof HTMLElement < "u" ? (i, r) => r instanceof HTMLElement ? r.outerHTML : r : void 0)]);
2277
- U(() => {
2278
- n == null || n(t ?? null);
2279
- }, [n, t]);
2280
- let o = ce(Ge);
2281
- return K(() => [o.setFloating, e ? o.styles : {}], [o.setFloating, e, o.styles]);
2282
- }
2283
- let on = 4;
2284
- function ir({ children: e, enabled: n = !0 }) {
2285
- let [t, o] = ae(null), [i, r] = ae(0), l = Y(null), [s, a] = ae(null);
2286
- rr(s);
2287
- let d = n && t !== null && s !== null, { to: u = "bottom", gap: f = 0, offset: g = 0, padding: c = 0, inner: m } = sr(t, s), [p, h = "center"] = u.split(" ");
2288
- U(() => {
2289
- d && r(0);
2290
- }, [d]);
2291
- let { refs: v, floatingStyles: w, context: b } = Ji({ open: d, placement: p === "selection" ? h === "center" ? "bottom" : `bottom-${h}` : h === "center" ? `${p}` : `${p}-${h}`, strategy: "absolute", transform: !1, middleware: [Mn({ mainAxis: p === "selection" ? 0 : f, crossAxis: g }), Di({ padding: c }), p !== "selection" && $i({ padding: c }), p === "selection" && m ? Qi({ ...m, padding: c, overflowRef: l, offset: i, minItemsVisible: on, referenceOverflowThreshold: c, onFallbackChange(D) {
2292
- var k, I;
2293
- if (!D) return;
2294
- let S = b.elements.floating;
2295
- if (!S) return;
2296
- let L = parseFloat(getComputedStyle(S).scrollPaddingBottom) || 0, V = Math.min(on, S.childElementCount), R = 0, z = 0;
2297
- for (let M of (I = (k = b.elements.floating) == null ? void 0 : k.childNodes) != null ? I : []) if (M instanceof HTMLElement) {
2298
- let te = M.offsetTop, Te = te + M.clientHeight + L, T = S.scrollTop, J = T + S.clientHeight;
2299
- if (te >= T && Te <= J) V--;
2300
- else {
2301
- z = Math.max(0, Math.min(Te, J) - Math.max(te, T)), R = M.clientHeight;
2302
- break;
2303
- }
2304
- }
2305
- V >= 1 && r((M) => {
2306
- let te = R * V - z + L;
2307
- return M >= te ? M : te;
2308
- });
2309
- } }) : null, Li({ padding: c, apply({ availableWidth: D, availableHeight: k, elements: I }) {
2310
- Object.assign(I.floating.style, { overflow: "auto", maxWidth: `${D}px`, maxHeight: `min(var(--anchor-max-height, 100vh), ${k}px)` });
2311
- } })].filter(Boolean), whileElementsMounted: Ci }), [x = p, y = h] = b.placement.split("-");
2312
- p === "selection" && (x = "selection");
2313
- let O = K(() => ({ anchor: [x, y].filter(Boolean).join(" ") }), [x, y]), C = Zi(b, { overflowRef: l, onChange: r }), { getReferenceProps: $, getFloatingProps: N } = Xi([C]), F = _((D) => {
2314
- a(D), v.setFloating(D);
2315
- });
2316
- return E.createElement(_t.Provider, { value: o }, E.createElement(Ge.Provider, { value: { setFloating: F, setReference: v.setReference, styles: w, getReferenceProps: $, getFloatingProps: N, slot: O } }, e));
2317
- }
2318
- function rr(e) {
2319
- U(() => {
2320
- if (!e) return;
2321
- let n = new MutationObserver(() => {
2322
- let t = window.getComputedStyle(e).maxHeight, o = parseFloat(t);
2323
- if (isNaN(o)) return;
2324
- let i = parseInt(t);
2325
- isNaN(i) || o !== i && (e.style.maxHeight = `${Math.ceil(o)}px`);
2326
- });
2327
- return n.observe(e, { attributes: !0, attributeFilter: ["style"] }), () => {
2328
- n.disconnect();
2329
- };
2330
- }, [e]);
2331
- }
2332
- function sr(e, n) {
2333
- var t, o, i;
2334
- let r = ht((t = e == null ? void 0 : e.gap) != null ? t : "var(--anchor-gap, 0)", n), l = ht((o = e == null ? void 0 : e.offset) != null ? o : "var(--anchor-offset, 0)", n), s = ht((i = e == null ? void 0 : e.padding) != null ? i : "var(--anchor-padding, 0)", n);
2335
- return { ...e, gap: r, offset: l, padding: s };
2336
- }
2337
- function ht(e, n, t = void 0) {
2338
- let o = cn(), i = _((a, d) => {
2339
- if (a == null) return [t, null];
2340
- if (typeof a == "number") return [a, null];
2341
- if (typeof a == "string") {
2342
- if (!d) return [t, null];
2343
- let u = rn(a, d);
2344
- return [u, (f) => {
2345
- let g = Pn(a);
2346
- {
2347
- let c = g.map((m) => window.getComputedStyle(d).getPropertyValue(m));
2348
- o.requestAnimationFrame(function m() {
2349
- o.nextFrame(m);
2350
- let p = !1;
2351
- for (let [v, w] of g.entries()) {
2352
- let b = window.getComputedStyle(d).getPropertyValue(w);
2353
- if (c[v] !== b) {
2354
- c[v] = b, p = !0;
2355
- break;
2356
- }
2357
- }
2358
- if (!p) return;
2359
- let h = rn(a, d);
2360
- u !== h && (f(h), u = h);
2361
- });
2362
- }
2363
- return o.dispose;
2364
- }];
2365
- }
2366
- return [t, null];
2367
- }), r = K(() => i(e, n)[0], [e, n]), [l = r, s] = ae();
2368
- return U(() => {
2369
- let [a, d] = i(e, n);
2370
- if (s(a), !!d) return d(s);
2371
- }, [e, n]), l;
2372
- }
2373
- function Pn(e) {
2374
- let n = /var\((.*)\)/.exec(e);
2375
- if (n) {
2376
- let t = n[1].indexOf(",");
2377
- if (t === -1) return [n[1]];
2378
- let o = n[1].slice(0, t).trim(), i = n[1].slice(t + 1).trim();
2379
- return i ? [o, ...Pn(i)] : [o];
2380
- }
2381
- return [];
2382
- }
2383
- function rn(e, n) {
2384
- let t = document.createElement("div");
2385
- n.appendChild(t), t.style.setProperty("margin-top", "0px", "important"), t.style.setProperty("margin-top", e, "important");
2386
- let o = parseFloat(window.getComputedStyle(t).marginTop) || 0;
2387
- return n.removeChild(t), o;
2388
- }
2389
- function lr({ children: e, freeze: n }) {
2390
- let t = wt(n, e);
2391
- return j.createElement(j.Fragment, null, t);
2392
- }
2393
- function wt(e, n) {
2394
- let [t, o] = ae(n);
2395
- return !e && t !== n && o(n), e ? t : n;
2396
- }
2397
- function ar(e) {
2398
- function n() {
2399
- document.readyState !== "loading" && (e(), document.removeEventListener("DOMContentLoaded", n));
2400
- }
2401
- typeof window < "u" && typeof document < "u" && (document.addEventListener("DOMContentLoaded", n), n());
2402
- }
2403
- let ye = [];
2404
- ar(() => {
2405
- function e(n) {
2406
- if (!(n.target instanceof HTMLElement) || n.target === document.body || ye[0] === n.target) return;
2407
- let t = n.target;
2408
- t = t.closest(ao), ye.unshift(t ?? n.target), ye = ye.filter((o) => o != null && o.isConnected), ye.splice(10);
2409
- }
2410
- window.addEventListener("click", e, { capture: !0 }), window.addEventListener("mousedown", e, { capture: !0 }), window.addEventListener("focus", e, { capture: !0 }), document.body.addEventListener("click", e, { capture: !0 }), document.body.addEventListener("mousedown", e, { capture: !0 }), document.body.addEventListener("focus", e, { capture: !0 });
2411
- });
2412
- function cr(e) {
2413
- throw new Error("Unexpected object: " + e);
2414
- }
2415
- var B = ((e) => (e[e.First = 0] = "First", e[e.Previous = 1] = "Previous", e[e.Next = 2] = "Next", e[e.Last = 3] = "Last", e[e.Specific = 4] = "Specific", e[e.Nothing = 5] = "Nothing", e))(B || {});
2416
- function sn(e, n) {
2417
- let t = n.resolveItems();
2418
- if (t.length <= 0) return null;
2419
- let o = n.resolveActiveIndex(), i = o ?? -1;
2420
- switch (e.focus) {
2421
- case 0: {
2422
- for (let r = 0; r < t.length; ++r) if (!n.resolveDisabled(t[r], r, t)) return r;
2423
- return o;
2424
- }
2425
- case 1: {
2426
- i === -1 && (i = t.length);
2427
- for (let r = i - 1; r >= 0; --r) if (!n.resolveDisabled(t[r], r, t)) return r;
2428
- return o;
2429
- }
2430
- case 2: {
2431
- for (let r = i + 1; r < t.length; ++r) if (!n.resolveDisabled(t[r], r, t)) return r;
2432
- return o;
2433
- }
2434
- case 3: {
2435
- for (let r = t.length - 1; r >= 0; --r) if (!n.resolveDisabled(t[r], r, t)) return r;
2436
- return o;
2437
- }
2438
- case 4: {
2439
- for (let r = 0; r < t.length; ++r) if (n.resolveId(t[r], r, t) === e.id) return r;
2440
- return o;
2441
- }
2442
- case 5:
2443
- return null;
2444
- default:
2445
- cr(e);
2446
- }
2447
- }
2448
- var At = ((e) => (e[e.Left = 0] = "Left", e[e.Right = 2] = "Right", e))(At || {});
2449
- function ur(e) {
2450
- let n = _(e), t = Y(!1);
2451
- oe(() => (t.current = !1, () => {
2452
- t.current = !0, qn(() => {
2453
- t.current && n();
2454
- });
2455
- }), [n]);
2456
- }
2457
- function dr() {
2458
- let e = typeof document > "u";
2459
- return "useSyncExternalStore" in E ? ((n) => n.useSyncExternalStore)(E)(() => () => {
2460
- }, () => !1, () => !e) : !1;
2461
- }
2462
- function fr() {
2463
- let e = dr(), [n, t] = E.useState(ze.isHandoffComplete);
2464
- return n && ze.isHandoffComplete === !1 && t(!1), E.useEffect(() => {
2465
- n !== !0 && t(!0);
2466
- }, [n]), E.useEffect(() => ze.handoff(), []), e ? !1 : n;
2467
- }
2468
- let pr = ve(!1);
2469
- function mr() {
2470
- return ce(pr);
2471
- }
2472
- function hr(e) {
2473
- let n = mr(), t = ce($n), o = st(e), [i, r] = ae(() => {
2474
- var l;
2475
- if (!n && t !== null) return (l = t.current) != null ? l : null;
2476
- if (ze.isServer) return null;
2477
- let s = o == null ? void 0 : o.getElementById("headlessui-portal-root");
2478
- if (s) return s;
2479
- if (o === null) return null;
2480
- let a = o.createElement("div");
2481
- return a.setAttribute("id", "headlessui-portal-root"), o.body.appendChild(a);
2482
- });
2483
- return oe(() => {
2484
- i !== null && (o != null && o.body.contains(i) || o == null || o.body.appendChild(i));
2485
- }, [i, o]), oe(() => {
2486
- n || t !== null && r(t.current);
2487
- }, [t, r, n]), i;
2488
- }
2489
- let Dn = rt, gr = be(function(e, n) {
2490
- let t = e, o = Y(null), i = Ce(Kn((u) => {
2491
- o.current = u;
2492
- }), n), r = st(o), l = hr(o), [s] = ae(() => {
2493
- var u;
2494
- return ze.isServer ? null : (u = r == null ? void 0 : r.createElement("div")) != null ? u : null;
2495
- }), a = ce(wr), d = fr();
2496
- return U(() => {
2497
- !l || !s || l.contains(s) || (s.setAttribute("data-headlessui-portal", ""), l.appendChild(s));
2498
- }, [l, s]), U(() => {
2499
- if (s && a) return a.register(s);
2500
- }, [a, s]), ur(() => {
2501
- var u;
2502
- !l || !s || (s instanceof Node && l.contains(s) && l.removeChild(s), l.childNodes.length <= 0 && ((u = l.parentElement) == null || u.removeChild(l)));
2503
- }), d ? !l || !s ? null : Gn(xe({ ourProps: { ref: i }, theirProps: t, slot: {}, defaultTag: Dn, name: "Portal" }), s) : null;
2504
- });
2505
- function vr(e, n) {
2506
- let t = Ce(n), { enabled: o = !0, ...i } = e;
2507
- return o ? j.createElement(gr, { ...i, ref: t }) : xe({ ourProps: { ref: t }, theirProps: i, slot: {}, defaultTag: Dn, name: "Portal" });
2508
- }
2509
- let br = rt, $n = ve(null);
2510
- function xr(e, n) {
2511
- let { target: t, ...o } = e, i = { ref: Ce(n) };
2512
- return j.createElement($n.Provider, { value: t }, xe({ ourProps: i, theirProps: o, defaultTag: br, name: "Popover.Group" }));
2513
- }
2514
- let wr = ve(null), yr = be(vr), Er = be(xr), Rr = Object.assign(yr, { Group: Er });
2515
- var Sr = ((e) => (e[e.Open = 0] = "Open", e[e.Closed = 1] = "Closed", e))(Sr || {}), Or = ((e) => (e[e.Single = 0] = "Single", e[e.Multi = 1] = "Multi", e))(Or || {}), Cr = ((e) => (e[e.Pointer = 0] = "Pointer", e[e.Focus = 1] = "Focus", e[e.Other = 2] = "Other", e))(Cr || {}), Tr = ((e) => (e[e.OpenCombobox = 0] = "OpenCombobox", e[e.CloseCombobox = 1] = "CloseCombobox", e[e.GoToOption = 2] = "GoToOption", e[e.SetTyping = 3] = "SetTyping", e[e.RegisterOption = 4] = "RegisterOption", e[e.UnregisterOption = 5] = "UnregisterOption", e[e.SetActivationTrigger = 6] = "SetActivationTrigger", e[e.UpdateVirtualConfiguration = 7] = "UpdateVirtualConfiguration", e))(Tr || {});
2516
- function gt(e, n = (t) => t) {
2517
- let t = e.activeOptionIndex !== null ? e.options[e.activeOptionIndex] : null, o = n(e.options.slice()), i = o.length > 0 && o[0].dataRef.current.order !== null ? o.sort((l, s) => l.dataRef.current.order - s.dataRef.current.order) : co(o, (l) => l.dataRef.current.domRef.current), r = t ? i.indexOf(t) : null;
2518
- return r === -1 && (r = null), { options: i, activeOptionIndex: r };
2519
- }
2520
- let Ir = { 1(e) {
2521
- var n;
2522
- return (n = e.dataRef.current) != null && n.disabled || e.comboboxState === 1 ? e : { ...e, activeOptionIndex: null, comboboxState: 1, isTyping: !1, activationTrigger: 2, __demoMode: !1 };
2523
- }, 0(e) {
2524
- var n, t;
2525
- if ((n = e.dataRef.current) != null && n.disabled || e.comboboxState === 0) return e;
2526
- if ((t = e.dataRef.current) != null && t.value) {
2527
- let o = e.dataRef.current.calculateIndex(e.dataRef.current.value);
2528
- if (o !== -1) return { ...e, activeOptionIndex: o, comboboxState: 0, __demoMode: !1 };
2529
- }
2530
- return { ...e, comboboxState: 0, __demoMode: !1 };
2531
- }, 3(e, n) {
2532
- return e.isTyping === n.isTyping ? e : { ...e, isTyping: n.isTyping };
2533
- }, 2(e, n) {
2534
- var t, o, i, r, l;
2535
- if ((t = e.dataRef.current) != null && t.disabled || (o = e.dataRef.current) != null && o.optionsRef.current && !((i = e.dataRef.current) != null && i.optionsPropsRef.current.static) && e.comboboxState === 1) return e;
2536
- if (e.virtual) {
2537
- let { options: u, disabled: f } = e.virtual, g = n.focus === B.Specific ? n.idx : sn(n, { resolveItems: () => u, resolveActiveIndex: () => {
2538
- var m, p;
2539
- return (p = (m = e.activeOptionIndex) != null ? m : u.findIndex((h) => !f(h))) != null ? p : null;
2540
- }, resolveDisabled: f, resolveId() {
2541
- throw new Error("Function not implemented.");
2542
- } }), c = (r = n.trigger) != null ? r : 2;
2543
- return e.activeOptionIndex === g && e.activationTrigger === c ? e : { ...e, activeOptionIndex: g, activationTrigger: c, isTyping: !1, __demoMode: !1 };
2544
- }
2545
- let s = gt(e);
2546
- if (s.activeOptionIndex === null) {
2547
- let u = s.options.findIndex((f) => !f.dataRef.current.disabled);
2548
- u !== -1 && (s.activeOptionIndex = u);
2549
- }
2550
- let a = n.focus === B.Specific ? n.idx : sn(n, { resolveItems: () => s.options, resolveActiveIndex: () => s.activeOptionIndex, resolveId: (u) => u.id, resolveDisabled: (u) => u.dataRef.current.disabled }), d = (l = n.trigger) != null ? l : 2;
2551
- return e.activeOptionIndex === a && e.activationTrigger === d ? e : { ...e, ...s, isTyping: !1, activeOptionIndex: a, activationTrigger: d, __demoMode: !1 };
2552
- }, 4: (e, n) => {
2553
- var t, o, i;
2554
- if ((t = e.dataRef.current) != null && t.virtual) return { ...e, options: [...e.options, n.payload] };
2555
- let r = n.payload, l = gt(e, (a) => (a.push(r), a));
2556
- e.activeOptionIndex === null && (o = e.dataRef.current) != null && o.isSelected(n.payload.dataRef.current.value) && (l.activeOptionIndex = l.options.indexOf(r));
2557
- let s = { ...e, ...l, activationTrigger: 2 };
2558
- return (i = e.dataRef.current) != null && i.__demoMode && e.dataRef.current.value === void 0 && (s.activeOptionIndex = 0), s;
2559
- }, 5: (e, n) => {
2560
- var t;
2561
- if ((t = e.dataRef.current) != null && t.virtual) return { ...e, options: e.options.filter((i) => i.id !== n.id) };
2562
- let o = gt(e, (i) => {
2563
- let r = i.findIndex((l) => l.id === n.id);
2564
- return r !== -1 && i.splice(r, 1), i;
2565
- });
2566
- return { ...e, ...o, activationTrigger: 2 };
2567
- }, 6: (e, n) => e.activationTrigger === n.trigger ? e : { ...e, activationTrigger: n.trigger }, 7: (e, n) => {
2568
- var t, o;
2569
- if (e.virtual === null) return { ...e, virtual: { options: n.options, disabled: (t = n.disabled) != null ? t : () => !1 } };
2570
- if (e.virtual.options === n.options && e.virtual.disabled === n.disabled) return e;
2571
- let i = e.activeOptionIndex;
2572
- if (e.activeOptionIndex !== null) {
2573
- let r = n.options.indexOf(e.virtual.options[e.activeOptionIndex]);
2574
- r !== -1 ? i = r : i = null;
2575
- }
2576
- return { ...e, activeOptionIndex: i, virtual: { options: n.options, disabled: (o = n.disabled) != null ? o : () => !1 } };
2577
- } }, Pt = ve(null);
2578
- Pt.displayName = "ComboboxActionsContext";
2579
- function Je(e) {
2580
- let n = ce(Pt);
2581
- if (n === null) {
2582
- let t = new Error(`<${e} /> is missing a parent <Combobox /> component.`);
2583
- throw Error.captureStackTrace && Error.captureStackTrace(t, Je), t;
2584
- }
2585
- return n;
2586
- }
2587
- let Ln = ve(null);
2588
- function Mr(e) {
2589
- let n = Le("VirtualProvider"), { options: t } = n.virtual, [o, i] = K(() => {
2590
- let d = n.optionsRef.current;
2591
- if (!d) return [0, 0];
2592
- let u = window.getComputedStyle(d);
2593
- return [parseFloat(u.paddingBlockStart || u.paddingTop), parseFloat(u.paddingBlockEnd || u.paddingBottom)];
2594
- }, [n.optionsRef.current]), r = _o({ enabled: t.length !== 0, scrollPaddingStart: o, scrollPaddingEnd: i, count: t.length, estimateSize() {
2595
- return 40;
2596
- }, getScrollElement() {
2597
- var d;
2598
- return (d = n.optionsRef.current) != null ? d : null;
2599
- }, overscan: 12 }), [l, s] = ae(0);
2600
- U(() => {
2601
- s((d) => d + 1);
2602
- }, [t]);
2603
- let a = r.getVirtualItems();
2604
- return a.length === 0 ? null : j.createElement(Ln.Provider, { value: r }, j.createElement("div", { style: { position: "relative", width: "100%", height: `${r.getTotalSize()}px` }, ref: (d) => {
2605
- if (d) {
2606
- if (typeof process < "u" && process.env.JEST_WORKER_ID !== void 0 || n.activationTrigger === 0) return;
2607
- n.activeOptionIndex !== null && t.length > n.activeOptionIndex && r.scrollToIndex(n.activeOptionIndex);
2608
- }
2609
- } }, a.map((d) => {
2610
- var u;
2611
- return j.createElement(rt, { key: d.key }, j.cloneElement((u = e.children) == null ? void 0 : u.call(e, { ...e.slot, option: t[d.index] }), { key: `${l}-${d.key}`, "data-index": d.index, "aria-setsize": t.length, "aria-posinset": d.index + 1, style: { position: "absolute", top: 0, left: 0, transform: `translateY(${d.start}px)`, overflowAnchor: "none" } }));
2612
- })));
2613
- }
2614
- let Ue = ve(null);
2615
- Ue.displayName = "ComboboxDataContext";
2616
- function Le(e) {
2617
- let n = ce(Ue);
2618
- if (n === null) {
2619
- let t = new Error(`<${e} /> is missing a parent <Combobox /> component.`);
2620
- throw Error.captureStackTrace && Error.captureStackTrace(t, Le), t;
2621
- }
2622
- return n;
2623
- }
2624
- function _r(e, n) {
2625
- return Ie(n.type, Ir, e, n);
2626
- }
2627
- let Ar = rt;
2628
- function Pr(e, n) {
2629
- var t, o;
2630
- let i = Zn(), { value: r, defaultValue: l, onChange: s, form: a, name: d, by: u, disabled: f = i || !1, onClose: g, __demoMode: c = !1, multiple: m = !1, immediate: p = !1, virtual: h = null, nullable: v, ...w } = e, b = eo(l), [x = m ? [] : void 0, y] = to(r, s, b), [O, C] = ln(_r, { dataRef: Bn(), comboboxState: c ? 0 : 1, isTyping: !1, options: [], virtual: h ? { options: h.options, disabled: (t = h.disabled) != null ? t : () => !1 } : null, activeOptionIndex: null, activationTrigger: 2, __demoMode: c }), $ = Y(!1), N = Y({ static: !1, hold: !1 }), F = Y(null), D = Y(null), k = Y(null), I = Xn(u), S = _((A) => h ? u === null ? h.options.indexOf(A) : h.options.findIndex((H) => I(H, A)) : O.options.findIndex((H) => I(H.dataRef.current.value, A))), L = Ve((A) => Ie(R.mode, { 1: () => x.some((H) => I(H, A)), 0: () => I(x, A) }), [x]), V = _((A) => O.activeOptionIndex === S(A)), R = K(() => ({ ...O, immediate: p, optionsPropsRef: N, inputRef: F, buttonRef: D, optionsRef: k, value: x, defaultValue: b, disabled: f, mode: m ? 1 : 0, virtual: h ? O.virtual : null, get activeOptionIndex() {
2631
- if ($.current && O.activeOptionIndex === null && (h ? h.options.length > 0 : O.options.length > 0)) {
2632
- if (h) {
2633
- let H = h.options.findIndex((le) => {
2634
- var Xe, Dt;
2635
- return !((Dt = (Xe = h.disabled) == null ? void 0 : Xe.call(h, le)) != null && Dt);
2636
- });
2637
- if (H !== -1) return H;
2638
- }
2639
- let A = O.options.findIndex((H) => !H.dataRef.current.disabled);
2640
- if (A !== -1) return A;
2641
- }
2642
- return O.activeOptionIndex;
2643
- }, calculateIndex: S, compare: I, isSelected: L, isActive: V }), [x, b, f, m, c, O, h]);
2644
- U(() => {
2645
- var A;
2646
- h && C({ type: 7, options: h.options, disabled: (A = h.disabled) != null ? A : null });
2647
- }, [h, h == null ? void 0 : h.options, h == null ? void 0 : h.disabled]), U(() => {
2648
- O.dataRef.current = R;
2649
- }, [R]);
2650
- let z = R.comboboxState === 0;
2651
- ko(z, [R.buttonRef, R.inputRef, R.optionsRef], () => se.closeCombobox());
2652
- let M = K(() => {
2653
- var A, H, le;
2654
- return { open: R.comboboxState === 0, disabled: f, activeIndex: R.activeOptionIndex, activeOption: R.activeOptionIndex === null ? null : R.virtual ? R.virtual.options[(A = R.activeOptionIndex) != null ? A : 0] : (le = (H = R.options[R.activeOptionIndex]) == null ? void 0 : H.dataRef.current.value) != null ? le : null, value: x };
2655
- }, [R, f, x]), te = _(() => {
2656
- if (R.activeOptionIndex !== null) {
2657
- if (se.setIsTyping(!1), R.virtual) W(R.virtual.options[R.activeOptionIndex]);
2658
- else {
2659
- let { dataRef: A } = R.options[R.activeOptionIndex];
2660
- W(A.current.value);
2661
- }
2662
- se.goToOption(B.Specific, R.activeOptionIndex);
2663
- }
2664
- }), Te = _(() => {
2665
- C({ type: 0 }), $.current = !0;
2666
- }), T = _(() => {
2667
- C({ type: 1 }), $.current = !1, g == null || g();
2668
- }), J = _((A) => {
2669
- C({ type: 3, isTyping: A });
2670
- }), q = _((A, H, le) => ($.current = !1, A === B.Specific ? C({ type: 2, focus: B.Specific, idx: H, trigger: le }) : C({ type: 2, focus: A, trigger: le }))), ie = _((A, H) => (C({ type: 4, payload: { id: A, dataRef: H } }), () => {
2671
- R.isActive(H.current.value) && ($.current = !0), C({ type: 5, id: A });
2672
- })), W = _((A) => Ie(R.mode, { 0() {
2673
- return y == null ? void 0 : y(A);
2674
- }, 1() {
2675
- let H = R.value.slice(), le = H.findIndex((Xe) => I(Xe, A));
2676
- return le === -1 ? H.push(A) : H.splice(le, 1), y == null ? void 0 : y(H);
2677
- } })), ne = _((A) => {
2678
- C({ type: 6, trigger: A });
2679
- }), se = K(() => ({ onChange: W, registerOption: ie, goToOption: q, setIsTyping: J, closeCombobox: T, openCombobox: Te, setActivationTrigger: ne, selectActiveOption: te }), []), [kn, zn] = no(), Hn = n === null ? {} : { ref: n }, Vn = Ve(() => {
2680
- if (b !== void 0) return y == null ? void 0 : y(b);
2681
- }, [y, b]);
2682
- return j.createElement(zn, { value: kn, props: { htmlFor: (o = R.inputRef.current) == null ? void 0 : o.id }, slot: { open: R.comboboxState === 0, disabled: f } }, j.createElement(ir, null, j.createElement(Pt.Provider, { value: se }, j.createElement(Ue.Provider, { value: R }, j.createElement(fo, { value: Ie(R.comboboxState, { 0: et.Open, 1: et.Closed }) }, d != null && j.createElement(oo, { disabled: f, data: x != null ? { [d]: x } : {}, form: a, onReset: Vn }), xe({ ourProps: Hn, theirProps: w, slot: M, defaultTag: Ar, name: "Combobox" }))))));
2683
- }
2684
- let Dr = "input";
2685
- function $r(e, n) {
2686
- var t, o, i, r, l;
2687
- let s = Le("Combobox.Input"), a = Je("Combobox.Input"), d = Ye(), u = io(), { id: f = u || `headlessui-combobox-input-${d}`, onChange: g, displayValue: c, disabled: m = s.disabled || !1, autoFocus: p = !1, type: h = "text", ...v } = e, w = Ce(s.inputRef, n, tr()), b = st(s.inputRef), x = cn(), y = _(() => {
2688
- a.onChange(null), s.optionsRef.current && (s.optionsRef.current.scrollTop = 0), a.goToOption(B.Nothing);
2689
- }), O = K(() => {
2690
- var T;
2691
- return typeof c == "function" && s.value !== void 0 ? (T = c(s.value)) != null ? T : "" : typeof s.value == "string" ? s.value : "";
2692
- }, [s.value, c]);
2693
- jt(([T, J], [q, ie]) => {
2694
- if (s.isTyping) return;
2695
- let W = s.inputRef.current;
2696
- W && ((ie === 0 && J === 1 || T !== q) && (W.value = T), requestAnimationFrame(() => {
2697
- if (s.isTyping || !W || (b == null ? void 0 : b.activeElement) !== W) return;
2698
- let { selectionStart: ne, selectionEnd: se } = W;
2699
- Math.abs((se ?? 0) - (ne ?? 0)) === 0 && ne === 0 && W.setSelectionRange(W.value.length, W.value.length);
2700
- }));
2701
- }, [O, s.comboboxState, b, s.isTyping]), jt(([T], [J]) => {
2702
- if (T === 0 && J === 1) {
2703
- if (s.isTyping) return;
2704
- let q = s.inputRef.current;
2705
- if (!q) return;
2706
- let ie = q.value, { selectionStart: W, selectionEnd: ne, selectionDirection: se } = q;
2707
- q.value = "", q.value = ie, se !== null ? q.setSelectionRange(W, ne, se) : q.setSelectionRange(W, ne);
2708
- }
2709
- }, [s.comboboxState]);
2710
- let C = Y(!1), $ = _(() => {
2711
- C.current = !0;
2712
- }), N = _(() => {
2713
- x.nextFrame(() => {
2714
- C.current = !1;
2715
- });
2716
- }), F = _((T) => {
2717
- switch (a.setIsTyping(!0), T.key) {
2718
- case X.Enter:
2719
- if (s.comboboxState !== 0 || C.current) return;
2720
- if (T.preventDefault(), T.stopPropagation(), s.activeOptionIndex === null) {
2721
- a.closeCombobox();
2722
- return;
2723
- }
2724
- a.selectActiveOption(), s.mode === 0 && a.closeCombobox();
2725
- break;
2726
- case X.ArrowDown:
2727
- return T.preventDefault(), T.stopPropagation(), Ie(s.comboboxState, { 0: () => a.goToOption(B.Next), 1: () => a.openCombobox() });
2728
- case X.ArrowUp:
2729
- return T.preventDefault(), T.stopPropagation(), Ie(s.comboboxState, { 0: () => a.goToOption(B.Previous), 1: () => {
2730
- Ee(() => a.openCombobox()), s.value || a.goToOption(B.Last);
2731
- } });
2732
- case X.Home:
2733
- if (T.shiftKey) break;
2734
- return T.preventDefault(), T.stopPropagation(), a.goToOption(B.First);
2735
- case X.PageUp:
2736
- return T.preventDefault(), T.stopPropagation(), a.goToOption(B.First);
2737
- case X.End:
2738
- if (T.shiftKey) break;
2739
- return T.preventDefault(), T.stopPropagation(), a.goToOption(B.Last);
2740
- case X.PageDown:
2741
- return T.preventDefault(), T.stopPropagation(), a.goToOption(B.Last);
2742
- case X.Escape:
2743
- return s.comboboxState !== 0 ? void 0 : (T.preventDefault(), s.optionsRef.current && !s.optionsPropsRef.current.static && T.stopPropagation(), s.mode === 0 && s.value === null && y(), a.closeCombobox());
2744
- case X.Tab:
2745
- if (s.comboboxState !== 0) return;
2746
- s.mode === 0 && s.activationTrigger !== 1 && a.selectActiveOption(), a.closeCombobox();
2747
- break;
2748
- }
2749
- }), D = _((T) => {
2750
- g == null || g(T), s.mode === 0 && T.target.value === "" && y(), a.openCombobox();
2751
- }), k = _((T) => {
2752
- var J, q, ie;
2753
- let W = (J = T.relatedTarget) != null ? J : ye.find((ne) => ne !== T.currentTarget);
2754
- if (!((q = s.optionsRef.current) != null && q.contains(W)) && !((ie = s.buttonRef.current) != null && ie.contains(W)) && s.comboboxState === 0) return T.preventDefault(), s.mode === 0 && s.value === null && y(), a.closeCombobox();
2755
- }), I = _((T) => {
2756
- var J, q, ie;
2757
- let W = (J = T.relatedTarget) != null ? J : ye.find((ne) => ne !== T.currentTarget);
2758
- (q = s.buttonRef.current) != null && q.contains(W) || (ie = s.optionsRef.current) != null && ie.contains(W) || s.disabled || s.immediate && s.comboboxState !== 0 && x.microTask(() => {
2759
- Ee(() => a.openCombobox()), a.setActivationTrigger(1);
2760
- });
2761
- }), S = Ot(), L = ro(), { isFocused: V, focusProps: R } = un({ autoFocus: p }), { isHovered: z, hoverProps: M } = dn({ isDisabled: m }), te = K(() => ({ open: s.comboboxState === 0, disabled: m, hover: z, focus: V, autofocus: p }), [s, z, V, p, m]), Te = St({ ref: w, id: f, role: "combobox", type: h, "aria-controls": (t = s.optionsRef.current) == null ? void 0 : t.id, "aria-expanded": s.comboboxState === 0, "aria-activedescendant": s.activeOptionIndex === null ? void 0 : s.virtual ? (o = s.options.find((T) => !T.dataRef.current.disabled && s.compare(T.dataRef.current.value, s.virtual.options[s.activeOptionIndex]))) == null ? void 0 : o.id : (i = s.options[s.activeOptionIndex]) == null ? void 0 : i.id, "aria-labelledby": S, "aria-describedby": L, "aria-autocomplete": "list", defaultValue: (l = (r = e.defaultValue) != null ? r : s.defaultValue !== void 0 ? c == null ? void 0 : c(s.defaultValue) : null) != null ? l : s.defaultValue, disabled: m || void 0, autoFocus: p, onCompositionStart: $, onCompositionEnd: N, onKeyDown: F, onChange: D, onFocus: I, onBlur: k }, R, M);
2762
- return xe({ ourProps: Te, theirProps: v, slot: te, defaultTag: Dr, name: "Combobox.Input" });
2763
- }
2764
- let Lr = "button";
2765
- function Fr(e, n) {
2766
- var t;
2767
- let o = Le("Combobox.Button"), i = Je("Combobox.Button"), r = Ce(o.buttonRef, n), l = Ye(), { id: s = `headlessui-combobox-button-${l}`, disabled: a = o.disabled || !1, autoFocus: d = !1, ...u } = e, f = vn(o.inputRef), g = _((C) => {
2768
- switch (C.key) {
2769
- case X.Space:
2770
- case X.Enter:
2771
- C.preventDefault(), C.stopPropagation(), o.comboboxState === 1 && Ee(() => i.openCombobox()), f();
2772
- return;
2773
- case X.ArrowDown:
2774
- C.preventDefault(), C.stopPropagation(), o.comboboxState === 1 && (Ee(() => i.openCombobox()), o.value || i.goToOption(B.First)), f();
2775
- return;
2776
- case X.ArrowUp:
2777
- C.preventDefault(), C.stopPropagation(), o.comboboxState === 1 && (Ee(() => i.openCombobox()), o.value || i.goToOption(B.Last)), f();
2778
- return;
2779
- case X.Escape:
2780
- if (o.comboboxState !== 0) return;
2781
- C.preventDefault(), o.optionsRef.current && !o.optionsPropsRef.current.static && C.stopPropagation(), Ee(() => i.closeCombobox()), f();
2782
- return;
2783
- default:
2784
- return;
2785
- }
2786
- }), c = _((C) => {
2787
- C.preventDefault(), !go(C.currentTarget) && (C.button === At.Left && (o.comboboxState === 0 ? i.closeCombobox() : i.openCombobox()), f());
2788
- }), m = Ot([s]), { isFocusVisible: p, focusProps: h } = un({ autoFocus: d }), { isHovered: v, hoverProps: w } = dn({ isDisabled: a }), { pressed: b, pressProps: x } = Jn({ disabled: a }), y = K(() => ({ open: o.comboboxState === 0, active: b || o.comboboxState === 0, disabled: a, value: o.value, hover: v, focus: p }), [o, v, p, b, a]), O = St({ ref: r, id: s, type: uo(e, o.buttonRef), tabIndex: -1, "aria-haspopup": "listbox", "aria-controls": (t = o.optionsRef.current) == null ? void 0 : t.id, "aria-expanded": o.comboboxState === 0, "aria-labelledby": m, disabled: a || void 0, autoFocus: d, onMouseDown: c, onKeyDown: g }, h, w, x);
2789
- return xe({ ourProps: O, theirProps: u, slot: y, defaultTag: Lr, name: "Combobox.Button" });
2790
- }
2791
- let Nr = "div", kr = Nt.RenderStrategy | Nt.Static;
2792
- function zr(e, n) {
2793
- var t, o, i;
2794
- let r = Ye(), { id: l = `headlessui-combobox-options-${r}`, hold: s = !1, anchor: a, portal: d = !1, modal: u = !0, transition: f = !1, ...g } = e, c = Le("Combobox.Options"), m = Je("Combobox.Options"), p = er(a);
2795
- p && (d = !0);
2796
- let [h, v] = or(p), w = nr(), b = Ce(c.optionsRef, n, p ? h : null), x = st(c.optionsRef), y = po(), [O, C] = mo(f, c.optionsRef, y !== null ? (y & et.Open) === et.Open : c.comboboxState === 0);
2797
- Lo(O, c.inputRef, m.closeCombobox);
2798
- let $ = c.__demoMode ? !1 : u && c.comboboxState === 0;
2799
- Uo($, x);
2800
- let N = c.__demoMode ? !1 : u && c.comboboxState === 0;
2801
- $o(N, { allowed: _(() => [c.inputRef.current, c.buttonRef.current, c.optionsRef.current]) }), U(() => {
2802
- var M;
2803
- c.optionsPropsRef.current.static = (M = e.static) != null ? M : !1;
2804
- }, [c.optionsPropsRef, e.static]), U(() => {
2805
- c.optionsPropsRef.current.hold = s;
2806
- }, [c.optionsPropsRef, s]), qo(c.comboboxState === 0, { container: c.optionsRef.current, accept(M) {
2807
- return M.getAttribute("role") === "option" ? NodeFilter.FILTER_REJECT : M.hasAttribute("role") ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT;
2808
- }, walk(M) {
2809
- M.setAttribute("role", "none");
2810
- } });
2811
- let F = Ot([(t = c.buttonRef.current) == null ? void 0 : t.id]), D = K(() => ({ open: c.comboboxState === 0, option: void 0 }), [c.comboboxState]), k = _(() => {
2812
- m.setActivationTrigger(0);
2813
- }), I = _((M) => {
2814
- M.preventDefault(), m.setActivationTrigger(0);
2815
- }), S = St(p ? w() : {}, { "aria-labelledby": F, role: "listbox", "aria-multiselectable": c.mode === 1 ? !0 : void 0, id: l, ref: b, style: { ...g.style, ...v, "--input-width": zt(c.inputRef, !0).width, "--button-width": zt(c.buttonRef, !0).width }, onWheel: c.activationTrigger === 0 ? void 0 : k, onMouseDown: I, ...ho(C) }), L = O && c.comboboxState === 1, V = wt(L, (o = c.virtual) == null ? void 0 : o.options), R = wt(L, c.value), z = _((M) => c.compare(R, M));
2816
- if (c.virtual) {
2817
- if (V === void 0) throw new Error("Missing `options` in virtual mode");
2818
- Object.assign(g, { children: j.createElement(Ue.Provider, { value: V !== c.virtual.options ? { ...c, virtual: { ...c.virtual, options: V } } : c }, j.createElement(Mr, { slot: D }, g.children)) });
2819
- }
2820
- return j.createElement(Rr, { enabled: d ? e.static || O : !1 }, j.createElement(Ue.Provider, { value: c.mode === 1 ? c : { ...c, isSelected: z } }, xe({ ourProps: S, theirProps: { ...g, children: j.createElement(lr, { freeze: L }, typeof g.children == "function" ? (i = g.children) == null ? void 0 : i.call(g, D) : g.children) }, slot: D, defaultTag: Nr, features: kr, visible: O, name: "Combobox.Options" })));
2821
- }
2822
- let Hr = "div";
2823
- function Vr(e, n) {
2824
- var t, o, i, r;
2825
- let l = Le("Combobox.Option"), s = Je("Combobox.Option"), a = Ye(), { id: d = `headlessui-combobox-option-${a}`, value: u, disabled: f = (i = (o = (t = l.virtual) == null ? void 0 : t.disabled) == null ? void 0 : o.call(t, u)) != null ? i : !1, order: g = null, ...c } = e, m = vn(l.inputRef), p = l.virtual ? l.activeOptionIndex === l.calculateIndex(u) : l.activeOptionIndex === null ? !1 : ((r = l.options[l.activeOptionIndex]) == null ? void 0 : r.id) === d, h = l.isSelected(u), v = Y(null), w = Pe({ disabled: f, value: u, domRef: v, order: g }), b = ce(Ln), x = Ce(n, v, b ? b.measureElement : null), y = _(() => {
2826
- s.setIsTyping(!1), s.onChange(u);
2827
- });
2828
- U(() => s.registerOption(d, w), [w, d]);
2829
- let O = Y(!(l.virtual || l.__demoMode));
2830
- U(() => {
2831
- if (!l.virtual && !l.__demoMode) return _e().requestAnimationFrame(() => {
2832
- O.current = !0;
2833
- });
2834
- }, [l.virtual, l.__demoMode]), U(() => {
2835
- if (O.current && l.comboboxState === 0 && p && l.activationTrigger !== 0) return _e().requestAnimationFrame(() => {
2836
- var S, L;
2837
- (L = (S = v.current) == null ? void 0 : S.scrollIntoView) == null || L.call(S, { block: "nearest" });
2838
- });
2839
- }, [v, p, l.comboboxState, l.activationTrigger, l.activeOptionIndex]);
2840
- let C = _((S) => {
2841
- S.preventDefault(), S.button === At.Left && (f || (y(), gn() || requestAnimationFrame(() => m()), l.mode === 0 && s.closeCombobox()));
2842
- }), $ = _(() => {
2843
- if (f) return s.goToOption(B.Nothing);
2844
- let S = l.calculateIndex(u);
2845
- s.goToOption(B.Specific, S);
2846
- }), N = Yo(), F = _((S) => N.update(S)), D = _((S) => {
2847
- if (!N.wasMoved(S) || f || p) return;
2848
- let L = l.calculateIndex(u);
2849
- s.goToOption(B.Specific, L, 0);
2850
- }), k = _((S) => {
2851
- N.wasMoved(S) && (f || p && (l.optionsPropsRef.current.hold || s.goToOption(B.Nothing)));
2852
- }), I = K(() => ({ active: p, focus: p, selected: h, disabled: f }), [p, h, f]);
2853
- return xe({ ourProps: { id: d, ref: x, role: "option", tabIndex: f === !0 ? void 0 : -1, "aria-disabled": f === !0 ? !0 : void 0, "aria-selected": h, disabled: void 0, onMouseDown: C, onFocus: $, onPointerEnter: F, onMouseEnter: F, onPointerMove: D, onMouseMove: D, onPointerLeave: k, onMouseLeave: k }, theirProps: c, slot: I, defaultTag: Hr, name: "Combobox.Option" });
2854
- }
2855
- let Wr = be(Pr), yt = be(Fr), Et = be($r), Br = Qn, Fn = be(zr), Nn = be(Vr), jr = Object.assign(Wr, { Input: Et, Button: yt, Label: Br, Options: Fn, Option: Nn });
2856
- const Ur = "_disabled_7p4d9_5", Yr = "_container_7p4d9_9", qr = "_full_7p4d9_22", Kr = "_button_7p4d9_34", Gr = "_options_7p4d9_48", Jr = "_top_7p4d9_59", Xr = "_bottom_7p4d9_64", Qr = "_m_7p4d9_91", Zr = "_l_7p4d9_105", es = "_option_7p4d9_48", ts = "_clear_7p4d9_154", P = {
2857
- "select-search": "_select-search_7p4d9_2",
2858
- disabled: Ur,
2859
- container: Yr,
2860
- "container-open": "_container-open_7p4d9_18",
2861
- full: qr,
2862
- "selected-icon": "_selected-icon_7p4d9_26",
2863
- "selector-icon-open": "_selector-icon-open_7p4d9_30",
2864
- button: Kr,
2865
- "selector-icon": "_selector-icon_7p4d9_30",
2866
- options: Gr,
2867
- top: Jr,
2868
- bottom: Xr,
2869
- "no-options": "_no-options_7p4d9_85",
2870
- m: Qr,
2871
- l: Zr,
2872
- "custom-input-class": "_custom-input-class_7p4d9_119",
2873
- option: es,
2874
- "option-active": "_option-active_7p4d9_135",
2875
- "option-inner": "_option-inner_7p4d9_138",
2876
- "right-slot": "_right-slot_7p4d9_145",
2877
- "required-mark": "_required-mark_7p4d9_149",
2878
- clear: ts
2879
- }, ws = jn(
2880
- (e, n) => {
2881
- const {
2882
- placeholder: t,
2883
- size: o = we.L,
2884
- value: i,
2885
- onChange: r,
2886
- full: l,
2887
- showArrow: s = !0,
2888
- items: a = [],
2889
- classNameOption: d,
2890
- displayValue: u = "name",
2891
- filterOnSearch: f = !0,
2892
- onSearch: g,
2893
- variant: c = Yn.DefaultGray,
2894
- menuPlacement: m = "bottom",
2895
- disabled: p = !1,
2896
- searchProps: h,
2897
- withClearButton: v = !1,
2898
- disableInput: w = !1
2899
- } = e, b = String((i == null ? void 0 : i[u]) || ""), [x, y] = ae(b), [O, C] = ae(i), $ = (I) => {
2900
- switch (I) {
2901
- case we.M:
2902
- return ut.M;
2903
- case we.L:
2904
- return ut.L;
2905
- default:
2906
- return ut.M;
2907
- }
2908
- }, N = K(() => !f || i && (i.id || i.name) ? a : x.trim().toLowerCase() ? a.filter(
2909
- (I) => I.name.toLowerCase().includes(x.toLowerCase())
2910
- ) : a, [x, a, i, f]), F = (I) => {
2911
- I ? (y(I.name), C(I), r == null || r(I)) : (y(""), C(null), r == null || r({ id: "", name: "" }));
2912
- }, D = Ve(
2913
- (I) => {
2914
- if (w) return;
2915
- const S = I.target.value;
2916
- y(S), g == null || g(S), !S && i && (r == null || r({ id: "", name: "" }));
39
+ placeholder: g,
40
+ size: s = v.L,
41
+ value: r,
42
+ onChange: o,
43
+ full: E,
44
+ showArrow: F = !0,
45
+ items: d = [],
46
+ classNameOption: G,
47
+ displayValue: P = "name",
48
+ filterOnSearch: w = !0,
49
+ onSearch: m,
50
+ variant: C = J.DefaultGray,
51
+ menuPlacement: h = "bottom",
52
+ disabled: l = !1,
53
+ searchProps: I,
54
+ withClearButton: f = !1,
55
+ disableInput: c = !1
56
+ } = O, k = String((r == null ? void 0 : r[P]) || ""), [p, _] = z(k), [b, N] = z(r), S = K(() => !w || r && (r.id || r.name) ? d : p.trim().toLowerCase() ? d.filter(
57
+ (a) => a.name.toLowerCase().includes(p.toLowerCase())
58
+ ) : d, [p, d, r, w]), T = (a) => {
59
+ a ? (_(a.name), N(a), o == null || o(a)) : (_(""), N(null), o == null || o({ id: "", name: "" }));
60
+ }, x = U(
61
+ (a) => {
62
+ if (c) return;
63
+ const t = a.target.value;
64
+ _(t), m == null || m(t), !t && r && (o == null || o({ id: "", name: "" }));
2917
65
  },
2918
- [w, r, g, i]
2919
- ), k = () => {
2920
- y(""), C(null), r == null || r({ id: "", name: "" });
66
+ [c, o, m, r]
67
+ ), V = () => {
68
+ _(""), N(null), o == null || o({ id: "", name: "" });
2921
69
  };
2922
- return oe(() => {
2923
- y(b);
2924
- }, [b]), /* @__PURE__ */ Q(
2925
- jr,
70
+ return W(() => {
71
+ _(k);
72
+ }, [k]), /* @__PURE__ */ n(
73
+ Q,
2926
74
  {
2927
75
  as: "div",
2928
- value: O,
2929
- className: fe(P["select-search"], {
2930
- [P.full]: l,
2931
- [P.disabled]: p
76
+ value: b,
77
+ className: i(e["select-search"], {
78
+ [e.full]: E,
79
+ [e.disabled]: l
2932
80
  }),
2933
- onChange: F,
2934
- ref: n,
2935
- disabled: p,
2936
- virtual: { options: N },
2937
- children: ({ open: I }) => /* @__PURE__ */ Fe($t, { children: [
2938
- /* @__PURE__ */ Fe(
81
+ onChange: T,
82
+ ref: L,
83
+ disabled: l,
84
+ virtual: { options: S },
85
+ children: ({ open: a }) => /* @__PURE__ */ u(y, { children: [
86
+ /* @__PURE__ */ u(
2939
87
  "div",
2940
88
  {
2941
- className: fe(P.container, P[o], {
2942
- [P["container-open"]]: I
89
+ className: i(e.container, e[s], {
90
+ [e["container-open"]]: a
2943
91
  }),
2944
92
  children: [
2945
- w && /* @__PURE__ */ Fe("div", { style: { position: "relative", width: "100%" }, children: [
2946
- /* @__PURE__ */ Q(yt, { disabled: p, style: { width: "100%" }, children: /* @__PURE__ */ Q(
2947
- Et,
93
+ c && /* @__PURE__ */ u("div", { style: { position: "relative", width: "100%" }, children: [
94
+ /* @__PURE__ */ n(B, { disabled: l, style: { width: "100%" }, children: /* @__PURE__ */ n(
95
+ M,
2948
96
  {
2949
- as: Ft,
2950
- label: t,
2951
- size: $(o),
2952
- className: P["custom-input-class"],
2953
- onChange: D,
2954
- value: x,
2955
- disabled: p,
2956
- variant: c,
2957
- rightSlotClassName: P["right-slot"],
2958
- requiredMarkClassName: P["required-mark"],
97
+ as: A,
98
+ label: g,
99
+ size: D(s),
100
+ className: i(e["select-input"], {
101
+ [e["select-input-disabled"]]: c && f
102
+ }),
103
+ onChange: x,
104
+ value: p,
105
+ disabled: l,
106
+ variant: C,
107
+ rightSlotClassName: e["right-slot"],
108
+ requiredMarkClassName: e["required-mark"],
2959
109
  "data-testid": "select-search-input",
2960
- onFocus: (S) => {
2961
- w && S.target.blur();
110
+ onFocus: (t) => {
111
+ c && t.target.blur();
2962
112
  },
2963
113
  rightAddon: {
2964
114
  addonType: "icon",
2965
- addonContent: I ? o === we.M ? "DropdownArrowUp16px" : "DropdownArrowUp24px" : o === we.M ? "DropdownArrowBottom16px" : "DropdownArrowDown24px"
115
+ addonContent: R(a, s)
2966
116
  },
2967
- ...h
117
+ ...I
2968
118
  }
2969
119
  ) }),
2970
- v && x && /* @__PURE__ */ Q(
2971
- Un,
120
+ f && p && /* @__PURE__ */ n(
121
+ $,
2972
122
  {
2973
123
  tabIndex: -1,
2974
- className: P.clear,
124
+ className: i(e.clear, {
125
+ [e.disabled]: l
126
+ }),
127
+ iconButtonClassName: e["icon-button"],
2975
128
  isIconButton: !0,
2976
129
  iconName: "Close16px",
2977
130
  size: "m-s",
2978
131
  clear: !0,
2979
- disabled: p,
132
+ disabled: l,
2980
133
  variant: "secondary-gray",
2981
- onClick: (S) => {
2982
- S.stopPropagation(), k();
134
+ onClick: (t) => {
135
+ t.stopPropagation(), V();
2983
136
  },
2984
137
  "data-testid": "clear-button"
2985
138
  }
2986
139
  )
2987
140
  ] }),
2988
- !w && /* @__PURE__ */ Q(
2989
- Et,
141
+ !c && /* @__PURE__ */ n(
142
+ M,
2990
143
  {
2991
- as: Ft,
2992
- label: t,
2993
- size: $(o),
2994
- className: P["custom-input-class"],
2995
- onChange: D,
2996
- value: x,
2997
- disabled: p,
2998
- variant: c,
2999
- withClearButton: v,
3000
- rightSlotClassName: P["right-slot"],
3001
- requiredMarkClassName: P["required-mark"],
144
+ as: A,
145
+ label: g,
146
+ size: D(s),
147
+ className: e["select-input"],
148
+ onChange: x,
149
+ value: p,
150
+ disabled: l,
151
+ variant: C,
152
+ withClearButton: f,
153
+ rightSlotClassName: e["right-slot"],
154
+ requiredMarkClassName: e["required-mark"],
3002
155
  "data-testid": "select-search-input",
3003
156
  rightAddon: {
3004
157
  addonType: "react-node",
3005
- addonContent: s && /* @__PURE__ */ Q(
3006
- yt,
158
+ addonContent: F && /* @__PURE__ */ n(
159
+ B,
3007
160
  {
3008
- className: fe(P.button, {
3009
- [P.disabled]: p
161
+ className: i(e.button, {
162
+ [e.disabled]: l
3010
163
  }),
3011
- disabled: p,
3012
- children: /* @__PURE__ */ Q(
3013
- Lt,
164
+ disabled: l,
165
+ children: /* @__PURE__ */ n(
166
+ q,
3014
167
  {
3015
- iconName: o == we.M ? "DropdownArrowBottom16px" : "DropdownArrowDown24px",
3016
- className: fe(P["selector-icon"], {
3017
- [P["selector-icon-open"]]: I
168
+ iconName: s == v.M ? "DropdownArrowBottom16px" : "DropdownArrowDown24px",
169
+ className: i(e["selector-icon"], {
170
+ [e["selector-icon-open"]]: a
3018
171
  })
3019
172
  }
3020
173
  )
3021
174
  }
3022
175
  )
3023
176
  },
3024
- onFocus: (S) => {
3025
- w && S.target.blur();
177
+ onFocus: (t) => {
178
+ c && t.target.blur();
3026
179
  },
3027
- ...h
180
+ ...I
3028
181
  }
3029
182
  )
3030
183
  ]
3031
184
  }
3032
185
  ),
3033
- I && /* @__PURE__ */ Q($t, { children: a.length ? N.length ? /* @__PURE__ */ Q(
3034
- Fn,
186
+ a && /* @__PURE__ */ n(y, { children: d.length ? S.length ? /* @__PURE__ */ n(
187
+ X,
3035
188
  {
3036
189
  "data-testid": "select-search-options",
3037
- className: fe(
3038
- P.options,
3039
- P[o],
3040
- P[m]
190
+ className: i(
191
+ e.options,
192
+ e[s],
193
+ e[h]
3041
194
  ),
3042
- children: ({ option: S }) => /* @__PURE__ */ Fe(
3043
- Nn,
195
+ children: ({ option: t }) => /* @__PURE__ */ u(
196
+ Y,
3044
197
  {
3045
- value: S,
3046
- className: ({ focus: L }) => fe(
3047
- P.option,
3048
- d,
3049
- o && P[o],
198
+ value: t,
199
+ className: ({ focus: j }) => i(
200
+ e.option,
201
+ G,
202
+ s && e[s],
3050
203
  {
3051
- [P["option-active"]]: L
204
+ [e["option-active"]]: j
3052
205
  }
3053
206
  ),
3054
- "data-testid": `select-search-option-${S.id}`,
207
+ "data-testid": `select-search-option-${t.id}`,
3055
208
  children: [
3056
- /* @__PURE__ */ Fe("div", { className: P["option-inner"], children: [
3057
- S.name,
3058
- S.bottom && /* @__PURE__ */ Q("div", { children: S.bottom })
209
+ /* @__PURE__ */ u("div", { className: e["option-inner"], children: [
210
+ t.name,
211
+ t.bottom && /* @__PURE__ */ n("div", { children: t.bottom })
3059
212
  ] }),
3060
- O && O.id === S.id && /* @__PURE__ */ Q(
3061
- Lt,
213
+ b && b.id === t.id && /* @__PURE__ */ n(
214
+ q,
3062
215
  {
3063
- iconName: o === we.M ? "Done16px" : "Done24px",
3064
- className: P["selected-icon"]
216
+ iconName: s === v.M ? "Done16px" : "Done24px",
217
+ className: e["selected-icon"]
3065
218
  }
3066
219
  )
3067
220
  ]
3068
221
  },
3069
- S.id
222
+ t.id
3070
223
  )
3071
224
  }
3072
- ) : /* @__PURE__ */ Q(
225
+ ) : /* @__PURE__ */ n(
3073
226
  "div",
3074
227
  {
3075
- className: fe(
3076
- P.options,
3077
- P[o],
3078
- P["no-options"]
228
+ className: i(
229
+ e.options,
230
+ e[s],
231
+ e["no-options"],
232
+ e[h]
3079
233
  ),
3080
234
  children: "Ничего не найдено"
3081
235
  }
3082
- ) : /* @__PURE__ */ Q(
236
+ ) : /* @__PURE__ */ n(
3083
237
  "div",
3084
238
  {
3085
- className: fe(
3086
- P.options,
3087
- P[o],
3088
- P["no-options"]
239
+ className: i(
240
+ e.options,
241
+ e[s],
242
+ e["no-options"],
243
+ e[h]
3089
244
  ),
3090
245
  children: "Нет данных"
3091
246
  }
@@ -3096,5 +251,5 @@ const Ur = "_disabled_7p4d9_5", Yr = "_container_7p4d9_9", qr = "_full_7p4d9_22"
3096
251
  }
3097
252
  );
3098
253
  export {
3099
- ws as SelectSearch
254
+ ve as SelectSearch
3100
255
  };