import { getEnv } from '../env.js';
export async function adminGuard(c, next) {
    const userEmail = c.get('userEmail');
    if (!userEmail) {
        return c.json({ error: 'Authentication required' }, 401);
    }
    const adminEmails = getEnv().ADMIN_EMAILS.split(',').map(e => e.trim().toLowerCase()).filter(Boolean);
    if (adminEmails.length === 0) {
        return c.json({ error: 'No admin emails configured' }, 403);
    }
    if (!adminEmails.includes(userEmail.toLowerCase())) {
        return c.json({ error: 'Admin access required' }, 403);
    }
    await next();
}
//# sourceMappingURL=admin.js.map