import { useEffect, useState, type ReactNode } from "react"; import { Loader2, X } from "lucide-react"; import { Button } from "@/components/ui/button"; import { Card } from "@/components/ui/card"; import { cn } from "@/lib/utils"; import { useT, type Key } from "@/i18n"; import { asUiError, api } from "@/lib/api"; import { realmRegistry, useRegistryStatus } from "@/lib/registry"; import { asControlError, control, type ControlStatus } from "@/lib/control"; import { isListed, stateTone, type PublishRealm } from "@/lib/publishRealms"; const LANGUAGES = ["en", "ru", "de", "fr", "es", "zh", "pt", "pl", "uk"]; function Modal({ title, onClose, children }: { title: string; onClose: () => void; children: ReactNode }) { const t = useT(); useEffect(() => { const onKey = (e: KeyboardEvent) => { if (e.key === "Escape") onClose(); }; window.addEventListener("keydown", onKey); return () => window.removeEventListener("keydown", onKey); }, [onClose]); return (