(function (factory) {
    if (typeof module === "object" && typeof module.exports === "object") {
        var v = factory(require, exports);
        if (v !== undefined) module.exports = v;
    }
    else if (typeof define === "function" && define.amd) {
        define(["require", "exports", "tslib", "styled-components", "../Pallette/themes", "../Pallette/ZIndex", "../utils/theme/getTheme", "../typography/P1", "./themes"], factory);
    }
})(function (require, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.TooltipContentWrapper = exports.TrailContentStyled = exports.TooltipStyled = exports.COMPONENT_NAME = exports.MARGIN = void 0;
    var tslib_1 = require("tslib");
    var styled_components_1 = (0, tslib_1.__importStar)(require("styled-components"));
    var themes_1 = require("../Pallette/themes");
    var ZIndex_1 = require("../Pallette/ZIndex");
    var getTheme_1 = require("../utils/theme/getTheme");
    var P1_1 = (0, tslib_1.__importDefault)(require("../typography/P1"));
    var themes_2 = require("./themes");
    exports.MARGIN = 15;
    exports.COMPONENT_NAME = "tooltip";
    var getDirectionStyles = function (direction, componentSizeAndPosition, textContentSize) {
        switch (direction) {
            case "top":
                return (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = (0, tslib_1.__makeTemplateObject)(["\n        left: ", "px;\n        top: ", "px;\n      "], ["\n        left: ", "px;\n        top: ", "px;\n      "])), componentSizeAndPosition.left +
                    componentSizeAndPosition.width / 2 -
                    textContentSize.width / 2, componentSizeAndPosition.top -
                    exports.MARGIN -
                    textContentSize.height);
            case "bottom":
                return (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = (0, tslib_1.__makeTemplateObject)(["\n        top: ", "px;\n        left: ", "px;\n      "], ["\n        top: ", "px;\n        left: ", "px;\n      "])), componentSizeAndPosition.bottom + exports.MARGIN, componentSizeAndPosition.left +
                    componentSizeAndPosition.width / 2 -
                    textContentSize.width / 2);
            case "right":
                return (0, styled_components_1.css)(templateObject_3 || (templateObject_3 = (0, tslib_1.__makeTemplateObject)(["\n        top: ", "px;\n        left: ", "px;\n      "], ["\n        top: ", "px;\n        left: ", "px;\n      "])), componentSizeAndPosition.height / 2 -
                    textContentSize.height / 2 +
                    componentSizeAndPosition.top, componentSizeAndPosition.left +
                    exports.MARGIN +
                    componentSizeAndPosition.width);
            case "left":
                return (0, styled_components_1.css)(templateObject_4 || (templateObject_4 = (0, tslib_1.__makeTemplateObject)(["\n        left: ", "px;\n        top: ", "px;\n      "], ["\n        left: ", "px;\n        top: ", "px;\n      "])), componentSizeAndPosition.left -
                    exports.MARGIN -
                    textContentSize.width, componentSizeAndPosition.height / 2 -
                    textContentSize.height / 2 +
                    componentSizeAndPosition.top);
            case "bottomRight":
                return (0, styled_components_1.css)(templateObject_5 || (templateObject_5 = (0, tslib_1.__makeTemplateObject)(["\n        top: ", "px;\n        left: ", "px;\n      "], ["\n        top: ", "px;\n        left: ", "px;\n      "])), componentSizeAndPosition.bottom + exports.MARGIN, componentSizeAndPosition.right - textContentSize.width);
            case "bottomLeft":
                return (0, styled_components_1.css)(templateObject_6 || (templateObject_6 = (0, tslib_1.__makeTemplateObject)(["\n        top: ", "px;\n        left: ", "px;\n      "], ["\n        top: ", "px;\n        left: ", "px;\n      "])), componentSizeAndPosition.bottom + exports.MARGIN, componentSizeAndPosition.left);
            case "topLeft":
                return (0, styled_components_1.css)(templateObject_7 || (templateObject_7 = (0, tslib_1.__makeTemplateObject)(["\n        top: ", "px;\n        left: ", "px;\n      "], ["\n        top: ", "px;\n        left: ", "px;\n      "])), componentSizeAndPosition.top -
                    exports.MARGIN -
                    textContentSize.height, componentSizeAndPosition.left);
            case "topRight":
                return (0, styled_components_1.css)(templateObject_8 || (templateObject_8 = (0, tslib_1.__makeTemplateObject)(["\n        top: ", "px;\n        left: ", "px;\n      "], ["\n        top: ", "px;\n        left: ", "px;\n      "])), componentSizeAndPosition.top -
                    exports.MARGIN -
                    textContentSize.height, componentSizeAndPosition.right - textContentSize.width);
            default:
                return (0, styled_components_1.css)(templateObject_9 || (templateObject_9 = (0, tslib_1.__makeTemplateObject)([""], [""])));
        }
    };
    exports.TooltipStyled = styled_components_1.default.div(templateObject_10 || (templateObject_10 = (0, tslib_1.__makeTemplateObject)(["\n  display: inline-block;\n  position: relative;\n"], ["\n  display: inline-block;\n  position: relative;\n"])));
    exports.TrailContentStyled = (0, styled_components_1.default)(P1_1.default)(templateObject_11 || (templateObject_11 = (0, tslib_1.__makeTemplateObject)(["\n  margin-left: 8px;\n"], ["\n  margin-left: 8px;\n"])));
    exports.TooltipContentWrapper = styled_components_1.default.div.attrs(function (props) { return ({
        theme: (0, getTheme_1.getTheme)({
            theme: props.theme,
            defaultTheme: themes_2.defaultThemeTooltip,
            componentName: exports.COMPONENT_NAME
        })
    }); })(templateObject_22 || (templateObject_22 = (0, tslib_1.__makeTemplateObject)(["\n  position: absolute;\n\n  padding: 4px 8px 2px 8px;\n  width: max-content;\n  display: flex;\n  flex-direction: row;\n  border-radius: 8px;\n  z-index: ", ";\n  ::after {\n    ", "\n  }\n  ", ";\n\n  ", ";\n\n  ", ";\n\n  ", " {\n    color: ", ";\n  }\n\n  opacity: 0;\n\n  &.tooltip-content {\n    &-enter {\n      opacity: 0;\n    }\n    &-enter-done {\n      opacity: 1;\n    }\n    &-exit {\n      opacity: 1;\n    }\n    &-exit-active {\n      opacity: 0;\n    }\n  }\n"], ["\n  position: absolute;\n\n  padding: 4px 8px 2px 8px;\n  width: max-content;\n  display: flex;\n  flex-direction: row;\n  border-radius: 8px;\n  z-index: ", ";\n  ::after {\n    ", "\n  }\n  ", ";\n\n  ", ";\n\n  ", ";\n\n  ", " {\n    color: ", ";\n  }\n\n  opacity: 0;\n\n  &.tooltip-content {\n    &-enter {\n      opacity: 0;\n    }\n    &-enter-done {\n      opacity: 1;\n    }\n    &-exit {\n      opacity: 1;\n    }\n    &-exit-active {\n      opacity: 0;\n    }\n  }\n"])), ZIndex_1.ZINDEX.tooltip, function (_a) {
        var direction = _a.direction, theme = _a.theme;
        switch (direction) {
            case "top":
                return (0, styled_components_1.css)(templateObject_12 || (templateObject_12 = (0, tslib_1.__makeTemplateObject)(["\n            content: \"\";\n            position: absolute;\n            top: 100%;\n            left: 50%;\n            margin-left: -5px;\n            border-width: 6px;\n            border-style: solid;\n            border-radius: 1px;\n            border-color: ", "\n              transparent transparent;\n          "], ["\n            content: \"\";\n            position: absolute;\n            top: 100%;\n            left: 50%;\n            margin-left: -5px;\n            border-width: 6px;\n            border-style: solid;\n            border-radius: 1px;\n            border-color: ", "\n              transparent transparent;\n          "])), theme.components[exports.COMPONENT_NAME].background);
            case "bottom":
                return (0, styled_components_1.css)(templateObject_13 || (templateObject_13 = (0, tslib_1.__makeTemplateObject)(["\n            content: \"\";\n            position: absolute;\n            bottom: 100%;\n            left: 50%;\n            margin-left: -5px;\n            border-width: 6px;\n            border-style: solid;\n            border-radius: 1px;\n            border-color: transparent transparent\n              ", ";\n          "], ["\n            content: \"\";\n            position: absolute;\n            bottom: 100%;\n            left: 50%;\n            margin-left: -5px;\n            border-width: 6px;\n            border-style: solid;\n            border-radius: 1px;\n            border-color: transparent transparent\n              ", ";\n          "])), theme.components[exports.COMPONENT_NAME].background);
            case "right":
                return (0, styled_components_1.css)(templateObject_14 || (templateObject_14 = (0, tslib_1.__makeTemplateObject)(["\n            content: \"\";\n            position: absolute;\n            bottom: 30%;\n            right: 100%;\n            margin-left: -5px;\n            border-width: 6px;\n            border-style: solid;\n            border-color: transparent\n              ", " transparent\n              transparent;\n          "], ["\n            content: \"\";\n            position: absolute;\n            bottom: 30%;\n            right: 100%;\n            margin-left: -5px;\n            border-width: 6px;\n            border-style: solid;\n            border-color: transparent\n              ", " transparent\n              transparent;\n          "])), theme.components[exports.COMPONENT_NAME].background);
            case "left":
                return (0, styled_components_1.css)(templateObject_15 || (templateObject_15 = (0, tslib_1.__makeTemplateObject)(["\n            content: \"\";\n            position: absolute;\n            bottom: 30%;\n            left: 100%;\n            margin-right: -5px;\n            border-width: 6px;\n            border-style: solid;\n            border-color: transparent transparent transparent\n              ", ";\n          "], ["\n            content: \"\";\n            position: absolute;\n            bottom: 30%;\n            left: 100%;\n            margin-right: -5px;\n            border-width: 6px;\n            border-style: solid;\n            border-color: transparent transparent transparent\n              ", ";\n          "])), theme.components[exports.COMPONENT_NAME].background);
            case "topRight":
                return (0, styled_components_1.css)(templateObject_16 || (templateObject_16 = (0, tslib_1.__makeTemplateObject)(["\n            content: \"\";\n            position: absolute;\n            top: 100%;\n            right: 10%;\n            margin-left: -5px;\n            border-width: 6px;\n            border-style: solid;\n            border-radius: 1px;\n            border-color: ", "\n              transparent transparent;\n          "], ["\n            content: \"\";\n            position: absolute;\n            top: 100%;\n            right: 10%;\n            margin-left: -5px;\n            border-width: 6px;\n            border-style: solid;\n            border-radius: 1px;\n            border-color: ", "\n              transparent transparent;\n          "])), theme.components[exports.COMPONENT_NAME].background);
            case "bottomRight":
                return (0, styled_components_1.css)(templateObject_17 || (templateObject_17 = (0, tslib_1.__makeTemplateObject)(["\n            content: \"\";\n            position: absolute;\n            bottom: 100%;\n            right: 10%;\n            margin-left: -5px;\n            border-width: 6px;\n            border-style: solid;\n            border-radius: 1px;\n            border-color: transparent transparent\n              ", ";\n          "], ["\n            content: \"\";\n            position: absolute;\n            bottom: 100%;\n            right: 10%;\n            margin-left: -5px;\n            border-width: 6px;\n            border-style: solid;\n            border-radius: 1px;\n            border-color: transparent transparent\n              ", ";\n          "])), theme.components[exports.COMPONENT_NAME].background);
            case "topLeft":
                return (0, styled_components_1.css)(templateObject_18 || (templateObject_18 = (0, tslib_1.__makeTemplateObject)(["\n            content: \"\";\n            position: absolute;\n            top: 100%;\n            left: 10%;\n            margin-left: -5px;\n            border-width: 6px;\n            border-style: solid;\n            border-radius: 1px;\n            border-color: ", "\n              transparent transparent;\n          "], ["\n            content: \"\";\n            position: absolute;\n            top: 100%;\n            left: 10%;\n            margin-left: -5px;\n            border-width: 6px;\n            border-style: solid;\n            border-radius: 1px;\n            border-color: ", "\n              transparent transparent;\n          "])), theme.components[exports.COMPONENT_NAME].background);
            case "bottomLeft":
                return (0, styled_components_1.css)(templateObject_19 || (templateObject_19 = (0, tslib_1.__makeTemplateObject)(["\n            content: \"\";\n            position: absolute;\n            bottom: 100%;\n            left: 10%;\n            margin-left: -5px;\n            border-width: 6px;\n            border-style: solid;\n            border-radius: 1px;\n            border-color: transparent transparent\n              ", ";\n          "], ["\n            content: \"\";\n            position: absolute;\n            bottom: 100%;\n            left: 10%;\n            margin-left: -5px;\n            border-width: 6px;\n            border-style: solid;\n            border-radius: 1px;\n            border-color: transparent transparent\n              ", ";\n          "])), theme.components[exports.COMPONENT_NAME].background);
            default:
                return (0, styled_components_1.css)(templateObject_20 || (templateObject_20 = (0, tslib_1.__makeTemplateObject)(["\n            content: \"\";\n            position: absolute;\n            top: 100%;\n            left: 50%;\n            margin-left: -5px;\n            border-width: 6px;\n            border-style: solid;\n            border-radius: 1px;\n          "], ["\n            content: \"\";\n            position: absolute;\n            top: 100%;\n            left: 50%;\n            margin-left: -5px;\n            border-width: 6px;\n            border-style: solid;\n            border-radius: 1px;\n          "])));
        }
    }, function (_a) {
        var theme = _a.theme;
        return (0, styled_components_1.css)(templateObject_21 || (templateObject_21 = (0, tslib_1.__makeTemplateObject)(["\n      background: ", ";\n      color: ", ";\n    "], ["\n      background: ", ";\n      color: ", ";\n    "])), theme.components[exports.COMPONENT_NAME].background, theme.components[exports.COMPONENT_NAME].color);
    }, function (_a) {
        var isShadow = _a.isShadow, theme = _a.theme;
        return isShadow && theme.shadows.hp.bottom;
    }, function (_a) {
        var direction = _a.direction, componentSizeAndPosition = _a.componentSizeAndPosition, textContentSize = _a.textContentSize;
        return getDirectionStyles(direction, componentSizeAndPosition, textContentSize);
    }, exports.TrailContentStyled, function (_a) {
        var theme = _a.theme;
        return theme.components[exports.COMPONENT_NAME].colorTrail;
    });
    exports.TooltipContentWrapper.defaultProps = {
        theme: themes_1.LIGHT_THEME
    };
    var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16, templateObject_17, templateObject_18, templateObject_19, templateObject_20, templateObject_21, templateObject_22;
});
