      target: '#invite-modal',
        swap: 'innerHTML'
    });
}

function closeInviteModal() {
    document.getElementById('invite-modal').innerHTML = '';
}

// Close modal on escape key
document.addEventListener('keydown', function(e) {
    if (e.key === 'Escape') {
        closeInviteModal();
    }
});

    function tableCopyLink(invite_code) {
        var url = window.location.origin;
        var icon = document.getElementById("icon_" + invite_code);

        // Copy the invite link using the fallback