@bigbinary/neeto-site-blocks 1.10.6 → 1.10.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -17460,6 +17460,13 @@ function getWindow() {
17460
17460
  return win;
17461
17461
  }
17462
17462
 
17463
+ function classesToTokens(classes) {
17464
+ if (classes === void 0) {
17465
+ classes = '';
17466
+ }
17467
+ return classes.trim().split(' ').filter(c => !!c.trim());
17468
+ }
17469
+
17463
17470
  function deleteProps(obj) {
17464
17471
  const object = obj;
17465
17472
  Object.keys(object).forEach(key => {
@@ -17636,12 +17643,20 @@ function elementChildren(element, selector) {
17636
17643
  }
17637
17644
  return [...element.children].filter(el => el.matches(selector));
17638
17645
  }
17646
+ function showWarning(text) {
17647
+ try {
17648
+ console.warn(text);
17649
+ return;
17650
+ } catch (err) {
17651
+ // err
17652
+ }
17653
+ }
17639
17654
  function createElement(tag, classes) {
17640
17655
  if (classes === void 0) {
17641
17656
  classes = [];
17642
17657
  }
17643
17658
  const el = document.createElement(tag);
17644
- el.classList.add(...(Array.isArray(classes) ? classes : [classes]));
17659
+ el.classList.add(...(Array.isArray(classes) ? classes : classesToTokens(classes)));
17645
17660
  return el;
17646
17661
  }
17647
17662
  function elementOffset(el) {
@@ -17790,6 +17805,7 @@ function getDevice(overrides) {
17790
17805
  let browser$1;
17791
17806
  function calcBrowser() {
17792
17807
  const window = getWindow();
17808
+ const device = getDevice();
17793
17809
  let needPerspectiveFix = false;
17794
17810
  function isSafari() {
17795
17811
  const ua = window.navigator.userAgent.toLowerCase();
@@ -17802,10 +17818,14 @@ function calcBrowser() {
17802
17818
  needPerspectiveFix = major < 16 || major === 16 && minor < 2;
17803
17819
  }
17804
17820
  }
17821
+ const isWebView = /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(window.navigator.userAgent);
17822
+ const isSafariBrowser = isSafari();
17823
+ const need3dFix = isSafariBrowser || isWebView && device.ios;
17805
17824
  return {
17806
- isSafari: needPerspectiveFix || isSafari(),
17825
+ isSafari: needPerspectiveFix || isSafariBrowser,
17807
17826
  needPerspectiveFix,
17808
- isWebView: /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(window.navigator.userAgent)
17827
+ need3dFix,
17828
+ isWebView
17809
17829
  };
17810
17830
  }
17811
17831
  function getBrowser() {
@@ -18094,24 +18114,8 @@ function updateSize() {
18094
18114
 
18095
18115
  function updateSlides() {
18096
18116
  const swiper = this;
18097
- function getDirectionLabel(property) {
18098
- if (swiper.isHorizontal()) {
18099
- return property;
18100
- }
18101
- // prettier-ignore
18102
- return {
18103
- 'width': 'height',
18104
- 'margin-top': 'margin-left',
18105
- 'margin-bottom ': 'margin-right',
18106
- 'margin-left': 'margin-top',
18107
- 'margin-right': 'margin-bottom',
18108
- 'padding-left': 'padding-top',
18109
- 'padding-right': 'padding-bottom',
18110
- 'marginRight': 'marginBottom'
18111
- }[property];
18112
- }
18113
18117
  function getDirectionPropertyValue(node, label) {
18114
- return parseFloat(node.getPropertyValue(getDirectionLabel(label)) || 0);
18118
+ return parseFloat(node.getPropertyValue(swiper.getDirectionLabel(label)) || 0);
18115
18119
  }
18116
18120
  const params = swiper.params;
18117
18121
  const {
@@ -18170,7 +18174,9 @@ function updateSlides() {
18170
18174
  }
18171
18175
  const gridEnabled = params.grid && params.grid.rows > 1 && swiper.grid;
18172
18176
  if (gridEnabled) {
18173
- swiper.grid.initSlides(slidesLength);
18177
+ swiper.grid.initSlides(slides);
18178
+ } else if (swiper.grid) {
18179
+ swiper.grid.unsetSlides();
18174
18180
  }
18175
18181
 
18176
18182
  // Calc slides
@@ -18183,13 +18189,13 @@ function updateSlides() {
18183
18189
  let slide;
18184
18190
  if (slides[i]) slide = slides[i];
18185
18191
  if (gridEnabled) {
18186
- swiper.grid.updateSlide(i, slide, slidesLength, getDirectionLabel);
18192
+ swiper.grid.updateSlide(i, slide, slides);
18187
18193
  }
18188
18194
  if (slides[i] && elementStyle(slide, 'display') === 'none') continue; // eslint-disable-line
18189
18195
 
18190
18196
  if (params.slidesPerView === 'auto') {
18191
18197
  if (shouldResetSlideSize) {
18192
- slides[i].style[getDirectionLabel('width')] = ``;
18198
+ slides[i].style[swiper.getDirectionLabel('width')] = ``;
18193
18199
  }
18194
18200
  const slideStyles = getComputedStyle(slide);
18195
18201
  const currentTransform = slide.style.transform;
@@ -18231,7 +18237,7 @@ function updateSlides() {
18231
18237
  slideSize = (swiperSize - (params.slidesPerView - 1) * spaceBetween) / params.slidesPerView;
18232
18238
  if (params.roundLengths) slideSize = Math.floor(slideSize);
18233
18239
  if (slides[i]) {
18234
- slides[i].style[getDirectionLabel('width')] = `${slideSize}px`;
18240
+ slides[i].style[swiper.getDirectionLabel('width')] = `${slideSize}px`;
18235
18241
  }
18236
18242
  }
18237
18243
  if (slides[i]) {
@@ -18261,10 +18267,10 @@ function updateSlides() {
18261
18267
  wrapperEl.style.width = `${swiper.virtualSize + spaceBetween}px`;
18262
18268
  }
18263
18269
  if (params.setWrapperSize) {
18264
- wrapperEl.style[getDirectionLabel('width')] = `${swiper.virtualSize + spaceBetween}px`;
18270
+ wrapperEl.style[swiper.getDirectionLabel('width')] = `${swiper.virtualSize + spaceBetween}px`;
18265
18271
  }
18266
18272
  if (gridEnabled) {
18267
- swiper.grid.updateWrapperSize(slideSize, snapGrid, getDirectionLabel);
18273
+ swiper.grid.updateWrapperSize(slideSize, snapGrid);
18268
18274
  }
18269
18275
 
18270
18276
  // Remove last grid elements depending on width
@@ -18301,7 +18307,7 @@ function updateSlides() {
18301
18307
  }
18302
18308
  if (snapGrid.length === 0) snapGrid = [0];
18303
18309
  if (spaceBetween !== 0) {
18304
- const key = swiper.isHorizontal() && rtl ? 'marginLeft' : getDirectionLabel('marginRight');
18310
+ const key = swiper.isHorizontal() && rtl ? 'marginLeft' : swiper.getDirectionLabel('marginRight');
18305
18311
  slides.filter((_, slideIndex) => {
18306
18312
  if (!params.cssMode || params.loop) return true;
18307
18313
  if (slideIndex === slides.length - 1) {
@@ -18331,8 +18337,9 @@ function updateSlides() {
18331
18337
  allSlidesSize += slideSizeValue + (spaceBetween || 0);
18332
18338
  });
18333
18339
  allSlidesSize -= spaceBetween;
18334
- if (allSlidesSize < swiperSize) {
18335
- const allSlidesOffset = (swiperSize - allSlidesSize) / 2;
18340
+ const offsetSize = (params.slidesOffsetBefore || 0) + (params.slidesOffsetAfter || 0);
18341
+ if (allSlidesSize + offsetSize < swiperSize) {
18342
+ const allSlidesOffset = (swiperSize - allSlidesSize - offsetSize) / 2;
18336
18343
  snapGrid.forEach((snap, snapIndex) => {
18337
18344
  snapGrid[snapIndex] = snap - allSlidesOffset;
18338
18345
  });
@@ -18368,6 +18375,7 @@ function updateSlides() {
18368
18375
  if (params.watchSlidesProgress) {
18369
18376
  swiper.updateSlidesOffset();
18370
18377
  }
18378
+ swiper.emit('slidesUpdated');
18371
18379
  if (!isVirtual && !params.cssMode && (params.effect === 'slide' || params.effect === 'fade')) {
18372
18380
  const backFaceHiddenClass = `${params.containerModifierClass}backface-hidden`;
18373
18381
  const hasClassBackfaceClassAdded = swiper.el.classList.contains(backFaceHiddenClass);
@@ -18435,6 +18443,13 @@ function updateSlidesOffset() {
18435
18443
  }
18436
18444
  }
18437
18445
 
18446
+ const toggleSlideClasses$1 = (slideEl, condition, className) => {
18447
+ if (condition && !slideEl.classList.contains(className)) {
18448
+ slideEl.classList.add(className);
18449
+ } else if (!condition && slideEl.classList.contains(className)) {
18450
+ slideEl.classList.remove(className);
18451
+ }
18452
+ };
18438
18453
  function updateSlidesProgress(translate) {
18439
18454
  if (translate === void 0) {
18440
18455
  translate = this && this.translate || 0;
@@ -18450,11 +18465,6 @@ function updateSlidesProgress(translate) {
18450
18465
  if (typeof slides[0].swiperSlideOffset === 'undefined') swiper.updateSlidesOffset();
18451
18466
  let offsetCenter = -translate;
18452
18467
  if (rtl) offsetCenter = translate;
18453
-
18454
- // Visible Slides
18455
- slides.forEach(slideEl => {
18456
- slideEl.classList.remove(params.slideVisibleClass);
18457
- });
18458
18468
  swiper.visibleSlidesIndexes = [];
18459
18469
  swiper.visibleSlides = [];
18460
18470
  let spaceBetween = params.spaceBetween;
@@ -18473,12 +18483,14 @@ function updateSlidesProgress(translate) {
18473
18483
  const originalSlideProgress = (offsetCenter - snapGrid[0] + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slide.swiperSlideSize + spaceBetween);
18474
18484
  const slideBefore = -(offsetCenter - slideOffset);
18475
18485
  const slideAfter = slideBefore + swiper.slidesSizesGrid[i];
18486
+ const isFullyVisible = slideBefore >= 0 && slideBefore <= swiper.size - swiper.slidesSizesGrid[i];
18476
18487
  const isVisible = slideBefore >= 0 && slideBefore < swiper.size - 1 || slideAfter > 1 && slideAfter <= swiper.size || slideBefore <= 0 && slideAfter >= swiper.size;
18477
18488
  if (isVisible) {
18478
18489
  swiper.visibleSlides.push(slide);
18479
18490
  swiper.visibleSlidesIndexes.push(i);
18480
- slides[i].classList.add(params.slideVisibleClass);
18481
18491
  }
18492
+ toggleSlideClasses$1(slide, isVisible, params.slideVisibleClass);
18493
+ toggleSlideClasses$1(slide, isFullyVisible, params.slideFullyVisibleClass);
18482
18494
  slide.progress = rtl ? -slideProgress : slideProgress;
18483
18495
  slide.originalProgress = rtl ? -originalSlideProgress : originalSlideProgress;
18484
18496
  }
@@ -18547,6 +18559,13 @@ function updateProgress(translate) {
18547
18559
  swiper.emit('progress', progress);
18548
18560
  }
18549
18561
 
18562
+ const toggleSlideClasses = (slideEl, condition, className) => {
18563
+ if (condition && !slideEl.classList.contains(className)) {
18564
+ slideEl.classList.add(className);
18565
+ } else if (!condition && slideEl.classList.contains(className)) {
18566
+ slideEl.classList.remove(className);
18567
+ }
18568
+ };
18550
18569
  function updateSlidesClasses() {
18551
18570
  const swiper = this;
18552
18571
  const {
@@ -18556,13 +18575,13 @@ function updateSlidesClasses() {
18556
18575
  activeIndex
18557
18576
  } = swiper;
18558
18577
  const isVirtual = swiper.virtual && params.virtual.enabled;
18578
+ const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1;
18559
18579
  const getFilteredSlide = selector => {
18560
18580
  return elementChildren(slidesEl, `.${params.slideClass}${selector}, swiper-slide${selector}`)[0];
18561
18581
  };
18562
- slides.forEach(slideEl => {
18563
- slideEl.classList.remove(params.slideActiveClass, params.slideNextClass, params.slidePrevClass);
18564
- });
18565
18582
  let activeSlide;
18583
+ let prevSlide;
18584
+ let nextSlide;
18566
18585
  if (isVirtual) {
18567
18586
  if (params.loop) {
18568
18587
  let slideIndex = activeIndex - swiper.virtual.slidesBefore;
@@ -18573,29 +18592,34 @@ function updateSlidesClasses() {
18573
18592
  activeSlide = getFilteredSlide(`[data-swiper-slide-index="${activeIndex}"]`);
18574
18593
  }
18575
18594
  } else {
18576
- activeSlide = slides[activeIndex];
18595
+ if (gridEnabled) {
18596
+ activeSlide = slides.filter(slideEl => slideEl.column === activeIndex)[0];
18597
+ nextSlide = slides.filter(slideEl => slideEl.column === activeIndex + 1)[0];
18598
+ prevSlide = slides.filter(slideEl => slideEl.column === activeIndex - 1)[0];
18599
+ } else {
18600
+ activeSlide = slides[activeIndex];
18601
+ }
18577
18602
  }
18578
18603
  if (activeSlide) {
18579
- // Active classes
18580
- activeSlide.classList.add(params.slideActiveClass);
18604
+ if (!gridEnabled) {
18605
+ // Next Slide
18606
+ nextSlide = elementNextAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0];
18607
+ if (params.loop && !nextSlide) {
18608
+ nextSlide = slides[0];
18609
+ }
18581
18610
 
18582
- // Next Slide
18583
- let nextSlide = elementNextAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0];
18584
- if (params.loop && !nextSlide) {
18585
- nextSlide = slides[0];
18586
- }
18587
- if (nextSlide) {
18588
- nextSlide.classList.add(params.slideNextClass);
18589
- }
18590
- // Prev Slide
18591
- let prevSlide = elementPrevAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0];
18592
- if (params.loop && !prevSlide === 0) {
18593
- prevSlide = slides[slides.length - 1];
18594
- }
18595
- if (prevSlide) {
18596
- prevSlide.classList.add(params.slidePrevClass);
18611
+ // Prev Slide
18612
+ prevSlide = elementPrevAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0];
18613
+ if (params.loop && !prevSlide === 0) {
18614
+ prevSlide = slides[slides.length - 1];
18615
+ }
18597
18616
  }
18598
18617
  }
18618
+ slides.forEach(slideEl => {
18619
+ toggleSlideClasses(slideEl, slideEl === activeSlide, params.slideActiveClass);
18620
+ toggleSlideClasses(slideEl, slideEl === nextSlide, params.slideNextClass);
18621
+ toggleSlideClasses(slideEl, slideEl === prevSlide, params.slidePrevClass);
18622
+ });
18599
18623
  swiper.emitSlidesClasses();
18600
18624
  }
18601
18625
 
@@ -18718,22 +18742,37 @@ function updateActiveIndex(newActiveIndex) {
18718
18742
  snapIndex = skip + Math.floor((activeIndex - skip) / params.slidesPerGroup);
18719
18743
  }
18720
18744
  if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1;
18721
- if (activeIndex === previousIndex) {
18745
+ if (activeIndex === previousIndex && !swiper.params.loop) {
18722
18746
  if (snapIndex !== previousSnapIndex) {
18723
18747
  swiper.snapIndex = snapIndex;
18724
18748
  swiper.emit('snapIndexChange');
18725
18749
  }
18726
- if (swiper.params.loop && swiper.virtual && swiper.params.virtual.enabled) {
18727
- swiper.realIndex = getVirtualRealIndex(activeIndex);
18728
- }
18729
18750
  return;
18730
18751
  }
18752
+ if (activeIndex === previousIndex && swiper.params.loop && swiper.virtual && swiper.params.virtual.enabled) {
18753
+ swiper.realIndex = getVirtualRealIndex(activeIndex);
18754
+ return;
18755
+ }
18756
+ const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1;
18757
+
18731
18758
  // Get real index
18732
18759
  let realIndex;
18733
18760
  if (swiper.virtual && params.virtual.enabled && params.loop) {
18734
18761
  realIndex = getVirtualRealIndex(activeIndex);
18762
+ } else if (gridEnabled) {
18763
+ const firstSlideInColumn = swiper.slides.filter(slideEl => slideEl.column === activeIndex)[0];
18764
+ let activeSlideIndex = parseInt(firstSlideInColumn.getAttribute('data-swiper-slide-index'), 10);
18765
+ if (Number.isNaN(activeSlideIndex)) {
18766
+ activeSlideIndex = Math.max(swiper.slides.indexOf(firstSlideInColumn), 0);
18767
+ }
18768
+ realIndex = Math.floor(activeSlideIndex / params.grid.rows);
18735
18769
  } else if (swiper.slides[activeIndex]) {
18736
- realIndex = parseInt(swiper.slides[activeIndex].getAttribute('data-swiper-slide-index') || activeIndex, 10);
18770
+ const slideIndex = swiper.slides[activeIndex].getAttribute('data-swiper-slide-index');
18771
+ if (slideIndex) {
18772
+ realIndex = parseInt(slideIndex, 10);
18773
+ } else {
18774
+ realIndex = activeIndex;
18775
+ }
18737
18776
  } else {
18738
18777
  realIndex = activeIndex;
18739
18778
  }
@@ -18958,6 +18997,7 @@ function translateTo(translate, speed, runCallbacks, translateBounds, internal)
18958
18997
  swiper.wrapperEl.removeEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd);
18959
18998
  swiper.onTranslateToWrapperTransitionEnd = null;
18960
18999
  delete swiper.onTranslateToWrapperTransitionEnd;
19000
+ swiper.animating = false;
18961
19001
  if (runCallbacks) {
18962
19002
  swiper.emit('transitionEnd');
18963
19003
  }
@@ -19065,9 +19105,6 @@ function slideTo(index, speed, runCallbacks, internal, initial) {
19065
19105
  if (index === void 0) {
19066
19106
  index = 0;
19067
19107
  }
19068
- if (speed === void 0) {
19069
- speed = this.params.speed;
19070
- }
19071
19108
  if (runCallbacks === void 0) {
19072
19109
  runCallbacks = true;
19073
19110
  }
@@ -19087,9 +19124,12 @@ function slideTo(index, speed, runCallbacks, internal, initial) {
19087
19124
  wrapperEl,
19088
19125
  enabled
19089
19126
  } = swiper;
19090
- if (swiper.animating && params.preventInteractionOnTransition || !enabled && !internal && !initial) {
19127
+ if (!enabled && !internal && !initial || swiper.destroyed || swiper.animating && params.preventInteractionOnTransition) {
19091
19128
  return false;
19092
19129
  }
19130
+ if (typeof speed === 'undefined') {
19131
+ speed = swiper.params.speed;
19132
+ }
19093
19133
  const skip = Math.min(swiper.params.slidesPerGroupSkip, slideIndex);
19094
19134
  let snapIndex = skip + Math.floor((slideIndex - skip) / swiper.params.slidesPerGroup);
19095
19135
  if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1;
@@ -19216,9 +19256,6 @@ function slideToLoop(index, speed, runCallbacks, internal) {
19216
19256
  if (index === void 0) {
19217
19257
  index = 0;
19218
19258
  }
19219
- if (speed === void 0) {
19220
- speed = this.params.speed;
19221
- }
19222
19259
  if (runCallbacks === void 0) {
19223
19260
  runCallbacks = true;
19224
19261
  }
@@ -19227,23 +19264,69 @@ function slideToLoop(index, speed, runCallbacks, internal) {
19227
19264
  index = indexAsNumber;
19228
19265
  }
19229
19266
  const swiper = this;
19267
+ if (swiper.destroyed) return;
19268
+ if (typeof speed === 'undefined') {
19269
+ speed = swiper.params.speed;
19270
+ }
19271
+ const gridEnabled = swiper.grid && swiper.params.grid && swiper.params.grid.rows > 1;
19230
19272
  let newIndex = index;
19231
19273
  if (swiper.params.loop) {
19232
19274
  if (swiper.virtual && swiper.params.virtual.enabled) {
19233
19275
  // eslint-disable-next-line
19234
19276
  newIndex = newIndex + swiper.virtual.slidesBefore;
19235
19277
  } else {
19236
- newIndex = swiper.getSlideIndexByData(newIndex);
19278
+ let targetSlideIndex;
19279
+ if (gridEnabled) {
19280
+ const slideIndex = newIndex * swiper.params.grid.rows;
19281
+ targetSlideIndex = swiper.slides.filter(slideEl => slideEl.getAttribute('data-swiper-slide-index') * 1 === slideIndex)[0].column;
19282
+ } else {
19283
+ targetSlideIndex = swiper.getSlideIndexByData(newIndex);
19284
+ }
19285
+ const cols = gridEnabled ? Math.ceil(swiper.slides.length / swiper.params.grid.rows) : swiper.slides.length;
19286
+ const {
19287
+ centeredSlides
19288
+ } = swiper.params;
19289
+ let slidesPerView = swiper.params.slidesPerView;
19290
+ if (slidesPerView === 'auto') {
19291
+ slidesPerView = swiper.slidesPerViewDynamic();
19292
+ } else {
19293
+ slidesPerView = Math.ceil(parseFloat(swiper.params.slidesPerView, 10));
19294
+ if (centeredSlides && slidesPerView % 2 === 0) {
19295
+ slidesPerView = slidesPerView + 1;
19296
+ }
19297
+ }
19298
+ let needLoopFix = cols - targetSlideIndex < slidesPerView;
19299
+ if (centeredSlides) {
19300
+ needLoopFix = needLoopFix || targetSlideIndex < Math.ceil(slidesPerView / 2);
19301
+ }
19302
+ if (internal && centeredSlides && swiper.params.slidesPerView !== 'auto' && !gridEnabled) {
19303
+ needLoopFix = false;
19304
+ }
19305
+ if (needLoopFix) {
19306
+ const direction = centeredSlides ? targetSlideIndex < swiper.activeIndex ? 'prev' : 'next' : targetSlideIndex - swiper.activeIndex - 1 < swiper.params.slidesPerView ? 'next' : 'prev';
19307
+ swiper.loopFix({
19308
+ direction,
19309
+ slideTo: true,
19310
+ activeSlideIndex: direction === 'next' ? targetSlideIndex + 1 : targetSlideIndex - cols + 1,
19311
+ slideRealIndex: direction === 'next' ? swiper.realIndex : undefined
19312
+ });
19313
+ }
19314
+ if (gridEnabled) {
19315
+ const slideIndex = newIndex * swiper.params.grid.rows;
19316
+ newIndex = swiper.slides.filter(slideEl => slideEl.getAttribute('data-swiper-slide-index') * 1 === slideIndex)[0].column;
19317
+ } else {
19318
+ newIndex = swiper.getSlideIndexByData(newIndex);
19319
+ }
19237
19320
  }
19238
19321
  }
19239
- return swiper.slideTo(newIndex, speed, runCallbacks, internal);
19322
+ requestAnimationFrame(() => {
19323
+ swiper.slideTo(newIndex, speed, runCallbacks, internal);
19324
+ });
19325
+ return swiper;
19240
19326
  }
19241
19327
 
19242
19328
  /* eslint no-unused-vars: "off" */
19243
19329
  function slideNext(speed, runCallbacks, internal) {
19244
- if (speed === void 0) {
19245
- speed = this.params.speed;
19246
- }
19247
19330
  if (runCallbacks === void 0) {
19248
19331
  runCallbacks = true;
19249
19332
  }
@@ -19253,7 +19336,10 @@ function slideNext(speed, runCallbacks, internal) {
19253
19336
  params,
19254
19337
  animating
19255
19338
  } = swiper;
19256
- if (!enabled) return swiper;
19339
+ if (!enabled || swiper.destroyed) return swiper;
19340
+ if (typeof speed === 'undefined') {
19341
+ speed = swiper.params.speed;
19342
+ }
19257
19343
  let perGroup = params.slidesPerGroup;
19258
19344
  if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) {
19259
19345
  perGroup = Math.max(swiper.slidesPerViewDynamic('current', true), 1);
@@ -19269,7 +19355,7 @@ function slideNext(speed, runCallbacks, internal) {
19269
19355
  swiper._clientLeft = swiper.wrapperEl.clientLeft;
19270
19356
  if (swiper.activeIndex === swiper.slides.length - 1 && params.cssMode) {
19271
19357
  requestAnimationFrame(() => {
19272
- swiper.slideTo(swiper.activeIndex + increment);
19358
+ swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal);
19273
19359
  });
19274
19360
  return true;
19275
19361
  }
@@ -19277,14 +19363,11 @@ function slideNext(speed, runCallbacks, internal) {
19277
19363
  if (params.rewind && swiper.isEnd) {
19278
19364
  return swiper.slideTo(0, speed, runCallbacks, internal);
19279
19365
  }
19280
- return swiper.slideTo(swiper.activeIndex + increment);
19366
+ return swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal);
19281
19367
  }
19282
19368
 
19283
19369
  /* eslint no-unused-vars: "off" */
19284
19370
  function slidePrev(speed, runCallbacks, internal) {
19285
- if (speed === void 0) {
19286
- speed = this.params.speed;
19287
- }
19288
19371
  if (runCallbacks === void 0) {
19289
19372
  runCallbacks = true;
19290
19373
  }
@@ -19297,7 +19380,10 @@ function slidePrev(speed, runCallbacks, internal) {
19297
19380
  enabled,
19298
19381
  animating
19299
19382
  } = swiper;
19300
- if (!enabled) return swiper;
19383
+ if (!enabled || swiper.destroyed) return swiper;
19384
+ if (typeof speed === 'undefined') {
19385
+ speed = swiper.params.speed;
19386
+ }
19301
19387
  const isVirtual = swiper.virtual && params.virtual.enabled;
19302
19388
  if (params.loop) {
19303
19389
  if (animating && !isVirtual && params.loopPreventsSliding) return false;
@@ -19350,21 +19436,19 @@ function slidePrev(speed, runCallbacks, internal) {
19350
19436
 
19351
19437
  /* eslint no-unused-vars: "off" */
19352
19438
  function slideReset(speed, runCallbacks, internal) {
19353
- if (speed === void 0) {
19354
- speed = this.params.speed;
19355
- }
19356
19439
  if (runCallbacks === void 0) {
19357
19440
  runCallbacks = true;
19358
19441
  }
19359
19442
  const swiper = this;
19443
+ if (swiper.destroyed) return;
19444
+ if (typeof speed === 'undefined') {
19445
+ speed = swiper.params.speed;
19446
+ }
19360
19447
  return swiper.slideTo(swiper.activeIndex, speed, runCallbacks, internal);
19361
19448
  }
19362
19449
 
19363
19450
  /* eslint no-unused-vars: "off" */
19364
19451
  function slideToClosest(speed, runCallbacks, internal, threshold) {
19365
- if (speed === void 0) {
19366
- speed = this.params.speed;
19367
- }
19368
19452
  if (runCallbacks === void 0) {
19369
19453
  runCallbacks = true;
19370
19454
  }
@@ -19372,6 +19456,10 @@ function slideToClosest(speed, runCallbacks, internal, threshold) {
19372
19456
  threshold = 0.5;
19373
19457
  }
19374
19458
  const swiper = this;
19459
+ if (swiper.destroyed) return;
19460
+ if (typeof speed === 'undefined') {
19461
+ speed = swiper.params.speed;
19462
+ }
19375
19463
  let index = swiper.activeIndex;
19376
19464
  const skip = Math.min(swiper.params.slidesPerGroupSkip, index);
19377
19465
  const snapIndex = skip + Math.floor((index - skip) / swiper.params.slidesPerGroup);
@@ -19400,6 +19488,7 @@ function slideToClosest(speed, runCallbacks, internal, threshold) {
19400
19488
 
19401
19489
  function slideToClickedSlide() {
19402
19490
  const swiper = this;
19491
+ if (swiper.destroyed) return;
19403
19492
  const {
19404
19493
  params,
19405
19494
  slidesEl
@@ -19452,10 +19541,45 @@ function loopCreate(slideRealIndex) {
19452
19541
  slidesEl
19453
19542
  } = swiper;
19454
19543
  if (!params.loop || swiper.virtual && swiper.params.virtual.enabled) return;
19455
- const slides = elementChildren(slidesEl, `.${params.slideClass}, swiper-slide`);
19456
- slides.forEach((el, index) => {
19457
- el.setAttribute('data-swiper-slide-index', index);
19458
- });
19544
+ const initSlides = () => {
19545
+ const slides = elementChildren(slidesEl, `.${params.slideClass}, swiper-slide`);
19546
+ slides.forEach((el, index) => {
19547
+ el.setAttribute('data-swiper-slide-index', index);
19548
+ });
19549
+ };
19550
+ const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1;
19551
+ const slidesPerGroup = params.slidesPerGroup * (gridEnabled ? params.grid.rows : 1);
19552
+ const shouldFillGroup = swiper.slides.length % slidesPerGroup !== 0;
19553
+ const shouldFillGrid = gridEnabled && swiper.slides.length % params.grid.rows !== 0;
19554
+ const addBlankSlides = amountOfSlides => {
19555
+ for (let i = 0; i < amountOfSlides; i += 1) {
19556
+ const slideEl = swiper.isElement ? createElement('swiper-slide', [params.slideBlankClass]) : createElement('div', [params.slideClass, params.slideBlankClass]);
19557
+ swiper.slidesEl.append(slideEl);
19558
+ }
19559
+ };
19560
+ if (shouldFillGroup) {
19561
+ if (params.loopAddBlankSlides) {
19562
+ const slidesToAdd = slidesPerGroup - swiper.slides.length % slidesPerGroup;
19563
+ addBlankSlides(slidesToAdd);
19564
+ swiper.recalcSlides();
19565
+ swiper.updateSlides();
19566
+ } else {
19567
+ showWarning('Swiper Loop Warning: The number of slides is not even to slidesPerGroup, loop mode may not function properly. You need to add more slides (or make duplicates, or empty slides)');
19568
+ }
19569
+ initSlides();
19570
+ } else if (shouldFillGrid) {
19571
+ if (params.loopAddBlankSlides) {
19572
+ const slidesToAdd = params.grid.rows - swiper.slides.length % params.grid.rows;
19573
+ addBlankSlides(slidesToAdd);
19574
+ swiper.recalcSlides();
19575
+ swiper.updateSlides();
19576
+ } else {
19577
+ showWarning('Swiper Loop Warning: The number of slides is not even to grid.rows, loop mode may not function properly. You need to add more slides (or make duplicates, or empty slides)');
19578
+ }
19579
+ initSlides();
19580
+ } else {
19581
+ initSlides();
19582
+ }
19459
19583
  swiper.loopFix({
19460
19584
  slideRealIndex,
19461
19585
  direction: params.centeredSlides ? undefined : 'next'
@@ -19482,6 +19606,9 @@ function loopFix(_temp) {
19482
19606
  slidesEl,
19483
19607
  params
19484
19608
  } = swiper;
19609
+ const {
19610
+ centeredSlides
19611
+ } = params;
19485
19612
  swiper.allowSlidePrev = true;
19486
19613
  swiper.allowSlideNext = true;
19487
19614
  if (swiper.virtual && params.virtual.enabled) {
@@ -19499,17 +19626,33 @@ function loopFix(_temp) {
19499
19626
  swiper.emit('loopFix');
19500
19627
  return;
19501
19628
  }
19502
- const slidesPerView = params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : Math.ceil(parseFloat(params.slidesPerView, 10));
19503
- let loopedSlides = params.loopedSlides || slidesPerView;
19504
- if (loopedSlides % params.slidesPerGroup !== 0) {
19505
- loopedSlides += params.slidesPerGroup - loopedSlides % params.slidesPerGroup;
19629
+ let slidesPerView = params.slidesPerView;
19630
+ if (slidesPerView === 'auto') {
19631
+ slidesPerView = swiper.slidesPerViewDynamic();
19632
+ } else {
19633
+ slidesPerView = Math.ceil(parseFloat(params.slidesPerView, 10));
19634
+ if (centeredSlides && slidesPerView % 2 === 0) {
19635
+ slidesPerView = slidesPerView + 1;
19636
+ }
19506
19637
  }
19638
+ const slidesPerGroup = params.slidesPerGroupAuto ? slidesPerView : params.slidesPerGroup;
19639
+ let loopedSlides = slidesPerGroup;
19640
+ if (loopedSlides % slidesPerGroup !== 0) {
19641
+ loopedSlides += slidesPerGroup - loopedSlides % slidesPerGroup;
19642
+ }
19643
+ loopedSlides += params.loopAdditionalSlides;
19507
19644
  swiper.loopedSlides = loopedSlides;
19645
+ const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1;
19646
+ if (slides.length < slidesPerView + loopedSlides) {
19647
+ showWarning('Swiper Loop Warning: The number of slides is not enough for loop mode, it will be disabled and not function properly. You need to add more slides (or make duplicates) or lower the values of slidesPerView and slidesPerGroup parameters');
19648
+ } else if (gridEnabled && params.grid.fill === 'row') {
19649
+ showWarning('Swiper Loop Warning: Loop mode is not compatible with grid.fill = `row`');
19650
+ }
19508
19651
  const prependSlidesIndexes = [];
19509
19652
  const appendSlidesIndexes = [];
19510
19653
  let activeIndex = swiper.activeIndex;
19511
19654
  if (typeof activeSlideIndex === 'undefined') {
19512
- activeSlideIndex = swiper.getSlideIndex(swiper.slides.filter(el => el.classList.contains(params.slideActiveClass))[0]);
19655
+ activeSlideIndex = swiper.getSlideIndex(slides.filter(el => el.classList.contains(params.slideActiveClass))[0]);
19513
19656
  } else {
19514
19657
  activeIndex = activeSlideIndex;
19515
19658
  }
@@ -19517,37 +19660,64 @@ function loopFix(_temp) {
19517
19660
  const isPrev = direction === 'prev' || !direction;
19518
19661
  let slidesPrepended = 0;
19519
19662
  let slidesAppended = 0;
19663
+ const cols = gridEnabled ? Math.ceil(slides.length / params.grid.rows) : slides.length;
19664
+ const activeColIndex = gridEnabled ? slides[activeSlideIndex].column : activeSlideIndex;
19665
+ const activeColIndexWithShift = activeColIndex + (centeredSlides && typeof setTranslate === 'undefined' ? -slidesPerView / 2 + 0.5 : 0);
19520
19666
  // prepend last slides before start
19521
- if (activeSlideIndex < loopedSlides) {
19522
- slidesPrepended = Math.max(loopedSlides - activeSlideIndex, params.slidesPerGroup);
19523
- for (let i = 0; i < loopedSlides - activeSlideIndex; i += 1) {
19524
- const index = i - Math.floor(i / slides.length) * slides.length;
19525
- prependSlidesIndexes.push(slides.length - index - 1);
19526
- }
19527
- } else if (activeSlideIndex /* + slidesPerView */ > swiper.slides.length - loopedSlides * 2) {
19528
- slidesAppended = Math.max(activeSlideIndex - (swiper.slides.length - loopedSlides * 2), params.slidesPerGroup);
19667
+ if (activeColIndexWithShift < loopedSlides) {
19668
+ slidesPrepended = Math.max(loopedSlides - activeColIndexWithShift, slidesPerGroup);
19669
+ for (let i = 0; i < loopedSlides - activeColIndexWithShift; i += 1) {
19670
+ const index = i - Math.floor(i / cols) * cols;
19671
+ if (gridEnabled) {
19672
+ const colIndexToPrepend = cols - index - 1;
19673
+ for (let i = slides.length - 1; i >= 0; i -= 1) {
19674
+ if (slides[i].column === colIndexToPrepend) prependSlidesIndexes.push(i);
19675
+ }
19676
+ // slides.forEach((slide, slideIndex) => {
19677
+ // if (slide.column === colIndexToPrepend) prependSlidesIndexes.push(slideIndex);
19678
+ // });
19679
+ } else {
19680
+ prependSlidesIndexes.push(cols - index - 1);
19681
+ }
19682
+ }
19683
+ } else if (activeColIndexWithShift + slidesPerView > cols - loopedSlides) {
19684
+ slidesAppended = Math.max(activeColIndexWithShift - (cols - loopedSlides * 2), slidesPerGroup);
19529
19685
  for (let i = 0; i < slidesAppended; i += 1) {
19530
- const index = i - Math.floor(i / slides.length) * slides.length;
19531
- appendSlidesIndexes.push(index);
19686
+ const index = i - Math.floor(i / cols) * cols;
19687
+ if (gridEnabled) {
19688
+ slides.forEach((slide, slideIndex) => {
19689
+ if (slide.column === index) appendSlidesIndexes.push(slideIndex);
19690
+ });
19691
+ } else {
19692
+ appendSlidesIndexes.push(index);
19693
+ }
19532
19694
  }
19533
19695
  }
19696
+ swiper.__preventObserver__ = true;
19697
+ requestAnimationFrame(() => {
19698
+ swiper.__preventObserver__ = false;
19699
+ });
19534
19700
  if (isPrev) {
19535
19701
  prependSlidesIndexes.forEach(index => {
19536
- swiper.slides[index].swiperLoopMoveDOM = true;
19537
- slidesEl.prepend(swiper.slides[index]);
19538
- swiper.slides[index].swiperLoopMoveDOM = false;
19702
+ slides[index].swiperLoopMoveDOM = true;
19703
+ slidesEl.prepend(slides[index]);
19704
+ slides[index].swiperLoopMoveDOM = false;
19539
19705
  });
19540
19706
  }
19541
19707
  if (isNext) {
19542
19708
  appendSlidesIndexes.forEach(index => {
19543
- swiper.slides[index].swiperLoopMoveDOM = true;
19544
- slidesEl.append(swiper.slides[index]);
19545
- swiper.slides[index].swiperLoopMoveDOM = false;
19709
+ slides[index].swiperLoopMoveDOM = true;
19710
+ slidesEl.append(slides[index]);
19711
+ slides[index].swiperLoopMoveDOM = false;
19546
19712
  });
19547
19713
  }
19548
19714
  swiper.recalcSlides();
19549
19715
  if (params.slidesPerView === 'auto') {
19550
19716
  swiper.updateSlides();
19717
+ } else if (gridEnabled && (prependSlidesIndexes.length > 0 && isPrev || appendSlidesIndexes.length > 0 && isNext)) {
19718
+ swiper.slides.forEach((slide, slideIndex) => {
19719
+ swiper.grid.updateSlide(slideIndex, slide, swiper.slides);
19720
+ });
19551
19721
  }
19552
19722
  if (params.watchSlidesProgress) {
19553
19723
  swiper.updateSlidesOffset();
@@ -19561,15 +19731,16 @@ function loopFix(_temp) {
19561
19731
  if (byMousewheel) {
19562
19732
  swiper.setTranslate(swiper.translate - diff);
19563
19733
  } else {
19564
- swiper.slideTo(activeIndex + slidesPrepended, 0, false, true);
19734
+ swiper.slideTo(activeIndex + Math.ceil(slidesPrepended), 0, false, true);
19565
19735
  if (setTranslate) {
19566
- swiper.touches[swiper.isHorizontal() ? 'startX' : 'startY'] += diff;
19567
- swiper.touchEventsData.currentTranslate = swiper.translate;
19736
+ swiper.touchEventsData.startTranslate = swiper.touchEventsData.startTranslate - diff;
19737
+ swiper.touchEventsData.currentTranslate = swiper.touchEventsData.currentTranslate - diff;
19568
19738
  }
19569
19739
  }
19570
19740
  } else {
19571
19741
  if (setTranslate) {
19572
- swiper.slideToLoop(slideRealIndex, 0, false, true);
19742
+ const shift = gridEnabled ? prependSlidesIndexes.length / params.grid.rows : prependSlidesIndexes.length;
19743
+ swiper.slideTo(swiper.activeIndex + shift, 0, false, true);
19573
19744
  swiper.touchEventsData.currentTranslate = swiper.translate;
19574
19745
  }
19575
19746
  }
@@ -19583,12 +19754,13 @@ function loopFix(_temp) {
19583
19754
  } else {
19584
19755
  swiper.slideTo(activeIndex - slidesAppended, 0, false, true);
19585
19756
  if (setTranslate) {
19586
- swiper.touches[swiper.isHorizontal() ? 'startX' : 'startY'] += diff;
19587
- swiper.touchEventsData.currentTranslate = swiper.translate;
19757
+ swiper.touchEventsData.startTranslate = swiper.touchEventsData.startTranslate - diff;
19758
+ swiper.touchEventsData.currentTranslate = swiper.touchEventsData.currentTranslate - diff;
19588
19759
  }
19589
19760
  }
19590
19761
  } else {
19591
- swiper.slideToLoop(slideRealIndex, 0, false, true);
19762
+ const shift = gridEnabled ? appendSlidesIndexes.length / params.grid.rows : appendSlidesIndexes.length;
19763
+ swiper.slideTo(swiper.activeIndex - shift, 0, false, true);
19592
19764
  }
19593
19765
  }
19594
19766
  }
@@ -19701,27 +19873,54 @@ function closestElement(selector, base) {
19701
19873
  }
19702
19874
  return __closestFrom(base);
19703
19875
  }
19876
+ function preventEdgeSwipe(swiper, event, startX) {
19877
+ const window = getWindow();
19878
+ const {
19879
+ params
19880
+ } = swiper;
19881
+ const edgeSwipeDetection = params.edgeSwipeDetection;
19882
+ const edgeSwipeThreshold = params.edgeSwipeThreshold;
19883
+ if (edgeSwipeDetection && (startX <= edgeSwipeThreshold || startX >= window.innerWidth - edgeSwipeThreshold)) {
19884
+ if (edgeSwipeDetection === 'prevent') {
19885
+ event.preventDefault();
19886
+ return true;
19887
+ }
19888
+ return false;
19889
+ }
19890
+ return true;
19891
+ }
19704
19892
  function onTouchStart(event) {
19705
19893
  const swiper = this;
19706
19894
  const document = getDocument();
19707
- const window = getWindow();
19895
+ let e = event;
19896
+ if (e.originalEvent) e = e.originalEvent;
19708
19897
  const data = swiper.touchEventsData;
19709
- data.evCache.push(event);
19898
+ if (e.type === 'pointerdown') {
19899
+ if (data.pointerId !== null && data.pointerId !== e.pointerId) {
19900
+ return;
19901
+ }
19902
+ data.pointerId = e.pointerId;
19903
+ } else if (e.type === 'touchstart' && e.targetTouches.length === 1) {
19904
+ data.touchId = e.targetTouches[0].identifier;
19905
+ }
19906
+ if (e.type === 'touchstart') {
19907
+ // don't proceed touch event
19908
+ preventEdgeSwipe(swiper, e, e.targetTouches[0].pageX);
19909
+ return;
19910
+ }
19710
19911
  const {
19711
19912
  params,
19712
19913
  touches,
19713
19914
  enabled
19714
19915
  } = swiper;
19715
19916
  if (!enabled) return;
19716
- if (!params.simulateTouch && event.pointerType === 'mouse') return;
19917
+ if (!params.simulateTouch && e.pointerType === 'mouse') return;
19717
19918
  if (swiper.animating && params.preventInteractionOnTransition) {
19718
19919
  return;
19719
19920
  }
19720
19921
  if (!swiper.animating && params.cssMode && params.loop) {
19721
19922
  swiper.loopFix();
19722
19923
  }
19723
- let e = event;
19724
- if (e.originalEvent) e = e.originalEvent;
19725
19924
  let targetEl = e.target;
19726
19925
  if (params.touchEventsTarget === 'wrapper') {
19727
19926
  if (!swiper.wrapperEl.contains(targetEl)) return;
@@ -19733,7 +19932,7 @@ function onTouchStart(event) {
19733
19932
  // change target el for shadow root component
19734
19933
  const swipingClassHasValue = !!params.noSwipingClass && params.noSwipingClass !== '';
19735
19934
  // eslint-disable-next-line
19736
- const eventPath = event.composedPath ? event.composedPath() : event.path;
19935
+ const eventPath = e.composedPath ? e.composedPath() : e.path;
19737
19936
  if (swipingClassHasValue && e.target && e.target.shadowRoot && eventPath) {
19738
19937
  targetEl = eventPath[0];
19739
19938
  }
@@ -19755,14 +19954,8 @@ function onTouchStart(event) {
19755
19954
 
19756
19955
  // Do NOT start if iOS edge swipe is detected. Otherwise iOS app cannot swipe-to-go-back anymore
19757
19956
 
19758
- const edgeSwipeDetection = params.edgeSwipeDetection || params.iOSEdgeSwipeDetection;
19759
- const edgeSwipeThreshold = params.edgeSwipeThreshold || params.iOSEdgeSwipeThreshold;
19760
- if (edgeSwipeDetection && (startX <= edgeSwipeThreshold || startX >= window.innerWidth - edgeSwipeThreshold)) {
19761
- if (edgeSwipeDetection === 'prevent') {
19762
- event.preventDefault();
19763
- } else {
19764
- return;
19765
- }
19957
+ if (!preventEdgeSwipe(swiper, e, startX)) {
19958
+ return;
19766
19959
  }
19767
19960
  Object.assign(data, {
19768
19961
  isTouched: true,
@@ -19812,15 +20005,24 @@ function onTouchMove(event) {
19812
20005
  if (!params.simulateTouch && event.pointerType === 'mouse') return;
19813
20006
  let e = event;
19814
20007
  if (e.originalEvent) e = e.originalEvent;
20008
+ if (e.type === 'pointermove') {
20009
+ if (data.touchId !== null) return; // return from pointer if we use touch
20010
+ const id = e.pointerId;
20011
+ if (id !== data.pointerId) return;
20012
+ }
20013
+ let targetTouch;
20014
+ if (e.type === 'touchmove') {
20015
+ targetTouch = [...e.changedTouches].filter(t => t.identifier === data.touchId)[0];
20016
+ if (!targetTouch || targetTouch.identifier !== data.touchId) return;
20017
+ } else {
20018
+ targetTouch = e;
20019
+ }
19815
20020
  if (!data.isTouched) {
19816
20021
  if (data.startMoving && data.isScrolling) {
19817
20022
  swiper.emit('touchMoveOpposite', e);
19818
20023
  }
19819
20024
  return;
19820
20025
  }
19821
- const pointerIndex = data.evCache.findIndex(cachedEv => cachedEv.pointerId === e.pointerId);
19822
- if (pointerIndex >= 0) data.evCache[pointerIndex] = e;
19823
- const targetTouch = data.evCache.length > 1 ? data.evCache[0] : e;
19824
20026
  const pageX = targetTouch.pageX;
19825
20027
  const pageY = targetTouch.pageY;
19826
20028
  if (e.preventedByNestedSwiper) {
@@ -19836,8 +20038,6 @@ function onTouchMove(event) {
19836
20038
  Object.assign(touches, {
19837
20039
  startX: pageX,
19838
20040
  startY: pageY,
19839
- prevX: swiper.touches.currentX,
19840
- prevY: swiper.touches.currentY,
19841
20041
  currentX: pageX,
19842
20042
  currentY: pageY
19843
20043
  });
@@ -19867,7 +20067,8 @@ function onTouchMove(event) {
19867
20067
  if (data.allowTouchCallbacks) {
19868
20068
  swiper.emit('touchMove', e);
19869
20069
  }
19870
- if (e.targetTouches && e.targetTouches.length > 1) return;
20070
+ touches.previousX = touches.currentX;
20071
+ touches.previousY = touches.currentY;
19871
20072
  touches.currentX = pageX;
19872
20073
  touches.currentY = pageY;
19873
20074
  const diffX = touches.currentX - touches.startX;
@@ -19893,7 +20094,7 @@ function onTouchMove(event) {
19893
20094
  data.startMoving = true;
19894
20095
  }
19895
20096
  }
19896
- if (data.isScrolling || swiper.zoom && swiper.params.zoom && swiper.params.zoom.enabled && data.evCache.length > 1) {
20097
+ if (data.isScrolling || e.type === 'touchmove' && data.preventTouchMoveFromPointerMove) {
19897
20098
  data.isTouched = false;
19898
20099
  return;
19899
20100
  }
@@ -19923,7 +20124,7 @@ function onTouchMove(event) {
19923
20124
  swiper.swipeDirection = diff > 0 ? 'prev' : 'next';
19924
20125
  swiper.touchesDirection = touchesDiff > 0 ? 'prev' : 'next';
19925
20126
  const isLoop = swiper.params.loop && !params.cssMode;
19926
- const allowLoopFix = swiper.swipeDirection === 'next' && swiper.allowSlideNext || swiper.swipeDirection === 'prev' && swiper.allowSlidePrev;
20127
+ const allowLoopFix = swiper.touchesDirection === 'next' && swiper.allowSlideNext || swiper.touchesDirection === 'prev' && swiper.allowSlidePrev;
19927
20128
  if (!data.isMoved) {
19928
20129
  if (isLoop && allowLoopFix) {
19929
20130
  swiper.loopFix({
@@ -19935,7 +20136,10 @@ function onTouchMove(event) {
19935
20136
  if (swiper.animating) {
19936
20137
  const evt = new window.CustomEvent('transitionend', {
19937
20138
  bubbles: true,
19938
- cancelable: true
20139
+ cancelable: true,
20140
+ detail: {
20141
+ bySwiperTouchMove: true
20142
+ }
19939
20143
  });
19940
20144
  swiper.wrapperEl.dispatchEvent(evt);
19941
20145
  }
@@ -19947,13 +20151,18 @@ function onTouchMove(event) {
19947
20151
  swiper.emit('sliderFirstMove', e);
19948
20152
  }
19949
20153
  let loopFixed;
19950
- if (data.isMoved && prevTouchesDirection !== swiper.touchesDirection && isLoop && allowLoopFix && Math.abs(diff) >= 1) {
19951
- // need another loop fix
19952
- swiper.loopFix({
19953
- direction: swiper.swipeDirection,
19954
- setTranslate: true
20154
+ new Date().getTime();
20155
+ if (data.isMoved && data.allowThresholdMove && prevTouchesDirection !== swiper.touchesDirection && isLoop && allowLoopFix && Math.abs(diff) >= 1) {
20156
+ Object.assign(touches, {
20157
+ startX: pageX,
20158
+ startY: pageY,
20159
+ currentX: pageX,
20160
+ currentY: pageY,
20161
+ startTranslate: data.currentTranslate
19955
20162
  });
19956
- loopFixed = true;
20163
+ data.loopSwapReset = true;
20164
+ data.startTranslate = data.currentTranslate;
20165
+ return;
19957
20166
  }
19958
20167
  swiper.emit('sliderMove', e);
19959
20168
  data.isMoved = true;
@@ -19964,7 +20173,7 @@ function onTouchMove(event) {
19964
20173
  resistanceRatio = 0;
19965
20174
  }
19966
20175
  if (diff > 0) {
19967
- if (isLoop && allowLoopFix && !loopFixed && data.currentTranslate > (params.centeredSlides ? swiper.minTranslate() - swiper.size / 2 : swiper.minTranslate())) {
20176
+ if (isLoop && allowLoopFix && !loopFixed && data.allowThresholdMove && data.currentTranslate > (params.centeredSlides ? swiper.minTranslate() - swiper.slidesSizesGrid[swiper.activeIndex + 1] : swiper.minTranslate())) {
19968
20177
  swiper.loopFix({
19969
20178
  direction: 'prev',
19970
20179
  setTranslate: true,
@@ -19978,7 +20187,7 @@ function onTouchMove(event) {
19978
20187
  }
19979
20188
  }
19980
20189
  } else if (diff < 0) {
19981
- if (isLoop && allowLoopFix && !loopFixed && data.currentTranslate < (params.centeredSlides ? swiper.maxTranslate() + swiper.size / 2 : swiper.maxTranslate())) {
20190
+ if (isLoop && allowLoopFix && !loopFixed && data.allowThresholdMove && data.currentTranslate < (params.centeredSlides ? swiper.maxTranslate() + swiper.slidesSizesGrid[swiper.slidesSizesGrid.length - 1] : swiper.maxTranslate())) {
19982
20191
  swiper.loopFix({
19983
20192
  direction: 'next',
19984
20193
  setTranslate: true,
@@ -20042,16 +20251,26 @@ function onTouchMove(event) {
20042
20251
  function onTouchEnd(event) {
20043
20252
  const swiper = this;
20044
20253
  const data = swiper.touchEventsData;
20045
- const pointerIndex = data.evCache.findIndex(cachedEv => cachedEv.pointerId === event.pointerId);
20046
- if (pointerIndex >= 0) {
20047
- data.evCache.splice(pointerIndex, 1);
20254
+ let e = event;
20255
+ if (e.originalEvent) e = e.originalEvent;
20256
+ let targetTouch;
20257
+ const isTouchEvent = e.type === 'touchend' || e.type === 'touchcancel';
20258
+ if (!isTouchEvent) {
20259
+ if (data.touchId !== null) return; // return from pointer if we use touch
20260
+ if (e.pointerId !== data.pointerId) return;
20261
+ targetTouch = e;
20262
+ } else {
20263
+ targetTouch = [...e.changedTouches].filter(t => t.identifier === data.touchId)[0];
20264
+ if (!targetTouch || targetTouch.identifier !== data.touchId) return;
20048
20265
  }
20049
- if (['pointercancel', 'pointerout', 'pointerleave', 'contextmenu'].includes(event.type)) {
20050
- const proceed = ['pointercancel', 'contextmenu'].includes(event.type) && (swiper.browser.isSafari || swiper.browser.isWebView);
20266
+ if (['pointercancel', 'pointerout', 'pointerleave', 'contextmenu'].includes(e.type)) {
20267
+ const proceed = ['pointercancel', 'contextmenu'].includes(e.type) && (swiper.browser.isSafari || swiper.browser.isWebView);
20051
20268
  if (!proceed) {
20052
20269
  return;
20053
20270
  }
20054
20271
  }
20272
+ data.pointerId = null;
20273
+ data.touchId = null;
20055
20274
  const {
20056
20275
  params,
20057
20276
  touches,
@@ -20060,9 +20279,7 @@ function onTouchEnd(event) {
20060
20279
  enabled
20061
20280
  } = swiper;
20062
20281
  if (!enabled) return;
20063
- if (!params.simulateTouch && event.pointerType === 'mouse') return;
20064
- let e = event;
20065
- if (e.originalEvent) e = e.originalEvent;
20282
+ if (!params.simulateTouch && e.pointerType === 'mouse') return;
20066
20283
  if (data.allowTouchCallbacks) {
20067
20284
  swiper.emit('touchEnd', e);
20068
20285
  }
@@ -20075,6 +20292,7 @@ function onTouchEnd(event) {
20075
20292
  data.startMoving = false;
20076
20293
  return;
20077
20294
  }
20295
+
20078
20296
  // Return Grab Cursor
20079
20297
  if (params.grabCursor && data.isMoved && data.isTouched && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) {
20080
20298
  swiper.setGrabCursor(false);
@@ -20097,7 +20315,7 @@ function onTouchEnd(event) {
20097
20315
  nextTick(() => {
20098
20316
  if (!swiper.destroyed) swiper.allowClick = true;
20099
20317
  });
20100
- if (!data.isTouched || !data.isMoved || !swiper.swipeDirection || touches.diff === 0 || data.currentTranslate === data.startTranslate) {
20318
+ if (!data.isTouched || !data.isMoved || !swiper.swipeDirection || touches.diff === 0 && !data.loopSwapReset || data.currentTranslate === data.startTranslate && !data.loopSwapReset) {
20101
20319
  data.isTouched = false;
20102
20320
  data.isMoved = false;
20103
20321
  data.startMoving = false;
@@ -20123,16 +20341,17 @@ function onTouchEnd(event) {
20123
20341
  }
20124
20342
 
20125
20343
  // Find current slide
20344
+ const swipeToLast = currentPos >= -swiper.maxTranslate() && !swiper.params.loop;
20126
20345
  let stopIndex = 0;
20127
20346
  let groupSize = swiper.slidesSizesGrid[0];
20128
20347
  for (let i = 0; i < slidesGrid.length; i += i < params.slidesPerGroupSkip ? 1 : params.slidesPerGroup) {
20129
20348
  const increment = i < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup;
20130
20349
  if (typeof slidesGrid[i + increment] !== 'undefined') {
20131
- if (currentPos >= slidesGrid[i] && currentPos < slidesGrid[i + increment]) {
20350
+ if (swipeToLast || currentPos >= slidesGrid[i] && currentPos < slidesGrid[i + increment]) {
20132
20351
  stopIndex = i;
20133
20352
  groupSize = slidesGrid[i + increment] - slidesGrid[i];
20134
20353
  }
20135
- } else if (currentPos >= slidesGrid[i]) {
20354
+ } else if (swipeToLast || currentPos >= slidesGrid[i]) {
20136
20355
  stopIndex = i;
20137
20356
  groupSize = slidesGrid[slidesGrid.length - 1] - slidesGrid[slidesGrid.length - 2];
20138
20357
  }
@@ -20294,8 +20513,15 @@ function onLoad(e) {
20294
20513
  swiper.update();
20295
20514
  }
20296
20515
 
20297
- let dummyEventAttached = false;
20298
- function dummyEventListener() {}
20516
+ function onDocumentTouchStart() {
20517
+ const swiper = this;
20518
+ if (swiper.documentTouchHandlerProceeded) return;
20519
+ swiper.documentTouchHandlerProceeded = true;
20520
+ if (swiper.params.touchReleaseOnEdges) {
20521
+ swiper.el.style.touchAction = 'auto';
20522
+ }
20523
+ }
20524
+
20299
20525
  const events = (swiper, method) => {
20300
20526
  const document = getDocument();
20301
20527
  const {
@@ -20307,21 +20533,39 @@ const events = (swiper, method) => {
20307
20533
  const capture = !!params.nested;
20308
20534
  const domMethod = method === 'on' ? 'addEventListener' : 'removeEventListener';
20309
20535
  const swiperMethod = method;
20536
+ if (!el || typeof el === 'string') return;
20310
20537
 
20311
20538
  // Touch Events
20539
+ document[domMethod]('touchstart', swiper.onDocumentTouchStart, {
20540
+ passive: false,
20541
+ capture
20542
+ });
20543
+ el[domMethod]('touchstart', swiper.onTouchStart, {
20544
+ passive: false
20545
+ });
20312
20546
  el[domMethod]('pointerdown', swiper.onTouchStart, {
20313
20547
  passive: false
20314
20548
  });
20549
+ document[domMethod]('touchmove', swiper.onTouchMove, {
20550
+ passive: false,
20551
+ capture
20552
+ });
20315
20553
  document[domMethod]('pointermove', swiper.onTouchMove, {
20316
20554
  passive: false,
20317
20555
  capture
20318
20556
  });
20557
+ document[domMethod]('touchend', swiper.onTouchEnd, {
20558
+ passive: true
20559
+ });
20319
20560
  document[domMethod]('pointerup', swiper.onTouchEnd, {
20320
20561
  passive: true
20321
20562
  });
20322
20563
  document[domMethod]('pointercancel', swiper.onTouchEnd, {
20323
20564
  passive: true
20324
20565
  });
20566
+ document[domMethod]('touchcancel', swiper.onTouchEnd, {
20567
+ passive: true
20568
+ });
20325
20569
  document[domMethod]('pointerout', swiper.onTouchEnd, {
20326
20570
  passive: true
20327
20571
  });
@@ -20354,22 +20598,18 @@ const events = (swiper, method) => {
20354
20598
  };
20355
20599
  function attachEvents() {
20356
20600
  const swiper = this;
20357
- const document = getDocument();
20358
20601
  const {
20359
20602
  params
20360
20603
  } = swiper;
20361
20604
  swiper.onTouchStart = onTouchStart.bind(swiper);
20362
20605
  swiper.onTouchMove = onTouchMove.bind(swiper);
20363
20606
  swiper.onTouchEnd = onTouchEnd.bind(swiper);
20607
+ swiper.onDocumentTouchStart = onDocumentTouchStart.bind(swiper);
20364
20608
  if (params.cssMode) {
20365
20609
  swiper.onScroll = onScroll.bind(swiper);
20366
20610
  }
20367
20611
  swiper.onClick = onClick.bind(swiper);
20368
20612
  swiper.onLoad = onLoad.bind(swiper);
20369
- if (!dummyEventAttached) {
20370
- document.addEventListener('touchstart', dummyEventListener);
20371
- dummyEventAttached = true;
20372
- }
20373
20613
  events(swiper, 'on');
20374
20614
  }
20375
20615
  function detachEvents() {
@@ -20402,6 +20642,8 @@ function setBreakpoint() {
20402
20642
  const breakpointParams = breakpointOnlyParams || swiper.originalParams;
20403
20643
  const wasMultiRow = isGridEnabled(swiper, params);
20404
20644
  const isMultiRow = isGridEnabled(swiper, breakpointParams);
20645
+ const wasGrabCursor = swiper.params.grabCursor;
20646
+ const isGrabCursor = breakpointParams.grabCursor;
20405
20647
  const wasEnabled = params.enabled;
20406
20648
  if (wasMultiRow && !isMultiRow) {
20407
20649
  el.classList.remove(`${params.containerModifierClass}grid`, `${params.containerModifierClass}grid-column`);
@@ -20413,6 +20655,11 @@ function setBreakpoint() {
20413
20655
  }
20414
20656
  swiper.emitContainerClasses();
20415
20657
  }
20658
+ if (wasGrabCursor && !isGrabCursor) {
20659
+ swiper.unsetGrabCursor();
20660
+ } else if (!wasGrabCursor && isGrabCursor) {
20661
+ swiper.setGrabCursor();
20662
+ }
20416
20663
 
20417
20664
  // Toggle navigation, pagination, scrollbar
20418
20665
  ['navigation', 'pagination', 'scrollbar'].forEach(prop => {
@@ -20563,6 +20810,7 @@ function removeClasses() {
20563
20810
  el,
20564
20811
  classNames
20565
20812
  } = swiper;
20813
+ if (!el || typeof el === 'string') return;
20566
20814
  el.classList.remove(...classNames);
20567
20815
  swiper.emitContainerClasses();
20568
20816
  }
@@ -20609,6 +20857,7 @@ var defaults$4 = {
20609
20857
  init: true,
20610
20858
  direction: 'horizontal',
20611
20859
  oneWayMovement: false,
20860
+ swiperElementNodeName: 'SWIPER-CONTAINER',
20612
20861
  touchEventsTarget: 'wrapper',
20613
20862
  initialSlide: 0,
20614
20863
  speed: 300,
@@ -20617,6 +20866,7 @@ var defaults$4 = {
20617
20866
  resizeObserver: true,
20618
20867
  nested: false,
20619
20868
  createElements: false,
20869
+ eventsPrefix: 'swiper',
20620
20870
  enabled: true,
20621
20871
  focusableElements: 'input, select, option, textarea, button, video, label',
20622
20872
  // Overrides
@@ -20691,7 +20941,8 @@ var defaults$4 = {
20691
20941
  slideToClickedSlide: false,
20692
20942
  // loop
20693
20943
  loop: false,
20694
- loopedSlides: null,
20944
+ loopAddBlankSlides: true,
20945
+ loopAdditionalSlides: 0,
20695
20946
  loopPreventsSliding: true,
20696
20947
  // rewind
20697
20948
  rewind: false,
@@ -20710,8 +20961,10 @@ var defaults$4 = {
20710
20961
  containerModifierClass: 'swiper-',
20711
20962
  // NEW
20712
20963
  slideClass: 'swiper-slide',
20964
+ slideBlankClass: 'swiper-slide-blank',
20713
20965
  slideActiveClass: 'swiper-slide-active',
20714
20966
  slideVisibleClass: 'swiper-slide-visible',
20967
+ slideFullyVisibleClass: 'swiper-slide-fully-visible',
20715
20968
  slideNextClass: 'swiper-slide-next',
20716
20969
  slidePrevClass: 'swiper-slide-prev',
20717
20970
  wrapperClass: 'swiper-wrapper',
@@ -20904,7 +21157,8 @@ class Swiper$1 {
20904
21157
  velocities: [],
20905
21158
  allowMomentumBounce: undefined,
20906
21159
  startMoving: undefined,
20907
- evCache: []
21160
+ pointerId: null,
21161
+ touchId: null
20908
21162
  },
20909
21163
  // Clicks
20910
21164
  allowClick: true,
@@ -20932,6 +21186,22 @@ class Swiper$1 {
20932
21186
  // eslint-disable-next-line no-constructor-return
20933
21187
  return swiper;
20934
21188
  }
21189
+ getDirectionLabel(property) {
21190
+ if (this.isHorizontal()) {
21191
+ return property;
21192
+ }
21193
+ // prettier-ignore
21194
+ return {
21195
+ 'width': 'height',
21196
+ 'margin-top': 'margin-left',
21197
+ 'margin-bottom ': 'margin-right',
21198
+ 'margin-left': 'margin-top',
21199
+ 'margin-right': 'margin-bottom',
21200
+ 'padding-left': 'padding-top',
21201
+ 'padding-right': 'padding-bottom',
21202
+ 'marginRight': 'marginBottom'
21203
+ }[property];
21204
+ }
20935
21205
  getSlideIndex(slideEl) {
20936
21206
  const {
20937
21207
  slidesEl,
@@ -21028,11 +21298,11 @@ class Swiper$1 {
21028
21298
  let spv = 1;
21029
21299
  if (typeof params.slidesPerView === 'number') return params.slidesPerView;
21030
21300
  if (params.centeredSlides) {
21031
- let slideSize = slides[activeIndex] ? slides[activeIndex].swiperSlideSize : 0;
21301
+ let slideSize = slides[activeIndex] ? Math.ceil(slides[activeIndex].swiperSlideSize) : 0;
21032
21302
  let breakLoop;
21033
21303
  for (let i = activeIndex + 1; i < slides.length; i += 1) {
21034
21304
  if (slides[i] && !breakLoop) {
21035
- slideSize += slides[i].swiperSlideSize;
21305
+ slideSize += Math.ceil(slides[i].swiperSlideSize);
21036
21306
  spv += 1;
21037
21307
  if (slideSize > swiperSize) breakLoop = true;
21038
21308
  }
@@ -21169,7 +21439,7 @@ class Swiper$1 {
21169
21439
  return false;
21170
21440
  }
21171
21441
  el.swiper = swiper;
21172
- if (el.parentNode && el.parentNode.host && el.parentNode.host.nodeName === 'SWIPER-CONTAINER') {
21442
+ if (el.parentNode && el.parentNode.host && el.parentNode.host.nodeName === swiper.params.swiperElementNodeName.toUpperCase()) {
21173
21443
  swiper.isElement = true;
21174
21444
  }
21175
21445
  const getWrapperSelector = () => {
@@ -21305,11 +21575,15 @@ class Swiper$1 {
21305
21575
  // Cleanup styles
21306
21576
  if (cleanStyles) {
21307
21577
  swiper.removeClasses();
21308
- el.removeAttribute('style');
21309
- wrapperEl.removeAttribute('style');
21578
+ if (el && typeof el !== 'string') {
21579
+ el.removeAttribute('style');
21580
+ }
21581
+ if (wrapperEl) {
21582
+ wrapperEl.removeAttribute('style');
21583
+ }
21310
21584
  if (slides && slides.length) {
21311
21585
  slides.forEach(slideEl => {
21312
- slideEl.classList.remove(params.slideVisibleClass, params.slideActiveClass, params.slideNextClass, params.slidePrevClass);
21586
+ slideEl.classList.remove(params.slideVisibleClass, params.slideFullyVisibleClass, params.slideActiveClass, params.slideNextClass, params.slidePrevClass);
21313
21587
  slideEl.removeAttribute('style');
21314
21588
  slideEl.removeAttribute('data-swiper-slide-index');
21315
21589
  });
@@ -21322,7 +21596,9 @@ class Swiper$1 {
21322
21596
  swiper.off(eventName);
21323
21597
  });
21324
21598
  if (deleteInstance !== false) {
21325
- swiper.el.swiper = null;
21599
+ if (swiper.el && typeof swiper.el !== 'string') {
21600
+ swiper.el.swiper = null;
21601
+ }
21326
21602
  deleteProps(swiper);
21327
21603
  }
21328
21604
  swiper.destroyed = true;
@@ -21361,7 +21637,7 @@ Object.keys(prototypes).forEach(prototypeGroup => {
21361
21637
  Swiper$1.use([Resize, Observer]);
21362
21638
 
21363
21639
  /* underscore in name -> watch for changes */
21364
- const paramsList = ['eventsPrefix', 'injectStyles', 'injectStylesUrls', 'modules', 'init', '_direction', 'oneWayMovement', 'touchEventsTarget', 'initialSlide', '_speed', 'cssMode', 'updateOnWindowResize', 'resizeObserver', 'nested', 'focusableElements', '_enabled', '_width', '_height', 'preventInteractionOnTransition', 'userAgent', 'url', '_edgeSwipeDetection', '_edgeSwipeThreshold', '_freeMode', '_autoHeight', 'setWrapperSize', 'virtualTranslate', '_effect', 'breakpoints', 'breakpointsBase', '_spaceBetween', '_slidesPerView', 'maxBackfaceHiddenSlides', '_grid', '_slidesPerGroup', '_slidesPerGroupSkip', '_slidesPerGroupAuto', '_centeredSlides', '_centeredSlidesBounds', '_slidesOffsetBefore', '_slidesOffsetAfter', 'normalizeSlideIndex', '_centerInsufficientSlides', '_watchOverflow', 'roundLengths', 'touchRatio', 'touchAngle', 'simulateTouch', '_shortSwipes', '_longSwipes', 'longSwipesRatio', 'longSwipesMs', '_followFinger', 'allowTouchMove', '_threshold', 'touchMoveStopPropagation', 'touchStartPreventDefault', 'touchStartForcePreventDefault', 'touchReleaseOnEdges', 'uniqueNavElements', '_resistance', '_resistanceRatio', '_watchSlidesProgress', '_grabCursor', 'preventClicks', 'preventClicksPropagation', '_slideToClickedSlide', '_loop', 'loopedSlides', 'loopPreventsSliding', '_rewind', '_allowSlidePrev', '_allowSlideNext', '_swipeHandler', '_noSwiping', 'noSwipingClass', 'noSwipingSelector', 'passiveListeners', 'containerModifierClass', 'slideClass', 'slideActiveClass', 'slideVisibleClass', 'slideNextClass', 'slidePrevClass', 'wrapperClass', 'lazyPreloaderClass', 'lazyPreloadPrevNext', 'runCallbacksOnInit', 'observer', 'observeParents', 'observeSlideChildren',
21640
+ const paramsList = ['eventsPrefix', 'injectStyles', 'injectStylesUrls', 'modules', 'init', '_direction', 'oneWayMovement', 'swiperElementNodeName', 'touchEventsTarget', 'initialSlide', '_speed', 'cssMode', 'updateOnWindowResize', 'resizeObserver', 'nested', 'focusableElements', '_enabled', '_width', '_height', 'preventInteractionOnTransition', 'userAgent', 'url', '_edgeSwipeDetection', '_edgeSwipeThreshold', '_freeMode', '_autoHeight', 'setWrapperSize', 'virtualTranslate', '_effect', 'breakpoints', 'breakpointsBase', '_spaceBetween', '_slidesPerView', 'maxBackfaceHiddenSlides', '_grid', '_slidesPerGroup', '_slidesPerGroupSkip', '_slidesPerGroupAuto', '_centeredSlides', '_centeredSlidesBounds', '_slidesOffsetBefore', '_slidesOffsetAfter', 'normalizeSlideIndex', '_centerInsufficientSlides', '_watchOverflow', 'roundLengths', 'touchRatio', 'touchAngle', 'simulateTouch', '_shortSwipes', '_longSwipes', 'longSwipesRatio', 'longSwipesMs', '_followFinger', 'allowTouchMove', '_threshold', 'touchMoveStopPropagation', 'touchStartPreventDefault', 'touchStartForcePreventDefault', 'touchReleaseOnEdges', 'uniqueNavElements', '_resistance', '_resistanceRatio', '_watchSlidesProgress', '_grabCursor', 'preventClicks', 'preventClicksPropagation', '_slideToClickedSlide', '_loop', 'loopAdditionalSlides', 'loopAddBlankSlides', 'loopPreventsSliding', '_rewind', '_allowSlidePrev', '_allowSlideNext', '_swipeHandler', '_noSwiping', 'noSwipingClass', 'noSwipingSelector', 'passiveListeners', 'containerModifierClass', 'slideClass', 'slideActiveClass', 'slideVisibleClass', 'slideFullyVisibleClass', 'slideNextClass', 'slidePrevClass', 'slideBlankClass', 'wrapperClass', 'lazyPreloaderClass', 'lazyPreloadPrevNext', 'runCallbacksOnInit', 'observer', 'observeParents', 'observeSlideChildren',
21365
21641
  // modules
21366
21642
  'a11y', '_autoplay', '_controller', 'coverflowEffect', 'cubeEffect', 'fadeEffect', 'flipEffect', 'creativeEffect', 'cardsEffect', 'hashNavigation', 'history', 'keyboard', 'mousewheel', '_navigation', '_pagination', 'parallax', '_scrollbar', '_thumbs', 'virtual', 'zoom', 'control'];
21367
21643
 
@@ -21490,7 +21766,7 @@ function updateSwiper(_ref) {
21490
21766
  }
21491
21767
  updateParams.forEach(key => {
21492
21768
  if (isObject$1(currentParams[key]) && isObject$1(passedParams[key])) {
21493
- extend$1(currentParams[key], passedParams[key]);
21769
+ Object.assign(currentParams[key], passedParams[key]);
21494
21770
  if ((key === 'navigation' || key === 'pagination' || key === 'scrollbar') && 'enabled' in passedParams[key] && !passedParams[key].enabled) {
21495
21771
  destroyModule(key);
21496
21772
  }
@@ -21511,6 +21787,9 @@ function updateSwiper(_ref) {
21511
21787
  if (changedParams.includes('children') && slides && virtual && currentParams.virtual.enabled) {
21512
21788
  virtual.slides = slides;
21513
21789
  virtual.update(true);
21790
+ } else if (changedParams.includes('virtual') && virtual && currentParams.virtual.enabled) {
21791
+ if (slides) virtual.slides = slides;
21792
+ virtual.update(true);
21514
21793
  }
21515
21794
  if (changedParams.includes('children') && slides && currentParams.loop) {
21516
21795
  loopNeedReloop = true;
@@ -21713,15 +21992,15 @@ const updateOnVirtualData = swiper => {
21713
21992
  };
21714
21993
 
21715
21994
  /**
21716
- * Swiper React 10.3.0
21995
+ * Swiper React 11.1.4
21717
21996
  * Most modern mobile touch slider and framework with hardware accelerated transitions
21718
21997
  * https://swiperjs.com
21719
21998
  *
21720
- * Copyright 2014-2023 Vladimir Kharlampidi
21999
+ * Copyright 2014-2024 Vladimir Kharlampidi
21721
22000
  *
21722
22001
  * Released under the MIT License
21723
22002
  *
21724
- * Released on: September 21, 2023
22003
+ * Released on: May 30, 2024
21725
22004
  */
21726
22005
 
21727
22006
  function _extends() {
@@ -21816,7 +22095,7 @@ function renderVirtual(swiper, slides, virtualData) {
21816
22095
  return /*#__PURE__*/React__default["default"].cloneElement(child, {
21817
22096
  swiper,
21818
22097
  style,
21819
- key: `slide-${index}`
22098
+ key: child.props.virtualIndex || child.key || `slide-${index}`
21820
22099
  });
21821
22100
  });
21822
22101
  }
@@ -21942,7 +22221,7 @@ const Swiper = /*#__PURE__*/React.forwardRef(function (_temp, externalElRef) {
21942
22221
  scrollbarEl: scrollbarElRef.current,
21943
22222
  swiper: swiperRef.current
21944
22223
  }, swiperParams);
21945
- if (onSwiper) onSwiper(swiperRef.current);
22224
+ if (onSwiper && !swiperRef.current.destroyed) onSwiper(swiperRef.current);
21946
22225
  // eslint-disable-next-line
21947
22226
  return () => {
21948
22227
  if (swiperRef.current && !swiperRef.current.destroyed) {
@@ -41560,7 +41839,7 @@ function History(_ref) {
41560
41839
  } else {
41561
41840
  location = window.location;
41562
41841
  }
41563
- const slide = swiper.slides[index];
41842
+ const slide = swiper.virtual && swiper.params.virtual.enabled ? swiper.slidesEl.querySelector(`[data-swiper-slide-index="${index}"]`) : swiper.slides[index];
41564
41843
  let value = slugify(slide.getAttribute('data-history'));
41565
41844
  if (swiper.params.history.root.length > 0) {
41566
41845
  let root = swiper.params.history.root;
@@ -41673,7 +41952,7 @@ function Autoplay(_ref) {
41673
41952
  enabled: false,
41674
41953
  delay: 3000,
41675
41954
  waitForTransition: true,
41676
- disableOnInteraction: true,
41955
+ disableOnInteraction: false,
41677
41956
  stopOnLastSlide: false,
41678
41957
  reverseDirection: false,
41679
41958
  pauseOnMouseEnter: false
@@ -41684,17 +41963,21 @@ function Autoplay(_ref) {
41684
41963
  let autoplayDelayTotal = params && params.autoplay ? params.autoplay.delay : 3000;
41685
41964
  let autoplayDelayCurrent = params && params.autoplay ? params.autoplay.delay : 3000;
41686
41965
  let autoplayTimeLeft;
41687
- let autoplayStartTime = new Date().getTime;
41966
+ let autoplayStartTime = new Date().getTime();
41688
41967
  let wasPaused;
41689
41968
  let isTouched;
41690
41969
  let pausedByTouch;
41691
41970
  let touchStartTimeout;
41692
41971
  let slideChanged;
41693
41972
  let pausedByInteraction;
41973
+ let pausedByPointerEnter;
41694
41974
  function onTransitionEnd(e) {
41695
41975
  if (!swiper || swiper.destroyed || !swiper.wrapperEl) return;
41696
41976
  if (e.target !== swiper.wrapperEl) return;
41697
41977
  swiper.wrapperEl.removeEventListener('transitionend', onTransitionEnd);
41978
+ if (pausedByPointerEnter || e.detail && e.detail.bySwiperTouchMove) {
41979
+ return;
41980
+ }
41698
41981
  resume();
41699
41982
  }
41700
41983
  const calcTimeLeft = () => {
@@ -41779,6 +42062,7 @@ function Autoplay(_ref) {
41779
42062
  return delay;
41780
42063
  };
41781
42064
  const start = () => {
42065
+ autoplayStartTime = new Date().getTime();
41782
42066
  swiper.autoplay.running = true;
41783
42067
  run();
41784
42068
  emit('autoplayStart');
@@ -41844,11 +42128,13 @@ function Autoplay(_ref) {
41844
42128
  const onPointerEnter = e => {
41845
42129
  if (e.pointerType !== 'mouse') return;
41846
42130
  pausedByInteraction = true;
42131
+ pausedByPointerEnter = true;
41847
42132
  if (swiper.animating || swiper.autoplay.paused) return;
41848
42133
  pause(true);
41849
42134
  };
41850
42135
  const onPointerLeave = e => {
41851
42136
  if (e.pointerType !== 'mouse') return;
42137
+ pausedByPointerEnter = false;
41852
42138
  if (swiper.autoplay.paused) {
41853
42139
  resume();
41854
42140
  }
@@ -41860,8 +42146,10 @@ function Autoplay(_ref) {
41860
42146
  }
41861
42147
  };
41862
42148
  const detachMouseEvents = () => {
41863
- swiper.el.removeEventListener('pointerenter', onPointerEnter);
41864
- swiper.el.removeEventListener('pointerleave', onPointerLeave);
42149
+ if (swiper.el && typeof swiper.el !== 'string') {
42150
+ swiper.el.removeEventListener('pointerenter', onPointerEnter);
42151
+ swiper.el.removeEventListener('pointerleave', onPointerLeave);
42152
+ }
41865
42153
  };
41866
42154
  const attachDocumentEvents = () => {
41867
42155
  const document = getDocument();
@@ -41875,7 +42163,6 @@ function Autoplay(_ref) {
41875
42163
  if (swiper.params.autoplay.enabled) {
41876
42164
  attachMouseEvents();
41877
42165
  attachDocumentEvents();
41878
- autoplayStartTime = new Date().getTime();
41879
42166
  start();
41880
42167
  }
41881
42168
  });
@@ -41886,6 +42173,18 @@ function Autoplay(_ref) {
41886
42173
  stop();
41887
42174
  }
41888
42175
  });
42176
+ on('_freeModeStaticRelease', () => {
42177
+ if (pausedByTouch || pausedByInteraction) {
42178
+ resume();
42179
+ }
42180
+ });
42181
+ on('_freeModeNoMomentumRelease', () => {
42182
+ if (!swiper.params.autoplay.disableOnInteraction) {
42183
+ pause(true, true);
42184
+ } else {
42185
+ stop();
42186
+ }
42187
+ });
41889
42188
  on('beforeTransitionStart', (_s, speed, internal) => {
41890
42189
  if (swiper.destroyed || !swiper.autoplay.running) return;
41891
42190
  if (internal || !swiper.params.autoplay.disableOnInteraction) {