export function normalizeRoleName(displayName: string): string { const key = displayName .trim() // remove leading/trailing whitespace .replace(/^[\W_]+|[\W_]+$/g, '') // remove leading/trailing non-alphanumeric characters .replace(/[\W_]+/g, '_'); // replace non-alphanumeric characters with underscores return key.toLowerCase(); }