const d=s=>{const i=document.getElementById(s.getAttribute("data-modal")),l=s.getAttribute("data-info");if(i&&l){const r=i.querySelector("[name=product_info]");r&&(r.value=l)}},f=()=>{const s=document.querySelectorAll(".js-price-table"),i=document.querySelectorAll(".js-price-tooltip"),l=()=>{s.forEach(t=>{const o=t.querySelector(".price-table__thead"),n=t.querySelectorAll(".price-table__btn-all"),e=t.querySelectorAll(".js-product-info"),a=()=>{t.getBoundingClientRect().top<=0?o.classList.add("is-sticky","_bg-primary"):o.classList.remove("is-sticky","_bg-primary")};o&&(a(),document.addEventListener("scroll",()=>{a()})),n.length>0&&n.forEach(c=>{c.addEventListener("click",()=>{c.closest(".price-table__card").classList.toggle("is-show")})}),e.length>0&&e.forEach(c=>{c.addEventListener("click",d.bind(null,c))})})},r=()=>{const t=()=>{i.forEach(e=>{e.classList.remove("is-active")})},o=e=>{e.code==="Escape"&&t()},n=()=>{window.addEventListener("click",e=>{e.target.closest(".js-price-tooltip")?n():t()},{once:!0})};i.forEach(e=>{e.addEventListener("click",a=>{a.target.classList.contains("price-table__underline")&&(e.classList.contains("is-active")?t():(t(),e.classList.add("is-active"),window.addEventListener("keydown",o,{once:!0}),window.addEventListener("click",n,{once:!0})))})})};s.length>0&&l(),i.length>0&&r()};export{f as i};
