"use strict";
// @ts-nocheck
exports.__esModule = true;
exports.ExternalCard = exports.cnExternalCard = exports.cardPropViewDefault = exports.cardPropView = exports.cardPropSizeDefault = exports.cardPropSize = void 0;
var tslib_1 = require("tslib");
require("./ExternalCard.css");
var react_1 = (0, tslib_1.__importDefault)(require("react"));
var IconOpenInNew_1 = require("../../icons/IconOpenInNew/IconOpenInNew");
var bem_1 = require("../../utils/bem");
var getSizeByMap_1 = require("../../utils/getSizeByMap");
var Button_1 = require("../Button/Button");
var Typography_1 = require("../Typography");
var User_1 = require("../User/User");
exports.cardPropSize = ['m'];
exports.cardPropSizeDefault = exports.cardPropSize[0];
exports.cardPropView = ['default', 'text'];
exports.cardPropViewDefault = exports.cardPropView[0];
var sizeMapTitle = {
    m: 'md'
};
exports.cnExternalCard = (0, bem_1.cn)('ExternalCard');
exports.ExternalCard = react_1["default"].forwardRef(function (props, ref) {
    var className = props.className, _a = props.size, size = _a === void 0 ? exports.cardPropSizeDefault : _a, _b = props.view, view = _b === void 0 ? exports.cardPropViewDefault : _b, text = props.text, link = props.link, linkText = props.linkText, onClickButton = props.onClickButton, authorName = props.authorName, authorPosition = props.authorPosition, authorPhoto = props.authorPhoto, members = props.members, title = props.title;
    return (react_1["default"].createElement("div", { className: (0, exports.cnExternalCard)({ size: size, view: view }, [className]) },
        react_1["default"].createElement("div", { className: (0, exports.cnExternalCard)('Body') },
            react_1["default"].createElement(Typography_1.Typography.Title, { size: (0, getSizeByMap_1.getSizeByMap)(sizeMapTitle, size), className: (0, exports.cnExternalCard)('Title') }, text !== null && text !== void 0 ? text : title),
            link && (react_1["default"].createElement("div", { className: (0, exports.cnExternalCard)('Button') }, Object.keys(link).length > 0 && typeof link !== 'string' ? (react_1["default"].createElement(Button_1.Button, { view: "link-secondary", as: "a", label: link.title, href: link.link, iconRight: IconOpenInNew_1.IconOpenInNew, onClick: onClickButton, iconSize: "xs", target: link.targetBlank ? '_blank' : null })) : (react_1["default"].createElement(Button_1.Button, { view: "link-secondary", as: "a", label: linkText, href: link, iconRight: IconOpenInNew_1.IconOpenInNew, onClick: onClickButton, iconSize: "xs", target: link.targetBlank ? '_blank' : null }))))),
        react_1["default"].createElement("div", { className: (0, exports.cnExternalCard)('User') }, members ? (react_1["default"].createElement(react_1["default"].Fragment, null, members.map(function (author) {
            var _a;
            return (react_1["default"].createElement(User_1.User, { size: "xs", avatarUrl: (_a = author.photo) === null || _a === void 0 ? void 0 : _a.desktop2x, key: "".concat(author.firstName, " ").concat(author.lastName), name: "".concat(author.firstName, " ").concat(author.lastName), info: author.title }));
        }))) : (react_1["default"].createElement(User_1.User, { size: "xs", name: authorName, info: authorPosition, avatarUrl: authorPhoto === null || authorPhoto === void 0 ? void 0 : authorPhoto.url })))));
});
