import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import React from 'react';
import { Text } from '@gravity-ui/uikit';
import { isActionConfig } from "../../../utils/actionUtils.js";
import { block } from "../../../utils/cn.js";
import { ActionButton } from "../../atoms/ActionButton/index.js";
import { ButtonGroup } from "../ButtonGroup/index.js";
import { ToolStatus } from "../ToolStatus/index.js";
import "./ToolHeader.css";
const b = block('tool-header');
export function ToolHeader(props) {
    const { toolIcon, toolName, content, actions, status, className, qa } = props;
    const hasActions = actions && actions.length > 0;
    return (_jsxs("div", { className: b('', className), "data-qa": qa, children: [_jsxs("div", { className: b('left'), children: [toolIcon, _jsx(Text, { children: toolName }), content] }), _jsxs("div", { className: b('right'), children: [hasActions && (_jsx(ButtonGroup, { children: actions.map((action, index) => {
                            // Check if action is a ReactNode (not an object with properties)
                            if (!isActionConfig(action)) {
                                return _jsx(React.Fragment, { children: action }, index);
                            }
                            // TypeScript now knows that action is ActionConfig
                            return (_jsx(ActionButton, { tooltipTitle: action.label, view: action.view || 'flat-secondary', size: "s", onClick: action.onClick, children: action.icon }, index));
                        }) })), _jsx(ToolStatus, { status: status })] })] }));
}
//# sourceMappingURL=index.js.map
