!function(){"use strict";function e(){document.querySelectorAll(".cryzel-responsive-nav-menu").forEach(t)}function t(e){const t=e.querySelector(".menu-title"),i=e.querySelector(".menu-toggle"),a=e.querySelector(".menu-items");if(!t||!a)return;const s="true"===e.dataset.enableAccordion,r=1023,o=(e.dataset.togglePosition,e.dataset.desktopDirection||"horizontal"),d=e.dataset.tabletDirection||"vertical",u=e.dataset.mobileDirection||"vertical",c=a.id||`menu-${Math.random().toString(36).substr(2,9)}`;a.id=c,t.setAttribute("aria-expanded","false"),t.setAttribute("aria-controls",c),a.setAttribute("aria-hidden","true"),t.setAttribute("role","button"),t.setAttribute("tabindex","0"),t.addEventListener("keydown",function(e){"Enter"===e.key||" "===e.key?(e.preventDefault(),p()&&b()):"Escape"===e.key&&v()}),t.addEventListener("click",function(e){e.preventDefault(),p()&&b()});let l,m=0;function p(){return s&&window.innerWidth<=r}function f(){(function(){const t=function(){const e=window.innerWidth;return e<=767?"mobile":e<=r?"tablet":"desktop"}();e.setAttribute("data-mobile-direction",u),e.setAttribute("data-tablet-direction",d),e.setAttribute("data-desktop-direction",o),e.setAttribute("data-current-breakpoint",t)})(),e.setAttribute("data-enable-accordion",s.toString()),p()?(e.classList.add("accordion-mode"),i&&(i.style.display="block"),"true"!==t.getAttribute("aria-expanded")&&(a.classList.remove("expanded"),a.setAttribute("aria-hidden","true"))):(e.classList.remove("accordion-mode"),t.setAttribute("aria-expanded","false"),a.setAttribute("aria-hidden","false"),a.classList.remove("expanded"),e.classList.remove("menu-expanded"),i&&(i.classList.remove("expanded"),i.setAttribute("aria-expanded","false")),a.style.maxHeight="",a.style.opacity="",a.style.overflow="",e.setAttribute("data-enable-accordion",s.toString()),i&&(i.style.display="none"),!s&&window.innerWidth<=r&&(a.setAttribute("aria-hidden","false"),a.classList.remove("expanded"),a.style.maxHeight="none",a.style.opacity="1",a.style.overflow="visible"))}function b(){p()&&("true"===t.getAttribute("aria-expanded")?v():function(){t.setAttribute("aria-expanded","true"),a.setAttribute("aria-hidden","false"),a.classList.add("expanded"),e.classList.add("menu-expanded"),i&&(i.classList.add("expanded"),i.setAttribute("aria-expanded","true")),n("Menu expanded");const s=a.querySelector(".menu-item a, .menu-item button");s&&setTimeout(()=>{s.focus()},300)}())}function v(){t.setAttribute("aria-expanded","false"),a.setAttribute("aria-hidden","true"),a.classList.remove("expanded"),e.classList.remove("menu-expanded"),i&&(i.classList.remove("expanded"),i.setAttribute("aria-expanded","false")),n("Menu collapsed")}t.addEventListener("touchstart",function(e){m=e.touches[0].clientY},{passive:!0}),t.addEventListener("touchend",function(e){const t=e.changedTouches[0].clientY;Math.abs(t-m)<10&&p()&&(e.preventDefault(),b())},{passive:!1}),window.addEventListener("resize",function(){clearTimeout(l),l=setTimeout(function(){f()},250)}),f();const y=a.querySelectorAll(".menu-item a, .menu-item button");y.forEach((e,n)=>{e.addEventListener("keydown",function(e){if("Escape"===e.key&&p())v(),t.focus();else if(p()&&"ArrowDown"===e.key){e.preventDefault();const t=y[n+1];t&&t.focus()}else if(p()&&"ArrowUp"===e.key){e.preventDefault();const i=y[n-1];i?i.focus():t.focus()}})})}function n(e){const t=document.createElement("div");t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),t.style.position="absolute",t.style.left="-10000px",t.style.width="1px",t.style.height="1px",t.style.overflow="hidden",t.textContent=e,document.body.appendChild(t),setTimeout(()=>{document.body.removeChild(t)},1e3)}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):e(),document.addEventListener("click",function(e){document.querySelectorAll(".cryzel-responsive-nav-menu").forEach(function(t){const n=t.querySelector(".menu-title"),i=t.querySelector(".menu-items"),a="true"===t.dataset.enableAccordion;if(!t.contains(e.target)&&a&&window.innerWidth<=1023&&n&&i){n.setAttribute("aria-expanded","false"),i.setAttribute("aria-hidden","true"),i.classList.remove("expanded"),t.classList.remove("menu-expanded");const e=t.querySelector(".menu-toggle");e&&(e.classList.remove("expanded"),e.setAttribute("aria-expanded","false"))}})})}();