import { onMounted as B, nextTick as k, unref as $, getCurrentScope as Q, onScopeDispose as U, getCurrentInstance as L, ref as g, watch as S, shallowRef as Y, watchEffect as H, readonly as j, isRef as W, computed as P, reactive as N } from "vue";
function de(e, t) {
  var o;
  const n = Y();
  return H(() => {
    n.value = e();
  }, {
    ...t,
    flush: (o = void 0) != null ? o : "sync"
  }), j(n);
}
function T(e) {
  return Q() ? (U(e), !0) : !1;
}
function b(e) {
  return typeof e == "function" ? e() : $(e);
}
function K(e) {
  if (!W(e))
    return N(e);
  const t = new Proxy({}, {
    get(o, n, r) {
      return $(Reflect.get(e.value, n, r));
    },
    set(o, n, r) {
      return W(e.value[n]) && !W(r) ? e.value[n].value = r : e.value[n] = r, !0;
    },
    deleteProperty(o, n) {
      return Reflect.deleteProperty(e.value, n);
    },
    has(o, n) {
      return Reflect.has(e.value, n);
    },
    ownKeys() {
      return Object.keys(e.value);
    },
    getOwnPropertyDescriptor() {
      return {
        enumerable: !0,
        configurable: !0
      };
    }
  });
  return N(t);
}
function ve(e) {
  return K(P(e));
}
const R = typeof window < "u" && typeof document < "u";
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
const X = (e) => typeof e < "u", q = (e) => e != null, Z = Object.prototype.toString, ee = (e) => Z.call(e) === "[object Object]", me = (e, t, o) => Math.min(o, Math.max(t, e)), x = () => {
}, te = /* @__PURE__ */ ne();
function ne() {
  var e, t;
  return R && ((e = window == null ? void 0 : window.navigator) == null ? void 0 : e.userAgent) && (/iP(?:ad|hone|od)/.test(window.navigator.userAgent) || ((t = window == null ? void 0 : window.navigator) == null ? void 0 : t.maxTouchPoints) > 2 && /iPad|Macintosh/.test(window == null ? void 0 : window.navigator.userAgent));
}
function G(e, t) {
  function o(...n) {
    return new Promise((r, l) => {
      Promise.resolve(e(() => t.apply(this, n), { fn: t, thisArg: this, args: n })).then(r).catch(l);
    });
  }
  return o;
}
function oe(e, t = {}) {
  let o, n, r = x;
  const l = (i) => {
    clearTimeout(i), r(), r = x;
  };
  return (i) => {
    const f = b(e), a = b(t.maxWait);
    return o && l(o), f <= 0 || a !== void 0 && a <= 0 ? (n && (l(n), n = null), Promise.resolve(i())) : new Promise((s, u) => {
      r = t.rejectOnCancel ? u : s, a && !n && (n = setTimeout(() => {
        o && l(o), n = null, s(i());
      }, a)), o = setTimeout(() => {
        n && l(n), n = null, s(i());
      }, f);
    });
  };
}
function re(...e) {
  let t = 0, o, n = !0, r = x, l, c, i, f, a;
  !W(e[0]) && typeof e[0] == "object" ? { delay: c, trailing: i = !0, leading: f = !0, rejectOnCancel: a = !1 } = e[0] : [c, i = !0, f = !0, a = !1] = e;
  const s = () => {
    o && (clearTimeout(o), o = void 0, r(), r = x);
  };
  return (v) => {
    const m = b(c), p = Date.now() - t, d = () => l = v();
    return s(), m <= 0 ? (t = Date.now(), d()) : (p > m && (f || !n) ? (t = Date.now(), d()) : i && (l = new Promise((h, w) => {
      r = a ? w : h, o = setTimeout(() => {
        t = Date.now(), n = !0, h(d()), s();
      }, Math.max(0, m - p));
    })), !f && !o && (o = setTimeout(() => n = !0, m)), n = !1, l);
  };
}
function ie(e) {
  return L();
}
function se(e, t = 200, o = {}) {
  return G(
    oe(t, o),
    e
  );
}
function he(e, t = 200, o = {}) {
  const n = g(e.value), r = se(() => {
    n.value = e.value;
  }, t, o);
  return S(e, () => r()), n;
}
function pe(e, t = 200, o = !1, n = !0, r = !1) {
  return G(
    re(t, o, n, r),
    e
  );
}
function V(e, t = !0, o) {
  ie() ? B(e, o) : t ? e() : k(e);
}
function we(e, t, o = {}) {
  const {
    immediate: n = !0
  } = o, r = g(!1);
  let l = null;
  function c() {
    l && (clearTimeout(l), l = null);
  }
  function i() {
    r.value = !1, c();
  }
  function f(...a) {
    c(), r.value = !0, l = setTimeout(() => {
      r.value = !1, l = null, e(...a);
    }, b(t));
  }
  return n && (r.value = !0, R && f()), T(i), {
    isPending: j(r),
    start: f,
    stop: i
  };
}
const _ = R ? window : void 0, ue = R ? window.document : void 0;
function y(e) {
  var t;
  const o = b(e);
  return (t = o == null ? void 0 : o.$el) != null ? t : o;
}
function A(...e) {
  let t, o, n, r;
  if (typeof e[0] == "string" || Array.isArray(e[0]) ? ([o, n, r] = e, t = _) : [t, o, n, r] = e, !t)
    return x;
  Array.isArray(o) || (o = [o]), Array.isArray(n) || (n = [n]);
  const l = [], c = () => {
    l.forEach((s) => s()), l.length = 0;
  }, i = (s, u, v, m) => (s.addEventListener(u, v, m), () => s.removeEventListener(u, v, m)), f = S(
    () => [y(t), b(r)],
    ([s, u]) => {
      if (c(), !s)
        return;
      const v = ee(u) ? { ...u } : u;
      l.push(
        ...o.flatMap((m) => n.map((p) => i(s, m, p, v)))
      );
    },
    { immediate: !0, flush: "post" }
  ), a = () => {
    f(), c();
  };
  return T(a), a;
}
let z = !1;
function ge(e, t, o = {}) {
  const { window: n = _, ignore: r = [], capture: l = !0, detectIframe: c = !1 } = o;
  if (!n)
    return x;
  te && !z && (z = !0, Array.from(n.document.body.children).forEach((d) => d.addEventListener("click", x)), n.document.documentElement.addEventListener("click", x));
  let i = !0;
  const f = (d) => b(r).some((h) => {
    if (typeof h == "string")
      return Array.from(n.document.querySelectorAll(h)).some((w) => w === d.target || d.composedPath().includes(w));
    {
      const w = y(h);
      return w && (d.target === w || d.composedPath().includes(w));
    }
  });
  function a(d) {
    const h = b(d);
    return h && h.$.subTree.shapeFlag === 16;
  }
  function s(d, h) {
    const w = b(d), E = w.$.subTree && w.$.subTree.children;
    return E == null || !Array.isArray(E) ? !1 : E.some((O) => O.el === h.target || h.composedPath().includes(O.el));
  }
  const u = (d) => {
    const h = y(e);
    if (d.target != null && !(!(h instanceof Element) && a(e) && s(e, d)) && !(!h || h === d.target || d.composedPath().includes(h))) {
      if (d.detail === 0 && (i = !f(d)), !i) {
        i = !0;
        return;
      }
      t(d);
    }
  };
  let v = !1;
  const m = [
    A(n, "click", (d) => {
      v || (v = !0, setTimeout(() => {
        v = !1;
      }, 0), u(d));
    }, { passive: !0, capture: l }),
    A(n, "pointerdown", (d) => {
      const h = y(e);
      i = !f(d) && !!(h && !d.composedPath().includes(h));
    }, { passive: !0 }),
    c && A(n, "blur", (d) => {
      setTimeout(() => {
        var h;
        const w = y(e);
        ((h = n.document.activeElement) == null ? void 0 : h.tagName) === "IFRAME" && !(w != null && w.contains(n.document.activeElement)) && t(d);
      }, 0);
    })
  ].filter(Boolean);
  return () => m.forEach((d) => d());
}
function le() {
  const e = g(!1), t = L();
  return t && B(() => {
    e.value = !0;
  }, t), e;
}
function F(e) {
  const t = le();
  return P(() => (t.value, !!e()));
}
function D(e, t, o = {}) {
  const { window: n = _, ...r } = o;
  let l;
  const c = F(() => n && "MutationObserver" in n), i = () => {
    l && (l.disconnect(), l = void 0);
  }, f = P(() => {
    const v = b(e), m = (Array.isArray(v) ? v : [v]).map(y).filter(q);
    return new Set(m);
  }), a = S(
    () => f.value,
    (v) => {
      i(), c.value && v.size && (l = new MutationObserver(t), v.forEach((m) => l.observe(m, r)));
    },
    { immediate: !0, flush: "post" }
  ), s = () => l == null ? void 0 : l.takeRecords(), u = () => {
    a(), i();
  };
  return T(u), {
    isSupported: c,
    stop: u,
    takeRecords: s
  };
}
function ye(e = {}) {
  var t;
  const {
    window: o = _,
    deep: n = !0,
    triggerOnRemoval: r = !1
  } = e, l = (t = e.document) != null ? t : o == null ? void 0 : o.document, c = () => {
    var a;
    let s = l == null ? void 0 : l.activeElement;
    if (n)
      for (; s != null && s.shadowRoot; )
        s = (a = s == null ? void 0 : s.shadowRoot) == null ? void 0 : a.activeElement;
    return s;
  }, i = g(), f = () => {
    i.value = c();
  };
  return o && (A(o, "blur", (a) => {
    a.relatedTarget === null && f();
  }, !0), A(o, "focus", f, !0)), r && D(l, (a) => {
    a.filter((s) => s.removedNodes.length).map((s) => Array.from(s.removedNodes)).flat().forEach((s) => {
      s === i.value && f();
    });
  }, {
    childList: !0,
    subtree: !0
  }), f(), i;
}
function ae(e, t = {}) {
  const { window: o = _ } = t, n = F(() => o && "matchMedia" in o && typeof o.matchMedia == "function");
  let r;
  const l = g(!1), c = (a) => {
    l.value = a.matches;
  }, i = () => {
    r && ("removeEventListener" in r ? r.removeEventListener("change", c) : r.removeListener(c));
  }, f = H(() => {
    n.value && (i(), r = o.matchMedia(b(e)), "addEventListener" in r ? r.addEventListener("change", c) : r.addListener(c), l.value = r.matches);
  });
  return T(() => {
    f(), i(), r = void 0;
  }), l;
}
function ce(e) {
  return JSON.parse(JSON.stringify(e));
}
function be(e, t, o = {}) {
  const { window: n = _, initialValue: r, observe: l = !1 } = o, c = g(r), i = P(() => {
    var a;
    return y(t) || ((a = n == null ? void 0 : n.document) == null ? void 0 : a.documentElement);
  });
  function f() {
    var a;
    const s = b(e), u = b(i);
    if (u && n && s) {
      const v = (a = n.getComputedStyle(u).getPropertyValue(s)) == null ? void 0 : a.trim();
      c.value = v || r;
    }
  }
  return l && D(i, f, {
    attributeFilter: ["style", "class"],
    window: n
  }), S(
    [i, () => b(e)],
    (a, s) => {
      s[0] && s[1] && s[0].style.removeProperty(s[1]), f();
    },
    { immediate: !0 }
  ), S(
    c,
    (a) => {
      var s;
      const u = b(e);
      (s = i.value) != null && s.style && u && (a == null ? i.value.style.removeProperty(u) : i.value.style.setProperty(u, a));
    }
  ), c;
}
function Ee(e = {}) {
  const { document: t = ue } = e;
  if (!t)
    return g("visible");
  const o = g(t.visibilityState);
  return A(t, "visibilitychange", () => {
    o.value = t.visibilityState;
  }), o;
}
function J(e, t, o = {}) {
  const { window: n = _, ...r } = o;
  let l;
  const c = F(() => n && "ResizeObserver" in n), i = () => {
    l && (l.disconnect(), l = void 0);
  }, f = P(() => {
    const u = b(e);
    return Array.isArray(u) ? u.map((v) => y(v)) : [y(u)];
  }), a = S(
    f,
    (u) => {
      if (i(), c.value && n) {
        l = new ResizeObserver(t);
        for (const v of u)
          v && l.observe(v, r);
      }
    },
    { immediate: !0, flush: "post" }
  ), s = () => {
    i(), a();
  };
  return T(s), {
    isSupported: c,
    stop: s
  };
}
function Oe(e, t = {}) {
  const {
    reset: o = !0,
    windowResize: n = !0,
    windowScroll: r = !0,
    immediate: l = !0,
    updateTiming: c = "sync"
  } = t, i = g(0), f = g(0), a = g(0), s = g(0), u = g(0), v = g(0), m = g(0), p = g(0);
  function d() {
    const w = y(e);
    if (!w) {
      o && (i.value = 0, f.value = 0, a.value = 0, s.value = 0, u.value = 0, v.value = 0, m.value = 0, p.value = 0);
      return;
    }
    const E = w.getBoundingClientRect();
    i.value = E.height, f.value = E.bottom, a.value = E.left, s.value = E.right, u.value = E.top, v.value = E.width, m.value = E.x, p.value = E.y;
  }
  function h() {
    c === "sync" ? d() : c === "next-frame" && requestAnimationFrame(() => d());
  }
  return J(e, h), S(() => y(e), (w) => !w && h()), D(e, h, {
    attributeFilter: ["style", "class"]
  }), r && A("scroll", h, { capture: !0, passive: !0 }), n && A("resize", h, { passive: !0 }), V(() => {
    l && h();
  }), {
    height: i,
    bottom: f,
    left: a,
    right: s,
    top: u,
    width: v,
    x: m,
    y: p,
    update: h
  };
}
function Se(e, t = { width: 0, height: 0 }, o = {}) {
  const { window: n = _, box: r = "content-box" } = o, l = P(() => {
    var u, v;
    return (v = (u = y(e)) == null ? void 0 : u.namespaceURI) == null ? void 0 : v.includes("svg");
  }), c = g(t.width), i = g(t.height), { stop: f } = J(
    e,
    ([u]) => {
      const v = r === "border-box" ? u.borderBoxSize : r === "content-box" ? u.contentBoxSize : u.devicePixelContentBoxSize;
      if (n && l.value) {
        const m = y(e);
        if (m) {
          const p = m.getBoundingClientRect();
          c.value = p.width, i.value = p.height;
        }
      } else if (v) {
        const m = Array.isArray(v) ? v : [v];
        c.value = m.reduce((p, { inlineSize: d }) => p + d, 0), i.value = m.reduce((p, { blockSize: d }) => p + d, 0);
      } else
        c.value = u.contentRect.width, i.value = u.contentRect.height;
    },
    o
  );
  V(() => {
    const u = y(e);
    u && (c.value = "offsetWidth" in u ? u.offsetWidth : t.width, i.value = "offsetHeight" in u ? u.offsetHeight : t.height);
  });
  const a = S(
    () => y(e),
    (u) => {
      c.value = u ? t.width : 0, i.value = u ? t.height : 0;
    }
  );
  function s() {
    f(), a();
  }
  return {
    width: c,
    height: i,
    stop: s
  };
}
function xe(e, t, o = {}) {
  const {
    root: n,
    rootMargin: r = "0px",
    threshold: l = 0,
    window: c = _,
    immediate: i = !0
  } = o, f = F(() => c && "IntersectionObserver" in c), a = P(() => {
    const p = b(e);
    return (Array.isArray(p) ? p : [p]).map(y).filter(q);
  });
  let s = x;
  const u = g(i), v = f.value ? S(
    () => [a.value, y(n), u.value],
    ([p, d]) => {
      if (s(), !u.value || !p.length)
        return;
      const h = new IntersectionObserver(
        t,
        {
          root: y(d),
          rootMargin: r,
          threshold: l
        }
      );
      p.forEach((w) => w && h.observe(w)), s = () => {
        h.disconnect(), s = x;
      };
    },
    { immediate: i, flush: "post" }
  ) : x, m = () => {
    s(), v(), u.value = !1;
  };
  return T(m), {
    isSupported: f,
    isActive: u,
    pause() {
      s(), u.value = !1;
    },
    resume() {
      u.value = !0;
    },
    stop: m
  };
}
function Ae(e, t, o, n = {}) {
  var r, l, c;
  const {
    clone: i = !1,
    passive: f = !1,
    eventName: a,
    deep: s = !1,
    defaultValue: u,
    shouldEmit: v
  } = n, m = L(), p = o || (m == null ? void 0 : m.emit) || ((r = m == null ? void 0 : m.$emit) == null ? void 0 : r.bind(m)) || ((c = (l = m == null ? void 0 : m.proxy) == null ? void 0 : l.$emit) == null ? void 0 : c.bind(m == null ? void 0 : m.proxy));
  let d = a;
  t || (t = "modelValue"), d = d || `update:${t.toString()}`;
  const h = (O) => i ? typeof i == "function" ? i(O) : ce(O) : O, w = () => X(e[t]) ? h(e[t]) : u, E = (O) => {
    v ? v(O) && p(d, O) : p(d, O);
  };
  if (f) {
    const O = w(), C = g(O);
    let M = !1;
    return S(
      () => e[t],
      (I) => {
        M || (M = !0, C.value = h(I), k(() => M = !1));
      }
    ), S(
      C,
      (I) => {
        !M && (I !== e[t] || s) && E(I);
      },
      { deep: s }
    ), C;
  } else
    return P({
      get() {
        return w();
      },
      set(O) {
        E(O);
      }
    });
}
function _e(e = {}) {
  const { window: t = _ } = e;
  if (!t)
    return g(!1);
  const o = g(t.document.hasFocus());
  return A(t, "blur", () => {
    o.value = !1;
  }), A(t, "focus", () => {
    o.value = !0;
  }), o;
}
function Pe(e = {}) {
  const {
    window: t = _,
    initialWidth: o = Number.POSITIVE_INFINITY,
    initialHeight: n = Number.POSITIVE_INFINITY,
    listenOrientation: r = !0,
    includeScrollbar: l = !0,
    type: c = "inner"
  } = e, i = g(o), f = g(n), a = () => {
    t && (c === "outer" ? (i.value = t.outerWidth, f.value = t.outerHeight) : l ? (i.value = t.innerWidth, f.value = t.innerHeight) : (i.value = t.document.documentElement.clientWidth, f.value = t.document.documentElement.clientHeight));
  };
  if (a(), V(a), A("resize", a, { passive: !0 }), r) {
    const s = ae("(orientation: portrait)");
    S(s, () => a());
  }
  return { width: i, height: f };
}
export {
  A as a,
  Pe as b,
  de as c,
  Oe as d,
  y as e,
  se as f,
  pe as g,
  D as h,
  R as i,
  te as j,
  be as k,
  ve as l,
  we as m,
  me as n,
  ge as o,
  xe as p,
  Ee as q,
  he as r,
  _e as s,
  T as t,
  J as u,
  Se as v,
  Ae as w,
  ye as x
};
