import { LANGUAGE_DISPLAY_NAMES } from "../../core/language-detector.js";
import { BLACK_CIRCLE } from "../constants/figures.js";
import { formatDuration } from "../duration-format.js";
import { UPDATE_NOTICE_TEXT } from "../app-items.js";
export function normalizeTranscriptStatusText(text) {
    return text.replace(/\\n/g, "\n").replace(/^\n+|\n+$/g, "");
}
export function presentStylePack(item) {
    return {
        headerLabel: item.added.length > 1 ? "STYLE PACKS ACTIVE" : "STYLE PACK ACTIVE",
        names: item.added.map((id) => LANGUAGE_DISPLAY_NAMES[id] ?? id).join(", "),
    };
}
export function presentError(item) {
    return {
        glyph: "✗ ",
        headline: item.headline,
        message: item.message && item.message !== item.headline ? item.message : undefined,
        guidance: `→ ${item.guidance}`,
    };
}
export function presentInfo(item) {
    return { glyph: "○ ", text: normalizeTranscriptStatusText(item.text), bold: false, muted: true };
}
export function presentTask(item) {
    return { glyph: "▸ ", label: "Task: ", text: item.title, bold: true };
}
export function presentPlanTransition(item) {
    return { glyph: `${BLACK_CIRCLE} `, text: normalizeTranscriptStatusText(item.text), bold: true };
}
export function presentModelTransition(item) {
    return { glyph: "▸ ", label: "Switched to ", text: item.modelName, bold: true };
}
export function presentThemeTransition(item) {
    return { glyph: "◐ ", label: "Theme switched to ", text: item.themeName, bold: true };
}
export function presentPlanEvent(item) {
    const labels = {
        approved: "Plan approved",
        rejected: "Plan rejected",
        dismissed: "Plan dismissed",
    };
    return {
        glyph: "○ ",
        text: labels[item.event],
        detail: item.detail ? ` — "${item.detail}"` : undefined,
        bold: true,
    };
}
export function presentStopped(item) {
    return { glyph: "⊘ ", text: normalizeTranscriptStatusText(item.text), bold: true };
}
export function presentQueued(item) {
    const imageSuffix = item.imageCount
        ? ` (+${item.imageCount} image${item.imageCount > 1 ? "s" : ""})`
        : "";
    const videoSuffix = item.videoCount
        ? ` (+${item.videoCount} video${item.videoCount > 1 ? "s" : ""})`
        : "";
    return {
        glyph: "• ",
        label: "Queued: ",
        text: item.text || "(empty)",
        suffix: `${imageSuffix}${videoSuffix}`,
    };
}
export function presentUpdateNotice(_item) {
    return { text: UPDATE_NOTICE_TEXT };
}
/** Max chars shown for a step-done description before ellipsis. Kept short so
 *  the "✓ Step N done — …" status line stays on one terminal row. */
const STEP_DONE_DESC_MAX = 48;
export function presentStepDone(item) {
    let description;
    if (item.description) {
        const trimmed = item.description.trim();
        description = ` — ${trimmed.length > STEP_DONE_DESC_MAX ? `${trimmed.slice(0, STEP_DONE_DESC_MAX - 1)}…` : trimmed}`;
    }
    return {
        glyph: "✓ ",
        text: `Step ${item.stepNum} done`,
        description,
    };
}
export function presentDuration(item) {
    return { glyph: "✻ ", text: `${item.verb} ${formatDuration(item.durationMs)}` };
}
//# sourceMappingURL=presentation.js.map