"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.sanitizeAuthMessage = sanitizeAuthMessage;
const branding_1 = require("../core/branding");
const catalog_1 = require("../i18n/catalog");
const MANAGED_AUTH_PATH_PATTERN = new RegExp(`(?:[A-Za-z]:)?/[^\\s,;)]*?/${escapeRegExp(branding_1.REPO_HOME_DIRECTORY_NAME)}/auth-profiles/[^\\s,;)]+`, "g");
function sanitizeAuthMessage(message, locale = catalog_1.DEFAULT_APP_LOCALE) {
    return message
        .replaceAll(/\b(?:Codex|Claude) \/ [^,.;)]+/g, "sign-in")
        .replaceAll(MANAGED_AUTH_PATH_PATTERN, (0, catalog_1.translate)(locale, "auth.sanitized.managedData"))
        .replaceAll(/\bauth_[A-Za-z0-9]+\b/gi, "sign-in");
}
function escapeRegExp(value) {
    return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
}
