var astraGetParents=function(elem,selector){if(!Element.prototype.matches){Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(s){var matches=(this.document||this.ownerDocument).querySelectorAll(s),i=matches.length;while(--i>=0&&matches.item(i)!==this){} return i>-1;};} var parents=[];for(;elem&&elem!==document;elem=elem.parentNode){if(selector){if(elem.matches(selector)){parents.push(elem);}}else{parents.push(elem);}} return parents;};var getParents=function(elem,selector){console.warn('getParents() function has been deprecated since version 2.5.0 or above of Astra Theme and will be removed in the future. Use astraGetParents() instead.');astraGetParents(elem,selector);} var astraToggleClass=function(el,className){if(el.classList.contains(className)){el.classList.remove(className);}else{el.classList.add(className);}};var toggleClass=function(el,className){console.warn('toggleClass() function has been deprecated since version 2.5.0 or above of Astra Theme and will be removed in the future. Use astraToggleClass() instead.');astraToggleClass(el,className);};(function(){if(typeof window.CustomEvent==="function")return false;function CustomEvent(event,params){params=params||{bubbles:false,cancelable:false,detail:undefined};var evt=document.createEvent('CustomEvent');evt.initCustomEvent(event,params.bubbles,params.cancelable,params.detail);return evt;} CustomEvent.prototype=window.Event.prototype;window.CustomEvent=CustomEvent;})();var astraTriggerEvent=function astraTriggerEvent(el,typeArg){var customEventInit=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var event=new CustomEvent(typeArg,customEventInit);el.dispatchEvent(event);};astraSmoothScroll=function astraSmoothScroll(e,top){e.preventDefault();window.scrollTo({top:top,left:0,behavior:'smooth'});};astScrollToTopHandler=function(masthead,astScrollTop){var content=getComputedStyle(astScrollTop).content,device=astScrollTop.dataset.onDevices;content=content.replace(/[^0-9]/g,'');if('both'==device||('desktop'==device&&'769'==content)||('mobile'==device&&''==content)){var scrollTop=window.pageYOffset||document.body.scrollTop;if(masthead&&masthead.length){if(scrollTop>masthead.offsetHeight+100){astScrollTop.style.display="block";}else{astScrollTop.style.display="none";}}else{if(window.pageYOffset>300){astScrollTop.style.display="block";}else{astScrollTop.style.display="none";}}}else{astScrollTop.style.display="none";}};(function(){var menu_toggle_all=document.querySelectorAll('#masthead .main-header-menu-toggle'),main_header_masthead=document.getElementById('masthead'),menu_click_listeners_nav={},mobileHeaderType='',body=document.body,mobileHeader='';if(undefined!==main_header_masthead&&null!==main_header_masthead){mobileHeader=main_header_masthead.querySelector("#ast-mobile-header");} if(''!==mobileHeader&&null!==mobileHeader){mobileHeaderType=mobileHeader.dataset.type;} document.addEventListener('astMobileHeaderTypeChange',updateHeaderType,false);function updateHeaderType(e){mobileHeaderType=e.detail.type;var popupTrigger=document.querySelectorAll('.menu-toggle');if('dropdown'===mobileHeaderType){document.getElementById('ast-mobile-popup').classList.remove('active','show');updateTrigger('updateHeader');} if('off-canvas'===mobileHeaderType){for(var item=0;item0){for(let index=0;index #ast-desktop-header .ast-desktop-header-content');var elementor_editor=document.querySelector('.elementor-editor-active');if(desktop_header_content){desktop_header_content.style.display='none';} var mobileResizeWidth=(null!==navigator.userAgent.match(/Android/i)&&'Android'===navigator.userAgent.match(/Android/i)[0])?window.visualViewport.width:window.innerWidth;if(mobileResizeWidth!==mobile_width){if(menu_dropdown_close&&null===elementor_editor){menu_dropdown_close.click();} document.body.classList.remove('ast-main-header-nav-open','ast-popup-nav-open');if(menu_offcanvas_close&&null==elementor_editor){menu_offcanvas_close.click();}} updateHeaderBreakPoint();AstraToggleSetup();} window.addEventListener('resize',function(){if('INPUT'!==document.activeElement.tagName){AstraHandleResizeEvent();}});document.addEventListener('DOMContentLoaded',function(){AstraToggleSetup();var containerButton;if(body.classList.contains('ast-header-break-point')){containerButton=document.getElementById('ast-mobile-header');}else{containerButton=document.getElementById('ast-desktop-header');} if(null!==containerButton){var containerMenu=containerButton.querySelector('.navigation-accessibility');navigation_accessibility(containerMenu,containerButton);}});var get_window_width=function(){return document.documentElement.clientWidth;} var updateHeaderBreakPoint=function(){var originalOverflow=body.style.overflow;body.style.overflow='hidden';var ww=get_window_width();body.style.overflow=originalOverflow;var break_point=astra.break_point;if(ww>break_point||0===ww){if(menu_toggle_all.length>0){for(var i=0;i0?false:true;menuToggleAllLength=flag?1:menuToggleAllLength;} if(menuToggleAllLength>0||flag){for(var i=0;i .menu-link, ul.main-header-menu .ast-menu-toggle');}else{var astra_menu_toggle=__main_header_all[mainHeaderCount].querySelectorAll('ul.main-header-menu .ast-menu-toggle');} if(astra_menu_toggle.length>0){for(var j=0;j #ast-mobile-header .main-header-bar-navigation');menu_toggle_all=document.querySelectorAll('#masthead > #ast-mobile-header .main-header-menu-toggle') var event_index='0';if(null!==this.closest('#ast-fixed-header')){__main_header_all=document.querySelectorAll('#ast-fixed-header > #ast-mobile-header .main-header-bar-navigation');menu_toggle_all=document.querySelectorAll('#ast-fixed-header .main-header-menu-toggle') event_index='0';} if('undefined'===typeof __main_header_all[event_index]){return false;} var menuHasChildren=__main_header_all[event_index].querySelectorAll('.menu-item-has-children');for(var i=0;i0){for(var i=0;i<__main_header_all.length;i++){if(null!=__main_header_all[i]){__main_header_all[i].classList.remove('toggle-on');__main_header_all[i].style.display='';} var sub_menu=__main_header_all[i].getElementsByClassName('sub-menu');for(var j=0;j{input.addEventListener('focus',function(e){var sibling=this.parentNode.parentNode.parentNode.querySelector('.ast-search-menu-icon');if(sibling){astraToggleClass(sibling,'ast-dropdown-active');}});input.addEventListener('blur',function(e){var sibling=this.parentNode.parentNode.parentNode.querySelector('.ast-search-menu-icon');if(sibling){sibling.classList.remove('ast-dropdown-active');astraToggleClass(sibling,'ast-dropdown-active');}});});body.onclick=function(event){if(typeof event.target.classList!=='undefined'){if(!event.target.classList.contains('ast-search-menu-icon')&&astraGetParents(event.target,'.ast-search-menu-icon').length===0&&astraGetParents(event.target,'.ast-search-icon').length===0){var dropdownSearchWrap=document.getElementsByClassName('ast-search-menu-icon');for(var i=0;i a .ast-header-navigation-arrow');const siteNavigationSubMenu=document.querySelectorAll('nav.site-navigation .sub-menu');const menuLi=document.querySelectorAll('nav.site-navigation .menu-item-has-children');const megaMenuFullWidth=document.querySelectorAll('.astra-full-megamenu-wrapper');if(dropdownToggleLinks){dropdownToggleLinks.forEach(element=>{element.addEventListener('keydown',function(e){if('Enter'===e.key){if(!e.target.closest('li').querySelector('.sub-menu').classList.contains('astra-megamenu')){setTimeout(()=>{e.target.closest('li').querySelector('.sub-menu').classList.toggle('toggled-on');e.target.closest('li').classList.toggle('ast-menu-hover');if('false'===e.target.getAttribute('aria-expanded')||!e.target.getAttribute('aria-expanded')){e.target.setAttribute('aria-expanded','true');}else{e.target.setAttribute('aria-expanded','false');}},10);}else{setTimeout(()=>{const subMenuTarget=e.target.closest('li').querySelector('.sub-menu');const fullMegaMenuWrapper=e.target.closest('li').querySelector('.astra-full-megamenu-wrapper');if(subMenuTarget){subMenuTarget.classList.toggle('astra-megamenu-focus');} if(fullMegaMenuWrapper){fullMegaMenuWrapper.classList.toggle('astra-megamenu-wrapper-focus');} e.target.closest('li').classList.toggle('ast-menu-hover');if('false'===e.target.getAttribute('aria-expanded')||!e.target.getAttribute('aria-expanded')){e.target.setAttribute('aria-expanded','true');}else{e.target.setAttribute('aria-expanded','false');}},10);}}});});if(siteNavigationSubMenu||menuLi){document.addEventListener('click',function(e){closeNavigationMenu(siteNavigationSubMenu,dropdownToggleLinks,menuLi,megaMenuFullWidth);},false);} if(siteNavigationSubMenu||menuLi){document.addEventListener('keydown',function(e){if('Escape'===e.key){closeNavigationMenu(siteNavigationSubMenu,dropdownToggleLinks,menuLi,megaMenuFullWidth);}},false);}} const allParentMenu=document.querySelectorAll('nav.site-navigation .ast-nav-menu > .menu-item-has-children > a .ast-header-navigation-arrow');if(allParentMenu){allParentMenu.forEach(element=>{element.addEventListener('keydown',function(e){if(!e.target.closest('li').classList.contains('ast-menu-hover')&&'Enter'===e.key){closeNavigationMenu(siteNavigationSubMenu,dropdownToggleLinks,menuLi,megaMenuFullWidth);}},false);});}} function closeNavigationMenu(siteNavigationSubMenu,dropdownToggleLinks,menuLi,megaMenuFullWidth){if(siteNavigationSubMenu){siteNavigationSubMenu.forEach(element=>{element.classList.remove('astra-megamenu-focus');element.classList.remove('toggled-on');});} if(menuLi){menuLi.forEach(element=>{element.classList.remove('ast-menu-hover');});} if(megaMenuFullWidth){megaMenuFullWidth.forEach(element=>{element.classList.remove('astra-megamenu-wrapper-focus')});} if(dropdownToggleLinks){dropdownToggleLinks.forEach(element=>{element.setAttribute('aria-expanded','false');});}} function toggleClose() {var self=this||'',hash='#';if(self&&!self.classList.contains('astra-search-icon')&&null===self.closest('.ast-builder-menu')){var link=new String(self);if(link.indexOf(hash)!==-1){var link_parent=self.parentNode;if(body.classList.contains('ast-header-break-point')){if(!(document.querySelector('header.site-header').classList.contains('ast-builder-menu-toggle-link')&&link_parent.classList.contains('menu-item-has-children'))){var builder_header_menu_toggle=document.querySelector('.main-header-menu-toggle');builder_header_menu_toggle.classList.remove('toggled');var main_header_bar_navigation=document.querySelector('.main-header-bar-navigation');main_header_bar_navigation.classList.remove('toggle-on');main_header_bar_navigation.style.display='none';astraTriggerEvent(document.querySelector('body'),'astraMenuHashLinkClicked');}}else{while(-1===self.className.indexOf('nav-menu')){if('li'===self.tagName.toLowerCase()){if(-1!==self.className.indexOf('focus')){self.className=self.className.replace(' focus','');}} self=self.parentElement;}}}}} function toggleFocus(){var self=this;while(-1===self.className.indexOf('navigation-accessibility')){if('li'===self.tagName.toLowerCase()){self.classList.toggle('focus');} self=self.parentElement;}} if(!astra.is_header_footer_builder_active){if('querySelector'in document&&'addEventListener'in window){body.addEventListener('mousedown',function(){body.classList.add('ast-mouse-clicked');});body.addEventListener('keydown',function(){body.classList.remove('ast-mouse-clicked');});}} if(astra.is_scroll_to_id){let hashLinks=[];const links=document.querySelectorAll('a[href*="#"]:not([href="#"]):not([href="#0"]):not([href*="uagb-tab"]):not(.uagb-toc-link__trigger):not(.skip-link):not(.nav-links a):not([href*="tab-"])');if(links){for(const link of links){if(link.href.split('#')[0]!==location.href.split('#')[0]){hashLinks.push({hash:link.hash,url:link.href.split('#')[0]});}else if(link.hash!==""){link.addEventListener("click",scrollToIDHandler);}}} function scrollToIDHandler(e){let offset=0;const siteHeader=document.querySelector('.site-header');if(siteHeader){const headerHeight=siteHeader.querySelectorAll('div[data-stick-support]');if(headerHeight){headerHeight.forEach(single=>{offset+=single.clientHeight;});} const href=this.hash;if(href){const scrollId=document.querySelector(href);if(scrollId){const scrollOffsetTop=scrollId.offsetTop-offset;if(scrollOffsetTop){astraSmoothScroll(e,scrollOffsetTop);}}}}} window.addEventListener('DOMContentLoaded',(event)=>{for(let link of hashLinks){if(window.location.href.split('#')[0]===link.url){const siteHeader=document.querySelector('.site-header');let offset=0;const headerHeight=siteHeader.querySelectorAll('div[data-stick-support]');if(headerHeight){headerHeight.forEach(single=>{offset+=single.clientHeight;});} const scrollId=document.querySelector(link.hash);if(scrollId){const scrollOffsetTop=scrollId.offsetTop-offset;if(scrollOffsetTop){astraSmoothScroll(event,scrollOffsetTop);}}}}});} if(astra.is_scroll_to_top){var masthead=document.querySelector('#page header');var astScrollTop=document.getElementById('ast-scroll-top');astScrollToTopHandler(masthead,astScrollTop);window.addEventListener('scroll',function(){astScrollToTopHandler(masthead,astScrollTop);});astScrollTop.onclick=function(e){astraSmoothScroll(e,0);};astScrollTop.addEventListener('keydown',function(e){if(e.key==='Enter'){astraSmoothScroll(e,0);}});}})();