import { k as elementTransitionEnd } from './utils.mjs'; function effectVirtualTransitionEnd(_ref) { let { swiper, duration, transformElements, allSlides } = _ref; const { activeIndex } = swiper; const getSlide = el => { if (!el.parentElement) { // assume shadow root const slide = swiper.slides.filter(slideEl => slideEl.shadowRoot && slideEl.shadowRoot === el.parentNode)[0]; return slide; } return el.parentElement; }; if (swiper.params.virtualTranslate && duration !== 0) { let eventTriggered = false; let transitionEndTarget; if (allSlides) { transitionEndTarget = transformElements; } else { transitionEndTarget = transformElements.filter(transformEl => { const el = transformEl.classList.contains('swiper-slide-transform') ? getSlide(transformEl) : transformEl; return swiper.getSlideIndex(el) === activeIndex; }); } transitionEndTarget.forEach(el => { elementTransitionEnd(el, () => { if (eventTriggered) return; if (!swiper || swiper.destroyed) return; eventTriggered = true; swiper.animating = false; const evt = new window.CustomEvent('transitionend', { bubbles: true, cancelable: true }); swiper.wrapperEl.dispatchEvent(evt); }); }); } } export { effectVirtualTransitionEnd as e };