@altinn/altinn-components 0.28.0 → 0.28.1

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