@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
@@ -1,2835 +0,0 @@
1
- import * as m from "react";
2
- import { useLayoutEffect as bn, useEffect as xn, useRef as Zn } from "react";
3
- import * as vn from "react-dom";
4
- function xt() {
5
- return typeof window < "u";
6
- }
7
- function Oe(e) {
8
- return yn(e) ? (e.nodeName || "").toLowerCase() : "#document";
9
- }
10
- function ue(e) {
11
- var t;
12
- return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
13
- }
14
- function he(e) {
15
- var t;
16
- return (t = (yn(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
17
- }
18
- function yn(e) {
19
- return xt() ? e instanceof Node || e instanceof ue(e).Node : !1;
20
- }
21
- function U(e) {
22
- return xt() ? e instanceof Element || e instanceof ue(e).Element : !1;
23
- }
24
- function X(e) {
25
- return xt() ? e instanceof HTMLElement || e instanceof ue(e).HTMLElement : !1;
26
- }
27
- function Ft(e) {
28
- return !xt() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof ue(e).ShadowRoot;
29
- }
30
- function Ze(e) {
31
- const {
32
- overflow: t,
33
- overflowX: n,
34
- overflowY: r,
35
- display: o
36
- } = le(e);
37
- return /auto|scroll|overlay|hidden|clip/.test(t + r + n) && !["inline", "contents"].includes(o);
38
- }
39
- function Jn(e) {
40
- return ["table", "td", "th"].includes(Oe(e));
41
- }
42
- function vt(e) {
43
- return [":popover-open", ":modal"].some((t) => {
44
- try {
45
- return e.matches(t);
46
- } catch {
47
- return !1;
48
- }
49
- });
50
- }
51
- function Wt(e) {
52
- const t = Bt(), n = U(e) ? le(e) : e;
53
- 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));
54
- }
55
- function Qn(e) {
56
- let t = ve(e);
57
- for (; X(t) && !Ae(t); ) {
58
- if (Wt(t))
59
- return t;
60
- if (vt(t))
61
- return null;
62
- t = ve(t);
63
- }
64
- return null;
65
- }
66
- function Bt() {
67
- return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
68
- }
69
- function Ae(e) {
70
- return ["html", "body", "#document"].includes(Oe(e));
71
- }
72
- function le(e) {
73
- return ue(e).getComputedStyle(e);
74
- }
75
- function yt(e) {
76
- return U(e) ? {
77
- scrollLeft: e.scrollLeft,
78
- scrollTop: e.scrollTop
79
- } : {
80
- scrollLeft: e.scrollX,
81
- scrollTop: e.scrollY
82
- };
83
- }
84
- function ve(e) {
85
- if (Oe(e) === "html")
86
- return e;
87
- const t = (
88
- // Step into the shadow DOM of the parent of a slotted node.
89
- e.assignedSlot || // DOM Element detected.
90
- e.parentNode || // ShadowRoot detected.
91
- Ft(e) && e.host || // Fallback.
92
- he(e)
93
- );
94
- return Ft(t) ? t.host : t;
95
- }
96
- function wn(e) {
97
- const t = ve(e);
98
- return Ae(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : X(t) && Ze(t) ? t : wn(t);
99
- }
100
- function Te(e, t, n) {
101
- var r;
102
- t === void 0 && (t = []), n === void 0 && (n = !0);
103
- const o = wn(e), i = o === ((r = e.ownerDocument) == null ? void 0 : r.body), s = ue(o);
104
- if (i) {
105
- const u = Pt(s);
106
- return t.concat(s, s.visualViewport || [], Ze(o) ? o : [], u && n ? Te(u) : []);
107
- }
108
- return t.concat(o, Te(o, [], n));
109
- }
110
- function Pt(e) {
111
- return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
112
- }
113
- function xe(e) {
114
- let t = e.activeElement;
115
- for (; ((n = t) == null || (n = n.shadowRoot) == null ? void 0 : n.activeElement) != null; ) {
116
- var n;
117
- t = t.shadowRoot.activeElement;
118
- }
119
- return t;
120
- }
121
- function ne(e, t) {
122
- if (!e || !t)
123
- return !1;
124
- const n = t.getRootNode == null ? void 0 : t.getRootNode();
125
- if (e.contains(t))
126
- return !0;
127
- if (n && Ft(n)) {
128
- let r = t;
129
- for (; r; ) {
130
- if (e === r)
131
- return !0;
132
- r = r.parentNode || r.host;
133
- }
134
- }
135
- return !1;
136
- }
137
- function Rn() {
138
- const e = navigator.userAgentData;
139
- return e != null && e.platform ? e.platform : navigator.platform;
140
- }
141
- function En() {
142
- const e = navigator.userAgentData;
143
- return e && Array.isArray(e.brands) ? e.brands.map((t) => {
144
- let {
145
- brand: n,
146
- version: r
147
- } = t;
148
- return n + "/" + r;
149
- }).join(" ") : navigator.userAgent;
150
- }
151
- function In(e) {
152
- return e.mozInputSource === 0 && e.isTrusted ? !0 : kt() && e.pointerType ? e.type === "click" && e.buttons === 1 : e.detail === 0 && !e.pointerType;
153
- }
154
- function Cn(e) {
155
- return tr() ? !1 : !kt() && e.width === 0 && e.height === 0 || kt() && e.width === 1 && e.height === 1 && e.pressure === 0 && e.detail === 0 && e.pointerType === "mouse" || // iOS VoiceOver returns 0.333• for width/height.
156
- e.width < 1 && e.height < 1 && e.pressure === 0 && e.detail === 0 && e.pointerType === "touch";
157
- }
158
- function Tn() {
159
- return /apple/i.test(navigator.vendor);
160
- }
161
- function kt() {
162
- const e = /android/i;
163
- return e.test(Rn()) || e.test(En());
164
- }
165
- function er() {
166
- return Rn().toLowerCase().startsWith("mac") && !navigator.maxTouchPoints;
167
- }
168
- function tr() {
169
- return En().includes("jsdom/");
170
- }
171
- function nr(e) {
172
- return "nativeEvent" in e;
173
- }
174
- function rr(e) {
175
- return e.matches("html,body");
176
- }
177
- function se(e) {
178
- return (e == null ? void 0 : e.ownerDocument) || document;
179
- }
180
- function Et(e, t) {
181
- if (t == null)
182
- return !1;
183
- if ("composedPath" in e)
184
- return e.composedPath().includes(t);
185
- const n = e;
186
- return n.target != null && t.contains(n.target);
187
- }
188
- function Fe(e) {
189
- return "composedPath" in e ? e.composedPath()[0] : e.target;
190
- }
191
- const or = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";
192
- function ir(e) {
193
- return X(e) && e.matches(or);
194
- }
195
- function re(e) {
196
- e.preventDefault(), e.stopPropagation();
197
- }
198
- function An(e) {
199
- return e ? e.getAttribute("role") === "combobox" && ir(e) : !1;
200
- }
201
- const Be = Math.min, ce = Math.max, lt = Math.round, Ne = Math.floor, pe = (e) => ({
202
- x: e,
203
- y: e
204
- }), sr = {
205
- left: "right",
206
- right: "left",
207
- bottom: "top",
208
- top: "bottom"
209
- }, cr = {
210
- start: "end",
211
- end: "start"
212
- };
213
- function Gt(e, t, n) {
214
- return ce(e, Be(t, n));
215
- }
216
- function Je(e, t) {
217
- return typeof e == "function" ? e(t) : e;
218
- }
219
- function Se(e) {
220
- return e.split("-")[0];
221
- }
222
- function Qe(e) {
223
- return e.split("-")[1];
224
- }
225
- function Sn(e) {
226
- return e === "x" ? "y" : "x";
227
- }
228
- function On(e) {
229
- return e === "y" ? "height" : "width";
230
- }
231
- function Pe(e) {
232
- return ["top", "bottom"].includes(Se(e)) ? "y" : "x";
233
- }
234
- function Mn(e) {
235
- return Sn(Pe(e));
236
- }
237
- function ur(e, t, n) {
238
- n === void 0 && (n = !1);
239
- const r = Qe(e), o = Mn(e), i = On(o);
240
- let s = o === "x" ? r === (n ? "end" : "start") ? "right" : "left" : r === "start" ? "bottom" : "top";
241
- return t.reference[i] > t.floating[i] && (s = at(s)), [s, at(s)];
242
- }
243
- function lr(e) {
244
- const t = at(e);
245
- return [Lt(e), t, Lt(t)];
246
- }
247
- function Lt(e) {
248
- return e.replace(/start|end/g, (t) => cr[t]);
249
- }
250
- function ar(e, t, n) {
251
- const r = ["left", "right"], o = ["right", "left"], i = ["top", "bottom"], s = ["bottom", "top"];
252
- switch (e) {
253
- case "top":
254
- case "bottom":
255
- return n ? t ? o : r : t ? r : o;
256
- case "left":
257
- case "right":
258
- return t ? i : s;
259
- default:
260
- return [];
261
- }
262
- }
263
- function fr(e, t, n, r) {
264
- const o = Qe(e);
265
- let i = ar(Se(e), n === "start", r);
266
- return o && (i = i.map((s) => s + "-" + o), t && (i = i.concat(i.map(Lt)))), i;
267
- }
268
- function at(e) {
269
- return e.replace(/left|right|bottom|top/g, (t) => sr[t]);
270
- }
271
- function dr(e) {
272
- return {
273
- top: 0,
274
- right: 0,
275
- bottom: 0,
276
- left: 0,
277
- ...e
278
- };
279
- }
280
- function mr(e) {
281
- return typeof e != "number" ? dr(e) : {
282
- top: e,
283
- right: e,
284
- bottom: e,
285
- left: e
286
- };
287
- }
288
- function ft(e) {
289
- const {
290
- x: t,
291
- y: n,
292
- width: r,
293
- height: o
294
- } = e;
295
- return {
296
- width: r,
297
- height: o,
298
- top: n,
299
- left: t,
300
- right: t + r,
301
- bottom: n + o,
302
- x: t,
303
- y: n
304
- };
305
- }
306
- /*!
307
- * tabbable 6.2.0
308
- * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
309
- */
310
- var gr = ["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__ */ gr.join(","), Dn = typeof Element > "u", _e = Dn ? function() {
311
- } : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector, mt = !Dn && Element.prototype.getRootNode ? function(e) {
312
- var t;
313
- return e == null || (t = e.getRootNode) === null || t === void 0 ? void 0 : t.call(e);
314
- } : function(e) {
315
- return e == null ? void 0 : e.ownerDocument;
316
- }, gt = function e(t, n) {
317
- var r;
318
- n === void 0 && (n = !0);
319
- 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);
320
- return s;
321
- }, pr = function(t) {
322
- var n, r = t == null || (n = t.getAttribute) === null || n === void 0 ? void 0 : n.call(t, "contenteditable");
323
- return r === "" || r === "true";
324
- }, hr = function(t, n, r) {
325
- if (gt(t))
326
- return [];
327
- var o = Array.prototype.slice.apply(t.querySelectorAll(dt));
328
- return n && _e.call(t, dt) && o.unshift(t), o = o.filter(r), o;
329
- }, br = function e(t, n, r) {
330
- for (var o = [], i = Array.from(t); i.length; ) {
331
- var s = i.shift();
332
- if (!gt(s, !1))
333
- if (s.tagName === "SLOT") {
334
- var u = s.assignedElements(), l = u.length ? u : s.children, c = e(l, !0, r);
335
- r.flatten ? o.push.apply(o, c) : o.push({
336
- scopeParent: s,
337
- candidates: c
338
- });
339
- } else {
340
- var d = _e.call(s, dt);
341
- d && r.filter(s) && (n || !t.includes(s)) && o.push(s);
342
- var a = s.shadowRoot || // check for an undisclosed shadow
343
- typeof r.getShadowRoot == "function" && r.getShadowRoot(s), p = !gt(a, !1) && (!r.shadowRootFilter || r.shadowRootFilter(s));
344
- if (a && p) {
345
- var f = e(a === !0 ? s.children : a.children, !0, r);
346
- r.flatten ? o.push.apply(o, f) : o.push({
347
- scopeParent: s,
348
- candidates: f
349
- });
350
- } else
351
- i.unshift.apply(i, s.children);
352
- }
353
- }
354
- return o;
355
- }, Fn = function(t) {
356
- return !isNaN(parseInt(t.getAttribute("tabindex"), 10));
357
- }, Pn = function(t) {
358
- if (!t)
359
- throw new Error("No node provided");
360
- return t.tabIndex < 0 && (/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName) || pr(t)) && !Fn(t) ? 0 : t.tabIndex;
361
- }, xr = function(t, n) {
362
- var r = Pn(t);
363
- return r < 0 && n && !Fn(t) ? 0 : r;
364
- }, vr = function(t, n) {
365
- return t.tabIndex === n.tabIndex ? t.documentOrder - n.documentOrder : t.tabIndex - n.tabIndex;
366
- }, kn = function(t) {
367
- return t.tagName === "INPUT";
368
- }, yr = function(t) {
369
- return kn(t) && t.type === "hidden";
370
- }, wr = function(t) {
371
- var n = t.tagName === "DETAILS" && Array.prototype.slice.apply(t.children).some(function(r) {
372
- return r.tagName === "SUMMARY";
373
- });
374
- return n;
375
- }, Rr = function(t, n) {
376
- for (var r = 0; r < t.length; r++)
377
- if (t[r].checked && t[r].form === n)
378
- return t[r];
379
- }, Er = function(t) {
380
- if (!t.name)
381
- return !0;
382
- var n = t.form || mt(t), r = function(u) {
383
- return n.querySelectorAll('input[type="radio"][name="' + u + '"]');
384
- }, o;
385
- if (typeof window < "u" && typeof window.CSS < "u" && typeof window.CSS.escape == "function")
386
- o = r(window.CSS.escape(t.name));
387
- else
388
- try {
389
- o = r(t.name);
390
- } catch (s) {
391
- 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;
392
- }
393
- var i = Rr(o, t.form);
394
- return !i || i === t;
395
- }, Ir = function(t) {
396
- return kn(t) && t.type === "radio";
397
- }, Cr = function(t) {
398
- return Ir(t) && !Er(t);
399
- }, Tr = function(t) {
400
- var n, r = t && mt(t), o = (n = r) === null || n === void 0 ? void 0 : n.host, i = !1;
401
- if (r && r !== t) {
402
- var s, u, l;
403
- for (i = !!((s = o) !== null && s !== void 0 && (u = s.ownerDocument) !== null && u !== void 0 && u.contains(o) || t != null && (l = t.ownerDocument) !== null && l !== void 0 && l.contains(t)); !i && o; ) {
404
- var c, d, a;
405
- r = mt(o), o = (c = r) === null || c === void 0 ? void 0 : c.host, i = !!((d = o) !== null && d !== void 0 && (a = d.ownerDocument) !== null && a !== void 0 && a.contains(o));
406
- }
407
- }
408
- return i;
409
- }, Xt = function(t) {
410
- var n = t.getBoundingClientRect(), r = n.width, o = n.height;
411
- return r === 0 && o === 0;
412
- }, Ar = function(t, n) {
413
- var r = n.displayCheck, o = n.getShadowRoot;
414
- if (getComputedStyle(t).visibility === "hidden")
415
- return !0;
416
- var i = _e.call(t, "details>summary:first-of-type"), s = i ? t.parentElement : t;
417
- if (_e.call(s, "details:not([open]) *"))
418
- return !0;
419
- if (!r || r === "full" || r === "legacy-full") {
420
- if (typeof o == "function") {
421
- for (var u = t; t; ) {
422
- var l = t.parentElement, c = mt(t);
423
- if (l && !l.shadowRoot && o(l) === !0)
424
- return Xt(t);
425
- t.assignedSlot ? t = t.assignedSlot : !l && c !== t.ownerDocument ? t = c.host : t = l;
426
- }
427
- t = u;
428
- }
429
- if (Tr(t))
430
- return !t.getClientRects().length;
431
- if (r !== "legacy-full")
432
- return !0;
433
- } else if (r === "non-zero-area")
434
- return Xt(t);
435
- return !1;
436
- }, Sr = function(t) {
437
- if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))
438
- for (var n = t.parentElement; n; ) {
439
- if (n.tagName === "FIELDSET" && n.disabled) {
440
- for (var r = 0; r < n.children.length; r++) {
441
- var o = n.children.item(r);
442
- if (o.tagName === "LEGEND")
443
- return _e.call(n, "fieldset[disabled] *") ? !0 : !o.contains(t);
444
- }
445
- return !0;
446
- }
447
- n = n.parentElement;
448
- }
449
- return !1;
450
- }, Or = function(t, n) {
451
- return !(n.disabled || // we must do an inert look up to filter out any elements inside an inert ancestor
452
- // because we're limited in the type of selectors we can use in JSDom (see related
453
- // note related to `candidateSelectors`)
454
- gt(n) || yr(n) || Ar(n, t) || // For a details element with a summary, the summary element gets the focus
455
- wr(n) || Sr(n));
456
- }, Nt = function(t, n) {
457
- return !(Cr(n) || Pn(n) < 0 || !Or(t, n));
458
- }, Mr = function(t) {
459
- var n = parseInt(t.getAttribute("tabindex"), 10);
460
- return !!(isNaN(n) || n >= 0);
461
- }, Dr = function e(t) {
462
- var n = [], r = [];
463
- return t.forEach(function(o, i) {
464
- var s = !!o.scopeParent, u = s ? o.scopeParent : o, l = xr(u, s), c = s ? e(o.candidates) : u;
465
- l === 0 ? s ? n.push.apply(n, c) : n.push(u) : r.push({
466
- documentOrder: i,
467
- tabIndex: l,
468
- item: o,
469
- isScope: s,
470
- content: c
471
- });
472
- }), r.sort(vr).reduce(function(o, i) {
473
- return i.isScope ? o.push.apply(o, i.content) : o.push(i.content), o;
474
- }, []).concat(n);
475
- }, Ge = function(t, n) {
476
- n = n || {};
477
- var r;
478
- return n.getShadowRoot ? r = br([t], n.includeContainer, {
479
- filter: Nt.bind(null, n),
480
- flatten: !1,
481
- getShadowRoot: n.getShadowRoot,
482
- shadowRootFilter: Mr
483
- }) : r = hr(t, n.includeContainer, Nt.bind(null, n)), Dr(r);
484
- }, Fr = function(t, n) {
485
- if (n = n || {}, !t)
486
- throw new Error("No node provided");
487
- return _e.call(t, dt) === !1 ? !1 : Nt(n, t);
488
- };
489
- function Zt(e, t, n) {
490
- let {
491
- reference: r,
492
- floating: o
493
- } = e;
494
- const i = Pe(t), s = Mn(t), u = On(s), l = Se(t), c = i === "y", d = r.x + r.width / 2 - o.width / 2, a = r.y + r.height / 2 - o.height / 2, p = r[u] / 2 - o[u] / 2;
495
- let f;
496
- switch (l) {
497
- case "top":
498
- f = {
499
- x: d,
500
- y: r.y - o.height
501
- };
502
- break;
503
- case "bottom":
504
- f = {
505
- x: d,
506
- y: r.y + r.height
507
- };
508
- break;
509
- case "right":
510
- f = {
511
- x: r.x + r.width,
512
- y: a
513
- };
514
- break;
515
- case "left":
516
- f = {
517
- x: r.x - o.width,
518
- y: a
519
- };
520
- break;
521
- default:
522
- f = {
523
- x: r.x,
524
- y: r.y
525
- };
526
- }
527
- switch (Qe(t)) {
528
- case "start":
529
- f[s] -= p * (n && c ? -1 : 1);
530
- break;
531
- case "end":
532
- f[s] += p * (n && c ? -1 : 1);
533
- break;
534
- }
535
- return f;
536
- }
537
- const Pr = async (e, t, n) => {
538
- const {
539
- placement: r = "bottom",
540
- strategy: o = "absolute",
541
- middleware: i = [],
542
- platform: s
543
- } = n, u = i.filter(Boolean), l = await (s.isRTL == null ? void 0 : s.isRTL(t));
544
- let c = await s.getElementRects({
545
- reference: e,
546
- floating: t,
547
- strategy: o
548
- }), {
549
- x: d,
550
- y: a
551
- } = Zt(c, r, l), p = r, f = {}, g = 0;
552
- for (let h = 0; h < u.length; h++) {
553
- const {
554
- name: v,
555
- fn: x
556
- } = u[h], {
557
- x: R,
558
- y: b,
559
- data: w,
560
- reset: D
561
- } = await x({
562
- x: d,
563
- y: a,
564
- initialPlacement: r,
565
- placement: p,
566
- strategy: o,
567
- middlewareData: f,
568
- rects: c,
569
- platform: s,
570
- elements: {
571
- reference: e,
572
- floating: t
573
- }
574
- });
575
- d = R ?? d, a = b ?? a, f = {
576
- ...f,
577
- [v]: {
578
- ...f[v],
579
- ...w
580
- }
581
- }, D && g <= 50 && (g++, typeof D == "object" && (D.placement && (p = D.placement), D.rects && (c = D.rects === !0 ? await s.getElementRects({
582
- reference: e,
583
- floating: t,
584
- strategy: o
585
- }) : D.rects), {
586
- x: d,
587
- y: a
588
- } = Zt(c, p, l)), h = -1);
589
- }
590
- return {
591
- x: d,
592
- y: a,
593
- placement: p,
594
- strategy: o,
595
- middlewareData: f
596
- };
597
- };
598
- async function _t(e, t) {
599
- var n;
600
- t === void 0 && (t = {});
601
- const {
602
- x: r,
603
- y: o,
604
- platform: i,
605
- rects: s,
606
- elements: u,
607
- strategy: l
608
- } = e, {
609
- boundary: c = "clippingAncestors",
610
- rootBoundary: d = "viewport",
611
- elementContext: a = "floating",
612
- altBoundary: p = !1,
613
- padding: f = 0
614
- } = Je(t, e), g = mr(f), v = u[p ? a === "floating" ? "reference" : "floating" : a], x = ft(await i.getClippingRect({
615
- element: (n = await (i.isElement == null ? void 0 : i.isElement(v))) == null || n ? v : v.contextElement || await (i.getDocumentElement == null ? void 0 : i.getDocumentElement(u.floating)),
616
- boundary: c,
617
- rootBoundary: d,
618
- strategy: l
619
- })), R = a === "floating" ? {
620
- x: r,
621
- y: o,
622
- width: s.floating.width,
623
- height: s.floating.height
624
- } : s.reference, b = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(u.floating)), w = await (i.isElement == null ? void 0 : i.isElement(b)) ? await (i.getScale == null ? void 0 : i.getScale(b)) || {
625
- x: 1,
626
- y: 1
627
- } : {
628
- x: 1,
629
- y: 1
630
- }, D = ft(i.convertOffsetParentRelativeRectToViewportRelativeRect ? await i.convertOffsetParentRelativeRectToViewportRelativeRect({
631
- elements: u,
632
- rect: R,
633
- offsetParent: b,
634
- strategy: l
635
- }) : R);
636
- return {
637
- top: (x.top - D.top + g.top) / w.y,
638
- bottom: (D.bottom - x.bottom + g.bottom) / w.y,
639
- left: (x.left - D.left + g.left) / w.x,
640
- right: (D.right - x.right + g.right) / w.x
641
- };
642
- }
643
- const kr = function(e) {
644
- return e === void 0 && (e = {}), {
645
- name: "flip",
646
- options: e,
647
- async fn(t) {
648
- var n, r;
649
- const {
650
- placement: o,
651
- middlewareData: i,
652
- rects: s,
653
- initialPlacement: u,
654
- platform: l,
655
- elements: c
656
- } = t, {
657
- mainAxis: d = !0,
658
- crossAxis: a = !0,
659
- fallbackPlacements: p,
660
- fallbackStrategy: f = "bestFit",
661
- fallbackAxisSideDirection: g = "none",
662
- flipAlignment: h = !0,
663
- ...v
664
- } = Je(e, t);
665
- if ((n = i.arrow) != null && n.alignmentOffset)
666
- return {};
667
- const x = Se(o), R = Pe(u), b = Se(u) === u, w = await (l.isRTL == null ? void 0 : l.isRTL(c.floating)), D = p || (b || !h ? [at(u)] : lr(u)), k = g !== "none";
668
- !p && k && D.push(...fr(u, h, g, w));
669
- const B = [u, ...D], W = await _t(t, v), Z = [];
670
- let H = ((r = i.flip) == null ? void 0 : r.overflows) || [];
671
- if (d && Z.push(W[x]), a) {
672
- const T = ur(o, s, w);
673
- Z.push(W[T[0]], W[T[1]]);
674
- }
675
- if (H = [...H, {
676
- placement: o,
677
- overflows: Z
678
- }], !Z.every((T) => T <= 0)) {
679
- var $, C;
680
- const T = ((($ = i.flip) == null ? void 0 : $.index) || 0) + 1, y = B[T];
681
- if (y)
682
- return {
683
- data: {
684
- index: T,
685
- overflows: H
686
- },
687
- reset: {
688
- placement: y
689
- }
690
- };
691
- let O = (C = H.filter((F) => F.overflows[0] <= 0).sort((F, I) => F.overflows[1] - I.overflows[1])[0]) == null ? void 0 : C.placement;
692
- if (!O)
693
- switch (f) {
694
- case "bestFit": {
695
- var L;
696
- const F = (L = H.filter((I) => {
697
- if (k) {
698
- const E = Pe(I.placement);
699
- return E === R || // Create a bias to the `y` side axis due to horizontal
700
- // reading directions favoring greater width.
701
- E === "y";
702
- }
703
- return !0;
704
- }).map((I) => [I.placement, I.overflows.filter((E) => E > 0).reduce((E, _) => E + _, 0)]).sort((I, E) => I[1] - E[1])[0]) == null ? void 0 : L[0];
705
- F && (O = F);
706
- break;
707
- }
708
- case "initialPlacement":
709
- O = u;
710
- break;
711
- }
712
- if (o !== O)
713
- return {
714
- reset: {
715
- placement: O
716
- }
717
- };
718
- }
719
- return {};
720
- }
721
- };
722
- };
723
- async function Lr(e, t) {
724
- const {
725
- placement: n,
726
- platform: r,
727
- elements: o
728
- } = e, i = await (r.isRTL == null ? void 0 : r.isRTL(o.floating)), s = Se(n), u = Qe(n), l = Pe(n) === "y", c = ["left", "top"].includes(s) ? -1 : 1, d = i && l ? -1 : 1, a = Je(t, e);
729
- let {
730
- mainAxis: p,
731
- crossAxis: f,
732
- alignmentAxis: g
733
- } = typeof a == "number" ? {
734
- mainAxis: a,
735
- crossAxis: 0,
736
- alignmentAxis: null
737
- } : {
738
- mainAxis: a.mainAxis || 0,
739
- crossAxis: a.crossAxis || 0,
740
- alignmentAxis: a.alignmentAxis
741
- };
742
- return u && typeof g == "number" && (f = u === "end" ? g * -1 : g), l ? {
743
- x: f * d,
744
- y: p * c
745
- } : {
746
- x: p * c,
747
- y: f * d
748
- };
749
- }
750
- const Nr = function(e) {
751
- return e === void 0 && (e = 0), {
752
- name: "offset",
753
- options: e,
754
- async fn(t) {
755
- var n, r;
756
- const {
757
- x: o,
758
- y: i,
759
- placement: s,
760
- middlewareData: u
761
- } = t, l = await Lr(t, e);
762
- return s === ((n = u.offset) == null ? void 0 : n.placement) && (r = u.arrow) != null && r.alignmentOffset ? {} : {
763
- x: o + l.x,
764
- y: i + l.y,
765
- data: {
766
- ...l,
767
- placement: s
768
- }
769
- };
770
- }
771
- };
772
- }, Vr = function(e) {
773
- return e === void 0 && (e = {}), {
774
- name: "shift",
775
- options: e,
776
- async fn(t) {
777
- const {
778
- x: n,
779
- y: r,
780
- placement: o
781
- } = t, {
782
- mainAxis: i = !0,
783
- crossAxis: s = !1,
784
- limiter: u = {
785
- fn: (v) => {
786
- let {
787
- x,
788
- y: R
789
- } = v;
790
- return {
791
- x,
792
- y: R
793
- };
794
- }
795
- },
796
- ...l
797
- } = Je(e, t), c = {
798
- x: n,
799
- y: r
800
- }, d = await _t(t, l), a = Pe(Se(o)), p = Sn(a);
801
- let f = c[p], g = c[a];
802
- if (i) {
803
- const v = p === "y" ? "top" : "left", x = p === "y" ? "bottom" : "right", R = f + d[v], b = f - d[x];
804
- f = Gt(R, f, b);
805
- }
806
- if (s) {
807
- const v = a === "y" ? "top" : "left", x = a === "y" ? "bottom" : "right", R = g + d[v], b = g - d[x];
808
- g = Gt(R, g, b);
809
- }
810
- const h = u.fn({
811
- ...t,
812
- [p]: f,
813
- [a]: g
814
- });
815
- return {
816
- ...h,
817
- data: {
818
- x: h.x - n,
819
- y: h.y - r,
820
- enabled: {
821
- [p]: i,
822
- [a]: s
823
- }
824
- }
825
- };
826
- }
827
- };
828
- }, Wr = function(e) {
829
- return e === void 0 && (e = {}), {
830
- name: "size",
831
- options: e,
832
- async fn(t) {
833
- var n, r;
834
- const {
835
- placement: o,
836
- rects: i,
837
- platform: s,
838
- elements: u
839
- } = t, {
840
- apply: l = () => {
841
- },
842
- ...c
843
- } = Je(e, t), d = await _t(t, c), a = Se(o), p = Qe(o), f = Pe(o) === "y", {
844
- width: g,
845
- height: h
846
- } = i.floating;
847
- let v, x;
848
- a === "top" || a === "bottom" ? (v = a, x = p === (await (s.isRTL == null ? void 0 : s.isRTL(u.floating)) ? "start" : "end") ? "left" : "right") : (x = a, v = p === "end" ? "top" : "bottom");
849
- const R = h - d.top - d.bottom, b = g - d.left - d.right, w = Be(h - d[v], R), D = Be(g - d[x], b), k = !t.middlewareData.shift;
850
- let B = w, W = D;
851
- if ((n = t.middlewareData.shift) != null && n.enabled.x && (W = b), (r = t.middlewareData.shift) != null && r.enabled.y && (B = R), k && !p) {
852
- const H = ce(d.left, 0), $ = ce(d.right, 0), C = ce(d.top, 0), L = ce(d.bottom, 0);
853
- f ? W = g - 2 * (H !== 0 || $ !== 0 ? H + $ : ce(d.left, d.right)) : B = h - 2 * (C !== 0 || L !== 0 ? C + L : ce(d.top, d.bottom));
854
- }
855
- await l({
856
- ...t,
857
- availableWidth: W,
858
- availableHeight: B
859
- });
860
- const Z = await s.getDimensions(u.floating);
861
- return g !== Z.width || h !== Z.height ? {
862
- reset: {
863
- rects: !0
864
- }
865
- } : {};
866
- }
867
- };
868
- };
869
- function Ln(e) {
870
- const t = le(e);
871
- let n = parseFloat(t.width) || 0, r = parseFloat(t.height) || 0;
872
- const o = X(e), i = o ? e.offsetWidth : n, s = o ? e.offsetHeight : r, u = lt(n) !== i || lt(r) !== s;
873
- return u && (n = i, r = s), {
874
- width: n,
875
- height: r,
876
- $: u
877
- };
878
- }
879
- function $t(e) {
880
- return U(e) ? e : e.contextElement;
881
- }
882
- function Ve(e) {
883
- const t = $t(e);
884
- if (!X(t))
885
- return pe(1);
886
- const n = t.getBoundingClientRect(), {
887
- width: r,
888
- height: o,
889
- $: i
890
- } = Ln(t);
891
- let s = (i ? lt(n.width) : n.width) / r, u = (i ? lt(n.height) : n.height) / o;
892
- return (!s || !Number.isFinite(s)) && (s = 1), (!u || !Number.isFinite(u)) && (u = 1), {
893
- x: s,
894
- y: u
895
- };
896
- }
897
- const Br = /* @__PURE__ */ pe(0);
898
- function Nn(e) {
899
- const t = ue(e);
900
- return !Bt() || !t.visualViewport ? Br : {
901
- x: t.visualViewport.offsetLeft,
902
- y: t.visualViewport.offsetTop
903
- };
904
- }
905
- function _r(e, t, n) {
906
- return t === void 0 && (t = !1), !n || t && n !== ue(e) ? !1 : t;
907
- }
908
- function ke(e, t, n, r) {
909
- t === void 0 && (t = !1), n === void 0 && (n = !1);
910
- const o = e.getBoundingClientRect(), i = $t(e);
911
- let s = pe(1);
912
- t && (r ? U(r) && (s = Ve(r)) : s = Ve(e));
913
- const u = _r(i, n, r) ? Nn(i) : pe(0);
914
- let l = (o.left + u.x) / s.x, c = (o.top + u.y) / s.y, d = o.width / s.x, a = o.height / s.y;
915
- if (i) {
916
- const p = ue(i), f = r && U(r) ? ue(r) : r;
917
- let g = p, h = Pt(g);
918
- for (; h && r && f !== g; ) {
919
- const v = Ve(h), x = h.getBoundingClientRect(), R = le(h), b = x.left + (h.clientLeft + parseFloat(R.paddingLeft)) * v.x, w = x.top + (h.clientTop + parseFloat(R.paddingTop)) * v.y;
920
- l *= v.x, c *= v.y, d *= v.x, a *= v.y, l += b, c += w, g = ue(h), h = Pt(g);
921
- }
922
- }
923
- return ft({
924
- width: d,
925
- height: a,
926
- x: l,
927
- y: c
928
- });
929
- }
930
- function Kt(e, t) {
931
- const n = yt(e).scrollLeft;
932
- return t ? t.left + n : ke(he(e)).left + n;
933
- }
934
- function Vn(e, t, n) {
935
- n === void 0 && (n = !1);
936
- const r = e.getBoundingClientRect(), o = r.left + t.scrollLeft - (n ? 0 : (
937
- // RTL <body> scrollbar.
938
- Kt(e, r)
939
- )), i = r.top + t.scrollTop;
940
- return {
941
- x: o,
942
- y: i
943
- };
944
- }
945
- function $r(e) {
946
- let {
947
- elements: t,
948
- rect: n,
949
- offsetParent: r,
950
- strategy: o
951
- } = e;
952
- const i = o === "fixed", s = he(r), u = t ? vt(t.floating) : !1;
953
- if (r === s || u && i)
954
- return n;
955
- let l = {
956
- scrollLeft: 0,
957
- scrollTop: 0
958
- }, c = pe(1);
959
- const d = pe(0), a = X(r);
960
- if ((a || !a && !i) && ((Oe(r) !== "body" || Ze(s)) && (l = yt(r)), X(r))) {
961
- const f = ke(r);
962
- c = Ve(r), d.x = f.x + r.clientLeft, d.y = f.y + r.clientTop;
963
- }
964
- const p = s && !a && !i ? Vn(s, l, !0) : pe(0);
965
- return {
966
- width: n.width * c.x,
967
- height: n.height * c.y,
968
- x: n.x * c.x - l.scrollLeft * c.x + d.x + p.x,
969
- y: n.y * c.y - l.scrollTop * c.y + d.y + p.y
970
- };
971
- }
972
- function Kr(e) {
973
- return Array.from(e.getClientRects());
974
- }
975
- function Hr(e) {
976
- const t = he(e), n = yt(e), r = e.ownerDocument.body, o = ce(t.scrollWidth, t.clientWidth, r.scrollWidth, r.clientWidth), i = ce(t.scrollHeight, t.clientHeight, r.scrollHeight, r.clientHeight);
977
- let s = -n.scrollLeft + Kt(e);
978
- const u = -n.scrollTop;
979
- return le(r).direction === "rtl" && (s += ce(t.clientWidth, r.clientWidth) - o), {
980
- width: o,
981
- height: i,
982
- x: s,
983
- y: u
984
- };
985
- }
986
- function zr(e, t) {
987
- const n = ue(e), r = he(e), o = n.visualViewport;
988
- let i = r.clientWidth, s = r.clientHeight, u = 0, l = 0;
989
- if (o) {
990
- i = o.width, s = o.height;
991
- const c = Bt();
992
- (!c || c && t === "fixed") && (u = o.offsetLeft, l = o.offsetTop);
993
- }
994
- return {
995
- width: i,
996
- height: s,
997
- x: u,
998
- y: l
999
- };
1000
- }
1001
- function qr(e, t) {
1002
- const n = ke(e, !0, t === "fixed"), r = n.top + e.clientTop, o = n.left + e.clientLeft, i = X(e) ? Ve(e) : pe(1), s = e.clientWidth * i.x, u = e.clientHeight * i.y, l = o * i.x, c = r * i.y;
1003
- return {
1004
- width: s,
1005
- height: u,
1006
- x: l,
1007
- y: c
1008
- };
1009
- }
1010
- function Jt(e, t, n) {
1011
- let r;
1012
- if (t === "viewport")
1013
- r = zr(e, n);
1014
- else if (t === "document")
1015
- r = Hr(he(e));
1016
- else if (U(t))
1017
- r = qr(t, n);
1018
- else {
1019
- const o = Nn(e);
1020
- r = {
1021
- x: t.x - o.x,
1022
- y: t.y - o.y,
1023
- width: t.width,
1024
- height: t.height
1025
- };
1026
- }
1027
- return ft(r);
1028
- }
1029
- function Wn(e, t) {
1030
- const n = ve(e);
1031
- return n === t || !U(n) || Ae(n) ? !1 : le(n).position === "fixed" || Wn(n, t);
1032
- }
1033
- function jr(e, t) {
1034
- const n = t.get(e);
1035
- if (n)
1036
- return n;
1037
- let r = Te(e, [], !1).filter((u) => U(u) && Oe(u) !== "body"), o = null;
1038
- const i = le(e).position === "fixed";
1039
- let s = i ? ve(e) : e;
1040
- for (; U(s) && !Ae(s); ) {
1041
- const u = le(s), l = Wt(s);
1042
- !l && u.position === "fixed" && (o = null), (i ? !l && !o : !l && u.position === "static" && !!o && ["absolute", "fixed"].includes(o.position) || Ze(s) && !l && Wn(e, s)) ? r = r.filter((d) => d !== s) : o = u, s = ve(s);
1043
- }
1044
- return t.set(e, r), r;
1045
- }
1046
- function Ur(e) {
1047
- let {
1048
- element: t,
1049
- boundary: n,
1050
- rootBoundary: r,
1051
- strategy: o
1052
- } = e;
1053
- const s = [...n === "clippingAncestors" ? vt(t) ? [] : jr(t, this._c) : [].concat(n), r], u = s[0], l = s.reduce((c, d) => {
1054
- const a = Jt(t, d, o);
1055
- return c.top = ce(a.top, c.top), c.right = Be(a.right, c.right), c.bottom = Be(a.bottom, c.bottom), c.left = ce(a.left, c.left), c;
1056
- }, Jt(t, u, o));
1057
- return {
1058
- width: l.right - l.left,
1059
- height: l.bottom - l.top,
1060
- x: l.left,
1061
- y: l.top
1062
- };
1063
- }
1064
- function Yr(e) {
1065
- const {
1066
- width: t,
1067
- height: n
1068
- } = Ln(e);
1069
- return {
1070
- width: t,
1071
- height: n
1072
- };
1073
- }
1074
- function Gr(e, t, n) {
1075
- const r = X(t), o = he(t), i = n === "fixed", s = ke(e, !0, i, t);
1076
- let u = {
1077
- scrollLeft: 0,
1078
- scrollTop: 0
1079
- };
1080
- const l = pe(0);
1081
- if (r || !r && !i)
1082
- if ((Oe(t) !== "body" || Ze(o)) && (u = yt(t)), r) {
1083
- const p = ke(t, !0, i, t);
1084
- l.x = p.x + t.clientLeft, l.y = p.y + t.clientTop;
1085
- } else o && (l.x = Kt(o));
1086
- const c = o && !r && !i ? Vn(o, u) : pe(0), d = s.left + u.scrollLeft - l.x - c.x, a = s.top + u.scrollTop - l.y - c.y;
1087
- return {
1088
- x: d,
1089
- y: a,
1090
- width: s.width,
1091
- height: s.height
1092
- };
1093
- }
1094
- function It(e) {
1095
- return le(e).position === "static";
1096
- }
1097
- function Qt(e, t) {
1098
- if (!X(e) || le(e).position === "fixed")
1099
- return null;
1100
- if (t)
1101
- return t(e);
1102
- let n = e.offsetParent;
1103
- return he(e) === n && (n = n.ownerDocument.body), n;
1104
- }
1105
- function Bn(e, t) {
1106
- const n = ue(e);
1107
- if (vt(e))
1108
- return n;
1109
- if (!X(e)) {
1110
- let o = ve(e);
1111
- for (; o && !Ae(o); ) {
1112
- if (U(o) && !It(o))
1113
- return o;
1114
- o = ve(o);
1115
- }
1116
- return n;
1117
- }
1118
- let r = Qt(e, t);
1119
- for (; r && Jn(r) && It(r); )
1120
- r = Qt(r, t);
1121
- return r && Ae(r) && It(r) && !Wt(r) ? n : r || Qn(e) || n;
1122
- }
1123
- const Xr = async function(e) {
1124
- const t = this.getOffsetParent || Bn, n = this.getDimensions, r = await n(e.floating);
1125
- return {
1126
- reference: Gr(e.reference, await t(e.floating), e.strategy),
1127
- floating: {
1128
- x: 0,
1129
- y: 0,
1130
- width: r.width,
1131
- height: r.height
1132
- }
1133
- };
1134
- };
1135
- function Zr(e) {
1136
- return le(e).direction === "rtl";
1137
- }
1138
- const Jr = {
1139
- convertOffsetParentRelativeRectToViewportRelativeRect: $r,
1140
- getDocumentElement: he,
1141
- getClippingRect: Ur,
1142
- getOffsetParent: Bn,
1143
- getElementRects: Xr,
1144
- getClientRects: Kr,
1145
- getDimensions: Yr,
1146
- getScale: Ve,
1147
- isElement: U,
1148
- isRTL: Zr
1149
- };
1150
- function _n(e, t) {
1151
- return e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height;
1152
- }
1153
- function Qr(e, t) {
1154
- let n = null, r;
1155
- const o = he(e);
1156
- function i() {
1157
- var u;
1158
- clearTimeout(r), (u = n) == null || u.disconnect(), n = null;
1159
- }
1160
- function s(u, l) {
1161
- u === void 0 && (u = !1), l === void 0 && (l = 1), i();
1162
- const c = e.getBoundingClientRect(), {
1163
- left: d,
1164
- top: a,
1165
- width: p,
1166
- height: f
1167
- } = c;
1168
- if (u || t(), !p || !f)
1169
- return;
1170
- const g = Ne(a), h = Ne(o.clientWidth - (d + p)), v = Ne(o.clientHeight - (a + f)), x = Ne(d), b = {
1171
- rootMargin: -g + "px " + -h + "px " + -v + "px " + -x + "px",
1172
- threshold: ce(0, Be(1, l)) || 1
1173
- };
1174
- let w = !0;
1175
- function D(k) {
1176
- const B = k[0].intersectionRatio;
1177
- if (B !== l) {
1178
- if (!w)
1179
- return s();
1180
- B ? s(!1, B) : r = setTimeout(() => {
1181
- s(!1, 1e-7);
1182
- }, 1e3);
1183
- }
1184
- B === 1 && !_n(c, e.getBoundingClientRect()) && s(), w = !1;
1185
- }
1186
- try {
1187
- n = new IntersectionObserver(D, {
1188
- ...b,
1189
- // Handle <iframe>s
1190
- root: o.ownerDocument
1191
- });
1192
- } catch {
1193
- n = new IntersectionObserver(D, b);
1194
- }
1195
- n.observe(e);
1196
- }
1197
- return s(!0), i;
1198
- }
1199
- function No(e, t, n, r) {
1200
- r === void 0 && (r = {});
1201
- const {
1202
- ancestorScroll: o = !0,
1203
- ancestorResize: i = !0,
1204
- elementResize: s = typeof ResizeObserver == "function",
1205
- layoutShift: u = typeof IntersectionObserver == "function",
1206
- animationFrame: l = !1
1207
- } = r, c = $t(e), d = o || i ? [...c ? Te(c) : [], ...Te(t)] : [];
1208
- d.forEach((x) => {
1209
- o && x.addEventListener("scroll", n, {
1210
- passive: !0
1211
- }), i && x.addEventListener("resize", n);
1212
- });
1213
- const a = c && u ? Qr(c, n) : null;
1214
- let p = -1, f = null;
1215
- s && (f = new ResizeObserver((x) => {
1216
- let [R] = x;
1217
- R && R.target === c && f && (f.unobserve(t), cancelAnimationFrame(p), p = requestAnimationFrame(() => {
1218
- var b;
1219
- (b = f) == null || b.observe(t);
1220
- })), n();
1221
- }), c && !l && f.observe(c), f.observe(t));
1222
- let g, h = l ? ke(e) : null;
1223
- l && v();
1224
- function v() {
1225
- const x = ke(e);
1226
- h && !_n(h, x) && n(), h = x, g = requestAnimationFrame(v);
1227
- }
1228
- return n(), () => {
1229
- var x;
1230
- d.forEach((R) => {
1231
- o && R.removeEventListener("scroll", n), i && R.removeEventListener("resize", n);
1232
- }), a == null || a(), (x = f) == null || x.disconnect(), f = null, l && cancelAnimationFrame(g);
1233
- };
1234
- }
1235
- const eo = Nr, Vo = Vr, to = kr, no = Wr, ro = (e, t, n) => {
1236
- const r = /* @__PURE__ */ new Map(), o = {
1237
- platform: Jr,
1238
- ...n
1239
- }, i = {
1240
- ...o.platform,
1241
- _c: r
1242
- };
1243
- return Pr(e, t, {
1244
- ...o,
1245
- platform: i
1246
- });
1247
- };
1248
- var ct = typeof document < "u" ? bn : xn;
1249
- function pt(e, t) {
1250
- if (e === t)
1251
- return !0;
1252
- if (typeof e != typeof t)
1253
- return !1;
1254
- if (typeof e == "function" && e.toString() === t.toString())
1255
- return !0;
1256
- let n, r, o;
1257
- if (e && t && typeof e == "object") {
1258
- if (Array.isArray(e)) {
1259
- if (n = e.length, n !== t.length) return !1;
1260
- for (r = n; r-- !== 0; )
1261
- if (!pt(e[r], t[r]))
1262
- return !1;
1263
- return !0;
1264
- }
1265
- if (o = Object.keys(e), n = o.length, n !== Object.keys(t).length)
1266
- return !1;
1267
- for (r = n; r-- !== 0; )
1268
- if (!{}.hasOwnProperty.call(t, o[r]))
1269
- return !1;
1270
- for (r = n; r-- !== 0; ) {
1271
- const i = o[r];
1272
- if (!(i === "_owner" && e.$$typeof) && !pt(e[i], t[i]))
1273
- return !1;
1274
- }
1275
- return !0;
1276
- }
1277
- return e !== e && t !== t;
1278
- }
1279
- function $n(e) {
1280
- return typeof window > "u" ? 1 : (e.ownerDocument.defaultView || window).devicePixelRatio || 1;
1281
- }
1282
- function en(e, t) {
1283
- const n = $n(e);
1284
- return Math.round(t * n) / n;
1285
- }
1286
- function Ct(e) {
1287
- const t = m.useRef(e);
1288
- return ct(() => {
1289
- t.current = e;
1290
- }), t;
1291
- }
1292
- function oo(e) {
1293
- e === void 0 && (e = {});
1294
- const {
1295
- placement: t = "bottom",
1296
- strategy: n = "absolute",
1297
- middleware: r = [],
1298
- platform: o,
1299
- elements: {
1300
- reference: i,
1301
- floating: s
1302
- } = {},
1303
- transform: u = !0,
1304
- whileElementsMounted: l,
1305
- open: c
1306
- } = e, [d, a] = m.useState({
1307
- x: 0,
1308
- y: 0,
1309
- strategy: n,
1310
- placement: t,
1311
- middlewareData: {},
1312
- isPositioned: !1
1313
- }), [p, f] = m.useState(r);
1314
- pt(p, r) || f(r);
1315
- const [g, h] = m.useState(null), [v, x] = m.useState(null), R = m.useCallback((I) => {
1316
- I !== k.current && (k.current = I, h(I));
1317
- }, []), b = m.useCallback((I) => {
1318
- I !== B.current && (B.current = I, x(I));
1319
- }, []), w = i || g, D = s || v, k = m.useRef(null), B = m.useRef(null), W = m.useRef(d), Z = l != null, H = Ct(l), $ = Ct(o), C = Ct(c), L = m.useCallback(() => {
1320
- if (!k.current || !B.current)
1321
- return;
1322
- const I = {
1323
- placement: t,
1324
- strategy: n,
1325
- middleware: p
1326
- };
1327
- $.current && (I.platform = $.current), ro(k.current, B.current, I).then((E) => {
1328
- const _ = {
1329
- ...E,
1330
- // The floating element's position may be recomputed while it's closed
1331
- // but still mounted (such as when transitioning out). To ensure
1332
- // `isPositioned` will be `false` initially on the next open, avoid
1333
- // setting it to `true` when `open === false` (must be specified).
1334
- isPositioned: C.current !== !1
1335
- };
1336
- T.current && !pt(W.current, _) && (W.current = _, vn.flushSync(() => {
1337
- a(_);
1338
- }));
1339
- });
1340
- }, [p, t, n, $, C]);
1341
- ct(() => {
1342
- c === !1 && W.current.isPositioned && (W.current.isPositioned = !1, a((I) => ({
1343
- ...I,
1344
- isPositioned: !1
1345
- })));
1346
- }, [c]);
1347
- const T = m.useRef(!1);
1348
- ct(() => (T.current = !0, () => {
1349
- T.current = !1;
1350
- }), []), ct(() => {
1351
- if (w && (k.current = w), D && (B.current = D), w && D) {
1352
- if (H.current)
1353
- return H.current(w, D, L);
1354
- L();
1355
- }
1356
- }, [w, D, L, H, Z]);
1357
- const y = m.useMemo(() => ({
1358
- reference: k,
1359
- floating: B,
1360
- setReference: R,
1361
- setFloating: b
1362
- }), [R, b]), O = m.useMemo(() => ({
1363
- reference: w,
1364
- floating: D
1365
- }), [w, D]), F = m.useMemo(() => {
1366
- const I = {
1367
- position: n,
1368
- left: 0,
1369
- top: 0
1370
- };
1371
- if (!O.floating)
1372
- return I;
1373
- const E = en(O.floating, d.x), _ = en(O.floating, d.y);
1374
- return u ? {
1375
- ...I,
1376
- transform: "translate(" + E + "px, " + _ + "px)",
1377
- ...$n(O.floating) >= 1.5 && {
1378
- willChange: "transform"
1379
- }
1380
- } : {
1381
- position: n,
1382
- left: E,
1383
- top: _
1384
- };
1385
- }, [n, u, O.floating, d.x, d.y]);
1386
- return m.useMemo(() => ({
1387
- ...d,
1388
- update: L,
1389
- refs: y,
1390
- elements: O,
1391
- floatingStyles: F
1392
- }), [d, L, y, O, F]);
1393
- }
1394
- const Wo = (e, t) => ({
1395
- ...eo(e),
1396
- options: [e, t]
1397
- }), Bo = (e, t) => ({
1398
- ...to(e),
1399
- options: [e, t]
1400
- }), _o = (e, t) => ({
1401
- ...no(e),
1402
- options: [e, t]
1403
- });
1404
- function $o(e) {
1405
- return m.useMemo(() => e.every((t) => t == null) ? null : (t) => {
1406
- e.forEach((n) => {
1407
- typeof n == "function" ? n(t) : n != null && (n.current = t);
1408
- });
1409
- }, e);
1410
- }
1411
- const Kn = {
1412
- ...m
1413
- }, io = Kn.useInsertionEffect, so = io || ((e) => e());
1414
- function fe(e) {
1415
- const t = m.useRef(() => {
1416
- if (process.env.NODE_ENV !== "production")
1417
- throw new Error("Cannot call an event handler while rendering.");
1418
- });
1419
- return so(() => {
1420
- t.current = e;
1421
- }), m.useCallback(function() {
1422
- for (var n = arguments.length, r = new Array(n), o = 0; o < n; o++)
1423
- r[o] = arguments[o];
1424
- return t.current == null ? void 0 : t.current(...r);
1425
- }, []);
1426
- }
1427
- const Ht = "ArrowUp", et = "ArrowDown", $e = "ArrowLeft", ze = "ArrowRight";
1428
- function ot(e, t, n) {
1429
- return Math.floor(e / t) !== n;
1430
- }
1431
- function Ue(e, t) {
1432
- return t < 0 || t >= e.current.length;
1433
- }
1434
- function Tt(e, t) {
1435
- return ee(e, {
1436
- disabledIndices: t
1437
- });
1438
- }
1439
- function tn(e, t) {
1440
- return ee(e, {
1441
- decrement: !0,
1442
- startingIndex: e.current.length,
1443
- disabledIndices: t
1444
- });
1445
- }
1446
- function ee(e, t) {
1447
- let {
1448
- startingIndex: n = -1,
1449
- decrement: r = !1,
1450
- disabledIndices: o,
1451
- amount: i = 1
1452
- } = t === void 0 ? {} : t;
1453
- const s = e.current;
1454
- let u = n;
1455
- do
1456
- u += r ? -i : i;
1457
- while (u >= 0 && u <= s.length - 1 && ut(s, u, o));
1458
- return u;
1459
- }
1460
- function co(e, t) {
1461
- let {
1462
- event: n,
1463
- orientation: r,
1464
- loop: o,
1465
- cols: i,
1466
- disabledIndices: s,
1467
- minIndex: u,
1468
- maxIndex: l,
1469
- prevIndex: c,
1470
- stopEvent: d = !1
1471
- } = t, a = c;
1472
- if (n.key === Ht) {
1473
- if (d && re(n), c === -1)
1474
- a = l;
1475
- else if (a = ee(e, {
1476
- startingIndex: a,
1477
- amount: i,
1478
- decrement: !0,
1479
- disabledIndices: s
1480
- }), o && (c - i < u || a < 0)) {
1481
- const p = c % i, f = l % i, g = l - (f - p);
1482
- f === p ? a = l : a = f > p ? g : g - i;
1483
- }
1484
- Ue(e, a) && (a = c);
1485
- }
1486
- if (n.key === et && (d && re(n), c === -1 ? a = u : (a = ee(e, {
1487
- startingIndex: c,
1488
- amount: i,
1489
- disabledIndices: s
1490
- }), o && c + i > l && (a = ee(e, {
1491
- startingIndex: c % i - i,
1492
- amount: i,
1493
- disabledIndices: s
1494
- }))), Ue(e, a) && (a = c)), r === "both") {
1495
- const p = Ne(c / i);
1496
- n.key === ze && (d && re(n), c % i !== i - 1 ? (a = ee(e, {
1497
- startingIndex: c,
1498
- disabledIndices: s
1499
- }), o && ot(a, i, p) && (a = ee(e, {
1500
- startingIndex: c - c % i - 1,
1501
- disabledIndices: s
1502
- }))) : o && (a = ee(e, {
1503
- startingIndex: c - c % i - 1,
1504
- disabledIndices: s
1505
- })), ot(a, i, p) && (a = c)), n.key === $e && (d && re(n), c % i !== 0 ? (a = ee(e, {
1506
- startingIndex: c,
1507
- decrement: !0,
1508
- disabledIndices: s
1509
- }), o && ot(a, i, p) && (a = ee(e, {
1510
- startingIndex: c + (i - c % i),
1511
- decrement: !0,
1512
- disabledIndices: s
1513
- }))) : o && (a = ee(e, {
1514
- startingIndex: c + (i - c % i),
1515
- decrement: !0,
1516
- disabledIndices: s
1517
- })), ot(a, i, p) && (a = c));
1518
- const f = Ne(l / i) === p;
1519
- Ue(e, a) && (o && f ? a = n.key === $e ? l : ee(e, {
1520
- startingIndex: c - c % i - 1,
1521
- disabledIndices: s
1522
- }) : a = c);
1523
- }
1524
- return a;
1525
- }
1526
- function uo(e, t, n) {
1527
- const r = [];
1528
- let o = 0;
1529
- return e.forEach((i, s) => {
1530
- let {
1531
- width: u,
1532
- height: l
1533
- } = i;
1534
- if (u > t && process.env.NODE_ENV !== "production")
1535
- throw new Error("[Floating UI]: Invalid grid - item width at index " + s + " is greater than grid columns");
1536
- let c = !1;
1537
- for (n && (o = 0); !c; ) {
1538
- const d = [];
1539
- for (let a = 0; a < u; a++)
1540
- for (let p = 0; p < l; p++)
1541
- d.push(o + a + p * t);
1542
- o % t + u <= t && d.every((a) => r[a] == null) ? (d.forEach((a) => {
1543
- r[a] = s;
1544
- }), c = !0) : o++;
1545
- }
1546
- }), [...r];
1547
- }
1548
- function lo(e, t, n, r, o) {
1549
- if (e === -1) return -1;
1550
- const i = n.indexOf(e), s = t[e];
1551
- switch (o) {
1552
- case "tl":
1553
- return i;
1554
- case "tr":
1555
- return s ? i + s.width - 1 : i;
1556
- case "bl":
1557
- return s ? i + (s.height - 1) * r : i;
1558
- case "br":
1559
- return n.lastIndexOf(e);
1560
- }
1561
- }
1562
- function ao(e, t) {
1563
- return t.flatMap((n, r) => e.includes(n) ? [r] : []);
1564
- }
1565
- function ut(e, t, n) {
1566
- if (n)
1567
- return n.includes(t);
1568
- const r = e[t];
1569
- return r == null || r.hasAttribute("disabled") || r.getAttribute("aria-disabled") === "true";
1570
- }
1571
- let nn = 0;
1572
- function Ie(e, t) {
1573
- t === void 0 && (t = {});
1574
- const {
1575
- preventScroll: n = !1,
1576
- cancelPrevious: r = !0,
1577
- sync: o = !1
1578
- } = t;
1579
- r && cancelAnimationFrame(nn);
1580
- const i = () => e == null ? void 0 : e.focus({
1581
- preventScroll: n
1582
- });
1583
- o ? i() : nn = requestAnimationFrame(i);
1584
- }
1585
- var G = typeof document < "u" ? bn : xn;
1586
- function ht() {
1587
- return ht = Object.assign ? Object.assign.bind() : function(e) {
1588
- for (var t = 1; t < arguments.length; t++) {
1589
- var n = arguments[t];
1590
- for (var r in n)
1591
- Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]);
1592
- }
1593
- return e;
1594
- }, ht.apply(this, arguments);
1595
- }
1596
- let rn = !1, fo = 0;
1597
- const on = () => (
1598
- // Ensure the id is unique with multiple independent versions of Floating UI
1599
- // on <React 18
1600
- "floating-ui-" + Math.random().toString(36).slice(2, 6) + fo++
1601
- );
1602
- function mo() {
1603
- const [e, t] = m.useState(() => rn ? on() : void 0);
1604
- return G(() => {
1605
- e == null && t(on());
1606
- }, []), m.useEffect(() => {
1607
- rn = !0;
1608
- }, []), e;
1609
- }
1610
- const go = Kn.useId, zt = go || mo;
1611
- let Xe;
1612
- process.env.NODE_ENV !== "production" && (Xe = /* @__PURE__ */ new Set());
1613
- function At() {
1614
- for (var e, t = arguments.length, n = new Array(t), r = 0; r < t; r++)
1615
- n[r] = arguments[r];
1616
- const o = "Floating UI: " + n.join(" ");
1617
- if (!((e = Xe) != null && e.has(o))) {
1618
- var i;
1619
- (i = Xe) == null || i.add(o), console.warn(o);
1620
- }
1621
- }
1622
- function po() {
1623
- for (var e, t = arguments.length, n = new Array(t), r = 0; r < t; r++)
1624
- n[r] = arguments[r];
1625
- const o = "Floating UI: " + n.join(" ");
1626
- if (!((e = Xe) != null && e.has(o))) {
1627
- var i;
1628
- (i = Xe) == null || i.add(o), console.error(o);
1629
- }
1630
- }
1631
- function ho() {
1632
- const e = /* @__PURE__ */ new Map();
1633
- return {
1634
- emit(t, n) {
1635
- var r;
1636
- (r = e.get(t)) == null || r.forEach((o) => o(n));
1637
- },
1638
- on(t, n) {
1639
- e.set(t, [...e.get(t) || [], n]);
1640
- },
1641
- off(t, n) {
1642
- var r;
1643
- e.set(t, ((r = e.get(t)) == null ? void 0 : r.filter((o) => o !== n)) || []);
1644
- }
1645
- };
1646
- }
1647
- const bo = /* @__PURE__ */ m.createContext(null), xo = /* @__PURE__ */ m.createContext(null), qt = () => {
1648
- var e;
1649
- return ((e = m.useContext(bo)) == null ? void 0 : e.id) || null;
1650
- }, wt = () => m.useContext(xo);
1651
- function Ke(e) {
1652
- return "data-floating-ui-" + e;
1653
- }
1654
- function Ce(e) {
1655
- const t = Zn(e);
1656
- return G(() => {
1657
- t.current = e;
1658
- }), t;
1659
- }
1660
- function vo(e, t) {
1661
- var n;
1662
- let r = [], o = (n = e.find((i) => i.id === t)) == null ? void 0 : n.parentId;
1663
- for (; o; ) {
1664
- const i = e.find((s) => s.id === o);
1665
- o = i == null ? void 0 : i.parentId, i && (r = r.concat(i));
1666
- }
1667
- return r;
1668
- }
1669
- function We(e, t) {
1670
- let n = e.filter((o) => {
1671
- var i;
1672
- return o.parentId === t && ((i = o.context) == null ? void 0 : i.open);
1673
- }), r = n;
1674
- for (; r.length; )
1675
- r = e.filter((o) => {
1676
- var i;
1677
- return (i = r) == null ? void 0 : i.some((s) => {
1678
- var u;
1679
- return o.parentId === s.id && ((u = o.context) == null ? void 0 : u.open);
1680
- });
1681
- }), n = n.concat(r);
1682
- return n;
1683
- }
1684
- function yo(e, t) {
1685
- let n, r = -1;
1686
- function o(i, s) {
1687
- s > r && (n = i, r = s), We(e, i).forEach((l) => {
1688
- o(l.id, s + 1);
1689
- });
1690
- }
1691
- return o(t, 0), e.find((i) => i.id === n);
1692
- }
1693
- let Le = /* @__PURE__ */ new WeakMap(), it = /* @__PURE__ */ new WeakSet(), st = {}, St = 0;
1694
- const wo = () => typeof HTMLElement < "u" && "inert" in HTMLElement.prototype, Hn = (e) => e && (e.host || Hn(e.parentNode)), Ro = (e, t) => t.map((n) => {
1695
- if (e.contains(n))
1696
- return n;
1697
- const r = Hn(n);
1698
- return e.contains(r) ? r : null;
1699
- }).filter((n) => n != null);
1700
- function Eo(e, t, n, r) {
1701
- const o = "data-floating-ui-inert", i = r ? "inert" : n ? "aria-hidden" : null, s = Ro(t, e), u = /* @__PURE__ */ new Set(), l = new Set(s), c = [];
1702
- st[o] || (st[o] = /* @__PURE__ */ new WeakMap());
1703
- const d = st[o];
1704
- s.forEach(a), p(t), u.clear();
1705
- function a(f) {
1706
- !f || u.has(f) || (u.add(f), f.parentNode && a(f.parentNode));
1707
- }
1708
- function p(f) {
1709
- !f || l.has(f) || [].forEach.call(f.children, (g) => {
1710
- if (Oe(g) !== "script")
1711
- if (u.has(g))
1712
- p(g);
1713
- else {
1714
- const h = i ? g.getAttribute(i) : null, v = h !== null && h !== "false", x = (Le.get(g) || 0) + 1, R = (d.get(g) || 0) + 1;
1715
- Le.set(g, x), d.set(g, R), c.push(g), x === 1 && v && it.add(g), R === 1 && g.setAttribute(o, ""), !v && i && g.setAttribute(i, "true");
1716
- }
1717
- });
1718
- }
1719
- return St++, () => {
1720
- c.forEach((f) => {
1721
- const g = (Le.get(f) || 0) - 1, h = (d.get(f) || 0) - 1;
1722
- Le.set(f, g), d.set(f, h), g || (!it.has(f) && i && f.removeAttribute(i), it.delete(f)), h || f.removeAttribute(o);
1723
- }), St--, St || (Le = /* @__PURE__ */ new WeakMap(), Le = /* @__PURE__ */ new WeakMap(), it = /* @__PURE__ */ new WeakSet(), st = {});
1724
- };
1725
- }
1726
- function sn(e, t, n) {
1727
- t === void 0 && (t = !1), n === void 0 && (n = !1);
1728
- const r = se(e[0]).body;
1729
- return Eo(e.concat(Array.from(r.querySelectorAll("[aria-live]"))), r, t, n);
1730
- }
1731
- const He = () => ({
1732
- getShadowRoot: !0,
1733
- displayCheck: (
1734
- // JSDOM does not support the `tabbable` library. To solve this we can
1735
- // check if `ResizeObserver` is a real function (not polyfilled), which
1736
- // determines if the current environment is JSDOM-like.
1737
- typeof ResizeObserver == "function" && ResizeObserver.toString().includes("[native code]") ? "full" : "none"
1738
- )
1739
- });
1740
- function zn(e, t) {
1741
- const n = Ge(e, He());
1742
- t === "prev" && n.reverse();
1743
- const r = n.indexOf(xe(se(e)));
1744
- return n.slice(r + 1)[0];
1745
- }
1746
- function qn() {
1747
- return zn(document.body, "next");
1748
- }
1749
- function jn() {
1750
- return zn(document.body, "prev");
1751
- }
1752
- function Ye(e, t) {
1753
- const n = t || e.currentTarget, r = e.relatedTarget;
1754
- return !r || !ne(n, r);
1755
- }
1756
- function Io(e) {
1757
- Ge(e, He()).forEach((n) => {
1758
- n.dataset.tabindex = n.getAttribute("tabindex") || "", n.setAttribute("tabindex", "-1");
1759
- });
1760
- }
1761
- function cn(e) {
1762
- e.querySelectorAll("[data-tabindex]").forEach((n) => {
1763
- const r = n.dataset.tabindex;
1764
- delete n.dataset.tabindex, r ? n.setAttribute("tabindex", r) : n.removeAttribute("tabindex");
1765
- });
1766
- }
1767
- function Co(e, t, n) {
1768
- const r = e.indexOf(t);
1769
- function o(s) {
1770
- const u = Ke("focus-guard");
1771
- let l = r + (s ? 1 : 0), c = e[l];
1772
- for (; c && (!c.isConnected || c.hasAttribute(u) || ne(n, c)); )
1773
- s ? l++ : l--, c = e[l];
1774
- return c;
1775
- }
1776
- const i = o(!0);
1777
- return i || o(!1);
1778
- }
1779
- const jt = {
1780
- border: 0,
1781
- clip: "rect(0 0 0 0)",
1782
- height: "1px",
1783
- margin: "-1px",
1784
- overflow: "hidden",
1785
- padding: 0,
1786
- position: "fixed",
1787
- whiteSpace: "nowrap",
1788
- width: "1px",
1789
- top: 0,
1790
- left: 0
1791
- };
1792
- let To;
1793
- function un(e) {
1794
- e.key === "Tab" && (e.target, clearTimeout(To));
1795
- }
1796
- const bt = /* @__PURE__ */ m.forwardRef(function(t, n) {
1797
- const [r, o] = m.useState();
1798
- G(() => (Tn() && o("button"), document.addEventListener("keydown", un), () => {
1799
- document.removeEventListener("keydown", un);
1800
- }), []);
1801
- const i = {
1802
- ref: n,
1803
- tabIndex: 0,
1804
- // Role is only for VoiceOver
1805
- role: r,
1806
- "aria-hidden": r ? void 0 : !0,
1807
- [Ke("focus-guard")]: "",
1808
- style: jt
1809
- };
1810
- return /* @__PURE__ */ m.createElement("span", ht({}, t, i));
1811
- }), Un = /* @__PURE__ */ m.createContext(null), ln = /* @__PURE__ */ Ke("portal");
1812
- function Ao(e) {
1813
- e === void 0 && (e = {});
1814
- const {
1815
- id: t,
1816
- root: n
1817
- } = e, r = zt(), o = Yn(), [i, s] = m.useState(null), u = m.useRef(null);
1818
- return G(() => () => {
1819
- i == null || i.remove(), queueMicrotask(() => {
1820
- u.current = null;
1821
- });
1822
- }, [i]), G(() => {
1823
- if (!r || u.current) return;
1824
- const l = t ? document.getElementById(t) : null;
1825
- if (!l) return;
1826
- const c = document.createElement("div");
1827
- c.id = r, c.setAttribute(ln, ""), l.appendChild(c), u.current = c, s(c);
1828
- }, [t, r]), G(() => {
1829
- if (!r || u.current) return;
1830
- let l = n || (o == null ? void 0 : o.portalNode);
1831
- l && !U(l) && (l = l.current), l = l || document.body;
1832
- let c = null;
1833
- t && (c = document.createElement("div"), c.id = t, l.appendChild(c));
1834
- const d = document.createElement("div");
1835
- d.id = r, d.setAttribute(ln, ""), l = c || l, l.appendChild(d), u.current = d, s(d);
1836
- }, [t, n, r, o]), i;
1837
- }
1838
- function Ko(e) {
1839
- const {
1840
- children: t,
1841
- id: n,
1842
- root: r = null,
1843
- preserveTabOrder: o = !0
1844
- } = e, i = Ao({
1845
- id: n,
1846
- root: r
1847
- }), [s, u] = m.useState(null), l = m.useRef(null), c = m.useRef(null), d = m.useRef(null), a = m.useRef(null), p = s == null ? void 0 : s.modal, f = s == null ? void 0 : s.open, g = (
1848
- // The FocusManager and therefore floating element are currently open/
1849
- // rendered.
1850
- !!s && // Guards are only for non-modal focus management.
1851
- !s.modal && // Don't render if unmount is transitioning.
1852
- s.open && o && !!(r || i)
1853
- );
1854
- return m.useEffect(() => {
1855
- if (!i || !o || p)
1856
- return;
1857
- function h(v) {
1858
- i && Ye(v) && (v.type === "focusin" ? cn : Io)(i);
1859
- }
1860
- return i.addEventListener("focusin", h, !0), i.addEventListener("focusout", h, !0), () => {
1861
- i.removeEventListener("focusin", h, !0), i.removeEventListener("focusout", h, !0);
1862
- };
1863
- }, [i, o, p]), m.useEffect(() => {
1864
- i && (f || cn(i));
1865
- }, [f, i]), /* @__PURE__ */ m.createElement(Un.Provider, {
1866
- value: m.useMemo(() => ({
1867
- preserveTabOrder: o,
1868
- beforeOutsideRef: l,
1869
- afterOutsideRef: c,
1870
- beforeInsideRef: d,
1871
- afterInsideRef: a,
1872
- portalNode: i,
1873
- setFocusManagerState: u
1874
- }), [o, i])
1875
- }, g && i && /* @__PURE__ */ m.createElement(bt, {
1876
- "data-type": "outside",
1877
- ref: l,
1878
- onFocus: (h) => {
1879
- if (Ye(h, i)) {
1880
- var v;
1881
- (v = d.current) == null || v.focus();
1882
- } else {
1883
- const x = jn() || (s == null ? void 0 : s.refs.domReference.current);
1884
- x == null || x.focus();
1885
- }
1886
- }
1887
- }), g && i && /* @__PURE__ */ m.createElement("span", {
1888
- "aria-owns": i.id,
1889
- style: jt
1890
- }), i && /* @__PURE__ */ vn.createPortal(t, i), g && i && /* @__PURE__ */ m.createElement(bt, {
1891
- "data-type": "outside",
1892
- ref: c,
1893
- onFocus: (h) => {
1894
- if (Ye(h, i)) {
1895
- var v;
1896
- (v = a.current) == null || v.focus();
1897
- } else {
1898
- const x = qn() || (s == null ? void 0 : s.refs.domReference.current);
1899
- x == null || x.focus(), s != null && s.closeOnFocusOut && (s == null || s.onOpenChange(!1, h.nativeEvent, "focus-out"));
1900
- }
1901
- }
1902
- }));
1903
- }
1904
- const Yn = () => m.useContext(Un), Vt = "data-floating-ui-focusable";
1905
- function Gn(e) {
1906
- return e ? e.hasAttribute(Vt) ? e : e.querySelector("[" + Vt + "]") || e : null;
1907
- }
1908
- const So = 20;
1909
- let De = [];
1910
- function Ot(e) {
1911
- De = De.filter((n) => n.isConnected);
1912
- let t = e;
1913
- if (!(!t || Oe(t) === "body")) {
1914
- if (!Fr(t, He())) {
1915
- const n = Ge(t, He())[0];
1916
- n && (t = n);
1917
- }
1918
- De.push(t), De.length > So && (De = De.slice(-20));
1919
- }
1920
- }
1921
- function an() {
1922
- return De.slice().reverse().find((e) => e.isConnected);
1923
- }
1924
- const Oo = /* @__PURE__ */ m.forwardRef(function(t, n) {
1925
- return /* @__PURE__ */ m.createElement("button", ht({}, t, {
1926
- type: "button",
1927
- ref: n,
1928
- tabIndex: -1,
1929
- style: jt
1930
- }));
1931
- });
1932
- function Ho(e) {
1933
- const {
1934
- context: t,
1935
- children: n,
1936
- disabled: r = !1,
1937
- order: o = ["content"],
1938
- guards: i = !0,
1939
- initialFocus: s = 0,
1940
- returnFocus: u = !0,
1941
- restoreFocus: l = !1,
1942
- modal: c = !0,
1943
- visuallyHiddenDismiss: d = !1,
1944
- closeOnFocusOut: a = !0
1945
- } = e, {
1946
- open: p,
1947
- refs: f,
1948
- nodeId: g,
1949
- onOpenChange: h,
1950
- events: v,
1951
- dataRef: x,
1952
- floatingId: R,
1953
- elements: {
1954
- domReference: b,
1955
- floating: w
1956
- }
1957
- } = t, D = typeof s == "number" && s < 0, k = An(b) && D, B = wo() ? i : !0, W = Ce(o), Z = Ce(s), H = Ce(u), $ = wt(), C = Yn(), L = m.useRef(null), T = m.useRef(null), y = m.useRef(!1), O = m.useRef(!1), F = m.useRef(-1), I = C != null, E = Gn(w), _ = fe(function(V) {
1958
- return V === void 0 && (V = E), V ? Ge(V, He()) : [];
1959
- }), Q = fe((V) => {
1960
- const M = _(V);
1961
- return W.current.map((A) => b && A === "reference" ? b : E && A === "floating" ? E : M).filter(Boolean).flat();
1962
- });
1963
- m.useEffect(() => {
1964
- y.current = !1;
1965
- }, [r]), m.useEffect(() => {
1966
- if (r || !c) return;
1967
- function V(A) {
1968
- if (A.key === "Tab") {
1969
- ne(E, xe(se(E))) && _().length === 0 && !k && re(A);
1970
- const P = Q(), q = Fe(A);
1971
- W.current[0] === "reference" && q === b && (re(A), A.shiftKey ? Ie(P[P.length - 1]) : Ie(P[1])), W.current[1] === "floating" && q === E && A.shiftKey && (re(A), Ie(P[0]));
1972
- }
1973
- }
1974
- const M = se(E);
1975
- return M.addEventListener("keydown", V), () => {
1976
- M.removeEventListener("keydown", V);
1977
- };
1978
- }, [r, b, E, c, W, k, _, Q]), m.useEffect(() => {
1979
- if (r || !w) return;
1980
- function V(M) {
1981
- const A = Fe(M), q = _().indexOf(A);
1982
- q !== -1 && (F.current = q);
1983
- }
1984
- return w.addEventListener("focusin", V), () => {
1985
- w.removeEventListener("focusin", V);
1986
- };
1987
- }, [r, w, _]), m.useEffect(() => {
1988
- if (r || !a) return;
1989
- function V() {
1990
- O.current = !0, setTimeout(() => {
1991
- O.current = !1;
1992
- });
1993
- }
1994
- function M(A) {
1995
- const P = A.relatedTarget;
1996
- queueMicrotask(() => {
1997
- const q = !(ne(b, P) || ne(w, P) || ne(P, w) || ne(C == null ? void 0 : C.portalNode, P) || P != null && P.hasAttribute(Ke("focus-guard")) || $ && (We($.nodesRef.current, g).find((J) => {
1998
- var te, Y;
1999
- return ne((te = J.context) == null ? void 0 : te.elements.floating, P) || ne((Y = J.context) == null ? void 0 : Y.elements.domReference, P);
2000
- }) || vo($.nodesRef.current, g).find((J) => {
2001
- var te, Y;
2002
- return ((te = J.context) == null ? void 0 : te.elements.floating) === P || ((Y = J.context) == null ? void 0 : Y.elements.domReference) === P;
2003
- })));
2004
- if (l && q && xe(se(E)) === se(E).body) {
2005
- X(E) && E.focus();
2006
- const J = F.current, te = _(), Y = te[J] || te[te.length - 1] || E;
2007
- X(Y) && Y.focus();
2008
- }
2009
- (k || !c) && P && q && !O.current && // Fix React 18 Strict Mode returnFocus due to double rendering.
2010
- P !== an() && (y.current = !0, h(!1, A, "focus-out"));
2011
- });
2012
- }
2013
- if (w && X(b))
2014
- return b.addEventListener("focusout", M), b.addEventListener("pointerdown", V), w.addEventListener("focusout", M), () => {
2015
- b.removeEventListener("focusout", M), b.removeEventListener("pointerdown", V), w.removeEventListener("focusout", M);
2016
- };
2017
- }, [r, b, w, E, c, g, $, C, h, a, l, _, k]), m.useEffect(() => {
2018
- var V;
2019
- if (r) return;
2020
- const M = Array.from((C == null || (V = C.portalNode) == null ? void 0 : V.querySelectorAll("[" + Ke("portal") + "]")) || []);
2021
- if (w) {
2022
- const A = [w, ...M, L.current, T.current, W.current.includes("reference") || k ? b : null].filter((q) => q != null), P = c || k ? sn(A, B, !B) : sn(A);
2023
- return () => {
2024
- P();
2025
- };
2026
- }
2027
- }, [r, b, w, c, W, C, k, B]), G(() => {
2028
- if (r || !X(E)) return;
2029
- const V = se(E), M = xe(V);
2030
- queueMicrotask(() => {
2031
- const A = Q(E), P = Z.current, q = (typeof P == "number" ? A[P] : P.current) || E, J = ne(E, M);
2032
- !D && !J && p && Ie(q, {
2033
- preventScroll: q === E
2034
- });
2035
- });
2036
- }, [r, p, E, D, Q, Z]), G(() => {
2037
- if (r || !E) return;
2038
- let V = !1;
2039
- const M = se(E), A = xe(M);
2040
- let q = x.current.openEvent;
2041
- const J = f.domReference.current;
2042
- Ot(A);
2043
- function te(Y) {
2044
- let {
2045
- open: Me,
2046
- reason: ye,
2047
- event: oe,
2048
- nested: we
2049
- } = Y;
2050
- Me && (q = oe), ye === "escape-key" && f.domReference.current && Ot(f.domReference.current), ye === "hover" && oe.type === "mouseleave" && (y.current = !0), ye === "outside-press" && (we ? (y.current = !1, V = !0) : y.current = !(In(oe) || Cn(oe)));
2051
- }
2052
- return v.on("openchange", te), () => {
2053
- v.off("openchange", te);
2054
- const Y = xe(M), Me = ne(w, Y) || $ && We($.nodesRef.current, g).some((me) => {
2055
- var qe;
2056
- return ne((qe = me.context) == null ? void 0 : qe.elements.floating, Y);
2057
- });
2058
- (Me || q && ["click", "mousedown"].includes(q.type)) && f.domReference.current && Ot(f.domReference.current);
2059
- const oe = J || A, we = Ge(se(oe).body, He());
2060
- queueMicrotask(() => {
2061
- let me = an();
2062
- !me && X(oe) && w && (me = Co(we, oe, w)), // eslint-disable-next-line react-hooks/exhaustive-deps
2063
- H.current && !y.current && X(me) && // If the focus moved somewhere else after mount, avoid returning focus
2064
- // since it likely entered a different element which should be
2065
- // respected: https://github.com/floating-ui/floating-ui/issues/2607
2066
- (!(me !== Y && Y !== M.body) || Me) && me.focus({
2067
- preventScroll: V
2068
- });
2069
- });
2070
- };
2071
- }, [r, w, E, H, x, f, v, $, g]), G(() => {
2072
- if (!r && C)
2073
- return C.setFocusManagerState({
2074
- modal: c,
2075
- closeOnFocusOut: a,
2076
- open: p,
2077
- onOpenChange: h,
2078
- refs: f
2079
- }), () => {
2080
- C.setFocusManagerState(null);
2081
- };
2082
- }, [r, C, c, p, h, f, a]), G(() => {
2083
- if (r || !E || typeof MutationObserver != "function" || D) return;
2084
- const V = () => {
2085
- const A = E.getAttribute("tabindex"), P = _(), q = xe(se(w)), J = P.indexOf(q);
2086
- J !== -1 && (F.current = J), W.current.includes("floating") || q !== f.domReference.current && P.length === 0 ? A !== "0" && E.setAttribute("tabindex", "0") : A !== "-1" && E.setAttribute("tabindex", "-1");
2087
- };
2088
- V();
2089
- const M = new MutationObserver(V);
2090
- return M.observe(E, {
2091
- childList: !0,
2092
- subtree: !0,
2093
- attributes: !0
2094
- }), () => {
2095
- M.disconnect();
2096
- };
2097
- }, [r, w, E, f, W, _, D]);
2098
- function be(V) {
2099
- return r || !d || !c ? null : /* @__PURE__ */ m.createElement(Oo, {
2100
- ref: V === "start" ? L : T,
2101
- onClick: (M) => h(!1, M.nativeEvent)
2102
- }, typeof d == "string" ? d : "Dismiss");
2103
- }
2104
- const de = !r && B && (c ? !k : !0) && (I || c);
2105
- return /* @__PURE__ */ m.createElement(m.Fragment, null, de && /* @__PURE__ */ m.createElement(bt, {
2106
- "data-type": "inside",
2107
- ref: C == null ? void 0 : C.beforeInsideRef,
2108
- onFocus: (V) => {
2109
- if (c) {
2110
- const A = Q();
2111
- Ie(o[0] === "reference" ? A[0] : A[A.length - 1]);
2112
- } else if (C != null && C.preserveTabOrder && C.portalNode)
2113
- if (y.current = !1, Ye(V, C.portalNode)) {
2114
- const A = qn() || b;
2115
- A == null || A.focus();
2116
- } else {
2117
- var M;
2118
- (M = C.beforeOutsideRef.current) == null || M.focus();
2119
- }
2120
- }
2121
- }), !k && be("start"), n, be("end"), de && /* @__PURE__ */ m.createElement(bt, {
2122
- "data-type": "inside",
2123
- ref: C == null ? void 0 : C.afterInsideRef,
2124
- onFocus: (V) => {
2125
- if (c)
2126
- Ie(Q()[0]);
2127
- else if (C != null && C.preserveTabOrder && C.portalNode)
2128
- if (a && (y.current = !0), Ye(V, C.portalNode)) {
2129
- const A = jn() || b;
2130
- A == null || A.focus();
2131
- } else {
2132
- var M;
2133
- (M = C.afterOutsideRef.current) == null || M.focus();
2134
- }
2135
- }
2136
- }));
2137
- }
2138
- const Mo = {
2139
- pointerdown: "onPointerDown",
2140
- mousedown: "onMouseDown",
2141
- click: "onClick"
2142
- }, Do = {
2143
- pointerdown: "onPointerDownCapture",
2144
- mousedown: "onMouseDownCapture",
2145
- click: "onClickCapture"
2146
- }, fn = (e) => {
2147
- var t, n;
2148
- return {
2149
- escapeKey: typeof e == "boolean" ? e : (t = e == null ? void 0 : e.escapeKey) != null ? t : !1,
2150
- outsidePress: typeof e == "boolean" ? e : (n = e == null ? void 0 : e.outsidePress) != null ? n : !0
2151
- };
2152
- };
2153
- function zo(e, t) {
2154
- t === void 0 && (t = {});
2155
- const {
2156
- open: n,
2157
- onOpenChange: r,
2158
- elements: o,
2159
- dataRef: i
2160
- } = e, {
2161
- enabled: s = !0,
2162
- escapeKey: u = !0,
2163
- outsidePress: l = !0,
2164
- outsidePressEvent: c = "pointerdown",
2165
- referencePress: d = !1,
2166
- referencePressEvent: a = "pointerdown",
2167
- ancestorScroll: p = !1,
2168
- bubbles: f,
2169
- capture: g
2170
- } = t, h = wt(), v = fe(typeof l == "function" ? l : () => !1), x = typeof l == "function" ? v : l, R = m.useRef(!1), b = m.useRef(!1), {
2171
- escapeKey: w,
2172
- outsidePress: D
2173
- } = fn(f), {
2174
- escapeKey: k,
2175
- outsidePress: B
2176
- } = fn(g), W = fe((T) => {
2177
- var y;
2178
- if (!n || !s || !u || T.key !== "Escape")
2179
- return;
2180
- const O = (y = i.current.floatingContext) == null ? void 0 : y.nodeId, F = h ? We(h.nodesRef.current, O) : [];
2181
- if (!w && (T.stopPropagation(), F.length > 0)) {
2182
- let I = !0;
2183
- if (F.forEach((E) => {
2184
- var _;
2185
- if ((_ = E.context) != null && _.open && !E.context.dataRef.current.__escapeKeyBubbles) {
2186
- I = !1;
2187
- return;
2188
- }
2189
- }), !I)
2190
- return;
2191
- }
2192
- r(!1, nr(T) ? T.nativeEvent : T, "escape-key");
2193
- }), Z = fe((T) => {
2194
- var y;
2195
- const O = () => {
2196
- var F;
2197
- W(T), (F = Fe(T)) == null || F.removeEventListener("keydown", O);
2198
- };
2199
- (y = Fe(T)) == null || y.addEventListener("keydown", O);
2200
- }), H = fe((T) => {
2201
- var y;
2202
- const O = R.current;
2203
- R.current = !1;
2204
- const F = b.current;
2205
- if (b.current = !1, c === "click" && F || O || typeof x == "function" && !x(T))
2206
- return;
2207
- const I = Fe(T), E = "[" + Ke("inert") + "]", _ = se(o.floating).querySelectorAll(E);
2208
- let Q = U(I) ? I : null;
2209
- for (; Q && !Ae(Q); ) {
2210
- const M = ve(Q);
2211
- if (Ae(M) || !U(M))
2212
- break;
2213
- Q = M;
2214
- }
2215
- if (_.length && U(I) && !rr(I) && // Clicked on a direct ancestor (e.g. FloatingOverlay).
2216
- !ne(I, o.floating) && // If the target root element contains none of the markers, then the
2217
- // element was injected after the floating element rendered.
2218
- Array.from(_).every((M) => !ne(Q, M)))
2219
- return;
2220
- if (X(I) && L) {
2221
- const M = I.clientWidth > 0 && I.scrollWidth > I.clientWidth, A = I.clientHeight > 0 && I.scrollHeight > I.clientHeight;
2222
- let P = A && T.offsetX > I.clientWidth;
2223
- if (A && le(I).direction === "rtl" && (P = T.offsetX <= I.offsetWidth - I.clientWidth), P || M && T.offsetY > I.clientHeight)
2224
- return;
2225
- }
2226
- const be = (y = i.current.floatingContext) == null ? void 0 : y.nodeId, de = h && We(h.nodesRef.current, be).some((M) => {
2227
- var A;
2228
- return Et(T, (A = M.context) == null ? void 0 : A.elements.floating);
2229
- });
2230
- if (Et(T, o.floating) || Et(T, o.domReference) || de)
2231
- return;
2232
- const V = h ? We(h.nodesRef.current, be) : [];
2233
- if (V.length > 0) {
2234
- let M = !0;
2235
- if (V.forEach((A) => {
2236
- var P;
2237
- if ((P = A.context) != null && P.open && !A.context.dataRef.current.__outsidePressBubbles) {
2238
- M = !1;
2239
- return;
2240
- }
2241
- }), !M)
2242
- return;
2243
- }
2244
- r(!1, T, "outside-press");
2245
- }), $ = fe((T) => {
2246
- var y;
2247
- const O = () => {
2248
- var F;
2249
- H(T), (F = Fe(T)) == null || F.removeEventListener(c, O);
2250
- };
2251
- (y = Fe(T)) == null || y.addEventListener(c, O);
2252
- });
2253
- m.useEffect(() => {
2254
- if (!n || !s)
2255
- return;
2256
- i.current.__escapeKeyBubbles = w, i.current.__outsidePressBubbles = D;
2257
- function T(F) {
2258
- r(!1, F, "ancestor-scroll");
2259
- }
2260
- const y = se(o.floating);
2261
- u && y.addEventListener("keydown", k ? Z : W, k), x && y.addEventListener(c, B ? $ : H, B);
2262
- let O = [];
2263
- return p && (U(o.domReference) && (O = Te(o.domReference)), U(o.floating) && (O = O.concat(Te(o.floating))), !U(o.reference) && o.reference && o.reference.contextElement && (O = O.concat(Te(o.reference.contextElement)))), O = O.filter((F) => {
2264
- var I;
2265
- return F !== ((I = y.defaultView) == null ? void 0 : I.visualViewport);
2266
- }), O.forEach((F) => {
2267
- F.addEventListener("scroll", T, {
2268
- passive: !0
2269
- });
2270
- }), () => {
2271
- u && y.removeEventListener("keydown", k ? Z : W, k), x && y.removeEventListener(c, B ? $ : H, B), O.forEach((F) => {
2272
- F.removeEventListener("scroll", T);
2273
- });
2274
- };
2275
- }, [i, o, u, x, c, n, r, p, s, w, D, W, k, Z, H, B, $]), m.useEffect(() => {
2276
- R.current = !1;
2277
- }, [x, c]);
2278
- const C = m.useMemo(() => ({
2279
- onKeyDown: W,
2280
- [Mo[a]]: (T) => {
2281
- d && r(!1, T.nativeEvent, "reference-press");
2282
- }
2283
- }), [W, r, d, a]), L = m.useMemo(() => ({
2284
- onKeyDown: W,
2285
- onMouseDown() {
2286
- b.current = !0;
2287
- },
2288
- onMouseUp() {
2289
- b.current = !0;
2290
- },
2291
- [Do[c]]: () => {
2292
- R.current = !0;
2293
- }
2294
- }), [W, c]);
2295
- return m.useMemo(() => s ? {
2296
- reference: C,
2297
- floating: L
2298
- } : {}, [s, C, L]);
2299
- }
2300
- function Fo(e) {
2301
- const {
2302
- open: t = !1,
2303
- onOpenChange: n,
2304
- elements: r
2305
- } = e, o = zt(), i = m.useRef({}), [s] = m.useState(() => ho()), u = qt() != null;
2306
- if (process.env.NODE_ENV !== "production") {
2307
- const f = r.reference;
2308
- f && !U(f) && po("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `refs.setPositionReference()`", "instead.");
2309
- }
2310
- const [l, c] = m.useState(r.reference), d = fe((f, g, h) => {
2311
- i.current.openEvent = f ? g : void 0, s.emit("openchange", {
2312
- open: f,
2313
- event: g,
2314
- reason: h,
2315
- nested: u
2316
- }), n == null || n(f, g, h);
2317
- }), a = m.useMemo(() => ({
2318
- setPositionReference: c
2319
- }), []), p = m.useMemo(() => ({
2320
- reference: l || r.reference || null,
2321
- floating: r.floating || null,
2322
- domReference: r.reference
2323
- }), [l, r.reference, r.floating]);
2324
- return m.useMemo(() => ({
2325
- dataRef: i,
2326
- open: t,
2327
- onOpenChange: d,
2328
- elements: p,
2329
- events: s,
2330
- floatingId: o,
2331
- refs: a
2332
- }), [t, d, p, s, o, a]);
2333
- }
2334
- function qo(e) {
2335
- e === void 0 && (e = {});
2336
- const {
2337
- nodeId: t
2338
- } = e, n = Fo({
2339
- ...e,
2340
- elements: {
2341
- reference: null,
2342
- floating: null,
2343
- ...e.elements
2344
- }
2345
- }), r = e.rootContext || n, o = r.elements, [i, s] = m.useState(null), [u, l] = m.useState(null), d = (o == null ? void 0 : o.reference) || i, a = m.useRef(null), p = wt();
2346
- G(() => {
2347
- d && (a.current = d);
2348
- }, [d]);
2349
- const f = oo({
2350
- ...e,
2351
- elements: {
2352
- ...o,
2353
- ...u && {
2354
- reference: u
2355
- }
2356
- }
2357
- }), g = m.useCallback((b) => {
2358
- const w = U(b) ? {
2359
- getBoundingClientRect: () => b.getBoundingClientRect(),
2360
- contextElement: b
2361
- } : b;
2362
- l(w), f.refs.setReference(w);
2363
- }, [f.refs]), h = m.useCallback((b) => {
2364
- (U(b) || b === null) && (a.current = b, s(b)), (U(f.refs.reference.current) || f.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
2365
- // `null` to support `positionReference` + an unstable `reference`
2366
- // callback ref.
2367
- b !== null && !U(b)) && f.refs.setReference(b);
2368
- }, [f.refs]), v = m.useMemo(() => ({
2369
- ...f.refs,
2370
- setReference: h,
2371
- setPositionReference: g,
2372
- domReference: a
2373
- }), [f.refs, h, g]), x = m.useMemo(() => ({
2374
- ...f.elements,
2375
- domReference: d
2376
- }), [f.elements, d]), R = m.useMemo(() => ({
2377
- ...f,
2378
- ...r,
2379
- refs: v,
2380
- elements: x,
2381
- nodeId: t
2382
- }), [f, v, x, t, r]);
2383
- return G(() => {
2384
- r.dataRef.current.floatingContext = R;
2385
- const b = p == null ? void 0 : p.nodesRef.current.find((w) => w.id === t);
2386
- b && (b.context = R);
2387
- }), m.useMemo(() => ({
2388
- ...f,
2389
- context: R,
2390
- refs: v,
2391
- elements: x
2392
- }), [f, v, x, R]);
2393
- }
2394
- const dn = "active", mn = "selected";
2395
- function Mt(e, t, n) {
2396
- const r = /* @__PURE__ */ new Map(), o = n === "item";
2397
- let i = e;
2398
- if (o && e) {
2399
- const {
2400
- [dn]: s,
2401
- [mn]: u,
2402
- ...l
2403
- } = e;
2404
- i = l;
2405
- }
2406
- return {
2407
- ...n === "floating" && {
2408
- tabIndex: -1,
2409
- [Vt]: ""
2410
- },
2411
- ...i,
2412
- ...t.map((s) => {
2413
- const u = s ? s[n] : null;
2414
- return typeof u == "function" ? e ? u(e) : null : u;
2415
- }).concat(e).reduce((s, u) => (u && Object.entries(u).forEach((l) => {
2416
- let [c, d] = l;
2417
- if (!(o && [dn, mn].includes(c)))
2418
- if (c.indexOf("on") === 0) {
2419
- if (r.has(c) || r.set(c, []), typeof d == "function") {
2420
- var a;
2421
- (a = r.get(c)) == null || a.push(d), s[c] = function() {
2422
- for (var p, f = arguments.length, g = new Array(f), h = 0; h < f; h++)
2423
- g[h] = arguments[h];
2424
- return (p = r.get(c)) == null ? void 0 : p.map((v) => v(...g)).find((v) => v !== void 0);
2425
- };
2426
- }
2427
- } else
2428
- s[c] = d;
2429
- }), s), {})
2430
- };
2431
- }
2432
- function jo(e) {
2433
- e === void 0 && (e = []);
2434
- const t = e.map((u) => u == null ? void 0 : u.reference), n = e.map((u) => u == null ? void 0 : u.floating), r = e.map((u) => u == null ? void 0 : u.item), o = m.useCallback(
2435
- (u) => Mt(u, e, "reference"),
2436
- // eslint-disable-next-line react-hooks/exhaustive-deps
2437
- t
2438
- ), i = m.useCallback(
2439
- (u) => Mt(u, e, "floating"),
2440
- // eslint-disable-next-line react-hooks/exhaustive-deps
2441
- n
2442
- ), s = m.useCallback(
2443
- (u) => Mt(u, e, "item"),
2444
- // eslint-disable-next-line react-hooks/exhaustive-deps
2445
- r
2446
- );
2447
- return m.useMemo(() => ({
2448
- getReferenceProps: o,
2449
- getFloatingProps: i,
2450
- getItemProps: s
2451
- }), [o, i, s]);
2452
- }
2453
- let gn = !1;
2454
- function Rt(e, t, n) {
2455
- switch (e) {
2456
- case "vertical":
2457
- return t;
2458
- case "horizontal":
2459
- return n;
2460
- default:
2461
- return t || n;
2462
- }
2463
- }
2464
- function pn(e, t) {
2465
- return Rt(t, e === Ht || e === et, e === $e || e === ze);
2466
- }
2467
- function Dt(e, t, n) {
2468
- return Rt(t, e === et, n ? e === $e : e === ze) || e === "Enter" || e === " " || e === "";
2469
- }
2470
- function Po(e, t, n) {
2471
- return Rt(t, n ? e === $e : e === ze, e === et);
2472
- }
2473
- function hn(e, t, n) {
2474
- return Rt(t, n ? e === ze : e === $e, e === Ht);
2475
- }
2476
- function Uo(e, t) {
2477
- const {
2478
- open: n,
2479
- onOpenChange: r,
2480
- elements: o
2481
- } = e, {
2482
- listRef: i,
2483
- activeIndex: s,
2484
- onNavigate: u = () => {
2485
- },
2486
- enabled: l = !0,
2487
- selectedIndex: c = null,
2488
- allowEscape: d = !1,
2489
- loop: a = !1,
2490
- nested: p = !1,
2491
- rtl: f = !1,
2492
- virtual: g = !1,
2493
- focusItemOnOpen: h = "auto",
2494
- focusItemOnHover: v = !0,
2495
- openOnArrowKeyDown: x = !0,
2496
- disabledIndices: R = void 0,
2497
- orientation: b = "vertical",
2498
- cols: w = 1,
2499
- scrollItemIntoView: D = !0,
2500
- virtualItemRef: k,
2501
- itemSizes: B,
2502
- dense: W = !1
2503
- } = t;
2504
- process.env.NODE_ENV !== "production" && (d && (a || At("`useListNavigation` looping must be enabled to allow escaping."), g || At("`useListNavigation` must be virtual to allow escaping.")), b === "vertical" && w > 1 && At("In grid list navigation mode (`cols` > 1), the `orientation` should", 'be either "horizontal" or "both".'));
2505
- const Z = Gn(o.floating), H = Ce(Z), $ = qt(), C = wt(), L = fe(u), T = m.useRef(h), y = m.useRef(c ?? -1), O = m.useRef(null), F = m.useRef(!0), I = m.useRef(L), E = m.useRef(!!o.floating), _ = m.useRef(n), Q = m.useRef(!1), be = m.useRef(!1), de = Ce(R), V = Ce(n), M = Ce(D), A = Ce(c), [P, q] = m.useState(), [J, te] = m.useState(), Y = fe(function(N, j, S) {
2506
- S === void 0 && (S = !1);
2507
- function K(z) {
2508
- g ? (q(z.id), C == null || C.events.emit("virtualfocus", z), k && (k.current = z)) : Ie(z, {
2509
- preventScroll: !0,
2510
- // Mac Safari does not move the virtual cursor unless the focus call
2511
- // is sync. However, for the very first focus call, we need to wait
2512
- // for the position to be ready in order to prevent unwanted
2513
- // scrolling. This means the virtual cursor will not move to the first
2514
- // item when first opening the floating element, but will on
2515
- // subsequent calls. `preventScroll` is supported in modern Safari,
2516
- // so we can use that instead.
2517
- // iOS Safari must be async or the first item will not be focused.
2518
- sync: er() && Tn() ? gn || Q.current : !1
2519
- });
2520
- }
2521
- const ie = N.current[j.current];
2522
- ie && K(ie), requestAnimationFrame(() => {
2523
- const z = N.current[j.current] || ie;
2524
- if (!z) return;
2525
- ie || K(z);
2526
- const ge = M.current;
2527
- ge && ye && (S || !F.current) && (z.scrollIntoView == null || z.scrollIntoView(typeof ge == "boolean" ? {
2528
- block: "nearest",
2529
- inline: "nearest"
2530
- } : ge));
2531
- });
2532
- });
2533
- G(() => {
2534
- document.createElement("div").focus({
2535
- get preventScroll() {
2536
- return gn = !0, !1;
2537
- }
2538
- });
2539
- }, []), G(() => {
2540
- l && (n && o.floating ? T.current && c != null && (be.current = !0, y.current = c, L(c)) : E.current && (y.current = -1, I.current(null)));
2541
- }, [l, n, o.floating, c, L]), G(() => {
2542
- if (l && n && o.floating)
2543
- if (s == null) {
2544
- if (Q.current = !1, A.current != null)
2545
- return;
2546
- if (E.current && (y.current = -1, Y(i, y)), (!_.current || !E.current) && T.current && (O.current != null || T.current === !0 && O.current == null)) {
2547
- let N = 0;
2548
- const j = () => {
2549
- i.current[0] == null ? (N < 2 && (N ? requestAnimationFrame : queueMicrotask)(j), N++) : (y.current = O.current == null || Dt(O.current, b, f) || p ? Tt(i, de.current) : tn(i, de.current), O.current = null, L(y.current));
2550
- };
2551
- j();
2552
- }
2553
- } else Ue(i, s) || (y.current = s, Y(i, y, be.current), be.current = !1);
2554
- }, [l, n, o.floating, s, A, p, i, b, f, L, Y, de]), G(() => {
2555
- var N;
2556
- if (!l || o.floating || !C || g || !E.current)
2557
- return;
2558
- const j = C.nodesRef.current, S = (N = j.find((z) => z.id === $)) == null || (N = N.context) == null ? void 0 : N.elements.floating, K = xe(se(o.floating)), ie = j.some((z) => z.context && ne(z.context.elements.floating, K));
2559
- S && !ie && F.current && S.focus({
2560
- preventScroll: !0
2561
- });
2562
- }, [l, o.floating, C, $, g]), G(() => {
2563
- if (!l || !C || !g || $) return;
2564
- function N(j) {
2565
- te(j.id), k && (k.current = j);
2566
- }
2567
- return C.events.on("virtualfocus", N), () => {
2568
- C.events.off("virtualfocus", N);
2569
- };
2570
- }, [l, C, g, $, k]), G(() => {
2571
- I.current = L, E.current = !!o.floating;
2572
- }), G(() => {
2573
- n || (O.current = null);
2574
- }, [n]), G(() => {
2575
- _.current = n;
2576
- }, [n]);
2577
- const Me = s != null, ye = m.useMemo(() => {
2578
- function N(S) {
2579
- if (!n) return;
2580
- const K = i.current.indexOf(S);
2581
- K !== -1 && L(K);
2582
- }
2583
- return {
2584
- onFocus(S) {
2585
- let {
2586
- currentTarget: K
2587
- } = S;
2588
- N(K);
2589
- },
2590
- onClick: (S) => {
2591
- let {
2592
- currentTarget: K
2593
- } = S;
2594
- return K.focus({
2595
- preventScroll: !0
2596
- });
2597
- },
2598
- // Safari
2599
- ...v && {
2600
- onMouseMove(S) {
2601
- let {
2602
- currentTarget: K
2603
- } = S;
2604
- N(K);
2605
- },
2606
- onPointerLeave(S) {
2607
- let {
2608
- pointerType: K
2609
- } = S;
2610
- !F.current || K === "touch" || (y.current = -1, Y(i, y), L(null), g || Ie(H.current, {
2611
- preventScroll: !0
2612
- }));
2613
- }
2614
- }
2615
- };
2616
- }, [n, H, Y, v, i, L, g]), oe = fe((N) => {
2617
- if (F.current = !1, Q.current = !0, !V.current && N.currentTarget === H.current)
2618
- return;
2619
- if (p && hn(N.key, b, f)) {
2620
- re(N), r(!1, N.nativeEvent, "list-navigation"), X(o.domReference) && !g && o.domReference.focus();
2621
- return;
2622
- }
2623
- const j = y.current, S = Tt(i, R), K = tn(i, R);
2624
- if (N.key === "Home" && (re(N), y.current = S, L(y.current)), N.key === "End" && (re(N), y.current = K, L(y.current)), w > 1) {
2625
- const ie = B || Array.from({
2626
- length: i.current.length
2627
- }, () => ({
2628
- width: 1,
2629
- height: 1
2630
- })), z = uo(ie, w, W), ge = z.findIndex((ae) => ae != null && !ut(i.current, ae, R)), tt = z.reduce((ae, Re, nt) => Re != null && !ut(i.current, Re, R) ? nt : ae, -1), je = z[co({
2631
- current: z.map((ae) => ae != null ? i.current[ae] : null)
2632
- }, {
2633
- event: N,
2634
- orientation: b,
2635
- loop: a,
2636
- cols: w,
2637
- // treat undefined (empty grid spaces) as disabled indices so we
2638
- // don't end up in them
2639
- disabledIndices: ao([...R || i.current.map((ae, Re) => ut(i.current, Re) ? Re : void 0), void 0], z),
2640
- minIndex: ge,
2641
- maxIndex: tt,
2642
- prevIndex: lo(
2643
- y.current > K ? S : y.current,
2644
- ie,
2645
- z,
2646
- w,
2647
- // use a corner matching the edge closest to the direction
2648
- // we're moving in so we don't end up in the same item. Prefer
2649
- // top/left over bottom/right.
2650
- N.key === et ? "bl" : N.key === ze ? "tr" : "tl"
2651
- ),
2652
- stopEvent: !0
2653
- })];
2654
- if (je != null && (y.current = je, L(y.current)), b === "both")
2655
- return;
2656
- }
2657
- if (pn(N.key, b)) {
2658
- if (re(N), n && !g && xe(N.currentTarget.ownerDocument) === N.currentTarget) {
2659
- y.current = Dt(N.key, b, f) ? S : K, L(y.current);
2660
- return;
2661
- }
2662
- Dt(N.key, b, f) ? a ? y.current = j >= K ? d && j !== i.current.length ? -1 : S : ee(i, {
2663
- startingIndex: j,
2664
- disabledIndices: R
2665
- }) : y.current = Math.min(K, ee(i, {
2666
- startingIndex: j,
2667
- disabledIndices: R
2668
- })) : a ? y.current = j <= S ? d && j !== -1 ? i.current.length : K : ee(i, {
2669
- startingIndex: j,
2670
- decrement: !0,
2671
- disabledIndices: R
2672
- }) : y.current = Math.max(S, ee(i, {
2673
- startingIndex: j,
2674
- decrement: !0,
2675
- disabledIndices: R
2676
- })), Ue(i, y.current) ? L(null) : L(y.current);
2677
- }
2678
- }), we = m.useMemo(() => g && n && Me && {
2679
- "aria-activedescendant": J || P
2680
- }, [g, n, Me, J, P]), me = m.useMemo(() => ({
2681
- "aria-orientation": b === "both" ? void 0 : b,
2682
- ...!An(o.domReference) && we,
2683
- onKeyDown: oe,
2684
- onPointerMove() {
2685
- F.current = !0;
2686
- }
2687
- }), [we, oe, o.domReference, b]), qe = m.useMemo(() => {
2688
- function N(S) {
2689
- h === "auto" && In(S.nativeEvent) && (T.current = !0);
2690
- }
2691
- function j(S) {
2692
- T.current = h, h === "auto" && Cn(S.nativeEvent) && (T.current = !0);
2693
- }
2694
- return {
2695
- ...we,
2696
- onKeyDown(S) {
2697
- F.current = !1;
2698
- const K = S.key.indexOf("Arrow") === 0, ie = Po(S.key, b, f), z = hn(S.key, b, f), ge = pn(S.key, b), tt = (p ? ie : ge) || S.key === "Enter" || S.key.trim() === "";
2699
- if (g && n) {
2700
- const nt = C == null ? void 0 : C.nodesRef.current.find((rt) => rt.parentId == null), Ee = C && nt ? yo(C.nodesRef.current, nt.id) : null;
2701
- if (K && Ee && k) {
2702
- const rt = new KeyboardEvent("keydown", {
2703
- key: S.key,
2704
- bubbles: !0
2705
- });
2706
- if (ie || z) {
2707
- var je, ae;
2708
- const Xn = ((je = Ee.context) == null ? void 0 : je.elements.domReference) === S.currentTarget, Ut = z && !Xn ? (ae = Ee.context) == null ? void 0 : ae.elements.domReference : ie ? i.current.find((Yt) => (Yt == null ? void 0 : Yt.id) === P) : null;
2709
- Ut && (re(S), Ut.dispatchEvent(rt), te(void 0));
2710
- }
2711
- if (ge && Ee.context && Ee.context.open && Ee.parentId && S.currentTarget !== Ee.context.elements.domReference) {
2712
- var Re;
2713
- re(S), (Re = Ee.context.elements.domReference) == null || Re.dispatchEvent(rt);
2714
- return;
2715
- }
2716
- }
2717
- return oe(S);
2718
- }
2719
- if (!(!n && !x && K)) {
2720
- if (tt && (O.current = p && ge ? null : S.key), p) {
2721
- ie && (re(S), n ? (y.current = Tt(i, de.current), L(y.current)) : r(!0, S.nativeEvent, "list-navigation"));
2722
- return;
2723
- }
2724
- ge && (c != null && (y.current = c), re(S), !n && x ? r(!0, S.nativeEvent, "list-navigation") : oe(S), n && L(y.current));
2725
- }
2726
- },
2727
- onFocus() {
2728
- n && !g && L(null);
2729
- },
2730
- onPointerDown: j,
2731
- onMouseDown: N,
2732
- onClick: N
2733
- };
2734
- }, [P, we, oe, de, h, i, p, L, r, n, x, b, f, c, C, g, k]);
2735
- return m.useMemo(() => l ? {
2736
- reference: qe,
2737
- floating: me,
2738
- item: ye
2739
- } : {}, [l, qe, me, ye]);
2740
- }
2741
- const ko = /* @__PURE__ */ new Map([["select", "listbox"], ["combobox", "listbox"], ["label", !1]]);
2742
- function Yo(e, t) {
2743
- var n;
2744
- t === void 0 && (t = {});
2745
- const {
2746
- open: r,
2747
- floatingId: o
2748
- } = e, {
2749
- enabled: i = !0,
2750
- role: s = "dialog"
2751
- } = t, u = (n = ko.get(s)) != null ? n : s, l = zt(), d = qt() != null, a = m.useMemo(() => u === "tooltip" || s === "label" ? {
2752
- ["aria-" + (s === "label" ? "labelledby" : "describedby")]: r ? o : void 0
2753
- } : {
2754
- "aria-expanded": r ? "true" : "false",
2755
- "aria-haspopup": u === "alertdialog" ? "dialog" : u,
2756
- "aria-controls": r ? o : void 0,
2757
- ...u === "listbox" && {
2758
- role: "combobox"
2759
- },
2760
- ...u === "menu" && {
2761
- id: l
2762
- },
2763
- ...u === "menu" && d && {
2764
- role: "menuitem"
2765
- },
2766
- ...s === "select" && {
2767
- "aria-autocomplete": "none"
2768
- },
2769
- ...s === "combobox" && {
2770
- "aria-autocomplete": "list"
2771
- }
2772
- }, [u, o, d, r, l, s]), p = m.useMemo(() => {
2773
- const g = {
2774
- id: o,
2775
- ...u && {
2776
- role: u
2777
- }
2778
- };
2779
- return u === "tooltip" || s === "label" ? g : {
2780
- ...g,
2781
- ...u === "menu" && {
2782
- "aria-labelledby": l
2783
- }
2784
- };
2785
- }, [u, o, l, s]), f = m.useCallback((g) => {
2786
- let {
2787
- active: h,
2788
- selected: v
2789
- } = g;
2790
- const x = {
2791
- role: "option",
2792
- ...h && {
2793
- id: o + "-option"
2794
- }
2795
- };
2796
- switch (s) {
2797
- case "select":
2798
- return {
2799
- ...x,
2800
- "aria-selected": h && v
2801
- };
2802
- case "combobox":
2803
- return {
2804
- ...x,
2805
- ...h && {
2806
- "aria-selected": !0
2807
- }
2808
- };
2809
- }
2810
- return {};
2811
- }, [o, s]);
2812
- return m.useMemo(() => i ? {
2813
- reference: a,
2814
- floating: p,
2815
- item: f
2816
- } : {}, [i, a, p, f]);
2817
- }
2818
- export {
2819
- Ko as F,
2820
- No as a,
2821
- qo as b,
2822
- ro as c,
2823
- Bo as d,
2824
- _o as e,
2825
- to as f,
2826
- Wo as g,
2827
- Yo as h,
2828
- zo as i,
2829
- Uo as j,
2830
- jo as k,
2831
- Ho as l,
2832
- eo as o,
2833
- Vo as s,
2834
- $o as u
2835
- };