export const LEGACY_ANTHROPIC_ACCOUNT_KEY = "anthropic:legacy-default";
export const ENV_ANTHROPIC_ACCOUNT_KEY = "anthropic:env";
export function normalizeAnthropicAccountKey(value) {
    const trimmed = value.trim().toLowerCase();
    return trimmed.startsWith("anthropic:") ? trimmed : `anthropic:${trimmed}`;
}
export function anthropicAccountKeysEqual(left, right) {
    return (normalizeAnthropicAccountKey(left) === normalizeAnthropicAccountKey(right));
}
export function createAccountAllowlist(values) {
    if (values === undefined) {
        return undefined;
    }
    return new Set(values
        .map(normalizeAnthropicAccountKey)
        .filter((value) => value !== "anthropic:"));
}
export function isAccountAllowed(accountKey, allowlist) {
    return (allowlist === undefined ||
        allowlist.has(normalizeAnthropicAccountKey(accountKey)));
}
export function shouldLoadFallbackCredential(storedAnthropicAccountCount, fallbackAccountKey, allowlist) {
    return (storedAnthropicAccountCount === 0 &&
        isAccountAllowed(fallbackAccountKey, allowlist));
}
