import { computed as I, ref as ot, shallowRef as Yt, watch as ht, getCurrentScope as qt, onScopeDispose as Ut, shallowReadonly as J, unref as Kt } from "vue";
const X = Math.min, E = Math.max, ct = Math.round, st = Math.floor, W = (t) => ({
  x: t,
  y: t
}), Gt = {
  left: "right",
  right: "left",
  bottom: "top",
  top: "bottom"
};
function wt(t, e, n) {
  return E(t, X(e, n));
}
function et(t, e) {
  return typeof t == "function" ? t(e) : t;
}
function j(t) {
  return t.split("-")[0];
}
function nt(t) {
  return t.split("-")[1];
}
function Wt(t) {
  return t === "x" ? "y" : "x";
}
function bt(t) {
  return t === "y" ? "height" : "width";
}
function N(t) {
  const e = t[0];
  return e === "t" || e === "b" ? "y" : "x";
}
function Rt(t) {
  return Wt(N(t));
}
function Jt(t, e, n) {
  n === void 0 && (n = !1);
  const o = nt(t), i = Rt(t), s = bt(i);
  let r = i === "x" ? o === (n ? "end" : "start") ? "right" : "left" : o === "start" ? "bottom" : "top";
  return e.reference[s] > e.floating[s] && (r = lt(r)), [r, lt(r)];
}
function Qt(t) {
  const e = lt(t);
  return [xt(t), e, xt(e)];
}
function xt(t) {
  return t.includes("start") ? t.replace("start", "end") : t.replace("end", "start");
}
const Et = ["left", "right"], Dt = ["right", "left"], Zt = ["top", "bottom"], te = ["bottom", "top"];
function ee(t, e, n) {
  switch (t) {
    case "top":
    case "bottom":
      return n ? e ? Dt : Et : e ? Et : Dt;
    case "left":
    case "right":
      return e ? Zt : te;
    default:
      return [];
  }
}
function ne(t, e, n, o) {
  const i = nt(t);
  let s = ee(j(t), n === "start", o);
  return i && (s = s.map((r) => r + "-" + i), e && (s = s.concat(s.map(xt)))), s;
}
function lt(t) {
  const e = j(t);
  return Gt[e] + t.slice(e.length);
}
function oe(t) {
  return {
    top: 0,
    right: 0,
    bottom: 0,
    left: 0,
    ...t
  };
}
function kt(t) {
  return typeof t != "number" ? oe(t) : {
    top: t,
    right: t,
    bottom: t,
    left: t
  };
}
function at(t) {
  const {
    x: e,
    y: n,
    width: o,
    height: i
  } = t;
  return {
    width: o,
    height: i,
    top: n,
    left: e,
    right: e + o,
    bottom: n + i,
    x: e,
    y: n
  };
}
function Lt(t, e, n) {
  let {
    reference: o,
    floating: i
  } = t;
  const s = N(e), r = Rt(e), c = bt(r), f = j(e), u = s === "y", l = o.x + o.width / 2 - i.width / 2, d = o.y + o.height / 2 - i.height / 2, m = o[c] / 2 - i[c] / 2;
  let a;
  switch (f) {
    case "top":
      a = {
        x: l,
        y: o.y - i.height
      };
      break;
    case "bottom":
      a = {
        x: l,
        y: o.y + o.height
      };
      break;
    case "right":
      a = {
        x: o.x + o.width,
        y: d
      };
      break;
    case "left":
      a = {
        x: o.x - i.width,
        y: d
      };
      break;
    default:
      a = {
        x: o.x,
        y: o.y
      };
  }
  switch (nt(e)) {
    case "start":
      a[r] -= m * (n && u ? -1 : 1);
      break;
    case "end":
      a[r] += m * (n && u ? -1 : 1);
      break;
  }
  return a;
}
async function ie(t, e) {
  var n;
  e === void 0 && (e = {});
  const {
    x: o,
    y: i,
    platform: s,
    rects: r,
    elements: c,
    strategy: f
  } = t, {
    boundary: u = "clippingAncestors",
    rootBoundary: l = "viewport",
    elementContext: d = "floating",
    altBoundary: m = !1,
    padding: a = 0
  } = et(e, t), h = kt(a), w = c[m ? d === "floating" ? "reference" : "floating" : d], p = at(await s.getClippingRect({
    element: (n = await (s.isElement == null ? void 0 : s.isElement(w))) == null || n ? w : w.contextElement || await (s.getDocumentElement == null ? void 0 : s.getDocumentElement(c.floating)),
    boundary: u,
    rootBoundary: l,
    strategy: f
  })), x = d === "floating" ? {
    x: o,
    y: i,
    width: r.floating.width,
    height: r.floating.height
  } : r.reference, y = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(c.floating)), b = await (s.isElement == null ? void 0 : s.isElement(y)) ? await (s.getScale == null ? void 0 : s.getScale(y)) || {
    x: 1,
    y: 1
  } : {
    x: 1,
    y: 1
  }, O = at(s.convertOffsetParentRelativeRectToViewportRelativeRect ? await s.convertOffsetParentRelativeRectToViewportRelativeRect({
    elements: c,
    rect: x,
    offsetParent: y,
    strategy: f
  }) : x);
  return {
    top: (p.top - O.top + h.top) / b.y,
    bottom: (O.bottom - p.bottom + h.bottom) / b.y,
    left: (p.left - O.left + h.left) / b.x,
    right: (O.right - p.right + h.right) / b.x
  };
}
const re = 50, se = async (t, e, n) => {
  const {
    placement: o = "bottom",
    strategy: i = "absolute",
    middleware: s = [],
    platform: r
  } = n, c = r.detectOverflow ? r : {
    ...r,
    detectOverflow: ie
  }, f = await (r.isRTL == null ? void 0 : r.isRTL(e));
  let u = await r.getElementRects({
    reference: t,
    floating: e,
    strategy: i
  }), {
    x: l,
    y: d
  } = Lt(u, o, f), m = o, a = 0;
  const h = {};
  for (let g = 0; g < s.length; g++) {
    const w = s[g];
    if (!w)
      continue;
    const {
      name: p,
      fn: x
    } = w, {
      x: y,
      y: b,
      data: O,
      reset: R
    } = await x({
      x: l,
      y: d,
      initialPlacement: o,
      placement: m,
      strategy: i,
      middlewareData: h,
      rects: u,
      platform: c,
      elements: {
        reference: t,
        floating: e
      }
    });
    l = y ?? l, d = b ?? d, h[p] = {
      ...h[p],
      ...O
    }, R && a < re && (a++, typeof R == "object" && (R.placement && (m = R.placement), R.rects && (u = R.rects === !0 ? await r.getElementRects({
      reference: t,
      floating: e,
      strategy: i
    }) : R.rects), {
      x: l,
      y: d
    } = Lt(u, m, f)), g = -1);
  }
  return {
    x: l,
    y: d,
    placement: m,
    strategy: i,
    middlewareData: h
  };
}, ce = (t) => ({
  name: "arrow",
  options: t,
  async fn(e) {
    const {
      x: n,
      y: o,
      placement: i,
      rects: s,
      platform: r,
      elements: c,
      middlewareData: f
    } = e, {
      element: u,
      padding: l = 0
    } = et(t, e) || {};
    if (u == null)
      return {};
    const d = kt(l), m = {
      x: n,
      y: o
    }, a = Rt(i), h = bt(a), g = await r.getDimensions(u), w = a === "y", p = w ? "top" : "left", x = w ? "bottom" : "right", y = w ? "clientHeight" : "clientWidth", b = s.reference[h] + s.reference[a] - m[a] - s.floating[h], O = m[a] - s.reference[a], R = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(u));
    let v = R ? R[y] : 0;
    (!v || !await (r.isElement == null ? void 0 : r.isElement(R))) && (v = c.floating[y] || s.floating[h]);
    const A = b / 2 - O / 2, S = v / 2 - g[h] / 2 - 1, L = X(d[p], S), B = X(d[x], S), V = L, H = v - g[h] - B, C = v / 2 - g[h] / 2 + A, q = wt(V, C, H), $ = !f.arrow && nt(i) != null && C !== q && s.reference[h] / 2 - (C < V ? L : B) - g[h] / 2 < 0, T = $ ? C < V ? C - V : C - H : 0;
    return {
      [a]: m[a] + T,
      data: {
        [a]: q,
        centerOffset: C - q - T,
        ...$ && {
          alignmentOffset: T
        }
      },
      reset: $
    };
  }
}), le = function(t) {
  return t === void 0 && (t = {}), {
    name: "flip",
    options: t,
    async fn(e) {
      var n, o;
      const {
        placement: i,
        middlewareData: s,
        rects: r,
        initialPlacement: c,
        platform: f,
        elements: u
      } = e, {
        mainAxis: l = !0,
        crossAxis: d = !0,
        fallbackPlacements: m,
        fallbackStrategy: a = "bestFit",
        fallbackAxisSideDirection: h = "none",
        flipAlignment: g = !0,
        ...w
      } = et(t, e);
      if ((n = s.arrow) != null && n.alignmentOffset)
        return {};
      const p = j(i), x = N(c), y = j(c) === c, b = await (f.isRTL == null ? void 0 : f.isRTL(u.floating)), O = m || (y || !g ? [lt(c)] : Qt(c)), R = h !== "none";
      !m && R && O.push(...ne(c, g, h, b));
      const v = [c, ...O], A = await f.detectOverflow(e, w), S = [];
      let L = ((o = s.flip) == null ? void 0 : o.overflows) || [];
      if (l && S.push(A[p]), d) {
        const C = Jt(i, r, b);
        S.push(A[C[0]], A[C[1]]);
      }
      if (L = [...L, {
        placement: i,
        overflows: S
      }], !S.every((C) => C <= 0)) {
        var B, V;
        const C = (((B = s.flip) == null ? void 0 : B.index) || 0) + 1, q = v[C];
        if (q && (!(d === "alignment" ? x !== N(q) : !1) || // We leave the current main axis only if every placement on that axis
        // overflows the main axis.
        L.every((P) => N(P.placement) === x ? P.overflows[0] > 0 : !0)))
          return {
            data: {
              index: C,
              overflows: L
            },
            reset: {
              placement: q
            }
          };
        let $ = (V = L.filter((T) => T.overflows[0] <= 0).sort((T, P) => T.overflows[1] - P.overflows[1])[0]) == null ? void 0 : V.placement;
        if (!$)
          switch (a) {
            case "bestFit": {
              var H;
              const T = (H = L.filter((P) => {
                if (R) {
                  const z = N(P.placement);
                  return z === x || // Create a bias to the `y` side axis due to horizontal
                  // reading directions favoring greater width.
                  z === "y";
                }
                return !0;
              }).map((P) => [P.placement, P.overflows.filter((z) => z > 0).reduce((z, jt) => z + jt, 0)]).sort((P, z) => P[1] - z[1])[0]) == null ? void 0 : H[0];
              T && ($ = T);
              break;
            }
            case "initialPlacement":
              $ = c;
              break;
          }
        if (i !== $)
          return {
            reset: {
              placement: $
            }
          };
      }
      return {};
    }
  };
}, ae = /* @__PURE__ */ new Set(["left", "top"]);
async function fe(t, e) {
  const {
    placement: n,
    platform: o,
    elements: i
  } = t, s = await (o.isRTL == null ? void 0 : o.isRTL(i.floating)), r = j(n), c = nt(n), f = N(n) === "y", u = ae.has(r) ? -1 : 1, l = s && f ? -1 : 1, d = et(e, t);
  let {
    mainAxis: m,
    crossAxis: a,
    alignmentAxis: h
  } = typeof d == "number" ? {
    mainAxis: d,
    crossAxis: 0,
    alignmentAxis: null
  } : {
    mainAxis: d.mainAxis || 0,
    crossAxis: d.crossAxis || 0,
    alignmentAxis: d.alignmentAxis
  };
  return c && typeof h == "number" && (a = c === "end" ? h * -1 : h), f ? {
    x: a * l,
    y: m * u
  } : {
    x: m * u,
    y: a * l
  };
}
const ue = function(t) {
  return t === void 0 && (t = 0), {
    name: "offset",
    options: t,
    async fn(e) {
      var n, o;
      const {
        x: i,
        y: s,
        placement: r,
        middlewareData: c
      } = e, f = await fe(e, t);
      return r === ((n = c.offset) == null ? void 0 : n.placement) && (o = c.arrow) != null && o.alignmentOffset ? {} : {
        x: i + f.x,
        y: s + f.y,
        data: {
          ...f,
          placement: r
        }
      };
    }
  };
}, de = function(t) {
  return t === void 0 && (t = {}), {
    name: "shift",
    options: t,
    async fn(e) {
      const {
        x: n,
        y: o,
        placement: i,
        platform: s
      } = e, {
        mainAxis: r = !0,
        crossAxis: c = !1,
        limiter: f = {
          fn: (p) => {
            let {
              x,
              y
            } = p;
            return {
              x,
              y
            };
          }
        },
        ...u
      } = et(t, e), l = {
        x: n,
        y: o
      }, d = await s.detectOverflow(e, u), m = N(j(i)), a = Wt(m);
      let h = l[a], g = l[m];
      if (r) {
        const p = a === "y" ? "top" : "left", x = a === "y" ? "bottom" : "right", y = h + d[p], b = h - d[x];
        h = wt(y, h, b);
      }
      if (c) {
        const p = m === "y" ? "top" : "left", x = m === "y" ? "bottom" : "right", y = g + d[p], b = g - d[x];
        g = wt(y, g, b);
      }
      const w = f.fn({
        ...e,
        [a]: h,
        [m]: g
      });
      return {
        ...w,
        data: {
          x: w.x - n,
          y: w.y - o,
          enabled: {
            [a]: r,
            [m]: c
          }
        }
      };
    }
  };
}, me = function(t) {
  return t === void 0 && (t = {}), {
    name: "size",
    options: t,
    async fn(e) {
      var n, o;
      const {
        placement: i,
        rects: s,
        platform: r,
        elements: c
      } = e, {
        apply: f = () => {
        },
        ...u
      } = et(t, e), l = await r.detectOverflow(e, u), d = j(i), m = nt(i), a = N(i) === "y", {
        width: h,
        height: g
      } = s.floating;
      let w, p;
      d === "top" || d === "bottom" ? (w = d, p = m === (await (r.isRTL == null ? void 0 : r.isRTL(c.floating)) ? "start" : "end") ? "left" : "right") : (p = d, w = m === "end" ? "top" : "bottom");
      const x = g - l.top - l.bottom, y = h - l.left - l.right, b = X(g - l[w], x), O = X(h - l[p], y), R = !e.middlewareData.shift;
      let v = b, A = O;
      if ((n = e.middlewareData.shift) != null && n.enabled.x && (A = y), (o = e.middlewareData.shift) != null && o.enabled.y && (v = x), R && !m) {
        const L = E(l.left, 0), B = E(l.right, 0), V = E(l.top, 0), H = E(l.bottom, 0);
        a ? A = h - 2 * (L !== 0 || B !== 0 ? L + B : E(l.left, l.right)) : v = g - 2 * (V !== 0 || H !== 0 ? V + H : E(l.top, l.bottom));
      }
      await f({
        ...e,
        availableWidth: A,
        availableHeight: v
      });
      const S = await r.getDimensions(c.floating);
      return h !== S.width || g !== S.height ? {
        reset: {
          rects: !0
        }
      } : {};
    }
  };
};
function ft() {
  return typeof window < "u";
}
function G(t) {
  return Ot(t) ? (t.nodeName || "").toLowerCase() : "#document";
}
function D(t) {
  var e;
  return (t == null || (e = t.ownerDocument) == null ? void 0 : e.defaultView) || window;
}
function k(t) {
  var e;
  return (e = (Ot(t) ? t.ownerDocument : t.document) || window.document) == null ? void 0 : e.documentElement;
}
function Ot(t) {
  return ft() ? t instanceof Node || t instanceof D(t).Node : !1;
}
function M(t) {
  return ft() ? t instanceof Element || t instanceof D(t).Element : !1;
}
function _(t) {
  return ft() ? t instanceof HTMLElement || t instanceof D(t).HTMLElement : !1;
}
function Tt(t) {
  return !ft() || typeof ShadowRoot > "u" ? !1 : t instanceof ShadowRoot || t instanceof D(t).ShadowRoot;
}
function rt(t) {
  const {
    overflow: e,
    overflowX: n,
    overflowY: o,
    display: i
  } = F(t);
  return /auto|scroll|overlay|hidden|clip/.test(e + o + n) && i !== "inline" && i !== "contents";
}
function he(t) {
  return /^(table|td|th)$/.test(G(t));
}
function ut(t) {
  try {
    if (t.matches(":popover-open"))
      return !0;
  } catch {
  }
  try {
    return t.matches(":modal");
  } catch {
    return !1;
  }
}
const ge = /transform|translate|scale|rotate|perspective|filter/, pe = /paint|layout|strict|content/, U = (t) => !!t && t !== "none";
let gt;
function At(t) {
  const e = M(t) ? F(t) : t;
  return U(e.transform) || U(e.translate) || U(e.scale) || U(e.rotate) || U(e.perspective) || !Ct() && (U(e.backdropFilter) || U(e.filter)) || ge.test(e.willChange || "") || pe.test(e.contain || "");
}
function we(t) {
  let e = Y(t);
  for (; _(e) && !tt(e); ) {
    if (At(e))
      return e;
    if (ut(e))
      return null;
    e = Y(e);
  }
  return null;
}
function Ct() {
  return gt == null && (gt = typeof CSS < "u" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none")), gt;
}
function tt(t) {
  return /^(html|body|#document)$/.test(G(t));
}
function F(t) {
  return D(t).getComputedStyle(t);
}
function dt(t) {
  return M(t) ? {
    scrollLeft: t.scrollLeft,
    scrollTop: t.scrollTop
  } : {
    scrollLeft: t.scrollX,
    scrollTop: t.scrollY
  };
}
function Y(t) {
  if (G(t) === "html")
    return t;
  const e = (
    // Step into the shadow DOM of the parent of a slotted node.
    t.assignedSlot || // DOM Element detected.
    t.parentNode || // ShadowRoot detected.
    Tt(t) && t.host || // Fallback.
    k(t)
  );
  return Tt(e) ? e.host : e;
}
function $t(t) {
  const e = Y(t);
  return tt(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : _(e) && rt(e) ? e : $t(e);
}
function it(t, e, n) {
  var o;
  e === void 0 && (e = []), n === void 0 && (n = !0);
  const i = $t(t), s = i === ((o = t.ownerDocument) == null ? void 0 : o.body), r = D(i);
  if (s) {
    const c = yt(r);
    return e.concat(r, r.visualViewport || [], rt(i) ? i : [], c && n ? it(c) : []);
  } else
    return e.concat(i, it(i, [], n));
}
function yt(t) {
  return t.parent && Object.getPrototypeOf(t.parent) ? t.frameElement : null;
}
function Nt(t) {
  const e = F(t);
  let n = parseFloat(e.width) || 0, o = parseFloat(e.height) || 0;
  const i = _(t), s = i ? t.offsetWidth : n, r = i ? t.offsetHeight : o, c = ct(n) !== s || ct(o) !== r;
  return c && (n = s, o = r), {
    width: n,
    height: o,
    $: c
  };
}
function St(t) {
  return M(t) ? t : t.contextElement;
}
function Z(t) {
  const e = St(t);
  if (!_(e))
    return W(1);
  const n = e.getBoundingClientRect(), {
    width: o,
    height: i,
    $: s
  } = Nt(e);
  let r = (s ? ct(n.width) : n.width) / o, c = (s ? ct(n.height) : n.height) / i;
  return (!r || !Number.isFinite(r)) && (r = 1), (!c || !Number.isFinite(c)) && (c = 1), {
    x: r,
    y: c
  };
}
const xe = /* @__PURE__ */ W(0);
function _t(t) {
  const e = D(t);
  return !Ct() || !e.visualViewport ? xe : {
    x: e.visualViewport.offsetLeft,
    y: e.visualViewport.offsetTop
  };
}
function ye(t, e, n) {
  return e === void 0 && (e = !1), !n || e && n !== D(t) ? !1 : e;
}
function K(t, e, n, o) {
  e === void 0 && (e = !1), n === void 0 && (n = !1);
  const i = t.getBoundingClientRect(), s = St(t);
  let r = W(1);
  e && (o ? M(o) && (r = Z(o)) : r = Z(t));
  const c = ye(s, n, o) ? _t(s) : W(0);
  let f = (i.left + c.x) / r.x, u = (i.top + c.y) / r.y, l = i.width / r.x, d = i.height / r.y;
  if (s) {
    const m = D(s), a = o && M(o) ? D(o) : o;
    let h = m, g = yt(h);
    for (; g && o && a !== h; ) {
      const w = Z(g), p = g.getBoundingClientRect(), x = F(g), y = p.left + (g.clientLeft + parseFloat(x.paddingLeft)) * w.x, b = p.top + (g.clientTop + parseFloat(x.paddingTop)) * w.y;
      f *= w.x, u *= w.y, l *= w.x, d *= w.y, f += y, u += b, h = D(g), g = yt(h);
    }
  }
  return at({
    width: l,
    height: d,
    x: f,
    y: u
  });
}
function mt(t, e) {
  const n = dt(t).scrollLeft;
  return e ? e.left + n : K(k(t)).left + n;
}
function Bt(t, e) {
  const n = t.getBoundingClientRect(), o = n.left + e.scrollLeft - mt(t, n), i = n.top + e.scrollTop;
  return {
    x: o,
    y: i
  };
}
function ve(t) {
  let {
    elements: e,
    rect: n,
    offsetParent: o,
    strategy: i
  } = t;
  const s = i === "fixed", r = k(o), c = e ? ut(e.floating) : !1;
  if (o === r || c && s)
    return n;
  let f = {
    scrollLeft: 0,
    scrollTop: 0
  }, u = W(1);
  const l = W(0), d = _(o);
  if ((d || !d && !s) && ((G(o) !== "body" || rt(r)) && (f = dt(o)), d)) {
    const a = K(o);
    u = Z(o), l.x = a.x + o.clientLeft, l.y = a.y + o.clientTop;
  }
  const m = r && !d && !s ? Bt(r, f) : W(0);
  return {
    width: n.width * u.x,
    height: n.height * u.y,
    x: n.x * u.x - f.scrollLeft * u.x + l.x + m.x,
    y: n.y * u.y - f.scrollTop * u.y + l.y + m.y
  };
}
function be(t) {
  return Array.from(t.getClientRects());
}
function Re(t) {
  const e = k(t), n = dt(t), o = t.ownerDocument.body, i = E(e.scrollWidth, e.clientWidth, o.scrollWidth, o.clientWidth), s = E(e.scrollHeight, e.clientHeight, o.scrollHeight, o.clientHeight);
  let r = -n.scrollLeft + mt(t);
  const c = -n.scrollTop;
  return F(o).direction === "rtl" && (r += E(e.clientWidth, o.clientWidth) - i), {
    width: i,
    height: s,
    x: r,
    y: c
  };
}
const Pt = 25;
function Oe(t, e) {
  const n = D(t), o = k(t), i = n.visualViewport;
  let s = o.clientWidth, r = o.clientHeight, c = 0, f = 0;
  if (i) {
    s = i.width, r = i.height;
    const l = Ct();
    (!l || l && e === "fixed") && (c = i.offsetLeft, f = i.offsetTop);
  }
  const u = mt(o);
  if (u <= 0) {
    const l = o.ownerDocument, d = l.body, m = getComputedStyle(d), a = l.compatMode === "CSS1Compat" && parseFloat(m.marginLeft) + parseFloat(m.marginRight) || 0, h = Math.abs(o.clientWidth - d.clientWidth - a);
    h <= Pt && (s -= h);
  } else u <= Pt && (s += u);
  return {
    width: s,
    height: r,
    x: c,
    y: f
  };
}
function Ae(t, e) {
  const n = K(t, !0, e === "fixed"), o = n.top + t.clientTop, i = n.left + t.clientLeft, s = _(t) ? Z(t) : W(1), r = t.clientWidth * s.x, c = t.clientHeight * s.y, f = i * s.x, u = o * s.y;
  return {
    width: r,
    height: c,
    x: f,
    y: u
  };
}
function Mt(t, e, n) {
  let o;
  if (e === "viewport")
    o = Oe(t, n);
  else if (e === "document")
    o = Re(k(t));
  else if (M(e))
    o = Ae(e, n);
  else {
    const i = _t(t);
    o = {
      x: e.x - i.x,
      y: e.y - i.y,
      width: e.width,
      height: e.height
    };
  }
  return at(o);
}
function Ht(t, e) {
  const n = Y(t);
  return n === e || !M(n) || tt(n) ? !1 : F(n).position === "fixed" || Ht(n, e);
}
function Ce(t, e) {
  const n = e.get(t);
  if (n)
    return n;
  let o = it(t, [], !1).filter((c) => M(c) && G(c) !== "body"), i = null;
  const s = F(t).position === "fixed";
  let r = s ? Y(t) : t;
  for (; M(r) && !tt(r); ) {
    const c = F(r), f = At(r);
    !f && c.position === "fixed" && (i = null), (s ? !f && !i : !f && c.position === "static" && !!i && (i.position === "absolute" || i.position === "fixed") || rt(r) && !f && Ht(t, r)) ? o = o.filter((l) => l !== r) : i = c, r = Y(r);
  }
  return e.set(t, o), o;
}
function Se(t) {
  let {
    element: e,
    boundary: n,
    rootBoundary: o,
    strategy: i
  } = t;
  const r = [...n === "clippingAncestors" ? ut(e) ? [] : Ce(e, this._c) : [].concat(n), o], c = Mt(e, r[0], i);
  let f = c.top, u = c.right, l = c.bottom, d = c.left;
  for (let m = 1; m < r.length; m++) {
    const a = Mt(e, r[m], i);
    f = E(a.top, f), u = X(a.right, u), l = X(a.bottom, l), d = E(a.left, d);
  }
  return {
    width: u - d,
    height: l - f,
    x: d,
    y: f
  };
}
function Ee(t) {
  const {
    width: e,
    height: n
  } = Nt(t);
  return {
    width: e,
    height: n
  };
}
function De(t, e, n) {
  const o = _(e), i = k(e), s = n === "fixed", r = K(t, !0, s, e);
  let c = {
    scrollLeft: 0,
    scrollTop: 0
  };
  const f = W(0);
  function u() {
    f.x = mt(i);
  }
  if (o || !o && !s)
    if ((G(e) !== "body" || rt(i)) && (c = dt(e)), o) {
      const a = K(e, !0, s, e);
      f.x = a.x + e.clientLeft, f.y = a.y + e.clientTop;
    } else i && u();
  s && !o && i && u();
  const l = i && !o && !s ? Bt(i, c) : W(0), d = r.left + c.scrollLeft - f.x - l.x, m = r.top + c.scrollTop - f.y - l.y;
  return {
    x: d,
    y: m,
    width: r.width,
    height: r.height
  };
}
function pt(t) {
  return F(t).position === "static";
}
function Ft(t, e) {
  if (!_(t) || F(t).position === "fixed")
    return null;
  if (e)
    return e(t);
  let n = t.offsetParent;
  return k(t) === n && (n = n.ownerDocument.body), n;
}
function zt(t, e) {
  const n = D(t);
  if (ut(t))
    return n;
  if (!_(t)) {
    let i = Y(t);
    for (; i && !tt(i); ) {
      if (M(i) && !pt(i))
        return i;
      i = Y(i);
    }
    return n;
  }
  let o = Ft(t, e);
  for (; o && he(o) && pt(o); )
    o = Ft(o, e);
  return o && tt(o) && pt(o) && !At(o) ? n : o || we(t) || n;
}
const Le = async function(t) {
  const e = this.getOffsetParent || zt, n = this.getDimensions, o = await n(t.floating);
  return {
    reference: De(t.reference, await e(t.floating), t.strategy),
    floating: {
      x: 0,
      y: 0,
      width: o.width,
      height: o.height
    }
  };
};
function Te(t) {
  return F(t).direction === "rtl";
}
const Pe = {
  convertOffsetParentRelativeRectToViewportRelativeRect: ve,
  getDocumentElement: k,
  getClippingRect: Se,
  getOffsetParent: zt,
  getElementRects: Le,
  getClientRects: be,
  getDimensions: Ee,
  getScale: Z,
  isElement: M,
  isRTL: Te
};
function It(t, e) {
  return t.x === e.x && t.y === e.y && t.width === e.width && t.height === e.height;
}
function Me(t, e) {
  let n = null, o;
  const i = k(t);
  function s() {
    var c;
    clearTimeout(o), (c = n) == null || c.disconnect(), n = null;
  }
  function r(c, f) {
    c === void 0 && (c = !1), f === void 0 && (f = 1), s();
    const u = t.getBoundingClientRect(), {
      left: l,
      top: d,
      width: m,
      height: a
    } = u;
    if (c || e(), !m || !a)
      return;
    const h = st(d), g = st(i.clientWidth - (l + m)), w = st(i.clientHeight - (d + a)), p = st(l), y = {
      rootMargin: -h + "px " + -g + "px " + -w + "px " + -p + "px",
      threshold: E(0, X(1, f)) || 1
    };
    let b = !0;
    function O(R) {
      const v = R[0].intersectionRatio;
      if (v !== f) {
        if (!b)
          return r();
        v ? r(!1, v) : o = setTimeout(() => {
          r(!1, 1e-7);
        }, 1e3);
      }
      v === 1 && !It(u, t.getBoundingClientRect()) && r(), b = !1;
    }
    try {
      n = new IntersectionObserver(O, {
        ...y,
        // Handle <iframe>s
        root: i.ownerDocument
      });
    } catch {
      n = new IntersectionObserver(O, y);
    }
    n.observe(t);
  }
  return r(!0), s;
}
function $e(t, e, n, o) {
  o === void 0 && (o = {});
  const {
    ancestorScroll: i = !0,
    ancestorResize: s = !0,
    elementResize: r = typeof ResizeObserver == "function",
    layoutShift: c = typeof IntersectionObserver == "function",
    animationFrame: f = !1
  } = o, u = St(t), l = i || s ? [...u ? it(u) : [], ...e ? it(e) : []] : [];
  l.forEach((p) => {
    i && p.addEventListener("scroll", n, {
      passive: !0
    }), s && p.addEventListener("resize", n);
  });
  const d = u && c ? Me(u, n) : null;
  let m = -1, a = null;
  r && (a = new ResizeObserver((p) => {
    let [x] = p;
    x && x.target === u && a && e && (a.unobserve(e), cancelAnimationFrame(m), m = requestAnimationFrame(() => {
      var y;
      (y = a) == null || y.observe(e);
    })), n();
  }), u && !f && a.observe(u), e && a.observe(e));
  let h, g = f ? K(t) : null;
  f && w();
  function w() {
    const p = K(t);
    g && !It(g, p) && n(), g = p, h = requestAnimationFrame(w);
  }
  return n(), () => {
    var p;
    l.forEach((x) => {
      i && x.removeEventListener("scroll", n), s && x.removeEventListener("resize", n);
    }), d == null || d(), (p = a) == null || p.disconnect(), a = null, f && cancelAnimationFrame(h);
  };
}
const Ne = ue, _e = de, Be = le, He = me, Fe = ce, Ve = (t, e, n) => {
  const o = /* @__PURE__ */ new Map(), i = {
    platform: Pe,
    ...n
  }, s = {
    ...i.platform,
    _c: o
  };
  return se(t, e, {
    ...i,
    platform: s
  });
};
function We(t) {
  return t != null && typeof t == "object" && "$el" in t;
}
function vt(t) {
  if (We(t)) {
    const e = t.$el;
    return Ot(e) && G(e) === "#comment" ? null : e;
  }
  return t;
}
function Q(t) {
  return typeof t == "function" ? t() : Kt(t);
}
function ze(t) {
  return {
    name: "arrow",
    options: t,
    fn(e) {
      const n = vt(Q(t.element));
      return n == null ? {} : Fe({
        element: n,
        padding: t.padding
      }).fn(e);
    }
  };
}
function Xt(t) {
  return typeof window > "u" ? 1 : (t.ownerDocument.defaultView || window).devicePixelRatio || 1;
}
function Vt(t, e) {
  const n = Xt(t);
  return Math.round(e * n) / n;
}
function Ie(t, e, n) {
  n === void 0 && (n = {});
  const o = n.whileElementsMounted, i = I(() => {
    var v;
    return (v = Q(n.open)) != null ? v : !0;
  }), s = I(() => Q(n.middleware)), r = I(() => {
    var v;
    return (v = Q(n.placement)) != null ? v : "bottom";
  }), c = I(() => {
    var v;
    return (v = Q(n.strategy)) != null ? v : "absolute";
  }), f = I(() => {
    var v;
    return (v = Q(n.transform)) != null ? v : !0;
  }), u = I(() => vt(t.value)), l = I(() => vt(e.value)), d = ot(0), m = ot(0), a = ot(c.value), h = ot(r.value), g = Yt({}), w = ot(!1), p = I(() => {
    const v = {
      position: a.value,
      left: "0",
      top: "0"
    };
    if (!l.value)
      return v;
    const A = Vt(l.value, d.value), S = Vt(l.value, m.value);
    return f.value ? {
      ...v,
      transform: "translate(" + A + "px, " + S + "px)",
      ...Xt(l.value) >= 1.5 && {
        willChange: "transform"
      }
    } : {
      position: a.value,
      left: A + "px",
      top: S + "px"
    };
  });
  let x;
  function y() {
    if (u.value == null || l.value == null)
      return;
    const v = i.value;
    Ve(u.value, l.value, {
      middleware: s.value,
      placement: r.value,
      strategy: c.value
    }).then((A) => {
      d.value = A.x, m.value = A.y, a.value = A.strategy, h.value = A.placement, g.value = A.middlewareData, w.value = v !== !1;
    });
  }
  function b() {
    typeof x == "function" && (x(), x = void 0);
  }
  function O() {
    if (b(), o === void 0) {
      y();
      return;
    }
    if (u.value != null && l.value != null) {
      x = o(u.value, l.value, y);
      return;
    }
  }
  function R() {
    i.value || (w.value = !1);
  }
  return ht([s, r, c, i], y, {
    flush: "sync"
  }), ht([u, l], O, {
    flush: "sync"
  }), ht(i, R, {
    flush: "sync"
  }), qt() && Ut(b), {
    x: J(d),
    y: J(m),
    strategy: J(a),
    placement: J(h),
    middlewareData: J(g),
    isPositioned: J(w),
    floatingStyles: p,
    update: y
  };
}
export {
  $e as a,
  ze as b,
  He as c,
  Be as f,
  Ne as o,
  _e as s,
  Ie as u
};
//# sourceMappingURL=floating-ui.vue-B4We5rJr.js.map
