(()=>{"use strict";var e,t={8(){const e=e=>{if("yes"===e.dataset.calioFilterableGalleryInit)return;e.dataset.calioFilterableGalleryInit="yes";const t=Array.from(e.querySelectorAll(".calio-filterable-gallery-filter")),l=Array.from(e.querySelectorAll(".calio-filterable-gallery-item")),a=e.querySelector(".calio-filterable-gallery-empty-state"),r=e.querySelector(".calio-filterable-gallery-status"),i=e.querySelector(".calio-filterable-gallery-badges"),o=e.querySelector(".calio-filterable-gallery-load-more"),s=e.querySelector(".calio-filterable-gallery-search-input"),n=e.querySelector(".calio-filterable-gallery-reset"),d=e.querySelector(".calio-filterable-gallery-grid"),c="yes"===e.dataset.loadMore,u=e.classList.contains("filter-motion-shuffle"),f=e.dataset.sortMode||"none",h=Number.parseInt(e.dataset.initialItems||"6",10)||6,m=Number.parseInt(e.dataset.loadMoreCount||"3",10)||3,g=e.dataset.allLoadedText||"All items loaded";let y="all",p="",v=h;if(0===l.length)return;const b=e=>{const t=[...e];return"title-asc"===f?t.sort((e,t)=>(e.dataset.sortTitle||"").localeCompare(t.dataset.sortTitle||"")):"title-desc"===f?t.sort((e,t)=>(t.dataset.sortTitle||"").localeCompare(e.dataset.sortTitle||"")):"category"===f&&t.sort((e,t)=>{const l=(e.dataset.sortCategory||"").localeCompare(t.dataset.sortCategory||"");return 0!==l?l:(e.dataset.sortTitle||"").localeCompare(t.dataset.sortTitle||"")}),t},w=()=>{const s=b((n=y,l.filter(e=>{const t=(e.dataset.filterGroups||"").split(",").map(e=>e.trim()).filter(Boolean),l=(e.dataset.searchText||"").toLowerCase(),a=""===p||l.includes(p);return("all"===n||t.includes(n))&&a})));var n;const f=c?s.slice(0,v):s,h=new Set(f),m=[...s,...b(l.filter(e=>!s.includes(e)))];(e=>{t.forEach(t=>{const l=t.dataset.filter===e;t.classList.toggle("is-active",l),t.setAttribute("aria-selected",l?"true":"false")})})(y),(()=>{if(!i)return;const e=[],l=t.find(e=>e.dataset.filter===y),a=l?.querySelector("span")?.textContent?.trim()||"";"all"!==y&&""!==a&&e.push(`Filter: ${a}`),""!==p&&e.push(`Search: ${p}`),i.replaceChildren(),e.forEach(e=>{const t=document.createElement("span");t.className="calio-filterable-gallery-badge",t.textContent=e,i.appendChild(t)}),i.hidden=0===e.length})(),d&&u?(m.forEach((e,t)=>{e.style.setProperty("--calio-filter-stagger",String(t)),d.appendChild(e)}),d.classList.remove("is-shuffling"),window.requestAnimationFrame(()=>{d.classList.add("is-shuffling")})):f.forEach((e,t)=>{e.style.setProperty("--calio-filter-stagger",String(t))}),l.forEach(e=>{h.has(e)?(e=>{window.clearTimeout(Number(e.dataset.hideTimer||"0")),e.hidden=!1,window.requestAnimationFrame(()=>{e.classList.remove("is-hidden"),e.classList.add("is-visible")})})(e):(e=>{window.clearTimeout(Number(e.dataset.hideTimer||"0")),e.classList.remove("is-visible"),e.classList.add("is-hidden"),e.dataset.hideTimer=String(window.setTimeout(()=>{e.hidden=!0},180))})(e)}),a&&(a.hidden=s.length>0),e.classList.toggle("has-no-results",0===s.length),((e,t)=>{if(r){if(0!==t)return c?e>=t?void(r.textContent=g):void(r.textContent=`${e} / ${t} items`):void(r.textContent=`${t} items`);r.textContent="0 items"}})(f.length,s.length),((e,t)=>{if(!o)return;const l=c&&t>e;o.hidden=!l,o.disabled=!l})(f.length,s.length)},C=e=>{y=e,v=h,w()};t.forEach(e=>{e.addEventListener("click",()=>{C(e.dataset.filter||"all")})}),s&&s.addEventListener("input",()=>{p=s.value.trim().toLowerCase(),v=h,w()}),o&&o.addEventListener("click",()=>{v+=m,w()}),n&&n.addEventListener("click",()=>{y="all",p="",v=h,s&&(s.value=""),w()}),C("all")},t=(t=document)=>{t.querySelectorAll(".calio-filterable-gallery").forEach(e)};document.addEventListener("DOMContentLoaded",()=>{t(document)});let l=!1;const a=()=>!!l||!!window.elementorFrontend?.hooks&&(window.elementorFrontend.hooks.addAction("frontend/element_ready/calio-filterable-gallery.default",e=>{const l=e?.[0]||null;l&&t(l)}),l=!0,!0);if(window.addEventListener("elementor/frontend/init",a),!a()){let e=0;const t=window.setInterval(()=>{e+=1,(a()||e>=40)&&window.clearInterval(t)},250)}}},l={};function a(e){var r=l[e];if(void 0!==r)return r.exports;var i=l[e]={exports:{}};return t[e](i,i.exports,a),i.exports}a.m=t,e=[],a.O=(t,l,r,i)=>{if(!l){var o=1/0;for(c=0;c<e.length;c++){for(var[l,r,i]=e[c],s=!0,n=0;n<l.length;n++)(!1&i||o>=i)&&Object.keys(a.O).every(e=>a.O[e](l[n]))?l.splice(n--,1):(s=!1,i<o&&(o=i));if(s){e.splice(c--,1);var d=r();void 0!==d&&(t=d)}}return t}i=i||0;for(var c=e.length;c>0&&e[c-1][2]>i;c--)e[c]=e[c-1];e[c]=[l,r,i]},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={3871:0,1607:0};a.O.j=t=>0===e[t];var t=(t,l)=>{var r,i,[o,s,n]=l,d=0;if(o.some(t=>0!==e[t])){for(r in s)a.o(s,r)&&(a.m[r]=s[r]);if(n)var c=n(a)}for(t&&t(l);d<o.length;d++)i=o[d],a.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return a.O(c)},l=globalThis.webpackChunkcalio_addon=globalThis.webpackChunkcalio_addon||[];l.forEach(t.bind(null,0)),l.push=t.bind(null,l.push.bind(l))})();var r=a.O(void 0,[1607],()=>a(8));r=a.O(r)})();