// Players modal — list of all participants with status const { useState: usePMState } = React; function PlayersModal({ tournament, onClose }) { if (!tournament) return null; const champ = getChampion(tournament.bracket); function statusFor(f) { if (champ && champ.name === f.name && champ.seed === f.seed) return { label: 'Campeão', tone: 'champ' }; for (const r of tournament.bracket.rounds) { for (const m of r.matches) { if (m.status === 'done' && m.winner) { const inMatch = (m.a?.name === f.name && m.a?.seed === f.seed) || (m.b?.name === f.name && m.b?.seed === f.seed); const isWinner = m.winner.name === f.name && m.winner.seed === f.seed; if (inMatch && !isWinner) return { label: 'Eliminado', tone: 'out' }; } } } for (const r of tournament.bracket.rounds) { for (const m of r.matches) { const inMatch = (m.a?.name === f.name && m.a?.seed === f.seed) || (m.b?.name === f.name && m.b?.seed === f.seed); if (!inMatch) continue; if (m.status === 'ready') return { label: r.name, tone: 'live' }; if (m.status === 'waiting') return { label: r.name, tone: 'wait' }; } } return { label: '—', tone: 'idle' }; } return (