import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useEffect, useState } from 'react';
import { Box, Text } from 'ink';
import { ClientSharedSessionActivityService, } from '../../client-shared/services/session-activities/index.js';
export function PromptStatusPanel({ currentActivity, latestActivity }) {
    const [now, setNow] = useState(() => new Date());
    useEffect(() => {
        if (!currentActivity) {
            return undefined;
        }
        const timer = setInterval(() => setNow(new Date()), 1000);
        return () => clearInterval(timer);
    }, [currentActivity]);
    if (!currentActivity && !latestActivity) {
        return null;
    }
    return (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [latestActivity ? _jsx(Text, { color: latestActivity.color, children: latestActivity.text }) : null, currentActivity ? (_jsx(Text, { color: currentActivity.tone === 'warning' ? 'yellow' : 'cyan', children: formatCurrentActivity(currentActivity, now) })) : null] }));
}
function formatCurrentActivity(activity, now) {
    const elapsed = ClientSharedSessionActivityService.formatElapsed(activity.startedAt, now);
    const detail = activity.detail ? ` · ${activity.detail}` : '';
    return activity.label === 'Thinking'
        ? `Thinking... ${elapsed}`
        : `${activity.label}${detail} · ${elapsed}`;
}
//# sourceMappingURL=PromptStatusPanel.js.map