"use client";
import * as s from "react";
import { keyframes as d, css as b, styled as c, setup as x } from "../../../../goober@2.1.16_csstype@3.1.3/node_modules/goober/dist/goober.modern.js";
var g = (t) => typeof t == "function", m = (t, e) => g(t) ? t(e) : t, h = /* @__PURE__ */ (() => {
  let t = 0;
  return () => (++t).toString();
})(), v = /* @__PURE__ */ (() => {
  let t;
  return () => {
    if (t === void 0 && typeof window < "u") {
      let e = matchMedia("(prefers-reduced-motion: reduce)");
      t = !e || e.matches;
    }
    return t;
  };
})(), w = 20, y = (t, e) => {
  switch (e.type) {
    case 0:
      return { ...t, toasts: [e.toast, ...t.toasts].slice(0, w) };
    case 1:
      return { ...t, toasts: t.toasts.map((o) => o.id === e.toast.id ? { ...o, ...e.toast } : o) };
    case 2:
      let { toast: a } = e;
      return y(t, { type: t.toasts.find((o) => o.id === a.id) ? 1 : 0, toast: a });
    case 3:
      let { toastId: r } = e;
      return { ...t, toasts: t.toasts.map((o) => o.id === r || r === void 0 ? { ...o, dismissed: !0, visible: !1 } : o) };
    case 4:
      return e.toastId === void 0 ? { ...t, toasts: [] } : { ...t, toasts: t.toasts.filter((o) => o.id !== e.toastId) };
    case 5:
      return { ...t, pausedAt: e.time };
    case 6:
      let n = e.time - (t.pausedAt || 0);
      return { ...t, pausedAt: void 0, toasts: t.toasts.map((o) => ({ ...o, pauseDuration: o.pauseDuration + n })) };
  }
}, $ = [], p = { toasts: [], pausedAt: void 0 }, u = (t) => {
  p = y(p, t), $.forEach((e) => {
    e(p);
  });
}, E = (t, e = "blank", a) => ({ createdAt: Date.now(), visible: !0, dismissed: !1, type: e, ariaProps: { role: "status", "aria-live": "polite" }, message: t, pauseDuration: 0, ...a, id: (a == null ? void 0 : a.id) || h() }), l = (t) => (e, a) => {
  let r = E(e, t, a);
  return u({ type: 2, toast: r }), r.id;
}, i = (t, e) => l("blank")(t, e);
i.error = l("error");
i.success = l("success");
i.loading = l("loading");
i.custom = l("custom");
i.dismiss = (t) => {
  u({ type: 3, toastId: t });
};
i.remove = (t) => u({ type: 4, toastId: t });
i.promise = (t, e, a) => {
  let r = i.loading(e.loading, { ...a, ...a == null ? void 0 : a.loading });
  return typeof t == "function" && (t = t()), t.then((n) => {
    let o = e.success ? m(e.success, n) : void 0;
    return o ? i.success(o, { id: r, ...a, ...a == null ? void 0 : a.success }) : i.dismiss(r), n;
  }).catch((n) => {
    let o = e.error ? m(e.error, n) : void 0;
    o ? i.error(o, { id: r, ...a, ...a == null ? void 0 : a.error }) : i.dismiss(r);
  }), t;
};
var k = d`
from {
  transform: scale(0) rotate(45deg);
	opacity: 0;
}
to {
 transform: scale(1) rotate(45deg);
  opacity: 1;
}`, I = d`
from {
  transform: scale(0);
  opacity: 0;
}
to {
  transform: scale(1);
  opacity: 1;
}`, z = d`
from {
  transform: scale(0) rotate(90deg);
	opacity: 0;
}
to {
  transform: scale(1) rotate(90deg);
	opacity: 1;
}`, A = c("div")`
  width: 20px;
  opacity: 0;
  height: 20px;
  border-radius: 10px;
  background: ${(t) => t.primary || "#ff4b4b"};
  position: relative;
  transform: rotate(45deg);

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

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

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

  animation: ${P} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
    forwards;
  animation-delay: 100ms;
  &:after {
    content: '';
    box-sizing: border-box;
    animation: ${T} 0.2s ease-out forwards;
    opacity: 0;
    animation-delay: 200ms;
    position: absolute;
    border-right: 2px solid;
    border-bottom: 2px solid;
    border-color: ${(t) => t.secondary || "#fff"};
    bottom: 6px;
    left: 6px;
    height: 10px;
    width: 6px;
  }
`, F = c("div")`
  position: absolute;
`, M = c("div")`
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 20px;
  min-height: 20px;
`, N = d`
from {
  transform: scale(0.6);
  opacity: 0.4;
}
to {
  transform: scale(1);
  opacity: 1;
}`, S = c("div")`
  position: relative;
  transform: scale(0.6);
  opacity: 0.4;
  min-width: 20px;
  animation: ${N} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275)
    forwards;
`, C = ({ toast: t }) => {
  let { icon: e, type: a, iconTheme: r } = t;
  return e !== void 0 ? typeof e == "string" ? s.createElement(S, null, e) : e : a === "blank" ? null : s.createElement(M, null, s.createElement(j, { ...r }), a !== "loading" && s.createElement(F, null, a === "error" ? s.createElement(A, { ...r }) : s.createElement(V, { ...r })));
}, J = (t) => `
0% {transform: translate3d(0,${t * -200}%,0) scale(.6); opacity:.5;}
100% {transform: translate3d(0,0,0) scale(1); opacity:1;}
`, L = (t) => `
0% {transform: translate3d(0,0,-1px) scale(1); opacity:1;}
100% {transform: translate3d(0,${t * -150}%,-1px) scale(.6); opacity:0;}
`, R = "0%{opacity:0;} 100%{opacity:1;}", U = "0%{opacity:1;} 100%{opacity:0;}", W = c("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;
`, Y = c("div")`
  display: flex;
  justify-content: center;
  margin: 4px 10px;
  color: inherit;
  flex: 1 1 auto;
  white-space: pre-line;
`, _ = (t, e) => {
  let a = t.includes("top") ? 1 : -1, [r, n] = v() ? [R, U] : [J(a), L(a)];
  return { animation: e ? `${d(r)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards` : `${d(n)} 0.4s forwards cubic-bezier(.06,.71,.55,1)` };
};
s.memo(({ toast: t, position: e, style: a, children: r }) => {
  let n = t.height ? _(t.position || e || "top-center", t.visible) : { opacity: 0 }, o = s.createElement(C, { toast: t }), f = s.createElement(Y, { ...t.ariaProps }, m(t.message, t));
  return s.createElement(W, { className: t.className, style: { ...n, ...a, ...t.style } }, typeof r == "function" ? r({ icon: o, message: f }) : s.createElement(s.Fragment, null, o, f));
});
x(s.createElement);
b`
  z-index: 9999;
  > * {
    pointer-events: auto;
  }
`;
var B = i;
export {
  V as CheckmarkIcon,
  A as ErrorIcon,
  j as LoaderIcon,
  C as ToastIcon,
  B as default,
  m as resolveValue,
  i as toast
};
//# sourceMappingURL=index.js.map
