(()=>{"use strict";function e(e){e.classList.add("flexa-bg-loaded"),e.removeAttribute("data-flexa-lazy-bg")}let t=null;function a(){t&&(t.remove(),t=null,document.removeEventListener("keydown",n))}function n(e){"Escape"===e.key&&a()}function o(){!function(){const t=document.querySelectorAll("[data-flexa-lazy-bg]");if(!t.length)return;if(void 0===window.IntersectionObserver)return void t.forEach(e);const a=new window.IntersectionObserver((t,a)=>{t.forEach(t=>{t.isIntersecting&&(e(t.target),a.unobserve(t.target))})},{rootMargin:"200px 0px"});t.forEach(e=>a.observe(e))}(),document.querySelectorAll(".flexa-image[data-click]").forEach(e=>{const o=e.dataset.click,c=e.querySelector(".flexa-image__frame");c&&("lightbox"===o?(c.style.cursor="zoom-in",c.addEventListener("click",()=>{const o=c.querySelector(".flexa-image__img"),i=e.dataset.full||o?.currentSrc||o?.src||"";i&&function(e,o,c){a();const i=document.createElement("div");i.className="flexa-image-lightbox",c&&i.style.setProperty("--flexa-lightbox-bg",c);const l=document.createElement("button");l.type="button",l.className="flexa-image-lightbox__close",l.setAttribute("aria-label","Close"),l.textContent="×";const r=document.createElement("figure");r.className="flexa-image-lightbox__figure";const d=document.createElement("img");if(d.className="flexa-image-lightbox__img",d.src=e,d.alt=o||"",r.appendChild(d),o){const e=document.createElement("figcaption");e.className="flexa-image-lightbox__caption",e.textContent=o,r.appendChild(e)}i.appendChild(l),i.appendChild(r),i.addEventListener("click",e=>{e.target!==i&&e.target!==l||a()}),document.body.appendChild(i),t=i,document.addEventListener("keydown",n)}(i,e.dataset.lightboxCaption||"",("dark"===document.documentElement.getAttribute("data-theme")||"dark"===document.body.getAttribute("data-theme")||window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches)&&e.dataset.lightboxBgDark?e.dataset.lightboxBgDark:e.dataset.lightboxBg||"")})):"media"===o&&(c.style.cursor="pointer",c.addEventListener("click",()=>{const t=e.dataset.full;t&&(window.location.href=t)})))})}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",o):o()})();