/**
 * @license
 * Copyright 2025 Vybestack LLC
 * SPDX-License-Identifier: Apache-2.0
 */
import { lerp } from '../../utils/math.js';
const getMainAreaWidthInternal = (terminalWidth) => {
    if (terminalWidth <= 80) {
        return Math.round(0.98 * terminalWidth);
    }
    if (terminalWidth >= 132) {
        return Math.round(0.9 * terminalWidth);
    }
    // Linearly interpolate between 80 columns (98%) and 132 columns (90%).
    const t = (terminalWidth - 80) / (132 - 80);
    const percentage = lerp(98, 90, t);
    return Math.round(percentage * terminalWidth * 0.01);
};
export const calculateMainAreaWidth = (terminalWidth, settings) => {
    if (settings.merged.ui?.useFullWidth !== false) {
        if (settings.merged.ui?.useAlternateBuffer) {
            return terminalWidth - 1;
        }
        return terminalWidth;
    }
    return getMainAreaWidthInternal(terminalWidth);
};
//# sourceMappingURL=ui-sizing.js.map