var blossompin=blossompin||{};function blossompinDomReady(e){if("function"==typeof e)return"interactive"===document.readyState||"complete"===document.readyState?e():void document.addEventListener("DOMContentLoaded",e,!1)}function blossompinToggleAttribute(e,t,o,n){void 0===o&&(o=!0),void 0===n&&(n=!1),e.getAttribute(t)!==o?e.setAttribute(t,o):e.setAttribute(t,n)}function blossompinFindParents(e,t){var o=[];return function e(n){var s=n.parentNode;s instanceof HTMLElement&&(s.matches(t)&&o.push(s),e(s))}(e),o}blossompin.createEvent=function(e){var t;return"function"==typeof window.Event?t=new Event(e):(t=document.createEvent("Event")).initEvent(e,!0,!1),t},blossompin.coverModals={init:function(){document.querySelector(".cover-modal")&&(this.onToggle(),this.closeOnEscape(),this.hideAndShowModals(),this.keepFocusInModal())},onToggle:function(){document.querySelectorAll(".cover-modal").forEach(function(e){e.addEventListener("toggled",function(e){var t=e.target,o=document.body;t.classList.contains("active")?o.classList.add("showing-modal"):(o.classList.remove("showing-modal"),o.classList.add("hiding-modal"),setTimeout(function(){o.classList.remove("hiding-modal")},500))})})},closeOnEscape:function(){document.addEventListener("keydown",function(e){27===e.keyCode&&(e.preventDefault(),document.querySelectorAll(".cover-modal.active").forEach(function(e){this.untoggleModal(e)}.bind(this)))}.bind(this))},hideAndShowModals:function(){var e=document,t=window,o=e.querySelectorAll(".cover-modal"),n=e.documentElement.style,s=e.querySelector("#wpadminbar");function i(e){var o,n=t.pageYOffset;return s?(o=n+s.getBoundingClientRect().height,e?-o:o):0===n?0:-n}function a(){return{"overflow-y":t.innerHeight>e.documentElement.getBoundingClientRect().height?"hidden":"scroll",position:"fixed",width:"100%",top:i(!0)+"px",left:0}}o.forEach(function(o){o.addEventListener("toggle-target-before-inactive",function(l){var c=a(),r=t.pageYOffset,d=Math.abs(i())-r+"px",u=t.matchMedia("(max-width: 600px)");l.target===o&&(Object.keys(c).forEach(function(e){n.setProperty(e,c[e])}),t.blossompin.scrolled=parseInt(c.top,10),s&&(e.body.style.setProperty("padding-top",d),u.matches&&(r>=i()?o.style.setProperty("top",0):o.style.setProperty("top",i()-r+"px"))),o.classList.add("show-modal"))}),o.addEventListener("toggle-target-after-inactive",function(l){l.target===o&&setTimeout(function(){var l=blossompin.toggles.clickedEl;o.classList.remove("show-modal"),Object.keys(a()).forEach(function(e){n.removeProperty(e)}),s&&(e.body.style.removeProperty("padding-top"),o.style.removeProperty("top")),!1!==l&&(l.focus(),l=!1),t.scrollTo(0,Math.abs(t.blossompin.scrolled+i())),t.blossompin.scrolled=0},500)})})},untoggleModal:function(e){var t,o=!1;e.dataset.modalTargetString&&(t=e.dataset.modalTargetString,o=document.querySelector('*[data-toggle-target="'+t+'"]')),o?o.click():e.classList.remove("active")},keepFocusInModal:function(){var e=document;e.addEventListener("keydown",function(t){var o,n,s,i,a,l,c,r,d,u,g=blossompin.toggles.clickedEl;g&&e.body.classList.contains("showing-modal")&&(o=g.dataset.toggleTarget,"input, a, button",n=e.querySelector(o),s=n.querySelectorAll("input, a, button"),s=Array.prototype.slice.call(s),".menu-modal"===o&&(i=(i=window.matchMedia("(min-width: 768px)").matches)?".expanded-menu":".mobile-menu",(s=s.filter(function(e){return null!==e.closest(i)&&null!==e.offsetParent})).unshift(e.querySelector(".close-nav-toggle")),(a=e.querySelector(".menu-bottom > nav"))&&a.querySelectorAll("input, a, button").forEach(function(e){s.push(e)})),".main-menu-modal"===o&&(i=(i=window.matchMedia("(min-width: 1025px)").matches)?".expanded-menu":".mobile-menu",(s=s.filter(function(e){return null!==e.closest(i)&&null!==e.offsetParent})).unshift(e.querySelector(".close-main-nav-toggle")),(a=e.querySelector(".menu-bottom > nav"))&&a.querySelectorAll("input, a, button").forEach(function(e){s.push(e)})),c=s[s.length-1],r=s[0],l=e.activeElement,d=9===t.keyCode,!(u=t.shiftKey)&&d&&c===l&&(t.preventDefault(),r.focus()),u&&d&&r===l&&(t.preventDefault(),c.focus()))})}},blossompin.modalMenu={init:function(){this.expandLevel()},expandLevel:function(){document.querySelectorAll(".modal-menu").forEach(function(e){var t=e.querySelector(".current-menu-item");t&&blossompinFindParents(t,"li").forEach(function(e){var t=e.querySelector(".submenu-toggle");t&&blossompin.toggles.performToggle(t,!0)})})}},blossompin.toggles={clickedEl:!1,init:function(){this.toggle()},performToggle:function(e,t){var o,n,s,i=this,a=document,l=e,c=l.dataset.toggleTarget;a.querySelectorAll(".show-modal").length||(i.clickedEl=a.activeElement),(o="next"===c?l.nextSibling:a.querySelector(c)).classList.contains("active")?o.dispatchEvent(blossompin.createEvent("toggle-target-before-active")):o.dispatchEvent(blossompin.createEvent("toggle-target-before-inactive")),s=l.dataset.classToToggle?l.dataset.classToToggle:"active",n=0,o.classList.contains("cover-modal")&&(n=10),setTimeout(function(){var e,n=o.classList.contains("sub-menu")?l.closest(".menu-item").querySelector(".sub-menu"):o,r=l.dataset.toggleDuration;"slidetoggle"!==l.dataset.toggleType||t||"0"===r?n.classList.toggle(s):blossompinMenuToggle(n,r),"next"===c?l.classList.toggle("active"):o.classList.contains("sub-menu")?l.classList.toggle("active"):a.querySelector('*[data-toggle-target="'+c+'"]').classList.toggle("active"),blossompinToggleAttribute(l,"aria-expanded","true","false"),i.clickedEl&&-1!==l.getAttribute("class").indexOf("close-")&&blossompinToggleAttribute(i.clickedEl,"aria-expanded","true","false"),l.dataset.toggleBodyClass&&a.body.classList.toggle(l.dataset.toggleBodyClass),l.dataset.setFocus&&(e=a.querySelector(l.dataset.setFocus))&&(o.classList.contains("active")?e.focus():e.blur()),o.dispatchEvent(blossompin.createEvent("toggled")),o.classList.contains("active")?o.dispatchEvent(blossompin.createEvent("toggle-target-after-active")):o.dispatchEvent(blossompin.createEvent("toggle-target-after-inactive"))},n)},toggle:function(){var e=this;document.querySelectorAll("*[data-toggle-target]").forEach(function(t){t.addEventListener("click",function(o){o.preventDefault(),e.performToggle(t)})})}},blossompinDomReady(function(){blossompin.toggles.init(),blossompin.coverModals.init()});