{"version":3,"sources":["webpack://@verndale/toolkit/./src/js/helpers/motion.js","webpack://@verndale/toolkit/./src/js/modules/TestimonialCarousel.js"],"names":[],"mappings":"qYAEO,KAAM,GAAO,CAAC,EAAS,EAAW,EAAG,EAAS,CAAC,IAAM,EAAG,IAAM,KACnE,QACE,EACA,CACE,UAAW,GAAG,EAAQ,iBACtB,QAAS,GAEX,CACE,WACA,WAIO,EAAQ,CAAC,EAAS,EAAW,EAAG,EAAS,CAAC,IAAM,EAAG,IAAM,KACpE,QACE,EACA,CACE,UAAW,EACX,QAAS,GAEX,CACE,WACA,WAIO,EAAc,CACzB,EACA,EAAW,EACX,EAAQ,EACR,EAAS,CAAC,IAAM,EAAG,IAAM,KAEzB,QACE,EACA,CACE,QAAS,GAEX,CACE,WACA,QACA,WAIO,EAAc,CACzB,EACA,EAAW,EACX,EAAQ,EACR,EAAS,CAAC,IAAM,EAAG,IAAM,KAEzB,QACE,EACA,CACE,QAAS,GAEX,CACE,WACA,QACA,WAIO,EAAO,CAClB,EACA,EAAW,EACX,EAAQ,EACR,EAAS,CAAC,IAAM,EAAG,IAAM,KAEzB,QACE,EACA,CACE,aAAc,SAEhB,CACE,WACA,QACA,WAIO,EAAO,CAClB,EACA,EAAe,EACf,EAAW,EACX,EAAQ,EACR,EAAS,CAAC,IAAM,EAAG,IAAM,KAEzB,QACE,EACA,CACE,gBAEF,CACE,WACA,QACA,WAIO,EAAiB,CAC5B,EACA,EAAQ,GACR,EAAW,GACX,EAAS,CAAC,IAAM,EAAG,GAAK,KAExB,QACE,EACA,CACE,QAAS,EACT,WAAY,GAEd,CACE,QACA,WACA,WAIO,EAAc,CACzB,EACA,EAAQ,GACR,EAAW,GACX,EAAS,CAAC,IAAM,EAAG,GAAK,KAExB,QACE,EACA,CACE,QAAS,EACT,WAAY,IAEd,CACE,QACA,WACA,WAIO,EAAc,CACzB,EACA,EAAQ,GACR,EAAW,GACX,EAAS,CAAC,IAAM,EAAG,GAAK,KAExB,QACE,EACA,CACE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AAK,GACF,cAAc,0CACd,UAKT,cAAe,CACb,KAAK,OAAO,GACV,oBACA,KAAK,6BAA6B,KAAK,OAEzC,KAAK,OAAO,GACV,6BACA,KAAK,iCAAiC,KAAK,OAI/C,iBAAiB,EAAQ,CACvB,EAAW,SACT,KAAK,IAAI,eAAe,MAAM,QAAU,OAExC,KAAK,IAAI,eAAe,MAAM,eAAe,WAIjD,sBAAuB,CACrB,KAAS,IAAI,iBAAiB,UAC5B,MAAK,IAAI,iBAAiB,UAAU,OAAO,iBAC3C,KAAK,IAAI,iBAAiB,QAExB,KAAK,IAAI,iBAAiB,UAC5B,MAAK,IAAI,iBAAiB,UAAU,OAAO,iBAC3C,KAAK,IAAI,iBAAiB,QAI9B,6BAA6B,EAAQ,CACnC,KAAK,IAAI,aAAa,QAAQ,CAAC,EAAS,IAAU,CAChD,IAAc,EAAO,aACd,MAAK,WACJ,GAAQ,KACV,GAAQ,KAAK,OACb,sBAAsB,IAAM,CAC1B,EAAQ,MAAM,WAAa,UAC3B,EAAQ,KAAO,SAAY,EAAS,MAGtC,GAAQ,MAAM,WAAa,UAC3B,EAAQ,KAAO,SAAY,EAAS,QAK5C,KAAK,uBAGP,iCAAiC,EAAQ,CACvC,KAAK,IAAI,aAAa,QAAQ,CAAC,EAAS,IAAU,CAChD,IAAc,EAAO,eACd,MAAK,WACJ,GAAQ,MAAM,EAAQ,KAAK,OAC/B,EAAQ,KAAO,SAAY,EAAS,EAAG,IACvC,EAAQ,KAAK,SAAS,KAAK,IAAM,CAC/B,EAAQ,MAAM,WAAa,gBAQvC,UAAe","file":"scripts/9686.0209fae7bffb7fc85410.js","sourcesContent":["import { animate } from 'motion';\n\nexport const open = (element, duration = 1, easing = [0.19, 1, 0.22, 1]) =>\n  animate(\n    element,\n    {\n      maxHeight: `${element.scrollHeight}px`,\n      opacity: 1\n    },\n    {\n      duration,\n      easing\n    }\n  );\n\nexport const close = (element, duration = 1, easing = [0.19, 1, 0.22, 1]) =>\n  animate(\n    element,\n    {\n      maxHeight: 0,\n      opacity: 0\n    },\n    {\n      duration,\n      easing\n    }\n  );\n\nexport const hideOpacity = (\n  element,\n  duration = 1,\n  delay = 0,\n  easing = [0.19, 1, 0.22, 1]\n) =>\n  animate(\n    element,\n    {\n      opacity: 0\n    },\n    {\n      duration,\n      delay,\n      easing\n    }\n  );\n\nexport const showOpacity = (\n  element,\n  duration = 1,\n  delay = 0,\n  easing = [0.19, 1, 0.22, 1]\n) =>\n  animate(\n    element,\n    {\n      opacity: 1\n    },\n    {\n      duration,\n      delay,\n      easing\n    }\n  );\n\nexport const show = (\n  element,\n  duration = 1,\n  delay = 0,\n  easing = [0.19, 1, 0.22, 1]\n) =>\n  animate(\n    element,\n    {\n      maxBlockSize: 'unset'\n    },\n    {\n      duration,\n      delay,\n      easing\n    }\n  );\n\nexport const hide = (\n  element,\n  maxBlockSize = 0,\n  duration = 1,\n  delay = 0,\n  easing = [0.19, 1, 0.22, 1]\n) =>\n  animate(\n    element,\n    {\n      maxBlockSize\n    },\n    {\n      duration,\n      delay,\n      easing\n    }\n  );\n\nexport const showFromBottom = (\n  element,\n  delay = 0.2,\n  duration = 0.2,\n  easing = [0.11, 0, 0.5, 0]\n) =>\n  animate(\n    element,\n    {\n      opacity: 1,\n      translateY: 0\n    },\n    {\n      delay,\n      duration,\n      easing\n    }\n  );\n\nexport const hideFromTop = (\n  element,\n  delay = 0.2,\n  duration = 0.2,\n  easing = [0.11, 0, 0.5, 0]\n) =>\n  animate(\n    element,\n    {\n      opacity: 0,\n      translateY: 30\n    },\n    {\n      delay,\n      duration,\n      easing\n    }\n  );\n\nexport const hideToRight = (\n  element,\n  delay = 0.2,\n  duration = 0.2,\n  easing = [0.11, 0, 0.5, 0]\n) =>\n  animate(\n    element,\n    {\n      opacity: 0,\n      translateX: 90\n    },\n    {\n      delay,\n      duration,\n      easing\n    }\n  );\n\nexport const hideToLeft = (\n  element,\n  delay = 0.2,\n  duration = 0.2,\n  easing = [0.11, 0, 0.5, 0]\n) =>\n  animate(\n    element,\n    {\n      opacity: 0,\n      translateX: -90\n    },\n    {\n      delay,\n      duration,\n      easing\n    }\n  );\n","import { Component } from '@verndale/core';\nimport Swiper, { Navigation, Pagination, A11y } from 'swiper';\nimport { hideOpacity, showOpacity } from '../helpers/motion';\n\nSwiper.use([Navigation, Pagination, A11y]);\n\nclass TestimonialCarousel extends Component {\n  setupDefaults() {\n    this.dom = {\n      swiperContainer: this.el.querySelector(\n        '.testimonial-carousel__swiper-container'\n      ),\n      swiperSlides: this.el.querySelectorAll(\n        '.testimonial-carousel__swiper-slide'\n      ),\n      swiperPagination: this.el.querySelector(\n        '.testimonial-carousel__swiper-pagination'\n      ),\n      swiperButtonPrev: this.el.querySelector(\n        '.testimonial-carousel__swiper-btn-prev'\n      ),\n      swiperButtonNext: this.el.querySelector(\n        '.testimonial-carousel__swiper-btn-next'\n      ),\n      swiperControls: this.el.querySelector(\n        '.testimonial-carousel__swiper-controls'\n      )\n    };\n\n    this.rewind = this.el.dataset.rewind;\n    this.clickableDots = this.el.dataset.clickableDots;\n    this.isEditing = this.el.dataset.isEditing;\n    this.initSlider();\n  }\n\n  initSlider() {\n    this.swiper = new Swiper(this.dom.swiperContainer, {\n      speed: 1000,\n      spaceBetween: 40,\n      autoHeight: false,\n      rewind: this.rewind,\n      breakpoints: {\n        768: {\n          speed: 1500,\n          spaceBetween: 50\n        },\n        1440: {\n          speed: 1500,\n          spaceBetween: 90\n        }\n      },\n      pagination: {\n        el: this.dom.swiperPagination,\n        clickable: this.clickableDots\n      },\n      navigation: {\n        prevEl: this.dom.swiperButtonPrev,\n        nextEl: this.dom.swiperButtonNext,\n        navigationDisabledClass: 'webo'\n      },\n      a11y: {\n        prevSlideMessage: this.el.dataset.previousSlideAriaLabel,\n        nextSlideMessage: this.el.dataset.nextSlideAriaLabel\n      },\n      on: {\n        init: this.toggleNavigation.bind(this)\n      }\n    });\n\n    this.dom.swiperSlides.forEach((element, index) => {\n      if (!this.isEditing) {\n        if (index !== 0)\n          hideOpacity(element, 0.1).finished.then(() => {\n            element.style.visibility = 'hidden';\n          });\n      }\n    });\n\n    if (this.dom.swiperSlides.length === 1) {\n      if (!this.isEditing) {\n        this.el\n          .querySelector('.testimonial-carousel__swiper-controls')\n          .remove();\n      }\n    }\n  }\n\n  addListeners() {\n    this.swiper.on(\n      'activeIndexChange',\n      this.handleSlideActiveIndexChange.bind(this)\n    );\n    this.swiper.on(\n      'slideChangeTransitionStart',\n      this.handleSlideChangeTransitionStart.bind(this)\n    );\n  }\n\n  toggleNavigation(swiper) {\n    if (swiper.isLocked) {\n      this.dom.swiperControls.style.display = 'none';\n    } else {\n      this.dom.swiperControls.style.removeProperty('display');\n    }\n  }\n\n  checkNavigationState() {\n    if (this.dom.swiperButtonNext.disabled) {\n      this.dom.swiperButtonNext.classList.remove('focus-visible');\n      this.dom.swiperButtonNext.blur();\n    }\n    if (this.dom.swiperButtonPrev.disabled) {\n      this.dom.swiperButtonPrev.classList.remove('focus-visible');\n      this.dom.swiperButtonPrev.blur();\n    }\n  }\n\n  handleSlideActiveIndexChange(swiper) {\n    this.dom.swiperSlides.forEach((element, index) => {\n      if (index === swiper.activeIndex) {\n        if (!this.isEditing) {\n          if (element.anim) {\n            element.anim.stop();\n            requestAnimationFrame(() => {\n              element.style.visibility = 'visible';\n              element.anim = showOpacity(element, 1);\n            });\n          } else {\n            element.style.visibility = 'visible';\n            element.anim = showOpacity(element, 1);\n          }\n        }\n      }\n    });\n    this.checkNavigationState();\n  }\n\n  handleSlideChangeTransitionStart(swiper) {\n    this.dom.swiperSlides.forEach((element, index) => {\n      if (index === swiper.previousIndex) {\n        if (!this.isEditing) {\n          if (element.anim) element.anim.stop();\n          element.anim = hideOpacity(element, 1, 0.5);\n          element.anim.finished.then(() => {\n            element.style.visibility = 'hidden';\n          });\n        }\n      }\n    });\n  }\n}\n\nexport default TestimonialCarousel;\n"],"sourceRoot":""}