from __future__ import annotations GITHUB_REACTION_CONTENT_MAP: dict[str, str] = { "+1": "+1", "👍": "+1", "thumbs_up": "+1", "-1": "-1", "👎": "-1", "thumbs_down": "-1", "laugh": "laugh", "😄": "laugh", "confused": "confused", "😕": "confused", "heart": "heart", "❤️": "heart", "hooray": "hooray", "🎉": "hooray", "rocket": "rocket", "🚀": "rocket", "eyes": "eyes", "👀": "eyes", } SUPPORTED_REACTIONS = frozenset({ "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", "eyes", }) def normalize_reaction_content(emoji: str) -> str: stripped = emoji.strip() if stripped in SUPPORTED_REACTIONS: return stripped return GITHUB_REACTION_CONTENT_MAP.get(stripped.lower(), "heart") def is_supported(emoji: str) -> bool: return normalize_reaction_content(emoji) in SUPPORTED_REACTIONS