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