@stihl-design-system/components 1.0.0-RC.29 → 1.0.0-RC.30

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 (46) hide show
  1. package/{actionbutton.DHt1AL7U.js → actionbutton.u1qp8oGC.js} +1 -1
  2. package/{actionlink.BML1jenE.js → actionlink.C7HzeIVa.js} +1 -1
  3. package/assets/ActionButton.oGVPTS1J.css +1 -0
  4. package/assets/ActionLink.CTh6IXrN.css +1 -0
  5. package/assets/Header.CNqtWTxB.css +1 -0
  6. package/assets/MegaMenu.DX9gChtY.css +1 -0
  7. package/assets/banner.BLdW5VF4.css +1 -0
  8. package/banner.j9YpudOS.js +55 -0
  9. package/chunks/ActionButton.B8zFwOrJ.js +165 -0
  10. package/chunks/{ActionLink.BlhqDEtq.js → ActionLink.IX6oRXU3.js} +31 -31
  11. package/chunks/Header.DqZRryB5.js +366 -0
  12. package/chunks/MegaMenu.BY7eOnhj.js +189 -0
  13. package/chunks/Popover.NGetxKGg.js +159 -0
  14. package/chunks/floating-ui.react.x0F9CYgn.js +1637 -0
  15. package/components/Banner/Banner.d.ts +1 -1
  16. package/components/InputFile/InputFile.d.ts +1 -1
  17. package/components/MegaMenu/MegaMenu.d.ts +32 -0
  18. package/components/MegaMenu/MegaMenu.test.d.ts +1 -0
  19. package/components/MegaMenu/MegaMenu.utils.d.ts +52 -0
  20. package/components/MegaMenu/MegaMenu.utils.test.d.ts +1 -0
  21. package/components/Popover/Popover.d.ts +1 -1
  22. package/components/Scroller/Scroller.d.ts +1 -1
  23. package/github-mark-white.svg +1 -0
  24. package/github-mark.svg +1 -0
  25. package/{header.Z4Oxj_xL.js → header.QpNjE3N-.js} +1 -1
  26. package/index.d.ts +2 -0
  27. package/index.es.js +117 -112
  28. package/megamenu.CdHrEeoh.js +12 -0
  29. package/megamenu.d.ts +2 -0
  30. package/package.json +3 -1
  31. package/partials/index.js +21 -15
  32. package/partials/lib/partials.d.ts +1 -1
  33. package/{popover.BFx99cHg.js → popover.DXxm1oWI.js} +3 -2
  34. package/styles/scss/ds/index.scss +0 -1
  35. package/styles/scss/ds/lib/grid-main.scss +2 -13
  36. package/styles/scss/ds/lib/grid-sidebar.scss +38 -136
  37. package/{topbar.Bccms0xZ.js → topbar.Dhy_TL0U.js} +1 -1
  38. package/assets/ActionButton.Ewi0i1hW.css +0 -1
  39. package/assets/ActionLink.BdPEvuGm.css +0 -1
  40. package/assets/Header.DO34x-dO.css +0 -1
  41. package/assets/banner.D9EiZqqR.css +0 -1
  42. package/banner.B2YO054K.js +0 -55
  43. package/chunks/ActionButton.CzaWZGPt.js +0 -165
  44. package/chunks/Header.BSvyYrIV.js +0 -368
  45. package/chunks/Popover.hXQTvwwd.js +0 -1685
  46. package/styles/scss/ds/lib/grid-sidebar-sidebar.scss +0 -52
@@ -0,0 +1,1637 @@
1
+ "use client";
2
+ import * as u from "react";
3
+ import { useLayoutEffect as Rt } from "react";
4
+ import { i as Wt, b as oe, f as Kt, c as Vt, o as qt, s as Ut, g as yt, d as G, e as Oe, h as jt, j as Ht, k as De, l as Yt } from "./floating-ui.dom.C9TD1WpB.js";
5
+ import { jsxs as Et, Fragment as Gt, jsx as se } from "react/jsx-runtime";
6
+ import * as He from "react-dom";
7
+ /*!
8
+ * tabbable 6.2.0
9
+ * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
10
+ */
11
+ var Xt = ["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])"], Ce = /* @__PURE__ */ Xt.join(","), wt = typeof Element > "u", me = wt ? function() {
12
+ } : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector, Ie = !wt && Element.prototype.getRootNode ? function(e) {
13
+ var t;
14
+ return e == null || (t = e.getRootNode) === null || t === void 0 ? void 0 : t.call(e);
15
+ } : function(e) {
16
+ return e == null ? void 0 : e.ownerDocument;
17
+ }, Ae = function e(t, n) {
18
+ var r;
19
+ n === void 0 && (n = !0);
20
+ var o = t == null || (r = t.getAttribute) === null || r === void 0 ? void 0 : r.call(t, "inert"), s = o === "" || o === "true", i = s || n && t && e(t.parentNode);
21
+ return i;
22
+ }, Zt = function(t) {
23
+ var n, r = t == null || (n = t.getAttribute) === null || n === void 0 ? void 0 : n.call(t, "contenteditable");
24
+ return r === "" || r === "true";
25
+ }, xt = function(t, n, r) {
26
+ if (Ae(t))
27
+ return [];
28
+ var o = Array.prototype.slice.apply(t.querySelectorAll(Ce));
29
+ return n && me.call(t, Ce) && o.unshift(t), o = o.filter(r), o;
30
+ }, Tt = function e(t, n, r) {
31
+ for (var o = [], s = Array.from(t); s.length; ) {
32
+ var i = s.shift();
33
+ if (!Ae(i, !1))
34
+ if (i.tagName === "SLOT") {
35
+ var a = i.assignedElements(), l = a.length ? a : i.children, c = e(l, !0, r);
36
+ r.flatten ? o.push.apply(o, c) : o.push({
37
+ scopeParent: i,
38
+ candidates: c
39
+ });
40
+ } else {
41
+ var p = me.call(i, Ce);
42
+ p && r.filter(i) && (n || !t.includes(i)) && o.push(i);
43
+ var g = i.shadowRoot || // check for an undisclosed shadow
44
+ typeof r.getShadowRoot == "function" && r.getShadowRoot(i), h = !Ae(g, !1) && (!r.shadowRootFilter || r.shadowRootFilter(i));
45
+ if (g && h) {
46
+ var m = e(g === !0 ? i.children : g.children, !0, r);
47
+ r.flatten ? o.push.apply(o, m) : o.push({
48
+ scopeParent: i,
49
+ candidates: m
50
+ });
51
+ } else
52
+ s.unshift.apply(s, i.children);
53
+ }
54
+ }
55
+ return o;
56
+ }, St = function(t) {
57
+ return !isNaN(parseInt(t.getAttribute("tabindex"), 10));
58
+ }, Ct = function(t) {
59
+ if (!t)
60
+ throw new Error("No node provided");
61
+ return t.tabIndex < 0 && (/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName) || Zt(t)) && !St(t) ? 0 : t.tabIndex;
62
+ }, zt = function(t, n) {
63
+ var r = Ct(t);
64
+ return r < 0 && n && !St(t) ? 0 : r;
65
+ }, Jt = function(t, n) {
66
+ return t.tabIndex === n.tabIndex ? t.documentOrder - n.documentOrder : t.tabIndex - n.tabIndex;
67
+ }, It = function(t) {
68
+ return t.tagName === "INPUT";
69
+ }, Qt = function(t) {
70
+ return It(t) && t.type === "hidden";
71
+ }, en = function(t) {
72
+ var n = t.tagName === "DETAILS" && Array.prototype.slice.apply(t.children).some(function(r) {
73
+ return r.tagName === "SUMMARY";
74
+ });
75
+ return n;
76
+ }, tn = function(t, n) {
77
+ for (var r = 0; r < t.length; r++)
78
+ if (t[r].checked && t[r].form === n)
79
+ return t[r];
80
+ }, nn = function(t) {
81
+ if (!t.name)
82
+ return !0;
83
+ var n = t.form || Ie(t), r = function(a) {
84
+ return n.querySelectorAll('input[type="radio"][name="' + a + '"]');
85
+ }, o;
86
+ if (typeof window < "u" && typeof window.CSS < "u" && typeof window.CSS.escape == "function")
87
+ o = r(window.CSS.escape(t.name));
88
+ else
89
+ try {
90
+ o = r(t.name);
91
+ } catch (i) {
92
+ return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s", i.message), !1;
93
+ }
94
+ var s = tn(o, t.form);
95
+ return !s || s === t;
96
+ }, rn = function(t) {
97
+ return It(t) && t.type === "radio";
98
+ }, on = function(t) {
99
+ return rn(t) && !nn(t);
100
+ }, sn = function(t) {
101
+ var n, r = t && Ie(t), o = (n = r) === null || n === void 0 ? void 0 : n.host, s = !1;
102
+ if (r && r !== t) {
103
+ var i, a, l;
104
+ for (s = !!((i = o) !== null && i !== void 0 && (a = i.ownerDocument) !== null && a !== void 0 && a.contains(o) || t != null && (l = t.ownerDocument) !== null && l !== void 0 && l.contains(t)); !s && o; ) {
105
+ var c, p, g;
106
+ r = Ie(o), o = (c = r) === null || c === void 0 ? void 0 : c.host, s = !!((p = o) !== null && p !== void 0 && (g = p.ownerDocument) !== null && g !== void 0 && g.contains(o));
107
+ }
108
+ }
109
+ return s;
110
+ }, Ze = function(t) {
111
+ var n = t.getBoundingClientRect(), r = n.width, o = n.height;
112
+ return r === 0 && o === 0;
113
+ }, un = function(t, n) {
114
+ var r = n.displayCheck, o = n.getShadowRoot;
115
+ if (getComputedStyle(t).visibility === "hidden")
116
+ return !0;
117
+ var s = me.call(t, "details>summary:first-of-type"), i = s ? t.parentElement : t;
118
+ if (me.call(i, "details:not([open]) *"))
119
+ return !0;
120
+ if (!r || r === "full" || r === "legacy-full") {
121
+ if (typeof o == "function") {
122
+ for (var a = t; t; ) {
123
+ var l = t.parentElement, c = Ie(t);
124
+ if (l && !l.shadowRoot && o(l) === !0)
125
+ return Ze(t);
126
+ t.assignedSlot ? t = t.assignedSlot : !l && c !== t.ownerDocument ? t = c.host : t = l;
127
+ }
128
+ t = a;
129
+ }
130
+ if (sn(t))
131
+ return !t.getClientRects().length;
132
+ if (r !== "legacy-full")
133
+ return !0;
134
+ } else if (r === "non-zero-area")
135
+ return Ze(t);
136
+ return !1;
137
+ }, an = function(t) {
138
+ if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))
139
+ for (var n = t.parentElement; n; ) {
140
+ if (n.tagName === "FIELDSET" && n.disabled) {
141
+ for (var r = 0; r < n.children.length; r++) {
142
+ var o = n.children.item(r);
143
+ if (o.tagName === "LEGEND")
144
+ return me.call(n, "fieldset[disabled] *") ? !0 : !o.contains(t);
145
+ }
146
+ return !0;
147
+ }
148
+ n = n.parentElement;
149
+ }
150
+ return !1;
151
+ }, Ke = function(t, n) {
152
+ return !(n.disabled || // we must do an inert look up to filter out any elements inside an inert ancestor
153
+ // because we're limited in the type of selectors we can use in JSDom (see related
154
+ // note related to `candidateSelectors`)
155
+ Ae(n) || Qt(n) || un(n, t) || // For a details element with a summary, the summary element gets the focus
156
+ en(n) || an(n));
157
+ }, Ve = function(t, n) {
158
+ return !(on(n) || Ct(n) < 0 || !Ke(t, n));
159
+ }, cn = function(t) {
160
+ var n = parseInt(t.getAttribute("tabindex"), 10);
161
+ return !!(isNaN(n) || n >= 0);
162
+ }, ln = function e(t) {
163
+ var n = [], r = [];
164
+ return t.forEach(function(o, s) {
165
+ var i = !!o.scopeParent, a = i ? o.scopeParent : o, l = zt(a, i), c = i ? e(o.candidates) : a;
166
+ l === 0 ? i ? n.push.apply(n, c) : n.push(a) : r.push({
167
+ documentOrder: s,
168
+ tabIndex: l,
169
+ item: o,
170
+ isScope: i,
171
+ content: c
172
+ });
173
+ }), r.sort(Jt).reduce(function(o, s) {
174
+ return s.isScope ? o.push.apply(o, s.content) : o.push(s.content), o;
175
+ }, []).concat(n);
176
+ }, ke = function(t, n) {
177
+ n = n || {};
178
+ var r;
179
+ return n.getShadowRoot ? r = Tt([t], n.includeContainer, {
180
+ filter: Ve.bind(null, n),
181
+ flatten: !1,
182
+ getShadowRoot: n.getShadowRoot,
183
+ shadowRootFilter: cn
184
+ }) : r = xt(t, n.includeContainer, Ve.bind(null, n)), ln(r);
185
+ }, fn = function(t, n) {
186
+ n = n || {};
187
+ var r;
188
+ return n.getShadowRoot ? r = Tt([t], n.includeContainer, {
189
+ filter: Ke.bind(null, n),
190
+ flatten: !0,
191
+ getShadowRoot: n.getShadowRoot
192
+ }) : r = xt(t, n.includeContainer, Ke.bind(null, n)), r;
193
+ }, At = function(t, n) {
194
+ if (n = n || {}, !t)
195
+ throw new Error("No node provided");
196
+ return me.call(t, Ce) === !1 ? !1 : Ve(n, t);
197
+ };
198
+ function Mt() {
199
+ const e = navigator.userAgentData;
200
+ return e != null && e.platform ? e.platform : navigator.platform;
201
+ }
202
+ function Pt() {
203
+ const e = navigator.userAgentData;
204
+ return e && Array.isArray(e.brands) ? e.brands.map((t) => {
205
+ let {
206
+ brand: n,
207
+ version: r
208
+ } = t;
209
+ return n + "/" + r;
210
+ }).join(" ") : navigator.userAgent;
211
+ }
212
+ function dn() {
213
+ return /apple/i.test(navigator.vendor);
214
+ }
215
+ function qe() {
216
+ const e = /android/i;
217
+ return e.test(Mt()) || e.test(Pt());
218
+ }
219
+ function pn() {
220
+ return Pt().includes("jsdom/");
221
+ }
222
+ const ze = "data-floating-ui-focusable", mn = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";
223
+ function de(e) {
224
+ let t = e.activeElement;
225
+ for (; ((n = t) == null || (n = n.shadowRoot) == null ? void 0 : n.activeElement) != null; ) {
226
+ var n;
227
+ t = t.shadowRoot.activeElement;
228
+ }
229
+ return t;
230
+ }
231
+ function Y(e, t) {
232
+ if (!e || !t)
233
+ return !1;
234
+ const n = t.getRootNode == null ? void 0 : t.getRootNode();
235
+ if (e.contains(t))
236
+ return !0;
237
+ if (n && Wt(n)) {
238
+ let r = t;
239
+ for (; r; ) {
240
+ if (e === r)
241
+ return !0;
242
+ r = r.parentNode || r.host;
243
+ }
244
+ }
245
+ return !1;
246
+ }
247
+ function ae(e) {
248
+ return "composedPath" in e ? e.composedPath()[0] : e.target;
249
+ }
250
+ function Ne(e, t) {
251
+ if (t == null)
252
+ return !1;
253
+ if ("composedPath" in e)
254
+ return e.composedPath().includes(t);
255
+ const n = e;
256
+ return n.target != null && t.contains(n.target);
257
+ }
258
+ function bn(e) {
259
+ return e.matches("html,body");
260
+ }
261
+ function z(e) {
262
+ return (e == null ? void 0 : e.ownerDocument) || document;
263
+ }
264
+ function kt(e) {
265
+ return oe(e) && e.matches(mn);
266
+ }
267
+ function Je(e) {
268
+ return e ? e.getAttribute("role") === "combobox" && kt(e) : !1;
269
+ }
270
+ function Ue(e) {
271
+ return e ? e.hasAttribute(ze) ? e : e.querySelector("[" + ze + "]") || e : null;
272
+ }
273
+ function ge(e, t) {
274
+ let n = e.filter((o) => {
275
+ var s;
276
+ return o.parentId === t && ((s = o.context) == null ? void 0 : s.open);
277
+ }), r = n;
278
+ for (; r.length; )
279
+ r = e.filter((o) => {
280
+ var s;
281
+ return (s = r) == null ? void 0 : s.some((i) => {
282
+ var a;
283
+ return o.parentId === i.id && ((a = o.context) == null ? void 0 : a.open);
284
+ });
285
+ }), n = n.concat(r);
286
+ return n;
287
+ }
288
+ function Qe(e, t) {
289
+ var n;
290
+ let r = [], o = (n = e.find((s) => s.id === t)) == null ? void 0 : n.parentId;
291
+ for (; o; ) {
292
+ const s = e.find((i) => i.id === o);
293
+ o = s == null ? void 0 : s.parentId, s && (r = r.concat(s));
294
+ }
295
+ return r;
296
+ }
297
+ function Le(e) {
298
+ e.preventDefault(), e.stopPropagation();
299
+ }
300
+ function gn(e) {
301
+ return "nativeEvent" in e;
302
+ }
303
+ function vn(e) {
304
+ return e.mozInputSource === 0 && e.isTrusted ? !0 : qe() && e.pointerType ? e.type === "click" && e.buttons === 1 : e.detail === 0 && !e.pointerType;
305
+ }
306
+ function hn(e) {
307
+ return pn() ? !1 : !qe() && e.width === 0 && e.height === 0 || qe() && e.width === 1 && e.height === 1 && e.pressure === 0 && e.detail === 0 && e.pointerType === "mouse" || // iOS VoiceOver returns 0.333• for width/height.
308
+ e.width < 1 && e.height < 1 && e.pressure === 0 && e.detail === 0 && e.pointerType === "touch";
309
+ }
310
+ function et(e, t) {
311
+ return ["mouse", "pen"].includes(e);
312
+ }
313
+ var Rn = typeof document < "u", yn = function() {
314
+ }, j = Rn ? Rt : yn;
315
+ const En = {
316
+ ...u
317
+ };
318
+ function $e(e) {
319
+ const t = u.useRef(e);
320
+ return j(() => {
321
+ t.current = e;
322
+ }), t;
323
+ }
324
+ const wn = En.useInsertionEffect, xn = wn || ((e) => e());
325
+ function te(e) {
326
+ const t = u.useRef(() => {
327
+ if (process.env.NODE_ENV !== "production")
328
+ throw new Error("Cannot call an event handler while rendering.");
329
+ });
330
+ return xn(() => {
331
+ t.current = e;
332
+ }), u.useCallback(function() {
333
+ for (var n = arguments.length, r = new Array(n), o = 0; o < n; o++)
334
+ r[o] = arguments[o];
335
+ return t.current == null ? void 0 : t.current(...r);
336
+ }, []);
337
+ }
338
+ const Re = () => ({
339
+ getShadowRoot: !0,
340
+ displayCheck: (
341
+ // JSDOM does not support the `tabbable` library. To solve this we can
342
+ // check if `ResizeObserver` is a real function (not polyfilled), which
343
+ // determines if the current environment is JSDOM-like.
344
+ typeof ResizeObserver == "function" && ResizeObserver.toString().includes("[native code]") ? "full" : "none"
345
+ )
346
+ });
347
+ function Ft(e, t) {
348
+ const n = ke(e, Re()), r = n.length;
349
+ if (r === 0) return;
350
+ const o = de(z(e)), s = n.indexOf(o), i = s === -1 ? t === 1 ? 0 : r - 1 : s + t;
351
+ return n[i];
352
+ }
353
+ function Ot(e) {
354
+ return Ft(z(e).body, 1) || e;
355
+ }
356
+ function Dt(e) {
357
+ return Ft(z(e).body, -1) || e;
358
+ }
359
+ function ve(e, t) {
360
+ const n = t || e.currentTarget, r = e.relatedTarget;
361
+ return !r || !Y(n, r);
362
+ }
363
+ function Tn(e) {
364
+ ke(e, Re()).forEach((n) => {
365
+ n.dataset.tabindex = n.getAttribute("tabindex") || "", n.setAttribute("tabindex", "-1");
366
+ });
367
+ }
368
+ function tt(e) {
369
+ e.querySelectorAll("[data-tabindex]").forEach((n) => {
370
+ const r = n.dataset.tabindex;
371
+ delete n.dataset.tabindex, r ? n.setAttribute("tabindex", r) : n.removeAttribute("tabindex");
372
+ });
373
+ }
374
+ var Sn = typeof document < "u", Cn = function() {
375
+ }, Se = Sn ? Rt : Cn;
376
+ function Me(e, t) {
377
+ if (e === t)
378
+ return !0;
379
+ if (typeof e != typeof t)
380
+ return !1;
381
+ if (typeof e == "function" && e.toString() === t.toString())
382
+ return !0;
383
+ let n, r, o;
384
+ if (e && t && typeof e == "object") {
385
+ if (Array.isArray(e)) {
386
+ if (n = e.length, n !== t.length) return !1;
387
+ for (r = n; r-- !== 0; )
388
+ if (!Me(e[r], t[r]))
389
+ return !1;
390
+ return !0;
391
+ }
392
+ if (o = Object.keys(e), n = o.length, n !== Object.keys(t).length)
393
+ return !1;
394
+ for (r = n; r-- !== 0; )
395
+ if (!{}.hasOwnProperty.call(t, o[r]))
396
+ return !1;
397
+ for (r = n; r-- !== 0; ) {
398
+ const s = o[r];
399
+ if (!(s === "_owner" && e.$$typeof) && !Me(e[s], t[s]))
400
+ return !1;
401
+ }
402
+ return !0;
403
+ }
404
+ return e !== e && t !== t;
405
+ }
406
+ function Nt(e) {
407
+ return typeof window > "u" ? 1 : (e.ownerDocument.defaultView || window).devicePixelRatio || 1;
408
+ }
409
+ function nt(e, t) {
410
+ const n = Nt(e);
411
+ return Math.round(t * n) / n;
412
+ }
413
+ function _e(e) {
414
+ const t = u.useRef(e);
415
+ return Se(() => {
416
+ t.current = e;
417
+ }), t;
418
+ }
419
+ function In(e) {
420
+ e === void 0 && (e = {});
421
+ const {
422
+ placement: t = "bottom",
423
+ strategy: n = "absolute",
424
+ middleware: r = [],
425
+ platform: o,
426
+ elements: {
427
+ reference: s,
428
+ floating: i
429
+ } = {},
430
+ transform: a = !0,
431
+ whileElementsMounted: l,
432
+ open: c
433
+ } = e, [p, g] = u.useState({
434
+ x: 0,
435
+ y: 0,
436
+ strategy: n,
437
+ placement: t,
438
+ middlewareData: {},
439
+ isPositioned: !1
440
+ }), [h, m] = u.useState(r);
441
+ Me(h, r) || m(r);
442
+ const [R, f] = u.useState(null), [w, I] = u.useState(null), b = u.useCallback((y) => {
443
+ y !== V.current && (V.current = y, f(y));
444
+ }, []), v = u.useCallback((y) => {
445
+ y !== D.current && (D.current = y, I(y));
446
+ }, []), M = s || R, N = i || w, V = u.useRef(null), D = u.useRef(null), J = u.useRef(p), U = l != null, X = _e(l), L = _e(o), ne = _e(c), H = u.useCallback(() => {
447
+ if (!V.current || !D.current)
448
+ return;
449
+ const y = {
450
+ placement: t,
451
+ strategy: n,
452
+ middleware: h
453
+ };
454
+ L.current && (y.platform = L.current), Vt(V.current, D.current, y).then((E) => {
455
+ const k = {
456
+ ...E,
457
+ // The floating element's position may be recomputed while it's closed
458
+ // but still mounted (such as when transitioning out). To ensure
459
+ // `isPositioned` will be `false` initially on the next open, avoid
460
+ // setting it to `true` when `open === false` (must be specified).
461
+ isPositioned: ne.current !== !1
462
+ };
463
+ $.current && !Me(J.current, k) && (J.current = k, He.flushSync(() => {
464
+ g(k);
465
+ }));
466
+ });
467
+ }, [h, t, n, L, ne]);
468
+ Se(() => {
469
+ c === !1 && J.current.isPositioned && (J.current.isPositioned = !1, g((y) => ({
470
+ ...y,
471
+ isPositioned: !1
472
+ })));
473
+ }, [c]);
474
+ const $ = u.useRef(!1);
475
+ Se(() => ($.current = !0, () => {
476
+ $.current = !1;
477
+ }), []), Se(() => {
478
+ if (M && (V.current = M), N && (D.current = N), M && N) {
479
+ if (X.current)
480
+ return X.current(M, N, H);
481
+ H();
482
+ }
483
+ }, [M, N, H, X, U]);
484
+ const d = u.useMemo(() => ({
485
+ reference: V,
486
+ floating: D,
487
+ setReference: b,
488
+ setFloating: v
489
+ }), [b, v]), P = u.useMemo(() => ({
490
+ reference: M,
491
+ floating: N
492
+ }), [M, N]), _ = u.useMemo(() => {
493
+ const y = {
494
+ position: n,
495
+ left: 0,
496
+ top: 0
497
+ };
498
+ if (!P.floating)
499
+ return y;
500
+ const E = nt(P.floating, p.x), k = nt(P.floating, p.y);
501
+ return a ? {
502
+ ...y,
503
+ transform: "translate(" + E + "px, " + k + "px)",
504
+ ...Nt(P.floating) >= 1.5 && {
505
+ willChange: "transform"
506
+ }
507
+ } : {
508
+ position: n,
509
+ left: E,
510
+ top: k
511
+ };
512
+ }, [n, a, P.floating, p.x, p.y]);
513
+ return u.useMemo(() => ({
514
+ ...p,
515
+ update: H,
516
+ refs: d,
517
+ elements: P,
518
+ floatingStyles: _
519
+ }), [p, H, d, P, _]);
520
+ }
521
+ const rr = (e, t) => ({
522
+ ...qt(e),
523
+ options: [e, t]
524
+ }), or = (e, t) => ({
525
+ ...Ut(e),
526
+ options: [e, t]
527
+ }), sr = (e, t) => ({
528
+ ...Kt(e),
529
+ options: [e, t]
530
+ });
531
+ function ir(e) {
532
+ const t = u.useRef(void 0), n = u.useCallback((r) => {
533
+ const o = e.map((s) => {
534
+ if (s != null) {
535
+ if (typeof s == "function") {
536
+ const i = s, a = i(r);
537
+ return typeof a == "function" ? a : () => {
538
+ i(null);
539
+ };
540
+ }
541
+ return s.current = r, () => {
542
+ s.current = null;
543
+ };
544
+ }
545
+ });
546
+ return () => {
547
+ o.forEach((s) => s == null ? void 0 : s());
548
+ };
549
+ }, e);
550
+ return u.useMemo(() => e.every((r) => r == null) ? null : (r) => {
551
+ t.current && (t.current(), t.current = void 0), r != null && (t.current = n(r));
552
+ }, e);
553
+ }
554
+ const An = "data-floating-ui-focusable", rt = "active", ot = "selected", Mn = {
555
+ ...u
556
+ };
557
+ let st = !1, Pn = 0;
558
+ const it = () => (
559
+ // Ensure the id is unique with multiple independent versions of Floating UI
560
+ // on <React 18
561
+ "floating-ui-" + Math.random().toString(36).slice(2, 6) + Pn++
562
+ );
563
+ function kn() {
564
+ const [e, t] = u.useState(() => st ? it() : void 0);
565
+ return j(() => {
566
+ e == null && t(it());
567
+ }, []), u.useEffect(() => {
568
+ st = !0;
569
+ }, []), e;
570
+ }
571
+ const Fn = Mn.useId, Ye = Fn || kn;
572
+ let je;
573
+ process.env.NODE_ENV !== "production" && (je = /* @__PURE__ */ new Set());
574
+ function On() {
575
+ for (var e, t = arguments.length, n = new Array(t), r = 0; r < t; r++)
576
+ n[r] = arguments[r];
577
+ const o = "Floating UI: " + n.join(" ");
578
+ if (!((e = je) != null && e.has(o))) {
579
+ var s;
580
+ (s = je) == null || s.add(o), console.error(o);
581
+ }
582
+ }
583
+ function Dn() {
584
+ const e = /* @__PURE__ */ new Map();
585
+ return {
586
+ emit(t, n) {
587
+ var r;
588
+ (r = e.get(t)) == null || r.forEach((o) => o(n));
589
+ },
590
+ on(t, n) {
591
+ e.has(t) || e.set(t, /* @__PURE__ */ new Set()), e.get(t).add(n);
592
+ },
593
+ off(t, n) {
594
+ var r;
595
+ (r = e.get(t)) == null || r.delete(n);
596
+ }
597
+ };
598
+ }
599
+ const Nn = /* @__PURE__ */ u.createContext(null), Ln = /* @__PURE__ */ u.createContext(null), Lt = () => {
600
+ var e;
601
+ return ((e = u.useContext(Nn)) == null ? void 0 : e.id) || null;
602
+ }, Ge = () => u.useContext(Ln);
603
+ function he(e) {
604
+ return "data-floating-ui-" + e;
605
+ }
606
+ function $n(e) {
607
+ e.current !== -1 && (clearTimeout(e.current), e.current = -1);
608
+ }
609
+ let ut = 0;
610
+ function fe(e, t) {
611
+ t === void 0 && (t = {});
612
+ const {
613
+ preventScroll: n = !1,
614
+ cancelPrevious: r = !0,
615
+ sync: o = !1
616
+ } = t;
617
+ r && cancelAnimationFrame(ut);
618
+ const s = () => e == null ? void 0 : e.focus({
619
+ preventScroll: n
620
+ });
621
+ o ? s() : ut = requestAnimationFrame(s);
622
+ }
623
+ function _n(e) {
624
+ return (e == null ? void 0 : e.ownerDocument) || document;
625
+ }
626
+ const pe = {
627
+ inert: /* @__PURE__ */ new WeakMap(),
628
+ "aria-hidden": /* @__PURE__ */ new WeakMap(),
629
+ none: /* @__PURE__ */ new WeakMap()
630
+ };
631
+ function at(e) {
632
+ return e === "inert" ? pe.inert : e === "aria-hidden" ? pe["aria-hidden"] : pe.none;
633
+ }
634
+ let we = /* @__PURE__ */ new WeakSet(), xe = {}, Be = 0;
635
+ const Bn = () => typeof HTMLElement < "u" && "inert" in HTMLElement.prototype, $t = (e) => e && (e.host || $t(e.parentNode)), Wn = (e, t) => t.map((n) => {
636
+ if (e.contains(n))
637
+ return n;
638
+ const r = $t(n);
639
+ return e.contains(r) ? r : null;
640
+ }).filter((n) => n != null);
641
+ function Kn(e, t, n, r) {
642
+ const o = "data-floating-ui-inert", s = r ? "inert" : n ? "aria-hidden" : null, i = Wn(t, e), a = /* @__PURE__ */ new Set(), l = new Set(i), c = [];
643
+ xe[o] || (xe[o] = /* @__PURE__ */ new WeakMap());
644
+ const p = xe[o];
645
+ i.forEach(g), h(t), a.clear();
646
+ function g(m) {
647
+ !m || a.has(m) || (a.add(m), m.parentNode && g(m.parentNode));
648
+ }
649
+ function h(m) {
650
+ !m || l.has(m) || [].forEach.call(m.children, (R) => {
651
+ if (yt(R) !== "script")
652
+ if (a.has(R))
653
+ h(R);
654
+ else {
655
+ const f = s ? R.getAttribute(s) : null, w = f !== null && f !== "false", I = at(s), b = (I.get(R) || 0) + 1, v = (p.get(R) || 0) + 1;
656
+ I.set(R, b), p.set(R, v), c.push(R), b === 1 && w && we.add(R), v === 1 && R.setAttribute(o, ""), !w && s && R.setAttribute(s, s === "inert" ? "" : "true");
657
+ }
658
+ });
659
+ }
660
+ return Be++, () => {
661
+ c.forEach((m) => {
662
+ const R = at(s), w = (R.get(m) || 0) - 1, I = (p.get(m) || 0) - 1;
663
+ R.set(m, w), p.set(m, I), w || (!we.has(m) && s && m.removeAttribute(s), we.delete(m)), I || m.removeAttribute(o);
664
+ }), Be--, Be || (pe.inert = /* @__PURE__ */ new WeakMap(), pe["aria-hidden"] = /* @__PURE__ */ new WeakMap(), pe.none = /* @__PURE__ */ new WeakMap(), we = /* @__PURE__ */ new WeakSet(), xe = {});
665
+ };
666
+ }
667
+ function ct(e, t, n) {
668
+ t === void 0 && (t = !1), n === void 0 && (n = !1);
669
+ const r = _n(e[0]).body;
670
+ return Kn(e.concat(Array.from(r.querySelectorAll("[aria-live]"))), r, t, n);
671
+ }
672
+ const Fe = {
673
+ border: 0,
674
+ clip: "rect(0 0 0 0)",
675
+ height: "1px",
676
+ margin: "-1px",
677
+ overflow: "hidden",
678
+ padding: 0,
679
+ position: "fixed",
680
+ whiteSpace: "nowrap",
681
+ width: "1px",
682
+ top: 0,
683
+ left: 0
684
+ }, Pe = /* @__PURE__ */ u.forwardRef(function(t, n) {
685
+ const [r, o] = u.useState();
686
+ j(() => {
687
+ dn() && o("button");
688
+ }, []);
689
+ const s = {
690
+ ref: n,
691
+ tabIndex: 0,
692
+ // Role is only for VoiceOver
693
+ role: r,
694
+ "aria-hidden": r ? void 0 : !0,
695
+ [he("focus-guard")]: "",
696
+ style: Fe
697
+ };
698
+ return /* @__PURE__ */ se("span", {
699
+ ...t,
700
+ ...s
701
+ });
702
+ }), _t = /* @__PURE__ */ u.createContext(null), lt = /* @__PURE__ */ he("portal");
703
+ function Vn(e) {
704
+ e === void 0 && (e = {});
705
+ const {
706
+ id: t,
707
+ root: n
708
+ } = e, r = Ye(), o = Bt(), [s, i] = u.useState(null), a = u.useRef(null);
709
+ return j(() => () => {
710
+ s == null || s.remove(), queueMicrotask(() => {
711
+ a.current = null;
712
+ });
713
+ }, [s]), j(() => {
714
+ if (!r || a.current) return;
715
+ const l = t ? document.getElementById(t) : null;
716
+ if (!l) return;
717
+ const c = document.createElement("div");
718
+ c.id = r, c.setAttribute(lt, ""), l.appendChild(c), a.current = c, i(c);
719
+ }, [t, r]), j(() => {
720
+ if (n === null || !r || a.current) return;
721
+ let l = n || (o == null ? void 0 : o.portalNode);
722
+ l && !G(l) && (l = l.current), l = l || document.body;
723
+ let c = null;
724
+ t && (c = document.createElement("div"), c.id = t, l.appendChild(c));
725
+ const p = document.createElement("div");
726
+ p.id = r, p.setAttribute(lt, ""), l = c || l, l.appendChild(p), a.current = p, i(p);
727
+ }, [t, n, r, o]), s;
728
+ }
729
+ function ur(e) {
730
+ const {
731
+ children: t,
732
+ id: n,
733
+ root: r,
734
+ preserveTabOrder: o = !0
735
+ } = e, s = Vn({
736
+ id: n,
737
+ root: r
738
+ }), [i, a] = u.useState(null), l = u.useRef(null), c = u.useRef(null), p = u.useRef(null), g = u.useRef(null), h = i == null ? void 0 : i.modal, m = i == null ? void 0 : i.open, R = (
739
+ // The FocusManager and therefore floating element are currently open/
740
+ // rendered.
741
+ !!i && // Guards are only for non-modal focus management.
742
+ !i.modal && // Don't render if unmount is transitioning.
743
+ i.open && o && !!(r || s)
744
+ );
745
+ return u.useEffect(() => {
746
+ if (!s || !o || h)
747
+ return;
748
+ function f(w) {
749
+ s && ve(w) && (w.type === "focusin" ? tt : Tn)(s);
750
+ }
751
+ return s.addEventListener("focusin", f, !0), s.addEventListener("focusout", f, !0), () => {
752
+ s.removeEventListener("focusin", f, !0), s.removeEventListener("focusout", f, !0);
753
+ };
754
+ }, [s, o, h]), u.useEffect(() => {
755
+ s && (m || tt(s));
756
+ }, [m, s]), /* @__PURE__ */ Et(_t.Provider, {
757
+ value: u.useMemo(() => ({
758
+ preserveTabOrder: o,
759
+ beforeOutsideRef: l,
760
+ afterOutsideRef: c,
761
+ beforeInsideRef: p,
762
+ afterInsideRef: g,
763
+ portalNode: s,
764
+ setFocusManagerState: a
765
+ }), [o, s]),
766
+ children: [R && s && /* @__PURE__ */ se(Pe, {
767
+ "data-type": "outside",
768
+ ref: l,
769
+ onFocus: (f) => {
770
+ if (ve(f, s)) {
771
+ var w;
772
+ (w = p.current) == null || w.focus();
773
+ } else {
774
+ const I = i ? i.domReference : null, b = Dt(I);
775
+ b == null || b.focus();
776
+ }
777
+ }
778
+ }), R && s && /* @__PURE__ */ se("span", {
779
+ "aria-owns": s.id,
780
+ style: Fe
781
+ }), s && /* @__PURE__ */ He.createPortal(t, s), R && s && /* @__PURE__ */ se(Pe, {
782
+ "data-type": "outside",
783
+ ref: c,
784
+ onFocus: (f) => {
785
+ if (ve(f, s)) {
786
+ var w;
787
+ (w = g.current) == null || w.focus();
788
+ } else {
789
+ const I = i ? i.domReference : null, b = Ot(I);
790
+ b == null || b.focus(), i != null && i.closeOnFocusOut && (i == null || i.onOpenChange(!1, f.nativeEvent, "focus-out"));
791
+ }
792
+ }
793
+ })]
794
+ });
795
+ }
796
+ const Bt = () => u.useContext(_t);
797
+ function ft(e) {
798
+ return u.useMemo(() => (t) => {
799
+ e.forEach((n) => {
800
+ n && (n.current = t);
801
+ });
802
+ }, e);
803
+ }
804
+ const qn = 20;
805
+ let le = [];
806
+ function Un(e) {
807
+ le = le.filter((t) => t.isConnected), e && yt(e) !== "body" && (le.push(e), le.length > qn && (le = le.slice(-20)));
808
+ }
809
+ function dt() {
810
+ return le.slice().reverse().find((e) => e.isConnected);
811
+ }
812
+ function jn(e) {
813
+ const t = Re();
814
+ return At(e, t) ? e : ke(e, t)[0] || e;
815
+ }
816
+ function pt(e, t) {
817
+ var n;
818
+ if (!t.current.includes("floating") && !((n = e.getAttribute("role")) != null && n.includes("dialog")))
819
+ return;
820
+ const r = Re(), s = fn(e, r).filter((a) => {
821
+ const l = a.getAttribute("data-tabindex") || "";
822
+ return At(a, r) || a.hasAttribute("data-tabindex") && !l.startsWith("-");
823
+ }), i = e.getAttribute("tabindex");
824
+ t.current.includes("floating") || s.length === 0 ? i !== "0" && e.setAttribute("tabindex", "0") : (i !== "-1" || e.hasAttribute("data-tabindex") && e.getAttribute("data-tabindex") !== "-1") && (e.setAttribute("tabindex", "-1"), e.setAttribute("data-tabindex", "-1"));
825
+ }
826
+ const Hn = /* @__PURE__ */ u.forwardRef(function(t, n) {
827
+ return /* @__PURE__ */ se("button", {
828
+ ...t,
829
+ type: "button",
830
+ ref: n,
831
+ tabIndex: -1,
832
+ style: Fe
833
+ });
834
+ });
835
+ function ar(e) {
836
+ const {
837
+ context: t,
838
+ children: n,
839
+ disabled: r = !1,
840
+ order: o = ["content"],
841
+ guards: s = !0,
842
+ initialFocus: i = 0,
843
+ returnFocus: a = !0,
844
+ restoreFocus: l = !1,
845
+ modal: c = !0,
846
+ visuallyHiddenDismiss: p = !1,
847
+ closeOnFocusOut: g = !0,
848
+ outsideElementsInert: h = !1,
849
+ getInsideElements: m = () => []
850
+ } = e, {
851
+ open: R,
852
+ onOpenChange: f,
853
+ events: w,
854
+ dataRef: I,
855
+ elements: {
856
+ domReference: b,
857
+ floating: v
858
+ }
859
+ } = t, M = te(() => {
860
+ var T;
861
+ return (T = I.current.floatingContext) == null ? void 0 : T.nodeId;
862
+ }), N = te(m), V = typeof i == "number" && i < 0, D = Je(b) && V, J = Bn(), U = J ? s : !0, X = !U || J && h, L = $e(o), ne = $e(i), H = $e(a), $ = Ge(), d = Bt(), P = u.useRef(null), _ = u.useRef(null), y = u.useRef(!1), E = u.useRef(!1), k = u.useRef(-1), B = d != null, x = Ue(v), Q = te(function(T) {
863
+ return T === void 0 && (T = x), T ? ke(T, Re()) : [];
864
+ }), ie = te((T) => {
865
+ const A = Q(T);
866
+ return L.current.map((S) => b && S === "reference" ? b : x && S === "floating" ? x : A).filter(Boolean).flat();
867
+ });
868
+ u.useEffect(() => {
869
+ if (r || !c) return;
870
+ function T(S) {
871
+ if (S.key === "Tab") {
872
+ Y(x, de(z(x))) && Q().length === 0 && !D && Le(S);
873
+ const C = ie(), W = ae(S);
874
+ L.current[0] === "reference" && W === b && (Le(S), S.shiftKey ? fe(C[C.length - 1]) : fe(C[1])), L.current[1] === "floating" && W === x && S.shiftKey && (Le(S), fe(C[0]));
875
+ }
876
+ }
877
+ const A = z(x);
878
+ return A.addEventListener("keydown", T), () => {
879
+ A.removeEventListener("keydown", T);
880
+ };
881
+ }, [r, b, x, c, L, D, Q, ie]), u.useEffect(() => {
882
+ if (r || !v) return;
883
+ function T(A) {
884
+ const S = ae(A), W = Q().indexOf(S);
885
+ W !== -1 && (k.current = W);
886
+ }
887
+ return v.addEventListener("focusin", T), () => {
888
+ v.removeEventListener("focusin", T);
889
+ };
890
+ }, [r, v, Q]), u.useEffect(() => {
891
+ if (r || !g) return;
892
+ function T() {
893
+ E.current = !0, setTimeout(() => {
894
+ E.current = !1;
895
+ });
896
+ }
897
+ function A(S) {
898
+ const C = S.relatedTarget, W = S.currentTarget, K = ae(S);
899
+ queueMicrotask(() => {
900
+ const ee = M(), re = !(Y(b, C) || Y(v, C) || Y(C, v) || Y(d == null ? void 0 : d.portalNode, C) || C != null && C.hasAttribute(he("focus-guard")) || $ && (ge($.nodesRef.current, ee).find((F) => {
901
+ var O, ue;
902
+ return Y((O = F.context) == null ? void 0 : O.elements.floating, C) || Y((ue = F.context) == null ? void 0 : ue.elements.domReference, C);
903
+ }) || Qe($.nodesRef.current, ee).find((F) => {
904
+ var O, ue, Xe;
905
+ return [(O = F.context) == null ? void 0 : O.elements.floating, Ue((ue = F.context) == null ? void 0 : ue.elements.floating)].includes(C) || ((Xe = F.context) == null ? void 0 : Xe.elements.domReference) === C;
906
+ })));
907
+ if (W === b && x && pt(x, L), l && W !== b && !(K != null && K.isConnected) && de(z(x)) === z(x).body) {
908
+ oe(x) && x.focus();
909
+ const F = k.current, O = Q(), ue = O[F] || O[O.length - 1] || x;
910
+ oe(ue) && ue.focus();
911
+ }
912
+ if (I.current.insideReactTree) {
913
+ I.current.insideReactTree = !1;
914
+ return;
915
+ }
916
+ (D || !c) && C && re && !E.current && // Fix React 18 Strict Mode returnFocus due to double rendering.
917
+ C !== dt() && (y.current = !0, f(!1, S, "focus-out"));
918
+ });
919
+ }
920
+ if (v && oe(b))
921
+ return b.addEventListener("focusout", A), b.addEventListener("pointerdown", T), v.addEventListener("focusout", A), () => {
922
+ b.removeEventListener("focusout", A), b.removeEventListener("pointerdown", T), v.removeEventListener("focusout", A);
923
+ };
924
+ }, [r, b, v, x, c, $, d, f, g, l, Q, D, M, L, I]);
925
+ const be = u.useRef(null), q = u.useRef(null), Z = ft([be, d == null ? void 0 : d.beforeInsideRef]), ce = ft([q, d == null ? void 0 : d.afterInsideRef]);
926
+ u.useEffect(() => {
927
+ var T, A;
928
+ if (r || !v) return;
929
+ const S = Array.from((d == null || (T = d.portalNode) == null ? void 0 : T.querySelectorAll("[" + he("portal") + "]")) || []), C = $ ? Qe($.nodesRef.current, M()) : [], W = $ && !c ? C.map((F) => {
930
+ var O;
931
+ return (O = F.context) == null ? void 0 : O.elements.floating;
932
+ }) : [], K = (A = C.find((F) => {
933
+ var O;
934
+ return Je(((O = F.context) == null ? void 0 : O.elements.domReference) || null);
935
+ })) == null || (A = A.context) == null ? void 0 : A.elements.domReference, ee = [v, K, ...S, ...W, ...N(), P.current, _.current, be.current, q.current, d == null ? void 0 : d.beforeOutsideRef.current, d == null ? void 0 : d.afterOutsideRef.current, L.current.includes("reference") || D ? b : null].filter((F) => F != null), re = c || D ? ct(ee, !X, X) : ct(ee);
936
+ return () => {
937
+ re();
938
+ };
939
+ }, [r, b, v, c, L, d, D, U, X, $, M, N]), j(() => {
940
+ if (r || !oe(x)) return;
941
+ const T = z(x), A = de(T);
942
+ queueMicrotask(() => {
943
+ const S = ie(x), C = ne.current, W = (typeof C == "number" ? S[C] : C.current) || x, K = Y(x, A);
944
+ !V && !K && R && fe(W, {
945
+ preventScroll: W === x
946
+ });
947
+ });
948
+ }, [r, R, x, V, ie, ne]), j(() => {
949
+ if (r || !x) return;
950
+ const T = z(x), A = de(T);
951
+ Un(A);
952
+ function S(K) {
953
+ let {
954
+ reason: ee,
955
+ event: re,
956
+ nested: F
957
+ } = K;
958
+ if (["hover", "safe-polygon"].includes(ee) && re.type === "mouseleave" && (y.current = !0), ee === "outside-press")
959
+ if (F)
960
+ y.current = !1;
961
+ else if (vn(re) || hn(re))
962
+ y.current = !1;
963
+ else {
964
+ let O = !1;
965
+ document.createElement("div").focus({
966
+ get preventScroll() {
967
+ return O = !0, !1;
968
+ }
969
+ }), O ? y.current = !1 : y.current = !0;
970
+ }
971
+ }
972
+ w.on("openchange", S);
973
+ const C = T.createElement("span");
974
+ C.setAttribute("tabindex", "-1"), C.setAttribute("aria-hidden", "true"), Object.assign(C.style, Fe), B && b && b.insertAdjacentElement("afterend", C);
975
+ function W() {
976
+ if (typeof H.current == "boolean") {
977
+ const K = b || dt();
978
+ return K && K.isConnected ? K : C;
979
+ }
980
+ return H.current.current || C;
981
+ }
982
+ return () => {
983
+ w.off("openchange", S);
984
+ const K = de(T), ee = Y(v, K) || $ && ge($.nodesRef.current, M()).some((F) => {
985
+ var O;
986
+ return Y((O = F.context) == null ? void 0 : O.elements.floating, K);
987
+ }), re = W();
988
+ queueMicrotask(() => {
989
+ const F = jn(re);
990
+ // eslint-disable-next-line react-hooks/exhaustive-deps
991
+ H.current && !y.current && oe(F) && // If the focus moved somewhere else after mount, avoid returning focus
992
+ // since it likely entered a different element which should be
993
+ // respected: https://github.com/floating-ui/floating-ui/issues/2607
994
+ (!(F !== K && K !== T.body) || ee) && F.focus({
995
+ preventScroll: !0
996
+ }), C.remove();
997
+ });
998
+ };
999
+ }, [r, v, x, H, I, w, $, B, b, M]), u.useEffect(() => {
1000
+ queueMicrotask(() => {
1001
+ y.current = !1;
1002
+ });
1003
+ }, [r]), j(() => {
1004
+ if (!r && d)
1005
+ return d.setFocusManagerState({
1006
+ modal: c,
1007
+ closeOnFocusOut: g,
1008
+ open: R,
1009
+ onOpenChange: f,
1010
+ domReference: b
1011
+ }), () => {
1012
+ d.setFocusManagerState(null);
1013
+ };
1014
+ }, [r, d, c, R, f, g, b]), j(() => {
1015
+ r || x && pt(x, L);
1016
+ }, [r, x, L]);
1017
+ function ye(T) {
1018
+ return r || !p || !c ? null : /* @__PURE__ */ se(Hn, {
1019
+ ref: T === "start" ? P : _,
1020
+ onClick: (A) => f(!1, A.nativeEvent),
1021
+ children: typeof p == "string" ? p : "Dismiss"
1022
+ });
1023
+ }
1024
+ const Ee = !r && U && (c ? !D : !0) && (B || c);
1025
+ return /* @__PURE__ */ Et(Gt, {
1026
+ children: [Ee && /* @__PURE__ */ se(Pe, {
1027
+ "data-type": "inside",
1028
+ ref: Z,
1029
+ onFocus: (T) => {
1030
+ if (c) {
1031
+ const S = ie();
1032
+ fe(o[0] === "reference" ? S[0] : S[S.length - 1]);
1033
+ } else if (d != null && d.preserveTabOrder && d.portalNode)
1034
+ if (y.current = !1, ve(T, d.portalNode)) {
1035
+ const S = Ot(b);
1036
+ S == null || S.focus();
1037
+ } else {
1038
+ var A;
1039
+ (A = d.beforeOutsideRef.current) == null || A.focus();
1040
+ }
1041
+ }
1042
+ }), !D && ye("start"), n, ye("end"), Ee && /* @__PURE__ */ se(Pe, {
1043
+ "data-type": "inside",
1044
+ ref: ce,
1045
+ onFocus: (T) => {
1046
+ if (c)
1047
+ fe(ie()[0]);
1048
+ else if (d != null && d.preserveTabOrder && d.portalNode)
1049
+ if (g && (y.current = !0), ve(T, d.portalNode)) {
1050
+ const S = Dt(b);
1051
+ S == null || S.focus();
1052
+ } else {
1053
+ var A;
1054
+ (A = d.afterOutsideRef.current) == null || A.focus();
1055
+ }
1056
+ }
1057
+ })]
1058
+ });
1059
+ }
1060
+ let Te = 0;
1061
+ const mt = "--floating-ui-scrollbar-width";
1062
+ function Yn() {
1063
+ const e = Mt(), t = /iP(hone|ad|od)|iOS/.test(e) || // iPads can claim to be MacIntel
1064
+ e === "MacIntel" && navigator.maxTouchPoints > 1, n = document.body.style, o = Math.round(document.documentElement.getBoundingClientRect().left) + document.documentElement.scrollLeft ? "paddingLeft" : "paddingRight", s = window.innerWidth - document.documentElement.clientWidth, i = n.left ? parseFloat(n.left) : window.scrollX, a = n.top ? parseFloat(n.top) : window.scrollY;
1065
+ if (n.overflow = "hidden", n.setProperty(mt, s + "px"), s && (n[o] = s + "px"), t) {
1066
+ var l, c;
1067
+ const p = ((l = window.visualViewport) == null ? void 0 : l.offsetLeft) || 0, g = ((c = window.visualViewport) == null ? void 0 : c.offsetTop) || 0;
1068
+ Object.assign(n, {
1069
+ position: "fixed",
1070
+ top: -(a - Math.floor(g)) + "px",
1071
+ left: -(i - Math.floor(p)) + "px",
1072
+ right: "0"
1073
+ });
1074
+ }
1075
+ return () => {
1076
+ Object.assign(n, {
1077
+ overflow: "",
1078
+ [o]: ""
1079
+ }), n.removeProperty(mt), t && (Object.assign(n, {
1080
+ position: "",
1081
+ top: "",
1082
+ left: "",
1083
+ right: ""
1084
+ }), window.scrollTo(i, a));
1085
+ };
1086
+ }
1087
+ let bt = () => {
1088
+ };
1089
+ const cr = /* @__PURE__ */ u.forwardRef(function(t, n) {
1090
+ const {
1091
+ lockScroll: r = !1,
1092
+ ...o
1093
+ } = t;
1094
+ return j(() => {
1095
+ if (r)
1096
+ return Te++, Te === 1 && (bt = Yn()), () => {
1097
+ Te--, Te === 0 && bt();
1098
+ };
1099
+ }, [r]), /* @__PURE__ */ se("div", {
1100
+ ref: n,
1101
+ ...o,
1102
+ style: {
1103
+ position: "fixed",
1104
+ overflow: "auto",
1105
+ top: 0,
1106
+ right: 0,
1107
+ bottom: 0,
1108
+ left: 0,
1109
+ ...o.style
1110
+ }
1111
+ });
1112
+ });
1113
+ function gt(e) {
1114
+ return oe(e.target) && e.target.tagName === "BUTTON";
1115
+ }
1116
+ function Gn(e) {
1117
+ return oe(e.target) && e.target.tagName === "A";
1118
+ }
1119
+ function vt(e) {
1120
+ return kt(e);
1121
+ }
1122
+ function lr(e, t) {
1123
+ t === void 0 && (t = {});
1124
+ const {
1125
+ open: n,
1126
+ onOpenChange: r,
1127
+ dataRef: o,
1128
+ elements: {
1129
+ domReference: s
1130
+ }
1131
+ } = e, {
1132
+ enabled: i = !0,
1133
+ event: a = "click",
1134
+ toggle: l = !0,
1135
+ ignoreMouse: c = !1,
1136
+ keyboardHandlers: p = !0,
1137
+ stickIfOpen: g = !0
1138
+ } = t, h = u.useRef(), m = u.useRef(!1), R = u.useMemo(() => ({
1139
+ onPointerDown(f) {
1140
+ h.current = f.pointerType;
1141
+ },
1142
+ onMouseDown(f) {
1143
+ const w = h.current;
1144
+ f.button === 0 && a !== "click" && (et(w) && c || (n && l && (!(o.current.openEvent && g) || o.current.openEvent.type === "mousedown") ? r(!1, f.nativeEvent, "click") : (f.preventDefault(), r(!0, f.nativeEvent, "click"))));
1145
+ },
1146
+ onClick(f) {
1147
+ const w = h.current;
1148
+ if (a === "mousedown" && h.current) {
1149
+ h.current = void 0;
1150
+ return;
1151
+ }
1152
+ et(w) && c || (n && l && (!(o.current.openEvent && g) || o.current.openEvent.type === "click") ? r(!1, f.nativeEvent, "click") : r(!0, f.nativeEvent, "click"));
1153
+ },
1154
+ onKeyDown(f) {
1155
+ h.current = void 0, !(f.defaultPrevented || !p || gt(f)) && (f.key === " " && !vt(s) && (f.preventDefault(), m.current = !0), !Gn(f) && f.key === "Enter" && r(!(n && l), f.nativeEvent, "click"));
1156
+ },
1157
+ onKeyUp(f) {
1158
+ f.defaultPrevented || !p || gt(f) || vt(s) || f.key === " " && m.current && (m.current = !1, r(!(n && l), f.nativeEvent, "click"));
1159
+ }
1160
+ }), [o, s, a, c, p, r, n, g, l]);
1161
+ return u.useMemo(() => i ? {
1162
+ reference: R
1163
+ } : {}, [i, R]);
1164
+ }
1165
+ const Xn = {
1166
+ pointerdown: "onPointerDown",
1167
+ mousedown: "onMouseDown",
1168
+ click: "onClick"
1169
+ }, Zn = {
1170
+ pointerdown: "onPointerDownCapture",
1171
+ mousedown: "onMouseDownCapture",
1172
+ click: "onClickCapture"
1173
+ }, ht = (e) => {
1174
+ var t, n;
1175
+ return {
1176
+ escapeKey: typeof e == "boolean" ? e : (t = e == null ? void 0 : e.escapeKey) != null ? t : !1,
1177
+ outsidePress: typeof e == "boolean" ? e : (n = e == null ? void 0 : e.outsidePress) != null ? n : !0
1178
+ };
1179
+ };
1180
+ function fr(e, t) {
1181
+ t === void 0 && (t = {});
1182
+ const {
1183
+ open: n,
1184
+ onOpenChange: r,
1185
+ elements: o,
1186
+ dataRef: s
1187
+ } = e, {
1188
+ enabled: i = !0,
1189
+ escapeKey: a = !0,
1190
+ outsidePress: l = !0,
1191
+ outsidePressEvent: c = "pointerdown",
1192
+ referencePress: p = !1,
1193
+ referencePressEvent: g = "pointerdown",
1194
+ ancestorScroll: h = !1,
1195
+ bubbles: m,
1196
+ capture: R
1197
+ } = t, f = Ge(), w = te(typeof l == "function" ? l : () => !1), I = typeof l == "function" ? w : l, b = u.useRef(!1), {
1198
+ escapeKey: v,
1199
+ outsidePress: M
1200
+ } = ht(m), {
1201
+ escapeKey: N,
1202
+ outsidePress: V
1203
+ } = ht(R), D = u.useRef(!1), J = u.useRef(-1), U = te((d) => {
1204
+ var P;
1205
+ if (!n || !i || !a || d.key !== "Escape" || D.current)
1206
+ return;
1207
+ const _ = (P = s.current.floatingContext) == null ? void 0 : P.nodeId, y = f ? ge(f.nodesRef.current, _) : [];
1208
+ if (!v && (d.stopPropagation(), y.length > 0)) {
1209
+ let E = !0;
1210
+ if (y.forEach((k) => {
1211
+ var B;
1212
+ if ((B = k.context) != null && B.open && !k.context.dataRef.current.__escapeKeyBubbles) {
1213
+ E = !1;
1214
+ return;
1215
+ }
1216
+ }), !E)
1217
+ return;
1218
+ }
1219
+ r(!1, gn(d) ? d.nativeEvent : d, "escape-key");
1220
+ }), X = te((d) => {
1221
+ var P;
1222
+ const _ = () => {
1223
+ var y;
1224
+ U(d), (y = ae(d)) == null || y.removeEventListener("keydown", _);
1225
+ };
1226
+ (P = ae(d)) == null || P.addEventListener("keydown", _);
1227
+ }), L = te((d) => {
1228
+ var P;
1229
+ const _ = s.current.insideReactTree;
1230
+ s.current.insideReactTree = !1;
1231
+ const y = b.current;
1232
+ if (b.current = !1, c === "click" && y || _ || typeof I == "function" && !I(d))
1233
+ return;
1234
+ const E = ae(d), k = "[" + he("inert") + "]", B = z(o.floating).querySelectorAll(k);
1235
+ let x = G(E) ? E : null;
1236
+ for (; x && !Oe(x); ) {
1237
+ const q = jt(x);
1238
+ if (Oe(q) || !G(q))
1239
+ break;
1240
+ x = q;
1241
+ }
1242
+ if (B.length && G(E) && !bn(E) && // Clicked on a direct ancestor (e.g. FloatingOverlay).
1243
+ !Y(E, o.floating) && // If the target root element contains none of the markers, then the
1244
+ // element was injected after the floating element rendered.
1245
+ Array.from(B).every((q) => !Y(x, q)))
1246
+ return;
1247
+ if (oe(E) && $) {
1248
+ const q = Oe(E), Z = Ht(E), ce = /auto|scroll/, ye = q || ce.test(Z.overflowX), Ee = q || ce.test(Z.overflowY), T = ye && E.clientWidth > 0 && E.scrollWidth > E.clientWidth, A = Ee && E.clientHeight > 0 && E.scrollHeight > E.clientHeight, S = Z.direction === "rtl", C = A && (S ? d.offsetX <= E.offsetWidth - E.clientWidth : d.offsetX > E.clientWidth), W = T && d.offsetY > E.clientHeight;
1249
+ if (C || W)
1250
+ return;
1251
+ }
1252
+ const Q = (P = s.current.floatingContext) == null ? void 0 : P.nodeId, ie = f && ge(f.nodesRef.current, Q).some((q) => {
1253
+ var Z;
1254
+ return Ne(d, (Z = q.context) == null ? void 0 : Z.elements.floating);
1255
+ });
1256
+ if (Ne(d, o.floating) || Ne(d, o.domReference) || ie)
1257
+ return;
1258
+ const be = f ? ge(f.nodesRef.current, Q) : [];
1259
+ if (be.length > 0) {
1260
+ let q = !0;
1261
+ if (be.forEach((Z) => {
1262
+ var ce;
1263
+ if ((ce = Z.context) != null && ce.open && !Z.context.dataRef.current.__outsidePressBubbles) {
1264
+ q = !1;
1265
+ return;
1266
+ }
1267
+ }), !q)
1268
+ return;
1269
+ }
1270
+ r(!1, d, "outside-press");
1271
+ }), ne = te((d) => {
1272
+ var P;
1273
+ const _ = () => {
1274
+ var y;
1275
+ L(d), (y = ae(d)) == null || y.removeEventListener(c, _);
1276
+ };
1277
+ (P = ae(d)) == null || P.addEventListener(c, _);
1278
+ });
1279
+ u.useEffect(() => {
1280
+ if (!n || !i)
1281
+ return;
1282
+ s.current.__escapeKeyBubbles = v, s.current.__outsidePressBubbles = M;
1283
+ let d = -1;
1284
+ function P(B) {
1285
+ r(!1, B, "ancestor-scroll");
1286
+ }
1287
+ function _() {
1288
+ window.clearTimeout(d), D.current = !0;
1289
+ }
1290
+ function y() {
1291
+ d = window.setTimeout(
1292
+ () => {
1293
+ D.current = !1;
1294
+ },
1295
+ // 0ms or 1ms don't work in Safari. 5ms appears to consistently work.
1296
+ // Only apply to WebKit for the test to remain 0ms.
1297
+ Yt() ? 5 : 0
1298
+ );
1299
+ }
1300
+ const E = z(o.floating);
1301
+ a && (E.addEventListener("keydown", N ? X : U, N), E.addEventListener("compositionstart", _), E.addEventListener("compositionend", y)), I && E.addEventListener(c, V ? ne : L, V);
1302
+ let k = [];
1303
+ return h && (G(o.domReference) && (k = De(o.domReference)), G(o.floating) && (k = k.concat(De(o.floating))), !G(o.reference) && o.reference && o.reference.contextElement && (k = k.concat(De(o.reference.contextElement)))), k = k.filter((B) => {
1304
+ var x;
1305
+ return B !== ((x = E.defaultView) == null ? void 0 : x.visualViewport);
1306
+ }), k.forEach((B) => {
1307
+ B.addEventListener("scroll", P, {
1308
+ passive: !0
1309
+ });
1310
+ }), () => {
1311
+ a && (E.removeEventListener("keydown", N ? X : U, N), E.removeEventListener("compositionstart", _), E.removeEventListener("compositionend", y)), I && E.removeEventListener(c, V ? ne : L, V), k.forEach((B) => {
1312
+ B.removeEventListener("scroll", P);
1313
+ }), window.clearTimeout(d);
1314
+ };
1315
+ }, [s, o, a, I, c, n, r, h, i, v, M, U, N, X, L, V, ne]), u.useEffect(() => {
1316
+ s.current.insideReactTree = !1;
1317
+ }, [s, I, c]);
1318
+ const H = u.useMemo(() => ({
1319
+ onKeyDown: U,
1320
+ ...p && {
1321
+ [Xn[g]]: (d) => {
1322
+ r(!1, d.nativeEvent, "reference-press");
1323
+ },
1324
+ ...g !== "click" && {
1325
+ onClick(d) {
1326
+ r(!1, d.nativeEvent, "reference-press");
1327
+ }
1328
+ }
1329
+ }
1330
+ }), [U, r, p, g]), $ = u.useMemo(() => ({
1331
+ onKeyDown: U,
1332
+ onMouseDown() {
1333
+ b.current = !0;
1334
+ },
1335
+ onMouseUp() {
1336
+ b.current = !0;
1337
+ },
1338
+ [Zn[c]]: () => {
1339
+ s.current.insideReactTree = !0;
1340
+ },
1341
+ onBlurCapture() {
1342
+ f || ($n(J), s.current.insideReactTree = !0, J.current = window.setTimeout(() => {
1343
+ s.current.insideReactTree = !1;
1344
+ }));
1345
+ }
1346
+ }), [U, c, s, f]);
1347
+ return u.useMemo(() => i ? {
1348
+ reference: H,
1349
+ floating: $
1350
+ } : {}, [i, H, $]);
1351
+ }
1352
+ function zn(e) {
1353
+ const {
1354
+ open: t = !1,
1355
+ onOpenChange: n,
1356
+ elements: r
1357
+ } = e, o = Ye(), s = u.useRef({}), [i] = u.useState(() => Dn()), a = Lt() != null;
1358
+ if (process.env.NODE_ENV !== "production") {
1359
+ const m = r.reference;
1360
+ m && !G(m) && On("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `refs.setPositionReference()`", "instead.");
1361
+ }
1362
+ const [l, c] = u.useState(r.reference), p = te((m, R, f) => {
1363
+ s.current.openEvent = m ? R : void 0, i.emit("openchange", {
1364
+ open: m,
1365
+ event: R,
1366
+ reason: f,
1367
+ nested: a
1368
+ }), n == null || n(m, R, f);
1369
+ }), g = u.useMemo(() => ({
1370
+ setPositionReference: c
1371
+ }), []), h = u.useMemo(() => ({
1372
+ reference: l || r.reference || null,
1373
+ floating: r.floating || null,
1374
+ domReference: r.reference
1375
+ }), [l, r.reference, r.floating]);
1376
+ return u.useMemo(() => ({
1377
+ dataRef: s,
1378
+ open: t,
1379
+ onOpenChange: p,
1380
+ elements: h,
1381
+ events: i,
1382
+ floatingId: o,
1383
+ refs: g
1384
+ }), [t, p, h, i, o, g]);
1385
+ }
1386
+ function dr(e) {
1387
+ e === void 0 && (e = {});
1388
+ const {
1389
+ nodeId: t
1390
+ } = e, n = zn({
1391
+ ...e,
1392
+ elements: {
1393
+ reference: null,
1394
+ floating: null,
1395
+ ...e.elements
1396
+ }
1397
+ }), r = e.rootContext || n, o = r.elements, [s, i] = u.useState(null), [a, l] = u.useState(null), p = (o == null ? void 0 : o.domReference) || s, g = u.useRef(null), h = Ge();
1398
+ j(() => {
1399
+ p && (g.current = p);
1400
+ }, [p]);
1401
+ const m = In({
1402
+ ...e,
1403
+ elements: {
1404
+ ...o,
1405
+ ...a && {
1406
+ reference: a
1407
+ }
1408
+ }
1409
+ }), R = u.useCallback((v) => {
1410
+ const M = G(v) ? {
1411
+ getBoundingClientRect: () => v.getBoundingClientRect(),
1412
+ getClientRects: () => v.getClientRects(),
1413
+ contextElement: v
1414
+ } : v;
1415
+ l(M), m.refs.setReference(M);
1416
+ }, [m.refs]), f = u.useCallback((v) => {
1417
+ (G(v) || v === null) && (g.current = v, i(v)), (G(m.refs.reference.current) || m.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
1418
+ // `null` to support `positionReference` + an unstable `reference`
1419
+ // callback ref.
1420
+ v !== null && !G(v)) && m.refs.setReference(v);
1421
+ }, [m.refs]), w = u.useMemo(() => ({
1422
+ ...m.refs,
1423
+ setReference: f,
1424
+ setPositionReference: R,
1425
+ domReference: g
1426
+ }), [m.refs, f, R]), I = u.useMemo(() => ({
1427
+ ...m.elements,
1428
+ domReference: p
1429
+ }), [m.elements, p]), b = u.useMemo(() => ({
1430
+ ...m,
1431
+ ...r,
1432
+ refs: w,
1433
+ elements: I,
1434
+ nodeId: t
1435
+ }), [m, w, I, t, r]);
1436
+ return j(() => {
1437
+ r.dataRef.current.floatingContext = b;
1438
+ const v = h == null ? void 0 : h.nodesRef.current.find((M) => M.id === t);
1439
+ v && (v.context = b);
1440
+ }), u.useMemo(() => ({
1441
+ ...m,
1442
+ context: b,
1443
+ refs: w,
1444
+ elements: I
1445
+ }), [m, w, I, b]);
1446
+ }
1447
+ function We(e, t, n) {
1448
+ const r = /* @__PURE__ */ new Map(), o = n === "item";
1449
+ let s = e;
1450
+ if (o && e) {
1451
+ const {
1452
+ [rt]: i,
1453
+ [ot]: a,
1454
+ ...l
1455
+ } = e;
1456
+ s = l;
1457
+ }
1458
+ return {
1459
+ ...n === "floating" && {
1460
+ tabIndex: -1,
1461
+ [An]: ""
1462
+ },
1463
+ ...s,
1464
+ ...t.map((i) => {
1465
+ const a = i ? i[n] : null;
1466
+ return typeof a == "function" ? e ? a(e) : null : a;
1467
+ }).concat(e).reduce((i, a) => (a && Object.entries(a).forEach((l) => {
1468
+ let [c, p] = l;
1469
+ if (!(o && [rt, ot].includes(c)))
1470
+ if (c.indexOf("on") === 0) {
1471
+ if (r.has(c) || r.set(c, []), typeof p == "function") {
1472
+ var g;
1473
+ (g = r.get(c)) == null || g.push(p), i[c] = function() {
1474
+ for (var h, m = arguments.length, R = new Array(m), f = 0; f < m; f++)
1475
+ R[f] = arguments[f];
1476
+ return (h = r.get(c)) == null ? void 0 : h.map((w) => w(...R)).find((w) => w !== void 0);
1477
+ };
1478
+ }
1479
+ } else
1480
+ i[c] = p;
1481
+ }), i), {})
1482
+ };
1483
+ }
1484
+ function pr(e) {
1485
+ e === void 0 && (e = []);
1486
+ const t = e.map((a) => a == null ? void 0 : a.reference), n = e.map((a) => a == null ? void 0 : a.floating), r = e.map((a) => a == null ? void 0 : a.item), o = u.useCallback(
1487
+ (a) => We(a, e, "reference"),
1488
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1489
+ t
1490
+ ), s = u.useCallback(
1491
+ (a) => We(a, e, "floating"),
1492
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1493
+ n
1494
+ ), i = u.useCallback(
1495
+ (a) => We(a, e, "item"),
1496
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1497
+ r
1498
+ );
1499
+ return u.useMemo(() => ({
1500
+ getReferenceProps: o,
1501
+ getFloatingProps: s,
1502
+ getItemProps: i
1503
+ }), [o, s, i]);
1504
+ }
1505
+ const Jn = /* @__PURE__ */ new Map([["select", "listbox"], ["combobox", "listbox"], ["label", !1]]);
1506
+ function mr(e, t) {
1507
+ var n, r;
1508
+ t === void 0 && (t = {});
1509
+ const {
1510
+ open: o,
1511
+ elements: s,
1512
+ floatingId: i
1513
+ } = e, {
1514
+ enabled: a = !0,
1515
+ role: l = "dialog"
1516
+ } = t, c = Ye(), p = ((n = s.domReference) == null ? void 0 : n.id) || c, g = u.useMemo(() => {
1517
+ var b;
1518
+ return ((b = Ue(s.floating)) == null ? void 0 : b.id) || i;
1519
+ }, [s.floating, i]), h = (r = Jn.get(l)) != null ? r : l, R = Lt() != null, f = u.useMemo(() => h === "tooltip" || l === "label" ? {
1520
+ ["aria-" + (l === "label" ? "labelledby" : "describedby")]: o ? g : void 0
1521
+ } : {
1522
+ "aria-expanded": o ? "true" : "false",
1523
+ "aria-haspopup": h === "alertdialog" ? "dialog" : h,
1524
+ "aria-controls": o ? g : void 0,
1525
+ ...h === "listbox" && {
1526
+ role: "combobox"
1527
+ },
1528
+ ...h === "menu" && {
1529
+ id: p
1530
+ },
1531
+ ...h === "menu" && R && {
1532
+ role: "menuitem"
1533
+ },
1534
+ ...l === "select" && {
1535
+ "aria-autocomplete": "none"
1536
+ },
1537
+ ...l === "combobox" && {
1538
+ "aria-autocomplete": "list"
1539
+ }
1540
+ }, [h, g, R, o, p, l]), w = u.useMemo(() => {
1541
+ const b = {
1542
+ id: g,
1543
+ ...h && {
1544
+ role: h
1545
+ }
1546
+ };
1547
+ return h === "tooltip" || l === "label" ? b : {
1548
+ ...b,
1549
+ ...h === "menu" && {
1550
+ "aria-labelledby": p
1551
+ }
1552
+ };
1553
+ }, [h, g, p, l]), I = u.useCallback((b) => {
1554
+ let {
1555
+ active: v,
1556
+ selected: M
1557
+ } = b;
1558
+ const N = {
1559
+ role: "option",
1560
+ ...v && {
1561
+ id: g + "-fui-option"
1562
+ }
1563
+ };
1564
+ switch (l) {
1565
+ case "select":
1566
+ return {
1567
+ ...N,
1568
+ "aria-selected": v && M
1569
+ };
1570
+ case "combobox":
1571
+ return {
1572
+ ...N,
1573
+ "aria-selected": M
1574
+ };
1575
+ }
1576
+ return {};
1577
+ }, [g, l]);
1578
+ return u.useMemo(() => a ? {
1579
+ reference: f,
1580
+ floating: w,
1581
+ item: I
1582
+ } : {}, [a, f, w, I]);
1583
+ }
1584
+ function Qn(e, t) {
1585
+ const [n, r] = u.useState(e);
1586
+ return e && !n && r(!0), u.useEffect(() => {
1587
+ if (!e && n) {
1588
+ const o = setTimeout(() => r(!1), t);
1589
+ return () => clearTimeout(o);
1590
+ }
1591
+ }, [e, n, t]), n;
1592
+ }
1593
+ function br(e, t) {
1594
+ t === void 0 && (t = {});
1595
+ const {
1596
+ open: n,
1597
+ elements: {
1598
+ floating: r
1599
+ }
1600
+ } = e, {
1601
+ duration: o = 250
1602
+ } = t, i = (typeof o == "number" ? o : o.close) || 0, [a, l] = u.useState("unmounted"), c = Qn(n, i);
1603
+ return !c && a === "close" && l("unmounted"), j(() => {
1604
+ if (r) {
1605
+ if (n) {
1606
+ l("initial");
1607
+ const p = requestAnimationFrame(() => {
1608
+ He.flushSync(() => {
1609
+ l("open");
1610
+ });
1611
+ });
1612
+ return () => {
1613
+ cancelAnimationFrame(p);
1614
+ };
1615
+ }
1616
+ l("close");
1617
+ }
1618
+ }, [n, r]), {
1619
+ isMounted: c,
1620
+ status: a
1621
+ };
1622
+ }
1623
+ export {
1624
+ ar as F,
1625
+ lr as a,
1626
+ fr as b,
1627
+ mr as c,
1628
+ pr as d,
1629
+ ir as e,
1630
+ br as f,
1631
+ ur as g,
1632
+ cr as h,
1633
+ sr as i,
1634
+ rr as o,
1635
+ or as s,
1636
+ dr as u
1637
+ };