(function () { 'use strict'; const ROUTES = { '/': 's-core', '/channels': 's-channels', '/categories': 's-categories', '/gmail': 's-gmail', '/behavior': 's-behavior', '/threads': 's-threads', '/pins': 's-pins', '/notifications': 's-notifications', '/logging': 's-logging', '/automation': 's-automation', '/appearance': 's-appearance', '/staff': 's-staff', '/advanced': 's-advanced' }; function navigate(path, updateHistory = true) { const sectionId = ROUTES[path] || ROUTES['/']; const normalizedPath = ROUTES[path] ? path : '/'; if (updateHistory) history.pushState({}, '', normalizedPath); document.querySelectorAll('.section').forEach(section => { section.classList.toggle('hidden', section.id !== sectionId); }); document.querySelectorAll('.sidebar a').forEach(link => { link.classList.toggle('active', link.getAttribute('href') === normalizedPath); }); } function setupSidebarRouting() { const sidebar = document.querySelector('.sidebar'); if (!sidebar) return; sidebar.addEventListener('click', e => { const a = e.target.closest('a'); if (!a) return; e.preventDefault(); navigate(a.getAttribute('href')); if (Util.isMobileViewport()) Util.setSidebarOpen(false); }); window.addEventListener('popstate', () => { navigate(location.pathname, false); }); } window.Router = { ROUTES, navigate, setupSidebarRouting }; })();