import '@das-fed/upf-ui/packages/components/text-tooltip/style.css';
import { createStyle as Mn } from "@das-fed/upf-utils/style";
import { ref as Ee } from "vue";
import { useZIndex as Vn } from "@das-fed/upf-utils/hooks/popup-manager/use-zindex";
import { currentLang as wo } from "@das-fed/upf-web/packages/i18n/index";
/*!
 * OverlayScrollbars
 * Version: 2.6.1
 *
 * Copyright (c) Rene Haas | KingSora.
 * https://github.com/KingSora
 *
 * Released under the MIT license.
 */
const xt = (t, e) => {
  const { o, u: n, _: s } = t;
  let c = o, r;
  const l = (i, f) => {
    const p = c, T = i, H = f || (n ? !n(p, T) : p !== T);
    return (H || s) && (c = T, r = p), [c, H, r];
  };
  return [e ? (i) => l(e(c, r), i) : l, (i) => [c, !!i, r]];
}, ro = typeof window < "u", gt = ro ? window : {}, ge = Math.max, Nn = Math.min, Ue = Math.round, Yo = gt.cancelAnimationFrame, qo = gt.requestAnimationFrame, je = gt.setTimeout, Xe = gt.clearTimeout, $e = (t) => typeof gt[t] < "u" ? gt[t] : void 0, zn = $e("MutationObserver"), So = $e("IntersectionObserver"), xe = $e("ResizeObserver"), Ge = $e("ScrollTimeline"), Zo = ro && Node.ELEMENT_NODE, { toString: Bn, hasOwnProperty: ze } = Object.prototype, _n = /^\[object (.+)\]$/, ae = (t) => t === void 0, Oe = (t) => t === null, Fn = (t) => ae(t) || Oe(t) ? `${t}` : Bn.call(t).replace(_n, "$1").toLowerCase(), Et = (t) => typeof t == "number", Ae = (t) => typeof t == "string", Ko = (t) => typeof t == "boolean", $t = (t) => typeof t == "function", St = (t) => Array.isArray(t), le = (t) => typeof t == "object" && !St(t) && !Oe(t), Le = (t) => {
  const e = !!t && t.length, o = Et(e) && e > -1 && e % 1 == 0;
  return St(t) || !$t(t) && o ? e > 0 && le(t) ? e - 1 in t : !0 : !1;
}, we = (t) => {
  if (!t || !le(t) || Fn(t) !== "object")
    return !1;
  let e;
  const o = "constructor", n = t[o], s = n && n.prototype, c = ze.call(t, o), r = s && ze.call(s, "isPrototypeOf");
  if (n && !c && !r)
    return !1;
  for (e in t)
    ;
  return ae(e) || ze.call(t, e);
}, ce = (t) => {
  const e = HTMLElement;
  return t ? e ? t instanceof e : t.nodeType === Zo : !1;
}, He = (t) => {
  const e = Element;
  return t ? e ? t instanceof e : t.nodeType === Zo : !1;
};
function q(t, e) {
  if (Le(t))
    for (let o = 0; o < t.length && e(t[o], o, t) !== !1; o++)
      ;
  else t && q(Object.keys(t), (o) => e(t[o], o, t));
  return t;
}
const De = (t, e) => t.indexOf(e) >= 0, Ot = (t, e) => t.concat(e), Q = (t, e, o) => (!Ae(e) && Le(e) ? Array.prototype.push.apply(t, e) : t.push(e), t), Ft = (t) => Array.from(t || []), Jo = (t) => St(t) ? t : [t], Ye = (t) => !!t && !t.length, Co = (t) => Ft(new Set(t)), bt = (t, e, o) => {
  q(t, (s) => s && s.apply(void 0, e || [])), !o && (t.length = 0);
}, Qo = "paddingTop", tn = "paddingRight", en = "paddingLeft", on = "paddingBottom", nn = "marginLeft", sn = "marginRight", cn = "marginBottom", Re = "overflowX", Ie = "overflowY", qt = "width", Zt = "height", Kt = "hidden", rn = "visible", lo = (t, e, o, n) => {
  if (t && e) {
    let s = !0;
    return q(o, (c) => {
      const r = t[c], l = e[c];
      r !== l && (s = !1);
    }), s;
  }
  return !1;
}, ln = (t, e) => lo(t, e, ["w", "h"]), an = (t, e) => lo(t, e, ["x", "y"]), Wn = (t, e) => lo(t, e, ["t", "r", "b", "l"]), wt = () => {
}, V = (t, ...e) => t.bind(0, ...e), Dt = (t) => {
  let e;
  const o = t ? je : qo, n = t ? Xe : Yo;
  return [(s) => {
    n(e), e = o(s, $t(t) ? t() : t);
  }, () => n(e)];
}, un = (t, e) => {
  let o, n, s, c = wt;
  const { v: r, p: l, S: a } = e || {}, u = function(H) {
    c(), Xe(o), o = n = void 0, c = wt, t.apply(this, H);
  }, i = (T) => a && n ? a(n, T) : T, f = () => {
    c !== wt && u(i(s) || s);
  }, p = function() {
    const H = Ft(arguments), A = $t(r) ? r() : r;
    if (Et(A) && A >= 0) {
      const R = $t(l) ? l() : l, C = Et(R) && R >= 0, g = A > 0 ? je : qo, E = A > 0 ? Xe : Yo, k = i(H) || H, z = u.bind(0, k);
      c();
      const _ = g(z, A);
      c = () => E(_), C && !o && (o = je(f, R)), n = s = k;
    } else
      u(H);
  };
  return p.m = f, p;
}, dn = (t, e) => Object.prototype.hasOwnProperty.call(t, e), At = (t) => t ? Object.keys(t) : [], G = (t, e, o, n, s, c, r) => {
  const l = [e, o, n, s, c, r];
  return (typeof t != "object" || Oe(t)) && !$t(t) && (t = {}), q(l, (a) => {
    q(a, (u, i) => {
      const f = a[i];
      if (t === f)
        return !0;
      const p = St(f);
      if (f && we(f)) {
        const T = t[i];
        let H = T;
        p && !St(T) ? H = [] : !p && !we(T) && (H = {}), t[i] = G(H, f);
      } else
        t[i] = p ? f.slice() : f;
    });
  }), t;
}, fn = (t, e) => q(G({}, t), (o, n, s) => {
  o === void 0 ? delete s[n] : o && we(o) && (s[n] = fn(o));
}), io = (t) => {
  for (const e in t)
    return !1;
  return !0;
}, qe = (t, e, o) => ge(t, Nn(e, o)), zt = (t) => Ft(new Set((St(t) ? t : (t || "").split(" ")).filter((e) => e))), ke = (t, e) => t && t.getAttribute(e), yt = (t, e, o) => {
  q(zt(e), (n) => {
    t && t.setAttribute(n, o || "");
  });
}, Tt = (t, e) => {
  q(zt(e), (o) => t && t.removeAttribute(o));
}, Pe = (t, e) => {
  const o = zt(ke(t, e)), n = V(yt, t, e), s = (c, r) => {
    const l = new Set(o);
    return q(zt(c), (a) => l[r](a)), Ft(l).join(" ");
  };
  return {
    O: (c) => n(s(c, "delete")),
    $: (c) => n(s(c, "add")),
    C: (c) => {
      const r = zt(c);
      return r.reduce((l, a) => l && o.includes(a), r.length > 0);
    }
  };
}, pn = (t, e, o) => {
  Pe(t, e).O(o);
}, ie = (t, e, o) => (Pe(t, e).$(o), V(pn, t, e, o)), be = (t, e, o, n) => {
  (n ? ie : pn)(t, e, o);
}, Un = (t, e, o) => Pe(t, e).C(o), mn = (t) => Pe(t, "class"), ao = (t, e) => {
  mn(t).O(e);
}, Se = (t, e) => (mn(t).$(e), V(ao, t, e)), To = ro && Element.prototype, hn = (t, e) => {
  const o = [], n = e ? He(e) && e : document;
  return n ? Q(o, n.querySelectorAll(t)) : o;
}, jn = (t, e) => {
  const o = e ? He(e) && e : document;
  return o ? o.querySelector(t) : null;
}, Ze = (t, e) => He(t) ? (To.matches || To.msMatchesSelector).call(t, e) : !1, Ke = (t) => t ? Ft(t.childNodes) : [], Jt = (t) => t && t.parentElement, jt = (t, e) => He(t) && t.closest(e), Xn = (t, e, o) => {
  const n = jt(t, e), s = t && jn(o, n), c = jt(s, e) === n;
  return n && s ? n === t || s === t || c && jt(jt(t, o), e) !== n : !1;
}, kt = (t) => {
  if (Le(t))
    q(Ft(t), (e) => kt(e));
  else if (t) {
    const e = Jt(t);
    e && e.removeChild(t);
  }
}, gn = (t, e, o) => {
  if (o && t) {
    let n = e, s;
    return Le(o) ? (s = document.createDocumentFragment(), q(o, (c) => {
      c === n && (n = c.previousSibling), s.appendChild(c);
    })) : s = o, e && (n ? n !== e && (n = n.nextSibling) : n = t.firstChild), t.insertBefore(s, n || null), () => kt(o);
  }
  return wt;
}, ht = (t, e) => gn(t, null, e), Eo = (t, e) => gn(Jt(t), t && t.nextSibling, e), Xt = (t) => {
  const e = document.createElement("div");
  return yt(e, "class", t), e;
}, bn = (t) => {
  const e = Xt();
  return e.innerHTML = t.trim(), q(Ke(e), (o) => kt(o));
}, Gn = /^--/, $o = (t, e) => t.getPropertyValue(e) || t[e] || "", uo = (t) => {
  const e = t || 0;
  return isFinite(e) ? e : 0;
}, pe = (t) => uo(parseFloat(t || "")), Oo = (t) => `${(uo(t) * 100).toFixed(3)}%`, Je = (t) => `${uo(t)}px`;
function Qt(t, e) {
  t && q(e, (o, n) => {
    try {
      const s = t.style, c = Et(o) ? Je(o) : (o || "") + "";
      Gn.test(n) ? s.setProperty(n, c) : s[n] = c;
    } catch {
    }
  });
}
function Bt(t, e, o) {
  const n = Ae(e);
  let s = n ? "" : {};
  if (t) {
    const c = gt.getComputedStyle(t, o) || t.style;
    s = n ? $o(c, e) : e.reduce((r, l) => (r[l] = $o(c, l), r), s);
  }
  return s;
}
const It = (t) => Bt(t, "direction") === "rtl", Ao = (t, e, o) => {
  const n = e ? `${e}-` : "", s = o ? `-${o}` : "", c = `${n}top${s}`, r = `${n}right${s}`, l = `${n}bottom${s}`, a = `${n}left${s}`, u = Bt(t, [c, r, l, a]);
  return {
    t: pe(u[c]),
    r: pe(u[r]),
    b: pe(u[l]),
    l: pe(u[a])
  };
}, Be = (t, e) => `translate${le(t) ? `(${t.x},${t.y})` : `${e ? "X" : "Y"}(${t})`}`, Yn = {
  w: 0,
  h: 0
}, Me = (t, e) => e ? {
  w: e[`${t}Width`],
  h: e[`${t}Height`]
} : Yn, qn = (t) => Me("inner", t || gt), re = V(Me, "offset"), vn = V(Me, "client"), Qe = V(Me, "scroll"), fo = (t) => {
  const e = parseFloat(Bt(t, qt)) || 0, o = parseFloat(Bt(t, Zt)) || 0;
  return {
    w: e - Ue(e),
    h: o - Ue(o)
  };
}, Gt = (t) => t.getBoundingClientRect(), to = (t) => !!(t && (t[Zt] || t[qt])), yn = (t, e) => {
  const o = to(t);
  return !to(e) && o;
}, Lo = (t, e, o, n) => {
  q(zt(e), (s) => {
    t.removeEventListener(s, o, n);
  });
}, nt = (t, e, o, n) => {
  var s;
  const c = (s = n && n.H) != null ? s : !0, r = n && n.I || !1, l = n && n.A || !1, a = {
    passive: c,
    capture: r
  };
  return V(bt, zt(e).map((u) => {
    const i = l ? (f) => {
      Lo(t, u, i, r), o(f);
    } : o;
    return t.addEventListener(u, i, a), V(Lo, t, u, i, r);
  }));
}, po = (t) => t.stopPropagation(), Ho = (t) => t.preventDefault(), Zn = {
  x: 0,
  y: 0
}, _e = (t) => {
  const e = t && Gt(t);
  return e ? {
    x: e.left + gt.scrollX,
    y: e.top + gt.scrollY
  } : Zn;
}, Ce = (t, e, o) => o ? o.n ? -t + 0 : o.i ? e - t : t : t, Do = (t, e) => [Ce(0, t, e), Ce(t, t, e)], Ro = (t, e, o) => qe(0, 1, Ce(t, e, o) / e || 0), Pt = (t, e) => {
  const { x: o, y: n } = Et(e) ? {
    x: e,
    y: e
  } : e || {};
  Et(o) && (t.scrollLeft = o), Et(n) && (t.scrollTop = n);
}, te = (t) => ({
  x: t.scrollLeft,
  y: t.scrollTop
}), Io = (t, e) => {
  q(Jo(e), t);
}, eo = (t) => {
  const e = /* @__PURE__ */ new Map(), o = (c, r) => {
    if (c) {
      const l = e.get(c);
      Io((a) => {
        l && l[a ? "delete" : "clear"](a);
      }, r);
    } else
      e.forEach((l) => {
        l.clear();
      }), e.clear();
  }, n = (c, r) => {
    if (Ae(c)) {
      const u = e.get(c) || /* @__PURE__ */ new Set();
      return e.set(c, u), Io((i) => {
        $t(i) && u.add(i);
      }, r), V(o, c, r);
    }
    Ko(r) && r && o();
    const l = At(c), a = [];
    return q(l, (u) => {
      const i = c[u];
      i && Q(a, n(u, i));
    }), V(bt, a);
  }, s = (c, r) => {
    q(Ft(e.get(c)), (l) => {
      r && !Ye(r) ? l.apply(0, r) : l();
    });
  };
  return n(t || {}), [n, o, s];
}, ko = (t) => JSON.stringify(t, (e, o) => {
  if ($t(o))
    throw 0;
  return o;
}), Po = (t, e) => t ? `${e}`.split(".").reduce((o, n) => o && dn(o, n) ? o[n] : void 0, t) : void 0, Kn = {
  paddingAbsolute: !1,
  showNativeOverlaidScrollbars: !1,
  update: {
    elementEvents: [["img", "load"]],
    debounce: [0, 33],
    attributes: null,
    ignoreMutation: null
  },
  overflow: {
    x: "scroll",
    y: "scroll"
  },
  scrollbars: {
    theme: "os-theme-dark",
    visibility: "auto",
    autoHide: "never",
    autoHideDelay: 1300,
    autoHideSuspend: !1,
    dragScroll: !0,
    clickScroll: !1,
    pointers: ["mouse", "touch", "pen"]
  }
}, xn = (t, e) => {
  const o = {}, n = Ot(At(e), At(t));
  return q(n, (s) => {
    const c = t[s], r = e[s];
    if (le(c) && le(r))
      G(o[s] = {}, xn(c, r)), io(o[s]) && delete o[s];
    else if (dn(e, s) && r !== c) {
      let l = !0;
      if (St(c) || St(r))
        try {
          ko(c) === ko(r) && (l = !1);
        } catch {
        }
      l && (o[s] = r);
    }
  }), o;
}, Mo = (t, e, o) => (n) => [Po(t, n), o || Po(e, n) !== void 0], ue = "data-overlayscrollbars", wn = "os-environment", Jn = `${wn}-scrollbar-hidden`, Fe = `${ue}-initialize`, mt = ue, Sn = `${mt}-overflow-x`, Cn = `${mt}-overflow-y`, Tn = "overflowVisible", Qn = "scrollbarPressed", oo = "updating", ts = "body", Rt = `${ue}-viewport`, es = "arrange", En = "scrollbarHidden", Yt = Tn, no = `${ue}-padding`, os = Yt, Vo = `${ue}-content`, mo = "os-size-observer", ns = `${mo}-appear`, ss = `${mo}-listener`, cs = "os-trinsic-observer", rs = "os-theme-none", ft = "os-scrollbar", ls = `${ft}-rtl`, is = `${ft}-horizontal`, as = `${ft}-vertical`, $n = `${ft}-track`, ho = `${ft}-handle`, us = `${ft}-visible`, ds = `${ft}-cornerless`, No = `${ft}-interaction`, zo = `${ft}-unusable`, so = `${ft}-auto-hide`, Bo = `${so}-hidden`, _o = `${ft}-wheel`, fs = `${$n}-interactive`, ps = `${ho}-interactive`, On = {}, An = {}, ms = (t) => {
  q(t, (e) => q(e, (o, n) => {
    On[n] = e[n];
  }));
}, Ln = (t, e, o) => At(t).map((n) => {
  const { static: s, instance: c } = t[n], [r, l, a] = o || [], u = o ? c : s;
  if (u) {
    const i = o ? u(r, l, e) : u(e);
    return (a || An)[n] = i;
  }
}), ee = (t) => An[t], hs = "__osOptionsValidationPlugin", gs = "__osSizeObserverPlugin", bs = (t, e) => {
  const { T: o } = e, [n, s] = t("showNativeOverlaidScrollbars");
  return [n && o.x && o.y, s];
}, Te = (t) => t.indexOf(rn) === 0, Hn = (t, e) => {
  const { D: o } = t, n = (a) => {
    const u = Bt(o, a), f = (e ? e[a] : u) === "scroll";
    return [u, f];
  }, [s, c] = n(Re), [r, l] = n(Ie);
  return {
    k: {
      x: s,
      y: r
    },
    R: {
      x: c,
      y: l
    }
  };
}, vs = (t, e, o, n) => {
  const s = e.x || e.y, c = (i, f) => {
    const p = Te(i), T = p && s ? "hidden" : "", H = f && p && i.replace(`${rn}-`, "") || T;
    return [f && !p ? i : "", Te(H) ? "hidden" : H];
  }, [r, l] = c(o.x, e.x), [a, u] = c(o.y, e.y);
  return n[Re] = l && a ? l : r, n[Ie] = u && r ? u : a, Hn(t, n);
}, go = "__osScrollbarsHidingPlugin", ys = "__osClickScrollPlugin";
let We;
const xs = () => {
  const t = (g, E, I, k) => {
    ht(g, E);
    const z = vn(E), _ = re(E), N = fo(I);
    return k && kt(E), {
      x: _.h - z.h + N.h,
      y: _.w - z.w + N.w
    };
  }, e = (g) => {
    let E = !1;
    const I = Se(g, Jn);
    try {
      E = Bt(g, "scrollbar-width") === "none" || Bt(g, "display", "::-webkit-scrollbar") === "none";
    } catch {
    }
    return I(), E;
  }, o = (g, E) => {
    Qt(g, {
      [Re]: Kt,
      [Ie]: Kt,
      direction: "rtl"
    }), Pt(g, {
      x: 0
    });
    const I = _e(g), k = _e(E);
    Pt(g, {
      x: -999
    });
    const z = _e(E);
    return {
      i: I.x === k.x,
      n: k.x !== z.x
    };
  }, { body: n } = document, c = bn(`<div class="${wn}"><div></div></div>`)[0], r = c.firstChild, [l, , a] = eo(), [u, i] = xt({
    o: t(n, c, r),
    u: an
  }, V(t, n, c, r, !0)), [f] = i(), p = e(c), T = {
    x: f.x === 0,
    y: f.y === 0
  }, H = {
    elements: {
      host: null,
      padding: !p,
      viewport: (g) => p && g === g.ownerDocument.body && g,
      content: !1
    },
    scrollbars: {
      slot: !0
    },
    cancel: {
      nativeScrollbarsOverlaid: !1,
      body: null
    }
  }, A = G({}, Kn), P = V(G, {}, A), R = V(G, {}, H), C = {
    P: f,
    T,
    L: p,
    J: !!Ge,
    K: o(c, r),
    Z: V(l, "r"),
    G: R,
    tt: (g) => G(H, g) && R(),
    nt: P,
    ot: (g) => G(A, g) && P(),
    st: G({}, H),
    et: G({}, A)
  };
  return Tt(c, "style"), kt(c), gt.addEventListener("resize", () => {
    let g;
    if (!p && (!T.x || !T.y)) {
      const E = ee(go);
      g = !!(E ? E.Y() : wt)(C, u);
    }
    a("r", [g]);
  }), C;
}, vt = () => (We || (We = xs()), We), bo = (t, e) => $t(e) ? e.apply(0, t) : e, ws = (t, e, o, n) => {
  const s = ae(n) ? o : n;
  return bo(t, s) || e.apply(0, t);
}, Dn = (t, e, o, n) => {
  const s = ae(n) ? o : n, c = bo(t, s);
  return !!c && (ce(c) ? c : e.apply(0, t));
}, Ss = (t, e) => {
  const { nativeScrollbarsOverlaid: o, body: n } = e || {}, { T: s, L: c, G: r } = vt(), { nativeScrollbarsOverlaid: l, body: a } = r().cancel, u = o ?? l, i = ae(n) ? a : n, f = (s.x || s.y) && u, p = t && (Oe(i) ? !c : i);
  return !!f || !!p;
}, vo = /* @__PURE__ */ new WeakMap(), Cs = (t, e) => {
  vo.set(t, e);
}, Ts = (t) => {
  vo.delete(t);
}, Rn = (t) => vo.get(t), Es = (t, e, o) => {
  let n = !1;
  const s = o ? /* @__PURE__ */ new WeakMap() : !1, c = () => {
    n = !0;
  }, r = (l) => {
    if (s && o) {
      const a = o.map((u) => {
        const [i, f] = u || [];
        return [f && i ? (l || hn)(i, t) : [], f];
      });
      q(a, (u) => q(u[0], (i) => {
        const f = u[1], p = s.get(i) || [];
        if (t.contains(i) && f) {
          const H = nt(i, f, (A) => {
            n ? (H(), s.delete(i)) : e(A);
          });
          s.set(i, Q(p, H));
        } else
          bt(p), s.delete(i);
      }));
    }
  };
  return r(), [c, r];
}, Fo = (t, e, o, n) => {
  let s = !1;
  const { ct: c, rt: r, lt: l, it: a, ut: u, ft: i } = n || {}, f = un(() => s && o(!0), {
    v: 33,
    p: 99
  }), [p, T] = Es(t, f, l), H = c || [], A = r || [], P = Ot(H, A), R = (g, E) => {
    if (!Ye(E)) {
      const I = u || wt, k = i || wt, z = [], _ = [];
      let N = !1, S = !1;
      if (q(E, (v) => {
        const { attributeName: O, target: x, type: $, oldValue: y, addedNodes: j, removedNodes: F } = v, U = $ === "attributes", Y = $ === "childList", B = t === x, tt = U && O, et = tt && ke(x, O || "") || null, L = tt && y !== et, K = De(A, O) && L;
        if (e && (Y || !B)) {
          const ot = U && L, it = ot && a && Ze(x, a), m = (it ? !I(x, O, y, et) : !U || ot) && !k(v, !!it, t, n);
          q(j, (h) => Q(z, h)), q(F, (h) => Q(z, h)), S = S || m;
        }
        !e && B && L && !I(x, O, y, et) && (Q(_, O), N = N || K);
      }), T((v) => Co(z).reduce((O, x) => (Q(O, hn(v, x)), Ze(x, v) ? Q(O, x) : O), [])), e)
        return !g && S && o(!1), [!1];
      if (!Ye(_) || N) {
        const v = [Co(_), N];
        return !g && o.apply(0, v), v;
      }
    }
  }, C = new zn(V(R, !1));
  return [() => (C.observe(t, {
    attributes: !0,
    attributeOldValue: !0,
    attributeFilter: P,
    subtree: e,
    childList: e,
    characterData: e
  }), s = !0, () => {
    s && (p(), C.disconnect(), s = !1);
  }), () => {
    if (s)
      return f.m(), R(!0, C.takeRecords());
  }];
}, In = (t, e, o) => {
  const { _t: s, dt: c } = o || {}, r = ee(gs), { K: l } = vt(), a = V(It, t), [u] = xt({
    o: !1,
    _: !0
  });
  return () => {
    const i = [], p = bn(`<div class="${mo}"><div class="${ss}"></div></div>`)[0], T = p.firstChild, H = (A) => {
      const P = A instanceof ResizeObserverEntry, R = !P && St(A);
      let C = !1, g = !1, E = !0;
      if (P) {
        const [I, , k] = u(A.contentRect), z = to(I), _ = yn(I, k);
        g = !k || _, C = !g && !z, E = !C;
      } else R ? [, E] = A : g = A === !0;
      if (s && E) {
        const I = R ? A[0] : It(p);
        Pt(p, {
          x: Ce(3333333, 3333333, I && l),
          y: 3333333
        });
      }
      C || e({
        vt: R ? A : void 0,
        ht: !R,
        dt: g
      });
    };
    if (xe) {
      const A = new xe((P) => H(P.pop()));
      A.observe(T), Q(i, () => {
        A.disconnect();
      });
    } else if (r) {
      const [A, P] = r(T, H, c);
      Q(i, Ot([Se(p, ns), nt(p, "animationstart", A)], P));
    } else
      return wt;
    if (s) {
      const [A] = xt({
        o: void 0
      }, a);
      Q(i, nt(p, "scroll", (P) => {
        const R = A(), [C, g, E] = R;
        g && (ao(T, "ltr rtl"), Se(T, C ? "rtl" : "ltr"), H([!!C, g, E])), po(P);
      }));
    }
    return V(bt, Q(i, ht(t, p)));
  };
}, $s = (t, e) => {
  let o;
  const n = (a) => a.h === 0 || a.isIntersecting || a.intersectionRatio > 0, s = Xt(cs), [c] = xt({
    o: !1
  }), r = (a, u) => {
    if (a) {
      const i = c(n(a)), [, f] = i;
      return f && !u && e(i) && [i];
    }
  }, l = (a, u) => r(u.pop(), a);
  return [() => {
    const a = [];
    if (So)
      o = new So(V(l, !1), {
        root: t
      }), o.observe(s), Q(a, () => {
        o.disconnect();
      });
    else {
      const u = () => {
        const i = re(s);
        r(i);
      };
      Q(a, In(s, u)()), u();
    }
    return V(bt, Q(a, ht(t, s)));
  }, () => o && l(!0, o.takeRecords())];
}, Os = (t, e, o, n) => {
  let s, c, r, l, a, u;
  const { L: i } = vt(), f = `[${mt}]`, p = `[${Rt}]`, T = ["tabindex"], H = ["wrap", "cols", "rows"], A = ["id", "class", "style", "open"], { gt: P, bt: R, D: C, wt: g, St: E, V: I, yt: k, Ot: z } = t, _ = {
    $t: !1,
    N: It(P)
  }, N = vt(), S = ee(go), [v] = xt({
    u: ln,
    o: {
      w: 0,
      h: 0
    }
  }, () => {
    const d = S && S.M(t, e, _, N, o).W, m = k(Yt), h = !I && k(es), b = h && te(C);
    z(Yt), I && z(oo, !0);
    const w = h && d && d()[0], D = Qe(g), M = Qe(C), W = fo(C);
    return z(Yt, m), I && z(oo), w && w(), Pt(C, b), {
      w: M.w + D.w + W.w,
      h: M.h + D.h + W.h
    };
  }), O = E ? H : Ot(A, H), x = un(n, {
    v: () => s,
    p: () => c,
    S(d, m) {
      const [h] = d, [b] = m;
      return [Ot(At(h), At(b)).reduce((w, D) => (w[D] = h[D] || b[D], w), {})];
    }
  }), $ = (d) => {
    if (I) {
      const m = It(P);
      G(d, {
        Ct: u !== m
      }), G(_, {
        N: m
      }), u = m;
    }
  }, y = (d) => {
    q(d || T, (m) => {
      if (De(T, m)) {
        const h = ke(R, m);
        Ae(h) ? yt(C, m, h) : Tt(C, m);
      }
    });
  }, j = (d, m) => {
    const [h, b] = d, w = {
      xt: b
    };
    return G(_, {
      $t: h
    }), !m && n(w), w;
  }, F = ({ ht: d, vt: m, dt: h }) => {
    const w = !(d && !h && !m) && i ? x : n, [D, M] = m || [], W = {
      ht: d || h,
      dt: h,
      Ct: M
    };
    $(W), m && G(_, {
      N: D
    }), w(W);
  }, U = (d, m) => {
    const [, h] = v(), b = {
      Ht: h
    };
    return $(b), h && !m && (d ? n : x)(b), b;
  }, Y = (d, m, h) => {
    const b = {
      It: m
    };
    return $(b), m && !h ? x(b) : I || y(d), b;
  }, { Z: B } = N, [tt, et] = g ? $s(R, j) : [], L = !I && In(R, F, {
    dt: !0,
    _t: !0
  }), [K, ot] = Fo(R, !1, Y, {
    rt: A,
    ct: Ot(A, T)
  }), it = I && xe && new xe((d) => {
    const m = d[d.length - 1].contentRect;
    F({
      ht: !0,
      dt: yn(m, a)
    }), a = m;
  });
  return [() => {
    y(), it && it.observe(R);
    const d = L && L(), m = tt && tt(), h = K(), b = B((w) => {
      const [, D] = v();
      x({
        zt: w,
        Ht: D
      });
    });
    return () => {
      it && it.disconnect(), d && d(), m && m(), l && l(), h(), b();
    };
  }, ({ Et: d, At: m, Tt: h }) => {
    const b = {}, [w] = d("update.ignoreMutation"), [D, M] = d("update.attributes"), [W, Z] = d("update.elementEvents"), [rt, at] = d("update.debounce"), J = Z || M, lt = m || h, Mt = (X) => $t(w) && w(X);
    if (J) {
      r && r(), l && l();
      const [X, ct] = Fo(g || C, !0, U, {
        ct: Ot(O, D || []),
        lt: W,
        it: f,
        ft: (ut, dt) => {
          const { target: st, attributeName: pt } = ut;
          return (!dt && pt && !I ? Xn(st, f, p) : !1) || !!jt(st, `.${ft}`) || !!Mt(ut);
        }
      });
      l = X(), r = ct;
    }
    if (at)
      if (x.m(), St(rt)) {
        const X = rt[0], ct = rt[1];
        s = Et(X) && X, c = Et(ct) && ct;
      } else Et(rt) ? (s = rt, c = !1) : (s = !1, c = !1);
    if (lt) {
      const X = ot(), ct = et && et(), ut = r && r();
      X && G(b, Y(X[0], X[1], lt)), ct && G(b, j(ct[0], lt)), ut && G(b, U(ut[0], lt));
    }
    return $(b), b;
  }, _];
}, As = (t, e, o, n) => {
  const { G: s, K: c } = vt(), { scrollbars: r } = s(), { slot: l } = r, { gt: a, bt: u, D: i, Dt: f, kt: p, Rt: T, V: H } = e, { scrollbars: A } = f ? {} : t, { slot: P } = A || {}, R = /* @__PURE__ */ new Map(), C = (d) => Ge && new Ge({
    source: p,
    axis: d
  }), g = C("x"), E = C("y"), I = Dn([a, u, i], () => H && T ? a : u, l, P), k = (d, m) => {
    if (m) {
      const W = d ? qt : Zt, { Mt: Z, Vt: rt } = m, at = Gt(rt)[W], J = Gt(Z)[W];
      return qe(0, 1, at / J || 0);
    }
    const h = d ? "x" : "y", { Lt: b, Pt: w } = o, D = w[h], M = b[h];
    return qe(0, 1, D / (D + M) || 0);
  }, z = (d, m, h, b) => {
    const w = k(h, d);
    return 1 / w * (1 - w) * (b ? 1 - m : m) || 0;
  }, _ = (d, m) => G(d, m ? {
    clear: ["left"]
  } : {}), N = (d) => {
    R.forEach((m, h) => {
      (d ? De(Jo(d), h) : !0) && (q(m || [], (w) => {
        w && w.cancel();
      }), R.delete(h));
    });
  }, S = (d, m, h, b) => {
    const w = R.get(d) || [], D = w.find((M) => M && M.timeline === m);
    D ? D.effect = new KeyframeEffect(d, h, {
      composite: b
    }) : R.set(d, Ot(w, [d.animate(h, {
      timeline: m,
      composite: b
    })]));
  }, v = (d, m, h) => {
    const b = h ? Se : ao;
    q(d, (w) => {
      b(w.Ut, m);
    });
  }, O = (d, m) => {
    q(d, (h) => {
      const [b, w] = m(h);
      Qt(b, w);
    });
  }, x = (d, m) => {
    O(d, (h) => {
      const { Vt: b } = h;
      return [b, {
        [m ? qt : Zt]: Oo(k(m))
      }];
    });
  }, $ = (d, m) => {
    const { Lt: h } = o, b = m ? h.x : h.y, w = (D, M, W) => Be(Oo(z(D, Ro(M, b, W), m, W)), m);
    if (g && E)
      q(d, (D) => {
        const { Ut: M, Vt: W } = D, Z = m && It(M) && c;
        S(W, m ? g : E, _({
          transform: Do(b, Z).map((rt) => w(D, rt, Z))
        }, Z));
      });
    else {
      const D = te(p);
      O(d, (M) => {
        const { Vt: W, Ut: Z } = M;
        return [W, {
          transform: w(M, m ? D.x : D.y, m && It(Z) && c)
        }];
      });
    }
  }, y = (d) => H && !T && Jt(d) === i, j = [], F = [], U = [], Y = (d, m, h) => {
    const b = Ko(h), w = b ? h : !0, D = b ? !h : !0;
    w && v(F, d, m), D && v(U, d, m);
  }, B = () => {
    x(F, !0), x(U);
  }, tt = () => {
    $(F, !0), $(U);
  }, et = () => {
    if (H) {
      const { Lt: d } = o, m = 0.5;
      if (g && E)
        q(Ot(U, F), ({ Ut: h }) => {
          if (y(h)) {
            const b = (w, D, M) => {
              const W = M && It(h) && c;
              S(h, w, _({
                transform: Do(D - m, W).map((Z) => Be(Je(Z), M))
              }, W), "add");
            };
            b(g, d.x, !0), b(E, d.y);
          } else
            N(h);
        });
      else {
        const h = te(p), b = (w) => {
          const { Ut: D } = w, M = y(D) && D, W = (Z, rt, at) => {
            const J = Ro(Z, rt, at), lt = rt * J;
            return Je(at ? -lt : lt);
          };
          return [M, {
            transform: M ? Be({
              x: W(h.x, d.x, It(D) && c),
              y: W(h.y, d.y)
            }) : ""
          }];
        };
        O(F, b), O(U, b);
      }
    }
  }, L = (d) => {
    const h = Xt(`${ft} ${d ? is : as}`), b = Xt($n), w = Xt(ho), D = {
      Ut: h,
      Mt: b,
      Vt: w
    };
    return Q(d ? F : U, D), Q(j, [ht(h, b), ht(b, w), V(kt, h), N, n(D, Y, $, d)]), D;
  }, K = V(L, !0), ot = V(L, !1), it = () => (ht(I, F[0].Ut), ht(I, U[0].Ut), V(bt, j));
  return K(), ot(), [{
    Bt: B,
    Nt: tt,
    jt: et,
    Ft: Y,
    qt: {
      J: g,
      Wt: F,
      Xt: K,
      Yt: V(O, F)
    },
    Jt: {
      J: E,
      Wt: U,
      Xt: ot,
      Yt: V(O, U)
    }
  }, it];
}, Ls = (t, e, o) => {
  const { bt: n, kt: s, Kt: c } = e;
  return (r, l, a, u) => {
    const { Ut: i, Mt: f, Vt: p } = r, [T, H] = Dt(333), [A, P] = Dt(), R = V(a, [r], u), C = !!s.scrollBy, g = `client${u ? "X" : "Y"}`, E = u ? qt : Zt, I = u ? "left" : "top", k = u ? "w" : "h", z = u ? "x" : "y", _ = (v) => v.propertyName.indexOf(E) > -1, N = () => {
      const v = "pointerup pointerleave pointercancel lostpointercapture", O = (x, $) => (y) => {
        const { Lt: j } = o, F = re(f)[k] - re(p)[k], Y = $ * y / F * j[z];
        Pt(s, {
          [z]: x + Y
        });
      };
      return nt(f, "pointerdown", (x) => {
        const $ = jt(x.target, `.${ho}`) === p, y = $ ? p : f, j = t.scrollbars, { button: F, isPrimary: U, pointerType: Y } = x, { pointers: B } = j;
        if (F === 0 && U && j[$ ? "dragScroll" : "clickScroll"] && (B || []).includes(Y)) {
          const et = !$ && x.shiftKey, L = V(Gt, p), K = V(Gt, f), ot = (J, lt) => (J || L())[I] - (lt || K())[I], it = Ue(Gt(s)[E]) / re(s)[k] || 1, d = O(te(s)[z] || 0, 1 / it), m = x[g], h = L(), b = K(), w = h[E], D = ot(h, b) + w / 2, M = m - b[I], W = $ ? 0 : M - D, Z = (J) => {
            bt(at), y.releasePointerCapture(J.pointerId);
          }, at = [ie(n, mt, Qn), nt(c, v, Z), nt(c, "selectstart", (J) => Ho(J), {
            H: !1
          }), nt(f, v, Z), nt(f, "pointermove", (J) => {
            const lt = J[g] - m;
            ($ || et) && d(W + lt);
          })];
          if (y.setPointerCapture(x.pointerId), et)
            d(W);
          else if (!$) {
            const J = ee(ys);
            J && Q(at, J(d, ot, W, w, M));
          }
        }
      });
    };
    let S = !0;
    return V(bt, [nt(i, "pointerenter", () => {
      l(No, !0);
    }), nt(i, "pointerleave pointercancel", () => {
      l(No, !1);
    }), nt(i, "wheel", (v) => {
      const { deltaX: O, deltaY: x, deltaMode: $ } = v;
      C && S && $ === 0 && Jt(i) === n && s.scrollBy({
        left: O,
        top: x,
        behavior: "smooth"
      }), S = !1, l(_o, !0), T(() => {
        S = !0, l(_o);
      }), Ho(v);
    }, {
      H: !1,
      I: !0
    }), nt(p, "transitionstart", (v) => {
      if (_(v)) {
        const O = () => {
          R(), A(O);
        };
        O();
      }
    }), nt(p, "transitionend transitioncancel", (v) => {
      _(v) && (P(), R());
    }), nt(i, "mousedown", V(nt, c, "click", po, {
      A: !0,
      I: !0
    }), {
      I: !0
    }), N(), H, P]);
  };
}, Hs = (t, e, o, n, s, c) => {
  let r, l, a, u, i, f = wt, p = 0;
  const [T, H] = Dt(), [A, P] = Dt(), [R, C] = Dt(100), [g, E] = Dt(100), [I, k] = Dt(100), [z, _] = Dt(() => p), [N, S] = As(t, s, n, Ls(e, s, n)), { bt: v, Zt: O, Rt: x } = s, { Ft: $, Bt: y, Nt: j, jt: F } = N, U = (L) => {
    $(so, L, !0), $(so, L, !1);
  }, Y = (L, K) => {
    if (_(), L)
      $(Bo);
    else {
      const ot = V($, Bo, !0);
      p > 0 && !K ? z(ot) : ot();
    }
  }, B = (L) => L.pointerType === "mouse", tt = (L) => {
    B(L) && (u = l, u && Y(!0));
  }, et = [C, _, E, k, P, H, () => f(), nt(v, "pointerover", tt, {
    A: !0
  }), nt(v, "pointerenter", tt), nt(v, "pointerleave", (L) => {
    B(L) && (u = !1, l && Y(!1));
  }), nt(v, "pointermove", (L) => {
    B(L) && r && T(() => {
      C(), Y(!0), g(() => {
        r && Y(!1);
      });
    });
  }), nt(O, "scroll", (L) => {
    A(() => {
      j(), a && Y(!0), R(() => {
        a && !u && Y(!1);
      });
    }), c(L), F();
  })];
  return [() => V(bt, Q(et, S())), ({ Et: L, Tt: K, Gt: ot, Qt: it }) => {
    const { tn: d, nn: m, sn: h } = it || {}, { Ct: b, dt: w } = ot || {}, { N: D } = o, { T: M } = vt(), { k: W, en: Z } = n, [rt, at] = L("showNativeOverlaidScrollbars"), [J, lt] = L("scrollbars.theme"), [Mt, X] = L("scrollbars.visibility"), [ct, ut] = L("scrollbars.autoHide"), [dt, st] = L("scrollbars.autoHideSuspend"), [pt] = L("scrollbars.autoHideDelay"), [Vt, Wt] = L("scrollbars.dragScroll"), [Ct, Nt] = L("scrollbars.clickScroll"), [Lt, Ve] = L("overflow"), Ht = w && !K, Ne = Z.x || Z.y, oe = d || m || b || K, de = h || X || Ve, fe = rt && M.x && M.y, ne = (se, Ut, yo) => {
      const xo = se.includes("scroll") && (Mt === "visible" || Mt === "auto" && Ut === "scroll");
      return $(us, xo, yo), xo;
    };
    if (p = pt, Ht && (dt && Ne ? (U(!1), f(), I(() => {
      f = nt(O, "scroll", V(U, !0), {
        A: !0
      });
    })) : U(!0)), at && $(rs, fe), lt && ($(i), $(J, !0), i = J), st && !dt && U(!0), ut && (r = ct === "move", l = ct === "leave", a = ct !== "never", Y(!a, !0)), Wt && $(ps, Vt), Nt && $(fs, Ct), de) {
      const se = ne(Lt.x, W.x, !0), Ut = ne(Lt.y, W.y, !1);
      $(ds, !(se && Ut));
    }
    oe && (y(), j(), F(), $(zo, !Z.x, !0), $(zo, !Z.y, !1), $(ls, D && !x));
  }, {}, N];
}, Ds = (t) => {
  const e = vt(), { G: o, L: n } = e, { elements: s } = o(), { host: c, padding: r, viewport: l, content: a } = s, u = ce(t), i = u ? {} : t, { elements: f } = i, { host: p, padding: T, viewport: H, content: A } = f || {}, P = u ? t : i.target, R = Ze(P, "textarea"), C = P.ownerDocument, g = C.documentElement, E = P === C.body, I = C.defaultView, k = () => C.activeElement, z = (X) => {
    X && X.focus && X.focus();
  }, _ = V(ws, [P]), N = V(Dn, [P]), S = V(bo, [P]), v = V(Xt, ""), O = V(_, v, l), x = V(N, v, a), $ = O(H), y = $ === P, j = y && E, F = !y && x(A), U = !y && ce($) && $ === F, Y = U && !!S(a), B = Y ? O() : $, tt = Y ? F : x(), L = j ? g : U ? B : $, K = R ? _(v, c, p) : P, ot = j ? L : K, it = U ? tt : F, d = {
    gt: P,
    bt: ot,
    D: L,
    cn: !y && N(v, r, T),
    wt: it,
    kt: j ? g : L,
    Zt: j ? C : L,
    rn: E ? g : P,
    ln: I,
    Kt: C,
    St: R,
    Rt: E,
    Dt: u,
    V: y,
    an: U,
    yt: (X) => Un(L, y ? mt : Rt, X),
    Ot: (X, ct) => be(L, y ? mt : Rt, X, ct)
  }, m = At(d).reduce((X, ct) => {
    const ut = d[ct];
    return Q(X, ut && ce(ut) && !Jt(ut) ? ut : !1);
  }, []), h = (X) => X ? De(m, X) : null, { gt: b, bt: w, cn: D, D: M, wt: W } = d, Z = [() => {
    Tt(w, [mt, Fe]), Tt(b, Fe), E && Tt(g, [Fe, mt]);
  }], rt = R && h(w);
  let at = R ? b : Ke([W, M, D, w, b].find((X) => h(X) === !1));
  const J = j ? b : W || M, lt = V(bt, Z);
  return [d, () => {
    const X = k(), ct = (st) => {
      ht(Jt(st), Ke(st)), kt(st);
    }, ut = (st) => st ? nt(st, "focusin focusout focus blur", (pt) => {
      po(pt), pt.stopImmediatePropagation();
    }, {
      I: !0,
      H: !1
    }) : wt, dt = ut(X);
    if (yt(w, mt, y ? "viewport" : "host"), yt(D, no, ""), yt(W, Vo, ""), y || (yt(M, Rt, ""), E && ie(g, mt, ts)), rt && (Eo(b, w), Q(Z, () => {
      Eo(w, b), kt(w);
    })), ht(J, at), ht(w, D), ht(D || w, !y && M), ht(M, W), Q(Z, [dt, () => {
      const st = k(), pt = ut(st);
      Tt(D, no), Tt(W, Vo), Tt(M, [Sn, Cn, Rt]), h(W) && ct(W), h(M) && ct(M), h(D) && ct(D), z(st), pt();
    }]), n && !y && (ie(M, Rt, En), Q(Z, V(Tt, M, Rt))), !y && I.top === I && X === P) {
      const st = "tabindex", pt = ke(M, st);
      yt(M, st, "-1"), z(M);
      const Vt = () => pt ? yt(M, st, pt) : Tt(M, st), Wt = nt(C, "pointerdown keydown", () => {
        Vt(), Wt();
      });
      Q(Z, [Vt, Wt]);
    } else
      z(X);
    return dt(), at = 0, lt;
  }, lt];
}, Rs = ({ wt: t }) => ({ Gt: e, un: o, Tt: n }) => {
  const { xt: s } = e || {}, { $t: c } = o;
  t && (s || n) && Qt(t, {
    [Zt]: c && "100%"
  });
}, Is = ({ bt: t, cn: e, D: o, V: n }, s) => {
  const [c, r] = xt({
    u: Wn,
    o: Ao()
  }, V(Ao, t, "padding", ""));
  return ({ Et: l, Gt: a, un: u, Tt: i }) => {
    let [f, p] = r(i);
    const { L: T } = vt(), { ht: H, Ht: A, Ct: P } = a || {}, { N: R } = u, [C, g] = l("paddingAbsolute");
    (H || p || (i || A)) && ([f, p] = c(i));
    const I = !n && (g || P || p);
    if (I) {
      const k = !C || !e && !T, z = f.r + f.l, _ = f.t + f.b, N = {
        [sn]: k && !R ? -z : 0,
        [cn]: k ? -_ : 0,
        [nn]: k && R ? -z : 0,
        top: k ? -f.t : 0,
        right: k ? R ? -f.r : "auto" : 0,
        left: k ? R ? "auto" : -f.l : 0,
        [qt]: k && `calc(100% + ${z}px)`
      }, S = {
        [Qo]: k ? f.t : 0,
        [tn]: k ? f.r : 0,
        [on]: k ? f.b : 0,
        [en]: k ? f.l : 0
      };
      Qt(e || o, N), Qt(o, S), G(s, {
        cn: f,
        fn: !k,
        j: e ? S : G({}, N, S)
      });
    }
    return {
      _n: I
    };
  };
}, ks = (t, e) => {
  const o = vt(), { bt: n, cn: s, D: c, V: r, Ot: l, Rt: a, ln: u } = t, { L: i } = o, f = a && r, p = V(ge, 0), T = {
    u: ln,
    o: {
      w: 0,
      h: 0
    }
  }, H = {
    u: an,
    o: {
      x: Kt,
      y: Kt
    }
  }, A = (S, v) => {
    const O = gt.devicePixelRatio % 1 !== 0 ? 1 : 0, x = {
      w: p(S.w - v.w),
      h: p(S.h - v.h)
    };
    return {
      w: x.w > O ? x.w : 0,
      h: x.h > O ? x.h : 0
    };
  }, [P, R] = xt(T, V(fo, c)), [C, g] = xt(T, V(Qe, c)), [E, I] = xt(T), [k, z] = xt(T), [_] = xt(H), N = ee(go);
  return ({ Et: S, Gt: v, un: O, Tt: x }, { _n: $ }) => {
    const { ht: y, Ht: j, Ct: F, zt: U } = v || {}, Y = N && N.M(t, e, O, o, S), { q: B, W: tt, X: et } = Y || {}, [L, K] = bs(S, o), [ot, it] = S("overflow"), d = y || $ || j || F || U || K, m = Te(ot.x), h = Te(ot.y), b = m || h;
    let w = R(x), D = g(x), M = I(x), W = z(x), Z;
    if (K && i && l(En, !L), d) {
      b && l(Yt, !1);
      const [Ct, Nt] = tt ? tt(Z) : [], [Lt, Ve] = w = P(x), [Ht, Ne] = D = C(x), oe = vn(c), de = Ht, fe = oe;
      Ct && Ct(), (Ne || Ve || K) && Nt && !L && B && B(Nt, Ht, Lt);
      const ne = qn(u), se = {
        w: p(ge(Ht.w, de.w) + Lt.w),
        h: p(ge(Ht.h, de.h) + Lt.h)
      }, Ut = {
        w: p((f ? ne.w : fe.w + p(oe.w - Ht.w)) + Lt.w),
        h: p((f ? ne.h : fe.h + p(oe.h - Ht.h)) + Lt.h)
      };
      W = k(Ut), M = E(A(se, Ut), x);
    }
    const [rt, at] = W, [J, lt] = M, [Mt, X] = D, [ct, ut] = w, dt = {
      x: J.w > 0,
      y: J.h > 0
    }, st = m && h && (dt.x || dt.y) || m && dt.x && !dt.y || h && dt.y && !dt.x;
    if ($ || F || U || ut || X || at || lt || it || K || d) {
      const Ct = {}, Nt = vs(t, dt, ot, Ct);
      et && et(Nt, O, !!B && B(Nt, Mt, ct), Ct), r ? (yt(n, Sn, Ct[Re]), yt(n, Cn, Ct[Ie])) : Qt(c, Ct);
    }
    be(n, mt, Tn, st), be(s, no, os, st), r || be(c, Rt, Yt, b);
    const [Vt, Wt] = _(Hn(t).k);
    return G(e, {
      k: Vt,
      Pt: {
        x: rt.w,
        y: rt.h
      },
      Lt: {
        x: J.w,
        y: J.h
      },
      en: dt
    }), {
      sn: Wt,
      tn: at,
      nn: lt
    };
  };
}, Ps = (t) => {
  const [e, o, n] = Ds(t), s = {
    cn: {
      t: 0,
      r: 0,
      b: 0,
      l: 0
    },
    fn: !1,
    j: {
      [sn]: 0,
      [cn]: 0,
      [nn]: 0,
      [Qo]: 0,
      [tn]: 0,
      [on]: 0,
      [en]: 0
    },
    Pt: {
      x: 0,
      y: 0
    },
    Lt: {
      x: 0,
      y: 0
    },
    k: {
      x: Kt,
      y: Kt
    },
    en: {
      x: !1,
      y: !1
    }
  }, { gt: c, D: r, V: l } = e, { L: a, T: u } = vt(), i = !a && (u.x || u.y), f = [Rs(e), Is(e, s), ks(e, s)];
  return [o, (p) => {
    const T = {}, A = i && te(r), P = l ? ie(r, mt, oo) : wt;
    return q(f, (R) => {
      G(T, R(p, T) || {});
    }), P(), Pt(r, A), !l && Pt(c, 0), T;
  }, s, e, n];
}, Ms = (t, e, o, n) => {
  const s = Mo(e, {}), [c, r, l, a, u] = Ps(t), [i, f, p] = Os(a, l, s, (C) => {
    R({}, C);
  }), [T, H, , A] = Hs(t, e, p, l, a, n), P = (C) => At(C).some((g) => !!C[g]), R = (C, g) => {
    const { dn: E, Tt: I, At: k, vn: z } = C, _ = E || {}, N = !!I, S = {
      Et: Mo(e, _, N),
      dn: _,
      Tt: N
    };
    if (z)
      return H(S), !1;
    const v = g || f(G({}, S, {
      At: k
    })), O = r(G({}, S, {
      un: p,
      Gt: v
    }));
    H(G({}, S, {
      Gt: v,
      Qt: O
    }));
    const x = P(v), $ = P(O), y = x || $ || !io(_) || N;
    return y && o(C, {
      Gt: v,
      Qt: O
    }), y;
  };
  return [() => {
    const { rn: C, D: g } = a, E = te(C), I = [i(), c(), T()];
    return Pt(g, E), V(bt, I);
  }, R, () => ({
    hn: p,
    pn: l
  }), {
    gn: a,
    bn: A
  }, u];
}, _t = (t, e, o) => {
  const { nt: n } = vt(), s = ce(t), c = s ? t : t.target, r = Rn(c);
  if (e && !r) {
    let l = !1;
    const a = [], u = {}, i = (S) => {
      const v = fn(S), O = ee(hs);
      return O ? O(v, !0) : v;
    }, f = G({}, n(), i(e)), [p, T, H] = eo(), [A, P, R] = eo(o), C = (S, v) => {
      R(S, v), H(S, v);
    }, [g, E, I, k, z] = Ms(t, f, ({ dn: S, Tt: v }, { Gt: O, Qt: x }) => {
      const { ht: $, Ct: y, xt: j, Ht: F, It: U, dt: Y } = O, { tn: B, nn: tt, sn: et } = x;
      C("updated", [N, {
        updateHints: {
          sizeChanged: !!$,
          directionChanged: !!y,
          heightIntrinsicChanged: !!j,
          overflowEdgeChanged: !!B,
          overflowAmountChanged: !!tt,
          overflowStyleChanged: !!et,
          contentMutation: !!F,
          hostMutation: !!U,
          appear: !!Y
        },
        changedOptions: S || {},
        force: !!v
      }]);
    }, (S) => C("scroll", [N, S])), _ = (S) => {
      Ts(c), bt(a), l = !0, C("destroyed", [N, S]), T(), P();
    }, N = {
      options(S, v) {
        if (S) {
          const O = v ? n() : {}, x = xn(f, G(O, i(S)));
          io(x) || (G(f, x), E({
            dn: x
          }));
        }
        return G({}, f);
      },
      on: A,
      off: (S, v) => {
        S && v && P(S, v);
      },
      state() {
        const { hn: S, pn: v } = I(), { N: O } = S, { Pt: x, Lt: $, k: y, en: j, cn: F, fn: U } = v;
        return G({}, {
          overflowEdge: x,
          overflowAmount: $,
          overflowStyle: y,
          hasOverflow: j,
          padding: F,
          paddingAbsolute: U,
          directionRTL: O,
          destroyed: l
        });
      },
      elements() {
        const { gt: S, bt: v, cn: O, D: x, wt: $, kt: y, Zt: j } = k.gn, { qt: F, Jt: U } = k.bn, Y = (tt) => {
          const { Vt: et, Mt: L, Ut: K } = tt;
          return {
            scrollbar: K,
            track: L,
            handle: et
          };
        }, B = (tt) => {
          const { Wt: et, Xt: L } = tt, K = Y(et[0]);
          return G({}, K, {
            clone: () => {
              const ot = Y(L());
              return E({
                vn: !0
              }), ot;
            }
          });
        };
        return G({}, {
          target: S,
          host: v,
          padding: O || x,
          viewport: x,
          content: $ || x,
          scrollOffsetElement: y,
          scrollEventElement: j,
          scrollbarHorizontal: B(F),
          scrollbarVertical: B(U)
        });
      },
      update: (S) => E({
        Tt: S,
        At: !0
      }),
      destroy: V(_, !1),
      plugin: (S) => u[At(S)[0]]
    };
    return Q(a, [z]), Cs(c, N), Ln(On, _t, [N, p, u]), Ss(k.gn.Rt, !s && t.cancel) ? (_(!0), N) : (Q(a, g()), C("initialized", [N]), N.update(!0), N);
  }
  return r;
};
_t.plugin = (t) => {
  const e = St(t), o = e ? t : [t], n = o.map((s) => Ln(s, _t)[0]);
  return ms(o), e ? n : n[0];
};
_t.valid = (t) => {
  const e = t && t.elements, o = $t(e) && e();
  return we(o) && !!Rn(o.target);
};
_t.env = () => {
  const { P: t, T: e, L: o, K: n, J: s, st: c, et: r, G: l, tt: a, nt: u, ot: i } = vt();
  return G({}, {
    scrollbarsSize: t,
    scrollbarsOverlaid: e,
    scrollbarsHiding: o,
    rtlScrollBehavior: n,
    scrollTimeline: s,
    staticDefaultInitialization: c,
    staticDefaultOptions: r,
    getDefaultInitialization: l,
    setDefaultInitialization: a,
    getDefaultOptions: u,
    setDefaultOptions: i
  });
};
const ve = Ee(999999), me = Ee(380), Vs = "var(--upf-text-tooltip-text, var(--upf-text-primary, #212121))", co = "var(--upf-text-tooltip-bg, var(--upf-bg-elevated, #ffffff))", Wo = "var(--upf-text-tooltip-border, var(--upf-border-color, #D9D9D9))", Ns = "var(--upf-border-radius, 4px)", Uo = "var(--upf-text-tooltip-shadow-color, rgba(38, 38, 38, 0.16))", zs = "var(--upf-text-tooltip-scrollbar-thumb, var(--upf-text-disabled, #B2B2B2))", jo = "var(--upf-text-tooltip-scrollbar-thumb-hover, var(--upf-text-secondary, #666666))", Bs = "var(--upf-text-tooltip-scrollbar-padding, 1px)", Xo = (t) => {
  const e = document.createElement("span"), o = document.createElement("span");
  return e.style.position = "absolute", e.style.width = "0", e.style.height = "0", e.style.pointerEvents = "none", e.style.zIndex = "2", o.style.position = "absolute", o.style.width = "0", o.style.height = "0", o.style.pointerEvents = "none", t === "top" ? (e.style.borderLeft = "7px solid transparent", e.style.borderRight = "7px solid transparent", e.style.borderBottom = `7px solid ${Wo}`, e.style.top = "-7px", o.style.borderLeft = "6px solid transparent", o.style.borderRight = "6px solid transparent", o.style.borderBottom = `6px solid ${co}`, o.style.top = "1px", o.style.left = "-6px") : (e.style.borderLeft = "7px solid transparent", e.style.borderRight = "7px solid transparent", e.style.borderTop = `7px solid ${Wo}`, e.style.bottom = "-7px", o.style.borderLeft = "6px solid transparent", o.style.borderRight = "6px solid transparent", o.style.borderTop = `6px solid ${co}`, o.style.bottom = "1px", o.style.left = "-6px"), e.appendChild(o), e;
}, _s = () => {
  Mn("das-ui-text", [
    {
      className: ".das-ui-text-context",
      style: { position: "relative", overflow: "hidden", "text-overflow": "ellipsis", "white-space": "nowrap", "letter-spacing": "-0.1px" }
    },
    {
      className: "#das-ui-text-tooltip",
      style: {
        position: "fixed",
        "z-index": ve.value
      }
    },
    {
      className: "#das-ui-text-tooltip-context",
      style: {
        "box-sizing": "border-box",
        "max-width": "380px",
        "max-height": "114px",
        padding: "10px",
        "font-size": "12px",
        color: Vs,
        background: co,
        // border: `1px solid ${tooltipBorderVar}`,
        "border-radius": Ns,
        "line-height": 1.5,
        "overflow-y": "hidden"
      }
    },
    {
      className: "#das-ui-text-tooltip-context *",
      style: {
        color: "inherit !important"
      }
    },
    {
      className: "#tooltip-scroll-content",
      style: {
        width: "100%",
        height: "100%"
      }
    },
    {
      className: ".das-scrollbar",
      style: {
        "--os-handle-bg": zs,
        "--os-handle-bg-hover": jo,
        "--os-handle-bg-active": jo,
        "--os-padding-perpendicular": Bs,
        "--os-size": "10px",
        "box-sizing": "border-box",
        ":hover": {
          // 悬浮时滚动条变大
          "--os-padding-perpendicular": 0
        }
      }
    }
  ]);
}, kn = (t) => {
  window.inTextTooltip = !0, t.stopPropagation();
}, he = Ee(0);
let Pn = Ee(null);
const ye = () => {
  var o;
  clearTimeout(Pn.value);
  const t = document.getElementById("das-ui-text-tooltip");
  t && ((o = document.body) == null || o.removeChild(t)), window.inTextTooltip = !1;
  const e = document.getElementById("das-ui-text-tooltip-context");
  e && e.removeEventListener("mouseover", kn);
}, Go = (t) => {
  let e = document.getElementById("das-ui-text-tooltip");
  const o = t.clientX, n = t.clientY, s = e == null ? void 0 : e.getBoundingClientRect();
  if (e && o >= s.left && o <= s.right && n >= s.top && n <= s.bottom)
    return !0;
  ye();
}, Fs = async (t, e) => {
  let o = t;
  return e.target && (typeof e.target == "string" && (o = e.target), typeof e.target == "function" && (o = await e.target(t))), o;
}, Gs = {
  beforeMount() {
    _s();
  },
  async mounted(t, e, o) {
    const n = (o ? e.value : e) || {};
    let s = (n == null ? void 0 : n.deep) ?? !0;
    if ((n == null ? void 0 : n.disabled) ?? !1) {
      const i = document.querySelectorAll(".das-ui-text-context");
      i.length && (i[0].style.textOverflow = "auto", i[0].style.overflow = "visible");
      return;
    }
    let r = (n == null ? void 0 : n.customContent) || "";
    he.value === 0 && window.addEventListener("wheel", Go), he.value++;
    let l = await Fs(t, n);
    const a = l.classList;
    l.dataset.customContent = r;
    let u = !0;
    a.contains("das-ui-text-context") || a.add("das-ui-text-context"), l.onmouseenter = (i) => {
      const p = i.composedPath()[0], { x: T, y: H, width: A, height: P, top: R, left: C, bottom: g, right: E } = p.getBoundingClientRect(), I = window.getComputedStyle(p, null), k = parseFloat(I.getPropertyValue("padding-left"));
      ve.value = Vn().nextZIndex();
      const z = document.createRange();
      z.setStart(l, 0);
      let _ = s ? l.childNodes.length : 1;
      z.setEnd(l, _);
      const N = parseFloat(I.paddingRight), S = parseFloat(I.paddingLeft), v = Math.round(z.getBoundingClientRect().width), O = Math.round(l.getBoundingClientRect().width) - N - S;
      if (v > O) {
        const $ = (window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth) - E;
        setTimeout(async () => {
          let y = document.getElementById("das-ui-text-tooltip");
          if (!y) {
            y = document.createElement("div"), y.style.cssText = `left: ${T + k}px;`, y.style.zIndex = `${ve.value}`, y.setAttribute("id", "das-ui-text-tooltip");
            const B = document.createElement("div");
            B.setAttribute("id", "das-ui-text-tooltip-context"), B && (B.style.wordBreak = wo.value == "zh-CN" ? "break-all" : "normal"), B.addEventListener("mouseover", kn);
            const tt = document.createElement("div");
            tt.setAttribute("id", "tooltip-scroll-content"), B.appendChild(tt), y.appendChild(B), document.body.appendChild(y);
            const et = "os-theme-dark das-scrollbar", L = document.getElementById("tooltip-scroll-content");
            if (L) {
              L.innerHTML = l.dataset.customContent || l.innerHTML;
              const K = {
                scrollbars: {
                  autoHide: "leave",
                  autoHideDelay: 0,
                  theme: et
                },
                overflow: { y: "scroll" }
              };
              l.dataset.customContent ? Pn.value = setTimeout(() => {
                _t(B, K);
              }, 10) : _t(B, K);
            }
          }
          const j = y.querySelector('[data-tooltip-arrow="true"]');
          j == null || j.remove();
          const F = Xo("bottom");
          if (F.setAttribute("data-tooltip-arrow", "true"), F.style.left = "14px", $ + A <= me.value) {
            let B = y.offsetWidth >= me.value ? me.value : y.offsetWidth;
            y.style.cssText = `left: ${T + k - B / 4}px;`, y.style.zIndex = `${ve.value}`, F.style.left = `${B / 2}px`;
          }
          y.appendChild(F);
          let U = l.dataset.customContent && wo.value != "zh-CN" ? y.offsetHeight - 10 : y.offsetHeight, Y = H - 10 - U;
          if (Y * 1 < 0) {
            y.style.top = `${g + 5}px`, F.remove();
            const B = Xo("top");
            B.setAttribute("data-tooltip-arrow", "true"), B.style.left = $ + A <= me.value ? F.style.left : "14px", y.appendChild(B), y.style.boxShadow = `0px -4px 10px 0px ${Uo}`;
          } else
            y.style.top = `${Y}px`, y.style.boxShadow = `0px 4px 10px 0px ${Uo}`;
          y.onmouseenter = (B) => {
            u = !1;
          }, y.onmouseleave = (B) => {
            u = !0, setTimeout(() => {
              ye();
            }, 200);
          };
        }, 200);
      }
    }, l.onmouseleave = (i) => {
      setTimeout(() => {
        u && ye();
      }, 200);
    };
  },
  // 指令与元素解绑时
  unmounted() {
    ye(), he.value--, he.value === 0 && window.removeEventListener("wheel", Go);
  }
};
export {
  Gs as default,
  Gs as vDasTooltip
};
