window.addEventListener("DOMContentLoaded",()=>{"function"==typeof GLightbox&&(window.gallerybergLightboxes=window.gallerybergLightboxes||new Map,document.querySelectorAll(".galleryberg-gallery-container.galleryberg-has-lightbox").forEach(e=>{const t=e.querySelectorAll("img"),o="true"===e.getAttribute("data-show-lightbox-captions"),a=Array.from(t).map(e=>{const t=e.closest("figure"),a=t?t.querySelector("figcaption"):null,r=o&&a?a.innerHTML:"";return{href:e.getAttribute("data-src")||e.currentSrc||e.src,type:"image",title:e.title||"",description:r}}),r=e.getAttribute("data-open-effect")||"zoom",i=e.getAttribute("data-close-effect")||"zoom",l=e.getAttribute("data-slide-effect")||"slide",n="false"!==e.getAttribute("data-keyboard-navigation"),g="false"!==e.getAttribute("data-loop"),c="false"!==e.getAttribute("data-zoomable"),s="false"!==e.getAttribute("data-draggable"),d=GLightbox({elements:a,keyboardNavigation:n,loop:g,zoomable:c,draggable:s,openEffect:r,closeEffect:i,slideEffect:l}),b=`lightbox-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;e.dataset.lightboxId=b,window.gallerybergLightboxes.set(b,d),t.forEach((e,t)=>{e.style.cursor="pointer",e.addEventListener("click",e=>{e.preventDefault(),d.openAt(t)});const o=e.closest("figure");if(o){const e=o.querySelector("figcaption.caption-type-full-overlay, figcaption.caption-type-bar-overlay");e&&(e.style.cursor="pointer",e.addEventListener("click",e=>{e.preventDefault(),d.openAt(t)}))}})}))});