import { jsxs as u, jsx as m } from "react/jsx-runtime";
import { t as _ } from "../../classix-DG18itHa.js";
import { useState as f, useEffect as l } from "react";
import { Icon as q } from "../icon/index.js";
import '../../assets/index45.css';const v = "_toast_12yql_1", y = "_active_12yql_21", d = "_error_12yql_27", h = "_success_12yql_36", e = {
  toast: v,
  active: y,
  error: d,
  success: h
}, w = ({
  label: o,
  type: s = "success",
  onClick: n,
  onExitComplete: t,
  open: a = !0
}) => {
  const [i, c] = f(!1);
  return l(() => {
    if (!a) return c(!1);
    const r = requestAnimationFrame(() => c(!0));
    return () => cancelAnimationFrame(r);
  }, [a]), /* @__PURE__ */ u("div", { "aria-live": s === "error" ? "assertive" : "polite", className: _(e.toast, e[s], i && e.active), onClick: n, onTransitionEnd: (r) => {
    a || r.propertyName !== "opacity" || r.currentTarget !== r.target || t == null || t();
  }, "data-component": "toast", children: [
    /* @__PURE__ */ m(q, { name: s }),
    o
  ] });
};
export {
  w as Toast
};
//# sourceMappingURL=index.js.map
