/* PAPERS VIEW — the real corpus from /papers, with per-paper figure counts
from the figures index and a detail drawer. Only fields the API actually
serves are shown (no fabricated authors/venue/citations). */
function PaperCard({ p, figCount, onOpen }) {
return (
);
}
/* First caption line, with internal [chunk_id] placeholders hidden — the
Figures gallery cleans these the same way. */
function drawerCaption(raw) {
const first = String(raw || "").split("\n")[0].trim();
return !first || /^\[[^\]]+\]$/.test(first) ? "No caption captured" : first;
}
function PaperDrawer({ p, figs, onClose }) {
useEffect(() => {
if (!p) return;
const onEsc = (e) => { if (e.key === "Escape") onClose(); };
document.addEventListener("keydown", onEsc);
return () => document.removeEventListener("keydown", onEsc);
}, [p, onClose]);
if (!p) return null;
return (