!function(){function e(e,t){var n,a=document.querySelector(e),r=document.querySelector(t);null!==r&&(null!==(n=a.querySelector(".menu-toggle"))&&(n.setAttribute("aria-expanded","false"),n.addEventListener("click",function(){r.classList.toggle("toggled-on"),n.setAttribute("aria-expanded",r.classList.contains("toggled-on"))})),r.querySelectorAll(".menu-item-has-children > a, .page_item_has_children > a").forEach(function(e){e.after(function(){var e=document.createElement("button");e.classList.add("dropdown-toggle"),e.setAttribute("aria-expanded","false");var t=(new DOMParser).parseFromString(wellingtonScreenReaderText.icon,"text/html").body.firstElementChild;e.appendChild(t);var n=document.createElement("span");return n.classList.add("screen-reader-text"),n.textContent=wellingtonScreenReaderText.expand,e.appendChild(n),e.cloneNode(!0)}())}),r.querySelectorAll(".current-menu-ancestor > button").forEach(function(e){e.classList.add("toggled-on"),e.setAttribute("aria-expanded","true"),e.querySelector(".screen-reader-text").textContent=wellingtonScreenReaderText.collapse}),r.querySelectorAll(".current-menu-ancestor > .sub-menu").forEach(function(e){e.classList.add("toggled-on")}),r.querySelectorAll(".dropdown-toggle").forEach(function(e){e.addEventListener("click",function(){e.classList.toggle("toggled-on"),e.setAttribute("aria-expanded",e.classList.contains("toggled-on")),e.querySelector(".screen-reader-text").textContent=e.classList.contains("toggled-on")?wellingtonScreenReaderText.collapse:wellingtonScreenReaderText.expand,e.nextElementSibling.classList.toggle("toggled-on")})}),r.querySelectorAll(".menu-item-has-children a, .page_item_has_children a").forEach(function(e){e.addEventListener("focus",function(){o(e)}),e.addEventListener("blur",function(){o(e)})}));function o(e){for(var t=e.parentNode;!t.classList.contains("menu");)t.classList.contains("menu-item-has-children")&&t.classList.toggle("focus"),t=t.parentNode}}document.addEventListener("DOMContentLoaded",function(){e(".primary-navigation-wrap",".main-navigation"),e(".header-bar",".top-navigation")})}();