import { j as c } from "../../node_modules/react/jsx-runtime.mjs";
import i from "../../node_modules/react-dom/index.mjs";
import s from "./Toast.mjs";
import "./index.less.mjs";
const a = () => {
  const t = document.createElement("div");
  document.body.appendChild(t);
  const o = i.render(/* @__PURE__ */ c.jsx(s, {}), t);
  return {
    addNotice(e) {
      return o.addNotice(e);
    },
    destroy() {
      i.unmountComponentAtNode(t), document.body.removeChild(t);
    }
  };
};
let n;
const r = (t, o, e = 2e3, d) => (n || (n = a()), n.addNotice({ type: t, content: o, duration: e, onClose: d })), l = {
  info(t, o, e) {
    return r("info", t, o, e);
  },
  success(t = "操作成功", o, e) {
    return r("success", t, o, e);
  },
  error(t, o, e) {
    return r("error", t, o, e);
  },
  loading(t = "加载中...", o = 0, e) {
    return r("loading", t, o, e);
  }
};
export {
  l as default
};
