1/* eslint-disable */ 2this.BX = this.BX || {}; 3(function (exports,ui_vue3) { 4 'use strict'; 5 6 var BackIcon = { 7 name: "BackIcon", 8 emits: ["click"], 9 // language=Vue 10 template: "\n <span class=\"search-icon search-icon_back\" @click=\"$emit('click')\">\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M10.4736 4.4707C10.7665 4.17781 11.2413 4.17781 11.5342 4.4707C11.827 4.7636 11.8271 5.23837 11.5342 5.53125L5.81445 11.251H20.0039C20.4181 11.251 20.7539 11.5868 20.7539 12.001C20.7539 12.4152 20.4181 12.751 20.0039 12.751H5.81445L11.5342 18.4707C11.827 18.7636 11.8271 19.2384 11.5342 19.5312C11.2413 19.8241 10.7665 19.8241 10.4736 19.5312L3.47363 12.5312C3.33299 12.3906 3.25392 12.1999 3.25391 12.001C3.25391 11.8021 3.333 11.6114 3.47363 11.4707L10.4736 4.4707Z\"\n fill=\"#B9BEC7\"\n />\n </svg>\n </span>\n " 11 }; 12 13 var ClearIcon = { 14 name: "ClearIcon", 15 emits: ["click"], 16 // language=Vue 17 template: "\n <span class=\"search-icon search-icon_clear\" @click=\"$emit('click')\">\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M15.6565 7.23169C15.9649 6.92377 16.4646 6.92443 16.7727 7.23267C17.0808 7.54102 17.081 8.04066 16.7727 8.34888L13.1194 12.0012L16.7717 15.6536C17.08 15.9618 17.0808 16.4614 16.7727 16.7698C16.4644 17.0781 15.9638 17.0781 15.6555 16.7698L12.0032 13.1174L8.35181 16.7688C8.04366 17.077 7.54396 17.0777 7.2356 16.7698C6.92729 16.4615 6.92643 15.9609 7.23462 15.6526L10.887 12.0012L7.23462 8.34888C6.92649 8.04054 6.92734 7.54091 7.2356 7.23267C7.54393 6.92438 8.04352 6.92433 8.35181 7.23267L12.0032 10.884L15.6565 7.23169Z\"\n fill=\"#989EAB\"\n />\n </svg>\n </span>\n " 18 }; 19 20 var SearchIcon = { 21 name: "SearchIcon", 22 emits: ["click"], 23 // language=Vue 24 template: "\n <span class=\"search-icon search-icon_search\" @click=\"$emit('click')\">\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M11.0088 3.00195C15.4265 3.00195 19.0078 6.58324 19.0078 11.001C19.0078 12.9393 18.3177 14.7175 17.1709 16.1016L20.5859 19.5176C20.8787 19.8105 20.8788 20.2853 20.5859 20.5781C20.2931 20.871 19.8183 20.8709 19.5254 20.5781L16.1094 17.1631C14.7253 18.3099 12.9471 19 11.0088 19C6.59105 19 3.00977 15.4187 3.00977 11.001C3.00977 6.58324 6.59105 3.00195 11.0088 3.00195ZM11.0088 4.50195C7.41948 4.50195 4.50977 7.41166 4.50977 11.001C4.50977 14.5903 7.41948 17.5 11.0088 17.5C12.8037 17.5 14.4276 16.7736 15.6045 15.5967C16.7814 14.4198 17.5078 12.7958 17.5078 11.001C17.5078 7.41166 14.5981 4.50195 11.0088 4.50195Z\"\n fill=\"#1E2024\"\n />\n </svg>\n </span>\n " 25 }; 26 27 var SearchBar = { 28 name: "SearchBar", 29 components: { 30 BackIcon: BackIcon, 31 ClearIcon: ClearIcon, 32 SearchIcon: SearchIcon 33 }, 34 props: { 35 modelValue: { 36 type: String, 37 "default": "" 38 }, 39 loading: { 40 type: Boolean, 41 "default": false 42 } 43 }, 44 emits: ["update:modelValue", "search", "clear", "back"], 45 computed: { 46 value: { 47 get: function get() { 48 return this.modelValue; 49 }, 50 set: function set(v) { 51 this.$emit("update:modelValue", v); 52 } 53 }, 54 hasValue: function hasValue() { 55 return this.value.length > 0; 56 } 57 }, 58 // language=Vue 59 template: "\n <div class=\"search__input\">\n <div class=\"search__field-container\">\n <BackIcon class=\"search__field-back\" @click=\"$emit('back')\"/>\n <input\n v-model=\"value\"\n type=\"text\"\n name=\"search\"\n class=\"search__field\"\n placeholder=\"\u0417\u0430\u043F\u0440\u043E\u0441\"\n @keyup.enter=\"$emit('search')\"\n >\n </div>\n <button\n v-if=\"hasValue\"\n class=\"search__clear\"\n type=\"button\"\n aria-label=\"\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C \u0437\u0430\u043F\u0440\u043E\u0441\"\n @click=\"$emit('clear')\"\n >\n <ClearIcon/>\n </button>\n <SearchIcon class=\"search__icon\" @click=\"$emit('search')\"/>\n </div>\n " 60 }; 61 62 /** 63 * SSR Window 5.0.1 64 * Better handling for window object in SSR environment 65 * https://github.com/nolimits4web/ssr-window 66 * 67 * Copyright 2025, Vladimir Kharlampidi 68 * 69 * Licensed under MIT 70 * 71 * Released on: June 27, 2025 72 */ 73 /* eslint-disable no-param-reassign */ 74 function isObject(obj) { 75 return obj !== null && babelHelpers["typeof"](obj) === 'object' && 'constructor' in obj && obj.constructor === Object; 76 }
77 function extend(target, src) { 78 if (target === void 0) { 79 target = {}; 80 } 81 if (src === void 0) { 82 src = {}; 83 } 84 var noExtend = ['__proto__', 'constructor', 'prototype']; 85 Object.keys(src).filter(function (key) { 86 return noExtend.indexOf(key) < 0; 87 }).forEach(function (key) { 88 if (typeof target[key] === 'undefined') target[key] = src[key];else if (isObject(src[key]) && isObject(target[key]) && Object.keys(src[key]).length > 0) { 89 extend(target[key], src[key]); 90 } 91 }); 92 } 93 var ssrDocument = { 94 body: {}, 95 addEventListener: function addEventListener() {}, 96 removeEventListener: function removeEventListener() {}, 97 activeElement: { 98 blur: function blur() {}, 99 nodeName: '' 100 }, 101 querySelector: function querySelector() { 102 return null; 103 }, 104 querySelectorAll: function querySelectorAll() { 105 return []; 106 }, 107 getElementById: function getElementById() { 108 return null; 109 }, 110 createEvent: function createEvent() { 111 return { 112 initEvent: function initEvent() {} 113 }; 114 }, 115 createElement: function createElement() { 116 return { 117 children: [], 118 childNodes: [], 119 style: {}, 120 setAttribute: function setAttribute() {}, 121 getElementsByTagName: function getElementsByTagName() { 122 return []; 123 } 124 }; 125 }, 126 createElementNS: function createElementNS() { 127 return {}; 128 }, 129 importNode: function importNode() { 130 return null; 131 }, 132 location: { 133 hash: '', 134 host: '', 135 hostname: '', 136 href: '', 137 origin: '', 138 pathname: '', 139 protocol: '', 140 search: '' 141 } 142 }; 143 function getDocument() { 144 var doc = typeof document !== 'undefined' ? document : {}; 145 extend(doc, ssrDocument); 146 return doc; 147 } 148 var ssrWindow = { 149 document: ssrDocument, 150 navigator: { 151 userAgent: '' 152 }, 153 location: { 154 hash: '', 155 host: '', 156 hostname: '', 157 href: '', 158 origin: '', 159 pathname: '', 160 protocol: '', 161 search: '' 162 }, 163 history: { 164 replaceState: function replaceState() {}, 165 pushState: function pushState() {}, 166 go: function go() {}, 167 back: function back() {} 168 }, 169 CustomEvent: function CustomEvent() { 170 return this; 171 }, 172 addEventListener: function addEventListener() {}, 173 removeEventListener: function removeEventListener() {}, 174 getComputedStyle: function getComputedStyle() { 175 return { 176 getPropertyValue: function getPropertyValue() { 177 return ''; 178 } 179 }; 180 }, 181 Image: function Image() {}, 182 Date: function Date() {}, 183 screen: {}, 184 setTimeout: function setTimeout() {}, 185 clearTimeout: function clearTimeout() {}, 186 matchMedia: function matchMedia() { 187 return {}; 188 }, 189 requestAnimationFrame: function requestAnimationFrame(callback) { 190 if (typeof setTimeout === 'undefined') { 191 callback(); 192 return null; 193 } 194 return setTimeout(callback, 0); 195 }, 196 cancelAnimationFrame: function cancelAnimationFrame(id) { 197 if (typeof setTimeout === 'undefined') { 198 return; 199 } 200 clearTimeout(id); 201 } 202 }; 203 function getWindow() { 204 var win = typeof window !== 'undefined' ? window : {}; 205 extend(win, ssrWindow); 206 return win; 207 } 208 209 function classesToTokens(classes) { 210 if (classes === void 0) { 211 classes = ''; 212 } 213 return classes.trim().split(' ').filter(function (c) { 214 return !!c.trim(); 215 }); 216 } 217 function deleteProps(obj) { 218 var object = obj; 219 Object.keys(object).forEach(function (key) { 220 try { 221 object[key] = null; 222 } catch (e) { 223 // no getter for object 224 } 225 try { 226 delete object[key]; 227 } catch (e) { 228 // something got wrong 229 } 230 }); 231 } 232 function nextTick(callback, delay) { 233 if (delay === void 0) {
234 delay = 0; 235 } 236 return setTimeout(callback, delay); 237 } 238 function now() { 239 return Date.now(); 240 } 241 function getComputedStyle$1(el) { 242 var window = getWindow(); 243 var style; 244 if (window.getComputedStyle) { 245 style = window.getComputedStyle(el, null); 246 } 247 if (!style && el.currentStyle) { 248 style = el.currentStyle; 249 } 250 if (!style) { 251 style = el.style; 252 } 253 return style; 254 } 255 function getTranslate(el, axis) { 256 if (axis === void 0) { 257 axis = 'x'; 258 } 259 var window = getWindow(); 260 var matrix; 261 var curTransform; 262 var transformMatrix; 263 var curStyle = getComputedStyle$1(el); 264 if (window.WebKitCSSMatrix) { 265 curTransform = curStyle.transform || curStyle.webkitTransform; 266 if (curTransform.split(',').length > 6) { 267 curTransform = curTransform.split(', ').map(function (a$$1) { 268 return a$$1.replace(',', '.'); 269 }).join(', '); 270 } 271 // Some old versions of Webkit choke when 'none' is passed; pass 272 // empty string instead in this case 273 transformMatrix = new window.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform); 274 } else { 275 transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,'); 276 matrix = transformMatrix.toString().split(','); 277 } 278 if (axis === 'x') { 279 // Latest Chrome and webkits Fix 280 if (window.WebKitCSSMatrix) curTransform = transformMatrix.m41; 281 // Crazy IE10 Matrix 282 else if (matrix.length === 16) curTransform = parseFloat(matrix[12]); 283 // Normal Browsers 284 else curTransform = parseFloat(matrix[4]); 285 } 286 if (axis === 'y') { 287 // Latest Chrome and webkits Fix 288 if (window.WebKitCSSMatrix) curTransform = transformMatrix.m42; 289 // Crazy IE10 Matrix 290 else if (matrix.length === 16) curTransform = parseFloat(matrix[13]); 291 // Normal Browsers 292 else curTransform = parseFloat(matrix[5]); 293 } 294 return curTransform || 0; 295 } 296 function isObject$1(o) { 297 return babelHelpers["typeof"](o) === 'object' && o !== null && o.constructor && Object.prototype.toString.call(o).slice(8, -1) === 'Object'; 298 } 299 function isNode(node) { 300 // eslint-disable-next-line 301 if (typeof window !== 'undefined' && typeof window.HTMLElement !== 'undefined') { 302 return node instanceof HTMLElement; 303 } 304 return node && (node.nodeType === 1 || node.nodeType === 11); 305 } 306 function extend$1() { 307 var to = Object(arguments.length <= 0 ? undefined : arguments[0]); 308 var noExtend = ['__proto__', 'constructor', 'prototype']; 309 for (var i = 1; i < arguments.length; i += 1) { 310 var nextSource = i < 0 || arguments.length <= i ? undefined : arguments[i]; 311 if (nextSource !== undefined && nextSource !== null && !isNode(nextSource)) { 312 var keysArray = Object.keys(Object(nextSource)).filter(function (key) { 313 return noExtend.indexOf(key) < 0; 314 }); 315 for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex += 1) { 316 var nextKey = keysArray[nextIndex]; 317 var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey); 318 if (desc !== undefined && desc.enumerable) { 319 if (isObject$1(to[nextKey]) && isObject$1(nextSource[nextKey])) { 320 if (nextSource[nextKey].__swiper__) { 321 to[nextKey] = nextSource[nextKey]; 322 } else { 323 extend$1(to[nextKey], nextSource[nextKey]); 324 } 325 } else if (!isObject$1(to[nextKey]) && isObject$1(nextSource[nextKey])) { 326 to[nextKey] = {}; 327 if (nextSource[nextKey].__swiper__) { 328 to[nextKey] = nextSource[nextKey]; 329 } else { 330 extend$1(to[nextKey], nextSource[nextKey]); 331 } 332 } else { 333 to[nextKey] = nextSource[nextKey]; 334 } 335 } 336 } 337 } 338 } 339 return to; 340 } 341 function setCSSProperty(el, varName, varValue) { 342 el.style.setProperty(varName, varValue); 343 } 344 function animateCSSModeScroll(_ref) { 345 var swiper = _ref.swiper, 346 targetPosition = _ref.targetPosition, 347 side = _ref.side; 348 var window = getWindow(); 349 var startPosition = -swiper.translate; 350 var startTime = null; 351 var time; 352 var duration = swiper.params.speed; 353 swiper.wrapperEl.style.scrollSnapType = 'none'; 354 window.cancelAnimationFrame(swiper.cssModeFrameID); 355 var dir = targetPosition > startPosition ? 'next' : 'prev'; 356 var isOutOfBound = function isOutOfBound(current, target) { 357 return dir === 'next' && current >= target || dir === 'prev' && current <= target; 358 }; 359 var animate = function animate() { 360 time = new Date().getTime(); 361 if (startTime === null) { 362 startTime = time; 363 } 364 var progress = Math.max(Math.min((time - startTime) / duration, 1), 0); 365 var easeProgress = 0.5 - Math.cos(progress * Math.PI) / 2; 366 var currentPosition = startPosition + easeProgress * (targetPosition - startPosition); 367 if (isOutOfBound(currentPosition, targetPosition)) { 368 currentPosition = targetPosition; 369 } 370 swiper.wrapperEl.scrollTo(babelHelpers.defineProperty({}, side, currentPosition)); 371 if (isOutOfBound(currentPosition, targetPosition)) { 372 swiper.wrapperEl.style.overflow = 'hidden'; 373 swiper.wrapperEl.style.scrollSnapType = ''; 374 setTimeout(function () { 375 swiper.wrapperEl.style.overflow = ''; 376 swiper.wrapperEl.scrollTo(babelHelpers.defineProperty({}, side, currentPosition)); 377 }); 378 window.cancelAnimationFrame(swiper.cssModeFrameID); 379 return; 380 } 381 swiper.cssModeFrameID = window.requestAnimationFrame(animate); 382 }; 383 animate(); 384 } 385 function elementChildren(element, selector) { 386 if (selector === void 0) { 387 selector = ''; 388 } 389 var window = getWindow(); 390 var children = babelHelpers.toConsumableArray(element.children); 391 if (window.HTMLSlotElement && element instanceof HTMLSlotElement) { 392 children.push.apply(children, babelHelpers.toConsumableArray(element.assignedElements())); 393 } 394 if (!selector) { 395 return children; 396 } 397 return children.filter(function (el) { 398 return el.matches(selector); 399 }); 400 } 401 function elementIsChildOfSlot(el, slot) { 402 // Breadth-first search through all parent's children and assigned elements 403 var elementsQueue = [slot]; 404 while (elementsQueue.length > 0) { 405 var elementToCheck = elementsQueue.shift(); 406 if (el === elementToCheck) { 407 return true; 408 } 409 elementsQueue.push.apply(elementsQueue, babelHelpers.toConsumableArray(elementToCheck.children).concat(babelHelpers.toConsumableArray(elementToCheck.shadowRoot ? elementToCheck.shadowRoot.children : []), babelHelpers.toConsumableArray(elementToCheck.assignedElements ? elementToCheck.assignedElements() : []))); 410 } 411 } 412 function elementIsChildOf(el, parent) { 413 var window = getWindow(); 414 var isChild = parent.contains(el); 415 if (!isChild && window.HTMLSlotElement && parent instanceof HTMLSlotElement) { 416 var children = babelHelpers.toConsumableArray(parent.assignedElements()); 417 isChild = children.includes(el); 418 if (!isChild) { 419 isChild = elementIsChildOfSlot(el, parent); 420 } 421 } 422 return isChild; 423 } 424 function showWarning(text) {
425 try { 426 console.warn(text); 427 return; 428 } catch (err) { 429 // err 430 } 431 } 432 function createElement(tag, classes) { 433 var _el$classList; 434 if (classes === void 0) { 435 classes = []; 436 } 437 var el = document.createElement(tag); 438 (_el$classList = el.classList).add.apply(_el$classList, babelHelpers.toConsumableArray(Array.isArray(classes) ? classes : classesToTokens(classes))); 439 return el; 440 } 441 function elementPrevAll(el, selector) { 442 var prevEls = []; 443 while (el.previousElementSibling) { 444 var prev = el.previousElementSibling; // eslint-disable-line 445 if (selector) { 446 if (prev.matches(selector)) prevEls.push(prev); 447 } else prevEls.push(prev); 448 el = prev; 449 } 450 return prevEls; 451 } 452 function elementNextAll(el, selector) { 453 var nextEls = []; 454 while (el.nextElementSibling) { 455 var next = el.nextElementSibling; // eslint-disable-line 456 if (selector) { 457 if (next.matches(selector)) nextEls.push(next); 458 } else nextEls.push(next); 459 el = next; 460 } 461 return nextEls; 462 } 463 function elementStyle(el, prop) { 464 var window = getWindow(); 465 return window.getComputedStyle(el, null).getPropertyValue(prop); 466 } 467 function elementIndex(el) { 468 var child = el; 469 var i; 470 if (child) { 471 i = 0; 472 // eslint-disable-next-line 473 while ((child = child.previousSibling) !== null) { 474 if (child.nodeType === 1) i += 1; 475 } 476 return i; 477 } 478 return undefined; 479 } 480 function elementParents(el, selector) { 481 var parents = []; // eslint-disable-line 482 var parent = el.parentElement; // eslint-disable-line 483 while (parent) { 484 if (selector) { 485 if (parent.matches(selector)) parents.push(parent); 486 } else { 487 parents.push(parent); 488 } 489 parent = parent.parentElement; 490 } 491 return parents; 492 } 493 function elementOuterSize(el, size, includeMargins) { 494 var window = getWindow(); 495 if (includeMargins) { 496 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')); 497 } 498 return el.offsetWidth; 499 } 500 501 function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } 502 function _objectSpread(target) { for (var i$$1 = 1; i$$1 < arguments.length; i$$1++) { var source = null != arguments[i$$1] ? arguments[i$$1] : {}; i$$1 % 2 ? ownKeys(Object(source), !0).forEach(function (key) { babelHelpers.defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } 503 var support; 504 function calcSupport() { 505 var window = getWindow(); 506 var document = getDocument(); 507 return { 508 smoothScroll: document.documentElement && document.documentElement.style && 'scrollBehavior' in document.documentElement.style, 509 touch: !!('ontouchstart' in window || window.DocumentTouch && document instanceof window.DocumentTouch) 510 }; 511 } 512 function getSupport() { 513 if (!support) { 514 support = calcSupport(); 515 } 516 return support; 517 } 518 var deviceCached; 519 function calcDevice(_temp) { 520 var _ref3 = _temp === void 0 ? {} : _temp, 521 userAgent = _ref3.userAgent;
522 var support = getSupport(); 523 var window = getWindow(); 524 var platform = window.navigator.platform; 525 var ua = userAgent || window.navigator.userAgent; 526 var device = { 527 ios: false, 528 android: false 529 }; 530 var screenWidth = window.screen.width; 531 var screenHeight = window.screen.height; 532 var android = ua.match(/(Android);?[\s\/]+([\d.]+)?/); // eslint-disable-line 533 var ipad = ua.match(/(iPad).*OS\s([\d_]+)/); 534 var ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/); 535 var iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/); 536 var windows = platform === 'Win32'; 537 var macos = platform === 'MacIntel'; 538 539 // iPadOs 13 fix 540 var iPadScreens = ['1024x1366', '1366x1024', '834x1194', '1194x834', '834x1112', '1112x834', '768x1024', '1024x768', '820x1180', '1180x820', '810x1080', '1080x810']; 541 if (!ipad && macos && support.touch && iPadScreens.indexOf("".concat(screenWidth, "x").concat(screenHeight)) >= 0) { 542 ipad = ua.match(/(Version)\/([\d.]+)/); 543 if (!ipad) ipad = [0, 1, '13_0_0']; 544 macos = false; 545 } 546 547 // Android 548 if (android && !windows) { 549 device.os = 'android'; 550 device.android = true; 551 } 552 if (ipad || iphone || ipod) { 553 device.os = 'ios'; 554 device.ios = true; 555 } 556 557 // Export object 558 return device; 559 } 560 function getDevice(overrides) { 561 if (overrides === void 0) { 562 overrides = {}; 563 } 564 if (!deviceCached) { 565 deviceCached = calcDevice(overrides); 566 } 567 return deviceCached; 568 } 569 var browser; 570 function calcBrowser() { 571 var window = getWindow(); 572 var device = getDevice(); 573 var needPerspectiveFix = false; 574 function isSafari() { 575 var ua = window.navigator.userAgent.toLowerCase(); 576 return ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0 && ua.indexOf('android') < 0; 577 } 578 if (isSafari()) { 579 var ua = String(window.navigator.userAgent); 580 if (ua.includes('Version/')) { 581 var _ua$split$1$split$0$s = ua.split('Version/')[1].split(' ')[0].split('.').map(function (num) { 582 return Number(num); 583 }), 584 _ua$split$1$split$0$s2 = babelHelpers.slicedToArray(_ua$split$1$split$0$s, 2), 585 major = _ua$split$1$split$0$s2[0], 586 minor = _ua$split$1$split$0$s2[1]; 587 needPerspectiveFix = major < 16 || major === 16 && minor < 2; 588 } 589 } 590 var isWebView = /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(window.navigator.userAgent); 591 var isSafariBrowser = isSafari(); 592 var need3dFix = isSafariBrowser || isWebView && device.ios; 593 return { 594 isSafari: needPerspectiveFix || isSafariBrowser, 595 needPerspectiveFix: needPerspectiveFix, 596 need3dFix: need3dFix, 597 isWebView: isWebView 598 }; 599 } 600 function getBrowser() { 601 if (!browser) { 602 browser = calcBrowser(); 603 } 604 return browser; 605 } 606 function Resize(_ref) { 607 var swiper = _ref.swiper, 608 on = _ref.on, 609 emit = _ref.emit; 610 var window = getWindow(); 611 var observer = null; 612 var animationFrame = null; 613 var resizeHandler = function resizeHandler() { 614 if (!swiper || swiper.destroyed || !swiper.initialized) return; 615 emit('beforeResize'); 616 emit('resize'); 617 }; 618 var createObserver = function createObserver() { 619 if (!swiper || swiper.destroyed || !swiper.initialized) return; 620 observer = new ResizeObserver(function (entries) { 621 animationFrame = window.requestAnimationFrame(function () { 622 var width = swiper.width, 623 height = swiper.height; 624 var newWidth = width; 625 var newHeight = height; 626 entries.forEach(function (_ref2) { 627 var contentBoxSize = _ref2.contentBoxSize, 628 contentRect = _ref2.contentRect, 629 target = _ref2.target; 630 if (target && target !== swiper.el) return; 631 newWidth = contentRect ? contentRect.width : (contentBoxSize[0] || contentBoxSize).inlineSize; 632 newHeight = contentRect ? contentRect.height : (contentBoxSize[0] || contentBoxSize).blockSize; 633 }); 634 if (newWidth !== width || newHeight !== height) { 635 resizeHandler(); 636 } 637 }); 638 }); 639 observer.observe(swiper.el); 640 }; 641 var removeObserver = function removeObserver() { 642 if (animationFrame) { 643 window.cancelAnimationFrame(animationFrame); 644 } 645 if (observer && observer.unobserve && swiper.el) { 646 observer.unobserve(swiper.el); 647 observer = null; 648 } 649 }; 650 var orientationChangeHandler = function orientationChangeHandler() { 651 if (!swiper || swiper.destroyed || !swiper.initialized) return; 652 emit('orientationchange'); 653 }; 654 on('init', function () { 655 if (swiper.params.resizeObserver && typeof window.ResizeObserver !== 'undefined') { 656 createObserver(); 657 return; 658 } 659 window.addEventListener('resize', resizeHandler); 660 window.addEventListener('orientationchange', orientationChangeHandler); 661 }); 662 on('destroy', function () { 663 removeObserver(); 664 window.removeEventListener('resize', resizeHandler); 665 window.removeEventListener('orientationchange', orientationChangeHandler); 666 }); 667 } 668 function Observer(_ref) { 669 var swiper = _ref.swiper, 670 extendParams = _ref.extendParams, 671 on = _ref.on, 672 emit = _ref.emit; 673 var observers = []; 674 var window = getWindow(); 675 var attach = function attach(target, options) { 676 if (options === void 0) { 677 options = {}; 678 } 679 var ObserverFunc = window.MutationObserver || window.WebkitMutationObserver; 680 var observer = new ObserverFunc(function (mutations) { 681 // The observerUpdate event should only be triggered 682 // once despite the number of mutations. Additional 683 // triggers are redundant and are very costly 684 if (swiper.__preventObserver__) return; 685 if (mutations.length === 1) { 686 emit('observerUpdate', mutations[0]); 687 return; 688 } 689 var observerUpdate = function observerUpdate() { 690 emit('observerUpdate', mutations[0]); 691 }; 692 if (window.requestAnimationFrame) { 693 window.requestAnimationFrame(observerUpdate); 694 } else { 695 window.setTimeout(observerUpdate, 0); 696 } 697 }); 698 observer.observe(target, { 699 attributes: typeof options.attributes === 'undefined' ? true : options.attributes, 700 childList: swiper.isElement || (typeof options.childList === 'undefined' ? true : options).childList, 701 characterData: typeof options.characterData === 'undefined' ? true : options.characterData 702 }); 703 observers.push(observer); 704 };
705 var init = function init() { 706 if (!swiper.params.observer) return; 707 if (swiper.params.observeParents) { 708 var containerParents = elementParents(swiper.hostEl); 709 for (var i$$1 = 0; i$$1 < containerParents.length; i$$1 += 1) { 710 attach(containerParents[i$$1]); 711 } 712 } 713 // Observe container 714 attach(swiper.hostEl, { 715 childList: swiper.params.observeSlideChildren 716 }); 717 718 // Observe wrapper 719 attach(swiper.wrapperEl, { 720 attributes: false 721 }); 722 }; 723 var destroy = function destroy() { 724 observers.forEach(function (observer) { 725 observer.disconnect(); 726 }); 727 observers.splice(0, observers.length); 728 }; 729 extendParams({ 730 observer: false, 731 observeParents: false, 732 observeSlideChildren: false 733 }); 734 on('init', init); 735 on('destroy', destroy); 736 } 737 738 /* eslint-disable no-underscore-dangle */ 739 740 var eventsEmitter = { 741 on: function on(events, handler, priority) { 742 var self = this; 743 if (!self.eventsListeners || self.destroyed) return self; 744 if (typeof handler !== 'function') return self; 745 var method = priority ? 'unshift' : 'push'; 746 events.split(' ').forEach(function (event) { 747 if (!self.eventsListeners[event]) self.eventsListeners[event] = []; 748 self.eventsListeners[event][method](handler); 749 }); 750 return self; 751 }, 752 once: function once(events, handler, priority) { 753 var self = this; 754 if (!self.eventsListeners || self.destroyed) return self; 755 if (typeof handler !== 'function') return self; 756 function onceHandler() { 757 self.off(events, onceHandler); 758 if (onceHandler.__emitterProxy) { 759 delete onceHandler.__emitterProxy; 760 } 761 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 762 args[_key] = arguments[_key]; 763 } 764 handler.apply(self, args); 765 } 766 onceHandler.__emitterProxy = handler; 767 return self.on(events, onceHandler, priority); 768 }, 769 onAny: function onAny(handler, priority) { 770 var self = this; 771 if (!self.eventsListeners || self.destroyed) return self; 772 if (typeof handler !== 'function') return self; 773 var method = priority ? 'unshift' : 'push'; 774 if (self.eventsAnyListeners.indexOf(handler) < 0) { 775 self.eventsAnyListeners[method](handler); 776 } 777 return self; 778 }, 779 offAny: function offAny(handler) { 780 var self = this; 781 if (!self.eventsListeners || self.destroyed) return self; 782 if (!self.eventsAnyListeners) return self; 783 var index = self.eventsAnyListeners.indexOf(handler); 784 if (index >= 0) { 785 self.eventsAnyListeners.splice(index, 1); 786 } 787 return self; 788 }, 789 off: function off(events, handler) { 790 var self = this; 791 if (!self.eventsListeners || self.destroyed) return self; 792 if (!self.eventsListeners) return self; 793 events.split(' ').forEach(function (event) { 794 if (typeof handler === 'undefined') { 795 self.eventsListeners[event] = []; 796 } else if (self.eventsListeners[event]) { 797 self.eventsListeners[event].forEach(function (eventHandler, index) { 798 if (eventHandler === handler || eventHandler.__emitterProxy && eventHandler.__emitterProxy === handler) { 799 self.eventsListeners[event].splice(index, 1); 800 } 801 }); 802 } 803 }); 804 return self; 805 }, 806 emit: function emit() { 807 var self = this; 808 if (!self.eventsListeners || self.destroyed) return self; 809 if (!self.eventsListeners) return self; 810 var events; 811 var data; 812 var context; 813 for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { 814 args[_key2] = arguments[_key2]; 815 } 816 if (typeof args[0] === 'string' || Array.isArray(args[0])) { 817 events = args[0]; 818 data = args.slice(1, args.length); 819 context = self; 820 } else { 821 events = args[0].events; 822 data = args[0].data;
823 context = args[0].context || self; 824 } 825 data.unshift(context); 826 var eventsArray = Array.isArray(events) ? events : events.split(' '); 827 eventsArray.forEach(function (event) { 828 if (self.eventsAnyListeners && self.eventsAnyListeners.length) { 829 self.eventsAnyListeners.forEach(function (eventHandler) { 830 eventHandler.apply(context, [event].concat(babelHelpers.toConsumableArray(data))); 831 }); 832 } 833 if (self.eventsListeners && self.eventsListeners[event]) { 834 self.eventsListeners[event].forEach(function (eventHandler) { 835 eventHandler.apply(context, data); 836 }); 837 } 838 }); 839 return self; 840 } 841 }; 842 function updateSize() { 843 var swiper = this; 844 var width; 845 var height; 846 var el = swiper.el; 847 if (typeof swiper.params.width !== 'undefined' && swiper.params.width !== null) { 848 width = swiper.params.width; 849 } else { 850 width = el.clientWidth; 851 } 852 if (typeof swiper.params.height !== 'undefined' && swiper.params.height !== null) { 853 height = swiper.params.height; 854 } else { 855 height = el.clientHeight; 856 } 857 if (width === 0 && swiper.isHorizontal() || height === 0 && swiper.isVertical()) { 858 return; 859 } 860 861 // Subtract paddings 862 width = width - parseInt(elementStyle(el, 'padding-left') || 0, 10) - parseInt(elementStyle(el, 'padding-right') || 0, 10); 863 height = height - parseInt(elementStyle(el, 'padding-top') || 0, 10) - parseInt(elementStyle(el, 'padding-bottom') || 0, 10); 864 if (Number.isNaN(width)) width = 0; 865 if (Number.isNaN(height)) height = 0; 866 Object.assign(swiper, { 867 width: width, 868 height: height, 869 size: swiper.isHorizontal() ? width : height 870 }); 871 } 872 function updateSlides() { 873 var swiper = this; 874 function getDirectionPropertyValue(node, label) { 875 return parseFloat(node.getPropertyValue(swiper.getDirectionLabel(label)) || 0); 876 } 877 var params = swiper.params; 878 var wrapperEl = swiper.wrapperEl, 879 slidesEl = swiper.slidesEl, 880 swiperSize = swiper.size, 881 rtl = swiper.rtlTranslate, 882 wrongRTL = swiper.wrongRTL; 883 var isVirtual = swiper.virtual && params.virtual.enabled; 884 var previousSlidesLength = isVirtual ? swiper.virtual.slides.length : swiper.slides.length; 885 var slides = elementChildren(slidesEl, ".".concat(swiper.params.slideClass, ", swiper-slide")); 886 var slidesLength = isVirtual ? swiper.virtual.slides.length : slides.length; 887 var snapGrid = []; 888 var slidesGrid = []; 889 var slidesSizesGrid = []; 890 var offsetBefore = params.slidesOffsetBefore; 891 if (typeof offsetBefore === 'function') { 892 offsetBefore = params.slidesOffsetBefore.call(swiper); 893 } 894 var offsetAfter = params.slidesOffsetAfter; 895 if (typeof offsetAfter === 'function') { 896 offsetAfter = params.slidesOffsetAfter.call(swiper); 897 } 898 var previousSnapGridLength = swiper.snapGrid.length; 899 var previousSlidesGridLength = swiper.slidesGrid.length; 900 var spaceBetween = params.spaceBetween; 901 var slidePosition = -offsetBefore; 902 var prevSlideSize = 0; 903 var index = 0; 904 if (typeof swiperSize === 'undefined') { 905 return; 906 } 907 if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) { 908 spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiperSize; 909 } else if (typeof spaceBetween === 'string') { 910 spaceBetween = parseFloat(spaceBetween); 911 } 912 swiper.virtualSize = -spaceBetween; 913 914 // reset margins 915 slides.forEach(function (slideEl) { 916 if (rtl) { 917 slideEl.style.marginLeft = ''; 918 } else { 919 slideEl.style.marginRight = ''; 920 } 921 slideEl.style.marginBottom = ''; 922 slideEl.style.marginTop = ''; 923 }); 924 925 // reset cssMode offsets 926 if (params.centeredSlides && params.cssMode) { 927 setCSSProperty(wrapperEl, '--swiper-centered-offset-before', ''); 928 setCSSProperty(wrapperEl, '--swiper-centered-offset-after', ''); 929 } 930 var gridEnabled = params.grid && params.grid.rows > 1 && swiper.grid; 931 if (gridEnabled) { 932 swiper.grid.initSlides(slides); 933 } else if (swiper.grid) { 934 swiper.grid.unsetSlides(); 935 } 936 937 // Calc slides 938 var slideSize; 939 var shouldResetSlideSize = params.slidesPerView === 'auto' && params.breakpoints && Object.keys(params.breakpoints).filter(function (key) { 940 return typeof params.breakpoints[key].slidesPerView !== 'undefined'; 941 }).length > 0; 942 for (var i$$1 = 0; i$$1 < slidesLength; i$$1 += 1) { 943 slideSize = 0; 944 var _slide = void 0; 945 if (slides[i$$1]) _slide = slides[i$$1]; 946 if (gridEnabled) { 947 swiper.grid.updateSlide(i$$1, _slide, slides); 948 } 949 if (slides[i$$1] && elementStyle(_slide, 'display') === 'none') continue; // eslint-disable-line 950 951 if (params.slidesPerView === 'auto') { 952 if (shouldResetSlideSize) { 953 slides[i$$1].style[swiper.getDirectionLabel('width')] = ""; 954 } 955 var slideStyles = getComputedStyle(_slide); 956 var currentTransform = _slide.style.transform; 957 var currentWebKitTransform = _slide.style.webkitTransform; 958 if (currentTransform) { 959 _slide.style.transform = 'none'; 960 } 961 if (currentWebKitTransform) { 962 _slide.style.webkitTransform = 'none'; 963 } 964 if (params.roundLengths) { 965 slideSize = swiper.isHorizontal() ? elementOuterSize(_slide, 'width', true) : elementOuterSize(_slide, 'height', true); 966 } else { 967 // eslint-disable-next-line 968 var width = getDirectionPropertyValue(slideStyles, 'width'); 969 var paddingLeft = getDirectionPropertyValue(slideStyles, 'padding-left'); 970 var paddingRight = getDirectionPropertyValue(slideStyles, 'padding-right'); 971 var marginLeft = getDirectionPropertyValue(slideStyles, 'margin-left'); 972 var marginRight = getDirectionPropertyValue(slideStyles, 'margin-right'); 973 var boxSizing = slideStyles.getPropertyValue('box-sizing'); 974 if (boxSizing && boxSizing === 'border-box') { 975 slideSize = width + marginLeft + marginRight; 976 } else { 977 var _slide2 = _slide, 978 clientWidth = _slide2.clientWidth, 979 offsetWidth = _slide2.offsetWidth; 980 slideSize = width + paddingLeft + paddingRight + marginLeft + marginRight + (offsetWidth - clientWidth); 981 } 982 } 983 if (currentTransform) { 984 _slide.style.transform = currentTransform; 985 } 986 if (currentWebKitTransform) { 987 _slide.style.webkitTransform = currentWebKitTransform; 988 } 989 if (params.roundLengths) slideSize = Math.floor(slideSize); 990 } else { 991 slideSize = (swiperSize - (params.slidesPerView - 1) * spaceBetween) / params.slidesPerView; 992 if (params.roundLengths) slideSize = Math.floor(slideSize); 993 if (slides[i$$1]) { 994 slides[i$$1].style[swiper.getDirectionLabel('width')] = "".concat(slideSize, "px"); 995 } 996 } 997 if (slides[i$$1]) { 998 slides[i$$1].swiperSlideSize = slideSize; 999 } 1000 slidesSizesGrid.push(slideSize); 1001 if (params.centeredSlides) { 1002 slidePosition = slidePosition + slideSize / 2 + prevSlideSize / 2 + spaceBetween; 1003 if (prevSlideSize === 0 && i$$1 !== 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween; 1004 if (i$$1 === 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween; 1005 if (Math.abs(slidePosition) < 1 / 1000) slidePosition = 0; 1006 if (params.roundLengths) slidePosition = Math.floor(slidePosition); 1007 if (index % params.slidesPerGroup === 0) snapGrid.push(slidePosition); 1008 slidesGrid.push(slidePosition); 1009 } else { 1010 if (params.roundLengths) slidePosition = Math.floor(slidePosition); 1011 if ((index - Math.min(swiper.params.slidesPerGroupSkip, index)) % swiper.params.slidesPerGroup === 0) snapGrid.push(slidePosition); 1012 slidesGrid.push(slidePosition); 1013 slidePosition = slidePosition + slideSize + spaceBetween; 1014 } 1015 swiper.virtualSize += slideSize + spaceBetween; 1016 prevSlideSize = slideSize; 1017 index += 1; 1018 } 1019 swiper.virtualSize = Math.max(swiper.virtualSize, swiperSize) + offsetAfter; 1020 if (rtl && wrongRTL && (params.effect === 'slide' || params.effect === 'coverflow')) { 1021 wrapperEl.style.width = "".concat(swiper.virtualSize + spaceBetween, "px"); 1022 } 1023 if (params.setWrapperSize) { 1024 wrapperEl.style[swiper.getDirectionLabel('width')] = "".concat(swiper.virtualSize + spaceBetween, "px"); 1025 } 1026 if (gridEnabled) { 1027 swiper.grid.updateWrapperSize(slideSize, snapGrid); 1028 } 1029 1030 // Remove last grid elements depending on width 1031 if (!params.centeredSlides) { 1032 var newSlidesGrid = []; 1033 for (var _i = 0; _i < snapGrid.length; _i += 1) { 1034 var slidesGridItem = snapGrid[_i]; 1035 if (params.roundLengths) slidesGridItem = Math.floor(slidesGridItem);
1036 if (snapGrid[_i] <= swiper.virtualSize - swiperSize) { 1037 newSlidesGrid.push(slidesGridItem); 1038 } 1039 } 1040 snapGrid = newSlidesGrid; 1041 if (Math.floor(swiper.virtualSize - swiperSize) - Math.floor(snapGrid[snapGrid.length - 1]) > 1) { 1042 snapGrid.push(swiper.virtualSize - swiperSize); 1043 } 1044 } 1045 if (isVirtual && params.loop) { 1046 var size = slidesSizesGrid[0] + spaceBetween; 1047 if (params.slidesPerGroup > 1) { 1048 var groups = Math.ceil((swiper.virtual.slidesBefore + swiper.virtual.slidesAfter) / params.slidesPerGroup); 1049 var groupSize = size * params.slidesPerGroup; 1050 for (var _i2 = 0; _i2 < groups; _i2 += 1) { 1051 snapGrid.push(snapGrid[snapGrid.length - 1] + groupSize); 1052 } 1053 } 1054 for (var _i3 = 0; _i3 < swiper.virtual.slidesBefore + swiper.virtual.slidesAfter; _i3 += 1) { 1055 if (params.slidesPerGroup === 1) { 1056 snapGrid.push(snapGrid[snapGrid.length - 1] + size); 1057 } 1058 slidesGrid.push(slidesGrid[slidesGrid.length - 1] + size); 1059 swiper.virtualSize += size; 1060 } 1061 } 1062 if (snapGrid.length === 0) snapGrid = [0]; 1063 if (spaceBetween !== 0) { 1064 var key = swiper.isHorizontal() && rtl ? 'marginLeft' : swiper.getDirectionLabel('marginRight'); 1065 slides.filter(function (_, slideIndex) { 1066 if (!params.cssMode || params.loop) return true; 1067 if (slideIndex === slides.length - 1) { 1068 return false; 1069 } 1070 return true; 1071 }
1071).forEach(function (slideEl) { 1072 slideEl.style[key] = "".concat(spaceBetween, "px"); 1073 }); 1074 } 1075 if (params.centeredSlides && params.centeredSlidesBounds) { 1076 var allSlidesSize = 0; 1077 slidesSizesGrid.forEach(function (slideSizeValue) { 1078 allSlidesSize += slideSizeValue + (spaceBetween || 0); 1079 }); 1080 allSlidesSize -= spaceBetween; 1081 var maxSnap = allSlidesSize > swiperSize ? allSlidesSize - swiperSize : 0; 1082 snapGrid = snapGrid.map(function (snap) { 1083 if (snap <= 0) return -offsetBefore; 1084 if (snap > maxSnap) return maxSnap + offsetAfter; 1085 return snap; 1086 }); 1087 } 1088 if (params.centerInsufficientSlides) { 1089 var _allSlidesSize = 0; 1090 slidesSizesGrid.forEach(function (slideSizeValue) { 1091 _allSlidesSize += slideSizeValue + (spaceBetween || 0); 1092 }); 1093 _allSlidesSize -= spaceBetween; 1094 var offsetSize = (params.slidesOffsetBefore || 0) + (params.slidesOffsetAfter || 0); 1095 if (_allSlidesSize + offsetSize < swiperSize) { 1096 var allSlidesOffset = (swiperSize - _allSlidesSize - offsetSize) / 2; 1097 snapGrid.forEach(function (snap, snapIndex) { 1098 snapGrid[snapIndex] = snap - allSlidesOffset; 1099 }); 1100 slidesGrid.forEach(function (snap, snapIndex) { 1101 slidesGrid[snapIndex] = snap + allSlidesOffset; 1102 }); 1103 } 1104 } 1105 Object.assign(swiper, { 1106 slides: slides, 1107 snapGrid: snapGrid, 1108 slidesGrid: slidesGrid, 1109 slidesSizesGrid: slidesSizesGrid 1110 }); 1111 if (params.centeredSlides && params.cssMode && !params.centeredSlidesBounds) { 1112 setCSSProperty(wrapperEl, '--swiper-centered-offset-before', "".concat(-snapGrid[0], "px")); 1113 setCSSProperty(wrapperEl, '--swiper-centered-offset-after', "".concat(swiper.size / 2 - slidesSizesGrid[slidesSizesGrid.length - 1] / 2, "px")); 1114 var addToSnapGrid = -swiper.snapGrid[0]; 1115 var addToSlidesGrid = -swiper.slidesGrid[0]; 1116 swiper.snapGrid = swiper.snapGrid.map(function (v$$1) { 1117 return v$$1 + addToSnapGrid; 1118 }); 1119 swiper.slidesGrid = swiper.slidesGrid.map(function (v$$1) { 1120 return v$$1 + addToSlidesGrid; 1121 }); 1122 } 1123 if (slidesLength !== previousSlidesLength) { 1124 swiper.emit('slidesLengthChange'); 1125 } 1126 if (snapGrid.length !== previousSnapGridLength) { 1127 if (swiper.params.watchOverflow) swiper.checkOverflow(); 1128 swiper.emit('snapGridLengthChange'); 1129 } 1130 if (slidesGrid.length !== previousSlidesGridLength) { 1131 swiper.emit('slidesGridLengthChange'); 1132 } 1133 if (params.watchSlidesProgress) { 1134 swiper.updateSlidesOffset(); 1135 } 1136 swiper.emit('slidesUpdated'); 1137 if (!isVirtual && !params.cssMode && (params.effect === 'slide' || params.effect === 'fade')) { 1138 var backFaceHiddenClass = "".concat(params.containerModifierClass, "backface-hidden"); 1139 var hasClassBackfaceClassAdded = swiper.el.classList.contains(backFaceHiddenClass); 1140 if (slidesLength <= params.maxBackfaceHiddenSlides) { 1141 if (!hasClassBackfaceClassAdded) swiper.el.classList.add(backFaceHiddenClass); 1142 } else if (hasClassBackfaceClassAdded) { 1143 swiper.el.classList.remove(backFaceHiddenClass); 1144 } 1145 } 1146 } 1147 function updateAutoHeight(speed) { 1148 var swiper = this; 1149 var activeSlides = []; 1150 var isVirtual = swiper.virtual && swiper.params.virtual.enabled; 1151 var newHeight = 0; 1152 var i$$1; 1153 if (typeof speed === 'number') { 1154 swiper.setTransition(speed); 1155 } else if (speed === true) { 1156 swiper.setTransition(swiper.params.speed); 1157 } 1158 var getSlideByIndex = function getSlideByIndex(index) { 1159 if (isVirtual) { 1160 return swiper.slides[swiper.getSlideIndexByData(index)]; 1161 } 1162 return swiper.slides[index]; 1163 }; 1164 // Find slides currently in view 1165 if (swiper.params.slidesPerView !== 'auto' && swiper.params.slidesPerView > 1) { 1166 if (swiper.params.centeredSlides) {
1167 (swiper.visibleSlides || []).forEach(function (slide) { 1168 activeSlides.push(slide); 1169 }); 1170 } else { 1171 for (i$$1 = 0; i$$1 < Math.ceil(swiper.params.slidesPerView); i$$1 += 1) { 1172 var index = swiper.activeIndex + i$$1; 1173 if (index > swiper.slides.length && !isVirtual) break; 1174 activeSlides.push(getSlideByIndex(index)); 1175 } 1176 } 1177 } else { 1178 activeSlides.push(getSlideByIndex(swiper.activeIndex)); 1179 } 1180 1181 // Find new height from highest slide in view 1182 for (i$$1 = 0; i$$1 < activeSlides.length; i$$1 += 1) { 1183 if (typeof activeSlides[i$$1] !== 'undefined') { 1184 var height = activeSlides[i$$1].offsetHeight; 1185 newHeight = height > newHeight ? height : newHeight; 1186 } 1187 } 1188 1189 // Update Height 1190 if (newHeight || newHeight === 0) swiper.wrapperEl.style.height = "".concat(newHeight, "px"); 1191 } 1192 function updateSlidesOffset() { 1193 var swiper = this; 1194 var slides = swiper.slides; 1195 // eslint-disable-next-line 1196 var minusOffset = swiper.isElement ? swiper.isHorizontal() ? swiper.wrapperEl.offsetLeft : swiper.wrapperEl.offsetTop : 0; 1197 for (var i$$1 = 0; i$$1 < slides.length; i$$1 += 1) { 1198 slides[i$$1].swiperSlideOffset = (swiper.isHorizontal() ? slides[i$$1].offsetLeft : slides[i$$1].offsetTop) - minusOffset - swiper.cssOverflowAdjustment(); 1199 } 1200 } 1201 var toggleSlideClasses$1 = function toggleSlideClasses$1(sli
1201deEl, condition, className) { 1202 if (condition && !slideEl.classList.contains(className)) { 1203 slideEl.classList.add(className); 1204 } else if (!condition && slideEl.classList.contains(className)) { 1205 slideEl.classList.remove(className); 1206 } 1207 }; 1208 function updateSlidesProgress(translate) { 1209 if (translate === void 0) { 1210 translate = this && this.translate || 0; 1211 } 1212 var swiper = this; 1213 var params = swiper.params; 1214 var slides = swiper.slides, 1215 rtl = swiper.rtlTranslate, 1216 snapGrid = swiper.snapGrid; 1217 if (slides.length === 0) return; 1218 if (typeof slides[0].swiperSlideOffset === 'undefined') swiper.updateSlidesOffset(); 1219 var offsetCenter = -translate; 1220 if (rtl) offsetCenter = translate; 1221 swiper.visibleSlidesIndexes = []; 1222 swiper.visibleSlides = []; 1223 var spaceBetween = params.spaceBetween; 1224 if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) { 1225 spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiper.size; 1226 } else if (typeof spaceBetween === 'string') { 1227 spaceBetween = parseFloat(spaceBetween); 1228 } 1229 for (var i$$1 = 0; i$$1 < slides.length; i$$1 += 1) { 1230 var _slide3 = slides[i$$1]; 1231 var slideOffset = _slide3.swiperSlideOffset; 1232 if (params.cssMode && params.centeredSlides) { 1233 slideOffset -= slides[0].swiperSlideOffset; 1234 } 1235 var slideProgress = (offsetCenter + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (_slide3.swiperSlideSize + spaceBetween); 1236 var originalSlideProgress = (offsetCenter - snapGrid[0] + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (_slide3.swiperSlideSize + spaceBetween); 1237 var slideBefore = -(offsetCenter - slideOffset); 1238 var slideAfter = slideBefore + swiper.slidesSizesGrid[i$$1]; 1239 var isFullyVisible = slideBefore >= 0 && slideBefore <= swiper.size - swiper.slidesSizesGrid[i$$1]; 1240 var isVisible = slideBefore >= 0 && slideBefore < swiper.size - 1 || slideAfter > 1 && slideAfter <= swiper.size || slideBefore <= 0 && slideAfter >= swiper.size; 1241 if (isVisible) { 1242 swiper.visibleSlides.push(_slide3); 1243 swiper.visibleSlidesIndexes.push(i$$1); 1244 } 1245 toggleSlideClasses$1(_slide3, isVisible, params.slideVisibleClass); 1246 toggleSlideClasses$1(_slide3, isFullyVisible, params.slideFullyVisibleClass); 1247 _slide3.progress = rtl ? -slideProgress : slideProgress; 1248 _slide3.originalProgress = rtl ? -originalSlideProgress : originalSlideProgress; 1249 } 1250 } 1251 function updateProgress(translate) { 1252 var swiper = this; 1253 if (typeof translate === 'undefined') { 1254 var multiplier = swiper.rtlTranslate ? -1 : 1; 1255 // eslint-disable-next-line 1256 translate = swiper && swiper.translate && swiper.translate * multiplier || 0; 1257 } 1258 var params = swiper.params; 1259 var translatesDiff = swiper.maxTranslate() - swiper.minTranslate(); 1260 var progress = swiper.progress, 1261 isBeginning = swiper.isBeginning, 1262 isEnd = swiper.isEnd, 1263 progressLoop = swiper.progressLoop; 1264 var wasBeginning = isBeginning; 1265 var wasEnd = isEnd; 1266 if (translatesDiff === 0) { 1267 progress = 0; 1268 isBeginning = true; 1269 isEnd = true; 1270 } else { 1271 progress = (translate - swiper.minTranslate()) / translatesDiff; 1272 var isBeginningRounded = Math.abs(translate - swiper.minTranslate()) < 1; 1273 var isEndRounded = Math.abs(translate - swiper.maxTranslate()) < 1; 1274 isBeginning = isBeginningRounded || progress <= 0; 1275 isEnd = isEndRounded || progress >= 1; 1276 if (isBeginningRounded) progress = 0; 1277 if (isEndRounded) progress = 1; 1278 } 1279 if (params.loop) { 1280 var firstSlideIndex = swiper.getSlideIndexByData(0); 1281 var lastSlideIndex = swiper.getSlideIndexByData(swiper.slides.length - 1); 1282 var firstSlideTranslate = swiper.slidesGrid[firstSlideIndex]; 1283 var lastSlideTranslate = swiper.slidesGrid[lastSlideIndex]; 1284 var translateMax = swiper.slidesGrid[swiper.slidesGrid.length - 1]; 1285 var translateAbs = Math.abs(translate); 1286 if (translateAbs >= firstSlideTranslate) { 1287 progressLoop = (translateAbs - firstSlideTranslate) / translateMax; 1288 } else { 1289 progressLoop = (translateAbs + translateMax - lastSlideTranslate) / translateMax; 1290 } 1291 if (progressLoop > 1) progressLoop -= 1; 1292 } 1293 Object.assign(swiper, { 1294 progress: progress, 1295 progressLoop: progressLoop, 1296 isBeginning: isBeginning, 1297 isEnd: isEnd 1298 }); 1299 if (params.watchSlidesProgress || params.centeredSlides && params.autoHeight) swiper.updateSlidesProgress(translate); 1300 if (isBeginning && !wasBeginning) { 1301 swiper.emit('reachBeginning toEdge'); 1302 } 1303 if (isEnd && !wasEnd) { 1304 swiper.emit('reachEnd toEdge'); 1305 } 1306 if (wasBeginning && !isBeginning || wasEnd && !isEnd) { 1307 swiper.emit('fromEdge'); 1308 } 1309 swiper.emit('progress', progress); 1310 }
1311 var toggleSlideClasses = function toggleSlideClasses(slideEl, condition, className) { 1312 if (condition && !slideEl.classList.contains(className)) { 1313 slideEl.classList.add(className); 1314 } else if (!condition && slideEl.classList.contains(className)) { 1315 slideEl.classList.remove(className); 1316 } 1317 }; 1318 function updateSlidesClasses() { 1319 var swiper = this; 1320 var slides = swiper.slides, 1321 params = swiper.params, 1322 slidesEl = swiper.slidesEl, 1323 activeIndex = swiper.activeIndex; 1324 var isVirtual = swiper.virtual && params.virtual.enabled; 1325 var gridEnabled = swiper.grid && params.grid && params.grid.rows > 1; 1326 var getFilteredSlide = function getFilteredSlide(selector) { 1327 return elementChildren(slidesEl, ".".concat(params.slideClass).concat(selector, ", swiper-slide").concat(selector))[0]; 1328 }; 1329 var activeSlide; 1330 var prevSlide; 1331 var nextSlide; 1332 if (isVirtual) { 1333 if (params.loop) { 1334 var slideIndex = activeIndex - swiper.virtual.slidesBefore; 1335 if (slideIndex < 0) slideIndex = swiper.virtual.slides.length + slideIndex; 1336 if (slideIndex >= swiper.virtual.slides.length) slideIndex -= swiper.virtual.slides.length; 1337 activeSlide = getFilteredSlide("[data-swiper-slide-index=\"".concat(slideIndex, "\"]")); 1338 } else { 1339 activeSlide = getFilteredSlide("[data-swiper-slide-index=\"".concat(activeIndex, "\"]")); 1340 } 1341 } else { 1342 if (gridEnabled) { 1343 activeSlide = slides.find(function (slideEl) { 1344 return slideEl.column === activeIndex; 1345 }); 1346 nextSlide = slides.find(function (slideEl) { 1347 return slideEl.column === activeIndex + 1; 1348 }); 1349 prevSlide = slides.find(function (slideEl) { 1350 return slideEl.column === activeIndex - 1; 1351 }); 1352 } else { 1353 activeSlide = slides[activeIndex]; 1354 } 1355 } 1356 if (activeSlide) { 1357 if (!gridEnabled) { 1358 // Next Slide 1359 nextSlide = elementNextAll(activeSlide, ".".concat(params.slideClass, ", swiper-slide"))[0]; 1360 if (params.loop && !nextSlide) { 1361 nextSlide = slides[0]; 1362 } 1363 1364 // Prev Slide 1365 prevSlide = elementPrevAll(activeSlide, ".".concat(params.slideClass, ", swiper-slide"))[0]; 1366 if (params.loop && !prevSlide === 0) { 1367 prevSlide = slides[slides.length - 1]; 1368 } 1369 } 1370 } 1371 slides.forEach(function (slideEl) { 1372 toggleSlideClasses(slideEl, slideEl === activeSlide, params.slideActiveClass); 1373 toggleSlideClasses(slideEl, slideEl === nextSlide, params.slideNextClass); 1374 toggleSlideClasses(slideEl, slideEl === prevSlide, params.slidePrevClass); 1375 }); 1376 swiper.emitSlidesClasses(); 1377 } 1378 var processLazyPreloader = function processLazyPreloader(swiper, imageEl) { 1379 if (!swiper || swiper.destroyed || !swiper.params) return; 1380 var slideSelector = function slideSelector() { 1381 return swiper.isElement ? "swiper-slide" : ".".concat(swiper.params.slideClass); 1382 }; 1383 var slideEl = imageEl.closest(slideSelector()); 1384 if (slideEl) { 1385 var lazyEl = slideEl.querySelector(".".concat(swiper.params.lazyPreloaderClass)); 1386 if (!lazyEl && swiper.isElement) { 1387 if (slideEl.shadowRoot) { 1388 lazyEl = slideEl.shadowRoot.querySelector(".".concat(swiper.params.lazyPreloaderClass)); 1389 } else { 1390 // init later 1391 requestAnimationFrame(function () { 1392 if (slideEl.shadowRoot) { 1393 lazyEl = slideEl.shadowRoot.querySelector(".".concat(swiper.params.lazyPreloaderClass)); 1394 if (lazyEl) lazyEl.remove(); 1395 } 1396 }); 1397 } 1398 } 1399 if (lazyEl) lazyEl.remove(); 1400 } 1401 }; 1402 var unlazy = function unlazy(swiper, index) { 1403 if (!swiper.slides[index]) return; 1404 var imageEl = swiper.slides[index].querySelector('[loading="lazy"]'); 1405 if (imageEl) imageEl.removeAttribute('loading'); 1406 }; 1407 var preload = function preload(swiper) { 1408 if (!swiper || swiper.destroyed || !swiper.params) return; 1409 var amount = swiper.params.lazyPreloadPrevNext; 1410 var len = swiper.slides.length; 1411 if (!len || !amount || amount < 0) return; 1412 amount = Math.min(amount, len); 1413 var slidesPerView = swiper.params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : Math.ceil(swiper.params.slidesPerView); 1414 var activeIndex = swiper.activeIndex; 1415 if (swiper.params.grid && swiper.params.grid.rows > 1) { 1416 var activeColumn = activeIndex; 1417 var preloadColumns = [activeColumn - amount];
1418 preloadColumns.push.apply(preloadColumns, babelHelpers.toConsumableArray(Array.from({ 1419 length: amount 1420 }).map(function (_, i$$1) { 1421 return activeColumn + slidesPerView + i$$1; 1422 }))); 1423 swiper.slides.forEach(function (slideEl, i$$1) { 1424 if (preloadColumns.includes(slideEl.column)) unlazy(swiper, i$$1); 1425 }); 1426 return; 1427 } 1428 var slideIndexLastInView = activeIndex + slidesPerView - 1; 1429 if (swiper.params.rewind || swiper.params.loop) { 1430 for (var i$$1 = activeIndex - amount; i$$1 <= slideIndexLastInView + amount; i$$1 += 1) { 1431 var realIndex = (i$$1 % len + len) % len; 1432 if (realIndex < activeIndex || realIndex > slideIndexLastInView) unlazy(swiper, realIndex); 1433 } 1434 } else { 1435 for (var _i4 = Math.max(activeIndex - amount, 0); _i4 <= Math.min(slideIndexLastInView + amount, len - 1); _i4 += 1) { 1436 if (_i4 !== activeIndex && (_i4 > slideIndexLastInView || _i4 < activeIndex)) { 1437 unlazy(swiper, _i4); 1438 } 1439 } 1440 } 1441 }; 1442 function getActiveIndexByTranslate(swiper) { 1443 var slidesGrid = swiper.slidesGrid, 1444 params = swiper.params; 1445 var translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate; 1446 var activeIndex; 1447 for (var i$$1 = 0; i$$1 < slidesGrid.length; i$$1 += 1) { 1448 if (typeof slidesGrid[i$$1 + 1] !== 'undefined') { 1449 if (translate >= slidesGrid[i$$1] && translate < slidesGrid[i$$1 + 1] - (slidesGrid[i$$1 + 1] - slidesGrid[i$$1]) / 2) { 1450 activeIndex = i$$1; 1451 } else if (translate >= slidesGrid[i$$1] && translate < slidesGrid[i$$1 + 1]) { 1452 activeIndex = i$$1 + 1; 1453 } 1454 } else if (translate >= slidesGrid[i$$1]) { 1455 activeIndex = i$$1; 1456 } 1457 } 1458 // Normalize slideIndex 1459 if (params.normalizeSlideIndex) { 1460 if (activeIndex < 0 || typeof activeIndex === 'undefined') activeIndex = 0; 1461 } 1462 return activeIndex; 1463 } 1464 function updateActiveIndex(newActiveIndex) { 1465 var swiper = this; 1466 var translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate; 1467 var snapGrid = swiper.snapGrid, 1468 params = swiper.params, 1469 previousIndex = swiper.activeIndex, 1470 previousRealIndex = swiper.realIndex, 1471 previousSnapIndex = swiper.snapIndex; 1472 var activeIndex = newActiveIndex; 1473 var snapIndex; 1474 var getVirtualRealIndex = function getVirtualRealIndex(aIndex) { 1475 var realIndex = aIndex - swiper.virtual.slidesBefore; 1476 if (realIndex < 0) { 1477 realIndex = swiper.virtual.slides.length + realIndex; 1478 } 1479 if (realIndex >= swiper.virtual.slides.length) { 1480 realIndex -= swiper.virtual.slides.length; 1481 } 1482 return realIndex; 1483 }; 1484 if (typeof activeIndex === 'undefined') { 1485 activeIndex = getActiveIndexByTranslate(swiper); 1486 } 1487 if (snapGrid.indexOf(translate) >= 0) { 1488 snapIndex = snapGrid.indexOf(translate); 1489 } else { 1490 var skip = Math.min(params.slidesPerGroupSkip, activeIndex); 1491 snapIndex = skip + Math.floor((activeIndex - skip) / params.slidesPerGroup); 1492 } 1493 if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1; 1494 if (activeIndex === previousIndex && !swiper.params.loop) { 1495 if (snapIndex !== previousSnapIndex) { 1496 swiper.snapIndex = snapIndex; 1497 swiper.emit('snapIndexChange'); 1498 } 1499 return; 1500 } 1501 if (activeIndex === previousIndex && swiper.params.loop && swiper.virtual && swiper.params.virtual.enabled) { 1502 swiper.realIndex = getVirtualRealIndex(activeIndex); 1503 return; 1504 } 1505 var gridEnabled = swiper.grid && params.grid && params.grid.rows > 1; 1506 1507 // Get real index 1508 var realIndex; 1509 if (swiper.virtual && params.virtual.enabled && params.loop) { 1510 realIndex = getVirtualRealIndex(activeIndex); 1511 } else if (gridEnabled) { 1512 var firstSlideInColumn = swiper.slides.find(function (slideEl) { 1513 return slideEl.column === activeIndex; 1514 }); 1515 var activeSlideIndex = parseInt(firstSlideInColumn.getAttribute('data-swiper-slide-index'), 10); 1516 if (Number.isNaN(activeSlideIndex)) { 1517 activeSlideIndex = Math.max(swiper.slides.indexOf(firstSlideInColumn), 0); 1518 } 1519 realIndex = Math.floor(activeSlideIndex / params.grid.rows); 1520 } else if (swiper.slides[activeIndex]) { 1521 var slideIndex = swiper.slides[activeIndex].getAttribute('data-swiper-slide-index'); 1522 if (slideIndex) { 1523 realIndex = parseInt(slideIndex, 10); 1524 } else { 1525 realIndex = activeIndex; 1526 } 1527 } else { 1528 realIndex = activeIndex; 1529 } 1530 Object.assign(swiper, { 1531 previousSnapIndex: previousSnapIndex,
1532 snapIndex: snapIndex, 1533 previousRealIndex: previousRealIndex, 1534 realIndex: realIndex, 1535 previousIndex: previousIndex, 1536 activeIndex: activeIndex 1537 }); 1538 if (swiper.initialized) { 1539 preload(swiper); 1540 } 1541 swiper.emit('activeIndexChange'); 1542 swiper.emit('snapIndexChange'); 1543 if (swiper.initialized || swiper.params.runCallbacksOnInit) { 1544 if (previousRealIndex !== realIndex) { 1545 swiper.emit('realIndexChange'); 1546 } 1547 swiper.emit('slideChange'); 1548 } 1549 } 1550 function updateClickedSlide(el, path) { 1551 var swiper = this; 1552 var params = swiper.params; 1553 var slide = el.closest(".".concat(params.slideClass, ", swiper-slide")); 1554 if (!slide && swiper.isElement && path && path.length > 1 && path.includes(el)) { 1555 babelHelpers.toConsumableArray(path.slice(path.indexOf(el) + 1, path.length)).forEach(function (pathEl) { 1556 if (!slide && pathEl.matches && pathEl.matches(".".concat(params.slideClass, ", swiper-slide"))) { 1557 slide = pathEl; 1558 } 1559 }); 1560 } 1561 var slideFound = false; 1562 var slideIndex; 1563 if (slide) { 1564 for (var i$$1 = 0; i$$1 < swiper.slides.length; i$$1 += 1) { 1565 if (swiper.slides[i$$1] === slide) { 1566 slideFound = true; 1567 slideIndex = i$$1; 1568 break; 1569 } 1570 } 1571 } 1572 if (slide && slideFound) { 1573 swiper.clickedSlide = slide; 1574 if (swiper.virtual && swiper.params.virtual.enabled) { 1575 swiper.clickedIndex = parseInt(slide.getAttribute('data-swiper-slide-index'), 10); 1576 } else { 1577 swiper.clickedIndex = slideIndex; 1578 } 1579 } else { 1580 swiper.clickedSlide = undefined; 1581 swiper.clickedIndex = undefined; 1582 return; 1583 } 1584 if (params.slideToClickedSlide && swiper.clickedIndex !== undefined && swiper.clickedIndex !== swiper.activeIndex) { 1585 swiper.slideToClickedSlide(); 1586 } 1587 } 1588 var update = { 1589 updateSize: updateSize, 1590 updateSlides: updateSlides, 1591 updateAutoHeight: updateAutoHeight, 1592 updateSlidesOffset: updateSlidesOffset, 1593 updateSlidesProgress: updateSlidesProgress, 1594 updateProgress: updateProgress, 1595 updateSlidesClasses: updateSlidesClasses, 1596 updateActiveIndex: updateActiveIndex, 1597 updateClickedSlide: updateClickedSlide 1598 }; 1599 function getSwiperTranslate(axis) { 1600 if (axis === void 0) { 1601 axis = this.isHorizontal() ? 'x' : 'y'; 1602 } 1603 var swiper = this; 1604 var params = swiper.params, 1605 rtl = swiper.rtlTranslate, 1606 translate = swiper.translate, 1607 wrapperEl = swiper.wrapperEl; 1608 if (params.virtualTranslate) { 1609 return rtl ? -translate : translate; 1610 } 1611 if (params.cssMode) { 1612 return translate; 1613 } 1614 var currentTranslate = getTranslate(wrapperEl, axis); 1615 currentTranslate += swiper.cssOverflowAdjustment(); 1616 if (rtl) currentTranslate = -currentTranslate; 1617 return currentTranslate || 0; 1618 } 1619 function setTranslate(translate, byController) { 1620 var swiper = this; 1621 var rtl = swiper.rtlTranslate, 1622 params = swiper.params, 1623 wrapperEl = swiper.wrapperEl, 1624 progress = swiper.progress; 1625 var x$$1 = 0; 1626 var y$$1 = 0; 1627 var z = 0; 1628 if (swiper.isHorizontal()) { 1629 x$$1 = rtl ? -translate : translate; 1630 } else { 1631 y$$1 = translate; 1632 } 1633 if (params.roundLengths) { 1634 x$$1 = Math.floor(x$$1); 1635 y$$1 = Math.floor(y$$1); 1636 } 1637 swiper.previousTranslate = swiper.translate; 1638 swiper.translate = swiper.isHorizontal() ? x$$1 : y$$1; 1639 if (params.cssMode) { 1640 wrapperEl[swiper.isHorizontal() ? 'scrollLeft' : 'scrollTop'] = swiper.isHorizontal() ? -x$$1 : -y$$1; 1641 } else if (!params.virtualTranslate) { 1642 if (swiper.isHorizontal()) { 1643 x$$1 -= swiper.cssOverflowAdjustment(); 1644 } else { 1645 y$$1 -= swiper.cssOverflowAdjustment(); 1646 } 1647 wrapperEl.style.transform = "translate3d(".concat(x$$1, "px, ").concat(y$$1, "px, ").concat(z, "px)"); 1648 } 1649 1650 // Check if we need to update progress 1651 var newProgress; 1652 var translatesDiff = swiper.maxTranslate() - swiper.minTranslate(); 1653 if (translatesDiff === 0) { 1654 newProgress = 0; 1655 } else { 1656 newProgress = (translate - swiper.minTranslate()) / translatesDiff; 1657 } 1658 if (newProgress !== progress) { 1659 swiper.updateProgress(translate); 1660 } 1661 swiper.emit('setTranslate', swiper.translate, byController); 1662 } 1663 function minTranslate() { 1664 return -this.snapGrid[0]; 1665 } 1666 function maxTranslate() { 1667 return -this.snapGrid[this.snapGrid.length - 1]; 1668 } 1669 function translateTo(translate, speed, runCallbacks, translateBounds, internal) { 1670 if (translate === void 0) { 1671 translate = 0; 1672 } 1673 if (speed === void 0) { 1674 speed = this.params.speed; 1675 } 1676 if (runCallbacks === void 0) { 1677 runCallbacks = true; 1678 } 1679 if (translateBounds === void 0) { 1680 translateBounds = true; 1681 } 1682 var swiper = this; 1683 var params = swiper.params, 1684 wrapperEl = swiper.wrapperEl; 1685 if (swiper.animating && params.preventInteractionOnTransition) { 1686 return false;
1687 } 1688 var minTranslate = swiper.minTranslate(); 1689 var maxTranslate = swiper.maxTranslate(); 1690 var newTranslate; 1691 if (translateBounds && translate > minTranslate) newTranslate = minTranslate;else if (translateBounds && translate < maxTranslate) newTranslate = maxTranslate;else newTranslate = translate; 1692 1693 // Update progress 1694 swiper.updateProgress(newTranslate); 1695 if (params.cssMode) { 1696 var isH = swiper.isHorizontal(); 1697 if (speed === 0) { 1698 wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = -newTranslate; 1699 } else { 1700 var _wrapperEl$scrollTo; 1701 if (!swiper.support.smoothScroll) { 1702 animateCSSModeScroll({ 1703 swiper: swiper, 1704 targetPosition: -newTranslate, 1705 side: isH ? 'left' : 'top' 1706 }); 1707 return true; 1708 } 1709 wrapperEl.scrollTo((_wrapperEl$scrollTo = {}, babelHelpers.defineProperty(_wrapperEl$scrollTo, isH ? 'left' : 'top', -newTranslate), babelHelpers.defineProperty(_wrapperEl$scrollTo, "behavior", 'smooth'), _wrapperEl$scrollTo)); 1710 } 1711 return true; 1712 } 1713 if (speed === 0) { 1714 swiper.setTransition(0); 1715 swiper.setTranslate(newTranslate); 1716 if (runCallbacks) { 1717 swiper.emit('beforeTransitionStart', speed, internal); 1718 swiper.emit('transitionEnd'); 1719 } 1720 } else { 1721 swiper.setTransition(speed); 1722 swiper.setTranslate(newTranslate); 1723 if (runCallbacks) { 1724 swiper.emit('beforeTransitionStart', speed, internal); 1725 swiper.emit('transitionStart'); 1726 } 1727 if (!swiper.animating) { 1728 swiper.animating = true; 1729 if (!swiper.onTranslateToWrapperTransitionEnd) { 1730 swiper.onTranslateToWrapperTransitionEnd = function transitionEnd(e$$1) { 1731 if (!swiper || swiper.destroyed) return; 1732 if (e$$1.target !== this) return; 1733 swiper.wrapperEl.removeEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd); 1734 swiper.onTranslateToWrapperTransitionEnd = null; 1735 delete swiper.onTranslateToWrapperTransitionEnd; 1736 swiper.animating = false; 1737 if (runCallbacks) { 1738 swiper.emit('transitionEnd'); 1739 } 1740 }; 1741 } 1742 swiper.wrapperEl.addEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd); 1743 } 1744 } 1745 return true; 1746 } 1747 var translate = { 1748 getTranslate: getSwiperTranslate, 1749 setTranslate: setTranslate, 1750 minTranslate: minTranslate, 1751 maxTranslate: maxTranslate, 1752 translateTo: translateTo 1753 }; 1754 function setTransition(duration, byController) { 1755 var swiper = this; 1756 if (!swiper.params.cssMode) { 1757 swiper.wrapperEl.style.transitionDuration = "".concat(duration, "ms"); 1758 swiper.wrapperEl.style.transitionDelay = duration === 0 ? "0ms" : ''; 1759 } 1760 swiper.emit('setTransition', duration, byController); 1761 } 1762 function transitionEmit(_ref) { 1763 var swiper = _ref.swiper, 1764 runCallbacks = _ref.runCallbacks, 1765 direction = _ref.direction, 1766 step = _ref.step; 1767 var activeIndex = swiper.activeIndex, 1768 previousIndex = swiper.previousIndex; 1769 var dir = direction; 1770 if (!dir) { 1771 if (activeIndex > previousIndex) dir = 'next';else if (activeIndex < previousIndex) dir = 'prev';else dir = 'reset'; 1772 } 1773 swiper.emit("transition".concat(step)); 1774 if (runCallbacks && dir === 'reset') { 1775 swiper.emit("slideResetTransition".concat(step)); 1776 } else if (runCallbacks && activeIndex !== previousIndex) { 1777 swiper.emit("slideChangeTransition".concat(step)); 1778 if (dir === 'next') { 1779 swiper.emit("slideNextTransition".concat(step)); 1780 } else { 1781 swiper.emit("slidePrevTransition".concat(step)); 1782 } 1783 } 1784 } 1785 function transitionStart(runCallbacks, direction) { 1786 if (runCallbacks === void 0) { 1787 runCallbacks = true; 1788 } 1789 var swiper = this; 1790 var params = swiper.params; 1791 if (params.cssMode) return; 1792 if (params.autoHeight) { 1793 swiper.updateAutoHeight(); 1794 } 1795 transitionEmit({ 1796 swiper: swiper, 1797 runCallbacks: runCallbacks, 1798 direction: direction, 1799 step: 'Start' 1800 }); 1801 } 1802 function transitionEnd(runCallbacks, direction) { 1803 if (runCallbacks === void 0) { 1804 runCallbacks = true; 1805 } 1806 var swiper = this; 1807 var params = swiper.params; 1808 swiper.animating = false;
1809 if (params.cssMode) return; 1810 swiper.setTransition(0); 1811 transitionEmit({ 1812 swiper: swiper, 1813 runCallbacks: runCallbacks, 1814 direction: direction, 1815 step: 'End' 1816 }); 1817 } 1818 var transition = { 1819 setTransition: setTransition, 1820 transitionStart: transitionStart, 1821 transitionEnd: transitionEnd 1822 }; 1823 function slideTo(index, speed, runCallbacks, internal, initial) { 1824 if (index === void 0) { 1825 index = 0; 1826 } 1827 if (runCallbacks === void 0) { 1828 runCallbacks = true; 1829 } 1830 if (typeof index === 'string') { 1831 index = parseInt(index, 10); 1832 } 1833 var swiper = this; 1834 var slideIndex = index; 1835 if (slideIndex < 0) slideIndex = 0; 1836 var params = swiper.params, 1837 snapGrid = swiper.snapGrid, 1838 slidesGrid = swiper.slidesGrid, 1839 previousIndex = swiper.previousIndex, 1840 activeIndex = swiper.activeIndex, 1841 rtl = swiper.rtlTranslate, 1842 wrapperEl = swiper.wrapperEl, 1843 enabled = swiper.enabled; 1844 if (!enabled && !internal && !initial || swiper.destroyed || swiper.animating && params.preventInteractionOnTransition) { 1845 return false; 1846 } 1847 if (typeof speed === 'undefined') { 1848 speed = swiper.params.speed; 1849 } 1850 var skip = Math.min(swiper.params.slidesPerGroupSkip, slideIndex); 1851 var snapIndex = skip + Math.floor((slideIndex - skip) / swiper.params.slidesPerGroup); 1852 if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1; 1853 var translate = -snapGrid[snapIndex]; 1854 // Normalize slideIndex 1855 if (params.normalizeSlideIndex) { 1856 for (var i$$1 = 0; i$$1 < slidesGrid.length; i$$1 += 1) { 1857 var normalizedTranslate = -Math.floor(translate * 100); 1858 var normalizedGrid = Math.floor(slidesGrid[i$$1] * 100); 1859 var normalizedGridNext = Math.floor(slidesGrid[i$$1 + 1] * 100); 1860 if (typeof slidesGrid[i$$1 + 1] !== 'undefined') { 1861 if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext - (normalizedGridNext - normalizedGrid) / 2) { 1862 slideIndex = i$$1; 1863 } else if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext) { 1864 slideIndex = i$$1 + 1; 1865 } 1866 } else if (normalizedTranslate >= normalizedGrid) { 1867 slideIndex = i$$1; 1868 } 1869 } 1870 } 1871 // Directions locks 1872 if (swiper.initialized && slideIndex !== activeIndex) { 1873 if (!swiper.allowSlideNext && (rtl ? translate > swiper.translate && translate > swiper.minTranslate() : translate < swiper.translate && translate < swiper.minTranslate())) { 1874 return false; 1875 } 1876 if (!swiper.allowSlidePrev && translate > swiper.translate && translate > swiper.maxTranslate()) { 1877 if ((activeIndex || 0) !== slideIndex) { 1878 return false; 1879 } 1880 } 1881 } 1882 if (slideIndex !== (previousIndex || 0) && runCallbacks) { 1883 swiper.emit('beforeSlideChangeStart'); 1884 } 1885 1886 // Update progress 1887 swiper.updateProgress(translate); 1888 var direction; 1889 if (slideIndex > activeIndex) direction = 'next';else if (slideIndex < activeIndex) direction = 'prev';else direction = 'reset'; 1890 1891 // initial virtual 1892 var isVirtual = swiper.virtual && swiper.params.virtual.enabled; 1893 var isInitialVirtual = isVirtual && initial; 1894 // Update Index 1895 if (!isInitialVirtual && (rtl && -translate === swiper.translate || !rtl && translate === swiper.translate)) { 1896 swiper.updateActiveIndex(slideIndex); 1897 // Update Height 1898 if (params.autoHeight) { 1899 swiper.updateAutoHeight(); 1900 } 1901 swiper.updateSlidesClasses(); 1902 if (params.effect !== 'slide') { 1903 swiper.setTranslate(translate); 1904 } 1905 if (direction !== 'reset') { 1906 swiper.transitionStart(runCallbacks, direction); 1907 swiper.transitionEnd(runCallbacks, direction); 1908 } 1909 return false; 1910 } 1911 if (params.cssMode) { 1912 var isH = swiper.isHorizontal(); 1913 var t$$1 = rtl ? translate : -translate; 1914 if (speed === 0) { 1915 if (isVirtual) { 1916 swiper.wrapperEl.style.scrollSnapType = 'none'; 1917 swiper._immediateVirtual = true; 1918 } 1919 if (isVirtual && !swiper._cssModeVirtualInitialSet && swiper.params.initialSlide > 0) { 1920 swiper._cssModeVirtualInitialSet = true; 1921 requestAnimationFrame(function () { 1922 wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t$$1; 1923 }); 1924 } else { 1925 wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t$$1; 1926 } 1927 if (isVirtual) { 1928 requestAnimationFrame(function () { 1929 swiper.wrapperEl.style.scrollSnapType = ''; 1930 swiper._immediateVirtual = false;
1931 }); 1932 } 1933 } else { 1934 var _wrapperEl$scrollTo2; 1935 if (!swiper.support.smoothScroll) { 1936 animateCSSModeScroll({ 1937 swiper: swiper, 1938 targetPosition: t$$1, 1939 side: isH ? 'left' : 'top' 1940 }); 1941 return true; 1942 } 1943 wrapperEl.scrollTo((_wrapperEl$scrollTo2 = {}, babelHelpers.defineProperty(_wrapperEl$scrollTo2, isH ? 'left' : 'top', t$$1), babelHelpers.defineProperty(_wrapperEl$scrollTo2, "behavior", 'smooth'), _wrapperEl$scrollTo2)); 1944 } 1945 return true; 1946 } 1947 var browser = getBrowser(); 1948 var isSafari = browser.isSafari; 1949 if (isVirtual && !initial && isSafari && swiper.isElement) { 1950 swiper.virtual.update(false, false, slideIndex); 1951 } 1952 swiper.setTransition(speed); 1953 swiper.setTranslate(translate); 1954 swiper.updateActiveIndex(slideIndex); 1955 swiper.updateSlidesClasses(); 1956 swiper.emit('beforeTransitionStart', speed, internal); 1957 swiper.transitionStart(runCallbacks, direction); 1958 if (speed === 0) { 1959 swiper.transitionEnd(runCallbacks, direction); 1960 } else if (!swiper.animating) { 1961 swiper.animating = true; 1962 if (!swiper.onSlideToWrapperTransitionEnd) { 1963 swiper.onSlideToWrapperTransitionEnd = function transitionEnd(e$$1) { 1964 if (!swiper || swiper.destroyed) return; 1965 if (e$$1.target !== this) return; 1966 swiper.wrapperEl.removeEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd); 1967 swiper.onSlideToWrapperTransitionEnd = null; 1968 delete swiper.onSlideToWrapperTransitionEnd; 1969 swiper.transitionEnd(runCallbacks, direction); 1970 }; 1971 } 1972 swiper.wrapperEl.addEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd); 1973 } 1974 return true; 1975 } 1976 function slideToLoop(index, speed, runCallbacks, internal) { 1977 if (index === void 0) { 1978 index = 0; 1979 } 1980 if (runCallbacks === void 0) { 1981 runCallbacks = true; 1982 } 1983 if (typeof index === 'string') { 1984 var indexAsNumber = parseInt(index, 10); 1985 index = indexAsNumber; 1986 } 1987 var swiper = this; 1988 if (swiper.destroyed) return; 1989 if (typeof speed === 'undefined') { 1990 speed = swiper.params.speed; 1991 } 1992 var gridEnabled = swiper.grid && swiper.params.grid && swiper.params.grid.rows > 1; 1993 var newIndex = index; 1994 if (swiper.params.loop) { 1995 if (swiper.virtual && swiper.params.virtual.enabled) { 1996 // eslint-disable-next-line 1997 newIndex = newIndex + swiper.virtual.slidesBefore; 1998 } else { 1999 var targetSlideIndex; 2000 if (gridEnabled) { 2001 var slideIndex = newIndex * swiper.params.grid.rows; 2002 targetSlideIndex = swiper.slides.find(function (slideEl) { 2003 return slideEl.getAttribute('data-swiper-slide-index') * 1 === slideIndex; 2004 }).column; 2005 } else { 2006 targetSlideIndex = swiper.getSlideIndexByData(newIndex); 2007 } 2008 var cols = gridEnabled ? Math.ceil(swiper.slides.length / swiper.params.grid.rows) : swiper.slides.length; 2009 var centeredSlides = swiper.params.centeredSlides; 2010 var slidesPerView = swiper.params.slidesPerView; 2011 if (slidesPerView === 'auto') { 2012 slidesPerView = swiper.slidesPerViewDynamic(); 2013 } else { 2014 slidesPerView = Math.ceil(parseFloat(swiper.params.slidesPerView, 10)); 2015 if (centeredSlides && slidesPerView % 2 === 0) { 2016 slidesPerView = slidesPerView + 1; 2017 } 2018 } 2019 var needLoopFix = cols - targetSlideIndex < slidesPerView; 2020 if (centeredSlides) { 2021 needLoopFix = needLoopFix || targetSlideIndex < Math.ceil(slidesPerView / 2); 2022 } 2023 if (internal && centeredSlides && swiper.params.slidesPerView !== 'auto' && !gridEnabled) { 2024 needLoopFix = false; 2025 } 2026 if (needLoopFix) { 2027 var direction = centeredSlides ? targetSlideIndex < swiper.activeIndex ? 'prev' : 'next' : targetSlideIndex - swiper.activeIndex - 1 < swiper.params.slidesPerView ? 'next' : 'prev'; 2028 swiper.loopFix({ 2029 direction: direction, 2030 slideTo: true, 2031 activeSlideIndex: direction === 'next' ? targetSlideIndex + 1 : targetSlideIndex - cols + 1, 2032 slideRealIndex: direction === 'next' ? swiper.realIndex : undefined 2033 }); 2034 } 2035 if (gridEnabled) { 2036 var _slideIndex = newIndex * swiper.params.grid.rows; 2037 newIndex = swiper.slides.find(function (slideEl) { 2038 return slideEl.getAttribute('data-swiper-slide-index') * 1 === _slideIndex; 2039 }).column; 2040 } else { 2041 newIndex = swiper.getSlideIndexByData(newIndex); 2042 } 2043 } 2044 } 2045 requestAnimationFrame(function () { 2046 swiper.slideTo(newIndex, speed, runCallbacks, internal); 2047 }); 2048 return swiper; 2049 } 2050 2051 /* eslint no-unused-vars: "off" */ 2052 function slideNext(speed, runCallbacks, internal) { 2053 if (runCallbacks === void 0) { 2054 runCallbacks = true; 2055 } 2056 var swiper = this; 2057 var enabled = swiper.enabled, 2058 params = swiper.params, 2059 animating = swiper.animating; 2060 if (!enabled || swiper.destroyed) return swiper; 2061 if (typeof speed === 'undefined') { 2062 speed = swiper.params.speed; 2063 } 2064 var perGroup = params.slidesPerGroup; 2065 if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) { 2066 perGroup = Math.max(swiper.slidesPerViewDynamic('current', true), 1); 2067 } 2068 var increment = swiper.activeIndex < params.slidesPerGroupSkip ? 1 : perGroup; 2069 var isVirtual = swiper.virtual && params.virtual.enabled; 2070 if (params.loop) { 2071 if (animating && !isVirtual && params.loopPreventsSliding) return false;
2072 swiper.loopFix({ 2073 direction: 'next' 2074 }); 2075 // eslint-disable-next-line 2076 swiper._clientLeft = swiper.wrapperEl.clientLeft; 2077 if (swiper.activeIndex === swiper.slides.length - 1 && params.cssMode) { 2078 requestAnimationFrame(function () { 2079 swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal); 2080 }); 2081 return true; 2082 } 2083 } 2084 if (params.rewind && swiper.isEnd) { 2085 return swiper.slideTo(0, speed, runCallbacks, internal); 2086 } 2087 return swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal); 2088 } 2089 2090 /* eslint no-unused-vars: "off" */ 2091 function slidePrev(speed, runCallbacks, internal) { 2092 if (runCallbacks === void 0) { 2093 runCallbacks = true; 2094 } 2095 var swiper = this; 2096 var params = swiper.params, 2097 snapGrid = swiper.snapGrid, 2098 slidesGrid = swiper.slidesGrid, 2099 rtlTranslate = swiper.rtlTranslate, 2100 enabled = swiper.enabled, 2101 animating = swiper.animating; 2102 if (!enabled || swiper.destroyed) return swiper; 2103 if (typeof speed === 'undefined') { 2104 speed = swiper.params.speed; 2105 } 2106 var isVirtual = swiper.virtual && params.virtual.enabled; 2107 if (params.loop) { 2108 if (animating && !isVirtual && params.loopPreventsSliding) return false; 2109 swiper.loopFix({ 2110 direction: 'prev' 2111 }); 2112 // eslint-disable-next-line 2113 swiper._clientLeft = swiper.wrapperEl.clientLeft; 2114 } 2115 var translate = rtlTranslate ? swiper.translate : -swiper.translate; 2116 function normalize(val) { 2117 if (val < 0) return -Math.floor(Math.abs(val)); 2118 return Math.floor(val); 2119 } 2120 var normalizedTranslate = normalize(translate); 2121 var normalizedSnapGrid = snapGrid.map(function (val) { 2122 return normalize(val); 2123 }); 2124 var isFreeMode = params.freeMode && params.freeMode.enabled; 2125 var prevSnap = snapGrid[normalizedSnapGrid.indexOf(normalizedTranslate) - 1]; 2126 if (typeof prevSnap === 'undefined' && (params.cssMode || isFreeMode)) { 2127 var prevSnapIndex; 2128 snapGrid.forEach(function (snap, snapIndex) { 2129 if (normalizedTranslate >= snap) { 2130 // prevSnap = snap; 2131 prevSnapIndex = snapIndex; 2132 } 2133 }); 2134 if (typeof prevSnapIndex !== 'undefined') { 2135 prevSnap = isFreeMode ? snapGrid[prevSnapIndex] : snapGrid[prevSnapIndex > 0 ? prevSnapIndex - 1 : prevSnapIndex]; 2136 } 2137 } 2138 var prevIndex = 0; 2139 if (typeof prevSnap !== 'undefined') { 2140 prevIndex = slidesGrid.indexOf(prevSnap); 2141 if (prevIndex < 0) prevIndex = swiper.activeIndex - 1; 2142 if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) { 2143 prevIndex = prevIndex - swiper.slidesPerViewDynamic('previous', true) + 1; 2144 prevIndex = Math.max(prevIndex, 0); 2145 } 2146 } 2147 if (params.rewind && swiper.isBeginning) { 2148 var lastIndex = swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual ? swiper.virtual.slides.length - 1 : swiper.slides.length - 1; 2149 return swiper.slideTo(lastIndex, speed, runCallbacks, internal); 2150 } else if (params.loop && swiper.activeIndex === 0 && params.cssMode) { 2151 requestAnimationFrame(function () { 2152 swiper.slideTo(prevIndex, speed, runCallbacks, internal); 2153 }); 2154 return true; 2155 } 2156 return swiper.slideTo(prevIndex, speed, runCallbacks, internal); 2157 } 2158 2159 /* eslint no-unused-vars: "off" */ 2160 function slideReset(speed, runCallbacks, internal) { 2161 if (runCallbacks === void 0) { 2162 runCallbacks = true; 2163 } 2164 var swiper = this; 2165 if (swiper.destroyed) return; 2166 if (typeof speed === 'undefined') { 2167 speed = swiper.params.speed; 2168 } 2169 return swiper.slideTo(swiper.activeIndex, speed, runCallbacks, internal); 2170 } 2171 2172 /* eslint no-unused-vars: "off" */ 2173 function slideToClosest(speed, runCallbacks, internal, threshold) { 2174 if (runCallbacks === void 0) { 2175 runCallbacks = true; 2176 } 2177 if (threshold === void 0) { 2178 threshold = 0.5; 2179 } 2180 var swiper = this; 2181 if (swiper.destroyed) return; 2182 if (typeof speed === 'undefined') { 2183 speed = swiper.params.speed; 2184 } 2185 var index = swiper.activeIndex; 2186 var skip = Math.min(swiper.params.slidesPerGroupSkip, index); 2187 var snapIndex = skip + Math.floor((index - skip) / swiper.params.slidesPerGroup); 2188 var translate = swiper.rtlTranslate ? swiper.translate : -swi
2188per.translate; 2189 if (translate >= swiper.snapGrid[snapIndex]) { 2190 // The current translate is on or after the current snap index, so the choice 2191 // is between the current index and the one after it. 2192 var currentSnap = swiper.snapGrid[snapIndex]; 2193 var nextSnap = swiper.snapGrid[snapIndex + 1]; 2194 if (translate - currentSnap > (nextSnap - currentSnap) * threshold) { 2195 index += swiper.params.slidesPerGroup; 2196 } 2197 } else { 2198 // The current translate is before the current snap index, so the choice 2199 // is between the current index and the one before it. 2200 var prevSnap = swiper.snapGrid[snapIndex - 1]; 2201 var _currentSnap = swiper.snapGrid[snapIndex]; 2202 if (translate - prevSnap <= (_currentSnap - prevSnap) * threshold) { 2203 index -= swiper.params.slidesPerGroup; 2204 } 2205 } 2206 index = Math.max(index, 0); 2207 index = Math.min(index, swiper.slidesGrid.length - 1); 2208 return swiper.slideTo(index, speed, runCallbacks, internal); 2209 } 2210 function slideToClickedSlide() { 2211 var swiper = this; 2212 if (swiper.destroyed) return; 2213 var params = swiper.params, 2214 slidesEl = swiper.slidesEl; 2215 var slidesPerView = params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : params.slidesPerView; 2216 var slideToIndex = swiper.getSlideIndexWhenGrid(swiper.clickedIndex); 2217 var realIndex; 2218 var slideSelector = swiper.isElement ? "swiper-slide" : ".".concat(params.slideClass); 2219 var isGrid = swiper.grid && swiper.params.grid && swiper.params.grid.rows > 1; 2220 if (params.loop) { 2221 if (swiper.animating) return; 2222 realIndex = parseInt(swiper.clickedSlide.getAttribute('data-swiper-slide-index'), 10); 2223 if (params.centeredSlides) { 2224 swiper.slideToLoop(realIndex); 2225 } else if (slideToIndex > (isGrid ? (swiper.slides.length - slidesPerView) / 2 - (swiper.params.grid.rows - 1) : swiper.slides.length - slidesPerView)) { 2226 swiper.loopFix(); 2227 slideToIndex = swiper.getSlideIndex(elementChildren(slidesEl, "".concat(slideSelector, "[data-swiper-slide-index=\"").concat(realIndex, "\"]"))[0]); 2228 nextTick(function () { 2229 swiper.slideTo(slideToIndex); 2230 }); 2231 } else { 2232 swiper.slideTo(slideToIndex); 2233 } 2234 } else { 2235 swiper.slideTo(slideToIndex); 2236 } 2237 } 2238 var slide = { 2239 slideTo: slideTo, 2240 slideToLoop: slideToLoop, 2241 slideNext: slideNext, 2242 slidePrev: slidePrev, 2243 slideReset: slideReset, 2244 slideToClosest: slideToClosest, 2245 slideToClickedSlide: slideToClickedSlide 2246 }; 2247 function loopCreate(slideRealIndex, initial) { 2248 var swiper = this; 2249 var params = swiper.params, 2250 slidesEl = swiper.slidesEl; 2251 if (!params.loop || swiper.virtual && swiper.params.virtual.enabled) return; 2252 var initSlides = function initSlides() { 2253 var slides = elementChildren(slidesEl, ".".concat(params.slideClass, ", swiper-slide")); 2254 slides.forEach(function (el, index) { 2255 el.setAttribute('data-swiper-slide-index', index); 2256 }); 2257 }; 2258 var clearBlankSlides = function clearBlankSlides() { 2259 var slides = elementChildren(slidesEl, ".".concat(params.slideBlankClass)); 2260 slides.forEach(function (el) { 2261 el.remove(); 2262 }); 2263 if (slides.length > 0) { 2264 swiper.recalcSlides(); 2265 swiper.updateSlides(); 2266 } 2267 }; 2268 var gridEnabled = swiper.grid && params.grid && params.grid.rows > 1; 2269 if (params.loopAddBlankSlides && (params.slidesPerGroup > 1 || gridEnabled)) { 2270 clearBlankSlides(); 2271 } 2272 var slidesPerGroup = params.slidesPerGroup * (gridEnabled ? params.grid.rows : 1); 2273 var shouldFillGroup = swiper.slides.length % slidesPerGroup !== 0; 2274 var shouldFillGrid = gridEnabled && swiper.slides.length % params.grid.rows !== 0; 2275 var addBlankSlides = function addBlankSlides(amountOfSlides) { 2276 for (var i$$1 = 0; i$$1 < amountOfSlides; i$$1 += 1) { 2277 var slideEl = swiper.isElement ? createElement('swiper-slide', [params.slideBlankClass]) : createElement('div', [params.slideClass, params.slideBlankClass]); 2278 swiper.slidesEl.append(slideEl); 2279 } 2280 }; 2281 if (shouldFillGroup) { 2282 if (params.loopAddBlankSlides) { 2283 var slidesToAdd = slidesPerGroup - swiper.slides.length % slidesPerGroup; 2284 addBlankSlides(slidesToAdd); 2285 swiper.recalcSlides(); 2286 swiper.updateSlides(); 2287 } else { 2288 showWarning('Swiper Loop Warning: The number of slides is not even to slidesPerGroup, loop mode may
2288not function properly. You need to add more slides (or make duplicates, or empty slides)'); 2289 } 2290 initSlides(); 2291 } else if (shouldFillGrid) { 2292 if (params.loopAddBlankSlides) { 2293 var _slidesToAdd = params.grid.rows - swiper.slides.length % params.grid.rows; 2294 addBlankSlides(_slidesToAdd); 2295 swiper.recalcSlides(); 2296 swiper.updateSlides(); 2297 } else { 2298 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)'); 2299 } 2300 initSlides(); 2301 } else { 2302 initSlides(); 2303 } 2304 swiper.loopFix({ 2305 slideRealIndex: slideRealIndex, 2306 direction: params.centeredSlides ? undefined : 'next', 2307 initial: initial 2308 }); 2309 } 2310 function loopFix(_temp) { 2311 var _ref4 = _temp === void 0 ? {} : _temp, 2312 slideRealIndex = _ref4.slideRealIndex, 2313 _ref4$slideTo = _ref4.slideTo, 2314 slideTo = _ref4$slideTo === void 0 ? true : _ref4$slideTo, 2315 direction = _ref4.direction, 2316 setTranslate = _ref4.setTranslate, 2317 activeSlideIndex = _ref4.activeSlideIndex, 2318 initial = _ref4.initial, 2319 byController = _ref4.byController, 2320 byMousewheel = _ref4.byMousewheel; 2321 var swiper = this; 2322 if (!swiper.params.loop) return; 2323 swiper.emit('beforeLoopFix'); 2324 var slides = swiper.slides, 2325 allowSlidePrev = swiper.allowSlidePrev, 2326 allowSlideNext = swiper.allowSlideNext, 2327 slidesEl = swiper.slidesEl, 2328 params = swiper.params; 2329 var centeredSlides = params.centeredSlides, 2330 initialSlide = params.initialSlide; 2331 swiper.allowSlidePrev = true; 2332 swiper.allowSlideNext = true; 2333 if (swiper.virtual && params.virtual.enabled) { 2334 if (slideTo) { 2335 if (!params.centeredSlides && swiper.snapIndex === 0) { 2336 swiper.slideTo(swiper.virtual.slides.length, 0, false, true); 2337 } else if (params.centeredSlides && swiper.snapIndex < params.slidesPerView) { 2338 swiper.slideTo(swiper.virtual.slides.length + swiper.snapIndex, 0, false, true); 2339 } else if (swiper.snapIndex === swiper.snapGrid.length - 1) { 2340 swiper.slideTo(swiper.virtual.slidesBefore, 0, false, true); 2341 } 2342 } 2343 swiper.allowSlidePrev = allowSlidePrev; 2344 swiper.allowSlideNext = allowSlideNext; 2345 swiper.emit('loopFix'); 2346 return; 2347 } 2348 var slidesPerView = params.slidesPerView; 2349 if (slidesPerView === 'auto') { 2350 slidesPerView = swiper.slidesPerViewDynamic(); 2351 } else { 2352 slidesPerView = Math.ceil(parseFloat(params.slidesPerView, 10)); 2353 if (centeredSlides && slidesPerView % 2 === 0) { 2354 slidesPerView = slidesPerView + 1; 2355 } 2356 } 2357 var slidesPerGroup = params.slidesPerGroupAuto ? slidesPerView : params.slidesPerGroup; 2358 var loopedSlides = centeredSlides ? Math.max(slidesPerGroup, Math.ceil(slidesPerView / 2)) : slidesPerGroup; 2359 if (loopedSlides % slidesPerGroup !== 0) { 2360 loopedSlides += slidesPerGroup - loopedSlides % slidesPerGroup; 2361 } 2362 loopedSlides += params.loopAdditionalSlides; 2363 swiper.loopedSlides = loopedSlides; 2364 var gridEnabled = swiper.grid && params.grid && params.grid.rows > 1; 2365 if (slides.length < slidesPerView + loopedSlides || swiper.params.effect === 'cards' && slides.length < slidesPerView + loopedSlides * 2) { 2366 showWarning('Swiper Loop Warning: The number of slides is not enough for loop mode, it will be disabled or not function properly. You need to add more slides (or make duplicates) or lower the values of slidesPerView and slidesPerGroup parameters'); 2367 } else if (gridEnabled && params.grid.fill === 'row') { 2368 showWarning('Swiper Loop Warning: Loop mode is not compatible with grid.fill = `row`'); 2369 } 2370 var prependSlidesIndexes = []; 2371 var appendSlidesIndexes = []; 2372 var cols = gridEnabled ? Math.ceil(slides.length / params.grid.rows) : slides.length; 2373 var isInitialOverflow = initial && cols - initialSlide < slidesPerView && !centeredSlides; 2374 var activeIndex = isInitialOverflow ? initialSlide : swiper.activeIndex; 2375 if (typeof activeSlideIndex === 'undefined') { 2376 activeSlideIndex = swiper.getSlideIndex(slides.find(function (el) { 2377 return el.classList.contains(params.slideActiveClass); 2378 })); 2379 } else { 2380 activeIndex = activeSlideIndex; 2381 } 2382 var isNext = direction === 'next' || !direction; 2383 var isPrev = direction === 'prev' || !direction; 2384 var slidesPrepended = 0; 2385 var slidesAppended = 0; 2386 var activeColIndex = gridEnabled ? slides[activeSlideIndex].column : activeSlideIndex; 2387 var activeColIndexWithShift = activeColIndex + (centeredSlides && typeof setTranslate === 'undefined' ? -slidesPerView / 2 + 0.5 : 0); 2388 // prepend last slides before start 2389 if (activeColIndexWithShift < loopedSlides) { 2390 slidesPrepended = Math.max(loopedSlides - activeColIndexWithShift, slidesPerGroup); 2391 for (var i$$1 = 0; i$$1 < loopedSlides - activeColIndexWithShift; i$$1 += 1) { 2392 var index = i$$1 - Math.floor(i$$1 / cols) * cols; 2393 if (gridEnabled) { 2394 var colIndexToPrepend = cols - index - 1; 2395 for (var _i5 = slides.length - 1; _i5 >= 0; _i5 -= 1) { 2396 if (slides[_i5].column === colIndexToPrepend) prependSlidesIndexes.push(_i5); 2397 }
2398 // slides.forEach((slide, slideIndex) => { 2399 // if (slide.column === colIndexToPrepend) prependSlidesIndexes.push(slideIndex); 2400 // }); 2401 } else { 2402 prependSlidesIndexes.push(cols - index - 1); 2403 } 2404 } 2405 } else if (activeColIndexWithShift + slidesPerView > cols - loopedSlides) { 2406 slidesAppended = Math.max(activeColIndexWithShift - (cols - loopedSlides * 2), slidesPerGroup); 2407 if (isInitialOverflow) { 2408 slidesAppended = Math.max(slidesAppended, slidesPerView - cols + initialSlide + 1); 2409 } 2410 var _loop = function _loop() { 2411 var index = _i6 - Math.floor(_i6 / cols) * cols; 2412 if (gridEnabled) { 2413 slides.forEach(function (slide, slideIndex) { 2414 if (slide.column === index) appendSlidesIndexes.push(slideIndex); 2415 }); 2416 } else { 2417 appendSlidesIndexes.push(index); 2418 } 2419 }; 2420 for (var _i6 = 0; _i6 < slidesAppended; _i6 += 1) { 2421 _loop(); 2422 } 2423 } 2424 swiper.__preventObserver__ = true; 2425 requestAnimationFrame(function () { 2426 swiper.__preventObserver__ = false; 2427 }); 2428 if (swiper.params.effect === 'cards' && slides.length < slidesPerView + loopedSlides * 2) { 2429 if (appendSlidesIndexes.includes(activeSlideIndex)) { 2430 appendSlidesIndexes.splice(appendSlidesIndexes.indexOf(activeSlideIndex), 1); 2431 } 2432 if (prependSlidesIndexes.includes(activeSlideIndex)) { 2433 prependSlidesIndexes.splice(prependSlidesIndexes.indexOf(activeSlideIndex), 1); 2434 } 2435 } 2436 if (isPrev) { 2437 prependSlidesIndexes.forEach(function (index) { 2438 slides[index].swiperLoopMoveDOM = true; 2439 slidesEl.prepend(slides[index]); 2440 slides[index].swiperLoopMoveDOM = false; 2441 }); 2442 } 2443 if (isNext) { 2444 appendSlidesIndexes.forEach(function (index) { 2445 slides[index].swiperLoopMoveDOM = true; 2446 slidesEl.append(slides[index]); 2447 slides[index].swiperLoopMoveDOM = false; 2448 }); 2449 } 2450 swiper.recalcSlides(); 2451 if (params.slidesPerView === 'auto') { 2452 swiper.updateSlides(); 2453 } else if (gridEnabled && (prependSlidesIndexes.length > 0 && isPrev || appendSlidesIndexes.length > 0 && isNext)) { 2454 swiper.slides.forEach(function (slide, slideIndex) { 2455 swiper.grid.updateSlide(slideIndex, slide, swiper.slides); 2456 }); 2457 } 2458 if (params.watchSlidesProgress) { 2459 swiper.updateSlidesOffset(); 2460 } 2461 if (slideTo) { 2462 if (prependSlidesIndexes.length > 0 && isPrev) { 2463 if (typeof slideRealIndex === 'undefined') { 2464 var currentSlideTranslate = swiper.slidesGrid[activeIndex]; 2465 var newSlideTranslate = swiper.slidesGrid[activeIndex + slidesPrepended]; 2466 var diff = newSlideTranslate - currentSlideTranslate; 2467 if (byMousewheel) { 2468 swiper.setTranslate(swiper.translate - diff); 2469 } else { 2470 swiper.slideTo(activeIndex + Math.ceil(slidesPrepended), 0, false, true); 2471 if (setTranslate) { 2472 swiper.touchEventsData.startTranslate = swiper.touchEventsData.startTranslate - diff; 2473 swiper.touchEventsData.currentTranslate = swiper.touchEventsData.currentTranslate - diff; 2474 } 2475 } 2476 } else { 2477 if (setTranslate) { 2478 var shift = gridEnabled ? prependSlidesIndexes.length / params.grid.rows : prependSlidesIndexes.length; 2479 swiper.slideTo(swiper.activeIndex + shift, 0, false, true); 2480 swiper.touchEventsData.currentTranslate = swiper.translate; 2481 } 2482 } 2483 } else if (appendSlidesIndexes.length > 0 && isNext) { 2484 if (typeof slideRealIndex === 'undefined') { 2485 var _currentSlideTranslate = swiper.slidesGrid[activeIndex]; 2486 var _newSlideTranslate = swiper.slidesGrid[activeIndex - slidesAppended]; 2487 var _diff = _newSlideTranslate - _currentSlideTranslate; 2488 if (byMousewheel) { 2489 swiper.setTranslate(swiper.translate - _diff); 2490 } else { 2491 swiper.slideTo(activeIndex - slidesAppended, 0, false, true); 2492 if (setTranslate) { 2493 swiper.touchEventsData.startTranslate = swiper.touchEventsData.startTranslate - _diff; 2494 swiper.touchEventsData.currentTranslate = swiper.touchEventsData.currentTranslate - _diff; 2495 } 2496 } 2497 } else { 2498 var _shift = gridEnabled ? appendSlidesIndexes.length / params.grid.rows : appendSlidesIndexes.length; 2499 swiper.slideTo(swiper.activeIndex - _shift, 0, false, true); 2500 } 2501 } 2502 } 2503 swiper.allowSlidePrev = allowSlidePrev; 2504 swiper.allowSlideNext = allowSlideNext; 2505 if (swiper.controller && swiper.controller.control && !byController) { 2506 var loopParams = { 2507 slideRealIndex: slideRealIndex, 2508 direction: direction, 2509 setTranslate: setTranslate, 2510 activeSlideIndex: activeSlideIndex, 2511 byController: true 2512 }; 2513 if (Array.isArray(swiper.controller.control)) { 2514 swiper.controller.control.forEach(function (c$$1) { 2515 if (!c$$1.destroyed && c$$1.params.loop) c$$1.loopFix(_objectSpread(_objectSpread({}, loopParams), {}, { 2516 slideTo: c$$1.params.slidesPerView === params.slidesPerView ? slideTo : false 2517 })); 2518 }); 2519 } else if (swiper.controller.control instanceof swiper.constructor && swiper.controller.control.params.loop) { 2520 swiper.controller.control.loopFix(_objectSpread(_objectSpread({}, loopParams), {}, { 2521 slideTo: swiper.controller.control.params.slidesPerView === params.slidesPerView ? slideTo : false 2522 })); 2523 } 2524 } 2525 swiper.emit('loopFix'); 2526 } 2527 function loopDestroy() { 2528 var swiper = this; 2529 var params = swiper.params, 2530 slidesEl = swiper.slidesEl; 2531 if (!params.loop || !slidesEl || swiper.virtual && swiper.params.virtual.enabled) return; 2532 swiper.recalcSlides(); 2533 var newSlidesOrder = [];
2534 swiper.slides.forEach(function (slideEl) { 2535 var index = typeof slideEl.swiperSlideIndex === 'undefined' ? slideEl.getAttribute('data-swiper-slide-index') * 1 : slideEl.swiperSlideIndex; 2536 newSlidesOrder[index] = slideEl; 2537 }); 2538 swiper.slides.forEach(function (slideEl) { 2539 slideEl.removeAttribute('data-swiper-slide-index'); 2540 }); 2541 newSlidesOrder.forEach(function (slideEl) { 2542 slidesEl.append(slideEl); 2543 }); 2544 swiper.recalcSlides(); 2545 swiper.slideTo(swiper.realIndex, 0); 2546 } 2547 var loop = { 2548 loopCreate: loopCreate, 2549 loopFix: loopFix, 2550 loopDestroy: loopDestroy 2551 }; 2552 function setGrabCursor(moving) { 2553 var swiper = this; 2554 if (!swiper.params.simulateTouch || swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) return; 2555 var el = swiper.params.touchEventsTarget === 'container' ? swiper.el : swiper.wrapperEl; 2556 if (swiper.isElement) { 2557 swiper.__preventObserver__ = true; 2558 } 2559 el.style.cursor = 'move'; 2560 el.style.cursor = moving ? 'grabbing' : 'grab'; 2561 if (swiper.isElement) { 2562 requestAnimationFrame(function () { 2563 swiper.__preventObserver__ = false; 2564 }); 2565 } 2566 } 2567 function unsetGrabCursor() { 2568 var swiper = this; 2569 if (swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) { 2570 return; 2571 } 2572 if (swiper.isElement) { 2573 swiper.__preventObserver__ = true; 2574 } 2575 swiper[swiper.params.touchEventsTarget === 'container' ? 'el' : 'wrapperEl'].style.cursor = ''; 2576 if (swiper.isElement) { 2577 requestAnimationFrame(function () { 2578 swiper.__preventObserver__ = false; 2579 }); 2580 } 2581 } 2582 var grabCursor = { 2583 setGrabCursor: setGrabCursor, 2584 unsetGrabCursor: unsetGrabCursor 2585 }; 2586 2587 // Modified from https://stackoverflow.com/questions/54520554/custom-element-getrootnode-closest-function-crossing-multiple-parent-shadowd 2588 function closestElement(selector, base) { 2589 if (base === void 0) { 2590 base = this; 2591 } 2592 function __closestFrom(el) { 2593 if (!el || el === getDocument() || el === getWindow()) return null; 2594 if (el.assignedSlot) el = el.assignedSlot; 2595 var found = el.closest(selector); 2596 if (!found && !el.getRootNode) { 2597 return null; 2598 } 2599 return found || __closestFrom(el.getRootNode().host); 2600 } 2601 return __closestFrom(base); 2602 } 2603 function preventEdgeSwipe(swiper, event, startX) { 2604 var window = getWindow(); 2605 var params = swiper.params; 2606 var edgeSwipeDetection = params.edgeSwipeDetection; 2607 var edgeSwipeThreshold = params.edgeSwipeThreshold; 2608 if (edgeSwipeDetection && (startX <= edgeSwipeThreshold || startX >= window.innerWidth - edgeSwipeThreshold)) { 2609 if (edgeSwipeDetection === 'prevent') { 2610 event.preventDefault(); 2611 return true; 2612 } 2613 return false; 2614 } 2615 return true; 2616 } 2617 function onTouchStart(event) { 2618 var swiper = this; 2619 var document = getDocument(); 2620 var e$$1 = event; 2621 if (e$$1.originalEvent) e$$1 = e$$1.originalEvent; 2622 var data = swiper.touchEventsData; 2623 if (e$$1.type === 'pointerdown') { 2624 if (data.pointerId !== null && data.pointerId !== e$$1.pointerId) { 2625 return; 2626 } 2627 data.pointerId = e$$1.pointerId; 2628 } else if (e$$1.type === 'touchstart' && e$$1.targetTouches.length === 1) { 2629 data.touchId = e$$1.targetTouches[0].identifier; 2630 } 2631 if (e$$1.type === 'touchstart') { 2632 // don't proceed touch event 2633 preventEdgeSwipe(swiper, e$$1, e$$1.targetTouches[0].pageX); 2634 return; 2635 } 2636 var params = swiper.params, 2637 touches = swiper.touches, 2638 enabled = swiper.enabled; 2639 if (!enabled) return; 2640 if (!params.simulateTouch && e$$1.pointerType === 'mouse') return; 2641 if (swiper.animating && params.preventInteractionOnTransition) { 2642 return; 2643 } 2644 if (!swiper.animating && params.cssMode && params.loop) { 2645 swiper.loopFix(); 2646 } 2647 var targetEl = e$$1.target; 2648 if (params.touchEventsTarget === 'wrapper') { 2649 if (!elementIsChildOf(targetEl, swiper.wrapperEl)) return; 2650 } 2651 if ('which' in e$$1 && e$$1.which === 3) return; 2652 if ('button' in e$$1 && e$$1.button > 0) return; 2653 if (data.isTouched && data.isMoved) return; 2654 2655 // change target el for shadow root component 2656 var swipingClassHasValue = !!params.noSwipingClass && params.noSwipingClass !== ''; 2657 // eslint-disable-next-line 2658 var eventPath = e$$1.composedPath ? e$$1.composedPath() : e$$1.path; 2659 if (swipingClassHasValue && e$$1.target && e$$1.target.shadowRoot && eventPath) { 2660 targetEl = eventPath[0]; 2661 } 2662 var noSwipingSelector = params.noSwipingSelector ? params.noSwipingSelector : ".".concat(params.noSwipingClass); 2663 var isTargetShadow = !!(e$$1.target && e$$1.target.shadowRoot); 2664 2665 // use closestElement for shadow root element to get the actual closest for nested shadow root element 2666 if (params.noSwiping && (isTargetShadow ? closestElement(noSwipingSelector, targetEl) : targetEl.closest(noSwipingSelector))) { 2667 swiper.allowClick = true; 2668 return; 2669 } 2670 if (params.swipeHandler) { 2671 if (!targetEl.closest(params.swipeHandler)) return; 2672 } 2673 touches.currentX = e$$1.pageX; 2674 touches.currentY = e$$1.pageY; 2675 var startX = touches.currentX; 2676 var startY = touches.currentY; 2677 2678 // Do NOT start if iOS edge swipe is detected. Otherwise iOS app cannot swipe-to-go-back anymore 2679 2680 if (!preventEdgeSwipe(swiper, e$$1, startX)) { 2681 return; 2682 } 2683 Object.assign(data, { 2684 isTouched: true, 2685 isMoved: false, 2686 allowTouchCallbacks: true, 2687 isScrolling: undefined, 2688 startMoving: undefined 2689 }); 2690 touches.startX = startX; 2691 touches.startY = startY;
2692 data.touchStartTime = now(); 2693 swiper.allowClick = true; 2694 swiper.updateSize(); 2695 swiper.swipeDirection = undefined; 2696 if (params.threshold > 0) data.allowThresholdMove = false; 2697 var preventDefault = true; 2698 if (targetEl.matches(data.focusableElements)) { 2699 preventDefault = false; 2700 if (targetEl.nodeName === 'SELECT') { 2701 data.isTouched = false; 2702 } 2703 } 2704 if (document.activeElement && document.activeElement.matches(data.focusableElements) && document.activeElement !== targetEl && (e$$1.pointerType === 'mouse' || e$$1.pointerType !== 'mouse' && !targetEl.matches(data.focusableElements))) { 2705 document.activeElement.blur(); 2706 } 2707 var shouldPreventDefault = preventDefault && swiper.allowTouchMove && params.touchStartPreventDefault; 2708 if ((params.touchStartForcePreventDefault || shouldPreventDefault) && !targetEl.isContentEditable) { 2709 e$$1.preventDefault(); 2710 } 2711 if (params.freeMode && params.freeMode.enabled && swiper.freeMode && swiper.animating && !params.cssMode) { 2712 swiper.freeMode.onTouchStart(); 2713 } 2714 swiper.emit('touchStart', e$$1); 2715 } 2716 function onTouchMove(event) { 2717 var document = getDocument(); 2718 var swiper = this; 2719 var data = swiper.touchEventsData; 2720 var params = swiper.params, 2721 touches = swiper.touches, 2722 rtl = swiper.rtlTranslate, 2723 enabled = swiper.enabled; 2724 if (!enabled) return; 2725 if (!params.simulateTouch && event.pointerType === 'mouse') return; 2726 var e$$1 = event; 2727 if (e$$1.originalEvent) e$$1 = e$$1.originalEvent; 2728 if (e$$1.type === 'pointermove') { 2729 if (data.touchId !== null) return; // return from pointer if we use touch 2730 var id = e$$1.pointerId; 2731 if (id !== data.pointerId) return; 2732 } 2733 var targetTouch; 2734 if (e$$1.type === 'touchmove') { 2735 targetTouch = babelHelpers.toConsumableArray(e$$1.changedTouches).find(function (t$$1) { 2736 return t$$1.identifier === data.touchId; 2737 }); 2738 if (!targetTouch || targetTouch.identifier !== data.touchId) return; 2739 } else { 2740 targetTouch = e$$1; 2741 } 2742 if (!data.isTouched) { 2743 if (data.startMoving && data.isScrolling) { 2744 swiper.emit('touchMoveOpposite', e$$1); 2745 } 2746 return; 2747 } 2748 var pageX = targetTouch.pageX; 2749 var pageY = targetTouch.pageY; 2750 if (e$$1.preventedByNestedSwiper) { 2751 touches.startX = pageX; 2752 touches.startY = pageY; 2753 return; 2754 } 2755 if (!swiper.allowTouchMove) { 2756 if (!e$$1.target.matches(data.focusableElements)) { 2757 swiper.allowClick = false; 2758 } 2759 if (data.isTouched) { 2760 Object.assign(touches, { 2761 startX: pageX, 2762 startY: pageY, 2763 currentX: pageX, 2764 currentY: pageY 2765 }); 2766 data.touchStartTime = now(); 2767 } 2768 return; 2769 } 2770 if (params.touchReleaseOnEdges && !params.loop) { 2771 if (swiper.isVertical()) { 2772 // Vertical 2773 if (pageY < touches.startY && swiper.translate <= swiper.maxTranslate() || pageY > touches.startY && swiper.translate >= swiper.minTranslate()) { 2774 data.isTouched = false; 2775 data.isMoved = false; 2776 return; 2777 } 2778 } else if (rtl && (pageX > touches.startX && -swiper.translate <= swiper.maxTranslate() || pageX < touches.startX && -swiper.translate >= swiper.minTranslate())) { 2779 return; 2780 } else if (!rtl && (pageX < touches.startX && swiper.translate <= swiper.maxTranslate() || pageX > touches.startX && swiper.translate >= swiper.minTranslate())) { 2781 return; 2782 } 2783 } 2784 if (document.activeElement && document.activeElement.matches(data.focusableElements) && document.activeElement !== e$$1.target && e$$1.pointerType !== 'mouse') { 2785 document.activeElement.blur(); 2786 } 2787 if (document.activeElement) { 2788 if (e$$1.target === document.activeElement && e$$1.target.matches(data.focusableElements)) { 2789 data.isMoved = true; 2790 swiper.allowClick = false;
2791 return; 2792 } 2793 } 2794 if (data.allowTouchCallbacks) { 2795 swiper.emit('touchMove', e$$1); 2796 } 2797 touches.previousX = touches.currentX; 2798 touches.previousY = touches.currentY; 2799 touches.currentX = pageX; 2800 touches.currentY = pageY; 2801 var diffX = touches.currentX - touches.startX; 2802 var diffY = touches.currentY - touches.startY; 2803 if (swiper.params.threshold && Math.sqrt(Math.pow(diffX, 2) + Math.pow(diffY, 2)) < swiper.params.threshold) return; 2804 if (typeof data.isScrolling === 'undefined') { 2805 var touchAngle; 2806 if (swiper.isHorizontal() && touches.currentY === touches.startY || swiper.isVertical() && touches.currentX === touches.startX) { 2807 data.isScrolling = false; 2808 } else { 2809 // eslint-disable-next-line 2810 if (diffX * diffX + diffY * diffY >= 25) { 2811 touchAngle = Math.atan2(Math.abs(diffY), Math.abs(diffX)) * 180 / Math.PI; 2812 data.isScrolling = swiper.isHorizontal() ? touchAngle > params.touchAngle : 90 - touchAngle > params.touchAngle; 2813 } 2814 } 2815 } 2816 if (data.isScrolling) { 2817 swiper.emit('touchMoveOpposite', e$$1); 2818 } 2819 if (typeof data.startMoving === 'undefined') { 2820 if (touches.currentX !== touches.startX || touches.currentY !== touches.startY) { 2821 data.startMoving = true; 2822 } 2823 } 2824 if (data.isScrolling || e$$1.type === 'touchmove' && data.preventTouchMoveFromPointerMove) { 2825 data.isTouched = false; 2826 return; 2827 } 2828 if (!data.startMoving) { 2829 return; 2830 } 2831 swiper.allowClick = false; 2832 if (!params.cssMode && e$$1.cancelable) { 2833 e$$1.preventDefault(); 2834 } 2835 if (params.touchMoveStopPropagation && !params.nested) { 2836 e$$1.stopPropagation(); 2837 } 2838 var diff = swiper.isHorizontal() ? diffX : diffY; 2839 var touchesDiff = swiper.isHorizontal() ? touches.currentX - touches.previousX : touches.currentY - touches.previousY; 2840 if (params.oneWayMovement) { 2841 diff = Math.abs(diff) * (rtl ? 1 : -1); 2842 touchesDiff = Math.abs(touchesDiff) * (rtl ? 1 : -1); 2843 } 2844 touches.diff = diff; 2845 diff *= params.touchRatio; 2846 if (rtl) { 2847 diff = -diff; 2848 touchesDiff = -touchesDiff; 2849 } 2850 var prevTouchesDirection = swiper.touchesDirection; 2851 swiper.swipeDirection = diff > 0 ? 'prev' : 'next'; 2852 swiper.touchesDirection = touchesDiff > 0 ? 'prev' : 'next'; 2853 var isLoop = swiper.params.loop && !params.cssMode; 2854 var allowLoopFix = swiper.touchesDirection === 'next' && swiper.allowSlideNext || swiper.touchesDirection === 'prev' && swiper.allowSlidePrev; 2855 if (!data.isMoved) { 2856 if (isLoop && allowLoopFix) { 2857 swiper.loopFix({ 2858 direction: swiper.swipeDirection 2859 }); 2860 } 2861 data.startTranslate = swiper.getTranslate(); 2862 swiper.setTransition(0); 2863 if (swiper.animating) { 2864 var evt = new window.CustomEvent('transitionend', { 2865 bubbles: true, 2866 cancelable: true, 2867 detail: { 2868 bySwiperTouchMove: true 2869 } 2870 }); 2871 swiper.wrapperEl.dispatchEvent(evt); 2872 } 2873 data.allowMomentumBounce = false; 2874 // Grab Cursor 2875 if (params.grabCursor && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) { 2876 swiper.setGrabCursor(true); 2877 } 2878 swiper.emit('sliderFirstMove', e$$1); 2879 } 2880 var loopFixed; 2881 new Date().getTime(); 2882 if (params._loopSwapReset !== false && data.isMoved && data.allowThresholdMove && prevTouchesDirection !== swiper.touchesDirection && isLoop && allowLoopFix && Math.abs(diff) >= 1) { 2883 Object.assign(touches, { 2884 startX: pageX, 2885 startY: pageY, 2886 currentX: pageX, 2887 currentY: pageY, 2888 startTranslate: data.currentTranslate 2889 }); 2890 data.loopSwapReset = true; 2891 data.startTranslate = data.currentTranslate; 2892 return; 2893 } 2894 swiper.emit('sliderMove', e$$1); 2895 data.isMoved = true; 2896 data.currentTranslate = diff + data.startTranslate; 2897 var disableParentSwiper = true; 2898 var resistanceRatio = params.resistanceRatio; 2899 if (params.touchReleaseOnEdges) { 2900 resistanceRatio = 0; 2901 } 2902 if (diff > 0) { 2903 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())) { 2904 swiper.loopFix({ 2905 direction: 'prev', 2906 setTranslate: true, 2907 activeSlideIndex: 0 2908 }); 2909 } 2910 if (data.currentTranslate > swiper.minTranslate()) { 2911 disableParentSwiper = false;
2912 if (params.resistance) { 2913 data.currentTranslate = swiper.minTranslate() - 1 + Math.pow(-swiper.minTranslate() + data.startTranslate + diff, resistanceRatio); 2914 } 2915 } 2916 } else if (diff < 0) { 2917 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())) { 2918 swiper.loopFix({ 2919 direction: 'next', 2920 setTranslate: true, 2921 activeSlideIndex: swiper.slides.length - (params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : Math.ceil(parseFloat(params.slidesPerView, 10))) 2922 }); 2923 } 2924 if (data.currentTranslate < swiper.maxTranslate()) { 2925 disableParentSwiper = false;
2926 if (params.resistance) { 2927 data.currentTranslate = swiper.maxTranslate() + 1 - Math.pow(swiper.maxTranslate() - data.startTranslate - diff, resistanceRatio); 2928 } 2929 } 2930 } 2931 if (disableParentSwiper) { 2932 e$$1.preventedByNestedSwiper = true; 2933 } 2934 2935 // Directions locks 2936 if (!swiper.allowSlideNext && swiper.swipeDirection === 'next' && data.currentTranslate < data.startTranslate) { 2937 data.currentTranslate = data.startTranslate; 2938 } 2939 if (!swiper.allowSlidePrev && swiper.swipeDirection === 'prev' && data.currentTranslate > data.startTranslate) { 2940 data.currentTranslate = data.startTranslate; 2941 } 2942 if (!swiper.allowSlidePrev && !swiper.allowSlideNext) { 2943 data.currentTranslate = data.startTranslate; 2944 } 2945 2946 // Threshold 2947 if (params.threshold > 0) { 2948 if (Math.abs(diff) > params.threshold || data.allowThresholdMove) { 2949 if (!data.allowThresholdMove) { 2950 data.allowThresholdMove = true; 2951 touches.startX = touches.currentX; 2952 touches.startY = touches.currentY; 2953 data.currentTranslate = data.startTranslate; 2954 touches.diff = swiper.isHorizontal() ? touches.currentX - touches.startX : touches.currentY - touches.startY; 2955 return; 2956 } 2957 } else { 2958 data.currentTranslate = data.startTranslate; 2959 return; 2960 } 2961 } 2962 if (!params.followFinger || params.cssMode) return; 2963 2964 // Update active index in free mode 2965 if (params.freeMode && params.freeMode.enabled && swiper.freeMode || params.watchSlidesProgress) { 2966 swiper.updateActiveIndex(); 2967 swiper.updateSlidesClasses(); 2968 } 2969 if (params.freeMode && params.freeMode.enabled && swiper.freeMode) { 2970 swiper.freeMode.onTouchMove(); 2971 } 2972 // Update progress 2973 swiper.updateProgress(data.currentTranslate); 2974 // Update translate 2975 swiper.setTranslate(data.currentTranslate); 2976 } 2977 function onTouchEnd(event) { 2978 var swiper = this; 2979 var data = swiper.touchEventsData; 2980 var e$$1 = event; 2981 if (e$$1.originalEvent) e$$1 = e$$1.originalEvent; 2982 var targetTouch; 2983 var isTouchEvent = e$$1.type === 'touchend' || e$$1.type === 'touchcancel'; 2984 if (!isTouchEvent) { 2985 if (data.touchId !== null) return; // return from pointer if we use touch 2986 if (e$$1.pointerId !== data.pointerId) return; 2987 targetTouch = e$$1; 2988 } else { 2989 targetTouch = babelHelpers.toConsumableArray(e$$1.changedTouches).find(function (t$$1) { 2990 return t$$1.identifier === data.touchId; 2991 }); 2992 if (!targetTouch || targetTouch.identifier !== data.touchId) return; 2993 } 2994 if (['pointercancel', 'pointerout', 'pointerleave', 'contextmenu'].includes(e$$1.type)) { 2995 var proceed = ['pointercancel', 'contextmenu'].includes(e$$1.type) && (swiper.browser.isSafari || swiper.browser.isWebView); 2996 if (!proceed) { 2997 return; 2998 } 2999 } 3000 data.pointerId = null; 3001 data.touchId = null; 3002 var params = swiper.params, 3003 touches = swiper.touches, 3004 rtl = swiper.rtlTranslate, 3005 slidesGrid = swiper.slidesGrid, 3006 enabled = swiper.enabled; 3007 if (!enabled) return; 3008 if (!params.simulateTouch && e$$1.pointerType === 'mouse') return; 3009 if (data.allowTouchCallbacks) { 3010 swiper.emit('touchEnd', e$$1); 3011 } 3012 data.allowTouchCallbacks = false; 3013 if (!data.isTouched) { 3014 if (data.isMoved && params.grabCursor) { 3015 swiper.setGrabCursor(false); 3016 } 3017 data.isMoved = false; 3018 data.startMoving = false; 3019 return; 3020 } 3021 3022 // Return Grab Cursor 3023 if (params.grabCursor && data.isMoved && data.isTouched && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) { 3024 swiper.setGrabCursor(false); 3025 } 3026 3027 // Time diff 3028 var touchEndTime = now(); 3029 var timeDiff = touchEndTime - data.touchStartTime; 3030 3031 // Tap, doubleTap, Click 3032 if (swiper.allowClick) { 3033 var pathTree = e$$1.path || e$$1.composedPath && e$$1.composedPath(); 3034 swiper.updateClickedSlide(pathTree && pathTree[0] || e$$1.target, pathTree); 3035 swiper.emit('tap click', e$$1); 3036 if (timeDiff < 300 && touchEndTime - data.lastClickTime < 300) { 3037 swiper.emit('doubleTap doubleClick', e$$1); 3038 } 3039 } 3040 data.lastClickTime = now(); 3041 nextTick(function () { 3042 if (!swiper.destroyed) swiper.allowClick = true; 3043 }); 3044 if (!data.isTouched || !data.isMoved || !swiper.swipeDirection || touches.diff === 0 && !data.loopSwapReset || data.currentTranslate === data.startTranslate && !data.loopSwapReset) { 3045 data.isTouched = false;
3046 data.isMoved = false; 3047 data.startMoving = false; 3048 return; 3049 } 3050 data.isTouched = false; 3051 data.isMoved = false; 3052 data.startMoving = false; 3053 var currentPos; 3054 if (params.followFinger) { 3055 currentPos = rtl ? swiper.translate : -swiper.translate; 3056 } else { 3057 currentPos = -data.currentTranslate; 3058 } 3059 if (params.cssMode) { 3060 return; 3061 } 3062 if (params.freeMode && params.freeMode.enabled) { 3063 swiper.freeMode.onTouchEnd({ 3064 currentPos: currentPos 3065 }); 3066 return; 3067 } 3068 3069 // Find current slide 3070 var swipeToLast = currentPos >= -swiper.maxTranslate() && !swiper.params.loop; 3071 var stopIndex = 0; 3072 var groupSize = swiper.slidesSizesGrid[0]; 3073 for (var i$$1 = 0; i$$1 < slidesGrid.length; i$$1 += i$$1 < params.slidesPerGroupSkip ? 1 : params.slidesPerGroup) { 3074 var _increment = i$$1 < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup; 3075 if (typeof slidesGrid[i$$1 + _increment] !== 'undefined') { 3076 if (swipeToLast || currentPos >= slidesGrid[i$$1] && currentPos < slidesGrid[i$$1 + _increment]) { 3077 stopIndex = i$$1; 3078 groupSize = slidesGrid[i$$1 + _increment] - slidesGrid[i$$1]; 3079 } 3080 } else if (swipeToLast || currentPos >= slidesGrid[i$$1]) { 3081 stopIndex = i$$1; 3082 groupSize = slidesGrid[slidesGrid.length - 1] - slidesGrid[slidesGrid.length - 2]; 3083 } 3084 } 3085 var rewindFirstIndex = null; 3086 var rewindLastIndex = null; 3087 if (params.rewind) { 3088 if (swiper.isBeginning) { 3089 rewindLastIndex = params.virtual && params.virtual.enabled && swiper.virtual ? swiper.virtual.slides.length - 1 : swiper.slides.length - 1; 3090 } else if (swiper.isEnd) { 3091 rewindFirstIndex = 0; 3092 } 3093 } 3094 // Find current slide size 3095 var ratio = (currentPos - slidesGrid[stopIndex]) / groupSize; 3096 var increment = stopIndex < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup; 3097 if (timeDiff > params.longSwipesMs) { 3098 // Long touches 3099 if (!params.longSwipes) { 3100 swiper.slideTo(swiper.activeIndex); 3101 return; 3102 } 3103 if (swiper.swipeDirection === 'next') { 3104 if (ratio >= params.longSwipesRatio) swiper.slideTo(params.rewind && swiper.isEnd ? rewindFirstIndex : stopIndex + increment);else swiper.slideTo(stopIndex); 3105 } 3106 if (swiper.swipeDirection === 'prev') { 3107 if (ratio > 1 - params.longSwipesRatio) { 3108 swiper.slideTo(stopIndex + increment); 3109 } else if (rewindLastIndex !== null && ratio < 0 && Math.abs(ratio) > params.longSwipesRatio) { 3110 swiper.slideTo(rewindLastIndex); 3111 } else { 3112 swiper.slideTo(stopIndex); 3113 } 3114 } 3115 } else { 3116 // Short swipes 3117 if (!params.shortSwipes) { 3118 swiper.slideTo(swiper.activeIndex); 3119 return; 3120 } 3121 var isNavButtonTarget = swiper.navigation && (e$$1.target === swiper.navigation.nextEl || e$$1.target === swiper.navigation.prevEl); 3122 if (!isNavButtonTarget) { 3123 if (swiper.swipeDirection === 'next') { 3124 swiper.slideTo(rewindFirstIndex !== null ? rewindFirstIndex : stopIndex + increment); 3125 } 3126 if (swiper.swipeDirection === 'prev') { 3127 swiper.slideTo(rewindLastIndex !== null ? rewindLastIndex : stopIndex); 3128 } 3129 } else if (e$$1.target === swiper.navigation.nextEl) { 3130 swiper.slideTo(stopIndex + increment); 3131 } else { 3132 swiper.slideTo(stopIndex); 3133 } 3134 } 3135 } 3136 function onResize() { 3137 var swiper = this; 3138 var params = swiper.params, 3139 el = swiper.el; 3140 if (el && el.offsetWidth === 0) return; 3141
3142 // Breakpoints 3143 if (params.breakpoints) { 3144 swiper.setBreakpoint(); 3145 } 3146 3147 // Save locks 3148 var allowSlideNext = swiper.allowSlideNext, 3149 allowSlidePrev = swiper.allowSlidePrev, 3150 snapGrid = swiper.snapGrid; 3151 var isVirtual = swiper.virtual && swiper.params.virtual.enabled; 3152 3153 // Disable locks on resize 3154 swiper.allowSlideNext = true; 3155 swiper.allowSlidePrev = true; 3156 swiper.updateSize(); 3157 swiper.updateSlides(); 3158 swiper.updateSlidesClasses(); 3159 var isVirtualLoop = isVirtual && params.loop; 3160 if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !swiper.isBeginning && !swiper.params.centeredSlides && !isVirtualLoop) { 3161 swiper.slideTo(swiper.slides.length - 1, 0, false, true); 3162 } else { 3163 if (swiper.params.loop && !isVirtual) { 3164 swiper.slideToLoop(swiper.realIndex, 0, false, true); 3165 } else { 3166 swiper.slideTo(swiper.activeIndex, 0, false, true); 3167 } 3168 } 3169 if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) { 3170 clearTimeout(swiper.autoplay.resizeTimeout); 3171 swiper.autoplay.resizeTimeout = setTimeout(function () { 3172 if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) { 3173 swiper.autoplay.resume(); 3174 } 3175 }, 500); 3176 } 3177 // Return locks after resize 3178 swiper.allowSlidePrev = allowSlidePrev; 3179 swiper.allowSlideNext = allowSlideNext; 3180 if (swiper.params.watchOverflow && snapGrid !== swiper.snapGrid) { 3181 swiper.checkOverflow(); 3182 } 3183 } 3184 function onClick(e$$1) { 3185 var swiper = this; 3186 if (!swiper.enabled) return; 3187 if (!swiper.allowClick) { 3188 if (swiper.params.preventClicks) e$$1.preventDefault(); 3189 if (swiper.params.preventClicksPropagation && swiper.animating) { 3190 e$$1.stopPropagation(); 3191 e$$1.stopImmediatePropagation(); 3192 } 3193 } 3194 } 3195 function onScroll() { 3196 var swiper = this; 3197 var wrapperEl = swiper.wrapperEl, 3198 rtlTranslate = swiper.rtlTranslate, 3199 enabled = swiper.enabled; 3200 if (!enabled) return; 3201 swiper.previousTranslate = swiper.translate; 3202 if (swiper.isHorizontal()) { 3203 swiper.translate = -wrapperEl.scrollLeft; 3204 } else { 3205 swiper.translate = -wrapperEl.scrollTop; 3206 } 3207 // eslint-disable-next-line 3208 if (swiper.translate === 0) swiper.translate = 0; 3209 swiper.updateActiveIndex(); 3210 swiper.updateSlidesClasses(); 3211 var newProgress; 3212 var translatesDiff = swiper.maxTranslate() - swiper.minTranslate(); 3213 if (translatesDiff === 0) { 3214 newProgress = 0; 3215 } else { 3216 newProgress = (swiper.translate - swiper.minTranslate()) / translatesDiff; 3217 } 3218 if (newProgress !== swiper.progress) { 3219 swiper.updateProgress(rtlTranslate ? -swiper.translate : swiper.translate); 3220 } 3221 swiper.emit('setTranslate', swiper.translate, false); 3222 } 3223 function onLoad(e$$1) { 3224 var swiper = this; 3225 processLazyPreloader(swiper, e$$1.target); 3226 if (swiper.params.cssMode || swiper.params.slidesPerView !== 'auto' && !swiper.params.autoHeight) { 3227 return; 3228 } 3229 swiper.update(); 3230 } 3231 function onDocumentTouchStart() { 3232 var swiper = this; 3233 if (swiper.documentTouchHandlerProceeded) return; 3234 swiper.documentTouchHandlerProceeded = true; 3235 if (swiper.params.touchReleaseOnEdges) { 3236 swiper.el.style.touchAction = 'auto'; 3237 } 3238 } 3239 var events = function events(swiper, method) { 3240 var document = getDocument(); 3241 var params = swiper.params, 3242 el = swiper.el, 3243 wrapperEl = swiper.wrapperEl, 3244 device = swiper.device; 3245 var capture = !!params.nested; 3246 var domMethod = method === 'on' ? 'addEventListener' : 'removeEventListener'; 3247 var swiperMethod = method; 3248 if (!el || typeof el === 'string') return; 3249 3250 // Touch Events 3251 document[domMethod]('touchstart', swiper.onDocumentTouchStart, { 3252 passive: false, 3253 capture: capture 3254 }); 3255 el[domMethod]('touchstart', swiper.onTouchStart, { 3256 passive: false 3257 }); 3258 el[domMethod]('pointerdown', swiper.onTouchStart, { 3259 passive: false 3260 }); 3261 document[domMethod]('touchmove', swiper.onTouchMove, { 3262 passive: false, 3263 capture: capture 3264 }); 3265 document[domMethod]('pointermove', swiper.onTouchMove, { 3266 passive: false, 3267 capture: capture 3268 }); 3269 document[domMethod]('touchend', swiper.onTouchEnd, { 3270 passive: true 3271 }); 3272 document[domMethod]('pointerup', swiper.onTouchEnd, { 3273 passive: true 3274 }); 3275 document[domMethod]('pointercancel', swiper.onTouchEnd, { 3276 passive: true 3277 }); 3278 document[domMethod]('touchcancel', swiper.onTouchEnd, { 3279 passive: true 3280 }); 3281 document[domMethod]('pointerout', swiper.onTouchEnd, { 3282 passive: true 3283 }); 3284 document[domMethod]('pointerleave', swiper.onTouchEnd, { 3285 passive: true 3286 }); 3287 document[domMethod]('contextmenu', swiper.onTouchEnd, { 3288 passive: true 3289 }); 3290 3291 // Prevent Links Clicks 3292 if (params.preventClicks || params.preventClicksPropagation) { 3293 el[domMethod]('click', swiper.onClick, true); 3294 } 3295 if (params.cssMode) { 3296 wrapperEl[domMethod]('scroll', swiper.onScroll); 3297 } 3298 3299 // Resize handler 3300 if (params.updateOnWindowResize) { 3301 swiper[swiperMethod](device.ios || device.android ? 'resize orientationchange observerUpdate' : 'resize observerUpdate', onResize, true); 3302 } else { 3303 swiper[swiperMethod]('observerUpdate', onResize, true); 3304 } 3305 3306 // Images loader 3307 el[domMethod]('load', swiper.onLoad, { 3308 capture: true 3309 }); 3310 }; 3311 function attachEvents() { 3312 var swiper = this; 3313 var params = swiper.params; 3314 swiper.onTouchStart = onTouchStart.bind(swiper); 3315 swiper.onTouchMove = onTouchMove.bind(swiper); 3316 swiper.onTouchEnd = onTouchEnd.bind(swiper); 3317 swiper.onDocumentTouchStart = onDocumentTouchStart.bind(swiper); 3318 if (params.cssMode) { 3319 swiper.onScroll = onScroll.bind(swiper); 3320 } 3321 swiper.onClick = onClick.bind(swiper); 3322 swiper.onLoad = onLoad.bind(swiper); 3323 events(swiper, 'on'); 3324 } 3325 function detachEvents() { 3326 var swiper = this; 3327 events(swiper, 'off'); 3328 } 3329 var events$1 = { 3330 attachEvents: attachEvents, 3331 detachEvents: detachEvents 3332 }; 3333 var isGridEnabled = function isGridEnabled(swiper, params) { 3334 return swiper.grid && params.grid && params.grid.rows > 1; 3335 }; 3336 function setBreakpoint() { 3337 var swiper = this; 3338 var realIndex = swiper.realIndex, 3339 initialized = swiper.initialized, 3340 params = swiper.params, 3341 el = swiper.el; 3342 var breakpoints = params.breakpoints; 3343 if (!breakpoints || breakpoints && Object.keys(breakpoints).length === 0) return; 3344 var document = getDocument(); 3345 3346 // Get breakpoint for window/container width and update parameters 3347 var breakpointsBase = params.breakpointsBase === 'window' || !params.breakpointsBase ? params.breakpointsBase : 'container'; 3348 var breakpointContainer = ['window', 'container'].includes(params.breakpointsBase) || !params.breakpointsBase ? swiper.el : document.querySelector(params.breakpointsBase);
3349 var breakpoint = swiper.getBreakpoint(breakpoints, breakpointsBase, breakpointContainer); 3350 if (!breakpoint || swiper.currentBreakpoint === breakpoint) return; 3351 var breakpointOnlyParams = breakpoint in breakpoints ? breakpoints[breakpoint] : undefined; 3352 var breakpointParams = breakpointOnlyParams || swiper.originalParams; 3353 var wasMultiRow = isGridEnabled(swiper, params); 3354 var isMultiRow = isGridEnabled(swiper, breakpointParams); 3355 var wasGrabCursor = swiper.params.grabCursor; 3356 var isGrabCursor = breakpointParams.grabCursor; 3357 var wasEnabled = params.enabled; 3358 if (wasMultiRow && !isMultiRow) { 3359 el.classList.remove("".concat(params.containerModifierClass, "grid"), "".concat(params.containerModifierClass, "grid-column")); 3360 swiper.emitContainerClasses(); 3361 } else if (!wasMultiRow && isMultiRow) { 3362 el.classList.add("".concat(params.containerModifierClass, "grid")); 3363 if (breakpointParams.grid.fill && breakpointParams.grid.fill === 'column' || !breakpointParams.grid.fill && params.grid.fill === 'column') { 3364 el.classList.add("".concat(params.containerModifierClass, "grid-column")); 3365 } 3366 swiper.emitContainerClasses(); 3367 } 3368 if (wasGrabCursor && !isGrabCursor) { 3369 swiper.unsetGrabCursor(); 3370 } else if (!wasGrabCursor && isGrabCursor) { 3371 swiper.setGrabCursor(); 3372 } 3373 3374 // Toggle navigation, pagination, scrollbar 3375 ['navigation', 'pagination', 'scrollbar'].forEach(function (prop) { 3376 if (typeof breakpointParams[prop] === 'undefined') return; 3377 var wasModuleEnabled = params[prop] && params[prop].enabled; 3378 var isModuleEnabled = breakpointParams[prop] && breakpointParams[prop].enabled; 3379 if (wasModuleEnabled && !isModuleEnabled) { 3380 swiper[prop].disable(); 3381 } 3382 if (!wasModuleEnabled && isModuleEnabled) { 3383 swiper[prop].enable(); 3384 } 3385 }); 3386 var directionChanged = breakpointParams.direction && breakpointParams.direction !== params.direction; 3387 var needsReLoop = params.loop && (breakpointParams.slidesPerView !== params.slidesPerView || directionChanged); 3388 var wasLoop = params.loop; 3389 if (directionChanged && initialized) { 3390 swiper.changeDirection(); 3391 } 3392 extend$1(swiper.params, breakpointParams); 3393 var isEnabled = swiper.params.enabled; 3394 var hasLoop = swiper.params.loop; 3395 Object.assign(swiper, { 3396 allowTouchMove: swiper.params.allowTouchMove, 3397 allowSlideNext: swiper.params.allowSlideNext, 3398 allowSlidePrev: swiper.params.allowSlidePrev 3399 }); 3400 if (wasEnabled && !isEnabled) { 3401 swiper.disable(); 3402 } else if (!wasEnabled && isEnabled) { 3403 swiper.enable(); 3404 } 3405 swiper.currentBreakpoint = breakpoint; 3406 swiper.emit('_beforeBreakpoint', breakpointParams); 3407 if (initialized) { 3408 if (needsReLoop) { 3409 swiper.loopDestroy(); 3410 swiper.loopCreate(realIndex); 3411 swiper.updateSlides(); 3412 } else if (!wasLoop && hasLoop) { 3413 swiper.loopCreate(realIndex); 3414 swiper.updateSlides(); 3415 } else if (wasLoop && !hasLoop) { 3416 swiper.loopDestroy(); 3417 } 3418 } 3419 swiper.emit('breakpoint', breakpointParams); 3420 } 3421 function getBreakpoint(breakpoints, base, containerEl) { 3422 if (base === void 0) { 3423 base = 'window'; 3424 } 3425 if (!breakpoints || base === 'container' && !containerEl) return undefined; 3426 var breakpoint = false; 3427 var window = getWindow(); 3428 var currentHeight = base === 'window' ? window.innerHeight : containerEl.clientHeight; 3429 var points = Object.keys(breakpoints).map(function (point) { 3430 if (typeof point === 'string' && point.indexOf('@') === 0) { 3431 var minRatio = parseFloat(point.substr(1)); 3432 var value = currentHeight * minRatio; 3433 return { 3434 value: value, 3435 point: point 3436 }; 3437 } 3438 return { 3439 value: point, 3440 point: point 3441 }; 3442 }); 3443 points.sort(function (a$$1, b$$1) { 3444 return parseInt(a$$1.value, 10) - parseInt(b$$1.value, 10); 3445 }); 3446 for (var i$$1 = 0; i$$1 < points.length; i$$1 += 1) { 3447 var _points$i = points[i$$1], 3448 point = _points$i.point, 3449 value = _points$i.value; 3450 if (base === 'window') { 3451 if (window.matchMedia("(min-width: ".concat(value, "px)")).matches) { 3452 breakpoint = point; 3453 } 3454 } else if (value <= containerEl.clientWidth) { 3455 breakpoint = point; 3456 } 3457 } 3458 return breakpoint || 'max'; 3459 } 3460 var breakpoints = { 3461 setBreakpoint: setBreakpoint,
3462 getBreakpoint: getBreakpoint 3463 }; 3464 function prepareClasses(entries, prefix) { 3465 var resultClasses = []; 3466 entries.forEach(function (item) { 3467 if (babelHelpers["typeof"](item) === 'object') { 3468 Object.keys(item).forEach(function (classNames) { 3469 if (item[classNames]) { 3470 resultClasses.push(prefix + classNames); 3471 } 3472 }); 3473 } else if (typeof item === 'string') { 3474 resultClasses.push(prefix + item); 3475 } 3476 }); 3477 return resultClasses; 3478 } 3479 function addClasses() { 3480 var _el$classList; 3481 var swiper = this; 3482 var classNames = swiper.classNames, 3483 params = swiper.params, 3484 rtl = swiper.rtl, 3485 el = swiper.el, 3486 device = swiper.device; 3487 // prettier-ignore 3488 var suffixes = prepareClasses(['initialized', params.direction, { 3489 'free-mode': swiper.params.freeMode && params.freeMode.enabled 3490 }, { 3491 'autoheight': params.autoHeight 3492 }, { 3493 'rtl': rtl 3494 }, { 3495 'grid': params.grid && params.grid.rows > 1 3496 }, { 3497 'grid-column': params.grid && params.grid.rows > 1 && params.grid.fill === 'column' 3498 }, { 3499 'android': device.android 3500 }, { 3501 'ios': device.ios 3502 }, { 3503 'css-mode': params.cssMode 3504 }, { 3505 'centered': params.cssMode && params.centeredSlides 3506 }, { 3507 'watch-progress': params.watchSlidesProgress 3508 }], params.containerModifierClass); 3509 classNames.push.apply(classNames, babelHelpers.toConsumableArray(suffixes)); 3510 (_el$classList = el.classList).add.apply(_el$classList, babelHelpers.toConsumableArray(classNames)); 3511 swiper.emitContainerClasses(); 3512 } 3513 function removeClasses() { 3514 var _el$classList2; 3515 var swiper = this; 3516 var el = swiper.el, 3517 classNames = swiper.classNames; 3518 if (!el || typeof el === 'string') return; 3519 (_el$classList2 = el.classList).remove.apply(_el$classList2, babelHelpers.toConsumableArray(classNames)); 3520 swiper.emitContainerClasses(); 3521 } 3522 var classes = { 3523 addClasses: addClasses, 3524 removeClasses: removeClasses 3525 }; 3526 function checkOverflow() { 3527 var swiper = this; 3528 var wasLocked = swiper.isLocked, 3529 params = swiper.params; 3530 var slidesOffsetBefore = params.slidesOffsetBefore; 3531 if (slidesOffsetBefore) { 3532 var lastSlideIndex = swiper.slides.length - 1; 3533 var lastSlideRightEdge = swiper.slidesGrid[lastSlideIndex] + swiper.slidesSizesGrid[lastSlideIndex] + slidesOffsetBefore * 2; 3534 swiper.isLocked = swiper.size > lastSlideRightEdge; 3535 } else { 3536 swiper.isLocked = swiper.snapGrid.length === 1; 3537 } 3538 if (params.allowSlideNext === true) { 3539 swiper.allowSlideNext = !swiper.isLocked; 3540 } 3541 if (params.allowSlidePrev === true) { 3542 swiper.allowSlidePrev = !swiper.isLocked; 3543 } 3544 if (wasLocked && wasLocked !== swiper.isLocked) { 3545 swiper.isEnd = false; 3546 } 3547 if (wasLocked !== swiper.isLocked) { 3548 swiper.emit(swiper.isLocked ? 'lock' : 'unlock'); 3549 } 3550 } 3551 var checkOverflow$1 = { 3552 checkOverflow: checkOverflow 3553 }; 3554 var defaults = { 3555 init: true, 3556 direction: 'horizontal', 3557 oneWayMovement: false, 3558 swiperElementNodeName: 'SWIPER-CONTAINER', 3559 touchEventsTarget: 'wrapper', 3560 initialSlide: 0, 3561 speed: 300, 3562 cssMode: false, 3563 updateOnWindowResize: true, 3564 resizeObserver: true, 3565 nested: false, 3566 createElements: false, 3567 eventsPrefix: 'swiper', 3568 enabled: true, 3569 focusableElements: 'input, select, option, textarea, button, video, label', 3570 // Overrides 3571 width: null, 3572 height: null, 3573 // 3574 preventInteractionOnTransition: false, 3575 // ssr 3576 userAgent: null, 3577 url: null, 3578 // To support iOS's swipe-to-go-back gesture (when being used in-app). 3579 edgeSwipeDetection: false, 3580 edgeSwipeThreshold: 20, 3581 // Autoheight 3582 autoHeight: false, 3583 // Set wrapper width 3584 setWrapperSize: false, 3585 // Virtual Translate 3586 virtualTranslate: false, 3587 // Effects 3588 effect: 'slide', 3589 // 'slide' or 'fade' or 'cube' or 'coverflow' or 'flip' 3590
3591 // Breakpoints 3592 breakpoints: undefined, 3593 breakpointsBase: 'window', 3594 // Slides grid 3595 spaceBetween: 0, 3596 slidesPerView: 1, 3597 slidesPerGroup: 1, 3598 slidesPerGroupSkip: 0, 3599 slidesPerGroupAuto: false, 3600 centeredSlides: false, 3601 centeredSlidesBounds: false, 3602 slidesOffsetBefore: 0, 3603 // in px 3604 slidesOffsetAfter: 0, 3605 // in px 3606 normalizeSlideIndex: true, 3607 centerInsufficientSlides: false, 3608 // Disable swiper and hide navigation when container not overflow 3609 watchOverflow: true, 3610 // Round length 3611 roundLengths: false, 3612 // Touches 3613 touchRatio: 1, 3614 touchAngle: 45, 3615 simulateTouch: true, 3616 shortSwipes: true, 3617 longSwipes: true, 3618 longSwipesRatio: 0.5, 3619 longSwipesMs: 300, 3620 followFinger: true, 3621 allowTouchMove: true, 3622 threshold: 5, 3623 touchMoveStopPropagation: false, 3624 touchStartPreventDefault: true, 3625 touchStartForcePreventDefault: false, 3626 touchReleaseOnEdges: false, 3627 // Unique Navigation Elements 3628 uniqueNavElements: true, 3629 // Resistance 3630 resistance: true, 3631 resistanceRatio: 0.85, 3632 // Progress 3633 watchSlidesProgress: false, 3634 // Cursor 3635 grabCursor: false, 3636 // Clicks 3637 preventClicks: true, 3638 preventClicksPropagation: true, 3639 slideToClickedSlide: false, 3640 // loop 3641 loop: false, 3642 loopAddBlankSlides: true, 3643 loopAdditionalSlides: 0, 3644 loopPreventsSliding: true, 3645 // rewind 3646 rewind: false, 3647 // Swiping/no swiping 3648 allowSlidePrev: true, 3649 allowSlideNext: true, 3650 swipeHandler: null, 3651 // '.swipe-handler', 3652 noSwiping: true, 3653 noSwipingClass: 'swiper-no-swiping', 3654 noSwipingSelector: null, 3655 // Passive Listeners 3656 passiveListeners: true, 3657 maxBackfaceHiddenSlides: 10, 3658 // NS 3659 containerModifierClass: 'swiper-', 3660 // NEW 3661 slideClass: 'swiper-slide', 3662 slideBlankClass: 'swiper-slide-blank', 3663 slideActiveClass: 'swiper-slide-active', 3664 slideVisibleClass: 'swiper-slide-visible', 3665 slideFullyVisibleClass: 'swiper-slide-fully-visible', 3666 slideNextClass: 'swiper-slide-next', 3667 slidePrevClass: 'swiper-slide-prev', 3668 wrapperClass: 'swiper-wrapper', 3669 lazyPreloaderClass: 'swiper-lazy-preloader', 3670 lazyPreloadPrevNext: 0, 3671 // Callbacks 3672 runCallbacksOnInit: true, 3673 // Internals 3674 _emitClasses: false 3675 }; 3676 function moduleExtendParams(params, allModulesParams) { 3677 return function extendParams(obj) { 3678 if (obj === void 0) { 3679 obj = {}; 3680 } 3681 var moduleParamName = Object.keys(obj)[0]; 3682 var moduleParams = obj[moduleParamName]; 3683 if (babelHelpers["typeof"](moduleParams) !== 'object' || moduleParams === null) { 3684 extend$1(allModulesParams, obj); 3685 return; 3686 } 3687 if (params[moduleParamName] === true) { 3688 params[moduleParamName] = { 3689 enabled: true 3690 }; 3691 } 3692 if (moduleParamName === 'navigation' && params[moduleParamName] && params[moduleParamName].enabled && !params[moduleParamName].prevEl && !params[moduleParamName].nextEl) { 3693 params[moduleParamName].auto = true; 3694 } 3695 if (['pagination', 'scrollbar'].indexOf(moduleParamName) >= 0 && params[moduleParamName] && params[moduleParamName].enabled && !params[moduleParamName].el) { 3696 params[moduleParamName].auto = true; 3697 } 3698 if (!(moduleParamName in params && 'enabled' in moduleParams)) { 3699 extend$1(allModulesParams, obj); 3700 return; 3701 } 3702 if (babelHelpers["typeof"](params[moduleParamName]) === 'object' && !('enabled' in params[moduleParamName])) { 3703 params[moduleParamName].enabled = true; 3704 } 3705 if (!params[moduleParamName]) params[moduleParamName] = { 3706 enabled: false 3707 }; 3708 extend$1(allModulesParams, obj); 3709 }; 3710 } 3711 3712 /* eslint no-param-reassign: "off" */ 3713 var prototypes = { 3714 eventsEmitter: eventsEmitter, 3715 update: update, 3716 translate: translate, 3717 transition: transition, 3718 slide: slide, 3719 loop: loop, 3720 grabCursor: grabCursor, 3721 events: events$1, 3722 breakpoints: breakpoints, 3723 checkOverflow: checkOverflow$1, 3724 classes: classes 3725 }; 3726 var extendedDefaults = {}; 3727 var Swiper = /*#__PURE__*/function () { 3728 function Swiper() { 3729 babelHelpers.classCallCheck(this, Swiper); 3730 var el; 3731 var params; 3732 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 3733 args[_key] = arguments[_key]; 3734 }
3735 if (args.length === 1 && args[0].constructor && Object.prototype.toString.call(args[0]).slice(8, -1) === 'Object') { 3736 params = args[0]; 3737 } else { 3738 el = args[0]; 3739 params = args[1]; 3740 } 3741 if (!params) params = {}; 3742 params = extend$1({}, params); 3743 if (el && !params.el) params.el = el; 3744 var document = getDocument(); 3745 if (params.el && typeof params.el === 'string' && document.querySelectorAll(params.el).length > 1) { 3746 var swipers = []; 3747 document.querySelectorAll(params.el).forEach(function (containerEl) { 3748 var newParams = extend$1({}, params, { 3749 el: containerEl 3750 }); 3751 swipers.push(new Swiper(newParams)); 3752 }); 3753 // eslint-disable-next-line no-constructor-return 3754 return swipers; 3755 } 3756 3757 // Swiper Instance 3758 var swiper = this; 3759 swiper.__swiper__ = true; 3760 swiper.support = getSupport(); 3761 swiper.device = getDevice({ 3762 userAgent: params.userAgent 3763 }); 3764 swiper.browser = getBrowser(); 3765 swiper.eventsListeners = {}; 3766 swiper.eventsAnyListeners = []; 3767 swiper.modules = babelHelpers.toConsumableArray(swiper.__modules__); 3768 if (params.modules && Array.isArray(params.modules)) { 3769 var _swiper$modules; 3770 (_swiper$modules = swiper.modules).push.apply(_swiper$modules, babelHelpers.toConsumableArray(params.modules)); 3771 } 3772 var allModulesParams = {}; 3773 swiper.modules.forEach(function (mod) { 3774 mod({ 3775 params: params, 3776 swiper: swiper, 3777 extendParams: moduleExtendParams(params, allModulesParams), 3778 on: swiper.on.bind(swiper), 3779 once: swiper.once.bind(swiper), 3780 off: swiper.off.bind(swiper), 3781 emit: swiper.emit.bind(swiper) 3782 }); 3783 }); 3784 3785 // Extend defaults with modules params 3786 var swiperParams = extend$1({}, defaults, allModulesParams); 3787 3788 // Extend defaults with passed params 3789 swiper.params = extend$1({}, swiperParams, extendedDefaults, params); 3790 swiper.originalParams = extend$1({}, swiper.params); 3791 swiper.passedParams = extend$1({}, params); 3792 3793 // add event listeners 3794 if (swiper.params && swiper.params.on) {
3795 Object.keys(swiper.params.on).forEach(function (eventName) { 3796 swiper.on(eventName, swiper.params.on[eventName]); 3797 }); 3798 } 3799 if (swiper.params && swiper.params.onAny) { 3800 swiper.onAny(swiper.params.onAny); 3801 } 3802 3803 // Extend Swiper 3804 Object.assign(swiper, { 3805 enabled: swiper.params.enabled, 3806 el: el, 3807 // Classes 3808 classNames: [], 3809 // Slides 3810 slides: [], 3811 slidesGrid: [], 3812 snapGrid: [], 3813 slidesSizesGrid: [], 3814 // isDirection 3815 isHorizontal: function isHorizontal() { 3816 return swiper.params.direction === 'horizontal'; 3817 }, 3818 isVertical: function isVertical() { 3819 return swiper.params.direction === 'vertical'; 3820 }, 3821 // Indexes 3822 activeIndex: 0, 3823 realIndex: 0, 3824 // 3825 isBeginning: true, 3826 isEnd: false, 3827 // Props 3828 translate: 0, 3829 previousTranslate: 0, 3830 progress: 0, 3831 velocity: 0, 3832 animating: false, 3833 cssOverflowAdjustment: function cssOverflowAdjustment() { 3834 // Returns 0 unless `translate` is > 2**23 3835 // Should be subtracted from css values to prevent overflow 3836 return Math.trunc(this.translate / Math.pow(2, 23)) * Math.pow(2, 23); 3837 }, 3838 // Locks 3839 allowSlideNext: swiper.params.allowSlideNext, 3840 allowSlidePrev: swiper.params.allowSlidePrev, 3841 // Touch Events 3842 touchEventsData: { 3843 isTouched: undefined, 3844 isMoved: undefined, 3845 allowTouchCallbacks: undefined, 3846 touchStartTime: undefined, 3847 isScrolling: undefined, 3848 currentTranslate: undefined, 3849 startTranslate: undefined, 3850 allowThresholdMove: undefined, 3851 // Form elements to match 3852 focusableElements: swiper.params.focusableElements, 3853 // Last click time 3854 lastClickTime: 0, 3855 clickTimeout: undefined, 3856 // Velocities 3857 velocities: [], 3858 allowMomentumBounce: undefined, 3859 startMoving: undefined, 3860 pointerId: null, 3861 touchId: null 3862 }, 3863 // Clicks 3864 allowClick: true, 3865 // Touches 3866 allowTouchMove: swiper.params.allowTouchMove, 3867 touches: { 3868 startX: 0, 3869 startY: 0, 3870 currentX: 0, 3871 currentY: 0, 3872 diff: 0 3873 }, 3874 // Images 3875 imagesToLoad: [], 3876 imagesLoaded: 0 3877 }); 3878 swiper.emit('_swiper'); 3879 3880 // Init 3881 if (swiper.params.init) { 3882 swiper.init(); 3883 } 3884 3885 // Return app instance 3886 // eslint-disable-next-line no-constructor-return 3887 return swiper; 3888 } 3889 babelHelpers.createClass(Swiper, [{ 3890 key: "getDirectionLabel", 3891 value: function getDirectionLabel(property) { 3892 if (this.isHorizontal()) { 3893 return property; 3894 } 3895 // prettier-ignore 3896 return { 3897 'width': 'height', 3898 'margin-top': 'margin-left', 3899 'margin-bottom ': 'margin-right', 3900 'margin-left': 'margin-top', 3901 'margin-right': 'margin-bottom', 3902 'padding-left': 'padding-top', 3903 'padding-right': 'padding-bottom', 3904 'marginRight': 'marginBottom' 3905 }[property]; 3906 } 3907 }, { 3908 key: "getSlideIndex", 3909 value: function getSlideIndex(slideEl) { 3910 var slidesEl = this.slidesEl, 3911 params = this.params; 3912 var slides = elementChildren(slidesEl, ".".concat(params.slideClass, ", swiper-slide")); 3913 var firstSlideIndex = elementIndex(slides[0]); 3914 return elementIndex(slideEl) - firstSlideIndex; 3915 } 3916 }, { 3917 key: "getSlideIndexByData", 3918 value: function getSlideIndexByData(index) { 3919 return this.getSlideIndex(this.slides.find(function (slideEl) { 3920 return slideEl.getAttribute('data-swiper-slide-index') * 1 === index; 3921 })); 3922 } 3923 }, { 3924 key: "getSlideIndexWhenGrid", 3925 value: function getSlideIndexWhenGrid(index) { 3926 if (this.grid && this.params.grid && this.params.grid.rows > 1) { 3927 if (this.params.grid.fill === 'column') { 3928 index = Math.floor(index / this.params.grid.rows); 3929 } else if (this.params.grid.fill === 'row') {
3930 index = index % Math.ceil(this.slides.length / this.params.grid.rows); 3931 } 3932 } 3933 return index; 3934 } 3935 }, { 3936 key: "recalcSlides", 3937 value: function recalcSlides() { 3938 var swiper = this; 3939 var slidesEl = swiper.slidesEl, 3940 params = swiper.params; 3941 swiper.slides = elementChildren(slidesEl, ".".concat(params.slideClass, ", swiper-slide")); 3942 } 3943 }, { 3944 key: "enable", 3945 value: function enable() { 3946 var swiper = this; 3947 if (swiper.enabled) return; 3948 swiper.enabled = true; 3949 if (swiper.params.grabCursor) { 3950 swiper.setGrabCursor(); 3951 } 3952 swiper.emit('enable'); 3953 } 3954 }, { 3955 key: "disable", 3956 value: function disable() { 3957 var swiper = this; 3958 if (!swiper.enabled) return; 3959 swiper.enabled = false; 3960 if (swiper.params.grabCursor) { 3961 swiper.unsetGrabCursor(); 3962 } 3963 swiper.emit('disable'); 3964 } 3965 }, { 3966 key: "setProgress", 3967 value: function setProgress(progress, speed) { 3968 var swiper = this; 3969 progress = Math.min(Math.max(progress, 0), 1); 3970 var min = swiper.minTranslate(); 3971 var max = swiper.maxTranslate(); 3972 var current = (max - min) * progress + min; 3973 swiper.translateTo(current, typeof speed === 'undefined' ? 0 : speed); 3974 swiper.updateActiveIndex(); 3975 swiper.updateSlidesClasses(); 3976 } 3977 }, { 3978 key: "emitContainerClasses", 3979 value: function emitContainerClasses() { 3980 var swiper = this; 3981 if (!swiper.params._emitClasses || !swiper.el) return; 3982 var cls = swiper.el.className.split(' ').filter(function (className) { 3983 return className.indexOf('swiper') === 0 || className.indexOf(swiper.params.containerModifierClass) === 0; 3984 }); 3985 swiper.emit('_containerClasses', cls.join(' ')); 3986 } 3987 }, { 3988 key: "getSlideClasses", 3989 value: function getSlideClasses(slideEl) { 3990 var swiper = this; 3991 if (swiper.destroyed) return ''; 3992 return slideEl.className.split(' ').filter(function (className) { 3993 return className.indexOf('swiper-slide') === 0 || className.indexOf(swiper.params.slideClass) === 0; 3994 }).join(' '); 3995 } 3996 }, { 3997 key: "emitSlidesClasses", 3998 value: function emitSlidesClasses() { 3999 var swiper = this; 4000 if (!swiper.params._emitClasses || !swiper.el) return; 4001 var updates = []; 4002 swiper.slides.forEach(function (slideEl) { 4003 var classNames = swiper.getSlideClasses(slideEl); 4004 updates.push({ 4005 slideEl: slideEl, 4006 classNames: classNames 4007 }); 4008 swiper.emit('_slideClass', slideEl, classNames); 4009 }); 4010 swiper.emit('_slideClasses', updates); 4011 } 4012 }, { 4013 key: "slidesPerViewDynamic", 4014 value: function slidesPerViewDynamic(view, exact) { 4015 if (view === void 0) { 4016 view = 'current'; 4017 } 4018 if (exact === void 0) { 4019 exact = false; 4020 } 4021 var swiper = this; 4022 var params = swiper.params, 4023 slides = swiper.slides, 4024 slidesGrid = swiper.slidesGrid, 4025 slidesSizesGrid = swiper.slidesSizesGrid, 4026 swiperSize = swiper.size, 4027 activeIndex = swiper.activeIndex; 4028 var spv = 1; 4029 if (typeof params.slidesPerView === 'number') return params.slidesPerView; 4030 if (params.centeredSlides) { 4031 var slideSize = slides[activeIndex] ? Math.ceil(slides[activeIndex].swiperSlideSize) : 0; 4032 var breakLoop; 4033 for (var i$$1 = activeIndex + 1; i$$1 < slides.length; i$$1 += 1) { 4034 if (slides[i$$1] && !breakLoop) { 4035 slideSize += Math.ceil(slides[i$$1].swiperSlideSize); 4036 spv += 1; 4037 if (slideSize > swiperSize) breakLoop = true; 4038 } 4039 } 4040 for (var _i7 = activeIndex - 1; _i7 >= 0; _i7 -= 1) { 4041 if (slides[_i7] && !breakLoop) { 4042 slideSize += slides[_i7].swiperSlideSize; 4043 spv += 1; 4044 if (slideSize > swiperSize) breakLoop = true; 4045 } 4046 } 4047 } else { 4048 // eslint-disable-next-line 4049 if (view === 'current') { 4050 for (var _i8 = activeIndex + 1; _i8 < slides.length; _i8 += 1) { 4051 var slideInView = exact ? slidesGrid[_i8] + slidesSizesGrid[_i8] - slidesGrid[activeIndex] < swiperSize : slidesGrid[_i8] - slidesGrid[activeIndex] < swiperSize; 4052 if (slideInView) { 4053 spv += 1; 4054 } 4055 } 4056 } else { 4057 // previous 4058 for (var _i9 = activeIndex - 1; _i9 >= 0; _i9 -= 1) { 4059 var _slideInView = slidesGrid[activeIndex] - slidesGrid[_i9] < swiperSize; 4060 if (_slideInView) { 4061 spv += 1; 4062 } 4063 } 4064 } 4065 } 4066 return spv; 4067 } 4068 }, { 4069 key: "update",
4070 value: function update() { 4071 var swiper = this; 4072 if (!swiper || swiper.destroyed) return; 4073 var snapGrid = swiper.snapGrid, 4074 params = swiper.params; 4075 // Breakpoints 4076 if (params.breakpoints) { 4077 swiper.setBreakpoint(); 4078 } 4079 babelHelpers.toConsumableArray(swiper.el.querySelectorAll('[loading="lazy"]')).forEach(function (imageEl) { 4080 if (imageEl.complete) { 4081 processLazyPreloader(swiper, imageEl); 4082 } 4083 }); 4084 swiper.updateSize(); 4085 swiper.updateSlides(); 4086 swiper.updateProgress(); 4087 swiper.updateSlidesClasses(); 4088 function setTranslate() { 4089 var translateValue = swiper.rtlTranslate ? swiper.translate * -1 : swiper.translate; 4090 var newTranslate = Math.min(Math.max(translateValue, swiper.maxTranslate()), swiper.minTranslate()); 4091 swiper.setTranslate(newTranslate); 4092 swiper.updateActiveIndex(); 4093 swiper.updateSlidesClasses(); 4094 } 4095 var translated; 4096 if (params.freeMode && params.freeMode.enabled && !params.cssMode) { 4097 setTranslate(); 4098 if (params.autoHeight) { 4099 swiper.updateAutoHeight(); 4100 } 4101 } else { 4102 if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !params.centeredSlides) { 4103 var slides = swiper.virtual && params.virtual.enabled ? swiper.virtual.slides : swiper.slides; 4104 translated = swiper.slideTo(slides.length - 1, 0, false, true); 4105 } else { 4106 translated = swiper.slideTo(swiper.activeIndex, 0, false, true); 4107 } 4108 if (!translated) { 4109 setTranslate(); 4110 } 4111 } 4112 if (params.watchOverflow && snapGrid !== swiper.snapGrid) { 4113 swiper.checkOverflow(); 4114 } 4115 swiper.emit('update'); 4116 } 4117 }, { 4118 key: "changeDirection", 4119 value: function changeDirection(newDirection, needUpdate) { 4120 if (needUpdate === void 0) { 4121 needUpdate = true; 4122 } 4123 var swiper = this; 4124 var currentDirection = swiper.params.direction; 4125 if (!newDirection) { 4126 // eslint-disable-next-line 4127 newDirection = currentDirection === 'horizontal' ? 'vertical' : 'horizontal'; 4128 } 4129 if (newDirection === currentDirection || newDirection !== 'horizontal' && newDirection !== 'vertical') { 4130 return swiper; 4131 } 4132 swiper.el.classList.remove("".concat(swiper.params.containerModifierClass).concat(currentDirection)); 4133 swiper.el.classList.add("".concat(swiper.params.containerModifierClass).concat(newDirection)); 4134 swiper.emitContainerClasses(); 4135 swiper.params.direction = newDirection; 4136 swiper.slides.forEach(function (slideEl) { 4137 if (newDirection === 'vertical') { 4138 slideEl.style.width = ''; 4139 } else { 4140 slideEl.style.height = ''; 4141 } 4142 }); 4143 swiper.emit('changeDirection'); 4144 if (needUpdate) swiper.update(); 4145 return swiper; 4146 } 4147 }, { 4148 key: "changeLanguageDirection", 4149 value: function changeLanguageDirection(direction) { 4150 var swiper = this; 4151 if (swiper.rtl && direction === 'rtl' || !swiper.rtl && direction === 'ltr') return; 4152 swiper.rtl = direction === 'rtl'; 4153 swiper.rtlTranslate = swiper.params.direction === 'horizontal' && swiper.rtl; 4154 if (swiper.rtl) { 4155 swiper.el.classList.add("".concat(swiper.params.containerModifierClass, "rtl")); 4156 swiper.el.dir = 'rtl'; 4157 } else { 4158 swiper.el.classList.remove("".concat(swiper.params.containerModifierClass, "rtl")); 4159 swiper.el.dir = 'ltr'; 4160 } 4161 swiper.update(); 4162 } 4163 }, { 4164 key: "mount", 4165 value: function mount(element) { 4166 var swiper = this; 4167 if (swiper.mounted) return true; 4168 4169 // Find el 4170 var el = element || swiper.params.el; 4171 if (typeof el === 'string') { 4172 el = document.querySelector(el); 4173 } 4174 if (!el) { 4175 return false;
4176 } 4177 el.swiper = swiper; 4178 if (el.parentNode && el.parentNode.host && el.parentNode.host.nodeName === swiper.params.swiperElementNodeName.toUpperCase()) { 4179 swiper.isElement = true; 4180 } 4181 var getWrapperSelector = function getWrapperSelector() { 4182 return ".".concat((swiper.params.wrapperClass || '').trim().split(' ').join('.')); 4183 }; 4184 var getWrapper = function getWrapper() { 4185 if (el && el.shadowRoot && el.shadowRoot.querySelector) { 4186 var res = el.shadowRoot.querySelector(getWrapperSelector()); 4187 // Children needs to return slot items 4188 return res; 4189 } 4190 return elementChildren(el, getWrapperSelector())[0]; 4191 }; 4192 // Find Wrapper 4193 var wrapperEl = getWrapper(); 4194 if (!wrapperEl && swiper.params.createElements) { 4195 wrapperEl = createElement('div', swiper.params.wrapperClass); 4196 el.append(wrapperEl); 4197 elementChildren(el, ".".concat(swiper.params.slideClass)).forEach(function (slideEl) { 4198 wrapperEl.append(slideEl); 4199 }); 4200 } 4201 Object.assign(swiper, { 4202 el: el, 4203 wrapperEl: wrapperEl, 4204 slidesEl: swiper.isElement && !el.parentNode.host.slideSlots ? el.parentNode.host : wrapperEl, 4205 hostEl: swiper.isElement ? el.parentNode.host : el, 4206 mounted: true, 4207 // RTL 4208 rtl: el.dir.toLowerCase() === 'rtl' || elementStyle(el, 'direction') === 'rtl', 4209 rtlTranslate: swiper.params.direction === 'horizontal' && (el.dir.toLowerCase() === 'rtl' || elementStyle(el, 'direction') === 'rtl'), 4210 wrongRTL: elementStyle(wrapperEl, 'display') === '-webkit-box' 4211 }); 4212 return true; 4213 } 4214 }, { 4215 key: "init", 4216 value: function init(el) { 4217 var swiper = this; 4218 if (swiper.initialized) return swiper; 4219 var mounted = swiper.mount(el); 4220 if (mounted === false) return swiper; 4221 swiper.emit('beforeInit'); 4222 4223 // Set breakpoint 4224 if (swiper.params.breakpoints) { 4225 swiper.setBreakpoint(); 4226 } 4227 4228 // Add Classes 4229 swiper.addClasses(); 4230 4231 // Update size 4232 swiper.updateSize(); 4233 4234 // Update slides 4235 swiper.updateSlides(); 4236 if (swiper.params.watchOverflow) { 4237 swiper.checkOverflow(); 4238 } 4239 4240 // Set Grab Cursor 4241 if (swiper.params.grabCursor && swiper.enabled) { 4242 swiper.setGrabCursor(); 4243 } 4244 4245 // Slide To Initial Slide 4246 if (swiper.params.loop && swiper.virtual && swiper.params.virtual.enabled) { 4247 swiper.slideTo(swiper.params.initialSlide + swiper.virtual.slidesBefore, 0, swiper.params.runCallbacksOnInit, false, true); 4248 } else { 4249 swiper.slideTo(swiper.params.initialSlide, 0, swiper.params.runCallbacksOnInit, false, true); 4250 } 4251 4252 // Create loop 4253 if (swiper.params.loop) { 4254 swiper.loopCreate(undefined, true); 4255 } 4256 4257 // Attach events 4258 swiper.attachEvents(); 4259 var lazyElements = babelHelpers.toConsumableArray(swiper.el.querySelectorAll('[loading="lazy"]')); 4260 if (swiper.isElement) { 4261 lazyElements.push.apply(lazyElements, babelHelpers.toConsumableArray(swiper.hostEl.querySelectorAll('[loading="lazy"]'))); 4262 } 4263 lazyElements.forEach(function (imageEl) { 4264 if (imageEl.complete) { 4265 processLazyPreloader(swiper, imageEl); 4266 } else { 4267 imageEl.addEventListener('load', function (e$$1) { 4268 processLazyPreloader(swiper, e$$1.target); 4269 }); 4270 } 4271 }); 4272 preload(swiper); 4273 4274 // Init Flag 4275 swiper.initialized = true; 4276 preload(swiper); 4277 4278 // Emit 4279 swiper.emit('init'); 4280 swiper.emit('afterInit'); 4281 return swiper; 4282 } 4283 }, {
4284 key: "destroy", 4285 value: function destroy(deleteInstance, cleanStyles) { 4286 if (deleteInstance === void 0) { 4287 deleteInstance = true; 4288 } 4289 if (cleanStyles === void 0) { 4290 cleanStyles = true; 4291 } 4292 var swiper = this; 4293 var params = swiper.params, 4294 el = swiper.el, 4295 wrapperEl = swiper.wrapperEl, 4296 slides = swiper.slides; 4297 if (typeof swiper.params === 'undefined' || swiper.destroyed) { 4298 return null; 4299 } 4300 swiper.emit('beforeDestroy'); 4301 4302 // Init Flag 4303 swiper.initialized = false; 4304 4305 // Detach events 4306 swiper.detachEvents(); 4307 4308 // Destroy loop 4309 if (params.loop) { 4310 swiper.loopDestroy(); 4311 } 4312 4313 // Cleanup styles 4314 if (cleanStyles) { 4315 swiper.removeClasses(); 4316 if (el && typeof el !== 'string') { 4317 el.removeAttribute('style'); 4318 } 4319 if (wrapperEl) { 4320 wrapperEl.removeAttribute('style'); 4321 } 4322 if (slides && slides.length) { 4323 slides.forEach(function (slideEl) { 4324 slideEl.classList.remove(params.slideVisibleClass, params.slideFullyVisibleClass, params.slideActiveClass, params.slideNextClass, params.slidePrevClass); 4325 slideEl.removeAttribute('style'); 4326 slideEl.removeAttribute('data-swiper-slide-index'); 4327 }); 4328 } 4329 } 4330 swiper.emit('destroy'); 4331 4332 // Detach emitter events 4333 Object.keys(swiper.eventsListeners).forEach(function (eventName) { 4334 swiper.off(eventName); 4335 }); 4336 if (deleteInstance !== false) { 4337 if (swiper.el && typeof swiper.el !== 'string') { 4338 swiper.el.swiper = null; 4339 } 4340 deleteProps(swiper); 4341 } 4342 swiper.destroyed = true; 4343 return null; 4344 } 4345 }], [{ 4346 key: "extendDefaults", 4347 value: function extendDefaults(newDefaults) { 4348 extend$1(extendedDefaults, newDefaults); 4349 } 4350 }, { 4351 key: "installModule", 4352 value: function installModule(mod) { 4353 if (!Swiper.prototype.__modules__) Swiper.prototype.__modules__ = []; 4354 var modules = Swiper.prototype.__modules__; 4355 if (typeof mod === 'function' && modules.indexOf(mod) < 0) { 4356 modules.push(mod); 4357 } 4358 } 4359 }, { 4360 key: "use", 4361 value: function use(module) { 4362 if (Array.isArray(module)) { 4363 module.forEach(function (m) { 4364 return Swiper.installModule(m); 4365 }); 4366 return Swiper; 4367 } 4368 Swiper.installModule(module); 4369 return Swiper; 4370 } 4371 }, { 4372 key: "extendedDefaults", 4373 get: function get() { 4374 return extendedDefaults; 4375 } 4376 }, { 4377 key: "defaults", 4378 get: function get() { 4379 return defaults; 4380 } 4381 }]); 4382 return Swiper; 4383 }(); 4384 Object.keys(prototypes).forEach(function (prototypeGroup) { 4385 Object.keys(prototypes[prototypeGroup]).forEach(function (protoMethod) { 4386 Swiper.prototype[protoMethod] = prototypes[prototypeGroup][protoMethod]; 4387 }); 4388 }); 4389 Swiper.use([Resize, Observer]); 4390 4391 /** 4392 * Swiper 11.2.10 4393 * Most modern mobile touch slider and framework with hardware accelerated transitions 4394 * https://swiperjs.com 4395 * 4396 * Copyright 2014-2025 Vladimir Kharlampidi 4397 * 4398 * Released under the MIT License 4399 * 4400 * Released on: June 28, 2025 4401 */ 4402 4403 var SearchTab = { 4404 name: "SearchTab", 4405 props: { 4406 label: { 4407 type: String, 4408 required: true 4409 }, 4410 counter: { 4411 type: [Number, String], 4412 "default": null 4413 }, 4414 selected: { 4415 type: Boolean, 4416 "default": false 4417 }, 4418 disabled: { 4419 type: Boolean, 4420 "default": false 4421 } 4422 }, 4423 emits: ["click"], 4424 // language=Vue
4425 template: "\n <span class=\"search__tab\"\n :class=\"{\n\t\t\t\t'search__tab--selected': selected,\n\t\t\t\t'search__tab--disabled': disabled\n\t\t\t}\"\n :disabled=\"disabled\"\n @click=\"$emit('click')\"\n >\n <span class=\"search__tab-title\">{{ label }}</span>\n <span v-if=\"counter !== null && counter !== ''\"\n class=\"search__tab-counter\"\n >{{ counter }}</span>\n </span>\n " 4426 }; 4427 4428 var SearchTabs = { 4429 name: "SearchTabs", 4430 components: { 4431 SearchTab: SearchTab 4432 }, 4433 props: { 4434 modelValue: { 4435 type: [String, Number], 4436 required: true 4437 }, 4438 items: { 4439 type: Array, 4440 required: true 4441 } 4442 }, 4443 emits: ["update:modelValue", "change"], 4444 data: function data() { 4445 return { 4446 swiperInstance: null 4447 }; 4448 }, 4449 mounted: function mounted() { 4450 var _this = this; 4451 this.$nextTick(function () { 4452 _this.swiperInstance = new Swiper(_this.$refs.swiper, { 4453 slidesPerView: "auto", 4454 spaceBetween: 8, 4455 resistance: true, 4456 resistanceRatio: 0 4457 }); 4458 }); 4459 }, 4460 beforeUnmount: function beforeUnmount() { 4461 if (this.swiperInstance) { 4462 this.swiperInstance.destroy(true, false); 4463 this.swiperInstance = null; 4464 } 4465 }, 4466 computed: { 4467 filteredItems: function filteredItems() { 4468 if (this.items.length === 2 && this.items[0].id === "all") { 4469 var onlyTab = this.items.slice(1)[0]; 4470 this.$emit('update:modelValue', onlyTab.id); 4471 return this.items.slice(1); 4472 } 4473 return this.items; 4474 } 4475 }, 4476 // language=Vue 4477 template: "\n <div class=\"search__tabs-group swiper\" ref=\"swiper\">\n <ul class=\"search__tabs swiper-wrapper\">\n <li class=\"swiper-slide\"\n v-for=\"item in filteredItems\"\n :key=\"item.id\"\n >\n <SearchTab\n :label=\"item.label\"\n :counter=\"item.counter\"\n :selected=\"item.id === modelValue\"\n @click=\"$emit('update:modelValue', item.id); $emit('change', item);\"\n />\n </li>\n </ul>\n </div>\n\t" 4478 }; 4479 4480 var SearchResultItem = { 4481 name: "SearchResultItem", 4482 props: { 4483 title: { 4484 type: String, 4485 required: true 4486 }, 4487 subtitle: { 4488 type: String, 4489 "default": "" 4490 }, 4491 active: { 4492 type: Boolean, 4493 "default": false 4494 }, 4495 url: { 4496 type: String, 4497 "default": "" 4498 } 4499 }, 4500 emits: ["click"], 4501 computed: { 4502 highlightedSubtitle: function highlightedSubtitle() { 4503 var text = this.subtitle || ""; 4504 var escaped = text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"); 4505 return escaped.replace(/<em>/g, "<b>").replace(/<\/em>/g, "</b>"); 4506 } 4507 }, 4508 // language=Vue 4509 template: "\n <li class=\"search-result__item\"\n :class=\"{ 'search-result__item--active': active }\"\n >\n <a\n :href=\"url || '#'\"\n class=\"search-result__item-link\"\n @click.prevent=\"$emit('click')\"\n >\n <div class=\"search-result__item-title\">{{ title }}</div>\n <div v-if=\"subtitle\"\n class=\"search-result__item-subtitle\"\n v-html=\"highlightedSubtitle\"\n ></div>\n </a>\n </li>\n " 4510 }; 4511 4512 var SearchResultsList = { 4513 name: "SearchResultsList", 4514 components: { 4515 SearchResultItem: SearchResultItem 4516 }, 4517 props: { 4518 items: { 4519 type: Array, 4520 required: true 4521 // [{ id, title, subtitle }
4521] 4522 }, 4523 4524 modelValue: { 4525 type: [String, Number, null], 4526 "default": null 4527 } 4528 }, 4529 emits: ["update:modelValue", "itemClick"], 4530 // language=Vue 4531 template: "\n\t\t<ul class=\"search-result__list\">\n <SearchResultItem\n v-for=\"item in items\"\n :key=\"item.id\"\n :title=\"item.title\"\n :subtitle=\"item.subtitle\"\n :url=\"item.url\"\n :active=\"item.id === modelValue\"\n @click=\"onItemClick(item)\"\n />\n\t\t</ul>\n\t", 4532 methods: { 4533 onItemClick: function onItemClick(item) { 4534 this.$emit("update:modelValue", item.id); 4535 this.$emit("itemClick", item); 4536 } 4537 } 4538 }; 4539 4540 var SearchHistoryList = { 4541 name: "SearchHistoryList", 4542 props: { 4543 history: { 4544 type: Array, 4545 "default": function _default() { 4546 return []; 4547 } 4548 } 4549 }, 4550 emits: ["select"], 4551 template: "\n <div class=\"search__content-overlay\">\n <div class=\"search-history\">\n <div class=\"search-history__title\">\u041D\u0435\u0434\u0430\u0432\u043D\u0438\u0435 \u0437\u0430\u043F\u0440\u043E\u0441\u044B:</div>\n <div class=\"search-history__list\">\n <div \n v-for=\"(item, index) in history\" \n :key=\"index\"\n class=\"search-history__item\"\n @click=\"$emit('select', item)\"\n >\n <svg class=\"search-history__item-icon\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M12.0039 3.00011C16.9745 3.00011 21.0039 7.02954 21.0039 12.0001C21.0039 16.9707 16.9745 21.0001 12.0039 21.0001C7.03334 21.0001 3.00391 16.9707 3.00391 12.0001C3.00391 7.02954 7.03334 3.00011 12.0039 3.00011ZM12.0039 4.50011C7.86177 4.50011 4.50391 7.85797 4.50391 12.0001C4.50391 16.1422 7.86177 19.5001 12.0039 19.5001C16.146 19.5001 19.5039 16.1422 19.5039 12.0001C19.5039 7.85797 16.146 4.50011 12.0039 4.50011ZM12 7.62804C12.4141 7.62804 12.7498 7.964 12.75 8.37804V11.7159L15.1523 13.2433C15.5016 13.4655 15.6048 13.929 15.3828 14.2784C15.1606 14.6279 14.6972 14.731 14.3477 14.5089L11.25 12.5401V8.37804C11.2502 7.964 11.5859 7.62804 12 7.62804Z\" fill=\"#1E2024\"/>\n </svg>\n <span class=\"search-history__item-title\">{{ item }}</span>\n </div>\n </div>\n </div>\n </div>\n " 4552 }; 4553 4554 function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } 4555 function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { babelHelpers.defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } 4556 function _regeneratorRuntime() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; }
vendor: 7,647 bytes, line 4556
4556 function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == babelHelpers["typeof"](value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEac
4556h(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; } 4557 function useSearchModel() { 4558 return { 4559 data: function data() { 4560 return { 4561 query: "", 4562 activeTab: "all", 4563 activeItemId: null, 4564 loading: false, 4565 error: "", 4566 initialized: false, 4567 tabs: [], 4568 results: [], 4569 searchHistory: [], 4570 isSearch: false, 4571 baseTabs: [], 4572 isPopup: false 4573 }; 4574 }, 4575 mounted: function mounted() { 4576 var _this = this; 4577 return babelHelpers.asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { 4578 return _regeneratorRuntime().wrap(function _callee$(_context) { 4579 while (1) switch (_context.prev = _context.next) { 4580 case 0: 4581 _context.next = 2; 4582 return _this.loadTabsConfig(); 4583 case 2: 4584 _this.loadSearchHistory(); 4585 if (!_this.isPopup) { 4586 _this.parseUrlParams(); 4587 } 4588 case 4: 4589 case "end": 4590 return _context.stop(); 4591 } 4592 }, _callee); 4593 }))(); 4594 }, 4595 computed: { 4596 filteredResults: function filteredResults() { 4597 var _this2 = this; 4598 if (this.activeTab === "all") return this.results; 4599 return this.results.filter(function (item) { 4600 return item.type === _this2.activeTab; 4601 }); 4602 }, 4603 hasResults: function hasResults() { 4604 return this.filteredResults.length > 0; 4605 }, 4606 showHistory: function showHistory() { 4607 return !this.query && !this.loading && this.searchHistory.length > 0; 4608 } 4609 }, 4610 methods: { 4611 loadSearchHistory: function loadSearchHistory() { 4612 try { 4613 var history = localStorage.getItem('searchHistory'); 4614 if (history) { 4615 this.searchHistory = JSON.parse(history).slice(-10); 4616 } 4617 } catch (e) { 4618 this.searchHistory = []; 4619 } 4620 }, 4621 saveSearchHistory: function saveSearchHistory(query) { 4622 if (!(query !== null && query !== void 0 && query.trim())) return; 4623 var trimmedQuery = query.trim(); 4624 this.searchHistory = this.searchHistory.filter(function (item) { 4625 return item !== trimmedQuery; 4626 }); 4627 this.searchHistory.unshift(trimmedQuery); 4628 this.searchHistory = this.searchHistory.slice(0, 10); 4629 try { 4630 localStorage.setItem('searchHistory', JSON.stringify(this.searchHistory)
4630); 4631 } catch (e) {} 4632 }, 4633 selectHistoryItem: function selectHistoryItem(query) { 4634 this.query = query; 4635 this.onSearch(); 4636 }, 4637 parseUrlParams: function parseUrlParams() { 4638 if (this.isPopup) return; 4639 var urlParams = new URLSearchParams(window.location.search); 4640 var qParam = urlParams.get('q'); 4641 if (qParam && qParam.trim()) { 4642 this.query = qParam.trim(); 4643 } 4644 var tabParam = urlParams.get('tab'); 4645 if (tabParam && tabParam.trim()) { 4646 var tabExists = this.baseTabs.some(function (tab) { 4647 return tab.id === tabParam; 4648 }); 4649 if (tabExists) { 4650 this.activeTab = tabParam; 4651 } 4652 } 4653 if (this.query) { 4654 this.activeTab = "all"; 4655 this.onSearch(); 4656 } 4657 }, 4658 onSearch: function onSearch() { 4659 var _this3 = this; 4660 return babelHelpers.asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() { 4661 var q, response, data, rawItems, items, counts, filteredTabs, activeTabExists, _filteredTabs$; 4662 return _regeneratorRuntime().wrap(function _callee2$(_context2) { 4663 while (1) switch (_context2.prev = _context2.next) { 4664 case 0: 4665 q = _this3.query.trim(); 4666 _this3.initialized = true; 4667 if (q) { 4668 _context2.next = 7; 4669 break; 4670 } 4671 _this3.results = []; 4672 _this3.tabs = []; 4673 _this3.updateUrlParams(); 4674 return _context2.abrupt("return"); 4675 case 7: 4676 _this3.saveSearchHistory(q); 4677 _this3.updateUrlParams(); 4678 _this3.loading = true; 4679 _this3.error = ""; 4680 _context2.prev = 11; 4681 _context2.next = 14; 4682 return BX.ajax.runAction("mendeleev:essync.searchcontroller.test", { 4683 data: { 4684 sQuery: q 4685 } 4686 }); 4687 case 14: 4688 response = _context2.sent; 4689 data = response.data || {}; 4690 if (!(data.status !== "ok")) { 4691 _context2.next = 22; 4692 break; 4693 } 4694 _this3.error = data.message || "ÐÑибка поиÑка"; 4695 _this3.results = []; 4696 _this3.tabs.forEach(function (tab) { 4697 return tab.counter = 0; 4698 }); 4699 _this3.loading = false; 4700 return _context2.abrupt("return"); 4701 case 22: 4702 rawItems = data.items || []; 4703 items = rawItems.map(function (item) { 4704 return { 4705 id: item.id, 4706 title: item.title, 4707 subtitle: item.snippet || item.body || "", 4708 type: item.type, 4709 url: item.url 4710 }; 4711 }); 4712 _this3.results = items; 4713 counts = {}; 4714 items.forEach(function (i) { 4715 if (i.type) { 4716 counts[i.type] = (counts[i.type] || 0) + 1; 4717 } 4718 }); 4719 filteredTabs = _this3.baseTabs.filter(function (tab) { 4720 return counts[tab.id] > 0; 4721 }).map(function (tab) { 4722 return _objectSpread$1(_objectSpread$1({}, tab), {}, { 4723 counter: counts[tab.id] 4724 }); 4725 }); 4726 if (filteredTabs.length > 0) { 4727 filteredTabs.unshift({ 4728 id: "all", 4729 label: "ÐÑе", 4730 counter: items.length 4731 }); 4732 } 4733 _this3.tabs = filteredTabs; 4734 activeTabExists = filteredTabs.some(function (tab) { 4735 return tab.id === _this3.activeTab; 4736 }); 4737 if (!activeTabExists) { 4738 _this3.activeTab = ((_filteredTabs$ = filteredTabs[0]) === null || _filteredTabs$ === void 0 ? void 0 : _filteredTabs$.id) || "all"; 4739 } 4740 _this3.loading = false;
4741 _this3.isSearch = true; 4742 _context2.next = 43; 4743 break; 4744 case 36: 4745 _context2.prev = 36; 4746 _context2.t0 = _context2["catch"](11); 4747 _this3.error = "ÐÑибка вÑÐ¿Ð¾Ð»Ð½ÐµÐ½Ð¸Ñ Ð¿Ð¾Ð¸Ñка"; 4748 _this3.results = []; 4749 _this3.tabs = []; 4750 _this3.loading = false; 4751 _this3.isSearch = true; 4752 case 43: 4753 case "end": 4754 return _context2.stop(); 4755 } 4756 }, _callee2, null, [[11, 36]]); 4757 }))(); 4758 }, 4759 updateUrlParams: function updateUrlParams() { 4760 if (this.isPopup) return; 4761 this.isSearch = false; 4762 var urlParams = new URLSearchParams(window.location.search); 4763 if (this.query) { 4764 urlParams.set('q', this.query); 4765 } else { 4766 urlParams["delete"]('q'); 4767 } 4768 if (this.activeTab && this.activeTab !== "all") { 4769 urlParams.set('tab', this.activeTab); 4770 } else { 4771 urlParams["delete"]('tab'); 4772 } 4773 var newUrl = window.location.pathname + (urlParams.toString() ? '?' + urlParams.toString() : ''); 4774 window.history.replaceState({}, '', newUrl); 4775 }, 4776 loadTabsConfig: function loadTabsConfig() { 4777 var _this4 = this; 4778 return babelHelpers.asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() { 4779 var response; 4780 return _regeneratorRuntime().wrap(function _callee3$(_context3) { 4781 while (1) switch (_context3.prev = _context3.next) { 4782 case 0: 4783 _context3.prev = 0; 4784 _context3.next = 3; 4785 return BX.ajax.runAction("mendeleev:essync.searchcontroller.getConfig", {}); 4786 case 3: 4787 response = _context3.sent; 4788 if (response.data.status === 'ok') { 4789 _this4.baseTabs = response.data.tabs.map(function (tab) { 4790 return { 4791 id: tab.id, 4792 label: tab.label, 4793 counter: 0 4794 }; 4795 }); 4796 } 4797 _context3.next = 11; 4798 break; 4799 case 7: 4800 _context3.prev = 7; 4801 _context3.t0 = _context3["catch"](0); 4802 console.error('ÐÑибка загÑÑзки конÑига Ñабов:', _context3.t0); 4803 _this4.baseTabs = []; 4804 case 11: 4805 case "end": 4806 return _context3.stop(); 4807 } 4808 }, _callee3, null, [[0, 7]]); 4809 }))(); 4810 }, 4811 onItemClick: function onItemClick(item) { 4812 this.activeItemId = item.id; 4813 if (item.url) window.open(item.url, "_blank"); 4814 }, 4815 onClear: function onClear() { 4816 this.query = ""; 4817 this.results = []; 4818 this.activeItemId = null; 4819 this.tabs = []; 4820 this.activeTab = "all"; 4821 this.isSearch = false; 4822 this.updateUrlParams(); 4823 },
vendor: 4,512 bytes, lines 4824-4836
4824 setActiveTab: function setActiveTab(tabId) { 4825 if (tabId && this.tabs.some(function (tab) { 4826 return tab.id === tabId; 4827 })) { 4828 this.activeTab = tabId; 4829 this.updateUrlParams(); 4830 } 4831 } 4832 } 4833 }; 4834 } 4835 4836 function _regeneratorRuntime$1() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime$1 = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == babelHelpers["typeof"](value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context);
vendor: 4,708 bytes, line 4836
4836 if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEac
4836h(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; } 4837 function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } 4838 function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) { babelHelpers.defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } 4839 var SearchPageRoot = { 4840 name: "SearchPageRoot", 4841 components: { 4842 SearchBar: SearchBar, 4843 SearchTabs: SearchTabs, 4844 SearchResultsList: SearchResultsList, 4845 SearchHistoryList: SearchHistoryList 4846 }, 4847 props: { 4848 initialQuery: { 4849 type: String, 4850 "default": "" 4851 }, 4852 initialTab: { 4853 type: String, 4854 "default": "all" 4855 } 4856 }, 4857 mixins: [useSearchModel()], 4858 data: function data() { 4859 return _objectSpread$2(_objectSpread$2({}, useSearchModel().data()), {}, { 4860 _initialTab: this.initialTab, 4861 isInitialized: false 4862 }); 4863 }, 4864 mounted: function mounted() { 4865 var _this = this; 4866 return babelHelpers.asyncToGenerator( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee() { 4867 return _regeneratorRuntime$1().wrap(function _callee$(_context) { 4868 while (1) switch (_context.prev = _context.next) { 4869 case 0: 4870 _context.next = 2;
4871 return _this.$options.mixins[0].mounted.call(_this, false); 4872 case 2: 4873 if (_this.initialQuery) { 4874 _this.query = _this.initialQuery; 4875 _this.onSearch(); 4876 } 4877 _this.isInitialized = true; 4878 case 4: 4879 case "end": 4880 return _context.stop(); 4881 } 4882 }, _callee); 4883 }))(); 4884 }, 4885 watch: { 4886 results: { 4887 handler: function handler(newResults) { 4888 var _this2 = this; 4889 if (this.isInitialized && newResults.length > 0 && this._initialTab !== 'all') { 4890 var validTab = this.tabs.find(function (tab) { 4891 return tab.id === _this2._initialTab; 4892 }); 4893 if (validTab) { 4894 this.activeTab = this._initialTab; 4895 } 4896 } 4897 }, 4898 immediate: true 4899 }, 4900 activeTab: { 4901 handler: function handler(newTab) { 4902 if (this.isInitialized) { 4903 this.updateUrl(); 4904 } 4905 }, 4906 immediate: false 4907 }, 4908 query: { 4909 handler: function handler(newQuery) { 4910 if (this.isInitialized) { 4911 this.updateUrl(); 4912 } 4913 } 4914 } 4915 }, 4916 methods: { 4917 updateUrl: function updateUrl() { 4918 var params = new URLSearchParams({ 4919 q: this.query || "", 4920 tab: this.activeTab !== "all" ? this.activeTab : "" 4921 }); 4922 var newUrl = "".concat(window.location.pathname, "?").concat(params.toString()); 4923 window.history.replaceState({}, "", newUrl); 4924 } 4925 }, 4926 // language=Vue 4927 // noinspection HtmlUnknownTag,HtmlUnknownAttribute 4928 template: "\n <div class=\"search-page\">\n <div class=\"search__droplist\">\n <SearchBar\n v-model=\"query\"\n :loading=\"loading\"\n @search=\"onSearch\"\n @clear=\"onClear\"\n @back=\"$router ? $router.back() : null\"\n />\n </div>\n <div class=\"search__popover\">\n <div v-if=\"hasResults && !loading\" class=\"search__tabs-container\">\n <SearchTabs\n v-model=\"activeTab\"\n :items=\"tabs\"\n />\n </div>\n <div class=\"search__content\">\n <SearchHistoryList\n v-if=\"showHistory\"\n :history=\"searchHistory\"\n @select=\"selectHistoryItem\"\n />\n <div v-else-if=\"!query && !loading\" class=\"search__content-overlay\">\n <span>\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043F\u043E\u0438\u0441\u043A\u043E\u0432\u044B\u0439 \u0437\u0430\u043F\u0440\u043E\u0441\u2026</span>\n </div>\n <div v-else-if=\"loading\" class=\"search__content-overlay\">\n <span>\u0418\u0449\u0435\u043C...</span>\n </div>\n <SearchResultsList\n v-else-if=\"hasResults\"\n v-model=\"activeItemId\"\n :items=\"filteredResults\"\n @itemClick=\"onItemClick\"\n />\n <div v-else-if=\"query && isSearch\" class=\"search__content-overlay\">\n <span>\u041A \u0441\u043E\u0436\u0430\u043B\u0435\u043D\u0438\u044E \u043D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043D\u0430\u0448\u043B\u043E\u0441\u044C, \u043F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0434\u0440\u0443\u0433\u043E\u0439 \u043F\u043E\u0438\u0441\u043A\u043E\u0432\u043E\u0439 \u0437\u0430\u043F\u0440\u043E\u0441</span>\n </div>\n <div v-else class=\"search__content-overlay\">\n <span>\u041D\u0430\u0436\u043C\u0438\u0442\u0435 Enter \u0434\u043B\u044F \u043F\u043E\u0438\u0441\u043A\u0430</span>\n </div>\n </div>\n </div>\n </div>\n " 4929 }; 4930 4931 var Modal = { 4932 mounted: function mounted() { 4933 document.documentElement.style.overflow = "hidden"; 4934 }, 4935 beforeUnmount: function beforeUnmount() { 4936 document.documentElement.style.overflow = ""; 4937 } 4938 }; 4939 4940 var CloseIcon = { 4941 name: "CloseIcon", 4942 emits: ["click"], 4943 // language=Vue
4944 template: "\n <span class=\"m-popup__close-btn\" @click=\"$emit('click')\">\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M18.4736 4.47065C18.7665 4.17779 19.2412 4.17771 19.5341 4.47065C19.8269 \n 4.76355 19.827 5.23834 19.5341 5.53119L13.0634 12.0009L19.5331 18.4706C19.826 18.7635 19.826 19.2383 19.5331 \n 19.5312C19.2402 19.824 18.7654 19.824 18.4726 19.5312L12.0019 13.0615L5.5341 19.5302C5.24123 19.8231 4.76647 \n 19.8231 4.47355 19.5302C4.18071 19.2373 4.18071 18.7626 4.47355 18.4697L10.9413 12.0009L4.47355 5.53119C4.1807 \n 5.23829 4.18068 4.76352 4.47355 4.47065C4.76647 4.17778 5.24123 4.17773 5.5341 4.47065L12.0029 10.9394L18.4736 \n 4.47065Z\" fill=\"#1B1B58\"/>\n </svg>\n </span>\n " 4945 }; 4946 4947 var SearchOverlay = { 4948 name: "SearchOverlay", 4949 "extends": Modal, 4950 components: { 4951 CloseIcon: CloseIcon 4952 }, 4953 props: { 4954 modelValue: { 4955 type: Boolean, 4956 "default": false 4957 }, 4958 closeOnClickOutside: { 4959 type: Boolean, 4960 "default": true 4961 }, 4962 teleportTo: { 4963 type: String, 4964 "default": "body" 4965 }, 4966 className: { 4967 type: String, 4968 "default": "" 4969 }, 4970 showCloseIcon: { 4971 type: Boolean, 4972 "default": true 4973 } 4974 }, 4975 emits: ["update:modelValue", "open", "opened", "close", "closed"], 4976 data: function data() { 4977 return { 4978 isOpen: this.modelValue 4979 }; 4980 }, 4981 watch: { 4982 modelValue: function modelValue(newVal) { 4983 if (newVal !== this.isOpen) { 4984 newVal ? this.open() : this.close(); 4985 } 4986 } 4987 }, 4988 mounted: function mounted() { 4989 if (this.modelValue) this.open(); 4990 }, 4991 methods: { 4992 open: function open() { 4993 var _this = this; 4994 this.isOpen = true; 4995 this.$emit("open"); 4996 document.documentElement.style.overflow = "hidden"; 4997 this.$nextTick(function () { 4998 return _this.$emit("opened"); 4999 }); 5000 }, 5001 close: function close() { 5002 var _this2 = this; 5003 this.$emit("close"); 5004 this.isOpen = false; 5005 document.documentElement.style.overflow = ""; 5006 this.$emit("update:modelValue", false); 5007 this.$nextTick(function () { 5008 return _this2.$emit("closed"); 5009 }); 5010 }, 5011 onOverlayClick: function onOverlayClick() { 5012 if (this.closeOnClickOutside) { 5013 this.close(); 5014 } 5015 } 5016 }, 5017 computed: { 5018 popupClass: function popupClass() { 5019 var classes = { 5020 "m-base-popup_is-open": this.isOpen 5021 }; 5022 if (this.className) { 5023 classes["m-base-popup_".concat(this.className)] = true; 5024 } 5025 return classes; 5026 } 5027 }, 5028 // language=Vue 5029 template: "\n <teleport :to=\"teleportTo\">\n <div class=\"m-base-popup\" :class=\"popupClass\" v-show=\"isOpen\">\n <div class=\"m-base-popup__overlay\" @click=\"onOverlayClick\"></div>\n <CloseIcon\n v-if=\"showCloseIcon\"\n @click=\"close\"\n class=\"m-base-popup__close-icon\"\n />\n <div class=\"m-base-popup__container\">\n <slot></slot>\n </div>\n </div>\n </teleport>\n " 5030 }; 5031 5032 var ArrowRightIcon = { 5033 name: "ArrowRightIcon", 5034 // language=Vue 5035 template: "\n <span class=\"search-icon search-icon_arrow\">\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M12.4736 4.4707C12.7665 4.17781 13.2413 4.17781 13.5342 4.4707L20.5342 11.4707C20.6748 11.6114 20.7539 11.8021 20.7539 12.001C20.7539 12.1999 20.6748 12.3906 20.5342 12.5312L13.5342 19.5312C13.2413 19.8241 12.7665 19.8241 12.4736 19.5312C12.1807 19.2384 12.1808 18.7636 12.4736 18.4707L18.1934 12.751H4.00391C3.58971 12.751 3.25394 12.4152 3.25391 12.001C3.25391 11.5868 3.58969 11.251 4.00391 11.251H18.1934L12.4736 5.53125C12.1807 5.23837 12.1808 4.7636 12.4736 4.4707Z\"\n fill=\"white\"\n />\n </svg>\n </span>\n " 5036 }; 5037 5038 function _regeneratorRuntime$2() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime$2 = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; }
vendor: 11,741 bytes, lines 5038-5041
5038 function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == babelHelpers["typeof"](value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; } 5039 function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } 5040 function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$3(Object(source), !0).forEach(function (key) { babelHelpers.defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } 5041 var TABLET_RESOLUTION = 1020;
5042 var SearchPopupRoot = { 5043 name: "SearchPopupRoot", 5044 props: { 5045 page: { 5046 type: String, 5047 "default": "" 5048 }, 5049 initialQuery: { 5050 type: String, 5051 "default": "" 5052 }, 5053 initialTab: { 5054 type: String, 5055 "default": "all" 5056 } 5057 }, 5058 components: { 5059 SearchOverlay: SearchOverlay, 5060 SearchBar: SearchBar, 5061 SearchTabs: SearchTabs, 5062 SearchResultsList: SearchResultsList, 5063 SearchHistoryList: SearchHistoryList, 5064 ArrowRightIcon: ArrowRightIcon 5065 }, 5066 mixins: [useSearchModel()], 5067 data: function data() { 5068 return _objectSpread$3(_objectSpread$3({}, useSearchModel().data()), {}, { 5069 isPopup: true, 5070 modelValue: true, 5071 isTabletView: window.innerWidth >= TABLET_RESOLUTION, 5072 _initialTab: this.initialTab, 5073 isInitialized: false 5074 }); 5075 }, 5076 mounted: function mounted() { 5077 var _this = this; 5078 return babelHelpers.asyncToGenerator( /*#__PURE__*/_regeneratorRuntime$2().mark(function _callee() { 5079 return _regeneratorRuntime$2().wrap(function _callee$(_context) { 5080 while (1) switch (_context.prev = _context.next) { 5081 case 0: 5082 _context.next = 2; 5083 return _this.$options.mixins[0].mounted.call(_this, true); 5084 case 2: 5085 if (_this.initialQuery) { 5086 _this.query = _this.initialQuery; 5087 _this.onSearch(); 5088 } 5089 _this.isInitialized = true; 5090 case 4: 5091 case "end": 5092 return _context.stop(); 5093 } 5094 }, _callee); 5095 }))(); 5096 }, 5097 watch: { 5098 results: { 5099 handler: function handler(newResults) { 5100 var _this2 = this; 5101 if (this.isInitialized && newResults.length > 0 && this._initialTab !== 'all') { 5102 var validTab = this.tabs.find(function (tab) { 5103 return tab.id === _this2._initialTab; 5104 }); 5105 if (validTab) { 5106 this.activeTab = this._initialTab; 5107 } 5108 } 5109 }, 5110 immediate: true 5111 } 5112 }, 5113 methods: { 5114 onClose: function onClose() { 5115 this.modelValue = false; 5116 }, 5117 onGoToResults: function onGoToResults() { 5118 var params = new URLSearchParams({ 5119 q: this.query, 5120 tab: this.activeTab !== "all" ? this.activeTab : "" 5121 }); 5122 window.location.href = "".concat(this.page, "?").concat(params.toString()); 5123 }, 5124 onItemClick: function onItemClick(item) { 5125 this.activeItemId = item.id; 5126 if (item.url) window.open(item.url, "_blank"); 5127 } 5128 }, 5129 // language=Vue 5130 // noinspection HtmlUnknownTag,HtmlUnknownAttribute 5131 template: "\n <SearchOverlay\n v-model=\"modelValue\"\n :close-on-click-outside=\"false\"\n :show-close-icon=\"isTabletView\"\n @closed=\"activeItemId = null\"\n >\n <div class=\"search-popup\">\n <div class=\"search__droplist\">\n <SearchBar\n v-model=\"query\"\n :loading=\"loading\"\n @search=\"onSearch\"\n @clear=\"onClear\"\n @back=\"onClose\"\n />\n <div class=\"search__popover\">\n <div v-if=\"hasResults && !loading\" class=\"search__tabs-container\">\n <SearchTabs\n v-model=\"activeTab\"\n :items=\"tabs\"\n />\n </div>\n <div class=\"search__content\" :class=\"{ 'search__content--empty': !hasResults }\">\n <SearchHistoryList\n v-if=\"showHistory\"\n :history=\"searchHistory\"\n @select=\"selectHistoryItem\"\n />\n <div v-else-if=\"!query && !loading\" class=\"search__content-overlay\">
5131\n <span>\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043F\u043E\u0438\u0441\u043A\u043E\u0432\u044B\u0439 \u0437\u0430\u043F\u0440\u043E\u0441\u2026</span>\n </div>\n <div v-else-if=\"loading\" class=\"search__content-overlay\">\n <span>\u0418\u0449\u0435\u043C...</span>\n </div>\n <SearchResultsList\n v-else-if=\"hasResults\"\n v-model=\"activeItemId\"\n :items=\"filteredResults\"\n @itemClick=\"onItemClick\"\n />\n <div v-else-if=\"query && isSearch\" class=\"search__content-overlay\">\n <span>\u041A \u0441\u043E\u0436\u0430\u043B\u0435\u043D\u0438\u044E \u043D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043D\u0430\u0448\u043B\u043E\u0441\u044C, \u043F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0434\u0440\u0443\u0433\u043E\u0439 \u043F\u043E\u0438\u0441\u043A\u043E\u0432\u043E\u0439 \u0437\u0430\u043F\u0440\u043E\u0441</span>\n </div>\n <div v-else class=\"search__content-overlay\">\n <span>\u041D\u0430\u0436\u043C\u0438\u0442\u0435 Enter \u0434\u043B\u044F \u043F\u043E\u0438\u0441\u043A\u0430</span>\n </div>\n </div>\n <div v-if=\"hasResults\"\n class=\"search__actions\">\n <button\n class=\"search__button-primary\"\n type=\"button\"\n @click=\"onGoToResults\" \n >\n <span>\u041F\u0435\u0440\u0435\u0439\u0442\u0438 \u043A \u0440\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442\u0430\u043C</span>\n <ArrowRightIcon/>\n </button>\n </div>\n </div>\n </div>\n </div>\n </SearchOverlay>\n " 5132 }; 5133 5134 function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } 5135 function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$4(Object(source), !0).forEach(function (key) { babelHelpers.defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } 5136 function mountVue(rootComponent, params) { 5137 var app = BX.Vue3.createApp(rootComponent, params.props || {}); 5138 app.mount(params.container); 5139 return app; 5140 } 5141 var SearchPage = function SearchPage(params) { 5142 babelHelpers.classCallCheck(this, SearchPage); 5143 var urlParams = new URLSearchParams(window.location.search); 5144 var query = urlParams.get("q") || ""; 5145 var tab = urlParams.get("tab") || "all"; 5146 this.app = mountVue(SearchPageRoot, _objectSpread$4(_objectSpread$4({}, params), {}, { 5147 props: { 5148 initialQuery: query, 5149 initialTab: tab 5150 } 5151 })); 5152 }; 5153 var SearchPopup = function SearchPopup(params) { 5154 babelHelpers.classCallCheck(this, SearchPopup); 5155 this.app = mountVue(SearchPopupRoot, _objectSpread$4(_objectSpread$4({}, params), {}, { 5156 props: { 5157 page: params.page 5158 } 5159 })); 5160 }; 5161 5162 exports.SearchPage = SearchPage; 5163 exports.SearchPopup = SearchPopup; 5164 5165}
5165((this.BX.ESSYNC = this.BX.ESSYNC || {}),BX)); 5166//# sourceMappingURL=search.bundle.js.map
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.