/*! @azure/msal-browser v5.0.1 2026-01-16 */
'use strict';
/*
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Licensed under the MIT License.
 */
/**
 * Returns all the accounts in the cache that match the optional filter. If no filter is provided, all accounts are returned.
 * @param accountFilter - (Optional) filter to narrow down the accounts returned
 * @returns Array of AccountInfo objects in cache
 */
function getAllAccounts(logger, browserStorage, isInBrowser, correlationId, accountFilter) {
    logger.verbose("1yd030", correlationId);
    return isInBrowser
        ? browserStorage.getAllAccounts(accountFilter, correlationId)
        : [];
}
/**
 * Returns the first account found in the cache that matches the account filter passed in.
 * @param accountFilter
 * @returns The first account found in the cache matching the provided filter or null if no account could be found.
 */
function getAccount(accountFilter, logger, browserStorage, correlationId) {
    logger.trace("0u7b90", correlationId);
    if (Object.keys(accountFilter).length === 0) {
        logger.warning("1kz0cu", correlationId);
        return null;
    }
    const account = browserStorage.getAccountInfoFilteredBy(accountFilter, correlationId);
    if (account) {
        logger.verbose("0btgll", correlationId);
        return account;
    }
    else {
        logger.verbose("0ltaj5", correlationId);
        return null;
    }
}
/**
 * Sets the account to use as the active account. If no account is passed to the acquireToken APIs, then MSAL will use this active account.
 * @param account
 */
function setActiveAccount(account, browserStorage, correlationId) {
    browserStorage.setActiveAccount(account, correlationId);
}
/**
 * Gets the currently active account
 */
function getActiveAccount(browserStorage, correlationId) {
    return browserStorage.getActiveAccount(correlationId);
}

export { getAccount, getActiveAccount, getAllAccounts, setActiveAccount };
//# sourceMappingURL=AccountManager.mjs.map
