(()=>{"use strict";function e(e){if("1"===e.dataset.mvReady)return;e.dataset.mvReady="1";const t=e.dataset.mvMode,n="1"===e.dataset.mvSingle,r="flyout"===t;function a(t,n){const a=t.querySelector(":scope > [data-mv-toggle]"),o=a&&a.getAttribute("aria-controls"),i=o?e.querySelector(`#${CSS.escape(o)}`):null;a&&i&&(a.setAttribute("aria-expanded",n?"true":"false"),i.hidden=!n,t.classList.toggle("is-expanded",n),n&&r?function(e){e.style.marginBlockStart="";const t=e.getBoundingClientRect().bottom-(window.innerHeight-16);t>0&&(e.style.marginBlockStart=`-${Math.round(t)}px`)}(i):n||(i.style.marginBlockStart=""))}e.querySelectorAll("[data-mv-toggle]").forEach(e=>{const t=e.closest(".menuverse-vertical__item");e.addEventListener("click",()=>{const r="true"===e.getAttribute("aria-expanded");!r&&n&&function(e){const t=e.parentElement;t&&t.querySelectorAll(":scope > .menuverse-vertical__item.is-expanded").forEach(t=>{t!==e&&a(t,!1)})}(t),a(t,!r)}),r&&(t.addEventListener("mouseenter",()=>a(t,!0)),t.addEventListener("mouseleave",()=>a(t,!1)))}),r&&(e.addEventListener("keydown",t=>{if("Escape"!==t.key)return;const n=e.querySelector(".menuverse-vertical__item.is-expanded");if(!n)return;t.preventDefault(),a(n,!1);const r=n.querySelector(":scope > [data-mv-toggle]");r&&r.focus()}),e.addEventListener("focusout",t=>{e.contains(t.relatedTarget)||e.querySelectorAll(".menuverse-vertical__item.is-expanded").forEach(e=>a(e,!1))}))}function t(){document.querySelectorAll("[data-menuverse-vertical]").forEach(e)}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",t):t(),window.menuverse=window.menuverse||{},window.menuverse.initVerticalMenu=t})();