import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { CircleDot } from "lucide-react";
import { memo } from "react";
import { Collapsible } from "../_shared/Collapsible";
import { ToolCall } from "./ToolCallPrimitives";
/**
 * Timeline-shaped composition of the compound {@link ToolCall} parts — the
 * molded `StatusStep` + `TimelineItem` (dot + connector). The running shimmer
 * is `(streaming|executing) && isLast`, derived from the lifecycle status via
 * the parts' `data-spin`, not a separate `isThinking` flag. `ToolCall.Root` is
 * the single `.openui-tool-call` container, so we compose *inside* it.
 *
 * @category Components
 */
export const TimelineToolCard = memo(function TimelineToolCard({ activity, isLast, isRunning = true, }) {
    return (_jsxs(ToolCall.Root, { activity: activity, isLast: isLast, running: isRunning, children: [_jsxs("div", { className: "openui-tool-call__title-row", children: [_jsx(ToolCall.StatusIcon, { render: (_state, props) => (_jsx("span", { className: `openui-tool-call__icon-wrapper${props["data-spin"] ? " openui-tool-call__icon--blinking" : ""}`, "data-status": props["data-status"], children: _jsx(CircleDot, { size: 14, className: "openui-tool-call__icon" }) })) }), _jsx(ToolCall.StatusText, { render: (state, props) => (_jsx("span", { 
                            // Announce tool-call status transitions (Calling → Running →
                            // Called/failed) to assistive tech; only changes are spoken, so
                            // settled/historical cards stay quiet.
                            role: "status", "aria-live": "polite", className: `openui-tool-call__name${(state.status === "streaming" || state.status === "executing") &&
                                isLast &&
                                isRunning
                                ? " openui-tool-call__name--shimmer"
                                : ""}`, children: props["children"] })) })] }), _jsx("div", { className: `openui-tool-call__connector${isLast ? " openui-tool-call__connector--last" : ""}`, children: _jsxs("div", { className: "openui-tool-call__args-block", children: [_jsx(Collapsible, { label: "Tool Request", labelLoading: `Sending request to ${activity.toolName}...`, loading: isRunning && isLast && activity.status === "streaming", children: _jsx(ToolCall.Parameters, { render: (_s, p) => (_jsx("pre", { className: "openui-tool-code-block__code", children: p["children"] })) }) }), _jsx(ToolCall.Result, { render: (s, p) => (_jsx(Collapsible, { label: "Tool Response", labelLoading: `Awaiting response from ${activity.toolName}...`, loading: isRunning && isLast && activity.status === "executing", children: _jsx("pre", { className: `openui-tool-code-block__code${s.isError ? " openui-tool-code-block__code--error" : ""}`, children: p["children"] }) })) })] }) })] }));
});
//# sourceMappingURL=TimelineToolCard.js.map