) 
            overlay.remove();
        }
    
    function confirmRename(id) {
        const input = document.querySelector('#rename-input');
        const newName = input
            .value
            .trim();

        if (!newName) 
            return;
        
        const history = JSON.parse(localStorage.getItem('mindmap-history') || '[]');
        const mindmapIndex = history.findIndex(item => item.id === id);

        if (mindmapIndex !== -1) {
            history[mindmapIndex].topic = newName;
 