{"version":3,"sources":["modules.stepByStep.js"],"names":["app","stepByStep","init","document","querySelectorAll","forEach","section","initStepSection","items1","section1","section2","querySelector","items2","prevBtn","nextBtn","let","activeStep","carousel1","EmblaCarousel","viewport1","inViewThreshold","align","containScroll","carousel2","parentElement","setAttribute","item","addEventListener","slideNodes","children","classList","add","index","target","event","remove","scrollTo","viewport2","EmblaAutoHeight","on","embla","onInit","onReInit","selectedScrollSnap","onSettle","dataLayer","pushEvent","pageUrl","window","location","pathname","option"],"mappings":"AAIAA,IAAIC,WAAc,WAChB,aA+GA,MAAO,CACLC,KA9GF,WACEC,SAASC,iBAAiB,wBAAwB,EAAEC,QAAQ,SAAAC,GAC1DC,CAMF,MAAMC,EAASC,EAASL,cAAiB,0BAAuB,EAE1DM,EAAQD,EAAGA,iBAAoBE,sBAAc,EAE7CC,EAASF,EAASN,WAAAA,cAAiB,wBAAuB,EAE1DS,EAAUH,EAASC,cAAc,0BAAuB,EAAxDE,GACOH,EAAWN,iBAAe,sBAAuB,EAD9CM,EAASC,cAAc,sBAAsB,GAK7DG,EAAAJ,EAAAC,cAAA,sBAAA,EAEAI,IAAAC,EAAA,KAMA,MAAEC,EAAA,IAAAC,cAAAC,EAAA,CAHAC,gBAAiB,GAKnBC,MAAA,QACAC,cAAA,WACA,CAAA,EA4BMC,GA1BNN,EAIED,GAAU,OAAGC,SAAAA,GACbD,EAAUQ,cAAcC,aAAa,mBAAA,CAAA,CAAA,GAIrCC,EAAKC,EAAiBC,WAAS,EAAA,GAAAC,SAAW,IACxCC,UAAAC,IAAA,WAAA,CAJJ,CAAC,EAEDvB,EAKIH,QAAA,SAAAqB,EAAAM,GAJFN,EAKEV,iBAAmBiB,QAAM,SAAAC,GAHzBlB,EAAWc,UAAUK,OAAO,WAAW,GAQvCnB,EAAAkB,EAAAD,QACFH,UAAAC,IAAA,WAAA,EAGFR,EAAAa,SAAAJ,EAAA,CAAA,CAAA,CACA,CAAA,CAJA,CAAC,EAMiB,IAAId,cAUtBmB,EACA,CACAjB,gBAAA,GARIC,MAAO,QAUXE,cAAmB,WACjBvB,EACA,CAAAsC,gBAAA,EAAA,GAFFf,EAAUgB,GAAG,OAAQ,SAACL,GAapBlC,IAAAwC,MAAAC,OAAA5B,EAAAC,EAAAuB,EAAAd,CAAA,CAXF,CAAC,EAEDA,EAYEgB,GAAA,SAAA,SAAAL,GACAlB,IAAAA,MAAU0B,SAAS7B,EAAOC,EAAAS,CAAA,CAX5B,CAAC,EAEDA,EAYEgB,GAAA,SAAA,SAAAL,GACAjB,IAAAA,MAAUmB,SAASJ,EAAMlB,EAAAS,CAAA,EAG3BA,IAAAA,EAAaA,EAAUoB,mBAAW,EAGhC3B,EAAAc,UAAAK,OAAA,WAAA,GAVAnB,EAaUO,EAAUoB,IAClBb,UAAAC,IAAA,WAAA,EAVFd,EAAUmB,SAASJ,CAAK,CAc5B,CAAA,EAEE9B,EAAMA,GAAAA,SAAAA,SAAAA,GACPF,IAAAwC,MAAAI,SAAArB,CAAA,EAVGvB,IAAI6C,UAAUC,UAAU,aAAc,CACpCC,QAASC,OAAOC,SAASC,SACzBC,OAAQ5B,EAAUoB,mBAAkB,EAAK,CAC3C,CAAC,CACH,CAAC,CAvGwB,CACzB,CAAC,CACH,CA2GA,CACF,EAAC","file":"../modules.stepByStep.min.js","sourcesContent":["/* ========================================================================\r\n Step by step\r\n ========================================================================== */\r\n\r\napp.stepByStep = (function () {\r\n 'use strict';\r\n\r\n function init() {\r\n document.querySelectorAll('[data-step-carousel-1]').forEach((section) => {\r\n initStepSection(section);\r\n });\r\n }\r\n\r\n function initStepSection(section1) {\r\n const viewport1 = section1.querySelector('[data-carousel-viewport]');\r\n const items1 = section1.querySelectorAll('[data-carousel-item]');\r\n\r\n const section2 = section1.parentNode.querySelector('[data-step-carousel-2]');\r\n const viewport2 = section2.querySelector('[data-carousel-viewport]');\r\n const items2 = section2.querySelectorAll('[data-carousel-item]');\r\n\r\n const prevBtn = section2.querySelector('[data-carousel-prev]');\r\n const nextBtn = section2.querySelector('[data-carousel-next]');\r\n\r\n let activeStep = null;\r\n\r\n //\r\n // Init carousel\r\n //\r\n\r\n const carousel1 = new EmblaCarousel(viewport1, {\r\n inViewThreshold: 0.1,\r\n align: 'start',\r\n containScroll: 'trimSnaps',\r\n });\r\n\r\n //\r\n // Event listeners\r\n //\r\n\r\n carousel1.on('init', (event) => {\r\n viewport1.parentElement.setAttribute('data-initialized', true);\r\n\r\n // Set first item as active\r\n activeStep = carousel1.slideNodes()[0].children[0];\r\n activeStep.classList.add('is-active');\r\n });\r\n\r\n items1.forEach((item, index) => {\r\n item.addEventListener('click', (event) => {\r\n // Remove active class from previous step\r\n activeStep.classList.remove('is-active');\r\n\r\n // Set new active step\r\n activeStep = event.target;\r\n activeStep.classList.add('is-active');\r\n\r\n // Scroll to active step in alt carousel\r\n carousel2.scrollTo(index, true);\r\n });\r\n });\r\n\r\n //\r\n // Init carousel (alt)\r\n //\r\n\r\n const carousel2 = new EmblaCarousel(\r\n viewport2,\r\n {\r\n inViewThreshold: 0.1,\r\n align: 'start',\r\n containScroll: 'trimSnaps',\r\n },\r\n [EmblaAutoHeight()]\r\n );\r\n\r\n //\r\n // Event listeners (alt)\r\n //\r\n\r\n carousel2.on('init', (event) => {\r\n app.embla.onInit(prevBtn, nextBtn, viewport2, carousel2);\r\n });\r\n\r\n carousel2.on('reInit', (event) => {\r\n app.embla.onReInit(prevBtn, nextBtn, carousel2);\r\n });\r\n\r\n carousel2.on('select', (event) => {\r\n app.embla.onSelect(prevBtn, nextBtn, carousel2);\r\n\r\n var index = carousel2.selectedScrollSnap();\r\n\r\n // Remove active class from previous step\r\n activeStep.classList.remove('is-active');\r\n\r\n // Set new active step\r\n activeStep = items1[index];\r\n activeStep.classList.add('is-active');\r\n\r\n // Scroll to active step in carousel\r\n carousel1.scrollTo(index);\r\n });\r\n\r\n carousel2.on('settle', (event) => {\r\n app.embla.onSettle(carousel2);\r\n\r\n // DATALAYER\r\n app.dataLayer.pushEvent('stepByStep', {\r\n pageUrl: window.location.pathname,\r\n option: carousel2.selectedScrollSnap() + 1,\r\n });\r\n });\r\n }\r\n\r\n // Expose public functions and variables\r\n return {\r\n init: init,\r\n };\r\n})();\r\n"]}