var _excluded = ["position", "style", "backgroundColor", "borderColor"];
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; }
import React, { forwardRef } from 'react';
import styled, { css } from 'styled-components';
import { BORDER_SIZE, TRIANGLE_SIZE } from '../consts';
var arrowTop = 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 ", ";}"], TRIANGLE_SIZE, TRIANGLE_SIZE, TRIANGLE_SIZE, TRIANGLE_SIZE, function (p) {
  return p.borderColor(p.theme);
}, BORDER_SIZE * 2, TRIANGLE_SIZE - BORDER_SIZE * 2, TRIANGLE_SIZE - BORDER_SIZE * 2, TRIANGLE_SIZE - BORDER_SIZE * 2, function (p) {
  return p.backgroundColor(p.theme);
});
var arrowBottom = 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 ", ";}"], TRIANGLE_SIZE, TRIANGLE_SIZE, TRIANGLE_SIZE, TRIANGLE_SIZE, function (p) {
  return p.borderColor(p.theme);
}, BORDER_SIZE * 2, TRIANGLE_SIZE - BORDER_SIZE * 2, TRIANGLE_SIZE - BORDER_SIZE * 2, TRIANGLE_SIZE - BORDER_SIZE * 2, function (p) {
  return p.backgroundColor(p.theme);
});
var arrowLeft = 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 ", ";}"], TRIANGLE_SIZE, TRIANGLE_SIZE, TRIANGLE_SIZE, TRIANGLE_SIZE, function (p) {
  return p.borderColor(p.theme);
}, BORDER_SIZE * 2, BORDER_SIZE * 2, TRIANGLE_SIZE - BORDER_SIZE * 2, TRIANGLE_SIZE - BORDER_SIZE * 2, TRIANGLE_SIZE - BORDER_SIZE * 2, function (p) {
  return p.backgroundColor(p.theme);
});
var arrowRight = 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 ", ";}"], TRIANGLE_SIZE, TRIANGLE_SIZE, TRIANGLE_SIZE, TRIANGLE_SIZE, function (p) {
  return p.borderColor(p.theme);
}, BORDER_SIZE * 2, TRIANGLE_SIZE - BORDER_SIZE * 2, TRIANGLE_SIZE - BORDER_SIZE * 2, TRIANGLE_SIZE - BORDER_SIZE * 2, function (p) {
  return p.backgroundColor(p.theme);
});
var StyledArrow = styled.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 = forwardRef(function (_ref, ref) {
  var position = _ref.position,
    style = _ref.style,
    backgroundColor = _ref.backgroundColor,
    borderColor = _ref.borderColor,
    htmlSpanProps = _objectWithoutProperties(_ref, _excluded);
  return React.createElement(StyledArrow, _extends({
    ref: ref,
    position: position,
    style: style,
    backgroundColor: backgroundColor,
    borderColor: borderColor
  }, htmlSpanProps));
});
export default TooltipArrow;