vendor: 9,804 bytes, lines 1-360
1/******/ (() => { // webpackBootstrap 2/******/ "use strict"; 3// This entry needs to be wrapped in an IIFE because it needs to be isolated against other entry modules. 4(() => { 5// extracted by mini-css-extract-plugin 6 7})(); 8 9// This entry needs to be wrapped in an IIFE because it needs to be isolated against other entry modules. 10(() => { 11 12 13const observer = new IntersectionObserver(entries => { 14 entries.forEach(entry => { 15 const video = entry.target; 16 if (entry.isIntersecting && video.dataset.playing === '1') { 17 video.play(); 18 } else { 19 video.pause(); 20 } 21 }); 22}); 23document.querySelectorAll('.hero--medium').forEach(asset => { 24 const video = asset.querySelector('video'); 25 const button = asset.querySelector('.moviebutton'); 26 if (video) { 27 observer.observe(video); 28 if (button) { 29 const text = button.querySelector('span'); 30 const icon = button.querySelector('iconify-icon'); 31 button.addEventListener('click', () => { 32 if (video.paused) { 33 video.dataset.playing = '1'; 34 video.play(); 35 } else { 36 video.dataset.playing = '0'; 37 video.pause(); 38 } 39 }); 40 video.addEventListener('play', () => { 41 text.innerText = button.dataset.textPause || ''; 42 icon.setAttribute('icon', button.dataset.iconPause || ''); 43 }); 44 video.addEventListener('pause', () => { 45 text.innerText = button.dataset.textPlay || ''; 46 icon.setAttribute('icon', button.dataset.iconPlay || ''); 47 }); 48 } 49 } 50}); 51})(); 52 53// This entry needs to be wrapped in an IIFE because it needs to be isolated against other entry modules. 54(() => { 55 56;// ./node_modules/swiper/shared/ssr-window.esm.mjs 57/** 58 * SSR Window 5.0.0 59 * Better handling for window object in SSR environment 60 * https://github.com/nolimits4web/ssr-window 61 * 62 * Copyright 2025, Vladimir Kharlampidi 63 * 64 * Licensed under MIT 65 * 66 * Released on: February 12, 2025 67 */ 68/* eslint-disable no-param-reassign */ 69function isObject(obj) { 70 return obj !== null && typeof obj === 'object' && 'constructor' in obj && obj.constructor === Object; 71} 72function extend(target, src) { 73 if (target === void 0) { 74 target = {}; 75 } 76 if (src === void 0) { 77 src = {}; 78 } 79 const noExtend = ['__proto__', 'constructor', 'prototype']; 80 Object.keys(src).filter(key => noExtend.indexOf(key) < 0).forEach(key => { 81 if (typeof target[key] === 'undefined') target[key] = src[key];else if (isObject(src[key]) && isObject(target[key]) && Object.keys(src[key]).length > 0) { 82 extend(target[key], src[key]); 83 } 84 }); 85} 86const ssrDocument = { 87 body: {}, 88 addEventListener() {}, 89 removeEventListener() {}, 90 activeElement: { 91 blur() {}, 92 nodeName: '' 93 }, 94 querySelector() { 95 return null; 96 }, 97 querySelectorAll() { 98 return []; 99 }, 100 getElementById() { 101 return null; 102 }, 103 createEvent() { 104 return { 105 initEvent() {} 106 }; 107 }, 108 createElement() { 109 return { 110 children: [], 111 childNodes: [], 112 style: {}, 113 setAttribute() {}, 114 getElementsByTagName() { 115 return []; 116 } 117 }; 118 }, 119 createElementNS() { 120 return {}; 121 }, 122 importNode() { 123 return null; 124 }, 125 location: { 126 hash: '', 127 host: '', 128 hostname: '', 129 href: '', 130 origin: '', 131 pathname: '', 132 protocol: '', 133 search: '' 134 } 135}; 136function getDocument() { 137 const doc = typeof document !== 'undefined' ? document : {}; 138 extend(doc, ssrDocument); 139 return doc; 140} 141const ssrWindow = { 142 document: ssrDocument, 143 navigator: { 144 userAgent: '' 145 }, 146 location: { 147 hash: '', 148 host: '', 149 hostname: '', 150 href: '', 151 origin: '', 152 pathname: '', 153 protocol: '', 154 search: '' 155 }, 156 history: { 157 replaceState() {}, 158 pushState() {}, 159 go() {}, 160 back() {} 161 }, 162 CustomEvent: function CustomEvent() { 163 return this; 164 }, 165 addEventListener() {}, 166 removeEventListener() {}, 167 getComputedStyle() { 168 return { 169 getPropertyValue() { 170 return ''; 171 } 172 }; 173 }, 174 Image() {}, 175 Date() {}, 176 screen: {}, 177 setTimeout() {}, 178 clearTimeout() {}, 179 matchMedia() { 180 return {}; 181 }, 182 requestAnimationFrame(callback) { 183 if (typeof setTimeout === 'undefined') { 184 callback(); 185 return null; 186 } 187 return setTimeout(callback, 0); 188 }, 189 cancelAnimationFrame(id) { 190 if (typeof setTimeout === 'undefined') { 191 return; 192 } 193 clearTimeout(id); 194 } 195}; 196function getWindow() { 197 const win = typeof window !== 'undefined' ? window : {}; 198 extend(win, ssrWindow); 199 return win; 200} 201 202 203 204;// ./node_modules/swiper/shared/utils.mjs 205 206 207function classesToTokens(classes) { 208 if (classes === void 0) { 209 classes = ''; 210 } 211 return classes.trim().split(' ').filter(c => !!c.trim()); 212} 213 214function deleteProps(obj) { 215 const object = obj; 216 Object.keys(object).forEach(key => { 217 try { 218 object[key] = null; 219 } catch (e) { 220 // no getter for object 221 } 222 try { 223 delete object[key]; 224 } catch (e) { 225 // something got wrong 226 } 227 }); 228} 229function nextTick(callback, delay) { 230 if (delay === void 0) { 231 delay = 0; 232 } 233 return setTimeout(callback, delay); 234} 235function now() { 236 return Date.now(); 237} 238function utils_getComputedStyle(el) { 239 const window = getWindow(); 240 let style; 241 if (window.getComputedStyle) { 242 style = window.getComputedStyle(el, null); 243 } 244 if (!style && el.currentStyle) { 245 style = el.currentStyle; 246 } 247 if (!style) { 248 style = el.style; 249 } 250 return style; 251} 252function getTranslate(el, axis) { 253 if (axis === void 0) { 254 axis = 'x'; 255 } 256 const window = getWindow(); 257 let matrix; 258 let curTransform; 259 let transformMatrix; 260 const curStyle = utils_getComputedStyle(el); 261 if (window.WebKitCSSMatrix) { 262 curTransform = curStyle.transform || curStyle.webkitTransform; 263 if (curTransform.split(',').length > 6) { 264 curTransform = curTransform.split(', ').map(a => a.replace(',', '.')).join(', '); 265 } 266 // Some old versions of Webkit choke when 'none' is passed; pass 267 // empty string instead in this case 268 transformMatrix = new window.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform); 269 } else { 270 transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,'); 271 matrix = transformMatrix.toString().split(','); 272 } 273 if (axis === 'x') { 274 // Latest Chrome and webkits Fix 275 if (window.WebKitCSSMatrix) curTransform = transformMatrix.m41; 276 // Crazy IE10 Matrix 277 else if (matrix.length === 16) curTransform = parseFloat(matrix[12]); 278 // Normal Browsers 279 else curTransform = parseFloat(matrix[4]); 280 } 281 if (axis === 'y') { 282 // Latest Chrome and webkits Fix 283 if (window.WebKitCSSMatrix) curTransform = transformMatrix.m42; 284 // Crazy IE10 Matrix 285 else if (matrix.length === 16) curTransform = parseFloat(matrix[13]); 286 // Normal Browsers 287 else curTransform = parseFloat(matrix[5]); 288 } 289 return curTransform || 0; 290} 291function utils_isObject(o) { 292 return typeof o === 'object' && o !== null && o.constructor && Object.prototype.toString.call(o).slice(8, -1) === 'Object'; 293} 294function isNode(node) { 295 // eslint-disable-next-line 296 if (typeof window !== 'undefined' && typeof window.HTMLElement !== 'undefined') { 297 return node instanceof HTMLElement; 298 } 299 return node && (node.nodeType === 1 || node.nodeType === 11); 300} 301function utils_extend() { 302 const to = Object(arguments.length <= 0 ? undefined : arguments[0]); 303 const noExtend = ['__proto__', 'constructor', 'prototype']; 304 for (let i = 1; i < arguments.length; i += 1) { 305 const nextSource = i < 0 || arguments.length <= i ? undefined : arguments[i]; 306 if (nextSource !== undefined && nextSource !== null && !isNode(nextSource)) { 307 const keysArray = Object.keys(Object(nextSource)).filter(key => noExtend.indexOf(key) < 0); 308 for (let nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex += 1) { 309 const nextKey = keysArray[nextIndex]; 310 const desc = Object.getOwnPropertyDescriptor(nextSource, nextKey); 311 if (desc !== undefined && desc.enumerable) { 312 if (utils_isObject(to[nextKey]) && utils_isObject(nextSource[nextKey])) { 313 if (nextSource[nextKey].__swiper__) { 314 to[nextKey] = nextSource[nextKey]; 315 } else { 316 utils_extend(to[nextKey], nextSource[nextKey]); 317 } 318 } else if (!utils_isObject(to[nextKey]) && utils_isObject(nextSource[nextKey])) { 319 to[nextKey] = {}; 320 if (nextSource[nextKey].__swiper__) { 321 to[nextKey] = nextSource[nextKey]; 322 } else { 323 utils_extend(to[nextKey], nextSource[nextKey]); 324 } 325 } else { 326 to[nextKey] = nextSource[nextKey]; 327 } 328 } 329 } 330 } 331 } 332 return to; 333} 334function setCSSProperty(el, varName, varValue) { 335 el.style.setProperty(varName, varValue); 336} 337function animateCSSModeScroll(_ref) { 338 let { 339 swiper, 340 targetPosition, 341 side 342 } = _ref; 343 const window = getWindow(); 344 const startPosition = -swiper.translate; 345 let startTime = null; 346 let time; 347 const duration = swiper.params.speed; 348 swiper.wrapperEl.style.scrollSnapType = 'none'; 349 window.cancelAnimationFrame(swiper.cssModeFrameID); 350 const dir = targetPosition > startPosition ? 'next' : 'prev'; 351 const isOutOfBound = (current, target) => { 352 return dir === 'next' && current >= target || dir === 'prev' && current <= target; 353 }; 354 const animate = () => { 355 time = new Date().getTime(); 356 if (startTime === null) { 357 startTime = time; 358 } 359 const progress = Math.max(Math.min((time - startTime) / duration, 1), 0); 360 const easeProgress = 0.5 - Math.cos(progress * Math.PI) / 2;
vendor: 5,798 bytes, lines 361-549
361 let currentPosition = startPosition + easeProgress * (targetPosition - startPosition); 362 if (isOutOfBound(currentPosition, targetPosition)) { 363 currentPosition = targetPosition; 364 } 365 swiper.wrapperEl.scrollTo({ 366 [side]: currentPosition 367 }); 368 if (isOutOfBound(currentPosition, targetPosition)) { 369 swiper.wrapperEl.style.overflow = 'hidden'; 370 swiper.wrapperEl.style.scrollSnapType = ''; 371 setTimeout(() => { 372 swiper.wrapperEl.style.overflow = ''; 373 swiper.wrapperEl.scrollTo({ 374 [side]: currentPosition 375 }); 376 }); 377 window.cancelAnimationFrame(swiper.cssModeFrameID); 378 return; 379 } 380 swiper.cssModeFrameID = window.requestAnimationFrame(animate); 381 }; 382 animate(); 383} 384function getSlideTransformEl(slideEl) { 385 return slideEl.querySelector('.swiper-slide-transform') || slideEl.shadowRoot && slideEl.shadowRoot.querySelector('.swiper-slide-transform') || slideEl; 386} 387function elementChildren(element, selector) { 388 if (selector === void 0) { 389 selector = ''; 390 } 391 const window = getWindow(); 392 const children = [...element.children]; 393 if (window.HTMLSlotElement && element instanceof HTMLSlotElement) { 394 children.push(...element.assignedElements()); 395 } 396 if (!selector) { 397 return children; 398 } 399 return children.filter(el => el.matches(selector)); 400} 401function elementIsChildOfSlot(el, slot) { 402 // Breadth-first search through all parent's children and assigned elements 403 const elementsQueue = [slot]; 404 while (elementsQueue.length > 0) { 405 const elementToCheck = elementsQueue.shift(); 406 if (el === elementToCheck) { 407 return true; 408 } 409 elementsQueue.push(...elementToCheck.children, ...(elementToCheck.shadowRoot?.children || []), ...(elementToCheck.assignedElements?.() || [])); 410 } 411} 412function elementIsChildOf(el, parent) { 413 const window = getWindow(); 414 let isChild = parent.contains(el); 415 if (!isChild && window.HTMLSlotElement && parent instanceof HTMLSlotElement) { 416 const children = [...parent.assignedElements()]; 417 isChild = children.includes(el); 418 if (!isChild) { 419 isChild = elementIsChildOfSlot(el, parent); 420 } 421 } 422 return isChild; 423} 424function showWarning(text) { 425 try { 426 console.warn(text); 427 return; 428 } catch (err) { 429 // err 430 } 431} 432function createElement(tag, classes) { 433 if (classes === void 0) { 434 classes = []; 435 } 436 const el = document.createElement(tag); 437 el.classList.add(...(Array.isArray(classes) ? classes : classesToTokens(classes))); 438 return el; 439} 440function elementOffset(el) { 441 const window = getWindow(); 442 const document = getDocument(); 443 const box = el.getBoundingClientRect(); 444 const body = document.body; 445 const clientTop = el.clientTop || body.clientTop || 0; 446 const clientLeft = el.clientLeft || body.clientLeft || 0; 447 const scrollTop = el === window ? window.scrollY : el.scrollTop; 448 const scrollLeft = el === window ? window.scrollX : el.scrollLeft; 449 return { 450 top: box.top + scrollTop - clientTop, 451 left: box.left + scrollLeft - clientLeft 452 }; 453} 454function elementPrevAll(el, selector) { 455 const prevEls = []; 456 while (el.previousElementSibling) { 457 const prev = el.previousElementSibling; // eslint-disable-line 458 if (selector) { 459 if (prev.matches(selector)) prevEls.push(prev); 460 } else prevEls.push(prev); 461 el = prev; 462 } 463 return prevEls; 464} 465function elementNextAll(el, selector) { 466 const nextEls = []; 467 while (el.nextElementSibling) { 468 const next = el.nextElementSibling; // eslint-disable-line 469 if (selector) { 470 if (next.matches(selector)) nextEls.push(next); 471 } else nextEls.push(next); 472 el = next; 473 } 474 return nextEls; 475} 476function elementStyle(el, prop) { 477 const window = getWindow(); 478 return window.getComputedStyle(el, null).getPropertyValue(prop); 479} 480function elementIndex(el) { 481 let child = el; 482 let i; 483 if (child) { 484 i = 0; 485 // eslint-disable-next-line 486 while ((child = child.previousSibling) !== null) { 487 if (child.nodeType === 1) i += 1; 488 } 489 return i; 490 } 491 return undefined; 492} 493function elementParents(el, selector) { 494 const parents = []; // eslint-disable-line 495 let parent = el.parentElement; // eslint-disable-line 496 while (parent) { 497 if (selector) { 498 if (parent.matches(selector)) parents.push(parent); 499 } else { 500 parents.push(parent); 501 } 502 parent = parent.parentElement; 503 } 504 return parents; 505} 506function elementTransitionEnd(el, callback) { 507 function fireCallBack(e) { 508 if (e.target !== el) return; 509 callback.call(el, e); 510 el.removeEventListener('transitionend', fireCallBack); 511 } 512 if (callback) { 513 el.addEventListener('transitionend', fireCallBack); 514 } 515} 516function elementOuterSize(el, size, includeMargins) { 517 const window = getWindow(); 518 if (includeMargins) { 519 return el[size === 'width' ? 'offsetWidth' : 'offsetHeight'] + parseFloat(window.getComputedStyle(el, null).getPropertyValue(size === 'width' ? 'margin-right' : 'margin-top')) + parseFloat(window.getComputedStyle(el, null).getPropertyValue(size === 'width' ? 'margin-left' : 'margin-bottom')); 520 } 521 return el.offsetWidth; 522} 523function makeElementsArray(el) { 524 return (Array.isArray(el) ? el : [el]).filter(e => !!e); 525} 526function getRotateFix(swiper) { 527 return v => { 528 if (Math.abs(v) > 0 && swiper.browser && swiper.browser.need3dFix && Math.abs(v) % 90 === 0) { 529 return v + 0.001; 530 } 531 return v; 532 }; 533} 534 535 536 537;// ./node_modules/swiper/shared/swiper-core.mjs 538 539 540 541let support; 542function calcSupport() { 543 const window = getWindow(); 544 const document = getDocument(); 545 return { 546 smoothScroll: document.documentElement && document.documentElement.style && 'scrollBehavior' in document.documentElement.style, 547 touch: !!('ontouchstart' in window || window.DocumentTouch && document instanceof window.DocumentTouch) 548 }; 549}
vendor: 4,892 bytes, lines 550-720
550function getSupport() { 551 if (!support) { 552 support = calcSupport(); 553 } 554 return support; 555} 556 557let deviceCached; 558function calcDevice(_temp) { 559 let { 560 userAgent 561 } = _temp === void 0 ? {} : _temp; 562 const support = getSupport(); 563 const window = getWindow(); 564 const platform = window.navigator.platform; 565 const ua = userAgent || window.navigator.userAgent; 566 const device = { 567 ios: false, 568 android: false 569 }; 570 const screenWidth = window.screen.width; 571 const screenHeight = window.screen.height; 572 const android = ua.match(/(Android);?[\s\/]+([\d.]+)?/); // eslint-disable-line 573 let ipad = ua.match(/(iPad).*OS\s([\d_]+)/); 574 const ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/); 575 const iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/); 576 const windows = platform === 'Win32'; 577 let macos = platform === 'MacIntel'; 578 579 // iPadOs 13 fix 580 const iPadScreens = ['1024x1366', '1366x1024', '834x1194', '1194x834', '834x1112', '1112x834', '768x1024', '1024x768', '820x1180', '1180x820', '810x1080', '1080x810']; 581 if (!ipad && macos && support.touch && iPadScreens.indexOf(`${screenWidth}x${screenHeight}`) >= 0) { 582 ipad = ua.match(/(Version)\/([\d.]+)/); 583 if (!ipad) ipad = [0, 1, '13_0_0']; 584 macos = false; 585 } 586 587 // Android 588 if (android && !windows) { 589 device.os = 'android'; 590 device.android = true; 591 } 592 if (ipad || iphone || ipod) { 593 device.os = 'ios'; 594 device.ios = true; 595 } 596 597 // Export object 598 return device; 599} 600function getDevice(overrides) { 601 if (overrides === void 0) { 602 overrides = {}; 603 } 604 if (!deviceCached) { 605 deviceCached = calcDevice(overrides); 606 } 607 return deviceCached; 608} 609 610let browser; 611function calcBrowser() { 612 const window = getWindow(); 613 const device = getDevice(); 614 let needPerspectiveFix = false; 615 function isSafari() { 616 const ua = window.navigator.userAgent.toLowerCase(); 617 return ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0 && ua.indexOf('android') < 0; 618 } 619 if (isSafari()) { 620 const ua = String(window.navigator.userAgent); 621 if (ua.includes('Version/')) { 622 const [major, minor] = ua.split('Version/')[1].split(' ')[0].split('.').map(num => Number(num)); 623 needPerspectiveFix = major < 16 || major === 16 && minor < 2; 624 } 625 } 626 const isWebView = /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(window.navigator.userAgent); 627 const isSafariBrowser = isSafari(); 628 const need3dFix = isSafariBrowser || isWebView && device.ios; 629 return { 630 isSafari: needPerspectiveFix || isSafariBrowser, 631 needPerspectiveFix, 632 need3dFix, 633 isWebView 634 }; 635} 636function getBrowser() { 637 if (!browser) { 638 browser = calcBrowser(); 639 } 640 return browser; 641} 642 643function Resize(_ref) { 644 let { 645 swiper, 646 on, 647 emit 648 } = _ref; 649 const window = getWindow(); 650 let observer = null; 651 let animationFrame = null; 652 const resizeHandler = () => { 653 if (!swiper || swiper.destroyed || !swiper.initialized) return; 654 emit('beforeResize'); 655 emit('resize'); 656 }; 657 const createObserver = () => { 658 if (!swiper || swiper.destroyed || !swiper.initialized) return; 659 observer = new ResizeObserver(entries => { 660 animationFrame = window.requestAnimationFrame(() => { 661 const { 662 width, 663 height 664 } = swiper; 665 let newWidth = width; 666 let newHeight = height; 667 entries.forEach(_ref2 => { 668 let { 669 contentBoxSize, 670 contentRect, 671 target 672 } = _ref2; 673 if (target && target !== swiper.el) return; 674 newWidth = contentRect ? contentRect.width : (contentBoxSize[0] || contentBoxSize).inlineSize; 675 newHeight = contentRect ? contentRect.height : (contentBoxSize[0] || contentBoxSize).blockSize; 676 }); 677 if (newWidth !== width || newHeight !== height) { 678 resizeHandler(); 679 } 680 }); 681 }); 682 observer.observe(swiper.el); 683 }; 684 const removeObserver = () => { 685 if (animationFrame) { 686 window.cancelAnimationFrame(animationFrame); 687 } 688 if (observer && observer.unobserve && swiper.el) { 689 observer.unobserve(swiper.el); 690 observer = null; 691 } 692 }; 693 const orientationChangeHandler = () => { 694 if (!swiper || swiper.destroyed || !swiper.initialized) return; 695 emit('orientationchange'); 696 }; 697 on('init', () => { 698 if (swiper.params.resizeObserver && typeof window.ResizeObserver !== 'undefined') { 699 createObserver(); 700 return; 701 } 702 window.addEventListener('resize', resizeHandler); 703 window.addEventListener('orientationchange', orientationChangeHandler); 704 }); 705 on('destroy', () => { 706 removeObserver(); 707 window.removeEventListener('resize', resizeHandler); 708 window.removeEventListener('orientationchange', orientationChangeHandler); 709 }); 710} 711 712function Observer(_ref) { 713 let { 714 swiper, 715 extendParams, 716 on, 717 emit 718 } = _ref; 719 const observers = []; 720 const window = getWindow
vendor: 8,509 bytes, lines 720-977
720(); 721 const attach = function (target, options) { 722 if (options === void 0) { 723 options = {}; 724 } 725 const ObserverFunc = window.MutationObserver || window.WebkitMutationObserver; 726 const observer = new ObserverFunc(mutations => { 727 // The observerUpdate event should only be triggered 728 // once despite the number of mutations. Additional 729 // triggers are redundant and are very costly 730 if (swiper.__preventObserver__) return; 731 if (mutations.length === 1) { 732 emit('observerUpdate', mutations[0]); 733 return; 734 } 735 const observerUpdate = function observerUpdate() { 736 emit('observerUpdate', mutations[0]); 737 }; 738 if (window.requestAnimationFrame) { 739 window.requestAnimationFrame(observerUpdate); 740 } else { 741 window.setTimeout(observerUpdate, 0); 742 } 743 }); 744 observer.observe(target, { 745 attributes: typeof options.attributes === 'undefined' ? true : options.attributes, 746 childList: swiper.isElement || (typeof options.childList === 'undefined' ? true : options).childList, 747 characterData: typeof options.characterData === 'undefined' ? true : options.characterData 748 }); 749 observers.push(observer); 750 }; 751 const init = () => { 752 if (!swiper.params.observer) return; 753 if (swiper.params.observeParents) { 754 const containerParents = elementParents(swiper.hostEl); 755 for (let i = 0; i < containerParents.length; i += 1) { 756 attach(containerParents[i]); 757 } 758 } 759 // Observe container 760 attach(swiper.hostEl, { 761 childList: swiper.params.observeSlideChildren 762 }); 763 764 // Observe wrapper 765 attach(swiper.wrapperEl, { 766 attributes: false 767 }); 768 }; 769 const destroy = () => { 770 observers.forEach(observer => { 771 observer.disconnect(); 772 }); 773 observers.splice(0, observers.length); 774 }; 775 extendParams({ 776 observer: false, 777 observeParents: false, 778 observeSlideChildren: false 779 }); 780 on('init', init); 781 on('destroy', destroy); 782} 783 784/* eslint-disable no-underscore-dangle */ 785 786var eventsEmitter = { 787 on(events, handler, priority) { 788 const self = this; 789 if (!self.eventsListeners || self.destroyed) return self; 790 if (typeof handler !== 'function') return self; 791 const method = priority ? 'unshift' : 'push'; 792 events.split(' ').forEach(event => { 793 if (!self.eventsListeners[event]) self.eventsListeners[event] = []; 794 self.eventsListeners[event][method](handler); 795 }); 796 return self; 797 }, 798 once(events, handler, priority) { 799 const self = this; 800 if (!self.eventsListeners || self.destroyed) return self; 801 if (typeof handler !== 'function') return self; 802 function onceHandler() { 803 self.off(events, onceHandler); 804 if (onceHandler.__emitterProxy) { 805 delete onceHandler.__emitterProxy; 806 } 807 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 808 args[_key] = arguments[_key]; 809 } 810 handler.apply(self, args); 811 } 812 onceHandler.__emitterProxy = handler; 813 return self.on(events, onceHandler, priority); 814 }, 815 onAny(handler, priority) { 816 const self = this; 817 if (!self.eventsListeners || self.destroyed) return self; 818 if (typeof handler !== 'function') return self; 819 const method = priority ? 'unshift' : 'push'; 820 if (self.eventsAnyListeners.indexOf(handler) < 0) { 821 self.eventsAnyListeners[method](handler); 822 } 823 return self; 824 }, 825 offAny(handler) { 826 const self = this; 827 if (!self.eventsListeners || self.destroyed) return self; 828 if (!self.eventsAnyListeners) return self; 829 const index = self.eventsAnyListeners.indexOf(handler); 830 if (index >= 0) { 831 self.eventsAnyListeners.splice(index, 1); 832 } 833 return self; 834 }, 835 off(events, handler) { 836 const self = this; 837 if (!self.eventsListeners || self.destroyed) return self; 838 if (!self.eventsListeners) return self; 839 events.split(' ').forEach(event => { 840 if (typeof handler === 'undefined') { 841 self.eventsListeners[event] = []; 842 } else if (self.eventsListeners[event]) { 843 self.eventsListeners[event].forEach((eventHandler, index) => { 844 if (eventHandler === handler || eventHandler.__emitterProxy && eventHandler.__emitterProxy === handler) { 845 self.eventsListeners[event].splice(index, 1); 846 } 847 }); 848 } 849 }); 850 return self; 851 }, 852 emit() { 853 const self = this; 854 if (!self.eventsListeners || self.destroyed) return self; 855 if (!self.eventsListeners) return self; 856 let events; 857 let data; 858 let context; 859 for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { 860 args[_key2] = arguments[_key2]; 861 } 862 if (typeof args[0] === 'string' || Array.isArray(args[0])) { 863 events = args[0]; 864 data = args.slice(1, args.length); 865 context = self; 866 } else { 867 events = args[0].events; 868 data = args[0].data; 869 context = args[0].context || self; 870 } 871 data.unshift(context); 872 const eventsArray = Array.isArray(events) ? events : events.split(' '); 873 eventsArray.forEach(event => { 874 if (self.eventsAnyListeners && self.eventsAnyListeners.length) { 875 self.eventsAnyListeners.forEach(eventHandler => { 876 eventHandler.apply(context, [event, ...data]); 877 }); 878 } 879 if (self.eventsListeners && self.eventsListeners[event]) { 880 self.eventsListeners[event].forEach(eventHandler => { 881 eventHandler.apply(context, data); 882 }); 883 } 884 }); 885 return self; 886 } 887}; 888 889function updateSize() { 890 const swiper = this; 891 let width; 892 let height; 893 const el = swiper.el; 894 if (typeof swiper.params.width !== 'undefined' && swiper.params.width !== null) { 895 width = swiper.params.width; 896 } else { 897 width = el.clientWidth; 898 } 899 if (typeof swiper.params.height !== 'undefined' && swiper.params.height !== null) { 900 height = swiper.params.height; 901 } else { 902 height = el.clientHeight; 903 } 904 if (width === 0 && swiper.isHorizontal() || height === 0 && swiper.isVertical()) { 905 return; 906 } 907 908 // Subtract paddings 909 width = width - parseInt(elementStyle(el, 'padding-left') || 0, 10) - parseInt(elementStyle(el, 'padding-right') || 0, 10); 910 height = height - parseInt(elementStyle(el, 'padding-top') || 0, 10) - parseInt(elementStyle(el, 'padding-bottom') || 0, 10); 911 if (Number.isNaN(width)) width = 0; 912 if (Number.isNaN(height)) height = 0; 913 Object.assign(swiper, { 914 width, 915 height, 916 size: swiper.isHorizontal() ? width : height 917 }); 918} 919 920function updateSlides() { 921 const swiper = this; 922 function getDirectionPropertyValue(node, label) { 923 return parseFloat(node.getPropertyValue(swiper.getDirectionLabel(label)) || 0); 924 } 925 const params = swiper.params; 926 const { 927 wrapperEl, 928 slidesEl, 929 size: swiperSize, 930 rtlTranslate: rtl, 931 wrongRTL 932 } = swiper; 933 const isVirtual = swiper.virtual && params.virtual.enabled; 934 const previousSlidesLength = isVirtual ? swiper.virtual.slides.length : swiper.slides.length; 935 const slides = elementChildren(slidesEl, `.${swiper.params.slideClass}, swiper-slide`); 936 const slidesLength = isVirtual ? swiper.virtual.slides.length : slides.length; 937 let snapGrid = []; 938 const slidesGrid = []; 939 const slidesSizesGrid = []; 940 let offsetBefore = params.slidesOffsetBefore; 941 if (typeof offsetBefore === 'function') { 942 offsetBefore = params.slidesOffsetBefore.call(swiper); 943 } 944 let offsetAfter = params.slidesOffsetAfter; 945 if (typeof offsetAfter === 'function') { 946 offsetAfter = params.slidesOffsetAfter.call(swiper); 947 } 948 const previousSnapGridLength = swiper.snapGrid.length; 949 const previousSlidesGridLength = swiper.slidesGrid.length; 950 let spaceBetween = params.spaceBetween; 951 let slidePosition = -offsetBefore; 952 let prevSlideSize = 0; 953 let index = 0; 954 if (typeof swiperSize === 'undefined') { 955 return; 956 } 957 if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) { 958 spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiperSize; 959 } else if (typeof spaceBetween === 'string') { 960 spaceBetween = parseFloat(spaceBetween); 961 } 962 swiper.virtualSize = -spaceBetween; 963 964 // reset margins 965 slides.forEach(slideEl => { 966 if (rtl) { 967 slideEl.style.marginLeft = ''; 968 } else { 969 slideEl.style.marginRight = ''; 970 } 971 slideEl.style.marginBottom = ''; 972 slideEl.style.marginTop = ''; 973 }); 974 975 // reset cssMode offsets 976 if (params.centeredSlides && params.cssMode) { 977 setCSSProperty
977(wrapperEl, '--swiper-centered-offset-before', ''); 978 setCSSProperty
vendor: 7,579 bytes, lines 978-1163
978(wrapperEl, '--swiper-centered-offset-after', ''); 979 } 980 const gridEnabled = params.grid && params.grid.rows > 1 && swiper.grid; 981 if (gridEnabled) { 982 swiper.grid.initSlides(slides); 983 } else if (swiper.grid) { 984 swiper.grid.unsetSlides(); 985 } 986 987 // Calc slides 988 let slideSize; 989 const shouldResetSlideSize = params.slidesPerView === 'auto' && params.breakpoints && Object.keys(params.breakpoints).filter(key => { 990 return typeof params.breakpoints[key].slidesPerView !== 'undefined'; 991 }).length > 0; 992 for (let i = 0; i < slidesLength; i += 1) { 993 slideSize = 0; 994 let slide; 995 if (slides[i]) slide = slides[i]; 996 if (gridEnabled) { 997 swiper.grid.updateSlide(i, slide, slides); 998 } 999 if (slides[i] && elementStyle(slide, 'display') === 'none') continue; // eslint-disable-line 1000 1001 if (params.slidesPerView === 'auto') { 1002 if (shouldResetSlideSize) { 1003 slides[i].style[swiper.getDirectionLabel('width')] = ``; 1004 } 1005 const slideStyles = getComputedStyle(slide); 1006 const currentTransform = slide.style.transform; 1007 const currentWebKitTransform = slide.style.webkitTransform; 1008 if (currentTransform) { 1009 slide.style.transform = 'none'; 1010 } 1011 if (currentWebKitTransform) { 1012 slide.style.webkitTransform = 'none'; 1013 } 1014 if (params.roundLengths) { 1015 slideSize = swiper.isHorizontal() ? elementOuterSize(slide, 'width', true) : elementOuterSize(slide, 'height', true); 1016 } else { 1017 // eslint-disable-next-line 1018 const width = getDirectionPropertyValue(slideStyles, 'width'); 1019 const paddingLeft = getDirectionPropertyValue(slideStyles, 'padding-left'); 1020 const paddingRight = getDirectionPropertyValue(slideStyles, 'padding-right'); 1021 const marginLeft = getDirectionPropertyValue(slideStyles, 'margin-left'); 1022 const marginRight = getDirectionPropertyValue(slideStyles, 'margin-right'); 1023 const boxSizing = slideStyles.getPropertyValue('box-sizing'); 1024 if (boxSizing && boxSizing === 'border-box') { 1025 slideSize = width + marginLeft + marginRight; 1026 } else { 1027 const { 1028 clientWidth, 1029 offsetWidth 1030 } = slide; 1031 slideSize = width + paddingLeft + paddingRight + marginLeft + marginRight + (offsetWidth - clientWidth); 1032 } 1033 } 1034 if (currentTransform) { 1035 slide.style.transform = currentTransform; 1036 } 1037 if (currentWebKitTransform) { 1038 slide.style.webkitTransform = currentWebKitTransform; 1039 } 1040 if (params.roundLengths) slideSize = Math.floor(slideSize); 1041 } else { 1042 slideSize = (swiperSize - (params.slidesPerView - 1) * spaceBetween) / params.slidesPerView; 1043 if (params.roundLengths) slideSize = Math.floor(slideSize); 1044 if (slides[i]) { 1045 slides[i].style[swiper.getDirectionLabel('width')] = `${slideSize}px`; 1046 } 1047 } 1048 if (slides[i]) { 1049 slides[i].swiperSlideSize = slideSize; 1050 } 1051 slidesSizesGrid.push(slideSize); 1052 if (params.centeredSlides) { 1053 slidePosition = slidePosition + slideSize / 2 + prevSlideSize / 2 + spaceBetween; 1054 if (prevSlideSize === 0 && i !== 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween; 1055 if (i === 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween; 1056 if (Math.abs(slidePosition) < 1 / 1000) slidePosition = 0; 1057 if (params.roundLengths) slidePosition = Math.floor(slidePosition); 1058 if (index % params.slidesPerGroup === 0) snapGrid.push(slidePosition); 1059 slidesGrid.push(slidePosition); 1060 } else { 1061 if (params.roundLengths) slidePosition = Math.floor(slidePosition); 1062 if ((index - Math.min(swiper.params.slidesPerGroupSkip, index)) % swiper.params.slidesPerGroup === 0) snapGrid.push(slidePosition); 1063 slidesGrid.push(slidePosition); 1064 slidePosition = slidePosition + slideSize + spaceBetween; 1065 } 1066 swiper.virtualSize += slideSize + spaceBetween; 1067 prevSlideSize = slideSize; 1068 index += 1; 1069 } 1070 swiper.virtualSize = Math.max(swiper.virtualSize, swiperSize) + offsetAfter; 1071 if (rtl && wrongRTL && (params.effect === 'slide' || params.effect === 'coverflow')) { 1072 wrapperEl.style.width = `${swiper.virtualSize + spaceBetween}px`; 1073 } 1074 if (params.setWrapperSize) { 1075 wrapperEl.style[swiper.getDirectionLabel('width')] = `${swiper.virtualSize + spaceBetween}px`; 1076 } 1077 if (gridEnabled) { 1078 swiper.grid.updateWrapperSize(slideSize, snapGrid); 1079 } 1080 1081 // Remove last grid elements depending on width 1082 if (!params.centeredSlides) { 1083 const newSlidesGrid = []; 1084 for (let i = 0; i < snapGrid.length; i += 1) { 1085 let slidesGridItem = snapGrid[i]; 1086 if (params.roundLengths) slidesGridItem = Math.floor(slidesGridItem); 1087 if (snapGrid[i] <= swiper.virtualSize - swiperSize) { 1088 newSlidesGrid.push(slidesGridItem); 1089 } 1090 } 1091 snapGrid = newSlidesGrid; 1092 if (Math.floor(swiper.virtualSize - swiperSize) - Math.floor(snapGrid[snapGrid.length - 1]) > 1) { 1093 snapGrid.push(swiper.virtualSize - swiperSize); 1094 } 1095 } 1096 if (isVirtual && params.loop) { 1097 const size = slidesSizesGrid[0] + spaceBetween; 1098 if (params.slidesPerGroup > 1) { 1099 const groups = Math.ceil((swiper.virtual.slidesBefore + swiper.virtual.slidesAfter) / params.slidesPerGroup); 1100 const groupSize = size * params.slidesPerGroup; 1101 for (let i = 0; i < groups; i += 1) { 1102 snapGrid.push(snapGrid[snapGrid.length - 1] + groupSize); 1103 } 1104 } 1105 for (let i = 0; i < swiper.virtual.slidesBefore + swiper.virtual.slidesAfter; i += 1) { 1106 if (params.slidesPerGroup === 1) { 1107 snapGrid.push(snapGrid[snapGrid.length - 1] + size); 1108 } 1109 slidesGrid.push(slidesGrid[slidesGrid.length - 1] + size); 1110 swiper.virtualSize += size; 1111 } 1112 } 1113 if (snapGrid.length === 0) snapGrid = [0]; 1114 if (spaceBetween !== 0) { 1115 const key = swiper.isHorizontal() && rtl ? 'marginLeft' : swiper.getDirectionLabel('marginRight'); 1116 slides.filter((_, slideIndex) => { 1117 if (!params.cssMode || params.loop) return true; 1118 if (slideIndex === slides.length - 1) { 1119 return false; 1120 } 1121 return true; 1122 }).forEach(slideEl => { 1123 slideEl.style[key] = `${spaceBetween}px`; 1124 }); 1125 } 1126 if (params.centeredSlides && params.centeredSlidesBounds) { 1127 let allSlidesSize = 0; 1128 slidesSizesGrid.forEach(slideSizeValue => { 1129 allSlidesSize += slideSizeValue + (spaceBetween || 0); 1130 }); 1131 allSlidesSize -= spaceBetween; 1132 const maxSnap = allSlidesSize > swiperSize ? allSlidesSize - swiperSize : 0; 1133 snapGrid = snapGrid.map(snap => { 1134 if (snap <= 0) return -offsetBefore; 1135 if (snap > maxSnap) return maxSnap + offsetAfter; 1136 return snap; 1137 }); 1138 } 1139 if (params.centerInsufficientSlides) { 1140 let allSlidesSize = 0; 1141 slidesSizesGrid.forEach(slideSizeValue => { 1142 allSlidesSize += slideSizeValue + (spaceBetween || 0); 1143 }); 1144 allSlidesSize -= spaceBetween; 1145 const offsetSize = (params.slidesOffsetBefore || 0) + (params.slidesOffsetAfter || 0); 1146 if (allSlidesSize + offsetSize < swiperSize) { 1147 const allSlidesOffset = (swiperSize - allSlidesSize - offsetSize) / 2; 1148 snapGrid.forEach((snap, snapIndex) => { 1149 snapGrid[snapIndex] = snap - allSlidesOffset; 1150 }); 1151 slidesGrid.forEach((snap, snapIndex) => { 1152 slidesGrid[snapIndex] = snap + allSlidesOffset; 1153 }); 1154 } 1155 } 1156 Object.assign(swiper, { 1157 slides, 1158 snapGrid, 1159 slidesGrid, 1160 slidesSizesGrid 1161 }); 1162 if (params.centeredSlides && params.cssMode && !params.centeredSlidesBounds) { 1163 setCSSProperty
1163(wrapperEl, '--swiper-centered-offset-before', `${-snapGrid[0]}px`); 1164 setCSSProperty
vendor: 23,179 bytes, lines 1164-1850
1164(wrapperEl, '--swiper-centered-offset-after', `${swiper.size / 2 - slidesSizesGrid[slidesSizesGrid.length - 1] / 2}px`); 1165 const addToSnapGrid = -swiper.snapGrid[0]; 1166 const addToSlidesGrid = -swiper.slidesGrid[0]; 1167 swiper.snapGrid = swiper.snapGrid.map(v => v + addToSnapGrid); 1168 swiper.slidesGrid = swiper.slidesGrid.map(v => v + addToSlidesGrid); 1169 } 1170 if (slidesLength !== previousSlidesLength) { 1171 swiper.emit('slidesLengthChange'); 1172 } 1173 if (snapGrid.length !== previousSnapGridLength) { 1174 if (swiper.params.watchOverflow) swiper.checkOverflow(); 1175 swiper.emit('snapGridLengthChange'); 1176 } 1177 if (slidesGrid.length !== previousSlidesGridLength) { 1178 swiper.emit('slidesGridLengthChange'); 1179 } 1180 if (params.watchSlidesProgress) { 1181 swiper.updateSlidesOffset(); 1182 } 1183 swiper.emit('slidesUpdated'); 1184 if (!isVirtual && !params.cssMode && (params.effect === 'slide' || params.effect === 'fade')) { 1185 const backFaceHiddenClass = `${params.containerModifierClass}backface-hidden`; 1186 const hasClassBackfaceClassAdded = swiper.el.classList.contains(backFaceHiddenClass); 1187 if (slidesLength <= params.maxBackfaceHiddenSlides) { 1188 if (!hasClassBackfaceClassAdded) swiper.el.classList.add(backFaceHiddenClass); 1189 } else if (hasClassBackfaceClassAdded) { 1190 swiper.el.classList.remove(backFaceHiddenClass); 1191 } 1192 } 1193} 1194 1195function updateAutoHeight(speed) { 1196 const swiper = this; 1197 const activeSlides = []; 1198 const isVirtual = swiper.virtual && swiper.params.virtual.enabled; 1199 let newHeight = 0; 1200 let i; 1201 if (typeof speed === 'number') { 1202 swiper.setTransition(speed); 1203 } else if (speed === true) { 1204 swiper.setTransition(swiper.params.speed); 1205 } 1206 const getSlideByIndex = index => { 1207 if (isVirtual) { 1208 return swiper.slides[swiper.getSlideIndexByData(index)]; 1209 } 1210 return swiper.slides[index]; 1211 }; 1212 // Find slides currently in view 1213 if (swiper.params.slidesPerView !== 'auto' && swiper.params.slidesPerView > 1) { 1214 if (swiper.params.centeredSlides) { 1215 (swiper.visibleSlides || []).forEach(slide => { 1216 activeSlides.push(slide); 1217 }); 1218 } else { 1219 for (i = 0; i < Math.ceil(swiper.params.slidesPerView); i += 1) { 1220 const index = swiper.activeIndex + i; 1221 if (index > swiper.slides.length && !isVirtual) break; 1222 activeSlides.push(getSlideByIndex(index)); 1223 } 1224 } 1225 } else { 1226 activeSlides.push(getSlideByIndex(swiper.activeIndex)); 1227 } 1228 1229 // Find new height from highest slide in view 1230 for (i = 0; i < activeSlides.length; i += 1) { 1231 if (typeof activeSlides[i] !== 'undefined') { 1232 const height = activeSlides[i].offsetHeight; 1233 newHeight = height > newHeight ? height : newHeight; 1234 } 1235 } 1236 1237 // Update Height 1238 if (newHeight || newHeight === 0) swiper.wrapperEl.style.height = `${newHeight}px`; 1239} 1240 1241function updateSlidesOffset() { 1242 const swiper = this; 1243 const slides = swiper.slides; 1244 // eslint-disable-next-line 1245 const minusOffset = swiper.isElement ? swiper.isHorizontal() ? swiper.wrapperEl.offsetLeft : swiper.wrapperEl.offsetTop : 0; 1246 for (let i = 0; i < slides.length; i += 1) { 1247 slides[i].swiperSlideOffset = (swiper.isHorizontal() ? slides[i].offsetLeft : slides[i].offsetTop) - minusOffset - swiper.cssOverflowAdjustment(); 1248 } 1249} 1250 1251const toggleSlideClasses$1 = (slideEl, condition, className) => { 1252 if (condition && !slideEl.classList.contains(className)) { 1253 slideEl.classList.add(className); 1254 } else if (!condition && slideEl.classList.contains(className)) { 1255 slideEl.classList.remove(className); 1256 } 1257}; 1258function updateSlidesProgress(translate) { 1259 if (translate === void 0) { 1260 translate = this && this.translate || 0; 1261 } 1262 const swiper = this; 1263 const params = swiper.params; 1264 const { 1265 slides, 1266 rtlTranslate: rtl, 1267 snapGrid 1268 } = swiper; 1269 if (slides.length === 0) return; 1270 if (typeof slides[0].swiperSlideOffset === 'undefined') swiper.updateSlidesOffset(); 1271 let offsetCenter = -translate; 1272 if (rtl) offsetCenter = translate; 1273 swiper.visibleSlidesIndexes = []; 1274 swiper.visibleSlides = []; 1275 let spaceBetween = params.spaceBetween; 1276 if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) { 1277 spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiper.size; 1278 } else if (typeof spaceBetween === 'string') { 1279 spaceBetween = parseFloat(spaceBetween); 1280 } 1281 for (let i = 0; i < slides.length; i += 1) { 1282 const slide = slides[i]; 1283 let slideOffset = slide.swiperSlideOffset; 1284 if (params.cssMode && params.centeredSlides) { 1285 slideOffset -= slides[0].swiperSlideOffset; 1286 } 1287 const slideProgress = (offsetCenter + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slide.swiperSlideSize + spaceBetween); 1288 const originalSlideProgress = (offsetCenter - snapGrid[0] + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slide.swiperSlideSize + spaceBetween); 1289 const slideBefore = -(offsetCenter - slideOffset); 1290 const slideAfter = slideBefore + swiper.slidesSizesGrid[i]; 1291 const isFullyVisible = slideBefore >= 0 && slideBefore <= swiper.size - swiper.slidesSizesGrid[i]; 1292 const isVisible = slideBefore >= 0 && slideBefore < swiper.size - 1 || slideAfter > 1 && slideAfter <= swiper.size || slideBefore <= 0 && slideAfter >= swiper.size; 1293 if (isVisible) { 1294 swiper.visibleSlides.push(slide); 1295 swiper.visibleSlidesIndexes.push(i); 1296 } 1297 toggleSlideClasses$1(slide, isVisible, params.slideVisibleClass); 1298 toggleSlideClasses$1(slide, isFullyVisible, params.slideFullyVisibleClass); 1299 slide.progress = rtl ? -slideProgress : slideProgress; 1300 slide.originalProgress = rtl ? -originalSlideProgress : originalSlideProgress; 1301 } 1302} 1303 1304function updateProgress(translate) { 1305 const swiper = this; 1306 if (typeof translate === 'undefined') { 1307 const multiplier = swiper.rtlTranslate ? -1 : 1; 1308 // eslint-disable-next-line 1309 translate = swiper && swiper.translate && swiper.translate * multiplier || 0; 1310 } 1311 const params = swiper.params; 1312 const translatesDiff = swiper.maxTranslate() - swiper.minTranslate(); 1313 let { 1314 progress, 1315 isBeginning, 1316 isEnd, 1317 progressLoop 1318 } = swiper; 1319 const wasBeginning = isBeginning; 1320 const wasEnd = isEnd; 1321 if (translatesDiff === 0) { 1322 progress = 0; 1323 isBeginning = true; 1324 isEnd = true; 1325 } else { 1326 progress = (translate - swiper.minTranslate()) / translatesDiff; 1327 const isBeginningRounded = Math.abs(translate - swiper.minTranslate()) < 1; 1328 const isEndRounded = Math.abs(translate - swiper.maxTranslate()) < 1; 1329 isBeginning = isBeginningRounded || progress <= 0; 1330 isEnd = isEndRounded || progress >= 1; 1331 if (isBeginningRounded) progress = 0; 1332 if (isEndRounded) progress = 1; 1333 } 1334 if (params.loop) { 1335 const firstSlideIndex = swiper.getSlideIndexByData(0); 1336 const lastSlideIndex = swiper.getSlideIndexByData(swiper.slides.length - 1); 1337 const firstSlideTranslate = swiper.slidesGrid[firstSlideIndex]; 1338 const lastSlideTranslate = swiper.slidesGrid[lastSlideIndex]; 1339 const translateMax = swiper.slidesGrid[swiper.slidesGrid.length - 1]; 1340 const translateAbs = Math.abs(translate); 1341 if (translateAbs >= firstSlideTranslate) { 1342 progressLoop = (translateAbs - firstSlideTranslate) / translateMax; 1343 } else { 1344 progressLoop = (translateAbs + translateMax - lastSlideTranslate) / translateMax; 1345 } 1346 if (progressLoop > 1) progressLoop -= 1; 1347 } 1348 Object.assign(swiper, { 1349 progress, 1350 progressLoop, 1351 isBeginning, 1352 isEnd 1353 }); 1354 if (params.watchSlidesProgress || params.centeredSlides && params.autoHeight) swiper.updateSlidesProgress(translate); 1355 if (isBeginning && !wasBeginning) { 1356 swiper.emit('reachBeginning toEdge'); 1357 } 1358 if (isEnd && !wasEnd) { 1359 swiper.emit('reachEnd toEdge'); 1360 } 1361 if (wasBeginning && !isBeginning || wasEnd && !isEnd) { 1362 swiper.emit('fromEdge'); 1363 } 1364 swiper.emit('progress', progress); 1365} 1366 1367const toggleSlideClasses = (slideEl, condition, className) => { 1368 if (condition && !slideEl.classList.contains(className)) { 1369 slideEl.classList.add(className); 1370 } else if (!condition && slideEl.classList.contains(className)) { 1371 slideEl.classList.remove(className); 1372 } 1373}; 1374function updateSlidesClasses() { 1375 const swiper = this; 1376 const { 1377 slides, 1378 params, 1379 slidesEl, 1380 activeIndex 1381 } = swiper; 1382 const isVirtual = swiper.virtual && params.virtual.enabled; 1383 const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1; 1384 const getFilteredSlide = selector => { 1385 return elementChildren(slidesEl, `.${params.slideClass}${selector}, swiper-slide${selector}`)[0]; 1386 }; 1387 let activeSlide; 1388 let prevSlide; 1389 let nextSlide; 1390 if (isVirtual) { 1391 if (params.loop) { 1392 let slideIndex = activeIndex - swiper.virtual.slidesBefore; 1393 if (slideIndex < 0) slideIndex = swiper.virtual.slides.length + slideIndex; 1394 if (slideIndex >= swiper.virtual.slides.length) slideIndex -= swiper.virtual.slides.length; 1395 activeSlide = getFilteredSlide(`[data-swiper-slide-index="${slideIndex}"]`); 1396 } else { 1397 activeSlide = getFilteredSlide(`[data-swiper-slide-index="${activeIndex}"]`); 1398 } 1399 } else { 1400 if (gridEnabled) { 1401 activeSlide = slides.find(slideEl => slideEl.column === activeIndex); 1402 nextSlide = slides.find(slideEl => slideEl.column === activeIndex + 1); 1403 prevSlide = slides.find(slideEl => slideEl.column === activeIndex - 1); 1404 } else { 1405 activeSlide = slides[activeIndex]; 1406 } 1407 } 1408 if (activeSlide) { 1409 if (!gridEnabled) { 1410 // Next Slide 1411 nextSlide = elementNextAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0]; 1412 if (params.loop && !nextSlide) { 1413 nextSlide = slides[0]; 1414 } 1415 1416 // Prev Slide 1417 prevSlide = elementPrevAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0]; 1418 if (params.loop && !prevSlide === 0) { 1419 prevSlide = slides[slides.length - 1]; 1420 } 1421 } 1422 } 1423 slides.forEach(slideEl => { 1424 toggleSlideClasses(slideEl, slideEl === activeSlide, params.slideActiveClass); 1425 toggleSlideClasses(slideEl, slideEl === nextSlide, params.slideNextClass); 1426 toggleSlideClasses(slideEl, slideEl === prevSlide, params.slidePrevClass); 1427 }); 1428 swiper.emitSlidesClasses(); 1429} 1430 1431const processLazyPreloader = (swiper, imageEl) => { 1432 if (!swiper || swiper.destroyed || !swiper.params) return; 1433 const slideSelector = () => swiper.isElement ? `swiper-slide` : `.${swiper.params.slideClass}`; 1434 const slideEl = imageEl.closest(slideSelector()); 1435 if (slideEl) { 1436 let lazyEl = slideEl.querySelector(`.${swiper.params.lazyPreloaderClass}`); 1437 if (!lazyEl && swiper.isElement) { 1438 if (slideEl.shadowRoot) { 1439 lazyEl = slideEl.shadowRoot.querySelector(`.${swiper.params.lazyPreloaderClass}`); 1440 } else { 1441 // init later 1442 requestAnimationFrame(() => { 1443 if (slideEl.shadowRoot) { 1444 lazyEl = slideEl.shadowRoot.querySelector(`.${swiper.params.lazyPreloaderClass}`); 1445 if (lazyEl) lazyEl.remove(); 1446 } 1447 }); 1448 } 1449 } 1450 if (lazyEl) lazyEl.remove(); 1451 } 1452}; 1453const unlazy = (swiper, index) => { 1454 if (!swiper.slides[index]) return; 1455 const imageEl = swiper.slides[index].querySelector('[loading="lazy"]'); 1456 if (imageEl) imageEl.removeAttribute('loading'); 1457}; 1458const preload = swiper => { 1459 if (!swiper || swiper.destroyed || !swiper.params) return; 1460 let amount = swiper.params.lazyPreloadPrevNext; 1461 const len = swiper.slides.length; 1462 if (!len || !amount || amount < 0) return; 1463 amount = Math.min(amount, len); 1464 const slidesPerView = swiper.params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : Math.ceil(swiper.params.slidesPerView); 1465 const activeIndex = swiper.activeIndex; 1466 if (swiper.params.grid && swiper.params.grid.rows > 1) { 1467 const activeColumn = activeIndex; 1468 const preloadColumns = [activeColumn - amount]; 1469 preloadColumns.push(...Array.from({ 1470 length: amount 1471 }).map((_, i) => { 1472 return activeColumn + slidesPerView + i; 1473 })); 1474 swiper.slides.forEach((slideEl, i) => { 1475 if (preloadColumns.includes(slideEl.column)) unlazy(swiper, i); 1476 }); 1477 return; 1478 } 1479 const slideIndexLastInView = activeIndex + slidesPerView - 1; 1480 if (swiper.params.rewind || swiper.params.loop) { 1481 for (let i = activeIndex - amount; i <= slideIndexLastInView + amount; i += 1) { 1482 const realIndex = (i % len + len) % len; 1483 if (realIndex < activeIndex || realIndex > slideIndexLastInView) unlazy(swiper, realIndex); 1484 } 1485 } else { 1486 for (let i = Math.max(activeIndex - amount, 0); i <= Math.min(slideIndexLastInView + amount, len - 1); i += 1) { 1487 if (i !== activeIndex && (i > slideIndexLastInView || i < activeIndex)) { 1488 unlazy(swiper, i); 1489 } 1490 } 1491 } 1492}; 1493 1494function getActiveIndexByTranslate(swiper) { 1495 const { 1496 slidesGrid, 1497 params 1498 } = swiper; 1499 const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate; 1500 let activeIndex; 1501 for (let i = 0; i < slidesGrid.length; i += 1) { 1502 if (typeof slidesGrid[i + 1] !== 'undefined') { 1503 if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1] - (slidesGrid[i + 1] - slidesGrid[i]) / 2) { 1504 activeIndex = i; 1505 } else if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1]) { 1506 activeIndex = i + 1; 1507 } 1508 } else if (translate >= slidesGrid[i]) { 1509 activeIndex = i; 1510 } 1511 } 1512 // Normalize slideIndex 1513 if (params.normalizeSlideIndex) { 1514 if (activeIndex < 0 || typeof activeIndex === 'undefined') activeIndex = 0; 1515 } 1516 return activeIndex; 1517} 1518function updateActiveIndex(newActiveIndex) { 1519 const swiper = this; 1520 const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate; 1521 const { 1522 snapGrid, 1523 params, 1524 activeIndex: previousIndex, 1525 realIndex: previousRealIndex, 1526 snapIndex: previousSnapIndex 1527 } = swiper; 1528 let activeIndex = newActiveIndex; 1529 let snapIndex; 1530 const getVirtualRealIndex = aIndex => { 1531 let realIndex = aIndex - swiper.virtual.slidesBefore; 1532 if (realIndex < 0) { 1533 realIndex = swiper.virtual.slides.length + realIndex; 1534 } 1535 if (realIndex >= swiper.virtual.slides.length) { 1536 realIndex -= swiper.virtual.slides.length; 1537 } 1538 return realIndex; 1539 }; 1540 if (typeof activeIndex === 'undefined') { 1541 activeIndex = getActiveIndexByTranslate(swiper); 1542 } 1543 if (snapGrid.indexOf(translate) >= 0) { 1544 snapIndex = snapGrid.indexOf(translate); 1545 } else { 1546 const skip = Math.min(params.slidesPerGroupSkip, activeIndex); 1547 snapIndex = skip + Math.floor((activeIndex - skip) / params.slidesPerGroup); 1548 } 1549 if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1; 1550 if (activeIndex === previousIndex && !swiper.params.loop) { 1551 if (snapIndex !== previousSnapIndex) { 1552 swiper.snapIndex = snapIndex; 1553 swiper.emit('snapIndexChange'); 1554 } 1555 return; 1556 } 1557 if (activeIndex === previousIndex && swiper.params.loop && swiper.virtual && swiper.params.virtual.enabled) { 1558 swiper.realIndex = getVirtualRealIndex(activeIndex); 1559 return; 1560 } 1561 const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1; 1562 1563 // Get real index 1564 let realIndex; 1565 if (swiper.virtual && params.virtual.enabled && params.loop) { 1566 realIndex = getVirtualRealIndex(activeIndex); 1567 } else if (gridEnabled) { 1568 const firstSlideInColumn = swiper.slides.find(slideEl => slideEl.column === activeIndex); 1569 let activeSlideIndex = parseInt(firstSlideInColumn.getAttribute('data-swiper-slide-index'), 10); 1570 if (Number.isNaN(activeSlideIndex)) { 1571 activeSlideIndex = Math.max(swiper.slides.indexOf(firstSlideInColumn), 0); 1572 } 1573 realIndex = Math.floor(activeSlideIndex / params.grid.rows); 1574 } else if (swiper.slides[activeIndex]) { 1575 const slideIndex = swiper.slides[activeIndex].getAttribute('data-swiper-slide-index'); 1576 if (slideIndex) { 1577 realIndex = parseInt(slideIndex, 10); 1578 } else { 1579 realIndex = activeIndex; 1580 } 1581 } else { 1582 realIndex = activeIndex; 1583 } 1584 Object.assign(swiper, { 1585 previousSnapIndex, 1586 snapIndex, 1587 previousRealIndex, 1588 realIndex, 1589 previousIndex, 1590 activeIndex 1591 }); 1592 if (swiper.initialized) { 1593 preload(swiper); 1594 } 1595 swiper.emit('activeIndexChange'); 1596 swiper.emit('snapIndexChange'); 1597 if (swiper.initialized || swiper.params.runCallbacksOnInit) { 1598 if (previousRealIndex !== realIndex) { 1599 swiper.emit('realIndexChange'); 1600 } 1601 swiper.emit('slideChange'); 1602 } 1603} 1604 1605function updateClickedSlide(el, path) { 1606 const swiper = this; 1607 const params = swiper.params; 1608 let slide = el.closest(`.${params.slideClass}, swiper-slide`); 1609 if (!slide && swiper.isElement && path && path.length > 1 && path.includes(el)) { 1610 [...path.slice(path.indexOf(el) + 1, path.length)].forEach(pathEl => { 1611 if (!slide && pathEl.matches && pathEl.matches(`.${params.slideClass}, swiper-slide`)) { 1612 slide = pathEl; 1613 } 1614 }); 1615 } 1616 let slideFound = false; 1617 let slideIndex; 1618 if (slide) { 1619 for (let i = 0; i < swiper.slides.length; i += 1) { 1620 if (swiper.slides[i] === slide) { 1621 slideFound = true; 1622 slideIndex = i; 1623 break; 1624 } 1625 } 1626 } 1627 if (slide && slideFound) { 1628 swiper.clickedSlide = slide; 1629 if (swiper.virtual && swiper.params.virtual.enabled) { 1630 swiper.clickedIndex = parseInt(slide.getAttribute('data-swiper-slide-index'), 10); 1631 } else { 1632 swiper.clickedIndex = slideIndex; 1633 } 1634 } else { 1635 swiper.clickedSlide = undefined; 1636 swiper.clickedIndex = undefined; 1637 return; 1638 } 1639 if (params.slideToClickedSlide && swiper.clickedIndex !== undefined && swiper.clickedIndex !== swiper.activeIndex) { 1640 swiper.slideToClickedSlide(); 1641 } 1642} 1643 1644var update = { 1645 updateSize, 1646 updateSlides, 1647 updateAutoHeight, 1648 updateSlidesOffset, 1649 updateSlidesProgress, 1650 updateProgress, 1651 updateSlidesClasses, 1652 updateActiveIndex, 1653 updateClickedSlide 1654}; 1655 1656function getSwiperTranslate(axis) { 1657 if (axis === void 0) { 1658 axis = this.isHorizontal() ? 'x' : 'y'; 1659 } 1660 const swiper = this; 1661 const { 1662 params, 1663 rtlTranslate: rtl, 1664 translate, 1665 wrapperEl 1666 } = swiper; 1667 if (params.virtualTranslate) { 1668 return rtl ? -translate : translate; 1669 } 1670 if (params.cssMode) { 1671 return translate; 1672 } 1673 let currentTranslate = getTranslate(wrapperEl, axis); 1674 currentTranslate += swiper.cssOverflowAdjustment(); 1675 if (rtl) currentTranslate = -currentTranslate; 1676 return currentTranslate || 0; 1677} 1678 1679function setTranslate(translate, byController) { 1680 const swiper = this; 1681 const { 1682 rtlTranslate: rtl, 1683 params, 1684 wrapperEl, 1685 progress 1686 } = swiper; 1687 let x = 0; 1688 let y = 0; 1689 const z = 0; 1690 if (swiper.isHorizontal()) { 1691 x = rtl ? -translate : translate; 1692 } else { 1693 y = translate; 1694 } 1695 if (params.roundLengths) { 1696 x = Math.floor(x); 1697 y = Math.floor(y); 1698 } 1699 swiper.previousTranslate = swiper.translate; 1700 swiper.translate = swiper.isHorizontal() ? x : y; 1701 if (params.cssMode) { 1702 wrapperEl[swiper.isHorizontal() ? 'scrollLeft' : 'scrollTop'] = swiper.isHorizontal() ? -x : -y; 1703 } else if (!params.virtualTranslate) { 1704 if (swiper.isHorizontal()) { 1705 x -= swiper.cssOverflowAdjustment(); 1706 } else { 1707 y -= swiper.cssOverflowAdjustment(); 1708 } 1709 wrapperEl.style.transform = `translate3d(${x}px, ${y}px, ${z}px)`; 1710 } 1711 1712 // Check if we need to update progress 1713 let newProgress; 1714 const translatesDiff = swiper.maxTranslate() - swiper.minTranslate(); 1715 if (translatesDiff === 0) { 1716 newProgress = 0; 1717 } else { 1718 newProgress = (translate - swiper.minTranslate()) / translatesDiff; 1719 } 1720 if (newProgress !== progress) { 1721 swiper.updateProgress(translate); 1722 } 1723 swiper.emit('setTranslate', swiper.translate, byController); 1724} 1725 1726function minTranslate() { 1727 return -this.snapGrid[0]; 1728} 1729 1730function maxTranslate() { 1731 return -this.snapGrid[this.snapGrid.length - 1]; 1732} 1733 1734function translateTo(translate, speed, runCallbacks, translateBounds, internal) { 1735 if (translate === void 0) { 1736 translate = 0; 1737 } 1738 if (speed === void 0) { 1739 speed = this.params.speed; 1740 } 1741 if (runCallbacks === void 0) { 1742 runCallbacks = true; 1743 } 1744 if (translateBounds === void 0) { 1745 translateBounds = true; 1746 } 1747 const swiper = this; 1748 const { 1749 params, 1750 wrapperEl 1751 } = swiper; 1752 if (swiper.animating && params.preventInteractionOnTransition) { 1753 return false; 1754 } 1755 const minTranslate = swiper.minTranslate(); 1756 const maxTranslate = swiper.maxTranslate(); 1757 let newTranslate; 1758 if (translateBounds && translate > minTranslate) newTranslate = minTranslate;else if (translateBounds && translate < maxTranslate) newTranslate = maxTranslate;else newTranslate = translate; 1759 1760 // Update progress 1761 swiper.updateProgress(newTranslate); 1762 if (params.cssMode) { 1763 const isH = swiper.isHorizontal(); 1764 if (speed === 0) { 1765 wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = -newTranslate; 1766 } else { 1767 if (!swiper.support.smoothScroll) { 1768 animateCSSModeScroll({ 1769 swiper, 1770 targetPosition: -newTranslate, 1771 side: isH ? 'left' : 'top' 1772 }); 1773 return true; 1774 } 1775 wrapperEl.scrollTo({ 1776 [isH ? 'left' : 'top']: -newTranslate, 1777 behavior: 'smooth' 1778 }); 1779 } 1780 return true; 1781 } 1782 if (speed === 0) { 1783 swiper.setTransition(0); 1784 swiper.setTranslate(newTranslate); 1785 if (runCallbacks) { 1786 swiper.emit('beforeTransitionStart', speed, internal); 1787 swiper.emit('transitionEnd'); 1788 } 1789 } else { 1790 swiper.setTransition(speed); 1791 swiper.setTranslate(newTranslate); 1792 if (runCallbacks) { 1793 swiper.emit('beforeTransitionStart', speed, internal); 1794 swiper.emit('transitionStart'); 1795 } 1796 if (!swiper.animating) { 1797 swiper.animating = true; 1798 if (!swiper.onTranslateToWrapperTransitionEnd) { 1799 swiper.onTranslateToWrapperTransitionEnd = function transitionEnd(e) { 1800 if (!swiper || swiper.destroyed) return; 1801 if (e.target !== this) return; 1802 swiper.wrapperEl.removeEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd); 1803 swiper.onTranslateToWrapperTransitionEnd = null; 1804 delete swiper.onTranslateToWrapperTransitionEnd; 1805 swiper.animating = false; 1806 if (runCallbacks) { 1807 swiper.emit('transitionEnd'); 1808 } 1809 }; 1810 } 1811 swiper.wrapperEl.addEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd); 1812 } 1813 } 1814 return true; 1815} 1816 1817var translate = { 1818 getTranslate: getSwiperTranslate, 1819 setTranslate, 1820 minTranslate, 1821 maxTranslate, 1822 translateTo 1823}; 1824 1825function setTransition(duration, byController) { 1826 const swiper = this; 1827 if (!swiper.params.cssMode) { 1828 swiper.wrapperEl.style.transitionDuration = `${duration}ms`; 1829 swiper.wrapperEl.style.transitionDelay = duration === 0 ? `0ms` : ''; 1830 } 1831 swiper.emit('setTransition', duration, byController); 1832} 1833 1834function transitionEmit(_ref) { 1835 let { 1836 swiper, 1837 runCallbacks, 1838 direction, 1839 step 1840 } = _ref; 1841 const { 1842 activeIndex, 1843 previousIndex 1844 } = swiper; 1845 let dir = direction; 1846 if (!dir) { 1847 if (activeIndex > previousIndex) dir = 'next';else if (activeIndex < previousIndex) dir = 'prev';else dir = 'reset'; 1848 } 1849 swiper.emit(`transition${step}`); 1850 if (runCallbacks &&
1850activeIndex !== previousIndex) { 1851 if (dir === 'reset') { 1852 swiper.emit(`slideResetTransition${step}`); 1853 return; 1854 }
vendor: 15,449 bytes, lines 1854-2310
1854 1855 swiper.emit(`slideChangeTransition${step}`); 1856 if (dir === 'next') { 1857 swiper.emit(`slideNextTransition${step}`); 1858 } else { 1859 swiper.emit(`slidePrevTransition${step}`); 1860 } 1861 } 1862} 1863 1864function transitionStart(runCallbacks, direction) { 1865 if (runCallbacks === void 0) { 1866 runCallbacks = true; 1867 } 1868 const swiper = this; 1869 const { 1870 params 1871 } = swiper; 1872 if (params.cssMode) return; 1873 if (params.autoHeight) { 1874 swiper.updateAutoHeight(); 1875 } 1876 transitionEmit({ 1877 swiper, 1878 runCallbacks, 1879 direction, 1880 step: 'Start' 1881 }); 1882} 1883 1884function transitionEnd(runCallbacks, direction) { 1885 if (runCallbacks === void 0) { 1886 runCallbacks = true; 1887 } 1888 const swiper = this; 1889 const { 1890 params 1891 } = swiper; 1892 swiper.animating = false; 1893 if (params.cssMode) return; 1894 swiper.setTransition(0); 1895 transitionEmit({ 1896 swiper, 1897 runCallbacks, 1898 direction, 1899 step: 'End' 1900 }); 1901} 1902 1903var transition = { 1904 setTransition, 1905 transitionStart, 1906 transitionEnd 1907}; 1908 1909function slideTo(index, speed, runCallbacks, internal, initial) { 1910 if (index === void 0) { 1911 index = 0; 1912 } 1913 if (runCallbacks === void 0) { 1914 runCallbacks = true; 1915 } 1916 if (typeof index === 'string') { 1917 index = parseInt(index, 10); 1918 } 1919 const swiper = this; 1920 let slideIndex = index; 1921 if (slideIndex < 0) slideIndex = 0; 1922 const { 1923 params, 1924 snapGrid, 1925 slidesGrid, 1926 previousIndex, 1927 activeIndex, 1928 rtlTranslate: rtl, 1929 wrapperEl, 1930 enabled 1931 } = swiper; 1932 if (!enabled && !internal && !initial || swiper.destroyed || swiper.animating && params.preventInteractionOnTransition) { 1933 return false; 1934 } 1935 if (typeof speed === 'undefined') { 1936 speed = swiper.params.speed; 1937 } 1938 const skip = Math.min(swiper.params.slidesPerGroupSkip, slideIndex); 1939 let snapIndex = skip + Math.floor((slideIndex - skip) / swiper.params.slidesPerGroup); 1940 if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1; 1941 const translate = -snapGrid[snapIndex]; 1942 // Normalize slideIndex 1943 if (params.normalizeSlideIndex) { 1944 for (let i = 0; i < slidesGrid.length; i += 1) { 1945 const normalizedTranslate = -Math.floor(translate * 100); 1946 const normalizedGrid = Math.floor(slidesGrid[i] * 100); 1947 const normalizedGridNext = Math.floor(slidesGrid[i + 1] * 100); 1948 if (typeof slidesGrid[i + 1] !== 'undefined') { 1949 if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext - (normalizedGridNext - normalizedGrid) / 2) { 1950 slideIndex = i; 1951 } else if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext) { 1952 slideIndex = i + 1; 1953 } 1954 } else if (normalizedTranslate >= normalizedGrid) { 1955 slideIndex = i; 1956 } 1957 } 1958 } 1959 // Directions locks 1960 if (swiper.initialized && slideIndex !== activeIndex) { 1961 if (!swiper.allowSlideNext && (rtl ? translate > swiper.translate && translate > swiper.minTranslate() : translate < swiper.translate && translate < swiper.minTranslate())) { 1962 return false; 1963 } 1964 if (!swiper.allowSlidePrev && translate > swiper.translate && translate > swiper.maxTranslate()) { 1965 if ((activeIndex || 0) !== slideIndex) { 1966 return false; 1967 } 1968 } 1969 } 1970 if (slideIndex !== (previousIndex || 0) && runCallbacks) { 1971 swiper.emit('beforeSlideChangeStart'); 1972 } 1973 1974 // Update progress 1975 swiper.updateProgress(translate); 1976 let direction; 1977 if (slideIndex > activeIndex) direction = 'next';else if (slideIndex < activeIndex) direction = 'prev';else direction = 'reset'; 1978 1979 // initial virtual 1980 const isVirtual = swiper.virtual && swiper.params.virtual.enabled; 1981 const isInitialVirtual = isVirtual && initial; 1982 // Update Index 1983 if (!isInitialVirtual && (rtl && -translate === swiper.translate || !rtl && translate === swiper.translate)) { 1984 swiper.updateActiveIndex(slideIndex); 1985 // Update Height 1986 if (params.autoHeight) { 1987 swiper.updateAutoHeight(); 1988 } 1989 swiper.updateSlidesClasses(); 1990 if (params.effect !== 'slide') { 1991 swiper.setTranslate(translate); 1992 } 1993 if (direction !== 'reset') { 1994 swiper.transitionStart(runCallbacks, direction); 1995 swiper.transitionEnd(runCallbacks, direction); 1996 } 1997 return false; 1998 } 1999 if (params.cssMode) { 2000 const isH = swiper.isHorizontal(); 2001 const t = rtl ? translate : -translate; 2002 if (speed === 0) { 2003 if (isVirtual) { 2004 swiper.wrapperEl.style.scrollSnapType = 'none'; 2005 swiper._immediateVirtual = true; 2006 } 2007 if (isVirtual && !swiper._cssModeVirtualInitialSet && swiper.params.initialSlide > 0) { 2008 swiper._cssModeVirtualInitialSet = true; 2009 requestAnimationFrame(() => { 2010 wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t; 2011 }); 2012 } else { 2013 wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t; 2014 } 2015 if (isVirtual) { 2016 requestAnimationFrame(() => { 2017 swiper.wrapperEl.style.scrollSnapType = ''; 2018 swiper._immediateVirtual = false; 2019 }); 2020 } 2021 } else { 2022 if (!swiper.support.smoothScroll) { 2023 animateCSSModeScroll({ 2024 swiper, 2025 targetPosition: t, 2026 side: isH ? 'left' : 'top' 2027 }); 2028 return true; 2029 } 2030 wrapperEl.scrollTo({ 2031 [isH ? 'left' : 'top']: t, 2032 behavior: 'smooth' 2033 }); 2034 } 2035 return true; 2036 } 2037 const browser = getBrowser(); 2038 const isSafari = browser.isSafari; 2039 if (isVirtual && !initial && isSafari && swiper.isElement) { 2040 swiper.virtual.update(false, false, slideIndex); 2041 } 2042 swiper.setTransition(speed); 2043 swiper.setTranslate(translate); 2044 swiper.updateActiveIndex(slideIndex); 2045 swiper.updateSlidesClasses(); 2046 swiper.emit('beforeTransitionStart', speed, internal); 2047 swiper.transitionStart(runCallbacks, direction); 2048 if (speed === 0) { 2049 swiper.transitionEnd(runCallbacks, direction); 2050 } else if (!swiper.animating) { 2051 swiper.animating = true; 2052 if (!swiper.onSlideToWrapperTransitionEnd) { 2053 swiper.onSlideToWrapperTransitionEnd = function transitionEnd(e) { 2054 if (!swiper || swiper.destroyed) return; 2055 if (e.target !== this) return; 2056 swiper.wrapperEl.removeEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd); 2057 swiper.onSlideToWrapperTransitionEnd = null; 2058 delete swiper.onSlideToWrapperTransitionEnd; 2059 swiper.transitionEnd(runCallbacks, direction); 2060 }; 2061 } 2062 swiper.wrapperEl.addEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd); 2063 } 2064 return true; 2065} 2066 2067function slideToLoop(index, speed, runCallbacks, internal) { 2068 if (index === void 0) { 2069 index = 0; 2070 } 2071 if (runCallbacks === void 0) { 2072 runCallbacks = true; 2073 } 2074 if (typeof index === 'string') { 2075 const indexAsNumber = parseInt(index, 10); 2076 index = indexAsNumber; 2077 } 2078 const swiper = this; 2079 if (swiper.destroyed) return; 2080 if (typeof speed === 'undefined') { 2081 speed = swiper.params.speed; 2082 } 2083 const gridEnabled = swiper.grid && swiper.params.grid && swiper.params.grid.rows > 1; 2084 let newIndex = index; 2085 if (swiper.params.loop) { 2086 if (swiper.virtual && swiper.params.virtual.enabled) { 2087 // eslint-disable-next-line 2088 newIndex = newIndex + swiper.virtual.slidesBefore; 2089 } else { 2090 let targetSlideIndex; 2091 if (gridEnabled) { 2092 const slideIndex = newIndex * swiper.params.grid.rows; 2093 targetSlideIndex = swiper.slides.find(slideEl => slideEl.getAttribute('data-swiper-slide-index') * 1 === slideIndex).column; 2094 } else { 2095 targetSlideIndex = swiper.getSlideIndexByData(newIndex); 2096 } 2097 const cols = gridEnabled ? Math.ceil(swiper.slides.length / swiper.params.grid.rows) : swiper.slides.length; 2098 const { 2099 centeredSlides 2100 } = swiper.params; 2101 let slidesPerView = swiper.params.slidesPerView; 2102 if (slidesPerView === 'auto') { 2103 slidesPerView = swiper.slidesPerViewDynamic(); 2104 } else { 2105 slidesPerView = Math.ceil(parseFloat(swiper.params.slidesPerView, 10)); 2106 if (centeredSlides && slidesPerView % 2 === 0) { 2107 slidesPerView = slidesPerView + 1; 2108 } 2109 } 2110 let needLoopFix = cols - targetSlideIndex < slidesPerView; 2111 if (centeredSlides) { 2112 needLoopFix = needLoopFix || targetSlideIndex < Math.ceil(slidesPerView / 2); 2113 } 2114 if (internal && centeredSlides && swiper.params.slidesPerView !== 'auto' && !gridEnabled) { 2115 needLoopFix = false; 2116 } 2117 if (needLoopFix) { 2118 const direction = centeredSlides ? targetSlideIndex < swiper.activeIndex ? 'prev' : 'next' : targetSlideIndex - swiper.activeIndex - 1 < swiper.params.slidesPerView ? 'next' : 'prev'; 2119 swiper.loopFix({ 2120 direction, 2121 slideTo: true, 2122 activeSlideIndex: direction === 'next' ? targetSlideIndex + 1 : targetSlideIndex - cols + 1, 2123 slideRealIndex: direction === 'next' ? swiper.realIndex : undefined 2124 }); 2125 } 2126 if (gridEnabled) { 2127 const slideIndex = newIndex * swiper.params.grid.rows; 2128 newIndex = swiper.slides.find(slideEl => slideEl.getAttribute('data-swiper-slide-index') * 1 === slideIndex).column; 2129 } else { 2130 newIndex = swiper.getSlideIndexByData(newIndex); 2131 } 2132 } 2133 } 2134 requestAnimationFrame(() => { 2135 swiper.slideTo(newIndex, speed, runCallbacks, internal); 2136 }); 2137 return swiper; 2138} 2139 2140/* eslint no-unused-vars: "off" */ 2141function slideNext(speed, runCallbacks, internal) { 2142 if (runCallbacks === void 0) { 2143 runCallbacks = true; 2144 } 2145 const swiper = this; 2146 const { 2147 enabled, 2148 params, 2149 animating 2150 } = swiper; 2151 if (!enabled || swiper.destroyed) return swiper; 2152 if (typeof speed === 'undefined') { 2153 speed = swiper.params.speed; 2154 } 2155 let perGroup = params.slidesPerGroup; 2156 if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) { 2157 perGroup = Math.max(swiper.slidesPerViewDynamic('current', true), 1); 2158 } 2159 const increment = swiper.activeIndex < params.slidesPerGroupSkip ? 1 : perGroup; 2160 const isVirtual = swiper.virtual && params.virtual.enabled; 2161 if (params.loop) { 2162 if (animating && !isVirtual && params.loopPreventsSliding) return false; 2163 swiper.loopFix({ 2164 direction: 'next' 2165 }); 2166 // eslint-disable-next-line 2167 swiper._clientLeft = swiper.wrapperEl.clientLeft; 2168 if (swiper.activeIndex === swiper.slides.length - 1 && params.cssMode) { 2169 requestAnimationFrame(() => { 2170 swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal); 2171 }); 2172 return true; 2173 } 2174 } 2175 if (params.rewind && swiper.isEnd) { 2176 return swiper.slideTo(0, speed, runCallbacks, internal); 2177 } 2178 return swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal); 2179} 2180 2181/* eslint no-unused-vars: "off" */ 2182function slidePrev(speed, runCallbacks, internal) { 2183 if (runCallbacks === void 0) { 2184 runCallbacks = true; 2185 } 2186 const swiper = this; 2187 const { 2188 params, 2189 snapGrid, 2190 slidesGrid, 2191 rtlTranslate, 2192 enabled, 2193 animating 2194 } = swiper; 2195 if (!enabled || swiper.destroyed) return swiper; 2196 if (typeof speed === 'undefined') { 2197 speed = swiper.params.speed; 2198 } 2199 const isVirtual = swiper.virtual && params.virtual.enabled; 2200 if (params.loop) { 2201 if (animating && !isVirtual && params.loopPreventsSliding) return false; 2202 swiper.loopFix({ 2203 direction: 'prev' 2204 }); 2205 // eslint-disable-next-line 2206 swiper._clientLeft = swiper.wrapperEl.clientLeft; 2207 } 2208 const translate = rtlTranslate ? swiper.translate : -swiper.translate; 2209 function normalize(val) { 2210 if (val < 0) return -Math.floor(Math.abs(val)); 2211 return Math.floor(val); 2212 } 2213 const normalizedTranslate = normalize(translate); 2214 const normalizedSnapGrid = snapGrid.map(val => normalize(val)); 2215 const isFreeMode = params.freeMode && params.freeMode.enabled; 2216 let prevSnap = snapGrid[normalizedSnapGrid.indexOf(normalizedTranslate) - 1]; 2217 if (typeof prevSnap === 'undefined' && (params.cssMode || isFreeMode)) { 2218 let prevSnapIndex; 2219 snapGrid.forEach((snap, snapIndex) => { 2220 if (normalizedTranslate >= snap) { 2221 // prevSnap = snap; 2222 prevSnapIndex = snapIndex; 2223 } 2224 }); 2225 if (typeof prevSnapIndex !== 'undefined') { 2226 prevSnap = isFreeMode ? snapGrid[prevSnapIndex] : snapGrid[prevSnapIndex > 0 ? prevSnapIndex - 1 : prevSnapIndex]; 2227 } 2228 } 2229 let prevIndex = 0; 2230 if (typeof prevSnap !== 'undefined') { 2231 prevIndex = slidesGrid.indexOf(prevSnap); 2232 if (prevIndex < 0) prevIndex = swiper.activeIndex - 1; 2233 if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) { 2234 prevIndex = prevIndex - swiper.slidesPerViewDynamic('previous', true) + 1; 2235 prevIndex = Math.max(prevIndex, 0); 2236 } 2237 } 2238 if (params.rewind && swiper.isBeginning) { 2239 const lastIndex = swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual ? swiper.virtual.slides.length - 1 : swiper.slides.length - 1; 2240 return swiper.slideTo(lastIndex, speed, runCallbacks, internal); 2241 } else if (params.loop && swiper.activeIndex === 0 && params.cssMode) { 2242 requestAnimationFrame(() => { 2243 swiper.slideTo(prevIndex, speed, runCallbacks, internal); 2244 }); 2245 return true; 2246 } 2247 return swiper.slideTo(prevIndex, speed, runCallbacks, internal); 2248} 2249 2250/* eslint no-unused-vars: "off" */ 2251function slideReset(speed, runCallbacks, internal) { 2252 if (runCallbacks === void 0) { 2253 runCallbacks = true; 2254 } 2255 const swiper = this; 2256 if (swiper.destroyed) return; 2257 if (typeof speed === 'undefined') { 2258 speed = swiper.params.speed; 2259 } 2260 return swiper.slideTo(swiper.activeIndex, speed, runCallbacks, internal); 2261} 2262 2263/* eslint no-unused-vars: "off" */ 2264function slideToClosest(speed, runCallbacks, internal, threshold) { 2265 if (runCallbacks === void 0) { 2266 runCallbacks = true; 2267 } 2268 if (threshold === void 0) { 2269 threshold = 0.5; 2270 } 2271 const swiper = this; 2272 if (swiper.destroyed) return; 2273 if (typeof speed === 'undefined') { 2274 speed = swiper.params.speed; 2275 } 2276 let index = swiper.activeIndex; 2277 const skip = Math.min(swiper.params.slidesPerGroupSkip, index); 2278 const snapIndex = skip + Math.floor((index - skip) / swiper.params.slidesPerGroup); 2279 const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate; 2280 if (translate >= swiper.snapGrid[snapIndex]) { 2281 // The current translate is on or after the current snap index, so the choice 2282 // is between the current index and the one after it. 2283 const currentSnap = swiper.snapGrid[snapIndex]; 2284 const nextSnap = swiper.snapGrid[snapIndex + 1]; 2285 if (translate - currentSnap > (nextSnap - currentSnap) * threshold) { 2286 index += swiper.params.slidesPerGroup; 2287 } 2288 } else { 2289 // The current translate is before the current snap index, so the choice 2290 // is between the current index and the one before it. 2291 const prevSnap = swiper.snapGrid[snapIndex - 1]; 2292 const currentSnap = swiper.snapGrid[snapIndex]; 2293 if (translate - prevSnap <= (currentSnap - prevSnap) * threshold) { 2294 index -= swiper.params.slidesPerGroup; 2295 } 2296 } 2297 index = Math.max(index, 0); 2298 index = Math.min(index, swiper.slidesGrid.length - 1); 2299 return swiper.slideTo(index, speed, runCallbacks, internal); 2300} 2301 2302function slideToClickedSlide() { 2303 const swiper = this; 2304 if (swiper.destroyed) return; 2305 const { 2306 params, 2307 slidesEl 2308 } = swiper; 2309 const slidesPerView = params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : params.slidesPerView; 2310 let slideToIndex = swiper.
vendor: 6,784 bytes, lines 2310-2482
2310clickedIndex; 2311 let realIndex; 2312 const slideSelector = swiper.isElement ? `swiper-slide` : `.${params.slideClass}`; 2313 if (params.loop) { 2314 if (swiper.animating) return; 2315 realIndex = parseInt(swiper.clickedSlide.getAttribute('data-swiper-slide-index'), 10); 2316 if (params.centeredSlides) { 2317 if (slideToIndex < swiper.loopedSlides - slidesPerView / 2 || slideToIndex > swiper.slides.length - swiper.loopedSlides + slidesPerView / 2) { 2318 swiper.loopFix(); 2319 slideToIndex = swiper.getSlideIndex(elementChildren(slidesEl, `${slideSelector}[data-swiper-slide-index="${realIndex}"]`)[0]); 2320 nextTick(() => { 2321 swiper.slideTo(slideToIndex); 2322 }); 2323 } else { 2324 swiper.slideTo(slideToIndex); 2325 } 2326 } else if (slideToIndex > swiper.slides.length - slidesPerView) { 2327 swiper.loopFix(); 2328 slideToIndex = swiper.getSlideIndex(elementChildren(slidesEl, `${slideSelector}[data-swiper-slide-index="${realIndex}"]`)[0]); 2329 nextTick(() => { 2330 swiper.slideTo(slideToIndex); 2331 }); 2332 } else { 2333 swiper.slideTo(slideToIndex); 2334 } 2335 } else { 2336 swiper.slideTo(slideToIndex); 2337 } 2338} 2339 2340var slide = { 2341 slideTo, 2342 slideToLoop, 2343 slideNext, 2344 slidePrev, 2345 slideReset, 2346 slideToClosest, 2347 slideToClickedSlide 2348}; 2349 2350function loopCreate(slideRealIndex) { 2351 const swiper = this; 2352 const { 2353 params, 2354 slidesEl 2355 } = swiper; 2356 if (!params.loop || swiper.virtual && swiper.params.virtual.enabled) return; 2357 const initSlides = () => { 2358 const slides = elementChildren(slidesEl, `.${params.slideClass}, swiper-slide`); 2359 slides.forEach((el, index) => { 2360 el.setAttribute('data-swiper-slide-index', index); 2361 }); 2362 }; 2363 const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1; 2364 const slidesPerGroup = params.slidesPerGroup * (gridEnabled ? params.grid.rows : 1); 2365 const shouldFillGroup = swiper.slides.length % slidesPerGroup !== 0; 2366 const shouldFillGrid = gridEnabled && swiper.slides.length % params.grid.rows !== 0; 2367 const addBlankSlides = amountOfSlides => { 2368 for (let i = 0; i < amountOfSlides; i += 1) { 2369 const slideEl = swiper.isElement ? createElement('swiper-slide', [params.slideBlankClass]) : createElement('div', [params.slideClass, params.slideBlankClass]); 2370 swiper.slidesEl.append(slideEl); 2371 } 2372 }; 2373 if (shouldFillGroup) { 2374 if (params.loopAddBlankSlides) { 2375 const slidesToAdd = slidesPerGroup - swiper.slides.length % slidesPerGroup; 2376 addBlankSlides(slidesToAdd); 2377 swiper.recalcSlides(); 2378 swiper.updateSlides(); 2379 } else { 2380 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)'); 2381 } 2382 initSlides(); 2383 } else if (shouldFillGrid) { 2384 if (params.loopAddBlankSlides) { 2385 const slidesToAdd = params.grid.rows - swiper.slides.length % params.grid.rows; 2386 addBlankSlides(slidesToAdd); 2387 swiper.recalcSlides(); 2388 swiper.updateSlides(); 2389 } else { 2390 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)'); 2391 } 2392 initSlides(); 2393 } else { 2394 initSlides(); 2395 } 2396 swiper.loopFix({ 2397 slideRealIndex, 2398 direction: params.centeredSlides ? undefined : 'next' 2399 }); 2400} 2401 2402function loopFix(_temp) { 2403 let { 2404 slideRealIndex, 2405 slideTo = true, 2406 direction, 2407 setTranslate, 2408 activeSlideIndex, 2409 byController, 2410 byMousewheel 2411 } = _temp === void 0 ? {} : _temp; 2412 const swiper = this; 2413 if (!swiper.params.loop) return; 2414 swiper.emit('beforeLoopFix'); 2415 const { 2416 slides, 2417 allowSlidePrev, 2418 allowSlideNext, 2419 slidesEl, 2420 params 2421 } = swiper; 2422 const { 2423 centeredSlides 2424 } = params; 2425 swiper.allowSlidePrev = true; 2426 swiper.allowSlideNext = true; 2427 if (swiper.virtual && params.virtual.enabled) { 2428 if (slideTo) { 2429 if (!params.centeredSlides && swiper.snapIndex === 0) { 2430 swiper.slideTo(swiper.virtual.slides.length, 0, false, true); 2431 } else if (params.centeredSlides && swiper.snapIndex < params.slidesPerView) { 2432 swiper.slideTo(swiper.virtual.slides.length + swiper.snapIndex, 0, false, true); 2433 } else if (swiper.snapIndex === swiper.snapGrid.length - 1) { 2434 swiper.slideTo(swiper.virtual.slidesBefore, 0, false, true); 2435 } 2436 } 2437 swiper.allowSlidePrev = allowSlidePrev; 2438 swiper.allowSlideNext = allowSlideNext; 2439 swiper.emit('loopFix'); 2440 return; 2441 } 2442 let slidesPerView = params.slidesPerView; 2443 if (slidesPerView === 'auto') { 2444 slidesPerView = swiper.slidesPerViewDynamic(); 2445 } else { 2446 slidesPerView = Math.ceil(parseFloat(params.slidesPerView, 10)); 2447 if (centeredSlides && slidesPerView % 2 === 0) { 2448 slidesPerView = slidesPerView + 1; 2449 } 2450 } 2451 const slidesPerGroup = params.slidesPerGroupAuto ? slidesPerView : params.slidesPerGroup; 2452 let loopedSlides = slidesPerGroup; 2453 if (loopedSlides % slidesPerGroup !== 0) { 2454 loopedSlides += slidesPerGroup - loopedSlides % slidesPerGroup; 2455 } 2456 loopedSlides += params.loopAdditionalSlides; 2457 swiper.loopedSlides = loopedSlides; 2458 const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1; 2459 if (slides.length < slidesPerView + loopedSlides) { 2460 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'); 2461 } else if (gridEnabled && params.grid.fill === 'row') { 2462 showWarning('Swiper Loop Warning: Loop mode is not compatible with grid.fill = `row`'); 2463 } 2464 const prependSlidesIndexes = []; 2465 const appendSlidesIndexes = []; 2466 let activeIndex = swiper.activeIndex; 2467 if (typeof activeSlideIndex === 'undefined') { 2468 activeSlideIndex = swiper.getSlideIndex(slides.find(el => el.classList.contains(params.slideActiveClass))); 2469 } else { 2470 activeIndex = activeSlideIndex; 2471 } 2472 const isNext = direction === 'next' || !direction; 2473 const isPrev = direction === 'prev' || !direction; 2474 let slidesPrepended = 0; 2475 let slidesAppended = 0; 2476 const cols = gridEnabled ? Math.ceil(slides.length / params.grid.rows) : slides.length; 2477 const activeColIndex = gridEnabled ? slides[activeSlideIndex].column : activeSlideIndex; 2478 const activeColIndexWithShift = activeColIndex + (centeredSlides && typeof setTranslate === 'undefined' ? -slidesPerView / 2 + 0.5 : 0); 2479 // prepend last slides before start 2480 if (activeColIndexWithShift < loopedSlides) { 2481 slidesPrepended = Math.max(loopedSlides - activeColIndexWithShift, slidesPerGroup); 2482 for (let i = 0; i < loopedSlides - activeColIndexWithShift; i += 1) {
vendor: 5,179 bytes, lines 2483-2615
2483 const index = i - Math.floor(i / cols) * cols; 2484 if (gridEnabled) { 2485 const colIndexToPrepend = cols - index - 1; 2486 for (let i = slides.length - 1; i >= 0; i -= 1) { 2487 if (slides[i].column === colIndexToPrepend) prependSlidesIndexes.push(i); 2488 } 2489 // slides.forEach((slide, slideIndex) => { 2490 // if (slide.column === colIndexToPrepend) prependSlidesIndexes.push(slideIndex); 2491 // }); 2492 } else { 2493 prependSlidesIndexes.push(cols - index - 1); 2494 } 2495 } 2496 } else if (activeColIndexWithShift + slidesPerView > cols - loopedSlides) { 2497 slidesAppended = Math.max(activeColIndexWithShift - (cols - loopedSlides * 2), slidesPerGroup); 2498 for (let i = 0; i < slidesAppended; i += 1) { 2499 const index = i - Math.floor(i / cols) * cols; 2500 if (gridEnabled) { 2501 slides.forEach((slide, slideIndex) => { 2502 if (slide.column === index) appendSlidesIndexes.push(slideIndex); 2503 }); 2504 } else { 2505 appendSlidesIndexes.push(index); 2506 } 2507 } 2508 } 2509 swiper.__preventObserver__ = true; 2510 requestAnimationFrame(() => { 2511 swiper.__preventObserver__ = false; 2512 }); 2513 if (isPrev) { 2514 prependSlidesIndexes.forEach(index => { 2515 slides[index].swiperLoopMoveDOM = true; 2516 slidesEl.prepend(slides[index]); 2517 slides[index].swiperLoopMoveDOM = false; 2518 }); 2519 } 2520 if (isNext) { 2521 appendSlidesIndexes.forEach(index => { 2522 slides[index].swiperLoopMoveDOM = true; 2523 slidesEl.append(slides[index]); 2524 slides[index].swiperLoopMoveDOM = false; 2525 }); 2526 } 2527 swiper.recalcSlides(); 2528 if (params.slidesPerView === 'auto') { 2529 swiper.updateSlides(); 2530 } else if (gridEnabled && (prependSlidesIndexes.length > 0 && isPrev || appendSlidesIndexes.length > 0 && isNext)) { 2531 swiper.slides.forEach((slide, slideIndex) => { 2532 swiper.grid.updateSlide(slideIndex, slide, swiper.slides); 2533 }); 2534 } 2535 if (params.watchSlidesProgress) { 2536 swiper.updateSlidesOffset(); 2537 } 2538 if (slideTo) { 2539 if (prependSlidesIndexes.length > 0 && isPrev) { 2540 if (typeof slideRealIndex === 'undefined') { 2541 const currentSlideTranslate = swiper.slidesGrid[activeIndex]; 2542 const newSlideTranslate = swiper.slidesGrid[activeIndex + slidesPrepended]; 2543 const diff = newSlideTranslate - currentSlideTranslate; 2544 if (byMousewheel) { 2545 swiper.setTranslate(swiper.translate - diff); 2546 } else { 2547 swiper.slideTo(activeIndex + Math.ceil(slidesPrepended), 0, false, true); 2548 if (setTranslate) { 2549 swiper.touchEventsData.startTranslate = swiper.touchEventsData.startTranslate - diff; 2550 swiper.touchEventsData.currentTranslate = swiper.touchEventsData.currentTranslate - diff; 2551 } 2552 } 2553 } else { 2554 if (setTranslate) { 2555 const shift = gridEnabled ? prependSlidesIndexes.length / params.grid.rows : prependSlidesIndexes.length; 2556 swiper.slideTo(swiper.activeIndex + shift, 0, false, true); 2557 swiper.touchEventsData.currentTranslate = swiper.translate; 2558 } 2559 } 2560 } else if (appendSlidesIndexes.length > 0 && isNext) { 2561 if (typeof slideRealIndex === 'undefined') { 2562 const currentSlideTranslate = swiper.slidesGrid[activeIndex]; 2563 const newSlideTranslate = swiper.slidesGrid[activeIndex - slidesAppended]; 2564 const diff = newSlideTranslate - currentSlideTranslate; 2565 if (byMousewheel) { 2566 swiper.setTranslate(swiper.translate - diff); 2567 } else { 2568 swiper.slideTo(activeIndex - slidesAppended, 0, false, true); 2569 if (setTranslate) { 2570 swiper.touchEventsData.startTranslate = swiper.touchEventsData.startTranslate - diff; 2571 swiper.touchEventsData.currentTranslate = swiper.touchEventsData.currentTranslate - diff; 2572 } 2573 } 2574 } else { 2575 const shift = gridEnabled ? appendSlidesIndexes.length / params.grid.rows : appendSlidesIndexes.length; 2576 swiper.slideTo(swiper.activeIndex - shift, 0, false, true); 2577 } 2578 } 2579 } 2580 swiper.allowSlidePrev = allowSlidePrev; 2581 swiper.allowSlideNext = allowSlideNext; 2582 if (swiper.controller && swiper.controller.control && !byController) { 2583 const loopParams = { 2584 slideRealIndex, 2585 direction, 2586 setTranslate, 2587 activeSlideIndex, 2588 byController: true 2589 }; 2590 if (Array.isArray(swiper.controller.control)) { 2591 swiper.controller.control.forEach(c => { 2592 if (!c.destroyed && c.params.loop) c.loopFix({ 2593 ...loopParams, 2594 slideTo: c.params.slidesPerView === params.slidesPerView ? slideTo : false 2595 }); 2596 }); 2597 } else if (swiper.controller.control instanceof swiper.constructor && swiper.controller.control.params.loop) { 2598 swiper.controller.control.loopFix({ 2599 ...loopParams, 2600 slideTo: swiper.controller.control.params.slidesPerView === params.slidesPerView ? slideTo : false 2601 }); 2602 } 2603 } 2604 swiper.emit('loopFix'); 2605} 2606 2607function loopDestroy() { 2608 const swiper = this; 2609 const { 2610 params, 2611 slidesEl 2612 } = swiper; 2613 if (!params.loop || swiper.virtual && swiper.params.virtual.enabled) return; 2614 swiper.recalcSlides(); 2615 const newSlidesOrder = [];
vendor: 5,200 bytes, lines 2616-2781
2616 swiper.slides.forEach(slideEl => { 2617 const index = typeof slideEl.swiperSlideIndex === 'undefined' ? slideEl.getAttribute('data-swiper-slide-index') * 1 : slideEl.swiperSlideIndex; 2618 newSlidesOrder[index] = slideEl; 2619 }); 2620 swiper.slides.forEach(slideEl => { 2621 slideEl.removeAttribute('data-swiper-slide-index'); 2622 }); 2623 newSlidesOrder.forEach(slideEl => { 2624 slidesEl.append(slideEl); 2625 }); 2626 swiper.recalcSlides(); 2627 swiper.slideTo(swiper.realIndex, 0); 2628} 2629 2630var loop = { 2631 loopCreate, 2632 loopFix, 2633 loopDestroy 2634}; 2635 2636function setGrabCursor(moving) { 2637 const swiper = this; 2638 if (!swiper.params.simulateTouch || swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) return; 2639 const el = swiper.params.touchEventsTarget === 'container' ? swiper.el : swiper.wrapperEl; 2640 if (swiper.isElement) { 2641 swiper.__preventObserver__ = true; 2642 } 2643 el.style.cursor = 'move'; 2644 el.style.cursor = moving ? 'grabbing' : 'grab'; 2645 if (swiper.isElement) { 2646 requestAnimationFrame(() => { 2647 swiper.__preventObserver__ = false; 2648 }); 2649 } 2650} 2651 2652function unsetGrabCursor() { 2653 const swiper = this; 2654 if (swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) { 2655 return; 2656 } 2657 if (swiper.isElement) { 2658 swiper.__preventObserver__ = true; 2659 } 2660 swiper[swiper.params.touchEventsTarget === 'container' ? 'el' : 'wrapperEl'].style.cursor = ''; 2661 if (swiper.isElement) { 2662 requestAnimationFrame(() => { 2663 swiper.__preventObserver__ = false; 2664 }); 2665 } 2666} 2667 2668var grabCursor = { 2669 setGrabCursor, 2670 unsetGrabCursor 2671}; 2672 2673// Modified from https://stackoverflow.com/questions/54520554/custom-element-getrootnode-closest-function-crossing-multiple-parent-shadowd 2674function closestElement(selector, base) { 2675 if (base === void 0) { 2676 base = this; 2677 } 2678 function __closestFrom(el) { 2679 if (!el || el === getDocument() || el === getWindow()) return null; 2680 if (el.assignedSlot) el = el.assignedSlot; 2681 const found = el.closest(selector); 2682 if (!found && !el.getRootNode) { 2683 return null; 2684 } 2685 return found || __closestFrom(el.getRootNode().host); 2686 } 2687 return __closestFrom(base); 2688} 2689function preventEdgeSwipe(swiper, event, startX) { 2690 const window = getWindow(); 2691 const { 2692 params 2693 } = swiper; 2694 const edgeSwipeDetection = params.edgeSwipeDetection; 2695 const edgeSwipeThreshold = params.edgeSwipeThreshold; 2696 if (edgeSwipeDetection && (startX <= edgeSwipeThreshold || startX >= window.innerWidth - edgeSwipeThreshold)) { 2697 if (edgeSwipeDetection === 'prevent') { 2698 event.preventDefault(); 2699 return true; 2700 } 2701 return false; 2702 } 2703 return true; 2704} 2705function onTouchStart(event) { 2706 const swiper = this; 2707 const document = getDocument(); 2708 let e = event; 2709 if (e.originalEvent) e = e.originalEvent; 2710 const data = swiper.touchEventsData; 2711 if (e.type === 'pointerdown') { 2712 if (data.pointerId !== null && data.pointerId !== e.pointerId) { 2713 return; 2714 } 2715 data.pointerId = e.pointerId; 2716 } else if (e.type === 'touchstart' && e.targetTouches.length === 1) { 2717 data.touchId = e.targetTouches[0].identifier; 2718 } 2719 if (e.type === 'touchstart') { 2720 // don't proceed touch event 2721 preventEdgeSwipe(swiper, e, e.targetTouches[0].pageX); 2722 return; 2723 } 2724 const { 2725 params, 2726 touches, 2727 enabled 2728 } = swiper; 2729 if (!enabled) return; 2730 if (!params.simulateTouch && e.pointerType === 'mouse') return; 2731 if (swiper.animating && params.preventInteractionOnTransition) { 2732 return; 2733 } 2734 if (!swiper.animating && params.cssMode && params.loop) { 2735 swiper.loopFix(); 2736 } 2737 let targetEl = e.target; 2738 if (params.touchEventsTarget === 'wrapper') { 2739 if (!elementIsChildOf(targetEl, swiper.wrapperEl)) return; 2740 } 2741 if ('which' in e && e.which === 3) return; 2742 if ('button' in e && e.button > 0) return; 2743 if (data.isTouched && data.isMoved) return; 2744 2745 // change target el for shadow root component 2746 const swipingClassHasValue = !!params.noSwipingClass && params.noSwipingClass !== ''; 2747 // eslint-disable-next-line 2748 const eventPath = e.composedPath ? e.composedPath() : e.path; 2749 if (swipingClassHasValue && e.target && e.target.shadowRoot && eventPath) { 2750 targetEl = eventPath[0]; 2751 } 2752 const noSwipingSelector = params.noSwipingSelector ? params.noSwipingSelector : `.${params.noSwipingClass}`; 2753 const isTargetShadow = !!(e.target && e.target.shadowRoot); 2754 2755 // use closestElement for shadow root element to get the actual closest for nested shadow root element 2756 if (params.noSwiping && (isTargetShadow ? closestElement(noSwipingSelector, targetEl) : targetEl.closest(noSwipingSelector))) { 2757 swiper.allowClick = true; 2758 return; 2759 } 2760 if (params.swipeHandler) { 2761 if (!targetEl.closest(params.swipeHandler)) return; 2762 } 2763 touches.currentX = e.pageX; 2764 touches.currentY = e.pageY; 2765 const startX = touches.currentX; 2766 const startY = touches.currentY; 2767 2768 // Do NOT start if iOS edge swipe is detected. Otherwise iOS app cannot swipe-to-go-back anymore 2769 2770 if (!preventEdgeSwipe(swiper, e, startX)) { 2771 return; 2772 } 2773 Object.assign(data, { 2774 isTouched: true, 2775 isMoved: false, 2776 allowTouchCallbacks: true, 2777 isScrolling: undefined, 2778 startMoving: undefined 2779 }); 2780 touches.startX = startX; 2781 touches.startY = startY;
vendor: 3,004 bytes, lines 2782-2869
2782 data.touchStartTime = now(); 2783 swiper.allowClick = true; 2784 swiper.updateSize(); 2785 swiper.swipeDirection = undefined; 2786 if (params.threshold > 0) data.allowThresholdMove = false; 2787 let preventDefault = true; 2788 if (targetEl.matches(data.focusableElements)) { 2789 preventDefault = false; 2790 if (targetEl.nodeName === 'SELECT') { 2791 data.isTouched = false; 2792 } 2793 } 2794 if (document.activeElement && document.activeElement.matches(data.focusableElements) && document.activeElement !== targetEl && (e.pointerType === 'mouse' || e.pointerType !== 'mouse' && !targetEl.matches(data.focusableElements))) { 2795 document.activeElement.blur(); 2796 } 2797 const shouldPreventDefault = preventDefault && swiper.allowTouchMove && params.touchStartPreventDefault; 2798 if ((params.touchStartForcePreventDefault || shouldPreventDefault) && !targetEl.isContentEditable) { 2799 e.preventDefault(); 2800 } 2801 if (params.freeMode && params.freeMode.enabled && swiper.freeMode && swiper.animating && !params.cssMode) { 2802 swiper.freeMode.onTouchStart(); 2803 } 2804 swiper.emit('touchStart', e); 2805} 2806 2807function onTouchMove(event) { 2808 const document = getDocument(); 2809 const swiper = this; 2810 const data = swiper.touchEventsData; 2811 const { 2812 params, 2813 touches, 2814 rtlTranslate: rtl, 2815 enabled 2816 } = swiper; 2817 if (!enabled) return; 2818 if (!params.simulateTouch && event.pointerType === 'mouse') return; 2819 let e = event; 2820 if (e.originalEvent) e = e.originalEvent; 2821 if (e.type === 'pointermove') { 2822 if (data.touchId !== null) return; // return from pointer if we use touch 2823 const id = e.pointerId; 2824 if (id !== data.pointerId) return; 2825 } 2826 let targetTouch; 2827 if (e.type === 'touchmove') { 2828 targetTouch = [...e.changedTouches].find(t => t.identifier === data.touchId); 2829 if (!targetTouch || targetTouch.identifier !== data.touchId) return; 2830 } else { 2831 targetTouch = e; 2832 } 2833 if (!data.isTouched) { 2834 if (data.startMoving && data.isScrolling) { 2835 swiper.emit('touchMoveOpposite', e); 2836 } 2837 return; 2838 } 2839 const pageX = targetTouch.pageX; 2840 const pageY = targetTouch.pageY; 2841 if (e.preventedByNestedSwiper) { 2842 touches.startX = pageX; 2843 touches.startY = pageY; 2844 return; 2845 } 2846 if (!swiper.allowTouchMove) { 2847 if (!e.target.matches(data.focusableElements)) { 2848 swiper.allowClick = false; 2849 } 2850 if (data.isTouched) { 2851 Object.assign(touches, { 2852 startX: pageX, 2853 startY: pageY, 2854 currentX: pageX, 2855 currentY: pageY 2856 }); 2857 data.touchStartTime = now(); 2858 } 2859 return; 2860 } 2861 if (params.touchReleaseOnEdges && !params.loop) { 2862 if (swiper.isVertical()) { 2863 // Vertical 2864 if (pageY < touches.startY && swiper.translate <= swiper.maxTranslate() || pageY > touches.startY && swiper.translate >= swiper.minTranslate()) { 2865 data.isTouched = false; 2866 data.isMoved = false; 2867 return; 2868 } 2869 } else if (pageX < touches.startX && swiper.translate <= swiper.maxTranslate() || pageX > touches.startX && swiper.translate >= swiper.minTranslate(
vendor: 13,442 bytes, lines 2869-3234
2869)) { 2870 return; 2871 } 2872 } 2873 if (document.activeElement && document.activeElement.matches(data.focusableElements) && document.activeElement !== e.target && e.pointerType !== 'mouse') { 2874 document.activeElement.blur(); 2875 } 2876 if (document.activeElement) { 2877 if (e.target === document.activeElement && e.target.matches(data.focusableElements)) { 2878 data.isMoved = true; 2879 swiper.allowClick = false; 2880 return; 2881 } 2882 } 2883 if (data.allowTouchCallbacks) { 2884 swiper.emit('touchMove', e); 2885 } 2886 touches.previousX = touches.currentX; 2887 touches.previousY = touches.currentY; 2888 touches.currentX = pageX; 2889 touches.currentY = pageY; 2890 const diffX = touches.currentX - touches.startX; 2891 const diffY = touches.currentY - touches.startY; 2892 if (swiper.params.threshold && Math.sqrt(diffX ** 2 + diffY ** 2) < swiper.params.threshold) return; 2893 if (typeof data.isScrolling === 'undefined') { 2894 let touchAngle; 2895 if (swiper.isHorizontal() && touches.currentY === touches.startY || swiper.isVertical() && touches.currentX === touches.startX) { 2896 data.isScrolling = false; 2897 } else { 2898 // eslint-disable-next-line 2899 if (diffX * diffX + diffY * diffY >= 25) { 2900 touchAngle = Math.atan2(Math.abs(diffY), Math.abs(diffX)) * 180 / Math.PI; 2901 data.isScrolling = swiper.isHorizontal() ? touchAngle > params.touchAngle : 90 - touchAngle > params.touchAngle; 2902 } 2903 } 2904 } 2905 if (data.isScrolling) { 2906 swiper.emit('touchMoveOpposite', e); 2907 } 2908 if (typeof data.startMoving === 'undefined') { 2909 if (touches.currentX !== touches.startX || touches.currentY !== touches.startY) { 2910 data.startMoving = true; 2911 } 2912 } 2913 if (data.isScrolling || e.type === 'touchmove' && data.preventTouchMoveFromPointerMove) { 2914 data.isTouched = false; 2915 return; 2916 } 2917 if (!data.startMoving) { 2918 return; 2919 } 2920 swiper.allowClick = false; 2921 if (!params.cssMode && e.cancelable) { 2922 e.preventDefault(); 2923 } 2924 if (params.touchMoveStopPropagation && !params.nested) { 2925 e.stopPropagation(); 2926 } 2927 let diff = swiper.isHorizontal() ? diffX : diffY; 2928 let touchesDiff = swiper.isHorizontal() ? touches.currentX - touches.previousX : touches.currentY - touches.previousY; 2929 if (params.oneWayMovement) { 2930 diff = Math.abs(diff) * (rtl ? 1 : -1); 2931 touchesDiff = Math.abs(touchesDiff) * (rtl ? 1 : -1); 2932 } 2933 touches.diff = diff; 2934 diff *= params.touchRatio; 2935 if (rtl) { 2936 diff = -diff; 2937 touchesDiff = -touchesDiff; 2938 } 2939 const prevTouchesDirection = swiper.touchesDirection; 2940 swiper.swipeDirection = diff > 0 ? 'prev' : 'next'; 2941 swiper.touchesDirection = touchesDiff > 0 ? 'prev' : 'next'; 2942 const isLoop = swiper.params.loop && !params.cssMode; 2943 const allowLoopFix = swiper.touchesDirection === 'next' && swiper.allowSlideNext || swiper.touchesDirection === 'prev' && swiper.allowSlidePrev; 2944 if (!data.isMoved) { 2945 if (isLoop && allowLoopFix) { 2946 swiper.loopFix({ 2947 direction: swiper.swipeDirection 2948 }); 2949 } 2950 data.startTranslate = swiper.getTranslate(); 2951 swiper.setTransition(0); 2952 if (swiper.animating) { 2953 const evt = new window.CustomEvent('transitionend', { 2954 bubbles: true, 2955 cancelable: true, 2956 detail: { 2957 bySwiperTouchMove: true 2958 } 2959 }); 2960 swiper.wrapperEl.dispatchEvent(evt); 2961 } 2962 data.allowMomentumBounce = false; 2963 // Grab Cursor 2964 if (params.grabCursor && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) { 2965 swiper.setGrabCursor(true); 2966 } 2967 swiper.emit('sliderFirstMove', e); 2968 } 2969 let loopFixed; 2970 new Date().getTime(); 2971 if (params._loopSwapReset !== false && data.isMoved && data.allowThresholdMove && prevTouchesDirection !== swiper.touchesDirection && isLoop && allowLoopFix && Math.abs(diff) >= 1) { 2972 Object.assign(touches, { 2973 startX: pageX, 2974 startY: pageY, 2975 currentX: pageX, 2976 currentY: pageY, 2977 startTranslate: data.currentTranslate 2978 }); 2979 data.loopSwapReset = true; 2980 data.startTranslate = data.currentTranslate; 2981 return; 2982 } 2983 swiper.emit('sliderMove', e); 2984 data.isMoved = true; 2985 data.currentTranslate = diff + data.startTranslate; 2986 let disableParentSwiper = true; 2987 let resistanceRatio = params.resistanceRatio; 2988 if (params.touchReleaseOnEdges) { 2989 resistanceRatio = 0; 2990 } 2991 if (diff > 0) { 2992 if (isLoop && allowLoopFix && !loopFixed && data.allowThresholdMove && data.currentTranslate > (params.centeredSlides ? swiper.minTranslate() - swiper.slidesSizesGrid[swiper.activeIndex + 1] - (params.slidesPerView !== 'auto' && swiper.slides.length - params.slidesPerView >= 2 ? swiper.slidesSizesGrid[swiper.activeIndex + 1] + swiper.params.spaceBetween : 0) - swiper.params.spaceBetween : swiper.minTranslate())) { 2993 swiper.loopFix({ 2994 direction: 'prev', 2995 setTranslate: true, 2996 activeSlideIndex: 0 2997 }); 2998 } 2999 if (data.currentTranslate > swiper.minTranslate()) { 3000 disableParentSwiper = false; 3001 if (params.resistance) { 3002 data.currentTranslate = swiper.minTranslate() - 1 + (-swiper.minTranslate() + data.startTranslate + diff) ** resistanceRatio; 3003 } 3004 } 3005 } else if (diff < 0) { 3006 if (isLoop && allowLoopFix && !loopFixed && data.allowThresholdMove && data.currentTranslate < (params.centeredSlides ? swiper.maxTranslate() + swiper.slidesSizesGrid[swiper.slidesSizesGrid.length - 1] + swiper.params.spaceBetween + (params.slidesPerView !== 'auto' && swiper.slides.length - params.slidesPerView >= 2 ? swiper.slidesSizesGrid[swiper.slidesSizesGrid.length - 1] + swiper.params.spaceBetween : 0) : swiper.maxTranslate())) { 3007 swiper.loopFix({ 3008 direction: 'next', 3009 setTranslate: true, 3010 activeSlideIndex: swiper.slides.length - (params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : Math.ceil(parseFloat(params.slidesPerView, 10))) 3011 }); 3012 } 3013 if (data.currentTranslate < swiper.maxTranslate()) { 3014 disableParentSwiper = false; 3015 if (params.resistance) { 3016 data.currentTranslate = swiper.maxTranslate() + 1 - (swiper.maxTranslate() - data.startTranslate - diff) ** resistanceRatio; 3017 } 3018 } 3019 } 3020 if (disableParentSwiper) { 3021 e.preventedByNestedSwiper = true; 3022 } 3023 3024 // Directions locks 3025 if (!swiper.allowSlideNext && swiper.swipeDirection === 'next' && data.currentTranslate < data.startTranslate) { 3026 data.currentTranslate = data.startTranslate; 3027 } 3028 if (!swiper.allowSlidePrev && swiper.swipeDirection === 'prev' && data.currentTranslate > data.startTranslate) { 3029 data.currentTranslate = data.startTranslate; 3030 } 3031 if (!swiper.allowSlidePrev && !swiper.allowSlideNext) { 3032 data.currentTranslate = data.startTranslate; 3033 } 3034 3035 // Threshold 3036 if (params.threshold > 0) { 3037 if (Math.abs(diff) > params.threshold || data.allowThresholdMove) { 3038 if (!data.allowThresholdMove) { 3039 data.allowThresholdMove = true; 3040 touches.startX = touches.currentX; 3041 touches.startY = touches.currentY; 3042 data.currentTranslate = data.startTranslate; 3043 touches.diff = swiper.isHorizontal() ? touches.currentX - touches.startX : touches.currentY - touches.startY; 3044 return; 3045 } 3046 } else { 3047 data.currentTranslate = data.startTranslate; 3048 return; 3049 } 3050 } 3051 if (!params.followFinger || params.cssMode) return; 3052 3053 // Update active index in free mode 3054 if (params.freeMode && params.freeMode.enabled && swiper.freeMode || params.watchSlidesProgress) { 3055 swiper.updateActiveIndex(); 3056 swiper.updateSlidesClasses(); 3057 } 3058 if (params.freeMode && params.freeMode.enabled && swiper.freeMode) { 3059 swiper.freeMode.onTouchMove(); 3060 } 3061 // Update progress 3062 swiper.updateProgress(data.currentTranslate); 3063 // Update translate 3064 swiper.setTranslate(data.currentTranslate); 3065} 3066 3067function onTouchEnd(event) { 3068 const swiper = this; 3069 const data = swiper.touchEventsData; 3070 let e = event; 3071 if (e.originalEvent) e = e.originalEvent; 3072 let targetTouch; 3073 const isTouchEvent = e.type === 'touchend' || e.type === 'touchcancel'; 3074 if (!isTouchEvent) { 3075 if (data.touchId !== null) return; // return from pointer if we use touch 3076 if (e.pointerId !== data.pointerId) return; 3077 targetTouch = e; 3078 } else { 3079 targetTouch = [...e.changedTouches].find(t => t.identifier === data.touchId); 3080 if (!targetTouch || targetTouch.identifier !== data.touchId) return; 3081 } 3082 if (['pointercancel', 'pointerout', 'pointerleave', 'contextmenu'].includes(e.type)) { 3083 const proceed = ['pointercancel', 'contextmenu'].includes(e.type) && (swiper.browser.isSafari || swiper.browser.isWebView); 3084 if (!proceed) { 3085 return; 3086 } 3087 } 3088 data.pointerId = null; 3089 data.touchId = null; 3090 const { 3091 params, 3092 touches, 3093 rtlTranslate: rtl, 3094 slidesGrid, 3095 enabled 3096 } = swiper; 3097 if (!enabled) return; 3098 if (!params.simulateTouch && e.pointerType === 'mouse') return; 3099 if (data.allowTouchCallbacks) { 3100 swiper.emit('touchEnd', e); 3101 } 3102 data.allowTouchCallbacks = false; 3103 if (!data.isTouched) { 3104 if (data.isMoved && params.grabCursor) { 3105 swiper.setGrabCursor(false); 3106 } 3107 data.isMoved = false; 3108 data.startMoving = false; 3109 return; 3110 } 3111 3112 // Return Grab Cursor 3113 if (params.grabCursor && data.isMoved && data.isTouched && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) { 3114 swiper.setGrabCursor(false); 3115 } 3116 3117 // Time diff 3118 const touchEndTime = now(); 3119 const timeDiff = touchEndTime - data.touchStartTime; 3120 3121 // Tap, doubleTap, Click 3122 if (swiper.allowClick) { 3123 const pathTree = e.path || e.composedPath && e.composedPath(); 3124 swiper.updateClickedSlide(pathTree && pathTree[0] || e.target, pathTree); 3125 swiper.emit('tap click', e); 3126 if (timeDiff < 300 && touchEndTime - data.lastClickTime < 300) { 3127 swiper.emit('doubleTap doubleClick', e); 3128 } 3129 } 3130 data.lastClickTime = now(); 3131 nextTick(() => { 3132 if (!swiper.destroyed) swiper.allowClick = true; 3133 }); 3134 if (!data.isTouched || !data.isMoved || !swiper.swipeDirection || touches.diff === 0 && !data.loopSwapReset || data.currentTranslate === data.startTranslate && !data.loopSwapReset) { 3135 data.isTouched = false; 3136 data.isMoved = false; 3137 data.startMoving = false; 3138 return; 3139 } 3140 data.isTouched = false; 3141 data.isMoved = false; 3142 data.startMoving = false; 3143 let currentPos; 3144 if (params.followFinger) { 3145 currentPos = rtl ? swiper.translate : -swiper.translate; 3146 } else { 3147 currentPos = -data.currentTranslate; 3148 } 3149 if (params.cssMode) { 3150 return; 3151 } 3152 if (params.freeMode && params.freeMode.enabled) { 3153 swiper.freeMode.onTouchEnd({ 3154 currentPos 3155 }); 3156 return; 3157 } 3158 3159 // Find current slide 3160 const swipeToLast = currentPos >= -swiper.maxTranslate() && !swiper.params.loop; 3161 let stopIndex = 0; 3162 let groupSize = swiper.slidesSizesGrid[0]; 3163 for (let i = 0; i < slidesGrid.length; i += i < params.slidesPerGroupSkip ? 1 : params.slidesPerGroup) { 3164 const increment = i < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup; 3165 if (typeof slidesGrid[i + increment] !== 'undefined') { 3166 if (swipeToLast || currentPos >= slidesGrid[i] && currentPos < slidesGrid[i + increment]) { 3167 stopIndex = i; 3168 groupSize = slidesGrid[i + increment] - slidesGrid[i]; 3169 } 3170 } else if (swipeToLast || currentPos >= slidesGrid[i]) { 3171 stopIndex = i; 3172 groupSize = slidesGrid[slidesGrid.length - 1] - slidesGrid[slidesGrid.length - 2]; 3173 } 3174 } 3175 let rewindFirstIndex = null; 3176 let rewindLastIndex = null; 3177 if (params.rewind) { 3178 if (swiper.isBeginning) { 3179 rewindLastIndex = params.virtual && params.virtual.enabled && swiper.virtual ? swiper.virtual.slides.length - 1 : swiper.slides.length - 1; 3180 } else if (swiper.isEnd) { 3181 rewindFirstIndex = 0; 3182 } 3183 } 3184 // Find current slide size 3185 const ratio = (currentPos - slidesGrid[stopIndex]) / groupSize; 3186 const increment = stopIndex < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup; 3187 if (timeDiff > params.longSwipesMs) { 3188 // Long touches 3189 if (!params.longSwipes) { 3190 swiper.slideTo(swiper.activeIndex); 3191 return; 3192 } 3193 if (swiper.swipeDirection === 'next') { 3194 if (ratio >= params.longSwipesRatio) swiper.slideTo(params.rewind && swiper.isEnd ? rewindFirstIndex : stopIndex + increment);else swiper.slideTo(stopIndex); 3195 } 3196 if (swiper.swipeDirection === 'prev') { 3197 if (ratio > 1 - params.longSwipesRatio) { 3198 swiper.slideTo(stopIndex + increment); 3199 } else if (rewindLastIndex !== null && ratio < 0 && Math.abs(ratio) > params.longSwipesRatio) { 3200 swiper.slideTo(rewindLastIndex); 3201 } else { 3202 swiper.slideTo(stopIndex); 3203 } 3204 } 3205 } else { 3206 // Short swipes 3207 if (!params.shortSwipes) { 3208 swiper.slideTo(swiper.activeIndex); 3209 return; 3210 } 3211 const isNavButtonTarget = swiper.navigation && (e.target === swiper.navigation.nextEl || e.target === swiper.navigation.prevEl); 3212 if (!isNavButtonTarget) { 3213 if (swiper.swipeDirection === 'next') { 3214 swiper.slideTo(rewindFirstIndex !== null ? rewindFirstIndex : stopIndex + increment); 3215 } 3216 if (swiper.swipeDirection === 'prev') { 3217 swiper.slideTo(rewindLastIndex !== null ? rewindLastIndex : stopIndex); 3218 } 3219 } else if (e.target === swiper.navigation.nextEl) { 3220 swiper.slideTo(stopIndex + increment); 3221 } else { 3222 swiper.slideTo(stopIndex); 3223 } 3224 } 3225} 3226 3227function onResize() { 3228 const swiper = this; 3229 const { 3230 params, 3231 el 3232 } = swiper; 3233 if (el && el.offsetWidth === 0) return; 3234
vendor: 8,547 bytes, lines 3235-3501
3235 // Breakpoints 3236 if (params.breakpoints) { 3237 swiper.setBreakpoint(); 3238 } 3239 3240 // Save locks 3241 const { 3242 allowSlideNext, 3243 allowSlidePrev, 3244 snapGrid 3245 } = swiper; 3246 const isVirtual = swiper.virtual && swiper.params.virtual.enabled; 3247 3248 // Disable locks on resize 3249 swiper.allowSlideNext = true; 3250 swiper.allowSlidePrev = true; 3251 swiper.updateSize(); 3252 swiper.updateSlides(); 3253 swiper.updateSlidesClasses(); 3254 const isVirtualLoop = isVirtual && params.loop; 3255 if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !swiper.isBeginning && !swiper.params.centeredSlides && !isVirtualLoop) { 3256 swiper.slideTo(swiper.slides.length - 1, 0, false, true); 3257 } else { 3258 if (swiper.params.loop && !isVirtual) { 3259 swiper.slideToLoop(swiper.realIndex, 0, false, true); 3260 } else { 3261 swiper.slideTo(swiper.activeIndex, 0, false, true); 3262 } 3263 } 3264 if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) { 3265 clearTimeout(swiper.autoplay.resizeTimeout); 3266 swiper.autoplay.resizeTimeout = setTimeout(() => { 3267 if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) { 3268 swiper.autoplay.resume(); 3269 } 3270 }, 500); 3271 } 3272 // Return locks after resize 3273 swiper.allowSlidePrev = allowSlidePrev; 3274 swiper.allowSlideNext = allowSlideNext; 3275 if (swiper.params.watchOverflow && snapGrid !== swiper.snapGrid) { 3276 swiper.checkOverflow(); 3277 } 3278} 3279 3280function onClick(e) { 3281 const swiper = this; 3282 if (!swiper.enabled) return; 3283 if (!swiper.allowClick) { 3284 if (swiper.params.preventClicks) e.preventDefault(); 3285 if (swiper.params.preventClicksPropagation && swiper.animating) { 3286 e.stopPropagation(); 3287 e.stopImmediatePropagation(); 3288 } 3289 } 3290} 3291 3292function onScroll() { 3293 const swiper = this; 3294 const { 3295 wrapperEl, 3296 rtlTranslate, 3297 enabled 3298 } = swiper; 3299 if (!enabled) return; 3300 swiper.previousTranslate = swiper.translate; 3301 if (swiper.isHorizontal()) { 3302 swiper.translate = -wrapperEl.scrollLeft; 3303 } else { 3304 swiper.translate = -wrapperEl.scrollTop; 3305 } 3306 // eslint-disable-next-line 3307 if (swiper.translate === 0) swiper.translate = 0; 3308 swiper.updateActiveIndex(); 3309 swiper.updateSlidesClasses(); 3310 let newProgress; 3311 const translatesDiff = swiper.maxTranslate() - swiper.minTranslate(); 3312 if (translatesDiff === 0) { 3313 newProgress = 0; 3314 } else { 3315 newProgress = (swiper.translate - swiper.minTranslate()) / translatesDiff; 3316 } 3317 if (newProgress !== swiper.progress) { 3318 swiper.updateProgress(rtlTranslate ? -swiper.translate : swiper.translate); 3319 } 3320 swiper.emit('setTranslate', swiper.translate, false); 3321} 3322 3323function onLoad(e) { 3324 const swiper = this; 3325 processLazyPreloader(swiper, e.target); 3326 if (swiper.params.cssMode || swiper.params.slidesPerView !== 'auto' && !swiper.params.autoHeight) { 3327 return; 3328 } 3329 swiper.update(); 3330} 3331 3332function onDocumentTouchStart() { 3333 const swiper = this; 3334 if (swiper.documentTouchHandlerProceeded) return; 3335 swiper.documentTouchHandlerProceeded = true; 3336 if (swiper.params.touchReleaseOnEdges) { 3337 swiper.el.style.touchAction = 'auto'; 3338 } 3339} 3340 3341const events = (swiper, method) => { 3342 const document = getDocument(); 3343 const { 3344 params, 3345 el, 3346 wrapperEl, 3347 device 3348 } = swiper; 3349 const capture = !!params.nested; 3350 const domMethod = method === 'on' ? 'addEventListener' : 'removeEventListener'; 3351 const swiperMethod = method; 3352 if (!el || typeof el === 'string') return; 3353 3354 // Touch Events 3355 document[domMethod]('touchstart', swiper.onDocumentTouchStart, { 3356 passive: false, 3357 capture 3358 }); 3359 el[domMethod]('touchstart', swiper.onTouchStart, { 3360 passive: false 3361 }); 3362 el[domMethod]('pointerdown', swiper.onTouchStart, { 3363 passive: false 3364 }); 3365 document[domMethod]('touchmove', swiper.onTouchMove, { 3366 passive: false, 3367 capture 3368 }); 3369 document[domMethod]('pointermove', swiper.onTouchMove, { 3370 passive: false, 3371 capture 3372 }); 3373 document[domMethod]('touchend', swiper.onTouchEnd, { 3374 passive: true 3375 }); 3376 document[domMethod]('pointerup', swiper.onTouchEnd, { 3377 passive: true 3378 }); 3379 document[domMethod]('pointercancel', swiper.onTouchEnd, { 3380 passive: true 3381 }); 3382 document[domMethod]('touchcancel', swiper.onTouchEnd, { 3383 passive: true 3384 }); 3385 document[domMethod]('pointerout', swiper.onTouchEnd, { 3386 passive: true 3387 }); 3388 document[domMethod]('pointerleave', swiper.onTouchEnd, { 3389 passive: true 3390 }); 3391 document[domMethod]('contextmenu', swiper.onTouchEnd, { 3392 passive: true 3393 }); 3394 3395 // Prevent Links Clicks 3396 if (params.preventClicks || params.preventClicksPropagation) { 3397 el[domMethod]('click', swiper.onClick, true); 3398 } 3399 if (params.cssMode) { 3400 wrapperEl[domMethod]('scroll', swiper.onScroll); 3401 } 3402 3403 // Resize handler 3404 if (params.updateOnWindowResize) { 3405 swiper[swiperMethod](device.ios || device.android ? 'resize orientationchange observerUpdate' : 'resize observerUpdate', onResize, true); 3406 } else { 3407 swiper[swiperMethod]('observerUpdate', onResize, true); 3408 } 3409 3410 // Images loader 3411 el[domMethod]('load', swiper.onLoad, { 3412 capture: true 3413 }); 3414}; 3415function attachEvents() { 3416 const swiper = this; 3417 const { 3418 params 3419 } = swiper; 3420 swiper.onTouchStart = onTouchStart.bind(swiper); 3421 swiper.onTouchMove = onTouchMove.bind(swiper); 3422 swiper.onTouchEnd = onTouchEnd.bind(swiper); 3423 swiper.onDocumentTouchStart = onDocumentTouchStart.bind(swiper); 3424 if (params.cssMode) { 3425 swiper.onScroll = onScroll.bind(swiper); 3426 } 3427 swiper.onClick = onClick.bind(swiper); 3428 swiper.onLoad = onLoad.bind(swiper); 3429 events(swiper, 'on'); 3430} 3431function detachEvents() { 3432 const swiper = this; 3433 events(swiper, 'off'); 3434} 3435var events$1 = { 3436 attachEvents, 3437 detachEvents 3438}; 3439 3440const isGridEnabled = (swiper, params) => { 3441 return swiper.grid && params.grid && params.grid.rows > 1; 3442}; 3443function setBreakpoint() { 3444 const swiper = this; 3445 const { 3446 realIndex, 3447 initialized, 3448 params, 3449 el 3450 } = swiper; 3451 const breakpoints = params.breakpoints; 3452 if (!breakpoints || breakpoints && Object.keys(breakpoints).length === 0) return; 3453 const document = getDocument(); 3454 3455 // Get breakpoint for window/container width and update parameters 3456 const breakpointsBase = params.breakpointsBase === 'window' || !params.breakpointsBase ? params.breakpointsBase : 'container'; 3457 const breakpointContainer = ['window', 'container'].includes(params.breakpointsBase) || !params.breakpointsBase ? swiper.el : document.querySelector(params.breakpointsBase); 3458 const breakpoint = swiper.getBreakpoint(breakpoints, breakpointsBase, breakpointContainer); 3459 if (!breakpoint || swiper.currentBreakpoint === breakpoint) return; 3460 const breakpointOnlyParams = breakpoint in breakpoints ? breakpoints[breakpoint] : undefined; 3461 const breakpointParams = breakpointOnlyParams || swiper.originalParams; 3462 const wasMultiRow = isGridEnabled(swiper, params); 3463 const isMultiRow = isGridEnabled(swiper, breakpointParams); 3464 const wasGrabCursor = swiper.params.grabCursor; 3465 const isGrabCursor = breakpointParams.grabCursor; 3466 const wasEnabled = params.enabled; 3467 if (wasMultiRow && !isMultiRow) { 3468 el.classList.remove(`${params.containerModifierClass}grid`, `${params.containerModifierClass}grid-column`); 3469 swiper.emitContainerClasses(); 3470 } else if (!wasMultiRow && isMultiRow) { 3471 el.classList.add(`${params.containerModifierClass}grid`); 3472 if (breakpointParams.grid.fill && breakpointParams.grid.fill === 'column' || !breakpointParams.grid.fill && params.grid.fill === 'column') { 3473 el.classList.add(`${params.containerModifierClass}grid-column`); 3474 } 3475 swiper.emitContainerClasses(); 3476 } 3477 if (wasGrabCursor && !isGrabCursor) { 3478 swiper.unsetGrabCursor(); 3479 } else if (!wasGrabCursor && isGrabCursor) { 3480 swiper.setGrabCursor(); 3481 } 3482 3483 // Toggle navigation, pagination, scrollbar 3484 ['navigation', 'pagination', 'scrollbar'].forEach(prop => { 3485 if (typeof breakpointParams[prop] === 'undefined') return; 3486 const wasModuleEnabled = params[prop] && params[prop].enabled; 3487 const isModuleEnabled = breakpointParams[prop] && breakpointParams[prop].enabled; 3488 if (wasModuleEnabled && !isModuleEnabled) { 3489 swiper[prop].disable(); 3490 } 3491 if (!wasModuleEnabled && isModuleEnabled) { 3492 swiper[prop].enable(); 3493 } 3494 }); 3495 const directionChanged = breakpointParams.direction && breakpointParams.direction !== params.direction; 3496 const needsReLoop = params.loop && (breakpointParams.slidesPerView !== params.slidesPerView || directionChanged); 3497 const wasLoop = params.loop; 3498 if (directionChanged && initialized) { 3499 swiper.changeDirection(); 3500 } 3501
vendor: 9,328 bytes, lines 3501-3855
3501utils_extend(swiper.params, breakpointParams); 3502 const isEnabled = swiper.params.enabled; 3503 const hasLoop = swiper.params.loop; 3504 Object.assign(swiper, { 3505 allowTouchMove: swiper.params.allowTouchMove, 3506 allowSlideNext: swiper.params.allowSlideNext, 3507 allowSlidePrev: swiper.params.allowSlidePrev 3508 }); 3509 if (wasEnabled && !isEnabled) { 3510 swiper.disable(); 3511 } else if (!wasEnabled && isEnabled) { 3512 swiper.enable(); 3513 } 3514 swiper.currentBreakpoint = breakpoint; 3515 swiper.emit('_beforeBreakpoint', breakpointParams); 3516 if (initialized) { 3517 if (needsReLoop) { 3518 swiper.loopDestroy(); 3519 swiper.loopCreate(realIndex); 3520 swiper.updateSlides(); 3521 } else if (!wasLoop && hasLoop) { 3522 swiper.loopCreate(realIndex); 3523 swiper.updateSlides(); 3524 } else if (wasLoop && !hasLoop) { 3525 swiper.loopDestroy(); 3526 } 3527 } 3528 swiper.emit('breakpoint', breakpointParams); 3529} 3530 3531function getBreakpoint(breakpoints, base, containerEl) { 3532 if (base === void 0) { 3533 base = 'window'; 3534 } 3535 if (!breakpoints || base === 'container' && !containerEl) return undefined; 3536 let breakpoint = false; 3537 const window = getWindow(); 3538 const currentHeight = base === 'window' ? window.innerHeight : containerEl.clientHeight; 3539 const points = Object.keys(breakpoints).map(point => { 3540 if (typeof point === 'string' && point.indexOf('@') === 0) { 3541 const minRatio = parseFloat(point.substr(1)); 3542 const value = currentHeight * minRatio; 3543 return { 3544 value, 3545 point 3546 }; 3547 } 3548 return { 3549 value: point, 3550 point 3551 }; 3552 }); 3553 points.sort((a, b) => parseInt(a.value, 10) - parseInt(b.value, 10)); 3554 for (let i = 0; i < points.length; i += 1) { 3555 const { 3556 point, 3557 value 3558 } = points[i]; 3559 if (base === 'window') { 3560 if (window.matchMedia(`(min-width: ${value}px)`).matches) { 3561 breakpoint = point; 3562 } 3563 } else if (value <= containerEl.clientWidth) { 3564 breakpoint = point; 3565 } 3566 } 3567 return breakpoint || 'max'; 3568} 3569 3570var breakpoints = { 3571 setBreakpoint, 3572 getBreakpoint 3573}; 3574 3575function prepareClasses(entries, prefix) { 3576 const resultClasses = []; 3577 entries.forEach(item => { 3578 if (typeof item === 'object') { 3579 Object.keys(item).forEach(classNames => { 3580 if (item[classNames]) { 3581 resultClasses.push(prefix + classNames); 3582 } 3583 }); 3584 } else if (typeof item === 'string') { 3585 resultClasses.push(prefix + item); 3586 } 3587 }); 3588 return resultClasses; 3589} 3590function addClasses() { 3591 const swiper = this; 3592 const { 3593 classNames, 3594 params, 3595 rtl, 3596 el, 3597 device 3598 } = swiper; 3599 // prettier-ignore 3600 const suffixes = prepareClasses(['initialized', params.direction, { 3601 'free-mode': swiper.params.freeMode && params.freeMode.enabled 3602 }, { 3603 'autoheight': params.autoHeight 3604 }, { 3605 'rtl': rtl 3606 }, { 3607 'grid': params.grid && params.grid.rows > 1 3608 }, { 3609 'grid-column': params.grid && params.grid.rows > 1 && params.grid.fill === 'column' 3610 }, { 3611 'android': device.android 3612 }, { 3613 'ios': device.ios 3614 }, { 3615 'css-mode': params.cssMode 3616 }, { 3617 'centered': params.cssMode && params.centeredSlides 3618 }, { 3619 'watch-progress': params.watchSlidesProgress 3620 }], params.containerModifierClass); 3621 classNames.push(...suffixes); 3622 el.classList.add(...classNames); 3623 swiper.emitContainerClasses(); 3624} 3625 3626function removeClasses() { 3627 const swiper = this; 3628 const { 3629 el, 3630 classNames 3631 } = swiper; 3632 if (!el || typeof el === 'string') return; 3633 el.classList.remove(...classNames); 3634 swiper.emitContainerClasses(); 3635} 3636 3637var classes = { 3638 addClasses, 3639 removeClasses 3640}; 3641 3642function checkOverflow() { 3643 const swiper = this; 3644 const { 3645 isLocked: wasLocked, 3646 params 3647 } = swiper; 3648 const { 3649 slidesOffsetBefore 3650 } = params; 3651 if (slidesOffsetBefore) { 3652 const lastSlideIndex = swiper.slides.length - 1; 3653 const lastSlideRightEdge = swiper.slidesGrid[lastSlideIndex] + swiper.slidesSizesGrid[lastSlideIndex] + slidesOffsetBefore * 2; 3654 swiper.isLocked = swiper.size > lastSlideRightEdge; 3655 } else { 3656 swiper.isLocked = swiper.snapGrid.length === 1; 3657 } 3658 if (params.allowSlideNext === true) { 3659 swiper.allowSlideNext = !swiper.isLocked; 3660 } 3661 if (params.allowSlidePrev === true) { 3662 swiper.allowSlidePrev = !swiper.isLocked; 3663 } 3664 if (wasLocked && wasLocked !== swiper.isLocked) { 3665 swiper.isEnd = false; 3666 } 3667 if (wasLocked !== swiper.isLocked) { 3668 swiper.emit(swiper.isLocked ? 'lock' : 'unlock'); 3669 } 3670} 3671var checkOverflow$1 = { 3672 checkOverflow 3673}; 3674 3675var defaults = { 3676 init: true, 3677 direction: 'horizontal', 3678 oneWayMovement: false, 3679 swiperElementNodeName: 'SWIPER-CONTAINER', 3680 touchEventsTarget: 'wrapper', 3681 initialSlide: 0, 3682 speed: 300, 3683 cssMode: false, 3684 updateOnWindowResize: true, 3685 resizeObserver: true, 3686 nested: false, 3687 createElements: false, 3688 eventsPrefix: 'swiper', 3689 enabled: true, 3690 focusableElements: 'input, select, option, textarea, button, video, label', 3691 // Overrides 3692 width: null, 3693 height: null, 3694 // 3695 preventInteractionOnTransition: false, 3696 // ssr 3697 userAgent: null, 3698 url: null, 3699 // To support iOS's swipe-to-go-back gesture (when being used in-app). 3700 edgeSwipeDetection: false, 3701 edgeSwipeThreshold: 20, 3702 // Autoheight 3703 autoHeight: false, 3704 // Set wrapper width 3705 setWrapperSize: false, 3706 // Virtual Translate 3707 virtualTranslate: false, 3708 // Effects 3709 effect: 'slide', 3710 // 'slide' or 'fade' or 'cube' or 'coverflow' or 'flip' 3711 3712 // Breakpoints 3713 breakpoints: undefined, 3714 breakpointsBase: 'window', 3715 // Slides grid 3716 spaceBetween: 0, 3717 slidesPerView: 1, 3718 slidesPerGroup: 1, 3719 slidesPerGroupSkip: 0, 3720 slidesPerGroupAuto: false, 3721 centeredSlides: false, 3722 centeredSlidesBounds: false, 3723 slidesOffsetBefore: 0, 3724 // in px 3725 slidesOffsetAfter: 0, 3726 // in px 3727 normalizeSlideIndex: true, 3728 centerInsufficientSlides: false, 3729 // Disable swiper and hide navigation when container not overflow 3730 watchOverflow: true, 3731 // Round length 3732 roundLengths: false, 3733 // Touches 3734 touchRatio: 1, 3735 touchAngle: 45, 3736 simulateTouch: true, 3737 shortSwipes: true, 3738 longSwipes: true, 3739 longSwipesRatio: 0.5, 3740 longSwipesMs: 300, 3741 followFinger: true, 3742 allowTouchMove: true, 3743 threshold: 5, 3744 touchMoveStopPropagation: false, 3745 touchStartPreventDefault: true, 3746 touchStartForcePreventDefault: false, 3747 touchReleaseOnEdges: false, 3748 // Unique Navigation Elements 3749 uniqueNavElements: true, 3750 // Resistance 3751 resistance: true, 3752 resistanceRatio: 0.85, 3753 // Progress 3754 watchSlidesProgress: false, 3755 // Cursor 3756 grabCursor: false, 3757 // Clicks 3758 preventClicks: true, 3759 preventClicksPropagation: true, 3760 slideToClickedSlide: false, 3761 // loop 3762 loop: false, 3763 loopAddBlankSlides: true, 3764 loopAdditionalSlides: 0, 3765 loopPreventsSliding: true, 3766 // rewind 3767 rewind: false, 3768 // Swiping/no swiping 3769 allowSlidePrev: true, 3770 allowSlideNext: true, 3771 swipeHandler: null, 3772 // '.swipe-handler', 3773 noSwiping: true, 3774 noSwipingClass: 'swiper-no-swiping', 3775 noSwipingSelector: null, 3776 // Passive Listeners 3777 passiveListeners: true, 3778 maxBackfaceHiddenSlides: 10, 3779 // NS 3780 containerModifierClass: 'swiper-', 3781 // NEW 3782 slideClass: 'swiper-slide', 3783 slideBlankClass: 'swiper-slide-blank', 3784 slideActiveClass: 'swiper-slide-active', 3785 slideVisibleClass: 'swiper-slide-visible', 3786 slideFullyVisibleClass: 'swiper-slide-fully-visible', 3787 slideNextClass: 'swiper-slide-next', 3788 slidePrevClass: 'swiper-slide-prev', 3789 wrapperClass: 'swiper-wrapper', 3790 lazyPreloaderClass: 'swiper-lazy-preloader', 3791 lazyPreloadPrevNext: 0, 3792 // Callbacks 3793 runCallbacksOnInit: true, 3794 // Internals 3795 _emitClasses: false 3796}; 3797 3798function moduleExtendParams(params, allModulesParams) { 3799 return function extendParams(obj) { 3800 if (obj === void 0) { 3801 obj = {}; 3802 } 3803 const moduleParamName = Object.keys(obj)[0]; 3804 const moduleParams = obj[moduleParamName]; 3805 if (typeof moduleParams !== 'object' || moduleParams === null) { 3806 utils_extend(allModulesParams, obj); 3807 return; 3808 } 3809 if (params[moduleParamName] === true) { 3810 params[moduleParamName] = { 3811 enabled: true 3812 }; 3813 } 3814 if (moduleParamName === 'navigation' && params[moduleParamName] && params[moduleParamName].enabled && !params[moduleParamName].prevEl && !params[moduleParamName].nextEl) { 3815 params[moduleParamName].auto = true; 3816 } 3817 if (['pagination', 'scrollbar'].indexOf(moduleParamName) >= 0 && params[moduleParamName] && params[moduleParamName].enabled && !params[moduleParamName].el) { 3818 params[moduleParamName].auto = true; 3819 } 3820 if (!(moduleParamName in params && 'enabled' in moduleParams)) { 3821 utils_extend(allModulesParams, obj); 3822 return; 3823 } 3824 if (typeof params[moduleParamName] === 'object' && !('enabled' in params[moduleParamName])) { 3825 params[moduleParamName].enabled = true; 3826 } 3827 if (!params[moduleParamName]) params[moduleParamName] = { 3828 enabled: false 3829 }; 3830 utils_extend(allModulesParams, obj); 3831 }; 3832} 3833 3834/* eslint no-param-reassign: "off" */ 3835const prototypes = { 3836 eventsEmitter, 3837 update, 3838 translate, 3839 transition, 3840 slide, 3841 loop, 3842 grabCursor, 3843 events: events$1, 3844 breakpoints, 3845 checkOverflow: checkOverflow$1, 3846 classes 3847}; 3848const extendedDefaults = {}; 3849class Swiper { 3850 constructor() { 3851 let el; 3852 let params; 3853 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 3854 args[_key] = arguments[_key]; 3855 }
vendor: 1,990 bytes, lines 3856-3913
3856 if (args.length === 1 && args[0].constructor && Object.prototype.toString.call(args[0]).slice(8, -1) === 'Object') { 3857 params = args[0]; 3858 } else { 3859 [el, params] = args; 3860 } 3861 if (!params) params = {}; 3862 params = utils_extend({}, params); 3863 if (el && !params.el) params.el = el; 3864 const document = getDocument(); 3865 if (params.el && typeof params.el === 'string' && document.querySelectorAll(params.el).length > 1) { 3866 const swipers = []; 3867 document.querySelectorAll(params.el).forEach(containerEl => { 3868 const newParams = utils_extend({}, params, { 3869 el: containerEl 3870 }); 3871 swipers.push(new Swiper(newParams)); 3872 }); 3873 // eslint-disable-next-line no-constructor-return 3874 return swipers; 3875 } 3876 3877 // Swiper Instance 3878 const swiper = this; 3879 swiper.__swiper__ = true; 3880 swiper.support = getSupport(); 3881 swiper.device = getDevice({ 3882 userAgent: params.userAgent 3883 }); 3884 swiper.browser = getBrowser(); 3885 swiper.eventsListeners = {}; 3886 swiper.eventsAnyListeners = []; 3887 swiper.modules = [...swiper.__modules__]; 3888 if (params.modules && Array.isArray(params.modules)) { 3889 swiper.modules.push(...params.modules); 3890 } 3891 const allModulesParams = {}; 3892 swiper.modules.forEach(mod => { 3893 mod({ 3894 params, 3895 swiper, 3896 extendParams: moduleExtendParams(params, allModulesParams), 3897 on: swiper.on.bind(swiper), 3898 once: swiper.once.bind(swiper), 3899 off: swiper.off.bind(swiper), 3900 emit: swiper.emit.bind(swiper) 3901 }); 3902 }); 3903 3904 // Extend defaults with modules params 3905 const swiperParams = utils_extend({}, defaults, allModulesParams); 3906 3907 // Extend defaults with passed params 3908 swiper.params = utils_extend({}, swiperParams, extendedDefaults, params); 3909 swiper.originalParams = utils_extend({}, swiper.params); 3910 swiper.passedParams = utils_extend({}, params); 3911 3912 // add event listeners 3913 if (swiper.params && swiper.params.on) {
vendor: 3,290 bytes, lines 3914-4034
3914 Object.keys(swiper.params.on).forEach(eventName => { 3915 swiper.on(eventName, swiper.params.on[eventName]); 3916 }); 3917 } 3918 if (swiper.params && swiper.params.onAny) { 3919 swiper.onAny(swiper.params.onAny); 3920 } 3921 3922 // Extend Swiper 3923 Object.assign(swiper, { 3924 enabled: swiper.params.enabled, 3925 el, 3926 // Classes 3927 classNames: [], 3928 // Slides 3929 slides: [], 3930 slidesGrid: [], 3931 snapGrid: [], 3932 slidesSizesGrid: [], 3933 // isDirection 3934 isHorizontal() { 3935 return swiper.params.direction === 'horizontal'; 3936 }, 3937 isVertical() { 3938 return swiper.params.direction === 'vertical'; 3939 }, 3940 // Indexes 3941 activeIndex: 0, 3942 realIndex: 0, 3943 // 3944 isBeginning: true, 3945 isEnd: false, 3946 // Props 3947 translate: 0, 3948 previousTranslate: 0, 3949 progress: 0, 3950 velocity: 0, 3951 animating: false, 3952 cssOverflowAdjustment() { 3953 // Returns 0 unless `translate` is > 2**23 3954 // Should be subtracted from css values to prevent overflow 3955 return Math.trunc(this.translate / 2 ** 23) * 2 ** 23; 3956 }, 3957 // Locks 3958 allowSlideNext: swiper.params.allowSlideNext, 3959 allowSlidePrev: swiper.params.allowSlidePrev, 3960 // Touch Events 3961 touchEventsData: { 3962 isTouched: undefined, 3963 isMoved: undefined, 3964 allowTouchCallbacks: undefined, 3965 touchStartTime: undefined, 3966 isScrolling: undefined, 3967 currentTranslate: undefined, 3968 startTranslate: undefined, 3969 allowThresholdMove: undefined, 3970 // Form elements to match 3971 focusableElements: swiper.params.focusableElements, 3972 // Last click time 3973 lastClickTime: 0, 3974 clickTimeout: undefined, 3975 // Velocities 3976 velocities: [], 3977 allowMomentumBounce: undefined, 3978 startMoving: undefined, 3979 pointerId: null, 3980 touchId: null 3981 }, 3982 // Clicks 3983 allowClick: true, 3984 // Touches 3985 allowTouchMove: swiper.params.allowTouchMove, 3986 touches: { 3987 startX: 0, 3988 startY: 0, 3989 currentX: 0, 3990 currentY: 0, 3991 diff: 0 3992 }, 3993 // Images 3994 imagesToLoad: [], 3995 imagesLoaded: 0 3996 }); 3997 swiper.emit('_swiper'); 3998 3999 // Init 4000 if (swiper.params.init) { 4001 swiper.init(); 4002 } 4003 4004 // Return app instance 4005 // eslint-disable-next-line no-constructor-return 4006 return swiper; 4007 } 4008 getDirectionLabel(property) { 4009 if (this.isHorizontal()) { 4010 return property; 4011 } 4012 // prettier-ignore 4013 return { 4014 'width': 'height', 4015 'margin-top': 'margin-left', 4016 'margin-bottom ': 'margin-right', 4017 'margin-left': 'margin-top', 4018 'margin-right': 'margin-bottom', 4019 'padding-left': 'padding-top', 4020 'padding-right': 'padding-bottom', 4021 'marginRight': 'marginBottom' 4022 }[property]; 4023 } 4024 getSlideIndex(slideEl) { 4025 const { 4026 slidesEl, 4027 params 4028 } = this; 4029 const slides = elementChildren(slidesEl, `.${params.slideClass}, swiper-slide`); 4030 const firstSlideIndex = elementIndex(slides[0]); 4031 return elementIndex(slideEl) - firstSlideIndex; 4032 } 4033 getSlideIndexByData(index) { 4034 return this.getSlideIndex(this.slides.find(slideEl => slideEl.getAttribute('data-swiper-slide-index') * 1 === index))
vendor: 6,135 bytes, lines 4034-4222
4034; 4035 } 4036 recalcSlides() { 4037 const swiper = this; 4038 const { 4039 slidesEl, 4040 params 4041 } = swiper; 4042 swiper.slides = elementChildren(slidesEl, `.${params.slideClass}, swiper-slide`); 4043 } 4044 enable() { 4045 const swiper = this; 4046 if (swiper.enabled) return; 4047 swiper.enabled = true; 4048 if (swiper.params.grabCursor) { 4049 swiper.setGrabCursor(); 4050 } 4051 swiper.emit('enable'); 4052 } 4053 disable() { 4054 const swiper = this; 4055 if (!swiper.enabled) return; 4056 swiper.enabled = false; 4057 if (swiper.params.grabCursor) { 4058 swiper.unsetGrabCursor(); 4059 } 4060 swiper.emit('disable'); 4061 } 4062 setProgress(progress, speed) { 4063 const swiper = this; 4064 progress = Math.min(Math.max(progress, 0), 1); 4065 const min = swiper.minTranslate(); 4066 const max = swiper.maxTranslate(); 4067 const current = (max - min) * progress + min; 4068 swiper.translateTo(current, typeof speed === 'undefined' ? 0 : speed); 4069 swiper.updateActiveIndex(); 4070 swiper.updateSlidesClasses(); 4071 } 4072 emitContainerClasses() { 4073 const swiper = this; 4074 if (!swiper.params._emitClasses || !swiper.el) return; 4075 const cls = swiper.el.className.split(' ').filter(className => { 4076 return className.indexOf('swiper') === 0 || className.indexOf(swiper.params.containerModifierClass) === 0; 4077 }); 4078 swiper.emit('_containerClasses', cls.join(' ')); 4079 } 4080 getSlideClasses(slideEl) { 4081 const swiper = this; 4082 if (swiper.destroyed) return ''; 4083 return slideEl.className.split(' ').filter(className => { 4084 return className.indexOf('swiper-slide') === 0 || className.indexOf(swiper.params.slideClass) === 0; 4085 }).join(' '); 4086 } 4087 emitSlidesClasses() { 4088 const swiper = this; 4089 if (!swiper.params._emitClasses || !swiper.el) return; 4090 const updates = []; 4091 swiper.slides.forEach(slideEl => { 4092 const classNames = swiper.getSlideClasses(slideEl); 4093 updates.push({ 4094 slideEl, 4095 classNames 4096 }); 4097 swiper.emit('_slideClass', slideEl, classNames); 4098 }); 4099 swiper.emit('_slideClasses', updates); 4100 } 4101 slidesPerViewDynamic(view, exact) { 4102 if (view === void 0) { 4103 view = 'current'; 4104 } 4105 if (exact === void 0) { 4106 exact = false; 4107 } 4108 const swiper = this; 4109 const { 4110 params, 4111 slides, 4112 slidesGrid, 4113 slidesSizesGrid, 4114 size: swiperSize, 4115 activeIndex 4116 } = swiper; 4117 let spv = 1; 4118 if (typeof params.slidesPerView === 'number') return params.slidesPerView; 4119 if (params.centeredSlides) { 4120 let slideSize = slides[activeIndex] ? Math.ceil(slides[activeIndex].swiperSlideSize) : 0; 4121 let breakLoop; 4122 for (let i = activeIndex + 1; i < slides.length; i += 1) { 4123 if (slides[i] && !breakLoop) { 4124 slideSize += Math.ceil(slides[i].swiperSlideSize); 4125 spv += 1; 4126 if (slideSize > swiperSize) breakLoop = true; 4127 } 4128 } 4129 for (let i = activeIndex - 1; i >= 0; i -= 1) { 4130 if (slides[i] && !breakLoop) { 4131 slideSize += slides[i].swiperSlideSize; 4132 spv += 1; 4133 if (slideSize > swiperSize) breakLoop = true; 4134 } 4135 } 4136 } else { 4137 // eslint-disable-next-line 4138 if (view === 'current') { 4139 for (let i = activeIndex + 1; i < slides.length; i += 1) { 4140 const slideInView = exact ? slidesGrid[i] + slidesSizesGrid[i] - slidesGrid[activeIndex] < swiperSize : slidesGrid[i] - slidesGrid[activeIndex] < swiperSize; 4141 if (slideInView) { 4142 spv += 1; 4143 } 4144 } 4145 } else { 4146 // previous 4147 for (let i = activeIndex - 1; i >= 0; i -= 1) { 4148 const slideInView = slidesGrid[activeIndex] - slidesGrid[i] < swiperSize; 4149 if (slideInView) { 4150 spv += 1; 4151 } 4152 } 4153 } 4154 } 4155 return spv; 4156 } 4157 update() { 4158 const swiper = this; 4159 if (!swiper || swiper.destroyed) return; 4160 const { 4161 snapGrid, 4162 params 4163 } = swiper; 4164 // Breakpoints 4165 if (params.breakpoints) { 4166 swiper.setBreakpoint(); 4167 } 4168 [...swiper.el.querySelectorAll('[loading="lazy"]')].forEach(imageEl => { 4169 if (imageEl.complete) { 4170 processLazyPreloader(swiper, imageEl); 4171 } 4172 }); 4173 swiper.updateSize(); 4174 swiper.updateSlides(); 4175 swiper.updateProgress(); 4176 swiper.updateSlidesClasses(); 4177 function setTranslate() { 4178 const translateValue = swiper.rtlTranslate ? swiper.translate * -1 : swiper.translate; 4179 const newTranslate = Math.min(Math.max(translateValue, swiper.maxTranslate()), swiper.minTranslate()); 4180 swiper.setTranslate(newTranslate); 4181 swiper.updateActiveIndex(); 4182 swiper.updateSlidesClasses(); 4183 } 4184 let translated; 4185 if (params.freeMode && params.freeMode.enabled && !params.cssMode) { 4186 setTranslate(); 4187 if (params.autoHeight) { 4188 swiper.updateAutoHeight(); 4189 } 4190 } else { 4191 if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !params.centeredSlides) { 4192 const slides = swiper.virtual && params.virtual.enabled ? swiper.virtual.slides : swiper.slides; 4193 translated = swiper.slideTo(slides.length - 1, 0, false, true); 4194 } else { 4195 translated = swiper.slideTo(swiper.activeIndex, 0, false, true); 4196 } 4197 if (!translated) { 4198 setTranslate(); 4199 } 4200 } 4201 if (params.watchOverflow && snapGrid !== swiper.snapGrid) { 4202 swiper.checkOverflow(); 4203 } 4204 swiper.emit('update'); 4205 } 4206 changeDirection(newDirection, needUpdate) { 4207 if (needUpdate === void 0) { 4208 needUpdate = true; 4209 } 4210 const swiper = this; 4211 const currentDirection = swiper.params.direction; 4212 if (!newDirection) { 4213 // eslint-disable-next-line 4214 newDirection = currentDirection === 'horizontal' ? 'vertical' : 'horizontal'; 4215 } 4216 if (newDirection === currentDirection || newDirection !== 'horizontal' && newDirection !== 'vertical') { 4217 return swiper; 4218 } 4219 swiper.el.classList.remove(`${swiper.params.containerModifierClass}${currentDirection}`); 4220 swiper.el.classList.add(`${swiper.params.containerModifierClass}${newDirection}`); 4221 swiper.emitContainerClasses(); 4222 swiper.params.direction = newDirection;
vendor: 3,676 bytes, lines 4223-4335
4223 swiper.slides.forEach(slideEl => { 4224 if (newDirection === 'vertical') { 4225 slideEl.style.width = ''; 4226 } else { 4227 slideEl.style.height = ''; 4228 } 4229 }); 4230 swiper.emit('changeDirection'); 4231 if (needUpdate) swiper.update(); 4232 return swiper; 4233 } 4234 changeLanguageDirection(direction) { 4235 const swiper = this; 4236 if (swiper.rtl && direction === 'rtl' || !swiper.rtl && direction === 'ltr') return; 4237 swiper.rtl = direction === 'rtl'; 4238 swiper.rtlTranslate = swiper.params.direction === 'horizontal' && swiper.rtl; 4239 if (swiper.rtl) { 4240 swiper.el.classList.add(`${swiper.params.containerModifierClass}rtl`); 4241 swiper.el.dir = 'rtl'; 4242 } else { 4243 swiper.el.classList.remove(`${swiper.params.containerModifierClass}rtl`); 4244 swiper.el.dir = 'ltr'; 4245 } 4246 swiper.update(); 4247 } 4248 mount(element) { 4249 const swiper = this; 4250 if (swiper.mounted) return true; 4251 4252 // Find el 4253 let el = element || swiper.params.el; 4254 if (typeof el === 'string') { 4255 el = document.querySelector(el); 4256 } 4257 if (!el) { 4258 return false; 4259 } 4260 el.swiper = swiper; 4261 if (el.parentNode && el.parentNode.host && el.parentNode.host.nodeName === swiper.params.swiperElementNodeName.toUpperCase()) { 4262 swiper.isElement = true; 4263 } 4264 const getWrapperSelector = () => { 4265 return `.${(swiper.params.wrapperClass || '').trim().split(' ').join('.')}`; 4266 }; 4267 const getWrapper = () => { 4268 if (el && el.shadowRoot && el.shadowRoot.querySelector) { 4269 const res = el.shadowRoot.querySelector(getWrapperSelector()); 4270 // Children needs to return slot items 4271 return res; 4272 } 4273 return elementChildren(el, getWrapperSelector())[0]; 4274 }; 4275 // Find Wrapper 4276 let wrapperEl = getWrapper(); 4277 if (!wrapperEl && swiper.params.createElements) { 4278 wrapperEl = createElement('div', swiper.params.wrapperClass); 4279 el.append(wrapperEl); 4280 elementChildren(el, `.${swiper.params.slideClass}`).forEach(slideEl => { 4281 wrapperEl.append(slideEl); 4282 }); 4283 } 4284 Object.assign(swiper, { 4285 el, 4286 wrapperEl, 4287 slidesEl: swiper.isElement && !el.parentNode.host.slideSlots ? el.parentNode.host : wrapperEl, 4288 hostEl: swiper.isElement ? el.parentNode.host : el, 4289 mounted: true, 4290 // RTL 4291 rtl: el.dir.toLowerCase() === 'rtl' || elementStyle(el, 'direction') === 'rtl', 4292 rtlTranslate: swiper.params.direction === 'horizontal' && (el.dir.toLowerCase() === 'rtl' || elementStyle(el, 'direction') === 'rtl'), 4293 wrongRTL: elementStyle(wrapperEl, 'display') === '-webkit-box' 4294 }); 4295 return true; 4296 } 4297 init(el) { 4298 const swiper = this; 4299 if (swiper.initialized) return swiper; 4300 const mounted = swiper.mount(el); 4301 if (mounted === false) return swiper; 4302 swiper.emit('beforeInit'); 4303 4304 // Set breakpoint 4305 if (swiper.params.breakpoints) { 4306 swiper.setBreakpoint(); 4307 } 4308 4309 // Add Classes 4310 swiper.addClasses(); 4311 4312 // Update size 4313 swiper.updateSize(); 4314 4315 // Update slides 4316 swiper.updateSlides(); 4317 if (swiper.params.watchOverflow) { 4318 swiper.checkOverflow(); 4319 } 4320 4321 // Set Grab Cursor 4322 if (swiper.params.grabCursor && swiper.enabled) { 4323 swiper.setGrabCursor(); 4324 } 4325 4326 // Slide To Initial Slide 4327 if (swiper.params.loop && swiper.virtual && swiper.params.virtual.enabled) { 4328 swiper.slideTo(swiper.params.initialSlide + swiper.virtual.slidesBefore, 0, swiper.params.runCallbacksOnInit, false, true); 4329 } else { 4330 swiper.slideTo(swiper.params.initialSlide, 0, swiper.params.runCallbacksOnInit, false, true); 4331 } 4332 4333 // Create loop 4334 if (swiper.params.loop) { 4335 swiper.loopCreate(
vendor: 1,553 bytes, lines 4335-4403
4335); 4336 } 4337 4338 // Attach events 4339 swiper.attachEvents(); 4340 const lazyElements = [...swiper.el.querySelectorAll('[loading="lazy"]')]; 4341 if (swiper.isElement) { 4342 lazyElements.push(...swiper.hostEl.querySelectorAll('[loading="lazy"]')); 4343 } 4344 lazyElements.forEach(imageEl => { 4345 if (imageEl.complete) { 4346 processLazyPreloader(swiper, imageEl); 4347 } else { 4348 imageEl.addEventListener('load', e => { 4349 processLazyPreloader(swiper, e.target); 4350 }); 4351 } 4352 }); 4353 preload(swiper); 4354 4355 // Init Flag 4356 swiper.initialized = true; 4357 preload(swiper); 4358 4359 // Emit 4360 swiper.emit('init'); 4361 swiper.emit('afterInit'); 4362 return swiper; 4363 } 4364 destroy(deleteInstance, cleanStyles) { 4365 if (deleteInstance === void 0) { 4366 deleteInstance = true; 4367 } 4368 if (cleanStyles === void 0) { 4369 cleanStyles = true; 4370 } 4371 const swiper = this; 4372 const { 4373 params, 4374 el, 4375 wrapperEl, 4376 slides 4377 } = swiper; 4378 if (typeof swiper.params === 'undefined' || swiper.destroyed) { 4379 return null; 4380 } 4381 swiper.emit('beforeDestroy'); 4382 4383 // Init Flag 4384 swiper.initialized = false; 4385 4386 // Detach events 4387 swiper.detachEvents(); 4388 4389 // Destroy loop 4390 if (params.loop) { 4391 swiper.loopDestroy(); 4392 } 4393 4394 // Cleanup styles 4395 if (cleanStyles) { 4396 swiper.removeClasses(); 4397 if (el && typeof el !== 'string') { 4398 el.removeAttribute('style'); 4399 } 4400 if (wrapperEl) { 4401 wrapperEl.removeAttribute('style'); 4402 } 4403 if (slides && slides.length) {
vendor: 4,273 bytes, lines 4404-4556
4404 slides.forEach(slideEl => { 4405 slideEl.classList.remove(params.slideVisibleClass, params.slideFullyVisibleClass, params.slideActiveClass, params.slideNextClass, params.slidePrevClass); 4406 slideEl.removeAttribute('style'); 4407 slideEl.removeAttribute('data-swiper-slide-index'); 4408 }); 4409 } 4410 } 4411 swiper.emit('destroy'); 4412 4413 // Detach emitter events 4414 Object.keys(swiper.eventsListeners).forEach(eventName => { 4415 swiper.off(eventName); 4416 }); 4417 if (deleteInstance !== false) { 4418 if (swiper.el && typeof swiper.el !== 'string') { 4419 swiper.el.swiper = null; 4420 } 4421 deleteProps(swiper); 4422 } 4423 swiper.destroyed = true; 4424 return null; 4425 } 4426 static extendDefaults(newDefaults) { 4427 utils_extend(extendedDefaults, newDefaults); 4428 } 4429 static get extendedDefaults() { 4430 return extendedDefaults; 4431 } 4432 static get defaults() { 4433 return defaults; 4434 } 4435 static installModule(mod) { 4436 if (!Swiper.prototype.__modules__) Swiper.prototype.__modules__ = []; 4437 const modules = Swiper.prototype.__modules__; 4438 if (typeof mod === 'function' && modules.indexOf(mod) < 0) { 4439 modules.push(mod); 4440 } 4441 } 4442 static use(module) { 4443 if (Array.isArray(module)) { 4444 module.forEach(m => Swiper.installModule(m)); 4445 return Swiper; 4446 } 4447 Swiper.installModule(module); 4448 return Swiper; 4449 } 4450} 4451Object.keys(prototypes).forEach(prototypeGroup => { 4452 Object.keys(prototypes[prototypeGroup]).forEach(protoMethod => { 4453 Swiper.prototype[protoMethod] = prototypes[prototypeGroup][protoMethod]; 4454 }); 4455}); 4456Swiper.use([Resize, Observer]); 4457 4458 4459 4460;// ./node_modules/swiper/modules/virtual.mjs 4461 4462 4463 4464function Virtual(_ref) { 4465 let { 4466 swiper, 4467 extendParams, 4468 on, 4469 emit 4470 } = _ref; 4471 extendParams({ 4472 virtual: { 4473 enabled: false, 4474 slides: [], 4475 cache: true, 4476 renderSlide: null, 4477 renderExternal: null, 4478 renderExternalUpdate: true, 4479 addSlidesBefore: 0, 4480 addSlidesAfter: 0 4481 } 4482 }); 4483 let cssModeTimeout; 4484 const document = getDocument(); 4485 swiper.virtual = { 4486 cache: {}, 4487 from: undefined, 4488 to: undefined, 4489 slides: [], 4490 offset: 0, 4491 slidesGrid: [] 4492 }; 4493 const tempDOM = document.createElement('div'); 4494 function renderSlide(slide, index) { 4495 const params = swiper.params.virtual; 4496 if (params.cache && swiper.virtual.cache[index]) { 4497 return swiper.virtual.cache[index]; 4498 } 4499 // eslint-disable-next-line 4500 let slideEl; 4501 if (params.renderSlide) { 4502 slideEl = params.renderSlide.call(swiper, slide, index); 4503 if (typeof slideEl === 'string') { 4504 tempDOM.innerHTML = slideEl; 4505 slideEl = tempDOM.children[0]; 4506 } 4507 } else if (swiper.isElement) { 4508 slideEl = createElement('swiper-slide'); 4509 } else { 4510 slideEl = createElement('div', swiper.params.slideClass); 4511 } 4512 slideEl.setAttribute('data-swiper-slide-index', index); 4513 if (!params.renderSlide) { 4514 slideEl.innerHTML = slide; 4515 } 4516 if (params.cache) { 4517 swiper.virtual.cache[index] = slideEl; 4518 } 4519 return slideEl; 4520 } 4521 function update(force, beforeInit, forceActiveIndex) { 4522 const { 4523 slidesPerView, 4524 slidesPerGroup, 4525 centeredSlides, 4526 loop: isLoop, 4527 initialSlide 4528 } = swiper.params; 4529 if (beforeInit && !isLoop && initialSlide > 0) { 4530 return; 4531 } 4532 const { 4533 addSlidesBefore, 4534 addSlidesAfter 4535 } = swiper.params.virtual; 4536 const { 4537 from: previousFrom, 4538 to: previousTo, 4539 slides, 4540 slidesGrid: previousSlidesGrid, 4541 offset: previousOffset 4542 } = swiper.virtual; 4543 if (!swiper.params.cssMode) { 4544 swiper.updateActiveIndex(); 4545 } 4546 const activeIndex = typeof forceActiveIndex === 'undefined' ? swiper.activeIndex || 0 : forceActiveIndex; 4547 let offsetProp; 4548 if (swiper.rtlTranslate) offsetProp = 'right';else offsetProp = swiper.isHorizontal() ? 'left' : 'top'; 4549 let slidesAfter; 4550 let slidesBefore; 4551 if (centeredSlides) { 4552 slidesAfter = Math.floor(slidesPerView / 2) + slidesPerGroup + addSlidesAfter; 4553 slidesBefore = Math.floor(slidesPerView / 2) + slidesPerGroup + addSlidesBefore; 4554 } else { 4555 slidesAfter = slidesPerView + (slidesPerGroup - 1) + addSlidesAfter; 4556 slidesBefore = (isLoop ? slidesPerView
vendor: 3,781 bytes, lines 4556-4669
4556 : slidesPerGroup) + addSlidesBefore; 4557 } 4558 let from = activeIndex - slidesBefore; 4559 let to = activeIndex + slidesAfter; 4560 if (!isLoop) { 4561 from = Math.max(from, 0); 4562 to = Math.min(to, slides.length - 1); 4563 } 4564 let offset = (swiper.slidesGrid[from] || 0) - (swiper.slidesGrid[0] || 0); 4565 if (isLoop && activeIndex >= slidesBefore) { 4566 from -= slidesBefore; 4567 if (!centeredSlides) offset += swiper.slidesGrid[0]; 4568 } else if (isLoop && activeIndex < slidesBefore) { 4569 from = -slidesBefore; 4570 if (centeredSlides) offset += swiper.slidesGrid[0]; 4571 } 4572 Object.assign(swiper.virtual, { 4573 from, 4574 to, 4575 offset, 4576 slidesGrid: swiper.slidesGrid, 4577 slidesBefore, 4578 slidesAfter 4579 }); 4580 function onRendered() { 4581 swiper.updateSlides(); 4582 swiper.updateProgress(); 4583 swiper.updateSlidesClasses(); 4584 emit('virtualUpdate'); 4585 } 4586 if (previousFrom === from && previousTo === to && !force) { 4587 if (swiper.slidesGrid !== previousSlidesGrid && offset !== previousOffset) { 4588 swiper.slides.forEach(slideEl => { 4589 slideEl.style[offsetProp] = `${offset - Math.abs(swiper.cssOverflowAdjustment())}px`; 4590 }); 4591 } 4592 swiper.updateProgress(); 4593 emit('virtualUpdate'); 4594 return; 4595 } 4596 if (swiper.params.virtual.renderExternal) { 4597 swiper.params.virtual.renderExternal.call(swiper, { 4598 offset, 4599 from, 4600 to, 4601 slides: function getSlides() { 4602 const slidesToRender = []; 4603 for (let i = from; i <= to; i += 1) { 4604 slidesToRender.push(slides[i]); 4605 } 4606 return slidesToRender; 4607 }() 4608 }); 4609 if (swiper.params.virtual.renderExternalUpdate) { 4610 onRendered(); 4611 } else { 4612 emit('virtualUpdate'); 4613 } 4614 return; 4615 } 4616 const prependIndexes = []; 4617 const appendIndexes = []; 4618 const getSlideIndex = index => { 4619 let slideIndex = index; 4620 if (index < 0) { 4621 slideIndex = slides.length + index; 4622 } else if (slideIndex >= slides.length) { 4623 // eslint-disable-next-line 4624 slideIndex = slideIndex - slides.length; 4625 } 4626 return slideIndex; 4627 }; 4628 if (force) { 4629 swiper.slides.filter(el => el.matches(`.${swiper.params.slideClass}, swiper-slide`)).forEach(slideEl => { 4630 slideEl.remove(); 4631 }); 4632 } else { 4633 for (let i = previousFrom; i <= previousTo; i += 1) { 4634 if (i < from || i > to) { 4635 const slideIndex = getSlideIndex(i); 4636 swiper.slides.filter(el => el.matches(`.${swiper.params.slideClass}[data-swiper-slide-index="${slideIndex}"], swiper-slide[data-swiper-slide-index="${slideIndex}"]`)).forEach(slideEl => { 4637 slideEl.remove(); 4638 }); 4639 } 4640 } 4641 } 4642 const loopFrom = isLoop ? -slides.length : 0; 4643 const loopTo = isLoop ? slides.length * 2 : slides.length; 4644 for (let i = loopFrom; i < loopTo; i += 1) { 4645 if (i >= from && i <= to) { 4646 const slideIndex = getSlideIndex(i); 4647 if (typeof previousTo === 'undefined' || force) { 4648 appendIndexes.push(slideIndex); 4649 } else { 4650 if (i > previousTo) appendIndexes.push(slideIndex); 4651 if (i < previousFrom) prependIndexes.push(slideIndex); 4652 } 4653 } 4654 } 4655 appendIndexes.forEach(index => { 4656 swiper.slidesEl.append(renderSlide(slides[index], index)); 4657 }); 4658 if (isLoop) { 4659 for (let i = prependIndexes.length - 1; i >= 0; i -= 1) { 4660 const index = prependIndexes[i]; 4661 swiper.slidesEl.prepend(renderSlide(slides[index], index)); 4662 } 4663 } else { 4664 prependIndexes.sort((a, b) => b - a); 4665 prependIndexes.forEach(index => { 4666 swiper.slidesEl.prepend(renderSlide(slides[index], index)); 4667 }); 4668 } 4669
4669elementChildren(swiper.slidesEl, '.swiper-slide, swiper-slide').forEach(sli
vendor: 5,514 bytes, lines 4669-4841
4669deEl => { 4670 slideEl.style[offsetProp] = `${offset - Math.abs(swiper.cssOverflowAdjustment())}px`; 4671 }); 4672 onRendered(); 4673 } 4674 function appendSlide(slides) { 4675 if (typeof slides === 'object' && 'length' in slides) { 4676 for (let i = 0; i < slides.length; i += 1) { 4677 if (slides[i]) swiper.virtual.slides.push(slides[i]); 4678 } 4679 } else { 4680 swiper.virtual.slides.push(slides); 4681 } 4682 update(true); 4683 } 4684 function prependSlide(slides) { 4685 const activeIndex = swiper.activeIndex; 4686 let newActiveIndex = activeIndex + 1; 4687 let numberOfNewSlides = 1; 4688 if (Array.isArray(slides)) { 4689 for (let i = 0; i < slides.length; i += 1) { 4690 if (slides[i]) swiper.virtual.slides.unshift(slides[i]); 4691 } 4692 newActiveIndex = activeIndex + slides.length; 4693 numberOfNewSlides = slides.length; 4694 } else { 4695 swiper.virtual.slides.unshift(slides); 4696 } 4697 if (swiper.params.virtual.cache) { 4698 const cache = swiper.virtual.cache; 4699 const newCache = {}; 4700 Object.keys(cache).forEach(cachedIndex => { 4701 const cachedEl = cache[cachedIndex]; 4702 const cachedElIndex = cachedEl.getAttribute('data-swiper-slide-index'); 4703 if (cachedElIndex) { 4704 cachedEl.setAttribute('data-swiper-slide-index', parseInt(cachedElIndex, 10) + numberOfNewSlides); 4705 } 4706 newCache[parseInt(cachedIndex, 10) + numberOfNewSlides] = cachedEl; 4707 }); 4708 swiper.virtual.cache = newCache; 4709 } 4710 update(true); 4711 swiper.slideTo(newActiveIndex, 0); 4712 } 4713 function removeSlide(slidesIndexes) { 4714 if (typeof slidesIndexes === 'undefined' || slidesIndexes === null) return; 4715 let activeIndex = swiper.activeIndex; 4716 if (Array.isArray(slidesIndexes)) { 4717 for (let i = slidesIndexes.length - 1; i >= 0; i -= 1) { 4718 if (swiper.params.virtual.cache) { 4719 delete swiper.virtual.cache[slidesIndexes[i]]; 4720 // shift cache indexes 4721 Object.keys(swiper.virtual.cache).forEach(key => { 4722 if (key > slidesIndexes) { 4723 swiper.virtual.cache[key - 1] = swiper.virtual.cache[key]; 4724 swiper.virtual.cache[key - 1].setAttribute('data-swiper-slide-index', key - 1); 4725 delete swiper.virtual.cache[key]; 4726 } 4727 }); 4728 } 4729 swiper.virtual.slides.splice(slidesIndexes[i], 1); 4730 if (slidesIndexes[i] < activeIndex) activeIndex -= 1; 4731 activeIndex = Math.max(activeIndex, 0); 4732 } 4733 } else { 4734 if (swiper.params.virtual.cache) { 4735 delete swiper.virtual.cache[slidesIndexes]; 4736 // shift cache indexes 4737 Object.keys(swiper.virtual.cache).forEach(key => { 4738 if (key > slidesIndexes) { 4739 swiper.virtual.cache[key - 1] = swiper.virtual.cache[key]; 4740 swiper.virtual.cache[key - 1].setAttribute('data-swiper-slide-index', key - 1); 4741 delete swiper.virtual.cache[key]; 4742 } 4743 }); 4744 } 4745 swiper.virtual.slides.splice(slidesIndexes, 1); 4746 if (slidesIndexes < activeIndex) activeIndex -= 1; 4747 activeIndex = Math.max(activeIndex, 0); 4748 } 4749 update(true); 4750 swiper.slideTo(activeIndex, 0); 4751 } 4752 function removeAllSlides() { 4753 swiper.virtual.slides = []; 4754 if (swiper.params.virtual.cache) { 4755 swiper.virtual.cache = {}; 4756 } 4757 update(true); 4758 swiper.slideTo(0, 0); 4759 } 4760 on('beforeInit', () => { 4761 if (!swiper.params.virtual.enabled) return; 4762 let domSlidesAssigned; 4763 if (typeof swiper.passedParams.virtual.slides === 'undefined') { 4764 const slides = [...swiper.slidesEl.children].filter(el => el.matches(`.${swiper.params.slideClass}, swiper-slide`)); 4765 if (slides && slides.length) { 4766 swiper.virtual.slides = [...slides]; 4767 domSlidesAssigned = true; 4768 slides.forEach((slideEl, slideIndex) => { 4769 slideEl.setAttribute('data-swiper-slide-index', slideIndex); 4770 swiper.virtual.cache[slideIndex] = slideEl; 4771 slideEl.remove(); 4772 }); 4773 } 4774 } 4775 if (!domSlidesAssigned) { 4776 swiper.virtual.slides = swiper.params.virtual.slides; 4777 } 4778 swiper.classNames.push(`${swiper.params.containerModifierClass}virtual`); 4779 swiper.params.watchSlidesProgress = true; 4780 swiper.originalParams.watchSlidesProgress = true; 4781 update(false, true); 4782 }); 4783 on('setTranslate', () => { 4784 if (!swiper.params.virtual.enabled) return; 4785 if (swiper.params.cssMode && !swiper._immediateVirtual) { 4786 clearTimeout(cssModeTimeout); 4787 cssModeTimeout = setTimeout(() => { 4788 update(); 4789 }, 100); 4790 } else { 4791 update(); 4792 } 4793 }); 4794 on('init update resize', () => { 4795 if (!swiper.params.virtual.enabled) return; 4796 if (swiper.params.cssMode) { 4797 setCSSProperty(swiper.wrapperEl, '--swiper-virtual-size', `${swiper.virtualSize}px`); 4798 } 4799 }); 4800 Object.assign(swiper.virtual, { 4801 appendSlide, 4802 prependSlide, 4803 removeSlide, 4804 removeAllSlides, 4805 update 4806 }); 4807} 4808 4809 4810 4811;// ./node_modules/swiper/modules/keyboard.mjs 4812 4813 4814 4815/* eslint-disable consistent-return */ 4816function Keyboard(_ref) { 4817 let { 4818 swiper, 4819 extendParams, 4820 on, 4821 emit 4822 } = _ref; 4823 const document = getDocument(); 4824 const window = getWindow(); 4825 swiper.keyboard = { 4826 enabled: false 4827 }; 4828 extendParams({ 4829 keyboard: { 4830 enabled: false, 4831 onlyInViewport: true, 4832 pageUpDown: true 4833 } 4834 }); 4835 function handle(event) { 4836 if (!swiper.enabled) return; 4837 const { 4838 rtlTranslate: rtl 4839 } = swiper; 4840 let e = event; 4841 if (e.originalEvent) e = e.originalEvent; // jquery fix
vendor: 3,932 bytes, lines 4842-4947
4842 const kc = e.keyCode || e.charCode; 4843 const pageUpDown = swiper.params.keyboard.pageUpDown; 4844 const isPageUp = pageUpDown && kc === 33; 4845 const isPageDown = pageUpDown && kc === 34; 4846 const isArrowLeft = kc === 37; 4847 const isArrowRight = kc === 39; 4848 const isArrowUp = kc === 38; 4849 const isArrowDown = kc === 40; 4850 // Directions locks 4851 if (!swiper.allowSlideNext && (swiper.isHorizontal() && isArrowRight || swiper.isVertical() && isArrowDown || isPageDown)) { 4852 return false; 4853 } 4854 if (!swiper.allowSlidePrev && (swiper.isHorizontal() && isArrowLeft || swiper.isVertical() && isArrowUp || isPageUp)) { 4855 return false; 4856 } 4857 if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey) { 4858 return undefined; 4859 } 4860 if (document.activeElement && document.activeElement.nodeName && (document.activeElement.nodeName.toLowerCase() === 'input' || document.activeElement.nodeName.toLowerCase() === 'textarea')) { 4861 return undefined; 4862 } 4863 if (swiper.params.keyboard.onlyInViewport && (isPageUp || isPageDown || isArrowLeft || isArrowRight || isArrowUp || isArrowDown)) { 4864 let inView = false; 4865 // Check that swiper should be inside of visible area of window 4866 if (elementParents(swiper.el, `.${swiper.params.slideClass}, swiper-slide`).length > 0 && elementParents(swiper.el, `.${swiper.params.slideActiveClass}`).length === 0) { 4867 return undefined; 4868 } 4869 const el = swiper.el; 4870 const swiperWidth = el.clientWidth; 4871 const swiperHeight = el.clientHeight; 4872 const windowWidth = window.innerWidth; 4873 const windowHeight = window.innerHeight; 4874 const swiperOffset = elementOffset(el); 4875 if (rtl) swiperOffset.left -= el.scrollLeft; 4876 const swiperCoord = [[swiperOffset.left, swiperOffset.top], [swiperOffset.left + swiperWidth, swiperOffset.top], [swiperOffset.left, swiperOffset.top + swiperHeight], [swiperOffset.left + swiperWidth, swiperOffset.top + swiperHeight]]; 4877 for (let i = 0; i < swiperCoord.length; i += 1) { 4878 const point = swiperCoord[i]; 4879 if (point[0] >= 0 && point[0] <= windowWidth && point[1] >= 0 && point[1] <= windowHeight) { 4880 if (point[0] === 0 && point[1] === 0) continue; // eslint-disable-line 4881 inView = true; 4882 } 4883 } 4884 if (!inView) return undefined; 4885 } 4886 if (swiper.isHorizontal()) { 4887 if (isPageUp || isPageDown || isArrowLeft || isArrowRight) { 4888 if (e.preventDefault) e.preventDefault();else e.returnValue = false; 4889 } 4890 if ((isPageDown || isArrowRight) && !rtl || (isPageUp || isArrowLeft) && rtl) swiper.slideNext(); 4891 if ((isPageUp || isArrowLeft) && !rtl || (isPageDown || isArrowRight) && rtl) swiper.slidePrev(); 4892 } else { 4893 if (isPageUp || isPageDown || isArrowUp || isArrowDown) { 4894 if (e.preventDefault) e.preventDefault();else e.returnValue = false; 4895 } 4896 if (isPageDown || isArrowDown) swiper.slideNext(); 4897 if (isPageUp || isArrowUp) swiper.slidePrev(); 4898 } 4899 emit('keyPress', kc); 4900 return undefined; 4901 } 4902 function enable() { 4903 if (swiper.keyboard.enabled) return; 4904 document.addEventListener('keydown', handle); 4905 swiper.keyboard.enabled = true; 4906 } 4907 function disable() { 4908 if (!swiper.keyboard.enabled) return; 4909 document.removeEventListener('keydown', handle); 4910 swiper.keyboard.enabled = false; 4911 } 4912 on('init', () => { 4913 if (swiper.params.keyboard.enabled) { 4914 enable(); 4915 } 4916 }); 4917 on('destroy', () => { 4918 if (swiper.keyboard.enabled) { 4919 disable(); 4920 } 4921 }); 4922 Object.assign(swiper.keyboard, { 4923 enable, 4924 disable 4925 }); 4926} 4927 4928 4929 4930;// ./node_modules/swiper/modules/mousewheel.mjs 4931 4932 4933 4934/* eslint-disable consistent-return */ 4935function Mousewheel(_ref) { 4936 let { 4937 swiper, 4938 extendParams, 4939 on, 4940 emit 4941 } = _ref; 4942 const window = getWindow(); 4943 extendParams({ 4944 mousewheel: { 4945 enabled: false, 4946 releaseOnEdges: false, 4947 invert: false,
vendor: 17,915 bytes, lines 4948-5441
4948 forceToAxis: false, 4949 sensitivity: 1, 4950 eventsTarget: 'container', 4951 thresholdDelta: null, 4952 thresholdTime: null, 4953 noMousewheelClass: 'swiper-no-mousewheel' 4954 } 4955 }); 4956 swiper.mousewheel = { 4957 enabled: false 4958 }; 4959 let timeout; 4960 let lastScrollTime = now(); 4961 let lastEventBeforeSnap; 4962 const recentWheelEvents = []; 4963 function normalize(e) { 4964 // Reasonable defaults 4965 const PIXEL_STEP = 10; 4966 const LINE_HEIGHT = 40; 4967 const PAGE_HEIGHT = 800; 4968 let sX = 0; 4969 let sY = 0; // spinX, spinY 4970 let pX = 0; 4971 let pY = 0; // pixelX, pixelY 4972 4973 // Legacy 4974 if ('detail' in e) { 4975 sY = e.detail; 4976 } 4977 if ('wheelDelta' in e) { 4978 sY = -e.wheelDelta / 120; 4979 } 4980 if ('wheelDeltaY' in e) { 4981 sY = -e.wheelDeltaY / 120; 4982 } 4983 if ('wheelDeltaX' in e) { 4984 sX = -e.wheelDeltaX / 120; 4985 } 4986 4987 // side scrolling on FF with DOMMouseScroll 4988 if ('axis' in e && e.axis === e.HORIZONTAL_AXIS) { 4989 sX = sY; 4990 sY = 0; 4991 } 4992 pX = sX * PIXEL_STEP; 4993 pY = sY * PIXEL_STEP; 4994 if ('deltaY' in e) { 4995 pY = e.deltaY; 4996 } 4997 if ('deltaX' in e) { 4998 pX = e.deltaX; 4999 } 5000 if (e.shiftKey && !pX) { 5001 // if user scrolls with shift he wants horizontal scroll 5002 pX = pY; 5003 pY = 0; 5004 } 5005 if ((pX || pY) && e.deltaMode) { 5006 if (e.deltaMode === 1) { 5007 // delta in LINE units 5008 pX *= LINE_HEIGHT; 5009 pY *= LINE_HEIGHT; 5010 } else { 5011 // delta in PAGE units 5012 pX *= PAGE_HEIGHT; 5013 pY *= PAGE_HEIGHT; 5014 } 5015 } 5016 5017 // Fall-back if spin cannot be determined 5018 if (pX && !sX) { 5019 sX = pX < 1 ? -1 : 1; 5020 } 5021 if (pY && !sY) { 5022 sY = pY < 1 ? -1 : 1; 5023 } 5024 return { 5025 spinX: sX, 5026 spinY: sY, 5027 pixelX: pX, 5028 pixelY: pY 5029 }; 5030 } 5031 function handleMouseEnter() { 5032 if (!swiper.enabled) return; 5033 swiper.mouseEntered = true; 5034 } 5035 function handleMouseLeave() { 5036 if (!swiper.enabled) return; 5037 swiper.mouseEntered = false; 5038 } 5039 function animateSlider(newEvent) { 5040 if (swiper.params.mousewheel.thresholdDelta && newEvent.delta < swiper.params.mousewheel.thresholdDelta) { 5041 // Prevent if delta of wheel scroll delta is below configured threshold 5042 return false; 5043 } 5044 if (swiper.params.mousewheel.thresholdTime && now() - lastScrollTime < swiper.params.mousewheel.thresholdTime) { 5045 // Prevent if time between scrolls is below configured threshold 5046 return false; 5047 } 5048 5049 // If the movement is NOT big enough and 5050 // if the last time the user scrolled was too close to the current one (avoid continuously triggering the slider): 5051 // Don't go any further (avoid insignificant scroll movement). 5052 if (newEvent.delta >= 6 && now() - lastScrollTime < 60) { 5053 // Return false as a default 5054 return true; 5055 } 5056 // If user is scrolling towards the end: 5057 // If the slider hasn't hit the latest slide or 5058 // if the slider is a loop and 5059 // if the slider isn't moving right now: 5060 // Go to next slide and 5061 // emit a scroll event. 5062 // Else (the user is scrolling towards the beginning) and 5063 // if the slider hasn't hit the first slide or 5064 // if the slider is a loop and 5065 // if the slider isn't moving right now: 5066 // Go to prev slide and 5067 // emit a scroll event. 5068 if (newEvent.direction < 0) { 5069 if ((!swiper.isEnd || swiper.params.loop) && !swiper.animating) { 5070 swiper.slideNext(); 5071 emit('scroll', newEvent.raw); 5072 } 5073 } else if ((!swiper.isBeginning || swiper.params.loop) && !swiper.animating) { 5074 swiper.slidePrev(); 5075 emit('scroll', newEvent.raw); 5076 } 5077 // If you got here is because an animation has been triggered so store the current time 5078 lastScrollTime = new window.Date().getTime(); 5079 // Return false as a default 5080 return false; 5081 } 5082 function releaseScroll(newEvent) { 5083 const params = swiper.params.mousewheel; 5084 if (newEvent.direction < 0) { 5085 if (swiper.isEnd && !swiper.params.loop && params.releaseOnEdges) { 5086 // Return true to animate scroll on edges 5087 return true; 5088 } 5089 } else if (swiper.isBeginning && !swiper.params.loop && params.releaseOnEdges) { 5090 // Return true to animate scroll on edges 5091 return true; 5092 } 5093 return false; 5094 } 5095 function handle(event) { 5096 let e = event; 5097 let disableParentSwiper = true; 5098 if (!swiper.enabled) return; 5099 5100 // Ignore event if the target or its parents have the swiper-no-mousewheel class 5101 if (event.target.closest(`.${swiper.params.mousewheel.noMousewheelClass}`)) return; 5102 const params = swiper.params.mousewheel; 5103 if (swiper.params.cssMode) { 5104 e.preventDefault(); 5105 } 5106 let targetEl = swiper.el; 5107 if (swiper.params.mousewheel.eventsTarget !== 'container') { 5108 targetEl = document.querySelector(swiper.params.mousewheel.eventsTarget); 5109 } 5110 const targetElContainsTarget = targetEl && targetEl.contains(e.target); 5111 if (!swiper.mouseEntered && !targetElContainsTarget && !params.releaseOnEdges) return true; 5112 if (e.originalEvent) e = e.originalEvent; // jquery fix 5113 let delta = 0; 5114 const rtlFactor = swiper.rtlTranslate ? -1 : 1; 5115 const data = normalize(e); 5116 if (params.forceToAxis) { 5117 if (swiper.isHorizontal()) { 5118 if (Math.abs(data.pixelX) > Math.abs(data.pixelY)) delta = -data.pixelX * rtlFactor;else return true; 5119 } else if (Math.abs(data.pixelY) > Math.abs(data.pixelX)) delta = -data.pixelY;else return true; 5120 } else { 5121 delta = Math.abs(data.pixelX) > Math.abs(data.pixelY) ? -data.pixelX * rtlFactor : -data.pixelY; 5122 } 5123 if (delta === 0) return true; 5124 if (params.invert) delta = -delta; 5125 5126 // Get the scroll positions 5127 let positions = swiper.getTranslate() + delta * params.sensitivity; 5128 if (positions >= swiper.minTranslate()) positions = swiper.minTranslate(); 5129 if (positions <= swiper.maxTranslate()) positions = swiper.maxTranslate(); 5130 5131 // When loop is true: 5132 // the disableParentSwiper will be true. 5133 // When loop is false: 5134 // if the scroll positions is not on edge, 5135 // then the disableParentSwiper will be true. 5136 // if the scroll on edge positions, 5137 // then the disableParentSwiper will be false. 5138 disableParentSwiper = swiper.params.loop ? true : !(positions === swiper.minTranslate() || positions === swiper.maxTranslate()); 5139 if (disableParentSwiper && swiper.params.nested) e.stopPropagation(); 5140 if (!swiper.params.freeMode || !swiper.params.freeMode.enabled) { 5141 // Register the new event in a variable which stores the relevant data 5142 const newEvent = { 5143 time: now(), 5144 delta: Math.abs(delta), 5145 direction: Math.sign(delta), 5146 raw: event 5147 }; 5148 5149 // Keep the most recent events 5150 if (recentWheelEvents.length >= 2) { 5151 recentWheelEvents.shift(); // only store the last N events 5152 } 5153 5154 const prevEvent = recentWheelEvents.length ? recentWheelEvents[recentWheelEvents.length - 1] : undefined; 5155 recentWheelEvents.push(newEvent); 5156 5157 // If there is at least one previous recorded event: 5158 // If direction has changed or 5159 // if the scroll is quicker than the previous one: 5160 // Animate the slider. 5161 // Else (this is the first time the wheel is moved): 5162 // Animate the slider. 5163 if (prevEvent) { 5164 if (newEvent.direction !== prevEvent.direction || newEvent.delta > prevEvent.delta || newEvent.time > prevEvent.time + 150) { 5165 animateSlider(newEvent); 5166 } 5167 } else { 5168 animateSlider(newEvent); 5169 } 5170 5171 // If it's time to release the scroll: 5172 // Return now so you don't hit the preventDefault. 5173 if (releaseScroll(newEvent)) { 5174 return true; 5175 } 5176 } else { 5177 // Freemode or scrollContainer: 5178 5179 // If we recently snapped after a momentum scroll, then ignore wheel events 5180 // to give time for the deceleration to finish. Stop ignoring after 500 msecs 5181 // or if it's a new scroll (larger delta or inverse sign as last event before 5182 // an end-of-momentum snap). 5183 const newEvent = { 5184 time: now(), 5185 delta: Math.abs(delta), 5186 direction: Math.sign(delta) 5187 }; 5188 const ignoreWheelEvents = lastEventBeforeSnap && newEvent.time < lastEventBeforeSnap.time + 500 && newEvent.delta <= lastEventBeforeSnap.delta && newEvent.direction === lastEventBeforeSnap.direction; 5189 if (!ignoreWheelEvents) { 5190 lastEventBeforeSnap = undefined; 5191 let position = swiper.getTranslate() + delta * params.sensitivity; 5192 const wasBeginning = swiper.isBeginning; 5193 const wasEnd = swiper.isEnd; 5194 if (position >= swiper.minTranslate()) position = swiper.minTranslate(); 5195 if (position <= swiper.maxTranslate()) position = swiper.maxTranslate(); 5196 swiper.setTransition(0); 5197 swiper.setTranslate(position); 5198 swiper.updateProgress(); 5199 swiper.updateActiveIndex(); 5200 swiper.updateSlidesClasses(); 5201 if (!wasBeginning && swiper.isBeginning || !wasEnd && swiper.isEnd) { 5202 swiper.updateSlidesClasses(); 5203 } 5204 if (swiper.params.loop) { 5205 swiper.loopFix({ 5206 direction: newEvent.direction < 0 ? 'next' : 'prev', 5207 byMousewheel: true 5208 }); 5209 } 5210 if (swiper.params.freeMode.sticky) { 5211 // When wheel scrolling starts with sticky (aka snap) enabled, then detect 5212 // the end of a momentum scroll by storing recent (N=15?) wheel events. 5213 // 1. do all N events have decreasing or same (absolute value) delta? 5214 // 2. did all N events arrive in the last M (M=500?) msecs? 5215 // 3. does the earliest event have an (absolute value) delta that's 5216 // at least P (P=1?) larger than the most recent event's delta? 5217 // 4. does the latest event have a delta that's smaller than Q (Q=6?) pixels? 5218 // If 1-4 are "yes" then we're near the end of a momentum scroll deceleration. 5219 // Snap immediately and ignore remaining wheel events in this scroll. 5220 // See comment above for "remaining wheel events in this scroll" determination. 5221 // If 1-4 aren't satisfied, then wait to snap until 500ms after the last event. 5222 clearTimeout(timeout); 5223 timeout = undefined; 5224 if (recentWheelEvents.length >= 15) { 5225 recentWheelEvents.shift(); // only store the last N events 5226 } 5227 5228 const prevEvent = recentWheelEvents.length ? recentWheelEvents[recentWheelEvents.length - 1] : undefined; 5229 const firstEvent = recentWheelEvents[0]; 5230 recentWheelEvents.push(newEvent); 5231 if (prevEvent && (newEvent.delta > prevEvent.delta || newEvent.direction !== prevEvent.direction)) { 5232 // Increasing or reverse-sign delta means the user started scrolling again. Clear the wheel event log. 5233 recentWheelEvents.splice(0); 5234 } else if (recentWheelEvents.length >= 15 && newEvent.time - firstEvent.time < 500 && firstEvent.delta - newEvent.delta >= 1 && newEvent.delta <= 6) { 5235 // We're at the end of the deceleration of a momentum scroll, so there's no need 5236 // to wait for more events. Snap ASAP on the next tick. 5237 // Also, because there's some remaining momentum we'll bias the snap in the 5238 // direction of the ongoing scroll because it's better UX for the scroll to snap 5239 // in the same direction as the scroll instead of reversing to snap. Therefore, 5240 // if it's already scrolled more than 20% in the current direction, keep going. 5241 const snapToThreshold = delta > 0 ? 0.8 : 0.2; 5242 lastEventBeforeSnap = newEvent; 5243 recentWheelEvents.splice(0); 5244 timeout = nextTick(() => { 5245 if (swiper.destroyed || !swiper.params) return; 5246 swiper.slideToClosest(swiper.params.speed, true, undefined, snapToThreshold); 5247 }, 0); // no delay; move on next tick 5248 } 5249 5250 if (!timeout) { 5251 // if we get here, then we haven't detected the end of a momentum scroll, so 5252 // we'll consider a scroll "complete" when there haven't been any wheel events 5253 // for 500ms. 5254 timeout = nextTick(() => { 5255 if (swiper.destroyed || !swiper.params) return; 5256 const snapToThreshold = 0.5; 5257 lastEventBeforeSnap = newEvent; 5258 recentWheelEvents.splice(0); 5259 swiper.slideToClosest(swiper.params.speed, true, undefined, snapToThreshold); 5260 }, 500); 5261 } 5262 } 5263 5264 // Emit event 5265 if (!ignoreWheelEvents) emit('scroll', e); 5266 5267 // Stop autoplay 5268 if (swiper.params.autoplay && swiper.params.autoplay.disableOnInteraction) swiper.autoplay.stop(); 5269 // Return page scroll on edge positions 5270 if (params.releaseOnEdges && (position === swiper.minTranslate() || position === swiper.maxTranslate())) { 5271 return true; 5272 } 5273 } 5274 } 5275 if (e.preventDefault) e.preventDefault();else e.returnValue = false; 5276 return false; 5277 } 5278 function events(method) { 5279 let targetEl = swiper.el; 5280 if (swiper.params.mousewheel.eventsTarget !== 'container') { 5281 targetEl = document.querySelector(swiper.params.mousewheel.eventsTarget); 5282 } 5283 targetEl[method]('mouseenter', handleMouseEnter); 5284 targetEl[method]('mouseleave', handleMouseLeave); 5285 targetEl[method]('wheel', handle); 5286 } 5287 function enable() { 5288 if (swiper.params.cssMode) { 5289 swiper.wrapperEl.removeEventListener('wheel', handle); 5290 return true; 5291 } 5292 if (swiper.mousewheel.enabled) return false; 5293 events('addEventListener'); 5294 swiper.mousewheel.enabled = true; 5295 return true; 5296 } 5297 function disable() { 5298 if (swiper.params.cssMode) { 5299 swiper.wrapperEl.addEventListener(event, handle); 5300 return true; 5301 } 5302 if (!swiper.mousewheel.enabled) return false; 5303 events('removeEventListener'); 5304 swiper.mousewheel.enabled = false; 5305 return true; 5306 } 5307 on('init', () => { 5308 if (!swiper.params.mousewheel.enabled && swiper.params.cssMode) { 5309 disable(); 5310 } 5311 if (swiper.params.mousewheel.enabled) enable(); 5312 }); 5313 on('destroy', () => { 5314 if (swiper.params.cssMode) { 5315 enable(); 5316 } 5317 if (swiper.mousewheel.enabled) disable(); 5318 }); 5319 Object.assign(swiper.mousewheel, { 5320 enable, 5321 disable 5322 }); 5323} 5324 5325 5326 5327;// ./node_modules/swiper/shared/create-element-if-not-defined.mjs 5328 5329 5330function createElementIfNotDefined(swiper, originalParams, params, checkProps) { 5331 if (swiper.params.createElements) { 5332 Object.keys(checkProps).forEach(key => { 5333 if (!params[key] && params.auto === true) { 5334 let element = elementChildren(swiper.el, `.${checkProps[key]}`)[0]; 5335 if (!element) { 5336 element = createElement('div', checkProps[key]); 5337 element.className = checkProps[key]; 5338 swiper.el.append(element); 5339 } 5340 params[key] = element; 5341 originalParams[key] = element; 5342 } 5343 }); 5344 } 5345 return params; 5346} 5347 5348 5349 5350;// ./node_modules/swiper/modules/navigation.mjs 5351 5352 5353 5354function Navigation(_ref) { 5355 let { 5356 swiper, 5357 extendParams, 5358 on, 5359 emit 5360 } = _ref; 5361 extendParams({ 5362 navigation: { 5363 nextEl: null, 5364 prevEl: null, 5365 hideOnClick: false, 5366 disabledClass: 'swiper-button-disabled', 5367 hiddenClass: 'swiper-button-hidden', 5368 lockClass: 'swiper-button-lock', 5369 navigationDisabledClass: 'swiper-navigation-disabled' 5370 } 5371 }); 5372 swiper.navigation = { 5373 nextEl: null, 5374 prevEl: null 5375 }; 5376 function getEl(el) { 5377 let res; 5378 if (el && typeof el === 'string' && swiper.isElement) { 5379 res = swiper.el.querySelector(el) || swiper.hostEl.querySelector(el); 5380 if (res) return res; 5381 } 5382 if (el) { 5383 if (typeof el === 'string') res = [...document.querySelectorAll(el)]; 5384 if (swiper.params.uniqueNavElements && typeof el === 'string' && res && res.length > 1 && swiper.el.querySelectorAll(el).length === 1) { 5385 res = swiper.el.querySelector(el); 5386 } else if (res && res.length === 1) { 5387 res = res[0]; 5388 } 5389 } 5390 if (el && !res) return el; 5391 // if (Array.isArray(res) && res.length === 1) res = res[0]; 5392 return res; 5393 } 5394 function toggleEl(el, disabled) { 5395 const params = swiper.params.navigation; 5396 el = makeElementsArray(el); 5397 el.forEach(subEl => { 5398 if (subEl) { 5399 subEl.classList[disabled ? 'add' : 'remove'](...params.disabledClass.split(' ')); 5400 if (subEl.tagName === 'BUTTON') subEl.disabled = disabled; 5401 if (swiper.params.watchOverflow && swiper.enabled) { 5402 subEl.classList[swiper.isLocked ? 'add' : 'remove'](params.lockClass); 5403 } 5404 } 5405 }); 5406 } 5407 function update() { 5408 // Update Navigation Buttons 5409 const { 5410 nextEl, 5411 prevEl 5412 } = swiper.navigation; 5413 if (swiper.params.loop) { 5414 toggleEl(prevEl, false); 5415 toggleEl(nextEl, false); 5416 return; 5417 } 5418 toggleEl(prevEl, swiper.isBeginning && !swiper.params.rewind); 5419 toggleEl(nextEl, swiper.isEnd && !swiper.params.rewind); 5420 } 5421 function onPrevClick(e) { 5422 e.preventDefault(); 5423 if (swiper.isBeginning && !swiper.params.loop && !swiper.params.rewind) return; 5424 swiper.slidePrev(); 5425 emit('navigationPrev'); 5426 } 5427 function onNextClick(e) { 5428 e.preventDefault(); 5429 if (swiper.isEnd && !swiper.params.loop && !swiper.params.rewind) return; 5430 swiper.slideNext(); 5431 emit('navigationNext'); 5432 } 5433 function init() { 5434 const params = swiper.params.navigation; 5435 swiper.params.navigation = createElementIfNotDefined(swiper, swiper.originalParams.navigation, swiper.params.navigation, { 5436 nextEl: 'swiper-button-next', 5437 prevEl: 'swiper-button-prev' 5438 }); 5439 if (!(params.nextEl || params.prevEl)) return; 5440 let nextEl = getEl(params.nextEl); 5441 let prevEl = getEl(params.prevEl);
vendor: 3,742 bytes, lines 5442-5574
5442 Object.assign(swiper.navigation, { 5443 nextEl, 5444 prevEl 5445 }); 5446 nextEl = makeElementsArray(nextEl); 5447 prevEl = makeElementsArray(prevEl); 5448 const initButton = (el, dir) => { 5449 if (el) { 5450 el.addEventListener('click', dir === 'next' ? onNextClick : onPrevClick); 5451 } 5452 if (!swiper.enabled && el) { 5453 el.classList.add(...params.lockClass.split(' ')); 5454 } 5455 }; 5456 nextEl.forEach(el => initButton(el, 'next')); 5457 prevEl.forEach(el => initButton(el, 'prev')); 5458 } 5459 function destroy() { 5460 let { 5461 nextEl, 5462 prevEl 5463 } = swiper.navigation; 5464 nextEl = makeElementsArray(nextEl); 5465 prevEl = makeElementsArray(prevEl); 5466 const destroyButton = (el, dir) => { 5467 el.removeEventListener('click', dir === 'next' ? onNextClick : onPrevClick); 5468 el.classList.remove(...swiper.params.navigation.disabledClass.split(' ')); 5469 }; 5470 nextEl.forEach(el => destroyButton(el, 'next')); 5471 prevEl.forEach(el => destroyButton(el, 'prev')); 5472 } 5473 on('init', () => { 5474 if (swiper.params.navigation.enabled === false) { 5475 // eslint-disable-next-line 5476 disable(); 5477 } else { 5478 init(); 5479 update(); 5480 } 5481 }); 5482 on('toEdge fromEdge lock unlock', () => { 5483 update(); 5484 }); 5485 on('destroy', () => { 5486 destroy(); 5487 }); 5488 on('enable disable', () => { 5489 let { 5490 nextEl, 5491 prevEl 5492 } = swiper.navigation; 5493 nextEl = makeElementsArray(nextEl); 5494 prevEl = makeElementsArray(prevEl); 5495 if (swiper.enabled) { 5496 update(); 5497 return; 5498 } 5499 [...nextEl, ...prevEl].filter(el => !!el).forEach(el => el.classList.add(swiper.params.navigation.lockClass)); 5500 }); 5501 on('click', (_s, e) => { 5502 let { 5503 nextEl, 5504 prevEl 5505 } = swiper.navigation; 5506 nextEl = makeElementsArray(nextEl); 5507 prevEl = makeElementsArray(prevEl); 5508 const targetEl = e.target; 5509 let targetIsButton = prevEl.includes(targetEl) || nextEl.includes(targetEl); 5510 if (swiper.isElement && !targetIsButton) { 5511 const path = e.path || e.composedPath && e.composedPath(); 5512 if (path) { 5513 targetIsButton = path.find(pathEl => nextEl.includes(pathEl) || prevEl.includes(pathEl)); 5514 } 5515 } 5516 if (swiper.params.navigation.hideOnClick && !targetIsButton) { 5517 if (swiper.pagination && swiper.params.pagination && swiper.params.pagination.clickable && (swiper.pagination.el === targetEl || swiper.pagination.el.contains(targetEl))) return; 5518 let isHidden; 5519 if (nextEl.length) { 5520 isHidden = nextEl[0].classList.contains(swiper.params.navigation.hiddenClass); 5521 } else if (prevEl.length) { 5522 isHidden = prevEl[0].classList.contains(swiper.params.navigation.hiddenClass); 5523 } 5524 if (isHidden === true) { 5525 emit('navigationShow'); 5526 } else { 5527 emit('navigationHide'); 5528 } 5529 [...nextEl, ...prevEl].filter(el => !!el).forEach(el => el.classList.toggle(swiper.params.navigation.hiddenClass)); 5530 } 5531 }); 5532 const enable = () => { 5533 swiper.el.classList.remove(...swiper.params.navigation.navigationDisabledClass.split(' ')); 5534 init(); 5535 update(); 5536 }; 5537 const disable = () => { 5538 swiper.el.classList.add(...swiper.params.navigation.navigationDisabledClass.split(' ')); 5539 destroy(); 5540 }; 5541 Object.assign(swiper.navigation, { 5542 enable, 5543 disable, 5544 update, 5545 init, 5546 destroy 5547 }); 5548} 5549 5550 5551 5552;// ./node_modules/swiper/shared/classes-to-selector.mjs 5553function classesToSelector(classes) { 5554 if (classes === void 0) { 5555 classes = ''; 5556 } 5557 return `.${classes.trim().replace(/([\.:!+\/])/g, '\\$1') // eslint-disable-line 5558 .replace(/ /g, '.')}`; 5559} 5560 5561 5562 5563;// ./node_modules/swiper/modules/pagination.mjs 5564 5565 5566 5567 5568function Pagination(_ref) { 5569 let { 5570 swiper, 5571 extendParams, 5572 on, 5573 emit 5574 } = _ref;
vendor: 8,796 bytes, lines 5574-5792
5574 5575 const pfx = 'swiper-pagination'; 5576 extendParams({ 5577 pagination: { 5578 el: null, 5579 bulletElement: 'span', 5580 clickable: false, 5581 hideOnClick: false, 5582 renderBullet: null, 5583 renderProgressbar: null, 5584 renderFraction: null, 5585 renderCustom: null, 5586 progressbarOpposite: false, 5587 type: 'bullets', 5588 // 'bullets' or 'progressbar' or 'fraction' or 'custom' 5589 dynamicBullets: false, 5590 dynamicMainBullets: 1, 5591 formatFractionCurrent: number => number, 5592 formatFractionTotal: number => number, 5593 bulletClass: `${pfx}-bullet`, 5594 bulletActiveClass: `${pfx}-bullet-active`, 5595 modifierClass: `${pfx}-`, 5596 currentClass: `${pfx}-current`, 5597 totalClass: `${pfx}-total`, 5598 hiddenClass: `${pfx}-hidden`, 5599 progressbarFillClass: `${pfx}-progressbar-fill`, 5600 progressbarOppositeClass: `${pfx}-progressbar-opposite`, 5601 clickableClass: `${pfx}-clickable`, 5602 lockClass: `${pfx}-lock`, 5603 horizontalClass: `${pfx}-horizontal`, 5604 verticalClass: `${pfx}-vertical`, 5605 paginationDisabledClass: `${pfx}-disabled` 5606 } 5607 }); 5608 swiper.pagination = { 5609 el: null, 5610 bullets: [] 5611 }; 5612 let bulletSize; 5613 let dynamicBulletIndex = 0; 5614 function isPaginationDisabled() { 5615 return !swiper.params.pagination.el || !swiper.pagination.el || Array.isArray(swiper.pagination.el) && swiper.pagination.el.length === 0; 5616 } 5617 function setSideBullets(bulletEl, position) { 5618 const { 5619 bulletActiveClass 5620 } = swiper.params.pagination; 5621 if (!bulletEl) return; 5622 bulletEl = bulletEl[`${position === 'prev' ? 'previous' : 'next'}ElementSibling`]; 5623 if (bulletEl) { 5624 bulletEl.classList.add(`${bulletActiveClass}-${position}`); 5625 bulletEl = bulletEl[`${position === 'prev' ? 'previous' : 'next'}ElementSibling`]; 5626 if (bulletEl) { 5627 bulletEl.classList.add(`${bulletActiveClass}-${position}-${position}`); 5628 } 5629 } 5630 } 5631 function getMoveDirection(prevIndex, nextIndex, length) { 5632 prevIndex = prevIndex % length; 5633 nextIndex = nextIndex % length; 5634 if (nextIndex === prevIndex + 1) { 5635 return 'next'; 5636 } else if (nextIndex === prevIndex - 1) { 5637 return 'previous'; 5638 } 5639 return; 5640 } 5641 function onBulletClick(e) { 5642 const bulletEl = e.target.closest(classesToSelector(swiper.params.pagination.bulletClass)); 5643 if (!bulletEl) { 5644 return; 5645 } 5646 e.preventDefault(); 5647 const index = elementIndex(bulletEl) * swiper.params.slidesPerGroup; 5648 if (swiper.params.loop) { 5649 if (swiper.realIndex === index) return; 5650 const moveDirection = getMoveDirection(swiper.realIndex, index, swiper.slides.length); 5651 if (moveDirection === 'next') { 5652 swiper.slideNext(); 5653 } else if (moveDirection === 'previous') { 5654 swiper.slidePrev(); 5655 } else { 5656 swiper.slideToLoop(index); 5657 } 5658 } else { 5659 swiper.slideTo(index); 5660 } 5661 } 5662 function update() { 5663 // Render || Update Pagination bullets/items 5664 const rtl = swiper.rtl; 5665 const params = swiper.params.pagination; 5666 if (isPaginationDisabled()) return; 5667 let el = swiper.pagination.el; 5668 el = makeElementsArray(el); 5669 // Current/Total 5670 let current; 5671 let previousIndex; 5672 const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length; 5673 const total = swiper.params.loop ? Math.ceil(slidesLength / swiper.params.slidesPerGroup) : swiper.snapGrid.length; 5674 if (swiper.params.loop) { 5675 previousIndex = swiper.previousRealIndex || 0; 5676 current = swiper.params.slidesPerGroup > 1 ? Math.floor(swiper.realIndex / swiper.params.slidesPerGroup) : swiper.realIndex; 5677 } else if (typeof swiper.snapIndex !== 'undefined') { 5678 current = swiper.snapIndex; 5679 previousIndex = swiper.previousSnapIndex; 5680 } else { 5681 previousIndex = swiper.previousIndex || 0; 5682 current = swiper.activeIndex || 0; 5683 } 5684 // Types 5685 if (params.type === 'bullets' && swiper.pagination.bullets && swiper.pagination.bullets.length > 0) { 5686 const bullets = swiper.pagination.bullets; 5687 let firstIndex; 5688 let lastIndex; 5689 let midIndex; 5690 if (params.dynamicBullets) { 5691 bulletSize = elementOuterSize(bullets[0], swiper.isHorizontal() ? 'width' : 'height', true); 5692 el.forEach(subEl => { 5693 subEl.style[swiper.isHorizontal() ? 'width' : 'height'] = `${bulletSize * (params.dynamicMainBullets + 4)}px`; 5694 }); 5695 if (params.dynamicMainBullets > 1 && previousIndex !== undefined) { 5696 dynamicBulletIndex += current - (previousIndex || 0); 5697 if (dynamicBulletIndex > params.dynamicMainBullets - 1) { 5698 dynamicBulletIndex = params.dynamicMainBullets - 1; 5699 } else if (dynamicBulletIndex < 0) { 5700 dynamicBulletIndex = 0; 5701 } 5702 } 5703 firstIndex = Math.max(current - dynamicBulletIndex, 0); 5704 lastIndex = firstIndex + (Math.min(bullets.length, params.dynamicMainBullets) - 1); 5705 midIndex = (lastIndex + firstIndex) / 2; 5706 } 5707 bullets.forEach(bulletEl => { 5708 const classesToRemove = [...['', '-next', '-next-next', '-prev', '-prev-prev', '-main'].map(suffix => `${params.bulletActiveClass}${suffix}`)].map(s => typeof s === 'string' && s.includes(' ') ? s.split(' ') : s).flat(); 5709 bulletEl.classList.remove(...classesToRemove); 5710 }); 5711 if (el.length > 1) { 5712 bullets.forEach(bullet => { 5713 const bulletIndex = elementIndex(bullet); 5714 if (bulletIndex === current) { 5715 bullet.classList.add(...params.bulletActiveClass.split(' ')); 5716 } else if (swiper.isElement) { 5717 bullet.setAttribute('part', 'bullet'); 5718 } 5719 if (params.dynamicBullets) { 5720 if (bulletIndex >= firstIndex && bulletIndex <= lastIndex) { 5721 bullet.classList.add(...`${params.bulletActiveClass}-main`.split(' ')); 5722 } 5723 if (bulletIndex === firstIndex) { 5724 setSideBullets(bullet, 'prev'); 5725 } 5726 if (bulletIndex === lastIndex) { 5727 setSideBullets(bullet, 'next'); 5728 } 5729 } 5730 }); 5731 } else { 5732 const bullet = bullets[current]; 5733 if (bullet) { 5734 bullet.classList.add(...params.bulletActiveClass.split(' ')); 5735 } 5736 if (swiper.isElement) { 5737 bullets.forEach((bulletEl, bulletIndex) => { 5738 bulletEl.setAttribute('part', bulletIndex === current ? 'bullet-active' : 'bullet'); 5739 }); 5740 } 5741 if (params.dynamicBullets) { 5742 const firstDisplayedBullet = bullets[firstIndex]; 5743 const lastDisplayedBullet = bullets[lastIndex]; 5744 for (let i = firstIndex; i <= lastIndex; i += 1) { 5745 if (bullets[i]) { 5746 bullets[i].classList.add(...`${params.bulletActiveClass}-main`.split(' ')); 5747 } 5748 } 5749 setSideBullets(firstDisplayedBullet, 'prev'); 5750 setSideBullets(lastDisplayedBullet, 'next'); 5751 } 5752 } 5753 if (params.dynamicBullets) { 5754 const dynamicBulletsLength = Math.min(bullets.length, params.dynamicMainBullets + 4); 5755 const bulletsOffset = (bulletSize * dynamicBulletsLength - bulletSize) / 2 - midIndex * bulletSize; 5756 const offsetProp = rtl ? 'right' : 'left'; 5757 bullets.forEach(bullet => { 5758 bullet.style[swiper.isHorizontal() ? offsetProp : 'top'] = `${bulletsOffset}px`; 5759 }); 5760 } 5761 } 5762 el.forEach((subEl, subElIndex) => { 5763 if (params.type === 'fraction') { 5764 subEl.querySelectorAll(classesToSelector(params.currentClass)).forEach(fractionEl => { 5765 fractionEl.textContent = params.formatFractionCurrent(current + 1); 5766 }); 5767 subEl.querySelectorAll(classesToSelector(params.totalClass)).forEach(totalEl => { 5768 totalEl.textContent = params.formatFractionTotal(total); 5769 }); 5770 } 5771 if (params.type === 'progressbar') { 5772 let progressbarDirection; 5773 if (params.progressbarOpposite) { 5774 progressbarDirection = swiper.isHorizontal() ? 'vertical' : 'horizontal'; 5775 } else { 5776 progressbarDirection = swiper.isHorizontal() ? 'horizontal' : 'vertical'; 5777 } 5778 const scale = (current + 1) / total; 5779 let scaleX = 1; 5780 let scaleY = 1; 5781 if (progressbarDirection === 'horizontal') { 5782 scaleX = scale; 5783 } else { 5784 scaleY = scale; 5785 } 5786 subEl.querySelectorAll(classesToSelector(params.progressbarFillClass)).forEach(progressEl => { 5787 progressEl.style.transform = `translate3d(0,0,0) scaleX(${scaleX}) scaleY(${scaleY})`; 5788 progressEl.style.transitionDuration = `${swiper.params.speed}ms`; 5789 }); 5790 } 5791 if (params.type === 'custom' && params.renderCustom) { 5792 s
vendor: 8,442 bytes, lines 5792-6039
5792ubEl.innerHTML = params.renderCustom(swiper, current + 1, total); 5793 if (subElIndex === 0) emit('paginationRender', subEl); 5794 } else { 5795 if (subElIndex === 0) emit('paginationRender', subEl); 5796 emit('paginationUpdate', subEl); 5797 } 5798 if (swiper.params.watchOverflow && swiper.enabled) { 5799 subEl.classList[swiper.isLocked ? 'add' : 'remove'](params.lockClass); 5800 } 5801 }); 5802 } 5803 function render() { 5804 // Render Container 5805 const params = swiper.params.pagination; 5806 if (isPaginationDisabled()) return; 5807 const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.grid && swiper.params.grid.rows > 1 ? swiper.slides.length / Math.ceil(swiper.params.grid.rows) : swiper.slides.length; 5808 let el = swiper.pagination.el; 5809 el = makeElementsArray(el); 5810 let paginationHTML = ''; 5811 if (params.type === 'bullets') { 5812 let numberOfBullets = swiper.params.loop ? Math.ceil(slidesLength / swiper.params.slidesPerGroup) : swiper.snapGrid.length; 5813 if (swiper.params.freeMode && swiper.params.freeMode.enabled && numberOfBullets > slidesLength) { 5814 numberOfBullets = slidesLength; 5815 } 5816 for (let i = 0; i < numberOfBullets; i += 1) { 5817 if (params.renderBullet) { 5818 paginationHTML += params.renderBullet.call(swiper, i, params.bulletClass); 5819 } else { 5820 // prettier-ignore 5821 paginationHTML += `<${params.bulletElement} ${swiper.isElement ? 'part="bullet"' : ''} class="${params.bulletClass}"></${params.bulletElement}>`; 5822 } 5823 } 5824 } 5825 if (params.type === 'fraction') { 5826 if (params.renderFraction) { 5827 paginationHTML = params.renderFraction.call(swiper, params.currentClass, params.totalClass); 5828 } else { 5829 paginationHTML = `<span class="${params.currentClass}"></span>` + ' / ' + `<span class="${params.totalClass}"></span>`; 5830 } 5831 } 5832 if (params.type === 'progressbar') { 5833 if (params.renderProgressbar) { 5834 paginationHTML = params.renderProgressbar.call(swiper, params.progressbarFillClass); 5835 } else { 5836 paginationHTML = `<span class="${params.progressbarFillClass}"></span>`; 5837 } 5838 } 5839 swiper.pagination.bullets = []; 5840 el.forEach(subEl => { 5841 if (params.type !== 'custom') { 5842 subEl.innerHTML = paginationHTML || ''; 5843 } 5844 if (params.type === 'bullets') { 5845 swiper.pagination.bullets.push(...subEl.querySelectorAll(classesToSelector(params.bulletClass))); 5846 } 5847 }); 5848 if (params.type !== 'custom') { 5849 emit('paginationRender', el[0]); 5850 } 5851 } 5852 function init() { 5853 swiper.params.pagination = createElementIfNotDefined(swiper, swiper.originalParams.pagination, swiper.params.pagination, { 5854 el: 'swiper-pagination' 5855 }); 5856 const params = swiper.params.pagination; 5857 if (!params.el) return; 5858 let el; 5859 if (typeof params.el === 'string' && swiper.isElement) { 5860 el = swiper.el.querySelector(params.el); 5861 } 5862 if (!el && typeof params.el === 'string') { 5863 el = [...document.querySelectorAll(params.el)]; 5864 } 5865 if (!el) { 5866 el = params.el; 5867 } 5868 if (!el || el.length === 0) return; 5869 if (swiper.params.uniqueNavElements && typeof params.el === 'string' && Array.isArray(el) && el.length > 1) { 5870 el = [...swiper.el.querySelectorAll(params.el)]; 5871 // check if it belongs to another nested Swiper 5872 if (el.length > 1) { 5873 el = el.find(subEl => { 5874 if (elementParents(subEl, '.swiper')[0] !== swiper.el) return false; 5875 return true; 5876 }); 5877 } 5878 } 5879 if (Array.isArray(el) && el.length === 1) el = el[0]; 5880 Object.assign(swiper.pagination, { 5881 el 5882 }); 5883 el = makeElementsArray(el); 5884 el.forEach(subEl => { 5885 if (params.type === 'bullets' && params.clickable) { 5886 subEl.classList.add(...(params.clickableClass || '').split(' ')); 5887 } 5888 subEl.classList.add(params.modifierClass + params.type); 5889 subEl.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass); 5890 if (params.type === 'bullets' && params.dynamicBullets) { 5891 subEl.classList.add(`${params.modifierClass}${params.type}-dynamic`); 5892 dynamicBulletIndex = 0; 5893 if (params.dynamicMainBullets < 1) { 5894 params.dynamicMainBullets = 1; 5895 } 5896 } 5897 if (params.type === 'progressbar' && params.progressbarOpposite) { 5898 subEl.classList.add(params.progressbarOppositeClass); 5899 } 5900 if (params.clickable) { 5901 subEl.addEventListener('click', onBulletClick); 5902 } 5903 if (!swiper.enabled) { 5904 subEl.classList.add(params.lockClass); 5905 } 5906 }); 5907 } 5908 function destroy() { 5909 const params = swiper.params.pagination; 5910 if (isPaginationDisabled()) return; 5911 let el = swiper.pagination.el; 5912 if (el) { 5913 el = makeElementsArray(el); 5914 el.forEach(subEl => { 5915 subEl.classList.remove(params.hiddenClass); 5916 subEl.classList.remove(params.modifierClass + params.type); 5917 subEl.classList.remove(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass); 5918 if (params.clickable) { 5919 subEl.classList.remove(...(params.clickableClass || '').split(' ')); 5920 subEl.removeEventListener('click', onBulletClick); 5921 } 5922 }); 5923 } 5924 if (swiper.pagination.bullets) swiper.pagination.bullets.forEach(subEl => subEl.classList.remove(...params.bulletActiveClass.split(' '))); 5925 } 5926 on('changeDirection', () => { 5927 if (!swiper.pagination || !swiper.pagination.el) return; 5928 const params = swiper.params.pagination; 5929 let { 5930 el 5931 } = swiper.pagination; 5932 el = makeElementsArray(el); 5933 el.forEach(subEl => { 5934 subEl.classList.remove(params.horizontalClass, params.verticalClass); 5935 subEl.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass); 5936 }); 5937 }); 5938 on('init', () => { 5939 if (swiper.params.pagination.enabled === false) { 5940 // eslint-disable-next-line 5941 disable(); 5942 } else { 5943 init(); 5944 render(); 5945 update(); 5946 } 5947 }); 5948 on('activeIndexChange', () => { 5949 if (typeof swiper.snapIndex === 'undefined') { 5950 update(); 5951 } 5952 }); 5953 on('snapIndexChange', () => { 5954 update(); 5955 }); 5956 on('snapGridLengthChange', () => { 5957 render(); 5958 update(); 5959 }); 5960 on('destroy', () => { 5961 destroy(); 5962 }); 5963 on('enable disable', () => { 5964 let { 5965 el 5966 } = swiper.pagination; 5967 if (el) { 5968 el = makeElementsArray(el); 5969 el.forEach(subEl => subEl.classList[swiper.enabled ? 'remove' : 'add'](swiper.params.pagination.lockClass)); 5970 } 5971 }); 5972 on('lock unlock', () => { 5973 update(); 5974 }); 5975 on('click', (_s, e) => { 5976 const targetEl = e.target; 5977 const el = makeElementsArray(swiper.pagination.el); 5978 if (swiper.params.pagination.el && swiper.params.pagination.hideOnClick && el && el.length > 0 && !targetEl.classList.contains(swiper.params.pagination.bulletClass)) { 5979 if (swiper.navigation && (swiper.navigation.nextEl && targetEl === swiper.navigation.nextEl || swiper.navigation.prevEl && targetEl === swiper.navigation.prevEl)) return; 5980 const isHidden = el[0].classList.contains(swiper.params.pagination.hiddenClass); 5981 if (isHidden === true) { 5982 emit('paginationShow'); 5983 } else { 5984 emit('paginationHide'); 5985 } 5986 el.forEach(subEl => subEl.classList.toggle(swiper.params.pagination.hiddenClass)); 5987 } 5988 }); 5989 const enable = () => { 5990 swiper.el.classList.remove(swiper.params.pagination.paginationDisabledClass); 5991 let { 5992 el 5993 } = swiper.pagination; 5994 if (el) { 5995 el = makeElementsArray(el); 5996 el.forEach(subEl => subEl.classList.remove(swiper.params.pagination.paginationDisabledClass)); 5997 } 5998 init(); 5999 render(); 6000 update(); 6001 }; 6002 const disable = () => { 6003 swiper.el.classList.add(swiper.params.pagination.paginationDisabledClass); 6004 let { 6005 el 6006 } = swiper.pagination; 6007 if (el) { 6008 el = makeElementsArray(el); 6009 el.forEach(subEl => subEl.classList.add(swiper.params.pagination.paginationDisabledClass)); 6010 } 6011 destroy(); 6012 }; 6013 Object.assign(swiper.pagination, { 6014 enable, 6015 disable, 6016 render, 6017 update, 6018 init, 6019 destroy 6020 }); 6021} 6022 6023 6024 6025;// ./node_modules/swiper/modules/scrollbar.mjs 6026 6027 6028 6029 6030 6031function Scrollbar(_ref) { 6032 let { 6033 swiper, 6034 extendParams, 6035 on, 6036 emit 6037 } = _ref; 6038 const document = getDocument(); 6039 let isTouched = false;
vendor: 4,705 bytes, lines 6040-6192
6040 let timeout = null; 6041 let dragTimeout = null; 6042 let dragStartPos; 6043 let dragSize; 6044 let trackSize; 6045 let divider; 6046 extendParams({ 6047 scrollbar: { 6048 el: null, 6049 dragSize: 'auto', 6050 hide: false, 6051 draggable: false, 6052 snapOnRelease: true, 6053 lockClass: 'swiper-scrollbar-lock', 6054 dragClass: 'swiper-scrollbar-drag', 6055 scrollbarDisabledClass: 'swiper-scrollbar-disabled', 6056 horizontalClass: `swiper-scrollbar-horizontal`, 6057 verticalClass: `swiper-scrollbar-vertical` 6058 } 6059 }); 6060 swiper.scrollbar = { 6061 el: null, 6062 dragEl: null 6063 }; 6064 function setTranslate() { 6065 if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; 6066 const { 6067 scrollbar, 6068 rtlTranslate: rtl 6069 } = swiper; 6070 const { 6071 dragEl, 6072 el 6073 } = scrollbar; 6074 const params = swiper.params.scrollbar; 6075 const progress = swiper.params.loop ? swiper.progressLoop : swiper.progress; 6076 let newSize = dragSize; 6077 let newPos = (trackSize - dragSize) * progress; 6078 if (rtl) { 6079 newPos = -newPos; 6080 if (newPos > 0) { 6081 newSize = dragSize - newPos; 6082 newPos = 0; 6083 } else if (-newPos + dragSize > trackSize) { 6084 newSize = trackSize + newPos; 6085 } 6086 } else if (newPos < 0) { 6087 newSize = dragSize + newPos; 6088 newPos = 0; 6089 } else if (newPos + dragSize > trackSize) { 6090 newSize = trackSize - newPos; 6091 } 6092 if (swiper.isHorizontal()) { 6093 dragEl.style.transform = `translate3d(${newPos}px, 0, 0)`; 6094 dragEl.style.width = `${newSize}px`; 6095 } else { 6096 dragEl.style.transform = `translate3d(0px, ${newPos}px, 0)`; 6097 dragEl.style.height = `${newSize}px`; 6098 } 6099 if (params.hide) { 6100 clearTimeout(timeout); 6101 el.style.opacity = 1; 6102 timeout = setTimeout(() => { 6103 el.style.opacity = 0; 6104 el.style.transitionDuration = '400ms'; 6105 }, 1000); 6106 } 6107 } 6108 function setTransition(duration) { 6109 if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; 6110 swiper.scrollbar.dragEl.style.transitionDuration = `${duration}ms`; 6111 } 6112 function updateSize() { 6113 if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; 6114 const { 6115 scrollbar 6116 } = swiper; 6117 const { 6118 dragEl, 6119 el 6120 } = scrollbar; 6121 dragEl.style.width = ''; 6122 dragEl.style.height = ''; 6123 trackSize = swiper.isHorizontal() ? el.offsetWidth : el.offsetHeight; 6124 divider = swiper.size / (swiper.virtualSize + swiper.params.slidesOffsetBefore - (swiper.params.centeredSlides ? swiper.snapGrid[0] : 0)); 6125 if (swiper.params.scrollbar.dragSize === 'auto') { 6126 dragSize = trackSize * divider; 6127 } else { 6128 dragSize = parseInt(swiper.params.scrollbar.dragSize, 10); 6129 } 6130 if (swiper.isHorizontal()) { 6131 dragEl.style.width = `${dragSize}px`; 6132 } else { 6133 dragEl.style.height = `${dragSize}px`; 6134 } 6135 if (divider >= 1) { 6136 el.style.display = 'none'; 6137 } else { 6138 el.style.display = ''; 6139 } 6140 if (swiper.params.scrollbar.hide) { 6141 el.style.opacity = 0; 6142 } 6143 if (swiper.params.watchOverflow && swiper.enabled) { 6144 scrollbar.el.classList[swiper.isLocked ? 'add' : 'remove'](swiper.params.scrollbar.lockClass); 6145 } 6146 } 6147 function getPointerPosition(e) { 6148 return swiper.isHorizontal() ? e.clientX : e.clientY; 6149 } 6150 function setDragPosition(e) { 6151 const { 6152 scrollbar, 6153 rtlTranslate: rtl 6154 } = swiper; 6155 const { 6156 el 6157 } = scrollbar; 6158 let positionRatio; 6159 positionRatio = (getPointerPosition(e) - elementOffset(el)[swiper.isHorizontal() ? 'left' : 'top'] - (dragStartPos !== null ? dragStartPos : dragSize / 2)) / (trackSize - dragSize); 6160 positionRatio = Math.max(Math.min(positionRatio, 1), 0); 6161 if (rtl) { 6162 positionRatio = 1 - positionRatio; 6163 } 6164 const position = swiper.minTranslate() + (swiper.maxTranslate() - swiper.minTranslate()) * positionRatio; 6165 swiper.updateProgress(position); 6166 swiper.setTranslate(position); 6167 swiper.updateActiveIndex(); 6168 swiper.updateSlidesClasses(); 6169 } 6170 function onDragStart(e) { 6171 const params = swiper.params.scrollbar; 6172 const { 6173 scrollbar, 6174 wrapperEl 6175 } = swiper; 6176 const { 6177 el, 6178 dragEl 6179 } = scrollbar; 6180 isTouched = true; 6181 dragStartPos = e.target === dragEl ? getPointerPosition(e) - e.target.getBoundingClientRect()[swiper.isHorizontal() ? 'left' : 'top'] : null; 6182 e.preventDefault(); 6183 e.stopPropagation(); 6184 wrapperEl.style.transitionDuration = '100ms'; 6185 dragEl.style.transitionDuration = '100ms'; 6186 setDragPosition(e); 6187 clearTimeout(dragTimeout); 6188 el.style.transitionDuration = '0ms'; 6189 if (params.hide) { 6190 el.style.opacity = 1; 6191 } 6192 if (swiper.params.cssMode) {
vendor: 62,590 bytes, lines 6193-8079
6193 swiper.wrapperEl.style['scroll-snap-type'] = 'none'; 6194 } 6195 emit('scrollbarDragStart', e); 6196 } 6197 function onDragMove(e) { 6198 const { 6199 scrollbar, 6200 wrapperEl 6201 } = swiper; 6202 const { 6203 el, 6204 dragEl 6205 } = scrollbar; 6206 if (!isTouched) return; 6207 if (e.preventDefault && e.cancelable) e.preventDefault();else e.returnValue = false; 6208 setDragPosition(e); 6209 wrapperEl.style.transitionDuration = '0ms'; 6210 el.style.transitionDuration = '0ms'; 6211 dragEl.style.transitionDuration = '0ms'; 6212 emit('scrollbarDragMove', e); 6213 } 6214 function onDragEnd(e) { 6215 const params = swiper.params.scrollbar; 6216 const { 6217 scrollbar, 6218 wrapperEl 6219 } = swiper; 6220 const { 6221 el 6222 } = scrollbar; 6223 if (!isTouched) return; 6224 isTouched = false; 6225 if (swiper.params.cssMode) { 6226 swiper.wrapperEl.style['scroll-snap-type'] = ''; 6227 wrapperEl.style.transitionDuration = ''; 6228 } 6229 if (params.hide) { 6230 clearTimeout(dragTimeout); 6231 dragTimeout = nextTick(() => { 6232 el.style.opacity = 0; 6233 el.style.transitionDuration = '400ms'; 6234 }, 1000); 6235 } 6236 emit('scrollbarDragEnd', e); 6237 if (params.snapOnRelease) { 6238 swiper.slideToClosest(); 6239 } 6240 } 6241 function events(method) { 6242 const { 6243 scrollbar, 6244 params 6245 } = swiper; 6246 const el = scrollbar.el; 6247 if (!el) return; 6248 const target = el; 6249 const activeListener = params.passiveListeners ? { 6250 passive: false, 6251 capture: false 6252 } : false; 6253 const passiveListener = params.passiveListeners ? { 6254 passive: true, 6255 capture: false 6256 } : false; 6257 if (!target) return; 6258 const eventMethod = method === 'on' ? 'addEventListener' : 'removeEventListener'; 6259 target[eventMethod]('pointerdown', onDragStart, activeListener); 6260 document[eventMethod]('pointermove', onDragMove, activeListener); 6261 document[eventMethod]('pointerup', onDragEnd, passiveListener); 6262 } 6263 function enableDraggable() { 6264 if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; 6265 events('on'); 6266 } 6267 function disableDraggable() { 6268 if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; 6269 events('off'); 6270 } 6271 function init() { 6272 const { 6273 scrollbar, 6274 el: swiperEl 6275 } = swiper; 6276 swiper.params.scrollbar = createElementIfNotDefined(swiper, swiper.originalParams.scrollbar, swiper.params.scrollbar, { 6277 el: 'swiper-scrollbar' 6278 }); 6279 const params = swiper.params.scrollbar; 6280 if (!params.el) return; 6281 let el; 6282 if (typeof params.el === 'string' && swiper.isElement) { 6283 el = swiper.el.querySelector(params.el); 6284 } 6285 if (!el && typeof params.el === 'string') { 6286 el = document.querySelectorAll(params.el); 6287 if (!el.length) return; 6288 } else if (!el) { 6289 el = params.el; 6290 } 6291 if (swiper.params.uniqueNavElements && typeof params.el === 'string' && el.length > 1 && swiperEl.querySelectorAll(params.el).length === 1) { 6292 el = swiperEl.querySelector(params.el); 6293 } 6294 if (el.length > 0) el = el[0]; 6295 el.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass); 6296 let dragEl; 6297 if (el) { 6298 dragEl = el.querySelector(classesToSelector(swiper.params.scrollbar.dragClass)); 6299 if (!dragEl) { 6300 dragEl = createElement('div', swiper.params.scrollbar.dragClass); 6301 el.append(dragEl); 6302 } 6303 } 6304 Object.assign(scrollbar, { 6305 el, 6306 dragEl 6307 }); 6308 if (params.draggable) { 6309 enableDraggable(); 6310 } 6311 if (el) { 6312 el.classList[swiper.enabled ? 'remove' : 'add'](...classesToTokens(swiper.params.scrollbar.lockClass)); 6313 } 6314 } 6315 function destroy() { 6316 const params = swiper.params.scrollbar; 6317 const el = swiper.scrollbar.el; 6318 if (el) { 6319 el.classList.remove(...classesToTokens(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass)); 6320 } 6321 disableDraggable(); 6322 } 6323 on('changeDirection', () => { 6324 if (!swiper.scrollbar || !swiper.scrollbar.el) return; 6325 const params = swiper.params.scrollbar; 6326 let { 6327 el 6328 } = swiper.scrollbar; 6329 el = makeElementsArray(el); 6330 el.forEach(subEl => { 6331 subEl.classList.remove(params.horizontalClass, params.verticalClass); 6332 subEl.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass); 6333 }); 6334 }); 6335 on('init', () => { 6336 if (swiper.params.scrollbar.enabled === false) { 6337 // eslint-disable-next-line 6338 disable(); 6339 } else { 6340 init(); 6341 updateSize(); 6342 setTranslate(); 6343 } 6344 }); 6345 on('update resize observerUpdate lock unlock changeDirection', () => { 6346 updateSize(); 6347 }); 6348 on('setTranslate', () => { 6349 setTranslate(); 6350 }); 6351 on('setTransition', (_s, duration) => { 6352 setTransition(duration); 6353 }); 6354 on('enable disable', () => { 6355 const { 6356 el 6357 } = swiper.scrollbar; 6358 if (el) { 6359 el.classList[swiper.enabled ? 'remove' : 'add'](...classesToTokens(swiper.params.scrollbar.lockClass)); 6360 } 6361 }); 6362 on('destroy', () => { 6363 destroy(); 6364 }); 6365 const enable = () => { 6366 swiper.el.classList.remove(...classesToTokens(swiper.params.scrollbar.scrollbarDisabledClass)); 6367 if (swiper.scrollbar.el) { 6368 swiper.scrollbar.el.classList.remove(...classesToTokens(swiper.params.scrollbar.scrollbarDisabledClass)); 6369 } 6370 init(); 6371 updateSize(); 6372 setTranslate(); 6373 }; 6374 const disable = () => { 6375 swiper.el.classList.add(...classesToTokens(swiper.params.scrollbar.scrollbarDisabledClass)); 6376 if (swiper.scrollbar.el) { 6377 swiper.scrollbar.el.classList.add(...classesToTokens(swiper.params.scrollbar.scrollbarDisabledClass)); 6378 } 6379 destroy(); 6380 }; 6381 Object.assign(swiper.scrollbar, { 6382 enable, 6383 disable, 6384 updateSize, 6385 setTranslate, 6386 init, 6387 destroy 6388 }); 6389} 6390 6391 6392 6393;// ./node_modules/swiper/modules/parallax.mjs 6394 6395 6396function Parallax(_ref) { 6397 let { 6398 swiper, 6399 extendParams, 6400 on 6401 } = _ref; 6402 extendParams({ 6403 parallax: { 6404 enabled: false 6405 } 6406 }); 6407 const elementsSelector = '[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]'; 6408 const setTransform = (el, progress) => { 6409 const { 6410 rtl 6411 } = swiper; 6412 const rtlFactor = rtl ? -1 : 1; 6413 const p = el.getAttribute('data-swiper-parallax') || '0'; 6414 let x = el.getAttribute('data-swiper-parallax-x'); 6415 let y = el.getAttribute('data-swiper-parallax-y'); 6416 const scale = el.getAttribute('data-swiper-parallax-scale'); 6417 const opacity = el.getAttribute('data-swiper-parallax-opacity'); 6418 const rotate = el.getAttribute('data-swiper-parallax-rotate'); 6419 if (x || y) { 6420 x = x || '0'; 6421 y = y || '0'; 6422 } else if (swiper.isHorizontal()) { 6423 x = p; 6424 y = '0'; 6425 } else { 6426 y = p; 6427 x = '0'; 6428 } 6429 if (x.indexOf('%') >= 0) { 6430 x = `${parseInt(x, 10) * progress * rtlFactor}%`; 6431 } else { 6432 x = `${x * progress * rtlFactor}px`; 6433 } 6434 if (y.indexOf('%') >= 0) { 6435 y = `${parseInt(y, 10) * progress}%`; 6436 } else { 6437 y = `${y * progress}px`; 6438 } 6439 if (typeof opacity !== 'undefined' && opacity !== null) { 6440 const currentOpacity = opacity - (opacity - 1) * (1 - Math.abs(progress)); 6441 el.style.opacity = currentOpacity; 6442 } 6443 let transform = `translate3d(${x}, ${y}, 0px)`; 6444 if (typeof scale !== 'undefined' && scale !== null) { 6445 const currentScale = scale - (scale - 1) * (1 - Math.abs(progress)); 6446 transform += ` scale(${currentScale})`; 6447 } 6448 if (rotate && typeof rotate !== 'undefined' && rotate !== null) { 6449 const currentRotate = rotate * progress * -1; 6450 transform += ` rotate(${currentRotate}deg)`; 6451 } 6452 el.style.transform = transform; 6453 }; 6454 const setTranslate = () => { 6455 const { 6456 el, 6457 slides, 6458 progress, 6459 snapGrid, 6460 isElement 6461 } = swiper; 6462 const elements = elementChildren(el, elementsSelector); 6463 if (swiper.isElement) { 6464 elements.push(...elementChildren(swiper.hostEl, elementsSelector)); 6465 } 6466 elements.forEach(subEl => { 6467 setTransform(subEl, progress); 6468 }); 6469 slides.forEach((slideEl, slideIndex) => { 6470 let slideProgress = slideEl.progress; 6471 if (swiper.params.slidesPerGroup > 1 && swiper.params.slidesPerView !== 'auto') { 6472 slideProgress += Math.ceil(slideIndex / 2) - progress * (snapGrid.length - 1); 6473 } 6474 slideProgress = Math.min(Math.max(slideProgress, -1), 1); 6475 slideEl.querySelectorAll(`${elementsSelector}, [data-swiper-parallax-rotate]`).forEach(subEl => { 6476 setTransform(subEl, slideProgress); 6477 }); 6478 }); 6479 }; 6480 const setTransition = function (duration) { 6481 if (duration === void 0) { 6482 duration = swiper.params.speed; 6483 } 6484 const { 6485 el, 6486 hostEl 6487 } = swiper; 6488 const elements = [...el.querySelectorAll(elementsSelector)]; 6489 if (swiper.isElement) { 6490 elements.push(...hostEl.querySelectorAll(elementsSelector)); 6491 } 6492 elements.forEach(parallaxEl => { 6493 let parallaxDuration = parseInt(parallaxEl.getAttribute('data-swiper-parallax-duration'), 10) || duration; 6494 if (duration === 0) parallaxDuration = 0; 6495 parallaxEl.style.transitionDuration = `${parallaxDuration}ms`; 6496 }); 6497 }; 6498 on('beforeInit', () => { 6499 if (!swiper.params.parallax.enabled) return; 6500 swiper.params.watchSlidesProgress = true; 6501 swiper.originalParams.watchSlidesProgress = true; 6502 }); 6503 on('init', () => { 6504 if (!swiper.params.parallax.enabled) return; 6505 setTranslate(); 6506 }); 6507 on('setTranslate', () => { 6508 if (!swiper.params.parallax.enabled) return; 6509 setTranslate(); 6510 }); 6511 on('setTransition', (_swiper, duration) => { 6512 if (!swiper.params.parallax.enabled) return; 6513 setTransition(duration); 6514 }); 6515} 6516 6517 6518 6519;// ./node_modules/swiper/modules/zoom.mjs 6520 6521 6522 6523function Zoom(_ref) { 6524 let { 6525 swiper, 6526 extendParams, 6527 on, 6528 emit 6529 } = _ref; 6530 const window = getWindow(); 6531 extendParams({ 6532 zoom: { 6533 enabled: false, 6534 limitToOriginalSize: false, 6535 maxRatio: 3, 6536 minRatio: 1, 6537 panOnMouseMove: false, 6538 toggle: true, 6539 containerClass: 'swiper-zoom-container', 6540 zoomedSlideClass: 'swiper-slide-zoomed' 6541 } 6542 }); 6543 swiper.zoom = { 6544 enabled: false 6545 }; 6546 let currentScale = 1; 6547 let isScaling = false; 6548 let isPanningWithMouse = false; 6549 let mousePanStart = { 6550 x: 0, 6551 y: 0 6552 }; 6553 const mousePanSensitivity = -3; // Negative to invert pan direction 6554 let fakeGestureTouched; 6555 let fakeGestureMoved; 6556 const evCache = []; 6557 const gesture = { 6558 originX: 0, 6559 originY: 0, 6560 slideEl: undefined, 6561 slideWidth: undefined, 6562 slideHeight: undefined, 6563 imageEl: undefined, 6564 imageWrapEl: undefined, 6565 maxRatio: 3 6566 }; 6567 const image = { 6568 isTouched: undefined, 6569 isMoved: undefined, 6570 currentX: undefined, 6571 currentY: undefined, 6572 minX: undefined, 6573 minY: undefined, 6574 maxX: undefined, 6575 maxY: undefined, 6576 width: undefined, 6577 height: undefined, 6578 startX: undefined, 6579 startY: undefined, 6580 touchesStart: {}, 6581 touchesCurrent: {} 6582 }; 6583 const velocity = { 6584 x: undefined, 6585 y: undefined, 6586 prevPositionX: undefined, 6587 prevPositionY: undefined, 6588 prevTime: undefined 6589 }; 6590 let scale = 1; 6591 Object.defineProperty(swiper.zoom, 'scale', { 6592 get() { 6593 return scale; 6594 }, 6595 set(value) { 6596 if (scale !== value) { 6597 const imageEl = gesture.imageEl; 6598 const slideEl = gesture.slideEl; 6599 emit('zoomChange', value, imageEl, slideEl); 6600 } 6601 scale = value; 6602 } 6603 }); 6604 function getDistanceBetweenTouches() { 6605 if (evCache.length < 2) return 1; 6606 const x1 = evCache[0].pageX; 6607 const y1 = evCache[0].pageY; 6608 const x2 = evCache[1].pageX; 6609 const y2 = evCache[1].pageY; 6610 const distance = Math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2); 6611 return distance; 6612 } 6613 function getMaxRatio() { 6614 const params = swiper.params.zoom; 6615 const maxRatio = gesture.imageWrapEl.getAttribute('data-swiper-zoom') || params.maxRatio; 6616 if (params.limitToOriginalSize && gesture.imageEl && gesture.imageEl.naturalWidth) { 6617 const imageMaxRatio = gesture.imageEl.naturalWidth / gesture.imageEl.offsetWidth; 6618 return Math.min(imageMaxRatio, maxRatio); 6619 } 6620 return maxRatio; 6621 } 6622 function getScaleOrigin() { 6623 if (evCache.length < 2) return { 6624 x: null, 6625 y: null 6626 }; 6627 const box = gesture.imageEl.getBoundingClientRect(); 6628 return [(evCache[0].pageX + (evCache[1].pageX - evCache[0].pageX) / 2 - box.x - window.scrollX) / currentScale, (evCache[0].pageY + (evCache[1].pageY - evCache[0].pageY) / 2 - box.y - window.scrollY) / currentScale]; 6629 } 6630 function getSlideSelector() { 6631 return swiper.isElement ? `swiper-slide` : `.${swiper.params.slideClass}`; 6632 } 6633 function eventWithinSlide(e) { 6634 const slideSelector = getSlideSelector(); 6635 if (e.target.matches(slideSelector)) return true; 6636 if (swiper.slides.filter(slideEl => slideEl.contains(e.target)).length > 0) return true; 6637 return false; 6638 } 6639 function eventWithinZoomContainer(e) { 6640 const selector = `.${swiper.params.zoom.containerClass}`; 6641 if (e.target.matches(selector)) return true; 6642 if ([...swiper.hostEl.querySelectorAll(selector)].filter(containerEl => containerEl.contains(e.target)).length > 0) return true; 6643 return false; 6644 } 6645 6646 // Events 6647 function onGestureStart(e) { 6648 if (e.pointerType === 'mouse') { 6649 evCache.splice(0, evCache.length); 6650 } 6651 if (!eventWithinSlide(e)) return; 6652 const params = swiper.params.zoom; 6653 fakeGestureTouched = false; 6654 fakeGestureMoved = false; 6655 evCache.push(e); 6656 if (evCache.length < 2) { 6657 return; 6658 } 6659 fakeGestureTouched = true; 6660 gesture.scaleStart = getDistanceBetweenTouches(); 6661 if (!gesture.slideEl) { 6662 gesture.slideEl = e.target.closest(`.${swiper.params.slideClass}, swiper-slide`); 6663 if (!gesture.slideEl) gesture.slideEl = swiper.slides[swiper.activeIndex]; 6664 let imageEl = gesture.slideEl.querySelector(`.${params.containerClass}`); 6665 if (imageEl) { 6666 imageEl = imageEl.querySelectorAll('picture, img, svg, canvas, .swiper-zoom-target')[0]; 6667 } 6668 gesture.imageEl = imageEl; 6669 if (imageEl) { 6670 gesture.imageWrapEl = elementParents(gesture.imageEl, `.${params.containerClass}`)[0]; 6671 } else { 6672 gesture.imageWrapEl = undefined; 6673 } 6674 if (!gesture.imageWrapEl) { 6675 gesture.imageEl = undefined; 6676 return; 6677 } 6678 gesture.maxRatio = getMaxRatio(); 6679 } 6680 if (gesture.imageEl) { 6681 const [originX, originY] = getScaleOrigin(); 6682 gesture.originX = originX; 6683 gesture.originY = originY; 6684 gesture.imageEl.style.transitionDuration = '0ms'; 6685 } 6686 isScaling = true; 6687 } 6688 function onGestureChange(e) { 6689 if (!eventWithinSlide(e)) return; 6690 const params = swiper.params.zoom; 6691 const zoom = swiper.zoom; 6692 const pointerIndex = evCache.findIndex(cachedEv => cachedEv.pointerId === e.pointerId); 6693 if (pointerIndex >= 0) evCache[pointerIndex] = e; 6694 if (evCache.length < 2) { 6695 return; 6696 } 6697 fakeGestureMoved = true; 6698 gesture.scaleMove = getDistanceBetweenTouches(); 6699 if (!gesture.imageEl) { 6700 return; 6701 } 6702 zoom.scale = gesture.scaleMove / gesture.scaleStart * currentScale; 6703 if (zoom.scale > gesture.maxRatio) { 6704 zoom.scale = gesture.maxRatio - 1 + (zoom.scale - gesture.maxRatio + 1) ** 0.5; 6705 } 6706 if (zoom.scale < params.minRatio) { 6707 zoom.scale = params.minRatio + 1 - (params.minRatio - zoom.scale + 1) ** 0.5; 6708 } 6709 gesture.imageEl.style.transform = `translate3d(0,0,0) scale(${zoom.scale})`; 6710 } 6711 function onGestureEnd(e) { 6712 if (!eventWithinSlide(e)) return; 6713 if (e.pointerType === 'mouse' && e.type === 'pointerout') return; 6714 const params = swiper.params.zoom; 6715 const zoom = swiper.zoom; 6716 const pointerIndex = evCache.findIndex(cachedEv => cachedEv.pointerId === e.pointerId); 6717 if (pointerIndex >= 0) evCache.splice(pointerIndex, 1); 6718 if (!fakeGestureTouched || !fakeGestureMoved) { 6719 return; 6720 } 6721 fakeGestureTouched = false; 6722 fakeGestureMoved = false; 6723 if (!gesture.imageEl) return; 6724 zoom.scale = Math.max(Math.min(zoom.scale, gesture.maxRatio), params.minRatio); 6725 gesture.imageEl.style.transitionDuration = `${swiper.params.speed}ms`; 6726 gesture.imageEl.style.transform = `translate3d(0,0,0) scale(${zoom.scale})`; 6727 currentScale = zoom.scale; 6728 isScaling = false; 6729 if (zoom.scale > 1 && gesture.slideEl) { 6730 gesture.slideEl.classList.add(`${params.zoomedSlideClass}`); 6731 } else if (zoom.scale <= 1 && gesture.slideEl) { 6732 gesture.slideEl.classList.remove(`${params.zoomedSlideClass}`); 6733 } 6734 if (zoom.scale === 1) { 6735 gesture.originX = 0; 6736 gesture.originY = 0; 6737 gesture.slideEl = undefined; 6738 } 6739 } 6740 let allowTouchMoveTimeout; 6741 function allowTouchMove() { 6742 swiper.touchEventsData.preventTouchMoveFromPointerMove = false; 6743 } 6744 function preventTouchMove() { 6745 clearTimeout(allowTouchMoveTimeout); 6746 swiper.touchEventsData.preventTouchMoveFromPointerMove = true; 6747 allowTouchMoveTimeout = setTimeout(() => { 6748 if (swiper.destroyed) return; 6749 allowTouchMove(); 6750 }); 6751 } 6752 function onTouchStart(e) { 6753 const device = swiper.device; 6754 if (!gesture.imageEl) return; 6755 if (image.isTouched) return; 6756 if (device.android && e.cancelable) e.preventDefault(); 6757 image.isTouched = true; 6758 const event = evCache.length > 0 ? evCache[0] : e; 6759 image.touchesStart.x = event.pageX; 6760 image.touchesStart.y = event.pageY; 6761 } 6762 function onTouchMove(e) { 6763 const isMouseEvent = e.pointerType === 'mouse'; 6764 const isMousePan = isMouseEvent && swiper.params.zoom.panOnMouseMove; 6765 if (!eventWithinSlide(e) || !eventWithinZoomContainer(e)) { 6766 return; 6767 } 6768 const zoom = swiper.zoom; 6769 if (!gesture.imageEl) { 6770 return; 6771 } 6772 if (!image.isTouched || !gesture.slideEl) { 6773 if (isMousePan) onMouseMove(e); 6774 return; 6775 } 6776 if (isMousePan) { 6777 onMouseMove(e); 6778 return; 6779 } 6780 if (!image.isMoved) { 6781 image.width = gesture.imageEl.offsetWidth || gesture.imageEl.clientWidth; 6782 image.height = gesture.imageEl.offsetHeight || gesture.imageEl.clientHeight; 6783 image.startX = getTranslate(gesture.imageWrapEl, 'x') || 0; 6784 image.startY = getTranslate(gesture.imageWrapEl, 'y') || 0; 6785 gesture.slideWidth = gesture.slideEl.offsetWidth; 6786 gesture.slideHeight = gesture.slideEl.offsetHeight; 6787 gesture.imageWrapEl.style.transitionDuration = '0ms'; 6788 } 6789 // Define if we need image drag 6790 const scaledWidth = image.width * zoom.scale; 6791 const scaledHeight = image.height * zoom.scale; 6792 image.minX = Math.min(gesture.slideWidth / 2 - scaledWidth / 2, 0); 6793 image.maxX = -image.minX; 6794 image.minY = Math.min(gesture.slideHeight / 2 - scaledHeight / 2, 0); 6795 image.maxY = -image.minY; 6796 image.touchesCurrent.x = evCache.length > 0 ? evCache[0].pageX : e.pageX; 6797 image.touchesCurrent.y = evCache.length > 0 ? evCache[0].pageY : e.pageY; 6798 const touchesDiff = Math.max(Math.abs(image.touchesCurrent.x - image.touchesStart.x), Math.abs(image.touchesCurrent.y - image.touchesStart.y)); 6799 if (touchesDiff > 5) { 6800 swiper.allowClick = false; 6801 } 6802 if (!image.isMoved && !isScaling) { 6803 if (swiper.isHorizontal() && (Math.floor(image.minX) === Math.floor(image.startX) && image.touchesCurrent.x < image.touchesStart.x || Math.floor(image.maxX) === Math.floor(image.startX) && image.touchesCurrent.x > image.touchesStart.x)) { 6804 image.isTouched = false; 6805 allowTouchMove(); 6806 return; 6807 } 6808 if (!swiper.isHorizontal() && (Math.floor(image.minY) === Math.floor(image.startY) && image.touchesCurrent.y < image.touchesStart.y || Math.floor(image.maxY) === Math.floor(image.startY) && image.touchesCurrent.y > image.touchesStart.y)) { 6809 image.isTouched = false; 6810 allowTouchMove(); 6811 return; 6812 } 6813 } 6814 if (e.cancelable) { 6815 e.preventDefault(); 6816 } 6817 e.stopPropagation(); 6818 preventTouchMove(); 6819 image.isMoved = true; 6820 const scaleRatio = (zoom.scale - currentScale) / (gesture.maxRatio - swiper.params.zoom.minRatio); 6821 const { 6822 originX, 6823 originY 6824 } = gesture; 6825 image.currentX = image.touchesCurrent.x - image.touchesStart.x + image.startX + scaleRatio * (image.width - originX * 2); 6826 image.currentY = image.touchesCurrent.y - image.touchesStart.y + image.startY + scaleRatio * (image.height - originY * 2); 6827 if (image.currentX < image.minX) { 6828 image.currentX = image.minX + 1 - (image.minX - image.currentX + 1) ** 0.8; 6829 } 6830 if (image.currentX > image.maxX) { 6831 image.currentX = image.maxX - 1 + (image.currentX - image.maxX + 1) ** 0.8; 6832 } 6833 if (image.currentY < image.minY) { 6834 image.currentY = image.minY + 1 - (image.minY - image.currentY + 1) ** 0.8; 6835 } 6836 if (image.currentY > image.maxY) { 6837 image.currentY = image.maxY - 1 + (image.currentY - image.maxY + 1) ** 0.8; 6838 } 6839 6840 // Velocity 6841 if (!velocity.prevPositionX) velocity.prevPositionX = image.touchesCurrent.x; 6842 if (!velocity.prevPositionY) velocity.prevPositionY = image.touchesCurrent.y; 6843 if (!velocity.prevTime) velocity.prevTime = Date.now(); 6844 velocity.x = (image.touchesCurrent.x - velocity.prevPositionX) / (Date.now() - velocity.prevTime) / 2; 6845 velocity.y = (image.touchesCurrent.y - velocity.prevPositionY) / (Date.now() - velocity.prevTime) / 2; 6846 if (Math.abs(image.touchesCurrent.x - velocity.prevPositionX) < 2) velocity.x = 0; 6847 if (Math.abs(image.touchesCurrent.y - velocity.prevPositionY) < 2) velocity.y = 0; 6848 velocity.prevPositionX = image.touchesCurrent.x; 6849 velocity.prevPositionY = image.touchesCurrent.y; 6850 velocity.prevTime = Date.now(); 6851 gesture.imageWrapEl.style.transform = `translate3d(${image.currentX}px, ${image.currentY}px,0)`; 6852 } 6853 function onTouchEnd() { 6854 const zoom = swiper.zoom; 6855 evCache.length = 0; 6856 if (!gesture.imageEl) return; 6857 if (!image.isTouched || !image.isMoved) { 6858 image.isTouched = false; 6859 image.isMoved = false; 6860 return; 6861 } 6862 image.isTouched = false; 6863 image.isMoved = false; 6864 let momentumDurationX = 300; 6865 let momentumDurationY = 300; 6866 const momentumDistanceX = velocity.x * momentumDurationX; 6867 const newPositionX = image.currentX + momentumDistanceX; 6868 const momentumDistanceY = velocity.y * momentumDurationY; 6869 const newPositionY = image.currentY + momentumDistanceY; 6870 6871 // Fix duration 6872 if (velocity.x !== 0) momentumDurationX = Math.abs((newPositionX - image.currentX) / velocity.x); 6873 if (velocity.y !== 0) momentumDurationY = Math.abs((newPositionY - image.currentY) / velocity.y); 6874 const momentumDuration = Math.max(momentumDurationX, momentumDurationY); 6875 image.currentX = newPositionX; 6876 image.currentY = newPositionY; 6877 // Define if we need image drag 6878 const scaledWidth = image.width * zoom.scale; 6879 const scaledHeight = image.height * zoom.scale; 6880 image.minX = Math.min(gesture.slideWidth / 2 - scaledWidth / 2, 0); 6881 image.maxX = -image.minX; 6882 image.minY = Math.min(gesture.slideHeight / 2 - scaledHeight / 2, 0); 6883 image.maxY = -image.minY; 6884 image.currentX = Math.max(Math.min(image.currentX, image.maxX), image.minX); 6885 image.currentY = Math.max(Math.min(image.currentY, image.maxY), image.minY); 6886 gesture.imageWrapEl.style.transitionDuration = `${momentumDuration}ms`; 6887 gesture.imageWrapEl.style.transform = `translate3d(${image.currentX}px, ${image.currentY}px,0)`; 6888 } 6889 function onTransitionEnd() { 6890 const zoom = swiper.zoom; 6891 if (gesture.slideEl && swiper.activeIndex !== swiper.slides.indexOf(gesture.slideEl)) { 6892 if (gesture.imageEl) { 6893 gesture.imageEl.style.transform = 'translate3d(0,0,0) scale(1)'; 6894 } 6895 if (gesture.imageWrapEl) { 6896 gesture.imageWrapEl.style.transform = 'translate3d(0,0,0)'; 6897 } 6898 gesture.slideEl.classList.remove(`${swiper.params.zoom.zoomedSlideClass}`); 6899 zoom.scale = 1; 6900 currentScale = 1; 6901 gesture.slideEl = undefined; 6902 gesture.imageEl = undefined; 6903 gesture.imageWrapEl = undefined; 6904 gesture.originX = 0; 6905 gesture.originY = 0; 6906 } 6907 } 6908 function onMouseMove(e) { 6909 // Only pan if zoomed in and mouse panning is enabled 6910 if (currentScale <= 1 || !gesture.imageWrapEl) return; 6911 if (!eventWithinSlide(e) || !eventWithinZoomContainer(e)) return; 6912 const currentTransform = window.getComputedStyle(gesture.imageWrapEl).transform; 6913 const matrix = new window.DOMMatrix(currentTransform); 6914 if (!isPanningWithMouse) { 6915 isPanningWithMouse = true; 6916 mousePanStart.x = e.clientX; 6917 mousePanStart.y = e.clientY; 6918 image.startX = matrix.e; 6919 image.startY = matrix.f; 6920 image.width = gesture.imageEl.offsetWidth || gesture.imageEl.clientWidth; 6921 image.height = gesture.imageEl.offsetHeight || gesture.imageEl.clientHeight; 6922 gesture.slideWidth = gesture.slideEl.offsetWidth; 6923 gesture.slideHeight = gesture.slideEl.offsetHeight; 6924 return; 6925 } 6926 const deltaX = (e.clientX - mousePanStart.x) * mousePanSensitivity; 6927 const deltaY = (e.clientY - mousePanStart.y) * mousePanSensitivity; 6928 const scaledWidth = image.width * currentScale; 6929 const scaledHeight = image.height * currentScale; 6930 const slideWidth = gesture.slideWidth; 6931 const slideHeight = gesture.slideHeight; 6932 const minX = Math.min(slideWidth / 2 - scaledWidth / 2, 0); 6933 const maxX = -minX; 6934 const minY = Math.min(slideHeight / 2 - scaledHeight / 2, 0); 6935 const maxY = -minY; 6936 const newX = Math.max(Math.min(image.startX + deltaX, maxX), minX); 6937 const newY = Math.max(Math.min(image.startY + deltaY, maxY), minY); 6938 gesture.imageWrapEl.style.transitionDuration = '0ms'; 6939 gesture.imageWrapEl.style.transform = `translate3d(${newX}px, ${newY}px, 0)`; 6940 mousePanStart.x = e.clientX; 6941 mousePanStart.y = e.clientY; 6942 image.startX = newX; 6943 image.startY = newY; 6944 } 6945 function zoomIn(e) { 6946 const zoom = swiper.zoom; 6947 const params = swiper.params.zoom; 6948 if (!gesture.slideEl) { 6949 if (e && e.target) { 6950 gesture.slideEl = e.target.closest(`.${swiper.params.slideClass}, swiper-slide`); 6951 } 6952 if (!gesture.slideEl) { 6953 if (swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual) { 6954 gesture.slideEl = elementChildren(swiper.slidesEl, `.${swiper.params.slideActiveClass}`)[0]; 6955 } else { 6956 gesture.slideEl = swiper.slides[swiper.activeIndex]; 6957 } 6958 } 6959 let imageEl = gesture.slideEl.querySelector(`.${params.containerClass}`); 6960 if (imageEl) { 6961 imageEl = imageEl.querySelectorAll('picture, img, svg, canvas, .swiper-zoom-target')[0]; 6962 } 6963 gesture.imageEl = imageEl; 6964 if (imageEl) { 6965 gesture.imageWrapEl = elementParents(gesture.imageEl, `.${params.containerClass}`)[0]; 6966 } else { 6967 gesture.imageWrapEl = undefined; 6968 } 6969 } 6970 if (!gesture.imageEl || !gesture.imageWrapEl) return; 6971 if (swiper.params.cssMode) { 6972 swiper.wrapperEl.style.overflow = 'hidden'; 6973 swiper.wrapperEl.style.touchAction = 'none'; 6974 } 6975 gesture.slideEl.classList.add(`${params.zoomedSlideClass}`); 6976 let touchX; 6977 let touchY; 6978 let offsetX; 6979 let offsetY; 6980 let diffX; 6981 let diffY; 6982 let translateX; 6983 let translateY; 6984 let imageWidth; 6985 let imageHeight; 6986 let scaledWidth; 6987 let scaledHeight; 6988 let translateMinX; 6989 let translateMinY; 6990 let translateMaxX; 6991 let translateMaxY; 6992 let slideWidth; 6993 let slideHeight; 6994 if (typeof image.touchesStart.x === 'undefined' && e) { 6995 touchX = e.pageX; 6996 touchY = e.pageY; 6997 } else { 6998 touchX = image.touchesStart.x; 6999 touchY = image.touchesStart.y; 7000 } 7001 const forceZoomRatio = typeof e === 'number' ? e : null; 7002 if (currentScale === 1 && forceZoomRatio) { 7003 touchX = undefined; 7004 touchY = undefined; 7005 image.touchesStart.x = undefined; 7006 image.touchesStart.y = undefined; 7007 } 7008 const maxRatio = getMaxRatio(); 7009 zoom.scale = forceZoomRatio || maxRatio; 7010 currentScale = forceZoomRatio || maxRatio; 7011 if (e && !(currentScale === 1 && forceZoomRatio)) { 7012 slideWidth = gesture.slideEl.offsetWidth; 7013 slideHeight = gesture.slideEl.offsetHeight; 7014 offsetX = elementOffset(gesture.slideEl).left + window.scrollX; 7015 offsetY = elementOffset(gesture.slideEl).top + window.scrollY; 7016 diffX = offsetX + slideWidth / 2 - touchX; 7017 diffY = offsetY + slideHeight / 2 - touchY; 7018 imageWidth = gesture.imageEl.offsetWidth || gesture.imageEl.clientWidth; 7019 imageHeight = gesture.imageEl.offsetHeight || gesture.imageEl.clientHeight; 7020 scaledWidth = imageWidth * zoom.scale; 7021 scaledHeight = imageHeight * zoom.scale; 7022 translateMinX = Math.min(slideWidth / 2 - scaledWidth / 2, 0); 7023 translateMinY = Math.min(slideHeight / 2 - scaledHeight / 2, 0); 7024 translateMaxX = -translateMinX; 7025 translateMaxY = -translateMinY; 7026 translateX = diffX * zoom.scale; 7027 translateY = diffY * zoom.scale; 7028 if (translateX < translateMinX) { 7029 translateX = translateMinX; 7030 } 7031 if (translateX > translateMaxX) { 7032 translateX = translateMaxX; 7033 } 7034 if (translateY < translateMinY) { 7035 translateY = translateMinY; 7036 } 7037 if (translateY > translateMaxY) { 7038 translateY = translateMaxY; 7039 } 7040 } else { 7041 translateX = 0; 7042 translateY = 0; 7043 } 7044 if (forceZoomRatio && zoom.scale === 1) { 7045 gesture.originX = 0; 7046 gesture.originY = 0; 7047 } 7048 gesture.imageWrapEl.style.transitionDuration = '300ms'; 7049 gesture.imageWrapEl.style.transform = `translate3d(${translateX}px, ${translateY}px,0)`; 7050 gesture.imageEl.style.transitionDuration = '300ms'; 7051 gesture.imageEl.style.transform = `translate3d(0,0,0) scale(${zoom.scale})`; 7052 } 7053 function zoomOut() { 7054 const zoom = swiper.zoom; 7055 const params = swiper.params.zoom; 7056 if (!gesture.slideEl) { 7057 if (swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual) { 7058 gesture.slideEl = elementChildren(swiper.slidesEl, `.${swiper.params.slideActiveClass}`)[0]; 7059 } else { 7060 gesture.slideEl = swiper.slides[swiper.activeIndex]; 7061 } 7062 let imageEl = gesture.slideEl.querySelector(`.${params.containerClass}`); 7063 if (imageEl) { 7064 imageEl = imageEl.querySelectorAll('picture, img, svg, canvas, .swiper-zoom-target')[0]; 7065 } 7066 gesture.imageEl = imageEl; 7067 if (imageEl) { 7068 gesture.imageWrapEl = elementParents(gesture.imageEl, `.${params.containerClass}`)[0]; 7069 } else { 7070 gesture.imageWrapEl = undefined; 7071 } 7072 } 7073 if (!gesture.imageEl || !gesture.imageWrapEl) return; 7074 if (swiper.params.cssMode) { 7075 swiper.wrapperEl.style.overflow = ''; 7076 swiper.wrapperEl.style.touchAction = ''; 7077 } 7078 zoom.scale = 1; 7079 currentScale = 1; 7080 image.touchesStart.x = undefined; 7081 image.touchesStart.y = undefined; 7082 gesture.imageWrapEl.style.transitionDuration = '300ms'; 7083 gesture.imageWrapEl.style.transform = 'translate3d(0,0,0)'; 7084 gesture.imageEl.style.transitionDuration = '300ms'; 7085 gesture.imageEl.style.transform = 'translate3d(0,0,0) scale(1)'; 7086 gesture.slideEl.classList.remove(`${params.zoomedSlideClass}`); 7087 gesture.slideEl = undefined; 7088 gesture.originX = 0; 7089 gesture.originY = 0; 7090 if (swiper.params.zoom.panOnMouseMove) { 7091 mousePanStart = { 7092 x: 0, 7093 y: 0 7094 }; 7095 if (isPanningWithMouse) { 7096 isPanningWithMouse = false; 7097 image.startX = 0; 7098 image.startY = 0; 7099 } 7100 } 7101 } 7102 7103 // Toggle Zoom 7104 function zoomToggle(e) { 7105 const zoom = swiper.zoom; 7106 if (zoom.scale && zoom.scale !== 1) { 7107 // Zoom Out 7108 zoomOut(); 7109 } else { 7110 // Zoom In 7111 zoomIn(e); 7112 } 7113 } 7114 function getListeners() { 7115 const passiveListener = swiper.params.passiveListeners ? { 7116 passive: true, 7117 capture: false 7118 } : false; 7119 const activeListenerWithCapture = swiper.params.passiveListeners ? { 7120 passive: false, 7121 capture: true 7122 } : true; 7123 return { 7124 passiveListener, 7125 activeListenerWithCapture 7126 }; 7127 } 7128 7129 // Attach/Detach Events 7130 function enable() { 7131 const zoom = swiper.zoom; 7132 if (zoom.enabled) return; 7133 zoom.enabled = true; 7134 const { 7135 passiveListener, 7136 activeListenerWithCapture 7137 } = getListeners(); 7138 7139 // Scale image 7140 swiper.wrapperEl.addEventListener('pointerdown', onGestureStart, passiveListener); 7141 swiper.wrapperEl.addEventListener('pointermove', onGestureChange, activeListenerWithCapture); 7142 ['pointerup', 'pointercancel', 'pointerout'].forEach(eventName => { 7143 swiper.wrapperEl.addEventListener(eventName, onGestureEnd, passiveListener); 7144 }); 7145 7146 // Move image 7147 swiper.wrapperEl.addEventListener('pointermove', onTouchMove, activeListenerWithCapture); 7148 } 7149 function disable() { 7150 const zoom = swiper.zoom; 7151 if (!zoom.enabled) return; 7152 zoom.enabled = false; 7153 const { 7154 passiveListener, 7155 activeListenerWithCapture 7156 } = getListeners(); 7157 7158 // Scale image 7159 swiper.wrapperEl.removeEventListener('pointerdown', onGestureStart, passiveListener); 7160 swiper.wrapperEl.removeEventListener('pointermove', onGestureChange, activeListenerWithCapture); 7161 ['pointerup', 'pointercancel', 'pointerout'].forEach(eventName => { 7162 swiper.wrapperEl.removeEventListener(eventName, onGestureEnd, passiveListener); 7163 }); 7164 7165 // Move image 7166 swiper.wrapperEl.removeEventListener('pointermove', onTouchMove, activeListenerWithCapture); 7167 } 7168 on('init', () => { 7169 if (swiper.params.zoom.enabled) { 7170 enable(); 7171 } 7172 }); 7173 on('destroy', () => { 7174 disable(); 7175 }); 7176 on('touchStart', (_s, e) => { 7177 if (!swiper.zoom.enabled) return; 7178 onTouchStart(e); 7179 }); 7180 on('touchEnd', (_s, e) => { 7181 if (!swiper.zoom.enabled) return; 7182 onTouchEnd(); 7183 }); 7184 on('doubleTap', (_s, e) => { 7185 if (!swiper.animating && swiper.params.zoom.enabled && swiper.zoom.enabled && swiper.params.zoom.toggle) { 7186 zoomToggle(e); 7187 } 7188 }); 7189 on('transitionEnd', () => { 7190 if (swiper.zoom.enabled && swiper.params.zoom.enabled) { 7191 onTransitionEnd(); 7192 } 7193 }); 7194 on('slideChange', () => { 7195 if (swiper.zoom.enabled && swiper.params.zoom.enabled && swiper.params.cssMode) { 7196 onTransitionEnd(); 7197 } 7198 }); 7199 Object.assign(swiper.zoom, { 7200 enable, 7201 disable, 7202 in: zoomIn, 7203 out: zoomOut, 7204 toggle: zoomToggle 7205 }); 7206} 7207 7208 7209 7210;// ./node_modules/swiper/modules/controller.mjs 7211 7212 7213/* eslint no-bitwise: ["error", { "allow": [">>"] }] */ 7214function Controller(_ref) { 7215 let { 7216 swiper, 7217 extendParams, 7218 on 7219 } = _ref; 7220 extendParams({ 7221 controller: { 7222 control: undefined, 7223 inverse: false, 7224 by: 'slide' // or 'container' 7225 } 7226 }); 7227 7228 swiper.controller = { 7229 control: undefined 7230 }; 7231 function LinearSpline(x, y) { 7232 const binarySearch = function search() { 7233 let maxIndex; 7234 let minIndex; 7235 let guess; 7236 return (array, val) => { 7237 minIndex = -1; 7238 maxIndex = array.length; 7239 while (maxIndex - minIndex > 1) { 7240 guess = maxIndex + minIndex >> 1; 7241 if (array[guess] <= val) { 7242 minIndex = guess; 7243 } else { 7244 maxIndex = guess; 7245 } 7246 } 7247 return maxIndex; 7248 }; 7249 }(); 7250 this.x = x; 7251 this.y = y; 7252 this.lastIndex = x.length - 1; 7253 // Given an x value (x2), return the expected y2 value: 7254 // (x1,y1) is the known point before given value, 7255 // (x3,y3) is the known point after given value. 7256 let i1; 7257 let i3; 7258 this.interpolate = function interpolate(x2) { 7259 if (!x2) return 0; 7260 7261 // Get the indexes of x1 and x3 (the array indexes before and after given x2): 7262 i3 = binarySearch(this.x, x2); 7263 i1 = i3 - 1; 7264 7265 // We have our indexes i1 & i3, so we can calculate already: 7266 // y2 := ((x2−x1) × (y3−y1)) ÷ (x3−x1) + y1 7267 return (x2 - this.x[i1]) * (this.y[i3] - this.y[i1]) / (this.x[i3] - this.x[i1]) + this.y[i1]; 7268 }; 7269 return this; 7270 } 7271 function getInterpolateFunction(c) { 7272 swiper.controller.spline = swiper.params.loop ? new LinearSpline(swiper.slidesGrid, c.slidesGrid) : new LinearSpline(swiper.snapGrid, c.snapGrid); 7273 } 7274 function setTranslate(_t, byController) { 7275 const controlled = swiper.controller.control; 7276 let multiplier; 7277 let controlledTranslate; 7278 const Swiper = swiper.constructor; 7279 function setControlledTranslate(c) { 7280 if (c.destroyed) return; 7281 7282 // this will create an Interpolate function based on the snapGrids 7283 // x is the Grid of the scrolled scroller and y will be the controlled scroller 7284 // it makes sense to create this only once and recall it for the interpolation 7285 // the function does a lot of value caching for performance 7286 const translate = swiper.rtlTranslate ? -swiper.translate : swiper.translate; 7287 if (swiper.params.controller.by === 'slide') { 7288 getInterpolateFunction(c); 7289 // i am not sure why the values have to be multiplicated this way, tried to invert the snapGrid 7290 // but it did not work out 7291 controlledTranslate = -swiper.controller.spline.interpolate(-translate); 7292 } 7293 if (!controlledTranslate || swiper.params.controller.by === 'container') { 7294 multiplier = (c.maxTranslate() - c.minTranslate()) / (swiper.maxTranslate() - swiper.minTranslate()); 7295 if (Number.isNaN(multiplier) || !Number.isFinite(multiplier)) { 7296 multiplier = 1; 7297 } 7298 controlledTranslate = (translate - swiper.minTranslate()) * multiplier + c.minTranslate(); 7299 } 7300 if (swiper.params.controller.inverse) { 7301 controlledTranslate = c.maxTranslate() - controlledTranslate; 7302 } 7303 c.updateProgress(controlledTranslate); 7304 c.setTranslate(controlledTranslate, swiper); 7305 c.updateActiveIndex(); 7306 c.updateSlidesClasses(); 7307 } 7308 if (Array.isArray(controlled)) { 7309 for (let i = 0; i < controlled.length; i += 1) { 7310 if (controlled[i] !== byController && controlled[i] instanceof Swiper) { 7311 setControlledTranslate(controlled[i]); 7312 } 7313 } 7314 } else if (controlled instanceof Swiper && byController !== controlled) { 7315 setControlledTranslate(controlled); 7316 } 7317 } 7318 function setTransition(duration, byController) { 7319 const Swiper = swiper.constructor; 7320 const controlled = swiper.controller.control; 7321 let i; 7322 function setControlledTransition(c) { 7323 if (c.destroyed) return; 7324 c.setTransition(duration, swiper); 7325 if (duration !== 0) { 7326 c.transitionStart(); 7327 if (c.params.autoHeight) { 7328 nextTick(() => { 7329 c.updateAutoHeight(); 7330 }); 7331 } 7332 elementTransitionEnd(c.wrapperEl, () => { 7333 if (!controlled) return; 7334 c.transitionEnd(); 7335 }); 7336 } 7337 } 7338 if (Array.isArray(controlled)) { 7339 for (i = 0; i < controlled.length; i += 1) { 7340 if (controlled[i] !== byController && controlled[i] instanceof Swiper) { 7341 setControlledTransition(controlled[i]); 7342 } 7343 } 7344 } else if (controlled instanceof Swiper && byController !== controlled) { 7345 setControlledTransition(controlled); 7346 } 7347 } 7348 function removeSpline() { 7349 if (!swiper.controller.control) return; 7350 if (swiper.controller.spline) { 7351 swiper.controller.spline = undefined; 7352 delete swiper.controller.spline; 7353 } 7354 } 7355 on('beforeInit', () => { 7356 if (typeof window !== 'undefined' && ( 7357 // eslint-disable-line 7358 typeof swiper.params.controller.control === 'string' || swiper.params.controller.control instanceof HTMLElement)) { 7359 const controlElements = typeof swiper.params.controller.control === 'string' ? [...document.querySelectorAll(swiper.params.controller.control)] : [swiper.params.controller.control]; 7360 controlElements.forEach(controlElement => { 7361 if (!swiper.controller.control) swiper.controller.control = []; 7362 if (controlElement && controlElement.swiper) { 7363 swiper.controller.control.push(controlElement.swiper); 7364 } else if (controlElement) { 7365 const eventName = `${swiper.params.eventsPrefix}init`; 7366 const onControllerSwiper = e => { 7367 swiper.controller.control.push(e.detail[0]); 7368 swiper.update(); 7369 controlElement.removeEventListener(eventName, onControllerSwiper); 7370 }; 7371 controlElement.addEventListener(eventName, onControllerSwiper); 7372 } 7373 }); 7374 return; 7375 } 7376 swiper.controller.control = swiper.params.controller.control; 7377 }); 7378 on('update', () => { 7379 removeSpline(); 7380 }); 7381 on('resize', () => { 7382 removeSpline(); 7383 }); 7384 on('observerUpdate', () => { 7385 removeSpline(); 7386 }); 7387 on('setTranslate', (_s, translate, byController) => { 7388 if (!swiper.controller.control || swiper.controller.control.destroyed) return; 7389 swiper.controller.setTranslate(translate, byController); 7390 }); 7391 on('setTransition', (_s, duration, byController) => { 7392 if (!swiper.controller.control || swiper.controller.control.destroyed) return; 7393 swiper.controller.setTransition(duration, byController); 7394 }); 7395 Object.assign(swiper.controller, { 7396 setTranslate, 7397 setTransition 7398 }); 7399} 7400 7401 7402 7403;// ./node_modules/swiper/modules/a11y.mjs 7404 7405 7406 7407 7408function A11y(_ref) { 7409 let { 7410 swiper, 7411 extendParams, 7412 on 7413 } = _ref; 7414 extendParams({ 7415 a11y: { 7416 enabled: true, 7417 notificationClass: 'swiper-notification', 7418 prevSlideMessage: 'Previous slide', 7419 nextSlideMessage: 'Next slide', 7420 firstSlideMessage: 'This is the first slide', 7421 lastSlideMessage: 'This is the last slide', 7422 paginationBulletMessage: 'Go to slide {{index}}', 7423 slideLabelMessage: '{{index}} / {{slidesLength}}', 7424 containerMessage: null, 7425 containerRoleDescriptionMessage: null, 7426 containerRole: null, 7427 itemRoleDescriptionMessage: null, 7428 slideRole: 'group', 7429 id: null, 7430 scrollOnFocus: true 7431 } 7432 }); 7433 swiper.a11y = { 7434 clicked: false 7435 }; 7436 let liveRegion = null; 7437 let preventFocusHandler; 7438 let focusTargetSlideEl; 7439 let visibilityChangedTimestamp = new Date().getTime(); 7440 function notify(message) { 7441 const notification = liveRegion; 7442 if (notification.length === 0) return; 7443 notification.innerHTML = ''; 7444 notification.innerHTML = message; 7445 } 7446 function getRandomNumber(size) { 7447 if (size === void 0) { 7448 size = 16; 7449 } 7450 const randomChar = () => Math.round(16 * Math.random()).toString(16); 7451 return 'x'.repeat(size).replace(/x/g, randomChar); 7452 } 7453 function makeElFocusable(el) { 7454 el = makeElementsArray(el); 7455 el.forEach(subEl => { 7456 subEl.setAttribute('tabIndex', '0'); 7457 }); 7458 } 7459 function makeElNotFocusable(el) { 7460 el = makeElementsArray(el); 7461 el.forEach(subEl => { 7462 subEl.setAttribute('tabIndex', '-1'); 7463 }); 7464 } 7465 function addElRole(el, role) { 7466 el = makeElementsArray(el); 7467 el.forEach(subEl => { 7468 subEl.setAttribute('role', role); 7469 }); 7470 } 7471 function addElRoleDescription(el, description) { 7472 el = makeElementsArray(el); 7473 el.forEach(subEl => { 7474 subEl.setAttribute('aria-roledescription', description); 7475 }); 7476 } 7477 function addElControls(el, controls) { 7478 el = makeElementsArray(el); 7479 el.forEach(subEl => { 7480 subEl.setAttribute('aria-controls', controls); 7481 }); 7482 } 7483 function addElLabel(el, label) { 7484 el = makeElementsArray(el); 7485 el.forEach(subEl => { 7486 subEl.setAttribute('aria-label', label); 7487 }); 7488 } 7489 function addElId(el, id) { 7490 el = makeElementsArray(el); 7491 el.forEach(subEl => { 7492 subEl.setAttribute('id', id); 7493 }); 7494 } 7495 function addElLive(el, live) { 7496 el = makeElementsArray(el); 7497 el.forEach(subEl => { 7498 subEl.setAttribute('aria-live', live); 7499 }); 7500 } 7501 function disableEl(el) { 7502 el = makeElementsArray(el); 7503 el.forEach(subEl => { 7504 subEl.setAttribute('aria-disabled', true); 7505 }); 7506 } 7507 function enableEl(el) { 7508 el = makeElementsArray(el); 7509 el.forEach(subEl => { 7510 subEl.setAttribute('aria-disabled', false); 7511 }); 7512 } 7513 function onEnterOrSpaceKey(e) { 7514 if (e.keyCode !== 13 && e.keyCode !== 32) return; 7515 const params = swiper.params.a11y; 7516 const targetEl = e.target; 7517 if (swiper.pagination && swiper.pagination.el && (targetEl === swiper.pagination.el || swiper.pagination.el.contains(e.target))) { 7518 if (!e.target.matches(classesToSelector(swiper.params.pagination.bulletClass))) return; 7519 } 7520 if (swiper.navigation && swiper.navigation.prevEl && swiper.navigation.nextEl) { 7521 const prevEls = makeElementsArray(swiper.navigation.prevEl); 7522 const nextEls = makeElementsArray(swiper.navigation.nextEl); 7523 if (nextEls.includes(targetEl)) { 7524 if (!(swiper.isEnd && !swiper.params.loop)) { 7525 swiper.slideNext(); 7526 } 7527 if (swiper.isEnd) { 7528 notify(params.lastSlideMessage); 7529 } else { 7530 notify(params.nextSlideMessage); 7531 } 7532 } 7533 if (prevEls.includes(targetEl)) { 7534 if (!(swiper.isBeginning && !swiper.params.loop)) { 7535 swiper.slidePrev(); 7536 } 7537 if (swiper.isBeginning) { 7538 notify(params.firstSlideMessage); 7539 } else { 7540 notify(params.prevSlideMessage); 7541 } 7542 } 7543 } 7544 if (swiper.pagination && targetEl.matches(classesToSelector(swiper.params.pagination.bulletClass))) { 7545 targetEl.click(); 7546 } 7547 } 7548 function updateNavigation() { 7549 if (swiper.params.loop || swiper.params.rewind || !swiper.navigation) return; 7550 const { 7551 nextEl, 7552 prevEl 7553 } = swiper.navigation; 7554 if (prevEl) { 7555 if (swiper.isBeginning) { 7556 disableEl(prevEl); 7557 makeElNotFocusable(prevEl); 7558 } else { 7559 enableEl(prevEl); 7560 makeElFocusable(prevEl); 7561 } 7562 } 7563 if (nextEl) { 7564 if (swiper.isEnd) { 7565 disableEl(nextEl); 7566 makeElNotFocusable(nextEl); 7567 } else { 7568 enableEl(nextEl); 7569 makeElFocusable(nextEl); 7570 } 7571 } 7572 } 7573 function hasPagination() { 7574 return swiper.pagination && swiper.pagination.bullets && swiper.pagination.bullets.length; 7575 } 7576 function hasClickablePagination() { 7577 return hasPagination() && swiper.params.pagination.clickable; 7578 } 7579 function updatePagination() { 7580 const params = swiper.params.a11y; 7581 if (!hasPagination()) return; 7582 swiper.pagination.bullets.forEach(bulletEl => { 7583 if (swiper.params.pagination.clickable) { 7584 makeElFocusable(bulletEl); 7585 if (!swiper.params.pagination.renderBullet) { 7586 addElRole(bulletEl, 'button'); 7587 addElLabel(bulletEl, params.paginationBulletMessage.replace(/\{\{index\}\}/, elementIndex(bulletEl) + 1)); 7588 } 7589 } 7590 if (bulletEl.matches(classesToSelector(swiper.params.pagination.bulletActiveClass))) { 7591 bulletEl.setAttribute('aria-current', 'true'); 7592 } else { 7593 bulletEl.removeAttribute('aria-current'); 7594 } 7595 }); 7596 } 7597 const initNavEl = (el, wrapperId, message) => { 7598 makeElFocusable(el); 7599 if (el.tagName !== 'BUTTON') { 7600 addElRole(el, 'button'); 7601 el.addEventListener('keydown', onEnterOrSpaceKey); 7602 } 7603 addElLabel(el, message); 7604 addElControls(el, wrapperId); 7605 }; 7606 const handlePointerDown = e => { 7607 if (focusTargetSlideEl && focusTargetSlideEl !== e.target && !focusTargetSlideEl.contains(e.target)) { 7608 preventFocusHandler = true; 7609 } 7610 swiper.a11y.clicked = true; 7611 }; 7612 const handlePointerUp = () => { 7613 preventFocusHandler = false; 7614 requestAnimationFrame(() => { 7615 requestAnimationFrame(() => { 7616 if (!swiper.destroyed) { 7617 swiper.a11y.clicked = false; 7618 } 7619 }); 7620 }); 7621 }; 7622 const onVisibilityChange = e => { 7623 visibilityChangedTimestamp = new Date().getTime(); 7624 }; 7625 const handleFocus = e => { 7626 if (swiper.a11y.clicked || !swiper.params.a11y.scrollOnFocus) return; 7627 if (new Date().getTime() - visibilityChangedTimestamp < 100) return; 7628 const slideEl = e.target.closest(`.${swiper.params.slideClass}, swiper-slide`); 7629 if (!slideEl || !swiper.slides.includes(slideEl)) return; 7630 focusTargetSlideEl = slideEl; 7631 const isActive = swiper.slides.indexOf(slideEl) === swiper.activeIndex; 7632 const isVisible = swiper.params.watchSlidesProgress && swiper.visibleSlides && swiper.visibleSlides.includes(slideEl); 7633 if (isActive || isVisible) return; 7634 if (e.sourceCapabilities && e.sourceCapabilities.firesTouchEvents) return; 7635 if (swiper.isHorizontal()) { 7636 swiper.el.scrollLeft = 0; 7637 } else { 7638 swiper.el.scrollTop = 0; 7639 } 7640 requestAnimationFrame(() => { 7641 if (preventFocusHandler) return; 7642 if (swiper.params.loop) { 7643 swiper.slideToLoop(parseInt(slideEl.getAttribute('data-swiper-slide-index')), 0); 7644 } else { 7645 swiper.slideTo(swiper.slides.indexOf(slideEl), 0); 7646 } 7647 preventFocusHandler = false; 7648 }); 7649 }; 7650 const initSlides = () => { 7651 const params = swiper.params.a11y; 7652 if (params.itemRoleDescriptionMessage) { 7653 addElRoleDescription(swiper.slides, params.itemRoleDescriptionMessage); 7654 } 7655 if (params.slideRole) { 7656 addElRole(swiper.slides, params.slideRole); 7657 } 7658 const slidesLength = swiper.slides.length; 7659 if (params.slideLabelMessage) { 7660 swiper.slides.forEach((slideEl, index) => { 7661 const slideIndex = swiper.params.loop ? parseInt(slideEl.getAttribute('data-swiper-slide-index'), 10) : index; 7662 const ariaLabelMessage = params.slideLabelMessage.replace(/\{\{index\}\}/, slideIndex + 1).replace(/\{\{slidesLength\}\}/, slidesLength); 7663 addElLabel(slideEl, ariaLabelMessage); 7664 }); 7665 } 7666 }; 7667 const init = () => { 7668 const params = swiper.params.a11y; 7669 swiper.el.append(liveRegion); 7670 7671 // Container 7672 const containerEl = swiper.el; 7673 if (params.containerRoleDescriptionMessage) { 7674 addElRoleDescription(containerEl, params.containerRoleDescriptionMessage); 7675 } 7676 if (params.containerMessage) { 7677 addElLabel(containerEl, params.containerMessage); 7678 } 7679 if (params.containerRole) { 7680 addElRole(containerEl, params.containerRole); 7681 } 7682 7683 // Wrapper 7684 const wrapperEl = swiper.wrapperEl; 7685 const wrapperId = params.id || wrapperEl.getAttribute('id') || `swiper-wrapper-${getRandomNumber(16)}`; 7686 const live = swiper.params.autoplay && swiper.params.autoplay.enabled ? 'off' : 'polite'; 7687 addElId(wrapperEl, wrapperId); 7688 addElLive(wrapperEl, live); 7689 7690 // Slide 7691 initSlides(); 7692 7693 // Navigation 7694 let { 7695 nextEl, 7696 prevEl 7697 } = swiper.navigation ? swiper.navigation : {}; 7698 nextEl = makeElementsArray(nextEl); 7699 prevEl = makeElementsArray(prevEl); 7700 if (nextEl) { 7701 nextEl.forEach(el => initNavEl(el, wrapperId, params.nextSlideMessage)); 7702 } 7703 if (prevEl) { 7704 prevEl.forEach(el => initNavEl(el, wrapperId, params.prevSlideMessage)); 7705 } 7706 7707 // Pagination 7708 if (hasClickablePagination()) { 7709 const paginationEl = makeElementsArray(swiper.pagination.el); 7710 paginationEl.forEach(el => { 7711 el.addEventListener('keydown', onEnterOrSpaceKey); 7712 }); 7713 } 7714 7715 // Tab focus 7716 const document = getDocument(); 7717 document.addEventListener('visibilitychange', onVisibilityChange); 7718 swiper.el.addEventListener('focus', handleFocus, true); 7719 swiper.el.addEventListener('focus', handleFocus, true); 7720 swiper.el.addEventListener('pointerdown', handlePointerDown, true); 7721 swiper.el.addEventListener('pointerup', handlePointerUp, true); 7722 }; 7723 function destroy() { 7724 if (liveRegion) liveRegion.remove(); 7725 let { 7726 nextEl, 7727 prevEl 7728 } = swiper.navigation ? swiper.navigation : {}; 7729 nextEl = makeElementsArray(nextEl); 7730 prevEl = makeElementsArray(prevEl); 7731 if (nextEl) { 7732 nextEl.forEach(el => el.removeEventListener('keydown', onEnterOrSpaceKey)); 7733 } 7734 if (prevEl) { 7735 prevEl.forEach(el => el.removeEventListener('keydown', onEnterOrSpaceKey)); 7736 } 7737 7738 // Pagination 7739 if (hasClickablePagination()) { 7740 const paginationEl = makeElementsArray(swiper.pagination.el); 7741 paginationEl.forEach(el => { 7742 el.removeEventListener('keydown', onEnterOrSpaceKey); 7743 }); 7744 } 7745 const document = getDocument(); 7746 document.removeEventListener('visibilitychange', onVisibilityChange); 7747 // Tab focus 7748 if (swiper.el && typeof swiper.el !== 'string') { 7749 swiper.el.removeEventListener('focus', handleFocus, true); 7750 swiper.el.removeEventListener('pointerdown', handlePointerDown, true); 7751 swiper.el.removeEventListener('pointerup', handlePointerUp, true); 7752 } 7753 } 7754 on('beforeInit', () => { 7755 liveRegion = createElement('span', swiper.params.a11y.notificationClass); 7756 liveRegion.setAttribute('aria-live', 'assertive'); 7757 liveRegion.setAttribute('aria-atomic', 'true'); 7758 }); 7759 on('afterInit', () => { 7760 if (!swiper.params.a11y.enabled) return; 7761 init(); 7762 }); 7763 on('slidesLengthChange snapGridLengthChange slidesGridLengthChange', () => { 7764 if (!swiper.params.a11y.enabled) return; 7765 initSlides(); 7766 }); 7767 on('fromEdge toEdge afterInit lock unlock', () => { 7768 if (!swiper.params.a11y.enabled) return; 7769 updateNavigation(); 7770 }); 7771 on('paginationUpdate', () => { 7772 if (!swiper.params.a11y.enabled) return; 7773 updatePagination(); 7774 }); 7775 on('destroy', () => { 7776 if (!swiper.params.a11y.enabled) return; 7777 destroy(); 7778 }); 7779} 7780 7781 7782 7783;// ./node_modules/swiper/modules/history.mjs 7784 7785 7786function History(_ref) { 7787 let { 7788 swiper, 7789 extendParams, 7790 on 7791 } = _ref; 7792 extendParams({ 7793 history: { 7794 enabled: false, 7795 root: '', 7796 replaceState: false, 7797 key: 'slides', 7798 keepQuery: false 7799 } 7800 }); 7801 let initialized = false; 7802 let paths = {}; 7803 const slugify = text => { 7804 return text.toString().replace(/\s+/g, '-').replace(/[^\w-]+/g, '').replace(/--+/g, '-').replace(/^-+/, '').replace(/-+$/, ''); 7805 }; 7806 const getPathValues = urlOverride => { 7807 const window = getWindow(); 7808 let location; 7809 if (urlOverride) { 7810 location = new URL(urlOverride); 7811 } else { 7812 location = window.location; 7813 } 7814 const pathArray = location.pathname.slice(1).split('/').filter(part => part !== ''); 7815 const total = pathArray.length; 7816 const key = pathArray[total - 2]; 7817 const value = pathArray[total - 1]; 7818 return { 7819 key, 7820 value 7821 }; 7822 }; 7823 const setHistory = (key, index) => { 7824 const window = getWindow(); 7825 if (!initialized || !swiper.params.history.enabled) return; 7826 let location; 7827 if (swiper.params.url) { 7828 location = new URL(swiper.params.url); 7829 } else { 7830 location = window.location; 7831 } 7832 const slide = swiper.virtual && swiper.params.virtual.enabled ? swiper.slidesEl.querySelector(`[data-swiper-slide-index="${index}"]`) : swiper.slides[index]; 7833 let value = slugify(slide.getAttribute('data-history')); 7834 if (swiper.params.history.root.length > 0) { 7835 let root = swiper.params.history.root; 7836 if (root[root.length - 1] === '/') root = root.slice(0, root.length - 1); 7837 value = `${root}/${key ? `${key}/` : ''}${value}`; 7838 } else if (!location.pathname.includes(key)) { 7839 value = `${key ? `${key}/` : ''}${value}`; 7840 } 7841 if (swiper.params.history.keepQuery) { 7842 value += location.search; 7843 } 7844 const currentState = window.history.state; 7845 if (currentState && currentState.value === value) { 7846 return; 7847 } 7848 if (swiper.params.history.replaceState) { 7849 window.history.replaceState({ 7850 value 7851 }, null, value); 7852 } else { 7853 window.history.pushState({ 7854 value 7855 }, null, value); 7856 } 7857 }; 7858 const scrollToSlide = (speed, value, runCallbacks) => { 7859 if (value) { 7860 for (let i = 0, length = swiper.slides.length; i < length; i += 1) { 7861 const slide = swiper.slides[i]; 7862 const slideHistory = slugify(slide.getAttribute('data-history')); 7863 if (slideHistory === value) { 7864 const index = swiper.getSlideIndex(slide); 7865 swiper.slideTo(index, speed, runCallbacks); 7866 } 7867 } 7868 } else { 7869 swiper.slideTo(0, speed, runCallbacks); 7870 } 7871 }; 7872 const setHistoryPopState = () => { 7873 paths = getPathValues(swiper.params.url); 7874 scrollToSlide(swiper.params.speed, paths.value, false); 7875 }; 7876 const init = () => { 7877 const window = getWindow(); 7878 if (!swiper.params.history) return; 7879 if (!window.history || !window.history.pushState) { 7880 swiper.params.history.enabled = false; 7881 swiper.params.hashNavigation.enabled = true; 7882 return; 7883 } 7884 initialized = true; 7885 paths = getPathValues(swiper.params.url); 7886 if (!paths.key && !paths.value) { 7887 if (!swiper.params.history.replaceState) { 7888 window.addEventListener('popstate', setHistoryPopState); 7889 } 7890 return; 7891 } 7892 scrollToSlide(0, paths.value, swiper.params.runCallbacksOnInit); 7893 if (!swiper.params.history.replaceState) { 7894 window.addEventListener('popstate', setHistoryPopState); 7895 } 7896 }; 7897 const destroy = () => { 7898 const window = getWindow(); 7899 if (!swiper.params.history.replaceState) { 7900 window.removeEventListener('popstate', setHistoryPopState); 7901 } 7902 }; 7903 on('init', () => { 7904 if (swiper.params.history.enabled) { 7905 init(); 7906 } 7907 }); 7908 on('destroy', () => { 7909 if (swiper.params.history.enabled) { 7910 destroy(); 7911 } 7912 }); 7913 on('transitionEnd _freeModeNoMomentumRelease', () => { 7914 if (initialized) { 7915 setHistory(swiper.params.history.key, swiper.activeIndex); 7916 } 7917 }); 7918 on('slideChange', () => { 7919 if (initialized && swiper.params.cssMode) { 7920 setHistory(swiper.params.history.key, swiper.activeIndex); 7921 } 7922 }); 7923} 7924 7925 7926 7927;// ./node_modules/swiper/modules/hash-navigation.mjs 7928 7929 7930 7931function HashNavigation(_ref) { 7932 let { 7933 swiper, 7934 extendParams, 7935 emit, 7936 on 7937 } = _ref; 7938 let initialized = false; 7939 const document = getDocument(); 7940 const window = getWindow(); 7941 extendParams({ 7942 hashNavigation: { 7943 enabled: false, 7944 replaceState: false, 7945 watchState: false, 7946 getSlideIndex(_s, hash) { 7947 if (swiper.virtual && swiper.params.virtual.enabled) { 7948 const slideWithHash = swiper.slides.find(slideEl => slideEl.getAttribute('data-hash') === hash); 7949 if (!slideWithHash) return 0; 7950 const index = parseInt(slideWithHash.getAttribute('data-swiper-slide-index'), 10); 7951 return index; 7952 } 7953 return swiper.getSlideIndex(elementChildren(swiper.slidesEl, `.${swiper.params.slideClass}[data-hash="${hash}"], swiper-slide[data-hash="${hash}"]`)[0]); 7954 } 7955 } 7956 }); 7957 const onHashChange = () => { 7958 emit('hashChange'); 7959 const newHash = document.location.hash.replace('#', ''); 7960 const activeSlideEl = swiper.virtual && swiper.params.virtual.enabled ? swiper.slidesEl.querySelector(`[data-swiper-slide-index="${swiper.activeIndex}"]`) : swiper.slides[swiper.activeIndex]; 7961 const activeSlideHash = activeSlideEl ? activeSlideEl.getAttribute('data-hash') : ''; 7962 if (newHash !== activeSlideHash) { 7963 const newIndex = swiper.params.hashNavigation.getSlideIndex(swiper, newHash); 7964 if (typeof newIndex === 'undefined' || Number.isNaN(newIndex)) return; 7965 swiper.slideTo(newIndex); 7966 } 7967 }; 7968 const setHash = () => { 7969 if (!initialized || !swiper.params.hashNavigation.enabled) return; 7970 const activeSlideEl = swiper.virtual && swiper.params.virtual.enabled ? swiper.slidesEl.querySelector(`[data-swiper-slide-index="${swiper.activeIndex}"]`) : swiper.slides[swiper.activeIndex]; 7971 const activeSlideHash = activeSlideEl ? activeSlideEl.getAttribute('data-hash') || activeSlideEl.getAttribute('data-history') : ''; 7972 if (swiper.params.hashNavigation.replaceState && window.history && window.history.replaceState) { 7973 window.history.replaceState(null, null, `#${activeSlideHash}` || ''); 7974 emit('hashSet'); 7975 } else { 7976 document.location.hash = activeSlideHash || ''; 7977 emit('hashSet'); 7978 } 7979 }; 7980 const init = () => { 7981 if (!swiper.params.hashNavigation.enabled || swiper.params.history && swiper.params.history.enabled) return; 7982 initialized = true; 7983 const hash = document.location.hash.replace('#', ''); 7984 if (hash) { 7985 const speed = 0; 7986 const index = swiper.params.hashNavigation.getSlideIndex(swiper, hash); 7987 swiper.slideTo(index || 0, speed, swiper.params.runCallbacksOnInit, true); 7988 } 7989 if (swiper.params.hashNavigation.watchState) { 7990 window.addEventListener('hashchange', onHashChange); 7991 } 7992 }; 7993 const destroy = () => { 7994 if (swiper.params.hashNavigation.watchState) { 7995 window.removeEventListener('hashchange', onHashChange); 7996 } 7997 }; 7998 on('init', () => { 7999 if (swiper.params.hashNavigation.enabled) { 8000 init(); 8001 } 8002 }); 8003 on('destroy', () => { 8004 if (swiper.params.hashNavigation.enabled) { 8005 destroy(); 8006 } 8007 }); 8008 on('transitionEnd _freeModeNoMomentumRelease', () => { 8009 if (initialized) { 8010 setHash(); 8011 } 8012 }); 8013 on('slideChange', () => { 8014 if (initialized && swiper.params.cssMode) { 8015 setHash(); 8016 } 8017 }); 8018} 8019 8020 8021 8022;// ./node_modules/swiper/modules/autoplay.mjs 8023 8024 8025/* eslint no-underscore-dangle: "off" */ 8026/* eslint no-use-before-define: "off" */ 8027function Autoplay(_ref) { 8028 let { 8029 swiper, 8030 extendParams, 8031 on, 8032 emit, 8033 params 8034 } = _ref; 8035 swiper.autoplay = { 8036 running: false, 8037 paused: false, 8038 timeLeft: 0 8039 }; 8040 extendParams({ 8041 autoplay: { 8042 enabled: false, 8043 delay: 3000, 8044 waitForTransition: true, 8045 disableOnInteraction: false, 8046 stopOnLastSlide: false, 8047 reverseDirection: false, 8048 pauseOnMouseEnter: false 8049 } 8050 }); 8051 let timeout; 8052 let raf; 8053 let autoplayDelayTotal = params && params.autoplay ? params.autoplay.delay : 3000; 8054 let autoplayDelayCurrent = params && params.autoplay ? params.autoplay.delay : 3000; 8055 let autoplayTimeLeft; 8056 let autoplayStartTime = new Date().getTime(); 8057 let wasPaused; 8058 let isTouched; 8059 let pausedByTouch; 8060 let touchStartTimeout; 8061 let slideChanged; 8062 let pausedByInteraction; 8063 let pausedByPointerEnter; 8064 function onTransitionEnd(e) { 8065 if (!swiper || swiper.destroyed || !swiper.wrapperEl) return; 8066 if (e.target !== swiper.wrapperEl) return; 8067 swiper.wrapperEl.removeEventListener('transitionend', onTransitionEnd); 8068 if (pausedByPointerEnter || e.detail && e.detail.bySwiperTouchMove) { 8069 return; 8070 } 8071 resume(); 8072 } 8073 const calcTimeLeft = () => { 8074 if (swiper.destroyed || !swiper.autoplay.running) return; 8075 if (swiper.autoplay.paused) { 8076 wasPaused = true; 8077 } else if (wasPaused) { 8078 autoplayDelayCurrent = autoplayTimeLeft; 8079 wasPaused = false;
vendor: 4,184 bytes, lines 8080-8199
8080 } 8081 const timeLeft = swiper.autoplay.paused ? autoplayTimeLeft : autoplayStartTime + autoplayDelayCurrent - new Date().getTime(); 8082 swiper.autoplay.timeLeft = timeLeft; 8083 emit('autoplayTimeLeft', timeLeft, timeLeft / autoplayDelayTotal); 8084 raf = requestAnimationFrame(() => { 8085 calcTimeLeft(); 8086 }); 8087 }; 8088 const getSlideDelay = () => { 8089 let activeSlideEl; 8090 if (swiper.virtual && swiper.params.virtual.enabled) { 8091 activeSlideEl = swiper.slides.find(slideEl => slideEl.classList.contains('swiper-slide-active')); 8092 } else { 8093 activeSlideEl = swiper.slides[swiper.activeIndex]; 8094 } 8095 if (!activeSlideEl) return undefined; 8096 const currentSlideDelay = parseInt(activeSlideEl.getAttribute('data-swiper-autoplay'), 10); 8097 return currentSlideDelay; 8098 }; 8099 const run = delayForce => { 8100 if (swiper.destroyed || !swiper.autoplay.running) return; 8101 cancelAnimationFrame(raf); 8102 calcTimeLeft(); 8103 let delay = typeof delayForce === 'undefined' ? swiper.params.autoplay.delay : delayForce; 8104 autoplayDelayTotal = swiper.params.autoplay.delay; 8105 autoplayDelayCurrent = swiper.params.autoplay.delay; 8106 const currentSlideDelay = getSlideDelay(); 8107 if (!Number.isNaN(currentSlideDelay) && currentSlideDelay > 0 && typeof delayForce === 'undefined') { 8108 delay = currentSlideDelay; 8109 autoplayDelayTotal = currentSlideDelay; 8110 autoplayDelayCurrent = currentSlideDelay; 8111 } 8112 autoplayTimeLeft = delay; 8113 const speed = swiper.params.speed; 8114 const proceed = () => { 8115 if (!swiper || swiper.destroyed) return; 8116 if (swiper.params.autoplay.reverseDirection) { 8117 if (!swiper.isBeginning || swiper.params.loop || swiper.params.rewind) { 8118 swiper.slidePrev(speed, true, true); 8119 emit('autoplay'); 8120 } else if (!swiper.params.autoplay.stopOnLastSlide) { 8121 swiper.slideTo(swiper.slides.length - 1, speed, true, true); 8122 emit('autoplay'); 8123 } 8124 } else { 8125 if (!swiper.isEnd || swiper.params.loop || swiper.params.rewind) { 8126 swiper.slideNext(speed, true, true); 8127 emit('autoplay'); 8128 } else if (!swiper.params.autoplay.stopOnLastSlide) { 8129 swiper.slideTo(0, speed, true, true); 8130 emit('autoplay'); 8131 } 8132 } 8133 if (swiper.params.cssMode) { 8134 autoplayStartTime = new Date().getTime(); 8135 requestAnimationFrame(() => { 8136 run(); 8137 }); 8138 } 8139 }; 8140 if (delay > 0) { 8141 clearTimeout(timeout); 8142 timeout = setTimeout(() => { 8143 proceed(); 8144 }, delay); 8145 } else { 8146 requestAnimationFrame(() => { 8147 proceed(); 8148 }); 8149 } 8150 8151 // eslint-disable-next-line 8152 return delay; 8153 }; 8154 const start = () => { 8155 autoplayStartTime = new Date().getTime(); 8156 swiper.autoplay.running = true; 8157 run(); 8158 emit('autoplayStart'); 8159 }; 8160 const stop = () => { 8161 swiper.autoplay.running = false; 8162 clearTimeout(timeout); 8163 cancelAnimationFrame(raf); 8164 emit('autoplayStop'); 8165 }; 8166 const pause = (internal, reset) => { 8167 if (swiper.destroyed || !swiper.autoplay.running) return; 8168 clearTimeout(timeout); 8169 if (!internal) { 8170 pausedByInteraction = true; 8171 } 8172 const proceed = () => { 8173 emit('autoplayPause'); 8174 if (swiper.params.autoplay.waitForTransition) { 8175 swiper.wrapperEl.addEventListener('transitionend', onTransitionEnd); 8176 } else { 8177 resume(); 8178 } 8179 }; 8180 swiper.autoplay.paused = true; 8181 if (reset) { 8182 if (slideChanged) { 8183 autoplayTimeLeft = swiper.params.autoplay.delay; 8184 } 8185 slideChanged = false; 8186 proceed(); 8187 return; 8188 } 8189 const delay = autoplayTimeLeft || swiper.params.autoplay.delay; 8190 autoplayTimeLeft = delay - (new Date().getTime() - autoplayStartTime); 8191 if (swiper.isEnd && autoplayTimeLeft < 0 && !swiper.params.loop) return; 8192 if (autoplayTimeLeft < 0) autoplayTimeLeft = 0; 8193 proceed(); 8194 }; 8195 const resume = () => { 8196 if (swiper.isEnd && autoplayTimeLeft < 0 && !swiper.params.loop || swiper.destroyed || !swiper.autoplay.running) return; 8197 autoplayStartTime = new Date().getTime(); 8198 if (pausedByInteraction) { 8199 pausedByInteraction = false;
vendor: 19,125 bytes, lines 8200-8774
8200 run(autoplayTimeLeft); 8201 } else { 8202 run(); 8203 } 8204 swiper.autoplay.paused = false; 8205 emit('autoplayResume'); 8206 }; 8207 const onVisibilityChange = () => { 8208 if (swiper.destroyed || !swiper.autoplay.running) return; 8209 const document = getDocument(); 8210 if (document.visibilityState === 'hidden') { 8211 pausedByInteraction = true; 8212 pause(true); 8213 } 8214 if (document.visibilityState === 'visible') { 8215 resume(); 8216 } 8217 }; 8218 const onPointerEnter = e => { 8219 if (e.pointerType !== 'mouse') return; 8220 pausedByInteraction = true; 8221 pausedByPointerEnter = true; 8222 if (swiper.animating || swiper.autoplay.paused) return; 8223 pause(true); 8224 }; 8225 const onPointerLeave = e => { 8226 if (e.pointerType !== 'mouse') return; 8227 pausedByPointerEnter = false; 8228 if (swiper.autoplay.paused) { 8229 resume(); 8230 } 8231 }; 8232 const attachMouseEvents = () => { 8233 if (swiper.params.autoplay.pauseOnMouseEnter) { 8234 swiper.el.addEventListener('pointerenter', onPointerEnter); 8235 swiper.el.addEventListener('pointerleave', onPointerLeave); 8236 } 8237 }; 8238 const detachMouseEvents = () => { 8239 if (swiper.el && typeof swiper.el !== 'string') { 8240 swiper.el.removeEventListener('pointerenter', onPointerEnter); 8241 swiper.el.removeEventListener('pointerleave', onPointerLeave); 8242 } 8243 }; 8244 const attachDocumentEvents = () => { 8245 const document = getDocument(); 8246 document.addEventListener('visibilitychange', onVisibilityChange); 8247 }; 8248 const detachDocumentEvents = () => { 8249 const document = getDocument(); 8250 document.removeEventListener('visibilitychange', onVisibilityChange); 8251 }; 8252 on('init', () => { 8253 if (swiper.params.autoplay.enabled) { 8254 attachMouseEvents(); 8255 attachDocumentEvents(); 8256 start(); 8257 } 8258 }); 8259 on('destroy', () => { 8260 detachMouseEvents(); 8261 detachDocumentEvents(); 8262 if (swiper.autoplay.running) { 8263 stop(); 8264 } 8265 }); 8266 on('_freeModeStaticRelease', () => { 8267 if (pausedByTouch || pausedByInteraction) { 8268 resume(); 8269 } 8270 }); 8271 on('_freeModeNoMomentumRelease', () => { 8272 if (!swiper.params.autoplay.disableOnInteraction) { 8273 pause(true, true); 8274 } else { 8275 stop(); 8276 } 8277 }); 8278 on('beforeTransitionStart', (_s, speed, internal) => { 8279 if (swiper.destroyed || !swiper.autoplay.running) return; 8280 if (internal || !swiper.params.autoplay.disableOnInteraction) { 8281 pause(true, true); 8282 } else { 8283 stop(); 8284 } 8285 }); 8286 on('sliderFirstMove', () => { 8287 if (swiper.destroyed || !swiper.autoplay.running) return; 8288 if (swiper.params.autoplay.disableOnInteraction) { 8289 stop(); 8290 return; 8291 } 8292 isTouched = true; 8293 pausedByTouch = false; 8294 pausedByInteraction = false; 8295 touchStartTimeout = setTimeout(() => { 8296 pausedByInteraction = true; 8297 pausedByTouch = true; 8298 pause(true); 8299 }, 200); 8300 }); 8301 on('touchEnd', () => { 8302 if (swiper.destroyed || !swiper.autoplay.running || !isTouched) return; 8303 clearTimeout(touchStartTimeout); 8304 clearTimeout(timeout); 8305 if (swiper.params.autoplay.disableOnInteraction) { 8306 pausedByTouch = false; 8307 isTouched = false; 8308 return; 8309 } 8310 if (pausedByTouch && swiper.params.cssMode) resume(); 8311 pausedByTouch = false; 8312 isTouched = false; 8313 }); 8314 on('slideChange', () => { 8315 if (swiper.destroyed || !swiper.autoplay.running) return; 8316 slideChanged = true; 8317 }); 8318 Object.assign(swiper.autoplay, { 8319 start, 8320 stop, 8321 pause, 8322 resume 8323 }); 8324} 8325 8326 8327 8328;// ./node_modules/swiper/modules/thumbs.mjs 8329 8330 8331 8332function Thumb(_ref) { 8333 let { 8334 swiper, 8335 extendParams, 8336 on 8337 } = _ref; 8338 extendParams({ 8339 thumbs: { 8340 swiper: null, 8341 multipleActiveThumbs: true, 8342 autoScrollOffset: 0, 8343 slideThumbActiveClass: 'swiper-slide-thumb-active', 8344 thumbsContainerClass: 'swiper-thumbs' 8345 } 8346 }); 8347 let initialized = false; 8348 let swiperCreated = false; 8349 swiper.thumbs = { 8350 swiper: null 8351 }; 8352 function onThumbClick() { 8353 const thumbsSwiper = swiper.thumbs.swiper; 8354 if (!thumbsSwiper || thumbsSwiper.destroyed) return; 8355 const clickedIndex = thumbsSwiper.clickedIndex; 8356 const clickedSlide = thumbsSwiper.clickedSlide; 8357 if (clickedSlide && clickedSlide.classList.contains(swiper.params.thumbs.slideThumbActiveClass)) return; 8358 if (typeof clickedIndex === 'undefined' || clickedIndex === null) return; 8359 let slideToIndex; 8360 if (thumbsSwiper.params.loop) { 8361 slideToIndex = parseInt(thumbsSwiper.clickedSlide.getAttribute('data-swiper-slide-index'), 10); 8362 } else { 8363 slideToIndex = clickedIndex; 8364 } 8365 if (swiper.params.loop) { 8366 swiper.slideToLoop(slideToIndex); 8367 } else { 8368 swiper.slideTo(slideToIndex); 8369 } 8370 } 8371 function init() { 8372 const { 8373 thumbs: thumbsParams 8374 } = swiper.params; 8375 if (initialized) return false; 8376 initialized = true; 8377 const SwiperClass = swiper.constructor; 8378 if (thumbsParams.swiper instanceof SwiperClass) { 8379 swiper.thumbs.swiper = thumbsParams.swiper; 8380 Object.assign(swiper.thumbs.swiper.originalParams, { 8381 watchSlidesProgress: true, 8382 slideToClickedSlide: false 8383 }); 8384 Object.assign(swiper.thumbs.swiper.params, { 8385 watchSlidesProgress: true, 8386 slideToClickedSlide: false 8387 }); 8388 swiper.thumbs.swiper.update(); 8389 } else if (utils_isObject(thumbsParams.swiper)) { 8390 const thumbsSwiperParams = Object.assign({}, thumbsParams.swiper); 8391 Object.assign(thumbsSwiperParams, { 8392 watchSlidesProgress: true, 8393 slideToClickedSlide: false 8394 }); 8395 swiper.thumbs.swiper = new SwiperClass(thumbsSwiperParams); 8396 swiperCreated = true; 8397 } 8398 swiper.thumbs.swiper.el.classList.add(swiper.params.thumbs.thumbsContainerClass); 8399 swiper.thumbs.swiper.on('tap', onThumbClick); 8400 return true; 8401 } 8402 function update(initial) { 8403 const thumbsSwiper = swiper.thumbs.swiper; 8404 if (!thumbsSwiper || thumbsSwiper.destroyed) return; 8405 const slidesPerView = thumbsSwiper.params.slidesPerView === 'auto' ? thumbsSwiper.slidesPerViewDynamic() : thumbsSwiper.params.slidesPerView; 8406 8407 // Activate thumbs 8408 let thumbsToActivate = 1; 8409 const thumbActiveClass = swiper.params.thumbs.slideThumbActiveClass; 8410 if (swiper.params.slidesPerView > 1 && !swiper.params.centeredSlides) { 8411 thumbsToActivate = swiper.params.slidesPerView; 8412 } 8413 if (!swiper.params.thumbs.multipleActiveThumbs) { 8414 thumbsToActivate = 1; 8415 } 8416 thumbsToActivate = Math.floor(thumbsToActivate); 8417 thumbsSwiper.slides.forEach(slideEl => slideEl.classList.remove(thumbActiveClass)); 8418 if (thumbsSwiper.params.loop || thumbsSwiper.params.virtual && thumbsSwiper.params.virtual.enabled) { 8419 for (let i = 0; i < thumbsToActivate; i += 1) { 8420 elementChildren(thumbsSwiper.slidesEl, `[data-swiper-slide-index="${swiper.realIndex + i}"]`).forEach(slideEl => { 8421 slideEl.classList.add(thumbActiveClass); 8422 }); 8423 } 8424 } else { 8425 for (let i = 0; i < thumbsToActivate; i += 1) { 8426 if (thumbsSwiper.slides[swiper.realIndex + i]) { 8427 thumbsSwiper.slides[swiper.realIndex + i].classList.add(thumbActiveClass); 8428 } 8429 } 8430 } 8431 const autoScrollOffset = swiper.params.thumbs.autoScrollOffset; 8432 const useOffset = autoScrollOffset && !thumbsSwiper.params.loop; 8433 if (swiper.realIndex !== thumbsSwiper.realIndex || useOffset) { 8434 const currentThumbsIndex = thumbsSwiper.activeIndex; 8435 let newThumbsIndex; 8436 let direction; 8437 if (thumbsSwiper.params.loop) { 8438 const newThumbsSlide = thumbsSwiper.slides.find(slideEl => slideEl.getAttribute('data-swiper-slide-index') === `${swiper.realIndex}`); 8439 newThumbsIndex = thumbsSwiper.slides.indexOf(newThumbsSlide); 8440 direction = swiper.activeIndex > swiper.previousIndex ? 'next' : 'prev'; 8441 } else { 8442 newThumbsIndex = swiper.realIndex; 8443 direction = newThumbsIndex > swiper.previousIndex ? 'next' : 'prev'; 8444 } 8445 if (useOffset) { 8446 newThumbsIndex += direction === 'next' ? autoScrollOffset : -1 * autoScrollOffset; 8447 } 8448 if (thumbsSwiper.visibleSlidesIndexes && thumbsSwiper.visibleSlidesIndexes.indexOf(newThumbsIndex) < 0) { 8449 if (thumbsSwiper.params.centeredSlides) { 8450 if (newThumbsIndex > currentThumbsIndex) { 8451 newThumbsIndex = newThumbsIndex - Math.floor(slidesPerView / 2) + 1; 8452 } else { 8453 newThumbsIndex = newThumbsIndex + Math.floor(slidesPerView / 2) - 1; 8454 } 8455 } else if (newThumbsIndex > currentThumbsIndex && thumbsSwiper.params.slidesPerGroup === 1) ; 8456 thumbsSwiper.slideTo(newThumbsIndex, initial ? 0 : undefined); 8457 } 8458 } 8459 } 8460 on('beforeInit', () => { 8461 const { 8462 thumbs 8463 } = swiper.params; 8464 if (!thumbs || !thumbs.swiper) return; 8465 if (typeof thumbs.swiper === 'string' || thumbs.swiper instanceof HTMLElement) { 8466 const document = getDocument(); 8467 const getThumbsElementAndInit = () => { 8468 const thumbsElement = typeof thumbs.swiper === 'string' ? document.querySelector(thumbs.swiper) : thumbs.swiper; 8469 if (thumbsElement && thumbsElement.swiper) { 8470 thumbs.swiper = thumbsElement.swiper; 8471 init(); 8472 update(true); 8473 } else if (thumbsElement) { 8474 const eventName = `${swiper.params.eventsPrefix}init`; 8475 const onThumbsSwiper = e => { 8476 thumbs.swiper = e.detail[0]; 8477 thumbsElement.removeEventListener(eventName, onThumbsSwiper); 8478 init(); 8479 update(true); 8480 thumbs.swiper.update(); 8481 swiper.update(); 8482 }; 8483 thumbsElement.addEventListener(eventName, onThumbsSwiper); 8484 } 8485 return thumbsElement; 8486 }; 8487 const watchForThumbsToAppear = () => { 8488 if (swiper.destroyed) return; 8489 const thumbsElement = getThumbsElementAndInit(); 8490 if (!thumbsElement) { 8491 requestAnimationFrame(watchForThumbsToAppear); 8492 } 8493 }; 8494 requestAnimationFrame(watchForThumbsToAppear); 8495 } else { 8496 init(); 8497 update(true); 8498 } 8499 }); 8500 on('slideChange update resize observerUpdate', () => { 8501 update(); 8502 }); 8503 on('setTransition', (_s, duration) => { 8504 const thumbsSwiper = swiper.thumbs.swiper; 8505 if (!thumbsSwiper || thumbsSwiper.destroyed) return; 8506 thumbsSwiper.setTransition(duration); 8507 }); 8508 on('beforeDestroy', () => { 8509 const thumbsSwiper = swiper.thumbs.swiper; 8510 if (!thumbsSwiper || thumbsSwiper.destroyed) return; 8511 if (swiperCreated) { 8512 thumbsSwiper.destroy(); 8513 } 8514 }); 8515 Object.assign(swiper.thumbs, { 8516 init, 8517 update 8518 }); 8519} 8520 8521 8522 8523;// ./node_modules/swiper/modules/free-mode.mjs 8524 8525 8526function freeMode(_ref) { 8527 let { 8528 swiper, 8529 extendParams, 8530 emit, 8531 once 8532 } = _ref; 8533 extendParams({ 8534 freeMode: { 8535 enabled: false, 8536 momentum: true, 8537 momentumRatio: 1, 8538 momentumBounce: true, 8539 momentumBounceRatio: 1, 8540 momentumVelocityRatio: 1, 8541 sticky: false, 8542 minimumVelocity: 0.02 8543 } 8544 }); 8545 function onTouchStart() { 8546 if (swiper.params.cssMode) return; 8547 const translate = swiper.getTranslate(); 8548 swiper.setTranslate(translate); 8549 swiper.setTransition(0); 8550 swiper.touchEventsData.velocities.length = 0; 8551 swiper.freeMode.onTouchEnd({ 8552 currentPos: swiper.rtl ? swiper.translate : -swiper.translate 8553 }); 8554 } 8555 function onTouchMove() { 8556 if (swiper.params.cssMode) return; 8557 const { 8558 touchEventsData: data, 8559 touches 8560 } = swiper; 8561 // Velocity 8562 if (data.velocities.length === 0) { 8563 data.velocities.push({ 8564 position: touches[swiper.isHorizontal() ? 'startX' : 'startY'], 8565 time: data.touchStartTime 8566 }); 8567 } 8568 data.velocities.push({ 8569 position: touches[swiper.isHorizontal() ? 'currentX' : 'currentY'], 8570 time: now() 8571 }); 8572 } 8573 function onTouchEnd(_ref2) { 8574 let { 8575 currentPos 8576 } = _ref2; 8577 if (swiper.params.cssMode) return; 8578 const { 8579 params, 8580 wrapperEl, 8581 rtlTranslate: rtl, 8582 snapGrid, 8583 touchEventsData: data 8584 } = swiper; 8585 // Time diff 8586 const touchEndTime = now(); 8587 const timeDiff = touchEndTime - data.touchStartTime; 8588 if (currentPos < -swiper.minTranslate()) { 8589 swiper.slideTo(swiper.activeIndex); 8590 return; 8591 } 8592 if (currentPos > -swiper.maxTranslate()) { 8593 if (swiper.slides.length < snapGrid.length) { 8594 swiper.slideTo(snapGrid.length - 1); 8595 } else { 8596 swiper.slideTo(swiper.slides.length - 1); 8597 } 8598 return; 8599 } 8600 if (params.freeMode.momentum) { 8601 if (data.velocities.length > 1) { 8602 const lastMoveEvent = data.velocities.pop(); 8603 const velocityEvent = data.velocities.pop(); 8604 const distance = lastMoveEvent.position - velocityEvent.position; 8605 const time = lastMoveEvent.time - velocityEvent.time; 8606 swiper.velocity = distance / time; 8607 swiper.velocity /= 2; 8608 if (Math.abs(swiper.velocity) < params.freeMode.minimumVelocity) { 8609 swiper.velocity = 0; 8610 } 8611 // this implies that the user stopped moving a finger then released. 8612 // There would be no events with distance zero, so the last event is stale. 8613 if (time > 150 || now() - lastMoveEvent.time > 300) { 8614 swiper.velocity = 0; 8615 } 8616 } else { 8617 swiper.velocity = 0; 8618 } 8619 swiper.velocity *= params.freeMode.momentumVelocityRatio; 8620 data.velocities.length = 0; 8621 let momentumDuration = 1000 * params.freeMode.momentumRatio; 8622 const momentumDistance = swiper.velocity * momentumDuration; 8623 let newPosition = swiper.translate + momentumDistance; 8624 if (rtl) newPosition = -newPosition; 8625 let doBounce = false; 8626 let afterBouncePosition; 8627 const bounceAmount = Math.abs(swiper.velocity) * 20 * params.freeMode.momentumBounceRatio; 8628 let needsLoopFix; 8629 if (newPosition < swiper.maxTranslate()) { 8630 if (params.freeMode.momentumBounce) { 8631 if (newPosition + swiper.maxTranslate() < -bounceAmount) { 8632 newPosition = swiper.maxTranslate() - bounceAmount; 8633 } 8634 afterBouncePosition = swiper.maxTranslate(); 8635 doBounce = true; 8636 data.allowMomentumBounce = true; 8637 } else { 8638 newPosition = swiper.maxTranslate(); 8639 } 8640 if (params.loop && params.centeredSlides) needsLoopFix = true; 8641 } else if (newPosition > swiper.minTranslate()) { 8642 if (params.freeMode.momentumBounce) { 8643 if (newPosition - swiper.minTranslate() > bounceAmount) { 8644 newPosition = swiper.minTranslate() + bounceAmount; 8645 } 8646 afterBouncePosition = swiper.minTranslate(); 8647 doBounce = true; 8648 data.allowMomentumBounce = true; 8649 } else { 8650 newPosition = swiper.minTranslate(); 8651 } 8652 if (params.loop && params.centeredSlides) needsLoopFix = true; 8653 } else if (params.freeMode.sticky) { 8654 let nextSlide; 8655 for (let j = 0; j < snapGrid.length; j += 1) { 8656 if (snapGrid[j] > -newPosition) { 8657 nextSlide = j; 8658 break; 8659 } 8660 } 8661 if (Math.abs(snapGrid[nextSlide] - newPosition) < Math.abs(snapGrid[nextSlide - 1] - newPosition) || swiper.swipeDirection === 'next') { 8662 newPosition = snapGrid[nextSlide]; 8663 } else { 8664 newPosition = snapGrid[nextSlide - 1]; 8665 } 8666 newPosition = -newPosition; 8667 } 8668 if (needsLoopFix) { 8669 once('transitionEnd', () => { 8670 swiper.loopFix(); 8671 }); 8672 } 8673 // Fix duration 8674 if (swiper.velocity !== 0) { 8675 if (rtl) { 8676 momentumDuration = Math.abs((-newPosition - swiper.translate) / swiper.velocity); 8677 } else { 8678 momentumDuration = Math.abs((newPosition - swiper.translate) / swiper.velocity); 8679 } 8680 if (params.freeMode.sticky) { 8681 // If freeMode.sticky is active and the user ends a swipe with a slow-velocity 8682 // event, then durations can be 20+ seconds to slide one (or zero!) slides. 8683 // It's easy to see this when simulating touch with mouse events. To fix this, 8684 // limit single-slide swipes to the default slide duration. This also has the 8685 // nice side effect of matching slide speed if the user stopped moving before 8686 // lifting finger or mouse vs. moving slowly before lifting the finger/mouse. 8687 // For faster swipes, also apply limits (albeit higher ones). 8688 const moveDistance = Math.abs((rtl ? -newPosition : newPosition) - swiper.translate); 8689 const currentSlideSize = swiper.slidesSizesGrid[swiper.activeIndex]; 8690 if (moveDistance < currentSlideSize) { 8691 momentumDuration = params.speed; 8692 } else if (moveDistance < 2 * currentSlideSize) { 8693 momentumDuration = params.speed * 1.5; 8694 } else { 8695 momentumDuration = params.speed * 2.5; 8696 } 8697 } 8698 } else if (params.freeMode.sticky) { 8699 swiper.slideToClosest(); 8700 return; 8701 } 8702 if (params.freeMode.momentumBounce && doBounce) { 8703 swiper.updateProgress(afterBouncePosition); 8704 swiper.setTransition(momentumDuration); 8705 swiper.setTranslate(newPosition); 8706 swiper.transitionStart(true, swiper.swipeDirection); 8707 swiper.animating = true; 8708 elementTransitionEnd(wrapperEl, () => { 8709 if (!swiper || swiper.destroyed || !data.allowMomentumBounce) return; 8710 emit('momentumBounce'); 8711 swiper.setTransition(params.speed); 8712 setTimeout(() => { 8713 swiper.setTranslate(afterBouncePosition); 8714 elementTransitionEnd(wrapperEl, () => { 8715 if (!swiper || swiper.destroyed) return; 8716 swiper.transitionEnd(); 8717 }); 8718 }, 0); 8719 }); 8720 } else if (swiper.velocity) { 8721 emit('_freeModeNoMomentumRelease'); 8722 swiper.updateProgress(newPosition); 8723 swiper.setTransition(momentumDuration); 8724 swiper.setTranslate(newPosition); 8725 swiper.transitionStart(true, swiper.swipeDirection); 8726 if (!swiper.animating) { 8727 swiper.animating = true; 8728 elementTransitionEnd(wrapperEl, () => { 8729 if (!swiper || swiper.destroyed) return; 8730 swiper.transitionEnd(); 8731 }); 8732 } 8733 } else { 8734 swiper.updateProgress(newPosition); 8735 } 8736 swiper.updateActiveIndex(); 8737 swiper.updateSlidesClasses(); 8738 } else if (params.freeMode.sticky) { 8739 swiper.slideToClosest(); 8740 return; 8741 } else if (params.freeMode) { 8742 emit('_freeModeNoMomentumRelease'); 8743 } 8744 if (!params.freeMode.momentum || timeDiff >= params.longSwipesMs) { 8745 emit('_freeModeStaticRelease'); 8746 swiper.updateProgress(); 8747 swiper.updateActiveIndex(); 8748 swiper.updateSlidesClasses(); 8749 } 8750 } 8751 Object.assign(swiper, { 8752 freeMode: { 8753 onTouchStart, 8754 onTouchMove, 8755 onTouchEnd 8756 } 8757 }); 8758} 8759 8760 8761 8762;// ./node_modules/swiper/modules/grid.mjs 8763function Grid(_ref) { 8764 let { 8765 swiper, 8766 extendParams, 8767 on 8768 } = _ref; 8769 extendParams({ 8770 grid: { 8771 rows: 1, 8772 fill: 'column' 8773 } 8774 });
vendor: 1,256 bytes, lines 8775-8809
8775 let slidesNumberEvenToRows; 8776 let slidesPerRow; 8777 let numFullColumns; 8778 let wasMultiRow; 8779 const getSpaceBetween = () => { 8780 let spaceBetween = swiper.params.spaceBetween; 8781 if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) { 8782 spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiper.size; 8783 } else if (typeof spaceBetween === 'string') { 8784 spaceBetween = parseFloat(spaceBetween); 8785 } 8786 return spaceBetween; 8787 }; 8788 const initSlides = slides => { 8789 const { 8790 slidesPerView 8791 } = swiper.params; 8792 const { 8793 rows, 8794 fill 8795 } = swiper.params.grid; 8796 const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : slides.length; 8797 numFullColumns = Math.floor(slidesLength / rows); 8798 if (Math.floor(slidesLength / rows) === slidesLength / rows) { 8799 slidesNumberEvenToRows = slidesLength; 8800 } else { 8801 slidesNumberEvenToRows = Math.ceil(slidesLength / rows) * rows; 8802 } 8803 if (slidesPerView !== 'auto' && fill === 'row') { 8804 slidesNumberEvenToRows = Math.max(slidesNumberEvenToRows, slidesPerView * rows); 8805 } 8806 slidesPerRow = slidesNumberEvenToRows / rows; 8807 }; 8808 const unsetSlides = () => { 8809 if (swiper.slides) {
vendor: 37,086 bytes, lines 8810-9961
8810 swiper.slides.forEach(slide => { 8811 if (slide.swiperSlideGridSet) { 8812 slide.style.height = ''; 8813 slide.style[swiper.getDirectionLabel('margin-top')] = ''; 8814 } 8815 }); 8816 } 8817 }; 8818 const updateSlide = (i, slide, slides) => { 8819 const { 8820 slidesPerGroup 8821 } = swiper.params; 8822 const spaceBetween = getSpaceBetween(); 8823 const { 8824 rows, 8825 fill 8826 } = swiper.params.grid; 8827 const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : slides.length; 8828 // Set slides order 8829 let newSlideOrderIndex; 8830 let column; 8831 let row; 8832 if (fill === 'row' && slidesPerGroup > 1) { 8833 const groupIndex = Math.floor(i / (slidesPerGroup * rows)); 8834 const slideIndexInGroup = i - rows * slidesPerGroup * groupIndex; 8835 const columnsInGroup = groupIndex === 0 ? slidesPerGroup : Math.min(Math.ceil((slidesLength - groupIndex * rows * slidesPerGroup) / rows), slidesPerGroup); 8836 row = Math.floor(slideIndexInGroup / columnsInGroup); 8837 column = slideIndexInGroup - row * columnsInGroup + groupIndex * slidesPerGroup; 8838 newSlideOrderIndex = column + row * slidesNumberEvenToRows / rows; 8839 slide.style.order = newSlideOrderIndex; 8840 } else if (fill === 'column') { 8841 column = Math.floor(i / rows); 8842 row = i - column * rows; 8843 if (column > numFullColumns || column === numFullColumns && row === rows - 1) { 8844 row += 1; 8845 if (row >= rows) { 8846 row = 0; 8847 column += 1; 8848 } 8849 } 8850 } else { 8851 row = Math.floor(i / slidesPerRow); 8852 column = i - row * slidesPerRow; 8853 } 8854 slide.row = row; 8855 slide.column = column; 8856 slide.style.height = `calc((100% - ${(rows - 1) * spaceBetween}px) / ${rows})`; 8857 slide.style[swiper.getDirectionLabel('margin-top')] = row !== 0 ? spaceBetween && `${spaceBetween}px` : ''; 8858 slide.swiperSlideGridSet = true; 8859 }; 8860 const updateWrapperSize = (slideSize, snapGrid) => { 8861 const { 8862 centeredSlides, 8863 roundLengths 8864 } = swiper.params; 8865 const spaceBetween = getSpaceBetween(); 8866 const { 8867 rows 8868 } = swiper.params.grid; 8869 swiper.virtualSize = (slideSize + spaceBetween) * slidesNumberEvenToRows; 8870 swiper.virtualSize = Math.ceil(swiper.virtualSize / rows) - spaceBetween; 8871 if (!swiper.params.cssMode) { 8872 swiper.wrapperEl.style[swiper.getDirectionLabel('width')] = `${swiper.virtualSize + spaceBetween}px`; 8873 } 8874 if (centeredSlides) { 8875 const newSlidesGrid = []; 8876 for (let i = 0; i < snapGrid.length; i += 1) { 8877 let slidesGridItem = snapGrid[i]; 8878 if (roundLengths) slidesGridItem = Math.floor(slidesGridItem); 8879 if (snapGrid[i] < swiper.virtualSize + snapGrid[0]) newSlidesGrid.push(slidesGridItem); 8880 } 8881 snapGrid.splice(0, snapGrid.length); 8882 snapGrid.push(...newSlidesGrid); 8883 } 8884 }; 8885 const onInit = () => { 8886 wasMultiRow = swiper.params.grid && swiper.params.grid.rows > 1; 8887 }; 8888 const onUpdate = () => { 8889 const { 8890 params, 8891 el 8892 } = swiper; 8893 const isMultiRow = params.grid && params.grid.rows > 1; 8894 if (wasMultiRow && !isMultiRow) { 8895 el.classList.remove(`${params.containerModifierClass}grid`, `${params.containerModifierClass}grid-column`); 8896 numFullColumns = 1; 8897 swiper.emitContainerClasses(); 8898 } else if (!wasMultiRow && isMultiRow) { 8899 el.classList.add(`${params.containerModifierClass}grid`); 8900 if (params.grid.fill === 'column') { 8901 el.classList.add(`${params.containerModifierClass}grid-column`); 8902 } 8903 swiper.emitContainerClasses(); 8904 } 8905 wasMultiRow = isMultiRow; 8906 }; 8907 on('init', onInit); 8908 on('update', onUpdate); 8909 swiper.grid = { 8910 initSlides, 8911 unsetSlides, 8912 updateSlide, 8913 updateWrapperSize 8914 }; 8915} 8916 8917 8918 8919;// ./node_modules/swiper/modules/manipulation.mjs 8920function appendSlide(slides) { 8921 const swiper = this; 8922 const { 8923 params, 8924 slidesEl 8925 } = swiper; 8926 if (params.loop) { 8927 swiper.loopDestroy(); 8928 } 8929 const appendElement = slideEl => { 8930 if (typeof slideEl === 'string') { 8931 const tempDOM = document.createElement('div'); 8932 tempDOM.innerHTML = slideEl; 8933 slidesEl.append(tempDOM.children[0]); 8934 tempDOM.innerHTML = ''; 8935 } else { 8936 slidesEl.append(slideEl); 8937 } 8938 }; 8939 if (typeof slides === 'object' && 'length' in slides) { 8940 for (let i = 0; i < slides.length; i += 1) { 8941 if (slides[i]) appendElement(slides[i]); 8942 } 8943 } else { 8944 appendElement(slides); 8945 } 8946 swiper.recalcSlides(); 8947 if (params.loop) { 8948 swiper.loopCreate(); 8949 } 8950 if (!params.observer || swiper.isElement) { 8951 swiper.update(); 8952 } 8953} 8954 8955function prependSlide(slides) { 8956 const swiper = this; 8957 const { 8958 params, 8959 activeIndex, 8960 slidesEl 8961 } = swiper; 8962 if (params.loop) { 8963 swiper.loopDestroy(); 8964 } 8965 let newActiveIndex = activeIndex + 1; 8966 const prependElement = slideEl => { 8967 if (typeof slideEl === 'string') { 8968 const tempDOM = document.createElement('div'); 8969 tempDOM.innerHTML = slideEl; 8970 slidesEl.prepend(tempDOM.children[0]); 8971 tempDOM.innerHTML = ''; 8972 } else { 8973 slidesEl.prepend(slideEl); 8974 } 8975 }; 8976 if (typeof slides === 'object' && 'length' in slides) { 8977 for (let i = 0; i < slides.length; i += 1) { 8978 if (slides[i]) prependElement(slides[i]); 8979 } 8980 newActiveIndex = activeIndex + slides.length; 8981 } else { 8982 prependElement(slides); 8983 } 8984 swiper.recalcSlides(); 8985 if (params.loop) { 8986 swiper.loopCreate(); 8987 } 8988 if (!params.observer || swiper.isElement) { 8989 swiper.update(); 8990 } 8991 swiper.slideTo(newActiveIndex, 0, false); 8992} 8993 8994function addSlide(index, slides) { 8995 const swiper = this; 8996 const { 8997 params, 8998 activeIndex, 8999 slidesEl 9000 } = swiper; 9001 let activeIndexBuffer = activeIndex; 9002 if (params.loop) { 9003 activeIndexBuffer -= swiper.loopedSlides; 9004 swiper.loopDestroy(); 9005 swiper.recalcSlides(); 9006 } 9007 const baseLength = swiper.slides.length; 9008 if (index <= 0) { 9009 swiper.prependSlide(slides); 9010 return; 9011 } 9012 if (index >= baseLength) { 9013 swiper.appendSlide(slides); 9014 return; 9015 } 9016 let newActiveIndex = activeIndexBuffer > index ? activeIndexBuffer + 1 : activeIndexBuffer; 9017 const slidesBuffer = []; 9018 for (let i = baseLength - 1; i >= index; i -= 1) { 9019 const currentSlide = swiper.slides[i]; 9020 currentSlide.remove(); 9021 slidesBuffer.unshift(currentSlide); 9022 } 9023 if (typeof slides === 'object' && 'length' in slides) { 9024 for (let i = 0; i < slides.length; i += 1) { 9025 if (slides[i]) slidesEl.append(slides[i]); 9026 } 9027 newActiveIndex = activeIndexBuffer > index ? activeIndexBuffer + slides.length : activeIndexBuffer; 9028 } else { 9029 slidesEl.append(slides); 9030 } 9031 for (let i = 0; i < slidesBuffer.length; i += 1) { 9032 slidesEl.append(slidesBuffer[i]); 9033 } 9034 swiper.recalcSlides(); 9035 if (params.loop) { 9036 swiper.loopCreate(); 9037 } 9038 if (!params.observer || swiper.isElement) { 9039 swiper.update(); 9040 } 9041 if (params.loop) { 9042 swiper.slideTo(newActiveIndex + swiper.loopedSlides, 0, false); 9043 } else { 9044 swiper.slideTo(newActiveIndex, 0, false); 9045 } 9046} 9047 9048function removeSlide(slidesIndexes) { 9049 const swiper = this; 9050 const { 9051 params, 9052 activeIndex 9053 } = swiper; 9054 let activeIndexBuffer = activeIndex; 9055 if (params.loop) { 9056 activeIndexBuffer -= swiper.loopedSlides; 9057 swiper.loopDestroy(); 9058 } 9059 let newActiveIndex = activeIndexBuffer; 9060 let indexToRemove; 9061 if (typeof slidesIndexes === 'object' && 'length' in slidesIndexes) { 9062 for (let i = 0; i < slidesIndexes.length; i += 1) { 9063 indexToRemove = slidesIndexes[i]; 9064 if (swiper.slides[indexToRemove]) swiper.slides[indexToRemove].remove(); 9065 if (indexToRemove < newActiveIndex) newActiveIndex -= 1; 9066 } 9067 newActiveIndex = Math.max(newActiveIndex, 0); 9068 } else { 9069 indexToRemove = slidesIndexes; 9070 if (swiper.slides[indexToRemove]) swiper.slides[indexToRemove].remove(); 9071 if (indexToRemove < newActiveIndex) newActiveIndex -= 1; 9072 newActiveIndex = Math.max(newActiveIndex, 0); 9073 } 9074 swiper.recalcSlides(); 9075 if (params.loop) { 9076 swiper.loopCreate(); 9077 } 9078 if (!params.observer || swiper.isElement) { 9079 swiper.update(); 9080 } 9081 if (params.loop) { 9082 swiper.slideTo(newActiveIndex + swiper.loopedSlides, 0, false); 9083 } else { 9084 swiper.slideTo(newActiveIndex, 0, false); 9085 } 9086} 9087 9088function removeAllSlides() { 9089 const swiper = this; 9090 const slidesIndexes = []; 9091 for (let i = 0; i < swiper.slides.length; i += 1) { 9092 slidesIndexes.push(i); 9093 } 9094 swiper.removeSlide(slidesIndexes); 9095} 9096 9097function Manipulation(_ref) { 9098 let { 9099 swiper 9100 } = _ref; 9101 Object.assign(swiper, { 9102 appendSlide: appendSlide.bind(swiper), 9103 prependSlide: prependSlide.bind(swiper), 9104 addSlide: addSlide.bind(swiper), 9105 removeSlide: removeSlide.bind(swiper), 9106 removeAllSlides: removeAllSlides.bind(swiper) 9107 }); 9108} 9109 9110 9111 9112;// ./node_modules/swiper/shared/effect-init.mjs 9113function effectInit(params) { 9114 const { 9115 effect, 9116 swiper, 9117 on, 9118 setTranslate, 9119 setTransition, 9120 overwriteParams, 9121 perspective, 9122 recreateShadows, 9123 getEffectParams 9124 } = params; 9125 on('beforeInit', () => { 9126 if (swiper.params.effect !== effect) return; 9127 swiper.classNames.push(`${swiper.params.containerModifierClass}${effect}`); 9128 if (perspective && perspective()) { 9129 swiper.classNames.push(`${swiper.params.containerModifierClass}3d`); 9130 } 9131 const overwriteParamsResult = overwriteParams ? overwriteParams() : {}; 9132 Object.assign(swiper.params, overwriteParamsResult); 9133 Object.assign(swiper.originalParams, overwriteParamsResult); 9134 }); 9135 on('setTranslate', () => { 9136 if (swiper.params.effect !== effect) return; 9137 setTranslate(); 9138 }); 9139 on('setTransition', (_s, duration) => { 9140 if (swiper.params.effect !== effect) return; 9141 setTransition(duration); 9142 }); 9143 on('transitionEnd', () => { 9144 if (swiper.params.effect !== effect) return; 9145 if (recreateShadows) { 9146 if (!getEffectParams || !getEffectParams().slideShadows) return; 9147 // remove shadows 9148 swiper.slides.forEach(slideEl => { 9149 slideEl.querySelectorAll('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').forEach(shadowEl => shadowEl.remove()); 9150 }); 9151 // create new one 9152 recreateShadows(); 9153 } 9154 }); 9155 let requireUpdateOnVirtual; 9156 on('virtualUpdate', () => { 9157 if (swiper.params.effect !== effect) return; 9158 if (!swiper.slides.length) { 9159 requireUpdateOnVirtual = true; 9160 } 9161 requestAnimationFrame(() => { 9162 if (requireUpdateOnVirtual && swiper.slides && swiper.slides.length) { 9163 setTranslate(); 9164 requireUpdateOnVirtual = false; 9165 } 9166 }); 9167 }); 9168} 9169 9170 9171 9172;// ./node_modules/swiper/shared/effect-target.mjs 9173 9174 9175function effectTarget(effectParams, slideEl) { 9176 const transformEl = getSlideTransformEl(slideEl); 9177 if (transformEl !== slideEl) { 9178 transformEl.style.backfaceVisibility = 'hidden'; 9179 transformEl.style['-webkit-backface-visibility'] = 'hidden'; 9180 } 9181 return transformEl; 9182} 9183 9184 9185 9186;// ./node_modules/swiper/shared/effect-virtual-transition-end.mjs 9187 9188 9189function effectVirtualTransitionEnd(_ref) { 9190 let { 9191 swiper, 9192 duration, 9193 transformElements, 9194 allSlides 9195 } = _ref; 9196 const { 9197 activeIndex 9198 } = swiper; 9199 const getSlide = el => { 9200 if (!el.parentElement) { 9201 // assume shadow root 9202 const slide = swiper.slides.find(slideEl => slideEl.shadowRoot && slideEl.shadowRoot === el.parentNode); 9203 return slide; 9204 } 9205 return el.parentElement; 9206 }; 9207 if (swiper.params.virtualTranslate && duration !== 0) { 9208 let eventTriggered = false; 9209 let transitionEndTarget; 9210 if (allSlides) { 9211 transitionEndTarget = transformElements; 9212 } else { 9213 transitionEndTarget = transformElements.filter(transformEl => { 9214 const el = transformEl.classList.contains('swiper-slide-transform') ? getSlide(transformEl) : transformEl; 9215 return swiper.getSlideIndex(el) === activeIndex; 9216 }); 9217 } 9218 transitionEndTarget.forEach(el => { 9219 elementTransitionEnd(el, () => { 9220 if (eventTriggered) return; 9221 if (!swiper || swiper.destroyed) return; 9222 eventTriggered = true; 9223 swiper.animating = false; 9224 const evt = new window.CustomEvent('transitionend', { 9225 bubbles: true, 9226 cancelable: true 9227 }); 9228 swiper.wrapperEl.dispatchEvent(evt); 9229 }); 9230 }); 9231 } 9232} 9233 9234 9235 9236;// ./node_modules/swiper/modules/effect-fade.mjs 9237 9238 9239 9240 9241 9242function EffectFade(_ref) { 9243 let { 9244 swiper, 9245 extendParams, 9246 on 9247 } = _ref; 9248 extendParams({ 9249 fadeEffect: { 9250 crossFade: false 9251 } 9252 }); 9253 const setTranslate = () => { 9254 const { 9255 slides 9256 } = swiper; 9257 const params = swiper.params.fadeEffect; 9258 for (let i = 0; i < slides.length; i += 1) { 9259 const slideEl = swiper.slides[i]; 9260 const offset = slideEl.swiperSlideOffset; 9261 let tx = -offset; 9262 if (!swiper.params.virtualTranslate) tx -= swiper.translate; 9263 let ty = 0; 9264 if (!swiper.isHorizontal()) { 9265 ty = tx; 9266 tx = 0; 9267 } 9268 const slideOpacity = swiper.params.fadeEffect.crossFade ? Math.max(1 - Math.abs(slideEl.progress), 0) : 1 + Math.min(Math.max(slideEl.progress, -1), 0); 9269 const targetEl = effectTarget(params, slideEl); 9270 targetEl.style.opacity = slideOpacity; 9271 targetEl.style.transform = `translate3d(${tx}px, ${ty}px, 0px)`; 9272 } 9273 }; 9274 const setTransition = duration => { 9275 const transformElements = swiper.slides.map(slideEl => getSlideTransformEl(slideEl)); 9276 transformElements.forEach(el => { 9277 el.style.transitionDuration = `${duration}ms`; 9278 }); 9279 effectVirtualTransitionEnd({ 9280 swiper, 9281 duration, 9282 transformElements, 9283 allSlides: true 9284 }); 9285 }; 9286 effectInit({ 9287 effect: 'fade', 9288 swiper, 9289 on, 9290 setTranslate, 9291 setTransition, 9292 overwriteParams: () => ({ 9293 slidesPerView: 1, 9294 slidesPerGroup: 1, 9295 watchSlidesProgress: true, 9296 spaceBetween: 0, 9297 virtualTranslate: !swiper.params.cssMode 9298 }) 9299 }); 9300} 9301 9302 9303 9304;// ./node_modules/swiper/modules/effect-cube.mjs 9305 9306 9307 9308function EffectCube(_ref) { 9309 let { 9310 swiper, 9311 extendParams, 9312 on 9313 } = _ref; 9314 extendParams({ 9315 cubeEffect: { 9316 slideShadows: true, 9317 shadow: true, 9318 shadowOffset: 20, 9319 shadowScale: 0.94 9320 } 9321 }); 9322 const createSlideShadows = (slideEl, progress, isHorizontal) => { 9323 let shadowBefore = isHorizontal ? slideEl.querySelector('.swiper-slide-shadow-left') : slideEl.querySelector('.swiper-slide-shadow-top'); 9324 let shadowAfter = isHorizontal ? slideEl.querySelector('.swiper-slide-shadow-right') : slideEl.querySelector('.swiper-slide-shadow-bottom'); 9325 if (!shadowBefore) { 9326 shadowBefore = createElement('div', `swiper-slide-shadow-cube swiper-slide-shadow-${isHorizontal ? 'left' : 'top'}`.split(' ')); 9327 slideEl.append(shadowBefore); 9328 } 9329 if (!shadowAfter) { 9330 shadowAfter = createElement('div', `swiper-slide-shadow-cube swiper-slide-shadow-${isHorizontal ? 'right' : 'bottom'}`.split(' ')); 9331 slideEl.append(shadowAfter); 9332 } 9333 if (shadowBefore) shadowBefore.style.opacity = Math.max(-progress, 0); 9334 if (shadowAfter) shadowAfter.style.opacity = Math.max(progress, 0); 9335 }; 9336 const recreateShadows = () => { 9337 // create new ones 9338 const isHorizontal = swiper.isHorizontal(); 9339 swiper.slides.forEach(slideEl => { 9340 const progress = Math.max(Math.min(slideEl.progress, 1), -1); 9341 createSlideShadows(slideEl, progress, isHorizontal); 9342 }); 9343 }; 9344 const setTranslate = () => { 9345 const { 9346 el, 9347 wrapperEl, 9348 slides, 9349 width: swiperWidth, 9350 height: swiperHeight, 9351 rtlTranslate: rtl, 9352 size: swiperSize, 9353 browser 9354 } = swiper; 9355 const r = getRotateFix(swiper); 9356 const params = swiper.params.cubeEffect; 9357 const isHorizontal = swiper.isHorizontal(); 9358 const isVirtual = swiper.virtual && swiper.params.virtual.enabled; 9359 let wrapperRotate = 0; 9360 let cubeShadowEl; 9361 if (params.shadow) { 9362 if (isHorizontal) { 9363 cubeShadowEl = swiper.wrapperEl.querySelector('.swiper-cube-shadow'); 9364 if (!cubeShadowEl) { 9365 cubeShadowEl = createElement('div', 'swiper-cube-shadow'); 9366 swiper.wrapperEl.append(cubeShadowEl); 9367 } 9368 cubeShadowEl.style.height = `${swiperWidth}px`; 9369 } else { 9370 cubeShadowEl = el.querySelector('.swiper-cube-shadow'); 9371 if (!cubeShadowEl) { 9372 cubeShadowEl = createElement('div', 'swiper-cube-shadow'); 9373 el.append(cubeShadowEl); 9374 } 9375 } 9376 } 9377 for (let i = 0; i < slides.length; i += 1) { 9378 const slideEl = slides[i]; 9379 let slideIndex = i; 9380 if (isVirtual) { 9381 slideIndex = parseInt(slideEl.getAttribute('data-swiper-slide-index'), 10); 9382 } 9383 let slideAngle = slideIndex * 90; 9384 let round = Math.floor(slideAngle / 360); 9385 if (rtl) { 9386 slideAngle = -slideAngle; 9387 round = Math.floor(-slideAngle / 360); 9388 } 9389 const progress = Math.max(Math.min(slideEl.progress, 1), -1); 9390 let tx = 0; 9391 let ty = 0; 9392 let tz = 0; 9393 if (slideIndex % 4 === 0) { 9394 tx = -round * 4 * swiperSize; 9395 tz = 0; 9396 } else if ((slideIndex - 1) % 4 === 0) { 9397 tx = 0; 9398 tz = -round * 4 * swiperSize; 9399 } else if ((slideIndex - 2) % 4 === 0) { 9400 tx = swiperSize + round * 4 * swiperSize; 9401 tz = swiperSize; 9402 } else if ((slideIndex - 3) % 4 === 0) { 9403 tx = -swiperSize; 9404 tz = 3 * swiperSize + swiperSize * 4 * round; 9405 } 9406 if (rtl) { 9407 tx = -tx; 9408 } 9409 if (!isHorizontal) { 9410 ty = tx; 9411 tx = 0; 9412 } 9413 const transform = `rotateX(${r(isHorizontal ? 0 : -slideAngle)}deg) rotateY(${r(isHorizontal ? slideAngle : 0)}deg) translate3d(${tx}px, ${ty}px, ${tz}px)`; 9414 if (progress <= 1 && progress > -1) { 9415 wrapperRotate = slideIndex * 90 + progress * 90; 9416 if (rtl) wrapperRotate = -slideIndex * 90 - progress * 90; 9417 } 9418 slideEl.style.transform = transform; 9419 if (params.slideShadows) { 9420 createSlideShadows(slideEl, progress, isHorizontal); 9421 } 9422 } 9423 wrapperEl.style.transformOrigin = `50% 50% -${swiperSize / 2}px`; 9424 wrapperEl.style['-webkit-transform-origin'] = `50% 50% -${swiperSize / 2}px`; 9425 if (params.shadow) { 9426 if (isHorizontal) { 9427 cubeShadowEl.style.transform = `translate3d(0px, ${swiperWidth / 2 + params.shadowOffset}px, ${-swiperWidth / 2}px) rotateX(89.99deg) rotateZ(0deg) scale(${params.shadowScale})`; 9428 } else { 9429 const shadowAngle = Math.abs(wrapperRotate) - Math.floor(Math.abs(wrapperRotate) / 90) * 90; 9430 const multiplier = 1.5 - (Math.sin(shadowAngle * 2 * Math.PI / 360) / 2 + Math.cos(shadowAngle * 2 * Math.PI / 360) / 2); 9431 const scale1 = params.shadowScale; 9432 const scale2 = params.shadowScale / multiplier; 9433 const offset = params.shadowOffset; 9434 cubeShadowEl.style.transform = `scale3d(${scale1}, 1, ${scale2}) translate3d(0px, ${swiperHeight / 2 + offset}px, ${-swiperHeight / 2 / scale2}px) rotateX(-89.99deg)`; 9435 } 9436 } 9437 const zFactor = (browser.isSafari || browser.isWebView) && browser.needPerspectiveFix ? -swiperSize / 2 : 0; 9438 wrapperEl.style.transform = `translate3d(0px,0,${zFactor}px) rotateX(${r(swiper.isHorizontal() ? 0 : wrapperRotate)}deg) rotateY(${r(swiper.isHorizontal() ? -wrapperRotate : 0)}deg)`; 9439 wrapperEl.style.setProperty('--swiper-cube-translate-z', `${zFactor}px`); 9440 }; 9441 const setTransition = duration => { 9442 const { 9443 el, 9444 slides 9445 } = swiper; 9446 slides.forEach(slideEl => { 9447 slideEl.style.transitionDuration = `${duration}ms`; 9448 slideEl.querySelectorAll('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').forEach(subEl => { 9449 subEl.style.transitionDuration = `${duration}ms`; 9450 }); 9451 }); 9452 if (swiper.params.cubeEffect.shadow && !swiper.isHorizontal()) { 9453 const shadowEl = el.querySelector('.swiper-cube-shadow'); 9454 if (shadowEl) shadowEl.style.transitionDuration = `${duration}ms`; 9455 } 9456 }; 9457 effectInit({ 9458 effect: 'cube', 9459 swiper, 9460 on, 9461 setTranslate, 9462 setTransition, 9463 recreateShadows, 9464 getEffectParams: () => swiper.params.cubeEffect, 9465 perspective: () => true, 9466 overwriteParams: () => ({ 9467 slidesPerView: 1, 9468 slidesPerGroup: 1, 9469 watchSlidesProgress: true, 9470 resistanceRatio: 0, 9471 spaceBetween: 0, 9472 centeredSlides: false, 9473 virtualTranslate: true 9474 }) 9475 }); 9476} 9477 9478 9479 9480;// ./node_modules/swiper/shared/create-shadow.mjs 9481 9482 9483function createShadow(suffix, slideEl, side) { 9484 const shadowClass = `swiper-slide-shadow${side ? `-${side}` : ''}${suffix ? ` swiper-slide-shadow-${suffix}` : ''}`; 9485 const shadowContainer = getSlideTransformEl(slideEl); 9486 let shadowEl = shadowContainer.querySelector(`.${shadowClass.split(' ').join('.')}`); 9487 if (!shadowEl) { 9488 shadowEl = createElement('div', shadowClass.split(' ')); 9489 shadowContainer.append(shadowEl); 9490 } 9491 return shadowEl; 9492} 9493 9494 9495 9496;// ./node_modules/swiper/modules/effect-flip.mjs 9497 9498 9499 9500 9501 9502 9503function EffectFlip(_ref) { 9504 let { 9505 swiper, 9506 extendParams, 9507 on 9508 } = _ref; 9509 extendParams({ 9510 flipEffect: { 9511 slideShadows: true, 9512 limitRotation: true 9513 } 9514 }); 9515 const createSlideShadows = (slideEl, progress) => { 9516 let shadowBefore = swiper.isHorizontal() ? slideEl.querySelector('.swiper-slide-shadow-left') : slideEl.querySelector('.swiper-slide-shadow-top'); 9517 let shadowAfter = swiper.isHorizontal() ? slideEl.querySelector('.swiper-slide-shadow-right') : slideEl.querySelector('.swiper-slide-shadow-bottom'); 9518 if (!shadowBefore) { 9519 shadowBefore = createShadow('flip', slideEl, swiper.isHorizontal() ? 'left' : 'top'); 9520 } 9521 if (!shadowAfter) { 9522 shadowAfter = createShadow('flip', slideEl, swiper.isHorizontal() ? 'right' : 'bottom'); 9523 } 9524 if (shadowBefore) shadowBefore.style.opacity = Math.max(-progress, 0); 9525 if (shadowAfter) shadowAfter.style.opacity = Math.max(progress, 0); 9526 }; 9527 const recreateShadows = () => { 9528 // Set shadows 9529 swiper.params.flipEffect; 9530 swiper.slides.forEach(slideEl => { 9531 let progress = slideEl.progress; 9532 if (swiper.params.flipEffect.limitRotation) { 9533 progress = Math.max(Math.min(slideEl.progress, 1), -1); 9534 } 9535 createSlideShadows(slideEl, progress); 9536 }); 9537 }; 9538 const setTranslate = () => { 9539 const { 9540 slides, 9541 rtlTranslate: rtl 9542 } = swiper; 9543 const params = swiper.params.flipEffect; 9544 const rotateFix = getRotateFix(swiper); 9545 for (let i = 0; i < slides.length; i += 1) { 9546 const slideEl = slides[i]; 9547 let progress = slideEl.progress; 9548 if (swiper.params.flipEffect.limitRotation) { 9549 progress = Math.max(Math.min(slideEl.progress, 1), -1); 9550 } 9551 const offset = slideEl.swiperSlideOffset; 9552 const rotate = -180 * progress; 9553 let rotateY = rotate; 9554 let rotateX = 0; 9555 let tx = swiper.params.cssMode ? -offset - swiper.translate : -offset; 9556 let ty = 0; 9557 if (!swiper.isHorizontal()) { 9558 ty = tx; 9559 tx = 0; 9560 rotateX = -rotateY; 9561 rotateY = 0; 9562 } else if (rtl) { 9563 rotateY = -rotateY; 9564 } 9565 slideEl.style.zIndex = -Math.abs(Math.round(progress)) + slides.length; 9566 if (params.slideShadows) { 9567 createSlideShadows(slideEl, progress); 9568 } 9569 const transform = `translate3d(${tx}px, ${ty}px, 0px) rotateX(${rotateFix(rotateX)}deg) rotateY(${rotateFix(rotateY)}deg)`; 9570 const targetEl = effectTarget(params, slideEl); 9571 targetEl.style.transform = transform; 9572 } 9573 }; 9574 const setTransition = duration => { 9575 const transformElements = swiper.slides.map(slideEl => getSlideTransformEl(slideEl)); 9576 transformElements.forEach(el => { 9577 el.style.transitionDuration = `${duration}ms`; 9578 el.querySelectorAll('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').forEach(shadowEl => { 9579 shadowEl.style.transitionDuration = `${duration}ms`; 9580 }); 9581 }); 9582 effectVirtualTransitionEnd({ 9583 swiper, 9584 duration, 9585 transformElements 9586 }); 9587 }; 9588 effectInit({ 9589 effect: 'flip', 9590 swiper, 9591 on, 9592 setTranslate, 9593 setTransition, 9594 recreateShadows, 9595 getEffectParams: () => swiper.params.flipEffect, 9596 perspective: () => true, 9597 overwriteParams: () => ({ 9598 slidesPerView: 1, 9599 slidesPerGroup: 1, 9600 watchSlidesProgress: true, 9601 spaceBetween: 0, 9602 virtualTranslate: !swiper.params.cssMode 9603 }) 9604 }); 9605} 9606 9607 9608 9609;// ./node_modules/swiper/modules/effect-coverflow.mjs 9610 9611 9612 9613 9614 9615function EffectCoverflow(_ref) { 9616 let { 9617 swiper, 9618 extendParams, 9619 on 9620 } = _ref; 9621 extendParams({ 9622 coverflowEffect: { 9623 rotate: 50, 9624 stretch: 0, 9625 depth: 100, 9626 scale: 1, 9627 modifier: 1, 9628 slideShadows: true 9629 } 9630 }); 9631 const setTranslate = () => { 9632 const { 9633 width: swiperWidth, 9634 height: swiperHeight, 9635 slides, 9636 slidesSizesGrid 9637 } = swiper; 9638 const params = swiper.params.coverflowEffect; 9639 const isHorizontal = swiper.isHorizontal(); 9640 const transform = swiper.translate; 9641 const center = isHorizontal ? -transform + swiperWidth / 2 : -transform + swiperHeight / 2; 9642 const rotate = isHorizontal ? params.rotate : -params.rotate; 9643 const translate = params.depth; 9644 const r = getRotateFix(swiper); 9645 // Each slide offset from center 9646 for (let i = 0, length = slides.length; i < length; i += 1) { 9647 const slideEl = slides[i]; 9648 const slideSize = slidesSizesGrid[i]; 9649 const slideOffset = slideEl.swiperSlideOffset; 9650 const centerOffset = (center - slideOffset - slideSize / 2) / slideSize; 9651 const offsetMultiplier = typeof params.modifier === 'function' ? params.modifier(centerOffset) : centerOffset * params.modifier; 9652 let rotateY = isHorizontal ? rotate * offsetMultiplier : 0; 9653 let rotateX = isHorizontal ? 0 : rotate * offsetMultiplier; 9654 // var rotateZ = 0 9655 let translateZ = -translate * Math.abs(offsetMultiplier); 9656 let stretch = params.stretch; 9657 // Allow percentage to make a relative stretch for responsive sliders 9658 if (typeof stretch === 'string' && stretch.indexOf('%') !== -1) { 9659 stretch = parseFloat(params.stretch) / 100 * slideSize; 9660 } 9661 let translateY = isHorizontal ? 0 : stretch * offsetMultiplier; 9662 let translateX = isHorizontal ? stretch * offsetMultiplier : 0; 9663 let scale = 1 - (1 - params.scale) * Math.abs(offsetMultiplier); 9664 9665 // Fix for ultra small values 9666 if (Math.abs(translateX) < 0.001) translateX = 0; 9667 if (Math.abs(translateY) < 0.001) translateY = 0; 9668 if (Math.abs(translateZ) < 0.001) translateZ = 0; 9669 if (Math.abs(rotateY) < 0.001) rotateY = 0; 9670 if (Math.abs(rotateX) < 0.001) rotateX = 0; 9671 if (Math.abs(scale) < 0.001) scale = 0; 9672 const slideTransform = `translate3d(${translateX}px,${translateY}px,${translateZ}px) rotateX(${r(rotateX)}deg) rotateY(${r(rotateY)}deg) scale(${scale})`; 9673 const targetEl = effectTarget(params, slideEl); 9674 targetEl.style.transform = slideTransform; 9675 slideEl.style.zIndex = -Math.abs(Math.round(offsetMultiplier)) + 1; 9676 if (params.slideShadows) { 9677 // Set shadows 9678 let shadowBeforeEl = isHorizontal ? slideEl.querySelector('.swiper-slide-shadow-left') : slideEl.querySelector('.swiper-slide-shadow-top'); 9679 let shadowAfterEl = isHorizontal ? slideEl.querySelector('.swiper-slide-shadow-right') : slideEl.querySelector('.swiper-slide-shadow-bottom'); 9680 if (!shadowBeforeEl) { 9681 shadowBeforeEl = createShadow('coverflow', slideEl, isHorizontal ? 'left' : 'top'); 9682 } 9683 if (!shadowAfterEl) { 9684 shadowAfterEl = createShadow('coverflow', slideEl, isHorizontal ? 'right' : 'bottom'); 9685 } 9686 if (shadowBeforeEl) shadowBeforeEl.style.opacity = offsetMultiplier > 0 ? offsetMultiplier : 0; 9687 if (shadowAfterEl) shadowAfterEl.style.opacity = -offsetMultiplier > 0 ? -offsetMultiplier : 0; 9688 } 9689 } 9690 }; 9691 const setTransition = duration => { 9692 const transformElements = swiper.slides.map(slideEl => getSlideTransformEl(slideEl)); 9693 transformElements.forEach(el => { 9694 el.style.transitionDuration = `${duration}ms`; 9695 el.querySelectorAll('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').forEach(shadowEl => { 9696 shadowEl.style.transitionDuration = `${duration}ms`; 9697 }); 9698 }); 9699 }; 9700 effectInit({ 9701 effect: 'coverflow', 9702 swiper, 9703 on, 9704 setTranslate, 9705 setTransition, 9706 perspective: () => true, 9707 overwriteParams: () => ({ 9708 watchSlidesProgress: true 9709 }) 9710 }); 9711} 9712 9713 9714 9715;// ./node_modules/swiper/modules/effect-creative.mjs 9716 9717 9718 9719 9720 9721 9722function EffectCreative(_ref) { 9723 let { 9724 swiper, 9725 extendParams, 9726 on 9727 } = _ref; 9728 extendParams({ 9729 creativeEffect: { 9730 limitProgress: 1, 9731 shadowPerProgress: false, 9732 progressMultiplier: 1, 9733 perspective: true, 9734 prev: { 9735 translate: [0, 0, 0], 9736 rotate: [0, 0, 0], 9737 opacity: 1, 9738 scale: 1 9739 }, 9740 next: { 9741 translate: [0, 0, 0], 9742 rotate: [0, 0, 0], 9743 opacity: 1, 9744 scale: 1 9745 } 9746 } 9747 }); 9748 const getTranslateValue = value => { 9749 if (typeof value === 'string') return value; 9750 return `${value}px`; 9751 }; 9752 const setTranslate = () => { 9753 const { 9754 slides, 9755 wrapperEl, 9756 slidesSizesGrid 9757 } = swiper; 9758 const params = swiper.params.creativeEffect; 9759 const { 9760 progressMultiplier: multiplier 9761 } = params; 9762 const isCenteredSlides = swiper.params.centeredSlides; 9763 const rotateFix = getRotateFix(swiper); 9764 if (isCenteredSlides) { 9765 const margin = slidesSizesGrid[0] / 2 - swiper.params.slidesOffsetBefore || 0; 9766 wrapperEl.style.transform = `translateX(calc(50% - ${margin}px))`; 9767 } 9768 for (let i = 0; i < slides.length; i += 1) { 9769 const slideEl = slides[i]; 9770 const slideProgress = slideEl.progress; 9771 const progress = Math.min(Math.max(slideEl.progress, -params.limitProgress), params.limitProgress); 9772 let originalProgress = progress; 9773 if (!isCenteredSlides) { 9774 originalProgress = Math.min(Math.max(slideEl.originalProgress, -params.limitProgress), params.limitProgress); 9775 } 9776 const offset = slideEl.swiperSlideOffset; 9777 const t = [swiper.params.cssMode ? -offset - swiper.translate : -offset, 0, 0]; 9778 const r = [0, 0, 0]; 9779 let custom = false; 9780 if (!swiper.isHorizontal()) { 9781 t[1] = t[0]; 9782 t[0] = 0; 9783 } 9784 let data = { 9785 translate: [0, 0, 0], 9786 rotate: [0, 0, 0], 9787 scale: 1, 9788 opacity: 1 9789 }; 9790 if (progress < 0) { 9791 data = params.next; 9792 custom = true; 9793 } else if (progress > 0) { 9794 data = params.prev; 9795 custom = true; 9796 } 9797 // set translate 9798 t.forEach((value, index) => { 9799 t[index] = `calc(${value}px + (${getTranslateValue(data.translate[index])} * ${Math.abs(progress * multiplier)}))`; 9800 }); 9801 // set rotates 9802 r.forEach((value, index) => { 9803 let val = data.rotate[index] * Math.abs(progress * multiplier); 9804 r[index] = val; 9805 }); 9806 slideEl.style.zIndex = -Math.abs(Math.round(slideProgress)) + slides.length; 9807 const translateString = t.join(', '); 9808 const rotateString = `rotateX(${rotateFix(r[0])}deg) rotateY(${rotateFix(r[1])}deg) rotateZ(${rotateFix(r[2])}deg)`; 9809 const scaleString = originalProgress < 0 ? `scale(${1 + (1 - data.scale) * originalProgress * multiplier})` : `scale(${1 - (1 - data.scale) * originalProgress * multiplier})`; 9810 const opacityString = originalProgress < 0 ? 1 + (1 - data.opacity) * originalProgress * multiplier : 1 - (1 - data.opacity) * originalProgress * multiplier; 9811 const transform = `translate3d(${translateString}) ${rotateString} ${scaleString}`; 9812 9813 // Set shadows 9814 if (custom && data.shadow || !custom) { 9815 let shadowEl = slideEl.querySelector('.swiper-slide-shadow'); 9816 if (!shadowEl && data.shadow) { 9817 shadowEl = createShadow('creative', slideEl); 9818 } 9819 if (shadowEl) { 9820 const shadowOpacity = params.shadowPerProgress ? progress * (1 / params.limitProgress) : progress; 9821 shadowEl.style.opacity = Math.min(Math.max(Math.abs(shadowOpacity), 0), 1); 9822 } 9823 } 9824 const targetEl = effectTarget(params, slideEl); 9825 targetEl.style.transform = transform; 9826 targetEl.style.opacity = opacityString; 9827 if (data.origin) { 9828 targetEl.style.transformOrigin = data.origin; 9829 } 9830 } 9831 }; 9832 const setTransition = duration => { 9833 const transformElements = swiper.slides.map(slideEl => getSlideTransformEl(slideEl)); 9834 transformElements.forEach(el => { 9835 el.style.transitionDuration = `${duration}ms`; 9836 el.querySelectorAll('.swiper-slide-shadow').forEach(shadowEl => { 9837 shadowEl.style.transitionDuration = `${duration}ms`; 9838 }); 9839 }); 9840 effectVirtualTransitionEnd({ 9841 swiper, 9842 duration, 9843 transformElements, 9844 allSlides: true 9845 }); 9846 }; 9847 effectInit({ 9848 effect: 'creative', 9849 swiper, 9850 on, 9851 setTranslate, 9852 setTransition, 9853 perspective: () => swiper.params.creativeEffect.perspective, 9854 overwriteParams: () => ({ 9855 watchSlidesProgress: true, 9856 virtualTranslate: !swiper.params.cssMode 9857 }) 9858 }); 9859} 9860 9861 9862 9863;// ./node_modules/swiper/modules/effect-cards.mjs 9864 9865 9866 9867 9868 9869 9870function EffectCards(_ref) { 9871 let { 9872 swiper, 9873 extendParams, 9874 on 9875 } = _ref; 9876 extendParams({ 9877 cardsEffect: { 9878 slideShadows: true, 9879 rotate: true, 9880 perSlideRotate: 2, 9881 perSlideOffset: 8 9882 } 9883 }); 9884 const setTranslate = () => { 9885 const { 9886 slides, 9887 activeIndex, 9888 rtlTranslate: rtl 9889 } = swiper; 9890 const params = swiper.params.cardsEffect; 9891 const { 9892 startTranslate, 9893 isTouched 9894 } = swiper.touchEventsData; 9895 const currentTranslate = rtl ? -swiper.translate : swiper.translate; 9896 for (let i = 0; i < slides.length; i += 1) { 9897 const slideEl = slides[i]; 9898 const slideProgress = slideEl.progress; 9899 const progress = Math.min(Math.max(slideProgress, -4), 4); 9900 let offset = slideEl.swiperSlideOffset; 9901 if (swiper.params.centeredSlides && !swiper.params.cssMode) { 9902 swiper.wrapperEl.style.transform = `translateX(${swiper.minTranslate()}px)`; 9903 } 9904 if (swiper.params.centeredSlides && swiper.params.cssMode) { 9905 offset -= slides[0].swiperSlideOffset; 9906 } 9907 let tX = swiper.params.cssMode ? -offset - swiper.translate : -offset; 9908 let tY = 0; 9909 const tZ = -100 * Math.abs(progress); 9910 let scale = 1; 9911 let rotate = -params.perSlideRotate * progress; 9912 let tXAdd = params.perSlideOffset - Math.abs(progress) * 0.75; 9913 const slideIndex = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.from + i : i; 9914 const isSwipeToNext = (slideIndex === activeIndex || slideIndex === activeIndex - 1) && progress > 0 && progress < 1 && (isTouched || swiper.params.cssMode) && currentTranslate < startTranslate; 9915 const isSwipeToPrev = (slideIndex === activeIndex || slideIndex === activeIndex + 1) && progress < 0 && progress > -1 && (isTouched || swiper.params.cssMode) && currentTranslate > startTranslate; 9916 if (isSwipeToNext || isSwipeToPrev) { 9917 const subProgress = (1 - Math.abs((Math.abs(progress) - 0.5) / 0.5)) ** 0.5; 9918 rotate += -28 * progress * subProgress; 9919 scale += -0.5 * subProgress; 9920 tXAdd += 96 * subProgress; 9921 tY = `${-25 * subProgress * Math.abs(progress)}%`; 9922 } 9923 if (progress < 0) { 9924 // next 9925 tX = `calc(${tX}px ${rtl ? '-' : '+'} (${tXAdd * Math.abs(progress)}%))`; 9926 } else if (progress > 0) { 9927 // prev 9928 tX = `calc(${tX}px ${rtl ? '-' : '+'} (-${tXAdd * Math.abs(progress)}%))`; 9929 } else { 9930 tX = `${tX}px`; 9931 } 9932 if (!swiper.isHorizontal()) { 9933 const prevY = tY; 9934 tY = tX; 9935 tX = prevY; 9936 } 9937 const scaleString = progress < 0 ? `${1 + (1 - scale) * progress}` : `${1 - (1 - scale) * progress}`; 9938 9939 /* eslint-disable */ 9940 const transform = ` 9941 translate3d(${tX}, ${tY}, ${tZ}px) 9942 rotateZ(${params.rotate ? rtl ? -rotate : rotate : 0}deg) 9943 scale(${scaleString}) 9944 `; 9945 /* eslint-enable */ 9946 9947 if (params.slideShadows) { 9948 // Set shadows 9949 let shadowEl = slideEl.querySelector('.swiper-slide-shadow'); 9950 if (!shadowEl) { 9951 shadowEl = createShadow('cards', slideEl); 9952 } 9953 if (shadowEl) shadowEl.style.opacity = Math.min(Math.max((Math.abs(progress) - 0.5) / 0.5, 0), 1); 9954 } 9955 slideEl.style.zIndex = -Math.abs(Math.round(slideProgress)) + slides.length; 9956 const targetEl = effectTarget(params, slideEl); 9957 targetEl.style.transform = transform; 9958 } 9959 }; 9960 const setTransition = duration => { 9961 const transformElements = swiper.slides.map(slideEl => getSlideTransformEl(slideEl));
9962 transformElements.forEach(el => { 9963 el.style.transitionDuration = `${duration}ms`; 9964 el.querySelectorAll('.swiper-slide-shadow').forEach(shadowEl => { 9965 shadowEl.style.transitionDuration = `${duration}ms`; 9966 }); 9967 }); 9968 effectVirtualTransitionEnd({ 9969 swiper, 9970 duration, 9971 transformElements 9972 }); 9973 }; 9974 effectInit({ 9975 effect: 'cards', 9976 swiper, 9977 on, 9978 setTranslate, 9979 setTransition, 9980 perspective: () => true, 9981 overwriteParams: () => ({ 9982 _loopSwapReset: false, 9983 watchSlidesProgress: true, 9984 loopAdditionalSlides: 3, 9985 centeredSlides: true, 9986 virtualTranslate: !swiper.params.cssMode 9987 }) 9988 }); 9989} 9990 9991 9992 9993;// ./node_modules/swiper/swiper-bundle.mjs 9994/** 9995 * Swiper 11.2.3 9996 * Most modern mobile touch slider and framework with hardware accelerated transitions 9997 * https://swiperjs.com 9998 * 9999 * Copyright 2014-2025 Vladimir Kharlampidi 10000 * 10001 * Released under the MIT License 10002 * 10003 * Released on: February 12, 2025 10004 */ 10005 10006 10007 10008 10009 10010 10011 10012 10013 10014 10015 10016 10017 10018 10019 10020 10021 10022 10023 10024 10025 10026 10027 10028 10029 10030 10031// Swiper Class 10032const modules = [Virtual, Keyboard, Mousewheel, Navigation, Pagination, Scrollbar, Parallax, Zoom, Controller, A11y, History, HashNavigation, Autoplay, Thumb, freeMode, Grid, Manipulation, EffectFade, EffectCube, EffectFlip, EffectCoverflow, EffectCreative, EffectCards]; 10033Swiper.use(modules); 10034 10035 10036 10037;// ./packages/portal/Resources/Private/Components/Structures/Hero/Components/Gallery/Scripts/swiper/_init.ts 10038 10039document.querySelectorAll('.heroGallery').forEach(gallery => { 10040 const items = gallery.querySelectorAll('.heroGallery__item'); 10041 const pagination = gallery.querySelector('.swiper-pagination'); 10042 const nextEl = gallery.querySelector('.swiper-button-next'); 10043 const prevEl = gallery.querySelector('.swiper-button-prev'); 10044 if (items.length >= 1) { 10045 new Swiper(gallery, { 10046 speed: 800, 10047 pagination: { 10048 el: pagination, 10049 clickable: true 10050 }, 10051 navigation: { 10052 nextEl: nextEl, 10053 prevEl: prevEl 10054 }, 10055 keyboard: { 10056 enabled: true 10057 }, 10058 a11y: { 10059 enabled: true, 10060 slideRole: '' 10061 } 10062 }); 10063 } 10064}); 10065})(); 10066 10067/******/ })() 10068;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.