import { jsx as f } from "@emotion/react/jsx-runtime";
import { toast as d } from "react-toastify";
import { ToastMessage as m } from "../subcomponents/ToastMessage/ToastMessage.js";
function i(o, t, n = "medium") {
  return {
    containerId: t,
    type: o?.type,
    toastId: o?.toastId,
    autoClose: o?.autoClose,
    size: n
  };
}
function a({
  props: o,
  toastOptions: t,
  containerId: n,
  type: r = "default",
  size: e = "medium"
}) {
  const u = n || t?.containerId, c = { ...o, ...i(t, u, e) }, s = (r === "default" || r === void 0 ? d : d[r])(/* @__PURE__ */ f(m, { ...c }), {
    ...t,
    containerId: u
  });
  return t?.toastId || d.update(s, {
    containerId: u,
    render: /* @__PURE__ */ f(m, { ...c, toastId: s })
  }), t?.toastId || s;
}
function y(o, t) {
  const n = (r, e = {}) => a({ props: r, toastOptions: e, containerId: o, size: t });
  return n.success = (r, e = {}) => a({ props: r, toastOptions: e, type: "success", containerId: o, size: t }), n.info = (r, e = {}) => a({ props: r, toastOptions: e, type: "info", containerId: o, size: t }), n.warning = (r, e = {}) => a({ props: r, toastOptions: e, type: "warning", containerId: o, size: t }), n.error = (r, e = {}) => a({ props: r, toastOptions: e, type: "error", containerId: o, size: t }), n;
}
export {
  y as default,
  a as triggerToast
};
