// Sidebar nav collapse state — persisted in the `mxgateway_nav` cookie so it // survives full page reloads and reconnects. Invoked from MainLayout.razor via // JS interop (window.navState.get / .set). Pattern lifted from ScadaLink // CentralUI's wwwroot/js/nav-state.js. window.navState = { // Returns the raw cookie value (comma-separated expanded section ids), or // an empty string when the cookie is absent. get: function () { const match = document.cookie.match(/(?:^|;\s*)mxgateway_nav=([^;]*)/); return match ? decodeURIComponent(match[1]) : ""; }, // Writes the cookie with a one-year lifetime. SameSite=Lax; not HttpOnly // (JS must write it) and not sensitive. set: function (value) { const oneYearSeconds = 60 * 60 * 24 * 365; document.cookie = "mxgateway_nav=" + encodeURIComponent(value) + ";path=/;max-age=" + oneYearSeconds + ";samesite=lax"; } };