import { jsx as s } from "react/jsx-runtime";
import M from "@mui/material/Button";
import j from "@mui/material/CircularProgress";
import { toBorderRadius as A, toMuiColor as O, toMuiVariant as R, toMuiSize as V, sizeOverrideSx as N } from "./types.js";
function $({
  children: c,
  color: a = "neutral",
  emphasis: i = "ghost",
  size: o = "sm",
  shape: u = "rounded",
  loading: r = !1,
  loadingPosition: t = "center",
  disabled: d,
  startIcon: m,
  startAdornment: l,
  icon: p,
  endIcon: I,
  endAdornment: f,
  fullWidth: v,
  onClick: b,
  type: S = "button",
  href: B,
  sx: e
}) {
  const y = m ?? l ?? p, z = I ?? f, h = O(a), x = R(i), C = V(o), E = N(o), n = /* @__PURE__ */ s(j, { size: o === "xs" ? 12 : 16, color: "inherit" });
  return /* @__PURE__ */ s(
    M,
    {
      color: h,
      variant: x,
      size: C,
      disabled: d || r && t === "center",
      startIcon: r && t === "start" ? n : y,
      endIcon: r && t === "end" ? n : z,
      fullWidth: v,
      onClick: b,
      type: S,
      href: B,
      sx: {
        borderRadius: A(u),
        ...E,
        ...typeof e == "object" && !Array.isArray(e) ? e : {}
      },
      children: r && t === "center" ? n : c
    }
  );
}
$.displayName = "Button";
export {
  $ as B
};
