// @ts-nocheck
import { __assign, __rest } from "tslib";
import './Text.css';
import React from 'react';
import { Link } from 'react-router-dom';
// eslint-disable-next-line import/no-named-default
import { default as parseFunc } from 'html-react-parser';
import { cn } from '../../../utils/bem';
import { forwardRefWithAs } from '../../../utils/types/PropsWithAsAttributes';
export var typographyPropAlign = ['left', 'center', 'right'];
export var typographyPropDisplay = ['block', 'inlineBlock', 'inline'];
export var typographyPropFont = ['primary', 'mono'];
export var typographyPropDecoration = ['underline'];
export var typographyPropSize = [
    'm',
    '2xs',
    'xs',
    's',
    'l',
    'xl',
    '2xl',
    '3xl',
    '4xl',
    '5xl',
    '6xl',
];
export var typographyPropSizeDefault = typographyPropSize[0];
export var typographyPropSpacing = ['xs', 's', 'm', 'l'];
export var typographyPropType = ['blockquote', 'p', 'h3', 'h2', 'h1'];
export var typographyPropView = ['default'];
export var typographyPropViewDefault = typographyPropView[0];
export var typographyPropWeight = [
    'black',
    'bold',
    'light',
    'regular',
    'semibold',
    'thin',
];
export var typographyPropFontStyle = ['italic'];
export var typographyPropTransform = ['uppercase'];
export var typographyPropWidth = ['default'];
export var cnText = cn('Text');
export var Text = 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 ? typographyPropSizeDefault : _b, spacing = props.spacing, fontStyle = props.fontStyle, transform = props.transform, type = props.type, _c = props.view, view = _c === void 0 ? typographyPropViewDefault : _c, weight = props.weight, width = props.width, className = props.className, children = props.children, nowrap = props.nowrap, parse = props.parse, otherProps = __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.createElement(Link, __assign({}, otherProps, { className: 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' ? parseFunc(children) : children));
    }
    var componentProps = {
        rel: target === '_blank' ? 'noreferrer noopener' : undefined
    };
    return (React.createElement(Tag, __assign({}, otherProps, componentProps, { className: 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' ? parseFunc(children) : children));
});
