tailtip 1.0.3 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/tailtip.mjs CHANGED
@@ -1,884 +1,805 @@
1
- var Nt = Object.defineProperty, Vt = Object.defineProperties;
2
- var Bt = Object.getOwnPropertyDescriptors;
3
- var Z = Object.getOwnPropertySymbols;
4
- var gt = Object.prototype.hasOwnProperty, ht = Object.prototype.propertyIsEnumerable;
5
- var pt = (t, e, n) => e in t ? Nt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, b = (t, e) => {
6
- for (var n in e || (e = {}))
7
- gt.call(e, n) && pt(t, n, e[n]);
8
- if (Z)
9
- for (var n of Z(e))
10
- ht.call(e, n) && pt(t, n, e[n]);
11
- return t;
12
- }, P = (t, e) => Vt(t, Bt(e));
13
- var rt = (t, e) => {
14
- var n = {};
15
- for (var o in t)
16
- gt.call(t, o) && e.indexOf(o) < 0 && (n[o] = t[o]);
17
- if (t != null && Z)
18
- for (var o of Z(t))
19
- e.indexOf(o) < 0 && ht.call(t, o) && (n[o] = t[o]);
20
- return n;
1
+ var min = Math.min, max = Math.max, round = Math.round, createCoords = (e) => ({
2
+ x: e,
3
+ y: e
4
+ }), oppositeSideMap = {
5
+ left: "right",
6
+ right: "left",
7
+ bottom: "top",
8
+ top: "bottom"
9
+ }, oppositeAlignmentMap = {
10
+ start: "end",
11
+ end: "start"
21
12
  };
22
- const K = Math.min, j = Math.max, tt = Math.round, V = (t) => ({
23
- x: t,
24
- y: t
25
- }), Ft = {
26
- left: "right",
27
- right: "left",
28
- bottom: "top",
29
- top: "bottom"
30
- }, Wt = {
31
- start: "end",
32
- end: "start"
13
+ function clamp(n, r, i) {
14
+ return max(n, min(r, i));
15
+ }
16
+ function evaluate(e, t) {
17
+ return typeof e == "function" ? e(t) : e;
18
+ }
19
+ function getSide(e) {
20
+ return e.split("-")[0];
21
+ }
22
+ function getAlignment(e) {
23
+ return e.split("-")[1];
24
+ }
25
+ function getOppositeAxis(e) {
26
+ return e === "x" ? "y" : "x";
27
+ }
28
+ function getAxisLength(e) {
29
+ return e === "y" ? "height" : "width";
30
+ }
31
+ var yAxisSides = /* @__PURE__ */ new Set(["top", "bottom"]);
32
+ function getSideAxis(e) {
33
+ return yAxisSides.has(getSide(e)) ? "y" : "x";
34
+ }
35
+ function getAlignmentAxis(e) {
36
+ return getOppositeAxis(getSideAxis(e));
37
+ }
38
+ function getAlignmentSides(e, t, n) {
39
+ n === void 0 && (n = !1);
40
+ let r = getAlignment(e), i = getAlignmentAxis(e), a = getAxisLength(i), o = i === "x" ? r === (n ? "end" : "start") ? "right" : "left" : r === "start" ? "bottom" : "top";
41
+ return t.reference[a] > t.floating[a] && (o = getOppositePlacement(o)), [o, getOppositePlacement(o)];
42
+ }
43
+ function getExpandedPlacements(e) {
44
+ let t = getOppositePlacement(e);
45
+ return [
46
+ getOppositeAlignmentPlacement(e),
47
+ t,
48
+ getOppositeAlignmentPlacement(t)
49
+ ];
50
+ }
51
+ function getOppositeAlignmentPlacement(e) {
52
+ return e.replace(/start|end/g, (e) => oppositeAlignmentMap[e]);
53
+ }
54
+ var lrPlacement = ["left", "right"], rlPlacement = ["right", "left"], tbPlacement = ["top", "bottom"], btPlacement = ["bottom", "top"];
55
+ function getSideList(e, t, n) {
56
+ switch (e) {
57
+ case "top":
58
+ case "bottom": return n ? t ? rlPlacement : lrPlacement : t ? lrPlacement : rlPlacement;
59
+ case "left":
60
+ case "right": return t ? tbPlacement : btPlacement;
61
+ default: return [];
62
+ }
63
+ }
64
+ function getOppositeAxisPlacements(e, t, n, r) {
65
+ let i = getAlignment(e), a = getSideList(getSide(e), n === "start", r);
66
+ return i && (a = a.map((e) => e + "-" + i), t && (a = a.concat(a.map(getOppositeAlignmentPlacement)))), a;
67
+ }
68
+ function getOppositePlacement(e) {
69
+ return e.replace(/left|right|bottom|top/g, (e) => oppositeSideMap[e]);
70
+ }
71
+ function expandPaddingObject(e) {
72
+ return {
73
+ top: 0,
74
+ right: 0,
75
+ bottom: 0,
76
+ left: 0,
77
+ ...e
78
+ };
79
+ }
80
+ function getPaddingObject(e) {
81
+ return typeof e == "number" ? {
82
+ top: e,
83
+ right: e,
84
+ bottom: e,
85
+ left: e
86
+ } : expandPaddingObject(e);
87
+ }
88
+ function rectToClientRect(e) {
89
+ let { x: t, y: n, width: r, height: i } = e;
90
+ return {
91
+ width: r,
92
+ height: i,
93
+ top: n,
94
+ left: t,
95
+ right: t + r,
96
+ bottom: n + i,
97
+ x: t,
98
+ y: n
99
+ };
100
+ }
101
+ function computeCoordsFromPlacement(e, t, n) {
102
+ let { reference: r, floating: i } = e, a = getSideAxis(t), o = getAlignmentAxis(t), s = getAxisLength(o), u = getSide(t), f = a === "y", h = r.x + r.width / 2 - i.width / 2, g = r.y + r.height / 2 - i.height / 2, _ = r[s] / 2 - i[s] / 2, v;
103
+ switch (u) {
104
+ case "top":
105
+ v = {
106
+ x: h,
107
+ y: r.y - i.height
108
+ };
109
+ break;
110
+ case "bottom":
111
+ v = {
112
+ x: h,
113
+ y: r.y + r.height
114
+ };
115
+ break;
116
+ case "right":
117
+ v = {
118
+ x: r.x + r.width,
119
+ y: g
120
+ };
121
+ break;
122
+ case "left":
123
+ v = {
124
+ x: r.x - i.width,
125
+ y: g
126
+ };
127
+ break;
128
+ default: v = {
129
+ x: r.x,
130
+ y: r.y
131
+ };
132
+ }
133
+ switch (getAlignment(t)) {
134
+ case "start":
135
+ v[o] -= _ * (n && f ? -1 : 1);
136
+ break;
137
+ case "end":
138
+ v[o] += _ * (n && f ? -1 : 1);
139
+ break;
140
+ }
141
+ return v;
142
+ }
143
+ async function detectOverflow(e, t) {
144
+ t === void 0 && (t = {});
145
+ let { x: n, y: r, platform: i, rects: a, elements: o, strategy: c } = e, { boundary: l = "clippingAncestors", rootBoundary: u = "viewport", elementContext: d = "floating", altBoundary: f = !1, padding: p = 0 } = evaluate(t, e), m = getPaddingObject(p), h = o[f ? d === "floating" ? "reference" : "floating" : d], g = rectToClientRect(await i.getClippingRect({
146
+ element: await (i.isElement == null ? void 0 : i.isElement(h)) ?? !0 ? h : h.contextElement || await (i.getDocumentElement == null ? void 0 : i.getDocumentElement(o.floating)),
147
+ boundary: l,
148
+ rootBoundary: u,
149
+ strategy: c
150
+ })), _ = d === "floating" ? {
151
+ x: n,
152
+ y: r,
153
+ width: a.floating.width,
154
+ height: a.floating.height
155
+ } : a.reference, v = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(o.floating)), y = await (i.isElement == null ? void 0 : i.isElement(v)) && await (i.getScale == null ? void 0 : i.getScale(v)) || {
156
+ x: 1,
157
+ y: 1
158
+ }, b = rectToClientRect(i.convertOffsetParentRelativeRectToViewportRelativeRect ? await i.convertOffsetParentRelativeRectToViewportRelativeRect({
159
+ elements: o,
160
+ rect: _,
161
+ offsetParent: v,
162
+ strategy: c
163
+ }) : _);
164
+ return {
165
+ top: (g.top - b.top + m.top) / y.y,
166
+ bottom: (b.bottom - g.bottom + m.bottom) / y.y,
167
+ left: (g.left - b.left + m.left) / y.x,
168
+ right: (b.right - g.right + m.right) / y.x
169
+ };
170
+ }
171
+ var computePosition$1 = async (e, t, n) => {
172
+ let { placement: r = "bottom", strategy: i = "absolute", middleware: a = [], platform: o } = n, s = a.filter(Boolean), c = await (o.isRTL == null ? void 0 : o.isRTL(t)), l = await o.getElementRects({
173
+ reference: e,
174
+ floating: t,
175
+ strategy: i
176
+ }), { x: u, y: d } = computeCoordsFromPlacement(l, r, c), f = r, p = {}, m = 0;
177
+ for (let n = 0; n < s.length; n++) {
178
+ let { name: a, fn: h } = s[n], { x: g, y: _, data: v, reset: y } = await h({
179
+ x: u,
180
+ y: d,
181
+ initialPlacement: r,
182
+ placement: f,
183
+ strategy: i,
184
+ middlewareData: p,
185
+ rects: l,
186
+ platform: {
187
+ ...o,
188
+ detectOverflow: o.detectOverflow ?? detectOverflow
189
+ },
190
+ elements: {
191
+ reference: e,
192
+ floating: t
193
+ }
194
+ });
195
+ u = g ?? u, d = _ ?? d, p = {
196
+ ...p,
197
+ [a]: {
198
+ ...p[a],
199
+ ...v
200
+ }
201
+ }, y && m <= 50 && (m++, typeof y == "object" && (y.placement && (f = y.placement), y.rects && (l = y.rects === !0 ? await o.getElementRects({
202
+ reference: e,
203
+ floating: t,
204
+ strategy: i
205
+ }) : y.rects), {x: u, y: d} = computeCoordsFromPlacement(l, f, c)), n = -1);
206
+ }
207
+ return {
208
+ x: u,
209
+ y: d,
210
+ placement: f,
211
+ strategy: i,
212
+ middlewareData: p
213
+ };
214
+ }, arrow$1 = (t) => ({
215
+ name: "arrow",
216
+ options: t,
217
+ async fn(n) {
218
+ let { x: r, y: i, placement: a, rects: c, platform: u, elements: f, middlewareData: p } = n, { element: h, padding: g = 0 } = evaluate(t, n) || {};
219
+ if (h == null) return {};
220
+ let _ = getPaddingObject(g), v = {
221
+ x: r,
222
+ y: i
223
+ }, y = getAlignmentAxis(a), b = getAxisLength(y), x = await u.getDimensions(h), S = y === "y", C = S ? "top" : "left", w = S ? "bottom" : "right", T = S ? "clientHeight" : "clientWidth", D = c.reference[b] + c.reference[y] - v[y] - c.floating[b], O = v[y] - c.reference[y], k = await (u.getOffsetParent == null ? void 0 : u.getOffsetParent(h)), A = k ? k[T] : 0;
224
+ (!A || !await (u.isElement == null ? void 0 : u.isElement(k))) && (A = f.floating[T] || c.floating[b]);
225
+ let j = D / 2 - O / 2, M = A / 2 - x[b] / 2 - 1, N = min(_[C], M), P = min(_[w], M), F = N, I = A - x[b] - P, L = A / 2 - x[b] / 2 + j, R = clamp(F, L, I), z = !p.arrow && getAlignment(a) != null && L !== R && c.reference[b] / 2 - (L < F ? N : P) - x[b] / 2 < 0, B = z ? L < F ? L - F : L - I : 0;
226
+ return {
227
+ [y]: v[y] + B,
228
+ data: {
229
+ [y]: R,
230
+ centerOffset: L - R - B,
231
+ ...z && { alignmentOffset: B }
232
+ },
233
+ reset: z
234
+ };
235
+ }
236
+ }), flip$1 = function(e) {
237
+ return e === void 0 && (e = {}), {
238
+ name: "flip",
239
+ options: e,
240
+ async fn(t) {
241
+ var n;
242
+ let { placement: r, middlewareData: i, rects: a, initialPlacement: o, platform: l, elements: u } = t, { mainAxis: d = !0, crossAxis: f = !0, fallbackPlacements: m, fallbackStrategy: _ = "bestFit", fallbackAxisSideDirection: v = "none", flipAlignment: y = !0, ...b } = evaluate(e, t);
243
+ if ((n = i.arrow) != null && n.alignmentOffset) return {};
244
+ let x = getSide(r), S = getSideAxis(o), T = getSide(o) === o, E = await (l.isRTL == null ? void 0 : l.isRTL(u.floating)), D = m || (T || !y ? [getOppositePlacement(o)] : getExpandedPlacements(o)), O = v !== "none";
245
+ !m && O && D.push(...getOppositeAxisPlacements(o, y, v, E));
246
+ let k = [o, ...D], A = await l.detectOverflow(t, b), j = [], M = i.flip?.overflows || [];
247
+ if (d && j.push(A[x]), f) {
248
+ let e = getAlignmentSides(r, a, E);
249
+ j.push(A[e[0]], A[e[1]]);
250
+ }
251
+ if (M = [...M, {
252
+ placement: r,
253
+ overflows: j
254
+ }], !j.every((e) => e <= 0)) {
255
+ let e = (i.flip?.index || 0) + 1, t = k[e];
256
+ if (t && (!(f === "alignment" && S !== getSideAxis(t)) || M.every((e) => getSideAxis(e.placement) === S ? e.overflows[0] > 0 : !0))) return {
257
+ data: {
258
+ index: e,
259
+ overflows: M
260
+ },
261
+ reset: { placement: t }
262
+ };
263
+ let n = M.filter((e) => e.overflows[0] <= 0).sort((e, t) => e.overflows[1] - t.overflows[1])[0]?.placement;
264
+ if (!n) switch (_) {
265
+ case "bestFit": {
266
+ let e = M.filter((e) => {
267
+ if (O) {
268
+ let t = getSideAxis(e.placement);
269
+ return t === S || t === "y";
270
+ }
271
+ return !0;
272
+ }).map((e) => [e.placement, e.overflows.filter((e) => e > 0).reduce((e, t) => e + t, 0)]).sort((e, t) => e[1] - t[1])[0]?.[0];
273
+ e && (n = e);
274
+ break;
275
+ }
276
+ case "initialPlacement":
277
+ n = o;
278
+ break;
279
+ }
280
+ if (r !== n) return { reset: { placement: n } };
281
+ }
282
+ return {};
283
+ }
284
+ };
285
+ }, originSides = /* @__PURE__ */ new Set(["left", "top"]);
286
+ async function convertValueToCoords(e, t) {
287
+ let { placement: n, platform: r, elements: i } = e, a = await (r.isRTL == null ? void 0 : r.isRTL(i.floating)), o = getSide(n), u = getAlignment(n), d = getSideAxis(n) === "y", f = originSides.has(o) ? -1 : 1, m = a && d ? -1 : 1, h = evaluate(t, e), { mainAxis: g, crossAxis: _, alignmentAxis: v } = typeof h == "number" ? {
288
+ mainAxis: h,
289
+ crossAxis: 0,
290
+ alignmentAxis: null
291
+ } : {
292
+ mainAxis: h.mainAxis || 0,
293
+ crossAxis: h.crossAxis || 0,
294
+ alignmentAxis: h.alignmentAxis
295
+ };
296
+ return u && typeof v == "number" && (_ = u === "end" ? v * -1 : v), d ? {
297
+ x: _ * m,
298
+ y: g * f
299
+ } : {
300
+ x: g * f,
301
+ y: _ * m
302
+ };
303
+ }
304
+ var offset$1 = function(e) {
305
+ return e === void 0 && (e = 0), {
306
+ name: "offset",
307
+ options: e,
308
+ async fn(t) {
309
+ var n;
310
+ let { x: r, y: i, placement: a, middlewareData: o } = t, s = await convertValueToCoords(t, e);
311
+ return a === o.offset?.placement && (n = o.arrow) != null && n.alignmentOffset ? {} : {
312
+ x: r + s.x,
313
+ y: i + s.y,
314
+ data: {
315
+ ...s,
316
+ placement: a
317
+ }
318
+ };
319
+ }
320
+ };
321
+ }, shift$1 = function(e) {
322
+ return e === void 0 && (e = {}), {
323
+ name: "shift",
324
+ options: e,
325
+ async fn(t) {
326
+ let { x: n, y: r, placement: i, platform: a } = t, { mainAxis: l = !0, crossAxis: d = !1, limiter: f = { fn: (e) => {
327
+ let { x: t, y: n } = e;
328
+ return {
329
+ x: t,
330
+ y: n
331
+ };
332
+ } }, ...m } = evaluate(e, t), h = {
333
+ x: n,
334
+ y: r
335
+ }, g = await a.detectOverflow(t, m), _ = getSideAxis(getSide(i)), v = getOppositeAxis(_), y = h[v], b = h[_];
336
+ if (l) {
337
+ let e = v === "y" ? "top" : "left", t = v === "y" ? "bottom" : "right", n = y + g[e], r = y - g[t];
338
+ y = clamp(n, y, r);
339
+ }
340
+ if (d) {
341
+ let e = _ === "y" ? "top" : "left", t = _ === "y" ? "bottom" : "right", n = b + g[e], r = b - g[t];
342
+ b = clamp(n, b, r);
343
+ }
344
+ let x = f.fn({
345
+ ...t,
346
+ [v]: y,
347
+ [_]: b
348
+ });
349
+ return {
350
+ ...x,
351
+ data: {
352
+ x: x.x - n,
353
+ y: x.y - r,
354
+ enabled: {
355
+ [v]: l,
356
+ [_]: d
357
+ }
358
+ }
359
+ };
360
+ }
361
+ };
33
362
  };
34
- function ct(t, e, n) {
35
- return j(t, K(e, n));
36
- }
37
- function J(t, e) {
38
- return typeof t == "function" ? t(e) : t;
39
- }
40
- function $(t) {
41
- return t.split("-")[0];
42
- }
43
- function Q(t) {
44
- return t.split("-")[1];
45
- }
46
- function vt(t) {
47
- return t === "x" ? "y" : "x";
48
- }
49
- function at(t) {
50
- return t === "y" ? "height" : "width";
51
- }
52
- function ot(t) {
53
- return ["top", "bottom"].includes($(t)) ? "y" : "x";
54
- }
55
- function ut(t) {
56
- return vt(ot(t));
57
- }
58
- function Mt(t, e, n) {
59
- n === void 0 && (n = !1);
60
- const o = Q(t), i = ut(t), r = at(i);
61
- let s = i === "x" ? o === (n ? "end" : "start") ? "right" : "left" : o === "start" ? "bottom" : "top";
62
- return e.reference[r] > e.floating[r] && (s = et(s)), [s, et(s)];
63
- }
64
- function Ht(t) {
65
- const e = et(t);
66
- return [lt(t), e, lt(e)];
67
- }
68
- function lt(t) {
69
- return t.replace(/start|end/g, (e) => Wt[e]);
70
- }
71
- function $t(t, e, n) {
72
- const o = ["left", "right"], i = ["right", "left"], r = ["top", "bottom"], s = ["bottom", "top"];
73
- switch (t) {
74
- case "top":
75
- case "bottom":
76
- return n ? e ? i : o : e ? o : i;
77
- case "left":
78
- case "right":
79
- return e ? r : s;
80
- default:
81
- return [];
82
- }
83
- }
84
- function jt(t, e, n, o) {
85
- const i = Q(t);
86
- let r = $t($(t), n === "start", o);
87
- return i && (r = r.map((s) => s + "-" + i), e && (r = r.concat(r.map(lt)))), r;
88
- }
89
- function et(t) {
90
- return t.replace(/left|right|bottom|top/g, (e) => Ft[e]);
91
- }
92
- function _t(t) {
93
- return b({
94
- top: 0,
95
- right: 0,
96
- bottom: 0,
97
- left: 0
98
- }, t);
99
- }
100
- function At(t) {
101
- return typeof t != "number" ? _t(t) : {
102
- top: t,
103
- right: t,
104
- bottom: t,
105
- left: t
106
- };
107
- }
108
- function nt(t) {
109
- return P(b({}, t), {
110
- top: t.y,
111
- left: t.x,
112
- right: t.x + t.width,
113
- bottom: t.y + t.height
114
- });
115
- }
116
- function wt(t, e, n) {
117
- let {
118
- reference: o,
119
- floating: i
120
- } = t;
121
- const r = ot(e), s = ut(e), c = at(s), l = $(e), f = r === "y", p = o.x + o.width / 2 - i.width / 2, d = o.y + o.height / 2 - i.height / 2, m = o[c] / 2 - i[c] / 2;
122
- let a;
123
- switch (l) {
124
- case "top":
125
- a = {
126
- x: p,
127
- y: o.y - i.height
128
- };
129
- break;
130
- case "bottom":
131
- a = {
132
- x: p,
133
- y: o.y + o.height
134
- };
135
- break;
136
- case "right":
137
- a = {
138
- x: o.x + o.width,
139
- y: d
140
- };
141
- break;
142
- case "left":
143
- a = {
144
- x: o.x - i.width,
145
- y: d
146
- };
147
- break;
148
- default:
149
- a = {
150
- x: o.x,
151
- y: o.y
152
- };
153
- }
154
- switch (Q(e)) {
155
- case "start":
156
- a[s] -= m * (n && f ? -1 : 1);
157
- break;
158
- case "end":
159
- a[s] += m * (n && f ? -1 : 1);
160
- break;
161
- }
162
- return a;
163
- }
164
- const Xt = async (t, e, n) => {
165
- const {
166
- placement: o = "bottom",
167
- strategy: i = "absolute",
168
- middleware: r = [],
169
- platform: s
170
- } = n, c = r.filter(Boolean), l = await (s.isRTL == null ? void 0 : s.isRTL(e));
171
- let f = await s.getElementRects({
172
- reference: t,
173
- floating: e,
174
- strategy: i
175
- }), {
176
- x: p,
177
- y: d
178
- } = wt(f, o, l), m = o, a = {}, u = 0;
179
- for (let g = 0; g < c.length; g++) {
180
- const {
181
- name: w,
182
- fn: h
183
- } = c[g], {
184
- x: y,
185
- y: x,
186
- data: A,
187
- reset: v
188
- } = await h({
189
- x: p,
190
- y: d,
191
- initialPlacement: o,
192
- placement: m,
193
- strategy: i,
194
- middlewareData: a,
195
- rects: f,
196
- platform: s,
197
- elements: {
198
- reference: t,
199
- floating: e
200
- }
201
- });
202
- if (p = y != null ? y : p, d = x != null ? x : d, a = P(b({}, a), {
203
- [w]: b(b({}, a[w]), A)
204
- }), v && u <= 50) {
205
- u++, typeof v == "object" && (v.placement && (m = v.placement), v.rects && (f = v.rects === !0 ? await s.getElementRects({
206
- reference: t,
207
- floating: e,
208
- strategy: i
209
- }) : v.rects), {
210
- x: p,
211
- y: d
212
- } = wt(f, m, l)), g = -1;
213
- continue;
214
- }
215
- }
216
- return {
217
- x: p,
218
- y: d,
219
- placement: m,
220
- strategy: i,
221
- middlewareData: a
222
- };
363
+ function hasWindow() {
364
+ return typeof window < "u";
365
+ }
366
+ function getNodeName(e) {
367
+ return isNode(e) ? (e.nodeName || "").toLowerCase() : "#document";
368
+ }
369
+ function getWindow(e) {
370
+ var t;
371
+ return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
372
+ }
373
+ function getDocumentElement(e) {
374
+ return ((isNode(e) ? e.ownerDocument : e.document) || window.document)?.documentElement;
375
+ }
376
+ function isNode(e) {
377
+ return hasWindow() ? e instanceof Node || e instanceof getWindow(e).Node : !1;
378
+ }
379
+ function isElement(e) {
380
+ return hasWindow() ? e instanceof Element || e instanceof getWindow(e).Element : !1;
381
+ }
382
+ function isHTMLElement(e) {
383
+ return hasWindow() ? e instanceof HTMLElement || e instanceof getWindow(e).HTMLElement : !1;
384
+ }
385
+ function isShadowRoot(e) {
386
+ return !hasWindow() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof getWindow(e).ShadowRoot;
387
+ }
388
+ var invalidOverflowDisplayValues = /* @__PURE__ */ new Set(["inline", "contents"]);
389
+ function isOverflowElement(e) {
390
+ let { overflow: t, overflowX: n, overflowY: r, display: i } = getComputedStyle$1(e);
391
+ return /auto|scroll|overlay|hidden|clip/.test(t + r + n) && !invalidOverflowDisplayValues.has(i);
392
+ }
393
+ var tableElements = /* @__PURE__ */ new Set([
394
+ "table",
395
+ "td",
396
+ "th"
397
+ ]);
398
+ function isTableElement(e) {
399
+ return tableElements.has(getNodeName(e));
400
+ }
401
+ var topLayerSelectors = [":popover-open", ":modal"];
402
+ function isTopLayer(e) {
403
+ return topLayerSelectors.some((t) => {
404
+ try {
405
+ return e.matches(t);
406
+ } catch {
407
+ return !1;
408
+ }
409
+ });
410
+ }
411
+ var transformProperties = [
412
+ "transform",
413
+ "translate",
414
+ "scale",
415
+ "rotate",
416
+ "perspective"
417
+ ], willChangeValues = [
418
+ "transform",
419
+ "translate",
420
+ "scale",
421
+ "rotate",
422
+ "perspective",
423
+ "filter"
424
+ ], containValues = [
425
+ "paint",
426
+ "layout",
427
+ "strict",
428
+ "content"
429
+ ];
430
+ function isContainingBlock(e) {
431
+ let t = isWebKit(), n = isElement(e) ? getComputedStyle$1(e) : e;
432
+ return transformProperties.some((e) => n[e] ? n[e] !== "none" : !1) || (n.containerType ? n.containerType !== "normal" : !1) || !t && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !t && (n.filter ? n.filter !== "none" : !1) || willChangeValues.some((e) => (n.willChange || "").includes(e)) || containValues.some((e) => (n.contain || "").includes(e));
433
+ }
434
+ function getContainingBlock(e) {
435
+ let t = getParentNode(e);
436
+ for (; isHTMLElement(t) && !isLastTraversableNode(t);) {
437
+ if (isContainingBlock(t)) return t;
438
+ if (isTopLayer(t)) return null;
439
+ t = getParentNode(t);
440
+ }
441
+ return null;
442
+ }
443
+ function isWebKit() {
444
+ return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
445
+ }
446
+ var lastTraversableNodeNames = /* @__PURE__ */ new Set([
447
+ "html",
448
+ "body",
449
+ "#document"
450
+ ]);
451
+ function isLastTraversableNode(e) {
452
+ return lastTraversableNodeNames.has(getNodeName(e));
453
+ }
454
+ function getComputedStyle$1(e) {
455
+ return getWindow(e).getComputedStyle(e);
456
+ }
457
+ function getNodeScroll(e) {
458
+ return isElement(e) ? {
459
+ scrollLeft: e.scrollLeft,
460
+ scrollTop: e.scrollTop
461
+ } : {
462
+ scrollLeft: e.scrollX,
463
+ scrollTop: e.scrollY
464
+ };
465
+ }
466
+ function getParentNode(e) {
467
+ if (getNodeName(e) === "html") return e;
468
+ let t = e.assignedSlot || e.parentNode || isShadowRoot(e) && e.host || getDocumentElement(e);
469
+ return isShadowRoot(t) ? t.host : t;
470
+ }
471
+ function getNearestOverflowAncestor(e) {
472
+ let t = getParentNode(e);
473
+ return isLastTraversableNode(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : isHTMLElement(t) && isOverflowElement(t) ? t : getNearestOverflowAncestor(t);
474
+ }
475
+ function getOverflowAncestors(e, t, n) {
476
+ t === void 0 && (t = []), n === void 0 && (n = !0);
477
+ let r = getNearestOverflowAncestor(e), i = r === e.ownerDocument?.body, a = getWindow(r);
478
+ if (i) {
479
+ let e = getFrameElement(a);
480
+ return t.concat(a, a.visualViewport || [], isOverflowElement(r) ? r : [], e && n ? getOverflowAncestors(e) : []);
481
+ }
482
+ return t.concat(r, getOverflowAncestors(r, [], n));
483
+ }
484
+ function getFrameElement(e) {
485
+ return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
486
+ }
487
+ function getCssDimensions(e) {
488
+ let t = getComputedStyle$1(e), r = parseFloat(t.width) || 0, i = parseFloat(t.height) || 0, a = isHTMLElement(e), o = a ? e.offsetWidth : r, s = a ? e.offsetHeight : i, c = round(r) !== o || round(i) !== s;
489
+ return c && (r = o, i = s), {
490
+ width: r,
491
+ height: i,
492
+ $: c
493
+ };
494
+ }
495
+ function unwrapElement(e) {
496
+ return isElement(e) ? e : e.contextElement;
497
+ }
498
+ function getScale(e) {
499
+ let t = unwrapElement(e);
500
+ if (!isHTMLElement(t)) return createCoords(1);
501
+ let i = t.getBoundingClientRect(), { width: a, height: o, $: s } = getCssDimensions(t), c = (s ? round(i.width) : i.width) / a, l = (s ? round(i.height) : i.height) / o;
502
+ return (!c || !Number.isFinite(c)) && (c = 1), (!l || !Number.isFinite(l)) && (l = 1), {
503
+ x: c,
504
+ y: l
505
+ };
506
+ }
507
+ var noOffsets = /* @__PURE__ */ createCoords(0);
508
+ function getVisualOffsets(e) {
509
+ let t = getWindow(e);
510
+ return !isWebKit() || !t.visualViewport ? noOffsets : {
511
+ x: t.visualViewport.offsetLeft,
512
+ y: t.visualViewport.offsetTop
513
+ };
514
+ }
515
+ function shouldAddVisualOffsets(e, t, n) {
516
+ return t === void 0 && (t = !1), !n || t && n !== getWindow(e) ? !1 : t;
517
+ }
518
+ function getBoundingClientRect(e, t, n, i) {
519
+ t === void 0 && (t = !1), n === void 0 && (n = !1);
520
+ let a = e.getBoundingClientRect(), o = unwrapElement(e), s = createCoords(1);
521
+ t && (i ? isElement(i) && (s = getScale(i)) : s = getScale(e));
522
+ let c = shouldAddVisualOffsets(o, n, i) ? getVisualOffsets(o) : createCoords(0), l = (a.left + c.x) / s.x, u = (a.top + c.y) / s.y, d = a.width / s.x, f = a.height / s.y;
523
+ if (o) {
524
+ let e = getWindow(o), t = i && isElement(i) ? getWindow(i) : i, n = e, r = getFrameElement(n);
525
+ for (; r && i && t !== n;) {
526
+ let e = getScale(r), t = r.getBoundingClientRect(), i = getComputedStyle$1(r), a = t.left + (r.clientLeft + parseFloat(i.paddingLeft)) * e.x, o = t.top + (r.clientTop + parseFloat(i.paddingTop)) * e.y;
527
+ l *= e.x, u *= e.y, d *= e.x, f *= e.y, l += a, u += o, n = getWindow(r), r = getFrameElement(n);
528
+ }
529
+ }
530
+ return rectToClientRect({
531
+ width: d,
532
+ height: f,
533
+ x: l,
534
+ y: u
535
+ });
536
+ }
537
+ function getWindowScrollBarX(e, t) {
538
+ let n = getNodeScroll(e).scrollLeft;
539
+ return t ? t.left + n : getBoundingClientRect(getDocumentElement(e)).left + n;
540
+ }
541
+ function getHTMLOffset(e, t) {
542
+ let n = e.getBoundingClientRect();
543
+ return {
544
+ x: n.left + t.scrollLeft - getWindowScrollBarX(e, n),
545
+ y: n.top + t.scrollTop
546
+ };
547
+ }
548
+ function convertOffsetParentRelativeRectToViewportRelativeRect(e) {
549
+ let { elements: t, rect: n, offsetParent: i, strategy: a } = e, o = a === "fixed", s = getDocumentElement(i), c = t ? isTopLayer(t.floating) : !1;
550
+ if (i === s || c && o) return n;
551
+ let l = {
552
+ scrollLeft: 0,
553
+ scrollTop: 0
554
+ }, u = createCoords(1), d = createCoords(0), f = isHTMLElement(i);
555
+ if ((f || !f && !o) && ((getNodeName(i) !== "body" || isOverflowElement(s)) && (l = getNodeScroll(i)), isHTMLElement(i))) {
556
+ let e = getBoundingClientRect(i);
557
+ u = getScale(i), d.x = e.x + i.clientLeft, d.y = e.y + i.clientTop;
558
+ }
559
+ let p = s && !f && !o ? getHTMLOffset(s, l) : createCoords(0);
560
+ return {
561
+ width: n.width * u.x,
562
+ height: n.height * u.y,
563
+ x: n.x * u.x - l.scrollLeft * u.x + d.x + p.x,
564
+ y: n.y * u.y - l.scrollTop * u.y + d.y + p.y
565
+ };
566
+ }
567
+ function getClientRects(e) {
568
+ return Array.from(e.getClientRects());
569
+ }
570
+ function getDocumentRect(e) {
571
+ let n = getDocumentElement(e), r = getNodeScroll(e), i = e.ownerDocument.body, a = max(n.scrollWidth, n.clientWidth, i.scrollWidth, i.clientWidth), o = max(n.scrollHeight, n.clientHeight, i.scrollHeight, i.clientHeight), s = -r.scrollLeft + getWindowScrollBarX(e), c = -r.scrollTop;
572
+ return getComputedStyle$1(i).direction === "rtl" && (s += max(n.clientWidth, i.clientWidth) - a), {
573
+ width: a,
574
+ height: o,
575
+ x: s,
576
+ y: c
577
+ };
578
+ }
579
+ var SCROLLBAR_MAX = 25;
580
+ function getViewportRect(e, t) {
581
+ let n = getWindow(e), r = getDocumentElement(e), i = n.visualViewport, a = r.clientWidth, o = r.clientHeight, s = 0, c = 0;
582
+ if (i) {
583
+ a = i.width, o = i.height;
584
+ let e = isWebKit();
585
+ (!e || e && t === "fixed") && (s = i.offsetLeft, c = i.offsetTop);
586
+ }
587
+ let l = getWindowScrollBarX(r);
588
+ if (l <= 0) {
589
+ let e = r.ownerDocument, t = e.body, n = getComputedStyle(t), i = e.compatMode === "CSS1Compat" && parseFloat(n.marginLeft) + parseFloat(n.marginRight) || 0, o = Math.abs(r.clientWidth - t.clientWidth - i);
590
+ o <= SCROLLBAR_MAX && (a -= o);
591
+ } else l <= SCROLLBAR_MAX && (a += l);
592
+ return {
593
+ width: a,
594
+ height: o,
595
+ x: s,
596
+ y: c
597
+ };
598
+ }
599
+ var absoluteOrFixed = /* @__PURE__ */ new Set(["absolute", "fixed"]);
600
+ function getInnerBoundingClientRect(e, t) {
601
+ let n = getBoundingClientRect(e, !0, t === "fixed"), i = n.top + e.clientTop, a = n.left + e.clientLeft, o = isHTMLElement(e) ? getScale(e) : createCoords(1);
602
+ return {
603
+ width: e.clientWidth * o.x,
604
+ height: e.clientHeight * o.y,
605
+ x: a * o.x,
606
+ y: i * o.y
607
+ };
608
+ }
609
+ function getClientRectFromClippingAncestor(e, t, n) {
610
+ let r;
611
+ if (t === "viewport") r = getViewportRect(e, n);
612
+ else if (t === "document") r = getDocumentRect(getDocumentElement(e));
613
+ else if (isElement(t)) r = getInnerBoundingClientRect(t, n);
614
+ else {
615
+ let n = getVisualOffsets(e);
616
+ r = {
617
+ x: t.x - n.x,
618
+ y: t.y - n.y,
619
+ width: t.width,
620
+ height: t.height
621
+ };
622
+ }
623
+ return rectToClientRect(r);
624
+ }
625
+ function hasFixedPositionAncestor(e, t) {
626
+ let n = getParentNode(e);
627
+ return n === t || !isElement(n) || isLastTraversableNode(n) ? !1 : getComputedStyle$1(n).position === "fixed" || hasFixedPositionAncestor(n, t);
628
+ }
629
+ function getClippingElementAncestors(e, t) {
630
+ let n = t.get(e);
631
+ if (n) return n;
632
+ let r = getOverflowAncestors(e, [], !1).filter((e) => isElement(e) && getNodeName(e) !== "body"), i = null, a = getComputedStyle$1(e).position === "fixed", o = a ? getParentNode(e) : e;
633
+ for (; isElement(o) && !isLastTraversableNode(o);) {
634
+ let t = getComputedStyle$1(o), n = isContainingBlock(o);
635
+ !n && t.position === "fixed" && (i = null), (a ? !n && !i : !n && t.position === "static" && i && absoluteOrFixed.has(i.position) || isOverflowElement(o) && !n && hasFixedPositionAncestor(e, o)) ? r = r.filter((e) => e !== o) : i = t, o = getParentNode(o);
636
+ }
637
+ return t.set(e, r), r;
638
+ }
639
+ function getClippingRect(n) {
640
+ let { element: r, boundary: i, rootBoundary: a, strategy: o } = n, s = [...i === "clippingAncestors" ? isTopLayer(r) ? [] : getClippingElementAncestors(r, this._c) : [].concat(i), a], c = s[0], l = s.reduce((n, i) => {
641
+ let a = getClientRectFromClippingAncestor(r, i, o);
642
+ return n.top = max(a.top, n.top), n.right = min(a.right, n.right), n.bottom = min(a.bottom, n.bottom), n.left = max(a.left, n.left), n;
643
+ }, getClientRectFromClippingAncestor(r, c, o));
644
+ return {
645
+ width: l.right - l.left,
646
+ height: l.bottom - l.top,
647
+ x: l.left,
648
+ y: l.top
649
+ };
650
+ }
651
+ function getDimensions(e) {
652
+ let { width: t, height: n } = getCssDimensions(e);
653
+ return {
654
+ width: t,
655
+ height: n
656
+ };
657
+ }
658
+ function getRectRelativeToOffsetParent(e, t, n) {
659
+ let i = isHTMLElement(t), a = getDocumentElement(t), o = n === "fixed", s = getBoundingClientRect(e, !0, o, t), c = {
660
+ scrollLeft: 0,
661
+ scrollTop: 0
662
+ }, l = createCoords(0);
663
+ function u() {
664
+ l.x = getWindowScrollBarX(a);
665
+ }
666
+ if (i || !i && !o) if ((getNodeName(t) !== "body" || isOverflowElement(a)) && (c = getNodeScroll(t)), i) {
667
+ let e = getBoundingClientRect(t, !0, o, t);
668
+ l.x = e.x + t.clientLeft, l.y = e.y + t.clientTop;
669
+ } else a && u();
670
+ o && !i && a && u();
671
+ let d = a && !i && !o ? getHTMLOffset(a, c) : createCoords(0);
672
+ return {
673
+ x: s.left + c.scrollLeft - l.x - d.x,
674
+ y: s.top + c.scrollTop - l.y - d.y,
675
+ width: s.width,
676
+ height: s.height
677
+ };
678
+ }
679
+ function isStaticPositioned(e) {
680
+ return getComputedStyle$1(e).position === "static";
681
+ }
682
+ function getTrueOffsetParent(e, t) {
683
+ if (!isHTMLElement(e) || getComputedStyle$1(e).position === "fixed") return null;
684
+ if (t) return t(e);
685
+ let n = e.offsetParent;
686
+ return getDocumentElement(e) === n && (n = n.ownerDocument.body), n;
687
+ }
688
+ function getOffsetParent(e, t) {
689
+ let n = getWindow(e);
690
+ if (isTopLayer(e)) return n;
691
+ if (!isHTMLElement(e)) {
692
+ let t = getParentNode(e);
693
+ for (; t && !isLastTraversableNode(t);) {
694
+ if (isElement(t) && !isStaticPositioned(t)) return t;
695
+ t = getParentNode(t);
696
+ }
697
+ return n;
698
+ }
699
+ let r = getTrueOffsetParent(e, t);
700
+ for (; r && isTableElement(r) && isStaticPositioned(r);) r = getTrueOffsetParent(r, t);
701
+ return r && isLastTraversableNode(r) && isStaticPositioned(r) && !isContainingBlock(r) ? n : r || getContainingBlock(e) || n;
702
+ }
703
+ var getElementRects = async function(e) {
704
+ let t = this.getOffsetParent || getOffsetParent, n = this.getDimensions, r = await n(e.floating);
705
+ return {
706
+ reference: getRectRelativeToOffsetParent(e.reference, await t(e.floating), e.strategy),
707
+ floating: {
708
+ x: 0,
709
+ y: 0,
710
+ width: r.width,
711
+ height: r.height
712
+ }
713
+ };
223
714
  };
224
- async function Et(t, e) {
225
- var n;
226
- e === void 0 && (e = {});
227
- const {
228
- x: o,
229
- y: i,
230
- platform: r,
231
- rects: s,
232
- elements: c,
233
- strategy: l
234
- } = t, {
235
- boundary: f = "clippingAncestors",
236
- rootBoundary: p = "viewport",
237
- elementContext: d = "floating",
238
- altBoundary: m = !1,
239
- padding: a = 0
240
- } = J(e, t), u = At(a), w = c[m ? d === "floating" ? "reference" : "floating" : d], h = nt(await r.getClippingRect({
241
- element: (n = await (r.isElement == null ? void 0 : r.isElement(w))) == null || n ? w : w.contextElement || await (r.getDocumentElement == null ? void 0 : r.getDocumentElement(c.floating)),
242
- boundary: f,
243
- rootBoundary: p,
244
- strategy: l
245
- })), y = d === "floating" ? P(b({}, s.floating), {
246
- x: o,
247
- y: i
248
- }) : s.reference, x = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(c.floating)), A = await (r.isElement == null ? void 0 : r.isElement(x)) ? await (r.getScale == null ? void 0 : r.getScale(x)) || {
249
- x: 1,
250
- y: 1
251
- } : {
252
- x: 1,
253
- y: 1
254
- }, v = nt(r.convertOffsetParentRelativeRectToViewportRelativeRect ? await r.convertOffsetParentRelativeRectToViewportRelativeRect({
255
- rect: y,
256
- offsetParent: x,
257
- strategy: l
258
- }) : y);
259
- return {
260
- top: (h.top - v.top + u.top) / A.y,
261
- bottom: (v.bottom - h.bottom + u.bottom) / A.y,
262
- left: (h.left - v.left + u.left) / A.x,
263
- right: (v.right - h.right + u.right) / A.x
264
- };
265
- }
266
- const Yt = (t) => ({
267
- name: "arrow",
268
- options: t,
269
- async fn(e) {
270
- const {
271
- x: n,
272
- y: o,
273
- placement: i,
274
- rects: r,
275
- platform: s,
276
- elements: c,
277
- middlewareData: l
278
- } = e, {
279
- element: f,
280
- padding: p = 0
281
- } = J(t, e) || {};
282
- if (f == null)
283
- return {};
284
- const d = At(p), m = {
285
- x: n,
286
- y: o
287
- }, a = ut(i), u = at(a), g = await s.getDimensions(f), w = a === "y", h = w ? "top" : "left", y = w ? "bottom" : "right", x = w ? "clientHeight" : "clientWidth", A = r.reference[u] + r.reference[a] - m[a] - r.floating[u], v = m[a] - r.reference[a], W = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(f));
288
- let O = W ? W[x] : 0;
289
- (!O || !await (s.isElement == null ? void 0 : s.isElement(W))) && (O = c.floating[x] || r.floating[u]);
290
- const M = A / 2 - v / 2, Y = O / 2 - g[u] / 2 - 1, q = K(d[h], Y), I = K(d[y], Y), H = q, T = O - g[u] - I, R = O / 2 - g[u] / 2 + M, D = ct(H, R, T), L = !l.arrow && Q(i) != null && R != D && r.reference[u] / 2 - (R < H ? q : I) - g[u] / 2 < 0, S = L ? R < H ? R - H : R - T : 0;
291
- return {
292
- [a]: m[a] + S,
293
- data: b({
294
- [a]: D,
295
- centerOffset: R - D - S
296
- }, L && {
297
- alignmentOffset: S
298
- }),
299
- reset: L
300
- };
301
- }
302
- }), qt = function(t) {
303
- return t === void 0 && (t = {}), {
304
- name: "flip",
305
- options: t,
306
- async fn(e) {
307
- var n, o;
308
- const {
309
- placement: i,
310
- middlewareData: r,
311
- rects: s,
312
- initialPlacement: c,
313
- platform: l,
314
- elements: f
315
- } = e, H = J(t, e), {
316
- mainAxis: p = !0,
317
- crossAxis: d = !0,
318
- fallbackPlacements: m,
319
- fallbackStrategy: a = "bestFit",
320
- fallbackAxisSideDirection: u = "none",
321
- flipAlignment: g = !0
322
- } = H, w = rt(H, [
323
- "mainAxis",
324
- "crossAxis",
325
- "fallbackPlacements",
326
- "fallbackStrategy",
327
- "fallbackAxisSideDirection",
328
- "flipAlignment"
329
- ]);
330
- if ((n = r.arrow) != null && n.alignmentOffset)
331
- return {};
332
- const h = $(i), y = $(c) === c, x = await (l.isRTL == null ? void 0 : l.isRTL(f.floating)), A = m || (y || !g ? [et(c)] : Ht(c));
333
- !m && u !== "none" && A.push(...jt(c, g, u, x));
334
- const v = [c, ...A], W = await Et(e, w), O = [];
335
- let M = ((o = r.flip) == null ? void 0 : o.overflows) || [];
336
- if (p && O.push(W[h]), d) {
337
- const T = Mt(i, s, x);
338
- O.push(W[T[0]], W[T[1]]);
339
- }
340
- if (M = [...M, {
341
- placement: i,
342
- overflows: O
343
- }], !O.every((T) => T <= 0)) {
344
- var Y, q;
345
- const T = (((Y = r.flip) == null ? void 0 : Y.index) || 0) + 1, R = v[T];
346
- if (R)
347
- return {
348
- data: {
349
- index: T,
350
- overflows: M
351
- },
352
- reset: {
353
- placement: R
354
- }
355
- };
356
- let D = (q = M.filter((L) => L.overflows[0] <= 0).sort((L, S) => L.overflows[1] - S.overflows[1])[0]) == null ? void 0 : q.placement;
357
- if (!D)
358
- switch (a) {
359
- case "bestFit": {
360
- var I;
361
- const L = (I = M.map((S) => [S.placement, S.overflows.filter((z) => z > 0).reduce((z, Dt) => z + Dt, 0)]).sort((S, z) => S[1] - z[1])[0]) == null ? void 0 : I[0];
362
- L && (D = L);
363
- break;
364
- }
365
- case "initialPlacement":
366
- D = c;
367
- break;
368
- }
369
- if (i !== D)
370
- return {
371
- reset: {
372
- placement: D
373
- }
374
- };
375
- }
376
- return {};
377
- }
378
- };
379
- };
380
- async function It(t, e) {
381
- const {
382
- placement: n,
383
- platform: o,
384
- elements: i
385
- } = t, r = await (o.isRTL == null ? void 0 : o.isRTL(i.floating)), s = $(n), c = Q(n), l = ot(n) === "y", f = ["left", "top"].includes(s) ? -1 : 1, p = r && l ? -1 : 1, d = J(e, t);
386
- let {
387
- mainAxis: m,
388
- crossAxis: a,
389
- alignmentAxis: u
390
- } = typeof d == "number" ? {
391
- mainAxis: d,
392
- crossAxis: 0,
393
- alignmentAxis: null
394
- } : b({
395
- mainAxis: 0,
396
- crossAxis: 0,
397
- alignmentAxis: null
398
- }, d);
399
- return c && typeof u == "number" && (a = c === "end" ? u * -1 : u), l ? {
400
- x: a * p,
401
- y: m * f
402
- } : {
403
- x: m * f,
404
- y: a * p
405
- };
406
- }
407
- const zt = function(t) {
408
- return t === void 0 && (t = 0), {
409
- name: "offset",
410
- options: t,
411
- async fn(e) {
412
- var n, o;
413
- const {
414
- x: i,
415
- y: r,
416
- placement: s,
417
- middlewareData: c
418
- } = e, l = await It(e, t);
419
- return s === ((n = c.offset) == null ? void 0 : n.placement) && (o = c.arrow) != null && o.alignmentOffset ? {} : {
420
- x: i + l.x,
421
- y: r + l.y,
422
- data: P(b({}, l), {
423
- placement: s
424
- })
425
- };
426
- }
427
- };
428
- }, Kt = function(t) {
429
- return t === void 0 && (t = {}), {
430
- name: "shift",
431
- options: t,
432
- async fn(e) {
433
- const {
434
- x: n,
435
- y: o,
436
- placement: i
437
- } = e, w = J(t, e), {
438
- mainAxis: r = !0,
439
- crossAxis: s = !1,
440
- limiter: c = {
441
- fn: (h) => {
442
- let {
443
- x: y,
444
- y: x
445
- } = h;
446
- return {
447
- x: y,
448
- y: x
449
- };
450
- }
451
- }
452
- } = w, l = rt(w, [
453
- "mainAxis",
454
- "crossAxis",
455
- "limiter"
456
- ]), f = {
457
- x: n,
458
- y: o
459
- }, p = await Et(e, l), d = ot($(i)), m = vt(d);
460
- let a = f[m], u = f[d];
461
- if (r) {
462
- const h = m === "y" ? "top" : "left", y = m === "y" ? "bottom" : "right", x = a + p[h], A = a - p[y];
463
- a = ct(x, a, A);
464
- }
465
- if (s) {
466
- const h = d === "y" ? "top" : "left", y = d === "y" ? "bottom" : "right", x = u + p[h], A = u - p[y];
467
- u = ct(x, u, A);
468
- }
469
- const g = c.fn(P(b({}, e), {
470
- [m]: a,
471
- [d]: u
472
- }));
473
- return P(b({}, g), {
474
- data: {
475
- x: g.x - n,
476
- y: g.y - o
477
- }
478
- });
479
- }
480
- };
481
- };
482
- function B(t) {
483
- return Ct(t) ? (t.nodeName || "").toLowerCase() : "#document";
484
- }
485
- function E(t) {
486
- var e;
487
- return (t == null || (e = t.ownerDocument) == null ? void 0 : e.defaultView) || window;
488
- }
489
- function F(t) {
490
- var e;
491
- return (e = (Ct(t) ? t.ownerDocument : t.document) || window.document) == null ? void 0 : e.documentElement;
492
- }
493
- function Ct(t) {
494
- return t instanceof Node || t instanceof E(t).Node;
495
- }
496
- function N(t) {
497
- return t instanceof Element || t instanceof E(t).Element;
498
- }
499
- function k(t) {
500
- return t instanceof HTMLElement || t instanceof E(t).HTMLElement;
501
- }
502
- function xt(t) {
503
- return typeof ShadowRoot > "u" ? !1 : t instanceof ShadowRoot || t instanceof E(t).ShadowRoot;
504
- }
505
- function U(t) {
506
- const {
507
- overflow: e,
508
- overflowX: n,
509
- overflowY: o,
510
- display: i
511
- } = C(t);
512
- return /auto|scroll|overlay|hidden|clip/.test(e + o + n) && !["inline", "contents"].includes(i);
513
- }
514
- function Gt(t) {
515
- return ["table", "td", "th"].includes(B(t));
516
- }
517
- function dt(t) {
518
- const e = mt(), n = C(t);
519
- return n.transform !== "none" || n.perspective !== "none" || (n.containerType ? n.containerType !== "normal" : !1) || !e && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !e && (n.filter ? n.filter !== "none" : !1) || ["transform", "perspective", "filter"].some((o) => (n.willChange || "").includes(o)) || ["paint", "layout", "strict", "content"].some((o) => (n.contain || "").includes(o));
520
- }
521
- function Jt(t) {
522
- let e = X(t);
523
- for (; k(e) && !it(e); ) {
524
- if (dt(e))
525
- return e;
526
- e = X(e);
527
- }
528
- return null;
529
- }
530
- function mt() {
531
- return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
532
- }
533
- function it(t) {
534
- return ["html", "body", "#document"].includes(B(t));
535
- }
536
- function C(t) {
537
- return E(t).getComputedStyle(t);
538
- }
539
- function st(t) {
540
- return N(t) ? {
541
- scrollLeft: t.scrollLeft,
542
- scrollTop: t.scrollTop
543
- } : {
544
- scrollLeft: t.pageXOffset,
545
- scrollTop: t.pageYOffset
546
- };
547
- }
548
- function X(t) {
549
- if (B(t) === "html")
550
- return t;
551
- const e = (
552
- // Step into the shadow DOM of the parent of a slotted node.
553
- t.assignedSlot || // DOM Element detected.
554
- t.parentNode || // ShadowRoot detected.
555
- xt(t) && t.host || // Fallback.
556
- F(t)
557
- );
558
- return xt(e) ? e.host : e;
559
- }
560
- function Ot(t) {
561
- const e = X(t);
562
- return it(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : k(e) && U(e) ? e : Ot(e);
563
- }
564
- function ft(t, e, n) {
565
- var o;
566
- e === void 0 && (e = []), n === void 0 && (n = !0);
567
- const i = Ot(t), r = i === ((o = t.ownerDocument) == null ? void 0 : o.body), s = E(i);
568
- return r ? e.concat(s, s.visualViewport || [], U(i) ? i : [], s.frameElement && n ? ft(s.frameElement) : []) : e.concat(i, ft(i, [], n));
569
- }
570
- function Tt(t) {
571
- const e = C(t);
572
- let n = parseFloat(e.width) || 0, o = parseFloat(e.height) || 0;
573
- const i = k(t), r = i ? t.offsetWidth : n, s = i ? t.offsetHeight : o, c = tt(n) !== r || tt(o) !== s;
574
- return c && (n = r, o = s), {
575
- width: n,
576
- height: o,
577
- $: c
578
- };
579
- }
580
- function Rt(t) {
581
- return N(t) ? t : t.contextElement;
582
- }
583
- function _(t) {
584
- const e = Rt(t);
585
- if (!k(e))
586
- return V(1);
587
- const n = e.getBoundingClientRect(), {
588
- width: o,
589
- height: i,
590
- $: r
591
- } = Tt(e);
592
- let s = (r ? tt(n.width) : n.width) / o, c = (r ? tt(n.height) : n.height) / i;
593
- return (!s || !Number.isFinite(s)) && (s = 1), (!c || !Number.isFinite(c)) && (c = 1), {
594
- x: s,
595
- y: c
596
- };
597
- }
598
- const Qt = /* @__PURE__ */ V(0);
599
- function Lt(t) {
600
- const e = E(t);
601
- return !mt() || !e.visualViewport ? Qt : {
602
- x: e.visualViewport.offsetLeft,
603
- y: e.visualViewport.offsetTop
604
- };
605
- }
606
- function Ut(t, e, n) {
607
- return e === void 0 && (e = !1), !n || e && n !== E(t) ? !1 : e;
608
- }
609
- function G(t, e, n, o) {
610
- e === void 0 && (e = !1), n === void 0 && (n = !1);
611
- const i = t.getBoundingClientRect(), r = Rt(t);
612
- let s = V(1);
613
- e && (o ? N(o) && (s = _(o)) : s = _(t));
614
- const c = Ut(r, n, o) ? Lt(r) : V(0);
615
- let l = (i.left + c.x) / s.x, f = (i.top + c.y) / s.y, p = i.width / s.x, d = i.height / s.y;
616
- if (r) {
617
- const m = E(r), a = o && N(o) ? E(o) : o;
618
- let u = m.frameElement;
619
- for (; u && o && a !== m; ) {
620
- const g = _(u), w = u.getBoundingClientRect(), h = C(u), y = w.left + (u.clientLeft + parseFloat(h.paddingLeft)) * g.x, x = w.top + (u.clientTop + parseFloat(h.paddingTop)) * g.y;
621
- l *= g.x, f *= g.y, p *= g.x, d *= g.y, l += y, f += x, u = E(u).frameElement;
622
- }
623
- }
624
- return nt({
625
- width: p,
626
- height: d,
627
- x: l,
628
- y: f
629
- });
630
- }
631
- function Zt(t) {
632
- let {
633
- rect: e,
634
- offsetParent: n,
635
- strategy: o
636
- } = t;
637
- const i = k(n), r = F(n);
638
- if (n === r)
639
- return e;
640
- let s = {
641
- scrollLeft: 0,
642
- scrollTop: 0
643
- }, c = V(1);
644
- const l = V(0);
645
- if ((i || !i && o !== "fixed") && ((B(n) !== "body" || U(r)) && (s = st(n)), k(n))) {
646
- const f = G(n);
647
- c = _(n), l.x = f.x + n.clientLeft, l.y = f.y + n.clientTop;
648
- }
649
- return {
650
- width: e.width * c.x,
651
- height: e.height * c.y,
652
- x: e.x * c.x - s.scrollLeft * c.x + l.x,
653
- y: e.y * c.y - s.scrollTop * c.y + l.y
654
- };
655
- }
656
- function te(t) {
657
- return Array.from(t.getClientRects());
658
- }
659
- function St(t) {
660
- return G(F(t)).left + st(t).scrollLeft;
661
- }
662
- function ee(t) {
663
- const e = F(t), n = st(t), o = t.ownerDocument.body, i = j(e.scrollWidth, e.clientWidth, o.scrollWidth, o.clientWidth), r = j(e.scrollHeight, e.clientHeight, o.scrollHeight, o.clientHeight);
664
- let s = -n.scrollLeft + St(t);
665
- const c = -n.scrollTop;
666
- return C(o).direction === "rtl" && (s += j(e.clientWidth, o.clientWidth) - i), {
667
- width: i,
668
- height: r,
669
- x: s,
670
- y: c
671
- };
672
- }
673
- function ne(t, e) {
674
- const n = E(t), o = F(t), i = n.visualViewport;
675
- let r = o.clientWidth, s = o.clientHeight, c = 0, l = 0;
676
- if (i) {
677
- r = i.width, s = i.height;
678
- const f = mt();
679
- (!f || f && e === "fixed") && (c = i.offsetLeft, l = i.offsetTop);
680
- }
681
- return {
682
- width: r,
683
- height: s,
684
- x: c,
685
- y: l
686
- };
687
- }
688
- function oe(t, e) {
689
- const n = G(t, !0, e === "fixed"), o = n.top + t.clientTop, i = n.left + t.clientLeft, r = k(t) ? _(t) : V(1), s = t.clientWidth * r.x, c = t.clientHeight * r.y, l = i * r.x, f = o * r.y;
690
- return {
691
- width: s,
692
- height: c,
693
- x: l,
694
- y: f
695
- };
696
- }
697
- function yt(t, e, n) {
698
- let o;
699
- if (e === "viewport")
700
- o = ne(t, n);
701
- else if (e === "document")
702
- o = ee(F(t));
703
- else if (N(e))
704
- o = oe(e, n);
705
- else {
706
- const i = Lt(t);
707
- o = P(b({}, e), {
708
- x: e.x - i.x,
709
- y: e.y - i.y
710
- });
711
- }
712
- return nt(o);
713
- }
714
- function Pt(t, e) {
715
- const n = X(t);
716
- return n === e || !N(n) || it(n) ? !1 : C(n).position === "fixed" || Pt(n, e);
717
- }
718
- function ie(t, e) {
719
- const n = e.get(t);
720
- if (n)
721
- return n;
722
- let o = ft(t, [], !1).filter((c) => N(c) && B(c) !== "body"), i = null;
723
- const r = C(t).position === "fixed";
724
- let s = r ? X(t) : t;
725
- for (; N(s) && !it(s); ) {
726
- const c = C(s), l = dt(s);
727
- !l && c.position === "fixed" && (i = null), (r ? !l && !i : !l && c.position === "static" && !!i && ["absolute", "fixed"].includes(i.position) || U(s) && !l && Pt(t, s)) ? o = o.filter((p) => p !== s) : i = c, s = X(s);
728
- }
729
- return e.set(t, o), o;
730
- }
731
- function se(t) {
732
- let {
733
- element: e,
734
- boundary: n,
735
- rootBoundary: o,
736
- strategy: i
737
- } = t;
738
- const s = [...n === "clippingAncestors" ? ie(e, this._c) : [].concat(n), o], c = s[0], l = s.reduce((f, p) => {
739
- const d = yt(e, p, i);
740
- return f.top = j(d.top, f.top), f.right = K(d.right, f.right), f.bottom = K(d.bottom, f.bottom), f.left = j(d.left, f.left), f;
741
- }, yt(e, c, i));
742
- return {
743
- width: l.right - l.left,
744
- height: l.bottom - l.top,
745
- x: l.left,
746
- y: l.top
747
- };
748
- }
749
- function re(t) {
750
- return Tt(t);
751
- }
752
- function ce(t, e, n) {
753
- const o = k(e), i = F(e), r = n === "fixed", s = G(t, !0, r, e);
754
- let c = {
755
- scrollLeft: 0,
756
- scrollTop: 0
757
- };
758
- const l = V(0);
759
- if (o || !o && !r)
760
- if ((B(e) !== "body" || U(i)) && (c = st(e)), o) {
761
- const f = G(e, !0, r, e);
762
- l.x = f.x + e.clientLeft, l.y = f.y + e.clientTop;
763
- } else
764
- i && (l.x = St(i));
765
- return {
766
- x: s.left + c.scrollLeft - l.x,
767
- y: s.top + c.scrollTop - l.y,
768
- width: s.width,
769
- height: s.height
770
- };
771
- }
772
- function bt(t, e) {
773
- return !k(t) || C(t).position === "fixed" ? null : e ? e(t) : t.offsetParent;
774
- }
775
- function kt(t, e) {
776
- const n = E(t);
777
- if (!k(t))
778
- return n;
779
- let o = bt(t, e);
780
- for (; o && Gt(o) && C(o).position === "static"; )
781
- o = bt(o, e);
782
- return o && (B(o) === "html" || B(o) === "body" && C(o).position === "static" && !dt(o)) ? n : o || Jt(t) || n;
783
- }
784
- const le = async function(t) {
785
- let {
786
- reference: e,
787
- floating: n,
788
- strategy: o
789
- } = t;
790
- const i = this.getOffsetParent || kt, r = this.getDimensions;
791
- return {
792
- reference: ce(e, await i(n), o),
793
- floating: b({
794
- x: 0,
795
- y: 0
796
- }, await r(n))
797
- };
798
- };
799
- function fe(t) {
800
- return C(t).direction === "rtl";
801
- }
802
- const ae = {
803
- convertOffsetParentRelativeRectToViewportRelativeRect: Zt,
804
- getDocumentElement: F,
805
- getClippingRect: se,
806
- getOffsetParent: kt,
807
- getElementRects: le,
808
- getClientRects: te,
809
- getDimensions: re,
810
- getScale: _,
811
- isElement: N,
812
- isRTL: fe
813
- }, ue = (t, e, n) => {
814
- const o = /* @__PURE__ */ new Map(), i = b({
815
- platform: ae
816
- }, n), r = P(b({}, i.platform), {
817
- _c: o
818
- });
819
- return Xt(t, e, P(b({}, i), {
820
- platform: r
821
- }));
822
- }, me = function(t, e = {}) {
823
- const n = t.nextElementSibling, o = n.querySelector(".tooltip-arrow"), i = [
824
- zt(6),
825
- qt(),
826
- Kt({
827
- padding: 5
828
- })
829
- ];
830
- o && i.push(
831
- Yt({
832
- element: o
833
- })
834
- );
835
- function r() {
836
- ue(t, n, {
837
- placement: e.placement || "top",
838
- middleware: i
839
- }).then(({ x: m, y: a, placement: u, middlewareData: g }) => {
840
- if (Object.assign(n.style, {
841
- left: "".concat(m, "px"),
842
- top: "".concat(a, "px")
843
- }), g.arrow) {
844
- const { x: w, y: h } = g.arrow, y = {
845
- top: "bottom",
846
- right: "left",
847
- bottom: "top",
848
- left: "right"
849
- }[u.split("-")[0]];
850
- Object.assign(o.style, {
851
- left: w != null ? "".concat(w, "px") : "",
852
- top: h != null ? "".concat(h, "px") : "",
853
- right: "",
854
- bottom: "",
855
- [y]: "-4px"
856
- });
857
- }
858
- });
859
- }
860
- const s = () => {
861
- n.style.display = "block", requestAnimationFrame(() => {
862
- n.classList.add("opacity-100", "visible");
863
- }), r();
864
- }, c = () => {
865
- n.style.display = "", n.classList.remove("opacity-100", "visible");
866
- }, l = () => {
867
- if (n.style.display === "block") {
868
- c();
869
- return;
870
- }
871
- s();
872
- };
873
- let f = ["mouseenter", "focus"], p = ["mouseleave", "blur"], d = [];
874
- e.trigger === "click" && (f = [], p = ["blur"], d = ["click"]), f.forEach((m) => {
875
- t.addEventListener(m, s);
876
- }), p.forEach((m) => {
877
- t.addEventListener(m, c);
878
- }), d.forEach((m) => {
879
- t.addEventListener(m, l);
880
- });
881
- };
882
- export {
883
- me as default
715
+ function isRTL(e) {
716
+ return getComputedStyle$1(e).direction === "rtl";
717
+ }
718
+ var platform = {
719
+ convertOffsetParentRelativeRectToViewportRelativeRect,
720
+ getDocumentElement,
721
+ getClippingRect,
722
+ getOffsetParent,
723
+ getElementRects,
724
+ getClientRects,
725
+ getDimensions,
726
+ getScale,
727
+ isElement,
728
+ isRTL
729
+ }, offset = offset$1, shift = shift$1, flip = flip$1, arrow = arrow$1, computePosition = (e, t, n) => {
730
+ let r = /* @__PURE__ */ new Map(), i = {
731
+ platform,
732
+ ...n
733
+ }, a = {
734
+ ...i.platform,
735
+ _c: r
736
+ };
737
+ return computePosition$1(e, t, {
738
+ ...i,
739
+ platform: a
740
+ });
741
+ }, src_default = function(e, t = {}) {
742
+ let n = e.nextElementSibling, r = n.querySelector(".tooltip-arrow"), i = [
743
+ offset(6),
744
+ flip(),
745
+ shift({ padding: 5 })
746
+ ];
747
+ r && i.push(arrow({ element: r }));
748
+ function a() {
749
+ computePosition(e, n, {
750
+ placement: t.placement || "top",
751
+ middleware: i
752
+ }).then(({ x: e, y: t, placement: i, middlewareData: a }) => {
753
+ if (Object.assign(n.style, {
754
+ left: `${e}px`,
755
+ top: `${t}px`
756
+ }), a.arrow) {
757
+ let { x: e, y: t } = a.arrow, n = {
758
+ top: "bottom",
759
+ right: "left",
760
+ bottom: "top",
761
+ left: "right"
762
+ }[i.split("-")[0]];
763
+ Object.assign(r.style, {
764
+ left: e == null ? "" : `${e}px`,
765
+ top: t == null ? "" : `${t}px`,
766
+ right: "",
767
+ bottom: "",
768
+ [n]: "-4px"
769
+ });
770
+ }
771
+ });
772
+ }
773
+ n.style.display = "block", a(), requestAnimationFrame(() => {
774
+ n.style.display = "";
775
+ });
776
+ let o = () => {
777
+ n.style.display = "block", requestAnimationFrame(() => {
778
+ n.style.opacity = "1", n.style.visibility = "visible";
779
+ }), a();
780
+ }, s = () => {
781
+ n.style.display = "", n.style.opacity = "", n.style.visibility = "";
782
+ }, c = () => {
783
+ if (n.style.display === "block") {
784
+ s();
785
+ return;
786
+ }
787
+ o();
788
+ }, l = ["mouseenter", "focus"], u = ["mouseleave", "blur"], d = [];
789
+ if (t.trigger === "click" && (l = [], u = ["blur"], d = ["click"]), d.includes("click")) {
790
+ let t = (r) => {
791
+ !n.contains(r.target) && !e.contains(r.target) && (s(), document.removeEventListener("click", t));
792
+ };
793
+ e.addEventListener("click", () => {
794
+ document.addEventListener("click", t);
795
+ });
796
+ }
797
+ l.forEach((t) => {
798
+ e.addEventListener(t, o);
799
+ }), u.forEach((t) => {
800
+ e.addEventListener(t, s);
801
+ }), d.forEach((t) => {
802
+ e.addEventListener(t, c);
803
+ });
884
804
  };
805
+ export { src_default as default };