import { j as t } from "../../../_virtual/jsx-runtime.js";
import { ToastWrapper as k, CompactWrapper as g, MessageWrapper as j, ActionWrapper as f } from "./styles.js";
import { getId as s, noop as h } from "../../../utils/index.js";
import { Button as c } from "../../Button/index.js";
import { getAriaRole as u } from "./utils.js";
import A from "./ToastIcon.js";
const d = {
  text: "",
  onClick: h
};
function W(a) {
  const r = s(a["data-testid"]), l = s(a["data-trackid"]), {
    className: m,
    variant: i = "neutral",
    message: p,
    action: x,
    primaryAction: n = d,
    icon: o
  } = a;
  let e = d;
  return a.action === "acknowledge" && (e = a.dismissAction), /* @__PURE__ */ t.jsxs(
    k,
    {
      className: m,
      variant: i,
      "data-testid": r("wrapper"),
      "data-trackid": l("wrapper"),
      "aria-label": a["aria-label"],
      role: u(i),
      children: [
        /* @__PURE__ */ t.jsxs(g, { children: [
          i === "neutral" && o ? o : /* @__PURE__ */ t.jsx(A, { variant: i }),
          /* @__PURE__ */ t.jsx(j, { children: p })
        ] }),
        /* @__PURE__ */ t.jsxs(f, { children: [
          x === "acknowledge" && e && /* @__PURE__ */ t.jsx(
            c,
            {
              size: "xSmall",
              variant: "inverse-ghost",
              onClick: e.onClick,
              "data-testid": r("dismiss-button"),
              children: e.text
            }
          ),
          /* @__PURE__ */ t.jsx(
            c,
            {
              size: "xSmall",
              variant: "inverse-ghost",
              onClick: n.onClick,
              "data-testid": r("action-button"),
              children: n.text
            }
          )
        ] })
      ]
    }
  );
}
export {
  W as Toast
};
