import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import React from "react";
import { useTerminalSize } from "../hooks/useTerminalSize.js";
import { getLiveAreaClampRows } from "../live-area-height.js";
import { ChatLiveArea } from "./ChatLayout.js";
import { StreamingArea } from "./StreamingArea.js";
export function ChatLivePane({ liveItems, renderItem, isRunning, visibleStreamingText, streamingThinking, thinkingMs, reserveStreamingSpacing, renderMarkdown, measuredLiveAreaRows, assistantMarginTop, streamingContinuation, }) {
    const { columns } = useTerminalSize();
    // Bound the WHOLE live area, not just each item: individual assistant blocks
    // truncate to the budget, but multiple stacked blocks (accumulated turns,
    // pinned text + streaming) can still sum past the terminal height. When that
    // happens, clamp the area so Ink's rendered frame stays below the terminal
    // height and never trips its fullscreen redraw (the "jump to top").
    const clampRows = getLiveAreaClampRows({
        liveItems,
        streamingText: visibleStreamingText,
        columns,
        liveAreaBudget: measuredLiveAreaRows,
    });
    return (_jsxs(ChatLiveArea, { clampRows: clampRows, children: [liveItems.map((item, index, items) => (_jsx(React.Fragment, { children: renderItem(item, index, items) }, item.id))), _jsx(StreamingArea, { isRunning: isRunning, streamingText: visibleStreamingText, streamingThinking: streamingThinking, thinkingMs: thinkingMs, reserveSpacing: reserveStreamingSpacing, renderMarkdown: renderMarkdown, availableTerminalHeight: measuredLiveAreaRows, assistantMarginTop: assistantMarginTop, continuation: streamingContinuation })] }));
}
//# sourceMappingURL=ChatLivePane.js.map