import { Container, Spacer, Text } from "@dotkaio/avis-tui";
import { theme } from "../theme/theme.js";
/**
 * Visual separator rendered between sessions when a new session starts
 * without clearing the chat container. Shows a horizontal rule with a label.
 */
export class SessionSeparatorComponent extends Container {
    constructor(label) {
        super();
        this.addChild(new Spacer(1));
        this.addChild(new SessionSeparatorLine(label ?? "new session"));
        this.addChild(new Spacer(1));
    }
}
class SessionSeparatorLine extends Text {
    constructor(label) {
        super("", 0, 0);
        this.label = label;
    }
    render(width) {
        const tag = ` ${this.label} `;
        const remaining = Math.max(0, width - tag.length);
        const left = Math.floor(remaining / 2);
        const right = remaining - left;
        const line = theme.fg("borderMuted", "─".repeat(left)) + theme.fg("dim", tag) + theme.fg("borderMuted", "─".repeat(right));
        return [line];
    }
}
//# sourceMappingURL=session-separator.js.map