"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UserMessage = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const uikit_1 = require("@gravity-ui/uikit");
const cn_1 = require("../../../utils/cn.js");
const FileIcon_1 = require("../../atoms/FileIcon/index.js");
const MarkdownRenderer_1 = require("../../atoms/MarkdownRenderer/index.js");
const MessageBalloon_1 = require("../../atoms/MessageBalloon/index.js");
const BaseMessage_1 = require("../../molecules/BaseMessage/index.js");
require("./UserMessage.css");
const b = (0, cn_1.block)('user-message');
const UserMessage = (props) => {
    const { className, qa, content, actions, extraInfo, showActionsOnHover, showAvatar, avatarUrl = '', images, fileAttachments, timestamp = '', showTimestamp, format = 'plain', transformOptions, shouldParseIncompleteMarkdown, onActionPopup, } = props;
    return ((0, jsx_runtime_1.jsxs)("div", { className: b(null, className), "data-qa": qa, children: [showAvatar ? (0, jsx_runtime_1.jsx)(uikit_1.Avatar, { imgUrl: avatarUrl, size: "s", view: "filled" }) : null, (0, jsx_runtime_1.jsxs)(BaseMessage_1.BaseMessage, { role: "user", actions: actions, extraInfo: extraInfo, showActionsOnHover: showActionsOnHover, showTimestamp: showTimestamp, timestamp: timestamp, onActionPopup: onActionPopup, children: [images === null || images === void 0 ? void 0 : images.map((src, i) => ((0, jsx_runtime_1.jsx)(MessageBalloon_1.MessageBalloon, { className: b('image-balloon'), children: (0, jsx_runtime_1.jsx)("img", { src: src, alt: "", className: b('image') }) }, i))), (0, jsx_runtime_1.jsx)(MessageBalloon_1.MessageBalloon, { className: (0, cn_1.modsClassName)(b({ format })), children: format === 'markdown' ? ((0, jsx_runtime_1.jsx)(MarkdownRenderer_1.MarkdownRenderer, { content: content, transformOptions: transformOptions, shouldParseIncompleteMarkdown: shouldParseIncompleteMarkdown })) : (content) }), fileAttachments && fileAttachments.length > 0 && ((0, jsx_runtime_1.jsx)("div", { className: b('file-attachments'), children: fileAttachments.map((attachment) => ((0, jsx_runtime_1.jsxs)("div", { className: b('file-chip'), children: [(0, jsx_runtime_1.jsx)(FileIcon_1.FileIcon, { mimeType: attachment.mimeType, fileName: attachment.name, size: "s" }), (0, jsx_runtime_1.jsx)("span", { className: b('file-chip-name'), children: attachment.name })] }, attachment.id))) }))] })] }));
};
exports.UserMessage = UserMessage;
//# sourceMappingURL=index.js.map
