import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
var _excluded = ["type", "size", "color", "none"];
import { forwardRef } from 'react';
import * as icons from '@ant-design/icons/es/index';
var createFromIconfontCN = icons.createFromIconfontCN;
var antIcon = function antIcon(props, ref) {
  var _props$type = props.type,
    type = _props$type === void 0 ? '' : _props$type,
    size = props.size,
    color = props.color,
    none = props.none,
    rest = _objectWithoutPropertiesLoose(props, _excluded);
  var IconComp = (icons || {})[type];
  var style = _extends({}, rest.style, {
    fontSize: size,
    color: color,
    display: none ? 'none' : 'inline-block'
  });
  if (!IconComp) {
    var IconFont = createFromIconfontCN();
    return /*#__PURE__*/React.createElement(IconFont, _extends({
      type: type
    }, rest, {
      style: style,
      ref: ref
    }));
  }
  return /*#__PURE__*/React.createElement(IconComp, _extends({}, rest, {
    style: style,
    twoToneColor: color,
    ref: ref
  }));
};
export default /*#__PURE__*/forwardRef(antIcon);