"use strict";

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

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

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

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

var _renderUi = require("@pie-lib/render-ui");

var ArrowHead = function ArrowHead(_ref) {
  var size = _ref.size,
      transform = _ref.transform,
      points = _ref.points;
  return /*#__PURE__*/_react["default"].createElement("polygon", {
    points: points || "0,0 ".concat(size, ",").concat(size / 2, " 0,").concat(size),
    transform: transform
  });
};

exports.ArrowHead = ArrowHead;
ArrowHead.propTypes = {
  points: _propTypes["default"].string,
  size: _propTypes["default"].number,
  transform: _propTypes["default"].string
};
ArrowHead.defaultProps = {
  points: '',
  size: 10,
  transform: ''
};

var genUid = function genUid() {
  var v = (Math.random() * 1000).toFixed(0);
  return "arrow-".concat(v);
};

exports.genUid = genUid;

var ArrowMarker = function ArrowMarker(_ref2) {
  var id = _ref2.id,
      size = _ref2.size,
      className = _ref2.className;
  return /*#__PURE__*/_react["default"].createElement("marker", {
    id: id,
    viewBox: "0 0 ".concat(size, " ").concat(size),
    refX: size / 2,
    refY: size / 2,
    markerWidth: size,
    markerHeight: size,
    orient: "auto-start-reverse",
    className: className,
    style: {
      fill: _renderUi.color.defaults.BLACK
    }
  }, /*#__PURE__*/_react["default"].createElement(ArrowHead, {
    size: size
  }));
};

exports.ArrowMarker = ArrowMarker;
ArrowMarker.propTypes = {
  id: _propTypes["default"].string,
  size: _propTypes["default"].number,
  className: _propTypes["default"].string
};
ArrowMarker.defaultProps = {
  size: 5
};
//# sourceMappingURL=arrow-head.js.map