((e,t,r,n)=>{"use strict";let s;const a=new Map,i={credentials:"omit",method:"GET",mode:"cors"},o=themifyBuilder.blocks,l=e=>{const t=e.parentNode;let r=t.dataset.gap;if(r)r=parseInt(r);else{const e=getComputedStyle(t);r=e.getPropertyValue("grid-template-columns").trim().includes(" ")?parseInt(e.getPropertyValue("grid-row-gap")):-1,t.dataset.gap=r}if(r>0){const t=e.tfClass("predesigned_image")[0].getBoundingClientRect().height+e.tfClass("predesigned_title")[0].getBoundingClientRect().height;e.style.gridRowEnd="span "+Math.ceil((t+r)/r)}},d=new IntersectionObserver(((e,t)=>{for(let n=e.length-1;n>-1;--n)if(!0===e[n].isIntersecting){t.unobserve(e[n].target);let s=e[n].target,a=s.parentNode,i=new Image(500,300),o=r("","tf_loader tf_abs_c"),d=s.tfTag("img")[0],c=d.dataset.src;i.decoding="async",i.src=c,i.title=i.alt=d.alt,s.appendChild(o),l(a),i.decode().catch((()=>{})).finally((()=>{d.replaceWith(i),o.remove(),requestAnimationFrame((()=>{l(a)}))}))}}),{rootMargin:"0px 0px 160px 0px"});e.preDesignedRows=class{constructor(r){r.removeAttribute("data-gap"),this.el=r,s?this.init():t.fetch("",null,i,o+"index.json").then((e=>{s=e,this.init()}),(t=>{e.Spinner.showLoader("error"),this.el.innerHTML='<h3 class="tf_textc">'+themifyBuilder.i18n.label.rows_fetch_error+"</h3>"}))}init(){const e=n(),a=n(),i=this.el.closest(".panel_tab").querySelector(".dropdown_wrap ul"),o=[];for(let n=0;n<s.length;++n){let a=s[n],i=[];if(a.category){let e=a.category.split(",");for(let r=0;r<e.length;++r)""!==e[r]&&(o.includes(e[r])||o.push(e[r]),i.push("tb"+t.hash(e[r])))}let l=r("",{class:"predesigned_row tf_w",draggable:!0,"data-slug":a.slug}),c=r("figure","predesigned_image tf_rel"),p=new Image(500,300);i.length>0&&(l.className+=" "+i.join(" ")),p.alt=p.title=a.title,p.loading="lazy",p.decoding="async",p.src="https://placehold.co/500x300.webp?text="+encodeURI(a.title),a.thumbnail&&(p.dataset.src=a.thumbnail.replace(".jpg",".webp").replace(".png",".webp"),d.observe(c)),c.append(p,r("button",{type:"button",class:"tf_plus_icon add_module_btn tb_disable_sorting tf_rel","data-type":"predesigned"})),l.append(c,r("","predesigned_title",a.title)),e.appendChild(l)}o.sort();for(let e=0;e<o.length;++e)a.appendChild(r("li",{"data-slug":"tb"+t.hash(o[e])},o[e]));this.el.appendChild(e),i.appendChild(a),t.imagesLoad(this.el).then((e=>{i.tfOn(t.click,(e=>{this.filter(e)}),{passive:!0}).parentNode.classList.remove("tf_hidden"),this.el.tfClass("tf_loader")[0]?.remove()}))}filter(e){e.stopPropagation();const t=e.target;if(!t.classList.contains("current")){const r=t.dataset.slug,n=t.closest(".panel_tab"),s=n.tfClass("dropdown_label")[0],a=r||0;s.textContent=t.textContent,s.dataset.active=a,e.isTrusted&&(n.closest(".panel_container").tfClass("panel_search")[0].value="");for(let e=t.parentNode.children,r=e.length-1;r>-1;--r)e[r].classList.toggle("current",e[r]===t);for(let e=n.tfClass("predesigned_row"),t=e.length-1;t>-1;--t)e[t].style.display=!a||e[t].classList.contains(a)?"":"none"}}static async get(r){if(e.Spinner.showLoader(),a.has(r))return a.get(r);try{const n=o+r,s=await t.fetch("",null,i,n+".json");if(e.Helper.clearElementId(s),a.set(r,s),!JSON.stringify(s).includes(e.GS.key))return s;try{const r=await t.fetch("",null,i,n+"-gs.json"),a={};for(let e in r)void 0!==r[e].class?a[r[e].class]=r[e]:a[e]=r[e];return e.GS.setImport(a,s)}catch(e){return s}}catch(t){e.Spinner.showLoader("error"),e.LiteLightBox.alert("row_fetch_error")}}}})(tb_app,Themify,tb_createElement,tb_createDocumentFragment);