{"version":3,"sources":["webpack:///./js/components/init-tabs.js"],"names":["ACTIVE","whenDomReady","then","tabs","Array","from","document","querySelectorAll","length","forEach","tab","i","tabContent","addEventListener","active","querySelector","activeContent","classList","remove","add","handleClick","bindTabs"],"mappings":"4HAEMA,EAAS,SAmCfC,cAAeC,MAjCf,WACE,IAAMC,EAAOC,MAAMC,KAAKC,SAASC,iBAAiB,yBAC9CJ,EAAKK,OAAS,GAKpB,SAAkBL,GAChBA,EAAKM,SAAQ,SAACC,EAAKC,GACjB,IAAMC,EAAaN,SAASC,iBAAiB,gCAAgCI,GACzEC,GACFF,EAAIG,iBAAiB,SAAS,YAOpC,SAAqBH,EAAKE,GACxB,IAAME,EAASR,SAASS,cAAc,+BAChCC,EAAgBV,SAASS,cAAc,uCAEzCC,GACFA,EAAcC,UAAUC,OAAOlB,GAEjCY,EAAWK,UAAUE,IAAInB,GAErBc,GACFA,EAAOG,UAAUC,OAAOlB,GAE1BU,EAAIO,UAAUE,IAAInB,GAlBZoB,CAAYV,EAAKE,SATrBS,CAASlB","file":"step-by-step-tabs-cbf1a6e53db698e57012.js","sourcesContent":["import whenDomReady from 'when-dom-ready';\r\n\r\nconst ACTIVE = 'active';\r\n\r\nfunction initialise() {\r\n const tabs = Array.from(document.querySelectorAll('.js-step-by-step-tab'));\r\n if (tabs.length > 0) {\r\n bindTabs(tabs);\r\n }\r\n}\r\n\r\nfunction bindTabs(tabs) {\r\n tabs.forEach((tab, i) => {\r\n const tabContent = document.querySelectorAll('.js-step-by-step-tab-content')[i];\r\n if (tabContent) {\r\n tab.addEventListener('click', () => {\r\n handleClick(tab, tabContent);\r\n });\r\n }\r\n });\r\n}\r\n\r\nfunction handleClick(tab, tabContent) {\r\n const active = document.querySelector('.js-step-by-step-tab.active');\r\n const activeContent = document.querySelector('.js-step-by-step-tab-content.active');\r\n\r\n if (activeContent) {\r\n activeContent.classList.remove(ACTIVE);\r\n }\r\n tabContent.classList.add(ACTIVE);\r\n\r\n if (active) {\r\n active.classList.remove(ACTIVE);\r\n }\r\n tab.classList.add(ACTIVE);\r\n}\r\n\r\nwhenDomReady().then(initialise);\r\n"],"sourceRoot":""}