           localStorage.setItem('mindmap-history', JSON.stringify(history));
            loadMindmaps();
        }

        closeRenameDialog();
    }

    function deleteMindmap(event, id) {
        event.stopPropagation();
        const deletePopup = document.createElement('div');
        deletePopup.className = 'delete-popup';
        deletePopup.innerHTML = `
            <div class="delete-popup-content">
                <h3>Delete Mind Map</h3>
                <p>Are you sure you want to delete this mi