import { _ as __rest } from './tslib.es6-ab63fd84.js';
import React__default, { useMemo } from 'react';
import { Spoiler as Spoiler$1 } from '@mantine/core';
import { T as Text } from './index-d0a1200e.js';
import { u as useTranslations } from './index-960c3169.js';
import { theme } from './miscTheme.js';

const Spoiler = (_a) => {
    var { children, line, lineHeight, trackingAttributes, maxHeight: _maxHeight, customExpandFn } = _a, rest = __rest(_a, ["children", "line", "lineHeight", "trackingAttributes", "maxHeight", "customExpandFn"]);
    const { t } = useTranslations();
    const maxHeight = useMemo(() => {
        if (_maxHeight)
            return _maxHeight;
        if (line && lineHeight)
            return line * lineHeight;
        console.error('[HHG-Comp]:[Spoiler] Please provide maxHeight, or line with lineHeight');
        return 0;
    }, []);
    if (!children)
        console.error('[HHG-Comp]:[Spoiler] Please provide children');
    const gaAttributes = useMemo(() => {
        if (trackingAttributes) {
            return {
                'data-event-category': trackingAttributes.dataEventCategory,
                'data-event-action': trackingAttributes.dataEventAction,
                'data-event-label': trackingAttributes.dataEventLabel,
            };
        }
        else {
            return {};
        }
    }, [trackingAttributes]);
    return (React__default.createElement(Spoiler$1, Object.assign({ showLabel: React__default.createElement(Text, Object.assign({ size: "p3", color: theme.colors.primaryBase }, gaAttributes, { onClick: customExpandFn }), t('articlePage.readMore')), hideLabel: React__default.createElement(Text, Object.assign({ size: "p3", color: theme.colors.primaryBase }, gaAttributes), t('articlePage.showLess')) }, rest, { maxHeight: maxHeight }), children));
};

export { Spoiler as S };
