"use strict";
// @ts-nocheck
exports.__esModule = true;
exports.Text = exports.cnText = exports.typographyPropWidth = exports.typographyPropTransform = exports.typographyPropFontStyle = exports.typographyPropWeight = exports.typographyPropViewDefault = exports.typographyPropView = exports.typographyPropType = exports.typographyPropSpacing = exports.typographyPropSizeDefault = exports.typographyPropSize = exports.typographyPropDecoration = exports.typographyPropFont = exports.typographyPropDisplay = exports.typographyPropAlign = void 0;
var tslib_1 = require("tslib");
require("./Text.css");
var react_1 = (0, tslib_1.__importDefault)(require("react"));
var react_router_dom_1 = require("react-router-dom");
// eslint-disable-next-line import/no-named-default
var html_react_parser_1 = (0, tslib_1.__importDefault)(require("html-react-parser"));
var bem_1 = require("../../../utils/bem");
var PropsWithAsAttributes_1 = require("../../../utils/types/PropsWithAsAttributes");
exports.typographyPropAlign = ['left', 'center', 'right'];
exports.typographyPropDisplay = ['block', 'inlineBlock', 'inline'];
exports.typographyPropFont = ['primary', 'mono'];
exports.typographyPropDecoration = ['underline'];
exports.typographyPropSize = [
    'm',
    '2xs',
    'xs',
    's',
    'l',
    'xl',
    '2xl',
    '3xl',
    '4xl',
    '5xl',
    '6xl',
];
exports.typographyPropSizeDefault = exports.typographyPropSize[0];
exports.typographyPropSpacing = ['xs', 's', 'm', 'l'];
exports.typographyPropType = ['blockquote', 'p', 'h3', 'h2', 'h1'];
exports.typographyPropView = ['default'];
exports.typographyPropViewDefault = exports.typographyPropView[0];
exports.typographyPropWeight = [
    'black',
    'bold',
    'light',
    'regular',
    'semibold',
    'thin',
];
exports.typographyPropFontStyle = ['italic'];
exports.typographyPropTransform = ['uppercase'];
exports.typographyPropWidth = ['default'];
exports.cnText = (0, bem_1.cn)('Text');
exports.Text = (0, PropsWithAsAttributes_1.forwardRefWithAs)(function (props, ref) {
    var _a = props.as, as = _a === void 0 ? 'div' : _a, align = props.align, decoration = props.decoration, display = props.display, font = props.font, _b = props.size, size = _b === void 0 ? exports.typographyPropSizeDefault : _b, spacing = props.spacing, fontStyle = props.fontStyle, transform = props.transform, type = props.type, _c = props.view, view = _c === void 0 ? exports.typographyPropViewDefault : _c, weight = props.weight, width = props.width, className = props.className, children = props.children, nowrap = props.nowrap, parse = props.parse, otherProps = (0, tslib_1.__rest)(props, ["as", "align", "decoration", "display", "font", "size", "spacing", "fontStyle", "transform", "type", "view", "weight", "width", "className", "children", "nowrap", "parse"]);
    var target = otherProps.target;
    var Tag = as;
    if (Tag === 'link') {
        return (react_1["default"].createElement(react_router_dom_1.Link, (0, tslib_1.__assign)({}, otherProps, { className: (0, exports.cnText)({
                align: align,
                decoration: decoration,
                display: display,
                font: font,
                size: size,
                spacing: spacing,
                fontStyle: fontStyle,
                transform: transform,
                type: type,
                view: view,
                weight: weight,
                width: width,
                nowrap: nowrap
            }, [className]), ref: ref }), parse && typeof children === 'string' ? (0, html_react_parser_1["default"])(children) : children));
    }
    var componentProps = {
        rel: target === '_blank' ? 'noreferrer noopener' : undefined
    };
    return (react_1["default"].createElement(Tag, (0, tslib_1.__assign)({}, otherProps, componentProps, { className: (0, exports.cnText)({
            align: align,
            decoration: decoration,
            display: display,
            font: font,
            size: size,
            spacing: spacing,
            fontStyle: fontStyle,
            transform: transform,
            type: type,
            view: view,
            weight: weight,
            width: width,
            nowrap: nowrap
        }, [className]), ref: ref }), parse && typeof children === 'string' ? (0, html_react_parser_1["default"])(children) : children));
});
