import { Fragment as _Fragment, jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
import { useLayoutEffect, useRef, useState } from "react";
import { cn } from "../../../../lib/utils";
import { AgentParentLink } from "./AgentParentLink";
import { AgentPromptComposer, } from "./AgentPromptComposer";
export function AgentTerminalFullLayout({ className, parentAgentId, simpleMode, isInitialGreetingMode, onBackToParent, readOnlyAccessNotice, upperContent, inlineDialog, aboveComposer, promptComposerProps, promptControls, attachmentsContent, dropHandlers, showPromptComposer = true, }) {
    const previousInitialGreetingModeRef = useRef(isInitialGreetingMode);
    const [isGreetingHeightAnimating, setIsGreetingHeightAnimating] = useState(false);
    useLayoutEffect(() => {
        const wasInitialGreetingMode = previousInitialGreetingModeRef.current;
        previousInitialGreetingModeRef.current = isInitialGreetingMode;
        if (!wasInitialGreetingMode || isInitialGreetingMode) {
            return;
        }
        setIsGreetingHeightAnimating(true);
        const timeoutId = window.setTimeout(() => setIsGreetingHeightAnimating(false), 560);
        return () => window.clearTimeout(timeoutId);
    }, [isInitialGreetingMode]);
    const keepGreetingStackPosition = isInitialGreetingMode || isGreetingHeightAnimating;
    const content = (_jsxs(_Fragment, { children: [upperContent, inlineDialog] }));
    const promptComposer = (_jsx(AgentPromptComposer, { ...promptComposerProps, reserveBottomControlsSpace: !!promptControls, attachmentsContent: attachmentsContent, dropHandlers: dropHandlers, className: cn("shrink-0", simpleMode ? "pb-10" : undefined, !aboveComposer && keepGreetingStackPosition ? "mt-6" : undefined), surface: aboveComposer ? "project" : "default", children: aboveComposer ? null : promptControls }));
    return (_jsxs("div", { "data-agent-terminal-root": "true", className: cn("mx-auto flex h-full min-h-0 w-full max-w-[750px] min-w-0 flex-col", keepGreetingStackPosition ? "justify-center" : undefined, className), children: [_jsx(AgentParentLink, { parentAgentId: parentAgentId, simpleMode: simpleMode, onBack: onBackToParent }), readOnlyAccessNotice, content, !showPromptComposer ? null : aboveComposer ? (_jsxs(_Fragment, { children: [_jsxs("div", { className: cn("border-border-default mx-3 shrink-0 overflow-hidden rounded-[16px] border bg-white sm:mx-4", keepGreetingStackPosition ? "mt-6" : undefined), children: [aboveComposer, promptComposer] }), _jsx("div", { className: "shrink-0 px-4 pb-2", children: promptControls })] })) : (promptComposer)] }));
}
//# sourceMappingURL=AgentTerminalFullLayout.js.map