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'), gostop: () => import('./gostop'), bang: () => import('./bang'), 'halli-galli': () => import('./halli-galli'), marble: () => import('./marble'), dalmuti: () => import('./dalmuti'), splendor: () => import('./splendor'), quoridor: () => import('./quoridor'), 'las-vegas': () => import('./las-vegas'), 'cockroach-poker': () => import('./cockroach-poker'), 'ninety-nine': () => import('./ninety-nine'), 'connect-four': () => import('./connect-four'), 'old-maid': () => import('./old-maid'), dobble: () => import('./dobble'), catchmind: () => import('./catchmind'), mafia: () => import('./mafia'), apple: () => import('./apple'), clue: () => import('./clue'), uno: () => import('./uno'), liar: () => import('./liar'), }; 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; }