import { getCapabilities } from "@threadwell/tui";
const BASELINE_GLYPHS = {
    threadwell: "T",
    branch: "branch",
    check: "ok",
    warning: "warn",
    error: "err",
    info: "i",
    memory: "mem",
    continuity: "cont",
    model: "model",
    folder: "dir",
    thinking: "think",
    message: "msg",
    terminal: "term",
    diff: "diff",
    git: "git",
    plus: "+",
    minus: "-",
    untracked: "?",
    separator: "|",
    sectionSeparator: "-",
    bullet: "-",
    pointer: ">",
    ellipsis: "...",
    spinnerFrames: ["-", "\\", "|", "/"],
};
const ENHANCED_GLYPHS = {
    threadwell: "TS",
    branch: "git",
    check: "✓",
    warning: "!",
    error: "x",
    info: "i",
    memory: "mem",
    continuity: "cont",
    model: "model",
    folder: "dir",
    thinking: "think",
    message: "msg",
    terminal: "term",
    diff: "diff",
    git: "git",
    plus: "+",
    minus: "-",
    untracked: "?",
    separator: "›",
    sectionSeparator: "─",
    bullet: "•",
    pointer: "›",
    ellipsis: "…",
    spinnerFrames: ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"],
};
const NERD_GLYPHS = {
    threadwell: "󰛦",
    branch: "",
    check: "󰄬",
    warning: "",
    error: "󰅚",
    info: "",
    memory: "󰍛",
    continuity: "󰑓",
    model: "󰚩",
    folder: "󰉋",
    thinking: "󰧑",
    message: "󰍡",
    terminal: "",
    diff: "",
    git: "󰊢",
    plus: "",
    minus: "",
    untracked: "",
    separator: "",
    sectionSeparator: "─",
    bullet: "•",
    pointer: "❯",
    ellipsis: "…",
    spinnerFrames: ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"],
};
const BASELINE_BORDERS = {
    rounded: {
        topLeft: "+",
        topRight: "+",
        bottomLeft: "+",
        bottomRight: "+",
        horizontal: "-",
        vertical: "|",
    },
    plain: {
        topLeft: "+",
        topRight: "+",
        bottomLeft: "+",
        bottomRight: "+",
        horizontal: "-",
        vertical: "|",
    },
};
const ENHANCED_BORDERS = {
    rounded: {
        topLeft: "╭",
        topRight: "╮",
        bottomLeft: "╰",
        bottomRight: "╯",
        horizontal: "─",
        vertical: "│",
    },
    plain: {
        topLeft: "┌",
        topRight: "┐",
        bottomLeft: "└",
        bottomRight: "┘",
        horizontal: "─",
        vertical: "│",
    },
};
let currentVisualTokens = createVisualTokens("baseline", "safe");
export function resolveVisualProfile(setting = "auto", env = process.env, capabilities = getCapabilities()) {
    if (setting === "baseline")
        return "baseline";
    if (setting === "enhanced")
        return "enhanced";
    return shouldAutoEnhance(env, capabilities) ? "enhanced" : "baseline";
}
export function configureVisualProfile(setting = "auto", glyphSet = "safe") {
    currentVisualTokens = createVisualTokens(resolveVisualProfile(setting), glyphSet);
    return currentVisualTokens;
}
export function getVisualTokens() {
    return currentVisualTokens;
}
export function createVisualTokens(profile, glyphSet = "safe") {
    const enhanced = profile === "enhanced";
    return {
        profile,
        enhanced,
        glyphs: enhanced ? (glyphSet === "nerd" ? NERD_GLYPHS : ENHANCED_GLYPHS) : BASELINE_GLYPHS,
        borders: enhanced ? ENHANCED_BORDERS : BASELINE_BORDERS,
    };
}
function shouldAutoEnhance(env, capabilities) {
    const termProgram = env.TERM_PROGRAM?.toLowerCase() ?? "";
    const term = env.TERM?.toLowerCase() ?? "";
    const isKnownEnhancedTerminal = Boolean(env.WEZTERM_EXECUTABLE ||
        env.WEZTERM_PANE ||
        termProgram === "wezterm" ||
        env.KITTY_WINDOW_ID ||
        termProgram === "kitty" ||
        termProgram === "ghostty" ||
        term.includes("ghostty") ||
        env.GHOSTTY_RESOURCES_DIR ||
        env.ITERM_SESSION_ID ||
        termProgram === "iterm.app" ||
        termProgram === "alacritty" ||
        env.WT_SESSION);
    return isKnownEnhancedTerminal || capabilities.trueColor;
}
//# sourceMappingURL=visual-profile.js.map