@altinn/altinn-components 0.56.20 → 0.56.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/dist/assets/AccountSelector.css +1 -1
  2. package/dist/assets/AccountSelectorButton.css +1 -0
  3. package/dist/assets/DatepickerFilter.css +1 -1
  4. package/dist/assets/Dropdown.css +1 -1
  5. package/dist/assets/GlobalHeader.css +1 -1
  6. package/dist/assets/GlobalMenuButton2.css +1 -1
  7. package/dist/assets/HeaderLogo2.css +1 -1
  8. package/dist/assets/LayoutGrid.css +1 -1
  9. package/dist/assets/ModalBase.css +1 -1
  10. package/dist/assets/ModalFooter.css +1 -0
  11. package/dist/assets/SettingsSection.css +1 -1
  12. package/dist/components/Account/AccountMenu.js +20 -20
  13. package/dist/components/Bookmarks/BookmarkSettingsList.js +41 -11
  14. package/dist/components/Dropdown/Dropdown.js +10 -10
  15. package/dist/components/DsComponents/index.js +20 -21
  16. package/dist/components/GlobalHeader/AccountSelector.js +64 -124
  17. package/dist/components/GlobalHeader/AccountSelectorButton.js +127 -0
  18. package/dist/components/GlobalHeader/DigdirLogomark.js +23 -109
  19. package/dist/components/GlobalHeader/GlobalHeader.js +84 -117
  20. package/dist/components/GlobalHeader/GlobalMenuButton.js +64 -0
  21. package/dist/components/GlobalHeader/HeaderLogo.js +20 -13
  22. package/dist/components/GlobalHeader/index.js +2 -2
  23. package/dist/components/GlobalMenu/GlobalMenu.js +11 -10
  24. package/dist/components/GlobalMenu/index.js +2 -4
  25. package/dist/components/Layout/Layout.js +30 -30
  26. package/dist/components/Layout/LayoutGrid.js +3 -3
  27. package/dist/components/Modal/ModalBase.js +35 -33
  28. package/dist/components/Modal/ModalFooter.js +7 -10
  29. package/dist/components/Modal/index.js +8 -6
  30. package/dist/components/Settings/SettingsItem.js +53 -35
  31. package/dist/components/Settings/SettingsItemBase.js +19 -20
  32. package/dist/components/Settings/SettingsSection.js +10 -10
  33. package/dist/components/index.js +89 -88
  34. package/dist/functions/index.js +6 -4
  35. package/dist/functions/orgno/index.js +4 -0
  36. package/dist/functions/orgno/orgno.js +4 -0
  37. package/dist/hooks/useAccountSelector.js +77 -75
  38. package/dist/index.js +88 -85
  39. package/dist/textfield-CNXt-27J.js +3403 -0
  40. package/dist/types/lib/components/Bookmarks/BookmarkSettingsItem.d.ts +2 -0
  41. package/dist/types/lib/components/Bookmarks/BookmarkSettingsList.d.ts +7 -1
  42. package/dist/types/lib/components/Bookmarks/BookmarkSettingsList.stories.d.ts +4 -1
  43. package/dist/types/lib/components/Dropdown/Dropdown.d.ts +1 -1
  44. package/dist/types/lib/components/{Account/AccountMenuButton.d.ts → GlobalHeader/AccountSelectorButton.d.ts} +2 -2
  45. package/dist/types/lib/components/{Account/AccountMenuButton.stories.d.ts → GlobalHeader/AccountSelectorButton.stories.d.ts} +1 -1
  46. package/dist/types/lib/components/GlobalHeader/DigdirLogomark.d.ts +1 -2
  47. package/dist/types/lib/components/GlobalHeader/GlobalHeader.d.ts +1 -3
  48. package/dist/types/lib/components/GlobalHeader/GlobalHeader.stories.d.ts +1 -1
  49. package/dist/types/lib/components/{GlobalMenu → GlobalHeader}/GlobalMenuButton.d.ts +2 -2
  50. package/dist/types/lib/components/{GlobalMenu → GlobalHeader}/GlobalMenuButton.stories.d.ts +1 -1
  51. package/dist/types/lib/components/GlobalHeader/index.d.ts +1 -1
  52. package/dist/types/lib/components/GlobalMenu/index.d.ts +0 -1
  53. package/dist/types/lib/components/Modal/ModalBase.d.ts +2 -1
  54. package/dist/types/lib/components/Modal/ModalFooter.d.ts +3 -3
  55. package/dist/types/lib/components/Modal/index.d.ts +1 -0
  56. package/dist/types/lib/components/Settings/SettingsModal.stories.d.ts +2 -1
  57. package/dist/types/lib/functions/index.d.ts +1 -0
  58. package/dist/types/lib/functions/orgno/index.d.ts +1 -0
  59. package/dist/types/lib/functions/orgno/orgno.d.ts +1 -0
  60. package/package.json +1 -1
  61. package/dist/assets/AccountMenuButton.css +0 -1
  62. package/dist/assets/GlobalHeaderBase.css +0 -1
  63. package/dist/assets/HeaderGroup2.css +0 -1
  64. package/dist/assets/globalSearch.css +0 -1
  65. package/dist/components/Account/AccountMenuButton.js +0 -134
  66. package/dist/components/GlobalHeader/GlobalHeaderBase.js +0 -24
  67. package/dist/components/GlobalHeader/GlobalSearch.js +0 -62
  68. package/dist/components/GlobalHeader/GlobalSearchButton.js +0 -54
  69. package/dist/components/GlobalHeader/HeaderGroup.js +0 -8
  70. package/dist/components/GlobalMenu/GlobalMenuButton.js +0 -83
  71. package/dist/globalSearch.module-DziLSGZg.js +0 -9
  72. package/dist/index--jNxJmA8.js +0 -2000
  73. package/dist/textfield-Drdr9bio.js +0 -1439
  74. package/dist/types/lib/components/GlobalHeader/GlobalHeaderBase.d.ts +0 -9
  75. package/dist/types/lib/components/GlobalHeader/GlobalSearch.d.ts +0 -4
  76. package/dist/types/lib/components/GlobalHeader/GlobalSearchButton.d.ts +0 -6
  77. package/dist/types/lib/components/GlobalHeader/HeaderGroup.d.ts +0 -6
@@ -0,0 +1,3403 @@
1
+ "use client";
2
+ import * as p from "react";
3
+ import Ot, { forwardRef as V, useState as Ce, useRef as ge, useEffect as de, createContext as Pe, useContext as oe, useMemo as Le, useLayoutEffect as zn, useReducer as _r, useId as ze, isValidElement as Vn, memo as Lr, useCallback as zr, Children as dn, version as Vr } from "react";
4
+ import { jsx as y, jsxs as le, Fragment as Ht } from "react/jsx-runtime";
5
+ import { c as X } from "./lite-1fxw3LjI.js";
6
+ import { S as se, a as Br } from "./index-D7FJjvrv.js";
7
+ import * as Bn from "react-dom";
8
+ import { flushSync as $n } from "react-dom";
9
+ import { S as $r, B as Ge, u as Kr } from "./button-BB5sYVKY.js";
10
+ import { V as Ut, u as Xt, F as Vt, a as jr, b as Wr, c as fn } from "./index-z82sbSVU.js";
11
+ import { P as Bt } from "./paragraph-BRiIBpbY.js";
12
+ import { I as vt } from "./input-wBv_FkEV.js";
13
+ import { S as qr } from "./XMark-tKk6aExO.js";
14
+ import { S as Hr, a as Ur } from "./ChevronUp-_BBfEirx.js";
15
+ import { L as Ne } from "./label-xTmTyPhk.js";
16
+ import { u as Xr } from "./useId-BVFxCjkq.js";
17
+ import { S as Gr } from "./Checkmark-Byz_C9x4.js";
18
+ import { f as Kn, b as Yr, o as jn, c as Wn, g as Tt, a as qn, s as Zr } from "./floating-ui.dom-bEgaHJCq.js";
19
+ import { u as Ve } from "./use-merge-refs-Cj4kTYVj.js";
20
+ import { T as Jr } from "./textarea-BBstVlPT.js";
21
+ var Qr = function(e, n) {
22
+ var t = {};
23
+ for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && n.indexOf(r) < 0 && (t[r] = e[r]);
24
+ if (e != null && typeof Object.getOwnPropertySymbols == "function")
25
+ for (var o = 0, r = Object.getOwnPropertySymbols(e); o < r.length; o++)
26
+ n.indexOf(r[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[o]) && (t[r[o]] = e[r[o]]);
27
+ return t;
28
+ };
29
+ const eo = V((e, n) => {
30
+ var { title: t, titleId: r } = e, o = Qr(e, ["title", "titleId"]);
31
+ let s = Xr();
32
+ return s = t ? r || "title-" + s : void 0, Ot.createElement(
33
+ "svg",
34
+ Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", fill: "none", viewBox: "0 0 24 24", focusable: !1, role: "img", ref: n, "aria-labelledby": s }, o),
35
+ t ? Ot.createElement("title", { id: s }, t) : null,
36
+ Ot.createElement("path", { fill: "currentColor", fillRule: "evenodd", d: "M12 2.25A4.75 4.75 0 0 0 7.25 7v2.25H7A1.75 1.75 0 0 0 5.25 11v9c0 .414.336.75.75.75h12a.75.75 0 0 0 .75-.75v-9A1.75 1.75 0 0 0 17 9.25h-.25V7A4.75 4.75 0 0 0 12 2.25m3.25 7V7a3.25 3.25 0 0 0-6.5 0v2.25zM12 13a1.5 1.5 0 0 0-.75 2.8V17a.75.75 0 0 0 1.5 0v-1.2A1.5 1.5 0 0 0 12 13", clipRule: "evenodd" })
37
+ );
38
+ }), We = (e, n) => {
39
+ const t = {}, r = {};
40
+ let o = 0;
41
+ const s = e.length;
42
+ for (; o < s; )
43
+ r[e[o]] = 1, o += 1;
44
+ for (const i in n)
45
+ Object.hasOwn(r, i) || (t[i] = n[i]);
46
+ return t;
47
+ }, Hn = Pe({
48
+ elements: { current: /* @__PURE__ */ new Map() },
49
+ getOrderedItems: () => [],
50
+ setFocusableValue: () => {
51
+ },
52
+ onShiftTab: () => {
53
+ },
54
+ focusableValue: null,
55
+ orientation: "horizontal"
56
+ }), to = V(({ activeValue: e, asChild: n, orientation: t = "horizontal", onBlur: r, onFocus: o, ...s }, i) => {
57
+ const a = n ? se : "div", l = e ?? null, [c, f] = Ce(l), [d, h] = Ce(!1), u = ge(/* @__PURE__ */ new Map()), m = ge(null), g = Ve([i, m]), E = () => {
58
+ if (!m.current)
59
+ return [];
60
+ const x = Array.from(m.current.querySelectorAll("[data-roving-tabindex-item]"));
61
+ return Array.from(u.current).sort((v, b) => x.indexOf(v[1]) - x.indexOf(b[1])).map(([v, b]) => ({ value: v, element: b }));
62
+ };
63
+ return de(() => {
64
+ f(l);
65
+ }, [l]), y(Hn.Provider, { value: {
66
+ elements: u,
67
+ getOrderedItems: E,
68
+ focusableValue: c,
69
+ setFocusableValue: f,
70
+ onShiftTab: () => {
71
+ h(!0);
72
+ },
73
+ orientation: t
74
+ }, children: y(a, { ...s, tabIndex: d ? -1 : 0, onBlur: (x) => {
75
+ r?.(x), h(!1), f(e ?? null);
76
+ }, onFocus: (x) => {
77
+ if (o?.(x), x.target !== x.currentTarget)
78
+ return;
79
+ const v = E();
80
+ v.length !== 0 && (c != null ? u.current.get(c)?.focus() : e != null ? u.current.get(e)?.focus() : v.at(0)?.element.focus());
81
+ }, ref: g }) });
82
+ }), no = (e) => {
83
+ const { elements: n, getOrderedItems: t, setFocusableValue: r, focusableValue: o, onShiftTab: s, orientation: i } = oe(Hn);
84
+ return {
85
+ getOrderedItems: t,
86
+ isFocusable: o === e,
87
+ orientation: i,
88
+ getRovingProps: (a) => ({
89
+ ...a,
90
+ ref: (l) => {
91
+ l ? n.current.set(e, l) : n.current.delete(e);
92
+ },
93
+ onKeyDown: (l) => {
94
+ if (a?.onKeyDown?.(l), l.shiftKey && l.key === "Tab") {
95
+ s();
96
+ return;
97
+ }
98
+ },
99
+ onFocus: (l) => {
100
+ a?.onFocus?.(l), r(e);
101
+ },
102
+ "data-roving-tabindex-item": !0,
103
+ tabIndex: o === e ? 0 : -1
104
+ })
105
+ };
106
+ };
107
+ function kt(e, n) {
108
+ const t = e.findIndex((r) => r.value === n);
109
+ return e.at(t === e.length - 1 ? 0 : t + 1);
110
+ }
111
+ function Mt(e, n) {
112
+ const t = e.findIndex((r) => r.value === n);
113
+ return e.at(t === 0 ? -1 : t - 1);
114
+ }
115
+ const ro = V(({ value: e, asChild: n, ...t }, r) => {
116
+ const o = n ? se : "div", s = e ?? (typeof t.children == "string" ? t.children : ""), { getOrderedItems: i, getRovingProps: a, orientation: l } = no(s), c = a({
117
+ onKeyDown: (d) => {
118
+ t?.onKeyDown?.(d);
119
+ const h = i();
120
+ let u;
121
+ switch (l) {
122
+ case "horizontal":
123
+ d.key === "ArrowRight" && (u = kt(h, s)), d.key === "ArrowLeft" && (u = Mt(h, s));
124
+ break;
125
+ case "vertical":
126
+ d.key === "ArrowDown" && (u = kt(h, s)), d.key === "ArrowUp" && (u = Mt(h, s));
127
+ break;
128
+ case "ambiguous":
129
+ ["ArrowRight", "ArrowDown"].includes(d.key) && (u = kt(h, s)), ["ArrowLeft", "ArrowUp"].includes(d.key) && (u = Mt(h, s));
130
+ }
131
+ d.key === "Home" && (u = h[0]), d.key === "End" && (u = h[h.length - 1]), u && (d.preventDefault(), u.element.focus());
132
+ }
133
+ }), f = Ve([r, c.ref]);
134
+ return y(o, { ...t, ...c, ref: f, children: t.children });
135
+ }), oo = (e, n, t) => {
136
+ const r = (t - 1) / 2, o = Math.max(1, Math.min(Math.max(e - Math.floor(r), 1), n - t + 1)), s = Math.min(Math.max(e + Math.ceil(r), t), n), i = Array.from({ length: s + 1 - o }, (a, l) => l + o);
137
+ return t > 4 && o > 1 && i.splice(0, 2, 1, 0), t > 3 && s < n && i.splice(-2, 2, 0, n), i;
138
+ }, Mi = ({ currentPage: e = 1, setCurrentPage: n, onChange: t, totalPages: r = 1, showPages: o = 7 }) => Le(() => {
139
+ const s = e < r, i = e !== 1, a = (l) => (c) => {
140
+ if (l < 1 || l > r)
141
+ return c.preventDefault();
142
+ t?.(c, l), c.defaultPrevented || n?.(l);
143
+ };
144
+ return {
145
+ /** Number of steps */
146
+ pages: oo(e, r, o).map((l, c) => ({
147
+ /**
148
+ * Page number or "ellipsis" for the ellipsis item
149
+ */
150
+ page: l || "ellipsis",
151
+ /**
152
+ * Unique key for the item
153
+ */
154
+ itemKey: l ? `page-${l}` : `ellipsis-${c}`,
155
+ // React key utility
156
+ /**
157
+ * Properties to spread on Pagination.Button
158
+ */
159
+ buttonProps: l ? {
160
+ "aria-current": l === e ? "page" : void 0,
161
+ onClick: a(l),
162
+ variant: l === e ? "primary" : "tertiary"
163
+ } : null
164
+ })),
165
+ /** Properties to spread on Pagination.Button used for previous naviagation */
166
+ prevButtonProps: {
167
+ "aria-hidden": !i,
168
+ // Using aria-hidden to support all HTML elements because of potential asChild
169
+ onClick: a(e - 1),
170
+ variant: "tertiary"
171
+ },
172
+ /** Properties to spread on Pagination.Button used for next naviagation */
173
+ nextButtonProps: {
174
+ "aria-hidden": !s,
175
+ // Using aria-hidden to support all HTML elements because of potential asChild
176
+ onClick: a(e + 1),
177
+ variant: "tertiary"
178
+ },
179
+ /** Indication if previous page action should be shown or not */
180
+ hasPrev: i,
181
+ /** Indication if next page action should be shown or not */
182
+ hasNext: s
183
+ };
184
+ }, [e, r, o]), so = V(function({ className: n, count: t, maxCount: r, variant: o = "base", ...s }, i) {
185
+ return y("span", { className: X("ds-badge", n), "data-count": t && r && t > r ? `${r}+` : t, "data-variant": o, ref: i, ...s });
186
+ }), io = V(function({ className: n, overlap: t = "rectangle", placement: r = "top-right", ...o }, s) {
187
+ return y("span", { className: X("ds-badge--position", n), "data-overlap": t, "data-placement": r, ref: s, ...o });
188
+ }), ao = Object.assign(so, { Position: io });
189
+ ao.Position.displayName = "Badge.Position";
190
+ const lo = V(({ asChild: e, className: n, ...t }, r) => y(e ? se : "a", { className: X("ds-link", n), ref: r, ...t }));
191
+ lo.displayName = "Link";
192
+ function yt() {
193
+ return typeof window < "u";
194
+ }
195
+ function xt(e) {
196
+ return Un(e) ? (e.nodeName || "").toLowerCase() : "#document";
197
+ }
198
+ function rt(e) {
199
+ var n;
200
+ return (e == null || (n = e.ownerDocument) == null ? void 0 : n.defaultView) || window;
201
+ }
202
+ function co(e) {
203
+ var n;
204
+ return (n = (Un(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : n.documentElement;
205
+ }
206
+ function Un(e) {
207
+ return yt() ? e instanceof Node || e instanceof rt(e).Node : !1;
208
+ }
209
+ function be(e) {
210
+ return yt() ? e instanceof Element || e instanceof rt(e).Element : !1;
211
+ }
212
+ function Re(e) {
213
+ return yt() ? e instanceof HTMLElement || e instanceof rt(e).HTMLElement : !1;
214
+ }
215
+ function $t(e) {
216
+ return !yt() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof rt(e).ShadowRoot;
217
+ }
218
+ function hn(e) {
219
+ return ["html", "body", "#document"].includes(xt(e));
220
+ }
221
+ function uo(e) {
222
+ return rt(e).getComputedStyle(e);
223
+ }
224
+ function fo(e) {
225
+ if (xt(e) === "html")
226
+ return e;
227
+ const n = (
228
+ // Step into the shadow DOM of the parent of a slotted node.
229
+ e.assignedSlot || // DOM Element detected.
230
+ e.parentNode || // ShadowRoot detected.
231
+ $t(e) && e.host || // Fallback.
232
+ co(e)
233
+ );
234
+ return $t(n) ? n.host : n;
235
+ }
236
+ function Se(e) {
237
+ let n = e.activeElement;
238
+ for (; ((t = n) == null || (t = t.shadowRoot) == null ? void 0 : t.activeElement) != null; ) {
239
+ var t;
240
+ n = n.shadowRoot.activeElement;
241
+ }
242
+ return n;
243
+ }
244
+ function ce(e, n) {
245
+ if (!e || !n)
246
+ return !1;
247
+ const t = n.getRootNode == null ? void 0 : n.getRootNode();
248
+ if (e.contains(n))
249
+ return !0;
250
+ if (t && $t(t)) {
251
+ let r = n;
252
+ for (; r; ) {
253
+ if (e === r)
254
+ return !0;
255
+ r = r.parentNode || r.host;
256
+ }
257
+ }
258
+ return !1;
259
+ }
260
+ function Xn() {
261
+ const e = navigator.userAgentData;
262
+ return e != null && e.platform ? e.platform : navigator.platform;
263
+ }
264
+ function Gn() {
265
+ const e = navigator.userAgentData;
266
+ return e && Array.isArray(e.brands) ? e.brands.map((n) => {
267
+ let {
268
+ brand: t,
269
+ version: r
270
+ } = n;
271
+ return t + "/" + r;
272
+ }).join(" ") : navigator.userAgent;
273
+ }
274
+ function Yn(e) {
275
+ return e.mozInputSource === 0 && e.isTrusted ? !0 : Kt() && e.pointerType ? e.type === "click" && e.buttons === 1 : e.detail === 0 && !e.pointerType;
276
+ }
277
+ function Zn(e) {
278
+ return mo() ? !1 : !Kt() && e.width === 0 && e.height === 0 || Kt() && e.width === 1 && e.height === 1 && e.pressure === 0 && e.detail === 0 && e.pointerType === "mouse" || // iOS VoiceOver returns 0.333• for width/height.
279
+ e.width < 1 && e.height < 1 && e.pressure === 0 && e.detail === 0 && e.pointerType === "touch";
280
+ }
281
+ function Jn() {
282
+ return /apple/i.test(navigator.vendor);
283
+ }
284
+ function Kt() {
285
+ const e = /android/i;
286
+ return e.test(Xn()) || e.test(Gn());
287
+ }
288
+ function ho() {
289
+ return Xn().toLowerCase().startsWith("mac") && !navigator.maxTouchPoints;
290
+ }
291
+ function mo() {
292
+ return Gn().includes("jsdom/");
293
+ }
294
+ function po(e) {
295
+ return "nativeEvent" in e;
296
+ }
297
+ function bo(e) {
298
+ return e.matches("html,body");
299
+ }
300
+ function pe(e) {
301
+ return e?.ownerDocument || document;
302
+ }
303
+ function Nt(e, n) {
304
+ if (n == null)
305
+ return !1;
306
+ if ("composedPath" in e)
307
+ return e.composedPath().includes(n);
308
+ const t = e;
309
+ return t.target != null && n.contains(t.target);
310
+ }
311
+ function _e(e) {
312
+ return "composedPath" in e ? e.composedPath()[0] : e.target;
313
+ }
314
+ const go = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";
315
+ function vo(e) {
316
+ return Re(e) && e.matches(go);
317
+ }
318
+ function ue(e) {
319
+ e.preventDefault(), e.stopPropagation();
320
+ }
321
+ function Qn(e) {
322
+ return e ? e.getAttribute("role") === "combobox" && vo(e) : !1;
323
+ }
324
+ const mn = Math.floor;
325
+ var yo = ["input:not([inert])", "select:not([inert])", "textarea:not([inert])", "a[href]:not([inert])", "button:not([inert])", "[tabindex]:not(slot):not([inert])", "audio[controls]:not([inert])", "video[controls]:not([inert])", '[contenteditable]:not([contenteditable="false"]):not([inert])', "details>summary:first-of-type:not([inert])", "details:not([inert])"], ft = /* @__PURE__ */ yo.join(","), er = typeof Element > "u", qe = er ? function() {
326
+ } : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector, ht = !er && Element.prototype.getRootNode ? function(e) {
327
+ var n;
328
+ return e == null || (n = e.getRootNode) === null || n === void 0 ? void 0 : n.call(e);
329
+ } : function(e) {
330
+ return e?.ownerDocument;
331
+ }, mt = function e(n, t) {
332
+ var r;
333
+ t === void 0 && (t = !0);
334
+ var o = n == null || (r = n.getAttribute) === null || r === void 0 ? void 0 : r.call(n, "inert"), s = o === "" || o === "true", i = s || t && n && e(n.parentNode);
335
+ return i;
336
+ }, xo = function(n) {
337
+ var t, r = n == null || (t = n.getAttribute) === null || t === void 0 ? void 0 : t.call(n, "contenteditable");
338
+ return r === "" || r === "true";
339
+ }, Co = function(n, t, r) {
340
+ if (mt(n))
341
+ return [];
342
+ var o = Array.prototype.slice.apply(n.querySelectorAll(ft));
343
+ return t && qe.call(n, ft) && o.unshift(n), o = o.filter(r), o;
344
+ }, Eo = function e(n, t, r) {
345
+ for (var o = [], s = Array.from(n); s.length; ) {
346
+ var i = s.shift();
347
+ if (!mt(i, !1))
348
+ if (i.tagName === "SLOT") {
349
+ var a = i.assignedElements(), l = a.length ? a : i.children, c = e(l, !0, r);
350
+ r.flatten ? o.push.apply(o, c) : o.push({
351
+ scopeParent: i,
352
+ candidates: c
353
+ });
354
+ } else {
355
+ var f = qe.call(i, ft);
356
+ f && r.filter(i) && (t || !n.includes(i)) && o.push(i);
357
+ var d = i.shadowRoot || // check for an undisclosed shadow
358
+ typeof r.getShadowRoot == "function" && r.getShadowRoot(i), h = !mt(d, !1) && (!r.shadowRootFilter || r.shadowRootFilter(i));
359
+ if (d && h) {
360
+ var u = e(d === !0 ? i.children : d.children, !0, r);
361
+ r.flatten ? o.push.apply(o, u) : o.push({
362
+ scopeParent: i,
363
+ candidates: u
364
+ });
365
+ } else
366
+ s.unshift.apply(s, i.children);
367
+ }
368
+ }
369
+ return o;
370
+ }, tr = function(n) {
371
+ return !isNaN(parseInt(n.getAttribute("tabindex"), 10));
372
+ }, nr = function(n) {
373
+ if (!n)
374
+ throw new Error("No node provided");
375
+ return n.tabIndex < 0 && (/^(AUDIO|VIDEO|DETAILS)$/.test(n.tagName) || xo(n)) && !tr(n) ? 0 : n.tabIndex;
376
+ }, wo = function(n, t) {
377
+ var r = nr(n);
378
+ return r < 0 && t && !tr(n) ? 0 : r;
379
+ }, Io = function(n, t) {
380
+ return n.tabIndex === t.tabIndex ? n.documentOrder - t.documentOrder : n.tabIndex - t.tabIndex;
381
+ }, rr = function(n) {
382
+ return n.tagName === "INPUT";
383
+ }, Ro = function(n) {
384
+ return rr(n) && n.type === "hidden";
385
+ }, So = function(n) {
386
+ var t = n.tagName === "DETAILS" && Array.prototype.slice.apply(n.children).some(function(r) {
387
+ return r.tagName === "SUMMARY";
388
+ });
389
+ return t;
390
+ }, Oo = function(n, t) {
391
+ for (var r = 0; r < n.length; r++)
392
+ if (n[r].checked && n[r].form === t)
393
+ return n[r];
394
+ }, To = function(n) {
395
+ if (!n.name)
396
+ return !0;
397
+ var t = n.form || ht(n), r = function(a) {
398
+ return t.querySelectorAll('input[type="radio"][name="' + a + '"]');
399
+ }, o;
400
+ if (typeof window < "u" && typeof window.CSS < "u" && typeof window.CSS.escape == "function")
401
+ o = r(window.CSS.escape(n.name));
402
+ else
403
+ try {
404
+ o = r(n.name);
405
+ } catch (i) {
406
+ return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s", i.message), !1;
407
+ }
408
+ var s = Oo(o, n.form);
409
+ return !s || s === n;
410
+ }, ko = function(n) {
411
+ return rr(n) && n.type === "radio";
412
+ }, Mo = function(n) {
413
+ return ko(n) && !To(n);
414
+ }, No = function(n) {
415
+ var t, r = n && ht(n), o = (t = r) === null || t === void 0 ? void 0 : t.host, s = !1;
416
+ if (r && r !== n) {
417
+ var i, a, l;
418
+ for (s = !!((i = o) !== null && i !== void 0 && (a = i.ownerDocument) !== null && a !== void 0 && a.contains(o) || n != null && (l = n.ownerDocument) !== null && l !== void 0 && l.contains(n)); !s && o; ) {
419
+ var c, f, d;
420
+ r = ht(o), o = (c = r) === null || c === void 0 ? void 0 : c.host, s = !!((f = o) !== null && f !== void 0 && (d = f.ownerDocument) !== null && d !== void 0 && d.contains(o));
421
+ }
422
+ }
423
+ return s;
424
+ }, pn = function(n) {
425
+ var t = n.getBoundingClientRect(), r = t.width, o = t.height;
426
+ return r === 0 && o === 0;
427
+ }, Po = function(n, t) {
428
+ var r = t.displayCheck, o = t.getShadowRoot;
429
+ if (getComputedStyle(n).visibility === "hidden")
430
+ return !0;
431
+ var s = qe.call(n, "details>summary:first-of-type"), i = s ? n.parentElement : n;
432
+ if (qe.call(i, "details:not([open]) *"))
433
+ return !0;
434
+ if (!r || r === "full" || r === "legacy-full") {
435
+ if (typeof o == "function") {
436
+ for (var a = n; n; ) {
437
+ var l = n.parentElement, c = ht(n);
438
+ if (l && !l.shadowRoot && o(l) === !0)
439
+ return pn(n);
440
+ n.assignedSlot ? n = n.assignedSlot : !l && c !== n.ownerDocument ? n = c.host : n = l;
441
+ }
442
+ n = a;
443
+ }
444
+ if (No(n))
445
+ return !n.getClientRects().length;
446
+ if (r !== "legacy-full")
447
+ return !0;
448
+ } else if (r === "non-zero-area")
449
+ return pn(n);
450
+ return !1;
451
+ }, Do = function(n) {
452
+ if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(n.tagName))
453
+ for (var t = n.parentElement; t; ) {
454
+ if (t.tagName === "FIELDSET" && t.disabled) {
455
+ for (var r = 0; r < t.children.length; r++) {
456
+ var o = t.children.item(r);
457
+ if (o.tagName === "LEGEND")
458
+ return qe.call(t, "fieldset[disabled] *") ? !0 : !o.contains(n);
459
+ }
460
+ return !0;
461
+ }
462
+ t = t.parentElement;
463
+ }
464
+ return !1;
465
+ }, Ao = function(n, t) {
466
+ return !(t.disabled || // we must do an inert look up to filter out any elements inside an inert ancestor
467
+ // because we're limited in the type of selectors we can use in JSDom (see related
468
+ // note related to `candidateSelectors`)
469
+ mt(t) || Ro(t) || Po(t, n) || // For a details element with a summary, the summary element gets the focus
470
+ So(t) || Do(t));
471
+ }, jt = function(n, t) {
472
+ return !(Mo(t) || nr(t) < 0 || !Ao(n, t));
473
+ }, Fo = function(n) {
474
+ var t = parseInt(n.getAttribute("tabindex"), 10);
475
+ return !!(isNaN(t) || t >= 0);
476
+ }, _o = function e(n) {
477
+ var t = [], r = [];
478
+ return n.forEach(function(o, s) {
479
+ var i = !!o.scopeParent, a = i ? o.scopeParent : o, l = wo(a, i), c = i ? e(o.candidates) : a;
480
+ l === 0 ? i ? t.push.apply(t, c) : t.push(a) : r.push({
481
+ documentOrder: s,
482
+ tabIndex: l,
483
+ item: o,
484
+ isScope: i,
485
+ content: c
486
+ });
487
+ }), r.sort(Io).reduce(function(o, s) {
488
+ return s.isScope ? o.push.apply(o, s.content) : o.push(s.content), o;
489
+ }, []).concat(t);
490
+ }, tt = function(n, t) {
491
+ t = t || {};
492
+ var r;
493
+ return t.getShadowRoot ? r = Eo([n], t.includeContainer, {
494
+ filter: jt.bind(null, t),
495
+ flatten: !1,
496
+ getShadowRoot: t.getShadowRoot,
497
+ shadowRootFilter: Fo
498
+ }) : r = Co(n, t.includeContainer, jt.bind(null, t)), _o(r);
499
+ }, Lo = function(n, t) {
500
+ if (t = t || {}, !n)
501
+ throw new Error("No node provided");
502
+ return qe.call(n, ft) === !1 ? !1 : jt(t, n);
503
+ }, ut = typeof document < "u" ? zn : de;
504
+ function pt(e, n) {
505
+ if (e === n)
506
+ return !0;
507
+ if (typeof e != typeof n)
508
+ return !1;
509
+ if (typeof e == "function" && e.toString() === n.toString())
510
+ return !0;
511
+ let t, r, o;
512
+ if (e && n && typeof e == "object") {
513
+ if (Array.isArray(e)) {
514
+ if (t = e.length, t !== n.length) return !1;
515
+ for (r = t; r-- !== 0; )
516
+ if (!pt(e[r], n[r]))
517
+ return !1;
518
+ return !0;
519
+ }
520
+ if (o = Object.keys(e), t = o.length, t !== Object.keys(n).length)
521
+ return !1;
522
+ for (r = t; r-- !== 0; )
523
+ if (!{}.hasOwnProperty.call(n, o[r]))
524
+ return !1;
525
+ for (r = t; r-- !== 0; ) {
526
+ const s = o[r];
527
+ if (!(s === "_owner" && e.$$typeof) && !pt(e[s], n[s]))
528
+ return !1;
529
+ }
530
+ return !0;
531
+ }
532
+ return e !== e && n !== n;
533
+ }
534
+ function or(e) {
535
+ return typeof window > "u" ? 1 : (e.ownerDocument.defaultView || window).devicePixelRatio || 1;
536
+ }
537
+ function bn(e, n) {
538
+ const t = or(e);
539
+ return Math.round(n * t) / t;
540
+ }
541
+ function Pt(e) {
542
+ const n = p.useRef(e);
543
+ return ut(() => {
544
+ n.current = e;
545
+ }), n;
546
+ }
547
+ function zo(e) {
548
+ e === void 0 && (e = {});
549
+ const {
550
+ placement: n = "bottom",
551
+ strategy: t = "absolute",
552
+ middleware: r = [],
553
+ platform: o,
554
+ elements: {
555
+ reference: s,
556
+ floating: i
557
+ } = {},
558
+ transform: a = !0,
559
+ whileElementsMounted: l,
560
+ open: c
561
+ } = e, [f, d] = p.useState({
562
+ x: 0,
563
+ y: 0,
564
+ strategy: t,
565
+ placement: n,
566
+ middlewareData: {},
567
+ isPositioned: !1
568
+ }), [h, u] = p.useState(r);
569
+ pt(h, r) || u(r);
570
+ const [m, g] = p.useState(null), [E, x] = p.useState(null), v = p.useCallback((k) => {
571
+ k !== M.current && (M.current = k, g(k));
572
+ }, []), b = p.useCallback((k) => {
573
+ k !== $.current && ($.current = k, x(k));
574
+ }, []), C = s || m, A = i || E, M = p.useRef(null), $ = p.useRef(null), K = p.useRef(f), Z = l != null, G = Pt(l), q = Pt(o), O = Pt(c), N = p.useCallback(() => {
575
+ if (!M.current || !$.current)
576
+ return;
577
+ const k = {
578
+ placement: n,
579
+ strategy: t,
580
+ middleware: h
581
+ };
582
+ q.current && (k.platform = q.current), Wn(M.current, $.current, k).then((R) => {
583
+ const U = {
584
+ ...R,
585
+ // The floating element's position may be recomputed while it's closed
586
+ // but still mounted (such as when transitioning out). To ensure
587
+ // `isPositioned` will be `false` initially on the next open, avoid
588
+ // setting it to `true` when `open === false` (must be specified).
589
+ isPositioned: O.current !== !1
590
+ };
591
+ P.current && !pt(K.current, U) && (K.current = U, Bn.flushSync(() => {
592
+ d(U);
593
+ }));
594
+ });
595
+ }, [h, n, t, q, O]);
596
+ ut(() => {
597
+ c === !1 && K.current.isPositioned && (K.current.isPositioned = !1, d((k) => ({
598
+ ...k,
599
+ isPositioned: !1
600
+ })));
601
+ }, [c]);
602
+ const P = p.useRef(!1);
603
+ ut(() => (P.current = !0, () => {
604
+ P.current = !1;
605
+ }), []), ut(() => {
606
+ if (C && (M.current = C), A && ($.current = A), C && A) {
607
+ if (G.current)
608
+ return G.current(C, A, N);
609
+ N();
610
+ }
611
+ }, [C, A, N, G, Z]);
612
+ const w = p.useMemo(() => ({
613
+ reference: M,
614
+ floating: $,
615
+ setReference: v,
616
+ setFloating: b
617
+ }), [v, b]), D = p.useMemo(() => ({
618
+ reference: C,
619
+ floating: A
620
+ }), [C, A]), B = p.useMemo(() => {
621
+ const k = {
622
+ position: t,
623
+ left: 0,
624
+ top: 0
625
+ };
626
+ if (!D.floating)
627
+ return k;
628
+ const R = bn(D.floating, f.x), U = bn(D.floating, f.y);
629
+ return a ? {
630
+ ...k,
631
+ transform: "translate(" + R + "px, " + U + "px)",
632
+ ...or(D.floating) >= 1.5 && {
633
+ willChange: "transform"
634
+ }
635
+ } : {
636
+ position: t,
637
+ left: R,
638
+ top: U
639
+ };
640
+ }, [t, a, D.floating, f.x, f.y]);
641
+ return p.useMemo(() => ({
642
+ ...f,
643
+ update: N,
644
+ refs: w,
645
+ elements: D,
646
+ floatingStyles: B
647
+ }), [f, N, w, D, B]);
648
+ }
649
+ const Vo = (e, n) => ({
650
+ ...jn(e),
651
+ options: [e, n]
652
+ }), Bo = (e, n) => ({
653
+ ...Kn(e),
654
+ options: [e, n]
655
+ }), $o = (e, n) => ({
656
+ ...Yr(e),
657
+ options: [e, n]
658
+ });
659
+ function Gt(e) {
660
+ return p.useMemo(() => e.every((n) => n == null) ? null : (n) => {
661
+ e.forEach((t) => {
662
+ typeof t == "function" ? t(n) : t != null && (t.current = n);
663
+ });
664
+ }, e);
665
+ }
666
+ const sr = {
667
+ ...p
668
+ }, Ko = sr.useInsertionEffect, jo = Ko || ((e) => e());
669
+ function xe(e) {
670
+ const n = p.useRef(() => {
671
+ if (process.env.NODE_ENV !== "production")
672
+ throw new Error("Cannot call an event handler while rendering.");
673
+ });
674
+ return jo(() => {
675
+ n.current = e;
676
+ }), p.useCallback(function() {
677
+ for (var t = arguments.length, r = new Array(t), o = 0; o < t; o++)
678
+ r[o] = arguments[o];
679
+ return n.current == null ? void 0 : n.current(...r);
680
+ }, []);
681
+ }
682
+ const Yt = "ArrowUp", ot = "ArrowDown", He = "ArrowLeft", Ye = "ArrowRight";
683
+ function at(e, n, t) {
684
+ return Math.floor(e / n) !== t;
685
+ }
686
+ function Qe(e, n) {
687
+ return n < 0 || n >= e.current.length;
688
+ }
689
+ function Dt(e, n) {
690
+ return ae(e, {
691
+ disabledIndices: n
692
+ });
693
+ }
694
+ function gn(e, n) {
695
+ return ae(e, {
696
+ decrement: !0,
697
+ startingIndex: e.current.length,
698
+ disabledIndices: n
699
+ });
700
+ }
701
+ function ae(e, n) {
702
+ let {
703
+ startingIndex: t = -1,
704
+ decrement: r = !1,
705
+ disabledIndices: o,
706
+ amount: s = 1
707
+ } = n === void 0 ? {} : n;
708
+ const i = e.current;
709
+ let a = t;
710
+ do
711
+ a += r ? -s : s;
712
+ while (a >= 0 && a <= i.length - 1 && dt(i, a, o));
713
+ return a;
714
+ }
715
+ function Wo(e, n) {
716
+ let {
717
+ event: t,
718
+ orientation: r,
719
+ loop: o,
720
+ cols: s,
721
+ disabledIndices: i,
722
+ minIndex: a,
723
+ maxIndex: l,
724
+ prevIndex: c,
725
+ stopEvent: f = !1
726
+ } = n, d = c;
727
+ if (t.key === Yt) {
728
+ if (f && ue(t), c === -1)
729
+ d = l;
730
+ else if (d = ae(e, {
731
+ startingIndex: d,
732
+ amount: s,
733
+ decrement: !0,
734
+ disabledIndices: i
735
+ }), o && (c - s < a || d < 0)) {
736
+ const h = c % s, u = l % s, m = l - (u - h);
737
+ u === h ? d = l : d = u > h ? m : m - s;
738
+ }
739
+ Qe(e, d) && (d = c);
740
+ }
741
+ if (t.key === ot && (f && ue(t), c === -1 ? d = a : (d = ae(e, {
742
+ startingIndex: c,
743
+ amount: s,
744
+ disabledIndices: i
745
+ }), o && c + s > l && (d = ae(e, {
746
+ startingIndex: c % s - s,
747
+ amount: s,
748
+ disabledIndices: i
749
+ }))), Qe(e, d) && (d = c)), r === "both") {
750
+ const h = mn(c / s);
751
+ t.key === Ye && (f && ue(t), c % s !== s - 1 ? (d = ae(e, {
752
+ startingIndex: c,
753
+ disabledIndices: i
754
+ }), o && at(d, s, h) && (d = ae(e, {
755
+ startingIndex: c - c % s - 1,
756
+ disabledIndices: i
757
+ }))) : o && (d = ae(e, {
758
+ startingIndex: c - c % s - 1,
759
+ disabledIndices: i
760
+ })), at(d, s, h) && (d = c)), t.key === He && (f && ue(t), c % s !== 0 ? (d = ae(e, {
761
+ startingIndex: c,
762
+ decrement: !0,
763
+ disabledIndices: i
764
+ }), o && at(d, s, h) && (d = ae(e, {
765
+ startingIndex: c + (s - c % s),
766
+ decrement: !0,
767
+ disabledIndices: i
768
+ }))) : o && (d = ae(e, {
769
+ startingIndex: c + (s - c % s),
770
+ decrement: !0,
771
+ disabledIndices: i
772
+ })), at(d, s, h) && (d = c));
773
+ const u = mn(l / s) === h;
774
+ Qe(e, d) && (o && u ? d = t.key === He ? l : ae(e, {
775
+ startingIndex: c - c % s - 1,
776
+ disabledIndices: i
777
+ }) : d = c);
778
+ }
779
+ return d;
780
+ }
781
+ function qo(e, n, t) {
782
+ const r = [];
783
+ let o = 0;
784
+ return e.forEach((s, i) => {
785
+ let {
786
+ width: a,
787
+ height: l
788
+ } = s;
789
+ if (a > n && process.env.NODE_ENV !== "production")
790
+ throw new Error("[Floating UI]: Invalid grid - item width at index " + i + " is greater than grid columns");
791
+ let c = !1;
792
+ for (t && (o = 0); !c; ) {
793
+ const f = [];
794
+ for (let d = 0; d < a; d++)
795
+ for (let h = 0; h < l; h++)
796
+ f.push(o + d + h * n);
797
+ o % n + a <= n && f.every((d) => r[d] == null) ? (f.forEach((d) => {
798
+ r[d] = i;
799
+ }), c = !0) : o++;
800
+ }
801
+ }), [...r];
802
+ }
803
+ function Ho(e, n, t, r, o) {
804
+ if (e === -1) return -1;
805
+ const s = t.indexOf(e), i = n[e];
806
+ switch (o) {
807
+ case "tl":
808
+ return s;
809
+ case "tr":
810
+ return i ? s + i.width - 1 : s;
811
+ case "bl":
812
+ return i ? s + (i.height - 1) * r : s;
813
+ case "br":
814
+ return t.lastIndexOf(e);
815
+ }
816
+ }
817
+ function Uo(e, n) {
818
+ return n.flatMap((t, r) => e.includes(t) ? [r] : []);
819
+ }
820
+ function dt(e, n, t) {
821
+ if (t)
822
+ return t.includes(n);
823
+ const r = e[n];
824
+ return r == null || r.hasAttribute("disabled") || r.getAttribute("aria-disabled") === "true";
825
+ }
826
+ let vn = 0;
827
+ function ke(e, n) {
828
+ n === void 0 && (n = {});
829
+ const {
830
+ preventScroll: t = !1,
831
+ cancelPrevious: r = !0,
832
+ sync: o = !1
833
+ } = n;
834
+ r && cancelAnimationFrame(vn);
835
+ const s = () => e?.focus({
836
+ preventScroll: t
837
+ });
838
+ o ? s() : vn = requestAnimationFrame(s);
839
+ }
840
+ var Q = typeof document < "u" ? zn : de;
841
+ function bt() {
842
+ return bt = Object.assign ? Object.assign.bind() : function(e) {
843
+ for (var n = 1; n < arguments.length; n++) {
844
+ var t = arguments[n];
845
+ for (var r in t)
846
+ Object.prototype.hasOwnProperty.call(t, r) && (e[r] = t[r]);
847
+ }
848
+ return e;
849
+ }, bt.apply(this, arguments);
850
+ }
851
+ let yn = !1, Xo = 0;
852
+ const xn = () => (
853
+ // Ensure the id is unique with multiple independent versions of Floating UI
854
+ // on <React 18
855
+ "floating-ui-" + Math.random().toString(36).slice(2, 6) + Xo++
856
+ );
857
+ function Go() {
858
+ const [e, n] = p.useState(() => yn ? xn() : void 0);
859
+ return Q(() => {
860
+ e == null && n(xn());
861
+ }, []), p.useEffect(() => {
862
+ yn = !0;
863
+ }, []), e;
864
+ }
865
+ const Yo = sr.useId, Zt = Yo || Go;
866
+ let nt;
867
+ process.env.NODE_ENV !== "production" && (nt = /* @__PURE__ */ new Set());
868
+ function At() {
869
+ for (var e, n = arguments.length, t = new Array(n), r = 0; r < n; r++)
870
+ t[r] = arguments[r];
871
+ const o = "Floating UI: " + t.join(" ");
872
+ if (!((e = nt) != null && e.has(o))) {
873
+ var s;
874
+ (s = nt) == null || s.add(o), console.warn(o);
875
+ }
876
+ }
877
+ function Zo() {
878
+ for (var e, n = arguments.length, t = new Array(n), r = 0; r < n; r++)
879
+ t[r] = arguments[r];
880
+ const o = "Floating UI: " + t.join(" ");
881
+ if (!((e = nt) != null && e.has(o))) {
882
+ var s;
883
+ (s = nt) == null || s.add(o), console.error(o);
884
+ }
885
+ }
886
+ function Jo() {
887
+ const e = /* @__PURE__ */ new Map();
888
+ return {
889
+ emit(n, t) {
890
+ var r;
891
+ (r = e.get(n)) == null || r.forEach((o) => o(t));
892
+ },
893
+ on(n, t) {
894
+ e.set(n, [...e.get(n) || [], t]);
895
+ },
896
+ off(n, t) {
897
+ var r;
898
+ e.set(n, ((r = e.get(n)) == null ? void 0 : r.filter((o) => o !== t)) || []);
899
+ }
900
+ };
901
+ }
902
+ const Qo = /* @__PURE__ */ p.createContext(null), es = /* @__PURE__ */ p.createContext(null), Jt = () => {
903
+ var e;
904
+ return ((e = p.useContext(Qo)) == null ? void 0 : e.id) || null;
905
+ }, Ct = () => p.useContext(es);
906
+ function Ue(e) {
907
+ return "data-floating-ui-" + e;
908
+ }
909
+ function Me(e) {
910
+ const n = ge(e);
911
+ return Q(() => {
912
+ n.current = e;
913
+ }), n;
914
+ }
915
+ function ts(e, n) {
916
+ var t;
917
+ let r = [], o = (t = e.find((s) => s.id === n)) == null ? void 0 : t.parentId;
918
+ for (; o; ) {
919
+ const s = e.find((i) => i.id === o);
920
+ o = s?.parentId, s && (r = r.concat(s));
921
+ }
922
+ return r;
923
+ }
924
+ function je(e, n) {
925
+ let t = e.filter((o) => {
926
+ var s;
927
+ return o.parentId === n && ((s = o.context) == null ? void 0 : s.open);
928
+ }), r = t;
929
+ for (; r.length; )
930
+ r = e.filter((o) => {
931
+ var s;
932
+ return (s = r) == null ? void 0 : s.some((i) => {
933
+ var a;
934
+ return o.parentId === i.id && ((a = o.context) == null ? void 0 : a.open);
935
+ });
936
+ }), t = t.concat(r);
937
+ return t;
938
+ }
939
+ function ns(e, n) {
940
+ let t, r = -1;
941
+ function o(s, i) {
942
+ i > r && (t = s, r = i), je(e, s).forEach((l) => {
943
+ o(l.id, i + 1);
944
+ });
945
+ }
946
+ return o(n, 0), e.find((s) => s.id === t);
947
+ }
948
+ let $e = /* @__PURE__ */ new WeakMap(), lt = /* @__PURE__ */ new WeakSet(), ct = {}, Ft = 0;
949
+ const rs = () => typeof HTMLElement < "u" && "inert" in HTMLElement.prototype, ir = (e) => e && (e.host || ir(e.parentNode)), os = (e, n) => n.map((t) => {
950
+ if (e.contains(t))
951
+ return t;
952
+ const r = ir(t);
953
+ return e.contains(r) ? r : null;
954
+ }).filter((t) => t != null);
955
+ function ss(e, n, t, r) {
956
+ const o = "data-floating-ui-inert", s = r ? "inert" : t ? "aria-hidden" : null, i = os(n, e), a = /* @__PURE__ */ new Set(), l = new Set(i), c = [];
957
+ ct[o] || (ct[o] = /* @__PURE__ */ new WeakMap());
958
+ const f = ct[o];
959
+ i.forEach(d), h(n), a.clear();
960
+ function d(u) {
961
+ !u || a.has(u) || (a.add(u), u.parentNode && d(u.parentNode));
962
+ }
963
+ function h(u) {
964
+ !u || l.has(u) || [].forEach.call(u.children, (m) => {
965
+ if (xt(m) !== "script")
966
+ if (a.has(m))
967
+ h(m);
968
+ else {
969
+ const g = s ? m.getAttribute(s) : null, E = g !== null && g !== "false", x = ($e.get(m) || 0) + 1, v = (f.get(m) || 0) + 1;
970
+ $e.set(m, x), f.set(m, v), c.push(m), x === 1 && E && lt.add(m), v === 1 && m.setAttribute(o, ""), !E && s && m.setAttribute(s, "true");
971
+ }
972
+ });
973
+ }
974
+ return Ft++, () => {
975
+ c.forEach((u) => {
976
+ const m = ($e.get(u) || 0) - 1, g = (f.get(u) || 0) - 1;
977
+ $e.set(u, m), f.set(u, g), m || (!lt.has(u) && s && u.removeAttribute(s), lt.delete(u)), g || u.removeAttribute(o);
978
+ }), Ft--, Ft || ($e = /* @__PURE__ */ new WeakMap(), $e = /* @__PURE__ */ new WeakMap(), lt = /* @__PURE__ */ new WeakSet(), ct = {});
979
+ };
980
+ }
981
+ function Cn(e, n, t) {
982
+ n === void 0 && (n = !1), t === void 0 && (t = !1);
983
+ const r = pe(e[0]).body;
984
+ return ss(e.concat(Array.from(r.querySelectorAll("[aria-live]"))), r, n, t);
985
+ }
986
+ const Xe = () => ({
987
+ getShadowRoot: !0,
988
+ displayCheck: (
989
+ // JSDOM does not support the `tabbable` library. To solve this we can
990
+ // check if `ResizeObserver` is a real function (not polyfilled), which
991
+ // determines if the current environment is JSDOM-like.
992
+ typeof ResizeObserver == "function" && ResizeObserver.toString().includes("[native code]") ? "full" : "none"
993
+ )
994
+ });
995
+ function ar(e, n) {
996
+ const t = tt(e, Xe());
997
+ n === "prev" && t.reverse();
998
+ const r = t.indexOf(Se(pe(e)));
999
+ return t.slice(r + 1)[0];
1000
+ }
1001
+ function lr() {
1002
+ return ar(document.body, "next");
1003
+ }
1004
+ function cr() {
1005
+ return ar(document.body, "prev");
1006
+ }
1007
+ function et(e, n) {
1008
+ const t = n || e.currentTarget, r = e.relatedTarget;
1009
+ return !r || !ce(t, r);
1010
+ }
1011
+ function is(e) {
1012
+ tt(e, Xe()).forEach((t) => {
1013
+ t.dataset.tabindex = t.getAttribute("tabindex") || "", t.setAttribute("tabindex", "-1");
1014
+ });
1015
+ }
1016
+ function En(e) {
1017
+ e.querySelectorAll("[data-tabindex]").forEach((t) => {
1018
+ const r = t.dataset.tabindex;
1019
+ delete t.dataset.tabindex, r ? t.setAttribute("tabindex", r) : t.removeAttribute("tabindex");
1020
+ });
1021
+ }
1022
+ function as(e, n, t) {
1023
+ const r = e.indexOf(n);
1024
+ function o(i) {
1025
+ const a = Ue("focus-guard");
1026
+ let l = r + (i ? 1 : 0), c = e[l];
1027
+ for (; c && (!c.isConnected || c.hasAttribute(a) || ce(t, c)); )
1028
+ i ? l++ : l--, c = e[l];
1029
+ return c;
1030
+ }
1031
+ const s = o(!0);
1032
+ return s || o(!1);
1033
+ }
1034
+ const Qt = {
1035
+ border: 0,
1036
+ clip: "rect(0 0 0 0)",
1037
+ height: "1px",
1038
+ margin: "-1px",
1039
+ overflow: "hidden",
1040
+ padding: 0,
1041
+ position: "fixed",
1042
+ whiteSpace: "nowrap",
1043
+ width: "1px",
1044
+ top: 0,
1045
+ left: 0
1046
+ };
1047
+ let ls;
1048
+ function wn(e) {
1049
+ e.key === "Tab" && (e.target, clearTimeout(ls));
1050
+ }
1051
+ const gt = /* @__PURE__ */ p.forwardRef(function(n, t) {
1052
+ const [r, o] = p.useState();
1053
+ Q(() => (Jn() && o("button"), document.addEventListener("keydown", wn), () => {
1054
+ document.removeEventListener("keydown", wn);
1055
+ }), []);
1056
+ const s = {
1057
+ ref: t,
1058
+ tabIndex: 0,
1059
+ // Role is only for VoiceOver
1060
+ role: r,
1061
+ "aria-hidden": r ? void 0 : !0,
1062
+ [Ue("focus-guard")]: "",
1063
+ style: Qt
1064
+ };
1065
+ return /* @__PURE__ */ p.createElement("span", bt({}, n, s));
1066
+ }), ur = /* @__PURE__ */ p.createContext(null), In = /* @__PURE__ */ Ue("portal");
1067
+ function cs(e) {
1068
+ e === void 0 && (e = {});
1069
+ const {
1070
+ id: n,
1071
+ root: t
1072
+ } = e, r = Zt(), o = dr(), [s, i] = p.useState(null), a = p.useRef(null);
1073
+ return Q(() => () => {
1074
+ s?.remove(), queueMicrotask(() => {
1075
+ a.current = null;
1076
+ });
1077
+ }, [s]), Q(() => {
1078
+ if (!r || a.current) return;
1079
+ const l = n ? document.getElementById(n) : null;
1080
+ if (!l) return;
1081
+ const c = document.createElement("div");
1082
+ c.id = r, c.setAttribute(In, ""), l.appendChild(c), a.current = c, i(c);
1083
+ }, [n, r]), Q(() => {
1084
+ if (!r || a.current) return;
1085
+ let l = t || o?.portalNode;
1086
+ l && !be(l) && (l = l.current), l = l || document.body;
1087
+ let c = null;
1088
+ n && (c = document.createElement("div"), c.id = n, l.appendChild(c));
1089
+ const f = document.createElement("div");
1090
+ f.id = r, f.setAttribute(In, ""), l = c || l, l.appendChild(f), a.current = f, i(f);
1091
+ }, [n, t, r, o]), s;
1092
+ }
1093
+ function us(e) {
1094
+ const {
1095
+ children: n,
1096
+ id: t,
1097
+ root: r = null,
1098
+ preserveTabOrder: o = !0
1099
+ } = e, s = cs({
1100
+ id: t,
1101
+ root: r
1102
+ }), [i, a] = p.useState(null), l = p.useRef(null), c = p.useRef(null), f = p.useRef(null), d = p.useRef(null), h = i?.modal, u = i?.open, m = (
1103
+ // The FocusManager and therefore floating element are currently open/
1104
+ // rendered.
1105
+ !!i && // Guards are only for non-modal focus management.
1106
+ !i.modal && // Don't render if unmount is transitioning.
1107
+ i.open && o && !!(r || s)
1108
+ );
1109
+ return p.useEffect(() => {
1110
+ if (!s || !o || h)
1111
+ return;
1112
+ function g(E) {
1113
+ s && et(E) && (E.type === "focusin" ? En : is)(s);
1114
+ }
1115
+ return s.addEventListener("focusin", g, !0), s.addEventListener("focusout", g, !0), () => {
1116
+ s.removeEventListener("focusin", g, !0), s.removeEventListener("focusout", g, !0);
1117
+ };
1118
+ }, [s, o, h]), p.useEffect(() => {
1119
+ s && (u || En(s));
1120
+ }, [u, s]), /* @__PURE__ */ p.createElement(ur.Provider, {
1121
+ value: p.useMemo(() => ({
1122
+ preserveTabOrder: o,
1123
+ beforeOutsideRef: l,
1124
+ afterOutsideRef: c,
1125
+ beforeInsideRef: f,
1126
+ afterInsideRef: d,
1127
+ portalNode: s,
1128
+ setFocusManagerState: a
1129
+ }), [o, s])
1130
+ }, m && s && /* @__PURE__ */ p.createElement(gt, {
1131
+ "data-type": "outside",
1132
+ ref: l,
1133
+ onFocus: (g) => {
1134
+ if (et(g, s)) {
1135
+ var E;
1136
+ (E = f.current) == null || E.focus();
1137
+ } else {
1138
+ const x = cr() || i?.refs.domReference.current;
1139
+ x?.focus();
1140
+ }
1141
+ }
1142
+ }), m && s && /* @__PURE__ */ p.createElement("span", {
1143
+ "aria-owns": s.id,
1144
+ style: Qt
1145
+ }), s && /* @__PURE__ */ Bn.createPortal(n, s), m && s && /* @__PURE__ */ p.createElement(gt, {
1146
+ "data-type": "outside",
1147
+ ref: c,
1148
+ onFocus: (g) => {
1149
+ if (et(g, s)) {
1150
+ var E;
1151
+ (E = d.current) == null || E.focus();
1152
+ } else {
1153
+ const x = lr() || i?.refs.domReference.current;
1154
+ x?.focus(), i?.closeOnFocusOut && i?.onOpenChange(!1, g.nativeEvent, "focus-out");
1155
+ }
1156
+ }
1157
+ }));
1158
+ }
1159
+ const dr = () => p.useContext(ur), Wt = "data-floating-ui-focusable";
1160
+ function fr(e) {
1161
+ return e ? e.hasAttribute(Wt) ? e : e.querySelector("[" + Wt + "]") || e : null;
1162
+ }
1163
+ const Rn = 20;
1164
+ let Fe = [];
1165
+ function _t(e) {
1166
+ Fe = Fe.filter((t) => t.isConnected);
1167
+ let n = e;
1168
+ if (!(!n || xt(n) === "body")) {
1169
+ if (!Lo(n, Xe())) {
1170
+ const t = tt(n, Xe())[0];
1171
+ t && (n = t);
1172
+ }
1173
+ Fe.push(n), Fe.length > Rn && (Fe = Fe.slice(-Rn));
1174
+ }
1175
+ }
1176
+ function Sn() {
1177
+ return Fe.slice().reverse().find((e) => e.isConnected);
1178
+ }
1179
+ const ds = /* @__PURE__ */ p.forwardRef(function(n, t) {
1180
+ return /* @__PURE__ */ p.createElement("button", bt({}, n, {
1181
+ type: "button",
1182
+ ref: t,
1183
+ tabIndex: -1,
1184
+ style: Qt
1185
+ }));
1186
+ });
1187
+ function fs(e) {
1188
+ const {
1189
+ context: n,
1190
+ children: t,
1191
+ disabled: r = !1,
1192
+ order: o = ["content"],
1193
+ guards: s = !0,
1194
+ initialFocus: i = 0,
1195
+ returnFocus: a = !0,
1196
+ restoreFocus: l = !1,
1197
+ modal: c = !0,
1198
+ visuallyHiddenDismiss: f = !1,
1199
+ closeOnFocusOut: d = !0
1200
+ } = e, {
1201
+ open: h,
1202
+ refs: u,
1203
+ nodeId: m,
1204
+ onOpenChange: g,
1205
+ events: E,
1206
+ dataRef: x,
1207
+ floatingId: v,
1208
+ elements: {
1209
+ domReference: b,
1210
+ floating: C
1211
+ }
1212
+ } = n, A = typeof i == "number" && i < 0, M = Qn(b) && A, $ = rs() ? s : !0, K = Me(o), Z = Me(i), G = Me(a), q = Ct(), O = dr(), N = p.useRef(null), P = p.useRef(null), w = p.useRef(!1), D = p.useRef(!1), B = p.useRef(-1), k = O != null, R = fr(C), U = xe(function(L) {
1213
+ return L === void 0 && (L = R), L ? tt(L, Xe()) : [];
1214
+ }), te = xe((L) => {
1215
+ const T = U(L);
1216
+ return K.current.map((S) => b && S === "reference" ? b : R && S === "floating" ? R : T).filter(Boolean).flat();
1217
+ });
1218
+ p.useEffect(() => {
1219
+ w.current = !1;
1220
+ }, [r]), p.useEffect(() => {
1221
+ if (r || !c) return;
1222
+ function L(S) {
1223
+ if (S.key === "Tab") {
1224
+ ce(R, Se(pe(R))) && U().length === 0 && !M && ue(S);
1225
+ const F = te(), H = _e(S);
1226
+ K.current[0] === "reference" && H === b && (ue(S), S.shiftKey ? ke(F[F.length - 1]) : ke(F[1])), K.current[1] === "floating" && H === R && S.shiftKey && (ue(S), ke(F[0]));
1227
+ }
1228
+ }
1229
+ const T = pe(R);
1230
+ return T.addEventListener("keydown", L), () => {
1231
+ T.removeEventListener("keydown", L);
1232
+ };
1233
+ }, [r, b, R, c, K, M, U, te]), p.useEffect(() => {
1234
+ if (r || !C) return;
1235
+ function L(T) {
1236
+ const S = _e(T), H = U().indexOf(S);
1237
+ H !== -1 && (B.current = H);
1238
+ }
1239
+ return C.addEventListener("focusin", L), () => {
1240
+ C.removeEventListener("focusin", L);
1241
+ };
1242
+ }, [r, C, U]), p.useEffect(() => {
1243
+ if (r || !d) return;
1244
+ function L() {
1245
+ D.current = !0, setTimeout(() => {
1246
+ D.current = !1;
1247
+ });
1248
+ }
1249
+ function T(S) {
1250
+ const F = S.relatedTarget;
1251
+ queueMicrotask(() => {
1252
+ const H = !(ce(b, F) || ce(C, F) || ce(F, C) || ce(O?.portalNode, F) || F != null && F.hasAttribute(Ue("focus-guard")) || q && (je(q.nodesRef.current, m).find((ee) => {
1253
+ var ne, Y;
1254
+ return ce((ne = ee.context) == null ? void 0 : ne.elements.floating, F) || ce((Y = ee.context) == null ? void 0 : Y.elements.domReference, F);
1255
+ }) || ts(q.nodesRef.current, m).find((ee) => {
1256
+ var ne, Y;
1257
+ return ((ne = ee.context) == null ? void 0 : ne.elements.floating) === F || ((Y = ee.context) == null ? void 0 : Y.elements.domReference) === F;
1258
+ })));
1259
+ if (l && H && Se(pe(R)) === pe(R).body) {
1260
+ Re(R) && R.focus();
1261
+ const ee = B.current, ne = U(), Y = ne[ee] || ne[ne.length - 1] || R;
1262
+ Re(Y) && Y.focus();
1263
+ }
1264
+ (M || !c) && F && H && !D.current && // Fix React 18 Strict Mode returnFocus due to double rendering.
1265
+ F !== Sn() && (w.current = !0, g(!1, S, "focus-out"));
1266
+ });
1267
+ }
1268
+ if (C && Re(b))
1269
+ return b.addEventListener("focusout", T), b.addEventListener("pointerdown", L), C.addEventListener("focusout", T), () => {
1270
+ b.removeEventListener("focusout", T), b.removeEventListener("pointerdown", L), C.removeEventListener("focusout", T);
1271
+ };
1272
+ }, [r, b, C, R, c, m, q, O, g, d, l, U, M]), p.useEffect(() => {
1273
+ var L;
1274
+ if (r) return;
1275
+ const T = Array.from((O == null || (L = O.portalNode) == null ? void 0 : L.querySelectorAll("[" + Ue("portal") + "]")) || []);
1276
+ if (C) {
1277
+ const S = [C, ...T, N.current, P.current, K.current.includes("reference") || M ? b : null].filter((H) => H != null), F = c || M ? Cn(S, $, !$) : Cn(S);
1278
+ return () => {
1279
+ F();
1280
+ };
1281
+ }
1282
+ }, [r, b, C, c, K, O, M, $]), Q(() => {
1283
+ if (r || !Re(R)) return;
1284
+ const L = pe(R), T = Se(L);
1285
+ queueMicrotask(() => {
1286
+ const S = te(R), F = Z.current, H = (typeof F == "number" ? S[F] : F.current) || R, ee = ce(R, T);
1287
+ !A && !ee && h && ke(H, {
1288
+ preventScroll: H === R
1289
+ });
1290
+ });
1291
+ }, [r, h, R, A, te, Z]), Q(() => {
1292
+ if (r || !R) return;
1293
+ let L = !1;
1294
+ const T = pe(R), S = Se(T);
1295
+ let H = x.current.openEvent;
1296
+ const ee = u.domReference.current;
1297
+ _t(S);
1298
+ function ne(Y) {
1299
+ let {
1300
+ open: we,
1301
+ reason: Ee,
1302
+ event: J,
1303
+ nested: Ie
1304
+ } = Y;
1305
+ we && (H = J), Ee === "escape-key" && u.domReference.current && _t(u.domReference.current), Ee === "hover" && J.type === "mouseleave" && (w.current = !0), Ee === "outside-press" && (Ie ? (w.current = !1, L = !0) : w.current = !(Yn(J) || Zn(J)));
1306
+ }
1307
+ return E.on("openchange", ne), () => {
1308
+ E.off("openchange", ne);
1309
+ const Y = Se(T), we = ce(C, Y) || q && je(q.nodesRef.current, m).some((he) => {
1310
+ var Ae;
1311
+ return ce((Ae = he.context) == null ? void 0 : Ae.elements.floating, Y);
1312
+ });
1313
+ (we || H && ["click", "mousedown"].includes(H.type)) && u.domReference.current && _t(u.domReference.current);
1314
+ const J = ee || S, Ie = tt(pe(J).body, Xe());
1315
+ queueMicrotask(() => {
1316
+ let he = Sn();
1317
+ !he && Re(J) && C && (he = as(Ie, J, C)), // eslint-disable-next-line react-hooks/exhaustive-deps
1318
+ G.current && !w.current && Re(he) && // If the focus moved somewhere else after mount, avoid returning focus
1319
+ // since it likely entered a different element which should be
1320
+ // respected: https://github.com/floating-ui/floating-ui/issues/2607
1321
+ (!(he !== Y && Y !== T.body) || we) && he.focus({
1322
+ preventScroll: L
1323
+ });
1324
+ });
1325
+ };
1326
+ }, [r, C, R, G, x, u, E, q, m]), Q(() => {
1327
+ if (!r && O)
1328
+ return O.setFocusManagerState({
1329
+ modal: c,
1330
+ closeOnFocusOut: d,
1331
+ open: h,
1332
+ onOpenChange: g,
1333
+ refs: u
1334
+ }), () => {
1335
+ O.setFocusManagerState(null);
1336
+ };
1337
+ }, [r, O, c, h, g, u, d]), Q(() => {
1338
+ if (r || !R || typeof MutationObserver != "function" || A) return;
1339
+ const L = () => {
1340
+ const S = R.getAttribute("tabindex"), F = U(), H = Se(pe(C)), ee = F.indexOf(H);
1341
+ ee !== -1 && (B.current = ee), K.current.includes("floating") || H !== u.domReference.current && F.length === 0 ? S !== "0" && R.setAttribute("tabindex", "0") : S !== "-1" && R.setAttribute("tabindex", "-1");
1342
+ };
1343
+ L();
1344
+ const T = new MutationObserver(L);
1345
+ return T.observe(R, {
1346
+ childList: !0,
1347
+ subtree: !0,
1348
+ attributes: !0
1349
+ }), () => {
1350
+ T.disconnect();
1351
+ };
1352
+ }, [r, C, R, u, K, U, A]);
1353
+ function ve(L) {
1354
+ return r || !f || !c ? null : /* @__PURE__ */ p.createElement(ds, {
1355
+ ref: L === "start" ? N : P,
1356
+ onClick: (T) => g(!1, T.nativeEvent)
1357
+ }, typeof f == "string" ? f : "Dismiss");
1358
+ }
1359
+ const fe = !r && $ && (c ? !M : !0) && (k || c);
1360
+ return /* @__PURE__ */ p.createElement(p.Fragment, null, fe && /* @__PURE__ */ p.createElement(gt, {
1361
+ "data-type": "inside",
1362
+ ref: O?.beforeInsideRef,
1363
+ onFocus: (L) => {
1364
+ if (c) {
1365
+ const S = te();
1366
+ ke(o[0] === "reference" ? S[0] : S[S.length - 1]);
1367
+ } else if (O != null && O.preserveTabOrder && O.portalNode)
1368
+ if (w.current = !1, et(L, O.portalNode)) {
1369
+ const S = lr() || b;
1370
+ S?.focus();
1371
+ } else {
1372
+ var T;
1373
+ (T = O.beforeOutsideRef.current) == null || T.focus();
1374
+ }
1375
+ }
1376
+ }), !M && ve("start"), t, ve("end"), fe && /* @__PURE__ */ p.createElement(gt, {
1377
+ "data-type": "inside",
1378
+ ref: O?.afterInsideRef,
1379
+ onFocus: (L) => {
1380
+ if (c)
1381
+ ke(te()[0]);
1382
+ else if (O != null && O.preserveTabOrder && O.portalNode)
1383
+ if (d && (w.current = !0), et(L, O.portalNode)) {
1384
+ const S = cr() || b;
1385
+ S?.focus();
1386
+ } else {
1387
+ var T;
1388
+ (T = O.afterOutsideRef.current) == null || T.focus();
1389
+ }
1390
+ }
1391
+ }));
1392
+ }
1393
+ const hs = {
1394
+ pointerdown: "onPointerDown",
1395
+ mousedown: "onMouseDown",
1396
+ click: "onClick"
1397
+ }, ms = {
1398
+ pointerdown: "onPointerDownCapture",
1399
+ mousedown: "onMouseDownCapture",
1400
+ click: "onClickCapture"
1401
+ }, On = (e) => {
1402
+ var n, t;
1403
+ return {
1404
+ escapeKey: typeof e == "boolean" ? e : (n = e?.escapeKey) != null ? n : !1,
1405
+ outsidePress: typeof e == "boolean" ? e : (t = e?.outsidePress) != null ? t : !0
1406
+ };
1407
+ };
1408
+ function ps(e, n) {
1409
+ n === void 0 && (n = {});
1410
+ const {
1411
+ open: t,
1412
+ onOpenChange: r,
1413
+ elements: o,
1414
+ dataRef: s
1415
+ } = e, {
1416
+ enabled: i = !0,
1417
+ escapeKey: a = !0,
1418
+ outsidePress: l = !0,
1419
+ outsidePressEvent: c = "pointerdown",
1420
+ referencePress: f = !1,
1421
+ referencePressEvent: d = "pointerdown",
1422
+ ancestorScroll: h = !1,
1423
+ bubbles: u,
1424
+ capture: m
1425
+ } = n, g = Ct(), E = xe(typeof l == "function" ? l : () => !1), x = typeof l == "function" ? E : l, v = p.useRef(!1), b = p.useRef(!1), {
1426
+ escapeKey: C,
1427
+ outsidePress: A
1428
+ } = On(u), {
1429
+ escapeKey: M,
1430
+ outsidePress: $
1431
+ } = On(m), K = xe((P) => {
1432
+ var w;
1433
+ if (!t || !i || !a || P.key !== "Escape")
1434
+ return;
1435
+ const D = (w = s.current.floatingContext) == null ? void 0 : w.nodeId, B = g ? je(g.nodesRef.current, D) : [];
1436
+ if (!C && (P.stopPropagation(), B.length > 0)) {
1437
+ let k = !0;
1438
+ if (B.forEach((R) => {
1439
+ var U;
1440
+ if ((U = R.context) != null && U.open && !R.context.dataRef.current.__escapeKeyBubbles) {
1441
+ k = !1;
1442
+ return;
1443
+ }
1444
+ }), !k)
1445
+ return;
1446
+ }
1447
+ r(!1, po(P) ? P.nativeEvent : P, "escape-key");
1448
+ }), Z = xe((P) => {
1449
+ var w;
1450
+ const D = () => {
1451
+ var B;
1452
+ K(P), (B = _e(P)) == null || B.removeEventListener("keydown", D);
1453
+ };
1454
+ (w = _e(P)) == null || w.addEventListener("keydown", D);
1455
+ }), G = xe((P) => {
1456
+ var w;
1457
+ const D = v.current;
1458
+ v.current = !1;
1459
+ const B = b.current;
1460
+ if (b.current = !1, c === "click" && B || D || typeof x == "function" && !x(P))
1461
+ return;
1462
+ const k = _e(P), R = "[" + Ue("inert") + "]", U = pe(o.floating).querySelectorAll(R);
1463
+ let te = be(k) ? k : null;
1464
+ for (; te && !hn(te); ) {
1465
+ const T = fo(te);
1466
+ if (hn(T) || !be(T))
1467
+ break;
1468
+ te = T;
1469
+ }
1470
+ if (U.length && be(k) && !bo(k) && // Clicked on a direct ancestor (e.g. FloatingOverlay).
1471
+ !ce(k, o.floating) && // If the target root element contains none of the markers, then the
1472
+ // element was injected after the floating element rendered.
1473
+ Array.from(U).every((T) => !ce(te, T)))
1474
+ return;
1475
+ if (Re(k) && N) {
1476
+ const T = k.clientWidth > 0 && k.scrollWidth > k.clientWidth, S = k.clientHeight > 0 && k.scrollHeight > k.clientHeight;
1477
+ let F = S && P.offsetX > k.clientWidth;
1478
+ if (S && uo(k).direction === "rtl" && (F = P.offsetX <= k.offsetWidth - k.clientWidth), F || T && P.offsetY > k.clientHeight)
1479
+ return;
1480
+ }
1481
+ const ve = (w = s.current.floatingContext) == null ? void 0 : w.nodeId, fe = g && je(g.nodesRef.current, ve).some((T) => {
1482
+ var S;
1483
+ return Nt(P, (S = T.context) == null ? void 0 : S.elements.floating);
1484
+ });
1485
+ if (Nt(P, o.floating) || Nt(P, o.domReference) || fe)
1486
+ return;
1487
+ const L = g ? je(g.nodesRef.current, ve) : [];
1488
+ if (L.length > 0) {
1489
+ let T = !0;
1490
+ if (L.forEach((S) => {
1491
+ var F;
1492
+ if ((F = S.context) != null && F.open && !S.context.dataRef.current.__outsidePressBubbles) {
1493
+ T = !1;
1494
+ return;
1495
+ }
1496
+ }), !T)
1497
+ return;
1498
+ }
1499
+ r(!1, P, "outside-press");
1500
+ }), q = xe((P) => {
1501
+ var w;
1502
+ const D = () => {
1503
+ var B;
1504
+ G(P), (B = _e(P)) == null || B.removeEventListener(c, D);
1505
+ };
1506
+ (w = _e(P)) == null || w.addEventListener(c, D);
1507
+ });
1508
+ p.useEffect(() => {
1509
+ if (!t || !i)
1510
+ return;
1511
+ s.current.__escapeKeyBubbles = C, s.current.__outsidePressBubbles = A;
1512
+ function P(B) {
1513
+ r(!1, B, "ancestor-scroll");
1514
+ }
1515
+ const w = pe(o.floating);
1516
+ a && w.addEventListener("keydown", M ? Z : K, M), x && w.addEventListener(c, $ ? q : G, $);
1517
+ let D = [];
1518
+ return h && (be(o.domReference) && (D = Tt(o.domReference)), be(o.floating) && (D = D.concat(Tt(o.floating))), !be(o.reference) && o.reference && o.reference.contextElement && (D = D.concat(Tt(o.reference.contextElement)))), D = D.filter((B) => {
1519
+ var k;
1520
+ return B !== ((k = w.defaultView) == null ? void 0 : k.visualViewport);
1521
+ }), D.forEach((B) => {
1522
+ B.addEventListener("scroll", P, {
1523
+ passive: !0
1524
+ });
1525
+ }), () => {
1526
+ a && w.removeEventListener("keydown", M ? Z : K, M), x && w.removeEventListener(c, $ ? q : G, $), D.forEach((B) => {
1527
+ B.removeEventListener("scroll", P);
1528
+ });
1529
+ };
1530
+ }, [s, o, a, x, c, t, r, h, i, C, A, K, M, Z, G, $, q]), p.useEffect(() => {
1531
+ v.current = !1;
1532
+ }, [x, c]);
1533
+ const O = p.useMemo(() => ({
1534
+ onKeyDown: K,
1535
+ [hs[d]]: (P) => {
1536
+ f && r(!1, P.nativeEvent, "reference-press");
1537
+ }
1538
+ }), [K, r, f, d]), N = p.useMemo(() => ({
1539
+ onKeyDown: K,
1540
+ onMouseDown() {
1541
+ b.current = !0;
1542
+ },
1543
+ onMouseUp() {
1544
+ b.current = !0;
1545
+ },
1546
+ [ms[c]]: () => {
1547
+ v.current = !0;
1548
+ }
1549
+ }), [K, c]);
1550
+ return p.useMemo(() => i ? {
1551
+ reference: O,
1552
+ floating: N
1553
+ } : {}, [i, O, N]);
1554
+ }
1555
+ function bs(e) {
1556
+ const {
1557
+ open: n = !1,
1558
+ onOpenChange: t,
1559
+ elements: r
1560
+ } = e, o = Zt(), s = p.useRef({}), [i] = p.useState(() => Jo()), a = Jt() != null;
1561
+ if (process.env.NODE_ENV !== "production") {
1562
+ const u = r.reference;
1563
+ u && !be(u) && Zo("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `refs.setPositionReference()`", "instead.");
1564
+ }
1565
+ const [l, c] = p.useState(r.reference), f = xe((u, m, g) => {
1566
+ s.current.openEvent = u ? m : void 0, i.emit("openchange", {
1567
+ open: u,
1568
+ event: m,
1569
+ reason: g,
1570
+ nested: a
1571
+ }), t?.(u, m, g);
1572
+ }), d = p.useMemo(() => ({
1573
+ setPositionReference: c
1574
+ }), []), h = p.useMemo(() => ({
1575
+ reference: l || r.reference || null,
1576
+ floating: r.floating || null,
1577
+ domReference: r.reference
1578
+ }), [l, r.reference, r.floating]);
1579
+ return p.useMemo(() => ({
1580
+ dataRef: s,
1581
+ open: n,
1582
+ onOpenChange: f,
1583
+ elements: h,
1584
+ events: i,
1585
+ floatingId: o,
1586
+ refs: d
1587
+ }), [n, f, h, i, o, d]);
1588
+ }
1589
+ function gs(e) {
1590
+ e === void 0 && (e = {});
1591
+ const {
1592
+ nodeId: n
1593
+ } = e, t = bs({
1594
+ ...e,
1595
+ elements: {
1596
+ reference: null,
1597
+ floating: null,
1598
+ ...e.elements
1599
+ }
1600
+ }), r = e.rootContext || t, o = r.elements, [s, i] = p.useState(null), [a, l] = p.useState(null), f = o?.reference || s, d = p.useRef(null), h = Ct();
1601
+ Q(() => {
1602
+ f && (d.current = f);
1603
+ }, [f]);
1604
+ const u = zo({
1605
+ ...e,
1606
+ elements: {
1607
+ ...o,
1608
+ ...a && {
1609
+ reference: a
1610
+ }
1611
+ }
1612
+ }), m = p.useCallback((b) => {
1613
+ const C = be(b) ? {
1614
+ getBoundingClientRect: () => b.getBoundingClientRect(),
1615
+ contextElement: b
1616
+ } : b;
1617
+ l(C), u.refs.setReference(C);
1618
+ }, [u.refs]), g = p.useCallback((b) => {
1619
+ (be(b) || b === null) && (d.current = b, i(b)), (be(u.refs.reference.current) || u.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
1620
+ // `null` to support `positionReference` + an unstable `reference`
1621
+ // callback ref.
1622
+ b !== null && !be(b)) && u.refs.setReference(b);
1623
+ }, [u.refs]), E = p.useMemo(() => ({
1624
+ ...u.refs,
1625
+ setReference: g,
1626
+ setPositionReference: m,
1627
+ domReference: d
1628
+ }), [u.refs, g, m]), x = p.useMemo(() => ({
1629
+ ...u.elements,
1630
+ domReference: f
1631
+ }), [u.elements, f]), v = p.useMemo(() => ({
1632
+ ...u,
1633
+ ...r,
1634
+ refs: E,
1635
+ elements: x,
1636
+ nodeId: n
1637
+ }), [u, E, x, n, r]);
1638
+ return Q(() => {
1639
+ r.dataRef.current.floatingContext = v;
1640
+ const b = h?.nodesRef.current.find((C) => C.id === n);
1641
+ b && (b.context = v);
1642
+ }), p.useMemo(() => ({
1643
+ ...u,
1644
+ context: v,
1645
+ refs: E,
1646
+ elements: x
1647
+ }), [u, E, x, v]);
1648
+ }
1649
+ const Tn = "active", kn = "selected";
1650
+ function Lt(e, n, t) {
1651
+ const r = /* @__PURE__ */ new Map(), o = t === "item";
1652
+ let s = e;
1653
+ if (o && e) {
1654
+ const {
1655
+ [Tn]: i,
1656
+ [kn]: a,
1657
+ ...l
1658
+ } = e;
1659
+ s = l;
1660
+ }
1661
+ return {
1662
+ ...t === "floating" && {
1663
+ tabIndex: -1,
1664
+ [Wt]: ""
1665
+ },
1666
+ ...s,
1667
+ ...n.map((i) => {
1668
+ const a = i ? i[t] : null;
1669
+ return typeof a == "function" ? e ? a(e) : null : a;
1670
+ }).concat(e).reduce((i, a) => (a && Object.entries(a).forEach((l) => {
1671
+ let [c, f] = l;
1672
+ if (!(o && [Tn, kn].includes(c)))
1673
+ if (c.indexOf("on") === 0) {
1674
+ if (r.has(c) || r.set(c, []), typeof f == "function") {
1675
+ var d;
1676
+ (d = r.get(c)) == null || d.push(f), i[c] = function() {
1677
+ for (var h, u = arguments.length, m = new Array(u), g = 0; g < u; g++)
1678
+ m[g] = arguments[g];
1679
+ return (h = r.get(c)) == null ? void 0 : h.map((E) => E(...m)).find((E) => E !== void 0);
1680
+ };
1681
+ }
1682
+ } else
1683
+ i[c] = f;
1684
+ }), i), {})
1685
+ };
1686
+ }
1687
+ function vs(e) {
1688
+ e === void 0 && (e = []);
1689
+ const n = e.map((a) => a?.reference), t = e.map((a) => a?.floating), r = e.map((a) => a?.item), o = p.useCallback(
1690
+ (a) => Lt(a, e, "reference"),
1691
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1692
+ n
1693
+ ), s = p.useCallback(
1694
+ (a) => Lt(a, e, "floating"),
1695
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1696
+ t
1697
+ ), i = p.useCallback(
1698
+ (a) => Lt(a, e, "item"),
1699
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1700
+ r
1701
+ );
1702
+ return p.useMemo(() => ({
1703
+ getReferenceProps: o,
1704
+ getFloatingProps: s,
1705
+ getItemProps: i
1706
+ }), [o, s, i]);
1707
+ }
1708
+ let Mn = !1;
1709
+ function Et(e, n, t) {
1710
+ switch (e) {
1711
+ case "vertical":
1712
+ return n;
1713
+ case "horizontal":
1714
+ return t;
1715
+ default:
1716
+ return n || t;
1717
+ }
1718
+ }
1719
+ function Nn(e, n) {
1720
+ return Et(n, e === Yt || e === ot, e === He || e === Ye);
1721
+ }
1722
+ function zt(e, n, t) {
1723
+ return Et(n, e === ot, t ? e === He : e === Ye) || e === "Enter" || e === " " || e === "";
1724
+ }
1725
+ function ys(e, n, t) {
1726
+ return Et(n, t ? e === He : e === Ye, e === ot);
1727
+ }
1728
+ function Pn(e, n, t) {
1729
+ return Et(n, t ? e === Ye : e === He, e === Yt);
1730
+ }
1731
+ function xs(e, n) {
1732
+ const {
1733
+ open: t,
1734
+ onOpenChange: r,
1735
+ elements: o
1736
+ } = e, {
1737
+ listRef: s,
1738
+ activeIndex: i,
1739
+ onNavigate: a = () => {
1740
+ },
1741
+ enabled: l = !0,
1742
+ selectedIndex: c = null,
1743
+ allowEscape: f = !1,
1744
+ loop: d = !1,
1745
+ nested: h = !1,
1746
+ rtl: u = !1,
1747
+ virtual: m = !1,
1748
+ focusItemOnOpen: g = "auto",
1749
+ focusItemOnHover: E = !0,
1750
+ openOnArrowKeyDown: x = !0,
1751
+ disabledIndices: v = void 0,
1752
+ orientation: b = "vertical",
1753
+ cols: C = 1,
1754
+ scrollItemIntoView: A = !0,
1755
+ virtualItemRef: M,
1756
+ itemSizes: $,
1757
+ dense: K = !1
1758
+ } = n;
1759
+ process.env.NODE_ENV !== "production" && (f && (d || At("`useListNavigation` looping must be enabled to allow escaping."), m || At("`useListNavigation` must be virtual to allow escaping.")), b === "vertical" && C > 1 && At("In grid list navigation mode (`cols` > 1), the `orientation` should", 'be either "horizontal" or "both".'));
1760
+ const Z = fr(o.floating), G = Me(Z), q = Jt(), O = Ct(), N = xe(a), P = p.useRef(g), w = p.useRef(c ?? -1), D = p.useRef(null), B = p.useRef(!0), k = p.useRef(N), R = p.useRef(!!o.floating), U = p.useRef(t), te = p.useRef(!1), ve = p.useRef(!1), fe = Me(v), L = Me(t), T = Me(A), S = Me(c), [F, H] = p.useState(), [ee, ne] = p.useState(), Y = xe(function(_, z, I) {
1761
+ I === void 0 && (I = !1);
1762
+ function W(j) {
1763
+ m ? (H(j.id), O?.events.emit("virtualfocus", j), M && (M.current = j)) : ke(j, {
1764
+ preventScroll: !0,
1765
+ // Mac Safari does not move the virtual cursor unless the focus call
1766
+ // is sync. However, for the very first focus call, we need to wait
1767
+ // for the position to be ready in order to prevent unwanted
1768
+ // scrolling. This means the virtual cursor will not move to the first
1769
+ // item when first opening the floating element, but will on
1770
+ // subsequent calls. `preventScroll` is supported in modern Safari,
1771
+ // so we can use that instead.
1772
+ // iOS Safari must be async or the first item will not be focused.
1773
+ sync: ho() && Jn() ? Mn || te.current : !1
1774
+ });
1775
+ }
1776
+ const ie = _.current[z.current];
1777
+ ie && W(ie), requestAnimationFrame(() => {
1778
+ const j = _.current[z.current] || ie;
1779
+ if (!j) return;
1780
+ ie || W(j);
1781
+ const re = T.current;
1782
+ re && Ee && (I || !B.current) && (j.scrollIntoView == null || j.scrollIntoView(typeof re == "boolean" ? {
1783
+ block: "nearest",
1784
+ inline: "nearest"
1785
+ } : re));
1786
+ });
1787
+ });
1788
+ Q(() => {
1789
+ document.createElement("div").focus({
1790
+ get preventScroll() {
1791
+ return Mn = !0, !1;
1792
+ }
1793
+ });
1794
+ }, []), Q(() => {
1795
+ l && (t && o.floating ? P.current && c != null && (ve.current = !0, w.current = c, N(c)) : R.current && (w.current = -1, k.current(null)));
1796
+ }, [l, t, o.floating, c, N]), Q(() => {
1797
+ if (l && t && o.floating)
1798
+ if (i == null) {
1799
+ if (te.current = !1, S.current != null)
1800
+ return;
1801
+ if (R.current && (w.current = -1, Y(s, w)), (!U.current || !R.current) && P.current && (D.current != null || P.current === !0 && D.current == null)) {
1802
+ let _ = 0;
1803
+ const z = () => {
1804
+ s.current[0] == null ? (_ < 2 && (_ ? requestAnimationFrame : queueMicrotask)(z), _++) : (w.current = D.current == null || zt(D.current, b, u) || h ? Dt(s, fe.current) : gn(s, fe.current), D.current = null, N(w.current));
1805
+ };
1806
+ z();
1807
+ }
1808
+ } else Qe(s, i) || (w.current = i, Y(s, w, ve.current), ve.current = !1);
1809
+ }, [l, t, o.floating, i, S, h, s, b, u, N, Y, fe]), Q(() => {
1810
+ var _;
1811
+ if (!l || o.floating || !O || m || !R.current)
1812
+ return;
1813
+ const z = O.nodesRef.current, I = (_ = z.find((j) => j.id === q)) == null || (_ = _.context) == null ? void 0 : _.elements.floating, W = Se(pe(o.floating)), ie = z.some((j) => j.context && ce(j.context.elements.floating, W));
1814
+ I && !ie && B.current && I.focus({
1815
+ preventScroll: !0
1816
+ });
1817
+ }, [l, o.floating, O, q, m]), Q(() => {
1818
+ if (!l || !O || !m || q) return;
1819
+ function _(z) {
1820
+ ne(z.id), M && (M.current = z);
1821
+ }
1822
+ return O.events.on("virtualfocus", _), () => {
1823
+ O.events.off("virtualfocus", _);
1824
+ };
1825
+ }, [l, O, m, q, M]), Q(() => {
1826
+ k.current = N, R.current = !!o.floating;
1827
+ }), Q(() => {
1828
+ t || (D.current = null);
1829
+ }, [t]), Q(() => {
1830
+ U.current = t;
1831
+ }, [t]);
1832
+ const we = i != null, Ee = p.useMemo(() => {
1833
+ function _(I) {
1834
+ if (!t) return;
1835
+ const W = s.current.indexOf(I);
1836
+ W !== -1 && N(W);
1837
+ }
1838
+ return {
1839
+ onFocus(I) {
1840
+ let {
1841
+ currentTarget: W
1842
+ } = I;
1843
+ _(W);
1844
+ },
1845
+ onClick: (I) => {
1846
+ let {
1847
+ currentTarget: W
1848
+ } = I;
1849
+ return W.focus({
1850
+ preventScroll: !0
1851
+ });
1852
+ },
1853
+ // Safari
1854
+ ...E && {
1855
+ onMouseMove(I) {
1856
+ let {
1857
+ currentTarget: W
1858
+ } = I;
1859
+ _(W);
1860
+ },
1861
+ onPointerLeave(I) {
1862
+ let {
1863
+ pointerType: W
1864
+ } = I;
1865
+ !B.current || W === "touch" || (w.current = -1, Y(s, w), N(null), m || ke(G.current, {
1866
+ preventScroll: !0
1867
+ }));
1868
+ }
1869
+ }
1870
+ };
1871
+ }, [t, G, Y, E, s, N, m]), J = xe((_) => {
1872
+ if (B.current = !1, te.current = !0, !L.current && _.currentTarget === G.current)
1873
+ return;
1874
+ if (h && Pn(_.key, b, u)) {
1875
+ ue(_), r(!1, _.nativeEvent, "list-navigation"), Re(o.domReference) && !m && o.domReference.focus();
1876
+ return;
1877
+ }
1878
+ const z = w.current, I = Dt(s, v), W = gn(s, v);
1879
+ if (_.key === "Home" && (ue(_), w.current = I, N(w.current)), _.key === "End" && (ue(_), w.current = W, N(w.current)), C > 1) {
1880
+ const ie = $ || Array.from({
1881
+ length: s.current.length
1882
+ }, () => ({
1883
+ width: 1,
1884
+ height: 1
1885
+ })), j = qo(ie, C, K), re = j.findIndex((ye) => ye != null && !dt(s.current, ye, v)), Be = j.reduce((ye, Oe, st) => Oe != null && !dt(s.current, Oe, v) ? st : ye, -1), Ze = j[Wo({
1886
+ current: j.map((ye) => ye != null ? s.current[ye] : null)
1887
+ }, {
1888
+ event: _,
1889
+ orientation: b,
1890
+ loop: d,
1891
+ cols: C,
1892
+ // treat undefined (empty grid spaces) as disabled indices so we
1893
+ // don't end up in them
1894
+ disabledIndices: Uo([...v || s.current.map((ye, Oe) => dt(s.current, Oe) ? Oe : void 0), void 0], j),
1895
+ minIndex: re,
1896
+ maxIndex: Be,
1897
+ prevIndex: Ho(
1898
+ w.current > W ? I : w.current,
1899
+ ie,
1900
+ j,
1901
+ C,
1902
+ // use a corner matching the edge closest to the direction
1903
+ // we're moving in so we don't end up in the same item. Prefer
1904
+ // top/left over bottom/right.
1905
+ _.key === ot ? "bl" : _.key === Ye ? "tr" : "tl"
1906
+ ),
1907
+ stopEvent: !0
1908
+ })];
1909
+ if (Ze != null && (w.current = Ze, N(w.current)), b === "both")
1910
+ return;
1911
+ }
1912
+ if (Nn(_.key, b)) {
1913
+ if (ue(_), t && !m && Se(_.currentTarget.ownerDocument) === _.currentTarget) {
1914
+ w.current = zt(_.key, b, u) ? I : W, N(w.current);
1915
+ return;
1916
+ }
1917
+ zt(_.key, b, u) ? d ? w.current = z >= W ? f && z !== s.current.length ? -1 : I : ae(s, {
1918
+ startingIndex: z,
1919
+ disabledIndices: v
1920
+ }) : w.current = Math.min(W, ae(s, {
1921
+ startingIndex: z,
1922
+ disabledIndices: v
1923
+ })) : d ? w.current = z <= I ? f && z !== -1 ? s.current.length : W : ae(s, {
1924
+ startingIndex: z,
1925
+ decrement: !0,
1926
+ disabledIndices: v
1927
+ }) : w.current = Math.max(I, ae(s, {
1928
+ startingIndex: z,
1929
+ decrement: !0,
1930
+ disabledIndices: v
1931
+ })), Qe(s, w.current) ? N(null) : N(w.current);
1932
+ }
1933
+ }), Ie = p.useMemo(() => m && t && we && {
1934
+ "aria-activedescendant": ee || F
1935
+ }, [m, t, we, ee, F]), he = p.useMemo(() => ({
1936
+ "aria-orientation": b === "both" ? void 0 : b,
1937
+ ...!Qn(o.domReference) && Ie,
1938
+ onKeyDown: J,
1939
+ onPointerMove() {
1940
+ B.current = !0;
1941
+ }
1942
+ }), [Ie, J, o.domReference, b]), Ae = p.useMemo(() => {
1943
+ function _(I) {
1944
+ g === "auto" && Yn(I.nativeEvent) && (P.current = !0);
1945
+ }
1946
+ function z(I) {
1947
+ P.current = g, g === "auto" && Zn(I.nativeEvent) && (P.current = !0);
1948
+ }
1949
+ return {
1950
+ ...Ie,
1951
+ onKeyDown(I) {
1952
+ B.current = !1;
1953
+ const W = I.key.indexOf("Arrow") === 0, ie = ys(I.key, b, u), j = Pn(I.key, b, u), re = Nn(I.key, b), Be = (h ? ie : re) || I.key === "Enter" || I.key.trim() === "";
1954
+ if (m && t) {
1955
+ const st = O?.nodesRef.current.find((it) => it.parentId == null), Te = O && st ? ns(O.nodesRef.current, st.id) : null;
1956
+ if (W && Te && M) {
1957
+ const it = new KeyboardEvent("keydown", {
1958
+ key: I.key,
1959
+ bubbles: !0
1960
+ });
1961
+ if (ie || j) {
1962
+ var Ze, ye;
1963
+ const Fr = ((Ze = Te.context) == null ? void 0 : Ze.elements.domReference) === I.currentTarget, cn = j && !Fr ? (ye = Te.context) == null ? void 0 : ye.elements.domReference : ie ? s.current.find((un) => un?.id === F) : null;
1964
+ cn && (ue(I), cn.dispatchEvent(it), ne(void 0));
1965
+ }
1966
+ if (re && Te.context && Te.context.open && Te.parentId && I.currentTarget !== Te.context.elements.domReference) {
1967
+ var Oe;
1968
+ ue(I), (Oe = Te.context.elements.domReference) == null || Oe.dispatchEvent(it);
1969
+ return;
1970
+ }
1971
+ }
1972
+ return J(I);
1973
+ }
1974
+ if (!(!t && !x && W)) {
1975
+ if (Be && (D.current = h && re ? null : I.key), h) {
1976
+ ie && (ue(I), t ? (w.current = Dt(s, fe.current), N(w.current)) : r(!0, I.nativeEvent, "list-navigation"));
1977
+ return;
1978
+ }
1979
+ re && (c != null && (w.current = c), ue(I), !t && x ? r(!0, I.nativeEvent, "list-navigation") : J(I), t && N(w.current));
1980
+ }
1981
+ },
1982
+ onFocus() {
1983
+ t && !m && N(null);
1984
+ },
1985
+ onPointerDown: z,
1986
+ onMouseDown: _,
1987
+ onClick: _
1988
+ };
1989
+ }, [F, Ie, J, fe, g, s, h, N, r, t, x, b, u, c, O, m, M]);
1990
+ return p.useMemo(() => l ? {
1991
+ reference: Ae,
1992
+ floating: he,
1993
+ item: Ee
1994
+ } : {}, [l, Ae, he, Ee]);
1995
+ }
1996
+ const Cs = /* @__PURE__ */ new Map([["select", "listbox"], ["combobox", "listbox"], ["label", !1]]);
1997
+ function Es(e, n) {
1998
+ var t;
1999
+ n === void 0 && (n = {});
2000
+ const {
2001
+ open: r,
2002
+ floatingId: o
2003
+ } = e, {
2004
+ enabled: s = !0,
2005
+ role: i = "dialog"
2006
+ } = n, a = (t = Cs.get(i)) != null ? t : i, l = Zt(), f = Jt() != null, d = p.useMemo(() => a === "tooltip" || i === "label" ? {
2007
+ ["aria-" + (i === "label" ? "labelledby" : "describedby")]: r ? o : void 0
2008
+ } : {
2009
+ "aria-expanded": r ? "true" : "false",
2010
+ "aria-haspopup": a === "alertdialog" ? "dialog" : a,
2011
+ "aria-controls": r ? o : void 0,
2012
+ ...a === "listbox" && {
2013
+ role: "combobox"
2014
+ },
2015
+ ...a === "menu" && {
2016
+ id: l
2017
+ },
2018
+ ...a === "menu" && f && {
2019
+ role: "menuitem"
2020
+ },
2021
+ ...i === "select" && {
2022
+ "aria-autocomplete": "none"
2023
+ },
2024
+ ...i === "combobox" && {
2025
+ "aria-autocomplete": "list"
2026
+ }
2027
+ }, [a, o, f, r, l, i]), h = p.useMemo(() => {
2028
+ const m = {
2029
+ id: o,
2030
+ ...a && {
2031
+ role: a
2032
+ }
2033
+ };
2034
+ return a === "tooltip" || i === "label" ? m : {
2035
+ ...m,
2036
+ ...a === "menu" && {
2037
+ "aria-labelledby": l
2038
+ }
2039
+ };
2040
+ }, [a, o, l, i]), u = p.useCallback((m) => {
2041
+ let {
2042
+ active: g,
2043
+ selected: E
2044
+ } = m;
2045
+ const x = {
2046
+ role: "option",
2047
+ ...g && {
2048
+ id: o + "-option"
2049
+ }
2050
+ };
2051
+ switch (i) {
2052
+ case "select":
2053
+ return {
2054
+ ...x,
2055
+ "aria-selected": g && E
2056
+ };
2057
+ case "combobox":
2058
+ return {
2059
+ ...x,
2060
+ ...g && {
2061
+ "aria-selected": !0
2062
+ }
2063
+ };
2064
+ }
2065
+ return {};
2066
+ }, [o, i]);
2067
+ return p.useMemo(() => s ? {
2068
+ reference: d,
2069
+ floating: h,
2070
+ item: u
2071
+ } : {}, [s, d, h, u]);
2072
+ }
2073
+ function Ke(e, n, t) {
2074
+ let r = t.initialDeps ?? [], o, s = !0;
2075
+ function i() {
2076
+ var a, l, c;
2077
+ let f;
2078
+ t.key && ((a = t.debug) != null && a.call(t)) && (f = Date.now());
2079
+ const d = e();
2080
+ if (!(d.length !== r.length || d.some((m, g) => r[g] !== m)))
2081
+ return o;
2082
+ r = d;
2083
+ let u;
2084
+ if (t.key && ((l = t.debug) != null && l.call(t)) && (u = Date.now()), o = n(...d), t.key && ((c = t.debug) != null && c.call(t))) {
2085
+ const m = Math.round((Date.now() - f) * 100) / 100, g = Math.round((Date.now() - u) * 100) / 100, E = g / 16, x = (v, b) => {
2086
+ for (v = String(v); v.length < b; )
2087
+ v = " " + v;
2088
+ return v;
2089
+ };
2090
+ console.info(
2091
+ `%c⏱ ${x(g, 5)} /${x(m, 5)} ms`,
2092
+ `
2093
+ font-size: .6rem;
2094
+ font-weight: bold;
2095
+ color: hsl(${Math.max(
2096
+ 0,
2097
+ Math.min(120 - 120 * E, 120)
2098
+ )}deg 100% 31%);`,
2099
+ t?.key
2100
+ );
2101
+ }
2102
+ return t?.onChange && !(s && t.skipInitialOnChange) && t.onChange(o), s = !1, o;
2103
+ }
2104
+ return i.updateDeps = (a) => {
2105
+ r = a;
2106
+ }, i;
2107
+ }
2108
+ function Dn(e, n) {
2109
+ if (e === void 0)
2110
+ throw new Error("Unexpected undefined");
2111
+ return e;
2112
+ }
2113
+ const ws = (e, n) => Math.abs(e - n) < 1.01, Is = (e, n, t) => {
2114
+ let r;
2115
+ return function(...o) {
2116
+ e.clearTimeout(r), r = e.setTimeout(() => n.apply(this, o), t);
2117
+ };
2118
+ }, An = (e) => {
2119
+ const { offsetWidth: n, offsetHeight: t } = e;
2120
+ return { width: n, height: t };
2121
+ }, Rs = (e) => e, Ss = (e) => {
2122
+ const n = Math.max(e.startIndex - e.overscan, 0), t = Math.min(e.endIndex + e.overscan, e.count - 1), r = [];
2123
+ for (let o = n; o <= t; o++)
2124
+ r.push(o);
2125
+ return r;
2126
+ }, Os = (e, n) => {
2127
+ const t = e.scrollElement;
2128
+ if (!t)
2129
+ return;
2130
+ const r = e.targetWindow;
2131
+ if (!r)
2132
+ return;
2133
+ const o = (i) => {
2134
+ const { width: a, height: l } = i;
2135
+ n({ width: Math.round(a), height: Math.round(l) });
2136
+ };
2137
+ if (o(An(t)), !r.ResizeObserver)
2138
+ return () => {
2139
+ };
2140
+ const s = new r.ResizeObserver((i) => {
2141
+ const a = () => {
2142
+ const l = i[0];
2143
+ if (l?.borderBoxSize) {
2144
+ const c = l.borderBoxSize[0];
2145
+ if (c) {
2146
+ o({ width: c.inlineSize, height: c.blockSize });
2147
+ return;
2148
+ }
2149
+ }
2150
+ o(An(t));
2151
+ };
2152
+ e.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(a) : a();
2153
+ });
2154
+ return s.observe(t, { box: "border-box" }), () => {
2155
+ s.unobserve(t);
2156
+ };
2157
+ }, Fn = {
2158
+ passive: !0
2159
+ }, _n = typeof window > "u" ? !0 : "onscrollend" in window, Ts = (e, n) => {
2160
+ const t = e.scrollElement;
2161
+ if (!t)
2162
+ return;
2163
+ const r = e.targetWindow;
2164
+ if (!r)
2165
+ return;
2166
+ let o = 0;
2167
+ const s = e.options.useScrollendEvent && _n ? () => {
2168
+ } : Is(
2169
+ r,
2170
+ () => {
2171
+ n(o, !1);
2172
+ },
2173
+ e.options.isScrollingResetDelay
2174
+ ), i = (f) => () => {
2175
+ const { horizontal: d, isRtl: h } = e.options;
2176
+ o = d ? t.scrollLeft * (h && -1 || 1) : t.scrollTop, s(), n(o, f);
2177
+ }, a = i(!0), l = i(!1);
2178
+ t.addEventListener("scroll", a, Fn);
2179
+ const c = e.options.useScrollendEvent && _n;
2180
+ return c && t.addEventListener("scrollend", l, Fn), () => {
2181
+ t.removeEventListener("scroll", a), c && t.removeEventListener("scrollend", l);
2182
+ };
2183
+ }, ks = (e, n, t) => {
2184
+ if (n?.borderBoxSize) {
2185
+ const r = n.borderBoxSize[0];
2186
+ if (r)
2187
+ return Math.round(
2188
+ r[t.options.horizontal ? "inlineSize" : "blockSize"]
2189
+ );
2190
+ }
2191
+ return e[t.options.horizontal ? "offsetWidth" : "offsetHeight"];
2192
+ }, Ms = (e, {
2193
+ adjustments: n = 0,
2194
+ behavior: t
2195
+ }, r) => {
2196
+ var o, s;
2197
+ const i = e + n;
2198
+ (s = (o = r.scrollElement) == null ? void 0 : o.scrollTo) == null || s.call(o, {
2199
+ [r.options.horizontal ? "left" : "top"]: i,
2200
+ behavior: t
2201
+ });
2202
+ };
2203
+ class Ns {
2204
+ constructor(n) {
2205
+ this.unsubs = [], this.scrollElement = null, this.targetWindow = null, this.isScrolling = !1, this.currentScrollToIndex = null, this.measurementsCache = [], this.itemSizeCache = /* @__PURE__ */ new Map(), this.laneAssignments = /* @__PURE__ */ new Map(), this.pendingMeasuredCacheIndexes = [], this.prevLanes = void 0, this.lanesChangedFlag = !1, this.lanesSettling = !1, this.scrollRect = null, this.scrollOffset = null, this.scrollDirection = null, this.scrollAdjustments = 0, this.elementsCache = /* @__PURE__ */ new Map(), this.observer = /* @__PURE__ */ (() => {
2206
+ let t = null;
2207
+ const r = () => t || (!this.targetWindow || !this.targetWindow.ResizeObserver ? null : t = new this.targetWindow.ResizeObserver((o) => {
2208
+ o.forEach((s) => {
2209
+ const i = () => {
2210
+ this._measureElement(s.target, s);
2211
+ };
2212
+ this.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(i) : i();
2213
+ });
2214
+ }));
2215
+ return {
2216
+ disconnect: () => {
2217
+ var o;
2218
+ (o = r()) == null || o.disconnect(), t = null;
2219
+ },
2220
+ observe: (o) => {
2221
+ var s;
2222
+ return (s = r()) == null ? void 0 : s.observe(o, { box: "border-box" });
2223
+ },
2224
+ unobserve: (o) => {
2225
+ var s;
2226
+ return (s = r()) == null ? void 0 : s.unobserve(o);
2227
+ }
2228
+ };
2229
+ })(), this.range = null, this.setOptions = (t) => {
2230
+ Object.entries(t).forEach(([r, o]) => {
2231
+ typeof o > "u" && delete t[r];
2232
+ }), this.options = {
2233
+ debug: !1,
2234
+ initialOffset: 0,
2235
+ overscan: 1,
2236
+ paddingStart: 0,
2237
+ paddingEnd: 0,
2238
+ scrollPaddingStart: 0,
2239
+ scrollPaddingEnd: 0,
2240
+ horizontal: !1,
2241
+ getItemKey: Rs,
2242
+ rangeExtractor: Ss,
2243
+ onChange: () => {
2244
+ },
2245
+ measureElement: ks,
2246
+ initialRect: { width: 0, height: 0 },
2247
+ scrollMargin: 0,
2248
+ gap: 0,
2249
+ indexAttribute: "data-index",
2250
+ initialMeasurementsCache: [],
2251
+ lanes: 1,
2252
+ isScrollingResetDelay: 150,
2253
+ enabled: !0,
2254
+ isRtl: !1,
2255
+ useScrollendEvent: !1,
2256
+ useAnimationFrameWithResizeObserver: !1,
2257
+ ...t
2258
+ };
2259
+ }, this.notify = (t) => {
2260
+ var r, o;
2261
+ (o = (r = this.options).onChange) == null || o.call(r, this, t);
2262
+ }, this.maybeNotify = Ke(
2263
+ () => (this.calculateRange(), [
2264
+ this.isScrolling,
2265
+ this.range ? this.range.startIndex : null,
2266
+ this.range ? this.range.endIndex : null
2267
+ ]),
2268
+ (t) => {
2269
+ this.notify(t);
2270
+ },
2271
+ {
2272
+ key: process.env.NODE_ENV !== "production" && "maybeNotify",
2273
+ debug: () => this.options.debug,
2274
+ initialDeps: [
2275
+ this.isScrolling,
2276
+ this.range ? this.range.startIndex : null,
2277
+ this.range ? this.range.endIndex : null
2278
+ ]
2279
+ }
2280
+ ), this.cleanup = () => {
2281
+ this.unsubs.filter(Boolean).forEach((t) => t()), this.unsubs = [], this.observer.disconnect(), this.scrollElement = null, this.targetWindow = null;
2282
+ }, this._didMount = () => () => {
2283
+ this.cleanup();
2284
+ }, this._willUpdate = () => {
2285
+ var t;
2286
+ const r = this.options.enabled ? this.options.getScrollElement() : null;
2287
+ if (this.scrollElement !== r) {
2288
+ if (this.cleanup(), !r) {
2289
+ this.maybeNotify();
2290
+ return;
2291
+ }
2292
+ this.scrollElement = r, this.scrollElement && "ownerDocument" in this.scrollElement ? this.targetWindow = this.scrollElement.ownerDocument.defaultView : this.targetWindow = ((t = this.scrollElement) == null ? void 0 : t.window) ?? null, this.elementsCache.forEach((o) => {
2293
+ this.observer.observe(o);
2294
+ }), this.unsubs.push(
2295
+ this.options.observeElementRect(this, (o) => {
2296
+ this.scrollRect = o, this.maybeNotify();
2297
+ })
2298
+ ), this.unsubs.push(
2299
+ this.options.observeElementOffset(this, (o, s) => {
2300
+ this.scrollAdjustments = 0, this.scrollDirection = s ? this.getScrollOffset() < o ? "forward" : "backward" : null, this.scrollOffset = o, this.isScrolling = s, this.maybeNotify();
2301
+ })
2302
+ ), this._scrollToOffset(this.getScrollOffset(), {
2303
+ adjustments: void 0,
2304
+ behavior: void 0
2305
+ });
2306
+ }
2307
+ }, 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, r) => {
2308
+ const o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
2309
+ for (let i = r - 1; i >= 0; i--) {
2310
+ const a = t[i];
2311
+ if (o.has(a.lane))
2312
+ continue;
2313
+ const l = s.get(
2314
+ a.lane
2315
+ );
2316
+ if (l == null || a.end > l.end ? s.set(a.lane, a) : a.end < l.end && o.set(a.lane, !0), o.size === this.options.lanes)
2317
+ break;
2318
+ }
2319
+ return s.size === this.options.lanes ? Array.from(s.values()).sort((i, a) => i.end === a.end ? i.index - a.index : i.end - a.end)[0] : void 0;
2320
+ }, this.getMeasurementOptions = Ke(
2321
+ () => [
2322
+ this.options.count,
2323
+ this.options.paddingStart,
2324
+ this.options.scrollMargin,
2325
+ this.options.getItemKey,
2326
+ this.options.enabled,
2327
+ this.options.lanes
2328
+ ],
2329
+ (t, r, o, s, i, a) => (this.prevLanes !== void 0 && this.prevLanes !== a && (this.lanesChangedFlag = !0), this.prevLanes = a, this.pendingMeasuredCacheIndexes = [], {
2330
+ count: t,
2331
+ paddingStart: r,
2332
+ scrollMargin: o,
2333
+ getItemKey: s,
2334
+ enabled: i,
2335
+ lanes: a
2336
+ }),
2337
+ {
2338
+ key: !1
2339
+ }
2340
+ ), this.getMeasurements = Ke(
2341
+ () => [this.getMeasurementOptions(), this.itemSizeCache],
2342
+ ({ count: t, paddingStart: r, scrollMargin: o, getItemKey: s, enabled: i, lanes: a }, l) => {
2343
+ if (!i)
2344
+ return this.measurementsCache = [], this.itemSizeCache.clear(), this.laneAssignments.clear(), [];
2345
+ if (this.laneAssignments.size > t)
2346
+ for (const h of this.laneAssignments.keys())
2347
+ h >= t && this.laneAssignments.delete(h);
2348
+ this.lanesChangedFlag && (this.lanesChangedFlag = !1, this.lanesSettling = !0, this.measurementsCache = [], this.itemSizeCache.clear(), this.laneAssignments.clear(), this.pendingMeasuredCacheIndexes = []), this.measurementsCache.length === 0 && !this.lanesSettling && (this.measurementsCache = this.options.initialMeasurementsCache, this.measurementsCache.forEach((h) => {
2349
+ this.itemSizeCache.set(h.key, h.size);
2350
+ }));
2351
+ const c = this.lanesSettling ? 0 : this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
2352
+ this.pendingMeasuredCacheIndexes = [], this.lanesSettling && this.measurementsCache.length === t && (this.lanesSettling = !1);
2353
+ const f = this.measurementsCache.slice(0, c), d = new Array(a).fill(
2354
+ void 0
2355
+ );
2356
+ for (let h = 0; h < c; h++) {
2357
+ const u = f[h];
2358
+ u && (d[u.lane] = h);
2359
+ }
2360
+ for (let h = c; h < t; h++) {
2361
+ const u = s(h), m = this.laneAssignments.get(h);
2362
+ let g, E;
2363
+ if (m !== void 0 && this.options.lanes > 1) {
2364
+ g = m;
2365
+ const C = d[g], A = C !== void 0 ? f[C] : void 0;
2366
+ E = A ? A.end + this.options.gap : r + o;
2367
+ } else {
2368
+ const C = this.options.lanes === 1 ? f[h - 1] : this.getFurthestMeasurement(f, h);
2369
+ E = C ? C.end + this.options.gap : r + o, g = C ? C.lane : h % this.options.lanes, this.options.lanes > 1 && this.laneAssignments.set(h, g);
2370
+ }
2371
+ const x = l.get(u), v = typeof x == "number" ? x : this.options.estimateSize(h), b = E + v;
2372
+ f[h] = {
2373
+ index: h,
2374
+ start: E,
2375
+ size: v,
2376
+ end: b,
2377
+ key: u,
2378
+ lane: g
2379
+ }, d[g] = h;
2380
+ }
2381
+ return this.measurementsCache = f, f;
2382
+ },
2383
+ {
2384
+ key: process.env.NODE_ENV !== "production" && "getMeasurements",
2385
+ debug: () => this.options.debug
2386
+ }
2387
+ ), this.calculateRange = Ke(
2388
+ () => [
2389
+ this.getMeasurements(),
2390
+ this.getSize(),
2391
+ this.getScrollOffset(),
2392
+ this.options.lanes
2393
+ ],
2394
+ (t, r, o, s) => this.range = t.length > 0 && r > 0 ? Ps({
2395
+ measurements: t,
2396
+ outerSize: r,
2397
+ scrollOffset: o,
2398
+ lanes: s
2399
+ }) : null,
2400
+ {
2401
+ key: process.env.NODE_ENV !== "production" && "calculateRange",
2402
+ debug: () => this.options.debug
2403
+ }
2404
+ ), this.getVirtualIndexes = Ke(
2405
+ () => {
2406
+ let t = null, r = null;
2407
+ const o = this.calculateRange();
2408
+ return o && (t = o.startIndex, r = o.endIndex), this.maybeNotify.updateDeps([this.isScrolling, t, r]), [
2409
+ this.options.rangeExtractor,
2410
+ this.options.overscan,
2411
+ this.options.count,
2412
+ t,
2413
+ r
2414
+ ];
2415
+ },
2416
+ (t, r, o, s, i) => s === null || i === null ? [] : t({
2417
+ startIndex: s,
2418
+ endIndex: i,
2419
+ overscan: r,
2420
+ count: o
2421
+ }),
2422
+ {
2423
+ key: process.env.NODE_ENV !== "production" && "getVirtualIndexes",
2424
+ debug: () => this.options.debug
2425
+ }
2426
+ ), this.indexFromElement = (t) => {
2427
+ const r = this.options.indexAttribute, o = t.getAttribute(r);
2428
+ return o ? parseInt(o, 10) : (console.warn(
2429
+ `Missing attribute name '${r}={index}' on measured element.`
2430
+ ), -1);
2431
+ }, this._measureElement = (t, r) => {
2432
+ const o = this.indexFromElement(t), s = this.measurementsCache[o];
2433
+ if (!s)
2434
+ return;
2435
+ const i = s.key, a = this.elementsCache.get(i);
2436
+ a !== t && (a && this.observer.unobserve(a), this.observer.observe(t), this.elementsCache.set(i, t)), t.isConnected && this.resizeItem(o, this.options.measureElement(t, r, this));
2437
+ }, this.resizeItem = (t, r) => {
2438
+ const o = this.measurementsCache[t];
2439
+ if (!o)
2440
+ return;
2441
+ const s = this.itemSizeCache.get(o.key) ?? o.size, i = r - s;
2442
+ i !== 0 && ((this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(o, i, this) : o.start < this.getScrollOffset() + this.scrollAdjustments) && (process.env.NODE_ENV !== "production" && this.options.debug && console.info("correction", i), this._scrollToOffset(this.getScrollOffset(), {
2443
+ adjustments: this.scrollAdjustments += i,
2444
+ behavior: void 0
2445
+ })), this.pendingMeasuredCacheIndexes.push(o.index), this.itemSizeCache = new Map(this.itemSizeCache.set(o.key, r)), this.notify(!1));
2446
+ }, this.measureElement = (t) => {
2447
+ if (!t) {
2448
+ this.elementsCache.forEach((r, o) => {
2449
+ r.isConnected || (this.observer.unobserve(r), this.elementsCache.delete(o));
2450
+ });
2451
+ return;
2452
+ }
2453
+ this._measureElement(t, void 0);
2454
+ }, this.getVirtualItems = Ke(
2455
+ () => [this.getVirtualIndexes(), this.getMeasurements()],
2456
+ (t, r) => {
2457
+ const o = [];
2458
+ for (let s = 0, i = t.length; s < i; s++) {
2459
+ const a = t[s], l = r[a];
2460
+ o.push(l);
2461
+ }
2462
+ return o;
2463
+ },
2464
+ {
2465
+ key: process.env.NODE_ENV !== "production" && "getVirtualItems",
2466
+ debug: () => this.options.debug
2467
+ }
2468
+ ), this.getVirtualItemForOffset = (t) => {
2469
+ const r = this.getMeasurements();
2470
+ if (r.length !== 0)
2471
+ return Dn(
2472
+ r[hr(
2473
+ 0,
2474
+ r.length - 1,
2475
+ (o) => Dn(r[o]).start,
2476
+ t
2477
+ )]
2478
+ );
2479
+ }, this.getMaxScrollOffset = () => {
2480
+ if (!this.scrollElement) return 0;
2481
+ if ("scrollHeight" in this.scrollElement)
2482
+ return this.options.horizontal ? this.scrollElement.scrollWidth - this.scrollElement.clientWidth : this.scrollElement.scrollHeight - this.scrollElement.clientHeight;
2483
+ {
2484
+ const t = this.scrollElement.document.documentElement;
2485
+ return this.options.horizontal ? t.scrollWidth - this.scrollElement.innerWidth : t.scrollHeight - this.scrollElement.innerHeight;
2486
+ }
2487
+ }, this.getOffsetForAlignment = (t, r, o = 0) => {
2488
+ if (!this.scrollElement) return 0;
2489
+ const s = this.getSize(), i = this.getScrollOffset();
2490
+ r === "auto" && (r = t >= i + s ? "end" : "start"), r === "center" ? t += (o - s) / 2 : r === "end" && (t -= s);
2491
+ const a = this.getMaxScrollOffset();
2492
+ return Math.max(Math.min(a, t), 0);
2493
+ }, this.getOffsetForIndex = (t, r = "auto") => {
2494
+ t = Math.max(0, Math.min(t, this.options.count - 1));
2495
+ const o = this.measurementsCache[t];
2496
+ if (!o)
2497
+ return;
2498
+ const s = this.getSize(), i = this.getScrollOffset();
2499
+ if (r === "auto")
2500
+ if (o.end >= i + s - this.options.scrollPaddingEnd)
2501
+ r = "end";
2502
+ else if (o.start <= i + this.options.scrollPaddingStart)
2503
+ r = "start";
2504
+ else
2505
+ return [i, r];
2506
+ if (r === "end" && t === this.options.count - 1)
2507
+ return [this.getMaxScrollOffset(), r];
2508
+ const a = r === "end" ? o.end + this.options.scrollPaddingEnd : o.start - this.options.scrollPaddingStart;
2509
+ return [
2510
+ this.getOffsetForAlignment(a, r, o.size),
2511
+ r
2512
+ ];
2513
+ }, this.isDynamicMode = () => this.elementsCache.size > 0, this.scrollToOffset = (t, { align: r = "start", behavior: o } = {}) => {
2514
+ o === "smooth" && this.isDynamicMode() && console.warn(
2515
+ "The `smooth` scroll behavior is not fully supported with dynamic size."
2516
+ ), this._scrollToOffset(this.getOffsetForAlignment(t, r), {
2517
+ adjustments: void 0,
2518
+ behavior: o
2519
+ });
2520
+ }, this.scrollToIndex = (t, { align: r = "auto", behavior: o } = {}) => {
2521
+ o === "smooth" && this.isDynamicMode() && console.warn(
2522
+ "The `smooth` scroll behavior is not fully supported with dynamic size."
2523
+ ), t = Math.max(0, Math.min(t, this.options.count - 1)), this.currentScrollToIndex = t;
2524
+ let s = 0;
2525
+ const i = 10, a = (c) => {
2526
+ if (!this.targetWindow) return;
2527
+ const f = this.getOffsetForIndex(t, c);
2528
+ if (!f) {
2529
+ console.warn("Failed to get offset for index:", t);
2530
+ return;
2531
+ }
2532
+ const [d, h] = f;
2533
+ this._scrollToOffset(d, { adjustments: void 0, behavior: o }), this.targetWindow.requestAnimationFrame(() => {
2534
+ const u = () => {
2535
+ if (this.currentScrollToIndex !== t) return;
2536
+ const m = this.getScrollOffset(), g = this.getOffsetForIndex(t, h);
2537
+ if (!g) {
2538
+ console.warn("Failed to get offset for index:", t);
2539
+ return;
2540
+ }
2541
+ ws(g[0], m) || l(h);
2542
+ };
2543
+ this.isDynamicMode() ? this.targetWindow.requestAnimationFrame(u) : u();
2544
+ });
2545
+ }, l = (c) => {
2546
+ this.targetWindow && this.currentScrollToIndex === t && (s++, s < i ? (process.env.NODE_ENV !== "production" && this.options.debug && console.info("Schedule retry", s, i), this.targetWindow.requestAnimationFrame(() => a(c))) : console.warn(
2547
+ `Failed to scroll to index ${t} after ${i} attempts.`
2548
+ ));
2549
+ };
2550
+ a(r);
2551
+ }, this.scrollBy = (t, { behavior: r } = {}) => {
2552
+ r === "smooth" && this.isDynamicMode() && console.warn(
2553
+ "The `smooth` scroll behavior is not fully supported with dynamic size."
2554
+ ), this._scrollToOffset(this.getScrollOffset() + t, {
2555
+ adjustments: void 0,
2556
+ behavior: r
2557
+ });
2558
+ }, this.getTotalSize = () => {
2559
+ var t;
2560
+ const r = this.getMeasurements();
2561
+ let o;
2562
+ if (r.length === 0)
2563
+ o = this.options.paddingStart;
2564
+ else if (this.options.lanes === 1)
2565
+ o = ((t = r[r.length - 1]) == null ? void 0 : t.end) ?? 0;
2566
+ else {
2567
+ const s = Array(this.options.lanes).fill(null);
2568
+ let i = r.length - 1;
2569
+ for (; i >= 0 && s.some((a) => a === null); ) {
2570
+ const a = r[i];
2571
+ s[a.lane] === null && (s[a.lane] = a.end), i--;
2572
+ }
2573
+ o = Math.max(...s.filter((a) => a !== null));
2574
+ }
2575
+ return Math.max(
2576
+ o - this.options.scrollMargin + this.options.paddingEnd,
2577
+ 0
2578
+ );
2579
+ }, this._scrollToOffset = (t, {
2580
+ adjustments: r,
2581
+ behavior: o
2582
+ }) => {
2583
+ this.options.scrollToFn(t, { behavior: o, adjustments: r }, this);
2584
+ }, this.measure = () => {
2585
+ this.itemSizeCache = /* @__PURE__ */ new Map(), this.laneAssignments = /* @__PURE__ */ new Map(), this.notify(!1);
2586
+ }, this.setOptions(n);
2587
+ }
2588
+ }
2589
+ const hr = (e, n, t, r) => {
2590
+ for (; e <= n; ) {
2591
+ const o = (e + n) / 2 | 0, s = t(o);
2592
+ if (s < r)
2593
+ e = o + 1;
2594
+ else if (s > r)
2595
+ n = o - 1;
2596
+ else
2597
+ return o;
2598
+ }
2599
+ return e > 0 ? e - 1 : 0;
2600
+ };
2601
+ function Ps({
2602
+ measurements: e,
2603
+ outerSize: n,
2604
+ scrollOffset: t,
2605
+ lanes: r
2606
+ }) {
2607
+ const o = e.length - 1, s = (l) => e[l].start;
2608
+ if (e.length <= r)
2609
+ return {
2610
+ startIndex: 0,
2611
+ endIndex: o
2612
+ };
2613
+ let i = hr(
2614
+ 0,
2615
+ o,
2616
+ s,
2617
+ t
2618
+ ), a = i;
2619
+ if (r === 1)
2620
+ for (; a < o && e[a].end < t + n; )
2621
+ a++;
2622
+ else if (r > 1) {
2623
+ const l = Array(r).fill(0);
2624
+ for (; a < o && l.some((f) => f < t + n); ) {
2625
+ const f = e[a];
2626
+ l[f.lane] = f.end, a++;
2627
+ }
2628
+ const c = Array(r).fill(t + n);
2629
+ for (; i >= 0 && c.some((f) => f >= t); ) {
2630
+ const f = e[i];
2631
+ c[f.lane] = f.start, i--;
2632
+ }
2633
+ i = Math.max(0, i - i % r), a = Math.min(o, a + (r - 1 - a % r));
2634
+ }
2635
+ return { startIndex: i, endIndex: a };
2636
+ }
2637
+ const Ln = typeof document < "u" ? p.useLayoutEffect : p.useEffect;
2638
+ function Ds({
2639
+ useFlushSync: e = !0,
2640
+ ...n
2641
+ }) {
2642
+ const t = p.useReducer(() => ({}), {})[1], r = {
2643
+ ...n,
2644
+ onChange: (s, i) => {
2645
+ var a;
2646
+ e && i ? $n(t) : t(), (a = n.onChange) == null || a.call(n, s, i);
2647
+ }
2648
+ }, [o] = p.useState(
2649
+ () => new Ns(r)
2650
+ );
2651
+ return o.setOptions(r), Ln(() => o._didMount(), []), Ln(() => o._willUpdate()), o;
2652
+ }
2653
+ function As(e) {
2654
+ return Ds({
2655
+ observeElementRect: Os,
2656
+ observeElementOffset: Ts,
2657
+ scrollToFn: Ms,
2658
+ ...e
2659
+ });
2660
+ }
2661
+ const De = Pe(void 0), mr = Pe({
2662
+ activeIndex: 0
2663
+ }), Fs = (e, n) => n.type === "SET_ACTIVE_INDEX" ? {
2664
+ ...e,
2665
+ activeIndex: n.payload
2666
+ } : e, pr = Pe(() => {
2667
+ throw new Error("ComboboxIdDispatch must be used within a provider");
2668
+ }), _s = ({ children: e }) => {
2669
+ const [n, t] = _r(Fs, {
2670
+ activeIndex: 0
2671
+ });
2672
+ return y(mr.Provider, { value: n, children: y(pr.Provider, { value: t, children: e }) });
2673
+ };
2674
+ function en() {
2675
+ return oe(pr);
2676
+ }
2677
+ function wt() {
2678
+ return oe(mr);
2679
+ }
2680
+ const br = V(({ asChild: e, interactive: n, id: t, className: r, ...o }, s) => {
2681
+ if (n && !t)
2682
+ throw new Error("If ComboboxCustom is interactive, it must have an id");
2683
+ const i = e ? se : "div", a = ze(), { activeIndex: l } = wt(), c = oe(De);
2684
+ if (!c)
2685
+ throw new Error("ComboboxCustom must be used within a Combobox");
2686
+ const { customIds: f, setListRef: d, getItemProps: h, size: u } = c, m = Le(() => t && f.indexOf(t) || 0, [t, f]), g = Gt([
2687
+ (E) => {
2688
+ d(m, E);
2689
+ },
2690
+ s
2691
+ ]);
2692
+ return y(Ne, { "data-size": u, asChild: !0, children: y(i, { ref: g, tabIndex: -1, className: X("ds-combobox__custom", r), id: t || a, role: "option", "aria-selected": l === m, "data-active": l === m, ...We(["interactive"], o), ...We(["onClick", "onPointerLeave"], h()) }) });
2693
+ }), gr = ({ size: e, error: n, formFieldProps: t }) => y("div", { className: "ds-combobox__error-message", id: t.errorId, "aria-live": "polite", "aria-relevant": "additions removals", children: n && y(Ut, { "data-size": e, children: n }) });
2694
+ gr.displayName = "ComboboxError";
2695
+ function Ls(e) {
2696
+ return Vn(e) && e.type === br;
2697
+ }
2698
+ function zs(e) {
2699
+ return Ls(e) && e.props.interactive === !0;
2700
+ }
2701
+ const vr = "internal-option-", me = (e) => vr + e, qt = (e) => e.slice(vr.length), Je = (e, n) => {
2702
+ const t = e.value;
2703
+ e.value = n;
2704
+ const r = e._valueTracker;
2705
+ typeof r < "u" && r.setValue(t), e.dispatchEvent(new Event("change", { bubbles: !0 }));
2706
+ }, yr = V(function({ asChild: n, className: t, ...r }, o) {
2707
+ return y(n ? se : "button", { className: X("ds-chip", t), type: n ? void 0 : "button", ref: o, ...r });
2708
+ }), xr = V(function(n, t) {
2709
+ return y(yr, { "data-removable": !0, ref: t, ...n });
2710
+ }), Cr = V(function({ asChild: n, children: t, className: r, "data-size": o, "data-color": s, ...i }, a) {
2711
+ const l = i.type ?? "checkbox";
2712
+ return le(n ? se : "label", { className: X("ds-chip", r), "data-size": o, "data-color": s, ref: a, children: [y(vt, { ...i, type: l }), y(Br, { children: t })] });
2713
+ }), Vs = V(function(n, t) {
2714
+ return y(Cr, { ref: t, type: "radio", ...n });
2715
+ }), It = {
2716
+ Button: yr,
2717
+ Checkbox: Cr,
2718
+ Radio: Vs,
2719
+ Removable: xr
2720
+ };
2721
+ It.Button.displayName = "Chip.Button";
2722
+ It.Checkbox.displayName = "Chip.Checkbox";
2723
+ It.Radio.displayName = "Chip.Radio";
2724
+ It.Removable.displayName = "Chip.Removable";
2725
+ const Er = () => {
2726
+ const e = oe(De);
2727
+ if (!e)
2728
+ throw new Error("ComboboxContext is missing");
2729
+ const { size: n, readOnly: t, disabled: r, selectedOptions: o, chipSrLabel: s, handleSelectOption: i, inputRef: a } = e;
2730
+ return y(Ht, { children: Object.keys(o).map((l) => y(xr, { "data-size": n, disabled: r, onKeyDown: (c) => {
2731
+ t || r || c.key === "Enter" && (c.stopPropagation(), i({
2732
+ option: o[l],
2733
+ remove: !0
2734
+ }), a?.current?.focus());
2735
+ }, onClick: () => {
2736
+ t || r || i({
2737
+ option: o[l],
2738
+ remove: !0
2739
+ });
2740
+ }, "aria-label": s(o[l]), children: o[l].label }, l)) });
2741
+ };
2742
+ Er.displayName = "ComboboxChips";
2743
+ const wr = V((e, n) => {
2744
+ const t = oe(De);
2745
+ if (!t)
2746
+ throw new Error("ComboboxContext is missing");
2747
+ const { readOnly: r, disabled: o, clearButtonLabel: s, handleSelectOption: i } = t;
2748
+ return y("button", { ...e, ref: n, disabled: o, className: X("ds-combobox__clear-button", "ds-focus"), onClick: () => {
2749
+ r || o || i({ option: null, clear: !0 });
2750
+ }, onKeyDown: (a) => {
2751
+ r || o || a.key === "Enter" && (a.stopPropagation(), i({ option: null, clear: !0 }));
2752
+ }, type: "button", "aria-label": s, children: y(qr, { fontSize: "1.5em", title: "Clear selection" }) });
2753
+ });
2754
+ wr.displayName = "ComboboxClearButton";
2755
+ const Ir = ({ hideClearButton: e, listId: n, error: t, hideChips: r, handleKeyDown: o, ...s }) => {
2756
+ const i = oe(De), a = en(), l = ge(null);
2757
+ if (!i)
2758
+ throw new Error("ComboboxContext is missing");
2759
+ const c = (w) => {
2760
+ a?.({ type: "SET_ACTIVE_INDEX", payload: w });
2761
+ }, { forwareddRef: f, readOnly: d, disabled: h, open: u, inputRef: m, refs: g, inputValue: E, multiple: x, selectedOptions: v, formFieldProps: b, htmlSize: C, options: A, setOpen: M, getReferenceProps: $, setInputValue: K, handleSelectOption: Z, size: G } = i, q = Gt([f, m]), O = (w) => {
2762
+ const D = w.target.value;
2763
+ K(D), c(0);
2764
+ for (const B of Object.values(A))
2765
+ if (B.label.toLowerCase() === D.toLowerCase()) {
2766
+ if (v[me(B.value)])
2767
+ continue;
2768
+ Z({ option: B });
2769
+ }
2770
+ }, N = !e && Object.keys(v).length > 0, P = $({
2771
+ ref: g?.setReference,
2772
+ role: null,
2773
+ "aria-controls": null,
2774
+ "aria-expanded": null,
2775
+ "aria-haspopup": null,
2776
+ /* If we click the wrapper, toggle open, set index to first option, and focus the input */
2777
+ onClick(w) {
2778
+ h || d || l.current?.contains(w.target) || (M(!u), c(0), m.current?.focus());
2779
+ },
2780
+ /* Handles list navigation */
2781
+ onKeyDown: o,
2782
+ // preventDefault on keydown to avoid sending in form
2783
+ onKeyPress(w) {
2784
+ w.key === "Enter" && w.preventDefault();
2785
+ }
2786
+ });
2787
+ return y(Bt, { "data-size": G, asChild: !0, children: le("div", { ...P, "aria-disabled": h ? "true" : void 0, className: X("ds-textfield__input", "ds-combobox__input__wrapper", d && "ds-combobox--readonly", t && "ds-combobox--error"), children: [le("div", { className: "ds-combobox__chip-and-input", children: [x && !r && y(Er, {}), y(Bt, { "data-size": G, asChild: !0, children: y("input", { ref: q, "aria-activedescendant": P["aria-activedescendant"], readOnly: d, "aria-autocomplete": "list", role: "combobox", "aria-expanded": u, "aria-controls": u ? n : void 0, autoComplete: "off", size: C, value: E, ...We(["style", "className"], s), ...b.inputProps, className: "ds-combobox__input", onChange: (w) => {
2788
+ O(w), !u && M(!0), s.onChange?.(w);
2789
+ } }) })] }), N && y(wr, { ref: l }), y("div", { className: "ds-combobox__arrow", children: u ? y(Hr, { title: "arrow up", fontSize: "1.5em" }) : y(Ur, { title: "arrow down", fontSize: "1.5em" }) })] }) });
2790
+ };
2791
+ Ir.displayName = "ComboboxInput";
2792
+ const Rr = ({ label: e, description: n, hideLabel: t, size: r, readOnly: o, formFieldProps: s }) => le(Ht, { children: [e && le(Ne, { "data-size": r, htmlFor: s.inputProps.id, className: X("ds-combobox__label", t && "ds-sr-only"), children: [o && y(eo, { "aria-hidden": !0, className: "ds-combobox__readonly__icon" }), e] }), n && y(Bt, { asChild: !0, "data-size": r, children: y("div", { id: s.descriptionId, className: X("ds-combobox__description", t && "ds-sr-only"), children: n }) })] });
2793
+ Rr.displayName = "ComboboxLabel";
2794
+ const Sr = ({ selectedOptions: e, multiple: n, name: t }) => {
2795
+ const r = Object.keys(e).map((o) => qt(o));
2796
+ return y("select", { name: t, multiple: n, style: { display: "none" }, value: n ? r : r[0], onChange: () => {
2797
+ }, children: r.map((o) => y("option", { value: o }, o)) });
2798
+ };
2799
+ Sr.displayName = "ComboboxNative";
2800
+ const Or = V(({ children: e, className: n, ...t }, r) => y("span", { className: X("ds-combobox__option__description", n), ref: r, ...t, children: e }));
2801
+ Or.displayName = "ComboboxOptionDescription";
2802
+ const Tr = ({ multiple: e, selected: n }) => y("div", { className: X(e && "ds-combobox__option__icon-wrapper", n && "ds-combobox__option__icon-wrapper--selected"), children: n && y(Gr, { className: "ds-combobox__option__icon-wrapper__icon", "aria-hidden": !0 }) });
2803
+ Tr.displayName = "SelectedIcon";
2804
+ const Bs = ({ id: e, ref: n, value: t }) => {
2805
+ const r = ze(), o = e || r, s = oe(De), { activeIndex: i } = wt(), a = en();
2806
+ if (!s)
2807
+ throw new Error("ComboboxOption must be used within a Combobox");
2808
+ const { selectedOptions: l, onOptionClick: c, setListRef: f, customIds: d, filteredOptions: h } = s, u = Le(() => h.indexOf(me(String(t))) + d.length, [d.length, h, t]), m = Gt([
2809
+ (v) => {
2810
+ f(u, v);
2811
+ },
2812
+ n
2813
+ ]);
2814
+ if (u === -1)
2815
+ throw new Error("Internal error: ComboboxOption did not find index");
2816
+ const g = l[me(t)], E = i === u;
2817
+ de(() => {
2818
+ E && a?.({ type: "SET_ACTIVE_INDEX", payload: u });
2819
+ }, [r, e, a, E, u]);
2820
+ const x = Xt(() => c(t), 50);
2821
+ return {
2822
+ id: o,
2823
+ ref: m,
2824
+ selected: g,
2825
+ active: E,
2826
+ onOptionClick: x
2827
+ };
2828
+ }, tn = Lr(V(({ value: e, description: n, children: t, className: r, ...o }, s) => {
2829
+ const i = ze(), { id: a, ref: l, selected: c, active: f, onOptionClick: d } = Bs({
2830
+ id: o.id,
2831
+ ref: s,
2832
+ value: e
2833
+ }), h = oe(De);
2834
+ if (!h)
2835
+ throw new Error("ComboboxOption must be used within a Combobox");
2836
+ const { size: u, multiple: m, getItemProps: g } = h, E = g();
2837
+ return y(Ne, { "data-size": "md", asChild: !0, children: le("button", { ref: l, id: a, role: "option", type: "button", "aria-selected": !!c, "aria-labelledby": i, tabIndex: -1, onClick: (x) => {
2838
+ d(), o.onClick?.(x);
2839
+ }, className: X("ds-combobox__option", f && "ds-combobox__option--active", m && "ds-combobox__option--multiple", r), ...We(["displayValue"], o), ...We(["onClick", "onPointerLeave"], E), children: [y(Ne, { asChild: !0, "data-size": u, children: y("span", { children: y(Tr, { multiple: m, selected: !!c }) }) }), le(Ne, { className: "ds-combobox__option__label", "data-size": u, id: i, children: [t, n && y(Or, { children: n })] })] }) });
2840
+ }));
2841
+ tn.displayName = "ComboboxOption";
2842
+ function $s(e) {
2843
+ return Vn(e) && e.type === tn;
2844
+ }
2845
+ const Ks = (e) => !!e;
2846
+ function js({ children: e, inputValue: n, multiple: t, filter: r = (s, i) => i.label.toLowerCase().startsWith(s.toLowerCase()), initialValue: o }) {
2847
+ const s = zr(r, [r]), { optionsChildren: i, customIds: a, restChildren: l, interactiveChildren: c } = Le(() => dn.toArray(e).reduce((v, b) => {
2848
+ if ($s(b))
2849
+ v.optionsChildren.push(b);
2850
+ else if (v.restChildren.push(b), zs(b)) {
2851
+ const C = b;
2852
+ if (v.interactiveChildren.push(C), !C.props.id)
2853
+ throw new Error("If ComboboxCustom is interactive, it must have an id");
2854
+ v.customIds.push(C.props.id);
2855
+ }
2856
+ return v;
2857
+ }, {
2858
+ optionsChildren: [],
2859
+ customIds: [],
2860
+ restChildren: [],
2861
+ interactiveChildren: []
2862
+ }), [e]), f = Le(() => {
2863
+ const E = [], x = {};
2864
+ return i.map((v) => {
2865
+ const b = v.props;
2866
+ let C = b.displayValue || "";
2867
+ if (!b.displayValue) {
2868
+ let A = "";
2869
+ dn.forEach(b.children, (M) => {
2870
+ if (typeof M == "string")
2871
+ A += M;
2872
+ else
2873
+ throw new Error("If ComboboxOption is not a string, it must have a displayValue prop");
2874
+ }), C = A;
2875
+ }
2876
+ return E.includes(b.value) && console.warn(`Combobox has multiple options with the same value: ${b.value}`), E.push(b.value), x[me(String(b.value))] = {
2877
+ value: String(b.value),
2878
+ label: C,
2879
+ displayValue: b.displayValue,
2880
+ description: b.description
2881
+ }, null;
2882
+ }), x;
2883
+ }, [i]), d = Le(() => (o?.map((E) => me(E)) || []).reduce((E, x) => {
2884
+ const v = f[x];
2885
+ return Ks(v) && (E[x] = v), E;
2886
+ }, {}), [o, f]), [h, u] = Ce(d), { filteredOptions: m, filteredOptionsChildren: g } = Le(() => {
2887
+ const E = [], x = Object.keys(f).map((v, b) => !t && Object.keys(h).length === 1 || t && h[v] || s(n, f[v]) ? (E.push(v), i[b]) : null).filter((v) => v);
2888
+ return { filteredOptions: E, filteredOptionsChildren: x };
2889
+ }, [
2890
+ s,
2891
+ n,
2892
+ t,
2893
+ f,
2894
+ i,
2895
+ h
2896
+ ]);
2897
+ return {
2898
+ filteredOptionsChildren: g,
2899
+ filteredOptions: m,
2900
+ restChildren: l,
2901
+ options: f,
2902
+ customIds: a,
2903
+ selectedOptions: h,
2904
+ interactiveChildren: c,
2905
+ setSelectedOptions: u
2906
+ };
2907
+ }
2908
+ const Ws = ({ readOnly: e, disabled: n, interactiveChildren: t, filteredOptions: r, inputValue: o, selectedOptions: s, multiple: i, open: a, options: l, setOpen: c, handleSelectOption: f }) => {
2909
+ const { activeIndex: d } = wt();
2910
+ return Xt((m) => {
2911
+ if (!(e || n) && m)
2912
+ switch (m.key) {
2913
+ case "ArrowDown":
2914
+ if (m.preventDefault(), a)
2915
+ break;
2916
+ c(!0);
2917
+ break;
2918
+ case "ArrowUp":
2919
+ if (m.preventDefault(), d !== 0)
2920
+ break;
2921
+ c(!1);
2922
+ break;
2923
+ case "Enter": {
2924
+ if (m.preventDefault(), !a)
2925
+ break;
2926
+ if (d <= t.length - 1) {
2927
+ const x = t[d];
2928
+ if (x.props.onSelect) {
2929
+ x?.props.onSelect();
2930
+ return;
2931
+ }
2932
+ }
2933
+ const g = d - t.length, E = r[g];
2934
+ f({ option: l[E] });
2935
+ break;
2936
+ }
2937
+ case "Backspace":
2938
+ if (!i) {
2939
+ const g = Object.keys(s).pop();
2940
+ g && f({
2941
+ option: s[g],
2942
+ remove: !0
2943
+ });
2944
+ break;
2945
+ }
2946
+ if (o === "" && i) {
2947
+ const g = Object.keys(s).pop();
2948
+ g && f({
2949
+ option: s[g],
2950
+ remove: !0
2951
+ });
2952
+ }
2953
+ break;
2954
+ }
2955
+ }, 20);
2956
+ }, qs = ({ listRef: e }) => {
2957
+ const [n, t] = Ce(!1), { activeIndex: r } = wt(), o = en(), { refs: s, floatingStyles: i, context: a } = gs({
2958
+ open: n,
2959
+ onOpenChange: (m) => {
2960
+ m || o?.({ type: "SET_ACTIVE_INDEX", payload: 0 }), $n(() => {
2961
+ s.floating.current && !m && (s.floating.current.scrollTop = 0), setTimeout(() => {
2962
+ t(m);
2963
+ }, 1);
2964
+ });
2965
+ },
2966
+ whileElementsMounted: (m, g, E) => (qn(m, g, E), () => {
2967
+ g.scrollTop = 0;
2968
+ }),
2969
+ middleware: [
2970
+ Bo({ padding: 10 }),
2971
+ $o({
2972
+ apply({ rects: m, elements: g }) {
2973
+ requestAnimationFrame(() => {
2974
+ Object.assign(g.floating.style, {
2975
+ width: `${m.reference.width}px`,
2976
+ maxHeight: "200px"
2977
+ });
2978
+ });
2979
+ }
2980
+ }),
2981
+ Vo(10)
2982
+ ]
2983
+ }), l = Es(a, { role: "listbox" }), c = ps(a), f = xs(a, {
2984
+ listRef: e,
2985
+ activeIndex: r,
2986
+ virtual: !0,
2987
+ scrollItemIntoView: !0,
2988
+ enabled: n,
2989
+ focusItemOnHover: !0,
2990
+ onNavigate: (m) => {
2991
+ o?.({ type: "SET_ACTIVE_INDEX", payload: m || 0 });
2992
+ }
2993
+ }), { getReferenceProps: d, getFloatingProps: h, getItemProps: u } = vs([l, c, f]);
2994
+ return {
2995
+ open: n,
2996
+ setOpen: t,
2997
+ activeIndex: r,
2998
+ refs: s,
2999
+ floatingStyles: i,
3000
+ context: a,
3001
+ getReferenceProps: d,
3002
+ getFloatingProps: h,
3003
+ getItemProps: u
3004
+ };
3005
+ }, Hs = Pe(null), Us = (e, n) => {
3006
+ const t = oe(Hs), r = ze(), o = e.id ?? `${n}-${r}`, s = e.errorId ?? `${n}-error-${r}`, i = `${n}-description-${r}`, a = e.size ?? t?.size ?? "md", l = t?.disabled || e?.disabled, c = !l && !!(e.error || t?.error);
3007
+ return {
3008
+ hasError: c,
3009
+ errorId: s,
3010
+ descriptionId: i,
3011
+ size: a,
3012
+ inputProps: {
3013
+ id: o,
3014
+ disabled: l,
3015
+ "aria-invalid": c ? !0 : void 0,
3016
+ "aria-describedby": X(e["aria-describedby"], !!e?.description && typeof e?.description == "string" && i, c && !t?.error && s, c && !!t?.error && t?.errorId) || void 0
3017
+ }
3018
+ };
3019
+ }, Xs = V(({ value: e, initialValue: n = [], onValueChange: t, label: r, hideLabel: o = !1, description: s, multiple: i = !1, disabled: a = !1, readOnly: l = !1, hideChips: c = !1, clearButtonLabel: f = "Fjern alt", hideClearButton: d = !1, error: h, errorId: u, id: m, name: g, portal: E = !0, htmlSize: x = 0, virtual: v = !1, children: b, style: C, size: A = "md", loading: M, loadingLabel: $ = "Laster...", filter: K, chipSrLabel: Z = (N) => "Slett " + N.label, className: G, ...q }, O) => {
3020
+ const N = ge(null), P = ge(null), w = ge([]), [D, B] = Ce(q.inputValue || "");
3021
+ de(() => {
3022
+ typeof q.inputValue == "string" && B(q.inputValue);
3023
+ }, [q.inputValue]);
3024
+ const { selectedOptions: k, options: R, restChildren: U, interactiveChildren: te, customIds: ve, filteredOptionsChildren: fe, filteredOptions: L, setSelectedOptions: T } = js({
3025
+ children: b,
3026
+ inputValue: D,
3027
+ filter: K,
3028
+ multiple: i,
3029
+ initialValue: n
3030
+ }), { open: S, setOpen: F, refs: H, floatingStyles: ee, context: ne, getReferenceProps: Y, getFloatingProps: we, getItemProps: Ee } = qs({
3031
+ listRef: w
3032
+ }), J = Us({
3033
+ disabled: a,
3034
+ error: h,
3035
+ errorId: u,
3036
+ size: A,
3037
+ description: s,
3038
+ id: m
3039
+ }, "combobox");
3040
+ de(() => {
3041
+ if (e && e.length > 0 && !i) {
3042
+ const z = R[me(e[0])];
3043
+ N.current && Je(N.current, z?.label || "");
3044
+ }
3045
+ }, [i, e, R]), de(() => {
3046
+ if (e && Object.keys(R).length >= 0) {
3047
+ const z = e.map((I) => R[me(I)]);
3048
+ T(z.reduce((I, W) => (I[me(W.value)] = W, I), {}));
3049
+ }
3050
+ }, [i, e, R, T]);
3051
+ const he = Xt((z) => {
3052
+ const { option: I, clear: W, remove: ie } = z;
3053
+ if (W) {
3054
+ T({}), N.current && Je(N.current, ""), t?.([]);
3055
+ return;
3056
+ }
3057
+ if (!I)
3058
+ return;
3059
+ if (ie) {
3060
+ const re = { ...k };
3061
+ delete re[me(I.value)], T(re), t?.(Object.keys(re).map((Be) => qt(Be)));
3062
+ return;
3063
+ }
3064
+ const j = { ...k };
3065
+ if (i)
3066
+ j[me(I.value)] ? delete j[me(I.value)] : j[me(I.value)] = I, N.current && Je(N.current, ""), N.current?.focus();
3067
+ else {
3068
+ for (const re of Object.keys(j))
3069
+ delete j[re];
3070
+ j[me(I.value)] = I, N.current && Je(N.current, I?.label || ""), setTimeout(() => {
3071
+ N.current?.setSelectionRange(I?.label?.length || 0, I?.label?.length || 0);
3072
+ }, 0);
3073
+ }
3074
+ T(j), t?.(Object.keys(j).map((re) => qt(re))), !i && F(!1), H.domReference.current?.focus();
3075
+ }, 50), Ae = Ws({
3076
+ filteredOptions: L,
3077
+ selectedOptions: k,
3078
+ readOnly: J.readOnly || !1,
3079
+ disabled: a,
3080
+ multiple: i,
3081
+ inputValue: D,
3082
+ options: R,
3083
+ open: S,
3084
+ interactiveChildren: te,
3085
+ setOpen: F,
3086
+ handleSelectOption: he
3087
+ }), _ = As({
3088
+ count: Object.keys(fe).length,
3089
+ getScrollElement: () => v ? H.floating.current : null,
3090
+ estimateSize: () => 70,
3091
+ measureElement: (z) => z.getBoundingClientRect().height,
3092
+ overscan: 7
3093
+ });
3094
+ return le(De.Provider, { value: {
3095
+ size: A,
3096
+ options: R,
3097
+ selectedOptions: k,
3098
+ multiple: i,
3099
+ disabled: a,
3100
+ readOnly: l,
3101
+ open: S,
3102
+ inputRef: N,
3103
+ refs: H,
3104
+ inputValue: D,
3105
+ formFieldProps: J,
3106
+ htmlSize: x,
3107
+ clearButtonLabel: f,
3108
+ customIds: ve,
3109
+ filteredOptions: L,
3110
+ setInputValue: B,
3111
+ setOpen: F,
3112
+ getReferenceProps: Y,
3113
+ getItemProps: Ee,
3114
+ /* Recieves the value of the option, and searches for it in our values lookup */
3115
+ onOptionClick: (z) => {
3116
+ if (l || a)
3117
+ return;
3118
+ const I = R[me(z)];
3119
+ he({ option: I });
3120
+ },
3121
+ handleSelectOption: he,
3122
+ chipSrLabel: Z,
3123
+ listRef: w,
3124
+ forwareddRef: O,
3125
+ setListRef: (z, I) => {
3126
+ w.current[z] = I;
3127
+ }
3128
+ }, children: [le("div", { className: X("ds-combobox", `ds-combobox--${A}`, a && "ds-combobox__disabled", G), style: C, ref: P, children: [g && y(Sr, { name: g, selectedOptions: k, multiple: i }), y(Rr, { label: r, description: s, size: A, readOnly: l, hideLabel: o, formFieldProps: J }), y(Ir, { ...We(["inputValue"], q), hideClearButton: d, listId: ne.floatingId || "", error: h, hideChips: c, handleKeyDown: Ae, "aria-busy": M }), y(gr, { size: A, error: h, formFieldProps: J })] }), S && y(us, { root: E ? null : P, children: y(fs, { context: ne, initialFocus: -1, visuallyHiddenDismiss: !0, children: le("div", { "aria-labelledby": J.inputProps.id, "aria-autocomplete": "list", tabIndex: -1, ...we({
3129
+ ref: H.setFloating,
3130
+ style: {
3131
+ ...ee
3132
+ }
3133
+ }), className: X("ds-combobox__options-wrapper", `ds-combobox--${A}`), children: [v && y("div", { style: {
3134
+ height: `${_.getTotalSize()}px`,
3135
+ width: "100%",
3136
+ position: "relative"
3137
+ }, children: _.getVirtualItems().map((z) => y("div", { ref: _.measureElement, "data-index": z.index, style: {
3138
+ position: "absolute",
3139
+ top: 0,
3140
+ left: 0,
3141
+ width: "100%",
3142
+ transform: `translateY(${z.start}px)`
3143
+ }, children: fe[z.index] }, z.index)) }), M ? le(br, { className: "ds-combobox__loading", children: [y($r, { "aria-label": "Laster", "data-size": "sm" }), $] }) : le(Ht, { children: [U, !v && fe] })] }) }) })] });
3144
+ }), kr = V((e, n) => y(_s, { children: y(Xs, { ...e, ref: n }) }));
3145
+ kr.displayName = "Combobox";
3146
+ const Mr = V(({ children: e, className: n, ...t }, r) => {
3147
+ const o = oe(De);
3148
+ if (!o)
3149
+ throw new Error("ComboboxEmpty must be used within a Combobox");
3150
+ const { filteredOptions: s, size: i } = o;
3151
+ return s.length === 0 && y(Ne, { "data-size": i, asChild: !0, children: y("div", { ref: r, className: X("ds-combobox__empty", n), ...t, children: e }) });
3152
+ });
3153
+ Mr.displayName = "ComboboxEmpty";
3154
+ const Rt = kr;
3155
+ Rt.Option = tn;
3156
+ Rt.Empty = Mr;
3157
+ Rt.Option.displayName = "Combobox.Option";
3158
+ Rt.Empty.displayName = "Combobox.Empty";
3159
+ const Ni = V(function({ "data-size": n, className: t, style: r, children: o, label: s, description: i, error: a, ...l }, c) {
3160
+ return le(Vt, { "data-size": n, className: t, style: r, children: [y(vt, { type: "checkbox", ref: c, ...l }), !!s && y(Ne, { weight: "regular", children: s }), !!i && y("div", { "data-field": "description", children: i }), !!a && y(Ut, { children: a })] });
3161
+ }), nn = Pe({
3162
+ current: null
3163
+ }), Nr = ({ children: e }) => {
3164
+ const n = ge(null);
3165
+ return y(nn.Provider, { value: n, children: e });
3166
+ };
3167
+ Nr.displayName = "DialogTriggerContext";
3168
+ const Gs = V(function({ asChild: n, children: t, className: r, placement: o = "center", closeButton: s = "Lukk dialogvindu", closedby: i = "closerequest", modal: a = !0, onClose: l, open: c, ...f }, d) {
3169
+ const h = oe(nn), u = ge(null), m = n ? se : "dialog", g = Ve([h, d, u]), E = a ? "showModal" : "show";
3170
+ return de(() => u.current?.[c ? E : "close"](), [c]), de(() => {
3171
+ const x = u.current, v = (C) => {
3172
+ if (C.defaultPrevented)
3173
+ return;
3174
+ const { clientY: A, clientX: M, target: $ } = C;
3175
+ if ($ instanceof Element && C.type === "click" && $.closest('[data-command="close"]'))
3176
+ return x?.close();
3177
+ if (!(x && "closedBy" in x)) {
3178
+ if (C instanceof KeyboardEvent)
3179
+ return i === "none" && C.key === "Escape" && C.preventDefault();
3180
+ if (!window.getSelection()?.toString() && x && $ === x && i === "any") {
3181
+ const { top: K, left: Z, right: G, bottom: q } = x.getBoundingClientRect();
3182
+ K <= A && A <= q && Z <= M && M <= G || x?.close();
3183
+ }
3184
+ }
3185
+ }, b = () => {
3186
+ const C = x?.querySelector("[autofocus]");
3187
+ document.activeElement !== C && C?.focus();
3188
+ };
3189
+ return x?.addEventListener("animationend", b), x?.addEventListener("click", v), x?.addEventListener("keydown", v), () => {
3190
+ x?.removeEventListener("animationend", b), x?.removeEventListener("click", v), x?.removeEventListener("keydown", v);
3191
+ };
3192
+ }, [i]), de(() => {
3193
+ const x = (b) => l?.(b), v = u.current;
3194
+ return v?.addEventListener("close", x), () => v?.removeEventListener("close", x);
3195
+ }, [l]), le(m, { className: X("ds-dialog", r), ref: g, "data-placement": o, "data-modal": a, closedby: i, ...f, children: [s !== !1 && y(Ge, { "aria-label": s, "data-color": "neutral", icon: !0, variant: "tertiary", "data-command": "close" }), t] });
3196
+ }), Ys = V(function({ asChild: n, className: t, ...r }, o) {
3197
+ return y(n ? se : "div", { className: X("ds-dialog__block", t), ref: o, ...r });
3198
+ }), Zs = V(function({ asChild: n, ...t }, r) {
3199
+ const o = oe(nn);
3200
+ return y(n ? se : Ge, { "aria-haspopup": "dialog", onClick: () => {
3201
+ o.current?.getAttribute("data-modal") === "true" ? o.current?.showModal() : o.current?.show();
3202
+ }, ref: r, ...t });
3203
+ }), rn = Object.assign(Gs, {
3204
+ Block: Ys,
3205
+ TriggerContext: Nr,
3206
+ Trigger: Zs
3207
+ });
3208
+ rn.Block.displayName = "Dialog.Block";
3209
+ rn.TriggerContext.displayName = "Dialog.TriggerContext";
3210
+ rn.Trigger.displayName = "Dialog.Trigger";
3211
+ const Pr = ({ children: e }) => {
3212
+ const n = ze(), [t, r] = Ce(n);
3213
+ return y(on.Provider, { value: { popoverId: t, setPopoverId: r }, children: e });
3214
+ };
3215
+ Pr.displayName = "PopoverTriggerContext";
3216
+ const on = Pe({}), Js = V(function({ id: n, className: t, onClose: r, onOpen: o, open: s, variant: i = "default", placement: a = "top", autoPlacement: l = !0, asChild: c = !1, ...f }, d) {
3217
+ const h = c ? se : "div", u = ge(null), m = Ve([u, d]), { popoverId: g, setPopoverId: E } = oe(on), [x, v] = Ce(!1), b = s ?? x;
3218
+ return de(() => {
3219
+ const C = u.current, A = ($) => {
3220
+ const K = $.target, Z = K?.closest?.(`[popovertarget="${C?.id}"]`), G = !Z && !C?.contains(K);
3221
+ Z && $.preventDefault(), b && (Z || G) ? (v(!1), r?.()) : !b && Z && (v(!0), o?.());
3222
+ }, M = ($) => {
3223
+ $.key !== "Escape" || !b || ($.preventDefault(), v(!1), r?.());
3224
+ };
3225
+ return C?.togglePopover?.(b), document.addEventListener("click", A, !0), document.addEventListener("keydown", M), () => {
3226
+ document.removeEventListener("click", A, !0), document.removeEventListener("keydown", M);
3227
+ };
3228
+ }, [b]), de(() => {
3229
+ const C = u.current, A = document.querySelector(`[popovertarget="${C?.id}"]`);
3230
+ if (C && A && b)
3231
+ return qn(A, C, () => {
3232
+ Wn(A, C, {
3233
+ placement: a,
3234
+ strategy: "fixed",
3235
+ middleware: [
3236
+ jn((M) => {
3237
+ const $ = getComputedStyle(M.elements.floating, "::before");
3238
+ return parseFloat($.height);
3239
+ }),
3240
+ ...l ? [Kn({ fallbackAxisSideDirection: "start" }), Zr()] : [],
3241
+ Qs
3242
+ ]
3243
+ }).then(({ x: M, y: $ }) => {
3244
+ C.style.translate = `${Math.round(M)}px ${Math.round($)}px`;
3245
+ });
3246
+ });
3247
+ }, [b, a, n, l]), de(() => {
3248
+ n && E?.(n);
3249
+ }, [n]), y(h, { className: X("ds-popover", t), id: n || g, popover: "manual", "data-variant": i, ref: m, ...f });
3250
+ }), Qs = {
3251
+ name: "ArrowPseudoElement",
3252
+ fn(e) {
3253
+ const { elements: n, rects: t, placement: r } = e;
3254
+ let o = `${Math.round(t.reference.width / 2 + t.reference.x - e.x)}px`, s = `${Math.round(t.reference.height / 2 + t.reference.y - e.y)}px`;
3255
+ switch (t.reference.width > t.floating.width && (o = `${Math.round(t.floating.width / 2)}px`), t.reference.height > t.floating.height && (s = `${Math.round(t.floating.height / 2)}px`), r.split("-")[0]) {
3256
+ case "top":
3257
+ s = "100%";
3258
+ break;
3259
+ case "right":
3260
+ o = "0";
3261
+ break;
3262
+ case "bottom":
3263
+ s = "0";
3264
+ break;
3265
+ case "left":
3266
+ o = "100%";
3267
+ break;
3268
+ }
3269
+ return n.floating.setAttribute("data-placement", r.split("-")[0]), n.floating.style.setProperty("--ds-popover-arrow-x", o), n.floating.style.setProperty("--ds-popover-arrow-y", s), e;
3270
+ }
3271
+ }, ei = V(function({ id: n, inline: t, asChild: r, ...o }, s) {
3272
+ const { popoverId: i } = oe(on), a = r ? se : t ? "button" : Ge, l = Object.assign({
3273
+ [Vr.startsWith("19") ? "popoverTarget" : "popovertarget"]: i,
3274
+ ...t ? {
3275
+ "data-popover": "inline"
3276
+ } : {}
3277
+ }, o);
3278
+ return y(a, { ref: s, ...l });
3279
+ }), Pi = V(function({ asChild: n, ...t }, r) {
3280
+ return y(n ? se : "li", { ...t, ref: r });
3281
+ }), Dr = (e, { asChild: n, className: t, ...r }, o) => y(n ? se : e, { className: X("ds-list", t), ref: o, ...r }), Di = V(function(n, t) {
3282
+ return Dr("ul", n, t);
3283
+ });
3284
+ V(function(n, t) {
3285
+ return Dr("ol", n, t);
3286
+ });
3287
+ const ti = V(function({ "aria-label": n = "Sidenavigering", asChild: t, className: r, ...o }, s) {
3288
+ return y(t ? se : "nav", { "aria-label": n, className: X("ds-pagination", r), ref: s, ...o });
3289
+ }), ni = V(function(n, t) {
3290
+ return y(Ge, { ref: t, ...n });
3291
+ }), ri = V(function({ asChild: n, className: t, ...r }, o) {
3292
+ return y(n ? se : "li", { ref: o, ...r });
3293
+ }), oi = V(function({ asChild: n, ...t }, r) {
3294
+ return y(n ? se : "ul", { ref: r, ...t });
3295
+ }), sn = Object.assign(ti, {
3296
+ List: oi,
3297
+ Item: ri,
3298
+ Button: ni
3299
+ });
3300
+ sn.List.displayName = "Pagination.List";
3301
+ sn.Item.displayName = "Pagination.Item";
3302
+ sn.Button.displayName = "Pagination.Button";
3303
+ const Ar = Object.assign(Js, {
3304
+ TriggerContext: Pr,
3305
+ Trigger: ei
3306
+ });
3307
+ Ar.TriggerContext.displayName = "Popover.TriggerContext";
3308
+ Ar.Trigger.displayName = "Popover.Trigger";
3309
+ const si = V(function({ className: n, ...t }, r) {
3310
+ return y("div", { ref: r, className: X("ds-search", n), ...t });
3311
+ }), ii = V(function({ children: n = "Søk", ...t }, r) {
3312
+ return y(Ge, { ref: r, type: "submit", ...t, children: n });
3313
+ }), ai = V(function({ "aria-label": n = "Tøm", onClick: t, ...r }, o) {
3314
+ return y(Ge, { ref: o, variant: "tertiary", type: "reset", "aria-label": n, onClick: (i) => {
3315
+ const a = i.target;
3316
+ let l = null;
3317
+ if (a instanceof HTMLElement && (l = a.closest(".ds-search")?.querySelector("input")), !l)
3318
+ throw new Error("Input is missing");
3319
+ if (!(l instanceof HTMLInputElement))
3320
+ throw new Error("Input is not an input element");
3321
+ i.preventDefault(), Je(l, ""), l.focus(), t?.(i);
3322
+ }, icon: !0, ...r });
3323
+ }), li = V(function({ ...n }, t) {
3324
+ return y(vt, {
3325
+ ref: t,
3326
+ type: "search",
3327
+ /* We need an empty placeholder for the clear button to be able to show/hide */
3328
+ placeholder: "",
3329
+ ...n
3330
+ });
3331
+ }), an = Object.assign(si, {
3332
+ Clear: ai,
3333
+ Button: ii,
3334
+ Input: li
3335
+ });
3336
+ an.Clear.displayName = "Search.Clear";
3337
+ an.Button.displayName = "Search.Button";
3338
+ an.Input.displayName = "Search.Input";
3339
+ const Ai = V(function({ asChild: n, className: t, height: r, style: o, variant: s = "rectangle", width: i, ...a }, l) {
3340
+ const c = n ? se : "span", f = s === "text", d = Kr("ds-skeleton-opacity-fade"), h = Ve([d, l]);
3341
+ return y(c, { "aria-hidden": "true", className: X("ds-skeleton", t), "data-text": f ? "-".repeat(Number(i) || 1) : void 0, "data-variant": s, ref: h, style: f ? o : { width: i, height: r, ...o }, ...a });
3342
+ }), St = Pe({}), ci = V(function({ value: n, defaultValue: t, className: r, onChange: o, ...s }, i) {
3343
+ const a = ge(null), l = n !== void 0, [c, f] = Ce(t), [d, h] = Ce(/* @__PURE__ */ new Map());
3344
+ let u = o;
3345
+ return l || (u = (m) => {
3346
+ f(m), o?.(m);
3347
+ }, n = c), y(St.Provider, { value: {
3348
+ value: n,
3349
+ defaultValue: t,
3350
+ onChange: u,
3351
+ tablistRef: a,
3352
+ panelButtonMap: d,
3353
+ setPanelButtonMap: h
3354
+ }, children: y("div", { className: X("ds-tabs", r), ref: i, ...s }) });
3355
+ }), ui = V(function({ children: n, ...t }, r) {
3356
+ const { value: o, tablistRef: s } = oe(St), i = Ve([r, s]);
3357
+ return y(to, { role: "tablist", activeValue: o, orientation: "ambiguous", ref: i, ...t, children: n });
3358
+ }), di = V(function({ children: n, value: t, id: r, ...o }, s) {
3359
+ const { value: i, tablistRef: a, setPanelButtonMap: l } = oe(St), c = t === i, f = ze(), d = r ?? `tabpanel-${f}`, [h, u] = Ce(!1), [m, g] = Ce(void 0), E = ge(null), x = Ve([s, E]);
3360
+ return de(() => {
3361
+ if (!E.current)
3362
+ return;
3363
+ const v = E.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');
3364
+ u(v.length > 0);
3365
+ }, [n]), de(() => {
3366
+ if (!a)
3367
+ return;
3368
+ const v = a.current?.querySelector(`[role="tab"][data-value="${t}"]`);
3369
+ g(v ? v.id : void 0), v && l?.((b) => new Map(b).set(v.id, d));
3370
+ }, [a]), y("div", { ref: x, id: d, role: "tabpanel", tabIndex: h ? void 0 : 0, "aria-labelledby": m, hidden: !c, ...o, children: n });
3371
+ }), fi = V(function({ value: n, id: t, onClick: r, ...o }, s) {
3372
+ const i = oe(St), a = ze(), l = t ?? `tab-${a}`;
3373
+ return y(ro, { value: n, ...o, asChild: !0, children: y("button", { ref: s, id: l, "aria-selected": i.value === n, "data-value": n, role: "tab", type: "button", onClick: (c) => {
3374
+ i.onChange?.(n), r?.(c);
3375
+ }, "aria-controls": i.panelButtonMap?.get(l), ...o }) });
3376
+ }), ln = Object.assign(ci, {
3377
+ List: ui,
3378
+ Tab: fi,
3379
+ Panel: di
3380
+ });
3381
+ ln.Tab.displayName = "Tabs.Tab";
3382
+ ln.List.displayName = "Tabs.List";
3383
+ ln.Panel.displayName = "Tabs.Panel";
3384
+ const Fi = V(function({ label: n, description: t, error: r, multiline: o, prefix: s, suffix: i, "data-size": a, counter: l, style: c, className: f, ...d }, h) {
3385
+ return le(Vt, { className: f, "data-size": a, style: c, children: [!!n && y(Ne, { children: n }), !!t && y(jr, { children: t }), le(Wr, { children: [s === void 0 || y(fn, { children: s }), o === !0 ? y(Jr, { ref: h, "aria-invalid": !!r || void 0, ...d }) : y(vt, { ref: h, "aria-invalid": !!r || void 0, ...d }), i === void 0 || y(fn, { children: i })] }), !!l && y(Vt.Counter, { ...typeof l == "number" ? { limit: l } : l }), !!r && y(Ut, { children: r })] });
3386
+ });
3387
+ export {
3388
+ ao as B,
3389
+ Ni as C,
3390
+ rn as D,
3391
+ lo as L,
3392
+ sn as P,
3393
+ an as S,
3394
+ Fi as T,
3395
+ It as a,
3396
+ Rt as b,
3397
+ Pi as c,
3398
+ Di as d,
3399
+ Ar as e,
3400
+ Ai as f,
3401
+ ln as g,
3402
+ Mi as u
3403
+ };