"use strict";
// @ts-nocheck
exports.__esModule = true;
exports.Text = exports.cnText = exports.typographyPropTransform = exports.typographyPropWeight = exports.typographyPropViewDefault = exports.typographyPropView = exports.typographyPropSpacing = exports.typographyPropSizeDefault = exports.typographyPropSize = 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.typographyPropSize = ['m', 'xs', 's', 'l', 'xl'];
exports.typographyPropSizeDefault = exports.typographyPropSize[0];
exports.typographyPropSpacing = ['xs', 's', 'm', 'l'];
exports.typographyPropView = ['default', 'primary', 'alert', 'web'];
exports.typographyPropViewDefault = exports.typographyPropView[0];
exports.typographyPropWeight = [
    'black',
    'bold',
    'light',
    'regular',
    'semibold',
    'thin',
];
exports.typographyPropTransform = ['uppercase'];
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, display = props.display, _b = props.size, size = _b === void 0 ? exports.typographyPropSizeDefault : _b, spacing = props.spacing, transform = props.transform, _c = props.view, view = _c === void 0 ? exports.typographyPropViewDefault : _c, weight = props.weight, className = props.className, children = props.children, nowrap = props.nowrap, parse = props.parse, otherProps = (0, tslib_1.__rest)(props, ["as", "align", "display", "size", "spacing", "transform", "view", "weight", "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,
                display: display,
                size: size,
                spacing: spacing,
                transform: transform,
                view: view,
                weight: weight,
                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,
            display: display,
            size: size,
            spacing: spacing,
            transform: transform,
            view: view,
            weight: weight,
            nowrap: nowrap
        }, [className]), ref: ref }), parse && typeof children === 'string' ? (0, html_react_parser_1["default"])(children) : children));
});
