import{h as f,r as w,a as g,b as C,d as _}from"./helpers-C6yshgUn.js";import{e as i,s as d}from"./config-CkUiWPd2.js";import{G as E}from"./glide.esm-0w1bDAP_.js";import{a as b}from"./Video-BgyV9E7X.js";const I=(t,e)=>{const r=()=>{document.fullscreenElement&&document.exitFullscreen()};Array.from(t).forEach((n,o)=>n.addEventListener("click",s=>{if(s.preventDefault(),!s.target.hasAttribute("data-toggle-fullscreen"))return;const l=e[o],a=l.requestFullScreen||l.webkitRequestFullScreen||l.mozRequestFullScreen||l.msRequestFullScreen;a&&r(a.call(l))}))},A=t=>{const e=()=>{const[r,n]=[document.createElement("input"),window.location.href];document.body.appendChild(r),r.value=n,r.select(),document.execCommand("copy"),document.body.removeChild(r),alert("Másolás sikeres!")};[...t].forEach(r=>{r.addEventListener("click",e)})},u=({sliderClassName:t,sliderCloneClassName:e,iterationFormOne:r}={sliderClassName:"glide__slide",sliderCloneClassName:"glide__slide--clone",iterationFormOne:!0})=>{const n=[...document.querySelectorAll(`.-gallerySlider .${t}:not(.${e})`)];n.forEach((a,c)=>{a.dataset.slideId=r?c+1:c});const o=n.find(a=>f(a,"glide__slide--active")),{slideId:s,imageFileName:l}=o.dataset;return{slideId:s,imageFileName:l??null,allSlidesNumber:n.length}},m=({counter:t,summa:e}={counter:void 0,summa:void 0})=>{const[r,n]=[i.galleryPageIndicator,i.galleryPageIndicatorSumma],o=u();r.textContent=t??o.slideId,n.textContent=e??String(o.allSlidesNumber)},T=(t,e="gallery")=>{if(!window.location.search.includes(`${e}=`))return;i.galleryTrigger.checked=!0;const r=window.location.search.match("/[0-9]+")[0].slice(1);m({counter:r}),t.update({startAt:Number(r)-1})},y=(t="gallery",e="1")=>{const r=u(),{slideId:n,imageFileName:o}=r;((l,a,c,v)=>{const p=new URL(window.location.origin+window.location.pathname);return p.searchParams.set(l,a),window.history.pushState("",document.title,p.href+`/${c}/${v}`)})(t,e,n,o??"banner")},h=(t,e="-visible",r=".glide__description",n=".glide__slide--active.-gallery")=>{var l;const o=(l=document.querySelector(n))==null?void 0:l.id,s=[...document.querySelectorAll(r)];s.forEach(a=>w(a,e)),s.filter(a=>a.dataset.id===o).map(a=>g(a,e))},S=(t,e)=>{try{return window.tagging.renderAsync(t,e)}catch(r){window.tagging&&window.tagging.log(r)}return null},P=(t="-cts",e="glide__cts")=>{var n;return(n=[...document.querySelectorAll(`.glide__slide.${t}`)].find(o=>f(o,"glide__slide--active")))==null?void 0:n.querySelector(`.${e}`)},$=(t="-cts",e="glide__cts")=>{const r=[...document.querySelectorAll(`.glide__slide.${t}`)],n=P(t,e);return r.forEach(o=>{const s=o==null?void 0:o.querySelector(`.${e}`);s.innerHTML=""}),n&&S(n.dataset.ctsPosition,`[data-gallery-cts-id="${n.dataset.galleryCtsId}"]`),null},L=t=>{const e=document.querySelector(t),r=new CustomEvent("_ce_measure_item",{bubbles:!0,detail:{target:e,type:"swipe"}});return window.dispatchEvent(r)},k=(t="_ce_gallery_pagination")=>window.dispatchEvent(new Event(t)),q=()=>{var t;return(t=window.dataLayer)==null?void 0:t.push({event:"galleryPagination"})},F=t=>{const e=u(),{slideId:r}=e;if(r!==t)return r>=t},B=(t,e,r)=>{const{forward:n,backward:o}=d.carousel.controls,s=t().slideId;e!==s&&e&&L(r?n:o)},D=(t,e)=>{let[r,n,o]=[0,!1,!1];const s={before(){r=u().slideId},after(){n=F(r),m(),h(),$(),!o&&B(u,r,n),y(e.urlQueryParam),k(),q()}};[i.galleryNextButton,i.galleryPrevButton].forEach(c=>{c.onmouseenter=()=>{o=!0},c.onmouseleave=()=>{o=!1}});const l=()=>{if(!i.galleryTrigger.checked&&window.location.search)return C();h(),m(),y(e.urlQueryParam),S(e.ctsConfig.asideCtsSlug,`[data-cts-position="${e.ctsConfig.asideCtsSlug}"]`)},a=new E(t,e.carousel);Object.keys(s).forEach(c=>{a.on(`run.${c}`,s[c])}),a.mount(),i.galleryTrigger.addEventListener("change",l,!1),T(a,e.urlQueryParam)},N=(t=d.carousel.gallerySlider)=>{if(!document.querySelectorAll(`${t} .glide__slide`).length)return;const e={carousel:{type:"carousel",perView:1,focusAt:"center"},ctsConfig:{asideCtsSlug:"gallery-content010"},urlQueryParam:"gallery"};I(i.fullScreen,i.fullPicture),A(i.galleryLink),D(t,e)};class H{constructor(e,r){this.targetItem=e,this.deadline=r,window.onscroll=()=>{this.scrolling()}}scrolling(){let{targetItem:e,offsetTop:r,offsetBottom:n,deadline:o}=this;const s=(document.body.scrollTop||document.documentElement.scrollTop)+e.getBoundingClientRect().top+e.scrollHeight,l=[e,d.active];if(o&&(r=window.pageYOffset+o.getBoundingClientRect().top,n=r+o.scrollHeight),s>=r&&s<=n){g(...l);return}f(...l)&&w(...l)}}const M=(t=null,e)=>{t&&new H(t,e)},R=()=>{const t=encodeURIComponent(document.getElementsByTagName("H1")[0].textContent);i.email.forEach(e=>{e.setAttribute("href",`mailto:?Subject=Nosalty:20%${t};Body=${t} receptje: ${window.location.href}`)})};class U{constructor(e){this.targetItem=e,this.selectTab()}selectTab(){const{targetItem:e}=this;e.forEach(r=>{const n=()=>{if(r.checked){for(const o of e)o.checked=!1;r.checked=!0}};r.addEventListener("click",n,!1)})}}const G=t=>{t&&new U(t)},Q=t=>{if(!i.preLoader)return;const e=[i.preLoader,d.pageVisible],r=[i.preLoader,d.pageHidden],n=window.performance.timing.domContentLoadedEventEnd-window.performance.timing.navigationStart,o=()=>{g(...e)},s=l=>{g(...r),w(...e),setTimeout(()=>{window.location.href=l.getAttribute("href")},n)};Array.from(t).filter(l=>{l.getAttribute("href").startsWith("#")||l.addEventListener("click",()=>{s(l)},!1)}),window.addEventListener("load",o,!1)};_(()=>{N(),b(),Q(i.transitionToPageAnchors),R(),G(i.accordionTabButton),M(i.recipeDrawer,i.recipeDrawerDeadline)});