export function resolvePackInstallLocation(project, user) {
    if (project && user) {
        return 'both';
    }
    if (project) {
        return 'project';
    }
    if (user) {
        return 'user';
    }
    return 'not-installed';
}
export function buildPackInstallStateMap(packs, tools) {
    const state = Object.fromEntries(packs.map((pack) => [
        pack,
        {
            project: false,
            user: false,
            location: 'not-installed',
        },
    ]));
    for (const tool of tools) {
        if (tool.pack === 'custom' || !(tool.pack in state)) {
            continue;
        }
        const packState = state[tool.pack];
        if (tool.scope === 'project') {
            packState.project = true;
        }
        else {
            packState.user = true;
        }
        packState.location = resolvePackInstallLocation(packState.project, packState.user);
    }
    return state;
}
