@txnlab/use-wallet-ui-react 1.0.0 → 1.1.0

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