1 line
6.3 KiB
JavaScript
1 line
6.3 KiB
JavaScript
|
|
"use strict";(globalThis.blocksyJsonP=globalThis.blocksyJsonP||[]).push([[834,907],{5907:function(t,e,n){n.r(e),n.d(e,{mount:function(){return r}});var i=n(6834);const r=function(t){if(window.wp&&wp&&wp.customize&&wp.customize("active_theme")){const e=[...t.children].find(function(t){return t.matches(".ct-mega-menu:not(.ct-mega-menu-custom-width)")});if(e){e.querySelector(".sub-menu").style.left=Math.round(e.closest('[class*="ct-container"]').firstElementChild.getBoundingClientRect().x)-Math.round(e.closest("nav").getBoundingClientRect().x)+"px"}}(0,i.mountMenuLevel)(t,{startPosition:"left"})}},6834:function(t,e,n){n.r(e),n.d(e,{mountMenuLevel:function(){return m}});var i=n(1610),r=n(9680);const o=function(){return"rtl"===document.querySelector("html").dir},s=function(t){return t.className.includes("animated-submenu")&&(!t.parentNode.classList.contains("menu")||-1===t.className.indexOf("ct-mega-menu")&&t.parentNode.classList.contains("menu"))};const c=function(t,e){const n=[];for(;t.parentNode!==e;)n.push(t.parentNode),t=t.parentNode;return n},u=function(t){return o()?"left"===t?"right":"right"===t?"left":t:t},a=function(t){let e=function(t,e){for(var n=[];t.parentNode;)t.parentNode&&t.parentNode.matches&&t.parentNode.matches(e)&&n.push(t.parentNode),t=t.parentNode;return n[n.length-1]}(t,"li.menu-item");if(!e)return u("right");const n=[...e.querySelectorAll(".sub-menu")].map(function(t){return{el:t,parents:c(t,e)}});if(0===n.length)return u("right");const i=n.sort(function(t,e){return t.parents.length-e.parents.length}).reverse()[0],r=[...i.parents.filter(function(t){return t.matches(".sub-menu")}),i.el],s=r.reduce(function(t,e,n){const i=getComputedStyle(e);return t+e.getBoundingClientRect().width+(0===n?0:parseFloat(i.getPropertyValue("--dropdown-horizontal-offset")||"5px"))},0),a=e.getBoundingClientRect();let l=s<a.right,d=innerWidth-a.left>s;return e.matches(".animated-submenu-inline")&&(d=innerWidth-a.left-a.width>s),o()?l||d?l?"left":"right":"left":l||d?d?"right":"left":"right"},l=function(t){const e=t.target.closest("li");e.__closeSubmenuTimer__&&(clearTimeout(e.__closeSubmenuTimer__),e.__closeSubmenuTimer__=null),e.classList.add("ct-active");let n=[...e.children].find(function(t){return t.matches(".ct-toggle-dropdown-desktop-ghost")});if(n||(n=e.firstElementChild),n&&(n.setAttribute("aria-expanded","true"),"button"===n.tagName.toLowerCase()&&n.setAttribute("aria-label",ct_localizations.collapse_submenu)),!s(e))return;const i=e.querySelector(".sub-menu");m(i),i.closest('[data-interaction="hover"]')&&i.parentNode.addEventListener("mouseleave",function(){[...i.children].filter(function(t){return s(t)}).map(function(t){return t.removeAttribute("data-submenu")})},{once:!0})},d=function(t){if(!t.target)return;const e=t.target.closest("li");e.classList.remove("ct-active");let n=[...e.children].find(function(t){return t.matches(".ct-toggle-dropdown-desktop-ghost")});n||(n=e.firstElementChild),n&&(n.setAttribute("aria-expanded","false"),"button"===n.tagName.toLowerCase()&&n.setAttribute("aria-label",ct_localizations.expand_submenu),t.focusOnIndicator&&n.focus({focusVisible:!0})),e.__closeSubmenuTimer__=setTimeout(function(){e.__closeSubmenuTimer__=null,[...e.querySelectorAll("[data-submenu]")].map(function(t){t.removeAttribute("data-submenu")}),[...e.querySelectorAll(".ct-active")].map(function(t){t.classList.remove("ct-active")})},30)},f=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.classList.contains("ct-mega-menu-custom-width")){const e=t.querySelector(".sub-menu"),n=t.getBoundingClientRect(),i=e.getBoundingClientRect();if(!(n.left+n.width/2>i.width/2&&innerWidth-(n.left+n.width/2)>i.width/2)){const r=a(e);let o=0,s=15;"right"===r&&(o=-1*Math.round(n.left-(innerWidth-i.width)+s)+"px",n.left+n.width/2>i.width/2||(o=-1*Math.round(n.left-s)+"px")),"left"===r&&(o=-1*Math.round(innerWidth-n.right-s)+"px"),t.dataset.submenu=r,e.style.setProperty("--theme-submenu-inline-offset",o)}}if(s(t)&&function(t,e){let{startPosition:n="end"}=e;const i=t.querySelector(".sub-menu"),r=a(i),{left:o,width
|