text: "use strict";
  
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  exports.default = void 0;
  
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
  
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
  
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
  
  var React = _interopRequireWildcard(require("react"));
  
  var _classnames = _interopRequireDefault(require("classnames"));
  
  var _Context = _interopRequireDefault(require("./Context"));
  
  var _utils = require("../utils");
  
  var _excluded = ["className", "component", "viewBox", "spin", "rotate", "tabIndex", "onClick", "children"];
  var Icon = /*#__PURE__*/React.forwardRef(function (props, ref) {
    var className = props.className,
        Component = props.component,
        viewBox = props.viewBox,
        spin = props.spin,
        rotate = props.rotate,
        tabIndex = props.tabIndex,
        onClick = props.onClick,
        children = props.children,
        restProps = (0, _objectWithoutProperties2.default)(props, _excluded);
    (0, _utils.warning)(Boolean(Component || children), 'Should have `component` prop or `children`.');
    (0, _utils.useInsertStyles)();
  
    var _React$useContext = React.useContext(_Context.default),
        _React$useContext$pre = _React$useContext.prefixCls,
        prefixCls = _React$useContext$pre === void 0 ? 'anticon' : _React$useContext$pre;
  
    var classString = (0, _classnames.default)(prefixCls, className);
    var svgClassString = (0, _classnames.default)((0, _defineProperty2.default)({}, "".concat(prefixCls, "-spin"), !!spin));
    var svgStyle = rotate ? {
      msTransform: "rotate(".concat(rotate, "deg)"),
      transform: "rotate(".concat(rotate, "deg)")
    } : undefined;
    var innerSvgProps = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, _utils.svgBaseProps), {}, {
      className: svgClassString,
      style: svgStyle,
      viewBox: viewBox
    });
  
    if (!viewBox) {
      delete innerSvgProps.viewBox;
    } // component > children
  
  
    var renderInnerNode = function renderInnerNode() {
      if (Component) {
        return /*#__PURE__*/React.createElement(Component, (0, _objectSpread2.default)({}, innerSvgProps), children);
      }
  
      if (children) {
        (0, _utils.warning)(Boolean(viewBox) || React.Children.count(children) === 1 && /*#__PURE__*/React.isValidElement(children) && React.Children.only(children).type === 'use', 'Make sure that you provide correct `viewBox`' + ' prop (default `0 0 1024 1024`) to the icon.');
        return /*#__PURE__*/React.createElement("svg", (0, _objectSpread2.default)((0, _objectSpread2.default)({}, innerSvgProps), {}, {
          viewBox: viewBox
        }), children);
      }
  
      return null;
    };
  
    var iconTabIndex = tabIndex;
  
    if (iconTabIndex === undefined && onClick) {
      iconTabIndex = -1;
    }
  
    return /*#__PURE__*/React.createElement("span", (0, _objectSpread2.default)((0, _objectSpread2.default)({
      role: "img"
    }, restProps), {}, {
      ref: ref,
      tabIndex: iconTabIndex,
      onClick: onClick,
      className: classString
    }), renderInnerNode());
  });
  Icon.displayName = 'AntdIcon';
  var _default = Icon;
  exports.default = _default;