"use strict";

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

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

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

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

var _line = require("../shared/line");

var _react = _interopRequireDefault(require("react"));

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

var _plot = require("../../../plot");

var _styles = require("@material-ui/core/styles");

var _classnames = _interopRequireDefault(require("classnames"));

var _excluded = ["className", "classes", "correctness", "disabled", "graphProps", "from", "to"];

var lineStyles = function lineStyles(theme) {
  return {
    line: _line.styles.line(theme),
    disabled: _line.styles.disabled(theme),
    correct: _line.styles.correct(theme, 'stroke'),
    incorrect: _line.styles.incorrect(theme, 'stroke'),
    missing: _line.styles.missing(theme, 'stroke')
  };
};

var Line = function Line(props) {
  var className = props.className,
      classes = props.classes,
      correctness = props.correctness,
      disabled = props.disabled,
      graphProps = props.graphProps,
      from = props.from,
      to = props.to,
      rest = (0, _objectWithoutProperties2["default"])(props, _excluded);
  var scale = graphProps.scale;
  return /*#__PURE__*/_react["default"].createElement("line", (0, _extends2["default"])({
    stroke: "green",
    strokeWidth: "6",
    x1: scale.x(from.x),
    y1: scale.y(from.y),
    x2: scale.x(to.x),
    y2: scale.y(to.y),
    className: (0, _classnames["default"])(classes.line, disabled && classes.disabled, classes[correctness], className)
  }, rest));
};

exports.Line = Line;
Line.propTypes = {
  className: _propTypes["default"].string,
  classes: _propTypes["default"].object,
  correctness: _propTypes["default"].string,
  disabled: _propTypes["default"].bool,
  graphProps: _propTypes["default"].any,
  from: _plot.types.PointType,
  to: _plot.types.PointType
};
var StyledLine = (0, _styles.withStyles)(lineStyles)(Line);
var Segment = (0, _line.lineBase)(StyledLine);
var Component = (0, _line.lineToolComponent)(Segment);
var _default = Component;
exports["default"] = _default;
//# sourceMappingURL=component.js.map