import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Avatar } from '@gravity-ui/uikit';
import { block, modsClassName } from "../../../utils/cn.js";
import { FileIcon } from "../../atoms/FileIcon/index.js";
import { MarkdownRenderer } from "../../atoms/MarkdownRenderer/index.js";
import { MessageBalloon } from "../../atoms/MessageBalloon/index.js";
import { BaseMessage } from "../../molecules/BaseMessage/index.js";
import "./UserMessage.css";
const b = block('user-message');
export const UserMessage = (props) => {
    const { className, qa, content, actions, extraInfo, showActionsOnHover, showAvatar, avatarUrl = '', images, fileAttachments, timestamp = '', showTimestamp, format = 'plain', transformOptions, shouldParseIncompleteMarkdown, onActionPopup, } = props;
    return (_jsxs("div", { className: b(null, className), "data-qa": qa, children: [showAvatar ? _jsx(Avatar, { imgUrl: avatarUrl, size: "s", view: "filled" }) : null, _jsxs(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) => (_jsx(MessageBalloon, { className: b('image-balloon'), children: _jsx("img", { src: src, alt: "", className: b('image') }) }, i))), _jsx(MessageBalloon, { className: modsClassName(b({ format })), children: format === 'markdown' ? (_jsx(MarkdownRenderer, { content: content, transformOptions: transformOptions, shouldParseIncompleteMarkdown: shouldParseIncompleteMarkdown })) : (content) }), fileAttachments && fileAttachments.length > 0 && (_jsx("div", { className: b('file-attachments'), children: fileAttachments.map((attachment) => (_jsxs("div", { className: b('file-chip'), children: [_jsx(FileIcon, { mimeType: attachment.mimeType, fileName: attachment.name, size: "s" }), _jsx("span", { className: b('file-chip-name'), children: attachment.name })] }, attachment.id))) }))] })] }));
};
//# sourceMappingURL=index.js.map
