(()=>{"use strict";const e="is-open",t="flexa-modal-scroll-lock";let o=null,n=null,l=null,a=!0;function d(){if(!o)return;o.setAttribute("hidden",""),o.setAttribute("aria-hidden","true"),o.classList.remove(e),document.body.classList.remove(t),document.removeEventListener("keydown",c);const a=l;o=null,n=null,l=null,a&&"function"==typeof a.focus&&a.focus()}function c(e){a&&"Escape"===e.key&&d()}function r(r){const u=r.querySelector(".flexa-modal__trigger"),i=r.querySelector(".flexa-modal__root");if(!u||!i)return;const s=i.querySelector(".flexa-modal__box"),f=i.querySelector(".flexa-modal__overlay"),m=i.querySelector(".flexa-modal__close"),y=r.getAttribute("data-flexa-modal-id")||"",b="0"!==r.getAttribute("data-close-overlay"),v="0"!==r.getAttribute("data-close-esc"),x="1"===r.getAttribute("data-show-once"),L="flexaModalSeen:"+y;u.addEventListener("click",r=>{r.preventDefault(),d(),o=i,n=s,l=u,a=v,i.removeAttribute("hidden"),i.setAttribute("aria-hidden","false"),i.classList.add(e),document.body.classList.add(t),document.addEventListener("keydown",c),x&&y&&function(e){try{window.localStorage.setItem(e,"1")}catch(e){}}(L),n&&"function"==typeof n.focus&&(n.setAttribute("tabindex","-1"),n.focus())}),m&&m.addEventListener("click",d),f&&b&&f.addEventListener("click",d),x&&y&&"1"===function(e){try{return window.localStorage.getItem(e)}catch(e){return null}}(L)&&r.classList.add("flexa-modal--seen")}function u(){document.querySelectorAll(".flexa-modal").forEach(r)}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",u):u()})();