wj-elements 0.1.32 → 0.1.34

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/localize.js CHANGED
@@ -1,7 +1,9 @@
1
- const n = /* @__PURE__ */ new Map();
2
- class s {
1
+ class r {
3
2
  constructor(t) {
4
- this.element = t, this.languages = n, this.lang = this.element.lang || document.documentElement.lang || "sk", this.dir = this.element.dir || document.documentElement.dir || "ltr", this.setLanguage();
3
+ this.element = t, this.lang = this.element.lang || document.documentElement.lang || "sk", this.dir = this.element.dir || document.documentElement.dir || "ltr", this.setLanguage();
4
+ }
5
+ get languages() {
6
+ return window.translations;
5
7
  }
6
8
  // Nastavenie aktuálneho jazyka
7
9
  setLanguage() {
@@ -20,24 +22,24 @@ class s {
20
22
  formatDate(t) {
21
23
  return new Intl.DateTimeFormat(this.currentLang).format(new Date(t));
22
24
  }
23
- relativeTime(t = 0, e, r = { numeric: "auto" }) {
24
- return new Intl.RelativeTimeFormat(this.currentLang, r).format(t, e);
25
+ relativeTime(t = 0, e, a = { numeric: "auto" }) {
26
+ return new Intl.RelativeTimeFormat(this.currentLang, a).format(t, e);
25
27
  }
26
28
  }
27
- function i(...a) {
28
- a.map((t) => {
29
+ function s(...n) {
30
+ n.map((t) => {
29
31
  const e = t.code.toLowerCase();
30
- n.has(e) ? n.set(e, { ...n.get(e), ...t }) : n.set(e, t);
32
+ translations.has(e) ? translations.set(e, { ...translations.get(e), ...t }) : translations.set(e, t);
31
33
  });
32
34
  }
33
- class o extends s {
35
+ class i extends r {
34
36
  constructor(t) {
35
37
  super(t);
36
38
  }
37
39
  static registerTranslation(...t) {
38
- i(...t);
40
+ s(...t);
39
41
  }
40
42
  }
41
43
  export {
42
- o as Localizer
44
+ i as Localizer
43
45
  };
@@ -1,6 +1,6 @@
1
1
  var Ot = Object.defineProperty;
2
2
  var Lt = (t, e, n) => e in t ? Ot(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var ut = (t, e, n) => (Lt(t, typeof e != "symbol" ? e + "" : e, n), n);
3
+ var st = (t, e, n) => (Lt(t, typeof e != "symbol" ? e + "" : e, n), n);
4
4
  import Tt, { event as U } from "./wje-element.js";
5
5
  const N = Math.min, R = Math.max, Z = Math.round, Q = Math.floor, B = (t) => ({
6
6
  x: t,
@@ -14,7 +14,7 @@ const N = Math.min, R = Math.max, Z = Math.round, Q = Math.floor, B = (t) => ({
14
14
  start: "end",
15
15
  end: "start"
16
16
  };
17
- function Dt(t, e, n) {
17
+ function kt(t, e, n) {
18
18
  return R(t, N(e, n));
19
19
  }
20
20
  function K(t, e) {
@@ -23,32 +23,32 @@ function K(t, e) {
23
23
  function j(t) {
24
24
  return t.split("-")[0];
25
25
  }
26
- function _(t) {
26
+ function I(t) {
27
27
  return t.split("-")[1];
28
28
  }
29
- function kt(t) {
29
+ function Dt(t) {
30
30
  return t === "x" ? "y" : "x";
31
31
  }
32
- function rt(t) {
32
+ function ct(t) {
33
33
  return t === "y" ? "height" : "width";
34
34
  }
35
35
  function nt(t) {
36
36
  return ["top", "bottom"].includes(j(t)) ? "y" : "x";
37
37
  }
38
- function ct(t) {
39
- return kt(nt(t));
38
+ function lt(t) {
39
+ return Dt(nt(t));
40
40
  }
41
41
  function Ht(t, e, n) {
42
42
  n === void 0 && (n = !1);
43
- const o = _(t), i = ct(t), s = rt(i);
43
+ const o = I(t), i = lt(t), s = ct(i);
44
44
  let r = i === "x" ? o === (n ? "end" : "start") ? "right" : "left" : o === "start" ? "bottom" : "top";
45
45
  return e.reference[s] > e.floating[s] && (r = tt(r)), [r, tt(r)];
46
46
  }
47
47
  function Wt(t) {
48
48
  const e = tt(t);
49
- return [st(t), e, st(e)];
49
+ return [rt(t), e, rt(e)];
50
50
  }
51
- function st(t) {
51
+ function rt(t) {
52
52
  return t.replace(/start|end/g, (e) => St[e]);
53
53
  }
54
54
  function Mt(t, e, n) {
@@ -65,9 +65,9 @@ function Mt(t, e, n) {
65
65
  }
66
66
  }
67
67
  function Ft(t, e, n, o) {
68
- const i = _(t);
68
+ const i = I(t);
69
69
  let s = Mt(j(t), n === "start", o);
70
- return i && (s = s.map((r) => r + "-" + i), e && (s = s.concat(s.map(st)))), s;
70
+ return i && (s = s.map((r) => r + "-" + i), e && (s = s.concat(s.map(rt)))), s;
71
71
  }
72
72
  function tt(t) {
73
73
  return t.replace(/left|right|bottom|top/g, (e) => Pt[e]);
@@ -103,7 +103,7 @@ function ht(t, e, n) {
103
103
  reference: o,
104
104
  floating: i
105
105
  } = t;
106
- const s = nt(e), r = ct(e), l = rt(r), c = j(e), a = s === "y", d = o.x + o.width / 2 - i.width / 2, h = o.y + o.height / 2 - i.height / 2, p = o[l] / 2 - i[l] / 2;
106
+ const s = nt(e), r = lt(e), l = ct(r), c = j(e), a = s === "y", d = o.x + o.width / 2 - i.width / 2, h = o.y + o.height / 2 - i.height / 2, p = o[l] / 2 - i[l] / 2;
107
107
  let f;
108
108
  switch (c) {
109
109
  case "top":
@@ -136,7 +136,7 @@ function ht(t, e, n) {
136
136
  y: o.y
137
137
  };
138
138
  }
139
- switch (_(e)) {
139
+ switch (I(e)) {
140
140
  case "start":
141
141
  f[r] -= p * (n && a ? -1 : 1);
142
142
  break;
@@ -167,7 +167,7 @@ const Bt = async (t, e, n) => {
167
167
  fn: g
168
168
  } = l[m], {
169
169
  x,
170
- y,
170
+ y: b,
171
171
  data: A,
172
172
  reset: v
173
173
  } = await g({
@@ -184,7 +184,7 @@ const Bt = async (t, e, n) => {
184
184
  floating: e
185
185
  }
186
186
  });
187
- if (d = x ?? d, h = y ?? h, f = {
187
+ if (d = x ?? d, h = b ?? h, f = {
188
188
  ...f,
189
189
  [w]: {
190
190
  ...f[w],
@@ -235,7 +235,7 @@ async function wt(t, e) {
235
235
  ...r.floating,
236
236
  x: o,
237
237
  y: i
238
- } : r.reference, y = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(l.floating)), A = await (s.isElement == null ? void 0 : s.isElement(y)) ? await (s.getScale == null ? void 0 : s.getScale(y)) || {
238
+ } : r.reference, b = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(l.floating)), A = await (s.isElement == null ? void 0 : s.isElement(b)) ? await (s.getScale == null ? void 0 : s.getScale(b)) || {
239
239
  x: 1,
240
240
  y: 1
241
241
  } : {
@@ -243,7 +243,7 @@ async function wt(t, e) {
243
243
  y: 1
244
244
  }, v = et(s.convertOffsetParentRelativeRectToViewportRelativeRect ? await s.convertOffsetParentRelativeRectToViewportRelativeRect({
245
245
  rect: x,
246
- offsetParent: y,
246
+ offsetParent: b,
247
247
  strategy: c
248
248
  }) : x);
249
249
  return {
@@ -274,20 +274,20 @@ const Vt = (t) => ({
274
274
  const h = gt(d), p = {
275
275
  x: n,
276
276
  y: o
277
- }, f = ct(i), u = rt(f), m = await r.getDimensions(a), w = f === "y", g = w ? "top" : "left", x = w ? "bottom" : "right", y = w ? "clientHeight" : "clientWidth", A = s.reference[u] + s.reference[f] - p[f] - s.floating[u], v = p[f] - s.reference[f], b = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(a));
278
- let E = b ? b[y] : 0;
279
- (!E || !await (r.isElement == null ? void 0 : r.isElement(b))) && (E = l.floating[y] || s.floating[u]);
280
- const P = A / 2 - v / 2, F = E / 2 - m[u] / 2 - 1, Y = N(h[g], F), X = N(h[x], F), L = Y, q = E - m[u] - X, C = E / 2 - m[u] / 2 + P, S = Dt(L, C, q), D = !c.arrow && _(i) != null && C != S && s.reference[u] / 2 - (C < L ? Y : X) - m[u] / 2 < 0, H = D ? C < L ? C - L : C - q : 0;
277
+ }, f = lt(i), u = ct(f), m = await r.getDimensions(a), w = f === "y", g = w ? "top" : "left", x = w ? "bottom" : "right", b = w ? "clientHeight" : "clientWidth", A = s.reference[u] + s.reference[f] - p[f] - s.floating[u], v = p[f] - s.reference[f], y = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(a));
278
+ let E = y ? y[b] : 0;
279
+ (!E || !await (r.isElement == null ? void 0 : r.isElement(y))) && (E = l.floating[b] || s.floating[u]);
280
+ const P = A / 2 - v / 2, F = E / 2 - m[u] / 2 - 1, Y = N(h[g], F), X = N(h[x], F), L = Y, q = E - m[u] - X, C = E / 2 - m[u] / 2 + P, S = kt(L, C, q), k = !c.arrow && I(i) != null && C != S && s.reference[u] / 2 - (C < L ? Y : X) - m[u] / 2 < 0, H = k ? C < L ? C - L : C - q : 0;
281
281
  return {
282
282
  [f]: p[f] + H,
283
283
  data: {
284
284
  [f]: S,
285
285
  centerOffset: C - S - H,
286
- ...D && {
286
+ ...k && {
287
287
  alignmentOffset: H
288
288
  }
289
289
  },
290
- reset: D
290
+ reset: k
291
291
  };
292
292
  }
293
293
  }), jt = function(t) {
@@ -314,13 +314,13 @@ const Vt = (t) => ({
314
314
  } = K(t, e);
315
315
  if ((n = s.arrow) != null && n.alignmentOffset)
316
316
  return {};
317
- const g = j(i), x = j(l) === l, y = await (c.isRTL == null ? void 0 : c.isRTL(a.floating)), A = p || (x || !m ? [tt(l)] : Wt(l));
318
- !p && u !== "none" && A.push(...Ft(l, m, u, y));
319
- const v = [l, ...A], b = await wt(e, w), E = [];
317
+ const g = j(i), x = j(l) === l, b = await (c.isRTL == null ? void 0 : c.isRTL(a.floating)), A = p || (x || !m ? [tt(l)] : Wt(l));
318
+ !p && u !== "none" && A.push(...Ft(l, m, u, b));
319
+ const v = [l, ...A], y = await wt(e, w), E = [];
320
320
  let P = ((o = s.flip) == null ? void 0 : o.overflows) || [];
321
- if (d && E.push(b[g]), h) {
322
- const L = Ht(i, r, y);
323
- E.push(b[L[0]], b[L[1]]);
321
+ if (d && E.push(y[g]), h) {
322
+ const L = Ht(i, r, b);
323
+ E.push(y[L[0]], y[L[1]]);
324
324
  }
325
325
  if (P = [...P, {
326
326
  placement: i,
@@ -338,12 +338,12 @@ const Vt = (t) => ({
338
338
  placement: q
339
339
  }
340
340
  };
341
- let C = (Y = P.filter((S) => S.overflows[0] <= 0).sort((S, D) => S.overflows[1] - D.overflows[1])[0]) == null ? void 0 : Y.placement;
341
+ let C = (Y = P.filter((S) => S.overflows[0] <= 0).sort((S, k) => S.overflows[1] - k.overflows[1])[0]) == null ? void 0 : Y.placement;
342
342
  if (!C)
343
343
  switch (f) {
344
344
  case "bestFit": {
345
345
  var X;
346
- const S = (X = P.map((D) => [D.placement, D.overflows.filter((H) => H > 0).reduce((H, Rt) => H + Rt, 0)]).sort((D, H) => D[1] - H[1])[0]) == null ? void 0 : X[0];
346
+ const S = (X = P.map((k) => [k.placement, k.overflows.filter((H) => H > 0).reduce((H, Rt) => H + Rt, 0)]).sort((k, H) => k[1] - H[1])[0]) == null ? void 0 : X[0];
347
347
  S && (C = S);
348
348
  break;
349
349
  }
@@ -367,7 +367,7 @@ async function zt(t, e) {
367
367
  placement: n,
368
368
  platform: o,
369
369
  elements: i
370
- } = t, s = await (o.isRTL == null ? void 0 : o.isRTL(i.floating)), r = j(n), l = _(n), c = nt(n) === "y", a = ["left", "top"].includes(r) ? -1 : 1, d = s && c ? -1 : 1, h = K(e, t);
370
+ } = t, s = await (o.isRTL == null ? void 0 : o.isRTL(i.floating)), r = j(n), l = I(n), c = nt(n) === "y", a = ["left", "top"].includes(r) ? -1 : 1, d = s && c ? -1 : 1, h = K(e, t);
371
371
  let {
372
372
  mainAxis: p,
373
373
  crossAxis: f,
@@ -406,7 +406,7 @@ const $t = function(t) {
406
406
  };
407
407
  }
408
408
  };
409
- }, It = function(t) {
409
+ }, _t = function(t) {
410
410
  return t === void 0 && (t = {}), {
411
411
  name: "size",
412
412
  options: t,
@@ -420,29 +420,29 @@ const $t = function(t) {
420
420
  apply: r = () => {
421
421
  },
422
422
  ...l
423
- } = K(t, e), c = await wt(e, l), a = j(n), d = _(n), h = nt(n) === "y", {
423
+ } = K(t, e), c = await wt(e, l), a = j(n), d = I(n), h = nt(n) === "y", {
424
424
  width: p,
425
425
  height: f
426
426
  } = o.floating;
427
427
  let u, m;
428
428
  a === "top" || a === "bottom" ? (u = a, m = d === (await (i.isRTL == null ? void 0 : i.isRTL(s.floating)) ? "start" : "end") ? "left" : "right") : (m = a, u = d === "end" ? "top" : "bottom");
429
429
  const w = f - c[u], g = p - c[m], x = !e.middlewareData.shift;
430
- let y = w, A = g;
430
+ let b = w, A = g;
431
431
  if (h) {
432
- const b = p - c.left - c.right;
433
- A = d || x ? N(g, b) : b;
432
+ const y = p - c.left - c.right;
433
+ A = d || x ? N(g, y) : y;
434
434
  } else {
435
- const b = f - c.top - c.bottom;
436
- y = d || x ? N(w, b) : b;
435
+ const y = f - c.top - c.bottom;
436
+ b = d || x ? N(w, y) : y;
437
437
  }
438
438
  if (x && !d) {
439
- const b = R(c.left, 0), E = R(c.right, 0), P = R(c.top, 0), F = R(c.bottom, 0);
440
- h ? A = p - 2 * (b !== 0 || E !== 0 ? b + E : R(c.left, c.right)) : y = f - 2 * (P !== 0 || F !== 0 ? P + F : R(c.top, c.bottom));
439
+ const y = R(c.left, 0), E = R(c.right, 0), P = R(c.top, 0), F = R(c.bottom, 0);
440
+ h ? A = p - 2 * (y !== 0 || E !== 0 ? y + E : R(c.left, c.right)) : b = f - 2 * (P !== 0 || F !== 0 ? P + F : R(c.top, c.bottom));
441
441
  }
442
442
  await r({
443
443
  ...e,
444
444
  availableWidth: A,
445
- availableHeight: y
445
+ availableHeight: b
446
446
  });
447
447
  const v = await i.getDimensions(s.floating);
448
448
  return p !== v.width || f !== v.height ? {
@@ -470,7 +470,7 @@ function vt(t) {
470
470
  function W(t) {
471
471
  return t instanceof Element || t instanceof O(t).Element;
472
472
  }
473
- function k(t) {
473
+ function D(t) {
474
474
  return t instanceof HTMLElement || t instanceof O(t).HTMLElement;
475
475
  }
476
476
  function dt(t) {
@@ -485,23 +485,23 @@ function G(t) {
485
485
  } = T(t);
486
486
  return /auto|scroll|overlay|hidden|clip/.test(e + o + n) && !["inline", "contents"].includes(i);
487
487
  }
488
- function _t(t) {
488
+ function It(t) {
489
489
  return ["table", "td", "th"].includes(V(t));
490
490
  }
491
- function lt(t) {
492
- const e = at(), n = T(t);
491
+ function at(t) {
492
+ const e = ft(), n = T(t);
493
493
  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));
494
494
  }
495
495
  function Yt(t) {
496
- let e = I(t);
497
- for (; k(e) && !ot(e); ) {
498
- if (lt(e))
496
+ let e = _(t);
497
+ for (; D(e) && !ot(e); ) {
498
+ if (at(e))
499
499
  return e;
500
- e = I(e);
500
+ e = _(e);
501
501
  }
502
502
  return null;
503
503
  }
504
- function at() {
504
+ function ft() {
505
505
  return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
506
506
  }
507
507
  function ot(t) {
@@ -519,7 +519,7 @@ function it(t) {
519
519
  scrollTop: t.pageYOffset
520
520
  };
521
521
  }
522
- function I(t) {
522
+ function _(t) {
523
523
  if (V(t) === "html")
524
524
  return t;
525
525
  const e = (
@@ -532,8 +532,8 @@ function I(t) {
532
532
  return dt(e) ? e.host : e;
533
533
  }
534
534
  function xt(t) {
535
- const e = I(t);
536
- return ot(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : k(e) && G(e) ? e : xt(e);
535
+ const e = _(t);
536
+ return ot(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : D(e) && G(e) ? e : xt(e);
537
537
  }
538
538
  function J(t, e, n) {
539
539
  var o;
@@ -541,28 +541,28 @@ function J(t, e, n) {
541
541
  const i = xt(t), s = i === ((o = t.ownerDocument) == null ? void 0 : o.body), r = O(i);
542
542
  return s ? e.concat(r, r.visualViewport || [], G(i) ? i : [], r.frameElement && n ? J(r.frameElement) : []) : e.concat(i, J(i, [], n));
543
543
  }
544
- function yt(t) {
544
+ function bt(t) {
545
545
  const e = T(t);
546
546
  let n = parseFloat(e.width) || 0, o = parseFloat(e.height) || 0;
547
- const i = k(t), s = i ? t.offsetWidth : n, r = i ? t.offsetHeight : o, l = Z(n) !== s || Z(o) !== r;
547
+ const i = D(t), s = i ? t.offsetWidth : n, r = i ? t.offsetHeight : o, l = Z(n) !== s || Z(o) !== r;
548
548
  return l && (n = s, o = r), {
549
549
  width: n,
550
550
  height: o,
551
551
  $: l
552
552
  };
553
553
  }
554
- function ft(t) {
554
+ function ut(t) {
555
555
  return W(t) ? t : t.contextElement;
556
556
  }
557
557
  function $(t) {
558
- const e = ft(t);
559
- if (!k(e))
558
+ const e = ut(t);
559
+ if (!D(e))
560
560
  return B(1);
561
561
  const n = e.getBoundingClientRect(), {
562
562
  width: o,
563
563
  height: i,
564
564
  $: s
565
- } = yt(e);
565
+ } = bt(e);
566
566
  let r = (s ? Z(n.width) : n.width) / o, l = (s ? Z(n.height) : n.height) / i;
567
567
  return (!r || !Number.isFinite(r)) && (r = 1), (!l || !Number.isFinite(l)) && (l = 1), {
568
568
  x: r,
@@ -570,9 +570,9 @@ function $(t) {
570
570
  };
571
571
  }
572
572
  const Xt = /* @__PURE__ */ B(0);
573
- function bt(t) {
573
+ function yt(t) {
574
574
  const e = O(t);
575
- return !at() || !e.visualViewport ? Xt : {
575
+ return !ft() || !e.visualViewport ? Xt : {
576
576
  x: e.visualViewport.offsetLeft,
577
577
  y: e.visualViewport.offsetTop
578
578
  };
@@ -582,17 +582,17 @@ function qt(t, e, n) {
582
582
  }
583
583
  function z(t, e, n, o) {
584
584
  e === void 0 && (e = !1), n === void 0 && (n = !1);
585
- const i = t.getBoundingClientRect(), s = ft(t);
585
+ const i = t.getBoundingClientRect(), s = ut(t);
586
586
  let r = B(1);
587
587
  e && (o ? W(o) && (r = $(o)) : r = $(t));
588
- const l = qt(s, n, o) ? bt(s) : B(0);
588
+ const l = qt(s, n, o) ? yt(s) : B(0);
589
589
  let c = (i.left + l.x) / r.x, a = (i.top + l.y) / r.y, d = i.width / r.x, h = i.height / r.y;
590
590
  if (s) {
591
591
  const p = O(s), f = o && W(o) ? O(o) : o;
592
592
  let u = p.frameElement;
593
593
  for (; u && o && f !== p; ) {
594
- const m = $(u), w = u.getBoundingClientRect(), g = T(u), x = w.left + (u.clientLeft + parseFloat(g.paddingLeft)) * m.x, y = w.top + (u.clientTop + parseFloat(g.paddingTop)) * m.y;
595
- c *= m.x, a *= m.y, d *= m.x, h *= m.y, c += x, a += y, u = O(u).frameElement;
594
+ const m = $(u), w = u.getBoundingClientRect(), g = T(u), x = w.left + (u.clientLeft + parseFloat(g.paddingLeft)) * m.x, b = w.top + (u.clientTop + parseFloat(g.paddingTop)) * m.y;
595
+ c *= m.x, a *= m.y, d *= m.x, h *= m.y, c += x, a += b, u = O(u).frameElement;
596
596
  }
597
597
  }
598
598
  return et({
@@ -608,7 +608,7 @@ function Ut(t) {
608
608
  offsetParent: n,
609
609
  strategy: o
610
610
  } = t;
611
- const i = k(n), s = M(n);
611
+ const i = D(n), s = M(n);
612
612
  if (n === s)
613
613
  return e;
614
614
  let r = {
@@ -616,7 +616,7 @@ function Ut(t) {
616
616
  scrollTop: 0
617
617
  }, l = B(1);
618
618
  const c = B(0);
619
- if ((i || !i && o !== "fixed") && ((V(n) !== "body" || G(s)) && (r = it(n)), k(n))) {
619
+ if ((i || !i && o !== "fixed") && ((V(n) !== "body" || G(s)) && (r = it(n)), D(n))) {
620
620
  const a = z(n);
621
621
  l = $(n), c.x = a.x + n.clientLeft, c.y = a.y + n.clientTop;
622
622
  }
@@ -649,7 +649,7 @@ function Gt(t, e) {
649
649
  let s = o.clientWidth, r = o.clientHeight, l = 0, c = 0;
650
650
  if (i) {
651
651
  s = i.width, r = i.height;
652
- const a = at();
652
+ const a = ft();
653
653
  (!a || a && e === "fixed") && (l = i.offsetLeft, c = i.offsetTop);
654
654
  }
655
655
  return {
@@ -660,7 +660,7 @@ function Gt(t, e) {
660
660
  };
661
661
  }
662
662
  function Qt(t, e) {
663
- const n = z(t, !0, e === "fixed"), o = n.top + t.clientTop, i = n.left + t.clientLeft, s = k(t) ? $(t) : B(1), r = t.clientWidth * s.x, l = t.clientHeight * s.y, c = i * s.x, a = o * s.y;
663
+ const n = z(t, !0, e === "fixed"), o = n.top + t.clientTop, i = n.left + t.clientLeft, s = D(t) ? $(t) : B(1), r = t.clientWidth * s.x, l = t.clientHeight * s.y, c = i * s.x, a = o * s.y;
664
664
  return {
665
665
  width: r,
666
666
  height: l,
@@ -677,7 +677,7 @@ function pt(t, e, n) {
677
677
  else if (W(e))
678
678
  o = Qt(e, n);
679
679
  else {
680
- const i = bt(t);
680
+ const i = yt(t);
681
681
  o = {
682
682
  ...e,
683
683
  x: e.x - i.x,
@@ -687,7 +687,7 @@ function pt(t, e, n) {
687
687
  return et(o);
688
688
  }
689
689
  function Et(t, e) {
690
- const n = I(t);
690
+ const n = _(t);
691
691
  return n === e || !W(n) || ot(n) ? !1 : T(n).position === "fixed" || Et(n, e);
692
692
  }
693
693
  function Zt(t, e) {
@@ -696,10 +696,10 @@ function Zt(t, e) {
696
696
  return n;
697
697
  let o = J(t, [], !1).filter((l) => W(l) && V(l) !== "body"), i = null;
698
698
  const s = T(t).position === "fixed";
699
- let r = s ? I(t) : t;
699
+ let r = s ? _(t) : t;
700
700
  for (; W(r) && !ot(r); ) {
701
- const l = T(r), c = lt(r);
702
- !c && l.position === "fixed" && (i = null), (s ? !c && !i : !c && l.position === "static" && !!i && ["absolute", "fixed"].includes(i.position) || G(r) && !c && Et(t, r)) ? o = o.filter((d) => d !== r) : i = l, r = I(r);
701
+ const l = T(r), c = at(r);
702
+ !c && l.position === "fixed" && (i = null), (s ? !c && !i : !c && l.position === "static" && !!i && ["absolute", "fixed"].includes(i.position) || G(r) && !c && Et(t, r)) ? o = o.filter((d) => d !== r) : i = l, r = _(r);
703
703
  }
704
704
  return e.set(t, o), o;
705
705
  }
@@ -722,10 +722,10 @@ function te(t) {
722
722
  };
723
723
  }
724
724
  function ee(t) {
725
- return yt(t);
725
+ return bt(t);
726
726
  }
727
727
  function ne(t, e, n) {
728
- const o = k(e), i = M(e), s = n === "fixed", r = z(t, !0, s, e);
728
+ const o = D(e), i = M(e), s = n === "fixed", r = z(t, !0, s, e);
729
729
  let l = {
730
730
  scrollLeft: 0,
731
731
  scrollTop: 0
@@ -745,16 +745,16 @@ function ne(t, e, n) {
745
745
  };
746
746
  }
747
747
  function mt(t, e) {
748
- return !k(t) || T(t).position === "fixed" ? null : e ? e(t) : t.offsetParent;
748
+ return !D(t) || T(t).position === "fixed" ? null : e ? e(t) : t.offsetParent;
749
749
  }
750
750
  function Ct(t, e) {
751
751
  const n = O(t);
752
- if (!k(t))
752
+ if (!D(t))
753
753
  return n;
754
754
  let o = mt(t, e);
755
- for (; o && _t(o) && T(o).position === "static"; )
755
+ for (; o && It(o) && T(o).position === "static"; )
756
756
  o = mt(o, e);
757
- return o && (V(o) === "html" || V(o) === "body" && T(o).position === "static" && !lt(o)) ? n : o || Yt(t) || n;
757
+ return o && (V(o) === "html" || V(o) === "body" && T(o).position === "static" && !at(o)) ? n : o || Yt(t) || n;
758
758
  }
759
759
  const oe = async function(t) {
760
760
  let {
@@ -807,17 +807,17 @@ function re(t, e) {
807
807
  rootMargin: -f + "px " + -u + "px " + -m + "px " + -w + "px",
808
808
  threshold: R(0, N(1, c)) || 1
809
809
  };
810
- let y = !0;
810
+ let b = !0;
811
811
  function A(v) {
812
- const b = v[0].intersectionRatio;
813
- if (b !== c) {
814
- if (!y)
812
+ const y = v[0].intersectionRatio;
813
+ if (y !== c) {
814
+ if (!b)
815
815
  return r();
816
- b ? r(!1, b) : o = setTimeout(() => {
816
+ y ? r(!1, y) : o = setTimeout(() => {
817
817
  r(!1, 1e-7);
818
818
  }, 100);
819
819
  }
820
- y = !1;
820
+ b = !1;
821
821
  }
822
822
  try {
823
823
  n = new IntersectionObserver(A, {
@@ -840,7 +840,7 @@ function ce(t, e, n, o) {
840
840
  elementResize: r = typeof ResizeObserver == "function",
841
841
  layoutShift: l = typeof IntersectionObserver == "function",
842
842
  animationFrame: c = !1
843
- } = o, a = ft(t), d = i || s ? [...a ? J(a) : [], ...J(e)] : [];
843
+ } = o, a = ut(t), d = i || s ? [...a ? J(a) : [], ...J(e)] : [];
844
844
  d.forEach((g) => {
845
845
  i && g.addEventListener("scroll", n, {
846
846
  passive: !0
@@ -887,7 +887,10 @@ class he extends Tt {
887
887
  */
888
888
  constructor() {
889
889
  super();
890
- ut(this, "className", "Popup");
890
+ st(this, "className", "Popup");
891
+ st(this, "clickHandler", (n) => {
892
+ n.composedPath().some((i) => i === this) || this.hasAttribute("active") && this.removeAttribute("active");
893
+ });
891
894
  this._manual = !1;
892
895
  }
893
896
  /**
@@ -940,6 +943,9 @@ class he extends Tt {
940
943
  attributeChangedCallback(n, o, i) {
941
944
  n === "active" && (this.hasAttribute(n) ? this.show() : this.hide());
942
945
  }
946
+ beforeDraw(n, o, i) {
947
+ document.removeEventListener("click", this.clickHandler);
948
+ }
943
949
  /**
944
950
  * Draws the component.
945
951
  *
@@ -968,14 +974,12 @@ class he extends Tt {
968
974
  setAnchor() {
969
975
  if (this.slotAnchor && typeof this.anchor == "string") {
970
976
  const n = this.getRootNode();
971
- this.anchorEl = n.getElementById(this.anchor);
977
+ this.anchorEl = n.querySelector("#" + this.anchor);
972
978
  } else
973
979
  this.slotAnchor instanceof HTMLSlotElement && (this.anchorEl = this.slotAnchor.assignedElements({ flatten: !0 })[0]);
974
980
  this.manual && U.addListener(this.anchorEl, "click", null, (n) => {
975
981
  this.hasAttribute("disabled") || this.showHide();
976
- }, { stopPropagation: !0 }), document.addEventListener("click", (n) => {
977
- n.composedPath().some((i) => i === this) || this.hasAttribute("active") && this.removeAttribute("active");
978
- });
982
+ }, { stopPropagation: !0 }), document.addEventListener("click", this.clickHandler, { capture: !0 });
979
983
  }
980
984
  /**
981
985
  * Toggles the active attribute of the popup.
@@ -998,7 +1002,7 @@ class he extends Tt {
998
1002
  ), n.push(
999
1003
  jt()
1000
1004
  ), this.hasAttribute("size") && n.push(
1001
- It({
1005
+ _t({
1002
1006
  apply({ availableWidth: o, availableHeight: i, elements: s }) {
1003
1007
  Object.assign(s.floating.style, {
1004
1008
  width: `${s.reference.offsetWidth}px`