"use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));

var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));

var _propTypes = _interopRequireDefault(require("prop-types"));

var React = _interopRequireWildcard(require("react"));

var _styledComponents = _interopRequireWildcard(require("styled-components"));

var _interpolation = require("../../Tools/interpolation");

var themeColorTemplate =
/*#__PURE__*/
(0, _styledComponents.css)(["\n  fill: ", ";\n  cursor: ", ";\n\n  &:hover {\n    fill: ", ";\n  }\n"], (0, _interpolation.theme)('iconColor'), function (props) {
  return props.selectable === 1 ? 'pointer' : 'default';
}, function (props) {
  return props.selectable === 1 ? (0, _interpolation.theme)('iconHoverColor')(props) : (0, _interpolation.theme)('iconColor')(props);
});
var svgColorTemplate =
/*#__PURE__*/
(0, _styledComponents.css)(["\n  cursor: ", ";\n"], function (props) {
  return props.selectable === 1 ? 'pointer' : 'default';
});

var _default = function _default(Svg, name) {
  var keepSvgColor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  var template = keepSvgColor ? svgColorTemplate : themeColorTemplate;
  var Icon =
  /*#__PURE__*/
  (0, _styledComponents.default)(Svg).withConfig({
    componentId: "sc-1pmbxjh-0"
  })(["\n    ", ";\n  "], template);
  /* eslint-disable react/prefer-stateless-function */

  var WithStyle =
  /*#__PURE__*/
  function (_React$PureComponent) {
    (0, _inherits2.default)(WithStyle, _React$PureComponent);

    function WithStyle() {
      (0, _classCallCheck2.default)(this, WithStyle);
      return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(WithStyle).apply(this, arguments));
    }

    (0, _createClass2.default)(WithStyle, [{
      key: "render",
      value: function render() {
        var _this$props = this.props,
            selectable = _this$props.selectable,
            size = _this$props.size,
            rest = (0, _objectWithoutProperties2.default)(_this$props, ["selectable", "size"]);
        return React.createElement(Icon, (0, _extends2.default)({}, rest, {
          height: size,
          selectable: selectable === true ? 1 : 0,
          width: size
        }));
      }
    }]);
    return WithStyle;
  }(React.PureComponent);

  (0, _defineProperty2.default)(WithStyle, "defaultProps", {
    selectable: false,
    size: '44px'
  });
  WithStyle.propTypes = process.env.NODE_ENV !== "production" ? {
    selectable: _propTypes.default.bool,
    size: _propTypes.default.string
  } : {};
  WithStyle.displayName = name;
  return WithStyle;
};

exports.default = _default;