v-float 0.7.2 → 0.8.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 (51) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +223 -204
  3. package/dist/composables/index.d.ts +1 -3
  4. package/dist/composables/index.d.ts.map +1 -1
  5. package/dist/composables/interactions/index.d.ts +0 -2
  6. package/dist/composables/interactions/index.d.ts.map +1 -1
  7. package/dist/composables/interactions/polygon.d.ts +2 -2
  8. package/dist/composables/interactions/polygon.d.ts.map +1 -1
  9. package/dist/composables/interactions/use-click.d.ts +2 -2
  10. package/dist/composables/interactions/use-click.d.ts.map +1 -1
  11. package/dist/composables/interactions/use-escape-key.d.ts +2 -2
  12. package/dist/composables/interactions/use-escape-key.d.ts.map +1 -1
  13. package/dist/composables/interactions/use-focus.d.ts +30 -25
  14. package/dist/composables/interactions/use-focus.d.ts.map +1 -1
  15. package/dist/composables/interactions/use-hover.d.ts +2 -2
  16. package/dist/composables/interactions/use-hover.d.ts.map +1 -1
  17. package/dist/composables/middlewares/arrow.d.ts +1 -2
  18. package/dist/composables/middlewares/arrow.d.ts.map +1 -1
  19. package/dist/composables/middlewares/index.d.ts +2 -1
  20. package/dist/composables/middlewares/index.d.ts.map +1 -1
  21. package/dist/composables/positioning/index.d.ts +5 -0
  22. package/dist/composables/positioning/index.d.ts.map +1 -0
  23. package/dist/composables/positioning/use-arrow.d.ts.map +1 -0
  24. package/dist/composables/{interactions → positioning}/use-client-point.d.ts +2 -2
  25. package/dist/composables/positioning/use-client-point.d.ts.map +1 -0
  26. package/dist/composables/{use-floating-tree.d.ts → positioning/use-floating-tree.d.ts} +134 -11
  27. package/dist/composables/positioning/use-floating-tree.d.ts.map +1 -0
  28. package/dist/composables/{use-floating.d.ts → positioning/use-floating.d.ts} +21 -6
  29. package/dist/composables/positioning/use-floating.d.ts.map +1 -0
  30. package/dist/types.d.ts +15 -0
  31. package/dist/types.d.ts.map +1 -1
  32. package/dist/utils.d.ts +84 -7
  33. package/dist/utils.d.ts.map +1 -1
  34. package/dist/v-float.es.js +1732 -1620
  35. package/dist/v-float.umd.js +1 -1
  36. package/package.json +73 -76
  37. package/dist/composables/interactions/use-client-point.d.ts.map +0 -1
  38. package/dist/composables/interactions/utils/browser-detection.d.ts +0 -23
  39. package/dist/composables/interactions/utils/browser-detection.d.ts.map +0 -1
  40. package/dist/composables/interactions/utils/element-detection.d.ts +0 -53
  41. package/dist/composables/interactions/utils/element-detection.d.ts.map +0 -1
  42. package/dist/composables/interactions/utils/event-utils.d.ts +0 -30
  43. package/dist/composables/interactions/utils/event-utils.d.ts.map +0 -1
  44. package/dist/composables/interactions/utils/index.d.ts +0 -11
  45. package/dist/composables/interactions/utils/index.d.ts.map +0 -1
  46. package/dist/composables/interactions/utils/tree-context.d.ts +0 -32
  47. package/dist/composables/interactions/utils/tree-context.d.ts.map +0 -1
  48. package/dist/composables/use-arrow.d.ts.map +0 -1
  49. package/dist/composables/use-floating-tree.d.ts.map +0 -1
  50. package/dist/composables/use-floating.d.ts.map +0 -1
  51. /package/dist/composables/{use-arrow.d.ts → positioning/use-arrow.d.ts} +0 -0
@@ -1,105 +1,81 @@
1
- var Kt = Object.defineProperty;
2
- var qt = (e, t, n) => t in e ? Kt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var ye = (e, t, n) => qt(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { watch as se, getCurrentScope as Gt, onScopeDispose as xe, computed as N, toValue as D, unref as Jt, watchPostEffect as Oe, onWatcherCleanup as ve, ref as U, watchEffect as Qt, readonly as Zt, onMounted as en, shallowRef as Ye, shallowReactive as tn } from "vue";
5
- function nn(e) {
6
- return Gt() ? (xe(e), !0) : !1;
7
- }
8
- const on = typeof window < "u" && typeof document < "u";
9
- typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
10
- const rn = Object.prototype.toString, sn = (e) => rn.call(e) === "[object Object]";
11
- function Ve(e) {
12
- return Array.isArray(e) ? e : [e];
13
- }
14
- function ln(e, t, n) {
15
- return se(
16
- e,
17
- t,
18
- {
19
- ...n,
20
- immediate: !0
21
- }
22
- );
1
+ var jt = Object.defineProperty;
2
+ var zt = (e, t, n) => t in e ? jt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var ye = (e, t, n) => zt(e, typeof t != "symbol" ? t + "" : t, n);
4
+ import { watch as se, computed as N, toValue as D, useId as Ut, ref as U, watchEffect as Kt, onWatcherCleanup as pe, readonly as qt, shallowRef as Xe, onScopeDispose as xe, shallowReactive as Gt, getCurrentScope as Jt, unref as Qt, watchPostEffect as Oe, onMounted as Zt } from "vue";
5
+ function So(e, t, n = {}) {
6
+ const { offset: o = "-4px" } = n, { middlewareData: i, placement: c, refs: r } = t;
7
+ se(e, (f) => {
8
+ r.arrowEl.value = f;
9
+ });
10
+ const a = N(() => {
11
+ var f;
12
+ return ((f = i.value.arrow) == null ? void 0 : f.x) ?? 0;
13
+ }), d = N(() => {
14
+ var f;
15
+ return ((f = i.value.arrow) == null ? void 0 : f.y) ?? 0;
16
+ }), s = N(() => {
17
+ if (!(e.value || r.arrowEl.value) || !i.value.arrow)
18
+ return {};
19
+ const u = D(c).split("-")[0], m = a.value, h = d.value;
20
+ return u === "bottom" ? {
21
+ "inset-inline-start": `${m}px`,
22
+ "inset-block-start": o
23
+ } : u === "top" ? {
24
+ "inset-inline-start": `${m}px`,
25
+ "inset-block-end": o
26
+ } : u === "right" ? {
27
+ "inset-block-start": `${h}px`,
28
+ "inset-inline-start": o
29
+ } : u === "left" ? {
30
+ "inset-block-start": `${h}px`,
31
+ "inset-inline-end": o
32
+ } : {};
33
+ });
34
+ return {
35
+ arrowX: a,
36
+ arrowY: d,
37
+ arrowStyles: s
38
+ };
23
39
  }
24
- const an = on ? window : void 0;
25
- function cn(e) {
26
- var t;
27
- const n = D(e);
28
- return (t = n == null ? void 0 : n.$el) != null ? t : n;
40
+ let en = 0;
41
+ function St() {
42
+ return Ut() || `id-${++en}`;
29
43
  }
30
- function J(...e) {
31
- const t = [], n = () => {
32
- t.forEach((a) => a()), t.length = 0;
33
- }, o = (a, f, c, u) => (a.addEventListener(f, c, u), () => a.removeEventListener(f, c, u)), i = N(() => {
34
- const a = Ve(D(e[0])).filter((f) => f != null);
35
- return a.every((f) => typeof f != "string") ? a : void 0;
36
- }), l = ln(
37
- () => {
38
- var a, f;
39
- return [
40
- (f = (a = i.value) == null ? void 0 : a.map((c) => cn(c))) != null ? f : [an].filter((c) => c != null),
41
- Ve(D(i.value ? e[1] : e[0])),
42
- Ve(Jt(i.value ? e[2] : e[1])),
43
- // @ts-expect-error - TypeScript gets the correct types, but somehow still complains
44
- D(i.value ? e[3] : e[2])
45
- ];
46
- },
47
- ([a, f, c, u]) => {
48
- if (n(), !(a != null && a.length) || !(f != null && f.length) || !(c != null && c.length))
49
- return;
50
- const v = sn(u) ? { ...u } : u;
51
- t.push(
52
- ...a.flatMap(
53
- (h) => f.flatMap(
54
- (d) => c.map((m) => o(h, d, m, v))
55
- )
56
- )
57
- );
58
- },
59
- { flush: "post" }
60
- ), r = () => {
61
- l(), n();
62
- };
63
- return nn(n), r;
44
+ function Ye(e) {
45
+ return e instanceof Element && e instanceof HTMLElement;
64
46
  }
65
- function st() {
47
+ function tn() {
66
48
  return typeof navigator > "u" ? !1 : navigator.platform.toUpperCase().indexOf("MAC") >= 0;
67
49
  }
68
- function lt() {
50
+ function nn() {
69
51
  return typeof navigator > "u" ? !1 : /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
70
52
  }
71
- function un(e) {
53
+ function on(e) {
72
54
  return typeof (e == null ? void 0 : e.matches) != "function" ? !1 : e.matches(":focus-visible");
73
55
  }
74
- function Dt(e, t) {
56
+ function Lt(e, t) {
75
57
  if (e === void 0) return !1;
76
58
  const n = e === "mouse";
77
59
  return t ? n : n || e === "pen";
78
60
  }
79
- function Mt(e) {
61
+ function At(e) {
80
62
  return !e || !(e instanceof HTMLElement) ? !1 : e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e.isContentEditable && e.contentEditable !== "false";
81
63
  }
82
- function at(e) {
64
+ function lt(e) {
83
65
  const t = e.target;
84
66
  return t instanceof HTMLElement ? t.tagName === "BUTTON" || t.tagName === "INPUT" && t.getAttribute("type") === "button" || t.getAttribute("role") === "button" : !1;
85
67
  }
86
- function ct(e) {
87
- return Mt(e);
88
- }
89
- function fn(e) {
90
- return e instanceof Element && e instanceof HTMLElement;
91
- }
92
- function Po(e) {
93
- return typeof e == "object" && e !== null && "contextElement" in e;
68
+ function at(e) {
69
+ return At(e);
94
70
  }
95
- function ut(e, t) {
71
+ function ct(e, t) {
96
72
  return t ? "composedPath" in e && typeof e.composedPath == "function" ? e.composedPath().includes(t) : t.contains(e.target) : !1;
97
73
  }
98
- function dn(e, t) {
99
- const n = t.getBoundingClientRect(), o = t.offsetWidth - t.clientWidth, i = t.offsetHeight - t.clientHeight, l = e.clientX - n.left, r = e.clientY - n.top;
74
+ function rn(e, t) {
75
+ const n = t.getBoundingClientRect(), o = t.offsetWidth - t.clientWidth, i = t.offsetHeight - t.clientHeight, c = e.clientX - n.left, r = e.clientY - n.top;
100
76
  if (o > 0) {
101
77
  const a = t.clientWidth;
102
- if (l >= a && l <= t.offsetWidth)
78
+ if (c >= a && c <= t.offsetWidth)
103
79
  return !0;
104
80
  }
105
81
  if (i > 0) {
@@ -109,23 +85,23 @@ function dn(e, t) {
109
85
  }
110
86
  return !1;
111
87
  }
112
- function Xe(e, t) {
88
+ function $e(e, t) {
113
89
  return e.contains(t);
114
90
  }
115
- function hn(e) {
91
+ function sn(e) {
116
92
  return e.target;
117
93
  }
118
- function ft() {
94
+ function ut() {
119
95
  return typeof performance < "u" ? performance.now() : Date.now();
120
96
  }
121
- function dt(e) {
97
+ function ft(e) {
122
98
  e !== -1 && clearTimeout(e);
123
99
  }
124
- function mn(e) {
100
+ function ln(e) {
125
101
  return e !== null && typeof e == "object" && "data" in e && "id" in e && "children" in e && "parent" in e;
126
102
  }
127
- function He(e) {
128
- return mn(e) ? {
103
+ function Ke(e) {
104
+ return ln(e) ? {
129
105
  floatingContext: e.data,
130
106
  treeContext: e
131
107
  } : {
@@ -133,7 +109,7 @@ function He(e) {
133
109
  treeContext: null
134
110
  };
135
111
  }
136
- function Z(e, t) {
112
+ function q(e, t) {
137
113
  if (!t) return !1;
138
114
  if (typeof t == "object" && t !== null && "contextElement" in t) {
139
115
  const n = t.contextElement;
@@ -141,132 +117,16 @@ function Z(e, t) {
141
117
  }
142
118
  return t instanceof Element ? t.contains(e) : !1;
143
119
  }
144
- function Ke(e, t) {
120
+ function qe(e, t) {
145
121
  for (const n of e.children.value)
146
122
  if (n.data.open.value) {
147
- if (Z(t, n.data.refs.anchorEl.value) || Z(t, n.data.refs.floatingEl.value))
123
+ if (q(t, n.data.refs.anchorEl.value) || q(t, n.data.refs.floatingEl.value))
148
124
  return n;
149
- const o = Ke(n, t);
125
+ const o = qe(n, t);
150
126
  if (o) return o;
151
127
  }
152
128
  return null;
153
129
  }
154
- function Lo(e, t = {}) {
155
- const { floatingContext: n, treeContext: o } = He(e), { open: i, setOpen: l, refs: r } = n, {
156
- enabled: a = !0,
157
- event: f = "click",
158
- toggle: c = !0,
159
- ignoreMouse: u = !1,
160
- ignoreKeyboard: v = !1,
161
- ignoreTouch: h = !1,
162
- // Outside click options
163
- outsideClick: d = !1,
164
- outsideEvent: m = "pointerdown",
165
- outsideCapture: g = !0,
166
- onOutsideClick: p,
167
- preventScrollbarClick: b = !0,
168
- handleDragEvents: E = !0
169
- } = t;
170
- let C, P = !1, w = !1, x = !1;
171
- const O = N(() => D(a)), R = N(() => D(d)), M = N(() => {
172
- const L = r.anchorEl.value;
173
- return L instanceof HTMLElement ? L : null;
174
- }), A = N(() => r.floatingEl.value);
175
- function k() {
176
- x = !0;
177
- try {
178
- i.value ? D(c) && l(!1) : l(!0);
179
- } finally {
180
- Promise.resolve().then(() => {
181
- x = !1;
182
- });
183
- }
184
- }
185
- function W() {
186
- C = void 0, P = !1, w = !1;
187
- }
188
- function $(L) {
189
- C = L.pointerType;
190
- }
191
- function F(L) {
192
- L.button === 0 && D(f) !== "click" && (V(C) || k());
193
- }
194
- function T() {
195
- if (D(f) === "mousedown" && C) {
196
- W();
197
- return;
198
- }
199
- if (V(C)) {
200
- W();
201
- return;
202
- }
203
- k(), W();
204
- }
205
- function s(L) {
206
- if (C = void 0, L.defaultPrevented || D(v) || at(L))
207
- return;
208
- const X = M.value;
209
- X && (L.key === " " && !ct(X) && (L.preventDefault(), P = !0), L.key === "Enter" && k());
210
- }
211
- function H(L) {
212
- const X = M.value;
213
- X && (L.defaultPrevented || D(v) || at(L) || ct(X) || L.key === " " && P && (P = !1, k()));
214
- }
215
- function y(L) {
216
- if (!O.value || !R.value || !i.value)
217
- return;
218
- if (D(m) === "click" && D(E) && w) {
219
- w = !1;
220
- return;
221
- }
222
- if (x)
223
- return;
224
- const X = L.target;
225
- if (X && !(D(b) && fn(X) && A.value && dn(L, X))) {
226
- if (o) {
227
- if (!vn(o, X))
228
- return;
229
- } else if (ut(L, M.value) || ut(L, A.value))
230
- return;
231
- p ? p(L, n) : l(!1);
232
- }
233
- }
234
- function I() {
235
- w = !0;
236
- }
237
- function oe() {
238
- setTimeout(() => {
239
- w = !1;
240
- }, 0);
241
- }
242
- function V(L) {
243
- return !!(Dt(L, !0) && D(u) || L === "touch" && D(h));
244
- }
245
- Oe(() => {
246
- const L = M.value;
247
- !O.value || !L || (L.addEventListener("pointerdown", $), L.addEventListener("mousedown", F), L.addEventListener("click", T), L.addEventListener("keydown", s), L.addEventListener("keyup", H), ve(() => {
248
- L.removeEventListener("pointerdown", $), L.removeEventListener("mousedown", F), L.removeEventListener("click", T), L.removeEventListener("keydown", s), L.removeEventListener("keyup", H), W();
249
- }));
250
- }), J(
251
- () => O.value && R.value ? document : null,
252
- () => D(m),
253
- y,
254
- { capture: D(g) }
255
- ), J(
256
- () => O.value && R.value && D(E) ? A.value : null,
257
- "mousedown",
258
- I,
259
- { capture: !0 }
260
- ), J(
261
- () => O.value && R.value && D(E) ? A.value : null,
262
- "mouseup",
263
- oe,
264
- { capture: !0 }
265
- );
266
- }
267
- function vn(e, t) {
268
- return !(Z(t, e.data.refs.anchorEl.value) || Z(t, e.data.refs.floatingEl.value) || Ke(e, t));
269
- }
270
130
  const De = (e) => typeof e == "number" && Number.isFinite(e) ? e : null, me = class me {
271
131
  /**
272
132
  * Create a virtual anchor element
@@ -342,14 +202,14 @@ const De = (e) => typeof e == "number" && Number.isFinite(e) ? e : null, me = cl
342
202
  * Resolve coordinate for a single axis with clear precedence
343
203
  */
344
204
  resolveAxisCoordinate(t) {
345
- const { current: n, baseline: o, fallback: i, isAxisEnabled: l } = t;
346
- return l && n !== null ? n : o !== null ? o : i;
205
+ const { current: n, baseline: o, fallback: i, isAxisEnabled: c } = t;
206
+ return c && n !== null ? n : o !== null ? o : i;
347
207
  }
348
208
  /**
349
209
  * Calculate virtual element size based on axis constraints
350
210
  */
351
211
  calculateSize(t, n) {
352
- const o = (i, l) => Math.max(0, i || l);
212
+ const o = (i, c) => Math.max(0, i || c);
353
213
  switch (t) {
354
214
  case "both":
355
215
  return { width: 0, height: 0 };
@@ -375,7 +235,7 @@ const De = (e) => typeof e == "number" && Number.isFinite(e) ? e : null, me = cl
375
235
  * Build a DOMRect object
376
236
  */
377
237
  buildDOMRect(t) {
378
- const { x: n, y: o, width: i, height: l } = t, r = Math.max(0, i), a = Math.max(0, l);
238
+ const { x: n, y: o, width: i, height: c } = t, r = Math.max(0, i), a = Math.max(0, c);
379
239
  return {
380
240
  x: n,
381
241
  y: o,
@@ -390,8 +250,8 @@ const De = (e) => typeof e == "number" && Number.isFinite(e) ? e : null, me = cl
390
250
  }
391
251
  };
392
252
  ye(me, "DEFAULT_DIMENSIONS", { width: 100, height: 30 });
393
- let _e = me;
394
- class Rt {
253
+ let je = me;
254
+ class Dt {
395
255
  constructor() {
396
256
  // The core state every strategy needs: the last known good coordinates
397
257
  ye(this, "lastKnownCoordinates", null);
@@ -417,7 +277,7 @@ class Rt {
417
277
  this.lastKnownCoordinates = null;
418
278
  }
419
279
  }
420
- class pn extends Rt {
280
+ class an extends Dt {
421
281
  constructor() {
422
282
  super(...arguments);
423
283
  ye(this, "name", "follow");
@@ -438,7 +298,7 @@ class pn extends Rt {
438
298
  case "pointerdown":
439
299
  return i;
440
300
  case "pointermove":
441
- return o.isOpen && Dt(n.originalEvent.pointerType, !0) ? i : null;
301
+ return o.isOpen && Lt(n.originalEvent.pointerType, !0) ? i : null;
442
302
  case "pointerenter":
443
303
  return i;
444
304
  default:
@@ -446,7 +306,7 @@ class pn extends Rt {
446
306
  }
447
307
  }
448
308
  }
449
- class gn extends Rt {
309
+ class cn extends Dt {
450
310
  constructor() {
451
311
  super(...arguments);
452
312
  ye(this, "name", "static");
@@ -485,799 +345,301 @@ class gn extends Rt {
485
345
  this.triggerCoordinates = null;
486
346
  }
487
347
  }
488
- function So(e, t, n = {}) {
489
- const { open: o, refs: i } = t, l = new _e(), r = U({ x: null, y: null }), a = U(null), f = N(() => D(n.axis ?? "both")), c = N(() => D(n.enabled ?? !0)), u = N(() => De(D(n.x ?? null))), v = N(() => De(D(n.y ?? null))), h = N(
490
- () => u.value !== null && v.value !== null
491
- ), d = N(() => h.value ? {
492
- x: u.value,
493
- y: v.value
494
- } : r.value), m = N(() => {
495
- const x = d.value;
496
- switch (f.value) {
348
+ function Lo(e, t, n = {}) {
349
+ const { open: o, refs: i } = t, c = new je(), r = U({ x: null, y: null }), a = U(null), d = N(() => D(n.axis ?? "both")), s = N(() => D(n.enabled ?? !0)), f = N(() => De(D(n.x ?? null))), u = N(() => De(D(n.y ?? null))), m = N(
350
+ () => f.value !== null && u.value !== null
351
+ ), h = N(() => m.value ? {
352
+ x: f.value,
353
+ y: u.value
354
+ } : r.value), p = N(() => {
355
+ const y = h.value;
356
+ switch (d.value) {
497
357
  case "x":
498
- return { x: x.x, y: null };
358
+ return { x: y.x, y: null };
499
359
  case "y":
500
- return { x: null, y: x.y };
360
+ return { x: null, y: y.y };
501
361
  case "both":
502
- return x;
362
+ return y;
503
363
  }
504
- }), g = (n.trackingMode ?? "follow") === "follow" ? new pn() : new gn(), p = (x, O) => {
505
- h.value || (r.value = {
506
- x: De(x),
364
+ }), g = (n.trackingMode ?? "follow") === "follow" ? new an() : new cn(), v = (y, O) => {
365
+ m.value || (r.value = {
366
+ x: De(y),
507
367
  y: De(O)
508
368
  });
509
- }, b = () => {
510
- h.value || (r.value = { x: null, y: null });
511
- }, E = (x, O) => {
512
- const R = {
369
+ }, x = () => {
370
+ m.value || (r.value = { x: null, y: null });
371
+ }, b = (y, O) => {
372
+ const M = {
513
373
  type: O,
514
- coordinates: { x: x.clientX, y: x.clientY },
515
- originalEvent: x
516
- }, M = g.process(R, {
374
+ coordinates: { x: y.clientX, y: y.clientY },
375
+ originalEvent: y
376
+ }, R = g.process(M, {
517
377
  isOpen: o.value
518
378
  });
519
- M && p(M.x, M.y);
379
+ R && v(R.x, R.y);
520
380
  };
521
381
  se(
522
- [m, a, f, e],
382
+ [p, a, d, e],
523
383
  () => {
524
- i.anchorEl.value = l.create({
525
- coordinates: m.value,
384
+ i.anchorEl.value = c.create({
385
+ coordinates: p.value,
526
386
  referenceElement: e.value,
527
387
  baselineCoordinates: a.value,
528
- axis: f.value
388
+ axis: d.value
529
389
  });
530
390
  },
531
391
  { immediate: !0 }
532
- ), se(o, (x) => {
533
- if (!(!c.value || h.value))
534
- if (x) {
392
+ ), se(o, (y) => {
393
+ if (!(!s.value || m.value))
394
+ if (y) {
535
395
  const O = g.getCoordinatesForOpening();
536
- O ? (p(O.x, O.y), a.value = { ...O }) : a.value = { ...r.value };
396
+ O ? (v(O.x, O.y), a.value = { ...O }) : a.value = { ...r.value };
537
397
  } else
538
- g.onClose(), b(), a.value = null;
398
+ g.onClose(), x(), a.value = null;
539
399
  });
540
- const C = (x) => {
541
- E(x, "pointerdown");
542
- }, P = (x) => {
543
- E(x, "pointerenter");
544
- }, w = (x) => {
545
- E(x, "pointermove");
400
+ const E = (y) => {
401
+ b(y, "pointerdown");
402
+ }, P = (y) => {
403
+ b(y, "pointerenter");
404
+ }, S = (y) => {
405
+ b(y, "pointermove");
546
406
  };
547
- return Qt(() => {
548
- if (h.value || !c.value) return;
549
- const x = e.value;
550
- if (!x) return;
551
- const O = g.getRequiredEvents(), R = {
407
+ return Kt(() => {
408
+ if (m.value || !s.value) return;
409
+ const y = e.value;
410
+ if (!y) return;
411
+ const O = g.getRequiredEvents(), M = {
552
412
  pointerenter: P,
553
- pointerdown: C,
554
- pointermove: w
413
+ pointerdown: E,
414
+ pointermove: S
555
415
  };
556
- O.forEach((M) => {
557
- const A = R[M];
558
- A && x.addEventListener(M, A);
559
- }), ve(() => {
560
- O.forEach((M) => {
561
- const A = R[M];
562
- A && x.removeEventListener(M, A);
416
+ O.forEach((R) => {
417
+ const A = M[R];
418
+ A && y.addEventListener(R, A);
419
+ }), pe(() => {
420
+ O.forEach((R) => {
421
+ const A = M[R];
422
+ A && y.removeEventListener(R, A);
563
423
  });
564
424
  });
565
425
  }), {
566
- coordinates: Zt(m),
567
- updatePosition: (x, O) => p(x, O)
426
+ coordinates: qt(p),
427
+ updatePosition: (y, O) => v(y, O)
568
428
  };
569
429
  }
570
- function Ao(e, t = {}) {
571
- const { floatingContext: n, treeContext: o } = He(e), { enabled: i = !0, capture: l = !1, onEscape: r } = t, { isComposing: a } = yn();
572
- J(document, "keydown", (c) => {
573
- if (!(c.key !== "Escape" || !D(i) || a())) {
574
- if (r) {
575
- r(c);
576
- return;
577
- }
578
- if (o) {
579
- const u = wn(o);
580
- u && u.data.setOpen(!1);
581
- } else
582
- n.setOpen(!1);
583
- }
584
- }, l);
430
+ const Rt = ["top", "right", "bottom", "left"], dt = ["start", "end"], ht = /* @__PURE__ */ Rt.reduce((e, t) => e.concat(t, t + "-" + dt[0], t + "-" + dt[1]), []), le = Math.min, Y = Math.max, Me = Math.round, Re = Math.floor, Z = (e) => ({
431
+ x: e,
432
+ y: e
433
+ }), un = {
434
+ left: "right",
435
+ right: "left",
436
+ bottom: "top",
437
+ top: "bottom"
438
+ }, fn = {
439
+ start: "end",
440
+ end: "start"
441
+ };
442
+ function ze(e, t, n) {
443
+ return Y(e, le(t, n));
585
444
  }
586
- function wn(e) {
587
- let t = e;
588
- for (; t.parent.value && !t.isRoot; )
589
- t = t.parent.value;
590
- let n = null, o = -1;
591
- const i = (l) => {
592
- if (l.data.open.value) {
593
- const r = l.getPath().length;
594
- r > o && (o = r, n = l);
595
- }
596
- for (const r of l.children.value)
597
- i(r);
598
- };
599
- return i(t), n;
445
+ function ce(e, t) {
446
+ return typeof e == "function" ? e(t) : e;
600
447
  }
601
- function yn() {
602
- const e = U(!1);
603
- return J(document, "compositionstart", () => {
604
- e.value = !0;
605
- }), J(document, "compositionend", () => {
606
- e.value = !1;
607
- }), {
608
- isComposing: () => e.value
609
- };
448
+ function ee(e) {
449
+ return e.split("-")[0];
610
450
  }
611
- function Do(e, t = {}) {
612
- const { floatingContext: n, treeContext: o } = He(e), {
613
- open: i,
614
- setOpen: l,
615
- refs: { floatingEl: r, anchorEl: a }
616
- } = n, { enabled: f = !0, requireFocusVisible: c = !0 } = t, u = N(() => a.value ? a.value instanceof HTMLElement ? a.value : a.value.contextElement : null);
617
- let v = !1, h = !0, d;
618
- J(window, "blur", () => {
619
- !i.value && u.value && u.value === document.activeElement && (v = !0);
620
- }), J(window, "focus", () => {
621
- v = !1;
622
- }), en(() => {
623
- st() && lt() && (J(
624
- window,
625
- "keydown",
626
- () => {
627
- h = !0;
628
- },
629
- { capture: !0 }
630
- ), J(
631
- window,
632
- "pointerdown",
633
- () => {
634
- h = !1;
635
- },
636
- { capture: !0 }
637
- ));
638
- });
639
- function m(p) {
640
- if (v) {
641
- v = !1;
642
- return;
643
- }
644
- const b = p.target;
645
- if (D(c) && b) {
646
- if (st() && lt() && !p.relatedTarget) {
647
- if (!h && !Mt(b))
648
- return;
649
- } else if (!un(b))
650
- return;
651
- }
652
- l(!0);
653
- }
654
- function g(p) {
655
- clearTimeout(d), d = window.setTimeout(() => {
656
- var C;
657
- const E = (((C = u.value) == null ? void 0 : C.ownerDocument) ?? document).activeElement;
658
- if (!(!p.relatedTarget && E === u.value)) {
659
- if (o) {
660
- if (E && bn(o, E))
661
- return;
662
- } else if (r.value && E && r.value.contains(E))
663
- return;
664
- l(!1);
665
- }
666
- }, 0);
667
- }
668
- Oe(() => {
669
- if (!D(f)) return;
670
- const p = u.value;
671
- !p || !(p instanceof HTMLElement) || (p.addEventListener("focus", m), p.addEventListener("blur", g), ve(() => {
672
- p.removeEventListener("focus", m), p.removeEventListener("blur", g);
673
- }));
674
- }), xe(() => {
675
- clearTimeout(d);
676
- });
451
+ function G(e) {
452
+ return e.split("-")[1];
677
453
  }
678
- function bn(e, t) {
679
- return Z(t, e.data.refs.anchorEl.value) || Z(t, e.data.refs.floatingEl.value) ? !0 : Nt(e, t) !== null;
454
+ function Mt(e) {
455
+ return e === "x" ? "y" : "x";
680
456
  }
681
- function Nt(e, t) {
682
- for (const n of e.children.value)
683
- if (n.data.open.value) {
684
- if (Z(t, n.data.refs.anchorEl.value) || Z(t, n.data.refs.floatingEl.value))
685
- return n;
686
- const o = Nt(n, t);
687
- if (o) return o;
688
- }
689
- return null;
457
+ function Ge(e) {
458
+ return e === "y" ? "height" : "width";
690
459
  }
691
- let xn = 0;
692
- function En() {
693
- return `vfloat-id-${xn++}`;
460
+ const dn = /* @__PURE__ */ new Set(["top", "bottom"]);
461
+ function ie(e) {
462
+ return dn.has(ee(e)) ? "y" : "x";
694
463
  }
695
- function ht(e) {
696
- return typeof e == "object" && e instanceof HTMLElement;
464
+ function Je(e) {
465
+ return Mt(ie(e));
697
466
  }
698
- function kt(e) {
699
- return e.children.value.some(
700
- (t) => t.data.open.value || kt(t)
701
- );
467
+ function Nt(e, t, n) {
468
+ n === void 0 && (n = !1);
469
+ const o = G(e), i = Je(e), c = Ge(i);
470
+ let r = i === "x" ? o === (n ? "end" : "start") ? "right" : "left" : o === "start" ? "bottom" : "top";
471
+ return t.reference[c] > t.floating[c] && (r = ke(r)), [r, ke(r)];
702
472
  }
703
- function Cn(e, t) {
704
- return e[0] >= t.x && e[0] <= t.x + t.width && e[1] >= t.y && e[1] <= t.y + t.height;
473
+ function hn(e) {
474
+ const t = ke(e);
475
+ return [Ne(e), t, Ne(t)];
705
476
  }
706
- function mt(e, t) {
707
- const [n, o] = e;
708
- let i = !1;
709
- const l = t.length;
710
- for (let r = 0, a = l - 1; r < l; a = r++) {
711
- const [f, c] = t[r] || [0, 0], [u, v] = t[a] || [0, 0];
712
- c >= o != v >= o && n <= (u - f) * (o - c) / (v - c) + f && (i = !i);
477
+ function Ne(e) {
478
+ return e.replace(/start|end/g, (t) => fn[t]);
479
+ }
480
+ const mt = ["left", "right"], pt = ["right", "left"], mn = ["top", "bottom"], pn = ["bottom", "top"];
481
+ function vn(e, t, n) {
482
+ switch (e) {
483
+ case "top":
484
+ case "bottom":
485
+ return n ? t ? pt : mt : t ? mt : pt;
486
+ case "left":
487
+ case "right":
488
+ return t ? mn : pn;
489
+ default:
490
+ return [];
713
491
  }
714
- return i;
715
492
  }
716
- function Tn(e = {}) {
717
- const { blockPointerEvents: t = !1, requireIntent: n = !0 } = e;
718
- let o = -1, i = !1;
719
- function l(a, f, c, u, v) {
720
- const h = ft(), d = h - v;
721
- if (c === null || u === null || d === 0)
722
- return {
723
- speed: null,
724
- lastX: a,
725
- lastY: f,
726
- lastCursorTime: h
727
- };
728
- const m = a - c, g = f - u;
729
- return {
730
- speed: Math.sqrt(m * m + g * g) / d,
731
- lastX: a,
732
- lastY: f,
733
- lastCursorTime: h
734
- };
735
- }
736
- const r = function(f) {
737
- const { x: c, y: u, placement: v, elements: h, buffer: d, onClose: m, nodeId: g, tree: p } = f, b = N(() => {
738
- const w = h.domReference;
739
- return ht(w) ? w : (w == null ? void 0 : w.contextElement) ?? null;
740
- });
741
- let E = null, C = null, P = ft();
742
- return function(x) {
743
- var Ae, et, tt, nt, ot, it, rt;
744
- function O() {
745
- dt(o), o = -1, m();
746
- }
747
- if (dt(o), o = -1, !h.domReference || !h.floating || v == null || c == null || u == null)
748
- return;
749
- const { clientX: R, clientY: M } = x, A = [R, M], k = hn(x), W = x.type === "mouseleave", $ = h.floating && Xe(h.floating, k), F = b.value && Xe(b.value, k), T = (Ae = b.value) == null ? void 0 : Ae.getBoundingClientRect(), s = (et = h.floating) == null ? void 0 : et.getBoundingClientRect(), H = v.split("-")[0], y = c > ((s == null ? void 0 : s.right) ?? 0) - ((s == null ? void 0 : s.width) ?? 0) / 2, I = u > ((s == null ? void 0 : s.bottom) ?? 0) - ((s == null ? void 0 : s.height) ?? 0) / 2, oe = T ? Cn(A, T) : !1, V = ((s == null ? void 0 : s.width) ?? 0) > ((T == null ? void 0 : T.width) ?? 0), L = ((s == null ? void 0 : s.height) ?? 0) > ((T == null ? void 0 : T.height) ?? 0), X = ((tt = V ? T : s) == null ? void 0 : tt.left) ?? 0, ue = ((nt = V ? T : s) == null ? void 0 : nt.right) ?? 0, z = ((ot = L ? T : s) == null ? void 0 : ot.top) ?? 0, fe = ((it = L ? T : s) == null ? void 0 : it.bottom) ?? 0;
750
- if ($ && (i = !0, !W))
751
- return;
752
- if (F && (i = !1), F && !W) {
753
- i = !0;
754
- return;
755
- }
756
- if (W && ht(x.relatedTarget) && h.floating && Xe(h.floating, x.relatedTarget))
757
- return;
758
- if (p && g) {
759
- const B = p.nodes.get(g);
760
- if (B && kt(B))
761
- return;
762
- }
763
- if (H === "top" && u >= ((T == null ? void 0 : T.bottom) ?? 0) - 1 || H === "bottom" && u <= ((T == null ? void 0 : T.top) ?? 0) + 1 || H === "left" && c >= ((T == null ? void 0 : T.right) ?? 0) - 1 || H === "right" && c <= ((T == null ? void 0 : T.left) ?? 0) + 1)
764
- return O();
765
- let re = [];
766
- switch (H) {
767
- case "top":
768
- re = [
769
- [X, ((T == null ? void 0 : T.top) ?? 0) + 1],
770
- [X, ((s == null ? void 0 : s.bottom) ?? 0) - 1],
771
- [ue, ((s == null ? void 0 : s.bottom) ?? 0) - 1],
772
- [ue, ((T == null ? void 0 : T.top) ?? 0) + 1]
773
- ];
774
- break;
775
- case "bottom":
776
- re = [
777
- [X, ((s == null ? void 0 : s.top) ?? 0) + 1],
778
- [X, ((T == null ? void 0 : T.bottom) ?? 0) - 1],
779
- [ue, ((T == null ? void 0 : T.bottom) ?? 0) - 1],
780
- [ue, ((s == null ? void 0 : s.top) ?? 0) + 1]
781
- ];
782
- break;
783
- case "left":
784
- re = [
785
- [((s == null ? void 0 : s.right) ?? 0) - 1, fe],
786
- [((s == null ? void 0 : s.right) ?? 0) - 1, z],
787
- [((T == null ? void 0 : T.left) ?? 0) + 1, z],
788
- [((T == null ? void 0 : T.left) ?? 0) + 1, fe]
789
- ];
790
- break;
791
- case "right":
792
- re = [
793
- [((T == null ? void 0 : T.right) ?? 0) - 1, fe],
794
- [((T == null ? void 0 : T.right) ?? 0) - 1, z],
795
- [((s == null ? void 0 : s.left) ?? 0) + 1, z],
796
- [((s == null ? void 0 : s.left) ?? 0) + 1, fe]
797
- ];
798
- break;
799
- }
800
- function Se([B, j]) {
801
- const S = d;
802
- switch (H) {
803
- case "top": {
804
- const de = [
805
- V ? B + S / 2 : y ? B + S * 4 : B - S * 4,
806
- j + S + 1
807
- ], he = [
808
- V ? B - S / 2 : y ? B + S * 4 : B - S * 4,
809
- j + S + 1
810
- ], we = [
811
- [
812
- (s == null ? void 0 : s.left) ?? 0,
813
- y || V ? ((s == null ? void 0 : s.bottom) ?? 0) - S : (s == null ? void 0 : s.top) ?? 0
814
- ],
815
- [
816
- (s == null ? void 0 : s.right) ?? 0,
817
- y ? V ? ((s == null ? void 0 : s.bottom) ?? 0) - S : (s == null ? void 0 : s.top) ?? 0 : ((s == null ? void 0 : s.bottom) ?? 0) - S
818
- ]
819
- ];
820
- return [de, he, ...we];
821
- }
822
- case "bottom": {
823
- const de = [
824
- V ? B + S / 2 : y ? B + S * 4 : B - S * 4,
825
- j - S
826
- ], he = [
827
- V ? B - S / 2 : y ? B + S * 4 : B - S * 4,
828
- j - S
829
- ], we = [
830
- [
831
- (s == null ? void 0 : s.left) ?? 0,
832
- y || V ? ((s == null ? void 0 : s.top) ?? 0) + S : (s == null ? void 0 : s.bottom) ?? 0
833
- ],
834
- [
835
- (s == null ? void 0 : s.right) ?? 0,
836
- y ? V ? ((s == null ? void 0 : s.top) ?? 0) + S : (s == null ? void 0 : s.bottom) ?? 0 : ((s == null ? void 0 : s.top) ?? 0) + S
837
- ]
838
- ];
839
- return [de, he, ...we];
840
- }
841
- case "left": {
842
- const de = [
843
- B + S + 1,
844
- L ? j + S / 2 : I ? j + S * 4 : j - S * 4
845
- ], he = [
846
- B + S + 1,
847
- L ? j - S / 2 : I ? j + S * 4 : j - S * 4
848
- ];
849
- return [...[
850
- [
851
- I || L ? ((s == null ? void 0 : s.right) ?? 0) - S : (s == null ? void 0 : s.left) ?? 0,
852
- (s == null ? void 0 : s.top) ?? 0
853
- ],
854
- [
855
- I ? L ? ((s == null ? void 0 : s.right) ?? 0) - S : (s == null ? void 0 : s.left) ?? 0 : ((s == null ? void 0 : s.right) ?? 0) - S,
856
- (s == null ? void 0 : s.bottom) ?? 0
857
- ]
858
- ], de, he];
859
- }
860
- case "right": {
861
- const de = [
862
- B - S,
863
- L ? j + S / 2 : I ? j + S * 4 : j - S * 4
864
- ], he = [
865
- B - S,
866
- L ? j - S / 2 : I ? j + S * 4 : j - S * 4
867
- ], we = [
868
- [
869
- I || L ? ((s == null ? void 0 : s.left) ?? 0) + S : (s == null ? void 0 : s.right) ?? 0,
870
- (s == null ? void 0 : s.top) ?? 0
871
- ],
872
- [
873
- I ? L ? ((s == null ? void 0 : s.left) ?? 0) + S : (s == null ? void 0 : s.right) ?? 0 : ((s == null ? void 0 : s.left) ?? 0) + S,
874
- (s == null ? void 0 : s.bottom) ?? 0
875
- ]
876
- ];
877
- return [de, he, ...we];
878
- }
879
- }
880
- }
881
- const ge = Se([c, u]);
882
- if ((rt = e.onPolygonChange) == null || rt.call(e, ge), !mt(A, re)) {
883
- if (mt(A, ge)) {
884
- if (!i && n) {
885
- const B = l(
886
- x.clientX,
887
- x.clientY,
888
- E,
889
- C,
890
- P
891
- );
892
- E = B.lastX, C = B.lastY, P = B.lastCursorTime, B.speed !== null && B.speed < 0.1 && (o = window.setTimeout(O, 40));
893
- }
894
- return;
895
- }
896
- if (i && !oe)
897
- return O();
898
- O();
899
- }
900
- };
901
- };
902
- return r.__options = {
903
- blockPointerEvents: t
904
- }, r;
905
- }
906
- const vt = 10;
907
- function On(e, t, n) {
908
- const { delay: o } = n, i = N(() => {
909
- const c = D(o);
910
- return (typeof c == "number" ? c : c.open) ?? 0;
911
- }), l = N(() => {
912
- const c = D(o);
913
- return (typeof c == "number" ? c : c.close) ?? 0;
914
- });
915
- let r, a;
916
- const f = () => {
917
- clearTimeout(r), clearTimeout(a);
918
- };
919
- return xe(f), {
920
- show: (c) => {
921
- f();
922
- const u = c ?? i.value;
923
- u === 0 ? e() : r = setTimeout(e, u);
924
- },
925
- hide: (c) => {
926
- f();
927
- const u = c ?? l.value;
928
- u === 0 ? t() : a = setTimeout(t, u);
929
- },
930
- showDelay: i,
931
- hideDelay: l,
932
- clearTimeouts: f
933
- };
934
- }
935
- function Mo(e, t = {}) {
936
- const { floatingContext: n, treeContext: o } = He(e), {
937
- open: i,
938
- setOpen: l,
939
- refs: { anchorEl: r, floatingEl: a }
940
- } = n, {
941
- enabled: f = !0,
942
- delay: c = 0,
943
- restMs: u = 0,
944
- mouseOnly: v = !1,
945
- safePolygon: h = !1
946
- } = t, d = N(() => D(f)), m = N(() => D(u)), g = N(() => {
947
- const y = r.value;
948
- return !y || y instanceof HTMLElement ? y : y.contextElement ?? null;
949
- }), { hide: p, show: b, showDelay: E, clearTimeouts: C } = On(
950
- () => {
951
- i.value || l(!0);
952
- },
953
- () => {
954
- i.value && l(!1);
955
- },
956
- { delay: c }
957
- );
958
- let P = null, w;
959
- const x = N(() => E.value === 0 && m.value > 0);
960
- function O(y) {
961
- if (!d.value || !A(y) || !x.value || !P) return;
962
- const I = { x: y.clientX, y: y.clientY }, oe = Math.abs(I.x - P.x), V = Math.abs(I.y - P.y);
963
- (oe > vt || V > vt) && (P = I, clearTimeout(w), w = setTimeout(() => {
964
- b(0);
965
- }, m.value));
966
- }
967
- function R(y) {
968
- !d.value || !A(y) || !x.value || (P = { x: y.clientX, y: y.clientY }, w = setTimeout(() => {
969
- b(0);
970
- }, m.value));
971
- }
972
- function M() {
973
- clearTimeout(w), P = null;
974
- }
975
- Oe(() => {
976
- const y = g.value;
977
- !y || !d.value || !x.value || (y.addEventListener("pointerenter", R), y.addEventListener("pointermove", O), y.addEventListener("pointerleave", M), ve(() => {
978
- y.removeEventListener("pointerenter", R), y.removeEventListener("pointermove", O), y.removeEventListener("pointerleave", M);
979
- }));
980
- }), xe(() => {
981
- clearTimeout(w);
982
- });
983
- function A(y) {
984
- return D(v) ? y.pointerType === "mouse" : !0;
985
- }
986
- function k(y) {
987
- !d.value || !A(y) || x.value || (F(), b());
988
- }
989
- function W(y) {
990
- !d.value || !A(y) || (C(), F());
991
- }
992
- let $ = null;
993
- function F() {
994
- $ && (document.removeEventListener("pointermove", $), $ = null);
995
- const y = s.value;
996
- y != null && y.onPolygonChange && y.onPolygonChange([]);
997
- }
998
- const T = N(() => !!D(h)), s = N(() => {
999
- const y = D(h);
1000
- if (typeof y == "object" && y) return y;
1001
- if (y === !0) return {};
1002
- });
1003
- function H(y) {
1004
- var L;
1005
- if (!d.value || !A(y)) return;
1006
- const { clientX: I, clientY: oe } = y, V = y.relatedTarget;
1007
- if (T.value)
1008
- setTimeout(() => {
1009
- var re;
1010
- F();
1011
- const X = g.value, ue = a.value;
1012
- if (!X || !ue) {
1013
- p();
1014
- return;
1015
- }
1016
- let z, fe;
1017
- if (o) {
1018
- z = /* @__PURE__ */ new Map();
1019
- const Se = (ge) => {
1020
- z == null || z.set(ge.id, ge);
1021
- for (const Ae of ge.children.value)
1022
- Se(Ae);
1023
- };
1024
- Se(o), fe = o.id;
1025
- }
1026
- $ = Tn(s.value)({
1027
- x: I,
1028
- y: oe,
1029
- placement: n.placement.value,
1030
- elements: {
1031
- domReference: X,
1032
- floating: ue
1033
- },
1034
- buffer: ((re = s.value) == null ? void 0 : re.buffer) ?? 1,
1035
- onClose: () => {
1036
- F(), p();
1037
- },
1038
- nodeId: fe,
1039
- tree: z ? { nodes: z } : void 0
1040
- }), $ && document.addEventListener("pointermove", $);
1041
- }, 0);
1042
- else {
1043
- if (o) {
1044
- if (!Pn(o, V))
1045
- return;
1046
- } else if ((L = a.value) != null && L.contains(V))
1047
- return;
1048
- p();
1049
- }
1050
- }
1051
- Oe(() => {
1052
- const y = g.value;
1053
- !y || !d.value || (y.addEventListener("pointerenter", k), y.addEventListener("pointerleave", H), ve(() => {
1054
- y.removeEventListener("pointerenter", k), y.removeEventListener("pointerleave", H);
1055
- }));
1056
- }), Oe(() => {
1057
- const y = a.value;
1058
- !y || !d.value || (y.addEventListener("pointerenter", W), y.addEventListener("pointerleave", H), ve(() => {
1059
- y.removeEventListener("pointerenter", W), y.removeEventListener("pointerleave", H);
1060
- }));
1061
- }), xe(() => {
1062
- F();
1063
- });
1064
- }
1065
- function Pn(e, t) {
1066
- return t ? !(Z(t, e.data.refs.anchorEl.value) || Z(t, e.data.refs.floatingEl.value) || Ke(e, t)) : !0;
1067
- }
1068
- const Ft = ["top", "right", "bottom", "left"], pt = ["start", "end"], gt = /* @__PURE__ */ Ft.reduce((e, t) => e.concat(t, t + "-" + pt[0], t + "-" + pt[1]), []), le = Math.min, Y = Math.max, Re = Math.round, Me = Math.floor, Q = (e) => ({
1069
- x: e,
1070
- y: e
1071
- }), Ln = {
1072
- left: "right",
1073
- right: "left",
1074
- bottom: "top",
1075
- top: "bottom"
1076
- }, Sn = {
1077
- start: "end",
1078
- end: "start"
1079
- };
1080
- function ze(e, t, n) {
1081
- return Y(e, le(t, n));
1082
- }
1083
- function ce(e, t) {
1084
- return typeof e == "function" ? e(t) : e;
1085
- }
1086
- function ee(e) {
1087
- return e.split("-")[0];
1088
- }
1089
- function K(e) {
1090
- return e.split("-")[1];
1091
- }
1092
- function Ht(e) {
1093
- return e === "x" ? "y" : "x";
1094
- }
1095
- function qe(e) {
1096
- return e === "y" ? "height" : "width";
1097
- }
1098
- const An = /* @__PURE__ */ new Set(["top", "bottom"]);
1099
- function ie(e) {
1100
- return An.has(ee(e)) ? "y" : "x";
1101
- }
1102
- function Ge(e) {
1103
- return Ht(ie(e));
1104
- }
1105
- function It(e, t, n) {
1106
- n === void 0 && (n = !1);
1107
- const o = K(e), i = Ge(e), l = qe(i);
1108
- let r = i === "x" ? o === (n ? "end" : "start") ? "right" : "left" : o === "start" ? "bottom" : "top";
1109
- return t.reference[l] > t.floating[l] && (r = ke(r)), [r, ke(r)];
1110
- }
1111
- function Dn(e) {
1112
- const t = ke(e);
1113
- return [Ne(e), t, Ne(t)];
1114
- }
1115
- function Ne(e) {
1116
- return e.replace(/start|end/g, (t) => Sn[t]);
1117
- }
1118
- const wt = ["left", "right"], yt = ["right", "left"], Mn = ["top", "bottom"], Rn = ["bottom", "top"];
1119
- function Nn(e, t, n) {
1120
- switch (e) {
1121
- case "top":
1122
- case "bottom":
1123
- return n ? t ? yt : wt : t ? wt : yt;
1124
- case "left":
1125
- case "right":
1126
- return t ? Mn : Rn;
1127
- default:
1128
- return [];
1129
- }
1130
- }
1131
- function kn(e, t, n, o) {
1132
- const i = K(e);
1133
- let l = Nn(ee(e), n === "start", o);
1134
- return i && (l = l.map((r) => r + "-" + i), t && (l = l.concat(l.map(Ne)))), l;
1135
- }
1136
- function ke(e) {
1137
- return e.replace(/left|right|bottom|top/g, (t) => Ln[t]);
1138
- }
1139
- function Fn(e) {
1140
- return {
1141
- top: 0,
1142
- right: 0,
1143
- bottom: 0,
1144
- left: 0,
1145
- ...e
1146
- };
1147
- }
1148
- function Bt(e) {
1149
- return typeof e != "number" ? Fn(e) : {
1150
- top: e,
1151
- right: e,
1152
- bottom: e,
1153
- left: e
1154
- };
1155
- }
1156
- function Fe(e) {
1157
- const {
1158
- x: t,
1159
- y: n,
1160
- width: o,
1161
- height: i
1162
- } = e;
1163
- return {
1164
- width: o,
1165
- height: i,
1166
- top: n,
1167
- left: t,
1168
- right: t + o,
1169
- bottom: n + i,
1170
- x: t,
1171
- y: n
1172
- };
1173
- }
1174
- function bt(e, t, n) {
1175
- let {
1176
- reference: o,
1177
- floating: i
1178
- } = e;
1179
- const l = ie(t), r = Ge(t), a = qe(r), f = ee(t), c = l === "y", u = o.x + o.width / 2 - i.width / 2, v = o.y + o.height / 2 - i.height / 2, h = o[a] / 2 - i[a] / 2;
1180
- let d;
1181
- switch (f) {
1182
- case "top":
1183
- d = {
1184
- x: u,
1185
- y: o.y - i.height
493
+ function gn(e, t, n, o) {
494
+ const i = G(e);
495
+ let c = vn(ee(e), n === "start", o);
496
+ return i && (c = c.map((r) => r + "-" + i), t && (c = c.concat(c.map(Ne)))), c;
497
+ }
498
+ function ke(e) {
499
+ return e.replace(/left|right|bottom|top/g, (t) => un[t]);
500
+ }
501
+ function wn(e) {
502
+ return {
503
+ top: 0,
504
+ right: 0,
505
+ bottom: 0,
506
+ left: 0,
507
+ ...e
508
+ };
509
+ }
510
+ function kt(e) {
511
+ return typeof e != "number" ? wn(e) : {
512
+ top: e,
513
+ right: e,
514
+ bottom: e,
515
+ left: e
516
+ };
517
+ }
518
+ function Fe(e) {
519
+ const {
520
+ x: t,
521
+ y: n,
522
+ width: o,
523
+ height: i
524
+ } = e;
525
+ return {
526
+ width: o,
527
+ height: i,
528
+ top: n,
529
+ left: t,
530
+ right: t + o,
531
+ bottom: n + i,
532
+ x: t,
533
+ y: n
534
+ };
535
+ }
536
+ function vt(e, t, n) {
537
+ let {
538
+ reference: o,
539
+ floating: i
540
+ } = e;
541
+ const c = ie(t), r = Je(t), a = Ge(r), d = ee(t), s = c === "y", f = o.x + o.width / 2 - i.width / 2, u = o.y + o.height / 2 - i.height / 2, m = o[a] / 2 - i[a] / 2;
542
+ let h;
543
+ switch (d) {
544
+ case "top":
545
+ h = {
546
+ x: f,
547
+ y: o.y - i.height
1186
548
  };
1187
549
  break;
1188
550
  case "bottom":
1189
- d = {
1190
- x: u,
551
+ h = {
552
+ x: f,
1191
553
  y: o.y + o.height
1192
554
  };
1193
555
  break;
1194
556
  case "right":
1195
- d = {
557
+ h = {
1196
558
  x: o.x + o.width,
1197
- y: v
559
+ y: u
1198
560
  };
1199
561
  break;
1200
562
  case "left":
1201
- d = {
563
+ h = {
1202
564
  x: o.x - i.width,
1203
- y: v
565
+ y: u
1204
566
  };
1205
567
  break;
1206
568
  default:
1207
- d = {
569
+ h = {
1208
570
  x: o.x,
1209
571
  y: o.y
1210
572
  };
1211
573
  }
1212
- switch (K(t)) {
574
+ switch (G(t)) {
1213
575
  case "start":
1214
- d[r] -= h * (n && c ? -1 : 1);
576
+ h[r] -= m * (n && s ? -1 : 1);
1215
577
  break;
1216
578
  case "end":
1217
- d[r] += h * (n && c ? -1 : 1);
579
+ h[r] += m * (n && s ? -1 : 1);
1218
580
  break;
1219
581
  }
1220
- return d;
582
+ return h;
1221
583
  }
1222
- const Hn = async (e, t, n) => {
584
+ const yn = async (e, t, n) => {
1223
585
  const {
1224
586
  placement: o = "bottom",
1225
587
  strategy: i = "absolute",
1226
- middleware: l = [],
588
+ middleware: c = [],
1227
589
  platform: r
1228
- } = n, a = l.filter(Boolean), f = await (r.isRTL == null ? void 0 : r.isRTL(t));
1229
- let c = await r.getElementRects({
590
+ } = n, a = c.filter(Boolean), d = await (r.isRTL == null ? void 0 : r.isRTL(t));
591
+ let s = await r.getElementRects({
1230
592
  reference: e,
1231
593
  floating: t,
1232
594
  strategy: i
1233
595
  }), {
1234
- x: u,
1235
- y: v
1236
- } = bt(c, o, f), h = o, d = {}, m = 0;
596
+ x: f,
597
+ y: u
598
+ } = vt(s, o, d), m = o, h = {}, p = 0;
1237
599
  for (let g = 0; g < a.length; g++) {
1238
600
  const {
1239
- name: p,
1240
- fn: b
601
+ name: v,
602
+ fn: x
1241
603
  } = a[g], {
1242
- x: E,
1243
- y: C,
604
+ x: b,
605
+ y: E,
1244
606
  data: P,
1245
- reset: w
1246
- } = await b({
1247
- x: u,
1248
- y: v,
607
+ reset: S
608
+ } = await x({
609
+ x: f,
610
+ y: u,
1249
611
  initialPlacement: o,
1250
- placement: h,
612
+ placement: m,
1251
613
  strategy: i,
1252
- middlewareData: d,
1253
- rects: c,
614
+ middlewareData: h,
615
+ rects: s,
1254
616
  platform: r,
1255
617
  elements: {
1256
618
  reference: e,
1257
619
  floating: t
1258
620
  }
1259
621
  });
1260
- u = E ?? u, v = C ?? v, d = {
1261
- ...d,
1262
- [p]: {
1263
- ...d[p],
622
+ f = b ?? f, u = E ?? u, h = {
623
+ ...h,
624
+ [v]: {
625
+ ...h[v],
1264
626
  ...P
1265
627
  }
1266
- }, w && m <= 50 && (m++, typeof w == "object" && (w.placement && (h = w.placement), w.rects && (c = w.rects === !0 ? await r.getElementRects({
628
+ }, S && p <= 50 && (p++, typeof S == "object" && (S.placement && (m = S.placement), S.rects && (s = S.rects === !0 ? await r.getElementRects({
1267
629
  reference: e,
1268
630
  floating: t,
1269
631
  strategy: i
1270
- }) : w.rects), {
1271
- x: u,
1272
- y: v
1273
- } = bt(c, h, f)), g = -1);
632
+ }) : S.rects), {
633
+ x: f,
634
+ y: u
635
+ } = vt(s, m, d)), g = -1);
1274
636
  }
1275
637
  return {
1276
- x: u,
1277
- y: v,
1278
- placement: h,
638
+ x: f,
639
+ y: u,
640
+ placement: m,
1279
641
  strategy: i,
1280
- middlewareData: d
642
+ middlewareData: h
1281
643
  };
1282
644
  };
1283
645
  async function Ee(e, t) {
@@ -1286,46 +648,46 @@ async function Ee(e, t) {
1286
648
  const {
1287
649
  x: o,
1288
650
  y: i,
1289
- platform: l,
651
+ platform: c,
1290
652
  rects: r,
1291
653
  elements: a,
1292
- strategy: f
654
+ strategy: d
1293
655
  } = e, {
1294
- boundary: c = "clippingAncestors",
1295
- rootBoundary: u = "viewport",
1296
- elementContext: v = "floating",
1297
- altBoundary: h = !1,
1298
- padding: d = 0
1299
- } = ce(t, e), m = Bt(d), p = a[h ? v === "floating" ? "reference" : "floating" : v], b = Fe(await l.getClippingRect({
1300
- element: (n = await (l.isElement == null ? void 0 : l.isElement(p))) == null || n ? p : p.contextElement || await (l.getDocumentElement == null ? void 0 : l.getDocumentElement(a.floating)),
1301
- boundary: c,
1302
- rootBoundary: u,
1303
- strategy: f
1304
- })), E = v === "floating" ? {
656
+ boundary: s = "clippingAncestors",
657
+ rootBoundary: f = "viewport",
658
+ elementContext: u = "floating",
659
+ altBoundary: m = !1,
660
+ padding: h = 0
661
+ } = ce(t, e), p = kt(h), v = a[m ? u === "floating" ? "reference" : "floating" : u], x = Fe(await c.getClippingRect({
662
+ element: (n = await (c.isElement == null ? void 0 : c.isElement(v))) == null || n ? v : v.contextElement || await (c.getDocumentElement == null ? void 0 : c.getDocumentElement(a.floating)),
663
+ boundary: s,
664
+ rootBoundary: f,
665
+ strategy: d
666
+ })), b = u === "floating" ? {
1305
667
  x: o,
1306
668
  y: i,
1307
669
  width: r.floating.width,
1308
670
  height: r.floating.height
1309
- } : r.reference, C = await (l.getOffsetParent == null ? void 0 : l.getOffsetParent(a.floating)), P = await (l.isElement == null ? void 0 : l.isElement(C)) ? await (l.getScale == null ? void 0 : l.getScale(C)) || {
671
+ } : r.reference, E = await (c.getOffsetParent == null ? void 0 : c.getOffsetParent(a.floating)), P = await (c.isElement == null ? void 0 : c.isElement(E)) ? await (c.getScale == null ? void 0 : c.getScale(E)) || {
1310
672
  x: 1,
1311
673
  y: 1
1312
674
  } : {
1313
675
  x: 1,
1314
676
  y: 1
1315
- }, w = Fe(l.convertOffsetParentRelativeRectToViewportRelativeRect ? await l.convertOffsetParentRelativeRectToViewportRelativeRect({
677
+ }, S = Fe(c.convertOffsetParentRelativeRectToViewportRelativeRect ? await c.convertOffsetParentRelativeRectToViewportRelativeRect({
1316
678
  elements: a,
1317
- rect: E,
1318
- offsetParent: C,
1319
- strategy: f
1320
- }) : E);
679
+ rect: b,
680
+ offsetParent: E,
681
+ strategy: d
682
+ }) : b);
1321
683
  return {
1322
- top: (b.top - w.top + m.top) / P.y,
1323
- bottom: (w.bottom - b.bottom + m.bottom) / P.y,
1324
- left: (b.left - w.left + m.left) / P.x,
1325
- right: (w.right - b.right + m.right) / P.x
684
+ top: (x.top - S.top + p.top) / P.y,
685
+ bottom: (S.bottom - x.bottom + p.bottom) / P.y,
686
+ left: (x.left - S.left + p.left) / P.x,
687
+ right: (S.right - x.right + p.right) / P.x
1326
688
  };
1327
689
  }
1328
- const In = (e) => ({
690
+ const bn = (e) => ({
1329
691
  name: "arrow",
1330
692
  options: e,
1331
693
  async fn(t) {
@@ -1333,108 +695,108 @@ const In = (e) => ({
1333
695
  x: n,
1334
696
  y: o,
1335
697
  placement: i,
1336
- rects: l,
698
+ rects: c,
1337
699
  platform: r,
1338
700
  elements: a,
1339
- middlewareData: f
701
+ middlewareData: d
1340
702
  } = t, {
1341
- element: c,
1342
- padding: u = 0
703
+ element: s,
704
+ padding: f = 0
1343
705
  } = ce(e, t) || {};
1344
- if (c == null)
706
+ if (s == null)
1345
707
  return {};
1346
- const v = Bt(u), h = {
708
+ const u = kt(f), m = {
1347
709
  x: n,
1348
710
  y: o
1349
- }, d = Ge(i), m = qe(d), g = await r.getDimensions(c), p = d === "y", b = p ? "top" : "left", E = p ? "bottom" : "right", C = p ? "clientHeight" : "clientWidth", P = l.reference[m] + l.reference[d] - h[d] - l.floating[m], w = h[d] - l.reference[d], x = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(c));
1350
- let O = x ? x[C] : 0;
1351
- (!O || !await (r.isElement == null ? void 0 : r.isElement(x))) && (O = a.floating[C] || l.floating[m]);
1352
- const R = P / 2 - w / 2, M = O / 2 - g[m] / 2 - 1, A = le(v[b], M), k = le(v[E], M), W = A, $ = O - g[m] - k, F = O / 2 - g[m] / 2 + R, T = ze(W, F, $), s = !f.arrow && K(i) != null && F !== T && l.reference[m] / 2 - (F < W ? A : k) - g[m] / 2 < 0, H = s ? F < W ? F - W : F - $ : 0;
711
+ }, h = Je(i), p = Ge(h), g = await r.getDimensions(s), v = h === "y", x = v ? "top" : "left", b = v ? "bottom" : "right", E = v ? "clientHeight" : "clientWidth", P = c.reference[p] + c.reference[h] - m[h] - c.floating[p], S = m[h] - c.reference[h], y = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(s));
712
+ let O = y ? y[E] : 0;
713
+ (!O || !await (r.isElement == null ? void 0 : r.isElement(y))) && (O = a.floating[E] || c.floating[p]);
714
+ const M = P / 2 - S / 2, R = O / 2 - g[p] / 2 - 1, A = le(u[x], R), k = le(u[b], R), F = A, $ = O - g[p] - k, H = O / 2 - g[p] / 2 + M, C = ze(F, H, $), l = !d.arrow && G(i) != null && H !== C && c.reference[p] / 2 - (H < F ? A : k) - g[p] / 2 < 0, I = l ? H < F ? H - F : H - $ : 0;
1353
715
  return {
1354
- [d]: h[d] + H,
716
+ [h]: m[h] + I,
1355
717
  data: {
1356
- [d]: T,
1357
- centerOffset: F - T - H,
1358
- ...s && {
1359
- alignmentOffset: H
718
+ [h]: C,
719
+ centerOffset: H - C - I,
720
+ ...l && {
721
+ alignmentOffset: I
1360
722
  }
1361
723
  },
1362
- reset: s
724
+ reset: l
1363
725
  };
1364
726
  }
1365
727
  });
1366
- function Bn(e, t, n) {
1367
- return (e ? [...n.filter((i) => K(i) === e), ...n.filter((i) => K(i) !== e)] : n.filter((i) => ee(i) === i)).filter((i) => e ? K(i) === e || (t ? Ne(i) !== i : !1) : !0);
728
+ function xn(e, t, n) {
729
+ return (e ? [...n.filter((i) => G(i) === e), ...n.filter((i) => G(i) !== e)] : n.filter((i) => ee(i) === i)).filter((i) => e ? G(i) === e || (t ? Ne(i) !== i : !1) : !0);
1368
730
  }
1369
- const Wn = function(e) {
731
+ const En = function(e) {
1370
732
  return e === void 0 && (e = {}), {
1371
733
  name: "autoPlacement",
1372
734
  options: e,
1373
735
  async fn(t) {
1374
736
  var n, o, i;
1375
737
  const {
1376
- rects: l,
738
+ rects: c,
1377
739
  middlewareData: r,
1378
740
  placement: a,
1379
- platform: f,
1380
- elements: c
741
+ platform: d,
742
+ elements: s
1381
743
  } = t, {
1382
- crossAxis: u = !1,
1383
- alignment: v,
1384
- allowedPlacements: h = gt,
1385
- autoAlignment: d = !0,
1386
- ...m
1387
- } = ce(e, t), g = v !== void 0 || h === gt ? Bn(v || null, d, h) : h, p = await Ee(t, m), b = ((n = r.autoPlacement) == null ? void 0 : n.index) || 0, E = g[b];
1388
- if (E == null)
744
+ crossAxis: f = !1,
745
+ alignment: u,
746
+ allowedPlacements: m = ht,
747
+ autoAlignment: h = !0,
748
+ ...p
749
+ } = ce(e, t), g = u !== void 0 || m === ht ? xn(u || null, h, m) : m, v = await Ee(t, p), x = ((n = r.autoPlacement) == null ? void 0 : n.index) || 0, b = g[x];
750
+ if (b == null)
1389
751
  return {};
1390
- const C = It(E, l, await (f.isRTL == null ? void 0 : f.isRTL(c.floating)));
1391
- if (a !== E)
752
+ const E = Nt(b, c, await (d.isRTL == null ? void 0 : d.isRTL(s.floating)));
753
+ if (a !== b)
1392
754
  return {
1393
755
  reset: {
1394
756
  placement: g[0]
1395
757
  }
1396
758
  };
1397
- const P = [p[ee(E)], p[C[0]], p[C[1]]], w = [...((o = r.autoPlacement) == null ? void 0 : o.overflows) || [], {
1398
- placement: E,
759
+ const P = [v[ee(b)], v[E[0]], v[E[1]]], S = [...((o = r.autoPlacement) == null ? void 0 : o.overflows) || [], {
760
+ placement: b,
1399
761
  overflows: P
1400
- }], x = g[b + 1];
1401
- if (x)
762
+ }], y = g[x + 1];
763
+ if (y)
1402
764
  return {
1403
765
  data: {
1404
- index: b + 1,
1405
- overflows: w
766
+ index: x + 1,
767
+ overflows: S
1406
768
  },
1407
769
  reset: {
1408
- placement: x
770
+ placement: y
1409
771
  }
1410
772
  };
1411
- const O = w.map((A) => {
1412
- const k = K(A.placement);
1413
- return [A.placement, k && u ? (
773
+ const O = S.map((A) => {
774
+ const k = G(A.placement);
775
+ return [A.placement, k && f ? (
1414
776
  // Check along the mainAxis and main crossAxis side.
1415
- A.overflows.slice(0, 2).reduce((W, $) => W + $, 0)
777
+ A.overflows.slice(0, 2).reduce((F, $) => F + $, 0)
1416
778
  ) : (
1417
779
  // Check only the mainAxis.
1418
780
  A.overflows[0]
1419
781
  ), A.overflows];
1420
- }).sort((A, k) => A[1] - k[1]), M = ((i = O.filter((A) => A[2].slice(
782
+ }).sort((A, k) => A[1] - k[1]), R = ((i = O.filter((A) => A[2].slice(
1421
783
  0,
1422
784
  // Aligned placements should not check their opposite crossAxis
1423
785
  // side.
1424
- K(A[0]) ? 2 : 3
786
+ G(A[0]) ? 2 : 3
1425
787
  ).every((k) => k <= 0))[0]) == null ? void 0 : i[0]) || O[0][0];
1426
- return M !== a ? {
788
+ return R !== a ? {
1427
789
  data: {
1428
- index: b + 1,
1429
- overflows: w
790
+ index: x + 1,
791
+ overflows: S
1430
792
  },
1431
793
  reset: {
1432
- placement: M
794
+ placement: R
1433
795
  }
1434
796
  } : {};
1435
797
  }
1436
798
  };
1437
- }, $n = function(e) {
799
+ }, Cn = function(e) {
1438
800
  return e === void 0 && (e = {}), {
1439
801
  name: "flip",
1440
802
  options: e,
@@ -1442,73 +804,73 @@ const Wn = function(e) {
1442
804
  var n, o;
1443
805
  const {
1444
806
  placement: i,
1445
- middlewareData: l,
807
+ middlewareData: c,
1446
808
  rects: r,
1447
809
  initialPlacement: a,
1448
- platform: f,
1449
- elements: c
810
+ platform: d,
811
+ elements: s
1450
812
  } = t, {
1451
- mainAxis: u = !0,
1452
- crossAxis: v = !0,
1453
- fallbackPlacements: h,
1454
- fallbackStrategy: d = "bestFit",
1455
- fallbackAxisSideDirection: m = "none",
813
+ mainAxis: f = !0,
814
+ crossAxis: u = !0,
815
+ fallbackPlacements: m,
816
+ fallbackStrategy: h = "bestFit",
817
+ fallbackAxisSideDirection: p = "none",
1456
818
  flipAlignment: g = !0,
1457
- ...p
819
+ ...v
1458
820
  } = ce(e, t);
1459
- if ((n = l.arrow) != null && n.alignmentOffset)
821
+ if ((n = c.arrow) != null && n.alignmentOffset)
1460
822
  return {};
1461
- const b = ee(i), E = ie(a), C = ee(a) === a, P = await (f.isRTL == null ? void 0 : f.isRTL(c.floating)), w = h || (C || !g ? [ke(a)] : Dn(a)), x = m !== "none";
1462
- !h && x && w.push(...kn(a, g, m, P));
1463
- const O = [a, ...w], R = await Ee(t, p), M = [];
1464
- let A = ((o = l.flip) == null ? void 0 : o.overflows) || [];
1465
- if (u && M.push(R[b]), v) {
1466
- const F = It(i, r, P);
1467
- M.push(R[F[0]], R[F[1]]);
823
+ const x = ee(i), b = ie(a), E = ee(a) === a, P = await (d.isRTL == null ? void 0 : d.isRTL(s.floating)), S = m || (E || !g ? [ke(a)] : hn(a)), y = p !== "none";
824
+ !m && y && S.push(...gn(a, g, p, P));
825
+ const O = [a, ...S], M = await Ee(t, v), R = [];
826
+ let A = ((o = c.flip) == null ? void 0 : o.overflows) || [];
827
+ if (f && R.push(M[x]), u) {
828
+ const H = Nt(i, r, P);
829
+ R.push(M[H[0]], M[H[1]]);
1468
830
  }
1469
831
  if (A = [...A, {
1470
832
  placement: i,
1471
- overflows: M
1472
- }], !M.every((F) => F <= 0)) {
1473
- var k, W;
1474
- const F = (((k = l.flip) == null ? void 0 : k.index) || 0) + 1, T = O[F];
1475
- if (T && (!(v === "alignment" ? E !== ie(T) : !1) || // We leave the current main axis only if every placement on that axis
833
+ overflows: R
834
+ }], !R.every((H) => H <= 0)) {
835
+ var k, F;
836
+ const H = (((k = c.flip) == null ? void 0 : k.index) || 0) + 1, C = O[H];
837
+ if (C && (!(u === "alignment" ? b !== ie(C) : !1) || // We leave the current main axis only if every placement on that axis
1476
838
  // overflows the main axis.
1477
- A.every((y) => ie(y.placement) === E ? y.overflows[0] > 0 : !0)))
839
+ A.every((w) => ie(w.placement) === b ? w.overflows[0] > 0 : !0)))
1478
840
  return {
1479
841
  data: {
1480
- index: F,
842
+ index: H,
1481
843
  overflows: A
1482
844
  },
1483
845
  reset: {
1484
- placement: T
846
+ placement: C
1485
847
  }
1486
848
  };
1487
- let s = (W = A.filter((H) => H.overflows[0] <= 0).sort((H, y) => H.overflows[1] - y.overflows[1])[0]) == null ? void 0 : W.placement;
1488
- if (!s)
1489
- switch (d) {
849
+ let l = (F = A.filter((I) => I.overflows[0] <= 0).sort((I, w) => I.overflows[1] - w.overflows[1])[0]) == null ? void 0 : F.placement;
850
+ if (!l)
851
+ switch (h) {
1490
852
  case "bestFit": {
1491
853
  var $;
1492
- const H = ($ = A.filter((y) => {
1493
- if (x) {
1494
- const I = ie(y.placement);
1495
- return I === E || // Create a bias to the `y` side axis due to horizontal
854
+ const I = ($ = A.filter((w) => {
855
+ if (y) {
856
+ const B = ie(w.placement);
857
+ return B === b || // Create a bias to the `y` side axis due to horizontal
1496
858
  // reading directions favoring greater width.
1497
- I === "y";
859
+ B === "y";
1498
860
  }
1499
861
  return !0;
1500
- }).map((y) => [y.placement, y.overflows.filter((I) => I > 0).reduce((I, oe) => I + oe, 0)]).sort((y, I) => y[1] - I[1])[0]) == null ? void 0 : $[0];
1501
- H && (s = H);
862
+ }).map((w) => [w.placement, w.overflows.filter((B) => B > 0).reduce((B, oe) => B + oe, 0)]).sort((w, B) => w[1] - B[1])[0]) == null ? void 0 : $[0];
863
+ I && (l = I);
1502
864
  break;
1503
865
  }
1504
866
  case "initialPlacement":
1505
- s = a;
867
+ l = a;
1506
868
  break;
1507
869
  }
1508
- if (i !== s)
870
+ if (i !== l)
1509
871
  return {
1510
872
  reset: {
1511
- placement: s
873
+ placement: l
1512
874
  }
1513
875
  };
1514
876
  }
@@ -1516,7 +878,7 @@ const Wn = function(e) {
1516
878
  }
1517
879
  };
1518
880
  };
1519
- function xt(e, t) {
881
+ function gt(e, t) {
1520
882
  return {
1521
883
  top: e.top - t.height,
1522
884
  right: e.right - t.width,
@@ -1524,10 +886,10 @@ function xt(e, t) {
1524
886
  left: e.left - t.width
1525
887
  };
1526
888
  }
1527
- function Et(e) {
1528
- return Ft.some((t) => e[t] >= 0);
889
+ function wt(e) {
890
+ return Rt.some((t) => e[t] >= 0);
1529
891
  }
1530
- const Vn = function(e) {
892
+ const Tn = function(e) {
1531
893
  return e === void 0 && (e = {}), {
1532
894
  name: "hide",
1533
895
  options: e,
@@ -1540,26 +902,26 @@ const Vn = function(e) {
1540
902
  } = ce(e, t);
1541
903
  switch (o) {
1542
904
  case "referenceHidden": {
1543
- const l = await Ee(t, {
905
+ const c = await Ee(t, {
1544
906
  ...i,
1545
907
  elementContext: "reference"
1546
- }), r = xt(l, n.reference);
908
+ }), r = gt(c, n.reference);
1547
909
  return {
1548
910
  data: {
1549
911
  referenceHiddenOffsets: r,
1550
- referenceHidden: Et(r)
912
+ referenceHidden: wt(r)
1551
913
  }
1552
914
  };
1553
915
  }
1554
916
  case "escaped": {
1555
- const l = await Ee(t, {
917
+ const c = await Ee(t, {
1556
918
  ...i,
1557
919
  altBoundary: !0
1558
- }), r = xt(l, n.floating);
920
+ }), r = gt(c, n.floating);
1559
921
  return {
1560
922
  data: {
1561
923
  escapedOffsets: r,
1562
- escaped: Et(r)
924
+ escaped: wt(r)
1563
925
  }
1564
926
  };
1565
927
  }
@@ -1568,35 +930,35 @@ const Vn = function(e) {
1568
930
  }
1569
931
  }
1570
932
  };
1571
- }, Xn = /* @__PURE__ */ new Set(["left", "top"]);
1572
- async function jn(e, t) {
933
+ }, On = /* @__PURE__ */ new Set(["left", "top"]);
934
+ async function Pn(e, t) {
1573
935
  const {
1574
936
  placement: n,
1575
937
  platform: o,
1576
938
  elements: i
1577
- } = e, l = await (o.isRTL == null ? void 0 : o.isRTL(i.floating)), r = ee(n), a = K(n), f = ie(n) === "y", c = Xn.has(r) ? -1 : 1, u = l && f ? -1 : 1, v = ce(t, e);
939
+ } = e, c = await (o.isRTL == null ? void 0 : o.isRTL(i.floating)), r = ee(n), a = G(n), d = ie(n) === "y", s = On.has(r) ? -1 : 1, f = c && d ? -1 : 1, u = ce(t, e);
1578
940
  let {
1579
- mainAxis: h,
1580
- crossAxis: d,
1581
- alignmentAxis: m
1582
- } = typeof v == "number" ? {
1583
- mainAxis: v,
941
+ mainAxis: m,
942
+ crossAxis: h,
943
+ alignmentAxis: p
944
+ } = typeof u == "number" ? {
945
+ mainAxis: u,
1584
946
  crossAxis: 0,
1585
947
  alignmentAxis: null
1586
948
  } : {
1587
- mainAxis: v.mainAxis || 0,
1588
- crossAxis: v.crossAxis || 0,
1589
- alignmentAxis: v.alignmentAxis
949
+ mainAxis: u.mainAxis || 0,
950
+ crossAxis: u.crossAxis || 0,
951
+ alignmentAxis: u.alignmentAxis
1590
952
  };
1591
- return a && typeof m == "number" && (d = a === "end" ? m * -1 : m), f ? {
1592
- x: d * u,
1593
- y: h * c
953
+ return a && typeof p == "number" && (h = a === "end" ? p * -1 : p), d ? {
954
+ x: h * f,
955
+ y: m * s
1594
956
  } : {
1595
- x: h * c,
1596
- y: d * u
957
+ x: m * s,
958
+ y: h * f
1597
959
  };
1598
960
  }
1599
- const Yn = function(e) {
961
+ const Sn = function(e) {
1600
962
  return e === void 0 && (e = 0), {
1601
963
  name: "offset",
1602
964
  options: e,
@@ -1604,21 +966,21 @@ const Yn = function(e) {
1604
966
  var n, o;
1605
967
  const {
1606
968
  x: i,
1607
- y: l,
969
+ y: c,
1608
970
  placement: r,
1609
971
  middlewareData: a
1610
- } = t, f = await jn(t, e);
972
+ } = t, d = await Pn(t, e);
1611
973
  return r === ((n = a.offset) == null ? void 0 : n.placement) && (o = a.arrow) != null && o.alignmentOffset ? {} : {
1612
- x: i + f.x,
1613
- y: l + f.y,
974
+ x: i + d.x,
975
+ y: c + d.y,
1614
976
  data: {
1615
- ...f,
977
+ ...d,
1616
978
  placement: r
1617
979
  }
1618
980
  };
1619
981
  }
1620
982
  };
1621
- }, _n = function(e) {
983
+ }, Ln = function(e) {
1622
984
  return e === void 0 && (e = {}), {
1623
985
  name: "shift",
1624
986
  options: e,
@@ -1628,38 +990,38 @@ const Yn = function(e) {
1628
990
  y: o,
1629
991
  placement: i
1630
992
  } = t, {
1631
- mainAxis: l = !0,
993
+ mainAxis: c = !0,
1632
994
  crossAxis: r = !1,
1633
995
  limiter: a = {
1634
- fn: (p) => {
996
+ fn: (v) => {
1635
997
  let {
1636
- x: b,
1637
- y: E
1638
- } = p;
998
+ x,
999
+ y: b
1000
+ } = v;
1639
1001
  return {
1640
- x: b,
1641
- y: E
1002
+ x,
1003
+ y: b
1642
1004
  };
1643
1005
  }
1644
1006
  },
1645
- ...f
1646
- } = ce(e, t), c = {
1007
+ ...d
1008
+ } = ce(e, t), s = {
1647
1009
  x: n,
1648
1010
  y: o
1649
- }, u = await Ee(t, f), v = ie(ee(i)), h = Ht(v);
1650
- let d = c[h], m = c[v];
1651
- if (l) {
1652
- const p = h === "y" ? "top" : "left", b = h === "y" ? "bottom" : "right", E = d + u[p], C = d - u[b];
1653
- d = ze(E, d, C);
1011
+ }, f = await Ee(t, d), u = ie(ee(i)), m = Mt(u);
1012
+ let h = s[m], p = s[u];
1013
+ if (c) {
1014
+ const v = m === "y" ? "top" : "left", x = m === "y" ? "bottom" : "right", b = h + f[v], E = h - f[x];
1015
+ h = ze(b, h, E);
1654
1016
  }
1655
1017
  if (r) {
1656
- const p = v === "y" ? "top" : "left", b = v === "y" ? "bottom" : "right", E = m + u[p], C = m - u[b];
1657
- m = ze(E, m, C);
1018
+ const v = u === "y" ? "top" : "left", x = u === "y" ? "bottom" : "right", b = p + f[v], E = p - f[x];
1019
+ p = ze(b, p, E);
1658
1020
  }
1659
1021
  const g = a.fn({
1660
1022
  ...t,
1661
- [h]: d,
1662
- [v]: m
1023
+ [m]: h,
1024
+ [u]: p
1663
1025
  });
1664
1026
  return {
1665
1027
  ...g,
@@ -1667,14 +1029,14 @@ const Yn = function(e) {
1667
1029
  x: g.x - n,
1668
1030
  y: g.y - o,
1669
1031
  enabled: {
1670
- [h]: l,
1671
- [v]: r
1032
+ [m]: c,
1033
+ [u]: r
1672
1034
  }
1673
1035
  }
1674
1036
  };
1675
1037
  }
1676
1038
  };
1677
- }, zn = function(e) {
1039
+ }, An = function(e) {
1678
1040
  return e === void 0 && (e = {}), {
1679
1041
  name: "size",
1680
1042
  options: e,
@@ -1682,32 +1044,32 @@ const Yn = function(e) {
1682
1044
  var n, o;
1683
1045
  const {
1684
1046
  placement: i,
1685
- rects: l,
1047
+ rects: c,
1686
1048
  platform: r,
1687
1049
  elements: a
1688
1050
  } = t, {
1689
- apply: f = () => {
1051
+ apply: d = () => {
1690
1052
  },
1691
- ...c
1692
- } = ce(e, t), u = await Ee(t, c), v = ee(i), h = K(i), d = ie(i) === "y", {
1693
- width: m,
1053
+ ...s
1054
+ } = ce(e, t), f = await Ee(t, s), u = ee(i), m = G(i), h = ie(i) === "y", {
1055
+ width: p,
1694
1056
  height: g
1695
- } = l.floating;
1696
- let p, b;
1697
- v === "top" || v === "bottom" ? (p = v, b = h === (await (r.isRTL == null ? void 0 : r.isRTL(a.floating)) ? "start" : "end") ? "left" : "right") : (b = v, p = h === "end" ? "top" : "bottom");
1698
- const E = g - u.top - u.bottom, C = m - u.left - u.right, P = le(g - u[p], E), w = le(m - u[b], C), x = !t.middlewareData.shift;
1699
- let O = P, R = w;
1700
- if ((n = t.middlewareData.shift) != null && n.enabled.x && (R = C), (o = t.middlewareData.shift) != null && o.enabled.y && (O = E), x && !h) {
1701
- const A = Y(u.left, 0), k = Y(u.right, 0), W = Y(u.top, 0), $ = Y(u.bottom, 0);
1702
- d ? R = m - 2 * (A !== 0 || k !== 0 ? A + k : Y(u.left, u.right)) : O = g - 2 * (W !== 0 || $ !== 0 ? W + $ : Y(u.top, u.bottom));
1057
+ } = c.floating;
1058
+ let v, x;
1059
+ u === "top" || u === "bottom" ? (v = u, x = m === (await (r.isRTL == null ? void 0 : r.isRTL(a.floating)) ? "start" : "end") ? "left" : "right") : (x = u, v = m === "end" ? "top" : "bottom");
1060
+ const b = g - f.top - f.bottom, E = p - f.left - f.right, P = le(g - f[v], b), S = le(p - f[x], E), y = !t.middlewareData.shift;
1061
+ let O = P, M = S;
1062
+ if ((n = t.middlewareData.shift) != null && n.enabled.x && (M = E), (o = t.middlewareData.shift) != null && o.enabled.y && (O = b), y && !m) {
1063
+ const A = Y(f.left, 0), k = Y(f.right, 0), F = Y(f.top, 0), $ = Y(f.bottom, 0);
1064
+ h ? M = p - 2 * (A !== 0 || k !== 0 ? A + k : Y(f.left, f.right)) : O = g - 2 * (F !== 0 || $ !== 0 ? F + $ : Y(f.top, f.bottom));
1703
1065
  }
1704
- await f({
1066
+ await d({
1705
1067
  ...t,
1706
- availableWidth: R,
1068
+ availableWidth: M,
1707
1069
  availableHeight: O
1708
1070
  });
1709
- const M = await r.getDimensions(a.floating);
1710
- return m !== M.width || g !== M.height ? {
1071
+ const R = await r.getDimensions(a.floating);
1072
+ return p !== R.width || g !== R.height ? {
1711
1073
  reset: {
1712
1074
  rects: !0
1713
1075
  }
@@ -1715,49 +1077,49 @@ const Yn = function(e) {
1715
1077
  }
1716
1078
  };
1717
1079
  };
1718
- function Ie() {
1080
+ function He() {
1719
1081
  return typeof window < "u";
1720
1082
  }
1721
1083
  function Te(e) {
1722
- return Wt(e) ? (e.nodeName || "").toLowerCase() : "#document";
1084
+ return Ft(e) ? (e.nodeName || "").toLowerCase() : "#document";
1723
1085
  }
1724
- function _(e) {
1086
+ function j(e) {
1725
1087
  var t;
1726
1088
  return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
1727
1089
  }
1728
1090
  function ne(e) {
1729
1091
  var t;
1730
- return (t = (Wt(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
1092
+ return (t = (Ft(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
1731
1093
  }
1732
- function Wt(e) {
1733
- return Ie() ? e instanceof Node || e instanceof _(e).Node : !1;
1094
+ function Ft(e) {
1095
+ return He() ? e instanceof Node || e instanceof j(e).Node : !1;
1734
1096
  }
1735
- function q(e) {
1736
- return Ie() ? e instanceof Element || e instanceof _(e).Element : !1;
1097
+ function J(e) {
1098
+ return He() ? e instanceof Element || e instanceof j(e).Element : !1;
1737
1099
  }
1738
1100
  function te(e) {
1739
- return Ie() ? e instanceof HTMLElement || e instanceof _(e).HTMLElement : !1;
1101
+ return He() ? e instanceof HTMLElement || e instanceof j(e).HTMLElement : !1;
1740
1102
  }
1741
- function Ct(e) {
1742
- return !Ie() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof _(e).ShadowRoot;
1103
+ function yt(e) {
1104
+ return !He() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof j(e).ShadowRoot;
1743
1105
  }
1744
- const Un = /* @__PURE__ */ new Set(["inline", "contents"]);
1745
- function Le(e) {
1106
+ const Dn = /* @__PURE__ */ new Set(["inline", "contents"]);
1107
+ function Se(e) {
1746
1108
  const {
1747
1109
  overflow: t,
1748
1110
  overflowX: n,
1749
1111
  overflowY: o,
1750
1112
  display: i
1751
- } = G(e);
1752
- return /auto|scroll|overlay|hidden|clip/.test(t + o + n) && !Un.has(i);
1113
+ } = Q(e);
1114
+ return /auto|scroll|overlay|hidden|clip/.test(t + o + n) && !Dn.has(i);
1753
1115
  }
1754
- const Kn = /* @__PURE__ */ new Set(["table", "td", "th"]);
1755
- function qn(e) {
1756
- return Kn.has(Te(e));
1116
+ const Rn = /* @__PURE__ */ new Set(["table", "td", "th"]);
1117
+ function Mn(e) {
1118
+ return Rn.has(Te(e));
1757
1119
  }
1758
- const Gn = [":popover-open", ":modal"];
1759
- function Be(e) {
1760
- return Gn.some((t) => {
1120
+ const Nn = [":popover-open", ":modal"];
1121
+ function Ie(e) {
1122
+ return Nn.some((t) => {
1761
1123
  try {
1762
1124
  return e.matches(t);
1763
1125
  } catch {
@@ -1765,34 +1127,34 @@ function Be(e) {
1765
1127
  }
1766
1128
  });
1767
1129
  }
1768
- const Jn = ["transform", "translate", "scale", "rotate", "perspective"], Qn = ["transform", "translate", "scale", "rotate", "perspective", "filter"], Zn = ["paint", "layout", "strict", "content"];
1769
- function Je(e) {
1770
- const t = Qe(), n = q(e) ? G(e) : e;
1771
- return Jn.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) || Qn.some((o) => (n.willChange || "").includes(o)) || Zn.some((o) => (n.contain || "").includes(o));
1130
+ const kn = ["transform", "translate", "scale", "rotate", "perspective"], Fn = ["transform", "translate", "scale", "rotate", "perspective", "filter"], Hn = ["paint", "layout", "strict", "content"];
1131
+ function Qe(e) {
1132
+ const t = Ze(), n = J(e) ? Q(e) : e;
1133
+ return kn.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) || Fn.some((o) => (n.willChange || "").includes(o)) || Hn.some((o) => (n.contain || "").includes(o));
1772
1134
  }
1773
- function eo(e) {
1135
+ function In(e) {
1774
1136
  let t = ae(e);
1775
1137
  for (; te(t) && !Ce(t); ) {
1776
- if (Je(t))
1138
+ if (Qe(t))
1777
1139
  return t;
1778
- if (Be(t))
1140
+ if (Ie(t))
1779
1141
  return null;
1780
1142
  t = ae(t);
1781
1143
  }
1782
1144
  return null;
1783
1145
  }
1784
- function Qe() {
1146
+ function Ze() {
1785
1147
  return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
1786
1148
  }
1787
- const to = /* @__PURE__ */ new Set(["html", "body", "#document"]);
1149
+ const Bn = /* @__PURE__ */ new Set(["html", "body", "#document"]);
1788
1150
  function Ce(e) {
1789
- return to.has(Te(e));
1151
+ return Bn.has(Te(e));
1790
1152
  }
1791
- function G(e) {
1792
- return _(e).getComputedStyle(e);
1153
+ function Q(e) {
1154
+ return j(e).getComputedStyle(e);
1793
1155
  }
1794
- function We(e) {
1795
- return q(e) ? {
1156
+ function Be(e) {
1157
+ return J(e) ? {
1796
1158
  scrollLeft: e.scrollLeft,
1797
1159
  scrollTop: e.scrollTop
1798
1160
  } : {
@@ -1807,182 +1169,182 @@ function ae(e) {
1807
1169
  // Step into the shadow DOM of the parent of a slotted node.
1808
1170
  e.assignedSlot || // DOM Element detected.
1809
1171
  e.parentNode || // ShadowRoot detected.
1810
- Ct(e) && e.host || // Fallback.
1172
+ yt(e) && e.host || // Fallback.
1811
1173
  ne(e)
1812
1174
  );
1813
- return Ct(t) ? t.host : t;
1175
+ return yt(t) ? t.host : t;
1814
1176
  }
1815
- function $t(e) {
1177
+ function Ht(e) {
1816
1178
  const t = ae(e);
1817
- return Ce(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : te(t) && Le(t) ? t : $t(t);
1179
+ return Ce(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : te(t) && Se(t) ? t : Ht(t);
1818
1180
  }
1819
1181
  function Pe(e, t, n) {
1820
1182
  var o;
1821
1183
  t === void 0 && (t = []), n === void 0 && (n = !0);
1822
- const i = $t(e), l = i === ((o = e.ownerDocument) == null ? void 0 : o.body), r = _(i);
1823
- if (l) {
1184
+ const i = Ht(e), c = i === ((o = e.ownerDocument) == null ? void 0 : o.body), r = j(i);
1185
+ if (c) {
1824
1186
  const a = Ue(r);
1825
- return t.concat(r, r.visualViewport || [], Le(i) ? i : [], a && n ? Pe(a) : []);
1187
+ return t.concat(r, r.visualViewport || [], Se(i) ? i : [], a && n ? Pe(a) : []);
1826
1188
  }
1827
1189
  return t.concat(i, Pe(i, [], n));
1828
1190
  }
1829
1191
  function Ue(e) {
1830
1192
  return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
1831
1193
  }
1832
- function Vt(e) {
1833
- const t = G(e);
1194
+ function It(e) {
1195
+ const t = Q(e);
1834
1196
  let n = parseFloat(t.width) || 0, o = parseFloat(t.height) || 0;
1835
- const i = te(e), l = i ? e.offsetWidth : n, r = i ? e.offsetHeight : o, a = Re(n) !== l || Re(o) !== r;
1836
- return a && (n = l, o = r), {
1197
+ const i = te(e), c = i ? e.offsetWidth : n, r = i ? e.offsetHeight : o, a = Me(n) !== c || Me(o) !== r;
1198
+ return a && (n = c, o = r), {
1837
1199
  width: n,
1838
1200
  height: o,
1839
1201
  $: a
1840
1202
  };
1841
1203
  }
1842
- function Ze(e) {
1843
- return q(e) ? e : e.contextElement;
1204
+ function et(e) {
1205
+ return J(e) ? e : e.contextElement;
1844
1206
  }
1845
1207
  function be(e) {
1846
- const t = Ze(e);
1208
+ const t = et(e);
1847
1209
  if (!te(t))
1848
- return Q(1);
1210
+ return Z(1);
1849
1211
  const n = t.getBoundingClientRect(), {
1850
1212
  width: o,
1851
1213
  height: i,
1852
- $: l
1853
- } = Vt(t);
1854
- let r = (l ? Re(n.width) : n.width) / o, a = (l ? Re(n.height) : n.height) / i;
1214
+ $: c
1215
+ } = It(t);
1216
+ let r = (c ? Me(n.width) : n.width) / o, a = (c ? Me(n.height) : n.height) / i;
1855
1217
  return (!r || !Number.isFinite(r)) && (r = 1), (!a || !Number.isFinite(a)) && (a = 1), {
1856
1218
  x: r,
1857
1219
  y: a
1858
1220
  };
1859
1221
  }
1860
- const no = /* @__PURE__ */ Q(0);
1861
- function Xt(e) {
1862
- const t = _(e);
1863
- return !Qe() || !t.visualViewport ? no : {
1222
+ const Wn = /* @__PURE__ */ Z(0);
1223
+ function Bt(e) {
1224
+ const t = j(e);
1225
+ return !Ze() || !t.visualViewport ? Wn : {
1864
1226
  x: t.visualViewport.offsetLeft,
1865
1227
  y: t.visualViewport.offsetTop
1866
1228
  };
1867
1229
  }
1868
- function oo(e, t, n) {
1869
- return t === void 0 && (t = !1), !n || t && n !== _(e) ? !1 : t;
1230
+ function $n(e, t, n) {
1231
+ return t === void 0 && (t = !1), !n || t && n !== j(e) ? !1 : t;
1870
1232
  }
1871
- function pe(e, t, n, o) {
1233
+ function ve(e, t, n, o) {
1872
1234
  t === void 0 && (t = !1), n === void 0 && (n = !1);
1873
- const i = e.getBoundingClientRect(), l = Ze(e);
1874
- let r = Q(1);
1875
- t && (o ? q(o) && (r = be(o)) : r = be(e));
1876
- const a = oo(l, n, o) ? Xt(l) : Q(0);
1877
- let f = (i.left + a.x) / r.x, c = (i.top + a.y) / r.y, u = i.width / r.x, v = i.height / r.y;
1878
- if (l) {
1879
- const h = _(l), d = o && q(o) ? _(o) : o;
1880
- let m = h, g = Ue(m);
1881
- for (; g && o && d !== m; ) {
1882
- const p = be(g), b = g.getBoundingClientRect(), E = G(g), C = b.left + (g.clientLeft + parseFloat(E.paddingLeft)) * p.x, P = b.top + (g.clientTop + parseFloat(E.paddingTop)) * p.y;
1883
- f *= p.x, c *= p.y, u *= p.x, v *= p.y, f += C, c += P, m = _(g), g = Ue(m);
1235
+ const i = e.getBoundingClientRect(), c = et(e);
1236
+ let r = Z(1);
1237
+ t && (o ? J(o) && (r = be(o)) : r = be(e));
1238
+ const a = $n(c, n, o) ? Bt(c) : Z(0);
1239
+ let d = (i.left + a.x) / r.x, s = (i.top + a.y) / r.y, f = i.width / r.x, u = i.height / r.y;
1240
+ if (c) {
1241
+ const m = j(c), h = o && J(o) ? j(o) : o;
1242
+ let p = m, g = Ue(p);
1243
+ for (; g && o && h !== p; ) {
1244
+ const v = be(g), x = g.getBoundingClientRect(), b = Q(g), E = x.left + (g.clientLeft + parseFloat(b.paddingLeft)) * v.x, P = x.top + (g.clientTop + parseFloat(b.paddingTop)) * v.y;
1245
+ d *= v.x, s *= v.y, f *= v.x, u *= v.y, d += E, s += P, p = j(g), g = Ue(p);
1884
1246
  }
1885
1247
  }
1886
1248
  return Fe({
1887
- width: u,
1888
- height: v,
1889
- x: f,
1890
- y: c
1249
+ width: f,
1250
+ height: u,
1251
+ x: d,
1252
+ y: s
1891
1253
  });
1892
1254
  }
1893
- function $e(e, t) {
1894
- const n = We(e).scrollLeft;
1895
- return t ? t.left + n : pe(ne(e)).left + n;
1255
+ function We(e, t) {
1256
+ const n = Be(e).scrollLeft;
1257
+ return t ? t.left + n : ve(ne(e)).left + n;
1896
1258
  }
1897
- function jt(e, t) {
1898
- const n = e.getBoundingClientRect(), o = n.left + t.scrollLeft - $e(e, n), i = n.top + t.scrollTop;
1259
+ function Wt(e, t) {
1260
+ const n = e.getBoundingClientRect(), o = n.left + t.scrollLeft - We(e, n), i = n.top + t.scrollTop;
1899
1261
  return {
1900
1262
  x: o,
1901
1263
  y: i
1902
1264
  };
1903
1265
  }
1904
- function io(e) {
1266
+ function Vn(e) {
1905
1267
  let {
1906
1268
  elements: t,
1907
1269
  rect: n,
1908
1270
  offsetParent: o,
1909
1271
  strategy: i
1910
1272
  } = e;
1911
- const l = i === "fixed", r = ne(o), a = t ? Be(t.floating) : !1;
1912
- if (o === r || a && l)
1273
+ const c = i === "fixed", r = ne(o), a = t ? Ie(t.floating) : !1;
1274
+ if (o === r || a && c)
1913
1275
  return n;
1914
- let f = {
1276
+ let d = {
1915
1277
  scrollLeft: 0,
1916
1278
  scrollTop: 0
1917
- }, c = Q(1);
1918
- const u = Q(0), v = te(o);
1919
- if ((v || !v && !l) && ((Te(o) !== "body" || Le(r)) && (f = We(o)), te(o))) {
1920
- const d = pe(o);
1921
- c = be(o), u.x = d.x + o.clientLeft, u.y = d.y + o.clientTop;
1279
+ }, s = Z(1);
1280
+ const f = Z(0), u = te(o);
1281
+ if ((u || !u && !c) && ((Te(o) !== "body" || Se(r)) && (d = Be(o)), te(o))) {
1282
+ const h = ve(o);
1283
+ s = be(o), f.x = h.x + o.clientLeft, f.y = h.y + o.clientTop;
1922
1284
  }
1923
- const h = r && !v && !l ? jt(r, f) : Q(0);
1285
+ const m = r && !u && !c ? Wt(r, d) : Z(0);
1924
1286
  return {
1925
- width: n.width * c.x,
1926
- height: n.height * c.y,
1927
- x: n.x * c.x - f.scrollLeft * c.x + u.x + h.x,
1928
- y: n.y * c.y - f.scrollTop * c.y + u.y + h.y
1287
+ width: n.width * s.x,
1288
+ height: n.height * s.y,
1289
+ x: n.x * s.x - d.scrollLeft * s.x + f.x + m.x,
1290
+ y: n.y * s.y - d.scrollTop * s.y + f.y + m.y
1929
1291
  };
1930
1292
  }
1931
- function ro(e) {
1293
+ function _n(e) {
1932
1294
  return Array.from(e.getClientRects());
1933
1295
  }
1934
- function so(e) {
1935
- const t = ne(e), n = We(e), o = e.ownerDocument.body, i = Y(t.scrollWidth, t.clientWidth, o.scrollWidth, o.clientWidth), l = Y(t.scrollHeight, t.clientHeight, o.scrollHeight, o.clientHeight);
1936
- let r = -n.scrollLeft + $e(e);
1296
+ function Xn(e) {
1297
+ const t = ne(e), n = Be(e), o = e.ownerDocument.body, i = Y(t.scrollWidth, t.clientWidth, o.scrollWidth, o.clientWidth), c = Y(t.scrollHeight, t.clientHeight, o.scrollHeight, o.clientHeight);
1298
+ let r = -n.scrollLeft + We(e);
1937
1299
  const a = -n.scrollTop;
1938
- return G(o).direction === "rtl" && (r += Y(t.clientWidth, o.clientWidth) - i), {
1300
+ return Q(o).direction === "rtl" && (r += Y(t.clientWidth, o.clientWidth) - i), {
1939
1301
  width: i,
1940
- height: l,
1302
+ height: c,
1941
1303
  x: r,
1942
1304
  y: a
1943
1305
  };
1944
1306
  }
1945
- const Tt = 25;
1946
- function lo(e, t) {
1947
- const n = _(e), o = ne(e), i = n.visualViewport;
1948
- let l = o.clientWidth, r = o.clientHeight, a = 0, f = 0;
1307
+ const bt = 25;
1308
+ function Yn(e, t) {
1309
+ const n = j(e), o = ne(e), i = n.visualViewport;
1310
+ let c = o.clientWidth, r = o.clientHeight, a = 0, d = 0;
1949
1311
  if (i) {
1950
- l = i.width, r = i.height;
1951
- const u = Qe();
1952
- (!u || u && t === "fixed") && (a = i.offsetLeft, f = i.offsetTop);
1953
- }
1954
- const c = $e(o);
1955
- if (c <= 0) {
1956
- const u = o.ownerDocument, v = u.body, h = getComputedStyle(v), d = u.compatMode === "CSS1Compat" && parseFloat(h.marginLeft) + parseFloat(h.marginRight) || 0, m = Math.abs(o.clientWidth - v.clientWidth - d);
1957
- m <= Tt && (l -= m);
1958
- } else c <= Tt && (l += c);
1312
+ c = i.width, r = i.height;
1313
+ const f = Ze();
1314
+ (!f || f && t === "fixed") && (a = i.offsetLeft, d = i.offsetTop);
1315
+ }
1316
+ const s = We(o);
1317
+ if (s <= 0) {
1318
+ const f = o.ownerDocument, u = f.body, m = getComputedStyle(u), h = f.compatMode === "CSS1Compat" && parseFloat(m.marginLeft) + parseFloat(m.marginRight) || 0, p = Math.abs(o.clientWidth - u.clientWidth - h);
1319
+ p <= bt && (c -= p);
1320
+ } else s <= bt && (c += s);
1959
1321
  return {
1960
- width: l,
1322
+ width: c,
1961
1323
  height: r,
1962
1324
  x: a,
1963
- y: f
1325
+ y: d
1964
1326
  };
1965
1327
  }
1966
- const ao = /* @__PURE__ */ new Set(["absolute", "fixed"]);
1967
- function co(e, t) {
1968
- const n = pe(e, !0, t === "fixed"), o = n.top + e.clientTop, i = n.left + e.clientLeft, l = te(e) ? be(e) : Q(1), r = e.clientWidth * l.x, a = e.clientHeight * l.y, f = i * l.x, c = o * l.y;
1328
+ const jn = /* @__PURE__ */ new Set(["absolute", "fixed"]);
1329
+ function zn(e, t) {
1330
+ const n = ve(e, !0, t === "fixed"), o = n.top + e.clientTop, i = n.left + e.clientLeft, c = te(e) ? be(e) : Z(1), r = e.clientWidth * c.x, a = e.clientHeight * c.y, d = i * c.x, s = o * c.y;
1969
1331
  return {
1970
1332
  width: r,
1971
1333
  height: a,
1972
- x: f,
1973
- y: c
1334
+ x: d,
1335
+ y: s
1974
1336
  };
1975
1337
  }
1976
- function Ot(e, t, n) {
1338
+ function xt(e, t, n) {
1977
1339
  let o;
1978
1340
  if (t === "viewport")
1979
- o = lo(e, n);
1341
+ o = Yn(e, n);
1980
1342
  else if (t === "document")
1981
- o = so(ne(e));
1982
- else if (q(t))
1983
- o = co(t, n);
1343
+ o = Xn(ne(e));
1344
+ else if (J(t))
1345
+ o = zn(t, n);
1984
1346
  else {
1985
- const i = Xt(e);
1347
+ const i = Bt(e);
1986
1348
  o = {
1987
1349
  x: t.x - i.x,
1988
1350
  y: t.y - i.y,
@@ -1992,108 +1354,108 @@ function Ot(e, t, n) {
1992
1354
  }
1993
1355
  return Fe(o);
1994
1356
  }
1995
- function Yt(e, t) {
1357
+ function $t(e, t) {
1996
1358
  const n = ae(e);
1997
- return n === t || !q(n) || Ce(n) ? !1 : G(n).position === "fixed" || Yt(n, t);
1359
+ return n === t || !J(n) || Ce(n) ? !1 : Q(n).position === "fixed" || $t(n, t);
1998
1360
  }
1999
- function uo(e, t) {
1361
+ function Un(e, t) {
2000
1362
  const n = t.get(e);
2001
1363
  if (n)
2002
1364
  return n;
2003
- let o = Pe(e, [], !1).filter((a) => q(a) && Te(a) !== "body"), i = null;
2004
- const l = G(e).position === "fixed";
2005
- let r = l ? ae(e) : e;
2006
- for (; q(r) && !Ce(r); ) {
2007
- const a = G(r), f = Je(r);
2008
- !f && a.position === "fixed" && (i = null), (l ? !f && !i : !f && a.position === "static" && !!i && ao.has(i.position) || Le(r) && !f && Yt(e, r)) ? o = o.filter((u) => u !== r) : i = a, r = ae(r);
1365
+ let o = Pe(e, [], !1).filter((a) => J(a) && Te(a) !== "body"), i = null;
1366
+ const c = Q(e).position === "fixed";
1367
+ let r = c ? ae(e) : e;
1368
+ for (; J(r) && !Ce(r); ) {
1369
+ const a = Q(r), d = Qe(r);
1370
+ !d && a.position === "fixed" && (i = null), (c ? !d && !i : !d && a.position === "static" && !!i && jn.has(i.position) || Se(r) && !d && $t(e, r)) ? o = o.filter((f) => f !== r) : i = a, r = ae(r);
2009
1371
  }
2010
1372
  return t.set(e, o), o;
2011
1373
  }
2012
- function fo(e) {
1374
+ function Kn(e) {
2013
1375
  let {
2014
1376
  element: t,
2015
1377
  boundary: n,
2016
1378
  rootBoundary: o,
2017
1379
  strategy: i
2018
1380
  } = e;
2019
- const r = [...n === "clippingAncestors" ? Be(t) ? [] : uo(t, this._c) : [].concat(n), o], a = r[0], f = r.reduce((c, u) => {
2020
- const v = Ot(t, u, i);
2021
- return c.top = Y(v.top, c.top), c.right = le(v.right, c.right), c.bottom = le(v.bottom, c.bottom), c.left = Y(v.left, c.left), c;
2022
- }, Ot(t, a, i));
1381
+ const r = [...n === "clippingAncestors" ? Ie(t) ? [] : Un(t, this._c) : [].concat(n), o], a = r[0], d = r.reduce((s, f) => {
1382
+ const u = xt(t, f, i);
1383
+ return s.top = Y(u.top, s.top), s.right = le(u.right, s.right), s.bottom = le(u.bottom, s.bottom), s.left = Y(u.left, s.left), s;
1384
+ }, xt(t, a, i));
2023
1385
  return {
2024
- width: f.right - f.left,
2025
- height: f.bottom - f.top,
2026
- x: f.left,
2027
- y: f.top
1386
+ width: d.right - d.left,
1387
+ height: d.bottom - d.top,
1388
+ x: d.left,
1389
+ y: d.top
2028
1390
  };
2029
1391
  }
2030
- function ho(e) {
1392
+ function qn(e) {
2031
1393
  const {
2032
1394
  width: t,
2033
1395
  height: n
2034
- } = Vt(e);
1396
+ } = It(e);
2035
1397
  return {
2036
1398
  width: t,
2037
1399
  height: n
2038
1400
  };
2039
1401
  }
2040
- function mo(e, t, n) {
2041
- const o = te(t), i = ne(t), l = n === "fixed", r = pe(e, !0, l, t);
1402
+ function Gn(e, t, n) {
1403
+ const o = te(t), i = ne(t), c = n === "fixed", r = ve(e, !0, c, t);
2042
1404
  let a = {
2043
1405
  scrollLeft: 0,
2044
1406
  scrollTop: 0
2045
1407
  };
2046
- const f = Q(0);
2047
- function c() {
2048
- f.x = $e(i);
2049
- }
2050
- if (o || !o && !l)
2051
- if ((Te(t) !== "body" || Le(i)) && (a = We(t)), o) {
2052
- const d = pe(t, !0, l, t);
2053
- f.x = d.x + t.clientLeft, f.y = d.y + t.clientTop;
2054
- } else i && c();
2055
- l && !o && i && c();
2056
- const u = i && !o && !l ? jt(i, a) : Q(0), v = r.left + a.scrollLeft - f.x - u.x, h = r.top + a.scrollTop - f.y - u.y;
1408
+ const d = Z(0);
1409
+ function s() {
1410
+ d.x = We(i);
1411
+ }
1412
+ if (o || !o && !c)
1413
+ if ((Te(t) !== "body" || Se(i)) && (a = Be(t)), o) {
1414
+ const h = ve(t, !0, c, t);
1415
+ d.x = h.x + t.clientLeft, d.y = h.y + t.clientTop;
1416
+ } else i && s();
1417
+ c && !o && i && s();
1418
+ const f = i && !o && !c ? Wt(i, a) : Z(0), u = r.left + a.scrollLeft - d.x - f.x, m = r.top + a.scrollTop - d.y - f.y;
2057
1419
  return {
2058
- x: v,
2059
- y: h,
1420
+ x: u,
1421
+ y: m,
2060
1422
  width: r.width,
2061
1423
  height: r.height
2062
1424
  };
2063
1425
  }
2064
- function je(e) {
2065
- return G(e).position === "static";
1426
+ function Ve(e) {
1427
+ return Q(e).position === "static";
2066
1428
  }
2067
- function Pt(e, t) {
2068
- if (!te(e) || G(e).position === "fixed")
1429
+ function Et(e, t) {
1430
+ if (!te(e) || Q(e).position === "fixed")
2069
1431
  return null;
2070
1432
  if (t)
2071
1433
  return t(e);
2072
1434
  let n = e.offsetParent;
2073
1435
  return ne(e) === n && (n = n.ownerDocument.body), n;
2074
1436
  }
2075
- function _t(e, t) {
2076
- const n = _(e);
2077
- if (Be(e))
1437
+ function Vt(e, t) {
1438
+ const n = j(e);
1439
+ if (Ie(e))
2078
1440
  return n;
2079
1441
  if (!te(e)) {
2080
1442
  let i = ae(e);
2081
1443
  for (; i && !Ce(i); ) {
2082
- if (q(i) && !je(i))
1444
+ if (J(i) && !Ve(i))
2083
1445
  return i;
2084
1446
  i = ae(i);
2085
1447
  }
2086
1448
  return n;
2087
1449
  }
2088
- let o = Pt(e, t);
2089
- for (; o && qn(o) && je(o); )
2090
- o = Pt(o, t);
2091
- return o && Ce(o) && je(o) && !Je(o) ? n : o || eo(e) || n;
1450
+ let o = Et(e, t);
1451
+ for (; o && Mn(o) && Ve(o); )
1452
+ o = Et(o, t);
1453
+ return o && Ce(o) && Ve(o) && !Qe(o) ? n : o || In(e) || n;
2092
1454
  }
2093
- const vo = async function(e) {
2094
- const t = this.getOffsetParent || _t, n = this.getDimensions, o = await n(e.floating);
1455
+ const Jn = async function(e) {
1456
+ const t = this.getOffsetParent || Vt, n = this.getDimensions, o = await n(e.floating);
2095
1457
  return {
2096
- reference: mo(e.reference, await t(e.floating), e.strategy),
1458
+ reference: Gn(e.reference, await t(e.floating), e.strategy),
2097
1459
  floating: {
2098
1460
  x: 0,
2099
1461
  y: 0,
@@ -2102,506 +1464,1256 @@ const vo = async function(e) {
2102
1464
  }
2103
1465
  };
2104
1466
  };
2105
- function po(e) {
2106
- return G(e).direction === "rtl";
1467
+ function Qn(e) {
1468
+ return Q(e).direction === "rtl";
2107
1469
  }
2108
- const go = {
2109
- convertOffsetParentRelativeRectToViewportRelativeRect: io,
1470
+ const Zn = {
1471
+ convertOffsetParentRelativeRectToViewportRelativeRect: Vn,
2110
1472
  getDocumentElement: ne,
2111
- getClippingRect: fo,
2112
- getOffsetParent: _t,
2113
- getElementRects: vo,
2114
- getClientRects: ro,
2115
- getDimensions: ho,
1473
+ getClippingRect: Kn,
1474
+ getOffsetParent: Vt,
1475
+ getElementRects: Jn,
1476
+ getClientRects: _n,
1477
+ getDimensions: qn,
2116
1478
  getScale: be,
2117
- isElement: q,
2118
- isRTL: po
1479
+ isElement: J,
1480
+ isRTL: Qn
2119
1481
  };
2120
- function zt(e, t) {
1482
+ function _t(e, t) {
2121
1483
  return e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height;
2122
1484
  }
2123
- function wo(e, t) {
1485
+ function eo(e, t) {
2124
1486
  let n = null, o;
2125
1487
  const i = ne(e);
2126
- function l() {
1488
+ function c() {
2127
1489
  var a;
2128
1490
  clearTimeout(o), (a = n) == null || a.disconnect(), n = null;
2129
1491
  }
2130
- function r(a, f) {
2131
- a === void 0 && (a = !1), f === void 0 && (f = 1), l();
2132
- const c = e.getBoundingClientRect(), {
2133
- left: u,
2134
- top: v,
2135
- width: h,
2136
- height: d
2137
- } = c;
2138
- if (a || t(), !h || !d)
1492
+ function r(a, d) {
1493
+ a === void 0 && (a = !1), d === void 0 && (d = 1), c();
1494
+ const s = e.getBoundingClientRect(), {
1495
+ left: f,
1496
+ top: u,
1497
+ width: m,
1498
+ height: h
1499
+ } = s;
1500
+ if (a || t(), !m || !h)
2139
1501
  return;
2140
- const m = Me(v), g = Me(i.clientWidth - (u + h)), p = Me(i.clientHeight - (v + d)), b = Me(u), C = {
2141
- rootMargin: -m + "px " + -g + "px " + -p + "px " + -b + "px",
2142
- threshold: Y(0, le(1, f)) || 1
1502
+ const p = Re(u), g = Re(i.clientWidth - (f + m)), v = Re(i.clientHeight - (u + h)), x = Re(f), E = {
1503
+ rootMargin: -p + "px " + -g + "px " + -v + "px " + -x + "px",
1504
+ threshold: Y(0, le(1, d)) || 1
2143
1505
  };
2144
1506
  let P = !0;
2145
- function w(x) {
2146
- const O = x[0].intersectionRatio;
2147
- if (O !== f) {
1507
+ function S(y) {
1508
+ const O = y[0].intersectionRatio;
1509
+ if (O !== d) {
2148
1510
  if (!P)
2149
1511
  return r();
2150
1512
  O ? r(!1, O) : o = setTimeout(() => {
2151
1513
  r(!1, 1e-7);
2152
1514
  }, 1e3);
2153
1515
  }
2154
- O === 1 && !zt(c, e.getBoundingClientRect()) && r(), P = !1;
1516
+ O === 1 && !_t(s, e.getBoundingClientRect()) && r(), P = !1;
2155
1517
  }
2156
1518
  try {
2157
- n = new IntersectionObserver(w, {
2158
- ...C,
1519
+ n = new IntersectionObserver(S, {
1520
+ ...E,
2159
1521
  // Handle <iframe>s
2160
1522
  root: i.ownerDocument
2161
1523
  });
2162
1524
  } catch {
2163
- n = new IntersectionObserver(w, C);
1525
+ n = new IntersectionObserver(S, E);
2164
1526
  }
2165
1527
  n.observe(e);
2166
1528
  }
2167
- return r(!0), l;
1529
+ return r(!0), c;
2168
1530
  }
2169
- function yo(e, t, n, o) {
1531
+ function to(e, t, n, o) {
2170
1532
  o === void 0 && (o = {});
2171
1533
  const {
2172
1534
  ancestorScroll: i = !0,
2173
- ancestorResize: l = !0,
1535
+ ancestorResize: c = !0,
2174
1536
  elementResize: r = typeof ResizeObserver == "function",
2175
1537
  layoutShift: a = typeof IntersectionObserver == "function",
2176
- animationFrame: f = !1
2177
- } = o, c = Ze(e), u = i || l ? [...c ? Pe(c) : [], ...Pe(t)] : [];
2178
- u.forEach((b) => {
2179
- i && b.addEventListener("scroll", n, {
1538
+ animationFrame: d = !1
1539
+ } = o, s = et(e), f = i || c ? [...s ? Pe(s) : [], ...Pe(t)] : [];
1540
+ f.forEach((x) => {
1541
+ i && x.addEventListener("scroll", n, {
2180
1542
  passive: !0
2181
- }), l && b.addEventListener("resize", n);
1543
+ }), c && x.addEventListener("resize", n);
2182
1544
  });
2183
- const v = c && a ? wo(c, n) : null;
2184
- let h = -1, d = null;
2185
- r && (d = new ResizeObserver((b) => {
2186
- let [E] = b;
2187
- E && E.target === c && d && (d.unobserve(t), cancelAnimationFrame(h), h = requestAnimationFrame(() => {
2188
- var C;
2189
- (C = d) == null || C.observe(t);
1545
+ const u = s && a ? eo(s, n) : null;
1546
+ let m = -1, h = null;
1547
+ r && (h = new ResizeObserver((x) => {
1548
+ let [b] = x;
1549
+ b && b.target === s && h && (h.unobserve(t), cancelAnimationFrame(m), m = requestAnimationFrame(() => {
1550
+ var E;
1551
+ (E = h) == null || E.observe(t);
2190
1552
  })), n();
2191
- }), c && !f && d.observe(c), d.observe(t));
2192
- let m, g = f ? pe(e) : null;
2193
- f && p();
2194
- function p() {
2195
- const b = pe(e);
2196
- g && !zt(g, b) && n(), g = b, m = requestAnimationFrame(p);
1553
+ }), s && !d && h.observe(s), h.observe(t));
1554
+ let p, g = d ? ve(e) : null;
1555
+ d && v();
1556
+ function v() {
1557
+ const x = ve(e);
1558
+ g && !_t(g, x) && n(), g = x, p = requestAnimationFrame(v);
2197
1559
  }
2198
1560
  return n(), () => {
2199
- var b;
2200
- u.forEach((E) => {
2201
- i && E.removeEventListener("scroll", n), l && E.removeEventListener("resize", n);
2202
- }), v == null || v(), (b = d) == null || b.disconnect(), d = null, f && cancelAnimationFrame(m);
1561
+ var x;
1562
+ f.forEach((b) => {
1563
+ i && b.removeEventListener("scroll", n), c && b.removeEventListener("resize", n);
1564
+ }), u == null || u(), (x = h) == null || x.disconnect(), h = null, d && cancelAnimationFrame(p);
2203
1565
  };
2204
1566
  }
2205
- const Ro = Yn, No = Wn, ko = _n, Fo = $n, Ho = zn, Io = Vn, bo = In, xo = (e, t, n) => {
1567
+ const Ao = Sn, Do = En, Ro = Ln, Mo = Cn, No = An, ko = Tn, no = bn, oo = (e, t, n) => {
2206
1568
  const o = /* @__PURE__ */ new Map(), i = {
2207
- platform: go,
1569
+ platform: Zn,
2208
1570
  ...n
2209
- }, l = {
1571
+ }, c = {
2210
1572
  ...i.platform,
2211
1573
  _c: o
2212
1574
  };
2213
- return Hn(e, t, {
1575
+ return yn(e, t, {
2214
1576
  ...i,
2215
- platform: l
1577
+ platform: c
2216
1578
  });
2217
1579
  };
2218
- function Bo(e, t, n = {}) {
2219
- const { offset: o = "-4px" } = n, { middlewareData: i, placement: l, refs: r } = t;
2220
- se(e, (u) => {
2221
- r.arrowEl.value = u;
2222
- });
2223
- const a = N(() => {
2224
- var u;
2225
- return ((u = i.value.arrow) == null ? void 0 : u.x) ?? 0;
2226
- }), f = N(() => {
2227
- var u;
2228
- return ((u = i.value.arrow) == null ? void 0 : u.y) ?? 0;
2229
- }), c = N(() => {
2230
- if (!(e.value || r.arrowEl.value) || !i.value.arrow)
2231
- return {};
2232
- const v = D(l).split("-")[0], h = a.value, d = f.value;
2233
- return v === "bottom" ? {
2234
- "inset-inline-start": `${h}px`,
2235
- "inset-block-start": o
2236
- } : v === "top" ? {
2237
- "inset-inline-start": `${h}px`,
2238
- "inset-block-end": o
2239
- } : v === "right" ? {
2240
- "inset-block-start": `${d}px`,
2241
- "inset-inline-start": o
2242
- } : v === "left" ? {
2243
- "inset-block-start": `${d}px`,
2244
- "inset-inline-end": o
2245
- } : {};
2246
- });
2247
- return {
2248
- arrowX: a,
2249
- arrowY: f,
2250
- arrowStyles: c
2251
- };
2252
- }
2253
- function Eo(e) {
1580
+ function io(e) {
2254
1581
  return {
2255
1582
  name: "arrow",
2256
1583
  options: e,
2257
1584
  fn(t) {
2258
1585
  const n = D(e.element);
2259
- return n == null ? {} : bo({ element: n, padding: e.padding }).fn(t);
1586
+ return n == null ? {} : no({ element: n, padding: e.padding }).fn(t);
2260
1587
  }
2261
1588
  };
2262
1589
  }
2263
- function Lt(e, t, n = {}) {
1590
+ function ro(e, t, n = {}) {
2264
1591
  const {
2265
1592
  transform: o = !0,
2266
1593
  middlewares: i,
2267
- autoUpdate: l = !0,
2268
- open: r = U(!1)
2269
- } = n, a = (w) => {
2270
- r.value = w;
2271
- }, f = N(() => D(n.placement) ?? "bottom"), c = N(() => D(n.strategy) ?? "absolute"), u = U(0), v = U(0), h = U(f.value), d = U(c.value), m = Ye({}), g = U(!1), p = U(null), b = N(() => {
2272
- const w = D(i) || [];
2273
- return p.value && !w.some((O) => O.name === "arrow") ? [...w, Eo({ element: p })] : w;
1594
+ autoUpdate: c = !0,
1595
+ open: r = U(!1),
1596
+ onOpenChange: a
1597
+ } = n, d = (y, O, M) => {
1598
+ if (r.value === y) return;
1599
+ r.value = y;
1600
+ const R = O ?? "programmatic";
1601
+ a == null || a(y, R, M);
1602
+ }, s = N(() => D(n.placement) ?? "bottom"), f = N(() => D(n.strategy) ?? "absolute"), u = U(0), m = U(0), h = U(s.value), p = U(f.value), g = Xe({}), v = U(!1), x = U(null), b = N(() => {
1603
+ const y = D(i) || [];
1604
+ return x.value && !y.some((M) => M.name === "arrow") ? [...y, io({ element: x })] : y;
2274
1605
  }), E = async () => {
2275
- if (!e.value || !t.value) return;
2276
- const w = await xo(e.value, t.value, {
2277
- placement: f.value,
2278
- strategy: c.value,
2279
- middleware: b.value
2280
- });
2281
- u.value = w.x, v.value = w.y, h.value = w.placement, d.value = w.strategy, m.value = w.middlewareData, g.value = r.value;
1606
+ if (!(!e.value || !t.value))
1607
+ try {
1608
+ const y = await oo(e.value, t.value, {
1609
+ placement: s.value,
1610
+ strategy: f.value,
1611
+ middleware: b.value
1612
+ });
1613
+ u.value = y.x, m.value = y.y, h.value = y.placement, p.value = y.strategy, g.value = y.middlewareData, v.value = r.value;
1614
+ } catch {
1615
+ }
2282
1616
  };
2283
- se([f, c, b], () => {
1617
+ se([s, f, b], () => {
2284
1618
  r.value && E();
2285
1619
  });
2286
- let C;
1620
+ let P;
2287
1621
  se(
2288
1622
  [e, t, r],
2289
- ([w, x, O]) => {
2290
- !O || !w || !x || (l && (C = yo(
2291
- w,
2292
- x,
1623
+ ([y, O, M]) => {
1624
+ !M || !y || !O || (c && (P = to(
1625
+ y,
1626
+ O,
2293
1627
  E,
2294
- typeof l == "object" ? l : void 0
2295
- )), ve(() => {
2296
- C == null || C(), C = void 0;
1628
+ typeof c == "object" ? c : void 0
1629
+ )), pe(() => {
1630
+ P == null || P(), P = void 0;
2297
1631
  }));
2298
1632
  },
2299
1633
  { immediate: !0 }
2300
- ), xe(() => C == null ? void 0 : C()), se(r, (w) => {
2301
- w || (g.value = !1);
1634
+ ), xe(() => P == null ? void 0 : P()), se(r, (y) => {
1635
+ y || (v.value = !1);
2302
1636
  });
2303
- const P = U({
2304
- position: c.value,
1637
+ const S = U({
1638
+ position: f.value,
2305
1639
  left: "0",
2306
1640
  top: "0"
2307
1641
  });
2308
1642
  return se(
2309
- [u, v, () => D(o)],
2310
- ([w, x, O]) => {
1643
+ [u, m, () => D(o)],
1644
+ ([y, O, M]) => {
2311
1645
  const R = t.value;
2312
1646
  if (!R) return;
2313
- const M = {
2314
- position: d.value,
1647
+ const A = {
1648
+ position: p.value,
2315
1649
  left: "0",
2316
1650
  top: "0"
2317
- }, A = St(R, w), k = St(R, x);
2318
- O ? P.value = {
2319
- ...M,
2320
- transform: `translate(${A}px, ${k}px)`,
2321
- ...Ut(R) >= 1.5 && {
1651
+ }, k = Ct(R, y), F = Ct(R, O);
1652
+ M ? S.value = {
1653
+ ...A,
1654
+ transform: `translate(${k}px, ${F}px)`,
1655
+ ...Xt(R) >= 1.5 && {
2322
1656
  "will-change": "transform"
2323
1657
  }
2324
- } : P.value = {
2325
- ...M,
2326
- left: `${A}px`,
2327
- top: `${k}px`
1658
+ } : S.value = {
1659
+ ...A,
1660
+ left: `${k}px`,
1661
+ top: `${F}px`
2328
1662
  };
2329
1663
  },
2330
1664
  { immediate: !0 }
2331
1665
  ), {
1666
+ id: n.id,
2332
1667
  x: u,
2333
- y: v,
2334
- strategy: d,
1668
+ y: m,
1669
+ strategy: p,
2335
1670
  placement: h,
2336
- middlewareData: m,
2337
- isPositioned: g,
2338
- floatingStyles: P,
1671
+ middlewareData: g,
1672
+ isPositioned: v,
1673
+ floatingStyles: S,
2339
1674
  update: E,
2340
1675
  refs: {
2341
1676
  anchorEl: e,
2342
1677
  floatingEl: t,
2343
- arrowEl: p
1678
+ arrowEl: x
2344
1679
  },
2345
1680
  open: r,
2346
- setOpen: a
1681
+ setOpen: d
2347
1682
  };
2348
1683
  }
2349
- function St(e, t) {
2350
- const n = Ut(e);
1684
+ function Ct(e, t) {
1685
+ const n = Xt(e);
2351
1686
  return Math.round(t * n) / n;
2352
1687
  }
2353
- function Ut(e) {
1688
+ function Xt(e) {
2354
1689
  return typeof window > "u" ? 1 : (e.ownerDocument.defaultView || window).devicePixelRatio || 1;
2355
1690
  }
2356
- function Wo(e, t, n = {}, o = {}) {
2357
- const { ...i } = n, l = Lt(e, t, i), r = Co(l, o);
2358
- return {
2359
- ...r,
2360
- addNode: (v, h, d = {}) => {
2361
- const { parentId: m, ...g } = d, p = Lt(v, h, g);
2362
- return r.addNode(p, m);
1691
+ function Fo(e = {}) {
1692
+ let t;
1693
+ return t = so(e), {
1694
+ ...t,
1695
+ get root() {
1696
+ return t.root;
1697
+ },
1698
+ addNode: (r, a, d = {}) => {
1699
+ const { parentId: s, ...f } = d, u = St(), m = f.onOpenChange, h = ro(r, a, {
1700
+ ...f,
1701
+ id: u,
1702
+ onOpenChange: (g, v, x) => {
1703
+ if (m == null || m(g, v, x), !g) {
1704
+ const b = t.findNodeById(u);
1705
+ if (b) {
1706
+ const E = b.children.value;
1707
+ for (const P of E)
1708
+ P.data.open.value && P.data.setOpen(!1, "tree-ancestor-close", x);
1709
+ }
1710
+ }
1711
+ }
1712
+ });
1713
+ return t.addNode(h, s, { id: u });
2363
1714
  },
2364
1715
  getAllOpenNodes: () => {
2365
- const v = [];
2366
- for (const h of r.nodeMap.values())
2367
- h.data.open.value && v.push(h);
2368
- return v;
1716
+ const r = [];
1717
+ for (const a of t.nodeMap.values())
1718
+ a.data.open.value && r.push(a);
1719
+ return r;
2369
1720
  },
2370
- getTopmostOpenNode: () => {
2371
- let v = null, h = -1;
2372
- for (const d of r.nodeMap.values())
1721
+ getDeepestOpenNode: () => {
1722
+ let r = null, a = -1;
1723
+ for (const d of t.nodeMap.values())
2373
1724
  if (d.data.open.value) {
2374
- const m = d.getPath().length;
2375
- m > h && (h = m, v = d);
1725
+ const s = d.getPath().length;
1726
+ s > a && (a = s, r = d);
2376
1727
  }
2377
- return v;
1728
+ return r;
2378
1729
  },
2379
- applyToNodes: (v, h, d = {}) => {
2380
- const { relationship: m = "self-and-children", applyToMatching: g = !0 } = d, p = r.findNodeById(v);
2381
- if (!p)
1730
+ applyToNodes: (r, a, d = {}) => {
1731
+ const { relationship: s = "self-and-children", applyToMatching: f = !0 } = d, u = t.findNodeById(r);
1732
+ if (!u)
2382
1733
  return;
2383
- const b = [], E = /* @__PURE__ */ new Set(), C = (w) => {
2384
- w && !E.has(w.id) && (b.push(w), E.add(w.id));
2385
- }, P = (w) => {
2386
- for (const x of w)
2387
- C(x);
1734
+ const m = [], h = /* @__PURE__ */ new Set(), p = (v) => {
1735
+ v && !h.has(v.id) && (m.push(v), h.add(v.id));
1736
+ }, g = (v) => {
1737
+ for (const x of v)
1738
+ p(x);
2388
1739
  };
2389
- if (m === "ancestors-only")
2390
- for (const w of p.getPath())
2391
- w.id !== p.id && C(w);
2392
- else if (m === "siblings-only") {
2393
- if (p.parent.value)
2394
- for (const w of p.parent.value.children.value)
2395
- w.id !== p.id && C(w);
2396
- } else if (m === "descendants-only")
2397
- for (const w of r.traverse("dfs", p))
2398
- w.id !== p.id && C(w);
2399
- else if (m === "children-only")
2400
- P(p.children.value);
2401
- else if (m === "self-and-ancestors")
2402
- P(p.getPath());
2403
- else if (m === "self-and-children")
2404
- C(p), P(p.children.value);
2405
- else if (m === "self-and-descendants")
2406
- P(r.traverse("dfs", p));
2407
- else if (m === "self-and-siblings")
2408
- C(p), p.parent.value && P(p.parent.value.children.value);
2409
- else if (m === "self-ancestors-and-children")
2410
- P(p.getPath()), P(p.children.value);
2411
- else if (m === "full-branch")
2412
- P(p.getPath()), P(r.traverse("dfs", p));
2413
- else if (m === "all-except-branch") {
2414
- const w = /* @__PURE__ */ new Set();
2415
- for (const x of p.getPath())
2416
- w.add(x.id);
2417
- for (const x of r.traverse("dfs", p))
2418
- w.add(x.id);
2419
- for (const x of r.nodeMap.values())
2420
- !w.has(x.id) === g && h(x);
1740
+ if (s === "ancestors-only")
1741
+ for (const v of u.getPath())
1742
+ v.id !== u.id && p(v);
1743
+ else if (s === "siblings-only") {
1744
+ if (u.parent.value)
1745
+ for (const v of u.parent.value.children.value)
1746
+ v.id !== u.id && p(v);
1747
+ } else if (s === "descendants-only")
1748
+ for (const v of t.traverse("dfs", u))
1749
+ v.id !== u.id && p(v);
1750
+ else if (s === "children-only")
1751
+ g(u.children.value);
1752
+ else if (s === "self-and-ancestors")
1753
+ g(u.getPath());
1754
+ else if (s === "self-and-children")
1755
+ p(u), g(u.children.value);
1756
+ else if (s === "self-and-descendants")
1757
+ g(t.traverse("dfs", u));
1758
+ else if (s === "self-and-siblings")
1759
+ p(u), u.parent.value && g(u.parent.value.children.value);
1760
+ else if (s === "self-ancestors-and-children")
1761
+ g(u.getPath()), g(u.children.value);
1762
+ else if (s === "full-branch")
1763
+ g(u.getPath()), g(t.traverse("dfs", u));
1764
+ else if (s === "all-except-branch") {
1765
+ const v = /* @__PURE__ */ new Set();
1766
+ for (const x of u.getPath())
1767
+ v.add(x.id);
1768
+ for (const x of t.traverse("dfs", u))
1769
+ v.add(x.id);
1770
+ for (const x of t.nodeMap.values())
1771
+ !v.has(x.id) === f && a(x);
2421
1772
  return;
2422
1773
  } else {
2423
- console.warn(`applyToNodes: Unknown relationship "${m}".`);
1774
+ console.warn(`applyToNodes: Unknown relationship "${s}".`);
2424
1775
  return;
2425
1776
  }
2426
- if (g)
2427
- for (const w of b)
2428
- h(w);
1777
+ if (f)
1778
+ for (const v of m)
1779
+ a(v);
2429
1780
  else
2430
- for (const w of r.nodeMap.values())
2431
- E.has(w.id) || h(w);
1781
+ for (const v of t.nodeMap.values())
1782
+ h.has(v.id) || a(v);
2432
1783
  }
2433
1784
  };
2434
1785
  }
2435
- function At(e, t = null, n = {}, o = !1) {
2436
- const i = n.id ?? En(), l = Ye(t), r = Ye([]), a = N(() => r.value.length === 0), f = {
1786
+ function Tt(e, t = null, n = {}, o = !1) {
1787
+ const i = n.id ?? St(), c = Xe(t), r = Xe([]), a = N(() => r.value.length === 0), d = {
2437
1788
  id: i,
2438
1789
  data: e,
2439
- parent: l,
1790
+ parent: c,
2440
1791
  children: r,
2441
1792
  isRoot: o,
2442
1793
  isLeaf: a,
2443
- addChild: (c) => {
2444
- r.value = [...r.value, c];
1794
+ addChild: (s) => {
1795
+ r.value = [...r.value, s];
2445
1796
  },
2446
- _removeChildInstance: (c) => r.value.includes(c) ? (r.value = r.value.filter((u) => u.id !== c.id), c.parent.value = null, !0) : !1,
2447
- findChild: (c) => r.value.find(c) ?? null,
2448
- findDescendant: (c) => {
2449
- const u = [f];
2450
- for (; u.length > 0; ) {
2451
- const v = u.pop();
2452
- if (c(v))
2453
- return v;
2454
- for (let h = v.children.value.length - 1; h >= 0; h--)
2455
- u.push(v.children.value[h]);
1797
+ _removeChildInstance: (s) => r.value.includes(s) ? (r.value = r.value.filter((f) => f.id !== s.id), s.parent.value = null, !0) : !1,
1798
+ findChild: (s) => r.value.find(s) ?? null,
1799
+ findDescendant: (s) => {
1800
+ const f = [d];
1801
+ for (; f.length > 0; ) {
1802
+ const u = f.pop();
1803
+ if (s(u))
1804
+ return u;
1805
+ for (let m = u.children.value.length - 1; m >= 0; m--)
1806
+ f.push(u.children.value[m]);
2456
1807
  }
2457
1808
  return null;
2458
1809
  },
2459
- isDescendantOf: (c) => {
2460
- let u = l.value;
2461
- for (; u; ) {
2462
- if (u.id === c.id)
1810
+ isDescendantOf: (s) => {
1811
+ let f = c.value;
1812
+ for (; f; ) {
1813
+ if (f.id === s.id)
2463
1814
  return !0;
2464
- u = u.parent.value;
1815
+ f = f.parent.value;
2465
1816
  }
2466
1817
  return !1;
2467
1818
  },
2468
1819
  getPath: () => {
2469
- const c = [];
2470
- let u = f;
2471
- for (; u; )
2472
- c.push(u), u = u.parent.value;
2473
- return c.reverse();
1820
+ const s = [];
1821
+ let f = d;
1822
+ for (; f; )
1823
+ s.push(f), f = f.parent.value;
1824
+ return s.reverse();
2474
1825
  }
2475
1826
  };
2476
- return Object.freeze(f);
2477
- }
2478
- function Co(e, t) {
2479
- const n = (t == null ? void 0 : t.deleteStrategy) ?? "recursive", o = tn(/* @__PURE__ */ new Map()), i = At(e, null, {}, !0);
2480
- o.set(i.id, i);
2481
- const l = (h) => o.get(h) ?? null, r = (h, d = null, m = {}) => {
2482
- const g = d ? l(d) : i;
2483
- if (!g)
2484
- return console.error(`Tree addNode: Parent node with ID ${d} not found.`), null;
2485
- m.id && o.has(m.id) && (m.id = void 0);
2486
- const p = At(h, g, m);
2487
- return o.set(p.id, p), g.addChild(p), p;
2488
- }, a = (h, d) => {
2489
- const m = d ?? n, g = l(h);
2490
- if (!g)
1827
+ return Object.freeze(d);
1828
+ }
1829
+ function so(e) {
1830
+ const t = (e == null ? void 0 : e.deleteStrategy) ?? "recursive", n = Gt(/* @__PURE__ */ new Map());
1831
+ let o = null;
1832
+ const i = (u) => n.get(u) ?? null, c = (u, m = null, h = {}) => {
1833
+ if (!o) {
1834
+ if (m != null)
1835
+ return console.error(
1836
+ `Tree addNode: Cannot add a non-root node before a root exists. Received parentId=${m}.`
1837
+ ), null;
1838
+ const v = Tt(u, null, h, !0);
1839
+ return n.set(v.id, v), o = v, v;
1840
+ }
1841
+ const p = m ? i(m) : o;
1842
+ if (!p)
1843
+ return console.error(`Tree addNode: Parent node with ID ${m} not found.`), null;
1844
+ h.id && n.has(h.id) && (h.id = void 0);
1845
+ const g = Tt(u, p, h);
1846
+ return n.set(g.id, g), p.addChild(g), g;
1847
+ }, r = (u, m) => {
1848
+ const h = m ?? t, p = i(u);
1849
+ if (!p)
2491
1850
  return !1;
2492
- if (g.isRoot)
1851
+ if (p.isRoot)
2493
1852
  return console.error("Tree removeNode: Cannot remove the root node."), !1;
2494
- const p = g.parent.value;
2495
- if (m === "recursive")
2496
- v(g);
1853
+ const g = p.parent.value;
1854
+ if (h === "recursive")
1855
+ f(p);
2497
1856
  else {
2498
- for (const b of g.children.value)
2499
- b.parent.value = null;
2500
- g.children.value = [], o.delete(g.id);
1857
+ for (const v of p.children.value)
1858
+ v.parent.value = null;
1859
+ p.children.value = [], n.delete(p.id);
2501
1860
  }
2502
- return p._removeChildInstance(g);
2503
- }, f = (h, d) => {
2504
- const m = l(h);
2505
- if (!m)
2506
- return console.error(`Tree moveNode: Node with ID ${h} not found.`), !1;
2507
- if (m.isRoot)
1861
+ return g._removeChildInstance(p);
1862
+ }, a = (u, m) => {
1863
+ const h = i(u);
1864
+ if (!h)
1865
+ return console.error(`Tree moveNode: Node with ID ${u} not found.`), !1;
1866
+ if (h.isRoot)
2508
1867
  return console.error("Tree moveNode: Cannot move the root node."), !1;
2509
- if (h === d)
1868
+ if (u === m)
2510
1869
  return console.error("Tree moveNode: Cannot move a node to be a child of itself."), !1;
2511
- const g = d ? l(d) : i;
2512
- if (!g)
2513
- return console.error(`Tree moveNode: New parent node with ID ${d} not found.`), !1;
2514
- if (g.isDescendantOf(m))
1870
+ const p = m ? i(m) : o;
1871
+ if (!p)
1872
+ return console.error(`Tree moveNode: New parent node with ID ${m} not found.`), !1;
1873
+ if (p.isDescendantOf(h))
2515
1874
  return console.error("Tree moveNode: Cannot move a node to become its own descendant."), !1;
2516
- const p = m.parent.value;
2517
- if (p) {
2518
- if (!p._removeChildInstance(m))
1875
+ const g = h.parent.value;
1876
+ if (g) {
1877
+ if (!g._removeChildInstance(h))
2519
1878
  return console.error("Tree moveNode: Failed to remove node from its original parent."), !1;
2520
- } else if (m.isRoot) {
2521
- if (m.isRoot)
1879
+ } else if (h.isRoot) {
1880
+ if (h.isRoot)
2522
1881
  return console.error("Tree moveNode: Attempting to move the root node, which is not allowed."), !1;
2523
1882
  }
2524
- return g.addChild(m), m.parent.value = g, !0;
2525
- }, c = (h = "dfs", d = i) => {
2526
- const m = [];
2527
- if (!d)
2528
- return console.warn("Tree traverse: Start node is null, returning empty array."), m;
2529
- if (h === "dfs") {
2530
- const g = [d];
2531
- for (; g.length > 0; ) {
2532
- const p = g.pop();
2533
- m.push(p);
2534
- for (let b = p.children.value.length - 1; b >= 0; b--)
2535
- g.push(p.children.value[b]);
1883
+ return p.addChild(h), h.parent.value = p, !0;
1884
+ }, d = (u = "dfs", m = o) => {
1885
+ const h = [];
1886
+ if (!m)
1887
+ return console.warn("Tree traverse: Start node is null, returning empty array."), h;
1888
+ if (u === "dfs") {
1889
+ const p = [m];
1890
+ for (; p.length > 0; ) {
1891
+ const g = p.pop();
1892
+ h.push(g);
1893
+ for (let v = g.children.value.length - 1; v >= 0; v--)
1894
+ p.push(g.children.value[v]);
2536
1895
  }
2537
1896
  } else {
2538
- const g = [d];
2539
- for (; g.length > 0; ) {
2540
- const p = g.shift();
2541
- m.push(p);
2542
- for (const b of p.children.value)
2543
- g.push(b);
1897
+ const p = [m];
1898
+ for (; p.length > 0; ) {
1899
+ const g = p.shift();
1900
+ h.push(g);
1901
+ for (const v of g.children.value)
1902
+ p.push(v);
2544
1903
  }
2545
1904
  }
2546
- return m;
2547
- }, u = () => {
2548
- o.clear();
2549
- }, v = (h) => {
2550
- const d = [...h.children.value];
2551
- for (const m of d)
2552
- v(m);
2553
- o.delete(h.id), h.children.value = [];
1905
+ return h;
1906
+ }, s = () => {
1907
+ n.clear();
1908
+ }, f = (u) => {
1909
+ const m = [...u.children.value];
1910
+ for (const h of m)
1911
+ f(h);
1912
+ n.delete(u.id), u.children.value = [];
2554
1913
  };
2555
1914
  return Object.freeze({
2556
1915
  get root() {
2557
- return i;
1916
+ return o;
2558
1917
  },
2559
1918
  get nodeMap() {
2560
- return o;
1919
+ return n;
1920
+ },
1921
+ findNodeById: i,
1922
+ addNode: c,
1923
+ removeNode: r,
1924
+ moveNode: a,
1925
+ traverse: d,
1926
+ dispose: s
1927
+ });
1928
+ }
1929
+ function lo(e) {
1930
+ return Jt() ? (xe(e), !0) : !1;
1931
+ }
1932
+ const ao = typeof window < "u" && typeof document < "u";
1933
+ typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
1934
+ const co = Object.prototype.toString, uo = (e) => co.call(e) === "[object Object]";
1935
+ function _e(e) {
1936
+ return Array.isArray(e) ? e : [e];
1937
+ }
1938
+ function fo(e, t, n) {
1939
+ return se(
1940
+ e,
1941
+ t,
1942
+ {
1943
+ ...n,
1944
+ immediate: !0
1945
+ }
1946
+ );
1947
+ }
1948
+ const ho = ao ? window : void 0;
1949
+ function mo(e) {
1950
+ var t;
1951
+ const n = D(e);
1952
+ return (t = n == null ? void 0 : n.$el) != null ? t : n;
1953
+ }
1954
+ function K(...e) {
1955
+ const t = [], n = () => {
1956
+ t.forEach((a) => a()), t.length = 0;
1957
+ }, o = (a, d, s, f) => (a.addEventListener(d, s, f), () => a.removeEventListener(d, s, f)), i = N(() => {
1958
+ const a = _e(D(e[0])).filter((d) => d != null);
1959
+ return a.every((d) => typeof d != "string") ? a : void 0;
1960
+ }), c = fo(
1961
+ () => {
1962
+ var a, d;
1963
+ return [
1964
+ (d = (a = i.value) == null ? void 0 : a.map((s) => mo(s))) != null ? d : [ho].filter((s) => s != null),
1965
+ _e(D(i.value ? e[1] : e[0])),
1966
+ _e(Qt(i.value ? e[2] : e[1])),
1967
+ // @ts-expect-error - TypeScript gets the correct types, but somehow still complains
1968
+ D(i.value ? e[3] : e[2])
1969
+ ];
1970
+ },
1971
+ ([a, d, s, f]) => {
1972
+ if (n(), !(a != null && a.length) || !(d != null && d.length) || !(s != null && s.length))
1973
+ return;
1974
+ const u = uo(f) ? { ...f } : f;
1975
+ t.push(
1976
+ ...a.flatMap(
1977
+ (m) => d.flatMap(
1978
+ (h) => s.map((p) => o(m, h, p, u))
1979
+ )
1980
+ )
1981
+ );
1982
+ },
1983
+ { flush: "post" }
1984
+ ), r = () => {
1985
+ c(), n();
1986
+ };
1987
+ return lo(n), r;
1988
+ }
1989
+ function Ho(e, t = {}) {
1990
+ const { floatingContext: n, treeContext: o } = Ke(e), { open: i, setOpen: c, refs: r } = n, {
1991
+ enabled: a = !0,
1992
+ event: d = "click",
1993
+ toggle: s = !0,
1994
+ ignoreMouse: f = !1,
1995
+ ignoreKeyboard: u = !1,
1996
+ ignoreTouch: m = !1,
1997
+ // Outside click options
1998
+ outsideClick: h = !1,
1999
+ outsideEvent: p = "pointerdown",
2000
+ outsideCapture: g = !0,
2001
+ onOutsideClick: v,
2002
+ preventScrollbarClick: x = !0,
2003
+ handleDragEvents: b = !0
2004
+ } = t;
2005
+ let E, P = !1, S = !1, y = !1;
2006
+ const O = N(() => D(a)), M = N(() => D(h)), R = N(() => {
2007
+ const T = r.anchorEl.value;
2008
+ return T instanceof HTMLElement ? T : null;
2009
+ }), A = N(() => r.floatingEl.value);
2010
+ function k(T, V) {
2011
+ y = !0;
2012
+ try {
2013
+ i.value ? D(s) && c(!1, T, V) : c(!0, T, V);
2014
+ } finally {
2015
+ Promise.resolve().then(() => {
2016
+ y = !1;
2017
+ });
2018
+ }
2019
+ }
2020
+ function F() {
2021
+ E = void 0, P = !1, S = !1;
2022
+ }
2023
+ function $(T) {
2024
+ E = T.pointerType;
2025
+ }
2026
+ function H(T) {
2027
+ T.button === 0 && D(d) !== "click" && (_(E) || k("anchor-click", T));
2028
+ }
2029
+ function C(T) {
2030
+ if (D(u) && T.detail === 0) {
2031
+ F();
2032
+ return;
2033
+ }
2034
+ if (D(d) === "mousedown" && E) {
2035
+ F();
2036
+ return;
2037
+ }
2038
+ if (_(E)) {
2039
+ F();
2040
+ return;
2041
+ }
2042
+ k("anchor-click", T), F();
2043
+ }
2044
+ function l(T) {
2045
+ if (E = void 0, T.defaultPrevented || D(u) || lt(T))
2046
+ return;
2047
+ const V = R.value;
2048
+ V && (T.key === " " && !at(V) && (T.preventDefault(), P = !0), T.key === "Enter" && k("keyboard-activate", T));
2049
+ }
2050
+ function I(T) {
2051
+ const V = R.value;
2052
+ V && (T.defaultPrevented || D(u) || lt(T) || at(V) || T.key === " " && P && (P = !1, k("keyboard-activate", T)));
2053
+ }
2054
+ function w(T) {
2055
+ if (!O.value || !M.value || !i.value)
2056
+ return;
2057
+ if (D(p) === "click" && D(b) && S) {
2058
+ S = !1;
2059
+ return;
2060
+ }
2061
+ if (y)
2062
+ return;
2063
+ const V = T.target;
2064
+ if (V && !(D(x) && Ye(V) && A.value && rn(T, V))) {
2065
+ if (o) {
2066
+ if (!po(o, V))
2067
+ return;
2068
+ } else if (ct(T, R.value) || ct(T, A.value))
2069
+ return;
2070
+ v ? v(T, n) : c(!1, "outside-pointer", T);
2071
+ }
2072
+ }
2073
+ function B() {
2074
+ S = !0;
2075
+ }
2076
+ function oe() {
2077
+ setTimeout(() => {
2078
+ S = !1;
2079
+ }, 0);
2080
+ }
2081
+ function _(T) {
2082
+ return !!(Lt(T, !0) && D(f) || T === "touch" && D(m));
2083
+ }
2084
+ Oe(() => {
2085
+ const T = R.value;
2086
+ !O.value || !T || (T.addEventListener("pointerdown", $), T.addEventListener("mousedown", H), T.addEventListener("click", C), T.addEventListener("keydown", l), T.addEventListener("keyup", I), pe(() => {
2087
+ T.removeEventListener("pointerdown", $), T.removeEventListener("mousedown", H), T.removeEventListener("click", C), T.removeEventListener("keydown", l), T.removeEventListener("keyup", I), F();
2088
+ }));
2089
+ }), K(
2090
+ () => O.value && M.value ? document : null,
2091
+ () => D(p),
2092
+ w,
2093
+ { capture: D(g) }
2094
+ ), K(
2095
+ () => O.value && M.value && D(b) ? A.value : null,
2096
+ "mousedown",
2097
+ B,
2098
+ { capture: !0 }
2099
+ ), K(
2100
+ () => O.value && M.value && D(b) ? A.value : null,
2101
+ "mouseup",
2102
+ oe,
2103
+ { capture: !0 }
2104
+ );
2105
+ }
2106
+ function po(e, t) {
2107
+ return !(q(t, e.data.refs.anchorEl.value) || q(t, e.data.refs.floatingEl.value) || qe(e, t));
2108
+ }
2109
+ function Io(e, t = {}) {
2110
+ const { floatingContext: n, treeContext: o } = Ke(e), { enabled: i = !0, capture: c = !1, onEscape: r } = t, { isComposing: a } = go();
2111
+ K(document, "keydown", (s) => {
2112
+ if (!(s.key !== "Escape" || !D(i) || a())) {
2113
+ if (r) {
2114
+ r(s);
2115
+ return;
2116
+ }
2117
+ if (o) {
2118
+ const f = vo(o);
2119
+ f && f.data.setOpen(!1, "escape-key", s);
2120
+ } else
2121
+ n.setOpen(!1, "escape-key", s);
2122
+ }
2123
+ }, c);
2124
+ }
2125
+ function vo(e) {
2126
+ var c;
2127
+ let t = e;
2128
+ for (; (c = t.parent) != null && c.value && !t.isRoot; )
2129
+ t = t.parent.value;
2130
+ let n = null, o = -1;
2131
+ const i = (r) => {
2132
+ var d;
2133
+ if (r.data.open.value) {
2134
+ const s = r.getPath().length;
2135
+ s > o && (o = s, n = r);
2136
+ }
2137
+ const a = ((d = r.children) == null ? void 0 : d.value) ?? [];
2138
+ for (const s of a)
2139
+ i(s);
2140
+ };
2141
+ return i(t), n;
2142
+ }
2143
+ function go() {
2144
+ const e = U(!1);
2145
+ return K(document, "compositionstart", () => {
2146
+ e.value = !0;
2147
+ }), K(document, "compositionend", () => {
2148
+ e.value = !1;
2149
+ }), {
2150
+ isComposing: () => e.value
2151
+ };
2152
+ }
2153
+ const wo = 0;
2154
+ function Bo(e, t = {}) {
2155
+ const {
2156
+ open: n,
2157
+ setOpen: o,
2158
+ refs: { floatingEl: i, anchorEl: c }
2159
+ } = e, { enabled: r = !0, requireFocusVisible: a = !0, tree: d } = t, s = N(() => c.value ? c.value instanceof HTMLElement ? c.value : c.value.contextElement : null);
2160
+ let f = !1, u = !0;
2161
+ const m = tn() && nn();
2162
+ let h, p = new yo(i);
2163
+ if (d) {
2164
+ let b = null;
2165
+ if (e.id && (b = d.findNodeById(e.id)), !b) {
2166
+ for (const E of d.nodeMap.values())
2167
+ if (E.data === e) {
2168
+ b = E;
2169
+ break;
2170
+ }
2171
+ }
2172
+ b && (p = new bo(b));
2173
+ }
2174
+ K(window, "blur", () => {
2175
+ !n.value && s.value && s.value === document.activeElement && (f = !0);
2176
+ }), K(window, "focus", () => {
2177
+ f = !1;
2178
+ }), Zt(() => {
2179
+ m && (K(
2180
+ window,
2181
+ "keydown",
2182
+ () => {
2183
+ u = !0;
2184
+ },
2185
+ { capture: !0 }
2186
+ ), K(
2187
+ window,
2188
+ "pointerdown",
2189
+ () => {
2190
+ u = !1;
2191
+ },
2192
+ { capture: !0 }
2193
+ ));
2194
+ });
2195
+ function g(b) {
2196
+ if (f) {
2197
+ f = !1;
2198
+ return;
2199
+ }
2200
+ const E = b.target instanceof Element ? b.target : null;
2201
+ if (D(a) && E) {
2202
+ if (m && !b.relatedTarget) {
2203
+ if (!u && !At(E))
2204
+ return;
2205
+ } else if (!on(E))
2206
+ return;
2207
+ }
2208
+ try {
2209
+ o(!0, "focus", b);
2210
+ } catch (P) {
2211
+ console.error("[useFocus] Error in onFocus handler:", P);
2212
+ }
2213
+ }
2214
+ function v(b) {
2215
+ clearTimeout(h), h = window.setTimeout(() => {
2216
+ var S;
2217
+ const P = (((S = s.value) == null ? void 0 : S.ownerDocument) ?? document).activeElement;
2218
+ if (!(!b.relatedTarget && P === s.value) && !p.shouldRemainOpen(P))
2219
+ try {
2220
+ if (P instanceof Element) {
2221
+ const y = p.getAncestorsToClose(P);
2222
+ for (const O of y)
2223
+ try {
2224
+ O.data.setOpen(!1, "tree-ancestor-close", b);
2225
+ } catch (M) {
2226
+ console.error("[useFocus] Error closing ancestor on blur:", M);
2227
+ }
2228
+ }
2229
+ o(!1, "blur", b);
2230
+ } catch (y) {
2231
+ console.error("[useFocus] Error in onBlur handler:", y);
2232
+ }
2233
+ }, wo);
2234
+ }
2235
+ K(
2236
+ document,
2237
+ "focusin",
2238
+ (b) => {
2239
+ if (!D(r)) return;
2240
+ const E = b.target;
2241
+ if (!(E instanceof Element)) return;
2242
+ const P = s.value;
2243
+ if (!(P && q(E, P)) && !p.shouldRemainOpen(E))
2244
+ try {
2245
+ const S = p.getAncestorsToClose(E);
2246
+ for (const y of S)
2247
+ try {
2248
+ y.data.setOpen(!1, "tree-ancestor-close", b);
2249
+ } catch (O) {
2250
+ console.error("[useFocus] Error closing ancestor on focusin:", O);
2251
+ }
2252
+ o(!1, "blur", b);
2253
+ } catch (S) {
2254
+ console.error("[useFocus] Error in document focusin handler:", S);
2255
+ }
2561
2256
  },
2562
- findNodeById: l,
2563
- addNode: r,
2564
- removeNode: a,
2565
- moveNode: f,
2566
- traverse: c,
2567
- dispose: u
2257
+ { capture: !0 }
2258
+ );
2259
+ const x = Oe(() => {
2260
+ if (!D(r)) return;
2261
+ const b = s.value;
2262
+ !b || !(b instanceof HTMLElement) || (b.addEventListener("focus", g), b.addEventListener("blur", v), pe(() => {
2263
+ b.removeEventListener("focus", g), b.removeEventListener("blur", v);
2264
+ }));
2568
2265
  });
2266
+ return xe(() => {
2267
+ clearTimeout(h);
2268
+ }), {
2269
+ /**
2270
+ * Cleanup function that removes all event listeners and clears pending timeouts.
2271
+ * Useful for manual cleanup in testing scenarios.
2272
+ */
2273
+ cleanup: () => {
2274
+ clearTimeout(h), x();
2275
+ }
2276
+ };
2277
+ }
2278
+ class yo {
2279
+ constructor(t) {
2280
+ this.floatingEl = t;
2281
+ }
2282
+ shouldRemainOpen(t) {
2283
+ return !t || !this.floatingEl.value ? !1 : this.floatingEl.value.contains(t);
2284
+ }
2285
+ getAncestorsToClose(t) {
2286
+ return [];
2287
+ }
2288
+ }
2289
+ class bo {
2290
+ constructor(t) {
2291
+ this.treeContext = t;
2292
+ }
2293
+ shouldRemainOpen(t) {
2294
+ return t ? this.isFocusWithinNodeHierarchy(this.treeContext, t) : !1;
2295
+ }
2296
+ /**
2297
+ * Returns a list of ancestors (starting from the immediate parent upward) that do not
2298
+ * contain the provided target within their subtree. Useful for closing ancestors when
2299
+ * focus moves outside the current branch.
2300
+ */
2301
+ getAncestorsToClose(t) {
2302
+ const n = [];
2303
+ let o = this.treeContext.parent.value;
2304
+ for (; o; ) {
2305
+ if (!this.isFocusWithinNodeHierarchy(o, t)) {
2306
+ n.push(o), o = o.parent.value;
2307
+ continue;
2308
+ }
2309
+ break;
2310
+ }
2311
+ return n;
2312
+ }
2313
+ isFocusWithinNodeHierarchy(t, n) {
2314
+ return q(n, t.data.refs.anchorEl.value) || q(n, t.data.refs.floatingEl.value) ? !0 : this.findDescendantContainingFocus(t, n) !== null;
2315
+ }
2316
+ findDescendantContainingFocus(t, n) {
2317
+ for (const o of t.children.value)
2318
+ if (o.data.open.value) {
2319
+ if (q(n, o.data.refs.anchorEl.value) || q(n, o.data.refs.floatingEl.value))
2320
+ return o;
2321
+ const i = this.findDescendantContainingFocus(o, n);
2322
+ if (i) return i;
2323
+ }
2324
+ return null;
2325
+ }
2326
+ }
2327
+ function Yt(e) {
2328
+ return e.children.value.some(
2329
+ (t) => t.data.open.value || Yt(t)
2330
+ );
2331
+ }
2332
+ function xo(e, t) {
2333
+ return e[0] >= t.x && e[0] <= t.x + t.width && e[1] >= t.y && e[1] <= t.y + t.height;
2334
+ }
2335
+ function Ot(e, t) {
2336
+ const [n, o] = e;
2337
+ let i = !1;
2338
+ const c = t.length;
2339
+ for (let r = 0, a = c - 1; r < c; a = r++) {
2340
+ const [d, s] = t[r] || [0, 0], [f, u] = t[a] || [0, 0];
2341
+ s >= o != u >= o && n <= (f - d) * (o - s) / (u - s) + d && (i = !i);
2342
+ }
2343
+ return i;
2344
+ }
2345
+ function Eo(e = {}) {
2346
+ const { blockPointerEvents: t = !1, requireIntent: n = !0 } = e;
2347
+ let o = -1, i = !1;
2348
+ function c(a, d, s, f, u) {
2349
+ const m = ut(), h = m - u;
2350
+ if (s === null || f === null || h === 0)
2351
+ return {
2352
+ speed: null,
2353
+ lastX: a,
2354
+ lastY: d,
2355
+ lastCursorTime: m
2356
+ };
2357
+ const p = a - s, g = d - f;
2358
+ return {
2359
+ speed: Math.sqrt(p * p + g * g) / h,
2360
+ lastX: a,
2361
+ lastY: d,
2362
+ lastCursorTime: m
2363
+ };
2364
+ }
2365
+ const r = function(d) {
2366
+ const { x: s, y: f, placement: u, elements: m, buffer: h, onClose: p, nodeId: g, tree: v } = d, x = N(() => {
2367
+ const S = m.domReference;
2368
+ return Ye(S) ? S : (S == null ? void 0 : S.contextElement) ?? null;
2369
+ });
2370
+ let b = null, E = null, P = ut();
2371
+ return function(y) {
2372
+ var Ae, tt, nt, ot, it, rt, st;
2373
+ function O() {
2374
+ ft(o), o = -1, p();
2375
+ }
2376
+ if (ft(o), o = -1, !m.domReference || !m.floating || u == null || s == null || f == null)
2377
+ return;
2378
+ const { clientX: M, clientY: R } = y, A = [M, R], k = sn(y), F = y.type === "mouseleave", $ = m.floating && $e(m.floating, k), H = x.value && $e(x.value, k), C = (Ae = x.value) == null ? void 0 : Ae.getBoundingClientRect(), l = (tt = m.floating) == null ? void 0 : tt.getBoundingClientRect(), I = u.split("-")[0], w = s > ((l == null ? void 0 : l.right) ?? 0) - ((l == null ? void 0 : l.width) ?? 0) / 2, B = f > ((l == null ? void 0 : l.bottom) ?? 0) - ((l == null ? void 0 : l.height) ?? 0) / 2, oe = C ? xo(A, C) : !1, _ = ((l == null ? void 0 : l.width) ?? 0) > ((C == null ? void 0 : C.width) ?? 0), T = ((l == null ? void 0 : l.height) ?? 0) > ((C == null ? void 0 : C.height) ?? 0), V = ((nt = _ ? C : l) == null ? void 0 : nt.left) ?? 0, ue = ((ot = _ ? C : l) == null ? void 0 : ot.right) ?? 0, z = ((it = T ? C : l) == null ? void 0 : it.top) ?? 0, fe = ((rt = T ? C : l) == null ? void 0 : rt.bottom) ?? 0;
2379
+ if ($ && (i = !0, !F))
2380
+ return;
2381
+ if (H && (i = !1), H && !F) {
2382
+ i = !0;
2383
+ return;
2384
+ }
2385
+ if (F && Ye(y.relatedTarget) && m.floating && $e(m.floating, y.relatedTarget))
2386
+ return;
2387
+ if (v && g) {
2388
+ const W = v.nodes.get(g);
2389
+ if (W && Yt(W))
2390
+ return;
2391
+ }
2392
+ if (I === "top" && f >= ((C == null ? void 0 : C.bottom) ?? 0) - 1 || I === "bottom" && f <= ((C == null ? void 0 : C.top) ?? 0) + 1 || I === "left" && s >= ((C == null ? void 0 : C.right) ?? 0) - 1 || I === "right" && s <= ((C == null ? void 0 : C.left) ?? 0) + 1)
2393
+ return O();
2394
+ let re = [];
2395
+ switch (I) {
2396
+ case "top":
2397
+ re = [
2398
+ [V, ((C == null ? void 0 : C.top) ?? 0) + 1],
2399
+ [V, ((l == null ? void 0 : l.bottom) ?? 0) - 1],
2400
+ [ue, ((l == null ? void 0 : l.bottom) ?? 0) - 1],
2401
+ [ue, ((C == null ? void 0 : C.top) ?? 0) + 1]
2402
+ ];
2403
+ break;
2404
+ case "bottom":
2405
+ re = [
2406
+ [V, ((l == null ? void 0 : l.top) ?? 0) + 1],
2407
+ [V, ((C == null ? void 0 : C.bottom) ?? 0) - 1],
2408
+ [ue, ((C == null ? void 0 : C.bottom) ?? 0) - 1],
2409
+ [ue, ((l == null ? void 0 : l.top) ?? 0) + 1]
2410
+ ];
2411
+ break;
2412
+ case "left":
2413
+ re = [
2414
+ [((l == null ? void 0 : l.right) ?? 0) - 1, fe],
2415
+ [((l == null ? void 0 : l.right) ?? 0) - 1, z],
2416
+ [((C == null ? void 0 : C.left) ?? 0) + 1, z],
2417
+ [((C == null ? void 0 : C.left) ?? 0) + 1, fe]
2418
+ ];
2419
+ break;
2420
+ case "right":
2421
+ re = [
2422
+ [((C == null ? void 0 : C.right) ?? 0) - 1, fe],
2423
+ [((C == null ? void 0 : C.right) ?? 0) - 1, z],
2424
+ [((l == null ? void 0 : l.left) ?? 0) + 1, z],
2425
+ [((l == null ? void 0 : l.left) ?? 0) + 1, fe]
2426
+ ];
2427
+ break;
2428
+ }
2429
+ function Le([W, X]) {
2430
+ const L = h;
2431
+ switch (I) {
2432
+ case "top": {
2433
+ const de = [
2434
+ _ ? W + L / 2 : w ? W + L * 4 : W - L * 4,
2435
+ X + L + 1
2436
+ ], he = [
2437
+ _ ? W - L / 2 : w ? W + L * 4 : W - L * 4,
2438
+ X + L + 1
2439
+ ], we = [
2440
+ [
2441
+ (l == null ? void 0 : l.left) ?? 0,
2442
+ w || _ ? ((l == null ? void 0 : l.bottom) ?? 0) - L : (l == null ? void 0 : l.top) ?? 0
2443
+ ],
2444
+ [
2445
+ (l == null ? void 0 : l.right) ?? 0,
2446
+ w ? _ ? ((l == null ? void 0 : l.bottom) ?? 0) - L : (l == null ? void 0 : l.top) ?? 0 : ((l == null ? void 0 : l.bottom) ?? 0) - L
2447
+ ]
2448
+ ];
2449
+ return [de, he, ...we];
2450
+ }
2451
+ case "bottom": {
2452
+ const de = [
2453
+ _ ? W + L / 2 : w ? W + L * 4 : W - L * 4,
2454
+ X - L
2455
+ ], he = [
2456
+ _ ? W - L / 2 : w ? W + L * 4 : W - L * 4,
2457
+ X - L
2458
+ ], we = [
2459
+ [
2460
+ (l == null ? void 0 : l.left) ?? 0,
2461
+ w || _ ? ((l == null ? void 0 : l.top) ?? 0) + L : (l == null ? void 0 : l.bottom) ?? 0
2462
+ ],
2463
+ [
2464
+ (l == null ? void 0 : l.right) ?? 0,
2465
+ w ? _ ? ((l == null ? void 0 : l.top) ?? 0) + L : (l == null ? void 0 : l.bottom) ?? 0 : ((l == null ? void 0 : l.top) ?? 0) + L
2466
+ ]
2467
+ ];
2468
+ return [de, he, ...we];
2469
+ }
2470
+ case "left": {
2471
+ const de = [
2472
+ W + L + 1,
2473
+ T ? X + L / 2 : B ? X + L * 4 : X - L * 4
2474
+ ], he = [
2475
+ W + L + 1,
2476
+ T ? X - L / 2 : B ? X + L * 4 : X - L * 4
2477
+ ];
2478
+ return [...[
2479
+ [
2480
+ B || T ? ((l == null ? void 0 : l.right) ?? 0) - L : (l == null ? void 0 : l.left) ?? 0,
2481
+ (l == null ? void 0 : l.top) ?? 0
2482
+ ],
2483
+ [
2484
+ B ? T ? ((l == null ? void 0 : l.right) ?? 0) - L : (l == null ? void 0 : l.left) ?? 0 : ((l == null ? void 0 : l.right) ?? 0) - L,
2485
+ (l == null ? void 0 : l.bottom) ?? 0
2486
+ ]
2487
+ ], de, he];
2488
+ }
2489
+ case "right": {
2490
+ const de = [
2491
+ W - L,
2492
+ T ? X + L / 2 : B ? X + L * 4 : X - L * 4
2493
+ ], he = [
2494
+ W - L,
2495
+ T ? X - L / 2 : B ? X + L * 4 : X - L * 4
2496
+ ], we = [
2497
+ [
2498
+ B || T ? ((l == null ? void 0 : l.left) ?? 0) + L : (l == null ? void 0 : l.right) ?? 0,
2499
+ (l == null ? void 0 : l.top) ?? 0
2500
+ ],
2501
+ [
2502
+ B ? T ? ((l == null ? void 0 : l.left) ?? 0) + L : (l == null ? void 0 : l.right) ?? 0 : ((l == null ? void 0 : l.left) ?? 0) + L,
2503
+ (l == null ? void 0 : l.bottom) ?? 0
2504
+ ]
2505
+ ];
2506
+ return [de, he, ...we];
2507
+ }
2508
+ }
2509
+ }
2510
+ const ge = Le([s, f]);
2511
+ if ((st = e.onPolygonChange) == null || st.call(e, ge), !Ot(A, re)) {
2512
+ if (Ot(A, ge)) {
2513
+ if (!i && n) {
2514
+ const W = c(
2515
+ y.clientX,
2516
+ y.clientY,
2517
+ b,
2518
+ E,
2519
+ P
2520
+ );
2521
+ b = W.lastX, E = W.lastY, P = W.lastCursorTime, W.speed !== null && W.speed < 0.1 && (o = window.setTimeout(O, 40));
2522
+ }
2523
+ return;
2524
+ }
2525
+ if (i && !oe)
2526
+ return O();
2527
+ O();
2528
+ }
2529
+ };
2530
+ };
2531
+ return r.__options = {
2532
+ blockPointerEvents: t
2533
+ }, r;
2534
+ }
2535
+ const Pt = 10;
2536
+ function Co(e, t, n) {
2537
+ const { delay: o } = n, i = N(() => {
2538
+ const s = D(o);
2539
+ return (typeof s == "number" ? s : s.open) ?? 0;
2540
+ }), c = N(() => {
2541
+ const s = D(o);
2542
+ return (typeof s == "number" ? s : s.close) ?? 0;
2543
+ });
2544
+ let r, a;
2545
+ const d = () => {
2546
+ clearTimeout(r), clearTimeout(a);
2547
+ };
2548
+ return xe(d), {
2549
+ show: (s, f) => {
2550
+ d();
2551
+ const u = s ?? i.value;
2552
+ u === 0 ? e(f) : r = setTimeout(() => e(f), u);
2553
+ },
2554
+ hide: (s, f) => {
2555
+ d();
2556
+ const u = s ?? c.value;
2557
+ u === 0 ? t(f) : a = setTimeout(() => t(f), u);
2558
+ },
2559
+ showDelay: i,
2560
+ hideDelay: c,
2561
+ clearTimeouts: d
2562
+ };
2563
+ }
2564
+ function Wo(e, t = {}) {
2565
+ const { floatingContext: n, treeContext: o } = Ke(e), {
2566
+ open: i,
2567
+ setOpen: c,
2568
+ refs: { anchorEl: r, floatingEl: a }
2569
+ } = n, {
2570
+ enabled: d = !0,
2571
+ delay: s = 0,
2572
+ restMs: f = 0,
2573
+ mouseOnly: u = !1,
2574
+ safePolygon: m = !1
2575
+ } = t, h = N(() => D(d)), p = N(() => D(f)), g = N(() => {
2576
+ const w = r.value;
2577
+ return !w || w instanceof HTMLElement ? w : w.contextElement ?? null;
2578
+ }), { hide: v, show: x, showDelay: b, clearTimeouts: E } = Co(
2579
+ (w) => {
2580
+ i.value || c(!0, "hover", w);
2581
+ },
2582
+ (w) => {
2583
+ i.value && c(!1, "hover", w);
2584
+ },
2585
+ { delay: s }
2586
+ );
2587
+ let P = null, S;
2588
+ const y = N(() => b.value === 0 && p.value > 0);
2589
+ function O(w) {
2590
+ if (!h.value || !A(w) || !y.value || !P) return;
2591
+ const B = { x: w.clientX, y: w.clientY }, oe = Math.abs(B.x - P.x), _ = Math.abs(B.y - P.y);
2592
+ (oe > Pt || _ > Pt) && (P = B, clearTimeout(S), S = setTimeout(() => {
2593
+ x(0, w);
2594
+ }, p.value));
2595
+ }
2596
+ function M(w) {
2597
+ !h.value || !A(w) || !y.value || (P = { x: w.clientX, y: w.clientY }, S = setTimeout(() => {
2598
+ x(0, w);
2599
+ }, p.value));
2600
+ }
2601
+ function R() {
2602
+ clearTimeout(S), P = null;
2603
+ }
2604
+ Oe(() => {
2605
+ const w = g.value;
2606
+ !w || !h.value || !y.value || (w.addEventListener("pointerenter", M), w.addEventListener("pointermove", O), w.addEventListener("pointerleave", R), pe(() => {
2607
+ w.removeEventListener("pointerenter", M), w.removeEventListener("pointermove", O), w.removeEventListener("pointerleave", R);
2608
+ }));
2609
+ }), xe(() => {
2610
+ clearTimeout(S);
2611
+ });
2612
+ function A(w) {
2613
+ return D(u) ? w.pointerType === "mouse" : !0;
2614
+ }
2615
+ function k(w) {
2616
+ !h.value || !A(w) || y.value || (H(), x(void 0, w));
2617
+ }
2618
+ function F(w) {
2619
+ !h.value || !A(w) || (E(), H());
2620
+ }
2621
+ let $ = null;
2622
+ function H() {
2623
+ $ && (document.removeEventListener("pointermove", $), $ = null);
2624
+ const w = l.value;
2625
+ w != null && w.onPolygonChange && w.onPolygonChange([]);
2626
+ }
2627
+ const C = N(() => !!D(m)), l = N(() => {
2628
+ const w = D(m);
2629
+ if (typeof w == "object" && w) return w;
2630
+ if (w === !0) return {};
2631
+ });
2632
+ function I(w) {
2633
+ var T;
2634
+ if (!h.value || !A(w)) return;
2635
+ const { clientX: B, clientY: oe } = w, _ = w.relatedTarget;
2636
+ if (C.value)
2637
+ setTimeout(() => {
2638
+ var re;
2639
+ H();
2640
+ const V = g.value, ue = a.value;
2641
+ if (!V || !ue) {
2642
+ v(void 0, w);
2643
+ return;
2644
+ }
2645
+ let z, fe;
2646
+ if (o) {
2647
+ z = /* @__PURE__ */ new Map();
2648
+ const Le = (ge) => {
2649
+ z == null || z.set(ge.id, ge);
2650
+ for (const Ae of ge.children.value)
2651
+ Le(Ae);
2652
+ };
2653
+ Le(o), fe = o.id;
2654
+ }
2655
+ $ = Eo(l.value)({
2656
+ x: B,
2657
+ y: oe,
2658
+ placement: n.placement.value,
2659
+ elements: {
2660
+ domReference: V,
2661
+ floating: ue
2662
+ },
2663
+ buffer: ((re = l.value) == null ? void 0 : re.buffer) ?? 1,
2664
+ onClose: () => {
2665
+ H(), v(void 0);
2666
+ },
2667
+ nodeId: fe,
2668
+ tree: z ? { nodes: z } : void 0
2669
+ }), $ && document.addEventListener("pointermove", $);
2670
+ }, 0);
2671
+ else {
2672
+ if (o) {
2673
+ if (!To(o, _))
2674
+ return;
2675
+ } else if ((T = a.value) != null && T.contains(_))
2676
+ return;
2677
+ v(void 0, w);
2678
+ }
2679
+ }
2680
+ Oe(() => {
2681
+ const w = g.value;
2682
+ !w || !h.value || (w.addEventListener("pointerenter", k), w.addEventListener("pointerleave", I), pe(() => {
2683
+ w.removeEventListener("pointerenter", k), w.removeEventListener("pointerleave", I);
2684
+ }));
2685
+ }), Oe(() => {
2686
+ const w = a.value;
2687
+ !w || !h.value || (w.addEventListener("pointerenter", F), w.addEventListener("pointerleave", I), pe(() => {
2688
+ w.removeEventListener("pointerenter", F), w.removeEventListener("pointerleave", I);
2689
+ }));
2690
+ }), xe(() => {
2691
+ H();
2692
+ });
2693
+ }
2694
+ function To(e, t) {
2695
+ return t ? !(q(t, e.data.refs.anchorEl.value) || q(t, e.data.refs.floatingEl.value) || qe(e, t)) : !0;
2569
2696
  }
2570
2697
  export {
2571
- bo as arrow,
2572
- No as autoPlacement,
2573
- dt as clearTimeoutIfSet,
2574
- Xe as contains,
2575
- Co as createTree,
2576
- At as createTreeNode,
2577
- Ke as findDescendantContainingTarget,
2578
- Fo as flip,
2579
- He as getContextFromParameter,
2580
- ft as getCurrentTime,
2581
- hn as getTarget,
2582
- Io as hide,
2583
- at as isButtonTarget,
2584
- dn as isClickOnScrollbar,
2585
- ut as isEventTargetWithin,
2586
- fn as isHTMLElement,
2587
- st as isMac,
2588
- Dt as isMouseLikePointerType,
2589
- lt as isSafari,
2590
- ct as isSpaceIgnored,
2591
- Z as isTargetWithinElement,
2592
- mn as isTreeNode,
2593
- Mt as isTypeableElement,
2594
- Po as isVirtualElement,
2595
- un as matchesFocusVisible,
2596
- Ro as offset,
2597
- ko as shift,
2598
- Ho as size,
2599
- Bo as useArrow,
2600
- Lo as useClick,
2601
- So as useClientPoint,
2602
- Ao as useEscapeKey,
2603
- Lt as useFloating,
2604
- Wo as useFloatingTree,
2605
- Do as useFocus,
2606
- Mo as useHover
2698
+ an as FollowTracker,
2699
+ cn as StaticTracker,
2700
+ Dt as TrackingStrategy,
2701
+ je as VirtualElementFactory,
2702
+ io as arrow,
2703
+ Do as autoPlacement,
2704
+ so as createTree,
2705
+ Tt as createTreeNode,
2706
+ Mo as flip,
2707
+ ko as hide,
2708
+ Ao as offset,
2709
+ Ro as shift,
2710
+ No as size,
2711
+ So as useArrow,
2712
+ Ho as useClick,
2713
+ Lo as useClientPoint,
2714
+ Io as useEscapeKey,
2715
+ ro as useFloating,
2716
+ Fo as useFloatingTree,
2717
+ Bo as useFocus,
2718
+ Wo as useHover
2607
2719
  };