((e,t)=>{"use strict";let s;const a=new Map,m=e.isTouch?"click":"mouseover",o=async function(m){if(e.w<s||m.target.closest(".mega-menu-posts"))return;let o="mouseenter"===m.type||"focus"===m.type?this.tfClass("mega-link")[0]:m.target;if(o.classList.contains("child-arrow")&&(o=o.closest(".has-mega-sub-menu").tfClass("mega-link")[0]),o=o.classList.contains("mega-link")?o:o.closest(".tf_mega_taxes .mega-link"),!o)return;"click"===m.type&&m.preventDefault();const i=o.dataset.termid,n=o.dataset.tax,c=o.tfTag("a")[0].classList,u=o.closest(".mega-sub-menu").tfClass("tf_mega_selected")[0];let f=o.tfClass("mega-menu-posts")[0],r=a.get(i);if(f||(f=t.createElement("div"),f.className="mega-menu-posts tf_left tf_box tf_scrollbar",o.appendChild(f)),u&&u.classList.remove("tf_mega_selected"),o.classList.add("tf_mega_selected"),void 0===r){if(c.contains("tf_loader"))return;c.add("tf_loader");try{r=await e.fetch({action:"themify_theme_mega_posts",termid:i,tax:n},"text"),a.set(i,r)}catch(m){}c.remove("tf_loader")}void 0!==r&&(f.innerHTML=r)};e.on("tf_mega_menu",((e,t)=>{const a=e.tfClass("tf_mega_taxes");s=t;for(let e=a.length-1;e>-1;--e){if(a[e].dataset.tfMegaInit)continue;a[e].tfOn(m,o),"mouseover"===m&&a[e].tfOn("focusin",o,{passive:!0});let t=a[e].closest(".has-mega-sub-menu");t&&("mouseover"===m?(t.tfOn("mouseenter",o,{passive:!0}),t.querySelector("a").tfOn("focus",o.bind(t),{passive:!0})):t.tfClass("child-arrow")[0].tfOn("click",o)),a[e].dataset.tf_mega_init=1}})),e.isTouch||setTimeout((()=>{e.edgeMenu()}),1500)})(Themify,document);