import { jsx as e } from "react/jsx-runtime";
import { useState as p } from "react";
import { cn as c } from "../utils/cn.js";
const d = ({
  children: t,
  size: r = 28,
  radius: o = 9999,
  className: a
}) => /* @__PURE__ */ e(
  "div",
  {
    className: c(
      "flex items-center justify-center overflow-hidden bg-sw-gray-700",
      a
    ),
    style: {
      width: `${r}px`,
      height: `${r}px`,
      borderRadius: `${o}px`
    },
    children: t
  }
), g = ({
  icon: t,
  label: r,
  radius: o = 9999,
  size: a = 28,
  className: s
}) => {
  const [i, n] = p("loading");
  return typeof t == "string" && i === "failed" ? /* @__PURE__ */ e(d, { size: a, radius: o, className: s, children: /* @__PURE__ */ e("span", { className: "text-sw-label-sm text-sw-gray-100", children: r.charAt(0).toUpperCase() }) }) : /* @__PURE__ */ e(d, { size: a, radius: o, className: s, children: /* @__PURE__ */ e(() => t ? typeof t == "string" ? /* @__PURE__ */ e(
    "img",
    {
      width: a,
      height: a,
      src: t,
      alt: r,
      onLoad: () => n("loaded"),
      onError: () => n("failed")
    }
  ) : t : /* @__PURE__ */ e("span", { className: "text-sw-label-md text-sw-gray-100", children: r?.charAt(0).toUpperCase() }), {}) });
};
export {
  g as Icon
};
//# sourceMappingURL=Icon.js.map
