import { truncateToWidth, visibleWidth } from "@threadwell/tui";
import { theme } from "../theme/theme.js";
export class CompactLine {
    text;
    constructor(text) {
        this.text = text;
    }
    invalidate() {
        // No cached state.
    }
    render(width) {
        if (width <= 0)
            return [];
        const prefix = " ";
        const available = Math.max(1, width - visibleWidth(prefix));
        const content = truncateToWidth(this.text, available, "");
        const fillWidth = Math.max(0, available - visibleWidth(content));
        return [
            `${prefix}${content}${fillWidth > 0 ? theme.fg("dim", ` ${"─".repeat(Math.max(0, fillWidth - 1))}`) : ""}`,
        ];
    }
}
//# sourceMappingURL=compact-line.js.map