import * as u from "react";
import { useEffect as M, useCallback as j, useState as pe, useRef as Y, useMemo as Xe, useLayoutEffect as Ue } from "react";
import * as Ve from "react-dom";
import { jsx as N, Fragment as Ge } from "react/jsx-runtime";
import { g as Te, c as G } from "./chunk-RXIM6GTA.C-ABNABt.js";
function Je(e, t) {
  typeof e == "function" ? e(t) : e != null && (e.current = t);
}
function je(...e) {
  return (t) => e.forEach((n) => Je(n, t));
}
function Wn(...e) {
  return u.useCallback(je(...e), e);
}
var Pe = u.forwardRef((e, t) => {
  const { children: n, ...r } = e, i = u.Children.toArray(n), o = i.find(qe);
  if (o) {
    const s = o.props.children, a = i.map((c) => c === o ? u.Children.count(s) > 1 ? u.Children.only(null) : u.isValidElement(s) ? s.props.children : null : c);
    return /* @__PURE__ */ N(ae, { ...r, ref: t, children: u.isValidElement(s) ? u.cloneElement(s, void 0, a) : null });
  }
  return /* @__PURE__ */ N(ae, { ...r, ref: t, children: n });
});
Pe.displayName = "Slot";
var ae = u.forwardRef((e, t) => {
  const { children: n, ...r } = e;
  if (u.isValidElement(n)) {
    const i = Ze(n);
    return u.cloneElement(n, {
      ...Ke(r, n.props),
      // @ts-ignore
      ref: t ? je(t, i) : i
    });
  }
  return u.Children.count(n) > 1 ? u.Children.only(null) : null;
});
ae.displayName = "SlotClone";
var Qe = ({ children: e }) => /* @__PURE__ */ N(Ge, { children: e });
function qe(e) {
  return u.isValidElement(e) && e.type === Qe;
}
function Ke(e, t) {
  const n = { ...t };
  for (const r in t) {
    const i = e[r], o = t[r];
    /^on[A-Z]/.test(r) ? i && o ? n[r] = (...a) => {
      o(...a), i(...a);
    } : i && (n[r] = i) : r === "style" ? n[r] = { ...i, ...o } : r === "className" && (n[r] = [i, o].filter(Boolean).join(" "));
  }
  return { ...e, ...n };
}
function Ze(e) {
  var r, i;
  let t = (r = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : r.get, n = t && "isReactWarning" in t && t.isReactWarning;
  return n ? e.ref : (t = (i = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : i.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
}
var et = [
  "a",
  "button",
  "div",
  "form",
  "h2",
  "h3",
  "img",
  "input",
  "label",
  "li",
  "nav",
  "ol",
  "p",
  "span",
  "svg",
  "ul"
], tt = et.reduce((e, t) => {
  const n = u.forwardRef((r, i) => {
    const { asChild: o, ...s } = r, a = o ? Pe : t;
    return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ N(a, { ...s, ref: i });
  });
  return n.displayName = `Primitive.${t}`, { ...e, [t]: n };
}, {});
function _n(e, t) {
  e && Ve.flushSync(() => e.dispatchEvent(t));
}
var nt = "VisuallyHidden", Ne = u.forwardRef(
  (e, t) => /* @__PURE__ */ N(
    tt.span,
    {
      ...e,
      ref: t,
      style: {
        // See: https://github.com/twbs/bootstrap/blob/master/scss/mixins/_screen-reader.scss
        position: "absolute",
        border: 0,
        width: 1,
        height: 1,
        padding: 0,
        margin: -1,
        overflow: "hidden",
        clip: "rect(0, 0, 0, 0)",
        whiteSpace: "nowrap",
        wordWrap: "normal",
        ...e.style
      }
    }
  )
);
Ne.displayName = nt;
var In = Ne, Re = { exports: {} };
/*!
	Copyright (c) 2018 Jed Watson.
	Licensed under the MIT License (MIT), see
	http://jedwatson.github.io/classnames
*/
(function(e) {
  (function() {
    var t = {}.hasOwnProperty;
    function n() {
      for (var r = [], i = 0; i < arguments.length; i++) {
        var o = arguments[i];
        if (o) {
          var s = typeof o;
          if (s === "string" || s === "number")
            r.push(o);
          else if (Array.isArray(o)) {
            if (o.length) {
              var a = n.apply(null, o);
              a && r.push(a);
            }
          } else if (s === "object") {
            if (o.toString !== Object.prototype.toString && !o.toString.toString().includes("[native code]")) {
              r.push(o.toString());
              continue;
            }
            for (var c in o)
              t.call(o, c) && o[c] && r.push(c);
          }
        }
      }
      return r.join(" ");
    }
    e.exports ? (n.default = n, e.exports = n) : window.classNames = n;
  })();
})(Re);
var rt = Re.exports;
const Fn = /* @__PURE__ */ Te(rt);
function Bn(e, t) {
  const n = u.createContext(t);
  function r(o) {
    const { children: s, ...a } = o, c = u.useMemo(() => a, Object.values(a));
    return /* @__PURE__ */ N(n.Provider, { value: c, children: s });
  }
  function i(o) {
    const s = u.useContext(n);
    if (s) return s;
    if (t !== void 0) return t;
    throw new Error(`\`${o}\` must be used within \`${e}\``);
  }
  return r.displayName = e + "Provider", [r, i];
}
function Hn(e, t = []) {
  let n = [];
  function r(o, s) {
    const a = u.createContext(s), c = n.length;
    n = [...n, s];
    function l(m) {
      const { scope: d, children: p, ...g } = m, b = (d == null ? void 0 : d[e][c]) || a, U = u.useMemo(() => g, Object.values(g));
      return /* @__PURE__ */ N(b.Provider, { value: U, children: p });
    }
    function f(m, d) {
      const p = (d == null ? void 0 : d[e][c]) || a, g = u.useContext(p);
      if (g) return g;
      if (s !== void 0) return s;
      throw new Error(`\`${m}\` must be used within \`${o}\``);
    }
    return l.displayName = o + "Provider", [l, f];
  }
  const i = () => {
    const o = n.map((s) => u.createContext(s));
    return function(a) {
      const c = (a == null ? void 0 : a[e]) || o;
      return u.useMemo(
        () => ({ [`__scope${e}`]: { ...a, [e]: c } }),
        [a, c]
      );
    };
  };
  return i.scopeName = e, [r, ot(i, ...t)];
}
function ot(...e) {
  const t = e[0];
  if (e.length === 1) return t;
  const n = () => {
    const r = e.map((i) => ({
      useScope: i(),
      scopeName: i.scopeName
    }));
    return function(o) {
      const s = r.reduce((a, { useScope: c, scopeName: l }) => {
        const m = c(o)[`__scope${l}`];
        return { ...a, ...m };
      }, {});
      return u.useMemo(() => ({ [`__scope${t.scopeName}`]: s }), [s]);
    };
  };
  return n.scopeName = t.scopeName, n;
}
function Yn(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
  return function(i) {
    if (e == null || e(i), n === !1 || !i.defaultPrevented)
      return t == null ? void 0 : t(i);
  };
}
var it = globalThis != null && globalThis.document ? u.useLayoutEffect : () => {
};
function Le(e) {
  const t = u.useRef(e);
  return u.useEffect(() => {
    t.current = e;
  }), u.useMemo(() => (...n) => {
    var r;
    return (r = t.current) == null ? void 0 : r.call(t, ...n);
  }, []);
}
function Xn({
  prop: e,
  defaultProp: t,
  onChange: n = () => {
  }
}) {
  const [r, i] = st({ defaultProp: t, onChange: n }), o = e !== void 0, s = o ? e : r, a = Le(n), c = u.useCallback(
    (l) => {
      if (o) {
        const m = typeof l == "function" ? l(e) : l;
        m !== e && a(m);
      } else
        i(l);
    },
    [o, e, i, a]
  );
  return [s, c];
}
function st({
  defaultProp: e,
  onChange: t
}) {
  const n = u.useState(e), [r] = n, i = u.useRef(r), o = Le(t);
  return u.useEffect(() => {
    i.current !== r && (o(r), i.current = r);
  }, [r, i, o]), n;
}
function Un(e) {
  const [t, n] = u.useState(void 0);
  return it(() => {
    if (e) {
      n({ width: e.offsetWidth, height: e.offsetHeight });
      const r = new ResizeObserver((i) => {
        if (!Array.isArray(i) || !i.length)
          return;
        const o = i[0];
        let s, a;
        if ("borderBoxSize" in o) {
          const c = o.borderBoxSize, l = Array.isArray(c) ? c[0] : c;
          s = l.inlineSize, a = l.blockSize;
        } else
          s = e.offsetWidth, a = e.offsetHeight;
        n({ width: s, height: a });
      });
      return r.observe(e, { box: "border-box" }), () => r.unobserve(e);
    } else
      n(void 0);
  }, [e]), t;
}
const ke = /* @__PURE__ */ new Set(), y = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), R = /* @__PURE__ */ new WeakMap(), ce = /* @__PURE__ */ new WeakMap(), at = /* @__PURE__ */ new WeakMap(), A = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakSet();
let $, me = 0, he = 0;
const E = "__aa_tgt", B = "__aa_del", K = "__aa_new", ct = (e) => {
  const t = mt(e);
  t && t.forEach((n) => ht(n));
}, lt = (e) => {
  e.forEach((t) => {
    t.target === $ && ut(), y.has(t.target) && L(t.target);
  });
};
function dt(e) {
  const t = ce.get(e);
  t == null || t.disconnect();
  let n = y.get(e), r = 0;
  const i = 5;
  n || (n = W(e), y.set(e, n));
  const { offsetWidth: o, offsetHeight: s } = $, c = [
    n.top - i,
    o - (n.left + i + n.width),
    s - (n.top + i + n.height),
    n.left - i
  ].map((f) => `${-1 * Math.floor(f)}px`).join(" "), l = new IntersectionObserver(() => {
    ++r > 1 && L(e);
  }, {
    root: $,
    threshold: 1,
    rootMargin: c
  });
  l.observe(e), ce.set(e, l);
}
function L(e) {
  clearTimeout(q.get(e));
  const t = ee(e), n = H(t) ? 500 : t.duration;
  q.set(e, setTimeout(async () => {
    const r = R.get(e);
    try {
      await (r == null ? void 0 : r.finished), y.set(e, W(e)), dt(e);
    } catch {
    }
  }, n));
}
function ut() {
  clearTimeout(q.get($)), q.set($, setTimeout(() => {
    ke.forEach((e) => We(e, (t) => ze(() => L(t))));
  }, 100));
}
function ft(e) {
  setTimeout(() => {
    at.set(e, setInterval(() => ze(L.bind(null, e)), 2e3));
  }, Math.round(2e3 * Math.random()));
}
function ze(e) {
  typeof requestIdleCallback == "function" ? requestIdleCallback(() => e()) : requestAnimationFrame(() => e());
}
let le, z;
const pt = typeof window < "u" && "ResizeObserver" in window;
pt && ($ = document.documentElement, le = new MutationObserver(ct), z = new ResizeObserver(lt), window.addEventListener("scroll", () => {
  he = window.scrollY, me = window.scrollX;
}), z.observe($));
function mt(e) {
  return e.reduce((r, i) => [
    ...r,
    ...Array.from(i.addedNodes),
    ...Array.from(i.removedNodes)
  ], []).every((r) => r.nodeName === "#comment") ? !1 : e.reduce((r, i) => {
    if (r === !1)
      return !1;
    if (i.target instanceof Element) {
      if (oe(i.target), !r.has(i.target)) {
        r.add(i.target);
        for (let o = 0; o < i.target.children.length; o++) {
          const s = i.target.children.item(o);
          if (s) {
            if (B in s)
              return !1;
            oe(i.target, s), r.add(s);
          }
        }
      }
      if (i.removedNodes.length)
        for (let o = 0; o < i.removedNodes.length; o++) {
          const s = i.removedNodes[o];
          if (B in s)
            return !1;
          s instanceof Element && (r.add(s), oe(i.target, s), D.set(s, [
            i.previousSibling,
            i.nextSibling
          ]));
        }
    }
    return r;
  }, /* @__PURE__ */ new Set());
}
function oe(e, t) {
  !t && !(E in e) ? Object.defineProperty(e, E, { value: e }) : t && !(E in t) && Object.defineProperty(t, E, { value: e });
}
function ht(e) {
  var t;
  const n = e.isConnected, r = y.has(e);
  n && D.has(e) && D.delete(e), R.has(e) && ((t = R.get(e)) === null || t === void 0 || t.cancel()), K in e ? we(e) : r && n ? vt(e) : r && !n ? yt(e) : we(e);
}
function w(e) {
  return Number(e.replace(/[^0-9.\-]/g, ""));
}
function gt(e) {
  let t = e.parentElement;
  for (; t; ) {
    if (t.scrollLeft || t.scrollTop)
      return { x: t.scrollLeft, y: t.scrollTop };
    t = t.parentElement;
  }
  return { x: 0, y: 0 };
}
function W(e) {
  const t = e.getBoundingClientRect(), { x: n, y: r } = gt(e);
  return {
    top: t.top + r,
    left: t.left + n,
    width: t.width,
    height: t.height
  };
}
function De(e, t, n) {
  let r = t.width, i = t.height, o = n.width, s = n.height;
  const a = getComputedStyle(e);
  if (a.getPropertyValue("box-sizing") === "content-box") {
    const l = w(a.paddingTop) + w(a.paddingBottom) + w(a.borderTopWidth) + w(a.borderBottomWidth), f = w(a.paddingLeft) + w(a.paddingRight) + w(a.borderRightWidth) + w(a.borderLeftWidth);
    r -= f, o -= f, i -= l, s -= l;
  }
  return [r, o, i, s].map(Math.round);
}
function ee(e) {
  return E in e && A.has(e[E]) ? A.get(e[E]) : { duration: 250, easing: "ease-in-out" };
}
function Ae(e) {
  if (E in e)
    return e[E];
}
function ge(e) {
  const t = Ae(e);
  return t ? I.has(t) : !1;
}
function We(e, ...t) {
  t.forEach((n) => n(e, A.has(e)));
  for (let n = 0; n < e.children.length; n++) {
    const r = e.children.item(n);
    r && t.forEach((i) => i(r, A.has(r)));
  }
}
function ve(e) {
  return Array.isArray(e) ? e : [e];
}
function H(e) {
  return typeof e == "function";
}
function vt(e) {
  const t = y.get(e), n = W(e);
  if (!ge(e))
    return y.set(e, n);
  let r;
  if (!t)
    return;
  const i = ee(e);
  if (typeof i != "function") {
    const o = t.left - n.left, s = t.top - n.top, [a, c, l, f] = De(e, t, n), m = {
      transform: `translate(${o}px, ${s}px)`
    }, d = {
      transform: "translate(0, 0)"
    };
    a !== c && (m.width = `${a}px`, d.width = `${c}px`), l !== f && (m.height = `${l}px`, d.height = `${f}px`), r = e.animate([m, d], {
      duration: i.duration,
      easing: i.easing
    });
  } else {
    const [o] = ve(i(e, "remain", t, n));
    r = new Animation(o), r.play();
  }
  R.set(e, r), y.set(e, n), r.addEventListener("finish", L.bind(null, e));
}
function we(e) {
  K in e && delete e[K];
  const t = W(e);
  y.set(e, t);
  const n = ee(e);
  if (!ge(e))
    return;
  let r;
  if (typeof n != "function")
    r = e.animate([
      { transform: "scale(.98)", opacity: 0 },
      { transform: "scale(0.98)", opacity: 0, offset: 0.5 },
      { transform: "scale(1)", opacity: 1 }
    ], {
      duration: n.duration * 1.5,
      easing: "ease-in"
    });
  else {
    const [i] = ve(n(e, "add", t));
    r = new Animation(i), r.play();
  }
  R.set(e, r), r.addEventListener("finish", L.bind(null, e));
}
function xe(e, t) {
  var n;
  e.remove(), y.delete(e), D.delete(e), R.delete(e), (n = ce.get(e)) === null || n === void 0 || n.disconnect(), setTimeout(() => {
    if (B in e && delete e[B], Object.defineProperty(e, K, { value: !0, configurable: !0 }), t && e instanceof HTMLElement)
      for (const r in t)
        e.style[r] = "";
  }, 0);
}
function yt(e) {
  var t;
  if (!D.has(e) || !y.has(e))
    return;
  const [n, r] = D.get(e);
  Object.defineProperty(e, B, { value: !0, configurable: !0 });
  const i = window.scrollX, o = window.scrollY;
  if (r && r.parentNode && r.parentNode instanceof Element ? r.parentNode.insertBefore(e, r) : n && n.parentNode ? n.parentNode.appendChild(e) : (t = Ae(e)) === null || t === void 0 || t.appendChild(e), !ge(e))
    return xe(e);
  const [s, a, c, l] = wt(e), f = ee(e), m = y.get(e);
  (i !== me || o !== he) && bt(e, i, o, f);
  let d, p = {
    position: "absolute",
    top: `${s}px`,
    left: `${a}px`,
    width: `${c}px`,
    height: `${l}px`,
    margin: "0",
    pointerEvents: "none",
    transformOrigin: "center",
    zIndex: "100"
  };
  if (!H(f))
    Object.assign(e.style, p), d = e.animate([
      {
        transform: "scale(1)",
        opacity: 1
      },
      {
        transform: "scale(.98)",
        opacity: 0
      }
    ], { duration: f.duration, easing: "ease-out" });
  else {
    const [g, b] = ve(f(e, "remove", m));
    (b == null ? void 0 : b.styleReset) !== !1 && (p = (b == null ? void 0 : b.styleReset) || p, Object.assign(e.style, p)), d = new Animation(g), d.play();
  }
  R.set(e, d), d.addEventListener("finish", xe.bind(null, e, p));
}
function bt(e, t, n, r) {
  const i = me - t, o = he - n, s = document.documentElement.style.scrollBehavior;
  if (getComputedStyle($).scrollBehavior === "smooth" && (document.documentElement.style.scrollBehavior = "auto"), window.scrollTo(window.scrollX + i, window.scrollY + o), !e.parentElement)
    return;
  const c = e.parentElement;
  let l = c.clientHeight, f = c.clientWidth;
  const m = performance.now();
  function d() {
    requestAnimationFrame(() => {
      if (!H(r)) {
        const p = l - c.clientHeight, g = f - c.clientWidth;
        m + r.duration > performance.now() ? (window.scrollTo({
          left: window.scrollX - g,
          top: window.scrollY - p
        }), l = c.clientHeight, f = c.clientWidth, d()) : document.documentElement.style.scrollBehavior = s;
      }
    });
  }
  d();
}
function wt(e) {
  const t = y.get(e), [n, , r] = De(e, t, W(e));
  let i = e.parentElement;
  for (; i && (getComputedStyle(i).position === "static" || i instanceof HTMLBodyElement); )
    i = i.parentElement;
  i || (i = document.body);
  const o = getComputedStyle(i), s = y.get(i) || W(i), a = Math.round(t.top - s.top) - w(o.borderTopWidth), c = Math.round(t.left - s.left) - w(o.borderLeftWidth);
  return [a, c, n, r];
}
function Vn(e, t = {}) {
  return le && z && (window.matchMedia("(prefers-reduced-motion: reduce)").matches && !H(t) && !t.disrespectUserMotionPreference || (I.add(e), getComputedStyle(e).position === "static" && Object.assign(e.style, { position: "relative" }), We(e, L, ft, (i) => z == null ? void 0 : z.observe(i)), H(t) ? A.set(e, t) : A.set(e, { duration: 250, easing: "ease-in-out", ...t }), le.observe(e, { childList: !0 }), ke.add(e))), Object.freeze({
    parent: e,
    enable: () => {
      I.add(e);
    },
    disable: () => {
      I.delete(e);
    },
    isEnabled: () => I.has(e)
  });
}
let xt = { data: "" }, Et = (e) => typeof window == "object" ? ((e ? e.querySelector("#_goober") : window._goober) || Object.assign((e || document.head).appendChild(document.createElement("style")), { innerHTML: " ", id: "_goober" })).firstChild : e || xt, St = /(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g, Ct = /\/\*[^]*?\*\/|  +/g, Ee = /\n+/g, O = (e, t) => {
  let n = "", r = "", i = "";
  for (let o in e) {
    let s = e[o];
    o[0] == "@" ? o[1] == "i" ? n = o + " " + s + ";" : r += o[1] == "f" ? O(s, o) : o + "{" + O(s, o[1] == "k" ? "" : t) + "}" : typeof s == "object" ? r += O(s, t ? t.replace(/([^,])+/g, (a) => o.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g, (c) => /&/.test(c) ? c.replace(/&/g, a) : a ? a + " " + c : c)) : o) : s != null && (o = /^--/.test(o) ? o : o.replace(/[A-Z]/g, "-$&").toLowerCase(), i += O.p ? O.p(o, s) : o + ":" + s + ";");
  }
  return n + (t && i ? t + "{" + i + "}" : i) + r;
}, x = {}, _e = (e) => {
  if (typeof e == "object") {
    let t = "";
    for (let n in e) t += n + _e(e[n]);
    return t;
  }
  return e;
}, Ot = (e, t, n, r, i) => {
  let o = _e(e), s = x[o] || (x[o] = ((c) => {
    let l = 0, f = 11;
    for (; l < c.length; ) f = 101 * f + c.charCodeAt(l++) >>> 0;
    return "go" + f;
  })(o));
  if (!x[s]) {
    let c = o !== e ? e : ((l) => {
      let f, m, d = [{}];
      for (; f = St.exec(l.replace(Ct, "")); ) f[4] ? d.shift() : f[3] ? (m = f[3].replace(Ee, " ").trim(), d.unshift(d[0][m] = d[0][m] || {})) : d[0][f[1]] = f[2].replace(Ee, " ").trim();
      return d[0];
    })(e);
    x[s] = O(i ? { ["@keyframes " + s]: c } : c, n ? "" : "." + s);
  }
  let a = n && x.g ? x.g : null;
  return n && (x.g = x[s]), ((c, l, f, m) => {
    m ? l.data = l.data.replace(m, c) : l.data.indexOf(c) === -1 && (l.data = f ? c + l.data : l.data + c);
  })(x[s], t, r, a), s;
}, Mt = (e, t, n) => e.reduce((r, i, o) => {
  let s = t[o];
  if (s && s.call) {
    let a = s(n), c = a && a.props && a.props.className || /^go/.test(a) && a;
    s = c ? "." + c : a && typeof a == "object" ? a.props ? "" : O(a, "") : a === !1 ? "" : a;
  }
  return r + i + (s ?? "");
}, "");
function te(e) {
  let t = this || {}, n = e.call ? e(t.p) : e;
  return Ot(n.unshift ? n.raw ? Mt(n, [].slice.call(arguments, 1), t.p) : n.reduce((r, i) => Object.assign(r, i && i.call ? i(t.p) : i), {}) : n, Et(t.target), t.g, t.o, t.k);
}
let Ie, de, ue;
te.bind({ g: 1 });
let S = te.bind({ k: 1 });
function $t(e, t, n, r) {
  O.p = t, Ie = e, de = n, ue = r;
}
function T(e, t) {
  let n = this || {};
  return function() {
    let r = arguments;
    function i(o, s) {
      let a = Object.assign({}, o), c = a.className || i.className;
      n.p = Object.assign({ theme: de && de() }, a), n.o = / *go\d+/.test(c), a.className = te.apply(n, r) + (c ? " " + c : "");
      let l = e;
      return e[0] && (l = a.as || e, delete a.as), ue && l[0] && ue(a), Ie(l, a);
    }
    return i;
  };
}
var Tt = (e) => typeof e == "function", Z = (e, t) => Tt(e) ? e(t) : e, jt = /* @__PURE__ */ (() => {
  let e = 0;
  return () => (++e).toString();
})(), Fe = /* @__PURE__ */ (() => {
  let e;
  return () => {
    if (e === void 0 && typeof window < "u") {
      let t = matchMedia("(prefers-reduced-motion: reduce)");
      e = !t || t.matches;
    }
    return e;
  };
})(), Pt = 20, Be = (e, t) => {
  switch (t.type) {
    case 0:
      return { ...e, toasts: [t.toast, ...e.toasts].slice(0, Pt) };
    case 1:
      return { ...e, toasts: e.toasts.map((o) => o.id === t.toast.id ? { ...o, ...t.toast } : o) };
    case 2:
      let { toast: n } = t;
      return Be(e, { type: e.toasts.find((o) => o.id === n.id) ? 1 : 0, toast: n });
    case 3:
      let { toastId: r } = t;
      return { ...e, toasts: e.toasts.map((o) => o.id === r || r === void 0 ? { ...o, dismissed: !0, visible: !1 } : o) };
    case 4:
      return t.toastId === void 0 ? { ...e, toasts: [] } : { ...e, toasts: e.toasts.filter((o) => o.id !== t.toastId) };
    case 5:
      return { ...e, pausedAt: t.time };
    case 6:
      let i = t.time - (e.pausedAt || 0);
      return { ...e, pausedAt: void 0, toasts: e.toasts.map((o) => ({ ...o, pauseDuration: o.pauseDuration + i })) };
  }
}, Q = [], P = { toasts: [], pausedAt: void 0 }, k = (e) => {
  P = Be(P, e), Q.forEach((t) => {
    t(P);
  });
}, Nt = { blank: 4e3, error: 4e3, success: 2e3, loading: 1 / 0, custom: 4e3 }, Rt = (e = {}) => {
  let [t, n] = pe(P), r = Y(P);
  M(() => (r.current !== P && n(P), Q.push(n), () => {
    let o = Q.indexOf(n);
    o > -1 && Q.splice(o, 1);
  }), []);
  let i = t.toasts.map((o) => {
    var s, a, c;
    return { ...e, ...e[o.type], ...o, removeDelay: o.removeDelay || ((s = e[o.type]) == null ? void 0 : s.removeDelay) || (e == null ? void 0 : e.removeDelay), duration: o.duration || ((a = e[o.type]) == null ? void 0 : a.duration) || (e == null ? void 0 : e.duration) || Nt[o.type], style: { ...e.style, ...(c = e[o.type]) == null ? void 0 : c.style, ...o.style } };
  });
  return { ...t, toasts: i };
}, Lt = (e, t = "blank", n) => ({ createdAt: Date.now(), visible: !0, dismissed: !1, type: t, ariaProps: { role: "status", "aria-live": "polite" }, message: e, pauseDuration: 0, ...n, id: (n == null ? void 0 : n.id) || jt() }), X = (e) => (t, n) => {
  let r = Lt(t, e, n);
  return k({ type: 2, toast: r }), r.id;
}, v = (e, t) => X("blank")(e, t);
v.error = X("error");
v.success = X("success");
v.loading = X("loading");
v.custom = X("custom");
v.dismiss = (e) => {
  k({ type: 3, toastId: e });
};
v.remove = (e) => k({ type: 4, toastId: e });
v.promise = (e, t, n) => {
  let r = v.loading(t.loading, { ...n, ...n == null ? void 0 : n.loading });
  return typeof e == "function" && (e = e()), e.then((i) => {
    let o = t.success ? Z(t.success, i) : void 0;
    return o ? v.success(o, { id: r, ...n, ...n == null ? void 0 : n.success }) : v.dismiss(r), i;
  }).catch((i) => {
    let o = t.error ? Z(t.error, i) : void 0;
    o ? v.error(o, { id: r, ...n, ...n == null ? void 0 : n.error }) : v.dismiss(r);
  }), e;
};
var kt = (e, t) => {
  k({ type: 1, toast: { id: e, height: t } });
}, zt = () => {
  k({ type: 5, time: Date.now() });
}, F = /* @__PURE__ */ new Map(), Dt = 1e3, At = (e, t = Dt) => {
  if (F.has(e)) return;
  let n = setTimeout(() => {
    F.delete(e), k({ type: 4, toastId: e });
  }, t);
  F.set(e, n);
}, Wt = (e) => {
  let { toasts: t, pausedAt: n } = Rt(e);
  M(() => {
    if (n) return;
    let o = Date.now(), s = t.map((a) => {
      if (a.duration === 1 / 0) return;
      let c = (a.duration || 0) + a.pauseDuration - (o - a.createdAt);
      if (c < 0) {
        a.visible && v.dismiss(a.id);
        return;
      }
      return setTimeout(() => v.dismiss(a.id), c);
    });
    return () => {
      s.forEach((a) => a && clearTimeout(a));
    };
  }, [t, n]);
  let r = j(() => {
    n && k({ type: 6, time: Date.now() });
  }, [n]), i = j((o, s) => {
    let { reverseOrder: a = !1, gutter: c = 8, defaultPosition: l } = s || {}, f = t.filter((p) => (p.position || l) === (o.position || l) && p.height), m = f.findIndex((p) => p.id === o.id), d = f.filter((p, g) => g < m && p.visible).length;
    return f.filter((p) => p.visible).slice(...a ? [d + 1] : [0, d]).reduce((p, g) => p + (g.height || 0) + c, 0);
  }, [t]);
  return M(() => {
    t.forEach((o) => {
      if (o.dismissed) At(o.id, o.removeDelay);
      else {
        let s = F.get(o.id);
        s && (clearTimeout(s), F.delete(o.id));
      }
    });
  }, [t]), { toasts: t, handlers: { updateHeight: kt, startPause: zt, endPause: r, calculateOffset: i } };
}, _t = S`
from {
  transform: scale(0) rotate(45deg);
	opacity: 0;
}
to {
 transform: scale(1) rotate(45deg);
  opacity: 1;
}`, It = S`
from {
  transform: scale(0);
  opacity: 0;
}
to {
  transform: scale(1);
  opacity: 1;
}`, Ft = S`
from {
  transform: scale(0) rotate(90deg);
	opacity: 0;
}
to {
  transform: scale(1) rotate(90deg);
	opacity: 1;
}`, Bt = T("div")`
  width: 20px;
  opacity: 0;
  height: 20px;
  border-radius: 10px;
  background: ${(e) => e.primary || "#ff4b4b"};
  position: relative;
  transform: rotate(45deg);

  animation: ${_t} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
    forwards;
  animation-delay: 100ms;

  &:after,
  &:before {
    content: '';
    animation: ${It} 0.15s ease-out forwards;
    animation-delay: 150ms;
    position: absolute;
    border-radius: 3px;
    opacity: 0;
    background: ${(e) => e.secondary || "#fff"};
    bottom: 9px;
    left: 4px;
    height: 2px;
    width: 12px;
  }

  &:before {
    animation: ${Ft} 0.15s ease-out forwards;
    animation-delay: 180ms;
    transform: rotate(90deg);
  }
`, Ht = S`
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
`, Yt = T("div")`
  width: 12px;
  height: 12px;
  box-sizing: border-box;
  border: 2px solid;
  border-radius: 100%;
  border-color: ${(e) => e.secondary || "#e0e0e0"};
  border-right-color: ${(e) => e.primary || "#616161"};
  animation: ${Ht} 1s linear infinite;
`, Xt = S`
from {
  transform: scale(0) rotate(45deg);
	opacity: 0;
}
to {
  transform: scale(1) rotate(45deg);
	opacity: 1;
}`, Ut = S`
0% {
	height: 0;
	width: 0;
	opacity: 0;
}
40% {
  height: 0;
	width: 6px;
	opacity: 1;
}
100% {
  opacity: 1;
  height: 10px;
}`, Vt = T("div")`
  width: 20px;
  opacity: 0;
  height: 20px;
  border-radius: 10px;
  background: ${(e) => e.primary || "#61d345"};
  position: relative;
  transform: rotate(45deg);

  animation: ${Xt} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
    forwards;
  animation-delay: 100ms;
  &:after {
    content: '';
    box-sizing: border-box;
    animation: ${Ut} 0.2s ease-out forwards;
    opacity: 0;
    animation-delay: 200ms;
    position: absolute;
    border-right: 2px solid;
    border-bottom: 2px solid;
    border-color: ${(e) => e.secondary || "#fff"};
    bottom: 6px;
    left: 6px;
    height: 10px;
    width: 6px;
  }
`, Gt = T("div")`
  position: absolute;
`, Jt = T("div")`
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 20px;
  min-height: 20px;
`, Qt = S`
from {
  transform: scale(0.6);
  opacity: 0.4;
}
to {
  transform: scale(1);
  opacity: 1;
}`, qt = T("div")`
  position: relative;
  transform: scale(0.6);
  opacity: 0.4;
  min-width: 20px;
  animation: ${Qt} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275)
    forwards;
`, Kt = ({ toast: e }) => {
  let { icon: t, type: n, iconTheme: r } = e;
  return t !== void 0 ? typeof t == "string" ? u.createElement(qt, null, t) : t : n === "blank" ? null : u.createElement(Jt, null, u.createElement(Yt, { ...r }), n !== "loading" && u.createElement(Gt, null, n === "error" ? u.createElement(Bt, { ...r }) : u.createElement(Vt, { ...r })));
}, Zt = (e) => `
0% {transform: translate3d(0,${e * -200}%,0) scale(.6); opacity:.5;}
100% {transform: translate3d(0,0,0) scale(1); opacity:1;}
`, en = (e) => `
0% {transform: translate3d(0,0,-1px) scale(1); opacity:1;}
100% {transform: translate3d(0,${e * -150}%,-1px) scale(.6); opacity:0;}
`, tn = "0%{opacity:0;} 100%{opacity:1;}", nn = "0%{opacity:1;} 100%{opacity:0;}", rn = T("div")`
  display: flex;
  align-items: center;
  background: #fff;
  color: #363636;
  line-height: 1.3;
  will-change: transform;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1), 0 3px 3px rgba(0, 0, 0, 0.05);
  max-width: 350px;
  pointer-events: auto;
  padding: 8px 10px;
  border-radius: 8px;
`, on = T("div")`
  display: flex;
  justify-content: center;
  margin: 4px 10px;
  color: inherit;
  flex: 1 1 auto;
  white-space: pre-line;
`, sn = (e, t) => {
  let n = e.includes("top") ? 1 : -1, [r, i] = Fe() ? [tn, nn] : [Zt(n), en(n)];
  return { animation: t ? `${S(r)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards` : `${S(i)} 0.4s forwards cubic-bezier(.06,.71,.55,1)` };
}, an = u.memo(({ toast: e, position: t, style: n, children: r }) => {
  let i = e.height ? sn(e.position || t || "top-center", e.visible) : { opacity: 0 }, o = u.createElement(Kt, { toast: e }), s = u.createElement(on, { ...e.ariaProps }, Z(e.message, e));
  return u.createElement(rn, { className: e.className, style: { ...i, ...n, ...e.style } }, typeof r == "function" ? r({ icon: o, message: s }) : u.createElement(u.Fragment, null, o, s));
});
$t(u.createElement);
var cn = ({ id: e, className: t, style: n, onHeightUpdate: r, children: i }) => {
  let o = u.useCallback((s) => {
    if (s) {
      let a = () => {
        let c = s.getBoundingClientRect().height;
        r(e, c);
      };
      a(), new MutationObserver(a).observe(s, { subtree: !0, childList: !0, characterData: !0 });
    }
  }, [e, r]);
  return u.createElement("div", { ref: o, className: t, style: n }, i);
}, ln = (e, t) => {
  let n = e.includes("top"), r = n ? { top: 0 } : { bottom: 0 }, i = e.includes("center") ? { justifyContent: "center" } : e.includes("right") ? { justifyContent: "flex-end" } : {};
  return { left: 0, right: 0, display: "flex", position: "absolute", transition: Fe() ? void 0 : "all 230ms cubic-bezier(.21,1.02,.73,1)", transform: `translateY(${t * (n ? 1 : -1)}px)`, ...r, ...i };
}, dn = te`
  z-index: 9999;
  > * {
    pointer-events: auto;
  }
`, J = 16, Gn = ({ reverseOrder: e, position: t = "top-center", toastOptions: n, gutter: r, children: i, containerStyle: o, containerClassName: s }) => {
  let { toasts: a, handlers: c } = Wt(n);
  return u.createElement("div", { id: "_rht_toaster", style: { position: "fixed", zIndex: 9999, top: J, left: J, right: J, bottom: J, pointerEvents: "none", ...o }, className: s, onMouseEnter: c.startPause, onMouseLeave: c.endPause }, a.map((l) => {
    let f = l.position || t, m = c.calculateOffset(l, { reverseOrder: e, gutter: r, defaultPosition: t }), d = ln(f, m);
    return u.createElement(cn, { id: l.id, key: l.id, onHeightUpdate: c.updateHeight, className: l.visible ? dn : "", style: d }, l.type === "custom" ? Z(l.message, l) : i ? i(l) : u.createElement(an, { toast: l, position: f }));
  }));
}, un = "Expected a function", Se = NaN, fn = "[object Symbol]", pn = /^\s+|\s+$/g, mn = /^[-+]0x[0-9a-f]+$/i, hn = /^0b[01]+$/i, gn = /^0o[0-7]+$/i, vn = parseInt, yn = typeof G == "object" && G && G.Object === Object && G, bn = typeof self == "object" && self && self.Object === Object && self, wn = yn || bn || Function("return this")(), xn = Object.prototype, En = xn.toString, Sn = Math.max, Cn = Math.min, ie = function() {
  return wn.Date.now();
};
function On(e, t, n) {
  var r, i, o, s, a, c, l = 0, f = !1, m = !1, d = !0;
  if (typeof e != "function")
    throw new TypeError(un);
  t = Ce(t) || 0, fe(n) && (f = !!n.leading, m = "maxWait" in n, o = m ? Sn(Ce(n.maxWait) || 0, t) : o, d = "trailing" in n ? !!n.trailing : d);
  function p(h) {
    var C = r, _ = i;
    return r = i = void 0, l = h, s = e.apply(_, C), s;
  }
  function g(h) {
    return l = h, a = setTimeout(V, t), f ? p(h) : s;
  }
  function b(h) {
    var C = h - c, _ = h - l, be = t - C;
    return m ? Cn(be, o - _) : be;
  }
  function U(h) {
    var C = h - c, _ = h - l;
    return c === void 0 || C >= t || C < 0 || m && _ >= o;
  }
  function V() {
    var h = ie();
    if (U(h))
      return ye(h);
    a = setTimeout(V, b(h));
  }
  function ye(h) {
    return a = void 0, d && r ? p(h) : (r = i = void 0, s);
  }
  function He() {
    a !== void 0 && clearTimeout(a), l = 0, r = c = i = a = void 0;
  }
  function Ye() {
    return a === void 0 ? s : ye(ie());
  }
  function re() {
    var h = ie(), C = U(h);
    if (r = arguments, i = this, c = h, C) {
      if (a === void 0)
        return g(c);
      if (m)
        return a = setTimeout(V, t), p(c);
    }
    return a === void 0 && (a = setTimeout(V, t)), s;
  }
  return re.cancel = He, re.flush = Ye, re;
}
function fe(e) {
  var t = typeof e;
  return !!e && (t == "object" || t == "function");
}
function Mn(e) {
  return !!e && typeof e == "object";
}
function $n(e) {
  return typeof e == "symbol" || Mn(e) && En.call(e) == fn;
}
function Ce(e) {
  if (typeof e == "number")
    return e;
  if ($n(e))
    return Se;
  if (fe(e)) {
    var t = typeof e.valueOf == "function" ? e.valueOf() : e;
    e = fe(t) ? t + "" : t;
  }
  if (typeof e != "string")
    return e === 0 ? e : +e;
  e = e.replace(pn, "");
  var n = hn.test(e);
  return n || gn.test(e) ? vn(e.slice(2), n ? 2 : 8) : mn.test(e) ? Se : +e;
}
var Tn = On;
const Oe = /* @__PURE__ */ Te(Tn);
var ne = typeof window < "u" ? Ue : M;
function Me(e, t, n, r) {
  const i = Y(t);
  ne(() => {
    i.current = t;
  }, [t]), M(() => {
    const o = window;
    if (!(o && o.addEventListener))
      return;
    const s = (a) => {
      i.current(a);
    };
    return o.addEventListener(e, s, r), () => {
      o.removeEventListener(e, s, r);
    };
  }, [e, n, r]);
}
function $e(e) {
  const t = Y(() => {
    throw new Error("Cannot call an event handler while rendering.");
  });
  return ne(() => {
    t.current = e;
  }, [e]), j((...n) => {
    var r;
    return (r = t.current) == null ? void 0 : r.call(t, ...n);
  }, [t]);
}
var se = typeof window > "u";
function jn(e, t, n = {}) {
  const { initializeWithValue: r = !0 } = n, i = j(
    (d) => n.serializer ? n.serializer(d) : JSON.stringify(d),
    [n]
  ), o = j(
    (d) => {
      if (n.deserializer)
        return n.deserializer(d);
      if (d === "undefined")
        return;
      const p = t instanceof Function ? t() : t;
      let g;
      try {
        g = JSON.parse(d);
      } catch (b) {
        return console.error("Error parsing JSON:", b), p;
      }
      return g;
    },
    [n, t]
  ), s = j(() => {
    const d = t instanceof Function ? t() : t;
    if (se)
      return d;
    try {
      const p = window.localStorage.getItem(e);
      return p ? o(p) : d;
    } catch (p) {
      return console.warn(`Error reading localStorage key “${e}”:`, p), d;
    }
  }, [t, e, o]), [a, c] = pe(() => r ? s() : t instanceof Function ? t() : t), l = $e((d) => {
    se && console.warn(
      `Tried setting localStorage key “${e}” even though environment is not a client`
    );
    try {
      const p = d instanceof Function ? d(s()) : d;
      window.localStorage.setItem(e, i(p)), c(p), window.dispatchEvent(new StorageEvent("local-storage", { key: e }));
    } catch (p) {
      console.warn(`Error setting localStorage key “${e}”:`, p);
    }
  }), f = $e(() => {
    se && console.warn(
      `Tried removing localStorage key “${e}” even though environment is not a client`
    );
    const d = t instanceof Function ? t() : t;
    window.localStorage.removeItem(e), c(d), window.dispatchEvent(new StorageEvent("local-storage", { key: e }));
  });
  M(() => {
    c(s());
  }, [e]);
  const m = j(
    (d) => {
      d.key && d.key !== e || c(s());
    },
    [e, s]
  );
  return Me("storage", m), Me("local-storage", m), [a, l, f];
}
var Pn = typeof window > "u";
function Nn(e, {
  defaultValue: t = !1,
  initializeWithValue: n = !0
} = {}) {
  const r = (a) => Pn ? t : window.matchMedia(a).matches, [i, o] = pe(() => n ? r(e) : t);
  function s() {
    o(r(e));
  }
  return ne(() => {
    const a = window.matchMedia(e);
    return s(), a.addListener ? a.addListener(s) : a.addEventListener("change", s), () => {
      a.removeListener ? a.removeListener(s) : a.removeEventListener("change", s);
    };
  }, [e]), i;
}
var Rn = "(prefers-color-scheme: dark)", Ln = "usehooks-ts-dark-mode";
function Jn(e = {}) {
  const {
    defaultValue: t,
    localStorageKey: n = Ln,
    initializeWithValue: r = !0
  } = e, i = Nn(Rn, {
    initializeWithValue: r,
    defaultValue: t
  }), [o, s] = jn(
    n,
    t ?? i ?? !1,
    { initializeWithValue: r }
  );
  return ne(() => {
    i !== o && s(i);
  }, [i]), {
    isDarkMode: o,
    toggle: () => {
      s((a) => !a);
    },
    enable: () => {
      s(!0);
    },
    disable: () => {
      s(!1);
    },
    set: (a) => {
      s(a);
    }
  };
}
function kn(e) {
  const t = Y(e);
  t.current = e, M(
    () => () => {
      t.current();
    },
    []
  );
}
function Qn(e, t = 500, n) {
  const r = Y();
  kn(() => {
    r.current && r.current.cancel();
  });
  const i = Xe(() => {
    const o = Oe(e, t, n), s = (...a) => o(...a);
    return s.cancel = () => {
      o.cancel();
    }, s.isPending = () => !!r.current, s.flush = () => o.flush(), s;
  }, [e, t, n]);
  return M(() => {
    r.current = Oe(e, t, n);
  }, [e, t, n]), i;
}
export {
  Gn as O,
  tt as P,
  In as R,
  Pe as S,
  Ne as V,
  Xn as a,
  Yn as b,
  Hn as c,
  Un as d,
  Qn as e,
  v as f,
  Jn as g,
  jn as h,
  Bn as i,
  it as j,
  Le as k,
  je as l,
  Vn as m,
  _n as n,
  Qe as o,
  Nn as p,
  Wn as u,
  Fn as y
};
//# sourceMappingURL=index.B-GbFHzr.js.map
