"use strict";
// @ts-nocheck
exports.__esModule = true;
exports.User = exports.cnUser = exports.userPropStatus = exports.userPropWidthDefault = exports.userPropWidth = exports.userPropViewDefault = exports.userPropView = exports.userPropSizeDefault = exports.userPropSize = void 0;
var tslib_1 = require("tslib");
require("./User.css");
var react_1 = (0, tslib_1.__importDefault)(require("react"));
var bem_1 = require("../../utils/bem");
var getSizeByMap_1 = require("../../utils/getSizeByMap");
var PropsWithAsAttributes_1 = require("../../utils/types/PropsWithAsAttributes");
var Avatar_1 = require("../Avatar/Avatar");
var Typography_1 = require("../Typography");
exports.userPropSize = ['xs', 'm', 's', 'l'];
exports.userPropSizeDefault = exports.userPropSize[0];
exports.userPropView = ['clear', 'ghost'];
exports.userPropViewDefault = exports.userPropView[0];
exports.userPropWidth = ['default', 'full'];
exports.userPropWidthDefault = exports.userPropWidth[0];
exports.userPropStatus = ['available', 'remote', 'out'];
exports.cnUser = (0, bem_1.cn)('User');
var titleSizeMap = {
    xs: 'm',
    s: 'm',
    m: 'm'
};
var infoSizeMap = {
    xs: 's',
    s: 'm',
    m: '2xs',
    l: 'xs'
};
var avatarSizeMap = {
    s: 's',
    m: 'm',
    l: 'l'
};
exports.User = (0, PropsWithAsAttributes_1.forwardRefWithAs)(function (props, ref) {
    var _a = props.as, as = _a === void 0 ? 'div' : _a, className = props.className, _b = props.size, size = _b === void 0 ? exports.userPropSizeDefault : _b, avatarUrl = props.avatarUrl, name = props.name, _c = props.view, view = _c === void 0 ? exports.userPropViewDefault : _c, _d = props.width, width = _d === void 0 ? exports.userPropWidthDefault : _d, propOnlyAvatar = props.onlyAvatar, info = props.info, contacts = props.contacts, socials = props.socials, status = props.status, description = props.description, otherProps = (0, tslib_1.__rest)(props, ["as", "className", "size", "avatarUrl", "name", "view", "width", "onlyAvatar", "info", "contacts", "socials", "status", "description"]);
    var Tag = as;
    var onlyAvatar = propOnlyAvatar || (!name && !info);
    return (react_1["default"].createElement(Tag, (0, tslib_1.__assign)({}, otherProps, { className: (0, exports.cnUser)({
            size: size,
            view: view,
            width: width,
            minified: onlyAvatar,
            alignTop: !!contacts || !!socials || !!description
        }, [className]), ref: ref }),
        avatarUrl && (react_1["default"].createElement("div", { className: (0, exports.cnUser)('AvatarWrapper', { status: status }) },
            react_1["default"].createElement(Avatar_1.Avatar, { size: (0, getSizeByMap_1.getSizeByMap)(avatarSizeMap, size), url: avatarUrl, name: name }))),
        !onlyAvatar && (name || info) && (react_1["default"].createElement("div", { className: (0, exports.cnUser)('Block') },
            name && (react_1["default"].createElement(Typography_1.Typography.Text, { className: (0, exports.cnUser)('Name'), size: (0, getSizeByMap_1.getSizeByMap)(titleSizeMap, size), weight: "bold" }, name)),
            info && size !== 's' && (react_1["default"].createElement(Typography_1.Typography.Text, { className: (0, exports.cnUser)('Info'), size: (0, getSizeByMap_1.getSizeByMap)(infoSizeMap, size) }, info)),
            description && react_1["default"].createElement("div", { className: (0, exports.cnUser)('Description') }, description()),
            contacts && react_1["default"].createElement("div", { className: (0, exports.cnUser)('Contacts') }, contacts()),
            socials && react_1["default"].createElement("div", { className: (0, exports.cnUser)('Socials') }, socials())))));
});
