import { jsx as r, jsxs as h } from "react/jsx-runtime";
import v from "../../_virtual/index.js";
import { Classes as $ } from "../../constants/selectors.js";
import { DangerIcon as A, CheckIcon as _, TipIcon as T, NoteIcon as D, WarningIcon as L, InfoIcon as W } from "../../icons/index.js";
import { cn as p } from "../../utils/cn.js";
import { Icon as j } from "../icon/icon.js";
const S = {
  info: {
    icon: W,
    defaultAriaLabel: "Info",
    className: "border border-stone-200 bg-stone-50 dark:border-stone-700 dark:bg-white/10",
    childrenClassName: "text-stone-800 dark:text-stone-300"
  },
  warning: {
    icon: L,
    defaultAriaLabel: "Warning",
    className: 'border border-yellow-200 bg-yellow-50 dark:border-yellow-900 dark:bg-yellow-600/20 **:data-[component-part="callout-icon"]:mt-px',
    childrenClassName: "text-yellow-800 dark:text-yellow-300"
  },
  note: {
    icon: D,
    defaultAriaLabel: "Note",
    className: "border border-blue-200 bg-blue-50 dark:border-blue-900 dark:bg-blue-600/20",
    childrenClassName: "text-blue-800 dark:text-blue-300"
  },
  tip: {
    icon: T,
    defaultAriaLabel: "Tip",
    className: 'border border-green-200 bg-green-50 dark:border-green-900 dark:bg-green-600/20 **:data-[component-part="callout-icon"]:mt-px',
    childrenClassName: "text-green-800 dark:text-green-300"
  },
  check: {
    icon: _,
    defaultAriaLabel: "Check",
    className: "border border-green-200 bg-green-50 dark:border-green-900 dark:bg-green-600/20",
    childrenClassName: "text-green-800 dark:text-green-300"
  },
  danger: {
    icon: A,
    defaultAriaLabel: "Danger",
    className: "border border-red-200 bg-red-50 dark:border-red-900 dark:bg-red-600/20",
    childrenClassName: "text-red-800 dark:text-red-300"
  }
}, a = ({
  children: e,
  title: s,
  variant: c = "custom",
  icon: f,
  iconType: C,
  iconLibrary: N,
  color: i,
  className: y,
  ariaLabel: b
}) => {
  let l, g, n = "", d = "", u = {}, m = {};
  if (c === "custom")
    if (l = f, g = i, i)
      try {
        const o = v(i), t = o.hex(), x = o.isDark(), w = o.lighten(0.5), I = o.darken(0.5);
        u = {
          "--callout-border-color-light": `${t}33`,
          "--callout-bg-color-light": `${t}1a`,
          "--callout-border-color-dark": `${t}${x ? "66" : "4d"}`,
          "--callout-bg-color-dark": `${t}${x ? "4d" : "1a"}`
        }, m = {
          "--callout-text-color": `${I.hex()}`,
          "--dark-callout-text-color": `${w.hex()}`
        }, n = "border border-(--callout-border-color-light,#71717a33) bg-(--callout-bg-color-light,#71717a1a) dark:border-(--callout-border-color-dark,#71717a4d) dark:bg-(--callout-bg-color-dark,#71717a1a)", d = "mt-1 text-(--callout-text-color) dark:text-(--dark-callout-text-color)";
      } catch {
        g = void 0, n = "border border-stone-500/20 bg-stone-50/50 dark:border-stone-500/30 dark:bg-stone-500/10", d = "text-stone-900 dark:text-stone-200";
      }
    else
      n = "border border-stone-500/20 bg-stone-50/50 dark:border-stone-500/30 dark:bg-stone-500/10", d = "text-stone-900 dark:text-stone-200";
  else {
    const o = S[c], t = o.icon;
    l = /* @__PURE__ */ r(t, { "aria-label": b || o.defaultAriaLabel }), n = o.className, d = o.childrenClassName;
  }
  const k = typeof l == "string" ? /* @__PURE__ */ r(
    j,
    {
      className: "m-0! size-4 shrink-0",
      color: g,
      icon: l,
      iconLibrary: N,
      iconType: C
    }
  ) : l;
  return /* @__PURE__ */ h(
    "div",
    {
      className: p(
        $.Callout,
        "my-4 flex gap-3 overflow-hidden rounded-2xl px-5 py-4",
        n,
        y
      ),
      "data-callout-type": c,
      style: { ...u, ...m },
      children: [
        !!k && /* @__PURE__ */ r(
          "div",
          {
            className: "mt-0.5 w-4",
            "data-component-part": "callout-icon",
            ...c === "custom" && b && { "aria-label": b },
            children: k
          }
        ),
        /* @__PURE__ */ h(
          "div",
          {
            className: p(
              "prose dark:prose-invert w-full min-w-0 text-sm [&_a]:border-current [&_a]:text-current! [&_code]:text-current! [&_kbd]:bg-stone-100 [&_kbd]:text-current! dark:[&_kbd]:bg-stone-800 [&_strong]:text-current!",
              s && "[&>:nth-child(2)]:mt-3",
              d
            ),
            "data-component-part": "callout-content",
            style: m,
            children: [
              s && /* @__PURE__ */ r("div", { className: "font-semibold", "data-component-part": "callout-title", children: s }),
              e
            ]
          }
        )
      ]
    }
  );
}, H = (e) => /* @__PURE__ */ r(a, { ...e, variant: "info" }), J = (e) => /* @__PURE__ */ r(a, { ...e, variant: "warning" }), K = (e) => /* @__PURE__ */ r(a, { ...e, variant: "note" }), M = (e) => /* @__PURE__ */ r(a, { ...e, variant: "tip" }), O = (e) => /* @__PURE__ */ r(a, { ...e, variant: "check" }), P = (e) => /* @__PURE__ */ r(a, { ...e, variant: "danger" });
export {
  a as Callout,
  O as Check,
  P as Danger,
  H as Info,
  K as Note,
  M as Tip,
  J as Warning
};
