import type { GameUI } from './types'; /** Game screens are code-split: each is downloaded only when that game is opened (docs/09 ยง6). */ export const GAME_UI: Record Promise<{ default: GameUI }>> = { omok: () => import('./omok'), othello: () => import('./othello'), chess: () => import('./chess'), janggi: () => import('./janggi'), baduk: () => import('./baduk'), seotda: () => import('./seotda'), poker: () => import('./poker'), yacht: () => import('./yacht'), yut: () => import('./yut'), 'one-card': () => import('./one-card'), rummikub: () => import('./rummikub'), 'davinci-code': () => import('./davinci-code'), mahjong: () => import('./mahjong'), }; const cache = new Map(); export async function loadGameUI(id: string): Promise { const hit = cache.get(id); if (hit) return hit; const loader = GAME_UI[id]; if (!loader) return null; const mod = (await loader()).default; cache.set(id, mod); return mod; } export function cachedGameUI(id: string): GameUI | null { return cache.get(id) ?? null; }