import _extends from "@babel/runtime/helpers/extends";

/* eslint-disable max-len */
import React from "react";
import PropTypes from "prop-types";
import classnames from "classnames";
import makeStyles from "../styles/makeStyles";
import { getShades } from "../styles/colors";

var deprecationWarning = function deprecationWarning(message) {
  if (process.env.NODE_ENV === "development") {
    // eslint-disable-next-line no-console
    console.warn("[Clever-react]: ".concat(message));
  }
};

var getClasses = makeStyles(function (_ref) {
  var colors = _ref.cleverUI.colors;
  return {
    root: function root(_ref2) {
      var rotation = _ref2.rotation,
          padding = _ref2.padding,
          size = _ref2.size,
          color = _ref2.color,
          shade = _ref2.shade;
      var res = {
        color: colors[color] ? colors[color][shade] : color
      };

      if (rotation > 0) {
        res.transform = "rotate(".concat(rotation, "deg)");
      }

      if (padding > 0) {
        res.padding = "".concat(size * padding / 200, "px");
      }

      return res;
    }
  };
});
var shadesList = getShades();

function Location(props) {
  var classes = getClasses(props);
  var size = props.size,
      padding = props.padding,
      className = props.className,
      onMouseEnter = props.onMouseEnter,
      onMouseLeave = props.onMouseLeave;
  var sizeIcon = size;
  var otherProps = {
    className: classnames(className, classes.root),
    onMouseEnter: onMouseEnter,
    onMouseLeave: onMouseLeave
  };

  if (padding) {
    deprecationWarning("The padding prop is deprecated, use a className for customization");
    sizeIcon = sizeIcon * (100 - padding) / 100;
  }

  return /*#__PURE__*/React.createElement("svg", _extends({
    viewBox: "0 0 16 16",
    fill: "none",
    height: sizeIcon,
    width: sizeIcon
  }, otherProps), /*#__PURE__*/React.createElement("path", {
    d: "M8.222 3.436c-1.758 0-3.341 1.265-3.341 3.008 0 1.744 1.583 3.009 3.341 3.009 1.758 0 3.342-1.265 3.342-3.009 0-1.743-1.584-3.008-3.342-3.008ZM6.231 6.444c0-.834.804-1.658 1.991-1.658 1.188 0 1.992.824 1.992 1.658S9.41 8.103 8.222 8.103c-1.187 0-1.991-.825-1.991-1.659Z",
    fill: "currentColor",
    fillRule: "evenodd",
    clipRule: "evenodd"
  }), /*#__PURE__*/React.createElement("path", {
    d: "m7.94 15.46.282-.46-.283.46a.54.54 0 0 0 .566 0L8.222 15l.283.46.002-.001.004-.003.015-.01a8.381 8.381 0 0 0 .263-.17 21.05 21.05 0 0 0 2.921-2.355c1.572-1.528 3.274-3.732 3.274-6.194 0-3.502-3.07-6.267-6.762-6.267C4.531.46 1.46 3.225 1.46 6.727c0 2.462 1.702 4.666 3.275 6.194a21.05 21.05 0 0 0 3.183 2.526l.015.01.005.002.001.001Zm-5.4-8.733c0-2.823 2.501-5.187 5.682-5.187 3.181 0 5.682 2.364 5.682 5.187 0 1.993-1.409 3.925-2.947 5.42a19.984 19.984 0 0 1-2.735 2.21 19.985 19.985 0 0 1-2.735-2.21C3.95 10.652 2.54 8.72 2.54 6.727Z",
    fill: "currentColor",
    fillRule: "evenodd",
    clipRule: "evenodd"
  }));
}

Location.propTypes = {
  color: PropTypes.string,
  className: PropTypes.string,
  size: PropTypes.number,
  onMouseEnter: PropTypes.func,
  onMouseLeave: PropTypes.func,
  rotation: PropTypes.number,
  shade: PropTypes.oneOf(shadesList),
  padding: PropTypes.number
};
Location.defaultProps = {
  color: "neutral",
  size: 24,
  className: "",
  rotation: 0,
  shade: 500,
  padding: 0,
  onMouseEnter: function onMouseEnter() {},
  onMouseLeave: function onMouseLeave() {}
};
export default Location;