"use strict";

function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _react = _interopRequireWildcard(require("react"));
var _styledComponents = _interopRequireWildcard(require("styled-components"));
var _consts = require("../consts");
var _excluded = ["position", "style", "backgroundColor", "borderColor"];
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
var arrowTop = (0, _styledComponents.css)(["top:3px;margin-left:-", "px;&::before{border-left:", "px solid transparent;border-right:", "px solid transparent;border-bottom:", "px solid ", ";}&::after{left:", "px;top:2px;border-left:", "px solid transparent;border-right:", "px solid transparent;border-bottom:", "px solid ", ";}"], _consts.TRIANGLE_SIZE, _consts.TRIANGLE_SIZE, _consts.TRIANGLE_SIZE, _consts.TRIANGLE_SIZE, function (p) {
  return p.borderColor(p.theme);
}, _consts.BORDER_SIZE * 2, _consts.TRIANGLE_SIZE - _consts.BORDER_SIZE * 2, _consts.TRIANGLE_SIZE - _consts.BORDER_SIZE * 2, _consts.TRIANGLE_SIZE - _consts.BORDER_SIZE * 2, function (p) {
  return p.backgroundColor(p.theme);
});
var arrowBottom = (0, _styledComponents.css)(["bottom:13px;margin-left:-", "px;&::before{border-left:", "px solid transparent;border-right:", "px solid transparent;border-top:", "px solid ", ";}&::after{left:", "px;top:0;border-left:", "px solid transparent;border-right:", "px solid transparent;border-top:", "px solid ", ";}"], _consts.TRIANGLE_SIZE, _consts.TRIANGLE_SIZE, _consts.TRIANGLE_SIZE, _consts.TRIANGLE_SIZE, function (p) {
  return p.borderColor(p.theme);
}, _consts.BORDER_SIZE * 2, _consts.TRIANGLE_SIZE - _consts.BORDER_SIZE * 2, _consts.TRIANGLE_SIZE - _consts.BORDER_SIZE * 2, _consts.TRIANGLE_SIZE - _consts.BORDER_SIZE * 2, function (p) {
  return p.backgroundColor(p.theme);
});
var arrowLeft = (0, _styledComponents.css)(["left:3px;margin-top:-", "px;&::before{border-top:", "px solid transparent;border-bottom:", "px solid transparent;border-right:", "px solid ", ";}&::after{left:", "px;top:", "px;border-top:", "px solid transparent;border-bottom:", "px solid transparent;border-right:", "px solid ", ";}"], _consts.TRIANGLE_SIZE, _consts.TRIANGLE_SIZE, _consts.TRIANGLE_SIZE, _consts.TRIANGLE_SIZE, function (p) {
  return p.borderColor(p.theme);
}, _consts.BORDER_SIZE * 2, _consts.BORDER_SIZE * 2, _consts.TRIANGLE_SIZE - _consts.BORDER_SIZE * 2, _consts.TRIANGLE_SIZE - _consts.BORDER_SIZE * 2, _consts.TRIANGLE_SIZE - _consts.BORDER_SIZE * 2, function (p) {
  return p.backgroundColor(p.theme);
});
var arrowRight = (0, _styledComponents.css)(["left:auto;right:13px;margin-top:-", "px;&::before{border-top:", "px solid transparent;border-bottom:", "px solid transparent;border-left:", "px solid ", ";}&::after{left:0;top:", "px;border-top:", "px solid transparent;border-bottom:", "px solid transparent;border-left:", "px solid ", ";}"], _consts.TRIANGLE_SIZE, _consts.TRIANGLE_SIZE, _consts.TRIANGLE_SIZE, _consts.TRIANGLE_SIZE, function (p) {
  return p.borderColor(p.theme);
}, _consts.BORDER_SIZE * 2, _consts.TRIANGLE_SIZE - _consts.BORDER_SIZE * 2, _consts.TRIANGLE_SIZE - _consts.BORDER_SIZE * 2, _consts.TRIANGLE_SIZE - _consts.BORDER_SIZE * 2, function (p) {
  return p.backgroundColor(p.theme);
});
var StyledArrow = _styledComponents.default.span.withConfig({
  displayName: "TooltipArrow__StyledArrow",
  componentId: "sc-1j07312-0"
})(["&::before,&::after{content:'';display:block;position:absolute;width:0;height:0;}&::before{left:0;top:0;}", " ", " ", " ", ""], function (p) {
  return ['top-start', 'top', 'top-end'].includes(p.position) ? arrowBottom : '';
}, function (p) {
  return ['bottom-start', 'bottom', 'bottom-end'].includes(p.position) ? arrowTop : '';
}, function (p) {
  return ['left-start', 'left', 'left-end'].includes(p.position) ? arrowRight : '';
}, function (p) {
  return ['right-start', 'right', 'right-end'].includes(p.position) ? arrowLeft : '';
});
var TooltipArrow = (0, _react.forwardRef)(function (_ref, ref) {
  var position = _ref.position,
    style = _ref.style,
    backgroundColor = _ref.backgroundColor,
    borderColor = _ref.borderColor,
    htmlSpanProps = _objectWithoutProperties(_ref, _excluded);
  return _react.default.createElement(StyledArrow, _extends({
    ref: ref,
    position: position,
    style: style,
    backgroundColor: backgroundColor,
    borderColor: borderColor
  }, htmlSpanProps));
});
var _default = exports.default = TooltipArrow;