const SECRET_KEY = /(api[_-]?key|token|secret|password|authorization|cookie|credential|refresh|access|reasoning[_-]?encrypted[_-]?content|encrypted[_-]?content)/i;
const SECRET_VALUE = /(sk-[a-zA-Z0-9_-]{16,}|Bearer\s+[a-zA-Z0-9._-]+|ghp_[a-zA-Z0-9_]+)/g;
export function sanitizeText(input) {
    return input.replace(SECRET_VALUE, "[REDACTED]");
}
export function sanitizeJson(input) {
    if (Array.isArray(input))
        return input.map((item) => sanitizeJson(item));
    if (typeof input === "string")
        return sanitizeText(input);
    if (typeof input !== "object" || input === null)
        return input;
    const output = {};
    for (const [key, value] of Object.entries(input)) {
        output[key] = SECRET_KEY.test(key) ? "[REDACTED]" : sanitizeJson(value);
    }
    return output;
}
//# sourceMappingURL=sanitize.js.map