/**
 * Words shown as the green "AI" badge inside subtitles.
 *
 * The check used to be `word.toUpperCase() === "AI"`, which only knows English:
 * Spanish says "IA" ("...ROBÓTICA CON IA"), French elides it ("AVEC L'IA") and
 * German says "KI", so on a translated page the badge never appeared. A
 * leading elision ("L'", "D'") stays outside the badge as plain text. English
 * behaves exactly as before: only the whole word "AI" matches.
 */
const AI_WORD = /^(.*?['’])?(AI|IA|KI)$/i;

export function aiBadgeParts(word: string): { prefix: string; badge: string } | null {
  const match = word.match(AI_WORD);
  return match ? { prefix: match[1] || "", badge: match[2] } : null;
}
