"use strict";
/**
 * CLI Output Utilities
 * Provides colorized, formatted output for the CLI
 */
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.success = success;
exports.error = error;
exports.warning = warning;
exports.info = info;
exports.header = header;
exports.subheader = subheader;
exports.code = code;
exports.path = path;
exports.bold = bold;
exports.dim = dim;
exports.spinner = spinner;
exports.blank = blank;
exports.rule = rule;
exports.errorWithSuggestions = errorWithSuggestions;
exports.list = list;
exports.table = table;
exports.banner = banner;
exports.progress = progress;
const chalk_1 = __importDefault(require("chalk"));
const ora_1 = __importDefault(require("ora"));
/**
 * Success message (green checkmark)
 */
function success(message) {
    console.log(chalk_1.default.green('✓') + ' ' + message);
}
/**
 * Error message (red X)
 */
function error(message) {
    console.log(chalk_1.default.red('✗') + ' ' + chalk_1.default.red(message));
}
/**
 * Warning message (yellow warning sign)
 */
function warning(message) {
    console.log(chalk_1.default.yellow('⚠') + ' ' + chalk_1.default.yellow(message));
}
/**
 * Info message (blue info icon)
 */
function info(message) {
    console.log(chalk_1.default.blue('ℹ') + ' ' + message);
}
/**
 * Section header
 */
function header(message) {
    console.log('\n' + chalk_1.default.bold.cyan(message));
}
/**
 * Subheader
 */
function subheader(message) {
    console.log(chalk_1.default.cyan(message));
}
/**
 * Command/code snippet
 */
function code(text) {
    return chalk_1.default.gray('`') + chalk_1.default.cyan(text) + chalk_1.default.gray('`');
}
/**
 * File path
 */
function path(filePath) {
    return chalk_1.default.gray(filePath);
}
/**
 * Emphasized text
 */
function bold(text) {
    return chalk_1.default.bold(text);
}
/**
 * Dimmed/muted text
 */
function dim(text) {
    return chalk_1.default.gray(text);
}
/**
 * Create a spinner for long-running operations
 */
function spinner(text) {
    return (0, ora_1.default)({
        text,
        color: 'cyan',
        spinner: 'dots',
    });
}
/**
 * Print a blank line
 */
function blank() {
    console.log('');
}
/**
 * Print a horizontal rule
 */
function rule() {
    console.log(chalk_1.default.gray('─'.repeat(60)));
}
/**
 * Format an error with suggestions
 */
function errorWithSuggestions(errorMessage, suggestions) {
    error(errorMessage);
    blank();
    console.log(chalk_1.default.bold('Suggestions:'));
    for (const suggestion of suggestions) {
        console.log('  ' + chalk_1.default.yellow('→') + ' ' + suggestion);
    }
    blank();
}
/**
 * Print a list of items
 */
function list(items, color = 'blue') {
    const colorFn = {
        green: chalk_1.default.green,
        yellow: chalk_1.default.yellow,
        blue: chalk_1.default.blue,
        gray: chalk_1.default.gray,
    }[color];
    for (const item of items) {
        console.log('  ' + colorFn('•') + ' ' + item);
    }
}
/**
 * Print a table
 */
function table(rows) {
    const maxKeyLength = Math.max(...rows.map(([key]) => key.length));
    for (const [key, value] of rows) {
        const paddedKey = key.padEnd(maxKeyLength);
        console.log('  ' + chalk_1.default.cyan(paddedKey) + '  ' + value);
    }
}
/**
 * Banner with box
 */
function banner(title, subtitle) {
    const width = Math.max(title.length, subtitle?.length || 0) + 4;
    const topLine = '┌' + '─'.repeat(width) + '┐';
    const bottomLine = '└' + '─'.repeat(width) + '┘';
    const titleLine = '│ ' + title.padEnd(width - 1) + '│';
    const subtitleLine = subtitle ? '│ ' + subtitle.padEnd(width - 1) + '│' : null;
    console.log(chalk_1.default.cyan(topLine));
    console.log(chalk_1.default.cyan(titleLine));
    if (subtitleLine) {
        console.log(chalk_1.default.gray(subtitleLine));
    }
    console.log(chalk_1.default.cyan(bottomLine));
    blank();
}
/**
 * Progress indicator
 */
function progress(current, total, label) {
    const percentage = Math.round((current / total) * 100);
    const barWidth = 30;
    const filled = Math.round((current / total) * barWidth);
    const empty = barWidth - filled;
    const bar = chalk_1.default.green('█'.repeat(filled)) + chalk_1.default.gray('░'.repeat(empty));
    const stats = chalk_1.default.gray(`${current}/${total}`) + ' ' + chalk_1.default.cyan(`${percentage}%`);
    process.stdout.write(`\r  ${bar} ${stats} ${label}`);
    if (current === total) {
        process.stdout.write('\n');
    }
}
//# sourceMappingURL=output.js.map