import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
import { Box, Text } from "ink";
import { buildStatusNoticeRows, StatusNoticePanel } from "./StatusNoticePanel.js";
import { StatusBadge } from "./design/StatusBadge.js";
import { truncateCells } from "./design/textLayout.js";
export function StatusNotices(props) {
    const model = statusNoticesModel(props);
    if (model.count === 0)
        return null;
    const width = props.width ?? 80;
    return (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsxs(Box, { flexDirection: "row", children: [_jsxs(Text, { color: "gray", children: [model.title, " "] }), _jsx(StatusBadge, { label: `${model.count}`, tone: model.highestSeverity === "error" ? "error" : "warning" }), _jsxs(Text, { color: "gray", children: [" ", truncateCells(model.subtitle, Math.max(12, width - 24))] })] }), _jsx(StatusNoticePanel, { providerReady: props.providerReady, permissionProfile: props.permissionProfile, shellEnabled: props.shellEnabled, browserEnabled: props.browserEnabled, width: width })] }));
}
export function statusNoticesModel(input) {
    const rows = buildStatusNoticeRows(input);
    const highestSeverity = rows.some((row) => row.tone === "error")
        ? "error"
        : rows.length > 0
            ? "warning"
            : "ok";
    return {
        count: rows.length,
        title: "startup notices",
        subtitle: highestSeverity === "ok"
            ? "ready"
            : "review setup before spending DeepSeek tokens",
        highestSeverity,
    };
}
