((l,e,t)=>{"use strict";let a,r=ThemifyBuilderModuleJs.cssUrl+"gallery_styles/",i=(e=l.w)=>{const t=themify_vars?.breakpoints||{};let a="d";return e<=t.mobile?a="m":e<=t.tablet_landscape[1]&&(a="t"),a},s=l=>{let e=getComputedStyle(l),a=e.getPropertyValue("--galg"),r=~~e.getPropertyValue("--galn");a=""===a?"1.5%":a,0===r&&(r=~~e.getPropertyValue("--gal"+i()));const s=t(a);if(a.includes("px")){const e=l.offsetWidth,a=t((e-(r-1)*s)/r);return t(100*a/e)}return t((100-(r-1)*s)/r).toFixed(2).replace(".00","")};l.on("builder_load_module_partial",((t,o)=>{if(!0===o&&!t.classList.contains("module-gallery"))return;let y=l.selectWithParent("module-gallery",t),g=[];for(let e=y.length-1;e>-1;--e){let t=y[e],a=t.classList;if(a.contains("layout-showcase"))l.loadCss(r+"showcase","tb_gallery_showcase");else if(a.contains("layout-lightboxed"))l.loadCss(r+"lightboxed","tb_gallery_lightboxed");else if(a.contains("layout-grid")){l.loadCss(r+"grid","tb_gallery_grid");let e=t.tfClass("gallery-masonry")[0];e&&(e.style.setProperty("--galw",s(e)+"%"),g.push(e))}}g.length>0&&requestAnimationFrame((()=>{setTimeout((()=>{a||(a=i(),(()=>{let l=".gallery-masonry>.gallery-item{width:var(--galw);display:inline-block}div.gallery-masonry{display:block}.gallery-masonry>.gutter-sizer{width:var(--galg)}",t=e.tfId("tb_inline_styles");null===t?(t=e.createElement("style"),t.textContent=l,e.head.prepend(t)):t.innerText+=l})(),l.on("tfsmartresize",(l=>{const t=i(l.w);if(t!==a){a=t;for(let l=e.tfClass("gallery-masonry"),t=l.length-1;t>-1;--t)l[t].style.setProperty("--galw",s(l[t])+"%")}}))),l.isotop(g,{itemSelector:".gallery-item",columnWidth:!1})}),0)}))})),e.body.tfOn("click",(e=>{const t=e.target?.closest("a"),a=t?.closest(".module-gallery");a&&(t.closest(".pagenav")?(e.preventDefault(),(async(e,t)=>{const a=t.tfClass("module-gallery-grid")[0].dataset.id,r=t.classList;r.add("tf_lazy");try{const r=await l.fetch("","html",{method:"GET"},e.getAttribute("href"));if(r){const e=r.querySelector('[data-id="'+a+'"]').parentNode;t.replaceWith(e),l.lazyScroll(l.convert(l.selectWithParent("[data-lazy]",e)).reverse(),!0)}}catch(l){}r.remove("tf_lazy")})(t,a)):a.classList.contains("layout-showcase")&&(e.preventDefault(),e.stopPropagation(),((e,t)=>{const a=t.tfClass("gallery-showcase-image")[0],r=a.tfClass("gallery-showcase-title")[0],i=a.tfClass("gallery-showcase-title-text")[0],s=a.tfClass("gallery-showcase-caption")[0],o=a.tfTag("img")[0],y=o.getAttribute("width"),g=o.getAttribute("height"),n=new Image;if(r){const l=r.style;r.innerText.trim()?l.opacity=l.visibility="":(l.opacity=0,l.visibility="hidden")}if(a.classList.add("tf_lazy"),i&&(i.innerHTML=e.title),s&&(s.innerHTML=e.dataset.caption),n.decoding="async",n.alt=e.tfTag("img")[0].alt,n.src=e.dataset.image,y&&(n.width=y),g&&(n.height=g),l.is_builder_active){const l=n.dataset;l.orig=e.dataset.orig,l.w=o.dataset.w,l.h=o.dataset.h}n.decode().catch((()=>{})).finally((()=>{o.replaceWith(n),a.classList.remove("tf_lazy")}))})(t,a)))}))})(Themify,document,parseFloat);