"use strict";
const node_path_1 = require("node:path");
const ENV_1 = require("./ENV");
const WIN32_1 = require("./WIN32");
// Vlt cache directory path.
// Vlt is a next-generation JavaScript package manager created by npm veterans.
//
// Default locations follow XDG base directory specifications:
// - macOS: ~/Library/Caches/vlt
// - Linux: ~/.cache/vlt (or $XDG_CACHE_HOME/vlt if set)
// - Windows: %LOCALAPPDATA%/vlt/Cache
//
// Can be overridden by:
// - --cache flag when running vlt commands
// - cache setting in vlt.json configuration file
//
// Documentation: https://docs.vlt.sh/cli/configuring
function getVltCachePath() {
    // Note: vlt doesn't document a specific environment variable for cache override.
    // The cache location is configured via --cache flag or vlt.json config file.
    if (WIN32_1) {
        // On Windows, use LOCALAPPDATA following XDG pattern.
        return ENV_1.LOCALAPPDATA ? node_path_1.join(ENV_1.LOCALAPPDATA, 'vlt', 'Cache') : '';
    }
    // On macOS, use Library/Caches.
    if (process.platform === 'darwin' && ENV_1.HOME) {
        return node_path_1.join(ENV_1.HOME, 'Library', 'Caches', 'vlt');
    }
    // On Linux/Unix, follow XDG Base Directory specification.
    const xdgCacheHome = process.env['XDG_CACHE_HOME'];
    if (xdgCacheHome) {
        return node_path_1.join(xdgCacheHome, 'vlt');
    }
    // Linux/Unix default location.
    return ENV_1.HOME ? node_path_1.join(ENV_1.HOME, '.cache', 'vlt') : '';
}
module.exports = getVltCachePath();
