// Names typed by users (functions, variables, params) may contain spaces and // special characters. When a name is emitted into generated code it is // URL-encoded, then each `%` is escaped as `\u0025` so the percent sign is // representable in the output text. E.g. "my variable" -> "my\u002520variable". export function encodeName(name: string): string { return encodeURIComponent(String(name ?? '')).replace(/%/g, '\\u0025'); } // Encode a comma-separated list of names (used for legacy param fields). export function encodeNameList(list: string): string { return String(list ?? '') .split(',') .map((p) => p.trim()) .filter((p) => p.length > 0) .map(encodeName) .join(', '); }