1
var module_40640051057=function(){var __hs_messages={}
2
;function setHeaderHeightVar(){$(".header-container-wrapper").css({"max-height":"none"}
3
);var headerHeight=$(".header-container-wrapper").innerHeight();$(".header-container-wrapper").css({"max-height":""}
4
),document.documentElement.style.setProperty("--headerHeight",headerHeight+"px")}
5
function moveDropdownsIntoWindow(){var windowWidth=$(window).width();$(".header__nav__submenu--level-2").each((function(){var $this=$(this);if($this.css({left:""}
6
),windowWidth>960){var bounding=$this[0].getBoundingClientRect();bounding.right>windowWidth&&$this.css({left:windowWidth-bounding.right}
7
)}
8
}
9
)),$(".header__nav__submenu--level-3").each((function(){var $this=$(this);($this.css({left:"100%",right:""}
10
),windowWidth>960)&&($this[0].getBoundingClientRect().right>windowWidth&&$this.css({left:"auto",right:"100%"}
11
))}
12
))}
13
i18n_getmessage=function(){return hs_i18n_getMessage(__hs_messages,hsVars.language,arguments)}
14
,i18n_getlanguage=function(){return hsVars.language}
15
,$(document).on("ready",(function(){setHeaderHeightVar(),moveDropdownsIntoWindow()}
16
)),$(window).on("load",(function(){setHeaderHeightVar(),moveDropdownsIntoWindow()}
17
)),$(window).on("resize",(function(){setHeaderHeightVar(),moveDropdownsIntoWindow()}
18
));var $headerLinks=$(".header__right .header__buttons").clone().removeClass("header__buttons").addClass("nav-50-50");$headerLinks.length>0&&($(".header__nav__menu").append($headerLinks),$headerLinks.wrap('<li class="header__nav__li header__nav--mob-only"></li>')),$(".header__hamburger-container").on("click",(function(){$(".header__hamburger",this).toggleClass("active"),$(".header__nav").toggleClass("active"),$(".header__nav").hasClass("active")?($(this).attr("aria-expanded",!0),setTimeout((function(){console.log($('.header__nav__li--depth-1[data-index="1"]')),$('.header__nav__li--depth-1[data-index="1"] > .header__nav__link').focus()}
19
),250)):$(this).attr("aria-expanded",!1)}
20
)),$(".header__nav__li--has-submenu > .header__nav__link").on("click",(function(e){$(window).width()<961&&(e.preventDefault(),$(this).parent().find("> ul").addClass("active"),$(this).parent().parent().addClass("overflow-hidden"))}
21
)),$(".header__nav__li--menu-back > .header__nav__link").on("click",(function(e){e.preventDefault(),closeSub(this),$(this).parent().parent().removeClass("active").parent().parent().removeClass("overflow-hidden")}
22
)),$(".header__nav__link--toggle").on("focusin",(function(){$(this).attr("aria-expanded",!0)}
23
)),$(".header__nav__link--toggle").on("focusout",(function(){$(this).attr("aria-expanded",!1)}
24
));var keys_tab=9,keys_esc=27,keys_space=32,keys_end=35,keys_home=36,keys_left=37,keys_up=38,keys_right=39,keys_down=40;function goToNext(that){var $currentLink=$(that).parent();$currentLink.closest("ul");if($(window).width()>960)var $next=$currentLink.next(".header__nav__li:not(.header__nav--mob-only)");else $next=$currentLink.next(".header__nav__li");$next.length>0?$next.find("> .header__nav__link").focus():goToFirst(that)}
25
function goToPrev(that){var $currentLink=$(that).parent();$currentLink.closest("ul");if($(window).width()>960)var $prev=$currentLink.prev(".header__nav__li:not(.header__nav--mob-only)");else $prev=$currentLink.prev(".header__nav__li");$prev.length>0?$prev.find("> .header__nav__link").focus():closeSub(that)}
26
function goToSub(that,open){var $currentLink=$(that).parent(),$childMenu=$("> ul",$currentLink);$currentLink.hasClass("header__nav__li--has-submenu")&&setTimeout((function(){"last"==open?$("> li > .header__nav__link",$childMenu).last().focus():$(window).width()>960?$("> li > .header__nav__link:not(.header__nav__link--mob-only)",$childMenu).first().focus():$("> li > .header__nav__link",$childMenu).first().focus()}
27
),100)}
28
function goToFirst(that){var $currentMenu=$(that).parent().closest("ul");$(window).width()>960?$(".header__nav__li:not(.header__nav--mob-only)",$currentMenu).first().find("> .header__nav__link").focus():$(".header__nav__li",$currentMenu).first().find("> .header__nav__link").focus()}
29
function closeSub(that){$(that).parent().closest("ul").parent().find("> .header__nav__link").focus()}
30
$(".header__nav__link").on("keydown",(function(e){if(console.log(e.keyCode),this==e.target){var $currentLink=$(this).parent(),depth=$currentLink.data("depth");$currentLink.closest("ul"),$("> ul",$currentLink);if(1==depth&&$(window).width()>960)switch(e.keyCode){case keys_right:goToNext(this);break;case keys_left:goToPrev(this);break;case keys_down:e.preventDefault,goToSub(this,"first");break;case keys_up:e.preventDefault}
31
else switch(e.keyCode){case keys_right:goToSub(this,"first");break;case keys_left:case keys_esc:closeSub(this);break;case keys_down:e.preventDefault,goToNext(this);break;case keys_up:e.preventDefault,goToPrev(this)}
32
switch(e.keyCode){case keys_home:goToFirst(this);break;case keys_end:goToLast(this);break;case keys_space:e.preventDefault,function(that){var $currentLink=$(that).parent();$currentLink.hasClass("header__nav__li--has-submenu")?goToSub(that,"first"):$currentLink.hasClass("header__nav__li--menu-back")?$(that).click():window.location.href=$(that).attr("href")}
33
(this);break;case keys_tab:$(window).width()>960||$(".header__hamburger-container").click()}
34
}
35
}
36
))}
37
();