"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.McpToolRenderer = McpToolRenderer;
const tslib_1 = require("tslib");
const jsx_runtime_1 = require("react/jsx-runtime");
const cn_1 = require("../../../utils/cn.js");
const MarkdownRenderer_1 = require("../../atoms/MarkdownRenderer/index.js");
const ToolMessage_1 = require("../../organisms/ToolMessage/index.js");
const i18n_1 = require("./i18n/index.js");
require("./McpToolRenderer.css");
const b = (0, cn_1.block)('aistudio-mcp-tool');
function McpToolRenderer({ part }) {
    const _a = part.data, { mcpRequest, mcpResponse } = _a, rest = tslib_1.__rest(_a, ["mcpRequest", "mcpResponse"]);
    const hasMcp = Boolean(mcpRequest || mcpResponse);
    if (!hasMcp) {
        return (0, jsx_runtime_1.jsx)(ToolMessage_1.ToolMessage, Object.assign({}, rest));
    }
    const body = ((0, jsx_runtime_1.jsxs)("div", { className: b(), children: [mcpRequest && ((0, jsx_runtime_1.jsxs)("div", { className: b('section'), children: [(0, jsx_runtime_1.jsx)("div", { className: b('section-label'), children: (0, i18n_1.i18n)('mcp_request') }), (0, jsx_runtime_1.jsx)(MarkdownRenderer_1.MarkdownRenderer, { content: `\`\`\`json\n${mcpRequest}\n\`\`\`` })] })), mcpResponse && ((0, jsx_runtime_1.jsxs)("div", { className: b('section'), children: [(0, jsx_runtime_1.jsx)("div", { className: b('section-label'), children: (0, i18n_1.i18n)('mcp_response') }), (0, jsx_runtime_1.jsx)(MarkdownRenderer_1.MarkdownRenderer, { content: `\`\`\`json\n${mcpResponse}\n\`\`\`` })] }))] }));
    return (0, jsx_runtime_1.jsx)(ToolMessage_1.ToolMessage, Object.assign({}, rest, { bodyContent: body }));
}
//# sourceMappingURL=McpToolRenderer.js.map
