{"version":3,"file":"/etc.clientlibs/corp-aem-sherwin/components/teasercarousel/clientlibs/site-teasercarousel/site-teasercarousel.0b67dacace30de1edf70.js","mappings":"8IAEA,IAAAA,IAAG,oBAAqB,0BAA4BC,IAClD,MAAM,OAACC,EAAM,OAAEC,GAAUF,EACnBG,EAA6BC,MAAMC,KACvCJ,EAAOK,uBAAuB,4BAE1BC,EAA2BN,EAAOK,uBACtC,8BACA,GACIE,GAAeD,EAASE,QAAQD,IAChCE,EAAgB,CAAEA,GAClBA,EAAQ,EAAUF,EAAM,EACnBE,GAASF,EAAY,EAEvBE,EAJa,CAKnBR,EAAOQ,OAEVH,EAASI,aAAa,eAAgB,IAAMD,EAAQ,IAEpDP,EAAOS,QAASC,IACdA,EAAMF,aAAa,cAAe,UAGpCR,EAAOO,GAAOI,gBAAgB,kBAGhC,IAAAf,IAAG,QAAS,0BAA2B,WACrC,MACMQ,EAD8BQ,KACMC,QACxC,+BAEIC,GAAmBV,EAASE,QAAQQ,QAAU,GAEpD,IAAAC,MAAKX,EAASS,QAAQ,2BAA4B,oBAAqB,CACrEN,OACGO,GAR+BF,KAStBI,UAAUC,SAAS,iCAAmC,EAAI,IAE1E,E","sources":["webpack://aem-maven-archetype/../ui.apps/src/main/content/jcr_root/apps/corp-aem-sherwin/components/teasercarousel/teasercarousel.site.ts"],"sourcesContent":["import {on, fire} from 'delegated-events';\n\non('carousel:navigate', '.sw-teasercarousel__cnt', (event: any): void => {\n  const {target, detail} = event;\n  const slides: Array<HTMLElement> = Array.from(\n    target.getElementsByClassName('sw-teasercarousel__item')\n  );\n  const actionEl: HTMLDivElement = target.getElementsByClassName(\n    'sw-teasercarousel__actions'\n  )[0];\n  const max: number = +actionEl.dataset.max;\n  const index: number = ((index) => {\n    if (index < 0) return max - 1;\n    else if (index >= max) return 0;\n\n    return index;\n  })(detail.index);\n\n  actionEl.setAttribute('data-current', '' + (index + 1));\n\n  slides.forEach((slide) => {\n    slide.setAttribute('aria-hidden', 'true');\n  });\n\n  slides[index].removeAttribute('aria-hidden');\n});\n\non('click', '.sw-teasercarousel__btn', function (): void {\n  const buttonEl = <HTMLButtonElement>this;\n  const actionEl: HTMLDivElement = buttonEl.closest(\n    '.sw-teasercarousel__actions'\n  );\n  const current: number = +actionEl.dataset.current - 1;\n\n  fire(actionEl.closest('.sw-teasercarousel__cnt'), 'carousel:navigate', {\n    index:\n      +current +\n      (buttonEl.classList.contains('sw-teasercarousel__btn--prev') ? -1 : 1),\n  });\n});\n"],"names":["on","event","target","detail","slides","Array","from","getElementsByClassName","actionEl","max","dataset","index","setAttribute","forEach","slide","removeAttribute","this","closest","current","fire","classList","contains"],"sourceRoot":""}