(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/style-utils", "../Pallette/ZIndex", "../utils/theme/getTheme", "./themes"], factory);
    }
})(function (require, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.PopoverContentWrapper = exports.PopoverStyled = 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 style_utils_1 = require("../Pallette/style-utils");
    var ZIndex_1 = require("../Pallette/ZIndex");
    var getTheme_1 = require("../utils/theme/getTheme");
    var themes_2 = require("./themes");
    exports.MARGIN = 15;
    exports.COMPONENT_NAME = "popover";
    var getDirectionStyles = function (direction, componentSizeAndPosition, textContentSize, theme) {
        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        &::after {\n          content: \"\";\n          position: absolute;\n          top: 100%;\n          left: 50%;\n          border-width: 6px;\n          border-style: solid;\n          border-color: transparent transparent\n            ", " transparent;\n          transform: rotate(180deg);\n        }\n      "], ["\n        left: ", "px;\n        top: ", "px;\n        &::after {\n          content: \"\";\n          position: absolute;\n          top: 100%;\n          left: 50%;\n          border-width: 6px;\n          border-style: solid;\n          border-color: transparent transparent\n            ", " transparent;\n          transform: rotate(180deg);\n        }\n      "])), componentSizeAndPosition.left +
                    componentSizeAndPosition.width / 2 -
                    textContentSize.width / 2, componentSizeAndPosition.top -
                    exports.MARGIN -
                    textContentSize.height, theme.components[exports.COMPONENT_NAME].background);
            case "bottom":
                return (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = (0, tslib_1.__makeTemplateObject)(["\n        top: ", "px;\n        left: ", "px;\n        &::after {\n          content: \"\";\n          position: absolute;\n          bottom: 100%;\n          left: 50%;\n          border-width: 6px;\n          border-style: solid;\n          border-color: transparent transparent\n            ", " transparent;\n        }\n      "], ["\n        top: ", "px;\n        left: ", "px;\n        &::after {\n          content: \"\";\n          position: absolute;\n          bottom: 100%;\n          left: 50%;\n          border-width: 6px;\n          border-style: solid;\n          border-color: transparent transparent\n            ", " transparent;\n        }\n      "])), componentSizeAndPosition.bottom + exports.MARGIN, componentSizeAndPosition.left +
                    componentSizeAndPosition.width / 2 -
                    textContentSize.width / 2, theme.components[exports.COMPONENT_NAME].background);
            case "right":
                return (0, styled_components_1.css)(templateObject_3 || (templateObject_3 = (0, tslib_1.__makeTemplateObject)(["\n        top: ", "px;\n        left: ", "px;\n        &::after {\n          content: \"\";\n          position: absolute;\n          top: 50%;\n          right: 100%;\n          border-width: 6px;\n          border-style: solid;\n          border-color: transparent transparent\n            ", " transparent;\n          transform: rotate(-90deg);\n        }\n      "], ["\n        top: ", "px;\n        left: ", "px;\n        &::after {\n          content: \"\";\n          position: absolute;\n          top: 50%;\n          right: 100%;\n          border-width: 6px;\n          border-style: solid;\n          border-color: transparent transparent\n            ", " transparent;\n          transform: rotate(-90deg);\n        }\n      "])), componentSizeAndPosition.height / 2 -
                    textContentSize.height / 2 +
                    componentSizeAndPosition.top, componentSizeAndPosition.left +
                    exports.MARGIN +
                    componentSizeAndPosition.width, theme.components[exports.COMPONENT_NAME].background);
            case "left":
                return (0, styled_components_1.css)(templateObject_4 || (templateObject_4 = (0, tslib_1.__makeTemplateObject)(["\n        left: ", "px;\n        top: ", "px;\n        &::after {\n          content: \"\";\n          position: absolute;\n          top: 50%;\n          left: 100%;\n          border-width: 6px;\n          border-style: solid;\n          border-color: transparent transparent\n            ", " transparent;\n          transform: rotate(90deg);\n        }\n      "], ["\n        left: ", "px;\n        top: ", "px;\n        &::after {\n          content: \"\";\n          position: absolute;\n          top: 50%;\n          left: 100%;\n          border-width: 6px;\n          border-style: solid;\n          border-color: transparent transparent\n            ", " transparent;\n          transform: rotate(90deg);\n        }\n      "])), componentSizeAndPosition.left -
                    exports.MARGIN -
                    textContentSize.width, componentSizeAndPosition.height / 2 -
                    textContentSize.height / 2 +
                    componentSizeAndPosition.top, theme.components[exports.COMPONENT_NAME].background);
            case "bottomRight":
                return (0, styled_components_1.css)(templateObject_5 || (templateObject_5 = (0, tslib_1.__makeTemplateObject)(["\n        top: ", "px;\n        left: ", "px;\n        &::after {\n          content: \"\";\n          position: absolute;\n          bottom: 100%;\n          right: 16px;\n          border-width: 6px;\n          border-style: solid;\n          border-color: transparent transparent\n            ", " transparent;\n        }\n      "], ["\n        top: ", "px;\n        left: ", "px;\n        &::after {\n          content: \"\";\n          position: absolute;\n          bottom: 100%;\n          right: 16px;\n          border-width: 6px;\n          border-style: solid;\n          border-color: transparent transparent\n            ", " transparent;\n        }\n      "])), componentSizeAndPosition.bottom + exports.MARGIN, componentSizeAndPosition.right - textContentSize.width, theme.components[exports.COMPONENT_NAME].background);
            case "bottomLeft":
                return (0, styled_components_1.css)(templateObject_6 || (templateObject_6 = (0, tslib_1.__makeTemplateObject)(["\n        top: ", "px;\n        left: ", "px;\n        &::after {\n          content: \"\";\n          position: absolute;\n          bottom: 100%;\n          left: 16px;\n          border-width: 6px;\n          border-style: solid;\n          border-color: transparent transparent\n            ", " transparent;\n        }\n      "], ["\n        top: ", "px;\n        left: ", "px;\n        &::after {\n          content: \"\";\n          position: absolute;\n          bottom: 100%;\n          left: 16px;\n          border-width: 6px;\n          border-style: solid;\n          border-color: transparent transparent\n            ", " transparent;\n        }\n      "])), componentSizeAndPosition.bottom + exports.MARGIN, componentSizeAndPosition.left, theme.components[exports.COMPONENT_NAME].background);
            case "topLeft":
                return (0, styled_components_1.css)(templateObject_7 || (templateObject_7 = (0, tslib_1.__makeTemplateObject)(["\n        top: ", "px;\n        left: ", "px;\n        &::after {\n          content: \"\";\n          position: absolute;\n          top: 100%;\n          left: 16px;\n          border-width: 6px;\n          border-style: solid;\n          border-color: transparent transparent\n            ", " transparent;\n          transform: rotate(180deg);\n        }\n      "], ["\n        top: ", "px;\n        left: ", "px;\n        &::after {\n          content: \"\";\n          position: absolute;\n          top: 100%;\n          left: 16px;\n          border-width: 6px;\n          border-style: solid;\n          border-color: transparent transparent\n            ", " transparent;\n          transform: rotate(180deg);\n        }\n      "])), componentSizeAndPosition.top -
                    exports.MARGIN -
                    textContentSize.height, componentSizeAndPosition.left, theme.components[exports.COMPONENT_NAME].background);
            case "topRight":
                return (0, styled_components_1.css)(templateObject_8 || (templateObject_8 = (0, tslib_1.__makeTemplateObject)(["\n        top: ", "px;\n        left: ", "px;\n        &::after {\n          content: \"\";\n          position: absolute;\n          top: 100%;\n          right: 16px;\n          border-width: 6px;\n          border-style: solid;\n          border-color: transparent transparent\n            ", " transparent;\n          transform: rotate(180deg);\n        }\n      "], ["\n        top: ", "px;\n        left: ", "px;\n        &::after {\n          content: \"\";\n          position: absolute;\n          top: 100%;\n          right: 16px;\n          border-width: 6px;\n          border-style: solid;\n          border-color: transparent transparent\n            ", " transparent;\n          transform: rotate(180deg);\n        }\n      "])), componentSizeAndPosition.top -
                    exports.MARGIN -
                    textContentSize.height, componentSizeAndPosition.right - textContentSize.width, theme.components[exports.COMPONENT_NAME].background);
            default:
                return (0, styled_components_1.css)(templateObject_9 || (templateObject_9 = (0, tslib_1.__makeTemplateObject)([""], [""])));
        }
    };
    exports.PopoverStyled = 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.PopoverContentWrapper = styled_components_1.default.div.attrs(function (props) { return ({
        theme: (0, getTheme_1.getTheme)({
            theme: props.theme,
            defaultTheme: themes_2.defaultThemePopover,
            componentName: exports.COMPONENT_NAME
        })
    }); })(templateObject_12 || (templateObject_12 = (0, tslib_1.__makeTemplateObject)(["\n  position: absolute;\n\n  padding: 24px;\n  width: 320px;\n  display: flex;\n  flex-direction: column;\n  z-index: ", ";\n\n  ", ";\n\n  ", ";\n  ", "\n  ", ";\n  opacity: 0;\n\n  .buttonHolder {\n    display: flex;\n    justify-content: center;\n    gap: 16px;\n    margin-top: 16px;\n  }\n  .popoverHeader {\n    display: flex;\n    span {\n      word-wrap: break-word;\n    }\n    width: 280px;\n    flex-direction: column;\n    gap: 8px;\n  }\n\n  &.Popover-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: 24px;\n  width: 320px;\n  display: flex;\n  flex-direction: column;\n  z-index: ", ";\n\n  ", ";\n\n  ", ";\n  ", "\n  ", ";\n  opacity: 0;\n\n  .buttonHolder {\n    display: flex;\n    justify-content: center;\n    gap: 16px;\n    margin-top: 16px;\n  }\n  .popoverHeader {\n    display: flex;\n    span {\n      word-wrap: break-word;\n    }\n    width: 280px;\n    flex-direction: column;\n    gap: 8px;\n  }\n\n  &.Popover-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 theme = _a.theme;
        return (0, styled_components_1.css)(templateObject_11 || (templateObject_11 = (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 theme = _a.theme;
        return theme.shadows.hp.bottom;
    }, style_utils_1.BorderRadius.roundBorder("16px"), function (_a) {
        var direction = _a.direction, componentSizeAndPosition = _a.componentSizeAndPosition, textContentSize = _a.textContentSize, theme = _a.theme;
        return getDirectionStyles(direction, componentSizeAndPosition, textContentSize, theme);
    });
    exports.PopoverContentWrapper.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;
});
