((e,t)=>{"use strict";let a;const s=(e,t,a)=>{localStorage.setItem(e,JSON.stringify({value:t,expiry:Date.now()+1e3*a}))},m=e.isTouch?"click":"mouseover",o=async function(m){if(e.w<a||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 l=o.dataset.termid,i=o.dataset.tax,r=o.tfTag("a")[0].classList,f=o.closest(".mega-sub-menu").tfClass("tf_mega_selected")[0];let n=o.tfClass("mega-menu-posts")[0];if(!n){n=t.createElement("div"),n.className="mega-menu-posts tf_left tf_box tf_scrollbar",o.appendChild(n);let a=(e=>{let t=localStorage.getItem(e);if(t){if(t=JSON.parse(t),!(Date.now()>t.expiry))return t.value;localStorage.removeItem(e)}return null})("tf_mega_"+l);if(null===a){if(r.contains("tf_loader"))return;r.add("tf_loader");try{a=await e.fetch({action:"themify_theme_mega_posts",termid:l,tax:i},"text"),s("tf_mega_"+l,a,3600)}catch(m){s("tf_mega_"+l,"",600)}r.remove("tf_loader")}void 0!==a&&(n.innerHTML=a)}f&&f.classList.remove("tf_mega_selected"),o.classList.add("tf_mega_selected")};e.on("tf_mega_menu",((e,t)=>{const s=e.tfClass("tf_mega_taxes");a=t;for(let e=s.length-1;e>-1;--e){if(s[e].dataset.tfMegaInit)continue;s[e].tfOn(m,o),"mouseover"===m&&s[e].tfOn("focusin",o,{passive:!0});let t=s[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)),s[e].dataset.tf_mega_init=1}})),e.isTouch||setTimeout((()=>{e.edgeMenu()}),1500)})(Themify,document);