import { __rest } from "tslib";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { block } from "../../../utils/cn.js";
import { MarkdownRenderer } from "../../atoms/MarkdownRenderer/index.js";
import { ToolMessage } from "../../organisms/ToolMessage/index.js";
import { i18n } from "./i18n/index.js";
import "./McpToolRenderer.css";
const b = block('aistudio-mcp-tool');
export function McpToolRenderer({ part }) {
    const _a = part.data, { mcpRequest, mcpResponse } = _a, rest = __rest(_a, ["mcpRequest", "mcpResponse"]);
    const hasMcp = Boolean(mcpRequest || mcpResponse);
    if (!hasMcp) {
        return _jsx(ToolMessage, Object.assign({}, rest));
    }
    const body = (_jsxs("div", { className: b(), children: [mcpRequest && (_jsxs("div", { className: b('section'), children: [_jsx("div", { className: b('section-label'), children: i18n('mcp_request') }), _jsx(MarkdownRenderer, { content: `\`\`\`json\n${mcpRequest}\n\`\`\`` })] })), mcpResponse && (_jsxs("div", { className: b('section'), children: [_jsx("div", { className: b('section-label'), children: i18n('mcp_response') }), _jsx(MarkdownRenderer, { content: `\`\`\`json\n${mcpResponse}\n\`\`\`` })] }))] }));
    return _jsx(ToolMessage, Object.assign({}, rest, { bodyContent: body }));
}
//# sourceMappingURL=McpToolRenderer.js.map
