(()=>{"use strict";Drupal.behaviors.siteHeader={attach:function(context){var HTML=document.documentElement,SMALL_HEADER_MQ=window.matchMedia("(max-width: ".concat(getComputedStyle(HTML).getPropertyValue("--small-header-mq"),")")),SITE_HEADER=context.querySelector('[data-js="site-header"]');if(SITE_HEADER){var SITE_HEADER_CONTENT=SITE_HEADER.querySelector(".site-header__content");if(SITE_HEADER_CONTENT){var debounceTimeout,scrollTicking=!1,isHeaderSmall=!1,lastScrollY=window.scrollY||HTML.scrollTop||0,shouldHeaderBeSmall=function(){return SMALL_HEADER_MQ.matches||lastScrollY>=(SMALL_HEADER_MQ.matches?0:50)},updateHeaderHeight=function(){if("none"!==getComputedStyle(SITE_HEADER_CONTENT).transition){var _handleTransitionEnd=function(){HTML.style.setProperty("--site-header-height","".concat(SITE_HEADER_CONTENT.clientHeight,"px")),SITE_HEADER_CONTENT.removeEventListener("transitionend",_handleTransitionEnd)};SITE_HEADER_CONTENT.addEventListener("transitionend",_handleTransitionEnd,{once:!0}),setTimeout(function(){HTML.style.setProperty("--site-header-height","".concat(SITE_HEADER_CONTENT.clientHeight,"px")),SITE_HEADER_CONTENT.removeEventListener("transitionend",_handleTransitionEnd)},500)}else HTML.style.setProperty("--site-header-height","".concat(SITE_HEADER_CONTENT.clientHeight,"px"))},handleHeaderStateChange=function(event){var EVENT_TYPE=event.type,executeUpdate=function(){"scroll"===EVENT_TYPE&&(lastScrollY=window.scrollY||HTML.scrollTop||0,scrollTicking=!1),HTML.removeAttribute("data-site-header-small"),isHeaderSmall=!1,updateHeaderHeight(),shouldHeaderBeSmall()&&!isHeaderSmall&&(HTML.setAttribute("data-site-header-small",!0),isHeaderSmall=!0,updateHeaderHeight())};"scroll"===EVENT_TYPE?(scrollTicking||window.requestAnimationFrame(executeUpdate),scrollTicking=!0):(clearTimeout(debounceTimeout),debounceTimeout=setTimeout(executeUpdate,16))};shouldHeaderBeSmall()&&(HTML.setAttribute("data-site-header-small",!0),isHeaderSmall=!0,updateHeaderHeight()),SMALL_HEADER_MQ.addEventListener("change",handleHeaderStateChange),window.addEventListener("resize",handleHeaderStateChange,{passive:!0}),window.addEventListener("scroll",handleHeaderStateChange,{passive:!0}),updateHeaderHeight()}}}}})();