import v from "../../../../@babel/runtime/helpers/esm/objectWithoutProperties.mjs";
import a from "../../../../@babel/runtime/helpers/esm/objectSpread2.mjs";
import * as T from "react";
import { getSecondaryColor as m, useInsertStyles as p, warning as w, isIconDefinition as C, generate as h } from "../utils.mjs";
var I = ["icon", "className", "onClick", "style", "primaryColor", "secondaryColor"], n = {
  primaryColor: "#333",
  secondaryColor: "#E6E6E6",
  calculated: !1
};
function N(t) {
  var o = t.primaryColor, e = t.secondaryColor;
  n.primaryColor = o, n.secondaryColor = e || m(o), n.calculated = !!e;
}
function R() {
  return a({}, n);
}
var c = function(o) {
  var e = o.icon, y = o.className, d = o.onClick, f = o.style, l = o.primaryColor, u = o.secondaryColor, g = v(o, I), s = T.useRef(), i = n;
  if (l && (i = {
    primaryColor: l,
    secondaryColor: u || m(l)
  }), p(s), w(C(e), "icon should be icon definiton, but got ".concat(e)), !C(e))
    return null;
  var r = e;
  return r && typeof r.icon == "function" && (r = a(a({}, r), {}, {
    icon: r.icon(i.primaryColor, i.secondaryColor)
  })), h(r.icon, "svg-".concat(r.name), a(a({
    className: y,
    onClick: d,
    style: f,
    "data-icon": r.name,
    width: "1em",
    height: "1em",
    fill: "currentColor",
    "aria-hidden": "true"
  }, g), {}, {
    ref: s
  }));
};
c.displayName = "IconReact";
c.getTwoToneColors = R;
c.setTwoToneColors = N;
const P = c;
export {
  P as default
};
