(()=>{let E='.wp-block-uicore-a-menu-link[data-menu-link-type="submenu"]',t=".wp-block-uicore-toggle-icon.uicore-is-active",b=70,w="data-uicore-website-blur-ready",f=e=>e.classList.contains("uicore-is-active"),k=e=>e.classList.contains("uicore-menu-submenu-hover")&&!f(e),p=e=>e.some(e=>Boolean(e.querySelector(t))),o=({menu:o,contextDocument:e=o?.ownerDocument,contextWindow:t=e?.defaultView})=>{if(!o||"true"===o.getAttribute(w)||!e||!t)return null;o.setAttribute(w,"true");let n=null,r=[],i=Array.from(o.querySelectorAll(E)),u=i.map(e=>e.querySelector(".wp-block-uicore-toggle-icon")).filter(Boolean),s=()=>{n&&(t.clearTimeout(n),n=null)},c=e=>{s(),e?o.classList.add("uicore-blur-on"):n=t.setTimeout(()=>{o.classList.remove("uicore-blur-on"),n=null},b)},a=()=>{c(!f(o)&&!k(o)&&p(i))},l=(i.forEach(t=>{let e=()=>{k(o)&&c(!0)},n=e=>{k(o)&&!t.contains(e.relatedTarget)&&c(!1)};t.addEventListener("mouseenter",e),t.addEventListener("mouseleave",n),t.addEventListener("focusin",e),t.addEventListener("focusout",n),r.push(()=>{t.removeEventListener("mouseenter",e),t.removeEventListener("mouseleave",n),t.removeEventListener("focusin",e),t.removeEventListener("focusout",n)})}),()=>{t.requestAnimationFrame(a)}),d=(u.forEach(e=>{e.addEventListener("click",l)}),r.push(()=>{u.forEach(e=>{e.removeEventListener("click",l)})}),()=>{k(o)&&c(!1)}),m=e=>{e.relatedTarget&&o.contains(e.relatedTarget)||a()},v=e=>{o.contains(e.target)||a()},L=e=>{"Escape"===e.key&&a()};return o.addEventListener("mouseleave",d),o.addEventListener("focusout",m),e.addEventListener("click",v),e.addEventListener("keydown",L),t.addEventListener("resize",a),r.push(()=>{o.removeEventListener("mouseleave",d),o.removeEventListener("focusout",m),e.removeEventListener("click",v),e.removeEventListener("keydown",L),t.removeEventListener("resize",a)}),a(),()=>{s(),r.forEach(e=>e&&e()),o.classList.remove("uicore-blur-on"),o.removeAttribute(w)}},e=({contextDocument:t=document,contextWindow:n=window}={})=>{t.querySelectorAll(".wp-block-uicore-a-menu.uicore-bl-menu-dropdown-website-blur").forEach(e=>{o({menu:e,contextDocument:t,contextWindow:n})})};window.MenuWebsiteBlur={initWebsiteBlur:e,initWebsiteBlurMenu:o},document.addEventListener("DOMContentLoaded",()=>{document.body.classList.contains("block-editor-page")||e()})})();