(function () {
    const switcher = document.getElementById('kb-version-switcher');
    if (!switcher) {
        return;
    }

    switcher.addEventListener('change', function () {
        const selected = switcher.options[switcher.selectedIndex];
        if (selected && selected.dataset.url) {
            window.location.href = selected.dataset.url;
        }
    });
}());
