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 Score(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 16A8 8 0 1 1 8 0a8 8 0 0 1 0 16ZM2.944 4.08A6.368 6.368 0 0 0 1.648 7.2H2.4a.8.8 0 1 1 0 1.6h-.752a6.36 6.36 0 0 0 1.056 2.8A7.968 7.968 0 0 1 7.2 9.64V5.6a.8.8 0 1 1 1.6 0v4.04c1.667.164 3.24.85 4.496 1.96a6.36 6.36 0 0 0 1.056-2.8H13.6a.8.8 0 0 1 0-1.6h.752a6.368 6.368 0 0 0-1.296-3.12l-.528.528a.803.803 0 1 1-1.136-1.136l.536-.528A6.368 6.368 0 0 0 8.8 1.648V2.4a.8.8 0 1 1-1.6 0v-.752a6.322 6.322 0 0 0-3.12 1.296l.528.528a.803.803 0 1 1-1.136 1.136l-.528-.536v.008Zm.824 8.72a6.376 6.376 0 0 0 8.464 0 6.376 6.376 0 0 0-8.464 0Z",
    fill: "currentColor"
  }));
}

Score.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
};
Score.defaultProps = {
  color: "neutral",
  size: 24,
  className: "",
  rotation: 0,
  shade: 500,
  padding: 0,
  onMouseEnter: function onMouseEnter() {},
  onMouseLeave: function onMouseLeave() {}
};
export default Score;