);
}
// Render a folder and everything beneath it (subfolders first, then panels).
// Folders with no in-scope descendant panels are hidden under the filter.
function renderFolder(folder: Folder) {
if (!folderHasVisible(folder.id)) return null;
const children = folders.filter(f => f.parent === folder.id);
const panels = visiblePanelsIn(folder.id);
const open = expanded[folder.id] !== false; // default expanded
const canDrop = folder.perm === 'write';
return (