import _isEqual from "lodash/isEqual";
import * as React from "react";
import { renderToStaticMarkup } from "react-dom/server";
import { getPlugins } from "../../../../plugins";
var icons;
export var getIcons = function getIcons() {
  if (!icons) {
    var plugins = getPlugins("pb-icons");
    icons = plugins.reduce(function (icons, pl) {
      return icons.concat(pl.getIcons());
    }, []);
  }

  return icons;
};
export var getSvg = function getSvg(id) {
  var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

  if (!props.width) {
    props.width = 50;
  }

  var icon = getIcons().find(function (ic) {
    return _isEqual(ic.id, id);
  });

  if (!icon) {
    return null;
  }

  return renderToStaticMarkup( /*#__PURE__*/React.cloneElement(icon.svg, props));
};
//# sourceMappingURL=utils.js.map